Mercurial > wow > ouroloot
comparison core.lua @ 110:f93c1a93923b
Change how dropdown menus are built, and register "mark as" in the loot dropdowns.
| author | Farmbuyer of US-Kilrogg <farmbuyer@gmail.com> |
|---|---|
| date | Wed, 08 Aug 2012 23:13:04 -0400 |
| parents | ce45011fab4c |
| children | 67bf97136273 |
comparison
equal
deleted
inserted
replaced
| 109:ce45011fab4c | 110:f93c1a93923b |
|---|---|
| 372 local g_boss_signpost = nil | 372 local g_boss_signpost = nil |
| 373 local g_seeing_oldsigs = nil | 373 local g_seeing_oldsigs = nil |
| 374 local g_uniques = nil -- memoization of unique loot events | 374 local g_uniques = nil -- memoization of unique loot events |
| 375 local g_unique_replace = nil | 375 local g_unique_replace = nil |
| 376 local opts = nil | 376 local opts = nil |
| 377 local g_gui = nil | |
| 377 | 378 |
| 378 local error = addon.error | 379 local error = addon.error |
| 379 local assert = addon.assert | 380 local assert = addon.assert |
| 380 | 381 |
| 381 local type, select, next, pairs, ipairs, tinsert, tremove, tostring, tonumber, wipe = | 382 local type, select, next, pairs, ipairs, tinsert, tremove, tostring, tonumber, wipe = |
| 847 end | 848 end |
| 848 | 849 |
| 849 self:FINISH_SPECIAL_TABS() | 850 self:FINISH_SPECIAL_TABS() |
| 850 _init(self) | 851 _init(self) |
| 851 self.dprint('flow', "version strings:", version_large, self.revision, self.status_text) | 852 self.dprint('flow', "version strings:", version_large, self.revision, self.status_text) |
| 853 g_gui = self.gui_state_pointer | |
| 852 self.gui_state_pointer = nil | 854 self.gui_state_pointer = nil |
| 853 self.load_assert = nil | 855 self.load_assert = nil |
| 854 self.OnInitialize = nil -- free up ALL the things! | 856 self.OnInitialize = nil -- free up ALL the things! |
| 855 end | 857 end |
| 856 | 858 |
| 970 -- LOOT_ITEM_SELF = "You receive loot: %s." --> You receive loot: (.+)%. | 972 -- LOOT_ITEM_SELF = "You receive loot: %s." --> You receive loot: (.+)%. |
| 971 g_LOOT_ITEM_SELF_s = LOOT_ITEM_SELF:gsub('%.$','%%.'):gsub('%%s','(.+)') | 973 g_LOOT_ITEM_SELF_s = LOOT_ITEM_SELF:gsub('%.$','%%.'):gsub('%%s','(.+)') |
| 972 | 974 |
| 973 -- LOOT_ITEM_SELF_MULTIPLE = "You receive loot: %sx%d." --> You receive loot: (.+)(x%d+)%. | 975 -- LOOT_ITEM_SELF_MULTIPLE = "You receive loot: %sx%d." --> You receive loot: (.+)(x%d+)%. |
| 974 g_LOOT_ITEM_SELF_MULTIPLE_ss = LOOT_ITEM_SELF_MULTIPLE:gsub('%.$','%%.'):gsub('%%s','(.+)'):gsub('x%%d','(x%%d+)') | 976 g_LOOT_ITEM_SELF_MULTIPLE_ss = LOOT_ITEM_SELF_MULTIPLE:gsub('%.$','%%.'):gsub('%%s','(.+)'):gsub('x%%d','(x%%d+)') |
| 977 | |
| 978 --[[ | |
| 979 Throw in the default disposition types. This could be called during load | |
| 980 were it not for the need to talk to the GUI data (not set up yet). | |
| 981 | |
| 982 Args: code, rhex, ghex, bhex, | |
| 983 text_notes, opt_text_menu (uses notes if nil), opt_tooltip_txt, | |
| 984 can_reassign_p, do_history_p, from_notes_text_p | |
| 985 ]] | |
| 986 local norm = self:_add_loot_disposition ('normal', "ff","ff","ff", "", "normal", | |
| 987 [[This is the default. Selecting any 'Mark as <x>' action blanks out extra notes about who broadcast this entry, etc.]], | |
| 988 true, true, false) | |
| 989 self:_add_loot_disposition ('offspec', "c6","9b","6d", "offspec", nil, nil, | |
| 990 true, true, true) | |
| 991 self:_add_loot_disposition ('shard', "a3","35","ee", "shard", | |
| 992 "disenchanted", nil, false, false, true) | |
| 993 -- suddenly changing localization mid-phrase is horky, change this to a submenu: | |
| 994 self:_add_loot_disposition ('gvault', "33","ff","99", _G.GUILD_BANK:lower(), | |
| 995 nil, nil, false, false, true) | |
| 996 -- fix up the odd (!) standard case of having a nil disposition field | |
| 997 norm.arg2 = nil | |
| 975 | 998 |
| 976 --[[ | 999 --[[ |
| 977 Stick something in the Blizzard addons options list, where most users | 1000 Stick something in the Blizzard addons options list, where most users |
| 978 will probably look these days. Try to be conservative about needless | 1001 will probably look these days. Try to be conservative about needless |
| 979 frame creation. | 1002 frame creation. |
| 2587 return alldisps[code][attrib] | 2610 return alldisps[code][attrib] |
| 2588 end | 2611 end |
| 2589 function addon:_iter_dispositions (attrib) | 2612 function addon:_iter_dispositions (attrib) |
| 2590 local r = {} | 2613 local r = {} |
| 2591 for code,disp in next, alldisps do | 2614 for code,disp in next, alldisps do |
| 2592 if disp.attrib then | 2615 if disp[attrib] then |
| 2593 r[code] = disp.text | 2616 r[code] = disp.text |
| 2594 end | 2617 end |
| 2595 end | 2618 end |
| 2596 return next, r | 2619 return next, r |
| 2597 end | 2620 end |
| 2598 | 2621 |
| 2599 function addon:_add_loot_disposition (code, rhex, ghex, bhex, text, | 2622 function addon:_add_loot_disposition (code, rhex, ghex, bhex, text_notes, |
| 2600 can_reassign_p, do_history_p, from_notes_text_p | 2623 text_menu, tooltip_txt, can_reassign_p, do_history_p, from_notes_text_p |
| 2601 ) | 2624 ) |
| 2602 assert(type(code)=='string' and #code>0) | 2625 assert(type(code)=='string' and #code>0) |
| 2603 assert(type(text)=='string') | 2626 assert(type(text_notes)=='string') |
| 2604 assert(type(rhex)=='string') | 2627 assert(type(rhex)=='string') |
| 2605 assert(type(bhex)=='string') | 2628 assert(type(bhex)=='string') |
| 2606 assert(type(ghex)=='string') | 2629 assert(type(ghex)=='string') |
| 2630 | |
| 2607 self.disposition_colors[code] = { | 2631 self.disposition_colors[code] = { |
| 2608 text = text, | 2632 text = text_notes, |
| 2609 -- for chat output by core code | 2633 -- for chat output by core code |
| 2610 hex = "|cff" .. rhex .. ghex .. bhex, | 2634 hex = "|cff" .. rhex .. ghex .. bhex, |
| 2611 -- for lib-st | 2635 -- for lib-st |
| 2612 r = tonumber(rhex,16)/255, | 2636 r = tonumber(rhex,16)/255, |
| 2613 g = tonumber(ghex,16)/255, | 2637 g = tonumber(ghex,16)/255, |
| 2615 a = 1, | 2639 a = 1, |
| 2616 } | 2640 } |
| 2617 -- not not = poor man's "toboolean", don't potentially hold arg | 2641 -- not not = poor man's "toboolean", don't potentially hold arg |
| 2618 -- objects from garbage collection | 2642 -- objects from garbage collection |
| 2619 alldisps[code] = { | 2643 alldisps[code] = { |
| 2620 text = text, | 2644 text = text_notes, |
| 2621 can_reassign = not not can_reassign_p, | 2645 can_reassign = not not can_reassign_p, |
| 2622 affects_history = not not do_history_p, | 2646 affects_history = not not do_history_p, |
| 2623 from_notes_text = not not from_notes_text_p, | 2647 from_notes_text = not not from_notes_text_p, |
| 2624 } | 2648 } |
| 2625 end | 2649 |
| 2626 | 2650 return g_gui.add_dropdown_entry ('eoi_loot', "Mark as "..(text_menu or text_notes), |
| 2627 -- reassign while tagged, affects history, copy from notes | 2651 --[[function_table=]]nil, 'df_DISPOSITION', code, tooltip_txt) |
| 2628 addon:_add_loot_disposition ('normal', "ff","ff","ff", "", true, true, false) | 2652 end |
| 2629 addon:_add_loot_disposition ('offspec', "c6","9b","6d", "offspec", true, true, true) | |
| 2630 addon:_add_loot_disposition ('shard', "a3","35","ee", "shard", false, false, true) | |
| 2631 addon:_add_loot_disposition ('gvault', "33","ff","99", _G.GUILD_BANK:lower(), false, false, true) | |
| 2632 end | 2653 end |
| 2633 | 2654 |
| 2634 -- In the rare case of items getting put into the loot table without current | 2655 -- In the rare case of items getting put into the loot table without current |
| 2635 -- item cache data (which will have arrived by now). | 2656 -- item cache data (which will have arrived by now). |
| 2636 function addon:do_item_cache_fixup() | 2657 function addon:do_item_cache_fixup() |
