forked from marcosvf132/TibiaAPI
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBossTracking.cs
More file actions
38 lines (33 loc) · 1.15 KB
/
BossTracking.cs
File metadata and controls
38 lines (33 loc) · 1.15 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
38
using System;
using System.Collections.Generic;
using OXGaming.TibiaAPI.Constants;
namespace OXGaming.TibiaAPI.Network.ServerPackets
{
public class BossTracking : ServerPacket
{
public List<(uint id, ulong time)> BossesList { get; } = new List<(uint id, ulong time)>();
public BossTracking(Client client)
{
Client = client;
PacketType = ServerPacketType.BossTracking;
}
public override void ParseFromNetworkMessage(NetworkMessage message)
{
BossesList.Capacity = message.ReadUInt16();
for (var i = 0; i < BossesList.Capacity; ++i) {
var id = message.ReadUInt32();
var time = message.ReadUInt64();
BossesList.Add((id, time));
}
}
public override void AppendToNetworkMessage(NetworkMessage message)
{
message.Write((byte)ServerPacketType.BossTracking);
message.Write((ushort)BossesList.Capacity);
foreach (var boss in BossesList) {
message.Write(boss.id);
message.Write(boss.time);
}
}
}
}