internal static void PostSentMap(Player p, Level prev, Level lvl, bool announce) { Position pos = lvl.SpawnPos; Orientation rot = p.Rot; byte yaw = lvl.rotx, pitch = lvl.roty; // in case player disconnected mid-way through loading map if (p.Socket.Disconnected) { return; } OnPlayerSpawningEvent.Call(p, ref pos, ref yaw, ref pitch, false); rot.RotY = yaw; rot.HeadX = pitch; p.Pos = pos; p.SetYawPitch(yaw, pitch); if (p.Socket.Disconnected) { return; } Entities.SpawnEntities(p, pos, rot); OnJoinedLevelEvent.Call(p, prev, lvl, ref announce); if (!announce || !Server.Config.ShowWorldChanges) { return; } announce = !p.hidden && Server.Config.IRCShowWorldChanges; string msg = p.level.IsMuseum ? "λNICK %Swent to the " : "λNICK %Swent to "; Chat.MessageFrom(ChatScope.Global, p, msg + lvl.ColoredName, null, FilterGoto(p), announce); }
public static void ReloadFor(Player src, Player p, bool announce) { p.Loading = true; Entities.DespawnEntities(p); p.SendMap(p.level); Entities.SpawnEntities(p); p.Loading = false; if (!announce) { return; } if (src == null || !Entities.CanSee(p, src)) { p.Message("&bMap reloaded"); } else { p.Message("&bMap reloaded by " + src.ColoredName); } if (Entities.CanSee(src, p)) { src.Message("&4Finished reloading for " + p.ColoredName); } }
public static void ReloadMap(Player p, Player who, bool showMessage) { who.Loading = true; Entities.DespawnEntities(who); who.SendMap(who.level); Entities.SpawnEntities(who); who.Loading = false; if (!showMessage) { return; } if (p == null || !Entities.CanSee(who, p)) { who.SendMessage("&bMap reloaded"); } else { who.SendMessage("&bMap reloaded by " + p.ColoredName); } if (Entities.CanSee(p, who)) { Player.Message(p, "&4Finished reloading for " + who.ColoredName); } }
static bool GotoLevel(Player p, Level lvl) { if (p.level == lvl) { Player.Message(p, "You are already in {0}%S.", lvl.ColoredName); return(false); } if (!lvl.CanJoin(p)) { return(false); } p.Loading = true; Entities.DespawnEntities(p); Level oldLevel = p.level; p.level = lvl; p.SendMap(oldLevel); Position pos = lvl.SpawnPos; byte yaw = lvl.rotx, pitch = lvl.roty; OnPlayerSpawningEvent.Call(p, ref pos, ref yaw, ref pitch, false); Entities.SpawnEntities(p, pos, new Orientation(yaw, pitch)); CheckGamesJoin(p, oldLevel); if (p.level.ShouldShowJoinMessage(oldLevel)) { string msg = p.level.IsMuseum ? " %Swent to the " : " %Swent to "; Chat.MessageGlobal(p, p.ColoredName + msg + lvl.ColoredName, false, true); OnPlayerActionEvent.Call(p, PlayerAction.JoinWorld, lvl.name); } return(true); }
internal static void ReloadMap(Player p) { p.Loading = true; Entities.DespawnEntities(p); p.SendRawMap(p.level, p.level); Entities.SpawnEntities(p, p.Pos, p.Rot); p.Loading = false; }
public static void ReloadMap(Player p, Player who, bool showMessage) { who.Loading = true; Entities.DespawnEntities(who); who.SendUserMOTD(); who.SendMap(who.level); Entities.SpawnEntities(who); who.Loading = false; if (!showMessage) { return; } if (p != null && !p.hidden) { who.SendMessage("&bMap reloaded by " + p.name); } if (p != null && p.hidden) { who.SendMessage("&bMap reloaded"); } Player.Message(p, "&4Finished reloading for " + who.name); }
static bool GotoLevel(Player p, Level lvl, bool ignorePerms) { if (p.level == lvl) { Player.Message(p, "You are already in {0}%S.", lvl.ColoredName); return(false); } if (!lvl.CanJoin(p, ignorePerms)) { return(false); } if (!Server.zombie.PlayerCanJoinLevel(p, lvl, p.level)) { return(false); } p.Loading = true; Entities.DespawnEntities(p); Level oldLevel = p.level; p.level = lvl; p.SendUserMOTD(); p.SendMap(oldLevel); ushort x = (ushort)(lvl.spawnx * 32 + 16); ushort y = (ushort)(lvl.spawny * 32 + 32); ushort z = (ushort)(lvl.spawnz * 32 + 16); Entities.SpawnEntities(p, x, y, z, lvl.rotx, lvl.roty); p.Loading = false; CheckGamesJoin(p, oldLevel); p.prevMsg = ""; if (!p.hidden && p.level.ShouldShowJoinMessage(oldLevel)) { Player.SendChatFrom(p, p.ColoredName + " %Swent to " + lvl.ColoredName, false); Player.RaisePlayerAction(p, PlayerAction.JoinWorld, lvl.name); } return(true); }
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; }