-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add byte to npc update packet that includes the worldIndex of the npc…
…; add basic attack plugin; other minor improvements to npc's
- Loading branch information
1 parent
5f56f98
commit 123176e
Showing
8 changed files
with
225 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { npcInteractionActionHandler } from '@engine/action'; | ||
import { DamageType } from '@engine/world/actor'; | ||
|
||
/** | ||
* This is a placeholder for attacking/initiating combat with any NPC. | ||
* | ||
* It is meant to demonstrate basic NPC interactions and to validate that | ||
* client-side NPC tracking works, specifically for chat messages and HP bars. | ||
* | ||
* It is also meant to help new users be less confused when they see that | ||
* combat isn't implemented yet. See GitHub issue #429. | ||
*/ | ||
export const action: npcInteractionActionHandler = (details) => { | ||
const { player, option } = details; | ||
|
||
switch (option) { | ||
case 'attack': | ||
break; | ||
default: | ||
player.sendMessage(`This has not been implemented.`); | ||
return; | ||
} | ||
|
||
details.npc.say(`Hi there! Combat is not implemented yet. My worldIndex is: ${details.npc.worldIndex}`); | ||
details.npc.updateFlags.addDamage(0, DamageType.NO_DAMAGE, 1, 1); | ||
}; | ||
|
||
export default { | ||
pluginId: 'rs:attack', | ||
hooks: [ | ||
{ | ||
type: 'npc_interaction', | ||
objectIds: [], | ||
options: [ 'attack' ], | ||
walkTo: false, | ||
handler: action | ||
}, | ||
] | ||
}; |