From 027a52f4cb76a78cc3798075014faaa574a375e3 Mon Sep 17 00:00:00 2001 From: Noshei <8866000+Noshei@users.noreply.github.com> Date: Tue, 1 Oct 2024 14:56:40 -0600 Subject: [PATCH] 2.5.4 Added support for RECrystallize Localized global functions to improve performance --- Bindings.lua | 15 +++++ Broker.lua | 15 +++++ Config.lua | 141 ++++++++++++++++++++++++++++++++-------- DisplayCollapse.lua | 15 +++++ DisplayCreation.lua | 15 +++++ FilterButton.lua | 15 +++++ GatheringTracker.lua | 37 +++++++---- GatheringTracker.toc | 4 +- NotificationHandler.lua | 21 +++++- Utilities.lua | 34 ++++++++++ 10 files changed, 268 insertions(+), 44 deletions(-) diff --git a/Bindings.lua b/Bindings.lua index f3163a2..80899fe 100644 --- a/Bindings.lua +++ b/Bindings.lua @@ -1,5 +1,20 @@ local GT = LibStub("AceAddon-3.0"):GetAddon("GatheringTracker") +-- Localize global functions +local ipairs = ipairs +local math = math +local max = max +local next = next +local pairs = pairs +local select = select +local string = string +local table = table +local time = time +local tonumber = tonumber +local tostring = tostring +local type = type +local unpack = unpack + function GT:ToggleGatheringTracker() GT.Debug("Toggle Gathering Tracker", 1, GT.db.profile.General.enable) local key = not GT.db.profile.General.enable diff --git a/Broker.lua b/Broker.lua index 18e2406..7d28af5 100644 --- a/Broker.lua +++ b/Broker.lua @@ -2,6 +2,21 @@ local GT = LibStub("AceAddon-3.0"):GetAddon("GatheringTracker") local ldb = LibStub("LibDataBroker-1.1") local LibDBIcon = LibStub("LibDBIcon-1.0") +-- Localize global functions +local ipairs = ipairs +local math = math +local max = max +local next = next +local pairs = pairs +local select = select +local string = string +local table = table +local time = time +local tonumber = tonumber +local tostring = tostring +local type = type +local unpack = unpack + function GT:InitializeBroker() GT.Debug("InitializeBroker", 1) -- Create LibDataBroker data object diff --git a/Config.lua b/Config.lua index d475054..917e083 100644 --- a/Config.lua +++ b/Config.lua @@ -6,6 +6,21 @@ local media = LibStub:GetLibrary("LibSharedMedia-3.0") GT.media = media +-- Localize global functions +local ipairs = ipairs +local math = math +local max = max +local next = next +local pairs = pairs +local select = select +local string = string +local table = table +local time = time +local tonumber = tonumber +local tostring = tostring +local type = type +local unpack = unpack + GT.defaults = { profile = { General = { @@ -108,7 +123,8 @@ local generalOptions = { miniMap = { type = "toggle", name = "Minimap Button", - desc = "Enable this to show the minimap button.\nLeft Click shows filters menu.\nRight Click opens the addon options.", + desc = "Enable this to show the minimap button.\nLeft Click shows filters menu.\n" .. + "Right Click opens the addon options.", width = 1.70, get = function() return not GT.db.profile.miniMap.hide end, set = function(_, key) @@ -192,7 +208,8 @@ local generalOptions = { buttonDelay = { type = "range", name = "Fade Out Delay", - desc = "This configures how long after the mouse leaves the button before it fades out.\nDefault is 0.5.", + desc = "This configures how long after the mouse leaves the button before it fades out.\n" .. + "Default is 0.5.", min = 0, max = 1, step = 0.02, @@ -220,7 +237,9 @@ local generalOptions = { groupType = { type = "select", name = "Group Mode", - desc = "Disabled: Hides the display when in a group\nGroup Only: Only shows the display when in a group\nGroup and Solo: Shows the display when in a group or Solo", + desc = "Disabled: Hides the display when in a group\n" .. + "Group Only: Only shows the display when in a group\n" .. + "Group and Solo: Shows the display when in a group or Solo", width = 1.40, values = { [0] = "Disabled", [1] = "Group Only", [2] = "Group and Solo" }, get = function() return GT.db.profile.General.groupType end, @@ -238,7 +257,8 @@ local generalOptions = { hideOthers = { type = "toggle", name = "Hide Other Party Members", - desc = "When selected only your character will be displayed when you are in a group.\nInformation will still be sent to and received from party members.", + desc = "When selected only your character will be displayed when you are in a group.\n" .. + "Information will still be sent to and received from party members.", width = 1.70, get = function() return GT.db.profile.General.hideOthers end, set = function(_, key) @@ -292,7 +312,8 @@ local generalOptions = { type = "toggle", dialogControl = "NW_CheckBox", name = "Display Per Character Value", - desc = "When selected the gold value of the items gathered per character will be displayed above the totals row.", + desc = "When selected the gold value of the items gathered per character will be displayed above the totals row.\n" .. + "Price Source is required for this option to be enabled.", width = 1.70, image = function() return 133784 end, imageCoords = { { 24, 24 } }, @@ -310,6 +331,8 @@ local generalOptions = { disabled = function() if GT.db.profile.General.groupType == 0 then return true + elseif not GT.priceSources or GT.db.profile.General.tsmPrice == 0 then + return true else return false end @@ -409,21 +432,44 @@ local generalOptions = { }, tsmPrice = { type = "select", - name = "TSM Price Source", - desc = "Select the desired TSM price source, or none to disable price information. TSM is required for this option to be enabled.", + name = "Price Source", + desc = "Select the desired price source, or none to disable price information.\n" .. + "|cffff0000Supported addon required.|r\n\n" .. + "Supports:\n" .. + "TradeSkillMaster\n" .. + "RECrystallize", width = 1.70, - values = { [0] = "None", [1] = "DBMarket", [2] = "DBMinBuyout", [3] = "DBHistorical", [4] = "DBRegionMinBuyoutAvg", [5] = "DBRegionMarketAvg", [6] = "DBRegionHistorical" }, + values = function() + local options = {} + options[0] = "None" + if not GT.priceSources then + return options + end + if GT.priceSources["TradeSkillMaster"] then + options[1] = "TSM - DBMarket" + options[2] = "TSM - DBMinBuyout" + options[3] = "TSM - DBHistorical" + options[4] = "TSM - DBRegionMinBuyoutAvg" + options[5] = "TSM - DBRegionMarketAvg" + options[6] = "TSM - DBRegionHistorical" + end + if GT.priceSources["RECrystallize"] then + options[10] = "RECrystallize" + end + return options + end, get = function() return GT.db.profile.General.tsmPrice end, set = function(_, key) GT.db.profile.General.tsmPrice = key if GT.db.profile.General.tsmPrice == 0 then GT.db.profile.General.perItemPrice = false GT.db.profile.General.goldPerHour = false + GT.db.profile.General.characterValue = false end GT:RebuildDisplay("TSM Price Source Option Changed") end, disabled = function() - if not GT.tsmLoaded then + if not GT.priceSources then return true else return false @@ -434,7 +480,8 @@ local generalOptions = { perItemPrice = { type = "toggle", name = "Display Per Item Price", - desc = "If selected the price for 1 of each item will be displayed", + desc = "If selected the price for 1 of each item will be displayed.\n" .. + "Price Source is required for this option to be enabled.", width = 1.70, get = function() return GT.db.profile.General.perItemPrice end, set = function(_, key) @@ -442,7 +489,7 @@ local generalOptions = { GT:RebuildDisplay("Display Per Item Price Changed") end, disabled = function() - if not GT.tsmLoaded or GT.db.profile.General.tsmPrice == 0 then + if not GT.priceSources or GT.db.profile.General.tsmPrice == 0 then return true else return false @@ -493,7 +540,8 @@ local generalOptions = { goldPerHour = { type = "toggle", name = "Display Gold Per Hour", - desc = "If selected an estimated gold per hour will be displayed based on the value of items gathered.\nTSM is required for this option to be enabled.", + desc = "If selected an estimated gold per hour will be displayed based on the value of items gathered.\n" .. + "Price Source is required for this option to be enabled.", width = 1.70, get = function() return GT.db.profile.General.goldPerHour end, set = function(_, key) @@ -501,7 +549,7 @@ local generalOptions = { GT:RebuildDisplay("Gold Per Hour Changed") end, disabled = function() - if not GT.tsmLoaded or GT.db.profile.General.tsmPrice == 0 then + if not GT.priceSources or GT.db.profile.General.tsmPrice == 0 then return true else return false @@ -866,7 +914,9 @@ local generalOptions = { countItemAll = { type = "select", name = "Notify for each item, all items, or both", - desc = "This controls if the notification triggers when each filtered item hits the threshold, when all items hits the threshold, or both.\n\nDefault: All Items", + desc = "This controls if the notification triggers when each filtered item hits the threshold" .. + ", when all items hits the threshold, or both.\n\n" .. + "Default: All Items", width = 1.40, values = { [0] = "Each Item", [1] = "All Items", [2] = "Both" }, get = function() return GT.db.profile.Notifications.Count.itemAll end, @@ -883,8 +933,12 @@ local generalOptions = { countInterval = { type = "select", name = "Exact or Interval", - desc = - "This controls if the notification only triggers when exceeding the exact threshold, an interval of the threshold, or both.\n For an Example, if the threshold is 100:\n Exact: only triggers once after exceeding 100\n Interval: Triggers after exceeding 100, 200, 300, etc\n\nDefault: Exact", + desc = "This controls if the notification only triggers when exceeding the exact threshold" .. + ", an interval of the threshold, or both.\n" .. + "For an Example, if the threshold is 100:\n" .. + "Exact: only triggers once after exceeding 100\n" .. + "Interval: Triggers after exceeding 100, 200, 300, etc\n\n" .. + "Default: Exact", width = 1.40, values = { [0] = "Exact", [1] = "Interval" }, get = function() return GT.db.profile.Notifications.Count.interval end, @@ -909,7 +963,7 @@ local generalOptions = { GT:ToggleGoldNotifications() end, disabled = function() - if not GT.tsmLoaded or GT.db.profile.General.tsmPrice == 0 then + if not GT.priceSources or GT.db.profile.General.tsmPrice == 0 then return true else return false @@ -928,7 +982,7 @@ local generalOptions = { set = function(_, key) GT.db.profile.Notifications.Gold.sound = key end, disabled = function() if GT.db.profile.Notifications.Gold.enable then - if not GT.tsmLoaded or GT.db.profile.General.tsmPrice == 0 then + if not GT.priceSources or GT.db.profile.General.tsmPrice == 0 then return true else return false @@ -965,7 +1019,7 @@ local generalOptions = { end, disabled = function() if GT.db.profile.Notifications.Gold.enable then - if not GT.tsmLoaded or GT.db.profile.General.tsmPrice == 0 then + if not GT.priceSources or GT.db.profile.General.tsmPrice == 0 then return true else return false @@ -979,14 +1033,16 @@ local generalOptions = { goldItemAll = { type = "select", name = "Notify for each item, all items, or both", - desc = "This controls if the notification triggers when each filtered item hits the threshold, when all items hits the threshold, or both.\n\nDefault: All Items", + desc = "This controls if the notification triggers when each filtered item hits the threshold" .. + ", when all items hits the threshold, or both.\n\n" .. + "Default: All Items", width = 1.40, values = { [0] = "Each Item", [1] = "All Items", [2] = "Both" }, get = function() return GT.db.profile.Notifications.Gold.itemAll end, set = function(_, key) GT.db.profile.Notifications.Gold.itemAll = key end, disabled = function() if GT.db.profile.Notifications.Gold.enable then - if not GT.tsmLoaded or GT.db.profile.General.tsmPrice == 0 then + if not GT.priceSources or GT.db.profile.General.tsmPrice == 0 then return true else return false @@ -1006,15 +1062,19 @@ local generalOptions = { goldInterval = { type = "select", name = "Exact or Interval", - desc = - "This controls if the notification only triggers when exceeding the exact threshold, an interval of the threshold, or both.\n For an Example, if the threshold is 100:\n Exact: only triggers once after exceeding 100\n Interval: Triggers after exceeding 100, 200, 300, etc\n\nDefault: Exact", + desc = "This controls if the notification only triggers when exceeding the exact threshold" .. + ", an interval of the threshold, or both.\n" .. + "For an Example, if the threshold is 100:\n" .. + "Exact: only triggers once after exceeding 100\n" .. + "Interval: Triggers after exceeding 100, 200, 300, etc\n\n" .. + "Default: Exact", width = 1.40, values = { [0] = "Exact", [1] = "Interval" }, get = function() return GT.db.profile.Notifications.Gold.interval end, set = function(_, key) GT.db.profile.Notifications.Gold.interval = key end, disabled = function() if GT.db.profile.Notifications.Gold.enable then - if not GT.tsmLoaded or GT.db.profile.General.tsmPrice == 0 then + if not GT.priceSources or GT.db.profile.General.tsmPrice == 0 then return true else return false @@ -1042,7 +1102,14 @@ local generalOptions = { name = "Debug", desc = "This is for debugging the addon, do NOT enable, it is spammy.", width = 1.70, - values = { [0] = "Off", [1] = "Limited", [2] = "Info", [3] = "Debug", [4] = "Trace (Very Spammy)", [5] = "Notification Spam" }, + values = { + [0] = "Off", + [1] = "Limited", + [2] = "Info", + [3] = "Debug", + [4] = "Trace (Very Spammy)", + [5] = "Notification Spam", + }, get = function() if type(GT.db.profile.General.debugOption) == "boolean" then GT.db.profile.General.debugOption = 0 @@ -1479,9 +1546,27 @@ local function UpdateChangedorRemovedSavedVariables() end end +local function InitializePriceSource() + local priceSources = { "TradeSkillMaster", "RECrystallize" } + local priceSourcesLoaded = {} + + for _, source in ipairs(priceSources) do + local loaded = C_AddOns.IsAddOnLoaded(source) + if loaded then + priceSourcesLoaded[source] = true + end + end + + if next(priceSourcesLoaded) == nil then + priceSourcesLoaded = false + end + + return priceSourcesLoaded +end + function Config:OnInitialize() --have to check if tsm is loaded before we create the options so that we can use that variable in the options. - GT.tsmLoaded = C_AddOns.IsAddOnLoaded("TradeSkillMaster") + GT.priceSources = InitializePriceSource() GT.db = LibStub("AceDB-3.0"):New("GatheringTrackerDB", GT.defaults, true) GT.db.RegisterCallback(GT, "OnProfileChanged", "RefreshConfig") @@ -1494,10 +1579,10 @@ function Config:OnInitialize() end --if TSM is not loaded set tsmPrice Option to none. - if not GT.tsmLoaded then + if not GT.priceSources then GT.db.profile.General.tsmPrice = 0 GT.db.profile.General.perItemPrice = false - else + elseif GT.priceSources["TradeSkillMaster"] then GT:SetTSMPriceSource() end diff --git a/DisplayCollapse.lua b/DisplayCollapse.lua index b9c3115..7563a7c 100644 --- a/DisplayCollapse.lua +++ b/DisplayCollapse.lua @@ -1,5 +1,20 @@ local GT = LibStub("AceAddon-3.0"):GetAddon("GatheringTracker") +-- Localize global functions +local ipairs = ipairs +local math = math +local max = max +local next = next +local pairs = pairs +local select = select +local string = string +local table = table +local time = time +local tonumber = tonumber +local tostring = tostring +local type = type +local unpack = unpack + function GT:CollapseDisplay() GT.Debug("CollapseDisplay", 1) for itemID, itemFrame in pairs(GT.Display.Frames) do diff --git a/DisplayCreation.lua b/DisplayCreation.lua index 321c1cf..fb51c4e 100644 --- a/DisplayCreation.lua +++ b/DisplayCreation.lua @@ -1,6 +1,21 @@ local GT = LibStub("AceAddon-3.0"):GetAddon("GatheringTracker") local media = LibStub:GetLibrary("LibSharedMedia-3.0") +-- Localize global functions +local ipairs = ipairs +local math = math +local max = max +local next = next +local pairs = pairs +local select = select +local string = string +local table = table +local time = time +local tonumber = tonumber +local tostring = tostring +local type = type +local unpack = unpack + local function FramePool_Resetter(framePool, frame) frame:Hide() frame:ClearAllPoints() diff --git a/FilterButton.lua b/FilterButton.lua index a14e467..7595d14 100644 --- a/FilterButton.lua +++ b/FilterButton.lua @@ -1,5 +1,20 @@ local GT = LibStub("AceAddon-3.0"):GetAddon("GatheringTracker") +-- Localize global functions +local ipairs = ipairs +local math = math +local max = max +local next = next +local pairs = pairs +local select = select +local string = string +local table = table +local time = time +local tonumber = tonumber +local tostring = tostring +local type = type +local unpack = unpack + function GT:ToggleFilterButton(show) if show then GT.Debug("Show Filters Button", 1) diff --git a/GatheringTracker.lua b/GatheringTracker.lua index da6c159..5ec3cdf 100644 --- a/GatheringTracker.lua +++ b/GatheringTracker.lua @@ -15,6 +15,21 @@ GT.Notifications = {} GT.NotificationPause = true GT.GlobalStartTime = 0 +-- Localize global functions +local ipairs = ipairs +local math = math +local max = max +local next = next +local pairs = pairs +local select = select +local string = string +local table = table +local time = time +local tonumber = tonumber +local tostring = tostring +local type = type +local unpack = unpack + GT.metaData = { name = C_AddOns.GetAddOnMetadata("GatheringTracker", "Title"), version = C_AddOns.GetAddOnMetadata("GatheringTracker", "Version"), @@ -526,7 +541,7 @@ function GT:PrepareDataForDisplay(event, wait) GT:SetupTotalsRow() - if GT.db.profile.General.characterValue and GT:GroupDisplayCheck() and GT.tsmLoaded then + if GT.db.profile.General.characterValue and GT:GroupDisplayCheck() and GT.priceSources then local playerPriceTotals = {} for senderIndex, senderData in ipairs(GT.sender) do local playerTotal, playerPrice = GT:CalculateTotals(senderIndex, true) @@ -577,8 +592,8 @@ function GT:SetupItemRows() else local totalItemCount, priceTotalItem = GT:CalculateTotals(nil, nil, itemID, true) local pricePerItem = nil - if GT.tsmLoaded then - pricePerItem = (TSM_API.GetCustomPriceValue(GT.TSM, "i:" .. itemID) or 0) / 10000 + if GT.priceSources then + pricePerItem = GT:GetItemPrice(itemID) end local itemsPerHour = GT:CalculateItemsPerHour(itemID) local goldPerHour = itemsPerHour * (pricePerItem or 0) @@ -624,8 +639,8 @@ function GT:CalculateItemsPerHourTotal(playerTotals) startAmount = startAmount + itemData.startTotal local itemPerHour = GT:CalculateItemsPerHour(itemID) - if itemPerHour and GT.tsmLoaded then - pricePerHour = pricePerHour + (itemPerHour * ((TSM_API.GetCustomPriceValue(GT.TSM, "i:" .. itemID) or 0) / 10000)) + if itemPerHour and GT.priceSources then + pricePerHour = pricePerHour + (itemPerHour * GT:GetItemPrice(itemID)) end end end @@ -688,8 +703,8 @@ function GT:RefreshPerHourDisplay(stop, wait) local itemsPerHour = 0 local goldPerHour = 0 local pricePerItem = nil - if GT.tsmLoaded then - pricePerItem = (TSM_API.GetCustomPriceValue(GT.TSM, "i:" .. itemID) or 0) / 10000 + if GT.priceSources then + pricePerItem = GT:GetItemPrice(itemID) end if itemFrame.itemsPerHour and GT.db.profile.General.itemsPerHour then @@ -1034,8 +1049,8 @@ function GT:CalculatePlayerTotals(senderIndex, calcSenderValue) for itemID, itemCount in pairs(GT.sender[senderIndex].inventoryData) do if itemID > #GT.ItemData.Other.Other and itemCount - GT.db.profile.General.ignoreAmount > 0 then total = total + itemCount - if calcSenderValue and GT.tsmLoaded then - value = value + (itemCount * (TSM_API.GetCustomPriceValue(GT.TSM, "i:" .. itemID) or 0) / 10000) + if calcSenderValue and GT.priceSources then + value = value + (itemCount * GT:GetItemPrice(itemID)) end end end @@ -1052,8 +1067,8 @@ function GT:CalculateItemTotals(itemID, calcItemValue) total = total + itemCount end end - if calcItemValue and GT.tsmLoaded then - value = (total * (TSM_API.GetCustomPriceValue(GT.TSM, "i:" .. itemID) or 0) / 10000) + if calcItemValue and GT.priceSources then + value = (total * GT:GetItemPrice(itemID)) end GT.InventoryData[itemID].total = total return total, math.ceil(value - 0.5) --rounds up to whole number diff --git a/GatheringTracker.toc b/GatheringTracker.toc index 4d6b71b..3853e26 100644 --- a/GatheringTracker.toc +++ b/GatheringTracker.toc @@ -2,8 +2,8 @@ ## Title: Gathering Tracker ## Notes: Addon for tracking gathered items, supports solo players and groups ## Author: Noshei -## Version: 2.5.3 -## OptionalDeps: TradeSkillMaster +## Version: 2.5.4 +## OptionalDeps: TradeSkillMaster, RECrystallize ## SavedVariables: GatheringTrackerDB ## AddonCompartmentFunc: GatheringTracker_OnAddonCompartmentClick ## IconTexture: 3692438 diff --git a/NotificationHandler.lua b/NotificationHandler.lua index a4c27a1..a19de7f 100644 --- a/NotificationHandler.lua +++ b/NotificationHandler.lua @@ -1,6 +1,21 @@ local GT = LibStub("AceAddon-3.0"):GetAddon("GatheringTracker") local media = LibStub:GetLibrary("LibSharedMedia-3.0") +-- Localize global functions +local ipairs = ipairs +local math = math +local max = max +local next = next +local pairs = pairs +local select = select +local string = string +local table = table +local time = time +local tonumber = tonumber +local tostring = tostring +local type = type +local unpack = unpack + function GT:NotificationHandler(mode, id, amount, value) GT.Debug("Notifications Handler", 5, mode, id, amount, value) @@ -110,13 +125,13 @@ function GT:NotificationHandler(mode, id, amount, value) end end - if GT.db.profile.Notifications.Gold.enable and GT.tsmLoaded and GT.db.profile.General.tsmPrice > 0 then + if GT.db.profile.Notifications.Gold.enable and GT.priceSources and GT.db.profile.General.tsmPrice > 0 then if mode == "all" and (GT.db.profile.Notifications.Gold.itemAll == 1 or GT.db.profile.Notifications.Gold.itemAll == 2) then --All Items or Both NotificationCheck("Gold", false) end if mode == "each" and (GT.db.profile.Notifications.Gold.itemAll == 0 or GT.db.profile.Notifications.Gold.itemAll == 2) then --Each Item or Both if GT.db.profile.General.tsmPrice > 0 then - local eprice = (TSM_API.GetCustomPriceValue(GT.TSM, "i:" .. tostring(id)) or 0) / 10000 + local eprice = GT:GetItemPrice(id) value = math.ceil(eprice * amount) NotificationCheck("Gold", false) end @@ -135,7 +150,7 @@ function GT:NotificationHandler(mode, id, amount, value) playerTotal = playerTotal + amount NotificationCheck("Count", true) if GT.db.profile.General.tsmPrice > 0 then - local eprice = (TSM_API.GetCustomPriceValue(GT.TSM, "i:" .. tostring(itemID)) or 0) / 10000 + local eprice = GT:GetItemPrice(itemID) value = math.ceil(eprice * amount) NotificationCheck("Gold", true) end diff --git a/Utilities.lua b/Utilities.lua index 1ede2d1..d2094b5 100644 --- a/Utilities.lua +++ b/Utilities.lua @@ -1,5 +1,20 @@ local GT = LibStub("AceAddon-3.0"):GetAddon("GatheringTracker") +-- Localize global functions +local ipairs = ipairs +local math = math +local max = max +local next = next +local pairs = pairs +local select = select +local string = string +local table = table +local time = time +local tonumber = tonumber +local tostring = tostring +local type = type +local unpack = unpack + function GT:AddComas(str) return #str % 3 == 0 and str:reverse():gsub("(%d%d%d)", "%1,"):reverse():sub(2) or str:reverse():gsub("(%d%d%d)", "%1,"):reverse() end @@ -246,3 +261,22 @@ function GT:CheckColumnSize(index, frame) return end end + +function GT:GetItemPrice(itemID) + if not GT.priceSources then + return + end + if GT.db.profile.General.tsmPrice == 0 then + return 0 + end + local itemID = tonumber(itemID) + local price = 0 + + if GT.priceSources["RECrystallize"] and GT.db.profile.General.tsmPrice == 10 then + price = (RECrystallize_PriceCheckItemID(itemID) or 0) / 10000 + end + if GT.priceSources["TradeSkillMaster"] then + price = (TSM_API.GetCustomPriceValue(GT.TSM, "i:" .. itemID) or 0) / 10000 + end + return price +end