Skip to content

Commit 9e81e3b

Browse files
authored
Summer Update 2019 (jo3bingham#25)
* Address existing changes from Summer Update 2019 * Prepare for new packets * Add new client packet FriendSystemAction * Fix BlessingsDialog server packet changes * Add new client and server packets * Add new DepotSearchDetailList server packet * Add new CyclopediaCharacterInfo data * Add client version check for new data * Additional error fixes
1 parent 0d12ac4 commit 9e81e3b

23 files changed

Lines changed: 911 additions & 59 deletions

TibiaAPI/Constants/Enums.cs

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,10 @@ public enum MessageModeType
283283
ThankYou = 41,
284284
Market = 42,
285285
Mana = 43,
286-
BeyondLast = 44
286+
BeyondLast = 44,
287+
BoostedCreature = 49,
288+
OfflineTraining = 50,
289+
Potion = 52
287290
}
288291

289292
public enum ClientPacketType
@@ -298,6 +301,7 @@ public enum ClientPacketType
298301
PingBack = 0x1E,
299302
PerformanceMetrics = 0x1F,
300303
StashAction = 0x28,
304+
DepotSearchRetrieve = 0x29,
301305
ClientCheck = 0x63,
302306
GoPath = 0x64,
303307
GoNorth = 0x65,
@@ -324,6 +328,7 @@ public enum ClientPacketType
324328
LookTrade = 0x7E,
325329
AcceptTrade = 0x7F,
326330
RejectTrade = 0x80,
331+
FriendSystemAction = 0x81,
327332
UseObject = 0x82,
328333
UseTwoObjects = 0x83,
329334
UseOnCreature = 0x84,
@@ -339,6 +344,10 @@ public enum ClientPacketType
339344
QuickLoot = 0x8F,
340345
LootContainer = 0x90,
341346
QuickLootBlackWhitelist = 0x91,
347+
OpenDepotSearch = 0x92,
348+
CloseDepotSearch = 0x93,
349+
DepotSearchType = 0x94,
350+
OpenParentContainer = 0x95,
342351
Talk = 0x96,
343352
GetChannels = 0x97,
344353
JoinChannel = 0x98,
@@ -456,6 +465,7 @@ public enum ServerPacketType
456465
CreateInContainer = 0x70,
457466
ChangeInContainer = 0x71,
458467
DeleteInContainer = 0x72,
468+
FriendSystemData = 0x74,
459469
ScreenshotEvent = 0x75,
460470
InspectionList = 0x76,
461471
InspectionState = 0x77,
@@ -480,11 +490,14 @@ public enum ServerPacketType
480490
CreatureParty = 0x91,
481491
CreatureUnpass = 0x92,
482492
CreatureMarks = 0x93,
483-
CreaturePvpHelpers = 0x94,
493+
//CreaturePvpHelpers = 0x94,
494+
DepotSearchResults = 0x94,
484495
CreatureType = 0x95,
485496
EditText = 0x96,
486497
EditList = 0x97,
487498
ShowGameNews = 0x98,
499+
DepotSearchDetailList = 0x99,
500+
CloseDepotSearch = 0x9A,
488501
BlessingsDialog = 0x9B,
489502
Blessings = 0x9C,
490503
SwitchPreset = 0x9D,
@@ -539,6 +552,7 @@ public enum ServerPacketType
539552
CyclopediaCharacterInfo = 0xDA,
540553
HirelingNameChange = 0xDB,
541554
TutorialHint = 0xDC,
555+
//AutomapFlag = 0xDD,
542556
CyclopediaMapData = 0xDD,
543557
DailyRewardCollectionState = 0xDE,
544558
CreditBalance = 0xDF,

TibiaAPI/Creatures/Creature.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ public class Creature
3636
public byte PartyFlag { get; set; }
3737
public byte PkFlag { get; set; }
3838
public byte SpeechCategory { get; set; }
39+
public byte Vocation { get; set; }
3940

4041
public bool Visible { get; set; }
4142

TibiaAPI/Network/ClientPacket.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ public static ClientPacket CreateInstance(Client client, ClientPacketType type)
3232
return new ClientPackets.PerformanceMetrics(client);
3333
case ClientPacketType.StashAction:
3434
return new ClientPackets.StashAction(client);
35+
case ClientPacketType.DepotSearchRetrieve:
36+
return new ClientPackets.DepotSearchRetrieve(client);
3537
case ClientPacketType.ClientCheck:
3638
return new ClientPackets.ClientCheck(client);
3739
case ClientPacketType.GoPath:
@@ -84,6 +86,8 @@ public static ClientPacket CreateInstance(Client client, ClientPacketType type)
8486
return new ClientPackets.AcceptTrade(client);
8587
case ClientPacketType.RejectTrade:
8688
return new ClientPackets.RejectTrade(client);
89+
case ClientPacketType.FriendSystemAction:
90+
return new ClientPackets.FriendSystemAction(client);
8791
case ClientPacketType.UseObject:
8892
return new ClientPackets.UseObject(client);
8993
case ClientPacketType.UseTwoObjects:
@@ -114,6 +118,14 @@ public static ClientPacket CreateInstance(Client client, ClientPacketType type)
114118
return new ClientPackets.LootContainer(client);
115119
case ClientPacketType.QuickLootBlackWhitelist:
116120
return new ClientPackets.QuickLootBlackWhitelist(client);
121+
case ClientPacketType.OpenDepotSearch:
122+
return new ClientPackets.OpenDepotSearch(client);
123+
case ClientPacketType.CloseDepotSearch:
124+
return new ClientPackets.CloseDepotSearch(client);
125+
case ClientPacketType.DepotSearchType:
126+
return new ClientPackets.DepotSearchType(client);
127+
case ClientPacketType.OpenParentContainer:
128+
return new ClientPackets.OpenParentContainer(client);
117129
case ClientPacketType.Talk:
118130
return new ClientPackets.Talk(client);
119131
case ClientPacketType.GetChannels:
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
using OXGaming.TibiaAPI.Constants;
2+
3+
namespace OXGaming.TibiaAPI.Network.ClientPackets
4+
{
5+
public class CloseDepotSearch : ClientPacket
6+
{
7+
public CloseDepotSearch(Client client)
8+
{
9+
Client = client;
10+
PacketType = ClientPacketType.CloseDepotSearch;
11+
}
12+
13+
public override void AppendToNetworkMessage(NetworkMessage message)
14+
{
15+
message.Write((byte)ClientPacketType.CloseDepotSearch);
16+
}
17+
}
18+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
using OXGaming.TibiaAPI.Constants;
2+
3+
namespace OXGaming.TibiaAPI.Network.ClientPackets
4+
{
5+
public class DepotSearchRetrieve : ClientPacket
6+
{
7+
public ushort ItemId { get; set; }
8+
public byte Amount { get; set; }
9+
10+
public DepotSearchRetrieve(Client client)
11+
{
12+
Client = client;
13+
PacketType = ClientPacketType.DepotSearchRetrieve;
14+
}
15+
16+
public override void ParseFromNetworkMessage(NetworkMessage message)
17+
{
18+
ItemId = message.ReadUInt16();
19+
Amount = message.ReadByte();
20+
}
21+
22+
public override void AppendToNetworkMessage(NetworkMessage message)
23+
{
24+
message.Write((byte)ClientPacketType.DepotSearchRetrieve);
25+
message.Write(ItemId);
26+
message.Write(Amount);
27+
}
28+
}
29+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
using OXGaming.TibiaAPI.Constants;
2+
3+
namespace OXGaming.TibiaAPI.Network.ClientPackets
4+
{
5+
public class DepotSearchType : ClientPacket
6+
{
7+
public ushort ItemId { get; set; }
8+
9+
public DepotSearchType(Client client)
10+
{
11+
Client = client;
12+
PacketType = ClientPacketType.DepotSearchType;
13+
}
14+
15+
public override void ParseFromNetworkMessage(NetworkMessage message)
16+
{
17+
ItemId = message.ReadUInt16();
18+
}
19+
20+
public override void AppendToNetworkMessage(NetworkMessage message)
21+
{
22+
message.Write((byte)ClientPacketType.DepotSearchType);
23+
message.Write(ItemId);
24+
}
25+
}
26+
}
Lines changed: 168 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,168 @@
1+
using System;
2+
3+
using OXGaming.TibiaAPI.Constants;
4+
5+
namespace OXGaming.TibiaAPI.Network.ClientPackets
6+
{
7+
public class FriendSystemAction : ClientPacket
8+
{
9+
public string PlayerName { get; set; }
10+
11+
public uint BadgeId { get; set; }
12+
public uint PlayerId { get; set; }
13+
14+
public byte Action { get; set; }
15+
public byte ConfigId { get; set; }
16+
public byte FriendshipLevel { get; set; }
17+
18+
public bool AllowInspect { get; set; }
19+
public bool DisplayBadge { get; set; }
20+
public bool ShowAccountInfo { get; set; }
21+
public bool ShowCharacterInfo { get; set; }
22+
23+
public FriendSystemAction(Client client)
24+
{
25+
Client = client;
26+
PacketType = ClientPacketType.FriendSystemAction;
27+
}
28+
29+
public override void ParseFromNetworkMessage(NetworkMessage message)
30+
{
31+
// TODO: Figure out Actions 0x0C, 0x0E, 0x0F (if they exist),
32+
// and others (if there are any).
33+
Action = message.ReadByte();
34+
if (Action == 0x00) // Open Window
35+
{
36+
}
37+
else if (Action == 0x01) // Get Invitations
38+
{
39+
}
40+
else if (Action == 0x02) // Get Blacklist
41+
{
42+
}
43+
else if (Action == 0x03) // Send Invitation
44+
{
45+
PlayerId = message.ReadUInt32();
46+
}
47+
else if (Action == 0x04) // Accept Invitation
48+
{
49+
PlayerId = message.ReadUInt32();
50+
FriendshipLevel = message.ReadByte();
51+
}
52+
else if (Action == 0x05) // Decline Invitation
53+
{
54+
PlayerId = message.ReadUInt32();
55+
}
56+
else if (Action == 0x06) // Cancel Invitation
57+
{
58+
PlayerId = message.ReadUInt32();
59+
}
60+
else if (Action == 0x07) // Add to Blacklist
61+
{
62+
PlayerId = message.ReadUInt32();
63+
}
64+
else if (Action == 0x08) // Remove from Blacklist
65+
{
66+
PlayerId = message.ReadUInt32();
67+
}
68+
else if (Action == 0x09) // Unfriend
69+
{
70+
PlayerId = message.ReadUInt32();
71+
}
72+
else if (Action == 0x0A) // Change Friendship Level
73+
{
74+
PlayerId = message.ReadUInt32();
75+
FriendshipLevel = message.ReadByte();
76+
}
77+
else if (Action == 0x0B) // Search
78+
{
79+
PlayerName = message.ReadString();
80+
}
81+
else if (Action == 0x0D) // Change Badge Display
82+
{
83+
BadgeId = message.ReadUInt32();
84+
DisplayBadge = message.ReadBool();
85+
}
86+
else if (Action == 0x10) // Change Config
87+
{
88+
ConfigId = message.ReadByte();
89+
ShowCharacterInfo = message.ReadBool();
90+
ShowAccountInfo = message.ReadBool();
91+
AllowInspect = message.ReadBool();
92+
}
93+
else
94+
{
95+
throw new Exception($"Invalid Friend System Action: {Action}");
96+
}
97+
}
98+
99+
public override void AppendToNetworkMessage(NetworkMessage message)
100+
{
101+
message.Write((byte)ClientPacketType.FriendSystemAction);
102+
message.Write(Action);
103+
if (Action == 0x00) // Open Window
104+
{
105+
}
106+
else if (Action == 0x01) // Get Invitations
107+
{
108+
}
109+
else if (Action == 0x02) // Get Blacklist
110+
{
111+
}
112+
else if (Action == 0x03) // Send Invitation
113+
{
114+
message.Write(PlayerId);
115+
}
116+
else if (Action == 0x04) // Accept Invitation
117+
{
118+
message.Write(PlayerId);
119+
message.Write(FriendshipLevel);
120+
}
121+
else if (Action == 0x05) // Decline Invitation
122+
{
123+
message.Write(PlayerId);
124+
}
125+
else if (Action == 0x06) // Cancel Invitation
126+
{
127+
message.Write(PlayerId);
128+
}
129+
else if (Action == 0x07) // Add to Blacklist
130+
{
131+
message.Write(PlayerId);
132+
}
133+
else if (Action == 0x08) // Remove from Blacklist
134+
{
135+
message.Write(PlayerId);
136+
}
137+
else if (Action == 0x09) // Unfriend
138+
{
139+
message.Write(PlayerId);
140+
}
141+
else if (Action == 0x0A) // Change Friendship Level
142+
{
143+
message.Write(PlayerId);
144+
message.Write(FriendshipLevel);
145+
}
146+
else if (Action == 0x0B) // Search
147+
{
148+
message.Write(PlayerName);
149+
}
150+
else if (Action == 0x0D) // Change Badge Display
151+
{
152+
message.Write(BadgeId);
153+
message.Write(DisplayBadge);
154+
}
155+
else if (Action == 0x10) // Change Config
156+
{
157+
message.Write(ConfigId);
158+
message.Write(ShowCharacterInfo);
159+
message.Write(ShowAccountInfo);
160+
message.Write(AllowInspect);
161+
}
162+
else
163+
{
164+
throw new Exception($"Invalid Friend System Action: {Action}");
165+
}
166+
}
167+
}
168+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
using OXGaming.TibiaAPI.Constants;
2+
3+
namespace OXGaming.TibiaAPI.Network.ClientPackets
4+
{
5+
public class OpenDepotSearch : ClientPacket
6+
{
7+
public OpenDepotSearch(Client client)
8+
{
9+
Client = client;
10+
PacketType = ClientPacketType.OpenDepotSearch;
11+
}
12+
13+
public override void AppendToNetworkMessage(NetworkMessage message)
14+
{
15+
message.Write((byte)ClientPacketType.OpenDepotSearch);
16+
}
17+
}
18+
}

0 commit comments

Comments
 (0)