From 0bb0e39fc138e4a8c41a7c3d462a0039d0a14f83 Mon Sep 17 00:00:00 2001 From: tomrus88 Date: Wed, 3 Dec 2008 00:27:33 +0300 Subject: [PATCH] Fixed possible crash --- src/game/Player.cpp | 2 +- src/game/Spell.cpp | 28 +++++++++------------------- src/game/SpellAuras.cpp | 4 ++-- 3 files changed, 12 insertions(+), 22 deletions(-) diff --git a/src/game/Player.cpp b/src/game/Player.cpp index e5c818b81..bcbe7f93e 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -17987,7 +17987,7 @@ void Player::SendAurasForTarget(Unit *target) // level data << uint8(aura->GetAuraLevel()); // charges - data << uint8(aura->m_procCharges); + data << uint8(aura->m_procCharges >= 0 ? aura->m_procCharges : 0 ); if(!(auraFlags & AFLAG_NOT_CASTER)) { diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index a0b48bb8a..1727ca15e 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -2659,16 +2659,16 @@ void Spell::SendSpellStart() data.append(m_caster->GetPackGUID()); data << uint8(m_cast_count); // pending spell cast? - data << uint32(m_spellInfo->Id); - data << uint32(castFlags); - data << uint32(m_timer); + data << uint32(m_spellInfo->Id); // spellId + data << uint32(castFlags); // cast flags + data << uint32(m_timer); // delay? m_targets.write(&data); if ( castFlags & CAST_FLAG_UNKNOWN6 ) // predicted power? data << uint32(0); - if ( castFlags & CAST_FLAG_UNKNOWN7 ) // rune cooldowns + if ( castFlags & CAST_FLAG_UNKNOWN7 ) // rune cooldowns list { uint8 v1 = 0;//m_runesState; uint8 v2 = 0;//((Player*)m_caster)->GetRunesState(); @@ -2678,19 +2678,14 @@ void Spell::SendSpellStart() { uint8 m = (1 << i); if(m & v1) // usable before... - { if(!(m & v2)) // ...but on cooldown now... - { data << uint8(0); // some unknown byte (time?) - } - } } } if ( castFlags & CAST_FLAG_AMMO ) WriteAmmoToPacket(&data); - data.hexlike(); m_caster->SendMessageToSet(&data, true); } @@ -2708,11 +2703,11 @@ void Spell::SendSpellGo() if(IsRangedSpell()) castFlags |= CAST_FLAG_AMMO; // arrows/bullets visual - if(m_spellInfo->runeCostID) + if((m_caster->GetTypeId() == TYPEID_PLAYER) && (m_caster->getClass() == CLASS_DEATH_KNIGHT) && m_spellInfo->runeCostID) { castFlags |= CAST_FLAG_UNKNOWN10; // same as in SMSG_SPELL_START castFlags |= CAST_FLAG_UNKNOWN6; // makes cooldowns visible - castFlags |= CAST_FLAG_UNKNOWN7; // rune cooldowns + castFlags |= CAST_FLAG_UNKNOWN7; // rune cooldowns list } WorldPacket data(SMSG_SPELL_GO, 50); // guess size @@ -2723,8 +2718,8 @@ void Spell::SendSpellGo() data.append(m_caster->GetPackGUID()); data << uint8(m_cast_count); // pending spell cast? - data << uint32(m_spellInfo->Id); - data << uint32(castFlags); + data << uint32(m_spellInfo->Id); // spellId + data << uint32(castFlags); // cast flags data << uint32(getMSTime()); // timestamp WriteSpellGoTargets(&data); @@ -2734,7 +2729,7 @@ void Spell::SendSpellGo() if ( castFlags & CAST_FLAG_UNKNOWN6 ) // unknown wotlk, predicted power? data << uint32(0); - if ( castFlags & CAST_FLAG_UNKNOWN7 ) // rune cooldowns? + if ( castFlags & CAST_FLAG_UNKNOWN7 ) // rune cooldowns list { uint8 v1 = m_runesState; uint8 v2 = ((Player*)m_caster)->GetRunesState(); @@ -2744,12 +2739,8 @@ void Spell::SendSpellGo() { uint8 m = (1 << i); if(m & v1) // usable before... - { if(!(m & v2)) // ...but on cooldown now... - { data << uint8(0); // some unknown byte (time?) - } - } } } @@ -2773,7 +2764,6 @@ void Spell::SendSpellGo() data << uint8(0); } - data.hexlike(); m_caster->SendMessageToSet(&data, true); } diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index adc1690c0..f427fb422 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -423,7 +423,7 @@ m_periodicTimer(0), m_PeriodicEventId(0), m_AuraDRGroup(DIMINISHING_NONE) modOwner->ApplySpellMod(GetId(), SPELLMOD_CHARGES, m_procCharges); } else - m_procCharges = 0; + m_procCharges = -1; m_isRemovedOnShapeLost = (m_caster_guid==m_target->GetGUID() && m_spellProto->Stances && !(m_spellProto->AttributesEx2 & 0x80000) && !(m_spellProto->Attributes & 0x10000)); @@ -1124,7 +1124,7 @@ void Aura::SendAuraUpdate(bool remove) uint8 auraFlags = GetAuraFlags(); data << uint8(auraFlags); data << uint8(GetAuraLevel()); - data << uint8(GetAuraCharges()); + data << uint8(m_procCharges >= 0 ? m_procCharges : 0); if(!(auraFlags & AFLAG_NOT_CASTER)) { -- 2.11.4.GIT