コード例 #1
0
ファイル: PlayerHandler.cs プロジェクト: fry/Survivalist
        public PlayerHandler(Server server, PacketPipe pipe, Player player)
        {
            this.server = server;
            this.pipe = pipe;
            this.player = player;

            pipe.SetHandler(this);
            //server.World.ChunkPool.AddPlayer(player);
            //pipe.SendPacket(new PositionPacket(0, 4, 0));
            SetPosition(player.X, player.Y, player.Z, 0, 0);

            var mainInv = new InventoryItem[36];
            mainInv[0] = new InventoryItem((int)BlockType.Stone, -1);
            mainInv[1] = new InventoryItem((int)BlockType.Dirt, -1);
            mainInv[2] = new InventoryItem((int)BlockType.Cobblestone, -1);
            mainInv[3] = new InventoryItem((int)BlockType.Wood, -1);
            mainInv[4] = new InventoryItem((int)BlockType.Sand, -1);
            mainInv[5] = new InventoryItem((int)BlockType.StillLava, -1);
            mainInv[6] = new InventoryItem((int)BlockType.StillWater, -1);
            mainInv[7] = new InventoryItem((int)BlockType.Sponge, -1);
            mainInv[8] = new InventoryItem(277, 1);
            pipe.SendPacket(new SendInventoryPacket(InventoryType.Main, mainInv));
            pipe.SendPacket(new SendInventoryPacket(InventoryType.Crafting, new InventoryItem[4]));
            pipe.SendPacket(new SendInventoryPacket(InventoryType.Armor, new InventoryItem[4]));
            pipe.SendPacket(new UpdateTimePacket((int)server.World.Time));
            Broadcast(new ChatPacket("Player connected: " + player.Name));
        }
コード例 #2
0
ファイル: EntityHandler.cs プロジェクト: fry/Survivalist
 public Player NewPlayer(PacketPipe client, string accountName, string serverPassword)
 {
     var player = new Player(client, world, accountName);
     player.X = 0;
     player.Y = 100;
     player.Z = 0;
     Console.WriteLine("Player #{0} connected: {1}", player.Id, accountName);
     return player;
 }
コード例 #3
0
ファイル: Player.cs プロジェクト: fry/Survivalist
 public Player(PacketPipe client, World world, string name)
     : base(name)
 {
     Client = client;
     this.World = world;
 }
コード例 #4
0
ファイル: LoginHandler.cs プロジェクト: fry/Survivalist
 public LoginHandler(Server server, TcpClient client)
 {
     this.server = server;
     pipe = new PacketPipe(client, this);
 }