20 Commits

Author SHA1 Message Date
69d7efe6f0 Release 3.11.0 2025-05-05 01:16:31 +02:00
202c5d0f46 Update release script to automatically tag releases
Maybe it's a bit better who knows...........
2025-05-05 01:16:21 +02:00
476e907205 Release 3.10.4 2025-05-05 01:15:55 +02:00
724194abe2 Fix up the release to be a little more manual 2025-05-05 01:02:59 +02:00
d57b573683 Update
Some checks failed
Release Workflow / release (push) Failing after 18s
2025-05-05 00:58:16 +02:00
5d8afe8db7 Add the FUCKING REMOVED _
Some checks failed
Release Workflow / release (push) Failing after 18s
2025-05-05 00:30:58 +02:00
b14f1ff2f9 Update
Some checks failed
Release Workflow / release (push) Failing after 18s
2025-05-05 00:02:47 +02:00
a1301abdb2 Update 2025-05-05 00:02:38 +02:00
f897183920 Update 2025-05-04 23:56:58 +02:00
c1885ce76a Fix up config to comply with meta
Update
2025-05-04 23:39:35 +02:00
e676d53e97 Update meta 2025-05-04 23:23:48 +02:00
f05156b257 Update 2025-05-04 21:38:03 +02:00
c8f9d81b3e Remove meaningless vscode settings 2025-05-04 21:37:57 +02:00
3a1639ab27 Clean up the modules a little 2025-05-04 20:47:00 +02:00
1da1e7bf9f Code format
Some checks failed
Release Workflow / release (push) Failing after 23s
2025-05-04 15:09:47 +02:00
304fbcbaae Update meta
Some checks failed
Release Workflow / release (push) Failing after 20s
Update meta
2025-05-04 15:07:42 +02:00
80f8500f6e Add luacheckrcAdd debug logs
Some checks failed
Release Workflow / release (push) Failing after 18s
2025-04-30 20:18:15 +02:00
78cbcbde9d Add luacheckrc 2025-04-30 20:13:10 +02:00
Git Admin
8db1cb179c Release 3.10.1 2025-01-29 20:31:06 +00:00
a065e47545 Automagically tag shit
All checks were successful
Release Workflow / release (push) Successful in 7s
2025-01-29 21:30:56 +01:00
37 changed files with 4917 additions and 4479 deletions

View File

@@ -1,61 +0,0 @@
name: Release Workflow
on: [push]
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install zip
run: sudo apt-get install zip
- name: Run deploy script
run: bash deploy.sh
- name: Determine Tag
id: determine_tag
run: |
# Check if the last commit has a tag
TAG=$(git describe --tags --exact-match 2>/dev/null || echo "")
if [ -z "$TAG" ]; then
# Get the latest tag
LATEST_TAG=$(git describe --tags `git rev-list --tags --max-count=1`)
# Increment the minor version
IFS='.' read -r -a VERSION_PARTS <<< "$LATEST_TAG"
VERSION_PARTS[2]=$((VERSION_PARTS[2]+1))
TAG="${VERSION_PARTS[0]}.${VERSION_PARTS[1]}.${VERSION_PARTS[2]}"
# Create a new tag
git tag $TAG
git push origin $TAG
fi
echo "::set-output name=tag::$TAG"
- name: Create Release
id: create_release
run: |
curl -X POST \
-H "Authorization: token ${{ secrets.JEBENI_TOKEN }}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"tag_name": "${{ steps.determine_tag.outputs.tag }}",
"name": "${{ steps.determine_tag.outputs.tag }}",
"draft": false,
"prerelease": false
}' \
http://srv-captain--git:3000/api/v1/repos/dave/wow-Heimdall/releases
- name: Upload Release Asset
run: |
RELEASE_ID=$(curl -s \
-H "Authorization: token ${{ secrets.JEBENI_TOKEN }}" \
http://srv-captain--git:3000/api/v1/repos/dave/wow-Heimdall/releases/tags/${{ steps.determine_tag.outputs.tag }} | jq -r '.id')
curl -X POST \
-H "Authorization: token ${{ secrets.JEBENI_TOKEN }}" \
-H "Content-Type: application/zip" \
--data-binary @Heimdall.zip \
http://srv-captain--git:3000/api/v1/repos/dave/wow-Heimdall/releases/${RELEASE_ID}/assets

1
.luacheckrc Symbolic link
View File

@@ -0,0 +1 @@
C:/Users/Administrator/Seafile/Games-WoW/Ruski/Interface/AddOns/Heimdall/Meta/.luacheckrc

1
.luarc.json Symbolic link
View File

@@ -0,0 +1 @@
C:/Users/Administrator/Seafile/Games-WoW/Ruski/Interface/AddOns/Heimdall/Meta/.luarc.json

View File

@@ -1,6 +0,0 @@
{
"Lua.diagnostics.globals": [
"UIParent",
"BattlefieldMinimap"
]
}

File diff suppressed because it is too large Load Diff

View File

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

2
Meta

Submodule Meta updated: c0337ef97f...6ab88bd8dc

View File

@@ -1,10 +1,9 @@
local addonname, shared = ... local _, shared = ...
---@cast shared HeimdallShared ---@cast shared HeimdallShared
---@cast addonname string
local ModuleName = "AchievementSniffer" local ModuleName = "AchievementSniffer"
local HeimdallRoot = "Interface\\AddOns\\Heimdall\\" -- local HeimdallRoot = "Interface\\AddOns\\Heimdall\\"
local TextureRoot = HeimdallRoot .. "Texture\\" -- local TextureRoot = HeimdallRoot .. "Texture\\"
local Achievements = { local Achievements = {
15, 15,
@@ -248,9 +247,7 @@ function shared.AchievementSniffer.Init()
if Heimdall_Data.config.achievementSniffer.debug then if Heimdall_Data.config.achievementSniffer.debug then
print(string.format("[%s] Event triggered: %s for unit: %s", ModuleName, event, unit)) print(string.format("[%s] Event triggered: %s for unit: %s", ModuleName, event, unit))
end end
if event == "NAME_PLATE_UNIT_ADDED" then if event == "NAME_PLATE_UNIT_ADDED" then TryInspect(unit) end
TryInspect(unit)
end
--UpdateFrames() --UpdateFrames()
end) end)
@@ -271,7 +268,6 @@ function shared.AchievementSniffer.Init()
Scan(name) Scan(name)
end) end)
local function Tick() local function Tick()
C_Timer.NewTimer(Heimdall_Data.config.achievementSniffer.scanInterval, Tick) C_Timer.NewTimer(Heimdall_Data.config.achievementSniffer.scanInterval, Tick)
if not Heimdall_Data.config.achievementSniffer.enabled then return end if not Heimdall_Data.config.achievementSniffer.enabled then return end

View File

@@ -1,6 +1,5 @@
local addonname, shared = ... local _, shared = ...
---@cast shared HeimdallShared ---@cast shared HeimdallShared
---@cast addonname string
local ModuleName = "AgentTracker" local ModuleName = "AgentTracker"
---@diagnostic disable-next-line: missing-fields ---@diagnostic disable-next-line: missing-fields
@@ -37,16 +36,20 @@ function shared.AgentTracker.Init()
local newAgents = 0 local newAgents = 0
for i = 1, count do for i = 1, count do
local name = GetChannelRosterInfo(index, i) name = GetChannelRosterInfo(index, i)
if name then if name then
local isNewAgent = not Heimdall_Data.config.agents[name] local isNewAgent = not Heimdall_Data.config.agents[name]
Heimdall_Data.config.agents[name] = date("%Y-%m-%dT%H:%M:%S") Heimdall_Data.config.agents[name] = date("%Y-%m-%dT%H:%M:%S")
if isNewAgent then if isNewAgent then newAgents = newAgents + 1 end
newAgents = newAgents + 1
end
if Heimdall_Data.config.agentTracker.debug then if Heimdall_Data.config.agentTracker.debug then
print(string.format("[%s] %s agent: %s", ModuleName, isNewAgent and "Added new" or "Updated existing", print(
name)) string.format(
"[%s] %s agent: %s",
ModuleName,
isNewAgent and "Added new" or "Updated existing",
name
)
)
end end
end end
end end
@@ -89,20 +92,27 @@ function shared.AgentTracker.Init()
shared.dumpTable(Heimdall_Data.config.agentTracker) shared.dumpTable(Heimdall_Data.config.agentTracker)
end end
sender = string.match(sender, "^[^-]+") sender = string.match(sender, "^[^-]+")
local isNewAgent = not Heimdall_Data.config.agents[sender] local isNewAgent = not Heimdall_Data.config.agents[sender]
Heimdall_Data.config.agents[sender] = date("%Y-%m-%dT%H:%M:%S") Heimdall_Data.config.agents[sender] = date("%Y-%m-%dT%H:%M:%S")
if Heimdall_Data.config.agentTracker.debug then if Heimdall_Data.config.agentTracker.debug then
print(string.format("[%s] %s agent from message: %s", ModuleName, print(
isNewAgent and "Added new" or "Updated existing", sender)) string.format(
"[%s] %s agent from message: %s",
ModuleName,
isNewAgent and "Added new" or "Updated existing",
sender
)
)
end end
end) end)
if Heimdall_Data.config.agentTracker.debug then if Heimdall_Data.config.agentTracker.debug then
local count = 0 local count = 0
for _ in pairs(Heimdall_Data.config.agents) do count = count + 1 end for _ in pairs(Heimdall_Data.config.agents) do
count = count + 1
end
print(string.format("[%s] Module initialized - Tracking %d agents", ModuleName, count)) print(string.format("[%s] Module initialized - Tracking %d agents", ModuleName, count))
end end
print("[Heimdall] AgentTracker loaded") print("[Heimdall] AgentTracker loaded")

View File

@@ -1,6 +1,5 @@
local addonname, shared = ... local _, shared = ...
---@cast shared HeimdallShared ---@cast shared HeimdallShared
---@cast addonname string
local ModuleName = "BonkDetector" local ModuleName = "BonkDetector"
---@diagnostic disable-next-line: missing-fields ---@diagnostic disable-next-line: missing-fields
@@ -30,14 +29,23 @@ function shared.BonkDetector.Init()
return return
end end
local source, err = CLEUParser.GetSourceName(...) ---@type string|nil, string, string, string, string
local err, source, sourceGUID, destination, destinationGUID
source, err = CLEUParser.GetSourceName(...)
if err then if err then
if Heimdall_Data.config.bonkDetector.debug then if Heimdall_Data.config.bonkDetector.debug then
print(string.format("[%s] Error getting source name: %s", ModuleName, err)) print(string.format("[%s] Error getting source name: %s", ModuleName, err))
end end
return return
end end
local sourceGUID = CLEUParser.GetSourceGUID(...) sourceGUID, err = CLEUParser.GetSourceGUID(...)
if err then
if Heimdall_Data.config.bonkDetector.debug then
print(string.format("[%s] Error getting source GUID: %s", ModuleName, err))
end
return
end
if not string.find(sourceGUID, "Player") then if not string.find(sourceGUID, "Player") then
if Heimdall_Data.config.bonkDetector.debug then if Heimdall_Data.config.bonkDetector.debug then
print(string.format("[%s] Source %s is not a player, nothing to do", ModuleName, source)) print(string.format("[%s] Source %s is not a player, nothing to do", ModuleName, source))
@@ -45,14 +53,20 @@ function shared.BonkDetector.Init()
return return
end end
local destination, err = CLEUParser.GetDestName(...) destination, err = CLEUParser.GetDestName(...)
if err then if err then
if Heimdall_Data.config.bonkDetector.debug then if Heimdall_Data.config.bonkDetector.debug then
print(string.format("[%s] Error getting destination name: %s", ModuleName, err)) print(string.format("[%s] Error getting destination name: %s", ModuleName, err))
end end
return return
end end
local destinationGUID = CLEUParser.GetDestGUID(...) destinationGUID, err = CLEUParser.GetDestGUID(...)
if err then
if Heimdall_Data.config.bonkDetector.debug then
print(string.format("[%s] Error getting destination GUID: %s", ModuleName, err))
end
return
end
if not string.find(destinationGUID, "Player") then if not string.find(destinationGUID, "Player") then
if Heimdall_Data.config.bonkDetector.debug then if Heimdall_Data.config.bonkDetector.debug then
print(string.format("[%s] Destination %s is not a player, nothing to do", ModuleName, destination)) print(string.format("[%s] Destination %s is not a player, nothing to do", ModuleName, destination))
@@ -73,8 +87,14 @@ function shared.BonkDetector.Init()
if lastReportTime[source] and (currentTime - lastReportTime[source]) < throttle then if lastReportTime[source] and (currentTime - lastReportTime[source]) < throttle then
if Heimdall_Data.config.bonkDetector.debug then if Heimdall_Data.config.bonkDetector.debug then
local timeLeft = throttle - (currentTime - lastReportTime[source]) local timeLeft = throttle - (currentTime - lastReportTime[source])
print(string.format("[%s] Damage report throttled for %s (%.1f seconds remaining)", print(
ModuleName, source, timeLeft)) string.format(
"[%s] Damage report throttled for %s (%.1f seconds remaining)",
ModuleName,
source,
timeLeft
)
)
end end
return return
end end
@@ -82,8 +102,15 @@ function shared.BonkDetector.Init()
lastReportTime[source] = currentTime lastReportTime[source] = currentTime
if Heimdall_Data.config.bonkDetector.debug then if Heimdall_Data.config.bonkDetector.debug then
print(string.format("[%s] Processing damage event - Source: %s, Target: %s, Type: %s", print(
ModuleName, source, destination, subevent)) string.format(
"[%s] Processing damage event - Source: %s, Target: %s, Type: %s",
ModuleName,
source,
destination,
subevent
)
)
end end
for _, channel in pairs(Heimdall_Data.config.bonkDetector.channels) do for _, channel in pairs(Heimdall_Data.config.bonkDetector.channels) do

View File

@@ -1,13 +1,10 @@
local addonname, shared = ... local _, shared = ...
---@cast shared HeimdallShared ---@cast shared HeimdallShared
---@cast addonname string
local ModuleName = "Bully" local ModuleName = "Bully"
---@diagnostic disable-next-line: missing-fields ---@diagnostic disable-next-line: missing-fields
shared.Bully = {} shared.Bully = {}
function shared.Bully.Init() function shared.Bully.Init()
if Heimdall_Data.config.bully.debug then if Heimdall_Data.config.bully.debug then print(string.format("[%s] Module initialized", ModuleName)) end
print(string.format("[%s] Module initialized", ModuleName))
end
print("[Heimdall] Bully loaded") print("[Heimdall] Bully loaded")
end end

View File

@@ -12,12 +12,12 @@ local function Init()
["destGUID"] = 8, ["destGUID"] = 8,
["destName"] = 9, ["destName"] = 9,
["destFlags"] = 10, ["destFlags"] = 10,
["destRaidFlags"] = 11 ["destRaidFlags"] = 11,
}, },
["GENERIC_SPELL"] = { ["GENERIC_SPELL"] = {
["spellId"] = 12, ["spellId"] = 12,
["spellName"] = 13, ["spellName"] = 13,
["spellSchool"] = 14 ["spellSchool"] = 14,
}, },
["GENERIC_DAMAGE"] = { ["GENERIC_DAMAGE"] = {
["amount"] = 15, ["amount"] = 15,
@@ -29,19 +29,19 @@ local function Init()
["critical"] = 21, ["critical"] = 21,
["glancing"] = 22, ["glancing"] = 22,
["crushing"] = 23, ["crushing"] = 23,
["isOffHand"] = 24 ["isOffHand"] = 24,
}, },
["GENERIC_MISSED"] = { ["GENERIC_MISSED"] = {
["missType"] = 15, ["missType"] = 15,
["isOffHand"] = 16, ["isOffHand"] = 16,
["amountMissed"] = 17, ["amountMissed"] = 17,
["critical"] = 18 ["critical"] = 18,
}, },
["GENERIC_HEAL"] = { ["GENERIC_HEAL"] = {
["amount"] = 15, ["amount"] = 15,
["overhealing"] = 16, ["overhealing"] = 16,
["absorbed"] = 17, ["absorbed"] = 17,
["critical"] = 18 ["critical"] = 18,
}, },
["GENERIC_HEAL_ABSORBED"] = { ["GENERIC_HEAL_ABSORBED"] = {
["extraGUID"] = 15, ["extraGUID"] = 15,
@@ -52,44 +52,44 @@ local function Init()
["extraSpellName"] = 20, ["extraSpellName"] = 20,
["extraSchool"] = 21, ["extraSchool"] = 21,
["absorbedAmount"] = 22, ["absorbedAmount"] = 22,
["totalAmount"] = 23 ["totalAmount"] = 23,
}, },
["GENERIC_ENERGIZE"] = { ["GENERIC_ENERGIZE"] = {
["amount"] = 15, ["amount"] = 15,
["overEnergize"] = 16, ["overEnergize"] = 16,
["powerType"] = 17 ["powerType"] = 17,
}, },
["GENERIC_DRAIN"] = { ["GENERIC_DRAIN"] = {
["amount"] = 15, ["amount"] = 15,
["powerType"] = 16, ["powerType"] = 16,
["extraAmount"] = 17 ["extraAmount"] = 17,
}, },
["GENERIC_LEECH"] = { ["GENERIC_LEECH"] = {
["amount"] = 15, ["amount"] = 15,
["powerType"] = 16, ["powerType"] = 16,
["extraAmount"] = 17 ["extraAmount"] = 17,
}, },
["GENERIC_INTERRUPT"] = { ["GENERIC_INTERRUPT"] = {
["extraSpellId"] = 15, ["extraSpellId"] = 15,
["extraSpellName"] = 16, ["extraSpellName"] = 16,
["extraSchool"] = 17 ["extraSchool"] = 17,
}, },
["GENERIC_DISPEL"] = { ["GENERIC_DISPEL"] = {
["extraSpellId"] = 15, ["extraSpellId"] = 15,
["extraSpellName"] = 16, ["extraSpellName"] = 16,
["extraSchool"] = 17, ["extraSchool"] = 17,
["auraType"] = 18 ["auraType"] = 18,
}, },
["GENERIC_DISPEL_FAILED"] = { ["GENERIC_DISPEL_FAILED"] = {
["extraSpellId"] = 15, ["extraSpellId"] = 15,
["extraSpellName"] = 16, ["extraSpellName"] = 16,
["extraSchool"] = 17 ["extraSchool"] = 17,
}, },
["GENERIC_STOLEN"] = { ["GENERIC_STOLEN"] = {
["extraSpellId"] = 15, ["extraSpellId"] = 15,
["extraSpellName"] = 16, ["extraSpellName"] = 16,
["extraSchool"] = 17, ["extraSchool"] = 17,
["auraType"] = 18 ["auraType"] = 18,
}, },
["GENERIC_EXTRA_ATTACKS"] = { ["amount"] = 15 }, ["GENERIC_EXTRA_ATTACKS"] = { ["amount"] = 15 },
["GENERIC_AURA_APPLIED"] = { ["auraType"] = 15, ["amount"] = 16 }, ["GENERIC_AURA_APPLIED"] = { ["auraType"] = 15, ["amount"] = 16 },
@@ -102,38 +102,32 @@ local function Init()
["extraSpellId"] = 15, ["extraSpellId"] = 15,
["extraSpellName"] = 16, ["extraSpellName"] = 16,
["extraSchool"] = 17, ["extraSchool"] = 17,
["auraType"] = 18 ["auraType"] = 18,
}, },
["GENERIC_CAST_START"] = {}, ["GENERIC_CAST_START"] = {},
["GENERIC_CAST_SUCCESS"] = {}, ["GENERIC_CAST_SUCCESS"] = {},
["GENERIC_CAST_FAILED"] = {} ["GENERIC_CAST_FAILED"] = {},
} }
CLEUEventInfo["SWING_DAMAGE"] = CLEUEventInfo["GENERIC_DAMAGE"] CLEUEventInfo["SWING_DAMAGE"] = CLEUEventInfo["GENERIC_DAMAGE"]
CLEUEventInfo["SWING_MISSED"] = CLEUEventInfo["GENERIC_MISSED"] CLEUEventInfo["SWING_MISSED"] = CLEUEventInfo["GENERIC_MISSED"]
CLEUEventInfo["SWING_HEAL"] = CLEUEventInfo["GENERIC_HEAL"] CLEUEventInfo["SWING_HEAL"] = CLEUEventInfo["GENERIC_HEAL"]
CLEUEventInfo["SWING_HEAL_ABSORBED"] = CLEUEventInfo["SWING_HEAL_ABSORBED"] = CLEUEventInfo["GENERIC_HEAL_ABSORBED"]
CLEUEventInfo["GENERIC_HEAL_ABSORBED"]
CLEUEventInfo["SWING_ENERGIZE"] = CLEUEventInfo["GENERIC_ENERGIZE"] CLEUEventInfo["SWING_ENERGIZE"] = CLEUEventInfo["GENERIC_ENERGIZE"]
CLEUEventInfo["SWING_DRAIN"] = CLEUEventInfo["GENERIC_DRAIN"] CLEUEventInfo["SWING_DRAIN"] = CLEUEventInfo["GENERIC_DRAIN"]
CLEUEventInfo["SWING_LEECH"] = CLEUEventInfo["GENERIC_LEECH"] CLEUEventInfo["SWING_LEECH"] = CLEUEventInfo["GENERIC_LEECH"]
CLEUEventInfo["SWING_INTERRUPT"] = CLEUEventInfo["GENERIC_INTERRUPT"] CLEUEventInfo["SWING_INTERRUPT"] = CLEUEventInfo["GENERIC_INTERRUPT"]
CLEUEventInfo["SWING_DISPEL"] = CLEUEventInfo["GENERIC_DISPEL"] CLEUEventInfo["SWING_DISPEL"] = CLEUEventInfo["GENERIC_DISPEL"]
CLEUEventInfo["SWING_DISPEL_FAILED"] = CLEUEventInfo["SWING_DISPEL_FAILED"] = CLEUEventInfo["GENERIC_DISPEL_FAILED"]
CLEUEventInfo["GENERIC_DISPEL_FAILED"]
CLEUEventInfo["SWING_STOLEN"] = CLEUEventInfo["GENERIC_STOLEN"] CLEUEventInfo["SWING_STOLEN"] = CLEUEventInfo["GENERIC_STOLEN"]
CLEUEventInfo["SWING_EXTRA_ATTACKS"] = CLEUEventInfo["SWING_EXTRA_ATTACKS"] = CLEUEventInfo["GENERIC_EXTRA_ATTACKS"]
CLEUEventInfo["GENERIC_EXTRA_ATTACKS"]
CLEUEventInfo["SWING_AURA_APPLIED"] = CLEUEventInfo["GENERIC_AURA_APPLIED"] CLEUEventInfo["SWING_AURA_APPLIED"] = CLEUEventInfo["GENERIC_AURA_APPLIED"]
CLEUEventInfo["SWING_AURA_REMOVED"] = CLEUEventInfo["GENERIC_AURA_REMOVED"] CLEUEventInfo["SWING_AURA_REMOVED"] = CLEUEventInfo["GENERIC_AURA_REMOVED"]
CLEUEventInfo["SWING_AURA_APPLIED_DOSE"] = CLEUEventInfo["SWING_AURA_APPLIED_DOSE"] = CLEUEventInfo["GENERIC_AURA_APPLIED_DOSE"]
CLEUEventInfo["GENERIC_AURA_APPLIED_DOSE"] CLEUEventInfo["SWING_AURA_REMOVED_DOSE"] = CLEUEventInfo["GENERIC_AURA_REMOVED_DOSE"]
CLEUEventInfo["SWING_AURA_REMOVED_DOSE"] =
CLEUEventInfo["GENERIC_AURA_REMOVED_DOSE"]
CLEUEventInfo["SWING_AURA_REFRESH"] = CLEUEventInfo["GENERIC_AURA_REFRESH"] CLEUEventInfo["SWING_AURA_REFRESH"] = CLEUEventInfo["GENERIC_AURA_REFRESH"]
CLEUEventInfo["SWING_AURA_BROKEN"] = CLEUEventInfo["GENERIC_AURA_BROKEN"] CLEUEventInfo["SWING_AURA_BROKEN"] = CLEUEventInfo["GENERIC_AURA_BROKEN"]
CLEUEventInfo["SWING_AURA_BROKEN_SPELL"] = CLEUEventInfo["SWING_AURA_BROKEN_SPELL"] = CLEUEventInfo["GENERIC_AURA_BROKEN_SPELL"]
CLEUEventInfo["GENERIC_AURA_BROKEN_SPELL"]
CLEUEventInfo["SWING_CAST_START"] = CLEUEventInfo["GENERIC_CAST_START"] CLEUEventInfo["SWING_CAST_START"] = CLEUEventInfo["GENERIC_CAST_START"]
CLEUEventInfo["SWING_CAST_SUCCESS"] = CLEUEventInfo["GENERIC_CAST_SUCCESS"] CLEUEventInfo["SWING_CAST_SUCCESS"] = CLEUEventInfo["GENERIC_CAST_SUCCESS"]
CLEUEventInfo["SWING_CAST_FAILED"] = CLEUEventInfo["GENERIC_CAST_FAILED"] CLEUEventInfo["SWING_CAST_FAILED"] = CLEUEventInfo["GENERIC_CAST_FAILED"]
@@ -141,28 +135,22 @@ local function Init()
CLEUEventInfo["RANGE_DAMAGE"] = CLEUEventInfo["GENERIC_DAMAGE"] CLEUEventInfo["RANGE_DAMAGE"] = CLEUEventInfo["GENERIC_DAMAGE"]
CLEUEventInfo["RANGE_MISSED"] = CLEUEventInfo["GENERIC_MISSED"] CLEUEventInfo["RANGE_MISSED"] = CLEUEventInfo["GENERIC_MISSED"]
CLEUEventInfo["RANGE_HEAL"] = CLEUEventInfo["GENERIC_HEAL"] CLEUEventInfo["RANGE_HEAL"] = CLEUEventInfo["GENERIC_HEAL"]
CLEUEventInfo["RANGE_HEAL_ABSORBED"] = CLEUEventInfo["RANGE_HEAL_ABSORBED"] = CLEUEventInfo["GENERIC_HEAL_ABSORBED"]
CLEUEventInfo["GENERIC_HEAL_ABSORBED"]
CLEUEventInfo["RANGE_ENERGIZE"] = CLEUEventInfo["GENERIC_ENERGIZE"] CLEUEventInfo["RANGE_ENERGIZE"] = CLEUEventInfo["GENERIC_ENERGIZE"]
CLEUEventInfo["RANGE_DRAIN"] = CLEUEventInfo["GENERIC_DRAIN"] CLEUEventInfo["RANGE_DRAIN"] = CLEUEventInfo["GENERIC_DRAIN"]
CLEUEventInfo["RANGE_LEECH"] = CLEUEventInfo["GENERIC_LEECH"] CLEUEventInfo["RANGE_LEECH"] = CLEUEventInfo["GENERIC_LEECH"]
CLEUEventInfo["RANGE_INTERRUPT"] = CLEUEventInfo["GENERIC_INTERRUPT"] CLEUEventInfo["RANGE_INTERRUPT"] = CLEUEventInfo["GENERIC_INTERRUPT"]
CLEUEventInfo["RANGE_DISPEL"] = CLEUEventInfo["GENERIC_DISPEL"] CLEUEventInfo["RANGE_DISPEL"] = CLEUEventInfo["GENERIC_DISPEL"]
CLEUEventInfo["RANGE_DISPEL_FAILED"] = CLEUEventInfo["RANGE_DISPEL_FAILED"] = CLEUEventInfo["GENERIC_DISPEL_FAILED"]
CLEUEventInfo["GENERIC_DISPEL_FAILED"]
CLEUEventInfo["RANGE_STOLEN"] = CLEUEventInfo["GENERIC_STOLEN"] CLEUEventInfo["RANGE_STOLEN"] = CLEUEventInfo["GENERIC_STOLEN"]
CLEUEventInfo["RANGE_EXTRA_ATTACKS"] = CLEUEventInfo["RANGE_EXTRA_ATTACKS"] = CLEUEventInfo["GENERIC_EXTRA_ATTACKS"]
CLEUEventInfo["GENERIC_EXTRA_ATTACKS"]
CLEUEventInfo["RANGE_AURA_APPLIED"] = CLEUEventInfo["GENERIC_AURA_APPLIED"] CLEUEventInfo["RANGE_AURA_APPLIED"] = CLEUEventInfo["GENERIC_AURA_APPLIED"]
CLEUEventInfo["RANGE_AURA_REMOVED"] = CLEUEventInfo["GENERIC_AURA_REMOVED"] CLEUEventInfo["RANGE_AURA_REMOVED"] = CLEUEventInfo["GENERIC_AURA_REMOVED"]
CLEUEventInfo["RANGE_AURA_APPLIED_DOSE"] = CLEUEventInfo["RANGE_AURA_APPLIED_DOSE"] = CLEUEventInfo["GENERIC_AURA_APPLIED_DOSE"]
CLEUEventInfo["GENERIC_AURA_APPLIED_DOSE"] CLEUEventInfo["RANGE_AURA_REMOVED_DOSE"] = CLEUEventInfo["GENERIC_AURA_REMOVED_DOSE"]
CLEUEventInfo["RANGE_AURA_REMOVED_DOSE"] =
CLEUEventInfo["GENERIC_AURA_REMOVED_DOSE"]
CLEUEventInfo["RANGE_AURA_REFRESH"] = CLEUEventInfo["GENERIC_AURA_REFRESH"] CLEUEventInfo["RANGE_AURA_REFRESH"] = CLEUEventInfo["GENERIC_AURA_REFRESH"]
CLEUEventInfo["RANGE_AURA_BROKEN"] = CLEUEventInfo["GENERIC_AURA_BROKEN"] CLEUEventInfo["RANGE_AURA_BROKEN"] = CLEUEventInfo["GENERIC_AURA_BROKEN"]
CLEUEventInfo["RANGE_AURA_BROKEN_SPELL"] = CLEUEventInfo["RANGE_AURA_BROKEN_SPELL"] = CLEUEventInfo["GENERIC_AURA_BROKEN_SPELL"]
CLEUEventInfo["GENERIC_AURA_BROKEN_SPELL"]
CLEUEventInfo["RANGE_CAST_START"] = CLEUEventInfo["GENERIC_CAST_START"] CLEUEventInfo["RANGE_CAST_START"] = CLEUEventInfo["GENERIC_CAST_START"]
CLEUEventInfo["RANGE_CAST_SUCCESS"] = CLEUEventInfo["GENERIC_CAST_SUCCESS"] CLEUEventInfo["RANGE_CAST_SUCCESS"] = CLEUEventInfo["GENERIC_CAST_SUCCESS"]
CLEUEventInfo["RANGE_CAST_FAILED"] = CLEUEventInfo["GENERIC_CAST_FAILED"] CLEUEventInfo["RANGE_CAST_FAILED"] = CLEUEventInfo["GENERIC_CAST_FAILED"]
@@ -170,28 +158,22 @@ local function Init()
CLEUEventInfo["SPELL_DAMAGE"] = CLEUEventInfo["GENERIC_DAMAGE"] CLEUEventInfo["SPELL_DAMAGE"] = CLEUEventInfo["GENERIC_DAMAGE"]
CLEUEventInfo["SPELL_MISSED"] = CLEUEventInfo["GENERIC_MISSED"] CLEUEventInfo["SPELL_MISSED"] = CLEUEventInfo["GENERIC_MISSED"]
CLEUEventInfo["SPELL_HEAL"] = CLEUEventInfo["GENERIC_HEAL"] CLEUEventInfo["SPELL_HEAL"] = CLEUEventInfo["GENERIC_HEAL"]
CLEUEventInfo["SPELL_HEAL_ABSORBED"] = CLEUEventInfo["SPELL_HEAL_ABSORBED"] = CLEUEventInfo["GENERIC_HEAL_ABSORBED"]
CLEUEventInfo["GENERIC_HEAL_ABSORBED"]
CLEUEventInfo["SPELL_ENERGIZE"] = CLEUEventInfo["GENERIC_ENERGIZE"] CLEUEventInfo["SPELL_ENERGIZE"] = CLEUEventInfo["GENERIC_ENERGIZE"]
CLEUEventInfo["SPELL_DRAIN"] = CLEUEventInfo["GENERIC_DRAIN"] CLEUEventInfo["SPELL_DRAIN"] = CLEUEventInfo["GENERIC_DRAIN"]
CLEUEventInfo["SPELL_LEECH"] = CLEUEventInfo["GENERIC_LEECH"] CLEUEventInfo["SPELL_LEECH"] = CLEUEventInfo["GENERIC_LEECH"]
CLEUEventInfo["SPELL_INTERRUPT"] = CLEUEventInfo["GENERIC_INTERRUPT"] CLEUEventInfo["SPELL_INTERRUPT"] = CLEUEventInfo["GENERIC_INTERRUPT"]
CLEUEventInfo["SPELL_DISPEL"] = CLEUEventInfo["GENERIC_DISPEL"] CLEUEventInfo["SPELL_DISPEL"] = CLEUEventInfo["GENERIC_DISPEL"]
CLEUEventInfo["SPELL_DISPEL_FAILED"] = CLEUEventInfo["SPELL_DISPEL_FAILED"] = CLEUEventInfo["GENERIC_DISPEL_FAILED"]
CLEUEventInfo["GENERIC_DISPEL_FAILED"]
CLEUEventInfo["SPELL_STOLEN"] = CLEUEventInfo["GENERIC_STOLEN"] CLEUEventInfo["SPELL_STOLEN"] = CLEUEventInfo["GENERIC_STOLEN"]
CLEUEventInfo["SPELL_EXTRA_ATTACKS"] = CLEUEventInfo["SPELL_EXTRA_ATTACKS"] = CLEUEventInfo["GENERIC_EXTRA_ATTACKS"]
CLEUEventInfo["GENERIC_EXTRA_ATTACKS"]
CLEUEventInfo["SPELL_AURA_APPLIED"] = CLEUEventInfo["GENERIC_AURA_APPLIED"] CLEUEventInfo["SPELL_AURA_APPLIED"] = CLEUEventInfo["GENERIC_AURA_APPLIED"]
CLEUEventInfo["SPELL_AURA_REMOVED"] = CLEUEventInfo["GENERIC_AURA_REMOVED"] CLEUEventInfo["SPELL_AURA_REMOVED"] = CLEUEventInfo["GENERIC_AURA_REMOVED"]
CLEUEventInfo["SPELL_AURA_APPLIED_DOSE"] = CLEUEventInfo["SPELL_AURA_APPLIED_DOSE"] = CLEUEventInfo["GENERIC_AURA_APPLIED_DOSE"]
CLEUEventInfo["GENERIC_AURA_APPLIED_DOSE"] CLEUEventInfo["SPELL_AURA_REMOVED_DOSE"] = CLEUEventInfo["GENERIC_AURA_REMOVED_DOSE"]
CLEUEventInfo["SPELL_AURA_REMOVED_DOSE"] =
CLEUEventInfo["GENERIC_AURA_REMOVED_DOSE"]
CLEUEventInfo["SPELL_AURA_REFRESH"] = CLEUEventInfo["GENERIC_AURA_REFRESH"] CLEUEventInfo["SPELL_AURA_REFRESH"] = CLEUEventInfo["GENERIC_AURA_REFRESH"]
CLEUEventInfo["SPELL_AURA_BROKEN"] = CLEUEventInfo["GENERIC_AURA_BROKEN"] CLEUEventInfo["SPELL_AURA_BROKEN"] = CLEUEventInfo["GENERIC_AURA_BROKEN"]
CLEUEventInfo["SPELL_AURA_BROKEN_SPELL"] = CLEUEventInfo["SPELL_AURA_BROKEN_SPELL"] = CLEUEventInfo["GENERIC_AURA_BROKEN_SPELL"]
CLEUEventInfo["GENERIC_AURA_BROKEN_SPELL"]
CLEUEventInfo["SPELL_CAST_START"] = CLEUEventInfo["GENERIC_CAST_START"] CLEUEventInfo["SPELL_CAST_START"] = CLEUEventInfo["GENERIC_CAST_START"]
CLEUEventInfo["SPELL_CAST_SUCCESS"] = CLEUEventInfo["GENERIC_CAST_SUCCESS"] CLEUEventInfo["SPELL_CAST_SUCCESS"] = CLEUEventInfo["GENERIC_CAST_SUCCESS"]
CLEUEventInfo["SPELL_CAST_FAILED"] = CLEUEventInfo["GENERIC_CAST_FAILED"] CLEUEventInfo["SPELL_CAST_FAILED"] = CLEUEventInfo["GENERIC_CAST_FAILED"]
@@ -199,39 +181,25 @@ local function Init()
CLEUEventInfo["SPELL_PERIODIC_DAMAGE"] = CLEUEventInfo["GENERIC_DAMAGE"] CLEUEventInfo["SPELL_PERIODIC_DAMAGE"] = CLEUEventInfo["GENERIC_DAMAGE"]
CLEUEventInfo["SPELL_PERIODIC_MISSED"] = CLEUEventInfo["GENERIC_MISSED"] CLEUEventInfo["SPELL_PERIODIC_MISSED"] = CLEUEventInfo["GENERIC_MISSED"]
CLEUEventInfo["SPELL_PERIODIC_HEAL"] = CLEUEventInfo["GENERIC_HEAL"] CLEUEventInfo["SPELL_PERIODIC_HEAL"] = CLEUEventInfo["GENERIC_HEAL"]
CLEUEventInfo["SPELL_PERIODIC_HEAL_ABSORBED"] = CLEUEventInfo["SPELL_PERIODIC_HEAL_ABSORBED"] = CLEUEventInfo["GENERIC_HEAL_ABSORBED"]
CLEUEventInfo["GENERIC_HEAL_ABSORBED"]
CLEUEventInfo["SPELL_PERIODIC_ENERGIZE"] = CLEUEventInfo["GENERIC_ENERGIZE"] CLEUEventInfo["SPELL_PERIODIC_ENERGIZE"] = CLEUEventInfo["GENERIC_ENERGIZE"]
CLEUEventInfo["SPELL_PERIODIC_DRAIN"] = CLEUEventInfo["GENERIC_DRAIN"] CLEUEventInfo["SPELL_PERIODIC_DRAIN"] = CLEUEventInfo["GENERIC_DRAIN"]
CLEUEventInfo["SPELL_PERIODIC_LEECH"] = CLEUEventInfo["GENERIC_LEECH"] CLEUEventInfo["SPELL_PERIODIC_LEECH"] = CLEUEventInfo["GENERIC_LEECH"]
CLEUEventInfo["SPELL_PERIODIC_INTERRUPT"] = CLEUEventInfo["SPELL_PERIODIC_INTERRUPT"] = CLEUEventInfo["GENERIC_INTERRUPT"]
CLEUEventInfo["GENERIC_INTERRUPT"]
CLEUEventInfo["SPELL_PERIODIC_DISPEL"] = CLEUEventInfo["GENERIC_DISPEL"] CLEUEventInfo["SPELL_PERIODIC_DISPEL"] = CLEUEventInfo["GENERIC_DISPEL"]
CLEUEventInfo["SPELL_PERIODIC_DISPEL_FAILED"] = CLEUEventInfo["SPELL_PERIODIC_DISPEL_FAILED"] = CLEUEventInfo["GENERIC_DISPEL_FAILED"]
CLEUEventInfo["GENERIC_DISPEL_FAILED"]
CLEUEventInfo["SPELL_PERIODIC_STOLEN"] = CLEUEventInfo["GENERIC_STOLEN"] CLEUEventInfo["SPELL_PERIODIC_STOLEN"] = CLEUEventInfo["GENERIC_STOLEN"]
CLEUEventInfo["SPELL_PERIODIC_EXTRA_ATTACKS"] = CLEUEventInfo["SPELL_PERIODIC_EXTRA_ATTACKS"] = CLEUEventInfo["GENERIC_EXTRA_ATTACKS"]
CLEUEventInfo["GENERIC_EXTRA_ATTACKS"] CLEUEventInfo["SPELL_PERIODIC_AURA_APPLIED"] = CLEUEventInfo["GENERIC_AURA_APPLIED"]
CLEUEventInfo["SPELL_PERIODIC_AURA_APPLIED"] = CLEUEventInfo["SPELL_PERIODIC_AURA_REMOVED"] = CLEUEventInfo["GENERIC_AURA_REMOVED"]
CLEUEventInfo["GENERIC_AURA_APPLIED"] CLEUEventInfo["SPELL_PERIODIC_AURA_APPLIED_DOSE"] = CLEUEventInfo["GENERIC_AURA_APPLIED_DOSE"]
CLEUEventInfo["SPELL_PERIODIC_AURA_REMOVED"] = CLEUEventInfo["SPELL_PERIODIC_AURA_REMOVED_DOSE"] = CLEUEventInfo["GENERIC_AURA_REMOVED_DOSE"]
CLEUEventInfo["GENERIC_AURA_REMOVED"] CLEUEventInfo["SPELL_PERIODIC_AURA_REFRESH"] = CLEUEventInfo["GENERIC_AURA_REFRESH"]
CLEUEventInfo["SPELL_PERIODIC_AURA_APPLIED_DOSE"] = CLEUEventInfo["SPELL_PERIODIC_AURA_BROKEN"] = CLEUEventInfo["GENERIC_AURA_BROKEN"]
CLEUEventInfo["GENERIC_AURA_APPLIED_DOSE"] CLEUEventInfo["SPELL_PERIODIC_AURA_BROKEN_SPELL"] = CLEUEventInfo["GENERIC_AURA_BROKEN_SPELL"]
CLEUEventInfo["SPELL_PERIODIC_AURA_REMOVED_DOSE"] = CLEUEventInfo["SPELL_PERIODIC_CAST_START"] = CLEUEventInfo["GENERIC_CAST_START"]
CLEUEventInfo["GENERIC_AURA_REMOVED_DOSE"] CLEUEventInfo["SPELL_PERIODIC_CAST_SUCCESS"] = CLEUEventInfo["GENERIC_CAST_SUCCESS"]
CLEUEventInfo["SPELL_PERIODIC_AURA_REFRESH"] = CLEUEventInfo["SPELL_PERIODIC_CAST_FAILED"] = CLEUEventInfo["GENERIC_CAST_FAILED"]
CLEUEventInfo["GENERIC_AURA_REFRESH"]
CLEUEventInfo["SPELL_PERIODIC_AURA_BROKEN"] =
CLEUEventInfo["GENERIC_AURA_BROKEN"]
CLEUEventInfo["SPELL_PERIODIC_AURA_BROKEN_SPELL"] =
CLEUEventInfo["GENERIC_AURA_BROKEN_SPELL"]
CLEUEventInfo["SPELL_PERIODIC_CAST_START"] =
CLEUEventInfo["GENERIC_CAST_START"]
CLEUEventInfo["SPELL_PERIODIC_CAST_SUCCESS"] =
CLEUEventInfo["GENERIC_CAST_SUCCESS"]
CLEUEventInfo["SPELL_PERIODIC_CAST_FAILED"] =
CLEUEventInfo["GENERIC_CAST_FAILED"]
---@class CLEUParser ---@class CLEUParser
CLEUParser = { CLEUParser = {
@@ -239,132 +207,88 @@ local function Init()
---@return number, nil|string ---@return number, nil|string
GetTimestamp = function(...) GetTimestamp = function(...)
local val = select(CLEUEventInfo["GENERIC"]["timestamp"], ...) local val = select(CLEUEventInfo["GENERIC"]["timestamp"], ...)
if val == nil then if val == nil then return 0, "Timestamp is nil or missing" end
return 0, "Timestamp is nil or missing" if type(val) ~= "number" then return 0, "Timestamp is not a number" end
end
if type(val) ~= "number" then
return 0, "Timestamp is not a number"
end
return val, nil return val, nil
end, end,
---@param ... any ---@param ... any
---@return string, nil|string ---@return string, nil|string
GetSubevent = function(...) GetSubevent = function(...)
local val = select(CLEUEventInfo["GENERIC"]["subevent"], ...) local val = select(CLEUEventInfo["GENERIC"]["subevent"], ...)
if val == nil then if val == nil then return "", "Subevent is nil or missing" end
return "", "Subevent is nil or missing" if type(val) ~= "string" then return "", "Subevent is not a string" end
end
if type(val) ~= "string" then
return "", "Subevent is not a string"
end
return val, nil return val, nil
end, end,
---@param ... any ---@param ... any
---@return boolean, nil|string ---@return boolean, nil|string
GetHideCaster = function(...) GetHideCaster = function(...)
local val = select(CLEUEventInfo["GENERIC"]["hideCaster"], ...) local val = select(CLEUEventInfo["GENERIC"]["hideCaster"], ...)
if val == nil then if val == nil then return false, "HideCaster is nil or missing" end
return false, "HideCaster is nil or missing" if type(val) ~= "boolean" then return false, "HideCaster is not a boolean" end
end
if type(val) ~= "boolean" then
return false, "HideCaster is not a boolean"
end
return val, nil return val, nil
end, end,
---@param ... any ---@param ... any
---@return string, nil|string ---@return string, nil|string
GetSourceGUID = function(...) GetSourceGUID = function(...)
local val = select(CLEUEventInfo["GENERIC"]["sourceGUID"], ...) local val = select(CLEUEventInfo["GENERIC"]["sourceGUID"], ...)
if val == nil then if val == nil then return "", "SourceGUID is nil or missing" end
return "", "SourceGUID is nil or missing" if type(val) ~= "string" then return "", "SourceGUID is not a string" end
end
if type(val) ~= "string" then
return "", "SourceGUID is not a string"
end
return val, nil return val, nil
end, end,
---@param ... any ---@param ... any
---@return string, nil|string ---@return string, nil|string
GetSourceName = function(...) GetSourceName = function(...)
local val = select(CLEUEventInfo["GENERIC"]["sourceName"], ...) local val = select(CLEUEventInfo["GENERIC"]["sourceName"], ...)
if val == nil then if val == nil then return "", "SourceName is nil or missing" end
return "", "SourceName is nil or missing" if type(val) ~= "string" then return "", "SourceName is not a string" end
end
if type(val) ~= "string" then
return "", "SourceName is not a string"
end
return val, nil return val, nil
end, end,
---@param ... any ---@param ... any
---@return number, nil|string ---@return number, nil|string
GetSourceFlags = function(...) GetSourceFlags = function(...)
local val = select(CLEUEventInfo["GENERIC"]["sourceFlags"], ...) local val = select(CLEUEventInfo["GENERIC"]["sourceFlags"], ...)
if val == nil then if val == nil then return 0, "SourceFlags is nil or missing" end
return 0, "SourceFlags is nil or missing" if type(val) ~= "number" then return 0, "SourceFlags is not a number" end
end
if type(val) ~= "number" then
return 0, "SourceFlags is not a number"
end
return val, nil return val, nil
end, end,
---@param ... any ---@param ... any
---@return number, nil|string ---@return number, nil|string
GetSourceRaidFlags = function(...) GetSourceRaidFlags = function(...)
local val = select(CLEUEventInfo["GENERIC"]["sourceRaidFlags"], ...) local val = select(CLEUEventInfo["GENERIC"]["sourceRaidFlags"], ...)
if val == nil then if val == nil then return 0, "SourceRaidFlags is nil or missing" end
return 0, "SourceRaidFlags is nil or missing" if type(val) ~= "number" then return 0, "SourceRaidFlags is not a number" end
end
if type(val) ~= "number" then
return 0, "SourceRaidFlags is not a number"
end
return val, nil return val, nil
end, end,
---@param ... any ---@param ... any
---@return string, nil|string ---@return string, nil|string
GetDestGUID = function(...) GetDestGUID = function(...)
local val = select(CLEUEventInfo["GENERIC"]["destGUID"], ...) local val = select(CLEUEventInfo["GENERIC"]["destGUID"], ...)
if val == nil then if val == nil then return "", "DestGUID is nil or missing" end
return "", "DestGUID is nil or missing" if type(val) ~= "string" then return "", "DestGUID is not a string" end
end
if type(val) ~= "string" then
return "", "DestGUID is not a string"
end
return val, nil return val, nil
end, end,
---@param ... any ---@param ... any
---@return string, nil|string ---@return string, nil|string
GetDestName = function(...) GetDestName = function(...)
local val = select(CLEUEventInfo["GENERIC"]["destName"], ...) local val = select(CLEUEventInfo["GENERIC"]["destName"], ...)
if val == nil then if val == nil then return "", "DestName is nil or missing" end
return "", "DestName is nil or missing" if type(val) ~= "string" then return "", "DestName is not a string" end
end
if type(val) ~= "string" then
return "", "DestName is not a string"
end
return val, nil return val, nil
end, end,
---@param ... any ---@param ... any
---@return number, nil|string ---@return number, nil|string
GetDestFlags = function(...) GetDestFlags = function(...)
local val = select(CLEUEventInfo["GENERIC"]["destFlags"], ...) local val = select(CLEUEventInfo["GENERIC"]["destFlags"], ...)
if val == nil then if val == nil then return 0, "DestFlags is nil or missing" end
return 0, "DestFlags is nil or missing" if type(val) ~= "number" then return 0, "DestFlags is not a number" end
end
if type(val) ~= "number" then
return 0, "DestFlags is not a number"
end
return val, nil return val, nil
end, end,
---@param ... any ---@param ... any
---@return number, nil|string ---@return number, nil|string
GetDestRaidFlags = function(...) GetDestRaidFlags = function(...)
local val = select(CLEUEventInfo["GENERIC"]["destRaidFlags"], ...) local val = select(CLEUEventInfo["GENERIC"]["destRaidFlags"], ...)
if val == nil then if val == nil then return 0, "DestRaidFlags is nil or missing" end
return 0, "DestRaidFlags is nil or missing" if type(val) ~= "number" then return 0, "DestRaidFlags is not a number" end
end
if type(val) ~= "number" then
return 0, "DestRaidFlags is not a number"
end
return val, nil return val, nil
end, end,
@@ -380,9 +304,7 @@ local function Init()
GetSpellId = function(...) GetSpellId = function(...)
local val = select(CLEUEventInfo["GENERIC_SPELL"]["spellId"], ...) local val = select(CLEUEventInfo["GENERIC_SPELL"]["spellId"], ...)
if val == nil then return 0, "SpellId is nil or missing" end if val == nil then return 0, "SpellId is nil or missing" end
if type(val) ~= "number" then if type(val) ~= "number" then return 0, "SpellId is not a number" end
return 0, "SpellId is not a number"
end
return val, nil return val, nil
end, end,
--- Specific to subevents prefixed by: --- Specific to subevents prefixed by:
@@ -396,12 +318,8 @@ local function Init()
---@return string, nil|string ---@return string, nil|string
GetSpellName = function(...) GetSpellName = function(...)
local val = select(CLEUEventInfo["GENERIC_SPELL"]["spellName"], ...) local val = select(CLEUEventInfo["GENERIC_SPELL"]["spellName"], ...)
if val == nil then if val == nil then return "", "SpellName is nil or missing" end
return "", "SpellName is nil or missing" if type(val) ~= "string" then return "", "SpellName is not a string" end
end
if type(val) ~= "string" then
return "", "SpellName is not a string"
end
return val, nil return val, nil
end, end,
--- Specific to subevents prefixed by: --- Specific to subevents prefixed by:
@@ -414,14 +332,9 @@ local function Init()
---@param ... any ---@param ... any
---@return number, nil|string ---@return number, nil|string
GetSpellSchool = function(...) GetSpellSchool = function(...)
local val = select(CLEUEventInfo["GENERIC_SPELL"]["spellSchool"], local val = select(CLEUEventInfo["GENERIC_SPELL"]["spellSchool"], ...)
...) if val == nil then return 0, "SpellSchool is nil or missing" end
if val == nil then if type(val) ~= "number" then return 0, "SpellSchool is not a number" end
return 0, "SpellSchool is nil or missing"
end
if type(val) ~= "number" then
return 0, "SpellSchool is not a number"
end
return val, nil return val, nil
end, end,
@@ -451,15 +364,10 @@ local function Init()
---@return number, nil|string ---@return number, nil|string
GetAmount = function(...) GetAmount = function(...)
local subevent, err = CLEUParser.GetSubevent(...) local subevent, err = CLEUParser.GetSubevent(...)
if err then if err then return 0, string.format("Failed getting subevent due to: %s", err) end
return 0,
string.format("Failed getting subevent due to: %s", err)
end
local val = select(CLEUEventInfo[subevent]["amount"], ...) local val = select(CLEUEventInfo[subevent]["amount"], ...)
if val == nil then return 0, "Amount is nil or missing" end if val == nil then return 0, "Amount is nil or missing" end
if type(val) ~= "number" then if type(val) ~= "number" then return 0, "Amount is not a number" end
return 0, "Amount is not a number"
end
return val, nil return val, nil
end, end,
--- Specific to subevents prefixed by: --- Specific to subevents prefixed by:
@@ -479,21 +387,12 @@ local function Init()
---@return number, nil|string ---@return number, nil|string
GetOverkill = function(...) GetOverkill = function(...)
local subevent, err = CLEUParser.GetSubevent(...) local subevent, err = CLEUParser.GetSubevent(...)
if err then if err then return 0, string.format("Failed getting subevent due to: %s", err) end
return 0, if not CLEUEventInfo[subevent] then return 0, "Subevent is not a valid event" end
string.format("Failed getting subevent due to: %s", err) if not CLEUEventInfo[subevent]["overkill"] then return 0, "Overkill is nil or missing" end
end
if not CLEUEventInfo[subevent] then
return 0, "Subevent is not a valid event"
end
if not CLEUEventInfo[subevent]["overkill"] then
return 0, "Overkill is nil or missing"
end
local val = select(CLEUEventInfo[subevent]["overkill"], ...) local val = select(CLEUEventInfo[subevent]["overkill"], ...)
if val == nil then return 0, "Overkill is nil or missing" end if val == nil then return 0, "Overkill is nil or missing" end
if type(val) ~= "number" then if type(val) ~= "number" then return 0, "Overkill is not a number" end
return 0, "Overkill is not a number"
end
return val, nil return val, nil
end, end,
--- Specific to subevents prefixed by: --- Specific to subevents prefixed by:
@@ -513,15 +412,10 @@ local function Init()
---@return number, nil|string ---@return number, nil|string
GetSchool = function(...) GetSchool = function(...)
local subevent, err = CLEUParser.GetSubevent(...) local subevent, err = CLEUParser.GetSubevent(...)
if err then if err then return 0, string.format("Failed getting subevent due to: %s", err) end
return 0,
string.format("Failed getting subevent due to: %s", err)
end
local val = select(CLEUEventInfo[subevent]["school"], ...) local val = select(CLEUEventInfo[subevent]["school"], ...)
if val == nil then return 0, "School is nil or missing" end if val == nil then return 0, "School is nil or missing" end
if type(val) ~= "number" then if type(val) ~= "number" then return 0, "School is not a number" end
return 0, "School is not a number"
end
return val, nil return val, nil
end, end,
--- Specific to subevents prefixed by: --- Specific to subevents prefixed by:
@@ -543,17 +437,10 @@ local function Init()
---@return boolean, nil|string ---@return boolean, nil|string
GetResisted = function(...) GetResisted = function(...)
local subevent, err = CLEUParser.GetSubevent(...) local subevent, err = CLEUParser.GetSubevent(...)
if err then if err then return false, string.format("Failed getting subevent due to: %s", err) end
return false,
string.format("Failed getting subevent due to: %s", err)
end
local val = select(CLEUEventInfo[subevent]["resisted"], ...) local val = select(CLEUEventInfo[subevent]["resisted"], ...)
if val == nil then if val == nil then return false, "Resisted is nil or missing" end
return false, "Resisted is nil or missing" if type(val) ~= "boolean" then return false, "Resisted is not a boolean" end
end
if type(val) ~= "boolean" then
return false, "Resisted is not a boolean"
end
return val, nil return val, nil
end, end,
--- Specific to subevents prefixed by: --- Specific to subevents prefixed by:
@@ -575,17 +462,10 @@ local function Init()
---@return boolean, nil|string ---@return boolean, nil|string
GetBlocked = function(...) GetBlocked = function(...)
local subevent, err = CLEUParser.GetSubevent(...) local subevent, err = CLEUParser.GetSubevent(...)
if err then if err then return false, string.format("Failed getting subevent due to: %s", err) end
return false,
string.format("Failed getting subevent due to: %s", err)
end
local val = select(CLEUEventInfo[subevent]["blocked"], ...) local val = select(CLEUEventInfo[subevent]["blocked"], ...)
if val == nil then if val == nil then return false, "Blocked is nil or missing" end
return false, "Blocked is nil or missing" if type(val) ~= "boolean" then return false, "Blocked is not a boolean" end
end
if type(val) ~= "boolean" then
return false, "Blocked is not a boolean"
end
return val, nil return val, nil
end, end,
--- Specific to subevents prefixed by: --- Specific to subevents prefixed by:
@@ -608,17 +488,10 @@ local function Init()
---@return boolean, nil|string ---@return boolean, nil|string
GetAbsorbed = function(...) GetAbsorbed = function(...)
local subevent, err = CLEUParser.GetSubevent(...) local subevent, err = CLEUParser.GetSubevent(...)
if err then if err then return false, string.format("Failed getting subevent due to: %s", err) end
return false,
string.format("Failed getting subevent due to: %s", err)
end
local val = select(CLEUEventInfo[subevent]["absorbed"], ...) local val = select(CLEUEventInfo[subevent]["absorbed"], ...)
if val == nil then if val == nil then return false, "Absorbed is nil or missing" end
return false, "Absorbed is nil or missing" if type(val) ~= "boolean" then return false, "Absorbed is not a boolean" end
end
if type(val) ~= "boolean" then
return false, "Absorbed is not a boolean"
end
return val, nil return val, nil
end, end,
--- Specific to subevents prefixed by: --- Specific to subevents prefixed by:
@@ -640,17 +513,10 @@ local function Init()
---@return boolean, nil|string ---@return boolean, nil|string
GetCritical = function(...) GetCritical = function(...)
local subevent, err = CLEUParser.GetSubevent(...) local subevent, err = CLEUParser.GetSubevent(...)
if err then if err then return false, string.format("Failed getting subevent due to: %s", err) end
return false,
string.format("Failed getting subevent due to: %s", err)
end
local val = select(CLEUEventInfo[subevent]["critical"], ...) local val = select(CLEUEventInfo[subevent]["critical"], ...)
if val == nil then if val == nil then return false, "Critical is nil or missing" end
return false, "Critical is nil or missing" if type(val) ~= "boolean" then return false, "Critical is not a boolean" end
end
if type(val) ~= "boolean" then
return false, "Critical is not a boolean"
end
return val, nil return val, nil
end, end,
--- Specific to subevents prefixed by: --- Specific to subevents prefixed by:
@@ -670,17 +536,10 @@ local function Init()
---@return boolean, nil|string ---@return boolean, nil|string
GetGlancing = function(...) GetGlancing = function(...)
local subevent, err = CLEUParser.GetSubevent(...) local subevent, err = CLEUParser.GetSubevent(...)
if err then if err then return false, string.format("Failed getting subevent due to: %s", err) end
return false,
string.format("Failed getting subevent due to: %s", err)
end
local val = select(CLEUEventInfo[subevent]["glancing"], ...) local val = select(CLEUEventInfo[subevent]["glancing"], ...)
if val == nil then if val == nil then return false, "Glancing is nil or missing" end
return false, "Glancing is nil or missing" if type(val) ~= "boolean" then return false, "Glancing is not a boolean" end
end
if type(val) ~= "boolean" then
return false, "Glancing is not a boolean"
end
return val, nil return val, nil
end, end,
--- Specific to subevents prefixed by: --- Specific to subevents prefixed by:
@@ -700,17 +559,10 @@ local function Init()
---@return boolean, nil|string ---@return boolean, nil|string
GetCrushing = function(...) GetCrushing = function(...)
local subevent, err = CLEUParser.GetSubevent(...) local subevent, err = CLEUParser.GetSubevent(...)
if err then if err then return false, string.format("Failed getting subevent due to: %s", err) end
return false,
string.format("Failed getting subevent due to: %s", err)
end
local val = select(CLEUEventInfo[subevent]["crushing"], ...) local val = select(CLEUEventInfo[subevent]["crushing"], ...)
if val == nil then if val == nil then return false, "Crushing is nil or missing" end
return false, "Crushing is nil or missing" if type(val) ~= "boolean" then return false, "Crushing is not a boolean" end
end
if type(val) ~= "boolean" then
return false, "Crushing is not a boolean"
end
return val, nil return val, nil
end, end,
--- Specific to subevents prefixed by: --- Specific to subevents prefixed by:
@@ -731,17 +583,10 @@ local function Init()
---@return boolean, nil|string ---@return boolean, nil|string
GetIsOffHand = function(...) GetIsOffHand = function(...)
local subevent, err = CLEUParser.GetSubevent(...) local subevent, err = CLEUParser.GetSubevent(...)
if err then if err then return false, string.format("Failed getting subevent due to: %s", err) end
return false,
string.format("Failed getting subevent due to: %s", err)
end
local val = select(CLEUEventInfo[subevent]["isOffHand"], ...) local val = select(CLEUEventInfo[subevent]["isOffHand"], ...)
if val == nil then if val == nil then return false, "IsOffHand is nil or missing" end
return false, "IsOffHand is nil or missing" if type(val) ~= "boolean" then return false, "IsOffHand is not a boolean" end
end
if type(val) ~= "boolean" then
return false, "IsOffHand is not a boolean"
end
return val, nil return val, nil
end, end,
@@ -764,17 +609,10 @@ local function Init()
---@return string, nil|string ---@return string, nil|string
GetMissType = function(...) GetMissType = function(...)
local subevent, err = CLEUParser.GetSubevent(...) local subevent, err = CLEUParser.GetSubevent(...)
if err then if err then return "", string.format("Failed getting subevent due to: %s", err) end
return "",
string.format("Failed getting subevent due to: %s", err)
end
local val = select(CLEUEventInfo[subevent]["missType"], ...) local val = select(CLEUEventInfo[subevent]["missType"], ...)
if val == nil then if val == nil then return "", "MissType is nil or missing" end
return "", "MissType is nil or missing" if type(val) ~= "string" then return "", "MissType is not a string" end
end
if type(val) ~= "string" then
return "", "MissType is not a string"
end
return val, nil return val, nil
end, end,
@@ -797,17 +635,10 @@ local function Init()
--- return type is unconfirmed! --- return type is unconfirmed!
GetAmountMissed = function(...) GetAmountMissed = function(...)
local subevent, err = CLEUParser.GetSubevent(...) local subevent, err = CLEUParser.GetSubevent(...)
if err then if err then return 0, string.format("Failed getting subevent due to: %s", err) end
return 0,
string.format("Failed getting subevent due to: %s", err)
end
local val = select(CLEUEventInfo[subevent]["amountMissed"], ...) local val = select(CLEUEventInfo[subevent]["amountMissed"], ...)
if val == nil then if val == nil then return 0, "AmountMissed is nil or missing" end
return 0, "AmountMissed is nil or missing" if type(val) ~= "number" then return 0, "AmountMissed is not a number" end
end
if type(val) ~= "number" then
return 0, "AmountMissed is not a number"
end
return val, nil return val, nil
end, end,
@@ -830,17 +661,10 @@ local function Init()
---@return number, nil|string ---@return number, nil|string
GetOverhealing = function(...) GetOverhealing = function(...)
local subevent, err = CLEUParser.GetSubevent(...) local subevent, err = CLEUParser.GetSubevent(...)
if err then if err then return 0, string.format("Failed getting subevent due to: %s", err) end
return 0,
string.format("Failed getting subevent due to: %s", err)
end
local val = select(CLEUEventInfo[subevent]["overhealing"], ...) local val = select(CLEUEventInfo[subevent]["overhealing"], ...)
if val == nil then if val == nil then return 0, "Overhealing is nil or missing" end
return 0, "Overhealing is nil or missing" if type(val) ~= "number" then return 0, "Overhealing is not a number" end
end
if type(val) ~= "number" then
return 0, "Overhealing is not a number"
end
return val, nil return val, nil
end, end,
@@ -861,17 +685,10 @@ local function Init()
---@return string, nil|string ---@return string, nil|string
GetExtraGUID = function(...) GetExtraGUID = function(...)
local subevent, err = CLEUParser.GetSubevent(...) local subevent, err = CLEUParser.GetSubevent(...)
if err then if err then return "", string.format("Failed getting subevent due to: %s", err) end
return "",
string.format("Failed getting subevent due to: %s", err)
end
local val = select(CLEUEventInfo[subevent]["extraGUID"], ...) local val = select(CLEUEventInfo[subevent]["extraGUID"], ...)
if val == nil then if val == nil then return "", "ExtraGUID is nil or missing" end
return "", "ExtraGUID is nil or missing" if type(val) ~= "string" then return "", "ExtraGUID is not a string" end
end
if type(val) ~= "string" then
return "", "ExtraGUID is not a string"
end
return val, nil return val, nil
end, end,
@@ -892,17 +709,10 @@ local function Init()
---@return string, nil|string ---@return string, nil|string
GetExtraName = function(...) GetExtraName = function(...)
local subevent, err = CLEUParser.GetSubevent(...) local subevent, err = CLEUParser.GetSubevent(...)
if err then if err then return "", string.format("Failed getting subevent due to: %s", err) end
return "",
string.format("Failed getting subevent due to: %s", err)
end
local val = select(CLEUEventInfo[subevent]["extraName"], ...) local val = select(CLEUEventInfo[subevent]["extraName"], ...)
if val == nil then if val == nil then return "", "ExtraName is nil or missing" end
return "", "ExtraName is nil or missing" if type(val) ~= "string" then return "", "ExtraName is not a string" end
end
if type(val) ~= "string" then
return "", "ExtraName is not a string"
end
return val, nil return val, nil
end, end,
@@ -923,17 +733,10 @@ local function Init()
---@return number, nil|string ---@return number, nil|string
GetExtraFlags = function(...) GetExtraFlags = function(...)
local subevent, err = CLEUParser.GetSubevent(...) local subevent, err = CLEUParser.GetSubevent(...)
if err then if err then return 0, string.format("Failed getting subevent due to: %s", err) end
return 0,
string.format("Failed getting subevent due to: %s", err)
end
local val = select(CLEUEventInfo[subevent]["extraFlags"], ...) local val = select(CLEUEventInfo[subevent]["extraFlags"], ...)
if val == nil then if val == nil then return 0, "ExtraFlags is nil or missing" end
return 0, "ExtraFlags is nil or missing" if type(val) ~= "number" then return 0, "ExtraFlags is not a number" end
end
if type(val) ~= "number" then
return 0, "ExtraFlags is not a number"
end
return val, nil return val, nil
end, end,
@@ -954,17 +757,10 @@ local function Init()
---@return number, nil|string ---@return number, nil|string
GetExtraRaidFlags = function(...) GetExtraRaidFlags = function(...)
local subevent, err = CLEUParser.GetSubevent(...) local subevent, err = CLEUParser.GetSubevent(...)
if err then if err then return 0, string.format("Failed getting subevent due to: %s", err) end
return 0,
string.format("Failed getting subevent due to: %s", err)
end
local val = select(CLEUEventInfo[subevent]["extraRaidFlags"], ...) local val = select(CLEUEventInfo[subevent]["extraRaidFlags"], ...)
if val == nil then if val == nil then return 0, "ExtraRaidFlags is nil or missing" end
return 0, "ExtraRaidFlags is nil or missing" if type(val) ~= "number" then return 0, "ExtraRaidFlags is not a number" end
end
if type(val) ~= "number" then
return 0, "ExtraRaidFlags is not a number"
end
return val, nil return val, nil
end, end,
@@ -989,17 +785,10 @@ local function Init()
---@return number, nil|string ---@return number, nil|string
GetExtraSpellID = function(...) GetExtraSpellID = function(...)
local subevent, err = CLEUParser.GetSubevent(...) local subevent, err = CLEUParser.GetSubevent(...)
if err then if err then return 0, string.format("Failed getting subevent due to: %s", err) end
return 0,
string.format("Failed getting subevent due to: %s", err)
end
local val = select(CLEUEventInfo[subevent]["extraSpellID"], ...) local val = select(CLEUEventInfo[subevent]["extraSpellID"], ...)
if val == nil then if val == nil then return 0, "ExtraSpellID is nil or missing" end
return 0, "ExtraSpellID is nil or missing" if type(val) ~= "number" then return 0, "ExtraSpellID is not a number" end
end
if type(val) ~= "number" then
return 0, "ExtraSpellID is not a number"
end
return val, nil return val, nil
end, end,
@@ -1025,17 +814,10 @@ local function Init()
---@return string, nil|string ---@return string, nil|string
GetExtraSpellName = function(...) GetExtraSpellName = function(...)
local subevent, err = CLEUParser.GetSubevent(...) local subevent, err = CLEUParser.GetSubevent(...)
if err then if err then return "", string.format("Failed getting subevent due to: %s", err) end
return "",
string.format("Failed getting subevent due to: %s", err)
end
local val = select(CLEUEventInfo[subevent]["extraSpellName"], ...) local val = select(CLEUEventInfo[subevent]["extraSpellName"], ...)
if val == nil then if val == nil then return "", "extraSpellName is nil or missing" end
return "", "extraSpellName is nil or missing" if type(val) ~= "string" then return "", "extraSpellName is not a string" end
end
if type(val) ~= "string" then
return "", "extraSpellName is not a string"
end
return val, nil return val, nil
end, end,
@@ -1061,17 +843,10 @@ local function Init()
---@return number, nil|string ---@return number, nil|string
GetExtraSchool = function(...) GetExtraSchool = function(...)
local subevent, err = CLEUParser.GetSubevent(...) local subevent, err = CLEUParser.GetSubevent(...)
if err then if err then return 0, string.format("Failed getting subevent due to: %s", err) end
return 0,
string.format("Failed getting subevent due to: %s", err)
end
local val = select(CLEUEventInfo[subevent]["extraSchool"], ...) local val = select(CLEUEventInfo[subevent]["extraSchool"], ...)
if val == nil then if val == nil then return 0, "ExtraSchool is nil or missing" end
return 0, "ExtraSchool is nil or missing" if type(val) ~= "number" then return 0, "ExtraSchool is not a number" end
end
if type(val) ~= "number" then
return 0, "ExtraSchool is not a number"
end
return val, nil return val, nil
end, end,
@@ -1092,17 +867,10 @@ local function Init()
---@return number, nil|string ---@return number, nil|string
GetAbsorbedAmount = function(...) GetAbsorbedAmount = function(...)
local subevent, err = CLEUParser.GetSubevent(...) local subevent, err = CLEUParser.GetSubevent(...)
if err then if err then return 0, string.format("Failed getting subevent due to: %s", err) end
return 0,
string.format("Failed getting subevent due to: %s", err)
end
local val = select(CLEUEventInfo[subevent]["absorbedAmount"], ...) local val = select(CLEUEventInfo[subevent]["absorbedAmount"], ...)
if val == nil then if val == nil then return 0, "AbsorbedAmount is nil or missing" end
return 0, "AbsorbedAmount is nil or missing" if type(val) ~= "number" then return 0, "AbsorbedAmount is not a number" end
end
if type(val) ~= "number" then
return 0, "AbsorbedAmount is not a number"
end
return val, nil return val, nil
end, end,
@@ -1123,17 +891,10 @@ local function Init()
---@return number, nil|string ---@return number, nil|string
GetOverEnergize = function(...) GetOverEnergize = function(...)
local subevent, err = CLEUParser.GetSubevent(...) local subevent, err = CLEUParser.GetSubevent(...)
if err then if err then return 0, string.format("Failed getting subevent due to: %s", err) end
return 0,
string.format("Failed getting subevent due to: %s", err)
end
local val = select(CLEUEventInfo[subevent]["overEnergize"], ...) local val = select(CLEUEventInfo[subevent]["overEnergize"], ...)
if val == nil then if val == nil then return 0, "OverEnergize is nil or missing" end
return 0, "OverEnergize is nil or missing" if type(val) ~= "number" then return 0, "OverEnergize is not a number" end
end
if type(val) ~= "number" then
return 0, "OverEnergize is not a number"
end
return val, nil return val, nil
end, end,
@@ -1158,17 +919,10 @@ local function Init()
---@return number, nil|string ---@return number, nil|string
GetPowerType = function(...) GetPowerType = function(...)
local subevent, err = CLEUParser.GetSubevent(...) local subevent, err = CLEUParser.GetSubevent(...)
if err then if err then return 0, string.format("Failed getting subevent due to: %s", err) end
return 0,
string.format("Failed getting subevent due to: %s", err)
end
local val = select(CLEUEventInfo[subevent]["powerType"], ...) local val = select(CLEUEventInfo[subevent]["powerType"], ...)
if val == nil then if val == nil then return 0, "PowerType is nil or missing" end
return 0, "PowerType is nil or missing" if type(val) ~= "number" then return 0, "PowerType is not a number" end
end
if type(val) ~= "number" then
return 0, "PowerType is not a number"
end
return val, nil return val, nil
end, end,
@@ -1190,17 +944,10 @@ local function Init()
---@return number, nil|string ---@return number, nil|string
GetExtraAmount = function(...) GetExtraAmount = function(...)
local subevent, err = CLEUParser.GetSubevent(...) local subevent, err = CLEUParser.GetSubevent(...)
if err then if err then return 0, string.format("Failed getting subevent due to: %s", err) end
return 0,
string.format("Failed getting subevent due to: %s", err)
end
local val = select(CLEUEventInfo[subevent]["extraAmount"], ...) local val = select(CLEUEventInfo[subevent]["extraAmount"], ...)
if val == nil then if val == nil then return 0, "ExtraAmount is nil or missing" end
return 0, "ExtraAmount is nil or missing" if type(val) ~= "number" then return 0, "ExtraAmount is not a number" end
end
if type(val) ~= "number" then
return 0, "ExtraAmount is not a number"
end
return val, nil return val, nil
end, end,
@@ -1229,17 +976,10 @@ local function Init()
---@return number, nil|string ---@return number, nil|string
GetExtraSpellId = function(...) GetExtraSpellId = function(...)
local subevent, err = CLEUParser.GetSubevent(...) local subevent, err = CLEUParser.GetSubevent(...)
if err then if err then return 0, string.format("Failed getting subevent due to: %s", err) end
return 0,
string.format("Failed getting subevent due to: %s", err)
end
local val = select(CLEUEventInfo[subevent]["extraSpellId"], ...) local val = select(CLEUEventInfo[subevent]["extraSpellId"], ...)
if val == nil then if val == nil then return 0, "ExtraSpellId is nil or missing" end
return 0, "ExtraSpellId is nil or missing" if type(val) ~= "number" then return 0, "ExtraSpellId is not a number" end
end
if type(val) ~= "number" then
return 0, "ExtraSpellId is not a number"
end
return val, nil return val, nil
end, end,
@@ -1268,17 +1008,12 @@ local function Init()
---@return number, nil|string ---@return number, nil|string
GetExtraAuraType = function(...) GetExtraAuraType = function(...)
local subevent, err = CLEUParser.GetSubevent(...) local subevent, err = CLEUParser.GetSubevent(...)
if err then if err then return 0, string.format("Failed getting subevent due to: %s", err) end
return 0,
string.format("Failed getting subevent due to: %s", err)
end
local val = select(CLEUEventInfo[subevent]["auraType"], ...) local val = select(CLEUEventInfo[subevent]["auraType"], ...)
if val == nil then return 0, "AuraType is nil or missing" end if val == nil then return 0, "AuraType is nil or missing" end
if type(val) ~= "number" then if type(val) ~= "number" then return 0, "AuraType is not a number" end
return 0, "AuraType is not a number"
end
return val, nil return val, nil
end end,
} }
end end
@@ -1286,7 +1021,5 @@ local frame = CreateFrame("Frame")
frame:RegisterEvent("PLAYER_LOGIN") frame:RegisterEvent("PLAYER_LOGIN")
frame:RegisterEvent("PLAYER_ENTERING_WORLD") frame:RegisterEvent("PLAYER_ENTERING_WORLD")
frame:RegisterEvent("GUILD_ROSTER_UPDATE") frame:RegisterEvent("GUILD_ROSTER_UPDATE")
frame:SetScript("OnEvent", function(self, event, ...) frame:SetScript("OnEvent", function(self, event, ...) Init() end)
Init()
end)
Init() Init()

View File

@@ -1,6 +1,5 @@
local addonname, shared = ... local _, shared = ...
---@cast shared HeimdallShared ---@cast shared HeimdallShared
---@cast addonname string
local ModuleName = "CombatAlerter" local ModuleName = "CombatAlerter"
---@diagnostic disable-next-line: missing-fields ---@diagnostic disable-next-line: missing-fields
@@ -20,7 +19,10 @@ function shared.CombatAlerter.Init()
return return
end end
local destination, err = CLEUParser.GetDestName(...) ---@type string|nil, string, string
local err, source, destination
destination, err = CLEUParser.GetDestName(...)
if err then if err then
if Heimdall_Data.config.combatAlerter.debug then if Heimdall_Data.config.combatAlerter.debug then
print(string.format("[%s] Error getting destination: %s", ModuleName, err)) print(string.format("[%s] Error getting destination: %s", ModuleName, err))
@@ -39,7 +41,7 @@ function shared.CombatAlerter.Init()
return return
end end
local source, err = CLEUParser.GetSourceName(...) source, err = CLEUParser.GetSourceName(...)
if err then if err then
if Heimdall_Data.config.combatAlerter.debug then if Heimdall_Data.config.combatAlerter.debug then
print(string.format("[%s] Error getting source, using 'unknown': %s", ModuleName, err)) print(string.format("[%s] Error getting source, using 'unknown': %s", ModuleName, err))
@@ -53,8 +55,14 @@ function shared.CombatAlerter.Init()
if shared.stinkyTracker.stinkies and shared.stinkyTracker.stinkies[source] then if shared.stinkyTracker.stinkies and shared.stinkyTracker.stinkies[source] then
if Heimdall_Data.config.combatAlerter.debug then if Heimdall_Data.config.combatAlerter.debug then
print(string.format("[%s] Source is tracked stinky: %s (Already alerted: %s)", ModuleName, source, print(
tostring(alerted[source] or false))) string.format(
"[%s] Source is tracked stinky: %s (Already alerted: %s)",
ModuleName,
source,
tostring(alerted[source] or false)
)
)
end end
if alerted[source] then return end if alerted[source] then return end
@@ -63,8 +71,16 @@ function shared.CombatAlerter.Init()
local zone, subZone = GetZoneText(), GetSubZoneText() local zone, subZone = GetZoneText(), GetSubZoneText()
if Heimdall_Data.config.combatAlerter.debug then if Heimdall_Data.config.combatAlerter.debug then
print(string.format("[%s] Player location: %s/%s at %.2f,%.2f", ModuleName, zone, subZone, x * 100, print(
y * 100)) string.format(
"[%s] Player location: %s/%s at %.2f,%.2f",
ModuleName,
zone,
subZone,
x * 100,
y * 100
)
)
end end
SetMapToCurrentZone() SetMapToCurrentZone()
@@ -73,11 +89,14 @@ function shared.CombatAlerter.Init()
for _, channel in pairs(Heimdall_Data.config.combatAlerter.channels) do for _, channel in pairs(Heimdall_Data.config.combatAlerter.channels) do
local locale = shared.GetLocaleForChannel(channel) local locale = shared.GetLocaleForChannel(channel)
local text = string.format(shared._L("combatAlerterInCombat", locale), local text = string.format(
shared._L("combatAlerterInCombat", locale),
source, source,
shared._L("zone", locale), shared._L("subZone", locale), shared._L("zone", locale),
shared._L("subZone", locale),
tostring(areaId), tostring(areaId),
x * 100, y * 100 x * 100,
y * 100
) )
---@type Message ---@type Message
local msg = { local msg = {
@@ -111,8 +130,6 @@ function shared.CombatAlerter.Init()
alerted = {} alerted = {}
end) end)
if Heimdall_Data.config.combatAlerter.debug then if Heimdall_Data.config.combatAlerter.debug then print(string.format("[%s] Module initialized", ModuleName)) end
print(string.format("[%s] Module initialized", ModuleName))
end
print("[Heimdall] CombatAlerter loaded") print("[Heimdall] CombatAlerter loaded")
end end

View File

@@ -1,6 +1,5 @@
local addonname, shared = ... local _, shared = ...
---@cast shared HeimdallShared ---@cast shared HeimdallShared
---@cast addonname string
local ModuleName = "Commander" local ModuleName = "Commander"
local helpMessages = { local helpMessages = {
@@ -29,7 +28,7 @@ local helpMessages = {
"9) note <name> i..j - lists notes from i to j for the character.", "9) note <name> i..j - lists notes from i to j for the character.",
"10) note <name> delete i - deletes the i-th note for the character.", "10) note <name> delete i - deletes the i-th note for the character.",
"11) note <name> delete i..j - deletes notes from i to j for the character.", "11) note <name> delete i..j - deletes notes from i to j for the character.",
} },
} }
---@diagnostic disable-next-line: missing-fields ---@diagnostic disable-next-line: missing-fields
@@ -51,16 +50,12 @@ function shared.Commander.Init()
if #currentChunk + #word + 1 <= size then if #currentChunk + #word + 1 <= size then
currentChunk = currentChunk .. (currentChunk == "" and word or " " .. word) currentChunk = currentChunk .. (currentChunk == "" and word or " " .. word)
else else
if #currentChunk > 0 then if #currentChunk > 0 then ret[#ret + 1] = currentChunk end
ret[#ret + 1] = currentChunk
end
currentChunk = word currentChunk = word
end end
end end
if #currentChunk > 0 then if #currentChunk > 0 then ret[#ret + 1] = currentChunk end
ret[#ret + 1] = currentChunk
end
return ret return ret
end end
@@ -69,9 +64,7 @@ function shared.Commander.Init()
local function Count(arr) local function Count(arr)
local ret = {} local ret = {}
for _, player in pairs(arr) do for _, player in pairs(arr) do
if shared.Whoer.ShouldNotifyForZone(player.zone) then if shared.Whoer.ShouldNotifyForZone(player.zone) then ret[player.zone] = (ret[player.zone] or 0) + 1 end
ret[player.zone] = (ret[player.zone] or 0) + 1
end
end end
local text = {} local text = {}
for zone, count in pairs(ret) do for zone, count in pairs(ret) do
@@ -84,6 +77,7 @@ function shared.Commander.Init()
local function CountPartitioned(arr) local function CountPartitioned(arr)
local count = Count(arr) local count = Count(arr)
local text = {} local text = {}
---@diagnostic disable-next-line: param-type-mismatch something wrong with luals, it's picking up the "wrong" unpack
for _, line in pairs(Partition(strjoin(", ", unpack(count)), 200)) do for _, line in pairs(Partition(strjoin(", ", unpack(count)), 200)) do
text[#text + 1] = line text[#text + 1] = line
end end
@@ -95,8 +89,13 @@ function shared.Commander.Init()
local ret = {} local ret = {}
for _, player in pairs(arr) do for _, player in pairs(arr) do
if shared.Whoer.ShouldNotifyForZone(player.zone) then if shared.Whoer.ShouldNotifyForZone(player.zone) then
ret[#ret + 1] = string.format("%s/%s (%s) %s", player.name, player.class, player.zone, ret[#ret + 1] = string.format(
player.stinky and "(!!!!)" or "") "%s/%s (%s) %s",
player.name,
player.class,
player.zone,
player.stinky and "(!!!!)" or ""
)
end end
end end
if Heimdall_Data.config.commander.debug then if Heimdall_Data.config.commander.debug then
@@ -109,6 +108,7 @@ function shared.Commander.Init()
local function WhoPartitioned(arr) local function WhoPartitioned(arr)
local who = Who(arr) local who = Who(arr)
local text = {} local text = {}
---@diagnostic disable-next-line: param-type-mismatch something wrong with luals, it's picking up the "wrong" unpack
for _, line in pairs(Partition(strjoin(", ", unpack(who)), 200)) do for _, line in pairs(Partition(strjoin(", ", unpack(who)), 200)) do
text[#text + 1] = "who: " .. line text[#text + 1] = "who: " .. line
end end
@@ -119,9 +119,7 @@ function shared.Commander.Init()
local function CountClass(arr) local function CountClass(arr)
local ret = {} local ret = {}
for _, player in pairs(arr) do for _, player in pairs(arr) do
if shared.Whoer.ShouldNotifyForZone(player.zone) then if shared.Whoer.ShouldNotifyForZone(player.zone) then ret[player.class] = (ret[player.class] or 0) + 1 end
ret[player.class] = (ret[player.class] or 0) + 1
end
end end
local text = {} local text = {}
for class, count in pairs(ret) do for class, count in pairs(ret) do
@@ -137,6 +135,7 @@ function shared.Commander.Init()
local function CountClassPartitioned(arr) local function CountClassPartitioned(arr)
local countClass = CountClass(arr) local countClass = CountClass(arr)
local text = {} local text = {}
---@diagnostic disable-next-line: param-type-mismatch something wrong with luals, it's picking up the "wrong" unpack
for _, line in pairs(Partition(strjoin(", ", unpack(countClass)), 200)) do for _, line in pairs(Partition(strjoin(", ", unpack(countClass)), 200)) do
text[#text + 1] = line text[#text + 1] = line
end end
@@ -144,36 +143,27 @@ function shared.Commander.Init()
end end
local function CountClassPartitionedStinkies() local function CountClassPartitionedStinkies()
if Heimdall_Data.config.commander.debug then if Heimdall_Data.config.commander.debug then
print(string.format("[%s] Executing: CountClassPartitionedStinkies", print(string.format("[%s] Executing: CountClassPartitionedStinkies", ModuleName))
ModuleName))
end end
local res = CountClassPartitioned(HeimdallStinkies) local res = CountClassPartitioned(HeimdallStinkies)
if #res == 0 then if #res == 0 then return { "No stinkies found" } end
return { "No stinkies found" }
end
return res return res
end end
local function WhoPartitionedStinkies() local function WhoPartitionedStinkies()
if Heimdall_Data.config.commander.debug then if Heimdall_Data.config.commander.debug then
print(string.format("[%s] Executing: WhoPartitionedStinkies", print(string.format("[%s] Executing: WhoPartitionedStinkies", ModuleName))
ModuleName))
shared.dumpTable(HeimdallStinkies) shared.dumpTable(HeimdallStinkies)
end end
local res = WhoPartitioned(HeimdallStinkies) local res = WhoPartitioned(HeimdallStinkies)
if #res == 0 then if #res == 0 then return { "No stinkies found" } end
return { "No stinkies found" }
end
return res return res
end end
local function CountPartitionedStinkies() local function CountPartitionedStinkies()
if Heimdall_Data.config.commander.debug then if Heimdall_Data.config.commander.debug then
print(string.format("[%s] Executing: CountPartitionedStinkies", print(string.format("[%s] Executing: CountPartitionedStinkies", ModuleName))
ModuleName))
end end
local res = CountPartitioned(HeimdallStinkies) local res = CountPartitioned(HeimdallStinkies)
if #res == 0 then if #res == 0 then return { "No stinkies found" } end
return { "No stinkies found" }
end
return res return res
end end
local function HelpRu() local function HelpRu()
@@ -190,26 +180,32 @@ function shared.Commander.Init()
AcceptGroup() AcceptGroup()
groupInviteFrame:UnregisterEvent("PARTY_INVITE_REQUEST") groupInviteFrame:UnregisterEvent("PARTY_INVITE_REQUEST")
C_Timer.NewTimer(0.1, function() C_Timer.NewTimer(0.1, function()
if Heimdall_Data.config.commander.debug then print(string.format("[%s] Click event triggered", ModuleName)) end if Heimdall_Data.config.commander.debug then
print(string.format("[%s] Click event triggered", ModuleName))
end
_G["StaticPopup1Button1"]:Click() _G["StaticPopup1Button1"]:Click()
end, 1) end, 1)
end) end)
local function JoinGroup() local function JoinGroup()
if Heimdall_Data.config.commander.debug then print(string.format("[%s] JoinGroup command received", ModuleName)) end if Heimdall_Data.config.commander.debug then
print(string.format("[%s] JoinGroup command received", ModuleName))
end
groupInviteFrame:RegisterEvent("PARTY_INVITE_REQUEST") groupInviteFrame:RegisterEvent("PARTY_INVITE_REQUEST")
C_Timer.NewTimer(10, function() C_Timer.NewTimer(10, function() groupInviteFrame:UnregisterEvent("PARTY_INVITE_REQUEST") end, 1)
groupInviteFrame:UnregisterEvent("PARTY_INVITE_REQUEST")
end, 1)
return { "+" } return { "+" }
end end
local function LeaveGroup() local function LeaveGroup()
if Heimdall_Data.config.commander.debug then print(string.format("[%s] LeaveGroup command received", ModuleName)) end if Heimdall_Data.config.commander.debug then
print(string.format("[%s] LeaveGroup command received", ModuleName))
end
LeaveParty() LeaveParty()
return {} return {}
end end
---@param target string ---@param target string
local function FollowTarget(target) local function FollowTarget(target)
if Heimdall_Data.config.commander.debug then print(string.format("[%s] Following target: %s", ModuleName, target)) end if Heimdall_Data.config.commander.debug then
print(string.format("[%s] Following target: %s", ModuleName, target))
end
if not target then return end if not target then return end
FollowUnit(target) FollowUnit(target)
return {} return {}
@@ -218,14 +214,13 @@ function shared.Commander.Init()
---@param args string[] ---@param args string[]
local function MacroTarget(args) local function MacroTarget(args)
if Heimdall_Data.config.commander.debug then if Heimdall_Data.config.commander.debug then
print(string.format("[%s] Macroing: %s", ModuleName, ---@diagnostic disable-next-line: param-type-mismatch something wrong with luals, it's picking up the "wrong" unpack
strjoin(" ", unpack(args)))) print(string.format("[%s] Macroing: %s", ModuleName, strjoin(" ", unpack(args))))
end end
if #args < 2 or #args % 2 ~= 0 then if #args < 2 or #args % 2 ~= 0 then
if #args < 2 or #args % 2 ~= 0 then if #args < 2 or #args % 2 ~= 0 then
if Heimdall_Data.config.commander.debug then if Heimdall_Data.config.commander.debug then
print(string.format( print(string.format("[%s] Invalid number of arguments for MacroTarget", ModuleName))
"[%s] Invalid number of arguments for MacroTarget", ModuleName))
end end
return {} return {}
end end
@@ -243,7 +238,7 @@ function shared.Commander.Init()
name = name, name = name,
class = class or "unknown", class = class or "unknown",
seenAt = GetTime(), seenAt = GetTime(),
hostile = true hostile = true,
} }
end end
return {} return {}
@@ -255,15 +250,15 @@ function shared.Commander.Init()
---@field callback fun(...: any): string[] ---@field callback fun(...: any): string[]
local commands = { local commands = {
{ keywordRe = "^who$", commanderOnly = false, callback = WhoPartitionedStinkies }, { keywordRe = "^who$", commanderOnly = false, callback = WhoPartitionedStinkies },
{ keywordRe = "^howmany$", commanderOnly = false, callback = CountPartitionedStinkies }, { keywordRe = "^howmany$", commanderOnly = false, callback = CountPartitionedStinkies },
{ keywordRe = "^classes$", commanderOnly = false, callback = CountClassPartitionedStinkies }, { keywordRe = "^classes$", commanderOnly = false, callback = CountClassPartitionedStinkies },
{ keywordRe = "^help$", commanderOnly = false, callback = HelpRu }, { keywordRe = "^help$", commanderOnly = false, callback = HelpRu },
{ keywordRe = "^helpen$", commanderOnly = false, callback = HelpEn }, { keywordRe = "^helpen$", commanderOnly = false, callback = HelpEn },
{ keywordRe = "^joingroup$", commanderOnly = false, callback = JoinGroup }, { keywordRe = "^joingroup$", commanderOnly = false, callback = JoinGroup },
{ keywordRe = "^leavegroup$", commanderOnly = false, callback = LeaveGroup }, { keywordRe = "^leavegroup$", commanderOnly = false, callback = LeaveGroup },
{ keywordRe = "^follow$", commanderOnly = false, callback = FollowTarget }, { keywordRe = "^follow$", commanderOnly = false, callback = FollowTarget },
{ keywordRe = "^macro", commanderOnly = false, callback = MacroTarget }, { keywordRe = "^macro", commanderOnly = false, callback = MacroTarget },
} }
local commanderChannelFrame = CreateFrame("Frame") local commanderChannelFrame = CreateFrame("Frame")
@@ -290,8 +285,14 @@ function shared.Commander.Init()
end end
if not ok then if not ok then
if Heimdall_Data.config.commander.debug then if Heimdall_Data.config.commander.debug then
print(string.format("[%s] Channel name '%s' does not match any of the channels '%s'", ModuleName, print(
channelname, table.concat(Heimdall_Data.config.commander.channels, ", "))) string.format(
"[%s] Channel name '%s' does not match any of the channels '%s'",
ModuleName,
channelname,
table.concat(Heimdall_Data.config.commander.channels, ", ")
)
)
end end
return return
end end
@@ -307,28 +308,33 @@ function shared.Commander.Init()
if Heimdall_Data.config.commander.debug then if Heimdall_Data.config.commander.debug then
print(string.format("[%s] Command match: %s = %s", ModuleName, command.keywordRe, tostring(enabled))) print(string.format("[%s] Command match: %s = %s", ModuleName, command.keywordRe, tostring(enabled)))
end end
if enabled and if
(not command.commanderOnly enabled
or (command.commanderOnly and (
and sender == Heimdall_Data.config.commander.commander)) then not command.commanderOnly
or (command.commanderOnly and sender == Heimdall_Data.config.commander.commander)
)
then
if msg:match(command.keywordRe) then if msg:match(command.keywordRe) then
---@diagnostic disable-next-line: redundant-parameter Currently luals does not support variadic functions as a @field
local messages = command.callback({ strsplit(",", msg) }) local messages = command.callback({ strsplit(",", msg) })
if Heimdall_Data.config.commander.debug then if Heimdall_Data.config.commander.debug then
---@diagnostic disable-next-line: param-type-mismatch
print(string.format("[%s] Messages to send: %s", ModuleName, strjoin(", ", unpack(messages)))) print(string.format("[%s] Messages to send: %s", ModuleName, strjoin(", ", unpack(messages))))
end end
for _, message in ipairs(messages) do for _, message in ipairs(messages) do
---@type Message ---@type Message
local msg = { local returnmsg = {
channel = "C", channel = "C",
data = channelname, data = channelname,
message = message message = message,
} }
if Heimdall_Data.config.commander.debug then if Heimdall_Data.config.commander.debug then
print(string.format("[%s] Queuing message", ModuleName)) print(string.format("[%s] Queuing message", ModuleName))
shared.dumpTable(msg) shared.dumpTable(msg)
end end
--table.insert(shared.messenger.queue, msg) --table.insert(shared.messenger.queue, msg)
table.insert(shared.networkMessenger.queue, msg) table.insert(shared.networkMessenger.queue, returnmsg)
end end
end end
end end

File diff suppressed because it is too large Load Diff

View File

@@ -1,10 +1,7 @@
local addonname, shared = ... local _, shared = ...
---@cast shared HeimdallShared ---@cast shared HeimdallShared
---@cast addonname string
local ModuleName = "Configurator" local ModuleName = "Configurator"
---@diagnostic disable-next-line: missing-fields ---@diagnostic disable-next-line: missing-fields
shared.Configurator = {} shared.Configurator = {}
function shared.Configurator.Init() function shared.Configurator.Init() print(string.format("[Heimdall] %s module loaded", ModuleName)) end
print("[Heimdall] Configurator module loaded")
end

View File

@@ -1,6 +1,5 @@
local addonname, shared = ... local _, shared = ...
---@cast shared HeimdallShared ---@cast shared HeimdallShared
---@cast addonname string
local ModuleName = "DeathReporter" local ModuleName = "DeathReporter"
---@diagnostic disable-next-line: missing-fields ---@diagnostic disable-next-line: missing-fields
@@ -16,8 +15,15 @@ function shared.DeathReporter.Init()
---@param spellName string ---@param spellName string
local function RegisterDeath(source, destination, spellName) local function RegisterDeath(source, destination, spellName)
if Heimdall_Data.config.deathReporter.debug then if Heimdall_Data.config.deathReporter.debug then
print(string.format("[%s] Processing death event - Source: %s, Target: %s, Spell: %s", print(
ModuleName, source, destination, spellName)) string.format(
"[%s] Processing death event - Source: %s, Target: %s, Spell: %s",
ModuleName,
source,
destination,
spellName
)
)
end end
if not Heimdall_Data.config.deathReporter.enabled then if not Heimdall_Data.config.deathReporter.enabled then
@@ -27,27 +33,52 @@ function shared.DeathReporter.Init()
return return
end end
if recentDeaths[destination] and GetTime() - recentDeaths[destination] < Heimdall_Data.config.deathReporter.throttle then if
recentDeaths[destination]
and GetTime() - recentDeaths[destination] < Heimdall_Data.config.deathReporter.throttle
then
if Heimdall_Data.config.deathReporter.debug then if Heimdall_Data.config.deathReporter.debug then
local timeLeft = Heimdall_Data.config.deathReporter.throttle - (GetTime() - recentDeaths[destination]) local timeLeft = Heimdall_Data.config.deathReporter.throttle - (GetTime() - recentDeaths[destination])
print(string.format("[%s] Death report throttled for %s (%.1f seconds remaining)", print(
ModuleName, destination, timeLeft)) string.format(
"[%s] Death report throttled for %s (%.1f seconds remaining)",
ModuleName,
destination,
timeLeft
)
)
end end
return return
end end
if recentDuels[destination] and GetTime() - recentDuels[destination] < Heimdall_Data.config.deathReporter.duelThrottle then if
recentDuels[destination]
and GetTime() - recentDuels[destination] < Heimdall_Data.config.deathReporter.duelThrottle
then
if Heimdall_Data.config.deathReporter.debug then if Heimdall_Data.config.deathReporter.debug then
print(string.format("[%s] Ignoring death report - Recent duel detected for target: %s", ModuleName, print(
destination)) string.format(
"[%s] Ignoring death report - Recent duel detected for target: %s",
ModuleName,
destination
)
)
end end
return return
end end
if recentDuels[source] and GetTime() - recentDuels[source] < Heimdall_Data.config.deathReporter.duelThrottle then if
recentDuels[source]
and GetTime() - recentDuels[source] < Heimdall_Data.config.deathReporter.duelThrottle
then
if Heimdall_Data.config.deathReporter.debug then if Heimdall_Data.config.deathReporter.debug then
print(string.format("[%s] Ignoring death report - Recent duel detected for source: %s", ModuleName, print(
source)) string.format(
"[%s] Ignoring death report - Recent duel detected for source: %s",
ModuleName,
source
)
)
end end
return return
end end
@@ -58,25 +89,48 @@ function shared.DeathReporter.Init()
recentDeaths[destination] = GetTime() recentDeaths[destination] = GetTime()
C_Timer.NewTimer(3, function() C_Timer.NewTimer(3, function()
if recentDuels[destination] and GetTime() - recentDuels[destination] < Heimdall_Data.config.deathReporter.duelThrottle then if
recentDuels[destination]
and GetTime() - recentDuels[destination] < Heimdall_Data.config.deathReporter.duelThrottle
then
if Heimdall_Data.config.deathReporter.debug then if Heimdall_Data.config.deathReporter.debug then
print(string.format("[%s] Cancelling delayed death report - Recent duel detected for: %s", ModuleName, print(
destination)) string.format(
"[%s] Cancelling delayed death report - Recent duel detected for: %s",
ModuleName,
destination
)
)
end end
return return
end end
if recentDuels[source] and GetTime() - recentDuels[source] < Heimdall_Data.config.deathReporter.duelThrottle then if
recentDuels[source]
and GetTime() - recentDuels[source] < Heimdall_Data.config.deathReporter.duelThrottle
then
if Heimdall_Data.config.deathReporter.debug then if Heimdall_Data.config.deathReporter.debug then
print(string.format("[%s] Cancelling delayed death report - Recent duel detected for: %s", ModuleName, print(
source)) string.format(
"[%s] Cancelling delayed death report - Recent duel detected for: %s",
ModuleName,
source
)
)
end end
return return
end end
if Heimdall_Data.config.deathReporter.debug then if Heimdall_Data.config.deathReporter.debug then
print(string.format("[%s] Sending death report - %s killed %s with %s", print(
ModuleName, source, destination, spellName)) string.format(
"[%s] Sending death report - %s killed %s with %s",
ModuleName,
source,
destination,
spellName
)
)
end end
local zone, subzone = GetZoneText() or "Unknown", GetSubZoneText() or "Unknown" local zone, subzone = GetZoneText() or "Unknown", GetSubZoneText() or "Unknown"
@@ -95,18 +149,22 @@ function shared.DeathReporter.Init()
for _, channel in pairs(Heimdall_Data.config.deathReporter.channels) do for _, channel in pairs(Heimdall_Data.config.deathReporter.channels) do
local locale = shared.GetLocaleForChannel(channel) local locale = shared.GetLocaleForChannel(channel)
local text = string.format(shared._L("killed", locale), local text = string.format(
shared._L("killed", locale),
source, source,
destination, destination,
shared._L(spellName, locale), shared._L(spellName, locale),
shared._L(zone, locale), shared._L(subzone, locale), shared._L(zone, locale),
shared._L(subzone, locale),
zoneId, zoneId,
x * 100, y * 100) x * 100,
y * 100
)
---@type Message ---@type Message
local msg = { local msg = {
channel = "C", channel = "C",
data = channel, data = channel,
message = text message = text,
} }
if Heimdall_Data.config.deathReporter.debug then if Heimdall_Data.config.deathReporter.debug then
print(string.format("[%s] Queuing death report message", ModuleName)) print(string.format("[%s] Queuing death report message", ModuleName))
@@ -124,32 +182,33 @@ function shared.DeathReporter.Init()
-- print(string.format("[%s] Received combat log event", ModuleName)) -- print(string.format("[%s] Received combat log event", ModuleName))
-- end -- end
if not Heimdall_Data.config.deathReporter.enabled then return end if not Heimdall_Data.config.deathReporter.enabled then return end
local overkill, err = CLEUParser.GetOverkill(...) local overkill, source, destination, spellName, sourceGUID, destinationGUID, err
overkill, err = CLEUParser.GetOverkill(...)
if not err and overkill > 0 then if not err and overkill > 0 then
local source, err = CLEUParser.GetSourceName(...) source, err = CLEUParser.GetSourceName(...)
if err then if err then
source = "unknown" source = "unknown"
if Heimdall_Data.config.deathReporter.debug then if Heimdall_Data.config.deathReporter.debug then
print(string.format("[%s] Error getting source name", ModuleName)) print(string.format("[%s] Error getting source name", ModuleName))
end end
end end
local destination, err = CLEUParser.GetDestName(...) destination, err = CLEUParser.GetDestName(...)
if err then if err then
destination = "unknown" destination = "unknown"
if Heimdall_Data.config.deathReporter.debug then if Heimdall_Data.config.deathReporter.debug then
print(string.format("[%s] Error getting destination name", ModuleName)) print(string.format("[%s] Error getting destination name", ModuleName))
end end
end end
local spellName, err = CLEUParser.GetSpellName(...) spellName, err = CLEUParser.GetSpellName(...)
if err then if err then
spellName = "unknown" spellName = "unknown"
if Heimdall_Data.config.deathReporter.debug then if Heimdall_Data.config.deathReporter.debug then
print(string.format("[%s] Error getting spell name", ModuleName)) print(string.format("[%s] Error getting spell name", ModuleName))
end end
end end
local sourceGUID, err = CLEUParser.GetSourceGUID(...) sourceGUID, err = CLEUParser.GetSourceGUID(...)
if err or not string.match(sourceGUID, "Player") then return end if err or not string.match(sourceGUID, "Player") then return end
local destinationGUID, err = CLEUParser.GetDestGUID(...) destinationGUID, err = CLEUParser.GetDestGUID(...)
if err or not string.match(destinationGUID, "Player") then return end if err or not string.match(destinationGUID, "Player") then return end
RegisterDeath(source, destination, spellName) RegisterDeath(source, destination, spellName)
end end
@@ -162,7 +221,9 @@ function shared.DeathReporter.Init()
local source, destination = string.match(msg, "([^ ]+) has defeated ([^ ]+) in a duel") local source, destination = string.match(msg, "([^ ]+) has defeated ([^ ]+) in a duel")
if Heimdall_Data.config.deathReporter.debug then if Heimdall_Data.config.deathReporter.debug then
print(string.format("[%s] Received system message: %s", ModuleName, msg)) print(string.format("[%s] Received system message: %s", ModuleName, msg))
print(string.format("[%s] Source: %s, Destination: %s", ModuleName, tostring(source), tostring(destination))) print(
string.format("[%s] Source: %s, Destination: %s", ModuleName, tostring(source), tostring(destination))
)
end end
if not source or not destination then return end if not source or not destination then return end
source = string.match(source, "([^-]+)") source = string.match(source, "([^-]+)")
@@ -178,8 +239,14 @@ function shared.DeathReporter.Init()
end) end)
if Heimdall_Data.config.deathReporter.debug then if Heimdall_Data.config.deathReporter.debug then
print(string.format("[%s] Module initialized with throttle: %.1fs, duel throttle: %.1fs", print(
ModuleName, Heimdall_Data.config.deathReporter.throttle, Heimdall_Data.config.deathReporter.duelThrottle)) string.format(
"[%s] Module initialized with throttle: %.1fs, duel throttle: %.1fs",
ModuleName,
Heimdall_Data.config.deathReporter.throttle,
Heimdall_Data.config.deathReporter.duelThrottle
)
)
end end
print("[Heimdall] DeathReporter loaded") print("[Heimdall] DeathReporter loaded")
end end

View File

@@ -1,6 +1,5 @@
local addonname, shared = ... local _, shared = ...
---@cast shared HeimdallShared ---@cast shared HeimdallShared
---@cast addonname string
local ModuleName = "Dueler" local ModuleName = "Dueler"
---@diagnostic disable-next-line: missing-fields ---@diagnostic disable-next-line: missing-fields
@@ -44,8 +43,13 @@ function shared.Dueler.Init()
end) end)
if Heimdall_Data.config.dueler.debug then if Heimdall_Data.config.dueler.debug then
print(string.format("[%s] Module initialized with auto-decline: %s", ModuleName, print(
tostring(Heimdall_Data.config.dueler.declineOther))) string.format(
"[%s] Module initialized with auto-decline: %s",
ModuleName,
tostring(Heimdall_Data.config.dueler.declineOther)
)
)
end end
print("[Heimdall] Dueler loaded") print("[Heimdall] Dueler loaded")
end end

View File

@@ -1,6 +1,5 @@
local addonname, shared = ... local _, shared = ...
---@cast shared HeimdallShared ---@cast shared HeimdallShared
---@cast addonname string
if not shared.dumpTable then if not shared.dumpTable then
---@param table table ---@param table table
@@ -10,15 +9,13 @@ if not shared.dumpTable then
print(tostring(table)) print(tostring(table))
return return
end end
if depth == nil then if depth == nil then depth = 0 end
depth = 0 if depth > 200 then
end
if (depth > 200) then
print("Error: Depth > 200 in dumpTable()") print("Error: Depth > 200 in dumpTable()")
return return
end end
for k, v in pairs(table) do for k, v in pairs(table) do
if (type(v) == "table") then if type(v) == "table" then
print(string.rep(" ", depth) .. k .. ":") print(string.rep(" ", depth) .. k .. ":")
shared.dumpTable(v, depth + 1) shared.dumpTable(v, depth + 1)
else else

View File

@@ -1,6 +1,5 @@
local addonname, shared = ... local _, shared = ...
---@cast shared HeimdallShared ---@cast shared HeimdallShared
---@cast addonname string
local ModuleName = "Echoer" local ModuleName = "Echoer"
---@diagnostic disable-next-line: missing-fields ---@diagnostic disable-next-line: missing-fields
@@ -44,18 +43,16 @@ function shared.Echoer.Init()
if Heimdall_Data.config.echoer.debug then if Heimdall_Data.config.echoer.debug then
print(string.format("[%s] Found echo command in message: %s", ModuleName, msg)) print(string.format("[%s] Found echo command in message: %s", ModuleName, msg))
end end
local msg = string.sub(msg, string.len(Heimdall_Data.config.echoer.prefix) + 1) local echomsg = string.sub(msg, string.len(Heimdall_Data.config.echoer.prefix) + 1)
if Heimdall_Data.config.echoer.debug then if Heimdall_Data.config.echoer.debug then
print(string.format("[%s] Echoing message: %s", ModuleName, msg)) print(string.format("[%s] Echoing message: %s", ModuleName, echomsg))
end end
SendChatMessage(msg, "SAY") SendChatMessage(echomsg, "SAY")
elseif Heimdall_Data.config.echoer.debug then elseif Heimdall_Data.config.echoer.debug then
print(string.format("[%s] Message does not start with echo prefix", ModuleName)) print(string.format("[%s] Message does not start with echo prefix", ModuleName))
end end
end) end)
if Heimdall_Data.config.echoer.debug then if Heimdall_Data.config.echoer.debug then print(string.format("[%s] Module initialized", ModuleName)) end
print(string.format("[%s] Module initialized", ModuleName))
end
print("[Heimdall] Echoer loaded") print("[Heimdall] Echoer loaded")
end end

View File

@@ -1,6 +1,5 @@
local addonname, shared = ... local _, shared = ...
---@cast shared HeimdallShared ---@cast shared HeimdallShared
---@cast addonname string
local ModuleName = "Emoter" local ModuleName = "Emoter"
---@diagnostic disable-next-line: missing-fields ---@diagnostic disable-next-line: missing-fields
@@ -55,8 +54,6 @@ function shared.Emoter.Init()
end end
end) end)
if Heimdall_Data.config.emoter.debug then if Heimdall_Data.config.emoter.debug then print(string.format("[%s] Module initialized", ModuleName)) end
print(string.format("[%s] Module initialized", ModuleName))
end
print("[Heimdall] Emoter loaded") print("[Heimdall] Emoter loaded")
end end

View File

@@ -1,14 +1,14 @@
local addonname, shared = ... local _, shared = ...
---@cast shared HeimdallShared ---@cast shared HeimdallShared
---@cast addonname string
local ModuleName = "Inviter" local ModuleName = "Inviter"
---@diagnostic disable-next-line: missing-fields ---@diagnostic disable-next-line: missing-fields
shared.Inviter = {} shared.Inviter = {}
function shared.Inviter.Init() function shared.Inviter.Init()
-- Fallback for old config
if type(Heimdall_Data.config.inviter.listeningChannel) == "string" then if type(Heimdall_Data.config.inviter.listeningChannel) == "string" then
Heimdall_Data.config.inviter.listeningChannel = { Heimdall_Data.config.inviter.listeningChannel = {
[Heimdall_Data.config.inviter.listeningChannel] = true [Heimdall_Data.config.inviter.listeningChannel] = true,
} }
end end
---@type Timer ---@type Timer
@@ -36,7 +36,9 @@ function shared.Inviter.Init()
if Heimdall_Data.config.inviter.agentsAssist then if Heimdall_Data.config.inviter.agentsAssist then
if Heimdall_Data.config.inviter.debug then if Heimdall_Data.config.inviter.debug then
local agentCount = 0 local agentCount = 0
for _ in pairs(Heimdall_Data.config.agents) do agentCount = agentCount + 1 end for _ in pairs(Heimdall_Data.config.agents) do
agentCount = agentCount + 1
end
print(string.format("[%s] Processing %d agents for assistant promotion", ModuleName, agentCount)) print(string.format("[%s] Processing %d agents for assistant promotion", ModuleName, agentCount))
end end
@@ -100,10 +102,18 @@ function shared.Inviter.Init()
local frame = FindPlayerRaidFrame(name) local frame = FindPlayerRaidFrame(name)
if frame then if frame then
playerButtons[name] = frame playerButtons[name] = frame
local button = framePool[frame.unit] or CreateFrame("Button", -- All of these are ELVUI specific so they won't be in our meta...
string.format("HeimdallKickButton%s", frame.unit, frame, "SecureActionButtonTemplate")) ---@diagnostic disable-next-line: undefined-field
local button = framePool[frame.unit]
or CreateFrame(
"Button",
---@diagnostic disable-next-line: undefined-field
string.format("HeimdallKickButton%s", frame.unit, frame, "SecureActionButtonTemplate")
)
---@diagnostic disable-next-line: undefined-field
framePool[frame.unit] = button framePool[frame.unit] = button
---@diagnostic disable-next-line: undefined-field
button:SetSize(frame.UNIT_WIDTH / 2, frame.UNIT_HEIGHT / 2) button:SetSize(frame.UNIT_WIDTH / 2, frame.UNIT_HEIGHT / 2)
button:SetPoint("CENTER", frame, "CENTER", 0, 0) button:SetPoint("CENTER", frame, "CENTER", 0, 0)
button:SetNormalTexture("Interface\\Buttons\\UI-GroupLoot-KickIcon") button:SetNormalTexture("Interface\\Buttons\\UI-GroupLoot-KickIcon")
@@ -142,9 +152,7 @@ function shared.Inviter.Init()
groupMembers[name] = now groupMembers[name] = now
else else
local online = UnitIsConnected(unit) local online = UnitIsConnected(unit)
if online then if online then groupMembers[name] = now end
groupMembers[name] = now
end
end end
end end
end end
@@ -221,9 +229,7 @@ function shared.Inviter.Init()
return return
end end
if msg == Heimdall_Data.config.inviter.keyword then if msg == Heimdall_Data.config.inviter.keyword then
if Heimdall_Data.config.inviter.debug then if Heimdall_Data.config.inviter.debug then print(string.format("[%s] Inviting %s", ModuleName, sender)) end
print(string.format("[%s] Inviting %s", ModuleName, sender))
end
InviteUnit(sender) InviteUnit(sender)
else else
if Heimdall_Data.config.inviter.debug then if Heimdall_Data.config.inviter.debug then
@@ -233,17 +239,25 @@ function shared.Inviter.Init()
end) end)
if Heimdall_Data.config.inviter.debug then if Heimdall_Data.config.inviter.debug then
print(string.format("[%s] Module initialized - All assist: %s, Agents assist: %s", print(
ModuleName, string.format(
tostring(Heimdall_Data.config.inviter.allAssist), "[%s] Module initialized - All assist: %s, Agents assist: %s",
tostring(Heimdall_Data.config.inviter.agentsAssist))) ModuleName,
tostring(Heimdall_Data.config.inviter.allAssist),
tostring(Heimdall_Data.config.inviter.agentsAssist)
)
)
end end
if Heimdall_Data.config.inviter.debug then if Heimdall_Data.config.inviter.debug then
print(string.format("[%s] Module initialized - All assist: %s, Agents assist: %s", print(
ModuleName, string.format(
tostring(Heimdall_Data.config.inviter.allAssist), "[%s] Module initialized - All assist: %s, Agents assist: %s",
tostring(Heimdall_Data.config.inviter.agentsAssist))) ModuleName,
tostring(Heimdall_Data.config.inviter.allAssist),
tostring(Heimdall_Data.config.inviter.agentsAssist)
)
)
end end
print("[Heimdall] Inviter loaded") print("[Heimdall] Inviter loaded")
end end

View File

@@ -1,107 +1,101 @@
local addonname, shared = ... local _, shared = ...
---@cast shared HeimdallShared ---@cast shared HeimdallShared
---@cast addonname string
local ModuleName = "Macroer" local ModuleName = "Macroer"
---@diagnostic disable-next-line: missing-fields ---@diagnostic disable-next-line: missing-fields
shared.Macroer = {} shared.Macroer = {}
function shared.Macroer.Init() function shared.Macroer.Init()
---@class stinky ---@class stinky
---@field name string ---@field name string
---@field class string ---@field class string
---@field seenAt number ---@field seenAt number
---@field hostile boolean ---@field hostile boolean
local function FindOrCreateMacro(macroName) local function FindOrCreateMacro(macroName)
if Heimdall_Data.config.macroer.debug then if Heimdall_Data.config.macroer.debug then
print(string.format("[%s] Finding or creating macro: %s", ModuleName, macroName)) print(string.format("[%s] Finding or creating macro: %s", ModuleName, macroName))
end end
local idx = GetMacroIndexByName(macroName) local idx = GetMacroIndexByName(macroName)
if idx == 0 then if idx == 0 then
if Heimdall_Data.config.macroer.debug then if Heimdall_Data.config.macroer.debug then
print(string.format("[%s] Creating new macro: %s", ModuleName, macroName)) print(string.format("[%s] Creating new macro: %s", ModuleName, macroName))
end end
CreateMacro(macroName, "INV_Misc_QuestionMark", "") CreateMacro(macroName, "INV_Misc_QuestionMark", "")
end end
idx = GetMacroIndexByName(macroName) idx = GetMacroIndexByName(macroName)
if Heimdall_Data.config.macroer.debug then if Heimdall_Data.config.macroer.debug then print(string.format("[%s] Macro index: %d", ModuleName, idx)) end
print(string.format("[%s] Macro index: %d", ModuleName, idx)) return idx
end end
return idx
end
---@param stinkies table<string, stinky> ---@param stinkies table<string, stinky>
local function FixMacro(stinkies) local function FixMacro(stinkies)
if Heimdall_Data.config.macroer.debug then if Heimdall_Data.config.macroer.debug then
print(string.format("[%s] Fixing macro with %d stinkies", ModuleName, #stinkies)) print(string.format("[%s] Fixing macro with %d stinkies", ModuleName, #stinkies))
end end
if not Heimdall_Data.config.macroer.enabled then if not Heimdall_Data.config.macroer.enabled then
if Heimdall_Data.config.macroer.debug then if Heimdall_Data.config.macroer.debug then
print(string.format("[%s] Module disabled, skipping macro update", ModuleName)) print(string.format("[%s] Module disabled, skipping macro update", ModuleName))
end end
return return
end end
if InCombatLockdown() then if InCombatLockdown() then
if Heimdall_Data.config.macroer.debug then if Heimdall_Data.config.macroer.debug then
print(string.format("[%s] In combat, skipping macro update", ModuleName)) print(string.format("[%s] In combat, skipping macro update", ModuleName))
end end
return return
end end
local priorityMap = {} local priorityMap = {}
for priority, className in ipairs(Heimdall_Data.config.macroer.priority) do for priority, className in ipairs(Heimdall_Data.config.macroer.priority) do
priorityMap[className] = priority priorityMap[className] = priority
end end
local minPriority = #Heimdall_Data.config.macroer.priority + 1 local minPriority = #Heimdall_Data.config.macroer.priority + 1
local sortedStinkies = {} local sortedStinkies = {}
for _, stinky in pairs(stinkies) do for _, stinky in pairs(stinkies) do
if not Heimdall_Data.config.agents[stinky.name] then if not Heimdall_Data.config.agents[stinky.name] then sortedStinkies[#sortedStinkies + 1] = stinky end
sortedStinkies[#sortedStinkies + 1] = stinky end
end
end
if Heimdall_Data.config.macroer.debug then if Heimdall_Data.config.macroer.debug then
print(string.format("[%s] Processing %d non-agent stinkies", ModuleName, #sortedStinkies)) print(string.format("[%s] Processing %d non-agent stinkies", ModuleName, #sortedStinkies))
end end
table.sort(sortedStinkies, function(a, b) table.sort(sortedStinkies, function(a, b)
local aPriority = priorityMap[a.class] or minPriority local aPriority = priorityMap[a.class] or minPriority
local bPriority = priorityMap[b.class] or minPriority local bPriority = priorityMap[b.class] or minPriority
return aPriority > bPriority return aPriority > bPriority
end) end)
if Heimdall_Data.config.macroer.debug then if Heimdall_Data.config.macroer.debug then
print(string.format("[%s] Sorted stinkies: %d", ModuleName, #sortedStinkies)) print(string.format("[%s] Sorted stinkies: %d", ModuleName, #sortedStinkies))
shared.dumpTable(sortedStinkies) shared.dumpTable(sortedStinkies)
end end
local lines = { "/targetenemy" } local lines = { "/targetenemy" }
for _, stinky in pairs(sortedStinkies) do for _, stinky in pairs(sortedStinkies) do
if stinky.seenAt > GetTime() - 600 then if stinky.seenAt > GetTime() - 600 then
if Heimdall_Data.config.macroer.debug then if Heimdall_Data.config.macroer.debug then
print(string.format("[%s] Adding target macro for: %s", ModuleName, stinky.name)) print(string.format("[%s] Adding target macro for: %s", ModuleName, stinky.name))
end end
lines[#lines + 1] = string.format("/tar %s", stinky.name) lines[#lines + 1] = string.format("/tar %s", stinky.name)
end end
end end
local idx = FindOrCreateMacro("HeimdallTarget") local idx = FindOrCreateMacro("HeimdallTarget")
local body = strjoin("\n", unpack(lines)) ---@diagnostic disable-next-line: param-type-mismatch
if Heimdall_Data.config.macroer.debug then local body = strjoin("\n", unpack(lines))
print(string.format("[%s] Updating macro with %d lines", ModuleName, #lines)) if Heimdall_Data.config.macroer.debug then
end print(string.format("[%s] Updating macro with %d lines", ModuleName, #lines))
EditMacro(idx, "HeimdallTarget", "INV_Misc_QuestionMark", body) end
end EditMacro(idx, "HeimdallTarget", "INV_Misc_QuestionMark", body)
end
shared.stinkyTracker.stinkies:onChange(function(value) shared.stinkyTracker.stinkies:onChange(function(value)
if Heimdall_Data.config.macroer.debug then if Heimdall_Data.config.macroer.debug then
print(string.format("[%s] Stinkies changed, updating macro", ModuleName)) print(string.format("[%s] Stinkies changed, updating macro", ModuleName))
end end
FixMacro(value) FixMacro(value)
end) end)
if Heimdall_Data.config.macroer.debug then if Heimdall_Data.config.macroer.debug then print(string.format("[%s] Module initialized", ModuleName)) end
print(string.format("[%s] Module initialized", ModuleName)) print("[Heimdall] Macroer loaded")
end
print("[Heimdall] Macroer loaded")
end end

View File

@@ -1,6 +1,5 @@
local addonname, shared = ... local _, shared = ...
---@cast shared HeimdallShared ---@cast shared HeimdallShared
---@cast addonname string
local ModuleName = "Messenger" local ModuleName = "Messenger"
---@diagnostic disable-next-line: missing-fields ---@diagnostic disable-next-line: missing-fields
@@ -35,45 +34,74 @@ function shared.Messenger.Init()
if not shared.messenger.queue then shared.messenger.queue = {} end if not shared.messenger.queue then shared.messenger.queue = {} end
if not shared.messenger.ticker then if not shared.messenger.ticker then
local function DoMessage() local function DoMessage()
--if Heimdall_Data.config.messenger.debug then if Heimdall_Data.config.messenger.debug then
-- print(string.format("[%s] Processing message queue", ModuleName)) print(string.format("[%s] Processing message queue - Size: %d", ModuleName, #shared.messenger.queue))
--end end
if not Heimdall_Data.config.messenger.enabled then if not Heimdall_Data.config.messenger.enabled then
--if Heimdall_Data.config.messenger.debug then if Heimdall_Data.config.messenger.debug then
-- print(string.format("[%s] Module disabled, skipping message processing", ModuleName)) print(string.format("[%s] Module disabled, skipping message processing", ModuleName))
--end end
return return
end end
---@type Message ---@type Message
local message = shared.messenger.queue[1] local message = shared.messenger.queue[1]
if not message then if not message then
--if Heimdall_Data.config.messenger.debug then if Heimdall_Data.config.messenger.debug then
-- print(string.format("[%s] Message queue empty", ModuleName)) print(string.format("[%s] Message queue empty", ModuleName))
--end end
return return
end end
if Heimdall_Data.config.messenger.debug then
print(
string.format(
"[%s] Processing message - Channel: %s, Data: %s",
ModuleName,
message.channel or "nil",
message.data or "nil"
)
)
print(string.format("[%s] Message content: %s", ModuleName, message.message or "nil"))
end
if not message.message or message.message == "" then if not message.message or message.message == "" then
if Heimdall_Data.config.messenger.debug then if Heimdall_Data.config.messenger.debug then
print(string.format("[%s] Invalid message: empty content", ModuleName)) print(string.format("[%s] Invalid message: empty content", ModuleName))
end end
return return
end end
if not message.channel or message.channel == "" then if not message.channel or message.channel == "" then
if Heimdall_Data.config.messenger.debug then if Heimdall_Data.config.messenger.debug then
print(string.format("[%s] Invalid message: no channel specified", ModuleName)) print(string.format("[%s] Invalid message: no channel specified", ModuleName))
end end
return return
end end
if string.find(message.channel, "^C") then if string.find(message.channel, "^C") then
if Heimdall_Data.config.messenger.debug then
print(string.format("[%s] Converting channel type from C to CHANNEL", ModuleName))
end
message.channel = "CHANNEL" message.channel = "CHANNEL"
elseif string.find(message.channel, "^W") then elseif string.find(message.channel, "^W") then
if Heimdall_Data.config.messenger.debug then
print(string.format("[%s] Converting channel type from W to WHISPER", ModuleName))
end
message.channel = "WHISPER" message.channel = "WHISPER"
end end
if message.channel == "CHANNEL" and message.data and string.match(message.data, "%D") then if message.channel == "CHANNEL" and message.data and string.match(message.data, "%D") then
if Heimdall_Data.config.messenger.debug then if Heimdall_Data.config.messenger.debug then
print(string.format("[%s] Processing channel message: '%s' to '%s'", ModuleName, message.message, print(
message.data)) string.format(
"[%s] Processing channel message: '%s' to '%s'",
ModuleName,
message.message,
message.data
)
)
end end
local channelId = GetChannelName(message.data) local channelId = GetChannelName(message.data)
if channelId == 0 then if channelId == 0 then
@@ -109,8 +137,15 @@ function shared.Messenger.Init()
end end
if Heimdall_Data.config.messenger.debug then if Heimdall_Data.config.messenger.debug then
print(string.format("[%s] Sending message: '%s' to %s:%s", ModuleName, message.message, message.channel, print(
message.data)) string.format(
"[%s] Sending message: '%s' to %s:%s",
ModuleName,
message.message,
message.channel,
message.data
)
)
end end
if string.len(message.message) > 255 then if string.len(message.message) > 255 then
print(string.format("[%s] Message too long!!!!: %s", ModuleName, message.message)) print(string.format("[%s] Message too long!!!!: %s", ModuleName, message.message))
@@ -119,10 +154,9 @@ function shared.Messenger.Init()
SendChatMessage(message.message, message.channel, nil, message.data) SendChatMessage(message.message, message.channel, nil, message.data)
end end
local function Tick() local function Tick()
--if Heimdall_Data.config.messenger.debug then if Heimdall_Data.config.messenger.debug then
-- local queueSize = #shared.messenger.queue print(string.format("[%s] Tick - Queue size: %d", ModuleName, #shared.messenger.queue))
-- print(string.format("[%s] Queue check - Messages pending: %d", ModuleName, queueSize)) end
--end
DoMessage() DoMessage()
shared.messenger.ticker = C_Timer.NewTimer(Heimdall_Data.config.messenger.interval, Tick, 1) shared.messenger.ticker = C_Timer.NewTimer(Heimdall_Data.config.messenger.interval, Tick, 1)
end end
@@ -130,8 +164,13 @@ function shared.Messenger.Init()
end end
if Heimdall_Data.config.messenger.debug then if Heimdall_Data.config.messenger.debug then
print(string.format("[%s] Module initialized with interval: %s", ModuleName, print(
Heimdall_Data.config.messenger.interval)) string.format(
"[%s] Module initialized with interval: %s",
ModuleName,
Heimdall_Data.config.messenger.interval
)
)
end end
print("[Heimdall] Messenger loaded") print("[Heimdall] Messenger loaded")
end end

View File

@@ -1,6 +1,5 @@
local addonname, shared = ... local _, shared = ...
---@cast shared HeimdallShared ---@cast shared HeimdallShared
---@cast addonname string
local ModuleName = "MinimapTagger" local ModuleName = "MinimapTagger"
local HeimdallRoot = "Interface\\AddOns\\Heimdall\\" local HeimdallRoot = "Interface\\AddOns\\Heimdall\\"
local SoundRoot = HeimdallRoot .. "Sounds\\" local SoundRoot = HeimdallRoot .. "Sounds\\"
@@ -56,7 +55,7 @@ function shared.MinimapTagger.Init()
self:SetAlpha(1) self:SetAlpha(1)
self.custom.busy = true self.custom.busy = true
self.custom.progress = 0 self.custom.progress = 0
self:SetScript("OnUpdate", function(self, elapsed) self:SetScript("OnUpdate", function(selff, elapsed)
self.custom.progress = self.custom.progress + elapsed self.custom.progress = self.custom.progress + elapsed
local progress = self.custom.progress / ttl local progress = self.custom.progress / ttl
-- if Heimdall_Data.config.minimapTagger.debug then -- if Heimdall_Data.config.minimapTagger.debug then
@@ -89,14 +88,21 @@ function shared.MinimapTagger.Init()
table.insert(alertFramePool, frame) table.insert(alertFramePool, frame)
end end
local muteAlertUntil = 0 local muteAlertUntil = 0
---@param x number ---@param x number|nil
---@param y number ---@param y number|nil
---@param scale number? ---@param scale number?
---@param doTag boolean? ---@param doTag boolean?
local function PlantAlert(x, y, scale, doTag) local function PlantAlert(x, y, scale, doTag)
if x == nil or y == nil then
if Heimdall_Data.config.minimapTagger.debug then
print(string.format("[%s] Alert position is nil, ignoring", ModuleName))
end
return
end
if doTag == nil then doTag = true end if doTag == nil then doTag = true end
local frame = nil local frame = nil
for _, alertFrame in ipairs(alertFramePool) do for _, alertFrame in ipairs(alertFramePool) do
---@diagnostic disable-next-line: undefined-field
if not alertFrame.custom.busy then if not alertFrame.custom.busy then
frame = alertFrame frame = alertFrame
break break
@@ -110,8 +116,13 @@ function shared.MinimapTagger.Init()
end end
if Heimdall_Data.config.minimapTagger.alertSound then if Heimdall_Data.config.minimapTagger.alertSound then
if Heimdall_Data.config.minimapTagger.debug then if Heimdall_Data.config.minimapTagger.debug then
print(string.format("[%s] Playing alert sound: %s", ModuleName, print(
Heimdall_Data.config.minimapTagger.alertSoundFile)) string.format(
"[%s] Playing alert sound: %s",
ModuleName,
Heimdall_Data.config.minimapTagger.alertSoundFile
)
)
end end
if muteAlertUntil > GetTime() then if muteAlertUntil > GetTime() then
if Heimdall_Data.config.minimapTagger.debug then if Heimdall_Data.config.minimapTagger.debug then
@@ -121,14 +132,17 @@ function shared.MinimapTagger.Init()
muteAlertUntil = GetTime() + Heimdall_Data.config.minimapTagger.alertSoundThrottle muteAlertUntil = GetTime() + Heimdall_Data.config.minimapTagger.alertSoundThrottle
local ok = PlaySoundFile(SoundRoot .. Heimdall_Data.config.minimapTagger.alertSoundFile, "Master") local ok = PlaySoundFile(SoundRoot .. Heimdall_Data.config.minimapTagger.alertSoundFile, "Master")
if not ok and Heimdall_Data.config.minimapTagger.debug then if not ok and Heimdall_Data.config.minimapTagger.debug then
print(string.format("[%s] Failed to play alert sound: %s", ModuleName, print(
Heimdall_Data.config.minimapTagger.alertSoundFile)) string.format(
"[%s] Failed to play alert sound: %s",
ModuleName,
Heimdall_Data.config.minimapTagger.alertSoundFile
)
)
end end
end end
end end
if doTag then if doTag then PlantFrame(x, y, frame, scale, Heimdall_Data.config.minimapTagger.alertTTL) end
PlantFrame(x, y, frame, scale, Heimdall_Data.config.minimapTagger.alertTTL)
end
end end
--endregion --endregion
@@ -145,14 +159,21 @@ function shared.MinimapTagger.Init()
table.insert(tagFramePool, frame) table.insert(tagFramePool, frame)
end end
local muteTagUntil = 0 local muteTagUntil = 0
---@param x number ---@param x number|nil
---@param y number ---@param y number|nil
---@param scale number? ---@param scale number?
---@param doTag boolean? ---@param doTag boolean?
local function PlantTag(x, y, scale, doTag) local function PlantTag(x, y, scale, doTag)
if x == nil or y == nil then
if Heimdall_Data.config.minimapTagger.debug then
print(string.format("[%s] Tag position is nil, ignoring", ModuleName))
end
return
end
if doTag == nil then doTag = true end if doTag == nil then doTag = true end
local frame = nil local frame = nil
for _, tagFrame in ipairs(tagFramePool) do for _, tagFrame in ipairs(tagFramePool) do
---@diagnostic disable-next-line: undefined-field
if not tagFrame.custom.busy then if not tagFrame.custom.busy then
frame = tagFrame frame = tagFrame
break break
@@ -166,8 +187,13 @@ function shared.MinimapTagger.Init()
end end
if Heimdall_Data.config.minimapTagger.tagSound then if Heimdall_Data.config.minimapTagger.tagSound then
if Heimdall_Data.config.minimapTagger.debug then if Heimdall_Data.config.minimapTagger.debug then
print(string.format("[%s] Playing tag sound: %s", ModuleName, print(
Heimdall_Data.config.minimapTagger.tagSoundFile)) string.format(
"[%s] Playing tag sound: %s",
ModuleName,
Heimdall_Data.config.minimapTagger.tagSoundFile
)
)
end end
if muteTagUntil > GetTime() then if muteTagUntil > GetTime() then
if Heimdall_Data.config.minimapTagger.debug then if Heimdall_Data.config.minimapTagger.debug then
@@ -177,14 +203,17 @@ function shared.MinimapTagger.Init()
muteTagUntil = GetTime() + Heimdall_Data.config.minimapTagger.tagSoundThrottle muteTagUntil = GetTime() + Heimdall_Data.config.minimapTagger.tagSoundThrottle
local ok = PlaySoundFile(SoundRoot .. Heimdall_Data.config.minimapTagger.tagSoundFile, "Master") local ok = PlaySoundFile(SoundRoot .. Heimdall_Data.config.minimapTagger.tagSoundFile, "Master")
if not ok and Heimdall_Data.config.minimapTagger.debug then if not ok and Heimdall_Data.config.minimapTagger.debug then
print(string.format("[%s] Failed to play tag sound: %s", ModuleName, print(
Heimdall_Data.config.minimapTagger.tagSoundFile)) string.format(
"[%s] Failed to play tag sound: %s",
ModuleName,
Heimdall_Data.config.minimapTagger.tagSoundFile
)
)
end end
end end
end end
if doTag then if doTag then PlantFrame(x, y, frame, scale, Heimdall_Data.config.minimapTagger.tagTTL) end
PlantFrame(x, y, frame, scale, Heimdall_Data.config.minimapTagger.tagTTL)
end
end end
--endregion --endregion
@@ -201,14 +230,21 @@ function shared.MinimapTagger.Init()
table.insert(combatFramePool, frame) table.insert(combatFramePool, frame)
end end
local muteCombatUntil = 0 local muteCombatUntil = 0
---@param x number ---@param x number|nil
---@param y number ---@param y number|nil
---@param scale number? ---@param scale number?
---@param doTag boolean? ---@param doTag boolean?
local function PlantCombat(x, y, scale, doTag) local function PlantCombat(x, y, scale, doTag)
if x == nil or y == nil then
if Heimdall_Data.config.minimapTagger.debug then
print(string.format("[%s] Combat position is nil, ignoring", ModuleName))
end
return
end
if doTag == nil then doTag = true end if doTag == nil then doTag = true end
local frame = nil local frame = nil
for _, combatFrame in ipairs(combatFramePool) do for _, combatFrame in ipairs(combatFramePool) do
---@diagnostic disable-next-line: undefined-field
if not combatFrame.custom.busy then if not combatFrame.custom.busy then
frame = combatFrame frame = combatFrame
break break
@@ -222,8 +258,13 @@ function shared.MinimapTagger.Init()
end end
if Heimdall_Data.config.minimapTagger.combatSound then if Heimdall_Data.config.minimapTagger.combatSound then
if Heimdall_Data.config.minimapTagger.debug then if Heimdall_Data.config.minimapTagger.debug then
print(string.format("[%s] Playing combat sound: %s", ModuleName, print(
Heimdall_Data.config.minimapTagger.combatSoundFile)) string.format(
"[%s] Playing combat sound: %s",
ModuleName,
Heimdall_Data.config.minimapTagger.combatSoundFile
)
)
end end
if muteCombatUntil > GetTime() then if muteCombatUntil > GetTime() then
if Heimdall_Data.config.minimapTagger.debug then if Heimdall_Data.config.minimapTagger.debug then
@@ -233,14 +274,17 @@ function shared.MinimapTagger.Init()
muteCombatUntil = GetTime() + Heimdall_Data.config.minimapTagger.combatSoundThrottle muteCombatUntil = GetTime() + Heimdall_Data.config.minimapTagger.combatSoundThrottle
local ok = PlaySoundFile(SoundRoot .. Heimdall_Data.config.minimapTagger.combatSoundFile, "Master") local ok = PlaySoundFile(SoundRoot .. Heimdall_Data.config.minimapTagger.combatSoundFile, "Master")
if not ok and Heimdall_Data.config.minimapTagger.debug then if not ok and Heimdall_Data.config.minimapTagger.debug then
print(string.format("[%s] Failed to play combat sound: %s", ModuleName, print(
Heimdall_Data.config.minimapTagger.combatSoundFile)) string.format(
"[%s] Failed to play combat sound: %s",
ModuleName,
Heimdall_Data.config.minimapTagger.combatSoundFile
)
)
end end
end end
end end
if doTag then if doTag then PlantFrame(x, y, frame, scale, Heimdall_Data.config.minimapTagger.combatTTL) end
PlantFrame(x, y, frame, scale, Heimdall_Data.config.minimapTagger.combatTTL)
end
end end
--endregion --endregion
@@ -257,14 +301,21 @@ function shared.MinimapTagger.Init()
table.insert(helpFramePool, frame) table.insert(helpFramePool, frame)
end end
local muteHelpUntil = 0 local muteHelpUntil = 0
---@param x number ---@param x number|nil
---@param y number ---@param y number|nil
---@param scale number? ---@param scale number?
---@param doTag boolean? ---@param doTag boolean?
local function PlantHelp(x, y, scale, doTag) local function PlantHelp(x, y, scale, doTag)
if x == nil or y == nil then
if Heimdall_Data.config.minimapTagger.debug then
print(string.format("[%s] Help position is nil, ignoring", ModuleName))
end
return
end
if doTag == nil then doTag = true end if doTag == nil then doTag = true end
local frame = nil local frame = nil
for _, helpFrame in ipairs(helpFramePool) do for _, helpFrame in ipairs(helpFramePool) do
---@diagnostic disable-next-line: undefined-field
if not helpFrame.custom.busy then if not helpFrame.custom.busy then
frame = helpFrame frame = helpFrame
break break
@@ -278,8 +329,13 @@ function shared.MinimapTagger.Init()
end end
if Heimdall_Data.config.minimapTagger.helpSound then if Heimdall_Data.config.minimapTagger.helpSound then
if Heimdall_Data.config.minimapTagger.debug then if Heimdall_Data.config.minimapTagger.debug then
print(string.format("[%s] Playing help sound: %s", ModuleName, print(
Heimdall_Data.config.minimapTagger.helpSoundFile)) string.format(
"[%s] Playing help sound: %s",
ModuleName,
Heimdall_Data.config.minimapTagger.helpSoundFile
)
)
end end
if muteHelpUntil > GetTime() then if muteHelpUntil > GetTime() then
if Heimdall_Data.config.minimapTagger.debug then if Heimdall_Data.config.minimapTagger.debug then
@@ -289,14 +345,17 @@ function shared.MinimapTagger.Init()
muteHelpUntil = GetTime() + Heimdall_Data.config.minimapTagger.helpSoundThrottle muteHelpUntil = GetTime() + Heimdall_Data.config.minimapTagger.helpSoundThrottle
local ok = PlaySoundFile(SoundRoot .. Heimdall_Data.config.minimapTagger.helpSoundFile, "Master") local ok = PlaySoundFile(SoundRoot .. Heimdall_Data.config.minimapTagger.helpSoundFile, "Master")
if not ok and Heimdall_Data.config.minimapTagger.debug then if not ok and Heimdall_Data.config.minimapTagger.debug then
print(string.format("[%s] Failed to play help sound: %s", ModuleName, print(
Heimdall_Data.config.minimapTagger.helpSoundFile)) string.format(
"[%s] Failed to play help sound: %s",
ModuleName,
Heimdall_Data.config.minimapTagger.helpSoundFile
)
)
end end
end end
end end
if doTag then if doTag then PlantFrame(x, y, frame, scale, Heimdall_Data.config.minimapTagger.helpTTL) end
PlantFrame(x, y, frame, scale, Heimdall_Data.config.minimapTagger.helpTTL)
end
end end
--endregion --endregion
@@ -323,20 +382,23 @@ function shared.MinimapTagger.Init()
BattlefieldMinimap:SetMovable(true) BattlefieldMinimap:SetMovable(true)
BattlefieldMinimap:EnableMouse(true) BattlefieldMinimap:EnableMouse(true)
BattlefieldMinimap:RegisterForDrag("LeftButton") BattlefieldMinimap:RegisterForDrag("LeftButton")
BattlefieldMinimap:SetScript("OnDragStart", function(self) self:StartMoving() end) BattlefieldMinimap:SetScript("OnDragStart", function(selff) selff:StartMoving() end)
BattlefieldMinimap:SetScript("OnDragStop", function(self) self:StopMovingOrSizing() end) BattlefieldMinimap:SetScript("OnDragStop", function(selff) selff:StopMovingOrSizing() end)
BattlefieldMinimapBackground:Hide() BattlefieldMinimapBackground:Hide()
BattlefieldMinimapCloseButton:Hide() BattlefieldMinimapCloseButton:Hide()
BattlefieldMinimapCorner:Hide() BattlefieldMinimapCorner:Hide()
BattlefieldMinimap:HookScript("OnHide", function(self) BattlefieldMinimap:HookScript("OnHide", function(selff)
for _, alertFrame in ipairs(alertFramePool) do for _, alertFrame in ipairs(alertFramePool) do
alertFrame:Hide() alertFrame:Hide()
---@diagnostic disable-next-line: undefined-field
alertFrame.custom.busy = false alertFrame.custom.busy = false
end end
for _, tagFrame in ipairs(tagFramePool) do for _, tagFrame in ipairs(tagFramePool) do
tagFrame:Hide() tagFrame:Hide()
---@diagnostic disable-next-line: undefined-field
tagFrame.custom.busy = false tagFrame.custom.busy = false
end end
-- What the fuck is this global?
for _, battleFrame in ipairs(battleFramePool) do for _, battleFrame in ipairs(battleFramePool) do
battleFrame:Hide() battleFrame:Hide()
battleFrame.custom.busy = false battleFrame.custom.busy = false
@@ -370,8 +432,14 @@ function shared.MinimapTagger.Init()
if not ok then if not ok then
if Heimdall_Data.config.minimapTagger.debug then if Heimdall_Data.config.minimapTagger.debug then
print(string.format("[%s] Ignoring message from non-master channel: %s, need %s", ModuleName, channelname, print(
Heimdall_Data.config.minimapTagger.masterChannel)) string.format(
"[%s] Ignoring message from non-master channel: %s, need %s",
ModuleName,
channelname,
Heimdall_Data.config.minimapTagger.masterChannel
)
)
end end
return return
end end
@@ -387,8 +455,14 @@ function shared.MinimapTagger.Init()
local currentMapId = GetCurrentMapAreaID() local currentMapId = GetCurrentMapAreaID()
if currentMapId ~= messageMapId then if currentMapId ~= messageMapId then
if Heimdall_Data.config.minimapTagger.debug 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", print(
ModuleName, currentMapId, messageMapId)) string.format(
"[%s] Current map ID (%d) does not match message map ID (%d), ignoring message",
ModuleName,
currentMapId,
messageMapId
)
)
end end
doTag = false doTag = false
end end
@@ -405,9 +479,7 @@ function shared.MinimapTagger.Init()
if Heimdall_Data.config.minimapTagger.debug then if Heimdall_Data.config.minimapTagger.debug then
print(string.format("[%s] Found alert position: %s, %s", ModuleName, tostring(x), tostring(y))) print(string.format("[%s] Found alert position: %s, %s", ModuleName, tostring(x), tostring(y)))
end end
if x and y then if x and y then PlantTag(tonumber(x), tonumber(y), 2, doTag) end
PlantTag(tonumber(x), tonumber(y), 2, doTag)
end
end end
--endregion --endregion
--region Combat --region Combat
@@ -425,9 +497,7 @@ function shared.MinimapTagger.Init()
if Heimdall_Data.config.minimapTagger.debug then if Heimdall_Data.config.minimapTagger.debug then
print(string.format("[%s] Found combat position: %s, %s", ModuleName, tostring(x), tostring(y))) print(string.format("[%s] Found combat position: %s, %s", ModuleName, tostring(x), tostring(y)))
end end
if x and y then if x and y then PlantCombat(tonumber(x), tonumber(y), 2, doTag) end
PlantCombat(tonumber(x), tonumber(y), 2, doTag)
end
end end
--endregion --endregion
--region Death --region Death
@@ -445,9 +515,7 @@ function shared.MinimapTagger.Init()
if Heimdall_Data.config.minimapTagger.debug then if Heimdall_Data.config.minimapTagger.debug then
print(string.format("[%s] Found death position: %s, %s", ModuleName, tostring(x), tostring(y))) print(string.format("[%s] Found death position: %s, %s", ModuleName, tostring(x), tostring(y)))
end end
if x and y then if x and y then PlantAlert(tonumber(x), tonumber(y), 2, doTag) end
PlantAlert(tonumber(x), tonumber(y), 2, doTag)
end
end end
--endregion --endregion
--region Help --region Help
@@ -468,6 +536,7 @@ function shared.MinimapTagger.Init()
if x and y then if x and y then
x, y = tonumber(x), tonumber(y) x, y = tonumber(x), tonumber(y)
PlantHelp(x, y, 1, doTag) PlantHelp(x, y, 1, doTag)
---@diagnostic disable-next-line: undefined-global
if TomTom then if TomTom then
if Heimdall_Data.config.minimapTagger.debug then if Heimdall_Data.config.minimapTagger.debug then
print(string.format("[%s] Adding help waypoint to TomTom", ModuleName)) print(string.format("[%s] Adding help waypoint to TomTom", ModuleName))
@@ -478,6 +547,7 @@ function shared.MinimapTagger.Init()
print(string.format("[%s] Area ID: %s", ModuleName, tostring(areaId))) print(string.format("[%s] Area ID: %s", ModuleName, tostring(areaId)))
end end
---@diagnostic disable-next-line: undefined-global
TomTom:AddMFWaypoint(areaId, nil, x / 100, y / 100, { TomTom:AddMFWaypoint(areaId, nil, x / 100, y / 100, {
title = "Help " .. sender, title = "Help " .. sender,
world = true, world = true,
@@ -497,7 +567,5 @@ function shared.MinimapTagger.Init()
print("[Heimdall] MinimapTagger loaded") print("[Heimdall] MinimapTagger loaded")
end end
SlashCmdList["HEIMDALL_MINIMAPTAGGER"] = function(args) SlashCmdList["HEIMDALL_MINIMAPTAGGER"] = function(args) shared.MinimapTagger.Init() end
shared.MinimapTagger.Init()
end
SLASH_HEIMDALL_MINIMAPTAGGER1 = "/mf" SLASH_HEIMDALL_MINIMAPTAGGER1 = "/mf"

View File

@@ -1,6 +1,5 @@
local addonname, shared = ... local _, shared = ...
---@cast shared HeimdallShared ---@cast shared HeimdallShared
---@cast addonname string
local ModuleName = "Network" local ModuleName = "Network"
---@diagnostic disable-next-line: missing-fields ---@diagnostic disable-next-line: missing-fields
@@ -15,7 +14,7 @@ function shared.Network.Init()
---@type table<string, boolean> ---@type table<string, boolean>
local friends = {} local friends = {}
for i = 1, GetNumFriends() do for i = 1, GetNumFriends() do
local name, level, class, area, connected, status, note, RAF = GetFriendInfo(i) local name, _, _, _, connected, _, _, _ = GetFriendInfo(i)
if name then if name then
friends[name] = connected friends[name] = connected
if Heimdall_Data.config.network.debug then if Heimdall_Data.config.network.debug then
@@ -39,7 +38,8 @@ function shared.Network.Init()
friends[UnitName("player")] = true friends[UnitName("player")] = true
shared.networkNodes = {} shared.networkNodes = {}
if false then shared.networkNodes[#shared.networkNodes + 1] = UnitName("player") end -- Why are we skipping this again...?
-- if false then shared.networkNodes[#shared.networkNodes + 1] = UnitName("player") end
for _, player in ipairs(Heimdall_Data.config.network.members) do for _, player in ipairs(Heimdall_Data.config.network.members) do
if friends[player] then if friends[player] then
shared.networkNodes[#shared.networkNodes + 1] = player shared.networkNodes[#shared.networkNodes + 1] = player
@@ -56,13 +56,10 @@ function shared.Network.Init()
local friendsFrame = CreateFrame("Frame") local friendsFrame = CreateFrame("Frame")
friendsFrame:RegisterEvent("FRIENDLIST_UPDATE") friendsFrame:RegisterEvent("FRIENDLIST_UPDATE")
friendsFrame:SetScript("OnEvent", function(self, event, ...) friendsFrame:SetScript("OnEvent", function(self, event, ...) end)
end)
local function NetworkTick() local function NetworkTick()
if Heimdall_Data.config.network.debug then if Heimdall_Data.config.network.debug then print("Network module is updating.") end
print("Network module is updating.")
end
ShowFriends() ShowFriends()
updatePending = true updatePending = true
C_Timer.After(1, function() C_Timer.After(1, function()

View File

@@ -1,6 +1,5 @@
local addonname, shared = ... local _, shared = ...
---@cast shared HeimdallShared ---@cast shared HeimdallShared
---@cast addonname string
local ModuleName = "NetworkMessenger" local ModuleName = "NetworkMessenger"
---@diagnostic disable-next-line: missing-fields ---@diagnostic disable-next-line: missing-fields
@@ -63,9 +62,15 @@ function shared.NetworkMessenger.Init()
end end
if Heimdall_Data.config.networkMessenger.debug then if Heimdall_Data.config.networkMessenger.debug then
print(string.format("[%s] Sending network message: '%s' to %s:%s", ModuleName, message.message, print(
message.channel, string.format(
message.data)) "[%s] Sending network message: '%s' to %s:%s",
ModuleName,
message.message,
message.channel,
message.data
)
)
end end
local payload = string.format("dmessage|%s|%s|%s", message.message, message.channel, message.data) local payload = string.format("dmessage|%s|%s|%s", message.message, message.channel, message.data)
if Heimdall_Data.config.networkMessenger.debug then if Heimdall_Data.config.networkMessenger.debug then
@@ -130,17 +135,19 @@ function shared.NetworkMessenger.Init()
end end
local command = strtrim(parts[1]) local command = strtrim(parts[1])
if command == "message" then if command == "message" then
local message = strtrim(tostring(parts[2])) local content = strtrim(tostring(parts[2]))
local channel = strtrim(tostring(parts[3])) local targetchannel = strtrim(tostring(parts[3]))
local target = strtrim(tostring(parts[4])) local target = strtrim(tostring(parts[4]))
if Heimdall_Data.config.networkMessenger.debug then if Heimdall_Data.config.networkMessenger.debug then
print(string.format("[%s] Received message command: %s %s %s", ModuleName, message, channel, target)) print(
string.format("[%s] Received message command: %s %s %s", ModuleName, content, targetchannel, target)
)
end end
---@type Message ---@type Message
local msg = { local msg = {
channel = channel, channel = targetchannel,
message = message, message = content,
data = target data = target,
} }
table.insert(shared.messenger.queue, msg) table.insert(shared.messenger.queue, msg)
elseif command == "dmessage" then elseif command == "dmessage" then
@@ -148,17 +155,15 @@ function shared.NetworkMessenger.Init()
print(string.format("[%s] Received dmessage command", ModuleName)) print(string.format("[%s] Received dmessage command", ModuleName))
end end
parts[1] = "message" parts[1] = "message"
local message = table.concat(parts, "|") local content = table.concat(parts, "|")
if nextIdx > #shared.networkNodes then if nextIdx > #shared.networkNodes then nextIdx = 1 end
nextIdx = 1
end
local recipient = shared.networkNodes[nextIdx] local recipient = shared.networkNodes[nextIdx]
nextIdx = nextIdx + 1 nextIdx = nextIdx + 1
if Heimdall_Data.config.networkMessenger.debug then if Heimdall_Data.config.networkMessenger.debug then
print(string.format("[%s] Sending message %s to %s", ModuleName, message, recipient)) print(string.format("[%s] Sending message %s to %s", ModuleName, content, recipient))
end end
SendAddonMessage(Heimdall_Data.config.addonPrefix, message, "WHISPER", recipient) SendAddonMessage(Heimdall_Data.config.addonPrefix, content, "WHISPER", recipient)
end end
end) end)
@@ -167,7 +172,7 @@ function shared.NetworkMessenger.Init()
local testmsg = { local testmsg = {
channel = "W", channel = "W",
message = "Hi, mom!", message = "Hi, mom!",
data = "Secundus" data = "Secundus",
} }
for i = 1, 36 do for i = 1, 36 do
table.insert(shared.networkMessenger.queue, testmsg) table.insert(shared.networkMessenger.queue, testmsg)

View File

@@ -1,6 +1,5 @@
local addonname, shared = ... local _, shared = ...
---@cast shared HeimdallShared ---@cast shared HeimdallShared
---@cast addonname string
local ModuleName = "Noter" local ModuleName = "Noter"
---@class Note ---@class Note
@@ -12,36 +11,32 @@ local ModuleName = "Noter"
---@diagnostic disable-next-line: missing-fields ---@diagnostic disable-next-line: missing-fields
shared.Noter = {} shared.Noter = {}
function shared.Noter.Init() function shared.Noter.Init()
---Hopefully this will not be necessary -- ---Hopefully this will not be necessary
---@param text string -- ---@param text string
---@param size number -- ---@param size number
---@return string[] -- ---@return string[]
local function Partition(text, size) -- local function Partition(text, size)
local words = {} -- local words = {}
for word in text:gmatch("[^,]+") do -- for word in text:gmatch("[^,]+") do
words[#words + 1] = word -- words[#words + 1] = word
end -- end
local ret = {} -- local ret = {}
local currentChunk = "" -- local currentChunk = ""
for _, word in ipairs(words) do -- for _, word in ipairs(words) do
if #currentChunk + #word + 1 <= size then -- if #currentChunk + #word + 1 <= size then
currentChunk = currentChunk .. (currentChunk == "" and word or " " .. word) -- currentChunk = currentChunk .. (currentChunk == "" and word or " " .. word)
else -- else
if #currentChunk > 0 then -- if #currentChunk > 0 then ret[#ret + 1] = currentChunk end
ret[#ret + 1] = currentChunk -- currentChunk = word
end -- end
currentChunk = word -- end
end
end
if #currentChunk > 0 then -- if #currentChunk > 0 then ret[#ret + 1] = currentChunk end
ret[#ret + 1] = currentChunk
end
return ret -- return ret
end -- end
---@param array any[] ---@param array any[]
---@return any[] ---@return any[]
local function Compact(array) local function Compact(array)
@@ -65,8 +60,7 @@ function shared.Noter.Init()
end end
local indices = shared.Split(range, "..") local indices = shared.Split(range, "..")
if Heimdall_Data.config.noter.debug then if Heimdall_Data.config.noter.debug then
print(string.format("[%s] Indices for range deletion: %s", ModuleName, print(string.format("[%s] Indices for range deletion: %s", ModuleName, table.concat(indices, ", ")))
table.concat(indices, ", ")))
shared.dumpTable(indices) shared.dumpTable(indices)
end end
local start = tonumber(indices[1]) local start = tonumber(indices[1])
@@ -74,8 +68,7 @@ function shared.Noter.Init()
if not start then if not start then
if Heimdall_Data.config.noter.debug then if Heimdall_Data.config.noter.debug then
print(string.format("[%s] Invalid start range for delete note: %s", ModuleName, print(string.format("[%s] Invalid start range for delete note: %s", ModuleName, tostring(start)))
tostring(start)))
end end
return return
end end
@@ -118,7 +111,7 @@ function shared.Noter.Init()
local msg = { local msg = {
channel = "C", channel = "C",
data = channel, data = channel,
message = string.format("[%s][%d] %s: %s", note.source, index, note.date, note.note) message = string.format("[%s][%d] %s: %s", note.source, index, note.date, note.note),
} }
--table.insert(shared.messenger.queue, msg) --table.insert(shared.messenger.queue, msg)
table.insert(shared.networkMessenger.queue, msg) table.insert(shared.networkMessenger.queue, msg)
@@ -132,8 +125,13 @@ function shared.Noter.Init()
local range = args[3] local range = args[3]
if not range then if not range then
if Heimdall_Data.config.noter.debug then if Heimdall_Data.config.noter.debug then
print(string.format("[%s] No range specified for print note, defaulting to last %d notes", ModuleName, print(
Heimdall_Data.config.noter.lastNotes)) string.format(
"[%s] No range specified for print note, defaulting to last %d notes",
ModuleName,
Heimdall_Data.config.noter.lastNotes
)
)
end end
local notes = Heimdall_Data.config.notes[name] or {} local notes = Heimdall_Data.config.notes[name] or {}
local start = math.max(1, #notes - Heimdall_Data.config.noter.lastNotes + 1) local start = math.max(1, #notes - Heimdall_Data.config.noter.lastNotes + 1)
@@ -152,8 +150,7 @@ function shared.Noter.Init()
end end
local indices = shared.Split(range, "..") local indices = shared.Split(range, "..")
if Heimdall_Data.config.noter.debug then if Heimdall_Data.config.noter.debug then
print(string.format("[%s] Indices for range printing: %s", ModuleName, print(string.format("[%s] Indices for range printing: %s", ModuleName, table.concat(indices, ", ")))
table.concat(indices, ", ")))
shared.dumpTable(indices) shared.dumpTable(indices)
end end
local start = tonumber(indices[1]) local start = tonumber(indices[1])
@@ -161,8 +158,7 @@ function shared.Noter.Init()
if not start then if not start then
if Heimdall_Data.config.noter.debug then if Heimdall_Data.config.noter.debug then
print(string.format("[%s] Invalid start range for print note: %s", ModuleName, print(string.format("[%s] Invalid start range for print note: %s", ModuleName, tostring(start)))
tostring(start)))
end end
return return
end end
@@ -212,7 +208,7 @@ function shared.Noter.Init()
local note = { local note = {
source = sender, source = sender,
date = date("%Y-%m-%dT%H:%M:%S"), date = date("%Y-%m-%dT%H:%M:%S"),
note = msg note = msg,
} }
if Heimdall_Data.config.noter.debug then if Heimdall_Data.config.noter.debug then
@@ -284,9 +280,7 @@ function shared.Noter.Init()
print(string.format("[%s] Note command received for: %s", ModuleName, name)) print(string.format("[%s] Note command received for: %s", ModuleName, name))
end end
local note = strtrim(args[3] or "") local note = strtrim(args[3] or "")
if Heimdall_Data.config.noter.debug then if Heimdall_Data.config.noter.debug then print(string.format("[%s] Note: %s", ModuleName, note)) end
print(string.format("[%s] Note: %s", ModuleName, note))
end
if note == "delete" then if note == "delete" then
DeleteNotes(name, args) DeleteNotes(name, args)
elseif string.find(note, "^[%d%.]*$") then elseif string.find(note, "^[%d%.]*$") then

File diff suppressed because it is too large Load Diff

View File

@@ -1,14 +1,11 @@
local addonname, shared = ... local _, shared = ...
---@cast shared HeimdallShared ---@cast shared HeimdallShared
---@cast addonname string
local ModuleName = "Sniffer" local ModuleName = "Sniffer"
---@diagnostic disable-next-line: missing-fields ---@diagnostic disable-next-line: missing-fields
shared.Sniffer = {} shared.Sniffer = {}
function shared.Sniffer.Init() function shared.Sniffer.Init()
if Heimdall_Data.config.sniffer.debug then if Heimdall_Data.config.sniffer.debug then print(string.format("[%s] Module initializing", ModuleName)) end
print(string.format("[%s] Module initializing", ModuleName))
end
local smellThrottle = {} local smellThrottle = {}
local SmellStinky = function(stinky) local SmellStinky = function(stinky)
if Heimdall_Data.config.sniffer.debug then if Heimdall_Data.config.sniffer.debug then
@@ -16,17 +13,14 @@ function shared.Sniffer.Init()
shared.dumpTable(Heimdall_Data.config.sniffer) shared.dumpTable(Heimdall_Data.config.sniffer)
end end
if not Heimdall_Data.config.sniffer.enabled then return end if not Heimdall_Data.config.sniffer.enabled then return end
if Heimdall_Data.config.sniffer.stinky and if Heimdall_Data.config.sniffer.stinky and not shared.IsStinky(stinky) then
not shared.IsStinky(stinky) then
if Heimdall_Data.config.sniffer.debug then if Heimdall_Data.config.sniffer.debug then
print(string.format("%s: Stinky not found in config", ModuleName)) print(string.format("%s: Stinky not found in config", ModuleName))
end end
return return
end end
if smellThrottle[stinky] and GetTime() - smellThrottle[stinky] < Heimdall_Data.config.sniffer.throttleTime then if smellThrottle[stinky] and GetTime() - smellThrottle[stinky] < Heimdall_Data.config.sniffer.throttleTime then
if Heimdall_Data.config.sniffer.debug then if Heimdall_Data.config.sniffer.debug then print(string.format("%s: Throttled", ModuleName)) end
print(string.format("%s: Throttled", ModuleName))
end
return return
end end
smellThrottle[stinky] = GetTime() smellThrottle[stinky] = GetTime()
@@ -60,7 +54,8 @@ function shared.Sniffer.Init()
end end
return return
end end
local source, err = CLEUParser.GetSourceName(...) local source, destination, err
source, err = CLEUParser.GetSourceName(...)
if Heimdall_Data.config.sniffer.debug then if Heimdall_Data.config.sniffer.debug then
print(string.format("[%s] Processing source: %s", ModuleName, source)) print(string.format("[%s] Processing source: %s", ModuleName, source))
end end
@@ -71,7 +66,7 @@ function shared.Sniffer.Init()
return return
end end
SmellStinky(source) SmellStinky(source)
local destination, err = CLEUParser.GetDestName(...) destination, err = CLEUParser.GetDestName(...)
if Heimdall_Data.config.sniffer.debug then if Heimdall_Data.config.sniffer.debug then
print(string.format("[%s] Processing destination: %s", ModuleName, destination)) print(string.format("[%s] Processing destination: %s", ModuleName, destination))
end end
@@ -83,8 +78,6 @@ function shared.Sniffer.Init()
end end
SmellStinky(destination) SmellStinky(destination)
end) end)
if Heimdall_Data.config.sniffer.debug then if Heimdall_Data.config.sniffer.debug then print(string.format("[%s] Module initialized", ModuleName)) end
print(string.format("[%s] Module initialized", ModuleName))
end
print("[Heimdall] Sniffer loaded") print("[Heimdall] Sniffer loaded")
end end

View File

@@ -1,6 +1,5 @@
local addonname, shared = ... local _, shared = ...
---@cast shared HeimdallShared ---@cast shared HeimdallShared
---@cast addonname string
local ModuleName = "Spotter" local ModuleName = "Spotter"
---@diagnostic disable-next-line: missing-fields ---@diagnostic disable-next-line: missing-fields
@@ -67,8 +66,13 @@ function shared.Spotter.Init()
end end
if Heimdall_Data.config.spotter.debug then if Heimdall_Data.config.spotter.debug then
print(string.format("[%s] Using everyone setting: %s", ModuleName, print(
tostring(Heimdall_Data.config.spotter.everyone))) string.format(
"[%s] Using everyone setting: %s",
ModuleName,
tostring(Heimdall_Data.config.spotter.everyone)
)
)
end end
return Heimdall_Data.config.spotter.everyone return Heimdall_Data.config.spotter.everyone
end end
@@ -158,7 +162,8 @@ function shared.Spotter.Init()
print(string.format("[%s] Processing channel: %s", ModuleName, channel)) print(string.format("[%s] Processing channel: %s", ModuleName, channel))
end end
local locale = shared.GetLocaleForChannel(channel) local locale = shared.GetLocaleForChannel(channel)
local text = string.format(shared._L("spotterSpotted", locale), local text = string.format(
shared._L("spotterSpotted", locale),
hostile and shared._L("hostile", locale) or shared._L("friendly", locale), hostile and shared._L("hostile", locale) or shared._L("friendly", locale),
name, name,
shared._L(class, locale), shared._L(class, locale),
@@ -168,15 +173,18 @@ function shared.Spotter.Init()
pvpOn and shared._L("pvpOn", locale) or shared._L("pvpOff", locale), pvpOn and shared._L("pvpOn", locale) or shared._L("pvpOff", locale),
string.gsub(FormatHP(hp), "M", "kk"), string.gsub(FormatHP(hp), "M", "kk"),
string.gsub(FormatHP(maxHp), "M", "kk"), string.gsub(FormatHP(maxHp), "M", "kk"),
shared._L(zone, locale), shared._L(subzone, locale), shared._L(zone, locale),
shared._L(subzone, locale),
areaId, areaId,
x * 100, y * 100) x * 100,
y * 100
)
---@type Message ---@type Message
local msg = { local msg = {
channel = "C", channel = "C",
data = channel, data = channel,
message = text message = text,
} }
if Heimdall_Data.config.spotter.debug then if Heimdall_Data.config.spotter.debug then
print(string.format("[%s] Queuing spotter message", ModuleName)) print(string.format("[%s] Queuing spotter message", ModuleName))
@@ -201,9 +209,7 @@ function shared.Spotter.Init()
return return
end end
if event == "UNIT_TARGET" then if event == "UNIT_TARGET" then unit = "target" end
unit = "target"
end
local err = NotifySpotted(unit) local err = NotifySpotted(unit)
if err then if err then
@@ -213,8 +219,6 @@ function shared.Spotter.Init()
end end
end) end)
if Heimdall_Data.config.spotter.debug then if Heimdall_Data.config.spotter.debug then print(string.format("[%s] Module initialized", ModuleName)) end
print(string.format("[%s] Module initialized", ModuleName))
end
print("[Heimdall] Spotter loaded") print("[Heimdall] Spotter loaded")
end end

View File

@@ -13,14 +13,23 @@ function shared.StinkyCache.Init()
---@param name string ---@param name string
local function AskCommander(name) local function AskCommander(name)
if Heimdall_Data.config.stinkyCache.debug then if Heimdall_Data.config.stinkyCache.debug then
print(string.format("[%s] Asking commander %s about %s", ModuleName, print(
Heimdall_Data.config.stinkyCache.commander, name)) string.format(
"[%s] Asking commander %s about %s",
ModuleName,
Heimdall_Data.config.stinkyCache.commander,
name
)
)
end end
local messageParts = { "isstinky", name } local messageParts = { "isstinky", name }
local message = table.concat(messageParts, "|") local message = table.concat(messageParts, "|")
SendAddonMessage(Heimdall_Data.config.addonPrefix, SendAddonMessage(
message, "WHISPER", Heimdall_Data.config.addonPrefix,
Heimdall_Data.config.stinkyCache.commander) message,
"WHISPER",
Heimdall_Data.config.stinkyCache.commander
)
return return
end end
@@ -29,20 +38,25 @@ function shared.StinkyCache.Init()
addonMessageFrame:SetScript("OnEvent", function(self, event, msg, sender, ...) addonMessageFrame:SetScript("OnEvent", function(self, event, msg, sender, ...)
if sender == Heimdall_Data.config.stinkyCache.commander then if sender == Heimdall_Data.config.stinkyCache.commander then
if Heimdall_Data.config.stinkyCache.debug then if Heimdall_Data.config.stinkyCache.debug then
print(string.format("[%s] Received stinky from commander %s: %s", ModuleName, print(
Heimdall_Data.config.stinkyCache.commander, msg)) string.format(
"[%s] Received stinky from commander %s: %s",
ModuleName,
Heimdall_Data.config.stinkyCache.commander,
msg
)
)
end end
local name, value = {strsplit("|", msg)} local parts = { strsplit("|", msg) }
local name, value = parts[1], parts[2]
shared.stinkyCache.stinkies[name] = { value = value, timestamp = time() } shared.stinkyCache.stinkies[name] = { value = value, timestamp = time() }
else else
if Heimdall_Data.config.stinkyCache.debug then if Heimdall_Data.config.stinkyCache.debug then
print(string.format("[%s] Received stinky from non-commander %s: %s", ModuleName, sender, msg)) print(string.format("[%s] Received stinky from non-commander %s: %s", ModuleName, sender, msg))
end end
local parts = {strsplit("|", msg)} local parts = { strsplit("|", msg) }
local command, name = parts[1], parts[2] local command, name = parts[1], parts[2]
if parts[1] == "isstinky" then if parts[1] == "isstinky" then local res = Heimdall_Data.config.stinkies[parts[2]] end
local res = Heimdall_Data.config.stinkies[parts[2]]
end
end end
end) end)
@@ -50,11 +64,9 @@ function shared.StinkyCache.Init()
__index = function(self, key) __index = function(self, key)
local value = rawget(self, key) local value = rawget(self, key)
local now = GetTime() local now = GetTime()
if value == nil or now - value.timestamp > Heimdall_Data.config.stinkyCache.ttl then if value == nil or now - value.timestamp > Heimdall_Data.config.stinkyCache.ttl then AskCommander(key) end
AskCommander(key)
end
return rawget(self, key) return rawget(self, key)
end end,
}) })
print("[Heimdall] StinkyCache module loaded") print("[Heimdall] StinkyCache module loaded")
end end

View File

@@ -1,13 +1,12 @@
local addonname, shared = ... local _, shared = ...
---@cast shared HeimdallShared ---@cast shared HeimdallShared
---@cast addonname string
local ModuleName = "StinkyTracker" local ModuleName = "StinkyTracker"
---@diagnostic disable-next-line: missing-fields ---@diagnostic disable-next-line: missing-fields
shared.StinkyTracker = {} shared.StinkyTracker = {}
function shared.StinkyTracker.Init() function shared.StinkyTracker.Init()
shared.stinkyTracker = { shared.stinkyTracker = {
stinkies = ReactiveValue.new({}) stinkies = ReactiveValue.new({}),
} }
local whoRegex = "([^ -/]+)-?%w*/(%w+)" local whoRegex = "([^ -/]+)-?%w*/(%w+)"
@@ -23,11 +22,18 @@ function shared.StinkyTracker.Init()
name = name, name = name,
class = class, class = class,
seenAt = GetTime(), seenAt = GetTime(),
hostile = true hostile = true,
} }
if Heimdall_Data.config.stinkyTracker.debug then if Heimdall_Data.config.stinkyTracker.debug then
print(string.format("[%s] Found hostile player: %s (%s) at %s", ModuleName, name, class, print(
date("%H:%M:%S", time()))) string.format(
"[%s] Found hostile player: %s (%s) at %s",
ModuleName,
name,
class,
date("%H:%M:%S", time())
)
)
shared.dumpTable(stinkies) shared.dumpTable(stinkies)
end end
end end
@@ -53,12 +59,20 @@ function shared.StinkyTracker.Init()
name = name, name = name,
class = class, class = class,
seenAt = GetTime(), seenAt = GetTime(),
hostile = aggression == "hostile" hostile = aggression == "hostile",
} }
stinkies[name] = stinky stinkies[name] = stinky
if Heimdall_Data.config.stinkyTracker.debug then if Heimdall_Data.config.stinkyTracker.debug then
print(string.format("[%s] Found stinky in SEE: %s (%s) - %s at %s", ModuleName, name, class, aggression, print(
date("%H:%M:%S", time()))) string.format(
"[%s] Found stinky in SEE: %s (%s) - %s at %s",
ModuleName,
name,
class,
aggression,
date("%H:%M:%S", time())
)
)
shared.dumpTable(stinkies) shared.dumpTable(stinkies)
end end
return stinkies return stinkies
@@ -87,7 +101,7 @@ function shared.StinkyTracker.Init()
name = name, name = name,
class = class, class = class,
seenAt = GetTime(), seenAt = GetTime(),
hostile = true hostile = true,
} }
stinkies[name] = stinky stinkies[name] = stinky
if Heimdall_Data.config.stinkyTracker.debug then if Heimdall_Data.config.stinkyTracker.debug then
@@ -141,8 +155,9 @@ function shared.StinkyTracker.Init()
if stinky.hostile then if stinky.hostile then
shared.stinkyTracker.stinkies[name] = stinky shared.stinkyTracker.stinkies[name] = stinky
if Heimdall_Data.config.stinkyTracker.debug then if Heimdall_Data.config.stinkyTracker.debug then
print(string.format("[%s] Added hostile stinky from WHO: %s (%s)", ModuleName, name, stinky print(
.class)) string.format("[%s] Added hostile stinky from WHO: %s (%s)", ModuleName, name, stinky.class)
)
end end
end end
end end
@@ -159,8 +174,9 @@ function shared.StinkyTracker.Init()
if stinky.hostile then if stinky.hostile then
shared.stinkyTracker.stinkies[name] = stinky shared.stinkyTracker.stinkies[name] = stinky
if Heimdall_Data.config.stinkyTracker.debug then if Heimdall_Data.config.stinkyTracker.debug then
print(string.format("[%s] Added hostile stinky from SEE: %s (%s)", ModuleName, name, stinky print(
.class)) string.format("[%s] Added hostile stinky from SEE: %s (%s)", ModuleName, name, stinky.class)
)
end end
end end
if not stinky.hostile then if not stinky.hostile then
@@ -190,7 +206,9 @@ function shared.StinkyTracker.Init()
-- Log total stinky count after processing -- Log total stinky count after processing
if Heimdall_Data.config.stinkyTracker.debug then if Heimdall_Data.config.stinkyTracker.debug then
local count = 0 local count = 0
for _ in pairs(shared.stinkyTracker.stinkies:get()) do count = count + 1 end for _ in pairs(shared.stinkyTracker.stinkies:get()) do
count = count + 1
end
print(string.format("[%s] Current total stinkies tracked: %d", ModuleName, count)) print(string.format("[%s] Current total stinkies tracked: %d", ModuleName, count))
end end
@@ -210,7 +228,7 @@ function shared.StinkyTracker.Init()
if Heimdall_Data.config.stinkyTracker.debug then if Heimdall_Data.config.stinkyTracker.debug then
print(string.format("[%s] Event received: %s for unit: %s", ModuleName, event, unit or "target")) print(string.format("[%s] Event received: %s for unit: %s", ModuleName, event, unit or "target"))
end end
local unit = "target" unit = "target"
if not Heimdall_Data.config.stinkyTracker.enabled then if not Heimdall_Data.config.stinkyTracker.enabled then
if Heimdall_Data.config.stinkyTracker.debug then if Heimdall_Data.config.stinkyTracker.debug then
@@ -236,7 +254,7 @@ function shared.StinkyTracker.Init()
name = name, name = name,
class = UnitClass(unit), class = UnitClass(unit),
seenAt = GetTime(), seenAt = GetTime(),
hostile = true hostile = true,
} }
return return
end end
@@ -254,8 +272,6 @@ function shared.StinkyTracker.Init()
shared.stinkyTracker.stinkies[name] = nil shared.stinkyTracker.stinkies[name] = nil
end) end)
if Heimdall_Data.config.stinkyTracker.debug then if Heimdall_Data.config.stinkyTracker.debug then print(string.format("[%s] Module initialized", ModuleName)) end
print(string.format("[%s] Module initialized", ModuleName))
end
print("[Heimdall] StinkyTracker loaded") print("[Heimdall] StinkyTracker loaded")
end end

View File

@@ -1,6 +1,5 @@
local addonname, shared = ... local _, shared = ...
---@cast shared HeimdallShared ---@cast shared HeimdallShared
---@cast addonname string
local ModuleName = "Whoer" local ModuleName = "Whoer"
---@diagnostic disable-next-line: missing-fields ---@diagnostic disable-next-line: missing-fields
@@ -32,7 +31,7 @@ function shared.Whoer.Init()
---@return Player ---@return Player
new = function(name, guild, race, class, zone) new = function(name, guild, race, class, zone)
local self = setmetatable({}, { local self = setmetatable({}, {
__index = Player __index = Player,
}) })
self.name = name self.name = name
self.guild = guild self.guild = guild
@@ -47,13 +46,15 @@ function shared.Whoer.Init()
end, end,
---@return string ---@return string
ToString = function(self) ToString = function(self)
local out = string.format("%s %s %s\nFirst: %s Last: %s Seen: %3d", local out = string.format(
"%s %s %s\nFirst: %s Last: %s Seen: %3d",
shared.padString(self.name, 16, true), shared.padString(self.name, 16, true),
shared.padString(self.guild, 26, false), shared.padString(self.guild, 26, false),
shared.padString(self.zone, 26, false), shared.padString(self.zone, 26, false),
shared.padString(self.firstSeen, 10, true), shared.padString(self.firstSeen, 10, true),
shared.padString(self.lastSeen, 10, true), shared.padString(self.lastSeen, 10, true),
self.seenCount) self.seenCount
)
return string.format("|cFF%s%s|r", shared.classColors[self.class], out) return string.format("|cFF%s%s|r", shared.classColors[self.class], out)
end, end,
} }
@@ -67,12 +68,12 @@ function shared.Whoer.Init()
---@return WHOQuery ---@return WHOQuery
new = function(query, filters) new = function(query, filters)
local self = setmetatable({}, { local self = setmetatable({}, {
__index = WHOQuery __index = WHOQuery,
}) })
self.query = query self.query = query
self.filters = filters self.filters = filters
return self return self
end end,
} }
---@class WHOFilter ---@class WHOFilter
@@ -81,12 +82,10 @@ function shared.Whoer.Init()
---@type WHOFilter ---@type WHOFilter
local NotSiegeOfOrgrimmarFilter = { local NotSiegeOfOrgrimmarFilter = {
Run = function(name, guild, level, race, class, zone) Run = function(name, guild, level, race, class, zone)
if not zone then if not zone then return false end
return false
end
return zone ~= "Siege of Orgrimmar" return zone ~= "Siege of Orgrimmar"
end, end,
key = "notsoo" key = "notsoo",
} }
---@type WHOFilter ---@type WHOFilter
local AllianceFilter = { local AllianceFilter = {
@@ -95,7 +94,7 @@ function shared.Whoer.Init()
if not shared.raceMap[race] then return false end if not shared.raceMap[race] then return false end
return shared.raceMap[race] == "Alliance" return shared.raceMap[race] == "Alliance"
end, end,
key = "ally" key = "ally",
} }
---@class WhoQueryService ---@class WhoQueryService
@@ -110,15 +109,13 @@ function shared.Whoer.Init()
queries = {}, queries = {},
filters = { filters = {
NotSiegeOfOrgrimmarFilter, NotSiegeOfOrgrimmarFilter,
AllianceFilter AllianceFilter,
}, },
---@param key string ---@param key string
---@return WHOFilter? ---@return WHOFilter?
getFilter = function(key) getFilter = function(key)
for _, filter in pairs(shared.WhoQueryService.filters) do for _, filter in pairs(shared.WhoQueryService.filters) do
if filter.key == key then if filter.key == key then return filter end
return filter
end
end end
return nil return nil
end, end,
@@ -167,16 +164,16 @@ function shared.Whoer.Init()
shared.dumpTable(filters) shared.dumpTable(filters)
return WHOQuery.new(queryParts[1], filters) return WHOQuery.new(queryParts[1], filters)
end, end,
---@param queries string ---@param queryStr string
---@return WHOQuery[] ---@return WHOQuery[]
WhoQueriesFromString = function(queries) WhoQueriesFromString = function(queryStr)
local queries = shared.Split(queries, "\n") local queries = shared.Split(queryStr, "\n")
local ret = {} local ret = {}
for _, query in pairs(queries) do for _, query in pairs(queries) do
table.insert(ret, shared.WhoQueryService.WhoQueryFromString(query)) table.insert(ret, shared.WhoQueryService.WhoQueryFromString(query))
end end
return ret return ret
end end,
} }
shared.WhoQueryService.queries = shared.WhoQueryService.WhoQueriesFromString(Heimdall_Data.config.who.queries) shared.WhoQueryService.queries = shared.WhoQueryService.WhoQueriesFromString(Heimdall_Data.config.who.queries)
@@ -187,9 +184,13 @@ function shared.Whoer.Init()
print(string.format("[%s] ShouldNotifyForZone %s", ModuleName, inputZone)) print(string.format("[%s] ShouldNotifyForZone %s", ModuleName, inputZone))
end end
for zone, _ in pairs(Heimdall_Data.config.who.zoneNotifyFor) do for zone, _ in pairs(Heimdall_Data.config.who.zoneNotifyFor) do
if Heimdall_Data.config.who.debug then print(string.format("[%s] Checking zone %s", ModuleName, zone)) end
if zone == "*" then return true end
if string.find(inputZone, zone) then if string.find(inputZone, zone) then
if not Heimdall_Data.config.who.debug then if not Heimdall_Data.config.who.debug then
print(string.format("[%s] ShouldNotifyForZone %s is true thanks to %s", ModuleName, inputZone, zone)) print(
string.format("[%s] ShouldNotifyForZone %s is true thanks to %s", ModuleName, inputZone, zone)
)
end end
return true return true
end end
@@ -229,6 +230,25 @@ function shared.Whoer.Init()
local function Notify(player) local function Notify(player)
if Heimdall_Data.config.who.debug then if Heimdall_Data.config.who.debug then
print(string.format("[%s] Processing notification for player: %s", ModuleName, player.name)) print(string.format("[%s] Processing notification for player: %s", ModuleName, player.name))
print(
string.format(
"[%s] Player details - Guild: %s, Race: %s, Class: %s, Zone: %s",
ModuleName,
player.guild,
player.race,
player.class,
player.zone
)
)
print(
string.format(
"[%s] Player history - First seen: %s, Last seen: %s, Seen count: %d",
ModuleName,
player.firstSeen,
player.lastSeen,
player.seenCount
)
)
end end
if not Heimdall_Data.config.who.enabled then if not Heimdall_Data.config.who.enabled then
@@ -248,26 +268,30 @@ function shared.Whoer.Init()
if not shared.Whoer.ShouldNotifyForZone(player.zone) then if not shared.Whoer.ShouldNotifyForZone(player.zone) then
--if not Heimdall_Data.config.who.zoneNotifyFor[player.zone] then --if not Heimdall_Data.config.who.zoneNotifyFor[player.zone] then
if Heimdall_Data.config.who.debug then if Heimdall_Data.config.who.debug then
print(string.format("[%s] Skipping notification - Zone '%s' not in notify list", ModuleName, player.zone)) print(
string.format("[%s] Skipping notification - Zone '%s' not in notify list", ModuleName, player.zone)
)
end end
return string.format("Not notifying for zone %s", tostring(player.zone)) return string.format("Not notifying for zone %s", tostring(player.zone))
end end
for _, channel in pairs(Heimdall_Data.config.who.channels) do for _, channel in pairs(Heimdall_Data.config.who.channels) do
local locale = shared.GetLocaleForChannel(channel) local locale = shared.GetLocaleForChannel(channel)
local text = string.format(shared._L("whoerNew", locale), local text = string.format(
shared._L("whoerNew", locale),
player.name, player.name,
player.stinky and "(!!!!)" or "", player.stinky and "(!!!!)" or "",
shared._L(player.class, locale), shared._L(player.class, locale),
--shared._L(player.race, locale), --shared._L(player.race, locale),
shared._L(shared.raceMap[player.race] or "unknown", locale), shared._L(shared.raceMap[player.race] or "unknown", locale),
player.guild, player.guild,
shared._L(player.zone, locale)) shared._L(player.zone, locale)
)
---@type Message ---@type Message
local msg = { local msg = {
channel = "C", channel = "C",
data = channel, data = channel,
message = text message = text,
} }
if Heimdall_Data.config.who.debug then if Heimdall_Data.config.who.debug then
print(string.format("[%s] Queuing channel notification", ModuleName)) print(string.format("[%s] Queuing channel notification", ModuleName))
@@ -311,20 +335,22 @@ function shared.Whoer.Init()
end end
for _, channel in pairs(Heimdall_Data.config.who.channels) do for _, channel in pairs(Heimdall_Data.config.who.channels) do
local locale = shared.GetLocaleForChannel(channel) local locale = shared.GetLocaleForChannel(channel)
local text = string.format(shared._L("whoerMoved", locale), local text = string.format(
shared._L("whoerMoved", locale),
player.name, player.name,
player.stinky and "(!!!!)" or "", player.stinky and "(!!!!)" or "",
shared._L(player.class, locale), shared._L(player.class, locale),
--shared._L(player.race, locale), --shared._L(player.race, locale),
shared._L(shared.raceMap[player.race] or "unknown", locale), shared._L(shared.raceMap[player.race] or "unknown", locale),
player.guild, player.guild,
shared._L(zone, locale)) shared._L(zone, locale)
)
---@type Message ---@type Message
local msg = { local msg = {
channel = "C", channel = "C",
data = channel, data = channel,
message = text message = text,
} }
if Heimdall_Data.config.who.debug then if Heimdall_Data.config.who.debug then
print(string.format("[%s] Queuing channel notification", ModuleName)) print(string.format("[%s] Queuing channel notification", ModuleName))
@@ -360,20 +386,22 @@ function shared.Whoer.Init()
for _, channel in pairs(Heimdall_Data.config.who.channels) do for _, channel in pairs(Heimdall_Data.config.who.channels) do
local locale = shared.GetLocaleForChannel(channel) local locale = shared.GetLocaleForChannel(channel)
local text = string.format(shared._L("whoerGone", locale), local text = string.format(
shared._L("whoerGone", locale),
player.name, player.name,
player.stinky and "(!!!!)" or "", player.stinky and "(!!!!)" or "",
shared._L(player.class, locale), shared._L(player.class, locale),
--shared._L(player.race, locale), --shared._L(player.race, locale),
shared._L(shared.raceMap[player.race] or "unknown", locale), shared._L(shared.raceMap[player.race] or "unknown", locale),
player.guild, player.guild,
shared._L(player.zone, locale)) shared._L(player.zone, locale)
)
---@type Message ---@type Message
local msg = { local msg = {
channel = "C", channel = "C",
data = channel, data = channel,
message = text message = text,
} }
if Heimdall_Data.config.who.debug then if Heimdall_Data.config.who.debug then
print(string.format("[%s] Queuing channel notification", ModuleName)) print(string.format("[%s] Queuing channel notification", ModuleName))
@@ -404,6 +432,7 @@ function shared.Whoer.Init()
frame:SetScript("OnEvent", function(self, event, ...) frame:SetScript("OnEvent", function(self, event, ...)
if Heimdall_Data.config.who.debug then if Heimdall_Data.config.who.debug then
print(string.format("[%s] WHO list update received", ModuleName)) print(string.format("[%s] WHO list update received", ModuleName))
print(string.format("[%s] Query index: %d/%d", ModuleName, whoQueryIdx, #shared.WhoQueryService.queries))
end end
if not Heimdall_Data.config.who.enabled then if not Heimdall_Data.config.who.enabled then
@@ -430,7 +459,9 @@ function shared.Whoer.Init()
for i = 1, results do for i = 1, results do
local name, guild, level, race, class, zone = GetWhoInfo(i) local name, guild, level, race, class, zone = GetWhoInfo(i)
if Heimdall_Data.config.who.debug then if Heimdall_Data.config.who.debug then
print(string.format("[%s] Processing result %d/%d: %s/%s/%s", ModuleName, i, results, name, class, zone)) print(
string.format("[%s] Processing result %d/%d: %s/%s/%s", ModuleName, i, results, name, class, zone)
)
end end
local continue = false local continue = false
@@ -438,11 +469,15 @@ function shared.Whoer.Init()
local filters = query.filters local filters = query.filters
for _, filter in pairs(filters) do for _, filter in pairs(filters) do
if Heimdall_Data.config.who.debug then if Heimdall_Data.config.who.debug then
print(string.format("[%s] Running filter %s on %s/%s/%s", ModuleName, filter.key, name, class, zone)) print(
string.format("[%s] Running filter %s on %s/%s/%s", ModuleName, filter.key, name, class, zone)
)
end end
if not filter.Run(name, guild, level, race, class, zone) then if not filter.Run(name, guild, level, race, class, zone) then
if Heimdall_Data.config.who.debug then if Heimdall_Data.config.who.debug then
print(string.format("[%s] Player %s filtered out by WHO filter %s", ModuleName, name, filter.key)) print(
string.format("[%s] Player %s filtered out by WHO filter %s", ModuleName, name, filter.key)
)
end end
continue = true continue = true
break break
@@ -454,13 +489,15 @@ function shared.Whoer.Init()
print(string.format("[%s] Ignoring blacklisted player: %s", ModuleName, name)) print(string.format("[%s] Ignoring blacklisted player: %s", ModuleName, name))
end end
continue = true continue = true
else
if Heimdall_Data.config.who.debug then
print(string.format("[%s] Player %s is not blacklisted", ModuleName, name))
end
end end
if Heimdall_Data.config.who.debug then
print(string.format("[%s] Player %s is not blacklisted", ModuleName, name))
end
if not continue then if not continue then
if Heimdall_Data.config.who.debug then
print(string.format("[%s] Player %s is not filtered out", ModuleName, name))
end
local timestamp = date("%Y-%m-%dT%H:%M:%S") local timestamp = date("%Y-%m-%dT%H:%M:%S")
local player = HeimdallStinkies[name] local player = HeimdallStinkies[name]
if not player then if not player then
@@ -475,8 +512,15 @@ function shared.Whoer.Init()
if existing then if existing then
if Heimdall_Data.config.who.debug then if Heimdall_Data.config.who.debug then
print(string.format("[%s] Found existing data for %s - Last seen: %s, Count: %d", print(
ModuleName, name, existing.lastSeen or "never", existing.seenCount or 0)) string.format(
"[%s] Found existing data for %s - Last seen: %s, Count: %d",
ModuleName,
name,
existing.lastSeen or "never",
existing.seenCount or 0
)
)
end end
player.lastSeen = existing.lastSeen or "never" player.lastSeen = existing.lastSeen or "never"
player.firstSeen = existing.firstSeen or "never" player.firstSeen = existing.firstSeen or "never"
@@ -497,13 +541,15 @@ function shared.Whoer.Init()
end end
player.stinky = true player.stinky = true
--PlaySoundFile("Interface\\Sounds\\Domination.ogg", "Master") --PlaySoundFile("Interface\\Sounds\\Domination.ogg", "Master")
else -- else
--PlaySoundFile("Interface\\Sounds\\Cloak.ogg", "Master") -- PlaySoundFile("Interface\\Sounds\\Cloak.ogg", "Master")
end end
local err = Notify(player) local err = Notify(player)
if err then if err then
print(string.format("[%s] Error notifying for %s: %s", ModuleName, tostring(name), tostring(err))) print(
string.format("[%s] Error notifying for %s: %s", ModuleName, tostring(name), tostring(err))
)
end end
player.lastSeen = timestamp player.lastSeen = timestamp
@@ -514,13 +560,18 @@ function shared.Whoer.Init()
player.lastSeenInternal = GetTime() player.lastSeenInternal = GetTime()
if player.zone ~= zone then if player.zone ~= zone then
if Heimdall_Data.config.who.debug then if Heimdall_Data.config.who.debug then
print(string.format("[%s] Player %s zone changed from %s to %s", ModuleName, name, player.zone, print(
zone)) string.format(
"[%s] Player %s zone changed from %s to %s",
ModuleName,
name,
player.zone,
zone
)
)
end end
local err = NotifyZoneChanged(player, zone) local err = NotifyZoneChanged(player, zone)
if err then if err then print(string.format("Error notifying for %s: %s", tostring(name), tostring(err))) end
print(string.format("Error notifying for %s: %s", tostring(name), tostring(err)))
end
end end
player.zone = zone player.zone = zone
player.lastSeen = timestamp player.lastSeen = timestamp
@@ -559,16 +610,29 @@ function shared.Whoer.Init()
local query = shared.WhoQueryService.queries[whoQueryIdx] local query = shared.WhoQueryService.queries[whoQueryIdx]
if not query then if not query then
if Heimdall_Data.config.who.debug then if Heimdall_Data.config.who.debug then
print(string.format("[%s] Error: No WHO query found to run", ModuleName)) print(string.format("[%s] Error: No WHO query found to run at index %d", ModuleName, whoQueryIdx))
end end
return return
end end
whoQueryIdx = whoQueryIdx + 1
if whoQueryIdx > #shared.WhoQueryService.queries then if Heimdall_Data.config.who.debug then
whoQueryIdx = 1 print(
string.format(
"[%s] Running WHO query %d/%d: %s",
ModuleName,
whoQueryIdx,
#shared.WhoQueryService.queries,
query.query
)
)
print(string.format("[%s] Query has %d filters", ModuleName, #query.filters))
for i, filter in ipairs(query.filters) do
print(string.format("[%s] Filter %d: %s", ModuleName, i, filter.key))
end
end end
whoQueryIdx = whoQueryIdx + 1
if whoQueryIdx > #shared.WhoQueryService.queries then whoQueryIdx = 1 end
lastQuery = query lastQuery = query
--print(string.format("Running who query: %s", tostring(query.query)))
---@diagnostic disable-next-line: param-type-mismatch ---@diagnostic disable-next-line: param-type-mismatch
SetWhoToUI(1) SetWhoToUI(1)
SendWho(query.query) SendWho(query.query)

View File

@@ -6,9 +6,7 @@ local function StringToMap(str, deliminer)
local parts = { strsplit(deliminer, str) } local parts = { strsplit(deliminer, str) }
for _, line in ipairs(parts) do for _, line in ipairs(parts) do
line = strtrim(line) line = strtrim(line)
if line ~= "" then if line ~= "" then map[line] = true end
map[line] = true
end
end end
return map return map
end end
@@ -21,9 +19,7 @@ local function StringToArray(str, deliminer)
local array = { strsplit(deliminer, str) } local array = { strsplit(deliminer, str) }
for i, line in ipairs(array) do for i, line in ipairs(array) do
line = strtrim(line) line = strtrim(line)
if line ~= "" then if line ~= "" then ret[i] = line end
ret[i] = line
end
end end
return ret return ret
end end
@@ -39,7 +35,7 @@ local config = {
stinky = aura_env.config.spotter.stinky, stinky = aura_env.config.spotter.stinky,
notifyChannel = aura_env.config.spotter.notifyChannel, notifyChannel = aura_env.config.spotter.notifyChannel,
zoneOverride = aura_env.config.spotter.zoneOverride, zoneOverride = aura_env.config.spotter.zoneOverride,
throttleTime = aura_env.config.spotter.throttleTime throttleTime = aura_env.config.spotter.throttleTime,
}, },
who = { who = {
enabled = aura_env.config.who.enabled, enabled = aura_env.config.who.enabled,

View File

@@ -1,53 +1,62 @@
#!/bin/bash #!/bin/bash
# Default version increment echo "Figuring out the tag..."
DEFAULT_INCREMENT="0.0.1" TAG=$(git describe --tags --exact-match 2>/dev/null || echo "")
if [ -z "$TAG" ]; then
# Get the latest tag
LATEST_TAG=$(git describe --tags $(git rev-list --tags --max-count=1))
# Increment the patch version
IFS='.' read -r -a VERSION_PARTS <<< "$LATEST_TAG"
VERSION_PARTS[2]=$((VERSION_PARTS[2]+1))
TAG="${VERSION_PARTS[0]}.${VERSION_PARTS[1]}.${VERSION_PARTS[2]}"
# Create a new tag
git tag $TAG
fi
echo "Tag: $TAG"
# Get the increment parameter or use the default echo "Building the thing..."
INCREMENT=${1:-$DEFAULT_INCREMENT} sed -i "s/## Version: .*/## Version: $TAG/" Heimdall.toc
sed -i "s/local VERSION = .*/local VERSION = \"$TAG\"/" Heimdall.lua
git add Heimdall.toc Heimdall.lua
git commit -m "Release $TAG"
git tag -f $TAG
git push origin $TAG
exit 0
# Function to increment the version rm Heimdall-${TAG}.zip
increment_version() {
local version=$1
local increment=$2
IFS='.' read -r -a version_parts <<< "$version"
IFS='.' read -r -a increment_parts <<< "$increment"
# Increment major, minor, and patch
version_parts[0]=$((version_parts[0] + increment_parts[0]))
version_parts[1]=$((version_parts[1] + increment_parts[1]))
version_parts[2]=$((version_parts[2] + increment_parts[2]))
# Reset minor and patch if major is incremented
if [ "${increment_parts[0]}" -gt 0 ]; then
version_parts[1]=0
version_parts[2]=0
elif [ "${increment_parts[1]}" -gt 0 ]; then
version_parts[2]=0
fi
echo "${version_parts[0]}.${version_parts[1]}.${version_parts[2]}"
}
CURRENT_VERSION=$(grep -oP '## Version: \K[0-9]+\.[0-9]+\.[0-9]+' Heimdall.toc)
NEW_VERSION=$(increment_version "$CURRENT_VERSION" "$INCREMENT")
sed -i "s/## Version: $CURRENT_VERSION/## Version: $NEW_VERSION/" Heimdall.toc
sed -i "s/local VERSION = \"$CURRENT_VERSION\"/local VERSION = \"$NEW_VERSION\"/" Heimdall.lua
# Existing deployment steps
rm Heimdall.zip
mkdir Heimdall mkdir Heimdall
cp *.lua *.toc Heimdall cp *.lua *.toc Heimdall
cp -r Modules Heimdall cp -r Modules Heimdall
cp -r Sounds Heimdall cp -r Sounds Heimdall
cp -r Texture Heimdall cp -r Texture Heimdall
7z a Heimdall.zip Heimdall 7z a Heimdall-${TAG}.zip Heimdall
rm -rf Heimdall rm -rf Heimdall
# Git operations echo "Creating a release..."
git add Heimdall.lua Heimdall.toc Heimdall.zip TOKEN="$GITEA_API_KEY"
git commit -m "Release $NEW_VERSION" GITEA="https://git.site.quack-lab.dev"
git tag "$NEW_VERSION" REPO="dave/wow-heimdall"
# Create a release
RELEASE_RESPONSE=$(curl -s -X POST \
-H "Authorization: token $TOKEN" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"tag_name": "'"$TAG"'",
"name": "'"$TAG"'",
"draft": false,
"prerelease": false
}' \
$GITEA/api/v1/repos/$REPO/releases)
echo "Deployment complete. New version: $NEW_VERSION" # Extract the release ID
echo $RELEASE_RESPONSE
RELEASE_ID=$(echo $RELEASE_RESPONSE | awk -F'"id":' '{print $2+0; exit}')
echo "Release ID: $RELEASE_ID"
echo "Uploading the things..."
curl -X POST \
-H "Authorization: token $TOKEN" \
-F "attachment=@Heimdall-${TAG}.zip" \
"$GITEA/api/v1/repos/$REPO/releases/${RELEASE_ID}/assets?name=Heimdall-${TAG}.zip"
rm Heimdall-${TAG}.zip

1
stylua.toml Symbolic link
View File

@@ -0,0 +1 @@
C:/Users/Administrator/Seafile/Games-WoW/Ruski/Interface/AddOns/Heimdall/Meta/stylua.toml