From f6034ff2dba1a8d094bdf6a4ae3cbf99c743899a Mon Sep 17 00:00:00 2001 From: broody Date: Mon, 18 Sep 2023 16:16:42 -0700 Subject: [PATCH] cairo format --- src/components/market.cairo | 4 ++-- src/systems/create.cairo | 8 ++++---- src/systems/decide.cairo | 12 ++++++------ src/systems/join.cairo | 4 +--- src/systems/set_name.cairo | 2 +- src/systems/travel.cairo | 3 +-- 6 files changed, 15 insertions(+), 18 deletions(-) diff --git a/src/components/market.cairo b/src/components/market.cairo index 23411d046..5c7497101 100644 --- a/src/components/market.cairo +++ b/src/components/market.cairo @@ -89,7 +89,7 @@ impl MarketImpl of MarketTrait { } } else { panic(array!['invalid drug_id']); - PricingInfos { min_price: 0, max_price: 0, min_qty: 0, max_qty: 0, } + PricingInfos { min_price: 0, max_price: 0, min_qty: 0, max_qty: 0, } } } } @@ -102,7 +102,7 @@ fn normalize(amount: usize, market: Market) -> (u128, u128, u128) { #[test] -#[should_panic(expected: ('not enough liquidity',))] +#[should_panic(expected: ('not enough liquidity', ))] fn test_not_enough_quantity() { let mut market = Market { game_id: 0, location_id: 0, drug_id: 0, cash: SCALING_FACTOR * 1, quantity: 1 diff --git a/src/systems/create.cairo b/src/systems/create.cairo index 3b4bea39d..f86512509 100644 --- a/src/systems/create.cairo +++ b/src/systems/create.cairo @@ -19,8 +19,7 @@ mod create_game { use rollyourown::components::location::{Location, LocationTrait}; use rollyourown::components::market::{MarketTrait}; use rollyourown::constants::{ - TRAVEL_RISK, CAPTURE_RISK, STARTING_CASH, STARTING_HEALTH, - STARTING_BAG_LIMIT + TRAVEL_RISK, CAPTURE_RISK, STARTING_CASH, STARTING_HEALTH, STARTING_BAG_LIMIT }; use rollyourown::utils::random; use debug::PrintTrait; @@ -144,8 +143,9 @@ mod create_game { // emit game created emit!( - ctx.world, - GameCreated { game_id, creator: ctx.origin, start_time, max_players, max_turns } + ctx.world, GameCreated { + game_id, creator: ctx.origin, start_time, max_players, max_turns + } ); (game_id, ctx.origin) diff --git a/src/systems/decide.cairo b/src/systems/decide.cairo index 9a447409d..e7ccc2fea 100644 --- a/src/systems/decide.cairo +++ b/src/systems/decide.cairo @@ -8,7 +8,7 @@ mod decide { use dojo::world::Context; use rollyourown::PlayerStatus; - use rollyourown::constants::{ COPS_DRUG_THRESHOLD,HEALTH_IMPACT,GANGS_PAYMENT}; + use rollyourown::constants::{COPS_DRUG_THRESHOLD, HEALTH_IMPACT, GANGS_PAYMENT}; use rollyourown::components::game::{Game, GameTrait}; use rollyourown::components::risks::{Risks, RisksTrait}; use rollyourown::components::player::{Player, PlayerTrait}; @@ -53,7 +53,7 @@ mod decide { cash_loss: u128 } - fn execute(ctx: Context, game_id: u32, action: Action, next_location_id: felt252) { + fn execute(ctx: Context, game_id: u32, action: Action, next_location_id: felt252) { let player_id = ctx.origin; let mut player = get!(ctx.world, (game_id, player_id).into(), Player); assert(player.status != PlayerStatus::Normal, 'player response not needed'); @@ -110,14 +110,14 @@ mod decide { emit!(ctx.world, Decision { game_id, player_id, action }); emit!( - ctx.world, - Consequence { game_id, player_id, outcome, health_loss, drug_loss, cash_loss } + ctx.world, Consequence { + game_id, player_id, outcome, health_loss, drug_loss, cash_loss + } ); } - - fn cops_payment(drug_count: u32) -> u128 { + fn cops_payment(drug_count: u32) -> u128 { if drug_count < COPS_DRUG_THRESHOLD + 20 { 1000_0000 // $1000 } else if drug_count < COPS_DRUG_THRESHOLD + 50 { diff --git a/src/systems/join.cairo b/src/systems/join.cairo index 320e901ea..8b4dad143 100644 --- a/src/systems/join.cairo +++ b/src/systems/join.cairo @@ -11,9 +11,7 @@ mod join_game { use rollyourown::components::game::Game; use rollyourown::components::player::Player; use rollyourown::components::location::{Location, LocationTrait}; - use rollyourown::constants::{ - STARTING_CASH, STARTING_HEALTH, STARTING_BAG_LIMIT - }; + use rollyourown::constants::{STARTING_CASH, STARTING_HEALTH, STARTING_BAG_LIMIT}; #[event] #[derive(Drop, starknet::Event)] diff --git a/src/systems/set_name.cairo b/src/systems/set_name.cairo index 2dbc455b1..1bf91d1b6 100644 --- a/src/systems/set_name.cairo +++ b/src/systems/set_name.cairo @@ -8,6 +8,6 @@ mod set_name { use rollyourown::components::name::Name; fn execute(ctx: Context, game_id: u32, player_name: felt252) { - set!(ctx.world, (Name { game_id, player_id: ctx.origin, short_string: player_name, })) + set!(ctx.world, (Name { game_id, player_id: ctx.origin, short_string: player_name, })) } } diff --git a/src/systems/travel.cairo b/src/systems/travel.cairo index c82f37f67..1a39b9aa8 100644 --- a/src/systems/travel.cairo +++ b/src/systems/travel.cairo @@ -69,8 +69,7 @@ mod travel { set!(ctx.world, (player)); emit!( - ctx.world, - Traveled { + ctx.world, Traveled { game_id, player_id, from_location: player.location_id, to_location: next_location_id } );