Skip to content

Commit

Permalink
Merge
Browse files Browse the repository at this point in the history
  • Loading branch information
gc committed Feb 22, 2024
2 parents 44ded68 + 982591e commit 8c2db37
Show file tree
Hide file tree
Showing 35 changed files with 375 additions and 213 deletions.
69 changes: 0 additions & 69 deletions .github/workflows/codequality.yml

This file was deleted.

File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,15 @@ jobs:
run: cp .env.example .env
- name: Generate Prisma Client
run: yarn gen
- name: Run ESLint on changed files
uses: tj-actions/eslint-changed-files@v21
with:
skip_annotations: true
config_path: ".eslintrc.json"
ignore_path: ".eslintignore"
file_extensions: |
**/*.ts
**/*.tsx
- name: Build
run: yarn build
- name: Test
Expand Down
7 changes: 7 additions & 0 deletions src/lib/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,8 @@ export enum BitField {
DisabledFarmingReminders = 37,
DisableClueButtons = 38,
DisableAutoSlayButton = 39,
DisableHighPeakTimeWarning = 40,

HasGivenBirthdayPack = 200,
HasPermanentSpawnLamp = 201,
HasScrollOfFarming = 202,
Expand Down Expand Up @@ -521,6 +523,11 @@ export const BitFieldData: Record<BitField, BitFieldData> = {
name: 'Disable Eagle Tame Opening Caskets',
protected: false,
userConfigurable: true
},
[BitField.DisableHighPeakTimeWarning]: {
name: 'Disable Wilderness High Peak Time Warning',
protected: false,
userConfigurable: true
}
} as const;

Expand Down
2 changes: 1 addition & 1 deletion src/lib/data/Collections.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1100,7 +1100,7 @@ export const allCollectionLogs: ICollection = {
"Shades of Mort'ton": {
items: shadesOfMorttonCL,
isActivity: true,
fmtProg: () => '0 KC'
fmtProg: mgProg('shades_of_morton')
},
'Soul Wars': {
alias: ['soul wars', 'sw'],
Expand Down
4 changes: 2 additions & 2 deletions src/lib/data/cox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -265,10 +265,10 @@ export async function checkCoxTeam(users: MUser[], cm: boolean, quantity: number
for (const user of users) {
const { total } = calculateUserGearPercents(user);
if (total < 20) {
return "Your gear is terrible! You do not stand a chance in the Chamber's of Xeric.";
return 'Your gear is terrible! You do not stand a chance in the Chambers of Xeric.';
}
if (!hasMinRaidsRequirements(user)) {
return `${user.usernameOrMention} doesn't meet the stat requirements to do the Chamber's of Xeric.`;
return `${user.usernameOrMention} doesn't meet the stat requirements to do the Chambers of Xeric.`;
}
if (cm) {
if (users.length === 1 && !user.hasEquippedOrInBank('Twisted bow')) {
Expand Down
21 changes: 18 additions & 3 deletions src/lib/degradeableItems.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Time } from 'e';
import { percentChance, Time } from 'e';
import { Bank } from 'oldschooljs';
import { Item } from 'oldschooljs/dist/meta/types';
import Monster from 'oldschooljs/dist/structures/Monster';
Expand Down Expand Up @@ -227,7 +227,7 @@ export const degradeableItems: DegradeableItem[] = [
setup: 'melee',
aliases: ['scythe of vitur'],
chargeInput: {
cost: new Bank().add('Blood rune', 300).add('Vial of blood').freeze(),
cost: new Bank().add('Blood rune', 200).add('Vial of blood').freeze(),
charges: 100
},
unchargedItem: getOSItem('Scythe of vitur (uncharged)'),
Expand Down Expand Up @@ -329,6 +329,17 @@ export async function degradeItem({
const degItem = degradeableItems.find(i => i.item === item);
if (!degItem) throw new Error('Invalid degradeable item');

// 5% chance to not consume a charge when Ghommal's lucky penny is equipped
let pennyReduction = 0;
if (user.hasEquipped("Ghommal's lucky penny")) {
for (let i = 0; i < chargesToDegrade; i++) {
if (percentChance(5)) {
pennyReduction++;
}
}
}
chargesToDegrade -= pennyReduction;

const currentCharges = user.user[degItem.settingsKey];
assert(typeof currentCharges === 'number');
const newCharges = Math.floor(currentCharges - chargesToDegrade);
Expand Down Expand Up @@ -385,7 +396,11 @@ export async function degradeItem({
const chargesAfter = user.user[degItem.settingsKey];
assert(typeof chargesAfter === 'number' && chargesAfter > 0);
return {
userMessage: `Your ${item.name} degraded by ${chargesToDegrade} charges, and now has ${chargesAfter} remaining.`
userMessage: `Your ${
item.name
} degraded by ${chargesToDegrade} charges, and now has ${chargesAfter} remaining.${
pennyReduction > 0 ? ` Your Ghommal's lucky penny saved ${pennyReduction} charges` : ''
}`
};
}

Expand Down
73 changes: 65 additions & 8 deletions src/lib/randomEvents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,36 @@ export const zombieOutfit = resolveItems([

export const mimeOutfit = resolveItems(['Mime mask', 'Mime top', 'Mime legs', 'Mime gloves', 'Mime boots']);

// Used by Mysterious Old man, Pillory, Rick Turpentine
const randomEventTable = new LootTable()
.add('Uncut sapphire', 1, 32)
.add('Uncut emerald', 1, 16)
.add('Coins', 80, 10)
.add('Coins', 160, 10)
.add('Coins', 320, 10)
.add('Coins', 480, 10)
.add('Coins', 640, 10)
.add('Uncut ruby', 1, 8)
.add('Coins', 240, 6)
.add('Cosmic talisman', 1, 4)
.add('Uncut diamond', 2, 2)
.add('Tooth half of key', 1, 1)
.add('Tooth half of key', 1, 1);

// https://oldschool.runescape.wiki/w/Random_events#List_of_random_events
// Missing: Evil Bob, Jekyll and Hyde, Maze, Prison Pete
export const RandomEvents: RandomEvent[] = [
{
id: 1,
name: 'Bee keeper',
outfit: beekeeperOutfit,
loot: new LootTable().add('Coins', [20, 60]).add('Flax', [1, 27])
loot: new LootTable().add('Coins', [16, 36]).add('Flax', [1, 27])
},
{
id: 2,
name: 'Drill Demon',
outfit: camoOutfit,
loot: new LootTable().every('Coins', 500)
loot: new LootTable().every('Genie lamp')
},
{
id: 3,
Expand All @@ -60,8 +78,8 @@ export const RandomEvents: RandomEvent[] = [
{
id: 4,
name: 'Freaky Forester',
loot: new LootTable().every('Coins', 500),
outfit: lederhosenOutfit
outfit: lederhosenOutfit,
loot: new LootTable().every('Genie lamp')
},
{
id: 5,
Expand All @@ -71,8 +89,8 @@ export const RandomEvents: RandomEvent[] = [
{
id: 6,
name: 'Gravedigger',
loot: new LootTable().every('Coins', 500),
outfit: zombieOutfit
outfit: zombieOutfit,
loot: new LootTable().every('Genie lamp')
},
{
id: 7,
Expand All @@ -82,8 +100,8 @@ export const RandomEvents: RandomEvent[] = [
{
id: 8,
name: 'Mime',
loot: new LootTable().every('Coins', 500),
outfit: mimeOutfit
outfit: mimeOutfit,
loot: new LootTable().every('Genie lamp')
},
{
id: 9,
Expand Down Expand Up @@ -129,6 +147,45 @@ export const RandomEvents: RandomEvent[] = [
.add('Spinach roll')
.add('Tooth half of key')
.add('Loop half of key')
},
{
id: 14,
name: 'Count Check',
loot: new LootTable().every('Genie lamp')
},
{
id: 15,
name: 'Evil twin',
loot: new LootTable()
.add('Uncut sapphire', [2, 4])
.add('Uncut emerald', [2, 4])
.add('Uncut ruby', [2, 4])
.add('Uncut diamond', [2, 4])
},
{
id: 16,
name: 'Mysterious Old Man',
loot: randomEventTable.add('Kebab', 1, 16).add('Spinach roll', 1, 14)
},
{
id: 17,
name: 'Pillory',
loot: randomEventTable
},
{
id: 18,
name: 'Pinball',
loot: new LootTable().add('Sapphire', 5, 3).add('Emerald', 5, 3).add('Ruby', 5, 3).add('Diamond', 2, 1)
},
{
id: 19,
name: 'Rick Turpentine',
loot: randomEventTable.add('Kebab', 1, 16).add('Spinach roll', 1, 14)
},
{
id: 20,
name: 'Strange plant',
loot: new LootTable().every('Strange fruit')
}
];

Expand Down
4 changes: 2 additions & 2 deletions src/lib/settings/minigames.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,12 @@ export const Minigames: readonly BotMinigame[] = [
column: 'castle_wars'
},
{
name: "Chamber's of Xeric",
name: 'Chambers of Xeric',
aliases: ['cox', 'raid1', 'raids1', 'chambers', 'xeric'],
column: 'raids'
},
{
name: "Chamber's of Xeric - Challenge Mode",
name: 'Chambers of Xeric - Challenge Mode',
aliases: ['coxcm', 'raid1cm', 'raids1cm', 'chamberscm', 'xericcm'],
column: 'raids_challenge_mode'
},
Expand Down
13 changes: 12 additions & 1 deletion src/lib/simulation/tob.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { Bank, LootTable } from 'oldschooljs';
import { LootBank } from 'oldschooljs/dist/meta/types';
import { convertLootBanksToItemBanks, JSONClone } from 'oldschooljs/dist/util';

import { BOT_TYPE } from '../constants';
import { TOBRooms } from '../data/tob';
import { assert } from '../util/logError';

Expand Down Expand Up @@ -50,7 +51,6 @@ const HardModeUniqueTable = new LootTable()
.add('Avernic defender hilt', 1, 7);

const NonUniqueTable = new LootTable()
.tertiary(25, 'Clue scroll (elite)')
.add('Vial of blood', [50, 60], 2)
.add('Death rune', [500, 600])
.add('Blood rune', [500, 600])
Expand Down Expand Up @@ -93,6 +93,10 @@ export class TheatreOfBloodClass {
if (deaths.length === TOBRooms.length) {
return new Bank().add('Cabbage');
}

if (BOT_TYPE === 'BSO') {
NonUniqueTable.tertiary(25, 'Clue scroll (elite)');
}
const loot = new Bank();
for (let i = 0; i < 3; i++) {
loot.add(NonUniqueTable.roll());
Expand All @@ -106,6 +110,13 @@ export class TheatreOfBloodClass {
// Add HM Tertiary drops: dust / kits
loot.add(HardModeExtraTable.roll());
}

if (BOT_TYPE === 'OSB') {
if (roll(25)) {
loot.add('Clue scroll (elite)');
}
}

let petChance = isHardMode ? 500 : 650;
if (member.numDeaths > 0) {
petChance *= member.numDeaths;
Expand Down
14 changes: 0 additions & 14 deletions src/lib/slayer/tasks/chaeldarTasks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -442,20 +442,6 @@ export const chaeldarTasks: AssignableSlayerTask[] = [
unlocked: true,
dontAssign: true
},
{
monster: Monsters.SpiritualRanger,
amount: [110, 170],

weight: 12,
monsters: [Monsters.SpiritualRanger.id, Monsters.SpiritualWarrior.id, Monsters.SpiritualMage.id],
levelRequirements: {
slayer: 60
},
combatLevel: 60,
slayerLevel: 63,
questPoints: 3,
unlocked: true
},
{
monster: Monsters.MountainTroll,
amount: [110, 170],
Expand Down
Loading

0 comments on commit 8c2db37

Please sign in to comment.