-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #430 from charles-m-knox/take-axe
Take-axe plugin; various small improvements
- Loading branch information
Showing
10 changed files
with
207 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"rs:ardougne_baker": { | ||
"game_id": 571 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} | ||
] | ||
}; |
Oops, something went wrong.