public void ShowFieldMap(GameClient client)
        {
            if (client.MapOpen)
            {
                return;
            }

            if (ServerContext.GlobalWorldMapTemplateCache.ContainsKey(client.Aisling.World))
            {
                var portal = ServerContext.GlobalWorldMapTemplateCache[client.Aisling.World];

                if (portal.Portals.Any(ports => !ServerContext.GlobalMapCache.ContainsKey(ports.Destination.AreaId)))
                {
                    ServerContext.Logger("No Valid Configured World Map.");
                    return;
                }
            }

            client.Send(new ServerFormat2E(client.Aisling));


            client.Aisling.PortalSession
                = new PortalSession
                {
                FieldNumber = client.Aisling.World,
                IsMapOpen   = true,
                DateOpened  = DateTime.UtcNow
                };
        }
Exemple #2
0
        private static void LoadExtensions()
        {
            ServerContext.Logger("Loading Extensions...");

            CacheBuffs();
            ServerContext.Logger($"Building Buff Cache: {GlobalBuffCache.Count} Loaded.");

            CacheDebuffs();
            ServerContext.Logger($"Building Debuff Cache: {GlobalDeBuffCache.Count} Loaded.");

            ServerContext.Logger("Loading Extensions... Completed.");
        }
 public static void Startup()
 {
     try
     {
         LoadAndCacheStorage();
         StartServers();
     }
     catch (Exception ex)
     {
         ServerContext.Logger(ex.Message, Microsoft.Extensions.Logging.LogLevel.Error);
         ServerContext.Logger(ex.StackTrace, Microsoft.Extensions.Logging.LogLevel.Error);
     }
 }
Exemple #4
0
        public static void Startup()
        {
            ServerContext.Logger(string.Format($"{Config.SERVER_TITLE} Loading..."));

            try
            {
                LoadAndCacheStorage();
                StartServers();
            }
            catch (Exception e)
            {
                ServerContext.Logger(string.Format("Startup Error.", e.Message));
            }
        }
        public static void LoadMetaDatabase()
        {
            try
            {
                var files = MetafileManager.GetMetaFiles();

                if (files.Any())
                {
                    GlobalMetaCache.AddRange(files);
                }
            }
            catch (Exception ex)
            {
                ServerContext.Logger(ex.Message, Microsoft.Extensions.Logging.LogLevel.Error);
                ServerContext.Logger(ex.StackTrace, Microsoft.Extensions.Logging.LogLevel.Error);
            }
        }
Exemple #6
0
        private static void StartServers()
        {
#if DEBUG
            Config.DebugMode = true;
#endif
            try
            {
                Game = new GameServer(Config.ConnectionCapacity);
                Game.Start(Config.SERVER_PORT);
                ServerContext.Logger("Login server is online.");

                Lobby = new LoginServer(Config.ConnectionCapacity);
                Lobby.Start(Config.LOGIN_PORT);
                ServerContext.Logger("Game server is online.");
            }
            catch (SocketException e)
            {
                ServerContext.Error(e);
            }
        }
        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);
            }
        }
Exemple #8
0
 public static void LoadNationsTemplates()
 {
     StorageManager.NationBucket.CacheFromStorage();
     ServerContext.Logger($"Nation Templates Loaded: {GlobalNationTemplateCache.Count}");
 }
Exemple #9
0
 public static void LoadMaps()
 {
     StorageManager.AreaBucket.CacheFromStorage();
     ServerContext.Logger($"Map Templates Loaded: {GlobalMapCache.Count}");
 }
Exemple #10
0
 public static void LoadWorldMapTemplates()
 {
     StorageManager.WorldMapBucket.CacheFromStorage();
     ServerContext.Logger($"World Map Templates Loaded: {GlobalWorldMapTemplateCache.Count}");
 }
Exemple #11
0
 public static void LoadPopupTemplates()
 {
     StorageManager.PopupBucket.CacheFromStorage();
     ServerContext.Logger($"Popup Templates Loaded: {GlobalPopupCache.Count}");
 }
Exemple #12
0
 public static void LoadServerTemplates()
 {
     StorageManager.ServerArgBucket.CacheFromStorage();
     ServerContext.Logger($"Server Templates Loaded: {GlobalServerVarCache.Count}");
 }
Exemple #13
0
 public static void LoadMundaneTemplates()
 {
     StorageManager.MundaneBucket.CacheFromStorage();
     ServerContext.Logger($"Mundane Templates Loaded: {GlobalMundaneTemplateCache.Count}");
 }
Exemple #14
0
 public static void LoadItemTemplates()
 {
     StorageManager.ItemBucket.CacheFromStorage();
     ServerContext.Logger($"Item Templates Loaded: {GlobalItemTemplateCache.Count}");
 }
Exemple #15
0
 public static void LoadSpellTemplates()
 {
     StorageManager.SpellBucket.CacheFromStorage();
     ServerContext.Logger($"Spell Templates Loaded: {GlobalSpellTemplateCache.Count}");
 }
Exemple #16
0
        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);
        }