Skip to content

Commit

Permalink
Implement q.7636 Stave of the Ancients
Browse files Browse the repository at this point in the history
Source: Nostalrius core
  • Loading branch information
MantisLord authored and killerwife committed Mar 21, 2018
1 parent 50419b7 commit b6f7f6f
Show file tree
Hide file tree
Showing 6 changed files with 1,343 additions and 1 deletion.
20 changes: 19 additions & 1 deletion sql/scriptdev2/scriptdev2.sql
Expand Up @@ -100,6 +100,11 @@ UPDATE creature_template SET ScriptName='npc_prof_leather' WHERE entry IN (7866,
-- UPDATE creature_template SET ScriptName='' WHERE npcflag!=npcflag|65536 AND ScriptName='npc_innkeeper';
-- UPDATE creature_template SET ScriptName='npc_innkeeper' WHERE npcflag=npcflag|65536;
UPDATE creature_template SET ScriptName='npc_redemption_target' WHERE entry IN (6172,6177,17542,17768);
<<<<<<< HEAD
=======
UPDATE creature_template SET ScriptName='npc_burster_worm' WHERE entry IN (16844,16857,16968,21380,21849,22038,22466,22482,23285);
UPDATE creature_template SET ScriptName='npc_the_cleaner' WHERE entry=14503;
>>>>>>> e1e796eb89... Implement q.7636 Stave of the Ancients

/* SPELL */
UPDATE creature_template SET ScriptName='spell_dummy_npc' WHERE entry IN (
Expand Down Expand Up @@ -236,6 +241,7 @@ UPDATE creature_template SET ScriptName='boss_kazzak' WHERE entry=12397;
/* BURNING STEPPES */
UPDATE creature_template SET ScriptName='npc_ragged_john' WHERE entry=9563;
UPDATE creature_template SET ScriptName='npc_grark_lorkrub' WHERE entry=9520;
UPDATE creature_template SET ScriptName='npc_klinfran' WHERE entry IN (14529,14534);

/* DARKSHORE */
UPDATE creature_template SET ScriptName='npc_kerlonian' WHERE entry=11218;
Expand Down Expand Up @@ -449,6 +455,8 @@ UPDATE creature_template SET ScriptName='boss_arugal' WHERE entry=4275;
/* SILITHUS */
UPDATE creature_template SET ScriptName='npc_anachronos_the_ancient' WHERE entry=15381;
UPDATE gameobject_template SET ScriptName='go_crystalline_tear' WHERE entry=180633;
UPDATE creature_template SET ScriptName='npc_solenor' WHERE entry IN (14530,14536);
UPDATE creature_template SET ScriptName='npc_creeping_doom' WHERE entry=14761;

/* SILVERPINE FOREST */
UPDATE creature_template SET ScriptName='npc_deathstalker_erland' WHERE entry=1978;
Expand Down Expand Up @@ -560,6 +568,9 @@ UPDATE instance_template SET ScriptName='instance_uldaman' WHERE map=70;
/* UN'GORO CRATER */
UPDATE creature_template SET ScriptName='npc_ame01' WHERE entry=9623;
UPDATE creature_template SET ScriptName='npc_ringo' WHERE entry=9999;
UPDATE creature_template SET ScriptName='npc_simone_seductress' WHERE entry=14533;
UPDATE creature_template SET ScriptName='npc_simone_the_inconspicuous' WHERE entry=14527;
UPDATE creature_template SET ScriptName='npc_precious_the_devourer' WHERE entry=14538;

/* UNDERCITY */

Expand All @@ -584,6 +595,7 @@ UPDATE creature_template SET ScriptName='npc_mikhail' WHERE entry=4963;
/* WINTERSPRING */
UPDATE creature_template SET ScriptName='npc_ranshalla' WHERE entry=10300;
UPDATE gameobject_template SET ScriptName='go_elune_fire' WHERE entry IN (177417, 177404);
UPDATE creature_template SET ScriptName='npc_artorius' WHERE entry IN (14531,14535);

/* ZUL'FARRAK */
UPDATE instance_template SET ScriptName='instance_zulfarrak' WHERE map=209;
Expand Down Expand Up @@ -1654,7 +1666,13 @@ INSERT INTO script_texts (entry,content_default,sound,type,language,emote,commen
(-1001197,'Wow! We did it... not sure why we thought we needed the likes of you. Nevertheless, speak with Smeed Srablescrew; he will give you your earnings!',0,0,0,0,'SAY_RIGGER_END'),
-- REUSE_ME -1001198 to -1001225
(-1001226,'%s is drawn to the ghost magnet...',0,2,0,0,'Magrami Spectre on spawn 1'),
(-1001227,'%s is angered!',0,2,0,0,'Magrami Spectre on spawn 2');
(-1001227,'%s is angered!',0,2,0,0,'Magrami Spectre on spawn 2'),
-- used in TBC
(-1001250,'%s is silenced by the venemous sting.',0,2,0,0,'npc_simone EMOTE_SILENCE'),
(-1001251,'%s is stricken by a virulent poison.',0,2,0,0,'npc_artorius EMOTE_POISON'),
(-1001252,'%s is immobilized.',0,2,0,0,'npc_solenor EMOTE_IMMOBILIZED'),
(-1001253,'You dare interfere with this being''s testing? The battle must be fought alone! You shall all pay for this interference!',0,0,0,0,'the_cleaner SAY_CLEANER_AGGRO');
-- used in TBC core

-- -1 033 000 SHADOWFANG KEEP
INSERT INTO script_texts (entry,content_default,sound,type,language,emote,comment) VALUES
Expand Down
235 changes: 235 additions & 0 deletions src/game/AI/ScriptDevAI/scripts/eastern_kingdoms/burning_steppes.cpp
Expand Up @@ -369,6 +369,234 @@ bool EffectDummyCreature_spell_capture_grark(Unit* /*pCaster*/, uint32 uiSpellId
return false;
}

enum
{
SPELL_FOOLS_PLIGHT = 23504,

SPELL_DEMONIC_FRENZY = 23257,
SPELL_ENTROPIC_STING = 23260,

EMOTE_FRENZY = -1000001,

NPC_NELSON_THE_NICE = 14529,
NPC_KLINFRAN_THE_CRAZED = 14534,
NPC_THE_CLEANER = 14503,

QUEST_STAVE_OF_THE_ANCIENTS = 7636
};

#define GOSSIP_ITEM "Show me your real face, demon."

/*######
## npc_franklin_the_friendly
######*/

/*######
## npc_klinfran_the_crazed
######*/

struct npc_klinfranAI : public ScriptedAI
{
npc_klinfranAI(Creature* pCreature) : ScriptedAI(pCreature)
{
m_bTransform = false;
m_uiDespawn_Timer = 0;
Reset();
}

uint32 m_uiTransform_Timer;
uint32 m_uiTransformEmote_Timer;
bool m_bTransform;

ObjectGuid m_hunterGuid;
uint32 m_uiDemonic_Frenzy_Timer;
uint32 m_uiDespawn_Timer;

void Reset() override
{
switch (m_creature->GetEntry())
{
case NPC_NELSON_THE_NICE:
m_creature->SetRespawnDelay(35 * MINUTE);
m_creature->SetRespawnTime(35 * MINUTE);
m_creature->NearTeleportTo(-8318.19f, -993.662f, 176.956f, 5.65024f);
if (m_creature->GetMotionMaster()->GetCurrentMovementGeneratorType() != WAYPOINT_MOTION_TYPE)
{
m_creature->SetDefaultMovementType(WAYPOINT_MOTION_TYPE);
m_creature->GetMotionMaster()->Initialize();
}

m_creature->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);

m_uiTransform_Timer = 10000;
m_uiTransformEmote_Timer = 5000;
m_bTransform = false;
m_uiDespawn_Timer = 0;
break;
case NPC_KLINFRAN_THE_CRAZED:
if (!m_uiDespawn_Timer)
m_uiDespawn_Timer = 20 * MINUTE*IN_MILLISECONDS;

m_hunterGuid.Clear();
m_uiDemonic_Frenzy_Timer = 5000;
break;
}
}

/** Franklin the Friendly */
void Transform()
{
m_creature->UpdateEntry(NPC_KLINFRAN_THE_CRAZED);
Reset();
}

void BeginEvent(ObjectGuid playerGuid)
{
m_hunterGuid = playerGuid;
m_creature->GetMotionMaster()->Clear(false);
m_creature->GetMotionMaster()->MoveIdle();
m_creature->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE);
m_bTransform = true;
}

/** Klinfran the Crazed */
void Aggro(Unit* pWho) override
{
if (pWho->getClass() == CLASS_HUNTER && (m_hunterGuid.IsEmpty() || m_hunterGuid == pWho->GetObjectGuid()))
{
m_hunterGuid = pWho->GetObjectGuid();
}
else
DemonDespawn();
}

void JustDied(Unit* /*pKiller*/) override
{
uint32 m_respawn_delay_Timer = 2 * HOUR;
m_creature->SetRespawnDelay(m_respawn_delay_Timer);
m_creature->SetRespawnTime(m_respawn_delay_Timer);
m_creature->SaveRespawnTime();
}

void DemonDespawn(bool triggered = true)
{
m_creature->SetRespawnDelay(15 * MINUTE);
m_creature->SetRespawnTime(15 * MINUTE);
m_creature->SaveRespawnTime();

if (triggered)
{
Creature* pCleaner = m_creature->SummonCreature(NPC_THE_CLEANER, m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ(), m_creature->GetAngle(m_creature), TEMPSPAWN_DEAD_DESPAWN, 20 * MINUTE*IN_MILLISECONDS);
if (pCleaner)
{
ThreatList const& tList = m_creature->getThreatManager().getThreatList();

for (ThreatList::const_iterator itr = tList.begin(); itr != tList.end(); ++itr)
{
if (Unit* pUnit = m_creature->GetMap()->GetUnit((*itr)->getUnitGuid()))
{
if (pUnit->isAlive())
{
pCleaner->SetInCombatWith(pUnit);
pCleaner->AddThreat(pUnit);
pCleaner->AI()->AttackStart(pUnit);
}
}
}
}
}

m_creature->ForcedDespawn();
}

void SpellHit(Unit* /*pCaster*/, const SpellEntry* pSpell) override
{
if (pSpell && pSpell->Id == 14277) // Scorpid Sting (Rank 4)
{
m_creature->RemoveAurasDueToSpell(SPELL_DEMONIC_FRENZY);
DoCastSpellIfCan(m_creature, SPELL_ENTROPIC_STING, CAST_TRIGGERED);
}
}

void UpdateAI(const uint32 uiDiff) override
{
/** Franklin the Friendly */
if (m_bTransform)
{
if (m_uiTransformEmote_Timer)
{
if (m_uiTransformEmote_Timer <= uiDiff)
{
m_creature->HandleEmote(EMOTE_ONESHOT_POINT);
m_uiTransformEmote_Timer = 0;
}
else
m_uiTransformEmote_Timer -= uiDiff;
}

if (m_uiTransform_Timer < uiDiff)
{
m_bTransform = false;
Transform();
}
else
m_uiTransform_Timer -= uiDiff;
}

/** Klinfran the Crazed */
if (m_uiDespawn_Timer)
{
if (m_uiDespawn_Timer <= uiDiff)
{
if (m_creature->isAlive() && !m_creature->isInCombat())
DemonDespawn(false);
}
else
m_uiDespawn_Timer -= uiDiff;
}

if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
return;

if (m_creature->getThreatManager().getThreatList().size() > 1 /*|| pHunter->isDead()*/)
DemonDespawn();

if (m_uiDemonic_Frenzy_Timer < uiDiff)
{
if (DoCastSpellIfCan(m_creature, SPELL_DEMONIC_FRENZY) == CAST_OK)
{
DoScriptText(EMOTE_FRENZY, m_creature);
m_uiDemonic_Frenzy_Timer = 15000;
}
}
else
m_uiDemonic_Frenzy_Timer -= uiDiff;

DoMeleeAttackIfReady();
}
};

bool GossipHello_npc_klinfran(Player* pPlayer, Creature* pCreature)
{
if (pPlayer->GetQuestStatus(QUEST_STAVE_OF_THE_ANCIENTS) == QUEST_STATUS_INCOMPLETE)
pPlayer->ADD_GOSSIP_ITEM(0, GOSSIP_ITEM, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF);

pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetObjectGuid());
return true;
}

bool GossipSelect_npc_klinfran(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction)
{
pPlayer->CLOSE_GOSSIP_MENU();
((npc_klinfranAI*)pCreature->AI())->BeginEvent(pPlayer->GetObjectGuid());
return true;
}

CreatureAI* GetAI_npc_klinfran(Creature* pCreature)
{
return new npc_klinfranAI(pCreature);
}

void AddSC_burning_steppes()
{
Script* pNewScript;
Expand All @@ -384,4 +612,11 @@ void AddSC_burning_steppes()
pNewScript->pQuestAcceptNPC = &QuestAccept_npc_grark_lorkrub;
pNewScript->pEffectDummyNPC = &EffectDummyCreature_spell_capture_grark;
pNewScript->RegisterSelf();

pNewScript = new Script;
pNewScript->Name = "npc_klinfran";
pNewScript->GetAI = &GetAI_npc_klinfran;
pNewScript->pGossipHello = &GossipHello_npc_klinfran;
pNewScript->pGossipSelect = &GossipSelect_npc_klinfran;
pNewScript->RegisterSelf();
}

0 comments on commit b6f7f6f

Please sign in to comment.