public bool Initialize(Address address, string baseKey)
        {
            _logger.LogCoreInfo("Loading Config.");
            Config = new Config("Settings/GameInfo.json");

            _server = new Host();
            _server.Create(address, 32, 32, 0, 0);

            var key = System.Convert.FromBase64String(baseKey);

            if (key.Length <= 0)
            {
                return(false);
            }

            Blowfish             = new BlowFish(key);
            PacketHandlerManager = new PacketHandlerManager(_logger, Blowfish, _server, _playerManager);
            Map            = new SummonersRift(this);
            PacketNotifier = new PacketNotifier(this, _playerManager, _networkIdManager);
            ApiFunctionManager.SetGame(this);
            IsRunning = false;

            foreach (var p in Config.Players)
            {
                _playerManager.AddPlayer(p);
            }
            return(true);
        }
Example #2
0
        public void RegisterMap(byte mapId)
        {
            var mapName = Config.ContentManager.GameModeName + "-Map" + mapId;
            var dic     = new Dictionary <string, Type>
            {
                { "LeagueSandbox-Default-Map1", typeof(SummonersRift) },
                // { "LeagueSandbox-Default-Map8", typeof(CrystalScar) },
                { "LeagueSandbox-Default-Map10", typeof(TwistedTreeline) },
                // { "LeagueSandbox-Default-Map11", typeof(NewSummonersRift) },
                { "LeagueSandbox-Default-Map12", typeof(HowlingAbyss) },
            };

            if (!dic.ContainsKey(mapName))
            {
                Map = new SummonersRift(this);
                return;
            }

            Map = (Map)Activator.CreateInstance(dic[mapName], this);
        }