Mercurial > wow > ouroloot
comparison gui.lua @ 73:32eb24fb2ebf
- This code is not quite ready for prime time. Do not run it yet.
- Loot events have associated unique IDs, enabling some new actions over
the network. These IDs are preserved as part of realm history. As a
result, the stored history format has completely changed (and requires
less memory as a bonus).
- "Prescan for faster handling" option, default off.
- "Mark as <x>" now broadcast to other trackers. Older versions can't
receive the message, of course. Future: Broadcast reassigning loot.
- New options controlling whether (and where) to print a message when
another player broadcasts those kinds of changes to existing loot.
- Names colored by class when that data is available; CUSTOM_CLASS_COLORS
supported.
- Metric boatloads of minor tweaks and optimizations throughout.
| author | Farmbuyer of US-Kilrogg <farmbuyer@gmail.com> |
|---|---|
| date | Tue, 29 May 2012 22:50:09 +0000 |
| parents | bb19899c65a7 |
| children | 5edaac60449b |
comparison
equal
deleted
inserted
replaced
| 72:bb19899c65a7 | 73:32eb24fb2ebf |
|---|---|
| 21 } | 21 } |
| 22 eoi_st_otherrow_bgcolortable[""] = eoi_st_otherrow_bgcolortable["kill"] | 22 eoi_st_otherrow_bgcolortable[""] = eoi_st_otherrow_bgcolortable["kill"] |
| 23 --eoi_st_otherrow_bgcolortable["realm"] = eoi_st_otherrow_bgcolortable["time"] | 23 --eoi_st_otherrow_bgcolortable["realm"] = eoi_st_otherrow_bgcolortable["time"] |
| 24 local eoi_st_otherrow_bgcolortable_default | 24 local eoi_st_otherrow_bgcolortable_default |
| 25 local eoi_st_lootrow_col3_colortable = { | 25 local eoi_st_lootrow_col3_colortable = { |
| 26 [""] = { text = "", r = 1.0, g = 1.0, b = 1.0, a = 1.0 }, | 26 normal = { text = "", r = "ff", g = "ff", b = "ff" }, |
| 27 shard = { text = "shard", r = 0xa3/255, g = 0x35/255, b = 0xee/255, a = 1.0 }, | 27 shard = { text = "shard", r = "a3", g = "35", b = "ee" }, |
| 28 offspec = { text = "offspec", r = 0.78, g = 0.61, b = 0.43, a = 1.0 }, | 28 offspec = { text = "offspec", r = "c6", g = "9b", b = "6d" }, |
| 29 gvault = { text = "guild vault", r = 0x33/255, g = 1.0, b = 0x99/255, a = 1.0 }, | 29 gvault = { text = "guild vault", r = "33", g = "ff", b = "99" }, |
| 30 } | 30 } |
| 31 local function eoi_st_lootrow_col3_colortable_func (data, cols, realrow, column, table) | 31 for k,v in pairs(eoi_st_lootrow_col3_colortable) do |
| 32 -- for chat output by core code | |
| 33 v.hex = "|cff" .. v.r .. v.g .. v.b | |
| 34 -- for lib-st | |
| 35 v.r = tonumber(v.r,16)/255 | |
| 36 v.g = tonumber(v.g,16)/255 | |
| 37 v.b = tonumber(v.b,16)/255 | |
| 38 v.a = 1 | |
| 39 end | |
| 40 addon.disposition_colors = eoi_st_lootrow_col3_colortable | |
| 41 local function eoi_st_lootrow_col3_colortable_func (data, _, realrow) | |
| 32 local disp = data[realrow].disposition | 42 local disp = data[realrow].disposition |
| 33 return eoi_st_lootrow_col3_colortable[disp or ""] | 43 return eoi_st_lootrow_col3_colortable[disp or 'normal'] |
| 34 end | 44 end |
| 35 addon.time_column1_used_mt = { __index = { | 45 addon.time_column1_used_mt = { __index = { |
| 36 [2] = {value=""}, | 46 [2] = {value=""}, |
| 37 [3] = {value=""}, | 47 [3] = {value=""}, |
| 38 } } | 48 } } |
| 66 argument. | 76 argument. |
| 67 ]] | 77 ]] |
| 68 local tabs_OnGroupSelected = {} | 78 local tabs_OnGroupSelected = {} |
| 69 local mkbutton | 79 local mkbutton |
| 70 local tabs_OnGroupSelected_func, tabs_generated_text_OGS | 80 local tabs_OnGroupSelected_func, tabs_generated_text_OGS |
| 81 | |
| 82 -- Class color support | |
| 83 local class_colors-- = {} | |
| 84 do | |
| 85 local function fill_out_class_colors() | |
| 86 class_colors = CUSTOM_CLASS_COLORS or RAID_CLASS_COLORS | |
| 87 -- If we were dependant on lib-st calling this function (via a | |
| 88 -- 'color' field in eoi_st_cols[2]), then this would have to be deep | |
| 89 -- copied and an "a=1" field added to each. But as we have to use | |
| 90 -- this ourselves via DoCellUpdate, we can just share tables and | |
| 91 -- pass an alpha value manually during cell update. | |
| 92 --for class,color in pairs(CUSTOM_CLASS_COLORS or RAID_CLASS_COLORS) do | |
| 93 -- class_colors[class] = { r = color.r, g = color.g, b = color.b, a = 1 } | |
| 94 --end | |
| 95 end | |
| 96 fill_out_class_colors() | |
| 97 if CUSTOM_CLASS_COLORS and CUSTOM_CLASS_COLORS.RegisterCallback then | |
| 98 CUSTOM_CLASS_COLORS:RegisterCallback(fill_out_class_colors) | |
| 99 end | |
| 100 addon.class_colors = class_colors | |
| 101 end | |
| 71 | 102 |
| 72 -- Working around this bug: | 103 -- Working around this bug: |
| 73 -- http://forums.wowace.com/showpost.php?p=295202&postcount=31 | 104 -- http://forums.wowace.com/showpost.php?p=295202&postcount=31 |
| 74 do | 105 do |
| 75 local function fix_frame_level (level, ...) | 106 local function fix_frame_level (level, ...) |
| 263 if e.kind == 'loot' then | 294 if e.kind == 'loot' then |
| 264 local textured = eoi_st_textured_item_format:format (e.itexture, ITEM_QUALITY_COLORS[e.quality].hex, e.itemname, e.count or "") | 295 local textured = eoi_st_textured_item_format:format (e.itexture, ITEM_QUALITY_COLORS[e.quality].hex, e.itemname, e.count or "") |
| 265 e.cols = { | 296 e.cols = { |
| 266 {value = textured}, | 297 {value = textured}, |
| 267 {value = e.person}, | 298 {value = e.person}, |
| 268 { color = eoi_st_lootrow_col3_colortable_func } | 299 {} |
| 269 } | 300 } |
| 270 -- This is horrible. Must do better. | 301 -- This is horrible. Must do better. |
| 271 if e.extratext then for k,v in pairs(eoi_st_lootrow_col3_colortable) do | 302 if e.extratext then for k,v in pairs(eoi_st_lootrow_col3_colortable) do |
| 272 if v.text == e.extratext then | 303 if v.text == e.extratext then |
| 273 e.disposition = k | 304 e.disposition = k ~= 'normal' and k or nil |
| 274 --e.extratext = nil, not feasible | 305 --e.extratext = nil, not feasible |
| 275 break | 306 break |
| 276 end | 307 end |
| 277 end end | 308 end end |
| 278 local ex = e.disposition or "" | 309 local ex = eoi_st_lootrow_col3_colortable[e.disposition or 'normal'].text |
| 279 ex = eoi_st_lootrow_col3_colortable[ex].text | |
| 280 if e.bcast_from and display_bcast_from and e.extratext then | 310 if e.bcast_from and display_bcast_from and e.extratext then |
| 281 ex = e.extratext .. " (from " .. e.bcast_from .. ")" | 311 ex = e.extratext .. " (from " .. e.bcast_from .. ")" |
| 282 elseif e.bcast_from and display_bcast_from then | 312 elseif e.bcast_from and display_bcast_from then |
| 283 ex = ex .. " (from " .. e.bcast_from .. ")" | 313 ex = ex .. (e.disposition and " " or "") |
| 314 .. "(from " .. e.bcast_from .. ")" | |
| 284 elseif e.extratext then | 315 elseif e.extratext then |
| 285 ex = e.extratext | 316 ex = e.extratext |
| 286 end | 317 end |
| 287 e.cols[3].value = ex | 318 e.cols[3].value = ex |
| 288 | 319 |
| 364 local col1 = new() | 395 local col1 = new() |
| 365 col1.OLi = pi | 396 col1.OLi = pi |
| 366 col1.OLn = #player | 397 col1.OLn = #player |
| 367 col1.value = player.name -- may spiffy this up in future | 398 col1.value = player.name -- may spiffy this up in future |
| 368 | 399 |
| 369 for li,loot in ipairs(player) do | 400 for li,unique in ipairs(player.unique) do |
| 370 local col2 = new() | 401 local col2 = new() |
| 371 col2.OLi = li | 402 col2.OLi = li |
| 372 local col3 = new() | 403 local col3 = new() |
| 373 col3.value = loot.when | 404 col3.value = player.when[unique] |
| 374 | 405 |
| 375 local itexture = GetItemIcon(loot.id) | 406 local id = player.id[unique] |
| 376 local iname, ilink, iquality = GetItemInfo(loot.id) | 407 local itexture = GetItemIcon(id) |
| 408 local iname, ilink, iquality = GetItemInfo(id) | |
| 377 local textured | 409 local textured |
| 378 if itexture and iname then | 410 if itexture and iname then |
| 379 textured = eoi_st_textured_item_format:format (itexture, | 411 textured = eoi_st_textured_item_format:format (itexture, |
| 380 ITEM_QUALITY_COLORS[iquality].hex, iname, loot.count or "") | 412 ITEM_QUALITY_COLORS[iquality].hex, iname, player.count[unique] or "") |
| 381 else | 413 else |
| 382 textured = eoi_st_textured_item_format:format ([[ICONS\INV_Misc_QuestionMark]], | 414 textured = eoi_st_textured_item_format:format ([[ICONS\INV_Misc_QuestionMark]], |
| 383 ITEM_QUALITY_COLORS[ITEM_QUALITY_COMMON].hex, 'UNKNOWN - REDISPLAY LATER', "") | 415 ITEM_QUALITY_COLORS[ITEM_QUALITY_COMMON].hex, 'UNKNOWN - REDISPLAY LATER', "") |
| 384 cache_okay = false | 416 cache_okay = false |
| 385 end | 417 end |
| 399 self.hist_clean = cache_okay and #self.history or nil | 431 self.hist_clean = cache_okay and #self.history or nil |
| 400 end | 432 end |
| 401 end | 433 end |
| 402 | 434 |
| 403 -- Debugging tooltip | 435 -- Debugging tooltip |
| 404 do | 436 if true then |
| 437 local tt | |
| 438 local function _create_tooltip() | |
| 439 tt = CreateFrame("GameTooltip") | |
| 440 UIParentLoadAddOn("Blizzard_DebugTools") | |
| 441 | |
| 442 tt:SetBackdrop{ | |
| 443 bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], | |
| 444 edgeFile = [[Interface\Tooltips\UI-Tooltip-Border]], | |
| 445 tile = true, | |
| 446 tileSize = 8, | |
| 447 edgeSize = 12, | |
| 448 insets = { left = 2, right = 2, top = 2, bottom = 2 } | |
| 449 } | |
| 450 tt:SetBackdropColor(TOOLTIP_DEFAULT_BACKGROUND_COLOR.r, | |
| 451 TOOLTIP_DEFAULT_BACKGROUND_COLOR.g, TOOLTIP_DEFAULT_BACKGROUND_COLOR.b) | |
| 452 tt:SetBackdropBorderColor(TOOLTIP_DEFAULT_COLOR.r, TOOLTIP_DEFAULT_COLOR.g, | |
| 453 TOOLTIP_DEFAULT_COLOR.b) | |
| 454 tt:SetMovable(false) | |
| 455 tt:EnableMouse(false) | |
| 456 tt:SetFrameStrata("TOOLTIP") | |
| 457 tt:SetToplevel(true) | |
| 458 tt:SetClampedToScreen(true) | |
| 459 | |
| 460 local font = CreateFont("OuroLootDebugFont") | |
| 461 font:CopyFontObject(GameTooltipTextSmall) | |
| 462 if IsAddOnLoaded"tekticles" then -- maybe check for one of the sharedmedia things? | |
| 463 font:SetFont([[Interface\AddOns\tekticles\Calibri.ttf]], 9) | |
| 464 else | |
| 465 font:SetFont([[Fonts\FRIZQT__.TTF]], 9) | |
| 466 end | |
| 467 | |
| 468 local left, right, prevleft | |
| 469 -- Only create as many lines as we might need (the auto growth | |
| 470 -- by Add*Line does odd things sometimes). | |
| 471 for i = 1, math.max(DEVTOOLS_MAX_ENTRY_CUTOFF,15)+5 do | |
| 472 prevleft = left | |
| 473 left = tt:CreateFontString(nil,"ARTWORK") | |
| 474 right = tt:CreateFontString(nil,"ARTWORK") | |
| 475 left:SetFontObject(font) | |
| 476 right:SetFontObject(font) | |
| 477 tt:AddFontStrings(left,right) | |
| 478 if prevleft then | |
| 479 left:SetPoint("TOPLEFT",prevleft,"BOTTOMLEFT",0,-2) | |
| 480 else | |
| 481 left:SetPoint("TOPLEFT",10,-10) -- top line | |
| 482 end | |
| 483 right:SetPoint("RIGHT",left,"LEFT") | |
| 484 end | |
| 485 tt.AddMessage = tt.AddLine | |
| 486 | |
| 487 _create_tooltip = nil | |
| 488 end | |
| 489 | |
| 490 function _build_debugging_tooltip (parent, index) | |
| 491 local e = g_loot[index]; assert(type(e)=='table') | |
| 492 if not tt then _create_tooltip() end | |
| 493 tt:SetOwner (parent, "ANCHOR_LEFT", -15, -5) | |
| 494 tt:ClearLines() | |
| 495 | |
| 496 local real = DEFAULT_CHAT_FRAME | |
| 497 DEFAULT_CHAT_FRAME = tt | |
| 498 DevTools_Dump{ [index] = e } | |
| 499 DEFAULT_CHAT_FRAME = real | |
| 500 | |
| 501 tt:Show() | |
| 502 end | |
| 503 | |
| 504 function _hide_debugging_tooltip() | |
| 505 if tt then tt:Hide() end | |
| 506 end | |
| 507 else | |
| 405 -- Fields to put in the tooltip (maybe move these into the options window | 508 -- Fields to put in the tooltip (maybe move these into the options window |
| 406 -- if I spend too much time fiddling). | 509 -- if I spend too much time fiddling). |
| 407 local loot = {'person', 'id', 'unique', 'disposition', 'count', 'variant'} | 510 local loot = {'person', 'id', 'unique', 'disposition', 'count', 'variant'} |
| 408 local boss = {'bossname', 'reason', 'instance', 'maxsize', 'duration', 'raidersnap'} | 511 local boss = {'bossname', 'reason', 'instance', 'maxsize', 'duration', 'raidersnap'} |
| 409 | 512 |
| 675 addon:Print("Rebroadcast entry", rowi, e.itemlink or e.bossname or UNKNOWN) | 778 addon:Print("Rebroadcast entry", rowi, e.itemlink or e.bossname or UNKNOWN) |
| 676 rowi = rowi + 1 | 779 rowi = rowi + 1 |
| 677 until rowi >= fencepost | 780 until rowi >= fencepost |
| 678 end, | 781 end, |
| 679 | 782 |
| 680 ["Mark as normal"] = function(rowi,disp) -- broadcast the change? ugh | 783 ["Mark as normal"] = function(rowi,disp) |
| 681 local olddisp = g_loot[rowi].disposition | 784 addon:loot_mark_disposition ("local", rowi, disp) |
| 682 g_loot[rowi].disposition = disp | |
| 683 g_loot[rowi].bcast_from = nil | |
| 684 g_loot[rowi].extratext = nil | |
| 685 addon:history_handle_disposition (rowi, olddisp) | |
| 686 end, | 785 end, |
| 687 | 786 |
| 688 ["Show only this player"] = function(rowi) | 787 ["Show only this player"] = function(rowi) |
| 689 local st = _d:GetUserData("eoiST") | 788 local st = _d:GetUserData("eoiST") |
| 690 _d:SetUserData("player filter name", g_loot[rowi].person) | 789 _d:SetUserData("player filter name", g_loot[rowi].person) |
| 1000 | 1099 |
| 1001 local e = data[realrow] | 1100 local e = data[realrow] |
| 1002 local cell = e.cols[column] | 1101 local cell = e.cols[column] |
| 1003 | 1102 |
| 1004 cellFrame.text:SetText(cell.value) | 1103 cellFrame.text:SetText(cell.value) |
| 1005 cellFrame.text:SetTextColor(1,1,1,1) | |
| 1006 | 1104 |
| 1007 if e.person_class then | 1105 if e.person_class then |
| 1008 local icon | 1106 local icon |
| 1009 if cellFrame.icontexture then | 1107 if cellFrame.icontexture then |
| 1010 icon = cellFrame.icontexture | 1108 icon = cellFrame.icontexture |
| 1017 cellFrame.icontexture = icon | 1115 cellFrame.icontexture = icon |
| 1018 end | 1116 end |
| 1019 icon:SetTexCoord(unpack(CLASS_ICON_TCOORDS[e.person_class])) | 1117 icon:SetTexCoord(unpack(CLASS_ICON_TCOORDS[e.person_class])) |
| 1020 icon:Show() | 1118 icon:Show() |
| 1021 cellFrame.text:SetPoint("LEFT", icon, "RIGHT", 1, 0) | 1119 cellFrame.text:SetPoint("LEFT", icon, "RIGHT", 1, 0) |
| 1120 local color = class_colors[e.person_class] | |
| 1121 cellFrame.text:SetTextColor(color.r,color.g,color.b,1) | |
| 1022 else | 1122 else |
| 1023 if cellFrame.icontexture then | 1123 if cellFrame.icontexture then |
| 1024 cellFrame.icontexture:Hide() | 1124 cellFrame.icontexture:Hide() |
| 1025 cellFrame.text:SetPoint("LEFT", cellFrame, "LEFT") | 1125 cellFrame.text:SetPoint("LEFT", cellFrame, "LEFT") |
| 1026 end | 1126 end |
| 1127 cellFrame.text:SetTextColor(1,1,1,1) | |
| 1027 end | 1128 end |
| 1028 | 1129 |
| 1029 --if e.kind ~= 'loot' then | 1130 --if e.kind ~= 'loot' then |
| 1030 stable:SetHighLightColor (rowFrame, eoi_st_otherrow_bgcolortable[e.reason or e.kind or ""]) | 1131 stable:SetHighLightColor (rowFrame, eoi_st_otherrow_bgcolortable[e.reason or e.kind or ""]) |
| 1031 --else | 1132 --else |
| 1044 DoCellUpdate = eoi_st_col2_DoCellUpdate, | 1145 DoCellUpdate = eoi_st_col2_DoCellUpdate, |
| 1045 }, | 1146 }, |
| 1046 { -- col 3 | 1147 { -- col 3 |
| 1047 name = "Notes", | 1148 name = "Notes", |
| 1048 width = 250, | 1149 width = 250, |
| 1150 color = eoi_st_lootrow_col3_colortable_func, | |
| 1049 }, | 1151 }, |
| 1050 } | 1152 } |
| 1051 | 1153 |
| 1052 local player_filter_all | 1154 local player_filter_all |
| 1053 local player_filter_by_name = function (st, e) | 1155 local player_filter_by_name = function (st, e) |
| 1622 grp:PauseLayout() | 1724 grp:PauseLayout() |
| 1623 grp:SetFullWidth(true) | 1725 grp:SetFullWidth(true) |
| 1624 grp:SetTitle("Debugging/Testing Options [not saved across sessions]") | 1726 grp:SetTitle("Debugging/Testing Options [not saved across sessions]") |
| 1625 | 1727 |
| 1626 w = mkbutton("EditBox", 'comm_ident', addon.ident, | 1728 w = mkbutton("EditBox", 'comm_ident', addon.ident, |
| 1627 [[Disable the addon, change this field (click Okay or press Enter), then re-enable the addon.]]) | 1729 [[Set tracking to 'Disabled' in the top-right dropdown, then change this field (click Okay or press Enter).]]) |
| 1628 w:SetRelativeWidth(0.2) | 1730 w:SetRelativeWidth(0.2) |
| 1629 w:SetLabel("Addon channel ID") | 1731 w:SetLabel("Addon channel ID") |
| 1630 w:SetCallback("OnTextChanged", adv_careful_OnTextChanged) | 1732 w:SetCallback("OnTextChanged", adv_careful_OnTextChanged) |
| 1631 w:SetCallback("OnEnterPressed", function(_w,event,value) | 1733 w:SetCallback("OnEnterPressed", function(_w,event,value) |
| 1632 -- if they set it to blank spaces, they're boned. oh well. | 1734 -- if they set it to blank spaces, they're boned. oh well. |
| 1660 end | 1762 end |
| 1661 local mod = DBM:GetModByName("NotScaryAtAll") | 1763 local mod = DBM:GetModByName("NotScaryAtAll") |
| 1662 if mod then | 1764 if mod then |
| 1663 mod:EnableMod() | 1765 mod:EnableMod() |
| 1664 addon:Print("Now tracking ID",mod.creatureId) | 1766 addon:Print("Now tracking ID",mod.creatureId) |
| 1665 else addon:Print("Can do nothing; DBM testing mod wasn't loaded.") end | 1767 else |
| 1768 addon:Print("Can do nothing; DBM testing mod wasn't loaded.") | |
| 1769 end | |
| 1666 end) | 1770 end) |
| 1667 w:SetDisabled(addon.bossmod_registered ~= 'DBM') | 1771 w:SetDisabled(addon.bossmod_registered ~= 'DBM') |
| 1668 grp:AddChild(w) | 1772 grp:AddChild(w) |
| 1669 | 1773 |
| 1670 w = mkbutton("GC", [[full GC cycle]]) | 1774 w = mkbutton("GC", [[full GC cycle]]) |
| 1671 w:SetRelativeWidth(0.1) | 1775 w:SetRelativeWidth(0.1) |
| 1672 w:SetCallback("OnClick", function() collectgarbage() end) | 1776 w:SetCallback("OnClick", function() |
| 1777 local before = collectgarbage('count') | |
| 1778 collectgarbage('collect') | |
| 1779 local after = collectgarbage('count') | |
| 1780 addon:Print("Collected %d KB, %d KB still in use by Lua universe.", before-after, after) | |
| 1781 end) | |
| 1673 grp:AddChild(w) | 1782 grp:AddChild(w) |
| 1674 | |
| 1675 --[==[ this has been well and truly debugged by now | |
| 1676 w = mkbutton("EditBox", nil, addon.loot_pattern:sub(17), [[]]) | |
| 1677 w:SetRelativeWidth(0.35) | |
| 1678 w:SetLabel("CML pattern suffix") | |
| 1679 w:SetCallback("OnEnterPressed", function(_w,event,value) | |
| 1680 addon.loot_pattern = addon.loot_pattern:sub(1,16) .. value | |
| 1681 end) | |
| 1682 grp:AddChild(w) ]==] | |
| 1683 | 1783 |
| 1684 w = GUI:Create("Spacer") w:SetFullWidth(true) w:SetHeight(1) grp:AddChild(w) | 1784 w = GUI:Create("Spacer") w:SetFullWidth(true) w:SetHeight(1) grp:AddChild(w) |
| 1685 | 1785 |
| 1686 local simple = GUI:Create("SimpleGroup") | 1786 local simple = GUI:Create("SimpleGroup") |
| 1687 simple:SetLayout("List") | 1787 simple:SetLayout("List") |
| 1707 simple:AddChild(w) | 1807 simple:AddChild(w) |
| 1708 w = GUI:Create("CheckBoxSmallLabel") | 1808 w = GUI:Create("CheckBoxSmallLabel") |
| 1709 w:SetFullWidth(true) | 1809 w:SetFullWidth(true) |
| 1710 w:SetType("checkbox") | 1810 w:SetType("checkbox") |
| 1711 w:SetLabel("GOP history mode") | 1811 w:SetLabel("GOP history mode") |
| 1712 w:SetValue(false) | 1812 w:SetValue(addon.history_suppress) |
| 1713 w:SetCallback("OnValueChanged", function(_w,event,value) addon.history_suppress = value end) | 1813 w:SetCallback("OnValueChanged", function(_w,event,value) addon.history_suppress = value end) |
| 1714 simple:AddChild(w) | 1814 simple:AddChild(w) |
| 1715 w = mkbutton("Clear All & Reload", | 1815 w = mkbutton("Clear All & Reload", |
| 1716 [[No confirmation! |cffff1010Erases absolutely all> Ouro Loot saved variables and reloads the UI.]]) | 1816 [[No confirmation! |cffff1010Erases absolutely all> Ouro Loot saved variables and reloads the UI.]]) |
| 1717 w:SetFullWidth(true) | 1817 w:SetFullWidth(true) |
| 1761 grp:AddChild(simple) | 1861 grp:AddChild(simple) |
| 1762 | 1862 |
| 1763 grp:ResumeLayout() | 1863 grp:ResumeLayout() |
| 1764 container:AddChild(grp) | 1864 container:AddChild(grp) |
| 1765 GUI:ClearFocus() | 1865 GUI:ClearFocus() |
| 1866 container:SetScroll(1000) -- scrollframe's max value | |
| 1766 end | 1867 end |
| 1767 | 1868 |
| 1768 -- Initial lower panel function | 1869 -- Initial lower panel function |
| 1769 local function adv_lower (container, specials) | 1870 local function adv_lower (container, specials) |
| 1871 local spacer = GUI:Create("Spacer") | |
| 1872 spacer:SetFullWidth(true) | |
| 1873 spacer:SetHeight(5) | |
| 1874 container:AddChild(spacer) | |
| 1770 local speedbump = GUI:Create("InteractiveLabel") | 1875 local speedbump = GUI:Create("InteractiveLabel") |
| 1771 speedbump:SetFullWidth(true) | 1876 speedbump:SetFullWidth(true) |
| 1772 speedbump:SetFontObject(GameFontHighlightLarge) | 1877 speedbump:SetFontObject(GameFontHighlightLarge) |
| 1773 speedbump:SetImage("Interface\\DialogFrame\\DialogAlertIcon") | 1878 speedbump:SetImage("Interface\\DialogFrame\\DialogAlertIcon") |
| 1774 speedbump:SetImageSize(50,50) | 1879 speedbump:SetImageSize(50,50) |
| 1779 adv_lower = adv_real | 1884 adv_lower = adv_real |
| 1780 return addon:redisplay() | 1885 return addon:redisplay() |
| 1781 --return tabs_OnGroupSelected_func(container.parent,"OnGroupSelected","opt") | 1886 --return tabs_OnGroupSelected_func(container.parent,"OnGroupSelected","opt") |
| 1782 end) | 1887 end) |
| 1783 container:AddChild(speedbump) | 1888 container:AddChild(speedbump) |
| 1889 spacer = GUI:Create("Spacer") | |
| 1890 spacer:SetFullWidth(true) | |
| 1891 spacer:SetHeight(5) | |
| 1892 container:AddChild(spacer) | |
| 1784 end | 1893 end |
| 1785 | 1894 |
| 1786 tabs_OnGroupSelected["opt"] = function(container,specials) | 1895 tabs_OnGroupSelected["opt"] = function(container,specials) |
| 1787 opts = OuroLootSV_opts | 1896 opts = OuroLootSV_opts |
| 1788 | 1897 |
| 1814 -- /loot option | 1923 -- /loot option |
| 1815 w = mkoption('register_slashloot', "Register /loot slash command on login", 0.49, | 1924 w = mkoption('register_slashloot', "Register /loot slash command on login", 0.49, |
| 1816 [[Register "/loot" as a slash command in addition to the normal "/ouroloot". Relog to take effect.]]) | 1925 [[Register "/loot" as a slash command in addition to the normal "/ouroloot". Relog to take effect.]]) |
| 1817 grp:AddChild(w) | 1926 grp:AddChild(w) |
| 1818 | 1927 |
| 1819 -- chatty mode | 1928 -- chatty boss mode |
| 1820 w = mkoption('chatty_on_kill', "Be chatty on boss kill", 0.49, | 1929 w = mkoption('chatty_on_kill', "Be chatty on boss kill", 0.49, |
| 1821 [[Print something to chat output when DBM tells Ouro Loot about a successful boss kill.]]) | 1930 [[Print something to chat output when DBM tells Ouro Loot about a successful boss kill.]]) |
| 1822 grp:AddChild(w) | 1931 grp:AddChild(w) |
| 1823 | 1932 |
| 1824 -- less noise in main panel | 1933 -- less noise in main panel |
| 1836 [[Show loadable plugins even if they've been disabled (and offer to enable them). Relog to take effect.]]) | 1945 [[Show loadable plugins even if they've been disabled (and offer to enable them). Relog to take effect.]]) |
| 1837 grp:AddChild(w) | 1946 grp:AddChild(w) |
| 1838 | 1947 |
| 1839 -- showing the "(from Rebroadcasterdude)" in the notes column | 1948 -- showing the "(from Rebroadcasterdude)" in the notes column |
| 1840 w = mkoption('display_bcast_from', "Show rebroadcasting player", 0.49, | 1949 w = mkoption('display_bcast_from', "Show rebroadcasting player", 0.49, |
| 1841 [[Include "(from Player_Name)" in the Notes column for loot that was broadcast to you.]], | 1950 [[Include "from PlayerName" in the Notes column for loot that was broadcast to you. (Not included in forum output).]], |
| 1842 function(_w,_e,value) | 1951 function(_w,_e,value) |
| 1843 opts.display_bcast_from = value | 1952 opts.display_bcast_from = value |
| 1844 addon.loot_clean = nil | 1953 addon.loot_clean = nil |
| 1845 end) | 1954 end) |
| 1846 grp:AddChild(w) | 1955 grp:AddChild(w) |
| 1847 | 1956 |
| 1957 -- prefilling g_uniques with history | |
| 1958 w = mkoption('precache_history_uniques', "Prescan for faster handling", 0.49, | |
| 1959 [[See description under +Help -- Handy Tips -- Prescanning> for instructions.]]) | |
| 1960 grp:AddChild(w) | |
| 1961 | |
| 1962 w = GUI:Create("Spacer") w:SetFullWidth(true) w:SetHeight(1) grp:AddChild(w) | |
| 1963 | |
| 1848 -- possible keybindings | 1964 -- possible keybindings |
| 1849 do | 1965 do |
| 1850 local pair = GUI:Create("SimpleGroup") | 1966 local pair = GUI:Create("InlineGroup") |
| 1851 pair:SetLayout("Flow") | 1967 pair:SetLayout("List") |
| 1852 pair:SetRelativeWidth(0.95) | 1968 pair:SetRelativeWidth(0.49) |
| 1853 local editbox, checkbox | 1969 local editbox, checkbox |
| 1854 editbox = mkbutton("EditBox", nil, opts.keybinding_text, | 1970 editbox = mkbutton("EditBox", nil, opts.keybinding_text, |
| 1855 [[Keybinding text format is fragile! Relog to take effect.]]) | 1971 [[Keybinding text format is fragile! Relog to take effect.]]) |
| 1856 editbox:SetRelativeWidth(0.5) | 1972 editbox:SetFullWidth(true) |
| 1857 editbox:SetLabel("Keybinding text") | 1973 editbox:SetLabel("Keybinding text") |
| 1858 editbox:SetCallback("OnEnterPressed", function(_w,event,value) | 1974 editbox:SetCallback("OnEnterPressed", function(_w,event,value) |
| 1859 opts.keybinding_text = value | 1975 opts.keybinding_text = value |
| 1860 end) | 1976 end) |
| 1861 editbox:SetDisabled(not opts.keybinding) | 1977 editbox:SetDisabled(not opts.keybinding) |
| 1862 checkbox = mkoption('keybinding', "Register keybinding", 0.5, | 1978 checkbox = mkoption('keybinding', "Register keybinding", 1, |
| 1863 [[Register a keybinding to toggle the loot display. Relog to take effect.]], | 1979 [[Register a keybinding to toggle the loot display. Relog to take effect.]], |
| 1864 function (_w,_,value) | 1980 function (_w,_,value) |
| 1865 opts.keybinding = value | 1981 opts.keybinding = value |
| 1866 editbox:SetDisabled(not opts.keybinding) | 1982 editbox:SetDisabled(not opts.keybinding) |
| 1867 end) | 1983 end) |
| 1984 checkbox:SetFullWidth(true) | |
| 1868 pair:AddChild(checkbox) | 1985 pair:AddChild(checkbox) |
| 1869 pair:AddChild(editbox) | 1986 pair:AddChild(editbox) |
| 1870 grp:AddChild(pair) | 1987 grp:AddChild(pair) |
| 1871 end | 1988 end |
| 1872 | 1989 |
| 1990 -- chatty disposition/assignment changes | |
| 1991 do | |
| 1992 local chatgroup = GUI:Create("InlineGroup") | |
| 1993 chatgroup:SetLayout("List") | |
| 1994 chatgroup:SetRelativeWidth(0.49) | |
| 1995 chatgroup:SetTitle("Remote Changes Chat") | |
| 1996 local toggle, editbox | |
| 1997 toggle = mkoption('chatty_on_remote_changes', "Be chatty on remote changes", 1, | |
| 1998 [[Print something to chat when other users change recorded loot.]], | |
| 1999 function (_w,_,value) | |
| 2000 opts.chatty_on_remote_changes = value | |
| 2001 editbox:SetDisabled(not opts.chatty_on_remote_changes) | |
| 2002 end) | |
| 2003 toggle:SetFullWidth(true) | |
| 2004 chatgroup:AddChild(toggle) | |
| 2005 w = GUI:Create("Label") | |
| 2006 w:SetFullWidth(true) | |
| 2007 w:SetText("This controls the output of the |cff00ffff'Be chatty on remote changes'|r option. If this field is a number, it designates which chat frame to use. Otherwise it is the Lua variable name of a frame with AddMessage capability.") | |
| 2008 chatgroup:AddChild(w) | |
| 2009 editbox = mkbutton("EditBox", nil, opts.chatty_on_remote_changes_frame, | |
| 2010 [[1 = default chat frame, 2 = combat log, etc]]) | |
| 2011 editbox:SetFullWidth(true) | |
| 2012 editbox:SetLabel("Output Chatframe") | |
| 2013 editbox:SetCallback("OnTextChanged", adv_careful_OnTextChanged) | |
| 2014 editbox:SetCallback("OnEnterPressed", function(_w,event,value) | |
| 2015 local prev = opts.chatty_on_remote_changes_frame | |
| 2016 value = value:trim() | |
| 2017 value = tonumber(value) or value | |
| 2018 if addon:_set_remote_change_chatframe (value) then | |
| 2019 opts.chatty_on_remote_changes_frame = value | |
| 2020 _w:SetText(tostring(value)) | |
| 2021 _w.editbox:ClearFocus() | |
| 2022 else | |
| 2023 _w:SetText(tostring(prev)) | |
| 2024 end | |
| 2025 end) | |
| 2026 editbox:SetDisabled(not opts.chatty_on_remote_changes) | |
| 2027 chatgroup:AddChild(editbox) | |
| 2028 w = mkbutton("Chat Frame Numbers", | |
| 2029 [[Print each chat window number in its own frame, for easy reference in the editing field.]]) | |
| 2030 w:SetFullWidth(true) | |
| 2031 --w:SetDisabled(not opts.chatty_on_remote_changes) | |
| 2032 w:SetCallback("OnClick", function() | |
| 2033 for i = 1, NUM_CHAT_WINDOWS do | |
| 2034 local cf = _G['ChatFrame'..i] | |
| 2035 if not cf then break end | |
| 2036 addon:CFPrint (cf, "This is frame number |cffff0000%d|r.", i) | |
| 2037 end | |
| 2038 end) | |
| 2039 chatgroup:AddChild(w) | |
| 2040 grp:AddChild(chatgroup) | |
| 2041 end | |
| 2042 | |
| 1873 -- boss mod selection | 2043 -- boss mod selection |
| 1874 w = GUI:Create("Spacer") | 2044 w = GUI:Create("Spacer") |
| 1875 w:SetFullWidth(true) | 2045 w:SetFullWidth(true) |
| 1876 w:SetHeight(20) | 2046 w:SetHeight(2) |
| 1877 grp:AddChild(w) | 2047 grp:AddChild(w) |
| 1878 do | 2048 do |
| 1879 local list = {} | 2049 local list = {} |
| 1880 local current | 2050 local current |
| 1881 for k,v in ipairs(addon.bossmods) do | 2051 for k,v in ipairs(addon.bossmods) do |
| 1896 end | 2066 end |
| 1897 | 2067 |
| 1898 -- item filters | 2068 -- item filters |
| 1899 w = GUI:Create("Spacer") | 2069 w = GUI:Create("Spacer") |
| 1900 w:SetFullWidth(true) | 2070 w:SetFullWidth(true) |
| 1901 w:SetHeight(20) | 2071 w:SetHeight(2) |
| 1902 grp:AddChild(w) | 2072 grp:AddChild(w) |
| 1903 do | 2073 do |
| 1904 local warntext = "At least one of the items in the filter list was not in your game client's cache. This is okay. Just wait a few seconds, display some other Ouro Loot tab, and then display Options again." | 2074 local warntext = "At least one of the items in the filter list was not in your game client's cache. This is okay. Just wait a few seconds, display some other Ouro Loot tab, and then display Options again." |
| 1905 local cache_warn, cache_warned = false, false | 2075 local cache_warn, cache_warned = false, false |
| 1906 local function do_warning() | 2076 local function do_warning() |
| 1932 w:SetRelativeWidth(0.4) | 2102 w:SetRelativeWidth(0.4) |
| 1933 w:SetText("Item filter") | 2103 w:SetText("Item filter") |
| 1934 w:SetEditBoxTooltip("Link items which should no longer be tracked.") | 2104 w:SetEditBoxTooltip("Link items which should no longer be tracked.") |
| 1935 w:SetList(filterlist) | 2105 w:SetList(filterlist) |
| 1936 w:SetCallback("OnTextEnterPressed", function(_w, _, text) | 2106 w:SetCallback("OnTextEnterPressed", function(_w, _, text) |
| 1937 local iname, ilink, iquality = GetItemInfo(strtrim(text)) | 2107 local iname, ilink, iquality = GetItemInfo(text:trim()) |
| 1938 if not iname then | 2108 if not iname then |
| 1939 return addon:Print("Error: %s is not a valid item name/link!", text) | 2109 return addon:Print("Error: %s is not a valid item name/link!", text) |
| 1940 end | 2110 end |
| 1941 local id = tonumber(ilink:match("item:(%d+)")) | 2111 local id = tonumber(ilink:match("item:(%d+)")) |
| 1942 filterlist[id] = ITEM_QUALITY_COLORS[iquality].hex .. iname .. "|r" | 2112 filterlist[id] = ITEM_QUALITY_COLORS[iquality].hex .. iname .. "|r" |
| 1961 w:SetRelativeWidth(0.4) | 2131 w:SetRelativeWidth(0.4) |
| 1962 w:SetText("Vault items") | 2132 w:SetText("Vault items") |
| 1963 w:SetEditBoxTooltip("Link items which should be automatically marked as guild vault.") | 2133 w:SetEditBoxTooltip("Link items which should be automatically marked as guild vault.") |
| 1964 w:SetList(vaultlist) | 2134 w:SetList(vaultlist) |
| 1965 w:SetCallback("OnTextEnterPressed", function(_w, _, text) | 2135 w:SetCallback("OnTextEnterPressed", function(_w, _, text) |
| 1966 local iname, ilink, iquality = GetItemInfo(strtrim(text)) | 2136 local iname, ilink, iquality = GetItemInfo(text:trim()) |
| 1967 if not iname then | 2137 if not iname then |
| 1968 return addon:Print("Error: %s is not a valid item name/link!", text) | 2138 return addon:Print("Error: %s is not a valid item name/link!", text) |
| 1969 end | 2139 end |
| 1970 local id = tonumber(ilink:match("item:(%d+)")) | 2140 local id = tonumber(ilink:match("item:(%d+)")) |
| 1971 vaultlist[id] = ITEM_QUALITY_COLORS[iquality].hex .. iname .. "|r" | 2141 vaultlist[id] = ITEM_QUALITY_COLORS[iquality].hex .. iname .. "|r" |
| 2423 -- | 2593 -- |
| 2424 -- This is really, really hideous to read. | 2594 -- This is really, really hideous to read. |
| 2425 local function eoi_st_insert_OnAccept_boss (dialog, data, data2) | 2595 local function eoi_st_insert_OnAccept_boss (dialog, data, data2) |
| 2426 if data.all_done then | 2596 if data.all_done then |
| 2427 -- It'll probably be the final entry in the table, but there might have | 2597 -- It'll probably be the final entry in the table, but there might have |
| 2428 -- been real loot happening at the same time. | 2598 -- been real loot happening while the user was clicking and typing. |
| 2429 local boss_index = addon._addBossEntry{ | 2599 local boss_index = addon._addBossEntry{ |
| 2430 kind = 'boss', | 2600 kind = 'boss', |
| 2431 bossname = (OuroLootSV_opts.snarky_boss and addon.boss_abbrev[data.name] or data.name) or data.name, | 2601 bossname = (OuroLootSV_opts.snarky_boss and addon.boss_abbrev[data.name] or data.name) or data.name, |
| 2432 reason = 'kill', | 2602 reason = 'kill', |
| 2433 instance = data.instance, | 2603 instance = data.instance, |
| 2485 local function eoi_st_insert_OnAccept_loot (dialog, data) | 2655 local function eoi_st_insert_OnAccept_loot (dialog, data) |
| 2486 if data.all_done then | 2656 if data.all_done then |
| 2487 --local real_rebroadcast, real_enabled = addon.rebroadcast, addon.enabled | 2657 --local real_rebroadcast, real_enabled = addon.rebroadcast, addon.enabled |
| 2488 --g_rebroadcast, g_enabled = false, true | 2658 --g_rebroadcast, g_enabled = false, true |
| 2489 data.display:Hide() | 2659 data.display:Hide() |
| 2490 local loot_index = addon:CHAT_MSG_LOOT ("manual", data.recipient, data.name, data.notes) | 2660 local loot_index = assert(addon:CHAT_MSG_LOOT ("manual", data.recipient, data.name, data.notes)) |
| 2491 --g_rebroadcast, g_enabled = real_g_rebroadcast, real_g_enabled | 2661 --g_rebroadcast, g_enabled = real_g_rebroadcast, real_g_enabled |
| 2492 local entry = tremove(g_loot,loot_index) | 2662 local entry = tremove(g_loot,loot_index) |
| 2493 tinsert(g_loot,data.rowindex,entry) | 2663 tinsert(g_loot,data.rowindex,entry) |
| 2494 --data.display:GetUserData("eoiST"):OuroLoot_Refresh(data.rowindex) | 2664 --data.display:GetUserData("eoiST"):OuroLoot_Refresh(data.rowindex) |
| 2495 addon:_fill_out_eoi_data(data.rowindex) | 2665 addon:_fill_out_eoi_data(data.rowindex) |
