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
2 changes: 1 addition & 1 deletion src/engine/world/config/object-ids.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ export const objectIds = {
milkableCow: 8689,
fire: 2732,
spinningWheel: 2644,
bankBooth: 2213,
bankBooth: [2213,18491],
depositBox: 9398,
shortCuts: {
stile: 12982,
Expand Down
4 changes: 2 additions & 2 deletions src/engine/world/config/travel-locations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ export class TravelLocations {
}

public find(search: string): TravelLocation | null {
search = search.toLowerCase().trim();
search = search.toLowerCase().trim().replace(/_/g, ' ');
for (const location of this.locations) {
if (location.key.indexOf(search) >= 0) {
if (location.key.toLowerCase() === search) {
return location;
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/commands/bank-command.plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { objectIds } from '@engine/world/config/object-ids';

const action: commandActionHandler = details => {
const interactionActions = getActionHooks<ObjectInteractionActionHook>('object_interaction').filter(plugin =>
advancedNumberHookFilter(plugin.objectIds, objectIds.bankBooth, plugin.options, 'use-quickly'),
advancedNumberHookFilter(plugin.objectIds, objectIds.bankBooth[0], plugin.options, 'use-quickly'),
);
interactionActions.forEach(plugin => {
if (!plugin.handler) {
Expand All @@ -16,7 +16,7 @@ const action: commandActionHandler = details => {
plugin.handler({
player: details.player,
object: {
objectId: objectIds.bankBooth,
objectId: objectIds.bankBooth[0],
level: details.player.position.level,
x: details.player.position.x,
y: details.player.position.y,
Expand Down
117 changes: 80 additions & 37 deletions src/plugins/commands/teleport-command.plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,52 +3,95 @@ import { activeWorld } from '@engine/world';
import { Position } from '@engine/world/position';

const action: commandActionHandler = details => {
const { player, args } = details;
const { player, args } = details;

const x = args.XorPlayerName;
const x = args.XorPlayerName;

if (typeof x === 'string') {
const playerWithName = activeWorld.findPlayer(x);
if (playerWithName) {
player.teleport(playerWithName.position);
return;
}
if (typeof x === 'string') {
const playerWithName = activeWorld.findPlayer(x);
if (playerWithName) {
player.teleport(playerWithName.position);
return;
}
}

const xCoord: number = typeof x === 'string' ? parseInt(x, 10) : x;
const xCoord: number = typeof x === 'string' ? parseInt(x, 10) : x;

if (isNaN(xCoord)) {
return;
}
const y: number = args.y as number;
const level: number = args.level as number;
if (isNaN(xCoord)) {
return;
}
const y: number = args.y as number;
const level: number = args.level as number;

player.teleport(new Position(xCoord, y, level));
};

const goUpAction: commandActionHandler = details => {
const { player } = details;

player.teleport(new Position(xCoord, y, level));
player.teleport(new Position(player.position.x, player.position.y, player.position.level + 1));
};

const goDownAction: commandActionHandler = details => {
const { player } = details;

if (player.position.level > 0) {
player.teleport(new Position(player.position.x, player.position.y, player.position.level - 1));
}
};

const setLevelCommand: commandActionHandler = details => {
const { player, args } = details;
const level: number = args.level as number;
if (!isNaN(level) && level >= 0 && level <= 255) {
player.teleport(new Position(player.position.x, player.position.y, level));
}
}

export default {
pluginId: 'rs:teleport_command_plugin',
hooks: [
pluginId: 'rs:teleport_command_plugin',
hooks: [
{
type: 'player_command',
commands: [ 'move', 'goto', 'teleport', 'tele', 'moveto', 'setpos' ],
args: [
{
type: 'player_command',
commands: ['move', 'goto', 'teleport', 'tele', 'moveto', 'setpos'],
args: [
{
name: 'XorPlayerName',
type: 'string',
},
{
name: 'y',
type: 'number',
defaultValue: 3222,
},
{
name: 'level',
type: 'number',
defaultValue: 0,
},
],
handler: action,
name: 'XorPlayerName',
type: 'string',
},
],
{
name: 'y',
type: 'number',
defaultValue: 3222,
},
{
name: 'level',
type: 'number',
defaultValue: 0,
},
],
handler: action,
},
{
type: 'player_command',
commands: [ 'up', 'goup' ],
handler: goUpAction,
},
{
type: 'player_command',
commands: [ 'down', 'godown' ],
handler: goDownAction,
},
{
type: 'player_command',
commands: [ 'setheightlevel', 'heightlevel', 'hl' ],
args: [
{
name: 'level',
type: 'number',
},
],
handler: setLevelCommand,
}
],
};
4 changes: 2 additions & 2 deletions src/plugins/items/rotten-potato/hooks/rotten-potato-peel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { openTravel } from '@plugins/items/rotten-potato/helpers/rotten-potato-t

function openBank(player: Player) {
const interactionActions = getActionHooks<ObjectInteractionActionHook>('object_interaction').filter(plugin =>
advancedNumberHookFilter(plugin.objectIds, objectIds.bankBooth, plugin.options, 'use-quickly'),
advancedNumberHookFilter(plugin.objectIds, objectIds.bankBooth[0], plugin.options, 'use-quickly'),
);
interactionActions.forEach(plugin => {
if (!plugin.handler) {
Expand All @@ -19,7 +19,7 @@ function openBank(player: Player) {
plugin.handler({
player: player,
object: {
objectId: objectIds.bankBooth,
objectId: objectIds.bankBooth[0],
level: player.position.level,
x: player.position.x,
y: player.position.y,
Expand Down
5 changes: 3 additions & 2 deletions src/plugins/npcs/lumbridge/hans.plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,9 @@ const handler = async ({ player, npc }) => {

if (dialogueSuccessful) {
if (sadEnding) {
npc.playAnimation(animationIds.cry);
npc.say(`Jerk!`);
// @todo These appear to be broken, debug
// npc.playAnimation(animationIds.cry);
// npc.say(`Jerk!`);
player.sendMessage(`Hans wanders off rather dejectedly.`);
} else {
player.sendMessage(`Hans wanders off aimlessly through the courtyard.`);
Expand Down
Loading