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:
offl
2021-04-13 10:38:17 +03:00
committed by GitHub
parent fe41744c7a
commit 8fa6f95d4b
2 changed files with 93 additions and 180 deletions

View File

@@ -0,0 +1,24 @@
-- https://youtu.be/1u2-TiUISDY?t=35
UPDATE `creature_template` SET `ScriptName` = "" WHERE `entry` = 12919;
DELETE FROM `gossip_menu` WHERE `MenuID` = 6445 AND `TextID` IN (7639,7640);
DELETE FROM `gossip_menu` WHERE `MenuID` IN (57023,57024);
INSERT INTO `gossip_menu` (`MenuID`,`TextID`) VALUES
(6445,7639),
(57023,7640),
(57024,7645);
DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId` = 14 AND `SourceGroup` = 6445;
INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`SourceId`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionTarget`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`NegativeCondition`,`ErrorType`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES
(14,6445,7638,0,0,8,0,8227,0,0,1,0,0,"","Group 0: Show gossip text 7638 if quest 'Nat's Measuring Tape' is not rewarded"),
(14,6445,7639,0,0,8,0,8227,0,0,0,0,0,"","Group 0: Show gossip text 7639 if quest 'Nat's Measuring Tape' is rewarded");
DELETE FROM `gossip_menu_option` WHERE `MenuID` IN (6445,57023);
INSERT INTO `gossip_menu_option` (`MenuID`,`OptionID`,`OptionIcon`,`OptionText`,`OptionBroadcastTextID`,`OptionType`,`OptionNpcFlag`,`ActionMenuID`,`ActionPoiID`,`BoxCoded`,`BoxMoney`,`BoxText`,`BoxBroadcastTextID`,`VerifiedBuild`) VALUES
(6445,0,0,"I want to catch Gahz'ranka! Tell me how!",10490,1,1,57023,0,0,0,"",0,0),
(57023,0,1,"Nat, I want to buy your mudskunk lures!",10492,3,128,0,0,0,0,"",0,0),
(57023,1,0,"How do I catch the mudskunks for your lure?",10500,1,1,57024,0,0,0,"",0,0);
DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId` = 15 AND `SourceGroup` = 6445;
INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`SourceId`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionTarget`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`NegativeCondition`,`ErrorType`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES
(15,6445,0,0,0,8,0,8227,0,0,0,0,0,"","Group 0: Show Gossip Option 0 if quest 'Nat's Measuring Tape' is rewarded");

View File

@@ -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);
}