-
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
Managing Miscellania #5960
Managing Miscellania #5960
Conversation
* Add price abuse check to packaged buyables.
…ngs admin command. (oldschoolgg#5748)
…into managing-miscellania
…into managing-miscellania
@ellipsis-dev review this pr |
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.
❌ Changes requested. Reviewed everything up to f7b3b51 in 46.953906 seconds
More details
- Looked at
791
lines of code in12
files - Skipped
0
files when reviewing. - Skipped posting
0
drafted comments based on config settings.
Workflow ID: wflow_QpI0DAU4V6q3oB38
Want Ellipsis to fix these issues? Tag @ellipsis-dev
in a comment. You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
src/mahoji/lib/abstracted_commands/managingMiscellaniaCommand.ts
Outdated
Show resolved
Hide resolved
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.
👍 Looks good to me! Reviewed everything up to f7b3b51 in 45.054875 seconds
More details
- Looked at
791
lines of code in12
files - Skipped
0
files when reviewing. - Skipped posting
1
drafted comments based on config settings.
1. src/mahoji/lib/abstracted_commands/managingMiscellaniaCommand.ts:123
- Draft comment:
The conflict check for the main and secondary collection areas inmanagingMiscellaniaCommand
is redundant if the main and secondary areas are the same. Consider reordering the checks to avoid unnecessary operations:
if (mainPair === secondaryPair) {
return 'You are unable to allocate workers to the same area.';
}
if (conflictPairs[mainPair]?.includes(secondaryPair)) {
return conflictString;
}
- Reason this comment was not posted:
Based on historical feedback, this comment is too similar to comments previously marked by users as bad.
Workflow ID: wflow_wo8bLL0KlPTEA35f
You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
export const managingMiscellaniaTask: MinionTask = { | ||
type: 'ManagingMiscellania', | ||
async run(data: ManagingMiscellaniaActivityTaskOptions) { | ||
const { userID, channelID, main_collect, secondary_collect, cofferCost } = data; | ||
const user = await mUserFetch(userID); | ||
const loot = new Bank(); | ||
|
||
const main = main_collect; | ||
const secondary = secondary_collect; | ||
const cofferMax = 75000; | ||
|
||
const daysDifference = Math.round(cofferCost / 75_000); | ||
|
||
const workerEffectiveness = (cofferMax * 100) / 8333; | ||
|
||
const dailyResourcePoints = Math.floor((workerEffectiveness * 127) / 100); | ||
|
||
const totalResourcePoints = Math.min(262143, daysDifference * dailyResourcePoints); | ||
|
||
const mainQty = getBaseQuantity(main, 10, totalResourcePoints); | ||
const secondaryQty = getBaseQuantity(secondary, 5, totalResourcePoints); | ||
|
||
await userStatsUpdate(user.id, { last_managing_miscellania_timestamp: new Date().getTime() }, {}); | ||
|
||
function addLoot(category: string, quantity: number) { | ||
switch (category) { | ||
case 'Wood': | ||
loot.add('Maple logs', quantity); | ||
loot.add(nestTable.roll(Math.min(999, Math.floor(quantity / 100)))); | ||
break; | ||
case 'Mining': | ||
loot.add('Coal', quantity); | ||
loot.add(miningGems.roll(Math.floor(quantity / 200 + 0.5))); | ||
break; | ||
case 'Fishing': | ||
loot.add('Raw tuna', Math.floor(0.5 * quantity)); | ||
loot.add('Raw swordfish', Math.floor(0.15 * quantity)); | ||
loot.add(fishingLoot.roll(Math.floor(quantity / 200))); | ||
break; | ||
case 'Cooked Fish': | ||
loot.add('Tuna', Math.floor(0.5 * quantity)); | ||
loot.add('Swordfish', Math.floor(0.15 * quantity)); | ||
loot.add(fishingLoot.roll(Math.floor(quantity / 200))); | ||
break; | ||
case 'Herbs': | ||
loot.add(herbsLoot.roll(quantity)); | ||
loot.add(herbSeedsLoot.roll(Math.floor(quantity / 100))); | ||
break; | ||
case 'Flax': | ||
loot.add('Flax', quantity); | ||
loot.add(flaxSeedsLoot.roll(Math.floor(quantity / 600))); | ||
break; | ||
case 'Mahogany': | ||
loot.add('Mahogany logs', quantity); | ||
loot.add(nestTable.roll(Math.floor(quantity / 350))); | ||
break; | ||
case 'Teak': | ||
loot.add('Teak logs', quantity); | ||
loot.add(nestTable.roll(Math.floor(quantity / 350))); | ||
break; | ||
case 'Hardwood (Mahogany and Teak)': | ||
loot.add('Mahogany logs', Math.floor(quantity * 0.5)); | ||
loot.add('Teak logs', Math.floor(quantity * 0.5)); | ||
loot.add(nestTable.roll(Math.floor(quantity / 350))); | ||
break; | ||
case 'Farm': | ||
loot.add(seedsLoot.roll(quantity)); | ||
loot.add(treeSeedsLoot.roll(Math.floor(quantity / 200))); | ||
break; | ||
} | ||
} | ||
|
||
addLoot(main, mainQty); | ||
addLoot(secondary, secondaryQty); | ||
|
||
const str = `${user}, ${user.minionName} finished collecting from the kingdom, you received ${loot}.`; | ||
|
||
await user.addItemsToBank({ items: loot, collectionLog: true }); | ||
await updateBankSetting('managing_miscellania_loot', loot); | ||
|
||
const image = await makeBankImage({ bank: loot, title: 'Managing Miscellania Loot', user }); | ||
|
||
handleTripFinish(user, channelID, str, image.file.attachment, data, loot); | ||
} |
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 abstracted outside this task, so that we can test/run it without a minion trip. It might be something like function determineManagingMiscLoot(inputsNeeded)
. This gives several big benefits: we can add simulating commands for it, and add tests for it.
You may want a second function which determines points/etc based on dates (not 100% sure how it works)
Adds the ability to collect from the Kingdom of Miscellania.
For simplicity in the bot, we assume:
Key Points:
/activities managing_miscellania
command to start the activity. You will need to specify your main collect area (where the 10 workers are) and the secondary collect area (where the additional 5 workers are).Testing Tool:
A new
/testpotato setcooldown
command has been added to modify the date you last performed Managing Miscellania. (Also tears of guthix and dailies)I have tested all my changes thoroughly.
closes: Managing Miscellania #1609
Summary:
Added functionality to manage and collect resources from the Kingdom of Miscellania, including new commands, tasks, and database fields.
Key points:
managing_miscellania_cost
andmanaging_miscellania_loot
fields toprisma/schema.prisma
.ManagingMiscellaniaActivityTaskOptions
insrc/lib/types/minions.ts
.managingMiscellaniaTask
tosrc/lib/Task.ts
.cooldownTimers
insrc/lib/events.ts
to includeManaging Miscellania
.ManagingMiscellania
case inminionStatus
function insrc/lib/util/minionStatus.ts
.taskCanBeRepeated
andtripHandlers
insrc/lib/util/repeatStoredTrip.ts
.managing_miscellania_cost
andmanaging_miscellania_loot
toClientBankKey
insrc/lib/util/updateBankSetting.ts
.managingMiscellaniaCommand
insrc/mahoji/commands/activities.ts
.managingMiscellaniaCommand
insrc/mahoji/lib/abstracted_commands/managingMiscellaniaCommand.ts
.managingMiscellaniaTask
insrc/tasks/managingMiscellaniaActivity.ts
.tests/globalSetup.ts
to includelast_managing_miscellania_timestamp
.Generated with ❤️ by ellipsis.dev