*Merge SD2.

*r973: Added support for quest 2767
*r974: Start MoveChase when boss reach phase 3.
*r975: Added support for quest 863 - Skip this patch because its already scripted. Just use enum instead of #define
*r976: Added support for quest 435 - Skip this patch because its already scripted. Just use enum instead of #define
*977: Remove one needless grid search and use new functions for SetRun in one script. - Skip this patch because TrinityCore2 has use another way for it.

--HG--
branch : trunk
This commit is contained in:
Anubisss
2009-05-19 23:48:48 +02:00
parent d8ce14c66a
commit 5854d17783
9 changed files with 328 additions and 54 deletions
@@ -31,9 +31,17 @@ void npc_escortAI::AttackStart(Unit *who)
if (IsBeingEscorted && !Defend)
return;
if ( m_creature->Attack(who, true) )
if(m_creature->Attack(who, true) )
{
m_creature->GetMotionMaster()->MoveChase(who);
m_creature->AddThreat(who, 0.0f);
m_creature->SetInCombatWith(who);
who->SetInCombatWith(m_creature);
if(CombatMovement)
{
m_creature->GetMotionMaster()->MovementExpired();
m_creature->GetMotionMaster()->MoveChase(who);
}
}
}
@@ -63,6 +71,7 @@ void npc_escortAI::JustRespawned()
{
IsBeingEscorted = false;
IsOnHold = false;
CombatMovement = true;
//Re-Enable questgiver flag
m_creature->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER);
@@ -82,8 +91,12 @@ void npc_escortAI::EnterEvadeMode()
debug_log("TSCR: EscortAI has left combat and is now returning to last point.");
Returning = true;
m_creature->GetMotionMaster()->MovementExpired();
m_creature->GetMotionMaster()->MovePoint(WP_LAST_POINT, LastPos.x, LastPos.y, LastPos.z);
//if default is WAYPOINT_MOTION_TYPE, must MoveIdle to prevent from using
if(m_creature->GetMotionMaster()->GetCurrentMovementGeneratorType() == WAYPOINT_MOTION_TYPE)
m_creature->GetMotionMaster()->MoveIdle();
m_creature->GetMotionMaster()->MovePoint(WP_LAST_POINT, LastPos.x, LastPos.y, LastPos.z);
}
else
{
@@ -224,15 +237,16 @@ void npc_escortAI::MovementInform(uint32 type, uint32 id)
debug_log("TSCR: EscortAI has returned to original position before combat");
ReconnectWP = true;
Returning = false;
WaitTimer = 1;
if(!WaitTimer)
WaitTimer = 1;
}
else
{
//Make sure that we are still on the right waypoint
if (CurrentWP->id != id)
{
debug_log("SD2 ERROR: EscortAI reached waypoint out of order %d, expected %d", id, CurrentWP->id);
debug_log("TSCR ERROR: EscortAI reached waypoint out of order %d, expected %d", id, CurrentWP->id);
return;
}
@@ -294,30 +308,25 @@ void npc_escortAI::SetRun(bool bRun)
if (bRun)
{
if (!bIsRunning)
{
m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE);
bIsRunning = true;
}
else
debug_log("TSCR: EscortAI attempt to set run mode, but is already running.");
}
else
{
if (bIsRunning)
{
m_creature->AddUnitMovementFlag(MOVEMENTFLAG_WALK_MODE);
bIsRunning = false;
}
else
debug_log("TSCR: EscortAI attempt to set walk mode, but is already walking.");
}
bIsRunning = bRun;
}
void npc_escortAI::Start(bool bAttack, bool bDefend, bool bRun, uint64 pGUID)
{
if (m_creature->isInCombat())
{
debug_log("SD2 ERROR: EscortAI attempt to Start while in combat");
debug_log("TSCR ERROR: EscortAI attempt to Start while in combat");
return;
}
@@ -333,6 +342,13 @@ void npc_escortAI::Start(bool bAttack, bool bDefend, bool bRun, uint64 pGUID)
return;
}
if(m_creature->GetMotionMaster()->GetCurrentMovementGeneratorType() == WAYPOINT_MOTION_TYPE)
{
m_creature->GetMotionMaster()->MovementExpired();
m_creature->GetMotionMaster()->MoveIdle();
debug_log("TSCR: EscortAI start with WAYPOINT_MOTION_TYPE, changed to MoveIdle.");
}
Attack = bAttack;
Defend = bDefend;
bIsRunning = bRun;
@@ -362,6 +378,6 @@ void npc_escortAI::Start(bool bAttack, bool bDefend, bool bRun, uint64 pGUID)
ReconnectWP = false;
Returning = false;
IsOnHold = false;
CombatMovement = true;
}
@@ -398,24 +398,33 @@ CreatureAI* GetAI_npc_twiggy_flathead(Creature *_Creature)
## npc_wizzlecrank_shredder
#####*/
#define SAY_PROGRESS_1 -1000272
#define SAY_PROGRESS_2 -1000273
#define SAY_PROGRESS_3 -1000274
enum
{
SAY_PROGRESS_1 = -1000272,
SAY_PROGRESS_2 = -1000273,
SAY_PROGRESS_3 = -1000274,
#define SAY_MERCENARY_4 -1000275
SAY_MERCENARY_4 = -1000275,
#define SAY_PROGRESS_5 -1000276
#define SAY_PROGRESS_6 -1000277
#define SAY_PROGRESS_7 -1000278
#define SAY_PROGRESS_8 -1000279
SAY_PROGRESS_5 = -1000276,
SAY_PROGRESS_6 = -1000277,
SAY_PROGRESS_7 = -1000278,
SAY_PROGRESS_8 = -1000279,
#define QUEST_ESCAPE 863
#define NPC_PILOT 3451
#define MOB_MERCENARY 3282
QUEST_ESCAPE = 863,
FACTION_RATCHET = 637,
NPC_PILOT = 3451,
MOB_MERCENARY = 3282,
};
struct TRINITY_DLL_DECL npc_wizzlecrank_shredderAI : public npc_escortAI
{
npc_wizzlecrank_shredderAI(Creature* c) : npc_escortAI(c) {}
npc_wizzlecrank_shredderAI(Creature* c) : npc_escortAI(c)
{
uiNormFaction = c->getFaction();
}
uint32 uiNormFaction;
bool Completed;
@@ -450,8 +459,7 @@ struct TRINITY_DLL_DECL npc_wizzlecrank_shredderAI : public npc_escortAI
case 31: m_creature->SummonCreature(NPC_PILOT, 1088.77, -2985.39, 91.84, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 300000);
m_creature->setDeathState(JUST_DIED);
Completed = true;
if (player && player->GetTypeId() == TYPEID_PLAYER)
((Player*)player)->GroupEventHappens(QUEST_ESCAPE, m_creature);
player->GroupEventHappens(QUEST_ESCAPE, m_creature);
break;
}
}
@@ -460,7 +468,12 @@ struct TRINITY_DLL_DECL npc_wizzlecrank_shredderAI : public npc_escortAI
{
m_creature->setDeathState(ALIVE);
Completed = false;
m_creature->setFaction(69);
if(!IsBeingEscorted)
{
m_creature->setFaction(uiNormFaction);
if (m_creature->getStandState() == UNIT_STAND_STATE_DEAD)
m_creature->SetStandState(UNIT_STAND_STATE_STAND);
}
}
void EnterCombat(Unit* who){}
@@ -471,7 +484,7 @@ struct TRINITY_DLL_DECL npc_wizzlecrank_shredderAI : public npc_escortAI
{
Player* player = Unit::GetPlayer(PlayerGUID);
if (player)
((Player*)player)->FailQuest(QUEST_ESCAPE);
player->FailQuest(QUEST_ESCAPE);
}
}
@@ -485,8 +498,8 @@ bool QuestAccept_npc_wizzlecrank_shredder(Player* player, Creature* creature, Qu
{
if (quest->GetQuestId() == QUEST_ESCAPE)
{
creature->setFaction(FACTION_RATCHET);
((npc_escortAI*)(creature->AI()))->Start(true, true, false, player->GetGUID());
creature->setFaction(113);
}
return true;
}
@@ -17,11 +17,12 @@
/* ScriptData
SDName: Feralas
SD%Complete: 100
SDComment: Quest support: 3520. Special vendor Gregan Brewspewer
SDComment: Quest support: 3520, 2767, Special vendor Gregan Brewspewer
SDCategory: Feralas
EndScriptData */
#include "precompiled.h"
#include "../../npc/npc_escortAI.h"
/*######
## npc_gregan_brewspewer
@@ -53,6 +54,148 @@ bool GossipSelect_npc_gregan_brewspewer(Player *player, Creature *_Creature, uin
return true;
}
/*######
## npc_oox22fe
######*/
enum
{
SAY_START = -1060000,
SAY_AGGRO = -1060001,
SAY_AGGRO2 = -1060002,
SAY_AMBUSH = -1060003,
SAY_END = -1060005,
NPC_YETI = 7848,
NPC_GORILLA = 5260,
NPC_WOODPAW_REAVER = 5255,
NPC_WOODPAW_BRUTE = 5253,
NPC_WOODPAW_ALPHA = 5258,
NPC_WOODPAW_MYSTIC = 5254,
QUEST_RESCUE_OOX22FE = 2767,
FACTION_ESCORTEE_A = 774,
FACTION_ESCORTEE_H = 775
};
struct TRINITY_DLL_DECL npc_oox22feAI : public npc_escortAI
{
npc_oox22feAI(Creature* pCreature) : npc_escortAI(pCreature)
{
normFaction = pCreature->getFaction();
}
uint32 normFaction;
void WaypointReached(uint32 i)
{
switch (i)
{
// First Ambush(3 Yetis)
case 11:
DoScriptText(SAY_AMBUSH,m_creature);
m_creature->SummonCreature(NPC_YETI, -4841.01, 1593.91, 73.42, 3.98, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 10000);
m_creature->SummonCreature(NPC_YETI, -4837.61, 1568.58, 78.21, 3.13, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 10000);
m_creature->SummonCreature(NPC_YETI, -4841.89, 1569.95, 76.53, 0.68, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 10000);
break;
//Second Ambush(3 Gorillas)
case 21:
DoScriptText(SAY_AMBUSH,m_creature);
m_creature->SummonCreature(NPC_GORILLA, -4595.81, 2005.99, 53.08, 3.74, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 10000);
m_creature->SummonCreature(NPC_GORILLA, -4597.53, 2008.31, 52.70, 3.78, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 10000);
m_creature->SummonCreature(NPC_GORILLA, -4599.37, 2010.59, 52.77, 3.84, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 10000);
break;
//Third Ambush(4 Gnolls)
case 30:
DoScriptText(SAY_AMBUSH,m_creature);
m_creature->SummonCreature(NPC_WOODPAW_REAVER, -4425.14, 2075.87, 47.77, 3.77, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 10000);
m_creature->SummonCreature(NPC_WOODPAW_BRUTE , -4426.68, 2077.98, 47.57, 3.77, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 10000);
m_creature->SummonCreature(NPC_WOODPAW_MYSTIC, -4428.33, 2080.24, 47.43, 3.87, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 10000);
m_creature->SummonCreature(NPC_WOODPAW_ALPHA , -4430.04, 2075.54, 46.83, 3.81, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 10000);
break;
case 37:
DoScriptText(SAY_END,m_creature);
// Award quest credit
if(Player* pPlayer = Unit::GetPlayer( PlayerGUID))
{
pPlayer->GroupEventHappens(QUEST_RESCUE_OOX22FE, m_creature);
}
break;
}
}
void Reset()
{
if (!IsBeingEscorted)
{
m_creature->setFaction(normFaction);
m_creature->SetStandState(UNIT_STAND_STATE_DEAD);
}
}
void Aggro(Unit* who)
{
//For an small probability the npc says something when he get aggro
switch(rand()%10)
{
case 0: DoScriptText(SAY_AGGRO,m_creature); break;
case 1: DoScriptText(SAY_AGGRO2,m_creature); break;
}
}
void JustSummoned(Creature* summoned)
{
summoned->AI()->AttackStart(m_creature);
}
void JustDied(Unit* killer)
{
if (!IsBeingEscorted)
return;
if(Player* pPlayer = Unit::GetPlayer(PlayerGUID))
{
// If NPC dies, player fails the quest
if(pPlayer->GetQuestStatus(QUEST_RESCUE_OOX22FE) != QUEST_STATUS_COMPLETE)
pPlayer->FailQuest(QUEST_RESCUE_OOX22FE);
}
}
void UpdateAI(const uint32 diff)
{
npc_escortAI::UpdateAI(diff);
}
};
CreatureAI* GetAI_npc_oox22fe(Creature* pCreature)
{
npc_oox22feAI* oox22AI = new npc_oox22feAI(pCreature);
oox22AI->FillPointMovementListForCreature();
return (CreatureAI*)oox22AI;
}
bool QuestAccept_npc_oox22fe(Player* pPlayer, Creature* pCreature, const Quest* pQuest)
{
if (pQuest->GetQuestId() == QUEST_RESCUE_OOX22FE)
{
DoScriptText(SAY_START, pCreature);
//change that the npc is not lying dead on the ground
pCreature->SetStandState(UNIT_STAND_STATE_STAND);
if (pPlayer->GetTeam() == ALLIANCE)
pCreature->setFaction(FACTION_ESCORTEE_A);
if (pPlayer->GetTeam() == HORDE)
pCreature->setFaction(FACTION_ESCORTEE_H);
((npc_escortAI*)(pCreature->AI()))->Start(true, true, false, pPlayer->GetGUID());
}
return true;
}
/*######
## npc_screecher_spirit
######*/
@@ -80,6 +223,12 @@ void AddSC_feralas()
newscript->pGossipSelect = &GossipSelect_npc_gregan_brewspewer;
newscript->RegisterSelf();
newscript = new Script;
newscript->Name = "npc_oox22fe";
newscript->GetAI = &GetAI_npc_oox22fe;
newscript->pQuestAccept = &QuestAccept_npc_oox22fe;
newscript->RegisterSelf();
newscript = new Script;
newscript->Name="npc_screecher_spirit";
newscript->pGossipHello = &GossipHello_npc_screecher_spirit;
@@ -141,6 +141,7 @@ struct TRINITY_DLL_DECL boss_onyxiaAI : public ScriptedAI
DoStartMovement(m_creature->getVictim());
m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE);
DoScriptText(SAY_PHASE_3_TRANS, m_creature);
m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim());
}
if(Phase == 1 || Phase == 3)
@@ -91,24 +91,27 @@ bool GossipSelect_npc_astor_hadren(Player *player, Creature *_Creature, uint32 s
## npc_deathstalker_erland
######*/
#define SAY_QUESTACCEPT -1000335
#define SAY_START -1000336
#define SAY_AGGRO_1 -1000337
#define SAY_AGGRO_2 -1000338
#define SAY_LAST -1000339
enum
{
SAY_QUESTACCEPT = -1000335,
SAY_START = -1000336,
SAY_AGGRO_1 = -1000337,
SAY_AGGRO_2 = -1000338,
SAY_LAST = -1000339,
#define SAY_THANKS -1000340
#define SAY_RANE -1000341
#define SAY_ANSWER -1000342
#define SAY_MOVE_QUINN -1000343
SAY_THANKS = -1000340,
SAY_RANE = -1000341,
SAY_ANSWER = -1000342,
SAY_MOVE_QUINN = -1000343,
#define SAY_GREETINGS -1000344
#define SAY_QUINN -1000345
#define SAY_ON_BYE -1000346
SAY_GREETINGS = -1000344,
SAY_QUINN = -1000345,
SAY_ON_BYE = -1000346,
#define QUEST_ESCORTING 435
#define NPC_RANE 1950
#define NPC_QUINN 1951
QUEST_ESCORTING = 435,
NPC_RANE = 1950,
NPC_QUINN = 1951
};
struct TRINITY_DLL_DECL npc_deathstalker_erlandAI : public npc_escortAI
{
@@ -126,8 +129,7 @@ struct TRINITY_DLL_DECL npc_deathstalker_erlandAI : public npc_escortAI
case 1: DoScriptText(SAY_START, m_creature, player);break;
case 13:
DoScriptText(SAY_LAST, m_creature, player);
if(player)
((Player*)player)->GroupEventHappens(QUEST_ESCORTING, m_creature);break;
player->GroupEventHappens(QUEST_ESCORTING, m_creature);break;
case 14: DoScriptText(SAY_THANKS, m_creature, player);break;
case 15: {
Unit* Rane = FindCreature(NPC_RANE, 20, m_creature);