Skip to content

Commit

Permalink
chore: optimze gm createBox
Browse files Browse the repository at this point in the history
  • Loading branch information
lewis committed Oct 24, 2023
1 parent 0d726fe commit 88ccd7d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
3 changes: 1 addition & 2 deletions packages/contracts/mud.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ export default mudConfig({
GMSystem: {
name: "gm",
// TODO,测试,正式需要关闭
openAccess: true,
accessList: [],
openAccess: true
},
PlayerSystem: {
name: "player",
Expand Down
6 changes: 3 additions & 3 deletions packages/contracts/src/systems/GMSystem.sol
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@ contract GMSystem is System {
}

// create box
function CreateBox(uint16 _x, uint16 _y, uint16 _oreBalance, uint16 _treasureBalance) public {
function CreateBox(uint16 _x, uint16 _y) public {
uint256 boxId = GameConfig.getBoxId(GAME_CONFIG_KEY);
BoxList.setX(boxId, _x);
BoxList.setY(boxId, _y);
BoxList.setDropTime(boxId, block.timestamp);
BoxList.setOreBalance(boxId, _oreBalance);
BoxList.setTreasureBalance(boxId, _treasureBalance);
// BoxList.setOreBalance(boxId, _oreBalance);
// BoxList.setTreasureBalance(boxId, _treasureBalance);
GameConfig.setBoxId(GAME_CONFIG_KEY, boxId + 1);
}

Expand Down
2 changes: 1 addition & 1 deletion packages/contracts/test/BoxTest.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ contract BoxTest is MudTest {

function testOpenBox() public {
vm.startPrank(vm.addr(vm.envUint("PRIVATE_KEY")));
world.CreateBox(5,4, 4, 5);
world.CreateBox(5,4);
Player.setX(bob, 4);
Player.setY(bob, 4);
Player.setStrength(bob, 5);
Expand Down

0 comments on commit 88ccd7d

Please sign in to comment.