Refactor whole addon to follow best practices

This commit is contained in:
Roman Jaroš 2025-03-07 12:52:37 +01:00
parent 43fc252902
commit 414aef6924
31 changed files with 7843 additions and 29579 deletions

23
Addon/Code/SpeechDataApi.lua Executable file
View file

@ -0,0 +1,23 @@
local _, addon = ...
local function FillPlaceholders(text)
if text == nil then
return text
end
local playerName = UnitName("player")
local formatted = text;
formatted = string.gsub(formatted, '<name>', playerName);
formatted = string.gsub(formatted, 'Champions', playerName);
formatted = string.gsub(formatted, 'champions', playerName);
return formatted
end
local function GetSpeech(message)
local speech = addon.data.speech[message];
local text = speech and speech.text or nil
return FillPlaceholders(text)
end
addon.API.GetSpeech = GetSpeech