From fdbd5b8cf5dd8534fd5e823bf9b18eb9b40fa112 Mon Sep 17 00:00:00 2001 From: Foglio Date: Thu, 26 Oct 2023 20:58:02 +0200 Subject: [PATCH] fix apply and broker messages author (close #301, close #302) --- TCC.Core/Data/Chat/ApplyMessage.cs | 1 + TCC.Core/Data/Chat/BrokerChatMessage.cs | 1 + TCC.Core/Data/Chat/ChatMessage.cs | 2 +- TCC.Core/UI/Controls/Chat/ApplyBody.xaml | 43 +++++++++++++------ .../Messages/S_OTHER_USER_APPLY_PARTY.cs | 7 +-- .../Messages/S_TRADE_BROKER_DEAL_SUGGESTED.cs | 14 +++--- 6 files changed, 44 insertions(+), 24 deletions(-) diff --git a/TCC.Core/Data/Chat/ApplyMessage.cs b/TCC.Core/Data/Chat/ApplyMessage.cs index ec0a92498..36c5992b0 100644 --- a/TCC.Core/Data/Chat/ApplyMessage.cs +++ b/TCC.Core/Data/Chat/ApplyMessage.cs @@ -15,6 +15,7 @@ public ApplyMessage(uint playerId, Class c, short level, string name, uint serve { Channel = ChatChannel.Apply; Author = name; + DisplayedAuthor = Author; PlayerId = playerId; PlayerLevel = level; UserClass = c; diff --git a/TCC.Core/Data/Chat/BrokerChatMessage.cs b/TCC.Core/Data/Chat/BrokerChatMessage.cs index bea1947bf..98a71c221 100644 --- a/TCC.Core/Data/Chat/BrokerChatMessage.cs +++ b/TCC.Core/Data/Chat/BrokerChatMessage.cs @@ -20,6 +20,7 @@ public BrokerChatMessage(uint playerId, uint listing, int item, long amount, lon ContainsPlayerName = true; Channel = ChatChannel.Bargain; Author = name; + DisplayedAuthor = Author; ListingId = listing; PlayerId = playerId; diff --git a/TCC.Core/Data/Chat/ChatMessage.cs b/TCC.Core/Data/Chat/ChatMessage.cs index 5c356fcfc..802bd2c39 100644 --- a/TCC.Core/Data/Chat/ChatMessage.cs +++ b/TCC.Core/Data/Chat/ChatMessage.cs @@ -72,7 +72,7 @@ public bool IsVisible } public int Size => App.Settings.FontSize; public string PlainMessage { get; protected init; } - public string DisplayedAuthor { get; } = string.Empty; + public string DisplayedAuthor { get; protected init; } = string.Empty; #endregion diff --git a/TCC.Core/UI/Controls/Chat/ApplyBody.xaml b/TCC.Core/UI/Controls/Chat/ApplyBody.xaml index 4b0af8e23..8a6d6d2a2 100644 --- a/TCC.Core/UI/Controls/Chat/ApplyBody.xaml +++ b/TCC.Core/UI/Controls/Chat/ApplyBody.xaml @@ -5,11 +5,29 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" mc:Ignorable="d" d:DataContext="{d:DesignData ApplyMessage}"> - - + + + + - - - + - - - - + - - - + diff --git a/TeraPacketParser/Messages/S_OTHER_USER_APPLY_PARTY.cs b/TeraPacketParser/Messages/S_OTHER_USER_APPLY_PARTY.cs index f038be4ac..26f6d72aa 100644 --- a/TeraPacketParser/Messages/S_OTHER_USER_APPLY_PARTY.cs +++ b/TeraPacketParser/Messages/S_OTHER_USER_APPLY_PARTY.cs @@ -28,12 +28,13 @@ public S_OTHER_USER_APPLY_PARTY(TeraMessageReader reader) : base(reader) else { var nameOffset = reader.ReadUInt16(); - reader.Skip(1); + reader.Skip(1); // isRaid? PlayerId = reader.ReadUInt32(); Class = (Class)reader.ReadInt16(); - reader.Skip(4); + reader.Skip(4); //race, gender Level = reader.ReadInt16(); - reader.BaseStream.Position = nameOffset - 4; + reader.RepositionAt(nameOffset); + // bool isWorldEventTarget? Name = reader.ReadTeraString(); } } diff --git a/TeraPacketParser/Messages/S_TRADE_BROKER_DEAL_SUGGESTED.cs b/TeraPacketParser/Messages/S_TRADE_BROKER_DEAL_SUGGESTED.cs index 37cbad6c4..596ba88de 100644 --- a/TeraPacketParser/Messages/S_TRADE_BROKER_DEAL_SUGGESTED.cs +++ b/TeraPacketParser/Messages/S_TRADE_BROKER_DEAL_SUGGESTED.cs @@ -2,13 +2,13 @@ public class S_TRADE_BROKER_DEAL_SUGGESTED : ParsedMessage { - public uint PlayerId { get; private set; } - public uint Listing { get; private set; } - public int Item { get; private set; } - public long Amount { get; private set; } - public long SellerPrice { get; private set; } - public long OfferedPrice { get; private set; } - public string Name { get; private set; } + public uint PlayerId { get; } + public uint Listing { get; } + public int Item { get; } + public long Amount { get; } + public long SellerPrice { get; } + public long OfferedPrice { get; } + public string Name { get; } public S_TRADE_BROKER_DEAL_SUGGESTED(TeraMessageReader reader) : base(reader) {