local _,rematch = ... local L = rematch.localization local C = rematch.constants local settings = rematch.settings rematch.winrecord = {} local playerForfeit -- true when the player forfeits a match rematch.events:Register(rematch.winrecord,"PLAYER_LOGIN",function(self) self:Update() -- register/unregister based on settings hooksecurefunc(C_PetBattles,"ForfeitGame",function() playerForfeit=true end) -- watch for player forfeiting match end) function rematch.winrecord:Update() if settings.AutoWinRecord then rematch.events:Register(self,"PET_BATTLE_FINAL_ROUND",self.PET_BATTLE_FINAL_ROUND) rematch.events:Register(self,"PET_BATTLE_OPENING_START",self.PET_BATTLE_OPENING_START) else rematch.events:Unregister(self,"PET_BATTLE_FINAL_ROUND") end end local function teamAlive(player) local numPets = C_PetBattles.GetNumPets(player) for i=1,3 do local health = C_PetBattles.GetHealth(player,i) if health and health>0 and i