*Add support for quest 9645 - original patch by BroodWyrm
--HG-- branch : trunk
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
-- event script for Medivh's Journal
|
||||
delete from event_scripts where id = 10951;
|
||||
insert into event_scripts values
|
||||
(10951,0,10,17651, 300000, 0,-11159,-1907.22,91.48,0);
|
||||
|
||||
-- remove every Image from Medivh (should not be spawned by db)
|
||||
delete from creature where id = 17651;
|
||||
-- add script
|
||||
update creature_template set scriptname = 'npc_image_of_medivh' where entry = 17651;
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user