fix(character): fix sheath type when mounted (#5)
This commit is contained in:
parent
af497b7ea6
commit
91f3ec424a
3 changed files with 77 additions and 6 deletions
|
|
@ -29,6 +29,8 @@ interface IEquipmentData {
|
|||
flags: number;
|
||||
enchantments: string;
|
||||
randomPropertyId: number;
|
||||
classId: number;
|
||||
subclassId: number;
|
||||
}
|
||||
|
||||
interface ICustomizationOption {
|
||||
|
|
@ -338,7 +340,16 @@ export class CharacterController {
|
|||
values: [charGuid],
|
||||
timeout: this.armory.config.dbQueryTimeout,
|
||||
});
|
||||
return rows as RowDataPacket[] as IEquipmentData[];
|
||||
|
||||
const data = rows as RowDataPacket[] as IEquipmentData[];
|
||||
|
||||
for (const row of data) {
|
||||
const item = await this.armory.dbc.item().find(item => item.id === row.itemEntry);
|
||||
row.classId = item.classId;
|
||||
row.subclassId = item.subclassId;
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
private async getMounts(realm: string, charGuid: number): Promise<IMount[]> {
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ export interface IAchievementCategory {
|
|||
export interface IItemDbc {
|
||||
id: number;
|
||||
classId: number;
|
||||
subclassId: number;
|
||||
displayInfoId: number;
|
||||
inventoryType: number;
|
||||
}
|
||||
|
|
@ -316,7 +317,7 @@ const dbcFields = {
|
|||
achievement: ["id", "faction", "titleLang0", "descriptionLang0", "category", "points", "flags", "iconId"],
|
||||
achievementCategory: ["id", "parent", "nameLang0"],
|
||||
glyphProperties: ["id", "spellId"],
|
||||
item: ["id", "classId", "displayInfoId", "inventoryType"],
|
||||
item: ["id", "classId", "subclassId", "displayInfoId", "inventoryType"],
|
||||
itemRetail: ["id", "inventoryType"],
|
||||
itemAppearance: ["id", "itemDisplayInfoId"],
|
||||
itemModifiedAppearance: ["id", "itemId", "itemAppearanceId"],
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@
|
|||
debug: () => { },
|
||||
};
|
||||
|
||||
const charData = {{{JSONstringify data}}};
|
||||
const charData = {{{ JSONstringify data }}};
|
||||
const races = {
|
||||
1: "human",
|
||||
2: "orc",
|
||||
|
|
@ -199,11 +199,38 @@
|
|||
onResize(true);
|
||||
|
||||
function setMount(mountId) {
|
||||
if (characterModel.mount.id !== mountId) {
|
||||
if (characterModel.mount.id === mountId) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (mountId !== 0) {
|
||||
const mainHand = charData.equipment.find(e => e.slot === 15);
|
||||
const offHand = charData.equipment.find(e => e.slot === 16);
|
||||
const ranged = charData.equipment.find(e => e.slot === 17);
|
||||
|
||||
characterModel.charCustomization.sheathMain = sheathTypes[mainHand.classId][mainHand.subclassId];
|
||||
if (offHand !== undefined) {
|
||||
characterModel.charCustomization.sheathOff = sheathTypes[offHand.classId][offHand.subclassId];
|
||||
} else if (ranged !== undefined) {
|
||||
characterModel.charCustomization.sheathOff = sheathTypes[ranged.classId][ranged.subclassId];
|
||||
} else {
|
||||
characterModel.charCustomization.sheathOff = -1;
|
||||
}
|
||||
|
||||
if (characterModel.charCustomization.sheathMain === undefined) {
|
||||
characterModel.charCustomization.sheathMain = 0;
|
||||
}
|
||||
if (characterModel.charCustomization.sheathOff === undefined) {
|
||||
characterModel.charCustomization.sheathOff = 0;
|
||||
}
|
||||
} else {
|
||||
characterModel.charCustomization.sheathMain = -1;
|
||||
characterModel.charCustomization.sheathOff = -1;
|
||||
}
|
||||
|
||||
characterModel.mount.id = mountId;
|
||||
createViewer();
|
||||
}
|
||||
}
|
||||
|
||||
if (charData.mounts.length === 0) {
|
||||
$("#mounts-container").hide();
|
||||
|
|
@ -233,6 +260,38 @@
|
|||
$("#mounts").slideToggle("fast");
|
||||
});
|
||||
|
||||
const sheathTypes = {
|
||||
2: {
|
||||
// One handed weapons
|
||||
0: 3,
|
||||
4: 3,
|
||||
7: 3,
|
||||
14: 3,
|
||||
15: 3,
|
||||
17: 3,
|
||||
20: 3,
|
||||
|
||||
// Two handed weapons
|
||||
1: 1,
|
||||
5: 1,
|
||||
8: 1,
|
||||
|
||||
// Others
|
||||
10: 2, // Staff
|
||||
6: 1, // Polearm
|
||||
2: 4, // Bow
|
||||
3: 4, // Gun
|
||||
18: 4, // Crossbow
|
||||
13: 0, // Fist weapons
|
||||
19: 3, // Wand
|
||||
20: 1, // Fishing pole
|
||||
},
|
||||
4: {
|
||||
0: 3, // Held in off-hand
|
||||
6: 9, // Shield
|
||||
},
|
||||
};
|
||||
|
||||
const characterModel = {
|
||||
type: ZamModelViewer.WOW,
|
||||
contentPath: "{{websiteRoot}}/data/",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue