Esempio n. 1
0
        public void Bootstrap(LotContext context)
        {
            Context    = context;
            Model.Id   = context.Id;
            Model.DbId = context.DbId;

            LOG.Info("Bootstrapping lot with dbid = " + context.DbId + "...");

            //Each lot gets its own set of bindings
            Kernel = new ChildKernel(
                ParentKernel
                );

            Kernel.Bind <LotContext>().ToConstant(context);
            Kernel.Bind <ILotHost>().ToConstant(this);

            Container = Kernel.Get <LotContainer>();

            BackgroundThread = new Thread(_DigestBackground)
            {
                Name = "Lot " + Context.DbId + " (background)"
            };
            BackgroundThread.Start();

            MainThread = new Thread(Container.Run)
            {
                Name = "Lot " + Context.DbId + " (main)"
            };
            MainThread.Start();
        }
Esempio n. 2
0
 public LotServerGlobalLink(LotServerConfiguration config, IDAFactory da, LotContext context, ILotHost host)
 {
     DAFactory = da;
     Host      = host;
     Context   = context;
     Config    = config;
 }
Esempio 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;
 }
Esempio n. 4
0
        public void SyncRoommates(LotContext context, FSO.Common.DataService.Model.Lot lot)
        {
            var city = CityConnections.GetByShardId(context.ShardId);

            if (city != null)
            {
                LotRoomiesSync.Sync(city, lot);
            }
        }
Esempio n. 5
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();
            }
        }