*Updated Phase Hunter script. - by Anubiss

*Fix the bug in attumen. - by Anubiss
*Added: support for quest 10198. - by nofantasy
*Remove macro for instance BM and use function instead to determine random mini boss. - by nofantasy
*Replace old npc-script with areatrigger-script (also solve crash-issue) to teleport player. - by nofantasy
*Cleaned up Tidewalker script.

--HG--
branch : trunk
This commit is contained in:
Blaymoira
2008-12-20 19:10:00 +01:00
parent 41e27a9b40
commit 622930c35a
12 changed files with 485 additions and 209 deletions
@@ -22,11 +22,40 @@ SDCategory: Areatrigger
EndScriptData */
/* ContentData
at_legion_teleporter 4560 Teleporter TO Invasion Point: Cataclysm
at_test script test only
EndContentData */
#include "precompiled.h"
/*#####
## at_legion_teleporter
#####*/
#define SPELL_TELE_A_TO 37387
#define SPELL_TELE_H_TO 37389
bool AreaTrigger_at_legion_teleporter(Player *player, AreaTriggerEntry *at)
{
if (player->isAlive() && !player->isInCombat())
{
if (player->GetTeam()== ALLIANCE && player->GetQuestRewardStatus(10589))
{
player->CastSpell(player,SPELL_TELE_A_TO,false);
return true;
}
if (player->GetTeam()== HORDE && player->GetQuestRewardStatus(10604))
{
player->CastSpell(player,SPELL_TELE_H_TO,false);
return true;
}
return false;
}
return false;
}
bool ATtest(Player *player, AreaTriggerEntry *at)
{
player->Say("Hi!",LANG_UNIVERSAL);
@@ -37,6 +66,11 @@ void AddSC_areatrigger_scripts()
{
Script *newscript;
newscript = new Script;
newscript->Name = "at_legion_teleporter";
newscript->pAreaTrigger = &AreaTrigger_at_legion_teleporter;
newscript->RegisterSelf();
newscript = new Script;
newscript->Name="at_test";
newscript->pAreaTrigger = ATtest;
@@ -303,8 +303,8 @@ CreatureAI* GetAI_boss_exarch_maladaar(Creature *_Creature)
return new boss_exarch_maladaarAI (_Creature);
}
#define SPELL_MORTAL_STRIKE 16856
#define SPELL_SUNDER_ARMOR 16145
#define SPELL_AV_MORTAL_STRIKE 16856
#define SPELL_AV_MORTAL_STRIKE 16856
struct TRINITY_DLL_DECL mob_avatar_of_martyredAI : public ScriptedAI
{
@@ -328,7 +328,7 @@ struct TRINITY_DLL_DECL mob_avatar_of_martyredAI : public ScriptedAI
if (Mortal_Strike_timer < diff)
{
DoCast(m_creature->getVictim(), SPELL_MORTAL_STRIKE);
DoCast(m_creature->getVictim(), SPELL_AV_MORTAL_STRIKE);
Mortal_Strike_timer = 10000 + rand()%20 * 1000;
} else Mortal_Strike_timer -= diff;
@@ -55,7 +55,7 @@ struct TRINITY_DLL_DECL boss_murmurAI : public Scripted_NoMovementAI
pTarget = 0;
//database should have `RegenHealth`=0 to prevent regen
uint32 hp = m_creature->GetMaxHealth()*0.4;
uint32 hp = (m_creature->GetMaxHealth()*40)/100;
if (hp)
m_creature->SetHealth(hp);
}
@@ -22,7 +22,6 @@
#define C_TIME_KEEPER 17918
#define C_RKEEP 21104
#define C_RLORD 17839
#define RIFT_BOSS (rand()%2 ? C_RKEEP : C_RLORD)
#define C_DEJA 17879
#define C_TEMPO 17880
#define C_AEONUS 17881
@@ -30,6 +30,9 @@ EndScriptData */
#define C_TIME_RIFT 17838
#define SPELL_RIFT_CHANNEL 31387
#define RIFT_BOSS 1
inline uint32 RandRiftBoss() { return rand()%2 ? C_RKEEP : C_RLORD; }
float PortalLocation[4][4]=
{
@@ -271,6 +274,9 @@ struct TRINITY_DLL_DECL instance_dark_portal : public ScriptedInstance
Unit* SummonedPortalBoss(Unit* source)
{
uint32 entry = RiftWaves[GetRiftWaveId()].PortalBoss;
if (entry == RIFT_BOSS)
entry = RandRiftBoss();
float x,y,z;
source->GetRandomPoint(source->GetPositionX(),source->GetPositionY(),source->GetPositionZ(),10.0f,x,y,z);
//normalize Z-level if we can, if rift is not at ground level.
@@ -153,66 +153,6 @@ struct TRINITY_DLL_DECL boss_morogrim_tidewalkerAI : public ScriptedAI
}
}
/*void ApplyWateryGrave(Unit *player, uint8 pos)
{
float x, y, z;
switch(pos)
{
case 0:
x = WATERY_GRAVE_X1;
y = WATERY_GRAVE_Y1;
z = WATERY_GRAVE_Z1;
break;
case 1:
x = WATERY_GRAVE_X2;
y = WATERY_GRAVE_Y2;
z = WATERY_GRAVE_Z2;
break;
case 2:
x = WATERY_GRAVE_X3;
y = WATERY_GRAVE_Y3;
z = WATERY_GRAVE_Z3;
break;
case 3:
x = WATERY_GRAVE_X4;
y = WATERY_GRAVE_Y4;
z = WATERY_GRAVE_Z4;
break;
}
DoTeleportPlayer(player, x, y, z+1, player->GetOrientation());
DoCast(player, SPELL_WATERY_GRAVE);
}*/
/*void SummonMurloc(float x, float y, float z)
{
Creature *Summoned;
Summoned = m_creature->SummonCreature(TIDEWALKER_LURKER, x, y, z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000);
if (Summoned)
{
Unit *target = NULL;
target = SelectUnit(SELECT_TARGET_RANDOM, 0);
if (target)
Summoned->AI()->AttackStart(target);
}
}*/
/*void SummonWaterGlobule(float x, float y, float z)
{
Creature *Globule;
Globule = m_creature->SummonCreature(WATER_GLOBULE, x, y, z, 0, TEMPSUMMON_TIMED_DESPAWN, 30000); //they despawn after 30 seconds
if (Globule)
{
Unit *target = NULL;
target = SelectUnit(SELECT_TARGET_RANDOM, 0);
if (target)
Globule->AI()->AttackStart(target);
}
}*/
void UpdateAI(const uint32 diff)
{
//Return since we have no target
@@ -236,30 +176,16 @@ struct TRINITY_DLL_DECL boss_morogrim_tidewalkerAI : public ScriptedAI
case 1: DoScriptText(SAY_SUMMON2, m_creature); break;
}
/*//north
SummonMurloc(486.10, -723.64, -7.14);
SummonMurloc(482.58, -723.78, -7.14);
SummonMurloc(479.38, -723.91, -7.14);
SummonMurloc(476.03, -723.86, -7.14);
SummonMurloc(472.69, -723.69, -7.14);
SummonMurloc(469.04, -723.63, -7.14);
//south
SummonMurloc(311.63, -725.04, -13.15);
SummonMurloc(307.81, -725.34, -13.15);
SummonMurloc(303.91, -725.64, -13.06);
SummonMurloc(300.23, -726, -11.89);
SummonMurloc(296.82, -726.33, -10.82);
SummonMurloc(293.64, -726.64, -9.81);*/
if(Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0))
{
//north
DoCast(target, SPELL_SUMMON_MURLOC_A6);
DoCast(target, SPELL_SUMMON_MURLOC_A7);
DoCast(target, SPELL_SUMMON_MURLOC_A8);
DoCast(target, SPELL_SUMMON_MURLOC_A9);
DoCast(target, SPELL_SUMMON_MURLOC_A10);
//south
DoCast(target, SPELL_SUMMON_MURLOC_B6);
DoCast(target, SPELL_SUMMON_MURLOC_B7);
DoCast(target, SPELL_SUMMON_MURLOC_B8);
@@ -313,10 +239,6 @@ struct TRINITY_DLL_DECL boss_morogrim_tidewalkerAI : public ScriptedAI
//WateryGlobules_Timer
if (WateryGlobules_Timer < diff)
{
/*SummonWaterGlobule(WATERY_GRAVE_X1, WATERY_GRAVE_Y1, WATERY_GRAVE_Z1);
SummonWaterGlobule(WATERY_GRAVE_X2, WATERY_GRAVE_Y2, WATERY_GRAVE_Z2);
SummonWaterGlobule(WATERY_GRAVE_X3, WATERY_GRAVE_Y3, WATERY_GRAVE_Z3);
SummonWaterGlobule(WATERY_GRAVE_X4, WATERY_GRAVE_Y4, WATERY_GRAVE_Z4);*/
if(Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0))
{
DoCast(target, SPELL_SUMMON_WATER_GLOBULE_1);
@@ -101,25 +101,26 @@ struct TRINITY_DLL_DECL boss_midnightAI : public ScriptedAI
}
else if(Phase ==3)
{
if(Mount_Timer)
if(Mount_Timer <= diff)
{
Mount_Timer = 0;
m_creature->SetVisibility(VISIBILITY_OFF);
m_creature->GetMotionMaster()->MoveIdle();
if (Unit *pAttumen = Unit::GetUnit(*m_creature, Attumen))
{
pAttumen->SetUInt32Value(UNIT_FIELD_DISPLAYID, MOUNTED_DISPLAYID);
pAttumen->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
if(pAttumen->getVictim())
{
pAttumen->GetMotionMaster()->MoveChase(pAttumen->getVictim());
pAttumen->SetUInt64Value(UNIT_FIELD_TARGET, pAttumen->getVictim()->GetGUID());
}
pAttumen->SetFloatValue(OBJECT_FIELD_SCALE_X,1);
if(Mount_Timer)
{
if(Mount_Timer <= diff)
{
Mount_Timer = 0;
m_creature->SetVisibility(VISIBILITY_OFF);
m_creature->GetMotionMaster()->MoveIdle();
if (Unit *pAttumen = Unit::GetUnit(*m_creature, Attumen))
{
pAttumen->SetUInt32Value(UNIT_FIELD_DISPLAYID, MOUNTED_DISPLAYID);
pAttumen->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
if(pAttumen->getVictim())
{
pAttumen->GetMotionMaster()->MoveChase(pAttumen->getVictim());
pAttumen->SetUInt64Value(UNIT_FIELD_TARGET, pAttumen->getVictim()->GetGUID());
}
pAttumen->SetFloatValue(OBJECT_FIELD_SCALE_X,1);
}
} else Mount_Timer -= diff;
}
}
}
if(Phase != 3)
@@ -201,29 +202,27 @@ struct TRINITY_DLL_DECL boss_attumenAI : public ScriptedAI
{
DoScriptText(SAY_DEATH, m_creature);
if (Unit *pMidnight = Unit::GetUnit(*m_creature, Midnight))
{
pMidnight->DealDamage(pMidnight, pMidnight->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
}
pMidnight->DealDamage(pMidnight, pMidnight->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
}
void UpdateAI(const uint32 diff)
{
if(ResetTimer)
if(ResetTimer <= diff)
{
ResetTimer = 0;
Unit *pMidnight = Unit::GetUnit(*m_creature, Midnight);
if(pMidnight)
{
pMidnight->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
pMidnight->SetVisibility(VISIBILITY_ON);
}
Midnight = 0;
m_creature->SetVisibility(VISIBILITY_OFF);
m_creature->DealDamage(m_creature, m_creature->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
}
else ResetTimer -= diff;
if(ResetTimer)
{
if(ResetTimer <= diff)
{
ResetTimer = 0;
Unit *pMidnight = Unit::GetUnit(*m_creature, Midnight);
if(pMidnight)
{
pMidnight->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
pMidnight->SetVisibility(VISIBILITY_ON);
}
Midnight = 0;
m_creature->SetVisibility(VISIBILITY_OFF);
m_creature->DealDamage(m_creature, m_creature->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
}
} else ResetTimer -= diff;
//Return since we have no target
if (!m_creature->SelectHostilTarget() || !m_creature->getVictim())
@@ -293,10 +292,8 @@ struct TRINITY_DLL_DECL boss_attumenAI : public ScriptedAI
void SpellHit(Unit *source, const SpellEntry *spell)
{
if(spell->Mechanic == MECHANIC_DISARM)
{
DoScriptText(SAY_DISARMED, m_creature);
}
if(spell->Mechanic == MECHANIC_DISARM)
DoScriptText(SAY_DISARMED, m_creature);
}
};
@@ -451,7 +451,7 @@ struct TRINITY_DLL_DECL boss_malchezaarAI : public ScriptedAI
m_creature->SetFloatValue(UNIT_FIELD_MINOFFHANDDAMAGE, cinfo->mindmg);
m_creature->SetFloatValue(UNIT_FIELD_MAXOFFHANDDAMAGE, cinfo->maxdmg);
m_creature->SetAttackTime(OFF_ATTACK, (((uint32)m_creature->GetAttackTime(BASE_ATTACK)/1.5)));
m_creature->SetAttackTime(OFF_ATTACK, (m_creature->GetAttackTime(BASE_ATTACK)*150)/100);
}
}
else if(phase == 2)
@@ -17,13 +17,14 @@
/* ScriptData
SDName: Netherstorm
SD%Complete: 75
SDComment: Quest support: 10438, 10652 (special flight paths), 10299,10321,10322,10323,10329,10330,10338,10365(Shutting Down Manaforge)
SDComment: Quest support: 10438, 10652 (special flight paths), 10299,10321,10322,10323,10329,10330,10338,10365(Shutting Down Manaforge), 10198
SDCategory: Netherstorm
EndScriptData */
/* ContentData
npc_manaforge_control_console
go_manaforge_control_console
npc_commander_dawnforge
npc_protectorate_nether_drake
npc_veronia
EndContentData */
@@ -330,6 +331,341 @@ bool GOHello_go_manaforge_control_console(Player *player, GameObject* _GO)
return true;
}
/*######
## npc_commander_dawnforge
######*/
// The Speech of Dawnforge, Ardonis & Pathaleon
#define SAY_COMMANDER_DAWNFORGE_1 -1000128
#define SAY_ARCANIST_ARDONIS_1 -1000129
#define SAY_COMMANDER_DAWNFORGE_2 -1000130
#define SAY_PATHALEON_CULATOR_IMAGE_1 -1000131
#define SAY_COMMANDER_DAWNFORGE_3 -1000132
#define SAY_PATHALEON_CULATOR_IMAGE_2 -1000133
#define SAY_PATHALEON_CULATOR_IMAGE_2_1 -1000134
#define SAY_PATHALEON_CULATOR_IMAGE_2_2 -1000135
#define SAY_COMMANDER_DAWNFORGE_4 -1000136
#define SAY_ARCANIST_ARDONIS_2 -1000136
#define SAY_COMMANDER_DAWNFORGE_5 -1000137
#define QUEST_INFO_GATHERING 10198
#define SPELL_SUNFURY_DISGUISE 34603
// Entries of Arcanist Ardonis, Commander Dawnforge, Pathaleon the Curators Image
int CreatureEntry[3][1] =
{
{19830}, // Ardonis
{19831}, // Dawnforge
{21504} // Pathaleon
};
struct TRINITY_DLL_DECL npc_commander_dawnforgeAI : public ScriptedAI
{
npc_commander_dawnforgeAI(Creature *c) : ScriptedAI(c) { Reset (); }
uint64 playerGUID;
uint64 ardonisGUID;
uint64 pathaleonGUID;
uint32 Phase;
uint32 PhaseSubphase;
uint32 Phase_Timer;
bool isEvent;
float angle_dawnforge;
float angle_ardonis;
void Reset()
{
playerGUID = 0;
ardonisGUID = 0;
pathaleonGUID = 0;
Phase = 1;
PhaseSubphase = 0;
Phase_Timer = 4000;
isEvent = false;
}
void Aggro(Unit *who) { }
//Select any creature in a grid
Creature* SelectCreatureInGrid(uint32 entry, float range)
{
Creature* pCreature = NULL;
CellPair pair(Trinity::ComputeCellPair(m_creature->GetPositionX(), m_creature->GetPositionY()));
Cell cell(pair);
cell.data.Part.reserved = ALL_DISTRICT;
cell.SetNoCreate();
Trinity::NearestCreatureEntryWithLiveStateInObjectRangeCheck creature_check(*m_creature, entry, true, range);
Trinity::CreatureLastSearcher<Trinity::NearestCreatureEntryWithLiveStateInObjectRangeCheck> searcher(pCreature, creature_check);
TypeContainerVisitor<Trinity::CreatureLastSearcher<Trinity::NearestCreatureEntryWithLiveStateInObjectRangeCheck>, GridTypeMapContainer> creature_searcher(searcher);
CellLock<GridReadGuard> cell_lock(cell, pair);
cell_lock->Visit(cell_lock, creature_searcher,*(m_creature->GetMap()));
return pCreature;
}
void JustSummoned(Creature *summoned)
{
pathaleonGUID = summoned->GetGUID();
}
// Emote Ardonis and Pathaleon
void Turn_to_Pathaleons_Image()
{
Unit *ardonis = Unit::GetUnit(*m_creature,ardonisGUID);
Unit *pathaleon = Unit::GetUnit(*m_creature,pathaleonGUID);
Player *player = (Player*)Unit::GetUnit(*m_creature,playerGUID);
if (!ardonis || !pathaleon || !player)
return;
//Calculate the angle to Pathaleon
angle_dawnforge = m_creature->GetAngle(pathaleon->GetPositionX(), pathaleon->GetPositionY());
angle_ardonis = ardonis->GetAngle(pathaleon->GetPositionX(), pathaleon->GetPositionY());
//Turn Dawnforge and update
m_creature->SetOrientation(angle_dawnforge);
m_creature->SendUpdateToPlayer(player);
//Turn Ardonis and update
ardonis->SetOrientation(angle_ardonis);
ardonis->SendUpdateToPlayer(player);
//Set them to kneel
m_creature->SetStandState(PLAYER_STATE_KNEEL);
ardonis->SetStandState(PLAYER_STATE_KNEEL);
}
//Set them back to each other
void Turn_to_eachother()
{
if (Unit *ardonis = Unit::GetUnit(*m_creature,ardonisGUID))
{
Player *player = (Player*)Unit::GetUnit(*m_creature,playerGUID);
if (!player)
return;
angle_dawnforge = m_creature->GetAngle(ardonis->GetPositionX(), ardonis->GetPositionY());
angle_ardonis = ardonis->GetAngle(m_creature->GetPositionX(), m_creature->GetPositionY());
//Turn Dawnforge and update
m_creature->SetOrientation(angle_dawnforge);
m_creature->SendUpdateToPlayer(player);
//Turn Ardonis and update
ardonis->SetOrientation(angle_ardonis);
ardonis->SendUpdateToPlayer(player);
//Set state
m_creature->SetStandState(PLAYER_STATE_NONE);
ardonis->SetStandState(PLAYER_STATE_NONE);
}
}
bool CanStartEvent(Player *player)
{
if (!isEvent)
{
Creature *ardonis = SelectCreatureInGrid(CreatureEntry[0][0], 10.0f);
if (!ardonis)
return false;
ardonisGUID = ardonis->GetGUID();
playerGUID = player->GetGUID();
isEvent = true;
Turn_to_eachother();
return true;
}
debug_log("SD2: npc_commander_dawnforge event already in progress, need to wait.");
return false;
}
void UpdateAI(const uint32 diff)
{
//Is event even running?
if (!isEvent)
return;
//Phase timing
if (Phase_Timer >= diff)
{
Phase_Timer -= diff;
return;
}
Unit *ardonis = Unit::GetUnit(*m_creature,ardonisGUID);
Unit *pathaleon = Unit::GetUnit(*m_creature,pathaleonGUID);
Player *player = (Player*)Unit::GetUnit(*m_creature,playerGUID);
if (!ardonis || !player)
{
Reset();
return;
}
if (Phase > 4 && !pathaleon)
{
Reset();
return;
}
//Phase 1 Dawnforge say
switch (Phase)
{
case 1:
DoScriptText(SAY_COMMANDER_DAWNFORGE_1, m_creature);
++Phase;
Phase_Timer = 16000;
break;
//Phase 2 Ardonis say
case 2:
DoScriptText(SAY_ARCANIST_ARDONIS_1, ardonis);
++Phase;
Phase_Timer = 16000;
break;
//Phase 3 Dawnforge say
case 3:
DoScriptText(SAY_COMMANDER_DAWNFORGE_2, m_creature);
++Phase;
Phase_Timer = 16000;
break;
//Phase 4 Pathaleon spawns up to phase 9
case 4:
//spawn pathaleon's image
m_creature->SummonCreature(CreatureEntry[2][0], 2325.851563, 2799.534668, 133.084229, 6.038996, TEMPSUMMON_TIMED_DESPAWN, 90000);
++Phase;
Phase_Timer = 500;
break;
//Phase 5 Pathaleon say
case 5:
DoScriptText(SAY_PATHALEON_CULATOR_IMAGE_1, pathaleon);
++Phase;
Phase_Timer = 6000;
break;
//Phase 6
case 6:
switch(PhaseSubphase)
{
//Subphase 1: Turn Dawnforge and Ardonis
case 0:
Turn_to_Pathaleons_Image();
++PhaseSubphase;
Phase_Timer = 8000;
break;
//Subphase 2 Dawnforge say
case 1:
DoScriptText(SAY_COMMANDER_DAWNFORGE_3, m_creature);
PhaseSubphase = 0;
++Phase;
Phase_Timer = 8000;
break;
}
break;
//Phase 7 Pathaleons say 3 Sentence, every sentence need a subphase
case 7:
switch(PhaseSubphase)
{
//Subphase 1
case 0:
DoScriptText(SAY_PATHALEON_CULATOR_IMAGE_2, pathaleon);
++PhaseSubphase;
Phase_Timer = 12000;
break;
//Subphase 2
case 1:
DoScriptText(SAY_PATHALEON_CULATOR_IMAGE_2_1, pathaleon);
++PhaseSubphase;
Phase_Timer = 16000;
break;
//Subphase 3
case 2:
DoScriptText(SAY_PATHALEON_CULATOR_IMAGE_2_2, pathaleon);
PhaseSubphase = 0;
++Phase;
Phase_Timer = 10000;
break;
}
break;
//Phase 8 Dawnforge & Ardonis say
case 8:
DoScriptText(SAY_COMMANDER_DAWNFORGE_4, m_creature);
DoScriptText(SAY_ARCANIST_ARDONIS_2, ardonis);
++Phase;
Phase_Timer = 4000;
break;
//Phase 9 Pathaleons Despawn, Reset Dawnforge & Ardonis angle
case 9:
Turn_to_eachother();
//hide pathaleon, unit will despawn shortly
pathaleon->SetVisibility(VISIBILITY_OFF);
PhaseSubphase = 0;
++Phase;
Phase_Timer = 3000;
break;
//Phase 10 Dawnforge say
case 10:
DoScriptText(SAY_COMMANDER_DAWNFORGE_5, m_creature);
player->AreaExploredOrEventHappens(QUEST_INFO_GATHERING);
Reset();
break;
}
}
};
CreatureAI* GetAI_npc_commander_dawnforge(Creature* _Creature)
{
return new npc_commander_dawnforgeAI(_Creature);
}
Creature* SearchDawnforge(Player *source, uint32 entry, float range)
{
Creature* pCreature = NULL;
CellPair pair(Trinity::ComputeCellPair(source->GetPositionX(), source->GetPositionY()));
Cell cell(pair);
cell.data.Part.reserved = ALL_DISTRICT;
cell.SetNoCreate();
Trinity::NearestCreatureEntryWithLiveStateInObjectRangeCheck creature_check(*source, entry, true, range);
Trinity::CreatureLastSearcher<Trinity::NearestCreatureEntryWithLiveStateInObjectRangeCheck> searcher(pCreature, creature_check);
TypeContainerVisitor<Trinity::CreatureLastSearcher<Trinity::NearestCreatureEntryWithLiveStateInObjectRangeCheck>, GridTypeMapContainer> creature_searcher(searcher);
CellLock<GridReadGuard> cell_lock(cell, pair);
cell_lock->Visit(cell_lock, creature_searcher,*(source->GetMap()));
return pCreature;
}
bool AreaTrigger_at_commander_dawnforge(Player *player, AreaTriggerEntry *at)
{
//if player lost aura or not have at all, we should not try start event.
if (!player->HasAura(SPELL_SUNFURY_DISGUISE,0))
return false;
if (player->isAlive() && player->GetQuestStatus(QUEST_INFO_GATHERING) == QUEST_STATUS_INCOMPLETE)
{
Creature* Dawnforge = SearchDawnforge(player, CreatureEntry[1][0], 30.0f);
if (!Dawnforge)
return false;
if (((npc_commander_dawnforgeAI*)Dawnforge->AI())->CanStartEvent(player))
return true;
}
return false;
}
/*######
## npc_protectorate_nether_drake
######*/
@@ -393,12 +729,14 @@ bool GossipSelect_npc_veronia(Player *player, Creature *_Creature, uint32 sender
## mob_phase_hunter
######*/
#define SUMMONED_MOB 19595
#define EMOTE_WEAK "is very weak"
#define SUMMONED_MOB 19595
#define EMOTE_WEAK "is very weak"
// Spells
#define SPELL_PHASE_SLIP 36574
#define SPELL_MANA_BURN 13321
#define SPELL_PHASE_SLIP 36574
#define SPELL_MANA_BURN 13321
#define SPELL_MATERIALIZE 34804
#define SPELL_DE_MATERIALIZE 34804
struct TRINITY_DLL_DECL mob_phase_hunterAI : public ScriptedAI
{
@@ -406,6 +744,8 @@ struct TRINITY_DLL_DECL mob_phase_hunterAI : public ScriptedAI
mob_phase_hunterAI(Creature *c) : ScriptedAI(c) {Reset();}
bool Weak;
bool Materialize;
int WeakPercent;
uint32 PlayerGUID;
uint32 Health;
@@ -416,6 +756,8 @@ struct TRINITY_DLL_DECL mob_phase_hunterAI : public ScriptedAI
void Reset()
{
Weak = false;
Materialize = false;
WeakPercent = 25 + (rand()%16); // 25-40
PlayerGUID = 0;
ManaBurnTimer = 5000 + (rand()%3 * 1000); // 5-8 sec cd
@@ -426,9 +768,20 @@ struct TRINITY_DLL_DECL mob_phase_hunterAI : public ScriptedAI
PlayerGUID = who->GetGUID();
}
void SpellHit(Unit *caster, const SpellEntry *spell)
{
DoCast(m_creature, SPELL_DE_MATERIALIZE);
}
void UpdateAI(const uint32 diff)
{
if(!Materialize)
{
DoCast(m_creature, SPELL_MATERIALIZE);
Materialize = true;
}
Player* target = NULL;
target = ((Player*)Unit::GetUnit((*m_creature), PlayerGUID));
@@ -501,6 +854,16 @@ void AddSC_netherstorm()
newscript->GetAI = GetAI_npc_manaforge_control_console;
newscript->RegisterSelf();
newscript = new Script;
newscript->Name = "npc_commander_dawnforge";
newscript->GetAI = GetAI_npc_commander_dawnforge;
newscript->RegisterSelf();
newscript = new Script;
newscript->Name = "at_commander_dawnforge";
newscript->pAreaTrigger = &AreaTrigger_at_commander_dawnforge;
newscript->RegisterSelf();
newscript = new Script;
newscript->Name="npc_protectorate_nether_drake";
newscript->pGossipHello = &GossipHello_npc_protectorate_nether_drake;
@@ -17,7 +17,7 @@
/* ScriptData
SDName: Shadowmoon_Valley
SD%Complete: 100
SDComment: Quest support: 10519, 10583, 10601, 10814, 10804, 10854, 11082, 11108. Vendor Drake Dealer Hurlunk. Teleporter TO Invasion Point: Cataclysm
SDComment: Quest support: 10519, 10583, 10601, 10814, 10804, 10854, 11082. Vendor Drake Dealer Hurlunk.
SDCategory: Shadowmoon Valley
EndScriptData */
@@ -25,7 +25,6 @@ EndScriptData */
mob_mature_netherwing_drake
mob_enslaved_netherwing_drake
npc_drake_dealer_hurlunk
npc_invis_legion_teleporter
npcs_flanis_swiftwing_and_kagrosh
npc_murkblood_overseer
npc_neltharaku
@@ -411,68 +410,6 @@ bool GossipSelect_npc_drake_dealer_hurlunk(Player *player, Creature *_Creature,
return true;
}
/*######
## npc_invis_legion_teleporter
######*/
#define SPELL_TELE_A_TO 37387
#define SPELL_TELE_H_TO 37389
struct TRINITY_DLL_DECL npc_invis_legion_teleporterAI : public ScriptedAI
{
npc_invis_legion_teleporterAI(Creature *c) : ScriptedAI(c) {Reset();}
uint64 PlayerGuid;
uint32 TeleTimer;
void Reset()
{
PlayerGuid=0;
TeleTimer = 5000;
}
void Aggro(Unit* who)
{
}
void MoveInLineOfSight(Unit *who)
{
if (!who || who->GetTypeId() != TYPEID_PLAYER)
return;
if(who->GetTypeId() == TYPEID_PLAYER && m_creature->GetDistance(who)<4)
{
if (who->isAlive() || !who->isInCombat())
PlayerGuid = who->GetGUID();
}
}
void UpdateAI(const uint32 diff)
{
if(TeleTimer < diff)
{
if(PlayerGuid)
{
Player* player = ((Player*)Unit::GetUnit((*m_creature), PlayerGuid));
if(m_creature->GetDistance(player)<3)
{
if(player->GetTeam()== ALLIANCE && player->GetQuestRewardStatus(10589))
player->CastSpell(player,SPELL_TELE_A_TO,false);
if(player->GetTeam()== HORDE && player->GetQuestRewardStatus(10604))
player->CastSpell(player,SPELL_TELE_H_TO,false);
}
PlayerGuid=0;
}
TeleTimer = 5000;
}else TeleTimer -= diff;
}
};
CreatureAI* GetAI_npc_invis_legion_teleporter(Creature *_Creature)
{
return new npc_invis_legion_teleporterAI (_Creature);
}
/*######
## npc_flanis_swiftwing_and_kagrosh
######*/
@@ -1124,11 +1061,6 @@ void AddSC_shadowmoon_valley()
newscript->pGossipSelect = &GossipSelect_npc_drake_dealer_hurlunk;
newscript->RegisterSelf();
newscript = new Script;
newscript->Name="npc_invis_legion_teleporter";
newscript->GetAI = GetAI_npc_invis_legion_teleporter;
newscript->RegisterSelf();
newscript = new Script;
newscript->Name="npcs_flanis_swiftwing_and_kagrosh";
newscript->pGossipHello = &GossipHello_npcs_flanis_swiftwing_and_kagrosh;
@@ -199,17 +199,18 @@ struct TRINITY_DLL_DECL mobs_spectral_ghostly_citizenAI : public ScriptedAI
{
if (Tagged)
{
for(uint8 i = 0; i < 4; i++)
for(uint32 i = 1; i <= 4; i++)
{
float x,y,z;
m_creature->GetRandomPoint(m_creature->GetPositionX(),m_creature->GetPositionY(),m_creature->GetPositionZ(),25.0f,x,y,z);
m_creature->GetRandomPoint(m_creature->GetPositionX(),m_creature->GetPositionY(),m_creature->GetPositionZ(),20.0f,x,y,z);
int j = rand()%i;
if (!j)
m_creature->SummonCreature(ENTRY_RESTLESS,x,y,z,0,TEMPSUMMON_CORPSE_DESPAWN,600000);
}
}
}
//100%, 50%, 33%, 25% chance to spawn
uint32 j = urand(1,i);
if (j==1)
m_creature->SummonCreature(ENTRY_RESTLESS,x,y,z,0,TEMPSUMMON_CORPSE_DESPAWN,600000);
}
}
}
void UpdateAI(const uint32 diff)
{