瀏覽代碼

armory

master
peter 5 年之前
父節點
當前提交
070d3d254b

+ 5
- 0
src/frontend/src/app/@theme/components/header/header.component.html 查看文件

1
 <div class="header-container">
1
 <div class="header-container">
2
+  <div>
3
+    <a (click)="toggleSidebar()" href="#" class="sidebar-toggle">
4
+      <nb-icon icon="menu-2-outline"></nb-icon>
5
+    </a>
6
+  </div>
2
   <div class="logo-container">
7
   <div class="logo-container">
3
     <a (click)="toggleSidebar()" href="#" class="sidebar-toggle">
8
     <a (click)="toggleSidebar()" href="#" class="sidebar-toggle">
4
       <nb-icon icon="menu-2-outline"></nb-icon>
9
       <nb-icon icon="menu-2-outline"></nb-icon>

+ 32
- 0
src/frontend/src/app/frontcraft/pages/armory/armory.component.html 查看文件

1
+<nb-card 
2
+class = "col-12 col-xl-9"
3
+status="control">
4
+    <nb-card-header style="text-transform: capitalize;">
5
+        <h4>
6
+            Armory
7
+        </h4>
8
+    </nb-card-header>
9
+
10
+    <nb-card-body>
11
+        <div>
12
+            <input name="Character" [(ngModel)]="charactername"  placeholder="Character Name" nbInput>
13
+            <nb-select [(selected)]="server" placeholder="Spec">
14
+                <nb-option *ngFor="let sv of servers" [value]="sv">{{sv}}</nb-option>
15
+            </nb-select>
16
+            <button nbButton
17
+              (click)="submit()"
18
+              status="primary"
19
+              size="medium"
20
+              [disabled]="charactername == ''"
21
+              [class.btn-pulse]="submitted">
22
+                Go
23
+            </button>
24
+        </div>
25
+        
26
+        <div>
27
+            <ng-container *ngFor="let item of gear">
28
+                <wowhead [item]="item"></wowhead><br />
29
+            </ng-container>
30
+        </div>
31
+    </nb-card-body>
32
+</nb-card>

+ 82
- 0
src/frontend/src/app/frontcraft/pages/armory/armory.component.ts 查看文件

1
+import { Component, OnInit } from '@angular/core';
2
+import { Item } from '../../../../../../backend/Types/Types';
3
+
4
+@Component({
5
+  selector: 'armory',
6
+  templateUrl: './armory.component.html',
7
+})
8
+export class FrontcraftArmoryComponent implements OnInit{
9
+
10
+  servers = servers
11
+  charactername = ""
12
+  server = "Gandling"
13
+  region = "EU"
14
+  gear:string[] = []
15
+
16
+  constructor(
17
+  ){}
18
+
19
+  async submit(){
20
+    const dataLink = "https://classic.warcraftlogs.com:443/v1/parses/character/"+this.charactername.toLowerCase().replace(/^\w/, c => c.toUpperCase())+"/"+this.server+"/"+this.region+"?api_key=c698515ab4f592cdb848d80b3abe616c&metric=dps"
21
+
22
+    fetch(dataLink).then(raw => raw.json().then((json:any[]) => {
23
+      if(json.length < 1) return
24
+      let min = -1
25
+      let data = null
26
+
27
+      json.forEach(item => {
28
+        if(item.startTime > min){
29
+          min = item.startTime
30
+          data = item
31
+        }
32
+      })
33
+
34
+      this.gear = data.gear.map(item => {return <Item>{
35
+        itemname: item.name,
36
+        iconname: item.icon.replace('.jpg', ''),
37
+        quality: item.quality.replace(/^\w/, c => c.toUpperCase()),
38
+        url: "https://classic.wowhead.com/item="+item.id
39
+      }})
40
+    }))
41
+  }
42
+
43
+  async ngOnInit(){
44
+
45
+  }
46
+}
47
+
48
+const servers = [
49
+  "Ashbringer"
50
+  ,"Bloodfang"
51
+  ,"Dreadmist"
52
+  ,"Firemaw"
53
+  ,"Flamelash"
54
+  ,"Gandling"
55
+  ,"Gehennas"
56
+  ,"Golemagg"
57
+  ,"Hydraxian Waterlords"
58
+  ,"Judgement"
59
+  ,"Mirage Rach"
60
+  ,"Mograine"
61
+  ,"Nethergarde"
62
+  ,"Noggenfogg"
63
+  ,"Pyrewood Village"
64
+  ,"Razorgore"
65
+  ,"Shazzrah"
66
+  ,"Skullflame"
67
+  ,"Stonespine"
68
+  ,"Ten Storms"
69
+  ,"Zandalar Tribe"
70
+  ,"Amnennar"
71
+  ,"Auberdine"
72
+  ,"Finkle"
73
+  ,"Sulfuron"
74
+  ,"Everlook"
75
+  ,"Lucifron"
76
+  ,"Razorfen"
77
+  ,"Patchwerk"
78
+  ,"Venoxis"
79
+  ,"Dragon’s Call"
80
+  ,"Lakeshire"
81
+  ,"Transcendence"
82
+]

+ 2
- 4
src/frontend/src/app/frontcraft/pages/character/character.component.ts 查看文件

58
               name: data.encounterName,
58
               name: data.encounterName,
59
               date: data.startTime
59
               date: data.startTime
60
             }
60
             }
61
-            this.gear1 = data.gear.map(item => {return <Item>{
61
+            this.gear2 = data.gear.map(item => {return <Item>{
62
               itemname: item.name,
62
               itemname: item.name,
63
               iconname: item.icon.replace('.jpg', ''),
63
               iconname: item.icon.replace('.jpg', ''),
64
               quality: item.quality.replace(/^\w/, c => c.toUpperCase()),
64
               quality: item.quality.replace(/^\w/, c => c.toUpperCase()),
77
               date: data.startTime
77
               date: data.startTime
78
             }
78
             }
79
 
79
 
80
-            
81
-
82
-            this.gear2 = data.gear.map(item => {return <Item>{
80
+            this.gear1 = data.gear.map(item => {return <Item>{
83
               itemname: item.name,
81
               itemname: item.name,
84
               iconname: item.icon.replace('.jpg', ''),
82
               iconname: item.icon.replace('.jpg', ''),
85
               quality: item.quality.replace(/^\w/, c => c.toUpperCase()),
83
               quality: item.quality.replace(/^\w/, c => c.toUpperCase()),

+ 4
- 0
src/frontend/src/app/frontcraft/pages/pages-layout.component.ts 查看文件

26
     icon: 'book-open-outline',
26
     icon: 'book-open-outline',
27
     title: 'Loot Rules',
27
     title: 'Loot Rules',
28
     link: '/frontcraft/rules',
28
     link: '/frontcraft/rules',
29
+  },{
30
+  icon: "shield",
31
+  title: 'Armory',
32
+  link: '/frontcraft/armory'
29
   }]
33
   }]
30
   
34
   
31
   constructor(
35
   constructor(

+ 5
- 0
src/frontend/src/app/frontcraft/pages/pages-routing.module.ts 查看文件

9
 import { FrontcraftShopComponent } from './shop/shop.component';
9
 import { FrontcraftShopComponent } from './shop/shop.component';
10
 import { FrontcraftRulesComponent } from './rules/rules.component';
10
 import { FrontcraftRulesComponent } from './rules/rules.component';
11
 import { FrontcraftCharactersComponent } from './characters/characters.component';
11
 import { FrontcraftCharactersComponent } from './characters/characters.component';
12
+import { FrontcraftArmoryComponent } from './armory/armory.component';
12
 
13
 
13
 export const routes: Routes = [
14
 export const routes: Routes = [
14
     {
15
     {
43
                 path: 'rules',
44
                 path: 'rules',
44
                 component: FrontcraftRulesComponent
45
                 component: FrontcraftRulesComponent
45
             },
46
             },
47
+            {
48
+                path: 'armory',
49
+                component: FrontcraftArmoryComponent
50
+            },
46
             {
51
             {
47
                 path: '**',
52
                 path: '**',
48
                 redirectTo: 'raids'
53
                 redirectTo: 'raids'

+ 3
- 1
src/frontend/src/app/frontcraft/pages/pages.module.ts 查看文件

40
 import { FrontcraftBuyTokenComponent } from './shop/buytoken.component';
40
 import { FrontcraftBuyTokenComponent } from './shop/buytoken.component';
41
 import { FrontcraftItemComponent } from './shop/item.component';
41
 import { FrontcraftItemComponent } from './shop/item.component';
42
 import { FrontcraftWowheadComponent } from './shop/wowhead.component';
42
 import { FrontcraftWowheadComponent } from './shop/wowhead.component';
43
+import { FrontcraftArmoryComponent } from './armory/armory.component';
43
 
44
 
44
 
45
 
45
 @NgModule({
46
 @NgModule({
84
     FrontcraftCreateRaidsComponent,
85
     FrontcraftCreateRaidsComponent,
85
     FrontcraftBuyTokenComponent,
86
     FrontcraftBuyTokenComponent,
86
     FrontcraftWowheadComponent,
87
     FrontcraftWowheadComponent,
87
-    FrontcraftItemComponent
88
+    FrontcraftItemComponent,
89
+    FrontcraftArmoryComponent
88
   ],
90
   ],
89
   entryComponents: [
91
   entryComponents: [
90
     FrontcraftItemSelectComponent,
92
     FrontcraftItemSelectComponent,

Loading…
取消
儲存