update tests

This commit is contained in:
peter
2020-02-06 15:42:56 +01:00
parent b01a06fa10
commit b987974b9e
34 changed files with 339 additions and 26 deletions
+4 -4
View File
@@ -1,4 +1,4 @@
import { T1 } from "../../Types/Items";
import { T1, T2 } from "../../Types/Items";
import { Inject, Injectable } from "../../Injector/ServiceDecorator";
import { ItemManagerFeatureIfc, ItemManagerIfc } from "./RPCInterface";
import { FrontworkComponent } from "../../Types/FrontworkComponent";
@@ -9,7 +9,6 @@ import { IItemManager } from "./Interface";
import { getLogger } from "log4js";
import { IUserManager } from "../User/Interface";
import { ICharacterManager } from "../Character/Interface";
import { join } from "path";
const fetch = require('node-fetch')
const xml2js = require('xml2js');
@@ -250,10 +249,11 @@ implements FrontworkComponent<ItemManagerIfc, ItemManagerFeatureIfc>, TableDefin
if(this.initialized) return
this.initialized = true
const allItems = [...T1]
getLogger('ItemManager').debug('Checking items')
const allItems = [...T1, ...T2]
const countCache = await this.countItems()
getLogger('ItemManager').debug('Checking items, got: ',countCache, 'expected: ', allItems.length)
if(countCache != allItems.length){
const items:Item[] = await Promise.all(allItems.map((i) => this.fetchItem(i)))
try{
+72 -1
View File
@@ -61,4 +61,75 @@ export const T1 = [
"Ring of Binding",
"Shard of the Scale",
"Head of Onyxia",
"Bindings of the Windseeker"]
"Bindings of the Windseeker"]
export const T2:string[] = [
"Gloves of Rapid Evolution",
"Mantle of the Blackwing Cabal",
"Spineshatter",
"The Untamed Blade",
"Pendant of the Fallen Dragon",
"Helm of Endless Rage",
"Dragonfang Blade",
"Red Dragonscale Protector",
"Black Brood Pauldrons",
"Bracers of Arcane Accuracy",
"Heartstriker",
"Maladath, Runed Blade of the Black Flight",
"Black Ash Robe",
"Firemaw's Clutch",
"Claw of the Black Drake",
"Cloak of Firemaw",
"Legguards of the Fallen Crusader",
"Taut Dragonhide Belt",
"Drake Talon Pauldrons",
"Rejuvenating Gem",
"Drake Talon Cleaver",
"Band of Forced Concentration",
"Drake Fang Talisman",
"Ebony Flame Gloves",
"Malfurion's Blessed Bulwark",
"Dragonbreath Hand Cannon",
"Shadow Wing Focus Staff",
"Shroud of Pure Thought",
"Circle of Applied Force",
"Emberweave Leggings",
"Styleen's Impeding Scarab",
"Dragon's Touch",
"Herald of Woe",
"Taut Dragonhide Shoulderpads",
"Chromatic Boots",
"Taut Dragonhide Gloves",
"Shimmering Geta",
"Elementium Threaded Cloak",
"Angelista's Grasp",
"Girdle of the Fallen Crusader",
"Empowered Leggings",
"Chromatically Tempered Sword",
"Claw of Chromaggus",
"Primalist's Linked Waistguard",
"Ashjre'thul, Crossbow of Smiting",
"Elementium Reinforced Bulwark",
"Head of Nefarian",
"Cloak of the Brood Lord",
"Boots of the Shadow Flame",
"Therazane's Link",
"Archimtiros' Ring of Reckoning",
"Neltharion's Tear",
"Pure Elementium Band",
"Mish'undare, Circlet of the Mind Flayer",
"Prestor's Talisman of Connivery",
"Staff of the Shadow Flame",
"Ashkandi, Greatsword of the Brotherhood",
"Crul'shorukh, Edge of Chaos",
"Lok'amir il Romathis",
"Boots of Pure Thought",
"Cloak of Draconic Might",
"Draconic Maul",
"Doom's Edge",
"Essence Gatherer",
"Band of Dark Dominion",
"Draconic Avenger",
"Interlaced Shadow Jerkin",
"Ringo's Blizzard Boots"
]
+2 -2
View File
@@ -2,7 +2,7 @@ import { Spec, _Class, Class } from "./Types"
export type SpecT = {
Warrior : 'Arms' | 'Fury' | 'Protection'
Rogue: 'Subetly' | 'Combat' | 'Assassination'
Rogue: 'Subtlety' | 'Combat' | 'Assassination'
Hunter: 'Beast Mastery' | 'Marksmanship' | 'Survival'
Paladin: 'Holy' | 'Protection' | 'Retribution'
Priest: 'Discipline' | 'Holy' | 'Shadow'
@@ -20,7 +20,7 @@ export const specs : { [classname in keyof SpecT] : SpecT[classname][] } = {
],
Rogue: [
'Subetly',
'Subtlety',
'Combat',
'Assassination'
],
@@ -40,7 +40,7 @@ export class HeaderComponent implements OnInit, OnDestroy {
},
];
currentTheme = 'dark';
currentTheme = 'default';
userMenu : NbMenuItem[] = [ { title: 'Log out', link: '/auth/logout' } ];
sendMessage: any = console.log
@@ -59,6 +59,8 @@ export class HeaderComponent implements OnInit, OnDestroy {
) {}
ngOnInit() {
this.themeService.changeTheme("dark");
this.currentTheme = this.themeService.currentTheme;
this.user = this.api.getCurrentUser()
@@ -1,30 +1,36 @@
<nb-card class="col-12 col-xl-9">
<nb-card style="width: 500px; padding: 0px 2rem 2rem 2rem">
<nb-card-header>
Pick Character
</nb-card-header>
<nb-card-body>
<div *ngFor="let character of characters">
<img [src]="'../../../../assets/images/'+character.class.toLowerCase()+'.png'" />
<span [ngStyle]="{'color': character.color}">
{{character.charactername}}
</span>
<br >
<br >
<br >
<button
(click)="signup(character, false)"
nbButton
outline
status="success"
size="tiny">
<nb-icon icon="checkmark-outline"></nb-icon>
size="medium">
<nb-icon icon="checkmark-outline"></nb-icon> On Time
</button>
&nbsp;
&nbsp;
&nbsp;
<button
(click)="signup(character, true)"
nbButton
outline
status="warning"
size="tiny">
<nb-icon icon="clock-outline"></nb-icon>
size="medium">
<nb-icon icon="clock-outline"></nb-icon> Late
</button>
<span [ngStyle]="{'color': character.color}">
{{character.charactername}}
</span>
</div>
</nb-card-body>
</nb-card>
@@ -1,6 +1,6 @@
<nb-card class="col-12 col-xl-9">
<nb-card style="width: 500px; padding: 0px 2rem 2rem 2rem">
<nb-card-header>
Create Raid
</nb-card-header>
@@ -11,11 +11,31 @@
nbInfiniteList
listenWindowScroll
[threshold]="500">
<nb-list-item *ngFor="let raid of raids" [routerLink]="'/frontcraft/raid/'+raid.id">
<b>{{raid.title}}</b><br>
{{raid.signupcount}} / {{raid.size}}<br>
{{raid.start | date : 'EEEE d MMMM @ HH:mm'}}<br>
{{raid.description}}<br>
<nb-list-item *ngFor="let raid of raids"
[routerLink]="'/frontcraft/raid/'+raid.id"
class="raidlist"
style="cursor: pointer;">
<div class="row">
<div class="col-2">
<img src="../../../../assets/images/mage.png" style="height: 75px" />
</div>
<div class="col-2 vcenter">
{{raid.title}}
</div>
<div class="col-2 vcenter">
<nb-icon icon="checkmark-circle"></nb-icon> {{raid.signupcount}} / {{raid.size}}<br>
</div>
<div class="col-2 vcenter">
<nb-icon icon="clock-outline"></nb-icon> {{raid.start | date : 'HH:mm'}}
</div>
<div class="col-4 vcenter">
<nb-icon icon="calendar-outline"></nb-icon> {{raid.start | date : 'EEEE MMMM d'}}
</div>
</div>
</nb-list-item>
</nb-list>
</nb-card>
@@ -5,3 +5,12 @@
}
}
}
.raidlist:hover {
background-color: #293259;
}
.vcenter {
height: 75px;
padding-top: 30px;
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 164 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 214 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 201 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 218 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 227 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 149 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 155 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 107 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 61 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 146 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 145 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

+207 -2
View File
@@ -3,7 +3,7 @@ import { FrontworkAdmin } from "../src/backend/Admin/Admin";
import { T1 } from "../src/backend/Types/Items";
import { RPCSocket } from "rpclibrary";
import { FrontcraftIfc, Auth, User, FrontcraftFeatureIfc, Raid, Character, Rank, Class, Race } from "../src/backend/Types/Types";
import { FrontcraftIfc, Auth, User, FrontcraftFeatureIfc, Raid, Character, Rank, Class, Race, SRPriority, Spec } from "../src/backend/Types/Types";
import { SpecT } from "../src/backend/Types/PlayerSpecs";
@@ -227,9 +227,214 @@ describe('Frontcraft', () => {
})
it('calculate priorities', (done)=>{
const makePrio = async (itemname:string, spec?: Spec, race?:Race, mod:number = 0, description:string = "") => {
let specid
if(spec)
specid = await client.CharacterManager.getSpecId(spec.class, <any>spec.specname)
await adminClient.managePriorities.setPriority(itemname, {
specid: specid,
race: race,
modifier: mod,
description: description
})
}
Promise.all([
makePrio(
'Bracers of Arcane Accuracy',
{class:'Warlock', specname:'Demonology'},
undefined, 2, "hit bias"
),
makePrio(
'Bracers of Arcane Accuracy',
{class:'Warlock', specname:'Affliction'},
undefined, 2, "hit bias"
),
makePrio(
'Bracers of Arcane Accuracy',
{class:'Warlock', specname:'Destruction'},
undefined, 2, "hit bias"
),
makePrio(
'Bracers of Arcane Accuracy',
{class:'Mage', specname:'Arcane'},
undefined, 1, "hit bias"
),
makePrio(
'Bracers of Arcane Accuracy',
{class:'Mage', specname:'Frost'},
undefined, 1, "hit bias"
),
makePrio(
'Bracers of Arcane Accuracy',
{class:'Mage', specname:'Fire'},
undefined, 1, "hit bias"
),
makePrio(
'Maladath, Runed Blade of the Black Flight',
{class:'Warrior', specname:'Fury'},
'Human', 2, "weapon skill bias"
),
makePrio(
'Cloak of Firemaw',
{class:'Rogue', specname:'Assassination'},
undefined, 2, "agi-to-ap bias"
),
makePrio(
'Cloak of Firemaw',
{class:'Rogue', specname:'Combat'},
undefined, 2, "agi-to-ap bias"
),
makePrio(
'Cloak of Firemaw',
{class:'Rogue', specname:'Subtlety'},
undefined, 2, "agi-to-ap bias"
),
makePrio(
'Band of Forced Concentration',
{class:'Warlock', specname:'Demonology'},
undefined, 2, "hit bias"
),
makePrio(
'Band of Forced Concentration',
{class:'Warlock', specname:'Affliction'},
undefined, 2, "hit bias"
),
makePrio(
'Band of Forced Concentration',
{class:'Warlock', specname:'Destruction'},
undefined, 2, "hit bias"
),
makePrio(
'Band of Forced Concentration',
{class:'Mage', specname:'Arcane'},
undefined, 1, "hit bias"
),
makePrio(
'Band of Forced Concentration',
{class:'Mage', specname:'Frost'},
undefined, 1, "hit bias"
),
makePrio(
'Band of Forced Concentration',
{class:'Mage', specname:'Fire'},
undefined, 1, "hit bias"
),
makePrio(
'Drake Fang Talisman',
{class:'Rogue', specname:'Assassination'},
undefined, 4, "hit bias"
),
makePrio(
'Drake Fang Talisman',
{class:'Rogue', specname:'Combat'},
undefined, 4, "hit bias"
),
makePrio(
'Drake Fang Talisman',
{class:'Rogue', specname:'Subtlety'},
undefined, 4, "hit bias"
),
makePrio(
'Drake Fang Talisman',
{class:'Warrior', specname:'Fury'},
undefined, 2, "hit bias"
),
makePrio(
'Drake Fang Talisman',
{class:'Druid', specname:'Feral (DPS)'},
undefined, 2, "hit bias"
),
makePrio(
'Circle of Applied Force',
{class:'Warrior', specname:'Fury'},
undefined, 2, "str-to-ap bias"
),
makePrio(
'Circle of Applied Force',
{class:'Druid', specname:'Feral (DPS)'},
undefined, 2, "str-to-ap bias"
),
makePrio(
'Empowered Leggings',
{class:'Paladin', specname:'Holy'},
undefined, 2, "crit bias"
),
makePrio(
'Boots of the Shadow Flame',
{class:'Rogue', specname:'Assassination'},
undefined, 2, "hit bias"
),
makePrio(
'Boots of the Shadow Flame',
{class:'Rogue', specname:'Combat'},
undefined, 2, "hit bias"
),
makePrio(
'Boots of the Shadow Flame',
{class:'Rogue', specname:'Subtlety'},
undefined, 2, "hit bias"
),
makePrio(
'Boots of the Shadow Flame',
{class:'Druid', specname:'Feral (DPS)'},
undefined, 2, "hit bias"
),
makePrio(
'Neltharion\'s Tear',
{class:'Warlock', specname:'Demonology'},
undefined, 4, "hit bias"
),
makePrio(
'Neltharion\'s Tear',
{class:'Warlock', specname:'Affliction'},
undefined, 4, "hit bias"
),
makePrio(
'Neltharion\'s Tear',
{class:'Warlock', specname:'Destruction'},
undefined, 4, "hit bias"
),
makePrio(
'Neltharion\'s Tear',
{class:'Mage', specname:'Arcane'},
undefined, 2, "hit bias"
),
makePrio(
'Neltharion\'s Tear',
{class:'Mage', specname:'Frost'},
undefined, 2, "hit bias"
),
makePrio(
'Neltharion\'s Tear',
{class:'Mage', specname:'Fire'},
undefined, 2, "hit bias"
),
makePrio(
'Cloak of Draconic Might',
{class:'Warrior', specname:'Fury'},
undefined, 2, "str-to-ap bias"
),
makePrio(
'Cloak of Draconic Might',
{class:'Druid', specname:'Feral (DPS)'},
undefined, 2, "str-to-ap bias"
),
])
const user = Object.values(users)[0]
adminClient.managePriorities.setPriority(T1[0], {
race: user.character.race,
specid: user.character.specid,