forked from marcosvf132/TibiaAPI
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBosstiary.cs
More file actions
44 lines (39 loc) · 1.52 KB
/
Bosstiary.cs
File metadata and controls
44 lines (39 loc) · 1.52 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
39
40
41
42
43
44
using System;
using System.Collections.Generic;
using OXGaming.TibiaAPI.Constants;
namespace OXGaming.TibiaAPI.Network.ServerPackets
{
public class Bosstiary : ServerPacket
{
public List<(uint id, byte type, uint kills, byte unknown, bool tracker)> TotalBossses { get; } = new List<(uint id, byte type, uint kills, byte unknown, bool tracker)>();
public Bosstiary(Client client)
{
Client = client;
PacketType = ServerPacketType.Bosstiary;
}
public override void ParseFromNetworkMessage(NetworkMessage message)
{
TotalBossses.Capacity = message.ReadUInt16();
for (var i = 0; i < TotalBossses.Capacity; ++i) {
var id = message.ReadUInt32();
var type = message.ReadByte();
var kills = message.ReadUInt32();
var unknown = message.ReadByte();
var tracker = message.ReadBool();
TotalBossses.Add((id, type, kills, unknown, tracker));
}
}
public override void AppendToNetworkMessage(NetworkMessage message)
{
message.Write((byte)ServerPacketType.Bosstiary);
message.Write((ushort)TotalBossses.Capacity);
foreach (var boss in TotalBossses) {
message.Write(boss.id);
message.Write(boss.type);
message.Write(boss.kills);
message.Write(boss.unknown);
message.Write(boss.tracker);
}
}
}
}