Mercurial > wow > ouroloot
comparison 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 |
comparison
equal
deleted
inserted
replaced
128:dc39ce56a62d | 129:2731702567c4 |
---|---|
63 local error = addon.error | 63 local error = addon.error |
64 local assert = addon.assert | 64 local assert = addon.assert |
65 | 65 |
66 local pairs, ipairs, tinsert, tremove, tostring, tonumber = | 66 local pairs, ipairs, tinsert, tremove, tostring, tonumber = |
67 pairs, ipairs, table.insert, table.remove, tostring, tonumber | 67 pairs, ipairs, table.insert, table.remove, tostring, tonumber |
68 local math_min, math_huge = math.min, math.huge | |
68 | 69 |
69 local pprint, tabledump = addon.pprint, flib.tabledump | 70 local pprint, tabledump = addon.pprint, flib.tabledump |
70 local GetItemInfo, ITEM_QUALITY_COLORS = GetItemInfo, ITEM_QUALITY_COLORS | 71 local GetItemInfo, ITEM_QUALITY_COLORS = GetItemInfo, ITEM_QUALITY_COLORS |
71 local GetNumRaidMembers = GetNumGroupMembers or GetNumRaidMembers | 72 local GetNumRaidMembers = GetNumGroupMembers or GetNumRaidMembers |
72 local IsInRaid = IsInRaid or (function() return GetNumRaidMembers() > 0 end) | 73 local IsInRaid = IsInRaid or (function() return GetNumRaidMembers() > 0 end) |
136 local wrappers = { | 137 local wrappers = { |
137 -- WTB Lua 5.2 instead of this | 138 -- WTB Lua 5.2 instead of this |
138 ["LEN"] = function() | 139 ["LEN"] = function() |
139 return #g_loot | 140 return #g_loot |
140 end, | 141 end, |
141 -- returns the display's entry and the core entry | 142 -- returns the core entry and the display's entry |
142 ["remove"] = function (dt, i) | 143 ["remove"] = function (dt, i) |
143 local reale = tremove (g_loot, i) | 144 return tremove (g_loot, i), tremove (dt, i) |
144 return tremove (dt, i), reale | |
145 end, | 145 end, |
146 -- counterpart | 146 -- counterpart; display entry is optional |
147 --[[ | 147 ["insert"] = function (dt, i, reale, displaye) |
148 ["insert"] = function (dt, i, displaye, reale) | |
149 tinsert (g_loot, i, reale) | 148 tinsert (g_loot, i, reale) |
150 tinsert (dt, i, displaye) | 149 if displaye then |
151 end,]] | 150 tinsert (dt, i, displaye) |
151 else | |
152 tinsert (dt, i, 42) -- grow it | |
153 dt[i] = nil -- force the index metamethod to trigger | |
154 end | |
155 end, | |
152 } | 156 } |
153 local function wrap_e (t,index) | 157 local function wrap_e (t,index) |
154 local real = g_loot[index] | 158 local real = g_loot[index] |
155 if not real then return nil end | 159 if not real then return nil end |
156 | 160 |
369 The g_loot table is populated only with "behavior-relevant" data (names, | 373 The g_loot table is populated only with "behavior-relevant" data (names, |
370 links, etc). This function runs through it and fills out the "display- | 374 links, etc). This function runs through it and fills out the "display- |
371 relevant" bits (icons, user-friendly labels, etc) in the g_dloot table, | 375 relevant" bits (icons, user-friendly labels, etc) in the g_dloot table, |
372 which inherits (so to speak) the corresponding row entries. | 376 which inherits (so to speak) the corresponding row entries. |
373 | 377 |
374 Everything from the loot_clean index to the end of the table is filled out; | 378 This is called *often*, so we try to minimize waste by keeping track of the |
375 loot_clean is updated. Override this starting point with the function arg. | 379 last known index known to have updated info. Everything from the loot_clean |
380 index to the end of the table is filled out; loot_clean is updated. Override | |
381 this starting point with the function argument. | |
376 ]] | 382 ]] |
377 function addon:_fill_out_eoi_data (opt_starting_index) | 383 function addon:_fill_out_eoi_data (opt_starting_index) |
378 if #g_loot < 1 then | 384 if #g_loot < 1 then |
379 --pprint('_f_o_e_d', "#g_loot<1") | 385 --pprint('_f_o_e_d', "#g_loot<1") |
380 self.loot_clean = nil | 386 self.loot_clean = nil |
383 | 389 |
384 local display_bcast_from = self.db.profile.display_bcast_from | 390 local display_bcast_from = self.db.profile.display_bcast_from |
385 local colcount = #eoi_st_cols | 391 local colcount = #eoi_st_cols |
386 | 392 |
387 -- 'while true' so that we can use (inner) break as (outer) continue | 393 -- 'while true' so that we can use (inner) break as (outer) continue |
388 for i = (opt_starting_index or self.loot_clean or 1), #g_loot do while true do | 394 local start = opt_starting_index or |
395 math_min (#g_dloot, self.loot_clean or math_huge, #g_loot) | |
396 for i = start, #g_loot do while true do | |
389 local e = g_dloot[i] | 397 local e = g_dloot[i] |
390 if e == nil then | 398 if e == nil then |
391 self.loot_clean = nil | 399 self.loot_clean = nil |
392 pprint('_f_o_e_d', "index",i,"somehow still in loop past",#g_loot,"bailing") | 400 pprint('_f_o_e_d', "index",i,"somehow still in loop past",#g_loot,"bailing") |
393 -- hmm. used to bail here. does restarting instead cause problems? | 401 -- hmm. used to bail here. does restarting instead cause problems? |
830 self.register_tab_control_AT_END = nil | 838 self.register_tab_control_AT_END = nil |
831 self.FINISH_SPECIAL_TABS = nil | 839 self.FINISH_SPECIAL_TABS = nil |
832 end | 840 end |
833 end | 841 end |
834 | 842 |
835 -- Done at startup, and whenever we've changed the population of tabs. | 843 -- Done at startup, and whenever we've changed the population of tabs. Can |
836 function addon:gui_init (loot_pointer, uniques_pointer) | 844 -- be triggered by player. In the first case only, the arguments are passed. |
837 g_loot = assert(loot_pointer, "something went wrong at startup") | 845 function addon:gui_init (at_init_p, loot_pointer, uniques_pointer) |
838 g_uniques = assert(uniques_pointer, "something went wrong at startup") | 846 if at_init_p then |
847 g_loot = assert(loot_pointer, "something went wrong at startup") | |
848 g_uniques = assert(uniques_pointer, "something went wrong at startup") | |
849 end | |
839 g_dloot = do_g_loot_wrap(g_loot) | 850 g_dloot = do_g_loot_wrap(g_loot) |
851 gui.g_dloot = g_dloot -- primarily for clean deletion | |
852 if gui.eoiST then -- re-init | |
853 self:_fill_out_eoi_data(1) | |
854 gui.eoiST:SetData(g_dloot) | |
855 end | |
840 g_generated = nil | 856 g_generated = nil |
841 tabgroup_tabs = {} | 857 tabgroup_tabs = {} |
842 window_title = "Ouro Loot " .. self.version | 858 window_title = "Ouro Loot " .. self.version |
843 -- TabGroup stretches out the tabs to fill the row but only if >75% of the | 859 -- TabGroup stretches out the tabs to fill the row but only if >75% of the |
844 -- row is already full. It turns out that not doing this looks like ass. | 860 -- row is already full. It turns out that not doing this looks like ass. |
922 dialog.editBox:SetScript("OnTextChanged",StaticPopup_EditBoxOnTextChanged) | 938 dialog.editBox:SetScript("OnTextChanged",StaticPopup_EditBoxOnTextChanged) |
923 dialog.data = {rowindex=rowi, display=_d, kind=text} | 939 dialog.data = {rowindex=rowi, display=_d, kind=text} |
924 end, | 940 end, |
925 | 941 |
926 df_DELETE = function(rowi) | 942 df_DELETE = function(rowi) |
927 local dgone, gone = g_dloot:remove(rowi) | 943 local gone, dgone = g_dloot:remove(rowi) |
928 addon:Fire ('DelEOIEntry', gone) | 944 addon:Fire ('DelEOIEntry', gone) |
929 addon:Print("Removed %s.", | 945 addon:Print("Removed %s.", |
930 gone.itemlink or gone.bossname or gone.startday.text) | 946 gone.itemlink or gone.bossname or gone.startday.text) |
931 if gone.kind == 'loot' then | 947 if gone.kind == 'loot' then |
932 addon:Fire ('DelLootEntry', gone) | 948 addon:Fire ('DelLootEntry', gone) |
1308 return | 1324 return |
1309 end | 1325 end |
1310 | 1326 |
1311 local e = data[realrow] | 1327 local e = data[realrow] |
1312 local cell = e.cols[column] | 1328 local cell = e.cols[column] |
1329 if not cell then | |
1330 pprint('default_cellupdate', "row", realrow, "had no cell in col", | |
1331 column, "retrying from first row") | |
1332 addon:_fill_out_eoi_data(1) | |
1333 cell = e.cols[column] | |
1334 if not cell then | |
1335 pprint('default_cellupdate', "FAILED, bailing") | |
1336 return | |
1337 end | |
1338 end | |
1313 | 1339 |
1314 cellFrame.text:SetText(cell.value) | 1340 cellFrame.text:SetText(cell.value) |
1315 -- subset of what the default ST's docellupdate looks for | 1341 -- subset of what the default ST's docellupdate looks for |
1316 local color = cols[column].color and cols[column].color(data,cols,realrow,column,stable) | 1342 local color = cols[column].color and cols[column].color(data,cols,realrow,column,stable) |
1317 if color then | 1343 if color then |
2099 -- This probably causes taint... hm. | 2125 -- This probably causes taint... hm. |
2100 local prev_fade_time = UIDROPDOWNMENU_SHOW_TIME | 2126 local prev_fade_time = UIDROPDOWNMENU_SHOW_TIME |
2101 UIDROPDOWNMENU_SHOW_TIME = 4 | 2127 UIDROPDOWNMENU_SHOW_TIME = 4 |
2102 | 2128 |
2103 if dirty_tabs then | 2129 if dirty_tabs then |
2104 -- pointers known to be good by now, pass them back in | 2130 self.dprint('flow', "dirty flag set in BuildMainDisplay, recreating!") |
2105 self:gui_init (g_loot, g_uniques) | 2131 self:gui_init() |
2106 self:zero_printed_fenceposts() | 2132 self:zero_printed_fenceposts() |
2107 end | 2133 end |
2108 gui.opts = self.db.profile | 2134 gui.opts = self.db.profile |
2109 | 2135 |
2110 local display = AceGUI:Create("Frame") | 2136 local display = AceGUI:Create("Frame") |
2571 duration = 0, | 2597 duration = 0, |
2572 maxsize = data.max_raid_size, | 2598 maxsize = data.max_raid_size, |
2573 raidersnap = data.yes_snap or {}, | 2599 raidersnap = data.yes_snap or {}, |
2574 } | 2600 } |
2575 local entry = tremove(g_loot,boss_index) | 2601 local entry = tremove(g_loot,boss_index) |
2576 tinsert(g_loot,data.rowindex,entry) | 2602 g_dloot:insert (data.rowindex, entry) |
2577 addon:_mark_boss_kill(data.rowindex) | 2603 addon:_mark_boss_kill(data.rowindex) |
2578 gui.eoiST:OuroLoot_Refresh(data.rowindex) | 2604 gui.eoiST:OuroLoot_Refresh(data.rowindex) |
2579 local jumpprefix = addon.chatprefix ("GoToLootLine", data.rowindex) | 2605 local jumpprefix = addon.chatprefix ("GoToLootLine", data.rowindex) |
2580 dialog.data = nil -- free up memory | 2606 dialog.data = nil -- free up memory |
2581 addon:PCFPrint (_G.DEFAULT_CHAT_FRAME, jumpprefix, | 2607 addon:PCFPrint (_G.DEFAULT_CHAT_FRAME, jumpprefix, |
2625 local function eoi_st_insert_OnAccept_loot (dialog, data) | 2651 local function eoi_st_insert_OnAccept_loot (dialog, data) |
2626 if data.all_done then | 2652 if data.all_done then |
2627 data.display:Hide() | 2653 data.display:Hide() |
2628 local loot_index = assert(addon:CHAT_MSG_LOOT ("manual", data.recipient, data.name, data.notes)) | 2654 local loot_index = assert(addon:CHAT_MSG_LOOT ("manual", data.recipient, data.name, data.notes)) |
2629 local entry = tremove(g_loot,loot_index) | 2655 local entry = tremove(g_loot,loot_index) |
2630 tinsert(g_loot,data.rowindex,entry) | 2656 g_dloot:insert (data.rowindex, entry) |
2631 addon:_fill_out_eoi_data(data.rowindex) | 2657 addon:_fill_out_eoi_data(data.rowindex) |
2632 addon:BuildMainDisplay() | 2658 addon:BuildMainDisplay() |
2633 local clicky = _new_rebroadcast_hyperlink (entry.unique) | 2659 local clicky = _new_rebroadcast_hyperlink (entry.unique) |
2634 local jumpprefix = addon.chatprefix ("GoToLootLine", data.rowindex) | 2660 local jumpprefix = addon.chatprefix ("GoToLootLine", data.rowindex) |
2635 dialog.data = nil | 2661 dialog.data = nil |