mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-02-13 21:49:49 +01:00
Scripts/Dragonblight: Fix quest Strengthen the Ancients - Closes #2043
This commit is contained in:
@@ -69,7 +69,106 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
/*######
|
||||
## Quest Strengthen the Ancients (12096|12092)
|
||||
######*/
|
||||
|
||||
enum StrengthenAncientsMisc
|
||||
{
|
||||
SAY_WALKER_FRIENDLY = 0,
|
||||
SAY_WALKER_ENEMY = 1,
|
||||
SAY_LOTHALOR = 0,
|
||||
|
||||
SPELL_CREATE_ITEM_BARK = 47550,
|
||||
SPELL_CONFUSED = 47044,
|
||||
|
||||
NPC_LOTHALOR = 26321,
|
||||
|
||||
FACTION_WALKER_ENEMY = 14,
|
||||
};
|
||||
|
||||
class spell_q12096_q12092_dummy : public SpellScriptLoader // Strengthen the Ancients: On Interact Dummy to Woodlands Walker
|
||||
{
|
||||
public:
|
||||
spell_q12096_q12092_dummy() : SpellScriptLoader("spell_q12096_q12092_dummy") { }
|
||||
|
||||
class spell_q12096_q12092_dummy_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_q12096_q12092_dummy_SpellScript);
|
||||
|
||||
void HandleDummy(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
uint32 roll = rand() % 2;
|
||||
|
||||
Creature* tree = GetHitCreature();
|
||||
Player* player = GetCaster()->ToPlayer();
|
||||
|
||||
if (!tree || !player)
|
||||
return;
|
||||
|
||||
tree->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK);
|
||||
|
||||
if (roll == 1) // friendly version
|
||||
{
|
||||
tree->CastSpell(player, SPELL_CREATE_ITEM_BARK);
|
||||
tree->AI()->Talk(SAY_WALKER_FRIENDLY, player->GetGUID());
|
||||
tree->DespawnOrUnsummon(1000);
|
||||
}
|
||||
else if (roll == 0) // enemy version
|
||||
{
|
||||
tree->AI()->Talk(SAY_WALKER_ENEMY, player->GetGUID());
|
||||
tree->setFaction(FACTION_WALKER_ENEMY);
|
||||
tree->Attack(player, true);
|
||||
}
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_q12096_q12092_dummy_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
return new spell_q12096_q12092_dummy_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
class spell_q12096_q12092_bark : public SpellScriptLoader // Bark of the Walkers
|
||||
{
|
||||
public:
|
||||
spell_q12096_q12092_bark() : SpellScriptLoader("spell_q12096_q12092_bark") { }
|
||||
|
||||
class spell_q12096_q12092_bark_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_q12096_q12092_bark_SpellScript);
|
||||
|
||||
void HandleDummy(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
Creature* lothalor = GetHitCreature();
|
||||
if (!lothalor || lothalor->GetEntry() != NPC_LOTHALOR)
|
||||
return;
|
||||
|
||||
lothalor->AI()->Talk(SAY_LOTHALOR);
|
||||
lothalor->RemoveAura(SPELL_CONFUSED);
|
||||
lothalor->DespawnOrUnsummon(4000);
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_q12096_q12092_bark_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
return new spell_q12096_q12092_bark_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_dragonblight()
|
||||
{
|
||||
new npc_alexstrasza_wr_gate;
|
||||
new spell_q12096_q12092_dummy;
|
||||
new spell_q12096_q12092_bark;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user