Core/Entities: Extended SpawnMask to 64 bit
This commit is contained in:
@@ -724,8 +724,8 @@ namespace Game.Entities
|
||||
{
|
||||
SetMap(map);
|
||||
|
||||
if (data != null && data.phaseid != 0)
|
||||
SetInPhase(data.phaseid, false, true);
|
||||
if (data != null && data.phaseId != 0)
|
||||
SetInPhase(data.phaseId, false, true);
|
||||
|
||||
if (data != null && data.phaseGroup != 0)
|
||||
foreach (var ph in Global.DB2Mgr.GetPhasesForGroup(data.phaseGroup))
|
||||
@@ -977,10 +977,10 @@ namespace Game.Entities
|
||||
}
|
||||
|
||||
uint mapId = GetTransport() ? (uint)GetTransport().GetGoInfo().MoTransport.SpawnMap : GetMapId();
|
||||
SaveToDB(mapId, data.spawnMask, GetPhaseMask());
|
||||
SaveToDB(mapId, data.spawnMask);
|
||||
}
|
||||
|
||||
public virtual void SaveToDB(uint mapid, uint spawnMask, uint phaseMask)
|
||||
public virtual void SaveToDB(uint mapid, ulong spawnMask)
|
||||
{
|
||||
// update in loaded data
|
||||
if (m_spawnId == 0)
|
||||
@@ -1022,7 +1022,6 @@ namespace Game.Entities
|
||||
// data.guid = guid must not be updated at save
|
||||
data.id = GetEntry();
|
||||
data.mapid = (ushort)mapid;
|
||||
data.phaseMask = phaseMask;
|
||||
data.displayid = displayId;
|
||||
data.equipmentId = GetCurrentEquipmentId();
|
||||
data.posX = GetPositionX();
|
||||
@@ -1045,7 +1044,7 @@ namespace Game.Entities
|
||||
data.unit_flags3 = unitFlags3;
|
||||
data.dynamicflags = dynamicflags;
|
||||
|
||||
data.phaseid = (uint)(GetDBPhase() > 0 ? GetDBPhase() : 0);
|
||||
data.phaseId = (uint)(GetDBPhase() > 0 ? GetDBPhase() : 0);
|
||||
data.phaseGroup = (uint)(GetDBPhase() < 0 ? Math.Abs(GetDBPhase()) : 0);
|
||||
|
||||
// update in DB
|
||||
@@ -1062,7 +1061,7 @@ namespace Game.Entities
|
||||
stmt.AddValue(index++, GetEntry());
|
||||
stmt.AddValue(index++, mapid);
|
||||
stmt.AddValue(index++, spawnMask);
|
||||
stmt.AddValue(index++, data.phaseid);
|
||||
stmt.AddValue(index++, data.phaseId);
|
||||
stmt.AddValue(index++, data.phaseGroup);
|
||||
stmt.AddValue(index++, displayId);
|
||||
stmt.AddValue(index++, GetCurrentEquipmentId());
|
||||
@@ -1320,7 +1319,7 @@ namespace Game.Entities
|
||||
|
||||
m_spawnId = spawnId;
|
||||
m_creatureData = data;
|
||||
if (!Create(map.GenerateLowGuid(HighGuid.Creature), map, data.phaseMask, data.id, data.posX, data.posY, data.posZ, data.orientation, data))
|
||||
if (!Create(map.GenerateLowGuid(HighGuid.Creature), map, PhaseMasks.Normal, data.id, data.posX, data.posY, data.posZ, data.orientation, data))
|
||||
return false;
|
||||
|
||||
//We should set first home position, because then AI calls home movement
|
||||
|
||||
@@ -279,7 +279,6 @@ namespace Game.Entities
|
||||
{
|
||||
public uint id; // entry in creature_template
|
||||
public ushort mapid;
|
||||
public uint phaseMask;
|
||||
public uint displayid;
|
||||
public int equipmentId;
|
||||
public float posX;
|
||||
@@ -292,13 +291,13 @@ namespace Game.Entities
|
||||
public uint curhealth;
|
||||
public uint curmana;
|
||||
public byte movementType;
|
||||
public uint spawnMask;
|
||||
public ulong spawnMask;
|
||||
public ulong npcflag;
|
||||
public uint unit_flags; // enum UnitFlags mask values
|
||||
public uint unit_flags2; // enum UnitFlags2 mask values
|
||||
public uint unit_flags3; // enum UnitFlags3 mask values
|
||||
public uint dynamicflags;
|
||||
public uint phaseid;
|
||||
public uint phaseId;
|
||||
public uint phaseGroup;
|
||||
public uint ScriptId;
|
||||
public bool dbData;
|
||||
|
||||
@@ -846,10 +846,10 @@ namespace Game.Entities
|
||||
return;
|
||||
}
|
||||
|
||||
SaveToDB(GetMapId(), data.spawnMask, data.phaseMask);
|
||||
SaveToDB(GetMapId(), data.spawnMask);
|
||||
}
|
||||
|
||||
public void SaveToDB(uint mapid, uint spawnMask, uint phaseMask)
|
||||
public void SaveToDB(uint mapid, ulong spawnMask)
|
||||
{
|
||||
GameObjectTemplate goI = GetGoInfo();
|
||||
|
||||
@@ -865,7 +865,6 @@ namespace Game.Entities
|
||||
// guid = guid must not be updated at save
|
||||
data.id = GetEntry();
|
||||
data.mapid = (ushort)mapid;
|
||||
data.phaseMask = (ushort)phaseMask;
|
||||
data.posX = GetPositionX();
|
||||
data.posY = GetPositionY();
|
||||
data.posZ = GetPositionZ();
|
||||
@@ -878,6 +877,9 @@ namespace Game.Entities
|
||||
data.artKit = GetGoArtKit();
|
||||
Global.ObjectMgr.NewGOData(m_spawnId, data);
|
||||
|
||||
data.phaseId = (uint)(GetDBPhase() > 0 ? GetDBPhase() : 0);
|
||||
data.phaseGroup = (uint)(GetDBPhase() < 0 ? Math.Abs(GetDBPhase()) : 0);
|
||||
|
||||
// Update in DB
|
||||
byte index = 0;
|
||||
PreparedStatement stmt = DB.World.GetPreparedStatement(WorldStatements.DEL_GAMEOBJECT);
|
||||
@@ -889,6 +891,8 @@ namespace Game.Entities
|
||||
stmt.AddValue(index++, GetEntry());
|
||||
stmt.AddValue(index++, mapid);
|
||||
stmt.AddValue(index++, spawnMask);
|
||||
stmt.AddValue(index++, data.phaseId);
|
||||
stmt.AddValue(index++, data.phaseGroup);
|
||||
stmt.AddValue(index++, GetPositionX());
|
||||
stmt.AddValue(index++, GetPositionY());
|
||||
stmt.AddValue(index++, GetPositionZ());
|
||||
@@ -914,7 +918,6 @@ namespace Game.Entities
|
||||
}
|
||||
|
||||
uint entry = data.id;
|
||||
uint phaseMask = data.phaseMask;
|
||||
Position pos = new Position(data.posX, data.posY, data.posZ, data.orientation);
|
||||
|
||||
uint animprogress = data.animprogress;
|
||||
@@ -922,11 +925,11 @@ namespace Game.Entities
|
||||
uint artKit = data.artKit;
|
||||
|
||||
m_spawnId = spawnId;
|
||||
if (!Create(entry, map, phaseMask, pos, data.rotation, animprogress, go_state, artKit))
|
||||
if (!Create(entry, map, PhaseMasks.Normal, pos, data.rotation, animprogress, go_state, artKit))
|
||||
return false;
|
||||
|
||||
if (data.phaseid != 0)
|
||||
SetInPhase(data.phaseid, false, true);
|
||||
if (data.phaseId != 0)
|
||||
SetInPhase(data.phaseId, false, true);
|
||||
|
||||
if (data.phaseGroup != 0)
|
||||
{
|
||||
|
||||
@@ -1055,7 +1055,6 @@ namespace Game.Entities
|
||||
{
|
||||
public uint id; // entry in gamobject_template
|
||||
public ushort mapid;
|
||||
public ushort phaseMask;
|
||||
public float posX;
|
||||
public float posY;
|
||||
public float posZ;
|
||||
@@ -1064,9 +1063,9 @@ namespace Game.Entities
|
||||
public int spawntimesecs;
|
||||
public uint animprogress;
|
||||
public GameObjectState go_state;
|
||||
public uint spawnMask;
|
||||
public ulong spawnMask;
|
||||
public byte artKit;
|
||||
public uint phaseid;
|
||||
public uint phaseId;
|
||||
public uint phaseGroup;
|
||||
public uint ScriptId;
|
||||
public bool dbData = true;
|
||||
|
||||
@@ -288,7 +288,7 @@ namespace Game.Entities
|
||||
base.RemoveFromWorld();
|
||||
}
|
||||
|
||||
public override void SaveToDB(uint mapid, uint spawnMask, uint phaseMask) { }
|
||||
public override void SaveToDB(uint mapid, ulong spawnMask) { }
|
||||
|
||||
public ObjectGuid GetSummonerGUID() { return m_summonerGUID; }
|
||||
|
||||
|
||||
@@ -338,8 +338,8 @@ namespace Game.Entities
|
||||
return null;
|
||||
}
|
||||
|
||||
if (data.phaseid != 0)
|
||||
creature.SetInPhase(data.phaseid, false, true);
|
||||
if (data.phaseId != 0)
|
||||
creature.SetInPhase(data.phaseId, false, true);
|
||||
else if (data.phaseGroup != 0)
|
||||
{
|
||||
foreach (var phase in Global.DB2Mgr.GetPhasesForGroup(data.phaseGroup))
|
||||
|
||||
Reference in New Issue
Block a user