Fixes one crash and chat not working.

This commit is contained in:
hondacrx
2023-03-24 07:37:16 -04:00
parent ebb7c450d1
commit 24fd4563ba
2 changed files with 7 additions and 11 deletions
+6 -10
View File
@@ -678,8 +678,8 @@ namespace Game.Maps
public class TransportAnimation public class TransportAnimation
{ {
public Dictionary<uint, TransportAnimationRecord> Path = new(); public SortedList<uint, TransportAnimationRecord> Path = new();
public Dictionary<uint, TransportRotationRecord> Rotations = new(); public SortedList<uint, TransportRotationRecord> Rotations = new();
public uint TotalTime; public uint TotalTime;
public TransportAnimationRecord GetPrevAnimNode(uint time) public TransportAnimationRecord GetPrevAnimNode(uint time)
@@ -687,11 +687,9 @@ namespace Game.Maps
if (Path.Empty()) if (Path.Empty())
return null; return null;
List<uint> lKeys = Path.Keys.ToList(); int reqIndex = Path.IndexOfKey(time);
int reqIndex = lKeys.IndexOf(time);
if (reqIndex != -1) if (reqIndex != -1)
return Path[lKeys[reqIndex - 1]]; return Path.GetValueAtIndex(reqIndex - 1);
return Path.LastOrDefault().Value; return Path.LastOrDefault().Value;
} }
@@ -701,11 +699,9 @@ namespace Game.Maps
if (Rotations.Empty()) if (Rotations.Empty())
return null; return null;
List<uint> lKeys = Rotations.Keys.ToList(); int reqIndex = Rotations.IndexOfKey(time);
int reqIndex = lKeys.IndexOf(time) - 1;
if (reqIndex != -1) if (reqIndex != -1)
return Rotations[lKeys[reqIndex]]; return Rotations.GetValueAtIndex(reqIndex - 1);
return Rotations.LastOrDefault().Value; return Rotations.LastOrDefault().Value;
} }
@@ -215,7 +215,7 @@ namespace Game.Networking.Packets
_worldPacket.WriteBits(Prefix.GetByteCount(), 5); _worldPacket.WriteBits(Prefix.GetByteCount(), 5);
_worldPacket.WriteBits(Channel.GetByteCount(), 7); _worldPacket.WriteBits(Channel.GetByteCount(), 7);
_worldPacket.WriteBits(ChatText.GetByteCount(), 12); _worldPacket.WriteBits(ChatText.GetByteCount(), 12);
_worldPacket.WriteBits((byte)_ChatFlags, 14); _worldPacket.WriteBits((byte)_ChatFlags, 15);
_worldPacket.WriteBit(HideChatLog); _worldPacket.WriteBit(HideChatLog);
_worldPacket.WriteBit(FakeSenderName); _worldPacket.WriteBit(FakeSenderName);
_worldPacket.WriteBit(Unused_801.HasValue); _worldPacket.WriteBit(Unused_801.HasValue);