Core/Pets: solved more pet issues

This commit is contained in:
Ovalord
2018-01-07 23:43:27 +01:00
parent 09bf919f1c
commit fea931eaf0
3 changed files with 14 additions and 6 deletions

View File

@@ -366,7 +366,10 @@ void Pet::SavePetToDB(PetSaveMode mode)
Optional<uint8> slot = IsHunterPet() ? GetOwner()->GetFirstUnusedActivePetSlot() : GetOwner()->GetFirstUnusedPetSlot();
if (slot)
{
SetActive(true);
SetSlot(*slot);
}
else
mode = PET_SAVE_AS_DELETED;
}
@@ -1313,10 +1316,6 @@ bool Pet::addSpell(uint32 spellId, ActiveStates active /*= ACT_DECIDE*/, PetSpel
return false;
}
// SPELL_ATTR4_UNK15 = DO NOT ADD SPELL TO SPELLBOOK OR ACTIONBAR
if (spellInfo->AttributesEx4 & SPELL_ATTR4_UNK15)
return false;
PetSpellMap::iterator itr = m_spells.find(spellId);
if (itr != m_spells.end())
{
@@ -1406,6 +1405,10 @@ bool Pet::addSpell(uint32 spellId, ActiveStates active /*= ACT_DECIDE*/, PetSpel
m_spells[spellId] = newspell;
// Do not go further if this Attribute exists
if (spellInfo->HasAttribute(SPELL_ATTR4_UNK15))
return true;
if (spellInfo->IsPassive() && (!spellInfo->CasterAuraState || HasAuraState(AuraStateType(spellInfo->CasterAuraState))))
CastSpell(this, spellId, true);
else

View File

@@ -21282,6 +21282,10 @@ void Player::PetSpellInitialize()
if (itr->second.state == PETSPELL_REMOVED)
continue;
// Do not send this spells, they are used indirectly
if (sSpellMgr->GetSpellInfo(itr->first)->HasAttribute(SPELL_ATTR4_UNK15))
continue;
data << uint32(MAKE_UNIT_ACTION_BUTTON(itr->first, itr->second.active));
++addlist;
}

View File

@@ -997,8 +997,6 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder* holder)
Pet::resetTalentsForAllPetsOf(pCurrChar);
pCurrChar->LoadPetsFromDB(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_ALL_PETS));
if (pCurrChar->getClass() == CLASS_HUNTER)
pCurrChar->GetSession()->SendStablePet(ObjectGuid::Empty);
// Load pet if any (if player not alive and in taxi flight or another then pet will remember as temporary unsummoned)
pCurrChar->LoadPet();
@@ -1112,6 +1110,9 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder* holder)
}
}
if (pCurrChar->getClass() == CLASS_HUNTER)
pCurrChar->GetSession()->SendStablePet(ObjectGuid::Empty);
// show time before shutdown if shutdown planned.
if (sWorld->IsShuttingDown())
sWorld->ShutdownMsg(true, pCurrChar);