示例#1
0
        public RealmManager(Resources resources, Database db, ServerConfig config)
        {
            Log.Info("Initalizing Realm Manager...");

            Resources  = resources;
            Database   = db;
            Config     = config;
            TPS        = config.serverSettings.tps;
            InstanceId = config.serverInfo.instanceId;

            // all these deal with db pub/sub... probably should put more thought into their structure...
            InterServer        = new ISManager(Database, config);
            ISControl          = new ISControl(this);
            Chat               = new ChatManager(this);
            DbServerController = new DbServerManager(this); // probably could integrate this with ChatManager and rename...
            DbEvents           = new DbEvents(this);

            // basic server necessities
            ConMan = new ConnectManager(this,
                                        config.serverSettings.maxPlayers,
                                        config.serverSettings.maxPlayersWithPriority);
            Behaviors = new BehaviorDb(this);
            Commands  = new CommandManager(this);

            // some necessities that shouldn't be (will work this out later)
            MerchantLists.Init(this);

            InitializeNexusHub();
            AddWorld("Realm");

            // add portal monitor to nexus and initialize worlds
            if (Worlds.ContainsKey(World.Nexus))
            {
                Monitor = new PortalMonitor(this, Worlds[World.Nexus]);
            }
            foreach (var world in Worlds.Values)
            {
                OnWorldAdded(world);
            }

            _initialized = true;

            Log.Info("Realm Manager initialized.");
        }
示例#2
0
        public RealmManager(Resources resources, Database db, ServerConfig config)
        {
            InstanceId = Guid.NewGuid().ToString();
            Database   = db;
            Resources  = resources;
            Config     = config;
            Config.serverInfo.instanceId = InstanceId;
            TPS = config.serverSettings.tps;

            // all these deal with db pub/sub... probably should put more thought into their structure...
            InterServer        = new ISManager(Database, config);
            ISControl          = new ISControl(this);
            Chat               = new ChatManager(this);
            DbServerController = new DbServerManager(this); // probably could integrate this with ChatManager and rename...
            DbEvents           = new DbEvents(this);

            // basic server necessities
            ConMan = new ConnectManager(this,
                                        config.serverSettings.maxPlayers,
                                        config.serverSettings.maxPlayersWithPriority);
            Behaviors = new BehaviorDb(this);
            Commands  = new CommandManager(this);

            // some necessities that shouldn't be (will work this out later)
            MerchantLists.Init(this);
            Tinker = new DbTinker(db.Conn);
            if (Config.serverSettings.enableMarket)
            {
                Market = new Market(this);
            }

            var serverMode = config.serverSettings.mode;

            switch (serverMode)
            {
            case ServerMode.Single:
                InitializeNexusHub();
                AddWorld("Realm");
                break;

            case ServerMode.Nexus:
                InitializeNexusHub();
                break;

            case ServerMode.Realm:
                AddWorld("Realm");
                break;

            case ServerMode.Marketplace:
                AddWorld("Marketplace", true);
                AddWorld("Vault");
                AddWorld("ClothBazaar");
                break;
            }

            // add portal monitor to nexus and initialize worlds
            if (Worlds.ContainsKey(World.Nexus))
            {
                Monitor = new PortalMonitor(this, Worlds[World.Nexus]);
            }
            foreach (var world in Worlds.Values)
            {
                OnWorldAdded(world);
            }

            _initialized = true;
        }