Applied coding style.

This commit is contained in:
tomrus88 2009-05-21 19:45:18 +04:00
parent d6782d067b
commit c802504304
5 changed files with 477 additions and 506 deletions

View file

@ -422,6 +422,9 @@ Player::Player (WorldSession *session): Unit(), m_achievementMgr(this), m_reputa
m_lastPotionId = 0;
m_activeSpec = 0;
m_speakCount = 0;
for (int i = 0; i < BASEMOD_END; ++i)
{
m_auraBaseMod[i][FLAT_MOD] = 0.0f;
@ -2740,7 +2743,7 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen
if(next_active_spell_id)
{
// update spell ranks in spellbook and action bar
WorldPacket data(SMSG_SUPERCEDED_SPELL, (4));
WorldPacket data(SMSG_SUPERCEDED_SPELL, 4 + 4);
data << uint32(spell_id);
data << uint32(next_active_spell_id);
GetSession()->SendPacket( &data );
@ -2839,7 +2842,7 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen
{
if(IsInWorld()) // not send spell (re-/over-)learn packets at loading
{
WorldPacket data(SMSG_SUPERCEDED_SPELL, (4));
WorldPacket data(SMSG_SUPERCEDED_SPELL, 4 + 4);
data << uint32(itr2->first);
data << uint32(spell_id);
GetSession()->SendPacket( &data );
@ -2855,7 +2858,7 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen
{
if(IsInWorld()) // not send spell (re-/over-)learn packets at loading
{
WorldPacket data(SMSG_SUPERCEDED_SPELL, (4));
WorldPacket data(SMSG_SUPERCEDED_SPELL, 4 + 4);
data << uint32(spell_id);
data << uint32(itr2->first);
GetSession()->SendPacket( &data );
@ -3003,7 +3006,7 @@ bool Player::IsNeedCastPassiveSpellAtLearn(SpellEntry const* spellInfo) const
switch(spellInfo->Id)
{
// some spells not have stance data expacted cast at form change or present
// some spells not have stance data expected cast at form change or present
case 5420: need_cast = (m_form == FORM_TREE); break;
case 5419: need_cast = (m_form == FORM_TRAVEL); break;
case 7376: need_cast = (m_form == FORM_DEFENSIVESTANCE); break;
@ -3213,7 +3216,7 @@ void Player::removeSpell(uint32 spell_id, bool disabled, bool update_action_bar_
if(update_action_bar_for_low_rank)
{
// downgrade spell ranks in spellbook and action bar
WorldPacket data(SMSG_SUPERCEDED_SPELL, (4));
WorldPacket data(SMSG_SUPERCEDED_SPELL, 4 + 4);
data << uint32(spell_id);
data << uint32(prev_id);
GetSession()->SendPacket( &data );
@ -3241,7 +3244,7 @@ void Player::RemoveSpellCooldown( uint32 spell_id, bool update /* = false */ )
if(update)
{
WorldPacket data(SMSG_CLEAR_COOLDOWN, (4+8));
WorldPacket data(SMSG_CLEAR_COOLDOWN, 4+8);
data << uint32(spell_id);
data << uint64(GetGUID());
SendDirectMessage(&data);
@ -3264,7 +3267,7 @@ void Player::RemoveArenaSpellCooldowns()
entry->CategoryRecoveryTime <= 15 * MINUTE * IN_MILISECONDS )
{
// notify player
WorldPacket data(SMSG_CLEAR_COOLDOWN, (4+8));
WorldPacket data(SMSG_CLEAR_COOLDOWN, 4+8);
data << uint32(itr->first);
data << uint64(GetGUID());
GetSession()->SendPacket(&data);
@ -3280,7 +3283,7 @@ void Player::RemoveAllSpellCooldown()
{
for(SpellCooldowns::const_iterator itr = m_spellCooldowns.begin();itr != m_spellCooldowns.end(); ++itr)
{
WorldPacket data(SMSG_CLEAR_COOLDOWN, (4+8));
WorldPacket data(SMSG_CLEAR_COOLDOWN, 4+8);
data << uint32(itr->first);
data << uint64(GetGUID());
GetSession()->SendPacket(&data);
@ -14921,18 +14924,18 @@ void Player::_LoadQuestStatus(QueryResult *result)
// add to quest log
if( slot < MAX_QUEST_LOG_SIZE &&
( questStatusData.m_status==QUEST_STATUS_INCOMPLETE ||
questStatusData.m_status==QUEST_STATUS_COMPLETE &&
( questStatusData.m_status == QUEST_STATUS_INCOMPLETE ||
questStatusData.m_status == QUEST_STATUS_COMPLETE &&
(!questStatusData.m_rewarded || pQuest->IsDaily()) ) )
{
SetQuestSlot(slot,quest_id,quest_time);
SetQuestSlot(slot, quest_id, quest_time);
if(questStatusData.m_status == QUEST_STATUS_COMPLETE)
SetQuestSlotState(slot,QUEST_STATE_COMPLETE);
SetQuestSlotState(slot, QUEST_STATE_COMPLETE);
for(uint8 idx = 0; idx < QUEST_OBJECTIVES_COUNT; ++idx)
if(questStatusData.m_creatureOrGOcount[idx])
SetQuestSlotCounter(slot,idx,questStatusData.m_creatureOrGOcount[idx]);
SetQuestSlotCounter(slot, idx, questStatusData.m_creatureOrGOcount[idx]);
++slot;
}
@ -14950,7 +14953,7 @@ void Player::_LoadQuestStatus(QueryResult *result)
}
if(pQuest->GetBonusTalents())
m_questRewardTalentCount+=pQuest->GetBonusTalents();
m_questRewardTalentCount += pQuest->GetBonusTalents();
}
sLog.outDebug("Quest status is {%u} for quest {%u} for player (GUID: %u)", questStatusData.m_status, quest_id, GetGUIDLow());
@ -14963,7 +14966,7 @@ void Player::_LoadQuestStatus(QueryResult *result)
// clear quest log tail
for ( uint16 i = slot; i < MAX_QUEST_LOG_SIZE; ++i )
SetQuestSlot(i,0);
SetQuestSlot(i, 0);
}
void Player::_LoadDailyQuestStatus(QueryResult *result)
@ -15177,7 +15180,7 @@ void Player::SendRaidInfo()
}
}
}
data.put<uint32>(p_counter,counter);
data.put<uint32>(p_counter, counter);
GetSession()->SendPacket(&data);
}
@ -16962,8 +16965,8 @@ void Player::ProhibitSpellScholl(SpellSchoolMask idSchoolMask, uint32 unTimeMs )
if((idSchoolMask & GetSpellSchoolMask(spellInfo)) && GetSpellCooldownDelay(unSpellId) < unTimeMs )
{
data << unSpellId;
data << unTimeMs; // in m.secs
data << uint32(unSpellId);
data << uint32(unTimeMs); // in m.secs
AddSpellCooldown(unSpellId, 0, curTime + unTimeMs/IN_MILISECONDS);
}
}
@ -17954,7 +17957,7 @@ void Player::SendInitialPacketsBeforeAddToMap()
SendEquipmentSetList();
data.Initialize(SMSG_LOGIN_SETTIMESPEED, 8);
data.Initialize(SMSG_LOGIN_SETTIMESPEED, 4 + 4 + 4);
data << uint32(secsToTimeBitFields(sWorld.GetGameTime()));
data << (float)0.01666667f; // game speed
data << uint32(0); // added in 3.1.2
@ -20280,4 +20283,12 @@ void Player::DeleteEquipmentSet(uint64 setGuid)
break;
}
}
}
void Player::ActivateSpec(uint32 specNum)
{
if(GetActiveSpec() == specNum)
return;
resetTalents(true);
}

View file

@ -1402,6 +1402,13 @@ class MANGOS_DLL_SPEC Player : public Unit
uint32 CalculateTalentsPoints() const;
// Dual Spec
uint32 GetActiveSpec() { return m_activeSpec; }
void SetActiveSpec(uint32 spec) { m_activeSpec = spec; }
uint32 GetSpecsCount() { return m_specsCount; }
void SetSpecsCount(uint32 count) { m_specsCount = count; }
void ActivateSpec(uint32 specNum);
void InitGlyphsForLevel();
void SetGlyphSlot(uint8 slot, uint32 slottype) { SetUInt32Value(PLAYER_FIELD_GLYPH_SLOTS_1 + slot, slottype); }
uint32 GetGlyphSlot(uint8 slot) { return GetUInt32Value(PLAYER_FIELD_GLYPH_SLOTS_1 + slot); }
@ -2209,6 +2216,9 @@ class MANGOS_DLL_SPEC Player : public Unit
SpellCooldowns m_spellCooldowns;
uint32 m_lastPotionId; // last used health/mana potion in combat, that block next potion use
uint32 m_activeSpec;
uint32 m_specsCount;
ActionButtonList m_actionButtons;
float m_auraBaseMod[BASEMOD_END][MOD_END];

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -305,7 +305,7 @@ void Unit::SendMonsterMoveByPath(Path const& path, uint32 start, uint32 end, uin
{
uint32 traveltime = uint32(path.GetTotalLength(start, end) * 32);
uint32 pathSize = end-start;
uint32 pathSize = end - start;
WorldPacket data( SMSG_MONSTER_MOVE, (GetPackGUID().size()+1+4+4+4+4+1+4+4+4+pathSize*4*3) );
data.append(GetPackGUID());
@ -551,7 +551,6 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa
if (pVictim->GetTypeId() == TYPEID_PLAYER)
((Player*)pVictim)->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_TOTAL_DAMAGE_RECEIVED, health);
// find player: owner of controlled `this` or `this` itself maybe
Player *player = GetCharmerOrOwnerPlayerOrPlayerItself();
@ -1154,7 +1153,7 @@ void Unit::DealSpellDamage(SpellNonMeleeDamage *damageInfo, bool durabilityLoss)
if(pVictim != this && GetTypeId() == TYPEID_PLAYER && pVictim->GetTypeId() == TYPEID_PLAYER)
{
const AreaTableEntry *area = GetAreaEntryByAreaID(pVictim->GetAreaId());
if(area && area->flags & 0x800) //sanctuary
if(area && area->flags & AREA_FLAG_SANCTUARY) // sanctuary
return;
}
@ -1429,11 +1428,11 @@ void Unit::DealMeleeDamage(CalcDamageInfo *damageInfo, bool durabilityLoss)
if(pVictim != this && GetTypeId() == TYPEID_PLAYER && pVictim->GetTypeId() == TYPEID_PLAYER)
{
const AreaTableEntry *area = GetAreaEntryByAreaID(pVictim->GetAreaId());
if(area && area->flags & 0x800) //sanctuary
if(area && area->flags & AREA_FLAG_SANCTUARY) // sanctuary
return;
}
// Hmmmm dont like this emotes cloent must by self do all animations
// Hmmmm dont like this emotes client must by self do all animations
if (damageInfo->HitInfo&HITINFO_CRITICALHIT)
pVictim->HandleEmoteCommand(EMOTE_ONESHOT_WOUNDCRITICAL);
if(damageInfo->blocked_amount && damageInfo->TargetState!=VICTIMSTATE_BLOCKS)
@ -1558,7 +1557,7 @@ void Unit::DealMeleeDamage(CalcDamageInfo *damageInfo, bool durabilityLoss)
void Unit::HandleEmoteCommand(uint32 anim_id)
{
WorldPacket data( SMSG_EMOTE, 12 );
WorldPacket data( SMSG_EMOTE, 4 + 8 );
data << uint32(anim_id);
data << uint64(GetGUID());
SendMessageToSet(&data, true);
@ -2326,7 +2325,7 @@ float Unit::CalculateLevelPenalty(SpellEntry const* spellProto) const
void Unit::SendAttackStart(Unit* pVictim)
{
WorldPacket data( SMSG_ATTACKSTART, 16 );
WorldPacket data( SMSG_ATTACKSTART, 8 + 8 );
data << uint64(GetGUID());
data << uint64(pVictim->GetGUID());
@ -4234,7 +4233,7 @@ void Unit::RemoveAllGameObjects()
void Unit::SendSpellNonMeleeDamageLog(SpellNonMeleeDamage *log)
{
WorldPacket data(SMSG_SPELLNONMELEEDAMAGELOG, (16+4+4+1+4+4+1+1+4+4+1)); // we guess size
WorldPacket data(SMSG_SPELLNONMELEEDAMAGELOG, (16+4+4+4+1+4+4+1+1+4+4+1)); // we guess size
data.append(log->target->GetPackGUID());
data.append(log->attacker->GetPackGUID());
data << uint32(log->SpellID);
@ -4292,41 +4291,42 @@ void Unit::SendSpellMiss(Unit *target, uint32 spellID, SpellMissInfo missInfo)
void Unit::SendAttackStateUpdate(CalcDamageInfo *damageInfo)
{
uint32 count = 1;
WorldPacket data(SMSG_ATTACKERSTATEUPDATE, (16+45)); // we guess size
data << (uint32)damageInfo->HitInfo;
data.append(GetPackGUID());
data.append(damageInfo->target->GetPackGUID());
data << (uint32)(damageInfo->damage); // Full damage
data << uint32(0); // overkill value
sLog.outDebug("WORLD: Sending SMSG_ATTACKERSTATEUPDATE");
data << (uint8)count; // Sub damage count
uint32 count = 1;
WorldPacket data(SMSG_ATTACKERSTATEUPDATE, 16 + 45); // we guess size
data << uint32(damageInfo->HitInfo);
data.append(damageInfo->attacker->GetPackGUID());
data.append(damageInfo->target->GetPackGUID());
data << uint32(damageInfo->damage); // Full damage
data << uint32(0); // overkill value
data << uint8(count); // Sub damage count
for(int i = 0; i < count; ++i)
{
data << (uint32)(damageInfo->damageSchoolMask); // School of sub damage
data << (float)damageInfo->damage; // sub damage
data << (uint32)damageInfo->damage; // Sub Damage
data << uint32(damageInfo->damageSchoolMask); // School of sub damage
data << float(damageInfo->damage); // sub damage
data << uint32(damageInfo->damage); // Sub Damage
}
if(damageInfo->HitInfo & (HITINFO_ABSORB | HITINFO_ABSORB2))
{
for(int i = 0; i < count; ++i)
data << (uint32)damageInfo->absorb; // Absorb
data << uint32(damageInfo->absorb); // Absorb
}
if(damageInfo->HitInfo & (HITINFO_RESIST | HITINFO_RESIST2))
{
for(int i = 0; i < count; ++i)
data << (uint32)damageInfo->resist; // Resist
data << uint32(damageInfo->resist); // Resist
}
data << (uint8)damageInfo->TargetState;
data << (uint32)0;
data << (uint32)0;
data << uint8(damageInfo->TargetState);
data << uint32(0);
data << uint32(0);
if(damageInfo->HitInfo & HITINFO_BLOCK)
data << (uint32)damageInfo->blocked_amount;
data << uint32(damageInfo->blocked_amount);
if(damageInfo->HitInfo & HITINFO_UNK3)
data << uint32(0);
@ -4355,71 +4355,17 @@ void Unit::SendAttackStateUpdate(CalcDamageInfo *damageInfo)
void Unit::SendAttackStateUpdate(uint32 HitInfo, Unit *target, uint8 SwingType, SpellSchoolMask damageSchoolMask, uint32 Damage, uint32 AbsorbDamage, uint32 Resist, VictimState TargetState, uint32 BlockedAmount)
{
sLog.outDebug("WORLD: Sending SMSG_ATTACKERSTATEUPDATE");
WorldPacket data(SMSG_ATTACKERSTATEUPDATE, (16+45)); // we guess size
data << uint32(HitInfo); // flags
data.append(GetPackGUID());
data.append(target->GetPackGUID());
data << uint32(Damage-AbsorbDamage-Resist-BlockedAmount);// damage
data << uint32(0); // overkill value
data << (uint8)SwingType; // count?
// for(i = 0; i < SwingType; ++i)
data << (uint32)damageSchoolMask;
data << (float)(Damage-AbsorbDamage-Resist-BlockedAmount);
data << (uint32)(Damage-AbsorbDamage-Resist-BlockedAmount);
// end loop
if(HitInfo & (HITINFO_ABSORB | HITINFO_ABSORB2))
{
// for(i = 0; i < SwingType; ++i)
data << uint32(AbsorbDamage);
// end loop
}
if(HitInfo & (HITINFO_RESIST | HITINFO_RESIST2))
{
// for(i = 0; i < SwingType; ++i)
data << uint32(Resist);
// end loop
}
data << (uint8)TargetState;
data << (uint32)0;
data << (uint32)0;
if(HitInfo & HITINFO_BLOCK)
{
data << uint32(BlockedAmount);
}
if(HitInfo & HITINFO_UNK3)
{
data << uint32(0);
}
if(HitInfo & HITINFO_UNK1)
{
data << uint32(0);
data << float(0);
data << float(0);
data << float(0);
data << float(0);
data << float(0);
data << float(0);
data << float(0);
data << float(0);
for(uint8 i = 0; i < 5; ++i)
{
data << float(0);
data << float(0);
}
data << uint32(0);
}
SendMessageToSet( &data, true );
CalcDamageInfo dmgInfo;
dmgInfo.HitInfo = HitInfo;
dmgInfo.attacker = this;
dmgInfo.target = target;
dmgInfo.damage = Damage - AbsorbDamage - Resist - BlockedAmount;
dmgInfo.damageSchoolMask = damageSchoolMask;
dmgInfo.absorb = AbsorbDamage;
dmgInfo.resist = Resist;
dmgInfo.TargetState = TargetState;
dmgInfo.blocked_amount = BlockedAmount;
SendAttackStateUpdate(&dmgInfo);
}
bool Unit::HandleHasteAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAura, SpellEntry const * /*procSpell*/, uint32 /*procFlag*/, uint32 /*procEx*/, uint32 cooldown)
@ -6595,7 +6541,7 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, Aura* triggeredB
if( m_extraAttacks && IsSpellHaveEffect(triggerEntry, SPELL_EFFECT_ADD_EXTRA_ATTACKS) )
return false;
// Costum requirements (not listed in procEx) Warning! damage dealing after this
// Custom requirements (not listed in procEx) Warning! damage dealing after this
// Custom triggered spells
switch (auraSpellInfo->Id)
{
@ -6629,7 +6575,7 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, Aura* triggeredB
// Greater Heal Refund (Avatar Raiment set)
case 37594:
{
// Not give if target alredy have full health
// Not give if target already have full health
if (pVictim->GetHealth() == pVictim->GetMaxHealth())
return false;
// If your Greater Heal brings the target to full health, you gain $37595s1 mana.
@ -6664,7 +6610,7 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, Aura* triggeredB
}
}
// Costum basepoints/target for exist spell
// Custom basepoints/target for exist spell
// dummy basepoints or other customs
switch(trigger_spell_id)
{
@ -6677,7 +6623,7 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, Aura* triggeredB
target = pVictim;
break;
}
// Combo points add triggers (need add combopoint only for main tatget, and after possible combopoints reset)
// Combo points add triggers (need add combopoint only for main target, and after possible combopoints reset)
case 15250: // Rogue Setup
{
if(!pVictim || pVictim != getVictim()) // applied only for main target
@ -9389,7 +9335,7 @@ void Unit::SetSpeed(UnitMoveType mtype, float rate, bool forced)
void Unit::SetHover(bool on)
{
if(on)
CastSpell(this,11010,true);
CastSpell(this, 11010, true);
else
RemoveAurasDueToSpell(11010);
}
@ -10834,7 +10780,7 @@ void Unit::SendPetCastFail(uint32 spellid, SpellCastResult msg)
if(!owner || owner->GetTypeId() != TYPEID_PLAYER)
return;
WorldPacket data(SMSG_PET_CAST_FAILED, (4+1));
WorldPacket data(SMSG_PET_CAST_FAILED, 1 + 4 + 1);
data << uint8(0); // cast count?
data << uint32(spellid);
data << uint8(msg);
@ -10860,7 +10806,7 @@ void Unit::SendPetTalk (uint32 pettalk)
if(!owner || owner->GetTypeId() != TYPEID_PLAYER)
return;
WorldPacket data(SMSG_PET_ACTION_SOUND, 8+4);
WorldPacket data(SMSG_PET_ACTION_SOUND, 8 + 4);
data << uint64(GetGUID());
data << uint32(pettalk);
((Player*)owner)->GetSession()->SendPacket(&data);
@ -10887,7 +10833,7 @@ void Unit::SendPetClearCooldown (uint32 spellid)
if(!owner || owner->GetTypeId() != TYPEID_PLAYER)
return;
WorldPacket data(SMSG_CLEAR_COOLDOWN, (4+8));
WorldPacket data(SMSG_CLEAR_COOLDOWN, 4+8);
data << uint32(spellid);
data << uint64(GetGUID());
((Player*)owner)->GetSession()->SendPacket(&data);
@ -10899,8 +10845,9 @@ void Unit::SendPetAIReaction(uint64 guid)
if(!owner || owner->GetTypeId() != TYPEID_PLAYER)
return;
WorldPacket data(SMSG_AI_REACTION, 12);
data << uint64(guid) << uint32(00000002);
WorldPacket data(SMSG_AI_REACTION, 8 + 4);
data << uint64(guid);
data << uint32(AI_REACTION_AGGRO);
((Player*)owner)->GetSession()->SendPacket(&data);
}