Closed maxcurrent420 closed 10 months ago
7ccd83358c
)[!TIP] I can email you next time I complete a pull request if you set up your email here!
Here are the GitHub Actions logs prior to making any changes:
d6d2d8f
Checking app.js for syntax errors... ✅ app.js has no syntax errors!
1/1 ✓Checking app.js for syntax errors... ✅ app.js has no syntax errors!
Sandbox passed on the latest main
, so sandbox checks will be enabled for this issue.
I found the following snippets in your repository. I will now analyze these snippets and come up with a plan.
components/NPC.js
✓ https://github.com/maxcurrent420/BeastBreeder/commit/4da3464598b6e98ea29b0d25035119f53805fd8b Edit
Create components/NPC.js with contents:
• Create a new file named NPC.js in the components folder.
• Define a class NPC with properties such as name, role, and dialogue. The dialogue property should be an array that will hold the dialogues for the NPC.
• Add methods for the NPC class. These methods could include startQuest and sellItem. The startQuest method can be similar to the startQuest method in the Quest class, and the sellItem method can be a new method that handles the logic for selling items to the player.
components/NPC.js
✓ Edit
Check components/NPC.js with contents:
Ran GitHub Actions for 4da3464598b6e98ea29b0d25035119f53805fd8b:
utils/dialogues.js
✓ https://github.com/maxcurrent420/BeastBreeder/commit/6bf6c8f88262e2473e209c43e6bc8658580c33fe Edit
Create utils/dialogues.js with contents:
• Create a new file named dialogues.js in the utils folder.
• Define an object that will hold the dialogues for the NPCs. The keys of the object should be the names of the NPCs, and the values should be arrays of dialogues.
• Add some standard dialogues for each NPC. These dialogues will be used in the NPC interactions with the player.
utils/dialogues.js
✓ Edit
Check utils/dialogues.js with contents:
Ran GitHub Actions for 6bf6c8f88262e2473e209c43e6bc8658580c33fe:
app.js
✓ https://github.com/maxcurrent420/BeastBreeder/commit/7368a7d9456d3cebe56b56f1cf292ed8bd244949 Edit
Modify app.js with contents:
• Import the NPC class from components/NPC.js and the dialogues from utils/dialogues.js at the top of the file.
• Instantiate some NPCs with the dialogues from the dialogues file. These NPCs can be stored in an array or an object for easy access during the game.
--- +++ @@ -10,8 +10,17 @@ import { loadInventoryScreen } from './screens/inventory.js'; import * as procedural from './utils/procedural.js'; import * as wallet from './utils/wallet.js'; -import * as gamedata from './utils/gamedata.js'; +import * as gamedata from './utils/gamedata.js'; +import { NPC } from './components/NPC.js'; +import { dialogues } from './utils/dialogues.js'; +// NPCs +const villageElder = new NPC('Village Elder', 'Elder', dialogues['Village Elder']); +const shopkeeper = new NPC('Shopkeeper', 'Merchant', dialogues['Shopkeeper']); +const blacksmith = new NPC('Blacksmith', 'Smith', dialogues['Blacksmith']); + +let npcs = [villageElder, shopkeeper, blacksmith]; + // Generate monster const monster = new Monster("Dragon", 300, 50, 30, ["Fire"]);
app.js
✓ Edit
Check app.js with contents:
Ran GitHub Actions for 7368a7d9456d3cebe56b56f1cf292ed8bd244949:
I have finished reviewing the code for completeness. I did not find errors for sweep/create_npcjs
.
💡 To recreate the pull request edit the issue title or description. To tweak the pull request, leave a comment on the pull request. Join Our Discord
Details
Checklist
- [X] Create `components/NPC.js` ✓ https://github.com/maxcurrent420/BeastBreeder/commit/4da3464598b6e98ea29b0d25035119f53805fd8b [Edit](https://github.com/maxcurrent420/BeastBreeder/edit/sweep/create_npcjs/components/NPC.js) - [X] Running GitHub Actions for `components/NPC.js` ✓ [Edit](https://github.com/maxcurrent420/BeastBreeder/edit/sweep/create_npcjs/components/NPC.js) - [X] Create `utils/dialogues.js` ✓ https://github.com/maxcurrent420/BeastBreeder/commit/6bf6c8f88262e2473e209c43e6bc8658580c33fe [Edit](https://github.com/maxcurrent420/BeastBreeder/edit/sweep/create_npcjs/utils/dialogues.js) - [X] Running GitHub Actions for `utils/dialogues.js` ✓ [Edit](https://github.com/maxcurrent420/BeastBreeder/edit/sweep/create_npcjs/utils/dialogues.js) - [X] Modify `app.js` ✓ https://github.com/maxcurrent420/BeastBreeder/commit/7368a7d9456d3cebe56b56f1cf292ed8bd244949 [Edit](https://github.com/maxcurrent420/BeastBreeder/edit/sweep/create_npcjs/app.js#L1-L1) - [X] Running GitHub Actions for `app.js` ✓ [Edit](https://github.com/maxcurrent420/BeastBreeder/edit/sweep/create_npcjs/app.js#L1-L1)