diff --git a/CHANGELOG.md b/CHANGELOG.md index a66c301b78..449768251d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Topographic map option - Search bars for social and crafting window - RTsim travellers now follow paths between towns +- "Poise" renamed to "Stun resilience" +- Stun resilience stat display ### Changed @@ -41,6 +43,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Loot tables can now recursively reference loot tables - "max_sfx_channels" default now set to 30 - Merchants now have stacks of stackable items instead of just one per slot +- Bag tooltips only show slots now +- Removed infinite armour values from most admin items ### Removed @@ -52,6 +56,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Mouse Cursor now locks to the center of the screen when menu is not open - Social window no longer moves when group is open - Combat rating no longer takes buffs into account +- Minimap icons are now displayed in both map modes ## [0.9.0] - 2021-03-20 diff --git a/assets/common/items/armor/misc/bag/sturdy_red_backpack.ron b/assets/common/items/armor/misc/bag/sturdy_red_backpack.ron index 323d495093..a075a8b0a3 100644 --- a/assets/common/items/armor/misc/bag/sturdy_red_backpack.ron +++ b/assets/common/items/armor/misc/bag/sturdy_red_backpack.ron @@ -1,6 +1,6 @@ ItemDef( - name: "Sturdy Red Backpack", - description: "Made from some patches of dyed cloth.", + name: "Sturdy Red Saddlebag", + description: "Made from a large amount of dyed cloth patches.", kind: Armor( ( kind: Bag("RedLarge"), diff --git a/assets/common/items/debug/admin_back.ron b/assets/common/items/debug/admin_back.ron index 1425d8c1f6..807aa10fee 100644 --- a/assets/common/items/debug/admin_back.ron +++ b/assets/common/items/debug/admin_back.ron @@ -5,8 +5,8 @@ ItemDef( ( kind: Back("Admin"), stats: ( - protection: Invincible, - poise_resilience: Invincible, + protection: Normal(0.0), + poise_resilience: Normal(0.0), ), ) ), diff --git a/assets/common/items/debug/cultist_belt.ron b/assets/common/items/debug/cultist_belt.ron index fc29f57504..9557ca7e9a 100644 --- a/assets/common/items/debug/cultist_belt.ron +++ b/assets/common/items/debug/cultist_belt.ron @@ -5,8 +5,8 @@ ItemDef( ( kind: Belt("VeloriteMage"), stats: ( - protection: Invincible, - poise_resilience: Invincible, + protection: Normal(0.0), + poise_resilience: Normal(0.0), ), ) ), diff --git a/assets/common/items/debug/cultist_boots.ron b/assets/common/items/debug/cultist_boots.ron index 31f9f0a4b4..3f354d647d 100644 --- a/assets/common/items/debug/cultist_boots.ron +++ b/assets/common/items/debug/cultist_boots.ron @@ -5,8 +5,8 @@ ItemDef( ( kind: Foot("VeloriteMage"), stats: ( - protection: Invincible, - poise_resilience: Invincible, + protection: Normal(0.0), + poise_resilience: Normal(0.0), ), ) ), diff --git a/assets/common/items/debug/cultist_chest_blue.ron b/assets/common/items/debug/cultist_chest_blue.ron index 9f8f44ecbf..80bc2d2483 100644 --- a/assets/common/items/debug/cultist_chest_blue.ron +++ b/assets/common/items/debug/cultist_chest_blue.ron @@ -5,8 +5,8 @@ ItemDef( ( kind: Chest("VeloriteMage"), stats: ( - protection: Invincible, - poise_resilience: Invincible, + protection: Normal(0.0), + poise_resilience: Normal(0.0), ), ) ), diff --git a/assets/common/items/debug/cultist_hands_blue.ron b/assets/common/items/debug/cultist_hands_blue.ron index 9cc5e51a3b..5461404080 100644 --- a/assets/common/items/debug/cultist_hands_blue.ron +++ b/assets/common/items/debug/cultist_hands_blue.ron @@ -5,8 +5,8 @@ ItemDef( ( kind: Hand("VeloriteMage"), stats: ( - protection: Invincible, - poise_resilience: Invincible, + protection: Normal(0.0), + poise_resilience: Normal(0.0), ), ) ), diff --git a/assets/common/items/debug/cultist_legs_blue.ron b/assets/common/items/debug/cultist_legs_blue.ron index aa52c7e443..e180a45a17 100644 --- a/assets/common/items/debug/cultist_legs_blue.ron +++ b/assets/common/items/debug/cultist_legs_blue.ron @@ -5,8 +5,8 @@ ItemDef( ( kind: Pants("VeloriteMage"), stats: ( - protection: Invincible, - poise_resilience: Invincible, + protection: Normal(0.0), + poise_resilience: Normal(0.0), ), ) ), diff --git a/assets/common/items/debug/cultist_shoulder_blue.ron b/assets/common/items/debug/cultist_shoulder_blue.ron index e7198a8230..4d635b0a6d 100644 --- a/assets/common/items/debug/cultist_shoulder_blue.ron +++ b/assets/common/items/debug/cultist_shoulder_blue.ron @@ -5,8 +5,8 @@ ItemDef( ( kind: Shoulder("VeloriteMage"), stats: ( - protection: Invincible, - poise_resilience: Invincible, + protection: Normal(0.0), + poise_resilience: Normal(0.0), ), ) ), diff --git a/assets/common/items/debug/dungeon_purple.ron b/assets/common/items/debug/dungeon_purple.ron index e9f05131be..b5e12e5624 100644 --- a/assets/common/items/debug/dungeon_purple.ron +++ b/assets/common/items/debug/dungeon_purple.ron @@ -5,8 +5,8 @@ ItemDef( ( kind: Back("VeloriteMage"), stats: ( - protection: Invincible, - poise_resilience: Invincible, + protection: Normal(0.0), + poise_resilience: Normal(0.0), ), ) ), diff --git a/assets/common/items/debug/velorite_bow_debug.ron b/assets/common/items/debug/velorite_bow_debug.ron new file mode 100644 index 0000000000..571e7dfb60 --- /dev/null +++ b/assets/common/items/debug/velorite_bow_debug.ron @@ -0,0 +1,18 @@ +ItemDef( + name: "Admin Velorite Bow", + description: "Infused with Velorite power.", + kind: Tool(( + kind: Bow, + hands: Two, + stats: Direct(( + equip_time_secs: 0.0, + power: 999.9, + poise_strength: 999.9, + speed: 100.0, + crit_chance: 0.5, + crit_mult: 2.0, + )), + )), + quality: Debug, + tags: [], +) \ No newline at end of file diff --git a/assets/voxygen/element/buttons/map_modes.png b/assets/voxygen/element/buttons/map_modes.png new file mode 100644 index 0000000000..13c1580eba --- /dev/null +++ b/assets/voxygen/element/buttons/map_modes.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4b1fbd99fe8ed4bfeb6d6e836258abb400b737ba3c7180d40c049bbe2ef039ee +size 1464 diff --git a/assets/voxygen/element/icons/stun_res.png b/assets/voxygen/element/icons/stun_res.png new file mode 100644 index 0000000000..1f016d0d59 --- /dev/null +++ b/assets/voxygen/element/icons/stun_res.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fe662dfd6fc5bd1fbe97cc0133fea17c4f334a60f5bf4c7969a8416ff9f483ee +size 123 diff --git a/assets/voxygen/i18n/en/common.ron b/assets/voxygen/i18n/en/common.ron index 12317c2323..40c87b0c52 100644 --- a/assets/voxygen/i18n/en/common.ron +++ b/assets/voxygen/i18n/en/common.ron @@ -96,7 +96,7 @@ Is the client up to date?"#, "common.stats.crit_chance": "Crit Chance", "common.stats.crit_mult": "Crit Mult", "common.stats.armor": "Armor", - "common.stats.poise_res": "Poise res", + "common.stats.poise_res":"Stun Res", "common.stats.slots": "Slots", }, diff --git a/assets/voxygen/i18n/en/hud/bag.ron b/assets/voxygen/i18n/en/hud/bag.ron index 0cfca4aaa4..85a0be7a64 100644 --- a/assets/voxygen/i18n/en/hud/bag.ron +++ b/assets/voxygen/i18n/en/hud/bag.ron @@ -29,8 +29,10 @@ "hud.bag.stamina": "Stamina", "hud.bag.combat_rating": "Combat Rating", "hud.bag.protection": "Protection", + "hud.bag.stun_res": "Stun Resilience", "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 Stamina.", }, diff --git a/assets/voxygen/item_image_manifest.ron b/assets/voxygen/item_image_manifest.ron index 8101403edf..9b67da9859 100644 --- a/assets/voxygen/item_image_manifest.ron +++ b/assets/voxygen/item_image_manifest.ron @@ -153,6 +153,10 @@ "voxel.weapon.bow.velorite", (0.0, 0.0, 0.0), (90.0, 90.0, 0.0), 1.0, ), + Tool("common.items.debug.velorite_bow_debug"): VoxTrans( + "voxel.weapon.bow.velorite", + (0.0, 0.0, 0.0), (90.0, 90.0, 0.0), 1.0, + ), Tool("common.items.weapons.bow.wood-0"): VoxTrans( "voxel.weapon.bow.wood-0", (0.0, 0.0, 0.0), (90.0, 90.0, 0.0), 1.0, @@ -1072,8 +1076,8 @@ ), // Other Utility(Coins): VoxTrans( - "voxel.object.coins", - (0.0, 0.0, 0.0), (0.0, 0.0, 0.0), 0.6, + "voxel.object.v-coin", + (0.0, 0.0, 0.0), (-10.0, 15.0, 0.0), 0.8, ), Utility(Collar): Png( "element.icons.collar", diff --git a/assets/voxygen/voxel/biped_weapon_manifest.ron b/assets/voxygen/voxel/biped_weapon_manifest.ron index 66d6e6c320..55afa7452d 100644 --- a/assets/voxygen/voxel/biped_weapon_manifest.ron +++ b/assets/voxygen/voxel/biped_weapon_manifest.ron @@ -799,6 +799,10 @@ vox_spec: ("weapon.bow.velorite", (-1.5, -4.0, -15.0)), color: None ), + "common.items.debug.velorite_bow_debug": ( + vox_spec: ("weapon.bow.velorite", (-1.5, -4.0, -15.0)), + color: Some((73, 63, 59)) + ), "common.items.weapons.bow.wood-0": ( vox_spec: ("weapon.bow.wood-0", (-0.5, -5.0, -11.0)), color: None diff --git a/assets/voxygen/voxel/object/v-coin.vox b/assets/voxygen/voxel/object/v-coin.vox new file mode 100644 index 0000000000..c7067a3bed --- /dev/null +++ b/assets/voxygen/voxel/object/v-coin.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e59ce494414429e409172b70523dd87895b462f4897db3be078fa08fffb880f4 +size 3592 diff --git a/voxygen/src/hud/bag.rs b/voxygen/src/hud/bag.rs index d555e5807e..a22b2251b5 100644 --- a/voxygen/src/hud/bag.rs +++ b/voxygen/src/hud/bag.rs @@ -20,7 +20,7 @@ use common::{ combat::{combat_rating, Damage}, comp::{ item::{ItemDef, MaterialStatManifest, Quality}, - Body, Energy, Health, Inventory, Stats, + Body, Energy, Health, Inventory, Poise, Stats, }, }; use conrod_core::{ @@ -521,7 +521,13 @@ impl<'a> Bag<'a> { } } } -const STATS: [&str; 4] = ["Health", "Stamina", "Protection", "Combat Rating"]; +const STATS: [&str; 5] = [ + "Health", + "Stamina", + "Protection", + "Combat Rating", + "Stun Resilience", +]; pub struct BagState { ids: BagIds, @@ -741,6 +747,7 @@ impl<'a> Widget for Bag<'a> { "Stamina" => self.imgs.stamina_ico, "Combat Rating" => self.imgs.combat_rating_ico, "Protection" => self.imgs.protection_ico, + "Stun Resilience" => self.imgs.stun_res_ico, _ => self.imgs.nothing, }) .w_h(20.0, 20.0) @@ -757,7 +764,10 @@ impl<'a> Widget for Bag<'a> { let health_txt = format!("{}", (self.health.maximum() as f32 / 10.0) as usize); let stamina_txt = format!("{}", (self.energy.maximum() as f32 / 10.0) as usize); let combat_rating_txt = format!("{}", (combat_rating * 10.0) as usize); - + let stun_res_txt = format!( + "{}", + (100.0 * Poise::compute_poise_damage_reduction(inventory)) as i32 + ); let btn = if i.0 == 0 { btn.top_left_with_margins_on(state.bg_ids.bg_frame, 55.0, 10.0) } else { @@ -768,11 +778,13 @@ impl<'a> Widget for Bag<'a> { "Stamina" => i18n.get("hud.bag.stamina"), "Combat Rating" => i18n.get("hud.bag.combat_rating"), "Protection" => i18n.get("hud.bag.protection"), + "Stun Resilience" => i18n.get("hud.bag.stun_res"), _ => "", }; let tooltip_txt = match i.1 { "Combat Rating" => i18n.get("hud.bag.combat_rating_desc"), "Protection" => i18n.get("hud.bag.protection_desc"), + "Stun Resilience" => i18n.get("hud.bag.stun_res_desc"), _ => "", }; btn.with_tooltip( @@ -788,6 +800,7 @@ impl<'a> Widget for Bag<'a> { "Stamina" => &stamina_txt, "Combat Rating" => &combat_rating_txt, "Protection" => &protection_txt, + "Stun Resilience" => &stun_res_txt, _ => "", }) .right_from(state.ids.stat_icons[i.0], 10.0) diff --git a/voxygen/src/hud/img_ids.rs b/voxygen/src/hud/img_ids.rs index 634fc9f5f0..6b1b246273 100644 --- a/voxygen/src/hud/img_ids.rs +++ b/voxygen/src/hud/img_ids.rs @@ -337,6 +337,7 @@ image_ids! { indicator_group: "voxygen.element.map.group_indicator", indicator_group_up: "voxygen.element.map.group_indicator_arrow_up", indicator_group_down: "voxygen.element.map.group_indicator_arrow_down", + map_mode_overlay: "voxygen.element.buttons.map_modes", // MiniMap mmap_frame: "voxygen.element.frames.mmap", @@ -452,6 +453,7 @@ image_ids! { health_ico: "voxygen.element.icons.health", protection_ico: "voxygen.element.icons.protection", combat_rating_ico: "voxygen.element.icons.combat_rating", + stun_res_ico: "voxygen.element.icons.stun_res", combat_rating_ico_shadow: "voxygen.element.icons.combat_rating_shadow", not_found: "voxygen.element.not_found", diff --git a/voxygen/src/hud/map.rs b/voxygen/src/hud/map.rs index 07ac6d207e..d25d1ad8b4 100644 --- a/voxygen/src/hud/map.rs +++ b/voxygen/src/hud/map.rs @@ -40,9 +40,6 @@ widget_ids! { member_indicators[], member_height_indicators[], map_settings_align, - show_topo_map_img, - show_topo_map_box, - show_topo_map_text, show_towns_img, show_towns_box, show_towns_text, @@ -66,6 +63,8 @@ widget_ids! { drag_ico, zoom_txt, zoom_ico, + map_mode_btn, + map_mode_overlay, } } @@ -374,44 +373,9 @@ impl<'a> Widget for Map<'a> { .top_right_with_margins_on(state.ids.frame, 55.0, 10.0) .set(state.ids.map_settings_align, ui); // Checkboxes - // Show topographic map - Image::new(self.imgs.map_topo) - .top_left_with_margins_on(state.ids.map_settings_align, 5.0, 5.0) - .w_h(20.0, 20.0) - .set(state.ids.show_topo_map_img, ui); - if Button::image(if show_topo_map { - self.imgs.checkbox_checked - } else { - self.imgs.checkbox - }) - .w_h(18.0, 18.0) - .hover_image(if show_topo_map { - self.imgs.checkbox_checked_mo - } else { - self.imgs.checkbox_mo - }) - .press_image(if show_topo_map { - self.imgs.checkbox_checked - } else { - self.imgs.checkbox_press - }) - .right_from(state.ids.show_topo_map_img, 10.0) - .set(state.ids.show_topo_map_box, ui) - .was_clicked() - { - events.push(Event::ShowTopoMap(!show_topo_map)); - } - Text::new(i18n.get("hud.map.topo_map")) - .right_from(state.ids.show_topo_map_box, 10.0) - .font_size(self.fonts.cyri.scale(14)) - .font_id(self.fonts.cyri.conrod_id) - .graphics_for(state.ids.show_topo_map_box) - .color(TEXT_COLOR) - .set(state.ids.show_topo_map_text, ui); - // Show difficulties Image::new(self.imgs.map_dif_6) - .down_from(state.ids.show_topo_map_img, 10.0) + .top_left_with_margins_on(state.ids.map_settings_align, 5.0, 5.0) .w_h(20.0, 20.0) .set(state.ids.show_difficulty_img, ui); if Button::image(if show_difficulty { @@ -962,6 +926,30 @@ impl<'a> Widget for Map<'a> { .color(TEXT_COLOR) .set(state.ids.zoom_txt, ui); + // Show topographic map + if Button::image(self.imgs.button) + .w_h(92.0, icon_size.y) + .hover_image(self.imgs.button_hover) + .press_image(self.imgs.button_press) + .bottom_right_with_margins_on(state.ids.map_layers[0], -36.0, 0.0) + .with_tooltip( + self.tooltip_manager, + "Change Map Mode", + "", + &site_tooltip, + TEXT_COLOR, + ) + .set(state.ids.map_mode_btn, ui) + .was_clicked() + { + events.push(Event::ShowTopoMap(!show_topo_map)); + }; + Button::image(self.imgs.map_mode_overlay) + .w_h(92.0, icon_size.y) + .graphics_for(state.ids.map_mode_btn) + .middle_of(state.ids.map_mode_btn) + .set(state.ids.map_mode_overlay, ui); + events } } diff --git a/voxygen/src/hud/minimap.rs b/voxygen/src/hud/minimap.rs index 7eed945091..5f21594c3d 100644 --- a/voxygen/src/hud/minimap.rs +++ b/voxygen/src/hud/minimap.rs @@ -351,7 +351,6 @@ impl<'a> Widget for MiniMap<'a> { SiteKind::Cave => Color::Rgba(1.0, 1.0, 1.0, 0.0), SiteKind::Tree => Color::Rgba(1.0, 1.0, 1.0, 0.0), })) - .parent(state.ids.map_layers[3]) .set(state.ids.mmap_site_icons_bgs[i], ui); Image::new(match &site.kind { SiteKind::Town => self.imgs.mmap_site_town, diff --git a/voxygen/src/hud/util.rs b/voxygen/src/hud/util.rs index 9edda17811..aa5c18b5c6 100644 --- a/voxygen/src/hud/util.rs +++ b/voxygen/src/hud/util.rs @@ -113,7 +113,7 @@ pub fn consumable_desc(effects: &[Effect], i18n: &Localization) -> String { BuffKind::IncreaseMaxHealth => i18n .get("buff.stat.increase_max_health") .replace("{strength}", &strength.to_string()), - BuffKind::Invulnerability => i18n.get("buff.stat.invulenrability").to_string(), + BuffKind::Invulnerability => i18n.get("buff.stat.invulnerability").to_string(), BuffKind::Bleeding | BuffKind::CampfireHeal | BuffKind::Cursed @@ -171,7 +171,6 @@ fn armor_kind<'a>(armor: &Armor, i18n: &'a Localization) -> &'a str { } //Tool - fn tool_kind<'a>(tool: &Tool, i18n: &'a Localization) -> &'a str { let kind = match tool.kind { ToolKind::Sword => i18n.get("common.weapons.sword"), diff --git a/voxygen/src/ui/widgets/item_tooltip.rs b/voxygen/src/ui/widgets/item_tooltip.rs index df4af16b09..65412a660e 100644 --- a/voxygen/src/ui/widgets/item_tooltip.rs +++ b/voxygen/src/ui/widgets/item_tooltip.rs @@ -11,7 +11,10 @@ use crate::{ use client::Client; use common::{ combat, - comp::item::{armor::Protection, Item, ItemDesc, ItemKind, MaterialStatManifest, Quality}, + comp::item::{ + armor::{ArmorKind, Protection}, + Item, ItemDesc, ItemKind, MaterialStatManifest, Quality, + }, trade::SitePrices, }; use conrod_core::{ @@ -424,13 +427,20 @@ impl<'a> Widget for ItemTooltip<'a> { } = args; fn stats_count(item: &dyn ItemDesc) -> usize { + let is_bag = matches!(item.kind(), ItemKind::Armor(armor) if matches!(armor.kind, ArmorKind::Bag(_))); let mut count = match item.kind() { - ItemKind::Armor(_) => 1, + ItemKind::Armor(armor) => { + if matches!(armor.kind, ArmorKind::Bag(_)) { + 0 + } else { + 1 + } + }, ItemKind::Tool(_) => 5, ItemKind::Consumable { .. } => 1, _ => 0, }; - if item.num_slots() != 0 { + if item.num_slots() != 0 && !is_bag { count += 1 } count as usize @@ -750,57 +760,76 @@ impl<'a> Widget for ItemTooltip<'a> { } }, ItemKind::Armor(armor) => { - let protection = armor.get_protection(); - let poise_res = armor.get_poise_resilience(); + match armor.kind { + ArmorKind::Bag(_) => { + // Bags + widget::Text::new(&format!( + "{} {}", + item.num_slots(), + i18n.get("common.stats.slots") + )) + .graphics_for(id) + .parent(id) + .with_style(self.style.desc) + .color(text_color) + .font_size(34) + .align_middle_y_of(state.ids.item_frame) + .right_from(state.ids.item_frame, H_PAD) + .set(state.ids.main_stat, ui); + }, + _ => { + // Armour + let protection = armor.get_protection(); + let poise_res = armor.get_poise_resilience(); + widget::Text::new(&util::protec2string(protection)) + .graphics_for(id) + .parent(id) + .with_style(self.style.desc) + .color(text_color) + .font_size(34) + .align_middle_y_of(state.ids.item_frame) + .right_from(state.ids.item_frame, H_PAD) + .set(state.ids.main_stat, ui); - // Armour - widget::Text::new(&util::protec2string(protection)) - .graphics_for(id) - .parent(id) - .with_style(self.style.desc) - .color(text_color) - .font_size(34) - .align_middle_y_of(state.ids.item_frame) - .right_from(state.ids.item_frame, H_PAD) - .set(state.ids.main_stat, ui); + widget::Text::new(i18n.get("common.stats.armor")) + .graphics_for(id) + .parent(id) + .with_style(self.style.desc) + .color(text_color) + .align_bottom_of(state.ids.main_stat) + .right_from(state.ids.main_stat, H_PAD) + .set(state.ids.main_stat_text, ui); - widget::Text::new(i18n.get("common.stats.armor")) - .graphics_for(id) - .parent(id) - .with_style(self.style.desc) - .color(text_color) - .align_bottom_of(state.ids.main_stat) - .right_from(state.ids.main_stat, H_PAD) - .set(state.ids.main_stat_text, ui); + // Poise res + widget::Text::new(&format!( + "{} : {}", + i18n.get("common.stats.poise_res"), + util::protec2string(poise_res) + )) + .graphics_for(id) + .parent(id) + .with_style(self.style.desc) + .color(text_color) + .x_align_to(state.ids.item_frame, conrod_core::position::Align::Start) + .down_from(state.ids.item_frame, V_PAD) + .set(state.ids.stats[0], ui); - // Poise res - widget::Text::new(&format!( - "{} : {}", - i18n.get("common.stats.poise_res"), - util::protec2string(poise_res) - )) - .graphics_for(id) - .parent(id) - .with_style(self.style.desc) - .color(text_color) - .x_align_to(state.ids.item_frame, conrod_core::position::Align::Start) - .down_from(state.ids.item_frame, V_PAD) - .set(state.ids.stats[0], ui); - - // Slots - if item.num_slots() > 0 { - widget::Text::new(&format!( - "{} : {}", - i18n.get("common.stats.slots"), - item.num_slots() - )) - .graphics_for(id) - .parent(id) - .with_style(self.style.desc) - .color(text_color) - .x_align_to(state.ids.item_frame, conrod_core::position::Align::Start) - .down_from(state.ids.stats[0], V_PAD_STATS) - .set(state.ids.stats[1], ui); + // Slots + if item.num_slots() > 0 { + widget::Text::new(&format!( + "{} : {}", + i18n.get("common.stats.slots"), + item.num_slots() + )) + .graphics_for(id) + .parent(id) + .with_style(self.style.desc) + .color(text_color) + .x_align_to(state.ids.item_frame, conrod_core::position::Align::Start) + .down_from(state.ids.stats[0], V_PAD_STATS) + .set(state.ids.stats[1], ui); + } + }, } if let Some(equipped_item) = equip_slot.cloned().next() { @@ -932,13 +961,24 @@ impl<'a> Widget for ItemTooltip<'a> { fn default_y_dimension(&self, ui: &Ui) -> Dimension { fn stats_count(item: &dyn ItemDesc) -> usize { let mut count = match item.kind() { - ItemKind::Armor(_) => 1, + ItemKind::Armor(armor) => { + if matches!(armor.kind, ArmorKind::Bag(_)) { + 0 + } else { + 1 + } + }, ItemKind::Tool(_) => 5, ItemKind::Consumable { .. } => 1, ItemKind::ModularComponent { .. } => 1, _ => 0, }; - if item.num_slots() != 0 { + + let is_bag = match item.kind() { + ItemKind::Armor(armor) => matches!(armor.kind, ArmorKind::Bag(_)), + _ => false, + }; + if item.num_slots() != 0 && !is_bag { count += 1 } count as usize