*Fix frenzy and Ferocious Inspiration proc.
*Add command .reset all pet_spells - use it if you still have problems with pet talents after recent revs changes (like pets with all talents for example) --HG-- branch : trunk
This commit is contained in:
@@ -14521,6 +14521,12 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
|
||||
InitTalentForLevel();
|
||||
learnDefaultSpells();
|
||||
|
||||
// must be done after aura loading for correct pet talent amount calculation
|
||||
if(HasAtLoginFlag(AT_LOGIN_RESET_PET_SPELLS))
|
||||
{
|
||||
_resetAllPetSpells();
|
||||
}
|
||||
|
||||
_LoadTutorials(holder->GetResult(PLAYER_LOGIN_QUERY_LOADTUTORIALS));
|
||||
|
||||
// must be before inventory (some items required reputation check)
|
||||
@@ -18585,6 +18591,44 @@ void Player::resetSpells()
|
||||
learnQuestRewardedSpells();
|
||||
}
|
||||
|
||||
void Player::_resetAllPetSpells()
|
||||
{
|
||||
if(HasAtLoginFlag(AT_LOGIN_RESET_PET_SPELLS))
|
||||
{
|
||||
m_atLoginFlags = m_atLoginFlags & ~AT_LOGIN_RESET_PET_SPELLS;
|
||||
CharacterDatabase.PExecute("UPDATE characters set at_login = at_login & ~ %u WHERE guid ='%u'", uint32(AT_LOGIN_RESET_PET_SPELLS), GetGUIDLow());
|
||||
}
|
||||
|
||||
if (QueryResult * result = CharacterDatabase.PQuery("SELECT id, level, entry FROM character_pet WHERE owner = '%u'", GetGUIDLow()))
|
||||
{
|
||||
// Mod points from owner SPELL_AURA_MOD_PET_TALENT_POINTS
|
||||
uint32 pointMod = GetTotalAuraModifier(SPELL_AURA_MOD_PET_TALENT_POINTS);
|
||||
do
|
||||
{
|
||||
Field *fields = result->Fetch();
|
||||
uint32 petId = fields[0].GetUInt32();
|
||||
uint32 level = fields[1].GetUInt32();
|
||||
uint32 entry = fields[2].GetUInt32();
|
||||
CreatureInfo const *ci = objmgr.GetCreatureTemplate(entry);
|
||||
if (!ci)
|
||||
sLog.outError("Unknown pet (id %d) type saved in character_pet!", petId);
|
||||
CreatureFamilyEntry const *pet_family = sCreatureFamilyStore.LookupEntry(ci->family);
|
||||
if (!pet_family)
|
||||
sLog.outError("Unknown pet (id %d) type saved in character_pet!", petId);
|
||||
if(pet_family && pet_family->petTalentType <= 0)
|
||||
{
|
||||
uint32 points = (level >= 20) ? ((level - 16) / 4) : 0;
|
||||
CharacterDatabase.PExecute("DELETE FROM pet_spell WHERE guid = '%u'", petId);
|
||||
std::ostringstream ss;
|
||||
ss << "UPDATE character_pet SET talentpoints = '"<<points + pointMod<<"' WHERE id = '"<<petId<<"'";
|
||||
sLog.outDebug(ss.str().c_str());
|
||||
CharacterDatabase.Execute(ss.str().c_str());
|
||||
}
|
||||
}
|
||||
while( result->NextRow() );
|
||||
}
|
||||
}
|
||||
|
||||
void Player::learnDefaultSpells()
|
||||
{
|
||||
// learn default race/class spells
|
||||
|
||||
Reference in New Issue
Block a user