fix(Core/Hunter): Stable Master, exotics pets management, tame validations. (#2100)

This commit is contained in:
GMKyle
2019-09-25 12:29:18 -04:00
committed by Francesco Borzì
parent 8689903f58
commit 58f3cfe387
11 changed files with 246 additions and 31 deletions

View File

@@ -20815,7 +20815,10 @@ void Player::RemovePet(Pet* pet, PetSaveMode mode, bool returnreagent)
{
// xinef: dont save dead pet as current, save him not in slot
if (!pet->IsAlive() && mode == PET_SAVE_AS_CURRENT && pet->getPetType() == HUNTER_PET)
{
mode = PET_SAVE_NOT_IN_SLOT;
m_temporaryUnsummonedPetNumber = 0;
}
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_PETS, "RemovePet %u, %u, %u", pet->GetEntry(), mode, returnreagent);
@@ -27579,3 +27582,19 @@ void Player::SummonPet(uint32 entry, float x, float y, float z, float ang, PetTy
AsynchPetSummon* asynchPetInfo = new AsynchPetSummon(entry, pos, petType, duration, createdBySpell, casterGUID);
Pet::LoadPetFromDB(this, asynchLoadType, entry, 0, false, asynchPetInfo);
}
bool Player::IsPetDismissed()
{
/*
* Check PET_SAVE_NOT_IN_SLOT means the pet is dismissed. If someone ever
* Changes the slot flag, they will break this validation.
*/
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_PET_BY_ENTRY_AND_SLOT);
stmt->setUInt32(0, GetGUIDLow());
stmt->setUInt8(1, uint8(PET_SAVE_NOT_IN_SLOT));
if (PreparedQueryResult result = CharacterDatabase.AsyncQuery(stmt))
return true;
return false;
}