[7911] Applied coding style.

This commit is contained in:
tomrus88 2009-05-29 19:06:04 +04:00
parent ec1d6a3b56
commit 42f8ce5f3e
58 changed files with 1452 additions and 1459 deletions

View file

@ -285,6 +285,7 @@ void Unit::SendMonsterMove(float NewPosX, float NewPosY, float NewPosZ, uint8 ty
}
data << uint32(MovementFlags);
data << uint32(Time); // Time in between points
data << uint32(1); // 1 single waypoint
data << NewPosX << NewPosY << NewPosZ; // the single waypoint Point B
@ -299,14 +300,14 @@ 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()+4+4+4+4+1+4+4+4+pathSize*4*3) );
data.append(GetPackGUID());
data << GetPositionX();
data << GetPositionY();
data << GetPositionZ();
data << getMSTime();
data << uint32(getMSTime());
data << uint8( 0 );
data << uint32( MovementFlags );
data << uint32( traveltime );
@ -544,7 +545,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();
@ -1147,7 +1147,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;
}
@ -1422,11 +1422,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)
@ -1551,7 +1551,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);
@ -2319,7 +2319,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());
@ -4227,7 +4227,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);
@ -4244,10 +4244,10 @@ void Unit::SendSpellNonMeleeDamageLog(SpellNonMeleeDamage *log)
SendMessageToSet( &data, true );
}
void Unit::SendSpellNonMeleeDamageLog(Unit *target,uint32 SpellID,uint32 Damage, SpellSchoolMask damageSchoolMask,uint32 AbsorbedDamage, uint32 Resist,bool PhysicalDamage, uint32 Blocked, bool CriticalHit)
void Unit::SendSpellNonMeleeDamageLog(Unit *target, uint32 SpellID, uint32 Damage, SpellSchoolMask damageSchoolMask, uint32 AbsorbedDamage, uint32 Resist, bool PhysicalDamage, uint32 Blocked, bool CriticalHit)
{
SpellNonMeleeDamage log(this,target,SpellID,damageSchoolMask);
log.damage = Damage-AbsorbedDamage-Resist-Blocked;
SpellNonMeleeDamage log(this, target, SpellID, damageSchoolMask);
log.damage = Damage - AbsorbedDamage - Resist - Blocked;
log.absorb = AbsorbedDamage;
log.resist = Resist;
log.physicalLog = PhysicalDamage;
@ -4258,6 +4258,52 @@ void Unit::SendSpellNonMeleeDamageLog(Unit *target,uint32 SpellID,uint32 Damage,
SendSpellNonMeleeDamageLog(&log);
}
void Unit::SendPeriodicAuraLog(SpellPeriodicAuraLogInfo *pInfo)
{
Aura *aura = pInfo->aura;
Modifier *mod = aura->GetModifier();
WorldPacket data(SMSG_PERIODICAURALOG, 30);
data.append(aura->GetTarget()->GetPackGUID());
data.appendPackGUID(aura->GetCasterGUID());
data << uint32(aura->GetId()); // spellId
data << uint32(1); // count
data << uint32(mod->m_auraname); // auraId
switch(mod->m_auraname)
{
case SPELL_AURA_PERIODIC_DAMAGE:
case SPELL_AURA_PERIODIC_DAMAGE_PERCENT:
data << uint32(pInfo->damage); // damage
data << uint32(pInfo->overDamage); // overkill?
data << uint32(GetSpellSchoolMask(aura->GetSpellProto()));
data << uint32(pInfo->absorb); // absorb
data << uint32(pInfo->resist); // resist
data << uint8(0); // new 3.1.2
break;
case SPELL_AURA_PERIODIC_HEAL:
case SPELL_AURA_OBS_MOD_HEALTH:
data << uint32(pInfo->damage); // damage
data << uint32(pInfo->overDamage); // overheal?
data << uint8(0); // new 3.1.2
break;
case SPELL_AURA_OBS_MOD_MANA:
case SPELL_AURA_PERIODIC_ENERGIZE:
data << uint32(mod->m_miscvalue); // power type
data << uint32(pInfo->damage); // damage
break;
case SPELL_AURA_PERIODIC_MANA_LEECH:
data << uint32(mod->m_miscvalue); // power type
data << uint32(pInfo->damage); // amount
data << float(pInfo->multiplier); // gain multiplier
break;
default:
sLog.outError("Unit::SendPeriodicAuraLog: unknown aura %u", uint32(mod->m_auraname));
return;
}
aura->GetTarget()->SendMessageToSet(&data, true);
}
void Unit::ProcDamageAndSpell(Unit *pVictim, uint32 procAttacker, uint32 procVictim, uint32 procExtra, uint32 amount, WeaponAttackType attType, SpellEntry const *procSpell)
{
// Not much to do if no flags are set.
@ -4285,41 +4331,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);
@ -4348,71 +4395,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)
@ -6605,7 +6598,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)
{
@ -6639,7 +6632,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.
@ -6674,7 +6667,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)
{
@ -6687,7 +6680,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
@ -9402,7 +9395,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);
}
@ -10421,7 +10414,7 @@ bool CharmInfo::AddSpellToActionBar(uint32 spell_id, ActiveStates newstate)
}
}
// or use empty slot in other case
// or use empty slot in other case
for(uint8 i = 0; i < MAX_UNIT_ACTION_BAR_INDEX; ++i)
{
if (!PetActionBar[i].SpellOrAction && PetActionBar[i].IsActionBarForSpell())
@ -10899,7 +10892,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);
@ -10925,7 +10918,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);
@ -10952,7 +10945,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);
@ -10964,8 +10957,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);
}
@ -10982,7 +10976,7 @@ void Unit::StopMoving()
// Relocate(GetPositionX(), GetPositionY(), z);
Relocate(GetPositionX(), GetPositionY(),GetPositionZ());
SendMonsterMove(GetPositionX(), GetPositionY(), GetPositionZ(), 0, true, 0);
SendMonsterMove(GetPositionX(), GetPositionY(), GetPositionZ(), 0, 0, 0);
// update position and orientation;
WorldPacket data;