Esempio n. 1
0
        private bool IsMoonOpening(IBosServiceCollection services)
        {
            IPlanetService planets    = services.PlanetService;
            var            moonPlanet = planets.GetPlanet(PlanetConst.MOON_ID);

            return(moonPlanet.State == PlanetState.Opening ||
                   moonPlanet.State == PlanetState.ReadyToOpen);
        }
Esempio n. 2
0
        /*
         * public ProfitResult CalculateProfitPerSecond(GeneratorInfo generator, int countOfOwnedGenerators, bool forceUpdateMults = false) {
         *  double perRound = Generators.GetCurrentValueForProfit(generator, countOfOwnedGenerators, forceUpdateMults);
         *  double generationInterval = generator.Time(Generators); //Generators.GetCurrentValueForTime(generator);
         *  double perSecond = perRound / generationInterval;
         *  return new ProfitResult(perRound, perSecond, generationInterval);
         * }
         *
         * public double CalculateTotalProfitOnInterval(float seconds ) {
         *  double value = 0.0;
         *  foreach(var generator in Generators.Generators) {
         *      if(generator.Value.IsAutomatic) {
         *          if(generator.Value.State == GeneratorState.Active) {
         *              var profit = CalculateProfitPerSecond(generator.Value, Services.TransportService.GetUnitLiveCount(generator.Key));
         *              value += profit.ValuePerSecond * seconds;
         *          }
         *      }
         *  }
         *  return value;
         * }*/


        public double CalculateProfit20Minute(int generatorId, int count, int planetId)
        {
            var    generator          = GetGetenerator(generatorId);
            var    planetInfo         = PlanetService.GetPlanet(planetId);
            double perRound           = generator.Data.BaseGeneration * count * planetInfo.Data.ProfitMultiplier * Math.Pow(generator.Data.ProfitIncrementFactor, count);
            double generationInterval = generator.Data.TimeToGenerate;
            double perSecond          = perRound / generationInterval;
            double intervalProfit     = perSecond * 1200;

            return(intervalProfit);
        }
Esempio n. 3
0
 public async Task <PlanetDto> GetPlanet(int id)
 {
     try
     {
         return(await _planetService.GetPlanet(id));
     }
     catch (Exception e)
     {
         log.Info(e.Message);
         return(new PlanetDto()
         {
             Message = e.Message
         });
     }
 }
        private async Task <string> GetPlanetName(string planetUrl)
        {
            var swapiPlanet = await planetService.GetPlanet(planetUrl);

            return(swapiPlanet.name);
        }