Repository navigation
Expand file tree
/
Copy pathTests.lua
More file actions
125 lines (102 loc) · 3.33 KB
/
Copy pathTests.lua
File metadata and controls
125 lines (102 loc) · 3.33 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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
local AddonName, Addon = ...
_G[AddonName] = Addon
local Defaults = {
pingMsg = "Ping from: ",
coords = 0.0,
zone = "The Jade Forest",
zonesLogged = {},
}
function Addon:OnInitialize()
self:EnableDebug(true)
self:InitializeDB(Defaults)
--self:StartRepeatingTimer(10, nil, "RepeatingTimer") --NOTE: We don't need a variable here if you don't plan on ever calling StopTimer
self:StartRepeatingTimer(10, "OnRepeatingPauseTimer", "RepeatingPauseTimer") --NOTE: We don't need a variable here if you don't plan on ever calling StopTimer
--self:StartTimer(60, "OnNonRepeatingTimer")
self:RegisterEvent({"ZONE_CHANGED", "ZONE_CHANGED_NEW_AREA", "ZONE_CHANGED_INDOORS" }, "OnZoneChanged")
self:RegisterEvent("PLAYER_TARGET_CHANGED")
self:RegisterEvent("MINIMAP_PING", "OnMiniMapPing")
self:RegisterEvent("PLAYER_REGEN_ENABLED")
self:RegisterEvent("PLAYER_REGEN_DISABLED")
end
function Addon:OnEnable()
--self:RegisterSlashCommand("sc", "OnSimpleCoreTests")
self:RegisterSlashCommand("sc")
end
function Addon:OnAddonLoaded(name)
end
function Addon:OnSlashCommand(...)
local msg, nextMsg = ...
if msg == "unregisterallevents" then
self:UnregisterAllEvents()
elseif msg == "timer" and nextMsg == "stop" then
self:DebugPrint("Stopping timer...")
self:StopTimer("RepeatingTimer")
elseif msg == "timer" and nextMsg == "stopall" then
self:DebugPrint("Stopping timers...")
self:StopAllTimers()
elseif msg == "timer" and nextMsg == "start" then
self:DebugPrint("Starting timer...")
self:StartTimer(20, nil, "slash")
elseif msg == "enable" and nextMsg then
self:DebugPrint("Enabling module %s", nextMsg)
self:EnableModule(nextMsg)
elseif msg == "disable" and nextMsg then
self:DebugPrint("Disabling module %s", nextMsg)
self:DisableModule(nextMsg)
elseif msg == "pingmsg" and nextMsg then
self.db.pingMsg = nextMsg
elseif msg == "pause" then
--self:DebugPrint("Pausing...")
self:PauseTimer("RepeatingPauseTimer")
elseif msg == "resume" then
--self:DebugPrint("Resuming...")
self:ResumeTimer("RepeatingPauseTimer")
else
self:DebugPrint("DEFAULT SLASH COMMAND HANDLER: " .. msg)
end
end
function Addon:OnSimpleCoreTests(...)
local msg = ...
self:DebugPrint("OnSimpleCoreTests: " .. msg)
end
function Addon:OnTimer(name)
self:DebugPrint("Addon:OnTimer -> " .. name)
end
function Addon:OnNonRepeatingTimer(name)
self:DebugPrint("Stopping NON-Repeating timer.")
end
function Addon:OnRepeatingPauseTimer(name)
self:DebugPrint("OnRepeatingPauseTimer tick -> " .. name)
end
function Addon:OnTimerPause(name)
self:DebugPrint("Pausing: " .. name)
end
function Addon:OnTimerResume(name)
self:DebugPrint("Resuming: " .. name)
end
function Addon:OnTimerStop(name)
self:DebugPrint("Stopping timer: " .. name)
end
function Addon:OnStopAllTimers()
self:DebugPrint("Stoping all timers!")
end
function Addon:OnZoneChanged(event)
local db = self.db
local zone = GetSubZoneText()
db["zone"] = zone
db.zonesLogged[zone] = zone
self:DebugPrint("%s: %s", event, db.zone)
end
function Addon:PLAYER_TARGET_CHANGED(event)
self:DebugPrint(event)
end
function Addon:OnMiniMapPing(event, unit, x, y)
self.db.coords = x
self:DebugPrint("%s %s X: %f Y: %f", self.db.pingMsg ,unit, x, y)
end
function Addon:PLAYER_REGEN_ENABLED()
self:DispatchMessage("OnLeavingCombat")
end
function Addon:PLAYER_REGEN_DISABLED()
self:DispatchMessage("OnEnteringCombat")
end