Skip to content
This repository has been archived by the owner on Dec 15, 2023. It is now read-only.

Commit

Permalink
chore: add hunter
Browse files Browse the repository at this point in the history
  • Loading branch information
mariz-ov committed Nov 15, 2023
1 parent f8e6345 commit c044d5e
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 5 deletions.
18 changes: 17 additions & 1 deletion contracts/scripts/init_auth.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ APP_MODELS=("Game" "Player")

SNAKE_MODELS=("Snake" "SnakeSegment")

HUNTER_MODELS=("LastAttempt")

MINESWEEPER_MODELS=("MinesweeperGame")

echo "Write permissions for CORE_ACTIONS"
for model in ${CORE_MODELS[@]}; do
sleep 0.1
Expand Down Expand Up @@ -45,12 +49,19 @@ done
echo "Write permissions for RPS_ACTIONS: Done"

echo "Write permissions for MINESWEEPER_ACTIONS"
for model in ${APP_MODELS[@]}; do
for model in ${MINESWEEPER_MODELS[@]}; do
sleep 0.1
sozo auth writer $model $MINESWEEPER_ACTIONS
done
echo "Write permissions for MINESWEEPER_ACTIONS: Done"

echo "Write permissions for HUNTER_ACTIONS"
for model in ${HUNTER_MODELS[@]}; do
sleep 0.1
sozo auth writer $model $HUNTER_ACTIONS
done
echo "Write permissions for HUNTER_ACTIONS: Done"


echo "Initialize CORE_ACTIONS : $CORE_ACTIONS"
sleep 0.1
Expand All @@ -77,4 +88,9 @@ sleep 0.1
sozo execute $MINESWEEPER_ACTIONS init
echo "Initialize MINESWEEPER_ACTIONS: Done"

echo "Initialize HUNTER_ACTIONS: Done"
sleep 0.1
sozo execute $HUNTER_ACTIONS init
echo "Initialize HUNTER_ACTIONS: Done"


1 change: 1 addition & 0 deletions contracts/scripts/update_contracts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ declare "PAINT_ACTIONS"=$(cat target/dev/manifest.copy.json | jq -r '.contracts[
declare "RPS_ACTIONS"=$(cat target/dev/manifest.copy.json | jq -r '.contracts[] | select(.name=="rps_actions") | .address')
declare "SNAKE_ACTIONS"=$(cat target/dev/manifest.copy.json | jq -r '.contracts[] | select(.name=="snake_actions") | .address')
declare "MINESWEEPER_ACTIONS"=$(cat target/dev/manifest.copy.json | jq -r '.contracts[] | select(.name=="minesweeper_actions") | .address')
declare "HUNTER_ACTIONS"=$(cat target/dev/manifest.copy.json | jq -r '.contracts[] | select(.name=="hunter_actions") | .address')
2 changes: 1 addition & 1 deletion contracts/scripts/upload_manifest.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

SYSTEMS=("paint" "minesweeper" "snake" "rps")
SYSTEMS=("paint" "minesweeper" "snake" "rps" "hunter")
BASE_URL="http://localhost:3000/manifests"
JSON_FILE="./target/dev/manifest.json"

Expand Down
2 changes: 1 addition & 1 deletion contracts/src/apps.cairo
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
mod paint;
mod rps;
mod snake;
// mod hunter;
mod hunter;
mod minesweeper;
7 changes: 5 additions & 2 deletions contracts/src/apps/hunter/app.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ struct LastAttempt {
}

const APP_KEY: felt252 = 'hunter';
const APP_ICON: felt252 = 'U+27B6';
/// BASE means using the server's default manifest.json handler
const APP_MANIFEST: felt252 = 'BASE/manifests/hunter';

#[dojo::contract]
mod hunter_actions {
Expand All @@ -35,7 +38,7 @@ mod hunter_actions {
IActionsDispatcher as ICoreActionsDispatcher,
IActionsDispatcherTrait as ICoreActionsDispatcherTrait
};
use super::APP_KEY;
use super::{APP_KEY, APP_ICON, APP_MANIFEST};
use pixelaw::core::utils::{get_core_actions, Direction, Position, DefaultParameters};

use debug::PrintTrait;
Expand All @@ -48,7 +51,7 @@ mod hunter_actions {
fn init(self: @ContractState) {
let core_actions = get_core_actions(self.world_dispatcher.read());

core_actions.update_app(APP_KEY, '', '');
core_actions.update_app(APP_KEY, APP_ICON, APP_MANIFEST);
}


Expand Down
1 change: 1 addition & 0 deletions web/src/components/Plugin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ const PluginButton = ({ system, onSelect, expanded, selected }: PluginButtonProp
'font-emoji',
'my-xs',
'text-center text-[36px]',
'w-[1.25em]',
'border border-brand-violetAccent rounded',
{'border-white': selected}
])}
Expand Down

0 comments on commit c044d5e

Please sign in to comment.