forked from enderneko/InstanceSpellCollector
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Core.lua
70 lines (60 loc) · 1.93 KB
/
Core.lua
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
local addonName, ISC = ...
local P = ISC.pixelPerfectFuncs
local eventFrame = CreateFrame("Frame")
eventFrame:RegisterEvent("ADDON_LOADED")
eventFrame:SetScript("OnEvent", function(self, event, ...)
self[event](self, ...)
end)
function eventFrame:ADDON_LOADED(arg1)
if arg1 == addonName then
eventFrame:UnregisterEvent("ADDON_LOADED")
if type(ISC_Config) ~= "table" then ISC_Config = {} end
-- scale
if type(ISC_Config.scale) ~= "number" then
local pScale = P:GetPixelPerfectScale()
local scale
if pScale >= 0.7 then
scale = 1
elseif pScale >= 0.5 then
scale = 1.4
else
scale = 2
end
ISC_Config.scale = scale
end
P:SetRelativeScale(ISC_Config.scale)
ISC:Fire("UpdateScale")
-- data table
if type(ISC_Data) ~= "table" then
ISC_Data = {
["instances"] = {
-- [id] = {name=string, enabled=boolean}
},
["debuffs"] = {
-- [sourceName] = {spellId=spellname}
},
["casts"] = {
-- [sourceName] = {spellId=spellname}
}
}
end
ISC:Fire("AddonLoaded")
end
end
ISC:RegisterCallback("UpdateScale", "Collector_UpdateScale", function()
P:SetRelativeScale(ISC_Config.scale)
P:SetEffectiveScale(InstanceSpellCollectorFrame)
P:SetEffectiveScale(ISCTooltip)
ISCTooltip:UpdatePixelPerfect()
end)
-------------------------------------------------
-- slash command
-------------------------------------------------
SLASH_ISC1 = "/isc"
function SlashCmdList.ISC(msg, editbox)
-- local command, rest = msg:match("^(%S*)%s*(.-)$")
InstanceSpellCollectorFrame:Show()
end
function ISC_OnAddonCompartmentClick()
InstanceSpellCollectorFrame:Show()
end