aboutsummaryrefslogtreecommitdiff
path: root/src/server/scripts/Spells
diff options
context:
space:
mode:
authorVincent-Michael <Vincent_Michael@gmx.de>2014-04-05 20:43:05 +0200
committerVincent-Michael <Vincent_Michael@gmx.de>2014-04-05 20:43:05 +0200
commite4b14b943d3a2aa5d7b41107adc8c5236b86d1af (patch)
tree2ef54a0bc7d4f5385b9266afe528265ed9f35f8d /src/server/scripts/Spells
parenta903c335024d0ef4a3d9899587fcd0b10a92b31e (diff)
parent29610b250dd5017f068264d9b1a37748c9f30feb (diff)
Merge branch 'master' of github.com:TrinityCore/TrinityCore into 4.3.4
Conflicts: sql/old/3.3.5a/TDB52_to_TDB53_updates/world/2013_07_24_00_world_spell_script_names.sql sql/updates/world/2013_07_24_00_world_spell_script_names.sql sql/updates/world/2013_07_24_00_world_spell_script_names_335.sql src/server/game/Achievements/AchievementMgr.cpp src/server/game/Achievements/AchievementMgr.h src/server/game/Battlegrounds/ArenaTeamMgr.cpp src/server/game/Chat/ChatLink.cpp src/server/game/DataStores/DBCStores.cpp src/server/game/DataStores/DBCStructure.h src/server/game/DataStores/DBCfmt.h src/server/game/Entities/DynamicObject/DynamicObject.h src/server/game/Entities/Object/Object.cpp src/server/game/Entities/Player/Player.cpp src/server/game/Entities/Unit/StatSystem.cpp src/server/game/Entities/Unit/Unit.cpp src/server/game/Entities/Unit/Unit.h src/server/game/Groups/Group.cpp src/server/game/Handlers/QuestHandler.cpp src/server/game/Miscellaneous/SharedDefines.h src/server/game/Spells/Auras/SpellAuraEffects.cpp src/server/game/Spells/Auras/SpellAuras.cpp src/server/game/World/World.h src/server/scripts/Commands/cs_character.cpp src/server/scripts/Commands/cs_lookup.cpp src/server/scripts/Commands/cs_titles.cpp src/server/scripts/EasternKingdoms/ZulAman/boss_halazzi.cpp src/server/scripts/EasternKingdoms/ZulAman/boss_zuljin.cpp src/server/scripts/EasternKingdoms/ZulGurub/boss_jeklik.cpp src/server/scripts/Kalimdor/zone_darkshore.cpp src/server/scripts/Kalimdor/zone_mulgore.cpp src/server/scripts/Kalimdor/zone_tanaris.cpp src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp src/server/scripts/Spells/spell_dk.cpp src/server/scripts/Spells/spell_mage.cpp src/server/scripts/Spells/spell_rogue.cpp src/server/shared/Database/Implementation/CharacterDatabase.cpp src/server/shared/Database/Implementation/CharacterDatabase.h src/tools/vmap4_extractor/mpq_libmpq04.h
Diffstat (limited to 'src/server/scripts/Spells')
-rw-r--r--src/server/scripts/Spells/spell_dk.cpp2
-rw-r--r--src/server/scripts/Spells/spell_generic.cpp78
-rw-r--r--src/server/scripts/Spells/spell_mage.cpp4
-rw-r--r--src/server/scripts/Spells/spell_pet.cpp6
-rw-r--r--src/server/scripts/Spells/spell_priest.cpp2
-rw-r--r--src/server/scripts/Spells/spell_quest.cpp4
-rw-r--r--src/server/scripts/Spells/spell_rogue.cpp4
-rw-r--r--src/server/scripts/Spells/spell_warlock.cpp5
-rw-r--r--src/server/scripts/Spells/spell_warrior.cpp2
9 files changed, 84 insertions, 23 deletions
diff --git a/src/server/scripts/Spells/spell_dk.cpp b/src/server/scripts/Spells/spell_dk.cpp
index 3fb74bddee0..e2f642d2b2a 100644
--- a/src/server/scripts/Spells/spell_dk.cpp
+++ b/src/server/scripts/Spells/spell_dk.cpp
@@ -190,7 +190,7 @@ class spell_dk_anti_magic_zone : public SpellScriptLoader
void CalculateAmount(AuraEffect const* /*aurEff*/, int32 & amount, bool & /*canBeRecalculated*/)
{
- SpellInfo const* talentSpell = sSpellMgr->GetSpellInfo(SPELL_DK_ANTI_MAGIC_SHELL_TALENT);
+ SpellInfo const* talentSpell = sSpellMgr->EnsureSpellInfo(SPELL_DK_ANTI_MAGIC_SHELL_TALENT);
amount = talentSpell->Effects[EFFECT_0].CalcValue(GetCaster());
if (Player* player = GetCaster()->ToPlayer())
amount += int32(2 * player->GetTotalAttackPowerValue(BASE_ATTACK));
diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp
index 891f578e73e..c3145450635 100644
--- a/src/server/scripts/Spells/spell_generic.cpp
+++ b/src/server/scripts/Spells/spell_generic.cpp
@@ -36,6 +36,7 @@
#include "SkillDiscovery.h"
#include "SpellScript.h"
#include "SpellAuraEffects.h"
+#include "Vehicle.h"
class spell_gen_absorb0_hitlimit1 : public SpellScriptLoader
{
@@ -776,7 +777,7 @@ class spell_gen_clone : public SpellScriptLoader
void HandleScriptEffect(SpellEffIndex effIndex)
{
PreventHitDefaultEffect(effIndex);
- GetHitUnit()->CastSpell(GetCaster(), GetEffectValue(), true);
+ GetHitUnit()->CastSpell(GetCaster(), uint32(GetEffectValue()), true);
}
void Register() OVERRIDE
@@ -824,10 +825,7 @@ class spell_gen_clone_weapon : public SpellScriptLoader
void HandleScriptEffect(SpellEffIndex effIndex)
{
PreventHitDefaultEffect(effIndex);
- Unit* caster = GetCaster();
-
- if (Unit* target = GetHitUnit())
- caster->CastSpell(target, GetEffectValue(), true);
+ GetHitUnit()->CastSpell(GetCaster(), uint32(GetEffectValue()), true);
}
void Register() OVERRIDE
@@ -851,8 +849,6 @@ class spell_gen_clone_weapon_aura : public SpellScriptLoader
{
PrepareAuraScript(spell_gen_clone_weapon_auraScript);
- uint32 prevItem;
-
bool Validate(SpellInfo const* /*spellInfo*/) OVERRIDE
{
if (!sSpellMgr->GetSpellInfo(SPELL_COPY_WEAPON_AURA) ||
@@ -865,6 +861,12 @@ class spell_gen_clone_weapon_aura : public SpellScriptLoader
return true;
}
+ bool Load() OVERRIDE
+ {
+ prevItem = 0;
+ return true;
+ }
+
void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
Unit* caster = GetCaster();
@@ -950,6 +952,8 @@ class spell_gen_clone_weapon_aura : public SpellScriptLoader
OnEffectRemove += AuraEffectRemoveFn(spell_gen_clone_weapon_auraScript::OnRemove, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK);
}
+ private:
+ uint32 prevItem;
};
AuraScript* GetAuraScript() const OVERRIDE
@@ -1208,7 +1212,7 @@ class spell_gen_defend : public SpellScriptLoader
void Register() OVERRIDE
{
- SpellInfo const* spell = sSpellMgr->GetSpellInfo(m_scriptSpellId);
+ SpellInfo const* spell = sSpellMgr->EnsureSpellInfo(m_scriptSpellId);
// Defend spells cast by NPCs (add visuals)
if (spell->Effects[EFFECT_0].ApplyAuraName == SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN)
@@ -2010,7 +2014,7 @@ class spell_gen_mounted_charge: public SpellScriptLoader
void Register() OVERRIDE
{
- SpellInfo const* spell = sSpellMgr->GetSpellInfo(m_scriptSpellId);
+ SpellInfo const* spell = sSpellMgr->EnsureSpellInfo(m_scriptSpellId);
if (spell->HasEffect(SPELL_EFFECT_SCRIPT_EFFECT))
OnEffectHitTarget += SpellEffectFn(spell_gen_mounted_charge_SpellScript::HandleScriptEffect, EFFECT_FIRST_FOUND, SPELL_EFFECT_SCRIPT_EFFECT);
@@ -3268,6 +3272,33 @@ class spell_gen_summon_tournament_mount : public SpellScriptLoader
}
};
+// 41213, 43416, 69222, 73076 - Throw Shield
+class spell_gen_throw_shield : public SpellScriptLoader
+{
+ public:
+ spell_gen_throw_shield() : SpellScriptLoader("spell_gen_throw_shield") { }
+
+ class spell_gen_throw_shield_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_gen_throw_shield_SpellScript);
+
+ void HandleScriptEffect(SpellEffIndex effIndex)
+ {
+ PreventHitDefaultEffect(effIndex);
+ GetCaster()->CastSpell(GetHitUnit(), uint32(GetEffectValue()), true);
+ }
+
+ void Register() OVERRIDE
+ {
+ OnEffectHitTarget += SpellEffectFn(spell_gen_throw_shield_SpellScript::HandleScriptEffect, EFFECT_1, SPELL_EFFECT_SCRIPT_EFFECT);
+ }
+ };
+
+ SpellScript* GetSpellScript() const OVERRIDE
+ {
+ return new spell_gen_throw_shield_SpellScript();
+ }
+};
enum MountedDuelSpells
{
@@ -3660,6 +3691,33 @@ class spell_gen_whisper_gulch_yogg_saron_whisper : public SpellScriptLoader
}
};
+class spell_gen_eject_all_passengers : public SpellScriptLoader
+{
+ public:
+ spell_gen_eject_all_passengers() : SpellScriptLoader("spell_gen_eject_all_passengers") { }
+
+ class spell_gen_eject_all_passengers_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_gen_eject_all_passengers_SpellScript);
+
+ void RemoveVehicleAuras()
+ {
+ if (Vehicle* vehicle = GetHitUnit()->GetVehicleKit())
+ vehicle->RemoveAllPassengers();
+ }
+
+ void Register() OVERRIDE
+ {
+ AfterHit += SpellHitFn(spell_gen_eject_all_passengers_SpellScript::RemoveVehicleAuras);
+ }
+ };
+
+ SpellScript* GetSpellScript() const OVERRIDE
+ {
+ return new spell_gen_eject_all_passengers_SpellScript();
+ }
+};
+
void AddSC_generic_spell_scripts()
{
new spell_gen_absorb0_hitlimit1();
@@ -3734,6 +3792,7 @@ void AddSC_generic_spell_scripts()
new spell_gen_summon_elemental("spell_gen_summon_fire_elemental", SPELL_SUMMON_FIRE_ELEMENTAL);
new spell_gen_summon_elemental("spell_gen_summon_earth_elemental", SPELL_SUMMON_EARTH_ELEMENTAL);
new spell_gen_summon_tournament_mount();
+ new spell_gen_throw_shield();
new spell_gen_tournament_duel();
new spell_gen_tournament_pennant();
new spell_pvp_trinket_wotf_shared_cd();
@@ -3743,4 +3802,5 @@ void AddSC_generic_spell_scripts()
new spell_gen_vendor_bark_trigger();
new spell_gen_wg_water();
new spell_gen_whisper_gulch_yogg_saron_whisper();
+ new spell_gen_eject_all_passengers();
}
diff --git a/src/server/scripts/Spells/spell_mage.cpp b/src/server/scripts/Spells/spell_mage.cpp
index 2b2834360a3..d1126f59c4c 100644
--- a/src/server/scripts/Spells/spell_mage.cpp
+++ b/src/server/scripts/Spells/spell_mage.cpp
@@ -331,7 +331,7 @@ class spell_mage_cold_snap : public SpellScriptLoader
const SpellCooldowns& cm = caster->GetSpellCooldownMap();
for (SpellCooldowns::const_iterator itr = cm.begin(); itr != cm.end();)
{
- SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first);
+ SpellInfo const* spellInfo = sSpellMgr->EnsureSpellInfo(itr->first);
if (spellInfo->SpellFamilyName == SPELLFAMILY_MAGE &&
(spellInfo->GetSchoolMask() & SPELL_SCHOOL_MASK_FROST) &&
@@ -824,7 +824,7 @@ class spell_mage_ignite : public SpellScriptLoader
{
PreventDefaultAction();
- SpellInfo const* igniteDot = sSpellMgr->GetSpellInfo(SPELL_MAGE_IGNITE);
+ SpellInfo const* igniteDot = sSpellMgr->EnsureSpellInfo(SPELL_MAGE_IGNITE);
int32 pct = 8 * GetSpellInfo()->GetRank();
int32 amount = int32(CalculatePct(eventInfo.GetDamageInfo()->GetDamage(), pct) / igniteDot->GetMaxTicks());
diff --git a/src/server/scripts/Spells/spell_pet.cpp b/src/server/scripts/Spells/spell_pet.cpp
index 7c8a725ca08..b8c38ad3f02 100644
--- a/src/server/scripts/Spells/spell_pet.cpp
+++ b/src/server/scripts/Spells/spell_pet.cpp
@@ -895,7 +895,7 @@ public:
if (itr != pet->ToPet()->m_spells.end()) // If pet has Wild Hunt
{
- SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first); // Then get the SpellProto and add the dummy effect value
+ SpellInfo const* spellInfo = sSpellMgr->EnsureSpellInfo(itr->first); // Then get the SpellProto and add the dummy effect value
AddPct(mod, spellInfo->Effects[EFFECT_0].CalcValue());
}
@@ -938,7 +938,7 @@ public:
if (itr != pet->ToPet()->m_spells.end()) // If pet has Wild Hunt
{
- SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first); // Then get the SpellProto and add the dummy effect value
+ SpellInfo const* spellInfo = sSpellMgr->EnsureSpellInfo(itr->first); // Then get the SpellProto and add the dummy effect value
mod += CalculatePct(1.0f, spellInfo->Effects[EFFECT_1].CalcValue());
}
@@ -968,7 +968,7 @@ public:
if (itr != pet->ToPet()->m_spells.end()) // If pet has Wild Hunt
{
- SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first); // Then get the SpellProto and add the dummy effect value
+ SpellInfo const* spellInfo = sSpellMgr->EnsureSpellInfo(itr->first); // Then get the SpellProto and add the dummy effect value
mod += CalculatePct(1.0f, spellInfo->Effects[EFFECT_1].CalcValue());
}
diff --git a/src/server/scripts/Spells/spell_priest.cpp b/src/server/scripts/Spells/spell_priest.cpp
index c92f9e30ac5..57f96433049 100644
--- a/src/server/scripts/Spells/spell_priest.cpp
+++ b/src/server/scripts/Spells/spell_priest.cpp
@@ -368,7 +368,7 @@ class spell_pri_glyph_of_prayer_of_healing : public SpellScriptLoader
{
PreventDefaultAction();
- SpellInfo const* triggeredSpellInfo = sSpellMgr->GetSpellInfo(SPELL_PRIEST_GLYPH_OF_PRAYER_OF_HEALING_HEAL);
+ SpellInfo const* triggeredSpellInfo = sSpellMgr->EnsureSpellInfo(SPELL_PRIEST_GLYPH_OF_PRAYER_OF_HEALING_HEAL);
int32 heal = int32(CalculatePct(int32(eventInfo.GetHealInfo()->GetHeal()), aurEff->GetAmount()) / triggeredSpellInfo->GetMaxTicks());
GetTarget()->CastCustomSpell(SPELL_PRIEST_GLYPH_OF_PRAYER_OF_HEALING_HEAL, SPELLVALUE_BASE_POINT0, heal, eventInfo.GetProcTarget(), true, NULL, aurEff);
}
diff --git a/src/server/scripts/Spells/spell_quest.cpp b/src/server/scripts/Spells/spell_quest.cpp
index cdf32bd94d5..d1b32570795 100644
--- a/src/server/scripts/Spells/spell_quest.cpp
+++ b/src/server/scripts/Spells/spell_quest.cpp
@@ -903,7 +903,7 @@ class spell_q12659_ahunaes_knife : public SpellScriptLoader
enum StoppingTheSpread
{
NPC_VILLAGER_KILL_CREDIT = 18240,
- SPELL_FLAMES = 39199,
+ SPELL_FLAMES = 39199
};
class spell_q9874_liquid_fire : public SpellScriptLoader
@@ -926,7 +926,7 @@ class spell_q9874_liquid_fire : public SpellScriptLoader
{
Player* caster = GetCaster()->ToPlayer();
if (Creature* target = GetHitCreature())
- if (target && target->HasAura(SPELL_FLAMES))
+ if (target && !target->HasAura(SPELL_FLAMES))
{
caster->KilledMonsterCredit(NPC_VILLAGER_KILL_CREDIT, 0);
target->CastSpell(target, SPELL_FLAMES, true);
diff --git a/src/server/scripts/Spells/spell_rogue.cpp b/src/server/scripts/Spells/spell_rogue.cpp
index 7768ad7596c..57c99a7d1e5 100644
--- a/src/server/scripts/Spells/spell_rogue.cpp
+++ b/src/server/scripts/Spells/spell_rogue.cpp
@@ -586,8 +586,8 @@ class spell_rog_preparation : public SpellScriptLoader
SpellCooldowns const& cm = caster->GetSpellCooldownMap();
for (SpellCooldowns::const_iterator itr = cm.begin(); itr != cm.end();)
{
- SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first);
- if (!spellInfo || spellInfo->SpellFamilyName != SPELLFAMILY_ROGUE)
+ SpellInfo const* spellInfo = sSpellMgr->EnsureSpellInfo(itr->first);
+ if (spellInfo->SpellFamilyName != SPELLFAMILY_ROGUE)
{
++itr;
continue;
diff --git a/src/server/scripts/Spells/spell_warlock.cpp b/src/server/scripts/Spells/spell_warlock.cpp
index 9a374764949..a467124bf50 100644
--- a/src/server/scripts/Spells/spell_warlock.cpp
+++ b/src/server/scripts/Spells/spell_warlock.cpp
@@ -333,7 +333,7 @@ class spell_warl_demonic_circle_summon : public SpellScriptLoader
// WARLOCK_DEMONIC_CIRCLE_ALLOW_CAST; allowing him to cast the WARLOCK_DEMONIC_CIRCLE_TELEPORT.
// If not in range remove the WARLOCK_DEMONIC_CIRCLE_ALLOW_CAST.
- SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(SPELL_WARLOCK_DEMONIC_CIRCLE_TELEPORT);
+ SpellInfo const* spellInfo = sSpellMgr->EnsureSpellInfo(SPELL_WARLOCK_DEMONIC_CIRCLE_TELEPORT);
if (GetTarget()->IsWithinDist(circle, spellInfo->GetMaxRange(true)))
{
@@ -485,6 +485,7 @@ class spell_warl_demonic_empowerment : public SpellScriptLoader
if (targetCreature->IsPet())
{
CreatureTemplate const* ci = sObjectMgr->GetCreatureTemplate(targetCreature->GetEntry());
+ ASSERT(ci);
switch (ci->family)
{
case CREATURE_FAMILY_SUCCUBUS:
@@ -492,7 +493,7 @@ class spell_warl_demonic_empowerment : public SpellScriptLoader
break;
case CREATURE_FAMILY_VOIDWALKER:
{
- SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(SPELL_WARLOCK_DEMONIC_EMPOWERMENT_VOIDWALKER);
+ SpellInfo const* spellInfo = sSpellMgr->EnsureSpellInfo(SPELL_WARLOCK_DEMONIC_EMPOWERMENT_VOIDWALKER);
int32 hp = int32(targetCreature->CountPctFromMaxHealth(GetCaster()->CalculateSpellDamage(targetCreature, spellInfo, 0)));
targetCreature->CastCustomSpell(targetCreature, SPELL_WARLOCK_DEMONIC_EMPOWERMENT_VOIDWALKER, &hp, NULL, NULL, true);
break;
diff --git a/src/server/scripts/Spells/spell_warrior.cpp b/src/server/scripts/Spells/spell_warrior.cpp
index 3a8af5f0e17..c85c663ab57 100644
--- a/src/server/scripts/Spells/spell_warrior.cpp
+++ b/src/server/scripts/Spells/spell_warrior.cpp
@@ -247,7 +247,7 @@ class spell_warr_deep_wounds : public SpellScriptLoader
damage = target->SpellDamageBonusTaken(caster, GetSpellInfo(), damage, SPELL_DIRECT_DAMAGE);
- SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(SPELL_WARRIOR_DEEP_WOUNDS_RANK_PERIODIC);
+ SpellInfo const* spellInfo = sSpellMgr->EnsureSpellInfo(SPELL_WARRIOR_DEEP_WOUNDS_RANK_PERIODIC);
uint32 ticks = spellInfo->GetDuration() / spellInfo->Effects[EFFECT_0].Amplitude;
// Add remaining ticks to damage done