Core/Entities: Extended SpawnMask to 64 bit

This commit is contained in:
hondacrx
2018-01-06 23:43:44 -05:00
parent ff338c6532
commit befc9fcae7
16 changed files with 95 additions and 75 deletions
+4 -8
View File
@@ -725,14 +725,10 @@ namespace Game.Chat
return false;
}
if (target.IsTypeId(TypeId.Unit))
{
int dbPhase = target.ToCreature().GetDBPhase();
if (dbPhase > 0)
handler.SendSysMessage("Target creature's PhaseId in DB: {0}", dbPhase);
else if (dbPhase < 0)
handler.SendSysMessage("Target creature's PhaseGroup in DB: {0}", Math.Abs(dbPhase));
}
if (target.GetDBPhase() > 0)
handler.SendSysMessage($"Target creature's PhaseId in DB: {target.GetDBPhase()}");
else if (target.GetDBPhase() < 0)
handler.SendSysMessage($"Target creature's PhaseGroup in DB: {Math.Abs(target.GetDBPhase())}");
string phases = "";
foreach (uint phase in target.GetPhases())
@@ -487,7 +487,7 @@ namespace Game.Chat
}
// fill the gameobject data and save to the db
obj.SaveToDB(map.GetId(), (byte)(1 << (int)map.GetSpawnMode()), player.GetPhaseMask());
obj.SaveToDB(map.GetId(), 1ul << (int)map.GetSpawnMode());
ulong spawnId = obj.GetSpawnId();
// this will generate a new guid if the object is in an instance
+6 -6
View File
@@ -86,7 +86,7 @@ namespace Game.Chat
CreatureData data = Global.ObjectMgr.GetCreatureData(target.GetSpawnId());
if (data != null)
{
handler.SendSysMessage(CypherStrings.NpcinfoPhases, data.phaseid, data.phaseGroup);
handler.SendSysMessage(CypherStrings.NpcinfoPhases, data.phaseId, data.phaseGroup);
if (data.phaseGroup != 0)
{
var _phases = target.GetPhases();
@@ -1106,15 +1106,14 @@ namespace Game.Chat
ulong guid = map.GenerateLowGuid(HighGuid.Creature);
CreatureData data = Global.ObjectMgr.NewOrExistCreatureData(guid);
data.id = id;
data.phaseMask = chr.GetPhaseMask();
data.posX = chr.GetTransOffsetX();
data.posY = chr.GetTransOffsetY();
data.posZ = chr.GetTransOffsetZ();
data.orientation = chr.GetTransOffsetO();
// @todo: add phases
Creature _creature = trans.CreateNPCPassenger(guid, data);
_creature.SaveToDB((uint)trans.GetGoInfo().MoTransport.SpawnMap, (byte)(1 << (int)map.GetSpawnMode()), chr.GetPhaseMask());
_creature.SaveToDB((uint)trans.GetGoInfo().MoTransport.SpawnMap, 1ul << (int)map.GetSpawnMode());
Global.ObjectMgr.AddCreatureToGrid(guid, data);
return true;
@@ -1124,7 +1123,8 @@ namespace Game.Chat
if (!creature.Create(map.GenerateLowGuid(HighGuid.Creature), map, chr.GetPhaseMask(), id, x, y, z, o))
return false;
creature.SaveToDB(map.GetId(), (byte)(1 << (int)map.GetSpawnMode()), chr.GetPhaseMask());
creature.CopyPhaseFrom(chr);
creature.SaveToDB(map.GetId(), 1ul << (int)map.GetSpawnMode());
ulong db_guid = creature.GetSpawnId();
+4 -4
View File
@@ -549,7 +549,7 @@ namespace Game.Chat.Commands
if (!wpCreature.Create(map.GenerateLowGuid(HighGuid.Creature), map, chr.GetPhaseMask(), 1, chr.GetPositionX(), chr.GetPositionY(), chr.GetPositionZ(), chr.GetOrientation()))
{
wpCreature.CopyPhaseFrom(chr);
wpCreature.SaveToDB(map.GetId(), (1u << (int)map.GetSpawnMode()), chr.GetPhaseMask());
wpCreature.SaveToDB(map.GetId(), 1ul << (int)map.GetSpawnMode());
// To call _LoadGoods(); _LoadQuests(); CreateTrainerSpells();
/// @todo Should we first use "Create" then use "LoadFromDB"?
if (!wpCreature.LoadCreatureFromDB(wpCreature.GetSpawnId(), map))
@@ -762,7 +762,7 @@ namespace Game.Chat.Commands
}
wpCreature.CopyPhaseFrom(chr);
wpCreature.SaveToDB(map.GetId(), (1u << (int)map.GetSpawnMode()), chr.GetPhaseMask());
wpCreature.SaveToDB(map.GetId(), 1ul << (int)map.GetSpawnMode());
// Set "wpguid" column to the visual waypoint
stmt = DB.World.GetPreparedStatement(WorldStatements.UPD_WAYPOINT_DATA_WPGUID);
@@ -822,8 +822,8 @@ namespace Game.Chat.Commands
}
creature.CopyPhaseFrom(chr);
creature.SaveToDB(map.GetId(), 1ul << (int)map.GetSpawnMode());
creature.SaveToDB(map.GetId(), (uint)(1 << (int)map.GetSpawnMode()), chr.GetPhaseMask());
if (!creature.LoadCreatureFromDB(creature.GetSpawnId(), map))
{
handler.SendSysMessage(CypherStrings.WaypointVpNotcreated, id);
@@ -870,8 +870,8 @@ namespace Game.Chat.Commands
}
creature.CopyPhaseFrom(chr);
creature.SaveToDB(map.GetId(), 1ul << (int)map.GetSpawnMode());
creature.SaveToDB(map.GetId(), (uint)(1 << (int)map.GetSpawnMode()), chr.GetPhaseMask());
if (!creature.LoadCreatureFromDB(creature.GetSpawnId(), map))
{
handler.SendSysMessage(CypherStrings.WaypointNotcreated, id);