diff --git a/TibiaAPI/Constants/Enums.cs b/TibiaAPI/Constants/Enums.cs index 2882306..b847226 100644 --- a/TibiaAPI/Constants/Enums.cs +++ b/TibiaAPI/Constants/Enums.cs @@ -37,7 +37,8 @@ public enum PreyActionType { ListReroll = 0, BonusReroll = 1, - MonsterSelection = 2 + MonsterSelection = 2, + Option = 5 } public enum ReportType @@ -119,7 +120,8 @@ public enum GraphicalEffectsType Delay = 2, Effect = 3, MissileXY = 4, - MissileYX = 5 + MissileYX = 5, + Unknown = 0x83 } public enum PreyDataState diff --git a/TibiaAPI/Network/ClientPackets/PreyAction.cs b/TibiaAPI/Network/ClientPackets/PreyAction.cs index 78db280..65368d0 100644 --- a/TibiaAPI/Network/ClientPackets/PreyAction.cs +++ b/TibiaAPI/Network/ClientPackets/PreyAction.cs @@ -7,6 +7,7 @@ public class PreyAction : ClientPacket public PreyActionType ActionType { get; set; } public byte MonsterIndex { get; set; } + public byte Option { get; set; } public byte PreyId { get; set; } public PreyAction(Client client) @@ -23,6 +24,10 @@ public override void ParseFromNetworkMessage(NetworkMessage message) { MonsterIndex = message.ReadByte(); } + else if (ActionType == PreyActionType.Option) + { + Option = message.ReadByte(); // 0 = None, 1 = Automatic Bonus Reroll, 2 = Lock Prey + } } public override void AppendToNetworkMessage(NetworkMessage message) @@ -34,6 +39,10 @@ public override void AppendToNetworkMessage(NetworkMessage message) { message.Write(MonsterIndex); } + else if (ActionType == PreyActionType.Option) + { + message.Write(Option); + } } } } diff --git a/TibiaAPI/Network/ServerPackets/GraphicalEffects.cs b/TibiaAPI/Network/ServerPackets/GraphicalEffects.cs index c537d9d..270af5a 100644 --- a/TibiaAPI/Network/ServerPackets/GraphicalEffects.cs +++ b/TibiaAPI/Network/ServerPackets/GraphicalEffects.cs @@ -66,6 +66,15 @@ public override void ParseFromNetworkMessage(NetworkMessage message) var distanceAxisX = message.ReadSByte(); Effects.Add((type, 0, 0, missileId, distanceAxisX, distanceAxisY)); } + else if (type == GraphicalEffectsType.Unknown) + { + // This is "unknown" because a) it seems to have existed for a single + // client update but no longer exist as of client update 12.51.10194 + // (or I can't reproduce it) and b) it seems to indicate a new + // GraphicalEffects packet without the position at the beginning + // (it jumps straight to the effect type). Either way, treating it + // as a type without any data fixes any existing parser errors. + } else { throw new System.Exception($"[ServerPackets.GraphicalEffects] Unknown type: {type}"); @@ -111,6 +120,9 @@ public override void AppendToNetworkMessage(NetworkMessage message) message.Write(DistanceY); message.Write(DistanceX); } + else if (Type == GraphicalEffectsType.Unknown) + { + } } message.Write((byte)GraphicalEffectsType.None); } diff --git a/TibiaAPI/Network/ServerPackets/PreyData.cs b/TibiaAPI/Network/ServerPackets/PreyData.cs index 2155f06..d4d4e7d 100644 --- a/TibiaAPI/Network/ServerPackets/PreyData.cs +++ b/TibiaAPI/Network/ServerPackets/PreyData.cs @@ -18,9 +18,10 @@ public class PreyData : ServerPacket public string Name { get; set; } + public uint TimeLeftUntilFreeListReroll { get; set; } + public ushort BonusPercentage { get; set; } public ushort TimeLeft { get; set; } - public ushort TimeLeftUntilFreeListReroll { get; set; } public byte BonusRarity { get; set; } public byte BonusType { get; set; } @@ -37,7 +38,6 @@ public PreyData(Client client) public override void ParseFromNetworkMessage(NetworkMessage message) { Index = message.ReadByte(); - State = (PreyDataState)message.ReadByte(); switch (State) { @@ -111,8 +111,14 @@ public override void ParseFromNetworkMessage(NetworkMessage message) throw new Exception($"[PreyData.ParseFromNetworkMessage] Unknown state: {State}"); } } - - TimeLeftUntilFreeListReroll = message.ReadUInt16(); + if (Client.VersionNumber >= 125110194) + { + TimeLeftUntilFreeListReroll = message.ReadUInt32(); + } + else + { + TimeLeftUntilFreeListReroll = message.ReadUInt16(); + } if (Client.VersionNumber > 11606457) { Option = message.ReadByte(); // 0 = none, 1 = automatic reroll, 2 = locked @@ -224,7 +230,14 @@ public override void AppendToNetworkMessage(NetworkMessage message) throw new Exception($"[PreyData.AppendToNetworkMessage] Unknown state: {State}"); } } - message.Write(TimeLeftUntilFreeListReroll); + if (Client.VersionNumber >= 125110194) + { + message.Write(TimeLeftUntilFreeListReroll); + } + else + { + message.Write((ushort)TimeLeftUntilFreeListReroll); + } if (Client.VersionNumber > 11606457) { message.Write(Option); diff --git a/TibiaAPI/Network/ServerPackets/PreyHuntingTaskData.cs b/TibiaAPI/Network/ServerPackets/PreyHuntingTaskData.cs index 00cc656..573cfb5 100644 --- a/TibiaAPI/Network/ServerPackets/PreyHuntingTaskData.cs +++ b/TibiaAPI/Network/ServerPackets/PreyHuntingTaskData.cs @@ -12,6 +12,8 @@ public class PreyHuntingTaskData : ServerPacket public List<(ushort RaceId, bool IsUnlocked)> ListSelection { get; } = new List<(ushort RaceId, bool IsUnlocked)>(); + public uint TimeLeftUntilFreeReroll { get; set; } + public ushort CurrentKills { get; set; } public ushort RaceId { get; set; } public ushort RequiredKills { get; set; } @@ -86,6 +88,10 @@ public override void ParseFromNetworkMessage(NetworkMessage message) throw new Exception($"[PreyHuntingTaskData.ParseFromNetworkMessage] Unknown state: {State}"); } } + if (Client.VersionNumber >= 125110194) + { + TimeLeftUntilFreeReroll = message.ReadUInt32(); + } } public override void AppendToNetworkMessage(NetworkMessage message)