Skip to content

Commit

Permalink
Merge branch 'feat-mvp' of github.com:Mississippi-Labs/mississippi in…
Browse files Browse the repository at this point in the history
…to feat-mvp
  • Loading branch information
Vivomo committed Oct 12, 2023
2 parents e5154dc + 6e65052 commit 59897c5
Show file tree
Hide file tree
Showing 18 changed files with 1,189 additions and 1,271 deletions.
2 changes: 1 addition & 1 deletion packages/contracts/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ artifacts/
abi/
types/
broadcast/

.env
# Ignore MUD deploy artifacts
deploys/**/*.json
9 changes: 5 additions & 4 deletions packages/contracts/mud.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,17 @@ export default mudConfig({
name: "player",
openAccess: true,
},
RandomSystem: {
name: "random",
openAccess: true,
},
// RandomSystem: {
// name: "random",
// openAccess: true,
// },
},
enums: {
BattleState: ["Inited", "Confirmed", "Revealed"],
PlayerState: ["Idle", "Preparing", "Exploring", "Attacking"],
ActionType: ["Attack", "Escape", "Props"],
Buff: ["None", "Fire", "Water", "Wind"],
RandomState:["Inited","Pending","Confirmed"]
},
tables: {
Season: {
Expand Down
10 changes: 7 additions & 3 deletions packages/contracts/remappings.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
ds-test/=./node_modules/ds-test/src/
forge-std/=./node_modules/forge-std/src/
@latticexyz/=./node_modules/@latticexyz/
ds-test/=node_modules/ds-test/src/
forge-std/=node_modules/forge-std/src/
@latticexyz/=node_modules/@latticexyz/
@src/=src/
@systems/=src/systems/
@codegen/=src/codegen/
@library/=src/systems/library/
17 changes: 15 additions & 2 deletions packages/contracts/script/GameConfigInit.sol
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,23 @@ library GameConfigInit {
merkleRoot, //merkleRoot
0, //battleId,
0, //randomId,
100, //originX,
100, //originY,
4, //originX,
4, //originY,
0, //roomId,
0 //boxId,
);
}

function setInitPosition(IWorld _world) internal {
GameConfig.setOriginX(_world, GAME_CONFIG_KEY, 4);
GameConfig.setOriginY(_world, GAME_CONFIG_KEY, 4);
}

function getPosition(IWorld _world) internal view returns (uint256, uint256) {
uint256 x = GameConfig.getOriginX(_world, GAME_CONFIG_KEY);
uint256 y = GameConfig.getOriginY(_world, GAME_CONFIG_KEY);
return (x,y);
}


}
3 changes: 3 additions & 0 deletions packages/contracts/script/PostDeploy.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { console } from "forge-std/console.sol";
import { IWorld } from "../src/codegen/world/IWorld.sol";
import { GameConfigInit } from "./GameConfigInit.sol";
import { BattleConfigInit } from "./BattleConfigInit.sol";
import { console } from "forge-std/console.sol";

contract PostDeploy is Script {
function run(address worldAddress) external {
Expand All @@ -15,6 +16,8 @@ contract PostDeploy is Script {
// Start broadcasting transactions from the deployer account
vm.startBroadcast(deployerPrivateKey);

console.log(" ========== PostDeploy ========== ");

// ------------------ INIT ------------------
GameConfigInit.initGameConfig(IWorld(worldAddress));
BattleConfigInit.initGameConfig(IWorld(worldAddress));
Expand Down
29 changes: 29 additions & 0 deletions packages/contracts/script/TempRun.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;

import { Script } from "forge-std/Script.sol";
import { console } from "forge-std/console.sol";
import { IWorld } from "../src/codegen/world/IWorld.sol";
import { GameConfigInit } from "./GameConfigInit.sol";

contract TempRun is Script {
function run(address worldAddress) external {
// Load the private key from the `PRIVATE_KEY` environment variable (in .env)
uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY");

// Start broadcasting transactions from the deployer account
vm.startBroadcast(deployerPrivateKey);

// address w = address(0x2Bc1034975c3df48D6f3026802f372677844b85d);

// ------------------ INIT ------------------
// GameConfigInit.setInitPosition(IWorld(0x2Bc1034975c3df48D6f3026802f372677844b85d));
(uint256 x, uint256 y) = GameConfigInit.getPosition(IWorld(worldAddress));
console.log("======= result =======");
console.log(x);
console.log(y);

vm.stopBroadcast();

}
}
Loading

0 comments on commit 59897c5

Please sign in to comment.