Mercurial > wow > inventory
comparison Core.lua @ 23:7d7aaa3fbe94
If Auctioneer data can not be retrieved, it will now display as ?Error? rather than break the caching.
The premade group update check should now be fully functional.
You can now shift-click item links into other text fields and alt-click while the auction house window is open to search it.
Added an option to the config to select the data used for the local item data. This option currently does nothing and is just a placeholder (just like the ?alert when below threshold? option).
Removed useless pullout hiding code for the track at characters option.
Added an option to always show the auction value, even when the threshold is nil.
When overriding an option, the default value should now be copied into the group, even without you changing it back and forth (previously if you overridden an option and didn?t change the value, it would still use the default value).
The ?Stock settings? tab is now called the ?General? tab.
The ?Group Management? tab is now called ?Management? tab.
Added tooltip descriptions to the ?Add items? and ?Current items? tabs.
Added the option to override the preferred addons to individual groups.
No longer copying tables when making the groups list in the config. We can just reference it (saves quite some memory).
Bumped the interface version from 30300 to 40000.
Added slash command arguement ?reset? (or the short version ?r?) to reset the size of the summary frame (I messed mine up while making some screenshots /facepalm).
You can now close the summary frame with escape.
author | Zerotorescue |
---|---|
date | Thu, 28 Oct 2010 19:14:30 +0200 |
parents | 8f5c02113c5c |
children | db57cd9273f1 |
comparison
equal
deleted
inserted
replaced
22:46815d4f69e8 | 23:7d7aaa3fbe94 |
---|---|
97 self.db.factionrealm.characters[playerName] = true; | 97 self.db.factionrealm.characters[playerName] = true; |
98 | 98 |
99 -- Default to tracking on all chars, untracking is a convenience, not tracking by default would probably get multiple issue reports. | 99 -- Default to tracking on all chars, untracking is a convenience, not tracking by default would probably get multiple issue reports. |
100 self.db.global.defaults.trackAtCharacters[playerName] = true; | 100 self.db.global.defaults.trackAtCharacters[playerName] = true; |
101 end | 101 end |
102 end | 102 |
103 self:PremadeGroupsCheck(); | |
104 end | |
105 | |
106 function addon:PremadeGroupsCheck(updateGroupName, updateKey, accept) | |
107 -- Compare the current premade groups with those used, notify about changes | |
108 if addon.defaultGroups then | |
109 for key, groupInfo in pairs(addon.defaultGroups) do | |
110 -- Go through all default groups | |
111 | |
112 for groupName, values in pairs(addon.db.global.groups) do | |
113 -- Go through all groups to find those with this premade group | |
114 | |
115 if values.premadeGroups and values.premadeGroups[key] and values.premadeGroups[key] < groupInfo.version then | |
116 -- Outdated group | |
117 | |
118 if updateGroupName and updateKey then | |
119 -- This function was called after pressing yes or no in a confirm box | |
120 | |
121 if accept then | |
122 -- Yes was clicked | |
123 | |
124 for itemId, version in pairs(groupInfo.items) do | |
125 -- Go through all items in this premade group | |
126 | |
127 if version > values.premadeGroups[key] then | |
128 -- This item was added in a more recent version than this group: Add item | |
129 | |
130 if InGroup(itemId) then | |
131 print(("Skipping %s (#%d) as it is already in the group |cfffed000%s|r."):format(select(2, GetItemInfo(itemId)) or "Unknown", itemId, InGroup(itemId))); | |
132 elseif AddToGroup(groupName, itemId) then | |
133 print(("Added %s (#%d) found in the premade group |cfffed000%s|r to the group |cfffed000%s|r."):format(select(2, GetItemInfo(itemId)) or "Unknown", itemId, InGroup(itemId))); | |
134 end | |
135 end | |
136 end | |
137 | |
138 -- Remember the new version | |
139 values.premadeGroups[key] = groupInfo.version; | |
140 else | |
141 -- No was clicked | |
142 | |
143 -- Let user know what was not added | |
144 for itemId, version in pairs(groupInfo.items) do | |
145 -- Go through all items in this premade group | |
146 | |
147 if version > values.premadeGroups[key] then | |
148 -- This item was added in a more recent version than this group: don't add (since we clicked no), but announce it | |
149 | |
150 print(("Skipping %s (#%d) found in the premade group |cfffed000%s|r."):format(select(2, GetItemInfo(itemId)) or "Unknown", itemId, InGroup(itemId))); | |
151 end | |
152 end | |
153 | |
154 -- Remember the new version | |
155 values.premadeGroups[key] = groupInfo.version; | |
156 end | |
157 else | |
158 StaticPopupDialogs["InventoriumConfirmUpdatePremadeGroup"] = { | |
159 text = "The premade group |cfffed000%s|r used in the group |cfffed000%s|r has been changed. Do you wish to copy these changes?", | |
160 button1 = YES, | |
161 button2 = NO, | |
162 OnAccept = function(self) | |
163 addon:PremadeGroupsCheck(groupName, key, true); | |
164 end, | |
165 OnCancel = function(self, _, reason) | |
166 if reason == "clicked" then | |
167 addon:PremadeGroupsCheck(groupName, key, false); | |
168 end | |
169 end, | |
170 timeout = 0, | |
171 whileDead = 1, | |
172 hideOnEscape = 1, | |
173 }; | |
174 StaticPopup_Show("InventoriumConfirmUpdatePremadeGroup", key, groupName); | |
175 | |
176 return; | |
177 end | |
178 end | |
179 end | |
180 end | |
181 end | |
182 end | |
183 | |
103 | 184 |
104 local slashArgs = {}; | 185 local slashArgs = {}; |
105 function addon:RegisterSlash(func, ...) | 186 function addon:RegisterSlash(func, ...) |
106 for _, arg in pairs({ ... }) do | 187 for _, arg in pairs({ ... }) do |
107 slashArgs[arg] = func; | 188 slashArgs[arg] = func; |
168 end | 249 end |
169 end); | 250 end); |
170 self:SetCallback("CustomOnLeave", function(this) | 251 self:SetCallback("CustomOnLeave", function(this) |
171 GameTooltip:Hide(); | 252 GameTooltip:Hide(); |
172 end); | 253 end); |
173 self:SetCallback("CustomOnClick", function(this) | 254 self:SetCallback("CustomOnClick", function(this, ...) |
255 -- Below is used in child widgets to prepare for onclick | |
174 if this.OnClick then | 256 if this.OnClick then |
175 this.OnClick(this); | 257 this.OnClick(this, ...); |
176 end | 258 end |
177 | 259 |
178 local func = this:GetUserData("exec"); | 260 local func = this:GetUserData("exec"); |
179 local itemId = this:GetUserData("itemId"); | 261 local itemId = this:GetUserData("itemId"); |
180 | 262 |
181 if func then | 263 if func then |
182 -- If this is a config option we will need the group id | 264 -- If this is a config option we will need the group id |
183 local path = this:GetUserData("path"); | 265 local path = this:GetUserData("path"); |
184 local groupId = (path and path[2]) or nil; | 266 local groupId = (path and path[2]) or nil; |
185 | 267 |
186 func(groupId, itemId); | 268 func(groupId, itemId, ...); |
187 end | 269 end |
188 end); | 270 end); |
189 | 271 |
190 | 272 |
191 | 273 |
418 name = "General", | 500 name = "General", |
419 args = { | 501 args = { |
420 description = { | 502 description = { |
421 order = 0, | 503 order = 0, |
422 type = "description", | 504 type = "description", |
423 name = "Change general settings unrelated to groups.", | 505 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.", |
424 }, | 506 }, |
425 header = { | 507 header = { |
426 order = 5, | 508 order = 5, |
427 type = "header", | 509 type = "header", |
428 name = "", | 510 name = "", |
458 end, | 540 end, |
459 get = function() return self.db.global.defaults.itemCountAddon; end, | 541 get = function() return self.db.global.defaults.itemCountAddon; end, |
460 set = function(i, v) self.db.global.defaults.itemCountAddon = v; end, | 542 set = function(i, v) self.db.global.defaults.itemCountAddon = v; end, |
461 }, | 543 }, |
462 craftingAddon = { | 544 craftingAddon = { |
463 order = 20, | 545 order = 30, |
464 type = "select", | 546 type = "select", |
465 name = "Prefered crafting addon", | 547 name = "Prefered crafting addon", |
466 desc = "Select the addon you prefer data to be queued into. A random supported addon will be used if the selected addon can not be found.", | 548 desc = "Select the addon you prefer data to be queued into. A random supported addon will be used if the selected addon can not be found.", |
467 values = function() | 549 values = function() |
468 local temp = {}; | 550 local temp = {}; |
472 | 554 |
473 return temp; | 555 return temp; |
474 end, | 556 end, |
475 get = function() return self.db.global.defaults.craftingAddon; end, | 557 get = function() return self.db.global.defaults.craftingAddon; end, |
476 set = function(i, v) self.db.global.defaults.craftingAddon = v; end, | 558 set = function(i, v) self.db.global.defaults.craftingAddon = v; end, |
559 }, | |
560 localItemData = { | |
561 order = 40, | |
562 type = "multiselect", | |
563 name = "Include in local item data NYI | PH", | |
564 desc = "Select which data should be included in the local item data.", | |
565 values = { | |
566 ["Bag"] = "Bag", | |
567 ["Bank"] = "Bank", | |
568 ["Auction House"] = "Auction House", | |
569 ["Mailbox"] = "Mailbox", | |
570 }, | |
571 get = function(i, v) return self.db.global.defaults.localItemData and self.db.global.defaults.localItemData[v]; end, | |
572 set = function(i, v, e) self.db.global.defaults.localItemData[v] = e or nil; end, | |
573 --dialogControl = "Dropdown", -- this is not standard, normal multiselect control gives us a list of all chars with toggle-boxes. UGLY! We want a multiselect-box instead. | |
477 }, | 574 }, |
478 }, | 575 }, |
479 }, | 576 }, |
480 minimumStock = { | 577 minimumStock = { |
481 order = 10, | 578 order = 10, |
538 end | 635 end |
539 | 636 |
540 return temp; | 637 return temp; |
541 end, | 638 end, |
542 get = function(i, v) return self.db.global.defaults.trackAtCharacters[v]; end, | 639 get = function(i, v) return self.db.global.defaults.trackAtCharacters[v]; end, |
543 set = function(i, v, e) | 640 set = function(i, v, e) self.db.global.defaults.trackAtCharacters[v] = e or nil; end, |
544 self.db.global.defaults.trackAtCharacters[v] = e or nil; | |
545 | |
546 -- We MUST close this pullout or we can get errors or even game client crashes once we click another group or close the config dialog! | |
547 local count = AceGUI:GetNextWidgetNum("Dropdown-Pullout"); | |
548 for i = 1, count do | |
549 if _G['AceGUI30Pullout' .. i] then | |
550 _G['AceGUI30Pullout' .. i]:Hide(); | |
551 end | |
552 end | |
553 end, | |
554 --dialogControl = "Dropdown", -- this is not standard, normal multiselect control gives us a list of all chars with toggle-boxes. UGLY! We want a multiselect-box instead. | 641 --dialogControl = "Dropdown", -- this is not standard, normal multiselect control gives us a list of all chars with toggle-boxes. UGLY! We want a multiselect-box instead. |
555 }, | 642 }, |
556 }, | 643 }, |
557 }, | 644 }, |
558 refill = { | 645 refill = { |
628 name = "Hide when below threshold", | 715 name = "Hide when below threshold", |
629 desc = "Hide items from the summary when their value is below the set price threshold.", | 716 desc = "Hide items from the summary when their value is below the set price threshold.", |
630 get = function() return self.db.global.defaults.summaryHidePriceThreshold; end, | 717 get = function() return self.db.global.defaults.summaryHidePriceThreshold; end, |
631 set = function(i, v) self.db.global.defaults.summaryHidePriceThreshold = v; end, | 718 set = function(i, v) self.db.global.defaults.summaryHidePriceThreshold = v; end, |
632 }, | 719 }, |
720 alwaysGetAuctionValue = { | |
721 order = 60, | |
722 type = "toggle", | |
723 name = "Always show auction value", | |
724 desc = "Always cache and show the auction value of items, even if the price threshold is set to 0.", | |
725 get = function() return self.db.global.defaults.alwaysGetAuctionValue; end, | |
726 set = function(i, v) self.db.global.defaults.alwaysGetAuctionValue = v; end, | |
727 }, | |
633 }, | 728 }, |
634 }, | 729 }, |
635 colorCodes = { | 730 colorCodes = { |
636 order = 30, | 731 order = 30, |
637 type = "group", | 732 type = "group", |
707 | 802 |
708 local function SetOption(info, value, multiSelectEnabled) | 803 local function SetOption(info, value, multiSelectEnabled) |
709 local groupName = groupIdToName[info[2]]; | 804 local groupName = groupIdToName[info[2]]; |
710 local optionName = info[#info]; | 805 local optionName = info[#info]; |
711 | 806 |
712 -- No need to store a setting if it's disabled (false) | 807 -- Special treatment for override toggle boxes |
713 if not value and info.arg and not info.arg:find("override") then | 808 if not info.arg:find("override") then |
714 value = nil; | 809 if not value and info.arg then |
715 | 810 -- If this override was disabled and a saved variable name was provided, set it to nil rather than false |
716 -- If this is an override toggler then also set the related field to nil | 811 |
717 addon.db.global.groups[groupName][info.arg] = nil; | 812 value = nil; |
813 | |
814 -- If this is an override toggler then also set the related field to nil | |
815 addon.db.global.groups[groupName][info.arg] = nil; | |
816 elseif value and info.arg then | |
817 -- If this override is now enabled, we need to copy the default into this field (unless it is not nil (which is supposed to be impossible), in which case we'll use the already selected value) | |
818 | |
819 addon.db.global.groups[groupName][info.arg] = addon:GetOptionByKey(groupName, info.arg); | |
820 end | |
718 end | 821 end |
719 | 822 |
720 if multiSelectEnabled ~= nil then | 823 if multiSelectEnabled ~= nil then |
721 -- The saved vars for a multiselect will always be an array, it may not yet exist in which case it must be created. | 824 -- The saved vars for a multiselect will always be an array, it may not yet exist in which case it must be created. |
722 if not addon.db.global.groups[groupName][optionName] then | 825 if not addon.db.global.groups[groupName][optionName] then |
728 addon.db.global.groups[groupName][optionName] = value; | 831 addon.db.global.groups[groupName][optionName] = value; |
729 end | 832 end |
730 end | 833 end |
731 | 834 |
732 function addon:GetOptionByKey(groupName, optionName, noDefault) | 835 function addon:GetOptionByKey(groupName, optionName, noDefault) |
733 if addon.db.global.groups[groupName][optionName] ~= nil then | 836 if groupName and self.db.global.groups[groupName] and self.db.global.groups[groupName][optionName] ~= nil then |
734 return addon.db.global.groups[groupName][optionName]; | 837 return self.db.global.groups[groupName][optionName]; |
735 elseif addon.db.global.defaults[optionName] and not noDefault then | 838 elseif self.db.global.defaults[optionName] and not noDefault then |
736 return addon.db.global.defaults[optionName]; | 839 return self.db.global.defaults[optionName]; |
737 else | 840 else |
738 return nil; | 841 return nil; |
739 end | 842 end |
740 end | 843 end |
741 | 844 |
976 end, | 1079 end, |
977 args = { | 1080 args = { |
978 general = { | 1081 general = { |
979 order = 10, | 1082 order = 10, |
980 type = "group", | 1083 type = "group", |
981 name = "Stock settings", | 1084 name = "General", |
982 desc = "Change the stock settings for just this group.", | 1085 desc = "Change the general settings for just this group.", |
983 args = { | 1086 args = { |
1087 general = { | |
1088 order = 0, | |
1089 type = "group", | |
1090 inline = true, | |
1091 name = "General", | |
1092 set = SetOption, | |
1093 get = GetOption, | |
1094 disabled = GetDisabled, | |
1095 args = { | |
1096 description = { | |
1097 order = 0, | |
1098 type = "description", | |
1099 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.", | |
1100 }, | |
1101 header = { | |
1102 order = 5, | |
1103 type = "header", | |
1104 name = "", | |
1105 }, | |
1106 overrideAuctionPricingAddon = { | |
1107 order = 9, | |
1108 type = "toggle", | |
1109 name = "Override pricing addon", | |
1110 desc = "Allows you to override the pricing addon setting for this group.", | |
1111 arg = "auctionPricingAddon", | |
1112 }, | |
1113 auctionPricingAddon = { | |
1114 order = 10, | |
1115 type = "select", | |
1116 name = "Prefered pricing addon", | |
1117 desc = "Select the addon you prefer data for this group to be retrieved from. A random supported addon will be used if the selected addon can not be found.", | |
1118 values = function() | |
1119 local temp = {}; | |
1120 for name, value in pairs(addon.supportedAddons.auctionPricing) do | |
1121 temp[name] = name; | |
1122 end | |
1123 | |
1124 return temp; | |
1125 end, | |
1126 arg = "overrideAuctionPricingAddon", | |
1127 }, | |
1128 overrideItemCountAddon = { | |
1129 order = 19, | |
1130 type = "toggle", | |
1131 name = "Override item count addon", | |
1132 desc = "Allows you to override the item count addon setting for this group.", | |
1133 arg = "itemCountAddon", | |
1134 }, | |
1135 itemCountAddon = { | |
1136 order = 20, | |
1137 type = "select", | |
1138 name = "Prefered item count addon", | |
1139 desc = "Select the addon you prefer data for this group to be retrieved from. A random supported addon will be used if the selected addon can not be found.", | |
1140 values = function() | |
1141 local temp = {}; | |
1142 for name, value in pairs(addon.supportedAddons.itemCount) do | |
1143 temp[name] = name; | |
1144 end | |
1145 | |
1146 return temp; | |
1147 end, | |
1148 arg = "overrideItemCountAddon", | |
1149 }, | |
1150 overrideCraftingAddon = { | |
1151 order = 29, | |
1152 type = "toggle", | |
1153 name = "Override crafting addon", | |
1154 desc = "Allows you to override the crafting addon setting for this group.", | |
1155 arg = "craftingAddon", | |
1156 }, | |
1157 craftingAddon = { | |
1158 order = 30, | |
1159 type = "select", | |
1160 name = "Prefered crafting addon", | |
1161 desc = "Select the addon you prefer data from this group to be queued into. A random supported addon will be used if the selected addon can not be found.", | |
1162 values = function() | |
1163 local temp = {}; | |
1164 for name, value in pairs(addon.supportedAddons.crafting) do | |
1165 temp[name] = name; | |
1166 end | |
1167 | |
1168 return temp; | |
1169 end, | |
1170 arg = "overrideCraftingAddon", | |
1171 }, | |
1172 }, | |
1173 }, | |
984 minimumStock = { | 1174 minimumStock = { |
985 order = 10, | 1175 order = 10, |
986 type = "group", | 1176 type = "group", |
987 inline = true, | 1177 inline = true, |
988 name = "Minimum stock", | 1178 name = "Minimum stock", |
1065 desc = "Select at which characters this should appear in the summary and generate alerts.", | 1255 desc = "Select at which characters this should appear in the summary and generate alerts.", |
1066 values = function() | 1256 values = function() |
1067 local temp = {}; | 1257 local temp = {}; |
1068 for charName in pairs(addon.db.factionrealm.characters) do | 1258 for charName in pairs(addon.db.factionrealm.characters) do |
1069 temp[charName] = charName; | 1259 temp[charName] = charName; |
1070 end | |
1071 | |
1072 -- We MUST close this pullout or we can get errors or even game client crashes once we click another group or close the config dialog! | |
1073 local count = AceGUI:GetNextWidgetNum("Dropdown-Pullout"); | |
1074 for i = 1, count do | |
1075 if _G['AceGUI30Pullout' .. i] then | |
1076 _G['AceGUI30Pullout' .. i]:Hide(); | |
1077 end | |
1078 end | 1260 end |
1079 | 1261 |
1080 return temp; | 1262 return temp; |
1081 end, | 1263 end, |
1082 get = GetMultiOption, | 1264 get = GetMultiOption, |
1194 type = "toggle", | 1376 type = "toggle", |
1195 name = "Hide when below threshold", | 1377 name = "Hide when below threshold", |
1196 desc = "Hide items from the summary when their value is below the set price threshold.", | 1378 desc = "Hide items from the summary when their value is below the set price threshold.", |
1197 arg = "overrideSummaryHidePriceThreshold", | 1379 arg = "overrideSummaryHidePriceThreshold", |
1198 }, | 1380 }, |
1381 overrideAlwaysGetAuctionValue = { | |
1382 order = 59, | |
1383 type = "toggle", | |
1384 name = "Override auction value showing", | |
1385 desc = "Allows you to override if the auction value of items in this group should be cached and displayed even when the price threshold is set to 0.", | |
1386 arg = "alwaysGetAuctionValue", | |
1387 }, | |
1388 alwaysGetAuctionValue = { | |
1389 order = 60, | |
1390 type = "toggle", | |
1391 name = "Always show auction value", | |
1392 desc = "Always cache and show the auction value of items in this group, even if the price threshold is set to 0.", | |
1393 arg = "overrideAlwaysGetAuctionValue", | |
1394 }, | |
1199 }, | 1395 }, |
1200 }, | 1396 }, |
1201 }, | 1397 }, |
1202 }, | 1398 }, |
1203 group = { | 1399 group = { |
1204 order = 20, | 1400 order = 20, |
1205 type = "group", | 1401 type = "group", |
1206 name = "Group Management", | 1402 name = "Management", |
1207 desc = "Rename, delete or export this group.", | 1403 desc = "Rename, delete, duplicate or export this group.", |
1208 args = { | 1404 args = { |
1209 actions = { | 1405 actions = { |
1210 order = 10, | 1406 order = 10, |
1211 type = "group", | 1407 type = "group", |
1212 name = "Actions", | 1408 name = "Actions", |
1305 }, | 1501 }, |
1306 add = { | 1502 add = { |
1307 order = 30, | 1503 order = 30, |
1308 type = "group", | 1504 type = "group", |
1309 name = "Add items", | 1505 name = "Add items", |
1506 desc = "Add new items to this group.", | |
1310 args = { | 1507 args = { |
1311 singleAdd = { | 1508 singleAdd = { |
1312 order = 10, | 1509 order = 10, |
1313 type = "group", | 1510 type = "group", |
1314 inline = true, | 1511 inline = true, |
1503 }, | 1700 }, |
1504 remove = { | 1701 remove = { |
1505 order = 40, | 1702 order = 40, |
1506 type = "group", | 1703 type = "group", |
1507 name = "Current items", | 1704 name = "Current items", |
1705 desc = "View, export or remove items from this group.", | |
1508 args = { | 1706 args = { |
1509 help = { | 1707 help = { |
1510 order = 10, | 1708 order = 10, |
1511 type = "group", | 1709 type = "group", |
1512 inline = true, | 1710 inline = true, |
1547 }, | 1745 }, |
1548 premadeGroups = { | 1746 premadeGroups = { |
1549 order = 30, | 1747 order = 30, |
1550 type = "select", | 1748 type = "select", |
1551 name = "Imported premade groups", | 1749 name = "Imported premade groups", |
1552 desc = "This is a list of all premade groups that were imported into this group. You will be notified when any of these premade groups have changed and you will be able to import these changes.\n\nSelect a group to remove it from this list and prevent notifications about changes made to this group. This will require you to manually update this when new items are added to the game.", | 1750 desc = "This is a list of all premade groups that were imported into this group. You will be notified when any of these premade groups have changed and you will be able to import these changes.\n\nSelect a group to stop reminding you of changes to the premade group (the item list will be unaffected). Doing so will require you to manually update this when new items are added to the game.", |
1553 values = function(info) | 1751 values = function(info) |
1554 local groupName = groupIdToName[info[2]]; | 1752 local groupName = groupIdToName[info[2]]; |
1555 | 1753 |
1556 local temp = {}; | 1754 local temp = {}; |
1557 if addon.db.global.groups[groupName].premadeGroups then | 1755 if addon.db.global.groups[groupName].premadeGroups then |
1700 temp.items[value] = nil; | 1898 temp.items[value] = nil; |
1701 temp.items[itemId] = true; | 1899 temp.items[itemId] = true; |
1702 end | 1900 end |
1703 end | 1901 end |
1704 | 1902 |
1705 -- Ensure this data isn't received (this would be buggy as exports from other accounts won't know what to do with this) | 1903 -- Ensure this data isn't received (this would be silly/buggy as exports from other accounts - with different characters - won't know what to do with this) |
1706 temp.trackAtCharacters = nil; | 1904 temp.trackAtCharacters = nil; |
1707 temp.overrideTrackAtCharacters = nil; | 1905 temp.overrideTrackAtCharacters = nil; |
1708 | 1906 |
1709 self.db.global.groups[name] = temp; | 1907 self.db.global.groups[name] = temp; |
1710 end | 1908 end |
1730 end | 1928 end |
1731 end | 1929 end |
1732 | 1930 |
1733 for name, values in pairs(self.db.global.groups) do | 1931 for name, values in pairs(self.db.global.groups) do |
1734 if not groupIdToName[name] then | 1932 if not groupIdToName[name] then |
1735 options.args.groups.args[tostring(count)] = CopyTable(defaultGroup); | 1933 options.args.groups.args[tostring(count)] = defaultGroup; |
1736 | 1934 |
1737 groupIdToName[tostring(count)] = name; | 1935 groupIdToName[tostring(count)] = name; |
1738 groupIdToName[name] = true; | 1936 groupIdToName[name] = true; |
1739 | 1937 |
1740 count = ( count + 1 ); | 1938 count = ( count + 1 ); |
1744 | 1942 |
1745 | 1943 |
1746 | 1944 |
1747 -- General functions used addon-wide | 1945 -- General functions used addon-wide |
1748 | 1946 |
1749 function addon:GetItemCount(itemId) | 1947 function addon:GetItemCount(itemId, group) |
1750 itemId = tonumber(itemId); | 1948 itemId = tonumber(itemId); |
1751 | 1949 |
1752 if not itemId then return; end | 1950 if not itemId then return; end |
1753 | 1951 |
1754 if self.supportedAddons.itemCount[self.db.global.defaults.itemCountAddon] then | 1952 local selectedExternalAddon = self:GetOptionByKey(group, "itemCountAddon"); |
1953 | |
1954 if self.supportedAddons.itemCount[selectedExternalAddon] and self.supportedAddons.itemCount[selectedExternalAddon].IsEnabled() then | |
1755 -- Try to use the default item count addon | 1955 -- Try to use the default item count addon |
1756 | 1956 |
1757 return self.supportedAddons.itemCount[self.db.global.defaults.itemCountAddon].GetTotalCount(itemId); | 1957 return self.supportedAddons.itemCount[selectedExternalAddon].GetTotalCount(itemId); |
1758 else | 1958 else |
1759 -- Default not available, get the first one then | 1959 -- Default not available, get the first one then |
1760 | 1960 |
1761 for name, value in pairs(self.supportedAddons.itemCount) do | 1961 for name, value in pairs(self.supportedAddons.itemCount) do |
1762 if value.IsEnabled() then | 1962 if value.IsEnabled() then |
1766 end | 1966 end |
1767 | 1967 |
1768 return -1; | 1968 return -1; |
1769 end | 1969 end |
1770 | 1970 |
1771 function addon:GetAuctionValue(itemLink) | 1971 function addon:GetAuctionValue(itemLink, group) |
1772 if not itemLink then return; end | 1972 if not itemLink then return -5; end |
1773 | 1973 |
1774 if self.supportedAddons.auctionPricing[self.db.global.defaults.auctionPricingAddon] then | 1974 local selectedExternalAddon = self:GetOptionByKey(group, "auctionPricingAddon"); |
1975 | |
1976 if self.supportedAddons.auctionPricing[selectedExternalAddon] and self.supportedAddons.auctionPricing[selectedExternalAddon].IsEnabled() then | |
1775 -- Try to use the default auction pricing addon | 1977 -- Try to use the default auction pricing addon |
1776 | 1978 |
1777 return self.supportedAddons.auctionPricing[self.db.global.defaults.auctionPricingAddon].GetValue(itemLink); | 1979 return self.supportedAddons.auctionPricing[selectedExternalAddon].GetValue(itemLink); |
1778 else | 1980 else |
1779 -- Default not available, get the first one then | 1981 -- Default not available, get the first one then |
1780 | 1982 |
1781 for name, value in pairs(self.supportedAddons.auctionPricing) do | 1983 for name, value in pairs(self.supportedAddons.auctionPricing) do |
1782 if value.IsEnabled() then | 1984 if value.IsEnabled() then |