*Added: Deadmines Cannon Event. By netoya.
--HG-- branch : trunk
This commit is contained in:
@@ -173,6 +173,7 @@ scripts/zone/coilfang_resevoir/steam_vault/instance_steam_vault.cpp \
|
||||
scripts/zone/coilfang_resevoir/underbog/boss_hungarfen.cpp \
|
||||
scripts/zone/darkshore/darkshore.cpp \
|
||||
scripts/zone/deadmines/deadmines.cpp \
|
||||
scripts/zone/deadmines/def_deadmines.h \
|
||||
scripts/zone/dun_morogh/dun_morogh.cpp \
|
||||
scripts/zone/dustwallow_marsh/dustwallow_marsh.cpp \
|
||||
scripts/zone/eastern_plaguelands/eastern_plaguelands.cpp \
|
||||
|
||||
@@ -253,6 +253,8 @@ extern void AddSC_boss_hungarfen();
|
||||
//Darkshore
|
||||
//Darnassus
|
||||
//Deadmines
|
||||
extern void AddSC_instance_deadmines();
|
||||
|
||||
//Deadwind pass
|
||||
//Desolace
|
||||
//Dire Maul
|
||||
@@ -1441,6 +1443,8 @@ void ScriptsInit()
|
||||
//Darkshore
|
||||
//Darnassus
|
||||
//Deadmines
|
||||
AddSC_instance_deadmines();
|
||||
|
||||
//Deadwind pass
|
||||
//Desolace
|
||||
//Dire Maul
|
||||
|
||||
@@ -309,6 +309,10 @@
|
||||
RelativePath="..\scripts\zone\deadmines\deadmines.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\scripts\zone\deadmines\def_deadmines.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Deadwind Pass"
|
||||
|
||||
@@ -554,6 +554,10 @@
|
||||
RelativePath="..\scripts\zone\deadmines\deadmines.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\scripts\zone\deadmines\def_deadmines.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Deadwind Pass"
|
||||
|
||||
@@ -540,6 +540,10 @@
|
||||
RelativePath="..\scripts\zone\deadmines\deadmines.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\scripts\zone\deadmines\def_deadmines.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Deadwind Pass"
|
||||
|
||||
@@ -22,3 +22,209 @@ SDCategory: Deadmines
|
||||
EndScriptData */
|
||||
|
||||
#include "precompiled.h"
|
||||
#include "def_deadmines.h"
|
||||
#include "Spell.h"
|
||||
|
||||
#define SOUND_CANNONFIRE 1400
|
||||
#define SOUND_DESTROYDOOR 3079
|
||||
#define SAY_MR_SMITE_ALARM1 "You there, check out that noise!"
|
||||
#define SOUND_MR_SMITE_ALARM1 5775
|
||||
#define SAY_MR_SMITE_ALARM2 "We're under attack! A vast, ye swabs! Repel the invaders!"
|
||||
#define SOUND_MR_SMITE_ALARM2 5777
|
||||
|
||||
#define GO_IRONCLAD_DOOR 16397
|
||||
#define GO_DEFIAS_CANNON 16398
|
||||
#define GO_DOOR_LEVER 101833
|
||||
|
||||
#define CANNON_BLAST_TIMER 3000
|
||||
#define PIRATES_DELAY_TIMER 1000
|
||||
|
||||
struct TRINITY_DLL_DECL instance_deadmines : public ScriptedInstance
|
||||
{
|
||||
instance_deadmines(Map *Map) : ScriptedInstance(Map) {Initialize();};
|
||||
|
||||
GameObject* IronCladDoor;
|
||||
GameObject* DefiasCannon;
|
||||
GameObject* DoorLever;
|
||||
Creature* DefiasPirate1;
|
||||
Creature* DefiasPirate2;
|
||||
Creature* DefiasCompanion;
|
||||
uint32 State;
|
||||
uint32 CannonBlast_Timer;
|
||||
uint32 PiratesDelay_Timer;
|
||||
|
||||
void Initialize()
|
||||
{
|
||||
IronCladDoor = NULL;
|
||||
DefiasCannon = NULL;
|
||||
DoorLever = NULL;
|
||||
State = CANNON_NOT_USED;
|
||||
}
|
||||
|
||||
virtual void Update(uint32 diff)
|
||||
{
|
||||
switch(State)
|
||||
{
|
||||
case CANNON_GUNPOWDER_USED:
|
||||
CannonBlast_Timer = CANNON_BLAST_TIMER;
|
||||
// it's a hack - Mr. Smite should do that but his too far away
|
||||
IronCladDoor->SetName("Mr. Smite");
|
||||
IronCladDoor->Yell(SAY_MR_SMITE_ALARM1, LANG_UNIVERSAL, 0);
|
||||
DoPlaySound(IronCladDoor, SOUND_MR_SMITE_ALARM1);
|
||||
State=CANNON_BLAST_INITIATED;
|
||||
break;
|
||||
case CANNON_BLAST_INITIATED:
|
||||
PiratesDelay_Timer = PIRATES_DELAY_TIMER;
|
||||
if(CannonBlast_Timer<diff)
|
||||
{
|
||||
SummonCreatures();
|
||||
ShootCannon();
|
||||
BlastOutDoor();
|
||||
LeverStucked();
|
||||
IronCladDoor->Yell(SAY_MR_SMITE_ALARM2, LANG_UNIVERSAL, 0);
|
||||
DoPlaySound(IronCladDoor, SOUND_MR_SMITE_ALARM2);
|
||||
State = PIRATES_ATTACK;
|
||||
}else
|
||||
CannonBlast_Timer-=diff;
|
||||
break;
|
||||
case PIRATES_ATTACK:
|
||||
if(PiratesDelay_Timer<diff)
|
||||
{
|
||||
MoveCreaturesInside();
|
||||
State = EVENT_DONE;
|
||||
}else
|
||||
PiratesDelay_Timer-=diff;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void SummonCreatures()
|
||||
{
|
||||
DefiasPirate1 = IronCladDoor->SummonCreature(657,IronCladDoor->GetPositionX() - 2,IronCladDoor->GetPositionY()-7,IronCladDoor->GetPositionZ(), 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 3000);
|
||||
DefiasPirate2 = IronCladDoor->SummonCreature(657,IronCladDoor->GetPositionX() + 3,IronCladDoor->GetPositionY()-6,IronCladDoor->GetPositionZ(), 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 3000);
|
||||
DefiasCompanion = IronCladDoor->SummonCreature(3450,IronCladDoor->GetPositionX() + 2,IronCladDoor->GetPositionY()-6,IronCladDoor->GetPositionZ(), 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 3000);
|
||||
}
|
||||
|
||||
void MoveCreaturesInside()
|
||||
{
|
||||
MoveCreatureInside(DefiasPirate1);
|
||||
MoveCreatureInside(DefiasPirate2);
|
||||
MoveCreatureInside(DefiasCompanion);
|
||||
}
|
||||
|
||||
void MoveCreatureInside(Creature *creature)
|
||||
{
|
||||
creature->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE);
|
||||
creature->GetMotionMaster()->MovePoint(0, -102.7,-655.9, creature->GetPositionZ());
|
||||
}
|
||||
|
||||
void ShootCannon()
|
||||
{
|
||||
DefiasCannon->SetUInt32Value(GAMEOBJECT_STATE, 0);
|
||||
DoPlaySound(DefiasCannon, SOUND_CANNONFIRE);
|
||||
}
|
||||
|
||||
void BlastOutDoor()
|
||||
{
|
||||
IronCladDoor->SetUInt32Value(GAMEOBJECT_STATE, 2);
|
||||
DoPlaySound(IronCladDoor, SOUND_DESTROYDOOR);
|
||||
}
|
||||
|
||||
void LeverStucked()
|
||||
{
|
||||
DoorLever->SetUInt32Value(GAMEOBJECT_FLAGS, 4);
|
||||
}
|
||||
|
||||
void OnObjectCreate(GameObject *go)
|
||||
{
|
||||
switch(go->GetEntry())
|
||||
{
|
||||
case GO_IRONCLAD_DOOR:
|
||||
IronCladDoor = go;
|
||||
break;
|
||||
case GO_DEFIAS_CANNON:
|
||||
DefiasCannon = go;
|
||||
break;
|
||||
case GO_DOOR_LEVER:
|
||||
DoorLever = go;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void SetData(uint32 type, uint32 data)
|
||||
{
|
||||
if (type == EVENT_STATE)
|
||||
{
|
||||
if (DefiasCannon && IronCladDoor)
|
||||
State=data;
|
||||
}
|
||||
}
|
||||
|
||||
uint32 GetData(uint32 type)
|
||||
{
|
||||
if (type == EVENT_STATE)
|
||||
return State;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void DoPlaySound(GameObject* unit, uint32 sound)
|
||||
{
|
||||
WorldPacket data(4);
|
||||
data.SetOpcode(SMSG_PLAY_SOUND);
|
||||
data << uint32(sound);
|
||||
unit->SendMessageToSet(&data,false);
|
||||
}
|
||||
|
||||
void DoPlaySoundCreature(Unit* unit, uint32 sound)
|
||||
{
|
||||
WorldPacket data(4);
|
||||
data.SetOpcode(SMSG_PLAY_SOUND);
|
||||
data << uint32(sound);
|
||||
unit->SendMessageToSet(&data,false);
|
||||
}
|
||||
};
|
||||
|
||||
/*#####
|
||||
# item_Defias_Gunpowder
|
||||
#####*/
|
||||
|
||||
bool ItemUse_item_defias_gunpowder(Player *player, Item* _Item, SpellCastTargets const& targets)
|
||||
{
|
||||
ScriptedInstance *pInstance = (player->GetInstanceData()) ? ((ScriptedInstance*)player->GetInstanceData()) : NULL;
|
||||
|
||||
if(!pInstance)
|
||||
{
|
||||
player->GetSession()->SendNotification("Instance script not initialized");
|
||||
return true;
|
||||
}
|
||||
if (pInstance->GetData(EVENT_STATE)!=CANNON_NOT_USED)
|
||||
return false;
|
||||
if(targets.getGOTarget() && targets.getGOTarget()->GetTypeId()==TYPEID_GAMEOBJECT &&
|
||||
targets.getGOTarget()->GetEntry() == GO_DEFIAS_CANNON)
|
||||
{
|
||||
pInstance->SetData(EVENT_STATE, CANNON_GUNPOWDER_USED);
|
||||
}
|
||||
|
||||
player->DestroyItemCount(_Item->GetEntry(), 1, true);
|
||||
return true;
|
||||
}
|
||||
|
||||
InstanceData* GetInstanceData_instance_deadmines(Map* map)
|
||||
{
|
||||
return new instance_deadmines(map);
|
||||
}
|
||||
|
||||
void AddSC_instance_deadmines()
|
||||
{
|
||||
Script *newscript;
|
||||
newscript = new Script;
|
||||
newscript->Name = "instance_deadmines";
|
||||
newscript->GetInstanceData = &GetInstanceData_instance_deadmines;
|
||||
newscript->RegisterSelf();
|
||||
|
||||
newscript = new Script;
|
||||
newscript->Name = "item_defias_gunpowder";
|
||||
newscript->pItemUse = &ItemUse_item_defias_gunpowder;
|
||||
newscript->RegisterSelf();
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
#ifndef DEF_DEADMINES_H
|
||||
#define DEF_DEADMINES_H
|
||||
|
||||
#include "precompiled.h"
|
||||
|
||||
#define CANNON_NOT_USED 1
|
||||
#define CANNON_GUNPOWDER_USED 2
|
||||
#define CANNON_BLAST_INITIATED 3
|
||||
#define PIRATES_ATTACK 4
|
||||
#define EVENT_DONE 5
|
||||
|
||||
#define EVENT_STATE 1
|
||||
#endif
|
||||
Reference in New Issue
Block a user