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

Hunter Rumours #6077

Closed
wants to merge 5,607 commits into from
Closed

Conversation

DaughtersOfNyx
Copy link
Contributor

@DaughtersOfNyx DaughtersOfNyx commented Oct 1, 2024

Description:

This PR adds the following:

  • Hunter Rumours, accessible via /rumours start

  • A Rumour blocklist, accessible via /rumours manage

  • Checking Rumour count via /rumours count

  • Rumour Collection Log, including 5 items and a pet

  • 7 New Hunter Creatures (Embertailed Jerboa, Sunlight Moth, Moonlight Moth, Sunlight Antelope, Moonlight Antelope, Pyre Fox, Tecu Salamander)

  • 2 New Buyables (Mixed Hide Base & Jaguar Fur)

  • 11 New Createable Items (Mixed Hide Armor, Quetzal Whistles and hunter's spear and sunlight crossbow)

  • 9 New Cookable and Eatable hunter meats, with the higher tiers having PVM bonuses

  • 4 New Openable Hunter Sacks, one for each tier

  • 2 New Fletchable Items (from antelope antlers)

  • Hunter Outfit Mod boosting catch chance

Changes: (Backend Stuff)

  • Added rumour stats and blocklist to the Schema
  • Added a Rumour command + subcommands and Activity
  • Added an optional field called "rumoursRequired" to cookables to allow for the rumour requirement for cooking hunter meats to work, this shouldn't (and doesn't from my testing) break anything existing
  • Added an optional array named "tier" to hunter creatures to specify what tier/s of rumour they can be assigned for

Other checks:

  • I have tested all my changes thoroughly. (2 Rounds of testing in the testing discord, alongside extensive testing privately by myself and a friend.

Important

Adds Hunter Rumours feature with new commands, items, creatures, and schema updates.

  • Features:
    • Adds Hunter Rumours accessible via /rumours start, with subcommands for managing and counting.
    • Introduces 7 new Hunter Creatures and 2 new buyable items.
    • Adds 11 new creatable items, 9 new cookable meats, 4 new openable sacks, and 2 new fletchable items.
    • Implements Hunter Outfit Mod boosting catch chance.
  • Schema:
    • Adds rumour_blocked_ids and rumours to User and UserStats models in schema.prisma.
  • Commands:
    • Adds rumourCommand in rumour.ts for handling Hunter Rumours.
  • Tasks:
    • Adds rumourTask in rumourActivity.ts for processing Rumour activities.
  • Data:
    • Updates Collections.ts and CollectionsExport.ts for new items and creatures.
    • Adds hunterCreatables in hunter.ts for new creatable items.
  • Misc:
    • Updates bankImage.ts for new loot sack names.
    • Modifies hunterActivity.ts to include outfit mod in calculations.

This description was created by Ellipsis for c2809b5. It will automatically update as commits are pushed.

Copy link
Collaborator

@gc gc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the gif image has been corrupted, to fix it first merge master, these 2 commands may fix it:

git rm --cached -r . 
git add .

otherwise, you could just manually put the gif there.

Copy link
Collaborator

@gc gc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of using Record<RumorIndex, number> for their "kc" of each rumour, put this in src\lib\structures\Bank.ts

export class RumorTierBank extends GeneralBank<RumourOption> {
	constructor(initialBank?: GeneralBankType<RumourOption>) {
		super({ initialBank, allowedKeys: RumourOptions });
	}

	toJSON() {
		return this._bank;
	}
}

Now, you have a easier (and typesafe) way to add/remove/etc KCs.

const rumourTierBank = new RumorTierBank();
rumourTierBank.add('novice', 1);

updating:

await userStatsUpdate(user.id, { rumours: rumourTierBank.toJSON() }, {});

honour_level Int @default(1)
high_gambles Int @default(0)
honour_points Int @default(0)
rumours Int[] @default([0, 0, 0, 0])
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To prevent your PR changing all these lines, separate your addition with an empty line.

const Rumours: Rumour[] = [];
let totalDuration = 0;
const maxDurationInSeconds = maxLength / 1000;
const blockList = (await getRumourBlockList(user.id)).rumour_blocked_ids;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cant you just do user.user.rumour_blocked_ids ? the getRumourBlockList function seems pointless


if (!selectedCreature) break;

const DurationAndQty = calcDurationAndQty(selectedCreature, user);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be camelcase

if (!selectedCreature) break;

const DurationAndQty = calcDurationAndQty(selectedCreature, user);
if (tier === 'novice' || tier === 'adept') DurationAndQty[0] += 50; //Extra 50 seconds per task for low rumour tier (creatures are more spread out)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

put comments like this on the line above

function calcDurationAndQty(creature: Creature, user: MUser): [number, number] {
const dropRate = hunterTechniqueToRate[creature.huntTechnique];

if (dropRate === -1) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably be checking for undefined

export async function rumourCount(userID: string): CommandResponse {
const user = await mUserFetch(userID);
const { rumours: rumoursCompleted } = await user.fetchStats({ rumours: true });
const totalrumours = rumoursCompleted.reduce((a, b) => a + b);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be camelcase. Note that we have a sumArr() fn you could use too.

rumoursCompleted[RumourOptions.indexOf(tier)] += quantity;
await userStatsUpdate(user.id, { rumours: rumoursCompleted }, {});

const newTotalrumours = rumoursCompleted.reduce((a, b) => a + b);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be camelcase

let str = 'You have the following creatures blocked:';

for (let i = 0; i < 4; i++) {
const tier = RumourOptions[i].charAt(0).toUpperCase() + RumourOptions[i].slice(1);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You may want the toTitleCase() function here.

@@ -306,6 +306,7 @@ model User {
minion_farmingContract Json? @map("minion.farmingContract") @db.Json
minion_birdhouseTraps Json? @map("minion.birdhouseTraps") @db.Json
finished_quest_ids Int[] @default([])
rumour_blocked_ids Int[] @default([0, 0, 0, 0])
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dont see why this is an array of 4 0's by default.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants