mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 22:37:03 +00:00
Moved SMSG_PERIODICAURALOG to single function, applied coding stype.
This commit is contained in:
parent
b77696bf26
commit
b0006cfbc0
3 changed files with 100 additions and 80 deletions
|
|
@ -5774,18 +5774,8 @@ void Aura::PeriodicTick()
|
|||
|
||||
pCaster->DealDamageMods(m_target, pdamage, &absorb);
|
||||
|
||||
WorldPacket data(SMSG_PERIODICAURALOG, (21+16));// we guess size
|
||||
data.append(m_target->GetPackGUID());
|
||||
data.appendPackGUID(GetCasterGUID());
|
||||
data << uint32(GetId());
|
||||
data << uint32(1);
|
||||
data << uint32(m_modifier.m_auraname);
|
||||
data << (uint32)pdamage;
|
||||
data << uint32(0); // overkill
|
||||
data << (uint32)GetSpellSchoolMask(GetSpellProto()); // will be mask in 2.4.x
|
||||
data << (uint32)absorb;
|
||||
data << (uint32)resist;
|
||||
m_target->SendMessageToSet(&data, true);
|
||||
SpellPeriodicAuraLogInfo pInfo(this, pdamage, 0, absorb, resist, 0.0f);
|
||||
m_target->SendPeriodicAuraLog(&pInfo);
|
||||
|
||||
Unit* target = m_target; // aura can be deleted in DealDamage
|
||||
SpellEntry const* spellProto = GetSpellProto();
|
||||
|
|
@ -5850,7 +5840,6 @@ void Aura::PeriodicTick()
|
|||
|
||||
pCaster->SendSpellNonMeleeDamageLog(m_target, GetId(), pdamage, GetSpellSchoolMask(GetSpellProto()), absorb, resist, false, 0);
|
||||
|
||||
|
||||
Unit* target = m_target; // aura can be deleted in DealDamage
|
||||
SpellEntry const* spellProto = GetSpellProto();
|
||||
float multiplier = spellProto->EffectMultipleValue[GetEffIndex()] > 0 ? spellProto->EffectMultipleValue[GetEffIndex()] : 1;
|
||||
|
|
@ -5867,7 +5856,7 @@ void Aura::PeriodicTick()
|
|||
|
||||
if (!target->isAlive() && pCaster->IsNonMeleeSpellCasted(false))
|
||||
{
|
||||
for (uint32 i = CURRENT_FIRST_NON_MELEE_SPELL; i < CURRENT_MAX_SPELL; i++)
|
||||
for (uint32 i = CURRENT_FIRST_NON_MELEE_SPELL; i < CURRENT_MAX_SPELL; ++i)
|
||||
{
|
||||
if (pCaster->m_currentSpells[i] && pCaster->m_currentSpells[i]->m_spellInfo->Id == spellProto->Id)
|
||||
pCaster->m_currentSpells[i]->cancel();
|
||||
|
|
@ -5910,15 +5899,8 @@ void Aura::PeriodicTick()
|
|||
sLog.outDetail("PeriodicTick: %u (TypeId: %u) heal of %u (TypeId: %u) for %u health inflicted by %u",
|
||||
GUID_LOPART(GetCasterGUID()), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), m_target->GetGUIDLow(), m_target->GetTypeId(), pdamage, GetId());
|
||||
|
||||
WorldPacket data(SMSG_PERIODICAURALOG, (21+16));// we guess size
|
||||
data.append(m_target->GetPackGUID());
|
||||
data.appendPackGUID(GetCasterGUID());
|
||||
data << uint32(GetId());
|
||||
data << uint32(1);
|
||||
data << uint32(m_modifier.m_auraname);
|
||||
data << (uint32)pdamage;
|
||||
data << uint32(0); // wotlk
|
||||
m_target->SendMessageToSet(&data, true);
|
||||
SpellPeriodicAuraLogInfo pInfo(this, pdamage, 0, 0, 0, 0.0f);
|
||||
m_target->SendPeriodicAuraLog(&pInfo);
|
||||
|
||||
int32 gain = m_target->ModifyHealth(pdamage);
|
||||
|
||||
|
|
@ -6030,16 +6012,8 @@ void Aura::PeriodicTick()
|
|||
modOwner->ApplySpellMod(GetId(), SPELLMOD_MULTIPLE_VALUE, gain_multiplier);
|
||||
}
|
||||
|
||||
WorldPacket data(SMSG_PERIODICAURALOG, (21+16));// we guess size
|
||||
data.append(m_target->GetPackGUID());
|
||||
data.appendPackGUID(GetCasterGUID());
|
||||
data << uint32(GetId());
|
||||
data << uint32(1);
|
||||
data << uint32(m_modifier.m_auraname);
|
||||
data << (uint32)power; // power type
|
||||
data << (uint32)drain_amount;
|
||||
data << (float)gain_multiplier;
|
||||
m_target->SendMessageToSet(&data, true);
|
||||
SpellPeriodicAuraLogInfo pInfo(this, drain_amount, 0, 0, 0, gain_multiplier);
|
||||
m_target->SendPeriodicAuraLog(&pInfo);
|
||||
|
||||
int32 gain_amount = int32(drain_amount * gain_multiplier);
|
||||
|
||||
|
|
@ -6066,15 +6040,8 @@ void Aura::PeriodicTick()
|
|||
if(m_target->GetMaxPower(power) == 0)
|
||||
break;
|
||||
|
||||
WorldPacket data(SMSG_PERIODICAURALOG, (21+16));// we guess size
|
||||
data.append(m_target->GetPackGUID());
|
||||
data.appendPackGUID(GetCasterGUID());
|
||||
data << uint32(GetId());
|
||||
data << uint32(1);
|
||||
data << uint32(m_modifier.m_auraname);
|
||||
data << (uint32)power; // power type
|
||||
data << (uint32)pdamage;
|
||||
m_target->SendMessageToSet(&data, true);
|
||||
SpellPeriodicAuraLogInfo pInfo(this, pdamage, 0, 0, 0, 0.0f);
|
||||
m_target->SendPeriodicAuraLog(&pInfo);
|
||||
|
||||
int32 gain = m_target->ModifyPower(power,pdamage);
|
||||
|
||||
|
|
@ -6095,15 +6062,8 @@ void Aura::PeriodicTick()
|
|||
if(m_target->GetMaxPower(POWER_MANA) == 0)
|
||||
break;
|
||||
|
||||
WorldPacket data(SMSG_PERIODICAURALOG, (21+16));// we guess size
|
||||
data.append(m_target->GetPackGUID());
|
||||
data.appendPackGUID(GetCasterGUID());
|
||||
data << uint32(GetId());
|
||||
data << uint32(1);
|
||||
data << uint32(m_modifier.m_auraname);
|
||||
data << (uint32)0; // ?
|
||||
data << (uint32)pdamage;
|
||||
m_target->SendMessageToSet(&data,true);
|
||||
SpellPeriodicAuraLogInfo pInfo(this, pdamage, 0, 0, 0, 0.0f);
|
||||
m_target->SendPeriodicAuraLog(&pInfo);
|
||||
|
||||
int32 gain = m_target->ModifyPower(POWER_MANA, pdamage);
|
||||
|
||||
|
|
|
|||
|
|
@ -4264,6 +4264,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.
|
||||
|
|
|
|||
|
|
@ -685,7 +685,7 @@ struct CalcDamageInfo
|
|||
uint32 procAttacker;
|
||||
uint32 procVictim;
|
||||
uint32 procEx;
|
||||
uint32 cleanDamage; // Used only fo rage calcultion
|
||||
uint32 cleanDamage; // Used only for rage calculation
|
||||
MeleeHitOutcome hitOutCome; // TODO: remove this field (need use TargetState)
|
||||
};
|
||||
|
||||
|
|
@ -712,6 +712,19 @@ struct SpellNonMeleeDamage{
|
|||
uint32 cleanDamage;
|
||||
};
|
||||
|
||||
struct SpellPeriodicAuraLogInfo
|
||||
{
|
||||
SpellPeriodicAuraLogInfo(Aura *_aura, uint32 _damage, uint32 _overDamage, uint32 _absorb, uint32 _resist, float _multiplier)
|
||||
: aura(_aura), damage(_damage), overDamage(_overDamage), absorb(_absorb), resist(_resist), multiplier(_multiplier) {}
|
||||
|
||||
Aura *aura;
|
||||
uint32 damage;
|
||||
uint32 absorb;
|
||||
uint32 resist;
|
||||
uint32 overDamage; // overkill/overheal
|
||||
float multiplier;
|
||||
};
|
||||
|
||||
uint32 createProcExtendMask(SpellNonMeleeDamage *damageInfo, SpellMissInfo missCondition);
|
||||
|
||||
#define MAX_DECLINED_NAME_CASES 5
|
||||
|
|
@ -1107,6 +1120,7 @@ class MANGOS_DLL_SPEC Unit : public WorldObject
|
|||
void SendAttackStateUpdate(uint32 HitInfo, Unit *target, uint8 SwingType, SpellSchoolMask damageSchoolMask, uint32 Damage, uint32 AbsorbDamage, uint32 Resist, VictimState TargetState, uint32 BlockedAmount);
|
||||
void SendSpellNonMeleeDamageLog(SpellNonMeleeDamage *log);
|
||||
void SendSpellNonMeleeDamageLog(Unit *target,uint32 SpellID, uint32 Damage, SpellSchoolMask damageSchoolMask, uint32 AbsorbedDamage, uint32 Resist, bool PhysicalDamage, uint32 Blocked, bool CriticalHit = false);
|
||||
void SendPeriodicAuraLog(SpellPeriodicAuraLogInfo *pInfo);
|
||||
void SendSpellMiss(Unit *target, uint32 spellID, SpellMissInfo missInfo);
|
||||
|
||||
void NearTeleportTo(float x, float y, float z, float orientation, bool casting = false);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue