Skip to content

Commit

Permalink
Merge pull request #435 from charles-m-knox/prayer-bury-bones-plugin
Browse files Browse the repository at this point in the history
Prayer: Bury Bones plugin update
  • Loading branch information
Promises authored Sep 8, 2024
2 parents 81ce4a2 + 89bb296 commit bceb43a
Show file tree
Hide file tree
Showing 5 changed files with 274 additions and 56 deletions.
195 changes: 194 additions & 1 deletion data/config/items/bones.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,199 @@
"rs:bones": {
"game_id": 526,
"tradable": true,
"weight": 0.5
"weight": 0.5,
"metadata": {
"prayerBuryXp": 4.5,
"wikiId": "Bones"
}
},
"rs:bones_burnt": {
"game_id": 528,
"tradable": true,
"weight": 0.5,
"metadata": {
"prayerBuryXp": 4.5,
"wikiId": "Burnt_bones"
}
},
"rs:bones_wolf": {
"game_id": 2859,
"tradable": true,
"weight": 0.5,
"metadata": {
"prayerBuryXp": 4.5,
"wikiId": "Wolf_bones"
}
},
"rs:bones_bat": {
"game_id": 530,
"tradable": true,
"weight": 0.5,
"metadata": {
"prayerBuryXp": 5.3,
"wikiId": "Bat_bones"
}
},
"rs:bones_big": {
"game_id": 532,
"tradable": true,
"weight": 0.8,
"metadata": {
"prayerBuryXp": 15,
"wikiId": "Big_bones"
}
},
"rs:bones_dagannoth": {
"game_id": 6729,
"tradable": true,
"weight": 1.5,
"metadata": {
"prayerBuryXp": 125,
"wikiId": "Dagannoth_bones"
}
},
"rs:bones_babydragon": {
"game_id": 534,
"tradable": true,
"weight": 0.8,
"metadata": {
"prayerBuryXp": 30,
"wikiId": "Babydragon_bones"
}
},
"rs:bones_dragon": {
"game_id": 536,
"tradable": true,
"weight": 1.5,
"metadata": {
"prayerBuryXp": 72,
"wikiId": "Dragon_bones"
}
},
"rs:bones_wyvern": {
"game_id": 6812,
"tradable": true,
"weight": 0.5,
"metadata": {
"prayerBuryXp": 72,
"wikiId": "Wyvern_bones"
}
},
"rs:bones_monkey_normal": {
"game_id": 3183,
"tradable": true,
"weight": 0.5,
"metadata": {
"prayerBuryXp": 5,
"wikiId": "Monkey_bones"
}
},
"rs:bones_monkey_small_zombie": {
"game_id": 3185,
"tradable": false,
"weight": 0.5,
"metadata": {
"prayerBuryXp": 5,
"wikiId": "Small_zombie_monkey_bones"
}
},
"rs:bones_monkey_large_zombie": {
"game_id": 3186,
"tradable": false,
"weight": 0.5,
"metadata": {
"prayerBuryXp": 5,
"wikiId": "Large_zombie_monkey_bones"
}
},
"rs:bones_monkey_gorilla": {
"game_id": 3181,
"tradable": false,
"weight": 0.5,
"metadata": {
"prayerBuryXp": 18,
"wikiId": "Gorilla_bones"
}
},
"rs:bones_monkey_bearded_gorilla": {
"game_id": 3182,
"tradable": false,
"weight": 0.8,
"metadata": {
"prayerBuryXp": 18,
"wikiId": "Bearded_gorilla_bones"
}
},
"rs:bones_monkey_small_ninja": {
"game_id": 3179,
"tradable": false,
"weight": 0.5,
"metadata": {
"prayerBuryXp": 16,
"wikiId": "Small_ninja_monkey_bones"
}
},
"rs:bones_monkey_medium_ninja": {
"game_id": 3180,
"tradable": false,
"weight": 0.5,
"metadata": {
"prayerBuryXp": 18,
"wikiId": "Medium_ninja_monkey_bones"
}
},
"rs:bones_monkey_skeleton_gorilla": {
"game_id": 3187,
"tradable": false,
"weight": 0.5,
"metadata": {
"prayerBuryXp": 3,
"wikiId": "Bones_(Ape_Atoll)"
}
},
"rs:bones_jogre": {
"game_id": 3152,
"tradable": true,
"weight": 0.8,
"metadata": {
"prayerBuryXp": 15,
"wikiId": "Jogre_bones"
}
},
"rs:bones_zogre": {
"game_id": 4812,
"tradable": true,
"weight": 0.8,
"metadata": {
"prayerBuryXp": 22.5,
"wikiId": "Zogre_bones"
}
},
"rs:bones_fayrg": {
"game_id": 4830,
"tradable": true,
"weight": 0.8,
"metadata": {
"prayerBuryXp": 84,
"wikiId": "Fayrg_bones"
}
},
"rs:bones_raurg": {
"game_id": 4832,
"tradable": true,
"weight": 0.8,
"metadata": {
"prayerBuryXp": 96,
"wikiId": "Raurg_bones"
}
},
"rs:bones_ourg": {
"game_id": 4834,
"tradable": true,
"weight": 0.8,
"metadata": {
"prayerBuryXp": 140,
"wikiId": "Ourg_bones"
}
}
}
14 changes: 14 additions & 0 deletions src/engine/config/item-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,20 @@ export interface ItemMetadata {
energy?: number | [number, number];
special: boolean;
};

/**
* If defined, the 'bury bones' plugin will assign experience according
* to this value.
*/
prayerBuryXp?: number;

/**
* If the full URL is `"https://oldschool.runescape.wiki/w/Bat_bones"`
* then the value is `"Bat_bones"`.
*
* @example "Bat_bones"
*/
wikiId?: string;
}


Expand Down
26 changes: 0 additions & 26 deletions src/engine/world/config/item-ids.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,32 +78,6 @@ export const itemIds = {
rune_fire_u: 2540,
rune_fire_l: 2541
},
bones: {
normal: 526,
burnt: 528,
wolf: 2859,
bat: 530,
big: 532,
dagannoth: 6729,
babydragon: 534,
dragon: 536,
wyvern: 6812,
monkey: {
normal: 3183,
small_zombie: 3185,
large_zombie: 3186,
gorilla: 3181,
bearded_gorilla: 3182,
small_ninja: 3179,
medium_ninja: 3180,
skeleton_gorilla: 3187
},
jogre: 3152,
zogre: 4812,
fayrg: 4830,
raurg: 4832,
ourg: 4834
},
essence: {
pure: 7936,
rune: 1436
Expand Down
66 changes: 66 additions & 0 deletions src/plugins/skills/prayer/bury-bones.plugin.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
import { itemInteractionActionHandler } from '@engine/action';
import { findItem, widgets } from '@engine/config';
import { Achievements, Skill, giveAchievement } from '@engine/world/actor';
import { animationIds, soundIds } from '@engine/world/config';

const action: itemInteractionActionHandler = (details) => {
const { player, option } = details;

if (option !== 'bury') return;

if (!player.canMove()) return;

// bones can be buried only if prayerBuryXp is defined, but they can also
// grant zero xp - this checks for that edge case
if (!details.itemDetails.metadata.prayerBuryXp && details.itemDetails.metadata.prayerBuryXp !== 0) {
return;
}

player.sendMessage(`You bury the ${details.itemDetails.name}.`);

player.playAnimation(animationIds.buryBones);
player.removeItem(details.itemSlot);
player.playSound(soundIds.buryBones);
player.skills.addExp(Skill.PRAYER, details.itemDetails.metadata.prayerBuryXp);

giveAchievement(Achievements.BURY_BONES, player);
};

const allBones: number[] = [
findItem('rs:bones')?.gameId,
findItem('rs:bones_burnt')?.gameId,
findItem('rs:bones_wolf')?.gameId,
findItem('rs:bones_bat')?.gameId,
findItem('rs:bones_big')?.gameId,
findItem('rs:bones_dagannoth')?.gameId,
findItem('rs:bones_babydragon')?.gameId,
findItem('rs:bones_dragon')?.gameId,
findItem('rs:bones_wyvern')?.gameId,
findItem('rs:bones_monkey_normal')?.gameId,
findItem('rs:bones_monkey_small_zombie')?.gameId,
findItem('rs:bones_monkey_large_zombie')?.gameId,
findItem('rs:bones_monkey_gorilla')?.gameId,
findItem('rs:bones_monkey_bearded_gorilla')?.gameId,
findItem('rs:bones_monkey_small_ninja')?.gameId,
findItem('rs:bones_monkey_medium_ninja')?.gameId,
findItem('rs:bones_monkey_skeleton_gorilla')?.gameId,
findItem('rs:bones_jogre')?.gameId,
findItem('rs:bones_zogre')?.gameId,
findItem('rs:bones_fayrg')?.gameId,
findItem('rs:bones_raurg')?.gameId,
findItem('rs:bones_ourg')?.gameId,
].filter(id => typeof id === 'number') as number[];

export default {
pluginId: 'rs:prayer_bury_bones',
hooks: [
{
type: 'item_interaction',
widgets: widgets.inventory,
options: 'bury',
itemIds: allBones,
handler: action,
cancelOtherActions: true
}
]
};
29 changes: 0 additions & 29 deletions src/plugins/skills/prayer_bury.plugin.js

This file was deleted.

0 comments on commit bceb43a

Please sign in to comment.