Mercurial > wow > ouroloot
diff gui.lua @ 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 |
line wrap: on
line diff
--- 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
