[8041] Avoid send talent info many times at loading. Small cleanups.

This commit is contained in:
VladimirMangos 2009-06-18 21:59:47 +04:00
parent 68848314e2
commit 3e2b810376
6 changed files with 16 additions and 17 deletions

View file

@ -4652,7 +4652,7 @@ bool ChatHandler::HandleResetTalentsCommand(const char * args)
return true; return true;
} }
// Try reset talenents as Hunter Pet // Try reset talents as Hunter Pet
Creature* creature = getSelectedCreature(); Creature* creature = getSelectedCreature();
if (creature && creature->isPet() && ((Pet *)creature)->getPetType() == HUNTER_PET) if (creature && creature->isPet() && ((Pet *)creature)->getPetType() == HUNTER_PET)
{ {

View file

@ -423,7 +423,7 @@ Player::Player (WorldSession *session): Unit(), m_achievementMgr(this), m_reputa
m_lastPotionId = 0; m_lastPotionId = 0;
m_activeSpec = 0; m_activeSpec = 0;
m_specsCount = 0; m_specsCount = 1;
for (int i = 0; i < BASEMOD_END; ++i) for (int i = 0; i < BASEMOD_END; ++i)
{ {
@ -2359,7 +2359,8 @@ void Player::InitTalentForLevel()
SetFreeTalentPoints(talentPointsForLevel-m_usedTalentCount); SetFreeTalentPoints(talentPointsForLevel-m_usedTalentCount);
} }
SendTalentsInfoData(false); // update at client if(!GetSession()->PlayerLoading())
SendTalentsInfoData(false); // update at client
} }
void Player::InitStatsForLevel(bool reapplyMods) void Player::InitStatsForLevel(bool reapplyMods)
@ -3250,7 +3251,6 @@ void Player::removeSpell(uint32 spell_id, bool disabled, bool update_action_bar_
} }
} }
void Player::RemoveSpellCooldown( uint32 spell_id, bool update /* = false */ ) void Player::RemoveSpellCooldown( uint32 spell_id, bool update /* = false */ )
{ {
m_spellCooldowns.erase(spell_id); m_spellCooldowns.erase(spell_id);
@ -19994,14 +19994,13 @@ bool Player::canSeeSpellClickOn(Creature const *c) const
void Player::BuildPlayerTalentsInfoData(WorldPacket *data) void Player::BuildPlayerTalentsInfoData(WorldPacket *data)
{ {
*data << uint32(GetFreeTalentPoints()); // unspentTalentPoints *data << uint32(GetFreeTalentPoints()); // unspentTalentPoints
uint8 talentGroupCount = 1; *data << uint8(m_specsCount); // talent group count (0, 1 or 2)
*data << uint8(talentGroupCount); // talent group count (0, 1 or 2) *data << uint8(m_activeSpec); // talent group index (0 or 1)
*data << uint8(0); // talent group index (0 or 1)
if(talentGroupCount) if(m_specsCount)
{ {
// loop through all specs (only 1 for now) // loop through all specs (only 1 for now)
for(uint32 groups = 0; groups < talentGroupCount; ++groups) for(uint32 specIdx = 0; specIdx < m_specsCount; ++specIdx)
{ {
uint8 talentIdCount = 0; uint8 talentIdCount = 0;
size_t pos = data->wpos(); size_t pos = data->wpos();
@ -20026,7 +20025,7 @@ void Player::BuildPlayerTalentsInfoData(WorldPacket *data)
// find max talent rank // find max talent rank
int32 curtalent_maxrank = -1; int32 curtalent_maxrank = -1;
for(int32 k = 4; k > -1; --k) for(int32 k = MAX_TALENT_RANK-1; k > -1; --k)
{ {
if(talentInfo->RankID[k] && HasSpell(talentInfo->RankID[k])) if(talentInfo->RankID[k] && HasSpell(talentInfo->RankID[k]))
{ {
@ -20300,4 +20299,4 @@ void Player::ActivateSpec(uint32 specNum)
return; return;
resetTalents(true); resetTalents(true);
} }

View file

@ -681,8 +681,8 @@ enum SpellEffects
SPELL_EFFECT_MILLING = 158, SPELL_EFFECT_MILLING = 158,
SPELL_EFFECT_ALLOW_RENAME_PET = 159, SPELL_EFFECT_ALLOW_RENAME_PET = 159,
SPELL_EFFECT_160 = 160, SPELL_EFFECT_160 = 160,
SPELL_EFFECT_161 = 161, SPELL_EFFECT_TALENT_SPEC_COUNT = 161,
SPELL_EFFECT_162 = 162, SPELL_EFFECT_TALENT_SPEC_SELECT = 162,
TOTAL_SPELL_EFFECTS = 163 TOTAL_SPELL_EFFECTS = 163
}; };

View file

@ -5712,4 +5712,4 @@ void Spell::FillRaidOrPartyHealthPriorityTargets( UnitList &TagUnitMap, Unit* ta
TagUnitMap.push_back(healthQueue.top().getUnit()); TagUnitMap.push_back(healthQueue.top().getUnit());
healthQueue.pop(); healthQueue.pop();
} }
} }

View file

@ -218,8 +218,8 @@ pEffect SpellEffects[TOTAL_SPELL_EFFECTS]=
&Spell::EffectMilling, //158 SPELL_EFFECT_MILLING milling &Spell::EffectMilling, //158 SPELL_EFFECT_MILLING milling
&Spell::EffectRenamePet, //159 SPELL_EFFECT_ALLOW_RENAME_PET allow rename pet once again &Spell::EffectRenamePet, //159 SPELL_EFFECT_ALLOW_RENAME_PET allow rename pet once again
&Spell::EffectNULL, //160 SPELL_EFFECT_160 unused &Spell::EffectNULL, //160 SPELL_EFFECT_160 unused
&Spell::EffectNULL, //161 SPELL_EFFECT_161 second talent spec (learn/revert) &Spell::EffectNULL, //161 SPELL_EFFECT_TALENT_SPEC_COUNT second talent spec (learn/revert)
&Spell::EffectNULL //162 SPELL_EFFECT_162 activate primary/secondary spec &Spell::EffectNULL, //162 SPELL_EFFECT_TALENT_SPEC_SELECT activate primary/secondary spec
}; };
void Spell::EffectNULL(uint32 /*i*/) void Spell::EffectNULL(uint32 /*i*/)

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "8040" #define REVISION_NR "8041"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__