Skip to content

Commit

Permalink
Merge branch 'master' into patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
Base20100 authored Oct 16, 2024
2 parents 3beac5f + 2355fdf commit 6504805
Show file tree
Hide file tree
Showing 10 changed files with 58 additions and 18 deletions.
5 changes: 4 additions & 1 deletion docs/src/content/docs/getting-started/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ sidebar:
order: 3
---

## Update 14/10/2024 [[68b130088f5e365ec2a341cae48bc5b353ccc2ff...8d58fb6722e2db20717e5ec3bce1abf8496344b7]]
## Update 16/10/2024 [[68b130088f5e365ec2a341cae48bc5b353ccc2ff...4fbfe429e9a1bdf817175cf497177e47fefc6be6]]

Bingo! We are running the 3rd official OSB bingo. See the [Bingo Page](/getting-started/bingo) for information.

Expand All @@ -19,6 +19,7 @@ Bingo! We are running the 3rd official OSB bingo. See the [Bingo Page](/getting-
- Various "engine" changes/improvements
- Various wiki fixes/improvements
- Fixed several bugs that were causing errors/issues
- Made some changes to fix roles (they may not be fully fixed yet)

### [[Arodab]]

Expand All @@ -38,6 +39,7 @@ Bingo! We are running the 3rd official OSB bingo. See the [Bingo Page](/getting-

### [[nwjgit]]

- Fixed the droprate of tormented demons uniques (instead of a roll that gets you either a synapse/claw, you get a roll at both now)
- [[Bow of faerdhinen (c)]] no longer requires arrows
- Improved code relating to item rerolling (e.g. bludgeon pieces)
- Added the **Colossal Wyrm Agility Course**
Expand All @@ -52,6 +54,7 @@ Bingo! We are running the 3rd official OSB bingo. See the [Bingo Page](/getting-
### [[00justas]]

- Updated agility xp/hr rates based on the osrs update (buffed)
- Added [[Clue scroll (elite)]] drop to Araxxor

## Update 9/10/2024 [[8de72b2de5a275497c67123904a280981415c553...68b130088f5e365ec2a341cae48bc5b353ccc2ff]]

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
"murmurhash": "^2.0.1",
"node-cron": "^3.0.3",
"node-fetch": "^2.6.7",
"oldschooljs": "git+https://github.com/oldschoolgg/oldschooljs.git#15a1cfd4995d939fbffec46d5ebf76f749c2066c",
"oldschooljs": "git+https://github.com/oldschoolgg/oldschooljs.git#50025d60df15b59dda616306b8aebd576514ab6e",
"p-queue": "^6.6.2",
"piscina": "^4.7.0",
"postgres": "^3.4.4",
Expand Down
2 changes: 0 additions & 2 deletions src/lib/crons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ GROUP BY item_id;`);
* Analytics
*/
schedule('*/5 * * * *', () => {
debugLog('Analytics cronjob starting');
return analyticsTick();
});

Expand All @@ -41,7 +40,6 @@ GROUP BY item_id;`);
});

schedule('35 */48 * * *', async () => {
debugLog('cacheGEPrices cronjob starting');
await cacheGEPrices();
});
}
3 changes: 2 additions & 1 deletion src/lib/data/CollectionsExport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1547,7 +1547,8 @@ export const allPetsCL = resolveItems([
'Butch',
'Baron',
'Scurry',
'Smol heredit'
'Smol heredit',
'Nid'
]);
export const camdozaalCL = resolveItems([
'Barronite mace',
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 @@ -71,6 +71,15 @@ const randomEventBuyables: Buyable[] = [
outputItems: new Bank({
'Frog mask': 1
})
},
{
name: 'Genie lamp',
itemCost: new Bank({
'Frog token': 1
}),
outputItems: new Bank({
'Genie lamp': 1
})
}
];

Expand Down
2 changes: 1 addition & 1 deletion src/lib/minions/data/killableMonsters/low.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ const killableMonsters: KillableMonster[] = [
timeToFinish: Time.Second * 6,
table: Monsters.Araxyte,
qpRequired: 1,
healAmountNeeded: 100,
healAmountNeeded: 40,
attackStyleToUse: GearStat.AttackCrush,
attackStylesUsed: [GearStat.AttackStab],
levelRequirements: {
Expand Down
36 changes: 28 additions & 8 deletions src/lib/rolesTask.ts
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,7 @@ async function globalCL() {

export async function runRolesTask(dryRun: boolean): Promise<CommandResponse> {
const results: RoleResult[] = [];
const debugMessages: string[] = [];

const promiseQueue = new PQueue({ concurrency: 2 });

Expand All @@ -374,8 +375,10 @@ export async function runRolesTask(dryRun: boolean): Promise<CommandResponse> {
results.push(...validResults);
if (invalidResults.length > 0) {
logError(`[RolesTask] Invalid results for ${name}: ${JSON.stringify(invalidResults)}`);
debugMessages.push(`The ${name} roles had invalid results.`);
}
} catch (err) {
debugMessages.push(`The ${name} roles errored.`);
logError(`[RolesTask] Error in ${name}: ${err}`);
} finally {
debugLog(`[RolesTask] Ran ${name} in ${stopwatch.stop()}`);
Expand All @@ -385,7 +388,7 @@ export async function runRolesTask(dryRun: boolean): Promise<CommandResponse> {

await promiseQueue.onIdle();

debugLog(`Finished role functions, ${results.length} results`);
debugMessages.push(`Finished role functions, ${results.length} results`);

const allBadgeIDs = uniqueArr(results.map(i => i.badge)).filter(notEmpty);
const allRoleIDs = uniqueArr(results.map(i => i.roleID)).filter(notEmpty);
Expand All @@ -396,7 +399,6 @@ export async function runRolesTask(dryRun: boolean): Promise<CommandResponse> {
if (!supportServerGuild) throw new Error('No support guild');

// Remove all top badges from all users (and add back later)
debugLog('Removing badges...');
const badgeIDs = `ARRAY[${allBadgeIDs.join(',')}]`;
await loggedRawPrismaQuery(`
UPDATE users
Expand All @@ -405,32 +407,43 @@ WHERE badges && ${badgeIDs}
`);

// Remove roles from ineligible users
debugLog('Remove roles from ineligible users...');
for (const member of supportServerGuild.members.cache.values()) {
const rolesToRemove = member.roles.cache.filter(r => allRoleIDs.includes(r.id));
const rolesToRemove = member.roles.cache
.filter(r => allRoleIDs.includes(r.id))
.filter(roleToRemove => {
const shouldHaveThisRole = results.some(
r => r.userID === member.id && r.roleID === roleToRemove.id
);
return !shouldHaveThisRole;
});
if (rolesToRemove.size > 0) {
await member.roles.remove(rolesToRemove.map(r => r.id)).catch(console.error);
debugMessages.push(
`Removing these roles from ${member.user.tag}: ${rolesToRemove.map(r => r.name).join(', ')}`
);
}
}

// Add roles to users
debugLog('Add roles to users...');
for (const { userID, roleID, badge } of results) {
if (!userID) continue;
const role = await supportServerGuild.roles.fetch(roleID).catch(console.error);
const member = await supportServerGuild.members.fetch(userID).catch(noOp);
if (!member) {
debugLog(`Failed to find member ${userID}`);
debugMessages.push(`Failed to find member ${userID}`);
continue;
}
if (!role) {
debugLog(`Failed to find role ${roleID}`);
debugMessages.push(`Failed to find role ${roleID}`);
continue;
}
roleNames.set(roleID, role.name);

if (!member.roles.cache.has(roleID)) {
await member.roles.add(roleID).catch(console.error);
debugMessages.push(`Adding the ${role.name} role to ${member.user.tag}`);
} else {
debugMessages.push(`${member.user.tag} already has the ${role.name} role`);
}

if (badge) {
Expand All @@ -441,12 +454,19 @@ WHERE badges && ${badgeIDs}
push: badge
}
});
debugMessages.push(`Adding badge ${badge} to ${member.user.tag}`);
} else {
debugMessages.push(`${member.user.tag} already has badge ${badge}`);
}
}
}

return returnStringOrFile(
`**Roles**\n${results.map(r => `${getUsernameSync(r.userID)} got ${roleNames.get(r.roleID)} because ${r.reason}`).join('\n')}`
`Roles
${results.map(r => `${getUsernameSync(r.userID)} got ${roleNames.get(r.roleID)} because ${r.reason}`).join('\n')}
Debug Messages:
${debugMessages.join('\n')}`
);
}

Expand Down
9 changes: 9 additions & 0 deletions tests/unit/snapshots/banksnapshots.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -2529,6 +2529,15 @@ exports[`OSB Buyables 1`] = `
"6188": 1,
},
},
{
"itemCost": {
"6183": 1,
},
"name": "Genie lamp",
"outputItems": {
"2528": 1,
},
},
{
"gpCost": 100000,
"itemCost": {},
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/snapshots/clsnapshots.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ exports[`OSB Collection Log Groups/Categories 1`] = `
Achievement Diary (48)
Aerial Fishing (9)
Alchemical Hydra (11)
All Pets (58)
All Pets (59)
Araxxor (10)
Barbarian Assault (11)
Barrows Chests (25)
Expand Down
6 changes: 3 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4362,9 +4362,9 @@ __metadata:
languageName: node
linkType: hard

"oldschooljs@git+https://github.com/oldschoolgg/oldschooljs.git#15a1cfd4995d939fbffec46d5ebf76f749c2066c":
"oldschooljs@git+https://github.com/oldschoolgg/oldschooljs.git#50025d60df15b59dda616306b8aebd576514ab6e":
version: 0.0.0
resolution: "oldschooljs@https://github.com/oldschoolgg/oldschooljs.git#commit=15a1cfd4995d939fbffec46d5ebf76f749c2066c"
resolution: "oldschooljs@https://github.com/oldschoolgg/oldschooljs.git#commit=50025d60df15b59dda616306b8aebd576514ab6e"
dependencies:
e: "npm:^0.2.33"
node-fetch: "npm:2.6.7"
Expand Down Expand Up @@ -5171,7 +5171,7 @@ __metadata:
node-cron: "npm:^3.0.3"
node-fetch: "npm:^2.6.7"
nodemon: "npm:^3.1.7"
oldschooljs: "git+https://github.com/oldschoolgg/oldschooljs.git#15a1cfd4995d939fbffec46d5ebf76f749c2066c"
oldschooljs: "git+https://github.com/oldschoolgg/oldschooljs.git#50025d60df15b59dda616306b8aebd576514ab6e"
p-queue: "npm:^6.6.2"
piscina: "npm:^4.7.0"
postgres: "npm:^3.4.4"
Expand Down

0 comments on commit 6504805

Please sign in to comment.