Skip to content

Commit

Permalink
Merge pull request #430 from charles-m-knox/take-axe
Browse files Browse the repository at this point in the history
Take-axe plugin; various small improvements
  • Loading branch information
Promises authored Sep 2, 2024
2 parents 94ecc7e + 1452424 commit 7f44935
Show file tree
Hide file tree
Showing 10 changed files with 207 additions and 85 deletions.
19 changes: 19 additions & 0 deletions data/config/items/equipment/capes.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"rs:cape_of_legends": {
"game_id": 1052,
"examine": "The cape worn by members of the Legends Guild.",
"tradable": false,
"weight": 1.814,
"equippable": true,
"equipment_data": {
"equipment_slot": "back",
"defensive_bonuses": {
"stab": 7,
"slash": 7,
"crush": 7,
"magic": 7,
"ranged": 7
}
}
}
}
38 changes: 38 additions & 0 deletions data/config/items/equipment/longswords.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"rs:dragon_longsword": {
"game_id": 1305,
"examine": "A very powerful sword.",
"tradable": true,
"weight": 1.814,
"equippable": true,
"equipment_data": {
"equipment_slot": "main_hand",
"requirements": {
"skills": {
"attack": 60
}
},
"offensive_bonuses": {
"speed": 5,
"stab": 58,
"slash": 69,
"crush": -2,
"magic": 0,
"ranged": 0
},
"defensive_bonuses": {
"stab": 0,
"slash": 3,
"crush": 2,
"magic": 0,
"ranged": 0
},
"skill_bonuses": {
"prayer": 0,
"strength": 71,
"ranged": 0,
"magic": 0
}
}
}
}
5 changes: 5 additions & 0 deletions data/config/npcs/ardougne.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"rs:ardougne_baker": {
"game_id": 571
}
}
8 changes: 7 additions & 1 deletion src/engine/world/config/animation-ids.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
export const animationIds = {
reset: -1,
walk: 819,
idle: 808,
run: 824,
milkCow: 2305,
lightingFire: 733,
homeTeleportDraw: 4847,
Expand Down Expand Up @@ -27,5 +31,7 @@ export const animationIds = {
armBlock: 424
},
fadeOut: 3541,
fadeIn: 2115
fadeIn: 2115,
transparent: 15,
teleport: 714
};
3 changes: 2 additions & 1 deletion src/engine/world/config/gfx-ids.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ export const gfxIds = {
homeTeleportPullOutBook: 802,
homeTeleportCircleGlow: 803,
homeTeleport: 804,
levelUpFireworks: 199
levelUpFireworks: 199,
teleport: 111
};
7 changes: 7 additions & 0 deletions src/engine/world/config/item-ids.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export const itemIds = {
bucket: 1925,
bucketOfMilk: 1927,
bucketOfWater: 1929,
banana: 1963,
ashes: 592,
tinderbox: 590,
jug: 1935,
Expand Down Expand Up @@ -528,4 +529,10 @@ export const itemIds = {
untrimmed: 9813,
},
},
staffs: {
air: 1381,
fire: 1387,
water: 1383,
earth: 1385
}
};
4 changes: 3 additions & 1 deletion src/engine/world/config/object-ids.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ export const objectIds = {
bankBooth: 2213,
depositBox: 9398,
shortCuts: {
stile: 12982
stile: 12982,
fenceNearKharidCows: 9300
},
ladders: {
taverlyDungeonOverworld: 1759,
Expand All @@ -23,6 +24,7 @@ export const objectIds = {
crate: 357,
skeletonLayingFlat: 5358,
skeletonLayingAgainstWall: 5359,
lumbridgeAxeInLogs: 5581,
tree: {
normal: [
{ default: 1276, stump: 1342 },
Expand Down
2 changes: 2 additions & 0 deletions src/engine/world/config/sound-ids.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ export const soundIds = {
homeTeleportSit: 196,
homeTeleportPullOutBook: 194,
homeTeleportCircleGlowAndTeleport: 195,
teleport: 200,
emptyBucket: 2401,
pinBeep: 1041,
potContentModified: 2584,
fillContainerWithWater: 2609,
sheepBaa: 2053,
Expand Down
42 changes: 42 additions & 0 deletions src/plugins/objects/item-spawns/take-axe.plugin.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import { objectInteractionActionHandler } from '@engine/action';
import { itemIds } from '@engine/world/config';
import { objectIds } from '@engine/world/config/object-ids';
import { logger } from '@runejs/common';

const itemMappings: Record<number, number> = {
[objectIds.lumbridgeAxeInLogs]: itemIds.axes.bronze,
}

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

const name = details.objectConfig.name || '';
if (!name) {
logger.warn(`Object ${details.object.objectId} has no name.`);
}

switch (option) {
case 'take-axe':
player.playAnimation(827);
player.sendMessage(`You take the axe.`);
player.playSound(2581, 7);
player.giveItem(itemMappings[details.object.objectId]);
return;
default:
player.sendMessage(`This has not been implemented.`);
return
}
};

export default {
pluginId: 'rs:take_axe',
hooks: [
{
type: 'object_interaction',
objectIds: [objectIds.lumbridgeAxeInLogs],
options: [ 'take-axe' ],
walkTo: true,
handler: action
}
]
};
Loading

0 comments on commit 7f44935

Please sign in to comment.