private static void StartServers() { #if DEBUG Config.DebugMode = true; #endif try { Game = new GameServer(Config.ConnectionCapacity); Game.Start(Config.SERVER_PORT); Lobby = new LoginServer(Config.ConnectionCapacity); Lobby.Start(Config.LOGIN_PORT); Console.ForegroundColor = ConsoleColor.Green; Logger("Login server is online."); Logger("Game server is online."); TimeServerStarted = DateTime.UtcNow; } catch (SocketException ex) { ServerContext.Logger(ex.Message, Microsoft.Extensions.Logging.LogLevel.Error); ServerContext.Logger(ex.StackTrace, Microsoft.Extensions.Logging.LogLevel.Error); } }
public static void LoadMaps() { StorageManager.AreaBucket.CacheFromStorage(); ServerContext.Logger($"Map Templates Loaded: {GlobalMapCache.Count}"); }
public static void LoadNationsTemplates() { StorageManager.NationBucket.CacheFromStorage(); ServerContext.Logger($"Nation Templates Loaded: {GlobalNationTemplateCache.Count}"); }
public static void LoadWorldMapTemplates() { StorageManager.WorldMapBucket.CacheFromStorage(); ServerContext.Logger($"World Map Templates Loaded: {GlobalWorldMapTemplateCache.Count}"); }
public static void LoadPopupTemplates() { StorageManager.PopupBucket.CacheFromStorage(); ServerContext.Logger($"Popup Templates Loaded: {GlobalPopupCache.Count}"); }
public static void LoadServerTemplates() { StorageManager.ServerArgBucket.CacheFromStorage(); ServerContext.Logger($"Server Templates Loaded: {GlobalServerVarCache.Count}"); }
public static void LoadMundaneTemplates() { StorageManager.MundaneBucket.CacheFromStorage(); ServerContext.Logger($"Mundane Templates Loaded: {GlobalMundaneTemplateCache.Count}"); }
public static void LoadItemTemplates() { StorageManager.ItemBucket.CacheFromStorage(); ServerContext.Logger($"Item Templates Loaded: {GlobalItemTemplateCache.Count}"); }
public static void LoadSpellTemplates() { StorageManager.SpellBucket.CacheFromStorage(); ServerContext.Logger($"Spell Templates Loaded: {GlobalSpellTemplateCache.Count}"); }
public bool OnLoaded() { var delete = false; lock (ServerContext.SyncLock) { Tile = new TileContent[Cols, Rows]; ObjectGrid = new TileGrid[Cols, Rows]; var stream = new MemoryStream(Data); var reader = new BinaryReader(stream); try { reader.BaseStream.Seek(0, SeekOrigin.Begin); for (var y = 0; y < Rows; y++) { for (var x = 0; x < Cols; x++) { ObjectGrid[x, y] = new TileGrid(this, x, y); reader.BaseStream.Seek(2, SeekOrigin.Current); if (reader.BaseStream.Position < reader.BaseStream.Length) { var a = reader.ReadInt16(); var b = reader.ReadInt16(); if (ParseMapWalls(a, b)) { Tile[x, y] = TileContent.Wall; } else { Tile[x, y] = TileContent.None; } } else { Tile[x, y] = TileContent.Wall; } } } foreach (var block in Blocks) { Tile[block.X, block.Y] = TileContent.Wall; } Ready = true; } catch (Exception ex) { ServerContext.Logger(ex.Message, Microsoft.Extensions.Logging.LogLevel.Error); ServerContext.Logger(ex.StackTrace, Microsoft.Extensions.Logging.LogLevel.Error); //Ignore delete = true; } finally { reader.Close(); stream.Close(); } if (!delete) { return(true); } } return(Ready); }