Sprayxe / unreal.js

A pak reader for games like VALORANT & Fortnite written in pure JavaScript
https://unreal.js.org
MIT License
60 stars 7 forks source link

Getting err on pkg.getExport() #12

Closed ghost closed 3 years ago

ghost commented 3 years ago

C:\Users\a_dep\Documents\test fortnite bot\node_modules\unreal.js\dist\ue4\assets\Package.js:11 class Package extends UObject_1.UObject { ^

TypeError: Class extends value undefined is not a constructor or null at Object. (C:\Users\a_dep\Documents\test fortnite bot\node_modules\unreal.js\dist\ue4\assets\Package.js:11:33) at Module._compile (node:internal/modules/cjs/loader:1101:14) at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10) at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12) at Module.require (node:internal/modules/cjs/loader:1005:19) at require (node:internal/modules/cjs/helpers:94:18)
at Object. (C:\Users\a_dep\Documents\test fortnite bot\node_modules\unreal.js\dist\ue4\assets\PakPackage.js:5:19) at Module._compile (node:internal/modules/cjs/loader:1101:14) at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10) PS C:\Users\a_dep\Documents\test fortnite bot>

Code is :

// Create new instance const unreal = require('unreal.js') const fs = require('fs') const usmap = new unreal.UsmapTypeMappingsProvider(fs.readFileSync("++Fortnite+Release-18.30-CL-17882303-Windows_oo.usmap")) const provider = new unreal.FileProvider("C:/Program Files/Epic Games/Fortnite/FortniteGame/Content/Paks", unreal.Ue4Version.GAME_UE4_LATEST, usmap) provider.mappingsProvider.reload() // Loads .usmap // Setting this to '0' will skip reading directory index // Means it will not populate .utoc file entries, so .getFiles() will be empty // Leaving it to default value will slightly increase pak mounting time provider.ioStoreTocReadOptions = 0 // 'start' the provider await provider.initialize() // submit aes key to decrypt paks await provider.submitKey(unreal.FGuid.mainGuid, "fa2aabc586ac624ba24a9e69729da9fef8e10402b79b975a6081a561fe26c555") const pkg = provider.loadGameFile("FortniteGame/Content/Athena/Items/Cosmetics/Characters/CID_144_Athena_Commando_M_SoccerDudeA") console.log(pkg.toJson()[0]) const tex = pkg.getExportOfTypeOrNull(UTexture2D) const image = unreal.Image.convert(tex) // converts texture to image (import Image class from unreal.js) // writes it it a file fs.writeFileSync("image.png", image)

Artlfmj commented 3 years ago

Sorry for reporting bugs all the time 😂

Sprayxe commented 3 years ago

Haha no problem! It's good that you report them, else they would not be fixed and other people would keep encountering them \:)

Sprayxe commented 3 years ago

I just updated the library, let me know if the error still occurs! Btw, your file doesn't appear to have an UTexture2D export so it won't work either way (you would get a different error though).

ghost commented 3 years ago

C:\Users\a_dep\Documents\test fortnite bot\node_modules\unreal.js\dist\ue4\assets\Package.js:11 class Package extends UObject_1.UObject { ^

TypeError: Class extends value undefined is not a constructor or null at Object. (C:\Users\a_dep\Documents\test fortnite bot\node_modules\unreal.js\dist\ue4\assets\Package.js:11:33) at Module._compile (node:internal/modules/cjs/loader:1101:14) at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10) at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12) at Module.require (node:internal/modules/cjs/loader:1005:19) at require (node:internal/modules/cjs/helpers:94:18)
at Object. (C:\Users\a_dep\Documents\test fortnite bot\node_modules\unreal.js\dist\ue4\assets\PakPackage.js:5:19) at Module._compile (node:internal/modules/cjs/loader:1101:14) at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)

ghost commented 3 years ago

Still

Sprayxe commented 3 years ago

And you updated the library?

ghost commented 3 years ago

Normally yes. Lemme recheck

ghost commented 3 years ago

yes

ghost commented 3 years ago

Do u have discord so i can send code?

Sprayxe commented 3 years ago

MarcelWRLD#4682

Sprayxe commented 3 years ago

Should be fixed in the newest update.