public static void Start() { serverConfig = ConfigElement.GetAll(typeof(ServerConfig)); levelConfig = ConfigElement.GetAll(typeof(LevelConfig)); zoneConfig = ConfigElement.GetAll(typeof(ZoneConfig)); #pragma warning disable 0618 Player.players = PlayerInfo.Online.list; Server.levels = LevelInfo.Loaded.list; #pragma warning restore 0618 StartTime = DateTime.UtcNow; shuttingDown = false; Logger.Log(LogType.SystemActivity, "Starting Server"); ServicePointManager.Expect100Continue = false; CheckFile("MySql.Data.dll"); CheckFile("sqlite3_x32.dll"); CheckFile("sqlite3_x64.dll"); EnsureFilesExist(); MoveSqliteDll(); MoveOutdatedFiles(); LoadAllSettings(); SrvProperties.GenerateSalt(); InitDatabase(); Economy.LoadDatabase(); Background.QueueOnce(UpgradeTasks.CombineEnvFiles); Background.QueueOnce(LoadMainLevel); Plugin.LoadAll(); Background.QueueOnce(LoadAutoloadMaps); Background.QueueOnce(UpgradeTasks.MovePreviousLevelFiles); Background.QueueOnce(UpgradeTasks.UpgradeOldTempranks); Background.QueueOnce(UpgradeTasks.UpgradeDBTimeSpent); Background.QueueOnce(InitPlayerLists); Background.QueueOnce(UpgradeTasks.UpgradeBots); Background.QueueOnce(SetupSocket); Background.QueueOnce(InitTimers); Background.QueueOnce(InitRest); Background.QueueOnce(InitHeartbeat); Devs.Clear(); Mods.Clear(); Background.QueueOnce(InitTasks.UpdateStaffList); ServerTasks.QueueTasks(); Background.QueueRepeat(ThreadSafeCache.DBCache.CleanupTask, null, TimeSpan.FromMinutes(5)); }
public static void LoadAllSettings() { // Unload custom plugins List <Plugin> plugins = new List <Plugin>(Plugin.all); foreach (Plugin p in plugins) { if (Plugin.core.Contains(p)) { continue; } Plugin.Unload(p, false); } ZSGame.Instance.infectMessages = ZSConfig.LoadInfectMessages(); Colors.Load(); Alias.Load(); BlockDefinition.LoadGlobal(); ImagePalette.Load(); SrvProperties.Load(); Group.LoadAll(); CommandPerms.Load(); Command.InitAll(); Block.SetBlocks(); Awards.Load(); Economy.Load(); WarpList.Global.Filename = "extra/warps.save"; WarpList.Global.Load(); CommandExtraPerms.Load(); ProfanityFilter.Init(); Team.LoadList(); ChatTokens.LoadCustom(); SrvProperties.FixupOldPerms(); TextFile announcementsFile = TextFile.Files["Announcements"]; announcementsFile.EnsureExists(); announcements = announcementsFile.GetText(); // Reload custom plugins foreach (Plugin p in plugins) { if (Plugin.core.Contains(p)) { continue; } Plugin.Load(p, false); } OnConfigUpdatedEvent.Call(); }
void DoLottery() { string[] players = Lottery.Items; if (players.Length == 0) { return; } // Ensure the players are actually online List <Player> online = new List <Player>(players.Length); foreach (string name in players) { Player pl = PlayerInfo.FindExact(name); if (pl == null) { continue; } online.Add(pl); Economy.EcoStats stats = Economy.RetrieveStats(pl.name); stats.TotalSpent += 10; Economy.UpdateStats(stats); } if (online.Count == 0) { return; } int amount = 10; Player winner = online[0]; if (online.Count == 1) { winner.SendMessage("Your money was refunded as you were " + "the only player still in the lottery."); } else { Random rand = new Random(); winner = online[rand.Next(online.Count)]; amount = 9 * online.Count; Chat.Message(ChatScope.Global, "%b" + winner.truename + " %7won the lottery for &a" + amount + " " + Server.Config.Currency + "%7.", null, null, true); } Lottery.Clear(); winner.SetMoney(winner.money + amount); }
public static void LoadAllSettings() { // Unload custom plugins List <Plugin> plugins = Plugin.all; foreach (Plugin plugin in plugins) { if (Plugin.core.Contains(plugin)) { continue; } plugin.Unload(false); } zombie.LoadInfectMessages(); Colors.LoadList(); Alias.Load(); BlockDefinition.LoadGlobal(); ImagePalette.Load(); SrvProperties.Load(); Group.InitAll(); Command.InitAll(); CommandPerms.Load(); Block.SetBlocks(); BlockDefinition.UpdateGlobalBlockProps(); Awards.Load(); Economy.Load(); WarpList.Global.Filename = "extra/warps.save"; WarpList.Global.Load(); CommandExtraPerms.Load(); ProfanityFilter.Init(); Team.LoadList(); ChatTokens.LoadCustom(); SrvProperties.FixupOldPerms(); // Reload custom plugins foreach (Plugin plugin in plugins) { if (Plugin.core.Contains(plugin)) { continue; } plugin.Load(false); } }
public static void LoadAllSettings() { Colors.LoadExtColors(); Alias.Load(); BlockDefinition.LoadGlobal(); SrvProperties.Load("properties/server.properties"); Updater.Load("properties/update.properties"); Group.InitAll(); Command.InitAll(); GrpCommands.fillRanks(); Block.SetBlocks(); Awards.Load(); Economy.Load(); Warp.LOAD(); CommandOtherPerms.Load(); ProfanityFilter.Init(); Team.LoadList(); }
internal static void LoadInfo(DataTable playerDb, Player p) { DataRow row = playerDb.Rows[0]; p.totalLogins = int.Parse(row["totalLogin"].ToString()) + 1; p.time = row["TimeSpent"].ToString().ParseDBTime(); p.userID = int.Parse(row["ID"].ToString()); p.firstLogin = DateTime.Parse(row["firstLogin"].ToString()); p.timeLogged = DateTime.Now; p.title = row["Title"].ToString().Trim(); if (p.title != "") { p.title = p.title.Replace("[", "").Replace("]", ""); } p.titlecolor = row["title_color"].ToString().Trim(); if (p.titlecolor != "") { p.titlecolor = Colors.Parse(p.titlecolor); } else { p.titlecolor = ""; } p.color = row["color"].ToString().Trim(); if (p.color != "") { p.color = Colors.Parse(p.color); } else { p.color = p.group.color; } p.overallDeath = int.Parse(row["TotalDeaths"].ToString()); p.overallBlocks = long.Parse(row["totalBlocks"].ToString().Trim()); //money = int.Parse(playerDb.Rows[0]["Money"].ToString()); p.money = Economy.RetrieveEcoStats(p.name).money; p.loginMoney = p.money; p.totalKicked = int.Parse(row["totalKicked"].ToString()); }
public static void LoadAllSettings() { zombie.LoadInfectMessages(); Colors.LoadExtColors(); Alias.Load(); Bots.BotsFile.Load(); BlockDefinition.LoadGlobal(); SrvProperties.Load("properties/server.properties"); Updater.Load("properties/update.properties"); Group.InitAll(); Command.InitAll(); GrpCommands.fillRanks(); Block.SetBlocks(); Awards.Load(); Economy.Load(); WarpList.Global.Load(null); CommandOtherPerms.Load(); ProfanityFilter.Init(); Team.LoadList(); ChatTokens.LoadCustom(); FixupOldPerms(); }
public void Start() { serverConfig = ConfigElement.GetAll(typeof(Server), typeof(ZombieGameProps)); levelConfig = ConfigElement.GetAll(typeof(Level)); #pragma warning disable 0618 Player.players = PlayerInfo.Online.list; PlayerInfo.players = PlayerInfo.Online.list; Server.levels = LevelInfo.Loaded.list; PlayerBot.playerbots = PlayerBot.Bots.list; #pragma warning restore 0618 StartTime = DateTime.UtcNow; StartTimeLocal = StartTime.ToLocalTime(); shuttingDown = false; Log("Starting Server"); try { if (File.Exists("Restarter.exe")) { File.Delete("Restarter.exe"); } } catch { } try { if (File.Exists("Restarter.pdb")) { File.Delete("Restarter.pdb"); } } catch { } CheckFile("MySql.Data.dll"); CheckFile("System.Data.SQLite.dll"); CheckFile("sqlite3.dll"); CheckFile("Newtonsoft.Json.dll"); CheckFile("LibNoise.dll"); EnsureFilesExist(); MoveOutdatedFiles(); lava = new LavaSurvival(); zombie = new ZombieGame(); Countdown = new CountdownGame(); LoadAllSettings(); InitDatabase(); Economy.LoadDatabase(); Server.zombie.CheckTableExists(); Level[] loaded = LevelInfo.Loaded.Items; foreach (Level l in loaded) { l.Unload(); } Background.QueueOnce(UpgradeTasks.CombineEnvFiles); Background.QueueOnce(LoadMainLevel); Plugin.Load(); Background.QueueOnce(UpgradeTasks.UpgradeOldBlacklist); Background.QueueOnce(LoadPlayerLists); Background.QueueOnce(LoadAutoloadCommands); Background.QueueOnce(UpgradeTasks.MovePreviousLevelFiles); Background.QueueOnce(UpgradeTasks.UpgradeOldLockdown); Background.QueueOnce(SetupSocket); Background.QueueOnce(InitTimers); Background.QueueOnce(InitRest); Background.QueueOnce(InitHeartbeat); Devs.Clear(); Mods.Clear(); Background.QueueOnce(InitTasks.UpdateStaffList); MainScheduler.QueueRepeat(ServerTasks.TemprankExpiry, null, TimeSpan.FromMinutes(1)); Background.QueueRepeat(ServerTasks.AutoSave, 1, TimeSpan.FromSeconds(Server.backupInterval)); Background.QueueRepeat(ServerTasks.BlockUpdates, null, TimeSpan.FromSeconds(Server.blockInterval)); Background.QueueRepeat(ThreadSafeCache.DBCache.CleanupTask, null, TimeSpan.FromMinutes(5)); }
public void Start() { serverConfig = ConfigElement.GetAll(typeof(Server), typeof(ZombieGame)); PlayerInfo.players = PlayerInfo.Online.list; Player.players = PlayerInfo.Online.list; Server.levels = LevelInfo.Loaded.list; PlayerBot.playerbots = PlayerBot.Bots.list; StartTime = DateTime.UtcNow; StartTimeLocal = StartTime.ToLocalTime(); shuttingDown = false; Log("Starting Server"); try { if (File.Exists("Restarter.exe")) { File.Delete("Restarter.exe"); } } catch { } try { if (File.Exists("Restarter.pdb")) { File.Delete("Restarter.pdb"); } } catch { } CheckFile("MySql.Data.dll"); CheckFile("System.Data.SQLite.dll"); CheckFile("sqlite3.dll"); CheckFile("Newtonsoft.Json.dll"); CheckFile("LibNoise.dll"); EnsureFilesExist(); MoveOutdatedFiles(); Chat.LoadCustomTokens(); if (File.Exists("text/emotelist.txt")) { foreach (string s in File.ReadAllLines("text/emotelist.txt")) { Player.emoteList.Add(s); } } else { File.Create("text/emotelist.txt").Dispose(); } lava = new LavaSurvival(); zombie = new ZombieGame(); Countdown = new CountdownGame(); LoadAllSettings(); InitDatabase(); Economy.LoadDatabase(); Server.zombie.CheckTableExists(); Level[] loaded = LevelInfo.Loaded.Items; foreach (Level l in loaded) { l.Unload(); } ml.Queue(LoadMainLevel); Plugin.Load(); ml.Queue(LoadPlayerLists); ml.Queue(LoadAutoloadCommands); ml.Queue(LoadGCAccepted); ml.Queue(InitTimers); ml.Queue(InitRest); ml.Queue(InitHeartbeat); UpdateStaffList(); }