forked from jo3bingham/TibiaAPI
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPreyAction.cs
More file actions
48 lines (43 loc) · 1.47 KB
/
PreyAction.cs
File metadata and controls
48 lines (43 loc) · 1.47 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
using OXGaming.TibiaAPI.Constants;
namespace OXGaming.TibiaAPI.Network.ClientPackets
{
public class PreyAction : ClientPacket
{
public PreyActionType ActionType { get; set; }
public byte MonsterIndex { get; set; }
public byte Option { get; set; }
public byte PreyId { get; set; }
public PreyAction(Client client)
{
Client = client;
PacketType = ClientPacketType.PreyAction;
}
public override void ParseFromNetworkMessage(NetworkMessage message)
{
PreyId = message.ReadByte();
ActionType = (PreyActionType)message.ReadByte();
if (ActionType == PreyActionType.MonsterSelection)
{
MonsterIndex = message.ReadByte();
}
else if (ActionType == PreyActionType.Option)
{
Option = message.ReadByte(); // 0 = None, 1 = Automatic Bonus Reroll, 2 = Lock Prey
}
}
public override void AppendToNetworkMessage(NetworkMessage message)
{
message.Write((byte)ClientPacketType.PreyAction);
message.Write(PreyId);
message.Write((byte)ActionType);
if (ActionType == PreyActionType.MonsterSelection)
{
message.Write(MonsterIndex);
}
else if (ActionType == PreyActionType.Option)
{
message.Write(Option);
}
}
}
}