Skip to content

Commit

Permalink
Add skill cape perks to comp & master cape
Browse files Browse the repository at this point in the history
  • Loading branch information
nwjgit committed Jun 12, 2024
1 parent 15fd4b2 commit 9109be0
Show file tree
Hide file tree
Showing 5 changed files with 113 additions and 107 deletions.
4 changes: 2 additions & 2 deletions src/lib/data/buyables/bsoBuyables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Time } from 'e';
import { Bank } from 'oldschooljs';

import { calculateCompCapeProgress } from '../../bso/calculateCompCapeProgress';
import { allMasterCapesBank } from '../../skilling/skillcapes';
import { compCapeCreatableBank } from '../../skilling/skillcapes';
import { isAtleastThisOld } from '../../util';
import { Buyable } from './buyables';
import { circusBuyables } from './circusBuyables';
Expand Down Expand Up @@ -104,7 +104,7 @@ export const bsoBuyables: Buyable[] = [
{
name: 'Completionist cape',
outputItems: new Bank().add('Completionist cape').add('Completionist hood'),
itemCost: allMasterCapesBank,
itemCost: compCapeCreatableBank,
customReq: async user => {
let { totalPercentUntrimmed } = await calculateCompCapeProgress(user);
if (totalPercentUntrimmed < 100) {
Expand Down
3 changes: 2 additions & 1 deletion src/lib/data/creatables/bsoItems.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1344,14 +1344,15 @@ export const BsoCreateables: Createable[] = [
{
name: 'Revert completionist cape',
outputItems: user => {
// check compCapeCreatableBank in skillcapes.ts to ensure all capes are being refunded
const refundBank = new Bank();
for (const { masterCape } of Skillcapes) {
if (user.cl.has(masterCape.id)) {
refundBank.add(masterCape);
}
}
refundBank.add('Master quest cape');
refundBank.add('Achievement diary cape(t)');
refundBank.add('Achievement diary cape (t)');
refundBank.add('Music cape (t)');
return refundBank;
},
Expand Down
122 changes: 49 additions & 73 deletions src/lib/data/similarItems.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { dyedItems } from '../dyedItems';
import { allMasterCapesBank } from '../skilling/skillcapes';
import skillcapes from '../skilling/skillcapes';
import getOSItem from '../util/getOSItem';
import itemID from '../util/itemID';
import resolveItems from '../util/resolveItems';
import {
Expand Down Expand Up @@ -88,6 +89,12 @@ const source: [string, (string | number)[]][] = [
['Rune axe', ['Rune felling axe', 'Gilded axe']],
['Dragon axe', ['Dragon felling axe', '3rd age axe', '3rd age felling axe']],
['Crystal axe', ['Crystal felling axe']],
['Lumberjack hat', ['Forestry hat']],
['Lumberjack top', ['Forestry top']],
['Lumberjack legs', ['Forestry legs']],
['Lumberjack boots', ['Forestry boots']],
['Log basket', ['Forestry basket']],
['Forestry kit', ['Forestry basket']],
['Rune pickaxe', ['Gilded pickaxe']],
['Dragon full helm', ['Dragon full helm (g)']],
['Dragon chainbody', ['Dragon chainbody (g)']],
Expand Down Expand Up @@ -286,25 +293,6 @@ const source: [string, (string | number)[]][] = [
'Void staff (u)'
]
],
['Attack cape', ['Max cape', 'Attack cape(t)']],
['Farming cape', ['Max cape', 'Farming cape(t)']],
['Agility master cape', ['Support cape']],
['Dungeoneering master cape', ['Support cape']],
['Thieving master cape', ['Support cape']],
['Slayer master cape', ['Support cape']],
['Farming master cape', ["Gatherer's cape"]],
['Fishing master cape', ["Gatherer's cape"]],
['Hunter master cape', ["Gatherer's cape"]],
['Mining master cape', ["Gatherer's cape"]],
['Woodcutting master cape', ["Gatherer's cape"]],
['Divination master cape', ["Gatherer's cape"]],
['Attack master cape', ["Combatant's cape"]],
['Hitpoints master cape', ["Combatant's cape"]],
['Defence master cape', ["Combatant's cape"]],
['Magic master cape', ["Combatant's cape"]],
['Prayer master cape', ["Combatant's cape"]],
['Ranged master cape', ["Combatant's cape"]],
['Strength master cape', ["Combatant's cape"]],
[
"Ava's assembler",
[
Expand All @@ -317,14 +305,6 @@ const source: [string, (string | number)[]][] = [
'Tidal collector'
]
],
['Crafting master cape', ["Artisan's cape"]],
['Construction master cape', ["Artisan's cape"]],
['Cooking master cape', ["Artisan's cape"]],
['Firemaking master cape', ["Artisan's cape"]],
['Fletching master cape', ["Artisan's cape"]],
['Herblore master cape', ["Artisan's cape"]],
['Runecraft master cape', ["Artisan's cape"]],
['Smithing master cape', ["Artisan's cape"]],
['Torva full helm', ['Gorajan warrior helmet', 'Infernal slayer helmet(i)']],
['Torva platebody', ['Gorajan warrior top']],
['Torva platelegs', ['Gorajan warrior legs']],
Expand Down Expand Up @@ -366,30 +346,6 @@ const source: [string, (string | number)[]][] = [
['Scythe of vitur (uncharged)', ['Sanguine scythe of vitur (uncharged)', 'Holy scythe of vitur (uncharged)']],
['Sanguinesti staff', ['Holy sanguinesti staff']],
['Sanguinesti staff (uncharged)', ['Holy sanguinesti staff (uncharged)']],
['Runecraft cape', ['Max cape', 'Runecraft cape(t)']],
['Agility cape', ['Max cape', 'Agility cape(t)']],
['Attack cape', ['Max cape', 'Attack cape(t)']],
['Construct. cape', ['Max cape', 'Construct. cape(t)']],
['Cooking cape', ['Max cape', 'Cooking cape(t)']],
['Crafting cape', ['Max cape', 'Crafting cape(t)']],
['Defence cape', ['Max cape', 'Defence cape(t)']],
['Farming cape', ['Max cape', 'Farming cape(t)']],
['Firemaking cape', ['Max cape', 'Firemaking cape(t)']],
['Fishing cape', ['Max cape', 'Fishing cape(t)']],
['Fletching cape', ['Max cape', 'Fletching cape(t)']],
['Herblore cape', ['Max cape', 'Herblore cape(t)']],
['Hitpoints cape', ['Max cape', 'Hitpoints cape(t)']],
['Hunter cape', ['Max cape', 'Hunter cape(t)']],
['Magic cape', ['Max cape', 'Magic cape(t)']],
['Mining cape', ['Max cape', 'Mining cape(t)']],
['Prayer cape', ['Max cape', 'Prayer cape(t)']],
['Ranging cape', ['Max cape', 'Ranging cape(t)']],
['Runecraft cape', ['Max cape', 'Runecraft cape(t)']],
['Slayer cape', ['Max cape', 'Slayer cape(t)']],
['Smithing cape', ['Max cape', 'Smithing cape(t)']],
['Strength cape', ['Max cape', 'Strength cape(t)']],
['Thieving cape', ['Max cape', 'Thieving cape(t)']],
['Woodcutting cape', ['Max cape', 'Woodcut. cape(t)']],
['Salve amulet', ['Salve amulet(ei)', 'Salve amulet(i)', 'Salve amulet (e)']],
['Salve amulet (e)', ['Salve amulet(ei)']],
['Salve amulet(i)', ['Salve amulet(ei)']],
Expand Down Expand Up @@ -433,10 +389,6 @@ const source: [string, (string | number)[]][] = [
["Inventors' backpack", ['Invention master cape']],
['Ignis ring', ['Ignis ring (i)']],
['Ring of piercing', ['Ring of piercing (i)']],
// Inventions
['Inferno adze', ['Superior inferno adze']],
['Gorajan bonecrusher', ['Superior bonecrusher']],
['Magic secateurs', ['Arcane harvester']],
["Karil's coif", ['Armadyl helmet', 'Masori mask (f)', 'Masori mask']],
["Karil's leathertop", ['Armadyl chestplate', 'Masori body (f)', 'Masori body']],
["Karil's leatherskirt", ['Armadyl chainskirt', 'Masori chaps (f)', 'Masori chaps']],
Expand All @@ -448,33 +400,57 @@ const source: [string, (string | number)[]][] = [
["Craw's bow", ['Webweaver bow']],
["Viggora's chainmace", ['Ursine chainmace']],
["Thammaron's sceptre", ['Accursed sceptre']],
['Lumberjack hat', ['Forestry hat']],
['Lumberjack top', ['Forestry top']],
['Lumberjack legs', ['Forestry legs']],
['Lumberjack boots', ['Forestry boots']],
// Inventions
['Inferno adze', ['Superior inferno adze']],
['Gorajan bonecrusher', ['Superior bonecrusher']],
['Magic secateurs', ['Arcane harvester']],
['Dwarven greataxe', ['Drygore axe']],
// Eagle tame gear
['Abyssal jibwings', ['Abyssal jibwings (e)']],
['3rd age jibwings', ['3rd age jibwings (e)']],
['Demonic jibwings', ['Demonic jibwings (e)']],

['Completionist cape', ['Completionist cape (t)']],
// Expert & Completionist cape
[
'Completionist cape',
['Completionist cape (t)', 'Master quest cape', 'Achievement diary cape (t)', 'Music cape (t)']
],
["Combatant's cape", ['Completionist cape', 'Completionist cape (t)']],
["Gatherer's cape", ['Completionist cape', 'Completionist cape (t)']],
['Support cape', ['Completionist cape', 'Completionist cape (t)']],
["Artisan's cape", ['Completionist cape', 'Completionist cape (t)']],
['Log basket', ['Forestry basket']],
['Forestry kit', ['Forestry basket']],
['Dwarven greataxe', ['Drygore axe']]
["Artisan's cape", ['Completionist cape', 'Completionist cape (t)']]
];

// Make max cape count as all master capes
for (const [cape] of allMasterCapesBank.items()) {
const existingSimilarItem = source.find(s => s[0] === cape.name);
if (existingSimilarItem) {
existingSimilarItem[1].push('Completionist cape', 'Completionist cape (t)');
// Build skill cape & master cape similar items. This also handles comp and comp(t) receiving all skillcape and master cape perks.
skillcapes.forEach(cape => {
const untrimmedCape = getOSItem(cape.untrimmed).name;
const trimmedCape = getOSItem(cape.trimmed).name;
const masterCape = getOSItem(cape.masterCape.id).name;
const expertCape = cape.expertCape ? getOSItem(cape.expertCape.id).name : null;

const skillCapeList = [trimmedCape, 'Max cape', masterCape, 'Completionist cape', 'Completionist cape (t)'];
const masterCapeList = ['Completionist cape', 'Completionist cape (t)'];

if (expertCape !== null) {
skillCapeList.push(expertCape);
masterCapeList.push(expertCape);
}

// Skill cape
const existingSkillCape = source.find(s => s[0] === untrimmedCape);
if (existingSkillCape) {
existingSkillCape[1].push(...skillCapeList);
} else {
source.push([cape.name, ['Completionist cape', 'Completionist cape (t)']]);
source.push([untrimmedCape, skillCapeList]);
}
}

// Master cape
const existingMasterCape = source.find(s => s[0] === masterCape);
if (existingMasterCape) {
existingMasterCape[1].push(...masterCapeList);
} else {
source.push([masterCape, masterCapeList]);
}
});

for (const { baseItem, dyedVersions } of dyedItems) {
// Update matching child rows (simmilarItems) first:
Expand Down
Loading

0 comments on commit 9109be0

Please sign in to comment.