Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for being able to queue is full mode only actions when there are … #81

Merged
merged 1 commit into from
Sep 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,12 @@ Clans [0x334caa8907bdf49470f7b085380c25431ef96f6d](https://ftmscan.com/address/0
WishingWell [0x0a8d80ce4855666b7d7121d75f2a49aac434a918](https://ftmscan.com/address/0x0a8d80ce4855666b7d7121d75f2a49aac434a918)
Bank Beacon [0xe183a43881eac74808c55bdb2a073929602af4db](https://ftmscan.com/address/0xe183a43881eac74808c55bdb2a073929602af4db)

PlayersLibrary [0x0DAbE42562B15614887C68fe486E9B81CB5DDbE9](https://ftmscan.com/address/0x0DAbE42562B15614887C68fe486E9B81CB5DDbE9)
PlayersImplQueueActions [0xb86cadad55067e24540c6d781d16778f887bf62f](https://ftmscan.com/address/0xb86cadad55067e24540c6d781d16778f887bf62f)
PlayersImplProcessActions [0xe2a9b8c9cee566ae94758510aeaca20476eff97f](https://ftmscan.com/address/0xe2a9b8c9cee566ae94758510aeaca20476eff97f)
PlayersImplRewards [0xfb2aa5afc0de399c76d570ac9bc446940367cfba](https://ftmscan.com/address/0xfb2aa5afc0de399c76d570ac9bc446940367cfba)
PlayersImplMisc [0xddf2bf45e270c1cd624a6ad479974dff24113500](https://ftmscan.com/address/0xddf2bf45e270c1cd624a6ad479974dff24113500)
PlayersImplMisc1 [0xc62bdaebc179b3f9cc83ac978db834457aea893b](https://ftmscan.com/address/0xc62bdaebc179b3f9cc83ac978db834457aea893b)
PlayersLibrary [0xfd0145ef3585176345cf8f2c63e025049f689073](https://ftmscan.com/address/0xfd0145ef3585176345cf8f2c63e025049f689073)
PlayersImplQueueActions [0x0776fd8b445e272b718db2db13f500d4d31b5de6](https://ftmscan.com/address/0x0776fd8b445e272b718db2db13f500d4d31b5de6)
PlayersImplProcessActions [0xb041035dbb95eac6011c5ef3cdd8a355fcb68700](https://ftmscan.com/address/0xb041035dbb95eac6011c5ef3cdd8a355fcb68700)
PlayersImplRewards [0x139bb2ac01597c7b4e6157aba6a4b3db1620014d](https://ftmscan.com/address/0x139bb2ac01597c7b4e6157aba6a4b3db1620014d)
PlayersImplMisc [0xf2136389a8e829da6a399b58ad56999d99e7cef7](https://ftmscan.com/address/0xf2136389a8e829da6a399b58ad56999d99e7cef7)
PlayersImplMisc1 [0x971703455f101d1d81d71e82a9ba895446c1183f](https://ftmscan.com/address/0x971703455f101d1d81d71e82a9ba895446c1183f)
Players [0x058ec56aba13f7fee3ae9c9b91b3bb03bc336143](https://ftmscan.com/address/0x058ec56aba13f7fee3ae9c9b91b3bb03bc336143)

BankRegistry [0x55a1b0251e1375bd41dd9778c379322e3863a54e](https://ftmscan.com/address/0x55a1b0251e1375bd41dd9778c379322e3863a54e)
Expand Down Expand Up @@ -114,11 +114,11 @@ WishingWell [0xdd1131f57e5e416622fa2b61d4108822e8cc38dc](https://ftmscan.com/add
Bank Beacon [0x73d1b1420deaeb6474b8aafb1d8229d392d1a04e](https://ftmscan.com/address/0x73d1b1420deaeb6474b8aafb1d8229d392d1a04e)

PlayersLibrary [0xa603b1b306032218032716e326d40ba37dd38c7d](https://ftmscan.com/address/0xa603b1b306032218032716e326d40ba37dd38c7d)
PlayersImplQueueActions [0xbbe4d7d9027e22562386cb794c618cde55ef04be](https://ftmscan.com/address/0xbbe4d7d9027e22562386cb794c618cde55ef04be)
PlayersImplProcessActions [0xb42935f9a62dc3c6f6898d54400b8c6b68a29f22](https://ftmscan.com/address/0xb42935f9a62dc3c6f6898d54400b8c6b68a29f22)
PlayersImplRewards [0x45cac1133b81181af3d0543c33a3e7c568579592](https://ftmscan.com/address/0x45cac1133b81181af3d0543c33a3e7c568579592)
PlayersImplMisc [0x55919fc7193d8c5fa409a1d2437ecda0eb395f17](https://ftmscan.com/address/0x55919fc7193d8c5fa409a1d2437ecda0eb395f17)
PlayersImplMisc1 [0xae72aebfdd87f74aa9409ada0f64a6d9d41a2ec8](https://ftmscan.com/address/0xae72aebfdd87f74aa9409ada0f64a6d9d41a2ec8)
PlayersImplQueueActions [0x14c8bd1269d27df96c6c3cb9d6d77db8c7e0c3c2](https://ftmscan.com/address/0x14c8bd1269d27df96c6c3cb9d6d77db8c7e0c3c2)
PlayersImplProcessActions [0x6e05be301a2c3b0ab3dff1cb3b2146d1bae95cb7](https://ftmscan.com/address/0x6e05be301a2c3b0ab3dff1cb3b2146d1bae95cb7)
PlayersImplRewards [0x406837789a65cbe484d972fd6505b6e958078de2](https://ftmscan.com/address/0x406837789a65cbe484d972fd6505b6e958078de2)
PlayersImplMisc [0xd4c808f05134923d90c2d88052b561e984ab0fdd](https://ftmscan.com/address/0xd4c808f05134923d90c2d88052b561e984ab0fdd)
PlayersImplMisc1 [0x8bf03010110f8b5bb60e3c2d189899d1fbf66245](https://ftmscan.com/address/0x8bf03010110f8b5bb60e3c2d189899d1fbf66245)
Players [0x0aac9c0966ad5ea59cd0a47a0d415a68126ab7be](https://ftmscan.com/address/0x0aac9c0966ad5ea59cd0a47a0d415a68126ab7be)

BankRegistry [0xd5da02cee3d9ef0d63d1b79c659df16770c3c4e0](https://ftmscan.com/address/0xd5da02cee3d9ef0d63d1b79c659df16770c3c4e0)
Expand Down
9 changes: 4 additions & 5 deletions contracts/Players/PlayersImplQueueActions.sol
Original file line number Diff line number Diff line change
Expand Up @@ -288,11 +288,10 @@ contract PlayersImplQueueActions is PlayersImplBase, PlayersBase {
}
} else if (_queuedActionInput.choiceId != NONE) {
revert ActionChoiceIdNotRequired();
} else {
// Check if the action requires full mode. Done here as don't want to check if both action and actionChoice are full mode only
if (actionInfo.isFullModeOnly && !isPlayerUpgraded) {
revert PlayerNotUpgraded();
}
}

if (actionInfo.isFullModeOnly && !isPlayerUpgraded) {
revert PlayerNotUpgraded();
}

if (_queuedActionInput.timespan == 0) {
Expand Down
20 changes: 10 additions & 10 deletions scripts/contractAddresses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ if (!isBeta) {
wishingWell = "0x0a8d80ce4855666b7d7121d75f2a49aac434a918";
bank = "0xe183a43881eac74808c55bdb2a073929602af4db"; // beacon
playersLibrary = "0xfd0145ef3585176345cf8f2c63e025049f689073";
playersImplQueueActions = "0xb86cadad55067e24540c6d781d16778f887bf62f";
playersImplProcessActions = "0xe2a9b8c9cee566ae94758510aeaca20476eff97f";
playersImplRewards = "0x5c4e321eacba5499bd3e55b796cc3bea47adc473";
playersImplMisc = "0xddf2bf45e270c1cd624a6ad479974dff24113500";
playersImplMisc1 = "0xc62bdaebc179b3f9cc83ac978db834457aea893b";
playersImplQueueActions = "0x0776fd8b445e272b718db2db13f500d4d31b5de6";
playersImplProcessActions = "0xb041035dbb95eac6011c5ef3cdd8a355fcb68700";
playersImplRewards = "0x139bb2ac01597c7b4e6157aba6a4b3db1620014d";
playersImplMisc = "0xf2136389a8e829da6a399b58ad56999d99e7cef7";
playersImplMisc1 = "0x971703455f101d1d81d71e82a9ba895446c1183f";
players = "0x058ec56aba13f7fee3ae9c9b91b3bb03bc336143";
bankRegistry = "0x55a1b0251e1375bd41dd9778c379322e3863a54e";
bankFactory = "0x4af59427b2aeb66e6f7dca98c366ec66cca4e8d4";
Expand Down Expand Up @@ -99,11 +99,11 @@ if (!isBeta) {
wishingWell = "0xdd1131f57e5e416622fa2b61d4108822e8cc38dc";
bank = "0x73d1b1420deaeb6474b8aafb1d8229d392d1a04e";
playersLibrary = "0xa603b1b306032218032716e326d40ba37dd38c7d";
playersImplQueueActions = "0xbbe4d7d9027e22562386cb794c618cde55ef04be";
playersImplProcessActions = "0xb42935f9a62dc3c6f6898d54400b8c6b68a29f22";
playersImplRewards = "0x45cac1133b81181af3d0543c33a3e7c568579592";
playersImplMisc = "0x55919fc7193d8c5fa409a1d2437ecda0eb395f17";
playersImplMisc1 = "0xae72aebfdd87f74aa9409ada0f64a6d9d41a2ec8";
playersImplQueueActions = "0x14c8bd1269d27df96c6c3cb9d6d77db8c7e0c3c2";
playersImplProcessActions = "0x6e05be301a2c3b0ab3dff1cb3b2146d1bae95cb7";
playersImplRewards = "0x406837789a65cbe484d972fd6505b6e958078de2";
playersImplMisc = "0xd4c808f05134923d90c2d88052b561e984ab0fdd";
playersImplMisc1 = "0x8bf03010110f8b5bb60e3c2d189899d1fbf66245";
players = "0x0aac9c0966ad5ea59cd0a47a0d415a68126ab7be";
bankRegistry = "0xd5da02cee3d9ef0d63d1b79c659df16770c3c4e0";
// const bankProxy = "0xe1998e9bad94716ecf81f3a3bead5fed3fb023cb"; // Only used for old beta clans
Expand Down
8 changes: 4 additions & 4 deletions scripts/deployImpls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,11 @@ async function main() {
*/
const players = (await ethers.getContractAt("Players", PLAYERS_ADDRESS)).connect(owner) as Players;
const tx = await players.setImpls(
PLAYERS_IMPL_QUEUE_ACTIONS_ADDRESS,
PLAYERS_IMPL_PROCESS_ACTIONS_ADDRESS,
playersImplQueueActions.address,
playersImplProcessActions.address,
playersImplRewards.address,
PLAYERS_IMPL_MISC_ADDRESS,
PLAYERS_IMPL_MISC1_ADDRESS
playersImplMisc.address,
playersImplMisc1.address
);
await tx.wait();
}
Expand Down
41 changes: 41 additions & 0 deletions test/Players/Players.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1970,6 +1970,47 @@ describe("Players", function () {
await players.connect(alice).startActions(playerId, [queuedAction], EstforTypes.ActionQueueStatus.NONE);
});

it("Check that only upgraded players can start a non-full mode only actionChoice, where action is set to full mode only", async function () {
const {playerId, players, itemNFT, world, alice, playerNFT, brush, upgradePlayerBrushPrice, origName} =
await loadFixture(playersFixture);

const successPercent = 100;
const minLevel = 1;
const {queuedAction} = await setupBasicCooking(itemNFT, world, successPercent, minLevel);

await world.editActions([
{
actionId: 1,
info: {
skill: EstforTypes.Skill.COOKING,
xpPerHour: 0,
minXP: 0,
isDynamic: false,
worldLocation: 0,
isFullModeOnly: true,
numSpawned: 0,
handItemTokenIdRangeMin: EstforConstants.NONE,
handItemTokenIdRangeMax: EstforConstants.NONE,
isAvailable: true,
actionChoiceRequired: true,
successPercent: 100,
},
guaranteedRewards: [],
randomRewards: [],
combatStats: EstforTypes.emptyCombatStats,
},
]);

await expect(
players.connect(alice).startActions(playerId, [queuedAction], EstforTypes.ActionQueueStatus.NONE)
).to.be.revertedWithCustomError(players, "PlayerNotUpgraded");
// Upgrade and try again
await brush.connect(alice).approve(playerNFT.address, upgradePlayerBrushPrice);
await brush.mint(alice.address, upgradePlayerBrushPrice);
await playerNFT.connect(alice).editPlayer(playerId, origName, "", "", "", true);
await players.connect(alice).startActions(playerId, [queuedAction], EstforTypes.ActionQueueStatus.NONE);
});

it("Check that only upgraded players can start a full mode only action", async function () {
const {playerId, world, players, brush, alice, playerNFT, origName, upgradePlayerBrushPrice} = await loadFixture(
playersFixture
Expand Down
Loading