mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-20 01:15:35 +01:00
Scripts/Zone: Update Dustwallow Marsh zone file (#26368)
* Scripts/Zone: Update Dustwallow Marsh zone file * Do you want SpellInfo back? Co-authored-by: offl <offl@users.noreply.github.com>
This commit is contained in:
@@ -15,215 +15,104 @@
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* ScriptData
|
||||
SDName: Dustwallow_Marsh
|
||||
SD%Complete: 95
|
||||
SDComment: Quest support: 558, 11126, 11142, 11174, Vendor Nat Pagle
|
||||
SDCategory: Dustwallow Marsh
|
||||
EndScriptData */
|
||||
|
||||
/* ContentData
|
||||
npc_nat_pagle
|
||||
npc_cassa_crimsonwing - handled by npc_taxi
|
||||
EndContentData */
|
||||
|
||||
#include "ScriptMgr.h"
|
||||
#include "MotionMaster.h"
|
||||
#include "Player.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_CHANNEL_CREDIT = 42486
|
||||
};
|
||||
|
||||
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
|
||||
SpellCastResult CheckRequirement()
|
||||
{
|
||||
npc_nat_pagleAI(Creature* creature) : ScriptedAI(creature) { }
|
||||
if (!GetCaster()->HasAura(GetSpellInfo()->Effects[EFFECT_1].CalcValue()))
|
||||
return SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW; // This is actually correct
|
||||
|
||||
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());
|
||||
if (!GetExplTargetUnit())
|
||||
return SPELL_FAILED_BAD_TARGETS;
|
||||
|
||||
return true;
|
||||
}
|
||||
return SPELL_CAST_OK;
|
||||
}
|
||||
|
||||
bool OnGossipHello(Player* player) override
|
||||
{
|
||||
if (me->IsQuestGiver())
|
||||
player->PrepareQuestMenu(me->GetGUID());
|
||||
|
||||
if (me->IsVendor() && player->GetQuestRewardStatus(QUEST_NATS_MEASURING_TAPE))
|
||||
{
|
||||
AddGossipItemFor(player, GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE);
|
||||
SendGossipMenuFor(player, 7640, me->GetGUID());
|
||||
}
|
||||
else
|
||||
SendGossipMenuFor(player, 7638, me->GetGUID());
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
CreatureAI* GetAI(Creature* creature) const override
|
||||
void HandleDummy(SpellEffIndex effIndex)
|
||||
{
|
||||
return new npc_nat_pagleAI(creature);
|
||||
PreventHitDefaultEffect(effIndex);
|
||||
if (GetHitUnit())
|
||||
GetCaster()->CastSpell(GetHitUnit(), uint32(GetEffectValue()), true);
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
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);
|
||||
|
||||
bool Validate(SpellInfo const* /*spellInfo*/) override
|
||||
{
|
||||
return ValidateSpellInfo({ SPELL_OOZE_CHANNEL_CREDIT });
|
||||
}
|
||||
|
||||
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 : public SpellScriptLoader
|
||||
// 42492 - Cast Energized
|
||||
class spell_energize_aoe : public SpellScript
|
||||
{
|
||||
public:
|
||||
spell_ooze_zap() : SpellScriptLoader("spell_ooze_zap") { }
|
||||
PrepareSpellScript(spell_energize_aoe);
|
||||
|
||||
class spell_ooze_zap_SpellScript : public SpellScript
|
||||
void FilterTargets(std::list<WorldObject*>& targets)
|
||||
{
|
||||
for (std::list<WorldObject*>::iterator itr = targets.begin(); itr != targets.end();)
|
||||
{
|
||||
PrepareSpellScript(spell_ooze_zap_SpellScript);
|
||||
|
||||
bool Validate(SpellInfo const* /*spellInfo*/) override
|
||||
{
|
||||
return ValidateSpellInfo({ SPELL_OOZE_ZAP });
|
||||
}
|
||||
|
||||
SpellCastResult CheckRequirement()
|
||||
{
|
||||
if (!GetCaster()->HasAura(GetSpellInfo()->Effects[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();
|
||||
if ((*itr)->GetTypeId() == TYPEID_PLAYER && (*itr)->ToPlayer()->GetQuestStatus(GetSpellInfo()->Effects[EFFECT_1].CalcValue()) == QUEST_STATUS_INCOMPLETE)
|
||||
++itr;
|
||||
else
|
||||
targets.erase(itr++);
|
||||
}
|
||||
};
|
||||
targets.push_back(GetCaster());
|
||||
}
|
||||
|
||||
class spell_ooze_zap_channel_end : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_ooze_zap_channel_end() : SpellScriptLoader("spell_ooze_zap_channel_end") { }
|
||||
void HandleScript(SpellEffIndex effIndex)
|
||||
{
|
||||
PreventHitDefaultEffect(effIndex);
|
||||
GetCaster()->CastSpell(GetCaster(), uint32(GetEffectValue()), true);
|
||||
}
|
||||
|
||||
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
|
||||
{
|
||||
return new spell_ooze_zap_channel_end_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
class spell_energize_aoe : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_energize_aoe() : SpellScriptLoader("spell_energize_aoe") { }
|
||||
|
||||
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(GetSpellInfo()->Effects[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 npc_nat_pagle();
|
||||
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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user