forked from jo3bingham/TibiaAPI
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBuyIngameShopOffer.cs
More file actions
56 lines (49 loc) · 1.88 KB
/
BuyIngameShopOffer.cs
File metadata and controls
56 lines (49 loc) · 1.88 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
using OXGaming.TibiaAPI.Constants;
namespace OXGaming.TibiaAPI.Network.ClientPackets
{
public class BuyIngameShopOffer : ClientPacket
{
public StoreServiceType ServiceType { get; set; }
public string DesiredCharacterName { get; set; }
public string TournamentContinent { get; set; }
public string TournamentTown { get; set; }
public uint OfferId { get; set; }
public byte TournamentVocation { get; set; }
public BuyIngameShopOffer(Client client)
{
Client = client;
PacketType = ClientPacketType.BuyIngameShopOffer;
}
public override void ParseFromNetworkMessage(NetworkMessage message)
{
OfferId = message.ReadUInt32();
ServiceType = (StoreServiceType)message.ReadByte();
if (ServiceType == StoreServiceType.CharacterNameChange)
{
DesiredCharacterName = message.ReadString();
}
else if (ServiceType == StoreServiceType.TournamentTicket)
{
TournamentContinent = message.ReadString();
TournamentVocation = message.ReadByte();
TournamentTown = message.ReadString();
}
}
public override void AppendToNetworkMessage(NetworkMessage message)
{
message.Write((byte)ClientPacketType.BuyIngameShopOffer);
message.Write(OfferId);
message.Write((byte)ServiceType);
if (ServiceType == StoreServiceType.CharacterNameChange)
{
message.Write(DesiredCharacterName);
}
else if (ServiceType == StoreServiceType.TournamentTicket)
{
message.Write(TournamentContinent);
message.Write(TournamentVocation);
message.Write(TournamentTown);
}
}
}
}