DEVELOPMENT ENVIRONMENT

~liljamo/deck-builder

615c3cdc32255c91d9bad1b0abd0dc26782cb731 — skye 1 year, 7 months ago 6aef1e4
feat(client): handle action seed as string
M client/src/api/game/create_action.rs => client/src/api/game/create_action.rs +2 -2
@@ 20,7 20,7 @@ struct CreateActionPost {
    invoker: String,
    target: String,
    command: String,
    seed: u64,
    seed: String,
}

pub fn create_action(


@@ 32,7 32,7 @@ pub fn create_action(
        invoker: action.invoker.to_string(),
        target: action.target.to_string(),
        command: serde_json::to_string(&action.command).unwrap(),
        seed: action.seed,
        seed: action.seed.to_string(),
    });

    Ok(res.json().unwrap())

M client/src/api/game/mod.rs => client/src/api/game/mod.rs +3 -2
@@ 51,7 51,8 @@ pub struct Action {
    pub invoker: String,
    pub target: String,
    pub command: Command,
    pub seed: u64,
    /// it's actually u64, but we handle it as a string to make psql happy
    pub seed: String,
}

impl Action {


@@ 70,7 71,7 @@ impl Action {
            invoker: invoker.to_string(),
            target: target.to_string(),
            command: command.clone(),
            seed,
            seed: seed.to_string(),
        }
    }
}

M client/src/game_status/parser.rs => client/src/game_status/parser.rs +1 -1
@@ 65,7 65,7 @@ pub fn parse(game: &Game) -> Result<GameStatus, ()> {
            Command::Draw { amount } => {
                for _ in 0..*amount {
                    if target.deck.is_empty() {
                        shuffle_discard_to_deck(target, action.seed);
                        shuffle_discard_to_deck(target, action.seed.parse::<u64>().unwrap());
                    }

                    target.hand.push(target.deck.pop()