/trunk
self:RegisterEvent("PLAYER_REGEN_DISABLED") |
self:RegisterEvent("PLAYER_REGEN_ENABLED") |
self:ScheduleRepeatingTimer("ExpireItems", 1) |
self:ScheduleRepeatingTimer("ExpireItems", 10) |
-- Delay frame display so that player does not show as offline |
self:RegisterEvent("PLAYER_ENTERING_WORLD") |
function NeedyGreedy:RecordReceived(link, player) |
local _, _, quality = GetItemInfo(link) |
if quality < self.db.profile.quality then return end |
-- Because disenchanted items can be white >_<9 |
if quality < ITEM_QUALITY_COMMON then return end |
local match = false |
for rollid, record in pairs(items) do |
match = true |
break |
end |
-- Since players receive disenchanted items not link |
if record.choices[player] == "disenchant" and record.assigned == player and record.received == 0 then |
record.received = GetTime() |
end |
end |
if not match then |
end |
end |
if not match then |
for rollid, record in pairs(items) do |
-- Since players receive the results of the disenchant, we will never be |
-- able to match the link that triggered the received message against |
-- our list. However, we should cross disenchanted items that have been |
-- assigned off the list as we find them on the assumption that they |
-- would have automatically received the item anyway. |
if record.choices[player] == "disenchant" and record.assigned == player and record.received == 0 then |
record.received = GetTime() |
end |
end |
end |
self:UpdateReport() |
end |
-- Unit tests |
function NeedyGreedy:SetItems(itemList) |
items = itemList |
self:UpdateReport() |
end |
function NeedyGreedy:TestItemList() |