Removed pet duplication bug and removed debug lines for no ownerName

This commit is contained in:
Tercio Jose
2024-06-14 21:54:11 -03:00
committed by andrew6180
parent f6c59381ab
commit af7e801136
2 changed files with 15 additions and 9 deletions
+10 -7
View File
@@ -609,12 +609,13 @@ end
end
petContainer.AddPet(petGuid, petName, petFlags, ownerGuid, ownerName, ownerFlags)
local petNameWithOwner, ownerName, ownerGUID, ownerFlags = petContainer.GetOwner(petGuid, petName)
--hashName is "petName <ownerName>"
local hashName, ownerName, ownerGUID, ownerFlags = petContainer.GetOwner(petGuid, petName)
local petOwnerActorObject
if (petNameWithOwner and ownerName) then
petName = petNameWithOwner
if (hashName and ownerName) then
petName = hashName
petOwnerActorObject = self:PegarCombatente(ownerGUID, ownerName, ownerFlags, true)
end
@@ -645,9 +646,10 @@ 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
local petName, ownerName, ownerGuid, ownerFlag = petContainer.GetOwner(actorSerial, actorName)
if (petName and ownerName and ownerGuid and ownerGuid ~= actorSerial and ownerFlag) then
actorName = petName
--hashName is "petName <ownerName>"
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
@@ -655,7 +657,8 @@ end
elseif (not petBlackList[actorSerial]) then --check if is a pet
--try to find the owner
if (actorFlags and bitBand(actorFlags, OBJECT_TYPE_PETGUARDIAN) ~= 0) then
local ownerName, ownerGuid, ownerFlags = petContainer.GetOwner(actorSerial, actorName)
--hashName is "petName <ownerName>"
local hashName, ownerName, ownerGuid, ownerFlags = petContainer.GetOwner(actorSerial, actorName) --hashName, ownerName, ownerGuid, ownerFlags
if (ownerName and ownerGuid) then
--don't pass ownerFlags just in case the cached owner happens to be an enemy from last combat, but ally now.
local newPetName, ownerObject = petOwnerFound(ownerName, actorSerial, actorName, actorFlags, self, ownerGuid)
+5 -2
View File
@@ -149,7 +149,7 @@ function petContainer.AddPet(petGuid, petName, petFlags, ownerGuid, ownerName, o
local bIsFriendly = petFlags and bitBand(petFlags, OBJECT_TYPE_PET) ~= 0 and bitBand(petFlags, OBJECT_IN_GROUP) ~= 0
if (not ownerName) then
print("NO OWNER NAME",petGuid, petName, petFlags, ownerGuid, ownerName, ownerFlags, summonSpellId)
--print("NO OWNER NAME",petGuid, petName, petFlags, ownerGuid, ownerName, ownerFlags, summonSpellId)
--NO OWNER NAME Creature-0-4218-2549-4490-61056-00006A5157 Primal Earth Elemental 2600 nil nil nil 118323 --spellId 118323: Earth Elemental
--NO OWNER NAME Pet-0-4218-2549-4490-26125-0102D77C2C Casketmuncher 4648 nil nil nil 52150 --spellId: 52150 raise dead
--NO OWNER NAME Creature-0-4214-2569-1456-202167-00006B35A1 Ray of Anguish 2632 nil nil nil 402191 --spellId: 402191 Ray of Anguish
@@ -281,7 +281,10 @@ end
---@param petGuid guid
---@param petName actorname
---@return actorname?, actorname?, guid?, number?
---@return actorname? petNameWithOwner
---@return actorname? ownerName
---@return guid? ownerGuid
---@return number? ownerFlags
function petContainer.GetOwner(petGuid, petName)
Details222.Profiling.ProfileStart("petContainer.GetOwner")