frontend work

This commit is contained in:
peter
2020-02-09 20:22:48 +01:00
parent 8189dadfbf
commit fa165167d9
5 changed files with 73 additions and 7 deletions
+1
View File
@@ -104,6 +104,7 @@ export const T2:string[] = [
"Chromatic Boots", "Chromatic Boots",
"Taut Dragonhide Gloves", "Taut Dragonhide Gloves",
"Shimmering Geta", "Shimmering Geta",
"Ring of Blackrock",
"Elementium Threaded Cloak", "Elementium Threaded Cloak",
"Angelista's Grasp", "Angelista's Grasp",
"Girdle of the Fallen Crusader", "Girdle of the Fallen Crusader",
@@ -22,10 +22,29 @@ status="control">
<span *ngIf="link === 'owner'"> <span *ngIf="link === 'owner'">
Owned by <a [routerLink]="'/frontcraft/user/'+char.username"> {{char.username}} ({{char.rank}})</a> Owned by <a [routerLink]="'/frontcraft/user/'+char.username"> {{char.username}} ({{char.rank}})</a>
</span> </span>
<br/><br /> <br/>
<br />
<br />
<h3>Tokens</h3>
<span *ngFor="let token of tokens"> <span *ngFor="let token of tokens">
[ {{token.level}} ] [ {{token.level}} ]
<wowhead [item]="token"></wowhead> <wowhead [item]="token"></wowhead><br />
</span> </span>
<br />
<br />
<br />
<h3>Gear of the last two reported kills <a target="_blank" *ngIf="dataLink != null && dataLink != ''" style="size: 0.5em;" [href]="dataLink">(data)</a></h3>
<h5>{{boss1.name}} {{boss1.date | date : 'MMM d @ HH : mm'}}</h5>
<ng-container *ngFor="let item of gear1">
<wowhead [item]="item"></wowhead><br />
</ng-container>
<h5>{{boss2.name}} {{boss2.date | date : 'MMM d @ HH : mm'}}</h5>
<ng-container *ngFor="let item of gear2">
<wowhead [item]="item"></wowhead><br />
</ng-container>
</nb-card-body> </nb-card-body>
</nb-card> </nb-card>
@@ -1,7 +1,7 @@
import { Component, OnInit, Input } from '@angular/core'; import { Component, OnInit, Input } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router'; import { ActivatedRoute, Router } from '@angular/router';
import { ApiService as ApiService } from '../../services/login-api'; import { ApiService as ApiService } from '../../services/login-api';
import { Spec, User, Character } from '../../../../../../backend/Types/Types'; import { Spec, User, Character, Item } from '../../../../../../backend/Types/Types';
import { getClassColor } from '../../../../../../backend/Types/PlayerSpecs'; import { getClassColor } from '../../../../../../backend/Types/PlayerSpecs';
import { _Tiers } from '../../../../../../backend/Types/Items'; import { _Tiers } from '../../../../../../backend/Types/Items';
@@ -20,6 +20,12 @@ export class FrontcraftCharacterComponent implements OnInit{
} as any } as any
color : string color : string
tokens tokens
dataLink = ""
boss1 = {}
gear1:string[] = []
boss2= {}
gear2:string[] = []
constructor( constructor(
private api: ApiService, private api: ApiService,
@@ -39,6 +45,41 @@ export class FrontcraftCharacterComponent implements OnInit{
this.api.get('ItemManager').getTokens(this.char, _Tiers, true).then(tokens => { this.api.get('ItemManager').getTokens(this.char, _Tiers, true).then(tokens => {
this.tokens = tokens this.tokens = tokens
}) })
this.dataLink = 'https://classic.warcraftlogs.com/v1/rankings/character/'+this.char.charactername.replace(/^\w/, c => c.toUpperCase())+'/Gandling/EU?metric=dps&api_key=c698515ab4f592cdb848d80b3abe616c'
fetch(this.dataLink).then(raw => raw.json().then((json) => {
if(json.length-1 < 0) return
const data = json[json.length-1]
this.boss2 = {
name: data.encounterName,
date: data.startTime
}
this.gear1 = data.gear.map(item => {return <Item>{
itemname: item.name,
iconname: item.icon.replace('.jpg', ''),
quality: item.quality.replace(/^\w/, c => c.toUpperCase()),
url: "https://classic.wowhead.com/item="+item.id
}})
}))
fetch(this.dataLink).then(raw => raw.json().then((json) => {
if(json.length-2 < 0) return
const data = json[json.length-2]
this.boss1 = {
name: data.encounterName,
date: data.startTime
}
this.gear2 = data.gear.map(item => {return <Item>{
itemname: item.name,
iconname: item.icon.replace('.jpg', ''),
quality: item.quality.replace(/^\w/, c => c.toUpperCase()),
url: "https://classic.wowhead.com/item="+item.id
}})
}))
} }
}) })
} }
@@ -147,12 +147,12 @@ export class FrontcraftRaidComponent implements OnInit, OnDestroy{
this.toast.show('Signup', 'Success', { status: 'success' }) this.toast.show('Signup', 'Success', { status: 'success' })
} }
adminUnsign = async() => { adminUnsign = async(character:Character) => {
const manage = this.api.get('manageRaid') const manage = this.api.get('manageRaid')
if(!manage) return if(!manage) return
await manage.adminUnsign({ await manage.adminUnsign({
...this.mySignup, ...character,
id: this.mySignup.characterid, id: character['characterid']
}, this.raid) }, this.raid)
} }
@@ -9,7 +9,12 @@ import { _Tiers, allItems, Tiers } from '../../../../../../backend/Types/Items';
@Component({ @Component({
selector: 'item', selector: 'item',
template: ` template: `
<span [ngStyle]="{'color':item.quality=='Epic'?'#a335ee':'#ff8000'}"> <span [ngStyle]="{'color':item.quality=='Poor'?'#9d9d9d':
item.quality=='Common'?'#FFFFFF':
item.quality=='Uncommon'?'#1eff00':
item.quality=='Rare'?'#0070dd':
item.quality=='Epic'?'#a335ee':
'#ff8000'}">
<img style="min-width: 20px; width: 2.25vw; max-width: 35px" <img style="min-width: 20px; width: 2.25vw; max-width: 35px"
[src]="'https://wow.zamimg.com/images/wow/icons/large/'+item.iconname+'.jpg'" /> [src]="'https://wow.zamimg.com/images/wow/icons/large/'+item.iconname+'.jpg'" />
&nbsp; &nbsp;