This commit is contained in:
peter
2020-02-07 18:18:57 +01:00
parent e3eb1f123c
commit 6930e2245f
4 changed files with 16 additions and 9 deletions
+1
View File
@@ -35,6 +35,7 @@ export type TableDefiniton = {
} }
export type Race = "Human" | "Gnome" | "Night Elf" | "Dwarf" export type Race = "Human" | "Gnome" | "Night Elf" | "Dwarf"
export const _Race: Race[] =["Human", "Gnome", "Night Elf", "Dwarf"]
export type Rank = "ADMIN" | "Guildmaster" | "Officer" | "Classleader" | "Raider" | "Trial" | "Social" | "Guest" export type Rank = "ADMIN" | "Guildmaster" | "Officer" | "Classleader" | "Raider" | "Trial" | "Social" | "Guest"
export const _Rank : Rank[] = ["ADMIN" , "Guildmaster" , "Officer" , "Classleader" , "Raider" , "Trial" , "Social" , "Guest"] export const _Rank : Rank[] = ["ADMIN" , "Guildmaster" , "Officer" , "Classleader" , "Raider" , "Trial" , "Social" , "Guest"]
export type Class = "Warrior" | "Rogue" | "Hunter" | "Mage" | "Warlock" | "Priest" | "Shaman" | "Paladin" | "Druid" export type Class = "Warrior" | "Rogue" | "Hunter" | "Mage" | "Warlock" | "Priest" | "Shaman" | "Paladin" | "Druid"
@@ -41,11 +41,14 @@
<nb-card> <nb-card>
<nb-card-body> <nb-card-body>
<nb-checkbox [(ngModel)]="showApplication" name="amMember" #checkbox>I am already a member</nb-checkbox> <nb-checkbox [(ngModel)]="showApplication" name="amMember" #checkbox><!--I am already a member-->I understand this is super beta and things might not work or are not very pretty</nb-checkbox>
<br /> <br />
<span *ngIf="showApplication"> <span > <!--*ngIf="showApplication"-->
And my main is &nbsp; <input name="preMember" [(ngModel)]="character.name" nbInput>, a And my main is &nbsp; <input name="preMember" [(ngModel)]="character.name" nbInput>, a
<nb-select [(selected)]="character.race" placeholder="Race" (selectedChange)="onSelectRace()">
<nb-option *ngFor="let race of races" [value]="race">{{race}}</nb-option>
</nb-select>
<nb-select [(selected)]="character.spec" placeholder="Spec" (selectedChange)="onSelectSpec()"> <nb-select [(selected)]="character.spec" placeholder="Spec" (selectedChange)="onSelectSpec()">
<nb-option *ngFor="let spec of specs" [value]="spec">{{spec}}</nb-option> <nb-option *ngFor="let spec of specs" [value]="spec">{{spec}}</nb-option>
</nb-select> </nb-select>
@@ -57,7 +60,7 @@
<nb-option *ngFor="let rank of ranks" [value]="rank" >{{rank}}</nb-option> <nb-option *ngFor="let rank of ranks" [value]="rank" >{{rank}}</nb-option>
</nb-select> </nb-select>
</span> </span>
<!--
<span *ngIf="!showApplication">Hello my name is &nbsp; <input name="charName" [(ngModel)]="character.name" nbInput> <span *ngIf="!showApplication">Hello my name is &nbsp; <input name="charName" [(ngModel)]="character.name" nbInput>
I am playing a level 60 I am playing a level 60
<nb-select [(selected)]="character.spec" placeholder="Spec" (selectedChange)="onSelectSpec()"> <nb-select [(selected)]="character.spec" placeholder="Spec" (selectedChange)="onSelectSpec()">
@@ -68,9 +71,8 @@
</nb-select> </nb-select>
and I would like to join Tranquil because and I would like to join Tranquil because
<textarea nbInput fullWidth placeholder="reason" style="min-height: 400px"></textarea> <textarea nbInput fullWidth placeholder="reason" style="min-height: 400px"></textarea>
</span> </span>
-->
</nb-card-body> </nb-card-body>
</nb-card> </nb-card>
@@ -1,7 +1,7 @@
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { ApiService as ApiService, hash } from '../../services/login-api'; import { ApiService as ApiService, hash } from '../../services/login-api';
import { Router } from '@angular/router'; import { Router } from '@angular/router';
import { _Rank, _Class, Class, User } from '../../../../../../backend/Types/Types' import { _Rank, _Class, Class, User, _Race } from '../../../../../../backend/Types/Types'
import { specs } from '../../../../../../backend/Types/PlayerSpecs' import { specs } from '../../../../../../backend/Types/PlayerSpecs'
import { race } from 'rxjs'; import { race } from 'rxjs';
@@ -18,11 +18,13 @@ export class RegisterComponent implements OnInit{
character: any = { character: any = {
class : "Warrior", class : "Warrior",
spec : "Arms" spec : "Arms",
race: "Night Elf"
} }
ranks = _Rank ranks = _Rank
classes = _Class classes = _Class
races = _Race
selectedClass : Class = "Warrior" selectedClass : Class = "Warrior"
selectedSpec = specs[this.selectedClass][0] selectedSpec = specs[this.selectedClass][0]
specs = specs[this.selectedClass] specs = specs[this.selectedClass]
@@ -51,6 +53,8 @@ export class RegisterComponent implements OnInit{
onSelectSpec(){ onSelectSpec(){
} }
onSelectRace(){}
async onSubmit(){ async onSubmit(){
const pw = this.user.pwhash const pw = this.user.pwhash
this.user.pwhash = await hash(this.user.pwhash) this.user.pwhash = await hash(this.user.pwhash)
@@ -76,7 +80,7 @@ export class RegisterComponent implements OnInit{
charactername: char.name, charactername: char.name,
specid: specid, specid: specid,
userid: this.api.getAuth().user.id!, userid: this.api.getAuth().user.id!,
race: 'Human' race: char.race
}) })
}catch(e){ }catch(e){
alert("Error creating character"+e) alert("Error creating character"+e)
@@ -99,7 +99,7 @@ import { _Tiers, allItems, Tiers } from '../../../../../../backend/Types/Items';
const token = await src.buyToken(this.api.getAuth().token.value, charactername, this.item.itemname, this.signup) const token = await src.buyToken(this.api.getAuth().token.value, charactername, this.item.itemname, this.signup)
if(token){ if(token){
this.toastr.show(token.characterid+' now has a token for '+token.itemname+' of level '+token.level, 'Yay', {status: 'success'}) this.toastr.show(token.charactername+' now has a token for '+token.itemname+' of level '+token.level, 'Yay', {status: 'success'})
}else{ }else{
this.toastr.show('Error (something went wrong)', 'Oh no', {status: 'danger'}) this.toastr.show('Error (something went wrong)', 'Oh no', {status: 'danger'})
} }