void CompleteLoginProcess() { LevelPermission adminChatRank = CommandOtherPerms.FindPerm("adminchat", LevelPermission.Admin); SendUserMOTD(); SendMap(null); if (disconnected) { return; } loggedIn = true; PlayerInfo.Online.Add(this); connections.Remove(this); RemoveFromPending(); Server.s.PlayerListUpdate(); //OpenClassic Client Check SendBlockchange(0, 0, 0, 0); timeLogged = DateTime.Now; lastLogin = DateTime.Now; time = new TimeSpan(0, 0, 0, 1); DataTable playerDb = Database.Backend.GetRows("Players", "*", "WHERE Name=@0", name); if (playerDb.Rows.Count == 0) { InitPlayerStats(playerDb); } else { LoadPlayerStats(playerDb); } Server.Background.QueueOnce(ShowAltsTask, name, TimeSpan.Zero); CheckState(); ZombieStats stats = Server.zombie.LoadZombieStats(name); Game.MaxInfected = stats.MaxInfected; Game.TotalInfected = stats.TotalInfected; Game.MaxRoundsSurvived = stats.MaxRounds; Game.TotalRoundsSurvived = stats.TotalRounds; if (!Directory.Exists("players")) { Directory.CreateDirectory("players"); } PlayerDB.Load(this); Game.Team = Team.FindTeam(this); SetPrefix(); playerDb.Dispose(); LoadCpeData(); if (Server.verifyadmins && group.Permission >= Server.verifyadminsrank) { adminpen = true; } if (Server.noEmotes.Contains(name)) { parseEmotes = !Server.parseSmiley; } hidden = group.CanExecute("hide") && Server.hidden.Contains(name); if (hidden) { SendMessage("&8Reminder: You are still hidden."); } if (group.Permission >= adminChatRank && Server.adminsjoinsilent) { hidden = true; adminchat = true; } if (PlayerConnect != null) { PlayerConnect(this); } OnPlayerConnectEvent.Call(this); if (cancellogin) { cancellogin = false; return; } string joinm = "&a+ " + FullName + " %S" + PlayerDB.GetLoginMessage(this); if (hidden) { joinm = "&8(hidden)" + joinm; } const LevelPermission perm = LevelPermission.Guest; if (group.Permission > perm || (Server.guestJoinNotify && group.Permission <= perm)) { Player[] players = PlayerInfo.Online.Items; foreach (Player pl in players) { if (Entities.CanSee(pl, this)) { Player.Message(pl, joinm); } } } if (Server.agreetorulesonentry && group.Permission == LevelPermission.Guest && !Server.agreed.Contains(name)) { SendMessage("&9You must read the &c/rules&9 and &c/agree&9 to them before you can build and use commands!"); agreed = false; } if (Server.verifyadmins && group.Permission >= Server.verifyadminsrank) { if (!Directory.Exists("extra/passwords") || !File.Exists("extra/passwords/" + name + ".dat")) { SendMessage("&cPlease set your admin verification password with &a/setpass [Password]!"); } else { SendMessage("&cPlease complete admin verification with &a/pass [Password]!"); } } Server.s.Log(name + " [" + ip + "] has joined the server."); Game.InfectMessages = PlayerDB.GetInfectMessages(this); Server.zombie.PlayerJoinedServer(this); ushort x = (ushort)(level.spawnx * 32 + 16); ushort y = (ushort)(level.spawny * 32 + 32); ushort z = (ushort)(level.spawnz * 32 + 16); pos = new ushort[3] { x, y, z }; rot = new byte[2] { level.rotx, level.roty }; Entities.SpawnEntities(this, x, y, z, rot[0], rot[1]); PlayerActions.CheckGamesJoin(this, null); Loading = false; }
void CompleteLoginProcess() { // Lock to ensure that no two players can end up with the same playerid lock (PlayerInfo.Online.locker) { id = NextFreeId(); PlayerInfo.Online.Add(this); } SendMap(null); if (disconnected) { return; } loggedIn = true; connections.Remove(this); RemoveFromPending(); Server.PlayerListUpdate(); SessionStartTime = DateTime.UtcNow; LastLogin = DateTime.Now; TotalTime = TimeSpan.FromSeconds(1); GetPlayerStats(); ShowWelcome(); Server.Background.QueueOnce(ShowAltsTask, name, TimeSpan.Zero); CheckState(); ZombieStats stats = Server.zombie.LoadZombieStats(name); Game.MaxInfected = stats.MaxInfected; Game.TotalInfected = stats.TotalInfected; Game.MaxRoundsSurvived = stats.MaxRounds; Game.TotalRoundsSurvived = stats.TotalRounds; if (!Directory.Exists("players")) { Directory.CreateDirectory("players"); } PlayerDB.Load(this); Game.Team = Team.TeamIn(this); SetPrefix(); LoadCpeData(); if (ServerConfig.verifyadmins && group.Permission >= ServerConfig.VerifyAdminsRank) { adminpen = true; } if (Server.noEmotes.Contains(name)) { parseEmotes = !ServerConfig.ParseEmotes; } LevelPermission adminChatRank = CommandExtraPerms.MinPerm("adminchat", LevelPermission.Admin); hidden = group.CanExecute("hide") && Server.hidden.Contains(name); if (hidden) { SendMessage("&8Reminder: You are still hidden."); } if (group.Permission >= adminChatRank && ServerConfig.AdminsJoinSilently) { hidden = true; adminchat = true; } OnPlayerConnectEvent.Call(this); if (cancellogin) { cancellogin = false; return; } string joinm = "&a+ " + FullName + " %S" + PlayerDB.GetLoginMessage(this); if (hidden) { joinm = "&8(hidden)" + joinm; } const LevelPermission perm = LevelPermission.Guest; if (group.Permission > perm || (ServerConfig.GuestJoinsNotify && group.Permission <= perm)) { Chat.MessageGlobal(this, joinm, false, true); } if (ServerConfig.AgreeToRulesOnEntry && group.Permission == LevelPermission.Guest && !Server.agreed.Contains(name)) { SendMessage("&9You must read the &c/Rules&9 and &c/Agree&9 to them before you can build and use commands!"); agreed = false; } if (ServerConfig.verifyadmins && group.Permission >= ServerConfig.VerifyAdminsRank) { if (!Directory.Exists("extra/passwords") || !File.Exists("extra/passwords/" + name + ".dat")) { SendMessage("&cPlease set your admin verification password with %T/SetPass [Password]!"); } else { SendMessage("&cPlease complete admin verification with %T/Pass [Password]!"); } } try { if (group.CanExecute("inbox") && Database.TableExists("Inbox" + name)) { using (DataTable table = Database.Backend.GetRows("Inbox" + name, "*")) { if (table.Rows.Count > 0) { SendMessage("You have &a" + table.Rows.Count + " %Smessages in %T/Inbox"); } } } } catch { } if (ServerConfig.PositionUpdateInterval > 1000) { SendMessage("Lowlag mode is currently &aON."); } if (String.IsNullOrEmpty(appName)) { Logger.Log(LogType.UserActivity, "{0} [{1}] connected.", name, ip); } else { Logger.Log(LogType.UserActivity, "{0} [{1}] connected using {2}.", name, ip, appName); } Game.InfectMessages = PlayerDB.GetInfectMessages(this); Server.lava.PlayerJoinedServer(this); Position pos = level.SpawnPos; byte yaw = level.rotx, pitch = level.roty; OnPlayerSpawningEvent.Call(this, ref pos, ref yaw, ref pitch, false); Pos = pos; SetYawPitch(yaw, pitch); Entities.SpawnEntities(this, true); PlayerActions.CheckGamesJoin(this, null); Loading = false; }