forked from jo3bingham/TibiaAPI
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCreditBalance.cs
More file actions
57 lines (52 loc) · 1.79 KB
/
CreditBalance.cs
File metadata and controls
57 lines (52 loc) · 1.79 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 OXGaming.TibiaAPI.Constants;
namespace OXGaming.TibiaAPI.Network.ServerPackets
{
public class CreditBalance : ServerPacket
{
public int TransferableTibiaCoins { get; set; }
public int TotalTibiaCoins { get; set; }
public int TournamentCoins { get; set; }
public int Unknown { get; set; }
public bool UpdateCreditBalance { get; set; }
public CreditBalance(Client client)
{
Client = client;
PacketType = ServerPacketType.CreditBalance;
}
public override void ParseFromNetworkMessage(NetworkMessage message)
{
UpdateCreditBalance = message.ReadBool();
if (UpdateCreditBalance)
{
TotalTibiaCoins = message.ReadInt32();
TransferableTibiaCoins = message.ReadInt32();
if (Client.VersionNumber >= 125010109)
{
Unknown = message.ReadInt32();
}
if (Client.VersionNumber >= 12158493)
{
TournamentCoins = message.ReadInt32();
}
}
}
public override void AppendToNetworkMessage(NetworkMessage message)
{
message.Write((byte)ServerPacketType.CreditBalance);
message.Write(UpdateCreditBalance);
if (UpdateCreditBalance)
{
message.Write(TotalTibiaCoins);
message.Write(TransferableTibiaCoins);
if (Client.VersionNumber >= 125010109)
{
message.Write(Unknown);
}
if (Client.VersionNumber >= 12158493)
{
message.Write(TournamentCoins);
}
}
}
}
}