From 8f381f123597b95f11bddbd078a2ac5c984c5880 Mon Sep 17 00:00:00 2001 From: Tercio Jose Date: Wed, 4 Nov 2020 10:50:04 -0300 Subject: [PATCH] More fixes and debug for the Coach feature --- core/network.lua | 6 +++--- core/util.lua | 13 ++++++++++++- functions/pack.lua | 26 ++++++++++++++++++++------ 3 files changed, 35 insertions(+), 10 deletions(-) diff --git a/core/network.lua b/core/network.lua index b2c03fa5..8ae328fa 100644 --- a/core/network.lua +++ b/core/network.lua @@ -347,7 +347,7 @@ end function _detalhes.network.Wipe_Call (player, realm, core_version, ...) - local chr_name = Ambiguate (player .. "-" .. realm, "none") + local chr_name = Ambiguate(player, "none") if (UnitIsGroupLeader (chr_name)) then if (UnitIsInMyGuild (chr_name)) then _detalhes:CallWipe() @@ -429,7 +429,7 @@ if (UnitIsGroupLeader("player")) then if (Details.Coach.Server.IsEnabled()) then --update the current combat with new information - + Details.packFunctions.DeployUnpackedCombatData(data) end end end @@ -441,7 +441,7 @@ --guild sync A = received missing encounters, add them function _detalhes.network.GuildSync (player, realm, core_version, type, data) - local chr_name = Ambiguate (player .. "-" .. realm, "none") + local chr_name = Ambiguate(player, "none") if (UnitName ("player") == chr_name) then return diff --git a/core/util.lua b/core/util.lua index 150746b8..c4903c82 100644 --- a/core/util.lua +++ b/core/util.lua @@ -874,9 +874,14 @@ end end elseif (Details.Coach.Server.IsEnabled()) then + if (Details.debug) then + print("coach server is enabled, can't leave combat...") + end return true + end - + + --> don't leave the combat if is in the argus encounter ~REMOVE on 8.0 --[=[ if (_detalhes.encounter_table and _detalhes.encounter_table.id == 2092) then @@ -892,6 +897,12 @@ end return true end + if (not Details.Coach.Server.IsEnabled()) then + if (Details.debug) then + Details:Msg("coach is disabled, the combat is now over!") + end + end + _detalhes:SairDoCombate() end diff --git a/functions/pack.lua b/functions/pack.lua index 3b012f75..3374bc15 100644 --- a/functions/pack.lua +++ b/functions/pack.lua @@ -384,11 +384,15 @@ function Details.packFunctions.PackDamage(combatObject) --get the player object from the combat > damage container local playerName = UnitName("player") - local playerOBject = combatObject:GetActor(DETAILS_ATTRIBUTE_DAMAGE, playerName) - tinsert(actorsToPack, playerOBject) + local playerObject = combatObject:GetActor(DETAILS_ATTRIBUTE_DAMAGE, playerName) + if (not playerObject) then + return + end + + tinsert(actorsToPack, playerObject) --get the list of pets the player own - local playerPets = playerOBject.pets + local playerPets = playerObject.pets for _, petName in ipairs(playerPets) do local petObject = combatObject:GetActor(DETAILS_ATTRIBUTE_DAMAGE, petName) if (petObject) then @@ -590,11 +594,15 @@ function Details.packFunctions.PackHeal(combatObject) --get the player object from the combat > damage container local playerName = UnitName("player") - local playerOBject = combatObject:GetActor(DETAILS_ATTRIBUTE_HEAL, playerName) - tinsert(actorsToPack, playerOBject) + local playerObject = combatObject:GetActor(DETAILS_ATTRIBUTE_HEAL, playerName) + if (not playerObject) then + return + end + + tinsert(actorsToPack, playerObject) --get the list of pets the player own - local playerPets = playerOBject.pets + local playerPets = playerObject.pets for _, petName in ipairs(playerPets) do local petObject = combatObject:GetActor(DETAILS_ATTRIBUTE_HEAL, petName) if (petObject) then @@ -784,6 +792,12 @@ end --what this function receives? --@packedCombatData: packed combat, ready to be unpacked function Details.packFunctions.UnPackCombatData(packedCombatData) + + if (true) then + print("Details is calling the wrong function UnPackCombatData()") + return + end + local LibDeflate = _G.LibStub:GetLibrary("LibDeflate") local dataCompressed = LibDeflate:DecodeForWoWAddonChannel(packedCombatData) local combatDataString = LibDeflate:DecompressDeflate(dataCompressed)