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
- 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

View File

@ -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"),

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -5,8 +5,8 @@ ItemDef(
(
kind: Back("VeloriteMage"),
stats: (
protection: Invincible,
poise_resilience: Invincible,
protection: Normal(0.0),
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_mult": "Crit Mult",
"common.stats.armor": "Armor",
"common.stats.poise_res": "Poise res",
"common.stats.poise_res":"Stun Res",
"common.stats.slots": "Slots",
},

View File

@ -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.",
},

View File

@ -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",

View File

@ -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

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},
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)

View File

@ -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",

View File

@ -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
}
}

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::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,

View File

@ -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"),

View File

@ -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