Last active
March 11, 2026 07:51
-
-
Save Infinitay/b661ad3428bf8bee13bcfb795d881730 to your computer and use it in GitHub Desktop.
Extracts the available teleports on the Portal Nexus and constructs an array of teleport objects to easily view the name and associated teleport id (POH_NEXUS_TELE varbit value). The script is used in Abex's Cache Viewer tool: https://abextm.github.io/cache2/#/editor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import * as c2 from "@abextm/cache2"; | |
| import * as context from "viewer/context"; | |
| interface Teleport { | |
| teleportID: number // Associated with the varbit POH_NEXUS_TELE_# | |
| teleportName: string | |
| } | |
| interface NexusTeleport extends Teleport { | |
| alternativeTeleports?: Teleport[] | |
| } | |
| type NexusTeleportMap = Map<number, number | string>; | |
| const nexusTeleportEnum = await c2.Enum.load(context.cache, 1377); | |
| const nexusTeleportMap: NexusTeleportMap = nexusTeleportEnum!.map; | |
| const nexusTeleports: NexusTeleport[] = []; | |
| for (const [teleportID, teleportStructID] of nexusTeleportMap) { | |
| const teleportStruct = await c2.Struct.load(context.cache, teleportStructID); | |
| const teleportName = teleportStruct!.params.get(660 as c2.ParamID) as string; | |
| const teleport: NexusTeleport = { | |
| teleportID: teleportID, | |
| teleportName: teleportName | |
| } | |
| // Check if the current teleport is an alternative teleport | |
| if (teleportID > 150) { | |
| const parentTeleportID = teleportID - 150; | |
| const parentTeleport = nexusTeleports.find(teleport => teleport.teleportID == parentTeleportID); | |
| // If the current teleport has a matching parent teleport, then add it to its alternativeTeleports | |
| if (parentTeleport) { | |
| if (!!parentTeleport.alternativeTeleports) { | |
| parentTeleport.alternativeTeleports.push(teleport); | |
| } else { | |
| parentTeleport.alternativeTeleports = [teleport]; | |
| } | |
| } | |
| } | |
| nexusTeleports.push(teleport); | |
| } | |
| console.log(nexusTeleports); |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://abextm.github.io/cache2/#/editor