Skip to content

Commit f426256

Browse files
committed
Refactored to naming convention,
Converted console.log to using logger
1 parent 9eb45e8 commit f426256

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

src/game-engine/net/inbound-packets/magic-attack-packet.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const magicAttackPacket = (player: Player, packet: PacketData) => {
1212
const widgetChildId = buffer.get(); // unsigned short LE
1313

1414
const npc = world.npcList[npcWorldIndex];
15-
//console.log(`actual spell being cast is ${widgetChildId}`);
15+
1616
player.actionPipeline.call('magic_on_npc', npc, player, widgetId, widgetChildId);
1717
};
1818

src/game-engine/world/action/magic-on-npc.action.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { Npc } from '../actor/npc/npc';
88
/**
99
* Defines a button action hook.
1010
*/
11-
export interface Magic_on_NPCActionHook extends ActionHook<Magic_on_NPCAction, magic_on_npcActionHandler> {
11+
export interface Magic_On_NPCActionHook extends ActionHook<Magic_On_NPCAction, magic_on_npcActionHandler> {
1212
// The npc world id that was clicked on after choosing the spell
1313
npcworldId?: number;
1414
// The IDs of the UI widgets that the buttons are on.
@@ -23,13 +23,13 @@ export interface Magic_on_NPCActionHook extends ActionHook<Magic_on_NPCAction, m
2323
/**
2424
* The button action hook handler function to be called when the hook's conditions are met.
2525
*/
26-
export type magic_on_npcActionHandler = (buttonAction: Magic_on_NPCAction) => void | Promise<void>;
26+
export type magic_on_npcActionHandler = (buttonAction: Magic_On_NPCAction) => void | Promise<void>;
2727

2828

2929
/**
3030
* Details about a button action being performed.
3131
*/
32-
export interface Magic_on_NPCAction {
32+
export interface Magic_On_NPCAction {
3333
// The npc world id that was clicked on after choosing the spell
3434
npc: Npc,
3535
// The player performing the action.
@@ -52,7 +52,7 @@ const buttonActionPipe = (npc:Npc, player: Player, widgetId: number, buttonId: n
5252
//console.info(`pew pew you use magic on ${npc.name}!`);
5353

5454
// Find all object action plugins that reference this location object
55-
let matchingHooks = getActionHooks<Magic_on_NPCActionHook>('magic_on_npc');
55+
let matchingHooks = getActionHooks<Magic_On_NPCActionHook>('magic_on_npc');
5656

5757

5858
return {

src/plugins/buttons/magic-attack.plugin.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,20 @@ import { gfxIds } from '@engine/world/config/gfx-ids';
77
import { loopingEvent } from '@engine/game-server';
88
import { TaskExecutor } from '@engine/world/action';
99
import { widgetButtonIds } from '../skills/smithing/smelting-constants';
10-
import { magic_on_npcActionHandler, Magic_on_NPCActionHook, Magic_on_NPCAction } from '../../game-engine/world/action/magic-on-npc.action';
10+
import { magic_on_npcActionHandler, Magic_On_NPCActionHook, Magic_On_NPCAction } from '../../game-engine/world/action/magic-on-npc.action';
11+
import { logger } from '@runejs/core';
1112

1213
const buttonIds: number[] = [
1314
0, // Home Teleport
1415
];
1516

1617
function attack_target(player: Player, elapsedTicks: number): boolean {
17-
console.log("attacking?");
18+
logger.info("attacking?");
1819
return true;
1920
}
2021

2122
const spells = ["Wind Strike","Confuse", "Water Strike","unknown?", "Earth Strike"];
22-
export const activate = (task: TaskExecutor<Magic_on_NPCAction>, elapsedTicks: number = 0) => {
23+
export const activate = (task: TaskExecutor<Magic_On_NPCAction>, elapsedTicks: number = 0) => {
2324
const {
2425
npc,
2526
player,
@@ -41,6 +42,6 @@ export default {
4142
activate,
4243
interval: 0
4344
}
44-
} as Magic_on_NPCActionHook
45+
} as Magic_On_NPCActionHook
4546

4647
};

0 commit comments

Comments
 (0)