Core/Entities: Extended SpawnMask to 64 bit
This commit is contained in:
@@ -83,7 +83,7 @@ namespace Framework.Database
|
|||||||
PrepareStatement(WorldStatements.INS_CREATURE, "INSERT INTO creature (guid, id , map, spawnMask, PhaseId, PhaseGroup, modelid, equipment_id, position_x, position_y, position_z, orientation, spawntimesecs, spawndist, currentwaypoint, curhealth, curmana, MovementType, npcflag, unit_flags, unit_flags2, unit_flags3, dynamicflags) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
|
PrepareStatement(WorldStatements.INS_CREATURE, "INSERT INTO creature (guid, id , map, spawnMask, PhaseId, PhaseGroup, modelid, equipment_id, position_x, position_y, position_z, orientation, spawntimesecs, spawndist, currentwaypoint, curhealth, curmana, MovementType, npcflag, unit_flags, unit_flags2, unit_flags3, dynamicflags) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
|
||||||
PrepareStatement(WorldStatements.DEL_GAME_EVENT_CREATURE, "DELETE FROM game_event_creature WHERE guid = ?");
|
PrepareStatement(WorldStatements.DEL_GAME_EVENT_CREATURE, "DELETE FROM game_event_creature WHERE guid = ?");
|
||||||
PrepareStatement(WorldStatements.DEL_GAME_EVENT_MODEL_EQUIP, "DELETE FROM game_event_model_equip WHERE guid = ?");
|
PrepareStatement(WorldStatements.DEL_GAME_EVENT_MODEL_EQUIP, "DELETE FROM game_event_model_equip WHERE guid = ?");
|
||||||
PrepareStatement(WorldStatements.INS_GAMEOBJECT, "INSERT INTO gameobject (guid, id, map, spawnMask, position_x, position_y, position_z, orientation, rotation0, rotation1, rotation2, rotation3, spawntimesecs, animprogress, state) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
|
PrepareStatement(WorldStatements.INS_GAMEOBJECT, "INSERT INTO gameobject (guid, id, map, spawnMask, PhaseId, PhaseGroup, position_x, position_y, position_z, orientation, rotation0, rotation1, rotation2, rotation3, spawntimesecs, animprogress, state) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
|
||||||
PrepareStatement(WorldStatements.INS_DISABLES, "INSERT INTO disables (entry, sourceType, flags, comment) VALUES (?, ?, ?, ?)");
|
PrepareStatement(WorldStatements.INS_DISABLES, "INSERT INTO disables (entry, sourceType, flags, comment) VALUES (?, ?, ?, ?)");
|
||||||
PrepareStatement(WorldStatements.SEL_DISABLES, "SELECT entry FROM disables WHERE entry = ? AND sourceType = ?");
|
PrepareStatement(WorldStatements.SEL_DISABLES, "SELECT entry FROM disables WHERE entry = ? AND sourceType = ?");
|
||||||
PrepareStatement(WorldStatements.DEL_DISABLES, "DELETE FROM disables WHERE entry = ? AND sourceType = ?");
|
PrepareStatement(WorldStatements.DEL_DISABLES, "DELETE FROM disables WHERE entry = ? AND sourceType = ?");
|
||||||
|
|||||||
@@ -725,14 +725,10 @@ namespace Game.Chat
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (target.IsTypeId(TypeId.Unit))
|
if (target.GetDBPhase() > 0)
|
||||||
{
|
handler.SendSysMessage($"Target creature's PhaseId in DB: {target.GetDBPhase()}");
|
||||||
int dbPhase = target.ToCreature().GetDBPhase();
|
else if (target.GetDBPhase() < 0)
|
||||||
if (dbPhase > 0)
|
handler.SendSysMessage($"Target creature's PhaseGroup in DB: {Math.Abs(target.GetDBPhase())}");
|
||||||
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));
|
|
||||||
}
|
|
||||||
|
|
||||||
string phases = "";
|
string phases = "";
|
||||||
foreach (uint phase in target.GetPhases())
|
foreach (uint phase in target.GetPhases())
|
||||||
|
|||||||
@@ -487,7 +487,7 @@ namespace Game.Chat
|
|||||||
}
|
}
|
||||||
|
|
||||||
// fill the gameobject data and save to the db
|
// 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();
|
ulong spawnId = obj.GetSpawnId();
|
||||||
|
|
||||||
// this will generate a new guid if the object is in an instance
|
// this will generate a new guid if the object is in an instance
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ namespace Game.Chat
|
|||||||
CreatureData data = Global.ObjectMgr.GetCreatureData(target.GetSpawnId());
|
CreatureData data = Global.ObjectMgr.GetCreatureData(target.GetSpawnId());
|
||||||
if (data != null)
|
if (data != null)
|
||||||
{
|
{
|
||||||
handler.SendSysMessage(CypherStrings.NpcinfoPhases, data.phaseid, data.phaseGroup);
|
handler.SendSysMessage(CypherStrings.NpcinfoPhases, data.phaseId, data.phaseGroup);
|
||||||
if (data.phaseGroup != 0)
|
if (data.phaseGroup != 0)
|
||||||
{
|
{
|
||||||
var _phases = target.GetPhases();
|
var _phases = target.GetPhases();
|
||||||
@@ -1106,15 +1106,14 @@ namespace Game.Chat
|
|||||||
ulong guid = map.GenerateLowGuid(HighGuid.Creature);
|
ulong guid = map.GenerateLowGuid(HighGuid.Creature);
|
||||||
CreatureData data = Global.ObjectMgr.NewOrExistCreatureData(guid);
|
CreatureData data = Global.ObjectMgr.NewOrExistCreatureData(guid);
|
||||||
data.id = id;
|
data.id = id;
|
||||||
data.phaseMask = chr.GetPhaseMask();
|
|
||||||
data.posX = chr.GetTransOffsetX();
|
data.posX = chr.GetTransOffsetX();
|
||||||
data.posY = chr.GetTransOffsetY();
|
data.posY = chr.GetTransOffsetY();
|
||||||
data.posZ = chr.GetTransOffsetZ();
|
data.posZ = chr.GetTransOffsetZ();
|
||||||
data.orientation = chr.GetTransOffsetO();
|
data.orientation = chr.GetTransOffsetO();
|
||||||
|
// @todo: add phases
|
||||||
|
|
||||||
Creature _creature = trans.CreateNPCPassenger(guid, data);
|
Creature _creature = trans.CreateNPCPassenger(guid, data);
|
||||||
|
_creature.SaveToDB((uint)trans.GetGoInfo().MoTransport.SpawnMap, 1ul << (int)map.GetSpawnMode());
|
||||||
_creature.SaveToDB((uint)trans.GetGoInfo().MoTransport.SpawnMap, (byte)(1 << (int)map.GetSpawnMode()), chr.GetPhaseMask());
|
|
||||||
|
|
||||||
Global.ObjectMgr.AddCreatureToGrid(guid, data);
|
Global.ObjectMgr.AddCreatureToGrid(guid, data);
|
||||||
return true;
|
return true;
|
||||||
@@ -1124,7 +1123,8 @@ namespace Game.Chat
|
|||||||
if (!creature.Create(map.GenerateLowGuid(HighGuid.Creature), map, chr.GetPhaseMask(), id, x, y, z, o))
|
if (!creature.Create(map.GenerateLowGuid(HighGuid.Creature), map, chr.GetPhaseMask(), id, x, y, z, o))
|
||||||
return false;
|
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();
|
ulong db_guid = creature.GetSpawnId();
|
||||||
|
|
||||||
|
|||||||
@@ -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()))
|
if (!wpCreature.Create(map.GenerateLowGuid(HighGuid.Creature), map, chr.GetPhaseMask(), 1, chr.GetPositionX(), chr.GetPositionY(), chr.GetPositionZ(), chr.GetOrientation()))
|
||||||
{
|
{
|
||||||
wpCreature.CopyPhaseFrom(chr);
|
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();
|
// To call _LoadGoods(); _LoadQuests(); CreateTrainerSpells();
|
||||||
/// @todo Should we first use "Create" then use "LoadFromDB"?
|
/// @todo Should we first use "Create" then use "LoadFromDB"?
|
||||||
if (!wpCreature.LoadCreatureFromDB(wpCreature.GetSpawnId(), map))
|
if (!wpCreature.LoadCreatureFromDB(wpCreature.GetSpawnId(), map))
|
||||||
@@ -762,7 +762,7 @@ namespace Game.Chat.Commands
|
|||||||
}
|
}
|
||||||
|
|
||||||
wpCreature.CopyPhaseFrom(chr);
|
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
|
// Set "wpguid" column to the visual waypoint
|
||||||
stmt = DB.World.GetPreparedStatement(WorldStatements.UPD_WAYPOINT_DATA_WPGUID);
|
stmt = DB.World.GetPreparedStatement(WorldStatements.UPD_WAYPOINT_DATA_WPGUID);
|
||||||
@@ -822,8 +822,8 @@ namespace Game.Chat.Commands
|
|||||||
}
|
}
|
||||||
|
|
||||||
creature.CopyPhaseFrom(chr);
|
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))
|
if (!creature.LoadCreatureFromDB(creature.GetSpawnId(), map))
|
||||||
{
|
{
|
||||||
handler.SendSysMessage(CypherStrings.WaypointVpNotcreated, id);
|
handler.SendSysMessage(CypherStrings.WaypointVpNotcreated, id);
|
||||||
@@ -870,8 +870,8 @@ namespace Game.Chat.Commands
|
|||||||
}
|
}
|
||||||
|
|
||||||
creature.CopyPhaseFrom(chr);
|
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))
|
if (!creature.LoadCreatureFromDB(creature.GetSpawnId(), map))
|
||||||
{
|
{
|
||||||
handler.SendSysMessage(CypherStrings.WaypointNotcreated, id);
|
handler.SendSysMessage(CypherStrings.WaypointNotcreated, id);
|
||||||
|
|||||||
@@ -278,7 +278,7 @@ namespace Game.Conditions
|
|||||||
condMeets = player.HasTitle(ConditionValue1);
|
condMeets = player.HasTitle(ConditionValue1);
|
||||||
break;
|
break;
|
||||||
case ConditionTypes.Spawnmask:
|
case ConditionTypes.Spawnmask:
|
||||||
condMeets = Convert.ToBoolean((1 << (int)obj.GetMap().GetSpawnMode()) & ConditionValue1);
|
condMeets = Convert.ToBoolean((1ul << (int)obj.GetMap().GetSpawnMode()) & ConditionValue1);
|
||||||
break;
|
break;
|
||||||
case ConditionTypes.UnitState:
|
case ConditionTypes.UnitState:
|
||||||
if (unit != null)
|
if (unit != null)
|
||||||
|
|||||||
@@ -1490,7 +1490,8 @@ namespace Game
|
|||||||
}
|
}
|
||||||
case ConditionTypes.Spawnmask:
|
case ConditionTypes.Spawnmask:
|
||||||
{
|
{
|
||||||
if (cond.ConditionValue1 > (uint)SpawnMask.RaidAll)
|
// @todo: ConditionValue need to be extended to uint64
|
||||||
|
if ((ulong)cond.ConditionValue1 > 1ul << (int)SpawnMask.RaidAll)
|
||||||
{
|
{
|
||||||
Log.outError(LogFilter.Sql, "{0} has non existing SpawnMask in value1 ({1}), skipped.", cond.ToString(true), cond.ConditionValue1);
|
Log.outError(LogFilter.Sql, "{0} has non existing SpawnMask in value1 ({1}), skipped.", cond.ToString(true), cond.ConditionValue1);
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -724,8 +724,8 @@ namespace Game.Entities
|
|||||||
{
|
{
|
||||||
SetMap(map);
|
SetMap(map);
|
||||||
|
|
||||||
if (data != null && data.phaseid != 0)
|
if (data != null && data.phaseId != 0)
|
||||||
SetInPhase(data.phaseid, false, true);
|
SetInPhase(data.phaseId, false, true);
|
||||||
|
|
||||||
if (data != null && data.phaseGroup != 0)
|
if (data != null && data.phaseGroup != 0)
|
||||||
foreach (var ph in Global.DB2Mgr.GetPhasesForGroup(data.phaseGroup))
|
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();
|
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
|
// update in loaded data
|
||||||
if (m_spawnId == 0)
|
if (m_spawnId == 0)
|
||||||
@@ -1022,7 +1022,6 @@ namespace Game.Entities
|
|||||||
// data.guid = guid must not be updated at save
|
// data.guid = guid must not be updated at save
|
||||||
data.id = GetEntry();
|
data.id = GetEntry();
|
||||||
data.mapid = (ushort)mapid;
|
data.mapid = (ushort)mapid;
|
||||||
data.phaseMask = phaseMask;
|
|
||||||
data.displayid = displayId;
|
data.displayid = displayId;
|
||||||
data.equipmentId = GetCurrentEquipmentId();
|
data.equipmentId = GetCurrentEquipmentId();
|
||||||
data.posX = GetPositionX();
|
data.posX = GetPositionX();
|
||||||
@@ -1045,7 +1044,7 @@ namespace Game.Entities
|
|||||||
data.unit_flags3 = unitFlags3;
|
data.unit_flags3 = unitFlags3;
|
||||||
data.dynamicflags = dynamicflags;
|
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);
|
data.phaseGroup = (uint)(GetDBPhase() < 0 ? Math.Abs(GetDBPhase()) : 0);
|
||||||
|
|
||||||
// update in DB
|
// update in DB
|
||||||
@@ -1062,7 +1061,7 @@ namespace Game.Entities
|
|||||||
stmt.AddValue(index++, GetEntry());
|
stmt.AddValue(index++, GetEntry());
|
||||||
stmt.AddValue(index++, mapid);
|
stmt.AddValue(index++, mapid);
|
||||||
stmt.AddValue(index++, spawnMask);
|
stmt.AddValue(index++, spawnMask);
|
||||||
stmt.AddValue(index++, data.phaseid);
|
stmt.AddValue(index++, data.phaseId);
|
||||||
stmt.AddValue(index++, data.phaseGroup);
|
stmt.AddValue(index++, data.phaseGroup);
|
||||||
stmt.AddValue(index++, displayId);
|
stmt.AddValue(index++, displayId);
|
||||||
stmt.AddValue(index++, GetCurrentEquipmentId());
|
stmt.AddValue(index++, GetCurrentEquipmentId());
|
||||||
@@ -1320,7 +1319,7 @@ namespace Game.Entities
|
|||||||
|
|
||||||
m_spawnId = spawnId;
|
m_spawnId = spawnId;
|
||||||
m_creatureData = data;
|
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;
|
return false;
|
||||||
|
|
||||||
//We should set first home position, because then AI calls home movement
|
//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 uint id; // entry in creature_template
|
||||||
public ushort mapid;
|
public ushort mapid;
|
||||||
public uint phaseMask;
|
|
||||||
public uint displayid;
|
public uint displayid;
|
||||||
public int equipmentId;
|
public int equipmentId;
|
||||||
public float posX;
|
public float posX;
|
||||||
@@ -292,13 +291,13 @@ namespace Game.Entities
|
|||||||
public uint curhealth;
|
public uint curhealth;
|
||||||
public uint curmana;
|
public uint curmana;
|
||||||
public byte movementType;
|
public byte movementType;
|
||||||
public uint spawnMask;
|
public ulong spawnMask;
|
||||||
public ulong npcflag;
|
public ulong npcflag;
|
||||||
public uint unit_flags; // enum UnitFlags mask values
|
public uint unit_flags; // enum UnitFlags mask values
|
||||||
public uint unit_flags2; // enum UnitFlags2 mask values
|
public uint unit_flags2; // enum UnitFlags2 mask values
|
||||||
public uint unit_flags3; // enum UnitFlags3 mask values
|
public uint unit_flags3; // enum UnitFlags3 mask values
|
||||||
public uint dynamicflags;
|
public uint dynamicflags;
|
||||||
public uint phaseid;
|
public uint phaseId;
|
||||||
public uint phaseGroup;
|
public uint phaseGroup;
|
||||||
public uint ScriptId;
|
public uint ScriptId;
|
||||||
public bool dbData;
|
public bool dbData;
|
||||||
|
|||||||
@@ -846,10 +846,10 @@ namespace Game.Entities
|
|||||||
return;
|
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();
|
GameObjectTemplate goI = GetGoInfo();
|
||||||
|
|
||||||
@@ -865,7 +865,6 @@ namespace Game.Entities
|
|||||||
// guid = guid must not be updated at save
|
// guid = guid must not be updated at save
|
||||||
data.id = GetEntry();
|
data.id = GetEntry();
|
||||||
data.mapid = (ushort)mapid;
|
data.mapid = (ushort)mapid;
|
||||||
data.phaseMask = (ushort)phaseMask;
|
|
||||||
data.posX = GetPositionX();
|
data.posX = GetPositionX();
|
||||||
data.posY = GetPositionY();
|
data.posY = GetPositionY();
|
||||||
data.posZ = GetPositionZ();
|
data.posZ = GetPositionZ();
|
||||||
@@ -878,6 +877,9 @@ namespace Game.Entities
|
|||||||
data.artKit = GetGoArtKit();
|
data.artKit = GetGoArtKit();
|
||||||
Global.ObjectMgr.NewGOData(m_spawnId, data);
|
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
|
// Update in DB
|
||||||
byte index = 0;
|
byte index = 0;
|
||||||
PreparedStatement stmt = DB.World.GetPreparedStatement(WorldStatements.DEL_GAMEOBJECT);
|
PreparedStatement stmt = DB.World.GetPreparedStatement(WorldStatements.DEL_GAMEOBJECT);
|
||||||
@@ -889,6 +891,8 @@ namespace Game.Entities
|
|||||||
stmt.AddValue(index++, GetEntry());
|
stmt.AddValue(index++, GetEntry());
|
||||||
stmt.AddValue(index++, mapid);
|
stmt.AddValue(index++, mapid);
|
||||||
stmt.AddValue(index++, spawnMask);
|
stmt.AddValue(index++, spawnMask);
|
||||||
|
stmt.AddValue(index++, data.phaseId);
|
||||||
|
stmt.AddValue(index++, data.phaseGroup);
|
||||||
stmt.AddValue(index++, GetPositionX());
|
stmt.AddValue(index++, GetPositionX());
|
||||||
stmt.AddValue(index++, GetPositionY());
|
stmt.AddValue(index++, GetPositionY());
|
||||||
stmt.AddValue(index++, GetPositionZ());
|
stmt.AddValue(index++, GetPositionZ());
|
||||||
@@ -914,7 +918,6 @@ namespace Game.Entities
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint entry = data.id;
|
uint entry = data.id;
|
||||||
uint phaseMask = data.phaseMask;
|
|
||||||
Position pos = new Position(data.posX, data.posY, data.posZ, data.orientation);
|
Position pos = new Position(data.posX, data.posY, data.posZ, data.orientation);
|
||||||
|
|
||||||
uint animprogress = data.animprogress;
|
uint animprogress = data.animprogress;
|
||||||
@@ -922,11 +925,11 @@ namespace Game.Entities
|
|||||||
uint artKit = data.artKit;
|
uint artKit = data.artKit;
|
||||||
|
|
||||||
m_spawnId = spawnId;
|
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;
|
return false;
|
||||||
|
|
||||||
if (data.phaseid != 0)
|
if (data.phaseId != 0)
|
||||||
SetInPhase(data.phaseid, false, true);
|
SetInPhase(data.phaseId, false, true);
|
||||||
|
|
||||||
if (data.phaseGroup != 0)
|
if (data.phaseGroup != 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1055,7 +1055,6 @@ namespace Game.Entities
|
|||||||
{
|
{
|
||||||
public uint id; // entry in gamobject_template
|
public uint id; // entry in gamobject_template
|
||||||
public ushort mapid;
|
public ushort mapid;
|
||||||
public ushort phaseMask;
|
|
||||||
public float posX;
|
public float posX;
|
||||||
public float posY;
|
public float posY;
|
||||||
public float posZ;
|
public float posZ;
|
||||||
@@ -1064,9 +1063,9 @@ namespace Game.Entities
|
|||||||
public int spawntimesecs;
|
public int spawntimesecs;
|
||||||
public uint animprogress;
|
public uint animprogress;
|
||||||
public GameObjectState go_state;
|
public GameObjectState go_state;
|
||||||
public uint spawnMask;
|
public ulong spawnMask;
|
||||||
public byte artKit;
|
public byte artKit;
|
||||||
public uint phaseid;
|
public uint phaseId;
|
||||||
public uint phaseGroup;
|
public uint phaseGroup;
|
||||||
public uint ScriptId;
|
public uint ScriptId;
|
||||||
public bool dbData = true;
|
public bool dbData = true;
|
||||||
|
|||||||
@@ -288,7 +288,7 @@ namespace Game.Entities
|
|||||||
base.RemoveFromWorld();
|
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; }
|
public ObjectGuid GetSummonerGUID() { return m_summonerGUID; }
|
||||||
|
|
||||||
|
|||||||
@@ -338,8 +338,8 @@ namespace Game.Entities
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data.phaseid != 0)
|
if (data.phaseId != 0)
|
||||||
creature.SetInPhase(data.phaseid, false, true);
|
creature.SetInPhase(data.phaseId, false, true);
|
||||||
else if (data.phaseGroup != 0)
|
else if (data.phaseGroup != 0)
|
||||||
{
|
{
|
||||||
foreach (var phase in Global.DB2Mgr.GetPhasesForGroup(data.phaseGroup))
|
foreach (var phase in Global.DB2Mgr.GetPhasesForGroup(data.phaseGroup))
|
||||||
|
|||||||
@@ -3213,7 +3213,7 @@ namespace Game
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Dictionary<uint, uint> spawnMasks = new Dictionary<uint, uint>();
|
Dictionary<uint, ulong> spawnMasks = new Dictionary<uint, ulong>();
|
||||||
foreach (var mapDifficultyPair in Global.DB2Mgr.GetMapDifficulties())
|
foreach (var mapDifficultyPair in Global.DB2Mgr.GetMapDifficulties())
|
||||||
{
|
{
|
||||||
foreach (var difficultyPair in mapDifficultyPair.Value)
|
foreach (var difficultyPair in mapDifficultyPair.Value)
|
||||||
@@ -3221,7 +3221,7 @@ namespace Game
|
|||||||
if (!spawnMasks.ContainsKey(mapDifficultyPair.Key))
|
if (!spawnMasks.ContainsKey(mapDifficultyPair.Key))
|
||||||
spawnMasks[mapDifficultyPair.Key] = 0;
|
spawnMasks[mapDifficultyPair.Key] = 0;
|
||||||
|
|
||||||
spawnMasks[mapDifficultyPair.Key] |= (uint)(1 << (int)difficultyPair.Key);
|
spawnMasks[mapDifficultyPair.Key] |= (1ul << (int)difficultyPair.Key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3253,7 +3253,7 @@ namespace Game
|
|||||||
data.curhealth = result.Read<uint>(12);
|
data.curhealth = result.Read<uint>(12);
|
||||||
data.curmana = result.Read<uint>(13);
|
data.curmana = result.Read<uint>(13);
|
||||||
data.movementType = result.Read<byte>(14);
|
data.movementType = result.Read<byte>(14);
|
||||||
data.spawnMask = result.Read<uint>(15);
|
data.spawnMask = result.Read<ulong>(15);
|
||||||
short gameEvent = result.Read<short>(16);
|
short gameEvent = result.Read<short>(16);
|
||||||
uint PoolId = result.Read<uint>(17);
|
uint PoolId = result.Read<uint>(17);
|
||||||
data.npcflag = result.Read<ulong>(18);
|
data.npcflag = result.Read<ulong>(18);
|
||||||
@@ -3261,7 +3261,7 @@ namespace Game
|
|||||||
data.unit_flags2 = result.Read<uint>(20);
|
data.unit_flags2 = result.Read<uint>(20);
|
||||||
data.unit_flags3 = result.Read<uint>(21);
|
data.unit_flags3 = result.Read<uint>(21);
|
||||||
data.dynamicflags = result.Read<uint>(22);
|
data.dynamicflags = result.Read<uint>(22);
|
||||||
data.phaseid = result.Read<uint>(23);
|
data.phaseId = result.Read<uint>(23);
|
||||||
data.phaseGroup = result.Read<uint>(24);
|
data.phaseGroup = result.Read<uint>(24);
|
||||||
data.ScriptId = GetScriptId(result.Read<string>(25));
|
data.ScriptId = GetScriptId(result.Read<string>(25));
|
||||||
if (data.ScriptId == 0)
|
if (data.ScriptId == 0)
|
||||||
@@ -3334,19 +3334,18 @@ namespace Game
|
|||||||
data.orientation = Position.NormalizeOrientation(data.orientation);
|
data.orientation = Position.NormalizeOrientation(data.orientation);
|
||||||
}
|
}
|
||||||
|
|
||||||
data.phaseMask = 1;
|
if (data.phaseGroup != 0 && data.phaseId != 0)
|
||||||
if (data.phaseGroup != 0 && data.phaseid != 0)
|
|
||||||
{
|
{
|
||||||
Log.outError(LogFilter.Sql, "Table `creature` have creature (GUID: {0} Entry: {1}) with both `phaseid` and `phasegroup` set, `phasegroup` set to 0", guid, data.id);
|
Log.outError(LogFilter.Sql, "Table `creature` have creature (GUID: {0} Entry: {1}) with both `phaseid` and `phasegroup` set, `phasegroup` set to 0", guid, data.id);
|
||||||
data.phaseGroup = 0;
|
data.phaseGroup = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data.phaseid != 0)
|
if (data.phaseId != 0)
|
||||||
{
|
{
|
||||||
if (!CliDB.PhaseStorage.ContainsKey(data.phaseid))
|
if (!CliDB.PhaseStorage.ContainsKey(data.phaseId))
|
||||||
{
|
{
|
||||||
Log.outError(LogFilter.Sql, "Table `creature` have creature (GUID: {0} Entry: {1}) with `phaseid` {2} does not exist, set to 0", guid, data.id, data.phaseid);
|
Log.outError(LogFilter.Sql, "Table `creature` have creature (GUID: {0} Entry: {1}) with `phaseid` {2} does not exist, set to 0", guid, data.id, data.phaseId);
|
||||||
data.phaseid = 0;
|
data.phaseId = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3386,7 +3385,7 @@ namespace Game
|
|||||||
|
|
||||||
public void AddCreatureToGrid(ulong guid, CreatureData data)
|
public void AddCreatureToGrid(ulong guid, CreatureData data)
|
||||||
{
|
{
|
||||||
uint mask = data.spawnMask;
|
ulong mask = data.spawnMask;
|
||||||
for (byte i = 0; mask != 0; i++, mask >>= 1)
|
for (byte i = 0; mask != 0; i++, mask >>= 1)
|
||||||
{
|
{
|
||||||
if (Convert.ToBoolean(mask & 1))
|
if (Convert.ToBoolean(mask & 1))
|
||||||
@@ -3399,7 +3398,7 @@ namespace Game
|
|||||||
}
|
}
|
||||||
public void RemoveCreatureFromGrid(ulong guid, CreatureData data)
|
public void RemoveCreatureFromGrid(ulong guid, CreatureData data)
|
||||||
{
|
{
|
||||||
uint mask = data.spawnMask;
|
ulong mask = data.spawnMask;
|
||||||
for (byte i = 0; mask != 0; i++, mask >>= 1)
|
for (byte i = 0; mask != 0; i++, mask >>= 1)
|
||||||
{
|
{
|
||||||
if (Convert.ToBoolean(mask & 1))
|
if (Convert.ToBoolean(mask & 1))
|
||||||
@@ -3441,8 +3440,7 @@ namespace Game
|
|||||||
data.curhealth = stats.GenerateHealth(cInfo);
|
data.curhealth = stats.GenerateHealth(cInfo);
|
||||||
data.curmana = stats.GenerateMana(cInfo);
|
data.curmana = stats.GenerateMana(cInfo);
|
||||||
data.movementType = (byte)cInfo.MovementType;
|
data.movementType = (byte)cInfo.MovementType;
|
||||||
data.spawnMask = 1;
|
data.spawnMask = (int)SpawnMask.Continent;
|
||||||
data.phaseMask = PhaseMasks.Normal;
|
|
||||||
data.dbData = false;
|
data.dbData = false;
|
||||||
data.npcflag = (uint)cInfo.Npcflag;
|
data.npcflag = (uint)cInfo.Npcflag;
|
||||||
data.unit_flags = (uint)cInfo.UnitFlags;
|
data.unit_flags = (uint)cInfo.UnitFlags;
|
||||||
@@ -3884,14 +3882,14 @@ namespace Game
|
|||||||
uint count = 0;
|
uint count = 0;
|
||||||
|
|
||||||
// build single time for check spawnmask
|
// build single time for check spawnmask
|
||||||
Dictionary<uint, uint> spawnMasks = new Dictionary<uint, uint>();
|
Dictionary<uint, ulong> spawnMasks = new Dictionary<uint, ulong>();
|
||||||
foreach (var mapDifficultyPair in Global.DB2Mgr.GetMapDifficulties())
|
foreach (var mapDifficultyPair in Global.DB2Mgr.GetMapDifficulties())
|
||||||
{
|
{
|
||||||
foreach (var difficultyPair in mapDifficultyPair.Value)
|
foreach (var difficultyPair in mapDifficultyPair.Value)
|
||||||
{
|
{
|
||||||
if (!spawnMasks.ContainsKey(mapDifficultyPair.Key))
|
if (!spawnMasks.ContainsKey(mapDifficultyPair.Key))
|
||||||
spawnMasks[mapDifficultyPair.Key] = 0;
|
spawnMasks[mapDifficultyPair.Key] = 0;
|
||||||
spawnMasks[mapDifficultyPair.Key] |= (uint)(1 << (int)difficultyPair.Key);
|
spawnMasks[mapDifficultyPair.Key] |= (1ul << (int)difficultyPair.Key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3965,7 +3963,7 @@ namespace Game
|
|||||||
}
|
}
|
||||||
data.go_state = (GameObjectState)gostate;
|
data.go_state = (GameObjectState)gostate;
|
||||||
|
|
||||||
data.spawnMask = result.Read<uint>(14);
|
data.spawnMask = result.Read<ulong>(14);
|
||||||
|
|
||||||
//if (!_transportMaps.Contains(data.mapid) && (spawnMasks.ContainsKey(data.mapid) && Convert.ToBoolean(data.spawnMask & ~spawnMasks[data.mapid])))
|
//if (!_transportMaps.Contains(data.mapid) && (spawnMasks.ContainsKey(data.mapid) && Convert.ToBoolean(data.spawnMask & ~spawnMasks[data.mapid])))
|
||||||
//Log.outError(LogFilter.Sql, "Table `gameobject` has gameobject (GUID: {0} Entry: {1}) that has wrong spawn mask {2} including not supported difficulty modes for map (Id: {3}), skip",
|
//Log.outError(LogFilter.Sql, "Table `gameobject` has gameobject (GUID: {0} Entry: {1}) that has wrong spawn mask {2} including not supported difficulty modes for map (Id: {3}), skip",
|
||||||
@@ -3973,21 +3971,21 @@ namespace Game
|
|||||||
|
|
||||||
short gameEvent = result.Read<sbyte>(15);
|
short gameEvent = result.Read<sbyte>(15);
|
||||||
uint PoolId = result.Read<uint>(16);
|
uint PoolId = result.Read<uint>(16);
|
||||||
data.phaseid = result.Read<uint>(17);
|
data.phaseId = result.Read<uint>(17);
|
||||||
data.phaseGroup = result.Read<uint>(18);
|
data.phaseGroup = result.Read<uint>(18);
|
||||||
|
|
||||||
if (data.phaseGroup != 0 && data.phaseid != 0)
|
if (data.phaseGroup != 0 && data.phaseId != 0)
|
||||||
{
|
{
|
||||||
Log.outError(LogFilter.Sql, "Table `gameobject` have gameobject (GUID: {0} Entry: {1}) with both `phaseid` and `phasegroup` set, `phasegroup` set to 0", guid, data.id);
|
Log.outError(LogFilter.Sql, "Table `gameobject` have gameobject (GUID: {0} Entry: {1}) with both `phaseid` and `phasegroup` set, `phasegroup` set to 0", guid, data.id);
|
||||||
data.phaseGroup = 0;
|
data.phaseGroup = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data.phaseid != 0)
|
if (data.phaseId != 0)
|
||||||
{
|
{
|
||||||
if (!CliDB.PhaseStorage.ContainsKey(data.phaseid))
|
if (!CliDB.PhaseStorage.ContainsKey(data.phaseId))
|
||||||
{
|
{
|
||||||
Log.outError(LogFilter.Sql, "Table `gameobject` have gameobject (GUID: {0} Entry: {1}) with `phaseid` {2} does not exist, set to 0", guid, data.id, data.phaseid);
|
Log.outError(LogFilter.Sql, "Table `gameobject` have gameobject (GUID: {0} Entry: {1}) with `phaseid` {2} does not exist, set to 0", guid, data.id, data.phaseId);
|
||||||
data.phaseid = 0;
|
data.phaseId = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4040,8 +4038,6 @@ namespace Game
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
data.phaseMask = 1;
|
|
||||||
|
|
||||||
if (WorldConfig.GetBoolValue(WorldCfg.CalculateGameobjectZoneAreaData))
|
if (WorldConfig.GetBoolValue(WorldCfg.CalculateGameobjectZoneAreaData))
|
||||||
{
|
{
|
||||||
uint zoneId = 0;
|
uint zoneId = 0;
|
||||||
@@ -4231,7 +4227,7 @@ namespace Game
|
|||||||
}
|
}
|
||||||
public void AddGameObjectToGrid(ulong guid, GameObjectData data)
|
public void AddGameObjectToGrid(ulong guid, GameObjectData data)
|
||||||
{
|
{
|
||||||
uint mask = data.spawnMask;
|
ulong mask = data.spawnMask;
|
||||||
for (byte i = 0; mask != 0; i++, mask >>= 1)
|
for (byte i = 0; mask != 0; i++, mask >>= 1)
|
||||||
{
|
{
|
||||||
if (Convert.ToBoolean(mask & 1))
|
if (Convert.ToBoolean(mask & 1))
|
||||||
@@ -4244,7 +4240,7 @@ namespace Game
|
|||||||
}
|
}
|
||||||
public void RemoveGameObjectFromGrid(ulong guid, GameObjectData data)
|
public void RemoveGameObjectFromGrid(ulong guid, GameObjectData data)
|
||||||
{
|
{
|
||||||
uint mask = data.spawnMask;
|
ulong mask = data.spawnMask;
|
||||||
for (byte i = 0; mask != 0; i++, mask >>= 1)
|
for (byte i = 0; mask != 0; i++, mask >>= 1)
|
||||||
{
|
{
|
||||||
if (Convert.ToBoolean(mask & 1))
|
if (Convert.ToBoolean(mask & 1))
|
||||||
@@ -4282,9 +4278,8 @@ namespace Game
|
|||||||
data.rotation.W = rotation3;
|
data.rotation.W = rotation3;
|
||||||
data.spawntimesecs = (int)spawntimedelay;
|
data.spawntimesecs = (int)spawntimedelay;
|
||||||
data.animprogress = 100;
|
data.animprogress = 100;
|
||||||
data.spawnMask = 1;
|
data.spawnMask = (int)SpawnMask.Continent;
|
||||||
data.go_state = GameObjectState.Ready;
|
data.go_state = GameObjectState.Ready;
|
||||||
data.phaseMask = (ushort)PhaseMasks.Normal;
|
|
||||||
data.artKit = (byte)(goinfo.type == GameObjectTypes.ControlZone ? 21 : 0);
|
data.artKit = (byte)(goinfo.type == GameObjectTypes.ControlZone ? 21 : 0);
|
||||||
data.dbData = false;
|
data.dbData = false;
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
ALTER TABLE `creature`
|
||||||
|
CHANGE `spawnMask` `spawnMask` BIGINT(20) UNSIGNED DEFAULT 1 NOT NULL;
|
||||||
|
|
||||||
|
ALTER TABLE `gameobject`
|
||||||
|
CHANGE `spawnMask` `spawnMask` BIGINT(20) UNSIGNED DEFAULT 1 NOT NULL;
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
UPDATE `creature` SET `spawnMask` = 1 << 1 WHERE `map` = 109;
|
||||||
|
UPDATE `gameobject` SET `spawnMask` = 1 << 1 WHERE `map` = 109;
|
||||||
|
|
||||||
|
UPDATE `creature` SET `spawnMask` = (1 << 14) | (1 << 33) WHERE `map` = 564;
|
||||||
|
UPDATE `gameobject` SET `spawnMask` = (1 << 14) | (1 << 33) WHERE `map` = 564;
|
||||||
|
|
||||||
|
UPDATE `creature` SET `spawnMask` = 1 << 25 WHERE `map` = 1191;
|
||||||
|
UPDATE `gameobject` SET `spawnMask` = 1 << 25 WHERE `map` = 1191;
|
||||||
|
|
||||||
|
UPDATE `gameobject` SET `spawnMask` = (1 << 3) | (1 << 4) | (1 << 5) | (1 << 6) WHERE `guid` IN (6177, 6178);
|
||||||
|
|
||||||
|
UPDATE `gameobject` SET `spawnMask` = 1 WHERE `guid` = 200623;
|
||||||
|
|
||||||
|
UPDATE `gameobject` SET `spawnMask` = (1 << 1) | (1 << 2) WHERE `guid` = 224759;
|
||||||
|
|
||||||
|
UPDATE `creature` SET `PhaseGroup` = 0 WHERE `PhaseGroup` IN (1, 169);
|
||||||
|
UPDATE `gameobject` SET `PhaseGroup` = 0 WHERE `PhaseGroup` IN (1, 169);
|
||||||
|
|
||||||
|
UPDATE `creature` SET `PhaseId` = 0 WHERE `PhaseId` = 1;
|
||||||
|
UPDATE `gameobject` SET `PhaseId` = 0 WHERE `PhaseId` = 1;
|
||||||
|
|
||||||
|
UPDATE `creature` SET `PhaseId` = 0 WHERE `PhaseId` = 169 AND `PhaseGroup` = 396;
|
||||||
|
UPDATE `gameobject` SET `PhaseId` = 0 WHERE `PhaseId` = 169 AND `PhaseGroup` = 396;
|
||||||
Reference in New Issue
Block a user