feat(character): colored item borders for quality (#20)

This commit is contained in:
Axel Cocat 2022-05-07 17:33:42 +02:00 committed by GitHub
parent 08009a575c
commit 1156ceb17f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
25 changed files with 21 additions and 5 deletions

View file

@ -31,6 +31,7 @@ interface IEquipmentData {
randomPropertyId: number;
classId: number;
subclassId: number;
quality: number;
}
interface ICustomizationOption {
@ -331,7 +332,7 @@ export class CharacterController {
}
private async getEquipmentData(realm: string, charGuid: number): Promise<IEquipmentData[]> {
const [rows, fields] = await this.armory.getCharactersDb(realm).query({
let [rows, fields] = await this.armory.getCharactersDb(realm).query({
sql: `
SELECT character_inventory.slot, item_instance.itemEntry, item_instance.flags, item_instance.enchantments, item_instance.randomPropertyId
FROM character_inventory
@ -350,6 +351,16 @@ export class CharacterController {
row.subclassId = item.subclassId;
}
[rows, fields] = await this.armory.worldDb.query({
sql: "SELECT entry, quality FROM item_template WHERE entry IN (?)",
values: [data.map((row) => row.itemEntry)],
timeout: this.armory.config.dbQueryTimeout,
});
for (const row of rows as RowDataPacket[]) {
const item = data.find((item) => item.itemEntry === row.entry);
item.quality = row.quality;
}
return data;
}