Fixed possible crash

This commit is contained in:
tomrus88 2008-12-03 00:27:33 +03:00
parent fa13127cf8
commit a2503162fc
3 changed files with 12 additions and 22 deletions

View file

@ -17987,7 +17987,7 @@ void Player::SendAurasForTarget(Unit *target)
// level // level
data << uint8(aura->GetAuraLevel()); data << uint8(aura->GetAuraLevel());
// charges // charges
data << uint8(aura->m_procCharges); data << uint8(aura->m_procCharges >= 0 ? aura->m_procCharges : 0 );
if(!(auraFlags & AFLAG_NOT_CASTER)) if(!(auraFlags & AFLAG_NOT_CASTER))
{ {

View file

@ -2659,16 +2659,16 @@ void Spell::SendSpellStart()
data.append(m_caster->GetPackGUID()); data.append(m_caster->GetPackGUID());
data << uint8(m_cast_count); // pending spell cast? data << uint8(m_cast_count); // pending spell cast?
data << uint32(m_spellInfo->Id); data << uint32(m_spellInfo->Id); // spellId
data << uint32(castFlags); data << uint32(castFlags); // cast flags
data << uint32(m_timer); data << uint32(m_timer); // delay?
m_targets.write(&data); m_targets.write(&data);
if ( castFlags & CAST_FLAG_UNKNOWN6 ) // predicted power? if ( castFlags & CAST_FLAG_UNKNOWN6 ) // predicted power?
data << uint32(0); data << uint32(0);
if ( castFlags & CAST_FLAG_UNKNOWN7 ) // rune cooldowns if ( castFlags & CAST_FLAG_UNKNOWN7 ) // rune cooldowns list
{ {
uint8 v1 = 0;//m_runesState; uint8 v1 = 0;//m_runesState;
uint8 v2 = 0;//((Player*)m_caster)->GetRunesState(); uint8 v2 = 0;//((Player*)m_caster)->GetRunesState();
@ -2678,19 +2678,14 @@ void Spell::SendSpellStart()
{ {
uint8 m = (1 << i); uint8 m = (1 << i);
if(m & v1) // usable before... if(m & v1) // usable before...
{
if(!(m & v2)) // ...but on cooldown now... if(!(m & v2)) // ...but on cooldown now...
{
data << uint8(0); // some unknown byte (time?) data << uint8(0); // some unknown byte (time?)
} }
} }
}
}
if ( castFlags & CAST_FLAG_AMMO ) if ( castFlags & CAST_FLAG_AMMO )
WriteAmmoToPacket(&data); WriteAmmoToPacket(&data);
data.hexlike();
m_caster->SendMessageToSet(&data, true); m_caster->SendMessageToSet(&data, true);
} }
@ -2708,11 +2703,11 @@ void Spell::SendSpellGo()
if(IsRangedSpell()) if(IsRangedSpell())
castFlags |= CAST_FLAG_AMMO; // arrows/bullets visual 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_UNKNOWN10; // same as in SMSG_SPELL_START
castFlags |= CAST_FLAG_UNKNOWN6; // makes cooldowns visible 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 WorldPacket data(SMSG_SPELL_GO, 50); // guess size
@ -2723,8 +2718,8 @@ void Spell::SendSpellGo()
data.append(m_caster->GetPackGUID()); data.append(m_caster->GetPackGUID());
data << uint8(m_cast_count); // pending spell cast? data << uint8(m_cast_count); // pending spell cast?
data << uint32(m_spellInfo->Id); data << uint32(m_spellInfo->Id); // spellId
data << uint32(castFlags); data << uint32(castFlags); // cast flags
data << uint32(getMSTime()); // timestamp data << uint32(getMSTime()); // timestamp
WriteSpellGoTargets(&data); WriteSpellGoTargets(&data);
@ -2734,7 +2729,7 @@ void Spell::SendSpellGo()
if ( castFlags & CAST_FLAG_UNKNOWN6 ) // unknown wotlk, predicted power? if ( castFlags & CAST_FLAG_UNKNOWN6 ) // unknown wotlk, predicted power?
data << uint32(0); data << uint32(0);
if ( castFlags & CAST_FLAG_UNKNOWN7 ) // rune cooldowns? if ( castFlags & CAST_FLAG_UNKNOWN7 ) // rune cooldowns list
{ {
uint8 v1 = m_runesState; uint8 v1 = m_runesState;
uint8 v2 = ((Player*)m_caster)->GetRunesState(); uint8 v2 = ((Player*)m_caster)->GetRunesState();
@ -2744,14 +2739,10 @@ void Spell::SendSpellGo()
{ {
uint8 m = (1 << i); uint8 m = (1 << i);
if(m & v1) // usable before... if(m & v1) // usable before...
{
if(!(m & v2)) // ...but on cooldown now... if(!(m & v2)) // ...but on cooldown now...
{
data << uint8(0); // some unknown byte (time?) data << uint8(0); // some unknown byte (time?)
} }
} }
}
}
if ( castFlags & CAST_FLAG_UNKNOWN4 ) // unknown wotlk if ( castFlags & CAST_FLAG_UNKNOWN4 ) // unknown wotlk
{ {
@ -2773,7 +2764,6 @@ void Spell::SendSpellGo()
data << uint8(0); data << uint8(0);
} }
data.hexlike();
m_caster->SendMessageToSet(&data, true); m_caster->SendMessageToSet(&data, true);
} }

View file

@ -423,7 +423,7 @@ m_periodicTimer(0), m_PeriodicEventId(0), m_AuraDRGroup(DIMINISHING_NONE)
modOwner->ApplySpellMod(GetId(), SPELLMOD_CHARGES, m_procCharges); modOwner->ApplySpellMod(GetId(), SPELLMOD_CHARGES, m_procCharges);
} }
else else
m_procCharges = 0; m_procCharges = -1;
m_isRemovedOnShapeLost = (m_caster_guid==m_target->GetGUID() && m_spellProto->Stances && m_isRemovedOnShapeLost = (m_caster_guid==m_target->GetGUID() && m_spellProto->Stances &&
!(m_spellProto->AttributesEx2 & 0x80000) && !(m_spellProto->Attributes & 0x10000)); !(m_spellProto->AttributesEx2 & 0x80000) && !(m_spellProto->Attributes & 0x10000));
@ -1124,7 +1124,7 @@ void Aura::SendAuraUpdate(bool remove)
uint8 auraFlags = GetAuraFlags(); uint8 auraFlags = GetAuraFlags();
data << uint8(auraFlags); data << uint8(auraFlags);
data << uint8(GetAuraLevel()); data << uint8(GetAuraLevel());
data << uint8(GetAuraCharges()); data << uint8(m_procCharges >= 0 ? m_procCharges : 0);
if(!(auraFlags & AFLAG_NOT_CASTER)) if(!(auraFlags & AFLAG_NOT_CASTER))
{ {