item list

This commit is contained in:
ntr 2018-12-21 19:21:09 +11:00
parent 114a6d505c
commit b9e74f1d0d
3 changed files with 46 additions and 2 deletions

View File

@ -0,0 +1,45 @@
const Phaser = require('phaser');
const {
TEXT,
// COLOURS,
POSITIONS: { GAME_LIST },
} = require('./constants');
class ItemList extends Phaser.GameObjects.Group {
constructor(args) {
super(args.list);
const { list, ws, itemList } = args;
const X = GAME_LIST.x() + GAME_LIST.x();
const WIDTH = Math.floor(GAME_LIST.width());
const HEIGHT = GAME_LIST.height();
const itemRow = (item, i) => {
const ITEM_X = X;
const ITEM_Y = GAME_LIST.rowY(i);
const itemBox = list.add
.rectangle(ITEM_X, ITEM_Y, WIDTH * 2, HEIGHT, 0x111111)
.setInteractive()
.setOrigin(0);
this.add(list.add.text(ITEM_X, ITEM_Y, item.action, TEXT.HEADER));
itemBox.on('pointerdown', () => {
ws.sendItemUse(item.id);
});
};
itemList.forEach(itemRow);
return true;
}
cleanup() {
return true;
}
}
module.exports = ItemList;

View File

@ -6,7 +6,6 @@
# WORK WORK
broken skills
parry
strangle

View File

@ -799,7 +799,7 @@ pub fn game_pve(params: GamePveParams, tx: &mut Transaction, account: &Account)
.set_team_size(cryps.len());
// create the mob team
let mut mob_team = generate_mob_team(params.mode, &cryps);
let mob_team = generate_mob_team(params.mode, &cryps);
// add the players
let mut plr_team = Team::new(account.id);