示例#1
0
        public void OnPlayerLogin(PlayerLoggedInEvent ev)
        {
            Log.Info($"Player {ev.Player.Login} Logged In with session {ev.Player.SessionId}", ConsoleColor.Yellow);
            var player = Mapper.Map <OnlinePlayer>(ev.Player);

            player.Tcp = ev.Client;
            Server.Players.Add(player);
            ev.Client.OnlinePlayer = player;

            // Going to start sending asset validations
            ev.Client.Send(new AssetsReadyPacket());

            // check if the player already have the tilesets
            foreach (var tileset in Server.Map.Tilesets)
            {
                ev.Client.Send(new AssetPacket()
                {
                    ResquestedImageName = tileset.Key,
                    AssetType           = AssetType.TILESET
                });
            }

            // check if the player have the main sprites
            ev.Client.Send(new AssetPacket()
            {
                ResquestedImageName = "sprites.png",
                AssetType           = AssetType.SPRITE
            });

            ev.Client.Send(new AssetPacket()
            {
                ResquestedImageName = "bodies.png",
                AssetType           = AssetType.SPRITE
            });

            ev.Client.Send(new AssetPacket()
            {
                ResquestedImageName = "legs.png",
                AssetType           = AssetType.SPRITE
            });

            ev.Client.Send(new AssetPacket()
            {
                ResquestedImageName = "heads.png",
                AssetType           = AssetType.SPRITE
            });

            ev.Client.Send(new AssetPacket()
            {
                ResquestedImageName = "chests.png",
                AssetType           = AssetType.SPRITE
            });

            // end of assets validation
            ev.Client.Send(new AssetsReadyPacket());
        }
示例#2
0
        public void OnPlayerLogin(PlayerLoggedInEvent ev)
        {
            Log.Info($"Player {ev.Player.Login} Logged In with session {ev.Player.SessionId}", ConsoleColor.Yellow);

            var player = new OnlinePlayer();

            player.FromStored(ev.Player);
            player.Tcp = ev.Client;
            Server.Players.Add(player);
            ev.Client.OnlinePlayer = player;
        }
示例#3
0
 public void PlayerLoggedIn(PlayerLoggedInEvent ev)
 {
     lock (this.server)
     {
         var room = this.server.World.FindUserRoom(ev.Handle);
         if (room != null && room.IsDangling)
         {
             Log.Information("Player {player} logged back, room {identifier} is no longer dangling", ev.Handle.Digest, room.Identifier);
             room.IsDangling = false;
         }
     }
 }
示例#4
0
        public void PlayerLoggedIn(PlayerLoggedInEvent ev)
        {
            var period = DateTime.Now - ev.Handle.Character.LastLogin;

            if (this.config.ServerPromptText != null && period.TotalHours > this.config.ServerPromptPeriod)
            {
                try
                {
                    this.loginServer.Emit(ev.Handle.Token, "alert", this.config.ServerPromptText);
                }
                catch (LoginServerListener.NotFoundException)
                {
                    Log.Warning("Failed to send prompt message to player {player} - socketio connection not found!", ev.Handle.Digest);
                }
            }
        }
示例#5
0
 public void PlayerLoggedIn(PlayerLoggedInEvent ev)
 {
     ev.Handle.Character.LastLogin = DateTime.Now;
     this.db.Write((c) => c.CharacterUpdate(ev.Handle.Character));
 }
示例#6
0
 public void PlayerLoggedIn(PlayerLoggedInEvent ev)
 {
     this.ResetGroup(ev.Handle);
     this.JoinGroup(ev.Handle, ev.Handle.CurrentGroup, true);
 }