Core/Misc: Misc fixes
This commit is contained in:
@@ -55,8 +55,7 @@ namespace Game.DataStorage
|
|||||||
var records = ReadData(fileReader);
|
var records = ReadData(fileReader);
|
||||||
foreach (var pair in records)
|
foreach (var pair in records)
|
||||||
{
|
{
|
||||||
using (MemoryStream ms = new MemoryStream(pair.Value))
|
using (BinaryReader dataReader = new BinaryReader(new MemoryStream(pair.Value), System.Text.Encoding.UTF8))
|
||||||
using (BinaryReader dataReader = new BinaryReader(ms, System.Text.Encoding.UTF8))
|
|
||||||
{
|
{
|
||||||
var obj = new T();
|
var obj = new T();
|
||||||
|
|
||||||
|
|||||||
@@ -1111,7 +1111,7 @@ namespace Game.Entities
|
|||||||
byte level = (byte)(minlevel == maxlevel ? minlevel : RandomHelper.URand(minlevel, maxlevel));
|
byte level = (byte)(minlevel == maxlevel ? minlevel : RandomHelper.URand(minlevel, maxlevel));
|
||||||
SetLevel(level);
|
SetLevel(level);
|
||||||
|
|
||||||
if (!HasScalableLevels())
|
if (HasScalableLevels())
|
||||||
{
|
{
|
||||||
SetUInt32Value(UnitFields.ScalingLevelMin, cInfo.levelScaling.Value.MinLevel);
|
SetUInt32Value(UnitFields.ScalingLevelMin, cInfo.levelScaling.Value.MinLevel);
|
||||||
SetUInt32Value(UnitFields.ScalingLevelMax, cInfo.levelScaling.Value.MaxLevel);
|
SetUInt32Value(UnitFields.ScalingLevelMax, cInfo.levelScaling.Value.MaxLevel);
|
||||||
|
|||||||
@@ -283,12 +283,15 @@ namespace Game.Entities
|
|||||||
if (!IsInWorld)
|
if (!IsInWorld)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_passengers.Add(passenger);
|
if (_passengers.Add(passenger))
|
||||||
passenger.SetTransport(this);
|
{
|
||||||
passenger.m_movementInfo.transport.guid = GetGUID();
|
passenger.SetTransport(this);
|
||||||
|
passenger.m_movementInfo.transport.guid = GetGUID();
|
||||||
|
|
||||||
if (passenger.IsTypeId(TypeId.Player))
|
Player player = passenger.ToPlayer();
|
||||||
Global.ScriptMgr.OnAddPassenger(this, passenger.ToPlayer());
|
if (player)
|
||||||
|
Global.ScriptMgr.OnAddPassenger(this, player);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RemovePassenger(WorldObject passenger)
|
public void RemovePassenger(WorldObject passenger)
|
||||||
@@ -665,10 +668,8 @@ namespace Game.Entities
|
|||||||
z = nextFrame.Node.Loc.Z,
|
z = nextFrame.Node.Loc.Z,
|
||||||
o = nextFrame.InitialOrientation;
|
o = nextFrame.InitialOrientation;
|
||||||
|
|
||||||
for (var i =0; i < _passengers.Count; ++i)
|
foreach(WorldObject obj in _passengers.ToList())
|
||||||
{
|
{
|
||||||
WorldObject obj = _passengers[i];
|
|
||||||
|
|
||||||
float destX, destY, destZ, destO;
|
float destX, destY, destZ, destO;
|
||||||
obj.m_movementInfo.transport.pos.GetPosition(out destX, out destY, out destZ, out destO);
|
obj.m_movementInfo.transport.pos.GetPosition(out destX, out destY, out destZ, out destO);
|
||||||
TransportPosHelper.CalculatePassengerPosition(ref destX, ref destY, ref destZ, ref destO, x, y, z, o);
|
TransportPosHelper.CalculatePassengerPosition(ref destX, ref destY, ref destZ, ref destO, x, y, z, o);
|
||||||
@@ -693,7 +694,7 @@ namespace Game.Entities
|
|||||||
GetMap().AddToMap(this);
|
GetMap().AddToMap(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdatePassengerPositions(List<WorldObject> passengers)
|
void UpdatePassengerPositions(HashSet<WorldObject> passengers)
|
||||||
{
|
{
|
||||||
foreach (var passenger in passengers)
|
foreach (var passenger in passengers)
|
||||||
{
|
{
|
||||||
@@ -774,7 +775,7 @@ namespace Game.Entities
|
|||||||
ClearUpdateMask(true);
|
ClearUpdateMask(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<WorldObject> GetPassengers() { return _passengers; }
|
public HashSet<WorldObject> GetPassengers() { return _passengers; }
|
||||||
|
|
||||||
public override uint GetTransportPeriod() { return GetUInt32Value(GameObjectFields.Level); }
|
public override uint GetTransportPeriod() { return GetUInt32Value(GameObjectFields.Level); }
|
||||||
public void SetPeriod(uint period) { SetUInt32Value(GameObjectFields.Level, period); }
|
public void SetPeriod(uint period) { SetUInt32Value(GameObjectFields.Level, period); }
|
||||||
@@ -799,8 +800,8 @@ namespace Game.Entities
|
|||||||
bool _triggeredArrivalEvent;
|
bool _triggeredArrivalEvent;
|
||||||
bool _triggeredDepartureEvent;
|
bool _triggeredDepartureEvent;
|
||||||
|
|
||||||
List<WorldObject> _passengers = new List<WorldObject>();
|
HashSet<WorldObject> _passengers = new HashSet<WorldObject>();
|
||||||
List<WorldObject> _staticPassengers = new List<WorldObject>();
|
HashSet<WorldObject> _staticPassengers = new HashSet<WorldObject>();
|
||||||
|
|
||||||
bool _delayedAddModel;
|
bool _delayedAddModel;
|
||||||
bool _delayedTeleport;
|
bool _delayedTeleport;
|
||||||
|
|||||||
@@ -32,12 +32,16 @@ namespace Game
|
|||||||
public partial class WorldSession
|
public partial class WorldSession
|
||||||
{
|
{
|
||||||
[WorldPacketHandler(ClientOpcodes.MoveChangeTransport, Processing = PacketProcessing.ThreadSafe)]
|
[WorldPacketHandler(ClientOpcodes.MoveChangeTransport, Processing = PacketProcessing.ThreadSafe)]
|
||||||
[WorldPacketHandler(ClientOpcodes.MoveFallReset, Processing = PacketProcessing.ThreadSafe)]
|
[WorldPacketHandler(ClientOpcodes.MoveDoubleJump, Processing = PacketProcessing.ThreadSafe)]
|
||||||
[WorldPacketHandler(ClientOpcodes.MoveFallLand, Processing = PacketProcessing.ThreadSafe)]
|
[WorldPacketHandler(ClientOpcodes.MoveFallLand, Processing = PacketProcessing.ThreadSafe)]
|
||||||
|
[WorldPacketHandler(ClientOpcodes.MoveFallReset, Processing = PacketProcessing.ThreadSafe)]
|
||||||
[WorldPacketHandler(ClientOpcodes.MoveHeartbeat, Processing = PacketProcessing.ThreadSafe)]
|
[WorldPacketHandler(ClientOpcodes.MoveHeartbeat, Processing = PacketProcessing.ThreadSafe)]
|
||||||
[WorldPacketHandler(ClientOpcodes.MoveJump, Processing = PacketProcessing.ThreadSafe)]
|
[WorldPacketHandler(ClientOpcodes.MoveJump, Processing = PacketProcessing.ThreadSafe)]
|
||||||
[WorldPacketHandler(ClientOpcodes.MoveSetFacing, Processing = PacketProcessing.ThreadSafe)]
|
[WorldPacketHandler(ClientOpcodes.MoveSetFacing, Processing = PacketProcessing.ThreadSafe)]
|
||||||
|
[WorldPacketHandler(ClientOpcodes.MoveSetFly, Processing = PacketProcessing.ThreadSafe)]
|
||||||
[WorldPacketHandler(ClientOpcodes.MoveSetPitch, Processing = PacketProcessing.ThreadSafe)]
|
[WorldPacketHandler(ClientOpcodes.MoveSetPitch, Processing = PacketProcessing.ThreadSafe)]
|
||||||
|
[WorldPacketHandler(ClientOpcodes.MoveSetRunMode, Processing = PacketProcessing.ThreadSafe)]
|
||||||
|
[WorldPacketHandler(ClientOpcodes.MoveSetWalkMode, Processing = PacketProcessing.ThreadSafe)]
|
||||||
[WorldPacketHandler(ClientOpcodes.MoveStartAscend, Processing = PacketProcessing.ThreadSafe)]
|
[WorldPacketHandler(ClientOpcodes.MoveStartAscend, Processing = PacketProcessing.ThreadSafe)]
|
||||||
[WorldPacketHandler(ClientOpcodes.MoveStartBackward, Processing = PacketProcessing.ThreadSafe)]
|
[WorldPacketHandler(ClientOpcodes.MoveStartBackward, Processing = PacketProcessing.ThreadSafe)]
|
||||||
[WorldPacketHandler(ClientOpcodes.MoveStartDescend, Processing = PacketProcessing.ThreadSafe)]
|
[WorldPacketHandler(ClientOpcodes.MoveStartDescend, Processing = PacketProcessing.ThreadSafe)]
|
||||||
@@ -55,7 +59,6 @@ namespace Game
|
|||||||
[WorldPacketHandler(ClientOpcodes.MoveStopStrafe, Processing = PacketProcessing.ThreadSafe)]
|
[WorldPacketHandler(ClientOpcodes.MoveStopStrafe, Processing = PacketProcessing.ThreadSafe)]
|
||||||
[WorldPacketHandler(ClientOpcodes.MoveStopSwim, Processing = PacketProcessing.ThreadSafe)]
|
[WorldPacketHandler(ClientOpcodes.MoveStopSwim, Processing = PacketProcessing.ThreadSafe)]
|
||||||
[WorldPacketHandler(ClientOpcodes.MoveStopTurn, Processing = PacketProcessing.ThreadSafe)]
|
[WorldPacketHandler(ClientOpcodes.MoveStopTurn, Processing = PacketProcessing.ThreadSafe)]
|
||||||
[WorldPacketHandler(ClientOpcodes.MoveDoubleJump, Processing = PacketProcessing.ThreadSafe)]
|
|
||||||
void HandleMovement(ClientPlayerMovement packet)
|
void HandleMovement(ClientPlayerMovement packet)
|
||||||
{
|
{
|
||||||
HandleMovementOpcode(packet.GetOpcode(), packet.Status);
|
HandleMovementOpcode(packet.GetOpcode(), packet.Status);
|
||||||
@@ -566,6 +569,7 @@ namespace Game
|
|||||||
GetPlayer().SendMessageToSet(updateKnockBack, false);
|
GetPlayer().SendMessageToSet(updateKnockBack, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[WorldPacketHandler(ClientOpcodes.MoveEnableDoubleJumpAck, Processing = PacketProcessing.ThreadSafe)]
|
||||||
[WorldPacketHandler(ClientOpcodes.MoveEnableSwimToFlyTransAck, Processing = PacketProcessing.ThreadSafe)]
|
[WorldPacketHandler(ClientOpcodes.MoveEnableSwimToFlyTransAck, Processing = PacketProcessing.ThreadSafe)]
|
||||||
[WorldPacketHandler(ClientOpcodes.MoveFeatherFallAck, Processing = PacketProcessing.ThreadSafe)]
|
[WorldPacketHandler(ClientOpcodes.MoveFeatherFallAck, Processing = PacketProcessing.ThreadSafe)]
|
||||||
[WorldPacketHandler(ClientOpcodes.MoveForceRootAck, Processing = PacketProcessing.ThreadSafe)]
|
[WorldPacketHandler(ClientOpcodes.MoveForceRootAck, Processing = PacketProcessing.ThreadSafe)]
|
||||||
@@ -577,7 +581,6 @@ namespace Game
|
|||||||
[WorldPacketHandler(ClientOpcodes.MoveSetCanTurnWhileFallingAck, Processing = PacketProcessing.ThreadSafe)]
|
[WorldPacketHandler(ClientOpcodes.MoveSetCanTurnWhileFallingAck, Processing = PacketProcessing.ThreadSafe)]
|
||||||
[WorldPacketHandler(ClientOpcodes.MoveSetIgnoreMovementForcesAck, Processing = PacketProcessing.ThreadSafe)]
|
[WorldPacketHandler(ClientOpcodes.MoveSetIgnoreMovementForcesAck, Processing = PacketProcessing.ThreadSafe)]
|
||||||
[WorldPacketHandler(ClientOpcodes.MoveWaterWalkAck, Processing = PacketProcessing.ThreadSafe)]
|
[WorldPacketHandler(ClientOpcodes.MoveWaterWalkAck, Processing = PacketProcessing.ThreadSafe)]
|
||||||
[WorldPacketHandler(ClientOpcodes.MoveEnableDoubleJumpAck, Processing = PacketProcessing.ThreadSafe)]
|
|
||||||
void HandleMovementAckMessage(MovementAckMessage movementAck)
|
void HandleMovementAckMessage(MovementAckMessage movementAck)
|
||||||
{
|
{
|
||||||
GetPlayer().ValidateMovementInfo(movementAck.Ack.Status);
|
GetPlayer().ValidateMovementInfo(movementAck.Ack.Status);
|
||||||
|
|||||||
@@ -76,10 +76,12 @@ namespace Game.Network.Packets
|
|||||||
var movementInfo = new MovementInfo();
|
var movementInfo = new MovementInfo();
|
||||||
movementInfo.Guid = data.ReadPackedGuid();
|
movementInfo.Guid = data.ReadPackedGuid();
|
||||||
movementInfo.Time = data.ReadUInt32();
|
movementInfo.Time = data.ReadUInt32();
|
||||||
movementInfo.Pos.posX = data.ReadFloat();
|
float x = data.ReadFloat();
|
||||||
movementInfo.Pos.posY = data.ReadFloat();
|
float y = data.ReadFloat();
|
||||||
movementInfo.Pos.posZ = data.ReadFloat();
|
float z = data.ReadFloat();
|
||||||
movementInfo.Pos.Orientation = data.ReadFloat();
|
float o = data.ReadFloat();
|
||||||
|
|
||||||
|
movementInfo.Pos.Relocate(x, y, z, o);
|
||||||
movementInfo.Pitch = data.ReadFloat();
|
movementInfo.Pitch = data.ReadFloat();
|
||||||
movementInfo.SplineElevation = data.ReadFloat();
|
movementInfo.SplineElevation = data.ReadFloat();
|
||||||
|
|
||||||
@@ -175,8 +177,8 @@ namespace Game.Network.Packets
|
|||||||
data.FlushBits();
|
data.FlushBits();
|
||||||
if (hasFallDirection)
|
if (hasFallDirection)
|
||||||
{
|
{
|
||||||
data.WriteFloat(movementInfo.jump.cosAngle);
|
|
||||||
data.WriteFloat(movementInfo.jump.sinAngle);
|
data.WriteFloat(movementInfo.jump.sinAngle);
|
||||||
|
data.WriteFloat(movementInfo.jump.cosAngle);
|
||||||
data.WriteFloat(movementInfo.jump.xyspeed);
|
data.WriteFloat(movementInfo.jump.xyspeed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -321,8 +321,8 @@ namespace Game.PvP
|
|||||||
m_State = ObjectiveStates.Neutral;
|
m_State = ObjectiveStates.Neutral;
|
||||||
m_PvP = pvp;
|
m_PvP = pvp;
|
||||||
|
|
||||||
m_activePlayers[0] = new List<ObjectGuid>();
|
m_activePlayers[0] = new HashSet<ObjectGuid>();
|
||||||
m_activePlayers[1] = new List<ObjectGuid>();
|
m_activePlayers[1] = new HashSet<ObjectGuid>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual bool HandlePlayerEnter(Player player)
|
public virtual bool HandlePlayerEnter(Player player)
|
||||||
@@ -333,8 +333,7 @@ namespace Game.PvP
|
|||||||
player.SendUpdateWorldState(m_capturePoint.GetGoInfo().ControlZone.worldstate2, (uint)Math.Ceiling((m_value + m_maxValue) / (2 * m_maxValue) * 100.0f));
|
player.SendUpdateWorldState(m_capturePoint.GetGoInfo().ControlZone.worldstate2, (uint)Math.Ceiling((m_value + m_maxValue) / (2 * m_maxValue) * 100.0f));
|
||||||
player.SendUpdateWorldState(m_capturePoint.GetGoInfo().ControlZone.worldstate3, m_neutralValuePct);
|
player.SendUpdateWorldState(m_capturePoint.GetGoInfo().ControlZone.worldstate3, m_neutralValuePct);
|
||||||
}
|
}
|
||||||
m_activePlayers[player.GetTeamId()].Add(player.GetGUID());
|
return m_activePlayers[player.GetTeamId()].Add(player.GetGUID());
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void HandlePlayerLeave(Player player)
|
public virtual void HandlePlayerLeave(Player player)
|
||||||
@@ -531,8 +530,8 @@ namespace Game.PvP
|
|||||||
{
|
{
|
||||||
if (player.IsOutdoorPvPActive())
|
if (player.IsOutdoorPvPActive())
|
||||||
{
|
{
|
||||||
m_activePlayers[player.GetTeamId()].Add(player.GetGUID());
|
if (m_activePlayers[player.GetTeamId()].Add(player.GetGUID()))
|
||||||
HandlePlayerEnter(player);
|
HandlePlayerEnter(player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -652,9 +651,9 @@ namespace Game.PvP
|
|||||||
}
|
}
|
||||||
|
|
||||||
// send to all players present in the area
|
// send to all players present in the area
|
||||||
foreach (var _guid in m_activePlayers[team])
|
foreach (var playerGuid in m_activePlayers[team])
|
||||||
{
|
{
|
||||||
Player player = Global.ObjAccessor.FindPlayer(_guid);
|
Player player = Global.ObjAccessor.FindPlayer(playerGuid);
|
||||||
if (player)
|
if (player)
|
||||||
player.KilledMonsterCredit(id, guid);
|
player.KilledMonsterCredit(id, guid);
|
||||||
}
|
}
|
||||||
@@ -706,7 +705,7 @@ namespace Game.PvP
|
|||||||
public ulong m_capturePointSpawnId;
|
public ulong m_capturePointSpawnId;
|
||||||
public GameObject m_capturePoint;
|
public GameObject m_capturePoint;
|
||||||
// active players in the area of the objective, 0 - alliance, 1 - horde
|
// active players in the area of the objective, 0 - alliance, 1 - horde
|
||||||
public List<ObjectGuid>[] m_activePlayers = new List<ObjectGuid>[2];
|
public HashSet<ObjectGuid>[] m_activePlayers = new HashSet<ObjectGuid>[2];
|
||||||
// total shift needed to capture the objective
|
// total shift needed to capture the objective
|
||||||
public float m_maxValue;
|
public float m_maxValue;
|
||||||
float m_minValue;
|
float m_minValue;
|
||||||
|
|||||||
@@ -313,7 +313,7 @@ namespace Game
|
|||||||
|
|
||||||
Global.ObjectMgr.SetHighestGuids();
|
Global.ObjectMgr.SetHighestGuids();
|
||||||
|
|
||||||
/*if (!Global.MapMgr.ExistMapAndVMap(0, -6240.32f, 331.033f) || !Global.MapMgr.ExistMapAndVMap(0, -8949.95f, -132.493f)
|
if (!Global.MapMgr.ExistMapAndVMap(0, -6240.32f, 331.033f) || !Global.MapMgr.ExistMapAndVMap(0, -8949.95f, -132.493f)
|
||||||
|| !Global.MapMgr.ExistMapAndVMap(1, -618.518f, -4251.67f) || !Global.MapMgr.ExistMapAndVMap(0, 1676.35f, 1677.45f)
|
|| !Global.MapMgr.ExistMapAndVMap(1, -618.518f, -4251.67f) || !Global.MapMgr.ExistMapAndVMap(0, 1676.35f, 1677.45f)
|
||||||
|| !Global.MapMgr.ExistMapAndVMap(1, 10311.3f, 832.463f) || !Global.MapMgr.ExistMapAndVMap(1, -2917.58f, -257.98f)
|
|| !Global.MapMgr.ExistMapAndVMap(1, 10311.3f, 832.463f) || !Global.MapMgr.ExistMapAndVMap(1, -2917.58f, -257.98f)
|
||||||
|| (WorldConfig.GetIntValue(WorldCfg.Expansion) != 0 && (!Global.MapMgr.ExistMapAndVMap(530, 10349.6f, -6357.29f) || !Global.MapMgr.ExistMapAndVMap(530, -3961.64f, -13931.2f))))
|
|| (WorldConfig.GetIntValue(WorldCfg.Expansion) != 0 && (!Global.MapMgr.ExistMapAndVMap(530, 10349.6f, -6357.29f) || !Global.MapMgr.ExistMapAndVMap(530, -3961.64f, -13931.2f))))
|
||||||
@@ -321,7 +321,7 @@ namespace Game
|
|||||||
Log.outError(LogFilter.ServerLoading, "Unable to load critical files - server shutting down !!!");
|
Log.outError(LogFilter.ServerLoading, "Unable to load critical files - server shutting down !!!");
|
||||||
ShutdownServ(0, 0, ShutdownExitCode.Error);
|
ShutdownServ(0, 0, ShutdownExitCode.Error);
|
||||||
return;
|
return;
|
||||||
}*/
|
}
|
||||||
|
|
||||||
// Initialize pool manager
|
// Initialize pool manager
|
||||||
Global.PoolMgr.Initialize();
|
Global.PoolMgr.Initialize();
|
||||||
|
|||||||
Reference in New Issue
Block a user