Don't tag minimap if we aren't in the same zone

This commit is contained in:
2025-01-13 16:25:07 +01:00
parent 8fa4effb6b
commit cf61a74fa8
3 changed files with 44 additions and 15 deletions

View File

@@ -1,6 +1,6 @@
## Interface: 70300
## Title: Heimdall
## Version: 3.4.3
## Version: 3.4.4
## Notes: Watches over areas and alerts when hostiles spotted
## Author: Cyka
## SavedVariables: Heimdall_Data

BIN
Heimdall.zip (Stored with Git LFS)

Binary file not shown.

View File

@@ -92,7 +92,9 @@ function shared.MinimapTagger.Init()
---@param x number
---@param y number
---@param scale number?
local function PlantAlert(x, y, scale)
---@param doTag boolean?
local function PlantAlert(x, y, scale, doTag)
if doTag == nil then doTag = true end
local frame = nil
for _, alertFrame in ipairs(alertFramePool) do
if not alertFrame.custom.busy then
@@ -124,7 +126,9 @@ function shared.MinimapTagger.Init()
end
end
end
PlantFrame(x, y, frame, scale, Heimdall_Data.config.minimapTagger.alertTTL)
if doTag then
PlantFrame(x, y, frame, scale, Heimdall_Data.config.minimapTagger.alertTTL)
end
end
--endregion
@@ -144,7 +148,9 @@ function shared.MinimapTagger.Init()
---@param x number
---@param y number
---@param scale number?
local function PlantTag(x, y, scale)
---@param doTag boolean?
local function PlantTag(x, y, scale, doTag)
if doTag == nil then doTag = true end
local frame = nil
for _, tagFrame in ipairs(tagFramePool) do
if not tagFrame.custom.busy then
@@ -176,7 +182,9 @@ function shared.MinimapTagger.Init()
end
end
end
PlantFrame(x, y, frame, scale, Heimdall_Data.config.minimapTagger.tagTTL)
if doTag then
PlantFrame(x, y, frame, scale, Heimdall_Data.config.minimapTagger.tagTTL)
end
end
--endregion
@@ -196,7 +204,9 @@ function shared.MinimapTagger.Init()
---@param x number
---@param y number
---@param scale number?
local function PlantCombat(x, y, scale)
---@param doTag boolean?
local function PlantCombat(x, y, scale, doTag)
if doTag == nil then doTag = true end
local frame = nil
for _, combatFrame in ipairs(combatFramePool) do
if not combatFrame.custom.busy then
@@ -228,7 +238,9 @@ function shared.MinimapTagger.Init()
end
end
end
PlantFrame(x, y, frame, scale, Heimdall_Data.config.minimapTagger.combatTTL)
if doTag then
PlantFrame(x, y, frame, scale, Heimdall_Data.config.minimapTagger.combatTTL)
end
end
--endregion
@@ -248,7 +260,9 @@ function shared.MinimapTagger.Init()
---@param x number
---@param y number
---@param scale number?
local function PlantHelp(x, y, scale)
---@param doTag boolean?
local function PlantHelp(x, y, scale, doTag)
if doTag == nil then doTag = true end
local frame = nil
for _, helpFrame in ipairs(helpFramePool) do
if not helpFrame.custom.busy then
@@ -280,7 +294,9 @@ function shared.MinimapTagger.Init()
end
end
end
PlantFrame(x, y, frame, scale, Heimdall_Data.config.minimapTagger.helpTTL)
if doTag then
PlantFrame(x, y, frame, scale, Heimdall_Data.config.minimapTagger.helpTTL)
end
end
--endregion
@@ -360,6 +376,19 @@ function shared.MinimapTagger.Init()
shared.dumpTable(Heimdall_Data.config.minimapTagger)
end
local doTag = true
local messageMapId = string.match(msg, "%[(%d+)%]") or 0
if messageMapId then messageMapId = tonumber(messageMapId) end
local currentMapId = GetCurrentMapAreaID()
if currentMapId ~= messageMapId then
if Heimdall_Data.config.minimapTagger.debug then
print(string.format("[%s] Current map ID (%d) does not match message map ID (%d), ignoring message",
ModuleName, currentMapId, messageMapId))
end
doTag = false
end
--region Tag
if string.find(msg, "^I see") then
if Heimdall_Data.config.minimapTagger.tagTTL == 0 then
@@ -373,7 +402,7 @@ function shared.MinimapTagger.Init()
print(string.format("[%s] Found alert position: %s, %s", ModuleName, tostring(x), tostring(y)))
end
if x and y then
PlantTag(tonumber(x), tonumber(y), 2)
PlantTag(tonumber(x), tonumber(y), 2, doTag)
end
end
--endregion
@@ -393,7 +422,7 @@ function shared.MinimapTagger.Init()
print(string.format("[%s] Found combat position: %s, %s", ModuleName, tostring(x), tostring(y)))
end
if x and y then
PlantCombat(tonumber(x), tonumber(y), 2)
PlantCombat(tonumber(x), tonumber(y), 2, doTag)
end
end
--endregion
@@ -413,7 +442,7 @@ function shared.MinimapTagger.Init()
print(string.format("[%s] Found death position: %s, %s", ModuleName, tostring(x), tostring(y)))
end
if x and y then
PlantAlert(tonumber(x), tonumber(y), 2)
PlantAlert(tonumber(x), tonumber(y), 2, doTag)
end
end
--endregion
@@ -434,7 +463,7 @@ function shared.MinimapTagger.Init()
end
if x and y then
x, y = tonumber(x), tonumber(y)
PlantHelp(x, y, 1)
PlantHelp(x, y, 1, doTag)
if TomTom then
if Heimdall_Data.config.minimapTagger.debug then
print(string.format("[%s] Adding help waypoint to TomTom", ModuleName))