[7690] Move GetCreature/GetGameobject to class Map. Author: VladimirMangos
* This let get objects at map without reference to player or another object.
* Simplify future implementation for per-map storage for like objects
--HG--
branch : trunk
This commit is contained in:
@@ -169,7 +169,7 @@ struct TRINITY_DLL_DECL instance_mount_hyjal : public ScriptedInstance
|
||||
if(ArchiYell)break;
|
||||
ArchiYell = true;
|
||||
|
||||
Creature* pCreature = instance->GetCreatureInMap(Azgalor);
|
||||
Creature* pCreature = instance->GetCreature(Azgalor);
|
||||
if(pCreature)
|
||||
{
|
||||
Creature* pUnit = pCreature->SummonCreature(21987,pCreature->GetPositionX(),pCreature->GetPositionY(),pCreature->GetPositionZ(),0,TEMPSUMMON_TIMED_DESPAWN,10000);
|
||||
|
||||
+1
-1
@@ -136,7 +136,7 @@ struct TRINITY_DLL_DECL instance_serpentshrine_cavern : public ScriptedInstance
|
||||
|
||||
void OpenDoor(uint64 DoorGUID, bool open)
|
||||
{
|
||||
if(GameObject *Door = instance->GetGameObjectInMap(DoorGUID))
|
||||
if(GameObject *Door = instance->GetGameObject(DoorGUID))
|
||||
Door->SetGoState(open ? 0 : 1);
|
||||
}
|
||||
|
||||
|
||||
+10
-10
@@ -126,7 +126,7 @@ struct TRINITY_DLL_DECL instance_magtheridons_lair : public ScriptedInstance
|
||||
RespawnTimer = 10000;
|
||||
if(data != IN_PROGRESS)
|
||||
{
|
||||
if(GameObject *Door = instance->GetGameObjectInMap(DoorGUID))
|
||||
if(GameObject *Door = instance->GetGameObject(DoorGUID))
|
||||
Door->SetGoState(0);
|
||||
}
|
||||
break;
|
||||
@@ -139,7 +139,7 @@ struct TRINITY_DLL_DECL instance_magtheridons_lair : public ScriptedInstance
|
||||
Encounters[1] = NOT_STARTED;
|
||||
for(std::set<uint64>::iterator i = ChannelerGUID.begin(); i != ChannelerGUID.end(); ++i)
|
||||
{
|
||||
if(Creature *Channeler = instance->GetCreatureInMap(*i))
|
||||
if(Creature *Channeler = instance->GetCreature(*i))
|
||||
{
|
||||
if(Channeler->isAlive())
|
||||
Channeler->AI()->EnterEvadeMode();
|
||||
@@ -148,7 +148,7 @@ struct TRINITY_DLL_DECL instance_magtheridons_lair : public ScriptedInstance
|
||||
}
|
||||
}
|
||||
CageTimer = 0;
|
||||
if(GameObject *Door = instance->GetGameObjectInMap(DoorGUID))
|
||||
if(GameObject *Door = instance->GetGameObject(DoorGUID))
|
||||
Door->SetGoState(0);
|
||||
}break;
|
||||
case IN_PROGRESS: // Event start.
|
||||
@@ -158,24 +158,24 @@ struct TRINITY_DLL_DECL instance_magtheridons_lair : public ScriptedInstance
|
||||
// Let all five channelers aggro.
|
||||
for(std::set<uint64>::iterator i = ChannelerGUID.begin(); i != ChannelerGUID.end(); ++i)
|
||||
{
|
||||
Creature *Channeler = instance->GetCreatureInMap(*i);
|
||||
Creature *Channeler = instance->GetCreature(*i);
|
||||
if(Channeler && Channeler->isAlive())
|
||||
Channeler->AI()->AttackStart(Channeler->SelectNearestTarget(999));
|
||||
}
|
||||
// Release Magtheridon after two minutes.
|
||||
Creature *Magtheridon = instance->GetCreatureInMap(MagtheridonGUID);
|
||||
Creature *Magtheridon = instance->GetCreature(MagtheridonGUID);
|
||||
if(Magtheridon && Magtheridon->isAlive())
|
||||
{
|
||||
Magtheridon->MonsterTextEmote("'s bonds begin to weaken!", 0);
|
||||
CageTimer = 120000;
|
||||
}
|
||||
if(GameObject *Door = instance->GetGameObjectInMap(DoorGUID))
|
||||
if(GameObject *Door = instance->GetGameObject(DoorGUID))
|
||||
Door->SetGoState(1);
|
||||
}break;
|
||||
case DONE: // Add buff and check if all channelers are dead.
|
||||
for(std::set<uint64>::iterator i = ChannelerGUID.begin(); i != ChannelerGUID.end(); ++i)
|
||||
{
|
||||
Creature *Channeler = instance->GetCreatureInMap(*i);
|
||||
Creature *Channeler = instance->GetCreature(*i);
|
||||
if(Channeler && Channeler->isAlive())
|
||||
{
|
||||
//Channeler->CastSpell(Channeler, SPELL_SOUL_TRANSFER, true);
|
||||
@@ -190,7 +190,7 @@ struct TRINITY_DLL_DECL instance_magtheridons_lair : public ScriptedInstance
|
||||
// true - collapse / false - reset
|
||||
for(std::set<uint64>::iterator i = ColumnGUID.begin(); i != ColumnGUID.end(); ++i)
|
||||
{
|
||||
if(GameObject *Column = instance->GetGameObjectInMap(*i))
|
||||
if(GameObject *Column = instance->GetGameObject(*i))
|
||||
Column->SetGoState(!data);
|
||||
}
|
||||
break;
|
||||
@@ -212,7 +212,7 @@ struct TRINITY_DLL_DECL instance_magtheridons_lair : public ScriptedInstance
|
||||
{
|
||||
if(CageTimer <= diff)
|
||||
{
|
||||
Creature *Magtheridon = instance->GetCreatureInMap(MagtheridonGUID);
|
||||
Creature *Magtheridon = instance->GetCreature(MagtheridonGUID);
|
||||
if(Magtheridon && Magtheridon->isAlive())
|
||||
{
|
||||
Magtheridon->clearUnitState(UNIT_STAT_STUNNED);
|
||||
@@ -228,7 +228,7 @@ struct TRINITY_DLL_DECL instance_magtheridons_lair : public ScriptedInstance
|
||||
{
|
||||
for(std::set<uint64>::iterator i = ChannelerGUID.begin(); i != ChannelerGUID.end(); ++i)
|
||||
{
|
||||
if(Creature *Channeler = instance->GetCreatureInMap(*i))
|
||||
if(Creature *Channeler = instance->GetCreature(*i))
|
||||
{
|
||||
if(Channeler->isAlive())
|
||||
Channeler->AI()->EnterEvadeMode();
|
||||
|
||||
@@ -93,7 +93,7 @@ struct TRINITY_DLL_DECL instance_scarlet_monastery : public ScriptedInstance
|
||||
case TYPE_MOGRAINE_AND_WHITE_EVENT: Encounter[0] = data; break;
|
||||
case GAMEOBJECT_PUMPKIN_SHRINE:
|
||||
{
|
||||
GameObject *Shrine = instance->GetGameObjectInMap(PumpkinShrineGUID);
|
||||
GameObject *Shrine = instance->GetGameObject(PumpkinShrineGUID);
|
||||
if(Shrine)
|
||||
Shrine->SetGoState(1);
|
||||
}break;
|
||||
@@ -102,12 +102,12 @@ struct TRINITY_DLL_DECL instance_scarlet_monastery : public ScriptedInstance
|
||||
{
|
||||
for(std::set<uint64>::iterator itr = HorsemanAdds.begin(); itr != HorsemanAdds.end(); ++itr)
|
||||
{
|
||||
Creature* add = instance->GetCreatureInMap(*itr);
|
||||
Creature* add = instance->GetCreature(*itr);
|
||||
if(add && add->isAlive())
|
||||
add->DealDamage(add, add->GetMaxHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
|
||||
}
|
||||
HorsemanAdds.clear();
|
||||
GameObject *Shrine = instance->GetGameObjectInMap(PumpkinShrineGUID);
|
||||
GameObject *Shrine = instance->GetGameObject(PumpkinShrineGUID);
|
||||
if(Shrine)
|
||||
Shrine->SetGoState(1);
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ struct TRINITY_DLL_DECL instance_uldaman : public ScriptedInstance
|
||||
|
||||
void OpenDoor(uint64 guid)
|
||||
{
|
||||
GameObject *go = instance->GetGameObjectInMap(guid);
|
||||
GameObject *go = instance->GetGameObject(guid);
|
||||
if(!go)
|
||||
return;
|
||||
|
||||
@@ -100,7 +100,7 @@ struct TRINITY_DLL_DECL instance_uldaman : public ScriptedInstance
|
||||
{
|
||||
for(std::vector<uint64>::iterator i = stoneKeeper.begin(); i != stoneKeeper.end(); ++i)
|
||||
{
|
||||
Creature *target = instance->GetCreatureInMap(*i);
|
||||
Creature *target = instance->GetCreature(*i);
|
||||
if (!target || !target->isAlive() || target->getFaction()==14)
|
||||
continue;
|
||||
target->RemoveFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_DISABLE_MOVE);
|
||||
@@ -114,13 +114,13 @@ struct TRINITY_DLL_DECL instance_uldaman : public ScriptedInstance
|
||||
|
||||
void ActivateWallMinions()
|
||||
{
|
||||
Creature *archaedas = instance->GetCreatureInMap(archaedasGUID);
|
||||
Creature *archaedas = instance->GetCreature(archaedasGUID);
|
||||
if(!archaedas)
|
||||
return;
|
||||
|
||||
for(std::vector<uint64>::iterator i = archaedasWallMinions.begin(); i != archaedasWallMinions.end(); ++i)
|
||||
{
|
||||
Creature *target = instance->GetCreatureInMap(*i);
|
||||
Creature *target = instance->GetCreature(*i);
|
||||
if (!target || !target->isAlive() || target->getFaction()==14)
|
||||
continue;
|
||||
archaedas->CastSpell(target, SPELL_AWAKEN_VAULT_WALKER, true);
|
||||
@@ -135,7 +135,7 @@ struct TRINITY_DLL_DECL instance_uldaman : public ScriptedInstance
|
||||
// first despawn any aggroed wall minions
|
||||
for(std::vector<uint64>::iterator i = archaedasWallMinions.begin(); i != archaedasWallMinions.end(); ++i)
|
||||
{
|
||||
Creature *target = instance->GetCreatureInMap(*i);
|
||||
Creature *target = instance->GetCreature(*i);
|
||||
if (!target || target->isDead() || target->getFaction()!=14)
|
||||
continue;
|
||||
target->setDeathState(JUST_DIED);
|
||||
@@ -145,7 +145,7 @@ struct TRINITY_DLL_DECL instance_uldaman : public ScriptedInstance
|
||||
// Vault Walkers
|
||||
for(std::vector<uint64>::iterator i = vaultWalker.begin(); i != vaultWalker.end(); ++i)
|
||||
{
|
||||
Creature *target = instance->GetCreatureInMap(*i);
|
||||
Creature *target = instance->GetCreature(*i);
|
||||
if (!target || target->isDead() || target->getFaction()!=14)
|
||||
continue;
|
||||
target->setDeathState(JUST_DIED);
|
||||
@@ -155,7 +155,7 @@ struct TRINITY_DLL_DECL instance_uldaman : public ScriptedInstance
|
||||
// Earthen Guardians
|
||||
for(std::vector<uint64>::iterator i = earthenGuardian.begin(); i != earthenGuardian.end(); ++i)
|
||||
{
|
||||
Creature *target = instance->GetCreatureInMap(*i);
|
||||
Creature *target = instance->GetCreature(*i);
|
||||
if (!target || target->isDead() || target->getFaction()!=14)
|
||||
continue;
|
||||
target->setDeathState(JUST_DIED);
|
||||
@@ -165,7 +165,7 @@ struct TRINITY_DLL_DECL instance_uldaman : public ScriptedInstance
|
||||
|
||||
void ActivateArchaedas(uint64 target)
|
||||
{
|
||||
Creature *archaedas = instance->GetCreatureInMap(archaedasGUID);
|
||||
Creature *archaedas = instance->GetCreature(archaedasGUID);
|
||||
if(!archaedas)
|
||||
return;
|
||||
|
||||
@@ -181,7 +181,7 @@ struct TRINITY_DLL_DECL instance_uldaman : public ScriptedInstance
|
||||
// first respawn any aggroed wall minions
|
||||
for(std::vector<uint64>::iterator i = archaedasWallMinions.begin(); i != archaedasWallMinions.end(); ++i)
|
||||
{
|
||||
Creature *target = instance->GetCreatureInMap(*i);
|
||||
Creature *target = instance->GetCreature(*i);
|
||||
if (target && target->isDead())
|
||||
{
|
||||
target->Respawn();
|
||||
@@ -193,7 +193,7 @@ struct TRINITY_DLL_DECL instance_uldaman : public ScriptedInstance
|
||||
// Vault Walkers
|
||||
for(std::vector<uint64>::iterator i = vaultWalker.begin(); i != vaultWalker.end(); ++i)
|
||||
{
|
||||
Creature *target = instance->GetCreatureInMap(*i);
|
||||
Creature *target = instance->GetCreature(*i);
|
||||
if (target && target->isDead())
|
||||
{
|
||||
target->Respawn();
|
||||
@@ -205,7 +205,7 @@ struct TRINITY_DLL_DECL instance_uldaman : public ScriptedInstance
|
||||
// Earthen Guardians
|
||||
for(std::vector<uint64>::iterator i = earthenGuardian.begin(); i != earthenGuardian.end(); ++i)
|
||||
{
|
||||
Creature *target = instance->GetCreatureInMap(*i);
|
||||
Creature *target = instance->GetCreature(*i);
|
||||
if (target && target->isDead())
|
||||
{
|
||||
target->Respawn();
|
||||
|
||||
@@ -139,7 +139,7 @@ struct TRINITY_DLL_DECL instance_zulaman : public ScriptedInstance
|
||||
|
||||
void OpenDoor(uint64 DoorGUID, bool open)
|
||||
{
|
||||
if(GameObject *Door = instance->GetGameObjectInMap(DoorGUID))
|
||||
if(GameObject *Door = instance->GetGameObject(DoorGUID))
|
||||
Door->SetGoState(open ? 0 : 1);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user