*Update to Trinity 759.

--HG--
branch : trunk
This commit is contained in:
megamage
2009-01-02 10:35:19 -06:00
19 changed files with 813 additions and 65 deletions
+2
View File
@@ -342,6 +342,7 @@ extern void AddSC_boss_moroes();
extern void AddSC_bosses_opera();
extern void AddSC_instance_karazhan();
extern void AddSC_karazhan();
extern void AddSC_boss_nightbane();
//Loch Modan
extern void AddSC_loch_modan();
@@ -1547,6 +1548,7 @@ void ScriptsInit()
AddSC_bosses_opera();
AddSC_instance_karazhan();
AddSC_karazhan();
AddSC_boss_nightbane();
//Loch Modan
AddSC_loch_modan();
+13 -44
View File
@@ -740,55 +740,24 @@ void ScriptedAI::DoTeleportAll(float x, float y, float z, float o)
i_pl->TeleportTo(m_creature->GetMapId(), x, y, z, o, TELE_TO_NOT_LEAVE_COMBAT);
}
Unit* ScriptedAI::FindCreature(uint32 entry, uint32 range, uint32 district)
Unit* ScriptedAI::FindCreature(uint32 entry, float range)
{
CellPair pair(Trinity::ComputeCellPair(m_creature->GetPositionX(), m_creature->GetPositionY()));
Cell cell(pair);
cell.data.Part.reserved = district;
cell.SetNoCreate();
std::list<Creature*> NPCList;
Creature* target = NULL;
Trinity::AllCreaturesOfEntryInRange check(m_creature, entry, range);
Trinity::CreatureListSearcher<Trinity::AllCreaturesOfEntryInRange> searcher(NPCList, check);
TypeContainerVisitor<Trinity::CreatureListSearcher<Trinity::AllCreaturesOfEntryInRange>, GridTypeMapContainer> visitor(searcher);
CellLock<GridReadGuard> cell_lock(cell, pair);
cell_lock->Visit(cell_lock, visitor, *(m_creature->GetMap()));
if (!NPCList.empty())
{
for(std::list<Creature*>::iterator itr = NPCList.begin(); itr != NPCList.end(); ++itr)
{
return Creature::GetUnit((*m_creature), (*itr)->GetGUID());
}
}else error_log("SD2 ERROR: Entry: %u not found!", entry); return NULL;
Trinity::CreatureSearcher<Trinity::AllCreaturesOfEntryInRange> searcher(target, check);
m_creature->VisitNearbyGridObject(range, searcher);
if(!target) error_log("SD2 ERROR: Entry: %u not found!", entry);
return target;
}
GameObject* ScriptedAI::FindGameObject(uint32 entry, uint32 district)
GameObject* ScriptedAI::FindGameObject(uint32 entry, float range)
{
CellPair pair(Trinity::ComputeCellPair(m_creature->GetPositionX(), m_creature->GetPositionY()));
Cell cell(pair);
cell.data.Part.reserved = district;
cell.SetNoCreate();
std::list<GameObject*> GOList;
Trinity::AllGameObjectsWithEntryInGrid go_check(entry);
Trinity::GameObjectListSearcher<Trinity::AllGameObjectsWithEntryInGrid> go_search(GOList, go_check);
TypeContainerVisitor
<Trinity::GameObjectListSearcher<Trinity::AllGameObjectsWithEntryInGrid>, GridTypeMapContainer> go_visit(go_search);
CellLock<GridReadGuard> cell_lock(cell, pair);
cell_lock->Visit(cell_lock, go_visit, *(m_creature->GetMap()));
if (!GOList.empty())
{
for(std::list<GameObject*>::iterator itr = GOList.begin(); itr != GOList.end(); ++itr)
{
return (*itr);
}
}
else error_log("SD2 ERROR: GameObject Entry: %u not found!", entry); return NULL;
GameObject* target = NULL;
Trinity::AllGameObjectsWithEntryInGrid go_check(entry);
Trinity::GameObjectSearcher<Trinity::AllGameObjectsWithEntryInGrid> searcher(target, go_check);
m_creature->VisitNearbyGridObject(range, searcher);
if(!target) error_log("SD2 ERROR: Entry: %u not found!", entry);
return target;
}
Unit* ScriptedAI::DoSelectLowestHpFriendly(float range, uint32 MinHPDiff)
+2 -2
View File
@@ -149,10 +149,10 @@ struct TRINITY_DLL_DECL ScriptedAI : public CreatureAI
void DoTeleportAll(float x, float y, float z, float o);
//Get a single creature of given entry
Unit* FindCreature(uint32 entry, uint32 range, uint32 district = ALL_DISTRICT);
Unit* FindCreature(uint32 entry, float range);
//Get a single gameobject of given entry
GameObject* FindGameObject(uint32 entry, uint32 district = ALL_DISTRICT);
GameObject* FindGameObject(uint32 entry, float range);
//Returns friendly unit with the most amount of hp missing from max hp
Unit* DoSelectLowestHpFriendly(float range, uint32 MinHPDiff = 1);
@@ -34,7 +34,7 @@ EndContentData */
#define SAY_PROGRESS_1 "Ok, $N. Follow me to the cave where I'll attempt to harness the power of the rune stone into these goggles."
#define SAY_PROGRESS_2 "I discovered this cave on our first day here. I believe the energy in the stone can be used to our advantage."
#define SAY_PROGRESS_3 "I'll begin drawing energy from the stone. Your job, $N, i to defend me. This place is cursed... trust me."
#define SAY_PROGRESS_3 "I'll begin drawing energy from the stone. Your job, $N, is to defend me. This place is cursed... trust me."
#define EMOTE_PROGRESS_4 "begins tinkering with the goggles before the stone."
#define SAY_AGGRO "Help!!! Get these things off me so I can get my work done!"
#define SAY_PROGRESS_5 "Almost done! Just a little longer!"
@@ -61,10 +61,8 @@ struct TRINITY_DLL_DECL npc_professor_phizzlethorpeAI : public npc_escortAI
case 8:DoTextEmote(EMOTE_PROGRESS_4, NULL);break;
case 9:
{
Creature* sum1 = m_creature->SummonCreature(MOB_VENGEFUL_SURGE, -2052.96, -2142.49, 20.15, 1.0f, TEMPSUMMON_DEAD_DESPAWN, 0);
Creature* sum2 = m_creature->SummonCreature(MOB_VENGEFUL_SURGE, -2052.96, -2142.49, 20.15, 1.0f, TEMPSUMMON_DEAD_DESPAWN, 0);
sum1->Attack(m_creature, true);
sum2->Attack(m_creature, true);
m_creature->SummonCreature(MOB_VENGEFUL_SURGE, -2052.96, -2142.49, 20.15, 1.0f, TEMPSUMMON_CORPSE_DESPAWN, 0);
m_creature->SummonCreature(MOB_VENGEFUL_SURGE, -2052.96, -2142.49, 20.15, 1.0f, TEMPSUMMON_CORPSE_DESPAWN, 0);
break;
}
case 10:DoSay(SAY_PROGRESS_5, LANG_UNIVERSAL, player, true);break;
@@ -73,11 +71,17 @@ struct TRINITY_DLL_DECL npc_professor_phizzlethorpeAI : public npc_escortAI
case 20:
DoTextEmote(EMOTE_PROGRESS_8, NULL);
DoSay(SAY_PROGRESS_9, LANG_UNIVERSAL, player, true);
if(player)
((Player*)player)->GroupEventHappens(QUEST_SUNKEN_TREASURE, m_creature);
break;
}
}
void JustSummoned(Creature *summoned)
{
summoned->AI()->AttackStart(m_creature);
}
void Reset(){}
void Aggro(Unit* who)
@@ -1879,7 +1879,7 @@ void boss_illidan_stormrageAI::JustSummoned(Creature* summon)
Unit *target = SelectUnit(SELECT_TARGET_TOPAGGRO, 0, 999, true);
if(!target || target->HasAura(SPELL_PARASITIC_SHADOWFIEND, 0)
|| target->HasAura(SPELL_PARASITIC_SHADOWFIEND2, 0))
target = SelectUnit(SELECT_TARGET_RANDOM, 0, 999, true);
target = SelectUnit(SELECT_TARGET_TOPAGGRO, 0, 999, true);
if(target)
summon->AI()->AttackStart(target);
}break;
@@ -161,7 +161,7 @@ struct TRINITY_DLL_DECL npc_ranger_lilathaAI : public npc_escortAI
case 0:
{
m_creature->SetUInt32Value(UNIT_FIELD_BYTES_1, 0);
GameObject* Cage = FindGameObject(GO_CAGE);
GameObject* Cage = FindGameObject(GO_CAGE, 99);
if(Cage)
Cage->SetGoState(0);
DoScriptText(SAY_START, m_creature, player);
@@ -212,7 +212,7 @@ struct TRINITY_DLL_DECL npc_ranger_lilathaAI : public npc_escortAI
if (!IsBeingEscorted)
m_creature->setFaction(1602);
GameObject* Cage = FindGameObject(GO_CAGE);
GameObject* Cage = FindGameObject(GO_CAGE, 99);
if(Cage)
Cage->SetGoState(1);
}
@@ -16,18 +16,389 @@
/* ScriptData
SDName: Boss_Nightbane
SD%Complete: 0
SDComment: Place holder
SD%Complete: 50
SDComment: skelleton adds, optimice some "if"s, timers, rain of bones applied self(!?)
SDCategory: Karazhan
EndScriptData */
#include "precompiled.h"
#include "def_karazhan.h"
//phase 1
#define SPELL_BELLOWING_ROAR 39427
#define SPELL_CHARRED_EARTH 30129 //Also 30209 (Target Charred Earth) triggers this
#define SPELL_CHARRED_EARTH 30129 //Also 30209 (Target Charred Earth) triggers this
#define SPELL_DISTRACTING_ASH 30130
#define SPELL_SMOLDERING_BREATH 30210
#define SPELL_TAIL_SWEEP 25653
//phase 2
#define SPELL_RAIN_OF_BONES 37098
#define SPELL_SMOKING_BLAST 37057
#define SPELL_FIREBALL_BARRAGE 30282
#define SPELL_SEARING_CINDERS 30127
float IntroWay[8][3] =
{
{-11053.37,-1794.48,149},
{-11141.07,-1841.40,125},
{-11187.28,-1890.23,125},
{-11189.20,-1931.25,125},
{-11153.76,-1948.93,125},
{-11128.73,-1929.75,125},
{-11140 , -1915 ,122},
{-11163 , -1903 ,91.473}
};
//float IntroWay[5][3] =
//{
// {-11000.00, -1765.75, 140.40},
// {-11000.00, -1765.75, 171.00},
// {-11173.67, -1832.26, 117.76},
// {-11142.75, -1916.78, 119.769},
// {-11161.91, -1911.148, 91.473}
//};
struct TRINITY_DLL_DECL boss_nightbaneAI : public ScriptedAI
{
boss_nightbaneAI(Creature* c) : ScriptedAI(c)
{
pInstance = ((ScriptedInstance*)c->GetInstanceData());
intro = true;
Reset();
}
ScriptedInstance* pInstance;
uint32 phase;
bool rainbones;
uint32 bellowingroar_timer;
uint32 charredearth_timer;
uint32 distractingash_timer;
uint32 smolderingbreath_timer;
uint32 tailsweep_timer;
uint32 rainofbones_timer;
uint32 smokingblast_timer;
uint32 fireballbarrage_timer;
uint32 searingcinders_timer;
uint32 fly_count;
uint32 fly_timer;
bool intro;
bool flying;
uint32 wait_timer;
uint32 MovePhase;
void Reset()
{
phase =1;
bellowingroar_timer = 30000;
charredearth_timer = 15000;
distractingash_timer = 20000;
smolderingbreath_timer = 10000;
tailsweep_timer = 12000;
rainofbones_timer = 10000;
smokingblast_timer = 20000;
fireballbarrage_timer = 13000;
searingcinders_timer = 14000;
fly_count = 0;
m_creature->SetSpeed(MOVE_RUN,2);
m_creature->AddUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT + MOVEMENTFLAG_LEVITATING);
m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE);
m_creature->setActive(true);
wait_timer = 1000;
MovePhase = 0;
if(pInstance)
pInstance->SetData(DATA_NIGHTBANE_EVENT, NOT_STARTED);
flying = false;
if(!intro)
{
m_creature->SetHomePosition(IntroWay[7][0],IntroWay[7][1],IntroWay[7][2],0);
m_creature->GetMotionMaster()->MoveTargetedHome();
}
}
void Aggro(Unit *who)
{
if(pInstance)
pInstance->SetData(DATA_NIGHTBANE_EVENT, IN_PROGRESS);
}
void AttackStart(Unit* who)
{
if(!intro && !flying)
ScriptedAI::AttackStart(who);
}
void JustDied(Unit* killer)
{
if(pInstance)
pInstance->SetData(DATA_NIGHTBANE_EVENT, DONE);
}
void MoveInLineOfSight(Unit *who)
{
if(!intro && !flying)
{
if(!m_creature->getVictim() && m_creature->canStartAttack(who))
ScriptedAI::AttackStart(who);
}
}
void MovementInform(uint32 type, uint32 id)
{
if(type != POINT_MOTION_TYPE)
return;
if(intro)
{
if(id >= 8)
{
intro = false;
m_creature->SetHomePosition(IntroWay[7][0],IntroWay[7][1],IntroWay[7][2],0);
return;
}
wait_timer = 1;
}
if(flying)
{
if(id == 0)
{
flying = false;
phase = 2;
return;
}
if(id == 3)
{
MovePhase = 4;
wait_timer = 1;
return;
}
if(id == 8)
{
flying = false;
phase = 1;
return;
}
wait_timer = 1;
}
}
void UpdateAI(const uint32 diff)
{
if(wait_timer)
if(wait_timer < diff)
{
if(intro)
{
if(MovePhase >= 7)
{
m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT + MOVEMENTFLAG_LEVITATING);
m_creature->HandleEmoteCommand(EMOTE_ONESHOT_LAND);
m_creature->GetMotionMaster()->MovePoint(8,IntroWay[7][0],IntroWay[7][1],IntroWay[7][2]);
}
else
{
m_creature->GetMotionMaster()->MovePoint(MovePhase,IntroWay[MovePhase][0],IntroWay[MovePhase][1],IntroWay[MovePhase][2]);
MovePhase++;
}
}
if(flying)
{
if(MovePhase >= 7)
{
m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT + MOVEMENTFLAG_LEVITATING);
m_creature->HandleEmoteCommand(EMOTE_ONESHOT_LAND);
m_creature->GetMotionMaster()->MovePoint(8,IntroWay[7][0],IntroWay[7][1],IntroWay[7][2]);
}
else
{
m_creature->GetMotionMaster()->MovePoint(MovePhase,IntroWay[MovePhase][0],IntroWay[MovePhase][1],IntroWay[MovePhase][2]);
MovePhase++;
}
}
wait_timer = 0;
}else wait_timer -= diff;
if(!m_creature->SelectHostilTarget())
return;
if(flying)
return;
// Phase 1 "GROUND FIGHT"
if(phase == 1)
{
m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim());
if (bellowingroar_timer < diff)
{
DoCast(m_creature->getVictim(),SPELL_BELLOWING_ROAR);
bellowingroar_timer = 30000+rand()%10000 ; //Timer
}else bellowingroar_timer -= diff;
if (smolderingbreath_timer < diff)
{
DoCast(m_creature->getVictim(),SPELL_SMOLDERING_BREATH);
smolderingbreath_timer = 20000;//timer
}else smolderingbreath_timer -= diff;
if (charredearth_timer < diff)
{
Unit* target = NULL;
target = SelectUnit(SELECT_TARGET_RANDOM,0);
DoCast(target,SPELL_CHARRED_EARTH);
charredearth_timer = 20000; //timer
}else charredearth_timer -= diff;
if (tailsweep_timer < diff)
{
Unit* target = NULL;
target = SelectUnit(SELECT_TARGET_RANDOM,0);
if (!m_creature->HasInArc( M_PI, target))
DoCast(target,SPELL_TAIL_SWEEP);
tailsweep_timer = 15000;//timer
}else tailsweep_timer -= diff;
if (searingcinders_timer < diff)
{
Unit* target = NULL;
target = SelectUnit(SELECT_TARGET_RANDOM,0);
DoCast(target,SPELL_SEARING_CINDERS);
searingcinders_timer = 10000; //timer
}else searingcinders_timer -= diff;
uint32 prozent;
prozent = (m_creature->GetHealth()*100) / m_creature->GetMaxHealth();
if (prozent < 75 && fly_count == 0) // first take off 75%
{
m_creature->InterruptSpell(CURRENT_GENERIC_SPELL);
m_creature->HandleEmoteCommand(EMOTE_ONESHOT_LIFTOFF);
m_creature->AddUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT + MOVEMENTFLAG_LEVITATING);
(*m_creature).GetMotionMaster()->Clear(false);
(*m_creature).GetMotionMaster()->MovePoint(0,IntroWay[2][0],IntroWay[2][1],IntroWay[2][2]);
flying = true;
fly_timer = 45000+rand()%15000;
fly_count++;
rainofbones_timer = 5000;
rainbones = false;
}
if (prozent < 50 && fly_count == 1) // secound take off 50%
{
m_creature->InterruptSpell(CURRENT_GENERIC_SPELL);
m_creature->HandleEmoteCommand(EMOTE_ONESHOT_LIFTOFF);
m_creature->AddUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT + MOVEMENTFLAG_LEVITATING);
(*m_creature).GetMotionMaster()->Clear(false);
(*m_creature).GetMotionMaster()->MovePoint(0,IntroWay[2][0],IntroWay[2][1],IntroWay[2][2]);
flying = true;
fly_timer = 45000+rand()%15000;
fly_count++;
rainofbones_timer = 5000;
rainbones = false;
}
if (prozent < 25 && fly_count == 2) // third take off 25%
{
m_creature->InterruptSpell(CURRENT_GENERIC_SPELL);
m_creature->HandleEmoteCommand(EMOTE_ONESHOT_LIFTOFF);
m_creature->AddUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT + MOVEMENTFLAG_LEVITATING);
(*m_creature).GetMotionMaster()->Clear(false);
(*m_creature).GetMotionMaster()->MovePoint(0,IntroWay[2][0],IntroWay[2][1],IntroWay[2][2]);
flying = true;
//phase = 2;
fly_timer = 45000+rand()%15000;
fly_count++;
rainofbones_timer = 5000;
rainbones = false;
}
DoMeleeAttackIfReady();
}
//Phase 2 "FLYING FIGHT"
if (phase == 2)
{
if (!rainbones)
{
if (rainofbones_timer < diff && !rainbones) // only once at the beginning of phase 2
{
DoCast(m_creature->getVictim(),SPELL_RAIN_OF_BONES);
rainbones = true;
smokingblast_timer = 20000;
}else rainofbones_timer -= diff;
if (distractingash_timer < diff)
{
Unit* target = NULL;
target = SelectUnit(SELECT_TARGET_RANDOM,0);
DoCast(target,SPELL_DISTRACTING_ASH);
distractingash_timer = 2000;//timer wrong
}else distractingash_timer -= diff;
}
if (rainbones)
{
if (smokingblast_timer < diff)
{
DoCast(m_creature->getVictim(),SPELL_SMOKING_BLAST);
smokingblast_timer = 1500 ; //timer wrong
}else smokingblast_timer -= diff;
}
if (fireballbarrage_timer < diff)
{
Unit* target = NULL;
target = SelectUnit(SELECT_TARGET_FARTHEST,0);
DoCast(target,SPELL_FIREBALL_BARRAGE);
fireballbarrage_timer = 20000; //Timer
}else fireballbarrage_timer -= diff;
if (fly_timer < diff) //landing
{
//m_creature->HandleEmoteCommand(EMOTE_ONESHOT_LAND);
//m_creature->SetHover(false);
(*m_creature).GetMotionMaster()->Clear(false);
m_creature->GetMotionMaster()->MovePoint(3,IntroWay[3][0],IntroWay[3][1],IntroWay[3][2]);
flying = true;
//wait_timer = 1;
//phase = 1;
}else fly_timer -= diff;
}
}
};
CreatureAI* GetAI_boss_nightbane(Creature *_Creature)
{
return new boss_nightbaneAI (_Creature);
}
void AddSC_boss_nightbane()
{
Script *newscript;
newscript = new Script;
newscript->Name="boss_nightbane";
newscript->GetAI = GetAI_boss_nightbane;
newscript->RegisterSelf();
}
@@ -59,7 +59,8 @@ struct TRINITY_DLL_DECL instance_karazhan : public ScriptedInstance
uint64 MassiveDoor; // Door at Netherspite
uint64 GamesmansDoor; // Door before Chess
uint64 GamesmansExitDoor; // Door after Chess
uint64 NetherspaceDoor; // Door at Malchezaar
uint64 NetherspaceDoor; // Door at Malchezaar
uint64 MastersTerraceDoor[2];
uint64 ImageGUID;
@@ -84,6 +85,8 @@ struct TRINITY_DLL_DECL instance_karazhan : public ScriptedInstance
GamesmansDoor = 0;
GamesmansExitDoor = 0;
NetherspaceDoor = 0;
MastersTerraceDoor[0]= 0;
MastersTerraceDoor[1]= 0;
ImageGUID = 0;
}
@@ -199,6 +202,8 @@ struct TRINITY_DLL_DECL instance_karazhan : public ScriptedInstance
case 184276: GamesmansDoor = go->GetGUID(); break;
case 184277: GamesmansExitDoor = go->GetGUID(); break;
case 185134: NetherspaceDoor = go->GetGUID(); break;
case 184274: MastersTerraceDoor[0] = go->GetGUID(); break;
case 184280: MastersTerraceDoor[1] = go->GetGUID(); break;
}
switch(OperaEvent)