comparison gui.lua @ 55:ac57a4342812

More people going to be looking at g_loot entries, so start cleaning up older fields a bit, and handle loading older data.
author Farmbuyer of US-Kilrogg <farmbuyer@gmail.com>
date Sat, 07 Apr 2012 05:40:20 +0000
parents 6d5fcbdc0590
children fcc0d0ff5832
comparison
equal deleted inserted replaced
54:6d5fcbdc0590 55:ac57a4342812
300 v = ("%s (%d:%.2d)"):format(v, math.floor(e.duration/60), math.floor(e.duration%60)) 300 v = ("%s (%d:%.2d)"):format(v, math.floor(e.duration/60), math.floor(e.duration%60))
301 elseif e.reason == 'wipe' then 301 elseif e.reason == 'wipe' then
302 v = ("wipe (%d:%.2d)"):format(math.floor(e.duration/60), math.floor(e.duration%60)) 302 v = ("wipe (%d:%.2d)"):format(math.floor(e.duration/60), math.floor(e.duration%60))
303 end 303 end
304 e.cols = { 304 e.cols = {
305 {value = e.bosskill}, 305 {value = e.bossname},
306 {value = e.instance}, 306 {value = e.instance},
307 {value = v or ""}, 307 {value = v or ""},
308 } 308 }
309 309
310 elseif e.kind == 'time' then 310 elseif e.kind == 'time' then
520 end, 520 end,
521 521
522 df_DELETE = function(rowi) 522 df_DELETE = function(rowi)
523 local gone = tremove(g_loot,rowi) 523 local gone = tremove(g_loot,rowi)
524 addon:Print("Removed %s.", 524 addon:Print("Removed %s.",
525 gone.itemlink or gone.bosskill or gone.startday.text) 525 gone.itemlink or gone.bossname or gone.startday.text)
526 if gone.kind == 'loot' and IsShiftKeyDown() then 526 if gone.kind == 'loot' and IsShiftKeyDown() then
527 addon:_delHistoryEntry (rowi, gone) 527 addon:_delHistoryEntry (rowi, gone)
528 end 528 end
529 end, 529 end,
530 530
551 -- this could be a lot of traffic, but frankly it's counterproductive 551 -- this could be a lot of traffic, but frankly it's counterproductive
552 -- to try to micromanage when ChatThrottleLib is already doing so 552 -- to try to micromanage when ChatThrottleLib is already doing so
553 repeat 553 repeat
554 local e = g_loot[rowi] 554 local e = g_loot[rowi]
555 if e.kind == 'boss' then 555 if e.kind == 'boss' then
556 addon:broadcast('boss', e.reason, e.bosskill, e.instance) 556 addon:broadcast('boss', e.reason, e.bossname, e.instance)
557 elseif e.kind == 'loot' then 557 elseif e.kind == 'loot' then
558 -- This only works because GetItemInfo accepts multiple argument formats 558 -- This only works because GetItemInfo accepts multiple argument formats
559 addon:broadcast('loot', e.person, e.itemlink, e.count, e.cols[3].value) 559 addon:broadcast('loot', e.person, e.itemlink, e.count, e.cols[3].value)
560 end 560 end
561 addon:Print("Rebroadcast entry", rowi, e.itemlink or e.bosskill or UNKNOWN) 561 addon:Print("Rebroadcast entry", rowi, e.itemlink or e.bossname or UNKNOWN)
562 rowi = rowi + 1 562 rowi = rowi + 1
563 until rowi >= fencepost 563 until rowi >= fencepost
564 end, 564 end,
565 565
566 ["Mark as normal"] = function(rowi,disp) -- broadcast the change? ugh 566 ["Mark as normal"] = function(rowi,disp) -- broadcast the change? ugh
802 eoi_player_dropdown[2].tooltipText = nil 802 eoi_player_dropdown[2].tooltipText = nil
803 end 803 end
804 EasyMenu (eoi_player_dropdown, dropdownmenuframe, cellFrame, 0, 0, "MENU") 804 EasyMenu (eoi_player_dropdown, dropdownmenuframe, cellFrame, 0, 0, "MENU")
805 805
806 elseif kind == 'boss' then 806 elseif kind == 'boss' then
807 eoi_boss_dropdown[1].text = e.bosskill 807 eoi_boss_dropdown[1].text = e.bossname
808 EasyMenu (eoi_boss_dropdown, dropdownmenuframe, cellFrame, 0, 0, "MENU") 808 EasyMenu (eoi_boss_dropdown, dropdownmenuframe, cellFrame, 0, 0, "MENU")
809 809
810 elseif kind == 'time' then 810 elseif kind == 'time' then
811 eoi_time_dropdown[1].text = e.startday.text 811 eoi_time_dropdown[1].text = e.startday.text
812 EasyMenu (eoi_time_dropdown, dropdownmenuframe, cellFrame, 0, 0, "MENU") 812 EasyMenu (eoi_time_dropdown, dropdownmenuframe, cellFrame, 0, 0, "MENU")
965 addon:_fill_out_eoi_data(1) 965 addon:_fill_out_eoi_data(1)
966 -- safety check begin 966 -- safety check begin
967 for i,e in ipairs(g_loot) do 967 for i,e in ipairs(g_loot) do
968 if type(e.cols) ~= 'table' then 968 if type(e.cols) ~= 'table' then
969 addon:Print("ARGH, index",i,"bad in eoi_OGS, type",type(e.cols), 969 addon:Print("ARGH, index",i,"bad in eoi_OGS, type",type(e.cols),
970 "entry kind", e.kind, "data", e.itemname or e.bosskill or e.startday.text, 970 "entry kind", e.kind, "data", e.itemname or e.bossname or e.startday.text,
971 "-- please take a screenshot and send to Farmbuyer.") 971 "-- please take a screenshot and send to Farmbuyer@US-Kilrogg.")
972 tabledump(e) 972 tabledump(e)
973 end 973 end
974 end 974 end
975 -- safety check end 975 -- safety check end
976 ST:SetData(g_loot) 976 ST:SetData(g_loot)
994 addon:_fill_out_eoi_data(opt_index) 994 addon:_fill_out_eoi_data(opt_index)
995 -- safety check begin 995 -- safety check begin
996 for i,e in ipairs(g_loot) do 996 for i,e in ipairs(g_loot) do
997 if type(e.cols) ~= 'table' then 997 if type(e.cols) ~= 'table' then
998 addon:Print("ARGH, index",i,"bad in eoi refresh, refreshed at", opt_index, "type",type(e.cols), 998 addon:Print("ARGH, index",i,"bad in eoi refresh, refreshed at", opt_index, "type",type(e.cols),
999 "entry kind", e.kind, "data", e.itemname or e.bosskill or e.startday.text, 999 "entry kind", e.kind, "data", e.itemname or e.bossname or e.startday.text,
1000 "-- please take a screenshot and send to Farmbuyer.") 1000 "-- please take a screenshot and send to Farmbuyer@US-Kilrogg.")
1001 tabledump(e) 1001 tabledump(e)
1002 end 1002 end
1003 end 1003 end
1004 -- safety check end 1004 -- safety check end
1005 self:SortData() -- calls hooked refresh 1005 self:SortData() -- calls hooked refresh
1150 1150
1151 hist_dropdownfuncs = dropdownfuncs{ 1151 hist_dropdownfuncs = dropdownfuncs{
1152 ["Delete this loot history"] = function(rowi) 1152 ["Delete this loot history"] = function(rowi)
1153 --local gone = tremove(g_loot,rowi) 1153 --local gone = tremove(g_loot,rowi)
1154 --addon:Print("Removed %s.", 1154 --addon:Print("Removed %s.",
1155 --gone.itemlink or gone.bosskill or gone.startday.text) 1155 --gone.itemlink or gone.bossname or gone.startday.text)
1156 end, 1156 end,
1157 } 1157 }
1158 local hist_dropdown = gen_easymenu_table( 1158 local hist_dropdown = gen_easymenu_table(
1159 {{ 1159 {{
1160 -- this is the dropdown title, text filled in on the fly 1160 -- this is the dropdown title, text filled in on the fly
2131 if data.all_done then 2131 if data.all_done then
2132 -- It'll probably be the final entry in the table, but there might have 2132 -- It'll probably be the final entry in the table, but there might have
2133 -- been real loot happening at the same time. 2133 -- been real loot happening at the same time.
2134 local boss_index = addon._addLootEntry{ 2134 local boss_index = addon._addLootEntry{
2135 kind = 'boss', 2135 kind = 'boss',
2136 bosskill = (OuroLootSV_opts.snarky_boss and addon.boss_abbrev[data.name] or data.name) or data.name, 2136 bossname = (OuroLootSV_opts.snarky_boss and addon.boss_abbrev[data.name] or data.name) or data.name,
2137 reason = 'kill', 2137 reason = 'kill',
2138 instance = data.instance, 2138 instance = data.instance,
2139 duration = 0, 2139 duration = 0,
2140 } 2140 }
2141 local entry = tremove(g_loot,boss_index) 2141 local entry = tremove(g_loot,boss_index)