Example #1
0
        public CraftTable(IBuffCollector buffCollector, IConditionService conditionService, IRandomService randomService, ICalculator calculator, ILookupService lookupService, ICraftQualityCalculator craftQualityCalculator,
                          Recipe recipe, CraftMan craftMan, IProgressWatcher progressWatcher = null)
        {
            if (recipe == null)
            {
                throw new ArgumentNullException(nameof(recipe));
            }
            if (craftMan == null)
            {
                throw new ArgumentNullException(nameof(craftMan));
            }
            if (buffCollector == null)
            {
                throw new ArgumentNullException(nameof(buffCollector));
            }
            if (conditionService == null)
            {
                throw new ArgumentNullException(nameof(conditionService));
            }
            if (randomService == null)
            {
                throw new ArgumentNullException(nameof(randomService));
            }
            if (calculator == null)
            {
                throw new ArgumentNullException(nameof(calculator));
            }
            if (lookupService == null)
            {
                throw new ArgumentNullException(nameof(lookupService));
            }
            if (craftQualityCalculator == null)
            {
                throw new ArgumentNullException(nameof(craftQualityCalculator));
            }

            _progressWatcher = progressWatcher ?? new DefaultProgressWatcher();

            _buffCollector          = buffCollector;
            _conditionService       = conditionService;
            _craftMan               = craftMan;
            _progressWatcher        = progressWatcher ?? new DefaultProgressWatcher();
            _randomService          = randomService;
            _calculator             = calculator;
            _lookupService          = lookupService;
            _craftQualityCalculator = craftQualityCalculator;
            _recipe          = recipe;
            _craftPointsLeft = craftMan.MaxCraftPoints;
            _durability      = recipe.Durability;
            _condition       = _conditionService.GetCondition(null);
            _quality         = recipe.StartQuality;
        }
Example #2
0
        public static CraftTable CreateCraftTable(Recipe recipe, CraftMan craftMan, IProgressWatcher watcher = null)
        {
            var efficiencyCalculator = new EfficiencyCalculator();
            var lookupService        = new LookupService();
            var calculator           = new Calculator(efficiencyCalculator, lookupService);
            var buffCollector        = new BuffCollector();
            var randomService        = new RandomService();
            var condition            = new ConditionService(randomService, calculator);


            var craftQualityCalculator = new CraftQualityCalculator();

            return(new CraftTable(buffCollector, condition, randomService, calculator, lookupService, craftQualityCalculator, recipe, craftMan, watcher));
        }