forked from jo3bingham/TibiaAPI
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathKillTracking.cs
More file actions
57 lines (48 loc) · 1.63 KB
/
KillTracking.cs
File metadata and controls
57 lines (48 loc) · 1.63 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
45
46
47
48
49
50
51
52
53
54
55
56
57
using System;
using System.Collections.Generic;
using OXGaming.TibiaAPI.Appearances;
using OXGaming.TibiaAPI.Constants;
namespace OXGaming.TibiaAPI.Network.ServerPackets
{
public class KillTracking : ServerPacket
{
public List<ObjectInstance> Loot { get; } = new List<ObjectInstance>();
public AppearanceInstance CreatureOutfit { get; set; }
public string CreatureName { get; set; }
public KillTracking(Client client)
{
Client = client;
PacketType = ServerPacketType.KillTracking;
}
public override void ParseFromNetworkMessage(NetworkMessage message)
{
CreatureName = message.ReadString();
CreatureOutfit = message.ReadCreatureOutfit();
Loot.Capacity = message.ReadByte();
for (var i = 0; i < Loot.Capacity; ++i)
{
Loot.Add(message.ReadObjectInstance());
}
}
public override void AppendToNetworkMessage(NetworkMessage message)
{
message.Write((byte)ServerPacketType.KillTracking);
message.Write(CreatureName);
if (CreatureOutfit is OutfitInstance)
{
message.Write((OutfitInstance)CreatureOutfit);
}
else
{
message.Write((ushort)0);
message.Write(CreatureOutfit.Id);
}
var count = Math.Min(Loot.Capacity, byte.MaxValue);
message.Write((byte)count);
for (var i = 0; i < count; ++i)
{
message.Write(Loot[i]);
}
}
}
}