Exemplo n.º 1
0
        //public List<Player> GuildMembersOf(string guild)
        //{
        //    return (from i in Worlds where i.Key != 0 from e in i.Value.Players where String.Equals(e.Value.Guild, guild, StringComparison.CurrentCultureIgnoreCase) select e.Value).ToList();
        //}

        public void Initialize()
        {
            log.Info("Initializing Realm Manager...");

            GameData  = new XmlData();
            Behaviors = new BehaviorDb(this);
            GeneratorCache.Init();
            MerchantLists.InitMerchatLists(GameData);

            AddWorld(World.NEXUS_ID, Worlds[0] = new Nexus());
            AddWorld(World.MARKET, new ClothBazaar());
            AddWorld(World.TEST_ID, new Test());
            AddWorld(World.TUT_ID, new Tutorial(true));
            AddWorld(World.DAILY_QUEST_ID, new DailyQuestRoom());
            Monitor = new RealmPortalMonitor(this);

            Task.Factory.StartNew(() => GameWorld.AutoName(1, true)).ContinueWith(_ => AddWorld(_.Result), TaskScheduler.Default);

            Chat     = new ChatManager(this);
            Commands = new CommandManager(this);

            log.Info("Realm Manager initialized.");
        }
Exemplo n.º 2
0
        protected Entity(short objType, bool interactive)
        {
            this.interactive = interactive;
            this.ObjectType  = objType;
            Name             = "";
            Size             = 100;
            Usable           = false;
            BagDropped       = false;
            isPet            = false;
            XmlDatas.ObjectDescs.TryGetValue(objType, out desc);
            BehaviorDb.ResolveBehavior(this);

            if (interactive)
            {
                posHistory  = new Position[256];
                projectiles = new Projectile[256];
                effects     = new int[EFFECT_COUNT];
            }
            if (objType == 0x072f)
            {
                Usable = true;
            }
        }
Exemplo n.º 3
0
        protected Entity(RealmManager manager, short objType, bool interactive, bool isPet)
        {
            Manager    = manager;
            ObjectType = objType;
            Name       = "";
            Usable     = false;
            BagDropped = false;
            IsPet      = isPet;
            XmlDatas.ObjectDescs.TryGetValue(objType, out desc);
            BehaviorDb.ResolveBehavior(this);
            Size = desc != null ? XmlDatas.ObjectDescs[objType].MaxSize : 100;

            if (interactive)
            {
                posHistory  = new Position[256];
                projectiles = new Projectile[256];
                effects     = new int[EFFECT_COUNT];
            }
            if (objType == 0x072f)
            {
                Usable = true;
            }

            if (ObjectDesc != null)
            {
                Tags = ObjectDesc.Tags;
            }

            if (objType == 0x0d60)
            {
                ApplyConditionEffect(new ConditionEffect
                {
                    Effect     = ConditionEffectIndex.Invincible,
                    DurationMS = -1
                });
            }
        }
Exemplo n.º 4
0
 public void Initialize()
 {
     if (CheckConfig.IsDebugOn())
     {
         Console.WriteLine("Initializing Realm Manager...");
     }
     GameData  = new XmlData();
     Behaviors = new BehaviorDb(this);
     GeneratorCache.Init();
     MerchantLists.InitMerchatLists(GameData);
     AddWorld(World.NEXUS_ID, Worlds[0] = new Nexus());
     AddWorld(World.MARKET, new ClothBazaar());
     AddWorld(World.TUT_ID, new Tutorial(true));
     AddWorld(World.FMARKET, new Market());
     Monitor = new RealmPortalMonitor(this);
     Task.Factory.StartNew(() => GameWorld.AutoName(1, true))
     .ContinueWith(_ => AddWorld(_.Result), TaskScheduler.Default);
     Chat     = new ChatManager(this);
     Commands = new CommandManager(this);
     if (CheckConfig.IsDebugOn())
     {
         Console.WriteLine("Realm Manager initialized.");
     }
 }
Exemplo n.º 5
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;
        }