diff options
Diffstat (limited to 'src/client/games/slots.rs')
| -rw-r--r-- | src/client/games/slots.rs | 33 |
1 files changed, 23 insertions, 10 deletions
diff --git a/src/client/games/slots.rs b/src/client/games/slots.rs index a417e7d..ad9ef5c 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, REELS, ROWS}; | 2 | use crate::slots::{paytable_lines, LINE_NAMES, REELS, ROWS}; |
| 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; |
| @@ -81,7 +81,21 @@ impl SlotsGame { | |||
| 81 | } | 81 | } |
| 82 | match state.data.get("win_lines").map(String::as_str) { | 82 | match state.data.get("win_lines").map(String::as_str) { |
| 83 | Some(lines) if !lines.is_empty() && lines != "-" => { | 83 | Some(lines) if !lines.is_empty() && lines != "-" => { |
| 84 | format!("Winning lines: {lines}") | 84 | let named: Vec<String> = lines |
| 85 | .split(',') | ||
| 86 | .filter_map(|raw| raw.trim().parse::<usize>().ok()) | ||
| 87 | .map(|line| { | ||
| 88 | let name = line | ||
| 89 | .checked_sub(1) | ||
| 90 | .and_then(|index| LINE_NAMES.get(index)) | ||
| 91 | .copied(); | ||
| 92 | match name { | ||
| 93 | Some(name) => format!("{line} ({name})"), | ||
| 94 | None => line.to_string(), | ||
| 95 | } | ||
| 96 | }) | ||
| 97 | .collect(); | ||
| 98 | format!("Winning lines: {}", named.join(", ")) | ||
| 85 | } | 99 | } |
| 86 | _ => String::new(), | 100 | _ => String::new(), |
| 87 | } | 101 | } |
| @@ -126,15 +140,14 @@ impl Game for SlotsGame { | |||
| 126 | "SLOTS GAME\n\ | 140 | "SLOTS GAME\n\ |
| 127 | =========\n\ | 141 | =========\n\ |
| 128 | 5 reels x 3 rows, 5 paylines.\n\ | 142 | 5 reels x 3 rows, 5 paylines.\n\ |
| 129 | Match 3, 4 or 5 symbols from the left on a payline.\n\ | 143 | A win needs 3, 4 or 5 matching symbols from reel 1 on a payline.\n\ |
| 130 | \n\ | 144 | \n\ |
| 131 | Payouts (x total bet, 3/4/5 of a kind):\n\ | 145 | Payout = total bet x symbol x shape\n\ |
| 132 | C: 2 / 5 / 15\n\ | 146 | Symbols: C=1 L=2 O=3 G=4 D=6 S=10\n\ |
| 133 | L: 3 / 7 / 20\n\ | 147 | Shapes: 3 of a kind=1, 4 of a kind=3, 5 of a kind=14\n\ |
| 134 | O: 3 / 8 / 25\n\ | 148 | \n\ |
| 135 | G: 4 / 12 / 40\n\ | 149 | Lines: 1 top, 2 middle, 3 bottom, 4 V, 5 inverted V\n\ |
| 136 | D: 6 / 18 / 70\n\ | 150 | Multiple winning lines are added together.\n\ |
| 137 | S: 9 / 30 / 150\n\ | ||
| 138 | \n\ | 151 | \n\ |
| 139 | Symbols: C=Cherry, L=Lemon, O=Orange, G=Grapes, D=Diamond, S=Seven\n\ | 152 | Symbols: C=Cherry, L=Lemon, O=Orange, G=Grapes, D=Diamond, S=Seven\n\ |
| 140 | \n\ | 153 | \n\ |
