Skip to content
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
40 changes: 24 additions & 16 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

39 changes: 39 additions & 0 deletions src/plugins/objects/bank/bank-booth-plugin.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import { ActionType, RunePlugin } from '@server/plugins/plugin';
import { objectIds } from '@server/world/config/object-ids';
import { widgets } from '@server/world/config/widget';
import { objectAction } from '@server/world/actor/player/action/object-action';


export const openBankInterface: objectAction = (details) => {
details.player.activeWidget = {
widgetId: widgets.bank.screenWidget,
secondaryWidgetId: widgets.bank.tabWidget.widgetId,
type: 'SCREEN_AND_TAB',
closeOnWalk: true
};
details.player.outgoingPackets.sendUpdateAllWidgetItems(widgets.bank.tabWidget, details.player.inventory);

};

export const depositItem: objectAction = (details) => {
// Check if player might be spawning widget clientside
if (!details.player.activeWidget ||
!(details.player.activeWidget.widgetId === widgets.bank.screenWidget) ||
!(details.player.activeWidget.secondaryWidgetId === widgets.bank.tabWidget.widgetId)) {
return;
}

};

export default new RunePlugin([{
type: ActionType.OBJECT_ACTION,
objectIds: objectIds.bankBooth,
options: ['use-quickly'],
walkTo: true,
action: openBankInterface
}, {
type: ActionType.ITEM_ACTION,
widgets: widgets.bank.tabWidget,
options: ['deposit-1', 'deposit-5', 'deposit-10'],
action: depositItem,
}]);
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import { objectAction } from '@server/world/actor/player/action/object-action';
import { ActionType, RunePlugin } from '@server/plugins/plugin';
import { objectIds } from '@server/world/config/object-ids';
import { World } from '@server/world/world';
import { animationIds } from '@server/world/config/animation-ids';

export const enterDungeon: objectAction = (details) => {
const loc = details.player.position.clone();
loc.y += 6400;
details.player.playAnimation(animationIds.climbLadder);
setTimeout(() => {
details.player.teleport(loc);
}, World.TICK_LENGTH);
};


export const exitDungeon: objectAction = (details) => {
const loc = details.player.position.clone();
loc.y -= 6400;
details.player.playAnimation(animationIds.climbLadder);
setTimeout(() => {
details.player.teleport(loc);
}, World.TICK_LENGTH);
};


export default new RunePlugin([
{
type: ActionType.OBJECT_ACTION,
objectIds: objectIds.ladders.taverlyDungeonOverworld,
options: ['climb-down'],
walkTo: true,
action: enterDungeon
},
{
type: ActionType.OBJECT_ACTION,
objectIds: objectIds.ladders.taverlyDungeonUnderground,
options: ['climb-up'],
walkTo: true,
action: exitDungeon
}
]);
1 change: 1 addition & 0 deletions src/world/config/animation-ids.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ export const animationIds = {
shearSheep: 893,
spinSpinningWheel: 894,
cry: 860,
climbLadder: 828
};
10 changes: 9 additions & 1 deletion src/world/config/object-ids.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
export const objectIds = {
milkableCow: 8689,
fire: 2732,
spinningWheel: 2644
spinningWheel: 2644,
bankBooth: 2213,
shortCuts: {
stile: 12982
},
ladders: {
taverlyDungeonOverworld: 1759,
taverlyDungeonUnderground: 1755,
}
};
7 changes: 7 additions & 0 deletions src/world/config/widget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ export const widgets: any = {
widgetId: 336,
containerId: 0
},
bank: {
screenWidget: 12,
tabWidget: {
widgetId: 266,
containerId: 0
}
},
skillGuide: 308,
skillsTab: 320,
logoutTab: 182,
Expand Down
4 changes: 4 additions & 0 deletions src/world/position.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ export class Position {
this.move(x, y, level);
}

public clone(): Position {
return new Position(this.x, this.y, this.level);
}

public withinInteractionDistance(locationObject: LocationObject): boolean {
const definition = cache.locationObjectDefinitions.get(locationObject.objectId);
const occupantX = locationObject.x;
Expand Down