From ff905fab958a0b425e2e7e431f41c8b437b83517 Mon Sep 17 00:00:00 2001 From: holychowders Date: Tue, 10 May 2022 10:31:45 -0500 Subject: [PATCH 1/4] Add stealth stat to Bag UI. NOTE: Needs icon. --- assets/voxygen/i18n/en/hud/bag.ron | 1 + voxygen/src/hud/bag.rs | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/assets/voxygen/i18n/en/hud/bag.ron b/assets/voxygen/i18n/en/hud/bag.ron index 697ba38a8f..72a359814d 100644 --- a/assets/voxygen/i18n/en/hud/bag.ron +++ b/assets/voxygen/i18n/en/hud/bag.ron @@ -34,6 +34,7 @@ "hud.bag.combat_rating": "Combat Rating", "hud.bag.protection": "Protection", "hud.bag.stun_res": "Stun Resilience", + "hud.bag.stealth_from_items": "Stealth from Items", "hud.bag.combat_rating_desc": "Calculated from your\nequipment and health.", "hud.bag.protection_desc": "Damage reduction through armor", "hud.bag.stun_res_desc": "Resilience against being stunned by consecutive hits.\nRegenerates like Energy.", diff --git a/voxygen/src/hud/bag.rs b/voxygen/src/hud/bag.rs index cdb925406a..45f34c698f 100644 --- a/voxygen/src/hud/bag.rs +++ b/voxygen/src/hud/bag.rs @@ -18,7 +18,7 @@ use crate::{ use client::Client; use common::{ assets::AssetExt, - combat::{combat_rating, Damage}, + combat::{combat_rating, perception_dist_multiplier_from_stealth, Damage}, comp::{ inventory::InventorySortOrder, item::{ItemDef, ItemDesc, MaterialStatManifest, Quality}, @@ -629,12 +629,13 @@ impl<'a> Bag<'a> { } } } -const STATS: [&str; 5] = [ +const STATS: [&str; 6] = [ "Health", "Energy", "Protection", "Combat Rating", "Stun Resilience", + "Stealth (Items)", ]; pub struct BagState { @@ -924,6 +925,8 @@ impl<'a> Widget for Bag<'a> { "Combat Rating" => self.imgs.combat_rating_ico, "Protection" => self.imgs.protection_ico, "Stun Resilience" => self.imgs.stun_res_ico, + // FIXME: Add icon. + // "Stealth (Items)" => self.imgs.stealth_ico, _ => self.imgs.nothing, }) .w_h(20.0, 20.0) @@ -945,6 +948,11 @@ impl<'a> Widget for Bag<'a> { "{}", (100.0 * Poise::compute_poise_damage_reduction(inventory)) as i32 ); + let stealth_from_items_txt = format!( + "{:.1}%", + ((1.0 - perception_dist_multiplier_from_stealth(Some(inventory), None)) + * 100.0) + ); let btn = if i.0 == 0 { btn.top_left_with_margins_on(state.bg_ids.bg_frame, 55.0, 10.0) } else { @@ -956,6 +964,7 @@ impl<'a> Widget for Bag<'a> { "Combat Rating" => i18n.get("hud.bag.combat_rating"), "Protection" => i18n.get("hud.bag.protection"), "Stun Resilience" => i18n.get("hud.bag.stun_res"), + "Stealth (Items)" => i18n.get("hud.bag.stealth_from_items"), _ => "", }; let tooltip_txt = match i.1 { @@ -978,6 +987,7 @@ impl<'a> Widget for Bag<'a> { "Combat Rating" => &combat_rating_txt, "Protection" => &protection_txt, "Stun Resilience" => &stun_res_txt, + "Stealth (Items)" => &stealth_from_items_txt, _ => "", }) .right_from(state.ids.stat_icons[i.0], 10.0) From 916d1d03f8256aca5381de6ae7cd4573d90c45bd Mon Sep 17 00:00:00 2001 From: holychowders Date: Tue, 10 May 2022 10:37:22 -0500 Subject: [PATCH 2/4] Update changelog. --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9d38c055b2..61586bb5c0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Added Belarusian translation - Add FOV check for agents scanning for targets they are hostile to - Implemented an LoD system for objects, making trees visible far beyond the view distance +- Add stealth stat on Bag UI ### Changed From 63f829be6662719298c2fa1bbda4a0033f220b6e Mon Sep 17 00:00:00 2001 From: holychowders Date: Tue, 10 May 2022 12:30:47 -0500 Subject: [PATCH 3/4] Add icon to stealth stat in Bag UI. - Thanks to Toaster for making the icon. --- assets/voxygen/element/ui/bag/icons/stealth_rating.png | 3 +++ voxygen/src/hud/bag.rs | 3 +-- voxygen/src/hud/img_ids.rs | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) create mode 100644 assets/voxygen/element/ui/bag/icons/stealth_rating.png diff --git a/assets/voxygen/element/ui/bag/icons/stealth_rating.png b/assets/voxygen/element/ui/bag/icons/stealth_rating.png new file mode 100644 index 0000000000..0f875f05f3 --- /dev/null +++ b/assets/voxygen/element/ui/bag/icons/stealth_rating.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4780a6327ecb7f00bffc6cdc036a97bd5394ed5b2a148de3f501e13ea1cd723f +size 185 diff --git a/voxygen/src/hud/bag.rs b/voxygen/src/hud/bag.rs index 45f34c698f..e410ce0f5a 100644 --- a/voxygen/src/hud/bag.rs +++ b/voxygen/src/hud/bag.rs @@ -925,8 +925,7 @@ impl<'a> Widget for Bag<'a> { "Combat Rating" => self.imgs.combat_rating_ico, "Protection" => self.imgs.protection_ico, "Stun Resilience" => self.imgs.stun_res_ico, - // FIXME: Add icon. - // "Stealth (Items)" => self.imgs.stealth_ico, + "Stealth (Items)" => self.imgs.stealth_rating_ico, _ => self.imgs.nothing, }) .w_h(20.0, 20.0) diff --git a/voxygen/src/hud/img_ids.rs b/voxygen/src/hud/img_ids.rs index dbd98ffd59..d346b38682 100644 --- a/voxygen/src/hud/img_ids.rs +++ b/voxygen/src/hud/img_ids.rs @@ -521,6 +521,7 @@ image_ids! { stun_res_ico: "voxygen.element.ui.bag.icons.stun_res", combat_rating_ico: "voxygen.element.ui.bag.icons.combat_rating", combat_rating_ico_shadow: "voxygen.element.ui.bag.icons.combat_rating_shadow", + stealth_rating_ico: "voxygen.element.ui.bag.icons.stealth_rating", not_found: "voxygen.element.not_found", From be0e32221991f4fbb5015d89aae8188237ffff7e Mon Sep 17 00:00:00 2001 From: holychowders Date: Sat, 14 May 2022 09:34:57 -0500 Subject: [PATCH 4/4] Remove "(Items)" from stealth stat descriptions. --- assets/voxygen/i18n/en/hud/bag.ron | 2 +- voxygen/src/hud/bag.rs | 10 +++++----- voxygen/src/hud/diary.rs | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/assets/voxygen/i18n/en/hud/bag.ron b/assets/voxygen/i18n/en/hud/bag.ron index 72a359814d..f164cf409b 100644 --- a/assets/voxygen/i18n/en/hud/bag.ron +++ b/assets/voxygen/i18n/en/hud/bag.ron @@ -34,7 +34,7 @@ "hud.bag.combat_rating": "Combat Rating", "hud.bag.protection": "Protection", "hud.bag.stun_res": "Stun Resilience", - "hud.bag.stealth_from_items": "Stealth from Items", + "hud.bag.stealth": "Stealth", "hud.bag.combat_rating_desc": "Calculated from your\nequipment and health.", "hud.bag.protection_desc": "Damage reduction through armor", "hud.bag.stun_res_desc": "Resilience against being stunned by consecutive hits.\nRegenerates like Energy.", diff --git a/voxygen/src/hud/bag.rs b/voxygen/src/hud/bag.rs index e410ce0f5a..e0d8b43d56 100644 --- a/voxygen/src/hud/bag.rs +++ b/voxygen/src/hud/bag.rs @@ -635,7 +635,7 @@ const STATS: [&str; 6] = [ "Protection", "Combat Rating", "Stun Resilience", - "Stealth (Items)", + "Stealth", ]; pub struct BagState { @@ -925,7 +925,7 @@ impl<'a> Widget for Bag<'a> { "Combat Rating" => self.imgs.combat_rating_ico, "Protection" => self.imgs.protection_ico, "Stun Resilience" => self.imgs.stun_res_ico, - "Stealth (Items)" => self.imgs.stealth_rating_ico, + "Stealth" => self.imgs.stealth_rating_ico, _ => self.imgs.nothing, }) .w_h(20.0, 20.0) @@ -947,7 +947,7 @@ impl<'a> Widget for Bag<'a> { "{}", (100.0 * Poise::compute_poise_damage_reduction(inventory)) as i32 ); - let stealth_from_items_txt = format!( + let stealth_txt = format!( "{:.1}%", ((1.0 - perception_dist_multiplier_from_stealth(Some(inventory), None)) * 100.0) @@ -963,7 +963,7 @@ impl<'a> Widget for Bag<'a> { "Combat Rating" => i18n.get("hud.bag.combat_rating"), "Protection" => i18n.get("hud.bag.protection"), "Stun Resilience" => i18n.get("hud.bag.stun_res"), - "Stealth (Items)" => i18n.get("hud.bag.stealth_from_items"), + "Stealth" => i18n.get("hud.bag.stealth"), _ => "", }; let tooltip_txt = match i.1 { @@ -986,7 +986,7 @@ impl<'a> Widget for Bag<'a> { "Combat Rating" => &combat_rating_txt, "Protection" => &protection_txt, "Stun Resilience" => &stun_res_txt, - "Stealth (Items)" => &stealth_from_items_txt, + "Stealth" => &stealth_txt, _ => "", }) .right_from(state.ids.stat_icons[i.0], 10.0) diff --git a/voxygen/src/hud/diary.rs b/voxygen/src/hud/diary.rs index 0e8ddcee78..1d96fc40c3 100644 --- a/voxygen/src/hud/diary.rs +++ b/voxygen/src/hud/diary.rs @@ -1112,7 +1112,7 @@ impl<'a> Widget for Diary<'a> { "Stun-Resistance", "Crit-Power", "Energy Reward", - "Stealth (Items)", + "Stealth", "Weapon Power", "Weapon Speed", "Weapon Poise", @@ -1206,7 +1206,7 @@ impl<'a> Widget for Diary<'a> { combat::compute_energy_reward_mod(Some(self.inventory)); format!("{:+.0}%", (energy_rew - 1.0) * 100.0) }, - "Stealth (Items)" => { + "Stealth" => { let stealth_perception_multiplier = combat::perception_dist_multiplier_from_stealth( Some(self.inventory),