From cd30eb14488bf8bf8cab60aa895420b0f3a691c3 Mon Sep 17 00:00:00 2001 From: LidamaoHub Date: Sun, 12 Nov 2023 11:17:44 +0800 Subject: [PATCH 1/4] update details --- packages/contracts/out/IWorld.sol/IWorld.json | 46 +++++------ packages/contracts/out/Loot.sol/MLoot.json | 28 +++---- .../contracts/out/Plugin.sol/MPlugin.json | 82 +++++++++---------- packages/contracts/out/User.sol/MUser.json | 28 +++---- .../src/systems/BattleForceSystem.sol | 3 - packages/contracts/worlds.json | 6 +- 6 files changed, 95 insertions(+), 98 deletions(-) diff --git a/packages/contracts/out/IWorld.sol/IWorld.json b/packages/contracts/out/IWorld.sol/IWorld.json index adc4b338..d77d7be5 100644 --- a/packages/contracts/out/IWorld.sol/IWorld.json +++ b/packages/contracts/out/IWorld.sol/IWorld.json @@ -3912,16 +3912,16 @@ 118568, 118556, 71348, - 129912, - 129821, - 129805, - 129808, - 129860, - 173570, - 129850, - 129839, + 129884, + 129793, + 129777, + 129780, + 129832, + 173542, + 129822, + 129811, 64435, - 127078, + 127050, 64393, 64426, 64399, @@ -3932,22 +3932,22 @@ "nameLocation": "798:6:169", "scope": 118826, "usedErrors": [ + 127015, + 127021, + 127023, + 127025, + 127031, + 127037, 127043, 127049, - 127051, - 127053, - 127059, - 127065, - 127071, - 127077, - 173539, - 173543, - 173549, - 173553, - 173557, - 173561, - 173565, - 173569 + 173511, + 173515, + 173521, + 173525, + 173529, + 173533, + 173537, + 173541 ] } ], diff --git a/packages/contracts/out/Loot.sol/MLoot.json b/packages/contracts/out/Loot.sol/MLoot.json index b9952c63..170c73d0 100644 --- a/packages/contracts/out/Loot.sol/MLoot.json +++ b/packages/contracts/out/Loot.sol/MLoot.json @@ -1636,34 +1636,34 @@ "id": 119867, "exportedSymbols": { "Address": [ - 131449 + 131421 ], "Base64": [ 118883 ], "Context": [ - 131471 + 131443 ], "ERC165": [ - 131495 + 131467 ], "ERC721": [ 72425 ], "IERC165": [ - 173776 + 173748 ], "IERC20": [ 71498 ], "IERC721": [ - 131074 + 131046 ], "IERC721Metadata": [ - 131119 + 131091 ], "IERC721Receiver": [ - 131092 + 131064 ], "MLoot": [ 119866 @@ -1672,10 +1672,10 @@ 120314 ], "Math": [ - 132361 + 132333 ], "SignedMath": [ - 132466 + 132438 ], "Strings": [ 72654 @@ -14325,11 +14325,11 @@ 119866, 120314, 72425, - 131119, - 131074, - 131495, - 173776, - 131471, + 131091, + 131046, + 131467, + 173748, + 131443, 120117 ], "name": "MLoot", diff --git a/packages/contracts/out/Plugin.sol/MPlugin.json b/packages/contracts/out/Plugin.sol/MPlugin.json index 4171448f..784be45e 100644 --- a/packages/contracts/out/Plugin.sol/MPlugin.json +++ b/packages/contracts/out/Plugin.sol/MPlugin.json @@ -217,13 +217,13 @@ "id": 120410, "exportedSymbols": { "Loot": [ - 124742 + 124714 ], "MPlugin": [ 120409 ], "User": [ - 124703 + 124675 ] }, "nodeType": "SourceUnit", @@ -250,7 +250,7 @@ "file": "@systems/library/Interface.sol", "nameLocation": "-1:-1:-1", "scope": 120410, - "sourceUnit": 124743, + "sourceUnit": 124715, "symbolAliases": [ { "foreign": { @@ -258,7 +258,7 @@ "name": "User", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 124703, + "referencedDeclaration": 124675, "src": "66:4:174", "typeDescriptions": {} }, @@ -270,7 +270,7 @@ "name": "Loot", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 124742, + "referencedDeclaration": 124714, "src": "72:4:174", "typeDescriptions": {} }, @@ -550,7 +550,7 @@ "stateVariable": false, "storageLocation": "default", "typeDescriptions": { - "typeIdentifier": "t_contract$_User_$124703", + "typeIdentifier": "t_contract$_User_$124675", "typeString": "contract User" }, "typeName": { @@ -560,13 +560,13 @@ "id": 120342, "name": "User", "nodeType": "IdentifierPath", - "referencedDeclaration": 124703, + "referencedDeclaration": 124675, "src": "389:4:174" }, - "referencedDeclaration": 124703, + "referencedDeclaration": 124675, "src": "389:4:174", "typeDescriptions": { - "typeIdentifier": "t_contract$_User_$124703", + "typeIdentifier": "t_contract$_User_$124675", "typeString": "contract User" } }, @@ -600,10 +600,10 @@ "name": "User", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 124703, + "referencedDeclaration": 124675, "src": "401:4:174", "typeDescriptions": { - "typeIdentifier": "t_type$_t_contract$_User_$124703_$", + "typeIdentifier": "t_type$_t_contract$_User_$124675_$", "typeString": "type(contract User)" } }, @@ -618,7 +618,7 @@ "src": "401:17:174", "tryCall": false, "typeDescriptions": { - "typeIdentifier": "t_contract$_User_$124703", + "typeIdentifier": "t_contract$_User_$124675", "typeString": "contract User" } }, @@ -642,7 +642,7 @@ "stateVariable": false, "storageLocation": "default", "typeDescriptions": { - "typeIdentifier": "t_contract$_Loot_$124742", + "typeIdentifier": "t_contract$_Loot_$124714", "typeString": "contract Loot" }, "typeName": { @@ -652,13 +652,13 @@ "id": 120349, "name": "Loot", "nodeType": "IdentifierPath", - "referencedDeclaration": 124742, + "referencedDeclaration": 124714, "src": "428:4:174" }, - "referencedDeclaration": 124742, + "referencedDeclaration": 124714, "src": "428:4:174", "typeDescriptions": { - "typeIdentifier": "t_contract$_Loot_$124742", + "typeIdentifier": "t_contract$_Loot_$124714", "typeString": "contract Loot" } }, @@ -692,10 +692,10 @@ "name": "Loot", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 124742, + "referencedDeclaration": 124714, "src": "440:4:174", "typeDescriptions": { - "typeIdentifier": "t_type$_t_contract$_Loot_$124742_$", + "typeIdentifier": "t_type$_t_contract$_Loot_$124714_$", "typeString": "type(contract Loot)" } }, @@ -710,7 +710,7 @@ "src": "440:17:174", "tryCall": false, "typeDescriptions": { - "typeIdentifier": "t_contract$_Loot_$124742", + "typeIdentifier": "t_contract$_Loot_$124714", "typeString": "contract Loot" } }, @@ -812,7 +812,7 @@ "referencedDeclaration": 120344, "src": "503:4:174", "typeDescriptions": { - "typeIdentifier": "t_contract$_User_$124703", + "typeIdentifier": "t_contract$_User_$124675", "typeString": "contract User" } }, @@ -823,7 +823,7 @@ "lValueRequested": false, "memberName": "mint", "nodeType": "MemberAccess", - "referencedDeclaration": 124697, + "referencedDeclaration": 124669, "src": "503:9:174", "typeDescriptions": { "typeIdentifier": "t_function_external_nonpayable$_t_address_$returns$__$", @@ -880,7 +880,7 @@ "referencedDeclaration": 120351, "src": "529:4:174", "typeDescriptions": { - "typeIdentifier": "t_contract$_Loot_$124742", + "typeIdentifier": "t_contract$_Loot_$124714", "typeString": "contract Loot" } }, @@ -891,7 +891,7 @@ "lValueRequested": false, "memberName": "mint", "nodeType": "MemberAccess", - "referencedDeclaration": 124736, + "referencedDeclaration": 124708, "src": "529:9:174", "typeDescriptions": { "typeIdentifier": "t_function_external_nonpayable$_t_address_$returns$__$", @@ -970,7 +970,7 @@ "stateVariable": false, "storageLocation": "default", "typeDescriptions": { - "typeIdentifier": "t_contract$_User_$124703", + "typeIdentifier": "t_contract$_User_$124675", "typeString": "contract User" }, "typeName": { @@ -980,13 +980,13 @@ "id": 120381, "name": "User", "nodeType": "IdentifierPath", - "referencedDeclaration": 124703, + "referencedDeclaration": 124675, "src": "643:4:174" }, - "referencedDeclaration": 124703, + "referencedDeclaration": 124675, "src": "643:4:174", "typeDescriptions": { - "typeIdentifier": "t_contract$_User_$124703", + "typeIdentifier": "t_contract$_User_$124675", "typeString": "contract User" } }, @@ -1020,10 +1020,10 @@ "name": "User", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 124703, + "referencedDeclaration": 124675, "src": "655:4:174", "typeDescriptions": { - "typeIdentifier": "t_type$_t_contract$_User_$124703_$", + "typeIdentifier": "t_type$_t_contract$_User_$124675_$", "typeString": "type(contract User)" } }, @@ -1038,7 +1038,7 @@ "src": "655:17:174", "tryCall": false, "typeDescriptions": { - "typeIdentifier": "t_contract$_User_$124703", + "typeIdentifier": "t_contract$_User_$124675", "typeString": "contract User" } }, @@ -1062,7 +1062,7 @@ "stateVariable": false, "storageLocation": "default", "typeDescriptions": { - "typeIdentifier": "t_contract$_Loot_$124742", + "typeIdentifier": "t_contract$_Loot_$124714", "typeString": "contract Loot" }, "typeName": { @@ -1072,13 +1072,13 @@ "id": 120388, "name": "Loot", "nodeType": "IdentifierPath", - "referencedDeclaration": 124742, + "referencedDeclaration": 124714, "src": "682:4:174" }, - "referencedDeclaration": 124742, + "referencedDeclaration": 124714, "src": "682:4:174", "typeDescriptions": { - "typeIdentifier": "t_contract$_Loot_$124742", + "typeIdentifier": "t_contract$_Loot_$124714", "typeString": "contract Loot" } }, @@ -1112,10 +1112,10 @@ "name": "Loot", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 124742, + "referencedDeclaration": 124714, "src": "694:4:174", "typeDescriptions": { - "typeIdentifier": "t_type$_t_contract$_Loot_$124742_$", + "typeIdentifier": "t_type$_t_contract$_Loot_$124714_$", "typeString": "type(contract Loot)" } }, @@ -1130,7 +1130,7 @@ "src": "694:17:174", "tryCall": false, "typeDescriptions": { - "typeIdentifier": "t_contract$_Loot_$124742", + "typeIdentifier": "t_contract$_Loot_$124714", "typeString": "contract Loot" } }, @@ -1168,7 +1168,7 @@ "referencedDeclaration": 120390, "src": "721:4:174", "typeDescriptions": { - "typeIdentifier": "t_contract$_Loot_$124742", + "typeIdentifier": "t_contract$_Loot_$124714", "typeString": "contract Loot" } }, @@ -1179,7 +1179,7 @@ "lValueRequested": false, "memberName": "revealNFT", "nodeType": "MemberAccess", - "referencedDeclaration": 124741, + "referencedDeclaration": 124713, "src": "721:14:174", "typeDescriptions": { "typeIdentifier": "t_function_external_nonpayable$_t_uint256_$returns$__$", @@ -1236,7 +1236,7 @@ "referencedDeclaration": 120383, "src": "759:4:174", "typeDescriptions": { - "typeIdentifier": "t_contract$_User_$124703", + "typeIdentifier": "t_contract$_User_$124675", "typeString": "contract User" } }, @@ -1247,7 +1247,7 @@ "lValueRequested": false, "memberName": "revealNFT", "nodeType": "MemberAccess", - "referencedDeclaration": 124702, + "referencedDeclaration": 124674, "src": "759:14:174", "typeDescriptions": { "typeIdentifier": "t_function_external_nonpayable$_t_uint256_$returns$__$", diff --git a/packages/contracts/out/User.sol/MUser.json b/packages/contracts/out/User.sol/MUser.json index 33bf1800..5ec8f18d 100644 --- a/packages/contracts/out/User.sol/MUser.json +++ b/packages/contracts/out/User.sol/MUser.json @@ -1426,31 +1426,31 @@ "id": 121069, "exportedSymbols": { "Address": [ - 131449 + 131421 ], "Base64": [ 118883 ], "Context": [ - 131471 + 131443 ], "ERC165": [ - 131495 + 131467 ], "ERC721": [ 72425 ], "IERC165": [ - 173776 + 173748 ], "IERC721": [ - 131074 + 131046 ], "IERC721Metadata": [ - 131119 + 131091 ], "IERC721Receiver": [ - 131092 + 131064 ], "MRandom": [ 120314 @@ -1459,10 +1459,10 @@ 121068 ], "Math": [ - 132361 + 132333 ], "SignedMath": [ - 132466 + 132438 ], "Strings": [ 72654 @@ -9919,11 +9919,11 @@ 121068, 120314, 72425, - 131119, - 131074, - 131495, - 173776, - 131471 + 131091, + 131046, + 131467, + 173748, + 131443 ], "name": "MUser", "nameLocation": "172:5:175", diff --git a/packages/contracts/src/systems/BattleForceSystem.sol b/packages/contracts/src/systems/BattleForceSystem.sol index d9606e0b..f669904f 100644 --- a/packages/contracts/src/systems/BattleForceSystem.sol +++ b/packages/contracts/src/systems/BattleForceSystem.sol @@ -23,11 +23,8 @@ contract BattleForceSystem is System { BattleState oppositeState = _msgSender() == battle.attacker ? battle.defenderState : battle.attackerState; BattleState playerState = _msgSender() == battle.attacker ? battle.attackerState : battle.defenderState; - console.log("battle attacker ", battle.attacker); address oppositer = _msgSender() == battle.attacker ? battle.defender : battle.attacker; - console.log(" opposite state ", uint(oppositeState)); - console.log(" player state ", uint(playerState)); require((oppositeState == BattleState.Inited && playerState == BattleState.Confirmed)||(oppositeState == BattleState.Confirmed && playerState == BattleState.Revealed), "battle state not correct"); diff --git a/packages/contracts/worlds.json b/packages/contracts/worlds.json index 928d3259..f132ae20 100644 --- a/packages/contracts/worlds.json +++ b/packages/contracts/worlds.json @@ -4,11 +4,11 @@ "blockNumber": 29582781 }, "31337": { - "address": "0xD28F3246f047Efd4059B24FA1fa587eD9fa3e77F" + "address": "0xD997fFf980e015359123C1124C21fae3bcD1f23d" }, "33784": { - "address": "0x2428109A9e775E4406fe079132F216dc77117333", - "blockNumber": 1528 + "address": "0x60b886a32B2dC612532a6E0ADF62ACd9093D0EDF", + "blockNumber": 36757 }, "421613": { "address": "0x2Bc1034975c3df48D6f3026802f372677844b85d", From 1f5f2f268dd641677ab55e4bed85f63cb377fa2f Mon Sep 17 00:00:00 2001 From: LidamaoHub Date: Sun, 12 Nov 2023 15:19:12 +0800 Subject: [PATCH 2/4] fix origin bugs --- packages/contracts/out/IWorld.sol/IWorld.json | 48 +++++------ packages/contracts/out/Loot.sol/MLoot.json | 28 +++---- .../contracts/out/Plugin.sol/MPlugin.json | 82 +++++++++---------- packages/contracts/out/User.sol/MUser.json | 28 +++---- .../src/systems/BattlePrepareSystem.sol | 4 +- packages/contracts/worlds.json | 6 +- 6 files changed, 98 insertions(+), 98 deletions(-) diff --git a/packages/contracts/out/IWorld.sol/IWorld.json b/packages/contracts/out/IWorld.sol/IWorld.json index d77d7be5..d89dfd36 100644 --- a/packages/contracts/out/IWorld.sol/IWorld.json +++ b/packages/contracts/out/IWorld.sol/IWorld.json @@ -3912,16 +3912,16 @@ 118568, 118556, 71348, - 129884, - 129793, - 129777, - 129780, - 129832, - 173542, - 129822, - 129811, + 129904, + 129813, + 129797, + 129800, + 129852, + 173562, + 129842, + 129831, 64435, - 127050, + 127070, 64393, 64426, 64399, @@ -3932,22 +3932,22 @@ "nameLocation": "798:6:169", "scope": 118826, "usedErrors": [ - 127015, - 127021, - 127023, - 127025, - 127031, - 127037, + 127035, + 127041, 127043, - 127049, - 173511, - 173515, - 173521, - 173525, - 173529, - 173533, - 173537, - 173541 + 127045, + 127051, + 127057, + 127063, + 127069, + 173531, + 173535, + 173541, + 173545, + 173549, + 173553, + 173557, + 173561 ] } ], diff --git a/packages/contracts/out/Loot.sol/MLoot.json b/packages/contracts/out/Loot.sol/MLoot.json index 170c73d0..949364eb 100644 --- a/packages/contracts/out/Loot.sol/MLoot.json +++ b/packages/contracts/out/Loot.sol/MLoot.json @@ -1636,34 +1636,34 @@ "id": 119867, "exportedSymbols": { "Address": [ - 131421 + 131441 ], "Base64": [ 118883 ], "Context": [ - 131443 + 131463 ], "ERC165": [ - 131467 + 131487 ], "ERC721": [ 72425 ], "IERC165": [ - 173748 + 173768 ], "IERC20": [ 71498 ], "IERC721": [ - 131046 + 131066 ], "IERC721Metadata": [ - 131091 + 131111 ], "IERC721Receiver": [ - 131064 + 131084 ], "MLoot": [ 119866 @@ -1672,10 +1672,10 @@ 120314 ], "Math": [ - 132333 + 132353 ], "SignedMath": [ - 132438 + 132458 ], "Strings": [ 72654 @@ -14325,11 +14325,11 @@ 119866, 120314, 72425, - 131091, - 131046, - 131467, - 173748, - 131443, + 131111, + 131066, + 131487, + 173768, + 131463, 120117 ], "name": "MLoot", diff --git a/packages/contracts/out/Plugin.sol/MPlugin.json b/packages/contracts/out/Plugin.sol/MPlugin.json index 784be45e..0ae7fb2c 100644 --- a/packages/contracts/out/Plugin.sol/MPlugin.json +++ b/packages/contracts/out/Plugin.sol/MPlugin.json @@ -217,13 +217,13 @@ "id": 120410, "exportedSymbols": { "Loot": [ - 124714 + 124734 ], "MPlugin": [ 120409 ], "User": [ - 124675 + 124695 ] }, "nodeType": "SourceUnit", @@ -250,7 +250,7 @@ "file": "@systems/library/Interface.sol", "nameLocation": "-1:-1:-1", "scope": 120410, - "sourceUnit": 124715, + "sourceUnit": 124735, "symbolAliases": [ { "foreign": { @@ -258,7 +258,7 @@ "name": "User", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 124675, + "referencedDeclaration": 124695, "src": "66:4:174", "typeDescriptions": {} }, @@ -270,7 +270,7 @@ "name": "Loot", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 124714, + "referencedDeclaration": 124734, "src": "72:4:174", "typeDescriptions": {} }, @@ -550,7 +550,7 @@ "stateVariable": false, "storageLocation": "default", "typeDescriptions": { - "typeIdentifier": "t_contract$_User_$124675", + "typeIdentifier": "t_contract$_User_$124695", "typeString": "contract User" }, "typeName": { @@ -560,13 +560,13 @@ "id": 120342, "name": "User", "nodeType": "IdentifierPath", - "referencedDeclaration": 124675, + "referencedDeclaration": 124695, "src": "389:4:174" }, - "referencedDeclaration": 124675, + "referencedDeclaration": 124695, "src": "389:4:174", "typeDescriptions": { - "typeIdentifier": "t_contract$_User_$124675", + "typeIdentifier": "t_contract$_User_$124695", "typeString": "contract User" } }, @@ -600,10 +600,10 @@ "name": "User", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 124675, + "referencedDeclaration": 124695, "src": "401:4:174", "typeDescriptions": { - "typeIdentifier": "t_type$_t_contract$_User_$124675_$", + "typeIdentifier": "t_type$_t_contract$_User_$124695_$", "typeString": "type(contract User)" } }, @@ -618,7 +618,7 @@ "src": "401:17:174", "tryCall": false, "typeDescriptions": { - "typeIdentifier": "t_contract$_User_$124675", + "typeIdentifier": "t_contract$_User_$124695", "typeString": "contract User" } }, @@ -642,7 +642,7 @@ "stateVariable": false, "storageLocation": "default", "typeDescriptions": { - "typeIdentifier": "t_contract$_Loot_$124714", + "typeIdentifier": "t_contract$_Loot_$124734", "typeString": "contract Loot" }, "typeName": { @@ -652,13 +652,13 @@ "id": 120349, "name": "Loot", "nodeType": "IdentifierPath", - "referencedDeclaration": 124714, + "referencedDeclaration": 124734, "src": "428:4:174" }, - "referencedDeclaration": 124714, + "referencedDeclaration": 124734, "src": "428:4:174", "typeDescriptions": { - "typeIdentifier": "t_contract$_Loot_$124714", + "typeIdentifier": "t_contract$_Loot_$124734", "typeString": "contract Loot" } }, @@ -692,10 +692,10 @@ "name": "Loot", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 124714, + "referencedDeclaration": 124734, "src": "440:4:174", "typeDescriptions": { - "typeIdentifier": "t_type$_t_contract$_Loot_$124714_$", + "typeIdentifier": "t_type$_t_contract$_Loot_$124734_$", "typeString": "type(contract Loot)" } }, @@ -710,7 +710,7 @@ "src": "440:17:174", "tryCall": false, "typeDescriptions": { - "typeIdentifier": "t_contract$_Loot_$124714", + "typeIdentifier": "t_contract$_Loot_$124734", "typeString": "contract Loot" } }, @@ -812,7 +812,7 @@ "referencedDeclaration": 120344, "src": "503:4:174", "typeDescriptions": { - "typeIdentifier": "t_contract$_User_$124675", + "typeIdentifier": "t_contract$_User_$124695", "typeString": "contract User" } }, @@ -823,7 +823,7 @@ "lValueRequested": false, "memberName": "mint", "nodeType": "MemberAccess", - "referencedDeclaration": 124669, + "referencedDeclaration": 124689, "src": "503:9:174", "typeDescriptions": { "typeIdentifier": "t_function_external_nonpayable$_t_address_$returns$__$", @@ -880,7 +880,7 @@ "referencedDeclaration": 120351, "src": "529:4:174", "typeDescriptions": { - "typeIdentifier": "t_contract$_Loot_$124714", + "typeIdentifier": "t_contract$_Loot_$124734", "typeString": "contract Loot" } }, @@ -891,7 +891,7 @@ "lValueRequested": false, "memberName": "mint", "nodeType": "MemberAccess", - "referencedDeclaration": 124708, + "referencedDeclaration": 124728, "src": "529:9:174", "typeDescriptions": { "typeIdentifier": "t_function_external_nonpayable$_t_address_$returns$__$", @@ -970,7 +970,7 @@ "stateVariable": false, "storageLocation": "default", "typeDescriptions": { - "typeIdentifier": "t_contract$_User_$124675", + "typeIdentifier": "t_contract$_User_$124695", "typeString": "contract User" }, "typeName": { @@ -980,13 +980,13 @@ "id": 120381, "name": "User", "nodeType": "IdentifierPath", - "referencedDeclaration": 124675, + "referencedDeclaration": 124695, "src": "643:4:174" }, - "referencedDeclaration": 124675, + "referencedDeclaration": 124695, "src": "643:4:174", "typeDescriptions": { - "typeIdentifier": "t_contract$_User_$124675", + "typeIdentifier": "t_contract$_User_$124695", "typeString": "contract User" } }, @@ -1020,10 +1020,10 @@ "name": "User", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 124675, + "referencedDeclaration": 124695, "src": "655:4:174", "typeDescriptions": { - "typeIdentifier": "t_type$_t_contract$_User_$124675_$", + "typeIdentifier": "t_type$_t_contract$_User_$124695_$", "typeString": "type(contract User)" } }, @@ -1038,7 +1038,7 @@ "src": "655:17:174", "tryCall": false, "typeDescriptions": { - "typeIdentifier": "t_contract$_User_$124675", + "typeIdentifier": "t_contract$_User_$124695", "typeString": "contract User" } }, @@ -1062,7 +1062,7 @@ "stateVariable": false, "storageLocation": "default", "typeDescriptions": { - "typeIdentifier": "t_contract$_Loot_$124714", + "typeIdentifier": "t_contract$_Loot_$124734", "typeString": "contract Loot" }, "typeName": { @@ -1072,13 +1072,13 @@ "id": 120388, "name": "Loot", "nodeType": "IdentifierPath", - "referencedDeclaration": 124714, + "referencedDeclaration": 124734, "src": "682:4:174" }, - "referencedDeclaration": 124714, + "referencedDeclaration": 124734, "src": "682:4:174", "typeDescriptions": { - "typeIdentifier": "t_contract$_Loot_$124714", + "typeIdentifier": "t_contract$_Loot_$124734", "typeString": "contract Loot" } }, @@ -1112,10 +1112,10 @@ "name": "Loot", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 124714, + "referencedDeclaration": 124734, "src": "694:4:174", "typeDescriptions": { - "typeIdentifier": "t_type$_t_contract$_Loot_$124714_$", + "typeIdentifier": "t_type$_t_contract$_Loot_$124734_$", "typeString": "type(contract Loot)" } }, @@ -1130,7 +1130,7 @@ "src": "694:17:174", "tryCall": false, "typeDescriptions": { - "typeIdentifier": "t_contract$_Loot_$124714", + "typeIdentifier": "t_contract$_Loot_$124734", "typeString": "contract Loot" } }, @@ -1168,7 +1168,7 @@ "referencedDeclaration": 120390, "src": "721:4:174", "typeDescriptions": { - "typeIdentifier": "t_contract$_Loot_$124714", + "typeIdentifier": "t_contract$_Loot_$124734", "typeString": "contract Loot" } }, @@ -1179,7 +1179,7 @@ "lValueRequested": false, "memberName": "revealNFT", "nodeType": "MemberAccess", - "referencedDeclaration": 124713, + "referencedDeclaration": 124733, "src": "721:14:174", "typeDescriptions": { "typeIdentifier": "t_function_external_nonpayable$_t_uint256_$returns$__$", @@ -1236,7 +1236,7 @@ "referencedDeclaration": 120383, "src": "759:4:174", "typeDescriptions": { - "typeIdentifier": "t_contract$_User_$124675", + "typeIdentifier": "t_contract$_User_$124695", "typeString": "contract User" } }, @@ -1247,7 +1247,7 @@ "lValueRequested": false, "memberName": "revealNFT", "nodeType": "MemberAccess", - "referencedDeclaration": 124674, + "referencedDeclaration": 124694, "src": "759:14:174", "typeDescriptions": { "typeIdentifier": "t_function_external_nonpayable$_t_uint256_$returns$__$", diff --git a/packages/contracts/out/User.sol/MUser.json b/packages/contracts/out/User.sol/MUser.json index 5ec8f18d..ea568c79 100644 --- a/packages/contracts/out/User.sol/MUser.json +++ b/packages/contracts/out/User.sol/MUser.json @@ -1426,31 +1426,31 @@ "id": 121069, "exportedSymbols": { "Address": [ - 131421 + 131441 ], "Base64": [ 118883 ], "Context": [ - 131443 + 131463 ], "ERC165": [ - 131467 + 131487 ], "ERC721": [ 72425 ], "IERC165": [ - 173748 + 173768 ], "IERC721": [ - 131046 + 131066 ], "IERC721Metadata": [ - 131091 + 131111 ], "IERC721Receiver": [ - 131064 + 131084 ], "MRandom": [ 120314 @@ -1459,10 +1459,10 @@ 121068 ], "Math": [ - 132333 + 132353 ], "SignedMath": [ - 132438 + 132458 ], "Strings": [ 72654 @@ -9919,11 +9919,11 @@ 121068, 120314, 72425, - 131091, - 131046, - 131467, - 173748, - 131443 + 131111, + 131066, + 131487, + 173768, + 131463 ], "name": "MUser", "nameLocation": "172:5:175", diff --git a/packages/contracts/src/systems/BattlePrepareSystem.sol b/packages/contracts/src/systems/BattlePrepareSystem.sol index c0828708..596454ea 100644 --- a/packages/contracts/src/systems/BattlePrepareSystem.sol +++ b/packages/contracts/src/systems/BattlePrepareSystem.sol @@ -21,8 +21,8 @@ contract BattlePrepareSystem is System { //实际上是送到原点 // TODO似乎可以直接通过indexer获取,就不需要再次插入了 - // Player.setX(player, GameConfig.getOriginX(GAME_CONFIG_KEY)); - // Player.setY(player, GameConfig.getOriginY(GAME_CONFIG_KEY)); + Player.setX(player, GameConfig.getOriginX(GAME_CONFIG_KEY)); + Player.setY(player, GameConfig.getOriginY(GAME_CONFIG_KEY)); Player.setState(player, PlayerState.Exploring); } diff --git a/packages/contracts/worlds.json b/packages/contracts/worlds.json index f132ae20..cf780d29 100644 --- a/packages/contracts/worlds.json +++ b/packages/contracts/worlds.json @@ -4,11 +4,11 @@ "blockNumber": 29582781 }, "31337": { - "address": "0xD997fFf980e015359123C1124C21fae3bcD1f23d" + "address": "0x65fCA99E7D20e04fEc8bFdD7503eA927d2b890f5" }, "33784": { - "address": "0x60b886a32B2dC612532a6E0ADF62ACd9093D0EDF", - "blockNumber": 36757 + "address": "0xe59592e480262c15cB5EA88b5059AC61eE035B2c", + "blockNumber": 51279 }, "421613": { "address": "0x2Bc1034975c3df48D6f3026802f372677844b85d", From 5d8f405f4b60737899d9744486ac0d87334c3131 Mon Sep 17 00:00:00 2001 From: LidamaoHub Date: Sun, 12 Nov 2023 19:40:28 +0800 Subject: [PATCH 3/4] update contract --- packages/contracts/worlds.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/contracts/worlds.json b/packages/contracts/worlds.json index cf780d29..6ccdec98 100644 --- a/packages/contracts/worlds.json +++ b/packages/contracts/worlds.json @@ -7,8 +7,8 @@ "address": "0x65fCA99E7D20e04fEc8bFdD7503eA927d2b890f5" }, "33784": { - "address": "0xe59592e480262c15cB5EA88b5059AC61eE035B2c", - "blockNumber": 51279 + "address": "0xD1B2087d0317522df980050602CE91Ba37869139", + "blockNumber": 66981 }, "421613": { "address": "0x2Bc1034975c3df48D6f3026802f372677844b85d", From 195ec394c6d42901617bed34b76f0dcc40068109 Mon Sep 17 00:00:00 2001 From: Tiyo Date: Sun, 12 Nov 2023 21:47:21 +0800 Subject: [PATCH 4/4] fix: fix bug --- packages/client/src/mud/createSystemCalls.ts | 2 + packages/client/src/pages/game/index.tsx | 113 +++++++++++-------- 2 files changed, 69 insertions(+), 46 deletions(-) diff --git a/packages/client/src/mud/createSystemCalls.ts b/packages/client/src/mud/createSystemCalls.ts index 53ed722f..8be5feed 100644 --- a/packages/client/src/mud/createSystemCalls.ts +++ b/packages/client/src/mud/createSystemCalls.ts @@ -316,8 +316,10 @@ export function createSystemCalls( const submitGem = async () => { try { + console.log('submitGem', new Date().getTime()); const tx = await worldContract.write.submitGem(); await waitForTransaction(tx); + console.log('submitGem success', new Date().getTime(), tx); return tx } catch (error) { console.log('submitGem', error); diff --git a/packages/client/src/pages/game/index.tsx b/packages/client/src/pages/game/index.tsx index 29598a9b..669a81ce 100644 --- a/packages/client/src/pages/game/index.tsx +++ b/packages/client/src/pages/game/index.tsx @@ -8,7 +8,7 @@ import Map from "@/components/Map"; import UserAvatar from "@/components/UserAvatar"; import Leaderboard from "@/components/Leaderboard"; import { useLocation, useNavigate } from "react-router-dom"; -import { message } from 'antd'; +import { message, Modal } from 'antd'; import "./styles.scss"; import Rank from "@/components/Rank"; import { CurIdMockData, PlayersMockData, RankMockData, TreasureChestMockData } from "@/mock/data"; @@ -16,7 +16,7 @@ import { IPlayer } from "@/components/Player"; import { useMUD } from "@/mud/MUDContext"; import Battle from "@/components/Battle"; import GameContext from '@/context'; -import useModal from '@/hooks/useModal'; +// import useModal from '@/hooks/useModal'; import TreasureChest from '@/components/TreasureChest'; import UserInfoDialog from '@/components/UserInfoDialog'; import { DELIVERY } from '@/config/map'; @@ -72,10 +72,14 @@ const Game = () => { const [percentage, setPercentage] = useState(0); + const [modalVisible, setModalVisible] = useState(false); + const [modalType, setModalType] = useState(''); + const [gotBox, setGotBox] = useState(null); + const { account } = network; const curId = account; - const { Modal, open, close, setContent } = useModal(); + // const { Modal, open, close, setContent } = useModal(); const mapDataRef = useRef([]); const moveInterval = useRef(); @@ -190,24 +194,9 @@ const Game = () => { } const getCollectionsFun = (box: any) => { - setContent( -
-
- Congrats,you got {box.oreBalance} gems! - -
- -
-
-
- -
-
- ); - open(); + setGotBox(box); + setModalType('getCollections'); + setModalVisible(true); } const boxs = useEntityQuery([Has(BoxList)]).map((entity) => { @@ -290,6 +279,8 @@ const Game = () => { message.error('Waiting for transaction'); return; } + let txFinished = false; + curPlayer.waiting = true; let playerLock = getComponentValue(PlayerLocationLock, encodeEntity({ addr: "address" }, { addr: account})) console.log(playerLock, 'playerLock') if (playerLock && Number(playerLock.lockTime)) { @@ -300,9 +291,10 @@ const Game = () => { timeout = null }, 2000); } + txFinished = true; + curPlayer.waiting = false; return } - let txFinished = false; clearInterval(moveInterval.current); let pathIndex = 0; const timeInterval = ~~(1500 / Number(curPlayer.speed)) @@ -386,8 +378,10 @@ const Game = () => { const goHomeFun = async () => { if (!curPlayer.waiting) { try { + curPlayer.waiting = true; await goHome(); await joinBattlefield() + curPlayer.waiting = false; } catch (error) { console.log(error) } @@ -399,37 +393,44 @@ const Game = () => { } } + const closeUserInfoDialog = () => { + if (curPlayer.waiting) { + message.error('Waiting for transaction'); + return; + } else { + setUserInfoVisible(false); + } + } + const submitGemFun = async () => { setUserInfoVisible(true); try { - goHomeFun() + goHomeFun(); if (curPlayer.oreBalance > 0) { + console.log('submitGem') + setGotBox({oreBalance: curPlayer.oreBalance}); await submitGem(); - setContent( -
-
- Congrats,you submitted {curPlayer.oreBalance} gems! - -
- -
-
-
- -
-
- ); - open(); + console.log(curPlayer) + setModalType('submitGem'); + setModalVisible(true); } } catch (error) { console.log(error) } } + const closeModal = async () => { + if (modalType === 'getCollections') { + await getCollections(gotBox.id, gotBox.oreBalance, gotBox.treasureBalance); + } else if (modalType === 'submitGem') { + curPlayer.oreBalance = 0; + curPlayer.seasonOreBalance = PlayerSeasonData.filter((item) => item.addr.toLocaleLowerCase() == curPlayer.addr.toLocaleLowerCase())[0]?.oreBalance + } + setModalVisible(false); + setGotBox(null); + setModalType(''); + } + const setStartBattle = async (player) => { const paths = bfs(simpleMapData, { x: curPlayer.x, y: curPlayer.y }, {x: player.x, y: player.y}).slice(1); let res = await battleInvitation(player.addr, formatMovePath(paths)); @@ -521,13 +522,33 @@ const Game = () => { } { - setUserInfoVisible(false); - }} + onClose={closeUserInfoDialog} {...userInfoPlayer} /> - + setModalVisible(false)} + > +
+
+ { + modalType === 'submitGem' ?
Congrats,you submitted {gotBox?.oreBalance} gems!
: null + } + { + modalType === 'getCollections' ?
Congrats,you got {gotBox?.oreBalance} gems!
: null + } +
+ +
+
+
+ +
+
+