2021-11-10 22:25:37 +00:00
|
|
|
use super::img_ids;
|
2021-02-25 16:25:39 +00:00
|
|
|
use common::{
|
|
|
|
comp::{
|
2021-03-25 04:35:33 +00:00
|
|
|
inventory::trade_pricing::TradePricing,
|
2021-02-25 16:25:39 +00:00
|
|
|
item::{
|
2021-05-26 23:35:47 +00:00
|
|
|
armor::{Armor, ArmorKind, Protection},
|
2022-03-19 19:18:38 +00:00
|
|
|
tool::{Hands, Tool, ToolKind},
|
2024-01-16 16:40:12 +00:00
|
|
|
Effects, Item, ItemDefinitionId, ItemDesc, ItemI18n, ItemKind, MaterialKind,
|
2022-08-05 01:40:40 +00:00
|
|
|
MaterialStatManifest,
|
2021-02-25 16:25:39 +00:00
|
|
|
},
|
2024-03-06 18:36:07 +00:00
|
|
|
BuffData, BuffKind,
|
2021-02-25 16:25:39 +00:00
|
|
|
},
|
|
|
|
effect::Effect,
|
2021-03-25 04:35:33 +00:00
|
|
|
trade::{Good, SitePrices},
|
2020-07-18 00:05:28 +00:00
|
|
|
};
|
2021-11-10 22:25:37 +00:00
|
|
|
use conrod_core::image;
|
2022-08-26 14:56:32 +00:00
|
|
|
use i18n::{fluent_args, Localization};
|
2024-01-16 11:07:53 +00:00
|
|
|
use std::{borrow::Cow, fmt::Write};
|
2020-07-18 00:05:28 +00:00
|
|
|
|
2022-08-26 14:56:32 +00:00
|
|
|
pub fn price_desc<'a>(
|
2021-03-24 22:17:25 +00:00
|
|
|
prices: &Option<SitePrices>,
|
2022-07-02 16:20:10 +00:00
|
|
|
item_definition_id: ItemDefinitionId<'_>,
|
2022-08-26 14:56:32 +00:00
|
|
|
i18n: &'a Localization,
|
|
|
|
) -> Option<(Cow<'a, str>, Cow<'a, str>, f32)> {
|
2022-09-05 14:16:18 +00:00
|
|
|
let prices = prices.as_ref()?;
|
|
|
|
let materials = TradePricing::get_materials(&item_definition_id)?;
|
|
|
|
let coinprice = prices.values.get(&Good::Coin).cloned().unwrap_or(1.0);
|
|
|
|
let buyprice: f32 = materials
|
|
|
|
.iter()
|
|
|
|
.map(|e| prices.values.get(&e.1).cloned().unwrap_or_default() * e.0)
|
|
|
|
.sum();
|
|
|
|
let sellprice: f32 = materials
|
|
|
|
.iter()
|
|
|
|
.map(|e| prices.values.get(&e.1).cloned().unwrap_or_default() * e.0 * e.1.trade_margin())
|
|
|
|
.sum();
|
|
|
|
|
|
|
|
let deal_goodness: f32 = materials
|
|
|
|
.iter()
|
|
|
|
.map(|e| prices.values.get(&e.1).cloned().unwrap_or(0.0))
|
|
|
|
.sum::<f32>()
|
|
|
|
/ prices.values.get(&Good::Coin).cloned().unwrap_or(1.0)
|
|
|
|
/ (materials.len() as f32);
|
|
|
|
let deal_goodness = deal_goodness.log(2.0);
|
|
|
|
|
|
|
|
let buy_string = i18n.get_msg_ctx("hud-trade-buy", &fluent_args! {
|
|
|
|
"coin_num" => buyprice / coinprice,
|
|
|
|
"coin_formatted" => format!("{:0.1}", buyprice / coinprice),
|
|
|
|
});
|
|
|
|
let sell_string = i18n.get_msg_ctx("hud-trade-sell", &fluent_args! {
|
|
|
|
"coin_num" => sellprice / coinprice,
|
|
|
|
"coin_formatted" => format!("{:0.1}", sellprice / coinprice),
|
|
|
|
});
|
|
|
|
|
|
|
|
let deal_goodness = match deal_goodness {
|
|
|
|
x if x < -2.5 => 0.0,
|
|
|
|
x if x < -1.05 => 0.25,
|
|
|
|
x if x < -0.95 => 0.5,
|
|
|
|
x if x < 0.0 => 0.75,
|
|
|
|
_ => 1.0,
|
|
|
|
};
|
|
|
|
Some((buy_string, sell_string, deal_goodness))
|
2021-03-25 04:35:33 +00:00
|
|
|
}
|
|
|
|
|
Add ItemDesc::l10n method
- Add ItemL10n struct that is similar to ItemImgs except it holds i18n
description and not items. ItemDesc::l10n uses this struct to provide
common_i18n::Content for both names and descriptions.
So far it only used in voxygen, but it can be used by rtsim in
dialogues.
- Introduced new deprecation, ItemKind::Ingredient, because it uses
item.name().
It's not deleted, because it's used in inventory sorting, and our
inventory sorting is, for some reason, server-side.
- Crafting UI also still uses deprecated item.name(), because again,
sorting. It's probably will be easier to handle, because it's UI
sorting and we can use localized names here, but still, it's a thing
to discuss.
- Moved Item::describe() to voxygen/hud/util.
The most important thing to note is we don't want to completely delete
deprecated .name() and .description() along with corresponding fields
in ItemDef because ItemDef is now "public" API, exposed in plugins and I
don't want to break plugins before we actually implement i18n for them.
Otherwise, it would be basically impossible to use items in plugins.
What's left is actually fully implementing ItemDesc::l10n, create
item_l10n.ron and add fallback on current .name() and .description()
implementation.
2024-01-11 16:28:25 +00:00
|
|
|
pub fn item_text<'a, I: ItemDesc + ?Sized>(
|
|
|
|
item: &I,
|
|
|
|
i18n: &'a Localization,
|
2024-01-16 16:40:12 +00:00
|
|
|
i18n_spec: &'a ItemI18n,
|
Add ItemDesc::l10n method
- Add ItemL10n struct that is similar to ItemImgs except it holds i18n
description and not items. ItemDesc::l10n uses this struct to provide
common_i18n::Content for both names and descriptions.
So far it only used in voxygen, but it can be used by rtsim in
dialogues.
- Introduced new deprecation, ItemKind::Ingredient, because it uses
item.name().
It's not deleted, because it's used in inventory sorting, and our
inventory sorting is, for some reason, server-side.
- Crafting UI also still uses deprecated item.name(), because again,
sorting. It's probably will be easier to handle, because it's UI
sorting and we can use localized names here, but still, it's a thing
to discuss.
- Moved Item::describe() to voxygen/hud/util.
The most important thing to note is we don't want to completely delete
deprecated .name() and .description() along with corresponding fields
in ItemDef because ItemDef is now "public" API, exposed in plugins and I
don't want to break plugins before we actually implement i18n for them.
Otherwise, it would be basically impossible to use items in plugins.
What's left is actually fully implementing ItemDesc::l10n, create
item_l10n.ron and add fallback on current .name() and .description()
implementation.
2024-01-11 16:28:25 +00:00
|
|
|
) -> (String, String) {
|
2024-01-16 16:40:12 +00:00
|
|
|
let (title, desc) = item.i18n(i18n_spec);
|
Add ItemDesc::l10n method
- Add ItemL10n struct that is similar to ItemImgs except it holds i18n
description and not items. ItemDesc::l10n uses this struct to provide
common_i18n::Content for both names and descriptions.
So far it only used in voxygen, but it can be used by rtsim in
dialogues.
- Introduced new deprecation, ItemKind::Ingredient, because it uses
item.name().
It's not deleted, because it's used in inventory sorting, and our
inventory sorting is, for some reason, server-side.
- Crafting UI also still uses deprecated item.name(), because again,
sorting. It's probably will be easier to handle, because it's UI
sorting and we can use localized names here, but still, it's a thing
to discuss.
- Moved Item::describe() to voxygen/hud/util.
The most important thing to note is we don't want to completely delete
deprecated .name() and .description() along with corresponding fields
in ItemDef because ItemDef is now "public" API, exposed in plugins and I
don't want to break plugins before we actually implement i18n for them.
Otherwise, it would be basically impossible to use items in plugins.
What's left is actually fully implementing ItemDesc::l10n, create
item_l10n.ron and add fallback on current .name() and .description()
implementation.
2024-01-11 16:28:25 +00:00
|
|
|
|
|
|
|
(i18n.get_content(&title), i18n.get_content(&desc))
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn describe<'a, I: ItemDesc + ?Sized>(
|
|
|
|
item: &I,
|
|
|
|
i18n: &'a Localization,
|
2024-01-16 16:40:12 +00:00
|
|
|
i18n_spec: &'a ItemI18n,
|
Add ItemDesc::l10n method
- Add ItemL10n struct that is similar to ItemImgs except it holds i18n
description and not items. ItemDesc::l10n uses this struct to provide
common_i18n::Content for both names and descriptions.
So far it only used in voxygen, but it can be used by rtsim in
dialogues.
- Introduced new deprecation, ItemKind::Ingredient, because it uses
item.name().
It's not deleted, because it's used in inventory sorting, and our
inventory sorting is, for some reason, server-side.
- Crafting UI also still uses deprecated item.name(), because again,
sorting. It's probably will be easier to handle, because it's UI
sorting and we can use localized names here, but still, it's a thing
to discuss.
- Moved Item::describe() to voxygen/hud/util.
The most important thing to note is we don't want to completely delete
deprecated .name() and .description() along with corresponding fields
in ItemDef because ItemDef is now "public" API, exposed in plugins and I
don't want to break plugins before we actually implement i18n for them.
Otherwise, it would be basically impossible to use items in plugins.
What's left is actually fully implementing ItemDesc::l10n, create
item_l10n.ron and add fallback on current .name() and .description()
implementation.
2024-01-11 16:28:25 +00:00
|
|
|
) -> String {
|
2024-01-16 16:40:12 +00:00
|
|
|
let (title, _) = item_text(item, i18n, i18n_spec);
|
Add ItemDesc::l10n method
- Add ItemL10n struct that is similar to ItemImgs except it holds i18n
description and not items. ItemDesc::l10n uses this struct to provide
common_i18n::Content for both names and descriptions.
So far it only used in voxygen, but it can be used by rtsim in
dialogues.
- Introduced new deprecation, ItemKind::Ingredient, because it uses
item.name().
It's not deleted, because it's used in inventory sorting, and our
inventory sorting is, for some reason, server-side.
- Crafting UI also still uses deprecated item.name(), because again,
sorting. It's probably will be easier to handle, because it's UI
sorting and we can use localized names here, but still, it's a thing
to discuss.
- Moved Item::describe() to voxygen/hud/util.
The most important thing to note is we don't want to completely delete
deprecated .name() and .description() along with corresponding fields
in ItemDef because ItemDef is now "public" API, exposed in plugins and I
don't want to break plugins before we actually implement i18n for them.
Otherwise, it would be basically impossible to use items in plugins.
What's left is actually fully implementing ItemDesc::l10n, create
item_l10n.ron and add fallback on current .name() and .description()
implementation.
2024-01-11 16:28:25 +00:00
|
|
|
let amount = item.amount();
|
|
|
|
|
2024-01-16 11:07:53 +00:00
|
|
|
if amount.get() > 1 {
|
Add ItemDesc::l10n method
- Add ItemL10n struct that is similar to ItemImgs except it holds i18n
description and not items. ItemDesc::l10n uses this struct to provide
common_i18n::Content for both names and descriptions.
So far it only used in voxygen, but it can be used by rtsim in
dialogues.
- Introduced new deprecation, ItemKind::Ingredient, because it uses
item.name().
It's not deleted, because it's used in inventory sorting, and our
inventory sorting is, for some reason, server-side.
- Crafting UI also still uses deprecated item.name(), because again,
sorting. It's probably will be easier to handle, because it's UI
sorting and we can use localized names here, but still, it's a thing
to discuss.
- Moved Item::describe() to voxygen/hud/util.
The most important thing to note is we don't want to completely delete
deprecated .name() and .description() along with corresponding fields
in ItemDef because ItemDef is now "public" API, exposed in plugins and I
don't want to break plugins before we actually implement i18n for them.
Otherwise, it would be basically impossible to use items in plugins.
What's left is actually fully implementing ItemDesc::l10n, create
item_l10n.ron and add fallback on current .name() and .description()
implementation.
2024-01-11 16:28:25 +00:00
|
|
|
format!("{amount} x {title}")
|
|
|
|
} else {
|
|
|
|
title
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-05-05 02:53:24 +00:00
|
|
|
pub fn kind_text<'a>(kind: &ItemKind, i18n: &'a Localization) -> Cow<'a, str> {
|
|
|
|
match kind {
|
2022-08-06 17:47:45 +00:00
|
|
|
ItemKind::Armor(armor) => armor_kind(armor, i18n),
|
2021-03-28 12:27:59 +00:00
|
|
|
ItemKind::Tool(tool) => Cow::Owned(format!(
|
|
|
|
"{} ({})",
|
2021-07-11 18:41:52 +00:00
|
|
|
tool_kind(tool, i18n),
|
2021-11-18 15:41:08 +00:00
|
|
|
tool_hands(tool, i18n)
|
2021-03-28 12:27:59 +00:00
|
|
|
)),
|
2022-03-19 19:18:38 +00:00
|
|
|
ItemKind::ModularComponent(mc) => {
|
|
|
|
if let Some(toolkind) = mc.toolkind() {
|
|
|
|
Cow::Owned(format!(
|
|
|
|
"{} {}",
|
2022-08-23 09:17:21 +00:00
|
|
|
i18n.get_msg(&format!("common-weapons-{}", toolkind.identifier_name())),
|
|
|
|
i18n.get_msg("common-kind-modular_component_partial")
|
2022-03-19 19:18:38 +00:00
|
|
|
))
|
|
|
|
} else {
|
2022-08-23 09:17:21 +00:00
|
|
|
i18n.get_msg("common-kind-modular_component")
|
2022-03-19 19:18:38 +00:00
|
|
|
}
|
|
|
|
},
|
2022-08-23 09:17:21 +00:00
|
|
|
ItemKind::Glider => i18n.get_msg("common-kind-glider"),
|
|
|
|
ItemKind::Consumable { .. } => i18n.get_msg("common-kind-consumable"),
|
|
|
|
ItemKind::Throwable { .. } => i18n.get_msg("common-kind-throwable"),
|
|
|
|
ItemKind::Utility { .. } => i18n.get_msg("common-kind-utility"),
|
|
|
|
ItemKind::Ingredient { .. } => i18n.get_msg("common-kind-ingredient"),
|
|
|
|
ItemKind::Lantern { .. } => i18n.get_msg("common-kind-lantern"),
|
2021-03-28 12:27:59 +00:00
|
|
|
ItemKind::TagExamples { .. } => Cow::Borrowed(""),
|
2022-11-29 03:50:44 +00:00
|
|
|
ItemKind::RecipeGroup { .. } => i18n.get_msg("common-kind-recipegroup"),
|
2021-03-02 00:45:02 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-08-06 17:47:45 +00:00
|
|
|
pub fn material_kind_text<'a>(kind: &MaterialKind, i18n: &'a Localization) -> Cow<'a, str> {
|
2021-05-26 00:12:43 +00:00
|
|
|
match kind {
|
2022-08-23 09:17:21 +00:00
|
|
|
MaterialKind::Metal { .. } => i18n.get_msg("common-material-metal"),
|
2023-07-19 14:16:20 +00:00
|
|
|
MaterialKind::Gem { .. } => i18n.get_msg("common-material-gem"),
|
2022-08-23 09:17:21 +00:00
|
|
|
MaterialKind::Wood { .. } => i18n.get_msg("common-material-wood"),
|
|
|
|
MaterialKind::Stone { .. } => i18n.get_msg("common-material-stone"),
|
|
|
|
MaterialKind::Cloth { .. } => i18n.get_msg("common-material-cloth"),
|
|
|
|
MaterialKind::Hide { .. } => i18n.get_msg("common-material-hide"),
|
2021-05-26 00:12:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-05-28 23:41:31 +00:00
|
|
|
pub fn stats_count(item: &dyn ItemDesc, msm: &MaterialStatManifest) -> usize {
|
2022-06-07 20:05:56 +00:00
|
|
|
let mut count = match &*item.kind() {
|
2021-06-30 20:48:30 +00:00
|
|
|
ItemKind::Armor(armor) => {
|
2022-06-06 21:48:39 +00:00
|
|
|
let armor_stats = armor.stats(msm, item.stats_durability_multiplier());
|
2022-07-28 23:19:20 +00:00
|
|
|
armor_stats.energy_reward.is_some() as usize
|
|
|
|
+ armor_stats.energy_max.is_some() as usize
|
|
|
|
+ armor_stats.stealth.is_some() as usize
|
2023-11-11 19:20:38 +00:00
|
|
|
+ armor_stats.precision_power.is_some() as usize
|
2022-07-28 23:19:20 +00:00
|
|
|
+ armor_stats.poise_resilience.is_some() as usize
|
|
|
|
+ armor_stats.protection.is_some() as usize
|
|
|
|
+ (item.num_slots() > 0) as usize
|
2021-06-30 20:48:30 +00:00
|
|
|
},
|
2024-02-17 04:50:00 +00:00
|
|
|
ItemKind::Tool(_) => 6,
|
2023-03-29 23:11:59 +00:00
|
|
|
ItemKind::Consumable { effects, .. } => match effects {
|
|
|
|
Effects::Any(_) | Effects::One(_) => 1,
|
|
|
|
Effects::All(effects) => effects.len(),
|
|
|
|
},
|
2024-02-17 04:50:00 +00:00
|
|
|
ItemKind::ModularComponent { .. } => 6,
|
2021-06-30 20:48:30 +00:00
|
|
|
_ => 0,
|
2022-06-07 20:05:56 +00:00
|
|
|
};
|
|
|
|
if item.has_durability() {
|
|
|
|
count += 1;
|
2021-06-30 20:48:30 +00:00
|
|
|
}
|
2022-06-07 20:05:56 +00:00
|
|
|
count
|
2021-06-30 20:48:30 +00:00
|
|
|
}
|
|
|
|
|
2022-09-05 14:16:18 +00:00
|
|
|
pub fn line_count(item: &dyn ItemDesc, msm: &MaterialStatManifest, i18n: &Localization) -> usize {
|
|
|
|
match &*item.kind() {
|
|
|
|
ItemKind::Consumable { effects, .. } => {
|
|
|
|
let descs = consumable_desc(effects, i18n);
|
|
|
|
let mut lines = 0;
|
|
|
|
for desc in descs {
|
|
|
|
lines += desc.matches('\n').count() + 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
lines
|
|
|
|
},
|
|
|
|
_ => stats_count(item, msm),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-03-06 18:36:07 +00:00
|
|
|
/// Returns i18n key for a buff with title, .desc and optionally .stat
|
|
|
|
///
|
|
|
|
/// NOTE: not to be confused with buff key for buff's kill message
|
|
|
|
fn buff_key(buff: BuffKind) -> &'static str {
|
|
|
|
match buff {
|
|
|
|
// Buffs
|
|
|
|
BuffKind::Regeneration => "buff-heal",
|
|
|
|
BuffKind::Saturation => "buff-saturation",
|
|
|
|
BuffKind::Potion => "buff-potion",
|
|
|
|
BuffKind::Agility => "buff-agility",
|
|
|
|
BuffKind::CampfireHeal => "buff-campfire_heal",
|
|
|
|
BuffKind::EnergyRegen => "buff-energy_regen",
|
|
|
|
BuffKind::IncreaseMaxHealth => "buff-increase_max_health",
|
|
|
|
BuffKind::IncreaseMaxEnergy => "buff-increase_max_energy",
|
|
|
|
BuffKind::Invulnerability => "buff-invulnerability",
|
|
|
|
BuffKind::ProtectingWard => "buff-protectingward",
|
|
|
|
BuffKind::Frenzied => "buff-frenzied",
|
|
|
|
BuffKind::Hastened => "buff-hastened",
|
|
|
|
BuffKind::Fortitude => "buff-fortitude",
|
|
|
|
BuffKind::Reckless => "buff-reckless",
|
|
|
|
// BuffKind::SalamanderAspect => "buff-salamanderaspect",
|
|
|
|
BuffKind::Flame => "buff-burn",
|
|
|
|
BuffKind::Frigid => "buff-frigid",
|
|
|
|
BuffKind::Lifesteal => "buff-lifesteal",
|
|
|
|
BuffKind::ImminentCritical => "buff-imminentcritical",
|
|
|
|
BuffKind::Fury => "buff-fury",
|
|
|
|
BuffKind::Sunderer => "buff-sunderer",
|
|
|
|
BuffKind::Defiance => "buff-defiance",
|
|
|
|
BuffKind::Bloodfeast => "buff-bloodfeast",
|
|
|
|
BuffKind::Berserk => "buff-berserk",
|
2024-02-17 04:40:42 +00:00
|
|
|
BuffKind::ScornfulTaunt => "buff-scornfultaunt",
|
2024-03-28 23:41:31 +00:00
|
|
|
BuffKind::Tenacity => "buff-tenacity",
|
2024-05-28 00:25:12 +00:00
|
|
|
BuffKind::Resilience => "buff-resilience",
|
2024-03-06 18:36:07 +00:00
|
|
|
// Debuffs
|
|
|
|
BuffKind::Bleeding => "buff-bleed",
|
|
|
|
BuffKind::Cursed => "buff-cursed",
|
|
|
|
BuffKind::Burning => "buff-burn",
|
|
|
|
BuffKind::Crippled => "buff-crippled",
|
|
|
|
BuffKind::Frozen => "buff-frozen",
|
|
|
|
BuffKind::Wet => "buff-wet",
|
|
|
|
BuffKind::Ensnared => "buff-ensnared",
|
|
|
|
BuffKind::Poisoned => "buff-poisoned",
|
|
|
|
BuffKind::Parried => "buff-parried",
|
|
|
|
BuffKind::PotionSickness => "buff-potionsickness",
|
|
|
|
BuffKind::Heatstroke => "buff-heatstroke",
|
2024-02-24 23:50:27 +00:00
|
|
|
BuffKind::Rooted => "buff-rooted",
|
2024-02-25 18:42:12 +00:00
|
|
|
BuffKind::Winded => "buff-winded",
|
2024-02-25 19:58:09 +00:00
|
|
|
BuffKind::Concussion => "buff-concussion",
|
2024-03-05 04:24:29 +00:00
|
|
|
BuffKind::Staggered => "buff-staggered",
|
2024-03-06 18:36:07 +00:00
|
|
|
// Neutral
|
|
|
|
BuffKind::Polymorphed => "buff-polymorphed",
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Returns localized buff title
|
|
|
|
pub fn get_buff_title(buff: BuffKind, i18n: &Localization) -> Cow<str> {
|
|
|
|
let key = buff_key(buff);
|
|
|
|
|
|
|
|
i18n.get_msg(key)
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Returns localized buff description
|
|
|
|
pub fn get_buff_desc(buff: BuffKind, data: BuffData, i18n: &Localization) -> Cow<str> {
|
|
|
|
let key = buff_key(buff);
|
|
|
|
if let BuffKind::CampfireHeal = buff {
|
|
|
|
i18n.get_attr_ctx(key, "desc", &i18n::fluent_args! {
|
|
|
|
"rate" => data.strength * 100.0
|
|
|
|
})
|
|
|
|
} else {
|
|
|
|
i18n.get_attr(key, "desc")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-06-30 20:48:30 +00:00
|
|
|
/// Takes N `effects` and returns N effect descriptions
|
|
|
|
/// If effect isn't intended to have description, returns empty string
|
|
|
|
///
|
|
|
|
/// FIXME: handle which effects should have description in `stats_count`
|
|
|
|
/// to not waste space in item box
|
2023-03-29 23:11:59 +00:00
|
|
|
pub fn consumable_desc(effects: &Effects, i18n: &Localization) -> Vec<String> {
|
2021-06-30 20:48:30 +00:00
|
|
|
let mut descriptions = Vec::new();
|
2023-03-29 23:11:59 +00:00
|
|
|
match effects {
|
|
|
|
Effects::Any(_) => {
|
|
|
|
descriptions.push(i18n.get_msg("buff-mysterious").into_owned());
|
|
|
|
},
|
|
|
|
Effects::All(_) | Effects::One(_) => {
|
|
|
|
for effect in effects.effects() {
|
|
|
|
let mut description = String::new();
|
|
|
|
if let Effect::Buff(buff) = effect {
|
|
|
|
let strength = buff.data.strength;
|
|
|
|
let dur_secs = buff.data.duration.map(|d| d.0 as f32);
|
|
|
|
let str_total = dur_secs.map_or(strength, |secs| strength * secs);
|
2021-02-25 16:25:39 +00:00
|
|
|
|
2023-03-29 23:11:59 +00:00
|
|
|
let format_float =
|
|
|
|
|input: f32| format!("{:.1}", input).trim_end_matches(".0").to_string();
|
2021-03-02 23:53:21 +00:00
|
|
|
|
2023-03-29 23:11:59 +00:00
|
|
|
let buff_desc = match buff.kind {
|
2024-03-06 18:36:07 +00:00
|
|
|
// These share common buff-key and show full possible regen
|
|
|
|
BuffKind::Saturation | BuffKind::Regeneration | BuffKind::Potion => {
|
|
|
|
let key = "buff-heal";
|
|
|
|
i18n.get_attr_ctx(key, "stat", &i18n::fluent_args! {
|
2023-03-29 23:11:59 +00:00
|
|
|
"str_total" => format_float(str_total),
|
2024-03-06 18:36:07 +00:00
|
|
|
})
|
|
|
|
},
|
|
|
|
// Shows its full possible regen
|
2023-03-29 23:11:59 +00:00
|
|
|
BuffKind::EnergyRegen => {
|
2024-03-06 18:36:07 +00:00
|
|
|
let key = buff_key(buff.kind);
|
|
|
|
i18n.get_attr_ctx(key, "stat", &i18n::fluent_args! {
|
2023-03-29 23:11:59 +00:00
|
|
|
"str_total" => format_float(str_total),
|
|
|
|
})
|
|
|
|
},
|
2024-03-06 18:36:07 +00:00
|
|
|
// Show buff strength
|
|
|
|
BuffKind::IncreaseMaxEnergy
|
|
|
|
| BuffKind::IncreaseMaxHealth => {
|
|
|
|
let key = buff_key(buff.kind);
|
|
|
|
i18n.get_attr_ctx(key, "stat", &i18n::fluent_args! {
|
2023-03-29 23:11:59 +00:00
|
|
|
"strength" => format_float(strength),
|
|
|
|
})
|
|
|
|
},
|
2024-03-06 18:36:07 +00:00
|
|
|
// Show percentage
|
|
|
|
BuffKind::PotionSickness
|
|
|
|
| BuffKind::Agility => {
|
|
|
|
let key = buff_key(buff.kind);
|
|
|
|
i18n.get_attr_ctx(key, "stat", &i18n::fluent_args! {
|
2023-03-29 23:11:59 +00:00
|
|
|
"strength" => format_float(strength),
|
|
|
|
})
|
|
|
|
},
|
2024-03-06 18:36:07 +00:00
|
|
|
// Independent of strength
|
|
|
|
BuffKind::Invulnerability => {
|
|
|
|
let key = buff_key(buff.kind);
|
|
|
|
i18n.get_attr(key, "stat")
|
2023-11-26 14:54:02 +00:00
|
|
|
},
|
2024-03-06 18:36:07 +00:00
|
|
|
// Have no stat description
|
2023-03-29 23:11:59 +00:00
|
|
|
BuffKind::Bleeding
|
|
|
|
| BuffKind::Burning
|
|
|
|
| BuffKind::CampfireHeal
|
|
|
|
| BuffKind::Cursed
|
|
|
|
| BuffKind::ProtectingWard
|
|
|
|
| BuffKind::Crippled
|
|
|
|
| BuffKind::Frenzied
|
|
|
|
| BuffKind::Frozen
|
|
|
|
| BuffKind::Wet
|
|
|
|
| BuffKind::Ensnared
|
|
|
|
| BuffKind::Poisoned
|
|
|
|
| BuffKind::Hastened
|
|
|
|
| BuffKind::Fortitude
|
|
|
|
| BuffKind::Parried
|
|
|
|
| BuffKind::Reckless
|
2023-11-12 17:37:28 +00:00
|
|
|
| BuffKind::Polymorphed
|
2023-05-19 03:07:44 +00:00
|
|
|
| BuffKind::Flame
|
|
|
|
| BuffKind::Frigid
|
2023-07-09 20:03:09 +00:00
|
|
|
| BuffKind::Lifesteal
|
2023-05-15 01:38:11 +00:00
|
|
|
// | BuffKind::SalamanderAspect
|
2023-05-20 17:25:49 +00:00
|
|
|
| BuffKind::ImminentCritical
|
2023-05-21 00:21:23 +00:00
|
|
|
| BuffKind::Fury
|
2023-05-27 21:02:34 +00:00
|
|
|
| BuffKind::Sunderer
|
2023-07-03 00:50:25 +00:00
|
|
|
| BuffKind::Defiance
|
|
|
|
| BuffKind::Bloodfeast
|
2023-11-28 11:13:18 +00:00
|
|
|
| BuffKind::Berserk
|
2024-02-17 04:40:42 +00:00
|
|
|
| BuffKind::Heatstroke
|
2024-02-24 23:50:27 +00:00
|
|
|
| BuffKind::ScornfulTaunt
|
2024-02-25 18:42:12 +00:00
|
|
|
| BuffKind::Rooted
|
2024-02-25 19:58:09 +00:00
|
|
|
| BuffKind::Winded
|
2024-03-05 04:24:29 +00:00
|
|
|
| BuffKind::Concussion
|
2024-03-28 23:41:31 +00:00
|
|
|
| BuffKind::Staggered
|
2024-05-28 00:25:12 +00:00
|
|
|
| BuffKind::Tenacity
|
|
|
|
| BuffKind::Resilience => Cow::Borrowed(""),
|
2023-03-29 23:11:59 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
write!(&mut description, "{}", buff_desc).unwrap();
|
2021-02-25 16:25:39 +00:00
|
|
|
|
2023-03-29 23:11:59 +00:00
|
|
|
let dur_desc = if let Some(dur_secs) = dur_secs {
|
|
|
|
match buff.kind {
|
|
|
|
BuffKind::Saturation
|
|
|
|
| BuffKind::Regeneration
|
|
|
|
| BuffKind::EnergyRegen => {
|
|
|
|
i18n.get_msg_ctx("buff-text-over_seconds", &i18n::fluent_args! {
|
|
|
|
"dur_secs" => dur_secs
|
|
|
|
})
|
|
|
|
},
|
|
|
|
BuffKind::IncreaseMaxEnergy
|
2023-12-05 18:15:54 +00:00
|
|
|
| BuffKind::Agility
|
2023-03-29 23:11:59 +00:00
|
|
|
| BuffKind::IncreaseMaxHealth
|
|
|
|
| BuffKind::Invulnerability
|
|
|
|
| BuffKind::PotionSickness
|
2023-11-12 17:37:28 +00:00
|
|
|
| BuffKind::Polymorphed => {
|
2023-03-29 23:11:59 +00:00
|
|
|
i18n.get_msg_ctx("buff-text-for_seconds", &i18n::fluent_args! {
|
|
|
|
"dur_secs" => dur_secs
|
|
|
|
})
|
|
|
|
},
|
|
|
|
BuffKind::Bleeding
|
|
|
|
| BuffKind::Burning
|
|
|
|
| BuffKind::Potion
|
|
|
|
| BuffKind::CampfireHeal
|
|
|
|
| BuffKind::Cursed
|
|
|
|
| BuffKind::ProtectingWard
|
|
|
|
| BuffKind::Crippled
|
|
|
|
| BuffKind::Frenzied
|
|
|
|
| BuffKind::Frozen
|
|
|
|
| BuffKind::Wet
|
|
|
|
| BuffKind::Ensnared
|
|
|
|
| BuffKind::Poisoned
|
|
|
|
| BuffKind::Hastened
|
|
|
|
| BuffKind::Fortitude
|
|
|
|
| BuffKind::Parried
|
2023-05-19 03:07:44 +00:00
|
|
|
| BuffKind::Reckless
|
|
|
|
| BuffKind::Flame
|
|
|
|
| BuffKind::Frigid
|
2023-07-09 20:03:09 +00:00
|
|
|
| BuffKind::Lifesteal
|
2023-05-15 01:38:11 +00:00
|
|
|
// | BuffKind::SalamanderAspect
|
2023-05-20 17:25:49 +00:00
|
|
|
| BuffKind::ImminentCritical
|
2023-05-21 00:21:23 +00:00
|
|
|
| BuffKind::Fury
|
2023-05-27 21:02:34 +00:00
|
|
|
| BuffKind::Sunderer
|
2023-07-03 00:50:25 +00:00
|
|
|
| BuffKind::Defiance
|
|
|
|
| BuffKind::Bloodfeast
|
2023-11-28 11:13:18 +00:00
|
|
|
| BuffKind::Berserk
|
2024-02-17 04:40:42 +00:00
|
|
|
| BuffKind::Heatstroke
|
2024-02-24 23:50:27 +00:00
|
|
|
| BuffKind::ScornfulTaunt
|
2024-02-25 18:42:12 +00:00
|
|
|
| BuffKind::Rooted
|
2024-02-25 19:58:09 +00:00
|
|
|
| BuffKind::Winded
|
2024-03-05 04:24:29 +00:00
|
|
|
| BuffKind::Concussion
|
2024-03-28 23:41:31 +00:00
|
|
|
| BuffKind::Staggered
|
2024-05-28 00:25:12 +00:00
|
|
|
| BuffKind::Tenacity
|
|
|
|
| BuffKind::Resilience => Cow::Borrowed(""),
|
2023-03-29 23:11:59 +00:00
|
|
|
}
|
|
|
|
} else if let BuffKind::Saturation
|
|
|
|
| BuffKind::Regeneration
|
|
|
|
| BuffKind::EnergyRegen = buff.kind
|
|
|
|
{
|
|
|
|
i18n.get_msg("buff-text-every_second")
|
|
|
|
} else {
|
|
|
|
Cow::Borrowed("")
|
|
|
|
};
|
|
|
|
|
|
|
|
write!(&mut description, " {}", dur_desc).unwrap();
|
|
|
|
}
|
|
|
|
descriptions.push(description);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
}
|
2021-06-30 20:48:30 +00:00
|
|
|
descriptions
|
2020-10-07 02:23:20 +00:00
|
|
|
}
|
|
|
|
|
2021-03-02 00:45:02 +00:00
|
|
|
// Armor
|
2022-08-06 17:47:45 +00:00
|
|
|
fn armor_kind<'a>(armor: &Armor, i18n: &'a Localization) -> Cow<'a, str> {
|
2020-07-18 00:05:28 +00:00
|
|
|
let kind = match armor.kind {
|
2022-08-23 09:17:21 +00:00
|
|
|
ArmorKind::Shoulder => i18n.get_msg("hud-bag-shoulders"),
|
|
|
|
ArmorKind::Chest => i18n.get_msg("hud-bag-chest"),
|
|
|
|
ArmorKind::Belt => i18n.get_msg("hud-bag-belt"),
|
|
|
|
ArmorKind::Hand => i18n.get_msg("hud-bag-hands"),
|
|
|
|
ArmorKind::Pants => i18n.get_msg("hud-bag-legs"),
|
|
|
|
ArmorKind::Foot => i18n.get_msg("hud-bag-feet"),
|
|
|
|
ArmorKind::Back => i18n.get_msg("hud-bag-back"),
|
2023-10-13 10:57:49 +00:00
|
|
|
ArmorKind::Backpack => i18n.get_msg("hud-bag-backpack"),
|
2022-08-23 09:17:21 +00:00
|
|
|
ArmorKind::Ring => i18n.get_msg("hud-bag-ring"),
|
|
|
|
ArmorKind::Neck => i18n.get_msg("hud-bag-neck"),
|
|
|
|
ArmorKind::Head => i18n.get_msg("hud-bag-head"),
|
|
|
|
ArmorKind::Tabard => i18n.get_msg("hud-bag-tabard"),
|
|
|
|
ArmorKind::Bag => i18n.get_msg("hud-bag-bag"),
|
2020-07-18 00:05:28 +00:00
|
|
|
};
|
2021-03-28 12:27:59 +00:00
|
|
|
kind
|
2021-03-02 00:45:02 +00:00
|
|
|
}
|
|
|
|
|
2021-06-07 00:51:46 +00:00
|
|
|
// Tool
|
2022-08-06 17:47:45 +00:00
|
|
|
fn tool_kind<'a>(tool: &Tool, i18n: &'a Localization) -> Cow<'a, str> {
|
2020-08-01 20:08:30 +00:00
|
|
|
let kind = match tool.kind {
|
2022-08-23 09:17:21 +00:00
|
|
|
ToolKind::Sword => i18n.get_msg("common-weapons-sword"),
|
|
|
|
ToolKind::Axe => i18n.get_msg("common-weapons-axe"),
|
|
|
|
ToolKind::Hammer => i18n.get_msg("common-weapons-hammer"),
|
|
|
|
ToolKind::Bow => i18n.get_msg("common-weapons-bow"),
|
|
|
|
ToolKind::Dagger => i18n.get_msg("common-weapons-dagger"),
|
|
|
|
ToolKind::Staff => i18n.get_msg("common-weapons-staff"),
|
|
|
|
ToolKind::Sceptre => i18n.get_msg("common-weapons-sceptre"),
|
|
|
|
ToolKind::Shield => i18n.get_msg("common-weapons-shield"),
|
|
|
|
ToolKind::Spear => i18n.get_msg("common-weapons-spear"),
|
|
|
|
ToolKind::Blowgun => i18n.get_msg("common-weapons-blowgun"),
|
|
|
|
ToolKind::Natural => i18n.get_msg("common-weapons-natural"),
|
|
|
|
ToolKind::Debug => i18n.get_msg("common-tool-debug"),
|
|
|
|
ToolKind::Farming => i18n.get_msg("common-tool-farming"),
|
2022-08-28 18:48:18 +00:00
|
|
|
ToolKind::Instrument => i18n.get_msg("common-tool-instrument"),
|
2022-08-23 09:17:21 +00:00
|
|
|
ToolKind::Pick => i18n.get_msg("common-tool-pick"),
|
2023-08-03 17:32:00 +00:00
|
|
|
ToolKind::Shovel => i18n.get_msg("common-tool-shovel"),
|
2022-08-23 09:17:21 +00:00
|
|
|
ToolKind::Empty => i18n.get_msg("common-empty"),
|
2020-08-01 20:08:30 +00:00
|
|
|
};
|
2021-03-28 12:27:59 +00:00
|
|
|
kind
|
2021-03-02 00:45:02 +00:00
|
|
|
}
|
2021-01-13 03:26:51 +00:00
|
|
|
|
2021-06-07 00:51:46 +00:00
|
|
|
/// Output the number of hands needed to hold a tool
|
2022-08-06 17:47:45 +00:00
|
|
|
pub fn tool_hands<'a>(tool: &Tool, i18n: &'a Localization) -> Cow<'a, str> {
|
2021-11-18 15:41:08 +00:00
|
|
|
let hands = match tool.hands {
|
2022-08-23 09:17:21 +00:00
|
|
|
Hands::One => i18n.get_msg("common-hands-one"),
|
|
|
|
Hands::Two => i18n.get_msg("common-hands-two"),
|
2021-02-13 00:57:52 +00:00
|
|
|
};
|
2021-03-28 12:27:59 +00:00
|
|
|
hands
|
2021-03-02 00:45:02 +00:00
|
|
|
}
|
2021-02-17 04:23:08 +00:00
|
|
|
|
2021-06-07 00:51:46 +00:00
|
|
|
/// Compare two type, output a colored character to show comparison
|
2021-03-28 12:27:59 +00:00
|
|
|
pub fn comparison<T: PartialOrd>(first: T, other: T) -> (&'static str, conrod_core::Color) {
|
2021-03-02 00:45:02 +00:00
|
|
|
if first == other {
|
2021-03-28 12:27:59 +00:00
|
|
|
("•", conrod_core::color::GREY)
|
2021-03-02 00:45:02 +00:00
|
|
|
} else if other < first {
|
2021-03-28 12:27:59 +00:00
|
|
|
("▲", conrod_core::color::GREEN)
|
2021-03-02 00:45:02 +00:00
|
|
|
} else {
|
2021-03-28 12:27:59 +00:00
|
|
|
("▼", conrod_core::color::RED)
|
2021-03-02 00:45:02 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-12-12 00:25:35 +00:00
|
|
|
/// Compare two Option type, output a colored character to show comparison
|
|
|
|
pub fn option_comparison<T: PartialOrd>(
|
|
|
|
first: &Option<T>,
|
|
|
|
other: &Option<T>,
|
|
|
|
) -> (&'static str, conrod_core::Color) {
|
|
|
|
if let Some(first) = first {
|
|
|
|
if let Some(other) = other {
|
|
|
|
if first == other {
|
|
|
|
("•", conrod_core::color::GREY)
|
|
|
|
} else if other < first {
|
|
|
|
("▲", conrod_core::color::GREEN)
|
|
|
|
} else {
|
|
|
|
("▼", conrod_core::color::RED)
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
("▲", conrod_core::color::GREEN)
|
|
|
|
}
|
|
|
|
} else if other.is_some() {
|
|
|
|
("▼", conrod_core::color::RED)
|
|
|
|
} else {
|
|
|
|
("•", conrod_core::color::GREY)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-06-07 00:51:46 +00:00
|
|
|
/// Output protection as a string
|
2021-03-02 00:45:02 +00:00
|
|
|
pub fn protec2string(stat: Protection) -> String {
|
|
|
|
match stat {
|
|
|
|
Protection::Normal(a) => format!("{:.1}", a),
|
2021-03-20 20:24:26 +00:00
|
|
|
Protection::Invincible => "Inf".to_string(),
|
2021-03-02 00:45:02 +00:00
|
|
|
}
|
|
|
|
}
|
2021-11-10 22:25:37 +00:00
|
|
|
|
2022-08-05 01:40:40 +00:00
|
|
|
/// Gets the durability of an item in a format more intuitive for UI
|
|
|
|
pub fn item_durability(item: &dyn ItemDesc) -> Option<u32> {
|
|
|
|
let durability = item
|
2023-04-16 21:31:39 +00:00
|
|
|
.durability_lost()
|
2022-08-05 01:40:40 +00:00
|
|
|
.or_else(|| item.has_durability().then_some(0));
|
|
|
|
durability.map(|d| Item::MAX_DURABILITY - d)
|
|
|
|
}
|
|
|
|
|
2021-11-10 22:25:37 +00:00
|
|
|
pub fn ability_image(imgs: &img_ids::Imgs, ability_id: &str) -> image::Id {
|
|
|
|
match ability_id {
|
|
|
|
// Debug stick
|
|
|
|
"common.abilities.debug.forwardboost" => imgs.flyingrod_m1,
|
|
|
|
"common.abilities.debug.upboost" => imgs.flyingrod_m2,
|
|
|
|
"common.abilities.debug.possess" => imgs.snake_arrow_0,
|
|
|
|
// Sword
|
2023-01-04 02:53:37 +00:00
|
|
|
"veloren.core.pseudo_abilities.sword.heavy_stance" => imgs.sword_heavy_stance,
|
|
|
|
"veloren.core.pseudo_abilities.sword.agile_stance" => imgs.sword_agile_stance,
|
|
|
|
"veloren.core.pseudo_abilities.sword.defensive_stance" => imgs.sword_defensive_stance,
|
|
|
|
"veloren.core.pseudo_abilities.sword.crippling_stance" => imgs.sword_crippling_stance,
|
|
|
|
"veloren.core.pseudo_abilities.sword.cleaving_stance" => imgs.sword_cleaving_stance,
|
|
|
|
"veloren.core.pseudo_abilities.sword.double_slash" => imgs.sword_double_slash,
|
|
|
|
"common.abilities.sword.basic_double_slash" => imgs.sword_basic_double_slash,
|
|
|
|
"common.abilities.sword.heavy_double_slash" => imgs.sword_heavy_double_slash,
|
|
|
|
"common.abilities.sword.agile_double_slash" => imgs.sword_agile_double_slash,
|
|
|
|
"common.abilities.sword.defensive_double_slash" => imgs.sword_defensive_double_slash,
|
|
|
|
"common.abilities.sword.crippling_double_slash" => imgs.sword_crippling_double_slash,
|
|
|
|
"common.abilities.sword.cleaving_double_slash" => imgs.sword_cleaving_double_slash,
|
|
|
|
"veloren.core.pseudo_abilities.sword.secondary_ability" => imgs.sword_secondary_ability,
|
|
|
|
"common.abilities.sword.basic_thrust" => imgs.sword_basic_thrust,
|
|
|
|
"common.abilities.sword.heavy_slam" => imgs.sword_heavy_slam,
|
2023-12-06 22:38:22 +00:00
|
|
|
"common.abilities.sword.agile_perforate" => imgs.sword_agile_perforate,
|
2023-04-24 01:31:29 +00:00
|
|
|
"common.abilities.sword.agile_dual_perforate" => imgs.sword_agile_perforate,
|
2023-03-29 00:46:44 +00:00
|
|
|
"common.abilities.sword.defensive_vital_jab" => imgs.sword_defensive_vital_jab,
|
2023-01-04 02:53:37 +00:00
|
|
|
"common.abilities.sword.crippling_deep_rend" => imgs.sword_crippling_deep_rend,
|
|
|
|
"common.abilities.sword.cleaving_spiral_slash" => imgs.sword_cleaving_spiral_slash,
|
2023-04-24 01:31:29 +00:00
|
|
|
"common.abilities.sword.cleaving_dual_spiral_slash" => imgs.sword_cleaving_spiral_slash,
|
2023-01-04 02:53:37 +00:00
|
|
|
"veloren.core.pseudo_abilities.sword.crescent_slash" => imgs.sword_crescent_slash,
|
|
|
|
"common.abilities.sword.basic_crescent_slash" => imgs.sword_basic_crescent_slash,
|
|
|
|
"common.abilities.sword.heavy_crescent_slash" => imgs.sword_heavy_crescent_slash,
|
|
|
|
"common.abilities.sword.agile_crescent_slash" => imgs.sword_agile_crescent_slash,
|
|
|
|
"common.abilities.sword.defensive_crescent_slash" => imgs.sword_defensive_crescent_slash,
|
|
|
|
"common.abilities.sword.crippling_crescent_slash" => imgs.sword_crippling_crescent_slash,
|
|
|
|
"common.abilities.sword.cleaving_crescent_slash" => imgs.sword_cleaving_crescent_slash,
|
|
|
|
"veloren.core.pseudo_abilities.sword.fell_strike" => imgs.sword_fell_strike,
|
|
|
|
"common.abilities.sword.basic_fell_strike" => imgs.sword_basic_fell_strike,
|
|
|
|
"common.abilities.sword.heavy_fell_strike" => imgs.sword_heavy_fell_strike,
|
|
|
|
"common.abilities.sword.agile_fell_strike" => imgs.sword_agile_fell_strike,
|
|
|
|
"common.abilities.sword.defensive_fell_strike" => imgs.sword_defensive_fell_strike,
|
|
|
|
"common.abilities.sword.crippling_fell_strike" => imgs.sword_crippling_fell_strike,
|
|
|
|
"common.abilities.sword.cleaving_fell_strike" => imgs.sword_cleaving_fell_strike,
|
|
|
|
"veloren.core.pseudo_abilities.sword.skewer" => imgs.sword_skewer,
|
|
|
|
"common.abilities.sword.basic_skewer" => imgs.sword_basic_skewer,
|
|
|
|
"common.abilities.sword.heavy_skewer" => imgs.sword_heavy_skewer,
|
|
|
|
"common.abilities.sword.agile_skewer" => imgs.sword_agile_skewer,
|
|
|
|
"common.abilities.sword.defensive_skewer" => imgs.sword_defensive_skewer,
|
|
|
|
"common.abilities.sword.crippling_skewer" => imgs.sword_crippling_skewer,
|
|
|
|
"common.abilities.sword.cleaving_skewer" => imgs.sword_cleaving_skewer,
|
|
|
|
"veloren.core.pseudo_abilities.sword.cascade" => imgs.sword_cascade,
|
|
|
|
"common.abilities.sword.basic_cascade" => imgs.sword_basic_cascade,
|
|
|
|
"common.abilities.sword.heavy_cascade" => imgs.sword_heavy_cascade,
|
|
|
|
"common.abilities.sword.agile_cascade" => imgs.sword_agile_cascade,
|
|
|
|
"common.abilities.sword.defensive_cascade" => imgs.sword_defensive_cascade,
|
|
|
|
"common.abilities.sword.crippling_cascade" => imgs.sword_crippling_cascade,
|
|
|
|
"common.abilities.sword.cleaving_cascade" => imgs.sword_cleaving_cascade,
|
|
|
|
"veloren.core.pseudo_abilities.sword.cross_cut" => imgs.sword_cross_cut,
|
|
|
|
"common.abilities.sword.basic_cross_cut" => imgs.sword_basic_cross_cut,
|
|
|
|
"common.abilities.sword.heavy_cross_cut" => imgs.sword_heavy_cross_cut,
|
|
|
|
"common.abilities.sword.agile_cross_cut" => imgs.sword_agile_cross_cut,
|
|
|
|
"common.abilities.sword.defensive_cross_cut" => imgs.sword_defensive_cross_cut,
|
|
|
|
"common.abilities.sword.crippling_cross_cut" => imgs.sword_crippling_cross_cut,
|
|
|
|
"common.abilities.sword.cleaving_cross_cut" => imgs.sword_cleaving_cross_cut,
|
2023-04-24 01:31:29 +00:00
|
|
|
"common.abilities.sword.basic_dual_cross_cut" => imgs.sword_basic_cross_cut,
|
|
|
|
"common.abilities.sword.heavy_dual_cross_cut" => imgs.sword_heavy_cross_cut,
|
|
|
|
"common.abilities.sword.agile_dual_cross_cut" => imgs.sword_agile_cross_cut,
|
|
|
|
"common.abilities.sword.defensive_dual_cross_cut" => imgs.sword_defensive_cross_cut,
|
|
|
|
"common.abilities.sword.crippling_dual_cross_cut" => imgs.sword_crippling_cross_cut,
|
|
|
|
"common.abilities.sword.cleaving_dual_cross_cut" => imgs.sword_cleaving_cross_cut,
|
2023-01-04 02:53:37 +00:00
|
|
|
"veloren.core.pseudo_abilities.sword.finisher" => imgs.sword_finisher,
|
|
|
|
"common.abilities.sword.basic_mighty_strike" => imgs.sword_basic_mighty_strike,
|
|
|
|
"common.abilities.sword.heavy_guillotine" => imgs.sword_heavy_guillotine,
|
|
|
|
"common.abilities.sword.agile_hundred_cuts" => imgs.sword_agile_hundred_cuts,
|
|
|
|
"common.abilities.sword.defensive_counter" => imgs.sword_defensive_counter,
|
|
|
|
"common.abilities.sword.crippling_mutilate" => imgs.sword_crippling_mutilate,
|
|
|
|
"common.abilities.sword.cleaving_bladestorm" => imgs.sword_cleaving_bladestorm,
|
2023-04-24 01:31:29 +00:00
|
|
|
"common.abilities.sword.cleaving_dual_bladestorm" => imgs.sword_cleaving_bladestorm,
|
2023-03-27 01:39:36 +00:00
|
|
|
"common.abilities.sword.heavy_sweep" => imgs.sword_heavy_sweep,
|
2023-01-04 02:53:37 +00:00
|
|
|
"common.abilities.sword.heavy_pommel_strike" => imgs.sword_heavy_pommel_strike,
|
|
|
|
"common.abilities.sword.agile_quick_draw" => imgs.sword_agile_quick_draw,
|
|
|
|
"common.abilities.sword.agile_feint" => imgs.sword_agile_feint,
|
|
|
|
"common.abilities.sword.defensive_riposte" => imgs.sword_defensive_riposte,
|
|
|
|
"common.abilities.sword.defensive_disengage" => imgs.sword_defensive_disengage,
|
2022-09-06 16:59:30 +00:00
|
|
|
"common.abilities.sword.crippling_gouge" => imgs.sword_crippling_gouge,
|
2023-01-04 02:53:37 +00:00
|
|
|
"common.abilities.sword.crippling_hamstring" => imgs.sword_crippling_hamstring,
|
|
|
|
"common.abilities.sword.cleaving_whirlwind_slice" => imgs.sword_cleaving_whirlwind_slice,
|
2023-04-24 01:31:29 +00:00
|
|
|
"common.abilities.sword.cleaving_dual_whirlwind_slice" => {
|
|
|
|
imgs.sword_cleaving_whirlwind_slice
|
|
|
|
},
|
2023-01-04 02:53:37 +00:00
|
|
|
"common.abilities.sword.cleaving_earth_splitter" => imgs.sword_cleaving_earth_splitter,
|
2022-09-06 16:59:30 +00:00
|
|
|
"common.abilities.sword.heavy_fortitude" => imgs.sword_heavy_fortitude,
|
2023-01-04 02:53:37 +00:00
|
|
|
"common.abilities.sword.heavy_pillar_thrust" => imgs.sword_heavy_pillar_thrust,
|
2023-01-05 02:52:54 +00:00
|
|
|
"common.abilities.sword.agile_dancing_edge" => imgs.sword_agile_dancing_edge,
|
2023-01-04 02:53:37 +00:00
|
|
|
"common.abilities.sword.agile_flurry" => imgs.sword_agile_flurry,
|
2023-04-24 01:31:29 +00:00
|
|
|
"common.abilities.sword.agile_dual_flurry" => imgs.sword_agile_flurry,
|
2023-01-05 02:52:54 +00:00
|
|
|
"common.abilities.sword.defensive_stalwart_sword" => imgs.sword_defensive_stalwart_sword,
|
2023-01-04 02:53:37 +00:00
|
|
|
"common.abilities.sword.defensive_deflect" => imgs.sword_defensive_deflect,
|
2023-01-05 02:52:54 +00:00
|
|
|
"common.abilities.sword.crippling_eviscerate" => imgs.sword_crippling_eviscerate,
|
2023-01-04 02:53:37 +00:00
|
|
|
"common.abilities.sword.crippling_bloody_gash" => imgs.sword_crippling_bloody_gash,
|
2023-01-05 02:52:54 +00:00
|
|
|
"common.abilities.sword.cleaving_blade_fever" => imgs.sword_cleaving_blade_fever,
|
2023-01-04 02:53:37 +00:00
|
|
|
"common.abilities.sword.cleaving_sky_splitter" => imgs.sword_cleaving_sky_splitter,
|
2021-11-10 22:25:37 +00:00
|
|
|
// Axe
|
2023-05-29 23:11:04 +00:00
|
|
|
"common.abilities.axe.triple_chop" => imgs.axe_triple_chop,
|
|
|
|
"common.abilities.axe.cleave" => imgs.axe_cleave,
|
|
|
|
"common.abilities.axe.brutal_swing" => imgs.axe_brutal_swing,
|
|
|
|
"common.abilities.axe.berserk" => imgs.axe_berserk,
|
|
|
|
"common.abilities.axe.rising_tide" => imgs.axe_rising_tide,
|
|
|
|
"common.abilities.axe.savage_sense" => imgs.axe_savage_sense,
|
|
|
|
"common.abilities.axe.adrenaline_rush" => imgs.axe_adrenaline_rush,
|
|
|
|
"common.abilities.axe.execute" => imgs.axe_execute,
|
|
|
|
"common.abilities.axe.maelstrom" => imgs.axe_maelstrom,
|
|
|
|
"common.abilities.axe.rake" => imgs.axe_rake,
|
|
|
|
"common.abilities.axe.bloodfeast" => imgs.axe_bloodfeast,
|
|
|
|
"common.abilities.axe.fierce_raze" => imgs.axe_fierce_raze,
|
|
|
|
"common.abilities.axe.dual_fierce_raze" => imgs.axe_fierce_raze,
|
|
|
|
"common.abilities.axe.furor" => imgs.axe_furor,
|
|
|
|
"common.abilities.axe.fracture" => imgs.axe_fracture,
|
|
|
|
"common.abilities.axe.lacerate" => imgs.axe_lacerate,
|
|
|
|
"common.abilities.axe.riptide" => imgs.axe_riptide,
|
|
|
|
"common.abilities.axe.skull_bash" => imgs.axe_skull_bash,
|
|
|
|
"common.abilities.axe.sunder" => imgs.axe_sunder,
|
|
|
|
"common.abilities.axe.plunder" => imgs.axe_plunder,
|
|
|
|
"common.abilities.axe.defiance" => imgs.axe_defiance,
|
|
|
|
"common.abilities.axe.keelhaul" => imgs.axe_keelhaul,
|
|
|
|
"common.abilities.axe.bulkhead" => imgs.axe_bulkhead,
|
|
|
|
"common.abilities.axe.capsize" => imgs.axe_capsize,
|
2021-11-10 22:25:37 +00:00
|
|
|
// Hammer
|
2024-01-29 23:20:06 +00:00
|
|
|
"common.abilities.hammer.solid_smash" => imgs.hammer_solid_smash,
|
2024-01-29 23:46:44 +00:00
|
|
|
"common.abilities.hammer.wide_wallop" => imgs.hammer_wide_wallop,
|
2024-02-17 04:40:42 +00:00
|
|
|
"common.abilities.hammer.scornful_swipe" => imgs.hammer_scornful_swipe,
|
2024-02-19 17:59:42 +00:00
|
|
|
"common.abilities.hammer.tremor" => imgs.hammer_tremor,
|
2024-02-19 19:41:22 +00:00
|
|
|
"common.abilities.hammer.vigorous_bash" => imgs.hammer_vigorous_bash,
|
2024-02-22 01:16:04 +00:00
|
|
|
"common.abilities.hammer.heavy_whorl" => imgs.hammer_heavy_whorl,
|
|
|
|
"common.abilities.hammer.dual_heavy_whorl" => imgs.hammer_heavy_whorl,
|
2024-02-22 03:42:55 +00:00
|
|
|
"common.abilities.hammer.intercept" => imgs.hammer_intercept,
|
|
|
|
"common.abilities.hammer.dual_intercept" => imgs.hammer_intercept,
|
2024-02-24 03:31:31 +00:00
|
|
|
"common.abilities.hammer.retaliate" => imgs.hammer_retaliate,
|
2024-02-24 16:48:12 +00:00
|
|
|
"common.abilities.hammer.spine_cracker" => imgs.hammer_spine_cracker,
|
2024-02-24 18:05:18 +00:00
|
|
|
"common.abilities.hammer.breach" => imgs.hammer_breach,
|
2024-02-24 23:50:27 +00:00
|
|
|
"common.abilities.hammer.pile_driver" => imgs.hammer_pile_driver,
|
2024-02-25 18:42:12 +00:00
|
|
|
"common.abilities.hammer.lung_pummel" => imgs.hammer_lung_pummel,
|
2024-02-25 19:58:09 +00:00
|
|
|
"common.abilities.hammer.helm_crusher" => imgs.hammer_helm_crusher,
|
2024-03-03 18:23:43 +00:00
|
|
|
"common.abilities.hammer.iron_tempest" => imgs.hammer_iron_tempest,
|
|
|
|
"common.abilities.hammer.dual_iron_tempest" => imgs.hammer_iron_tempest,
|
2024-03-05 04:24:29 +00:00
|
|
|
"common.abilities.hammer.upheaval" => imgs.hammer_upheaval,
|
|
|
|
"common.abilities.hammer.dual_upheaval" => imgs.hammer_upheaval,
|
2024-03-27 23:45:27 +00:00
|
|
|
"common.abilities.hammer.rampart" => imgs.hammer_rampart,
|
2024-03-28 23:41:31 +00:00
|
|
|
"common.abilities.hammer.tenacity" => imgs.hammer_tenacity,
|
2024-03-29 18:37:24 +00:00
|
|
|
"common.abilities.hammer.thunderclap" => imgs.hammer_thunderclap,
|
2024-03-29 19:05:30 +00:00
|
|
|
"common.abilities.hammer.seismic_shock" => imgs.hammer_seismic_shock,
|
2024-03-30 01:06:02 +00:00
|
|
|
"common.abilities.hammer.earthshaker" => imgs.hammer_earthshaker,
|
2024-03-30 02:12:56 +00:00
|
|
|
"common.abilities.hammer.judgement" => imgs.hammer_judgement,
|
2021-11-10 22:25:37 +00:00
|
|
|
// Bow
|
|
|
|
"common.abilities.bow.charged" => imgs.bow_m1,
|
|
|
|
"common.abilities.bow.repeater" => imgs.bow_m2,
|
|
|
|
"common.abilities.bow.shotgun" => imgs.skill_bow_jump_burst,
|
|
|
|
// Staff
|
|
|
|
"common.abilities.staff.firebomb" => imgs.fireball,
|
|
|
|
"common.abilities.staff.flamethrower" => imgs.flamethrower,
|
|
|
|
"common.abilities.staff.fireshockwave" => imgs.fire_aoe,
|
|
|
|
// Sceptre
|
|
|
|
"common.abilities.sceptre.lifestealbeam" => imgs.skill_sceptre_lifesteal,
|
|
|
|
"common.abilities.sceptre.healingaura" => imgs.skill_sceptre_heal,
|
|
|
|
"common.abilities.sceptre.wardingaura" => imgs.skill_sceptre_aura,
|
|
|
|
// Shield
|
2024-02-17 03:50:23 +00:00
|
|
|
"common.abilities.shield.singlestrike" => imgs.onehshield_m1,
|
2024-02-19 22:22:55 +00:00
|
|
|
"common.abilities.shield.power_guard" => imgs.onehshield_m1,
|
2021-11-10 22:25:37 +00:00
|
|
|
// Dagger
|
|
|
|
"common.abilities.dagger.tempbasic" => imgs.onehdagger_m1,
|
2022-01-08 00:47:25 +00:00
|
|
|
// Pickaxe
|
|
|
|
"common.abilities.pick.swing" => imgs.mining,
|
2023-08-03 17:32:00 +00:00
|
|
|
// Shovel
|
|
|
|
"common.abilities.shovel.dig" => imgs.dig,
|
2022-08-28 18:48:18 +00:00
|
|
|
// Instruments
|
|
|
|
"common.abilities.music.bass" => imgs.instrument,
|
|
|
|
"common.abilities.music.flute" => imgs.instrument,
|
|
|
|
"common.abilities.music.harp" => imgs.instrument,
|
|
|
|
"common.abilities.music.perc" => imgs.instrument,
|
|
|
|
"common.abilities.music.kalimba" => imgs.instrument,
|
|
|
|
"common.abilities.music.melodica" => imgs.instrument,
|
|
|
|
"common.abilities.music.lute" => imgs.instrument,
|
2022-09-10 17:23:38 +00:00
|
|
|
"common.abilities.music.guitar" => imgs.instrument,
|
2023-01-13 13:37:45 +00:00
|
|
|
"common.abilities.music.dark_guitar" => imgs.instrument,
|
2022-08-28 18:48:18 +00:00
|
|
|
"common.abilities.music.sitar" => imgs.instrument,
|
2022-11-10 20:59:53 +00:00
|
|
|
"common.abilities.music.double_bass" => imgs.instrument,
|
|
|
|
"common.abilities.music.glass_flute" => imgs.instrument,
|
|
|
|
"common.abilities.music.lyre" => imgs.instrument,
|
2023-05-02 23:18:04 +00:00
|
|
|
"common.abilities.music.wildskin_drum" => imgs.instrument,
|
2023-01-13 13:37:45 +00:00
|
|
|
"common.abilities.music.icy_talharpa" => imgs.instrument,
|
2022-11-10 20:59:53 +00:00
|
|
|
"common.abilities.music.washboard" => imgs.instrument,
|
2024-02-15 06:08:03 +00:00
|
|
|
"common.abilities.music.steeltonguedrum" => imgs.instrument,
|
2024-01-20 17:45:23 +00:00
|
|
|
"common.abilities.music.shamisen" => imgs.instrument,
|
2024-01-27 13:40:17 +00:00
|
|
|
// Glider
|
|
|
|
"common.abilities.debug.glide_boost" => imgs.flyingrod_m2,
|
|
|
|
"common.abilities.debug.glide_speeder" => imgs.flyingrod_m1,
|
2021-11-12 04:41:01 +00:00
|
|
|
_ => imgs.not_found,
|
2021-11-10 22:25:37 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-06-25 11:23:06 +00:00
|
|
|
pub fn ability_description<'a>(
|
2022-08-06 17:47:45 +00:00
|
|
|
ability_id: &str,
|
2022-07-15 12:08:04 +00:00
|
|
|
loc: &'a Localization,
|
2022-08-06 17:47:45 +00:00
|
|
|
) -> (Cow<'a, str>, Cow<'a, str>) {
|
2022-08-19 00:18:33 +00:00
|
|
|
let ability = ability_id.replace('.', "-");
|
2022-08-06 17:47:45 +00:00
|
|
|
|
2022-08-19 00:18:33 +00:00
|
|
|
(loc.get_msg(&ability), loc.get_attr(&ability, "desc"))
|
2021-11-10 22:25:37 +00:00
|
|
|
}
|