-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
70 additions
and
0 deletions.
There are no files selected for viewing
16 changes: 16 additions & 0 deletions
16
src/protocol/Edelstein.Protocol.Gameplay.Game/Contracts/Packets/Send/Message.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using BinarySerialization; | ||
using Edelstein.Protocol.Gameplay.Game.Objects.Users.Messages; | ||
using Edelstein.Protocol.Network.Packets; | ||
|
||
namespace Edelstein.Protocol.Gameplay.Game.Contracts.Packets.Send; | ||
|
||
public record Message() : StructuredSendPacket((short)PacketSendOperation.Message) | ||
{ | ||
[FieldOrder(0)] | ||
public required MessageType Type { get; init; } | ||
|
||
[FieldOrder(1)] | ||
[Subtype(nameof(Type), MessageType.SystemMessage, typeof(StructuredMessageInfoSystemMessage))] | ||
[SubtypeDefault(typeof(StructuredMessageInfo))] | ||
public required StructuredMessageInfo Info { get; init; } | ||
} |
19 changes: 19 additions & 0 deletions
19
src/protocol/Edelstein.Protocol.Gameplay.Game/Objects/Users/IFieldUserExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
using System.Threading.Tasks; | ||
using Edelstein.Protocol.Gameplay.Game.Contracts.Packets.Send; | ||
using Edelstein.Protocol.Gameplay.Game.Objects.Users.Messages; | ||
using Edelstein.Protocol.Network.Packets.Types; | ||
|
||
namespace Edelstein.Protocol.Gameplay.Game.Objects.Users; | ||
|
||
public static class IFieldUserExtensions | ||
{ | ||
public static Task Message(this IFieldUser user, string chat) | ||
=> user.Dispatch(new Message | ||
{ | ||
Type = MessageType.SystemMessage, | ||
Info = new StructuredMessageInfoSystemMessage | ||
{ | ||
Chat = new LPString(chat) | ||
} | ||
}); | ||
} |
20 changes: 20 additions & 0 deletions
20
src/protocol/Edelstein.Protocol.Gameplay.Game/Objects/Users/Messages/MessageType.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
namespace Edelstein.Protocol.Gameplay.Game.Objects.Users.Messages; | ||
|
||
public enum MessageType : byte | ||
{ | ||
DropPickUpMessage = 0x0, | ||
QuestRecordMessage = 0x1, | ||
CashItemExpireMessage = 0x2, | ||
IncEXPMessage = 0x3, | ||
IncSPMessage = 0x4, | ||
IncPOPMessage = 0x5, | ||
IncMoneyMessage = 0x6, | ||
IncGPMessage = 0x7, | ||
GiveBuffMessage = 0x8, | ||
GeneralItemExpireMessage = 0x9, | ||
SystemMessage = 0xA, | ||
QuestRecordExMessage = 0xB, | ||
ItemProtectExpireMessage = 0xC, | ||
ItemExpireReplaceMessage = 0xD, | ||
SkillExpireMessage = 0xE | ||
} |
5 changes: 5 additions & 0 deletions
5
...protocol/Edelstein.Protocol.Gameplay.Game/Objects/Users/Messages/StructuredMessageInfo.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
using Edelstein.Protocol.Network.Packets; | ||
|
||
namespace Edelstein.Protocol.Gameplay.Game.Objects.Users.Messages; | ||
|
||
public record StructuredMessageInfo : StructuredBasePacket; |
10 changes: 10 additions & 0 deletions
10
...stein.Protocol.Gameplay.Game/Objects/Users/Messages/StructuredMessageInfoSystemMessage.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
using BinarySerialization; | ||
using Edelstein.Protocol.Network.Packets.Types; | ||
|
||
namespace Edelstein.Protocol.Gameplay.Game.Objects.Users.Messages; | ||
|
||
public record StructuredMessageInfoSystemMessage : StructuredMessageInfo | ||
{ | ||
[FieldOrder(0)] | ||
public required LPString Chat { get; init; } | ||
} |