forked from marcosvf132/TibiaAPI
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBossSlots.cs
More file actions
179 lines (150 loc) · 7.37 KB
/
BossSlots.cs
File metadata and controls
179 lines (150 loc) · 7.37 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
using OXGaming.TibiaAPI.Constants;
using System.Collections.Generic;
namespace OXGaming.TibiaAPI.Network.ServerPackets
{
public class BossSlots : ServerPacket
{
public bool IsAnyBossUnlocked { get; set; }
public ushort EquipmentLootBonus { get; set; }
public ushort NextEquipmentLootBonus { get; set; }
public uint Points { get; set; }
public uint TotalPoints { get; set; }
public List<(uint id, byte type)> UnlockedBosses { get; } = new List<(uint id, byte type)>();
#region First slot
public bool IsFirstSlotUnlocked { get; set; }
public bool FirstSlotIsInactive { get; set; }
public byte FirstSlotRaceType { get; set; }
public byte FirstSlotKillBonus { get; set; }
public byte FirstSlotUnknownEnum { get; set; }
public uint FirstSlotUnlockAmountOrSelectedBossId { get; set; }
public uint FirstSlotSlainAmount { get; set; }
public uint FirstSlotPriceToRemove { get; set; }
public ushort FirstSlotEquipmentLootBonus { get; set; }
#endregion
#region Second slot
public bool IsSecondSlotUnlocked { get; set; }
public bool SecondSlotIsInactive { get; set; }
public byte SecondSlotRaceType { get; set; }
public byte SecondSlotKillBonus { get; set; }
public byte SecondSlotUnknownEnum { get; set; }
public uint SecondSlotUnlockAmountOrSelectedBossId { get; set; }
public uint SecondSlotSlainAmount { get; set; }
public uint SecondSlotPriceToRemove { get; set; }
public ushort SecondSlotEquipmentLootBonus { get; set; }
#endregion
#region Today boss slot
public bool IsTodaySlotUnlocked { get; set; }
public bool TodaySlotIsInactive { get; set; }
public byte TodaySlotRaceType { get; set; }
public byte TodaySlotKillBonus { get; set; }
public byte TodaySlotUnknownEnum { get; set; }
public uint TodaySlotUnlockAmountOrSelectedBossId { get; set; }
public uint TodaySlotSlainAmount { get; set; }
public uint TodaySlotPriceToRemove { get; set; }
public ushort TodaySlotEquipmentLootBonus { get; set; }
#endregion
public BossSlots(Client client)
{
Client = client;
PacketType = ServerPacketType.BossSlots;
}
public override void ParseFromNetworkMessage(NetworkMessage message)
{
Points = message.ReadUInt32();
TotalPoints = message.ReadUInt32();
EquipmentLootBonus = message.ReadUInt16();
NextEquipmentLootBonus = message.ReadUInt16();
IsFirstSlotUnlocked = message.ReadBool();
FirstSlotUnlockAmountOrSelectedBossId = message.ReadUInt32();
if (IsFirstSlotUnlocked && FirstSlotUnlockAmountOrSelectedBossId > 0) {
FirstSlotRaceType = message.ReadByte();
FirstSlotSlainAmount = message.ReadUInt32();
FirstSlotEquipmentLootBonus = message.ReadUInt16();
FirstSlotKillBonus = message.ReadByte();
FirstSlotUnknownEnum = message.ReadByte();
FirstSlotPriceToRemove = message.ReadUInt32();
FirstSlotIsInactive = message.ReadBool();
}
IsSecondSlotUnlocked = message.ReadBool();
SecondSlotUnlockAmountOrSelectedBossId = message.ReadUInt32();
if (IsSecondSlotUnlocked && SecondSlotUnlockAmountOrSelectedBossId > 0) {
SecondSlotRaceType = message.ReadByte();
SecondSlotSlainAmount = message.ReadUInt32();
SecondSlotEquipmentLootBonus = message.ReadUInt16();
SecondSlotKillBonus = message.ReadByte();
SecondSlotUnknownEnum = message.ReadByte();
SecondSlotPriceToRemove = message.ReadUInt32();
SecondSlotIsInactive = message.ReadBool();
}
IsTodaySlotUnlocked = message.ReadBool();
TodaySlotUnlockAmountOrSelectedBossId = message.ReadUInt32();
if (IsTodaySlotUnlocked && TodaySlotUnlockAmountOrSelectedBossId > 0) {
TodaySlotRaceType = message.ReadByte();
TodaySlotSlainAmount = message.ReadUInt32();
TodaySlotEquipmentLootBonus = message.ReadUInt16();
TodaySlotKillBonus = message.ReadByte();
TodaySlotUnknownEnum = message.ReadByte();
TodaySlotPriceToRemove = message.ReadUInt32();
TodaySlotIsInactive = message.ReadBool();
}
IsAnyBossUnlocked = message.ReadBool();
if (IsAnyBossUnlocked) {
UnlockedBosses.Capacity = message.ReadUInt16();
for (var i = 0; i < UnlockedBosses.Capacity; ++i) {
var id = message.ReadUInt32();
var type = message.ReadByte();
UnlockedBosses.Add((id, type));
}
}
}
public override void AppendToNetworkMessage(NetworkMessage message)
{
message.Write((byte)ServerPacketType.BossSlots);
message.Write(Points);
message.Write(TotalPoints);
message.Write(EquipmentLootBonus);
message.Write(NextEquipmentLootBonus);
message.Write(IsFirstSlotUnlocked);
message.Write(FirstSlotUnlockAmountOrSelectedBossId);
if (IsFirstSlotUnlocked && FirstSlotUnlockAmountOrSelectedBossId > 0) {
message.Write(FirstSlotRaceType);
message.Write(FirstSlotSlainAmount);
message.Write(FirstSlotEquipmentLootBonus);
message.Write(FirstSlotKillBonus);
message.Write(FirstSlotUnknownEnum);
message.Write(FirstSlotPriceToRemove);
message.Write(FirstSlotIsInactive);
}
message.Write(IsSecondSlotUnlocked);
message.Write(SecondSlotUnlockAmountOrSelectedBossId);
if (IsSecondSlotUnlocked && SecondSlotUnlockAmountOrSelectedBossId > 0) {
message.Write(SecondSlotRaceType);
message.Write(SecondSlotSlainAmount);
message.Write(SecondSlotEquipmentLootBonus);
message.Write(SecondSlotKillBonus);
message.Write(SecondSlotUnknownEnum);
message.Write(SecondSlotPriceToRemove);
message.Write(SecondSlotIsInactive);
}
message.Write(IsTodaySlotUnlocked);
message.Write(TodaySlotUnlockAmountOrSelectedBossId);
if (IsTodaySlotUnlocked && TodaySlotUnlockAmountOrSelectedBossId > 0) {
message.Write(TodaySlotRaceType);
message.Write(TodaySlotSlainAmount);
message.Write(TodaySlotEquipmentLootBonus);
message.Write(TodaySlotKillBonus);
message.Write(TodaySlotUnknownEnum);
message.Write(TodaySlotPriceToRemove);
message.Write(TodaySlotIsInactive);
}
message.Write(IsAnyBossUnlocked);
if (IsAnyBossUnlocked) {
message.Write((ushort)UnlockedBosses.Capacity);
foreach (var unlockedBoss in UnlockedBosses) {
message.Write(unlockedBoss.id);
message.Write(unlockedBoss.type);
}
}
}
}
}