Improve server_version support

- It's now used for OSRS as well as NXT.
- We retain buildMinor if buildMajor == server_version, so we don't have
  to keep retrying minor versions.

Signed-off-by: Graham <gpe@openrs2.org>
master
Graham 7 months ago
parent 1f83b8668d
commit 8052561dcf
  1. 22
      archive/src/main/kotlin/org/openrs2/archive/cache/CacheDownloader.kt

@ -40,6 +40,11 @@ public class CacheDownloader @Inject constructor(
val codebase = config.config[CODEBASE] ?: throw Exception("Codebase missing")
hostname = URI(codebase).host ?: throw Exception("Hostname missing")
val serverVersion = config.params[OSRS_SERVER_VERSION]
if (serverVersion != null) {
buildMajor = serverVersion.toInt()
}
OsrsJs5ChannelInitializer(
OsrsJs5ChannelHandler(
bootstrap,
@ -58,10 +63,18 @@ public class CacheDownloader @Inject constructor(
"runescape" -> {
var buildMinor = game.buildMinor ?: throw Exception("Current minor build not set")
val serverVersion = config.config[SERVER_VERSION]
val serverVersion = config.config[NXT_SERVER_VERSION]
if (serverVersion != null) {
buildMajor = serverVersion.toInt()
buildMinor = 1
val n = serverVersion.toInt()
/*
* Only reset buildMinor if buildMajor changes, so
* we don't have to keep retrying minor versions.
*/
if (buildMajor != n) {
buildMajor = n
buildMinor = 1
}
}
val tokens = config.params.values.filter { TOKEN_REGEX.matches(it) }
@ -107,7 +120,8 @@ public class CacheDownloader @Inject constructor(
private companion object {
private const val CODEBASE = "codebase"
private const val SERVER_VERSION = "server_version"
private const val OSRS_SERVER_VERSION = "25"
private const val NXT_SERVER_VERSION = "server_version"
private const val NXT_LIVE_HOSTNAME = "content.runescape.com"
private const val NXT_BETA_HOSTNAME = "content.beta.runescape.com"
private const val PORT = 443

Loading…
Cancel
Save