Skip to content

Commit

Permalink
fix a bug with initial equipment, and add a tiara example plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
Promises committed Oct 12, 2020
1 parent 4f2e239 commit 4c40e97
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 0 deletions.
23 changes: 23 additions & 0 deletions data/config/item-data.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -591,6 +591,29 @@
alchemy:
high: 12
low: 8
- id: 5527
desc: air tiara
canTrade: true
weight: 1
alchemy:
high: 60
low: 30
equipment:
slot: HEAD
helmetType: HAT
bonuses:
offencive:
stab: 0
slash: 0
crush: 0
magic: 0
ranged: 0
defencive:
stab: 0
slash: 0
crush: 0
magic: 0
ranged: 0
- id: 6623
desc: white full helm
canTrade: true
Expand Down
23 changes: 23 additions & 0 deletions src/plugins/items/runecrafting/tiara.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { ActionType, RunePlugin } from '@server/plugins/plugin';
import { equipAction } from '@server/world/actor/player/action/equip-action';

export const equip: equipAction = (details) => {
const {player} = details;
player.outgoingPackets.updateClientConfig(491, 1);
};
export const unequip: equipAction = (details) => {
const {player} = details;
player.outgoingPackets.updateClientConfig(491, 0);
};

export default new RunePlugin([{
type: ActionType.EQUIP_ACTION,
equipType: 'EQUIP',
action: equip,
itemIds: 5527
}, {
type: ActionType.EQUIP_ACTION,
equipType: 'UNEQUIP',
action: unequip,
itemIds: 5527
}]);
5 changes: 5 additions & 0 deletions src/world/actor/player/player.ts
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,11 @@ export class Player extends Actor {

this.outgoingPackets.sendUpdateAllWidgetItems(widgets.inventory, this.inventory);
this.outgoingPackets.sendUpdateAllWidgetItems(widgets.equipment, this.equipment);
for (const item of this.equipment.items) {
if(item) {
equipAction(this, item.itemId, 'EQUIP');
}
}

if (this.firstTimePlayer) {
this.activeWidget = {
Expand Down

0 comments on commit 4c40e97

Please sign in to comment.