Mercurial > wow > ouroloot
changeset 70:cdee65c1bd8c
Implement a list of items to be automatically marked as sent to the guild vault. List controlled on the Options tab like the existing filter. Default list is Cataclysm crafting material drops.
| author | Farmbuyer of US-Kilrogg <farmbuyer@gmail.com> |
|---|---|
| date | Fri, 11 May 2012 03:56:21 +0000 |
| parents | 8442272a8418 |
| children | fb330a1fb6e9 |
| files | core.lua gui.lua verbage.lua |
| diffstat | 3 files changed, 66 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/core.lua Fri May 11 03:08:12 2012 +0000 +++ b/core.lua Fri May 11 03:56:21 2012 +0000 @@ -547,6 +547,10 @@ opts.itemfilter = self.default_itemfilter end self.default_itemfilter = nil + if opts.itemvault == nil then + opts.itemvault = self.default_itemvault + end + self.default_itemvault = nil self:RegisterChatCommand("ouroloot", "OnSlash") if opts.register_slashloot then @@ -1082,12 +1086,16 @@ id = itemid, itemlink = ilink, itexture = itexture, - disposition = (recipient == self.sharder) and 'shard' or nil, count = (count and count ~= "") and count or nil, bcast_from = from, extratext = extratext, variant = self:is_variant_item(ilink), } + if opts.itemvault[itemid] then + i.disposition = 'gvault' + elseif recipient == self.sharder then + i.disposition = 'shard' + end if local_override then -- player is adding loot by hand, don't wait for network cache timeouts -- keep this sync'd with prefer_local_loots above
--- a/gui.lua Fri May 11 03:08:12 2012 +0000 +++ b/gui.lua Fri May 11 03:56:21 2012 +0000 @@ -1805,34 +1805,51 @@ grp:AddChild(w) end - -- item filter + -- item filters w = GUI:Create("Spacer") w:SetFullWidth(true) w:SetHeight(20) grp:AddChild(w) do - local list = {} + 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." local cache_warn, cache_warned = false, false + local function do_warning() + if cache_warn and not cache_warned then + cache_warned = true + addon:Print(warntext) + end + end + + local filterlist, vaultlist = {}, {} for id in pairs(opts.itemfilter) do local iname, _, iquality = GetItemInfo(id) if iname then - list[id] = ITEM_QUALITY_COLORS[iquality].hex .. iname .. "|r" + filterlist[id] = ITEM_QUALITY_COLORS[iquality].hex .. iname .. "|r" else cache_warn = true end end + for id in pairs(opts.itemvault) do + local iname, _, iquality = GetItemInfo(id) + if iname then + vaultlist[id] = ITEM_QUALITY_COLORS[iquality].hex .. iname .. "|r" + else + cache_warn = true + end + end + w = GUI:Create("EditBoxDropDown") w:SetRelativeWidth(0.4) w:SetText("Item filter") w:SetEditBoxTooltip("Link items which should no longer be tracked.") - w:SetList(list) + w:SetList(filterlist) w:SetCallback("OnTextEnterPressed", function(_w, _, text) local iname, ilink, iquality = GetItemInfo(strtrim(text)) if not iname then return addon:Print("Error: %s is not a valid item name/link!", text) end local id = tonumber(ilink:match("item:(%d+)")) - list[id] = ITEM_QUALITY_COLORS[iquality].hex .. iname .. "|r" + filterlist[id] = ITEM_QUALITY_COLORS[iquality].hex .. iname .. "|r" opts.itemfilter[id] = true addon:Print("Now filtering out", ilink) end) @@ -1842,12 +1859,36 @@ --addon:Print("No longer filtering out", ilink) addon:Print("No longer filtering out", val_name) end) - w:SetCallback("OnDropdownShown", function() - if cache_warn and not cache_warned then - cache_warned = true - addon:Print("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.") + w:SetCallback("OnDropdownShown",do_warning) + grp:AddChild(w) + + w = GUI:Create("Spacer") + w:SetRelativeWidth(0.1) + w:SetHeight(2) + grp:AddChild(w) + + w = GUI:Create("EditBoxDropDown") + w:SetRelativeWidth(0.4) + w:SetText("Vault items") + w:SetEditBoxTooltip("Link items which should be automatically marked as guild vault.") + w:SetList(vaultlist) + w:SetCallback("OnTextEnterPressed", function(_w, _, text) + local iname, ilink, iquality = GetItemInfo(strtrim(text)) + if not iname then + return addon:Print("Error: %s is not a valid item name/link!", text) end + local id = tonumber(ilink:match("item:(%d+)")) + vaultlist[id] = ITEM_QUALITY_COLORS[iquality].hex .. iname .. "|r" + opts.itemvault[id] = true + addon:Print("Now auto-vaulting", ilink) end) + w:SetCallback("OnListItemClicked", function(_w, _, key_id, val_name) + --local ilink = select(2,GetItemInfo(key_id)) + opts.itemfilter[tonumber(key_id)] = nil + --addon:Print("No longer filtering out", ilink) + addon:Print("No longer auto-vaulting", val_name) + end) + w:SetCallback("OnDropdownShown",do_warning) grp:AddChild(w) end
--- a/verbage.lua Fri May 11 03:08:12 2012 +0000 +++ b/verbage.lua Fri May 11 03:56:21 2012 +0000 @@ -1,7 +1,5 @@ local todo = [[ -- broadcasted entries triggering auto-shard don't have "shard" text - - [DONE,TEST,comm] releasing before DBM signals wipe results in outdoor location - implement ack, then fallback to recording if not ack'd @@ -553,4 +551,11 @@ [49426] = true, -- Emblem of Frost } +-- Mark these as straight to guild vault: +addon.default_itemvault = { + [52078] = true, -- Chaos Orb + [69237] = true, -- Living Ember + [71998] = true, -- Essence of Destruction +} + -- vim:noet
