forked from jo3bingham/TibiaAPI
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCreatureType.cs
More file actions
39 lines (34 loc) · 1.14 KB
/
CreatureType.cs
File metadata and controls
39 lines (34 loc) · 1.14 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
using OXGaming.TibiaAPI.Constants;
namespace OXGaming.TibiaAPI.Network.ServerPackets
{
public class CreatureType : ServerPacket
{
public Constants.CreatureType Type { get; set; }
public uint CreatureId { get; set; }
public uint SummonerId { get; set; }
public CreatureType(Client client)
{
Client = client;
PacketType = ServerPacketType.CreatureType;
}
public override void ParseFromNetworkMessage(NetworkMessage message)
{
CreatureId = message.ReadUInt32();
Type = (Constants.CreatureType)message.ReadByte();
if (Type == Constants.CreatureType.PlayerSummon)
{
SummonerId = message.ReadUInt32();
}
}
public override void AppendToNetworkMessage(NetworkMessage message)
{
message.Write((byte)ServerPacketType.CreatureType);
message.Write(CreatureId);
message.Write((byte)Type);
if (Type == Constants.CreatureType.PlayerSummon)
{
message.Write(SummonerId);
}
}
}
}