Skip to content

Commit

Permalink
First wave of "Works from Bank" poll results (#5659)
Browse files Browse the repository at this point in the history
* Invention master cape from bank

* Skilling outfits

* A few skilling items

* Misc skilling items / master skillcapes

* Some dwarven gear
  • Loading branch information
themrrobert authored Feb 7, 2024
1 parent f88d50c commit f524f3c
Show file tree
Hide file tree
Showing 42 changed files with 94 additions and 114 deletions.
6 changes: 3 additions & 3 deletions src/lib/addXP.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,17 +190,17 @@ export async function addXP(user: MUser, params: AddXpParams): Promise<string> {
const boosts = staticXPBoosts.get(params.skillName);
if (boosts && !params.artificial) {
for (const booster of boosts) {
if (user.hasEquipped(booster.item.id)) {
if (user.hasEquippedOrInBank(booster.item.id)) {
params.amount = increaseNumByPercent(params.amount, booster.boostPercent);
}
}
}

const skillOutfit = skillingOutfitBoosts.find(i => i.skill === params.skillName);
if (!params.artificial && skillOutfit) {
const amountBoost = user.hasEquipped(skillOutfit.outfit, true)
const amountBoost = user.hasEquippedOrInBank(skillOutfit.outfit, 'every')
? skillOutfit.totalBoost
: skillOutfit.outfit.filter(i => user.hasEquipped(i)).length * skillOutfit.individualBoost;
: skillOutfit.outfit.filter(i => user.hasEquippedOrInBank(i)).length * skillOutfit.individualBoost;
params.amount = increaseNumByPercent(params.amount, amountBoost);
}

Expand Down
4 changes: 2 additions & 2 deletions src/lib/implings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export const implings: Record<number, { level: number; customRequirements?: (use
return false;
}
},
[EternalImpling.id]: { level: 99, customRequirements: async user => user.hasEquipped('Vasa cloak') },
[EternalImpling.id]: { level: 99, customRequirements: async user => user.hasEquippedOrInBank('Vasa cloak') },
[MysteryImpling.id]: { level: 105 }
};

Expand Down Expand Up @@ -176,7 +176,7 @@ export async function handlePassiveImplings(user: MUser, data: ActivityTaskData)
let baseChance = IMPLING_CHANCE_PER_MINUTE;
const hasScrollOfTheHunt = user.bitfield.includes(BitField.HasScrollOfTheHunt);
if (hasScrollOfTheHunt) baseChance = Math.floor(baseChance / 2);
if (user.hasEquipped('Hunter master cape')) baseChance = Math.floor(baseChance / 2);
if (user.hasEquippedOrInBank('Hunter master cape')) baseChance = Math.floor(baseChance / 2);

const impTable = implingTableByWorldLocation[activityInArea(data)](baseChance, user.usingPet('Mr. E'));

Expand Down
2 changes: 1 addition & 1 deletion src/lib/invention/disassemble.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ export async function handleDisassembly({
);
}
}
if (user.hasEquipped('Invention master cape')) {
if (user.hasEquippedOrInBank('Invention master cape')) {
timePer = reduceNumByPercent(timePer, inventionBoosts.inventionMasterCape.disassemblySpeedBoostPercent);
messages.push(
`${inventionBoosts.inventionMasterCape.disassemblySpeedBoostPercent}% faster disassembly for mastery`
Expand Down
2 changes: 1 addition & 1 deletion src/lib/invention/inventions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -646,7 +646,7 @@ export async function inventionItemBoost({
}

let messages: string[] = [`Removed ${materialCost}`];
if (user.hasEquipped('Invention master cape')) {
if (user.hasEquippedOrInBank('Invention master cape')) {
materialCost.mutReduceAllValuesByPercent(inventionBoosts.inventionMasterCape.materialCostReductionPercent);
messages.shift();
messages.unshift(`Removed ${materialCost}`);
Expand Down
2 changes: 1 addition & 1 deletion src/lib/openables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ for (const clueTier of ClueTiers) {
const clueTier = ClueTiers.find(c => c.id === self.id)!;

Check warning on line 137 in src/lib/openables.ts

View workflow job for this annotation

GitHub Actions / ESLint

'clueTier' is already declared in the upper scope on line 129 column 12
let loot = new Bank(clueTier.table.open(quantity));

const hasCHEquipped = user.hasEquipped(clueHunterOutfit, true);
const hasCHEquipped = user.hasEquippedOrInBank(clueHunterOutfit, 'every');
let extraClueRolls = 0;
for (let i = 0; i < quantity; i++) {
const roll = randInt(1, 3);

Check warning on line 143 in src/lib/openables.ts

View workflow job for this annotation

GitHub Actions / ESLint

'roll' is already declared in the upper scope on line 25 column 33
Expand Down
6 changes: 3 additions & 3 deletions src/lib/skilling/functions/calcsRunecrafting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,17 @@ export async function bloodEssence(user: MUser, quantity: number): Promise<numbe
export function raimentBonus(user: MUser, quantity: number): number {
let bonusQuantity = 0;
if (
user.gear.skilling.hasEquipped(
user.hasEquippedOrInBank(
Object.keys(Runecraft.raimentsOfTheEyeItems).map(i => parseInt(i)),
true
'every'
)
) {
const amountToAdd = Math.floor(quantity * (60 / 100));
bonusQuantity = amountToAdd;
} else {
// For each Raiments of the Eye item, check if they have it, give its' quantity boost if so (NO bonus XP).
for (const [itemID, bonus] of Object.entries(Runecraft.raimentsOfTheEyeItems)) {
if (user.gear.skilling.hasEquipped([parseInt(itemID)], false)) {
if (user.hasEquippedOrInBank(parseInt(itemID))) {
const amountToAdd = Math.floor(quantity * (bonus / 100));
bonusQuantity += amountToAdd;
}
Expand Down
4 changes: 2 additions & 2 deletions src/lib/util/calcMaxTripLength.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export function calcMaxTripLength(user: MUser, activity?: activity_type_enum) {
case 'TinkeringWorkshop':
case 'Disassembling':
case 'Research': {
if (user.hasEquipped('Materials bag') || user.owns('Materials bag')) {
if (user.hasEquippedOrInBank('Materials bag')) {
max += Time.Minute * 7;
}
break;
Expand All @@ -89,7 +89,7 @@ export function calcMaxTripLength(user: MUser, activity?: activity_type_enum) {
}
}

if (user.hasEquipped('Zak')) {
if (user.usingPet('Zak')) {
max *= 1.4;
}

Expand Down
2 changes: 1 addition & 1 deletion src/lib/util/handleTripFinish.ts
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ const tripFinishEffects: TripFinishEffect[] = [
{
name: 'Invention Effects',
fn: async ({ data, messages, user }) => {
if (user.hasEquipped('Silverhawk boots') && data.duration > Time.Minute) {
if (user.hasEquippedOrInBank('Silverhawk boots') && data.duration > Time.Minute) {
const costRes = await inventionItemBoost({
user,
inventionID: InventionID.SilverHawkBoots,
Expand Down
2 changes: 1 addition & 1 deletion src/mahoji/commands/chop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ export const chopCommand: OSBMahojiCommand = {
// Default bronze axe, last in the array
let axeMultiplier = 1;

if (user.hasEquipped(['Drygore axe'])) {
if (user.hasEquippedOrInBank(['Drygore axe'])) {
let [predeterminedTotalTime] = determineWoodcuttingTime({
quantity,
user,
Expand Down
2 changes: 1 addition & 1 deletion src/mahoji/commands/clue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ export const clueCommand: OSBMahojiCommand = {
durationMultiplier: 0.5
},
{
condition: () => user.hasEquipped(clueHunterOutfit, true),
condition: () => user.hasEquippedOrInBank(clueHunterOutfit, 'every'),
boost: '2x Boost for Clue hunter outfit',
durationMultiplier: 0.5
},
Expand Down
11 changes: 7 additions & 4 deletions src/mahoji/commands/cook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,19 +82,22 @@ export const cookCommand: OSBMahojiCommand = {
const [hasFavour] = gotFavour(user, Favours.Hosidius, 100);
if (hasFavour) boosts.push('Using Hosidius Range');
if (hasFavour && hasEliteDiary) boosts.push('Kourend Elite Diary');
const hasGaunts = user.hasEquipped('Cooking gauntlets');
if (hasGaunts) boosts.push('Cooking gauntlets equipped');
const hasGaunts = user.hasEquippedOrInBank('Cooking gauntlets');
if (hasGaunts) boosts.push('Cooking gauntlets available');

let timeToCookSingleCookable = Time.Second * 2.4 + Time.Second * 0.45;

if (cookable.id === itemID('Jug of wine') || cookable.id === itemID('Wine of zamorak')) {
timeToCookSingleCookable /= 1.6;
if (hasRemy) timeToCookSingleCookable /= 1.5;
} else if (user.hasEquipped('Cooking master cape')) {
} else if (user.hasEquippedOrInBank('Cooking master cape')) {
boosts.push('5x for Cooking master cape');
timeToCookSingleCookable /= 5;
} else if (user.hasEquipped('Dwarven gauntlets')) {
} else if (user.hasEquippedOrInBank('Dwarven gauntlets')) {
boosts.push('3x for Dwarven gauntlets');
timeToCookSingleCookable /= 3;
} else if (hasRemy) {
boosts.push('2x for Remy');
timeToCookSingleCookable /= 2;
}

Expand Down
2 changes: 1 addition & 1 deletion src/mahoji/commands/craft.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export const craftCommand: OSBMahojiCommand = {
boosts.push('3x faster for Klik helping Tan');
}
if (!isTannable) {
if (user.hasEquipped('Dwarven greathammer')) {
if (user.hasEquippedOrInBank('Dwarven greathammer')) {
timeToCraftSingleItem /= 2;
boosts.push('2x faster for Dwarven greathammer');
}
Expand Down
10 changes: 5 additions & 5 deletions src/mahoji/commands/fish.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,29 +116,29 @@ export const fishCommand: OSBMahojiCommand = {
case itemID('Fishing bait'):
if (fish.name === 'Infernal eel') {
scaledTimePerFish *= 1;
} else if (user.hasEquipped('Pearl fishing rod') && fish.name !== 'Infernal eel') {
} else if (user.hasEquippedOrInBank('Pearl fishing rod') && fish.name !== 'Infernal eel') {
scaledTimePerFish *= 0.95;
boosts.push('5% for Pearl fishing rod');
}
break;
case itemID('Feather'):
if (fish.name === 'Barbarian fishing' && user.hasEquipped('Pearl barbarian rod')) {
if (fish.name === 'Barbarian fishing' && user.hasEquippedOrInBank('Pearl barbarian rod')) {
scaledTimePerFish *= 0.95;
boosts.push('5% for Pearl barbarian rod');
} else if (user.hasEquipped('Pearl fly fishing rod') && fish.name !== 'Barbarian fishing') {
} else if (user.hasEquippedOrInBank('Pearl fly fishing rod') && fish.name !== 'Barbarian fishing') {
scaledTimePerFish *= 0.95;
boosts.push('5% for Pearl fly fishing rod');
}
break;
default:
if (user.hasEquipped('Crystal harpoon')) {
if (user.hasEquippedOrInBank('Crystal harpoon')) {
scaledTimePerFish *= 0.95;
boosts.push('5% for Crystal harpoon');
}
break;
}

if (user.hasEquipped('Shark tooth necklace')) {
if (user.hasEquippedOrInBank('Shark tooth necklace')) {
scaledTimePerFish = reduceNumByPercent(scaledTimePerFish, 5);
boosts.push('5% for Shark tooth necklace');
}
Expand Down
2 changes: 1 addition & 1 deletion src/mahoji/commands/fletch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export const fletchCommand: OSBMahojiCommand = {
'<:scruffy:749945071146762301> To help out, Scruffy is fetching items from the bank for you - making your training much faster! Good boy! (+100% for Scruffy)'
);
}
if (user.hasEquipped('Dwarven knife')) {
if (user.hasEquippedOrInBank('Dwarven knife')) {
boostMsg.push('+100% for Dwarven knife');
boost += 1;
}
Expand Down
6 changes: 3 additions & 3 deletions src/mahoji/commands/smelt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,18 +111,18 @@ export const smeltingCommand: OSBMahojiCommand = {
timeToSmithSingleBar *= 1.075;
boosts.push('-7.5% penalty for not having graceful equipped');
}
if (user.hasEquipped('Smithing master cape')) {
if (user.hasEquippedOrInBank('Smithing master cape')) {
timeToSmithSingleBar /= 2;
boosts.push('2x boost for Smithing master cape');
}
if (user.hasEquipped('Dwarven gauntlets') && bar.id !== itemID('Gold bar')) {
if (user.hasEquippedOrInBank('Dwarven gauntlets') && bar.id !== itemID('Gold bar')) {
boosts.push('2x boost for having Dwarven gauntlets equipped');
timeToSmithSingleBar /= 2;
}
}

if (!blast_furnace) {
if (user.hasEquipped('Dwarven gauntlets')) {
if (user.hasEquippedOrInBank('Dwarven gauntlets')) {
boosts.push('2x boost for having a Dwarven gauntlets equipped');
timeToSmithSingleBar /= 2;
}
Expand Down
10 changes: 5 additions & 5 deletions src/mahoji/commands/smith.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,16 +75,16 @@ export const smithCommand: OSBMahojiCommand = {
// If they have the entire Smiths' Uniform, give 100% chance save 1 tick each item
let setBonus = 0;
if (
user.gear.skilling.hasEquipped(
user.hasEquippedOrInBank(
Object.keys(Smithing.smithsUniformItems).map(i => parseInt(i)),
true
'every'
)
) {
setBonus += 100;
} else {
// For each Smiths' Uniform item, check if they have it, give % chance to save 1 tick each item
for (const [itemID, bonus] of Object.entries(Smithing.smithsUniformItems)) {
if (user.gear.skilling.hasEquipped([parseInt(itemID)], false)) {
if (user.hasEquippedOrInBank(parseInt(itemID))) {
setBonus += bonus;
}
}
Expand All @@ -110,7 +110,7 @@ export const smithCommand: OSBMahojiCommand = {
let timeToSmithSingleBar = timeToUse + Time.Second / 4 - (Time.Second * 0.6 * setBonus) / 100;
if (user.usingPet('Takon')) {
timeToSmithSingleBar /= 4;
} else if (user.hasEquipped('Dwarven greathammer')) {
} else if (user.hasEquippedOrInBank('Dwarven greathammer')) {
timeToSmithSingleBar /= 2;
}

Expand Down Expand Up @@ -196,7 +196,7 @@ export const smithCommand: OSBMahojiCommand = {

if (user.usingPet('Takon')) {
str += ' Takon is Smithing for you, at incredible speeds and skill.';
} else if (user.hasEquipped('Dwarven greathammer')) {
} else if (user.hasEquippedOrInBank('Dwarven greathammer')) {
str += ' 2x faster for Dwarven greathammer.';
}
if (hasScroll) {
Expand Down
9 changes: 5 additions & 4 deletions src/mahoji/commands/testpotato.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ import { prisma } from '../../lib/settings/prisma';
import { getFarmingInfo } from '../../lib/skilling/functions/getFarmingInfo';
import Skills from '../../lib/skilling/skills';
import Farming from '../../lib/skilling/skills/farming';
import { SkillsEnum } from '../../lib/skilling/types';
import { getUsersTame, tameSpecies } from '../../lib/tames';
import { stringMatches } from '../../lib/util';
import { calcDropRatesFromBankWithoutUniques } from '../../lib/util/calcDropRatesFromBank';
Expand Down Expand Up @@ -405,9 +404,11 @@ export const testPotatoCommand: OSBMahojiCommand | null = production
name: 'skill',
description: 'The skill.',
required: true,
choices: Object.values(Skills)
.map(s => ({ name: s.name, value: s.id }))
.filter(i => i.value !== SkillsEnum.Woodcutting)
autocomplete: async value => {
return Object.values(Skills)
.map(s => ({ name: s.name, value: s.id }))
.filter(s => (!value ? true : s.name.toLowerCase().includes(value.toLowerCase())));
}
},
{
type: ApplicationCommandOptionType.Integer,
Expand Down
6 changes: 3 additions & 3 deletions src/mahoji/lib/abstracted_commands/giantsFoundryCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,16 +178,16 @@ export async function giantsFoundryStartCommand(
// If they have the entire Smiths' Uniform, give an extra 15% speed bonus
let setBonus = 0;
if (
user.gear.skilling.hasEquipped(
user.hasEquippedOrInBank(
Object.keys(Smithing.smithsUniformItems).map(i => parseInt(i)),
true
'every'
)
) {
setBonus += 15;
} else {
// For each Smiths' Uniform item, check if they have it, give its' set boost and covert to 15% speed bonus later.
for (const [itemID] of Object.entries(Smithing.smithsUniformItems)) {
if (user.gear.skilling.hasEquipped([parseInt(itemID)], false)) {
if (user.hasEquippedOrInBank(parseInt(itemID))) {
setBonus += 3;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/mahoji/lib/abstracted_commands/minionKill.ts
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ export async function minionKillCommand(
}

const hasBlessing = user.hasEquipped('Dwarven blessing');
const hasZealotsAmulet = user.hasEquipped('Amulet of zealots');
const hasZealotsAmulet = user.hasEquippedOrInBank('Amulet of zealots');
if (hasZealotsAmulet && hasBlessing) {
timeToFinish *= 0.75;
boosts.push('25% for Dwarven blessing & Amulet of zealots');
Expand Down
6 changes: 3 additions & 3 deletions src/mahoji/lib/abstracted_commands/monkeyRumbleCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,11 @@ export async function monkeyRumbleCommand(user: MUser, channelID: string): Comma
let duration = quantity * fightDuration;

let chanceOfSpecial = Math.floor(125 * (6 - monkeyTierOfUser(user) / 2));
if (user.hasEquipped('Big banana')) {
if (user.hasEquippedOrInBank('Big banana')) {
chanceOfSpecial = reduceNumByPercent(chanceOfSpecial, 12);
boosts.push('12% higher chance of purple monkeys from Big banana');
}
if (user.hasEquipped('Ring of luck')) {
if (user.hasEquippedOrInBank('Ring of luck')) {
chanceOfSpecial = reduceNumByPercent(chanceOfSpecial, 4);
boosts.push('4% higher chance of purple monkeys from ring of luck');
}
Expand All @@ -92,7 +92,7 @@ export async function monkeyRumbleCommand(user: MUser, channelID: string): Comma
}
monkeysToFight.sort((a, b) => (a.special === b.special ? 0 : a.special ? -1 : 1));
let foodRequired = Math.floor(duration / (Time.Minute * 1.34));
if (user.hasEquipped('Big banana')) {
if (user.hasEquippedOrInBank('Big banana')) {
foodRequired = reduceNumByPercent(foodRequired, 25);
foodRequired = Math.floor(foodRequired);
boosts.push('25% less food from Big banana');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export async function motherlodeMineCommand({
goldSilverBoost,
miningLvl: miningLevel,
maxTripLength: calcMaxTripLength(user, 'Mining'),
hasGlory: user.hasEquipped('Amulet of glory')
hasGlory: user.hasEquippedOrInBank('Amulet of glory')
});

const fakeDurationMin = quantity ? randomVariation(reduceNumByPercent(duration, 25), 20) : duration;
Expand Down
2 changes: 1 addition & 1 deletion src/mahoji/lib/abstracted_commands/wintertodtCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export async function wintertodtCommand(user: MUser, channelID: string) {

const boosts: string[] = [];

if (user.hasEquipped('Dwarven greataxe')) {
if (user.hasEquippedOrInBank('Dwarven greataxe')) {
durationPerTodt /= 2;
boosts.push('2x faster for Dwarven greataxe.');
}
Expand Down
6 changes: 2 additions & 4 deletions src/mahoji/mahojiSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,11 +213,10 @@ export function userHasGracefulEquipped(user: MUser) {
}

export function anglerBoostPercent(user: MUser) {
const skillingSetup = user.gear.skilling;
let amountEquipped = 0;
let boostPercent = 0;
for (const [id, percent] of anglerBoosts) {
if (skillingSetup.hasEquipped([id])) {
if (user.hasEquippedOrInBank(id)) {
boostPercent += percent;
amountEquipped++;
}
Expand All @@ -231,10 +230,9 @@ export function anglerBoostPercent(user: MUser) {
const rogueOutfit = resolveItems(['Rogue mask', 'Rogue top', 'Rogue trousers', 'Rogue gloves', 'Rogue boots']);

export function rogueOutfitPercentBonus(user: MUser): number {
const skillingSetup = user.gear.skilling;
let amountEquipped = 0;
for (const id of rogueOutfit) {
if (skillingSetup.hasEquipped([id])) {
if (user.hasEquippedOrInBank(id)) {
amountEquipped++;
}
}
Expand Down
Loading

0 comments on commit f524f3c

Please sign in to comment.