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
6 changes: 5 additions & 1 deletion data/config/npc-spawns.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,8 @@
- npcId: 540
x: 3288
y: 3212
radius: 1
radius: 1
- npcId: 3807
x: 3253
y: 3274
radius: 1
21 changes: 10 additions & 11 deletions src/plugins/buttons/player-setting-button-plugin.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
import { buttonAction } from '@server/world/actor/player/action/button-action';
import { ActionType, RunePlugin } from '@server/plugins/plugin';

// @TODO fix me!
const buttonIds: number[] = [
17104896, // walk/run
930, 931, 932, 933, 934, // music volume
941, 942, 943, 944, 945, // sound effect volume
957, 958, // split private chat
913, 914, // mouse buttons
906, 908, 910, 912, // screen brightness
915, 916, // chat effects
12464, 12465, // accept aid
150, 151, // auto retaliate
0, // walk/run
11, 12, 13, 14, 15, // music volume
16, 17, 18, 19, 20, // sound effect volume
2, // split private chat
3, // mouse buttons
7, 8, 9, 10, // screen brightness
1, // chat effects
4, // accept aid
5, // house options
];

export const action: buttonAction = (details) => {
const { player, buttonId } = details;
player.settingChanged(buttonId);
};

export default new RunePlugin({ type: ActionType.BUTTON, widgetId: 0, buttonIds, action });
export default new RunePlugin({ type: ActionType.BUTTON, widgetId: 261, buttonIds: buttonIds, action });
47 changes: 41 additions & 6 deletions src/plugins/objects/cows/cow-plugin.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,56 @@
import { objectAction } from '@server/world/actor/player/action/object-action';
import { gameCache } from "@server/game-server";
import { gameCache } from '@server/game-server';
import { ActionType, RunePlugin } from '@server/plugins/plugin';
import { dialogueAction, DialogueEmote } from '@server/world/actor/player/action/dialogue-action';
import { Npc } from '@server/world/actor/npc/npc';


export const action: objectAction = (details) => {
const { player, option, objectDefinition, object } = details;
const {player, option, objectDefinition, object} = details;
const emptyBucketItem = gameCache.itemDefinitions.get(1925);
const milkBucketItem = gameCache.itemDefinitions.get(1927);

if(player.hasItemInInventory(emptyBucketItem.id)) {
if (player.hasItemInInventory(emptyBucketItem.id)) {
player.playAnimation(2305);
player.outgoingPackets.playSound(372, 7);
player.removeFirstItem(emptyBucketItem.id);
player.giveItem(milkBucketItem.id);
player.outgoingPackets.chatboxMessage(`You ${ option } the ${ objectDefinition.name } and receive some milk.`);
player.outgoingPackets.chatboxMessage(`You ${option} the ${objectDefinition.name} and receive some milk.`);
} else {
player.outgoingPackets.chatboxMessage(`You need a ${ emptyBucketItem.name } to ${ option } this ${ objectDefinition.name }!`);
let foundNpc: Npc = null;
for (const chunk of player.nearbyChunks) {
for (const npc of chunk.npcs) {
if (npc.id === 3807) {
foundNpc = npc;
break;
}
}
if (foundNpc != null) {
break;
}
}

if (!foundNpc) {
player.outgoingPackets.chatboxMessage(`You need a ${ emptyBucketItem.name } to ${ option } this ${ objectDefinition.name }!`);
return;
}
dialogueAction(player)
.then(d => d.npc(foundNpc, DialogueEmote.LAUGH_1, ['Tee hee! You\'ve never milked a cow before, have you?']))
.then(d => d.player(DialogueEmote.CALM_TALK_1, ['Erm... No. How could you tell?']))
.then(d => d.npc(foundNpc, DialogueEmote.LAUGH_2, ['Because you\'re spilling milk all over the floor. What a', 'waste! You need something to hold the milk.']))
.then(d => d.player(DialogueEmote.CONSIDERING, ['Ah yes, I really should have guessed that one, should\'nt', 'I?']))
.then(d => d.npc(foundNpc, DialogueEmote.LAUGH_2, ['You\'re from the city aren\'t you... Try it again with an', `${emptyBucketItem.name.toLowerCase()}.`]))
.then(d => d.player(DialogueEmote.CALM_TALK_2, ['Right, I\'ll do that.']))
.then(d => {
d.close();
});
}
};

export default new RunePlugin({ type: ActionType.OBJECT_ACTION, objectIds: [8689], options: ['milk'], walkTo: true, action });
export default new RunePlugin({
type: ActionType.OBJECT_ACTION,
objectIds: [8689],
options: ['milk'],
walkTo: true,
action
});
7 changes: 6 additions & 1 deletion src/plugins/objects/doors/door-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ const doors = [
closed: 1536,
open: 1537,
hinge: 'LEFT'
},
{
closed: 11993,
open: 11994,
hinge: 'RIGHT'
}
];

Expand Down Expand Up @@ -88,4 +93,4 @@ export const action: objectAction = (details): void => {
};

export default new RunePlugin({ type: ActionType.OBJECT_ACTION, objectIds: [1530, 4465, 4467, 3014, 3017, 3018,
3019, 1536, 1537, 1533, 1531, 1534, 12348], options: [ 'open', 'close' ], walkTo: true, action });
3019, 1536, 1537, 1533, 1531, 1534, 12348, 11993, 11994], options: [ 'open', 'close' ], walkTo: true, action });
4 changes: 2 additions & 2 deletions src/plugins/objects/doors/gate-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const action: objectAction = (details) => {

world.chunkManager.toggleObjects(metadata.originalMain, metadata.main, metadata.originalMainPosition, metadata.mainPosition, metadata.originalMainChunk, metadata.mainChunk, true);
world.chunkManager.toggleObjects(metadata.originalSecond, metadata.second, metadata.originalSecondPosition, metadata.secondPosition, metadata.originalSecondChunk, metadata.secondChunk, true);
player.outgoingPackets.playSound(60, 7); // @TODO find correct gate closing sound
player.outgoingPackets.playSound(66, 7); // @TODO find correct gate closing sound
} else {
let details = gates.find(g => g.main === gate.objectId);
let clickedSecondary = false;
Expand Down Expand Up @@ -205,7 +205,7 @@ const action: objectAction = (details) => {

world.chunkManager.toggleObjects(newHinge, gate, newPosition, position, newHingeChunk, hingeChunk, !cacheOriginal);
world.chunkManager.toggleObjects(newSecond, secondGate, newSecondPosition, gateSecondPosition, newSecondChunk, gateSecondChunk, !cacheOriginal);
player.outgoingPackets.playSound(62, 7); // @TODO find correct gate opening sound
player.outgoingPackets.playSound(67, 7); // @TODO find correct gate opening sound
}
};

Expand Down
49 changes: 24 additions & 25 deletions src/world/actor/player/player.ts
Original file line number Diff line number Diff line change
Expand Up @@ -395,32 +395,31 @@ export class Player extends Actor {
}

public settingChanged(buttonId: number): void {
logger.info(`${buttonId}`);
const settingsMappings = {
17104896: {setting: 'runEnabled', value: !this.settings['runEnabled']},
930: {setting: 'musicVolume', value: 4},
931: {setting: 'musicVolume', value: 3},
932: {setting: 'musicVolume', value: 2},
933: {setting: 'musicVolume', value: 1},
934: {setting: 'musicVolume', value: 0},
941: {setting: 'soundEffectVolume', value: 4},
942: {setting: 'soundEffectVolume', value: 3},
943: {setting: 'soundEffectVolume', value: 2},
944: {setting: 'soundEffectVolume', value: 1},
945: {setting: 'soundEffectVolume', value: 0},
957: {setting: 'splitPrivateChatEnabled', value: true},
958: {setting: 'splitPrivateChatEnabled', value: false},
913: {setting: 'twoMouseButtonsEnabled', value: true},
914: {setting: 'twoMouseButtonsEnabled', value: false},
906: {setting: 'screenBrightness', value: 1},
908: {setting: 'screenBrightness', value: 2},
910: {setting: 'screenBrightness', value: 3},
912: {setting: 'screenBrightness', value: 4},
915: {setting: 'chatEffectsEnabled', value: true},
916: {setting: 'chatEffectsEnabled', value: false},
12464: {setting: 'acceptAidEnabled', value: true},
12465: {setting: 'acceptAidEnabled', value: false},
150: {setting: 'autoRetaliateEnabled', value: true},
151: {setting: 'autoRetaliateEnabled', value: false}
0: {setting: 'runEnabled', value: !this.settings['runEnabled']},
1: {setting: 'chatEffectsEnabled', value: !this.settings['chatEffectsEnabled']},
2: {setting: 'splitPrivateChatEnabled', value: !this.settings['splitPrivateChatEnabled']},
3: {setting: 'twoMouseButtonsEnabled', value: !this.settings['twoMouseButtonsEnabled']},
4: {setting: 'acceptAidEnabled', value: !this.settings['acceptAidEnabled']},
// 5 is house options
// 6 is unknown, might not even exist
7: {setting: 'screenBrightness', value: 1},
8: {setting: 'screenBrightness', value: 2},
9: {setting: 'screenBrightness', value: 3},
10: {setting: 'screenBrightness', value: 4},
11: {setting: 'musicVolume', value: 0},
12: {setting: 'musicVolume', value: 1},
13: {setting: 'musicVolume', value: 2},
14: {setting: 'musicVolume', value: 3},
15: {setting: 'musicVolume', value: 4},
16: {setting: 'soundEffectVolume', value: 0},
17: {setting: 'soundEffectVolume', value: 1},
18: {setting: 'soundEffectVolume', value: 2},
19: {setting: 'soundEffectVolume', value: 3},
20: {setting: 'soundEffectVolume', value: 4},
// 150: {setting: 'autoRetaliateEnabled', value: true},
// 151: {setting: 'autoRetaliateEnabled', value: false}
};

if(!settingsMappings.hasOwnProperty(buttonId)) {
Expand Down