forked from marcosvf132/TibiaAPI
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBugReport.cs
More file actions
53 lines (47 loc) · 1.57 KB
/
BugReport.cs
File metadata and controls
53 lines (47 loc) · 1.57 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
using OXGaming.TibiaAPI.Constants;
using OXGaming.TibiaAPI.Utilities;
namespace OXGaming.TibiaAPI.Network.ClientPackets
{
public class BugReport : ClientPacket
{
public BugCategory BugCategory { get; set; }
public Position Position { get; set; }
public string ReportText { get; set; }
public string SpeakerName { get; set; }
public string TypoText { get; set; }
public BugReport(Client client)
{
Client = client;
PacketType = ClientPacketType.BugReport;
}
public override void ParseFromNetworkMessage(NetworkMessage message)
{
BugCategory = (BugCategory)message.ReadByte();
ReportText = message.ReadString();
if (BugCategory == BugCategory.Map)
{
Position = message.ReadPosition();
}
else if (BugCategory == BugCategory.Typo)
{
SpeakerName = message.ReadString();
TypoText = message.ReadString();
}
}
public override void AppendToNetworkMessage(NetworkMessage message)
{
message.Write((byte)ClientPacketType.BugReport);
message.Write((byte)BugCategory);
message.Write(ReportText);
if (BugCategory == BugCategory.Map)
{
message.Write(Position);
}
else if (BugCategory == BugCategory.Typo)
{
message.Write(SpeakerName);
message.Write(TypoText);
}
}
}
}