1 import { Api } from './api';
2 import { playerOverview } from './sections/overview';
3 import $ from 'jquery';
4 import {$exploreButton, $fightButton, disablePickItemButton} from './dom';
6 const api = new Api('http://localhost:9090');
8 api.on('player', playerOverview);
10 async function main() {
12 await api.login('xangelo', 'test');
15 await api.signup('xangelo', 'test', 'test');
16 await api.login('xangelo', 'test');
20 $exploreButton().on('click', async e => {
27 $fightButton().on('click', async e => {
31 const fightId = $(e.target).attr('data-fight-id');
33 if(!fightId || fightId === 'unset') {
37 await api.fight(fightId);
41 $('.stat-increase').on('click', e => {
45 const stat = $(e.target).attr('data-stat');
48 throw new Error('Invalid stat increase');
51 api.increaseStat(stat);
54 $('#take-world-drop').on('click', e => {
59 const id = $(e.target).attr('data-drop-id');
60 if(id === 'unset' || id === undefined) {
64 // lets pick this item up!
65 api.pickItem(id.toString());