Scripts/Dragonblight: Fix quest Strengthen the Ancients - Closes #2043

This commit is contained in:
Nay
2012-06-01 23:03:57 +01:00
parent f89ef6da5b
commit d75ea8837b
2 changed files with 140 additions and 0 deletions

View File

@@ -0,0 +1,41 @@
-- Creature addon
DELETE FROM `creature_template_addon` WHERE `entry` IN (26421,26321,26333);
INSERT INTO `creature_template_addon` (`entry`,`mount`,`bytes1`,`bytes2`,`emote`,`auras`) VALUES
(26421,0,0,1,0, NULL), -- Woodlands Walker
(26321,0,0,1,64, '47044'), -- Lothalor Ancient (Cosmetic - Confused State Visual (Big))
(26333,0,0,1,0, '32566 46967'); -- Corrupted Lothalor Ancient (Purple Banish State, Purple Banish State - Breath)
-- Woodlands Walker already has spellclick spell: 47575 (Strengthen the Ancients: On Interact Dummy to Woodlands Walker)
-- Monster emotes
DELETE FROM `creature_text` WHERE `entry` IN (26421,26321);
INSERT INTO `creature_text` (`entry`, `groupid`, `id`, `text`, `type`, `language`, `probability`, `emote`, `duration`, `sound`, `comment`) VALUES
(26421, 0, 0, 'Breaking off a piece of its bark, the %s hands it to you before departing.', 16, 0, 100, 0, 0, 0, 'Woodlands Walker'),
(26421, 1, 0, 'The %s is angered by your request and attacks!', 16, 0, 100, 0, 0, 0, 'Woodlands Walker'),
(26321, 0, 0, 'The %s gives you its thanks.', 16, 0, 100, 0, 0, 1525, 'Lothalor Ancient');
-- Assign scripts to spells
DELETE FROM `spell_script_names` WHERE `spell_id` IN (47575,47530);
INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES
(47575, 'spell_q12096_q12092_dummy'),
(47530, 'spell_q12096_q12092_bark');
/*
- player spellclicks Woodlands Walker, casts 47575 on the tree Woodlands Walker: two outcomes:
- - tree turns enemy:
* say The %s is angered by your request and attacks!
* change faction to 14
* start attack
- - tree stays friendly:
* cast 47550 (Create Bark of the Walkers)on player
* say Breaking off a piece of its bark, the %s hands it to you before departing.
* despawn
- player uses item on Lothalor Ancient (47530 (Bark of the Walkers)):
* tree says The %s gives you its thanks.
* aura 47044 (Cosmetic - Confused State Visual (Big)) is removed
* despawns after 4 secs
*/

View File

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