-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInit.lua
More file actions
76 lines (65 loc) · 2.4 KB
/
Init.lua
File metadata and controls
76 lines (65 loc) · 2.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
-- CharacterMarkdown - Final Initialization
local CM = CharacterMarkdown
-- Validate all required modules
local validationResults = {
core = (CM ~= nil),
utils = (CM.utils ~= nil),
links = (CM.links ~= nil),
collectors = (CM.collectors ~= nil),
generators = (CM.generators ~= nil),
commands = (CM.commands ~= nil),
events = (CM.events ~= nil),
settings = (CM.Settings ~= nil),
}
local allValid = true
for module, isValid in pairs(validationResults) do
if not isValid then
CM.Error(string.format("Module '%s' failed to load!", module))
allValid = false
end
end
if not allValid then
CM.Error("Addon initialization incomplete! Some modules failed to load.")
CM.Error("Try /reloadui to restart the addon.")
return
end
-- Validate critical functions
local criticalFunctions = {
{ name = "CommandHandler", ref = CM.commands.CommandHandler },
{ name = "GenerateMarkdown", ref = CM.generators.GenerateMarkdown },
{ name = "CollectCharacterData", ref = CM.collectors.CollectCharacterData },
}
for _, func in ipairs(criticalFunctions) do
if not func.ref or type(func.ref) ~= "function" then
CM.Error(string.format("Critical function '%s' not available!", func.name))
allValid = false
end
end
if not allValid then
CM.Error("Critical functions missing! Addon may not work correctly.")
return
end
-- Validate slash command registered
if not SLASH_COMMANDS["/markdown"] then
CM.Error("/markdown command not registered!")
allValid = false
end
if allValid then
CM.Success("CharacterMarkdown v" .. CM.version .. " loaded successfully")
CM.Success("Type /markdown to generate a character profile")
-- Check for optional dependencies and inform user
if not LibDebugLogger then
CM.Info(
"|cFFFF00[CharacterMarkdown] INFO:|r LibDebugLogger not installed - diagnostic logging will show in chat instead"
)
CM.Info("|cFFFF00[CharacterMarkdown] INFO:|r For cleaner chat, install LibDebugLogger from ESOUI.com")
end
if not LibSlashCommander then
CM.Info("|cFFFF00[CharacterMarkdown] INFO:|r LibSlashCommander not installed - basic command handling enabled")
CM.Info(
"|cFFFF00[CharacterMarkdown] INFO:|r For auto-completion and better help, install LibSlashCommander from ESOUI.com"
)
end
else
CM.Error("Initialization completed with errors")
end