Implement call for help

This commit is contained in:
2025-01-09 16:38:57 +01:00
parent f66a990103
commit 6becc08e18

View File

@@ -5,6 +5,7 @@ local ModuleName = "MinimapTagger"
local HeimdallRoot = "Interface\\AddOns\\Heimdall\\"
local SoundRoot = HeimdallRoot .. "Sounds\\"
local TextureRoot = HeimdallRoot .. "Texture\\"
--/run local a=GetChannelName("Agent")local b,c=GetPlayerMapPosition("player")b,c=b*100,c*100;local d=string.format("I need help at %s (%s) [%s](%2.2f, %2.2f)",GetZoneText(),GetSubZoneText(),GetCurrentMapAreaID(),b,c)SendChatMessage(d,"CHANNEL",nil,a)
---@diagnostic disable-next-line: missing-fields
shared.MinimapTagger = {}
@@ -206,7 +207,7 @@ function shared.MinimapTagger.Init()
if Heimdall_Data.config.minimapTagger.combatSound then
if Heimdall_Data.config.minimapTagger.debug then
print(string.format("[%s] Playing combat sound: %s", ModuleName,
Heimdall_Data.config.minimapTagger.combatSoundFile))
Heimdall_Data.config.minimapTagger.combatSoundFile))
end
if muteBattleUntil > GetTime() then
if Heimdall_Data.config.minimapTagger.debug then
@@ -258,7 +259,7 @@ function shared.MinimapTagger.Init()
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))
Heimdall_Data.config.minimapTagger.helpSoundFile))
end
if muteHelpUntil > GetTime() then
if Heimdall_Data.config.minimapTagger.debug then
@@ -353,6 +354,7 @@ function shared.MinimapTagger.Init()
shared.dumpTable(Heimdall_Data.config.minimapTagger)
end
--region Tag
if string.find(msg, "^I see") then
if Heimdall_Data.config.minimapTagger.tagTTL == 0 then
if Heimdall_Data.config.minimapTagger.debug then
@@ -368,6 +370,8 @@ function shared.MinimapTagger.Init()
PlantTag(tonumber(x), tonumber(y), 2)
end
end
--endregion
--region Combat
if string.find(msg, "^I am in combat with") then
if Heimdall_Data.config.minimapTagger.combatTTL == 0 then
if Heimdall_Data.config.minimapTagger.debug then
@@ -386,6 +390,8 @@ function shared.MinimapTagger.Init()
PlantBattle(tonumber(x), tonumber(y), 2)
end
end
--endregion
--region Death
if string.find(msg, " killed ") then
if Heimdall_Data.config.minimapTagger.alertTTL == 0 then
if Heimdall_Data.config.minimapTagger.debug then
@@ -404,6 +410,27 @@ function shared.MinimapTagger.Init()
PlantAlert(tonumber(x), tonumber(y), 2)
end
end
--endregion
--region Help
if string.find(msg, "I need help") then
if Heimdall_Data.config.minimapTagger.helpTTL == 0 then
if Heimdall_Data.config.minimapTagger.debug then
print(string.format("[%s] Help TTL is 0, ignoring message: %s", ModuleName, msg))
end
return
end
if Heimdall_Data.config.minimapTagger.debug then
print(string.format("[%s] Found help alert in message: %s", ModuleName, msg))
end
local x, y = string.match(msg, "%((%d+%.%d+)%s*,%s*(%d+%.%d+)%)")
if Heimdall_Data.config.minimapTagger.debug then
print(string.format("[%s] Found help position: %s, %s", ModuleName, tostring(x), tostring(y)))
end
if x and y then
PlantHelp(tonumber(x), tonumber(y), 2)
end
end
--endregion
end)
print("[Heimdall] MinimapTagger loaded")