Skip to content

Commit

Permalink
Add skill cape perks to comp & master cape (oldschoolgg#6116)
Browse files Browse the repository at this point in the history
  • Loading branch information
nwjgit authored Oct 16, 2024
1 parent 78d6c28 commit 6db09f4
Show file tree
Hide file tree
Showing 6 changed files with 120 additions and 113 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 type { Buyable } from './buyables';
import { circusBuyables } from './circusBuyables';
import { fistOfGuthixBuyables } from './fistOfGuthixBuyables';
Expand Down Expand Up @@ -103,7 +103,7 @@ export const bsoBuyables: Buyable[] = [
{
name: 'Completionist cape',
outputItems: new Bank().add('Completionist cape').add('Completionist hood'),
itemCost: allMasterCapesBank,
itemCost: compCapeCreatableBank,
customReq: async user => {
const { 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 @@ -1329,14 +1329,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
130 changes: 52 additions & 78 deletions src/lib/data/similarItems.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { resolveItems } from 'oldschooljs/dist/util/util';
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 {
gracefulCapes,
Expand Down Expand Up @@ -90,6 +91,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 @@ -212,7 +219,6 @@ const source: [string, (string | number)[]][] = [
]
],
['Mythical cape', ['Mythical max cape']],
['Achievement diary cape', ['Achievement diary cape(t)']],
[
'Imbued guthix cape',
[
Expand Down Expand Up @@ -278,7 +284,6 @@ const source: [string, (string | number)[]][] = [
]
]
],
['Slayer cape', ['Slayer cape (t)']],
['Nose peg', slayerHelmSimilar],
['Earmuffs', slayerHelmSimilar],
['Spiny helmet', slayerHelmSimilar],
Expand All @@ -304,33 +309,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"]],
['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 @@ -372,30 +350,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 @@ -441,50 +395,70 @@ const source: [string, (string | number)[]][] = [
['Archers ring', ['Archers ring (i)']],
['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']],
['Armadyl helmet', ['Masori mask (f)', 'Masori mask']],
['Armadyl chestplate', ['Armadyl chestplate', 'Masori body (f)', 'Masori body']],
['Armadyl chainskirt', ['Masori chaps (f)', 'Masori chaps']],
['Music cape', ['Music cape (t)']],
['Imbued heart', ['Saturated heart']],
["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']],
['Ring of stone', ['Ring of coins', 'Crate ring', 'Ring of nature', 'Snowman ring', 'Ring of 3rd age']],
['Ring of suffering (i)', ['Ring of suffering (ri)']],
['Amulet of rancour', ['Amulet of rancour (s)']],

// Tame gear
['Abyssal jibwings', ['Abyssal jibwings (e)']],
['3rd age jibwings', ['3rd age jibwings (e)']],
['Demonic jibwings', ['Demonic jibwings (e)']],

['Completionist cape', ['Completionist cape (t)']],
// Inventions
['Inferno adze', ['Superior inferno adze']],
['Gorajan bonecrusher', ['Superior bonecrusher']],
['Magic secateurs', ['Arcane harvester']],
['Dwarven greataxe', ['Drygore axe']],

// Mastery capes
['Music cape', ['Music cape (t)', 'Completionist cape', 'Completionist cape (t)']],
['Achievement diary cape', ['Achievement diary cape(t)', 'Completionist cape', 'Completionist cape (t)']],
['Master quest cape', ['Completionist cape', 'Completionist 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']],
['Ring of stone', ['Ring of coins', 'Crate ring', 'Ring of nature', 'Snowman ring', 'Ring of 3rd age']],
['Ring of suffering (i)', ['Ring of suffering (ri)']],
['Amulet of rancour', ['Amulet of rancour (s)']]
["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.
for (const cape of skillcapes) {
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([untrimmedCape, skillCapeList]);
}

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

Expand Down
Loading

0 comments on commit 6db09f4

Please sign in to comment.