*script for quest Recharging the Batteries. By Anubisss.

*script for quest The Road to Falcon Watch. By neo0608.

--HG--
branch : trunk
This commit is contained in:
megamage
2008-11-21 17:29:05 -06:00
parent 11c55ba0a1
commit b2ba78e57a
3 changed files with 255 additions and 2 deletions
+2
View File
@@ -0,0 +1,2 @@
UPDATE `creature_template` SET `ScriptName`='npc_wounded_blood_elf' WHERE `entry`='16993';
UPDATE `creature_template` SET `ScriptName` = 'mob_phase_hunter' WHERE `entry` = '18879';
@@ -17,7 +17,7 @@
/* ScriptData
SDName: Hellfire_Peninsula
SD%Complete: 100
SDComment: Quest support: 10129, 10146, 10162, 10163, 10340, 10346, 10347, 10382 (Special flight paths)
SDComment: Quest support: 9375, 10129, 10146, 10162, 10163, 10340, 10346, 10347, 10382 (Special flight paths)
SDCategory: Hellfire Peninsula
EndScriptData */
@@ -25,9 +25,11 @@ EndScriptData */
npc_wing_commander_dabiree
npc_gryphoneer_windbellow
npc_wing_commander_brack
npc_wounded_blood_elf
EndContentData */
#include "precompiled.h"
#include "../../npc/npc_escortAI.h"
/*######
## npc_wing_commander_dabiree
@@ -159,6 +161,151 @@ bool GossipSelect_npc_wing_commander_brack(Player *player, Creature *_Creature,
return true;
}
/*######
## npc_wounded_blood_elf
######*/
#define QUEST_THE_ROAD_TO_FALCON_WATCH 9375
#define SAY1 "Thank you for agreeing to help. Now, let's get out of here $N."
#define SAY2 "Over there! They're following us!"
#define SAY3 "Allow me a moment to rest. The journey taxes what little strength I have."
#define SAY4 "Did you hear something?"
#define SAY5 "Falcon Watch, at last! Now, where's my... Oh no! My pack, it's missing! Where has -"
#define SAYAGGRO "You won't keep me from getting to Falcon Watch!"
struct TRINITY_DLL_DECL npc_wounded_blood_elfAI : public npc_escortAI
{
npc_wounded_blood_elfAI(Creature *c) : npc_escortAI(c) {Reset();}
void WaypointReached(uint32 i)
{
Unit* player = Unit::GetUnit((*m_creature), PlayerGUID);
if (!player)
return;
switch (i)
{
case 0:
DoSay(SAY1, LANG_UNIVERSAL, player);
// Change faction, so mobs can attack
m_creature->setFaction(1610);
break;
case 9:
DoSay(SAY2, LANG_UNIVERSAL, player);
// Spawn two Haal'eshi Talonguard
{
Creature* temp1 = m_creature->SummonCreature(16967, m_creature->GetPositionX()-15, m_creature->GetPositionY()-15, m_creature->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 3000);
if (temp1) temp1->AI()->AttackStart(m_creature);
Creature* temp2 = m_creature->SummonCreature(16967, m_creature->GetPositionX()-17, m_creature->GetPositionY()-17, m_creature->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 3000);
if (temp2) temp2->AI()->AttackStart(m_creature);
}
break;
case 13:
DoSay(SAY3, LANG_UNIVERSAL, player);
// NPC "should" kneel
m_creature->HandleEmoteCommand(EMOTE_STATE_KNEEL);
break;
case 14:
DoSay(SAY4, LANG_UNIVERSAL, player);
// Spawn two Haal'eshi Windwalker
{
Creature* temp3 = m_creature->SummonCreature(16966, m_creature->GetPositionX()-15, m_creature->GetPositionY()-15, m_creature->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 3000);
if (temp3) temp3->AI()->AttackStart(m_creature);
Creature* temp4 = m_creature->SummonCreature(16966, m_creature->GetPositionX()-17, m_creature->GetPositionY()-17, m_creature->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 3000);
if (temp4) temp4->AI()->AttackStart(m_creature);
}
break;
case 27:
DoSay(SAY5, LANG_UNIVERSAL, player);
// Set faction back to normal
m_creature->setFaction(1604);
// Award quest credit
if( PlayerGUID )
{
Unit* player = Unit::GetUnit((*m_creature), PlayerGUID);
if( player && player->GetTypeId() == TYPEID_PLAYER )
((Player*)player)->GroupEventHappens(9375,m_creature);
}
break;
}
}
void Aggro(Unit* who)
{
DoSay(SAYAGGRO, LANG_UNIVERSAL, who);
}
void Reset() { }
void JustDied(Unit* killer)
// If NPC dies, Quest fail
{
if (PlayerGUID)
{
Unit* player = Unit::GetUnit((*m_creature), PlayerGUID);
if (player)
((Player*)player)->FailQuest(QUEST_THE_ROAD_TO_FALCON_WATCH);
}
}
void UpdateAI(const uint32 diff)
{
npc_escortAI::UpdateAI(diff);
}
};
bool QuestAccept_wounded_blood_elf(Player* player, Creature* creature, Quest const* quest)
// Begin the escort quest
{
if (quest->GetQuestId() == QUEST_THE_ROAD_TO_FALCON_WATCH)
{
((npc_escortAI*)(creature->AI()))->Start(true, true, false, player->GetGUID());
}
return true;
}
CreatureAI* GetAI_npc_wounded_blood_elf(Creature *_Creature)
{
npc_wounded_blood_elfAI* thisAI = new npc_wounded_blood_elfAI(_Creature);
thisAI->AddWaypoint(0, -1137.72, 4272.10, 14.04, 3000);
thisAI->AddWaypoint(1, -1141.34, 4232.42, 14.63);
thisAI->AddWaypoint(2, -1133.47, 4220.88, 11.78);
thisAI->AddWaypoint(3, -1126.18, 4213.26, 13.51);
thisAI->AddWaypoint(4, -1100.12, 4204.32, 16.41);
thisAI->AddWaypoint(5, -1063.68, 4197.92, 15.51);
thisAI->AddWaypoint(6, -1027.28, 4194.36, 15.52);
thisAI->AddWaypoint(7, -995.68, 4189.59, 19.84);
thisAI->AddWaypoint(8, -970.90, 4188.60, 24.61);
thisAI->AddWaypoint(9, -961.93, 4193.34, 26.11, 80000); // Summon 1
thisAI->AddWaypoint(10, -935.52, 4210.99, 31.98);
thisAI->AddWaypoint(11, -913.42, 4218.27, 37.29);
thisAI->AddWaypoint(12, -896.53, 4207.73, 43.23);
thisAI->AddWaypoint(13, -868.49, 4194.77, 46.75, 17000); // Kneel and Rest Here
thisAI->AddWaypoint(14, -852.83, 4198.29, 47.28, 80000); // Summon 2
thisAI->AddWaypoint(15, -819.85, 4200.50, 46.37);
thisAI->AddWaypoint(16, -791.92, 4201.96, 44.19);
thisAI->AddWaypoint(17, -774.42, 4202.46, 47.41);
thisAI->AddWaypoint(18, -762.90, 4202.17, 48.81);
thisAI->AddWaypoint(19, -728.25, 4195.35, 50.68);
thisAI->AddWaypoint(20, -713.58, 4192.07, 53.98);
thisAI->AddWaypoint(21, -703.09, 4189.74, 56.96);
thisAI->AddWaypoint(22, -693.70, 4185.43, 57.06);
thisAI->AddWaypoint(23, -686.38, 4159.81, 60.26);
thisAI->AddWaypoint(24, -679.88, 4147.04, 64.20);
thisAI->AddWaypoint(25, -656.74, 4147.72, 64.11);
thisAI->AddWaypoint(26, -652.22, 4137.50, 64.58);
thisAI->AddWaypoint(27, -649.99, 4136.38, 64.63, 20000); // Award Quest Credit
return (CreatureAI*)thisAI;
}
/*######
##
######*/
@@ -184,4 +331,10 @@ void AddSC_hellfire_peninsula()
newscript->pGossipHello = &GossipHello_npc_wing_commander_brack;
newscript->pGossipSelect = &GossipSelect_npc_wing_commander_brack;
newscript->RegisterSelf();
}
newscript = new Script;
newscript->Name="npc_wounded_blood_elf";
newscript->GetAI = &GetAI_npc_wounded_blood_elf;
newscript->pQuestAccept = &QuestAccept_wounded_blood_elf;
newscript->RegisterSelf();
}
@@ -389,6 +389,99 @@ bool GossipSelect_npc_veronia(Player *player, Creature *_Creature, uint32 sender
return true;
}
/*######
## mob_phase_hunter
######*/
#define SUMMONED_MOB 19595
#define EMOTE_WEAK "is very weak"
// Spells
#define SPELL_PHASE_SLIP 36574
#define SPELL_MANA_BURN 13321
struct TRINITY_DLL_DECL mob_phase_hunterAI : public ScriptedAI
{
mob_phase_hunterAI(Creature *c) : ScriptedAI(c) {Reset();}
bool Weak;
int WeakPercent;
uint32 PlayerGUID;
uint32 Health;
uint32 Level;
uint32 PhaseSlipVulnerabilityTimer;
uint32 ManaBurnTimer;
void Reset()
{
Weak = false;
WeakPercent = 25 + (rand()%16); // 25-40
PlayerGUID = 0;
ManaBurnTimer = 5000 + (rand()%3 * 1000); // 5-8 sec cd
}
void Aggro(Unit *who)
{
PlayerGUID = who->GetGUID();
}
void UpdateAI(const uint32 diff)
{
Player* target = NULL;
target = ((Player*)Unit::GetUnit((*m_creature), PlayerGUID));
if(!target)
return;
if(m_creature->HasAuraType(SPELL_AURA_MOD_DECREASE_SPEED) || m_creature->hasUnitState(UNIT_STAT_ROOT)) // if the mob is rooted/slowed by spells eg.: Entangling Roots, Frost Nova, Hamstring, Crippling Poison, etc. => remove it
DoCast(m_creature, SPELL_PHASE_SLIP);
if(ManaBurnTimer < diff) // cast Mana Burn
{
if(target->GetCreateMana() > 0)
{
DoCast(target, SPELL_MANA_BURN);
ManaBurnTimer = 8000 + (rand()%10 * 1000); // 8-18 sec cd
}
}
else ManaBurnTimer -= diff;
if(!Weak && m_creature->GetHealth() < (m_creature->GetMaxHealth() / 100 * WeakPercent) && target->GetQuestStatus(10190) == QUEST_STATUS_INCOMPLETE) // start: support for quest 10190
{
DoTextEmote(EMOTE_WEAK, 0);
Weak = true;
}
if(Weak && m_creature->HasAura(34219, 0))
{
Health = m_creature->GetHealth(); // get the normal mob's data
Level = m_creature->getLevel();
m_creature->AttackStop(); // delete the normal mob
m_creature->DealDamage(m_creature, m_creature->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
m_creature->RemoveCorpse();
Creature* DrainedPhaseHunter = NULL;
if(!DrainedPhaseHunter)
DrainedPhaseHunter = m_creature->SummonCreature(SUMMONED_MOB, m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ(), m_creature->GetOrientation(), TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 60000); // summon the mob
if(DrainedPhaseHunter)
{
DrainedPhaseHunter->SetLevel(Level); // set the summoned mob's data
DrainedPhaseHunter->SetHealth(Health);
DrainedPhaseHunter->AI()->AttackStart(target);
}
} // end: support for quest 10190
}
};
CreatureAI* GetAI_mob_phase_hunter(Creature *_Creature)
{
return new mob_phase_hunterAI (_Creature);
}
/*######
##
######*/
@@ -418,4 +511,9 @@ void AddSC_netherstorm()
newscript->pGossipHello = &GossipHello_npc_veronia;
newscript->pGossipSelect = &GossipSelect_npc_veronia;
newscript->RegisterSelf();
newscript = new Script;
newscript->Name = "mob_phase_hunter";
newscript->GetAI = GetAI_mob_phase_hunter;
newscript->RegisterSelf();
}