Created
February 4, 2024 03:59
-
-
Save ultraviolet-jordan/e493189bab84218dff89aa3521c8006e to your computer and use it in GitHub Desktop.
This file contains 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
// // main | |
if (GameShell.getParameter('world').length === 0) { | |
GameShell.setParameter('world', '1'); | |
} | |
if (GameShell.getParameter('detail').length === 0) { | |
GameShell.setParameter('detail', 'high'); | |
} | |
if (GameShell.getParameter('method').length === 0) { | |
GameShell.setParameter('method', '0'); | |
} | |
type WorldList = { | |
id: number; | |
region: string; | |
address: string; | |
portOffset: number; | |
players: number; | |
members?: boolean; | |
} | |
const worldlist: WorldList[] = JSON.parse(await downloadText('http://2004scape.org/api/v1/worldlist')); | |
const id: number = parseInt(GameShell.getParameter('world'), 10); | |
const lowmem: boolean = GameShell.getParameter('detail') === 'low'; | |
const world: WorldList | undefined = worldlist.find((x): boolean => x.id === id); | |
const protocol: string = window.location.protocol; | |
const hostname: string = window.location.hostname; | |
const secured: boolean = hostname.startsWith('https'); | |
Client.nodeId = 10 + (world?.id ?? 1) - 1; | |
if (hostname === 'localhost') { | |
Client.serverAddress = protocol + '//' + hostname; | |
Client.portOffset = 0; | |
} else { | |
Client.serverAddress = world?.address ?? 'https://w1.225.2004scape.org'; | |
if (!secured) { | |
Client.serverAddress = Client.serverAddress.replace('https', 'http'); | |
} | |
Client.portOffset = world?.portOffset ?? 0; | |
} | |
if (lowmem) { | |
Client.setLowMemory(); | |
} else { | |
Client.setHighMemory(); | |
} | |
console.log('RS2 user client - release #225'); | |
new Client().run().then((): void => {}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment