diff options
| author | salmonik <salmonik@tuta.io> | 2026-10-29 23:08:25 +0100 |
|---|---|---|
| committer | salmonik <salmonik@tuta.io> | 2026-10-29 23:08:25 +0100 |
| commit | 80d9aa13251f7f5c3d3eeaa877bc79dac4435341 (patch) | |
| tree | 62e8b341749fa0644b9877ae621583929a9c1a29 /src/client | |
| parent | v3.1.0: warn on shrink, but let a live round finish (diff) | |
| download | zagan-bet-80d9aa13251f7f5c3d3eeaa877bc79dac4435341.tar.gz zagan-bet-80d9aa13251f7f5c3d3eeaa877bc79dac4435341.zip | |
PLN changed to Kromer
Diffstat (limited to 'src/client')
| -rw-r--r-- | src/client/core.rs | 16 | ||||
| -rw-r--r-- | src/client/games/blackjack.rs | 10 | ||||
| -rw-r--r-- | src/client/games/crash.rs | 6 | ||||
| -rw-r--r-- | src/client/games/roulette.rs | 25 | ||||
| -rw-r--r-- | src/client/games/slots.rs | 10 | ||||
| -rw-r--r-- | src/client/ui.rs | 8 |
6 files changed, 37 insertions, 38 deletions
diff --git a/src/client/core.rs b/src/client/core.rs index 95fa050..54a6434 100644 --- a/src/client/core.rs +++ b/src/client/core.rs | |||
| @@ -2,12 +2,12 @@ use crate::client::games::manager::GameManager; | |||
| 2 | use crate::client::games::response::{ | 2 | use crate::client::games::response::{ |
| 3 | parse_blackjack_response, parse_crash_response, parse_roulette_response, parse_spin_response, | 3 | parse_blackjack_response, parse_crash_response, parse_roulette_response, parse_spin_response, |
| 4 | }; | 4 | }; |
| 5 | use crate::client::games::roulette::Direction; | ||
| 5 | use crate::client::ui::{ | 6 | use crate::client::ui::{ |
| 6 | command_names, completion_lines, display_width, help_lines, input_cursor_column, parse_bet_arg, | 7 | command_names, completion_lines, display_width, help_lines, input_cursor_column, parse_bet_arg, |
| 7 | record_history, | 8 | record_history, |
| 8 | }; | 9 | }; |
| 9 | use crate::crash::{multiplier_at, CrashState}; | 10 | use crate::crash::{CrashState, multiplier_at}; |
| 10 | use crate::client::games::roulette::Direction; | ||
| 11 | use crate::roulette::Bets; | 11 | use crate::roulette::Bets; |
| 12 | use std::time::{Duration, Instant}; | 12 | use std::time::{Duration, Instant}; |
| 13 | 13 | ||
| @@ -240,7 +240,7 @@ impl ClientCore { | |||
| 240 | Ok(state) => { | 240 | Ok(state) => { |
| 241 | self.game.end_game(); | 241 | self.game.end_game(); |
| 242 | let message = format!( | 242 | let message = format!( |
| 243 | "Game exited. Active hand forfeited ({} PLN lost).", | 243 | "Game exited. Active hand forfeited ({} Kr lost).", |
| 244 | state.bet | 244 | state.bet |
| 245 | ); | 245 | ); |
| 246 | vec![Effect::ClearRegion, Effect::Print(vec![message])] | 246 | vec![Effect::ClearRegion, Effect::Print(vec![message])] |
| @@ -273,7 +273,7 @@ impl ClientCore { | |||
| 273 | Ok(state) => { | 273 | Ok(state) => { |
| 274 | self.crash_started = None; | 274 | self.crash_started = None; |
| 275 | self.game.end_game(); | 275 | self.game.end_game(); |
| 276 | let message = format!("Game exited. Round forfeited ({} PLN lost).", state.bet); | 276 | let message = format!("Game exited. Round forfeited ({} Kr lost).", state.bet); |
| 277 | vec![Effect::ClearRegion, Effect::Print(vec![message])] | 277 | vec![Effect::ClearRegion, Effect::Print(vec![message])] |
| 278 | } | 278 | } |
| 279 | Err(_) if self.game.crash_status() != "running" => { | 279 | Err(_) if self.game.crash_status() != "running" => { |
| @@ -865,9 +865,9 @@ impl ClientCore { | |||
| 865 | Some(fingerprint) => { | 865 | Some(fingerprint) => { |
| 866 | effects.push(Effect::Print(vec![format!("Fingerprint: {fingerprint}")])) | 866 | effects.push(Effect::Print(vec![format!("Fingerprint: {fingerprint}")])) |
| 867 | } | 867 | } |
| 868 | None => effects.push(Effect::Print( | 868 | None => effects.push(Effect::Print(vec![ |
| 869 | vec!["Fingerprint: (not trusted)".to_string()], | 869 | "Fingerprint: (not trusted)".to_string(), |
| 870 | )), | 870 | ])), |
| 871 | } | 871 | } |
| 872 | 872 | ||
| 873 | self.pending = Some(Pending::Info); | 873 | self.pending = Some(Pending::Info); |
| @@ -953,7 +953,7 @@ fn info_lines(reply: &str) -> Vec<String> { | |||
| 953 | vec![ | 953 | vec![ |
| 954 | format!("User: {}", parts[1]), | 954 | format!("User: {}", parts[1]), |
| 955 | format!("Account: {}", parts[2]), | 955 | format!("Account: {}", parts[2]), |
| 956 | format!("Balance: {} PLN", parts[3]), | 956 | format!("Balance: {} Kr", parts[3]), |
| 957 | ] | 957 | ] |
| 958 | } else { | 958 | } else { |
| 959 | vec![reply.trim().to_string()] | 959 | vec![reply.trim().to_string()] |
diff --git a/src/client/games/blackjack.rs b/src/client/games/blackjack.rs index d5f45b3..8fa5693 100644 --- a/src/client/games/blackjack.rs +++ b/src/client/games/blackjack.rs | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | use super::traits::{Game, GameState}; | 1 | use super::traits::{Game, GameState}; |
| 2 | use crate::blackjack::{card_label, BlackjackState}; | 2 | use crate::blackjack::{BlackjackState, card_label}; |
| 3 | 3 | ||
| 4 | pub const BLACKJACK_BOARD_LINES: usize = 6; | 4 | pub const BLACKJACK_BOARD_LINES: usize = 6; |
| 5 | 5 | ||
| @@ -33,8 +33,8 @@ impl BlackjackGame { | |||
| 33 | 33 | ||
| 34 | fn result_text(result: &str, winnings: u64) -> String { | 34 | fn result_text(result: &str, winnings: u64) -> String { |
| 35 | match result { | 35 | match result { |
| 36 | "blackjack" => format!("BLACKJACK! Won {winnings} PLN"), | 36 | "blackjack" => format!("BLACKJACK! Won {winnings} Kr"), |
| 37 | "win" => format!("Win! Won {winnings} PLN"), | 37 | "win" => format!("Win! Won {winnings} Kr"), |
| 38 | "push" => "Push. Bet returned.".to_string(), | 38 | "push" => "Push. Bet returned.".to_string(), |
| 39 | "lose" => "Dealer wins.".to_string(), | 39 | "lose" => "Dealer wins.".to_string(), |
| 40 | "bust" => "Bust.".to_string(), | 40 | "bust" => "Bust.".to_string(), |
| @@ -65,7 +65,7 @@ impl Game for BlackjackGame { | |||
| 65 | .map(|hand| hand.bet) | 65 | .map(|hand| hand.bet) |
| 66 | .unwrap_or(state.bet_amount); | 66 | .unwrap_or(state.bet_amount); |
| 67 | return format!( | 67 | return format!( |
| 68 | "=== BLACKJACK ===\r\nBalance: {balance} PLN Bet: {bet} PLN\r\n\r\n\r\nERROR: {error}\r\n[Q] Quit" | 68 | "=== BLACKJACK ===\r\nBalance: {balance} Kr Bet: {bet} Kr\r\n\r\n\r\nERROR: {error}\r\n[Q] Quit" |
| 69 | ); | 69 | ); |
| 70 | } | 70 | } |
| 71 | 71 | ||
| @@ -120,7 +120,7 @@ impl Game for BlackjackGame { | |||
| 120 | }; | 120 | }; |
| 121 | 121 | ||
| 122 | format!( | 122 | format!( |
| 123 | "=== BLACKJACK ===\r\nBalance: {} PLN Bet: {} PLN\r\nDealer: {} {}\r\nYou: {} {}\r\n{}\r\n{}", | 123 | "=== BLACKJACK ===\r\nBalance: {} Kr Bet: {} Kr\r\nDealer: {} {}\r\nYou: {} {}\r\n{}\r\n{}", |
| 124 | balance, bet, dealer, dealer_total, player, player_total, text, controls | 124 | balance, bet, dealer, dealer_total, player, player_total, text, controls |
| 125 | ) | 125 | ) |
| 126 | } | 126 | } |
diff --git a/src/client/games/crash.rs b/src/client/games/crash.rs index 19733f2..383e807 100644 --- a/src/client/games/crash.rs +++ b/src/client/games/crash.rs | |||
| @@ -19,7 +19,7 @@ impl CrashGame { | |||
| 19 | "starting" => "Starting...".to_string(), | 19 | "starting" => "Starting...".to_string(), |
| 20 | "running" => "Rising... cash out before it crashes.".to_string(), | 20 | "running" => "Rising... cash out before it crashes.".to_string(), |
| 21 | "cashed" => format!( | 21 | "cashed" => format!( |
| 22 | "Cashed out at {}x Won {} PLN", | 22 | "Cashed out at {}x Won {} Kr", |
| 23 | Self::value(state, "multiplier").unwrap_or("1.00"), | 23 | Self::value(state, "multiplier").unwrap_or("1.00"), |
| 24 | Self::value(state, "payout").unwrap_or("0") | 24 | Self::value(state, "payout").unwrap_or("0") |
| 25 | ), | 25 | ), |
| @@ -55,13 +55,13 @@ impl Game for CrashGame { | |||
| 55 | 55 | ||
| 56 | if let Some(error) = Self::value(state, "error") { | 56 | if let Some(error) = Self::value(state, "error") { |
| 57 | return format!( | 57 | return format!( |
| 58 | "=== CRASH ===\r\nBalance: {balance} PLN Bet: {} PLN\r\n\r\nERROR: {error}\r\n\r\n[SPACE] Play [+/=/-] Bet [Q] Quit", | 58 | "=== CRASH ===\r\nBalance: {balance} Kr Bet: {} Kr\r\n\r\nERROR: {error}\r\n\r\n[SPACE] Play [+/=/-] Bet [Q] Quit", |
| 59 | state.bet_amount | 59 | state.bet_amount |
| 60 | ); | 60 | ); |
| 61 | } | 61 | } |
| 62 | 62 | ||
| 63 | format!( | 63 | format!( |
| 64 | "=== CRASH ===\r\nBalance: {} PLN Bet: {} PLN\r\nMultiplier: {}x\r\nPotential: {} PLN\r\n{}\r\n{}", | 64 | "=== CRASH ===\r\nBalance: {} Kr Bet: {} Kr\r\nMultiplier: {}x\r\nPotential: {} Kr\r\n{}\r\n{}", |
| 65 | balance, | 65 | balance, |
| 66 | state.bet_amount, | 66 | state.bet_amount, |
| 67 | multiplier, | 67 | multiplier, |
diff --git a/src/client/games/roulette.rs b/src/client/games/roulette.rs index 3cb1c58..96f8791 100644 --- a/src/client/games/roulette.rs +++ b/src/client/games/roulette.rs | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | use super::traits::{Game, GameState}; | 1 | use super::traits::{Game, GameState}; |
| 2 | use crate::roulette::{is_even, is_odd, BetTarget, Bets, Outside}; | 2 | use crate::roulette::{BetTarget, Bets, Outside, is_even, is_odd}; |
| 3 | 3 | ||
| 4 | pub const ROULETTE_BOARD_LINES: usize = 12; | 4 | pub const ROULETTE_BOARD_LINES: usize = 12; |
| 5 | 5 | ||
| @@ -96,7 +96,9 @@ impl Cursor { | |||
| 96 | 96 | ||
| 97 | /// Numbers the cursor would cover, for highlighting the felt. | 97 | /// Numbers the cursor would cover, for highlighting the felt. |
| 98 | pub fn numbers(&self) -> Vec<u8> { | 98 | pub fn numbers(&self) -> Vec<u8> { |
| 99 | self.target().map(|target| target.numbers()).unwrap_or_default() | 99 | self.target() |
| 100 | .map(|target| target.numbers()) | ||
| 101 | .unwrap_or_default() | ||
| 100 | } | 102 | } |
| 101 | 103 | ||
| 102 | pub fn moved(&self, direction: Direction) -> Cursor { | 104 | pub fn moved(&self, direction: Direction) -> Cursor { |
| @@ -130,9 +132,7 @@ impl Cursor { | |||
| 130 | (Cursor::Column(index), Direction::Up) => Cursor::Dozen(index), | 132 | (Cursor::Column(index), Direction::Up) => Cursor::Dozen(index), |
| 131 | (Cursor::Column(index), Direction::Down) => Cursor::Outside(index * 2), | 133 | (Cursor::Column(index), Direction::Down) => Cursor::Outside(index * 2), |
| 132 | 134 | ||
| 133 | (Cursor::Outside(index), Direction::Left) => { | 135 | (Cursor::Outside(index), Direction::Left) => Cursor::Outside(index.saturating_sub(1)), |
| 134 | Cursor::Outside(index.saturating_sub(1)) | ||
| 135 | } | ||
| 136 | (Cursor::Outside(index), Direction::Right) => { | 136 | (Cursor::Outside(index), Direction::Right) => { |
| 137 | Cursor::Outside((index + 1).min(OUTSIDE_ORDER.len() - 1)) | 137 | Cursor::Outside((index + 1).min(OUTSIDE_ORDER.len() - 1)) |
| 138 | } | 138 | } |
| @@ -249,7 +249,11 @@ impl RouletteGame { | |||
| 249 | .iter() | 249 | .iter() |
| 250 | .enumerate() | 250 | .enumerate() |
| 251 | .map(|(index, kind)| { | 251 | .map(|(index, kind)| { |
| 252 | Self::wide_cell(kind.label(), OUTSIDE_WIDTH, cursor == Cursor::Outside(index)) | 252 | Self::wide_cell( |
| 253 | kind.label(), | ||
| 254 | OUTSIDE_WIDTH, | ||
| 255 | cursor == Cursor::Outside(index), | ||
| 256 | ) | ||
| 253 | }) | 257 | }) |
| 254 | .collect() | 258 | .collect() |
| 255 | } | 259 | } |
| @@ -268,7 +272,7 @@ impl RouletteGame { | |||
| 268 | if list.chars().count() > 40 { | 272 | if list.chars().count() > 40 { |
| 269 | list = list.chars().take(39).collect::<String>() + "…"; | 273 | list = list.chars().take(39).collect::<String>() + "…"; |
| 270 | } | 274 | } |
| 271 | format!("Bets: {list} Total: {} PLN", bets.total()) | 275 | format!("Bets: {list} Total: {} Kr", bets.total()) |
| 272 | } | 276 | } |
| 273 | 277 | ||
| 274 | fn status_line(state: &GameState) -> String { | 278 | fn status_line(state: &GameState) -> String { |
| @@ -309,7 +313,7 @@ impl RouletteGame { | |||
| 309 | format!("No win at {number} {color}{parity}") | 313 | format!("No win at {number} {color}{parity}") |
| 310 | } else { | 314 | } else { |
| 311 | let profit = winnings.parse::<u64>().unwrap_or(0).saturating_sub(stake); | 315 | let profit = winnings.parse::<u64>().unwrap_or(0).saturating_sub(stake); |
| 312 | format!("Won {winnings} PLN at {number} {color}{parity} (+{profit})") | 316 | format!("Won {winnings} Kr at {number} {color}{parity} (+{profit})") |
| 313 | } | 317 | } |
| 314 | } | 318 | } |
| 315 | Some("spinning") => "Spinning...".to_string(), | 319 | Some("spinning") => "Spinning...".to_string(), |
| @@ -332,7 +336,7 @@ impl Game for RouletteGame { | |||
| 332 | 336 | ||
| 333 | let lines = [ | 337 | let lines = [ |
| 334 | "=== ROULETTE ===".to_string(), | 338 | "=== ROULETTE ===".to_string(), |
| 335 | format!("Balance: {balance} PLN Chip: {chip} PLN"), | 339 | format!("Balance: {balance} Kr Chip: {chip} Kr"), |
| 336 | Self::zero_cell(cursor), | 340 | Self::zero_cell(cursor), |
| 337 | Self::number_row(0, &covered), | 341 | Self::number_row(0, &covered), |
| 338 | Self::number_row(1, &covered), | 342 | Self::number_row(1, &covered), |
| @@ -342,8 +346,7 @@ impl Game for RouletteGame { | |||
| 342 | Self::outside_row(cursor), | 346 | Self::outside_row(cursor), |
| 343 | Self::bets_line(&bets), | 347 | Self::bets_line(&bets), |
| 344 | Self::status_line(state), | 348 | Self::status_line(state), |
| 345 | "[ARROWS] Move [ENTER] Bet [C]lear [+/-] Chip [SPACE] Spin [Q] Quit" | 349 | "[ARROWS] Move [ENTER] Bet [C]lear [+/-] Chip [SPACE] Spin [Q] Quit".to_string(), |
| 346 | .to_string(), | ||
| 347 | ]; | 350 | ]; |
| 348 | lines.join("\r\n") | 351 | lines.join("\r\n") |
| 349 | } | 352 | } |
diff --git a/src/client/games/slots.rs b/src/client/games/slots.rs index 2ec354e..5bffc4c 100644 --- a/src/client/games/slots.rs +++ b/src/client/games/slots.rs | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | use super::traits::{Game, GamePhase, GameState}; | 1 | use super::traits::{Game, GamePhase, GameState}; |
| 2 | use crate::slots::{paytable_lines, LINE_NAMES, REELS, ROWS}; | 2 | use crate::slots::{LINE_NAMES, REELS, ROWS, paytable_lines}; |
| 3 | 3 | ||
| 4 | /// Height of the game board. It must never depend on the spin result. | 4 | /// Height of the game board. It must never depend on the spin result. |
| 5 | pub const SLOT_BOARD_LINES: usize = 10; | 5 | pub const SLOT_BOARD_LINES: usize = 10; |
| @@ -65,9 +65,9 @@ impl SlotsGame { | |||
| 65 | .unwrap_or("0"); | 65 | .unwrap_or("0"); |
| 66 | if winnings != "0" { | 66 | if winnings != "0" { |
| 67 | return match state.data.get("win_type").map(String::as_str) { | 67 | return match state.data.get("win_type").map(String::as_str) { |
| 68 | Some("mega") => format!("MEGA WIN! {winnings} PLN"), | 68 | Some("mega") => format!("MEGA WIN! {winnings} Kr"), |
| 69 | Some("big") => format!("BIG WIN! {winnings} PLN"), | 69 | Some("big") => format!("BIG WIN! {winnings} Kr"), |
| 70 | _ => format!("Won {winnings} PLN"), | 70 | _ => format!("Won {winnings} Kr"), |
| 71 | }; | 71 | }; |
| 72 | } | 72 | } |
| 73 | return "No win.".to_string(); | 73 | return "No win.".to_string(); |
| @@ -115,7 +115,7 @@ impl Game for SlotsGame { | |||
| 115 | let paytable = paytable_lines(); | 115 | let paytable = paytable_lines(); |
| 116 | 116 | ||
| 117 | format!( | 117 | format!( |
| 118 | "=== SLOTS ===\r\nBet: {} PLN Balance: {} PLN\r\n{}\r\n{}\r\n{}\r\n{}\r\n{}\r\n{}\r\n{}\r\n[+/-] Bet [SPACE] Spin [Q] Quit", | 118 | "=== SLOTS ===\r\nBet: {} Kr Balance: {} Kr\r\n{}\r\n{}\r\n{}\r\n{}\r\n{}\r\n{}\r\n{}\r\n[+/-] Bet [SPACE] Spin [Q] Quit", |
| 119 | state.bet_amount, | 119 | state.bet_amount, |
| 120 | balance, | 120 | balance, |
| 121 | grid[0], | 121 | grid[0], |
diff --git a/src/client/ui.rs b/src/client/ui.rs index ca001c2..e7f510b 100644 --- a/src/client/ui.rs +++ b/src/client/ui.rs | |||
| @@ -145,7 +145,7 @@ pub fn parse_bet_arg(raw: &str) -> Result<u64, String> { | |||
| 145 | .parse::<u64>() | 145 | .parse::<u64>() |
| 146 | .map_err(|_| format!("Invalid bet: {raw}"))?; | 146 | .map_err(|_| format!("Invalid bet: {raw}"))?; |
| 147 | if bet < 10 { | 147 | if bet < 10 { |
| 148 | return Err("Bet must be at least 10 PLN".to_string()); | 148 | return Err("Bet must be at least 10 Kr".to_string()); |
| 149 | } | 149 | } |
| 150 | Ok(bet) | 150 | Ok(bet) |
| 151 | } | 151 | } |
| @@ -189,11 +189,7 @@ fn char_width(c: char) -> usize { | |||
| 189 | if is_zero_width(cp) || is_combining(cp) { | 189 | if is_zero_width(cp) || is_combining(cp) { |
| 190 | return 0; | 190 | return 0; |
| 191 | } | 191 | } |
| 192 | if is_wide(cp) { | 192 | if is_wide(cp) { 2 } else { 1 } |
| 193 | 2 | ||
| 194 | } else { | ||
| 195 | 1 | ||
| 196 | } | ||
| 197 | } | 193 | } |
| 198 | 194 | ||
| 199 | fn is_zero_width(cp: u32) -> bool { | 195 | fn is_zero_width(cp: u32) -> bool { |
