Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
dubzn committed Dec 24, 2023
2 parents c1f3029 + d07e061 commit 7b58749
Show file tree
Hide file tree
Showing 29 changed files with 355 additions and 370 deletions.
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
katana:
katana --disable-fee --invoke-max-steps 4294967295

setup:
@./scripts/setup.sh

torii:
torii --world $(word 2,$(MAKECMDGOALS))
50 changes: 16 additions & 34 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,47 +1,29 @@
<p align="center">
<img alt="Dojo logo" width="650" src="https://github.com/amegakure-starknet/starkane/assets/58611754/5b8bf89e-8e4c-4316-a58c-b1e853092248">
</p>
<picture>
<source media="(prefers-color-scheme: dark)" srcset=".github/mark-dark.svg">
<img alt="Dojo logo" align="right" width="120" src=".github/mark-light.svg">
</picture>

<a href="https://twitter.com/dojostarknet">
<img src="https://img.shields.io/twitter/follow/dojostarknet?style=social"/>
</a>
<a href="https://github.com/dojoengine/dojo">
<img src="https://img.shields.io/github/stars/dojoengine/dojo?style=social"/>
</a>
# Starkane

[![discord](https://img.shields.io/badge/join-dojo-green?logo=discord&logoColor=white)](https://discord.gg/PwDa2mKhR4)
[![Telegram Chat][tg-badge]][tg-url]
## Configurar ambiente local

[tg-badge]: https://img.shields.io/endpoint?color=neon&logo=telegram&label=chat&style=flat-square&url=https%3A%2F%2Ftg.sumanjay.workers.dev%2Fdojoengine
[tg-url]: https://t.me/dojoengine
Terminal 1

# Dojo Starter: Official Guide
```bash
make katana
```

The official Dojo Starter guide, the quickest and most streamlined way to get your Dojo Autonomous World up and running. This guide will assist you with the initial setup, from cloning the repository to deploying your world.
Terminal 2

Read the full tutorial [here](https://book.dojoengine.org/cairo/hello-dojo.html)
```bash
make setup
```

---
Copiamos el World Address y lo pasamos como parametro

## Contribution
```bash
make torii <WORLD_ADDRESS>
```

This starter project is a constant work in progress and contributions are greatly appreciated!
[Playground de graphql](http://localhost:8080/graphql)

1. **Report a Bug**

- If you think you have encountered a bug, and we should know about it, feel free to report it [here](https://github.com/dojoengine/dojo-starter/issues) and we will take care of it.

2. **Request a Feature**

- You can also request for a feature [here](https://github.com/dojoengine/dojo-starter/issues), and if it's viable, it will be picked for development.

3. **Create a Pull Request**
- It can't get better then this, your pull request will be appreciated by the community.

For any other questions, feel free to reach out to us [here](https://dojoengine.org/contact).

Happy coding!
### Ya esta el ambiente configurado!
14 changes: 14 additions & 0 deletions Scarb.lock
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,14 @@ name = "alexandria_sorting"
version = "0.1.0"
source = "git+https://github.com/keep-starknet-strange/alexandria.git?rev=ecc881e2aee668332441bdfa32336e3404cf8eb1#ecc881e2aee668332441bdfa32336e3404cf8eb1"

[[package]]
name = "cc_starknet"
version = "0.1.1"
source = "git+https://github.com/CheDAOLabs/cryptsandcaverns.git?tag=v0.1.1-rc0#0ad6a6443106e176ddc1cfd4fa0ff3e0da3b82e1"
dependencies = [
"openzeppelin",
]

[[package]]
name = "dojo"
version = "0.4.1"
Expand All @@ -52,11 +60,17 @@ name = "dojo_plugin"
version = "0.3.11"
source = "git+https://github.com/dojoengine/dojo?tag=v0.3.11#1e651b5d4d3b79b14a7d8aa29a92062fcb9e6659"

[[package]]
name = "openzeppelin"
version = "0.8.0-beta.0"
source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?tag=v0.8.0-beta.0#4c95981a7178e43730f152c85a92336dc6a22d62"

[[package]]
name = "starkane"
version = "0.4.0"
dependencies = [
"alexandria_data_structures",
"alexandria_sorting",
"cc_starknet",
"dojo",
]
1 change: 1 addition & 0 deletions Scarb.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ sierra-replace-ids = true
dojo = { git = "https://github.com/dojoengine/dojo", version = "0.4.0" }
alexandria_sorting = { git = "https://github.com/keep-starknet-strange/alexandria.git", rev = "ecc881e2aee668332441bdfa32336e3404cf8eb1"}
alexandria_data_structures = { git = "https://github.com/keep-starknet-strange/alexandria.git", rev = "ecc881e2aee668332441bdfa32336e3404cf8eb1"}
cc_starknet = { git = "https://github.com/CheDAOLabs/cryptsandcaverns.git", tag = "v0.1.1-rc0" }

[[target.dojo]]

Expand Down
49 changes: 49 additions & 0 deletions scripts/setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/bin/bash

set -e

echo "sozo build && sozo migrate"
output=$(sozo build && sozo migrate)

contract_addresses=$(echo "$output" | awk '/Contract address/ {print $NF}')
world_address=$(echo "$output" | awk '/Successfully migrated World at address/ {print $NF}')

action_system=$(echo "$contract_addresses" | awk 'NR==3')
character_system=$(echo "$contract_addresses" | awk 'NR==4')
map_system=$(echo "$contract_addresses" | awk 'NR==5')
match_system=$(echo "$contract_addresses" | awk 'NR==6')
move_system=$(echo "$contract_addresses" | awk 'NR==7')
ranking_system=$(echo "$contract_addresses" | awk 'NR==8')
skill_system=$(echo "$contract_addresses" | awk 'NR==9')
stadistics_system=$(echo "$contract_addresses" | awk 'NR==10')
turn_system=$(echo "$contract_addresses" | awk 'NR==11')

echo -e "\nSystems: "
echo "action_system: $action_system"
echo "character_system: $character_system"
echo "map_system: $map_system"
echo "match_system: $match_system"
echo "move_system: $move_system"
echo "ranking_system: $ranking_system"
echo "skill_system: $skill_system"
echo "stadistics_system: $stadistics_system"
echo "turn_system: $turn_system"
echo -e "\n🎉 World Address: $world_address"

echo -e "\n Setup ..."

# [Create]
sozo execute ${character_system} init

sozo execute ${skill_system} init

sozo execute ${map_system} init

# TODO: es para pruebas
sozo execute ${character_system} mint -c 3,1,1

sozo execute ${character_system} mint -c 3,2,1

sozo execute ${match_system} init -c 2,1,3,2,3

echo -e "\n✅ Setup finish!"
2 changes: 1 addition & 1 deletion src/constants.cairo
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
fn MAP_1() -> (Array<felt252>, (u128, u128)) {
fn MAP_1() -> (Array<felt252>, (u64, u64)) {
let mut map = array![
'G',
'G',
Expand Down
6 changes: 3 additions & 3 deletions src/lib.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ mod store;
mod models {
mod entities {
mod character;
mod map;
mod map_cc;
mod skill;
}
mod data {
Expand All @@ -20,7 +20,7 @@ mod systems {
mod action_system;
mod character_system;
mod match_system;
mod map_system;
mod map_cc_system;
mod move_system;
mod turn_system;
mod ranking_system;
Expand All @@ -36,7 +36,7 @@ mod utils {
mod tests {
mod setup;
mod test_character_system;
// mod test_map_system;
mod test_map_cc_system;
mod test_match_system;
mod test_move_system;
mod test_skill_system;
Expand Down
12 changes: 6 additions & 6 deletions src/models/data/starkane.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ impl CharacterPlayerProgressImpl of CharacterPlayerProgressTrait {
struct PlayerStadistics {
#[key]
owner: felt252,
matchs_won: u128,
matchs_lost: u128,
matchs_won: u64,
matchs_lost: u64,
characters_owned: u32,
total_score: u128,
total_score: u64,
recommendation_score: u64
}

Expand All @@ -67,15 +67,15 @@ struct Ranking {
#[key]
id: u32,
player: felt252,
score: u128
score: u64
}

trait RankingTrait {
fn new(id: u32, player: felt252, score: u128) -> Ranking;
fn new(id: u32, player: felt252, score: u64) -> Ranking;
}

impl RankingImpl of RankingTrait {
fn new(id: u32, player: felt252, score: u128) -> Ranking {
fn new(id: u32, player: felt252, score: u64) -> Ranking {
Ranking { id, player, score }
}
}
Expand Down
16 changes: 8 additions & 8 deletions src/models/entities/character.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ struct Character {
#[key]
character_id: u32,
character_type: u8,
hp: u128,
mp: u128,
attack: u128,
defense: u128,
evasion: u128,
crit_chance: u128,
crit_rate: u128,
movement_range: u128,
hp: u64,
mp: u64,
attack: u64,
defense: u64,
evasion: u64,
crit_chance: u64,
crit_rate: u64,
movement_range: u64,
}

trait CharacterTrait {
Expand Down
133 changes: 0 additions & 133 deletions src/models/entities/map.cairo

This file was deleted.

Loading

0 comments on commit 7b58749

Please sign in to comment.