diff --git a/Modules/MinimapTagger.lua b/Modules/MinimapTagger.lua index 7c5738a..5f84041 100644 --- a/Modules/MinimapTagger.lua +++ b/Modules/MinimapTagger.lua @@ -69,6 +69,7 @@ function shared.MinimapTagger.Init() frame:Show() end + --region Alert ---@type Frame[] local alertFramePool = {} local alertFramePoolMaxSize = 20 @@ -118,7 +119,9 @@ function shared.MinimapTagger.Init() end PlantFrame(x, y, frame, scale, Heimdall_Data.config.minimapTagger.alertTTL) end + --endregion + --region Tag ---@type Frame[] local tagFramePool = {} local tagFramePoolMaxSize = 20 @@ -168,7 +171,9 @@ function shared.MinimapTagger.Init() end PlantFrame(x, y, frame, scale, Heimdall_Data.config.minimapTagger.tagTTL) end + --endregion + --region Battle ---@type Frame[] local battleFramePool = {} local battleFramePoolMaxSize = 20 @@ -218,6 +223,59 @@ function shared.MinimapTagger.Init() end PlantFrame(x, y, frame, scale, Heimdall_Data.config.minimapTagger.combatTTL) end + --endregion + + --region Help + ---@type Frame[] + local helpFramePool = {} + local helpFramePoolMaxSize = 20 + for i = 1, helpFramePoolMaxSize do + local frame = CreateFrame("Frame") + frame.custom = { busy = false } + local texture = frame:CreateTexture(nil, "ARTWORK") + texture:SetAllPoints(frame) + texture:SetTexture(TextureRoot .. "Help.tga") + table.insert(helpFramePool, frame) + end + local muteHelpUntil = 0 + ---@param x number + ---@param y number + ---@param scale number? + local function PlantHelp(x, y, scale) + local frame = nil + for _, helpFrame in ipairs(helpFramePool) do + if not helpFrame.custom.busy then + frame = helpFrame + break + end + end + if not frame then + if Heimdall_Data.config.minimapTagger.debug then + print(string.format("[%s] Help frame pool is full and could not get frame", ModuleName)) + end + return + end + if Heimdall_Data.config.minimapTagger.helpSound then + if Heimdall_Data.config.minimapTagger.debug then + print(string.format("[%s] Playing help sound: %s", ModuleName, + Heimdall_Data.config.minimapTagger.helpSoundFile)) + end + if muteHelpUntil > GetTime() then + if Heimdall_Data.config.minimapTagger.debug then + print(string.format("[%s] Help sound is muted until %d", ModuleName, muteHelpUntil)) + end + else + muteHelpUntil = GetTime() + Heimdall_Data.config.minimapTagger.helpSoundThrottle + local ok = PlaySoundFile(SoundRoot .. Heimdall_Data.config.minimapTagger.helpSoundFile, "Master") + if not ok and Heimdall_Data.config.minimapTagger.debug then + print(string.format("[%s] Failed to play help sound: %s", ModuleName, + Heimdall_Data.config.minimapTagger.helpSoundFile)) + end + end + end + PlantFrame(x, y, frame, scale, Heimdall_Data.config.minimapTagger.helpTTL) + end + --endregion local pauseUntil = 0 local frame = CreateFrame("Frame") @@ -237,8 +295,7 @@ function shared.MinimapTagger.Init() end return end - --local scale = Heimdall_Data.config.minimapTagger.scale - local scale = 4 + local scale = Heimdall_Data.config.minimapTagger.scale BattlefieldMinimap:SetScale(scale) BattlefieldMinimap:SetMovable(true) BattlefieldMinimap:EnableMouse(true)