Esempio n. 1
0
 public Bot(IOutput output, MonsterFactory monsterFactory,
            HealerFactory healerFactory,
            WeaponDealerFactory weaponDealerFactory,
            ClothesDealerFactory clothesDealerFactory, PersonageSettings settings) : base(output)
 {
     _monsterFactory       = monsterFactory;
     _healerFactory        = healerFactory;
     _weaponDealerFactory  = weaponDealerFactory;
     _clothesDealerFactory = clothesDealerFactory;
     _settings             = settings;
 }
Esempio n. 2
0
        static void InitialConfig(IConfigurationRoot configuration, ContainerBuilder containerBuilder)
        {
            var gamerSettings = new GamerSettings();

            configuration.GetSection("GamerSettings").Bind(gamerSettings);
            containerBuilder.Register(x => gamerSettings);

            var settings = new PersonageSettings();

            configuration.GetSection("PersonageSettings").Bind(settings);
            containerBuilder.Register(x => settings.AttackSettings);

            if (settings.HealerSettings.MaxHealth > settings.HealerSettings.MinHealth ||
                settings.HealerSettings.MaxHealth > 100)
            {
                settings.HealerSettings.MaxHealth = 10;
                settings.HealerSettings.MinHealth = 1;
            }
            containerBuilder.Register(x => settings.HealerSettings);

            if (settings.ClothesDealerSettings.MaxHealth > settings.ClothesDealerSettings.MinHealth ||
                settings.ClothesDealerSettings.MaxHealth > 100)
            {
                settings.ClothesDealerSettings.MaxHealth = 2;
                settings.ClothesDealerSettings.MinHealth = 1;
            }
            containerBuilder.Register(x => settings.ClothesDealerSettings);

            if (settings.WeaponDealerSettings.MaxPower > settings.WeaponDealerSettings.MinPower)
            {
                settings.WeaponDealerSettings.MaxPower = 2;
                settings.WeaponDealerSettings.MinPower = 1;
            }
            containerBuilder.Register(x => settings.WeaponDealerSettings);

            containerBuilder.Register(x => settings);
        }