Beispiel #1
0
        public override void SendTradeCancel(Client sender, Client destClient, bool fromServer = false)
        {
            if (!fromServer)
                Server.NotifyClientTradeCancel(this, sender, destClient);

            if (destClient is P3DPlayer)
                destClient.SendPacket(new TradeQuitPacket { Origin = sender.Id });
        }
Beispiel #2
0
        public override void AddClient(Client client)
        {
            // -- We assume the Client is a GameJolt or the Client's password is correct and no one is using the Client's name.

            if (IsGameJoltIdUsed(client as P3DPlayer))
            {
                client.Kick("You are already on server!");
                return;
            }
            SavePlayerGJ(client as P3DPlayer);


            ClientUpdate(client, true);


            // Send to player his Id
            client.SendPacket(new CreatePlayerPacket { Origin = -1, PlayerId = client.Id });
            // Send to player all Players Id
            foreach (var aClient in Server.GetAllClients())
            {
                client.SendPacket(new CreatePlayerPacket { Origin = -1, PlayerId = aClient.Id });
                var packet = aClient.GetDataPacket();
                packet.Origin = aClient.Id;
                client.SendPacket(packet);
            }
            // Send to Players player Id
            SendPacketToAll(new CreatePlayerPacket { Origin = -1, PlayerId = client.Id });
            var p = client.GetDataPacket();
            p.Origin = client.Id;
            SendPacketToAll(p);


            ClientConnected(client);


            base.AddClient(client);
        }
Beispiel #3
0
        public override void SendTradeRequest(Client sender, Monster monster, Client destClient, bool fromServer = false)
        {
            if (!fromServer)
                Server.NotifyClientTradeOffer(this, sender, monster, destClient);

            if (destClient is P3DPlayer)
                destClient.SendPacket(new TradeOfferPacket { Origin = sender.Id, DataItems = monster.ToDataItems() });
        }
Beispiel #4
0
        public override void AddClient(Client client)
        {
            if (!Server.DatabaseSetClientId(client))
            {
                client.Kick("You are already on server!");
                return;
            }

            ClientUpdate(client, true);

            client.SendPacket(new AuthorizationCompletePacket { PlayerId = new VarInt(client.Id) });

            PlayersToAdd.Add(client);
            PlayersJoining.Remove(client);
        }
Beispiel #5
0
        public void PokeDTileSetRequest(Client player, IEnumerable<string> tileSetNames)
        {
            var tileSets = new List<TileSetResponse>();
            var images = new List<ImageResponse>();


            foreach (var tileSetName in tileSetNames)
            {
                tileSets.Add(new TileSetResponse() { Name = tileSetName, TileSetData = TileSets.GetFileAsync($"{tileSetName}.tsx").Result.ReadAllTextAsync().Result });

                var image = new ImageResponse();
                image.Name = tileSetName;
                using (var fileStream = TileSets.GetFileAsync($"{tileSetName}.png").Result.OpenAsync(FileAccess.Read).Result)
                    image.ImageData = fileStream.ReadFully();
                images.Add(image);
            }

            player.SendPacket(new TileSetResponsePacket()
            {
                TileSets = tileSets.ToArray(),
                Images = images.ToArray()
            });
        }
Beispiel #6
0
        public override void SendTradeCancel(Client sender, Client destClient, bool fromServer = false)
        {
            if (!fromServer)
                Server.NotifyClientTradeCancel(this, sender, destClient);

            if (destClient is PokeDPlayer)
                destClient.SendPacket(new TradeRefusePacket{ DestinationId = new VarInt(-1) });
        }
Beispiel #7
0
        public override void SendTradeConfirm(Client sender, Client destClient, bool fromServer = false)
        {
            if (!fromServer)
                Server.NotifyClientTradeConfirm(this, sender, destClient);

            if (destClient is PokeDPlayer)
            {
                destClient.SendPacket(new TradeAcceptPacket { DestinationId = new VarInt(-1) });

                Thread.Sleep(5000);
            }
        }
Beispiel #8
0
        public override void SendTradeRequest(Client sender, Monster monster, Client destClient, bool fromServer = false)
        {
            if (!fromServer)
                Server.NotifyClientTradeOffer(this, sender, monster, destClient);

            if (destClient is PokeDPlayer)
                destClient.SendPacket(new TradeOfferPacket { DestinationId = new VarInt(-1), MonsterData = monster.InstanceData });
        }