DB/Quest: With a little help from my friends

Closes #24639
This commit is contained in:
dr-j
2020-05-20 23:20:37 +02:00
committed by Killyana
parent cc5bea023a
commit e80b66fd52
2 changed files with 64 additions and 204 deletions

View File

@@ -0,0 +1,64 @@
--
UPDATE `creature_template` SET `AIName`='SmartAI', `ScriptName`='' WHERE `entry`=9999;
DELETE FROM `smart_scripts` WHERE `entryorguid`=9999 AND `source_type`=0;
DELETE FROM `smart_scripts` WHERE `entryorguid` IN (999900,999901,999902,999903) AND `source_type`=9;
INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `event_param5`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_param4`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES
(9999, 0, 0, 0, 19, 0, 100, 0, 4491, 0, 0, 0, 0, 80, 999902, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Ringo - On Quest Accept (A Little Help From My Friends) - Action list'),
(999902, 9, 0, 0, 0, 0, 100, 0, 0, 0, 0, 0, 0, 81, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Ringo - Action list - Set NPC Flags'),
(999902, 9, 1, 0, 0, 0, 100, 0, 0, 0, 0, 0, 0, 64, 1, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 'Ringo - Action list - Store Target List'),
(999902, 9, 2, 0, 0, 0, 100, 0, 0, 0, 0, 0, 0, 8, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Ringo - Action list - Set Reactstate Passive'),
(999902, 9, 3, 0, 0, 0, 100, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Ringo - Action list - Say Line 0'),
(999902, 9, 4, 0, 0, 0, 100, 0, 0, 0, 0, 0, 0, 29, 0, 0, 0, 0, 0, 0, 12, 1, 0, 0, 0, 0, 0, 0, 0, 'Ringo - Action list - Follow Invoker'),
(999902, 9, 5, 0, 0, 0, 100, 0, 0, 0, 0, 0, 0, 22, 2, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Ringo - Action list - Set event Phase 2'),
(999902, 9, 6, 0, 0, 0, 100, 0, 0, 0, 0, 0, 0, 2, 250, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Ringo - Action list - Set Faction'),
(999902, 9, 7, 0, 0, 0, 100, 0, 0, 0, 0, 0, 0, 91, 7, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Ringo - Action list - Set Bytes 1'),
(999902, 9, 8, 0, 0, 0, 100, 0, 4000, 4000, 0, 0, 0, 1, 7, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Ringo - Action list - Say Line 7'),
(9999, 0, 1, 2, 7, 0, 100, 0, 0, 0, 0, 0, 0, 22, 2, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Ringo - On Evade - Set event Phase 2'),
(9999, 0, 2, 0, 61, 0, 100, 0, 0, 0, 0, 0, 0, 91, 7, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Ringo - On Evade - Set Bytes 1'),
(9999, 0, 3, 0, 6, 0, 100, 0, 0, 0, 0, 0, 0, 6, 4491, 0, 0, 0, 0, 0, 12, 1, 0, 0, 0, 0, 0, 0, 0, 'Ringo - On Death - Fail Quest'),
(9999, 0, 4, 0, 1, 2, 100, 0, 30000, 60000, 60000, 90000, 0, 80, 999900, 2, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Ringo - OOC (event Phase 2) - Action list'),
(999900, 9, 0, 0, 0, 0, 100, 0, 0, 0, 0, 0, 0, 103, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Ringo - Action list - Set Root'),
(999900, 9, 1, 0, 0, 0, 100, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Ringo - Action list - Say Line 1'),
(999900, 9, 2, 0, 0, 0, 100, 0, 3000, 3000, 0, 0, 0, 90, 7, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Ringo - Action list - Set Bytes 1'),
(999900, 9, 3, 0, 0, 0, 100, 0, 0, 0, 0, 0, 0, 1, 5, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Ringo - Action list - Say Line 5'),
(999900, 9, 4, 0, 0, 0, 100, 0, 0, 0, 0, 0, 0, 101, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Ringo - Action list - Set home position'),
(999900, 9, 5, 0, 0, 0, 100, 0, 0, 0, 0, 0, 0, 22, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Ringo - Action list - Set event Phase 1'),
(999900, 9, 6, 0, 0, 0, 100, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Ringo - Action list - Set Reactstate Passive'),
(9999, 0, 5, 0, 8, 1, 100, 0, 15591, 0, 0, 0, 0, 80, 999901, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Ringo - On Spellhit (Revive Ringo) - Action list'),
(999901, 9, 0, 0, 0, 0, 100, 0, 0, 0, 0, 0, 0, 103, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Ringo - Action list - Turn Root Off'),
(999901, 9, 1, 0, 0, 0, 100, 0, 0, 0, 0, 0, 0, 91, 7, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Ringo - Action list - Set Bytes 1'),
(999901, 9, 2, 0, 0, 0, 100, 0, 0, 0, 0, 0, 0, 29, 0, 0, 0, 0, 0, 0, 12, 1, 0, 0, 0, 0, 0, 0, 0, 'Ringo -Action list - Follow Invoker'),
(999901, 9, 3, 0, 0, 0, 100, 0, 0, 0, 0, 0, 0, 1, 2, 0, 0, 0, 0, 0, 12, 1, 0, 0, 0, 0, 0, 0, 0, 'Ringo - Action list - Say Line 2'),
(999901, 9, 4, 0, 0, 0, 100, 0, 0, 0, 0, 0, 0, 22, 2, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Ringo - Action list - Set event Phase 2'),
(999901, 9, 5, 0, 0, 0, 100, 0, 0, 0, 0, 0, 0, 8, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Ringo - Action list - Set Reactstate Defensive'),
(9999, 0, 6, 0, 75, 2, 100, 1, 0, 9997, 5, 0, 0, 80, 999903, 2, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Ringo - On Spraggle within 10 yards - Set event Phase 1'),
(999903, 9, 0, 0, 0, 0, 100, 0, 0, 0, 0, 0, 0, 22, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Ringo - On Spraggle within 10 yards - Set event Phase 1'),
(999903, 9, 1, 0, 0, 0, 100, 0, 0, 0, 0, 0, 0, 103, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Ringo - On Spraggle within 10 yards - Root'),
(999903, 9, 2, 0, 0, 0, 100, 0, 0, 0, 0, 0, 0, 15, 4491, 0, 0, 0, 0, 0, 12, 1, 0, 0, 0, 0, 0, 0, 0, 'Ringo - On Spraggle within 10 yards - Call areaexploredoreventhappens'),
(999903, 9, 3, 0, 0, 0, 100, 0, 0, 0, 0, 0, 0, 48, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Ringo - On Spraggle within 10 yards - Set Active'),
(999903, 9, 4, 0, 0, 0, 100, 0, 0, 0, 0, 0, 0, 1, 3, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Ringo - Action list 2 - Say Line 3'),
(999903, 9, 5, 0, 0, 0, 100, 0, 3000, 3000, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 19, 9997, 0, 0, 0, 0, 0, 0, 0, 'Ringo - Action list 2 - Say Line 0 (Spraggle)'),
(999903, 9, 6, 0, 0, 0, 100, 0, 5000, 5000, 0, 0, 0, 1, 4, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Ringo - Action list 2 - Say Line 4'),
(999903, 9, 7, 0, 0, 0, 100, 0, 1000, 1000, 0, 0, 0, 1, 5, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Ringo - Action list 2 - Say Line 5'),
(999903, 9, 8, 0, 0, 0, 100, 0, 0, 0, 0, 0, 0, 90, 7, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Ringo - Action list 2 - Set Bytes 1'),
(999903, 9, 9, 0, 0, 0, 100, 0, 5000, 5000, 0, 0, 0, 1, 6, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Ringo - Action list 2 - Say Line 6'),
(999903, 9, 10, 0, 0, 0, 100, 0, 0, 0, 0, 0, 0, 91, 7, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Ringo - Action list 2 - Set Bytes 1'),
(999903, 9, 11, 0, 0, 0, 100, 0, 3000, 3000, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 19, 9997, 0, 0, 0, 0, 0, 0, 0, 'Ringo - Action list 2 - Say Line 1 (Spraggle)'),
(999903, 9, 12, 0, 0, 0, 100, 0, 15000, 15000, 0, 0, 0, 41, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Ringo - Action list 2 - Despawn');
DELETE FROM `creature_text` WHERE `CreatureID` = 9999;
INSERT INTO `creature_text` (`CreatureID`, `GroupID`, `ID`, `Text`, `Type`, `Language`, `Probability`, `Emote`, `Duration`, `Sound`, `BroadcastTextId`, `TextRange`, `comment`) VALUES
(9999, 0, 0, "Well, I'm not sure how far I'll make it in this state... I'm feeling kind of faint...", 12, 0, 100, 0, 0, 0, 5391, 0, "ringo SAY_RIN_START_1"),
(9999, 1, 0, "The heat... I can't take it...", 12, 0, 100, 0, 0, 0, 5396, 0, "ringo SAY_FAINT_1"),
(9999, 1, 1, "Maybe... you could carry me?", 12, 0, 100, 0, 0, 0, 5397, 0, "ringo SAY_FAINT_2"),
(9999, 1, 2, "Uuuuuuggggghhhhh....", 12, 0, 100, 0, 0, 0, 5394, 0, "ringo SAY_FAINT_3"),
(9999, 1, 3, "I'm not feeling so well...", 12, 0, 100, 0, 0, 0, 5395, 0, "ringo SAY_FAINT_4"),
(9999, 2, 0, "Where... where am I?", 12, 0, 100, 0, 0, 0, 5400, 0, "ringo SAY_WAKE_1"),
(9999, 2, 1, "I am feeling a little better now, thank you.", 12, 0, 100, 0, 0, 0, 5399, 0, "ringo SAY_WAKE_2"),
(9999, 2, 2, "Yes, I must go on.", 12, 0, 100, 0, 0, 0, 5398, 0, "ringo SAY_WAKE_3"),
(9999, 2, 3, "How am I feeling? Quite soaked, thank you.", 12, 0, 100, 0, 0, 0, 5401, 0, "ringo SAY_WAKE_4"),
(9999, 3, 0, "Spraggle! I didn't think I'd make it back!", 12, 0, 100, 0, 0, 0, 5402, 0, "ringo SAY_RIN_END_1"),
(9999, 4, 0, "Oh... I'm feeling faint...", 12, 0, 100, 0, 0, 0, 5403, 0, "ringo SAY_RIN_END_3"),
(9999, 5, 0, "%s faints and falls onto the ground.", 16, 0, 100, 0, 0, 0, 5393, 0, "ringo EMOTE_RIN_END_4"),
(9999, 6, 0, "Ugh.", 12, 0, 100, 0, 0, 0, 5404, 0, "ringo SAY_RIN_END_6"),
(9999, 7, 0, "If I look woozy, slap me. If I pass out, use the canteen. Now let's go!", 12, 0, 100, 0, 0, 0, 5392, 0, "ringo SAY_RIN_START_2");

View File

@@ -24,7 +24,6 @@ EndScriptData */
/* ContentData
npc_a-me
npc_ringo
EndContentData */
#include "ScriptMgr.h"
@@ -147,211 +146,8 @@ public:
}
};
/*####
# npc_ringo
####*/
enum Ringo
{
SAY_RIN_START = 0,
SAY_FAINT = 1,
SAY_WAKE = 2,
SAY_RIN_END_1 = 3,
SAY_SPR_END_2 = 0,
SAY_RIN_END_3 = 4,
EMOTE_RIN_END_4 = 5,
EMOTE_RIN_END_5 = 6,
SAY_RIN_END_6 = 7,
SAY_SPR_END_7 = 1,
EMOTE_RIN_END_8 = 8,
SPELL_REVIVE_RINGO = 15591,
QUEST_A_LITTLE_HELP = 4491,
NPC_SPRAGGLE = 9997
};
class npc_ringo : public CreatureScript
{
public:
npc_ringo() : CreatureScript("npc_ringo") { }
struct npc_ringoAI : public FollowerAI
{
npc_ringoAI(Creature* creature) : FollowerAI(creature)
{
Initialize();
}
void Initialize()
{
FaintTimer = urand(30000, 60000);
EndEventProgress = 0;
EndEventTimer = 1000;
SpraggleGUID.Clear();
}
uint32 FaintTimer;
uint32 EndEventProgress;
uint32 EndEventTimer;
ObjectGuid SpraggleGUID;
void Reset() override
{
Initialize();
}
void MoveInLineOfSight(Unit* who) override
{
FollowerAI::MoveInLineOfSight(who);
if (!me->GetVictim() && !HasFollowState(STATE_FOLLOW_COMPLETE) && who->GetEntry() == NPC_SPRAGGLE)
{
if (me->IsWithinDistInMap(who, INTERACTION_DISTANCE))
{
if (Player* player = GetLeaderForFollower())
{
if (player->GetQuestStatus(QUEST_A_LITTLE_HELP) == QUEST_STATUS_INCOMPLETE)
player->GroupEventHappens(QUEST_A_LITTLE_HELP, me);
}
SpraggleGUID = who->GetGUID();
SetFollowComplete(true);
}
}
}
void SpellHit(Unit* /*pCaster*/, SpellInfo const* pSpell) override
{
if (HasFollowState(STATE_FOLLOW_INPROGRESS | STATE_FOLLOW_PAUSED) && pSpell->Id == SPELL_REVIVE_RINGO)
ClearFaint();
}
void SetFaint()
{
if (!HasFollowState(STATE_FOLLOW_POSTEVENT))
{
SetFollowPaused(true);
Talk(SAY_FAINT);
}
//what does actually happen here? Emote? Aura?
me->SetStandState(UNIT_STAND_STATE_SLEEP);
}
void ClearFaint()
{
me->SetStandState(UNIT_STAND_STATE_STAND);
if (HasFollowState(STATE_FOLLOW_POSTEVENT))
return;
Talk(SAY_WAKE);
SetFollowPaused(false);
}
void UpdateFollowerAI(uint32 Diff) override
{
if (!UpdateVictim())
{
if (HasFollowState(STATE_FOLLOW_POSTEVENT))
{
if (EndEventTimer <= Diff)
{
Creature* spraggle = ObjectAccessor::GetCreature(*me, SpraggleGUID);
if (!spraggle || !spraggle->IsAlive())
{
SetFollowComplete();
return;
}
switch (EndEventProgress)
{
case 1:
Talk(SAY_RIN_END_1);
EndEventTimer = 3000;
break;
case 2:
spraggle->AI()->Talk(SAY_SPR_END_2);
EndEventTimer = 5000;
break;
case 3:
Talk(SAY_RIN_END_3);
EndEventTimer = 1000;
break;
case 4:
Talk(EMOTE_RIN_END_4);
SetFaint();
EndEventTimer = 9000;
break;
case 5:
Talk(EMOTE_RIN_END_5);
ClearFaint();
EndEventTimer = 1000;
break;
case 6:
Talk(SAY_RIN_END_6);
EndEventTimer = 3000;
break;
case 7:
spraggle->AI()->Talk(SAY_SPR_END_7);
EndEventTimer = 10000;
break;
case 8:
Talk(EMOTE_RIN_END_8);
EndEventTimer = 5000;
break;
case 9:
SetFollowComplete();
break;
}
++EndEventProgress;
}
else
EndEventTimer -= Diff;
}
else if (HasFollowState(STATE_FOLLOW_INPROGRESS) && !HasFollowState(STATE_FOLLOW_PAUSED))
{
if (FaintTimer <= Diff)
{
SetFaint();
FaintTimer = urand(60000, 120000);
}
else
FaintTimer -= Diff;
}
return;
}
DoMeleeAttackIfReady();
}
void QuestAccept(Player* player, Quest const* quest) override
{
if (quest->GetQuestId() == QUEST_A_LITTLE_HELP)
{
me->SetStandState(UNIT_STAND_STATE_STAND);
StartFollow(player, FACTION_ESCORTEE_N_NEUTRAL_PASSIVE, QUEST_A_LITTLE_HELP);
}
}
};
CreatureAI* GetAI(Creature* creature) const override
{
return new npc_ringoAI(creature);
}
};
void AddSC_ungoro_crater()
{
new npc_ame();
new npc_ringo();
}