Update CharacterController.ts
This commit is contained in:
parent
f7985f84c6
commit
f5ce2a4c64
1 changed files with 44 additions and 0 deletions
|
|
@ -257,6 +257,31 @@ export class CharacterController {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async skills(req: express.Request, res: express.Response, next: express.NextFunction): Promise<void> {
|
||||||
|
const realmName = req.params.realm;
|
||||||
|
const charName = req.params.name;
|
||||||
|
|
||||||
|
const realm = this.armory.getRealm(realmName);
|
||||||
|
if (realm === undefined) {
|
||||||
|
// Could not find realm
|
||||||
|
return next(404);
|
||||||
|
}
|
||||||
|
|
||||||
|
const charData = await this.getCharacterData(realm, charName);
|
||||||
|
if (charData === null) {
|
||||||
|
// Could not find character
|
||||||
|
return next(404);
|
||||||
|
}
|
||||||
|
|
||||||
|
res.render("character-skills.hbs", {
|
||||||
|
title: `Armory - ${charData.name} - Skills`,
|
||||||
|
...this.makeSharedDataObject(realm, charData),
|
||||||
|
data: {
|
||||||
|
skills: await this.getSkills(realm.name, charData.guid),
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
public async achievements(req: express.Request, res: express.Response, next: express.NextFunction): Promise<void> {
|
public async achievements(req: express.Request, res: express.Response, next: express.NextFunction): Promise<void> {
|
||||||
const realmName = req.params.realm;
|
const realmName = req.params.realm;
|
||||||
const charName = req.params.name;
|
const charName = req.params.name;
|
||||||
|
|
@ -968,6 +993,25 @@ export class CharacterController {
|
||||||
return talents;
|
return talents;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async getSkills(realm: string, character: number): Promise<number[][]> {
|
||||||
|
const [rows] = await this.armory.getCharactersDb(realm).query({
|
||||||
|
sql: `
|
||||||
|
SELECT skill, value, max
|
||||||
|
FROM character_skills
|
||||||
|
WHERE guid = ?
|
||||||
|
`,
|
||||||
|
values: [character],
|
||||||
|
timeout: this.armory.config.dbQueryTimeout,
|
||||||
|
});
|
||||||
|
|
||||||
|
const skills: number[][] = [[], []];
|
||||||
|
for (const row of rows as RowDataPacket[]) {
|
||||||
|
skills[0].push(row.skill, row.value, row.max);
|
||||||
|
}
|
||||||
|
|
||||||
|
return skills;
|
||||||
|
}
|
||||||
|
|
||||||
private async getTalentTrees(classId: number) {
|
private async getTalentTrees(classId: number) {
|
||||||
const items = await this.armory.dbc
|
const items = await this.armory.dbc
|
||||||
.talentTab()
|
.talentTab()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue