Skip to content

Commit 722dbbc

Browse files
authored
Merge branch 'develop' into develop
2 parents bae7e81 + 5cfeecc commit 722dbbc

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,4 @@ yarn-error.log*
2222
*.njsproj
2323
*.sln
2424
*.sw?
25+
/.vs
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import { findItem, widgets } from '@engine/config';
2+
import { objectInteractionActionHandler } from '@engine/world/action/object-interaction.action';
3+
import { World } from '@engine/world';
4+
import { itemIds } from '@engine/world/config/item-ids';
5+
import { LandscapeObject } from '@runejs/filestore';
6+
7+
export const action: objectInteractionActionHandler = (details) => {
8+
const veggies = [itemIds.onion, itemIds.grain, itemIds.cabbage];
9+
details.player.busy = true;
10+
details.player.playAnimation(827);
11+
12+
const random = Math.floor(Math.random() * 3);
13+
const pickedItem = findItem(veggies[random]);
14+
15+
details.player.outgoingPackets.sendUpdateAllWidgetItems(widgets.inventory, details.player.inventory);
16+
17+
setTimeout(() => {
18+
details.player.sendMessage(`You found a ${pickedItem.name.toLowerCase()} chest!.`);
19+
details.player.playSound(2581, 7);
20+
details.player.instance.hideGameObjectTemporarily(details.object, 60);
21+
details.player.giveItem(pickedItem.gameId);
22+
details.player.busy = false;
23+
}, World.TICK_LENGTH);
24+
};
25+
26+
export default {
27+
pluginId: 'rs:crates',
28+
hooks: [
29+
{
30+
type: 'object_interaction',
31+
objectIds: [ 366, 357, 355 ],
32+
options: ['loot', 'search', 'examine' ],
33+
walkTo: true,
34+
handler: action
35+
}
36+
]
37+
};

0 commit comments

Comments
 (0)