Scripts/Sholazar: Fix quest Kick, What Kick? - Closes #370

This commit is contained in:
Nay
2012-06-01 19:48:43 +01:00
parent 8cc19196a6
commit 925657cc98
2 changed files with 192 additions and 0 deletions

View File

@@ -0,0 +1,70 @@
/* Quest: Kick, What Kick? - 12589 by Nay */
-- Lucky Wilhelm: 0xF150006D960041CB
-- Drostan: 0xF130006EA80041CA
-- Apple: 0xF130006D950041C8
-- Remove old conditions, now done in cpp
DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=17 AND `SourceEntry`=51330;
-- Spells conditions
DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=13 AND `SourceEntry` IN (51331,51332,51366);
INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES
(13, 1, 51331, 0, 0, 31, 0, 3, 28053, 0, 0, 0, '', 'Hit Apple - Apple - Q: Kick, What Kick?'),
(13, 1, 51332, 0, 0, 31, 0, 3, 28054, 0, 0, 0, '', 'Miss Apple - Wilhelm - Q: Kick, What Kick?'),
(13, 1, 51366, 0, 0, 31, 0, 3, 28093, 0, 0, 0, '', 'Miss Apple, Hit Bird - Sholazar Tickbird - Q: Kick, What Kick?');
-- Assign script to spell
DELETE FROM `spell_script_names` WHERE `spell_id`=51330;
INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES
(51330, 'spell_q12589_shoot_rjr');
-- Spellclick spell for Wilhelm
DELETE FROM `npc_spellclick_spells` WHERE `npc_entry`=28054;
INSERT INTO `npc_spellclick_spells` (`npc_entry`,`spell_id`,`cast_flags`,`user_type`) VALUES
(28054,50556,1,0);
-- Addon data
DELETE FROM `creature_template_addon` WHERE `entry` IN (28053,28328,30737,28346);
INSERT INTO `creature_template_addon` (`entry`,`mount`,`bytes1`,`bytes2`,`emote`,`auras`) VALUES
(28053,0,0,1,0, NULL), -- Apple
(28328,0,0,257,0, NULL), -- Drostan
(30737,0,0,256,0, NULL), -- Nesingwary Game Warden
(28346,0,0,1,0, NULL); -- Crunchy
-- Put Apple in Wilhelm's head
DELETE FROM `vehicle_template_accessory` WHERE `entry`=28054 AND `accessory_entry`=28053;
INSERT INTO `vehicle_template_accessory` (`entry`,`accessory_entry`, `seat_id`, `minion`, `description`, `summontype`, `summontimer`) VALUES
(28054, 28053, -1, 0, 'Lucky Wilhelm - Apple', 6, 10000);
-- Says and yells
DELETE FROM `creature_text` WHERE `entry`=28328 OR (`entry`=28054 AND `groupid` IN (0,1));
INSERT INTO `creature_text` (`entry`, `groupid`, `id`, `text`, `type`, `language`, `probability`, `emote`, `duration`, `sound`, `comment`) VALUES
(28328, 0, 0, 'The only thing hurt is your pride, lad. Buck up!', 12, 0, 100, 11, 0, 0, 'Drostan to Lucky Wilhelm'),
(28328, 0, 1, 'Stop whining. You''ve still got your luck.', 12, 0, 100, 11, 0, 0, 'Drostan to Lucky Wilhelm'),
(28328, 0, 2, 'Bah, it''s an improvement.', 12, 0, 100, 0, 0, 0, 'Drostan to Lucky Wilhelm'),
(28328, 0, 3, 'Calm down lad, it''s just a birdshot!', 12, 0, 100, 0, 0, 0, 'Drostan to Lucky Wilhelm'),
(28054, 0, 0, 'Not the ''stache! Now I''m asymmetrical!', 12, 0, 100, 5, 0, 0, 'Lucky Wilhelm'),
(28054, 0, 1, 'Ouch! That''s it, I quit the target business!', 12, 0, 100, 0, 0, 0, 'Lucky Wilhelm'),
(28054, 0, 2, 'My ear! You grazed my ear!', 12, 0, 100, 0, 0, 0, 'Lucky Wilhelm'),
(28054, 1, 0, 'Good shot!', 12, 0, 100, 4, 0, 0, 'Lucky Wilhelm');
/* * Hit: */
/* player casts Shoot RJR on Lucky */
/* apple gets hit by 51331 (Hit Apple) by player */
/* after that apple casts 51371 (Apple Falls to ground) on self */
/* Wilhelm says Good shot! */
/* reward killcredit 28053 */
/* * Miss: */
/* player casts Shoot RJR on Lucky */
/* lucky gets hit by 51332 (Miss Apple) by player */
/* lucky says random text */
/* drostan says random text */
/* * Miss, Hit Bird - guessed */
/* player casts Shoot RJR on Lucky */
/* bird gets hit by 51366 (Miss Apple, Hit Bird and dies) */
/* bird gets hit by 51369 (Tickbird Signal to Fall) */
/* lucky says random text */
/* drostan says random text */

View File

@@ -746,6 +746,127 @@ public:
}
};
/*######
## Quest Kick, What Kick? (12589)
######*/
enum KickWhatKick
{
NPC_LUCKY_WILHELM = 28054,
NPC_APPLE = 28053,
NPC_DROSTAN = 28328,
NPC_CRUNCHY = 28346,
NPC_THICKBIRD = 28093,
SPELL_HIT_APPLE = 51331,
SPELL_MISS_APPLE = 51332,
SPELL_MISS_BIRD_APPLE = 51366,
SPELL_APPLE_FALL = 51371,
SPELL_BIRD_FALL = 51369,
EVENT_MISS = 0,
EVENT_HIT = 1,
EVENT_MISS_BIRD = 2,
SAY_WILHELM_MISS = 0,
SAY_WILHELM_HIT = 1,
SAY_DROSTAN_REPLY_MISS = 0,
};
class spell_q12589_shoot_rjr : public SpellScriptLoader
{
public:
spell_q12589_shoot_rjr() : SpellScriptLoader("spell_q12589_shoot_rjr") { }
class spell_q12589_shoot_rjr_SpellScript : public SpellScript
{
PrepareSpellScript(spell_q12589_shoot_rjr_SpellScript);
SpellCastResult CheckCast()
{
if (Unit* target = GetExplTargetUnit())
if (target->GetEntry() == NPC_LUCKY_WILHELM)
return SPELL_CAST_OK;
SetCustomCastResultMessage(SPELL_CUSTOM_ERROR_MUST_TARGET_WILHELM);
return SPELL_FAILED_CUSTOM_ERROR;
}
void HandleDummy(SpellEffIndex /*effIndex*/)
{
uint32 roll = urand(1, 100);
uint8 ev;
if (roll <= 50)
ev = EVENT_MISS;
else if (roll <= 83)
ev = EVENT_HIT;
else
ev = EVENT_MISS_BIRD;
Unit* shooter = GetCaster();
Creature* wilhelm = GetHitUnit()->ToCreature();
Creature* apple = shooter->FindNearestCreature(NPC_APPLE, 30);
Creature* bird = shooter->FindNearestCreature(NPC_THICKBIRD, 30);
Creature* drostan = shooter->FindNearestCreature(NPC_DROSTAN, 30);
Creature* crunchy = shooter->FindNearestCreature(NPC_CRUNCHY, 30);
if (!wilhelm || !apple || !drostan)
return;
switch (ev)
{
case EVENT_MISS_BIRD:
{
if (!bird || !crunchy)
; // fall to EVENT_MISS
else
{
shooter->CastSpell(bird, SPELL_MISS_BIRD_APPLE);
shooter->CastSpell(bird, SPELL_BIRD_FALL);
wilhelm->AI()->Talk(SAY_WILHELM_MISS);
drostan->AI()->Talk(SAY_DROSTAN_REPLY_MISS);
bird->Kill(bird);
crunchy->GetMotionMaster()->MovePoint(0, bird->GetPositionX(), bird->GetPositionY(),
bird->GetMap()->GetWaterOrGroundLevel(bird->GetPositionX(), bird->GetPositionY(), bird->GetPositionZ()));
// TODO: Make crunchy perform emote eat when he reaches the bird
}
}
case EVENT_MISS:
{
shooter->CastSpell(wilhelm, SPELL_MISS_APPLE);
wilhelm->AI()->Talk(SAY_WILHELM_MISS);
drostan->AI()->Talk(SAY_DROSTAN_REPLY_MISS);
break;
}
case EVENT_HIT:
{
shooter->CastSpell(apple, SPELL_HIT_APPLE);
apple->CastSpell(apple, SPELL_APPLE_FALL);
wilhelm->AI()->Talk(SAY_WILHELM_HIT);
if (Player* player = shooter->ToPlayer())
player->KilledMonsterCredit(NPC_APPLE, 0);
apple->DespawnOrUnsummon();
break;
}
}
}
void Register()
{
OnCheckCast += SpellCheckCastFn(spell_q12589_shoot_rjr_SpellScript::CheckCast);
OnEffectHitTarget += SpellEffectFn(spell_q12589_shoot_rjr_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
SpellScript* GetSpellScript() const
{
return new spell_q12589_shoot_rjr_SpellScript();
}
};
void AddSC_sholazar_basin()
{
new npc_injured_rainspeaker_oracle();
@@ -756,4 +877,5 @@ void AddSC_sholazar_basin()
new npc_adventurous_dwarf();
new npc_jungle_punch_target();
new spell_q12620_the_lifewarden_wrath();
new spell_q12589_shoot_rjr();
}