forked from jo3bingham/TibiaAPI
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBottomFloor.cs
More file actions
55 lines (47 loc) · 1.67 KB
/
BottomFloor.cs
File metadata and controls
55 lines (47 loc) · 1.67 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
using OXGaming.TibiaAPI.Constants;
namespace OXGaming.TibiaAPI.Network.ServerPackets
{
public class BottomFloor : Map
{
private const int GroundLayer = 7;
private const int UndergroundLayer = 2;
private const int MapMaxZ = 15;
public BottomFloor(Client client)
{
Client = client;
PacketType = ServerPacketType.BottomFloor;
}
public override void ParseFromNetworkMessage(NetworkMessage message)
{
var position = Client.WorldMapStorage.GetPosition();
position.X--;
position.Y--;
position.Z++;
Client.WorldMapStorage.SetPosition(position.X, position.Y, position.Z);
if (position.Z > (GroundLayer + 1))
{
Client.WorldMapStorage.ScrollMap(0, 0, 1);
if (position.Z <= (MapMaxZ - UndergroundLayer))
{
message.ReadFloor(0, 0, Fields);
}
}
else if (position.Z == (GroundLayer + 1))
{
Client.WorldMapStorage.ScrollMap(0, 0, (UndergroundLayer + 1));
var numberOfTilesToSkip = 0;
var floorNumber = UndergroundLayer;
while (floorNumber >= 0)
{
numberOfTilesToSkip = message.ReadFloor(floorNumber, numberOfTilesToSkip, Fields);
floorNumber--;
}
}
}
public override void AppendToNetworkMessage(NetworkMessage message)
{
message.Write((byte)ServerPacketType.BottomFloor);
base.AppendToNetworkMessage(message);
}
}
}