Closed yrodrigez closed 3 months ago
@yrodrigez can you send me your code ?
@Miorey Thanks for the quick answer, ofc:
'use client'
import {useEffect, useState} from "react";
export function TDModelViewer() {
const [isClient, setIsClient] = useState(false);
const [generateModels, setGenerateModels] = useState<Function | null>(null);
useEffect(() => {
const loadGenerateModels = async () => {
// @ts-ignore
window.CONTENT_PATH = `${window.location.origin}/api/v1/bypass/`;
// @ts-ignore
window.WOTLK_TO_RETAIL_DISPLAY_ID_API=`https://wotlk.murlocvillage.com/api/items`
const {generateModels} = await import('wow-model-viewer');
setGenerateModels(() => generateModels);
};
if (typeof window !== 'undefined') {
setIsClient(true);
loadGenerateModels();
}
}, []);
useEffect(() => {
if (!isClient || !generateModels) return;
const character = {
"race": 4, // 7 is for Gnome, 1 is for Human, 3 is for Dwarf, 4 is for Night Elf
"gender": 0, // 0 is male, 1 is female
"skin": 4,
"face": 0,
"hairStyle": 2,
"hairColor": 5,
"facialStyle": 0,
"items": [
[1, 215161], // Head https://www.wowhead.com/classic/item=215161/tempered-interference-negating-helmet
[3, 220738], // Shoulder
[5, 220653], // Chest
[6, 215380], // Waist
[7, 220654], // Legs
[8, 220656], // Feet
[9, 19580], // Wrist
[10, 220541], // Hands
[15, 213307], // Cloak
[21, 220583], // Main hand
[22, 220600] // Off hand
]
};
generateModels(1, '#model_3d', character);
}, [generateModels])
return null;
}
As you can see i'm trying to use it in a nextJS project
@Miorey closing this one i messed up with the display id
@yrodrigez I hope it will work well. By the way I will pull a new version to fix an issue on the animations, due to wowhead changes. If you are happy with this lib ⭐ it please !
It is working so and so @Miorey I.E: https://www.everlastingvendetta.com/roster/porco
Using the code from here: https://github.com/yrodrigez/everlasting-vendetta/blob/main/src/app/roster/%5Bname%5D/components/TDModelViewer.tsx https://github.com/yrodrigez/everlasting-vendetta/blob/main/src/app/roster/%5Bname%5D/components/ModelGenerator.ts And getting the displays id's here: https://github.com/yrodrigez/everlasting-vendetta/blob/main/src/app/util/wowhead/getItemDisplayId.ts
@yrodrigez Is it for a wotlk or older server or retail ? For retail I have to push build the new package version: https://github.com/Miorey/wow-model-viewer/commit/c708506644238c080c1e3a4f3f06640c5dc21b57
@Miorey Its SOD (season of discovery) WoW Classic
I'm trying to use this with SOD characters but the items are not being displayed![image](https://github.com/Miorey/wow-model-viewer/assets/6799275/7b2f418b-fe71-440e-9841-e008fcfcce98)