mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 22:37:03 +00:00
Applied coding style.
This commit is contained in:
parent
d6782d067b
commit
c802504304
5 changed files with 477 additions and 506 deletions
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue