use crate::party::{PartyEntry, PartyInfo, PartyRenderer};
use super::{
Palette, RenderContext,
style::{RESET_COLOR, bold},
};
pub static BASE_PARTY: PartyEntry = PartyEntry {
info: PartyInfo {
id: "base",
name: "Basic Party",
description: "Just shows how many points you earned.",
cost: 0, supports_color: true,
},
renderer: PartyRenderer::Inline { render },
};
fn render(ctx: &RenderContext, palette: &Palette) -> bool {
let offset = palette.random_offset();
let color0 = palette.get_color(offset);
let color1 = palette.get_color(offset + 1);
let total = ctx.breakdown.total;
if total > 0 {
let points_word = if total == 1 { "point" } else { "points" };
let points = bold(format!("{color1}{total} party {points_word}"));
println!("🎉 {color0}You earned {points}{color0}!{RESET_COLOR}");
} else {
println!("🎉 {color0}Pushed! {color1}(already counted){RESET_COLOR}");
}
if !ctx.pack_thresholds.is_empty() {
let color2 = palette.get_color(offset + 2);
println!();
for threshold in &ctx.pack_thresholds {
let a_pack = bold(format!("{color1}a pack{color0}"));
let lifetime_points = bold(format!("{color2}{threshold} lifetime points{color0}"));
println!(" {color0}You earned {a_pack} for reaching {lifetime_points}{RESET_COLOR}!");
}
}
true
}