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},
|
2022-07-02 16:20:10 +00:00
|
|
|
ItemDefinitionId, ItemDesc, ItemKind, MaterialKind, MaterialStatManifest,
|
2021-02-25 16:25:39 +00:00
|
|
|
},
|
|
|
|
BuffKind,
|
|
|
|
},
|
|
|
|
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;
|
2021-07-29 18:47:45 +00:00
|
|
|
use i18n::Localization;
|
2021-03-28 12:27:59 +00:00
|
|
|
use std::{borrow::Cow, fmt::Write};
|
2020-07-18 00:05:28 +00:00
|
|
|
|
2021-03-24 22:17:25 +00:00
|
|
|
pub fn price_desc(
|
|
|
|
prices: &Option<SitePrices>,
|
2022-07-02 16:20:10 +00:00
|
|
|
item_definition_id: ItemDefinitionId<'_>,
|
2021-03-24 22:17:25 +00:00
|
|
|
i18n: &Localization,
|
2021-04-02 19:27:02 +00:00
|
|
|
) -> Option<(String, String, f32)> {
|
2021-03-25 04:35:33 +00:00
|
|
|
if let Some(prices) = prices {
|
2022-07-05 21:37:40 +00:00
|
|
|
if let Some(materials) = TradePricing::get_materials(&item_definition_id) {
|
2022-03-03 02:32:34 +00:00
|
|
|
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();
|
2021-04-02 19:27:02 +00:00
|
|
|
|
2022-03-03 02:32:34 +00:00
|
|
|
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 = format!(
|
|
|
|
"{} : {:0.1} {}",
|
|
|
|
i18n.get("hud.trade.buy_price"),
|
|
|
|
buyprice / coinprice,
|
|
|
|
i18n.get("hud.trade.coin"),
|
|
|
|
);
|
|
|
|
let sell_string = format!(
|
|
|
|
"{} : {:0.1} {}",
|
|
|
|
i18n.get("hud.trade.sell_price"),
|
|
|
|
sellprice / coinprice,
|
|
|
|
i18n.get("hud.trade.coin"),
|
|
|
|
);
|
|
|
|
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))
|
|
|
|
} else {
|
|
|
|
None
|
|
|
|
}
|
2021-03-24 22:17:25 +00:00
|
|
|
} else {
|
|
|
|
None
|
2021-03-25 04:35:33 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-05-05 02:53:24 +00:00
|
|
|
pub fn kind_text<'a>(kind: &ItemKind, i18n: &'a Localization) -> Cow<'a, str> {
|
|
|
|
match kind {
|
2021-07-11 18:41:52 +00:00
|
|
|
ItemKind::Armor(armor) => Cow::Borrowed(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!(
|
|
|
|
"{} {}",
|
|
|
|
i18n.get(&format!("common.weapons.{}", toolkind.identifier_name())),
|
|
|
|
i18n.get("common.kind.modular_component_partial")
|
|
|
|
))
|
|
|
|
} else {
|
|
|
|
Cow::Borrowed(i18n.get("common.kind.modular_component"))
|
|
|
|
}
|
|
|
|
},
|
2022-05-18 20:28:06 +00:00
|
|
|
ItemKind::Glider => Cow::Borrowed(i18n.get("common.kind.glider")),
|
2021-03-28 12:27:59 +00:00
|
|
|
ItemKind::Consumable { .. } => Cow::Borrowed(i18n.get("common.kind.consumable")),
|
|
|
|
ItemKind::Throwable { .. } => Cow::Borrowed(i18n.get("common.kind.throwable")),
|
|
|
|
ItemKind::Utility { .. } => Cow::Borrowed(i18n.get("common.kind.utility")),
|
|
|
|
ItemKind::Ingredient { .. } => Cow::Borrowed(i18n.get("common.kind.ingredient")),
|
|
|
|
ItemKind::Lantern { .. } => Cow::Borrowed(i18n.get("common.kind.lantern")),
|
|
|
|
ItemKind::TagExamples { .. } => Cow::Borrowed(""),
|
2021-03-02 00:45:02 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-06-07 00:51:46 +00:00
|
|
|
pub fn material_kind_text<'a>(kind: &MaterialKind, i18n: &'a Localization) -> &'a str {
|
2021-05-26 00:12:43 +00:00
|
|
|
match kind {
|
2021-06-07 00:51:46 +00:00
|
|
|
MaterialKind::Metal { .. } => i18n.get("common.material.metal"),
|
|
|
|
MaterialKind::Wood { .. } => i18n.get("common.material.wood"),
|
|
|
|
MaterialKind::Stone { .. } => i18n.get("common.material.stone"),
|
|
|
|
MaterialKind::Cloth { .. } => i18n.get("common.material.cloth"),
|
|
|
|
MaterialKind::Hide { .. } => i18n.get("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-07-28 23:19:20 +00:00
|
|
|
match &*item.kind() {
|
2021-06-30 20:48:30 +00:00
|
|
|
ItemKind::Armor(armor) => {
|
2022-07-28 23:19:20 +00:00
|
|
|
let armor_stats = armor.stats(msm);
|
|
|
|
armor_stats.energy_reward.is_some() as usize
|
|
|
|
+ armor_stats.energy_max.is_some() as usize
|
|
|
|
+ armor_stats.stealth.is_some() as usize
|
|
|
|
+ armor_stats.crit_power.is_some() as usize
|
|
|
|
+ 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
|
|
|
},
|
2022-03-19 20:22:12 +00:00
|
|
|
ItemKind::Tool(_) => 7,
|
2021-06-30 20:48:30 +00:00
|
|
|
ItemKind::Consumable { effects, .. } => effects.len(),
|
2022-03-19 19:18:38 +00:00
|
|
|
ItemKind::ModularComponent { .. } => 7,
|
2021-06-30 20:48:30 +00:00
|
|
|
_ => 0,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/// 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
|
|
|
|
pub fn consumable_desc(effects: &[Effect], i18n: &Localization) -> Vec<String> {
|
|
|
|
let mut descriptions = Vec::new();
|
2021-02-25 16:25:39 +00:00
|
|
|
|
2021-03-02 23:53:21 +00:00
|
|
|
for effect in effects {
|
2021-06-30 20:48:30 +00:00
|
|
|
let mut description = String::new();
|
2021-03-02 23:53:21 +00:00
|
|
|
if let Effect::Buff(buff) = effect {
|
2021-09-14 14:55:14 +00:00
|
|
|
let strength = buff.data.strength;
|
2021-03-03 20:31:17 +00:00
|
|
|
let dur_secs = buff.data.duration.map(|d| d.as_secs_f32());
|
|
|
|
let str_total = dur_secs.map_or(strength, |secs| strength * secs);
|
2021-03-02 23:53:21 +00:00
|
|
|
|
2021-11-13 20:25:09 +00:00
|
|
|
let format_float =
|
|
|
|
|input: f32| format!("{:.1}", input).trim_end_matches(".0").to_string();
|
|
|
|
|
2021-03-02 23:53:21 +00:00
|
|
|
let buff_desc = match buff.kind {
|
2021-03-24 01:05:14 +00:00
|
|
|
BuffKind::Saturation | BuffKind::Regeneration | BuffKind::Potion => i18n
|
|
|
|
.get("buff.stat.health")
|
2021-11-13 20:25:09 +00:00
|
|
|
.replace("{str_total}", &format_float(str_total)),
|
2021-03-24 01:05:14 +00:00
|
|
|
BuffKind::IncreaseMaxEnergy => i18n
|
2021-07-31 05:03:12 +00:00
|
|
|
.get("buff.stat.increase_max_energy")
|
2021-11-13 20:25:09 +00:00
|
|
|
.replace("{strength}", &format_float(strength)),
|
2021-03-24 01:05:14 +00:00
|
|
|
BuffKind::IncreaseMaxHealth => i18n
|
|
|
|
.get("buff.stat.increase_max_health")
|
2021-11-13 20:25:09 +00:00
|
|
|
.replace("{strength}", &format_float(strength)),
|
2021-04-11 03:49:47 +00:00
|
|
|
BuffKind::Invulnerability => i18n.get("buff.stat.invulnerability").to_string(),
|
2021-03-05 10:12:44 +00:00
|
|
|
BuffKind::Bleeding
|
2021-04-15 20:32:38 +00:00
|
|
|
| BuffKind::Burning
|
2021-03-05 10:12:44 +00:00
|
|
|
| BuffKind::CampfireHeal
|
|
|
|
| BuffKind::Cursed
|
2021-04-16 17:44:11 +00:00
|
|
|
| BuffKind::ProtectingWard
|
2021-04-24 19:01:36 +00:00
|
|
|
| BuffKind::Crippled
|
2021-05-30 15:51:47 +00:00
|
|
|
| BuffKind::Frenzied
|
2021-05-24 00:45:22 +00:00
|
|
|
| BuffKind::Frozen
|
2021-06-20 05:37:22 +00:00
|
|
|
| BuffKind::Wet
|
2021-09-02 23:57:17 +00:00
|
|
|
| BuffKind::Ensnared
|
2022-02-09 01:23:23 +00:00
|
|
|
| BuffKind::Poisoned
|
|
|
|
| BuffKind::Hastened => "".to_owned(),
|
2021-03-02 23:53:21 +00:00
|
|
|
};
|
|
|
|
|
2021-03-16 12:19:31 +00:00
|
|
|
write!(&mut description, "{}", buff_desc).unwrap();
|
2021-03-02 23:31:47 +00:00
|
|
|
|
2021-03-24 01:05:14 +00:00
|
|
|
let dur_desc = if let Some(dur_secs) = dur_secs {
|
2021-03-03 20:31:17 +00:00
|
|
|
match buff.kind {
|
2021-03-24 01:05:14 +00:00
|
|
|
BuffKind::Saturation | BuffKind::Regeneration => i18n
|
|
|
|
.get("buff.text.over_seconds")
|
2021-11-13 20:25:09 +00:00
|
|
|
.replace("{dur_secs}", &format_float(dur_secs)),
|
2021-03-03 21:10:41 +00:00
|
|
|
BuffKind::IncreaseMaxEnergy
|
|
|
|
| BuffKind::IncreaseMaxHealth
|
2021-03-24 01:05:14 +00:00
|
|
|
| BuffKind::Invulnerability => i18n
|
|
|
|
.get("buff.text.for_seconds")
|
2021-11-13 20:25:09 +00:00
|
|
|
.replace("{dur_secs}", &format_float(dur_secs)),
|
2021-03-03 21:10:41 +00:00
|
|
|
BuffKind::Bleeding
|
2021-04-15 20:32:38 +00:00
|
|
|
| BuffKind::Burning
|
2021-03-03 21:10:41 +00:00
|
|
|
| BuffKind::Potion
|
|
|
|
| BuffKind::CampfireHeal
|
2021-03-05 10:12:44 +00:00
|
|
|
| BuffKind::Cursed
|
2021-04-16 17:44:11 +00:00
|
|
|
| BuffKind::ProtectingWard
|
2021-04-24 19:01:36 +00:00
|
|
|
| BuffKind::Crippled
|
2021-05-30 15:51:47 +00:00
|
|
|
| BuffKind::Frenzied
|
2021-05-24 00:45:22 +00:00
|
|
|
| BuffKind::Frozen
|
2021-06-20 05:37:22 +00:00
|
|
|
| BuffKind::Wet
|
2021-09-02 23:57:17 +00:00
|
|
|
| BuffKind::Ensnared
|
2022-02-09 01:23:23 +00:00
|
|
|
| BuffKind::Poisoned
|
|
|
|
| BuffKind::Hastened => "".to_owned(),
|
2021-02-25 17:22:30 +00:00
|
|
|
}
|
2021-03-03 20:31:17 +00:00
|
|
|
} else if let BuffKind::Saturation | BuffKind::Regeneration = buff.kind {
|
2021-03-24 01:05:14 +00:00
|
|
|
i18n.get("buff.text.every_second").to_string()
|
2021-03-03 20:31:17 +00:00
|
|
|
} else {
|
2021-06-30 20:48:30 +00:00
|
|
|
"".to_owned()
|
2021-03-02 23:53:21 +00:00
|
|
|
};
|
|
|
|
|
2021-03-03 20:31:17 +00:00
|
|
|
write!(&mut description, " {}", dur_desc).unwrap();
|
2021-02-25 16:25:39 +00:00
|
|
|
}
|
2021-06-30 20:48:30 +00:00
|
|
|
descriptions.push(description);
|
2021-02-25 16:25:39 +00:00
|
|
|
}
|
|
|
|
|
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
|
2021-03-28 12:27:59 +00:00
|
|
|
fn armor_kind<'a>(armor: &Armor, i18n: &'a Localization) -> &'a str {
|
2020-07-18 00:05:28 +00:00
|
|
|
let kind = match armor.kind {
|
2022-05-18 20:28:06 +00:00
|
|
|
ArmorKind::Shoulder => i18n.get("hud.bag.shoulders"),
|
|
|
|
ArmorKind::Chest => i18n.get("hud.bag.chest"),
|
|
|
|
ArmorKind::Belt => i18n.get("hud.bag.belt"),
|
|
|
|
ArmorKind::Hand => i18n.get("hud.bag.hands"),
|
|
|
|
ArmorKind::Pants => i18n.get("hud.bag.legs"),
|
|
|
|
ArmorKind::Foot => i18n.get("hud.bag.feet"),
|
|
|
|
ArmorKind::Back => i18n.get("hud.bag.back"),
|
|
|
|
ArmorKind::Ring => i18n.get("hud.bag.ring"),
|
|
|
|
ArmorKind::Neck => i18n.get("hud.bag.neck"),
|
|
|
|
ArmorKind::Head => i18n.get("hud.bag.head"),
|
|
|
|
ArmorKind::Tabard => i18n.get("hud.bag.tabard"),
|
|
|
|
ArmorKind::Bag => i18n.get("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
|
2021-03-28 12:27:59 +00:00
|
|
|
fn tool_kind<'a>(tool: &Tool, i18n: &'a Localization) -> &'a str {
|
2020-08-01 20:08:30 +00:00
|
|
|
let kind = match tool.kind {
|
2021-03-24 01:05:14 +00:00
|
|
|
ToolKind::Sword => i18n.get("common.weapons.sword"),
|
|
|
|
ToolKind::Axe => i18n.get("common.weapons.axe"),
|
|
|
|
ToolKind::Hammer => i18n.get("common.weapons.hammer"),
|
|
|
|
ToolKind::Bow => i18n.get("common.weapons.bow"),
|
|
|
|
ToolKind::Dagger => i18n.get("common.weapons.dagger"),
|
|
|
|
ToolKind::Staff => i18n.get("common.weapons.staff"),
|
|
|
|
ToolKind::Sceptre => i18n.get("common.weapons.sceptre"),
|
|
|
|
ToolKind::Shield => i18n.get("common.weapons.shield"),
|
|
|
|
ToolKind::Spear => i18n.get("common.weapons.spear"),
|
2021-12-20 04:49:35 +00:00
|
|
|
ToolKind::Blowgun => i18n.get("common.weapons.blowgun"),
|
2021-04-30 19:25:08 +00:00
|
|
|
ToolKind::Natural => i18n.get("common.weapons.natural"),
|
2021-03-24 01:05:14 +00:00
|
|
|
ToolKind::Debug => i18n.get("common.tool.debug"),
|
|
|
|
ToolKind::Farming => i18n.get("common.tool.farming"),
|
|
|
|
ToolKind::Pick => i18n.get("common.tool.pick"),
|
|
|
|
ToolKind::Empty => i18n.get("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
|
2021-11-18 15:41:08 +00:00
|
|
|
pub fn tool_hands<'a>(tool: &Tool, i18n: &'a Localization) -> &'a str {
|
|
|
|
let hands = match tool.hands {
|
2021-03-24 01:05:14 +00:00
|
|
|
Hands::One => i18n.get("common.hands.one"),
|
|
|
|
Hands::Two => i18n.get("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
|
|
|
|
|
|
|
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
|
|
|
|
"common.abilities.sword.triplestrike" => imgs.twohsword_m1,
|
|
|
|
"common.abilities.sword.dash" => imgs.twohsword_m2,
|
|
|
|
"common.abilities.sword.spin" => imgs.sword_whirlwind,
|
|
|
|
// Axe
|
|
|
|
"common.abilities.axe.doublestrike" => imgs.twohaxe_m1,
|
|
|
|
"common.abilities.axe.spin" => imgs.axespin,
|
|
|
|
"common.abilities.axe.leap" => imgs.skill_axe_leap_slash,
|
|
|
|
// Hammer
|
|
|
|
"common.abilities.hammer.singlestrike" => imgs.twohhammer_m1,
|
|
|
|
"common.abilities.hammer.charged" => imgs.hammergolf,
|
|
|
|
"common.abilities.hammer.leap" => imgs.hammerleap,
|
|
|
|
// 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
|
|
|
|
"common.abilities.shield.tempbasic" => imgs.onehshield_m1,
|
|
|
|
"common.abilities.shield.block" => imgs.onehshield_m2,
|
|
|
|
// Dagger
|
|
|
|
"common.abilities.dagger.tempbasic" => imgs.onehdagger_m1,
|
2022-01-08 00:47:25 +00:00
|
|
|
// Pickaxe
|
|
|
|
"common.abilities.pick.swing" => imgs.mining,
|
2021-11-10 22:25:37 +00:00
|
|
|
|
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>(
|
|
|
|
ability_id: &'a str,
|
2022-07-15 12:08:04 +00:00
|
|
|
loc: &'a Localization,
|
2022-06-25 11:23:06 +00:00
|
|
|
) -> (Cow<'a, str>, &'a str) {
|
|
|
|
let (name, desc) = (
|
|
|
|
format!("{}.name", ability_id),
|
|
|
|
format!("{}.desc", ability_id),
|
|
|
|
);
|
|
|
|
(
|
|
|
|
Cow::Borrowed(
|
|
|
|
loc.get_or(&name, "common.abilities.unknown.name")
|
|
|
|
.unwrap_or(ability_id),
|
2021-11-12 03:37:37 +00:00
|
|
|
),
|
2022-06-25 11:23:06 +00:00
|
|
|
loc.get_or(&desc, "common.abilities.unknown.desc")
|
|
|
|
.unwrap_or(ability_id),
|
|
|
|
)
|
2021-11-10 22:25:37 +00:00
|
|
|
}
|