addon/CzechQuests.lua

75 lines
3.3 KiB
Lua
Raw Permalink Normal View History

local _, addon = ...
-- Prepare API object
addon.API = {}
2025-03-29 07:44:17 +01:00
-- Prepare Data objects
addon.data = {};
addon.data.quest = {};
addon.data.item = {};
addon.data.speech = {}
2025-03-29 07:44:17 +01:00
addon.data.tactic = {}
-- Expose object as global for other addon integration
CzechQuestsAddon = {}
CzechQuestsAddon.data = addon.data
local function SetDefault(key, default)
if CzechQuestsAddon_Store.config[key] == nil then
CzechQuestsAddon_Store.config[key] = default
end
return CzechQuestsAddon_Store.config[key]
end
local function InitStore()
-- Init Store
CzechQuestsAddon_Store = CzechQuestsAddon_Store or {}
CzechQuestsAddon_Store.config = CzechQuestsAddon_Store.config or {}
-- General Settings
CzechQuestsAddon_Store.config.DEBUG_MODE = SetDefault("DEBUG_MODE", false)
-- Quest Settings
CzechQuestsAddon_Store.config.QUEST_ENABLED = SetDefault("QUEST_ENABLED", true)
CzechQuestsAddon_Store.config.QUEST_DARK_MODE = SetDefault("QUEST_DARK_MODE", false)
CzechQuestsAddon_Store.config.QUEST_HEADER_FONT_SIZE = SetDefault("QUEST_HEADER_FONT_SIZE", 18)
CzechQuestsAddon_Store.config.QUEST_TEXT_FONT_SIZE = SetDefault("QUEST_TEXT_FONT_SIZE", 14)
CzechQuestsAddon_Store.config.QUEST_HEADER_FONT_NAME = SetDefault("QUEST_HEADER_FONT_NAME", 'morpheus_cz.ttf')
CzechQuestsAddon_Store.config.QUEST_TEXT_FONT_NAME = SetDefault("QUEST_TEXT_FONT_NAME", 'frizquadratatt_cz.ttf')
CzechQuestsAddon_Store.config.QUEST_TEXTURE_ALPHA = SetDefault("QUEST_TEXTURE_ALPHA", 80)
CzechQuestsAddon_Store.config.QUEST_TEXTURE_ALPHA_ONLY_MOVING = SetDefault("QUEST_TEXTURE_ALPHA_ONLY_MOVING", true)
-- Speech Settings
CzechQuestsAddon_Store.config.SPEECH_ENABLED = SetDefault("SPEECH_ENABLED", true)
CzechQuestsAddon_Store.config.SPEECH_TEXT_FONT_SIZE = SetDefault("SPEECH_TEXT_FONT_SIZE", 13)
CzechQuestsAddon_Store.config.SPEECH_TEXT_FONT_NAME = SetDefault("SPEECH_TEXT_FONT_NAME", 'frizquadratatt_cz.ttf')
CzechQuestsAddon_Store.config.SPEECH_FRAME_WIDTH = SetDefault("SPEECH_FRAME_WIDTH", 320)
CzechQuestsAddon_Store.config.SPEECH_ORIGINAL_WHEN_MISSING = SetDefault("SPEECH_ORIGINAL_WHEN_MISSING", false)
CzechQuestsAddon_Store.config.SPEECH_MESSAGE_TEXTURE_ALPHA = SetDefault("SPEECH_MESSAGE_TEXTURE_ALPHA", 40)
CzechQuestsAddon_Store.config.SPEECH_FRAME_POSITION_X = SetDefault("SPEECH_FRAME_POSITION_X", 0)
CzechQuestsAddon_Store.config.SPEECH_FRAME_POSITION_Y = SetDefault("SPEECH_FRAME_POSITION_Y", 0)
2025-03-28 10:45:45 +01:00
2025-03-29 07:44:17 +01:00
-- Tactic Settings
CzechQuestsAddon_Store.config.TACTIC_ENABLED = SetDefault("TACTIC_ENABLED", true)
CzechQuestsAddon_Store.config.TACTIC_TEXT_FONT_SIZE = SetDefault("TACTIC_TEXT_FONT_SIZE", 12)
CzechQuestsAddon_Store.config.TACTIC_TEXT_FONT_NAME = SetDefault("TACTIC_TEXT_FONT_NAME", 'frizquadratatt_cz.ttf')
2025-03-29 07:44:17 +01:00
end
2025-03-28 10:45:45 +01:00
2025-03-29 07:44:17 +01:00
-- Event handler frame
local frame = CreateFrame("Frame")
local function OnEvent(self, event, addonName, ...)
if event == "ADDON_LOADED" and addonName == 'CzechQuests' then
InitStore()
addon.API.InitOptions()
addon.API.InitQuests()
addon.API.InitSpeeches()
if (WOW_PROJECT_ID ~= WOW_PROJECT_CLASSIC) then
addon.API.InitTactics()
end
2025-03-29 07:44:17 +01:00
self:UnregisterEvent("ADDON_LOADED")
2025-03-28 10:45:45 +01:00
end
2024-08-25 11:50:46 +02:00
end
2025-03-29 07:44:17 +01:00
-- Register the event
2024-08-25 11:50:46 +02:00
frame:RegisterEvent("ADDON_LOADED")
2025-03-29 07:44:17 +01:00
frame:SetScript("OnEvent", OnEvent)