Skip to content

Commit

Permalink
Merge branch 'master' into tm/fix-readme
Browse files Browse the repository at this point in the history
  • Loading branch information
MedovTimur authored Nov 1, 2024
2 parents a5b9322 + 506fc06 commit c9b7e81
Show file tree
Hide file tree
Showing 470 changed files with 15,525 additions and 1,960 deletions.
Binary file removed .DS_Store
Binary file not shown.
4 changes: 2 additions & 2 deletions .github/workflows/STG-tamagotchi-battle-new.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
push:
branches: ["master", "main"]
paths:
- frontend/apps/tamagotchi-battle-new/**
- frontend/apps/web3-warriors-battle/**
- frontend/packages/**

concurrency:
Expand Down Expand Up @@ -71,7 +71,7 @@ jobs:
- name: Build and push image
uses: docker/build-push-action@v5
with:
file: frontend/apps/tamagotchi-battle-new/Dockerfile
file: frontend/apps/web3-warriors-battle/Dockerfile
push: true
tags: ${{ needs.prepair.outputs.image_name }}
build-args: |
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# misc
.DS_Store
64 changes: 34 additions & 30 deletions contracts/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions contracts/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ members = [
"car-races/car-3",
"car-races/wasm",
"concert/wasm",
"galactic-express",
"galactic-express/wasm",
"multisig-wallet",
"multisig-wallet/state",
"oracle",
Expand Down Expand Up @@ -70,7 +70,6 @@ tamagotchi-battle-state.path = "tamagotchi-battle/state"

battleship-io.path = "battleship/io"
car-races-io.path = "car-races/io"
galactic-express-io.path = "galactic-express/io"
multi-token-io.path = "multi-token/io"
multisig-wallet-io.path = "multisig-wallet/io"
ping-io.path = "ping/io"
Expand Down
19 changes: 1 addition & 18 deletions contracts/battle/app/src/services/game/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,24 +117,6 @@ impl Battle {
}
}

pub fn delete_players(&mut self, loser_1: &ActorId, loser_2: &ActorId, pair_id: u16) {
let player_loser_1 = self
.participants
.remove(loser_1)
.expect("The player must exist");
let player_loser_2 = self
.participants
.remove(loser_2)
.expect("The player must exist");

self.defeated_participants.insert(*loser_1, player_loser_1);
self.defeated_participants.insert(*loser_2, player_loser_2);

self.pairs.remove(&pair_id);
self.players_to_pairs.remove(loser_1);
self.players_to_pairs.remove(loser_2);
}

pub fn check_min_player_amount(&self) -> Result<(), BattleError> {
if self.participants.len() <= 1 {
return Err(BattleError::NotEnoughPlayers);
Expand Down Expand Up @@ -183,6 +165,7 @@ impl Battle {
self.pairs.insert(self.pair_id, pair);
self.players_to_pairs.insert(player.owner, self.pair_id);
self.waiting_player = Some((player.owner, self.pair_id));
self.pair_id += 1;
}
}
pub fn send_delayed_message_make_move_from_reservation(&mut self, time_for_move: u32) {
Expand Down
4 changes: 2 additions & 2 deletions contracts/battle/tests/gtest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ async fn test() {

println!("\n RES {:?}", result);

make_move(&mut service_client, Move::Attack, USER_1, program_id)
make_move(&mut service_client, Move::Attack, USER_2, program_id)
.await
.unwrap();

Expand Down Expand Up @@ -170,7 +170,7 @@ async fn test() {

service_client
.start_next_fight()
.with_args(GTestArgs::new(USER_2.into()))
.with_args(GTestArgs::new(USER_3.into()))
.send_recv(program_id)
.await
.unwrap();
Expand Down
Binary file removed contracts/galactic-express/.DS_Store
Binary file not shown.
1 change: 0 additions & 1 deletion contracts/galactic-express/.binpath

This file was deleted.

17 changes: 0 additions & 17 deletions contracts/galactic-express/Cargo.toml

This file was deleted.

5 changes: 1 addition & 4 deletions contracts/galactic-express/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
[![Open in Gitpod](https://img.shields.io/badge/Open_in-Gitpod-white?logo=gitpod)](https://gitpod.io/#FOLDER=galactic-express/https://github.com/gear-foundation/dapps)
[![Docs](https://img.shields.io/github/actions/workflow/status/gear-foundation/dapps/contracts.yml?logo=rust&label=docs)](https://dapps.gear.rs/galactic_express_io)

# [Galactic Express](https://wiki.gear-tech.io/docs/examples/Gaming/galactic-express)

Galactic Express (GalEx) is a 100% on-chain PvE economic game.
Expand All @@ -16,7 +13,7 @@ cargo b -r -p "galactic-express"
### ✅ Testing

```sh
cargo t -r -p "galactic-express"
cargo t -r -p "galactic-express-app"
```

## Stages
Expand Down
18 changes: 18 additions & 0 deletions contracts/galactic-express/app/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[package]
name = "galactic-express-app"
version.workspace = true
edition.workspace = true
license.workspace = true

[dependencies]
gstd = { workspace = true, features = ["debug"] }
sails-rs = { workspace = true, features = ["gtest"] }
num-traits.workspace = true

[dev-dependencies]
gtest.workspace = true
gstd.workspace = true
gear-core.workspace = true
gclient.workspace = true
galactic-express = { path = "../wasm" }
tokio = "1"
19 changes: 19 additions & 0 deletions contracts/galactic-express/app/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#![no_std]
#![allow(clippy::new_without_default)]

use sails_rs::prelude::*;
mod services;
use services::galactic_express::GameService;
pub struct Program(());

#[program]
impl Program {
pub async fn new(dns_id_and_name: Option<(ActorId, String)>) -> Self {
GameService::init(dns_id_and_name).await;
Self(())
}

pub fn galactic_express(&self) -> GameService {
GameService::new()
}
}
Loading

0 comments on commit c9b7e81

Please sign in to comment.