diff --git a/src/js/client.ts b/src/js/client.ts index b080de30..c76556e7 100644 --- a/src/js/client.ts +++ b/src/js/client.ts @@ -6685,59 +6685,62 @@ class Client extends GameShell { if (entityType === 2 && this.scene && this.scene.getInfo(this.currentLevel, x, z, bitset) >= 0) { const loc: LocType = LocType.get(typeId); - if (this.objSelected === 1) { - this.menuOption[this.menuSize] = 'Use ' + this.objSelectedName + ' with @cya@' + loc.name; - this.menuAction[this.menuSize] = 450; - this.menuParamA[this.menuSize] = bitset; - this.menuParamB[this.menuSize] = x; - this.menuParamC[this.menuSize] = z; - this.menuSize++; - } else if (this.spellSelected !== 1) { - if (loc.ops) { - for (let op: number = 4; op >= 0; op--) { - if (loc.ops[op]) { - this.menuOption[this.menuSize] = loc.ops[op] + ' @cya@' + loc.name; - if (op === 0) { - this.menuAction[this.menuSize] = 285; - } + // loc.name check is custom but think we need it + if (loc.name) { + if (this.objSelected === 1) { + this.menuOption[this.menuSize] = 'Use ' + this.objSelectedName + ' with @cya@' + loc.name; + this.menuAction[this.menuSize] = 450; + this.menuParamA[this.menuSize] = bitset; + this.menuParamB[this.menuSize] = x; + this.menuParamC[this.menuSize] = z; + this.menuSize++; + } else if (this.spellSelected !== 1) { + if (loc.ops) { + for (let op: number = 4; op >= 0; op--) { + if (loc.ops[op]) { + this.menuOption[this.menuSize] = loc.ops[op] + ' @cya@' + loc.name; + if (op === 0) { + this.menuAction[this.menuSize] = 285; + } - if (op === 1) { - this.menuAction[this.menuSize] = 504; - } + if (op === 1) { + this.menuAction[this.menuSize] = 504; + } - if (op === 2) { - this.menuAction[this.menuSize] = 364; - } + if (op === 2) { + this.menuAction[this.menuSize] = 364; + } - if (op === 3) { - this.menuAction[this.menuSize] = 581; - } + if (op === 3) { + this.menuAction[this.menuSize] = 581; + } - if (op === 4) { - this.menuAction[this.menuSize] = 1501; - } + if (op === 4) { + this.menuAction[this.menuSize] = 1501; + } - this.menuParamA[this.menuSize] = bitset; - this.menuParamB[this.menuSize] = x; - this.menuParamC[this.menuSize] = z; - this.menuSize++; + this.menuParamA[this.menuSize] = bitset; + this.menuParamB[this.menuSize] = x; + this.menuParamC[this.menuSize] = z; + this.menuSize++; + } } } - } - this.menuOption[this.menuSize] = 'Examine @cya@' + loc.name; - this.menuAction[this.menuSize] = 1175; - this.menuParamA[this.menuSize] = bitset; - this.menuParamB[this.menuSize] = x; - this.menuParamC[this.menuSize] = z; - this.menuSize++; - } else if ((this.activeSpellFlags & 0x4) === 4) { - this.menuOption[this.menuSize] = this.spellCaption + ' @cya@' + loc.name; - this.menuAction[this.menuSize] = 55; - this.menuParamA[this.menuSize] = bitset; - this.menuParamB[this.menuSize] = x; - this.menuParamC[this.menuSize] = z; - this.menuSize++; + this.menuOption[this.menuSize] = 'Examine @cya@' + loc.name; + this.menuAction[this.menuSize] = 1175; + this.menuParamA[this.menuSize] = bitset; + this.menuParamB[this.menuSize] = x; + this.menuParamC[this.menuSize] = z; + this.menuSize++; + } else if ((this.activeSpellFlags & 0x4) === 4) { + this.menuOption[this.menuSize] = this.spellCaption + ' @cya@' + loc.name; + this.menuAction[this.menuSize] = 55; + this.menuParamA[this.menuSize] = bitset; + this.menuParamB[this.menuSize] = x; + this.menuParamC[this.menuSize] = z; + this.menuSize++; + } } } diff --git a/src/js/jagex2/config/LocType.ts b/src/js/jagex2/config/LocType.ts index f86e5a5e..48489b3f 100644 --- a/src/js/jagex2/config/LocType.ts +++ b/src/js/jagex2/config/LocType.ts @@ -97,7 +97,7 @@ export default class LocType extends ConfigType { walloff: number = 16; ambient: number = 0; contrast: number = 0; - ops: (string | null)[] = []; + ops: (string | null)[] | null = null; mapfunction: number = -1; mapscene: number = -1; mirror: boolean = false; @@ -159,9 +159,12 @@ export default class LocType extends ConfigType { } else if (code === 39) { this.contrast = dat.g1b; } else if (code >= 30 && code < 35) { - this.ops[code - 30] = dat.gjstr; + if (!this.ops) { + this.ops = new Array(5).fill(null); + } - if (this.ops[code - 30] === 'hidden') { + this.ops[code - 30] = dat.gjstr; + if (this.ops[code - 30]?.toLowerCase() === 'hidden') { this.ops[code - 30] = null; } } else if (code === 40) { diff --git a/src/js/jagex2/config/NpcType.ts b/src/js/jagex2/config/NpcType.ts index 3d97b5e4..78e90ed8 100644 --- a/src/js/jagex2/config/NpcType.ts +++ b/src/js/jagex2/config/NpcType.ts @@ -74,7 +74,7 @@ export default class NpcType extends ConfigType { hasalpha: boolean = false; recol_s: Uint16Array | null = null; recol_d: Uint16Array | null = null; - ops: (string | null)[] = []; + ops: (string | null)[] | null = null; code90: number = -1; code91: number = -1; code92: number = -1; @@ -109,9 +109,12 @@ export default class NpcType extends ConfigType { this.walkanim_r = dat.g2; this.walkanim_l = dat.g2; } else if (code >= 30 && code < 40) { - this.ops[code - 30] = dat.gjstr; + if (!this.ops) { + this.ops = new Array(5).fill(null); + } - if (this.ops[code - 30] === 'hidden') { + this.ops[code - 30] = dat.gjstr; + if (this.ops[code - 30]?.toLowerCase() === 'hidden') { this.ops[code - 30] = null; } } else if (code === 40) { diff --git a/src/js/jagex2/config/ObjType.ts b/src/js/jagex2/config/ObjType.ts index 5737d71a..76bfa25e 100644 --- a/src/js/jagex2/config/ObjType.ts +++ b/src/js/jagex2/config/ObjType.ts @@ -63,8 +63,8 @@ export default class ObjType extends ConfigType { if (!this.membersWorld && obj.members) { obj.name = 'Members Object'; obj.desc = "Login to a members' server to use this object."; - obj.ops = []; - obj.iops = []; + obj.ops = null; + obj.iops = null; } return obj; @@ -205,7 +205,7 @@ export default class ObjType extends ConfigType { cost: number = 1; members: boolean = false; ops: (string | null)[] | null = null; - iops: string[] | null = null; + iops: (string | null)[] | null = null; manwear: number = -1; manwear2: number = -1; manwearOffsetY: number = 0; @@ -268,11 +268,11 @@ export default class ObjType extends ConfigType { this.womanwear2 = dat.g2; } else if (code >= 30 && code < 35) { if (!this.ops) { - this.ops = new Array(5); + this.ops = new Array(5).fill(null); } this.ops[code - 30] = dat.gjstr; - if (this.ops[code - 30] === 'hidden') { + if (this.ops[code - 30]?.toLowerCase() === 'hidden') { this.ops[code - 30] = null; } } else if (code >= 35 && code < 40) {