Import SIMC Error - TypeError: Cannot read property 'mana' of undefined
tehmufifnman opened this issue ยท 2 comments
TypeError: Cannot read property 'mana' of undefined
at new OvalePowerClass (E:\Dropbox\Projects\Ovale\Ovale\dist\Power.js:332:75)
at Object. (E:\Dropbox\Projects\Ovale\Ovale\dist\Power.js:598:22)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
at Function.Module._load (internal/modules/cjs/loader.js:530:3)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:20:18)
at Object. (E:\Dropbox\Projects\Ovale\Ovale\dist\Compile.js:12:17)
Trying to run npm run simc
You will need to add condition to check if class is defined by importsimc.js
in Power.ts on line 327
if(Ovale.playerClass != undefined){
for (const [powerType, powerId] of pairs(Enum.PowerType)) {
let powerTypeLower = strlower(powerType);
let powerToken = possiblePowerTypes[Ovale.playerClass][powerTypeLower];
if (powerToken) {
this.POWER_TYPE[powerId] = powerTypeLower;
this.POWER_TYPE[powerToken] = powerTypeLower;
this.POWER_INFO[powerTypeLower] = {
id: powerId,
token: powerToken,
mini: 0,
maxCost: (powerTypeLower == "combopoints" && MAX_COMBO_POINTS) || 0 // Not currently used.
}
}
}
}
or just change line with powerToken to
let powerToken = Ovale.playerClass != undefined && possiblePowerTypes[Ovale.playerClass][powerTypeLower];