We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 0eb9350 + 8a4a8f4 commit df2c5f4Copy full SHA for df2c5f4
plugins/combat/combat.js
@@ -1,13 +1,14 @@
1
-const { NPC_ACTION, DamageType, wait } = require('../rune.js');
+const { NPC_ACTION, DamageType, schedule } = require('../rune.js');
2
3
const action = async details => {
4
const { player, npc } = details;
5
6
npc.updateFlags.addDamage(1, DamageType.DAMAGE, 4, 5);
7
+ npc.say(`Ow!`);
8
- await wait(1000);
9
+ await schedule(4);
10
- player.updateFlags.addDamage(1, DamageType.DAMAGE, 9, 10);
11
+ player.updateFlags.addDamage(1, DamageType.DAMAGE, 4, 5);
12
};
13
14
module.exports = {
plugins/rune.js
@@ -13,8 +13,7 @@ const { InteractingAction, loopingAction, walkToAction } = require('../dist/worl
const { DamageType, Damage, Animation, Graphic, ChatMessage } = require('../dist/world/actor/update-flags');
const { Skill, Skills } = require('../dist/world/actor/skills');
15
const { Achievements, giveAchievement } = require('../dist/world/actor/player/achievements');
16
-const { of } = require('rxjs');
17
-const { delay } = require('rxjs/operators');
+const { wait, schedule } = require('../dist/task/task');
18
19
20
@@ -27,14 +26,13 @@ module.exports = {
27
26
WORLD_ITEM_ACTION: ActionType.WORLD_ITEM_ACTION, OBJECT_ACTION: ActionType.OBJECT_ACTION,
28
ITEM_ON_OBJECT_ACTION: ActionType.ITEM_ON_OBJECT_ACTION, ITEM_ON_NPC_ACTION: ActionType.ITEM_ON_NPC_ACTION,
29
COMMAND_ACTION: ActionType.COMMAND, PLAYER_INIT: ActionType.PLAYER_INIT, NPC_INIT: ActionType.NPC_INIT,
+ PLAYER_ACTION: ActionType.PLAYER_ACTION,
30
QUEST: ActionType.QUEST, RunePlugin,
31
32
world, InteractingAction, loopingAction, walkToAction,
33
34
DamageType, Damage, Animation, Graphic, ChatMessage, Skill, Skills, Achievements, giveAchievement,
35
36
- wait: async (waitLength) => {
37
- await of(null).pipe(delay(waitLength)).toPromise();
38
- }
+ wait, schedule
39
40
src/data-dump.ts
@@ -1,7 +1,7 @@
import { join } from 'path';
import { writeFileSync } from 'fs';
import { cache } from '@server/game-server';
-import { logger } from '@runejs/logger/dist/logger';
+import { logger } from '@runejs/logger';
import { ItemDefinition, NpcDefinition, Widget } from '@runejs/cache-parser';
function dump<T>(fileName: string, definitions: Map<number, T>): boolean {
src/error-handling.ts
@@ -1,4 +1,4 @@
/*
* Error handling! Feel free to add other types of errors or warnings here. :)
src/game-server.ts
@@ -25,6 +25,7 @@ import { setItemOnNpcPlugins } from '@server/world/actor/player/action/item-on-n
25
import { setPlayerInitPlugins } from '@server/world/actor/player/player';
import { setNpcInitPlugins } from '@server/world/actor/npc/npc';
import { setQuestPlugins } from '@server/world/config/quests';
+import { setPlayerPlugins } from '@server/world/actor/player/action/player-action';
export let serverConfig: ServerConfig;
@@ -68,6 +69,7 @@ export async function injectPlugins(): Promise<void> {
68
69
setWidgetPlugins(actionPluginMap[ActionType.WIDGET_ACTION]);
70
setPlayerInitPlugins(actionPluginMap[ActionType.PLAYER_INIT]);
71
setNpcInitPlugins(actionPluginMap[ActionType.NPC_INIT]);
72
+ setPlayerPlugins(actionPluginMap[ActionType.PLAYER_ACTION]);
73
}
74
75
function generateCrcTable(): void {
src/net/data-parser/client-login-parser.ts
@@ -3,7 +3,7 @@ import { Player } from '@server/world/actor/player/player';
import { Isaac } from '@server/net/isaac';
import { serverConfig, world } from '@server/game-server';
import { DataParser } from './data-parser';
import { ByteBuffer } from '@runejs/byte-buffer';
import * as bcrypt from 'bcrypt';
import { loadPlayerSave } from '@server/world/actor/player/player-data';
src/net/incoming-packet-directory.ts
@@ -21,6 +21,7 @@ import { itemInteractionPacket } from '@server/net/incoming-packets/item-interac
21
import { itemOnObjectPacket } from '@server/net/incoming-packets/item-on-object-packet';
22
import { numberInputPacket } from '@server/net/incoming-packets/number-input-packet';
23
import { itemOnNpcPacket } from '@server/net/incoming-packets/item-on-npc-packet';
24
+import { playerInteractionPacket } from '@server/net/incoming-packets/player-interaction-packet';
import { examinePacket } from '@server/net/incoming-packets/examine-packet';
const ignore = [ 234, 160, 216, 13, 58 /* camera move */ ];
@@ -62,6 +63,9 @@ const packets: { [key: number]: incomingPacket } = {
62
63
164: objectInteractionPacket,
64
183: objectInteractionPacket,
65
66
+ 68: playerInteractionPacket,
67
+ 211: playerInteractionPacket,
+
148: examinePacket, // examine item
151: examinePacket, // examine object
247: examinePacket, // examine npc
src/net/incoming-packet-sizes.ts
@@ -5,7 +5,7 @@ export const incomingPacketSizes: number[] = [
6, -3, -3, -3, -3, -3, -3, -3, 8, -3, //30
16, -3, -3, -3, -3, -3, -3, -3, -3, -3, //40
-3, -3, -3, -3, -3, -3, -3, 2, 4, -3, //50
- -3, -3, -3, 2, 4, 6, -3, -3, -3, -3, //60
+ -3, -3, -3, 2, 4, 6, -3, -3, 2, -3, //60
-3, -3, -3, -1, -3, -3, -3, -3, -3, -3, //70
-3, -3, -3, 9, -3, 6, 8, -3, -3, -1, //80
-3, -3, -3, -3, -3, -3, -3, -3, 8, -3, //90
@@ -20,7 +20,7 @@ export const incomingPacketSizes: number[] = [
-3, -3, -3, 6, -3, -3, -3, -3, -3, -3, //180
-3, -3, -3, -3, -3, -3, -3, -3, -3, -3, //190
-3, -3, -3, -3, -3, -3, -3, -3, 10, -3, //200
- -3, -3, -3, -3, -3, -3, 0, -3, -3, -3, //210
+ -3, 2, -3, -3, -3, -3, 0, -3, -3, -3, //210
-3, -3, -3, -3, -3, -3, -3, -3, 8, -3, //220
-3, 13, -3, -3, 4, -3, -1, -3, 4, -3, //230
-3, -3, -3, -3, -3, -1, -3, 2, -1, -3, //240
src/net/incoming-packets/item-on-item-packet.ts
import { incomingPacket } from '../incoming-packet';
import { Player } from '../../world/actor/player/player';
import { widgets } from '@server/world/config/widget';
import { itemOnItemAction } from '@server/world/actor/player/action/item-on-item-action';
src/net/incoming-packets/item-on-npc-packet.ts
import { world } from '@server/game-server';
import { World } from '@server/world/world';
import { itemOnNpcAction } from '@server/world/actor/player/action/item-on-npc-action';
0 commit comments