forked from sakaras/ShestakUI_Filger
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCommands.lua
65 lines (58 loc) · 2.06 KB
/
Commands.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
local _, ns = ...
local Misc = ns.Misc
local class = select(2, UnitClass("player"))
SLASH_S_FILGER1 = "/sf"
SLASH_S_FILGER2 = "/filger"
testMode = false
local function ShowHelp()
print(string.format("|cffffff00 %s move 解锁/锁定|r", SLASH_S_FILGER1))
print(string.format("|cffffff00 %s reset 重置|r", SLASH_S_FILGER1))
end
local function Move()
if UnitAffectingCombat("player") then print("|cffffff00"..ERR_NOT_IN_COMBAT.."|r") return end
testMode = not testMode
for i = 1, #Filger_Spells[class], 1 do
local data = Filger_Spells[class][i]
local frame = _G["FilgerFrame"..i.."_"..data.Name]
frame.actives = {}
if testMode then
for j = 1, math.min(Misc.maxTestIcon, #Filger_Spells[class][i]), 1 do
local data = Filger_Spells[class][i][j]
local name, icon
if data.spellID then
name, _, icon = GetSpellInfo(data.spellID)
elseif data.slotID then
local slotLink = GetInventoryItemLink("player", data.slotID)
if slotLink then
name, _, _, _, _, _, _, _, _, icon = GetItemInfo(slotLink)
end
end
frame.actives[j] = {data = data, name = name, icon = icon, count = 9, start = 0, duration = 0, spid = data.spellID or data.slotID}
end
frame:SetScript("OnEvent", nil)
frame.movebar:Show()
else
frame:SetScript("OnEvent", Filger.OnEvent)
frame.movebar:Hide()
end
Filger.DisplayActives(frame)
end
end
local function Reset()
for i = 1, #Filger_Spells[class], 1 do
local data = Filger_Spells[class][i]
local frame = _G["FilgerFrame"..i.."_"..data.Name]
frame.movebar:ClearAllPoints()
frame.movebar:SetPoint(unpack(data.Position))
end
end
SlashCmdList["S_FILGER"] = function(msg)
msg = string.lower(msg)
if msg == "move" then
Move()
elseif msg == "reset" then
Reset()
else
ShowHelp()
end
end