forked from marcosvf132/TibiaAPI
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAnthem.cs
More file actions
37 lines (33 loc) · 1.05 KB
/
Anthem.cs
File metadata and controls
37 lines (33 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
using OXGaming.TibiaAPI.Constants;
using OXGaming.TibiaAPI.Utilities;
using System;
namespace OXGaming.TibiaAPI.Network.ServerPackets
{
public class Anthem : ServerPacket
{
public byte Type { get; set; }
public ushort MusicId { get; set; }
public Anthem(Client client)
{
Client = client;
PacketType = ServerPacketType.Anthem;
}
public override void ParseFromNetworkMessage(NetworkMessage message)
{
Type = message.ReadByte();
if (Type == 0 || Type == 1 || Type == 2) {
MusicId = message.ReadUInt16();
} else {
throw new Exception($"[Anthem.ParseFromNetworkMessage] Unknown type: {Type}");
}
}
public override void AppendToNetworkMessage(NetworkMessage message)
{
message.Write((byte)ServerPacketType.Anthem);
message.Write(Type);
if (Type == 0 || Type == 1 || Type == 2) {
message.Write(MusicId);
}
}
}
}