mirror of
https://github.com/mangosfour/server.git
synced 2025-12-26 16:37:06 +00:00
[11138] Make sure GameEvent/Pool systems work with static instance object guids
* Pool System for correct full power work in instance need implement
MapPersistentState local pool system state for instanceable maps.
Unit this not implemented pool system must avoid creating/despawn/touch
instance map objects. Currently this work because instance map object use
dynamic generated guids and "invisible" for Pool System, with explcitly forbiden
for it spawn directly new objects. Code changes add explicit checks for preserve
this way work for time when instance object will use static guids. When local pool
state storing in persistent state this protection checks will possible drop.
Non-instanced working cases converted in local map object search calls.
* GameEvent Systems currently have code that work correctly only with objects at
non-instanced maps by same reasons as Pool System. But in different Pool System
case game event activate/deactivate expected applied to _all_ object copies in all
existed instanceable map copies. Code modified for work in expected way.
Direct spawn disabled for instanceable maps until swith to static guids.
Despawn code will make affect only for non-instanceavble maps unit swithc to static guids as-is.
This is preserve current code working result.
* Convert last case usage global creature search in aura code to map local case.
Player case also possible not need now after including caster damage/heal mods
part to aura base damage/heal. In any cases player case preserved in old way work.
NOTE: this last places dependent from global creature/gameobject guid search so look like this
make possible start direct work to switch instances use static guids instead dynamic generated
This commit is contained in:
parent
47060fe4b1
commit
9a8a74c2ad
8 changed files with 231 additions and 65 deletions
|
|
@ -265,8 +265,20 @@ void PoolGroup<Creature>::Despawn1Object(uint32 guid)
|
|||
{
|
||||
sObjectMgr.RemoveCreatureFromGrid(guid, data);
|
||||
|
||||
if (Creature* pCreature = ObjectAccessor::GetCreatureInWorld(ObjectGuid(HIGHGUID_UNIT, data->id, guid)))
|
||||
pCreature->AddObjectToRemoveList();
|
||||
// FIXME: pool system must have local state for each instanced map copy
|
||||
// Current code preserve existed single state for all instanced map copies way
|
||||
// specially because pool system not spawn object in instanceable maps
|
||||
MapEntry const* mapEntry = sMapStore.LookupEntry(data->mapid);
|
||||
|
||||
// temporary limit pool system full power work to continents
|
||||
if (mapEntry && !mapEntry->Instanceable())
|
||||
{
|
||||
if (Map* map = const_cast<Map*>(sMapMgr.FindMap(data->mapid)))
|
||||
{
|
||||
if (Creature* pCreature = map->GetCreature(ObjectGuid(HIGHGUID_UNIT, data->id, guid)))
|
||||
pCreature->AddObjectToRemoveList();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -278,8 +290,20 @@ void PoolGroup<GameObject>::Despawn1Object(uint32 guid)
|
|||
{
|
||||
sObjectMgr.RemoveGameobjectFromGrid(guid, data);
|
||||
|
||||
if (GameObject* pGameobject = ObjectAccessor::GetGameObjectInWorld(ObjectGuid(HIGHGUID_GAMEOBJECT, data->id, guid)))
|
||||
pGameobject->AddObjectToRemoveList();
|
||||
// FIXME: pool system must have local state for each instanced map copy
|
||||
// Current code preserve existed single state for all instanced map copies way
|
||||
// specially because pool system not spawn object in instanceable maps
|
||||
MapEntry const* mapEntry = sMapStore.LookupEntry(data->mapid);
|
||||
|
||||
// temporary limit pool system full power work to continents
|
||||
if (mapEntry && !mapEntry->Instanceable())
|
||||
{
|
||||
if (Map* map = const_cast<Map*>(sMapMgr.FindMap(data->mapid)))
|
||||
{
|
||||
if (GameObject* pGameobject = map->GetGameObject(ObjectGuid(HIGHGUID_GAMEOBJECT, data->id, guid)))
|
||||
pGameobject->AddObjectToRemoveList();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -370,7 +394,8 @@ void PoolGroup<Creature>::Spawn1Object(PoolObject* obj, bool instantly)
|
|||
|
||||
MapEntry const* mapEntry = sMapStore.LookupEntry(data->mapid);
|
||||
|
||||
// temporary limit pool system full power work to continents
|
||||
// FIXME: pool system must have local state for each instanced map copy
|
||||
// Current code preserve existed single state for all instanced map copies way
|
||||
if (mapEntry && !mapEntry->Instanceable())
|
||||
{
|
||||
// Spawn if necessary (loaded grids only)
|
||||
|
|
@ -417,7 +442,8 @@ void PoolGroup<GameObject>::Spawn1Object(PoolObject* obj, bool instantly)
|
|||
|
||||
MapEntry const* mapEntry = sMapStore.LookupEntry(data->mapid);
|
||||
|
||||
// temporary limit pool system full power work to continents
|
||||
// FIXME: pool system must have local state for each instanced map copy
|
||||
// Current code preserve existed single state for all instanced map copies way
|
||||
if (mapEntry && !mapEntry->Instanceable())
|
||||
{
|
||||
// Spawn if necessary (loaded grids only)
|
||||
|
|
@ -471,8 +497,22 @@ template <>
|
|||
void PoolGroup<Creature>::ReSpawn1Object(PoolObject* obj)
|
||||
{
|
||||
if (CreatureData const* data = sObjectMgr.GetCreatureData(obj->guid))
|
||||
if (Creature* pCreature = ObjectAccessor::GetCreatureInWorld(ObjectGuid(HIGHGUID_UNIT, data->id, obj->guid)))
|
||||
pCreature->GetMap()->Add(pCreature);
|
||||
{
|
||||
// FIXME: pool system must have local state for each instanced map copy
|
||||
// Current code preserve existed single state for all instanced map copies way
|
||||
// specially because pool system not spawn object in instanceable maps
|
||||
MapEntry const* mapEntry = sMapStore.LookupEntry(data->mapid);
|
||||
|
||||
// temporary limit pool system full power work to continents
|
||||
if (mapEntry && !mapEntry->Instanceable())
|
||||
{
|
||||
if (Map* map = const_cast<Map*>(sMapMgr.FindMap(data->mapid)))
|
||||
{
|
||||
if (Creature* pCreature = map->GetCreature(ObjectGuid(HIGHGUID_UNIT, data->id, obj->guid)))
|
||||
pCreature->GetMap()->Add(pCreature);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Method that does the respawn job on the specified gameobject
|
||||
|
|
@ -480,8 +520,22 @@ template <>
|
|||
void PoolGroup<GameObject>::ReSpawn1Object(PoolObject* obj)
|
||||
{
|
||||
if (GameObjectData const* data = sObjectMgr.GetGOData(obj->guid))
|
||||
if (GameObject* pGameobject = ObjectAccessor::GetGameObjectInWorld(ObjectGuid(HIGHGUID_GAMEOBJECT, data->id, obj->guid)))
|
||||
pGameobject->GetMap()->Add(pGameobject);
|
||||
{
|
||||
// FIXME: pool system must have local state for each instanced map copy
|
||||
// Current code preserve existed single state for all instanced map copies way
|
||||
// specially because pool system not spawn object in instanceable maps
|
||||
MapEntry const* mapEntry = sMapStore.LookupEntry(data->mapid);
|
||||
|
||||
// temporary limit pool system full power work to continents
|
||||
if (mapEntry && !mapEntry->Instanceable())
|
||||
{
|
||||
if (Map* map = const_cast<Map*>(sMapMgr.FindMap(data->mapid)))
|
||||
{
|
||||
if (GameObject* pGameobject = map->GetGameObject(ObjectGuid(HIGHGUID_GAMEOBJECT, data->id, obj->guid)))
|
||||
pGameobject->GetMap()->Add(pGameobject);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Nothing to do for a child Pool
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue