-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathDismounter_Core.lua
More file actions
48 lines (39 loc) · 1.22 KB
/
Dismounter_Core.lua
File metadata and controls
48 lines (39 loc) · 1.22 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
local addonName, addon = ...
local function addEventListeners(self)
addon.core.frame:RegisterEvent("UI_ERROR_MESSAGE")
addon.core.frame:RegisterEvent("TAXIMAP_OPENED")
end
local function onEvent(self, event, ...)
local args = {...}
if event == "UI_ERROR_MESSAGE" then
local msg = args[2];
local isMountErrorMessage = addon.utils.isMountErrorMessage(msg);
local isShapeshiftErrorMessage = addon.utils.isShapeshiftErrorMessage(msg);
if (isMountErrorMessage) then
UIErrorsFrame:Clear();
Dismount();
end
if (isShapeshiftErrorMessage) then
if (InCombatLockdown()) then
addon.utils.printMsg("Can't remove shapeshift in combat")
else
if (addon.utils.cancelShapeshiftBuffs()) then
UIErrorsFrame:Clear();
end
end
end;
return;
end
if event == "TAXIMAP_OPENED" then
addon.utils.cancelShapeshiftBuffs();
Dismount();
return;
end
end
local function init()
addon.core = {};
addon.core.frame = CreateFrame("Frame");
addon.core.frame:SetScript("OnEvent", onEvent);
addEventListeners();
end
init();