2025-04-17 19:04:49 +02:00
|
|
|
local _, addon = ...
|
|
|
|
|
2025-04-18 14:03:11 +02:00
|
|
|
local function ParseAbilities(input, delimiter)
|
2025-04-17 19:04:49 +02:00
|
|
|
local result = {}
|
|
|
|
local pattern = "([^" .. delimiter .. "]*)"
|
|
|
|
local normalizedAbility = string.gsub(input, "||", "|???|")
|
|
|
|
|
|
|
|
local lastPos = 1
|
|
|
|
for part in string.gmatch(normalizedAbility, pattern) do
|
|
|
|
table.insert(result, part)
|
|
|
|
lastPos = lastPos + #part + 1
|
|
|
|
end
|
|
|
|
|
|
|
|
if input:sub(-1) == delimiter then
|
|
|
|
table.insert(result, "")
|
|
|
|
end
|
|
|
|
|
|
|
|
return result
|
|
|
|
end
|
2025-04-18 14:03:11 +02:00
|
|
|
addon.API.ParseAbilities = ParseAbilities
|
2025-04-17 19:04:49 +02:00
|
|
|
|
2025-04-18 14:03:11 +02:00
|
|
|
local function SetAbilityDescription(text, original)
|
|
|
|
local withNumbers = addon.API.FillNumbers(text, original)
|
|
|
|
return addon.API.ColorSpellNames(withNumbers)
|
|
|
|
end
|
|
|
|
addon.API.SetAbilityDescription = SetAbilityDescription
|
|
|
|
|
|
|
|
local function SetSummaryDescription(text, original)
|
|
|
|
local withNumbers = addon.API.FillNumbers(text, original)
|
|
|
|
|
|
|
|
local lines = {}
|
|
|
|
for part in string.gmatch(withNumbers, "([^\n]+)") do
|
|
|
|
table.insert(lines, part)
|
|
|
|
end
|
|
|
|
|
|
|
|
local description = ""
|
|
|
|
for i, line in pairs(lines) do
|
|
|
|
description = description
|
|
|
|
.. "- "
|
|
|
|
.. addon.API.ColorSpellNames(line)
|
|
|
|
.. (i == #lines and "" or "\n\n")
|
|
|
|
end
|
|
|
|
|
|
|
|
return description
|
|
|
|
end
|
|
|
|
addon.API.SetSummaryDescription = SetSummaryDescription
|
2025-04-17 19:04:49 +02:00
|
|
|
|
|
|
|
local function GetEncounterAbility(abilityKey)
|
2025-04-18 14:03:11 +02:00
|
|
|
return addon.data.encounter[abilityKey].m or nil
|
2025-04-17 19:04:49 +02:00
|
|
|
end
|
|
|
|
addon.API.GetEncounterAbility = GetEncounterAbility
|
|
|
|
|
|
|
|
local function GetEncounter(bossKey)
|
|
|
|
return {
|
|
|
|
abilities = addon.data.encounter[bossKey] or nil,
|
2025-04-18 14:03:11 +02:00
|
|
|
overview = addon.data.encounter[bossKey .. "_summary_instance"].m or nil,
|
|
|
|
tank = addon.data.encounter[bossKey .. "_summary_tank"].m or nil,
|
|
|
|
healer = addon.data.encounter[bossKey .. "_summary_healer"].m or nil,
|
|
|
|
dps = addon.data.encounter[bossKey .. "_summary_dps"].m or nil,
|
2025-04-17 19:04:49 +02:00
|
|
|
}
|
|
|
|
end
|
|
|
|
addon.API.GetEncounter = GetEncounter
|