aboutsummaryrefslogtreecommitdiff
path: root/src/game/SpellEffects.cpp
diff options
context:
space:
mode:
authormegamage <none@none>2009-05-31 15:56:51 -0500
committermegamage <none@none>2009-05-31 15:56:51 -0500
commit5ed5513ca82712a6e3691add2c9a0f005d80426f (patch)
tree781e8589bb7f8e95e6b9126f7a555c2f0e1b03ca /src/game/SpellEffects.cpp
parent19e12305515d958c5de586c2a409979b3d193ce6 (diff)
Mangos [7911]. Author: tomrus88
Very big patch. May cause bugs. --HG-- branch : trunk
Diffstat (limited to 'src/game/SpellEffects.cpp')
-rw-r--r--src/game/SpellEffects.cpp311
1 files changed, 157 insertions, 154 deletions
diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp
index 59830551cf3..8cfbb259421 100644
--- a/src/game/SpellEffects.cpp
+++ b/src/game/SpellEffects.cpp
@@ -276,14 +276,14 @@ void Spell::EffectInstaKill(uint32 /*i*/)
case 1863: spellID=18791; break; //succubus
case 17252: spellID=35701; break; //fellguard
default:
- sLog.outError("EffectInstaKill: Unhandled creature entry (%u) case.",entry);
+ sLog.outError("EffectInstaKill: Unhandled creature entry (%u) case.", entry);
return;
}
- m_caster->CastSpell(m_caster,spellID,true);
+ m_caster->CastSpell(m_caster, spellID, true);
}
- if(m_caster==unitTarget) // prevent interrupt message
+ if(m_caster == unitTarget) // prevent interrupt message
finish();
m_caster->DealDamage(unitTarget, unitTarget->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
@@ -299,11 +299,11 @@ void Spell::EffectEnvirinmentalDMG(uint32 i)
// currently each enemy selected explicitly and self cast damage, we prevent apply self casted spell bonuses/etc
damage = m_spellInfo->CalculateSimpleValue(i);
- m_caster->CalcAbsorbResist(m_caster,GetSpellSchoolMask(m_spellInfo), SPELL_DIRECT_DAMAGE, damage, &absorb, &resist, m_spellInfo);
+ m_caster->CalcAbsorbResist(m_caster, GetSpellSchoolMask(m_spellInfo), SPELL_DIRECT_DAMAGE, damage, &absorb, &resist, m_spellInfo);
m_caster->SendSpellNonMeleeDamageLog(m_caster, m_spellInfo->Id, damage, GetSpellSchoolMask(m_spellInfo), absorb, resist, false, 0, false);
if(m_caster->GetTypeId() == TYPEID_PLAYER)
- ((Player*)m_caster)->EnvironmentalDamage(DAMAGE_FIRE,damage);
+ ((Player*)m_caster)->EnvironmentalDamage(DAMAGE_FIRE, damage);
}
void Spell::EffectSchoolDMG(uint32 effect_idx)
@@ -783,7 +783,7 @@ void Spell::EffectDummy(uint32 i)
case 4: spell_id = 8067; break; // Party Time!
case 5: spell_id = 8068; break; // Healthy Spirit
}
- m_caster->CastSpell(m_caster,spell_id,true,NULL);
+ m_caster->CastSpell(m_caster, spell_id, true, NULL);
return;
}
case 8213: // Savory Deviate Delight
@@ -805,7 +805,7 @@ void Spell::EffectDummy(uint32 i)
case 8593: // Symbol of life (restore creature to life)
case 31225: // Shimmering Vessel (restore creature to life)
{
- if(!unitTarget || unitTarget->GetTypeId()!=TYPEID_UNIT)
+ if(!unitTarget || unitTarget->GetTypeId() != TYPEID_UNIT)
return;
((Creature*)unitTarget)->setDeathState(JUST_ALIVED);
return;
@@ -889,18 +889,18 @@ void Spell::EffectDummy(uint32 i)
}
case 16589: // Noggenfogger Elixir
{
- if(m_caster->GetTypeId()!=TYPEID_PLAYER)
+ if(m_caster->GetTypeId() != TYPEID_PLAYER)
return;
uint32 spell_id = 0;
- switch(urand(1,3))
+ switch(urand(1, 3))
{
case 1: spell_id = 16595; break;
case 2: spell_id = 16593; break;
default:spell_id = 16591; break;
}
- m_caster->CastSpell(m_caster,spell_id,true,NULL);
+ m_caster->CastSpell(m_caster, spell_id, true, NULL);
return;
}
case 17251: // Spirit Healer Res
@@ -911,7 +911,7 @@ void Spell::EffectDummy(uint32 i)
if(m_originalCaster->GetTypeId() == TYPEID_PLAYER)
{
WorldPacket data(SMSG_SPIRIT_HEALER_CONFIRM, 8);
- data << unitTarget->GetGUID();
+ data << uint64(unitTarget->GetGUID());
((Player*)m_originalCaster)->GetSession()->SendPacket( &data );
}
return;
@@ -923,12 +923,12 @@ void Spell::EffectDummy(uint32 i)
uint32 spell_id = roll_chance_i(50) ? 17269 : 17270;
- m_caster->CastSpell(m_caster,spell_id,true,NULL);
+ m_caster->CastSpell(m_caster, spell_id, true, NULL);
return;
}
case 20577: // Cannibalize
if (unitTarget)
- m_caster->CastSpell(m_caster,20578,false,NULL);
+ m_caster->CastSpell(m_caster, 20578, false, NULL);
return;
case 23019: // Crystal Prison Dummy DND
{
@@ -948,49 +948,49 @@ void Spell::EffectDummy(uint32 i)
WorldPacket data(SMSG_GAMEOBJECT_SPAWN_ANIM_OBSOLETE, 8);
data << uint64(Crystal_Prison->GetGUID());
- m_caster->SendMessageToSet(&data,true);
+ m_caster->SendMessageToSet(&data, true);
return;
}
case 23074: // Arcanite Dragonling
if (!m_CastItem) return;
- m_caster->CastSpell(m_caster,19804,true,m_CastItem);
+ m_caster->CastSpell(m_caster, 19804, true, m_CastItem);
return;
case 23075: // Mithril Mechanical Dragonling
if (!m_CastItem) return;
- m_caster->CastSpell(m_caster,12749,true,m_CastItem);
+ m_caster->CastSpell(m_caster, 12749, true, m_CastItem);
return;
case 23076: // Mechanical Dragonling
if (!m_CastItem) return;
- m_caster->CastSpell(m_caster,4073,true,m_CastItem);
+ m_caster->CastSpell(m_caster, 4073, true, m_CastItem);
return;
case 23133: // Gnomish Battle Chicken
if (!m_CastItem) return;
- m_caster->CastSpell(m_caster,13166,true,m_CastItem);
+ m_caster->CastSpell(m_caster, 13166, true, m_CastItem);
return;
case 23448: // Ultrasafe Transporter: Gadgetzan - backfires
{
int32 r = irand(0, 119);
if ( r < 20 ) // 1/6 polymorph
- m_caster->CastSpell(m_caster,23444,true);
+ m_caster->CastSpell(m_caster, 23444, true);
else if ( r < 100 ) // 4/6 evil twin
- m_caster->CastSpell(m_caster,23445,true);
+ m_caster->CastSpell(m_caster, 23445, true);
else // 1/6 miss the target
- m_caster->CastSpell(m_caster,36902,true);
+ m_caster->CastSpell(m_caster, 36902, true);
return;
}
case 23453: // Ultrasafe Transporter: Gadgetzan
if ( roll_chance_i(50) ) // success
- m_caster->CastSpell(m_caster,23441,true);
+ m_caster->CastSpell(m_caster, 23441, true);
else // failure
- m_caster->CastSpell(m_caster,23446,true);
+ m_caster->CastSpell(m_caster, 23446, true);
return;
case 23645: // Hourglass Sand
m_caster->RemoveAurasDueToSpell(23170);
return;
case 23725: // Gift of Life (warrior bwl trinket)
- m_caster->CastSpell(m_caster,23782,true);
- m_caster->CastSpell(m_caster,23783,true);
+ m_caster->CastSpell(m_caster, 23782, true);
+ m_caster->CastSpell(m_caster, 23783, true);
return;
case 25860: // Reindeer Transformation
{
@@ -1021,7 +1021,7 @@ void Spell::EffectDummy(uint32 i)
case 28006: // Arcane Cloaking
{
if (unitTarget && unitTarget->GetTypeId() == TYPEID_PLAYER )
- m_caster->CastSpell(unitTarget,29294,true);
+ m_caster->CastSpell(unitTarget, 29294, true);
return;
}
// Polarity Shift
@@ -1086,7 +1086,7 @@ void Spell::EffectDummy(uint32 i)
case 5: spell_id = 33064; break;
}
- m_caster->CastSpell(m_caster,spell_id,true,NULL);
+ m_caster->CastSpell(m_caster, spell_id, true, NULL);
return;
}
case 35745:
@@ -1099,7 +1099,7 @@ void Spell::EffectDummy(uint32 i)
default: return;
}
- m_caster->CastSpell(m_caster,spell_id,true);
+ m_caster->CastSpell(m_caster, spell_id, true);
return;
}
case 37674: // Chaos Blast
@@ -1108,14 +1108,14 @@ void Spell::EffectDummy(uint32 i)
return;
int32 basepoints0 = 100;
- m_caster->CastCustomSpell(unitTarget,37675,&basepoints0,NULL,NULL,true);
+ m_caster->CastCustomSpell(unitTarget, 37675, &basepoints0, NULL, NULL, true);
return;
}
case 40802: // Mingo's Fortune Generator (Mingo's Fortune Giblets)
{
// selecting one from Bloodstained Fortune item
uint32 newitemid;
- switch(urand(1,20))
+ switch(urand(1, 20))
{
case 1: newitemid = 32688; break;
case 2: newitemid = 32689; break;
@@ -1141,7 +1141,7 @@ void Spell::EffectDummy(uint32 i)
return;
}
- DoCreateItem(i,newitemid);
+ DoCreateItem(i, newitemid);
return;
}
// Demon Broiled Surprise
@@ -1167,7 +1167,7 @@ void Spell::EffectDummy(uint32 i)
creatureTarget->SetHealth(0); // just for nice GM-mode view
//cast spell Raptor Capture Credit
- m_caster->CastSpell(m_caster,42337,true,NULL);
+ m_caster->CastSpell(m_caster, 42337, true, NULL);
return;
}
case 34665: //Administer Antidote
@@ -1195,7 +1195,7 @@ void Spell::EffectDummy(uint32 i)
return;
pCreature->SetHealth(health);
- ((Player*)m_caster)->RewardPlayerAndGroupAtEvent(16992,pCreature);
+ ((Player*)m_caster)->RewardPlayerAndGroupAtEvent(16992, pCreature);
if (pCreature->IsAIEnabled)
pCreature->AI()->AttackStart(m_caster);
@@ -1285,7 +1285,7 @@ void Spell::EffectDummy(uint32 i)
case 53341:
case 53343:
{
- m_caster->CastSpell(m_caster,54586,true);
+ m_caster->CastSpell(m_caster, 54586, true);
return;
}
case 58418: // Portal to Orgrimmar
@@ -1312,7 +1312,7 @@ void Spell::EffectDummy(uint32 i)
// FIXME: custom spell required this aura state by some unknown reason, we not need remove it anyway
m_caster->ModifyAuraState(AURA_STATE_BERSERKING,true);
- m_caster->CastCustomSpell(m_caster,26635,&hasteModBasePoints0,&hasteModBasePoints1,&hasteModBasePoints2,true,NULL);
+ m_caster->CastCustomSpell(m_caster, 26635, &hasteModBasePoints0, &hasteModBasePoints1, &hasteModBasePoints2, true, NULL);
return;
}
}
@@ -1340,7 +1340,7 @@ void Spell::EffectDummy(uint32 i)
(GetSpellSchoolMask(spellInfo) & SPELL_SCHOOL_MASK_FROST) &&
spellInfo->Id != 11958 && GetSpellRecoveryTime(spellInfo) > 0 )
{
- ((Player*)m_caster)->RemoveSpellCooldown(classspell,true);
+ ((Player*)m_caster)->RemoveSpellCooldown(classspell, true);
}
}
return;
@@ -1362,7 +1362,7 @@ void Spell::EffectDummy(uint32 i)
if(m_spellInfo->SpellFamilyFlags & 0x1 && m_spellInfo->SpellVisual[0] == 867)
{
int32 chargeBasePoints0 = damage;
- m_caster->CastCustomSpell(m_caster,34846,&chargeBasePoints0,NULL,NULL,true);
+ m_caster->CastCustomSpell(m_caster, 34846, &chargeBasePoints0, NULL, NULL, true);
return;
}
//Slam
@@ -1425,7 +1425,7 @@ void Spell::EffectDummy(uint32 i)
{
if(!unitTarget)
return;
- m_caster->CastSpell(unitTarget,21887,true); // spell mod
+ m_caster->CastSpell(unitTarget, 21887, true);// spell mod
return;
}
// Last Stand
@@ -1602,7 +1602,7 @@ void Spell::EffectDummy(uint32 i)
}
case 31231: // Cheat Death
{
- m_caster->CastSpell(m_caster,45182,true);
+ m_caster->CastSpell(m_caster, 45182, true);
return;
}
}
@@ -1707,7 +1707,7 @@ void Spell::EffectDummy(uint32 i)
((Player*)m_caster)->AddSpellMod(mod, false);
}
else
- m_caster->CastSpell(unitTarget,spell_proto,true,NULL);
+ m_caster->CastSpell(unitTarget, spell_proto, true, NULL);
return;
}
@@ -1761,7 +1761,7 @@ void Spell::EffectDummy(uint32 i)
default: return; // ignore for not healing classes
}
- m_caster->CastSpell(m_caster,spell_id,true);
+ m_caster->CastSpell(m_caster, spell_id, true);
return;
}
}
@@ -1780,7 +1780,7 @@ void Spell::EffectDummy(uint32 i)
case 8019: spell_id = 36755; break; // Rank 3
case 10399: spell_id = 36759; break; // Rank 4
default:
- sLog.outError("Spell::EffectDummy: Spell %u not handled in RW",m_spellInfo->Id);
+ sLog.outError("Spell::EffectDummy: Spell %u not handled in RW", m_spellInfo->Id);
return;
}
@@ -1847,7 +1847,7 @@ void Spell::EffectDummy(uint32 i)
damage+=dummy->GetAmount();
// Regenerate 6% of Total Mana Every 3 secs
int32 EffectBasePoints0 = unitTarget->GetMaxPower(POWER_MANA) * damage / 100;
- m_caster->CastCustomSpell(unitTarget,39609,&EffectBasePoints0,NULL,NULL,true,NULL,NULL,m_originalCasterGUID);
+ m_caster->CastCustomSpell(unitTarget, 39609, &EffectBasePoints0, NULL, NULL, true, NULL, NULL, m_originalCasterGUID);
return;
}
// Lava Lash
@@ -1884,12 +1884,12 @@ void Spell::EffectDummy(uint32 i)
return;
int32 bp = damage * 1.5f;
- m_caster->CastCustomSpell(unitTarget,47633,&bp,NULL,NULL,true);
+ m_caster->CastCustomSpell(unitTarget, 47633, &bp, NULL, NULL, true);
}
else
{
int32 bp = damage;
- m_caster->CastCustomSpell(unitTarget,47632,&bp,NULL,NULL,true);
+ m_caster->CastCustomSpell(unitTarget, 47632, &bp, NULL, NULL, true);
}
return;
}
@@ -1993,7 +1993,7 @@ void Spell::EffectForceCast(uint32 i)
return;
}
- unitTarget->CastSpell(unitTarget,spellInfo,true,NULL,NULL,m_originalCasterGUID);
+ unitTarget->CastSpell(unitTarget, spellInfo, true, NULL, NULL, m_originalCasterGUID);
}
void Spell::EffectTriggerSpell(uint32 i)
@@ -2069,7 +2069,7 @@ void Spell::EffectTriggerSpell(uint32 i)
return;
for (int j=0; j < spell->StackAmount; ++j)
- m_caster->CastSpell(unitTarget,spell->Id, true, m_CastItem, NULL, m_originalCasterGUID);
+ m_caster->CastSpell(unitTarget, spell->Id, true, m_CastItem, NULL, m_originalCasterGUID);
return;
}
// Mercurial Shield - (need add max stack of 26464 Mercurial Shield)
@@ -2080,13 +2080,13 @@ void Spell::EffectTriggerSpell(uint32 i)
return;
for (int j=0; j < spell->StackAmount; ++j)
- m_caster->CastSpell(unitTarget,spell->Id, true, m_CastItem, NULL, m_originalCasterGUID);
+ m_caster->CastSpell(unitTarget, spell->Id, true, m_CastItem, NULL, m_originalCasterGUID);
return;
}
// Righteous Defense
case 31980:
{
- m_caster->CastSpell(unitTarget, 31790, true,m_CastItem,NULL,m_originalCasterGUID);
+ m_caster->CastSpell(unitTarget, 31790, true, m_CastItem, NULL, m_originalCasterGUID);
return;
}
// Cloak of Shadows
@@ -2264,9 +2264,9 @@ void Spell::EffectTeleportUnits(uint32 i)
if ( r >= 70 ) // 7/12 success
{
if ( r < 100 ) // 4/12 evil twin
- m_caster->CastSpell(m_caster,23445,true);
+ m_caster->CastSpell(m_caster, 23445, true);
else // 1/12 fire
- m_caster->CastSpell(m_caster,23449,true);
+ m_caster->CastSpell(m_caster, 23449, true);
}
return;
}
@@ -2275,41 +2275,41 @@ void Spell::EffectTeleportUnits(uint32 i)
{
if ( roll_chance_i(50) ) // 50% success
{
- int32 rand_eff = urand(1,7);
+ int32 rand_eff = urand(1, 7);
switch ( rand_eff )
{
case 1:
// soul split - evil
- m_caster->CastSpell(m_caster,36900,true);
+ m_caster->CastSpell(m_caster, 36900, true);
break;
case 2:
// soul split - good
- m_caster->CastSpell(m_caster,36901,true);
+ m_caster->CastSpell(m_caster, 36901, true);
break;
case 3:
// Increase the size
- m_caster->CastSpell(m_caster,36895,true);
+ m_caster->CastSpell(m_caster, 36895, true);
break;
case 4:
// Decrease the size
- m_caster->CastSpell(m_caster,36893,true);
+ m_caster->CastSpell(m_caster, 36893, true);
break;
case 5:
// Transform
{
if (((Player*)m_caster)->GetTeam() == ALLIANCE )
- m_caster->CastSpell(m_caster,36897,true);
+ m_caster->CastSpell(m_caster, 36897, true);
else
- m_caster->CastSpell(m_caster,36899,true);
+ m_caster->CastSpell(m_caster, 36899, true);
break;
}
case 6:
// chicken
- m_caster->CastSpell(m_caster,36940,true);
+ m_caster->CastSpell(m_caster, 36940, true);
break;
case 7:
// evil twin
- m_caster->CastSpell(m_caster,23445,true);
+ m_caster->CastSpell(m_caster, 23445, true);
break;
}
}
@@ -2320,28 +2320,28 @@ void Spell::EffectTeleportUnits(uint32 i)
{
if ( roll_chance_i(50) ) // 50% success
{
- int32 rand_eff = urand(1,4);
+ int32 rand_eff = urand(1, 4);
switch ( rand_eff )
{
case 1:
// soul split - evil
- m_caster->CastSpell(m_caster,36900,true);
+ m_caster->CastSpell(m_caster, 36900, true);
break;
case 2:
// soul split - good
- m_caster->CastSpell(m_caster,36901,true);
+ m_caster->CastSpell(m_caster, 36901, true);
break;
case 3:
// Increase the size
- m_caster->CastSpell(m_caster,36895,true);
+ m_caster->CastSpell(m_caster, 36895, true);
break;
case 4:
// Transform
{
if (((Player*)m_caster)->GetTeam() == ALLIANCE )
- m_caster->CastSpell(m_caster,36897,true);
+ m_caster->CastSpell(m_caster, 36897, true);
else
- m_caster->CastSpell(m_caster,36899,true);
+ m_caster->CastSpell(m_caster, 36899, true);
break;
}
}
@@ -2422,11 +2422,11 @@ void Spell::EffectPowerDrain(uint32 i)
if(Player *modOwner = m_caster->GetSpellModOwner())
modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_MULTIPLE_VALUE, manaMultiplier);
- int32 gain = int32(new_damage*manaMultiplier);
+ int32 gain = int32(new_damage * manaMultiplier);
m_caster->ModifyPower(POWER_MANA,gain);
//send log
- m_caster->SendEnergizeSpellLog(m_caster, m_spellInfo->Id,gain,POWER_MANA);
+ m_caster->SendEnergizeSpellLog(m_caster, m_spellInfo->Id, gain, POWER_MANA);
}
}
@@ -2474,7 +2474,7 @@ void Spell::EffectPowerBurn(uint32 i)
int32 new_damage = (curPower < power) ? curPower : power;
- unitTarget->ModifyPower(powertype,-new_damage);
+ unitTarget->ModifyPower(powertype, -new_damage);
float multiplier = m_spellInfo->EffectMultipleValue[i];
if(Player *modOwner = m_caster->GetSpellModOwner())
@@ -2745,7 +2745,7 @@ void Spell::DoCreateItem(uint32 i, uint32 itemtype)
// set the "Crafted by ..." property of the item
if( pItem->GetProto()->Class != ITEM_CLASS_CONSUMABLE && pItem->GetProto()->Class != ITEM_CLASS_QUEST)
- pItem->SetUInt32Value(ITEM_FIELD_CREATOR,player->GetGUIDLow());
+ pItem->SetUInt32Value(ITEM_FIELD_CREATOR, player->GetGUIDLow());
// send info to the client
if(pItem)
@@ -2769,23 +2769,23 @@ void Spell::EffectCreateItem2(uint32 i)
uint32 item_id = m_spellInfo->EffectItemType[i];
if(item_id)
- DoCreateItem(i,item_id);
+ DoCreateItem(i, item_id);
// special case: fake item replaced by generate using spell_loot_template
if(IsLootCraftingSpell(m_spellInfo))
{
if(item_id)
{
- if(!player->HasItemCount(item_id,1))
+ if(!player->HasItemCount(item_id, 1))
return;
// remove reagent
uint32 count = 1;
- player->DestroyItemCount (item_id,count,true);
+ player->DestroyItemCount(item_id, count, true);
}
// create some random items
- player->AutoStoreLoot(m_spellInfo->Id,LootTemplates_Spell);
+ player->AutoStoreLoot(m_spellInfo->Id, LootTemplates_Spell);
}
}
@@ -3079,7 +3079,7 @@ void Spell::EffectOpenLock(uint32 effIndex)
int32 reqSkillValue = 0;
int32 skillValue;
- SpellCastResult res = CanOpenLock(effIndex,lockId,skillId,reqSkillValue,skillValue);
+ SpellCastResult res = CanOpenLock(effIndex, lockId, skillId, reqSkillValue, skillValue);
if(res != SPELL_CAST_OK)
{
SendCastResult(res);
@@ -3153,7 +3153,7 @@ void Spell::EffectSummonChangeItem(uint32 i)
uint8 msg = player->CanStoreItem( m_CastItem->GetBagSlot(), m_CastItem->GetSlot(), dest, pNewItem, true );
if( msg == EQUIP_ERR_OK )
{
- player->DestroyItem(m_CastItem->GetBagSlot(), m_CastItem->GetSlot(),true);
+ player->DestroyItem(m_CastItem->GetBagSlot(), m_CastItem->GetSlot(), true);
// prevent crash at access and unexpected charges counting with item update queue corrupt
if(m_CastItem==m_targets.getItemTarget())
@@ -3171,7 +3171,7 @@ void Spell::EffectSummonChangeItem(uint32 i)
uint8 msg = player->CanBankItem( m_CastItem->GetBagSlot(), m_CastItem->GetSlot(), dest, pNewItem, true );
if( msg == EQUIP_ERR_OK )
{
- player->DestroyItem(m_CastItem->GetBagSlot(), m_CastItem->GetSlot(),true);
+ player->DestroyItem(m_CastItem->GetBagSlot(), m_CastItem->GetSlot(), true);
// prevent crash at access and unexpected charges counting with item update queue corrupt
if(m_CastItem==m_targets.getItemTarget())
@@ -3189,7 +3189,7 @@ void Spell::EffectSummonChangeItem(uint32 i)
uint8 msg = player->CanEquipItem( m_CastItem->GetSlot(), dest, pNewItem, true );
if( msg == EQUIP_ERR_OK )
{
- player->DestroyItem(m_CastItem->GetBagSlot(), m_CastItem->GetSlot(),true);
+ player->DestroyItem(m_CastItem->GetBagSlot(), m_CastItem->GetSlot(), true);
// prevent crash at access and unexpected charges counting with item update queue corrupt
if(m_CastItem==m_targets.getItemTarget())
@@ -3219,15 +3219,15 @@ void Spell::EffectProficiency(uint32 /*i*/)
Player *p_target = (Player*)unitTarget;
uint32 subClassMask = m_spellInfo->EquippedItemSubClassMask;
- if(m_spellInfo->EquippedItemClass == 2 && !(p_target->GetWeaponProficiency() & subClassMask))
+ if(m_spellInfo->EquippedItemClass == ITEM_CLASS_WEAPON && !(p_target->GetWeaponProficiency() & subClassMask))
{
p_target->AddWeaponProficiency(subClassMask);
- p_target->SendProficiency(uint8(0x02),p_target->GetWeaponProficiency());
+ p_target->SendProficiency(ITEM_CLASS_WEAPON, p_target->GetWeaponProficiency());
}
- if(m_spellInfo->EquippedItemClass == 4 && !(p_target->GetArmorProficiency() & subClassMask))
+ if(m_spellInfo->EquippedItemClass == ITEM_CLASS_ARMOR && !(p_target->GetArmorProficiency() & subClassMask))
{
p_target->AddArmorProficiency(subClassMask);
- p_target->SendProficiency(uint8(0x04),p_target->GetArmorProficiency());
+ p_target->SendProficiency(ITEM_CLASS_ARMOR, p_target->GetArmorProficiency());
}
}
@@ -3568,7 +3568,7 @@ void Spell::EffectDistract(uint32 /*i*/)
// Set creature Distracted, Stop it, And turn it
unitTarget->SetOrientation(angle);
unitTarget->StopMoving();
- unitTarget->GetMotionMaster()->MoveDistract(damage*IN_MILISECONDS);
+ unitTarget->GetMotionMaster()->MoveDistract(damage * IN_MILISECONDS);
}
}
@@ -3891,26 +3891,26 @@ void Spell::EffectEnchantItemTmp(uint32 i)
uint32 duration;
// rogue family enchantments exception by duration
- if(m_spellInfo->Id==38615)
+ if(m_spellInfo->Id == 38615)
duration = 1800; // 30 mins
// other rogue family enchantments always 1 hour (some have spell damage=0, but some have wrong data in EffBasePoints)
- else if(m_spellInfo->SpellFamilyName==SPELLFAMILY_ROGUE)
+ else if(m_spellInfo->SpellFamilyName == SPELLFAMILY_ROGUE)
duration = 3600; // 1 hour
// shaman family enchantments
- else if(m_spellInfo->SpellFamilyName==SPELLFAMILY_SHAMAN)
+ else if(m_spellInfo->SpellFamilyName == SPELLFAMILY_SHAMAN)
duration = 1800; // 30 mins
// other cases with this SpellVisual already selected
- else if(m_spellInfo->SpellVisual[0]==215)
+ else if(m_spellInfo->SpellVisual[0] == 215)
duration = 1800; // 30 mins
// some fishing pole bonuses
- else if(m_spellInfo->SpellVisual[0]==563)
+ else if(m_spellInfo->SpellVisual[0] == 563)
duration = 600; // 10 mins
// shaman rockbiter enchantments
- else if(m_spellInfo->SpellVisual[0]==0)
+ else if(m_spellInfo->SpellVisual[0] == 0)
duration = 1800; // 30 mins
- else if(m_spellInfo->Id==29702)
+ else if(m_spellInfo->Id == 29702)
duration = 300; // 5 mins
- else if(m_spellInfo->Id==37360)
+ else if(m_spellInfo->Id == 37360)
duration = 300; // 5 mins
// default case
else
@@ -3924,18 +3924,18 @@ void Spell::EffectEnchantItemTmp(uint32 i)
if(item_owner!=p_caster && p_caster->GetSession()->GetSecurity() > SEC_PLAYER && sWorld.getConfig(CONFIG_GM_LOG_TRADE) )
{
sLog.outCommand(p_caster->GetSession()->GetAccountId(),"GM %s (Account: %u) enchanting(temp): %s (Entry: %d) for player: %s (Account: %u)",
- p_caster->GetName(),p_caster->GetSession()->GetAccountId(),
- itemTarget->GetProto()->Name1,itemTarget->GetEntry(),
- item_owner->GetName(),item_owner->GetSession()->GetAccountId());
+ p_caster->GetName(), p_caster->GetSession()->GetAccountId(),
+ itemTarget->GetProto()->Name1, itemTarget->GetEntry(),
+ item_owner->GetName(), item_owner->GetSession()->GetAccountId());
}
// remove old enchanting before applying new if equipped
- item_owner->ApplyEnchantment(itemTarget,TEMP_ENCHANTMENT_SLOT,false);
+ item_owner->ApplyEnchantment(itemTarget,TEMP_ENCHANTMENT_SLOT, false);
- itemTarget->SetEnchantment(TEMP_ENCHANTMENT_SLOT, enchant_id, duration*1000, 0);
+ itemTarget->SetEnchantment(TEMP_ENCHANTMENT_SLOT, enchant_id, duration * 1000, 0);
// add new enchanting if equipped
- item_owner->ApplyEnchantment(itemTarget,TEMP_ENCHANTMENT_SLOT,true);
+ item_owner->ApplyEnchantment(itemTarget, TEMP_ENCHANTMENT_SLOT, true);
}
void Spell::EffectTameCreature(uint32 /*i*/)
@@ -4130,7 +4130,7 @@ void Spell::SpellDamageWeaponDmg(uint32 i)
// multiple weapon dmg effect workaround
// execute only the last weapon damage
// and handle all effects at once
- for (int j = 0; j < 3; j++)
+ for (int j = 0; j < 3; ++j)
{
switch(m_spellInfo->Effect[j])
{
@@ -4279,7 +4279,7 @@ void Spell::SpellDamageWeaponDmg(uint32 i)
// Stormstrike AP Buff
if ( (*citr)->GetMiscValue() == 5634 )
{
- m_caster->CastSpell(m_caster,38430,true,NULL,*citr);
+ m_caster->CastSpell(m_caster, 38430, true, NULL, *citr);
break;
}
}
@@ -4306,10 +4306,10 @@ void Spell::SpellDamageWeaponDmg(uint32 i)
{
case SPELL_EFFECT_WEAPON_DAMAGE:
case SPELL_EFFECT_WEAPON_DAMAGE_NOSCHOOL:
- fixed_bonus += CalculateDamage(j,unitTarget);
+ fixed_bonus += CalculateDamage(j, unitTarget);
break;
case SPELL_EFFECT_NORMALIZED_WEAPON_DMG:
- fixed_bonus += CalculateDamage(j,unitTarget);
+ fixed_bonus += CalculateDamage(j, unitTarget);
normalized = true;
break;
case SPELL_EFFECT_WEAPON_PERCENT_DAMAGE:
@@ -4437,7 +4437,7 @@ void Spell::EffectSummonObjectWild(uint32 i)
if( !target )
target = m_caster;
- float x,y,z;
+ float x, y, z;
if(m_targets.m_targetMask & TARGET_FLAG_DEST_LOCATION)
{
x = m_targets.m_destX;
@@ -4445,7 +4445,7 @@ void Spell::EffectSummonObjectWild(uint32 i)
z = m_targets.m_destZ;
}
else
- m_caster->GetClosePoint(x,y,z,DEFAULT_WORLD_OBJECT_SIZE);
+ m_caster->GetClosePoint(x, y, z, DEFAULT_WORLD_OBJECT_SIZE);
Map *map = target->GetMap();
@@ -4549,7 +4549,7 @@ void Spell::EffectScriptEffect(uint32 effIndex)
return;
uint32 spell_id = 0;
- switch(urand(1,5))
+ switch(urand(1, 5))
{
case 1: spell_id = 8854; break;
default: spell_id = 8855; break;
@@ -4671,14 +4671,17 @@ void Spell::EffectScriptEffect(uint32 effIndex)
case 29830:
{
uint32 item = 0;
- switch ( urand(1,6) )
+ switch ( urand(1, 6) )
{
- case 1:case 2:case 3:
- item = 23584;break; // Loch Modan Lager
- case 4:case 5:
- item = 23585;break; // Stouthammer Lite
+ case 1:
+ case 2:
+ case 3:
+ item = 23584; break; // Loch Modan Lager
+ case 4:
+ case 5:
+ item = 23585; break; // Stouthammer Lite
case 6:
- item = 23586;break; // Aerie Peak Pale Ale
+ item = 23586; break; // Aerie Peak Pale Ale
}
if (item)
DoCreateItem(effIndex,item);
@@ -4823,7 +4826,7 @@ void Spell::EffectScriptEffect(uint32 effIndex)
return;
uint32 spellId = 0;
- switch(rand()%4)
+ switch(rand() % 4)
{
case 0: spellId = 46740; break;
case 1: spellId = 46739; break;
@@ -4963,12 +4966,12 @@ void Spell::EffectScriptEffect(uint32 effIndex)
case 61288: // Minor Inscription Research
case 61756: // Northrend Inscription Research (FAST QA VERSION)
{
- if(m_caster->GetTypeId()!=TYPEID_PLAYER)
+ if(m_caster->GetTypeId() != TYPEID_PLAYER)
return;
// learn random explicit discovery recipe (if any)
if(uint32 discoveredSpell = GetExplicitDiscoverySpell(m_spellInfo->Id, (Player*)m_caster))
- ((Player*)m_caster)->learnSpell(discoveredSpell,false);
+ ((Player*)m_caster)->learnSpell(discoveredSpell, false);
return;
}
}
@@ -5006,14 +5009,14 @@ void Spell::EffectScriptEffect(uint32 effIndex)
}
static uint32 const itypes[8][3] = {
- { 5512,19004,19005}, // Minor Healthstone
- { 5511,19006,19007}, // Lesser Healthstone
- { 5509,19008,19009}, // Healthstone
- { 5510,19010,19011}, // Greater Healthstone
- { 9421,19012,19013}, // Major Healthstone
- {22103,22104,22105}, // Master Healthstone
- {36889,36890,36891}, // Demonic Healthstone
- {36892,36893,36894} // Fel Healthstone
+ { 5512, 19004, 19005}, // Minor Healthstone
+ { 5511, 19006, 19007}, // Lesser Healthstone
+ { 5509, 19008, 19009}, // Healthstone
+ { 5510, 19010, 19011}, // Greater Healthstone
+ { 9421, 19012, 19013}, // Major Healthstone
+ {22103, 22104, 22105}, // Master Healthstone
+ {36889, 36890, 36891}, // Demonic Healthstone
+ {36892, 36893, 36894} // Fel Healthstone
};
switch(m_spellInfo->Id)
@@ -5254,8 +5257,8 @@ void Spell::EffectScriptEffect(uint32 effIndex)
const uint32 spellid = 28703;
// don't overwrite an existing aura
- for(uint8 i=0; i<5; i++)
- if(unitTarget->HasAuraEffect(spellid+i, 0))
+ for(uint8 i = 0; i < 5; ++i)
+ if(unitTarget->HasAuraEffect(spellid + i, 0))
return;
unitTarget->CastSpell(unitTarget, spellid+urand(0, 4), true);
break;
@@ -5392,9 +5395,9 @@ void Spell::EffectDuel(uint32 i)
//END
// Send request
- WorldPacket data(SMSG_DUEL_REQUESTED, 16);
- data << pGameObj->GetGUID();
- data << caster->GetGUID();
+ WorldPacket data(SMSG_DUEL_REQUESTED, 8 + 8);
+ data << uint64(pGameObj->GetGUID());
+ data << uint64(caster->GetGUID());
caster->GetSession()->SendPacket(&data);
target->GetSession()->SendPacket(&data);
@@ -5413,8 +5416,8 @@ void Spell::EffectDuel(uint32 i)
duel2->startTimer = 0;
target->duel = duel2;
- caster->SetUInt64Value(PLAYER_DUEL_ARBITER,pGameObj->GetGUID());
- target->SetUInt64Value(PLAYER_DUEL_ARBITER,pGameObj->GetGUID());
+ caster->SetUInt64Value(PLAYER_DUEL_ARBITER, pGameObj->GetGUID());
+ target->SetUInt64Value(PLAYER_DUEL_ARBITER, pGameObj->GetGUID());
}
void Spell::EffectStuck(uint32 /*i*/)
@@ -5440,7 +5443,7 @@ void Spell::EffectStuck(uint32 /*i*/)
SpellEntry const *spellInfo = sSpellStore.LookupEntry(8690);
if(!spellInfo)
return;
- Spell spell(pTarget,spellInfo,true,0);
+ Spell spell(pTarget, spellInfo, true, 0);
spell.SendSpellCooldown();
}
@@ -5453,8 +5456,8 @@ void Spell::EffectSummonPlayer(uint32 /*i*/)
if(unitTarget->GetDummyAura(23445))
return;
- float x,y,z;
- m_caster->GetClosePoint(x,y,z,unitTarget->GetObjectSize());
+ float x, y, z;
+ m_caster->GetClosePoint(x, y, z, unitTarget->GetObjectSize());
((Player*)unitTarget)->SetSummonPoint(m_caster->GetMapId(),x,y,z);
@@ -5559,7 +5562,7 @@ void Spell::EffectEnchantHeldItem(uint32 i)
// Apply the temporary enchantment
item->SetEnchantment(slot, enchant_id, duration*IN_MILISECONDS, 0);
- item_owner->ApplyEnchantment(item,slot,true);
+ item_owner->ApplyEnchantment(item, slot, true);
}
}
@@ -5591,7 +5594,7 @@ void Spell::EffectInebriate(uint32 /*i*/)
currentDrunk = 0xFFFF;
else
currentDrunk += drunkMod;
- player->SetDrunkValue(currentDrunk, m_CastItem?m_CastItem->GetEntry():0);
+ player->SetDrunkValue(currentDrunk, m_CastItem ? m_CastItem->GetEntry() : 0);
}
void Spell::EffectFeedPet(uint32 i)
@@ -5620,7 +5623,7 @@ void Spell::EffectFeedPet(uint32 i)
_player->DestroyItemCount(foodItem,count,true);
// TODO: fix crash when a spell has two effects, both pointed at the same item target
- m_caster->CastCustomSpell(pet,m_spellInfo->EffectTriggerSpell[i],&benefit,NULL,NULL,true);
+ m_caster->CastCustomSpell(pet, m_spellInfo->EffectTriggerSpell[i], &benefit, NULL, NULL, true);
}
void Spell::EffectDismissPet(uint32 /*i*/)
@@ -5634,7 +5637,7 @@ void Spell::EffectDismissPet(uint32 /*i*/)
if(!pet||!pet->isAlive())
return;
- ((Player*)m_caster)->RemovePet(pet,PET_SAVE_NOT_IN_SLOT);
+ ((Player*)m_caster)->RemovePet(pet, PET_SAVE_NOT_IN_SLOT);
}
void Spell::EffectSummonObject(uint32 i)
@@ -5664,7 +5667,7 @@ void Spell::EffectSummonObject(uint32 i)
GameObject* pGameObj = new GameObject;
- float x,y,z;
+ float x, y, z;
// If dest location if present
if (m_targets.m_targetMask & TARGET_FLAG_DEST_LOCATION)
{
@@ -5674,7 +5677,7 @@ void Spell::EffectSummonObject(uint32 i)
}
// Summon in random point all other units if location present
else
- m_caster->GetClosePoint(x,y,z,DEFAULT_WORLD_OBJECT_SIZE);
+ m_caster->GetClosePoint(x, y, z, DEFAULT_WORLD_OBJECT_SIZE);
Map *map = m_caster->GetMap();
if(!pGameObj->Create(objmgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT), go_id, map,
@@ -5692,8 +5695,8 @@ void Spell::EffectSummonObject(uint32 i)
map->Add(pGameObj);
WorldPacket data(SMSG_GAMEOBJECT_SPAWN_ANIM_OBSOLETE, 8);
- data << pGameObj->GetGUID();
- m_caster->SendMessageToSet(&data,true);
+ data << uint64(pGameObj->GetGUID());
+ m_caster->SendMessageToSet(&data, true);
m_caster->m_ObjectSlot[slot] = pGameObj->GetGUID();
}
@@ -5848,7 +5851,7 @@ void Spell::EffectReputation(uint32 i)
if(!factionEntry)
return;
- _player->GetReputationMgr().ModifyReputation(factionEntry,rep_change);
+ _player->GetReputationMgr().ModifyReputation(factionEntry, rep_change);
}
void Spell::EffectQuestComplete(uint32 i)
@@ -6001,7 +6004,7 @@ void Spell::EffectPlayerPull(uint32 i)
float vsin = sin(unitTarget->GetAngle(m_caster));
float vcos = cos(unitTarget->GetAngle(m_caster));
- WorldPacket data(SMSG_MOVE_KNOCK_BACK, (8+4+4+4+4+4));
+ WorldPacket data(SMSG_MOVE_KNOCK_BACK, 8+4+4+4+4+4);
data.append(unitTarget->GetPackGUID());
data << uint32(0); // Sequence
data << float(vcos); // x direction
@@ -6099,7 +6102,7 @@ void Spell::EffectDurabilityDamage(uint32 i)
// Possibly its mean -1 all player equipped items and -2 all items
if(slot < 0)
{
- ((Player*)unitTarget)->DurabilityPointsLossAll(damage,(slot < -1));
+ ((Player*)unitTarget)->DurabilityPointsLossAll(damage, (slot < -1));
return;
}
@@ -6107,8 +6110,8 @@ void Spell::EffectDurabilityDamage(uint32 i)
if(slot >= INVENTORY_SLOT_BAG_END)
return;
- if(Item* item = ((Player*)unitTarget)->GetItemByPos(INVENTORY_SLOT_BAG_0,slot))
- ((Player*)unitTarget)->DurabilityPointsLoss(item,damage);
+ if(Item* item = ((Player*)unitTarget)->GetItemByPos(INVENTORY_SLOT_BAG_0, slot))
+ ((Player*)unitTarget)->DurabilityPointsLoss(item, damage);
}
void Spell::EffectDurabilityDamagePCT(uint32 i)
@@ -6122,7 +6125,7 @@ void Spell::EffectDurabilityDamagePCT(uint32 i)
// Possibly its mean -1 all player equipped items and -2 all items
if(slot < 0)
{
- ((Player*)unitTarget)->DurabilityLossAll(double(damage)/100.0f,(slot < -1));
+ ((Player*)unitTarget)->DurabilityLossAll(double(damage)/100.0f, (slot < -1));
return;
}
@@ -6133,8 +6136,8 @@ void Spell::EffectDurabilityDamagePCT(uint32 i)
if(damage <= 0)
return;
- if(Item* item = ((Player*)unitTarget)->GetItemByPos(INVENTORY_SLOT_BAG_0,slot))
- ((Player*)unitTarget)->DurabilityLoss(item,double(damage)/100.0f);
+ if(Item* item = ((Player*)unitTarget)->GetItemByPos(INVENTORY_SLOT_BAG_0, slot))
+ ((Player*)unitTarget)->DurabilityLoss(item, double(damage)/100.0f);
}
void Spell::EffectModifyThreatPercent(uint32 /*effIndex*/)
@@ -6157,7 +6160,7 @@ void Spell::EffectTransmitted(uint32 effIndex)
return;
}
- float fx,fy,fz;
+ float fx, fy, fz;
if(m_targets.m_targetMask & TARGET_FLAG_DEST_LOCATION)
{
@@ -6169,7 +6172,7 @@ void Spell::EffectTransmitted(uint32 effIndex)
else if(m_spellInfo->EffectRadiusIndex[effIndex] && m_spellInfo->speed==0)
{
float dis = GetSpellRadiusForFriend(sSpellRadiusStore.LookupEntry(m_spellInfo->EffectRadiusIndex[effIndex]));
- m_caster->GetClosePoint(fx,fy,fz,DEFAULT_WORLD_OBJECT_SIZE, dis);
+ m_caster->GetClosePoint(fx, fy, fz, DEFAULT_WORLD_OBJECT_SIZE, dis);
}
else
{
@@ -6178,14 +6181,14 @@ void Spell::EffectTransmitted(uint32 effIndex)
float max_dis = GetSpellMaxRangeForFriend(sSpellRangeStore.LookupEntry(m_spellInfo->rangeIndex));
float dis = rand_norm() * (max_dis - min_dis) + min_dis;
- m_caster->GetClosePoint(fx,fy,fz,DEFAULT_WORLD_OBJECT_SIZE, dis);
+ m_caster->GetClosePoint(fx, fy, fz, DEFAULT_WORLD_OBJECT_SIZE, dis);
}
Map *cMap = m_caster->GetMap();
if(goinfo->type==GAMEOBJECT_TYPE_FISHINGNODE)
{
- if ( !cMap->IsInWater(fx,fy,fz-0.5f)) // Hack to prevent fishing bobber from failing to land on fishing hole
+ if ( !cMap->IsInWater(fx, fy, fz-0.5f)) // Hack to prevent fishing bobber from failing to land on fishing hole
{ // but this is not proper, we really need to ignore not materialized objects
SendCastResult(SPELL_FAILED_NOT_HERE);
SendChannelUpdate(0);
@@ -6193,12 +6196,12 @@ void Spell::EffectTransmitted(uint32 effIndex)
}
// replace by water level in this case
- fz = cMap->GetWaterLevel(fx,fy);
+ fz = cMap->GetWaterLevel(fx, fy);
}
// if gameobject is summoning object, it should be spawned right on caster's position
else if(goinfo->type==GAMEOBJECT_TYPE_SUMMONING_RITUAL)
{
- m_caster->GetPosition(fx,fy,fz);
+ m_caster->GetPosition(fx, fy, fz);
}
GameObject* pGameObj = new GameObject;
@@ -6235,7 +6238,7 @@ void Spell::EffectTransmitted(uint32 effIndex)
}
case GAMEOBJECT_TYPE_SUMMONING_RITUAL:
{
- if(m_caster->GetTypeId()==TYPEID_PLAYER)
+ if(m_caster->GetTypeId() == TYPEID_PLAYER)
{
pGameObj->AddUniqueUse((Player*)m_caster);
m_caster->AddGameObject(pGameObj); // will removed at spell cancel