Fix login

This commit is contained in:
Hondacrx
2024-11-16 23:05:45 -05:00
parent 76b0d747d3
commit 406aa5e445
26 changed files with 151 additions and 76 deletions
@@ -46,10 +46,11 @@ namespace Game.Entities
{
packet = new UpdateObject();
packet.NumObjUpdates = BlockCount;
packet.MapID = (ushort)MapId;
WorldPacket buffer = new();
buffer.WriteUInt16((ushort)MapId);
buffer.WriteUInt32(BlockCount);
buffer.WriteBit(true); // unk
if (buffer.WriteBit(!outOfRangeGUIDs.Empty() || !destroyGUIDs.Empty()))
{
buffer.WriteUInt16((ushort)destroyGUIDs.Count);
@@ -4337,7 +4337,7 @@ namespace Game.Entities
public class TraitSubTreeCache
{
public List<TraitEntry> Entries;
public List<TraitEntry> Entries = new();
public int TraitSubTreeID;
public uint Active;
@@ -50,7 +50,6 @@ namespace Game.Entities
public const byte CGObjectActiveMask = 0x1;
public const byte CGObjectChangedMask = 0x2;
public const byte CGObjectUpdateMask = CGObjectActiveMask | CGObjectChangedMask;
}
public class EntityFragmentsHolder
@@ -75,15 +74,16 @@ namespace Game.Entities
(int, bool) insertSorted(ref EntityFragment[] arr, ref byte count, EntityFragment f)
{
//auto where = std::ranges::lower_bound(arr.begin(), arr.begin() + count, f);
var where = Array.IndexOf(arr, f);
if (where != -1)
return (where, false);
var whereIndex = Array.IndexOf(arr, f);
if (whereIndex != -1)
return (whereIndex, false);
arr.SetValue(f, where);
arr = arr[^1..^0].Concat(arr[..^1]).ToArray();
whereIndex = Array.IndexOf(arr, EntityFragment.End);
arr.SetValue(f, whereIndex);
Array.Sort(arr);
++count;
return (where, true);
return (whereIndex, true);
};
if (!insertSorted(ref Ids, ref Count, fragment).Item2)
@@ -120,7 +120,7 @@ namespace Game.Entities
if (where != -1)
{
arr.SetValue(EntityFragment.End, where);
arr = arr[^1..^0].Concat(arr[..^1]).ToArray();
Array.Sort(arr);
--count;
return (where, true);
}
+6 -4
View File
@@ -172,11 +172,13 @@ namespace Game.Entities
UpdateFieldFlag fieldFlags = GetUpdateFieldFlagsFor(target);
WorldPacket tempBuffer = new();
tempBuffer.WriteUInt8((byte)fieldFlags);
BuildEntityFragments(tempBuffer, m_entityFragments.GetIds());
tempBuffer.WriteUInt8(1); // IndirectFragmentActive: CGObject
BuildValuesCreate(tempBuffer, fieldFlags, target);
buffer.WriteUInt32(tempBuffer.GetSize());
buffer.WriteUInt8((byte)fieldFlags);
BuildEntityFragments(buffer, m_entityFragments.GetIds());
buffer.WriteUInt8(1); // IndirectFragmentActive: CGObject
buffer.WriteBytes(tempBuffer);
data.AddUpdateBlock(buffer);
@@ -3879,7 +3881,7 @@ namespace Game.Entities
public TypeMask ObjectTypeMask { get; set; }
protected TypeId ObjectTypeId { get; set; }
protected CreateObjectBits m_updateFlag;
public EntityFragmentsHolder m_entityFragments;
public EntityFragmentsHolder m_entityFragments = new();
ObjectGuid m_guid;
bool _isNewObject;
bool _isDestroyedObject;
+2 -2
View File
@@ -193,7 +193,7 @@ namespace Game.Entities
AdvFlyingRateTypeSingle.SurfaceFriction => (ServerOpcodes.MoveSetAdvFlyingSurfaceFriction, flightCapabilityEntry.SurfaceFriction, AuraType.None),
AdvFlyingRateTypeSingle.OverMaxDeceleration => (ServerOpcodes.MoveSetAdvFlyingOverMaxDeceleration, flightCapabilityEntry.OverMaxDeceleration, AuraType.ModAdvFlyingOverMaxDeceleration),
AdvFlyingRateTypeSingle.LaunchSpeedCoefficient => (ServerOpcodes.MoveSetAdvFlyingLaunchSpeedCoefficient, flightCapabilityEntry.LaunchSpeedCoefficient, AuraType.None),
_ => (ServerOpcodes.Max, 0, AuraType.None)
_ => (ServerOpcodes.Unknown, 0, AuraType.None)
};
if (rateAura != AuraType.None)
@@ -239,7 +239,7 @@ namespace Game.Entities
AdvFlyingRateTypeRange.PitchingRateDown => (ServerOpcodes.MoveSetAdvFlyingPitchingRateDown, flightCapabilityEntry.PitchingRateDownMin, flightCapabilityEntry.PitchingRateDownMax, AuraType.ModAdvFlyingPitchingRateDown),
AdvFlyingRateTypeRange.PitchingRateUp => (ServerOpcodes.MoveSetAdvFlyingPitchingRateUp, flightCapabilityEntry.PitchingRateUpMin, flightCapabilityEntry.PitchingRateUpMax, AuraType.ModAdvFlyingPitchingRateUp),
AdvFlyingRateTypeRange.TurnVelocityThreshold => (ServerOpcodes.MoveSetAdvFlyingTurnVelocityThreshold, flightCapabilityEntry.TurnVelocityThresholdMin, flightCapabilityEntry.TurnVelocityThresholdMax, AuraType.None),
_ => (ServerOpcodes.Max, 0, 0, AuraType.None)
_ => (ServerOpcodes.Unknown, 0, 0, AuraType.None)
};
if (rateAura != AuraType.None)
+2 -1
View File
@@ -24,6 +24,7 @@ namespace Game.Entities
{
public Unit(bool isWorldObject) : base(isWorldObject)
{
m_unitData = new UnitData();
MoveSpline = new MoveSpline();
i_motionMaster = new MotionMaster(this);
m_combatManager = new CombatManager(this);
@@ -74,7 +75,7 @@ namespace Game.Entities
m_serverSideVisibility.SetValue(ServerSideVisibilityType.Ghost, GhostVisibilityType.Alive);
m_unitData = new UnitData();
}
public override void Dispose()