Added more tools to debug pets on '/details debug' and '/details mypets'

This commit is contained in:
Tercio Jose
2024-07-13 23:56:21 -03:00
committed by andrew6180
parent a90ab80de3
commit 7538b36b2a
10 changed files with 366 additions and 24 deletions
+13 -2
View File
@@ -639,7 +639,7 @@ end
---@param actorName string
---@param actorFlags number
---@param bShouldCreateActor boolean
---@return table|nil, table|nil, string|nil
---@return actor|nil, actor|nil, actorname|nil
function actorContainer:PegarCombatente(actorSerial, actorName, actorFlags, bShouldCreateActor)
return self:GetOrCreateActor(actorSerial, actorName, actorFlags, bShouldCreateActor)
end
@@ -648,7 +648,7 @@ end
---@param actorName string
---@param actorFlags number
---@param bShouldCreateActor boolean
---@return table|nil, table|nil, string|nil
---@return actor|nil, actor|nil, actorname|nil
function actorContainer:GetOrCreateActor(actorSerial, actorName, actorFlags, bShouldCreateActor)
--need to check if the actor is a pet
local petOwnerObject
@@ -657,12 +657,23 @@ end
--check if this actor is a pet and the pet is in the pet cache
if (petContainer.IsPetInCache(actorSerial)) then --this is a registered pet
--hashName is "petName <ownerName>"
--actorSerial: petGuid, actorName: petName
local hashName, ownerName, ownerGuid, ownerFlag = petContainer.GetOwner(actorSerial, actorName) --hashName, ownerName, ownerGuid, ownerFlags
if (hashName and ownerName and ownerGuid and ownerGuid ~= actorSerial and ownerFlag) then
actorName = hashName
petOwnerObject = self:PegarCombatente(ownerGuid, ownerName, ownerFlag, true)
end
if (Details222.Debug.DebugPets or Details222.Debug.DebugPlayerPets) then
Details:Msg("DebugPets|ActorContainer|petContainer.IsPetInCache(actorSerial) = true")
if (hashName) then
Details:Msg("DebugPets|ActorContainer|Owner Found In Pet Cache|OwnerName:", ownerName, "Actor Hash:", hashName, "petOwnerObject:", petOwnerObject)
else
Details:Msg("DebugPets|ActorContainer|Pet Is Orphan|petContainer.GetOwner(", actorSerial, actorName, ") == nil")
end
end
--this actor isn't in the pet cache
elseif (not petBlackList[actorSerial]) then --check if is a pet
--try to find the owner
+24
View File
@@ -100,6 +100,22 @@ function Details.DebugPets()
dumpt(toShow)
end
function Details.DebugMyPets()
local amountPets = 0
local myPets = {}
local playerGUID = UnitGUID("player")
for petGuid, petData in pairs(petContainer.Pets) do
---@cast petData petdata
if (petData.ownerGuid == playerGUID) then
myPets[petGuid] = petData
amountPets = amountPets + 1
end
end
dumpt(myPets)
end
---add a pet guid into the ignored list, when a pet is ignored the system will not try to find its owner as it already failed to find it once
---@param petGuid guid
function petContainer.IgnorePet(petGuid)
@@ -119,6 +135,7 @@ end
---return the pet data from the cache by passing the pet guid
---@param petGuid guid
---@return petdata?
function petContainer.GetPetInfo(petGuid)
return petContainer.Pets[petGuid]
end
@@ -161,6 +178,13 @@ function petContainer.AddPet(petGuid, petName, petFlags, ownerGuid, ownerName, o
return
end
if (Details222.Debug.DebugPets) then
Details:Msg("petContainer.AddPet", petGuid, petName, petFlags, ownerGuid, ownerName, ownerFlags, summonSpellId)
elseif (Details222.Debug.DebugPlayerPets and ownerName == Details.playername) then
Details:Msg("petContainer.AddPet", petGuid, petName, petFlags, ownerGuid, ownerName, ownerFlags, summonSpellId)
end
--print("====================================")
--print(petName)
--print(debugstack())