Skip to content
Permalink
Browse files

Server/PacketIO: Update SMSG_SPELL_PERIODIC_AURA_LOG.

Signed-off-by: AriDEV <aridev666@gmail.com>
  • Loading branch information...
AriDEV committed Jul 7, 2019
1 parent fb2d96f commit c40592e474c955aa038b121b2b6d04eaa5c53b92
@@ -1627,7 +1627,6 @@ bool AchievementMgr<T>::IsCompletedAchievement(AchievementEntry const* entry)
return false;

// for achievement with referenced achievement criterias get from referenced and counter from self
uint32 achievementForTestId = entry->refAchievement ? entry->refAchievement : entry->ID;
uint32 achievementForTestCount = entry->count;

if (CriteriaTreeEntry const* criteriaTree = sCriteriaTreeStore.LookupEntry(entry->criteriaTreeID))
@@ -179,8 +179,6 @@ void BlackMarketMgr::LoadBlackMarketAuctions()

void BlackMarketMgr::Update()
{
uint32 curTime = time(NULL);

SQLTransaction trans = CharacterDatabase.BeginTransaction();

// Delete expired auctions
@@ -4901,130 +4901,73 @@ void Unit::ProcDamageAndSpell(Unit* victim, uint32 procAttacker, uint32 procVict

void Unit::SendPeriodicAuraLog(SpellPeriodicAuraLogInfo* pInfo)
{
std::vector<SpellPeriodicAuraLogInfo> Entries;
AuraEffect const* aura = pInfo->auraEff;
ObjectGuid casterGuid = aura->GetCasterGUID();
ObjectGuid targetGuid = GetGUID();
ObjectGuid CasterGUID = aura->GetCasterGUID();
ObjectGuid TargetGUID = GetGUID();

WorldPacket data(SMSG_SPELL_PERIODIC_AURA_LOG, 30);

data.WriteBit(targetGuid [7]);
data.WriteBit(casterGuid [0]);
data.WriteBit(casterGuid [7]);
data.WriteBit(targetGuid [1]);
data.WriteBits(1, 21); // Count

// Count loop here
data.WriteBit(pInfo->critical);
size_t pos = data.bitwpos();

data.WriteBit(targetGuid [0]);
data.WriteGuidMask(TargetGUID, 7);
data.WriteGuidMask(CasterGUID, 0, 7);
data.WriteGuidMask(TargetGUID, 1);
data.WriteBits(Entries.size(), 21); // SpellPeriodicAuraLogInfo
data.WriteGuidMask(TargetGUID, 0);

// All sent for now, will mess with it l8 ^^
switch (aura->GetAuraType())
for (SpellPeriodicAuraLogInfo const& entry : Entries)
{

case SPELL_AURA_PERIODIC_DAMAGE:
case SPELL_AURA_PERIODIC_DAMAGE_PERCENT:
data.WriteBit(0); // Int 2 -- OverKill
data.WriteBit(0); // Int 4 -- Absorb
data.WriteBit(0); // Int 3 -- SchoolMask
data.WriteBit(0); // Int 5 -- Resist
break;
case SPELL_AURA_PERIODIC_HEAL:
case SPELL_AURA_OBS_MOD_HEALTH:
data.WriteBit(0); // Int 2 -- OverHeal
data.WriteBit(0); // Int 4 -- Absorb
data.WriteBit(0); // Int 3 -- SchoolMask
data.WriteBit(1); // Int 5
break;
case SPELL_AURA_OBS_MOD_POWER:
case SPELL_AURA_PERIODIC_ENERGIZE:
data.WriteBit(1); // Int 2
data.WriteBit(1); // Int 4
data.WriteBit(0); // Int 3
data.WriteBit(1); // Int 5
case SPELL_AURA_PERIODIC_MANA_LEECH:
data.WriteBit(1); // Int 2
data.WriteBit(1); // Int 4
data.WriteBit(0); // Int 3
data.WriteBit(1); // Int 5
break;
default:
data.WriteBit(1); // Int 2
data.WriteBit(1); // Int 4
data.WriteBit(1); // Int 3
data.WriteBit(1); // Int 5
break;
data.WriteBit(!entry.overDamage);
data.WriteBit(!entry.absorb);
data.WriteBit(entry.critical);
data.WriteBit(!entry.resist);
data.WriteBit(!entry.power);
}

data.WriteBit(targetGuid [5]);
data.WriteBit(targetGuid [3]);
data.WriteBit(casterGuid [1]);
data.WriteBit(targetGuid [2]);
data.WriteBit(casterGuid [6]);
data.WriteBit(casterGuid [3]);
data.WriteBit(casterGuid [4]);
data.WriteBit(0); // Power data
data.WriteBit(casterGuid [2]);
data.WriteBit(targetGuid [6]);
data.WriteBit(casterGuid [5]);
data.WriteBit(casterGuid [4]);
data.WriteGuidMask(TargetGUID, 5, 3);
data.WriteGuidMask(CasterGUID, 1);
data.WriteGuidMask(TargetGUID, 2);
data.WriteGuidMask(CasterGUID, 6, 3, 4);
data.WriteBit(0); // PeriodicAuraLogEffectDebugInfo
data.WriteGuidMask(CasterGUID, 2);
data.WriteGuidMask(TargetGUID, 6);
data.WriteGuidMask(CasterGUID, 5);
data.WriteGuidMask(TargetGUID, 4);
data.FlushBits();

// Switch Loop
data << uint32(aura->GetAuraType()); // auraId
switch (aura->GetAuraType())
for (SpellPeriodicAuraLogInfo const& entry : Entries)
{

case SPELL_AURA_PERIODIC_DAMAGE:
case SPELL_AURA_PERIODIC_DAMAGE_PERCENT:
if (entry.overDamage)
data << uint32(pInfo->overDamage); // overkill
data << uint32(pInfo->absorb); // absorb
data << uint32(pInfo->damage); // damage

data << uint32(pInfo->damage); // amount
data << uint32(aura->GetAuraType());

if (entry.resist)
data << uint32(pInfo->resist); // resist
data << uint32(aura->GetSpellInfo()->GetSchoolMask());
break;
case SPELL_AURA_PERIODIC_HEAL:
case SPELL_AURA_OBS_MOD_HEALTH:
data << uint32(pInfo->overDamage); // overheal

if (entry.absorb);
data << uint32(pInfo->absorb); // absorb
data << uint32(pInfo->damage); // damage
data << uint32(aura->GetSpellInfo()->GetSchoolMask());
break;
case SPELL_AURA_OBS_MOD_POWER:
case SPELL_AURA_PERIODIC_ENERGIZE:
data << uint32(pInfo->damage); // damage
data << uint32(aura->GetMiscValue()); // power type
break;
case SPELL_AURA_PERIODIC_MANA_LEECH:
data << uint32(pInfo->damage); // amount
data << uint32(aura->GetMiscValue()); // power type
//data << float(pInfo->multiplier); // gain multiplier
break;
default:
SF_LOG_ERROR("entities.unit", "Unit::SendPeriodicAuraLog: unknown aura %u", uint32(aura->GetAuraType()));
data << uint32(0); // Mask
break;

if (entry.power)
data << uint32(pInfo->power); // power
}

data.WriteByteSeq(casterGuid [5]);
data.WriteByteSeq(casterGuid [3]);
data.WriteByteSeq(targetGuid [4]);
data << uint32(aura->GetId()); // spellId
data.WriteByteSeq(targetGuid [6]);
data.WriteByteSeq(casterGuid [7]);
data.WriteByteSeq(casterGuid [1]);
data.WriteByteSeq(targetGuid [5]);
data.WriteByteSeq(casterGuid [0]);
data.WriteByteSeq(targetGuid [1]);
data.WriteByteSeq(targetGuid [7]);
data.WriteByteSeq(casterGuid [4]);
data.WriteByteSeq(targetGuid [3]);
data.WriteByteSeq(casterGuid [2]);
data.WriteByteSeq(targetGuid [0]);
data.WriteByteSeq(targetGuid [2]);
data.WriteByteSeq(casterGuid [6]);
data.WriteGuidBytes(CasterGUID, 5, 3);
data.WriteGuidBytes(TargetGUID, 4);
data << int32(aura->GetId()); // auraId
data.WriteGuidBytes(TargetGUID, 6);
data.WriteGuidBytes(CasterGUID, 7, 1);

// for (PeriodicAuraLogEffectDebugInfo : DebugInfo)

data.WriteGuidBytes(TargetGUID, 5);
data.WriteGuidBytes(CasterGUID, 0);
data.WriteGuidBytes(TargetGUID, 1, 7);
data.WriteGuidBytes(CasterGUID, 4);
data.WriteGuidBytes(TargetGUID, 3);
data.WriteGuidBytes(CasterGUID, 2);
data.WriteGuidBytes(TargetGUID, 0, 2);
data.WriteGuidBytes(CasterGUID, 6);
SendMessageToSet(&data, true);
}

@@ -1076,15 +1076,16 @@ struct SpellNonMeleeDamage

struct SpellPeriodicAuraLogInfo
{
SpellPeriodicAuraLogInfo(AuraEffect const* _auraEff, uint32 _damage, uint32 _overDamage, uint32 _absorb, uint32 _resist, float _multiplier, bool _critical)
: auraEff(_auraEff), damage(_damage), overDamage(_overDamage), absorb(_absorb), resist(_resist), multiplier(_multiplier), critical(_critical)
SpellPeriodicAuraLogInfo(AuraEffect const* _auraEff, uint32 _damage, uint32 _overDamage, uint32 _absorb, uint32 _resist, uint32 _power, float _multiplier, bool _critical)
: auraEff(_auraEff), damage(_damage), overDamage(_overDamage), absorb(_absorb), resist(_resist), power(_power), multiplier(_multiplier), critical(_critical)
{ }

AuraEffect const* auraEff;
uint32 damage;
uint32 overDamage; // overkill/overheal
uint32 absorb;
uint32 resist;
uint32 power;
float multiplier;
bool critical;
};
@@ -5969,7 +5969,7 @@ void AuraEffect::HandlePeriodicDamageAurasTick(Unit* target, Unit* caster) const
if (overkill < 0)
overkill = 0;

SpellPeriodicAuraLogInfo pInfo(this, damage, overkill, absorb, resist, 0.0f, crit);
SpellPeriodicAuraLogInfo pInfo(this, damage, overkill, absorb, resist, GetSpellInfo()->GetSchoolMask(), 0.0f, crit);
target->SendPeriodicAuraLog(&pInfo);

caster->ProcDamageAndSpell(target, procAttacker, procVictim, procEx, damage, BASE_ATTACK, GetSpellInfo());
@@ -6153,7 +6153,7 @@ void AuraEffect::HandlePeriodicHealAurasTick(Unit* target, Unit* caster) const
caster->CalcHealAbsorb(target, GetSpellInfo(), heal, absorb);
int32 gain = caster->DealHeal(target, heal);

SpellPeriodicAuraLogInfo pInfo(this, heal, heal - gain, absorb, 0, 0.0f, crit);
SpellPeriodicAuraLogInfo pInfo(this, heal, heal - gain, absorb, 0, GetSpellInfo()->GetSchoolMask(), 0.0f, crit);
target->SendPeriodicAuraLog(&pInfo);

target->getHostileRefManager().threatAssist(caster, float(gain) * 0.5f, GetSpellInfo());
@@ -6221,7 +6221,7 @@ void AuraEffect::HandlePeriodicManaLeechAuraTick(Unit* target, Unit* caster) con

float gainMultiplier = GetSpellInfo()->Effects[GetEffIndex()].CalcValueMultiplier(caster);

SpellPeriodicAuraLogInfo pInfo(this, drainedAmount, 0, 0, 0, gainMultiplier, false);
SpellPeriodicAuraLogInfo pInfo(this, drainedAmount, 0, 0, 0, GetMiscValue(), gainMultiplier, false);
target->SendPeriodicAuraLog(&pInfo);

int32 gainAmount = int32(drainedAmount * gainMultiplier);
@@ -6274,7 +6274,7 @@ void AuraEffect::HandleObsModPowerAuraTick(Unit* target, Unit* caster) const
SF_LOG_INFO("spells", "PeriodicTick: %u (TypeId: %u) energize %u (TypeId: %u) for %u dmg inflicted by %u",
GUID_LOPART(GetCasterGUID()), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), target->GetGUIDLow(), target->GetTypeId(), amount, GetId());

SpellPeriodicAuraLogInfo pInfo(this, amount, 0, 0, 0, 0.0f, false);
SpellPeriodicAuraLogInfo pInfo(this, amount, 0, 0, 0, GetMiscValue(), 0.0f, false);
target->SendPeriodicAuraLog(&pInfo);

int32 gain = target->ModifyPower(powerType, amount);
@@ -6303,7 +6303,7 @@ void AuraEffect::HandlePeriodicEnergizeAuraTick(Unit* target, Unit* caster) cons
// ignore negative values (can be result apply spellmods to aura damage
int32 amount = std::max(m_amount, 0);

SpellPeriodicAuraLogInfo pInfo(this, amount, 0, 0, 0, 0.0f, false);
SpellPeriodicAuraLogInfo pInfo(this, amount, 0, 0, 0, GetMiscValue(), 0.0f, false);
target->SendPeriodicAuraLog(&pInfo);

SF_LOG_INFO("spells", "PeriodicTick: %u (TypeId: %u) energize %u (TypeId: %u) for %u dmg inflicted by %u",

0 comments on commit c40592e

Please sign in to comment.
You can’t perform that action at this time.