Skip to content

Commit

Permalink
changed profiles, update module and version capability added
Browse files Browse the repository at this point in the history
  • Loading branch information
sgrutman978 committed Dec 11, 2024
1 parent 53f7962 commit 89df354
Show file tree
Hide file tree
Showing 8 changed files with 259 additions and 276 deletions.
8 changes: 4 additions & 4 deletions Move.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[move]
version = 3
manifest_digest = "DA7A6409E80EB002B0DB02F23A3F98AB7C28C551DDA72D08F207BC4BA43F2E1C"
manifest_digest = "ADB961474DCF2FBCDA7C06A782C83C9B103FD97F8B6D0419A0AB40C22A5CA4F1"
deps_digest = "F8BBB0CCB2491CA29A3DF03D6F92277A4F3574266507ACD77214D37ECA3F3082"
dependencies = [
{ id = "Sui", name = "Sui" },
Expand Down Expand Up @@ -35,6 +35,6 @@ published-version = "1"

[env.testnet]
chain-id = "4c78adac"
original-published-id = "0x3802617b7accf0106775224e4de74770f633acad7a5906fa2376e1b9ff12674b"
latest-published-id = "0x3802617b7accf0106775224e4de74770f633acad7a5906fa2376e1b9ff12674b"
published-version = "1"
original-published-id = "0xa4a6a2a787a9c4e79d8492ab62ebbab006a16779ded867557e9cba68bc6c4fba"
latest-published-id = "0x160d8d65afad45b4e127109d98913d10e6a128b5759a53681c018ebdbe928249"
published-version = "2"
1 change: 0 additions & 1 deletion Move.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[package]
name = "find_four"
edition = "2024.beta" # edition = "legacy" to use legacy (pre-2024) Move
published-at = "0x0ab1df6b005fa2731b2d571aec358e3dbd1a9426410825ec217ecf03587587cb"
# license = "" # e.g., "MIT", "GPL", "Apache 2.0"
# authors = ["..."] # e.g., ["Joe Smith ([email protected])", "John Snow ([email protected])"]

Expand Down
8 changes: 4 additions & 4 deletions sources/ffio.move
Original file line number Diff line number Diff line change
Expand Up @@ -151,19 +151,19 @@ module find_four::FFIO {
transfer::share_object(presale_state);
}

public(package) fun check_version_Treasury(treasury: &Treasury){
fun check_version_Treasury(treasury: &Treasury){
assert!(treasury.version == VERSION, 1);
}

public(package) fun check_version_RewardState(rewardState: &RewardState){
fun check_version_RewardState(rewardState: &RewardState){
assert!(rewardState.version == VERSION, 1);
}

public(package) fun check_version_UserState(userState: &UserState){
fun check_version_UserState(userState: &UserState){
assert!(userState.version == VERSION, 1);
}

public(package) fun check_version_PresaleState(presaleState: &PresaleState){
fun check_version_PresaleState(presaleState: &PresaleState){
assert!(presaleState.version == VERSION, 1);
}

Expand Down
12 changes: 11 additions & 1 deletion sources/find_four_game.move
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module find_four::find_four_game {
use std::debug;
use sui::event;
use find_four::profile_and_rank::{PointsObj, updatePoints, Profile};
// use find_four::profile_and_rank::{PointsObj, updatePoints, Profile};
use find_four::FFIO::{reward_winner, FindFourAdminCap};
// use find_four::multiplayer::{}

Expand Down Expand Up @@ -91,6 +91,16 @@ module find_four::find_four_game {
game.winner
}

public(package) fun getP1(game: &GameBoard): address {
check_version_GameBoard(game);
game.p1
}

public(package) fun getP2(game: &GameBoard): address {
check_version_GameBoard(game);
game.p2
}

public(package) fun getWinHandled(game: &GameBoard): bool {
check_version_GameBoard(game);
game.winHandled
Expand Down
23 changes: 14 additions & 9 deletions sources/multi_player.move
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
module find_four::multi_player {

use sui::event;
use find_four::find_four_game::{initialize_game, GameBoard, player_move, setWinHandled};
use find_four::profile_and_rank::{Profile, PointsObj, updatePoints};
use find_four::find_four_game::{initialize_game, GameBoard, player_move, setWinHandled, getP1, getP2};
use find_four::profile_and_rank::{update_both_trophies_after_win, ProfileTable};
use find_four::FFIO::{FindFourAdminCap};

const VERSION: u64 = 1;
Expand All @@ -16,9 +16,8 @@ module find_four::multi_player {

public struct AddToListEvent has copy, drop, store {
addy: address,
profileAddy: address,
points: u64,
nonce: u64
nonce: u64,
points: u64
}

public struct FFIO_Nonce has key {
Expand Down Expand Up @@ -80,16 +79,16 @@ module find_four::multi_player {
player_move(game, column, ctx);
}

public fun add_to_list(addy: address, profileAddy: address, points: u64, the_ffio_nonce: &mut FFIO_Nonce){
public fun add_to_list2(addy: address, points: u64, the_ffio_nonce: &mut FFIO_Nonce){
check_version_Nonce(the_ffio_nonce);
incrementNonce(the_ffio_nonce);
let add_to_List_event = AddToListEvent { addy: addy, profileAddy: profileAddy, points: points, nonce: the_ffio_nonce.nonce };
let add_to_List_event = AddToListEvent { addy: addy, points: points, nonce: the_ffio_nonce.nonce };
event::emit(add_to_List_event);
}

public fun do_win_stuffs(game: &mut GameBoard, pointsObj1: &mut PointsObj, pointsObj2: &mut PointsObj, ctx: &mut TxContext){
public fun do_win_stuffs(game: &mut GameBoard, profileTable: &mut ProfileTable, ctx: &mut TxContext){
if(!game.getWinHandled() && game.getGameType() == 2){
updatePoints(game.getWinner(), pointsObj1, pointsObj2, ctx);
update_both_trophies_after_win(profileTable, game.getWinner(), game.getP1(), game.getP2(), ctx);
setWinHandled(game, true);
}
}
Expand Down Expand Up @@ -117,4 +116,10 @@ module find_four::multi_player {
// }
}





public fun add_to_list(addy: address, profileAddy: address, points: u64, the_ffio_nonce: &mut FFIO_Nonce){}

}
159 changes: 0 additions & 159 deletions sources/old_ffio.move

This file was deleted.

Loading

0 comments on commit 89df354

Please sign in to comment.