diff --git a/DagoniteEmpire/Pages/Components/BattleStatsComponent.razor b/DagoniteEmpire/Pages/Components/BattleStatsComponent.razor index 07ecceb..7a72ee4 100644 --- a/DagoniteEmpire/Pages/Components/BattleStatsComponent.razor +++ b/DagoniteEmpire/Pages/Components/BattleStatsComponent.razor @@ -186,7 +186,7 @@ } - @if (Armor is not null && ArmorBattleProperties is not null) + @if (Armor is not null && ArmorBattleProperties is not null && AllParams?.SpecialSkills is not null) {
@@ -208,7 +208,7 @@
- @ArmorBattleProperties.FirstOrDefault(p => p.Name == SD.WeaponQuality.ArmorDefenceBonus).GearBonus + @ArmorDefenceBonus
@@ -218,7 +218,7 @@
- @ArmorBattleProperties.FirstOrDefault(p => p.Name == SD.WeaponQuality.Armor).GearBonus + @ArmorValue
@@ -226,7 +226,7 @@
- @ArmorBattleProperties.FirstOrDefault(p => p.Name == SD.WeaponQuality.ArmorPenalty).GearBonus + @ArmorPenalty
@@ -342,9 +342,13 @@ public Dictionary EquipItemComp { get; set; } = new Dictionary(); public Dictionary?> WeaponBattleProperties { get; set; } = new Dictionary?>(); public Dictionary Weapons { get; set; } = new Dictionary(); - public EquipmentDTO? Armor { get; set; } - public IEnumerable? ArmorBattleProperties { get; set; } - + public EquipmentDTO? Armor { get; set; } + public IEnumerable? ArmorBattleProperties { get; set; } = null; + public int ArmorDefenceBonus { get; set; } = 0; + public int ArmorValue { get; set; } = 0; + public int ArmorPenalty {get;set;} = 0; + public int a; + protected override async Task OnInitializedAsync() { for (EquippedItems i = EquippedItems.WeaponMain1; i <= EquippedItems.WeaponOff2; i++) @@ -377,7 +381,38 @@ { Armor = AllParams.EquipmentSlots?.FirstOrDefault(s => s.SlotType == SD.SlotType.Body)?.Equipment; if (Armor is not null) + { + ArmorBattleProperties = AllParams.BattleProperties.GetWeaponQualityListFromItem(Armor); + BattlePropertyDTO? prop = ArmorBattleProperties?.FirstOrDefault(p => p.Name == SD.WeaponQuality.ArmorDefenceBonus); + if(prop is null) + { + ArmorDefenceBonus = 0; + } + else + { + ArmorDefenceBonus = prop.GearBonus; + } + var arm = ArmorBattleProperties?.FirstOrDefault(p => p.Name == SD.WeaponQuality.Armor); + if (prop is null) + { + ArmorValue = 0; + } + else + { + ArmorValue = prop.GearBonus; + } + var def = ArmorBattleProperties?.FirstOrDefault(p => p.Name == SD.WeaponQuality.ArmorPenalty); + if (prop is null) + { + ArmorPenalty = 0; + } + else + { + ArmorPenalty = prop.GearBonus; + } + + } else ArmorBattleProperties = null; } diff --git a/DagoniteEmpire/Pages/Components/TraitsComponent.razor b/DagoniteEmpire/Pages/Components/TraitsComponent.razor index cdf6c77..b9f83c4 100644 --- a/DagoniteEmpire/Pages/Components/TraitsComponent.razor +++ b/DagoniteEmpire/Pages/Components/TraitsComponent.razor @@ -149,17 +149,17 @@ private async Task AddWeaponQualities() { NewTrait = CreateNewTrait(); - var weaponPropertyTrait = Traits.FirstOrDefault(t => t.Name == SD.WeaponParametersDescr); - bool editMode = false; - if (weaponPropertyTrait is not null) - { - editMode = true; - NewTrait = new TraitEquipmentDTO(weaponPropertyTrait,null); - } - else - { + // var weaponPropertyTrait = Traits.FirstOrDefault(t => t.Name == SD.WeaponParametersDescr); + // bool editMode = false; + // if (weaponPropertyTrait is not null) + // { + // editMode = true; + // NewTrait = new TraitEquipmentDTO(weaponPropertyTrait,null); + // } + // else + // { NewTrait = new TraitEquipmentDTO(); - } + //} var parameters = new DialogParameters { { x => x.NewTrait, NewTrait }, { x => x.IsWeaponQualityMode, true }, { x => x.AllParams, AllParams } }; @@ -170,14 +170,14 @@ if (!result.Canceled) { NewTrait = (TraitDTO)result.Data; - if (editMode) - { - weaponPropertyTrait = NewTrait; - } - else - { + // if (editMode) + // { + // weaponPropertyTrait = NewTrait; + // } + // else + // { Traits.Add(NewTrait); - } + // } await UpdateTraits(); } } diff --git a/DagoniteEmpire/Pages/Dialogs/CreateEquipmentSlotDialog.razor b/DagoniteEmpire/Pages/Dialogs/CreateEquipmentSlotDialog.razor index a0a48d8..304d1f9 100644 --- a/DagoniteEmpire/Pages/Dialogs/CreateEquipmentSlotDialog.razor +++ b/DagoniteEmpire/Pages/Dialogs/CreateEquipmentSlotDialog.razor @@ -1,6 +1,7 @@  @using System.Globalization; @using System.Text; +@using DA_Models @inject ISnackbar Snackbar @inject IUserService _userService @inject ISpecialSkillRepository _specialSkillRepository @@ -294,8 +295,19 @@ Traits = NewSlot.Equipment.Traits.Cast().ToList(); } userInfo = await _userService.GetUserInfo(); - MeleeSkills = await (_specialSkillRepository.GetAllFromGroup(userInfo.SelectedCharacter.Id , SD.BaseSkills.Melee)); - ShootingSkills = await (_specialSkillRepository.GetAllFromGroup(userInfo.SelectedCharacter.Id, SD.BaseSkills.Shooting)); + + + if(userInfo?.SelectedCharacter is not null && userInfo.SelectedCharacter.Id != 0) + { + + MeleeSkills = await (_specialSkillRepository.GetAllFromGroup(userInfo.SelectedCharacter.Id , SD.BaseSkills.Melee)); + ShootingSkills = await (_specialSkillRepository.GetAllFromGroup(userInfo.SelectedCharacter.Id, SD.BaseSkills.Shooting)); + } + else + { + MeleeSkills = CharacterSeeder.GetSpecialSkills().Where(u => u.RelatedBaseSkillName == SD.BaseSkills.Melee); + ShootingSkills = CharacterSeeder.GetSpecialSkills().Where(u => u.RelatedBaseSkillName == SD.BaseSkills.Shooting); + } HeaderName = IsEditMode ? "Edit" : "Add"; HeaderName += " item"; if (NewSlot.Equipment is not null && NewSlot.Equipment.IsApproved) diff --git a/DagoniteEmpire/wwwroot/upload/portraits/35e3cecf-fd45-47ae-9e72-d1f3163fb634.webp b/DagoniteEmpire/wwwroot/upload/portraits/35e3cecf-fd45-47ae-9e72-d1f3163fb634.webp new file mode 100644 index 0000000..6e41a52 Binary files /dev/null and b/DagoniteEmpire/wwwroot/upload/portraits/35e3cecf-fd45-47ae-9e72-d1f3163fb634.webp differ