comparison core.lua @ 34:f1d0a5d7b006

Manual loot insertion should not go through recent cache.
author Farmbuyer of US-Kilrogg <farmbuyer@gmail.com>
date Wed, 07 Dec 2011 08:27:58 +0000
parents 47949f8eb783
children f75329fe5758
comparison
equal deleted inserted replaced
33:076a44f30a8b 34:f1d0a5d7b006
669 local candidates = {} 669 local candidates = {}
670 local function prefer_local_loots (cache) 670 local function prefer_local_loots (cache)
671 -- The function name is a bit of a misnomer, as local entries overwrite 671 -- The function name is a bit of a misnomer, as local entries overwrite
672 -- remote entries as the candidate table is populated. This routine is 672 -- remote entries as the candidate table is populated. This routine is
673 -- to extract the results once the cache timers have expired. 673 -- to extract the results once the cache timers have expired.
674 -- Keep this sync'd with the local_override branch below.
674 for i,sig in ipairs(candidates) do 675 for i,sig in ipairs(candidates) do
675 addon.dprint('loot', "processing candidate entry", i, sig) 676 addon.dprint('loot', "processing candidate entry", i, sig)
676 local loot = candidates[sig] 677 local loot = candidates[sig]
677 if loot then 678 if loot then
678 addon.dprint('loot', i, "was found") 679 addon.dprint('loot', i, "was found")
717 if (not self.enabled) and (not local_override) then break end 718 if (not self.enabled) and (not local_override) then break end
718 local signature = recipient .. iname .. (count or "") 719 local signature = recipient .. iname .. (count or "")
719 if from and self.recent_loot:test(signature) then 720 if from and self.recent_loot:test(signature) then
720 self.dprint('cache', "loot <",signature,"> already in cache, skipping") 721 self.dprint('cache', "loot <",signature,"> already in cache, skipping")
721 else 722 else
722 self.recent_loot:add(signature)
723 -- There is some redundancy in all this, in the interests of ease-of-coding 723 -- There is some redundancy in all this, in the interests of ease-of-coding
724 i = { 724 i = {
725 kind = 'loot', 725 kind = 'loot',
726 person = recipient, 726 person = recipient,
727 person_class= select(2,UnitClass(recipient)), 727 person_class= select(2,UnitClass(recipient)),
735 count = count, 735 count = count,
736 bcast_from = from, 736 bcast_from = from,
737 extratext = extratext, 737 extratext = extratext,
738 is_heroic = self:is_heroic_item(ilink), 738 is_heroic = self:is_heroic_item(ilink),
739 } 739 }
740 candidates[signature] = i 740 if local_override then
741 tinsert (candidates, signature) 741 -- adding things by hand, don't wait for network cache timeouts
742 self.dprint('cache', "loot <",signature,"> added to cache, candidate", #candidates) 742 if i.extratext == 'shard'
743 or i.extratext == 'gvault'
744 or i.extratext == 'offspec'
745 then
746 i.disposition = i.extratext
747 end
748 local looti = self._addLootEntry(i)
749 if (i.disposition ~= 'shard')
750 and (i.disposition ~= 'gvault')
751 and (not self.history_suppress)
752 then
753 self:_addHistoryEntry(looti)
754 end
755 i = looti -- mostly for gui's manual entry
756 else
757 self.recent_loot:add(signature)
758 candidates[signature] = i
759 tinsert (candidates, signature)
760 self.dprint('cache', "loot <",signature,"> added to cache, candidate", #candidates)
761 end
743 end 762 end
744 break 763 break
745 end 764 end
746 self.dprint('loot',"<<_do_loot out") 765 self.dprint('loot',"<<_do_loot out")
747 return i 766 return i