forked from pops64/VanillaGuide
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Core.lua
232 lines (205 loc) · 7.97 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
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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
--[[--------------------------------------------------
----- VanillaGuide -----
------------------
Core.lua
Authors: mrmr
Version: 1.04.3
------------------------------------------------------
Description:
Powerleveling Guide for 1.12.1 servers
based on Joana Guide. Core FILE!
1.00
-- Initial Ace2 release
1.99a
-- Ally addition starter version
1.03
-- No Changes. Just adjusting "version".
1.99x for a beta release was a weird choise.
1.04.1
-- Vanilla Guide Rewrite
The "keybind" problems is forcing me to rethink
this entire Addon. Let's see what comes out!
-- Two level Debug (let's waste time!)
-- Two New object created:
.Settings, containing various settings (unneeded?)
.GuideTables, containing the actual guides
1.04.2
-- no changes in here for this revision
1.04.3
-- no changes in here for this revision
--]]--------------------------------------------------
--[[--------------------------------------------------
Debug:
--]]--------------------------------------------------
--debug_info = false
--debug_verbose = true
debug_info = false
debug_verbose = false
do
function Di(...)
if debug_info then
for k, v in pairs(arg) do arg[k] = tostring(v) end
local s = table.concat(arg, ", ")
s = string.gsub(s, "([=:]),", "%1")
DEFAULT_CHAT_FRAME:AddMessage("|cFFff6633VGuide info:|r" .. s)
end
--return s
end
function Dv(...)
if debug_verbose then
for k, v in pairs(arg) do arg[k] = tostring(v) end
local s = table.concat(arg, ", ")
s = string.gsub(s, "([=:]),", "%1")
DEFAULT_CHAT_FRAME:AddMessage(" |cFFff6677VGuide debug:|r" .. s)
end
--return s
end
function Dtprint (tbl, indent)
if not debug_verbose then return end
if not indent then indent = 0 end
for k, v in pairs(tbl) do
formatting = string.rep(" ", indent) .. "[" .. k .."]" .. ": "
if type(v) == "table" then
Dv(formatting)
Dtprint(v, indent+4)
elseif type(v) == "boolean" then
Dv(formatting .. tostring(v))
elseif type(v) == "function" then
Dv(formatting .. tostring(v))
elseif type(v) == "userdata" then
Dv(formatting .. tostring(v))
else
Dv(formatting .. v)
end
end
end
end
--[[--------------------------------------------------
Connection:
--]]--------------------------------------------------
--VGuide = AceLibrary("AceAddon-2.0"):new("AceEvent-2.0", "AceDB-2.0", "AceConsole-2.0", "AceDebug-2.0")
VGuide = AceLibrary("AceAddon-2.0"):new("AceEvent-2.0", "AceConsole-2.0", "AceDebug-2.0")
-- Keybindings
BINDING_HEADER_VGUIDE = "Vanilla Guide"
BINDING_NAME_VGUIDE_TOGGLE = "Toggle Vanilla Guide"
BINDING_NAME_VGUIDE_PREV_STEP = "Prev Step"
BINDING_NAME_VGUIDE_NEXT_STEP = "Next Step"
BINDING_NAME_VGUIDE_PREV_GUIDE = "Prev Guide"
BINDING_NAME_VGUIDE_NEXT_GUIDE = "Next Guide"
-- Keybindings End
Dv(" ----- Verbose Debug is turned On -----")
Dv(" VGuide Core.lua Start")
Dv(" Starting!")
Dv(" on: " .. date())
function VGuide:OnInitialize(Addon_Name)
-- fired upon Blizz's Event ADDON_LOADED
--Dv(" -- OnInitialize Start")
--Dv(" arg1: 'name' --> ", tostring(Addon_Name))
--self:Print(self:PrintAddonInfo())
-- Fires when non-addon-specific saved variables are loaded
--self:RegisterEvent("VARIABLES_LOADED")
-- Fires when an addon and its saved variables are loaded
self:RegisterEvent("ADDON_LOADED")
-- Fires immediately before `PLAYER_ENTERING_WORLD` on login and UI reload
self:RegisterEvent("PLAYER_LOGIN")
-- Fired when the player enters the world, reloads the UI,
-- enters/leaves an instance or battleground, or respawns at a graveyard.
-- Also fires any other time the player sees a loading screen
--self:RegisterEvent("PLAYER_ENTERING_WORLD")
self:RegisterEvent("OnProfileEnable")
self:RegisterEvent("Ace2_AddonInitialized")
self:RegisterEvent("Ace2_AddonEnabled")
if Addon_Name == "VanillaGuide" then
Dv(" -- Event |c00FF3333OnInitialize|r: " .. Addon_Name)
end
--Dv(" -- OnInitialize End")
end
function VGuide:Ace2_AddonInitialized(addon)
--Dv(" -- Ace2_AddonInitialized Start")
--self:Print("|c00FF3333"..addon.."|r: VGuide v1.0 Initialized!")
if tostring(addon) == "VanillaGuide" then
Dv(" -- Event |c00FF3333Ace2_AddonInitialized|r: " .. tostring(addon))
end
--Dv(" -- Ace2_AddonInitialized End")
end
function VGuide:ADDON_LOADED(name)
--Dv(" -- ADDON_LOADED Start")
if name == "VanillaGuide" then
Dv(" -- Event |c00FF3333ADDON_LOADED|r: " .. name)
Dv(" |c00FF3333Vanilla Guide|r and its own SavedVariables should be loaded now!")
end
--Dv(" -- ADDON_LOADED End")
end
function VGuide:PLAYER_LOGIN()
--Dv(" -- PLAYER_LOGIN Start")
Dv(" -- Event |c00FF3333PLAYER_LOGIN|r: Player should be logged in now....")
--Dv(" -- PLAYER_LOGIN End")
end
function VGuide:OnProfileEnable()
Dv(" -- OnProfileEnable Start")
Dv(" -- OnProfileEnable End")
end
function VGuide:OnEnable(first)
-- fired upon Blizz's Event PLAYER_LOGIN
-- guess this is after VARIABLE_LOADED
--Dv(" -- OnEnable Start")
--Dv(" arg1: 'first' --> ", tostring(first))
local _, title = GetAddOnInfo("VanillaGuide")
local author = GetAddOnMetadata("VanillaGuide", "Author")
local version = GetAddOnMetadata("VanillaGuide", "Version")
local CharName = UnitName("player")
local RealmName = GetRealmName()
local Class = UnitClass("player")
local Race = UnitRace("player")
local Faction = UnitFactionGroup("player")
Di(" Title: " .. title)
Di(" Author: " .. author .. " Version: |cccff1919" .. version .. "|r")
Dv(" - CharName: " .. CharName)
Dv(" - RealmName: " .. RealmName)
Dv(" - Class: " .. Class)
Dv(" - Race: " .. Race)
Dv(" - Faction: " .. Faction)
Dv(" ...let's check our old SavedVariables or create a new set...")
self.Settings = objSettings:new()
self.Settings:CheckSettings()
--self.Settings:PrintSettings()
self.GuideTable = objGuideTable:new(self.Settings)
self.Display = objDisplay:new(self.Settings, self.GuideTable)
self.UI = objUI:new(self.Settings, self.Display)
Dv(" -- Event |c00FF3333OnEnable|r: Player is logged in...loading UI!")
--Dv(" -- OnEnable End")
end
function VGuide:Ace2_AddonEnabled(addon, first)
--Dv(" -- Ace2_AddonEnabled Start")
if tostring(addon) == "VanillaGuide" then
if first then
Dv(" -- Event |c00FF3333Ace2_AddonEnabled|r: " .. tostring(addon) .. " Enabled for the first time!")
else
Dv(" -- Event |c00FF3333Ace2_AddonEnabled|r: " .. tostring(addon) .. " Enabled after...")
end
end
--Dv(" -- Ace2_AddonEnabled End")
end
function VGuide:OnDisable()
-- fired when AddOn is disabled
Dv(" -- OnDisable Start")
--local db = self.Settings:GetSettingsEntireCharDB()
--self.Settings:SetEntireCharDB(db)
Dv(" -- OnSidable End")
end
function VGuide:ZONE_CHANGED()
Dv(" -- ZONE_CHANGED Start")
--[[
if GetBindLocation() == GetSubZoneText() then
if self:IsShowInChat() then
self:Print(self:GetMessage())
end
if self:IsShowOnScreen() then
UIErrorsFrame:AddMessage(self:GetMessage(), 1.0, 1.0, 1.0, 5.0)
end
end
]]
Dv(" -- ZONE_CHANGED End")
end
Dv(" VGuide Core.lua End")
return VGuide