Skip to content

Commit

Permalink
[3126] Improve quest 12754
Browse files Browse the repository at this point in the history
Thanks to @Grz3s for providing the data

Close #146
  • Loading branch information
xfurry committed Apr 19, 2015
1 parent 6970346 commit 327097b
Show file tree
Hide file tree
Showing 6 changed files with 143 additions and 3 deletions.
133 changes: 132 additions & 1 deletion scripts/eastern_kingdoms/scarlet_enclave/ebon_hold.cpp
Expand Up @@ -17,7 +17,7 @@
/* ScriptData
SDName: Ebon_Hold
SD%Complete: 95
SDComment: Quest support: 12641, 12687, 12698, 12733, 12739(and 12742 to 12750), 12801, 12848
SDComment: Quest support: 12641, 12687, 12698, 12733, 12739(and 12742 to 12750), 12754, 12801, 12848
SDCategory: Ebon Hold
EndScriptData */

Expand All @@ -32,12 +32,14 @@ npc_scarlet_ghoul
npc_highlord_darion_mograine
npc_fellow_death_knight
npc_acherus_deathcharger
npc_scarlet_courier
EndContentData */

#include "precompiled.h"
#include "escort_ai.h"
#include "world_map_ebon_hold.h"
#include "pet_ai.h"
#include "TemporarySummon.h"

/*######
## npc_a_special_surprise
Expand Down Expand Up @@ -2822,6 +2824,130 @@ bool EffectDummyCreature_npc_acherus_deathcharger(Unit* /*pCaster*/, uint32 uiSp
return false;
}

/*######
## npc_scarlet_courier
######*/

enum
{
SAY_TREE_1 = -1609079,
SAY_TREE_2 = -1609080,

GO_TREE = 191144,
};

struct npc_scarlet_courierAI : public ScriptedAI
{
npc_scarlet_courierAI(Creature* pCreature) : ScriptedAI(pCreature) { Reset(); }

uint32 m_uiInitTimer;
uint32 m_uiCombatTimer;
uint8 m_uiCombatStage;

void Reset() override
{
m_uiInitTimer = 2000;
m_uiCombatTimer = 0;
m_uiCombatStage = 0;
}

void AttackedBy(Unit* /*pAttacker*/) override
{
m_creature->Unmount();
}

void JustReachedHome() override
{
m_creature->ForcedDespawn();
DoDespawnTree();
}

void JustDied(Unit* /*pKiller*/) override
{
DoDespawnTree();
}

void MovementInform(uint32 uiType, uint32 uiPointId) override
{
if (uiType != POINT_MOTION_TYPE || !uiPointId)
return;

m_uiCombatTimer = 5000;
}

// Wrapper function that despawns the tree
void DoDespawnTree()
{
if (GameObject* pTree = GetClosestGameObjectWithEntry(m_creature, GO_TREE, 30.0f))
pTree->SetLootState(GO_JUST_DEACTIVATED);
}

void UpdateAI(const uint32 uiDiff) override
{
// walk to the tree
if (m_uiInitTimer)
{
if (m_uiInitTimer <= uiDiff)
{
DoScriptText(SAY_TREE_1, m_creature);

float fX, fY, fZ;
if (GameObject* pTree = GetClosestGameObjectWithEntry(m_creature, GO_TREE, 30.0f))
{
pTree->GetContactPoint(m_creature, fX, fY, fZ);
m_creature->GetMotionMaster()->MovePoint(1, fX, fY, fZ);
}

m_uiInitTimer = 0;
}
else
m_uiInitTimer -= uiDiff;
}

// despawn tree and start combat
if (m_uiCombatTimer)
{
if (m_uiCombatTimer <= uiDiff)
{
switch (m_uiCombatStage)
{
case 0:
DoScriptText(SAY_TREE_2, m_creature);
m_creature->Unmount();
DoDespawnTree();

m_uiCombatTimer = 3000;
break;
case 1:
if (m_creature->IsTemporarySummon())
{
TemporarySummon* pTemporary = (TemporarySummon*)m_creature;

if (Player* pSummoner = m_creature->GetMap()->GetPlayer(pTemporary->GetSummonerGuid()))
m_creature->AI()->AttackStart(pSummoner);
}

m_uiCombatTimer = 0;
break;
}
++m_uiCombatStage;
}
else
m_uiCombatTimer -= uiDiff;
}

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

DoMeleeAttackIfReady();
}
};

CreatureAI* GetAI_npc_scarlet_courier(Creature* pCreature)
{
return new npc_scarlet_courierAI(pCreature);
}

void AddSC_ebon_hold()
{
Script* pNewScript;
Expand Down Expand Up @@ -2887,4 +3013,9 @@ void AddSC_ebon_hold()
pNewScript->GetAI = &GetAI_npc_acherus_deathcharger;
pNewScript->pEffectDummyNPC = &EffectDummyCreature_npc_acherus_deathcharger;
pNewScript->RegisterSelf();

pNewScript = new Script;
pNewScript->Name = "npc_scarlet_courier";
pNewScript->GetAI = &GetAI_npc_scarlet_courier;
pNewScript->RegisterSelf();
}
2 changes: 1 addition & 1 deletion sd2_revision_nr.h
@@ -1,4 +1,4 @@
#ifndef __SD2_REVISION_NR_H__
#define __SD2_REVISION_NR_H__
#define SD2_REVISION_NR "3125"
#define SD2_REVISION_NR "3126"
#endif // __SD2_REVISION_NR_H__
1 change: 1 addition & 0 deletions sql/mangos_scriptname_full.sql
Expand Up @@ -602,6 +602,7 @@ UPDATE creature_template SET ScriptName='npc_highlord_darion_mograine' WHERE ent
UPDATE creature_template SET ScriptName='npc_fellow_death_knight' WHERE entry IN (29199, 29204, 29200);
UPDATE creature_template SET ScriptName='npc_lich_king_light_dawn' WHERE entry=29183;
UPDATE creature_template SET ScriptName='npc_acherus_deathcharger' WHERE entry=28782;
UPDATE creature_template SET ScriptName='npc_scarlet_courier' WHERE entry=29076;

/* ELWYNN FOREST */

Expand Down
5 changes: 4 additions & 1 deletion sql/scriptdev2_script_full.sql
Expand Up @@ -4138,7 +4138,10 @@ INSERT INTO script_texts (entry,content_default,sound,type,language,emote,commen
(-1609077,'Do it, $N! Put me out of my misery!',0,0,0,1,'special_surprise SAY_EXEC_WAITING'),
(-1609078,'%s dies from his wounds.',0,2,0,0,'special_surprise EMOTE_DIES'),

-- PLEASE RE-USE -1609079 to -1609088
(-1609079,'Hrm, what a strange tree. I must investigate.',0,0,0,1,'scarlet courier SAY_TREE_1'),
(-1609080,'What\'s this!? This isn\'t a tree at all! Guards! Guards!',0,0,0,5,'scarlet courier SAY_TREE_2'),

-- PLEASE RE-USE -1609081 to -1609088

(-1609089,'The Eye of Acherus launches towards its destination',0,3,0,0,'eye of acherus EMOTE_DESTIANTION'),
(-1609090,'The Eye of Acherus is in your control',0,3,0,0,'eye of acherus EMOTE_CONTROL'),
Expand Down
1 change: 1 addition & 0 deletions sql/updates/r3126_mangos.sql
@@ -0,0 +1 @@
UPDATE creature_template SET ScriptName='npc_scarlet_courier' WHERE entry=29076;
4 changes: 4 additions & 0 deletions sql/updates/r3126_scriptdev2.sql
@@ -0,0 +1,4 @@
DELETE FROM script_texts WHERE entry IN (-1609079,-1609080);
INSERT INTO script_texts (entry,content_default,sound,type,language,emote,comment) VALUES
(-1609079,'Hrm, what a strange tree. I must investigate.',0,0,0,1,'scarlet courier SAY_TREE_1'),
(-1609080,'What\'s this!? This isn\'t a tree at all! Guards! Guards!',0,0,0,5,'scarlet courier SAY_TREE_2');

0 comments on commit 327097b

Please sign in to comment.