comparison core.lua @ 39:8f7ec6ccf5e3

Comment/debug changes to help in tracking down cache bug. Do not run OnAccept when pressing Enter in an empty editbox.
author Farmbuyer of US-Kilrogg <farmbuyer@gmail.com>
date Thu, 29 Dec 2011 23:15:51 +0000
parents bb41be8f13b2
children dc3a66688e50
comparison
equal deleted inserted replaced
38:bb41be8f13b2 39:8f7ec6ccf5e3
695 -- Recent loot cache 695 -- Recent loot cache
696 local candidates = {} 696 local candidates = {}
697 local function prefer_local_loots (cache) 697 local function prefer_local_loots (cache)
698 -- The function name is a bit of a misnomer, as local entries overwrite 698 -- The function name is a bit of a misnomer, as local entries overwrite
699 -- remote entries as the candidate table is populated. This routine is 699 -- remote entries as the candidate table is populated. This routine is
700 -- here to extract the results once the cache timers have expired. 700 -- here to extract the final results once the cache timers have expired.
701 -- 701 --
702 -- Keep this sync'd with the local_override branch below. 702 -- Keep this sync'd with the local_override branch below.
703 for i,sig in ipairs(candidates) do 703 for i,sig in ipairs(candidates) do
704 addon.dprint('loot', "processing candidate entry", i, sig) 704 addon.dprint('loot', "processing candidate entry", i, sig)
705 local loot = candidates[sig] 705 local loot = candidates[sig]
736 UNKNOWN..': '..itemid, 'item:6948', ITEM_QUALITY_COMMON, [[ICONS\INV_Misc_QuestionMark]] 736 UNKNOWN..': '..itemid, 'item:6948', ITEM_QUALITY_COMMON, [[ICONS\INV_Misc_QuestionMark]]
737 end 737 end
738 self.dprint('loot',">>_do_loot, R:", recipient, "I:", itemid, "C:", count, "frm:", from, "ex:", extratext, "q:", iquality) 738 self.dprint('loot',">>_do_loot, R:", recipient, "I:", itemid, "C:", count, "frm:", from, "ex:", extratext, "q:", iquality)
739 739
740 itemid = tonumber(ilink:match("item:(%d+)") or 0) 740 itemid = tonumber(ilink:match("item:(%d+)") or 0)
741 -- This is only a loop to make jumping out of it easy, and still do cleanup below. 741 -- This is only a 'while' to make jumping out of it easy and still do cleanup below.
742 while local_override or ((iquality >= self.threshold) and not opts.itemfilter[itemid]) do 742 while local_override or ((iquality >= self.threshold) and not opts.itemfilter[itemid]) do
743 if (self.rebroadcast and (not from)) and not local_override then 743 if (self.rebroadcast and (not from)) and not local_override then
744 self:broadcast('loot', recipient, itemid, count) 744 self:broadcast('loot', recipient, itemid, count)
745 end 745 end
746 if (not self.enabled) and (not local_override) then break end 746 if (not self.enabled) and (not local_override) then break end
747 local signature = recipient .. iname .. (count or "") 747 local signature = recipient .. iname .. (count or "")
748 if from and self.recent_loot:test(signature) then 748 if from and self.recent_loot:test(signature) then
749 self.dprint('cache', "loot <",signature,"> already in cache, skipping") 749 self.dprint('cache', "remote loot <",signature,"> already in cache, skipping")
750 else 750 else
751 -- There is some redundancy in all this, in the interests of ease-of-coding 751 -- There is some redundancy in all this, in the interests of ease-of-coding
752 i = { 752 i = {
753 kind = 'loot', 753 kind = 'loot',
754 person = recipient, 754 person = recipient,
764 bcast_from = from, 764 bcast_from = from,
765 extratext = extratext, 765 extratext = extratext,
766 is_heroic = self:is_heroic_item(ilink), 766 is_heroic = self:is_heroic_item(ilink),
767 } 767 }
768 if local_override then 768 if local_override then
769 -- adding things by hand, don't wait for network cache timeouts 769 -- player is adding loot by hand, don't wait for network cache timeouts
770 -- keep this sync'd with prefer_local_loots above
770 if i.extratext == 'shard' 771 if i.extratext == 'shard'
771 or i.extratext == 'gvault' 772 or i.extratext == 'gvault'
772 or i.extratext == 'offspec' 773 or i.extratext == 'offspec'
773 then 774 then
774 i.disposition = i.extratext 775 i.disposition = i.extratext
778 and (i.disposition ~= 'gvault') 779 and (i.disposition ~= 'gvault')
779 and (not self.history_suppress) 780 and (not self.history_suppress)
780 then 781 then
781 self:_addHistoryEntry(looti) 782 self:_addHistoryEntry(looti)
782 end 783 end
783 i = looti -- mostly for gui's manual entry 784 i = looti -- return value mostly for gui's manual entry
784 else 785 else
785 self.recent_loot:add(signature) 786 self.recent_loot:add(signature)
786 candidates[signature] = i 787 candidates[signature] = i
787 tinsert (candidates, signature) 788 tinsert (candidates, signature)
788 self.dprint('cache', "loot <",signature,"> added to cache, candidate", #candidates) 789 self.dprint('cache', "loot <",signature,"> added to cache as candidate", #candidates)
789 end 790 end
790 end 791 end
791 break 792 break
792 end 793 end
793 self.dprint('loot',"<<_do_loot out") 794 self.dprint('loot',"<<_do_loot out")
1278 if reason == 'wipe' and opts.no_tracking_wipes then break end 1279 if reason == 'wipe' and opts.no_tracking_wipes then break end
1279 bossname = (opts.snarky_boss and self.boss_abbrev[bossname] or bossname) or bossname 1280 bossname = (opts.snarky_boss and self.boss_abbrev[bossname] or bossname) or bossname
1280 local not_from_local = duration == nil 1281 local not_from_local = duration == nil
1281 local signature = bossname .. reason 1282 local signature = bossname .. reason
1282 if not_from_local and self.recent_boss:test(signature) then 1283 if not_from_local and self.recent_boss:test(signature) then
1283 self.dprint('cache', "boss <",signature,"> already in cache, skipping") 1284 self.dprint('cache', "remote boss <",signature,"> already in cache, skipping")
1284 else 1285 else
1285 self.recent_boss:add(signature) 1286 self.recent_boss:add(signature)
1286 g_boss_signpost = #g_loot + 1 1287 g_boss_signpost = #g_loot + 1
1287 self.dprint('loot', "added boss signpost", g_boss_signpost) 1288 self.dprint('loot', "added boss signpost", g_boss_signpost)
1288 -- Possible scenarios: (1) we don't see a boss event at all (e.g., we're 1289 -- Possible scenarios: (1) we don't see a boss event at all (e.g., we're