From 24fd4563ba97957f4a6b1bd5853a7213fe53c2f7 Mon Sep 17 00:00:00 2001 From: hondacrx Date: Fri, 24 Mar 2023 07:37:16 -0400 Subject: [PATCH] Fixes one crash and chat not working. --- Source/Game/Maps/TransportManager.cs | 16 ++++++---------- Source/Game/Networking/Packets/ChatPackets.cs | 2 +- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/Source/Game/Maps/TransportManager.cs b/Source/Game/Maps/TransportManager.cs index da53dd43a..3ebffb3f4 100644 --- a/Source/Game/Maps/TransportManager.cs +++ b/Source/Game/Maps/TransportManager.cs @@ -678,8 +678,8 @@ namespace Game.Maps public class TransportAnimation { - public Dictionary Path = new(); - public Dictionary Rotations = new(); + public SortedList Path = new(); + public SortedList Rotations = new(); public uint TotalTime; public TransportAnimationRecord GetPrevAnimNode(uint time) @@ -687,11 +687,9 @@ namespace Game.Maps if (Path.Empty()) return null; - List lKeys = Path.Keys.ToList(); - int reqIndex = lKeys.IndexOf(time); - + int reqIndex = Path.IndexOfKey(time); if (reqIndex != -1) - return Path[lKeys[reqIndex - 1]]; + return Path.GetValueAtIndex(reqIndex - 1); return Path.LastOrDefault().Value; } @@ -701,11 +699,9 @@ namespace Game.Maps if (Rotations.Empty()) return null; - List lKeys = Rotations.Keys.ToList(); - int reqIndex = lKeys.IndexOf(time) - 1; - + int reqIndex = Rotations.IndexOfKey(time); if (reqIndex != -1) - return Rotations[lKeys[reqIndex]]; + return Rotations.GetValueAtIndex(reqIndex - 1); return Rotations.LastOrDefault().Value; } diff --git a/Source/Game/Networking/Packets/ChatPackets.cs b/Source/Game/Networking/Packets/ChatPackets.cs index f09080478..68d416c3a 100644 --- a/Source/Game/Networking/Packets/ChatPackets.cs +++ b/Source/Game/Networking/Packets/ChatPackets.cs @@ -215,7 +215,7 @@ namespace Game.Networking.Packets _worldPacket.WriteBits(Prefix.GetByteCount(), 5); _worldPacket.WriteBits(Channel.GetByteCount(), 7); _worldPacket.WriteBits(ChatText.GetByteCount(), 12); - _worldPacket.WriteBits((byte)_ChatFlags, 14); + _worldPacket.WriteBits((byte)_ChatFlags, 15); _worldPacket.WriteBit(HideChatLog); _worldPacket.WriteBit(FakeSenderName); _worldPacket.WriteBit(Unused_801.HasValue);