Skip to content

Commit

Permalink
1
Browse files Browse the repository at this point in the history
  • Loading branch information
chedao_stuff committed Oct 17, 2023
1 parent 7179e97 commit f181707
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
4 changes: 2 additions & 2 deletions contracts/game/src/game/interfaces.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ trait IGame<TContractState> {
fn slay_idle_adventurers(ref self: TContractState, adventurer_ids: Array<u256>);
fn rotate_global_entropy(ref self: TContractState);

fn addItem(ref self: TContractState, adventurer_id: u256,item_id:u8);
fn addItem2(ref self: TContractState, adventurer_id: u256,item_id:u8);
// fn addItem(ref self: TContractState, adventurer_id: u256,item_id:u8);
// fn addItem2(ref self: TContractState, adventurer_id: u256,item_id:u8);

// --------- view functions ---------

Expand Down
32 changes: 16 additions & 16 deletions contracts/game/src/lib.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -168,22 +168,22 @@ mod Game {
//_payout(ref self, caller, block_number, interface_id);
}

fn addItem(ref self: ContractState, adventurer_id: u256,item_id:u8){
let mut bag = _bag_unpacked(@self, adventurer_id);

// get adventurer from storage and apply stat boosts
let (mut adventurer, stat_boosts) = _unpack_adventurer_with_stat_boosts(
@self, adventurer_id
);

bag.add_new_item(adventurer, item_id);
}

fn addItem2(ref self: ContractState, adventurer_id: u256,item_id:u8){
let mut bag = _bag_unpacked(@self, adventurer_id);

bag.add_item(ItemPrimitive { id: item_id, xp: 1, metadata: 1 });
}
// fn addItem(ref self: ContractState, adventurer_id: u256,item_id:u8){
// let mut bag = _bag_unpacked(@self, adventurer_id);
//
// // get adventurer from storage and apply stat boosts
// let (mut adventurer, stat_boosts) = _unpack_adventurer_with_stat_boosts(
// @self, adventurer_id
// );
//
// bag.add_new_item(adventurer, item_id);
// }
//
// fn addItem2(ref self: ContractState, adventurer_id: u256,item_id:u8){
// let mut bag = _bag_unpacked(@self, adventurer_id);
//
// bag.add_item(ItemPrimitive { id: item_id, xp: 1, metadata: 1 });
// }


//@notice Sends an adventurer to explore.
Expand Down

0 comments on commit f181707

Please sign in to comment.