comparison Core.lua @ 35:31e5da6a2b16

Added a description for which item count addon is used. Virtual group option should no longer get disabled.
author Zerotorescue
date Wed, 03 Nov 2010 19:38:53 +0100
parents e732843b16d2
children 58fb38f0b447
comparison
equal deleted inserted replaced
34:73470d53a429 35:31e5da6a2b16
518 type = "description", 518 type = "description",
519 name = "Please note that all multi-select |cfffed000dropdown|r boxes were turned into multi-select |cfffed000toggle|r boxes. I do not intend to keep it this way, however it can not yet be reverted due to a major bug in one of the libraries used by Inventorium. The layout of this config may look terribly organized in it's current state.\n\n" .. 519 name = "Please note that all multi-select |cfffed000dropdown|r boxes were turned into multi-select |cfffed000toggle|r boxes. I do not intend to keep it this way, however it can not yet be reverted due to a major bug in one of the libraries used by Inventorium. The layout of this config may look terribly organized in it's current state.\n\n" ..
520 "Since this is a beta some functionality might not be implemented yet while the options are available (usually - but not always - tagged as \"NYI\"). These options are used to indicate a feature is on the way and will be implemented before Inventorium is tagged as a release.\n\n" .. 520 "Since this is a beta some functionality might not be implemented yet while the options are available (usually - but not always - tagged as \"NYI\"). These options are used to indicate a feature is on the way and will be implemented before Inventorium is tagged as a release.\n\n" ..
521 "Please request things you want and report anything that's clunky, weird, vague or otherwise buggy at |cfffed000the Inventorium development addon page|r. You can find this by searching for \"|cfffed000Inventorium|r\" at |cfffed000CurseForge.com|r.\n\n" .. 521 "Please request things you want and report anything that's clunky, weird, vague or otherwise buggy at |cfffed000the Inventorium development addon page|r. You can find this by searching for \"|cfffed000Inventorium|r\" at |cfffed000CurseForge.com|r.\n\n" ..
522 "Tutorials for Inventorium will be created after the first stable release. If you require any help before that you can always contact me in the |cfffed000#JMTC|r IRC channel at |cfffed000QuakeNet.org|r. You may also report issues and request things there if you wish.\n\n" .. 522 "Tutorials for Inventorium will be created after the first stable release. If you require any help before that you can always contact me in the |cfffed000#JMTC|r IRC channel at |cfffed000QuakeNet.org|r. You may also report issues and request things there if you wish.\n\n" ..
523 "You might notice the summary window currently gets very slow when refreshed once you get over 100-200 items in the list, this is a known issue and will be fixed in version 1.1 (which is after the initial release).", 523 "You might notice the summary window currently gets very slow when refreshed once you get over 100-200 items in the list, this is a known issue and will be fixed in |cfffed000version 1.1|r (which is after the initial release).",
524 }, 524 },
525 }, 525 },
526 }, 526 },
527 general = { 527 general = {
528 order = 1, 528 order = 1,
531 name = "General", 531 name = "General",
532 args = { 532 args = {
533 description = { 533 description = {
534 order = 0, 534 order = 0,
535 type = "description", 535 type = "description",
536 name = "Here you can set general settings. The settings entered here will be used when you choose not to override the settings within an individual group.", 536 name = function()
537 local t = "Here you can set general settings. The settings entered here will be used when you choose not to override the settings within an individual group.\n\n";
538
539 local currentAddon, selectedAddonName = addon:GetItemCountAddon();
540
541 if currentAddon then
542 --GetCharacterCount
543 --self.supportedAddons.itemCount[selectedExternalAddon]
544 t = t .. "Currently using |cfffed000" .. selectedAddonName .. "|r as your item count addon. This addon is " .. ((currentAddon.IsEnabled() and "|cff00ff00enabled|r") or "|cffff0000disabled|r") .. ".";
545
546 if currentAddon.GetTotalCount and currentAddon.GetCharacterCount then
547 t = t .. " This addon supports |cfffed000both total as local|r item counts.";
548 elseif currentAddon.GetTotalCount then
549 t = t .. " This addon supports |cfffed000only total|r item counts.";
550 elseif currentAddon.GetCharacterCount then
551 t = t .. " This addon supports |cfffed000only local|r item counts.";
552 end
553 end
554
555 return t;
556 end,
537 }, 557 },
538 header = { 558 header = {
539 order = 5, 559 order = 5,
540 type = "header", 560 type = "header",
541 name = "", 561 name = "",
907 927
908 local function GetDisabled(info) 928 local function GetDisabled(info)
909 local groupName = groupIdToName[info[2]]; 929 local groupName = groupIdToName[info[2]];
910 local optionName = info[#info]; 930 local optionName = info[#info];
911 931
912 if optionName:find("override") then 932 if optionName:find("override") or not info.arg then
913 return false; 933 return false;
914 end 934 end
915 935
916 return (addon:GetOptionByKey(groupName, info.arg, true) == nil); 936 return (addon:GetOptionByKey(groupName, info.arg, true) == nil);
917 end 937 end
1137 disabled = GetDisabled, 1157 disabled = GetDisabled,
1138 args = { 1158 args = {
1139 description = { 1159 description = {
1140 order = 0, 1160 order = 0,
1141 type = "description", 1161 type = "description",
1142 name = "Here you can set general settings for the currently selected group. If you do not wish to override a setting, the default setting specified in the general group will be used.", 1162 name = function(info)
1163 local groupName = groupIdToName[info[2]];
1164
1165 local t = "Here you can set general settings for the currently selected group. If you do not wish to override a setting, the default setting specified in the general group will be used.\n\n";
1166
1167 local currentAddon, selectedAddonName = addon:GetItemCountAddon(groupName);
1168
1169 if currentAddon then
1170 --GetCharacterCount
1171 --self.supportedAddons.itemCount[selectedExternalAddon]
1172 t = t .. "Currently using |cfffed000" .. selectedAddonName .. "|r as your item count addon. This addon is " .. ((currentAddon.IsEnabled() and "|cff00ff00enabled|r") or "|cffff0000disabled|r") .. ".";
1173
1174 if currentAddon.GetTotalCount and currentAddon.GetCharacterCount then
1175 t = t .. " This addon supports |cfffed000both total as local|r item counts.";
1176 elseif currentAddon.GetTotalCount then
1177 t = t .. " This addon supports |cfffed000only total|r item counts.";
1178 elseif currentAddon.GetCharacterCount then
1179 t = t .. " This addon supports |cfffed000only local|r item counts.";
1180 end
1181 end
1182
1183 return t;
1184 end,
1143 }, 1185 },
1144 header = { 1186 header = {
1145 order = 5, 1187 order = 5,
1146 type = "header", 1188 type = "header",
1147 name = "", 1189 name = "",
1257 local groupName = groupIdToName[info[2]]; 1299 local groupName = groupIdToName[info[2]];
1258 local optionName = info[#info]; 1300 local optionName = info[#info];
1259 1301
1260 addon.db.global.groups[groupName][optionName] = value ~= "" and value; 1302 addon.db.global.groups[groupName][optionName] = value ~= "" and value;
1261 end, 1303 end,
1304 disabled = false,
1262 }, 1305 },
1263 }, 1306 },
1264 }, 1307 },
1265 minimumStock = { 1308 minimumStock = {
1266 order = 10, 1309 order = 10,
2061 2104
2062 2105
2063 2106
2064 -- General functions used addon-wide 2107 -- General functions used addon-wide
2065 2108
2066 function addon:GetItemCount(itemId, group) 2109 function addon:GetItemCountAddon(group)
2067 itemId = tonumber(itemId);
2068
2069 if not itemId then return; end
2070
2071 local selectedExternalAddon = self:GetOptionByKey(group, "itemCountAddon"); 2110 local selectedExternalAddon = self:GetOptionByKey(group, "itemCountAddon");
2072 2111
2073 if self.supportedAddons.itemCount[selectedExternalAddon] and self.supportedAddons.itemCount[selectedExternalAddon].IsEnabled() then 2112 if self.supportedAddons.itemCount[selectedExternalAddon] and self.supportedAddons.itemCount[selectedExternalAddon].IsEnabled() then
2074 -- Try to use the default item count addon 2113 -- Try to use the default item count addon
2075 2114
2076 return self.supportedAddons.itemCount[selectedExternalAddon].GetTotalCount(itemId); 2115 return self.supportedAddons.itemCount[selectedExternalAddon], selectedExternalAddon;
2077 else 2116 else
2078 -- Default not available, get the first one then 2117 -- Default not available, get the first one then
2079 2118
2080 for name, value in pairs(self.supportedAddons.itemCount) do 2119 for name, value in pairs(self.supportedAddons.itemCount) do
2081 if value.IsEnabled() then 2120 if value.IsEnabled() then
2082 return value.GetTotalCount(itemId); 2121 return value, name;
2083 end 2122 end
2084 end 2123 end
2085 end 2124 end
2086 2125
2087 return -1; 2126 return;
2127 end
2128
2129 function addon:GetItemCount(itemId, group)
2130 itemId = tonumber(itemId);
2131
2132 if not itemId then return; end
2133
2134 local itemCountAddon = self:GetItemCountAddon(group);
2135
2136 return (itemCountAddon and itemCountAddon.GetTotalCount(itemId)) or -1;
2088 end 2137 end
2089 2138
2090 function addon:GetAuctionValue(itemLink, group) 2139 function addon:GetAuctionValue(itemLink, group)
2091 if not itemLink then return -5; end 2140 if not itemLink then return -5; end
2092 2141