diff options
| author | et65 <et65@ashbringer.fr> | 2014-12-28 19:50:19 +0100 |
|---|---|---|
| committer | et65 <et65@ashbringer.fr> | 2014-12-28 19:50:19 +0100 |
| commit | e46921748d9173f0dcaa32f8a53626c21cf4a2a2 (patch) | |
| tree | e9467c092c4c9189b34ac10e95bc684c7d77ce3e /src/server/scripts/Spells | |
| parent | 4f557347ce26dcb3d7ce697ecd203ff92da5198a (diff) | |
| parent | 27137ca06e99209bd1a47a0ff7082ff14fcae8c9 (diff) | |
Merge remote-tracking branch 'trinitycore/6.x' into 6.x
Diffstat (limited to 'src/server/scripts/Spells')
| -rw-r--r-- | src/server/scripts/Spells/spell_mage.cpp | 69 | ||||
| -rw-r--r-- | src/server/scripts/Spells/spell_quest.cpp | 28 |
2 files changed, 91 insertions, 6 deletions
diff --git a/src/server/scripts/Spells/spell_mage.cpp b/src/server/scripts/Spells/spell_mage.cpp index baf7ff48cb5..fc8ba0ffad0 100644 --- a/src/server/scripts/Spells/spell_mage.cpp +++ b/src/server/scripts/Spells/spell_mage.cpp @@ -392,7 +392,7 @@ class spell_mage_cone_of_cold : public SpellScriptLoader }; // 42955 Conjure Refreshment -/// Updated 4.3.4 +/// Updated 6.0.3 struct ConjureRefreshmentData { uint32 minLevel; @@ -400,7 +400,7 @@ struct ConjureRefreshmentData uint32 spellId; }; -uint8 const MAX_CONJURE_REFRESHMENT_SPELLS = 7; +uint8 const MAX_CONJURE_REFRESHMENT_SPELLS = 9; ConjureRefreshmentData const _conjureData[MAX_CONJURE_REFRESHMENT_SPELLS] = { { 33, 43, 92739 }, @@ -409,7 +409,9 @@ ConjureRefreshmentData const _conjureData[MAX_CONJURE_REFRESHMENT_SPELLS] = { 64, 73, 92805 }, { 74, 79, 74625 }, { 80, 84, 92822 }, - { 85, 85, 92727 } + { 85, 89, 92727 }, + { 90, 99, 116130 }, + { 100, 100, 167143 } }; // 42955 - Conjure Refreshment @@ -462,6 +464,66 @@ class spell_mage_conjure_refreshment : public SpellScriptLoader } }; +uint8 const MAX_CONJURE_REFRESHMENT_TABLE_SPELLS = 5; +ConjureRefreshmentData const _conjureTableData[MAX_CONJURE_REFRESHMENT_TABLE_SPELLS] = +{ + { 73, 79, 120056 }, + { 80, 84, 120055 }, + { 85, 89, 120054 }, + { 90, 99, 120053 }, + { 100, 100, 167145 } +}; + +// 43987 - Conjure Refreshment Table +class spell_mage_conjure_refreshment_table : public SpellScriptLoader +{ +public: + spell_mage_conjure_refreshment_table() : SpellScriptLoader("spell_mage_conjure_refreshment_table") { } + + class spell_mage_conjure_refreshment_table_SpellScript : public SpellScript + { + PrepareSpellScript(spell_mage_conjure_refreshment_table_SpellScript); + + bool Validate(SpellInfo const* /*spellInfo*/) override + { + for (uint8 i = 0; i < MAX_CONJURE_REFRESHMENT_TABLE_SPELLS; ++i) + if (!sSpellMgr->GetSpellInfo(_conjureTableData[i].spellId)) + return false; + return true; + } + + bool Load() override + { + if (GetCaster()->GetTypeId() != TYPEID_PLAYER) + return false; + return true; + } + + void HandleDummy(SpellEffIndex /*effIndex*/) + { + uint8 level = GetHitUnit()->getLevel(); + for (uint8 i = 0; i < MAX_CONJURE_REFRESHMENT_TABLE_SPELLS; ++i) + { + ConjureRefreshmentData const& spellData = _conjureTableData[i]; + if (level < spellData.minLevel || level > spellData.maxLevel) + continue; + GetHitUnit()->CastSpell(GetHitUnit(), spellData.spellId); + break; + } + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_mage_conjure_refreshment_table_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; + + SpellScript* GetSpellScript() const override + { + return new spell_mage_conjure_refreshment_table_SpellScript(); + } +}; + // 543 - Fire War class spell_mage_fire_frost_ward : public SpellScriptLoader { @@ -1468,6 +1530,7 @@ void AddSC_mage_spell_scripts() new spell_mage_cold_snap(); new spell_mage_cone_of_cold(); new spell_mage_conjure_refreshment(); + new spell_mage_conjure_refreshment_table(); new spell_mage_fire_frost_ward(); new spell_mage_focus_magic(); new spell_mage_frostbolt(); diff --git a/src/server/scripts/Spells/spell_quest.cpp b/src/server/scripts/Spells/spell_quest.cpp index e9cf81f2e64..434a8f75693 100644 --- a/src/server/scripts/Spells/spell_quest.cpp +++ b/src/server/scripts/Spells/spell_quest.cpp @@ -1076,9 +1076,12 @@ class spell_q14112_14145_chum_the_water: public SpellScriptLoader // http://old01.wowhead.com/quest=9452 - Red Snapper - Very Tasty! enum RedSnapperVeryTasty { - SPELL_CAST_NET = 29866, - ITEM_RED_SNAPPER = 23614, - SPELL_NEW_SUMMON_TEST = 49214, + ITEM_RED_SNAPPER = 23614, + + SPELL_CAST_NET = 29866, + SPELL_NEW_SUMMON_TEST = 49214, + + GO_SCHOOL_OF_RED_SNAPPER = 181616 }; class spell_q9452_cast_net: public SpellScriptLoader @@ -1095,6 +1098,15 @@ class spell_q9452_cast_net: public SpellScriptLoader return GetCaster()->GetTypeId() == TYPEID_PLAYER; } + SpellCastResult CheckCast() + { + GameObject* go = GetCaster()->FindNearestGameObject(GO_SCHOOL_OF_RED_SNAPPER, 3.0f); + if (!go || go->GetRespawnTime()) + return SPELL_FAILED_REQUIRES_SPELL_FOCUS; + + return SPELL_CAST_OK; + } + void HandleDummy(SpellEffIndex /*effIndex*/) { Player* caster = GetCaster()->ToPlayer(); @@ -1104,9 +1116,19 @@ class spell_q9452_cast_net: public SpellScriptLoader caster->CastSpell(caster, SPELL_NEW_SUMMON_TEST, true); } + void HandleActiveObject(SpellEffIndex effIndex) + { + PreventHitDefaultEffect(effIndex); + GetHitGObj()->SetRespawnTime(roll_chance_i(50) ? 2 * MINUTE : 3 * MINUTE); + GetHitGObj()->Use(GetCaster()); + GetHitGObj()->SetLootState(GO_JUST_DEACTIVATED); + } + void Register() override { + OnCheckCast += SpellCheckCastFn(spell_q9452_cast_net_SpellScript::CheckCast); OnEffectHit += SpellEffectFn(spell_q9452_cast_net_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + OnEffectHitTarget += SpellEffectFn(spell_q9452_cast_net_SpellScript::HandleActiveObject, EFFECT_1, SPELL_EFFECT_ACTIVATE_OBJECT); } }; |
