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/games | |
| 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 '')
| -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 |
4 files changed, 27 insertions, 24 deletions
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], |
