fix(DB/Script): Rewrite A Special Surprise Quest event using SmartAI. (#26861)
This commit is contained in:
@@ -779,181 +779,6 @@ struct npc_scarlet_courier : public ScriptedAI
|
||||
}
|
||||
};
|
||||
|
||||
/*######
|
||||
## Various NPCs AI
|
||||
## Quest: A Special Surprise
|
||||
## Note: Used by 29032, 29061, 29065, 29067, 29068, 29070, 29074, 29072, 29073, 29071 but signed for 29032
|
||||
######*/
|
||||
|
||||
enum SpecialSurprise
|
||||
{
|
||||
SAY_EXEC_START = 0,
|
||||
SAY_EXEC_PROG = 1,
|
||||
SAY_EXEC_NAME = 2,
|
||||
SAY_EXEC_RECOG = 3,
|
||||
SAY_EXEC_NOREM = 4,
|
||||
SAY_EXEC_THINK = 5,
|
||||
SAY_EXEC_LISTEN = 6,
|
||||
SAY_EXEC_TIME = 7,
|
||||
SAY_EXEC_WAITING = 8,
|
||||
EMOTE_DIES = 9,
|
||||
|
||||
SAY_PLAGUEFIST = 0,
|
||||
NPC_PLAGUEFIST = 29053
|
||||
};
|
||||
|
||||
struct npc_a_special_surprise : public ScriptedAI
|
||||
{
|
||||
npc_a_special_surprise(Creature* creature) : ScriptedAI(creature) { }
|
||||
|
||||
uint32 ExecuteSpeech_Timer;
|
||||
uint32 ExecuteSpeech_Counter;
|
||||
ObjectGuid PlayerGUID;
|
||||
|
||||
void Reset() override
|
||||
{
|
||||
ExecuteSpeech_Timer = 0;
|
||||
ExecuteSpeech_Counter = 0;
|
||||
PlayerGUID.Clear();
|
||||
|
||||
me->SetReactState(REACT_PASSIVE);
|
||||
me->SetImmuneToPC(true);
|
||||
}
|
||||
|
||||
bool MeetQuestCondition(Player* player)
|
||||
{
|
||||
switch (me->GetEntry())
|
||||
{
|
||||
case 29061: // Ellen Stanbridge
|
||||
if (player->GetQuestStatus(12742) == QUEST_STATUS_INCOMPLETE)
|
||||
return true;
|
||||
break;
|
||||
case 29072: // Kug Ironjaw
|
||||
if (player->GetQuestStatus(12748) == QUEST_STATUS_INCOMPLETE)
|
||||
return true;
|
||||
break;
|
||||
case 29067: // Donovan Pulfrost
|
||||
if (player->GetQuestStatus(12744) == QUEST_STATUS_INCOMPLETE)
|
||||
return true;
|
||||
break;
|
||||
case 29065: // Yazmina Oakenthorn
|
||||
if (player->GetQuestStatus(12743) == QUEST_STATUS_INCOMPLETE)
|
||||
return true;
|
||||
break;
|
||||
case 29071: // Antoine Brack
|
||||
if (player->GetQuestStatus(12750) == QUEST_STATUS_INCOMPLETE)
|
||||
return true;
|
||||
break;
|
||||
case 29032: // Malar Bravehorn
|
||||
if (player->GetQuestStatus(12739) == QUEST_STATUS_INCOMPLETE)
|
||||
return true;
|
||||
break;
|
||||
case 29068: // Goby Blastenheimer
|
||||
if (player->GetQuestStatus(12745) == QUEST_STATUS_INCOMPLETE)
|
||||
return true;
|
||||
break;
|
||||
case 29073: // Iggy Darktusk
|
||||
if (player->GetQuestStatus(12749) == QUEST_STATUS_INCOMPLETE)
|
||||
return true;
|
||||
break;
|
||||
case 29074: // Lady Eonys
|
||||
if (player->GetQuestStatus(12747) == QUEST_STATUS_INCOMPLETE)
|
||||
return true;
|
||||
break;
|
||||
case 29070: // Valok the Righteous
|
||||
if (player->GetQuestStatus(12746) == QUEST_STATUS_INCOMPLETE)
|
||||
return true;
|
||||
break;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void MoveInLineOfSight(Unit* who) override
|
||||
|
||||
{
|
||||
if (PlayerGUID || !who->IsPlayer() || !who->IsWithinDist(me, INTERACTION_DISTANCE))
|
||||
return;
|
||||
|
||||
if (MeetQuestCondition(who->ToPlayer()))
|
||||
PlayerGUID = who->GetGUID();
|
||||
}
|
||||
|
||||
void UpdateAI(uint32 diff) override
|
||||
{
|
||||
if (PlayerGUID && !me->GetVictim() && me->IsAlive())
|
||||
{
|
||||
if (ExecuteSpeech_Timer <= diff)
|
||||
{
|
||||
Player* player = ObjectAccessor::GetPlayer(*me, PlayerGUID);
|
||||
|
||||
if (!player)
|
||||
{
|
||||
Reset();
|
||||
return;
|
||||
}
|
||||
|
||||
switch (ExecuteSpeech_Counter)
|
||||
{
|
||||
case 0:
|
||||
Talk(SAY_EXEC_START, player);
|
||||
break;
|
||||
case 1:
|
||||
me->SetStandState(UNIT_STAND_STATE_STAND);
|
||||
break;
|
||||
case 2:
|
||||
Talk(SAY_EXEC_PROG, player);
|
||||
break;
|
||||
case 3:
|
||||
Talk(SAY_EXEC_NAME, player);
|
||||
break;
|
||||
case 4:
|
||||
Talk(SAY_EXEC_RECOG, player);
|
||||
break;
|
||||
case 5:
|
||||
Talk(SAY_EXEC_NOREM, player);
|
||||
break;
|
||||
case 6:
|
||||
Talk(SAY_EXEC_THINK, player);
|
||||
break;
|
||||
case 7:
|
||||
Talk(SAY_EXEC_LISTEN, player);
|
||||
break;
|
||||
case 8:
|
||||
if (Creature* Plaguefist = GetClosestCreatureWithEntry(me, NPC_PLAGUEFIST, 85.0f))
|
||||
{
|
||||
Plaguefist->AI()->Talk(SAY_PLAGUEFIST, player);
|
||||
}
|
||||
break;
|
||||
case 9:
|
||||
Talk(SAY_EXEC_TIME, player);
|
||||
me->SetStandState(UNIT_STAND_STATE_KNEEL);
|
||||
me->SetReactState(REACT_PASSIVE);
|
||||
me->SetImmuneToPC(false);
|
||||
break;
|
||||
case 10:
|
||||
Talk(SAY_EXEC_WAITING, player);
|
||||
break;
|
||||
case 11:
|
||||
Talk(EMOTE_DIES);
|
||||
me->setDeathState(DeathState::JustDied);
|
||||
me->SetHealth(0);
|
||||
return;
|
||||
}
|
||||
|
||||
if (ExecuteSpeech_Counter >= 9)
|
||||
ExecuteSpeech_Timer = 15000;
|
||||
else
|
||||
ExecuteSpeech_Timer = 7000;
|
||||
|
||||
++ExecuteSpeech_Counter;
|
||||
}
|
||||
else
|
||||
ExecuteSpeech_Timer -= diff;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/*######
|
||||
## Gothik the Harvester and Acherus Necromancer AI
|
||||
## Phase 4 Internal Mechanics.
|
||||
@@ -2938,7 +2763,6 @@ void AddSC_the_scarlet_enclave()
|
||||
RegisterCreatureAI(npc_dkc1_gothik);
|
||||
RegisterCreatureAI(npc_scarlet_courier);
|
||||
RegisterCreatureAI(npc_koltira_deathweaver);
|
||||
RegisterCreatureAI(npc_a_special_surprise);
|
||||
RegisterCreatureAI(npc_acherus_necromancer);
|
||||
RegisterCreatureAI(npc_gothik_the_harvester);
|
||||
RegisterCreatureAI(npc_highlord_darion_mograine);
|
||||
|
||||
Reference in New Issue
Block a user