/* Thor Server 2.0 Project - Codenamed "Stockholm" Copyright 2008 - 2009 Joe Hegarty This file is part of The Thor Server 2.0 Project - Codenamed "Stockholm". The Thor Server 2.0 Project - Codenamed "Stockholm" is free software: you can redistribute it and/or modify it under the terms of the Microsoft Public License The Thor Server Project is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Microsoft Public License for more details. You should have received a copy of the Microsoft Public License along with The Thor Server Project. If not, see http://www.opensource.org/licenses/ms-pl.html */ using System; using System.Collections.Generic; using StockholmLibrary.Net; using StockholmLibrary.Util; namespace StockholmLibrary.Game.Packets.Server { //------------------------------------ public class FloorObject { public int ID = 0; public string Sprite; public IsometricPoint Location = new IsometricPoint(); public int Orientation = 0; } //------------------------------------ public class FloorObjectsPacket : ServerPacket { List _floorObjects; //********************************************** public FloorObjectsPacket() { _packetType = EServerPacket.FLOOR_OBJECTS; } //********************************************** public FloorObjectsPacket(FloorObject floorObject) { _packetType = EServerPacket.FLOOR_OBJECTS; _floorObjects = new List(); _floorObjects.Add(floorObject); } //********************************************** public FloorObjectsPacket(List floorObjects) { _packetType = EServerPacket.FLOOR_OBJECTS; _floorObjects = floorObjects; } //********************************************** protected override void SerialiseBody() { if (_floorObjects != null) { foreach (var floorObject in _floorObjects) { SerialiseFloorObject(floorObject); WriteByte(0xD); // Chr13 } } } //********************************************** private void SerialiseFloorObject(FloorObject floorObject) { WriteStringInt(floorObject.ID); WriteByteRaw(0x20); // Space WriteStringRaw(floorObject.Sprite); WriteByteRaw(0x20); // Space WriteStringInt(floorObject.Location.X); WriteByteRaw(0x20); // Space WriteStringInt(floorObject.Location.Y); WriteByteRaw(0x20); // Space WriteStringFloat(floorObject.Location.Z); WriteByteRaw(0x20); // Space WriteStringInt(floorObject.Orientation); } } }