Exemplo n.º 1
0
 public LotServerGlobalLink(LotServerConfiguration config, IDAFactory da, LotContext context, ILotHost host)
 {
     DAFactory = da;
     Host      = host;
     Context   = context;
     Config    = config;
 }
Exemplo n.º 2
0
        public CityConnections(LotServerConfiguration config, IKernel kernel)
        {
            Config = config;
            try
            {
                CpuCounter = new PerformanceCounter();
                CpuCounter.CategoryName = "Processor";
                CpuCounter.CounterName  = "% Processor Time";
                CpuCounter.InstanceName = "_Total";

                if (PerformanceCounterCategory.Exists("Processor"))
                {
                    var firstValue = CpuCounter.NextValue();
                }
            } catch
            {
                LOG.Info("Performance counters are not supported on this platform, running without.");
            }

            Connections = new Dictionary <LotServerConfigurationCity, CityConnection>();
            foreach (var city in config.Cities)
            {
                var connection = new CityConnection(kernel, city, config);
                Connections.Add(city, connection);
                connection.OnDisconnected += Connection_OnDisconnected;
            }
        }
Exemplo n.º 3
0
 public LotServerGlobalLink(LotServerConfiguration config, IDAFactory da, LotContext context, ILotHost host, CityConnections city)
 {
     DAFactory = da;
     Host      = host;
     Context   = context;
     Config    = config;
     City      = city;
 }
Exemplo n.º 4
0
 public CityConnection(IKernel kernel, LotServerConfigurationCity config, LotServerConfiguration lotServerConfig)
 {
     LotServerConfig = lotServerConfig;
     CityConfig      = config;
     Client          = new AriesClient(kernel);
     Client.AddSubscriber(this);
     _Router = kernel.Get <IAriesPacketRouter>();
 }
Exemplo n.º 5
0
        public LotHostEntry(LotHost host, IKernel kernel, IDAFactory da, LotServerConfiguration config)
        {
            Host         = host;
            DAFactory    = da;
            Config       = config;
            ParentKernel = kernel;

            Model = new FSO.Common.DataService.Model.Lot();
        }
Exemplo n.º 6
0
        public LotHost(LotServerConfiguration config, IDAFactory da, IKernel kernel, IDataServiceSyncFactory ds, CityConnections connections)
        {
            Config          = config;
            DAFactory       = da;
            Kernel          = kernel;
            CityConnections = connections;

            LotStatusSync  = ds.Get <FSO.Common.DataService.Model.Lot>("Lot_NumOccupants", "Lot_IsOnline", "Lot_SpotLightText");
            LotRoomiesSync = ds.Get <FSO.Common.DataService.Model.Lot>("Lot_RoommateVec");
        }
Exemplo n.º 7
0
        public LotContainer(IDAFactory da, LotContext context, ILotHost host, IKernel kernel, LotServerConfiguration config, IRealestateDomain realestate)
        {
            VM.UseWorld = false;
            DAFactory   = da;
            Host        = host;
            Context     = context;
            Kernel      = kernel;
            Config      = config;

            JobLot = (context.Id & 0x40000000) > 0;
            if (JobLot)
            {
                var jobPacked = Context.DbId - 0x200;
                var jobLevel  = (short)((jobPacked - 1) & 0xF);
                var jobType   = (short)((jobPacked - 1) / 0xF);
                LotPersist = new DbLot
                {
                    lot_id     = Context.DbId,
                    location   = Context.Id,
                    category   = LotCategory.money,
                    name       = "{job:" + jobType + ":" + jobLevel + "}",
                    admit_mode = 4
                };
                LotAdj       = new List <DbLot>();
                LotRoommates = new List <DbRoommate>();
                Terrain      = new VMTSOSurroundingTerrain();

                for (int y = 0; y < 3; y++)
                {
                    for (int x = 0; x < 3; x++)
                    {
                        Terrain.Roads[x, y] = 0xF; //crossroads everywhere
                    }
                }
            }
            else
            {
                using (var db = DAFactory.Get())
                {
                    LotPersist   = db.Lots.Get(context.DbId);
                    LotAdj       = db.Lots.GetAdjToLocation(context.ShardId, LotPersist.location);
                    LotRoommates = db.Roommates.GetLotRoommates(context.DbId);
                }
                Realestate = realestate.GetByShard(LotPersist.shard_id);
                GenerateTerrain();
            }
        }
Exemplo n.º 8
0
        public CityConnections(LotServerConfiguration config, IKernel kernel)
        {
            Config     = config;
            CpuCounter = new PerformanceCounter();
            CpuCounter.CategoryName = "Processor";
            CpuCounter.CounterName  = "% Processor Time";
            CpuCounter.InstanceName = "_Total";

            if (PerformanceCounterCategory.Exists("Processor"))
            {
                var firstValue = CpuCounter.NextValue();
            }

            Connections = new Dictionary <LotServerConfigurationCity, CityConnection>();
            foreach (var city in config.Cities)
            {
                var connection = new CityConnection(kernel, city, config);
                Connections.Add(city, connection);
                connection.OnDisconnected += Connection_OnDisconnected;
            }
        }