mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-30 09:03:47 +00:00
fix(Core/Pets): Improved Revive Pet should affect dead despawned pet. (#9625)
* fix(Core/Pets): Improved Revive Pet should affect dead despawned pet. Fixes #9589
This commit is contained in:
@@ -222,7 +222,7 @@ bool Pet::LoadPetFromDB(Player* owner, uint8 asynchLoadType, uint32 petentry, ui
|
||||
{
|
||||
// process only if player is in world (teleport crashes?)
|
||||
// otherwise wait with result till he logs in
|
||||
uint8 loadResult = mySess->HandleLoadPetFromDBFirstCallback(result, asynchLoadType);
|
||||
uint8 loadResult = mySess->HandleLoadPetFromDBFirstCallback(result, asynchLoadType, info);
|
||||
|
||||
if (loadResult != PET_LOAD_OK)
|
||||
Pet::HandleAsynchLoadFailed(info, owner, asynchLoadType, loadResult);
|
||||
@@ -2328,6 +2328,11 @@ void Pet::HandleAsynchLoadFailed(AsynchPetSummon* info, Player* player, uint8 as
|
||||
//owner->PetSpellInitialize();
|
||||
pet->SavePetToDB(PET_SAVE_AS_CURRENT, false);
|
||||
}
|
||||
|
||||
if (info->m_healthPct)
|
||||
{
|
||||
pet->SetHealth(pet->CountPctFromMaxHealth(info->m_healthPct));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -35,15 +35,15 @@ struct PetSpell
|
||||
class AsynchPetSummon
|
||||
{
|
||||
public:
|
||||
AsynchPetSummon(uint32 entry, Position position, PetType petType, uint32 duration, uint32 createdBySpell, ObjectGuid casterGUID) :
|
||||
m_entry(entry), pos(position), m_petType(petType),
|
||||
m_duration(duration), m_createdBySpell(createdBySpell), m_casterGUID(casterGUID) { }
|
||||
AsynchPetSummon(uint32 entry, Position position, PetType petType, uint32 duration, uint32 createdBySpell, ObjectGuid casterGUID, int32 healthPct = 0) :
|
||||
m_entry(entry), pos(position), m_petType(petType), m_duration(duration), m_createdBySpell(createdBySpell), m_casterGUID(casterGUID), m_healthPct(healthPct) { }
|
||||
|
||||
uint32 m_entry;
|
||||
Position pos;
|
||||
PetType m_petType;
|
||||
uint32 m_duration, m_createdBySpell;
|
||||
ObjectGuid m_casterGUID;
|
||||
int32 m_healthPct;
|
||||
};
|
||||
|
||||
typedef std::unordered_map<uint32, PetSpell> PetSpellMap;
|
||||
|
||||
@@ -15136,13 +15136,13 @@ Guild* Player::GetGuild() const
|
||||
return guildId ? sGuildMgr->GetGuildById(guildId) : nullptr;
|
||||
}
|
||||
|
||||
void Player::SummonPet(uint32 entry, float x, float y, float z, float ang, PetType petType, uint32 duration, uint32 createdBySpell, ObjectGuid casterGUID, uint8 asynchLoadType)
|
||||
void Player::SummonPet(uint32 entry, float x, float y, float z, float ang, PetType petType, uint32 duration, uint32 createdBySpell, ObjectGuid casterGUID, uint8 asynchLoadType, int32 healthPct /*= 0*/)
|
||||
{
|
||||
Position pos = {x, y, z, ang};
|
||||
if (!pos.IsPositionValid())
|
||||
return;
|
||||
|
||||
AsynchPetSummon* asynchPetInfo = new AsynchPetSummon(entry, pos, petType, duration, createdBySpell, casterGUID);
|
||||
AsynchPetSummon* asynchPetInfo = new AsynchPetSummon(entry, pos, petType, duration, createdBySpell, casterGUID, healthPct);
|
||||
Pet::LoadPetFromDB(this, asynchLoadType, entry, 0, false, asynchPetInfo);
|
||||
}
|
||||
|
||||
|
||||
@@ -1165,7 +1165,7 @@ public:
|
||||
|
||||
[[nodiscard]] Pet* GetPet() const;
|
||||
bool IsPetDismissed();
|
||||
void SummonPet(uint32 entry, float x, float y, float z, float ang, PetType petType, uint32 despwtime, uint32 createdBySpell, ObjectGuid casterGUID, uint8 asynchLoadType);
|
||||
void SummonPet(uint32 entry, float x, float y, float z, float ang, PetType petType, uint32 despwtime, uint32 createdBySpell, ObjectGuid casterGUID, uint8 asynchLoadType, int32 healthPct = 0);
|
||||
void RemovePet(Pet* pet, PetSaveMode mode, bool returnreagent = false);
|
||||
[[nodiscard]] uint32 GetPhaseMaskForSpawn() const; // used for proper set phase for DB at GM-mode creature/GO spawn
|
||||
|
||||
|
||||
Reference in New Issue
Block a user