--HG--
branch : trunk
This commit is contained in:
megamage
2008-12-24 21:08:43 -06:00
13 changed files with 830 additions and 40 deletions
@@ -258,7 +258,7 @@ struct TRINITY_DLL_DECL boss_teron_gorefiendAI : public ScriptedAI
m_creature->AddThreat(who, 1.0f);
}
if(!InCombat && !Intro && m_creature->IsWithinDistInMap(who, 200.0f) && (who->GetTypeId() == TYPEID_PLAYER))
if(!InCombat && !Intro && m_creature->IsWithinDistInMap(who, 60.0f) && (who->GetTypeId() == TYPEID_PLAYER))
{
if(pInstance)
pInstance->SetData(DATA_TERONGOREFIENDEVENT, IN_PROGRESS);
@@ -29,7 +29,6 @@ update `creature_template` set `npcflag`='1',`ScriptName`='npc_tobias_seecher' w
update `instance_template` set `script`='instance_blackrock_depths' where `map`='230';
*/
#include "GameObject.h"
#include "precompiled.h"
#include "def_blackrock_depths.h"
@@ -30,6 +30,7 @@
#define DATA_GAMEOBJECT_NETHER_DOOR 23
#define DATA_GAMEOBJECT_GAME_DOOR 24
#define DATA_GAMEOBJECT_GAME_EXIT_DOOR 25
#define DATA_IMAGE_OF_MEDIVH 26
// Opera Performances
#define EVENT_OZ 1
@@ -61,6 +61,8 @@ struct TRINITY_DLL_DECL instance_karazhan : public ScriptedInstance
uint64 GamesmansExitDoor; // Door after Chess
uint64 NetherspaceDoor; // Door at Malchezaar
uint64 ImageGUID;
void Initialize()
{
for (uint8 i = 0; i < ENCOUNTERS; ++i)
@@ -82,6 +84,8 @@ struct TRINITY_DLL_DECL instance_karazhan : public ScriptedInstance
GamesmansDoor = 0;
GamesmansExitDoor = 0;
NetherspaceDoor = 0;
ImageGUID = 0;
}
bool IsEncounterInProgress() const
@@ -111,6 +115,7 @@ struct TRINITY_DLL_DECL instance_karazhan : public ScriptedInstance
case DATA_NIGHTBANE_EVENT: return Encounters[11];
case DATA_OPERA_PERFORMANCE: return OperaEvent;
case DATA_OPERA_OZ_DEATHCOUNT: return OzDeathCount;
case DATA_IMAGE_OF_MEDIVH: return ImageGUID;
}
return 0;
@@ -174,6 +179,14 @@ struct TRINITY_DLL_DECL instance_karazhan : public ScriptedInstance
SaveToDB();
}
void SetData64(uint32 identifier, uint64 data)
{
switch(identifier)
{
case DATA_IMAGE_OF_MEDIVH: ImageGUID = data;
}
}
void OnObjectCreate(GameObject* go)
{
switch(go->GetEntry())
@@ -17,13 +17,14 @@
/* ScriptData
SDName: Karazhan
SD%Complete: 100
SDComment: Support for Barnes (Opera controller) and Berthold (Doorman).
SDComment: Support for Barnes (Opera controller) and Berthold (Doorman), Support for Quest 9645.
SDCategory: Karazhan
EndScriptData */
/* ContentData
npc_barnes
npc_berthold
npc_image_of_medivh
EndContentData */
#include "precompiled.h"
@@ -432,6 +433,209 @@ bool GossipSelect_npc_berthold(Player* player, Creature* _Creature, uint32 sende
return true;
}
/*###
# npc_image_of_medivh
####*/
#define SAY_DIALOG_MEDIVH_1 "You've got my attention, dragon. You'll find I'm not as easily scared as the villagers below."
#define SAY_DIALOG_ARCANAGOS_2 "Your dabbling in the arcane has gone too far, Medivh. You've attracted the attention of powers beyond your understanding. You must leave Karazhan at once!"
#define SAY_DIALOG_MEDIVH_3 "You dare challenge me at my own dwelling? Your arrogance is astounding, even for a dragon!"
#define SAY_DIALOG_ARCANAGOS_4 "A dark power seeks to use you, Medivh! If you stay, dire days will follow. You must hurry, we don't have much time!"
#define SAY_DIALOG_MEDIVH_5 "I do not know what you speak of, dragon... but I will not be bullied by this display of insolence. I'll leave Karazhan when it suits me!"
#define SAY_DIALOG_ARCANAGOS_6 "You leave me no alternative. I will stop you by force if you won't listen to reason!"
#define EMOTE_DIALOG_MEDIVH_7 "begins to cast a spell of great power, weaving his own essence into the magic."
#define SAY_DIALOG_ARCANAGOS_8 "What have you done, wizard? This cannot be! I'm burning from... within!"
#define SAY_DIALOG_MEDIVH_9 "He should not have angered me. I must go... recover my strength now..."
#define MOB_ARCANAGOS 17652
#define SPELL_FIRE_BALL 30967
#define SPELL_UBER_FIREBALL 30971
#define SPELL_CONFLAGRATION_BLAST 30977
#define SPELL_MANA_SHIELD 31635
static float MedivPos[4] = {-11161.49,-1902.24,91.48,1.94};
static float ArcanagosPos[4] = {-11169.75,-1881.48,95.39,4.83};
struct TRINITY_DLL_DECL npc_image_of_medivhAI : public ScriptedAI
{
npc_image_of_medivhAI(Creature* c) : ScriptedAI(c)
{
pInstance = ((ScriptedInstance*)c->GetInstanceData());
Reset();
}
ScriptedInstance *pInstance;
uint64 ArcanagosGUID;
uint32 YellTimer;
uint32 Step;
uint32 FireMedivhTimer;
uint32 FireArcanagosTimer;
bool EventStarted;
void Reset()
{
ArcanagosGUID = 0;
if(pInstance && pInstance->GetData64(DATA_IMAGE_OF_MEDIVH) == 0)
{
pInstance->SetData64(DATA_IMAGE_OF_MEDIVH, m_creature->GetGUID());
(*m_creature).GetMotionMaster()->MovePoint(1,MedivPos[0],MedivPos[1],MedivPos[2]);
Step = 0;
}else
{
m_creature->DealDamage(m_creature,m_creature->GetHealth(),NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
m_creature->RemoveCorpse();
}
}
void Aggro(Unit* who){}
void MovementInform(uint32 type, uint32 id)
{
if(type != POINT_MOTION_TYPE)
return;
if(id == 1)
{
StartEvent();
m_creature->SetOrientation(MedivPos[3]);
m_creature->SetOrientation(MedivPos[3]);
}
}
void StartEvent()
{
Step = 1;
EventStarted = true;
Creature* Arcanagos = m_creature->SummonCreature(MOB_ARCANAGOS,ArcanagosPos[0],ArcanagosPos[1],ArcanagosPos[2],0,TEMPSUMMON_CORPSE_TIMED_DESPAWN,20000);
ArcanagosGUID = Arcanagos->GetGUID();
Arcanagos->AddUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT + MOVEMENTFLAG_LEVITATING);
(*Arcanagos).GetMotionMaster()->MovePoint(0,ArcanagosPos[0],ArcanagosPos[1],ArcanagosPos[2]);
Arcanagos->SetOrientation(ArcanagosPos[3]);
m_creature->SetOrientation(MedivPos[3]);
YellTimer = 10000;
}
uint32 NextStep(uint32 Step)
{
Unit* arca = Unit::GetUnit((*m_creature),ArcanagosGUID);
Map *map = m_creature->GetMap();
switch(Step)
{
case 0: return 9999999;
case 1:
m_creature->Yell(SAY_DIALOG_MEDIVH_1,LANG_UNIVERSAL,NULL);
return 10000;
case 2:
if(arca)
((Creature*)arca)->Yell(SAY_DIALOG_ARCANAGOS_2,LANG_UNIVERSAL,NULL);
return 20000;
case 3:
m_creature->Yell(SAY_DIALOG_MEDIVH_3,LANG_UNIVERSAL,NULL);
return 10000;
case 4:
if(arca)
((Creature*)arca)->Yell(SAY_DIALOG_ARCANAGOS_4, LANG_UNIVERSAL, NULL);
return 20000;
case 5:
m_creature->Yell(SAY_DIALOG_MEDIVH_5, LANG_UNIVERSAL, NULL);
return 20000;
case 6:
if(arca)
((Creature*)arca)->Yell(SAY_DIALOG_ARCANAGOS_6, LANG_UNIVERSAL, NULL);
return 10000;
case 7:
FireArcanagosTimer = 500;
return 5000;
case 8:
FireMedivhTimer = 500;
DoCast(m_creature, SPELL_MANA_SHIELD);
return 10000;
case 9:
m_creature->TextEmote(EMOTE_DIALOG_MEDIVH_7, 0, false);
return 10000;
case 10:
if(arca)
m_creature->CastSpell(arca, SPELL_CONFLAGRATION_BLAST, false);
return 1000;
case 11:
if(arca)
((Creature*)arca)->Yell(SAY_DIALOG_ARCANAGOS_8, LANG_UNIVERSAL, NULL);
return 5000;
case 12:
arca->GetMotionMaster()->MovePoint(0, -11010.82,-1761.18, 156.47);
arca->setActive(true);
arca->InterruptNonMeleeSpells(true);
arca->SetSpeed(MOVE_FLIGHT, 2.0f);
return 10000;
case 13:
m_creature->Yell(SAY_DIALOG_MEDIVH_9, LANG_UNIVERSAL, NULL);
return 10000;
case 14:
m_creature->SetVisibility(VISIBILITY_OFF);
m_creature->ClearInCombat();
if(map->IsDungeon())
{
InstanceMap::PlayerList const &PlayerList = ((InstanceMap*)map)->GetPlayers();
for (InstanceMap::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
{
if(i->getSource()->isAlive())
{
if(i->getSource()->GetQuestStatus(9645) == QUEST_STATUS_INCOMPLETE)
i->getSource()->CompleteQuest(9645);
}
}
}
return 50000;
case 15:
arca->DealDamage(arca,arca->GetHealth(),NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
return 5000;
default : return 9999999;
}
}
void UpdateAI(const uint32 diff)
{
if(YellTimer < diff)
{
if(EventStarted)
{
YellTimer = NextStep(Step++);
}
}else YellTimer -= diff;
if(Step >= 7 && Step <= 12 )
{
Unit* arca = Unit::GetUnit((*m_creature),ArcanagosGUID);
if(FireArcanagosTimer < diff)
{
if(arca)
arca->CastSpell(m_creature, SPELL_FIRE_BALL, false);
FireArcanagosTimer = 6000;
}else FireArcanagosTimer -= diff;
if(FireMedivhTimer < diff)
{
if(arca)
DoCast(arca, SPELL_FIRE_BALL);
FireMedivhTimer = 5000;
}else FireMedivhTimer -= diff;
}
}
};
CreatureAI* GetAI_npc_image_of_medivh(Creature *_Creature)
{
return new npc_image_of_medivhAI(_Creature);
}
void AddSC_karazhan()
{
Script* newscript;
@@ -447,5 +651,10 @@ void AddSC_karazhan()
newscript->Name = "npc_berthold";
newscript->pGossipHello = &GossipHello_npc_berthold;
newscript->pGossipSelect = &GossipSelect_npc_berthold;
newscript->RegisterSelf();
newscript = new Script;
newscript->Name = "npc_image_of_medivh";
newscript->GetAI = &GetAI_npc_image_of_medivh;
newscript->RegisterSelf();
}
@@ -435,16 +435,30 @@ struct TRINITY_DLL_DECL boss_nalorakkAI : public ScriptedAI
DoYell(YELL_SURGE, LANG_UNIVERSAL, NULL);
DoPlaySoundToSet(m_creature, SOUND_YELL_SURGE);
Unit *target = SelectUnit(SELECT_TARGET_RANDOM, 1);
if(!target) target = m_creature->getVictim();
Unit *target = NULL;
std::list<HostilReference *> t_list = m_creature->getThreatManager().getThreatList();
std::vector<Unit *> target_list;
for(std::list<HostilReference *>::iterator itr = t_list.begin(); itr!= t_list.end(); ++itr)
{
target = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid());
//50 yard radius maximum
if(target && target->GetDistance2d(m_creature) < 50)
target_list.push_back(target);
target = NULL;
}
if(target_list.size())
target = *(target_list.begin()+rand()%target_list.size());
if(!target)
target = m_creature->getVictim();
TankGUID = m_creature->getVictim()->GetGUID();
ChargeTargetGUID = target->GetGUID();
float x, y, z;
target->GetContactPoint(m_creature, x, y, z);
m_creature->SetSpeed(MOVE_RUN, 5.0f);
m_creature->GetMotionMaster()->Clear();
m_creature->GetMotionMaster()->MovePoint(0, x, y, z);
float x, y, z;
target->GetContactPoint(m_creature, x, y, z);
m_creature->SetSpeed(MOVE_RUN, 5.0f);
m_creature->GetMotionMaster()->Clear();
m_creature->GetMotionMaster()->MovePoint(0, x, y, z);
Surge_Timer = 15000 + rand()%5000;
return;