Ejemplo n.º 1
0
        /// <summary>
        /// Tells the client to create a player for the context ID.
        /// </summary>
        /// <param name="SendTo"></param>
        /// <param name="PlayerID"></param>
        public static void CreatePlayer(ClientContext SendTo, int PlayerID)
        {
            var b    = BitConverter.GetBytes(PlayerID);
            var send = DSPacket.Format(Command.CLIENT_CREATEPLAYER, b);

            SendPacketToClient(SendTo, send);
            WriteLine($"Player created on context: {SendTo.ID}, for ID: {PlayerID}");
        }
        /// <summary>
        /// Client tells the server that the player has navigated to a specific point.
        /// </summary>
        /// <param name="context"></param>
        /// <param name="data"></param>
        public static void PlayerNavigated(ClientContext context, byte[] data)
        {
            var b = DSPacket.Format(Command.PLAYER_NAVIGATE, data);

            BroadcastPacket(b);
            var x = BitConverter.ToInt32(data, 4);
            var y = BitConverter.ToInt32(data, 8);

            WriteLine($"Client: {context.ID} Navigates to X:{x}, Y:{y}");
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Sends the current level to client, forcing it to update it's level.
 /// </summary>
 /// <param name="context"></param>
 public static void SendLevel(ClientContext context)
 {
     if (SERVER_LevelFile == null)
     {
         WriteLine("A LevelSave is not present and therefore the SendLevel command was aborted.");
         return;
     }
     WriteLine($"Sending level data to context: {context.ID}");
     SendPacketToClient(context, DSPacket.Format(Command.LEVEL_LEVELCHANGED, SERVER_LevelFile));
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Client sent the server that it was interacting with an object.
        /// </summary>
        /// <param name="context"></param>
        /// <param name="data"></param>
        public static void PlayerInteracted(ClientContext context, byte[] data)
        {
            var b = DSPacket.Format(Command.PLAYER_INTERACT, data);

            BroadcastPacket(b);
            var x = BitConverter.ToInt32(data, 0);
            var y = BitConverter.ToInt32(data, 4);

            WriteLine($"Player: {x}, Interacts with Object: {y}");
        }
Ejemplo n.º 5
0
        /// <summary>
        /// The client tells the server that it has seated a person at a table.
        /// </summary>
        /// <param name="context"></param>
        /// <param name="data"></param>
        public static void PersonSeated(ClientContext context, byte[] data)
        {
            var b = DSPacket.Format(Command.PERSON_SEAT, data);

            BroadcastPacket(b, BroadcastAudience.All); //Tell all clients to seat a person at table ID in seat ID.
            var SenderID = BitConverter.ToInt32(data, 0);
            var pID      = BitConverter.ToInt32(data, 4);
            var table    = BitConverter.ToInt32(data, 8);

            WriteLine($"Player: {SenderID}, Seats Person: {pID} at Table: {table}");
        }
        public static void BroadcastGameStart()
        {
            var packet = DSPacket.Format(Command.HOST_STARTGAME, new byte[0]);

            BroadcastPacket(packet);
        }
Ejemplo n.º 7
0
 public void RequestLevelChange(byte[] LevelData)
 {
     SendPacketToServer(DSPacket.Format(Commands.Command.LEVEL_NEWLEVEL, LevelData));
 }
Ejemplo n.º 8
0
 /// <summary>
 /// Tells every client to change the level to the currently stored level in the Server.
 /// </summary>
 public static void BroadcastSendLevel()
 {
     BroadcastPacket(DSPacket.Format(Command.LEVEL_LEVELCHANGED, SERVER_LevelFile));
 }