Skip to content

Commit 7613a68

Browse files
committed
add remove quest script
1 parent d191ba6 commit 7613a68

3 files changed

Lines changed: 59 additions & 20 deletions

File tree

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@
9494
"clearPlayerPromotion": "npx hardhat run scripts/clearPlayerPromotion.ts",
9595
"addQuests": "npx hardhat run scripts/addQuests.ts",
9696
"editQuests": "npx hardhat run scripts/editQuests.ts",
97+
"removeQuests": "npx hardhat run scripts/removeQuests.ts",
9798
"addActions": "npx hardhat run scripts/addActions.ts",
9899
"editActions": "npx hardhat run scripts/editActions.ts",
99100
"addActionChoices": "npx hardhat run scripts/addActionChoices.ts",

scripts/data/quests.ts

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -115,26 +115,26 @@ export const allQuests: QuestInput[] = [
115115
isFullModeOnly: false,
116116
worldLocation: 0,
117117
},
118-
{
119-
questId: EstforConstants.QUEST_PURSE_STRINGS, // Special one that just involves buying brush
120-
dependentQuestId: 0,
121-
actionId1: NONE,
122-
actionNum1: 0,
123-
actionId2: NONE,
124-
actionNum2: 0,
125-
actionChoiceId: NONE,
126-
actionChoiceNum: 0,
127-
skillReward: Skill.HEALTH,
128-
skillXPGained: 100,
129-
rewardItemTokenId1: NONE,
130-
rewardAmount1: 0,
131-
rewardItemTokenId2: NONE,
132-
rewardAmount2: 0,
133-
burnItemTokenId: NONE,
134-
burnAmount: 0,
135-
isFullModeOnly: false,
136-
worldLocation: 0,
137-
},
118+
// {
119+
// questId: EstforConstants.QUEST_PURSE_STRINGS, // Special one that just involves buying brush
120+
// dependentQuestId: 0,
121+
// actionId1: NONE,
122+
// actionNum1: 0,
123+
// actionId2: NONE,
124+
// actionNum2: 0,
125+
// actionChoiceId: NONE,
126+
// actionChoiceNum: 0,
127+
// skillReward: Skill.HEALTH,
128+
// skillXPGained: 100,
129+
// rewardItemTokenId1: NONE,
130+
// rewardAmount1: 0,
131+
// rewardItemTokenId2: NONE,
132+
// rewardAmount2: 0,
133+
// burnItemTokenId: NONE,
134+
// burnAmount: 0,
135+
// isFullModeOnly: false,
136+
// worldLocation: 0,
137+
// },
138138
{
139139
questId: EstforConstants.QUEST_ALMS_POOR,
140140
dependentQuestId: 0,

scripts/removeQuests.ts

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import {EstforConstants} from "@paintswap/estfor-definitions";
2+
import {ethers} from "hardhat";
3+
import {ITEM_NFT_ADDRESS, QUESTS_ADDRESS} from "./contractAddresses";
4+
import {allItems} from "./data/items";
5+
import {getSafeUpgradeTransaction, initialiseSafe, sendTransactionSetToSafe} from "./utils";
6+
import {ItemNFT__factory, Quests__factory} from "../typechain-types";
7+
import {OperationType, MetaTransactionData} from "@safe-global/types-kit";
8+
9+
async function main() {
10+
const [owner, , proposer] = await ethers.getSigners(); // 0 is old deployer, 2 is proposer for Safe (new deployer)
11+
const network = await ethers.provider.getNetwork();
12+
const {useSafe, apiKit, protocolKit} = await initialiseSafe(network);
13+
console.log(`Removing items using account: ${proposer.address} on chain id ${network.chainId}, useSafe: ${useSafe}`);
14+
15+
const quests = await ethers.getContractAt("Quests", QUESTS_ADDRESS);
16+
17+
const itemsToDelete = EstforConstants.QUEST_PURSE_STRINGS;
18+
19+
if (useSafe) {
20+
const transactionSet: MetaTransactionData[] = [];
21+
const iface = Quests__factory.createInterface();
22+
23+
transactionSet.push({
24+
to: ethers.getAddress(QUESTS_ADDRESS),
25+
value: "0",
26+
data: iface.encodeFunctionData("removeQuest", [itemsToDelete]),
27+
operation: OperationType.Call,
28+
});
29+
await sendTransactionSetToSafe(network, protocolKit, apiKit, transactionSet, proposer);
30+
} else {
31+
await quests.removeQuest(itemsToDelete);
32+
}
33+
}
34+
35+
main().catch((error) => {
36+
console.error(error);
37+
process.exitCode = 1;
38+
});

0 commit comments

Comments
 (0)