Skip to content

Commit

Permalink
Merge branch 'master' into updaeprisma
Browse files Browse the repository at this point in the history
  • Loading branch information
gc committed Feb 22, 2024
2 parents 48eba0f + 982591e commit 4b08bfc
Show file tree
Hide file tree
Showing 60 changed files with 1,088 additions and 392 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
18 changes: 18 additions & 0 deletions src/lib/MUser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -824,6 +824,24 @@ GROUP BY data->>'clueID';`);
async validateEquippedGear() {
let itemsUnequippedAndRefunded = new Bank();
for (const [gearSetupName, gearSetup] of Object.entries(this.gear) as [GearSetupType, GearSetup][]) {
if (gearSetup['2h'] !== null) {
if (gearSetup.weapon?.item) {
const { refundBank } = await this.forceUnequip(
gearSetupName,
EquipmentSlot.Weapon,
'2h Already equipped'
);
itemsUnequippedAndRefunded.add(refundBank);
}
if (gearSetup.shield?.item) {
const { refundBank } = await this.forceUnequip(
gearSetupName,
EquipmentSlot.Shield,
'2h Already equipped'
);
itemsUnequippedAndRefunded.add(refundBank);
}
}
for (const slot of Object.values(EquipmentSlot)) {
const item = gearSetup[slot];
if (!item) continue;
Expand Down
5 changes: 3 additions & 2 deletions src/lib/clues/clueUtils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { ButtonBuilder, ButtonStyle } from 'discord.js';
import { Bank } from 'oldschooljs';

import { BitField } from '../constants';
import { ClueTiers } from './clueTiers';

export function getClueScoresFromOpenables(openableScores: Bank, mutate = false) {
Expand All @@ -23,9 +24,9 @@ export function deduplicateClueScrolls({ loot, currentBank }: { loot: Bank; curr
return newLoot;
}

export function buildClueButtons(loot: Bank | null, perkTier: number) {
export function buildClueButtons(loot: Bank | null, perkTier: number, user: MUser) {
const components: ButtonBuilder[] = [];
if (loot && perkTier > 1) {
if (loot && perkTier > 1 && !user.bitfield.includes(BitField.DisableClueButtons)) {
const clueReceived = ClueTiers.filter(tier => loot.amount(tier.scrollID) > 0);
components.push(
...clueReceived.map(clue =>
Expand Down
20 changes: 19 additions & 1 deletion src/lib/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,10 @@ export enum BitField {
UsedFrozenTablet = 34,
CleanHerbsFarming = 35,
SelfGamblingLocked = 36,
DisabledFarmingReminders = 37
DisabledFarmingReminders = 37,
DisableClueButtons = 38,
DisableAutoSlayButton = 39,
DisableHighPeakTimeWarning = 40
}

interface BitFieldData {
Expand Down Expand Up @@ -338,6 +341,21 @@ export const BitFieldData: Record<BitField, BitFieldData> = {
name: 'Disable Farming Reminders',
protected: false,
userConfigurable: true
},
[BitField.DisableClueButtons]: {
name: 'Disable Clue Buttons',
protected: false,
userConfigurable: true
},
[BitField.DisableAutoSlayButton]: {
name: 'Disable Auto Slay Button',
protected: false,
userConfigurable: true
},
[BitField.DisableHighPeakTimeWarning]: {
name: 'Disable Wilderness High Peak Time Warning',
protected: false,
userConfigurable: true
}
} as const;

Expand Down
6 changes: 3 additions & 3 deletions src/lib/data/Collections.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ function kcProg(mon: Monster): FormatProgressFunction {
}

function mgProg(minigameName: MinigameName): FormatProgressFunction {
return ({ minigames }) => `${minigames[minigameName]} KC`;
return ({ minigames }) => `${minigames[minigameName]} Completions`;
}

function skillProg(skillName: SkillsEnum): FormatProgressFunction {
Expand Down Expand Up @@ -502,7 +502,7 @@ export const allCollectionLogs: ICollection = {
},
Raids: {
activities: {
"Chamber's of Xeric": {
'Chambers of Xeric': {
alias: ChambersOfXeric.aliases,
kcActivity: {
Default: async (_, minigameScores) =>
Expand Down Expand Up @@ -807,7 +807,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 @@ -263,10 +263,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
36 changes: 36 additions & 0 deletions src/lib/data/creatables/caCreatables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ export const caCreatables: Createable[] = [
return null;
}
},
{
name: 'Revert Tztok slayer helmet',
outputItems: new Bank().add('Slayer helmet'),
inputItems: new Bank().add('Tztok slayer helmet'),
noCl: true
},
{
name: 'Tztok slayer helmet (i)',
inputItems: new Bank().add('Slayer helmet (i)'),
Expand All @@ -25,6 +31,12 @@ export const caCreatables: Createable[] = [
return null;
}
},
{
name: 'Revert Tztok slayer helmet (i)',
outputItems: new Bank().add('Slayer helmet (i)'),
inputItems: new Bank().add('Tztok slayer helmet (i)'),
noCl: true
},
//
{
name: 'Dragon hunter crossbow (t)',
Expand Down Expand Up @@ -73,6 +85,12 @@ export const caCreatables: Createable[] = [
return null;
}
},
{
name: 'Revert Tzkal slayer helmet',
outputItems: new Bank().add('Slayer helmet'),
inputItems: new Bank().add('Tzkal slayer helmet'),
noCl: true
},
{
name: 'Tzkal slayer helmet (i)',
inputItems: new Bank().add('Slayer helmet (i)'),
Expand All @@ -84,6 +102,12 @@ export const caCreatables: Createable[] = [
return null;
}
},
{
name: 'Revert Tzkal slayer helmet (i)',
outputItems: new Bank().add('Slayer helmet (i)'),
inputItems: new Bank().add('Tzkal slayer helmet (i)'),
noCl: true
},
//
{
name: 'Vampyric slayer helmet',
Expand All @@ -96,6 +120,12 @@ export const caCreatables: Createable[] = [
return null;
}
},
{
name: 'Revert Vampyric slayer helmet',
outputItems: new Bank().add('Slayer helmet'),
inputItems: new Bank().add('Vampyric slayer helmet'),
noCl: true
},
{
name: 'Vampyric slayer helmet (i)',
inputItems: new Bank().add('Slayer helmet (i)'),
Expand All @@ -107,6 +137,12 @@ export const caCreatables: Createable[] = [
return null;
}
},
{
name: 'Revert Vampyric slayer helmet (i)',
outputItems: new Bank().add('Slayer helmet (i)'),
inputItems: new Bank().add('Vampyric slayer helmet (i)'),
noCl: true
},
//
{
name: "Ghommal's avernic defender 5",
Expand Down
Loading

0 comments on commit 4b08bfc

Please sign in to comment.