-
Notifications
You must be signed in to change notification settings - Fork 133
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
Hunter Rumours #6077
Conversation
There was a problem hiding this 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.
There was a problem hiding this 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() }, {});
prisma/schema.prisma
Outdated
honour_level Int @default(1) | ||
high_gambles Int @default(0) | ||
honour_points Int @default(0) | ||
rumours Int[] @default([0, 0, 0, 0]) |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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.
src/tasks/minions/rumourActivity.ts
Outdated
rumoursCompleted[RumourOptions.indexOf(tier)] += quantity; | ||
await userStatsUpdate(user.id, { rumours: rumoursCompleted }, {}); | ||
|
||
const newTotalrumours = rumoursCompleted.reduce((a, b) => a + b); |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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.
prisma/schema.prisma
Outdated
@@ -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]) |
There was a problem hiding this comment.
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.
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)
Other checks:
Important
Adds Hunter Rumours feature with new commands, items, creatures, and schema updates.
/rumours start
, with subcommands for managing and counting.rumour_blocked_ids
andrumours
toUser
andUserStats
models inschema.prisma
.rumourCommand
inrumour.ts
for handling Hunter Rumours.rumourTask
inrumourActivity.ts
for processing Rumour activities.Collections.ts
andCollectionsExport.ts
for new items and creatures.hunterCreatables
inhunter.ts
for new creatable items.bankImage.ts
for new loot sack names.hunterActivity.ts
to include outfit mod in calculations.This description was created by for c2809b5. It will automatically update as commits are pushed.