Mercurial > wow > ouroloot
diff gui.lua @ 129:2731702567c4
- Detect loot received in LFR when player isn't eligible (for the strange
people out there who are tracking in LFR).
- Followup for r116, make sure all entries in display table are properly
updated. Add a force-refresh button to the Help tab for the worst case.
author | Farmbuyer of US-Kilrogg <farmbuyer@gmail.com> |
---|---|
date | Mon, 27 Aug 2012 02:53:42 -0400 |
parents | dc39ce56a62d |
children | 08d3d2b7c31d |
line wrap: on
line diff
--- a/gui.lua Wed Aug 22 23:37:24 2012 -0400 +++ b/gui.lua Mon Aug 27 02:53:42 2012 -0400 @@ -65,6 +65,7 @@ local pairs, ipairs, tinsert, tremove, tostring, tonumber = pairs, ipairs, table.insert, table.remove, tostring, tonumber +local math_min, math_huge = math.min, math.huge local pprint, tabledump = addon.pprint, flib.tabledump local GetItemInfo, ITEM_QUALITY_COLORS = GetItemInfo, ITEM_QUALITY_COLORS @@ -138,17 +139,20 @@ ["LEN"] = function() return #g_loot end, - -- returns the display's entry and the core entry + -- returns the core entry and the display's entry ["remove"] = function (dt, i) - local reale = tremove (g_loot, i) - return tremove (dt, i), reale + return tremove (g_loot, i), tremove (dt, i) end, - -- counterpart - --[[ - ["insert"] = function (dt, i, displaye, reale) + -- counterpart; display entry is optional + ["insert"] = function (dt, i, reale, displaye) tinsert (g_loot, i, reale) - tinsert (dt, i, displaye) - end,]] + if displaye then + tinsert (dt, i, displaye) + else + tinsert (dt, i, 42) -- grow it + dt[i] = nil -- force the index metamethod to trigger + end + end, } local function wrap_e (t,index) local real = g_loot[index] @@ -371,8 +375,10 @@ relevant" bits (icons, user-friendly labels, etc) in the g_dloot table, which inherits (so to speak) the corresponding row entries. -Everything from the loot_clean index to the end of the table is filled out; -loot_clean is updated. Override this starting point with the function arg. +This is called *often*, so we try to minimize waste by keeping track of the +last known index known to have updated info. Everything from the loot_clean +index to the end of the table is filled out; loot_clean is updated. Override +this starting point with the function argument. ]] function addon:_fill_out_eoi_data (opt_starting_index) if #g_loot < 1 then @@ -385,7 +391,9 @@ local colcount = #eoi_st_cols -- 'while true' so that we can use (inner) break as (outer) continue - for i = (opt_starting_index or self.loot_clean or 1), #g_loot do while true do + local start = opt_starting_index or + math_min (#g_dloot, self.loot_clean or math_huge, #g_loot) + for i = start, #g_loot do while true do local e = g_dloot[i] if e == nil then self.loot_clean = nil @@ -832,11 +840,19 @@ end end --- Done at startup, and whenever we've changed the population of tabs. -function addon:gui_init (loot_pointer, uniques_pointer) - g_loot = assert(loot_pointer, "something went wrong at startup") - g_uniques = assert(uniques_pointer, "something went wrong at startup") +-- Done at startup, and whenever we've changed the population of tabs. Can +-- be triggered by player. In the first case only, the arguments are passed. +function addon:gui_init (at_init_p, loot_pointer, uniques_pointer) + if at_init_p then + g_loot = assert(loot_pointer, "something went wrong at startup") + g_uniques = assert(uniques_pointer, "something went wrong at startup") + end g_dloot = do_g_loot_wrap(g_loot) + gui.g_dloot = g_dloot -- primarily for clean deletion + if gui.eoiST then -- re-init + self:_fill_out_eoi_data(1) + gui.eoiST:SetData(g_dloot) + end g_generated = nil tabgroup_tabs = {} window_title = "Ouro Loot " .. self.version @@ -924,7 +940,7 @@ end, df_DELETE = function(rowi) - local dgone, gone = g_dloot:remove(rowi) + local gone, dgone = g_dloot:remove(rowi) addon:Fire ('DelEOIEntry', gone) addon:Print("Removed %s.", gone.itemlink or gone.bossname or gone.startday.text) @@ -1310,6 +1326,16 @@ local e = data[realrow] local cell = e.cols[column] + if not cell then + pprint('default_cellupdate', "row", realrow, "had no cell in col", + column, "retrying from first row") + addon:_fill_out_eoi_data(1) + cell = e.cols[column] + if not cell then + pprint('default_cellupdate', "FAILED, bailing") + return + end + end cellFrame.text:SetText(cell.value) -- subset of what the default ST's docellupdate looks for @@ -2101,8 +2127,8 @@ UIDROPDOWNMENU_SHOW_TIME = 4 if dirty_tabs then - -- pointers known to be good by now, pass them back in - self:gui_init (g_loot, g_uniques) + self.dprint('flow', "dirty flag set in BuildMainDisplay, recreating!") + self:gui_init() self:zero_printed_fenceposts() end gui.opts = self.db.profile @@ -2573,7 +2599,7 @@ raidersnap = data.yes_snap or {}, } local entry = tremove(g_loot,boss_index) - tinsert(g_loot,data.rowindex,entry) + g_dloot:insert (data.rowindex, entry) addon:_mark_boss_kill(data.rowindex) gui.eoiST:OuroLoot_Refresh(data.rowindex) local jumpprefix = addon.chatprefix ("GoToLootLine", data.rowindex) @@ -2627,7 +2653,7 @@ data.display:Hide() local loot_index = assert(addon:CHAT_MSG_LOOT ("manual", data.recipient, data.name, data.notes)) local entry = tremove(g_loot,loot_index) - tinsert(g_loot,data.rowindex,entry) + g_dloot:insert (data.rowindex, entry) addon:_fill_out_eoi_data(data.rowindex) addon:BuildMainDisplay() local clicky = _new_rebroadcast_hyperlink (entry.unique)