*Update to Mangos 7208. Implement phase system.
--HG-- branch : trunk
This commit is contained in:
+14
-9
@@ -637,11 +637,11 @@ void Creature::DisablePossessedAI()
|
||||
m_AI_enabled = true;
|
||||
}
|
||||
|
||||
bool Creature::Create (uint32 guidlow, Map *map, uint32 Entry, uint32 team, const CreatureData *data)
|
||||
bool Creature::Create (uint32 guidlow, Map *map, uint32 phaseMask, uint32 Entry, uint32 team, const CreatureData *data)
|
||||
{
|
||||
SetMapId(map->GetId());
|
||||
SetInstanceId(map->GetInstanceId());
|
||||
//m_DBTableGuid = guidlow;
|
||||
SetPhaseMask(phaseMask,false);
|
||||
|
||||
//oX = x; oY = y; dX = x; dY = y; m_moveTime = 0; m_startMove = 0;
|
||||
const bool bResult = CreateFromProto(guidlow, Entry, team, data);
|
||||
@@ -1192,10 +1192,10 @@ void Creature::SaveToDB()
|
||||
return;
|
||||
}
|
||||
|
||||
SaveToDB(GetMapId(), data->spawnMask);
|
||||
SaveToDB(GetMapId(), data->spawnMask,GetPhaseMask());
|
||||
}
|
||||
|
||||
void Creature::SaveToDB(uint32 mapid, uint8 spawnMask)
|
||||
void Creature::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask)
|
||||
{
|
||||
// update in loaded data
|
||||
if (!m_DBTableGuid)
|
||||
@@ -1215,6 +1215,7 @@ void Creature::SaveToDB(uint32 mapid, uint8 spawnMask)
|
||||
// data->guid = guid don't must be update at save
|
||||
data.id = GetEntry();
|
||||
data.mapid = mapid;
|
||||
data.phaseMask = phaseMask;
|
||||
data.displayid = displayId;
|
||||
data.equipmentId = GetEquipmentId();
|
||||
data.posX = GetPositionX();
|
||||
@@ -1413,7 +1414,7 @@ bool Creature::LoadFromDB(uint32 guid, Map *map)
|
||||
if (map->GetInstanceId() != 0) guid = objmgr.GenerateLowGuid(HIGHGUID_UNIT);
|
||||
|
||||
uint16 team = 0;
|
||||
if(!Create(guid,map,data->id,team,data))
|
||||
if(!Create(guid,map,data->phaseMask,data->id,team,data))
|
||||
return false;
|
||||
|
||||
Relocate(data->posX,data->posY,data->posZ,data->orientation);
|
||||
@@ -1544,6 +1545,10 @@ bool Creature::canSeeOrDetect(Unit const* u, bool detect, bool inVisibleList, bo
|
||||
if (u == this)
|
||||
return true;
|
||||
|
||||
// phased visibility (both must phased in same way)
|
||||
if(!InSamePhase(u))
|
||||
return false;
|
||||
|
||||
// always seen by owner
|
||||
if(GetGUID() == u->GetCharmerOrOwnerGUID())
|
||||
return true;
|
||||
@@ -1870,7 +1875,7 @@ void Creature::DoFleeToGetAssistance(float radius) // Optional parameter
|
||||
|
||||
Creature* pCreature = NULL;
|
||||
Trinity::NearestAssistCreatureInCreatureRangeCheck u_check(this,getVictim(),radius);
|
||||
Trinity::CreatureLastSearcher<Trinity::NearestAssistCreatureInCreatureRangeCheck> searcher(pCreature, u_check);
|
||||
Trinity::CreatureLastSearcher<Trinity::NearestAssistCreatureInCreatureRangeCheck> searcher(this, pCreature, u_check);
|
||||
VisitNearbyGridObject(radius, searcher);
|
||||
|
||||
if(!pCreature)
|
||||
@@ -1890,7 +1895,7 @@ Unit* Creature::SelectNearestTarget(float dist) const
|
||||
|
||||
{
|
||||
Trinity::NearestHostileUnitInAttackDistanceCheck u_check(this, dist);
|
||||
Trinity::UnitLastSearcher<Trinity::NearestHostileUnitInAttackDistanceCheck> searcher(target, u_check);
|
||||
Trinity::UnitLastSearcher<Trinity::NearestHostileUnitInAttackDistanceCheck> searcher(this, target, u_check);
|
||||
|
||||
TypeContainerVisitor<Trinity::UnitLastSearcher<Trinity::NearestHostileUnitInAttackDistanceCheck>, WorldTypeMapContainer > world_unit_searcher(searcher);
|
||||
TypeContainerVisitor<Trinity::UnitLastSearcher<Trinity::NearestHostileUnitInAttackDistanceCheck>, GridTypeMapContainer > grid_unit_searcher(searcher);
|
||||
@@ -1920,8 +1925,8 @@ void Creature::CallAssistance()
|
||||
cell.data.Part.reserved = ALL_DISTRICT;
|
||||
cell.SetNoCreate();
|
||||
|
||||
Trinity::AnyAssistCreatureInRangeCheck u_check(this, getVictim(), radius);
|
||||
Trinity::CreatureListSearcher<Trinity::AnyAssistCreatureInRangeCheck> searcher(assistList, u_check);
|
||||
MaNGOS::AnyAssistCreatureInRangeCheck u_check(this, getVictim(), radius);
|
||||
MaNGOS::CreatureListSearcher<MaNGOS::AnyAssistCreatureInRangeCheck> searcher(this, assistList, u_check);
|
||||
|
||||
TypeContainerVisitor<Trinity::CreatureListSearcher<Trinity::AnyAssistCreatureInRangeCheck>, GridTypeMapContainer > grid_creature_searcher(searcher);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user