UI fixes and more

This commit is contained in:
Monty Marz 2021-04-11 03:49:47 +00:00
parent 8b034ed56f
commit 6772e71aaa
24 changed files with 202 additions and 119 deletions

View File

@ -24,6 +24,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Topographic map option - Topographic map option
- Search bars for social and crafting window - Search bars for social and crafting window
- RTsim travellers now follow paths between towns - RTsim travellers now follow paths between towns
- "Poise" renamed to "Stun resilience"
- Stun resilience stat display
### Changed ### 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 - Loot tables can now recursively reference loot tables
- "max_sfx_channels" default now set to 30 - "max_sfx_channels" default now set to 30
- Merchants now have stacks of stackable items instead of just one per slot - 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 ### 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 - Mouse Cursor now locks to the center of the screen when menu is not open
- Social window no longer moves when group is open - Social window no longer moves when group is open
- Combat rating no longer takes buffs into account - Combat rating no longer takes buffs into account
- Minimap icons are now displayed in both map modes
## [0.9.0] - 2021-03-20 ## [0.9.0] - 2021-03-20

View File

@ -1,6 +1,6 @@
ItemDef( ItemDef(
name: "Sturdy Red Backpack", name: "Sturdy Red Saddlebag",
description: "Made from some patches of dyed cloth.", description: "Made from a large amount of dyed cloth patches.",
kind: Armor( kind: Armor(
( (
kind: Bag("RedLarge"), kind: Bag("RedLarge"),

View File

@ -5,8 +5,8 @@ ItemDef(
( (
kind: Back("Admin"), kind: Back("Admin"),
stats: ( stats: (
protection: Invincible, protection: Normal(0.0),
poise_resilience: Invincible, poise_resilience: Normal(0.0),
), ),
) )
), ),

View File

@ -5,8 +5,8 @@ ItemDef(
( (
kind: Belt("VeloriteMage"), kind: Belt("VeloriteMage"),
stats: ( stats: (
protection: Invincible, protection: Normal(0.0),
poise_resilience: Invincible, poise_resilience: Normal(0.0),
), ),
) )
), ),

View File

@ -5,8 +5,8 @@ ItemDef(
( (
kind: Foot("VeloriteMage"), kind: Foot("VeloriteMage"),
stats: ( stats: (
protection: Invincible, protection: Normal(0.0),
poise_resilience: Invincible, poise_resilience: Normal(0.0),
), ),
) )
), ),

View File

@ -5,8 +5,8 @@ ItemDef(
( (
kind: Chest("VeloriteMage"), kind: Chest("VeloriteMage"),
stats: ( stats: (
protection: Invincible, protection: Normal(0.0),
poise_resilience: Invincible, poise_resilience: Normal(0.0),
), ),
) )
), ),

View File

@ -5,8 +5,8 @@ ItemDef(
( (
kind: Hand("VeloriteMage"), kind: Hand("VeloriteMage"),
stats: ( stats: (
protection: Invincible, protection: Normal(0.0),
poise_resilience: Invincible, poise_resilience: Normal(0.0),
), ),
) )
), ),

View File

@ -5,8 +5,8 @@ ItemDef(
( (
kind: Pants("VeloriteMage"), kind: Pants("VeloriteMage"),
stats: ( stats: (
protection: Invincible, protection: Normal(0.0),
poise_resilience: Invincible, poise_resilience: Normal(0.0),
), ),
) )
), ),

View File

@ -5,8 +5,8 @@ ItemDef(
( (
kind: Shoulder("VeloriteMage"), kind: Shoulder("VeloriteMage"),
stats: ( stats: (
protection: Invincible, protection: Normal(0.0),
poise_resilience: Invincible, poise_resilience: Normal(0.0),
), ),
) )
), ),

View File

@ -5,8 +5,8 @@ ItemDef(
( (
kind: Back("VeloriteMage"), kind: Back("VeloriteMage"),
stats: ( stats: (
protection: Invincible, protection: Normal(0.0),
poise_resilience: Invincible, poise_resilience: Normal(0.0),
), ),
) )
), ),

View File

@ -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: [],
)

BIN
assets/voxygen/element/buttons/map_modes.png (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/element/icons/stun_res.png (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -96,7 +96,7 @@ Is the client up to date?"#,
"common.stats.crit_chance": "Crit Chance", "common.stats.crit_chance": "Crit Chance",
"common.stats.crit_mult": "Crit Mult", "common.stats.crit_mult": "Crit Mult",
"common.stats.armor": "Armor", "common.stats.armor": "Armor",
"common.stats.poise_res": "Poise res", "common.stats.poise_res":"Stun Res",
"common.stats.slots": "Slots", "common.stats.slots": "Slots",
}, },

View File

@ -29,8 +29,10 @@
"hud.bag.stamina": "Stamina", "hud.bag.stamina": "Stamina",
"hud.bag.combat_rating": "Combat Rating", "hud.bag.combat_rating": "Combat Rating",
"hud.bag.protection": "Protection", "hud.bag.protection": "Protection",
"hud.bag.stun_res": "Stun Resilience",
"hud.bag.combat_rating_desc": "Calculated from your\nequipment and health.", "hud.bag.combat_rating_desc": "Calculated from your\nequipment and health.",
"hud.bag.protection_desc": "Damage reduction through armor", "hud.bag.protection_desc": "Damage reduction through armor",
"hud.bag.stun_res_desc": "Resilience against being stunned by consecutive hits.\nRegenerates like Stamina.",
}, },

View File

@ -153,6 +153,10 @@
"voxel.weapon.bow.velorite", "voxel.weapon.bow.velorite",
(0.0, 0.0, 0.0), (90.0, 90.0, 0.0), 1.0, (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( Tool("common.items.weapons.bow.wood-0"): VoxTrans(
"voxel.weapon.bow.wood-0", "voxel.weapon.bow.wood-0",
(0.0, 0.0, 0.0), (90.0, 90.0, 0.0), 1.0, (0.0, 0.0, 0.0), (90.0, 90.0, 0.0), 1.0,
@ -1072,8 +1076,8 @@
), ),
// Other // Other
Utility(Coins): VoxTrans( Utility(Coins): VoxTrans(
"voxel.object.coins", "voxel.object.v-coin",
(0.0, 0.0, 0.0), (0.0, 0.0, 0.0), 0.6, (0.0, 0.0, 0.0), (-10.0, 15.0, 0.0), 0.8,
), ),
Utility(Collar): Png( Utility(Collar): Png(
"element.icons.collar", "element.icons.collar",

View File

@ -799,6 +799,10 @@
vox_spec: ("weapon.bow.velorite", (-1.5, -4.0, -15.0)), vox_spec: ("weapon.bow.velorite", (-1.5, -4.0, -15.0)),
color: None 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": ( "common.items.weapons.bow.wood-0": (
vox_spec: ("weapon.bow.wood-0", (-0.5, -5.0, -11.0)), vox_spec: ("weapon.bow.wood-0", (-0.5, -5.0, -11.0)),
color: None color: None

BIN
assets/voxygen/voxel/object/v-coin.vox (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -20,7 +20,7 @@ use common::{
combat::{combat_rating, Damage}, combat::{combat_rating, Damage},
comp::{ comp::{
item::{ItemDef, MaterialStatManifest, Quality}, item::{ItemDef, MaterialStatManifest, Quality},
Body, Energy, Health, Inventory, Stats, Body, Energy, Health, Inventory, Poise, Stats,
}, },
}; };
use conrod_core::{ 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 { pub struct BagState {
ids: BagIds, ids: BagIds,
@ -741,6 +747,7 @@ impl<'a> Widget for Bag<'a> {
"Stamina" => self.imgs.stamina_ico, "Stamina" => self.imgs.stamina_ico,
"Combat Rating" => self.imgs.combat_rating_ico, "Combat Rating" => self.imgs.combat_rating_ico,
"Protection" => self.imgs.protection_ico, "Protection" => self.imgs.protection_ico,
"Stun Resilience" => self.imgs.stun_res_ico,
_ => self.imgs.nothing, _ => self.imgs.nothing,
}) })
.w_h(20.0, 20.0) .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 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 stamina_txt = format!("{}", (self.energy.maximum() as f32 / 10.0) as usize);
let combat_rating_txt = format!("{}", (combat_rating * 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 { let btn = if i.0 == 0 {
btn.top_left_with_margins_on(state.bg_ids.bg_frame, 55.0, 10.0) btn.top_left_with_margins_on(state.bg_ids.bg_frame, 55.0, 10.0)
} else { } else {
@ -768,11 +778,13 @@ impl<'a> Widget for Bag<'a> {
"Stamina" => i18n.get("hud.bag.stamina"), "Stamina" => i18n.get("hud.bag.stamina"),
"Combat Rating" => i18n.get("hud.bag.combat_rating"), "Combat Rating" => i18n.get("hud.bag.combat_rating"),
"Protection" => i18n.get("hud.bag.protection"), "Protection" => i18n.get("hud.bag.protection"),
"Stun Resilience" => i18n.get("hud.bag.stun_res"),
_ => "", _ => "",
}; };
let tooltip_txt = match i.1 { let tooltip_txt = match i.1 {
"Combat Rating" => i18n.get("hud.bag.combat_rating_desc"), "Combat Rating" => i18n.get("hud.bag.combat_rating_desc"),
"Protection" => i18n.get("hud.bag.protection_desc"), "Protection" => i18n.get("hud.bag.protection_desc"),
"Stun Resilience" => i18n.get("hud.bag.stun_res_desc"),
_ => "", _ => "",
}; };
btn.with_tooltip( btn.with_tooltip(
@ -788,6 +800,7 @@ impl<'a> Widget for Bag<'a> {
"Stamina" => &stamina_txt, "Stamina" => &stamina_txt,
"Combat Rating" => &combat_rating_txt, "Combat Rating" => &combat_rating_txt,
"Protection" => &protection_txt, "Protection" => &protection_txt,
"Stun Resilience" => &stun_res_txt,
_ => "", _ => "",
}) })
.right_from(state.ids.stat_icons[i.0], 10.0) .right_from(state.ids.stat_icons[i.0], 10.0)

View File

@ -337,6 +337,7 @@ image_ids! {
indicator_group: "voxygen.element.map.group_indicator", indicator_group: "voxygen.element.map.group_indicator",
indicator_group_up: "voxygen.element.map.group_indicator_arrow_up", indicator_group_up: "voxygen.element.map.group_indicator_arrow_up",
indicator_group_down: "voxygen.element.map.group_indicator_arrow_down", indicator_group_down: "voxygen.element.map.group_indicator_arrow_down",
map_mode_overlay: "voxygen.element.buttons.map_modes",
// MiniMap // MiniMap
mmap_frame: "voxygen.element.frames.mmap", mmap_frame: "voxygen.element.frames.mmap",
@ -452,6 +453,7 @@ image_ids! {
health_ico: "voxygen.element.icons.health", health_ico: "voxygen.element.icons.health",
protection_ico: "voxygen.element.icons.protection", protection_ico: "voxygen.element.icons.protection",
combat_rating_ico: "voxygen.element.icons.combat_rating", 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", combat_rating_ico_shadow: "voxygen.element.icons.combat_rating_shadow",
not_found: "voxygen.element.not_found", not_found: "voxygen.element.not_found",

View File

@ -40,9 +40,6 @@ widget_ids! {
member_indicators[], member_indicators[],
member_height_indicators[], member_height_indicators[],
map_settings_align, map_settings_align,
show_topo_map_img,
show_topo_map_box,
show_topo_map_text,
show_towns_img, show_towns_img,
show_towns_box, show_towns_box,
show_towns_text, show_towns_text,
@ -66,6 +63,8 @@ widget_ids! {
drag_ico, drag_ico,
zoom_txt, zoom_txt,
zoom_ico, 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) .top_right_with_margins_on(state.ids.frame, 55.0, 10.0)
.set(state.ids.map_settings_align, ui); .set(state.ids.map_settings_align, ui);
// Checkboxes // 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 // Show difficulties
Image::new(self.imgs.map_dif_6) 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) .w_h(20.0, 20.0)
.set(state.ids.show_difficulty_img, ui); .set(state.ids.show_difficulty_img, ui);
if Button::image(if show_difficulty { if Button::image(if show_difficulty {
@ -962,6 +926,30 @@ impl<'a> Widget for Map<'a> {
.color(TEXT_COLOR) .color(TEXT_COLOR)
.set(state.ids.zoom_txt, ui); .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 events
} }
} }

View File

@ -351,7 +351,6 @@ impl<'a> Widget for MiniMap<'a> {
SiteKind::Cave => Color::Rgba(1.0, 1.0, 1.0, 0.0), SiteKind::Cave => Color::Rgba(1.0, 1.0, 1.0, 0.0),
SiteKind::Tree => 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); .set(state.ids.mmap_site_icons_bgs[i], ui);
Image::new(match &site.kind { Image::new(match &site.kind {
SiteKind::Town => self.imgs.mmap_site_town, SiteKind::Town => self.imgs.mmap_site_town,

View File

@ -113,7 +113,7 @@ pub fn consumable_desc(effects: &[Effect], i18n: &Localization) -> String {
BuffKind::IncreaseMaxHealth => i18n BuffKind::IncreaseMaxHealth => i18n
.get("buff.stat.increase_max_health") .get("buff.stat.increase_max_health")
.replace("{strength}", &strength.to_string()), .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::Bleeding
| BuffKind::CampfireHeal | BuffKind::CampfireHeal
| BuffKind::Cursed | BuffKind::Cursed
@ -171,7 +171,6 @@ fn armor_kind<'a>(armor: &Armor, i18n: &'a Localization) -> &'a str {
} }
//Tool //Tool
fn tool_kind<'a>(tool: &Tool, i18n: &'a Localization) -> &'a str { fn tool_kind<'a>(tool: &Tool, i18n: &'a Localization) -> &'a str {
let kind = match tool.kind { let kind = match tool.kind {
ToolKind::Sword => i18n.get("common.weapons.sword"), ToolKind::Sword => i18n.get("common.weapons.sword"),

View File

@ -11,7 +11,10 @@ use crate::{
use client::Client; use client::Client;
use common::{ use common::{
combat, combat,
comp::item::{armor::Protection, Item, ItemDesc, ItemKind, MaterialStatManifest, Quality}, comp::item::{
armor::{ArmorKind, Protection},
Item, ItemDesc, ItemKind, MaterialStatManifest, Quality,
},
trade::SitePrices, trade::SitePrices,
}; };
use conrod_core::{ use conrod_core::{
@ -424,13 +427,20 @@ impl<'a> Widget for ItemTooltip<'a> {
} = args; } = args;
fn stats_count(item: &dyn ItemDesc) -> usize { 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() { 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::Tool(_) => 5,
ItemKind::Consumable { .. } => 1, ItemKind::Consumable { .. } => 1,
_ => 0, _ => 0,
}; };
if item.num_slots() != 0 { if item.num_slots() != 0 && !is_bag {
count += 1 count += 1
} }
count as usize count as usize
@ -750,57 +760,76 @@ impl<'a> Widget for ItemTooltip<'a> {
} }
}, },
ItemKind::Armor(armor) => { ItemKind::Armor(armor) => {
let protection = armor.get_protection(); match armor.kind {
let poise_res = armor.get_poise_resilience(); 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(i18n.get("common.stats.armor"))
widget::Text::new(&util::protec2string(protection)) .graphics_for(id)
.graphics_for(id) .parent(id)
.parent(id) .with_style(self.style.desc)
.with_style(self.style.desc) .color(text_color)
.color(text_color) .align_bottom_of(state.ids.main_stat)
.font_size(34) .right_from(state.ids.main_stat, H_PAD)
.align_middle_y_of(state.ids.item_frame) .set(state.ids.main_stat_text, ui);
.right_from(state.ids.item_frame, H_PAD)
.set(state.ids.main_stat, ui);
widget::Text::new(i18n.get("common.stats.armor")) // Poise res
.graphics_for(id) widget::Text::new(&format!(
.parent(id) "{} : {}",
.with_style(self.style.desc) i18n.get("common.stats.poise_res"),
.color(text_color) util::protec2string(poise_res)
.align_bottom_of(state.ids.main_stat) ))
.right_from(state.ids.main_stat, H_PAD) .graphics_for(id)
.set(state.ids.main_stat_text, ui); .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 // Slots
widget::Text::new(&format!( if item.num_slots() > 0 {
"{} : {}", widget::Text::new(&format!(
i18n.get("common.stats.poise_res"), "{} : {}",
util::protec2string(poise_res) i18n.get("common.stats.slots"),
)) item.num_slots()
.graphics_for(id) ))
.parent(id) .graphics_for(id)
.with_style(self.style.desc) .parent(id)
.color(text_color) .with_style(self.style.desc)
.x_align_to(state.ids.item_frame, conrod_core::position::Align::Start) .color(text_color)
.down_from(state.ids.item_frame, V_PAD) .x_align_to(state.ids.item_frame, conrod_core::position::Align::Start)
.set(state.ids.stats[0], ui); .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() { 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 default_y_dimension(&self, ui: &Ui) -> Dimension {
fn stats_count(item: &dyn ItemDesc) -> usize { fn stats_count(item: &dyn ItemDesc) -> usize {
let mut count = match item.kind() { 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::Tool(_) => 5,
ItemKind::Consumable { .. } => 1, ItemKind::Consumable { .. } => 1,
ItemKind::ModularComponent { .. } => 1, ItemKind::ModularComponent { .. } => 1,
_ => 0, _ => 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 += 1
} }
count as usize count as usize