Mercurial > wow > ouroloot
comparison 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 |
comparison
equal
deleted
inserted
replaced
69:8442272a8418 | 70:cdee65c1bd8c |
---|---|
1803 opts.bossmod = list[choice] | 1803 opts.bossmod = list[choice] |
1804 end) | 1804 end) |
1805 grp:AddChild(w) | 1805 grp:AddChild(w) |
1806 end | 1806 end |
1807 | 1807 |
1808 -- item filter | 1808 -- item filters |
1809 w = GUI:Create("Spacer") | 1809 w = GUI:Create("Spacer") |
1810 w:SetFullWidth(true) | 1810 w:SetFullWidth(true) |
1811 w:SetHeight(20) | 1811 w:SetHeight(20) |
1812 grp:AddChild(w) | 1812 grp:AddChild(w) |
1813 do | 1813 do |
1814 local list = {} | 1814 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." |
1815 local cache_warn, cache_warned = false, false | 1815 local cache_warn, cache_warned = false, false |
1816 local function do_warning() | |
1817 if cache_warn and not cache_warned then | |
1818 cache_warned = true | |
1819 addon:Print(warntext) | |
1820 end | |
1821 end | |
1822 | |
1823 local filterlist, vaultlist = {}, {} | |
1816 for id in pairs(opts.itemfilter) do | 1824 for id in pairs(opts.itemfilter) do |
1817 local iname, _, iquality = GetItemInfo(id) | 1825 local iname, _, iquality = GetItemInfo(id) |
1818 if iname then | 1826 if iname then |
1819 list[id] = ITEM_QUALITY_COLORS[iquality].hex .. iname .. "|r" | 1827 filterlist[id] = ITEM_QUALITY_COLORS[iquality].hex .. iname .. "|r" |
1820 else | 1828 else |
1821 cache_warn = true | 1829 cache_warn = true |
1822 end | 1830 end |
1823 end | 1831 end |
1832 for id in pairs(opts.itemvault) do | |
1833 local iname, _, iquality = GetItemInfo(id) | |
1834 if iname then | |
1835 vaultlist[id] = ITEM_QUALITY_COLORS[iquality].hex .. iname .. "|r" | |
1836 else | |
1837 cache_warn = true | |
1838 end | |
1839 end | |
1840 | |
1824 w = GUI:Create("EditBoxDropDown") | 1841 w = GUI:Create("EditBoxDropDown") |
1825 w:SetRelativeWidth(0.4) | 1842 w:SetRelativeWidth(0.4) |
1826 w:SetText("Item filter") | 1843 w:SetText("Item filter") |
1827 w:SetEditBoxTooltip("Link items which should no longer be tracked.") | 1844 w:SetEditBoxTooltip("Link items which should no longer be tracked.") |
1828 w:SetList(list) | 1845 w:SetList(filterlist) |
1829 w:SetCallback("OnTextEnterPressed", function(_w, _, text) | 1846 w:SetCallback("OnTextEnterPressed", function(_w, _, text) |
1830 local iname, ilink, iquality = GetItemInfo(strtrim(text)) | 1847 local iname, ilink, iquality = GetItemInfo(strtrim(text)) |
1831 if not iname then | 1848 if not iname then |
1832 return addon:Print("Error: %s is not a valid item name/link!", text) | 1849 return addon:Print("Error: %s is not a valid item name/link!", text) |
1833 end | 1850 end |
1834 local id = tonumber(ilink:match("item:(%d+)")) | 1851 local id = tonumber(ilink:match("item:(%d+)")) |
1835 list[id] = ITEM_QUALITY_COLORS[iquality].hex .. iname .. "|r" | 1852 filterlist[id] = ITEM_QUALITY_COLORS[iquality].hex .. iname .. "|r" |
1836 opts.itemfilter[id] = true | 1853 opts.itemfilter[id] = true |
1837 addon:Print("Now filtering out", ilink) | 1854 addon:Print("Now filtering out", ilink) |
1838 end) | 1855 end) |
1839 w:SetCallback("OnListItemClicked", function(_w, _, key_id, val_name) | 1856 w:SetCallback("OnListItemClicked", function(_w, _, key_id, val_name) |
1840 --local ilink = select(2,GetItemInfo(key_id)) | 1857 --local ilink = select(2,GetItemInfo(key_id)) |
1841 opts.itemfilter[tonumber(key_id)] = nil | 1858 opts.itemfilter[tonumber(key_id)] = nil |
1842 --addon:Print("No longer filtering out", ilink) | 1859 --addon:Print("No longer filtering out", ilink) |
1843 addon:Print("No longer filtering out", val_name) | 1860 addon:Print("No longer filtering out", val_name) |
1844 end) | 1861 end) |
1845 w:SetCallback("OnDropdownShown", function() | 1862 w:SetCallback("OnDropdownShown",do_warning) |
1846 if cache_warn and not cache_warned then | 1863 grp:AddChild(w) |
1847 cache_warned = true | 1864 |
1848 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.") | 1865 w = GUI:Create("Spacer") |
1866 w:SetRelativeWidth(0.1) | |
1867 w:SetHeight(2) | |
1868 grp:AddChild(w) | |
1869 | |
1870 w = GUI:Create("EditBoxDropDown") | |
1871 w:SetRelativeWidth(0.4) | |
1872 w:SetText("Vault items") | |
1873 w:SetEditBoxTooltip("Link items which should be automatically marked as guild vault.") | |
1874 w:SetList(vaultlist) | |
1875 w:SetCallback("OnTextEnterPressed", function(_w, _, text) | |
1876 local iname, ilink, iquality = GetItemInfo(strtrim(text)) | |
1877 if not iname then | |
1878 return addon:Print("Error: %s is not a valid item name/link!", text) | |
1849 end | 1879 end |
1880 local id = tonumber(ilink:match("item:(%d+)")) | |
1881 vaultlist[id] = ITEM_QUALITY_COLORS[iquality].hex .. iname .. "|r" | |
1882 opts.itemvault[id] = true | |
1883 addon:Print("Now auto-vaulting", ilink) | |
1850 end) | 1884 end) |
1885 w:SetCallback("OnListItemClicked", function(_w, _, key_id, val_name) | |
1886 --local ilink = select(2,GetItemInfo(key_id)) | |
1887 opts.itemfilter[tonumber(key_id)] = nil | |
1888 --addon:Print("No longer filtering out", ilink) | |
1889 addon:Print("No longer auto-vaulting", val_name) | |
1890 end) | |
1891 w:SetCallback("OnDropdownShown",do_warning) | |
1851 grp:AddChild(w) | 1892 grp:AddChild(w) |
1852 end | 1893 end |
1853 | 1894 |
1854 addon.sender_list.sort() | 1895 addon.sender_list.sort() |
1855 if #addon.sender_list.namesI > 0 then | 1896 if #addon.sender_list.namesI > 0 then |