From 2ed11936e709a828ee33915880075b0995a0643a Mon Sep 17 00:00:00 2001 From: krystian kempski Date: Wed, 20 Nov 2024 20:59:00 +0100 Subject: [PATCH] fix: Armor adding problems #43 --- .../Components/BattleStatsComponent.razor | 49 +++++++++++++++--- .../Pages/Components/TraitsComponent.razor | 34 ++++++------ .../Dialogs/CreateEquipmentSlotDialog.razor | 16 +++++- .../35e3cecf-fd45-47ae-9e72-d1f3163fb634.webp | Bin 0 -> 7770 bytes 4 files changed, 73 insertions(+), 26 deletions(-) create mode 100644 DagoniteEmpire/wwwroot/upload/portraits/35e3cecf-fd45-47ae-9e72-d1f3163fb634.webp 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 0000000000000000000000000000000000000000..6e41a5274abca5e15e46c668c1a0d71eaf58a1d9 GIT binary patch literal 7770 zcmV-g9;M+@Nk&Fe9smGWMM6+kP&gn)9smFk!vLKDDq{id0X~sLo=YX8qamY`>Y%U^ z32AQOa(-PItUhLPhiH8s`4{_N4g9`*d)=O8`_}Y7?O*b}2mia|ZvgLSf4bt=0KI8u zXUxn0A0xQ|bd8lFM#_;RWk`{-q)6FPBy6b?HdKi8k(@RltIqnDVeVwE(pdq4p~HaP z(vt8+Gv()o*4)-`yl?Kp69CElzStd0R1uoI+$0xCZiacpE?=R1ZL_x1{H$X-tKxNE z4Yo}RU=0Oh?nSTa2?@V;>tN}U!?)}(9K@=Xc1gQ^EP(_!Tv%&FGU2CqgEDoBt=Gec zyrAWOmoJps$~@U9WEDIDhnaZCGjwxiwe~Pe9-iiFbcc^BW6`=%??vQPzl5-j(p%9t z|41)5aw*l(0+GDM`1PPqIOCPwHT}$&EzEl%FoBZjr=@2Z@WO3Zy#a4&MHq@~sS^4e z8K|b^>3BrMQ)MoH@H7&CdVMrZER-F-bESSgxDDS$DkYC*CP^friah(ipG^}BCW(Zs zTs`BYRzgg~(e&wBbLeA1UmyAmZYaX7@~BDwS-8JlP>O7+5;jza@$)Cs6BPXu>+gMH zhWa#V1e`)|3fOL@9v(UwQ<839Os3q_xIIdKegh6sol0qSHcQiXiU}B_ICEl$q;u!tF8x)6id9aV$IV zr>Ni~5@;Cp+L0Syj*%kd=bv#N87x8amm@=A49~4x+GO#^RP|(GDRB!{h;$Wst@DYQ z6dUH9Wn#P8rAgpRWT2-z-Q;cc$yekY775$#ewS{{3O_-lz|5DX? zx$k;zI;Xe?9!U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