Exemplo n.º 1
0
        public UserMothershipDataModel CreateMother(IDbConnection connection, int userId, int startSystem = 1)
        {
            var r         = StorageResources.InitMotherResources();
            var curMother = GetMother(connection, userId, false);

            if (curMother != null)
            {
                return(curMother);
            }

            var teches = new BattleTeches();

            teches.CreateStartTeches();
            var userTeches = teches.ConvertToDbTeches();

            var newMother = new UserMothershipDataModel
            {
                Id                  = userId,
                StartSystemId       = startSystem,
                Resources           = r,
                Hangar              = UnitList.InitUnitsInOwn(),
                ExtractionProportin = MaterialResource.InitBaseOwnProportion(),
                UnitProgress        = new Dictionary <UnitType, TurnedUnit>(),
                TechProgress        = userTeches
            };

            return(AddOrUpdate(connection, newMother));
        }
Exemplo n.º 2
0
        public void ResetMotherResourceById(IDbConnection connection, int userId)
        {
            var res    = StorageResources.InitMotherResources();
            var mother = _mothershipService.GetMother(connection, userId);

            mother.Resources = res;
            _mothershipService.AddOrUpdate(connection, mother);
        }
Exemplo n.º 3
0
        public void ResetAllMotherResources(IDbConnection connection)
        {
            var res     = StorageResources.InitMotherResources();
            var mothers = _mothershipService.GetAllMothers(connection);

            foreach (var mother in mothers)
            {
                mother.Resources = res;
            }
            _mothershipService.AddOrUpdate(connection, mothers);
        }