[7207] Phase system development continue for DB/in_game objects

* Store phase mask for creatures/gameobjects/corpse in DB
* Propertly set phase for summoned creatures/gameobjects/pets/corpses/spell related dynobjects
* Select proper phase for spawned creature/gameobjects and save it in DB

TODO: in game commands.
This commit is contained in:
VladimirMangos 2009-01-30 18:56:49 +03:00
parent b5da610388
commit aa24bd836e
29 changed files with 204 additions and 82 deletions

View file

@ -1028,11 +1028,12 @@ WorldObject::WorldObject()
{
}
void WorldObject::_Create( uint32 guidlow, HighGuid guidhigh, uint32 mapid )
void WorldObject::_Create( uint32 guidlow, HighGuid guidhigh, uint32 mapid, uint32 phaseMask )
{
Object::_Create(guidlow, 0, guidhigh);
m_mapId = mapid;
m_phaseMask = phaseMask;
}
uint32 WorldObject::GetZoneId() const
@ -1468,7 +1469,7 @@ Creature* WorldObject::SummonCreature(uint32 id, float x, float y, float z, floa
if (GetTypeId()==TYPEID_PLAYER)
team = ((Player*)this)->GetTeam();
if (!pCreature->Create(objmgr.GenerateLowGuid(HIGHGUID_UNIT), GetMap(), id, team))
if (!pCreature->Create(objmgr.GenerateLowGuid(HIGHGUID_UNIT), GetMap(), GetPhaseMask(), id, team))
{
delete pCreature;
return NULL;
@ -1704,3 +1705,11 @@ void WorldObject::GetNearPoint(WorldObject const* searcher, float &x, float &y,
UpdateGroundPositionZ(x,y,z); // update to LOS height if available
}
void WorldObject::SetPhaseMask(uint32 newPhaseMask, bool update)
{
m_phaseMask = newPhaseMask;
if(update && IsInWorld())
ObjectAccessor::UpdateObjectVisibility(this);
}