From f73a7588defb4cf6acbdb361163a5ca848e0538b Mon Sep 17 00:00:00 2001 From: "V.O.T" Date: Mon, 25 Dec 2023 20:14:54 +0700 Subject: [PATCH 1/7] WIP: tiles and map --- Scarb.toml | 4 +- src/models.cairo | 2 + src/models/map.cairo | 66 +++++++++++++++++++++++++++++++++ src/models/tile.cairo | 85 +++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 155 insertions(+), 2 deletions(-) create mode 100644 src/models/map.cairo create mode 100644 src/models/tile.cairo diff --git a/Scarb.toml b/Scarb.toml index d9f2d3870..19ce565b9 100644 --- a/Scarb.toml +++ b/Scarb.toml @@ -8,7 +8,7 @@ sierra-replace-ids = true [dependencies] # cubit = {git = "https://github.com/influenceth/cubit.git"} -dojo = {git = "https://github.com/dojoengine/dojo.git", tag = "v0.3.15"} +dojo = { git = "https://github.com/dojoengine/dojo.git", tag = "v0.3.15" } # dojo = {git = "https://github.com/dojoengine/dojo.git", rev = "d7f46502cba3d6462b68a4dfb07336377bca2678"} [[target.dojo]] @@ -29,6 +29,7 @@ migrate_prod = "sozo -P prod migrate" rpc_url = "http://localhost:5050" account_address = "0x517ececd29116499f4a1b64b094da79ba08dfd54a3edaa316134c41f8160973" private_key = "0x1800000000300000180000000000030000000000003006001800006600" +world_address = "0x3c877dbe4454125201bdc0c5c6dcafc5a9b3a2fc78417702a6cd5ebaf143cc3" # seed 420 # [profile.staging.tool.dojo.env] @@ -48,4 +49,3 @@ website = "https://rollyourown.preview.cartridge.gg/" icon_uri = "file://assets/icon.png" cover_uri = "file://assets/cover.png" socials.x = "https://x.com/TheDopeWars" - diff --git a/src/models.cairo b/src/models.cairo index 3e5f0854e..fa46bd885 100644 --- a/src/models.cairo +++ b/src/models.cairo @@ -7,3 +7,5 @@ mod item; mod encounter; mod leaderboard; mod ryo; +mod tile; +mod map; diff --git a/src/models/map.cairo b/src/models/map.cairo new file mode 100644 index 000000000..014378315 --- /dev/null +++ b/src/models/map.cairo @@ -0,0 +1,66 @@ +use core::traits::TryInto; +use core::option::OptionTrait; +use array::{ArrayTrait, SpanTrait, Span}; + +struct Map { + horizontal: Span, //20 + vertical: Span, //20 +} + +trait MapTrait { + fn new() -> Map; + fn get_horizontal(self: Map) -> Span; + fn get_horizontal_index(self: Map, index: u32) -> u32; + fn get_vertical(self: Map) -> Span; + fn get_vertical_index(self: Map, index: u32) -> u32; +} + +impl MapImpl of MapTrait { + fn new() -> Map { + Map { + horizontal: array![0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0].span(), + vertical: array![0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0].span(), + } + } + + fn get_horizontal(self: Map) -> Span { + self.horizontal + } + + fn get_horizontal_index(self: Map, index: u32) -> u32 { + *self.horizontal.at(index) + } + + fn get_vertical(self: Map) -> Span { + self.vertical + } + + fn get_vertical_index(self: Map, index: u32) -> u32 { + *self.vertical.at(index) + } +} + +#[cfg(test)] +mod map_test { + use core::array::SpanTrait; + use super::{Map, MapTrait}; + #[test] + #[available_gas(1000000)] + fn test_create_map_horizontal() { + let map = Map { + horizontal: array![0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0].span(), + vertical: array![0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,].span(), + }; + assert(map.get_horizontal().len() == 20, 'Horizontal length is not 20'); + } + + #[test] + #[available_gas(1000000)] + fn test_create_map_vertical() { + let map = Map { + horizontal: array![0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0].span(), + vertical: array![0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,].span(), + }; + assert(map.get_vertical().len() == 20, 'Vertical length is not 20'); + } +} diff --git a/src/models/tile.cairo b/src/models/tile.cairo new file mode 100644 index 000000000..47ed61098 --- /dev/null +++ b/src/models/tile.cairo @@ -0,0 +1,85 @@ +const STREET_TYPE: u8 = 0; +const WALL_TYPE: u8 = 1; +const PLAYER_TYPE: u8 = 2; +const COP_TYPE: u8 = 3; +const GANGSTER_TYPE: u8 = 4; + + +#[derive(Model, Copy, Drop, Serde)] +struct Tile { + #[key] + game_id: u32, + #[key] + index: u32, + _type: u8, + x: u32, + y: u32 +} + +trait TileTrait { + fn new(x: u32, y: u32, _type: u8) -> Tile; + fn is_street(self: Tile) -> bool; + fn is_wall(self: Tile) -> bool; + fn is_player(self: Tile) -> bool; + fn is_cop(self: Tile) -> bool; + fn is_gangster(self: Tile) -> bool; + fn is_zero(self: Tile) -> bool; + fn is_equal(self: Tile, b: Tile) -> bool; + fn is_close(self: Tile, b: Tile) -> bool; + fn distance(self: Tile, b: Tile) -> u32; +} + +impl TileImpl of TileTrait { + fn new(x: u32, y: u32, _type: u8) -> Tile { + Tile { game_id: 0, index: 0, x: x, y: y, _type: _type } + } + + fn is_street(self: Tile) -> bool { + self._type == STREET_TYPE + } + + fn is_wall(self: Tile) -> bool { + self._type == WALL_TYPE + } + + fn is_player(self: Tile) -> bool { + self._type == PLAYER_TYPE + } + + fn is_cop(self: Tile) -> bool { + self._type == COP_TYPE + } + + fn is_gangster(self: Tile) -> bool { + self._type == GANGSTER_TYPE + } + + fn is_zero(self: Tile) -> bool { + self.x == 0 && self.y == 0 + } + + fn is_equal(self: Tile, b: Tile) -> bool { + self.x == b.x && self.y == b.y + } + + fn is_close(self: Tile, b: Tile) -> bool { + self.distance(b) <= 1 + } + + fn distance(self: Tile, b: Tile) -> u32 { + let mut dx = 0; + if self.x > b.x { + dx = self.x - b.x; + } else { + dx = b.x - self.x; + }; + + let mut dy = 0; + if self.y > b.y { + dy = self.y - b.y; + } else { + dy = b.y - self.y; + }; + dx * dx + dy * dy + } +} From 126c304b8c50e566c5ae370cba27263e7d64b262 Mon Sep 17 00:00:00 2001 From: "V.O.T" Date: Fri, 29 Dec 2023 10:43:35 +0700 Subject: [PATCH 2/7] feat: implemented map witrh tiles --- src/models/map.cairo | 76 ++++++++++++++++---------------------------- 1 file changed, 28 insertions(+), 48 deletions(-) diff --git a/src/models/map.cairo b/src/models/map.cairo index 014378315..dd6d5a570 100644 --- a/src/models/map.cairo +++ b/src/models/map.cairo @@ -1,66 +1,46 @@ +use core::clone::Clone; +use core::box::BoxTrait; +use core::traits::Into; use core::traits::TryInto; use core::option::OptionTrait; +use rollyourown::models::tile::{Tile, TileTrait}; use array::{ArrayTrait, SpanTrait, Span}; struct Map { - horizontal: Span, //20 - vertical: Span, //20 + map: Span, } trait MapTrait { fn new() -> Map; - fn get_horizontal(self: Map) -> Span; - fn get_horizontal_index(self: Map, index: u32) -> u32; - fn get_vertical(self: Map) -> Span; - fn get_vertical_index(self: Map, index: u32) -> u32; + fn get_coordinate(ref self: Map, index: u32) -> (u32, u32); } impl MapImpl of MapTrait { fn new() -> Map { - Map { - horizontal: array![0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0].span(), - vertical: array![0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0].span(), - } - } - - fn get_horizontal(self: Map) -> Span { - self.horizontal - } - - fn get_horizontal_index(self: Map, index: u32) -> u32 { - *self.horizontal.at(index) - } - - fn get_vertical(self: Map) -> Span { - self.vertical - } - - fn get_vertical_index(self: Map, index: u32) -> u32 { - *self.vertical.at(index) - } -} - -#[cfg(test)] -mod map_test { - use core::array::SpanTrait; - use super::{Map, MapTrait}; - #[test] - #[available_gas(1000000)] - fn test_create_map_horizontal() { - let map = Map { - horizontal: array![0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0].span(), - vertical: array![0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,].span(), + let mut i: u32 = 0; + let mut map = array![]; + loop { + if i == 400 { + break; + } + if (i >= 1 || i <= 20) { + map.append(TileTrait::new(i % 20, i / 20, 1)); + } else if (i % 20 == 0) { + map.append(TileTrait::new(i % 20, i / 20, 1)); + } else { + map.append(TileTrait::new(i % 20, i / 20, 0)); + } + + i += 1; }; - assert(map.get_horizontal().len() == 20, 'Horizontal length is not 20'); + + Map { map: map.span() } } - #[test] - #[available_gas(1000000)] - fn test_create_map_vertical() { - let map = Map { - horizontal: array![0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0].span(), - vertical: array![0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,].span(), - }; - assert(map.get_vertical().len() == 20, 'Vertical length is not 20'); + fn get_coordinate(ref self: Map, index: u32) -> (u32, u32) { + let mut point = self.map.at(index); + let point_x = point.x.clone(); + let point_y = point.y.clone(); + (point_x, point_y) } } From 5dfafd1660ed284152b7c7f72a681303726bbd71 Mon Sep 17 00:00:00 2001 From: "V.O.T" Date: Fri, 29 Dec 2023 11:29:06 +0700 Subject: [PATCH 3/7] feat: cop and gangster --- src/models/cop.cairo | 23 +++++++++++++++++++++++ src/models/gangster.cairo | 23 +++++++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 src/models/cop.cairo create mode 100644 src/models/gangster.cairo diff --git a/src/models/cop.cairo b/src/models/cop.cairo new file mode 100644 index 000000000..87e7f9c2d --- /dev/null +++ b/src/models/cop.cairo @@ -0,0 +1,23 @@ +use rollyourown::models::tile::Tile; + +struct Cop { + #[key] + game_id: u32, + level: u32, + step: u32, + coordinate_x: u32, + coordinate_y: u32, +} + + +#[generate_trait] +impl CopImpl of CopTrait { + #[inline(always)] + fn new(game_id: u32, level: u32, coordinate_x: u32, coordinate_y: u32) -> Cop { + if (level == 1) { + Cop { game_id: game_id, level: level, step: 1, coordinate_x, coordinate_y } + } else { + Cop { game_id: game_id, level: level, step: 2, coordinate_x, coordinate_y } + } + } +} diff --git a/src/models/gangster.cairo b/src/models/gangster.cairo new file mode 100644 index 000000000..6847abd20 --- /dev/null +++ b/src/models/gangster.cairo @@ -0,0 +1,23 @@ +use rollyourown::models::tile::Tile; + +struct Gangster { + #[key] + game_id: u32, + level: u32, + step: u32, + coordinate_x: u32, + coordinate_y: u32, +} + + +#[generate_trait] +impl CopImpl of CopTrait { + #[inline(always)] + fn new(game_id: u32, level: u32, coordinate_x: u32, coordinate_y: u32) -> Gangster { + if (level == 1) { + Gangster { game_id: game_id, level: level, step: 1, coordinate_x, coordinate_y } + } else { + Gangster { game_id: game_id, level: level, step: 2, coordinate_x, coordinate_y } + } + } +} From e19bd8fcc4b0cd28c8563e213b4971fa84d9a970 Mon Sep 17 00:00:00 2001 From: "V.O.T" Date: Fri, 29 Dec 2023 12:23:52 +0700 Subject: [PATCH 4/7] WIP: current progress --- src/models.cairo | 2 ++ src/models/gangster.cairo | 10 +++++++--- src/systems.cairo | 3 ++- src/systems/world.cairo | 29 +++++++++++++++++++++++++++++ 4 files changed, 40 insertions(+), 4 deletions(-) create mode 100644 src/systems/world.cairo diff --git a/src/models.cairo b/src/models.cairo index fa46bd885..3c22700e4 100644 --- a/src/models.cairo +++ b/src/models.cairo @@ -9,3 +9,5 @@ mod leaderboard; mod ryo; mod tile; mod map; +mod cop; +mod gangster; diff --git a/src/models/gangster.cairo b/src/models/gangster.cairo index 6847abd20..6c79bd0ea 100644 --- a/src/models/gangster.cairo +++ b/src/models/gangster.cairo @@ -11,13 +11,17 @@ struct Gangster { #[generate_trait] -impl CopImpl of CopTrait { +impl GangsterImpl of GangsterTrait { #[inline(always)] fn new(game_id: u32, level: u32, coordinate_x: u32, coordinate_y: u32) -> Gangster { if (level == 1) { - Gangster { game_id: game_id, level: level, step: 1, coordinate_x, coordinate_y } - } else { Gangster { game_id: game_id, level: level, step: 2, coordinate_x, coordinate_y } + } else if (level == 2) { + Gangster { game_id: game_id, level: level, step: 3, coordinate_x, coordinate_y } + } else if (level == 3) { + Gangster { game_id: game_id, level: level, step: 4, coordinate_x, coordinate_y } + } else { + Gangster { game_id: game_id, level: level, step: 5, coordinate_x, coordinate_y } } } } diff --git a/src/systems.cairo b/src/systems.cairo index 18cda9d09..b9d9b2454 100644 --- a/src/systems.cairo +++ b/src/systems.cairo @@ -4,6 +4,7 @@ mod travel; mod decide; mod shop; mod ryo; - +mod world; // mod devtools; + diff --git a/src/systems/world.cairo b/src/systems/world.cairo new file mode 100644 index 000000000..5cfd93b70 --- /dev/null +++ b/src/systems/world.cairo @@ -0,0 +1,29 @@ +use starknet::ContractAddress; +use dojo::world::{IWorldDispatcher, IWorldDispatcherTrait}; +use rollyourown::models::player::Player; + +#[starknet::interface] +trait IWorldMap { + fn start(self: @TContractState, player: Player) -> (); +} + +#[dojo::contract] +mod world { + use starknet::ContractAddress; + use starknet::get_caller_address; + use rollyourown::models::player::Player; + use rollyourown::models::game::{Game, GameTrait}; + + use super::IWorldMap; + #[external(v0)] + impl WorldMapImpl of IWorldMap { + fn start(self: @ContractState, player: Player) -> () { + let world = self.world(); + let game = get!(world, game_id, Game); + assert(game.tick(), 'game cannot progress'); + + let player_id = get_caller_address(); + let mut player: Player = get!(world, (game_id, player_id).into(), Player); + } + } +} From e32ab910c0045a73295fb2c3126fcd18281e81b3 Mon Sep 17 00:00:00 2001 From: "V.O.T" Date: Sat, 30 Dec 2023 18:06:05 +0700 Subject: [PATCH 5/7] wip: current check point --- src/constants.cairo | 5 +++ src/models/map.cairo | 76 ++++++++++++++++++++++++++++---------- src/models/tile.cairo | 12 +++--- src/systems.cairo | 2 +- src/systems/minigame.cairo | 46 +++++++++++++++++++++++ src/systems/world.cairo | 29 --------------- 6 files changed, 115 insertions(+), 55 deletions(-) create mode 100644 src/systems/minigame.cairo delete mode 100644 src/systems/world.cairo diff --git a/src/constants.cairo b/src/constants.cairo index f868652c9..d71d33232 100644 --- a/src/constants.cairo +++ b/src/constants.cairo @@ -1 +1,6 @@ const SCALING_FACTOR: u128 = 10_000; +const STREET_TYPE: u8 = 0; +const WALL_TYPE: u8 = 1; +const PLAYER_TYPE: u8 = 2; +const COP_TYPE: u8 = 3; +const GANGSTER_TYPE: u8 = 4; diff --git a/src/models/map.cairo b/src/models/map.cairo index dd6d5a570..d13745cb1 100644 --- a/src/models/map.cairo +++ b/src/models/map.cairo @@ -1,3 +1,4 @@ +use core::traits::IndexView; use core::clone::Clone; use core::box::BoxTrait; use core::traits::Into; @@ -5,42 +6,79 @@ use core::traits::TryInto; use core::option::OptionTrait; use rollyourown::models::tile::{Tile, TileTrait}; use array::{ArrayTrait, SpanTrait, Span}; +use rollyourown::constants::{STREET_TYPE, WALL_TYPE, PLAYER_TYPE, COP_TYPE, GANGSTER_TYPE}; +use rollyourown::models::encounter::EncounterType; -struct Map { - map: Span, -} -trait MapTrait { - fn new() -> Map; - fn get_coordinate(ref self: Map, index: u32) -> (u32, u32); -} +struct Map {} +#[generate_trait] impl MapImpl of MapTrait { - fn new() -> Map { + fn new(player_position: u8, enemy_type: EncounterType, enemy_position: u32) -> Span { let mut i: u32 = 0; let mut map = array![]; loop { if i == 400 { break; } - if (i >= 1 || i <= 20) { - map.append(TileTrait::new(i % 20, i / 20, 1)); + if (i >= 0 || i <= 20) { + map.append(TileTrait::new(i % 20, i / 20, WALL_TYPE)); } else if (i % 20 == 0) { - map.append(TileTrait::new(i % 20, i / 20, 1)); + map.append(TileTrait::new(i % 20, i / 20, WALL_TYPE)); } else { - map.append(TileTrait::new(i % 20, i / 20, 0)); + if (i == player_position.into()) { + map.append(TileTrait::new(i % 20, i / 20, PLAYER_TYPE)); + } else if (i == enemy_position) { + match enemy_type { + EncounterType::Gang => { + map.append(TileTrait::new(i % 20, i / 20, GANGSTER_TYPE)); + }, + EncounterType::Cops => { + map.append(TileTrait::new(i % 20, i / 20, COP_TYPE)); + }, + } + } else { + map.append(TileTrait::new(i % 20, i / 20, STREET_TYPE)); + } } i += 1; }; - Map { map: map.span() } + map.span() } +// fn replace_tile(ref self: Map, index: u32, _type: u8) { +// let mut new_tiles = array![]; // Assuming this creates a new Array +// let mut i: u32 = 0; - fn get_coordinate(ref self: Map, index: u32) -> (u32, u32) { - let mut point = self.map.at(index); - let point_x = point.x.clone(); - let point_y = point.y.clone(); - (point_x, point_y) - } +// // Copy tiles from the old map to the new one, replacing the specified tile +// loop { +// if i == 400 { +// break; +// } +// if (i >= 1 || i <= 20) { +// new_tiles.append(TileTrait::new(i % 20, i / 20, 1)); +// } else if (i % 20 == 0) { +// new_tiles.append(TileTrait::new(i % 20, i / 20, 1)); +// } else { +// if (i == index) { +// new_tiles.append(TileTrait::new(i % 20, i / 20, _type)); +// } else { +// new_tiles.append(TileTrait::new(i % 20, i / 20, 0)); +// } +// } + +// i += 1; +// }; + +// self.map = new_tiles.span(); // Update the map with the new Span +// } + +// fn get_coordinate(ref self: Map, index: u32) -> (u32, u32) { +// let mut point = self.map.at(index); +// let point_x = point.x.clone(); +// let point_y = point.y.clone(); +// (point_x, point_y) +// } } + diff --git a/src/models/tile.cairo b/src/models/tile.cairo index 47ed61098..634ed9ba6 100644 --- a/src/models/tile.cairo +++ b/src/models/tile.cairo @@ -1,9 +1,4 @@ -const STREET_TYPE: u8 = 0; -const WALL_TYPE: u8 = 1; -const PLAYER_TYPE: u8 = 2; -const COP_TYPE: u8 = 3; -const GANGSTER_TYPE: u8 = 4; - +use rollyourown::constants::{STREET_TYPE, WALL_TYPE, PLAYER_TYPE, COP_TYPE, GANGSTER_TYPE}; #[derive(Model, Copy, Drop, Serde)] struct Tile { @@ -27,6 +22,7 @@ trait TileTrait { fn is_equal(self: Tile, b: Tile) -> bool; fn is_close(self: Tile, b: Tile) -> bool; fn distance(self: Tile, b: Tile) -> u32; + fn calculate_index(self: Tile) -> u32; } impl TileImpl of TileTrait { @@ -82,4 +78,8 @@ impl TileImpl of TileTrait { }; dx * dx + dy * dy } + + fn calculate_index(self: Tile) -> u32 { + self.y * 20 + self.x + } } diff --git a/src/systems.cairo b/src/systems.cairo index b9d9b2454..326e77d63 100644 --- a/src/systems.cairo +++ b/src/systems.cairo @@ -4,7 +4,7 @@ mod travel; mod decide; mod shop; mod ryo; -mod world; +mod minigame; // mod devtools; diff --git a/src/systems/minigame.cairo b/src/systems/minigame.cairo new file mode 100644 index 000000000..4322dda0c --- /dev/null +++ b/src/systems/minigame.cairo @@ -0,0 +1,46 @@ +use starknet::ContractAddress; +use dojo::world::{IWorldDispatcher, IWorldDispatcherTrait}; +use rollyourown::models::player::Player; +use rollyourown::models::encounter::EncounterType; + +#[starknet::interface] +trait IMiniGame { + fn start( + self: @TContractState, game_id: u32, player: Player, encounter_id: EncounterType + ) -> (); +} + +#[dojo::contract] +mod minigame { + use starknet::ContractAddress; + use starknet::get_caller_address; + use rollyourown::models::player::Player; + use rollyourown::models::game::{Game, GameTrait}; + use rollyourown::models::encounter::EncounterType; + use rollyourown::constants::{COP_TYPE, GANGSTER_TYPE}; + use rollyourown::utils::random::{Random, RandomImpl, RandomTrait}; + use rollyourown::models::tile::{Tile, TileTrait}; + + use super::IMiniGame; + use rollyourown::models::map::{Map, MapTrait}; + #[external(v0)] + impl MiniGameImpl of IMiniGame { + fn start( + self: @ContractState, game_id: u32, player: Player, encounter_id: EncounterType + ) -> () { + let world = self.world(); + // let game_id = self.world().uuid(); + let game = get!(world, game_id, Game); + assert(game.tick(), 'game cannot progress'); + let mut randomizer = RandomImpl::new(world); + + let player_id = get_caller_address(); + let mut player: Player = get!(world, (game_id, player_id).into(), Player); + + let random_spawn = randomizer.between::(0, 400); + + let mut map: Span = MapTrait::new(4, encounter_id, random_spawn); + } + } +} + diff --git a/src/systems/world.cairo b/src/systems/world.cairo deleted file mode 100644 index 5cfd93b70..000000000 --- a/src/systems/world.cairo +++ /dev/null @@ -1,29 +0,0 @@ -use starknet::ContractAddress; -use dojo::world::{IWorldDispatcher, IWorldDispatcherTrait}; -use rollyourown::models::player::Player; - -#[starknet::interface] -trait IWorldMap { - fn start(self: @TContractState, player: Player) -> (); -} - -#[dojo::contract] -mod world { - use starknet::ContractAddress; - use starknet::get_caller_address; - use rollyourown::models::player::Player; - use rollyourown::models::game::{Game, GameTrait}; - - use super::IWorldMap; - #[external(v0)] - impl WorldMapImpl of IWorldMap { - fn start(self: @ContractState, player: Player) -> () { - let world = self.world(); - let game = get!(world, game_id, Game); - assert(game.tick(), 'game cannot progress'); - - let player_id = get_caller_address(); - let mut player: Player = get!(world, (game_id, player_id).into(), Player); - } - } -} From f951efe4251bb3ba64b2354786d6efc1f2c9bd10 Mon Sep 17 00:00:00 2001 From: "V.O.T" Date: Sat, 30 Dec 2023 23:44:06 +0700 Subject: [PATCH 6/7] feat: implemented the map system , create func --- src/models.cairo | 1 + src/models/cop.cairo | 1 + src/models/gangster.cairo | 1 + src/models/map.cairo | 34 ++++++++++++++++++-- src/models/player_minigame.cairo | 15 +++++++++ src/models/tile.cairo | 18 +++++++++++ src/systems/minigame.cairo | 54 ++++++++++++++++++++++++++++---- 7 files changed, 116 insertions(+), 8 deletions(-) create mode 100644 src/models/player_minigame.cairo diff --git a/src/models.cairo b/src/models.cairo index 3c22700e4..fcf496541 100644 --- a/src/models.cairo +++ b/src/models.cairo @@ -9,5 +9,6 @@ mod leaderboard; mod ryo; mod tile; mod map; +mod player_minigame; mod cop; mod gangster; diff --git a/src/models/cop.cairo b/src/models/cop.cairo index 87e7f9c2d..86137a3b8 100644 --- a/src/models/cop.cairo +++ b/src/models/cop.cairo @@ -1,5 +1,6 @@ use rollyourown::models::tile::Tile; +#[derive(Model, Copy, Drop, Serde)] struct Cop { #[key] game_id: u32, diff --git a/src/models/gangster.cairo b/src/models/gangster.cairo index 6c79bd0ea..687ca3f38 100644 --- a/src/models/gangster.cairo +++ b/src/models/gangster.cairo @@ -1,5 +1,6 @@ use rollyourown::models::tile::Tile; +#[derive(Model, Copy, Drop, Serde)] struct Gangster { #[key] game_id: u32, diff --git a/src/models/map.cairo b/src/models/map.cairo index d13745cb1..f8ba71f69 100644 --- a/src/models/map.cairo +++ b/src/models/map.cairo @@ -10,11 +10,26 @@ use rollyourown::constants::{STREET_TYPE, WALL_TYPE, PLAYER_TYPE, COP_TYPE, GANG use rollyourown::models::encounter::EncounterType; -struct Map {} +#[derive(Model, Copy, Drop, Serde)] +struct Map { + #[key] + map_id: u32, + level: u32, +} + +#[derive(Serde, Copy, Drop, PartialEq)] +enum Type { + Street: (), + Wall: (), + Player: (), + Cop: (), + Gangster: (), +} + #[generate_trait] impl MapImpl of MapTrait { - fn new(player_position: u8, enemy_type: EncounterType, enemy_position: u32) -> Span { + fn new(player_position: u32, enemy_type: EncounterType, enemy_position: u32) -> Span { let mut i: u32 = 0; let mut map = array![]; loop { @@ -47,6 +62,21 @@ impl MapImpl of MapTrait { map.span() } + + fn get_type(tile: Tile, raw_type: u8) -> Type { + if raw_type == STREET_TYPE { + return Type::Street(()); + } else if raw_type == WALL_TYPE { + return Type::Wall(()); + } else if raw_type == PLAYER_TYPE { + return Type::Player(()); + } else if raw_type == COP_TYPE { + return Type::Cop(()); + } else if raw_type == GANGSTER_TYPE { + return Type::Gangster(()); + } + Type::Street(()) + } // fn replace_tile(ref self: Map, index: u32, _type: u8) { // let mut new_tiles = array![]; // Assuming this creates a new Array // let mut i: u32 = 0; diff --git a/src/models/player_minigame.cairo b/src/models/player_minigame.cairo new file mode 100644 index 000000000..93a0467da --- /dev/null +++ b/src/models/player_minigame.cairo @@ -0,0 +1,15 @@ +use starknet::ContractAddress; +use rollyourown::models::player::Player; + +#[derive(Model, Copy, Drop, Serde)] +struct PlayerMiniGame { + #[key] + game_id: u32, + #[key] + player_id: ContractAddress, + _player: Player, + position: u32, +} + +#[generate_trait] +impl PlayerMiniGameImpl of PlayerMiniGameTrait {} diff --git a/src/models/tile.cairo b/src/models/tile.cairo index 634ed9ba6..56ebc264f 100644 --- a/src/models/tile.cairo +++ b/src/models/tile.cairo @@ -11,8 +11,10 @@ struct Tile { y: u32 } + trait TileTrait { fn new(x: u32, y: u32, _type: u8) -> Tile; + fn get_tile(self: Tile) -> u8; fn is_street(self: Tile) -> bool; fn is_wall(self: Tile) -> bool; fn is_player(self: Tile) -> bool; @@ -30,6 +32,22 @@ impl TileImpl of TileTrait { Tile { game_id: 0, index: 0, x: x, y: y, _type: _type } } + fn get_tile(self: Tile) -> u8 { + if self._type == STREET_TYPE { + return STREET_TYPE; + } else if self._type == WALL_TYPE { + return WALL_TYPE; + } else if self._type == PLAYER_TYPE { + return PLAYER_TYPE; + } else if self._type == COP_TYPE { + return COP_TYPE; + } else if self._type == GANGSTER_TYPE { + return GANGSTER_TYPE; + } else { + return STREET_TYPE; + } + } + fn is_street(self: Tile) -> bool { self._type == STREET_TYPE } diff --git a/src/systems/minigame.cairo b/src/systems/minigame.cairo index 4322dda0c..e866783bf 100644 --- a/src/systems/minigame.cairo +++ b/src/systems/minigame.cairo @@ -5,9 +5,10 @@ use rollyourown::models::encounter::EncounterType; #[starknet::interface] trait IMiniGame { - fn start( + fn create( self: @TContractState, game_id: u32, player: Player, encounter_id: EncounterType ) -> (); +// fn move(self: @TContractState, game_id: u32, player: Player, index: u32) -> (); } #[dojo::contract] @@ -17,15 +18,18 @@ mod minigame { use rollyourown::models::player::Player; use rollyourown::models::game::{Game, GameTrait}; use rollyourown::models::encounter::EncounterType; - use rollyourown::constants::{COP_TYPE, GANGSTER_TYPE}; + use rollyourown::constants::{COP_TYPE, GANGSTER_TYPE, STREET_TYPE, WALL_TYPE, PLAYER_TYPE}; use rollyourown::utils::random::{Random, RandomImpl, RandomTrait}; use rollyourown::models::tile::{Tile, TileTrait}; + use rollyourown::models::player_minigame::PlayerMiniGame; + use rollyourown::models::gangster::{Gangster, GangsterTrait}; + use rollyourown::models::cop::{Cop, CopTrait}; use super::IMiniGame; - use rollyourown::models::map::{Map, MapTrait}; + use rollyourown::models::map::{Map, MapTrait, Type}; #[external(v0)] impl MiniGameImpl of IMiniGame { - fn start( + fn create( self: @ContractState, game_id: u32, player: Player, encounter_id: EncounterType ) -> () { let world = self.world(); @@ -37,10 +41,48 @@ mod minigame { let player_id = get_caller_address(); let mut player: Player = get!(world, (game_id, player_id).into(), Player); + let mut map: Map = Map { map_id: game_id, level: 1 }; + + set!(world, (map)); let random_spawn = randomizer.between::(0, 400); + let raw_map = MapTrait::new(5, encounter_id, random_spawn); + let mut index = 0; + let length = raw_map.len(); + loop { + if index == length { + break; + } + + let raw_type = *raw_map[index]; + let tile_type: Type = MapTrait::get_type(raw_type, raw_type.get_tile()); + let x: u32 = index % 20; + let y: u32 = index / 20; + let tile = Tile { game_id, index, _type: raw_type.get_tile(), x, y }; + match tile_type { + Type::Street => { set!(world, (tile)); }, + Type::Wall => { set!(world, (tile)); }, + Type::Player => { + set!(world, (tile)); + let mut player_mini: PlayerMiniGame = PlayerMiniGame { + game_id: game_id, player_id: player_id, _player: player, position: 5, + }; + set!(world, (player_mini)); + }, + Type::Cop => { + set!(world, (tile)); + let mut cop: Cop = CopTrait::new(game_id, 1, x, y); - let mut map: Span = MapTrait::new(4, encounter_id, random_spawn); + set!(world, (cop)); + }, + Type::Gangster => { + set!(world, (tile)); + let mut gangster: Gangster = GangsterTrait::new(game_id, 1, x, y); + + set!(world, (gangster)); + }, + } + index += 1; + } } } } - From 600ddae27915fb4b31114f761892014350ad6ba4 Mon Sep 17 00:00:00 2001 From: "V.O.T" Date: Sun, 31 Dec 2023 20:05:09 +0700 Subject: [PATCH 7/7] feat: changed the auth --- scripts/default_auth.sh | 8 + web/manifest.json | 1960 ++++++++++++++++++++++++++++++++------- 2 files changed, 1621 insertions(+), 347 deletions(-) diff --git a/scripts/default_auth.sh b/scripts/default_auth.sh index 5f9bc459a..e5d27c2ca 100755 --- a/scripts/default_auth.sh +++ b/scripts/default_auth.sh @@ -16,6 +16,7 @@ export DECIDE_ADDRESS=$(cat ./target/dev/manifest.json | jq -r '.contracts[] | s export TRADE_ADDRESS=$(cat ./target/dev/manifest.json | jq -r '.contracts[] | select(.name == "trade" ).address') export SHOP_ADDRESS=$(cat ./target/dev/manifest.json | jq -r '.contracts[] | select(.name == "shop" ).address') export RYO_ADDRESS=$(cat ./target/dev/manifest.json | jq -r '.contracts[] | select(.name == "ryo" ).address') +export MINI_GAME_ADDRESS=$(cat ./target/dev/manifest.json | jq -r '.contracts[] | select(.name == "minigame" ).address') echo "---------------------------------------------------------------------------" echo profile : $PROFILE @@ -28,6 +29,7 @@ echo decide: $DECIDE_ADDRESS echo trade : $TRADE_ADDRESS echo shop : $SHOP_ADDRESS echo ryo : $RYO_ADDRESS +echo minigame : $MINI_GAME_ADDRESS echo "---------------------------------------------------------------------------" # enable system -> component authorizations @@ -37,6 +39,7 @@ DECIDE_COMPONENTS=("Player" "Drug" "Market" "Encounter" "Leaderboard" "RyoMeta") TRADE_COMPONENTS=("Drug" "Market" "Player") SHOP_COMPONENTS=("Player" "Item" "Market") RYO_COMPONENTS=("RyoMeta" "Leaderboard") +MINI_GAME_COMPONENTS=("Player" "Game" "Map" "Cop" "Gangster" "PlayerMiniGame" "Tile" "Encounter") for component in ${LOBBY_COMPONENTS[@]}; do sozo -P $PROFILE auth writer $component $LOBBY_ADDRESS --world $WORLD_ADDRESS @@ -68,6 +71,11 @@ for component in ${RYO_COMPONENTS[@]}; do sleep 0.1 done +for component in ${MINI_GAME_COMPONENTS[@]}; do + sozo -P $PROFILE auth writer $component $MINI_GAME_ADDRESS --world $WORLD_ADDRESS + sleep 0.1 +done + echo "Default authorizations have been successfully set." echo "Initializing..." diff --git a/web/manifest.json b/web/manifest.json index e0b660268..c21284fdb 100644 --- a/web/manifest.json +++ b/web/manifest.json @@ -1528,9 +1528,9 @@ "computed": [] }, { - "name": "ryo", - "address": "0x442d71805e2f98dd2fd7c91d4578e019513f2848ec71236ae3aea9749ebed9", - "class_hash": "0x82e0861472ccbde2de0e89d122c183b8865844b1e832ba45686d003b32fc7e", + "name": "minigame", + "address": "0x44e56f8b0b447ee0d699bf0fb4687389eaff620ddf83fabbbcd68ec23972ca8", + "class_hash": "0x3f804c8bb4c86b52490bb27d57d572cc3a428e63d5305a2d0f2f1fe15831e91", "abi": [ { "type": "impl", @@ -1566,17 +1566,208 @@ }, { "type": "impl", - "name": "RyoExternalImpl", - "interface_name": "rollyourown::systems::ryo::IRyo" + "name": "MiniGameImpl", + "interface_name": "rollyourown::systems::minigame::IMiniGame" + }, + { + "type": "enum", + "name": "rollyourown::models::player::PlayerStatus", + "variants": [ + { + "name": "Normal", + "type": "()" + }, + { + "name": "BeingMugged", + "type": "()" + }, + { + "name": "BeingArrested", + "type": "()" + }, + { + "name": "AtPawnshop", + "type": "()" + } + ] + }, + { + "type": "enum", + "name": "rollyourown::models::location::LocationEnum", + "variants": [ + { + "name": "Home", + "type": "()" + }, + { + "name": "Queens", + "type": "()" + }, + { + "name": "Bronx", + "type": "()" + }, + { + "name": "Brooklyn", + "type": "()" + }, + { + "name": "Jersey", + "type": "()" + }, + { + "name": "Central", + "type": "()" + }, + { + "name": "Coney", + "type": "()" + } + ] + }, + { + "type": "enum", + "name": "core::bool", + "variants": [ + { + "name": "False", + "type": "()" + }, + { + "name": "True", + "type": "()" + } + ] + }, + { + "type": "struct", + "name": "rollyourown::models::player::Player", + "members": [ + { + "name": "game_id", + "type": "core::integer::u32" + }, + { + "name": "player_id", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "mainnet_address", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "name", + "type": "core::felt252" + }, + { + "name": "avatar_id", + "type": "core::integer::u8" + }, + { + "name": "status", + "type": "rollyourown::models::player::PlayerStatus" + }, + { + "name": "hood_id", + "type": "rollyourown::models::location::LocationEnum" + }, + { + "name": "location_id", + "type": "rollyourown::models::location::LocationEnum" + }, + { + "name": "next_location_id", + "type": "rollyourown::models::location::LocationEnum" + }, + { + "name": "turn", + "type": "core::integer::u32" + }, + { + "name": "max_turns", + "type": "core::integer::u32" + }, + { + "name": "max_items", + "type": "core::integer::u8" + }, + { + "name": "cash", + "type": "core::integer::u128" + }, + { + "name": "health", + "type": "core::integer::u8" + }, + { + "name": "drug_count", + "type": "core::integer::u32" + }, + { + "name": "attack", + "type": "core::integer::u32" + }, + { + "name": "defense", + "type": "core::integer::u32" + }, + { + "name": "transport", + "type": "core::integer::u32" + }, + { + "name": "speed", + "type": "core::integer::u32" + }, + { + "name": "wanted", + "type": "core::integer::u8" + }, + { + "name": "leaderboard_version", + "type": "core::integer::u32" + }, + { + "name": "game_over", + "type": "core::bool" + } + ] + }, + { + "type": "enum", + "name": "rollyourown::models::encounter::EncounterType", + "variants": [ + { + "name": "Gang", + "type": "()" + }, + { + "name": "Cops", + "type": "()" + } + ] }, { "type": "interface", - "name": "rollyourown::systems::ryo::IRyo", + "name": "rollyourown::systems::minigame::IMiniGame", "items": [ { "type": "function", - "name": "initialize", - "inputs": [], + "name": "create", + "inputs": [ + { + "name": "game_id", + "type": "core::integer::u32" + }, + { + "name": "player", + "type": "rollyourown::models::player::Player" + }, + { + "name": "encounter_id", + "type": "rollyourown::models::encounter::EncounterType" + } + ], "outputs": [], "state_mutability": "view" } @@ -1642,7 +1833,7 @@ }, { "type": "event", - "name": "rollyourown::systems::ryo::ryo::Event", + "name": "rollyourown::systems::minigame::minigame::Event", "kind": "enum", "variants": [ { @@ -1653,16 +1844,19 @@ ] } ], - "reads": [], + "reads": [ + "Game", + "Player" + ], "writes": [ - "Leaderboard" + "Map" ], "computed": [] }, { - "name": "shop", - "address": "0x4273123f2ce39a3ea67518cc2d28969bd014284637e8a5f876ca463aea45089", - "class_hash": "0x45e6d0243bf394cd9d5c673f7f3b8e1fe6c8f92827f29bd3da33cb45a45372f", + "name": "ryo", + "address": "0x442d71805e2f98dd2fd7c91d4578e019513f2848ec71236ae3aea9749ebed9", + "class_hash": "0x82e0861472ccbde2de0e89d122c183b8865844b1e832ba45686d003b32fc7e", "abi": [ { "type": "impl", @@ -1698,59 +1892,191 @@ }, { "type": "impl", - "name": "ShopExternalImpl", - "interface_name": "rollyourown::systems::shop::IShop" + "name": "RyoExternalImpl", + "interface_name": "rollyourown::systems::ryo::IRyo" }, { - "type": "enum", - "name": "core::bool", - "variants": [ - { - "name": "False", - "type": "()" - }, + "type": "interface", + "name": "rollyourown::systems::ryo::IRyo", + "items": [ { - "name": "True", - "type": "()" + "type": "function", + "name": "initialize", + "inputs": [], + "outputs": [], + "state_mutability": "view" } ] }, { - "type": "enum", - "name": "rollyourown::models::item::ItemEnum", - "variants": [ - { - "name": "Attack", - "type": "()" - }, - { - "name": "Defense", - "type": "()" - }, - { - "name": "Transport", - "type": "()" - }, + "type": "impl", + "name": "UpgradableImpl", + "interface_name": "dojo::components::upgradeable::IUpgradeable" + }, + { + "type": "interface", + "name": "dojo::components::upgradeable::IUpgradeable", + "items": [ { - "name": "Speed", - "type": "()" + "type": "function", + "name": "upgrade", + "inputs": [ + { + "name": "new_class_hash", + "type": "core::starknet::class_hash::ClassHash" + } + ], + "outputs": [], + "state_mutability": "external" } ] }, { - "type": "struct", - "name": "rollyourown::systems::shop::AvailableItem", - "members": [ - { - "name": "item_id", - "type": "core::integer::u32" - }, - { - "name": "item_type", - "type": "core::felt252" - }, + "type": "function", + "name": "dojo_resource", + "inputs": [], + "outputs": [ { - "name": "name", + "type": "core::felt252" + } + ], + "state_mutability": "view" + }, + { + "type": "event", + "name": "dojo::components::upgradeable::upgradeable::Upgraded", + "kind": "struct", + "members": [ + { + "name": "class_hash", + "type": "core::starknet::class_hash::ClassHash", + "kind": "data" + } + ] + }, + { + "type": "event", + "name": "dojo::components::upgradeable::upgradeable::Event", + "kind": "enum", + "variants": [ + { + "name": "Upgraded", + "type": "dojo::components::upgradeable::upgradeable::Upgraded", + "kind": "nested" + } + ] + }, + { + "type": "event", + "name": "rollyourown::systems::ryo::ryo::Event", + "kind": "enum", + "variants": [ + { + "name": "UpgradeableEvent", + "type": "dojo::components::upgradeable::upgradeable::Event", + "kind": "nested" + } + ] + } + ], + "reads": [], + "writes": [ + "Leaderboard" + ], + "computed": [] + }, + { + "name": "shop", + "address": "0x4273123f2ce39a3ea67518cc2d28969bd014284637e8a5f876ca463aea45089", + "class_hash": "0x45e6d0243bf394cd9d5c673f7f3b8e1fe6c8f92827f29bd3da33cb45a45372f", + "abi": [ + { + "type": "impl", + "name": "WorldProviderImpl", + "interface_name": "dojo::world::IWorldProvider" + }, + { + "type": "struct", + "name": "dojo::world::IWorldDispatcher", + "members": [ + { + "name": "contract_address", + "type": "core::starknet::contract_address::ContractAddress" + } + ] + }, + { + "type": "interface", + "name": "dojo::world::IWorldProvider", + "items": [ + { + "type": "function", + "name": "world", + "inputs": [], + "outputs": [ + { + "type": "dojo::world::IWorldDispatcher" + } + ], + "state_mutability": "view" + } + ] + }, + { + "type": "impl", + "name": "ShopExternalImpl", + "interface_name": "rollyourown::systems::shop::IShop" + }, + { + "type": "enum", + "name": "core::bool", + "variants": [ + { + "name": "False", + "type": "()" + }, + { + "name": "True", + "type": "()" + } + ] + }, + { + "type": "enum", + "name": "rollyourown::models::item::ItemEnum", + "variants": [ + { + "name": "Attack", + "type": "()" + }, + { + "name": "Defense", + "type": "()" + }, + { + "name": "Transport", + "type": "()" + }, + { + "name": "Speed", + "type": "()" + } + ] + }, + { + "type": "struct", + "name": "rollyourown::systems::shop::AvailableItem", + "members": [ + { + "name": "item_id", + "type": "core::integer::u32" + }, + { + "name": "item_type", + "type": "core::felt252" + }, + { + "name": "name", "type": "core::felt252" }, { @@ -2580,132 +2906,1107 @@ "kind": "data" }, { - "name": "demand_pct", - "type": "core::integer::u8", - "kind": "data" + "name": "demand_pct", + "type": "core::integer::u8", + "kind": "data" + } + ] + }, + { + "type": "enum", + "name": "rollyourown::models::drug::DrugEnum", + "variants": [ + { + "name": "Ludes", + "type": "()" + }, + { + "name": "Speed", + "type": "()" + }, + { + "name": "Weed", + "type": "()" + }, + { + "name": "Acid", + "type": "()" + }, + { + "name": "Heroin", + "type": "()" + }, + { + "name": "Cocaine", + "type": "()" + } + ] + }, + { + "type": "event", + "name": "rollyourown::systems::travel::travel::MarketEvent", + "kind": "struct", + "members": [ + { + "name": "game_id", + "type": "core::integer::u32", + "kind": "data" + }, + { + "name": "location_id", + "type": "rollyourown::models::location::LocationEnum", + "kind": "data" + }, + { + "name": "drug_id", + "type": "rollyourown::models::drug::DrugEnum", + "kind": "data" + }, + { + "name": "increase", + "type": "core::bool", + "kind": "data" + } + ] + }, + { + "type": "event", + "name": "rollyourown::systems::travel::travel::AtPawnshop", + "kind": "struct", + "members": [ + { + "name": "game_id", + "type": "core::integer::u32", + "kind": "key" + }, + { + "name": "player_id", + "type": "core::starknet::contract_address::ContractAddress", + "kind": "key" + } + ] + }, + { + "type": "event", + "name": "rollyourown::systems::travel::travel::Event", + "kind": "enum", + "variants": [ + { + "name": "UpgradeableEvent", + "type": "dojo::components::upgradeable::upgradeable::Event", + "kind": "nested" + }, + { + "name": "Traveled", + "type": "rollyourown::systems::travel::travel::Traveled", + "kind": "nested" + }, + { + "name": "AdverseEvent", + "type": "rollyourown::systems::travel::travel::AdverseEvent", + "kind": "nested" + }, + { + "name": "MarketEvent", + "type": "rollyourown::systems::travel::travel::MarketEvent", + "kind": "nested" + }, + { + "name": "AtPawnshop", + "type": "rollyourown::systems::travel::travel::AtPawnshop", + "kind": "nested" + } + ] + } + ], + "reads": [ + "Game", + "Player" + ], + "writes": [ + "Player" + ], + "computed": [] + } + ], + "models": [ + { + "name": "Cop", + "members": [ + { + "name": "game_id", + "type": "u32", + "key": true + }, + { + "name": "level", + "type": "u32", + "key": false + }, + { + "name": "step", + "type": "u32", + "key": false + }, + { + "name": "coordinate_x", + "type": "u32", + "key": false + }, + { + "name": "coordinate_y", + "type": "u32", + "key": false + } + ], + "class_hash": "0x3856098306fc3a130d98a47dfe380a2bee295fe58bca5108c47b451cfcd894a", + "abi": [ + { + "type": "function", + "name": "name", + "inputs": [], + "outputs": [ + { + "type": "core::felt252" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "unpacked_size", + "inputs": [], + "outputs": [ + { + "type": "core::integer::u32" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "packed_size", + "inputs": [], + "outputs": [ + { + "type": "core::integer::u32" + } + ], + "state_mutability": "view" + }, + { + "type": "struct", + "name": "core::array::Span::", + "members": [ + { + "name": "snapshot", + "type": "@core::array::Array::" + } + ] + }, + { + "type": "function", + "name": "layout", + "inputs": [], + "outputs": [ + { + "type": "core::array::Span::" + } + ], + "state_mutability": "view" + }, + { + "type": "struct", + "name": "core::array::Span::", + "members": [ + { + "name": "snapshot", + "type": "@core::array::Array::" + } + ] + }, + { + "type": "struct", + "name": "core::array::Span::>", + "members": [ + { + "name": "snapshot", + "type": "@core::array::Array::>" + } + ] + }, + { + "type": "struct", + "name": "dojo::database::introspect::Struct", + "members": [ + { + "name": "name", + "type": "core::felt252" + }, + { + "name": "attrs", + "type": "core::array::Span::" + }, + { + "name": "children", + "type": "core::array::Span::>" + } + ] + }, + { + "type": "struct", + "name": "core::array::Span::<(core::felt252, core::array::Span::)>", + "members": [ + { + "name": "snapshot", + "type": "@core::array::Array::<(core::felt252, core::array::Span::)>" + } + ] + }, + { + "type": "struct", + "name": "dojo::database::introspect::Enum", + "members": [ + { + "name": "name", + "type": "core::felt252" + }, + { + "name": "attrs", + "type": "core::array::Span::" + }, + { + "name": "children", + "type": "core::array::Span::<(core::felt252, core::array::Span::)>" + } + ] + }, + { + "type": "enum", + "name": "dojo::database::introspect::Ty", + "variants": [ + { + "name": "Primitive", + "type": "core::felt252" + }, + { + "name": "Struct", + "type": "dojo::database::introspect::Struct" + }, + { + "name": "Enum", + "type": "dojo::database::introspect::Enum" + }, + { + "name": "Tuple", + "type": "core::array::Span::>" + } + ] + }, + { + "type": "function", + "name": "schema", + "inputs": [], + "outputs": [ + { + "type": "dojo::database::introspect::Ty" + } + ], + "state_mutability": "view" + }, + { + "type": "event", + "name": "rollyourown::models::cop::cop::Event", + "kind": "enum", + "variants": [] + } + ] + }, + { + "name": "Drug", + "members": [ + { + "name": "game_id", + "type": "u32", + "key": true + }, + { + "name": "player_id", + "type": "ContractAddress", + "key": true + }, + { + "name": "drug_id", + "type": "DrugEnum", + "key": true + }, + { + "name": "quantity", + "type": "usize", + "key": false + } + ], + "class_hash": "0x1ac7fc72c0f587033f33bfa06139622daa3498b7e3b1b2b06f51a15da1ec277", + "abi": [ + { + "type": "function", + "name": "name", + "inputs": [], + "outputs": [ + { + "type": "core::felt252" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "unpacked_size", + "inputs": [], + "outputs": [ + { + "type": "core::integer::u32" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "packed_size", + "inputs": [], + "outputs": [ + { + "type": "core::integer::u32" + } + ], + "state_mutability": "view" + }, + { + "type": "struct", + "name": "core::array::Span::", + "members": [ + { + "name": "snapshot", + "type": "@core::array::Array::" + } + ] + }, + { + "type": "function", + "name": "layout", + "inputs": [], + "outputs": [ + { + "type": "core::array::Span::" + } + ], + "state_mutability": "view" + }, + { + "type": "struct", + "name": "core::array::Span::", + "members": [ + { + "name": "snapshot", + "type": "@core::array::Array::" + } + ] + }, + { + "type": "struct", + "name": "core::array::Span::>", + "members": [ + { + "name": "snapshot", + "type": "@core::array::Array::>" + } + ] + }, + { + "type": "struct", + "name": "dojo::database::introspect::Struct", + "members": [ + { + "name": "name", + "type": "core::felt252" + }, + { + "name": "attrs", + "type": "core::array::Span::" + }, + { + "name": "children", + "type": "core::array::Span::>" + } + ] + }, + { + "type": "struct", + "name": "core::array::Span::<(core::felt252, core::array::Span::)>", + "members": [ + { + "name": "snapshot", + "type": "@core::array::Array::<(core::felt252, core::array::Span::)>" + } + ] + }, + { + "type": "struct", + "name": "dojo::database::introspect::Enum", + "members": [ + { + "name": "name", + "type": "core::felt252" + }, + { + "name": "attrs", + "type": "core::array::Span::" + }, + { + "name": "children", + "type": "core::array::Span::<(core::felt252, core::array::Span::)>" + } + ] + }, + { + "type": "enum", + "name": "dojo::database::introspect::Ty", + "variants": [ + { + "name": "Primitive", + "type": "core::felt252" + }, + { + "name": "Struct", + "type": "dojo::database::introspect::Struct" + }, + { + "name": "Enum", + "type": "dojo::database::introspect::Enum" + }, + { + "name": "Tuple", + "type": "core::array::Span::>" + } + ] + }, + { + "type": "function", + "name": "schema", + "inputs": [], + "outputs": [ + { + "type": "dojo::database::introspect::Ty" + } + ], + "state_mutability": "view" + }, + { + "type": "event", + "name": "rollyourown::models::drug::drug::Event", + "kind": "enum", + "variants": [] + } + ] + }, + { + "name": "Encounter", + "members": [ + { + "name": "game_id", + "type": "u32", + "key": true + }, + { + "name": "player_id", + "type": "ContractAddress", + "key": true + }, + { + "name": "encounter_id", + "type": "EncounterType", + "key": true + }, + { + "name": "level", + "type": "u8", + "key": false + }, + { + "name": "health", + "type": "u8", + "key": false + }, + { + "name": "payout", + "type": "u128", + "key": false + }, + { + "name": "demand_pct", + "type": "u8", + "key": false + } + ], + "class_hash": "0x31062043240b6b2b8e980841ee1f4df7136bb969748086cc0be030158889b10", + "abi": [ + { + "type": "function", + "name": "name", + "inputs": [], + "outputs": [ + { + "type": "core::felt252" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "unpacked_size", + "inputs": [], + "outputs": [ + { + "type": "core::integer::u32" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "packed_size", + "inputs": [], + "outputs": [ + { + "type": "core::integer::u32" + } + ], + "state_mutability": "view" + }, + { + "type": "struct", + "name": "core::array::Span::", + "members": [ + { + "name": "snapshot", + "type": "@core::array::Array::" + } + ] + }, + { + "type": "function", + "name": "layout", + "inputs": [], + "outputs": [ + { + "type": "core::array::Span::" + } + ], + "state_mutability": "view" + }, + { + "type": "struct", + "name": "core::array::Span::", + "members": [ + { + "name": "snapshot", + "type": "@core::array::Array::" + } + ] + }, + { + "type": "struct", + "name": "core::array::Span::>", + "members": [ + { + "name": "snapshot", + "type": "@core::array::Array::>" + } + ] + }, + { + "type": "struct", + "name": "dojo::database::introspect::Struct", + "members": [ + { + "name": "name", + "type": "core::felt252" + }, + { + "name": "attrs", + "type": "core::array::Span::" + }, + { + "name": "children", + "type": "core::array::Span::>" + } + ] + }, + { + "type": "struct", + "name": "core::array::Span::<(core::felt252, core::array::Span::)>", + "members": [ + { + "name": "snapshot", + "type": "@core::array::Array::<(core::felt252, core::array::Span::)>" + } + ] + }, + { + "type": "struct", + "name": "dojo::database::introspect::Enum", + "members": [ + { + "name": "name", + "type": "core::felt252" + }, + { + "name": "attrs", + "type": "core::array::Span::" + }, + { + "name": "children", + "type": "core::array::Span::<(core::felt252, core::array::Span::)>" + } + ] + }, + { + "type": "enum", + "name": "dojo::database::introspect::Ty", + "variants": [ + { + "name": "Primitive", + "type": "core::felt252" + }, + { + "name": "Struct", + "type": "dojo::database::introspect::Struct" + }, + { + "name": "Enum", + "type": "dojo::database::introspect::Enum" + }, + { + "name": "Tuple", + "type": "core::array::Span::>" + } + ] + }, + { + "type": "function", + "name": "schema", + "inputs": [], + "outputs": [ + { + "type": "dojo::database::introspect::Ty" + } + ], + "state_mutability": "view" + }, + { + "type": "event", + "name": "rollyourown::models::encounter::encounter::Event", + "kind": "enum", + "variants": [] + } + ] + }, + { + "name": "Game", + "members": [ + { + "name": "game_id", + "type": "u32", + "key": true + }, + { + "name": "game_mode", + "type": "GameMode", + "key": false + }, + { + "name": "start_time", + "type": "u64", + "key": false + }, + { + "name": "max_players", + "type": "usize", + "key": false + }, + { + "name": "num_players", + "type": "usize", + "key": false + }, + { + "name": "max_turns", + "type": "usize", + "key": false + }, + { + "name": "creator", + "type": "ContractAddress", + "key": false + } + ], + "class_hash": "0x5e6ab12b244ddf419d01bf81e74ed839afcfb86c8fe4b5c6d642747b72c160c", + "abi": [ + { + "type": "function", + "name": "name", + "inputs": [], + "outputs": [ + { + "type": "core::felt252" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "unpacked_size", + "inputs": [], + "outputs": [ + { + "type": "core::integer::u32" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "packed_size", + "inputs": [], + "outputs": [ + { + "type": "core::integer::u32" + } + ], + "state_mutability": "view" + }, + { + "type": "struct", + "name": "core::array::Span::", + "members": [ + { + "name": "snapshot", + "type": "@core::array::Array::" + } + ] + }, + { + "type": "function", + "name": "layout", + "inputs": [], + "outputs": [ + { + "type": "core::array::Span::" + } + ], + "state_mutability": "view" + }, + { + "type": "struct", + "name": "core::array::Span::", + "members": [ + { + "name": "snapshot", + "type": "@core::array::Array::" + } + ] + }, + { + "type": "struct", + "name": "core::array::Span::>", + "members": [ + { + "name": "snapshot", + "type": "@core::array::Array::>" + } + ] + }, + { + "type": "struct", + "name": "dojo::database::introspect::Struct", + "members": [ + { + "name": "name", + "type": "core::felt252" + }, + { + "name": "attrs", + "type": "core::array::Span::" + }, + { + "name": "children", + "type": "core::array::Span::>" + } + ] + }, + { + "type": "struct", + "name": "core::array::Span::<(core::felt252, core::array::Span::)>", + "members": [ + { + "name": "snapshot", + "type": "@core::array::Array::<(core::felt252, core::array::Span::)>" + } + ] + }, + { + "type": "struct", + "name": "dojo::database::introspect::Enum", + "members": [ + { + "name": "name", + "type": "core::felt252" + }, + { + "name": "attrs", + "type": "core::array::Span::" + }, + { + "name": "children", + "type": "core::array::Span::<(core::felt252, core::array::Span::)>" + } + ] + }, + { + "type": "enum", + "name": "dojo::database::introspect::Ty", + "variants": [ + { + "name": "Primitive", + "type": "core::felt252" + }, + { + "name": "Struct", + "type": "dojo::database::introspect::Struct" + }, + { + "name": "Enum", + "type": "dojo::database::introspect::Enum" + }, + { + "name": "Tuple", + "type": "core::array::Span::>" + } + ] + }, + { + "type": "function", + "name": "schema", + "inputs": [], + "outputs": [ + { + "type": "dojo::database::introspect::Ty" + } + ], + "state_mutability": "view" + }, + { + "type": "event", + "name": "rollyourown::models::game::game::Event", + "kind": "enum", + "variants": [] + } + ] + }, + { + "name": "Gangster", + "members": [ + { + "name": "game_id", + "type": "u32", + "key": true + }, + { + "name": "level", + "type": "u32", + "key": false + }, + { + "name": "step", + "type": "u32", + "key": false + }, + { + "name": "coordinate_x", + "type": "u32", + "key": false + }, + { + "name": "coordinate_y", + "type": "u32", + "key": false + } + ], + "class_hash": "0x2282c4bfc850d88d8faf47496585948c3b2662c8b31b54c74b1d889e528380", + "abi": [ + { + "type": "function", + "name": "name", + "inputs": [], + "outputs": [ + { + "type": "core::felt252" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "unpacked_size", + "inputs": [], + "outputs": [ + { + "type": "core::integer::u32" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "packed_size", + "inputs": [], + "outputs": [ + { + "type": "core::integer::u32" + } + ], + "state_mutability": "view" + }, + { + "type": "struct", + "name": "core::array::Span::", + "members": [ + { + "name": "snapshot", + "type": "@core::array::Array::" + } + ] + }, + { + "type": "function", + "name": "layout", + "inputs": [], + "outputs": [ + { + "type": "core::array::Span::" + } + ], + "state_mutability": "view" + }, + { + "type": "struct", + "name": "core::array::Span::", + "members": [ + { + "name": "snapshot", + "type": "@core::array::Array::" } ] }, { - "type": "enum", - "name": "rollyourown::models::drug::DrugEnum", - "variants": [ - { - "name": "Ludes", - "type": "()" - }, - { - "name": "Speed", - "type": "()" - }, - { - "name": "Weed", - "type": "()" - }, - { - "name": "Acid", - "type": "()" - }, - { - "name": "Heroin", - "type": "()" - }, + "type": "struct", + "name": "core::array::Span::>", + "members": [ { - "name": "Cocaine", - "type": "()" + "name": "snapshot", + "type": "@core::array::Array::>" } ] }, { - "type": "event", - "name": "rollyourown::systems::travel::travel::MarketEvent", - "kind": "struct", + "type": "struct", + "name": "dojo::database::introspect::Struct", "members": [ { - "name": "game_id", - "type": "core::integer::u32", - "kind": "data" + "name": "name", + "type": "core::felt252" }, { - "name": "location_id", - "type": "rollyourown::models::location::LocationEnum", - "kind": "data" + "name": "attrs", + "type": "core::array::Span::" }, { - "name": "drug_id", - "type": "rollyourown::models::drug::DrugEnum", - "kind": "data" - }, + "name": "children", + "type": "core::array::Span::>" + } + ] + }, + { + "type": "struct", + "name": "core::array::Span::<(core::felt252, core::array::Span::)>", + "members": [ { - "name": "increase", - "type": "core::bool", - "kind": "data" + "name": "snapshot", + "type": "@core::array::Array::<(core::felt252, core::array::Span::)>" } ] }, { - "type": "event", - "name": "rollyourown::systems::travel::travel::AtPawnshop", - "kind": "struct", + "type": "struct", + "name": "dojo::database::introspect::Enum", "members": [ { - "name": "game_id", - "type": "core::integer::u32", - "kind": "key" + "name": "name", + "type": "core::felt252" }, { - "name": "player_id", - "type": "core::starknet::contract_address::ContractAddress", - "kind": "key" + "name": "attrs", + "type": "core::array::Span::" + }, + { + "name": "children", + "type": "core::array::Span::<(core::felt252, core::array::Span::)>" } ] }, { - "type": "event", - "name": "rollyourown::systems::travel::travel::Event", - "kind": "enum", + "type": "enum", + "name": "dojo::database::introspect::Ty", "variants": [ { - "name": "UpgradeableEvent", - "type": "dojo::components::upgradeable::upgradeable::Event", - "kind": "nested" - }, - { - "name": "Traveled", - "type": "rollyourown::systems::travel::travel::Traveled", - "kind": "nested" + "name": "Primitive", + "type": "core::felt252" }, { - "name": "AdverseEvent", - "type": "rollyourown::systems::travel::travel::AdverseEvent", - "kind": "nested" + "name": "Struct", + "type": "dojo::database::introspect::Struct" }, { - "name": "MarketEvent", - "type": "rollyourown::systems::travel::travel::MarketEvent", - "kind": "nested" + "name": "Enum", + "type": "dojo::database::introspect::Enum" }, { - "name": "AtPawnshop", - "type": "rollyourown::systems::travel::travel::AtPawnshop", - "kind": "nested" + "name": "Tuple", + "type": "core::array::Span::>" } ] + }, + { + "type": "function", + "name": "schema", + "inputs": [], + "outputs": [ + { + "type": "dojo::database::introspect::Ty" + } + ], + "state_mutability": "view" + }, + { + "type": "event", + "name": "rollyourown::models::gangster::gangster::Event", + "kind": "enum", + "variants": [] } - ], - "reads": [ - "Game", - "Player" - ], - "writes": [ - "Player" - ], - "computed": [] - } - ], - "models": [ + ] + }, { - "name": "Drug", + "name": "Item", "members": [ { "name": "game_id", @@ -2718,17 +4019,27 @@ "key": true }, { - "name": "drug_id", - "type": "DrugEnum", + "name": "item_id", + "type": "ItemEnum", "key": true }, { - "name": "quantity", + "name": "level", + "type": "u8", + "key": false + }, + { + "name": "name", + "type": "felt252", + "key": false + }, + { + "name": "value", "type": "usize", "key": false } ], - "class_hash": "0x1ac7fc72c0f587033f33bfa06139622daa3498b7e3b1b2b06f51a15da1ec277", + "class_hash": "0x794d7848aa424f9c463608c67745a5596b16fa1d90a7b46ffbb2aeac371f8a", "abi": [ { "type": "function", @@ -2885,52 +4196,32 @@ }, { "type": "event", - "name": "rollyourown::models::drug::drug::Event", + "name": "rollyourown::models::item::item::Event", "kind": "enum", "variants": [] } ] }, { - "name": "Encounter", + "name": "Leaderboard", "members": [ { - "name": "game_id", + "name": "version", "type": "u32", "key": true }, { - "name": "player_id", - "type": "ContractAddress", - "key": true - }, - { - "name": "encounter_id", - "type": "EncounterType", - "key": true - }, - { - "name": "level", - "type": "u8", - "key": false - }, - { - "name": "health", - "type": "u8", - "key": false - }, - { - "name": "payout", + "name": "high_score", "type": "u128", "key": false }, { - "name": "demand_pct", - "type": "u8", + "name": "next_version_timestamp", + "type": "u64", "key": false } ], - "class_hash": "0x31062043240b6b2b8e980841ee1f4df7136bb969748086cc0be030158889b10", + "class_hash": "0x3e00fa1dc8561c929164d616957ea96e6bb97816d45364cdd5c79251af8cb2f", "abi": [ { "type": "function", @@ -3087,52 +4378,27 @@ }, { "type": "event", - "name": "rollyourown::models::encounter::encounter::Event", + "name": "rollyourown::models::leaderboard::leaderboard::Event", "kind": "enum", "variants": [] } ] }, { - "name": "Game", + "name": "Map", "members": [ { - "name": "game_id", + "name": "map_id", "type": "u32", "key": true }, { - "name": "game_mode", - "type": "GameMode", - "key": false - }, - { - "name": "start_time", - "type": "u64", - "key": false - }, - { - "name": "max_players", - "type": "usize", - "key": false - }, - { - "name": "num_players", - "type": "usize", - "key": false - }, - { - "name": "max_turns", - "type": "usize", - "key": false - }, - { - "name": "creator", - "type": "ContractAddress", + "name": "level", + "type": "u32", "key": false } ], - "class_hash": "0x5e6ab12b244ddf419d01bf81e74ed839afcfb86c8fe4b5c6d642747b72c160c", + "class_hash": "0x14fccbbb65ce1950fa7c58caae913963ac4496a66d3bdea26164d8fe26a942", "abi": [ { "type": "function", @@ -3289,14 +4555,14 @@ }, { "type": "event", - "name": "rollyourown::models::game::game::Event", + "name": "rollyourown::models::map::map::Event", "kind": "enum", "variants": [] } ] }, { - "name": "Item", + "name": "Market", "members": [ { "name": "game_id", @@ -3304,32 +4570,27 @@ "key": true }, { - "name": "player_id", - "type": "ContractAddress", + "name": "location_id", + "type": "LocationEnum", "key": true }, { - "name": "item_id", - "type": "ItemEnum", + "name": "drug_id", + "type": "DrugEnum", "key": true }, { - "name": "level", - "type": "u8", - "key": false - }, - { - "name": "name", - "type": "felt252", + "name": "cash", + "type": "u128", "key": false }, { - "name": "value", + "name": "quantity", "type": "usize", "key": false } ], - "class_hash": "0x794d7848aa424f9c463608c67745a5596b16fa1d90a7b46ffbb2aeac371f8a", + "class_hash": "0x19ffd0eb9514e134043276dfb856e1bf47e439c6d84c28f5aad6a55392d3723", "abi": [ { "type": "function", @@ -3486,32 +4747,127 @@ }, { "type": "event", - "name": "rollyourown::models::item::item::Event", + "name": "rollyourown::models::market::market::Event", "kind": "enum", "variants": [] } ] }, { - "name": "Leaderboard", + "name": "Player", "members": [ { - "name": "version", + "name": "game_id", "type": "u32", "key": true }, { - "name": "high_score", + "name": "player_id", + "type": "ContractAddress", + "key": true + }, + { + "name": "mainnet_address", + "type": "ContractAddress", + "key": false + }, + { + "name": "name", + "type": "felt252", + "key": false + }, + { + "name": "avatar_id", + "type": "u8", + "key": false + }, + { + "name": "status", + "type": "PlayerStatus", + "key": false + }, + { + "name": "hood_id", + "type": "LocationEnum", + "key": false + }, + { + "name": "location_id", + "type": "LocationEnum", + "key": false + }, + { + "name": "next_location_id", + "type": "LocationEnum", + "key": false + }, + { + "name": "turn", + "type": "usize", + "key": false + }, + { + "name": "max_turns", + "type": "usize", + "key": false + }, + { + "name": "max_items", + "type": "u8", + "key": false + }, + { + "name": "cash", "type": "u128", "key": false }, { - "name": "next_version_timestamp", - "type": "u64", + "name": "health", + "type": "u8", + "key": false + }, + { + "name": "drug_count", + "type": "usize", + "key": false + }, + { + "name": "attack", + "type": "usize", + "key": false + }, + { + "name": "defense", + "type": "usize", + "key": false + }, + { + "name": "transport", + "type": "usize", + "key": false + }, + { + "name": "speed", + "type": "usize", + "key": false + }, + { + "name": "wanted", + "type": "u8", + "key": false + }, + { + "name": "leaderboard_version", + "type": "u32", + "key": false + }, + { + "name": "game_over", + "type": "bool", "key": false } ], - "class_hash": "0x3e00fa1dc8561c929164d616957ea96e6bb97816d45364cdd5c79251af8cb2f", + "class_hash": "0x109a09b8c547c4b751288359256c06d92f5b4abeb36ecc9d0a1c1f5d4769887", "abi": [ { "type": "function", @@ -3668,14 +5024,14 @@ }, { "type": "event", - "name": "rollyourown::models::leaderboard::leaderboard::Event", + "name": "rollyourown::models::player::player::Event", "kind": "enum", "variants": [] } ] }, { - "name": "Market", + "name": "PlayerMiniGame", "members": [ { "name": "game_id", @@ -3683,27 +5039,22 @@ "key": true }, { - "name": "location_id", - "type": "LocationEnum", - "key": true - }, - { - "name": "drug_id", - "type": "DrugEnum", + "name": "player_id", + "type": "ContractAddress", "key": true }, { - "name": "cash", - "type": "u128", + "name": "_player", + "type": "Player", "key": false }, { - "name": "quantity", - "type": "usize", + "name": "position", + "type": "u32", "key": false } ], - "class_hash": "0x19ffd0eb9514e134043276dfb856e1bf47e439c6d84c28f5aad6a55392d3723", + "class_hash": "0x31759218546f85d6d851459c8c16e044608f62c0121a0c11f5d9bdd00142722", "abi": [ { "type": "function", @@ -3860,127 +5211,32 @@ }, { "type": "event", - "name": "rollyourown::models::market::market::Event", + "name": "rollyourown::models::player_minigame::player_mini_game::Event", "kind": "enum", "variants": [] } ] }, { - "name": "Player", + "name": "RyoMeta", "members": [ { - "name": "game_id", + "name": "id", "type": "u32", "key": true }, { - "name": "player_id", - "type": "ContractAddress", - "key": true - }, - { - "name": "mainnet_address", - "type": "ContractAddress", - "key": false - }, - { - "name": "name", - "type": "felt252", - "key": false - }, - { - "name": "avatar_id", - "type": "u8", - "key": false - }, - { - "name": "status", - "type": "PlayerStatus", - "key": false - }, - { - "name": "hood_id", - "type": "LocationEnum", - "key": false - }, - { - "name": "location_id", - "type": "LocationEnum", - "key": false - }, - { - "name": "next_location_id", - "type": "LocationEnum", - "key": false - }, - { - "name": "turn", - "type": "usize", - "key": false - }, - { - "name": "max_turns", - "type": "usize", - "key": false - }, - { - "name": "max_items", - "type": "u8", - "key": false - }, - { - "name": "cash", - "type": "u128", - "key": false - }, - { - "name": "health", - "type": "u8", - "key": false - }, - { - "name": "drug_count", - "type": "usize", - "key": false - }, - { - "name": "attack", - "type": "usize", - "key": false - }, - { - "name": "defense", - "type": "usize", - "key": false - }, - { - "name": "transport", - "type": "usize", - "key": false - }, - { - "name": "speed", - "type": "usize", - "key": false - }, - { - "name": "wanted", - "type": "u8", + "name": "initialized", + "type": "bool", "key": false }, { "name": "leaderboard_version", "type": "u32", "key": false - }, - { - "name": "game_over", - "type": "bool", - "key": false } ], - "class_hash": "0x109a09b8c547c4b751288359256c06d92f5b4abeb36ecc9d0a1c1f5d4769887", + "class_hash": "0x23b8332c167af1c19572530f27f30ef0093d001dcbe8f4726ced2da896decab", "abi": [ { "type": "function", @@ -4137,32 +5393,42 @@ }, { "type": "event", - "name": "rollyourown::models::player::player::Event", + "name": "rollyourown::models::ryo::ryo_meta::Event", "kind": "enum", "variants": [] } ] }, { - "name": "RyoMeta", + "name": "Tile", "members": [ { - "name": "id", + "name": "game_id", "type": "u32", "key": true }, { - "name": "initialized", - "type": "bool", + "name": "index", + "type": "u32", + "key": true + }, + { + "name": "_type", + "type": "u8", "key": false }, { - "name": "leaderboard_version", + "name": "x", + "type": "u32", + "key": false + }, + { + "name": "y", "type": "u32", "key": false } ], - "class_hash": "0x23b8332c167af1c19572530f27f30ef0093d001dcbe8f4726ced2da896decab", + "class_hash": "0x1bfbb69d08a06d6f09d446db52fd00b0ffbca086d37478f4d71e8cf29e56c56", "abi": [ { "type": "function", @@ -4319,7 +5585,7 @@ }, { "type": "event", - "name": "rollyourown::models::ryo::ryo_meta::Event", + "name": "rollyourown::models::tile::tile::Event", "kind": "enum", "variants": [] }