Fix tower and price listing

This commit is contained in:
Joey Hines 2025-11-15 16:28:38 -07:00
parent 19d80030c9
commit 30767e8e0e
Signed by: joeyahines
GPG Key ID: 38BA6F25C94C9382
4 changed files with 15 additions and 7 deletions

2
Cargo.lock generated
View File

@ -1093,7 +1093,7 @@ dependencies = [
[[package]] [[package]]
name = "fren" name = "fren"
version = "2.5.0" version = "2.5.1"
dependencies = [ dependencies = [
"axum 0.8.1", "axum 0.8.1",
"base64 0.22.1", "base64 0.22.1",

View File

@ -1,6 +1,6 @@
[package] [package]
name = "fren" name = "fren"
version = "2.5.0" version = "2.5.1"
edition = "2024" edition = "2024"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

View File

@ -20,7 +20,11 @@ pub async fn improvements(ctx: Context<'_>) -> Result<(), Error> {
if let Some(improvement) = Improvements::get_improvement(&ctx.data().db, improvement_type)? if let Some(improvement) = Improvements::get_improvement(&ctx.data().db, improvement_type)?
{ {
if improvement_type.has_levels() { if improvement_type.has_levels() {
msg_builder.push(format!(" (✅ Level={}) ", improvement.level)); msg_builder.push(format!(
"({} FC Level={}) ",
improvement_type.price().separate_with_commas(),
improvement.level
));
} else { } else {
msg_builder.push(" (✅) "); msg_builder.push(" (✅) ");
} }

View File

@ -62,6 +62,7 @@ impl ImprovementType {
#[allow(clippy::match_like_matches_macro)] #[allow(clippy::match_like_matches_macro)]
match self { match self {
ImprovementType::FriendshipTower => true, ImprovementType::FriendshipTower => true,
ImprovementType::JotchuaCollegeFund => true,
_ => false, _ => false,
} }
} }
@ -138,12 +139,15 @@ impl Improvements {
let entry = improvements let entry = improvements
.improvements .improvements
.entry(improvement_type) .entry(improvement_type)
.or_insert(Improvement { level: 1 }) .or_insert(Improvement { level: 0 });
.clone();
entry.level += 1;
let level = entry.level;
db.insert(improvements)?; db.insert(improvements)?;
Ok(entry.level) Ok(level)
} }
pub fn has_improvement( pub fn has_improvement(