*Update Uldaman script.
--HG-- branch : trunk
This commit is contained in:
@@ -31,58 +31,54 @@
|
|||||||
|
|
||||||
struct TRINITY_DLL_DECL instance_uldaman : public ScriptedInstance
|
struct TRINITY_DLL_DECL instance_uldaman : public ScriptedInstance
|
||||||
{
|
{
|
||||||
instance_uldaman(Map *Map) : ScriptedInstance(Map) {
|
instance_uldaman(Map *map) : ScriptedInstance(map)
|
||||||
|
{
|
||||||
Initialize();
|
Initialize();
|
||||||
stoneKeepersCounter = 0;
|
|
||||||
altarOfTheKeeperCounter = 0;
|
|
||||||
vaultWalkerCounter = 0;
|
|
||||||
earthenGuardianCounter = 0;
|
|
||||||
archaedasWallMinionsCounter = 0;
|
|
||||||
whoWokeArchaedasGUID = 0;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void Initialize()
|
||||||
|
{
|
||||||
|
archaedasGUID = 0;
|
||||||
|
altarOfTheKeeperTempleDoor = 0;
|
||||||
|
archaedasTempleDoor = 0;
|
||||||
|
ancientVaultDoor = 0;
|
||||||
|
whoWokeArchaedasGUID = 0;
|
||||||
|
}
|
||||||
|
|
||||||
Creature* archaedas;
|
uint64 archaedasGUID;
|
||||||
uint64 stoneKeeper[4];
|
uint64 altarOfTheKeeperTempleDoor;
|
||||||
uint32 stoneKeepersCounter;
|
uint64 archaedasTempleDoor;
|
||||||
|
uint64 ancientVaultDoor;
|
||||||
uint64 altarOfTheKeeperCount[5];
|
|
||||||
uint32 altarOfTheKeeperCounter;
|
|
||||||
|
|
||||||
uint64 vaultWalker[4];
|
|
||||||
uint32 vaultWalkerCounter;
|
|
||||||
|
|
||||||
uint64 earthenGuardian[6];
|
|
||||||
uint32 earthenGuardianCounter;
|
|
||||||
|
|
||||||
uint64 archaedasWallMinions[100]; // minions lined up around the wall
|
|
||||||
uint32 archaedasWallMinionsCounter;
|
|
||||||
|
|
||||||
GameObject *altarOfTheKeeperTempleDoor;
|
|
||||||
GameObject *archaedasTempleDoor;
|
|
||||||
GameObject *ancientVaultDoor;
|
|
||||||
|
|
||||||
uint64 whoWokeArchaedasGUID;
|
uint64 whoWokeArchaedasGUID;
|
||||||
|
|
||||||
void OnObjectCreate (GameObject* go) {
|
std::vector<uint64> stoneKeeper;
|
||||||
switch (go->GetEntry()) {
|
std::vector<uint64> altarOfTheKeeperCount;
|
||||||
|
std::vector<uint64> vaultWalker;
|
||||||
|
std::vector<uint64> earthenGuardian;
|
||||||
|
std::vector<uint64> archaedasWallMinions; // minions lined up around the wall
|
||||||
|
|
||||||
|
void OnObjectCreate (GameObject* go)
|
||||||
|
{
|
||||||
|
switch (go->GetEntry())
|
||||||
|
{
|
||||||
case ALTAR_OF_THE_KEEPER_TEMPLE_DOOR: // lock the door
|
case ALTAR_OF_THE_KEEPER_TEMPLE_DOOR: // lock the door
|
||||||
altarOfTheKeeperTempleDoor = go;
|
altarOfTheKeeperTempleDoor = go->GetGUID();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ARCHAEDAS_TEMPLE_DOOR:
|
case ARCHAEDAS_TEMPLE_DOOR:
|
||||||
archaedasTempleDoor = go;
|
archaedasTempleDoor = go->GetGUID();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ANCIENT_VAULT_DOOR:
|
case ANCIENT_VAULT_DOOR:
|
||||||
go->SetUInt32Value(GAMEOBJECT_STATE,1);
|
go->SetUInt32Value(GAMEOBJECT_STATE,1);
|
||||||
go->SetUInt32Value(GAMEOBJECT_FLAGS, 33);
|
go->SetUInt32Value(GAMEOBJECT_FLAGS, 33);
|
||||||
ancientVaultDoor = go;
|
ancientVaultDoor = go->GetGUID();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetFrozenState(Creature *creature) {
|
void SetFrozenState(Creature *creature)
|
||||||
|
{
|
||||||
creature->setFaction(35);
|
creature->setFaction(35);
|
||||||
creature->RemoveAllAuras();
|
creature->RemoveAllAuras();
|
||||||
//creature->RemoveFlag (UNIT_FIELD_FLAGS,UNIT_FLAG_ANIMATION_FROZEN);
|
//creature->RemoveFlag (UNIT_FIELD_FLAGS,UNIT_FLAG_ANIMATION_FROZEN);
|
||||||
@@ -90,121 +86,137 @@ struct TRINITY_DLL_DECL instance_uldaman : public ScriptedInstance
|
|||||||
creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE);
|
creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OpenDoor (GameObject *go) {
|
void OpenDoor(uint64 guid)
|
||||||
if (!go) return;
|
{
|
||||||
|
GameObject *go = instance->GetGameObjectInMap(guid);
|
||||||
|
if(!go)
|
||||||
|
return;
|
||||||
|
|
||||||
go->SetUInt32Value(GAMEOBJECT_FLAGS, 33);
|
go->SetUInt32Value(GAMEOBJECT_FLAGS, 33);
|
||||||
go->SetUInt32Value(GAMEOBJECT_STATE, 0);
|
go->SetUInt32Value(GAMEOBJECT_STATE, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ActivateStoneKeepers()
|
||||||
|
{
|
||||||
void ActivateStoneKeepers() {
|
for(std::vector<uint64>::iterator i = stoneKeeper.begin(); i != stoneKeeper.end(); ++i)
|
||||||
Creature *target;
|
{
|
||||||
uint32 counter = stoneKeepersCounter;
|
Creature *target = instance->GetCreatureInMap(*i);
|
||||||
// error_log ("ActivateStoneKeepers");
|
if (!target || !target->isAlive() || target->getFaction()==14)
|
||||||
// error_log ("counter = %d", counter);
|
continue;
|
||||||
for (; counter>0; ) {
|
target->RemoveFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_DISABLE_MOVE);
|
||||||
target = (Creature *) Unit::GetUnit(*archaedas,stoneKeeper[--counter]);
|
|
||||||
if (!target || !target->isAlive() || target->getFaction()==14) continue;
|
|
||||||
target->RemoveFlag (UNIT_FIELD_FLAGS,UNIT_FLAG_DISABLE_MOVE);
|
|
||||||
target->setFaction(14);
|
target->setFaction(14);
|
||||||
target->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
|
target->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
|
||||||
return; // only want the first one we find
|
return; // only want the first one we find
|
||||||
}
|
}
|
||||||
// error_log ("opening doors");
|
|
||||||
// if we get this far than all four are dead so open the door
|
// if we get this far than all four are dead so open the door
|
||||||
SetData (NULL, 0);
|
SetData (NULL, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ActivateWallMinions() {
|
void ActivateWallMinions()
|
||||||
Creature *target;
|
{
|
||||||
uint32 counter = archaedasWallMinionsCounter;
|
Creature *archaedas = instance->GetCreatureInMap(archaedasGUID);
|
||||||
for (; counter>0; ) {
|
if(!archaedas)
|
||||||
target = (Creature *) Unit::GetUnit(*archaedas,archaedasWallMinions[--counter]);
|
return;
|
||||||
if (!target || !target->isAlive() || target->getFaction()==14) continue;
|
|
||||||
archaedas->CastSpell (target, SPELL_AWAKEN_VAULT_WALKER, true);
|
for(std::vector<uint64>::iterator i = archaedasWallMinions.begin(); i != archaedasWallMinions.end(); ++i)
|
||||||
|
{
|
||||||
|
Creature *target = instance->GetCreatureInMap(*i);
|
||||||
|
if (!target || !target->isAlive() || target->getFaction()==14)
|
||||||
|
continue;
|
||||||
|
archaedas->CastSpell(target, SPELL_AWAKEN_VAULT_WALKER, true);
|
||||||
target->CastSpell(target, SPELL_ARCHAEDAS_AWAKEN,true);
|
target->CastSpell(target, SPELL_ARCHAEDAS_AWAKEN,true);
|
||||||
return; // only want the first one we find
|
return; // only want the first one we find
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// used when Archaedas dies. All active minions must be despawned.
|
// used when Archaedas dies. All active minions must be despawned.
|
||||||
void DeActivateMinions() {
|
void DeActivateMinions()
|
||||||
Creature *target;
|
{
|
||||||
uint32 counter = archaedasWallMinionsCounter;
|
|
||||||
|
|
||||||
// first despawn any aggroed wall minions
|
// first despawn any aggroed wall minions
|
||||||
for (; counter>0; ) {
|
for(std::vector<uint64>::iterator i = archaedasWallMinions.begin(); i != archaedasWallMinions.end(); ++i)
|
||||||
target = (Creature *) Unit::GetUnit(*archaedas,archaedasWallMinions[--counter]);
|
{
|
||||||
if (!target || target->isDead() || target->getFaction()!=14) continue;
|
Creature *target = instance->GetCreatureInMap(*i);
|
||||||
target->RemoveFromWorld();
|
if (!target || target->isDead() || target->getFaction()!=14)
|
||||||
target->AI()->EnterEvadeMode(); // need this b/c it still attacks even when removed
|
continue;
|
||||||
|
target->setDeathState(JUST_DIED);
|
||||||
|
target->RemoveCorpse();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Vault Walkers
|
// Vault Walkers
|
||||||
for (counter=0; counter<4; counter++) {
|
for(std::vector<uint64>::iterator i = vaultWalker.begin(); i != vaultWalker.end(); ++i)
|
||||||
target = (Creature *) Unit::GetUnit(*archaedas,vaultWalker[counter]);
|
{
|
||||||
if (!target || target->isDead() || target->getFaction() != 14) continue;
|
Creature *target = instance->GetCreatureInMap(*i);
|
||||||
target->RemoveFromWorld();
|
if (!target || target->isDead() || target->getFaction()!=14)
|
||||||
target->AI()->EnterEvadeMode(); // need this b/c it sill attacks even when removed
|
continue;
|
||||||
|
target->setDeathState(JUST_DIED);
|
||||||
|
target->RemoveCorpse();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Earthen Guardians
|
// Earthen Guardians
|
||||||
for (counter=0; counter<6; counter++) {
|
for(std::vector<uint64>::iterator i = earthenGuardian.begin(); i != earthenGuardian.end(); ++i)
|
||||||
target = (Creature *) Unit::GetUnit(*archaedas,earthenGuardian[counter]);
|
{
|
||||||
if (!target || target->isDead() || target->getFaction() != 14) continue;
|
Creature *target = instance->GetCreatureInMap(*i);
|
||||||
target->RemoveFromWorld();
|
if (!target || target->isDead() || target->getFaction()!=14)
|
||||||
target->AI()->EnterEvadeMode(); // need this b/c it sill attacks even when removed
|
continue;
|
||||||
|
target->setDeathState(JUST_DIED);
|
||||||
|
target->RemoveCorpse();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ActivateArchaedas(uint64 target) {
|
void ActivateArchaedas(uint64 target)
|
||||||
|
{
|
||||||
|
Creature *archaedas = instance->GetCreatureInMap(archaedasGUID);
|
||||||
|
if(!archaedas)
|
||||||
|
return;
|
||||||
|
|
||||||
Unit *victim = Unit::GetUnit(*archaedas, target);
|
if(Unit *victim = Unit::GetUnit(*archaedas, target))
|
||||||
|
{
|
||||||
archaedas->CastSpell(archaedas, SPELL_ARCHAEDAS_AWAKEN,false);
|
archaedas->CastSpell(archaedas, SPELL_ARCHAEDAS_AWAKEN,false);
|
||||||
whoWokeArchaedasGUID = target;
|
whoWokeArchaedasGUID = target;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void RespawnMinions() {
|
void RespawnMinions()
|
||||||
Creature *target;
|
{
|
||||||
uint32 counter = archaedasWallMinionsCounter;
|
// first respawn any aggroed wall minions
|
||||||
|
for(std::vector<uint64>::iterator i = archaedasWallMinions.begin(); i != archaedasWallMinions.end(); ++i)
|
||||||
// first respawn any wall minions
|
{
|
||||||
for (; counter>0; ) {
|
Creature *target = instance->GetCreatureInMap(*i);
|
||||||
target = (Creature *) Unit::GetUnit(*archaedas,archaedasWallMinions[--counter]);
|
if (target && target->isDead())
|
||||||
if (target && target->isDead()) {
|
{
|
||||||
target->Respawn();
|
target->Respawn();
|
||||||
target->GetMotionMaster()->MoveTargetedHome();
|
target->GetMotionMaster()->MoveTargetedHome();
|
||||||
//target->AI()->EnterEvadeMode();
|
|
||||||
SetFrozenState(target);
|
SetFrozenState(target);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Vault Walkers
|
// Vault Walkers
|
||||||
for (counter=0; counter<4; counter++) {
|
for(std::vector<uint64>::iterator i = vaultWalker.begin(); i != vaultWalker.end(); ++i)
|
||||||
target = (Creature *) Unit::GetUnit(*archaedas,vaultWalker[counter]);
|
{
|
||||||
if (target && target->isDead()) {
|
Creature *target = instance->GetCreatureInMap(*i);
|
||||||
|
if (target && target->isDead())
|
||||||
|
{
|
||||||
target->Respawn();
|
target->Respawn();
|
||||||
target->GetMotionMaster()->MoveTargetedHome();
|
target->GetMotionMaster()->MoveTargetedHome();
|
||||||
// target->AI()->EnterEvadeMode();
|
|
||||||
SetFrozenState(target);
|
SetFrozenState(target);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Earthen Guardians
|
// Earthen Guardians
|
||||||
for (counter=0; counter<6; counter++) {
|
for(std::vector<uint64>::iterator i = earthenGuardian.begin(); i != earthenGuardian.end(); ++i)
|
||||||
target = (Creature *) Unit::GetUnit(*archaedas,earthenGuardian[counter]);
|
{
|
||||||
if (target && target->isDead()) {
|
Creature *target = instance->GetCreatureInMap(*i);
|
||||||
|
if (target && target->isDead())
|
||||||
|
{
|
||||||
target->Respawn();
|
target->Respawn();
|
||||||
target->GetMotionMaster()->MoveTargetedHome();
|
target->GetMotionMaster()->MoveTargetedHome();
|
||||||
//target->AI()->EnterEvadeMode();
|
|
||||||
SetFrozenState(target);
|
SetFrozenState(target);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetData (uint32 type, uint32 data) {
|
void SetData (uint32 type, uint32 data)
|
||||||
|
{
|
||||||
//error_log ("SetData: data = %d", data);
|
//error_log ("SetData: data = %d", data);
|
||||||
if (data==0) OpenDoor (altarOfTheKeeperTempleDoor);
|
if (data==0) OpenDoor (altarOfTheKeeperTempleDoor);
|
||||||
if (data==0) OpenDoor (archaedasTempleDoor);
|
if (data==0) OpenDoor (archaedasTempleDoor);
|
||||||
@@ -216,8 +228,11 @@ struct TRINITY_DLL_DECL instance_uldaman : public ScriptedInstance
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SetData64 (uint32 type, uint64 data) {
|
void SetData64 (uint32 type, uint64 data)
|
||||||
if (type==0 ) { // Archaedas
|
{
|
||||||
|
// Archaedas
|
||||||
|
if (type==0 )
|
||||||
|
{
|
||||||
ActivateArchaedas (data);
|
ActivateArchaedas (data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -228,33 +243,34 @@ struct TRINITY_DLL_DECL instance_uldaman : public ScriptedInstance
|
|||||||
switch (creature_entry) {
|
switch (creature_entry) {
|
||||||
case 4857: // Stone Keeper
|
case 4857: // Stone Keeper
|
||||||
SetFrozenState (creature);
|
SetFrozenState (creature);
|
||||||
stoneKeeper[stoneKeepersCounter++] = creature->GetGUID();
|
stoneKeeper.push_back(creature->GetGUID());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 7309: // Earthen Custodian
|
case 7309: // Earthen Custodian
|
||||||
archaedasWallMinions[archaedasWallMinionsCounter++] = creature->GetGUID();
|
archaedasWallMinions.push_back(creature->GetGUID());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 7077: // Earthen Hallshaper
|
case 7077: // Earthen Hallshaper
|
||||||
archaedasWallMinions[archaedasWallMinionsCounter++] = creature->GetGUID();
|
archaedasWallMinions.push_back(creature->GetGUID());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 7076: // Earthen Guardian
|
case 7076: // Earthen Guardian
|
||||||
earthenGuardian[earthenGuardianCounter++] = creature->GetGUID();
|
earthenGuardian.push_back(creature->GetGUID());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 10120: // Vault Walker
|
case 10120: // Vault Walker
|
||||||
vaultWalker[vaultWalkerCounter++] = creature->GetGUID();
|
vaultWalker.push_back(creature->GetGUID());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2748: // Archaedas
|
case 2748: // Archaedas
|
||||||
archaedas = creature;
|
archaedasGUID = creature->GetGUID();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
} // end switch
|
} // end switch
|
||||||
} // end OnCreatureCreate
|
} // end OnCreatureCreate
|
||||||
|
|
||||||
uint64 GetData64 (uint32 identifier) {
|
uint64 GetData64 (uint32 identifier)
|
||||||
|
{
|
||||||
if (identifier == 0) return whoWokeArchaedasGUID;
|
if (identifier == 0) return whoWokeArchaedasGUID;
|
||||||
if (identifier == 1) return vaultWalker[0]; // VaultWalker1
|
if (identifier == 1) return vaultWalker[0]; // VaultWalker1
|
||||||
if (identifier == 2) return vaultWalker[1]; // VaultWalker2
|
if (identifier == 2) return vaultWalker[1]; // VaultWalker2
|
||||||
@@ -270,7 +286,6 @@ struct TRINITY_DLL_DECL instance_uldaman : public ScriptedInstance
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
} // end GetData64
|
} // end GetData64
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user