Пример #1
0
#pragma warning disable CS1998 // Async method lacks 'await' operators and will run synchronously
        public async Task <IViewComponentResult> InvokeAsync(Constants.Races RaceConstraint)
#pragma warning restore CS1998 // Async method lacks 'await' operators and will run synchronously
        {
            var viewModel = _mapper.Map <ICharacter, CharacterVM>(CharacterService.CreateRandomCharacter(RaceConstraint));

            return(View("~/Views/Character/Components/_Overview.cshtml", viewModel));
        }
Пример #2
0
        public ICharacter CreateRandomCharacter(Constants.Races RaceConstraint)
        {
            //Feedback.Log(_context.Characters.ToList().Count.ToString());
            ICharacter newchar = new Character_Base(RandomStatArray(), new bool[18]);
            ICharacter charwithrace;

            if (RaceConstraint != Constants.Races.None)
            {
                charwithrace = RaceService.AddRace(newchar, RaceConstraint);
            }
            else
            {
                charwithrace = RaceService.AddRace(newchar, Constants.Races.Random);
            }

            ICharacter charwithbackground = BackgroundService.AddBackground(charwithrace, Constants.Backgrounds.Random);

            ICharacter charwithclass = ClassService.AddClass(charwithbackground, 1, Constants.Classes.Random);

            FlatteningService.SaveAndFlatten(charwithclass);

            return(charwithclass);
        }
Пример #3
0
 public IActionResult GetRandomCharacter(Constants.Races RaceConstraint)
 {
     return(ViewComponent("RandomCharacter", RaceConstraint));
 }