From 59990af4d2b9a372c51d8867579534aedf4b488a Mon Sep 17 00:00:00 2001 From: peter Date: Thu, 6 Feb 2020 23:41:50 +0100 Subject: [PATCH] implement loot system feedback --- .../pages/character/character.component.html | 2 +- .../pages/characters/characters.component.ts | 2 +- .../pages/shop/itemselector.component.ts | 3 +- .../frontcraft/pages/shop/shop.component.ts | 94 ------------------- 4 files changed, 3 insertions(+), 98 deletions(-) diff --git a/src/frontend/src/app/frontcraft/pages/character/character.component.html b/src/frontend/src/app/frontcraft/pages/character/character.component.html index 0c011b9..f6828d8 100644 --- a/src/frontend/src/app/frontcraft/pages/character/character.component.html +++ b/src/frontend/src/app/frontcraft/pages/character/character.component.html @@ -5,7 +5,7 @@ status="control">

{{char.charactername}} - +

diff --git a/src/frontend/src/app/frontcraft/pages/characters/characters.component.ts b/src/frontend/src/app/frontcraft/pages/characters/characters.component.ts index ef3e4e9..f0908fe 100644 --- a/src/frontend/src/app/frontcraft/pages/characters/characters.component.ts +++ b/src/frontend/src/app/frontcraft/pages/characters/characters.component.ts @@ -1,4 +1,4 @@ -import { Component, OnInit, AfterViewInit, OnDestroy } from '@angular/core'; +import { Component, AfterViewInit, OnDestroy } from '@angular/core'; import { NbThemeService } from '@nebular/theme'; import { ApiService } from '../../services/login-api'; import { _Class } from '../../../../../../backend/Types/Types'; diff --git a/src/frontend/src/app/frontcraft/pages/shop/itemselector.component.ts b/src/frontend/src/app/frontcraft/pages/shop/itemselector.component.ts index 8cc41ac..b7ec040 100644 --- a/src/frontend/src/app/frontcraft/pages/shop/itemselector.component.ts +++ b/src/frontend/src/app/frontcraft/pages/shop/itemselector.component.ts @@ -18,8 +18,7 @@ export class FrontcraftItemSelectComponent implements OnInit{ constructor( private api: ApiService, - ){ - } + ){} async ngOnInit(){ Promise.all(this.items.map(itemname => diff --git a/src/frontend/src/app/frontcraft/pages/shop/shop.component.ts b/src/frontend/src/app/frontcraft/pages/shop/shop.component.ts index 39f92dd..88ed0f1 100644 --- a/src/frontend/src/app/frontcraft/pages/shop/shop.component.ts +++ b/src/frontend/src/app/frontcraft/pages/shop/shop.component.ts @@ -24,97 +24,3 @@ export class FrontcraftShopComponent{ private dialogService : NbDialogService ){} } - -@Component({ - selector: 'buyToken', - template: ` - - - Buy {{item.itemname}} - - -

- You currently have {{currency}} softreserve currency -

-
-
- - {{kv.key}} (+{{kv.value}} from priorities) -
-
- - {{token.charactername}} [ {{token.level}} ] => [ {{token.level+1}} ] -
-
-
-
- - `, -}) -export class FrontcraftBuyTokenComponent implements OnInit{ - - item : Item - characters: Character[] - modifier = {} - currency: number = 0 - ownedtokens: SRToken[] = [] - - constructor( - private toastr: NbToastrService, - protected dialogRef: NbDialogRef, - private api : ApiService - ){} - - ngOnInit(): void { - const usr = this.api.getCurrentUser() - this.api.get('CharacterManager') - .getCharactersOfUser(usr.username) - .then(chars => { - chars.forEach(char => { - char['color'] = getClassColor(char.class) - this.api.get('ItemManager').getToken(char, this.item).then(token => { - if(token) this.ownedtokens.push(token) - else{ - this.api.get('ItemManager').calculatePriorities(this.item.itemname, char).then(modifier => { - this.modifier[char.charactername] = modifier - }) - } - }) - }) - this.characters = chars - }) - this.api.get('UserManager').getUser(usr.username).then(u => { - if(!u) return - this.currency = u.currency - }) - } - - buyToken = async (charactername:string) => { - - const src = this.api.get('ItemManager') - const token = await src.buyToken(this.api.getAuth().token.value, charactername, this.item.itemname) - - - if(token){ - this.toastr.show(token.characterid+' now has a token for '+token.itemname+' of level '+token.level, 'Yay', {status: 'success'}) - }else{ - this.toastr.show('Error (something went wrong)', 'Oh no', {status: 'danger'}) - } - this.dialogRef.close() - } -} \ No newline at end of file