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);
}