comparison gui.lua @ 114:67bf97136273

- Start paying attention to cross-realm names. New 'fname' and 'realm' keys in snapshot (now indexed by name only), 'person_realm' key in loot entries. Realm data not stored if it's the same as the player's realm. Manual rebroadcasting does not include realm data (do we care?). - New history_suppress_LFR and history_ignore_xrealm options. - This implementation depends on no two cross-realm players sharing the same player name. Is that guaranteed by Blizzard, or merely "unlikely"? - Gather history suppression knobs into a single function. - If restoring loot data, make sure the item cache has their values; fix up any missing data on load. - Memory tweaks for player history sorting. - Handle some long-standing FIXME's: reassigning loot to the same player, using expunge() for history, no partial duplication of effort for addHistoryEntry. - Try to be more graceful when discovering messed up history during column 3 display loops. Don't leave History tab in player-focused mode when all that player's data have been removed elsewhere.
author Farmbuyer of US-Kilrogg <farmbuyer@gmail.com>
date Mon, 13 Aug 2012 21:49:08 -0400
parents cfbaf001fd52
children fc2ff128835a
comparison
equal deleted inserted replaced
113:d1b914bbed8b 114:67bf97136273
338 for i = (opt_starting_index or self.loot_clean or 1), #g_loot do 338 for i = (opt_starting_index or self.loot_clean or 1), #g_loot do
339 local e = g_loot[i] 339 local e = g_loot[i]
340 if e == nil then 340 if e == nil then
341 self.loot_clean = nil 341 self.loot_clean = nil
342 pprint('_f_o_e_d', "index",i,"somehow still in loop past",#g_loot,"bailing") 342 pprint('_f_o_e_d', "index",i,"somehow still in loop past",#g_loot,"bailing")
343 return 343 -- hmm. used to bail here. does restarting cause problems?
344 return self:_fill_out_eoi_data(1)
344 end 345 end
345 346
346 local display_bcast_from = self.db.profile.display_bcast_from 347 local display_bcast_from = self.db.profile.display_bcast_from
347 -- XXX FIXME a major weakness here is that we're constantly replacing 348 -- XXX FIXME a major weakness here is that we're constantly replacing
348 -- what's already been created. Lots of garbage. Trying to detect what 349 -- what's already been created. Lots of garbage. Trying to detect what
349 -- actually needs to be replaced is even worse. We'll live with 350 -- actually needs to be replaced is even worse. We'll live with
350 -- garbage for now. 351 -- garbage for now.
351 if e.kind == 'loot' then 352 if e.kind == 'loot' then
352 local textured = eoi_st_textured_item_format:format (e.itexture, ITEM_QUALITY_COLORS[e.quality].hex, e.itemname, e.count or "") 353 local textured = eoi_st_textured_item_format:format (e.itexture, ITEM_QUALITY_COLORS[e.quality].hex, e.itemname, e.count or "")
354 local pdisplay = e.person_realm
355 and (e.person .. FOREIGN_SERVER_LABEL) or e.person
353 e.cols = { 356 e.cols = {
354 {value = textured}, 357 {value = textured},
355 {value = e.person}, 358 {value = pdisplay},
356 {} 359 {}
357 } 360 }
358 -- This is horrible. Must do better. 361 -- This is horrible. Must do better.
359 if e.extratext then 362 if e.extratext then
360 for disp,text in self:_iter_dispositions('from_notes_text') do 363 for disp,text in self:_iter_dispositions('from_notes_text') do
458 for li,unique in ipairs(player.unique) do 461 for li,unique in ipairs(player.unique) do
459 local col2 = new() 462 local col2 = new()
460 col2.OLi = li 463 col2.OLi = li
461 col2.OLu = unique 464 col2.OLu = unique
462 local col3 = new() 465 local col3 = new()
463 col3.value = assert(player.when[unique]) 466 col3.value = player.when[unique]
467
468 if not col3.value then
469 col3.hist_miss = true
470 col3.value = '??'
471 end
464 472
465 local id = assert(player.id[unique]) 473 local id = assert(player.id[unique])
466 local itexture = GetItemIcon(id) 474 local itexture = GetItemIcon(id)
467 local iname, ilink, iquality = GetItemInfo(id) 475 local iname, ilink, iquality = GetItemInfo(id)
468 local textured 476 local textured
1053 local function eoi_st_OnEnter (rowFrame, cellFrame, data, cols, row, realrow, column, stable, motion) 1061 local function eoi_st_OnEnter (rowFrame, cellFrame, data, cols, row, realrow, column, stable, motion)
1054 if (row == nil) or (realrow == nil) then return end -- mouseover column header 1062 if (row == nil) or (realrow == nil) then return end -- mouseover column header
1055 local e = data[realrow] 1063 local e = data[realrow]
1056 if e == nil then return end -- something horrible has happened 1064 if e == nil then return end -- something horrible has happened
1057 local kind = e.kind 1065 local kind = e.kind
1066 local cell = e.cols[column]
1058 local tt = GameTooltip -- can this be hoisted? does GT ever get securely replaced? 1067 local tt = GameTooltip -- can this be hoisted? does GT ever get securely replaced?
1059 1068
1060 if gui._do_debugging_tooltip and column == 1 and kind ~= 'hist' then 1069 if gui._do_debugging_tooltip and column == 1 and kind ~= 'hist' then
1061 _build_debugging_tooltip (cellFrame, realrow) 1070 _build_debugging_tooltip (cellFrame, realrow)
1062 end 1071 end
1074 end 1083 end
1075 1084
1076 elseif kind == 'loot' and column == 2 then 1085 elseif kind == 'loot' and column == 2 then
1077 tt:SetOwner (cellFrame, "ANCHOR_BOTTOMRIGHT", -50, 5) 1086 tt:SetOwner (cellFrame, "ANCHOR_BOTTOMRIGHT", -50, 5)
1078 tt:ClearLines() 1087 tt:ClearLines()
1079 tt:AddLine(e.person.." Loot:") 1088 tt:AddLine(("%s Loot:"):format(e.person_realm
1089 and (e.person .. "-" .. e.person_realm) or e.person))
1080 local counter = 0 1090 local counter = 0
1081 for i,e2 in ipairs(data) do 1091 for i,e2 in ipairs(data) do
1082 if e2.person == e.person then -- would be awesome to test for alts 1092 if e2.person == e.person then -- would be awesome to test for alts
1083 if counter > 10 then 1093 if counter > 10 then
1084 tt:AddLine("...") 1094 tt:AddLine("...")
1093 end 1103 end
1094 end 1104 end
1095 tt:Show() 1105 tt:Show()
1096 1106
1097 elseif kind == 'loot' and column == 3 then 1107 elseif kind == 'loot' and column == 3 then
1098 setstatus(e.cols[column].value) 1108 setstatus(cell.value)
1109
1110 elseif kind == 'hist' and column == 3 and cell.hist_miss then
1111 tt:SetOwner (cellFrame, "ANCHOR_RIGHT", -20, 0)
1112 tt:ClearLines()
1113 tt:AddLine("Corrupted History Data")
1114 tt:AddLine([[Close this window, then type]], 0.8, 0.8, 0.8, 1)
1115 tt:AddLine([[/ouroloot fix history]], 0, 1, 64/255, nil)
1116 tt:AddLine([[and redisplay this window.]], 0.8, 0.8, 0.8, 1)
1117 tt:Show()
1099 1118
1100 end 1119 end
1101 1120
1102 return false -- continue with default highlighting behavior 1121 return false -- continue with default highlighting behavior
1103 end 1122 end
1142 gui.dropdown.eoi_loot[1].text = e.itemlink 1161 gui.dropdown.eoi_loot[1].text = e.itemlink
1143 EasyMenu (gui.dropdown.eoi_loot, dropdownmenuframe, cellFrame, 0, 0, "MENU") 1162 EasyMenu (gui.dropdown.eoi_loot, dropdownmenuframe, cellFrame, 0, 0, "MENU")
1144 1163
1145 elseif kind == 'loot' and column == 2 then 1164 elseif kind == 'loot' and column == 2 then
1146 local ddep = gui.dropdown.eoi_player 1165 local ddep = gui.dropdown.eoi_player
1147 ddep[1].text = e.person 1166 ddep[1].text = e.person -- FIXME realm this too
1148 local raiders = {} 1167 local raiders = {}
1149 for i = 1, GetNumRaidMembers() do 1168 for i = 1, GetNumRaidMembers() do
1150 tinsert (raiders, (GetRaidRosterInfo(i))) 1169 tinsert (raiders, (GetRaidRosterInfo(i)))
1151 end 1170 end
1152 table.sort(raiders) 1171 table.sort(raiders)
1810 st_widget:WrapST(histST) 1829 st_widget:WrapST(histST)
1811 st_widget.head_offset = 15 1830 st_widget.head_offset = 15
1812 st_widget.tail_offset = 0 1831 st_widget.tail_offset = 0
1813 container:SetLayout("Fill") 1832 container:SetLayout("Fill")
1814 container:AddChild(st_widget) 1833 container:AddChild(st_widget)
1815 setstatus(hist_normal_status) 1834 -- If we're focused on one player, but have deleted all entries for
1835 -- that player, don't sit there stuck on a blank grid.
1836 if history_filter_who and #histST.filtered < 1 then
1837 history_filter_who = nil
1838 histST:SetFilter(history_filter_by_recent)
1839 setstatus(hist_normal_status)
1840 else
1841 setstatus(hist_name_status)
1842 end
1816 1843
1817 local b 1844 local b
1818 do 1845 do
1819 local realms,current = {},1 1846 local realms,current = {},1
1820 for realmname,histtable in pairs(addon.history_all) do 1847 for realmname,histtable in pairs(addon.history_all) do