From aa486a47794564737d4c17ab4b98f6c53518a6f8 Mon Sep 17 00:00:00 2001 From: Peter Eliasson Date: Tue, 20 Jan 2015 19:32:13 +0100 Subject: [PATCH] Fix for recount not detecting encounters. --- src/parse_modules/recount.lua | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/src/parse_modules/recount.lua b/src/parse_modules/recount.lua index b725b72..e4cd9c3 100644 --- a/src/parse_modules/recount.lua +++ b/src/parse_modules/recount.lua @@ -108,31 +108,35 @@ function mod:PutInCombat() self:Debug("Recount: PutInCombat"); self.recountFightEncounterId = self.currentEncounterId; - self.currentEncounterId = nil; end function mod:ENCOUNTER_START(event, encounterID, encounterName, difficultyID, raidSize) - self:Debug("Recount: ENCOUNTER_START"); - -- Since recount doesn't track the encounter itself, we have to do it. + -- We do this by setting the currentEncounterId whenever an encounter + -- starts. If recount is currently in combat, or if recount starts + -- combat between ENCOUNTER_START and END, then we track that fight as + -- the fight against the encounter id. + + self.currentEncounterId = encounterID; + if Recount.InCombat then -- If recount currently is in a fight then track -- the current encounter id as the encounter being fighted. self.recountFightEncounterId = encounterID; - self.currentEncounterId = nil; - else - -- If recount has not yet started a fight, store the current - -- encounter id. This will be set in the StartCombat hook. - self.currentEncounterId = encounterID; end end +function mod:ENCOUNTER_END(event, encounterId, encounterName, difficultyId, raidSize, endStatus) + self.currentEncounterId = nil; +end + function mod:OnEnable() self.pendingParseRequests = {}; self.currentEncounterId = nil; self.recountFightEncounterId = nil; - self:RegisterEvent("ENCOUNTER_START"); + self:RegisterEvent("ENCOUNTER_START"); + self:RegisterEvent("ENCOUNTER_END"); self:SecureHook(Recount, "LeaveCombat"); self:SecureHook(Recount, "PutInCombat"); @@ -144,6 +148,7 @@ function mod:OnDisable() self.recountFightEncounterId = nil; self:UnregisterEvent("ENCOUNTER_START"); + self:UnregisterEvent("ENCOUNTER_END"); self:UnHook(Recount, "LeaveCombat"); self:UnHook(Recount, "PutInCombat"); -- 1.7.9.5