Mercurial > wow > ouroloot
comparison core.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 |
|---|---|
| 176 --['heirloom'] = 7, | 176 --['heirloom'] = 7, |
| 177 } | 177 } |
| 178 local my_name = UnitName('player') | 178 local my_name = UnitName('player') |
| 179 local comm_cleanup_ttl = 4 -- seconds in the communications cache | 179 local comm_cleanup_ttl = 4 -- seconds in the communications cache |
| 180 local version_large = nil -- defaults to 1, possibly changed by version | 180 local version_large = nil -- defaults to 1, possibly changed by version |
| 181 local g_LOOT_ITEM_ss, g_LOOT_ITEM_MULTIPLE_sss, g_LOOT_ITEM_SELF_s, g_LOOT_ITEM_SELF_MULTIPLE_ss | 181 local g_LOOT_ITEM_ss, g_LOOT_ITEM_MULTIPLE_sss, g_LOOT_ITEM_SELF_s |
| 182 local g_LOOT_ITEM_SELF_MULTIPLE_ss, g_LOOT_ITEM_WHILE_PLAYER_INELIGIBLE_ss | |
| 182 | 183 |
| 183 | 184 |
| 184 ------ Addon member data | 185 ------ Addon member data |
| 185 local flib = LibStub("LibFarmbuyer") | 186 local flib = LibStub("LibFarmbuyer") |
| 186 addon.author_debug = flib.author_debug | 187 addon.author_debug = flib.author_debug |
| 964 end | 965 end |
| 965 break | 966 break |
| 966 end | 967 end |
| 967 | 968 |
| 968 --[[ | 969 --[[ |
| 969 The four loot format patterns of interest, changed into relatively tight | 970 The five loot format patterns of interest, changed into relatively tight |
| 970 string match patterns. Done at enable-time rather than load-time against | 971 string match patterns. Done at enable-time rather than load-time against |
| 971 the slim chance that one of the non-US "delocalizers" needs to mess with | 972 the slim chance that one of the non-US "delocalizers" needs to mess with |
| 972 the global patterns before we transform them. | 973 the global patterns before we transform them. |
| 973 | 974 |
| 974 The SELF variants can be replaced with LOOT_ITEM_PUSHED_SELF[_MULTIPLE] to | 975 The SELF variants can be replaced with LOOT_ITEM_PUSHED_SELF[_MULTIPLE] to |
| 975 trigger on 'receive item' instead, which would detect extracting stuff | 976 trigger on 'receive item' instead, which would detect extracting stuff |
| 976 from mail, or s/PUSHED/CREATED/ for things like healthstones and guild | 977 from mail, or s/PUSHED/CREATED/ for things like healthstones and guild |
| 977 cauldron flasks. | 978 cauldron flasks. |
| 978 | |
| 979 ??? do something with LOOT_ITEM_WHILE_PLAYER_INELIGIBLE for locked LFRs? | |
| 980 ]] | 979 ]] |
| 981 | 980 |
| 982 -- LOOT_ITEM = "%s receives loot: %s." --> (.+) receives loot: (.+)%. | 981 -- LOOT_ITEM = "%s receives loot: %s." --> (.+) receives loot: (.+)%. |
| 983 g_LOOT_ITEM_ss = LOOT_ITEM:gsub('%.$','%%.'):gsub('%%s','(.+)') | 982 g_LOOT_ITEM_ss = LOOT_ITEM:gsub('%.$','%%.'):gsub('%%s','(.+)') |
| 984 | 983 |
| 988 -- LOOT_ITEM_SELF = "You receive loot: %s." --> You receive loot: (.+)%. | 987 -- LOOT_ITEM_SELF = "You receive loot: %s." --> You receive loot: (.+)%. |
| 989 g_LOOT_ITEM_SELF_s = LOOT_ITEM_SELF:gsub('%.$','%%.'):gsub('%%s','(.+)') | 988 g_LOOT_ITEM_SELF_s = LOOT_ITEM_SELF:gsub('%.$','%%.'):gsub('%%s','(.+)') |
| 990 | 989 |
| 991 -- LOOT_ITEM_SELF_MULTIPLE = "You receive loot: %sx%d." --> You receive loot: (.+)(x%d+)%. | 990 -- LOOT_ITEM_SELF_MULTIPLE = "You receive loot: %sx%d." --> You receive loot: (.+)(x%d+)%. |
| 992 g_LOOT_ITEM_SELF_MULTIPLE_ss = LOOT_ITEM_SELF_MULTIPLE:gsub('%.$','%%.'):gsub('%%s','(.+)'):gsub('x%%d','(x%%d+)') | 991 g_LOOT_ITEM_SELF_MULTIPLE_ss = LOOT_ITEM_SELF_MULTIPLE:gsub('%.$','%%.'):gsub('%%s','(.+)'):gsub('x%%d','(x%%d+)') |
| 992 | |
| 993 -- LOOT_ITEM_WHILE_PLAYER_INELIGIBLE is mostly the same as LOOT_ITEM with | |
| 994 -- an inline texture and no full stop. The punctuation in the texture | |
| 995 -- path causes fits while matching, so just make that a wildcard rather | |
| 996 -- than trying to escape it all. | |
| 997 g_LOOT_ITEM_WHILE_PLAYER_INELIGIBLE_ss = LOOT_ITEM_WHILE_PLAYER_INELIGIBLE: | |
| 998 gsub('\124T%S*\124t','\124T%%S*\124t'):gsub('%%s','(.+)') | |
| 993 | 999 |
| 994 --[[ | 1000 --[[ |
| 995 Throw in the default disposition types. This could be called during load | 1001 Throw in the default disposition types. This could be called during load |
| 996 were it not for the need to talk to the GUI data (not set up yet). | 1002 were it not for the need to talk to the GUI data (not set up yet). |
| 997 | 1003 |
| 1741 return ret1, ret2 | 1747 return ret1, ret2 |
| 1742 end | 1748 end |
| 1743 | 1749 |
| 1744 -- Returns the index of the resulting new loot entry, or nil after | 1750 -- Returns the index of the resulting new loot entry, or nil after |
| 1745 -- displaying any errors. | 1751 -- displaying any errors. |
| 1752 local match = string.match | |
| 1746 function addon:CHAT_MSG_LOOT (event, ...) | 1753 function addon:CHAT_MSG_LOOT (event, ...) |
| 1747 if (not self.rebroadcast) and (not self.enabled) and (event ~= "manual") then return end | 1754 if (not self.rebroadcast) and (not self.enabled) and (event ~= "manual") then return end |
| 1748 | 1755 |
| 1749 --[[ | 1756 --[[ |
| 1750 iname: Hearthstone | 1757 iname: Hearthstone |
| 1758 local msg = ... | 1765 local msg = ... |
| 1759 local person, itemstring, count | 1766 local person, itemstring, count |
| 1760 --ChatFrame2:AddMessage("original string: >"..(msg:gsub("\124","\124\124")).."<") | 1767 --ChatFrame2:AddMessage("original string: >"..(msg:gsub("\124","\124\124")).."<") |
| 1761 | 1768 |
| 1762 -- test in most likely order: other people get more loot than "you" do | 1769 -- test in most likely order: other people get more loot than "you" do |
| 1763 person, itemstring, count = msg:match(g_LOOT_ITEM_MULTIPLE_sss) | 1770 person, itemstring, count = match(msg,g_LOOT_ITEM_MULTIPLE_sss) |
| 1764 if not person then | 1771 if not person then |
| 1765 person, itemstring = msg:match(g_LOOT_ITEM_ss) | 1772 person, itemstring = match(msg,g_LOOT_ITEM_ss) |
| 1766 end | 1773 end |
| 1767 if not person then | 1774 if not person then |
| 1768 itemstring, count = msg:match(g_LOOT_ITEM_SELF_MULTIPLE_ss) | 1775 -- Could only do this text if in an LFR... but the restriction |
| 1776 -- might apply elsewhere soon enough. | |
| 1777 person, itemstring = match(msg,g_LOOT_ITEM_WHILE_PLAYER_INELIGIBLE_ss) | |
| 1778 end | |
| 1779 if not person then | |
| 1780 itemstring, count = match(msg,g_LOOT_ITEM_SELF_MULTIPLE_ss) | |
| 1769 if not itemstring then | 1781 if not itemstring then |
| 1770 itemstring = msg:match(g_LOOT_ITEM_SELF_s) | 1782 itemstring = match(msg,g_LOOT_ITEM_SELF_s) |
| 1771 end | 1783 end |
| 1772 end | 1784 end |
| 1773 | 1785 |
| 1774 if not itemstring then return end -- "PlayerX selected Greed", etc, not looting | 1786 if not itemstring then return end -- "PlayerX selected Greed", etc, not looting |
| 1775 self.dprint('loot', "CHAT_MSG_LOOT, person is", person, | 1787 self.dprint('loot', "CHAT_MSG_LOOT, person is", person, |
| 1776 ", itemstring is", itemstring, ", count is", count) | 1788 ", itemstring is", itemstring, ", count is", count) |
| 1777 | 1789 |
| 1778 -- Name might be colorized, remove the highlighting | 1790 -- Name might be colorized, remove the highlighting |
| 1779 if person then | 1791 if person then |
| 1780 person = person:match("|c%x%x%x%x%x%x%x%x(%S+)") or person | 1792 person = match(person,"|c%x%x%x%x%x%x%x%x(%S+)") or person |
| 1781 else | 1793 else |
| 1782 person = my_name -- UNIT_YOU / You | 1794 person = my_name -- UNIT_YOU / You |
| 1783 end | 1795 end |
| 1784 | 1796 |
| 1785 --local id = tonumber(itemstring:match('|Hitem:(%d+):')) | 1797 --local id = tonumber(itemstring:match('|Hitem:(%d+):')) |
| 2325 if type(g_loot.printed) ~= 'table' then | 2337 if type(g_loot.printed) ~= 'table' then |
| 2326 g_loot.printed = {} | 2338 g_loot.printed = {} |
| 2327 end | 2339 end |
| 2328 | 2340 |
| 2329 self.threshold = opts.threshold or self.threshold -- in the case of restoring but not tracking | 2341 self.threshold = opts.threshold or self.threshold -- in the case of restoring but not tracking |
| 2330 local g_loot_wrapper = self:gui_init (g_loot, g_uniques) | 2342 local g_loot_wrapper = self:gui_init (true, g_loot, g_uniques) |
| 2331 opts.autoshard = nil | 2343 opts.autoshard = nil |
| 2332 opts.threshold = nil | 2344 opts.threshold = nil |
| 2333 | 2345 |
| 2334 if g_restore_p then | 2346 if g_restore_p then |
| 2335 self:zero_printed_fenceposts() -- g_loot.printed.* = previous/safe values | 2347 self:zero_printed_fenceposts() -- g_loot.printed.* = previous/safe values |
| 2489 d.instance == e.instance and | 2501 d.instance == e.instance and |
| 2490 d.reason == 'wipe' | 2502 d.reason == 'wipe' |
| 2491 then | 2503 then |
| 2492 first = first or i | 2504 first = first or i |
| 2493 attempts = attempts + 1 | 2505 attempts = attempts + 1 |
| 2494 assert(tremove(g_loot,i)==d,"_mark_boss_kill screwed up data badly") | 2506 assert(g_gui.g_dloot:remove(i)==d,"_mark_boss_kill screwed up data badly") |
| 2495 else | 2507 else |
| 2496 i = i + 1 | 2508 i = i + 1 |
| 2497 end | 2509 end |
| 2498 d = g_loot[i] | 2510 d = g_loot[i] |
| 2499 end | 2511 end |
| 2681 e.unique = e.id .. (e.disposition or e.person) .. date("%Y/%m/%d %H:%M",e.stamp) | 2693 e.unique = e.id .. (e.disposition or e.person) .. date("%Y/%m/%d %H:%M",e.stamp) |
| 2682 end | 2694 end |
| 2683 addon:Fire ('NewLootEntry', e, index) | 2695 addon:Fire ('NewLootEntry', e, index) |
| 2684 end | 2696 end |
| 2685 g_loot[index] = e | 2697 g_loot[index] = e |
| 2698 g_gui.g_dloot[index] = nil | |
| 2686 addon:Fire ('NewEOIEntry', e, index) | 2699 addon:Fire ('NewEOIEntry', e, index) |
| 2687 return index | 2700 return index |
| 2688 end | 2701 end |
| 2689 | 2702 |
| 2690 -- Safety/convenience wrapper only. | 2703 -- Safety/convenience wrapper only. |
| 2722 return | 2735 return |
| 2723 end | 2736 end |
| 2724 end | 2737 end |
| 2725 | 2738 |
| 2726 assert(g_loot[is].kind == 'boss') | 2739 assert(g_loot[is].kind == 'boss') |
| 2727 local boss = tremove (g_loot, is) | 2740 local boss = g_gui.g_dloot:remove(is) |
| 2728 tinsert (g_loot, should_be, boss) | 2741 g_gui.g_dloot:insert (should_be, boss) |
| 2729 return should_be | 2742 return should_be |
| 2730 end | 2743 end |
| 2731 end | 2744 end |
| 2732 | 2745 |
| 2733 -- Disposition control; more precisely, how various dispositions affect flow | 2746 -- Disposition control; more precisely, how various dispositions affect flow |
