aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/server/scripts/Kalimdor/zone_dustwallow_marsh.cpp250
1 files changed, 77 insertions, 173 deletions
diff --git a/src/server/scripts/Kalimdor/zone_dustwallow_marsh.cpp b/src/server/scripts/Kalimdor/zone_dustwallow_marsh.cpp
index 716f78300b9..5be9f6502cb 100644
--- a/src/server/scripts/Kalimdor/zone_dustwallow_marsh.cpp
+++ b/src/server/scripts/Kalimdor/zone_dustwallow_marsh.cpp
@@ -15,212 +15,116 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-/* ScriptData
-SDName: Dustwallow_Marsh
-SD%Complete: 95
-SDComment: Quest support: 1270, 1222, 27245
-SDCategory: Dustwallow Marsh
-EndScriptData */
-
-/* ContentData
-EndContentData */
-
#include "ScriptMgr.h"
#include "Player.h"
-#include "QuestDef.h"
-#include "ScriptedCreature.h"
-#include "ScriptedGossip.h"
#include "SpellInfo.h"
#include "SpellScript.h"
-#include "WorldSession.h"
-
-/*######
-## npc_nat_pagle
-######*/
-enum NatPagle
+enum OozeZap
{
- QUEST_NATS_MEASURING_TAPE = 8227
+ SPELL_OOZE_ZAP = 42489,
+ SPELL_OOZE_CHANNEL_CREDIT = 42486,
+ SPELL_ENERGIZED = 42492,
};
-class npc_nat_pagle : public CreatureScript
+// 42489 - Cast Ooze Zap When Energized
+class spell_ooze_zap : public SpellScript
{
-public:
- npc_nat_pagle() : CreatureScript("npc_nat_pagle") { }
+ PrepareSpellScript(spell_ooze_zap);
- struct npc_nat_pagleAI : public ScriptedAI
+ bool Validate(SpellInfo const* spellInfo) override
{
- npc_nat_pagleAI(Creature* creature) : ScriptedAI(creature) { }
+ return spellInfo->GetEffects().size() > EFFECT_1 && ValidateSpellInfo({ SPELL_OOZE_ZAP });
+ }
- bool OnGossipSelect(Player* player, uint32 /*menuId*/, uint32 gossipListId) override
- {
- uint32 const action = player->PlayerTalkClass->GetGossipOptionAction(gossipListId);
- ClearGossipMenuFor(player);
- if (action == GOSSIP_ACTION_TRADE)
- player->GetSession()->SendListInventory(me->GetGUID());
+ SpellCastResult CheckRequirement()
+ {
+ if (!GetCaster()->HasAura(GetEffectInfo(EFFECT_1).CalcValue()))
+ return SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW; // This is actually correct
- return true;
- }
+ if (!GetExplTargetUnit())
+ return SPELL_FAILED_BAD_TARGETS;
- bool OnGossipHello(Player* player) override
- {
- if (me->IsQuestGiver())
- player->PrepareQuestMenu(me->GetGUID());
-
- if (me->IsVendor() && player->GetQuestRewardStatus(QUEST_NATS_MEASURING_TAPE))
- {
- AddGossipItemFor(player, GossipOptionIcon::Vendor, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE);
- SendGossipMenuFor(player, 7640, me->GetGUID());
- }
- else
- SendGossipMenuFor(player, 7638, me->GetGUID());
+ return SPELL_CAST_OK;
+ }
- return true;
- }
- };
+ void HandleDummy(SpellEffIndex effIndex)
+ {
+ PreventHitDefaultEffect(effIndex);
+ if (GetHitUnit())
+ GetCaster()->CastSpell(GetHitUnit(), uint32(GetEffectValue()), true);
+ }
- CreatureAI* GetAI(Creature* creature) const override
+ void Register() override
{
- return new npc_nat_pagleAI(creature);
+ OnEffectHitTarget += SpellEffectFn(spell_ooze_zap::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
+ OnCheckCast += SpellCheckCastFn(spell_ooze_zap::CheckRequirement);
}
};
-enum SpellScripts
+// 42485 - End of Ooze Channel
+class spell_ooze_zap_channel_end : public SpellScript
{
- SPELL_OOZE_ZAP = 42489,
- SPELL_OOZE_ZAP_CHANNEL_END = 42485,
- SPELL_OOZE_CHANNEL_CREDIT = 42486,
- SPELL_ENERGIZED = 42492,
-};
+ PrepareSpellScript(spell_ooze_zap_channel_end);
-class spell_ooze_zap : public SpellScriptLoader
-{
- public:
- spell_ooze_zap() : SpellScriptLoader("spell_ooze_zap") { }
+ bool Validate(SpellInfo const* /*spellInfo*/) override
+ {
+ return ValidateSpellInfo({ SPELL_OOZE_CHANNEL_CREDIT });
+ }
- class spell_ooze_zap_SpellScript : public SpellScript
- {
- PrepareSpellScript(spell_ooze_zap_SpellScript);
-
- bool Validate(SpellInfo const* spellInfo) override
- {
- return spellInfo->GetEffects().size() > EFFECT_1 && ValidateSpellInfo({ SPELL_OOZE_ZAP });
- }
-
- SpellCastResult CheckRequirement()
- {
- if (!GetCaster()->HasAura(GetEffectInfo(EFFECT_1).CalcValue()))
- return SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW; // This is actually correct
-
- if (!GetExplTargetUnit())
- return SPELL_FAILED_BAD_TARGETS;
-
- return SPELL_CAST_OK;
- }
-
- void HandleDummy(SpellEffIndex effIndex)
- {
- PreventHitDefaultEffect(effIndex);
- if (GetHitUnit())
- GetCaster()->CastSpell(GetHitUnit(), uint32(GetEffectValue()), true);
- }
-
- void Register() override
- {
- OnEffectHitTarget += SpellEffectFn(spell_ooze_zap_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
- OnCheckCast += SpellCheckCastFn(spell_ooze_zap_SpellScript::CheckRequirement);
- }
- };
-
- SpellScript* GetSpellScript() const override
- {
- return new spell_ooze_zap_SpellScript();
- }
+ void HandleDummy(SpellEffIndex effIndex)
+ {
+ PreventHitDefaultEffect(effIndex);
+ if (Player* player = GetCaster()->ToPlayer())
+ player->CastSpell(player, SPELL_OOZE_CHANNEL_CREDIT, true);
+ GetHitUnit()->KillSelf();
+ }
+
+ void Register() override
+ {
+ OnEffectHitTarget += SpellEffectFn(spell_ooze_zap_channel_end::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
+ }
};
-class spell_ooze_zap_channel_end : public SpellScriptLoader
+// 42492 - Cast Energized
+class spell_energize_aoe : public SpellScript
{
- public:
- spell_ooze_zap_channel_end() : SpellScriptLoader("spell_ooze_zap_channel_end") { }
+ PrepareSpellScript(spell_energize_aoe);
- class spell_ooze_zap_channel_end_SpellScript : public SpellScript
- {
- PrepareSpellScript(spell_ooze_zap_channel_end_SpellScript);
-
- bool Validate(SpellInfo const* /*spellInfo*/) override
- {
- return ValidateSpellInfo({ SPELL_OOZE_ZAP_CHANNEL_END });
- }
-
- void HandleDummy(SpellEffIndex effIndex)
- {
- PreventHitDefaultEffect(effIndex);
- if (Player* player = GetCaster()->ToPlayer())
- player->CastSpell(player, SPELL_OOZE_CHANNEL_CREDIT, true);
- GetHitUnit()->KillSelf();
- }
-
- void Register() override
- {
- OnEffectHitTarget += SpellEffectFn(spell_ooze_zap_channel_end_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
- }
- };
-
- SpellScript* GetSpellScript() const override
+ bool Validate(SpellInfo const* /*spellInfo*/) override
+ {
+ return ValidateSpellInfo({ SPELL_ENERGIZED });
+ }
+
+ void FilterTargets(std::list<WorldObject*>& targets)
+ {
+ for (std::list<WorldObject*>::iterator itr = targets.begin(); itr != targets.end();)
{
- return new spell_ooze_zap_channel_end_SpellScript();
+ if ((*itr)->GetTypeId() == TYPEID_PLAYER && (*itr)->ToPlayer()->GetQuestStatus(GetEffectInfo(EFFECT_1).CalcValue()) == QUEST_STATUS_INCOMPLETE)
+ ++itr;
+ else
+ targets.erase(itr++);
}
-};
+ targets.push_back(GetCaster());
+ }
-class spell_energize_aoe : public SpellScriptLoader
-{
- public:
- spell_energize_aoe() : SpellScriptLoader("spell_energize_aoe") { }
+ void HandleScript(SpellEffIndex effIndex)
+ {
+ PreventHitDefaultEffect(effIndex);
+ GetCaster()->CastSpell(GetCaster(), uint32(GetEffectValue()), true);
+ }
- class spell_energize_aoe_SpellScript : public SpellScript
- {
- PrepareSpellScript(spell_energize_aoe_SpellScript);
-
- bool Validate(SpellInfo const* /*spellInfo*/) override
- {
- return ValidateSpellInfo({ SPELL_ENERGIZED });
- }
-
- void FilterTargets(std::list<WorldObject*>& targets)
- {
- for (std::list<WorldObject*>::iterator itr = targets.begin(); itr != targets.end();)
- {
- if ((*itr)->GetTypeId() == TYPEID_PLAYER && (*itr)->ToPlayer()->GetQuestStatus(GetEffectInfo(EFFECT_1).CalcValue()) == QUEST_STATUS_INCOMPLETE)
- ++itr;
- else
- targets.erase(itr++);
- }
- targets.push_back(GetCaster());
- }
-
- void HandleScript(SpellEffIndex effIndex)
- {
- PreventHitDefaultEffect(effIndex);
- GetCaster()->CastSpell(GetCaster(), uint32(GetEffectValue()), true);
- }
-
- void Register() override
- {
- OnEffectHitTarget += SpellEffectFn(spell_energize_aoe_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
- OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_energize_aoe_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENTRY);
- OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_energize_aoe_SpellScript::FilterTargets, EFFECT_1, TARGET_UNIT_SRC_AREA_ENTRY);
- }
- };
-
- SpellScript* GetSpellScript() const override
- {
- return new spell_energize_aoe_SpellScript();
- }
+ void Register() override
+ {
+ OnEffectHitTarget += SpellEffectFn(spell_energize_aoe::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
+ OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_energize_aoe::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENTRY);
+ OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_energize_aoe::FilterTargets, EFFECT_1, TARGET_UNIT_SRC_AREA_ENTRY);
+ }
};
void AddSC_dustwallow_marsh()
{
- new spell_ooze_zap();
- new spell_ooze_zap_channel_end();
- new spell_energize_aoe();
+ RegisterSpellScript(spell_ooze_zap);
+ RegisterSpellScript(spell_ooze_zap_channel_end);
+ RegisterSpellScript(spell_energize_aoe);
}