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

mining effect fix #6118

Merged
merged 10 commits into from
Oct 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
72 changes: 36 additions & 36 deletions docs/src/content/docs/osb/Skills/mining.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,42 +106,42 @@ The only other thing unidentified minerals can be used to purchase are:
{/_ DO NOT EDIT - This section is auto-generated by the build script _/}
| Ore | XP/hr | Powermining |
| --- | --- | --- |
| [[6983]] | 114,000 | Yes |
| [[6975]] | 81,000 | Yes |
| [[440]] | 77,000 | Yes |
| [[6975]] | 73,000 | No |
| [[442]] | 62,000 | Yes |
| [[6983]] | 60,000 | No |
| [[442]] | 57,000 | No |
| [[440]] | 55,000 | No |
| [[453]] | 44,000 | Yes |
| [[453]] | 38,000 | No |
| [[436]] | 38,000 | Yes |
| [[1625]] | 38,000 | Yes |
| [[444]] | 38,000 | Yes |
| [[438]] | 38,000 | Yes |
| [[444]] | 37,000 | No |
| [[1625]] | 36,000 | No |
| [[447]] | 28,000 | Yes |
| [[447]] | 26,000 | No |
| [[21347]] | 23,000 | Yes |
| [[21347]] | 22,000 | No |
| [[436]] | 19,000 | No |
| [[438]] | 19,000 | No |
| [[449]] | 16,000 | Yes |
| [[449]] | 15,000 | No |
| [[21622]] | 13,000 | Yes |
| [[21622]] | 13,000 | No |
| [[434]] | 11,000 | Yes |
| [[24706]] | 10,000 | Yes |
| [[24706]] | 10,000 | No |
| [[7936]] | 10,000 | Yes |
| [[1436]] | 10,000 | Yes |
| [[451]] | 10,000 | Yes |
| [[451]] | 10,000 | No |
| [[7936]] | 7,000 | No |
| [[1436]] | 7,000 | No |
| [[434]] | 5,000 | No |
| [[6983]] | 125 000 | Yes |
| [[6975]] | 93 000 | Yes |
| [[6975]] | 83 000 | No |
| [[440]] | 82 000 | Yes |
| [[6983]] | 66 000 | No |
| [[440]] | 58 000 | No |
| [[442]] | 58 000 | Yes |
| [[442]] | 53 000 | No |
| [[453]] | 45 000 | Yes |
| [[444]] | 42 000 | Yes |
| [[444]] | 40 000 | No |
| [[453]] | 38 000 | No |
| [[436]] | 38 000 | Yes |
| [[1625]] | 38 000 | Yes |
| [[438]] | 38 000 | Yes |
| [[1625]] | 36 000 | No |
| [[447]] | 32 000 | Yes |
| [[447]] | 30 000 | No |
| [[21347]] | 22 000 | Yes |
| [[21347]] | 22 000 | No |
| [[449]] | 19 000 | Yes |
| [[449]] | 19 000 | No |
| [[436]] | 19 000 | No |
| [[438]] | 19 000 | No |
| [[451]] | 13 000 | Yes |
| [[451]] | 13 000 | No |
| [[21622]] | 13 000 | Yes |
| [[21622]] | 13 000 | No |
| [[434]] | 11 000 | Yes |
| [[24706]] | 10 000 | Yes |
| [[24706]] | 10 000 | No |
| [[7936]] | 10 000 | Yes |
| [[1436]] | 10 000 | Yes |
| [[7936]] | 7 000 | No |
| [[1436]] | 7 000 | No |
| [[434]] | 5 000 | No |
| [[13421]] | 0 | Yes |
| [[13421]] | 0 | No |

Expand Down
12 changes: 9 additions & 3 deletions src/lib/skilling/functions/determineMiningTime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ interface MiningTimeOptions {
quantity: number | undefined;
ore: Ore;
ticksBetweenRolls: number;
glovesRate: number;
glovesEffect: number;
armourEffect: number;
miningCapeEffect: number;
powermining: boolean;
Expand All @@ -22,7 +22,7 @@ export function determineMiningTime({
quantity,
ore,
ticksBetweenRolls,
glovesRate,
glovesEffect,
armourEffect,
miningCapeEffect,
powermining,
Expand Down Expand Up @@ -54,12 +54,18 @@ export function determineMiningTime({
userMaxTripTicks *= 1.5;
}

let remainingNoDeplete = glovesEffect;

while (timeElapsed < userMaxTripTicks) {
while (!percentChance(chanceOfSuccess)) {
timeElapsed += ticksBetweenRolls;
}
if (!percentChance(glovesRate)) {
if (remainingNoDeplete <= 0) {
timeElapsed += respawnTimeOrPick;
remainingNoDeplete = glovesEffect;
} else {
timeElapsed += ticksBetweenRolls;
remainingNoDeplete--;
}
newQuantity++;
if (percentChance(miningCapeEffect)) {
Expand Down
68 changes: 37 additions & 31 deletions src/lib/skilling/functions/miningBoosts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,37 +53,43 @@ export const pickaxes = [
}
];

export const miningGloves: { id: number; Percentages: Record<string, number> }[] = [
export const miningGloves: { id: number; Depletions: Record<string, number> }[] = [
{
id: itemID('Expert mining gloves'),
Percentages: {
'Silver ore': 50,
Coal: 40,
'Gold ore': 33.33,
'Mithril ore': 25,
'Adamantite ore': 16.66,
'Runite ore': 12.5,
Amethyst: 25
Depletions: {
'Iron ore': 3,
'Silver ore': 3,
Coal: 3,
Sandstone: 1,
'Gold ore': 3,
'Mithril ore': 2,
'Adamantite ore': 2,
'Runite ore': 1,
Amethyst: 1
}
},
{
id: itemID('Superior mining gloves'),
Percentages: {
'Silver ore': 0,
Coal: 0,
'Gold ore': 0,
'Mithril ore': 25,
'Adamantite ore': 16.66,
'Runite ore': 12.5,
Depletions: {
'Iron ore': 2,
'Silver ore': 2,
Coal: 2,
Sandstone: 0,
'Gold ore': 2,
'Mithril ore': 1,
'Adamantite ore': 1,
'Runite ore': 0,
Amethyst: 0
}
},
{
id: itemID('Mining gloves'),
Percentages: {
'Silver ore': 50,
Coal: 40,
'Gold ore': 33.33,
Depletions: {
'Iron ore': 1,
'Silver ore': 1,
Coal: 1,
Sandstone: 0,
'Gold ore': 1,
'Mithril ore': 0,
'Adamantite ore': 0,
'Runite ore': 0,
Expand All @@ -102,9 +108,9 @@ export const varrockArmours: { id: number; Percentages: Record<string, number> }
'Iron ore': 10,
'Silver ore': 10,
Coal: 10,
'Sandstone (5kg)': 10,
Sandstone: 10,
'Gold ore': 10,
'Granite (5kg)': 10,
Granite: 10,
'Mithril ore': 10,
'Adamantite ore': 10,
'Runite ore': 10,
Expand All @@ -120,9 +126,9 @@ export const varrockArmours: { id: number; Percentages: Record<string, number> }
'Iron ore': 10,
'Silver ore': 10,
Coal: 10,
'Sandstone (5kg)': 10,
Sandstone: 10,
'Gold ore': 10,
'Granite (5kg)': 10,
Granite: 10,
'Mithril ore': 10,
'Adamantite ore': 10,
'Runite ore': 0,
Expand All @@ -138,9 +144,9 @@ export const varrockArmours: { id: number; Percentages: Record<string, number> }
'Iron ore': 10,
'Silver ore': 10,
Coal: 10,
'Sandstone (5kg)': 10,
Sandstone: 10,
'Gold ore': 10,
'Granite (5kg)': 10,
Granite: 10,
'Mithril ore': 10,
'Adamantite ore': 0,
'Runite ore': 0,
Expand All @@ -156,9 +162,9 @@ export const varrockArmours: { id: number; Percentages: Record<string, number> }
'Iron ore': 10,
'Silver ore': 10,
Coal: 10,
'Sandstone (5kg)': 0,
'Gold ore': 0,
'Granite (5kg)': 0,
'Sandstone)': 0,
'Gold ore': 10,
Granite: 0,
'Mithril ore': 0,
'Adamantite ore': 0,
'Runite ore': 0,
Expand All @@ -174,9 +180,9 @@ export const miningCapeOreEffect: Record<string, number> = {
'Iron ore': 5,
'Silver ore': 5,
Coal: 5,
'Sandstone (5kg)': 5,
Sandstone: 5,
'Gold ore': 5,
'Granite (5kg)': 5,
Granite: 5,
'Mithril ore': 5,
'Adamantite ore': 5,
'Runite ore': 0,
Expand Down
14 changes: 8 additions & 6 deletions src/mahoji/commands/mine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,15 @@ export function determineMiningTrip({
break;
}

let glovesRate = 0;
let glovesEffect = 0;
if (gearBank.skillsAsLevels.mining >= 60) {
for (const glove of miningGloves) {
if (!gearBank.hasEquipped(glove.id) || !glove.Percentages[ore.name]) continue;
glovesRate = glove.Percentages[ore.name];
if (glovesRate) {
boosts.push(`Lowered rock depletion rate by **${glovesRate}%** for ${itemNameFromID(glove.id)}`);
if (!gearBank.hasEquipped(glove.id) || !glove.Depletions[ore.name]) continue;
glovesEffect = glove.Depletions[ore.name];
if (glovesEffect) {
boosts.push(
`mining gloves saves ${ore.name} from becoming depleted **${glovesEffect}x** ${glovesEffect > 1 ? 'times' : 'time'} using ${itemNameFromID(glove.id)}`
);
break;
}
}
Expand Down Expand Up @@ -104,7 +106,7 @@ export function determineMiningTrip({
gearBank,
ore,
ticksBetweenRolls: currentPickaxe.ticksBetweenRolls,
glovesRate,
glovesEffect,
armourEffect,
miningCapeEffect,
powermining: isPowermining,
Expand Down
4 changes: 2 additions & 2 deletions src/mahoji/lib/abstracted_commands/camdozaalCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ async function miningCommand(user: MUser, channelID: string, quantity: number |
break;
}

const glovesRate = 0;
const glovesEffect = 0;
const armourEffect = 0;
const miningCapeEffect = 0;
const goldSilverBoost = false;
Expand All @@ -50,7 +50,7 @@ async function miningCommand(user: MUser, channelID: string, quantity: number |
gearBank: user.gearBank,
ore: barroniteRocks,
ticksBetweenRolls: currentPickaxe.ticksBetweenRolls,
glovesRate,
glovesEffect,
armourEffect,
miningCapeEffect,
powermining: powermine,
Expand Down
4 changes: 2 additions & 2 deletions src/mahoji/lib/abstracted_commands/motherlodeMineCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export async function motherlodeMineCommand({
);
}

const glovesRate = 0;
const glovesEffect = 0;
const armourEffect = 0;
const miningCapeEffect = 0;
const goldSilverBoost = false;
Expand All @@ -67,7 +67,7 @@ export async function motherlodeMineCommand({
gearBank: user.gearBank,
ore: motherlode,
ticksBetweenRolls: currentPickaxe.ticksBetweenRolls,
glovesRate,
glovesEffect,
armourEffect,
miningCapeEffect,
powermining: powermine,
Expand Down
2 changes: 1 addition & 1 deletion src/mahoji/lib/abstracted_commands/shootingStarsCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ export async function shootingStarsCommand(channelID: string, user: MUserClass,
gearBank: user.gearBank,
ore: star,
ticksBetweenRolls: currentPickaxe.ticksBetweenRolls,
glovesRate: 0,
glovesEffect: 0,
armourEffect: 0,
miningCapeEffect: 0,
powermining: false,
Expand Down