Core/Pets: Pet management refactoring
Port From (https://github.com/TrinityCore/TrinityCore/commit/ca92686b44cc8c53a8991bf02d6e8534797fc115)
This commit is contained in:
@@ -536,10 +536,12 @@ namespace Game
|
||||
bool isdeclined = packet.RenameData.HasDeclinedNames;
|
||||
string name = packet.RenameData.NewName;
|
||||
|
||||
PetStable petStable = _player.GetPetStable();
|
||||
Pet pet = ObjectAccessor.GetPet(GetPlayer(), petguid);
|
||||
// check it!
|
||||
if (!pet || !pet.IsPet() || pet.ToPet().GetPetType() != PetType.Hunter || !pet.HasPetFlag(UnitPetFlags.CanBeRenamed) ||
|
||||
pet.GetOwnerGUID() != GetPlayer().GetGUID() || pet.GetCharmInfo() == null)
|
||||
pet.GetOwnerGUID() != _player.GetGUID() || pet.GetCharmInfo() == null ||
|
||||
petStable == null || petStable.CurrentPet == null || petStable.CurrentPet.PetNumber != pet.GetCharmInfo().GetPetNumber())
|
||||
return;
|
||||
|
||||
PetNameInvalidReason res = ObjectManager.CheckPetName(name);
|
||||
@@ -559,6 +561,9 @@ namespace Game
|
||||
pet.SetGroupUpdateFlag(GroupUpdatePetFlags.Name);
|
||||
pet.RemovePetFlag(UnitPetFlags.CanBeRenamed);
|
||||
|
||||
petStable.CurrentPet.Name = name;
|
||||
petStable.CurrentPet.WasRenamed = true;
|
||||
|
||||
PreparedStatement stmt;
|
||||
SQLTransaction trans = new();
|
||||
if (isdeclined)
|
||||
|
||||
Reference in New Issue
Block a user