Mercurial > wow > inventory
comparison Core.lua @ 30:8177b5bcb883
Added tag ?NYI? to the ?Alert when below minimum? option.
Added ?Don't queue when below threshold? option. This isn?t functional yet, just a place holder to indicate it will be implemented at a later time.
Added initial functionality for ?virtual? groups (feel free to suggest a better name :P), with these groups you can override the defaults for multiple groups. By default, settings will be retrieved as CURRENT_GROUP -> DEFAULTS, with this it can become CURRENT_GROUP -> VIRTUAL_GROUP -> DEFAULTS. This will come in handy when managing a lot of groups. Full functionality is not yet implemented, it is just a placeholder to indicate it will be added.
Reduced the softmax for the restock target option from 1000 to 100 to make the slider actually useful. You can still enter a value of upto 100.000 in the edit box below.
author | Zerotorescue |
---|---|
date | Fri, 29 Oct 2010 13:43:41 +0200 |
parents | db57cd9273f1 |
children | e732843b16d2 |
comparison
equal
deleted
inserted
replaced
29:661a59cdcb18 | 30:8177b5bcb883 |
---|---|
3 addon = LibStub("AceAddon-3.0"):NewAddon(addon, "Inventorium", "AceEvent-3.0"); | 3 addon = LibStub("AceAddon-3.0"):NewAddon(addon, "Inventorium", "AceEvent-3.0"); |
4 | 4 |
5 local AceGUI = LibStub("AceGUI-3.0"); | 5 local AceGUI = LibStub("AceGUI-3.0"); |
6 | 6 |
7 local AceConfigDialog, AceConfigRegistry, AceSerializer; | 7 local AceConfigDialog, AceConfigRegistry, AceSerializer; |
8 local groupIdToName = {}; | 8 local groupIdToName, groupIsVirtual, options = {}, {}, {}; |
9 local options = {}; | |
10 local includeTradeSkillItems = 500; | 9 local includeTradeSkillItems = 500; |
11 | 10 |
12 -- All modules must be able to retrieve our supported addons database, thus keep it public | 11 -- All modules must be able to retrieve our supported addons database, thus keep it public |
13 addon.supportedAddons = {}; | 12 addon.supportedAddons = {}; |
14 addon.supportedAddons.auctionPricing = {}; | 13 addon.supportedAddons.auctionPricing = {}; |
627 set = function(i, v) self.db.global.defaults.summaryThresholdShow = v; end, | 626 set = function(i, v) self.db.global.defaults.summaryThresholdShow = v; end, |
628 }, | 627 }, |
629 alertBelowMinimum = { | 628 alertBelowMinimum = { |
630 order = 30, | 629 order = 30, |
631 type = "toggle", | 630 type = "toggle", |
632 name = "Alert when below minimum", | 631 name = "NYI | Alert when below minimum", |
633 desc = "Show an alert when this item gets below this threshold.", | 632 desc = "Show an alert when this item gets below this threshold.", |
634 get = function() return self.db.global.defaults.alertBelowMinimum; end, | 633 get = function() return self.db.global.defaults.alertBelowMinimum; end, |
635 set = function(i, v) self.db.global.defaults.alertBelowMinimum = v; end, | 634 set = function(i, v) self.db.global.defaults.alertBelowMinimum = v; end, |
636 }, | 635 }, |
637 trackAtCharacters = { | 636 trackAtCharacters = { |
678 restockTarget = { | 677 restockTarget = { |
679 order = 10, | 678 order = 10, |
680 type = "range", | 679 type = "range", |
681 min = 0, | 680 min = 0, |
682 max = 100000, | 681 max = 100000, |
683 softMax = 1000, | 682 softMax = 100, |
684 step = 1, | 683 step = 1, |
685 name = "Restock target", | 684 name = "Restock target", |
686 desc = "You can manually enter a value between 1.000 and 100.000 in the edit box if the provided range is insufficient.", | 685 desc = "You can manually enter a value between 100 and 100.000 in the edit box if the provided range is insufficient.", |
687 get = function() return self.db.global.defaults.restockTarget; end, | 686 get = function() return self.db.global.defaults.restockTarget; end, |
688 set = function(i, v) self.db.global.defaults.restockTarget = v; end, | 687 set = function(i, v) self.db.global.defaults.restockTarget = v; end, |
689 }, | 688 }, |
690 minCraftingQueue = { | 689 minCraftingQueue = { |
691 order = 20, | 690 order = 20, |
725 type = "toggle", | 724 type = "toggle", |
726 name = "Hide when below threshold", | 725 name = "Hide when below threshold", |
727 desc = "Hide items from the summary when their value is below the set price threshold.", | 726 desc = "Hide items from the summary when their value is below the set price threshold.", |
728 get = function() return self.db.global.defaults.summaryHidePriceThreshold; end, | 727 get = function() return self.db.global.defaults.summaryHidePriceThreshold; end, |
729 set = function(i, v) self.db.global.defaults.summaryHidePriceThreshold = v; end, | 728 set = function(i, v) self.db.global.defaults.summaryHidePriceThreshold = v; end, |
729 }, | |
730 queueSkipPriceThreshild = { | |
731 order = 55, | |
732 type = "toggle", | |
733 name = "NYI | Don't queue when below threshold", | |
734 desc = "Do not queue items when their value is below the set price threshold.", | |
735 get = function() return self.db.global.defaults.queueSkipPriceThreshild; end, | |
736 set = function(i, v) self.db.global.defaults.queueSkipPriceThreshild = v; end, | |
730 }, | 737 }, |
731 alwaysGetAuctionValue = { | 738 alwaysGetAuctionValue = { |
732 order = 60, | 739 order = 60, |
733 type = "toggle", | 740 type = "toggle", |
734 name = "Always show auction value", | 741 name = "Always show auction value", |
1073 local defaultGroup = { | 1080 local defaultGroup = { |
1074 order = 0, | 1081 order = 0, |
1075 type = "group", | 1082 type = "group", |
1076 childGroups = "tab", | 1083 childGroups = "tab", |
1077 name = function(info) | 1084 name = function(info) |
1078 return groupIdToName[info[#info]]; | 1085 local groupId = info[#info]; |
1086 if groupIsVirtual[groupId] then | |
1087 return ("%s |cfffed000Virtual|r"):format(groupIdToName[groupId]); | |
1088 else | |
1089 return groupIdToName[groupId]; | |
1090 end | |
1091 end, | |
1092 desc = function(info) | |
1093 local groupId = info[#info]; | |
1094 if groupIsVirtual[groupId] then | |
1095 return "This is a virtual group, you can use it to override the defaults for other groups."; | |
1096 end | |
1079 end, | 1097 end, |
1080 args = { | 1098 args = { |
1081 general = { | 1099 general = { |
1082 order = 10, | 1100 order = 10, |
1083 type = "group", | 1101 type = "group", |
1167 | 1185 |
1168 return temp; | 1186 return temp; |
1169 end, | 1187 end, |
1170 arg = "overrideCraftingAddon", | 1188 arg = "overrideCraftingAddon", |
1171 }, | 1189 }, |
1190 virtualGroup = { | |
1191 order = 40, | |
1192 type = "select", | |
1193 name = "Use virtual group settings", | |
1194 desc = "Use the settings from a virtual group before using the general defaults.\n\n|cffff9933This is an advanced option, you will probably not need it unless you manage a lot of groups.|r\n\n|cfffed000Off|r: Use the overridden options in this group and then the defaults.\n\n|cfffed000On|r: Use the overridden options in this group, then the ones in the selected virtual group and then the defaults.", | |
1195 values = function() | |
1196 local temp = {}; | |
1197 | |
1198 --TODO: Build list based on virtual groups we have, exclude the currently selected virtual group (allow endless linking, e.g. Normal group -> virtual1 -> virtual2 -> virtual3 -> ... -> defaults, do this by calling the "GetOptionByKey" function whenever a virtual group is enabled) | |
1199 temp[""] = ""; | |
1200 temp["NYI"] = "Not Yet Implemented"; | |
1201 | |
1202 return temp; | |
1203 end, | |
1204 }, | |
1172 }, | 1205 }, |
1173 }, | 1206 }, |
1174 minimumStock = { | 1207 minimumStock = { |
1175 order = 10, | 1208 order = 10, |
1176 type = "group", | 1209 type = "group", |
1235 arg = "alertBelowMinimum", | 1268 arg = "alertBelowMinimum", |
1236 }, | 1269 }, |
1237 alertBelowMinimum = { | 1270 alertBelowMinimum = { |
1238 order = 30, | 1271 order = 30, |
1239 type = "toggle", | 1272 type = "toggle", |
1240 name = "Alert when below minimum", | 1273 name = "NYI | Alert when below minimum", |
1241 desc = "Show an alert when an item in this group gets below the minimum stock threshold.", | 1274 desc = "Show an alert when an item in this group gets below the minimum stock threshold.", |
1242 arg = "overrideAlertBelowMinimum", | 1275 arg = "overrideAlertBelowMinimum", |
1243 }, | 1276 }, |
1244 overrideTrackAtCharacters = { | 1277 overrideTrackAtCharacters = { |
1245 order = 39, | 1278 order = 39, |
1303 restockTarget = { | 1336 restockTarget = { |
1304 order = 10, | 1337 order = 10, |
1305 type = "range", | 1338 type = "range", |
1306 min = 0, | 1339 min = 0, |
1307 max = 100000, | 1340 max = 100000, |
1308 softMax = 1000, | 1341 softMax = 100, |
1309 step = 1, | 1342 step = 1, |
1310 name = "Restock target", | 1343 name = "Restock target", |
1311 desc = "You can manually enter a value between 1.000 and 100.000 in the edit box if the provided range is insufficient.", | 1344 desc = "You can manually enter a value between 100 and 100.000 in the edit box if the provided range is insufficient.", |
1312 arg = "overrideRestockTarget", | 1345 arg = "overrideRestockTarget", |
1313 }, | 1346 }, |
1314 overrideMinCraftingQueue = { | 1347 overrideMinCraftingQueue = { |
1315 order = 19, | 1348 order = 19, |
1316 type = "toggle", | 1349 type = "toggle", |
1375 order = 50, | 1408 order = 50, |
1376 type = "toggle", | 1409 type = "toggle", |
1377 name = "Hide when below threshold", | 1410 name = "Hide when below threshold", |
1378 desc = "Hide items from the summary when their value is below the set price threshold.", | 1411 desc = "Hide items from the summary when their value is below the set price threshold.", |
1379 arg = "overrideSummaryHidePriceThreshold", | 1412 arg = "overrideSummaryHidePriceThreshold", |
1413 }, | |
1414 overrideQueueSkipPriceThreshild = { | |
1415 order = 54, | |
1416 type = "toggle", | |
1417 name = "Override queue skipping", | |
1418 desc = "Allows you to override if items in this group should be skipped when queueing while their value is below the price threshold.", | |
1419 arg = "queueSkipPriceThreshild", | |
1420 }, | |
1421 queueSkipPriceThreshild = { | |
1422 order = 55, | |
1423 type = "toggle", | |
1424 name = "NYI | Don't queue when below threshold", | |
1425 desc = "Do not queue items when their value is below the set price threshold.", | |
1426 arg = "overrideQueueSkipPriceThreshild", | |
1380 }, | 1427 }, |
1381 overrideAlwaysGetAuctionValue = { | 1428 overrideAlwaysGetAuctionValue = { |
1382 order = 59, | 1429 order = 59, |
1383 type = "toggle", | 1430 type = "toggle", |
1384 name = "Override auction value showing", | 1431 name = "Override auction value showing", |
1502 add = { | 1549 add = { |
1503 order = 30, | 1550 order = 30, |
1504 type = "group", | 1551 type = "group", |
1505 name = "Add items", | 1552 name = "Add items", |
1506 desc = "Add new items to this group.", | 1553 desc = "Add new items to this group.", |
1554 disabled = function(info) return groupIsVirtual[info[2]]; end, | |
1507 args = { | 1555 args = { |
1508 singleAdd = { | 1556 singleAdd = { |
1509 order = 10, | 1557 order = 10, |
1510 type = "group", | 1558 type = "group", |
1511 inline = true, | 1559 inline = true, |
1701 remove = { | 1749 remove = { |
1702 order = 40, | 1750 order = 40, |
1703 type = "group", | 1751 type = "group", |
1704 name = "Current items", | 1752 name = "Current items", |
1705 desc = "View, export or remove items from this group.", | 1753 desc = "View, export or remove items from this group.", |
1754 disabled = function(info) return groupIsVirtual[info[2]]; end, | |
1706 args = { | 1755 args = { |
1707 help = { | 1756 help = { |
1708 order = 10, | 1757 order = 10, |
1709 type = "group", | 1758 type = "group", |
1710 inline = true, | 1759 inline = true, |
1821 }, | 1870 }, |
1822 }, | 1871 }, |
1823 }, | 1872 }, |
1824 }; | 1873 }; |
1825 | 1874 |
1875 local currentGroupType = "Normal"; | |
1826 function addon:MakeGroupOptions() | 1876 function addon:MakeGroupOptions() |
1827 options.args.groups = { | 1877 options.args.groups = { |
1828 order = 1100, | 1878 order = 1100, |
1829 type = "group", | 1879 type = "group", |
1830 name = "Groups", | 1880 name = "Groups", |
1842 name = "Group name", | 1892 name = "Group name", |
1843 desc = "The name of the group. You can also use item links as you wish.", | 1893 desc = "The name of the group. You can also use item links as you wish.", |
1844 validate = ValidateGroupName, | 1894 validate = ValidateGroupName, |
1845 set = function(_, value) | 1895 set = function(_, value) |
1846 self.db.global.groups[value] = {}; | 1896 self.db.global.groups[value] = {}; |
1847 | 1897 if currentGroupType == "Virtual" then |
1898 self.db.global.groups[value].isVirtual = true; | |
1899 end | |
1900 | |
1848 addon:FillGroupOptions(); | 1901 addon:FillGroupOptions(); |
1849 end, | 1902 end, |
1850 get = false, | 1903 get = false, |
1851 width = "double", | 1904 width = "double", |
1905 }, | |
1906 type = { | |
1907 order = 20, | |
1908 type = "select", | |
1909 name = "Type (advanced)", | |
1910 desc = "The type of the new group. This can not be changed at a later time.\n\n|cffff9933This is an advanced option, you will probably not need it unless you manage a lot of groups.|r\n\n|cfffed000Normal|r: A normal group with complete functionality.\n\n|cfffed000Virtual|r: A virtual group which you can use to override the defaults for a set of groups. You can not add items to virtual groups.", | |
1911 values = { | |
1912 ["Normal"] = "Normal", | |
1913 ["Virtual"] = "Virtual", | |
1914 }, | |
1915 set = function(_, value) currentGroupType = value; end, | |
1916 get = function() return currentGroupType; end, | |
1852 }, | 1917 }, |
1853 }, | 1918 }, |
1854 }, | 1919 }, |
1855 import = { | 1920 import = { |
1856 order = 20, | 1921 order = 20, |
1923 for id, name in pairs(groupIdToName) do | 1988 for id, name in pairs(groupIdToName) do |
1924 if type(name) == "string" and not self.db.global.groups[name] then | 1989 if type(name) == "string" and not self.db.global.groups[name] then |
1925 options.args.groups.args[id] = nil; | 1990 options.args.groups.args[id] = nil; |
1926 groupIdToName[id] = nil; | 1991 groupIdToName[id] = nil; |
1927 groupIdToName[name] = nil; | 1992 groupIdToName[name] = nil; |
1993 groupIsVirtual[id] = nil; | |
1928 end | 1994 end |
1929 end | 1995 end |
1930 | 1996 |
1931 for name, values in pairs(self.db.global.groups) do | 1997 for name, values in pairs(self.db.global.groups) do |
1932 if not groupIdToName[name] then | 1998 if not groupIdToName[name] then |
1933 options.args.groups.args[tostring(count)] = defaultGroup; | 1999 options.args.groups.args[tostring(count)] = defaultGroup; |
1934 | 2000 |
1935 groupIdToName[tostring(count)] = name; | 2001 groupIdToName[tostring(count)] = name; |
1936 groupIdToName[name] = true; | 2002 groupIdToName[name] = true; |
2003 if values.isVirtual then | |
2004 groupIsVirtual[tostring(count)] = true; | |
2005 end | |
1937 | 2006 |
1938 count = ( count + 1 ); | 2007 count = ( count + 1 ); |
1939 end | 2008 end |
1940 end | 2009 end |
1941 end | 2010 end |