Skip to content
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

Bso wildy slayer #5877

Merged
merged 32 commits into from
Jun 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
7fa725e
Add simple run test for all commands (#5729)
gc May 11, 2024
832ecfc
Filter out completed quests (#5873)
TastyPumPum May 12, 2024
8329ced
Wildy slayer (#5426)
TastyPumPum May 12, 2024
4c58e31
Fix recently killed monster list (#5876)
themrrobert May 13, 2024
bbca8f8
Merge branch 'bso' of https://github.com/oldschoolgg/oldschoolbot int…
TastyPumPum May 13, 2024
239bd14
Changes
TastyPumPum May 13, 2024
4177ead
Update mine.ts
TastyPumPum May 13, 2024
2aa35d2
Update rates.ts
TastyPumPum May 13, 2024
c614f70
virtus fix
TastyPumPum May 13, 2024
723264b
Update minionKill.ts
TastyPumPum May 13, 2024
b4083e0
Merge branch 'bso' of https://github.com/oldschoolgg/oldschoolbot int…
TastyPumPum May 24, 2024
6c009b0
PK chance wildy cannon
TastyPumPum May 24, 2024
5754c44
Test error
TastyPumPum May 24, 2024
975403a
Merge branch 'bso-wildy-slayer' of github.com:TastyPumPum/oldschoolbo…
gc May 26, 2024
85785b9
fixes
gc May 11, 2024
00a68d9
Merge branch 'bso' into TastyPumPum-bso-wildy-slayer
gc May 27, 2024
308e661
changes
gc May 27, 2024
f3ccdf8
Merge branch 'bso' into TastyPumPum-bso-wildy-slayer
gc May 27, 2024
592b448
fixes
gc May 28, 2024
164c8fe
skip image tests
gc May 28, 2024
092bdb5
fix unused vars
gc May 28, 2024
378c002
Merge branch 'bso' of https://github.com/oldschoolgg/oldschoolbot int…
TastyPumPum May 28, 2024
aef5170
Merge branch 'bso-wildy-slayer' of https://github.com/TastyPumPum/old…
TastyPumPum May 28, 2024
8ad0d66
Update wildyMulti
TastyPumPum May 28, 2024
b2d6e1f
Add autoslayer ehp methods
TastyPumPum May 31, 2024
ca9582b
Green Dragon activity
TastyPumPum Jun 4, 2024
685d36f
Fixes
TastyPumPum Jun 5, 2024
d15b58a
Fixes ehp
TastyPumPum Jun 6, 2024
e36e9f0
Barrage fix
TastyPumPum Jun 6, 2024
c18cfda
Degradeable items fix
TastyPumPum Jun 6, 2024
85423fb
Add back double global boost (fix in a different pr)
TastyPumPum Jun 6, 2024
0f6a2db
Update cannonMulti
TastyPumPum Jun 6, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
"@types/jest-image-snapshot": "^6.1.0",
"@types/lodash": "^4.14.195",
"@types/madge": "^5.0.0",
"@types/mitm": "^1.3.8",
"@types/node": "^14.18.12",
"@types/node-cron": "^3.0.7",
"@types/node-fetch": "^2.6.1",
Expand All @@ -85,6 +86,7 @@
"eslint-plugin-unicorn": "^44.0.2",
"fast-check": "^3.18.0",
"jest-image-snapshot": "^6.2.0",
"mitm": "^1.7.2",
"madge": "^7.0.0",
"prettier": "^2.7.1",
"prisma": "^5.13.0",
Expand Down
9 changes: 5 additions & 4 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -984,10 +984,11 @@ model UserStats {
high_gambles Int @default(0)
honour_points Int @default(0)

slayer_task_streak Int @default(0)
slayer_superior_count Int @default(0)
slayer_unsired_offered Int @default(0)
slayer_chewed_offered Int @default(0)
slayer_task_streak Int @default(0)
slayer_wildy_task_streak Int @default(0)
slayer_superior_count Int @default(0)
slayer_unsired_offered Int @default(0)
slayer_chewed_offered Int @default(0)

tob_cost Json @default("{}")
tob_loot Json @default("{}")
Expand Down
30 changes: 19 additions & 11 deletions src/lib/MUser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@

for (const setup of Object.values(this.gear)) {
for (const equipped of Object.values(setup)) {
if (equipped?.item) {

Check warning on line 426 in src/lib/MUser.ts

View workflow job for this annotation

GitHub Actions / Node v18.12.0 - ubuntu-latest

Unexpected any value in conditional. An explicit comparison or type cast is required

Check warning on line 426 in src/lib/MUser.ts

View workflow job for this annotation

GitHub Actions / Node v20 - ubuntu-latest

Unexpected any value in conditional. An explicit comparison or type cast is required
bank.add(equipped.item, equipped.quantity);
}
}
Expand Down Expand Up @@ -645,10 +645,10 @@
}
const scales = Math.ceil((10 / 3) * dart[1]);
const rawBlowpipeData = this.blowpipe;
if (!this.allItemsOwned.has('Toxic blowpipe') || !rawBlowpipeData) {

Check warning on line 648 in src/lib/MUser.ts

View workflow job for this annotation

GitHub Actions / Node v18.12.0 - ubuntu-latest

Unexpected object value in conditional. The condition is always true

Check warning on line 648 in src/lib/MUser.ts

View workflow job for this annotation

GitHub Actions / Node v20 - ubuntu-latest

Unexpected object value in conditional. The condition is always true
throw new UserError("You don't have a Toxic blowpipe.");
}
if (!rawBlowpipeData.dartID || !rawBlowpipeData.dartQuantity) {

Check warning on line 651 in src/lib/MUser.ts

View workflow job for this annotation

GitHub Actions / Node v18.12.0 - ubuntu-latest

Unexpected number value in conditional. An explicit zero/NaN check is required

Check warning on line 651 in src/lib/MUser.ts

View workflow job for this annotation

GitHub Actions / Node v20 - ubuntu-latest

Unexpected number value in conditional. An explicit zero/NaN check is required
throw new UserError('You have no darts in your Toxic blowpipe.');
}
if (rawBlowpipeData.dartQuantity < dart[1]) {
Expand All @@ -658,7 +658,7 @@
)}s in your Toxic blowpipe, you need ${dart[1]}, but you have only ${rawBlowpipeData.dartQuantity}.`
);
}
if (!rawBlowpipeData.scales || rawBlowpipeData.scales < scales) {

Check warning on line 661 in src/lib/MUser.ts

View workflow job for this annotation

GitHub Actions / Node v18.12.0 - ubuntu-latest

Unexpected number value in conditional. An explicit zero/NaN check is required

Check warning on line 661 in src/lib/MUser.ts

View workflow job for this annotation

GitHub Actions / Node v20 - ubuntu-latest

Unexpected number value in conditional. An explicit zero/NaN check is required
throw new UserError(
`You don't have enough Zulrah's scales in your Toxic blowpipe, you need ${scales} but you have only ${rawBlowpipeData.scales}.`
);
Expand Down Expand Up @@ -799,7 +799,7 @@

private buildPaintedItems(): Map<number, number> {
const rawPaintedItems = this.user.painted_items_tuple;
if (!rawPaintedItems) return new Map();

Check warning on line 802 in src/lib/MUser.ts

View workflow job for this annotation

GitHub Actions / Node v18.12.0 - ubuntu-latest

Unexpected value in conditional. A boolean expression is required

Check warning on line 802 in src/lib/MUser.ts

View workflow job for this annotation

GitHub Actions / Node v20 - ubuntu-latest

Unexpected value in conditional. A boolean expression is required
return new Map(rawPaintedItems as [number, number][]);
}

Expand All @@ -810,7 +810,7 @@

async getGodFavour(): Promise<GodFavourBank> {
let { god_favour_bank: currentFavour } = await this.fetchStats({ god_favour_bank: true });
if (!currentFavour) {

Check warning on line 813 in src/lib/MUser.ts

View workflow job for this annotation

GitHub Actions / Node v18.12.0 - ubuntu-latest

Unexpected value in conditional. A boolean expression is required

Check warning on line 813 in src/lib/MUser.ts

View workflow job for this annotation

GitHub Actions / Node v20 - ubuntu-latest

Unexpected value in conditional. A boolean expression is required
return {
Zamorak: 0,
Armadyl: 0,
Expand Down Expand Up @@ -872,7 +872,7 @@
);
const track = mysteriousTrailTracks.find(i => i.id === trackID)!;
const step = track.steps[currentStepID - 1];
if (!step) {

Check warning on line 875 in src/lib/MUser.ts

View workflow job for this annotation

GitHub Actions / Node v18.12.0 - ubuntu-latest

Unexpected object value in conditional. The condition is always true

Check warning on line 875 in src/lib/MUser.ts

View workflow job for this annotation

GitHub Actions / Node v20 - ubuntu-latest

Unexpected object value in conditional. The condition is always true
throw new Error(`No step for ${currentStepID} ${this.id}`);
}
return {
Expand Down Expand Up @@ -901,20 +901,28 @@
return this.caPoints() >= CombatAchievements[tier].rewardThreshold;
}

buildCATertiaryItemChanges() {
buildTertiaryItemChanges(hasRingOfWealthI: boolean = false, inWildy: boolean = false, onTask: boolean = false) {
const changes = new Map();
if (this.hasCompletedCATier('easy')) {
changes.set('Clue scroll (easy)', 5);
}
if (this.hasCompletedCATier('medium')) {
changes.set('Clue scroll (medium)', 5);
}
if (this.hasCompletedCATier('hard')) {
changes.set('Clue scroll (hard)', 5);

const tiers = Object.keys(CombatAchievements) as Array<keyof typeof CombatAchievements>;
for (const tier of tiers) {
let change = hasRingOfWealthI ? 50 : 0;
if (this.hasCompletedCATier(tier)) {
change += 5;
}
changes.set(`Clue scroll (${tier})`, change);
}
if (this.hasCompletedCATier('elite')) {
changes.set('Clue scroll (elite)', 5);

if (inWildy) changes.set('Giant key', 50);

if (inWildy && !onTask) {
changes.set('Mossy key', 60);
} else if (!inWildy && onTask) {
changes.set('Mossy key', 66.67);
} else if (inWildy && onTask) {
changes.set('Mossy key', 77.6);
}

return changes;
}

Expand All @@ -930,13 +938,13 @@
return resetBackground();
}
if (background.id === 1) return;
if (background.storeBitField && this.user.store_bitfield.includes(background.storeBitField)) {

Check warning on line 941 in src/lib/MUser.ts

View workflow job for this annotation

GitHub Actions / Node v18.12.0 - ubuntu-latest

Unexpected value in conditional. A boolean expression is required

Check warning on line 941 in src/lib/MUser.ts

View workflow job for this annotation

GitHub Actions / Node v20 - ubuntu-latest

Unexpected value in conditional. A boolean expression is required
return;
}
if (background.perkTierNeeded && this.perkTier() >= background.perkTierNeeded) {

Check warning on line 944 in src/lib/MUser.ts

View workflow job for this annotation

GitHub Actions / Node v18.12.0 - ubuntu-latest

Unexpected value in conditional. A boolean expression is required

Check warning on line 944 in src/lib/MUser.ts

View workflow job for this annotation

GitHub Actions / Node v20 - ubuntu-latest

Unexpected value in conditional. A boolean expression is required
return;
}
if (background.bitfield && this.bitfield.includes(background.bitfield)) {

Check warning on line 947 in src/lib/MUser.ts

View workflow job for this annotation

GitHub Actions / Node v18.12.0 - ubuntu-latest

Unexpected value in conditional. A boolean expression is required

Check warning on line 947 in src/lib/MUser.ts

View workflow job for this annotation

GitHub Actions / Node v20 - ubuntu-latest

Unexpected value in conditional. A boolean expression is required
return;
}
if (!background.storeBitField && !background.perkTierNeeded && !background.bitfield && !background.owners) {
Expand Down
6 changes: 4 additions & 2 deletions src/lib/bankImage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ export const bankFlags = [
] as const;
export type BankFlag = (typeof bankFlags)[number];

class BankImageTask {
export class BankImageTask {
public itemIconsList: Set<number>;
public itemIconImagesCache: Map<number, Image>;
public backgroundImages: BankBackground[] = [];
Expand Down Expand Up @@ -855,6 +855,7 @@ class BankImageTask {
if (!isTransparent && noBorder !== 1) {
this.drawBorder(ctx, bgSprite, bgImage.name === 'Default');
}

await this.drawItems(
ctx,
compact,
Expand Down Expand Up @@ -1045,5 +1046,6 @@ declare global {
}
}
}
global.bankImageGenerator = new BankImageTask();
export const bankImageTask = new BankImageTask();
global.bankImageGenerator = bankImageTask;
bankImageGenerator.init();
41 changes: 40 additions & 1 deletion src/lib/bossEvents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import {
import { Bank, LootTable } from 'oldschooljs';

import { OWNER_IDS, production } from '../config';
import { scaryEatables } from './constants';
import { prisma } from './settings/prisma';
import {
getPHeadDescriptor,
Expand All @@ -26,6 +25,7 @@ import { BossInstance, BossOptions, BossUser } from './structures/Boss';
import { Gear } from './structures/Gear';
import { NewBossOptions } from './types/minions';
import { formatDuration, roll } from './util';
import getOSItem from './util/getOSItem';
import { logError } from './util/logError';
import { sendToChannelID } from './util/webhook';
import { LampTable } from './xpLamps';
Expand All @@ -39,6 +39,45 @@ interface BossEvent {

export const bossEventChannelID = production ? '897170239333220432' : '1023760501957722163';

export const scaryEatables = [
{
item: getOSItem('Candy teeth'),
healAmount: 3
},
{
item: getOSItem('Toffeet'),
healAmount: 5
},
{
item: getOSItem('Chocolified skull'),
healAmount: 8
},
{
item: getOSItem('Rotten sweets'),
healAmount: 9
},
{
item: getOSItem('Hairyfloss'),
healAmount: 12
},
{
item: getOSItem('Eyescream'),
healAmount: 13
},
{
item: getOSItem('Goblinfinger soup'),
healAmount: 20
},
{
item: getOSItem("Benny's brain brew"),
healAmount: 50
},
{
item: getOSItem('Roasted newt'),
healAmount: 120
}
];

function getScaryFoodFromBank(user: MUser, totalHealingNeeded: number, _userBank?: Bank): false | Bank {
if (OWNER_IDS.includes(user.id)) return new Bank();
let totalHealingCalc = totalHealingNeeded;
Expand Down
41 changes: 1 addition & 40 deletions src/lib/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -668,45 +668,6 @@ export const mahojiInformationalButtons: APIButtonComponent[] = buttonSource.map
export const PATRON_ONLY_GEAR_SETUP =
'Sorry - but the `other` gear setup is only available for Tier 3 Patrons (and higher) to use.';

export const scaryEatables = [
{
item: getOSItem('Candy teeth'),
healAmount: 3
},
{
item: getOSItem('Toffeet'),
healAmount: 5
},
{
item: getOSItem('Chocolified skull'),
healAmount: 8
},
{
item: getOSItem('Rotten sweets'),
healAmount: 9
},
{
item: getOSItem('Hairyfloss'),
healAmount: 12
},
{
item: getOSItem('Eyescream'),
healAmount: 13
},
{
item: getOSItem('Goblinfinger soup'),
healAmount: 20
},
{
item: getOSItem("Benny's brain brew"),
healAmount: 50
},
{
item: getOSItem('Roasted newt'),
healAmount: 120
}
];

export const projectiles = {
arrow: {
items: resolveItems(['Adamant arrow', 'Rune arrow', 'Amethyst arrow', 'Dragon arrow', 'Hellfire arrow']),
Expand Down Expand Up @@ -878,7 +839,7 @@ const globalConfigSchema = z.object({
patreonCampaignID: z.coerce.number().int().default(1),
patreonWebhookSecret: z.coerce.string().default(''),
httpPort: z.coerce.number().int().default(8080),
clientID: z.string().min(15).max(25),
clientID: z.string().min(10).max(25),
geAdminChannelID: z.string().default('')
});
dotenv.config({ path: path.resolve(process.cwd(), process.env.TEST ? '.env.test' : '.env') });
Expand Down
6 changes: 3 additions & 3 deletions src/lib/data/CollectionsExport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2020,9 +2020,9 @@ export const slayerCL = resolveItems([
'Mystic gloves (dusk)',
'Mystic boots (dusk)',
'Basilisk jaw',
// "Dagon'hai hat",
// "Dagon'hai robe top",
// "Dagon'hai robe bottom",
"Dagon'hai hat",
"Dagon'hai robe top",
"Dagon'hai robe bottom",
'Blood shard',
...stoneSpirits.map(i => i.spirit.id),
'Brackish blade',
Expand Down
9 changes: 9 additions & 0 deletions src/lib/data/buyables/buyables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1171,6 +1171,15 @@ const Buyables: Buyable[] = [
return toaKCs.expertKC >= 25 ? [true] : [false, 'You need a 25 Expert KC in Tombs of Amascut to buy this.'];
}
},
{
name: 'Lockpick',
gpCost: 5000,
ironmanPrice: 500,
skillsNeeded: {
agility: 50,
thieving: 50
}
},
...sepulchreBuyables,
...constructionBuyables,
...hunterBuyables,
Expand Down
1 change: 1 addition & 0 deletions src/lib/data/creatablesTable.txt
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
| Kodai wand | 1x Master wand, 1x Kodai insignia | 1x Kodai wand | 0 |
| Salve amulet (e) | 1x Salve amulet | 1x Salve amulet (e) | 0 |
| Salve amulet(ei) | 1x Salve amulet(i) | 1x Salve amulet(ei) | 0 |
| Ring of wealth (i) | 1x Ring of wealth, 1x Ring of wealth scroll | 1x Ring of wealth (i) | 50000 |
| Strange hallowed tome | 1x Mysterious page 1, 1x Mysterious page 2, 1x Mysterious page 3, 1x Mysterious page 4, 1x Mysterious page 5 | 1x Strange hallowed tome | 0 |
| Frozen key | 1x Frozen key piece (armadyl), 1x Frozen key piece (bandos), 1x Frozen key piece (zamorak), 1x Frozen key piece (saradomin) | 1x Frozen key | 0 |
| Ecumenical key | 50x Ecumenical key shard | 1x Ecumenical key | 0 |
Expand Down
6 changes: 6 additions & 0 deletions src/lib/data/createables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2230,6 +2230,12 @@ const Createables: Createable[] = [
},
customReq: salveECustomReq
},
{
name: 'Ring of wealth (i)',
inputItems: new Bank().add('Ring of wealth').add('Ring of wealth scroll'),
GPCost: 50_000,
outputItems: new Bank().add('Ring of wealth (i)')
},
{
name: 'Strange hallowed tome',
inputItems: new Bank({
Expand Down
69 changes: 1 addition & 68 deletions src/lib/geImage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,11 @@ import { formatItemStackQuantity, generateHexColorForCashStack, toTitleCase } fr
import { GEListing, GETransaction } from '@prisma/client';
import * as fs from 'fs/promises';
import { floor } from 'lodash';
import fetch from 'node-fetch';
import * as path from 'path';

import { GEListingWithTransactions } from './../mahoji/commands/ge';
import { GrandExchange } from './grandExchange';
import { fillTextXTimesInCtx } from './util/canvasUtil';
import getOSItem from './util/getOSItem';
import { logError } from './util/logError';

const CACHE_DIR = './icon_cache';

function drawTitle(ctx: SKRSContext2D, title: string, canvas: Canvas) {
// Draw Page Title
Expand All @@ -34,20 +29,9 @@ class GeImageTask {
public geProgressShadow: Image | null = null;
public geIconBuy: Image | null = null;
public geIconSell: Image | null = null;
public itemIconsList: Set<number>;
public itemIconImagesCache: Map<number, Image>;

public constructor() {
// This tells us simply whether the file exists or not on disk.
this.itemIconsList = new Set();

// If this file does exist, it might be cached in this, or need to be read from fs.
this.itemIconImagesCache = new Map();
}

async init() {
await this.prepare();
await this.run();
}

async prepare() {
Expand All @@ -74,23 +58,6 @@ class GeImageTask {
);
}

async run() {
await this.cacheFiles();
}

async cacheFiles() {
// Ensure that the icon_cache dir exists.
await fs.mkdir(CACHE_DIR).catch(() => null);
CACHE_DIR;
// Get a list of all files (images) in the dir.
const filesInDir = await fs.readdir(CACHE_DIR);

// For each one, set a cache value that it exists.
for (const fileName of filesInDir) {
this.itemIconsList.add(parseInt(path.parse(fileName).name));
}
}

drawText(
ctx: SKRSContext2D,
text: string,
Expand Down Expand Up @@ -148,7 +115,7 @@ class GeImageTask {

if (listing) {
// Get item
const itemImage = await this.getItemImage(listing.item_id);
const itemImage = await bankImageGenerator.getItemImage(listing.item_id);

// Draw item
ctx.textAlign = 'left';
Expand Down Expand Up @@ -221,40 +188,6 @@ class GeImageTask {
}
}

async getItemImage(itemID: number): Promise<Image> {
const cachedImage = this.itemIconImagesCache.get(itemID);
if (cachedImage) return cachedImage;

const isOnDisk = this.itemIconsList.has(itemID);
if (!isOnDisk) {
await this.fetchAndCacheImage(itemID);
return this.getItemImage(itemID);
}

const imageBuffer = await fs.readFile(path.join(CACHE_DIR, `${itemID}.png`));
try {
const image = await loadImage(imageBuffer);
this.itemIconImagesCache.set(itemID, image);
return image;
} catch (err) {
logError(`Failed to load item icon with id: ${itemID}`);
return this.getItemImage(1);
}
}

async fetchAndCacheImage(itemID: number) {
const imageBuffer = await fetch(`https://chisel.weirdgloop.org/static/img/osrs-sprite/${itemID}.png`).then(
result => result.buffer()
);

await fs.writeFile(path.join(CACHE_DIR, `${itemID}.png`), imageBuffer);

const image = await loadImage(imageBuffer);

this.itemIconsList.add(itemID);
this.itemIconImagesCache.set(itemID, image);
}

async createInterface(opts: {
user: MUser;
page: number;
Expand Down
Loading
Loading