diff --git a/Bindings.lua b/Bindings.lua index 609fb16..f8414ae 100644 --- a/Bindings.lua +++ b/Bindings.lua @@ -1,3 +1,4 @@ +---@class GT local GT = LibStub("AceAddon-3.0"):GetAddon("GatheringTracker") -- Localize global functions diff --git a/Broker.lua b/Broker.lua index 7d28af5..4c7af31 100644 --- a/Broker.lua +++ b/Broker.lua @@ -1,3 +1,4 @@ +---@class GT local GT = LibStub("AceAddon-3.0"):GetAddon("GatheringTracker") local ldb = LibStub("LibDataBroker-1.1") local LibDBIcon = LibStub("LibDBIcon-1.0") diff --git a/Config.lua b/Config.lua index a2cd9da..dd662b2 100644 --- a/Config.lua +++ b/Config.lua @@ -1,5 +1,5 @@ +---@class GT : AceAddon-3.0, AceEvent-3.0, AceConfigRegistry-3.0, AceConfigDialog-3.0 local GT = LibStub("AceAddon-3.0"):GetAddon("GatheringTracker") -local Config = GT:NewModule("Config", "AceEvent-3.0") local AceConfigRegistry = LibStub("AceConfigRegistry-3.0") local AceConfigDialog = LibStub("AceConfigDialog-3.0") local media = LibStub:GetLibrary("LibSharedMedia-3.0") @@ -63,6 +63,7 @@ GT.defaults = { collapseTime = 2, sessionItems = false, sessionOnly = false, + itemTooltip = false, }, Notifications = { Count = { @@ -422,6 +423,19 @@ local generalOptions = { end, order = 320 }, + itemTooltip = { + type = "toggle", + name = "Display Item Tooltip", + desc = + "When selected the item tooltip will be displayed when mousing over an items icon.", + width = 1.70, + get = function() return GT.db.profile.General.itemTooltip end, + set = function(_, key) + GT.db.profile.General.itemTooltip = key + GT:RebuildDisplay("Item Tooltip Option Changed") + end, + order = 321 + }, }, }, LookandFeel = { @@ -429,7 +443,7 @@ local generalOptions = { name = "Look and Feel", order = 2, args = { - header2 = { + header3 = { type = "header", name = "Display Options", order = 200 @@ -648,7 +662,7 @@ local generalOptions = { end, order = 257 }, - header3 = { + header4 = { type = "header", name = "Columns", order = 300 @@ -688,7 +702,7 @@ local generalOptions = { end, order = 302 }, - header4 = { + header5 = { type = "header", name = "Icon", order = 400 @@ -747,7 +761,7 @@ local generalOptions = { for itemID, itemFrame in pairs(GT.Display.Frames) do if itemID > 2 and itemID < 9999999998 then local iconRarity = C_Item.GetItemQualityByID(itemID) - GT:CreateRarityBorder(itemFrame, iconRarity) + GT:DisplayFrameRarity(itemFrame, iconRarity) end end else @@ -762,7 +776,7 @@ local generalOptions = { end, order = 403 }, - header5 = { + header6 = { type = "header", name = "Text", order = 500 @@ -1299,7 +1313,7 @@ for expansion, expansionData in pairs(GT.ItemData) do if itemData.id <= #GT.ItemData.Other.Other then return itemData.icon else - return GetItemIcon(tonumber(itemData.id)) + return C_Item.GetItemIconByID(itemData.id) end end, imageCoords = function() @@ -1314,7 +1328,7 @@ for expansion, expansionData in pairs(GT.ItemData) do borderColor = nil overlay = nil else - local rarity = C_Item.GetItemQualityByID(tonumber(itemData.id)) or 1 + local rarity = C_Item.GetItemQualityByID(itemData.id) or 1 if rarity <= 1 then border = { "Interface\\Common\\WhiteIconFrame", "texture" } else @@ -1433,7 +1447,7 @@ local aliasOptions = { end if exists > 0 then if tempAliasName == "Reset This Alias" then - table.remove(GT.db.profile.Aliases, index) + table.remove(GT.db.profile.Aliases, exists) GT:UpdateAliases(tempAliasCharacter) else GT.db.profile.Aliases[exists].alias = tempAliasName @@ -1496,7 +1510,7 @@ function GT:CreateCustomFilterOptions() end for id, value in pairs(GT.db.profile.CustomFiltersTable) do --Create a local item to get data from the server - local itemID = tonumber(id) + local itemID = tonumber(id) or 1 local item = Item:CreateFromItemID(itemID) GT.Debug("Create Custom Filter Options", 2, itemID) --Waits for the data to be returned from the server @@ -1507,7 +1521,7 @@ function GT:CreateCustomFilterOptions() type = "toggle", dialogControl = "NW_CheckBox", name = itemName, - image = function() return GetItemIcon(tonumber(id)) end, + image = function() return C_Item.GetItemIconByID(id) end, get = function() return GT.db.profile.CustomFiltersTable[id] end, set = function(_, key) if key then @@ -1526,12 +1540,12 @@ function GT:CreateCustomFilterOptions() local borderColor = {} local overlay = {} - if tonumber(id) <= #GT.ItemData.Other.Other then + if id <= #GT.ItemData.Other.Other then border = nil borderColor = nil overlay = nil else - local rarity = C_Item.GetItemQualityByID(tonumber(id)) or 1 + local rarity = C_Item.GetItemQualityByID(id) or 1 if rarity <= 1 then border = { "Interface\\Common\\WhiteIconFrame", "texture" } else @@ -1632,13 +1646,13 @@ local function InitializePriceSource() end if next(priceSourcesLoaded) == nil then - priceSourcesLoaded = false + priceSourcesLoaded = nil end return priceSourcesLoaded end -function Config:OnInitialize() +function GT:OnInitialize() --have to check if tsm is loaded before we create the options so that we can use that variable in the options. GT.priceSources = InitializePriceSource() @@ -1693,18 +1707,18 @@ function Config:OnInitialize() --register font and sound with LSM media:Register("font", "Fira Mono Medium", "Interface\\Addons\\GatheringTracker\\Media\\Fonts\\FiraMono-Medium.ttf", media.LOCALE_BIT_western + media.LOCALE_BIT_ruRU) - media:Register("sound", "Auction Window Open", 567482) - media:Register("sound", "Auction Window Close", 567499) - media:Register("sound", "Auto Quest Complete", 567476) - media:Register("sound", "Level Up", 567431) - media:Register("sound", "Player Invite", 567451) - media:Register("sound", "Raid Warning", 567397) - media:Register("sound", "Ready Check", 567409) - media:Register("sound", "Murloc Aggro", 556000) - media:Register("sound", "Map Ping", 567416) - media:Register("sound", "Bonk 1", 568956) - media:Register("sound", "Bonk 2", 569179) - media:Register("sound", "Bonk 3", 569569) + media:Register("sound", "Auction Window Open", "567482") + media:Register("sound", "Auction Window Close", "567499") + media:Register("sound", "Auto Quest Complete", "567476") + media:Register("sound", "Level Up", "567431") + media:Register("sound", "Player Invite", "567451") + media:Register("sound", "Raid Warning", "567397") + media:Register("sound", "Ready Check", "567409") + media:Register("sound", "Murloc Aggro", "556000") + media:Register("sound", "Map Ping", "567416") + media:Register("sound", "Bonk 1", "568956") + media:Register("sound", "Bonk 2", "569179") + media:Register("sound", "Bonk 3", "569569") GT.Enabled = GT.db.profile.General.enable if not GT.Enabled then @@ -1719,5 +1733,5 @@ function Config:OnInitialize() GT.NotificationPause = true GT:RebuildIDTables() - GT:CreateBaseFrame("Config:OnInitialize") + GT:CreateBaseFrame() end diff --git a/Constants.lua b/Constants.lua index f6dc4dd..60db233 100644 --- a/Constants.lua +++ b/Constants.lua @@ -1,3 +1,4 @@ +---@class GT local GT = LibStub("AceAddon-3.0"):GetAddon("GatheringTracker") local expansions = { diff --git a/DisplayCollapse.lua b/DisplayCollapse.lua index 7563a7c..9619c51 100644 --- a/DisplayCollapse.lua +++ b/DisplayCollapse.lua @@ -1,3 +1,4 @@ +---@class GT local GT = LibStub("AceAddon-3.0"):GetAddon("GatheringTracker") -- Localize global functions diff --git a/DisplayCreation.lua b/DisplayCreation.lua index fb51c4e..6b3f80e 100644 --- a/DisplayCreation.lua +++ b/DisplayCreation.lua @@ -1,3 +1,4 @@ +---@class GT local GT = LibStub("AceAddon-3.0"):GetAddon("GatheringTracker") local media = LibStub:GetLibrary("LibSharedMedia-3.0") @@ -20,6 +21,10 @@ local function FramePool_Resetter(framePool, frame) frame:Hide() frame:ClearAllPoints() if frame.icon then + frame.icon:SetScript("OnEnter", nil) + frame.icon:SetScript("OnLeave", nil) + frame.icon:SetMouseClickEnabled(false) + frame.icon:SetMouseMotionEnabled(false) GT.Pools.texturePool:Release(frame.icon) frame.icon = nil end @@ -100,7 +105,9 @@ function GT:CreateDisplayFrame(id, iconId, iconQuality, iconRarity, displayText, GT.Display.Frames[id] = frame - GT:DisplayFrameIcon(frame, iconId) + --GT:DisplayFrameHighlight(frame) + + GT:DisplayFrameIcon(frame, iconId, id) if iconQuality then GT:DisplayFrameQuality(frame, iconQuality) @@ -108,7 +115,7 @@ function GT:CreateDisplayFrame(id, iconId, iconQuality, iconRarity, displayText, GT:DisplayFrameRarity(frame, iconRarity) - frameHeight = frame:GetHeight() + local frameHeight = frame:GetHeight() frame.text = {} GT:DisplayFrameCounts(frame, id, displayText) @@ -150,7 +157,7 @@ function GT:DisplayFrameBase(id) return frame end -function GT:DisplayFrameIcon(frame, iconId) +function GT:DisplayFrameIcon(frame, iconId, id) frame.icon = GT.Pools.texturePool:Acquire() frame.icon:SetParent(frame) frame.icon:SetDrawLayer("BACKGROUND", 0) @@ -159,6 +166,33 @@ function GT:DisplayFrameIcon(frame, iconId) frame.icon:SetWidth(GT.db.profile.General.iconWidth) frame.icon:SetHeight(GT.db.profile.General.iconHeight) frame.icon:Show() + + if id <= #GT.ItemData.Other.Other and id >= 9999999998 then + return + end + if not GT.db.profile.General.itemTooltip then + return + end + + frame.icon:SetScript("OnEnter", function(self, motion) + if motion then + GameTooltip:SetOwner(self, self:GetTooltipAnchor()) + GameTooltip:SetItemByID(id) + GameTooltip:Show() + end + end) + + frame.icon:SetScript("OnLeave", function(self) + if GameTooltip:GetOwner() == self then + GameTooltip:Hide() + end + end) + + function frame.icon:GetTooltipAnchor() + local x = self:GetRight() / GetScreenWidth() > 0.8 + return x and 'ANCHOR_LEFT' or 'ANCHOR_RIGHT' + end + frame.icon:SetMouseClickEnabled(false) end function GT:DisplayFrameQuality(frame, iconQuality) @@ -196,6 +230,23 @@ function GT:DisplayFrameRarity(frame, iconRarity) frame.iconRarity:Show() end +function GT:DisplayFrameHighlight(frame) + frame.highlight = GT.Pools.texturePool:Acquire() + frame.highlight:SetParent(frame) + frame.highlight:SetDrawLayer("BACKGROUND", 7) + frame.highlight:SetAtlas("communities-create-avatar-border-hover") + frame.highlight:SetAllPoints(frame) + frame.highlight:Hide() +end +--[[ + Possible textures to use for the highlight: + Looting_ItemCard_HighlightState (best option as it is visible and colors well) + ClickCastList-ButtonHighlight (good option, but less visible) + Adventures_MissionList_Highlight + communitiesfinder_card_highlight + search-highlight-largeNumber +]] + function GT:DisplayFrameCounts(frame, id, displayText) for i, text in ipairs(displayText) do local anchor = frame.icon diff --git a/FilterButton.lua b/FilterButton.lua index 0555a6f..3797d68 100644 --- a/FilterButton.lua +++ b/FilterButton.lua @@ -1,3 +1,4 @@ +---@class GT local GT = LibStub("AceAddon-3.0"):GetAddon("GatheringTracker") -- Localize global functions @@ -226,7 +227,7 @@ function GT:GenerateFiltersMenu(frame) if itemData.icon then leftTexture:SetTexture(itemData.icon) else - leftTexture:SetTexture(GetItemIcon(tonumber(itemData.id))) + leftTexture:SetTexture(C_Item.GetItemIconByID(itemData.id)) end text.fontString:SetPoint("LEFT", leftTexture, "RIGHT", 7, 1) @@ -331,7 +332,7 @@ end function GT:CreateCustomFiltersList(frame, rootDescription) local customFiltersList = {} for id, data in pairs(GT.db.profile.CustomFiltersTable) do - local itemID = tonumber(id) + local itemID = tonumber(id) or 1 local item = Item:CreateFromItemID(itemID) --Waits for the data to be returned from the server if not item:IsItemEmpty() then @@ -339,7 +340,7 @@ function GT:CreateCustomFiltersList(frame, rootDescription) local itemDetails = { id = tonumber(id), text = item:GetItemName(), - icon = tostring(GetItemIcon(itemID) or "") + icon = tostring(C_Item.GetItemIconByID(itemID) or "") } table.insert(customFiltersList, itemDetails) end) @@ -427,7 +428,7 @@ function GT:CreateProfilesList(frame, rootDescription) end local function SetSelected_Profile() - GT.Debug("Profile Button Clicked", 2, name, key) + GT.Debug("Profile Button Clicked", 2, name) --this closes the menu when the profile is changed --ToggleDropDownMenu(1, nil, GT.baseFrame.menu, "cursor", 0, 0, GT.baseFrame.filterMenu, nil) GT.db:SetProfile(name) diff --git a/GatheringTracker.lua b/GatheringTracker.lua index 43149c6..475bd0f 100644 --- a/GatheringTracker.lua +++ b/GatheringTracker.lua @@ -1,7 +1,7 @@ GatheringTracker = LibStub("AceAddon-3.0"):NewAddon("GatheringTracker", "AceEvent-3.0", "AceComm-3.0") -local AceGUI = LibStub("AceGUI-3.0") -local media = LibStub:GetLibrary("LibSharedMedia-3.0") +---@class GT : AceAddon-3.0, AceEvent-3.0, AceComm-3.0, AceGUI-3.0 local GT = GatheringTracker + GT.sender = {} GT.count = {} GT.InventoryData = {} @@ -524,15 +524,8 @@ function GT:PrepareDataForDisplay(event, wait) for senderIndex, senderData in ipairs(GT.sender) do if senderData.name == GT.Player and not GT.NotificationPause then GT.Debug("Trigger Notification Handler for all", 2) - local countTotal = 0 - local valueTotal = 0 - if playerTotals and playerTotals.countTotal and playerTotals.countTotal[senderIndex] then - countTotal = playerTotals.countTotal[senderIndex] - end - if playerTotals and playerTotals.valueTotal and playerTotals.valueTotal[senderIndex] then - valueTotal = playerTotals.valueTotal[senderIndex] - end - GT:NotificationHandler("all", "all", countTotal, valueTotal) + local count, value = GT:CalculatePlayerTotals(senderIndex, true, GT.db.profile.General.sessionOnly) + GT:NotificationHandler("all", "all", count, value) end end @@ -545,11 +538,9 @@ function GT:PrepareDataForDisplay(event, wait) 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( + local playerTotal, playerPrice = GT:CalculatePlayerTotals( senderIndex, true, - nil, - nil, GT.db.profile.General.sessionOnly ) table.insert(playerPriceTotals, tostring(math.ceil(playerPrice - 0.5)) .. "g") @@ -597,7 +588,11 @@ function GT:SetupItemRows() itemData.counts ) else - local totalItemCount, priceTotalItem = GT:CalculateTotals(nil, nil, itemID, true, GT.db.profile.General.sessionOnly) + local totalItemCount, priceTotalItem = GT:CalculateItemTotals( + itemID, + true, + GT.db.profile.General.sessionOnly + ) local pricePerItem = nil if GT.priceSources then pricePerItem = GT:GetItemPrice(itemID) @@ -608,7 +603,7 @@ function GT:SetupItemRows() if totalItemCount > 0 or GT.db.profile.General.allFiltered then GT:InitiateFrameProcess( tonumber(itemID), - GetItemIcon(tonumber(itemID)), + C_Item.GetItemIconByID(itemID), C_TradeSkillUI.GetItemReagentQualityByItemInfo(itemID), C_Item.GetItemQualityByID(itemID), GT:GetItemRowData(itemID), @@ -694,10 +689,18 @@ function GT:SetupTotalsRow() local totalItemCount = 0 for senderIndex, senderData in ipairs(GT.sender) do - local playerTotal, playerPrice = GT:CalculateTotals(senderIndex, true, nil, nil, GT.db.profile.General.sessionOnly) + local playerTotal, playerPrice = GT:CalculatePlayerTotals( + senderIndex, + true, + GT.db.profile.General.sessionOnly + ) table.insert(playerTotals, playerTotal) if GT.db.profile.General.sessionItems and not GT.db.profile.General.sessionOnly and not IsInGroup() then - local playerTotalSession, playerPriceSession = GT:CalculateTotals(senderIndex, true, nil, nil, true) + local playerTotalSession, playerPriceSession = GT:CalculatePlayerTotals( + senderIndex, + true, + true + ) table.insert(playerTotals, playerTotalSession) end totalItemCount = totalItemCount + playerTotal @@ -755,7 +758,11 @@ function GT:RefreshPerHourDisplay(stop, wait) local totalItemCount = 0 for senderIndex, senderData in ipairs(GT.sender) do - local playerTotal = GT:CalculateTotals(senderIndex) + local playerTotal = GT:CalculatePlayerTotals( + senderIndex, + false, + GT.db.profile.General.sessionOnly + ) table.insert(playerTotals, playerTotal) end totalItemCount = GT:SumTable(playerTotals) @@ -901,6 +908,9 @@ function GT:ProcessSoloData(event) GT:PrepareDataForDisplay("Process Solo Data") end +--- Creates the message string to send to other party members +---@param event any calling function +---@param wait any if true we will wait a bit to avoid issues function GT:CreateDataMessage(event, wait) GT.Debug("CreateDataMessage", 2, event) if wait then @@ -943,6 +953,8 @@ function GT:CreateDataMessage(event, wait) GT:SendDataMessage(updateMessage) end +--- Send addon message to other characters in group +---@param updateMessage string message string to send to group that is formatted with id=count and space seperated function GT:SendDataMessage(updateMessage) GT:SetChatType() @@ -950,6 +962,11 @@ function GT:SendDataMessage(updateMessage) GT:SendCommMessage("GT_Data", updateMessage, GT.groupMode, nil, "NORMAL") end +--- Called when receiving an addon message +---@param prefix string addon message prefix +---@param message string addon message +---@param distribution string distribution type of message expect "PARTY" or "RAID" +---@param sender string name of player that sent the message function GT:DataMessageReceived(prefix, message, distribution, sender) GT.Debug("Data Message Received", 3, prefix, message, distribution, sender) @@ -977,6 +994,9 @@ function GT:DataMessageReceived(prefix, message, distribution, sender) GT:PrepareDataForDisplay("Data Message Received") end +--- Creates or Updates the sender table +---@param sender string Sender name +---@return integer senderIndex function GT:UpdateSenderTable(sender) GT.Debug("UpdateSenderTable", 2, sender) local senderIndex = 0 @@ -1000,6 +1020,9 @@ function GT:UpdateSenderTable(sender) return senderIndex end +--- Creates a table from a string that is formatted with id=count and space seperated +---@param message string Message string +---@return table itemTable function GT:CreateItemTable(message) GT.Debug("CreateItemTable", 3, message) --create messageText table @@ -1009,12 +1032,17 @@ function GT:CreateItemTable(message) for itemID, value in string.gmatch(str, "(%S-)=(.-)\n") do local itemID = tonumber(itemID) + ---@diagnostic disable-next-line: need-check-nil itemTable[itemID] = value end return itemTable end +--- Creates an itemData Construct +---@param itemID integer ID of the item to create +---@param senderIndex integer Index of the user that initiated the creation of the item +---@return table itemData function GT:ItemDataConstructor(itemID, senderIndex) GT.Debug("ItemDataConstructor", 1, itemID, senderIndex) @@ -1032,6 +1060,9 @@ function GT:ItemDataConstructor(itemID, senderIndex) return itemData end +--- Updates the Inventory data for a Sender +---@param senderIndex integer +---@param itemTable table function GT:UpdateInventoryData(senderIndex, itemTable) GT.Debug("UpdateInventoryData", 1, senderIndex, itemTable) for itemID, value in pairs(itemTable) do @@ -1073,6 +1104,8 @@ function GT:UpdateInventoryData(senderIndex, itemTable) end end +---@param itemID integer +---@return integer startTotal function GT:CalculateStartTotal(itemID) GT.Debug("CalculateStartTotal", 1, itemID) @@ -1087,18 +1120,11 @@ function GT:CalculateStartTotal(itemID) return total end -function GT:CalculateTotals(senderIndex, calcSenderValue, itemID, calcItemValue, useSessionData) - GT.Debug("CalculateTotals", 1, senderIndex, calcSenderValue, itemID, calcItemValue, useSessionData) - - if senderIndex then - return GT:CalculatePlayerTotals(senderIndex, calcSenderValue, useSessionData) - end - - if itemID then - return GT:CalculateItemTotals(itemID, calcItemValue, useSessionData) - end -end - +---@param senderIndex integer Index of a character from GT.Sender +---@param calcSenderValue boolean If true calculates value of all filtered items from sender +---@param useSessionData boolean If true only uses session data for calculations +---@return integer total Total count of items for sender +---@return integer value Total gold value of items for sender function GT:CalculatePlayerTotals(senderIndex, calcSenderValue, useSessionData) GT.Debug("CalculatePlayerTotals", 1, senderIndex, calcSenderValue, useSessionData) @@ -1121,6 +1147,11 @@ function GT:CalculatePlayerTotals(senderIndex, calcSenderValue, useSessionData) return total, math.ceil(value - 0.5) --rounds up to whole number end +---@param itemID integer Item id of the item to calculate for +---@param calcItemValue boolean If true calculates value of the item from all senders +---@param useSessionData boolean If true only uses session data for calculations +---@return integer total Total count of the item from all senders +---@return integer value Total gold value of the item from all senders function GT:CalculateItemTotals(itemID, calcItemValue, useSessionData) GT.Debug("CalculateItemTotals", 1, itemID, calcItemValue, useSessionData) diff --git a/GatheringTracker.toc b/GatheringTracker.toc index 94d7b11..ffad540 100644 --- a/GatheringTracker.toc +++ b/GatheringTracker.toc @@ -2,7 +2,7 @@ ## Title: Gathering Tracker ## Notes: Addon for tracking gathered items, supports solo players and groups ## Author: Noshei -## Version: 2.6.1 +## Version: 2.6.2 ## OptionalDeps: TradeSkillMaster, RECrystallize, Auctionator ## SavedVariables: GatheringTrackerDB ## AddonCompartmentFunc: GatheringTracker_OnAddonCompartmentClick diff --git a/NotificationHandler.lua b/NotificationHandler.lua index a19de7f..abea4e4 100644 --- a/NotificationHandler.lua +++ b/NotificationHandler.lua @@ -1,3 +1,4 @@ +---@class GT local GT = LibStub("AceAddon-3.0"):GetAddon("GatheringTracker") local media = LibStub:GetLibrary("LibSharedMedia-3.0") @@ -140,7 +141,7 @@ function GT:NotificationHandler(mode, id, amount, value) if mode == "PLAYER_ENTERING_WORLD" then GT.Debug("Generate Notification Table", 1) - for i = 1, table.getn(GT.sender) do + for i = 1, #GT.sender do if GT.sender[1].name == GT.Player then local playerTotal = 0 for itemID, data in pairs(GT.InventoryData) do @@ -157,7 +158,7 @@ function GT:NotificationHandler(mode, id, amount, value) end end id = "all" - amount, value = GT:CalculateTotals(i, true) + amount, value = GT:CalculatePlayerTotals(i, true, GT.db.profile.General.sessionOnly) NotificationCheck("Count", true) NotificationCheck("Gold", true) end @@ -170,10 +171,10 @@ function GT:TriggerNotification(alertType) if not GT.NotificationPause then --GT.Debug("|cffff6f00" .. GT.metaData.name .. " v" .. GT.metaData.version .. "|r|cff00ff00 Notifications |r" .. alertType, 1) if media:IsValid("sound", GT.db.profile.Notifications[alertType].sound) then - PlaySoundFile(media:Fetch("sound", GT.db.profile.Notifications[alertType].sound), "master") + PlaySoundFile(tostring(media:Fetch("sound", GT.db.profile.Notifications[alertType].sound)), "master") else GT.Debug("Trigger Notifications: Play Default Sound", 1, alertType, GT.NotificationPause, GT.db.profile.Notifications[alertType].sound, GT.defaults.profile.Notifications[alertType].sound) - PlaySoundFile(media:Fetch("sound", GT.defaults.profile.Notifications[alertType].sound), "master") + PlaySoundFile(tostring(media:Fetch("sound", GT.defaults.profile.Notifications[alertType].sound)), "master") end end end diff --git a/Utilities.lua b/Utilities.lua index d2d0ac9..21c4329 100644 --- a/Utilities.lua +++ b/Utilities.lua @@ -1,3 +1,4 @@ +---@class GT local GT = LibStub("AceAddon-3.0"):GetAddon("GatheringTracker") -- Localize global functions @@ -209,7 +210,7 @@ function GT:CheckModeStatus() end function GT:GetUnitFullName(UnitId) - name, realm = UnitNameUnmodified(UnitId) + local name, realm = UnitNameUnmodified(UnitId) local fullName = name if realm then fullName = fullName .. "-" .. realm