Skip to content

Commit 0e07fa3

Browse files
committed
Add known changes to GraphicalEffects packet
1 parent 7cb220c commit 0e07fa3

1 file changed

Lines changed: 34 additions & 12 deletions

File tree

TibiaAPI/Network/ServerPackets/GraphicalEffects.cs

Lines changed: 34 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ public class GraphicalEffects : ServerPacket
77
{
88
public Position Position { get; set; }
99

10-
public uint Unknown { get; set; }
11-
1210
public byte Effect { get; set; }
1311

1412
public GraphicalEffects(Client client)
@@ -24,15 +22,36 @@ public override bool ParseFromNetworkMessage(NetworkMessage message)
2422
return false;
2523
}
2624

27-
// Apparently, there's more information than I thought, and it doesn't make sense.
28-
//83 53 7E D6 7D 06 01 61 03 04 03 09 00
29-
//83 54 7E D7 7D 07 01 1D 03 26 01 01 03 26 01 01 03 26 01 01 03 26 01 01 03 26 01 01 03 26 01 01 03 26 00
30-
3125
Position = message.ReadPosition();
32-
Effect = message.ReadByte();
33-
if (Client.VersionNumber >= 12000000)
26+
27+
if (Client.VersionNumber < 12000000)
3428
{
35-
Unknown = message.ReadUInt32();
29+
Effect = message.ReadByte();
30+
}
31+
else
32+
{
33+
// TODO: Store new structure in a sensible manner
34+
// that is easy to append to a networkmessage.
35+
while (true)
36+
{
37+
var type = message.ReadByte();
38+
if (type == 0)
39+
{
40+
break;
41+
}
42+
else if (type == 1)
43+
{
44+
var tilesToMove = message.ReadByte();
45+
}
46+
else if (type == 3)
47+
{
48+
var effectId = message.ReadByte();
49+
}
50+
else
51+
{
52+
throw new System.Exception($"[ServerPackets.GraphicalEffects] Unknown type: {type}");
53+
}
54+
}
3655
}
3756
return true;
3857
}
@@ -41,10 +60,13 @@ public override void AppendToNetworkMessage(NetworkMessage message)
4160
{
4261
message.Write((byte)ServerPacketType.GraphicalEffects);
4362
message.Write(Position);
44-
message.Write(Effect);
45-
if (Client.VersionNumber >= 12000000)
63+
if (Client.VersionNumber < 12000000)
64+
{
65+
message.Write(Effect);
66+
}
67+
else
4668
{
47-
message.Write(Unknown);
69+
// TODO: Write new structure to message.
4870
}
4971
}
5072
}

0 commit comments

Comments
 (0)