Skip to content

Commit

Permalink
new encounters wip
Browse files Browse the repository at this point in the history
  • Loading branch information
notV4l committed Apr 11, 2024
1 parent 041bd43 commit af65e22
Show file tree
Hide file tree
Showing 26 changed files with 645 additions and 783 deletions.
8 changes: 4 additions & 4 deletions Scarb.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ token = { git = "https://github.com/notV4l/origami", branch = "erc_without_event

[scripts]
# dope_mock = "./scripts/dope_mock.sh"
katana = "katana --disable-fee --invoke-max-steps 999999999"
katana = "katana --disable-fee --invoke-max-steps 2000000"
build = "sozo build && scarb run gendojo"
gendojo = "./scripts/gen.sh"

Expand All @@ -26,17 +26,17 @@ auth_ryo421 = "./scripts/default_auth.sh ryo421"
auth_prod = "./scripts/default_auth.sh prod"

# migrate
migrate = "sozo migrate apply && scarb run gendojo && scarb run auth"
migrate = "sozo migrate apply && scarb run auth && scarb run gendojo"
migrate_ryo420 = "sozo -P ryo420 build && sozo -P ryo420 migrate apply && scarb run auth_ryo420"
migrate_ryo421 = "sozo -P ryo421 build && sozo -P ryo421 migrate apply && scarb run auth_ryo421"
migrate_prod = "sozo -P prod migrate"

# slot ryo420
slot_ryo420_katana="slot d create ryo420 katana --seed 420 --version v0.6.0 --chain-id KATANA_SLOT_420 --disable-fee true"
slot_ryo420_katana="slot d create ryo420 katana --seed 420 --version v0.6.0 --chain-id KATANA_SLOT_420 --disable-fee true --invoke-max-steps 2000000"
slot_ryo420_torii="slot d create ryo420 torii --rpc https://api.cartridge.gg/x/ryo420/katana -s 0 --version v0.6.0 --world 0x3bf84ccc82282acd4c8afbb843c9e864bf1e0770fba607595104202b938b7a4"

# slot ryo421
slot_ryo421_katana="slot d create ryo421 katana --seed 421 --version v0.6.0 --chain-id KATANA_SLOT_421 --disable-fee true"
slot_ryo421_katana="slot d create ryo421 katana --seed 421 --version v0.6.0 --chain-id KATANA_SLOT_421 --disable-fee true --invoke-max-steps 2000000"
slot_ryo421_torii="slot d create ryo421 torii --rpc https://api.cartridge.gg/x/ryo421/katana -s 0 --version v0.6.0 --world 0x3bf84ccc82282acd4c8afbb843c9e864bf1e0770fba607595104202b938b7a4"


Expand Down
8 changes: 6 additions & 2 deletions scripts/default_auth.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,12 @@ sozo -P $PROFILE execute --world $WORLD_ADDRESS $RYO_ADDRESS initialize --calld
echo "Initialized RYO!"
sleep $TX_SLEEP

sozo -P $PROFILE execute --world $WORLD_ADDRESS $CONFIG_ADDRESS initialize --wait
echo "Initialized CONFIG!"
sozo -P $PROFILE execute --world $WORLD_ADDRESS $CONFIG_ADDRESS initialize_1 --wait
echo "Initialized CONFIG 1!"
sleep $TX_SLEEP

sozo -P $PROFILE execute --world $WORLD_ADDRESS $CONFIG_ADDRESS initialize_2 --wait
echo "Initialized CONFIG 2!"
sleep $TX_SLEEP

# remove later
Expand Down
21 changes: 14 additions & 7 deletions src/config/config.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ use rollyourown::config::{

#[starknet::interface]
trait IConfig<T> {
fn initialize(self: @T);
fn initialize_1(self: @T);
fn initialize_2(self: @T);
fn get_config(self: @T) -> Config;
fn update_game_config(self: @T, game_config: GameConfig);
fn update_drug_config(self: @T, drug_config: DrugConfig);
Expand Down Expand Up @@ -69,16 +70,17 @@ mod config {

#[abi(embed_v0)]
impl ConfigImpl of super::IConfig<ContractState> {
fn initialize(self: @ContractState) {
fn initialize_1(self: @ContractState) {
// TODO checks
self.assert_caller_is_owner();

let world = self.world();

// common
initialize_game_config(world); // must be set before encounters

initialize_drug_config(world);
initialize_location_config(world);
//initialize_item_config(world);

// hustlers items
initialize_weapons_config(world);
Expand All @@ -91,12 +93,17 @@ mod config {
initialize_clothes_tiers_config(world);
initialize_feet_tiers_config(world);
initialize_transport_tiers_config(world);

}

fn initialize_2(self: @ContractState) {
// TODO checks
self.assert_caller_is_owner();

let world = self.world();

// encounters
initialize_encounter_config(world);

// game
initialize_game_config(world);
}

fn get_config(self: @ContractState) -> Config {
Expand Down Expand Up @@ -150,7 +157,7 @@ mod config {
};

//

// TODO: remove & use torii
let game_config = GameConfigImpl::get(world);

//
Expand Down
Loading

0 comments on commit af65e22

Please sign in to comment.