Mercurial > wow > inventory
changeset 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 | 46815d4f69e8 |
children | db57cd9273f1 |
files | AuctionAddons/Auctioneer.lua Core.lua Inventorium.toc Queue.lua Summary.lua |
diffstat | 5 files changed, 310 insertions(+), 74 deletions(-) [+] |
line wrap: on
line diff
--- a/AuctionAddons/Auctioneer.lua Wed Oct 20 01:37:22 2010 +0200 +++ b/AuctionAddons/Auctioneer.lua Thu Oct 28 19:14:30 2010 +0200 @@ -9,7 +9,7 @@ return -1; end - return lowBuy; + return lowBuy or -5; end local function IsEnabled()
--- a/Core.lua Wed Oct 20 01:37:22 2010 +0200 +++ b/Core.lua Thu Oct 28 19:14:30 2010 +0200 @@ -99,8 +99,89 @@ -- Default to tracking on all chars, untracking is a convenience, not tracking by default would probably get multiple issue reports. self.db.global.defaults.trackAtCharacters[playerName] = true; end + + self:PremadeGroupsCheck(); end +function addon:PremadeGroupsCheck(updateGroupName, updateKey, accept) + -- Compare the current premade groups with those used, notify about changes + if addon.defaultGroups then + for key, groupInfo in pairs(addon.defaultGroups) do + -- Go through all default groups + + for groupName, values in pairs(addon.db.global.groups) do + -- Go through all groups to find those with this premade group + + if values.premadeGroups and values.premadeGroups[key] and values.premadeGroups[key] < groupInfo.version then + -- Outdated group + + if updateGroupName and updateKey then + -- This function was called after pressing yes or no in a confirm box + + if accept then + -- Yes was clicked + + for itemId, version in pairs(groupInfo.items) do + -- Go through all items in this premade group + + if version > values.premadeGroups[key] then + -- This item was added in a more recent version than this group: Add item + + if InGroup(itemId) then + print(("Skipping %s (#%d) as it is already in the group |cfffed000%s|r."):format(select(2, GetItemInfo(itemId)) or "Unknown", itemId, InGroup(itemId))); + elseif AddToGroup(groupName, itemId) then + 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))); + end + end + end + + -- Remember the new version + values.premadeGroups[key] = groupInfo.version; + else + -- No was clicked + + -- Let user know what was not added + for itemId, version in pairs(groupInfo.items) do + -- Go through all items in this premade group + + if version > values.premadeGroups[key] then + -- This item was added in a more recent version than this group: don't add (since we clicked no), but announce it + + print(("Skipping %s (#%d) found in the premade group |cfffed000%s|r."):format(select(2, GetItemInfo(itemId)) or "Unknown", itemId, InGroup(itemId))); + end + end + + -- Remember the new version + values.premadeGroups[key] = groupInfo.version; + end + else + StaticPopupDialogs["InventoriumConfirmUpdatePremadeGroup"] = { + text = "The premade group |cfffed000%s|r used in the group |cfffed000%s|r has been changed. Do you wish to copy these changes?", + button1 = YES, + button2 = NO, + OnAccept = function(self) + addon:PremadeGroupsCheck(groupName, key, true); + end, + OnCancel = function(self, _, reason) + if reason == "clicked" then + addon:PremadeGroupsCheck(groupName, key, false); + end + end, + timeout = 0, + whileDead = 1, + hideOnEscape = 1, + }; + StaticPopup_Show("InventoriumConfirmUpdatePremadeGroup", key, groupName); + + return; + end + end + end + end + end +end + + local slashArgs = {}; function addon:RegisterSlash(func, ...) for _, arg in pairs({ ... }) do @@ -170,9 +251,10 @@ self:SetCallback("CustomOnLeave", function(this) GameTooltip:Hide(); end); - self:SetCallback("CustomOnClick", function(this) + self:SetCallback("CustomOnClick", function(this, ...) + -- Below is used in child widgets to prepare for onclick if this.OnClick then - this.OnClick(this); + this.OnClick(this, ...); end local func = this:GetUserData("exec"); @@ -183,7 +265,7 @@ local path = this:GetUserData("path"); local groupId = (path and path[2]) or nil; - func(groupId, itemId); + func(groupId, itemId, ...); end end); @@ -420,7 +502,7 @@ description = { order = 0, type = "description", - name = "Change general settings unrelated to groups.", + 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.", }, header = { order = 5, @@ -460,7 +542,7 @@ set = function(i, v) self.db.global.defaults.itemCountAddon = v; end, }, craftingAddon = { - order = 20, + order = 30, type = "select", name = "Prefered crafting addon", 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.", @@ -475,6 +557,21 @@ get = function() return self.db.global.defaults.craftingAddon; end, set = function(i, v) self.db.global.defaults.craftingAddon = v; end, }, + localItemData = { + order = 40, + type = "multiselect", + name = "Include in local item data NYI | PH", + desc = "Select which data should be included in the local item data.", + values = { + ["Bag"] = "Bag", + ["Bank"] = "Bank", + ["Auction House"] = "Auction House", + ["Mailbox"] = "Mailbox", + }, + get = function(i, v) return self.db.global.defaults.localItemData and self.db.global.defaults.localItemData[v]; end, + set = function(i, v, e) self.db.global.defaults.localItemData[v] = e or nil; end, + --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. + }, }, }, minimumStock = { @@ -540,17 +637,7 @@ return temp; end, get = function(i, v) return self.db.global.defaults.trackAtCharacters[v]; end, - set = function(i, v, e) - self.db.global.defaults.trackAtCharacters[v] = e or nil; - - -- 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! - local count = AceGUI:GetNextWidgetNum("Dropdown-Pullout"); - for i = 1, count do - if _G['AceGUI30Pullout' .. i] then - _G['AceGUI30Pullout' .. i]:Hide(); - end - end - end, + set = function(i, v, e) self.db.global.defaults.trackAtCharacters[v] = e or nil; end, --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. }, }, @@ -630,6 +717,14 @@ get = function() return self.db.global.defaults.summaryHidePriceThreshold; end, set = function(i, v) self.db.global.defaults.summaryHidePriceThreshold = v; end, }, + alwaysGetAuctionValue = { + order = 60, + type = "toggle", + name = "Always show auction value", + desc = "Always cache and show the auction value of items, even if the price threshold is set to 0.", + get = function() return self.db.global.defaults.alwaysGetAuctionValue; end, + set = function(i, v) self.db.global.defaults.alwaysGetAuctionValue = v; end, + }, }, }, colorCodes = { @@ -709,12 +804,20 @@ local groupName = groupIdToName[info[2]]; local optionName = info[#info]; - -- No need to store a setting if it's disabled (false) - if not value and info.arg and not info.arg:find("override") then - value = nil; - - -- If this is an override toggler then also set the related field to nil - addon.db.global.groups[groupName][info.arg] = nil; + -- Special treatment for override toggle boxes + if not info.arg:find("override") then + if not value and info.arg then + -- If this override was disabled and a saved variable name was provided, set it to nil rather than false + + value = nil; + + -- If this is an override toggler then also set the related field to nil + addon.db.global.groups[groupName][info.arg] = nil; + elseif value and info.arg then + -- 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) + + addon.db.global.groups[groupName][info.arg] = addon:GetOptionByKey(groupName, info.arg); + end end if multiSelectEnabled ~= nil then @@ -730,10 +833,10 @@ end function addon:GetOptionByKey(groupName, optionName, noDefault) - if addon.db.global.groups[groupName][optionName] ~= nil then - return addon.db.global.groups[groupName][optionName]; - elseif addon.db.global.defaults[optionName] and not noDefault then - return addon.db.global.defaults[optionName]; + if groupName and self.db.global.groups[groupName] and self.db.global.groups[groupName][optionName] ~= nil then + return self.db.global.groups[groupName][optionName]; + elseif self.db.global.defaults[optionName] and not noDefault then + return self.db.global.defaults[optionName]; else return nil; end @@ -978,9 +1081,96 @@ general = { order = 10, type = "group", - name = "Stock settings", - desc = "Change the stock settings for just this group.", + name = "General", + desc = "Change the general settings for just this group.", args = { + general = { + order = 0, + type = "group", + inline = true, + name = "General", + set = SetOption, + get = GetOption, + disabled = GetDisabled, + args = { + description = { + order = 0, + type = "description", + 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.", + }, + header = { + order = 5, + type = "header", + name = "", + }, + overrideAuctionPricingAddon = { + order = 9, + type = "toggle", + name = "Override pricing addon", + desc = "Allows you to override the pricing addon setting for this group.", + arg = "auctionPricingAddon", + }, + auctionPricingAddon = { + order = 10, + type = "select", + name = "Prefered pricing addon", + 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.", + values = function() + local temp = {}; + for name, value in pairs(addon.supportedAddons.auctionPricing) do + temp[name] = name; + end + + return temp; + end, + arg = "overrideAuctionPricingAddon", + }, + overrideItemCountAddon = { + order = 19, + type = "toggle", + name = "Override item count addon", + desc = "Allows you to override the item count addon setting for this group.", + arg = "itemCountAddon", + }, + itemCountAddon = { + order = 20, + type = "select", + name = "Prefered item count addon", + 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.", + values = function() + local temp = {}; + for name, value in pairs(addon.supportedAddons.itemCount) do + temp[name] = name; + end + + return temp; + end, + arg = "overrideItemCountAddon", + }, + overrideCraftingAddon = { + order = 29, + type = "toggle", + name = "Override crafting addon", + desc = "Allows you to override the crafting addon setting for this group.", + arg = "craftingAddon", + }, + craftingAddon = { + order = 30, + type = "select", + name = "Prefered crafting addon", + 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.", + values = function() + local temp = {}; + for name, value in pairs(addon.supportedAddons.crafting) do + temp[name] = name; + end + + return temp; + end, + arg = "overrideCraftingAddon", + }, + }, + }, minimumStock = { order = 10, type = "group", @@ -1069,14 +1259,6 @@ temp[charName] = charName; end - -- 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! - local count = AceGUI:GetNextWidgetNum("Dropdown-Pullout"); - for i = 1, count do - if _G['AceGUI30Pullout' .. i] then - _G['AceGUI30Pullout' .. i]:Hide(); - end - end - return temp; end, get = GetMultiOption, @@ -1196,6 +1378,20 @@ desc = "Hide items from the summary when their value is below the set price threshold.", arg = "overrideSummaryHidePriceThreshold", }, + overrideAlwaysGetAuctionValue = { + order = 59, + type = "toggle", + name = "Override auction value showing", + 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.", + arg = "alwaysGetAuctionValue", + }, + alwaysGetAuctionValue = { + order = 60, + type = "toggle", + name = "Always show auction value", + desc = "Always cache and show the auction value of items in this group, even if the price threshold is set to 0.", + arg = "overrideAlwaysGetAuctionValue", + }, }, }, }, @@ -1203,8 +1399,8 @@ group = { order = 20, type = "group", - name = "Group Management", - desc = "Rename, delete or export this group.", + name = "Management", + desc = "Rename, delete, duplicate or export this group.", args = { actions = { order = 10, @@ -1307,6 +1503,7 @@ order = 30, type = "group", name = "Add items", + desc = "Add new items to this group.", args = { singleAdd = { order = 10, @@ -1505,6 +1702,7 @@ order = 40, type = "group", name = "Current items", + desc = "View, export or remove items from this group.", args = { help = { order = 10, @@ -1549,7 +1747,7 @@ order = 30, type = "select", name = "Imported premade groups", - 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.", + 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.", values = function(info) local groupName = groupIdToName[info[2]]; @@ -1702,7 +1900,7 @@ end end - -- Ensure this data isn't received (this would be buggy as exports from other accounts won't know what to do with this) + -- 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) temp.trackAtCharacters = nil; temp.overrideTrackAtCharacters = nil; @@ -1732,7 +1930,7 @@ for name, values in pairs(self.db.global.groups) do if not groupIdToName[name] then - options.args.groups.args[tostring(count)] = CopyTable(defaultGroup); + options.args.groups.args[tostring(count)] = defaultGroup; groupIdToName[tostring(count)] = name; groupIdToName[name] = true; @@ -1746,15 +1944,17 @@ -- General functions used addon-wide -function addon:GetItemCount(itemId) +function addon:GetItemCount(itemId, group) itemId = tonumber(itemId); if not itemId then return; end - if self.supportedAddons.itemCount[self.db.global.defaults.itemCountAddon] then + local selectedExternalAddon = self:GetOptionByKey(group, "itemCountAddon"); + + if self.supportedAddons.itemCount[selectedExternalAddon] and self.supportedAddons.itemCount[selectedExternalAddon].IsEnabled() then -- Try to use the default item count addon - return self.supportedAddons.itemCount[self.db.global.defaults.itemCountAddon].GetTotalCount(itemId); + return self.supportedAddons.itemCount[selectedExternalAddon].GetTotalCount(itemId); else -- Default not available, get the first one then @@ -1768,13 +1968,15 @@ return -1; end -function addon:GetAuctionValue(itemLink) - if not itemLink then return; end +function addon:GetAuctionValue(itemLink, group) + if not itemLink then return -5; end - if self.supportedAddons.auctionPricing[self.db.global.defaults.auctionPricingAddon] then + local selectedExternalAddon = self:GetOptionByKey(group, "auctionPricingAddon"); + + if self.supportedAddons.auctionPricing[selectedExternalAddon] and self.supportedAddons.auctionPricing[selectedExternalAddon].IsEnabled() then -- Try to use the default auction pricing addon - return self.supportedAddons.auctionPricing[self.db.global.defaults.auctionPricingAddon].GetValue(itemLink); + return self.supportedAddons.auctionPricing[selectedExternalAddon].GetValue(itemLink); else -- Default not available, get the first one then
--- a/Inventorium.toc Wed Oct 20 01:37:22 2010 +0200 +++ b/Inventorium.toc Thu Oct 28 19:14:30 2010 +0200 @@ -1,4 +1,4 @@ -## Interface: 30300 +## Interface: 40000 ## Title: Inventorium ## Notes: Keep track of items you wish to keep enough stock on, and refill. ## Author: Zerotorescue
--- a/Queue.lua Wed Oct 20 01:37:22 2010 +0200 +++ b/Queue.lua Thu Oct 28 19:14:30 2010 +0200 @@ -75,7 +75,7 @@ temp[itemId] = true; end - local currentStock = addon:GetItemCount(itemId); + local currentStock = addon:GetItemCount(itemId, groupName); if currentStock >= 0 then -- Current stock will be -1 when no itemcount addon was found local restockTarget = addon:GetOptionByKey(groupName, "restockTarget"); @@ -89,7 +89,7 @@ end if amount > 0 and amount >= minCraftingQueue then - self:Queue(i, amount); + self:Queue(i, amount, groupName); print("Queued " .. amount .. " of " .. itemLink); end @@ -100,16 +100,18 @@ end end -function mod:Queue(tradeSkillIndex, amount) +function mod:Queue(tradeSkillIndex, amount, group) tradeSkillIndex = tonumber(tradeSkillIndex); amount = tonumber(amount); if not tradeSkillIndex or not amount then return; end - if addon.supportedAddons.crafting[addon.db.global.defaults.craftingAddon] then + local selectedExternalAddon = addon:GetOptionByKey(group, "craftingAddon"); + + if addon.supportedAddons.crafting[selectedExternalAddon] and addon.supportedAddons.crafting[selectedExternalAddon].IsEnabled() then -- Try to use the default auction pricing addon - return addon.supportedAddons.crafting[addon.db.global.defaults.craftingAddon].Queue(tradeSkillIndex, amount); + return addon.supportedAddons.crafting[selectedExternalAddon].Queue(tradeSkillIndex, amount); else -- Default not available, get the first one then
--- a/Summary.lua Wed Oct 20 01:37:22 2010 +0200 +++ b/Summary.lua Thu Oct 28 19:14:30 2010 +0200 @@ -3,6 +3,13 @@ local AceGUI = LibStub("AceGUI-3.0"); +local unknownItemName = "Unknown (#%d)"; + +local itemsCache = {}; + +local CACHE_ITEMS_TOTAL, CACHE_ITEMS_CURRENT = 0, 0; +local cacheStart; + function mod:OnEnable() self:RegisterWidgets(); @@ -11,6 +18,14 @@ mod:BuildMain(); mod:Build(); end, "s", "sum", "summary"); + addon:RegisterSlash(function() + if mod.frame then + mod.frame:SetWidth(650); + mod.frame:SetHeight(600); + + print("Resetting width and height of the summary frame."); + end + end, "r", "reset"); end local function ShowTooltip(self) @@ -74,11 +89,6 @@ AceGUI:RegisterWidgetType(widgetType, Constructor, widgetVersion); end -local itemsCache = {}; - -local CACHE_ITEMS_TOTAL, CACHE_ITEMS_CURRENT = 0, 0; -local cacheStart; - function mod:BuildMain() LibStub("AceConfigDialog-3.0"):Close("InventoriumOptions"); @@ -86,6 +96,7 @@ -- Main Window mod.frame = AceGUI:Create("Frame"); + _G["InventoriumSummary"] = mod.frame; -- name the global frame so it can be put in the UISpecialFrames mod.frame:SetTitle("Summary"); mod.frame:SetLayout("Fill"); mod.frame:SetCallback("OnClose", function(widget) @@ -101,6 +112,9 @@ addon.db.global.defaults.summary.height = height; end; + -- Close on escape + tinsert(UISpecialFrames, "InventoriumSummary"); + -- ScrollFrame child mod.scrollFrame = AceGUI:Create("ScrollFrame"); mod.scrollFrame:SetLayout("Flow"); @@ -265,7 +279,7 @@ local showWhenBelow = (values.summaryThresholdShow or (values.summaryThresholdShow == nil and addon.db.global.defaults.summaryThresholdShow)); local priceThreshold = (values.priceThreshold or (values.priceThreshold == nil and addon.db.global.defaults.priceThreshold)); local hideWhenBelowPriceThreshold = (values.hideFromSummaryWhenBelowPriceThreshold or (values.hideFromSummaryWhenBelowPriceThreshold == nil and addon.db.global.defaults.hideFromSummaryWhenBelowPriceThreshold)); - + local alwaysGetAuctionValue = (values.alwaysGetAuctionValue or (values.alwaysGetAuctionValue == nil and addon.db.global.defaults.alwaysGetAuctionValue)); -- Make group container local iGroup = AceGUI:Create("InlineGroupWithButton"); @@ -343,8 +357,6 @@ if not itemsCache[groupName] then itemsCache[groupName] = {}; - local unknownItemName = "Unknown (#%d)"; - -- Sort item list for itemId, _ in pairs(values.items) do local itemName, itemLink, itemRarity = GetItemInfo(itemId); @@ -352,10 +364,10 @@ table.insert(itemsCache[groupName], { id = itemId, name = itemName or unknownItemName:format(itemId), - link = itemLink or unknownItemName:format(itemId), - value = ((priceThreshold == 0) and -4) or -3,-- if no price threshold is set for this item, then don't look it up either --addon:GetAuctionValue(itemLink), + link = itemLink, + value = ((priceThreshold == 0 and not alwaysGetAuctionValue) and -4) or -3,-- if (no price threshold is set for this item and you don't want to always get auction value), then don't look it up either --addon:GetAuctionValue(itemLink), rarity = itemRarity or 1, - count = -3,--addon:GetItemCount(itemId), + count = -3,--addon:GetItemCount(itemId, groupName), set = {}, }); CACHE_ITEMS_TOTAL = CACHE_ITEMS_TOTAL + 1; @@ -412,9 +424,21 @@ for i, item in pairs(itemsCache[groupName]) do if ( item.count / minimumStock ) < showWhenBelow and not (hideWhenBelowPriceThreshold and item.value < priceThreshold) then local btnItemLink = AceGUI:Create("ItemLinkButton"); - --btnItemLink:SetUserData("exec", function() - -- print("Nothing happening yet."); - --end); + btnItemLink:SetUserData("exec", function(_, itemId, _, buttonName) + local itemName, itemLink = GetItemInfo(itemId); + + if buttonName == "LeftButton" and IsShiftKeyDown() and itemLink then + ChatEdit_InsertLink(itemLink); + elseif buttonName == "LeftButton" and IsAltKeyDown() and itemName and AuctionFrame and AuctionFrame:IsShown() and AuctionFrameBrowse then + -- Start search at page 0 + AuctionFrameBrowse.page = 0; + + -- Set the search field (even though we could use "ChatEdit_InsertLink", this ensures the right field is updated) + BrowseName:SetText(itemName) + + QueryAuctionItems(itemName, nil, nil, 0, 0, 0, 0, 0, 0); + end + end); btnItemLink:SetRelativeWidth(.7); btnItemLink:SetItemId(item.id); @@ -495,7 +519,7 @@ if item.set then if item.count == -3 then -- Only if item count was queued, update it - item.count = addon:GetItemCount(item.id); + item.count = addon:GetItemCount(item.id, groupName); if item.set.current and item.set.current.SetText then item.set.current:SetText(self:DisplayItemCount(item.count, minimumStock)); end @@ -503,9 +527,15 @@ if item.value == -3 then -- Only if item value was queued, update it - item.value = addon:GetAuctionValue(item.link); - if item.set.value and item.set.value.SetText then - item.set.value:SetText(self:DisplayMoney(item.value, priceThreshold)); + + -- The itemlink might not have been loaded yet in which case we retry + item.link = item.link or select(2, GetItemInfo(item.id)); + + if item.link then + item.value = addon:GetAuctionValue(item.link, groupName); + if item.set.value and item.set.value.SetText then + item.set.value:SetText(self:DisplayMoney(item.value, priceThreshold)); + end end end @@ -565,7 +595,9 @@ return "|cffffff00Unknown|r"; elseif value == -4 then return "|cff00ff00-|r"; - elseif value < priceThreshold then + elseif value == -5 then + return "|cffff9933Error|r"; + elseif priceThreshold and value < priceThreshold then return ("|cffaaaaaa%s|r"):format(addon:ReadableMoney(value or 0, true):gsub("|([a-fA-F0-9]+)([gsc]+)|r", "%2")); else return addon:ReadableMoney(value or 0, true);