From 00710a4eb05051715d917c8d0270ece44820c793 Mon Sep 17 00:00:00 2001 From: Sam Date: Sat, 6 Aug 2022 15:09:32 -0400 Subject: [PATCH] Fixed csv tools --- common/src/bin/csv_export/main.rs | 35 +++++++++++-------- ...urability.sql => V51__item_durability.sql} | 0 voxygen/src/hud/crafting.rs | 20 +++++------ 3 files changed, 30 insertions(+), 25 deletions(-) rename server/src/migrations/{V50__item_durability.sql => V51__item_durability.sql} (100%) diff --git a/common/src/bin/csv_export/main.rs b/common/src/bin/csv_export/main.rs index 9ea38040bd..5b41bd5d86 100644 --- a/common/src/bin/csv_export/main.rs +++ b/common/src/bin/csv_export/main.rs @@ -15,7 +15,7 @@ use veloren_common::{ armor::{ArmorKind, Protection}, modular::{generate_weapon_primary_components, generate_weapons}, tool::{Hands, Tool, ToolKind}, - Item, MaterialStatManifest, + DurabilityMultiplier, Item, MaterialStatManifest, }, }, generation::{EntityConfig, EntityInfo}, @@ -58,21 +58,23 @@ fn armor_stats() -> Result<(), Box> { } let msm = &MaterialStatManifest::load().read(); + let dur_mult = DurabilityMultiplier(1.0); + let armor_stats = armor.stats(msm, dur_mult); - let protection = match armor.stats(msm).protection { + let protection = match armor_stats.protection { Some(Protection::Invincible) => "Invincible".to_string(), Some(Protection::Normal(value)) => value.to_string(), None => "0.0".to_string(), }; - let poise_resilience = match armor.stats(msm).poise_resilience { + let poise_resilience = match armor_stats.poise_resilience { Some(Protection::Invincible) => "Invincible".to_string(), Some(Protection::Normal(value)) => value.to_string(), None => "0.0".to_string(), }; - let max_energy = armor.stats(msm).energy_max.unwrap_or(0.0).to_string(); - let energy_reward = armor.stats(msm).energy_reward.unwrap_or(0.0).to_string(); - let crit_power = armor.stats(msm).crit_power.unwrap_or(0.0).to_string(); - let stealth = armor.stats(msm).stealth.unwrap_or(0.0).to_string(); + let max_energy = armor_stats.energy_max.unwrap_or(0.0).to_string(); + let energy_reward = armor_stats.energy_reward.unwrap_or(0.0).to_string(); + let crit_power = armor_stats.crit_power.unwrap_or(0.0).to_string(); + let stealth = armor_stats.stealth.unwrap_or(0.0).to_string(); wtr.write_record([ item.item_definition_id() @@ -124,14 +126,17 @@ fn weapon_stats() -> Result<(), Box> { for item in items.iter() { if let comp::item::ItemKind::Tool(tool) = &*item.kind() { - let power = tool.base_power().to_string(); - let effect_power = tool.base_effect_power().to_string(); - let speed = tool.base_speed().to_string(); - let crit_chance = tool.base_crit_chance().to_string(); - let range = tool.base_range().to_string(); - let energy_efficiency = tool.base_energy_efficiency().to_string(); - let buff_strength = tool.base_buff_strength().to_string(); - let equip_time = tool.equip_time().as_secs_f32().to_string(); + let dur_mult = DurabilityMultiplier(1.0); + let tool_stats = tool.stats(dur_mult); + + let power = tool_stats.power.to_string(); + let effect_power = tool_stats.effect_power.to_string(); + let speed = tool_stats.speed.to_string(); + let crit_chance = tool_stats.crit_chance.to_string(); + let range = tool_stats.range.to_string(); + let energy_efficiency = tool_stats.energy_efficiency.to_string(); + let buff_strength = tool_stats.buff_strength.to_string(); + let equip_time = tool_stats.equip_time_secs.to_string(); let kind = get_tool_kind(&tool.kind); let hands = get_tool_hands(tool); diff --git a/server/src/migrations/V50__item_durability.sql b/server/src/migrations/V51__item_durability.sql similarity index 100% rename from server/src/migrations/V50__item_durability.sql rename to server/src/migrations/V51__item_durability.sql diff --git a/voxygen/src/hud/crafting.rs b/voxygen/src/hud/crafting.rs index 7585fca117..4207147773 100644 --- a/voxygen/src/hud/crafting.rs +++ b/voxygen/src/hud/crafting.rs @@ -1497,16 +1497,16 @@ impl<'a> Widget for Crafting<'a> { // Craft button if Button::image(self.imgs.button) .w_h(105.0, 25.0) - .hover_image( - can_perform - .then_some(self.imgs.button_hover) - .unwrap_or(self.imgs.button), - ) - .press_image( - can_perform - .then_some(self.imgs.button_press) - .unwrap_or(self.imgs.button), - ) + .hover_image(if can_perform { + self.imgs.button_hover + } else { + self.imgs.button + }) + .press_image(if can_perform { + self.imgs.button_press + } else { + self.imgs.button + }) .label(&match recipe_kind { RecipeKind::Repair => self.localized_strings.get_msg("hud-crafting-repair"), _ => self.localized_strings.get_msg("hud-crafting-craft"),