Skip to content

Commit 067865c

Browse files
committed
Refactoring
1 parent 2f822f0 commit 067865c

File tree

3 files changed

+74
-74
lines changed

3 files changed

+74
-74
lines changed

Broker.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ local function MilitaryTime(v)
4646
local sec = floor(v) % 60
4747
local minute = floor(v/60) % 60
4848
local hour = floor(v/3600)
49-
49+
5050
if v >= 3600 then
5151
return format("%02.f:%02.f:%02.f", hour, minute, sec)
5252
else

Core.lua

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -15,58 +15,58 @@ local profile, char
1515

1616
function KIT:OnInitialize()
1717
self.db = LibStub("AceDB-3.0"):New("KethoInstanceTimerDB", S.defaults, true)
18-
18+
1919
self.db.RegisterCallback(self, "OnProfileChanged", "RefreshDB")
2020
self.db.RegisterCallback(self, "OnProfileCopied", "RefreshDB")
2121
self.db.RegisterCallback(self, "OnProfileReset", "RefreshDB")
2222
self:RefreshDB()
23-
23+
2424
self.db.global.version = S.VERSION
2525
self.db.global.build = S.BUILD
26-
26+
2727
options.args.libsink = self:GetSinkAce3OptionsDataTable()
2828
options.args.libsink.order = 2
29-
29+
3030
options.args.profiles = LibStub("AceDBOptions-3.0"):GetOptionsTable(self.db)
3131
options.args.profiles.order = 4
3232
options.args.profiles.name = "|TInterface\\Icons\\INV_Misc_Note_01:16:16:-2:-1"..S.crop.."|t "..options.args.profiles.name
33-
33+
3434
ACR:RegisterOptionsTable(NAME, S.options)
3535
ACD:AddToBlizOptions(NAME, NAME)
3636
ACD:SetDefaultSize(NAME, 550, 430)
37-
37+
3838
---------------------
3939
--- Dungeon Names ---
4040
---------------------
41-
41+
4242
if S.isRetail then
4343
-- grab the localized names from the dungeon finder
4444
for i = 1, GetNumRFDungeons() do
4545
local id, name = GetRFDungeonInfo(i)
4646
S.DungeonName[id] = name
4747
end
48-
48+
4949
for k, v in pairs(S.SpecialDungeon) do
5050
S.DungeonName[k] = GetLFGDungeonInfo(k)
5151
end
5252
end
53-
53+
5454
S.RemapDungeon()
55-
55+
5656
----------------------
5757
--- Slash Commands ---
5858
----------------------
59-
59+
6060
for _, v in ipairs({"kit", "kethoinstance", "kethoinstancetimer"}) do
6161
self:RegisterChatCommand(v, "SlashCommand")
6262
end
63-
63+
6464
-----------------------------
6565
--- Custom SavedVariables ---
6666
-----------------------------
67-
67+
6868
char.TimeInstanceList = char.TimeInstanceList or {}
69-
69+
7070
-- time data should be preserved between every /reload
7171
char.timeInstance = char.timeInstance or 0
7272
char.startDate = char.startDate or ""
@@ -77,17 +77,17 @@ function KIT:OnEnable()
7777
for _, v in ipairs(S.isRetail and S.Events or S.ClassicEvents) do
7878
self:RegisterEvent(v)
7979
end
80-
80+
8181
-- support [Class Colors] by Phanx
8282
if CUSTOM_CLASS_COLORS then
8383
CUSTOM_CLASS_COLORS:RegisterCallback("WipeCache", self)
8484
end
85-
85+
8686
-- player is not in a group (anymore) -> reset timer
8787
if not IsInGroup() then
8888
self:ResetTime(true)
8989
end
90-
90+
9191
-- initialize stopwatch while in an instance
9292
if S.IsStopwatch() then
9393
S.instance = select(2, IsInInstance())
@@ -97,11 +97,11 @@ end
9797

9898
function KIT:OnDisable()
9999
self:UnregisterAllEvents()
100-
100+
101101
if CUSTOM_CLASS_COLORS then
102102
CUSTOM_CLASS_COLORS:UnregisterCallback("WipeCache", self)
103103
end
104-
104+
105105
if S.IsStopwatch() then
106106
S.StopwatchEnd()
107107
end
@@ -110,9 +110,9 @@ end
110110
function KIT:RefreshDB()
111111
profile = self.db.profile
112112
char = self.db.char
113-
113+
114114
self:SetSinkStorage(profile) -- LibSink
115-
115+
116116
-- update table references in other files
117117
for i = 1, 2 do
118118
self["RefreshDB"..i](self)
@@ -153,18 +153,18 @@ end
153153

154154
function KIT:PLAYER_ENTERING_WORLD(event)
155155
S.instance = select(2, IsInInstance())
156-
156+
157157
local prevInstance = S.mapinstance
158158
S.mapinstance = select(8, GetInstanceInfo())
159-
159+
160160
if S.pve[S.instance] and not S.IsGarrison() then
161161
-- zoned from an instance to a different instance
162162
local changedInstances = prevInstance and prevInstance ~= S.mapinstance
163163
-- entered instance
164164
if char.timeInstance == 0 or changedInstances then
165165
self:StartData()
166166
end
167-
167+
168168
if S.IsStopwatch() then
169169
S.StopwatchStart()
170170
end
@@ -174,7 +174,7 @@ function KIT:PLAYER_ENTERING_WORLD(event)
174174
elseif (S.instance == "none" or S.IsGarrison()) and not IsInGroup(LE_PARTY_CATEGORY_INSTANCE) then
175175
-- left instance
176176
self:ResetTime(true)
177-
177+
178178
if profile.Stopwatch then
179179
S.StopwatchEnd()
180180
end
@@ -187,33 +187,33 @@ end
187187

188188
function KIT:COMBAT_LOG_EVENT_UNFILTERED(event)
189189
local timestamp, subevent, hideCaster, sourceGUID, sourceName, sourceFlags, sourceRaidFlags, destGUID, destName, destFlags, destRaidFlags = CombatLogGetCurrentEventInfo()
190-
190+
191191
if subevent ~= "UNIT_DIED" then return end
192-
192+
193193
local unitType, _, _, _, _, npcId = strsplit("-", destGUID)
194194
npcId = tonumber(npcId)
195-
195+
196196
local hasBossID = S.isRetail and S.BossIDs[npcId] or S.ClassicBossIDs[npcId]
197197
-- dont report raid finder in normal/heroic/mythic raids
198198
-- note that we still want to report in dungeons like maraudon and seasonal
199199
local name = not S.IsNormalRaid() and S.DungeonIDs[npcId] or hasBossID
200-
200+
201201
if S.npc[unitType] and name and char.timeInstance > 0 then
202-
202+
203203
-- boss fights with multiple npcs
204204
if S.Multiple[npcId] and not S.CheckMultiple(npcId) then return end
205-
205+
206206
-- if its raid finder/seasonal, get specific name, otherwise fall back to zone
207207
local name = (type(name) == "string") and name
208-
208+
209209
-- Record
210210
self:Record(name)
211-
211+
212212
-- Report
213213
if profile[S.instance] then
214214
self:Pour(self:InstanceText(nil, name))
215215
end
216-
216+
217217
self:Finalize()
218218
end
219219
end
@@ -229,7 +229,7 @@ function KIT:CHAT_MSG_SYSTEM(event, msg)
229229
-- left or kicked from group; or reset through ResetInstances()
230230
if msg == ERR_LEFT_GROUP_YOU or msg == ERR_UNINVITE_YOU or strfind(msg, INSTANCE_RESET_SUCCESS) then
231231
self:ResetTime(true)
232-
232+
233233
if profile.Stopwatch then
234234
S.StopwatchEnd()
235235
end
@@ -244,7 +244,7 @@ function KIT:LFG_PROPOSAL_SUCCEEDED(event)
244244
C_Timer.After(20, function()
245245
if char.timeInstance == 0 then
246246
self:StartData()
247-
247+
248248
if S.IsStopwatch() then
249249
S.StopwatchStart()
250250
end
@@ -261,11 +261,11 @@ function KIT:SecondaryCompletion()
261261
C_Timer.After(1, function()
262262
if char.timeInstance > 0 then
263263
self:Record()
264-
264+
265265
if profile[S.instance] then
266266
self:Pour(self:InstanceText())
267267
end
268-
268+
269269
self:Finalize()
270270
end
271271
end)

0 commit comments

Comments
 (0)