public async Task <bool> PerformSave(IPhysicalAppearanceModal phyAppModal) { var physicalAppreance = new PhysicalAppearance { BodyType = phyAppModal.BodyType, Chest = phyAppModal.Chest, Ethnicity = phyAppModal.Ethnicity, EyeColor = phyAppModal.EyeColor, HairColor = phyAppModal.HairColor, HairLength = phyAppModal.HairLength, HairType = phyAppModal.HairType, Height = phyAppModal.Height, IsActive = true, IsDeleted = false, SkinColor = phyAppModal.SkinColor, UserId = phyAppModal.UserId, Weight = phyAppModal.Weight, West = phyAppModal.West }; return(await this._physicalAppearanceRepository.PerformSaveOperation(physicalAppreance)); }
private GetBonusDto GetBonusDto() { var dto = new GetBonusDto { Character = this, Round = Round, Abilities = Abilities, ActiveBonus = new List <BonusRef>(), PassiveBonus = new List <BonusRef>(), EquippedItems = GetEquippedItems(), AllItems = Inventory.BagItems, Classes = CurrentClasses, Feats = new List <SpecialAbility>(Feats), }; //Conditions Round.EnrichActiveBonusDto(dto); //Feats dto.Feats.AddRange(Race.RacialAbilities); dto.Feats.AddRange( Inventory.BagItems.Where(x => x.IsEquipped.GetValueOrDefault()) .Select(x => x.Item.EnchanmentAbilities) .SelectMany(x => x)); dto.Feats.AddRange( Inventory.BagItems.Where(x => x.IsEquipped.GetValueOrDefault()) .Select(x => x.EnchanmentAbilities ?? new List <SpecialAbility>()) .SelectMany(x => x)); foreach (var currentClass in CurrentClasses) { var currentClassAbis = currentClass.GetAbilitiesAtCurrentLevel(); dto.Feats.AddRange(currentClassAbis); } //dto.Feats.AddRange(CurrentClasses.Select(x => x.GetAbilitiesAtCurrentLevel()).SelectMany( x=> x)); //Passive bonuses Race.EnrichPassiveBonusDto(dto); PhysicalAppearance.EnrichPassiveBonusDto(dto); foreach (var specialAbility in dto.Feats) { specialAbility.EnrichPassiveBonusDto(dto); } var itemEquiped = Inventory.BagItems.Where(x => x.IsEquipped.GetValueOrDefault()); foreach (var ownedItem in itemEquiped) { foreach (var bonuse in ownedItem.Item.EnchanmentsBonuses) { dto.PassiveBonus.Add(new BonusRef(ownedItem.Item, bonuse)); } if (ownedItem.EnchanmentsBonuses != null) { foreach (var bonuse in ownedItem.EnchanmentsBonuses) { dto.PassiveBonus.Add(new BonusRef(new ElementId { Name = Name + "'s " + ownedItem.Item.Name }, bonuse)); } } } //dto.PassiveBonus.AddRange(Inventory.BagItems.Where(x => x.IsEquipped.GetValueOrDefault()).Select(x=> x.Item.EnchanmentsBonuses).SelectMany(x => x)); //Active bonuses Race.EnrichActiveBonusDto(dto); foreach (var specialAbility in dto.Feats) { specialAbility.EnrichActiveBonusDto(dto); } //Replaying actions foreach (var specialAbility in dto.Feats) { specialAbility.SetChildReferences(); } dto.Feats = dto.Feats.DistinctBy(x => x.ID).ToList(); return(dto); }