Mercurial > wow > ouroloot
changeset 66:43913e02a1ef
Detect LFR loot as best we can, and bundle it into the same warning given for heroic loot formatted by name only. Less tedious method of bumping data revisions.
author | Farmbuyer of US-Kilrogg <farmbuyer@gmail.com> |
---|---|
date | Fri, 27 Apr 2012 10:11:56 +0000 |
parents | 69fd720f853e |
children | c01875b275ca |
files | core.lua text_tabs.lua |
diffstat | 2 files changed, 40 insertions(+), 19 deletions(-) [+] |
line wrap: on
line diff
--- a/core.lua Fri Apr 27 09:12:45 2012 +0000 +++ b/core.lua Fri Apr 27 10:11:56 2012 +0000 @@ -56,7 +56,7 @@ - count e.g., "x3"; missing otherwise; can be set/removed from extratext; triggers only for a stack of items, not "the boss dropped double axes today" -- is_heroic true if item is heroic; missing otherwise +- variant 1 = heroic item, 2 = LFR item; missing otherwise - cache_miss if GetItemInfo failed; SHOULD be missing (changes other fields) - bcast_from player's name if received rebroadcast from that player; missing otherwise; can be deleted as a result of in-game @@ -107,7 +107,7 @@ ------ Constants local option_defaults = { - ['datarev'] = 17, -- cheating, this isn't actually an option + ['datarev'] = 18, -- cheating, this isn't actually an option ['popup_on_join'] = true, ['register_slashloot'] = true, ['scroll_to_bottom'] = true, @@ -470,7 +470,7 @@ virgin = nil end opts = OuroLootSV_opts - local stored_datarev = opts.datarev + local stored_datarev = opts.datarev or 14 for opt,default in pairs(option_defaults) do if opts[opt] == nil then opts[opt] = default @@ -542,17 +542,16 @@ -- Handle changes to the stored data format in stages from oldest to newest. if OuroLootSV then local dirty = false - if stored_datarev == nil then - self:Print("Transitioning saved data format to 15..."); dirty = true + local bumpers = {} + bumpers[14] = function() for i,e in ipairs(OuroLootSV) do if e.bosskill then e.bossname, e.bosskill = e.bosskill, nil end end - stored_datarev = 15 end - if stored_datarev == 15 then - self:Print("Transitioning saved data format to 16..."); dirty = true + + bumpers[15] = function() for i,e in ipairs(OuroLootSV) do if e.kind == 'boss' then e.maxsize, e.raiderlist, e.raidersnap = 0, nil, {} @@ -562,25 +561,45 @@ for name,r in pairs(OuroLootSV.raiders) do r.subgroup = 0 end - stored_datarev = 16 end - if stored_datarev == 16 then - self:Print("Transitioning saved data format to 17..."); dirty = true + + bumpers[16] = function() for i,e in ipairs(OuroLootSV) do if e.kind == 'boss' then -- brown paper bag bugs e.raidersnap = e.raidersnap or {} e.maxsize = e.maxsize or 0 end end - stored_datarev = 17 + end + + bumpers[17] = function() + for i,e in ipairs(OuroLootSV) do + if e.kind == 'loot' and e.is_heroic then + e.variant, e.is_heroic = 1, nil + -- Could try detecting any previous LFR loot here, but... gah + end + end + end + + --[===[ + local real = bumpers + bumpers = newproxy(true) + local mt = getmetatable(bumpers) + mt.__index = real + mt.__gc = function() print"whadda ya know, garbage collection works" end ]===] + + while stored_datarev < opts.datarev do + self:Printf("Transitioning saved data format to %d...", stored_datarev+1) + dirty = true + bumpers[stored_datarev]() + stored_datarev = stored_datarev + 1 end if dirty then self:Print("Saved data has been massaged into shape.") end - assert(stored_datarev==opts.datarev) end _init(self) self.dprint('flow', "version strings:", revision_large, self.status_text) - self.OnInitialize = nil + self.OnInitialize = nil -- free up ALL the things! end function addon:OnEnable() @@ -1028,7 +1047,7 @@ count = (count and count ~= "") and count or nil, bcast_from = from, extratext = extratext, - is_heroic = self:is_heroic_item(ilink), + variant = self:is_variant_item(ilink), } if local_override then -- player is adding loot by hand, don't wait for network cache timeouts @@ -1432,14 +1451,16 @@ tip.lefts = lefts return tip end - function addon:is_heroic_item(item) -- returns true or *nil* + function addon:is_variant_item(item) -- returns number or *nil* itt = itt or create() itt:SetOwner(UIParent,"ANCHOR_NONE") itt:ClearLines() itt:SetHyperlink(item) local t = itt.lefts[2]:GetText() itt:Hide() - return (t == ITEM_HEROIC) or nil + return (t == ITEM_HEROIC and 1) + or (t == RAID_FINDER and 2) -- no ITEM_ for this, apparently + or nil end end
--- a/text_tabs.lua Fri Apr 27 09:12:45 2012 +0000 +++ b/text_tabs.lua Fri Apr 27 10:11:56 2012 +0000 @@ -48,7 +48,7 @@ do local red = '|cffff0505' local green = ITEM_QUALITY_COLORS[ITEM_QUALITY_UNCOMMON].hex - warning_text = ([[%sWARNING:|r Heroic items sharing the same name as normal items often display incorrectly on forums that use the item name as the identifier. Recommend you change the %sItem markup|r dropdown in the right-hand side to %s"[item] by ID"|r and regenerate this loot.]]):format(red, green, green) + warning_text = ([[%sWARNING:|r Heroic (and Raid Finder) items sharing the same name as normal items often display incorrectly on forums that use the item name as the identifier. Recommend you change the %sItem markup|r dropdown in the right-hand side to %s"[item] by ID"|r (or some other format that uses $I) and regenerate this loot.]]):format(red, green, green) end local function forum (_, loot, last_printed, generated, cache) @@ -72,7 +72,7 @@ if e.extratext_byhand then disp = disp .. " -- " .. e.extratext end - if e.is_heroic and not forum_warned_heroic then + if e.variant and not forum_warned_heroic then forum_warned_heroic = true addon:Print(warning_text) end