chore: apply prettier on all files (#8)
* chore: apply prettier on all files
* chore: add prettier npm script
* Update .prettierrc
Co-authored-by: Axel Cocat <ax.cocat@gmail.com>
* Update .prettierignore
Co-authored-by: Axel Cocat <ax.cocat@gmail.com>
* Update .prettierignore
Co-authored-by: Axel Cocat <ax.cocat@gmail.com>
* Update .prettierignore
Co-authored-by: Axel Cocat <ax.cocat@gmail.com>
* chore: apply prettier with new conf
* Revert "chore: apply prettier with new conf"
This reverts commit db2a04c03f.
* chore: apply prettier correctly
* chore: update .prettierignore
* chore: restore viewer.min.js minification
* chore: apply again prettier
Co-authored-by: Stefano Borzi <stefano.borzi@fedex.com>
Co-authored-by: Axel Cocat <ax.cocat@gmail.com>
This commit is contained in:
parent
fe21209817
commit
8331e4dd73
15 changed files with 504 additions and 228 deletions
|
|
@ -54,9 +54,12 @@ class Progress {
|
|||
}
|
||||
|
||||
private createProgressBar(text: string, total: number): cliProgress.SingleBar {
|
||||
const progress = new cliProgress.SingleBar({
|
||||
format: `${text} {bar} {percentage}% ({value} / {total})`,
|
||||
}, cliProgress.Presets.shades_classic);
|
||||
const progress = new cliProgress.SingleBar(
|
||||
{
|
||||
format: `${text} {bar} {percentage}% ({value} / {total})`,
|
||||
},
|
||||
cliProgress.Presets.shades_classic,
|
||||
);
|
||||
progress.start(total, 0);
|
||||
return progress;
|
||||
}
|
||||
|
|
@ -163,25 +166,13 @@ function queueTexturesAndModels(item: any): void {
|
|||
}
|
||||
|
||||
async function downloadRaces(): Promise<void> {
|
||||
const races = [
|
||||
"human",
|
||||
"nightelf",
|
||||
"dwarf",
|
||||
"gnome",
|
||||
"draenei",
|
||||
"orc",
|
||||
"troll",
|
||||
"tauren",
|
||||
"bloodelf",
|
||||
"scourge",
|
||||
];
|
||||
const races = ["human", "nightelf", "dwarf", "gnome", "draenei", "orc", "troll", "tauren", "bloodelf", "scourge"];
|
||||
const genders = ["male", "female"];
|
||||
const raceGenderCombo = races.map((race) => [race + genders[0], race + genders[1]]).flat();
|
||||
|
||||
const progress = new Progress("Downloading races data...", raceGenderCombo.length);
|
||||
|
||||
await promisepool.PromisePool
|
||||
.for(raceGenderCombo)
|
||||
await promisepool.PromisePool.for(raceGenderCombo)
|
||||
.withConcurrency(4)
|
||||
.process(async (race) => {
|
||||
const characterJson = await download("meta/character", `${race}.json`);
|
||||
|
|
@ -191,7 +182,11 @@ async function downloadRaces(): Promise<void> {
|
|||
for (const option of customizationJson.Options) {
|
||||
for (const choice of option.Choices) {
|
||||
for (const element of choice.Elements) {
|
||||
if (element.SkinnedModel !== null && typeof element.SkinnedModel.CollectionFileDataID === "number" && element.SkinnedModel.CollectionFileDataID !== 0) {
|
||||
if (
|
||||
element.SkinnedModel !== null &&
|
||||
typeof element.SkinnedModel.CollectionFileDataID === "number" &&
|
||||
element.SkinnedModel.CollectionFileDataID !== 0
|
||||
) {
|
||||
modelsDownloadQueue.add(element.SkinnedModel.CollectionFileDataID);
|
||||
}
|
||||
if (element.BoneSet !== null && typeof element.BoneSet.BoneFileDataID === "number" && element.BoneSet.BoneFileDataID !== 0) {
|
||||
|
|
@ -202,7 +197,7 @@ async function downloadRaces(): Promise<void> {
|
|||
}
|
||||
|
||||
const textureFiles = Object.keys(customizationJson.TextureFiles)
|
||||
.map(key => customizationJson.TextureFiles[key])
|
||||
.map((key) => customizationJson.TextureFiles[key])
|
||||
.flat();
|
||||
for (const file of textureFiles) {
|
||||
texturesDownloadQueue.add(file.FileDataId);
|
||||
|
|
@ -215,12 +210,14 @@ async function downloadRaces(): Promise<void> {
|
|||
}
|
||||
|
||||
async function downloadArmors(): Promise<void> {
|
||||
const rows = await dbc.item().filter((row) => row.classId === classIdArmor).toArray();
|
||||
const rows = await dbc
|
||||
.item()
|
||||
.filter((row) => row.classId === classIdArmor)
|
||||
.toArray();
|
||||
|
||||
const progress = new Progress("Downloading armor data...", rows.length);
|
||||
|
||||
await promisepool.PromisePool
|
||||
.for(rows)
|
||||
await promisepool.PromisePool.for(rows)
|
||||
.withConcurrency(50)
|
||||
.process(async (row) => {
|
||||
const modifiedAppearance = dbcItemModifiedAppearanceByItemId[row.id];
|
||||
|
|
@ -247,12 +244,14 @@ async function downloadArmors(): Promise<void> {
|
|||
}
|
||||
|
||||
async function downloadWeapons(): Promise<void> {
|
||||
const rows = await dbc.item().filter((row) => row.classId === classIdWeapon).toArray();
|
||||
const rows = await dbc
|
||||
.item()
|
||||
.filter((row) => row.classId === classIdWeapon)
|
||||
.toArray();
|
||||
|
||||
const progress = new Progress("Downloading weapon data...", rows.length);
|
||||
|
||||
await promisepool.PromisePool
|
||||
.for(rows)
|
||||
await promisepool.PromisePool.for(rows)
|
||||
.withConcurrency(50)
|
||||
.process(async (row) => {
|
||||
const modifiedAppearance = dbcItemModifiedAppearanceByItemId[row.id];
|
||||
|
|
@ -307,11 +306,13 @@ async function readDbcData(): Promise<void> {
|
|||
}
|
||||
|
||||
async function downloadMounts(): Promise<void> {
|
||||
const mountSpells = await dbc.spell().filter(spell => spell.mechanic === spellMechanicMounted).toArray();
|
||||
const mountSpells = await dbc
|
||||
.spell()
|
||||
.filter((spell) => spell.mechanic === spellMechanicMounted)
|
||||
.toArray();
|
||||
const progress = new Progress("Downloading mount data...", mountSpells.length);
|
||||
|
||||
await promisepool.PromisePool
|
||||
.for(mountSpells)
|
||||
await promisepool.PromisePool.for(mountSpells)
|
||||
.withConcurrency(50)
|
||||
.process(async (spell) => {
|
||||
const mount = dbcMountBySourceSpellId[spell.id];
|
||||
|
|
@ -333,8 +334,7 @@ async function downloadMounts(): Promise<void> {
|
|||
async function downloadTextures(): Promise<void> {
|
||||
const progress = new Progress("Downloading textures...", texturesDownloadQueue.size);
|
||||
|
||||
await promisepool.PromisePool
|
||||
.for(Array.from(texturesDownloadQueue))
|
||||
await promisepool.PromisePool.for(Array.from(texturesDownloadQueue))
|
||||
.withConcurrency(25)
|
||||
.process(async (fileDataId) => {
|
||||
await download("textures", `${fileDataId}.png`);
|
||||
|
|
@ -347,8 +347,7 @@ async function downloadTextures(): Promise<void> {
|
|||
async function downloadModels(): Promise<void> {
|
||||
const progress = new Progress("Downloading models...", modelsDownloadQueue.size);
|
||||
|
||||
await promisepool.PromisePool
|
||||
.for(Array.from(modelsDownloadQueue))
|
||||
await promisepool.PromisePool.for(Array.from(modelsDownloadQueue))
|
||||
.withConcurrency(25)
|
||||
.process(async (fileDataId) => {
|
||||
await download("mo3", `${fileDataId}.mo3`);
|
||||
|
|
@ -361,8 +360,7 @@ async function downloadModels(): Promise<void> {
|
|||
async function downloadBones(): Promise<void> {
|
||||
const progress = new Progress("Downloading bones...", bonesDownloadQueue.size);
|
||||
|
||||
await promisepool.PromisePool
|
||||
.for(Array.from(bonesDownloadQueue))
|
||||
await promisepool.PromisePool.for(Array.from(bonesDownloadQueue))
|
||||
.withConcurrency(25)
|
||||
.process(async (fileDataId) => {
|
||||
try {
|
||||
|
|
@ -384,8 +382,7 @@ async function parseModels(): Promise<void> {
|
|||
const files = await glob("data/mo3/*.mo3");
|
||||
const progress = new Progress("Reading model files for texture references...", files.length);
|
||||
|
||||
await promisepool.PromisePool
|
||||
.for(files)
|
||||
await promisepool.PromisePool.for(files)
|
||||
.withConcurrency(20)
|
||||
.process(async (file) => {
|
||||
const buffer = await fsp.readFile(file);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue