aboutsummaryrefslogtreecommitdiff
path: root/lib/utils/Minecraft_Test.ts
diff options
context:
space:
mode:
authorIRONM00N <64110067+IRONM00N@users.noreply.github.com>2022-08-21 13:36:14 -0400
committerIRONM00N <64110067+IRONM00N@users.noreply.github.com>2022-08-21 13:36:14 -0400
commit03bcc47f9994523b61b1bea06cec718a43700c83 (patch)
tree015922aa79762bbfcda23e1388195c62357c16d0 /lib/utils/Minecraft_Test.ts
parentbe60d01553dc4e948c8c13400d5a4932fd741ed8 (diff)
downloadtanzanite-03bcc47f9994523b61b1bea06cec718a43700c83.tar.gz
tanzanite-03bcc47f9994523b61b1bea06cec718a43700c83.tar.bz2
tanzanite-03bcc47f9994523b61b1bea06cec718a43700c83.zip
fix wip mc stuff
Diffstat (limited to 'lib/utils/Minecraft_Test.ts')
-rw-r--r--lib/utils/Minecraft_Test.ts51
1 files changed, 50 insertions, 1 deletions
diff --git a/lib/utils/Minecraft_Test.ts b/lib/utils/Minecraft_Test.ts
index 26ca648..fce9d5b 100644
--- a/lib/utils/Minecraft_Test.ts
+++ b/lib/utils/Minecraft_Test.ts
@@ -1,7 +1,10 @@
+/* eslint-disable */
+
+import { parse } from '@ironm00n/nbt-ts';
import fs from 'fs/promises';
import path from 'path';
import { fileURLToPath } from 'url';
-import { mcToAnsi, RawNeuItem } from './Minecraft.js';
+import { McItemId, mcToAnsi, NbtTag, PetNums, PetsConstants, RawNeuItem, SbItemId } from './Minecraft.js';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const repo = path.join(__dirname, '..', '..', '..', '..', '..', 'neu-item-repo-dangerous');
@@ -84,3 +87,49 @@ for (const path_ of items) {
/* console.log('=-=-=-=-=-=-=-=-=-=-=-=-=-=-\n=-=-=-=-=-=-=-=-=-=-=-=-=-=-'); */
}
+const neuConstantsPath = path.join(repo, 'constants');
+const neuPetsPath = path.join(neuConstantsPath, 'pets.json');
+const neuPets = (await import(neuPetsPath, { assert: { type: 'json' } })) as PetsConstants;
+const neuPetNumsPath = path.join(neuConstantsPath, 'petnums.json');
+const neuPetNums = (await import(neuPetNumsPath, { assert: { type: 'json' } })) as PetNums;
+
+export class NeuItem {
+ public itemId: McItemId;
+ public displayName: string;
+ public nbtTag: NbtTag;
+ public internalName: SbItemId;
+ public lore: string[];
+
+ public constructor(raw: RawNeuItem) {
+ this.itemId = raw.itemid;
+ this.nbtTag = <NbtTag>parse(raw.nbttag);
+ this.displayName = raw.displayname;
+ this.internalName = raw.internalname;
+ this.lore = raw.lore;
+
+ this.petLoreReplacements();
+ }
+
+ private petLoreReplacements(level = -1) {
+ if (/.*?;[0-5]$/.test(this.internalName) && this.displayName.includes('LVL')) {
+ const maxLevel = neuPets?.custom_pet_leveling?.[this.internalName]?.max_level ?? 100;
+ this.displayName = this.displayName.replace('LVL', `1➡${maxLevel}`);
+
+ const nums = neuPetNums[this.internalName];
+ if (!nums) throw new Error(`Pet (${this.internalName}) has no pet nums.`);
+
+ const teir = ['COMMON', 'UNCOMMON', 'RARE', 'EPIC', 'LEGENDARY', 'MYTHIC'][+this.internalName.at(-1)!];
+ const petInfoTier = nums[teir];
+ if (!petInfoTier) throw new Error(`Pet (${this.internalName}) has no pet nums for ${teir} rarity.`);
+
+ const curve = petInfoTier?.stats_levelling_curve?.split(';');
+
+ // todo: finish copying from neu
+
+ const minStatsLevel = parseInt(curve?.[0] ?? '0');
+ const maxStatsLevel = parseInt(curve?.[0] ?? '100');
+
+ const lore = '';
+ }
+ }
+}