forked from m00nyONE/LibCustomIcons
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLibCustomIcons.lua
More file actions
75 lines (63 loc) · 2.42 KB
/
LibCustomIcons.lua
File metadata and controls
75 lines (63 loc) · 2.42 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
-- SPDX-FileCopyrightText: 2025 m00nyONE
-- SPDX-License-Identifier: Artistic-2.0
--[[ doc.lua begin ]]
--- @class LibCustomIcons
local lib = {
name = "LibCustomIcons",
version = "dev",
author = "@m00nyONE",
}
local lib_name = lib.name
local lib_author = lib.author
local lib_version = lib.version
_G[lib_name] = lib
local EM = EVENT_MANAGER
--- @type table<string, string> Table mapping `@accountname` to "texturePath"
local static = {}
--- @type table<string, table> Table mapping `@accountname` to { "texturePath", sizeX, sizeY, fps }
local animated = {}
--[[ doc.lua end ]]
--- Returns a reference to the internal static table.
--- This is only available during addon initialization, to disallow other addons tampering with the data later.
--- returns table<string, string> The table of custom static icons.
function lib.GetStaticTable()
return static
end
--- Returns a reference to the internal animated table.
--- This is only available during addon initialization, to disallow other addons tampering with the data later.
--- returns table<string, table> The table of custom animated icons.
function lib.GetAnimatedTable()
return animated
end
--- Internal function to perform post-load initialization.
local function initialize()
lib.BuildMenu()
end
--- Register for the EVENT_ADD_ON_LOADED event to initialize the addon properly.
EM:RegisterForEvent(lib_name, EVENT_ADD_ON_LOADED, function(_, name)
if name ~= lib_name then return end
initialize()
EM:UnregisterForEvent(lib_name, EVENT_ADD_ON_LOADED)
end)
--- Opens the in-game mail window with donation fields prefilled for supporting the library.
function lib.Donate()
SCENE_MANAGER:Show('mailSend')
zo_callLater(function()
ZO_MailSendToField:SetText(lib_author)
ZO_MailSendSubjectField:SetText("Donation for " .. lib_name)
ZO_MailSendBodyField:SetText("")
ZO_MailSendBodyField:TakeFocus()
end, 250)
end
--- Handles slash commands for version output and donation prompt.
--- Usage:
--- - `/lci version` — shows current version
--- - `/lci donate` — opens mail window for donations
local function slashCommands(str)
if str == "version" then d(lib_version) end
if str == "donate" then lib.Donate() end
if str == "integrity" then lib.IntegrityCheck() end
end
--- Register slash commands for interacting with the library.
SLASH_COMMANDS["/LibCustomIcons"] = slashCommands
SLASH_COMMANDS["/lci"] = slashCommands