From 8048827121f46cbaf6209789f7e22dee02c26d60 Mon Sep 17 00:00:00 2001 From: Fiereu Date: Sun, 24 May 2026 11:20:02 +0200 Subject: [PATCH 1/2] feat(bytecodec): add bidirectional binary codec library --- bytecodec/build.gradle.kts | 6 + .../main/kotlin/de/fiereu/bytecodec/Atoms.kt | 328 ++++++++++++++++++ .../main/kotlin/de/fiereu/bytecodec/Buffer.kt | 19 + .../kotlin/de/fiereu/bytecodec/Buffers.kt | 88 +++++ .../main/kotlin/de/fiereu/bytecodec/Codec.kt | 7 + .../kotlin/de/fiereu/bytecodec/Combinators.kt | 267 ++++++++++++++ .../kotlin/de/fiereu/bytecodec/Exceptions.kt | 14 + .../kotlin/de/fiereu/bytecodec/PacketCodec.kt | 56 +++ .../de/fiereu/bytecodec/test/TestHelpers.kt | 47 +++ .../kotlin/de/fiereu/bytecodec/AtomsTest.kt | 140 ++++++++ .../kotlin/de/fiereu/bytecodec/BuffersTest.kt | 50 +++ .../de/fiereu/bytecodec/CombinatorsTest.kt | 134 +++++++ .../de/fiereu/bytecodec/PacketCodecTest.kt | 109 ++++++ settings.gradle.kts | 1 + 14 files changed, 1266 insertions(+) create mode 100644 bytecodec/build.gradle.kts create mode 100644 bytecodec/src/main/kotlin/de/fiereu/bytecodec/Atoms.kt create mode 100644 bytecodec/src/main/kotlin/de/fiereu/bytecodec/Buffer.kt create mode 100644 bytecodec/src/main/kotlin/de/fiereu/bytecodec/Buffers.kt create mode 100644 bytecodec/src/main/kotlin/de/fiereu/bytecodec/Codec.kt create mode 100644 bytecodec/src/main/kotlin/de/fiereu/bytecodec/Combinators.kt create mode 100644 bytecodec/src/main/kotlin/de/fiereu/bytecodec/Exceptions.kt create mode 100644 bytecodec/src/main/kotlin/de/fiereu/bytecodec/PacketCodec.kt create mode 100644 bytecodec/src/main/kotlin/de/fiereu/bytecodec/test/TestHelpers.kt create mode 100644 bytecodec/src/test/kotlin/de/fiereu/bytecodec/AtomsTest.kt create mode 100644 bytecodec/src/test/kotlin/de/fiereu/bytecodec/BuffersTest.kt create mode 100644 bytecodec/src/test/kotlin/de/fiereu/bytecodec/CombinatorsTest.kt create mode 100644 bytecodec/src/test/kotlin/de/fiereu/bytecodec/PacketCodecTest.kt diff --git a/bytecodec/build.gradle.kts b/bytecodec/build.gradle.kts new file mode 100644 index 0000000..1b734bf --- /dev/null +++ b/bytecodec/build.gradle.kts @@ -0,0 +1,6 @@ +plugins { + id("buildsrc.convention.kotlin-jvm") + id("buildsrc.convention.spotless") +} + +dependencies { testImplementation(libs.bundles.kotest) } diff --git a/bytecodec/src/main/kotlin/de/fiereu/bytecodec/Atoms.kt b/bytecodec/src/main/kotlin/de/fiereu/bytecodec/Atoms.kt new file mode 100644 index 0000000..6452221 --- /dev/null +++ b/bytecodec/src/main/kotlin/de/fiereu/bytecodec/Atoms.kt @@ -0,0 +1,328 @@ +package de.fiereu.bytecodec + +object Bool : Codec { + override fun read(buf: ReadBuffer): Boolean = buf.readByte() != 0.toByte() + + override fun write(buf: WriteBuffer, value: Boolean) { + buf.writeByte(if (value) 1 else 0) + } +} + +object S8 : Codec { + override fun read(buf: ReadBuffer): Byte = buf.readByte() + + override fun write(buf: WriteBuffer, value: Byte) { + buf.writeByte(value) + } +} + +object U8 : Codec { + override fun read(buf: ReadBuffer): Int = buf.readByte().toInt() and 0xFF + + override fun write(buf: WriteBuffer, value: Int) { + require(value in 0..0xFF) { "U8 out of range: $value" } + buf.writeByte(value.toByte()) + } +} + +object S16LE : Codec { + override fun read(buf: ReadBuffer): Short { + val b0 = buf.readByte().toInt() and 0xFF + val b1 = buf.readByte().toInt() and 0xFF + return ((b1 shl 8) or b0).toShort() + } + + override fun write(buf: WriteBuffer, value: Short) { + val v = value.toInt() + buf.writeByte((v and 0xFF).toByte()) + buf.writeByte(((v ushr 8) and 0xFF).toByte()) + } +} + +object S16BE : Codec { + override fun read(buf: ReadBuffer): Short { + val b0 = buf.readByte().toInt() and 0xFF + val b1 = buf.readByte().toInt() and 0xFF + return ((b0 shl 8) or b1).toShort() + } + + override fun write(buf: WriteBuffer, value: Short) { + val v = value.toInt() + buf.writeByte(((v ushr 8) and 0xFF).toByte()) + buf.writeByte((v and 0xFF).toByte()) + } +} + +object U16LE : Codec { + override fun read(buf: ReadBuffer): Int { + val b0 = buf.readByte().toInt() and 0xFF + val b1 = buf.readByte().toInt() and 0xFF + return (b1 shl 8) or b0 + } + + override fun write(buf: WriteBuffer, value: Int) { + require(value in 0..0xFFFF) { "U16 out of range: $value" } + buf.writeByte((value and 0xFF).toByte()) + buf.writeByte(((value ushr 8) and 0xFF).toByte()) + } +} + +object U16BE : Codec { + override fun read(buf: ReadBuffer): Int { + val b0 = buf.readByte().toInt() and 0xFF + val b1 = buf.readByte().toInt() and 0xFF + return (b0 shl 8) or b1 + } + + override fun write(buf: WriteBuffer, value: Int) { + require(value in 0..0xFFFF) { "U16 out of range: $value" } + buf.writeByte(((value ushr 8) and 0xFF).toByte()) + buf.writeByte((value and 0xFF).toByte()) + } +} + +object S32LE : Codec { + override fun read(buf: ReadBuffer): Int { + val b0 = buf.readByte().toInt() and 0xFF + val b1 = buf.readByte().toInt() and 0xFF + val b2 = buf.readByte().toInt() and 0xFF + val b3 = buf.readByte().toInt() and 0xFF + return (b3 shl 24) or (b2 shl 16) or (b1 shl 8) or b0 + } + + override fun write(buf: WriteBuffer, value: Int) { + buf.writeByte((value and 0xFF).toByte()) + buf.writeByte(((value ushr 8) and 0xFF).toByte()) + buf.writeByte(((value ushr 16) and 0xFF).toByte()) + buf.writeByte(((value ushr 24) and 0xFF).toByte()) + } +} + +object S32BE : Codec { + override fun read(buf: ReadBuffer): Int { + val b0 = buf.readByte().toInt() and 0xFF + val b1 = buf.readByte().toInt() and 0xFF + val b2 = buf.readByte().toInt() and 0xFF + val b3 = buf.readByte().toInt() and 0xFF + return (b0 shl 24) or (b1 shl 16) or (b2 shl 8) or b3 + } + + override fun write(buf: WriteBuffer, value: Int) { + buf.writeByte(((value ushr 24) and 0xFF).toByte()) + buf.writeByte(((value ushr 16) and 0xFF).toByte()) + buf.writeByte(((value ushr 8) and 0xFF).toByte()) + buf.writeByte((value and 0xFF).toByte()) + } +} + +object U32LE : Codec { + override fun read(buf: ReadBuffer): Long { + val b0 = buf.readByte().toLong() and 0xFF + val b1 = buf.readByte().toLong() and 0xFF + val b2 = buf.readByte().toLong() and 0xFF + val b3 = buf.readByte().toLong() and 0xFF + return (b3 shl 24) or (b2 shl 16) or (b1 shl 8) or b0 + } + + override fun write(buf: WriteBuffer, value: Long) { + require(value in 0L..0xFFFFFFFFL) { "U32 out of range: $value" } + buf.writeByte((value and 0xFF).toByte()) + buf.writeByte(((value ushr 8) and 0xFF).toByte()) + buf.writeByte(((value ushr 16) and 0xFF).toByte()) + buf.writeByte(((value ushr 24) and 0xFF).toByte()) + } +} + +object U32BE : Codec { + override fun read(buf: ReadBuffer): Long { + val b0 = buf.readByte().toLong() and 0xFF + val b1 = buf.readByte().toLong() and 0xFF + val b2 = buf.readByte().toLong() and 0xFF + val b3 = buf.readByte().toLong() and 0xFF + return (b0 shl 24) or (b1 shl 16) or (b2 shl 8) or b3 + } + + override fun write(buf: WriteBuffer, value: Long) { + require(value in 0L..0xFFFFFFFFL) { "U32 out of range: $value" } + buf.writeByte(((value ushr 24) and 0xFF).toByte()) + buf.writeByte(((value ushr 16) and 0xFF).toByte()) + buf.writeByte(((value ushr 8) and 0xFF).toByte()) + buf.writeByte((value and 0xFF).toByte()) + } +} + +object S64LE : Codec { + override fun read(buf: ReadBuffer): Long { + var result = 0L + var shift = 0 + repeat(8) { + result = result or ((buf.readByte().toLong() and 0xFF) shl shift) + shift += 8 + } + return result + } + + override fun write(buf: WriteBuffer, value: Long) { + var v = value + repeat(8) { + buf.writeByte((v and 0xFF).toByte()) + v = v ushr 8 + } + } +} + +object S64BE : Codec { + override fun read(buf: ReadBuffer): Long { + var result = 0L + repeat(8) { result = (result shl 8) or (buf.readByte().toLong() and 0xFF) } + return result + } + + override fun write(buf: WriteBuffer, value: Long) { + var shift = 56 + repeat(8) { + buf.writeByte(((value ushr shift) and 0xFF).toByte()) + shift -= 8 + } + } +} + +object F32LE : Codec { + override fun read(buf: ReadBuffer): Float = Float.fromBits(S32LE.read(buf)) + + override fun write(buf: WriteBuffer, value: Float) { + S32LE.write(buf, value.toRawBits()) + } +} + +object F32BE : Codec { + override fun read(buf: ReadBuffer): Float = Float.fromBits(S32BE.read(buf)) + + override fun write(buf: WriteBuffer, value: Float) { + S32BE.write(buf, value.toRawBits()) + } +} + +object F64LE : Codec { + override fun read(buf: ReadBuffer): Double = Double.fromBits(S64LE.read(buf)) + + override fun write(buf: WriteBuffer, value: Double) { + S64LE.write(buf, value.toRawBits()) + } +} + +object F64BE : Codec { + override fun read(buf: ReadBuffer): Double = Double.fromBits(S64BE.read(buf)) + + override fun write(buf: WriteBuffer, value: Double) { + S64BE.write(buf, value.toRawBits()) + } +} + +fun fixedBytes(n: Int): Codec { + require(n >= 0) { "fixedBytes negative size: $n" } + return object : Codec { + override fun read(buf: ReadBuffer): ByteArray { + val arr = ByteArray(n) + if (n > 0) buf.readBytes(arr) + return arr + } + + override fun write(buf: WriteBuffer, value: ByteArray) { + if (value.size != n) { + throw MalformedPacketException("fixedBytes($n) got ${value.size}") + } + if (n > 0) buf.writeBytes(value) + } + } +} + +fun unknownBytes(n: Int): Codec = fixedBytes(n) + +fun reserved(byte: Int, strict: Boolean = false): Codec { + val literal = (byte and 0xFF).toByte() + return object : Codec { + override fun read(buf: ReadBuffer) { + val read = buf.readByte() + if (strict && read != literal) { + throw ReservedByteMismatchException(byte and 0xFF, read.toInt() and 0xFF) + } + } + + override fun write(buf: WriteBuffer, value: Unit) { + buf.writeByte(literal) + } + } +} + +fun padding(n: Int, fill: Byte = 0): Codec { + require(n >= 0) { "padding negative size: $n" } + return object : Codec { + override fun read(buf: ReadBuffer) { + if (n > 0) buf.skip(n) + } + + override fun write(buf: WriteBuffer, value: Unit) { + repeat(n) { buf.writeByte(fill) } + } + } +} + +fun skip(n: Int): Codec = padding(n) + +object Utf16LeNullTerminated : Codec { + override fun read(buf: ReadBuffer): String { + val out = java.io.ByteArrayOutputStream() + while (true) { + val lo = buf.readByte() + val hi = buf.readByte() + if (lo == 0.toByte() && hi == 0.toByte()) break + out.write(lo.toInt() and 0xFF) + out.write(hi.toInt() and 0xFF) + } + return String(out.toByteArray(), Charsets.UTF_16LE) + } + + override fun write(buf: WriteBuffer, value: String) { + buf.writeBytes(value.toByteArray(Charsets.UTF_16LE)) + buf.writeByte(0) + buf.writeByte(0) + } +} + +object Utf16BeNullTerminated : Codec { + override fun read(buf: ReadBuffer): String { + val out = java.io.ByteArrayOutputStream() + while (true) { + val hi = buf.readByte() + val lo = buf.readByte() + if (hi == 0.toByte() && lo == 0.toByte()) break + out.write(hi.toInt() and 0xFF) + out.write(lo.toInt() and 0xFF) + } + return String(out.toByteArray(), Charsets.UTF_16BE) + } + + override fun write(buf: WriteBuffer, value: String) { + buf.writeBytes(value.toByteArray(Charsets.UTF_16BE)) + buf.writeByte(0) + buf.writeByte(0) + } +} + +object AsciiNullTerminated : Codec { + override fun read(buf: ReadBuffer): String { + val out = java.io.ByteArrayOutputStream() + while (true) { + val b = buf.readByte() + if (b == 0.toByte()) break + out.write(b.toInt() and 0xFF) + } + return String(out.toByteArray(), Charsets.US_ASCII) + } + + override fun write(buf: WriteBuffer, value: String) { + buf.writeBytes(value.toByteArray(Charsets.US_ASCII)) + buf.writeByte(0) + } +} diff --git a/bytecodec/src/main/kotlin/de/fiereu/bytecodec/Buffer.kt b/bytecodec/src/main/kotlin/de/fiereu/bytecodec/Buffer.kt new file mode 100644 index 0000000..3f58b1f --- /dev/null +++ b/bytecodec/src/main/kotlin/de/fiereu/bytecodec/Buffer.kt @@ -0,0 +1,19 @@ +package de.fiereu.bytecodec + +interface ReadBuffer { + fun readByte(): Byte + + fun readBytes(dst: ByteArray, offset: Int = 0, length: Int = dst.size - offset) + + fun skip(n: Int) + + fun remaining(): Int +} + +interface WriteBuffer { + fun writeByte(value: Byte) + + fun writeBytes(src: ByteArray, offset: Int = 0, length: Int = src.size - offset) +} + +interface Buffer : ReadBuffer, WriteBuffer diff --git a/bytecodec/src/main/kotlin/de/fiereu/bytecodec/Buffers.kt b/bytecodec/src/main/kotlin/de/fiereu/bytecodec/Buffers.kt new file mode 100644 index 0000000..6d3e116 --- /dev/null +++ b/bytecodec/src/main/kotlin/de/fiereu/bytecodec/Buffers.kt @@ -0,0 +1,88 @@ +package de.fiereu.bytecodec + +import java.nio.ByteBuffer + +class ByteArrayReadBuffer( + private val array: ByteArray, + private val offset: Int = 0, + private val length: Int = array.size - offset, +) : ReadBuffer { + init { + require(offset >= 0) { "offset < 0" } + require(length >= 0) { "length < 0" } + require(offset + length <= array.size) { "offset + length > array.size" } + } + + private var pos = 0 + + override fun readByte(): Byte { + if (pos >= length) throw IndexOutOfBoundsException("read past end") + return array[offset + pos++] + } + + override fun readBytes(dst: ByteArray, offset: Int, length: Int) { + if (this.pos + length > this.length) throw IndexOutOfBoundsException("read past end") + System.arraycopy(array, this.offset + pos, dst, offset, length) + pos += length + } + + override fun skip(n: Int) { + if (n < 0) throw IndexOutOfBoundsException("negative skip") + if (pos + n > length) throw IndexOutOfBoundsException("skip past end") + pos += n + } + + override fun remaining(): Int = length - pos +} + +class GrowableWriteBuffer(initialCapacity: Int = 256) : WriteBuffer { + private var buf: ByteArray = ByteArray(initialCapacity.coerceAtLeast(16)) + private var pos: Int = 0 + + fun size(): Int = pos + + fun toByteArray(): ByteArray = buf.copyOf(pos) + + private fun ensure(extra: Int) { + val needed = pos + extra + if (needed <= buf.size) return + var newSize = buf.size + while (newSize < needed) newSize *= 2 + buf = buf.copyOf(newSize) + } + + override fun writeByte(value: Byte) { + ensure(1) + buf[pos++] = value + } + + override fun writeBytes(src: ByteArray, offset: Int, length: Int) { + ensure(length) + System.arraycopy(src, offset, buf, pos, length) + pos += length + } +} + +class NioReadBuffer(private val nio: ByteBuffer) : ReadBuffer { + override fun readByte(): Byte = nio.get() + + override fun readBytes(dst: ByteArray, offset: Int, length: Int) { + nio.get(dst, offset, length) + } + + override fun skip(n: Int) { + nio.position(nio.position() + n) + } + + override fun remaining(): Int = nio.remaining() +} + +class NioWriteBuffer(private val nio: ByteBuffer) : WriteBuffer { + override fun writeByte(value: Byte) { + nio.put(value) + } + + override fun writeBytes(src: ByteArray, offset: Int, length: Int) { + nio.put(src, offset, length) + } +} diff --git a/bytecodec/src/main/kotlin/de/fiereu/bytecodec/Codec.kt b/bytecodec/src/main/kotlin/de/fiereu/bytecodec/Codec.kt new file mode 100644 index 0000000..1062f56 --- /dev/null +++ b/bytecodec/src/main/kotlin/de/fiereu/bytecodec/Codec.kt @@ -0,0 +1,7 @@ +package de.fiereu.bytecodec + +interface Codec { + fun read(buf: ReadBuffer): T + + fun write(buf: WriteBuffer, value: T) +} diff --git a/bytecodec/src/main/kotlin/de/fiereu/bytecodec/Combinators.kt b/bytecodec/src/main/kotlin/de/fiereu/bytecodec/Combinators.kt new file mode 100644 index 0000000..da8c450 --- /dev/null +++ b/bytecodec/src/main/kotlin/de/fiereu/bytecodec/Combinators.kt @@ -0,0 +1,267 @@ +package de.fiereu.bytecodec + +import java.nio.charset.Charset + +fun Codec.imap(decode: (T) -> R, encode: (R) -> T): Codec { + val inner = this + return object : Codec { + override fun read(buf: ReadBuffer): R = decode(inner.read(buf)) + + override fun write(buf: WriteBuffer, value: R) { + inner.write(buf, encode(value)) + } + } +} + +fun Codec.imapCatching( + decode: (T) -> R, + encode: (R) -> T, + onError: (T, Throwable) -> String = { v, _ -> "Cannot decode $v" }, +): Codec { + val inner = this + return object : Codec { + override fun read(buf: ReadBuffer): R { + val raw = inner.read(buf) + return try { + decode(raw) + } catch (e: CodecException) { + throw e + } catch (e: Throwable) { + throw MalformedPacketException(onError(raw, e), e) + } + } + + override fun write(buf: WriteBuffer, value: R) { + inner.write(buf, encode(value)) + } + } +} + +fun Codec.listPrefixed(prefix: Codec): Codec> { + val inner = this + return object : Codec> { + override fun read(buf: ReadBuffer): List { + val n = prefix.read(buf) + if (n < 0) throw MalformedPacketException("negative list length: $n") + val list = ArrayList(n.coerceAtMost(1024)) + repeat(n) { list.add(inner.read(buf)) } + return list + } + + override fun write(buf: WriteBuffer, value: List) { + prefix.write(buf, value.size) + for (item in value) inner.write(buf, item) + } + } +} + +fun Codec.repeat(count: Int): Codec> { + require(count >= 0) { "repeat negative count: $count" } + val inner = this + return object : Codec> { + override fun read(buf: ReadBuffer): List = List(count) { inner.read(buf) } + + override fun write(buf: WriteBuffer, value: List) { + if (value.size != count) { + throw MalformedPacketException("repeat($count) got ${value.size}") + } + for (item in value) inner.write(buf, item) + } + } +} + +fun bytesPrefixed(prefix: Codec): Codec = + object : Codec { + override fun read(buf: ReadBuffer): ByteArray { + val n = prefix.read(buf) + if (n < 0) throw MalformedPacketException("negative byte length: $n") + val arr = ByteArray(n) + if (n > 0) buf.readBytes(arr) + return arr + } + + override fun write(buf: WriteBuffer, value: ByteArray) { + prefix.write(buf, value.size) + if (value.isNotEmpty()) buf.writeBytes(value) + } + } + +fun stringPrefixed(prefix: Codec, charset: Charset): Codec = + object : Codec { + override fun read(buf: ReadBuffer): String { + val n = prefix.read(buf) + if (n < 0) throw MalformedPacketException("negative string length: $n") + val arr = ByteArray(n) + if (n > 0) buf.readBytes(arr) + return String(arr, charset) + } + + override fun write(buf: WriteBuffer, value: String) { + val arr = value.toByteArray(charset) + prefix.write(buf, arr.size) + if (arr.isNotEmpty()) buf.writeBytes(arr) + } + } + +inline fun > enumByOrdinalByte(): Codec { + val values = enumValues() + val name = E::class.simpleName ?: "enum" + return U8.imapCatching( + decode = { ord -> + if (ord !in values.indices) { + throw MalformedPacketException("ordinal $ord out of range for $name") + } + values[ord] + }, + encode = { it.ordinal }, + ) +} + +inline fun > enumByOrdinalU16LE(): Codec { + val values = enumValues() + val name = E::class.simpleName ?: "enum" + return U16LE.imapCatching( + decode = { ord -> + if (ord !in values.indices) { + throw MalformedPacketException("ordinal $ord out of range for $name") + } + values[ord] + }, + encode = { it.ordinal }, + ) +} + +fun > enumBy( + prefix: Codec, + lookup: (Int) -> E, + keyOf: (E) -> Int, +): Codec = + object : Codec { + override fun read(buf: ReadBuffer): E { + val key = prefix.read(buf) + return try { + lookup(key) + } catch (e: CodecException) { + throw e + } catch (e: Throwable) { + throw MalformedPacketException("no enum value for key $key", e) + } + } + + override fun write(buf: WriteBuffer, value: E) { + prefix.write(buf, keyOf(value)) + } + } + +fun choose( + tag: Codec, + identify: (T) -> Int, + vararg branches: Pair>, +): Codec { + val byTag: Map> = branches.toMap() + require(byTag.size == branches.size) { "duplicate branch tags in choose" } + return object : Codec { + override fun read(buf: ReadBuffer): T { + val t = tag.read(buf) + val branch = byTag[t] ?: throw UnknownTagException(t) + return branch.read(buf) + } + + override fun write(buf: WriteBuffer, value: T) { + val t = identify(value) + val branch = + byTag[t] + ?: throw MalformedPacketException("identify returned unknown tag 0x${t.toString(16)}") + tag.write(buf, t) + @Suppress("UNCHECKED_CAST") (branch as Codec).write(buf, value) + } + } +} + +fun Codec.optional(flag: Codec = Bool): Codec { + val inner = this + return object : Codec { + override fun read(buf: ReadBuffer): T? { + val present = flag.read(buf) + return if (present) inner.read(buf) else null + } + + override fun write(buf: WriteBuffer, value: T?) { + flag.write(buf, value != null) + if (value != null) inner.write(buf, value) + } + } +} + +fun Codec.then(other: Codec): Codec> { + val first = this + return object : Codec> { + override fun read(buf: ReadBuffer): Pair = first.read(buf) to other.read(buf) + + override fun write(buf: WriteBuffer, value: Pair) { + first.write(buf, value.first) + other.write(buf, value.second) + } + } +} + +interface BitsBuilder { + fun bit(index: Int, name: String) +} + +class BitSet32 +internal constructor( + internal val raw: Int, + internal val byName: Map, +) { + operator fun get(index: Int): Boolean { + require(index in 0..31) { "bit index out of range: $index" } + return (raw ushr index) and 1 != 0 + } + + operator fun get(name: String): Boolean { + val i = byName[name] ?: error("unknown bit name: $name") + return get(i) + } + + fun toRaw(): Int = raw + + override fun equals(other: Any?): Boolean = other is BitSet32 && other.raw == raw + + override fun hashCode(): Int = raw +} + +class BitsCodec +internal constructor( + private val backing: Codec, + private val byName: Map, +) : Codec { + override fun read(buf: ReadBuffer): BitSet32 = BitSet32(backing.read(buf), byName) + + override fun write(buf: WriteBuffer, value: BitSet32) { + backing.write(buf, value.raw) + } + + fun of(vararg bits: Pair): BitSet32 { + var raw = 0 + for ((name, set) in bits) { + val i = byName[name] ?: error("unknown bit name: $name") + if (set) raw = raw or (1 shl i) + } + return BitSet32(raw, byName) + } +} + +fun bitsLE(backing: Codec, builder: BitsBuilder.() -> Unit): BitsCodec { + val map = LinkedHashMap() + val b = + object : BitsBuilder { + override fun bit(index: Int, name: String) { + require(index in 0..31) { "bit index out of range: $index" } + require(name !in map) { "duplicate bit name: $name" } + map[name] = index + } + } + b.builder() + return BitsCodec(backing, map) +} diff --git a/bytecodec/src/main/kotlin/de/fiereu/bytecodec/Exceptions.kt b/bytecodec/src/main/kotlin/de/fiereu/bytecodec/Exceptions.kt new file mode 100644 index 0000000..f994180 --- /dev/null +++ b/bytecodec/src/main/kotlin/de/fiereu/bytecodec/Exceptions.kt @@ -0,0 +1,14 @@ +package de.fiereu.bytecodec + +open class CodecException(message: String, cause: Throwable? = null) : + RuntimeException(message, cause) + +class MalformedPacketException(message: String, cause: Throwable? = null) : + CodecException(message, cause) + +class UnknownTagException(val tag: Int) : CodecException("No branch for tag 0x${tag.toString(16)}") + +class ReservedByteMismatchException(val expected: Int, val actual: Int) : + CodecException( + "Expected reserved 0x${expected.toString(16)}, got 0x${actual.toString(16)}", + ) diff --git a/bytecodec/src/main/kotlin/de/fiereu/bytecodec/PacketCodec.kt b/bytecodec/src/main/kotlin/de/fiereu/bytecodec/PacketCodec.kt new file mode 100644 index 0000000..2bec106 --- /dev/null +++ b/bytecodec/src/main/kotlin/de/fiereu/bytecodec/PacketCodec.kt @@ -0,0 +1,56 @@ +package de.fiereu.bytecodec + +interface CodecScope

{ + fun field(codec: Codec, get: (P) -> T): T + + fun structural(codec: Codec) +} + +internal class ReadingScope

(private val buf: ReadBuffer) : CodecScope

{ + override fun field(codec: Codec, get: (P) -> T): T = codec.read(buf) + + override fun structural(codec: Codec) { + codec.read(buf) + } +} + +internal class WritingScope

( + private val buf: WriteBuffer, + private val value: P, +) : CodecScope

{ + override fun field(codec: Codec, get: (P) -> T): T { + val v = get(value) + codec.write(buf, v) + return v + } + + override fun structural(codec: Codec) { + codec.write(buf, Unit) + } +} + +abstract class PacketCodec

: Codec

{ + protected abstract fun CodecScope

.body(): P + + final override fun read(buf: ReadBuffer): P { + val scope = ReadingScope

( + protocol: P, + side: Side, +) : ProtocolHandler(protocol, side) { + + @Volatile private var sealed = false + + private val handlers = mutableMapOf, (PacketEvent<*>) -> Unit>() + + protected inline fun on(noinline handler: (PacketEvent) -> Unit) { + register(T::class, handler) + } + + @PublishedApi + internal fun register(type: KClass, handler: (PacketEvent) -> Unit) { + if (sealed) { + throw HandlerRegistrationException( + "Cannot register handler for ${type.simpleName} after the first packet", + ) + } + if (handlers.containsKey(type)) { + throw HandlerRegistrationException( + "Duplicate handler registration for ${type.simpleName}", + ) + } + @Suppress("UNCHECKED_CAST") + handlers[type] = handler as (PacketEvent<*>) -> Unit + } + + open fun isRegistered(type: KClass<*>): Boolean = handlers.containsKey(type) + + protected open fun onUnhandled(event: PacketEvent<*>) { + log.error { "Unhandled packet ${event.packet::class.simpleName} on $side" } + } + + final override fun onPacket(event: PacketEvent<*>) { + sealed = true + val handler = handlers[event.packet::class] + if (handler != null) { + handler(event) + } else if (!tryHandleAlternate(event)) { + onUnhandled(event) + } + } + + protected open fun tryHandleAlternate(event: PacketEvent<*>): Boolean = false +} diff --git a/network/src/main/kotlin/de/fiereu/network/checksum/Checksum.kt b/network/src/main/kotlin/de/fiereu/network/checksum/Checksum.kt new file mode 100644 index 0000000..e5b8293 --- /dev/null +++ b/network/src/main/kotlin/de/fiereu/network/checksum/Checksum.kt @@ -0,0 +1,11 @@ +package de.fiereu.network.checksum + +import io.netty.buffer.ByteBuf + +interface Checksum { + val size: Int + + fun calculate(data: ByteBuf): ByteArray + + fun verify(data: ByteBuf, expected: ByteArray): Boolean +} diff --git a/network/src/main/kotlin/de/fiereu/network/checksum/ChecksumFactory.kt b/network/src/main/kotlin/de/fiereu/network/checksum/ChecksumFactory.kt new file mode 100644 index 0000000..2f76bc0 --- /dev/null +++ b/network/src/main/kotlin/de/fiereu/network/checksum/ChecksumFactory.kt @@ -0,0 +1,11 @@ +package de.fiereu.network.checksum + +object ChecksumFactory { + fun create(size: Int, key: ByteArray = ByteArray(0)): Checksum = + when (size) { + 0 -> NoOpChecksum + 2 -> Crc16Checksum() + in 4..32 -> HmacSha256Checksum(size, key) + else -> throw IllegalArgumentException("Unsupported checksum size: $size") + } +} diff --git a/network/src/main/kotlin/de/fiereu/network/checksum/Crc16Checksum.kt b/network/src/main/kotlin/de/fiereu/network/checksum/Crc16Checksum.kt new file mode 100644 index 0000000..899b719 --- /dev/null +++ b/network/src/main/kotlin/de/fiereu/network/checksum/Crc16Checksum.kt @@ -0,0 +1,293 @@ +package de.fiereu.network.checksum + +import io.netty.buffer.ByteBuf + +class Crc16Checksum : Checksum { + override val size: Int = 2 + + override fun calculate(data: ByteBuf): ByteArray { + val sum = hash(data) + return byteArrayOf((sum and 0xFF).toByte(), ((sum shr 8) and 0xFF).toByte()) + } + + override fun verify(data: ByteBuf, expected: ByteArray): Boolean { + if (expected.size != size) return false + val actual = hash(data) + val expectedSum = ((expected[1].toInt() and 0xFF) shl 8) or (expected[0].toInt() and 0xFF) + return actual == expectedSum + } + + private fun hash(data: ByteBuf): Int { + var sum = 0 + val end = data.writerIndex() + var i = data.readerIndex() + while (i < end) { + val b = data.getByte(i).toInt() and 0xFF + sum = (sum ushr 8) xor TABLE[(sum xor b) and 0xFF] + i++ + } + return sum and 0xFFFF + } + + companion object { + private val TABLE = + intArrayOf( + 0x0000, + 0xc0c1, + 0xc181, + 0x0140, + 0xc301, + 0x03c0, + 0x0280, + 0xc241, + 0xc601, + 0x06c0, + 0x0780, + 0xc741, + 0x0500, + 0xc5c1, + 0xc481, + 0x0440, + 0xcc01, + 0x0cc0, + 0x0d80, + 0xcd41, + 0x0f00, + 0xcfc1, + 0xce81, + 0x0e40, + 0x0a00, + 0xcac1, + 0xcb81, + 0x0b40, + 0xc901, + 0x09c0, + 0x0880, + 0xc841, + 0xd801, + 0x18c0, + 0x1980, + 0xd941, + 0x1b00, + 0xdbc1, + 0xda81, + 0x1a40, + 0x1e00, + 0xdec1, + 0xdf81, + 0x1f40, + 0xdd01, + 0x1dc0, + 0x1c80, + 0xdc41, + 0x1400, + 0xd4c1, + 0xd581, + 0x1540, + 0xd701, + 0x17c0, + 0x1680, + 0xd641, + 0xd201, + 0x12c0, + 0x1380, + 0xd341, + 0x1100, + 0xd1c1, + 0xd081, + 0x1040, + 0xf001, + 0x30c0, + 0x3180, + 0xf141, + 0x3300, + 0xf3c1, + 0xf281, + 0x3240, + 0x3600, + 0xf6c1, + 0xf781, + 0x3740, + 0xf501, + 0x35c0, + 0x3480, + 0xf441, + 0x3c00, + 0xfcc1, + 0xfd81, + 0x3d40, + 0xff01, + 0x3fc0, + 0x3e80, + 0xfe41, + 0xfa01, + 0x3ac0, + 0x3b80, + 0xfb41, + 0x3900, + 0xf9c1, + 0xf881, + 0x3840, + 0x2800, + 0xe8c1, + 0xe981, + 0x2940, + 0xeb01, + 0x2bc0, + 0x2a80, + 0xea41, + 0xee01, + 0x2ec0, + 0x2f80, + 0xef41, + 0x2d00, + 0xedc1, + 0xec81, + 0x2c40, + 0xe401, + 0x24c0, + 0x2580, + 0xe541, + 0x2700, + 0xe7c1, + 0xe681, + 0x2640, + 0x2200, + 0xe2c1, + 0xe381, + 0x2340, + 0xe101, + 0x21c0, + 0x2080, + 0xe041, + 0xa001, + 0x60c0, + 0x6180, + 0xa141, + 0x6300, + 0xa3c1, + 0xa281, + 0x6240, + 0x6600, + 0xa6c1, + 0xa781, + 0x6740, + 0xa501, + 0x65c0, + 0x6480, + 0xa441, + 0x6c00, + 0xacc1, + 0xad81, + 0x6d40, + 0xaf01, + 0x6fc0, + 0x6e80, + 0xae41, + 0xaa01, + 0x6ac0, + 0x6b80, + 0xab41, + 0x6900, + 0xa9c1, + 0xa881, + 0x6840, + 0x7800, + 0xb8c1, + 0xb981, + 0x7940, + 0xbb01, + 0x7bc0, + 0x7a80, + 0xba41, + 0xbe01, + 0x7ec0, + 0x7f80, + 0xbf41, + 0x7d00, + 0xbdc1, + 0xbc81, + 0x7c40, + 0xb401, + 0x74c0, + 0x7580, + 0xb541, + 0x7700, + 0xb7c1, + 0xb681, + 0x7640, + 0x7200, + 0xb2c1, + 0xb381, + 0x7340, + 0xb101, + 0x71c0, + 0x7080, + 0xb041, + 0x5000, + 0x90c1, + 0x9181, + 0x5140, + 0x9301, + 0x53c0, + 0x5280, + 0x9241, + 0x9601, + 0x56c0, + 0x5780, + 0x9741, + 0x5500, + 0x95c1, + 0x9481, + 0x5440, + 0x9c01, + 0x5cc0, + 0x5d80, + 0x9d41, + 0x5f00, + 0x9fc1, + 0x9e81, + 0x5e40, + 0x5a00, + 0x9ac1, + 0x9b81, + 0x5b40, + 0x9901, + 0x59c0, + 0x5880, + 0x9841, + 0x8801, + 0x48c0, + 0x4980, + 0x8941, + 0x4b00, + 0x8bc1, + 0x8a81, + 0x4a40, + 0x4e00, + 0x8ec1, + 0x8f81, + 0x4f40, + 0x8d01, + 0x4dc0, + 0x4c80, + 0x8c41, + 0x4400, + 0x84c1, + 0x8581, + 0x4540, + 0x8701, + 0x47c0, + 0x4680, + 0x8641, + 0x8201, + 0x42c0, + 0x4380, + 0x8341, + 0x4100, + 0x81c1, + 0x8081, + 0x4040, + ) + } +} diff --git a/network/src/main/kotlin/de/fiereu/network/checksum/HmacSha256Checksum.kt b/network/src/main/kotlin/de/fiereu/network/checksum/HmacSha256Checksum.kt new file mode 100644 index 0000000..b0be66f --- /dev/null +++ b/network/src/main/kotlin/de/fiereu/network/checksum/HmacSha256Checksum.kt @@ -0,0 +1,48 @@ +package de.fiereu.network.checksum + +import io.netty.buffer.ByteBuf +import java.security.MessageDigest +import javax.crypto.Mac +import javax.crypto.spec.SecretKeySpec + +class HmacSha256Checksum( + override val size: Int, + key: ByteArray, +) : Checksum { + + init { + require(size in 4..32) { "HMAC-SHA256 size must be between 4 and 32 bytes" } + } + + private val mac: Mac = + Mac.getInstance("HmacSHA256").also { it.init(SecretKeySpec(key, "HmacSHA256")) } + + private var calculateRound = 0 + private var verifyRound = 0 + + override fun calculate(data: ByteBuf): ByteArray { + val bytes = ByteArray(data.readableBytes()) + data.getBytes(data.readerIndex(), bytes) + mac.update(bytes) + mac.update(roundBytes(calculateRound++)) + return mac.doFinal().copyOfRange(0, size) + } + + override fun verify(data: ByteBuf, expected: ByteArray): Boolean { + if (expected.size != size) return false + val bytes = ByteArray(data.readableBytes()) + data.getBytes(data.readerIndex(), bytes) + mac.update(bytes) + mac.update(roundBytes(verifyRound++)) + val actual = mac.doFinal().copyOfRange(0, size) + return MessageDigest.isEqual(actual, expected) + } + + private fun roundBytes(value: Int): ByteArray = + byteArrayOf( + ((value ushr 24) and 0xFF).toByte(), + ((value ushr 16) and 0xFF).toByte(), + ((value ushr 8) and 0xFF).toByte(), + (value and 0xFF).toByte(), + ) +} diff --git a/network/src/main/kotlin/de/fiereu/network/checksum/NoOpChecksum.kt b/network/src/main/kotlin/de/fiereu/network/checksum/NoOpChecksum.kt new file mode 100644 index 0000000..26f209a --- /dev/null +++ b/network/src/main/kotlin/de/fiereu/network/checksum/NoOpChecksum.kt @@ -0,0 +1,13 @@ +package de.fiereu.network.checksum + +import io.netty.buffer.ByteBuf + +object NoOpChecksum : Checksum { + override val size: Int = 0 + + private val EMPTY = ByteArray(0) + + override fun calculate(data: ByteBuf): ByteArray = EMPTY + + override fun verify(data: ByteBuf, expected: ByteArray): Boolean = true +} diff --git a/network/src/main/kotlin/de/fiereu/network/cipher/AesCtrSessionCipher.kt b/network/src/main/kotlin/de/fiereu/network/cipher/AesCtrSessionCipher.kt new file mode 100644 index 0000000..290e32f --- /dev/null +++ b/network/src/main/kotlin/de/fiereu/network/cipher/AesCtrSessionCipher.kt @@ -0,0 +1,93 @@ +package de.fiereu.network.cipher + +import io.netty.buffer.ByteBuf +import java.security.MessageDigest +import java.security.PrivateKey +import java.security.PublicKey +import javax.crypto.Cipher +import javax.crypto.KeyAgreement +import javax.crypto.spec.IvParameterSpec +import javax.crypto.spec.SecretKeySpec + +class AesCtrSessionCipher +private constructor( + private val encryptCipher: Cipher, + private val decryptCipher: Cipher, +) : SessionCipher { + + enum class Role { + SERVER, + CLIENT + } + + override fun encrypt(input: ByteBuf, output: ByteBuf) { + apply(encryptCipher, input, output) + } + + override fun decrypt(input: ByteBuf, output: ByteBuf) { + apply(decryptCipher, input, output) + } + + private fun apply(cipher: Cipher, input: ByteBuf, output: ByteBuf) { + val len = input.readableBytes() + if (len == 0) return + val src = ByteArray(len) + input.readBytes(src) + val dst = cipher.update(src) ?: return + if (dst.isNotEmpty()) { + output.writeBytes(dst) + } + } + + companion object { + private val IV_SALT = "IVDERIV".toByteArray(Charsets.US_ASCII) + private val CLIENT_KEY_SALT = "KeySalt".toByteArray(Charsets.US_ASCII) + byteArrayOf(1) + private val SERVER_KEY_SALT = "KeySalt".toByteArray(Charsets.US_ASCII) + byteArrayOf(2) + + fun ecdh(localPrivate: PrivateKey, remotePublic: PublicKey): ByteArray { + val agreement = KeyAgreement.getInstance("ECDH") + agreement.init(localPrivate) + agreement.doPhase(remotePublic, true) + return agreement.generateSecret() + } + + fun derive(secret: ByteArray, role: Role): AesCtrSessionCipher { + val (outSeed, inSeed) = directionalSeeds(secret, role) + return AesCtrSessionCipher( + encryptCipher = createCipher(Cipher.ENCRYPT_MODE, outSeed), + decryptCipher = createCipher(Cipher.DECRYPT_MODE, inSeed), + ) + } + + internal fun directionalSeeds(secret: ByteArray, role: Role): Pair { + val clientSeed = tripleHash(secret, CLIENT_KEY_SALT) + val serverSeed = tripleHash(secret, SERVER_KEY_SALT) + return when (role) { + Role.SERVER -> serverSeed to clientSeed + Role.CLIENT -> clientSeed to serverSeed + } + } + + fun derive( + localPrivate: PrivateKey, + remotePublic: PublicKey, + role: Role, + ): AesCtrSessionCipher = derive(ecdh(localPrivate, remotePublic), role) + + internal fun tripleHash(secret: ByteArray, salt: ByteArray): ByteArray { + val sha = MessageDigest.getInstance("SHA-256") + sha.update(salt) + sha.update(secret) + sha.update(salt) + return sha.digest().copyOfRange(0, 16) + } + + private fun createCipher(mode: Int, seed: ByteArray): Cipher { + val cipher = Cipher.getInstance("AES/CTR/NoPadding") + val key = SecretKeySpec(seed, "AES") + val iv = IvParameterSpec(tripleHash(seed, IV_SALT)) + cipher.init(mode, key, iv) + return cipher + } + } +} diff --git a/network/src/main/kotlin/de/fiereu/network/cipher/SessionCipher.kt b/network/src/main/kotlin/de/fiereu/network/cipher/SessionCipher.kt new file mode 100644 index 0000000..6552c16 --- /dev/null +++ b/network/src/main/kotlin/de/fiereu/network/cipher/SessionCipher.kt @@ -0,0 +1,19 @@ +package de.fiereu.network.cipher + +import io.netty.buffer.ByteBuf + +interface SessionCipher { + fun encrypt(input: ByteBuf, output: ByteBuf) + + fun decrypt(input: ByteBuf, output: ByteBuf) +} + +object NoOpSessionCipher : SessionCipher { + override fun encrypt(input: ByteBuf, output: ByteBuf) { + output.writeBytes(input) + } + + override fun decrypt(input: ByteBuf, output: ByteBuf) { + output.writeBytes(input) + } +} diff --git a/network/src/main/kotlin/de/fiereu/network/coroutines/CoroutineProtocolHandler.kt b/network/src/main/kotlin/de/fiereu/network/coroutines/CoroutineProtocolHandler.kt new file mode 100644 index 0000000..3623ec4 --- /dev/null +++ b/network/src/main/kotlin/de/fiereu/network/coroutines/CoroutineProtocolHandler.kt @@ -0,0 +1,84 @@ +package de.fiereu.network.coroutines + +import de.fiereu.network.HandlerRegistrationException +import de.fiereu.network.PacketEvent +import de.fiereu.network.Protocol +import de.fiereu.network.Side +import de.fiereu.network.TypedProtocolHandler +import io.github.oshai.kotlinlogging.KotlinLogging +import io.netty.channel.ChannelHandlerContext +import kotlin.reflect.KClass +import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.Job +import kotlinx.coroutines.channels.Channel +import kotlinx.coroutines.launch + +private val log = KotlinLogging.logger {} + +abstract class CoroutineProtocolHandler

( + protocol: P, + side: Side, + private val coroutineScope: CoroutineScope, +) : TypedProtocolHandler

(protocol, side) { + + private val suspendHandlers = mutableMapOf, suspend (PacketEvent<*>) -> Unit>() + + private val mailbox: Channel> = Channel(Channel.UNLIMITED) + + @Volatile private var consumerJob: Job? = null + + protected inline fun onSuspend( + noinline handler: suspend (PacketEvent) -> Unit, + ) { + registerSuspend(T::class, handler) + } + + @PublishedApi + internal fun registerSuspend( + type: KClass, + handler: suspend (PacketEvent) -> Unit, + ) { + if (isRegistered(type) || suspendHandlers.containsKey(type)) { + throw HandlerRegistrationException( + "Duplicate handler registration for ${type.simpleName}", + ) + } + @Suppress("UNCHECKED_CAST") + suspendHandlers[type] = handler as suspend (PacketEvent<*>) -> Unit + } + + override fun handlerAdded(ctx: ChannelHandlerContext) { + super.handlerAdded(ctx) + consumerJob = + coroutineScope.launch { + for (event in mailbox) { + val handler = suspendHandlers[event.packet::class] ?: continue + try { + handler(event) + } catch (t: Throwable) { + log.warn(t) { "Suspend handler for ${event.packet::class.simpleName} threw" } + ctx.executor().execute { onError(t) } + } + } + } + } + + override fun handlerRemoved(ctx: ChannelHandlerContext) { + mailbox.close() + consumerJob?.cancel() + consumerJob = null + } + + override fun isRegistered(type: KClass<*>): Boolean = + super.isRegistered(type) || suspendHandlers.containsKey(type) + + final override fun tryHandleAlternate(event: PacketEvent<*>): Boolean { + if (event.packet::class !in suspendHandlers) return false + val result = mailbox.trySend(event) + if (!result.isSuccess) { + log.warn { "Mailbox rejected packet ${event.packet::class.simpleName}" } + onError(IllegalStateException("Coroutine mailbox closed")) + } + return true + } +} diff --git a/network/src/main/kotlin/de/fiereu/network/handlers/ChecksumFrameDecoder.kt b/network/src/main/kotlin/de/fiereu/network/handlers/ChecksumFrameDecoder.kt new file mode 100644 index 0000000..b8c7d5a --- /dev/null +++ b/network/src/main/kotlin/de/fiereu/network/handlers/ChecksumFrameDecoder.kt @@ -0,0 +1,33 @@ +package de.fiereu.network.handlers + +import de.fiereu.network.ChecksumMismatchException +import de.fiereu.network.checksum.Checksum +import io.netty.buffer.ByteBuf +import io.netty.channel.ChannelHandlerContext +import io.netty.handler.codec.ByteToMessageDecoder + +class ChecksumFrameDecoder(@Volatile var checksum: Checksum) : ByteToMessageDecoder() { + + override fun decode(ctx: ChannelHandlerContext, buffer: ByteBuf, out: MutableList) { + val checksum = this.checksum + val tagSize = checksum.size + val total = buffer.readableBytes() + if (tagSize == 0) { + out += buffer.readRetainedSlice(total) + return + } + if (total < tagSize) { + throw ChecksumMismatchException() + } + val payloadSize = total - tagSize + val expected = ByteArray(tagSize) + buffer.getBytes(buffer.readerIndex() + payloadSize, expected) + val payload = buffer.slice(buffer.readerIndex(), payloadSize) + if (!checksum.verify(payload, expected)) { + buffer.skipBytes(total) + throw ChecksumMismatchException() + } + out += payload.retain() + buffer.skipBytes(total) + } +} diff --git a/network/src/main/kotlin/de/fiereu/network/handlers/ChecksumFrameEncoder.kt b/network/src/main/kotlin/de/fiereu/network/handlers/ChecksumFrameEncoder.kt new file mode 100644 index 0000000..3012bd5 --- /dev/null +++ b/network/src/main/kotlin/de/fiereu/network/handlers/ChecksumFrameEncoder.kt @@ -0,0 +1,19 @@ +package de.fiereu.network.handlers + +import de.fiereu.network.checksum.Checksum +import io.netty.buffer.ByteBuf +import io.netty.channel.ChannelHandlerContext +import io.netty.handler.codec.MessageToByteEncoder + +class ChecksumFrameEncoder(@Volatile var checksum: Checksum) : MessageToByteEncoder() { + + override fun encode(ctx: ChannelHandlerContext, msg: ByteBuf, out: ByteBuf) { + val checksum = this.checksum + val len = msg.readableBytes() + val tag = if (checksum.size > 0) checksum.calculate(msg) else null + out.writeBytes(msg, msg.readerIndex(), len) + if (tag != null) { + out.writeBytes(tag) + } + } +} diff --git a/network/src/main/kotlin/de/fiereu/network/handlers/CipherDecoder.kt b/network/src/main/kotlin/de/fiereu/network/handlers/CipherDecoder.kt new file mode 100644 index 0000000..4935e62 --- /dev/null +++ b/network/src/main/kotlin/de/fiereu/network/handlers/CipherDecoder.kt @@ -0,0 +1,21 @@ +package de.fiereu.network.handlers + +import de.fiereu.network.cipher.SessionCipher +import io.netty.buffer.ByteBuf +import io.netty.channel.ChannelHandlerContext +import io.netty.handler.codec.ByteToMessageDecoder + +class CipherDecoder(@Volatile var cipher: SessionCipher) : ByteToMessageDecoder() { + + override fun decode(ctx: ChannelHandlerContext, buffer: ByteBuf, out: MutableList) { + val len = buffer.readableBytes() + if (len == 0) return + val output = ctx.alloc().buffer(len) + try { + cipher.decrypt(buffer, output) + out += output.retain() + } finally { + output.release() + } + } +} diff --git a/network/src/main/kotlin/de/fiereu/network/handlers/CipherEncoder.kt b/network/src/main/kotlin/de/fiereu/network/handlers/CipherEncoder.kt new file mode 100644 index 0000000..e1273f8 --- /dev/null +++ b/network/src/main/kotlin/de/fiereu/network/handlers/CipherEncoder.kt @@ -0,0 +1,13 @@ +package de.fiereu.network.handlers + +import de.fiereu.network.cipher.SessionCipher +import io.netty.buffer.ByteBuf +import io.netty.channel.ChannelHandlerContext +import io.netty.handler.codec.MessageToByteEncoder + +class CipherEncoder(@Volatile var cipher: SessionCipher) : MessageToByteEncoder() { + + override fun encode(ctx: ChannelHandlerContext, msg: ByteBuf, out: ByteBuf) { + cipher.encrypt(msg, out) + } +} diff --git a/network/src/main/kotlin/de/fiereu/network/handlers/CompressionDecoder.kt b/network/src/main/kotlin/de/fiereu/network/handlers/CompressionDecoder.kt new file mode 100644 index 0000000..13ff327 --- /dev/null +++ b/network/src/main/kotlin/de/fiereu/network/handlers/CompressionDecoder.kt @@ -0,0 +1,47 @@ +package de.fiereu.network.handlers + +import io.netty.buffer.ByteBuf +import io.netty.channel.ChannelHandlerContext +import io.netty.handler.codec.ByteToMessageDecoder +import java.util.zip.Inflater + +class CompressionDecoder : ByteToMessageDecoder() { + + private val inflater = Inflater(true) + + override fun decode(ctx: ChannelHandlerContext, buffer: ByteBuf, out: MutableList) { + if (buffer.readableBytes() < 2) return + val opcode = buffer.readByte() + val flag = buffer.readByte().toInt() + val payloadLen = buffer.readableBytes() + val output = ctx.alloc().buffer(payloadLen * 2 + 1) + try { + output.writeByte(opcode.toInt()) + if (flag == 0) { + output.writeBytes(buffer, buffer.readerIndex(), payloadLen) + buffer.skipBytes(payloadLen) + } else { + val input = ByteArray(payloadLen) + buffer.readBytes(input) + inflater.reset() + inflater.setInput(input) + val chunk = ByteArray(0x4000) + while (!inflater.finished() && !inflater.needsInput()) { + val written = inflater.inflate(chunk) + if (written == 0) break + output.writeBytes(chunk, 0, written) + } + if (output.readableBytes() >= 2) { + output.writerIndex(output.writerIndex() - 2) + } + } + out += output.retain() + } finally { + output.release() + } + } + + override fun handlerRemoved0(ctx: ChannelHandlerContext) { + inflater.end() + } +} diff --git a/network/src/main/kotlin/de/fiereu/network/handlers/CompressionEncoder.kt b/network/src/main/kotlin/de/fiereu/network/handlers/CompressionEncoder.kt new file mode 100644 index 0000000..bbbf76a --- /dev/null +++ b/network/src/main/kotlin/de/fiereu/network/handlers/CompressionEncoder.kt @@ -0,0 +1,42 @@ +package de.fiereu.network.handlers + +import io.netty.buffer.ByteBuf +import io.netty.channel.ChannelHandlerContext +import io.netty.handler.codec.MessageToByteEncoder +import java.util.zip.Deflater + +class CompressionEncoder(private val threshold: Int = 256) : MessageToByteEncoder() { + + private val deflater = Deflater(Deflater.DEFAULT_COMPRESSION, true) + + override fun encode(ctx: ChannelHandlerContext, msg: ByteBuf, out: ByteBuf) { + if (msg.readableBytes() < 1) return + val opcode = msg.readByte() + out.writeByte(opcode.toInt()) + val payloadLen = msg.readableBytes() + if (payloadLen < threshold) { + out.writeByte(0) + out.writeBytes(msg, msg.readerIndex(), payloadLen) + msg.skipBytes(payloadLen) + return + } + val input = ByteArray(payloadLen + 2) + msg.getBytes(msg.readerIndex(), input, 0, payloadLen) + input[payloadLen] = 0xFF.toByte() + input[payloadLen + 1] = 0xFF.toByte() + msg.skipBytes(payloadLen) + out.writeByte(1) + deflater.reset() + deflater.setInput(input) + val chunk = ByteArray(0x4000) + while (true) { + val written = deflater.deflate(chunk, 0, chunk.size, Deflater.SYNC_FLUSH) + if (written == 0) break + out.writeBytes(chunk, 0, written) + } + } + + override fun handlerRemoved(ctx: ChannelHandlerContext) { + deflater.end() + } +} diff --git a/network/src/main/kotlin/de/fiereu/network/handlers/PacketFrameDecoder.kt b/network/src/main/kotlin/de/fiereu/network/handlers/PacketFrameDecoder.kt new file mode 100644 index 0000000..5d9765d --- /dev/null +++ b/network/src/main/kotlin/de/fiereu/network/handlers/PacketFrameDecoder.kt @@ -0,0 +1,15 @@ +package de.fiereu.network.handlers + +import io.netty.handler.codec.LengthFieldBasedFrameDecoder +import java.nio.ByteOrder + +class PacketFrameDecoder(maxFrameLength: Int = 0xFFFF) : + LengthFieldBasedFrameDecoder( + ByteOrder.LITTLE_ENDIAN, + maxFrameLength, + 0, + UShort.SIZE_BYTES, + -UShort.SIZE_BYTES, + UShort.SIZE_BYTES, + false, + ) diff --git a/network/src/main/kotlin/de/fiereu/network/handlers/PacketFrameEncoder.kt b/network/src/main/kotlin/de/fiereu/network/handlers/PacketFrameEncoder.kt new file mode 100644 index 0000000..9185edb --- /dev/null +++ b/network/src/main/kotlin/de/fiereu/network/handlers/PacketFrameEncoder.kt @@ -0,0 +1,12 @@ +package de.fiereu.network.handlers + +import io.netty.handler.codec.LengthFieldPrepender +import java.nio.ByteOrder + +class PacketFrameEncoder : + LengthFieldPrepender( + ByteOrder.LITTLE_ENDIAN, + UShort.SIZE_BYTES, + 0, + true, + ) diff --git a/network/src/main/kotlin/de/fiereu/network/handshake/ClientSessionHandshakeHandler.kt b/network/src/main/kotlin/de/fiereu/network/handshake/ClientSessionHandshakeHandler.kt new file mode 100644 index 0000000..e329b96 --- /dev/null +++ b/network/src/main/kotlin/de/fiereu/network/handshake/ClientSessionHandshakeHandler.kt @@ -0,0 +1,76 @@ +package de.fiereu.network.handshake + +import de.fiereu.network.InvalidServerSignatureException +import de.fiereu.network.PipelineNames +import de.fiereu.network.PipelineOptions +import de.fiereu.network.Protocol +import de.fiereu.network.ProtocolHandler +import de.fiereu.network.SessionPhase +import de.fiereu.network.Side +import de.fiereu.network.TypedProtocolHandler +import de.fiereu.network.cipher.AesCtrSessionCipher +import de.fiereu.network.handlers.ChecksumFrameDecoder +import de.fiereu.network.handlers.ChecksumFrameEncoder +import de.fiereu.network.handlers.CipherDecoder +import de.fiereu.network.handlers.CipherEncoder +import de.fiereu.network.handlers.CompressionDecoder +import de.fiereu.network.internal.MutableSessionContext +import io.github.oshai.kotlinlogging.KotlinLogging +import java.security.interfaces.ECPublicKey + +private val log = KotlinLogging.logger {} + +internal class ClientSessionHandshakeHandler( + private val rootPublic: ECPublicKey, + private val applicationProtocol: Protocol, + private val applicationHandlerFactory: () -> ProtocolHandler, + private val options: PipelineOptions, +) : TypedProtocolHandler(SessionHandshakeProtocol, Side.CLIENT) { + + private val ephemeralKeyPair = EcKeys.generateEphemeralKeyPair() + + override fun onActive() { + session.send(ClientHelloPacket(timestamp = System.currentTimeMillis())) + } + + init { + on { event -> + val publicBytes = EcKeys.toUncompressedPoint(event.packet.ephemeralPublic) + if (!EcKeys.verify(rootPublic, publicBytes, event.packet.signature)) { + throw InvalidServerSignatureException() + } + val crypto = + SessionCryptoState.derive( + localPrivate = ephemeralKeyPair.private, + remotePublic = event.packet.ephemeralPublic, + role = AesCtrSessionCipher.Role.CLIENT, + checksumSize = event.packet.checksumSize, + ) + event.session.send( + ClientReadyPacket(ephemeralPublic = ephemeralKeyPair.public as ECPublicKey), + ) + val pipeline = event.session.channel.pipeline() + (pipeline.get(PipelineNames.CHECKSUM_DECODER) as ChecksumFrameDecoder).checksum = + crypto.incomingChecksum + (pipeline.get(PipelineNames.CHECKSUM_ENCODER) as ChecksumFrameEncoder).checksum = + crypto.outgoingChecksum + (pipeline.get(PipelineNames.CIPHER_DECODER) as CipherDecoder).cipher = crypto.cipher + (pipeline.get(PipelineNames.CIPHER_ENCODER) as CipherEncoder).cipher = crypto.cipher + if (applicationProtocol.compressed) { + pipeline.addBefore( + PipelineNames.PROTOCOL_HANDLER, + PipelineNames.COMPRESSION_DECODER, + CompressionDecoder(), + ) + } + val appHandler = applicationHandlerFactory() + pipeline.replace( + PipelineNames.PROTOCOL_HANDLER, + PipelineNames.PROTOCOL_HANDLER, + appHandler, + ) + (event.session as MutableSessionContext).transitionTo(SessionPhase.ESTABLISHED) + log.debug { "Client handshake complete with ${event.session.remoteAddress}" } + } + } +} diff --git a/network/src/main/kotlin/de/fiereu/network/handshake/EcKeys.kt b/network/src/main/kotlin/de/fiereu/network/handshake/EcKeys.kt new file mode 100644 index 0000000..f85cfa6 --- /dev/null +++ b/network/src/main/kotlin/de/fiereu/network/handshake/EcKeys.kt @@ -0,0 +1,78 @@ +package de.fiereu.network.handshake + +import java.math.BigInteger +import java.security.AlgorithmParameters +import java.security.KeyFactory +import java.security.KeyPair +import java.security.KeyPairGenerator +import java.security.Signature +import java.security.interfaces.ECPrivateKey +import java.security.interfaces.ECPublicKey +import java.security.spec.ECGenParameterSpec +import java.security.spec.ECParameterSpec +import java.security.spec.ECPoint +import java.security.spec.ECPublicKeySpec + +internal object EcKeys { + private const val UNCOMPRESSED_INDICATOR: Byte = 0x04 + private const val CURVE = "secp256r1" + private val keyFactory = KeyFactory.getInstance("EC") + private val parameters: ECParameterSpec by lazy { + val params = AlgorithmParameters.getInstance("EC") + params.init(ECGenParameterSpec(CURVE)) + params.getParameterSpec(ECParameterSpec::class.java) + } + private val keyByteLength: Int by lazy { + (parameters.order.bitLength() + Byte.SIZE_BITS - 1) / Byte.SIZE_BITS + } + + fun generateEphemeralKeyPair(): KeyPair { + val gen = KeyPairGenerator.getInstance("EC") + gen.initialize(ECGenParameterSpec(CURVE)) + return gen.generateKeyPair() + } + + fun toUncompressedPoint(key: ECPublicKey): ByteArray { + val point = key.w + val keyLength = keyByteLength + val data = ByteArray(1 + 2 * keyLength) + data[0] = UNCOMPRESSED_INDICATOR + writeFieldInto(data, 1, point.affineX.toByteArray(), keyLength) + writeFieldInto(data, 1 + keyLength, point.affineY.toByteArray(), keyLength) + return data + } + + fun fromUncompressedPoint(bytes: ByteArray): ECPublicKey { + require(bytes.isNotEmpty() && bytes[0] == UNCOMPRESSED_INDICATOR) { + "Invalid uncompressed point indicator" + } + val keyLength = keyByteLength + require(bytes.size == 1 + 2 * keyLength) { "Invalid EC point length: ${bytes.size}" } + val x = BigInteger(1, bytes.copyOfRange(1, 1 + keyLength)) + val y = BigInteger(1, bytes.copyOfRange(1 + keyLength, 1 + 2 * keyLength)) + return keyFactory.generatePublic(ECPublicKeySpec(ECPoint(x, y), parameters)) as ECPublicKey + } + + private fun writeFieldInto(dst: ByteArray, offset: Int, src: ByteArray, length: Int) { + when { + src.size <= length -> System.arraycopy(src, 0, dst, offset + length - src.size, src.size) + src.size == length + 1 && src[0] == 0.toByte() -> + System.arraycopy(src, 1, dst, offset, length) + else -> error("EC coordinate too large: ${src.size}") + } + } + + fun sign(privateKey: ECPrivateKey, data: ByteArray): ByteArray { + val sig = Signature.getInstance("SHA256withECDSA") + sig.initSign(privateKey) + sig.update(data) + return sig.sign() + } + + fun verify(publicKey: ECPublicKey, data: ByteArray, signature: ByteArray): Boolean { + val sig = Signature.getInstance("SHA256withECDSA") + sig.initVerify(publicKey) + sig.update(data) + return sig.verify(signature) + } +} diff --git a/network/src/main/kotlin/de/fiereu/network/handshake/HandshakePackets.kt b/network/src/main/kotlin/de/fiereu/network/handshake/HandshakePackets.kt new file mode 100644 index 0000000..58397f3 --- /dev/null +++ b/network/src/main/kotlin/de/fiereu/network/handshake/HandshakePackets.kt @@ -0,0 +1,69 @@ +package de.fiereu.network.handshake + +import de.fiereu.bytecodec.CodecScope +import de.fiereu.bytecodec.PacketCodec +import de.fiereu.bytecodec.S64LE +import de.fiereu.bytecodec.U16LE +import de.fiereu.bytecodec.U8 +import de.fiereu.bytecodec.bytesPrefixed +import java.security.interfaces.ECPublicKey +import kotlin.random.Random + +private const val XOR_KEY_RANDOM = 3214621489648854472L +private const val XOR_KEY_TIMESTAMP = -4214651440992349575L + +data class ClientHelloPacket(val timestamp: Long) + +data class ServerHelloPacket( + val ephemeralPublic: ECPublicKey, + val signature: ByteArray, + val checksumSize: Int, +) { + override fun equals(other: Any?): Boolean = + other is ServerHelloPacket && + ephemeralPublic == other.ephemeralPublic && + signature.contentEquals(other.signature) && + checksumSize == other.checksumSize + + override fun hashCode(): Int = + (ephemeralPublic.hashCode() * 31 + signature.contentHashCode()) * 31 + checksumSize +} + +data class ClientReadyPacket(val ephemeralPublic: ECPublicKey) + +object ClientHelloCodec : PacketCodec() { + override fun CodecScope.body(): ClientHelloPacket { + var random = 0L + val xoredRandom = + field(S64LE) { + random = Random.nextLong() + random xor XOR_KEY_RANDOM + } + val xoredTimestamp = field(S64LE) { it.timestamp xor XOR_KEY_TIMESTAMP xor random } + val readRandom = xoredRandom xor XOR_KEY_RANDOM + val timestamp = xoredTimestamp xor XOR_KEY_TIMESTAMP xor readRandom + return ClientHelloPacket(timestamp) + } +} + +private val LengthPrefixedBytes = bytesPrefixed(U16LE) + +object ServerHelloCodec : PacketCodec() { + override fun CodecScope.body(): ServerHelloPacket { + val pubKey = field(LengthPrefixedBytes) { EcKeys.toUncompressedPoint(it.ephemeralPublic) } + val signature = field(LengthPrefixedBytes, ServerHelloPacket::signature) + val checksumSize = field(U8, ServerHelloPacket::checksumSize) + return ServerHelloPacket( + ephemeralPublic = EcKeys.fromUncompressedPoint(pubKey), + signature = signature, + checksumSize = checksumSize, + ) + } +} + +object ClientReadyCodec : PacketCodec() { + override fun CodecScope.body(): ClientReadyPacket { + val bytes = field(LengthPrefixedBytes) { EcKeys.toUncompressedPoint(it.ephemeralPublic) } + return ClientReadyPacket(EcKeys.fromUncompressedPoint(bytes)) + } +} diff --git a/network/src/main/kotlin/de/fiereu/network/handshake/ServerSessionHandshakeHandler.kt b/network/src/main/kotlin/de/fiereu/network/handshake/ServerSessionHandshakeHandler.kt new file mode 100644 index 0000000..4ea310f --- /dev/null +++ b/network/src/main/kotlin/de/fiereu/network/handshake/ServerSessionHandshakeHandler.kt @@ -0,0 +1,85 @@ +package de.fiereu.network.handshake + +import de.fiereu.network.PipelineNames +import de.fiereu.network.PipelineOptions +import de.fiereu.network.Protocol +import de.fiereu.network.ProtocolHandler +import de.fiereu.network.SessionPhase +import de.fiereu.network.Side +import de.fiereu.network.StaleClientHelloException +import de.fiereu.network.TypedProtocolHandler +import de.fiereu.network.cipher.AesCtrSessionCipher +import de.fiereu.network.handlers.ChecksumFrameDecoder +import de.fiereu.network.handlers.ChecksumFrameEncoder +import de.fiereu.network.handlers.CipherDecoder +import de.fiereu.network.handlers.CipherEncoder +import de.fiereu.network.handlers.CompressionEncoder +import de.fiereu.network.internal.MutableSessionContext +import io.github.oshai.kotlinlogging.KotlinLogging +import java.security.interfaces.ECPrivateKey +import kotlin.math.abs + +private val log = KotlinLogging.logger {} + +internal class ServerSessionHandshakeHandler( + private val rootPrivate: ECPrivateKey, + private val applicationProtocol: Protocol, + private val applicationHandlerFactory: () -> ProtocolHandler, + private val options: PipelineOptions, +) : TypedProtocolHandler(SessionHandshakeProtocol, Side.SERVER) { + + private val ephemeralKeyPair = EcKeys.generateEphemeralKeyPair() + + init { + on { event -> + val skew = abs(System.currentTimeMillis() - event.packet.timestamp) + if (skew > options.maxHelloSkew.inWholeMilliseconds) { + throw StaleClientHelloException(skew) + } + val publicBytes = + EcKeys.toUncompressedPoint( + ephemeralKeyPair.public as java.security.interfaces.ECPublicKey, + ) + val signature = EcKeys.sign(rootPrivate, publicBytes) + event.session.send( + ServerHelloPacket( + ephemeralPublic = ephemeralKeyPair.public as java.security.interfaces.ECPublicKey, + signature = signature, + checksumSize = options.checksumSize, + ), + ) + } + + on { event -> + val crypto = + SessionCryptoState.derive( + localPrivate = ephemeralKeyPair.private, + remotePublic = event.packet.ephemeralPublic, + role = AesCtrSessionCipher.Role.SERVER, + checksumSize = options.checksumSize, + ) + val pipeline = event.session.channel.pipeline() + (pipeline.get(PipelineNames.CHECKSUM_DECODER) as ChecksumFrameDecoder).checksum = + crypto.incomingChecksum + (pipeline.get(PipelineNames.CHECKSUM_ENCODER) as ChecksumFrameEncoder).checksum = + crypto.outgoingChecksum + (pipeline.get(PipelineNames.CIPHER_DECODER) as CipherDecoder).cipher = crypto.cipher + (pipeline.get(PipelineNames.CIPHER_ENCODER) as CipherEncoder).cipher = crypto.cipher + if (applicationProtocol.compressed) { + pipeline.addBefore( + PipelineNames.PROTOCOL_HANDLER, + PipelineNames.COMPRESSION_ENCODER, + CompressionEncoder(options.compressionThreshold), + ) + } + val appHandler = applicationHandlerFactory() + pipeline.replace( + PipelineNames.PROTOCOL_HANDLER, + PipelineNames.PROTOCOL_HANDLER, + appHandler, + ) + (event.session as MutableSessionContext).transitionTo(SessionPhase.ESTABLISHED) + log.debug { "Handshake complete for ${event.session.remoteAddress}" } + } + } +} diff --git a/network/src/main/kotlin/de/fiereu/network/handshake/SessionCryptoState.kt b/network/src/main/kotlin/de/fiereu/network/handshake/SessionCryptoState.kt new file mode 100644 index 0000000..e595c23 --- /dev/null +++ b/network/src/main/kotlin/de/fiereu/network/handshake/SessionCryptoState.kt @@ -0,0 +1,32 @@ +package de.fiereu.network.handshake + +import de.fiereu.network.checksum.Checksum +import de.fiereu.network.checksum.ChecksumFactory +import de.fiereu.network.cipher.AesCtrSessionCipher +import de.fiereu.network.cipher.SessionCipher +import java.security.PrivateKey +import java.security.PublicKey + +internal class SessionCryptoState( + val cipher: SessionCipher, + val incomingChecksum: Checksum, + val outgoingChecksum: Checksum, +) { + companion object { + fun derive( + localPrivate: PrivateKey, + remotePublic: PublicKey, + role: AesCtrSessionCipher.Role, + checksumSize: Int, + ): SessionCryptoState { + val secret = AesCtrSessionCipher.ecdh(localPrivate, remotePublic) + val cipher = AesCtrSessionCipher.derive(secret, role) + val (outSeed, inSeed) = AesCtrSessionCipher.directionalSeeds(secret, role) + return SessionCryptoState( + cipher = cipher, + incomingChecksum = ChecksumFactory.create(checksumSize, inSeed), + outgoingChecksum = ChecksumFactory.create(checksumSize, outSeed), + ) + } + } +} diff --git a/network/src/main/kotlin/de/fiereu/network/handshake/SessionHandshakeProtocol.kt b/network/src/main/kotlin/de/fiereu/network/handshake/SessionHandshakeProtocol.kt new file mode 100644 index 0000000..e6b94ae --- /dev/null +++ b/network/src/main/kotlin/de/fiereu/network/handshake/SessionHandshakeProtocol.kt @@ -0,0 +1,11 @@ +package de.fiereu.network.handshake + +import de.fiereu.network.Protocol + +object SessionHandshakeProtocol : Protocol() { + init { + bidi(0x00u, ClientHelloCodec, ClientHelloPacket::class) + bidi(0x01u, ServerHelloCodec, ServerHelloPacket::class) + bidi(0x02u, ClientReadyCodec, ClientReadyPacket::class) + } +} diff --git a/network/src/main/kotlin/de/fiereu/network/internal/MutableSessionContext.kt b/network/src/main/kotlin/de/fiereu/network/internal/MutableSessionContext.kt new file mode 100644 index 0000000..1c74bc5 --- /dev/null +++ b/network/src/main/kotlin/de/fiereu/network/internal/MutableSessionContext.kt @@ -0,0 +1,110 @@ +package de.fiereu.network.internal + +import de.fiereu.network.Protocol +import de.fiereu.network.SessionAttribute +import de.fiereu.network.SessionAttributes +import de.fiereu.network.SessionContext +import de.fiereu.network.SessionPhase +import de.fiereu.network.Side +import io.github.oshai.kotlinlogging.KotlinLogging +import io.netty.channel.Channel +import io.netty.channel.ChannelFuture +import io.netty.util.AttributeKey +import java.net.SocketAddress +import java.time.Instant +import java.util.concurrent.ConcurrentHashMap + +private val log = KotlinLogging.logger {} + +internal val SESSION_KEY: AttributeKey = + AttributeKey.valueOf("de.fiereu.network.session") + +internal class MutableSessionContext( + override val side: Side, + override val channel: Channel, + internal val applicationProtocol: Protocol, +) : SessionContext { + + override val remoteAddress: SocketAddress + get() = channel.remoteAddress() + + @Volatile + override var phase: SessionPhase = SessionPhase.HANDSHAKE + private set + + @Volatile + override var handshakeCompletedAt: Instant? = null + private set + + override val attributes: SessionAttributes = ConcurrentAttributes() + + private val listenersLock = Any() + private val listeners = mutableMapOf Unit>>() + + internal fun transitionTo(next: SessionPhase) { + val toFire: List<() -> Unit> + synchronized(listenersLock) { + if (phase == next) return + phase = next + if (next == SessionPhase.ESTABLISHED) { + handshakeCompletedAt = Instant.now() + } + toFire = listeners[next]?.toList() ?: emptyList() + } + for (listener in toFire) { + try { + listener() + } catch (t: Throwable) { + log.warn(t) { "Phase listener for $next threw" } + } + } + } + + override fun send(packet: Any): ChannelFuture = channel.writeAndFlush(packet) + + override fun close(reason: () -> String) { + val message = reason() + log.debug { "Closing session $remoteAddress: $message" } + channel.close() + } + + override fun onPhase(phase: SessionPhase, listener: () -> Unit) { + val fireNow: Boolean + synchronized(listenersLock) { + if (this.phase == phase) { + fireNow = true + } else { + fireNow = false + listeners.getOrPut(phase) { mutableListOf() } += listener + } + } + if (fireNow) { + listener() + } + } +} + +internal data class OutgoingPacket( + val registration: Protocol.Registration<*>, + val value: Any, +) + +private class ConcurrentAttributes : SessionAttributes { + private val map = ConcurrentHashMap, Any>() + + @Suppress("UNCHECKED_CAST") + override fun get(key: SessionAttribute): T? = map[key] as T? + + override fun set(key: SessionAttribute, value: T) { + map[key] = value + } + + @Suppress("UNCHECKED_CAST") + override fun remove(key: SessionAttribute): T? = map.remove(key) as T? + + @Suppress("UNCHECKED_CAST") + override fun getOrPut(key: SessionAttribute, default: () -> T): T = + map.getOrPut(key) { default() } as T + + override fun contains(key: SessionAttribute<*>): Boolean = map.containsKey(key) +} diff --git a/network/src/test/kotlin/de/fiereu/network/NettyBuffersTest.kt b/network/src/test/kotlin/de/fiereu/network/NettyBuffersTest.kt new file mode 100644 index 0000000..5e7e7da --- /dev/null +++ b/network/src/test/kotlin/de/fiereu/network/NettyBuffersTest.kt @@ -0,0 +1,30 @@ +package de.fiereu.network + +import io.kotest.core.spec.style.FunSpec +import io.kotest.matchers.shouldBe +import io.netty.buffer.Unpooled + +class NettyBuffersTest : + FunSpec({ + test("NettyReadBuffer matches ByteBuf state") { + val buf = Unpooled.wrappedBuffer(byteArrayOf(1, 2, 3, 4)) + val read = NettyReadBuffer(buf) + read.readByte() shouldBe 1 + read.remaining() shouldBe 3 + val dst = ByteArray(2) + read.readBytes(dst) + dst shouldBe byteArrayOf(2, 3) + read.skip(1) + read.remaining() shouldBe 0 + } + + test("NettyWriteBuffer writes through to ByteBuf") { + val buf = Unpooled.buffer() + val write = NettyWriteBuffer(buf) + write.writeByte(0xAB.toByte()) + write.writeBytes(byteArrayOf(0xCD.toByte(), 0xEF.toByte())) + val read = ByteArray(3) + buf.readBytes(read) + read shouldBe byteArrayOf(0xAB.toByte(), 0xCD.toByte(), 0xEF.toByte()) + } + }) diff --git a/network/src/test/kotlin/de/fiereu/network/ProtocolTest.kt b/network/src/test/kotlin/de/fiereu/network/ProtocolTest.kt new file mode 100644 index 0000000..5a80302 --- /dev/null +++ b/network/src/test/kotlin/de/fiereu/network/ProtocolTest.kt @@ -0,0 +1,73 @@ +package de.fiereu.network + +import de.fiereu.bytecodec.CodecScope +import de.fiereu.bytecodec.PacketCodec +import de.fiereu.bytecodec.U16LE +import de.fiereu.bytecodec.U8 +import io.kotest.assertions.throwables.shouldThrow +import io.kotest.core.spec.style.FunSpec +import io.kotest.matchers.shouldBe + +private data class Hello(val n: Int) + +private data class World(val n: Int) + +private object HelloCodec : PacketCodec() { + override fun CodecScope.body() = Hello(field(U16LE, Hello::n)) +} + +private object WorldCodec : PacketCodec() { + override fun CodecScope.body() = World(field(U8, World::n)) +} + +private data class Beep(val n: Int) + +private object BeepCodec : PacketCodec() { + override fun CodecScope.body() = Beep(field(U16LE, Beep::n)) +} + +private object SampleProtocol : Protocol() { + init { + c2s(0x10u, HelloCodec) + s2c(0x20u, WorldCodec) + bidi(0x30u, BeepCodec) + } +} + +class ProtocolTest : + FunSpec({ + test("incoming lookup depends on side") { + SampleProtocol.incomingCodec(Side.SERVER, 0x10u) shouldBe HelloCodec + SampleProtocol.incomingCodec(Side.CLIENT, 0x10u) shouldBe null + SampleProtocol.incomingCodec(Side.CLIENT, 0x20u) shouldBe WorldCodec + } + + test("outgoing lookup depends on side") { + SampleProtocol.outgoingRegistration(Side.CLIENT, Hello::class)?.opcode shouldBe 0x10u + SampleProtocol.outgoingRegistration(Side.SERVER, World::class)?.opcode shouldBe 0x20u + } + + test("bidi registers both directions") { + SampleProtocol.incomingCodec(Side.SERVER, 0x30u) shouldBe BeepCodec + SampleProtocol.incomingCodec(Side.CLIENT, 0x30u) shouldBe BeepCodec + SampleProtocol.outgoingRegistration(Side.SERVER, Beep::class)?.opcode shouldBe 0x30u + SampleProtocol.outgoingRegistration(Side.CLIENT, Beep::class)?.opcode shouldBe 0x30u + } + + test("duplicate registration throws") { + shouldThrow { + object : Protocol() { + init { + c2s(0x01u, HelloCodec) + c2s(0x02u, HelloCodec) + } + } + } + } + + test("Direction.isIncomingFor") { + Direction.C2S.isIncomingFor(Side.SERVER) shouldBe true + Direction.C2S.isIncomingFor(Side.CLIENT) shouldBe false + Direction.S2C.isIncomingFor(Side.CLIENT) shouldBe true + } + }) diff --git a/network/src/test/kotlin/de/fiereu/network/TypedProtocolHandlerTest.kt b/network/src/test/kotlin/de/fiereu/network/TypedProtocolHandlerTest.kt new file mode 100644 index 0000000..a9c29ff --- /dev/null +++ b/network/src/test/kotlin/de/fiereu/network/TypedProtocolHandlerTest.kt @@ -0,0 +1,133 @@ +package de.fiereu.network + +import de.fiereu.bytecodec.CodecScope +import de.fiereu.bytecodec.PacketCodec +import de.fiereu.bytecodec.U16LE +import de.fiereu.network.internal.MutableSessionContext +import de.fiereu.network.internal.OutgoingPacket +import de.fiereu.network.internal.SESSION_KEY +import io.kotest.assertions.throwables.shouldThrow +import io.kotest.core.spec.style.FunSpec +import io.kotest.matchers.shouldBe +import io.netty.buffer.ByteBuf +import io.netty.buffer.Unpooled +import io.netty.channel.embedded.EmbeddedChannel + +private data class Ping(val n: Int) + +private data class Pong(val n: Int) + +private object PingCodec : PacketCodec() { + override fun CodecScope.body() = Ping(field(U16LE, Ping::n)) +} + +private object PongCodec : PacketCodec() { + override fun CodecScope.body() = Pong(field(U16LE, Pong::n)) +} + +private object PingPongProtocol : Protocol() { + init { + c2s(0xA0u, PingCodec) + s2c(0xA1u, PongCodec) + } +} + +private class ServerHandler : + TypedProtocolHandler(PingPongProtocol, Side.SERVER) { + val seen = mutableListOf() + + init { + on { event -> + seen += event.packet + event.session.send(Pong(event.packet.n + 1)) + } + } +} + +private fun channelWithHandler(handler: ProtocolHandler): EmbeddedChannel { + val channel = EmbeddedChannel() + val session = MutableSessionContext(handler.side, channel, handler.protocol) + channel.attr(SESSION_KEY).set(session) + channel.pipeline().addLast(PipelineNames.PROTOCOL_HANDLER, handler) + return channel +} + +class TypedProtocolHandlerTest : + FunSpec({ + test("incoming bytes dispatch to on") { + val handler = ServerHandler() + val channel = channelWithHandler(handler) + channel.writeInbound(Unpooled.wrappedBuffer(byteArrayOf(0xA0.toByte(), 0x05, 0x00))) + handler.seen shouldBe listOf(Ping(5)) + val out = channel.readOutbound() + out.readUnsignedByte().toInt() shouldBe 0xA1 + out.readUnsignedShortLE() shouldBe 6 + } + + test("session.send writes through the handler") { + val handler = ServerHandler() + val channel = channelWithHandler(handler) + val session = channel.attr(SESSION_KEY).get() + session.send(Pong(42)) + val out = channel.readOutbound() + out.readUnsignedByte().toInt() shouldBe 0xA1 + out.readUnsignedShortLE() shouldBe 42 + } + + test("unknown opcode is logged but channel stays open") { + val handler = ServerHandler() + val channel = channelWithHandler(handler) + channel.writeInbound(Unpooled.wrappedBuffer(byteArrayOf(0xFE.toByte()))) + channel.isOpen shouldBe true + } + + test("unhandled packet logs but keeps the channel open") { + val protocol = + object : Protocol() { + init { + c2s(0xB0u, PingCodec) + c2s(0xB1u, PongCodec) + } + } + class OnlyPingHandler : TypedProtocolHandler(protocol, Side.SERVER) { + init { + on { /* no-op */ } + } + } + val handler = OnlyPingHandler() + val channel = channelWithHandler(handler) + channel.writeInbound(Unpooled.wrappedBuffer(byteArrayOf(0xB1.toByte(), 0x01, 0x00))) + channel.isOpen shouldBe true + } + + test("duplicate handler registration throws") { + shouldThrow { + object : TypedProtocolHandler(PingPongProtocol, Side.SERVER) { + init { + on {} + on {} + } + } + } + } + + test("attributes survive on a session") { + val handler = ServerHandler() + val channel = channelWithHandler(handler) + val session = channel.attr(SESSION_KEY).get() + val key = SessionAttribute.of("userId") + session.attributes[key] = 42L + session.attributes[key] shouldBe 42L + session.attributes.contains(key) shouldBe true + } + + test("OutgoingPacket goes through ProtocolHandler.write") { + val handler = ServerHandler() + val channel = channelWithHandler(handler) + val reg = PingPongProtocol.outgoingRegistration(Side.SERVER, Pong::class)!! + channel.writeOutbound(OutgoingPacket(reg, Pong(7))) + val out = channel.readOutbound() + out.readUnsignedByte().toInt() shouldBe 0xA1 + out.readUnsignedShortLE() shouldBe 7 + } + }) diff --git a/network/src/test/kotlin/de/fiereu/network/checksum/ChecksumTest.kt b/network/src/test/kotlin/de/fiereu/network/checksum/ChecksumTest.kt new file mode 100644 index 0000000..f8ec387 --- /dev/null +++ b/network/src/test/kotlin/de/fiereu/network/checksum/ChecksumTest.kt @@ -0,0 +1,42 @@ +package de.fiereu.network.checksum + +import io.kotest.core.spec.style.FunSpec +import io.kotest.matchers.shouldBe +import io.netty.buffer.Unpooled + +class ChecksumTest : + FunSpec({ + test("NoOp produces empty tag") { + NoOpChecksum.size shouldBe 0 + NoOpChecksum.calculate(Unpooled.wrappedBuffer(byteArrayOf(1, 2, 3))).size shouldBe 0 + NoOpChecksum.verify(Unpooled.wrappedBuffer(byteArrayOf(1, 2, 3)), ByteArray(0)) shouldBe + true + } + + test("CRC16 verify matches calculate") { + val c = Crc16Checksum() + val data = byteArrayOf(0x10, 0x20, 0x30, 0x40, 0x50) + val tag = c.calculate(Unpooled.wrappedBuffer(data)) + tag.size shouldBe 2 + Crc16Checksum().verify(Unpooled.wrappedBuffer(data), tag) shouldBe true + Crc16Checksum().verify(Unpooled.wrappedBuffer(byteArrayOf(0, 0)), tag) shouldBe false + } + + test("HMAC-SHA256 round counter advances on every verify") { + val key = ByteArray(16) { it.toByte() } + val calc = HmacSha256Checksum(8, key) + val ver = HmacSha256Checksum(8, key) + val data = byteArrayOf(0xAA.toByte(), 0xBB.toByte(), 0xCC.toByte()) + val tag0 = calc.calculate(Unpooled.wrappedBuffer(data)) + val tag1 = calc.calculate(Unpooled.wrappedBuffer(data)) + tag0.contentEquals(tag1) shouldBe false + ver.verify(Unpooled.wrappedBuffer(data), tag0) shouldBe true + ver.verify(Unpooled.wrappedBuffer(data), tag1) shouldBe true + } + + test("ChecksumFactory dispatches on size") { + ChecksumFactory.create(0).size shouldBe 0 + ChecksumFactory.create(2).size shouldBe 2 + ChecksumFactory.create(8, ByteArray(16)).size shouldBe 8 + } + }) diff --git a/network/src/test/kotlin/de/fiereu/network/cipher/AesCtrSessionCipherTest.kt b/network/src/test/kotlin/de/fiereu/network/cipher/AesCtrSessionCipherTest.kt new file mode 100644 index 0000000..84ed98f --- /dev/null +++ b/network/src/test/kotlin/de/fiereu/network/cipher/AesCtrSessionCipherTest.kt @@ -0,0 +1,47 @@ +package de.fiereu.network.cipher + +import de.fiereu.network.handshake.EcKeys +import io.kotest.core.spec.style.FunSpec +import io.kotest.matchers.shouldBe +import io.netty.buffer.Unpooled + +class AesCtrSessionCipherTest : + FunSpec({ + test("derived ciphers interoperate across roles") { + val serverEphemeral = EcKeys.generateEphemeralKeyPair() + val clientEphemeral = EcKeys.generateEphemeralKeyPair() + + val serverCipher = + AesCtrSessionCipher.derive( + localPrivate = serverEphemeral.private, + remotePublic = clientEphemeral.public, + role = AesCtrSessionCipher.Role.SERVER, + ) + val clientCipher = + AesCtrSessionCipher.derive( + localPrivate = clientEphemeral.private, + remotePublic = serverEphemeral.public, + role = AesCtrSessionCipher.Role.CLIENT, + ) + + val plaintext = "the quick brown fox jumps over the lazy dog".toByteArray() + val srcServerOut = Unpooled.wrappedBuffer(plaintext) + val encrypted = Unpooled.buffer() + serverCipher.encrypt(srcServerOut, encrypted) + + val decrypted = Unpooled.buffer() + clientCipher.decrypt(encrypted, decrypted) + val read = ByteArray(decrypted.readableBytes()) + decrypted.readBytes(read) + read shouldBe plaintext + } + + test("NoOpSessionCipher passes through") { + val src = Unpooled.wrappedBuffer(byteArrayOf(1, 2, 3)) + val dst = Unpooled.buffer() + NoOpSessionCipher.encrypt(src, dst) + val arr = ByteArray(3) + dst.readBytes(arr) + arr shouldBe byteArrayOf(1, 2, 3) + } + }) diff --git a/network/src/test/kotlin/de/fiereu/network/coroutines/CoroutineProtocolHandlerTest.kt b/network/src/test/kotlin/de/fiereu/network/coroutines/CoroutineProtocolHandlerTest.kt new file mode 100644 index 0000000..c388abe --- /dev/null +++ b/network/src/test/kotlin/de/fiereu/network/coroutines/CoroutineProtocolHandlerTest.kt @@ -0,0 +1,124 @@ +package de.fiereu.network.coroutines + +import de.fiereu.bytecodec.CodecScope +import de.fiereu.bytecodec.PacketCodec +import de.fiereu.bytecodec.U16LE +import de.fiereu.network.HandlerRegistrationException +import de.fiereu.network.PipelineNames +import de.fiereu.network.Protocol +import de.fiereu.network.ProtocolHandler +import de.fiereu.network.Side +import de.fiereu.network.c2s +import de.fiereu.network.internal.MutableSessionContext +import de.fiereu.network.internal.SESSION_KEY +import io.kotest.assertions.throwables.shouldThrow +import io.kotest.core.spec.style.FunSpec +import io.kotest.matchers.shouldBe +import io.netty.buffer.Unpooled +import io.netty.channel.embedded.EmbeddedChannel +import kotlinx.coroutines.CompletableDeferred +import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.Job +import kotlinx.coroutines.cancel +import kotlinx.coroutines.runBlocking +import kotlinx.coroutines.withTimeout + +private data class Slow(val id: Int) + +private data class Fast(val id: Int) + +private object SlowCodec : PacketCodec() { + override fun CodecScope.body() = Slow(field(U16LE, Slow::id)) +} + +private object FastCodec : PacketCodec() { + override fun CodecScope.body() = Fast(field(U16LE, Fast::id)) +} + +private object MixedProtocol : Protocol() { + init { + c2s(0xC0u, SlowCodec) + c2s(0xC1u, FastCodec) + } +} + +private fun channelWithHandler(handler: ProtocolHandler): EmbeddedChannel { + val channel = EmbeddedChannel() + val session = MutableSessionContext(handler.side, channel, handler.protocol) + channel.attr(SESSION_KEY).set(session) + channel.pipeline().addLast(PipelineNames.PROTOCOL_HANDLER, handler) + return channel +} + +class CoroutineProtocolHandlerTest : + FunSpec({ + test("onSuspend handler runs on the supplied scope") { + val scope = CoroutineScope(Dispatchers.Default + Job()) + val received = CompletableDeferred() + val handler = + object : CoroutineProtocolHandler(MixedProtocol, Side.SERVER, scope) { + init { + onSuspend { event -> received.complete(event.packet) } + } + } + val channel = channelWithHandler(handler) + channel.writeInbound(Unpooled.wrappedBuffer(byteArrayOf(0xC0.toByte(), 0x07, 0x00))) + runBlocking { withTimeout(2000) { received.await() } shouldBe Slow(7) } + scope.cancel() + } + + test("sync on and onSuspend coexist") { + val scope = CoroutineScope(Dispatchers.Default + Job()) + val syncSeen = mutableListOf() + val asyncSeen = CompletableDeferred() + val handler = + object : CoroutineProtocolHandler(MixedProtocol, Side.SERVER, scope) { + init { + on { event -> syncSeen += event.packet } + onSuspend { event -> asyncSeen.complete(event.packet) } + } + } + val channel = channelWithHandler(handler) + channel.writeInbound(Unpooled.wrappedBuffer(byteArrayOf(0xC1.toByte(), 0x03, 0x00))) + channel.writeInbound(Unpooled.wrappedBuffer(byteArrayOf(0xC0.toByte(), 0x09, 0x00))) + syncSeen shouldBe listOf(Fast(3)) + runBlocking { withTimeout(2000) { asyncSeen.await() } shouldBe Slow(9) } + scope.cancel() + } + + test("registering the same type twice across sync/suspend throws") { + val scope = CoroutineScope(Dispatchers.Default + Job()) + shouldThrow { + object : CoroutineProtocolHandler(MixedProtocol, Side.SERVER, scope) { + init { + on {} + onSuspend {} + } + } + } + scope.cancel() + } + + test("mailbox preserves ordering") { + val scope = CoroutineScope(Dispatchers.Default + Job()) + val seen = mutableListOf() + val all = CompletableDeferred() + val handler = + object : CoroutineProtocolHandler(MixedProtocol, Side.SERVER, scope) { + init { + onSuspend { event -> + seen += event.packet.id + if (seen.size == 5) all.complete(Unit) + } + } + } + val channel = channelWithHandler(handler) + for (i in 1..5) { + channel.writeInbound(Unpooled.wrappedBuffer(byteArrayOf(0xC0.toByte(), i.toByte(), 0x00))) + } + runBlocking { withTimeout(2000) { all.await() } } + seen shouldBe listOf(1, 2, 3, 4, 5) + scope.cancel() + } + }) diff --git a/network/src/test/kotlin/de/fiereu/network/handlers/CompressionTest.kt b/network/src/test/kotlin/de/fiereu/network/handlers/CompressionTest.kt new file mode 100644 index 0000000..0a80f04 --- /dev/null +++ b/network/src/test/kotlin/de/fiereu/network/handlers/CompressionTest.kt @@ -0,0 +1,52 @@ +package de.fiereu.network.handlers + +import io.kotest.core.spec.style.FunSpec +import io.kotest.matchers.shouldBe +import io.netty.buffer.ByteBuf +import io.netty.buffer.Unpooled +import io.netty.channel.embedded.EmbeddedChannel + +class CompressionTest : + FunSpec({ + test("payload below threshold preserves opcode and writes flag=0") { + val enc = EmbeddedChannel(CompressionEncoder(threshold = 16)) + enc.writeOutbound(Unpooled.wrappedBuffer(byteArrayOf(0xAA.toByte(), 1, 2, 3, 4))) + val out = enc.readOutbound() + out.readableBytes() shouldBe 6 + out.readByte() shouldBe 0xAA.toByte() + out.readByte() shouldBe 0 + val rest = ByteArray(4) + out.readBytes(rest) + rest shouldBe byteArrayOf(1, 2, 3, 4) + } + + test("encoder + decoder roundtrip for raw payload") { + val enc = EmbeddedChannel(CompressionEncoder(threshold = 16)) + enc.writeOutbound(Unpooled.wrappedBuffer(byteArrayOf(0xAA.toByte(), 1, 2, 3, 4))) + val compressed = enc.readOutbound() + val dec = EmbeddedChannel(CompressionDecoder()) + dec.writeInbound(compressed) + val out = dec.readInbound() + out.readableBytes() shouldBe 5 + out.readByte() shouldBe 0xAA.toByte() + val rest = ByteArray(4) + out.readBytes(rest) + rest shouldBe byteArrayOf(1, 2, 3, 4) + } + + test("encoder + decoder roundtrip for compressed payload") { + val payload = ByteArray(512) { (it and 0x0F).toByte() } + val enc = EmbeddedChannel(CompressionEncoder(threshold = 64)) + enc.writeOutbound(Unpooled.wrappedBuffer(byteArrayOf(0xBB.toByte()) + payload)) + val compressed = enc.readOutbound() + compressed.getByte(0) shouldBe 0xBB.toByte() + compressed.getByte(1) shouldBe 1 + val dec = EmbeddedChannel(CompressionDecoder()) + dec.writeInbound(compressed) + val out = dec.readInbound() + out.readByte() shouldBe 0xBB.toByte() + val read = ByteArray(out.readableBytes()) + out.readBytes(read) + read shouldBe payload + } + }) diff --git a/network/src/test/kotlin/de/fiereu/network/handlers/FrameAndChecksumTest.kt b/network/src/test/kotlin/de/fiereu/network/handlers/FrameAndChecksumTest.kt new file mode 100644 index 0000000..df3cb2f --- /dev/null +++ b/network/src/test/kotlin/de/fiereu/network/handlers/FrameAndChecksumTest.kt @@ -0,0 +1,83 @@ +package de.fiereu.network.handlers + +import de.fiereu.network.ChecksumMismatchException +import de.fiereu.network.checksum.Crc16Checksum +import de.fiereu.network.checksum.NoOpChecksum +import io.kotest.assertions.throwables.shouldThrow +import io.kotest.core.spec.style.FunSpec +import io.kotest.matchers.shouldBe +import io.netty.buffer.ByteBuf +import io.netty.buffer.Unpooled +import io.netty.channel.embedded.EmbeddedChannel + +private fun EmbeddedChannel.drainOutbound(): ByteBuf { + val out = Unpooled.buffer() + while (true) { + val obj = readOutbound() ?: break + if (obj is ByteBuf) { + out.writeBytes(obj) + obj.release() + } + } + return out +} + +private fun rootCause(t: Throwable): Throwable { + var c: Throwable = t + while (c.cause != null && c.cause !== c) c = c.cause!! + return c +} + +class FrameAndChecksumTest : + FunSpec({ + test("PacketFrameEncoder writes LE length prefix including itself") { + val channel = EmbeddedChannel(PacketFrameEncoder()) + channel.writeOutbound( + Unpooled.wrappedBuffer(byteArrayOf(0xAA.toByte(), 0xBB.toByte(), 0xCC.toByte()))) + val out = channel.drainOutbound() + out.readableBytes() shouldBe 5 + out.readUnsignedShortLE() shouldBe 5 + val rest = ByteArray(3) + out.readBytes(rest) + rest shouldBe byteArrayOf(0xAA.toByte(), 0xBB.toByte(), 0xCC.toByte()) + } + + test("PacketFrameDecoder strips the length prefix") { + val encoder = EmbeddedChannel(PacketFrameEncoder()) + encoder.writeOutbound(Unpooled.wrappedBuffer(byteArrayOf(1, 2, 3, 4))) + val framed = encoder.drainOutbound() + + val decoder = EmbeddedChannel(PacketFrameDecoder()) + decoder.writeInbound(framed) + val out = decoder.readInbound() + out.readableBytes() shouldBe 4 + } + + test("ChecksumFrameEncoder appends tag; decoder strips it") { + val enc = EmbeddedChannel(ChecksumFrameEncoder(Crc16Checksum())) + enc.writeOutbound(Unpooled.wrappedBuffer(byteArrayOf(1, 2, 3, 4))) + val withTag = enc.drainOutbound() + withTag.readableBytes() shouldBe 6 + + val dec = EmbeddedChannel(ChecksumFrameDecoder(Crc16Checksum())) + dec.writeInbound(withTag) + val out = dec.readInbound() + out.readableBytes() shouldBe 4 + } + + test("ChecksumFrameDecoder throws on mismatch") { + val dec = EmbeddedChannel(ChecksumFrameDecoder(Crc16Checksum())) + val thrown = + shouldThrow { + dec.writeInbound(Unpooled.wrappedBuffer(byteArrayOf(1, 2, 3, 4, 0, 0))) + } + (rootCause(thrown) is ChecksumMismatchException) shouldBe true + } + + test("NoOpChecksum decoder passes payload through") { + val dec = EmbeddedChannel(ChecksumFrameDecoder(NoOpChecksum)) + dec.writeInbound(Unpooled.wrappedBuffer(byteArrayOf(9, 9, 9))) + val out = dec.readInbound() + out.readableBytes() shouldBe 3 + } + }) diff --git a/network/src/test/kotlin/de/fiereu/network/handshake/EndToEndHandshakeTest.kt b/network/src/test/kotlin/de/fiereu/network/handshake/EndToEndHandshakeTest.kt new file mode 100644 index 0000000..e73e9df --- /dev/null +++ b/network/src/test/kotlin/de/fiereu/network/handshake/EndToEndHandshakeTest.kt @@ -0,0 +1,117 @@ +package de.fiereu.network.handshake + +import de.fiereu.bytecodec.CodecScope +import de.fiereu.bytecodec.PacketCodec +import de.fiereu.bytecodec.U16LE +import de.fiereu.network.PipelineOptions +import de.fiereu.network.Protocol +import de.fiereu.network.ProtocolHandler +import de.fiereu.network.SessionIdentity +import de.fiereu.network.SessionPhase +import de.fiereu.network.Side +import de.fiereu.network.TypedProtocolHandler +import de.fiereu.network.bidi +import de.fiereu.network.installPipeline +import de.fiereu.network.internal.SESSION_KEY +import io.kotest.core.spec.style.FunSpec +import io.kotest.matchers.shouldBe +import io.netty.buffer.ByteBuf +import io.netty.channel.Channel +import io.netty.channel.ChannelInitializer +import io.netty.channel.embedded.EmbeddedChannel +import java.security.interfaces.ECPrivateKey +import java.security.interfaces.ECPublicKey + +private data class Echo(val value: Int) + +private object EchoCodec : PacketCodec() { + override fun CodecScope.body() = Echo(field(U16LE, Echo::value)) +} + +private object EchoProtocol : Protocol() { + init { + bidi(0x55u, EchoCodec) + } +} + +private class CollectingHandler(side: Side) : + TypedProtocolHandler(EchoProtocol, side) { + val received = mutableListOf() + + init { + on { event -> received += event.packet } + } +} + +private fun drain(from: EmbeddedChannel, into: EmbeddedChannel) { + while (true) { + val obj = from.readOutbound() ?: break + into.writeInbound(obj) + } +} + +class EndToEndHandshakeTest : + FunSpec({ + test("server and client exchange a full handshake and an application packet") { + val rootKeyPair = EcKeys.generateEphemeralKeyPair() + val rootPrivate = rootKeyPair.private as ECPrivateKey + val rootPublic = rootKeyPair.public as ECPublicKey + + val serverApp = CollectingHandler(Side.SERVER) + val clientApp = CollectingHandler(Side.CLIENT) + + val options = PipelineOptions(checksumSize = 8) + + val serverChannel = + EmbeddedChannel( + object : ChannelInitializer() { + override fun initChannel(ch: Channel) { + installPipeline( + pipeline = ch.pipeline(), + side = Side.SERVER, + identity = SessionIdentity.ServerRoot(rootPrivate), + applicationProtocol = EchoProtocol, + applicationHandlerFactory = { serverApp as ProtocolHandler }, + options = options, + ) + } + }, + ) + + val clientChannel = + EmbeddedChannel( + object : ChannelInitializer() { + override fun initChannel(ch: Channel) { + installPipeline( + pipeline = ch.pipeline(), + side = Side.CLIENT, + identity = SessionIdentity.ClientTrust(rootPublic), + applicationProtocol = EchoProtocol, + applicationHandlerFactory = { clientApp as ProtocolHandler }, + options = options, + ) + } + }, + ) + + // Client sends ClientHello on channelActive (called during init for EmbeddedChannel) + drain(clientChannel, serverChannel) + // Server replies ServerHello + drain(serverChannel, clientChannel) + // Client replies ClientReady + drain(clientChannel, serverChannel) + + serverChannel.attr(SESSION_KEY).get().phase shouldBe SessionPhase.ESTABLISHED + clientChannel.attr(SESSION_KEY).get().phase shouldBe SessionPhase.ESTABLISHED + + // Client sends an application packet through the encrypted pipeline + clientChannel.attr(SESSION_KEY).get().send(Echo(0xCAFE)) + drain(clientChannel, serverChannel) + serverApp.received shouldBe listOf(Echo(0xCAFE)) + + // Server responds + serverChannel.attr(SESSION_KEY).get().send(Echo(0xBABE)) + drain(serverChannel, clientChannel) + clientApp.received shouldBe listOf(Echo(0xBABE)) + } + }) diff --git a/network/src/test/kotlin/de/fiereu/network/handshake/HandshakeCodecsTest.kt b/network/src/test/kotlin/de/fiereu/network/handshake/HandshakeCodecsTest.kt new file mode 100644 index 0000000..645568a --- /dev/null +++ b/network/src/test/kotlin/de/fiereu/network/handshake/HandshakeCodecsTest.kt @@ -0,0 +1,39 @@ +package de.fiereu.network.handshake + +import de.fiereu.bytecodec.test.assertValueRoundtrip +import de.fiereu.bytecodec.test.decodeBytes +import de.fiereu.bytecodec.test.encodeToBytes +import io.kotest.core.spec.style.FunSpec +import io.kotest.matchers.shouldBe +import java.security.interfaces.ECPublicKey + +class HandshakeCodecsTest : + FunSpec({ + test("ClientHello roundtrip recovers timestamp despite XOR obfuscation") { + val ts = 1764115200L + val bytes = ClientHelloCodec.encodeToBytes(ClientHelloPacket(ts)) + bytes.size shouldBe 16 + ClientHelloCodec.decodeBytes(bytes).timestamp shouldBe ts + } + + test("ServerHello roundtrips pubkey, signature, checksum size") { + val keyPair = EcKeys.generateEphemeralKeyPair() + val pkt = + ServerHelloPacket( + ephemeralPublic = keyPair.public as ECPublicKey, + signature = ByteArray(64) { it.toByte() }, + checksumSize = 16, + ) + val bytes = ServerHelloCodec.encodeToBytes(pkt) + val decoded = ServerHelloCodec.decodeBytes(bytes) + decoded.ephemeralPublic shouldBe pkt.ephemeralPublic + decoded.signature shouldBe pkt.signature + decoded.checksumSize shouldBe 16 + } + + test("ClientReady roundtrips public key") { + val keyPair = EcKeys.generateEphemeralKeyPair() + val pkt = ClientReadyPacket(ephemeralPublic = keyPair.public as ECPublicKey) + ClientReadyCodec.assertValueRoundtrip(pkt) + } + }) diff --git a/patcher/src/main/kotlin/de/fiereu/openmmo/patcher/Agent.kt b/patcher/src/main/kotlin/de/fiereu/openmmo/patcher/Launcher.kt similarity index 56% rename from patcher/src/main/kotlin/de/fiereu/openmmo/patcher/Agent.kt rename to patcher/src/main/kotlin/de/fiereu/openmmo/patcher/Launcher.kt index 331b8e5..55e7458 100644 --- a/patcher/src/main/kotlin/de/fiereu/openmmo/patcher/Agent.kt +++ b/patcher/src/main/kotlin/de/fiereu/openmmo/patcher/Launcher.kt @@ -1,3 +1,3 @@ Removed on request of pokemmo.eu. Date: 2026-08-17 -Nonce: 0485ce0df8a74237b94853f3ed55fd38 +Nonce: 83616ef24a6849d7bd35ff77cfa88667 diff --git a/patcher/src/main/kotlin/de/fiereu/openmmo/patcher/PatchingClassFileTransformer.kt b/patcher/src/main/kotlin/de/fiereu/openmmo/patcher/PatchingClassFileTransformer.kt deleted file mode 100644 index bbe727c..0000000 --- a/patcher/src/main/kotlin/de/fiereu/openmmo/patcher/PatchingClassFileTransformer.kt +++ /dev/null @@ -1,3 +0,0 @@ -Removed on request of pokemmo.eu. -Date: 2026-08-17 -Nonce: 746fedca4ccc49109f8f64ba0b924c6e diff --git a/protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/GameProtocol.kt b/protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/GameProtocol.kt deleted file mode 100644 index 64c1b34..0000000 --- a/protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/GameProtocol.kt +++ /dev/null @@ -1,222 +0,0 @@ -package de.fiereu.openmmo.protocols.game - -import de.fiereu.openmmo.protocols.Protocol -import de.fiereu.openmmo.protocols.game.packets.CharacterListDeserializer -import de.fiereu.openmmo.protocols.game.packets.CharacterListSerializer -import de.fiereu.openmmo.protocols.game.packets.ChatMessageDeserialize -import de.fiereu.openmmo.protocols.game.packets.ChatMessageSerialize -import de.fiereu.openmmo.protocols.game.packets.CreateCharacterDeserializer -import de.fiereu.openmmo.protocols.game.packets.DialogChoiceDeserializer -import de.fiereu.openmmo.protocols.game.packets.DialogChoiceSerializer -import de.fiereu.openmmo.protocols.game.packets.DialogDataDeserializer -import de.fiereu.openmmo.protocols.game.packets.DialogDataSerializer -import de.fiereu.openmmo.protocols.game.packets.DialogOptionDeserializer -import de.fiereu.openmmo.protocols.game.packets.DialogOptionSerializer -import de.fiereu.openmmo.protocols.game.packets.DialogStateDeserializer -import de.fiereu.openmmo.protocols.game.packets.DialogStateSerializer -import de.fiereu.openmmo.protocols.game.packets.EntityInteractDeserializer -import de.fiereu.openmmo.protocols.game.packets.EntityInteractSerializer -import de.fiereu.openmmo.protocols.game.packets.EntityLeaveDeserializer -import de.fiereu.openmmo.protocols.game.packets.EntityLeaveSerializer -import de.fiereu.openmmo.protocols.game.packets.EntityMovePacketDeserializer -import de.fiereu.openmmo.protocols.game.packets.EntityMovePacketSerializer -import de.fiereu.openmmo.protocols.game.packets.FaceDirectionDeserializer -import de.fiereu.openmmo.protocols.game.packets.FaceDirectionSerializer -import de.fiereu.openmmo.protocols.game.packets.InteractiveResponseDeserializer -import de.fiereu.openmmo.protocols.game.packets.InteractiveSerializer -import de.fiereu.openmmo.protocols.game.packets.JoinPacketDeserializer -import de.fiereu.openmmo.protocols.game.packets.JoinPacketSerializer -import de.fiereu.openmmo.protocols.game.packets.JoinResponseDeserializer -import de.fiereu.openmmo.protocols.game.packets.JoinResponseSerializer -import de.fiereu.openmmo.protocols.game.packets.KeepAlivePacketDeserializer -import de.fiereu.openmmo.protocols.game.packets.KeepAlivePacketSerializer -import de.fiereu.openmmo.protocols.game.packets.LoadEntityDeserializer -import de.fiereu.openmmo.protocols.game.packets.LoadEntitySerializer -import de.fiereu.openmmo.protocols.game.packets.LoadMapPacketDeserializer -import de.fiereu.openmmo.protocols.game.packets.LoadMapPacketSerializer -import de.fiereu.openmmo.protocols.game.packets.MapTransitionAckDeserializer -import de.fiereu.openmmo.protocols.game.packets.MapTransitionAckSerializer -import de.fiereu.openmmo.protocols.game.packets.MapTransitionDeserializer -import de.fiereu.openmmo.protocols.game.packets.MapTransitionSerializer -import de.fiereu.openmmo.protocols.game.packets.MovementPacketDeserializer -import de.fiereu.openmmo.protocols.game.packets.MovementPacketSerializer -import de.fiereu.openmmo.protocols.game.packets.NpcAnimationDeserializer -import de.fiereu.openmmo.protocols.game.packets.NpcAnimationSerializer -import de.fiereu.openmmo.protocols.game.packets.NpcSpawnDeserializer -import de.fiereu.openmmo.protocols.game.packets.NpcSpawnSerializer -import de.fiereu.openmmo.protocols.game.packets.NpcUpdateDeserializer -import de.fiereu.openmmo.protocols.game.packets.NpcUpdateSerializer -import de.fiereu.openmmo.protocols.game.packets.NullPacketDeserializer -import de.fiereu.openmmo.protocols.game.packets.PokemonContainerDeserializer -import de.fiereu.openmmo.protocols.game.packets.PokemonContainerSerializer -import de.fiereu.openmmo.protocols.game.packets.RenderScreenDeserializer -import de.fiereu.openmmo.protocols.game.packets.RenderScreenSerializer -import de.fiereu.openmmo.protocols.game.packets.RequestCharactersDeserializer -import de.fiereu.openmmo.protocols.game.packets.RequestCharactersPacketSerializer -import de.fiereu.openmmo.protocols.game.packets.RequestPlayerDeserializePacket -import de.fiereu.openmmo.protocols.game.packets.RequestPlayerSerializer -import de.fiereu.openmmo.protocols.game.packets.SelectCharacterDeserializer -import de.fiereu.openmmo.protocols.game.packets.SelectCharacterSerializer -import de.fiereu.openmmo.protocols.game.packets.SelectedCharacterDeserializer -import de.fiereu.openmmo.protocols.game.packets.SelectedCharacterSerializer -import de.fiereu.openmmo.protocols.game.packets.TokenPayloadSerializer -import de.fiereu.openmmo.protocols.incomingPacket -import de.fiereu.openmmo.protocols.outgoingPacket - -/** - * Game Protocol implementation. This protocol handles in-game communication after the TLS handshake - * is complete. - */ -abstract class GameProtocol : Protocol() { - override val async: Boolean = true - override val compressed: Boolean = true -} - -class GameServerProtocol : GameProtocol() { - init { - // Game server: client sends 0x01 as first packet (client info / "JoinGame") - incomingPacket(0x01u, JoinPacketDeserializer()) - outgoingPacket(0x01u, JoinResponseSerializer()) - - incomingPacket(0x02u, RequestCharactersDeserializer()) - outgoingPacket(0x02u, CharacterListSerializer()) - - incomingPacket(0x03u, CreateCharacterDeserializer()) - - incomingPacket(0x04u, SelectCharacterDeserializer()) - outgoingPacket(0x04u, SelectedCharacterSerializer()) - - incomingPacket(0x05u, RequestPlayerDeserializePacket()) - outgoingPacket(0x05u, LoadEntitySerializer()) - - incomingPacket(0x06u, MovementPacketDeserializer()) // Client movement - outgoingPacket(0xEAu, EntityMovePacketSerializer()) // Entity move broadcast - - incomingPacket(0x07u, FaceDirectionDeserializer()) // Face direction - - outgoingPacket(0x08u, EntityLeaveSerializer()) // Entity leave area - - incomingPacket(0x09u, ChatMessageDeserialize()) // Chat message - outgoingPacket(0x09u, ChatMessageSerialize()) - - outgoingPacket(0x10u, LoadMapPacketSerializer()) // Load map - incomingPacket(0x10u, LoadMapPacketDeserializer()) - - outgoingPacket(0x13u, PokemonContainerSerializer()) // Pokemon data - incomingPacket(0x13u, PokemonContainerDeserializer()) - - incomingPacket(0x20u, NullPacketDeserializer()) // Token exchange (heartbeat/token) - outgoingPacket(0x20u, TokenPayloadSerializer()) - - outgoingPacket(0xB4u, RenderScreenSerializer()) // Render screen - incomingPacket(0xB4u, RenderScreenDeserializer()) - - incomingPacket(0xC2u, KeepAlivePacketDeserializer()) // Keepalive echo - outgoingPacket(0xC2u, KeepAlivePacketSerializer()) - - incomingPacket(0x0Du, DialogDataDeserializer()) - outgoingPacket(0x0Du, DialogDataSerializer()) - - incomingPacket(0x0Eu, DialogStateDeserializer()) - outgoingPacket(0x0Eu, DialogStateSerializer()) - - outgoingPacket(0x11u, NpcUpdateSerializer()) - - incomingPacket(0x12u, NpcSpawnDeserializer()) - outgoingPacket(0x12u, NpcSpawnSerializer()) - - incomingPacket(0x1Bu, MapTransitionDeserializer()) - outgoingPacket(0x1Bu, MapTransitionSerializer()) - - incomingPacket(0x21u, InteractiveResponseDeserializer()) - outgoingPacket(0x21u, InteractiveSerializer()) - - incomingPacket(0x22u, EntityInteractDeserializer()) // Entity interaction start - outgoingPacket(0x22u, EntityInteractSerializer()) - - incomingPacket(0x25u, DialogChoiceDeserializer()) - outgoingPacket(0x25u, DialogChoiceSerializer()) - - incomingPacket(0x26u, DialogOptionDeserializer()) - outgoingPacket(0x26u, DialogOptionSerializer()) - - incomingPacket(0xB2u, NpcAnimationDeserializer()) - outgoingPacket(0xB2u, NpcAnimationSerializer()) - - incomingPacket(0xB9u, MapTransitionAckDeserializer()) - outgoingPacket(0xB9u, MapTransitionAckSerializer()) - } -} - -class GameClientProtocol : GameProtocol() { - init { - outgoingPacket(0x01u, JoinPacketSerializer()) // Client info / "JoinGame" - incomingPacket(0x01u, JoinResponseDeserializer()) - - outgoingPacket(0x02u, RequestCharactersPacketSerializer()) - incomingPacket(0x02u, CharacterListDeserializer()) - - outgoingPacket(0x04u, SelectCharacterSerializer()) - incomingPacket(0x04u, SelectedCharacterDeserializer()) - - outgoingPacket(0x05u, RequestPlayerSerializer()) - incomingPacket(0x05u, LoadEntityDeserializer()) - - outgoingPacket(0x06u, MovementPacketSerializer()) // Client movement - incomingPacket(0xEAu, EntityMovePacketDeserializer()) // Entity move broadcast - - outgoingPacket(0x07u, FaceDirectionSerializer()) // Face direction - - incomingPacket(0x08u, EntityLeaveDeserializer()) // Entity leave area - - outgoingPacket(0x09u, ChatMessageSerialize()) - incomingPacket(0x09u, ChatMessageDeserialize()) - - outgoingPacket(0x10u, LoadMapPacketSerializer()) - incomingPacket(0x10u, LoadMapPacketDeserializer()) - - outgoingPacket(0x13u, PokemonContainerSerializer()) - incomingPacket(0x13u, PokemonContainerDeserializer()) - - outgoingPacket(0x20u, TokenPayloadSerializer()) - incomingPacket(0x20u, NullPacketDeserializer()) - - outgoingPacket(0xB4u, RenderScreenSerializer()) - incomingPacket(0xB4u, RenderScreenDeserializer()) - - outgoingPacket(0xC2u, KeepAlivePacketSerializer()) // Keepalive echo - incomingPacket(0xC2u, KeepAlivePacketDeserializer()) - - outgoingPacket(0x0Du, DialogDataSerializer()) - incomingPacket(0x0Du, DialogDataDeserializer()) - - outgoingPacket(0x0Eu, DialogStateSerializer()) - incomingPacket(0x0Eu, DialogStateDeserializer()) - - incomingPacket(0x11u, NpcUpdateDeserializer()) - - outgoingPacket(0x12u, NpcSpawnSerializer()) - incomingPacket(0x12u, NpcSpawnDeserializer()) - - outgoingPacket(0x1Bu, MapTransitionSerializer()) - incomingPacket(0x1Bu, MapTransitionDeserializer()) - - outgoingPacket(0x21u, InteractiveSerializer()) - incomingPacket(0x21u, InteractiveResponseDeserializer()) - - outgoingPacket(0x22u, EntityInteractSerializer()) - incomingPacket(0x22u, EntityInteractDeserializer()) - - outgoingPacket(0x25u, DialogChoiceSerializer()) - incomingPacket(0x25u, DialogChoiceDeserializer()) - - outgoingPacket(0x26u, DialogOptionSerializer()) - incomingPacket(0x26u, DialogOptionDeserializer()) - - outgoingPacket(0xB2u, NpcAnimationSerializer()) - incomingPacket(0xB2u, NpcAnimationDeserializer()) - - outgoingPacket(0xB9u, MapTransitionAckSerializer()) - incomingPacket(0xB9u, MapTransitionAckDeserializer()) - } -} diff --git a/protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/CharactersListPacket.kt b/protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/CharactersListPacket.kt deleted file mode 100644 index d480bac..0000000 --- a/protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/CharactersListPacket.kt +++ /dev/null @@ -1,71 +0,0 @@ -package de.fiereu.openmmo.protocols.game.packets - -import de.fiereu.openmmo.common.CharacterInfo -import de.fiereu.openmmo.common.Pokemon -import de.fiereu.openmmo.common.enums.SkinSlot -import de.fiereu.openmmo.protocols.PacketDeserializer -import de.fiereu.openmmo.protocols.PacketSerializer -import de.fiereu.openmmo.protocols.game.packets.codecs.* -import de.fiereu.openmmo.protocols.readUtf16LE -import de.fiereu.openmmo.protocols.writeUtf16LE -import io.netty.buffer.ByteBuf - -data class CharacterListPacket(val characters: List) - -data class CharacterEntry( - val characterInfo: CharacterInfo, - val skinSet: SkinSet, - val guildId: Int? = null, - val pokemon: List -) { - init { - require(pokemon.size <= 6) { "Party size can't be more than 6 pokemon" } - } -} - -class CharacterListSerializer : PacketSerializer { - override fun serialize(packet: CharacterListPacket, buffer: ByteBuf) = - buffer.run { - writeByte(packet.characters.size) - packet.characters.forEach { characterEntry -> - writeCharacterInfoLE(useLong = false, characterEntry.characterInfo) - writeSkinsLE(characterEntry.skinSet) - // TODO find out why we send 2 times the skin data - writeSkinsLE(characterEntry.skinSet, writeByte = false) - - val hasGuild = characterEntry.guildId != null - buffer.writeBoolean(hasGuild) - if (hasGuild) { - writeUtf16LE("") // unused - writeIntLE(characterEntry.guildId) - } - - buffer.writeByte(characterEntry.pokemon.size) - characterEntry.pokemon.forEach(::writePokemonLE) - } - } -} - -class CharacterListDeserializer : PacketDeserializer { - override fun deserialize(buffer: ByteBuf): CharacterListPacket = - buffer.run { - val size = buffer.readByte().toInt() - val characters = - buildList(size) { - val characterInfo = readCharacterInfoLE(useLong = true) - val skinSet1 = readSkinsLE(SkinSlot.entries, readByte = true) - val skinSet2 = readSkinsLE(SkinSlot.entries, readByte = false) - - val guildId = - if (readBoolean()) { - readUtf16LE() // unused - readIntLE() - } else null - - val partySize = readUnsignedByte().toInt() - val pokemon = buildList(partySize) { repeat(partySize) { add(readPokemonLE()) } } - add(CharacterEntry(characterInfo, skinSet1, guildId, pokemon)) - } - return CharacterListPacket(characters) - } -} diff --git a/protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/ChatMessagePacket.kt b/protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/ChatMessagePacket.kt deleted file mode 100644 index 1364c80..0000000 --- a/protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/ChatMessagePacket.kt +++ /dev/null @@ -1,57 +0,0 @@ -package de.fiereu.openmmo.protocols.game.packets - -import de.fiereu.openmmo.common.enums.ChatType -import de.fiereu.openmmo.common.enums.Language -import de.fiereu.openmmo.protocols.PacketDeserializer -import de.fiereu.openmmo.protocols.PacketSerializer -import de.fiereu.openmmo.protocols.readUtf16LE -import de.fiereu.openmmo.protocols.writeUtf16LE -import io.netty.buffer.ByteBuf - -data class ChatMessagePacket( - val type: ChatType, - val language: Language?, - val message: String, - val sender: String? -) - -class ChatMessageSerialize : PacketSerializer { - override fun serialize(packet: ChatMessagePacket, buffer: ByteBuf) { - buffer.apply { - writeByte(packet.type.ordinal) - when (packet.type) { - ChatType.TEAM -> { - writeUtf16LE(packet.message) - } - else -> { - require(packet.sender != null) { "sender must not be null" } - require(packet.language != null) { "language must not be null" } - writeLongLE(0) // TODO some id - writeUtf16LE(packet.sender) - writeByte(packet.language.ordinal) - writeByte(-1) - writeUtf16LE(packet.message) - } - } - } - } -} - -class ChatMessageDeserialize : PacketDeserializer { - override fun deserialize(buffer: ByteBuf): ChatMessagePacket { - when (val type = ChatType.entries[buffer.readByte().toInt()]) { - ChatType.LINK -> { - val message = buffer.readUtf16LE() - return ChatMessagePacket(type, Language.OTHER, message, null) - } - else -> { - buffer.readIntLE() - val sender = buffer.readUtf16LE() - val language = Language.entries[buffer.readByte().toInt()] - buffer.readByte() - val message = buffer.readUtf16LE() - return ChatMessagePacket(type, language, message, sender) - } - } - } -} diff --git a/protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/CreateCharacterPacket.kt b/protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/CreateCharacterPacket.kt deleted file mode 100644 index 3cc0c33..0000000 --- a/protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/CreateCharacterPacket.kt +++ /dev/null @@ -1,15 +0,0 @@ -package de.fiereu.openmmo.protocols.game.packets - -import de.fiereu.openmmo.protocols.PacketDeserializer -import de.fiereu.openmmo.protocols.readUtf16LE -import io.netty.buffer.ByteBuf - -data class CreateCharacterPacket(val name: String) - -class CreateCharacterDeserializer : PacketDeserializer { - override fun deserialize(buffer: ByteBuf): CreateCharacterPacket { - val name = buffer.readUtf16LE() - buffer.skipBytes(buffer.readableBytes()) - return CreateCharacterPacket(name) - } -} diff --git a/protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/DialogChoicePacket.kt b/protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/DialogChoicePacket.kt deleted file mode 100644 index 6e0503b..0000000 --- a/protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/DialogChoicePacket.kt +++ /dev/null @@ -1,25 +0,0 @@ -package de.fiereu.openmmo.protocols.game.packets - -import de.fiereu.openmmo.protocols.PacketDeserializer -import de.fiereu.openmmo.protocols.PacketSerializer -import io.netty.buffer.ByteBuf - -data class DialogChoicePacket( - val unk1: Int, - val unk2: Int, -) - -class DialogChoiceSerializer : PacketSerializer { - override fun serialize(packet: DialogChoicePacket, buffer: ByteBuf) { - buffer.writeByte(packet.unk1) - buffer.writeShortLE(packet.unk2) - } -} - -class DialogChoiceDeserializer : PacketDeserializer { - override fun deserialize(buffer: ByteBuf): DialogChoicePacket { - val unk1 = buffer.readByte().toInt() - val unk2 = buffer.readShortLE().toInt() - return DialogChoicePacket(unk1, unk2) - } -} diff --git a/protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/DialogDataPacket.kt b/protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/DialogDataPacket.kt deleted file mode 100644 index 202b2f5..0000000 --- a/protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/DialogDataPacket.kt +++ /dev/null @@ -1,27 +0,0 @@ -package de.fiereu.openmmo.protocols.game.packets - -import de.fiereu.openmmo.protocols.PacketDeserializer -import de.fiereu.openmmo.protocols.PacketSerializer -import io.netty.buffer.ByteBuf - -data class DialogDataPacket(val entityId: Long, val unk1: Int, val type: Int, val data: ByteArray) - -class DialogDataSerializer : PacketSerializer { - override fun serialize(packet: DialogDataPacket, buffer: ByteBuf) { - buffer.writeLongLE(packet.entityId) - buffer.writeByte(packet.unk1) - buffer.writeByte(packet.type) - buffer.writeBytes(packet.data) - } -} - -class DialogDataDeserializer : PacketDeserializer { - override fun deserialize(buffer: ByteBuf): DialogDataPacket { - val entityId = buffer.readLongLE() - val unk1 = buffer.readByte().toInt() - val type = buffer.readByte().toInt() - val data = ByteArray(buffer.readableBytes()) - buffer.readBytes(data) - return DialogDataPacket(entityId, unk1, type, data) - } -} diff --git a/protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/DialogOptionPacket.kt b/protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/DialogOptionPacket.kt deleted file mode 100644 index b006528..0000000 --- a/protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/DialogOptionPacket.kt +++ /dev/null @@ -1,19 +0,0 @@ -package de.fiereu.openmmo.protocols.game.packets - -import de.fiereu.openmmo.protocols.PacketDeserializer -import de.fiereu.openmmo.protocols.PacketSerializer -import io.netty.buffer.ByteBuf - -data class DialogOptionPacket(val data: Int) - -class DialogOptionSerializer : PacketSerializer { - override fun serialize(packet: DialogOptionPacket, buffer: ByteBuf) { - buffer.writeIntLE(packet.data) - } -} - -class DialogOptionDeserializer : PacketDeserializer { - override fun deserialize(buffer: ByteBuf): DialogOptionPacket { - return DialogOptionPacket(buffer.readIntLE()) - } -} diff --git a/protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/DialogStatePacket.kt b/protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/DialogStatePacket.kt deleted file mode 100644 index adb1ea5..0000000 --- a/protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/DialogStatePacket.kt +++ /dev/null @@ -1,19 +0,0 @@ -package de.fiereu.openmmo.protocols.game.packets - -import de.fiereu.openmmo.protocols.PacketDeserializer -import de.fiereu.openmmo.protocols.PacketSerializer -import io.netty.buffer.ByteBuf - -data class DialogStatePacket(val active: Boolean) - -class DialogStateSerializer : PacketSerializer { - override fun serialize(packet: DialogStatePacket, buffer: ByteBuf) { - buffer.writeBoolean(packet.active) - } -} - -class DialogStateDeserializer : PacketDeserializer { - override fun deserialize(buffer: ByteBuf): DialogStatePacket { - return DialogStatePacket(buffer.readBoolean()) - } -} diff --git a/protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/EntityInteractPacket.kt b/protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/EntityInteractPacket.kt deleted file mode 100644 index 32510de..0000000 --- a/protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/EntityInteractPacket.kt +++ /dev/null @@ -1,25 +0,0 @@ -package de.fiereu.openmmo.protocols.game.packets - -import de.fiereu.openmmo.protocols.PacketDeserializer -import de.fiereu.openmmo.protocols.PacketSerializer -import io.netty.buffer.ByteBuf - -data class EntityInteractPacket( - val entityId: Long, - val token: Long, -) - -class EntityInteractSerializer : PacketSerializer { - override fun serialize(packet: EntityInteractPacket, buffer: ByteBuf) { - buffer.writeLongLE(packet.entityId) - buffer.writeLongLE(packet.token) - } -} - -class EntityInteractDeserializer : PacketDeserializer { - override fun deserialize(buffer: ByteBuf): EntityInteractPacket { - val entityId = buffer.readLongLE() - val token = buffer.readLongLE() - return EntityInteractPacket(entityId, token) - } -} diff --git a/protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/EntityLeavePacket.kt b/protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/EntityLeavePacket.kt deleted file mode 100644 index 5053ead..0000000 --- a/protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/EntityLeavePacket.kt +++ /dev/null @@ -1,22 +0,0 @@ -package de.fiereu.openmmo.protocols.game.packets - -import de.fiereu.openmmo.protocols.PacketDeserializer -import de.fiereu.openmmo.protocols.PacketSerializer -import io.netty.buffer.ByteBuf - -data class EntityLeavePacket( - val entityId: Long, -) - -class EntityLeaveSerializer : PacketSerializer { - override fun serialize(packet: EntityLeavePacket, buffer: ByteBuf) { - buffer.writeLong(packet.entityId) - } -} - -class EntityLeaveDeserializer : PacketDeserializer { - override fun deserialize(buffer: ByteBuf): EntityLeavePacket { - val entityId = buffer.readLong() - return EntityLeavePacket(entityId) - } -} diff --git a/protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/EntityMovePacket.kt b/protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/EntityMovePacket.kt deleted file mode 100644 index e2083f7..0000000 --- a/protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/EntityMovePacket.kt +++ /dev/null @@ -1,41 +0,0 @@ -package de.fiereu.openmmo.protocols.game.packets - -import de.fiereu.openmmo.common.enums.Direction -import de.fiereu.openmmo.protocols.PacketDeserializer -import de.fiereu.openmmo.protocols.PacketSerializer -import io.netty.buffer.ByteBuf - -data class EntityMovePacket( - val entityId: Long, - val marker: Byte = 0x33, - val subtype: Byte = 0x03, - val seq: Byte = 0, - val x: Byte, - val y: Byte, - val direction: Direction, -) - -class EntityMovePacketSerializer : PacketSerializer { - override fun serialize(packet: EntityMovePacket, buffer: ByteBuf) { - buffer.writeLong(packet.entityId) - buffer.writeByte(packet.marker.toInt()) - buffer.writeByte(packet.subtype.toInt()) - buffer.writeByte(packet.seq.toInt()) - buffer.writeByte(packet.x.toInt()) - buffer.writeByte(packet.y.toInt()) - buffer.writeByte(packet.direction.ordinal) - } -} - -class EntityMovePacketDeserializer : PacketDeserializer { - override fun deserialize(buffer: ByteBuf): EntityMovePacket { - val entityId = buffer.readLong() - val marker = buffer.readByte() - val subtype = buffer.readByte() - val seq = buffer.readByte() - val x = buffer.readByte() - val y = buffer.readByte() - val direction = Direction.entries[buffer.readByte().toInt()] - return EntityMovePacket(entityId, marker, subtype, seq, x, y, direction) - } -} diff --git a/protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/FaceDirectionPacket.kt b/protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/FaceDirectionPacket.kt deleted file mode 100644 index 166073b..0000000 --- a/protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/FaceDirectionPacket.kt +++ /dev/null @@ -1,23 +0,0 @@ -package de.fiereu.openmmo.protocols.game.packets - -import de.fiereu.openmmo.common.enums.Direction -import de.fiereu.openmmo.protocols.PacketDeserializer -import de.fiereu.openmmo.protocols.PacketSerializer -import io.netty.buffer.ByteBuf - -data class FaceDirectionPacket( - val direction: Direction, -) - -class FaceDirectionSerializer : PacketSerializer { - override fun serialize(packet: FaceDirectionPacket, buffer: ByteBuf) { - buffer.writeByte(packet.direction.ordinal) - } -} - -class FaceDirectionDeserializer : PacketDeserializer { - override fun deserialize(buffer: ByteBuf): FaceDirectionPacket { - val direction = Direction.entries[buffer.readByte().toInt()] - return FaceDirectionPacket(direction) - } -} diff --git a/protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/InteractivePacket.kt b/protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/InteractivePacket.kt deleted file mode 100644 index 579d658..0000000 --- a/protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/InteractivePacket.kt +++ /dev/null @@ -1,40 +0,0 @@ -package de.fiereu.openmmo.protocols.game.packets - -import de.fiereu.openmmo.protocols.PacketDeserializer -import de.fiereu.openmmo.protocols.PacketSerializer -import io.netty.buffer.ByteBuf - -data class InteractivePacket( - val id: Int, - val type: Int, - val unk1: Int, - val unk2: Int, - val targetEntityId: Long, - val unk3: Int, - val unk4: Int, -) - -class InteractiveSerializer : PacketSerializer { - override fun serialize(packet: InteractivePacket, buffer: ByteBuf) { - buffer.writeByte(packet.id) - buffer.writeByte(packet.type) - buffer.writeIntLE(packet.unk1) - buffer.writeIntLE(packet.unk2) - buffer.writeLongLE(packet.targetEntityId) - buffer.writeShortLE(packet.unk3) - buffer.writeShortLE(packet.unk4) - } -} - -class InteractiveDeserializer : PacketDeserializer { - override fun deserialize(buffer: ByteBuf): InteractivePacket { - val id = buffer.readByte().toInt() - val type = buffer.readByte().toInt() - val unk1 = buffer.readIntLE() - val unk2 = buffer.readIntLE() - val targetEntityId = buffer.readLongLE() - val unk3 = buffer.readShortLE().toInt() - val unk4 = buffer.readShortLE().toInt() - return InteractivePacket(id, type, unk1, unk2, targetEntityId, unk3, unk4) - } -} diff --git a/protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/InteractiveResponsePacket.kt b/protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/InteractiveResponsePacket.kt deleted file mode 100644 index 56ac9e2..0000000 --- a/protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/InteractiveResponsePacket.kt +++ /dev/null @@ -1,25 +0,0 @@ -package de.fiereu.openmmo.protocols.game.packets - -import de.fiereu.openmmo.protocols.PacketDeserializer -import de.fiereu.openmmo.protocols.PacketSerializer -import io.netty.buffer.ByteBuf - -data class InteractiveResponsePacket( - val id: Int, - val unk: Int, -) - -class InteractiveResponseSerializer : PacketSerializer { - override fun serialize(packet: InteractiveResponsePacket, buffer: ByteBuf) { - buffer.writeByte(packet.id) - buffer.writeByte(packet.unk) - } -} - -class InteractiveResponseDeserializer : PacketDeserializer { - override fun deserialize(buffer: ByteBuf): InteractiveResponsePacket { - val id = buffer.readByte().toInt() - val unk = buffer.readByte().toInt() - return InteractiveResponsePacket(id, unk) - } -} diff --git a/protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/JoinGamePacket.kt b/protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/JoinGamePacket.kt deleted file mode 100644 index 18a82d6..0000000 --- a/protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/JoinGamePacket.kt +++ /dev/null @@ -1,173 +0,0 @@ -package de.fiereu.openmmo.protocols.game.packets - -import de.fiereu.openmmo.common.enums.Arch -import de.fiereu.openmmo.common.enums.Bitness -import de.fiereu.openmmo.common.enums.Platform -import de.fiereu.openmmo.protocols.PacketDeserializer -import de.fiereu.openmmo.protocols.PacketSerializer -import de.fiereu.openmmo.protocols.readUtf16LE -import de.fiereu.openmmo.protocols.writeUtf16LE -import io.netty.buffer.ByteBuf - -data class RomInfo(val code: String, val id: Byte, val type: Byte) - -abstract class GameAuthenticationData - -/** - * Used when a player reconnects to the game server after a disconnection. This data typically - * includes the sessions unique id and a session key that was issued by the login server to - * re-establish the session. - */ -data class ReconnectAuthData(val sessionId: Long, val sessionKey: ByteArray) : - GameAuthenticationData() - -/** - * Used when a player is joining the game server for the first time after logging in. This data - * typically includes the user's unique id and a session key that was issued by the login server to - * authenticate the session. - */ -data class NewAuthData( - val userId: Int, - val sessionKey: ByteArray, -) : GameAuthenticationData() - -data class JoinGamePacket( - val authData: GameAuthenticationData, - val mac: ByteArray, - val clientRevision: Int, - val installationRevision: Int, - val currentChatLanguage: Byte, - val chatLanguages: Short, - val matchmakingLanguages: Short, - val romMask: Byte, - val roms: List, - val clientInfo: Map, - val platform: Platform, - val arch: Arch, - val bitness: Bitness, - val unk1: ByteArray -) - -class JoinPacketSerializer : PacketSerializer { - override fun serialize(packet: JoinGamePacket, buffer: ByteBuf) { - when (packet.authData) { - is NewAuthData -> { - buffer.writeByte(0x00) - buffer.writeIntLE(packet.authData.userId) - buffer.writeByte(packet.authData.sessionKey.size) - buffer.writeBytes(packet.authData.sessionKey) - } - is ReconnectAuthData -> { - buffer.writeByte(0x01) - buffer.writeLongLE(packet.authData.sessionId) - buffer.writeByte(packet.authData.sessionKey.size) - buffer.writeBytes(packet.authData.sessionKey) - } - else -> - throw IllegalArgumentException( - "Unsupported authentication data type: ${packet.authData::class.simpleName}") - } - buffer.writeBytes(packet.mac) - buffer.writeIntLE(packet.clientRevision) - buffer.writeIntLE(packet.installationRevision) - buffer.writeByte(packet.currentChatLanguage.toInt()) - buffer.writeShortLE(packet.chatLanguages.toInt()) - buffer.writeShortLE(packet.matchmakingLanguages.toInt()) - buffer.writeByte(packet.romMask.toInt()) - - buffer.writeByte(packet.roms.size) - for (rom in packet.roms) { - buffer.writeUtf16LE(rom.code) - buffer.writeByte(rom.id.toInt()) - buffer.writeByte(rom.type.toInt()) - } - - buffer.writeByte(packet.clientInfo.size) - for ((key, value) in packet.clientInfo) { - buffer.writeByte(key.toInt()) - buffer.writeUtf16LE(value) - } - - buffer.writeByte(packet.platform.ordinal) - buffer.writeByte(packet.arch.ordinal) - buffer.writeByte(packet.bitness.ordinal) - - buffer.writeByte(packet.unk1.size) - buffer.writeBytes(packet.unk1) - } -} - -class JoinPacketDeserializer : PacketDeserializer { - override fun deserialize(buffer: ByteBuf): JoinGamePacket { - val authOption = buffer.readByte() - val authenticationData = - when (authOption) { - 0x00.toByte() -> { - val userId = buffer.readIntLE() - val sessionKeyLength = buffer.readUnsignedByte().toInt() - val sessionKey = ByteArray(sessionKeyLength) - buffer.readBytes(sessionKey) - NewAuthData(userId, sessionKey) - } - 0x01.toByte() -> { - val playerId = buffer.readLongLE() - val sessionKeyLength = buffer.readUnsignedByte().toInt() - val sessionKey = ByteArray(sessionKeyLength) - buffer.readBytes(sessionKey) - ReconnectAuthData(playerId, sessionKey) - } - else -> throw IllegalArgumentException("Unsupported authentication option: $authOption") - } - - val mac = ByteArray(6) - buffer.readBytes(mac) - - val clientRevision = buffer.readIntLE() - val installationRevision = buffer.readIntLE() - val currentChatLanguage = buffer.readByte() - val chatLanguages = buffer.readShortLE() - val ignoreLanguages = buffer.readShortLE() - val romMask = buffer.readByte() - - val romCount = buffer.readUnsignedByte().toInt() - val roms = mutableListOf() - for (i in 0 until romCount) { - val code = buffer.readUtf16LE() - val id = buffer.readByte() - val type = buffer.readByte() - roms.add(RomInfo(code, id, type)) - } - - val clientInfoCount = buffer.readUnsignedByte().toInt() - val clientInfo = mutableMapOf() - for (i in 0 until clientInfoCount) { - val key = buffer.readByte() - val value = buffer.readUtf16LE() - clientInfo[key] = value - } - - val platform = Platform.from(buffer.readByte().toInt()) - val arch = Arch.from(buffer.readByte().toInt()) - val bitness = Bitness.from(buffer.readByte().toInt()) - - val unk1 = buffer.readByte().toInt() - val unk2 = ByteArray(unk1) - buffer.readBytes(unk2) - - return JoinGamePacket( - authenticationData, - mac, - clientRevision, - installationRevision, - currentChatLanguage, - chatLanguages, - ignoreLanguages, - romMask, - roms, - clientInfo, - platform, - arch, - bitness, - unk2) - } -} diff --git a/protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/JoinResponsePacket.kt b/protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/JoinResponsePacket.kt deleted file mode 100644 index 46cd419..0000000 --- a/protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/JoinResponsePacket.kt +++ /dev/null @@ -1,79 +0,0 @@ -package de.fiereu.openmmo.protocols.game.packets - -import de.fiereu.openmmo.protocols.PacketDeserializer -import de.fiereu.openmmo.protocols.PacketSerializer -import de.fiereu.openmmo.protocols.readUtf16LE -import de.fiereu.openmmo.protocols.writeUtf16LE -import io.netty.buffer.ByteBuf -import java.time.LocalDate -import java.time.ZoneId - -/* - * Some info to the packet: - * The packet is sent in response to a JoinGamePacket BUT - * seems to also be sent as some kind of time sync packet - */ -data class JoinResponsePacket( - val canJoin: Boolean, - val stats: GameStats? = null - // we dont need TimeInfo here since it can be calculated on the fly -) { - data class GameStats(val playtime: Int, val rewardPoints: Int, val balance: Int) -} - -class JoinResponseSerializer : PacketSerializer { - override fun serialize(packet: JoinResponsePacket, buffer: ByteBuf) { - buffer.writeBoolean(packet.canJoin) - if (!packet.canJoin) return // no further data is sent - - // the following fields are not used by the client, so we send empty/default values - buffer.writeUtf16LE("") - buffer.writeByte(0) - - requireNotNull(packet.stats) { "Stats must be provided if canJoin is true" } - buffer.writeIntLE(packet.stats.playtime) // Playtime - buffer.writeIntLE(packet.stats.rewardPoints) // Reward Points - buffer.writeIntLE(packet.stats.balance) // Balance (pokeyen obvsly) - - // start of current day in epoch seconds - // used to calculate the current hour - buffer.writeIntLE(LocalDate.now().atStartOfDay(ZoneId.systemDefault()).toEpochSecond().toInt()) - // Used to calculate server time / desync - buffer.writeIntLE(((System.currentTimeMillis() / 1000).toInt())) - } -} - -class JoinResponseDeserializer : PacketDeserializer { - data class JoinResponsePacket( - val canJoin: Boolean, - val stats: GameStats? = null, - val time: TimeInfo? = null - ) { - - data class GameStats(val playtime: Int, val rewardPoints: Int, val balance: Int) - - data class TimeInfo(val serverDayStartSecond: Int, val serverCurrentSecond: Int) - } - - override fun deserialize(buffer: ByteBuf): JoinResponsePacket { - if (!buffer.readBoolean()) { - return JoinResponsePacket(false, null) - } - - // unused - buffer.readUtf16LE() - buffer.readByte() - - val playtime = buffer.readUnsignedIntLE().toInt() - val rewardPoints = buffer.readUnsignedIntLE().toInt() - val balance = buffer.readUnsignedIntLE().toInt() - - val serverDayStartSecond = buffer.readUnsignedIntLE().toInt() - val serverCurrentSecond = buffer.readUnsignedIntLE().toInt() - - return JoinResponsePacket( - true, - JoinResponsePacket.GameStats(playtime, rewardPoints, balance), - JoinResponsePacket.TimeInfo(serverDayStartSecond, serverCurrentSecond)) - } -} diff --git a/protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/KeepAlivePacket.kt b/protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/KeepAlivePacket.kt deleted file mode 100644 index 646dc5f..0000000 --- a/protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/KeepAlivePacket.kt +++ /dev/null @@ -1,26 +0,0 @@ -package de.fiereu.openmmo.protocols.game.packets - -import de.fiereu.openmmo.protocols.PacketDeserializer -import de.fiereu.openmmo.protocols.PacketSerializer -import io.netty.buffer.ByteBuf - -data class KeepAlivePacket( - val canJoin: Boolean, - val sessionData: ByteArray, -) - -class KeepAlivePacketSerializer : PacketSerializer { - override fun serialize(packet: KeepAlivePacket, buffer: ByteBuf) { - buffer.writeBoolean(packet.canJoin) - buffer.writeBytes(packet.sessionData) - } -} - -class KeepAlivePacketDeserializer : PacketDeserializer { - override fun deserialize(buffer: ByteBuf): KeepAlivePacket { - val canJoin = buffer.readBoolean() - val sessionData = ByteArray(buffer.readableBytes()) - buffer.readBytes(sessionData) - return KeepAlivePacket(canJoin, sessionData) - } -} diff --git a/protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/LoadEntityPacket.kt b/protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/LoadEntityPacket.kt deleted file mode 100644 index a471197..0000000 --- a/protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/LoadEntityPacket.kt +++ /dev/null @@ -1,140 +0,0 @@ -package de.fiereu.openmmo.protocols.game.packets - -import de.fiereu.openmmo.common.enums.Direction -import de.fiereu.openmmo.common.enums.EntityStatus -import de.fiereu.openmmo.common.enums.SkinSlot -import de.fiereu.openmmo.protocols.PacketDeserializer -import de.fiereu.openmmo.protocols.PacketSerializer -import de.fiereu.openmmo.protocols.game.packets.codecs.SkinSet -import de.fiereu.openmmo.protocols.game.packets.codecs.readSkinsLE -import de.fiereu.openmmo.protocols.game.packets.codecs.writeSkinsLE -import de.fiereu.openmmo.protocols.readUtf16LE -import de.fiereu.openmmo.protocols.writeShortLE -import de.fiereu.openmmo.protocols.writeUtf16LE -import io.netty.buffer.ByteBuf - -data class LoadEntityPacket( - val entityId: Long, - val skin: SkinSet, - val name: String, - val regionId: Int, - val bankId: Int, - val mapId: Int, - val x: Int, - val y: Int, - val z: Int, - val facing: Direction, - val transportation: Int = 0, - val entityNameplateType: Int = 0, - val status: EntityStatus, - val hasFollower: Boolean, - val followerDexId: Short, -) - -class LoadEntitySerializer : PacketSerializer { - override fun serialize(packet: LoadEntityPacket, buffer: ByteBuf) = - buffer.run { - writeLongLE(packet.entityId) - writeByte(0) - writeSkinsLE(packet.skin) - writeUtf16LE(packet.name) - writeByte(packet.regionId) - writeByte(packet.bankId) - writeByte(packet.mapId) - writeShortLE(packet.x) - writeShortLE(packet.y) - writeByte(packet.z) - writeByte(packet.facing.ordinal) - writeByte(packet.transportation) - writeByte(packet.entityNameplateType) - - var flags = 0 - if (packet.hasFollower) flags = flags or 0x04 - writeShortLE(flags) - if (flags and 0x01 != 0) { - writeByte(0) - } - - if (flags and 0x02 != 0) { - writeByte(0) - writeShortLE(flags) - } - - if (flags and 0x04 != 0) { - writeShortLE(packet.followerDexId) - } - - if (flags and 0x08 != 0) { - writeByte(0) - } - - if (flags and 0x10 != 0) { - writeIntLE(0) - writeUtf16LE("") - } - } -} - -class LoadEntityDeserializer : PacketDeserializer { - override fun deserialize(buffer: ByteBuf): LoadEntityPacket = - buffer.run { - val entityId = readLong() - readByte() // Skip padding byte - val skin = readSkinsLE(SkinSlot.entries) - val name = readUtf16LE() - val regionId = readByte().toInt() - val bankId = readByte().toInt() - val mapId = readByte().toInt() - val x = readShortLE() - val y = readShortLE() - val z = readByte().toInt() - val facing = Direction.entries[readByte().toInt()] - val transportation = readByte().toInt() - val entityNameplateType = readByte().toInt() - - val flags = readUnsignedShortLE() - if (flags and 0x01 != 0) { - readByte() - } - - if (flags and 0x02 != 0) { - readByte() - readUnsignedShortLE() - } - - val hasFollower = (flags and 0x04) != 0 - val followerDexId = - if (hasFollower) { - readShortLE() - } else { - 0 - } - - if (flags and 0x08 != 0) { - readByte() - } - - if (flags and 0x10 != 0) { - readInt() // Skip int value - readUtf16LE() // Skip string - } - - LoadEntityPacket( - entityId = entityId, - skin = skin, - name = name, - regionId = regionId, - bankId = bankId, - mapId = mapId, - x = x.toInt(), - y = y.toInt(), - z = z, - facing = facing, - transportation = transportation, - entityNameplateType = entityNameplateType, - status = EntityStatus.NONE, - hasFollower = hasFollower, - followerDexId = followerDexId, - ) - } -} diff --git a/protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/LoadMapPacket.kt b/protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/LoadMapPacket.kt deleted file mode 100644 index 3f52321..0000000 --- a/protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/LoadMapPacket.kt +++ /dev/null @@ -1,234 +0,0 @@ -package de.fiereu.openmmo.protocols.game.packets - -import de.fiereu.openmmo.common.Tile2D -import de.fiereu.openmmo.common.enums.EncounterType -import de.fiereu.openmmo.common.enums.Lighting -import de.fiereu.openmmo.common.enums.MapType -import de.fiereu.openmmo.common.enums.Weather -import de.fiereu.openmmo.common.utils.gzipCompress -import de.fiereu.openmmo.common.utils.gzipDecompress -import de.fiereu.openmmo.common.utils.isNdsRegion -import de.fiereu.openmmo.protocols.PacketDeserializer -import de.fiereu.openmmo.protocols.PacketSerializer -import de.fiereu.openmmo.protocols.game.packets.codecs.readTile2DLE -import de.fiereu.openmmo.protocols.game.packets.codecs.writeTile2DLE -import de.fiereu.openmmo.protocols.readUtf16LE -import de.fiereu.openmmo.protocols.writeUtf16LE -import io.netty.buffer.ByteBuf - -data class LoadMapPacket( - val reloadPlayer: Boolean, - val deleteCache: Boolean, - val regionId: Int, - val bankId: Int, - val mapId: Int, - val mapData: MapData -) { - init { - when (mapData) { - is MapData.NdsMapData -> require(isNdsRegion(regionId)) { "MapData is invalid" } - is MapData.GbaMapData -> require(!isNdsRegion(regionId)) { "MapData is invalid" } - } - } -} - -sealed interface MapData { - data class NdsMapData(val lighting: Lighting, val weather: Weather, val mapType: MapType) : - MapData - - data class GbaConnection( - val direction: Int, - val unknown: Int, - val targetBank: Int, - val targetMap: Int, - ) - - data class GbaMapData( - val width: Int, - val height: Int, - val paletteIdx1: Int, - val paletteIdx2: Int, - val borderWidth: Int, - val borderHeight: Int, - val unknownShort: Int = 0, - val unknownByte: Int = 0, - val borderTiles: List, - val lighting: Lighting, - val weather: Weather, - val mapType: MapType, - val encounterType: EncounterType, - val connections: List = emptyList(), - ) : MapData { - init { - require(borderWidth * borderHeight == borderTiles.size) { - "borderTiles size doesnt match dimensions" - } - require(borderWidth * borderHeight > 0) { "BorderWidth & Height must be greater than zero" } - } - } -} - -class LoadMapPacketSerializer : PacketSerializer { - override fun serialize(packet: LoadMapPacket, buffer: ByteBuf) { - buffer.apply { - var flags = 0 - if (packet.deleteCache) flags = flags or 1 - if (packet.reloadPlayer) flags = flags or 2 - - writeByte(flags) - - writeByte(packet.regionId) // Client will stop parsing if the region is not loaded - writeByte(packet.bankId) - writeByte(packet.mapId) - writeByte(0) - - when (packet.mapData) { - is MapData.NdsMapData -> { - writeShortLE(0) - val unk = 0 - writeByte(unk) - for (i in 0 until unk) { - writeShortLE(0) - writeShortLE(0) - } - - writeByte(packet.mapData.lighting.ordinal) - writeByte(packet.mapData.weather.ordinal) - writeByte(packet.mapData.mapType.ordinal) - } - is MapData.GbaMapData -> { - writeIntLE(packet.mapData.width) - writeIntLE(packet.mapData.height) - writeIntLE(packet.mapData.paletteIdx1) - writeIntLE(packet.mapData.paletteIdx2) - writeByte(packet.mapData.borderWidth) - writeByte(packet.mapData.borderHeight) - writeShortLE(packet.mapData.unknownShort) - writeByte(packet.mapData.unknownByte) - writeByte(packet.mapData.lighting.ordinal) - writeByte(packet.mapData.weather.ordinal) - writeByte(packet.mapData.mapType.ordinal) - writeByte(packet.mapData.encounterType.ordinal) - - for (tile2D in packet.mapData.borderTiles) { - writeTile2DLE(tile2D) - } - - val hasUnknown = false - writeBoolean(hasUnknown) - if (hasUnknown) { - val unknown = ByteArray(0) - writeIntLE(unknown.size) - writeBytes(unknown.gzipCompress()) - } - - val connections = packet.mapData.connections - writeByte(connections.size) - for (conn in connections) { - writeByte(conn.direction) - writeIntLE(conn.unknown) - writeByte(conn.targetBank) - writeByte(conn.targetMap) - } - - val hasUnknown2 = false - writeBoolean(hasUnknown2) - if (hasUnknown2) { - writeLongLE(0) - writeUtf16LE("") - } - } - } - } - } -} - -class LoadMapPacketDeserializer : PacketDeserializer { - override fun deserialize(buffer: ByteBuf): LoadMapPacket = - buffer.let { - val flags = buffer.readByte().toInt() - val deleteCache = (flags and 1) != 0 - val reloadPlayer = (flags and 2) != 0 - - val regionId = buffer.readByte().toInt() - val bankId = buffer.readByte().toInt() - val mapId = buffer.readByte().toInt() - buffer.readByte() - - val mapData = - if (isNdsRegion(regionId)) { - // NDS format - buffer.readShortLE() - val unk = buffer.readByte().toInt() - for (i in 0 until unk) { - buffer.readShortLE() - buffer.readShortLE() - } - val lighting = Lighting.entries[buffer.readByte().toInt()] - val weather = Weather.entries[buffer.readByte().toInt()] - val mapType = MapType.entries[buffer.readByte().toInt()] - MapData.NdsMapData(lighting, weather, mapType) - } else { - // GBA format - val width = buffer.readIntLE() - val height = buffer.readIntLE() - val paletteIdx1 = buffer.readIntLE() - val paletteIdx2 = buffer.readIntLE() - val borderWidth = buffer.readByte().toInt() - val borderHeight = buffer.readByte().toInt() - val unknownShort = buffer.readShortLE().toInt() - val unknownByte = buffer.readByte().toInt() - val lighting = Lighting.entries[buffer.readByte().toInt()] - val weather = Weather.entries[buffer.readByte().toInt()] - val mapType = MapType.entries[buffer.readByte().toInt()] - val encounterType = EncounterType.entries[buffer.readByte().toInt()] - - val borderTiles = mutableListOf() - for (i in 0 until (borderWidth * borderHeight)) { - borderTiles.add(buffer.readTile2DLE()) - } - - val hasUnknown = buffer.readBoolean() - if (hasUnknown) { - val unknownSize = buffer.readIntLE() - val unknownCompressed = ByteArray(unknownSize) - buffer.readBytes(unknownCompressed) - unknownCompressed.gzipDecompress() - } - - val connectionCount = buffer.readByte().toInt() - val connections = mutableListOf() - for (i in 0 until connectionCount) { - val direction = buffer.readByte().toInt() - val unknown = buffer.readIntLE() - val targetBank = buffer.readByte().toInt() - val targetMap = buffer.readByte().toInt() - connections.add(MapData.GbaConnection(direction, unknown, targetBank, targetMap)) - } - - val hasUnknown2 = buffer.readBoolean() - if (hasUnknown2) { - buffer.readLongLE() - buffer.readUtf16LE() - } - - MapData.GbaMapData( - width, - height, - paletteIdx1, - paletteIdx2, - borderWidth, - borderHeight, - unknownShort, - unknownByte, - borderTiles, - lighting, - weather, - mapType, - encounterType, - connections = connections) - } - - LoadMapPacket(reloadPlayer, deleteCache, regionId, bankId, mapId, mapData) - } -} diff --git a/protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/MapTransitionAckPacket.kt b/protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/MapTransitionAckPacket.kt deleted file mode 100644 index 0f7cafc..0000000 --- a/protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/MapTransitionAckPacket.kt +++ /dev/null @@ -1,19 +0,0 @@ -package de.fiereu.openmmo.protocols.game.packets - -import de.fiereu.openmmo.protocols.PacketDeserializer -import de.fiereu.openmmo.protocols.PacketSerializer -import io.netty.buffer.ByteBuf - -data class MapTransitionAckPacket(val unk: Int = 0) - -class MapTransitionAckSerializer : PacketSerializer { - override fun serialize(packet: MapTransitionAckPacket, buffer: ByteBuf) { - buffer.writeByte(packet.unk) - } -} - -class MapTransitionAckDeserializer : PacketDeserializer { - override fun deserialize(buffer: ByteBuf): MapTransitionAckPacket { - return MapTransitionAckPacket(buffer.readByte().toInt()) - } -} diff --git a/protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/MapTransitionPacket.kt b/protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/MapTransitionPacket.kt deleted file mode 100644 index cb0b883..0000000 --- a/protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/MapTransitionPacket.kt +++ /dev/null @@ -1,15 +0,0 @@ -package de.fiereu.openmmo.protocols.game.packets - -import de.fiereu.openmmo.protocols.PacketDeserializer -import de.fiereu.openmmo.protocols.PacketSerializer -import io.netty.buffer.ByteBuf - -class MapTransitionPacket - -class MapTransitionSerializer : PacketSerializer { - override fun serialize(packet: MapTransitionPacket, buffer: ByteBuf) {} -} - -class MapTransitionDeserializer : PacketDeserializer { - override fun deserialize(buffer: ByteBuf): MapTransitionPacket = MapTransitionPacket() -} diff --git a/protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/MovementPacket.kt b/protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/MovementPacket.kt deleted file mode 100644 index 817b607..0000000 --- a/protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/MovementPacket.kt +++ /dev/null @@ -1,29 +0,0 @@ -package de.fiereu.openmmo.protocols.game.packets - -import de.fiereu.openmmo.common.enums.Direction -import de.fiereu.openmmo.protocols.PacketDeserializer -import de.fiereu.openmmo.protocols.PacketSerializer -import io.netty.buffer.ByteBuf - -data class MovementPacket( - val x: Int, - val y: Int, - val direction: Direction, -) - -class MovementPacketSerializer : PacketSerializer { - override fun serialize(packet: MovementPacket, buffer: ByteBuf) { - buffer.writeShortLE(packet.x) - buffer.writeShortLE(packet.y) - buffer.writeByte(packet.direction.ordinal) - } -} - -class MovementPacketDeserializer : PacketDeserializer { - override fun deserialize(buffer: ByteBuf): MovementPacket { - val x = buffer.readShortLE().toInt() - val y = buffer.readShortLE().toInt() - val direction = Direction.entries[buffer.readByte().toInt()] - return MovementPacket(x, y, direction) - } -} diff --git a/protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/NpcAnimationPacket.kt b/protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/NpcAnimationPacket.kt deleted file mode 100644 index f960681..0000000 --- a/protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/NpcAnimationPacket.kt +++ /dev/null @@ -1,25 +0,0 @@ -package de.fiereu.openmmo.protocols.game.packets - -import de.fiereu.openmmo.protocols.PacketDeserializer -import de.fiereu.openmmo.protocols.PacketSerializer -import io.netty.buffer.ByteBuf - -data class NpcAnimationPacket( - val entityId: Long, - val animation: Int, -) - -class NpcAnimationSerializer : PacketSerializer { - override fun serialize(packet: NpcAnimationPacket, buffer: ByteBuf) { - buffer.writeLongLE(packet.entityId) - buffer.writeByte(packet.animation) - } -} - -class NpcAnimationDeserializer : PacketDeserializer { - override fun deserialize(buffer: ByteBuf): NpcAnimationPacket { - val entityId = buffer.readLongLE() - val animation = buffer.readByte().toInt() - return NpcAnimationPacket(entityId, animation) - } -} diff --git a/protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/NpcSpawnPacket.kt b/protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/NpcSpawnPacket.kt deleted file mode 100644 index fa14055..0000000 --- a/protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/NpcSpawnPacket.kt +++ /dev/null @@ -1,59 +0,0 @@ -package de.fiereu.openmmo.protocols.game.packets - -import de.fiereu.openmmo.protocols.PacketDeserializer -import de.fiereu.openmmo.protocols.PacketSerializer -import io.netty.buffer.ByteBuf - -data class NpcSpawnPacket( - val entityId: Long, - val unk1: Int, - val unk2: Int, - val unk3: Int, - val unk4: Int, - val regionId: Int, - val bankId: Int, - val mapId: Int, - val x: Int, - val y: Int, - val facing: Int, - val unk5: Int, - val unk6: Int, -) - -class NpcSpawnSerializer : PacketSerializer { - override fun serialize(packet: NpcSpawnPacket, buffer: ByteBuf) { - buffer.writeLongLE(packet.entityId) - buffer.writeByte(packet.unk1) - buffer.writeShortLE(packet.unk2) - buffer.writeShortLE(packet.unk3) - buffer.writeShortLE(packet.unk4) - buffer.writeByte(packet.regionId) - buffer.writeByte(packet.bankId) - buffer.writeByte(packet.mapId) - buffer.writeShortLE(packet.x) - buffer.writeShortLE(packet.y) - buffer.writeByte(packet.unk5) - buffer.writeByte(packet.facing) - buffer.writeShortLE(packet.unk6) - } -} - -class NpcSpawnDeserializer : PacketDeserializer { - override fun deserialize(buffer: ByteBuf): NpcSpawnPacket { - val entityId = buffer.readLongLE() - val unk1 = buffer.readByte().toInt() - val unk2 = buffer.readShortLE().toInt() - val unk3 = buffer.readShortLE().toInt() - val unk4 = buffer.readShortLE().toInt() - val regionId = buffer.readByte().toInt() - val bankId = buffer.readByte().toInt() - val mapId = buffer.readByte().toInt() - val x = buffer.readShortLE().toInt() - val y = buffer.readShortLE().toInt() - val unk5 = buffer.readByte().toInt() - val facing = buffer.readByte().toInt() - val unk6 = buffer.readShortLE().toInt() - return NpcSpawnPacket( - entityId, unk1, unk2, unk3, unk4, regionId, bankId, mapId, x, y, facing, unk5, unk6) - } -} diff --git a/protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/NpcUpdatePacket.kt b/protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/NpcUpdatePacket.kt deleted file mode 100644 index 5dbbc46..0000000 --- a/protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/NpcUpdatePacket.kt +++ /dev/null @@ -1,43 +0,0 @@ -package de.fiereu.openmmo.protocols.game.packets - -import de.fiereu.openmmo.protocols.PacketDeserializer -import de.fiereu.openmmo.protocols.PacketSerializer -import io.netty.buffer.ByteBuf - -data class NpcUpdatePacket( - val entityId: Long, - val regionId: Int, - val bankId: Int, - val mapId: Int, - val x: Int, - val y: Int, - val facing: Int, - val unk: Int, -) - -class NpcUpdateSerializer : PacketSerializer { - override fun serialize(packet: NpcUpdatePacket, buffer: ByteBuf) { - buffer.writeLongLE(packet.entityId) - buffer.writeByte(packet.regionId) - buffer.writeByte(packet.bankId) - buffer.writeByte(packet.mapId) - buffer.writeShortLE(packet.x) - buffer.writeShortLE(packet.y) - buffer.writeByte(packet.facing) - buffer.writeByte(packet.unk) - } -} - -class NpcUpdateDeserializer : PacketDeserializer { - override fun deserialize(buffer: ByteBuf): NpcUpdatePacket { - val entityId = buffer.readLongLE() - val regionId = buffer.readByte().toInt() - val bankId = buffer.readByte().toInt() - val mapId = buffer.readByte().toInt() - val x = buffer.readShortLE().toInt() - val y = buffer.readShortLE().toInt() - val facing = buffer.readByte().toInt() - val unk = buffer.readByte().toInt() - return NpcUpdatePacket(entityId, regionId, bankId, mapId, x, y, facing, unk) - } -} diff --git a/protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/NullPacket.kt b/protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/NullPacket.kt deleted file mode 100644 index 3c663ae..0000000 --- a/protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/NullPacket.kt +++ /dev/null @@ -1,10 +0,0 @@ -package de.fiereu.openmmo.protocols.game.packets - -import de.fiereu.openmmo.protocols.PacketDeserializer -import io.netty.buffer.ByteBuf - -class NullPacketDeserializer : PacketDeserializer { - override fun deserialize(buffer: ByteBuf) { - buffer.skipBytes(buffer.readableBytes()) - } -} diff --git a/protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/PokemonContainerPacket.kt b/protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/PokemonContainerPacket.kt deleted file mode 100644 index 0c60ad3..0000000 --- a/protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/PokemonContainerPacket.kt +++ /dev/null @@ -1,53 +0,0 @@ -package de.fiereu.openmmo.protocols.game.packets - -import de.fiereu.openmmo.common.Pokemon -import de.fiereu.openmmo.common.enums.PokemonContainer -import de.fiereu.openmmo.protocols.PacketDeserializer -import de.fiereu.openmmo.protocols.PacketSerializer -import de.fiereu.openmmo.protocols.game.packets.codecs.readPokemonLE -import de.fiereu.openmmo.protocols.game.packets.codecs.writePokemonLE -import io.netty.buffer.ByteBuf - -data class PokemonContainerPacket( - val container: PokemonContainer, - val hasChange: Boolean, - val delete: Boolean, - val pokemon: List, -) { - init { - if (delete) - require(hasChange) { - "Pokemon container cannot be deleted if the packet doesn't change anything" - } - if (delete) - require(pokemon.isEmpty()) { "Deleting a Pokemon container shouldn't have any pokemon" } - } -} - -class PokemonContainerSerializer : PacketSerializer { - override fun serialize(packet: PokemonContainerPacket, buffer: ByteBuf) = - buffer.run { - writeByte(packet.container.ordinal) - var flags = 0 - if (packet.hasChange) flags = flags or 1 - if (packet.delete) flags = flags or 2 - writeByte(flags) - if (packet.delete) return - writeByte(packet.pokemon.size) - for (pokemon in packet.pokemon) { - writePokemonLE(pokemon) - } - } -} - -class PokemonContainerDeserializer : PacketDeserializer { - override fun deserialize(buffer: ByteBuf): PokemonContainerPacket = - buffer.run { - val pokemonContainer = PokemonContainer.entries[buffer.readByte().toInt()] - val flags = buffer.readByte().toInt() - val hasChange = (flags and 1) != 0 - val delete = (flags and 2) != 0 - val pokemon = buildList(readByte().toInt()) { readPokemonLE() } - return PokemonContainerPacket(pokemonContainer, hasChange, delete, pokemon) - } -} diff --git a/protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/RenderScreenPacket.kt b/protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/RenderScreenPacket.kt deleted file mode 100644 index 4d986e6..0000000 --- a/protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/RenderScreenPacket.kt +++ /dev/null @@ -1,19 +0,0 @@ -package de.fiereu.openmmo.protocols.game.packets - -import de.fiereu.openmmo.protocols.PacketDeserializer -import de.fiereu.openmmo.protocols.PacketSerializer -import io.netty.buffer.ByteBuf - -data class RenderScreenPacket(val renderScreen: Boolean) - -class RenderScreenSerializer : PacketSerializer { - override fun serialize(packet: RenderScreenPacket, buffer: ByteBuf) { - buffer.writeBoolean(packet.renderScreen) - } -} - -class RenderScreenDeserializer : PacketDeserializer { - override fun deserialize(buffer: ByteBuf): RenderScreenPacket { - return RenderScreenPacket(buffer.readBoolean()) - } -} diff --git a/protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/RequestCharactersPacket.kt b/protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/RequestCharactersPacket.kt deleted file mode 100644 index 9aa0071..0000000 --- a/protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/RequestCharactersPacket.kt +++ /dev/null @@ -1,17 +0,0 @@ -package de.fiereu.openmmo.protocols.game.packets - -import de.fiereu.openmmo.protocols.PacketDeserializer -import de.fiereu.openmmo.protocols.PacketSerializer -import io.netty.buffer.ByteBuf - -class RequestCharactersPacket() - -class RequestCharactersPacketSerializer : PacketSerializer { - override fun serialize(packet: RequestCharactersPacket, buffer: ByteBuf) {} -} - -class RequestCharactersDeserializer : PacketDeserializer { - override fun deserialize(buffer: ByteBuf): RequestCharactersPacket { - return RequestCharactersPacket() - } -} diff --git a/protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/RequestPlayerPacket.kt b/protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/RequestPlayerPacket.kt deleted file mode 100644 index b59e01a..0000000 --- a/protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/RequestPlayerPacket.kt +++ /dev/null @@ -1,17 +0,0 @@ -package de.fiereu.openmmo.protocols.game.packets - -import de.fiereu.openmmo.protocols.PacketDeserializer -import de.fiereu.openmmo.protocols.PacketSerializer -import io.netty.buffer.ByteBuf - -class RequestPlayerPacket - -class RequestPlayerSerializer : PacketSerializer { - override fun serialize(packet: RequestPlayerPacket, buffer: ByteBuf) {} -} - -class RequestPlayerDeserializePacket : PacketDeserializer { - override fun deserialize(buffer: ByteBuf): RequestPlayerPacket { - return RequestPlayerPacket() - } -} diff --git a/protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/SelectCharacterPacket.kt b/protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/SelectCharacterPacket.kt deleted file mode 100644 index df94353..0000000 --- a/protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/SelectCharacterPacket.kt +++ /dev/null @@ -1,25 +0,0 @@ -package de.fiereu.openmmo.protocols.game.packets - -import de.fiereu.openmmo.protocols.PacketDeserializer -import de.fiereu.openmmo.protocols.PacketSerializer -import io.netty.buffer.ByteBuf - -data class SelectCharacterPacket(val characterId: Long, val characterIdHash: Long) - -class SelectCharacterSerializer : PacketSerializer { - override fun serialize(packet: SelectCharacterPacket, buffer: ByteBuf) { - buffer.apply { - buffer.writeLongLE(packet.characterId) - buffer.writeLongLE(packet.characterIdHash) - } - } -} - -class SelectCharacterDeserializer : PacketDeserializer { - override fun deserialize(buffer: ByteBuf): SelectCharacterPacket = - buffer.run { - val characterId = buffer.readLongLE() - val characterIdHash = buffer.readLongLE() - return SelectCharacterPacket(characterId, characterIdHash) - } -} diff --git a/protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/SelectedCharacterPacket.kt b/protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/SelectedCharacterPacket.kt deleted file mode 100644 index 6ae63f1..0000000 --- a/protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/SelectedCharacterPacket.kt +++ /dev/null @@ -1,30 +0,0 @@ -package de.fiereu.openmmo.protocols.game.packets - -import de.fiereu.openmmo.common.CharacterInfo -import de.fiereu.openmmo.protocols.PacketDeserializer -import de.fiereu.openmmo.protocols.PacketSerializer -import de.fiereu.openmmo.protocols.game.packets.codecs.readCharacterInfoLE -import de.fiereu.openmmo.protocols.game.packets.codecs.writeCharacterInfoLE -import io.netty.buffer.ByteBuf - -data class SelectedCharacterPacket(val character: CharacterInfo?) - -class SelectedCharacterSerializer : PacketSerializer { - override fun serialize(packet: SelectedCharacterPacket, buffer: ByteBuf) { - buffer.apply { - val hasCharacter = packet.character != null - writeBoolean(hasCharacter) - if (!hasCharacter) return - writeCharacterInfoLE(false, packet.character) - } - } -} - -class SelectedCharacterDeserializer : PacketDeserializer { - override fun deserialize(buffer: ByteBuf): SelectedCharacterPacket = - buffer.run { - val hasCharacter = readBoolean() - val character = if (hasCharacter) readCharacterInfoLE(false) else null - return SelectedCharacterPacket(character) - } -} diff --git a/protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/TokenPayloadPacket.kt b/protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/TokenPayloadPacket.kt deleted file mode 100644 index 4dab1e3..0000000 --- a/protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/TokenPayloadPacket.kt +++ /dev/null @@ -1,21 +0,0 @@ -package de.fiereu.openmmo.protocols.game.packets - -import de.fiereu.openmmo.protocols.PacketDeserializer -import de.fiereu.openmmo.protocols.PacketSerializer -import io.netty.buffer.ByteBuf - -data class TokenPayloadPacket(val payload: ByteArray) - -class TokenPayloadSerializer : PacketSerializer { - override fun serialize(packet: TokenPayloadPacket, buffer: ByteBuf) { - buffer.writeBytes(packet.payload) - } -} - -class TokenPayloadDeserializer : PacketDeserializer { - override fun deserialize(buffer: ByteBuf): TokenPayloadPacket { - val data = ByteArray(buffer.readableBytes()) - buffer.readBytes(data) - return TokenPayloadPacket(data) - } -} diff --git a/protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/builders/JoinResponsePacketBuilder.kt b/protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/builders/JoinResponsePacketBuilder.kt deleted file mode 100644 index 7bc0bd0..0000000 --- a/protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/builders/JoinResponsePacketBuilder.kt +++ /dev/null @@ -1,45 +0,0 @@ -package de.fiereu.openmmo.protocols.game.packets.builders - -import de.fiereu.openmmo.protocols.game.packets.JoinResponsePacket - -class JoinResponsePacketBuilder(private val canJoin: Boolean) { - private var playtime: Int = 0 - private var rewardPoints: Int = 0 - private var balance: Int = 0 - - companion object { - fun reject(): JoinResponsePacket { - return JoinResponsePacket(false) - } - - fun accept(): JoinResponsePacketBuilder { - return JoinResponsePacketBuilder(true) - } - } - - fun withPlaytime(playtime: Int): JoinResponsePacketBuilder { - this.playtime = playtime - return this - } - - fun withRewardPoints(rewardPoints: Int): JoinResponsePacketBuilder { - this.rewardPoints = rewardPoints - return this - } - - fun withBalance(balance: Int): JoinResponsePacketBuilder { - this.balance = balance - return this - } - - fun build(): JoinResponsePacket { - require(canJoin) { - "Cannot build a JoinResponsePacket with canJoin=false. Use JoinResponsePacketBuilder.reject() instead." - } - return JoinResponsePacket( - canJoin = true, - stats = - JoinResponsePacket.GameStats( - playtime = playtime, rewardPoints = rewardPoints, balance = balance)) - } -} diff --git a/protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/codecs/CharacterInfo.kt b/protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/codecs/CharacterInfo.kt deleted file mode 100644 index 409d6d3..0000000 --- a/protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/codecs/CharacterInfo.kt +++ /dev/null @@ -1,136 +0,0 @@ -package de.fiereu.openmmo.protocols.game.packets.codecs - -import de.fiereu.openmmo.common.CharacterInfo -import de.fiereu.openmmo.protocols.readEpochSeconds -import de.fiereu.openmmo.protocols.readUtf16LE -import de.fiereu.openmmo.protocols.writeEpochSecond -import de.fiereu.openmmo.protocols.writeUtf16LE -import io.netty.buffer.ByteBuf - -fun ByteBuf.writeCharacterInfoLE(useLong: Boolean, characterInfo: CharacterInfo) = apply { - writeLongLE(characterInfo.id) - writeUtf16LE(characterInfo.name) - writeUtf16LE("") - writeIntLE(characterInfo.userId) - writeByte(characterInfo.rivalSex.toInt()) - writeEpochSecond(characterInfo.lastLogin) - if (useLong) { - writeLongLE(0) - } - writeEpochSecond(characterInfo.createdAt) - writeIntLE(0) // unused - writeByte(0) // unused - writeIntLE(0) - writeIntLE(characterInfo.money) - writeShortLE(0) - writeIntLE(0) - writeByte(characterInfo.permissions) - writeByte(0) // unused - writeByte(0) - writeIntLE(0) - repeat(8) { - writeByte(0) // unused - } - writeShortLE(characterInfo.remainingSafariSteps.toInt()) - writeByte(characterInfo.remainingSafariBalls.toInt()) - writeIntLE(0) - writeByte(characterInfo.pcExtraSlots.toInt()) - writeByte(characterInfo.battleBoxExtraSlots.toInt()) - writeByte(characterInfo.templateAmount.toInt()) - writeByte(0) // unused - writeByte(0) // unused - writeByte(0) // unused - writeByte(characterInfo.positionRegionId.toInt()) - writeByte(characterInfo.positionBankId.toInt()) - writeByte(characterInfo.positionMapId.toInt()) - writeByte(0) // unused - writeShortLE(characterInfo.positionX.toInt()) - writeShortLE(characterInfo.positionY.toInt()) - writeByte(0) // unused - writeByte(0) // unused - writeShortLE(characterInfo.repelLeft.toInt()) - writeShortLE(characterInfo.repelItemId.toInt()) - writeByte(0) // 100 - writeShortLE(characterInfo.lureItemId.toInt()) - writeShortLE(characterInfo.lureLeft.toInt()) - val bytes = ByteArray(0) - writeShortLE(bytes.size) - writeBytes(bytes) -} - -fun ByteBuf.readCharacterInfoLE(useLong: Boolean): CharacterInfo = let { - val id = readLongLE() - val name = readUtf16LE() - val namePrefix = readUtf16LE() - val userId = readIntLE() - val rivalSex = readByte() - val lastLogin = readEpochSeconds() - if (useLong) { - readLongLE() - } - val createdAt = readEpochSeconds() - readIntLE() // unused - readByte() // unused - readIntLE() - val money = readIntLE() - readShortLE() - readIntLE() - val permissions = readByte().toInt() - readByte() // unused - readByte() - readIntLE() - repeat(8) { - readByte() // unused - } - val remainingSafariSteps = readShortLE() - val remainingSafariBalls = readByte() - readIntLE() - val pcExtraSlots = readByte() - val battleBoxExtraSlots = readByte() - val templateAmount = readByte() - readByte() // unused - readByte() // unused - readByte() // unused - val positionRegionId = readByte() - val positionBankId = readByte() - val positionMapId = readByte() - readByte() // unused - val positionX = readShortLE() - val positionY = readShortLE() - readByte() // unused - readByte() // unused - val repelLeft = readShortLE() - val repelItemId = readShortLE() - readByte() - val lureItemId = readShortLE() - val lureLeft = readShortLE() - val arraySize = readShortLE().toInt() - if (arraySize > 0) { - val bytes = ByteArray(arraySize) - readBytes(bytes) - } - return CharacterInfo( - id, - name, - namePrefix, - userId, - rivalSex, - lastLogin, - createdAt, - money, - permissions, - remainingSafariSteps, - remainingSafariBalls, - pcExtraSlots, - battleBoxExtraSlots, - templateAmount, - positionRegionId, - positionBankId, - positionMapId, - positionX, - positionY, - repelLeft, - repelItemId, - lureLeft, - lureItemId) -} diff --git a/protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/codecs/Pokemon.kt b/protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/codecs/Pokemon.kt deleted file mode 100644 index 45b7f38..0000000 --- a/protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/codecs/Pokemon.kt +++ /dev/null @@ -1,179 +0,0 @@ -package de.fiereu.openmmo.protocols.game.packets.codecs - -import de.fiereu.openmmo.common.Pokemon -import de.fiereu.openmmo.common.PokemonMove -import de.fiereu.openmmo.common.enums.EVs -import de.fiereu.openmmo.common.enums.PokemonContainer -import de.fiereu.openmmo.common.enums.PokemonRarity -import de.fiereu.openmmo.common.enums.compress -import de.fiereu.openmmo.common.enums.decompressIVs -import de.fiereu.openmmo.protocols.readEpochSeconds -import de.fiereu.openmmo.protocols.readUtf16LE -import de.fiereu.openmmo.protocols.writeByte -import de.fiereu.openmmo.protocols.writeEpochSecond -import de.fiereu.openmmo.protocols.writeShortLE -import de.fiereu.openmmo.protocols.writeUtf16LE -import io.netty.buffer.ByteBuf - -fun ByteBuf.writePokemonLE(pokemon: Pokemon) = apply { - writeLongLE(pokemon.id) - writeByte(0) - writeLongLE(0) - writeLongLE(0) // unused - writeByte(pokemon.container.ordinal) - writeShortLE(pokemon.containerSlot) - writeShortLE(pokemon.dexId) - writeIntLE(pokemon.seed) - writeLongLE(0) // unused - writeUtf16LE(pokemon.ot) - writeUtf16LE(pokemon.nickname) - writeByte(0) - writeByte(0) - writeByte(pokemon.level) - writeShortLE(pokemon.hp) - writeShortLE(0) - writeIntLE(pokemon.xp) - writeByte(0) - writeShortLE(0) - pokemon.moves.forEach { move -> writeShortLE(move.id) } - pokemon.moves.forEach { move -> writeByte(move.pp) } - arrayOf(0, 0, 0, 0).forEach { writeShortLE(it) } - - writeByte(pokemon.eVs.hp) - writeByte(pokemon.eVs.atk) - writeByte(pokemon.eVs.def) - writeByte(pokemon.eVs.spd) - writeByte(pokemon.eVs.spAtk) - writeByte(pokemon.eVs.spDef) - - writeByte(0) - writeByte(0) - writeByte(0) - writeByte(0) - writeByte(0) - writeByte(0) - writeByte(0) - writeByte(0) - writeByte(0) - writeByte(0) - writeByte(0) - - writeIntLE(pokemon.iVs.compress()) - writeByte(0) - writeLongLE(0) - - var rarityMask = 0 - if (pokemon.isShiny) rarityMask = rarityMask or (1 shl PokemonRarity.SHINY.ordinal) - if (pokemon.hasHiddenAbility) - rarityMask = rarityMask or (1 shl PokemonRarity.HIDDEN_ABILITY.ordinal) - if (pokemon.isAlpha) rarityMask = rarityMask or (1 shl PokemonRarity.ALPHA.ordinal) - if (pokemon.isSecret) rarityMask = rarityMask or (1 shl PokemonRarity.SECRET.ordinal) - if (pokemon.isFatefulEncounter) - rarityMask = rarityMask or (1 shl PokemonRarity.FATEFUL_ENCOUNTER.ordinal) - if (pokemon.isRaidEncounter) - rarityMask = rarityMask or (1 shl PokemonRarity.RAID_ENCOUNTER.ordinal) - writeShortLE(rarityMask) - - writeEpochSecond(pokemon.caughtAt) - writeShortLE(0) - writeByte(0) - writeByte(0) - - val unk = ByteArray(0) - writeByte(unk.size) - writeBytes(unk) - - writeBytes(ByteArray(12) { 0.toByte() }) -} - -fun ByteBuf.readPokemonLE(): Pokemon { - val id = readLongLE() - readByte() - readLongLE() - readLongLE() // unused - val container = PokemonContainer.entries[readUnsignedByte().toInt()] - val containerSlot = readShortLE() - val dexId = readUnsignedShortLE().toInt() - val seed = readIntLE() - readLongLE() // unused - val ot = readUtf16LE() - val nickname = readUtf16LE() - readByte() - readByte() - val level = readByte() - val currentHp = readShortLE() - readShortLE() - val xp = readIntLE() - readByte() - readShortLE() - val moves = List(4) { PokemonMove(readShortLE(), 0) } - moves.forEach { move -> move.pp = readByte() } - repeat(4) { readByte() } - val eVs = - EVs().apply { - hp = readByte().toInt() - atk = readByte().toInt() - def = readByte().toInt() - spd = readByte().toInt() - spAtk = readByte().toInt() - spDef = readByte().toInt() - } - readByte() - readByte() - readByte() - readByte() - readByte() - readByte() - readByte() - readByte() - readByte() - readByte() - readByte() - readByte() // unused - readByte() - readByte() - readByte() - readByte() - readByte() - val iVs = decompressIVs(readIntLE()) - readByte() - readLongLE() - - val rarityMask = readUnsignedShortLE() - val isShiny = (rarityMask and (1 shl PokemonRarity.SHINY.ordinal)) != 0 - val hasHiddenAbility = (rarityMask and (1 shl PokemonRarity.HIDDEN_ABILITY.ordinal)) != 0 - val isAlpha = (rarityMask and (1 shl PokemonRarity.ALPHA.ordinal)) != 0 - val isSecret = (rarityMask and (1 shl PokemonRarity.SECRET.ordinal)) != 0 - val isFatefulEncounter = (rarityMask and (1 shl PokemonRarity.FATEFUL_ENCOUNTER.ordinal)) != 0 - val isRaidEncounter = (rarityMask and (1 shl PokemonRarity.RAID_ENCOUNTER.ordinal)) != 0 - - val caughtAt = readEpochSeconds() - readShortLE() - readByte() - readByte() - - val unknown = ByteArray(readByte().toInt()) - readBytes(unknown) - - return Pokemon( - id, - container, - containerSlot, - dexId, - seed, - ot, - nickname, - level, - currentHp, - xp, - eVs, - iVs, - moves, - isShiny, - hasHiddenAbility, - isAlpha, - isSecret, - isFatefulEncounter, - isRaidEncounter, - caughtAt) -} diff --git a/protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/codecs/Skin.kt b/protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/codecs/Skin.kt deleted file mode 100644 index 4945660..0000000 --- a/protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/codecs/Skin.kt +++ /dev/null @@ -1,65 +0,0 @@ -package de.fiereu.openmmo.protocols.game.packets.codecs - -import de.fiereu.openmmo.common.enums.SkinSlot -import io.netty.buffer.ByteBuf -import java.util.EnumMap -import kotlin.enums.EnumEntries - -data class Skin(val slot: SkinSlot, val type: UShort?, val color: UByte?) - -class SkinSet() : EnumMap(SkinSlot::class.java) { - fun put(skin: Skin) { - this[skin.slot] = skin - } - - override fun put(key: SkinSlot, value: Skin): Skin? { - require(key == value.slot) { "Slot mismatch: $key != ${value.slot}" } - return super.put(key, value) - } -} - -fun ByteBuf.writeSkinsLE( - skinSet: SkinSet, - slots: EnumEntries = SkinSlot.entries, - writeByte: Boolean = true -) = apply { - if (writeByte) { - writeByte(0) - } - val mask = slots.fold(0) { acc, slot -> acc or (1 shl slot.ordinal) } - writeShortLE(mask) - - slots.forEach { slot -> - val skin = skinSet[slot] ?: Skin(slot, 0u, 0u) - val type = skin.type ?: 0x3FFFu - val color = skin.color ?: 0x3Fu - require(type <= 0x3FFFu) { "Skin type too large: ${skin.type}" } - require(color <= 0x3Fu) { "Skin color too large: ${skin.color}" } - - val compressed = (type and 0x3FFFu).toInt() or ((color and 0x3Fu).toInt() shl 10) - - writeShortLE(compressed) - } -} - -fun ByteBuf.readSkinsLE( - slots: EnumEntries, - readByte: Boolean = true, -): SkinSet { - if (readByte) { - readByte() - } - val mask = readUnsignedShortLE() - val skinSet = SkinSet() - - slots.forEach { slot -> - if ((mask and (1 shl slot.ordinal)) != 0) { - val compressed = readUnsignedShortLE() - val type = (compressed and 0x3FFF).toUShort() - val color = ((compressed shr 10) and 0x3F).toUByte() - skinSet.put(Skin(slot, type, color)) - } - } - - return skinSet -} diff --git a/protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/codecs/Tile2D.kt b/protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/codecs/Tile2D.kt deleted file mode 100644 index 36801fd..0000000 --- a/protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/codecs/Tile2D.kt +++ /dev/null @@ -1,14 +0,0 @@ -package de.fiereu.openmmo.protocols.game.packets.codecs - -import de.fiereu.openmmo.common.Tile2D -import io.netty.buffer.ByteBuf - -fun ByteBuf.readTile2DLE(): Tile2D { - val raw = readShortLE().toInt() - return Tile2D(material = (raw and 0x3FF).toShort(), collision = ((raw shr 10) and 0x3F).toByte()) -} - -fun ByteBuf.writeTile2DLE(tile: Tile2D) { - val raw = ((tile.collision.toInt() and 0x3F) shl 10) or (tile.material.toInt() and 0x3FF) - writeShortLE(raw) -} diff --git a/protocol.login/README.md b/protocol.login/README.md deleted file mode 100644 index 74bb9ec..0000000 --- a/protocol.login/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# Protocol.Login Module - -The protocol.login module implements login-specific protocol packets and serialization for OpenMMO authentication. diff --git a/protocol.login/src/main/kotlin/de/fiereu/openmmo/protocols/tls/LoginProtocol.kt b/protocol.login/src/main/kotlin/de/fiereu/openmmo/protocols/tls/LoginProtocol.kt deleted file mode 100644 index ec78fb5..0000000 --- a/protocol.login/src/main/kotlin/de/fiereu/openmmo/protocols/tls/LoginProtocol.kt +++ /dev/null @@ -1,76 +0,0 @@ -package de.fiereu.openmmo.protocols.tls - -import de.fiereu.openmmo.protocols.Protocol -import de.fiereu.openmmo.protocols.incomingPacket -import de.fiereu.openmmo.protocols.outgoingPacket -import de.fiereu.openmmo.protocols.tls.packets.GameServerListPacketDeserializer -import de.fiereu.openmmo.protocols.tls.packets.GameServerListPacketSerializer -import de.fiereu.openmmo.protocols.tls.packets.GameServerNodesPacketDeserializer -import de.fiereu.openmmo.protocols.tls.packets.GameServerNodesPacketSerializer -import de.fiereu.openmmo.protocols.tls.packets.JoinGameServerPacketDeserializer -import de.fiereu.openmmo.protocols.tls.packets.JoinGameServerPacketSerializer -import de.fiereu.openmmo.protocols.tls.packets.LoginKickPacketDeserializer -import de.fiereu.openmmo.protocols.tls.packets.LoginKickPacketSerializer -import de.fiereu.openmmo.protocols.tls.packets.LoginRequestPacketDeserializer -import de.fiereu.openmmo.protocols.tls.packets.LoginRequestPacketSerializer -import de.fiereu.openmmo.protocols.tls.packets.LoginResponsePacketDeserializer -import de.fiereu.openmmo.protocols.tls.packets.LoginResponsePacketSerializer -import de.fiereu.openmmo.protocols.tls.packets.MfaChallengePacketDeserializer -import de.fiereu.openmmo.protocols.tls.packets.MfaChallengePacketSerializer -import de.fiereu.openmmo.protocols.tls.packets.MfaResponsePacketDeserializer -import de.fiereu.openmmo.protocols.tls.packets.MfaResponsePacketSerializer -import de.fiereu.openmmo.protocols.tls.packets.RequestGameServerListPacketDeserializer -import de.fiereu.openmmo.protocols.tls.packets.RequestGameServerListPacketSerializer -import de.fiereu.openmmo.protocols.tls.packets.SentCredentialsPacketDeserializer -import de.fiereu.openmmo.protocols.tls.packets.SentCredentialsPacketSerializer -import de.fiereu.openmmo.protocols.tls.packets.SentExistingSessionPacketDeserializer -import de.fiereu.openmmo.protocols.tls.packets.SentExistingSessionPacketSerializer -import de.fiereu.openmmo.protocols.tls.packets.ToSConfirmationPacketDeserializer -import de.fiereu.openmmo.protocols.tls.packets.ToSConfirmationPacketSerializer -import de.fiereu.openmmo.protocols.tls.packets.ToSPacketDeserializer -import de.fiereu.openmmo.protocols.tls.packets.ToSPacketSerializer - -/** - * Login Protocol implementation. This protocol handles the login process after the TLS handshake is - * complete. - */ -abstract class LoginProtocol() : Protocol() { - override val async: Boolean = true - override val compressed: Boolean = false -} - -class LoginServerProtocol() : LoginProtocol() { - init { - outgoingPacket(0x01u, LoginResponsePacketSerializer()) - incomingPacket(0x02u, RequestGameServerListPacketDeserializer()) - incomingPacket(0x03u, JoinGameServerPacketDeserializer()) - outgoingPacket(0x03u, GameServerNodesPacketSerializer()) - incomingPacket(0x04u, ToSConfirmationPacketDeserializer()) - outgoingPacket(0x05u, LoginKickPacketSerializer()) - outgoingPacket(0x07u, SentCredentialsPacketSerializer()) - outgoingPacket(0x08u, MfaChallengePacketSerializer()) - incomingPacket(0x08u, MfaResponsePacketDeserializer()) - incomingPacket(0x11u, LoginRequestPacketDeserializer()) - outgoingPacket(0x14u, ToSPacketSerializer()) - outgoingPacket(0x22u, GameServerListPacketSerializer()) - outgoingPacket(0x26u, SentExistingSessionPacketSerializer()) - } -} - -class LoginClientProtocol() : LoginProtocol() { - init { - incomingPacket(0x01u, LoginResponsePacketDeserializer()) - outgoingPacket(0x02u, RequestGameServerListPacketSerializer()) - outgoingPacket(0x03u, JoinGameServerPacketSerializer()) - incomingPacket(0x03u, GameServerNodesPacketDeserializer()) - outgoingPacket(0x04u, ToSConfirmationPacketSerializer()) - incomingPacket(0x05u, LoginKickPacketDeserializer()) - incomingPacket(0x07u, SentCredentialsPacketDeserializer()) - incomingPacket(0x08u, MfaChallengePacketDeserializer()) - outgoingPacket(0x08u, MfaResponsePacketSerializer()) - outgoingPacket(0x11u, LoginRequestPacketSerializer()) - incomingPacket(0x14u, ToSPacketDeserializer()) - incomingPacket(0x22u, GameServerListPacketDeserializer()) - incomingPacket(0x26u, SentExistingSessionPacketDeserializer()) - } -} diff --git a/protocol.login/src/main/kotlin/de/fiereu/openmmo/protocols/tls/packets/ExistingSessionPacket.kt b/protocol.login/src/main/kotlin/de/fiereu/openmmo/protocols/tls/packets/ExistingSessionPacket.kt deleted file mode 100644 index 7f0bbe8..0000000 --- a/protocol.login/src/main/kotlin/de/fiereu/openmmo/protocols/tls/packets/ExistingSessionPacket.kt +++ /dev/null @@ -1,101 +0,0 @@ -package de.fiereu.openmmo.protocols.tls.packets - -import com.github.maltalex.ineter.base.IPv4Address -import com.github.maltalex.ineter.base.IPv6Address -import de.fiereu.openmmo.protocols.PacketDeserializer -import de.fiereu.openmmo.protocols.PacketSerializer -import de.fiereu.openmmo.protocols.readIpLE -import de.fiereu.openmmo.protocols.readUtf16LE -import de.fiereu.openmmo.protocols.writeIpLE -import de.fiereu.openmmo.protocols.writeUtf16LE -import io.netty.buffer.ByteBuf - -data class ExistingSessionPacket( - val sessionId: Long, - val sessionKey: ByteArray, - val serverName: String -) { - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (javaClass != other?.javaClass) return false - - other as ExistingSessionPacket - - if (sessionId != other.sessionId) return false - if (!sessionKey.contentEquals(other.sessionKey)) return false - if (serverName != other.serverName) return false - - return true - } - - override fun hashCode(): Int { - var result = sessionId.hashCode() - result = 31 * result + sessionKey.contentHashCode() - result = 31 * result + serverName.hashCode() - return result - } -} - -class SentExistingSessionPacketSerializer : PacketSerializer { - override fun serialize(packet: ExistingSessionPacket, buffer: ByteBuf) { - buffer.writeLongLE(packet.sessionId) - buffer.writeByte(packet.sessionKey.size) - buffer.writeBytes(packet.sessionKey) - - buffer.writeByte(0) - buffer.writeUtf16LE(packet.serverName) - - buffer.writeByte(0) - buffer.writeBytes(ByteArray(0)) // empty byte array for unknown purpose - - buffer.writeUtf16LE("") - - buffer.writeIntLE(0) - buffer.writeShortLE(0) - buffer.writeShortLE(0) - buffer.writeBoolean(false) - - val size: Byte = 0 - buffer.writeByte(size.toInt()) - for (i in 0 until size) { - buffer.writeByte(i) // not used on client - buffer.writeIpLE(IPv4Address.MIN_ADDR) - buffer.writeIpLE(IPv6Address.MIN_ADDR) - buffer.writeShortLE(0) // port - buffer.writeByte(0) - } - } -} - -class SentExistingSessionPacketDeserializer : PacketDeserializer { - override fun deserialize(buffer: ByteBuf): ExistingSessionPacket { - val sessionId = buffer.readLongLE() - val sessionKeyLength = buffer.readUnsignedByte().toInt() - val sessionKey = ByteArray(sessionKeyLength) - buffer.readBytes(sessionKey) - - buffer.readByte() - val serverName = buffer.readUtf16LE() - - val unk = ByteArray(buffer.readByte().toInt()) - buffer.readBytes(unk) - - buffer.readUtf16LE() - - buffer.readIntLE() - buffer.readShortLE() - buffer.readShortLE() - buffer.readBoolean() - - val size = buffer.readUnsignedByte().toInt() - for (i in 0 until size) { - buffer.readByte() // not used on client - buffer.readIpLE() // IPv4 - buffer.readIpLE() // IPv6 - buffer.readShortLE() // port - buffer.readByte() - } - - return ExistingSessionPacket(sessionId, sessionKey, serverName) - } -} diff --git a/protocol.login/src/main/kotlin/de/fiereu/openmmo/protocols/tls/packets/GameServerListPacket.kt b/protocol.login/src/main/kotlin/de/fiereu/openmmo/protocols/tls/packets/GameServerListPacket.kt deleted file mode 100644 index e8ded1e..0000000 --- a/protocol.login/src/main/kotlin/de/fiereu/openmmo/protocols/tls/packets/GameServerListPacket.kt +++ /dev/null @@ -1,69 +0,0 @@ -package de.fiereu.openmmo.protocols.tls.packets - -import de.fiereu.openmmo.protocols.PacketDeserializer -import de.fiereu.openmmo.protocols.PacketSerializer -import de.fiereu.openmmo.protocols.readUtf16LE -import de.fiereu.openmmo.protocols.writeUtf16LE -import io.netty.buffer.ByteBuf - -data class GameServer( - val id: UByte, - val name: String, - val currentPlayers: UShort = 0u, - val maxPlayers: UShort = 0u, - val joinable: Boolean -) - -data class GameServerListPacket(val gameServers: List) - -class GameServerListPacketSerializer : PacketSerializer { - override fun serialize(packet: GameServerListPacket, buffer: ByteBuf) { - require(packet.gameServers.size <= Byte.MAX_VALUE) { "Too many game servers" } - - buffer.writeByte(packet.gameServers.size) - - if (packet.gameServers.isEmpty()) { - buffer.writeByte(0) - buffer.writeByte(0) - return - } - - val first = packet.gameServers.first() - buffer.writeByte(first.id.toInt()) - - for (gameServer in packet.gameServers) { - buffer.writeByte(gameServer.id.toInt()) - buffer.writeUtf16LE(gameServer.name) - buffer.writeShortLE(gameServer.currentPlayers.toInt()) - buffer.writeShortLE(gameServer.maxPlayers.toInt()) - buffer.writeBoolean(gameServer.joinable) - } - } -} - -class GameServerListPacketDeserializer : PacketDeserializer { - override fun deserialize(buffer: ByteBuf): GameServerListPacket { - val serverCount = buffer.readUnsignedByte().toInt() - - if (serverCount == 0) { - buffer.readByte() // skip first server id (0) - buffer.readByte() // skip second byte (0) - return GameServerListPacket(emptyList()) - } - - val firstServerId = buffer.readUnsignedByte().toUByte() - val gameServers = mutableListOf() - - for (i in 0 until serverCount) { - val id = buffer.readUnsignedByte().toUByte() - val name = buffer.readUtf16LE() - val currentPlayers = buffer.readUnsignedShortLE().toUShort() - val maxPlayers = buffer.readUnsignedShortLE().toUShort() - val joinable = buffer.readBoolean() - - gameServers.add(GameServer(id, name, currentPlayers, maxPlayers, joinable)) - } - - return GameServerListPacket(gameServers) - } -} diff --git a/protocol.login/src/main/kotlin/de/fiereu/openmmo/protocols/tls/packets/GameServerNodesPacket.kt b/protocol.login/src/main/kotlin/de/fiereu/openmmo/protocols/tls/packets/GameServerNodesPacket.kt deleted file mode 100644 index 7e6763d..0000000 --- a/protocol.login/src/main/kotlin/de/fiereu/openmmo/protocols/tls/packets/GameServerNodesPacket.kt +++ /dev/null @@ -1,122 +0,0 @@ -package de.fiereu.openmmo.protocols.tls.packets - -import com.github.maltalex.ineter.base.IPAddress -import com.github.maltalex.ineter.base.IPv4Address -import com.github.maltalex.ineter.base.IPv6Address -import de.fiereu.openmmo.common.enums.LoginState -import de.fiereu.openmmo.protocols.PacketDeserializer -import de.fiereu.openmmo.protocols.PacketSerializer -import de.fiereu.openmmo.protocols.readIpLE -import de.fiereu.openmmo.protocols.readUtf16LE -import de.fiereu.openmmo.protocols.writeIpLE -import de.fiereu.openmmo.protocols.writeUtf16LE -import io.netty.buffer.ByteBuf - -/** - * Nodes are address entries for game servers that the client can connect to. The nodes are selected - * by a weighted random algorithm on the client side. The weight is a value between 0 and 255, where - * 0 means the node will never be selected and 255 means the node will always be selected. - * Typically, nodes are assigned weights based on their capacity or priority. - */ -data class GameServerNode( - val iPv4Address: IPv4Address, - val iPv6Address: IPv6Address, - val port: UShort = 7777u, - val weight: UByte -) - -data class GameServerData( - val gameServerId: UByte, - val userId: Int, - val sessionToken: ByteArray, - val localAddress: IPAddress, - val localHostname: String, - val port: UShort, -) - -data class GameServerNodesPacket( - val loginState: LoginState, - val gameServerData: GameServerData? = null, - val nodes: List = emptyList() -) - -class GameServerNodesPacketSerializer : PacketSerializer { - override fun serialize(packet: GameServerNodesPacket, buffer: ByteBuf) { - buffer.writeByte(packet.loginState.id) - if (packet.loginState != LoginState.AUTHED) { - return - } - - val gsd = - requireNotNull(packet.gameServerData) { "GameServerData must be provided for AUTHED state" } - - buffer.writeIntLE(gsd.userId) - buffer.writeByte(gsd.sessionToken.size) - buffer.writeBytes(gsd.sessionToken) - - buffer.writeByte(gsd.gameServerId.toInt()) - - val localAddressBytes = gsd.localAddress.toBigEndianArray() - buffer.writeByte(localAddressBytes.size) - buffer.writeBytes(localAddressBytes) - buffer.writeUtf16LE(gsd.localHostname) - - buffer.writeIntLE(gsd.port.toInt()) - - buffer.writeByte(packet.nodes.size) - for ((index, node) in packet.nodes.withIndex()) { - buffer.writeByte(index) - - buffer.writeIpLE(node.iPv4Address) - buffer.writeIpLE(node.iPv6Address) - - buffer.writeShortLE(node.port.toInt()) - buffer.writeByte(node.weight.toInt()) - } - } -} - -class GameServerNodesPacketDeserializer : PacketDeserializer { - - override fun deserialize(buffer: ByteBuf): GameServerNodesPacket { - val stateId = buffer.readUnsignedByte().toInt() - val loginState = LoginState.entries.find { it.id == stateId } ?: LoginState.SYSTEM_ERROR - if (loginState != LoginState.AUTHED) { - return GameServerNodesPacket(loginState) - } - - val userId = buffer.readIntLE() - - val sessionTokenSize = buffer.readUnsignedByte().toInt() - val sessionToken = ByteArray(sessionTokenSize) - buffer.readBytes(sessionToken) - - val gameServerId = buffer.readUnsignedByte().toUByte() - - val localAddressBuffer = ByteArray(buffer.readUnsignedByte().toInt()) - buffer.readBytes(localAddressBuffer) - val localAddress = IPAddress.of(localAddressBuffer) - val localHostname = buffer.readUtf16LE() - - val port = buffer.readUnsignedIntLE().toUShort() - - val nodeCount = buffer.readUnsignedByte().toInt() - val nodes = mutableListOf() - for (i in 0 until nodeCount) { - buffer.readByte() // padding - - val iPv4Address = buffer.readIpLE() as IPv4Address - val iPv6Address = buffer.readIpLE() as IPv6Address - - val nodePort = buffer.readUnsignedShortLE().toUShort() - val weight = buffer.readUnsignedByte().toUByte() - - nodes.add(GameServerNode(iPv4Address, iPv6Address, nodePort, weight)) - } - - return GameServerNodesPacket( - LoginState.AUTHED, - GameServerData(gameServerId, userId, sessionToken, localAddress, localHostname, port), - nodes) - } -} diff --git a/protocol.login/src/main/kotlin/de/fiereu/openmmo/protocols/tls/packets/JoinGameServerPacket.kt b/protocol.login/src/main/kotlin/de/fiereu/openmmo/protocols/tls/packets/JoinGameServerPacket.kt deleted file mode 100644 index 4c9cd63..0000000 --- a/protocol.login/src/main/kotlin/de/fiereu/openmmo/protocols/tls/packets/JoinGameServerPacket.kt +++ /dev/null @@ -1,20 +0,0 @@ -package de.fiereu.openmmo.protocols.tls.packets - -import de.fiereu.openmmo.protocols.PacketDeserializer -import de.fiereu.openmmo.protocols.PacketSerializer -import io.netty.buffer.ByteBuf - -data class JoinGameServerPacket(val gameServerId: UByte) - -class JoinGameServerPacketSerializer : PacketSerializer { - override fun serialize(packet: JoinGameServerPacket, buffer: ByteBuf) { - buffer.writeByte(packet.gameServerId.toInt()) - } -} - -class JoinGameServerPacketDeserializer : PacketDeserializer { - override fun deserialize(buffer: ByteBuf): JoinGameServerPacket { - val gameServerId = buffer.readUnsignedByte() - return JoinGameServerPacket(gameServerId.toUByte()) - } -} diff --git a/protocol.login/src/main/kotlin/de/fiereu/openmmo/protocols/tls/packets/LoginKickPacket.kt b/protocol.login/src/main/kotlin/de/fiereu/openmmo/protocols/tls/packets/LoginKickPacket.kt deleted file mode 100644 index 5e8fd2b..0000000 --- a/protocol.login/src/main/kotlin/de/fiereu/openmmo/protocols/tls/packets/LoginKickPacket.kt +++ /dev/null @@ -1,105 +0,0 @@ -package de.fiereu.openmmo.protocols.tls.packets - -import com.github.maltalex.ineter.base.IPv4Address -import de.fiereu.openmmo.protocols.PacketDeserializer -import de.fiereu.openmmo.protocols.PacketSerializer -import de.fiereu.openmmo.protocols.readIpRangeLE -import de.fiereu.openmmo.protocols.readUtf16LE -import de.fiereu.openmmo.protocols.writeIpRangeLE -import de.fiereu.openmmo.protocols.writeUtf16LE -import io.netty.buffer.ByteBuf - -// TODO needs proper investigation and implementation -// Could be split into multiple packets per KickReason -enum class KickReason { - A, - IP_RANGE, - C -} - -data class LoginKickPacket(val reason: KickReason?) - -class LoginKickPacketSerializer : PacketSerializer { - override fun serialize(packet: LoginKickPacket, buffer: ByteBuf) { - val hasReason = packet.reason != null - buffer.writeBoolean(hasReason) - if (!hasReason) return - - buffer.writeByte(packet.reason.ordinal) - when (packet.reason) { - KickReason.A -> { - buffer.writeIntLE(0) - buffer.writeIntLE(0) - buffer.writeIntLE(0) - buffer.writeIntLE(0) - buffer.writeUtf16LE("") - buffer.writeUtf16LE("") - buffer.writeByte(0) // could be a boolean - } - KickReason.IP_RANGE -> { - buffer.writeIntLE(0) - buffer.writeIpRangeLE(IPv4Address.MIN_ADDR, IPv4Address.MAX_ADDR) - buffer.writeIntLE(0) - buffer.writeIntLE(0) - buffer.writeUtf16LE("") - buffer.writeUtf16LE("") - buffer.writeByte(0) // could be a boolean - } - KickReason.C -> { - buffer.writeIntLE(0) - buffer.writeIntLE(0) - buffer.writeIntLE(0) - buffer.writeIntLE(0) - buffer.writeUtf16LE("") - buffer.writeUtf16LE("") - buffer.writeByte(0) // could be a boolean - } - } - } -} - -class LoginKickPacketDeserializer : PacketDeserializer { - override fun deserialize(buffer: ByteBuf): LoginKickPacket { - val hasReason = buffer.readBoolean() - if (!hasReason) { - return LoginKickPacket(null) - } - - val reasonOrdinal = buffer.readUnsignedByte().toInt() - val reason = - KickReason.entries.getOrNull(reasonOrdinal) - ?: throw IllegalArgumentException("Unknown kick reason: $reasonOrdinal") - - when (reason) { - KickReason.A -> { - buffer.readIntLE() - buffer.readIntLE() - buffer.readIntLE() - buffer.readIntLE() - buffer.readUtf16LE() - buffer.readUtf16LE() - buffer.readByte() // could be a boolean - } - KickReason.IP_RANGE -> { - buffer.readIntLE() - buffer.readIpRangeLE() - buffer.readIntLE() - buffer.readIntLE() - buffer.readUtf16LE() - buffer.readUtf16LE() - buffer.readByte() // could be a boolean - } - KickReason.C -> { - buffer.readIntLE() - buffer.readIntLE() - buffer.readIntLE() - buffer.readIntLE() - buffer.readUtf16LE() - buffer.readUtf16LE() - buffer.readByte() // could be a boolean - } - } - - return LoginKickPacket(reason) - } -} diff --git a/protocol.login/src/main/kotlin/de/fiereu/openmmo/protocols/tls/packets/LoginRequestPacket.kt b/protocol.login/src/main/kotlin/de/fiereu/openmmo/protocols/tls/packets/LoginRequestPacket.kt deleted file mode 100644 index dfdd54e..0000000 --- a/protocol.login/src/main/kotlin/de/fiereu/openmmo/protocols/tls/packets/LoginRequestPacket.kt +++ /dev/null @@ -1,107 +0,0 @@ -package de.fiereu.openmmo.protocols.tls.packets - -import de.fiereu.openmmo.common.enums.Language -import de.fiereu.openmmo.protocols.PacketDeserializer -import de.fiereu.openmmo.protocols.PacketSerializer -import de.fiereu.openmmo.protocols.readUtf16LE -import de.fiereu.openmmo.protocols.writeUtf16LE -import io.netty.buffer.ByteBuf - -interface LoginMethod - -data class PasswordLogin(val password: String, val stayLoggedIn: Boolean) : LoginMethod - -data class TokenLogin(val token: ByteArray) : LoginMethod - -data class LoginRequestPacket( - val username: String, - val manualLogin: Boolean, - val hwid: ByteArray, - val method: LoginMethod, - val language: Language, - val clientRevision: Int, - val installationRevision: Int, - val os: UByte, - val hardwareInfoCache: ByteArray -) - -class LoginRequestPacketSerializer : PacketSerializer { - override fun serialize(packet: LoginRequestPacket, buffer: ByteBuf) { - buffer.writeUtf16LE(packet.username) - buffer.writeBoolean(packet.manualLogin) - buffer.writeByte(packet.hwid.size) - buffer.writeBytes(packet.hwid) - - when (packet.method) { - is PasswordLogin -> { - buffer.writeByte(0) // Method type: Password - buffer.writeUtf16LE(packet.method.password) - buffer.writeBoolean(packet.method.stayLoggedIn) - } - is TokenLogin -> { - buffer.writeByte(1) // Method type: Token - buffer.writeByte(packet.method.token.size) - buffer.writeBytes(packet.method.token) - } - } - - buffer.writeUtf16LE(packet.language.code) - buffer.writeIntLE(packet.clientRevision) - buffer.writeIntLE(packet.installationRevision) - buffer.writeByte(packet.os.toInt()) - buffer.writeByte(packet.hardwareInfoCache.size) - buffer.writeBytes(packet.hardwareInfoCache) - } -} - -class LoginRequestPacketDeserializer : PacketDeserializer { - override fun deserialize(buffer: ByteBuf): LoginRequestPacket { - val username = buffer.readUtf16LE() - val manualLogin = buffer.readBoolean() - - val hwidSize = buffer.readUnsignedByte().toInt() - val hwid = ByteArray(hwidSize) - buffer.readBytes(hwid) - - val methodType = buffer.readByte().toInt() - val method: LoginMethod = - when (methodType) { - 0 -> { // Password - val password = buffer.readUtf16LE() - val stayLoggedIn = buffer.readBoolean() - PasswordLogin(password, stayLoggedIn) - } - - 1 -> { // Token - val tokenSize = buffer.readUnsignedByte().toInt() - val token = ByteArray(tokenSize) - buffer.readBytes(token) - TokenLogin(token) - } - - else -> throw IllegalArgumentException("Unknown login method type: $methodType") - } - - val languageCode = buffer.readUtf16LE() - val language = Language.fromCode(languageCode) - - val clientRevision = buffer.readIntLE() - val installationRevision = buffer.readIntLE() - val os = buffer.readUnsignedByte().toUByte() - - val hardwareInfoCacheSize = buffer.readUnsignedByte().toInt() - val hardwareInfoCache = ByteArray(hardwareInfoCacheSize) - buffer.readBytes(hardwareInfoCache) - - return LoginRequestPacket( - username, - manualLogin, - hwid, - method, - language, - clientRevision, - installationRevision, - os, - hardwareInfoCache) - } -} diff --git a/protocol.login/src/main/kotlin/de/fiereu/openmmo/protocols/tls/packets/LoginResponsePacket.kt b/protocol.login/src/main/kotlin/de/fiereu/openmmo/protocols/tls/packets/LoginResponsePacket.kt deleted file mode 100644 index f1cdb30..0000000 --- a/protocol.login/src/main/kotlin/de/fiereu/openmmo/protocols/tls/packets/LoginResponsePacket.kt +++ /dev/null @@ -1,47 +0,0 @@ -package de.fiereu.openmmo.protocols.tls.packets - -import de.fiereu.openmmo.common.enums.LoginState -import de.fiereu.openmmo.protocols.PacketDeserializer -import de.fiereu.openmmo.protocols.PacketSerializer -import de.fiereu.openmmo.protocols.readUtf16LE -import de.fiereu.openmmo.protocols.writeUtf16LE -import io.netty.buffer.ByteBuf -import java.time.LocalDateTime - -data class LoginResponsePacket(val state: LoginState, val ratelimitEnd: LocalDateTime?) { - constructor(state: LoginState) : this(state, null) -} - -class LoginResponsePacketSerializer : PacketSerializer { - override fun serialize(packet: LoginResponsePacket, buffer: ByteBuf) { - buffer.writeByte(packet.state.id) - if (packet.state == LoginState.RATE_LIMITED || packet.state == LoginState.RATE_LIMITED_2FA) { - val epochSeconds = - packet.ratelimitEnd?.toEpochSecond(java.time.ZoneOffset.UTC) - ?: throw IllegalArgumentException( - "ratelimitEnd must be provided for RATE_LIMITED states") - buffer.writeLongLE(epochSeconds) - } - if (packet.state == LoginState.AUTHED) { - buffer.writeUtf16LE("") - } - } -} - -class LoginResponsePacketDeserializer : PacketDeserializer { - override fun deserialize(buffer: ByteBuf): LoginResponsePacket { - val stateId = buffer.readUnsignedByte().toInt() - val state = LoginState.entries.find { it.id == stateId } ?: LoginState.SYSTEM_ERROR - - var ratelimitEnd = LocalDateTime.now() - if (state == LoginState.RATE_LIMITED || state == LoginState.RATE_LIMITED_2FA) { - val epochSeconds = buffer.readLongLE() - ratelimitEnd = LocalDateTime.ofEpochSecond(epochSeconds, 0, java.time.ZoneOffset.UTC) - } - if (state == LoginState.AUTHED) { - buffer.readUtf16LE() - } - - return LoginResponsePacket(state, ratelimitEnd) - } -} diff --git a/protocol.login/src/main/kotlin/de/fiereu/openmmo/protocols/tls/packets/MfaChallengePacket.kt b/protocol.login/src/main/kotlin/de/fiereu/openmmo/protocols/tls/packets/MfaChallengePacket.kt deleted file mode 100644 index 2c3be78..0000000 --- a/protocol.login/src/main/kotlin/de/fiereu/openmmo/protocols/tls/packets/MfaChallengePacket.kt +++ /dev/null @@ -1,24 +0,0 @@ -package de.fiereu.openmmo.protocols.tls.packets - -import de.fiereu.openmmo.protocols.PacketDeserializer -import de.fiereu.openmmo.protocols.PacketSerializer -import de.fiereu.openmmo.protocols.readUtf16LE -import de.fiereu.openmmo.protocols.writeUtf16LE -import io.netty.buffer.ByteBuf - -data class MfaChallengePacket(val unk: Byte, val email: String) - -class MfaChallengePacketSerializer : PacketSerializer { - override fun serialize(packet: MfaChallengePacket, buffer: ByteBuf) { - buffer.writeByte(packet.unk.toInt()) - buffer.writeUtf16LE(packet.email) - } -} - -class MfaChallengePacketDeserializer : PacketDeserializer { - override fun deserialize(buffer: ByteBuf): MfaChallengePacket { - val unk = buffer.readByte() - val email = buffer.readUtf16LE() - return MfaChallengePacket(unk, email) - } -} diff --git a/protocol.login/src/main/kotlin/de/fiereu/openmmo/protocols/tls/packets/MfaResponsePacket.kt b/protocol.login/src/main/kotlin/de/fiereu/openmmo/protocols/tls/packets/MfaResponsePacket.kt deleted file mode 100644 index ecf46f3..0000000 --- a/protocol.login/src/main/kotlin/de/fiereu/openmmo/protocols/tls/packets/MfaResponsePacket.kt +++ /dev/null @@ -1,22 +0,0 @@ -package de.fiereu.openmmo.protocols.tls.packets - -import de.fiereu.openmmo.protocols.PacketDeserializer -import de.fiereu.openmmo.protocols.PacketSerializer -import de.fiereu.openmmo.protocols.readUtf16LE -import de.fiereu.openmmo.protocols.writeUtf16LE -import io.netty.buffer.ByteBuf - -data class MfaResponsePacket(val mfaCode: String) - -class MfaResponsePacketSerializer : PacketSerializer { - override fun serialize(packet: MfaResponsePacket, buffer: ByteBuf) { - buffer.writeUtf16LE(packet.mfaCode) - } -} - -class MfaResponsePacketDeserializer : PacketDeserializer { - override fun deserialize(buffer: ByteBuf): MfaResponsePacket { - val mfaCode = buffer.readUtf16LE() - return MfaResponsePacket(mfaCode) - } -} diff --git a/protocol.login/src/main/kotlin/de/fiereu/openmmo/protocols/tls/packets/RequestGameServerListPacket.kt b/protocol.login/src/main/kotlin/de/fiereu/openmmo/protocols/tls/packets/RequestGameServerListPacket.kt deleted file mode 100644 index c48e6b8..0000000 --- a/protocol.login/src/main/kotlin/de/fiereu/openmmo/protocols/tls/packets/RequestGameServerListPacket.kt +++ /dev/null @@ -1,20 +0,0 @@ -package de.fiereu.openmmo.protocols.tls.packets - -import de.fiereu.openmmo.protocols.PacketDeserializer -import de.fiereu.openmmo.protocols.PacketSerializer -import io.netty.buffer.ByteBuf - -class RequestGameServerListPacket - -class RequestGameServerListPacketSerializer : PacketSerializer { - override fun serialize(packet: RequestGameServerListPacket, buffer: ByteBuf) { - // No data to serialize - } -} - -class RequestGameServerListPacketDeserializer : PacketDeserializer { - override fun deserialize(buffer: ByteBuf): RequestGameServerListPacket { - // No data to deserialize - return RequestGameServerListPacket() - } -} diff --git a/protocol.login/src/main/kotlin/de/fiereu/openmmo/protocols/tls/packets/SentCredentialsPacket.kt b/protocol.login/src/main/kotlin/de/fiereu/openmmo/protocols/tls/packets/SentCredentialsPacket.kt deleted file mode 100644 index 1388de0..0000000 --- a/protocol.login/src/main/kotlin/de/fiereu/openmmo/protocols/tls/packets/SentCredentialsPacket.kt +++ /dev/null @@ -1,49 +0,0 @@ -package de.fiereu.openmmo.protocols.tls.packets - -import de.fiereu.openmmo.protocols.PacketDeserializer -import de.fiereu.openmmo.protocols.PacketSerializer -import de.fiereu.openmmo.protocols.readUtf16LE -import de.fiereu.openmmo.protocols.writeUtf16LE -import io.netty.buffer.ByteBuf -import java.util.Base64 - -/** - * This packet is sent to the Client to give it the credentials for a user. These credentials are - * used so no password is stored on the User PC and the Client can automatically log in the user - * without asking for a password. - */ -data class SentCredentialsPacket(val username: String, val key: String) { - /** - * Constructor for when a key is provided. - * - * @param username the username of the user whose credentials we want to send. - * @param keyBytes the key for the user as a byte array. - */ - constructor( - username: String, - keyBytes: ByteArray? - ) : this(username, keyBytes?.let { Base64.getEncoder().encodeToString(it) } ?: "") - - /** - * Constructor for when no key is provided. The Client will remove the credentials for this user - * from its credential list. - * - * @param username the username of the user whose credentials we want to remove. - */ - constructor(username: String) : this(username, "") -} - -class SentCredentialsPacketSerializer : PacketSerializer { - override fun serialize(packet: SentCredentialsPacket, buffer: ByteBuf) { - buffer.writeUtf16LE(packet.username) - buffer.writeUtf16LE(packet.key) - } -} - -class SentCredentialsPacketDeserializer : PacketDeserializer { - override fun deserialize(buffer: ByteBuf): SentCredentialsPacket { - val username = buffer.readUtf16LE() - val key = buffer.readUtf16LE() - return SentCredentialsPacket(username, key) - } -} diff --git a/protocol.login/src/main/kotlin/de/fiereu/openmmo/protocols/tls/packets/ToSConfirmationPacket.kt b/protocol.login/src/main/kotlin/de/fiereu/openmmo/protocols/tls/packets/ToSConfirmationPacket.kt deleted file mode 100644 index 147dcc7..0000000 --- a/protocol.login/src/main/kotlin/de/fiereu/openmmo/protocols/tls/packets/ToSConfirmationPacket.kt +++ /dev/null @@ -1,20 +0,0 @@ -package de.fiereu.openmmo.protocols.tls.packets - -import de.fiereu.openmmo.protocols.PacketDeserializer -import de.fiereu.openmmo.protocols.PacketSerializer -import io.netty.buffer.ByteBuf - -data class ToSConfirmationPacket(val confirmationKey: Byte) - -class ToSConfirmationPacketSerializer : PacketSerializer { - override fun serialize(packet: ToSConfirmationPacket, buffer: ByteBuf) { - buffer.writeByte(packet.confirmationKey.toInt()) - } -} - -class ToSConfirmationPacketDeserializer : PacketDeserializer { - override fun deserialize(buffer: ByteBuf): ToSConfirmationPacket { - val confirmationKey = buffer.readByte() - return ToSConfirmationPacket(confirmationKey) - } -} diff --git a/protocol.login/src/main/kotlin/de/fiereu/openmmo/protocols/tls/packets/ToSPacket.kt b/protocol.login/src/main/kotlin/de/fiereu/openmmo/protocols/tls/packets/ToSPacket.kt deleted file mode 100644 index 56bf67d..0000000 --- a/protocol.login/src/main/kotlin/de/fiereu/openmmo/protocols/tls/packets/ToSPacket.kt +++ /dev/null @@ -1,49 +0,0 @@ -package de.fiereu.openmmo.protocols.tls.packets - -import de.fiereu.openmmo.protocols.PacketDeserializer -import de.fiereu.openmmo.protocols.PacketSerializer -import io.netty.buffer.ByteBuf -import java.io.ByteArrayInputStream -import java.io.ByteArrayOutputStream -import java.nio.charset.StandardCharsets -import java.util.zip.GZIPInputStream -import java.util.zip.GZIPOutputStream - -data class ToSPacket(val confirmationKey: Byte, val tosText: String) - -class ToSPacketSerializer : PacketSerializer { - override fun serialize(packet: ToSPacket, buffer: ByteBuf) { - buffer.writeByte(packet.confirmationKey.toInt()) - - val compressedText = compressString(packet.tosText) - buffer.writeShortLE(compressedText.size) - buffer.writeBytes(compressedText) - } - - private fun compressString(text: String): ByteArray { - val baos = ByteArrayOutputStream() - GZIPOutputStream(baos).use { gzipOut -> - gzipOut.write(text.toByteArray(StandardCharsets.UTF_8)) - } - return baos.toByteArray() - } -} - -class ToSPacketDeserializer : PacketDeserializer { - override fun deserialize(buffer: ByteBuf): ToSPacket { - val confirmationKey = buffer.readByte() - val tosLength = buffer.readUnsignedShortLE() - val compressedTosText = ByteArray(tosLength) - buffer.readBytes(compressedTosText) - - val decompressedText = decompressBytes(compressedTosText) - return ToSPacket(confirmationKey, decompressedText) - } - - private fun decompressBytes(compressed: ByteArray): String { - val bais = ByteArrayInputStream(compressed) - return GZIPInputStream(bais).use { gzipIn -> - String(gzipIn.readAllBytes(), StandardCharsets.UTF_8) - } - } -} diff --git a/protocol.login/src/main/kotlin/de/fiereu/openmmo/protocols/tls/packets/builders/GameServerListPacketBuilder.kt b/protocol.login/src/main/kotlin/de/fiereu/openmmo/protocols/tls/packets/builders/GameServerListPacketBuilder.kt deleted file mode 100644 index a89412a..0000000 --- a/protocol.login/src/main/kotlin/de/fiereu/openmmo/protocols/tls/packets/builders/GameServerListPacketBuilder.kt +++ /dev/null @@ -1,36 +0,0 @@ -package de.fiereu.openmmo.protocols.tls.packets.builders - -import de.fiereu.openmmo.protocols.tls.packets.GameServer -import de.fiereu.openmmo.protocols.tls.packets.GameServerListPacket - -class GameServerListPacketBuilder { - private val servers = mutableListOf() - - companion object { - fun create(): GameServerListPacketBuilder = GameServerListPacketBuilder() - - fun withServers(servers: List): GameServerListPacket { - return GameServerListPacket(servers) - } - - fun empty(): GameServerListPacket = GameServerListPacket(emptyList()) - } - - fun addServer( - id: UByte, - name: String, - currentPlayers: UShort = 0u, - maxPlayers: UShort = 0u, - joinable: Boolean = true - ): GameServerListPacketBuilder { - servers.add(GameServer(id, name, currentPlayers, maxPlayers, joinable)) - return this - } - - fun addServer(server: GameServer): GameServerListPacketBuilder { - servers.add(server) - return this - } - - fun build(): GameServerListPacket = GameServerListPacket(servers.toList()) -} diff --git a/protocol.login/src/main/kotlin/de/fiereu/openmmo/protocols/tls/packets/builders/GameServerNodesPacketBuilder.kt b/protocol.login/src/main/kotlin/de/fiereu/openmmo/protocols/tls/packets/builders/GameServerNodesPacketBuilder.kt deleted file mode 100644 index 5f6e354..0000000 --- a/protocol.login/src/main/kotlin/de/fiereu/openmmo/protocols/tls/packets/builders/GameServerNodesPacketBuilder.kt +++ /dev/null @@ -1,59 +0,0 @@ -package de.fiereu.openmmo.protocols.tls.packets.builders - -import com.github.maltalex.ineter.base.IPAddress -import de.fiereu.openmmo.common.enums.LoginState -import de.fiereu.openmmo.protocols.tls.packets.GameServerData -import de.fiereu.openmmo.protocols.tls.packets.GameServerNode -import de.fiereu.openmmo.protocols.tls.packets.GameServerNodesPacket - -class GameServerNodesPacketBuilder { - companion object { - fun forState(loginState: LoginState): GameServerNodesPacket { - require(loginState != LoginState.AUTHED) { "Use forAuthedUser() for AUTHED state" } - return GameServerNodesPacket(loginState) - } - - fun forAuthedUser( - userId: Int, - sessionToken: ByteArray, - gameServerId: UByte - ): AuthedPacketBuilder { - return AuthedPacketBuilder(userId, sessionToken, gameServerId) - } - } -} - -class AuthedPacketBuilder -internal constructor( - private val userId: Int, - private val sessionToken: ByteArray, - private val gameServerId: UByte -) { - private var localAddress: IPAddress? = null - private var localHostname: String? = null - private var port: UShort? = null - private var nodes: List = emptyList() - - fun withLocalEndpoint(address: IPAddress, hostname: String, port: UShort): AuthedPacketBuilder { - this.localAddress = address - this.localHostname = hostname - this.port = port - return this - } - - fun withNodes(nodes: List): AuthedPacketBuilder { - this.nodes = nodes - return this - } - - fun build(): GameServerNodesPacket { - requireNotNull(localAddress) { "Local address must be set for AUTHED packets" } - requireNotNull(localHostname) { "Local hostname must be set for AUTHED packets" } - requireNotNull(port) { "Port must be set for AUTHED packets" } - - val gameServerData = - GameServerData(gameServerId, userId, sessionToken, localAddress!!, localHostname!!, port!!) - - return GameServerNodesPacket(LoginState.AUTHED, gameServerData, nodes) - } -} diff --git a/protocol.login/src/main/kotlin/de/fiereu/openmmo/protocols/tls/packets/builders/LoginResponsePacketBuilder.kt b/protocol.login/src/main/kotlin/de/fiereu/openmmo/protocols/tls/packets/builders/LoginResponsePacketBuilder.kt deleted file mode 100644 index 3823736..0000000 --- a/protocol.login/src/main/kotlin/de/fiereu/openmmo/protocols/tls/packets/builders/LoginResponsePacketBuilder.kt +++ /dev/null @@ -1,23 +0,0 @@ -package de.fiereu.openmmo.protocols.tls.packets.builders - -import de.fiereu.openmmo.common.enums.LoginState -import de.fiereu.openmmo.protocols.tls.packets.LoginResponsePacket -import java.time.LocalDateTime - -class LoginResponsePacketBuilder { - companion object { - fun withState(state: LoginState): LoginResponsePacket { - require(state != LoginState.RATE_LIMITED && state != LoginState.RATE_LIMITED_2FA) { - "Use withRateLimit() for rate limited states" - } - return LoginResponsePacket(state) - } - - fun withRateLimit(state: LoginState, ratelimitEnd: LocalDateTime): LoginResponsePacket { - require(state == LoginState.RATE_LIMITED || state == LoginState.RATE_LIMITED_2FA) { - "Rate limit end time can only be used with RATE_LIMITED states" - } - return LoginResponsePacket(state, ratelimitEnd) - } - } -} diff --git a/protocol.tls/README.md b/protocol.tls/README.md deleted file mode 100644 index 4672f05..0000000 --- a/protocol.tls/README.md +++ /dev/null @@ -1,35 +0,0 @@ -# Protocol.TLS Module - -The protocol.tls module implements a custom TLS-like protocol for secure client-server communication in OpenMMO. - -## Contents - -### Core Classes -- **TlsProtocol**: Abstract base protocol for TLS handshake implementation -- **TlsServerProtocol**: Server-side TLS protocol implementation -- **TlsClientProtocol**: Client-side TLS protocol implementation - -### Packet Types -- **ClientHelloPacket**: Initial handshake packet sent by client -- **ServerHelloPacket**: Server response containing server's public key -- **ClientReadyPacket**: Client confirmation with client's public key - -### Cryptographic Features -- **ECKeyExtensions**: Extensions for elliptic curve key operations -- ECDH key exchange for shared secret derivation -- Secure communication setup using ECDSA key pairs - -## Protocol Flow -1. Client sends `ClientHello` to initiate handshake -2. Server responds with `ServerHello` containing its public key -3. Client derives shared secret using ECDH and switches to secure mode -4. Client sends `ClientReady` with its public key -5. Server derives shared secret and switches to next protocol (e.g., LoginProtocol) - -## Dependencies -- Protocol module for base framework -- BouncyCastle crypto libraries for cryptographic operations -- Kotest for testing - -## Security -This module implements a custom TLS-like protocol specifically designed for PokeMMO server compatibility, using ECDSA with secp256r1 curve for key exchange and authentication. diff --git a/protocol.tls/build.gradle.kts b/protocol.tls/build.gradle.kts deleted file mode 100644 index a4e697c..0000000 --- a/protocol.tls/build.gradle.kts +++ /dev/null @@ -1,11 +0,0 @@ -plugins { - id("buildsrc.convention.kotlin-jvm") - id("buildsrc.convention.spotless") -} - -dependencies { - api(project(":protocol")) - api(libs.bundles.crypto) - - testImplementation(libs.bundles.kotest) -} diff --git a/protocol.tls/src/main/kotlin/de/fiereu/openmmo/protocols/tls/TlsProtocol.kt b/protocol.tls/src/main/kotlin/de/fiereu/openmmo/protocols/tls/TlsProtocol.kt deleted file mode 100644 index b4e78a4..0000000 --- a/protocol.tls/src/main/kotlin/de/fiereu/openmmo/protocols/tls/TlsProtocol.kt +++ /dev/null @@ -1,43 +0,0 @@ -package de.fiereu.openmmo.protocols.tls - -import de.fiereu.openmmo.protocols.Protocol -import de.fiereu.openmmo.protocols.incomingPacket -import de.fiereu.openmmo.protocols.outgoingPacket -import de.fiereu.openmmo.protocols.tls.packets.* -import java.security.interfaces.ECPrivateKey -import java.security.interfaces.ECPublicKey - -/** - * TLS Protocol implementation. This protocol handles the initial TLS handshake before any secure - * communication can take place. - * - * The flow is as follows: - * 1. Client sends a ClientHello packet to initiate the handshake. - * 2. Server responds with a ServerHello packet. -> The client knows the servers public key and its - * own private key. And it can derive a shared secret using ECDH. -> Every packet the client now - * would receive is expected to be secured. -> Client switches to next protocol (e.g. - * LoginProtocol) after the handshake is complete. - * 3. Client sends a ClientReady packet with its public key. -> The server can now secure its - * communication with the client using the shared secret. -> Server switches to next protocol - * (e.g. LoginProtocol) after the handshake is complete. - */ -abstract class TlsProtocol() : Protocol() { - override val async: Boolean = false - override val compressed: Boolean = false -} - -class TlsServerProtocol(serverKeyPair: Pair) : TlsProtocol() { - init { - incomingPacket(0x00u, ClientHelloPacketDeserializer()) - outgoingPacket(0x01u, ServerHelloPacketSerializer(serverKeyPair.first)) - incomingPacket(0x02u, ClientReadyPacketDeserializer()) - } -} - -class TlsClientProtocol() : TlsProtocol() { - init { - outgoingPacket(0x00u, ClientHelloPacketSerializer()) - incomingPacket(0x01u, ServerHelloPacketDeserializer()) - outgoingPacket(0x02u, ClientReadyPacketSerializer()) - } -} diff --git a/protocol.tls/src/main/kotlin/de/fiereu/openmmo/protocols/tls/packets/ClientHelloPacket.kt b/protocol.tls/src/main/kotlin/de/fiereu/openmmo/protocols/tls/packets/ClientHelloPacket.kt deleted file mode 100644 index 0bdfc04..0000000 --- a/protocol.tls/src/main/kotlin/de/fiereu/openmmo/protocols/tls/packets/ClientHelloPacket.kt +++ /dev/null @@ -1,37 +0,0 @@ -package de.fiereu.openmmo.protocols.tls.packets - -import de.fiereu.openmmo.protocols.PacketDeserializer -import de.fiereu.openmmo.protocols.PacketSerializer -import io.netty.buffer.ByteBuf -import kotlin.random.Random - -private const val key1 = 3214621489648854472L -private const val key2 = -4214651440992349575L - -data class ClientHelloPacket(val timestamp: Long) - -class ClientHelloPacketSerializer : PacketSerializer { - - override fun serialize(packet: ClientHelloPacket, buffer: ByteBuf) { - val randomKey = Random.nextLong() - - val xoredRandomKey = randomKey xor key1 - val xoredTimestamp = packet.timestamp xor key2 xor randomKey - - buffer.writeLongLE(xoredRandomKey) - buffer.writeLongLE(xoredTimestamp) - } -} - -class ClientHelloPacketDeserializer : PacketDeserializer { - - override fun deserialize(buffer: ByteBuf): ClientHelloPacket { - val xoredRandomKey = buffer.readLongLE() - val xoredTimestamp = buffer.readLongLE() - - val randomKey = xoredRandomKey xor key1 - val timestamp = xoredTimestamp xor key2 xor randomKey - - return ClientHelloPacket(timestamp) - } -} diff --git a/protocol.tls/src/main/kotlin/de/fiereu/openmmo/protocols/tls/packets/ClientReadyPacket.kt b/protocol.tls/src/main/kotlin/de/fiereu/openmmo/protocols/tls/packets/ClientReadyPacket.kt deleted file mode 100644 index 02ef5b5..0000000 --- a/protocol.tls/src/main/kotlin/de/fiereu/openmmo/protocols/tls/packets/ClientReadyPacket.kt +++ /dev/null @@ -1,32 +0,0 @@ -package de.fiereu.openmmo.protocols.tls.packets - -import de.fiereu.openmmo.protocols.PacketDeserializer -import de.fiereu.openmmo.protocols.PacketSerializer -import de.fiereu.openmmo.protocols.tls.util.toECPublicKey -import de.fiereu.openmmo.protocols.tls.util.toUncompressedPoint -import io.netty.buffer.ByteBuf -import java.security.interfaces.ECPublicKey - -data class ClientReadyPacket(val clientPublicKey: ECPublicKey) - -class ClientReadyPacketSerializer : PacketSerializer { - - override fun serialize(packet: ClientReadyPacket, buffer: ByteBuf) { - val publicKeyBytes = packet.clientPublicKey.toUncompressedPoint() - - buffer.writeShortLE(publicKeyBytes.size) - buffer.writeBytes(publicKeyBytes) - } -} - -class ClientReadyPacketDeserializer : PacketDeserializer { - - override fun deserialize(buffer: ByteBuf): ClientReadyPacket { - val keyBytes = ByteArray(buffer.readShortLE().toInt()) - buffer.readBytes(keyBytes) - - val publicKey = keyBytes.toECPublicKey() - - return ClientReadyPacket(publicKey) - } -} diff --git a/protocol.tls/src/main/kotlin/de/fiereu/openmmo/protocols/tls/packets/ServerHelloPacket.kt b/protocol.tls/src/main/kotlin/de/fiereu/openmmo/protocols/tls/packets/ServerHelloPacket.kt deleted file mode 100644 index e4e42f1..0000000 --- a/protocol.tls/src/main/kotlin/de/fiereu/openmmo/protocols/tls/packets/ServerHelloPacket.kt +++ /dev/null @@ -1,62 +0,0 @@ -package de.fiereu.openmmo.protocols.tls.packets - -import de.fiereu.openmmo.protocols.PacketDeserializer -import de.fiereu.openmmo.protocols.PacketSerializer -import de.fiereu.openmmo.protocols.tls.util.sign -import de.fiereu.openmmo.protocols.tls.util.toECPublicKey -import de.fiereu.openmmo.protocols.tls.util.toUncompressedPoint -import io.netty.buffer.ByteBuf -import java.security.PublicKey -import java.security.interfaces.ECPrivateKey -import java.security.interfaces.ECPublicKey - -/** - * Represents a server hello packet in the TLS handshake. - * - * @property publicKey The public key generated for this connection. - * @property checksumSize The size of the checksum used for this connection. - */ -data class ServerHelloPacket(val publicKey: ECPublicKey, val checksumSize: Int) - -class ServerHelloPacketSerializer(private val serverRootPrivateKey: ECPrivateKey) : - PacketSerializer { - - override fun serialize(packet: ServerHelloPacket, buffer: ByteBuf) { - val publicKeyBytes = packet.publicKey.toUncompressedPoint() - val signature = serverRootPrivateKey.sign(publicKeyBytes) - - buffer.writeShortLE(publicKeyBytes.size) - buffer.writeBytes(publicKeyBytes) - - buffer.writeShortLE(signature.size) - buffer.writeBytes(signature) - - buffer.writeByte(packet.checksumSize) - } -} - -class ServerHelloPacketDeserializer : - PacketDeserializer { - - data class ServerHelloPacket( - val clientPublicKey: PublicKey, - val signature: ByteArray, - val checksumSize: Int - ) - - override fun deserialize(buffer: ByteBuf): ServerHelloPacket { - val publicKeySize = buffer.readShortLE().toInt() - val publicKeyBytes = ByteArray(publicKeySize) - buffer.readBytes(publicKeyBytes) - - val clientPublicKey = publicKeyBytes.toECPublicKey() - - val signatureSize = buffer.readShortLE().toInt() - val signature = ByteArray(signatureSize) - buffer.readBytes(signature) - - val checksumSize = buffer.readByte().toInt() - - return ServerHelloPacket(clientPublicKey, signature, checksumSize) - } -} diff --git a/protocol.tls/src/main/kotlin/de/fiereu/openmmo/protocols/tls/util/ECKeyExtensions.kt b/protocol.tls/src/main/kotlin/de/fiereu/openmmo/protocols/tls/util/ECKeyExtensions.kt deleted file mode 100644 index 9647340..0000000 --- a/protocol.tls/src/main/kotlin/de/fiereu/openmmo/protocols/tls/util/ECKeyExtensions.kt +++ /dev/null @@ -1,95 +0,0 @@ -package de.fiereu.openmmo.protocols.tls.util - -import java.math.BigInteger -import java.security.AlgorithmParameters -import java.security.KeyFactory -import java.security.Signature -import java.security.interfaces.ECPrivateKey -import java.security.interfaces.ECPublicKey -import java.security.spec.ECGenParameterSpec -import java.security.spec.ECParameterSpec -import java.security.spec.ECPoint -import java.security.spec.ECPublicKeySpec - -private const val uncompressedPointIndicator: Byte = 0x04 - -private val keyFactory: KeyFactory = KeyFactory.getInstance("EC") - -private val ecParameterSpec: ECParameterSpec by lazy { - val algorithmParameters = AlgorithmParameters.getInstance("EC") - algorithmParameters.init(ECGenParameterSpec("secp256r1")) - algorithmParameters.getParameterSpec(ECParameterSpec::class.java) -} - -fun ECPublicKey.toUncompressedPoint(): ByteArray { - val key = this - val point = key.w - val keyLength = (ecParameterSpec.order.bitLength() + Byte.SIZE_BITS - 1) / Byte.SIZE_BITS - - var offset = 0 - val data = ByteArray(1 + 2 * keyLength) - data[offset++] = uncompressedPointIndicator - - val x = point.affineX.toByteArray() - val y = point.affineY.toByteArray() - - when { - x.size <= keyLength -> { - System.arraycopy(x, 0, data, offset + keyLength - x.size, x.size) - } - x.size == keyLength + 1 && x[0] == 0.toByte() -> { - System.arraycopy(x, 1, data, offset, keyLength) - } - else -> { - throw IllegalStateException("x value is too large") - } - } - - offset += keyLength - when { - y.size <= keyLength -> { - System.arraycopy(y, 0, data, offset + keyLength - y.size, y.size) - } - y.size == keyLength + 1 && y[0] == 0.toByte() -> { - System.arraycopy(y, 1, data, offset, keyLength) - } - else -> { - throw IllegalStateException("y value is too large") - } - } - - return data -} - -fun ByteArray.toECPublicKey(): ECPublicKey { - if (this[0] != uncompressedPointIndicator) { - throw IllegalArgumentException("Invalid uncompressed point indicator") - } - - val keyLength = (ecParameterSpec.order.bitLength() + Byte.SIZE_BITS - 1) / Byte.SIZE_BITS - if (this.size != 1 + 2 * keyLength) { - throw IllegalArgumentException("Invalid data length") - } - - var offset = 1 - val x = BigInteger(1, this.copyOfRange(offset, offset + keyLength)) - offset += keyLength - val y = BigInteger(1, this.copyOfRange(offset, offset + keyLength)) - val point = ECPoint(x, y) - - return keyFactory.generatePublic(ECPublicKeySpec(point, ecParameterSpec)) as ECPublicKey -} - -fun ECPrivateKey.sign(data: ByteArray): ByteArray { - val signature = Signature.getInstance("SHA256withECDSA") - signature.initSign(this) - signature.update(data) - return signature.sign() -} - -fun ECPublicKey.verify(data: ByteArray, signatureBytes: ByteArray): Boolean { - val signature = Signature.getInstance("SHA256withECDSA") - signature.initVerify(this) - signature.update(data) - return signature.verify(signatureBytes) -} diff --git a/protocol/README.md b/protocol/README.md deleted file mode 100644 index 353684a..0000000 --- a/protocol/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# Protocol Module - -The protocol module provides the core packet protocol framework for OpenMMO, including serialization and deserialization capabilities. diff --git a/protocol/src/main/kotlin/de/fiereu/openmmo/protocols/ByteBufExtension.kt b/protocol/src/main/kotlin/de/fiereu/openmmo/protocols/ByteBufExtension.kt deleted file mode 100644 index 3d1059b..0000000 --- a/protocol/src/main/kotlin/de/fiereu/openmmo/protocols/ByteBufExtension.kt +++ /dev/null @@ -1,89 +0,0 @@ -package de.fiereu.openmmo.protocols - -import com.github.maltalex.ineter.base.IPAddress -import com.github.maltalex.ineter.base.IPv4Address -import com.github.maltalex.ineter.base.IPv6Address -import io.netty.buffer.ByteBuf -import java.time.LocalDateTime -import java.time.ZoneOffset - -fun ByteBuf.readCharLE(): Char { - return ((readUnsignedByte().toInt() or (readUnsignedByte().toInt() shl 8)) and 0xFFFF).toChar() -} - -fun ByteBuf.writeCharLE(value: Char): ByteBuf = apply { - writeByte(value.code and 0xFF) - writeByte((value.code shr 8) and 0xFF) -} - -fun ByteBuf.readUtf16LE(): String { - val builder = StringBuilder() - var c: Char - while ((readCharLE().also { c = it }).code != 0) { - builder.append(c) - } - return builder.toString() -} - -fun ByteBuf.writeUtf16LE(value: String): ByteBuf = apply { - for (c in value) { - writeCharLE(c) - } - writeCharLE(0.toChar()) // Null-terminator -} - -fun ByteBuf.readIpLE(): IPAddress { - val type = readUnsignedByte().toInt() - return when (type) { - 4 -> { - val intValue = readIntLE() - IPv4Address.of(intValue) - } - 6 -> { - val upper = readLongLE() - val lower = readLongLE() - IPv6Address.of(upper, lower) - } - else -> throw IllegalArgumentException("Unknown IP address type: $type") - } -} - -fun ByteBuf.writeIpLE(ipAddress: IPAddress): ByteBuf = apply { - when (ipAddress) { - is IPv4Address -> { - writeByte(4) - writeIntLE(ipAddress.toInt()) - } - - is IPv6Address -> { - writeByte(6) - writeLongLE(ipAddress.upper) - writeLongLE(ipAddress.lower) - } - - else -> { - throw IllegalArgumentException("Unsupported IP address type: ${ipAddress::class}") - } - } -} - -fun ByteBuf.readIpRangeLE(): Pair { - val start = readIpLE() - val end = readIpLE() - return Pair(start, end) -} - -fun ByteBuf.writeIpRangeLE(start: IPAddress, end: IPAddress): ByteBuf = apply { - writeIpLE(start) - writeIpLE(end) -} - -fun ByteBuf.readEpochSeconds(): LocalDateTime = - LocalDateTime.ofEpochSecond(readIntLE().toLong(), 0, ZoneOffset.UTC) - -fun ByteBuf.writeEpochSecond(dateTime: LocalDateTime): ByteBuf = - writeIntLE(dateTime.toEpochSecond(ZoneOffset.UTC).toInt()) - -fun ByteBuf.writeByte(byte: Byte): ByteBuf = writeByte(byte.toInt()) - -fun ByteBuf.writeShortLE(short: Short): ByteBuf = writeShortLE(short.toInt()) diff --git a/protocol/src/main/kotlin/de/fiereu/openmmo/protocols/Protocol.kt b/protocol/src/main/kotlin/de/fiereu/openmmo/protocols/Protocol.kt deleted file mode 100644 index 57641fe..0000000 --- a/protocol/src/main/kotlin/de/fiereu/openmmo/protocols/Protocol.kt +++ /dev/null @@ -1,102 +0,0 @@ -package de.fiereu.openmmo.protocols - -import io.github.oshai.kotlinlogging.KotlinLogging -import io.netty.buffer.ByteBuf -import kotlin.reflect.KClass - -/** Value class wrapping a UByte to represent an opcode. */ -@JvmInline -value class Opcode(val value: UByte) { - override fun toString(): String = "0x${value.toString(16).padStart(2, '0').uppercase()}" -} - -/** - * Packet direction enum representing the direction of packet flow. This is needed because depending - * on the current side (client or server), the same opcode can represent different packets. For - * example, opcode 0x01 might represent a "LoginRequest" packet on the client side, but a - * "LoginResponse" packet on the server side. - */ -enum class PacketDirection { - CLIENT_TO_SERVER, - SERVER_TO_CLIENT -} - -interface PacketSerializer { - fun serializeObject(packet: Any, buffer: ByteBuf) { - @Suppress("UNCHECKED_CAST") serialize(packet as T, buffer) - } - - fun serialize(packet: T, buffer: ByteBuf) -} - -interface PacketDeserializer { - fun deserialize(buffer: ByteBuf): T -} - -/** - * The base class for all protocols. A protocol is a collection of packets that can be sent and - * received. - * - * We cant combine Server and Client protocols because they have different dependencies. For - * example, the server protocol needs to know about the server's root private key, while the client - * protocol should not have any knowledge about the server's private key. - */ -abstract class Protocol { - private val log = KotlinLogging.logger {} - private val incomingPacketRegistry: MutableMap> = mutableMapOf() - private val outgoingPacketRegistry: MutableMap> = mutableMapOf() - private val dataClassToOpcode: MutableMap, Opcode> = mutableMapOf() - - abstract val async: Boolean - abstract val compressed: Boolean - - fun getOpcode(dataClass: KClass<*>): Opcode? = dataClassToOpcode[dataClass] - - fun registerIncoming(opcode: Opcode, deserializer: PacketDeserializer) { - log.debug { - "Registering incoming packet: opcode=$opcode, deserializer=${deserializer::class.simpleName}" - } - - incomingPacketRegistry[opcode] = deserializer - } - - fun registerOutgoing( - opcode: Opcode, - serializer: PacketSerializer, - dataClass: KClass, - ) { - log.debug { - "Registering outgoing packet: opcode=$opcode, serializer=${serializer::class.simpleName}" - } - - if (dataClassToOpcode.containsKey(dataClass)) { - // Better to fail fast here than to have hard to debug issues later - error("Data class ${dataClass.simpleName} is already registered with an opcode!") - } - dataClassToOpcode[dataClass] = opcode - outgoingPacketRegistry[opcode] = serializer - } - - fun getSerializer(opcode: Opcode): PacketSerializer<*>? { - return outgoingPacketRegistry[opcode] - } - - fun getDeserializer(opcode: Opcode): PacketDeserializer<*>? { - return incomingPacketRegistry[opcode] - } -} - -fun Protocol.getDeserializer(opcode: UByte): PacketDeserializer<*>? { - return this.getDeserializer(Opcode(opcode)) -} - -fun Protocol.incomingPacket(opcode: UByte, deserializer: PacketDeserializer) { - this.registerIncoming(Opcode(opcode), deserializer) -} - -inline fun Protocol.outgoingPacket( - opcode: UByte, - serializer: PacketSerializer -) { - this.registerOutgoing(Opcode(opcode), serializer, T::class) -} diff --git a/protocol.login/build.gradle.kts b/protocols.game/build.gradle.kts similarity index 72% rename from protocol.login/build.gradle.kts rename to protocols.game/build.gradle.kts index 025b0dd..34fd19f 100644 --- a/protocol.login/build.gradle.kts +++ b/protocols.game/build.gradle.kts @@ -1,11 +1,11 @@ plugins { id("buildsrc.convention.kotlin-jvm") id("buildsrc.convention.spotless") + id("buildsrc.convention.sonarlint") } dependencies { - api(project(":protocol")) + api(project(":network")) api(project(":common")) - testImplementation(libs.bundles.kotest) } diff --git a/protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/GameProtocol.kt b/protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/GameProtocol.kt new file mode 100644 index 0000000..74e4427 --- /dev/null +++ b/protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/GameProtocol.kt @@ -0,0 +1,129 @@ +package de.fiereu.openmmo.net.game + +import de.fiereu.network.Protocol +import de.fiereu.network.bidi +import de.fiereu.network.c2s +import de.fiereu.network.s2c +import de.fiereu.openmmo.net.game.packets.CharactersListPacket +import de.fiereu.openmmo.net.game.packets.CharactersListPacketCodec +import de.fiereu.openmmo.net.game.packets.ChatMessagePacket +import de.fiereu.openmmo.net.game.packets.ChatMessagePacketCodec +import de.fiereu.openmmo.net.game.packets.CreateCharacterPacket +import de.fiereu.openmmo.net.game.packets.CreateCharacterPacketCodec +import de.fiereu.openmmo.net.game.packets.DialogChoicePacket +import de.fiereu.openmmo.net.game.packets.DialogChoicePacketCodec +import de.fiereu.openmmo.net.game.packets.DialogDataPacket +import de.fiereu.openmmo.net.game.packets.DialogDataPacketCodec +import de.fiereu.openmmo.net.game.packets.DialogOptionPacket +import de.fiereu.openmmo.net.game.packets.DialogOptionPacketCodec +import de.fiereu.openmmo.net.game.packets.DialogStatePacket +import de.fiereu.openmmo.net.game.packets.DialogStatePacketCodec +import de.fiereu.openmmo.net.game.packets.EntityInteractPacket +import de.fiereu.openmmo.net.game.packets.EntityInteractPacketCodec +import de.fiereu.openmmo.net.game.packets.EntityLeavePacket +import de.fiereu.openmmo.net.game.packets.EntityLeavePacketCodec +import de.fiereu.openmmo.net.game.packets.EntityMovePacket +import de.fiereu.openmmo.net.game.packets.EntityMovePacketCodec +import de.fiereu.openmmo.net.game.packets.FaceDirectionPacket +import de.fiereu.openmmo.net.game.packets.FaceDirectionPacketCodec +import de.fiereu.openmmo.net.game.packets.InteractivePacket +import de.fiereu.openmmo.net.game.packets.InteractivePacketCodec +import de.fiereu.openmmo.net.game.packets.InteractiveResponsePacket +import de.fiereu.openmmo.net.game.packets.InteractiveResponsePacketCodec +import de.fiereu.openmmo.net.game.packets.JoinPacket +import de.fiereu.openmmo.net.game.packets.JoinPacketCodec +import de.fiereu.openmmo.net.game.packets.JoinResponsePacket +import de.fiereu.openmmo.net.game.packets.JoinResponsePacketCodec +import de.fiereu.openmmo.net.game.packets.KeepAlivePacket +import de.fiereu.openmmo.net.game.packets.KeepAlivePacketCodec +import de.fiereu.openmmo.net.game.packets.LoadEntityPacket +import de.fiereu.openmmo.net.game.packets.LoadEntityPacketCodec +import de.fiereu.openmmo.net.game.packets.LoadMapPacket +import de.fiereu.openmmo.net.game.packets.LoadMapPacketCodec +import de.fiereu.openmmo.net.game.packets.MapTransitionAckPacket +import de.fiereu.openmmo.net.game.packets.MapTransitionAckPacketCodec +import de.fiereu.openmmo.net.game.packets.MapTransitionPacket +import de.fiereu.openmmo.net.game.packets.MapTransitionPacketCodec +import de.fiereu.openmmo.net.game.packets.MovementPacket +import de.fiereu.openmmo.net.game.packets.MovementPacketCodec +import de.fiereu.openmmo.net.game.packets.NpcAnimationPacket +import de.fiereu.openmmo.net.game.packets.NpcAnimationPacketCodec +import de.fiereu.openmmo.net.game.packets.NpcSpawnPacket +import de.fiereu.openmmo.net.game.packets.NpcSpawnPacketCodec +import de.fiereu.openmmo.net.game.packets.NpcUpdatePacket +import de.fiereu.openmmo.net.game.packets.NpcUpdatePacketCodec +import de.fiereu.openmmo.net.game.packets.NullPacket +import de.fiereu.openmmo.net.game.packets.NullPacketCodec +import de.fiereu.openmmo.net.game.packets.PokemonContainerPacket +import de.fiereu.openmmo.net.game.packets.PokemonContainerPacketCodec +import de.fiereu.openmmo.net.game.packets.RenderScreenPacket +import de.fiereu.openmmo.net.game.packets.RenderScreenPacketCodec +import de.fiereu.openmmo.net.game.packets.RequestCharactersPacket +import de.fiereu.openmmo.net.game.packets.RequestCharactersPacketCodec +import de.fiereu.openmmo.net.game.packets.RequestPlayerPacket +import de.fiereu.openmmo.net.game.packets.RequestPlayerPacketCodec +import de.fiereu.openmmo.net.game.packets.SelectCharacterPacket +import de.fiereu.openmmo.net.game.packets.SelectCharacterPacketCodec +import de.fiereu.openmmo.net.game.packets.SelectedCharacterPacket +import de.fiereu.openmmo.net.game.packets.SelectedCharacterPacketCodec +import de.fiereu.openmmo.net.game.packets.TokenPayloadPacket +import de.fiereu.openmmo.net.game.packets.TokenPayloadPacketCodec + +object GameProtocol : Protocol() { + override val compressed: Boolean = true + + init { + c2s(0x01u, JoinPacketCodec) + s2c(0x01u, JoinResponsePacketCodec) + + c2s(0x02u, RequestCharactersPacketCodec) + s2c(0x02u, CharactersListPacketCodec) + + c2s(0x03u, CreateCharacterPacketCodec) + + c2s(0x04u, SelectCharacterPacketCodec) + s2c(0x04u, SelectedCharacterPacketCodec) + + c2s(0x05u, RequestPlayerPacketCodec) + s2c(0x05u, LoadEntityPacketCodec) + + c2s(0x06u, MovementPacketCodec) + + c2s(0x07u, FaceDirectionPacketCodec) + + s2c(0x08u, EntityLeavePacketCodec) + + bidi(0x09u, ChatMessagePacketCodec) + + bidi(0x0Du, DialogDataPacketCodec) + bidi(0x0Eu, DialogStatePacketCodec) + + bidi(0x10u, LoadMapPacketCodec) + + s2c(0x11u, NpcUpdatePacketCodec) + + bidi(0x12u, NpcSpawnPacketCodec) + + bidi(0x13u, PokemonContainerPacketCodec) + + bidi(0x1Bu, MapTransitionPacketCodec) + + c2s(0x20u, NullPacketCodec) + s2c(0x20u, TokenPayloadPacketCodec) + + s2c(0x21u, InteractivePacketCodec) + c2s(0x21u, InteractiveResponsePacketCodec) + + bidi(0x22u, EntityInteractPacketCodec) + + bidi(0x25u, DialogChoicePacketCodec) + bidi(0x26u, DialogOptionPacketCodec) + + bidi(0xB2u, NpcAnimationPacketCodec) + bidi(0xB4u, RenderScreenPacketCodec) + bidi(0xB9u, MapTransitionAckPacketCodec) + bidi(0xC2u, KeepAlivePacketCodec) + + s2c(0xEAu, EntityMovePacketCodec) + } +} diff --git a/protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/codecs/CharacterInfoCodec.kt b/protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/codecs/CharacterInfoCodec.kt new file mode 100644 index 0000000..5c07dc4 --- /dev/null +++ b/protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/codecs/CharacterInfoCodec.kt @@ -0,0 +1,100 @@ +package de.fiereu.openmmo.net.game.codecs + +import de.fiereu.bytecodec.Codec +import de.fiereu.bytecodec.CodecScope +import de.fiereu.bytecodec.PacketCodec +import de.fiereu.bytecodec.S16LE +import de.fiereu.bytecodec.S32LE +import de.fiereu.bytecodec.S64LE +import de.fiereu.bytecodec.S8 +import de.fiereu.bytecodec.U16LE +import de.fiereu.bytecodec.U8 +import de.fiereu.bytecodec.Utf16LeNullTerminated +import de.fiereu.bytecodec.bytesPrefixed +import de.fiereu.bytecodec.imap +import de.fiereu.openmmo.common.CharacterInfo +import java.time.LocalDateTime +import java.time.ZoneOffset + +internal val EpochSecondsS32LE: Codec = + S32LE.imap( + decode = { LocalDateTime.ofEpochSecond(it.toLong(), 0, ZoneOffset.UTC) }, + encode = { it.toEpochSecond(ZoneOffset.UTC).toInt() }, + ) + +private val TrailingBytes = bytesPrefixed(U16LE) + +class CharacterInfoCodec(private val withExtraLong: Boolean) : PacketCodec() { + override fun CodecScope.body(): CharacterInfo { + val id = field(S64LE, CharacterInfo::id) + val name = field(Utf16LeNullTerminated, CharacterInfo::name) + val namePrefix = field(Utf16LeNullTerminated) { "" } + val userId = field(S32LE, CharacterInfo::userId) + val rivalSex = field(S8, CharacterInfo::rivalSex) + val lastLogin = field(EpochSecondsS32LE, CharacterInfo::lastLogin) + if (withExtraLong) field(S64LE) { 0L } + val createdAt = field(EpochSecondsS32LE, CharacterInfo::createdAt) + field(S32LE) { 0 } + field(S8) { 0 } + field(S32LE) { 0 } + val money = field(S32LE, CharacterInfo::money) + field(S16LE) { 0 } + field(S32LE) { 0 } + val permissions = field(U8) { it.permissions and 0xFF } + field(S8) { 0 } + field(S8) { 0 } + field(S32LE) { 0 } + repeat(8) { field(S8) { 0 } } + val remainingSafariSteps = field(S16LE, CharacterInfo::remainingSafariSteps) + val remainingSafariBalls = field(S8, CharacterInfo::remainingSafariBalls) + field(S32LE) { 0 } + val pcExtraSlots = field(S8, CharacterInfo::pcExtraSlots) + val battleBoxExtraSlots = field(S8, CharacterInfo::battleBoxExtraSlots) + val templateAmount = field(S8, CharacterInfo::templateAmount) + field(S8) { 0 } + field(S8) { 0 } + field(S8) { 0 } + val positionRegionId = field(S8, CharacterInfo::positionRegionId) + val positionBankId = field(S8, CharacterInfo::positionBankId) + val positionMapId = field(S8, CharacterInfo::positionMapId) + field(S8) { 0 } + val positionX = field(S16LE, CharacterInfo::positionX) + val positionY = field(S16LE, CharacterInfo::positionY) + field(S8) { 0 } + field(S8) { 0 } + val repelLeft = field(S16LE, CharacterInfo::repelLeft) + val repelItemId = field(S16LE, CharacterInfo::repelItemId) + field(S8) { 0 } + val lureItemId = field(S16LE, CharacterInfo::lureItemId) + val lureLeft = field(S16LE, CharacterInfo::lureLeft) + field(TrailingBytes) { ByteArray(0) } + return CharacterInfo( + id = id, + name = name, + namePrefix = namePrefix, + userId = userId, + rivalSex = rivalSex, + lastLogin = lastLogin, + createdAt = createdAt, + money = money, + permissions = permissions, + remainingSafariSteps = remainingSafariSteps, + remainingSafariBalls = remainingSafariBalls, + pcExtraSlots = pcExtraSlots, + battleBoxExtraSlots = battleBoxExtraSlots, + templateAmount = templateAmount, + positionRegionId = positionRegionId, + positionBankId = positionBankId, + positionMapId = positionMapId, + positionX = positionX, + positionY = positionY, + repelLeft = repelLeft, + repelItemId = repelItemId, + lureLeft = lureLeft, + lureItemId = lureItemId, + ) + } +} + +val CharacterInfoCodecShort: Codec = CharacterInfoCodec(withExtraLong = false) +val CharacterInfoCodecLong: Codec = CharacterInfoCodec(withExtraLong = true) diff --git a/protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/codecs/PokemonCodec.kt b/protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/codecs/PokemonCodec.kt new file mode 100644 index 0000000..66d330b --- /dev/null +++ b/protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/codecs/PokemonCodec.kt @@ -0,0 +1,108 @@ +package de.fiereu.openmmo.net.game.codecs + +import de.fiereu.bytecodec.Codec +import de.fiereu.bytecodec.CodecScope +import de.fiereu.bytecodec.PacketCodec +import de.fiereu.bytecodec.S16LE +import de.fiereu.bytecodec.S32LE +import de.fiereu.bytecodec.S64LE +import de.fiereu.bytecodec.S8 +import de.fiereu.bytecodec.U16LE +import de.fiereu.bytecodec.U8 +import de.fiereu.bytecodec.Utf16LeNullTerminated +import de.fiereu.bytecodec.bytesPrefixed +import de.fiereu.openmmo.common.Pokemon +import de.fiereu.openmmo.common.PokemonMove +import de.fiereu.openmmo.common.enums.EVs +import de.fiereu.openmmo.common.enums.PokemonContainer +import de.fiereu.openmmo.common.enums.PokemonRarity +import de.fiereu.openmmo.common.enums.compress +import de.fiereu.openmmo.common.enums.decompressIVs + +private val PokemonUnknownBytes: Codec = bytesPrefixed(U8) + +object PokemonCodec : PacketCodec() { + override fun CodecScope.body(): Pokemon { + val id = field(S64LE, Pokemon::id) + field(S8) { 0 } + field(S64LE) { 0L } + field(S64LE) { 0L } + val container = PokemonContainer.entries[field(U8) { it.container.ordinal }] + val containerSlot = field(S16LE, Pokemon::containerSlot) + val dexId = field(U16LE, Pokemon::dexId) + val seed = field(S32LE, Pokemon::seed) + field(S64LE) { 0L } + val ot = field(Utf16LeNullTerminated, Pokemon::ot) + val nickname = field(Utf16LeNullTerminated, Pokemon::nickname) + field(S8) { 0 } + field(S8) { 0 } + val level = field(S8, Pokemon::level) + val currentHp = field(S16LE, Pokemon::hp) + field(S16LE) { 0 } + val xp = field(S32LE, Pokemon::xp) + field(S8) { 0 } + field(S16LE) { 0 } + val moveIds = List(4) { i -> field(S16LE) { it.moves[i].id } } + val movePps = List(4) { i -> field(S8) { it.moves[i].pp } } + val moves = List(4) { PokemonMove(moveIds[it], movePps[it]) } + repeat(4) { field(S16LE) { 0 } } + val eVs = + EVs().apply { + hp = field(U8) { it.eVs.hp } + atk = field(U8) { it.eVs.atk } + def = field(U8) { it.eVs.def } + spd = field(U8) { it.eVs.spd } + spAtk = field(U8) { it.eVs.spAtk } + spDef = field(U8) { it.eVs.spDef } + } + repeat(11) { field(S8) { 0 } } + val iVs = decompressIVs(field(S32LE) { it.iVs.compress() }) + field(S8) { 0 } + field(S64LE) { 0L } + val rarityMask = + field(U16LE) { + var m = 0 + if (it.isShiny) m = m or (1 shl PokemonRarity.SHINY.ordinal) + if (it.hasHiddenAbility) m = m or (1 shl PokemonRarity.HIDDEN_ABILITY.ordinal) + if (it.isAlpha) m = m or (1 shl PokemonRarity.ALPHA.ordinal) + if (it.isSecret) m = m or (1 shl PokemonRarity.SECRET.ordinal) + if (it.isFatefulEncounter) m = m or (1 shl PokemonRarity.FATEFUL_ENCOUNTER.ordinal) + if (it.isRaidEncounter) m = m or (1 shl PokemonRarity.RAID_ENCOUNTER.ordinal) + m + } + val isShiny = (rarityMask and (1 shl PokemonRarity.SHINY.ordinal)) != 0 + val hasHiddenAbility = (rarityMask and (1 shl PokemonRarity.HIDDEN_ABILITY.ordinal)) != 0 + val isAlpha = (rarityMask and (1 shl PokemonRarity.ALPHA.ordinal)) != 0 + val isSecret = (rarityMask and (1 shl PokemonRarity.SECRET.ordinal)) != 0 + val isFatefulEncounter = (rarityMask and (1 shl PokemonRarity.FATEFUL_ENCOUNTER.ordinal)) != 0 + val isRaidEncounter = (rarityMask and (1 shl PokemonRarity.RAID_ENCOUNTER.ordinal)) != 0 + val caughtAt = field(EpochSecondsS32LE, Pokemon::caughtAt) + field(S16LE) { 0 } + field(S8) { 0 } + field(S8) { 0 } + field(PokemonUnknownBytes) { ByteArray(0) } + repeat(12) { field(S8) { 0 } } + return Pokemon( + id, + container, + containerSlot, + dexId, + seed, + ot, + nickname, + level, + currentHp, + xp, + eVs, + iVs, + moves, + isShiny, + hasHiddenAbility, + isAlpha, + isSecret, + isFatefulEncounter, + isRaidEncounter, + caughtAt, + ) + } +} diff --git a/protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/codecs/SkinCodec.kt b/protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/codecs/SkinCodec.kt new file mode 100644 index 0000000..471635f --- /dev/null +++ b/protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/codecs/SkinCodec.kt @@ -0,0 +1,53 @@ +package de.fiereu.openmmo.net.game.codecs + +import de.fiereu.bytecodec.Codec +import de.fiereu.bytecodec.CodecScope +import de.fiereu.bytecodec.PacketCodec +import de.fiereu.bytecodec.U16LE +import de.fiereu.bytecodec.U8 +import de.fiereu.openmmo.common.enums.SkinSlot +import java.util.EnumMap + +data class Skin(val slot: SkinSlot, val type: UShort?, val color: UByte?) + +class SkinSet : EnumMap(SkinSlot::class.java) { + fun put(skin: Skin) { + this[skin.slot] = skin + } + + override fun put(key: SkinSlot, value: Skin): Skin? { + require(key == value.slot) { "Slot mismatch: $key != ${value.slot}" } + return super.put(key, value) + } +} + +class SkinSetCodec( + private val slots: List = SkinSlot.entries, + private val withLeadingByte: Boolean = true, +) : PacketCodec() { + override fun CodecScope.body(): SkinSet { + if (withLeadingByte) field(U8) { 0 } + val mask = field(U16LE) { slots.fold(0) { acc, slot -> acc or (1 shl slot.ordinal) } } + val skins = SkinSet() + slots.forEach { slot -> + if ((mask and (1 shl slot.ordinal)) != 0) { + val compressed = + field(U16LE) { + val skin = it[slot] ?: Skin(slot, 0u, 0u) + val type = skin.type ?: 0x3FFFu + val color = skin.color ?: 0x3Fu + require(type <= 0x3FFFu) { "Skin type too large: ${skin.type}" } + require(color <= 0x3Fu) { "Skin color too large: ${skin.color}" } + (type and 0x3FFFu).toInt() or ((color and 0x3Fu).toInt() shl 10) + } + val type = (compressed and 0x3FFF).toUShort() + val color = ((compressed shr 10) and 0x3F).toUByte() + skins.put(Skin(slot, type, color)) + } + } + return skins + } +} + +val DefaultSkinSetCodec: Codec = SkinSetCodec() +val SkinSetCodecNoLeading: Codec = SkinSetCodec(withLeadingByte = false) \ No newline at end of file diff --git a/protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/codecs/Tile2DCodec.kt b/protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/codecs/Tile2DCodec.kt new file mode 100644 index 0000000..29df5fb --- /dev/null +++ b/protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/codecs/Tile2DCodec.kt @@ -0,0 +1,19 @@ +package de.fiereu.openmmo.net.game.codecs + +import de.fiereu.bytecodec.Codec +import de.fiereu.bytecodec.U16LE +import de.fiereu.bytecodec.imap +import de.fiereu.openmmo.common.Tile2D + +val Tile2DCodec: Codec = + U16LE.imap( + decode = { raw -> + Tile2D( + material = (raw and 0x3FF).toShort(), + collision = ((raw shr 10) and 0x3F).toByte(), + ) + }, + encode = { tile -> + ((tile.collision.toInt() and 0x3F) shl 10) or (tile.material.toInt() and 0x3FF) + }, + ) diff --git a/protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/CharactersListPacket.kt b/protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/CharactersListPacket.kt new file mode 100644 index 0000000..3ba33ef --- /dev/null +++ b/protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/CharactersListPacket.kt @@ -0,0 +1,80 @@ +package de.fiereu.openmmo.net.game.packets + +import de.fiereu.bytecodec.Bool +import de.fiereu.bytecodec.Codec +import de.fiereu.bytecodec.CodecScope +import de.fiereu.bytecodec.PacketCodec +import de.fiereu.bytecodec.ReadBuffer +import de.fiereu.bytecodec.S32LE +import de.fiereu.bytecodec.U8 +import de.fiereu.bytecodec.Utf16LeNullTerminated +import de.fiereu.bytecodec.WriteBuffer +import de.fiereu.openmmo.common.CharacterInfo +import de.fiereu.openmmo.common.Pokemon +import de.fiereu.openmmo.net.game.codecs.CharacterInfoCodecLong +import de.fiereu.openmmo.net.game.codecs.CharacterInfoCodecShort +import de.fiereu.openmmo.net.game.codecs.DefaultSkinSetCodec +import de.fiereu.openmmo.net.game.codecs.PokemonCodec +import de.fiereu.openmmo.net.game.codecs.SkinSet +import de.fiereu.openmmo.net.game.codecs.SkinSetCodecNoLeading + +data class CharacterEntry( + val characterInfo: CharacterInfo, + val skinSet: SkinSet, + val guildId: Int? = null, + val pokemon: List, +) { + init { + require(pokemon.size <= 6) { "Party size can't be more than 6 pokemon" } + } +} + +data class CharactersListPacket(val characters: List) + +private val CharacterInfoAsymmetric: Codec = + object : Codec { + override fun read(buf: ReadBuffer): CharacterInfo = CharacterInfoCodecLong.read(buf) + + override fun write(buf: WriteBuffer, value: CharacterInfo) { + CharacterInfoCodecShort.write(buf, value) + } + } + +private object CharacterEntryCodec : PacketCodec() { + override fun CodecScope.body(): CharacterEntry { + val info = field(CharacterInfoAsymmetric, CharacterEntry::characterInfo) + val skin = field(DefaultSkinSetCodec, CharacterEntry::skinSet) + field(SkinSetCodecNoLeading, CharacterEntry::skinSet) + val hasGuild = field(Bool) { it.guildId != null } + val guildId = + if (hasGuild) { + field(Utf16LeNullTerminated) { "" } + field(S32LE) { it.guildId!! } + } else { + null + } + val partySize = field(U8) { it.pokemon.size } + val party = List(partySize) { field(PokemonCodec) { entry -> entry.pokemon[it] } } + return CharacterEntry(info, skin, guildId, party) + } +} + +private val CharacterEntryListPrefixedU8: Codec> = + object : Codec> { + override fun read(buf: ReadBuffer): List { + val n = U8.read(buf) + return List(n) { CharacterEntryCodec.read(buf) } + } + + override fun write(buf: WriteBuffer, value: List) { + U8.write(buf, value.size) + value.forEach { CharacterEntryCodec.write(buf, it) } + } + } + +object CharactersListPacketCodec : PacketCodec() { + override fun CodecScope.body() = + CharactersListPacket( + characters = field(CharacterEntryListPrefixedU8, CharactersListPacket::characters), + ) +} diff --git a/protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/ChatMessagePacket.kt b/protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/ChatMessagePacket.kt new file mode 100644 index 0000000..3c3aa3b --- /dev/null +++ b/protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/ChatMessagePacket.kt @@ -0,0 +1,52 @@ +package de.fiereu.openmmo.net.game.packets + +import de.fiereu.bytecodec.CodecScope +import de.fiereu.bytecodec.MalformedPacketException +import de.fiereu.bytecodec.PacketCodec +import de.fiereu.bytecodec.S64LE +import de.fiereu.bytecodec.S8 +import de.fiereu.bytecodec.U8 +import de.fiereu.bytecodec.Utf16LeNullTerminated +import de.fiereu.openmmo.common.enums.ChatType +import de.fiereu.openmmo.common.enums.Language + +data class ChatMessagePacket( + val type: ChatType, + val language: Language?, + val message: String, + val sender: String?, +) + +object ChatMessagePacketCodec : PacketCodec() { + override fun CodecScope.body(): ChatMessagePacket { + val type = ChatType.entries[field(U8) { it.type.ordinal }] + return if (type == ChatType.TEAM) { + ChatMessagePacket( + type = type, + language = null, + message = field(Utf16LeNullTerminated, ChatMessagePacket::message), + sender = null, + ) + } else { + field(S64LE) { 0L } + val sender = + field(Utf16LeNullTerminated) { + it.sender ?: throw MalformedPacketException("sender must not be null") + } + val language = + Language.entries[ + field(U8) { + (it.language ?: throw MalformedPacketException("language must not be null")) + .ordinal + }] + field(S8) { -1 } + val message = field(Utf16LeNullTerminated, ChatMessagePacket::message) + ChatMessagePacket( + type = type, + language = language, + message = message, + sender = sender, + ) + } + } +} diff --git a/protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/CreateCharacterPacket.kt b/protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/CreateCharacterPacket.kt new file mode 100644 index 0000000..02e50bd --- /dev/null +++ b/protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/CreateCharacterPacket.kt @@ -0,0 +1,14 @@ +package de.fiereu.openmmo.net.game.packets + +import de.fiereu.bytecodec.CodecScope +import de.fiereu.bytecodec.PacketCodec +import de.fiereu.bytecodec.Utf16LeNullTerminated + +data class CreateCharacterPacket(val name: String) + +object CreateCharacterPacketCodec : PacketCodec() { + override fun CodecScope.body(): CreateCharacterPacket { + val name = field(Utf16LeNullTerminated) { it.name } + return CreateCharacterPacket(name) + } +} diff --git a/protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/DialogChoicePacket.kt b/protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/DialogChoicePacket.kt new file mode 100644 index 0000000..b3ef395 --- /dev/null +++ b/protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/DialogChoicePacket.kt @@ -0,0 +1,16 @@ +package de.fiereu.openmmo.net.game.packets + +import de.fiereu.bytecodec.CodecScope +import de.fiereu.bytecodec.PacketCodec +import de.fiereu.bytecodec.U16LE +import de.fiereu.bytecodec.U8 + +data class DialogChoicePacket(val unk1: Int, val unk2: Int) + +object DialogChoicePacketCodec : PacketCodec() { + override fun CodecScope.body(): DialogChoicePacket { + val unk1 = field(U8) { it.unk1 } + val unk2 = field(U16LE) { it.unk2 } + return DialogChoicePacket(unk1, unk2) + } +} diff --git a/protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/DialogDataPacket.kt b/protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/DialogDataPacket.kt new file mode 100644 index 0000000..8c5f039 --- /dev/null +++ b/protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/DialogDataPacket.kt @@ -0,0 +1,54 @@ +package de.fiereu.openmmo.net.game.packets + +import de.fiereu.bytecodec.Codec +import de.fiereu.bytecodec.CodecScope +import de.fiereu.bytecodec.PacketCodec +import de.fiereu.bytecodec.ReadBuffer +import de.fiereu.bytecodec.S64LE +import de.fiereu.bytecodec.U8 +import de.fiereu.bytecodec.WriteBuffer + +data class DialogDataPacket( + val entityId: Long, + val unk1: Int, + val type: Int, + val data: ByteArray, +) { + override fun equals(other: Any?): Boolean = + other is DialogDataPacket && + entityId == other.entityId && + unk1 == other.unk1 && + type == other.type && + data.contentEquals(other.data) + + override fun hashCode(): Int { + var result = entityId.hashCode() + result = 31 * result + unk1 + result = 31 * result + type + result = 31 * result + data.contentHashCode() + return result + } +} + +private object RemainingBytes : Codec { + override fun read(buf: ReadBuffer): ByteArray { + val n = buf.remaining() + val arr = ByteArray(n) + if (n > 0) buf.readBytes(arr) + return arr + } + + override fun write(buf: WriteBuffer, value: ByteArray) { + if (value.isNotEmpty()) buf.writeBytes(value) + } +} + +object DialogDataPacketCodec : PacketCodec() { + override fun CodecScope.body(): DialogDataPacket { + val entityId = field(S64LE) { it.entityId } + val unk1 = field(U8) { it.unk1 } + val type = field(U8) { it.type } + val data = field(RemainingBytes) { it.data } + return DialogDataPacket(entityId, unk1, type, data) + } +} diff --git a/protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/DialogOptionPacket.kt b/protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/DialogOptionPacket.kt new file mode 100644 index 0000000..3a3d47a --- /dev/null +++ b/protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/DialogOptionPacket.kt @@ -0,0 +1,13 @@ +package de.fiereu.openmmo.net.game.packets + +import de.fiereu.bytecodec.Codec +import de.fiereu.bytecodec.S32LE +import de.fiereu.bytecodec.imap + +data class DialogOptionPacket(val data: Int) + +val DialogOptionPacketCodec: Codec = + S32LE.imap( + decode = { DialogOptionPacket(it) }, + encode = { it.data }, + ) diff --git a/protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/DialogStatePacket.kt b/protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/DialogStatePacket.kt new file mode 100644 index 0000000..30c4c32 --- /dev/null +++ b/protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/DialogStatePacket.kt @@ -0,0 +1,13 @@ +package de.fiereu.openmmo.net.game.packets + +import de.fiereu.bytecodec.Bool +import de.fiereu.bytecodec.Codec +import de.fiereu.bytecodec.imap + +data class DialogStatePacket(val active: Boolean) + +val DialogStatePacketCodec: Codec = + Bool.imap( + decode = { DialogStatePacket(it) }, + encode = { it.active }, + ) diff --git a/protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/EntityInteractPacket.kt b/protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/EntityInteractPacket.kt new file mode 100644 index 0000000..f658f4e --- /dev/null +++ b/protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/EntityInteractPacket.kt @@ -0,0 +1,15 @@ +package de.fiereu.openmmo.net.game.packets + +import de.fiereu.bytecodec.CodecScope +import de.fiereu.bytecodec.PacketCodec +import de.fiereu.bytecodec.S64LE + +data class EntityInteractPacket(val entityId: Long, val token: Long) + +object EntityInteractPacketCodec : PacketCodec() { + override fun CodecScope.body(): EntityInteractPacket { + val entityId = field(S64LE) { it.entityId } + val token = field(S64LE) { it.token } + return EntityInteractPacket(entityId, token) + } +} diff --git a/protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/EntityLeavePacket.kt b/protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/EntityLeavePacket.kt new file mode 100644 index 0000000..1489228 --- /dev/null +++ b/protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/EntityLeavePacket.kt @@ -0,0 +1,14 @@ +package de.fiereu.openmmo.net.game.packets + +import de.fiereu.bytecodec.CodecScope +import de.fiereu.bytecodec.PacketCodec +import de.fiereu.bytecodec.S64BE + +data class EntityLeavePacket(val entityId: Long) + +object EntityLeavePacketCodec : PacketCodec() { + override fun CodecScope.body(): EntityLeavePacket { + val entityId = field(S64BE) { it.entityId } + return EntityLeavePacket(entityId) + } +} diff --git a/protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/EntityMovePacket.kt b/protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/EntityMovePacket.kt new file mode 100644 index 0000000..8c2b80c --- /dev/null +++ b/protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/EntityMovePacket.kt @@ -0,0 +1,33 @@ +package de.fiereu.openmmo.net.game.packets + +import de.fiereu.bytecodec.CodecScope +import de.fiereu.bytecodec.PacketCodec +import de.fiereu.bytecodec.S64BE +import de.fiereu.bytecodec.S8 +import de.fiereu.bytecodec.enumByOrdinalByte +import de.fiereu.openmmo.common.enums.Direction + +data class EntityMovePacket( + val entityId: Long, + val marker: Byte = 0x33, + val subtype: Byte = 0x03, + val seq: Byte = 0, + val x: Byte, + val y: Byte, + val direction: Direction, +) + +object EntityMovePacketCodec : PacketCodec() { + private val DirectionCodec = enumByOrdinalByte() + + override fun CodecScope.body(): EntityMovePacket { + val entityId = field(S64BE) { it.entityId } + val marker = field(S8) { it.marker } + val subtype = field(S8) { it.subtype } + val seq = field(S8) { it.seq } + val x = field(S8) { it.x } + val y = field(S8) { it.y } + val direction = field(DirectionCodec) { it.direction } + return EntityMovePacket(entityId, marker, subtype, seq, x, y, direction) + } +} diff --git a/protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/FaceDirectionPacket.kt b/protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/FaceDirectionPacket.kt new file mode 100644 index 0000000..0c262b9 --- /dev/null +++ b/protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/FaceDirectionPacket.kt @@ -0,0 +1,17 @@ +package de.fiereu.openmmo.net.game.packets + +import de.fiereu.bytecodec.CodecScope +import de.fiereu.bytecodec.PacketCodec +import de.fiereu.bytecodec.enumByOrdinalByte +import de.fiereu.openmmo.common.enums.Direction + +data class FaceDirectionPacket(val direction: Direction) + +object FaceDirectionPacketCodec : PacketCodec() { + private val DirectionCodec = enumByOrdinalByte() + + override fun CodecScope.body(): FaceDirectionPacket { + val direction = field(DirectionCodec) { it.direction } + return FaceDirectionPacket(direction) + } +} diff --git a/protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/InteractivePacket.kt b/protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/InteractivePacket.kt new file mode 100644 index 0000000..6f98824 --- /dev/null +++ b/protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/InteractivePacket.kt @@ -0,0 +1,31 @@ +package de.fiereu.openmmo.net.game.packets + +import de.fiereu.bytecodec.CodecScope +import de.fiereu.bytecodec.PacketCodec +import de.fiereu.bytecodec.S32LE +import de.fiereu.bytecodec.S64LE +import de.fiereu.bytecodec.U16LE +import de.fiereu.bytecodec.U8 + +data class InteractivePacket( + val id: Int, + val type: Int, + val unk1: Int, + val unk2: Int, + val targetEntityId: Long, + val unk3: Int, + val unk4: Int, +) + +object InteractivePacketCodec : PacketCodec() { + override fun CodecScope.body(): InteractivePacket { + val id = field(U8) { it.id } + val type = field(U8) { it.type } + val unk1 = field(S32LE) { it.unk1 } + val unk2 = field(S32LE) { it.unk2 } + val targetEntityId = field(S64LE) { it.targetEntityId } + val unk3 = field(U16LE) { it.unk3 } + val unk4 = field(U16LE) { it.unk4 } + return InteractivePacket(id, type, unk1, unk2, targetEntityId, unk3, unk4) + } +} diff --git a/protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/InteractiveResponsePacket.kt b/protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/InteractiveResponsePacket.kt new file mode 100644 index 0000000..8467366 --- /dev/null +++ b/protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/InteractiveResponsePacket.kt @@ -0,0 +1,15 @@ +package de.fiereu.openmmo.net.game.packets + +import de.fiereu.bytecodec.CodecScope +import de.fiereu.bytecodec.PacketCodec +import de.fiereu.bytecodec.U8 + +data class InteractiveResponsePacket(val id: Int, val unk: Int) + +object InteractiveResponsePacketCodec : PacketCodec() { + override fun CodecScope.body(): InteractiveResponsePacket { + val id = field(U8) { it.id } + val unk = field(U8) { it.unk } + return InteractiveResponsePacket(id, unk) + } +} diff --git a/protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/JoinPacket.kt b/protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/JoinPacket.kt new file mode 100644 index 0000000..9d21929 --- /dev/null +++ b/protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/JoinPacket.kt @@ -0,0 +1,203 @@ +package de.fiereu.openmmo.net.game.packets + +import de.fiereu.bytecodec.Codec +import de.fiereu.bytecodec.CodecScope +import de.fiereu.bytecodec.PacketCodec +import de.fiereu.bytecodec.S16LE +import de.fiereu.bytecodec.S32LE +import de.fiereu.bytecodec.S64LE +import de.fiereu.bytecodec.S8 +import de.fiereu.bytecodec.U8 +import de.fiereu.bytecodec.Utf16LeNullTerminated +import de.fiereu.bytecodec.bytesPrefixed +import de.fiereu.bytecodec.choose +import de.fiereu.bytecodec.enumByOrdinalByte +import de.fiereu.bytecodec.fixedBytes +import de.fiereu.bytecodec.imap +import de.fiereu.bytecodec.listPrefixed +import de.fiereu.bytecodec.then +import de.fiereu.openmmo.common.enums.Arch +import de.fiereu.openmmo.common.enums.Bitness +import de.fiereu.openmmo.common.enums.Platform + +data class RomInfo(val code: String, val id: Byte, val type: Byte) + +sealed class GameAuthenticationData + +data class ReconnectAuthData(val sessionId: Long, val sessionKey: ByteArray) : + GameAuthenticationData() { + override fun equals(other: Any?): Boolean = + other is ReconnectAuthData && + sessionId == other.sessionId && + sessionKey.contentEquals(other.sessionKey) + + override fun hashCode(): Int = sessionId.hashCode() * 31 + sessionKey.contentHashCode() +} + +data class NewAuthData(val userId: Int, val sessionKey: ByteArray) : GameAuthenticationData() { + override fun equals(other: Any?): Boolean = + other is NewAuthData && userId == other.userId && sessionKey.contentEquals(other.sessionKey) + + override fun hashCode(): Int = userId * 31 + sessionKey.contentHashCode() +} + +data class JoinPacket( + val authData: GameAuthenticationData, + val mac: ByteArray, + val clientRevision: Int, + val installationRevision: Int, + val currentChatLanguage: Byte, + val chatLanguages: Short, + val matchmakingLanguages: Short, + val romMask: Byte, + val roms: List, + val clientInfo: Map, + val platform: Platform, + val arch: Arch, + val bitness: Bitness, + val unk1: ByteArray, + val unk2: ByteArray, +) { + override fun equals(other: Any?): Boolean = + other is JoinPacket && + authData == other.authData && + mac.contentEquals(other.mac) && + clientRevision == other.clientRevision && + installationRevision == other.installationRevision && + currentChatLanguage == other.currentChatLanguage && + chatLanguages == other.chatLanguages && + matchmakingLanguages == other.matchmakingLanguages && + romMask == other.romMask && + roms == other.roms && + clientInfo == other.clientInfo && + platform == other.platform && + arch == other.arch && + bitness == other.bitness && + unk1.contentEquals(other.unk1) && + unk2.contentEquals(other.unk2) + + override fun hashCode(): Int { + var r = authData.hashCode() + r = r * 31 + mac.contentHashCode() + r = r * 31 + clientRevision + r = r * 31 + installationRevision + r = r * 31 + currentChatLanguage + r = r * 31 + chatLanguages + r = r * 31 + matchmakingLanguages + r = r * 31 + romMask + r = r * 31 + roms.hashCode() + r = r * 31 + clientInfo.hashCode() + r = r * 31 + platform.hashCode() + r = r * 31 + arch.hashCode() + r = r * 31 + bitness.hashCode() + r = r * 31 + unk1.contentHashCode() + r = r * 31 + unk2.contentHashCode() + return r + } +} + +private val SessionKey = bytesPrefixed(U8) + +private object NewAuthDataCodec : PacketCodec() { + override fun CodecScope.body(): NewAuthData { + val userId = field(S32LE) { it.userId } + val sessionKey = field(SessionKey) { it.sessionKey } + return NewAuthData(userId, sessionKey) + } +} + +private object ReconnectAuthDataCodec : PacketCodec() { + override fun CodecScope.body(): ReconnectAuthData { + val sessionId = field(S64LE) { it.sessionId } + val sessionKey = field(SessionKey) { it.sessionKey } + return ReconnectAuthData(sessionId, sessionKey) + } +} + +private val AuthDataCodec: Codec = + choose( + tag = U8, + identify = { data -> + when (data) { + is NewAuthData -> 0x00 + is ReconnectAuthData -> 0x01 + } + }, + 0x00 to NewAuthDataCodec, + 0x01 to ReconnectAuthDataCodec, + ) + +private val PlatformCodec: Codec = + U8.imap( + decode = { Platform.from(it) }, + encode = { p -> + when (p) { + Platform.WINDOWS -> 0x00 + Platform.LINUX -> 0x01 + Platform.MACOS -> 0x02 + Platform.IOS -> 0x03 + Platform.ANDROID -> 0x04 + Platform.UNKNOWN -> 0xFF + } + }, + ) + +private val ArchCodec: Codec = enumByOrdinalByte() +private val BitnessCodec: Codec = enumByOrdinalByte() + +private val RomInfoCodec: Codec = + object : PacketCodec() { + override fun CodecScope.body(): RomInfo { + val code = field(Utf16LeNullTerminated) { it.code } + val id = field(S8) { it.id } + val type = field(S8) { it.type } + return RomInfo(code, id, type) + } + } + +private val ClientInfoEntryCodec: Codec> = S8.then(Utf16LeNullTerminated) + +private val ClientInfoMapCodec: Codec> = + ClientInfoEntryCodec.listPrefixed(U8) + .imap(decode = { it.toMap() }, encode = { it.entries.map { e -> e.key to e.value } }) + +private val MacBytes = fixedBytes(6) +private val Unk1Bytes = bytesPrefixed(U8) +private val Unk2Bytes = fixedBytes(32) + +object JoinPacketCodec : PacketCodec() { + override fun CodecScope.body(): JoinPacket { + val authData = field(AuthDataCodec) { it.authData } + val mac = field(MacBytes) { it.mac } + val clientRevision = field(S32LE) { it.clientRevision } + val installationRevision = field(S32LE) { it.installationRevision } + val currentChatLanguage = field(S8) { it.currentChatLanguage } + val chatLanguages = field(S16LE) { it.chatLanguages } + val matchmakingLanguages = field(S16LE) { it.matchmakingLanguages } + val romMask = field(S8) { it.romMask } + val roms = field(RomInfoCodec.listPrefixed(U8)) { it.roms } + val clientInfo = field(ClientInfoMapCodec) { it.clientInfo } + val platform = field(PlatformCodec) { it.platform } + val arch = field(ArchCodec) { it.arch } + val bitness = field(BitnessCodec) { it.bitness } + val unk1 = field(Unk1Bytes) { it.unk1 } + val unk2 = field(Unk2Bytes) { it.unk2 } + return JoinPacket( + authData = authData, + mac = mac, + clientRevision = clientRevision, + installationRevision = installationRevision, + currentChatLanguage = currentChatLanguage, + chatLanguages = chatLanguages, + matchmakingLanguages = matchmakingLanguages, + romMask = romMask, + roms = roms, + clientInfo = clientInfo, + platform = platform, + arch = arch, + bitness = bitness, + unk1 = unk1, + unk2 = unk2, + ) + } +} diff --git a/protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/JoinResponsePacket.kt b/protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/JoinResponsePacket.kt new file mode 100644 index 0000000..28d1653 --- /dev/null +++ b/protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/JoinResponsePacket.kt @@ -0,0 +1,75 @@ +package de.fiereu.openmmo.net.game.packets + +import de.fiereu.bytecodec.Bool +import de.fiereu.bytecodec.CodecScope +import de.fiereu.bytecodec.MalformedPacketException +import de.fiereu.bytecodec.PacketCodec +import de.fiereu.bytecodec.S32LE +import de.fiereu.bytecodec.S8 +import de.fiereu.bytecodec.Utf16LeNullTerminated +import java.time.LocalDate +import java.time.ZoneId + +data class JoinResponsePacket( + val canJoin: Boolean, + val stats: GameStats? = null, + val time: TimeInfo? = null, +) { + data class GameStats(val playtime: Int, val rewardPoints: Int, val balance: Int) + + data class TimeInfo(val serverDayStartSecond: Int, val serverCurrentSecond: Int) + + companion object { + fun reject(): JoinResponsePacket = JoinResponsePacket(false) + + fun accept(stats: GameStats, time: TimeInfo? = null): JoinResponsePacket = + JoinResponsePacket(true, stats, time) + + fun acceptNow(playtime: Int, rewardPoints: Int, balance: Int): JoinResponsePacket { + val dayStart = LocalDate.now().atStartOfDay(ZoneId.systemDefault()).toEpochSecond().toInt() + val now = (System.currentTimeMillis() / 1000).toInt() + return JoinResponsePacket( + canJoin = true, + stats = GameStats(playtime, rewardPoints, balance), + time = TimeInfo(dayStart, now), + ) + } + } +} + +private fun nowTimeInfo(): JoinResponsePacket.TimeInfo = + JoinResponsePacket.TimeInfo( + serverDayStartSecond = + LocalDate.now().atStartOfDay(ZoneId.systemDefault()).toEpochSecond().toInt(), + serverCurrentSecond = (System.currentTimeMillis() / 1000).toInt(), + ) + +object JoinResponsePacketCodec : PacketCodec() { + override fun CodecScope.body(): JoinResponsePacket { + val canJoin = field(Bool, JoinResponsePacket::canJoin) + if (!canJoin) return JoinResponsePacket(false) + field(Utf16LeNullTerminated) { "" } + field(S8) { 0 } + val playtime = + field(S32LE) { + (it.stats + ?: throw MalformedPacketException("stats must be provided when canJoin is true")) + .playtime + } + val rewardPoints = field(S32LE) { it.stats!!.rewardPoints } + val balance = field(S32LE) { it.stats!!.balance } + var resolvedTime: JoinResponsePacket.TimeInfo? = null + val dayStart = + field(S32LE) { + val t = it.time ?: nowTimeInfo() + resolvedTime = t + t.serverDayStartSecond + } + val now = field(S32LE) { resolvedTime!!.serverCurrentSecond } + return JoinResponsePacket( + canJoin = true, + stats = JoinResponsePacket.GameStats(playtime, rewardPoints, balance), + time = JoinResponsePacket.TimeInfo(dayStart, now), + ) + } +} diff --git a/protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/KeepAlivePacket.kt b/protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/KeepAlivePacket.kt new file mode 100644 index 0000000..d391c55 --- /dev/null +++ b/protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/KeepAlivePacket.kt @@ -0,0 +1,38 @@ +package de.fiereu.openmmo.net.game.packets + +import de.fiereu.bytecodec.Bool +import de.fiereu.bytecodec.Codec +import de.fiereu.bytecodec.CodecScope +import de.fiereu.bytecodec.PacketCodec +import de.fiereu.bytecodec.ReadBuffer +import de.fiereu.bytecodec.WriteBuffer + +data class KeepAlivePacket(val canJoin: Boolean, val sessionData: ByteArray) { + override fun equals(other: Any?): Boolean = + other is KeepAlivePacket && + canJoin == other.canJoin && + sessionData.contentEquals(other.sessionData) + + override fun hashCode(): Int = canJoin.hashCode() * 31 + sessionData.contentHashCode() +} + +private val KeepAliveSessionDataBytes: Codec = + object : Codec { + override fun read(buf: ReadBuffer): ByteArray { + val data = ByteArray(buf.remaining()) + if (data.isNotEmpty()) buf.readBytes(data) + return data + } + + override fun write(buf: WriteBuffer, value: ByteArray) { + if (value.isNotEmpty()) buf.writeBytes(value) + } + } + +object KeepAlivePacketCodec : PacketCodec() { + override fun CodecScope.body() = + KeepAlivePacket( + canJoin = field(Bool, KeepAlivePacket::canJoin), + sessionData = field(KeepAliveSessionDataBytes, KeepAlivePacket::sessionData), + ) +} diff --git a/protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/LoadEntityPacket.kt b/protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/LoadEntityPacket.kt new file mode 100644 index 0000000..5a46f3b --- /dev/null +++ b/protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/LoadEntityPacket.kt @@ -0,0 +1,82 @@ +package de.fiereu.openmmo.net.game.packets + +import de.fiereu.bytecodec.CodecScope +import de.fiereu.bytecodec.PacketCodec +import de.fiereu.bytecodec.S16LE +import de.fiereu.bytecodec.S32LE +import de.fiereu.bytecodec.S64LE +import de.fiereu.bytecodec.S8 +import de.fiereu.bytecodec.U16LE +import de.fiereu.bytecodec.U8 +import de.fiereu.bytecodec.Utf16LeNullTerminated +import de.fiereu.bytecodec.reserved +import de.fiereu.openmmo.common.enums.Direction +import de.fiereu.openmmo.common.enums.EntityStatus +import de.fiereu.openmmo.net.game.codecs.DefaultSkinSetCodec +import de.fiereu.openmmo.net.game.codecs.SkinSet + +data class LoadEntityPacket( + val entityId: Long, + val skin: SkinSet, + val name: String, + val regionId: Int, + val bankId: Int, + val mapId: Int, + val x: Int, + val y: Int, + val z: Int, + val facing: Direction, + val transportation: Int = 0, + val entityNameplateType: Int = 0, + val status: EntityStatus = EntityStatus.NONE, + val hasFollower: Boolean, + val followerDexId: Short, +) + +object LoadEntityPacketCodec : PacketCodec() { + override fun CodecScope.body(): LoadEntityPacket { + val entityId = field(S64LE, LoadEntityPacket::entityId) + reserved(byte = 0) + val skin = field(DefaultSkinSetCodec, LoadEntityPacket::skin) + val name = field(Utf16LeNullTerminated, LoadEntityPacket::name) + val regionId = field(U8, LoadEntityPacket::regionId) + val bankId = field(U8, LoadEntityPacket::bankId) + val mapId = field(U8, LoadEntityPacket::mapId) + val x = field(S16LE) { it.x.toShort() }.toInt() + val y = field(S16LE) { it.y.toShort() }.toInt() + val z = field(U8, LoadEntityPacket::z) + val facing = Direction.entries[field(U8) { it.facing.ordinal }] + val transportation = field(U8, LoadEntityPacket::transportation) + val entityNameplateType = field(U8, LoadEntityPacket::entityNameplateType) + val flags = field(U16LE) { if (it.hasFollower) 0x04 else 0 } + if (flags and 0x01 != 0) field(S8) { 0 } + if (flags and 0x02 != 0) { + field(S8) { 0 } + field(U16LE) { 0 } + } + val hasFollower = (flags and 0x04) != 0 + val followerDexId: Short = if (hasFollower) field(S16LE, LoadEntityPacket::followerDexId) else 0 + if (flags and 0x08 != 0) field(S8) { 0 } + if (flags and 0x10 != 0) { + field(S32LE) { 0 } + field(Utf16LeNullTerminated) { "" } + } + return LoadEntityPacket( + entityId = entityId, + skin = skin, + name = name, + regionId = regionId, + bankId = bankId, + mapId = mapId, + x = x, + y = y, + z = z, + facing = facing, + transportation = transportation, + entityNameplateType = entityNameplateType, + status = EntityStatus.NONE, + hasFollower = hasFollower, + followerDexId = followerDexId, + ) + } +} diff --git a/protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/LoadMapPacket.kt b/protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/LoadMapPacket.kt new file mode 100644 index 0000000..003debf --- /dev/null +++ b/protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/LoadMapPacket.kt @@ -0,0 +1,191 @@ +package de.fiereu.openmmo.net.game.packets + +import de.fiereu.bytecodec.Bool +import de.fiereu.bytecodec.Codec +import de.fiereu.bytecodec.CodecScope +import de.fiereu.bytecodec.MalformedPacketException +import de.fiereu.bytecodec.PacketCodec +import de.fiereu.bytecodec.ReadBuffer +import de.fiereu.bytecodec.S16LE +import de.fiereu.bytecodec.S32LE +import de.fiereu.bytecodec.S64LE +import de.fiereu.bytecodec.S8 +import de.fiereu.bytecodec.U8 +import de.fiereu.bytecodec.Utf16LeNullTerminated +import de.fiereu.bytecodec.WriteBuffer +import de.fiereu.openmmo.common.Tile2D +import de.fiereu.openmmo.common.enums.EncounterType +import de.fiereu.openmmo.common.enums.Lighting +import de.fiereu.openmmo.common.enums.MapType +import de.fiereu.openmmo.common.enums.Weather +import de.fiereu.openmmo.common.utils.gzipDecompress +import de.fiereu.openmmo.common.utils.isNdsRegion +import de.fiereu.openmmo.net.game.codecs.Tile2DCodec + +sealed interface MapData { + data class NdsMapData(val lighting: Lighting, val weather: Weather, val mapType: MapType) : + MapData + + data class GbaConnection( + val direction: Int, + val unknown: Int, + val targetBank: Int, + val targetMap: Int, + ) + + data class GbaMapData( + val width: Int, + val height: Int, + val paletteIdx1: Int, + val paletteIdx2: Int, + val borderWidth: Int, + val borderHeight: Int, + val unknownShort: Int = 0, + val unknownByte: Int = 0, + val borderTiles: List, + val lighting: Lighting, + val weather: Weather, + val mapType: MapType, + val encounterType: EncounterType, + val connections: List = emptyList(), + ) : MapData { + init { + require(borderWidth * borderHeight == borderTiles.size) { + "borderTiles size doesnt match dimensions" + } + require(borderWidth * borderHeight > 0) { "BorderWidth & Height must be greater than zero" } + } + } +} + +data class LoadMapPacket( + val reloadPlayer: Boolean, + val deleteCache: Boolean, + val regionId: Int, + val bankId: Int, + val mapId: Int, + val mapData: MapData, +) { + init { + when (mapData) { + is MapData.NdsMapData -> require(isNdsRegion(regionId)) { "MapData is invalid" } + is MapData.GbaMapData -> require(!isNdsRegion(regionId)) { "MapData is invalid" } + } + } +} + +private object GbaConnectionCodec : PacketCodec() { + override fun CodecScope.body() = + MapData.GbaConnection( + direction = field(U8, MapData.GbaConnection::direction), + unknown = field(S32LE, MapData.GbaConnection::unknown), + targetBank = field(U8, MapData.GbaConnection::targetBank), + targetMap = field(U8, MapData.GbaConnection::targetMap), + ) +} + +private val GbaConnectionListPrefixedU8: Codec> = + object : Codec> { + override fun read(buf: ReadBuffer): List { + val n = U8.read(buf) + return List(n) { GbaConnectionCodec.read(buf) } + } + + override fun write(buf: WriteBuffer, value: List) { + U8.write(buf, value.size) + value.forEach { GbaConnectionCodec.write(buf, it) } + } + } + +object LoadMapPacketCodec : PacketCodec() { + override fun CodecScope.body(): LoadMapPacket { + val flags = + field(U8) { + var f = 0 + if (it.deleteCache) f = f or 1 + if (it.reloadPlayer) f = f or 2 + f + } + val deleteCache = (flags and 1) != 0 + val reloadPlayer = (flags and 2) != 0 + val regionId = field(U8, LoadMapPacket::regionId) + val bankId = field(U8, LoadMapPacket::bankId) + val mapId = field(U8, LoadMapPacket::mapId) + field(S8) { 0 } + val mapData: MapData = + if (isNdsRegion(regionId)) { + field(S16LE) { 0 } + field(U8) { 0 } + val lighting = + Lighting.entries[field(U8) { (it.mapData as MapData.NdsMapData).lighting.ordinal }] + val weather = + Weather.entries[field(U8) { (it.mapData as MapData.NdsMapData).weather.ordinal }] + val mapType = + MapType.entries[field(U8) { (it.mapData as MapData.NdsMapData).mapType.ordinal }] + MapData.NdsMapData(lighting, weather, mapType) + } else { + val getGba: (LoadMapPacket) -> MapData.GbaMapData = { + it.mapData as? MapData.GbaMapData + ?: throw MalformedPacketException("expected GbaMapData for region $regionId") + } + val width = field(S32LE) { getGba(it).width } + val height = field(S32LE) { getGba(it).height } + val paletteIdx1 = field(S32LE) { getGba(it).paletteIdx1 } + val paletteIdx2 = field(S32LE) { getGba(it).paletteIdx2 } + val borderWidth = field(U8) { getGba(it).borderWidth } + val borderHeight = field(U8) { getGba(it).borderHeight } + val unknownShort = field(S16LE) { getGba(it).unknownShort.toShort() }.toInt() + val unknownByte = field(U8) { getGba(it).unknownByte } + val lighting = Lighting.entries[field(U8) { getGba(it).lighting.ordinal }] + val weather = Weather.entries[field(U8) { getGba(it).weather.ordinal }] + val mapType = MapType.entries[field(U8) { getGba(it).mapType.ordinal }] + val encounterType = EncounterType.entries[field(U8) { getGba(it).encounterType.ordinal }] + val borderTiles = + List(borderWidth * borderHeight) { + field(Tile2DCodec) { entry -> getGba(entry).borderTiles[it] } + } + val hasCompressed = field(Bool) { false } + if (hasCompressed) { + val size = field(S32LE) { 0 } + val compressed = field(FixedReadBytes(size)) { ByteArray(0) } + compressed.gzipDecompress() + } + val connections = field(GbaConnectionListPrefixedU8) { getGba(it).connections } + val hasTrailer = field(Bool) { false } + if (hasTrailer) { + field(S64LE) { 0L } + field(Utf16LeNullTerminated) { "" } + } + MapData.GbaMapData( + width = width, + height = height, + paletteIdx1 = paletteIdx1, + paletteIdx2 = paletteIdx2, + borderWidth = borderWidth, + borderHeight = borderHeight, + unknownShort = unknownShort, + unknownByte = unknownByte, + borderTiles = borderTiles, + lighting = lighting, + weather = weather, + mapType = mapType, + encounterType = encounterType, + connections = connections, + ) + } + return LoadMapPacket(reloadPlayer, deleteCache, regionId, bankId, mapId, mapData) + } +} + +private fun FixedReadBytes(n: Int): Codec = + object : Codec { + override fun read(buf: ReadBuffer): ByteArray { + val arr = ByteArray(n) + if (n > 0) buf.readBytes(arr) + return arr + } + + override fun write(buf: WriteBuffer, value: ByteArray) { + error("FixedReadBytes is read-only") + } + } diff --git a/protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/MapTransitionAckPacket.kt b/protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/MapTransitionAckPacket.kt new file mode 100644 index 0000000..adb46de --- /dev/null +++ b/protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/MapTransitionAckPacket.kt @@ -0,0 +1,13 @@ +package de.fiereu.openmmo.net.game.packets + +import de.fiereu.bytecodec.Codec +import de.fiereu.bytecodec.U8 +import de.fiereu.bytecodec.imap + +data class MapTransitionAckPacket(val unk: Int = 0) + +val MapTransitionAckPacketCodec: Codec = + U8.imap( + decode = { MapTransitionAckPacket(it) }, + encode = { it.unk }, + ) diff --git a/protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/MapTransitionPacket.kt b/protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/MapTransitionPacket.kt new file mode 100644 index 0000000..6844d52 --- /dev/null +++ b/protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/MapTransitionPacket.kt @@ -0,0 +1,14 @@ +package de.fiereu.openmmo.net.game.packets + +import de.fiereu.bytecodec.CodecScope +import de.fiereu.bytecodec.PacketCodec + +class MapTransitionPacket { + override fun equals(other: Any?): Boolean = other is MapTransitionPacket + + override fun hashCode(): Int = MapTransitionPacket::class.hashCode() +} + +object MapTransitionPacketCodec : PacketCodec() { + override fun CodecScope.body() = MapTransitionPacket() +} diff --git a/protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/MovementPacket.kt b/protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/MovementPacket.kt new file mode 100644 index 0000000..4ddbbcb --- /dev/null +++ b/protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/MovementPacket.kt @@ -0,0 +1,20 @@ +package de.fiereu.openmmo.net.game.packets + +import de.fiereu.bytecodec.CodecScope +import de.fiereu.bytecodec.PacketCodec +import de.fiereu.bytecodec.S16LE +import de.fiereu.bytecodec.enumByOrdinalByte +import de.fiereu.openmmo.common.enums.Direction + +data class MovementPacket(val x: Int, val y: Int, val direction: Direction) + +object MovementPacketCodec : PacketCodec() { + private val DirectionCodec = enumByOrdinalByte() + + override fun CodecScope.body(): MovementPacket { + val x = field(S16LE) { it.x.toShort() } + val y = field(S16LE) { it.y.toShort() } + val direction = field(DirectionCodec) { it.direction } + return MovementPacket(x.toInt(), y.toInt(), direction) + } +} diff --git a/protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/NpcAnimationPacket.kt b/protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/NpcAnimationPacket.kt new file mode 100644 index 0000000..ebee33f --- /dev/null +++ b/protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/NpcAnimationPacket.kt @@ -0,0 +1,16 @@ +package de.fiereu.openmmo.net.game.packets + +import de.fiereu.bytecodec.CodecScope +import de.fiereu.bytecodec.PacketCodec +import de.fiereu.bytecodec.S64LE +import de.fiereu.bytecodec.U8 + +data class NpcAnimationPacket(val entityId: Long, val animation: Int) + +object NpcAnimationPacketCodec : PacketCodec() { + override fun CodecScope.body(): NpcAnimationPacket { + val entityId = field(S64LE) { it.entityId } + val animation = field(U8) { it.animation } + return NpcAnimationPacket(entityId, animation) + } +} diff --git a/protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/NpcSpawnPacket.kt b/protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/NpcSpawnPacket.kt new file mode 100644 index 0000000..c13345e --- /dev/null +++ b/protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/NpcSpawnPacket.kt @@ -0,0 +1,43 @@ +package de.fiereu.openmmo.net.game.packets + +import de.fiereu.bytecodec.CodecScope +import de.fiereu.bytecodec.PacketCodec +import de.fiereu.bytecodec.S64LE +import de.fiereu.bytecodec.U16LE +import de.fiereu.bytecodec.U8 + +data class NpcSpawnPacket( + val entityId: Long, + val unk1: Int, + val unk2: Int, + val unk3: Int, + val unk4: Int, + val regionId: Int, + val bankId: Int, + val mapId: Int, + val x: Int, + val y: Int, + val facing: Int, + val unk5: Int, + val unk6: Int, +) + +object NpcSpawnPacketCodec : PacketCodec() { + override fun CodecScope.body(): NpcSpawnPacket { + val entityId = field(S64LE) { it.entityId } + val unk1 = field(U8) { it.unk1 } + val unk2 = field(U16LE) { it.unk2 } + val unk3 = field(U16LE) { it.unk3 } + val unk4 = field(U16LE) { it.unk4 } + val regionId = field(U8) { it.regionId } + val bankId = field(U8) { it.bankId } + val mapId = field(U8) { it.mapId } + val x = field(U16LE) { it.x } + val y = field(U16LE) { it.y } + val unk5 = field(U8) { it.unk5 } + val facing = field(U8) { it.facing } + val unk6 = field(U16LE) { it.unk6 } + return NpcSpawnPacket( + entityId, unk1, unk2, unk3, unk4, regionId, bankId, mapId, x, y, facing, unk5, unk6) + } +} diff --git a/protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/NpcUpdatePacket.kt b/protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/NpcUpdatePacket.kt new file mode 100644 index 0000000..4dd532f --- /dev/null +++ b/protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/NpcUpdatePacket.kt @@ -0,0 +1,32 @@ +package de.fiereu.openmmo.net.game.packets + +import de.fiereu.bytecodec.CodecScope +import de.fiereu.bytecodec.PacketCodec +import de.fiereu.bytecodec.S64LE +import de.fiereu.bytecodec.U16LE +import de.fiereu.bytecodec.U8 + +data class NpcUpdatePacket( + val entityId: Long, + val regionId: Int, + val bankId: Int, + val mapId: Int, + val x: Int, + val y: Int, + val facing: Int, + val unk: Int, +) + +object NpcUpdatePacketCodec : PacketCodec() { + override fun CodecScope.body(): NpcUpdatePacket { + val entityId = field(S64LE) { it.entityId } + val regionId = field(U8) { it.regionId } + val bankId = field(U8) { it.bankId } + val mapId = field(U8) { it.mapId } + val x = field(U16LE) { it.x } + val y = field(U16LE) { it.y } + val facing = field(U8) { it.facing } + val unk = field(U8) { it.unk } + return NpcUpdatePacket(entityId, regionId, bankId, mapId, x, y, facing, unk) + } +} diff --git a/protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/NullPacket.kt b/protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/NullPacket.kt new file mode 100644 index 0000000..c97b02a --- /dev/null +++ b/protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/NullPacket.kt @@ -0,0 +1,24 @@ +package de.fiereu.openmmo.net.game.packets + +import de.fiereu.bytecodec.Codec +import de.fiereu.bytecodec.CodecScope +import de.fiereu.bytecodec.PacketCodec +import de.fiereu.bytecodec.ReadBuffer +import de.fiereu.bytecodec.WriteBuffer + +class NullPacket + +private object DrainRemaining : Codec { + override fun read(buf: ReadBuffer) { + if (buf.remaining() > 0) buf.skip(buf.remaining()) + } + + override fun write(buf: WriteBuffer, value: Unit) {} +} + +object NullPacketCodec : PacketCodec() { + override fun CodecScope.body(): NullPacket { + structural(DrainRemaining) + return NullPacket() + } +} diff --git a/protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/PokemonContainerPacket.kt b/protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/PokemonContainerPacket.kt new file mode 100644 index 0000000..249e909 --- /dev/null +++ b/protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/PokemonContainerPacket.kt @@ -0,0 +1,60 @@ +package de.fiereu.openmmo.net.game.packets + +import de.fiereu.bytecodec.Codec +import de.fiereu.bytecodec.CodecScope +import de.fiereu.bytecodec.PacketCodec +import de.fiereu.bytecodec.ReadBuffer +import de.fiereu.bytecodec.U8 +import de.fiereu.bytecodec.WriteBuffer +import de.fiereu.openmmo.common.Pokemon +import de.fiereu.openmmo.common.enums.PokemonContainer +import de.fiereu.openmmo.net.game.codecs.PokemonCodec + +data class PokemonContainerPacket( + val container: PokemonContainer, + val hasChange: Boolean, + val delete: Boolean, + val pokemon: List, +) { + init { + if (delete) + require(hasChange) { + "Pokemon container cannot be deleted if the packet doesn't change anything" + } + if (delete) + require(pokemon.isEmpty()) { "Deleting a Pokemon container shouldn't have any pokemon" } + } +} + +private val PokemonListPrefixedU8: Codec> = + object : Codec> { + override fun read(buf: ReadBuffer): List { + val n = U8.read(buf) + return List(n) { PokemonCodec.read(buf) } + } + + override fun write(buf: WriteBuffer, value: List) { + U8.write(buf, value.size) + value.forEach { PokemonCodec.write(buf, it) } + } + } + +object PokemonContainerPacketCodec : PacketCodec() { + override fun CodecScope.body(): PokemonContainerPacket { + val container = PokemonContainer.entries[field(U8) { it.container.ordinal }] + val flags = + field(U8) { + var f = 0 + if (it.hasChange) f = f or 1 + if (it.delete) f = f or 2 + f + } + val hasChange = (flags and 1) != 0 + val delete = (flags and 2) != 0 + if (delete) { + return PokemonContainerPacket(container, hasChange, true, emptyList()) + } + val pokemon = field(PokemonListPrefixedU8, PokemonContainerPacket::pokemon) + return PokemonContainerPacket(container, hasChange, false, pokemon) + } +} diff --git a/protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/RenderScreenPacket.kt b/protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/RenderScreenPacket.kt new file mode 100644 index 0000000..5cc0312 --- /dev/null +++ b/protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/RenderScreenPacket.kt @@ -0,0 +1,14 @@ +package de.fiereu.openmmo.net.game.packets + +import de.fiereu.bytecodec.Bool +import de.fiereu.bytecodec.CodecScope +import de.fiereu.bytecodec.PacketCodec + +data class RenderScreenPacket(val renderScreen: Boolean) + +object RenderScreenPacketCodec : PacketCodec() { + override fun CodecScope.body(): RenderScreenPacket { + val renderScreen = field(Bool) { it.renderScreen } + return RenderScreenPacket(renderScreen) + } +} diff --git a/protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/RequestCharactersPacket.kt b/protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/RequestCharactersPacket.kt new file mode 100644 index 0000000..62b45ce --- /dev/null +++ b/protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/RequestCharactersPacket.kt @@ -0,0 +1,10 @@ +package de.fiereu.openmmo.net.game.packets + +import de.fiereu.bytecodec.CodecScope +import de.fiereu.bytecodec.PacketCodec + +class RequestCharactersPacket + +object RequestCharactersPacketCodec : PacketCodec() { + override fun CodecScope.body() = RequestCharactersPacket() +} diff --git a/protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/RequestPlayerPacket.kt b/protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/RequestPlayerPacket.kt new file mode 100644 index 0000000..b3f6f5c --- /dev/null +++ b/protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/RequestPlayerPacket.kt @@ -0,0 +1,10 @@ +package de.fiereu.openmmo.net.game.packets + +import de.fiereu.bytecodec.CodecScope +import de.fiereu.bytecodec.PacketCodec + +class RequestPlayerPacket + +object RequestPlayerPacketCodec : PacketCodec() { + override fun CodecScope.body() = RequestPlayerPacket() +} diff --git a/protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/SelectCharacterPacket.kt b/protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/SelectCharacterPacket.kt new file mode 100644 index 0000000..a090376 --- /dev/null +++ b/protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/SelectCharacterPacket.kt @@ -0,0 +1,15 @@ +package de.fiereu.openmmo.net.game.packets + +import de.fiereu.bytecodec.CodecScope +import de.fiereu.bytecodec.PacketCodec +import de.fiereu.bytecodec.S64LE + +data class SelectCharacterPacket(val characterId: Long, val characterIdHash: Long) + +object SelectCharacterPacketCodec : PacketCodec() { + override fun CodecScope.body(): SelectCharacterPacket { + val characterId = field(S64LE) { it.characterId } + val characterIdHash = field(S64LE) { it.characterIdHash } + return SelectCharacterPacket(characterId, characterIdHash) + } +} diff --git a/protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/SelectedCharacterPacket.kt b/protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/SelectedCharacterPacket.kt new file mode 100644 index 0000000..01ea582 --- /dev/null +++ b/protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/SelectedCharacterPacket.kt @@ -0,0 +1,18 @@ +package de.fiereu.openmmo.net.game.packets + +import de.fiereu.bytecodec.CodecScope +import de.fiereu.bytecodec.PacketCodec +import de.fiereu.bytecodec.optional +import de.fiereu.openmmo.common.CharacterInfo +import de.fiereu.openmmo.net.game.codecs.CharacterInfoCodecShort + +data class SelectedCharacterPacket(val character: CharacterInfo?) + +private val OptionalCharacterInfo = CharacterInfoCodecShort.optional() + +object SelectedCharacterPacketCodec : PacketCodec() { + override fun CodecScope.body() = + SelectedCharacterPacket( + character = field(OptionalCharacterInfo, SelectedCharacterPacket::character), + ) +} diff --git a/protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/TokenPayloadPacket.kt b/protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/TokenPayloadPacket.kt new file mode 100644 index 0000000..513aba2 --- /dev/null +++ b/protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/TokenPayloadPacket.kt @@ -0,0 +1,34 @@ +package de.fiereu.openmmo.net.game.packets + +import de.fiereu.bytecodec.Codec +import de.fiereu.bytecodec.CodecScope +import de.fiereu.bytecodec.PacketCodec +import de.fiereu.bytecodec.ReadBuffer +import de.fiereu.bytecodec.WriteBuffer + +data class TokenPayloadPacket(val payload: ByteArray) { + override fun equals(other: Any?): Boolean = + other is TokenPayloadPacket && payload.contentEquals(other.payload) + + override fun hashCode(): Int = payload.contentHashCode() +} + +private val TokenPayloadBytes: Codec = + object : Codec { + override fun read(buf: ReadBuffer): ByteArray { + val data = ByteArray(buf.remaining()) + if (data.isNotEmpty()) buf.readBytes(data) + return data + } + + override fun write(buf: WriteBuffer, value: ByteArray) { + if (value.isNotEmpty()) buf.writeBytes(value) + } + } + +object TokenPayloadPacketCodec : PacketCodec() { + override fun CodecScope.body() = + TokenPayloadPacket( + payload = field(TokenPayloadBytes, TokenPayloadPacket::payload), + ) +} diff --git a/protocols.game/src/test/kotlin/de/fiereu/openmmo/net/game/GameCodecRoundtripTest.kt b/protocols.game/src/test/kotlin/de/fiereu/openmmo/net/game/GameCodecRoundtripTest.kt new file mode 100644 index 0000000..19566e3 --- /dev/null +++ b/protocols.game/src/test/kotlin/de/fiereu/openmmo/net/game/GameCodecRoundtripTest.kt @@ -0,0 +1,46 @@ +package de.fiereu.openmmo.net.game + +import de.fiereu.bytecodec.test.decodeBytes +import de.fiereu.bytecodec.test.encodeToBytes +import de.fiereu.openmmo.common.enums.Direction +import de.fiereu.openmmo.net.game.packets.DialogStatePacket +import de.fiereu.openmmo.net.game.packets.DialogStatePacketCodec +import de.fiereu.openmmo.net.game.packets.EntityLeavePacket +import de.fiereu.openmmo.net.game.packets.EntityLeavePacketCodec +import de.fiereu.openmmo.net.game.packets.FaceDirectionPacket +import de.fiereu.openmmo.net.game.packets.FaceDirectionPacketCodec +import de.fiereu.openmmo.net.game.packets.MovementPacket +import de.fiereu.openmmo.net.game.packets.MovementPacketCodec +import de.fiereu.openmmo.net.game.packets.RenderScreenPacket +import de.fiereu.openmmo.net.game.packets.RenderScreenPacketCodec +import io.kotest.core.spec.style.FunSpec +import io.kotest.matchers.shouldBe + +class GameCodecRoundtripTest : + FunSpec({ + test("RenderScreenPacket roundtrip") { + RenderScreenPacketCodec.encodeToBytes(RenderScreenPacket(true)) shouldBe byteArrayOf(1) + RenderScreenPacketCodec.decodeBytes(byteArrayOf(0)) shouldBe RenderScreenPacket(false) + } + + test("EntityLeavePacket roundtrip") { + val pkt = EntityLeavePacket(entityId = 0x0102030405060708L) + EntityLeavePacketCodec.decodeBytes(EntityLeavePacketCodec.encodeToBytes(pkt)) shouldBe pkt + } + + test("FaceDirectionPacket roundtrip") { + val pkt = FaceDirectionPacket(direction = Direction.UP) + FaceDirectionPacketCodec.decodeBytes(FaceDirectionPacketCodec.encodeToBytes(pkt)) shouldBe + pkt + } + + test("MovementPacket roundtrip") { + val pkt = MovementPacket(x = 100, y = 250, direction = Direction.DOWN) + MovementPacketCodec.decodeBytes(MovementPacketCodec.encodeToBytes(pkt)) shouldBe pkt + } + + test("DialogStatePacket roundtrip") { + DialogStatePacketCodec.encodeToBytes(DialogStatePacket(true)) shouldBe byteArrayOf(1) + DialogStatePacketCodec.decodeBytes(byteArrayOf(0)) shouldBe DialogStatePacket(false) + } + }) diff --git a/protocols.game/src/test/kotlin/de/fiereu/openmmo/net/game/GameProtocolTest.kt b/protocols.game/src/test/kotlin/de/fiereu/openmmo/net/game/GameProtocolTest.kt new file mode 100644 index 0000000..7b1e85a --- /dev/null +++ b/protocols.game/src/test/kotlin/de/fiereu/openmmo/net/game/GameProtocolTest.kt @@ -0,0 +1,87 @@ +package de.fiereu.openmmo.net.game + +import de.fiereu.network.Direction +import de.fiereu.network.Side +import de.fiereu.openmmo.net.game.packets.ChatMessagePacket +import de.fiereu.openmmo.net.game.packets.EntityMovePacket +import de.fiereu.openmmo.net.game.packets.JoinPacket +import de.fiereu.openmmo.net.game.packets.JoinResponsePacket +import de.fiereu.openmmo.net.game.packets.KeepAlivePacket +import de.fiereu.openmmo.net.game.packets.LoadMapPacket +import de.fiereu.openmmo.net.game.packets.NullPacket +import de.fiereu.openmmo.net.game.packets.TokenPayloadPacket +import io.kotest.core.spec.style.FunSpec +import io.kotest.matchers.shouldBe + +class GameProtocolTest : + FunSpec({ + test("at least one registration per known opcode") { + val opcodes = GameProtocol.registrations.map { it.opcode }.toSet() + opcodes shouldBe + setOf( + 0x01u.toUByte(), + 0x02u.toUByte(), + 0x03u.toUByte(), + 0x04u.toUByte(), + 0x05u.toUByte(), + 0x06u.toUByte(), + 0x07u.toUByte(), + 0x08u.toUByte(), + 0x09u.toUByte(), + 0x0Du.toUByte(), + 0x0Eu.toUByte(), + 0x10u.toUByte(), + 0x11u.toUByte(), + 0x12u.toUByte(), + 0x13u.toUByte(), + 0x1Bu.toUByte(), + 0x20u.toUByte(), + 0x21u.toUByte(), + 0x22u.toUByte(), + 0x25u.toUByte(), + 0x26u.toUByte(), + 0xB2u.toUByte(), + 0xB4u.toUByte(), + 0xB9u.toUByte(), + 0xC2u.toUByte(), + 0xEAu.toUByte(), + ) + } + + test("compressed flag is set") { GameProtocol.compressed shouldBe true } + + test("0x01 split: client outgoing JoinPacket, server outgoing JoinResponsePacket") { + GameProtocol.outgoingRegistration(Side.CLIENT, JoinPacket::class)?.opcode shouldBe 0x01u + GameProtocol.outgoingRegistration(Side.SERVER, JoinResponsePacket::class)?.opcode shouldBe + 0x01u + } + + test("0xEA EntityMovePacket is S2C only") { + GameProtocol.outgoingRegistration(Side.SERVER, EntityMovePacket::class)?.opcode shouldBe + 0xEAu + GameProtocol.outgoingRegistration(Side.CLIENT, EntityMovePacket::class) shouldBe null + } + + test("0x20 split: NullPacket C2S, TokenPayloadPacket S2C") { + GameProtocol.incomingRegistration(Side.SERVER, 0x20u)?.type shouldBe NullPacket::class + GameProtocol.incomingRegistration(Side.CLIENT, 0x20u)?.type shouldBe + TokenPayloadPacket::class + } + + test("bidi packets are registered both directions") { + val bidi = + listOf( + ChatMessagePacket::class, + LoadMapPacket::class, + KeepAlivePacket::class, + ) + for (type in bidi) { + val serverOut = GameProtocol.outgoingRegistration(Side.SERVER, type) + val clientOut = GameProtocol.outgoingRegistration(Side.CLIENT, type) + (serverOut != null && clientOut != null) shouldBe true + serverOut?.direction shouldBe Direction.S2C + clientOut?.direction shouldBe Direction.C2S + serverOut?.opcode shouldBe clientOut?.opcode + } + } + }) diff --git a/protocol.game/build.gradle.kts b/protocols.login/build.gradle.kts similarity index 67% rename from protocol.game/build.gradle.kts rename to protocols.login/build.gradle.kts index 025b0dd..c142d51 100644 --- a/protocol.game/build.gradle.kts +++ b/protocols.login/build.gradle.kts @@ -1,11 +1,12 @@ plugins { id("buildsrc.convention.kotlin-jvm") id("buildsrc.convention.spotless") + id("buildsrc.convention.sonarlint") } dependencies { - api(project(":protocol")) + api(project(":network")) api(project(":common")) - + api(libs.ineter) testImplementation(libs.bundles.kotest) } diff --git a/protocols.login/src/main/kotlin/de/fiereu/openmmo/net/login/LoginProtocol.kt b/protocols.login/src/main/kotlin/de/fiereu/openmmo/net/login/LoginProtocol.kt new file mode 100644 index 0000000..a7437bc --- /dev/null +++ b/protocols.login/src/main/kotlin/de/fiereu/openmmo/net/login/LoginProtocol.kt @@ -0,0 +1,49 @@ +package de.fiereu.openmmo.net.login + +import de.fiereu.network.Protocol +import de.fiereu.network.c2s +import de.fiereu.network.s2c +import de.fiereu.openmmo.net.login.packets.ExistingSessionPacket +import de.fiereu.openmmo.net.login.packets.ExistingSessionPacketCodec +import de.fiereu.openmmo.net.login.packets.GameServerListPacket +import de.fiereu.openmmo.net.login.packets.GameServerListPacketCodec +import de.fiereu.openmmo.net.login.packets.GameServerNodesPacket +import de.fiereu.openmmo.net.login.packets.GameServerNodesPacketCodec +import de.fiereu.openmmo.net.login.packets.JoinGameServerPacket +import de.fiereu.openmmo.net.login.packets.JoinGameServerPacketCodec +import de.fiereu.openmmo.net.login.packets.LoginKickPacket +import de.fiereu.openmmo.net.login.packets.LoginKickPacketCodec +import de.fiereu.openmmo.net.login.packets.LoginRequestPacket +import de.fiereu.openmmo.net.login.packets.LoginRequestPacketCodec +import de.fiereu.openmmo.net.login.packets.LoginResponsePacket +import de.fiereu.openmmo.net.login.packets.LoginResponsePacketCodec +import de.fiereu.openmmo.net.login.packets.MfaChallengePacket +import de.fiereu.openmmo.net.login.packets.MfaChallengePacketCodec +import de.fiereu.openmmo.net.login.packets.MfaResponsePacket +import de.fiereu.openmmo.net.login.packets.MfaResponsePacketCodec +import de.fiereu.openmmo.net.login.packets.RequestGameServerListPacket +import de.fiereu.openmmo.net.login.packets.RequestGameServerListPacketCodec +import de.fiereu.openmmo.net.login.packets.SentCredentialsPacket +import de.fiereu.openmmo.net.login.packets.SentCredentialsPacketCodec +import de.fiereu.openmmo.net.login.packets.ToSConfirmationPacket +import de.fiereu.openmmo.net.login.packets.ToSConfirmationPacketCodec +import de.fiereu.openmmo.net.login.packets.ToSPacket +import de.fiereu.openmmo.net.login.packets.ToSPacketCodec + +object LoginProtocol : Protocol() { + init { + s2c(0x01u, LoginResponsePacketCodec) + c2s(0x02u, RequestGameServerListPacketCodec) + c2s(0x03u, JoinGameServerPacketCodec) + s2c(0x03u, GameServerNodesPacketCodec) + c2s(0x04u, ToSConfirmationPacketCodec) + s2c(0x05u, LoginKickPacketCodec) + s2c(0x07u, SentCredentialsPacketCodec) + s2c(0x08u, MfaChallengePacketCodec) + c2s(0x08u, MfaResponsePacketCodec) + c2s(0x11u, LoginRequestPacketCodec) + s2c(0x14u, ToSPacketCodec) + s2c(0x22u, GameServerListPacketCodec) + s2c(0x26u, ExistingSessionPacketCodec) + } +} diff --git a/protocols.login/src/main/kotlin/de/fiereu/openmmo/net/login/packets/ExistingSessionPacket.kt b/protocols.login/src/main/kotlin/de/fiereu/openmmo/net/login/packets/ExistingSessionPacket.kt new file mode 100644 index 0000000..25597b5 --- /dev/null +++ b/protocols.login/src/main/kotlin/de/fiereu/openmmo/net/login/packets/ExistingSessionPacket.kt @@ -0,0 +1,52 @@ +package de.fiereu.openmmo.net.login.packets + +import de.fiereu.bytecodec.Bool +import de.fiereu.bytecodec.CodecScope +import de.fiereu.bytecodec.PacketCodec +import de.fiereu.bytecodec.S16LE +import de.fiereu.bytecodec.S32LE +import de.fiereu.bytecodec.S64LE +import de.fiereu.bytecodec.U8 +import de.fiereu.bytecodec.Utf16LeNullTerminated +import de.fiereu.bytecodec.bytesPrefixed +import de.fiereu.bytecodec.reserved + +data class ExistingSessionPacket( + val sessionId: Long, + val sessionKey: ByteArray, + val serverName: String, +) { + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is ExistingSessionPacket) return false + return sessionId == other.sessionId && + sessionKey.contentEquals(other.sessionKey) && + serverName == other.serverName + } + + override fun hashCode(): Int { + var result = sessionId.hashCode() + result = 31 * result + sessionKey.contentHashCode() + result = 31 * result + serverName.hashCode() + return result + } +} + +private val SessionKeyCodec = bytesPrefixed(U8) + +object ExistingSessionPacketCodec : PacketCodec() { + override fun CodecScope.body(): ExistingSessionPacket { + val sessionId = field(S64LE) { it.sessionId } + val sessionKey = field(SessionKeyCodec) { it.sessionKey } + reserved(byte = 0) + val serverName = field(Utf16LeNullTerminated) { it.serverName } + reserved(byte = 0) + field(Utf16LeNullTerminated) { "" } + field(S32LE) { 0 } + field(S16LE) { 0 } + field(S16LE) { 0 } + field(Bool) { false } + field(U8) { 0 } + return ExistingSessionPacket(sessionId, sessionKey, serverName) + } +} diff --git a/protocols.login/src/main/kotlin/de/fiereu/openmmo/net/login/packets/GameServerListPacket.kt b/protocols.login/src/main/kotlin/de/fiereu/openmmo/net/login/packets/GameServerListPacket.kt new file mode 100644 index 0000000..ddc2092 --- /dev/null +++ b/protocols.login/src/main/kotlin/de/fiereu/openmmo/net/login/packets/GameServerListPacket.kt @@ -0,0 +1,48 @@ +package de.fiereu.openmmo.net.login.packets + +import de.fiereu.bytecodec.Bool +import de.fiereu.bytecodec.CodecScope +import de.fiereu.bytecodec.PacketCodec +import de.fiereu.bytecodec.U16LE +import de.fiereu.bytecodec.U8 +import de.fiereu.bytecodec.Utf16LeNullTerminated + +data class GameServer( + val id: UByte, + val name: String, + val currentPlayers: UShort = 0u, + val maxPlayers: UShort = 0u, + val joinable: Boolean, +) + +data class GameServerListPacket(val gameServers: List) + +object GameServerCodec : PacketCodec() { + override fun CodecScope.body(): GameServer { + val id = field(U8) { it.id.toInt() }.toUByte() + val name = field(Utf16LeNullTerminated) { it.name } + val currentPlayers = field(U16LE) { it.currentPlayers.toInt() }.toUShort() + val maxPlayers = field(U16LE) { it.maxPlayers.toInt() }.toUShort() + val joinable = field(Bool) { it.joinable } + return GameServer(id, name, currentPlayers, maxPlayers, joinable) + } +} + +object GameServerListPacketCodec : PacketCodec() { + override fun CodecScope.body(): GameServerListPacket { + val count = + field(U8) { + require(it.gameServers.size <= Byte.MAX_VALUE) { "Too many game servers" } + it.gameServers.size + } + if (count == 0) { + field(U8) { 0 } + field(U8) { 0 } + return GameServerListPacket(emptyList()) + } + field(U8) { it.gameServers.first().id.toInt() } + val list = ArrayList(count) + repeat(count) { i -> list += field(GameServerCodec) { it.gameServers[i] } } + return GameServerListPacket(list) + } +} diff --git a/protocols.login/src/main/kotlin/de/fiereu/openmmo/net/login/packets/GameServerNodesPacket.kt b/protocols.login/src/main/kotlin/de/fiereu/openmmo/net/login/packets/GameServerNodesPacket.kt new file mode 100644 index 0000000..b8aac58 --- /dev/null +++ b/protocols.login/src/main/kotlin/de/fiereu/openmmo/net/login/packets/GameServerNodesPacket.kt @@ -0,0 +1,83 @@ +package de.fiereu.openmmo.net.login.packets + +import com.github.maltalex.ineter.base.IPAddress +import com.github.maltalex.ineter.base.IPv4Address +import com.github.maltalex.ineter.base.IPv6Address +import de.fiereu.bytecodec.CodecScope +import de.fiereu.bytecodec.MalformedPacketException +import de.fiereu.bytecodec.PacketCodec +import de.fiereu.bytecodec.S16LE +import de.fiereu.bytecodec.S32LE +import de.fiereu.bytecodec.U8 +import de.fiereu.bytecodec.Utf16LeNullTerminated +import de.fiereu.bytecodec.bytesPrefixed +import de.fiereu.openmmo.common.enums.LoginState + +data class GameServerNode( + val iPv4Address: IPv4Address, + val iPv6Address: IPv6Address, + val port: UShort = 7777u, + val weight: UByte, +) + +data class GameServerData( + val gameServerId: UByte, + val userId: Int, + val sessionToken: ByteArray, + val localAddress: IPAddress, + val localHostname: String, + val port: UShort, +) + +data class GameServerNodesPacket( + val loginState: LoginState, + val gameServerData: GameServerData? = null, + val nodes: List = emptyList(), +) + +private val SessionTokenCodec = bytesPrefixed(U8) +private val LocalAddressCodec = bytesPrefixed(U8) + +object GameServerNodesPacketCodec : PacketCodec() { + override fun CodecScope.body(): GameServerNodesPacket { + val stateId = field(U8) { it.loginState.id } + val loginState = LoginState.entries.find { it.id == stateId } ?: LoginState.SYSTEM_ERROR + if (loginState != LoginState.AUTHED) return GameServerNodesPacket(loginState) + + val userId = + field(S32LE) { + val gsd = + it.gameServerData + ?: throw MalformedPacketException( + "GameServerData must be provided for AUTHED state") + gsd.userId + } + val sessionToken = field(SessionTokenCodec) { it.gameServerData!!.sessionToken } + val gameServerId = field(U8) { it.gameServerData!!.gameServerId.toInt() }.toUByte() + val localBytes = + field(LocalAddressCodec) { it.gameServerData!!.localAddress.toBigEndianArray() } + val localAddress = IPAddress.of(localBytes) + val localHostname = field(Utf16LeNullTerminated) { it.gameServerData!!.localHostname } + val port = field(S32LE) { it.gameServerData!!.port.toInt() }.toUShort() + + val nodeCount = field(U8) { it.nodes.size } + val nodes = ArrayList(nodeCount) + repeat(nodeCount) { i -> + field(U8) { i } + val ipv4 = + field(TaggedIpCodec) { it.nodes[i].iPv4Address } as? IPv4Address + ?: throw MalformedPacketException("Expected IPv4 address for game server node") + val ipv6 = + field(TaggedIpCodec) { it.nodes[i].iPv6Address } as? IPv6Address + ?: throw MalformedPacketException("Expected IPv6 address for game server node") + val nodePort = field(S16LE) { it.nodes[i].port.toShort() }.toUShort() + val weight = field(U8) { it.nodes[i].weight.toInt() }.toUByte() + nodes += GameServerNode(ipv4, ipv6, nodePort, weight) + } + return GameServerNodesPacket( + LoginState.AUTHED, + GameServerData(gameServerId, userId, sessionToken, localAddress, localHostname, port), + nodes, + ) + } +} diff --git a/protocols.login/src/main/kotlin/de/fiereu/openmmo/net/login/packets/IpCodec.kt b/protocols.login/src/main/kotlin/de/fiereu/openmmo/net/login/packets/IpCodec.kt new file mode 100644 index 0000000..aa62030 --- /dev/null +++ b/protocols.login/src/main/kotlin/de/fiereu/openmmo/net/login/packets/IpCodec.kt @@ -0,0 +1,42 @@ +package de.fiereu.openmmo.net.login.packets + +import com.github.maltalex.ineter.base.IPAddress +import com.github.maltalex.ineter.base.IPv4Address +import com.github.maltalex.ineter.base.IPv6Address +import de.fiereu.bytecodec.Codec +import de.fiereu.bytecodec.MalformedPacketException +import de.fiereu.bytecodec.ReadBuffer +import de.fiereu.bytecodec.S32LE +import de.fiereu.bytecodec.S64LE +import de.fiereu.bytecodec.U8 +import de.fiereu.bytecodec.WriteBuffer + +object TaggedIpCodec : Codec { + override fun read(buf: ReadBuffer): IPAddress { + val type = U8.read(buf) + return when (type) { + 4 -> IPv4Address.of(S32LE.read(buf)) + 6 -> { + val upper = S64LE.read(buf) + val lower = S64LE.read(buf) + IPv6Address.of(upper, lower) + } + else -> throw MalformedPacketException("Unknown IP address type: $type") + } + } + + override fun write(buf: WriteBuffer, value: IPAddress) { + when (value) { + is IPv4Address -> { + U8.write(buf, 4) + S32LE.write(buf, value.toInt()) + } + is IPv6Address -> { + U8.write(buf, 6) + S64LE.write(buf, value.upper) + S64LE.write(buf, value.lower) + } + else -> throw MalformedPacketException("Unknown IP address type: ${value.javaClass}") + } + } +} diff --git a/protocols.login/src/main/kotlin/de/fiereu/openmmo/net/login/packets/JoinGameServerPacket.kt b/protocols.login/src/main/kotlin/de/fiereu/openmmo/net/login/packets/JoinGameServerPacket.kt new file mode 100644 index 0000000..bf2fa9a --- /dev/null +++ b/protocols.login/src/main/kotlin/de/fiereu/openmmo/net/login/packets/JoinGameServerPacket.kt @@ -0,0 +1,13 @@ +package de.fiereu.openmmo.net.login.packets + +import de.fiereu.bytecodec.Codec +import de.fiereu.bytecodec.U8 +import de.fiereu.bytecodec.imap + +data class JoinGameServerPacket(val gameServerId: UByte) + +val JoinGameServerPacketCodec: Codec = + U8.imap( + decode = { JoinGameServerPacket(it.toUByte()) }, + encode = { it.gameServerId.toInt() }, + ) diff --git a/protocols.login/src/main/kotlin/de/fiereu/openmmo/net/login/packets/LoginKickPacket.kt b/protocols.login/src/main/kotlin/de/fiereu/openmmo/net/login/packets/LoginKickPacket.kt new file mode 100644 index 0000000..be81c6b --- /dev/null +++ b/protocols.login/src/main/kotlin/de/fiereu/openmmo/net/login/packets/LoginKickPacket.kt @@ -0,0 +1,52 @@ +package de.fiereu.openmmo.net.login.packets + +import com.github.maltalex.ineter.base.IPv4Address +import de.fiereu.bytecodec.Bool +import de.fiereu.bytecodec.CodecScope +import de.fiereu.bytecodec.MalformedPacketException +import de.fiereu.bytecodec.PacketCodec +import de.fiereu.bytecodec.S32LE +import de.fiereu.bytecodec.U8 +import de.fiereu.bytecodec.Utf16LeNullTerminated + +enum class KickReason { + A, + IP_RANGE, + C, +} + +data class LoginKickPacket(val reason: KickReason?) + +object LoginKickPacketCodec : PacketCodec() { + override fun CodecScope.body(): LoginKickPacket { + val hasReason = field(Bool) { it.reason != null } + if (!hasReason) return LoginKickPacket(null) + val ordinal = field(U8) { it.reason!!.ordinal } + val reason = + KickReason.entries.getOrNull(ordinal) + ?: throw MalformedPacketException("Unknown kick reason: $ordinal") + when (reason) { + KickReason.IP_RANGE -> { + field(S32LE) { 0 } + field(TaggedIpCodec) { IPv4Address.MIN_ADDR } + field(TaggedIpCodec) { IPv4Address.MAX_ADDR } + field(S32LE) { 0 } + field(S32LE) { 0 } + field(Utf16LeNullTerminated) { "" } + field(Utf16LeNullTerminated) { "" } + field(U8) { 0 } + } + KickReason.A, + KickReason.C -> { + field(S32LE) { 0 } + field(S32LE) { 0 } + field(S32LE) { 0 } + field(S32LE) { 0 } + field(Utf16LeNullTerminated) { "" } + field(Utf16LeNullTerminated) { "" } + field(U8) { 0 } + } + } + return LoginKickPacket(reason) + } +} diff --git a/protocols.login/src/main/kotlin/de/fiereu/openmmo/net/login/packets/LoginRequestPacket.kt b/protocols.login/src/main/kotlin/de/fiereu/openmmo/net/login/packets/LoginRequestPacket.kt new file mode 100644 index 0000000..ab5c804 --- /dev/null +++ b/protocols.login/src/main/kotlin/de/fiereu/openmmo/net/login/packets/LoginRequestPacket.kt @@ -0,0 +1,114 @@ +package de.fiereu.openmmo.net.login.packets + +import de.fiereu.bytecodec.Bool +import de.fiereu.bytecodec.CodecScope +import de.fiereu.bytecodec.MalformedPacketException +import de.fiereu.bytecodec.PacketCodec +import de.fiereu.bytecodec.S32LE +import de.fiereu.bytecodec.U8 +import de.fiereu.bytecodec.Utf16LeNullTerminated +import de.fiereu.bytecodec.bytesPrefixed +import de.fiereu.bytecodec.imap +import de.fiereu.openmmo.common.enums.Language + +sealed interface LoginMethod + +data class PasswordLogin(val password: String, val stayLoggedIn: Boolean) : LoginMethod + +data class TokenLogin(val token: ByteArray) : LoginMethod { + override fun equals(other: Any?): Boolean = + other is TokenLogin && token.contentEquals(other.token) + + override fun hashCode(): Int = token.contentHashCode() +} + +data class LoginRequestPacket( + val username: String, + val manualLogin: Boolean, + val hwid: ByteArray, + val method: LoginMethod, + val language: Language, + val clientRevision: Int, + val installationRevision: Int, + val os: UByte, + val hardwareInfoCache: ByteArray, +) { + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is LoginRequestPacket) return false + return username == other.username && + manualLogin == other.manualLogin && + hwid.contentEquals(other.hwid) && + method == other.method && + language == other.language && + clientRevision == other.clientRevision && + installationRevision == other.installationRevision && + os == other.os && + hardwareInfoCache.contentEquals(other.hardwareInfoCache) + } + + override fun hashCode(): Int { + var result = username.hashCode() + result = 31 * result + manualLogin.hashCode() + result = 31 * result + hwid.contentHashCode() + result = 31 * result + method.hashCode() + result = 31 * result + language.hashCode() + result = 31 * result + clientRevision + result = 31 * result + installationRevision + result = 31 * result + os.hashCode() + result = 31 * result + hardwareInfoCache.contentHashCode() + return result + } +} + +private val LanguageCodec = + Utf16LeNullTerminated.imap( + decode = { Language.fromCode(it) }, + encode = { it.code }, + ) + +private val LengthPrefixedBytes = bytesPrefixed(U8) + +object LoginRequestPacketCodec : PacketCodec() { + override fun CodecScope.body(): LoginRequestPacket { + val username = field(Utf16LeNullTerminated) { it.username } + val manualLogin = field(Bool) { it.manualLogin } + val hwid = field(LengthPrefixedBytes) { it.hwid } + val methodTag = + field(U8) { + when (it.method) { + is PasswordLogin -> 0 + is TokenLogin -> 1 + } + } + val method: LoginMethod = + when (methodTag) { + 0 -> { + val password = field(Utf16LeNullTerminated) { (it.method as PasswordLogin).password } + val stayLoggedIn = field(Bool) { (it.method as PasswordLogin).stayLoggedIn } + PasswordLogin(password, stayLoggedIn) + } + 1 -> { + val token = field(LengthPrefixedBytes) { (it.method as TokenLogin).token } + TokenLogin(token) + } + else -> throw MalformedPacketException("Unknown login method type: $methodTag") + } + val language = field(LanguageCodec) { it.language } + val clientRevision = field(S32LE) { it.clientRevision } + val installationRevision = field(S32LE) { it.installationRevision } + val os = field(U8) { it.os.toInt() }.toUByte() + val hardwareInfoCache = field(LengthPrefixedBytes) { it.hardwareInfoCache } + return LoginRequestPacket( + username, + manualLogin, + hwid, + method, + language, + clientRevision, + installationRevision, + os, + hardwareInfoCache, + ) + } +} diff --git a/protocols.login/src/main/kotlin/de/fiereu/openmmo/net/login/packets/LoginResponsePacket.kt b/protocols.login/src/main/kotlin/de/fiereu/openmmo/net/login/packets/LoginResponsePacket.kt new file mode 100644 index 0000000..26e559a --- /dev/null +++ b/protocols.login/src/main/kotlin/de/fiereu/openmmo/net/login/packets/LoginResponsePacket.kt @@ -0,0 +1,36 @@ +package de.fiereu.openmmo.net.login.packets + +import de.fiereu.bytecodec.CodecScope +import de.fiereu.bytecodec.MalformedPacketException +import de.fiereu.bytecodec.PacketCodec +import de.fiereu.bytecodec.S64LE +import de.fiereu.bytecodec.U8 +import de.fiereu.bytecodec.Utf16LeNullTerminated +import de.fiereu.openmmo.common.enums.LoginState +import java.time.LocalDateTime +import java.time.ZoneOffset + +data class LoginResponsePacket(val state: LoginState, val ratelimitEnd: LocalDateTime?) { + constructor(state: LoginState) : this(state, null) +} + +object LoginResponsePacketCodec : PacketCodec() { + override fun CodecScope.body(): LoginResponsePacket { + val stateId = field(U8) { it.state.id } + val state = LoginState.entries.find { it.id == stateId } ?: LoginState.SYSTEM_ERROR + var ratelimitEnd: LocalDateTime? = null + if (state == LoginState.RATE_LIMITED || state == LoginState.RATE_LIMITED_2FA) { + val epoch = + field(S64LE) { + it.ratelimitEnd?.toEpochSecond(ZoneOffset.UTC) + ?: throw MalformedPacketException( + "ratelimitEnd must be provided for RATE_LIMITED states") + } + ratelimitEnd = LocalDateTime.ofEpochSecond(epoch, 0, ZoneOffset.UTC) + } + if (state == LoginState.AUTHED) { + field(Utf16LeNullTerminated) { "" } + } + return LoginResponsePacket(state, ratelimitEnd) + } +} diff --git a/protocols.login/src/main/kotlin/de/fiereu/openmmo/net/login/packets/MfaChallengePacket.kt b/protocols.login/src/main/kotlin/de/fiereu/openmmo/net/login/packets/MfaChallengePacket.kt new file mode 100644 index 0000000..669713a --- /dev/null +++ b/protocols.login/src/main/kotlin/de/fiereu/openmmo/net/login/packets/MfaChallengePacket.kt @@ -0,0 +1,16 @@ +package de.fiereu.openmmo.net.login.packets + +import de.fiereu.bytecodec.CodecScope +import de.fiereu.bytecodec.PacketCodec +import de.fiereu.bytecodec.S8 +import de.fiereu.bytecodec.Utf16LeNullTerminated + +data class MfaChallengePacket(val unk: Byte, val email: String) + +object MfaChallengePacketCodec : PacketCodec() { + override fun CodecScope.body(): MfaChallengePacket { + val unk = field(S8) { it.unk } + val email = field(Utf16LeNullTerminated) { it.email } + return MfaChallengePacket(unk, email) + } +} diff --git a/protocols.login/src/main/kotlin/de/fiereu/openmmo/net/login/packets/MfaResponsePacket.kt b/protocols.login/src/main/kotlin/de/fiereu/openmmo/net/login/packets/MfaResponsePacket.kt new file mode 100644 index 0000000..b7575ff --- /dev/null +++ b/protocols.login/src/main/kotlin/de/fiereu/openmmo/net/login/packets/MfaResponsePacket.kt @@ -0,0 +1,13 @@ +package de.fiereu.openmmo.net.login.packets + +import de.fiereu.bytecodec.Codec +import de.fiereu.bytecodec.Utf16LeNullTerminated +import de.fiereu.bytecodec.imap + +data class MfaResponsePacket(val mfaCode: String) + +val MfaResponsePacketCodec: Codec = + Utf16LeNullTerminated.imap( + decode = { MfaResponsePacket(it) }, + encode = { it.mfaCode }, + ) diff --git a/protocols.login/src/main/kotlin/de/fiereu/openmmo/net/login/packets/RequestGameServerListPacket.kt b/protocols.login/src/main/kotlin/de/fiereu/openmmo/net/login/packets/RequestGameServerListPacket.kt new file mode 100644 index 0000000..a24b153 --- /dev/null +++ b/protocols.login/src/main/kotlin/de/fiereu/openmmo/net/login/packets/RequestGameServerListPacket.kt @@ -0,0 +1,10 @@ +package de.fiereu.openmmo.net.login.packets + +import de.fiereu.bytecodec.CodecScope +import de.fiereu.bytecodec.PacketCodec + +class RequestGameServerListPacket + +object RequestGameServerListPacketCodec : PacketCodec() { + override fun CodecScope.body() = RequestGameServerListPacket() +} diff --git a/protocols.login/src/main/kotlin/de/fiereu/openmmo/net/login/packets/SentCredentialsPacket.kt b/protocols.login/src/main/kotlin/de/fiereu/openmmo/net/login/packets/SentCredentialsPacket.kt new file mode 100644 index 0000000..d2a004f --- /dev/null +++ b/protocols.login/src/main/kotlin/de/fiereu/openmmo/net/login/packets/SentCredentialsPacket.kt @@ -0,0 +1,23 @@ +package de.fiereu.openmmo.net.login.packets + +import de.fiereu.bytecodec.CodecScope +import de.fiereu.bytecodec.PacketCodec +import de.fiereu.bytecodec.Utf16LeNullTerminated +import java.util.Base64 + +data class SentCredentialsPacket(val username: String, val key: String) { + constructor( + username: String, + keyBytes: ByteArray?, + ) : this(username, keyBytes?.let { Base64.getEncoder().encodeToString(it) } ?: "") + + constructor(username: String) : this(username, "") +} + +object SentCredentialsPacketCodec : PacketCodec() { + override fun CodecScope.body(): SentCredentialsPacket { + val username = field(Utf16LeNullTerminated) { it.username } + val key = field(Utf16LeNullTerminated) { it.key } + return SentCredentialsPacket(username, key) + } +} diff --git a/protocols.login/src/main/kotlin/de/fiereu/openmmo/net/login/packets/ToSConfirmationPacket.kt b/protocols.login/src/main/kotlin/de/fiereu/openmmo/net/login/packets/ToSConfirmationPacket.kt new file mode 100644 index 0000000..288864a --- /dev/null +++ b/protocols.login/src/main/kotlin/de/fiereu/openmmo/net/login/packets/ToSConfirmationPacket.kt @@ -0,0 +1,13 @@ +package de.fiereu.openmmo.net.login.packets + +import de.fiereu.bytecodec.Codec +import de.fiereu.bytecodec.S8 +import de.fiereu.bytecodec.imap + +data class ToSConfirmationPacket(val confirmationKey: Byte) + +val ToSConfirmationPacketCodec: Codec = + S8.imap( + decode = { ToSConfirmationPacket(it) }, + encode = { it.confirmationKey }, + ) diff --git a/protocols.login/src/main/kotlin/de/fiereu/openmmo/net/login/packets/ToSPacket.kt b/protocols.login/src/main/kotlin/de/fiereu/openmmo/net/login/packets/ToSPacket.kt new file mode 100644 index 0000000..7ecc18e --- /dev/null +++ b/protocols.login/src/main/kotlin/de/fiereu/openmmo/net/login/packets/ToSPacket.kt @@ -0,0 +1,38 @@ +package de.fiereu.openmmo.net.login.packets + +import de.fiereu.bytecodec.Codec +import de.fiereu.bytecodec.CodecScope +import de.fiereu.bytecodec.PacketCodec +import de.fiereu.bytecodec.S8 +import de.fiereu.bytecodec.U16LE +import de.fiereu.bytecodec.bytesPrefixed +import de.fiereu.bytecodec.imap +import java.io.ByteArrayInputStream +import java.io.ByteArrayOutputStream +import java.nio.charset.StandardCharsets +import java.util.zip.GZIPInputStream +import java.util.zip.GZIPOutputStream + +data class ToSPacket(val confirmationKey: Byte, val tosText: String) + +private fun gzipDecompress(data: ByteArray): String = + GZIPInputStream(ByteArrayInputStream(data)).use { + String(it.readAllBytes(), StandardCharsets.UTF_8) + } + +private fun gzipCompress(text: String): ByteArray { + val baos = ByteArrayOutputStream() + GZIPOutputStream(baos).use { it.write(text.toByteArray(StandardCharsets.UTF_8)) } + return baos.toByteArray() +} + +private val GzippedTextU16: Codec = + bytesPrefixed(U16LE).imap(decode = ::gzipDecompress, encode = ::gzipCompress) + +object ToSPacketCodec : PacketCodec() { + override fun CodecScope.body(): ToSPacket { + val confirmationKey = field(S8) { it.confirmationKey } + val tosText = field(GzippedTextU16) { it.tosText } + return ToSPacket(confirmationKey, tosText) + } +} diff --git a/protocols.login/src/test/kotlin/de/fiereu/openmmo/net/login/LoginCodecRoundtripTest.kt b/protocols.login/src/test/kotlin/de/fiereu/openmmo/net/login/LoginCodecRoundtripTest.kt new file mode 100644 index 0000000..67d84cb --- /dev/null +++ b/protocols.login/src/test/kotlin/de/fiereu/openmmo/net/login/LoginCodecRoundtripTest.kt @@ -0,0 +1,40 @@ +package de.fiereu.openmmo.net.login + +import de.fiereu.bytecodec.test.decodeBytes +import de.fiereu.bytecodec.test.encodeToBytes +import de.fiereu.openmmo.net.login.packets.JoinGameServerPacket +import de.fiereu.openmmo.net.login.packets.JoinGameServerPacketCodec +import de.fiereu.openmmo.net.login.packets.MfaResponsePacket +import de.fiereu.openmmo.net.login.packets.MfaResponsePacketCodec +import de.fiereu.openmmo.net.login.packets.RequestGameServerListPacket +import de.fiereu.openmmo.net.login.packets.RequestGameServerListPacketCodec +import de.fiereu.openmmo.net.login.packets.ToSConfirmationPacket +import de.fiereu.openmmo.net.login.packets.ToSConfirmationPacketCodec +import io.kotest.core.spec.style.FunSpec +import io.kotest.matchers.shouldBe + +class LoginCodecRoundtripTest : + FunSpec({ + test("RequestGameServerListPacket has no payload") { + RequestGameServerListPacketCodec.encodeToBytes(RequestGameServerListPacket()).size shouldBe + 0 + } + + test("JoinGameServerPacket roundtrips") { + val pkt = JoinGameServerPacket(gameServerId = 0x07u) + val bytes = JoinGameServerPacketCodec.encodeToBytes(pkt) + bytes.size shouldBe 1 + JoinGameServerPacketCodec.decodeBytes(bytes) shouldBe pkt + } + + test("ToSConfirmationPacket roundtrip") { + val pkt = ToSConfirmationPacket(confirmationKey = 1) + ToSConfirmationPacketCodec.decodeBytes( + ToSConfirmationPacketCodec.encodeToBytes(pkt)) shouldBe pkt + } + + test("MfaResponsePacket roundtrips a string") { + val pkt = MfaResponsePacket(mfaCode = "123456") + MfaResponsePacketCodec.decodeBytes(MfaResponsePacketCodec.encodeToBytes(pkt)) shouldBe pkt + } + }) diff --git a/protocols.login/src/test/kotlin/de/fiereu/openmmo/net/login/LoginProtocolTest.kt b/protocols.login/src/test/kotlin/de/fiereu/openmmo/net/login/LoginProtocolTest.kt new file mode 100644 index 0000000..3e4de5e --- /dev/null +++ b/protocols.login/src/test/kotlin/de/fiereu/openmmo/net/login/LoginProtocolTest.kt @@ -0,0 +1,57 @@ +package de.fiereu.openmmo.net.login + +import de.fiereu.network.Direction +import de.fiereu.network.Side +import de.fiereu.openmmo.net.login.packets.ExistingSessionPacket +import de.fiereu.openmmo.net.login.packets.GameServerListPacket +import de.fiereu.openmmo.net.login.packets.GameServerNodesPacket +import de.fiereu.openmmo.net.login.packets.JoinGameServerPacket +import de.fiereu.openmmo.net.login.packets.LoginKickPacket +import de.fiereu.openmmo.net.login.packets.LoginRequestPacket +import de.fiereu.openmmo.net.login.packets.LoginResponsePacket +import de.fiereu.openmmo.net.login.packets.MfaChallengePacket +import de.fiereu.openmmo.net.login.packets.MfaResponsePacket +import de.fiereu.openmmo.net.login.packets.RequestGameServerListPacket +import de.fiereu.openmmo.net.login.packets.SentCredentialsPacket +import de.fiereu.openmmo.net.login.packets.ToSConfirmationPacket +import de.fiereu.openmmo.net.login.packets.ToSPacket +import io.kotest.core.spec.style.FunSpec +import io.kotest.matchers.collections.shouldContainAll +import io.kotest.matchers.shouldBe +import kotlin.reflect.KClass + +class LoginProtocolTest : + FunSpec({ + test("registers every documented opcode pair") { + val expected: List>> = + listOf( + Triple(0x01u, Direction.S2C, LoginResponsePacket::class), + Triple(0x02u, Direction.C2S, RequestGameServerListPacket::class), + Triple(0x03u, Direction.C2S, JoinGameServerPacket::class), + Triple(0x03u, Direction.S2C, GameServerNodesPacket::class), + Triple(0x04u, Direction.C2S, ToSConfirmationPacket::class), + Triple(0x05u, Direction.S2C, LoginKickPacket::class), + Triple(0x07u, Direction.S2C, SentCredentialsPacket::class), + Triple(0x08u, Direction.S2C, MfaChallengePacket::class), + Triple(0x08u, Direction.C2S, MfaResponsePacket::class), + Triple(0x11u, Direction.C2S, LoginRequestPacket::class), + Triple(0x14u, Direction.S2C, ToSPacket::class), + Triple(0x22u, Direction.S2C, GameServerListPacket::class), + Triple(0x26u, Direction.S2C, ExistingSessionPacket::class), + ) + val actual = LoginProtocol.registrations.map { Triple(it.opcode, it.direction, it.type) } + actual shouldContainAll expected + LoginProtocol.registrations.size shouldBe expected.size + } + + test("incoming/outgoing maps resolve per side") { + LoginProtocol.incomingRegistration(Side.SERVER, 0x11u)?.type shouldBe + LoginRequestPacket::class + LoginProtocol.incomingRegistration(Side.CLIENT, 0x01u)?.type shouldBe + LoginResponsePacket::class + LoginProtocol.outgoingRegistration(Side.SERVER, GameServerListPacket::class) + ?.opcode shouldBe 0x22u + LoginProtocol.outgoingRegistration(Side.CLIENT, LoginRequestPacket::class)?.opcode shouldBe + 0x11u + } + }) diff --git a/server.game/.gitignore b/server.game/.gitignore deleted file mode 100644 index 31fce6d..0000000 --- a/server.game/.gitignore +++ /dev/null @@ -1 +0,0 @@ -src/main/resources/game.*.pem \ No newline at end of file diff --git a/server.game/Dockerfile b/server.game/Dockerfile deleted file mode 100644 index ffa16ce..0000000 --- a/server.game/Dockerfile +++ /dev/null @@ -1,61 +0,0 @@ -# Multi-stage build for OpenMMO Game Server -FROM azul/zulu-openjdk:24-latest AS builder - -WORKDIR /app - -# Copy gradle files first for better caching -COPY ./gradle gradle/ -COPY ./gradlew gradlew.bat gradle.properties settings.gradle.kts gradle.env ./ -COPY ./buildSrc buildSrc/ - -# remove all includ("...") from settings.gradle.kts -RUN sed -i '/include(/d' settings.gradle.kts -# manually include only the required modules -RUN echo 'include("common")' >> settings.gradle.kts -RUN echo 'include("keys")' >> settings.gradle.kts -RUN echo 'include("protocol")' >> settings.gradle.kts -RUN echo 'include("protocol.tls")' >> settings.gradle.kts -RUN echo 'include("protocol.game")' >> settings.gradle.kts -RUN echo 'include("server")' >> settings.gradle.kts -RUN echo 'include("server.game")' >> settings.gradle.kts - -# Copy all module build files -COPY ./build.gradle.kts ./ -COPY ./common/build.gradle.kts common/ -COPY ./keys/build.gradle.kts keys/ -COPY ./protocol/build.gradle.kts protocol/ -COPY ./protocol.tls/build.gradle.kts protocol.tls/ -COPY ./protocol.game/build.gradle.kts protocol.game/ -COPY ./server/build.gradle.kts server/ -COPY ./server.game/build.gradle.kts server.game/ - -# Download dependencies -RUN ./gradlew dependencies --no-daemon - -# Copy source code -COPY ./common/src common/src/ -COPY ./protocol/src protocol/src/ -COPY ./protocol.tls/src protocol.tls/src/ -COPY ./protocol.game/src protocol.game/src/ -COPY ./server/src server/src/ -COPY ./server.game/src server.game/src/ - -# Build the application -RUN ./gradlew :server.game:distTar --no-daemon - -# Extract the distribution -RUN cd server.game/build/distributions && \ - tar -xf server.game-*.tar && \ - mv server.game-*/ server.game/ - -# Runtime stage -FROM azul/zulu-openjdk:24-jre-latest - -WORKDIR /app - -# Copy the extracted distribution from builder -COPY --from=builder /app/server.game/build/distributions/server.game/ . - -EXPOSE 2106 - -ENTRYPOINT ["./bin/server.game"] \ No newline at end of file diff --git a/server.game/README.md b/server.game/README.md deleted file mode 100644 index de5169f..0000000 --- a/server.game/README.md +++ /dev/null @@ -1,9 +0,0 @@ -# Server.Game Module - -The server.game module implements the game server for OpenMMO. - -## Development -- Run with: `./gradlew :server.game:run` -- Database setup: `./gradlew cleanMigrateAndGenerate` -- Code generation: `./gradlew jooqCodegen` -- Docker build: `docker build -t openmmo-game server.game/` diff --git a/server.game/build.gradle.kts b/server.game/build.gradle.kts index ef16a8a..2f54a58 100644 --- a/server.game/build.gradle.kts +++ b/server.game/build.gradle.kts @@ -1,123 +1,36 @@ -import org.flywaydb.gradle.task.AbstractFlywayTask - -buildscript { dependencies { classpath(libs.flyway.postgresql) } } - plugins { application - distribution id("buildsrc.convention.kotlin-jvm") id("buildsrc.convention.spotless") + id("buildsrc.convention.sonarlint") id("buildsrc.common.keys") - alias(libs.plugins.kotlin.serialization) - alias(libs.plugins.jooq) - alias(libs.plugins.flyway) + alias(libs.plugins.ksp) } group = "de.fiereu.openmmo" version = "0.1.0" +application { mainClass.set("de.fiereu.openmmo.server.game.MainKt") } + dependencies { - implementation(project(":server")) - implementation(project(":protocol.game")) - implementation(libs.logback) + api(project(":network")) + api(project(":protocols.game")) + api(project(":common")) + api(project(":maps")) + + implementation(libs.dagger) + ksp(libs.dagger.compiler) + + implementation(libs.typesafe.config) implementation(libs.kotlinx.coroutines) + implementation(libs.kotlin.logging) + implementation(libs.logback) testImplementation(libs.bundles.kotest) testImplementation(libs.kotlinx.coroutines.test) - testImplementation(libs.mockk) } -application { mainClass.set("de.fiereu.openmmo.server.game.GameServerKt") } - -fun env(key: String): Any { - val value = - property(key) - ?: System.getenv(key) - ?: throw IllegalArgumentException( - "Environment variable or system property '$key' is not set.") - fun interpolate(value: String): Any { - val PATTERN_WORD = Regex("\\$([a-zA-Z0-9_]+)") - val PATTERN_MULTI = Regex("\\$\\{([a-zA-Z0-9_]+)\\}") - return (PATTERN_WORD.findAll(value) + PATTERN_MULTI.findAll(value)).distinct().fold(value) { - acc, - match -> - val envName = match.groupValues[1] - val envValue = System.getProperty(envName) ?: System.getProperty(envName) - if (envValue == null) { - throw IllegalArgumentException( - "Environment variable or system property '$envName' is not set.") - } - acc.replace(match.value, envValue) - } - } - return if (value is String && (value.contains('$') || value.contains('{'))) { - interpolate(value) - } else value +listOf("classes", "processResources").forEach { taskName -> + tasks.named(taskName) { dependsOn("copyPublicKeyGame", "copyPrivateKeyGame") } } - -val dbPort = env("openmmo.db.game.port") as String -val dbName = env("openmmo.db.game.name") as String -val dbUser = env("openmmo.db.game.user") as String -val dbPassword = env("openmmo.db.game.password") as String - -jooq { - configuration { - jdbc { - driver = "org.postgresql.Driver" - url = "jdbc:postgresql://localhost:$dbPort/$dbName" - user = dbUser - password = dbPassword - } - generator { - database { - name = "org.jooq.meta.postgres.PostgresDatabase" - includes = ".*" - excludes = - """ - flyway_schema_history | - pgp_armor_headers - """ - inputSchema = "public" - } - - generate { name = "org.jooq.codegen.KotlinGenerator" } - target { - packageName = "de.fiereu.openmmo.server.game.jooq" - directory = "src/main/jooq" - } - } - } -} - -flyway { - driver = "org.postgresql.Driver" - url = "jdbc:postgresql://localhost:$dbPort/$dbName" - user = dbUser - password = dbPassword - schemas = arrayOf("public") - locations = arrayOf("filesystem:src/main/resources/db/migration") - cleanDisabled = false -} - -// Fuck this shit uhh we are not gonna update our gradle plugin bc all our enterprise customers are -// stuck on Java 1.6 and gradle 5 anyway -tasks.withType().configureEach { - notCompatibleWithConfigurationCache("https://github.com/flyway/flyway/issues/3550") -} - -tasks.register("cleanMigrateAndGenerate") { - group = "openmmo" - description = "Cleans the database, migrates it and generates the jOOQ classes." - dependsOn("flywayClean", "flywayMigrate", "jooqCodegen") -} - -spotless { kotlin { targetExclude("src/main/jooq/**") } } - -// If someone knows a better way then this please please please help me :( -listOf("classes", "processResources", "spotlessKotlin", "spotlessKotlinGradle", "spotlessMisc") - .forEach { taskName -> - tasks.named(taskName) { - listOf("copyPublicKeyGame", "copyPrivateKeyGame").forEach { dependsOn(it) } - } - } diff --git a/server.game/src/main/kotlin/de/fiereu/openmmo/server/game/GameServer.kt b/server.game/src/main/kotlin/de/fiereu/openmmo/server/game/GameServer.kt index 8430e70..34fb777 100644 --- a/server.game/src/main/kotlin/de/fiereu/openmmo/server/game/GameServer.kt +++ b/server.game/src/main/kotlin/de/fiereu/openmmo/server/game/GameServer.kt @@ -1,30 +1,78 @@ package de.fiereu.openmmo.server.game -import de.fiereu.openmmo.protocols.game.GameServerProtocol -import de.fiereu.openmmo.server.ServerBuilder -import de.fiereu.openmmo.server.config.ServerConfig -import de.fiereu.openmmo.server.config.TlsConfig -import de.fiereu.openmmo.server.game.protocol.game.GameProtocolHandler -import de.fiereu.openmmo.server.io.resource -import de.fiereu.openmmo.server.keys.KeyLoader -import kotlinx.coroutines.CoroutineScope -import kotlinx.coroutines.Dispatchers -import kotlinx.coroutines.SupervisorJob +import de.fiereu.network.PipelineNames +import de.fiereu.network.PipelineOptions +import de.fiereu.network.SessionIdentity +import de.fiereu.network.installPipeline +import de.fiereu.network.session +import de.fiereu.openmmo.net.game.GameProtocol +import de.fiereu.openmmo.server.game.config.GameServerConfig +import de.fiereu.openmmo.server.game.handler.GameAppHandler +import de.fiereu.openmmo.server.game.session.SessionRegistry +import de.fiereu.openmmo.server.game.session.SessionRegistryHandler +import io.github.oshai.kotlinlogging.KotlinLogging +import io.netty.bootstrap.ServerBootstrap +import io.netty.channel.Channel +import io.netty.channel.ChannelInitializer +import io.netty.channel.ChannelOption +import io.netty.channel.EventLoopGroup +import io.netty.channel.socket.nio.NioServerSocketChannel +import java.security.interfaces.ECPrivateKey +import javax.inject.Inject +import javax.inject.Named +import javax.inject.Provider +import javax.inject.Singleton -fun main() { - val serverConfig = ServerConfig(port = 7777) - val tlsConfig = TlsConfig(checksumSize = 2) - val coroutineScope = CoroutineScope(SupervisorJob() + Dispatchers.Default) - val server = - ServerBuilder.create() - .withCoroutineScope(coroutineScope) - .withConfig(serverConfig) - .withTlsConfig(tlsConfig) - .withPublicKey(KeyLoader.loadPemECPublicKey(resource("game.public.pem"))) - .withPrivateKey(KeyLoader.loadPemECPrivateKey(resource("game.private.pem"))) - .withChannelHandlerProvider { - GameProtocolHandler(GameServerProtocol(), serverConfig, coroutineScope) - } - .build() - server.start() +private val log = KotlinLogging.logger {} + +@Singleton +class GameServer +@Inject +constructor( + private val config: GameServerConfig, + @Named("boss") private val bossGroup: EventLoopGroup, + @Named("worker") private val workerGroup: EventLoopGroup, + private val rootKey: ECPrivateKey, + private val handlerProvider: Provider, + private val sessionRegistry: SessionRegistry, +) { + fun start() { + val channel = + ServerBootstrap() + .group(bossGroup, workerGroup) + .channel(NioServerSocketChannel::class.java) + .option(ChannelOption.SO_BACKLOG, 128) + .childOption(ChannelOption.TCP_NODELAY, true) + .childHandler( + object : ChannelInitializer() { + override fun initChannel(ch: Channel) { + installPipeline( + pipeline = ch.pipeline(), + side = de.fiereu.network.Side.SERVER, + identity = SessionIdentity.ServerRoot(rootKey), + applicationProtocol = GameProtocol, + applicationHandlerFactory = { handlerProvider.get() }, + options = PipelineOptions(checksumSize = config.checksumSize), + ) + val session = ch.session() ?: error("session missing after installPipeline") + ch.pipeline() + .addAfter( + PipelineNames.PROTOCOL_HANDLER, + "session-registry", + SessionRegistryHandler(sessionRegistry, session), + ) + } + }, + ) + .bind(config.host, config.port) + .sync() + .channel() + log.info { "Game server listening on ${channel.localAddress()}" } + channel.closeFuture().sync() + } + + fun shutdown() { + workerGroup.shutdownGracefully() + bossGroup.shutdownGracefully() + } } diff --git a/server.game/src/main/kotlin/de/fiereu/openmmo/server/game/Main.kt b/server.game/src/main/kotlin/de/fiereu/openmmo/server/game/Main.kt new file mode 100644 index 0000000..65cefc3 --- /dev/null +++ b/server.game/src/main/kotlin/de/fiereu/openmmo/server/game/Main.kt @@ -0,0 +1,10 @@ +package de.fiereu.openmmo.server.game + +import de.fiereu.openmmo.server.game.config.ConfigLoader +import de.fiereu.openmmo.server.game.di.DaggerGameServerComponent + +fun main() { + val config = ConfigLoader.load() + val component = DaggerGameServerComponent.factory().create(config) + component.server().start() +} diff --git a/server.game/src/main/kotlin/de/fiereu/openmmo/server/game/config/ConfigLoader.kt b/server.game/src/main/kotlin/de/fiereu/openmmo/server/game/config/ConfigLoader.kt new file mode 100644 index 0000000..24e2109 --- /dev/null +++ b/server.game/src/main/kotlin/de/fiereu/openmmo/server/game/config/ConfigLoader.kt @@ -0,0 +1,18 @@ +package de.fiereu.openmmo.server.game.config + +import com.typesafe.config.ConfigFactory + +object ConfigLoader { + fun load(): GameServerConfig { + val config = ConfigFactory.load() + val secret = config.getString("server.sessionSecret") + require(secret.isNotEmpty()) { "server.sessionSecret must not be empty" } + return GameServerConfig( + host = config.getString("server.host"), + port = config.getInt("server.port"), + checksumSize = config.getInt("server.checksumSize"), + rootKeyResource = config.getString("server.rootKeyResource"), + sessionSecret = secret.toByteArray(Charsets.UTF_8), + ) + } +} diff --git a/server.game/src/main/kotlin/de/fiereu/openmmo/server/game/config/GameServerConfig.kt b/server.game/src/main/kotlin/de/fiereu/openmmo/server/game/config/GameServerConfig.kt new file mode 100644 index 0000000..f29065c --- /dev/null +++ b/server.game/src/main/kotlin/de/fiereu/openmmo/server/game/config/GameServerConfig.kt @@ -0,0 +1,26 @@ +package de.fiereu.openmmo.server.game.config + +data class GameServerConfig( + val host: String, + val port: Int, + val checksumSize: Int, + val rootKeyResource: String, + val sessionSecret: ByteArray, +) { + override fun equals(other: Any?): Boolean = + other is GameServerConfig && + host == other.host && + port == other.port && + checksumSize == other.checksumSize && + rootKeyResource == other.rootKeyResource && + sessionSecret.contentEquals(other.sessionSecret) + + override fun hashCode(): Int { + var h = host.hashCode() + h = h * 31 + port + h = h * 31 + checksumSize + h = h * 31 + rootKeyResource.hashCode() + h = h * 31 + sessionSecret.contentHashCode() + return h + } +} diff --git a/server.game/src/main/kotlin/de/fiereu/openmmo/server/game/di/GameServerComponent.kt b/server.game/src/main/kotlin/de/fiereu/openmmo/server/game/di/GameServerComponent.kt new file mode 100644 index 0000000..58b4eef --- /dev/null +++ b/server.game/src/main/kotlin/de/fiereu/openmmo/server/game/di/GameServerComponent.kt @@ -0,0 +1,26 @@ +package de.fiereu.openmmo.server.game.di + +import dagger.BindsInstance +import dagger.Component +import de.fiereu.openmmo.server.game.GameServer +import de.fiereu.openmmo.server.game.config.GameServerConfig +import de.fiereu.openmmo.server.game.handler.GameAppHandler +import de.fiereu.openmmo.server.game.session.SessionRegistry +import javax.inject.Provider +import javax.inject.Singleton + +@Singleton +@Component(modules = [GameServerModule::class]) +interface GameServerComponent { + + fun server(): GameServer + + fun handlerProvider(): Provider + + fun sessionRegistry(): SessionRegistry + + @Component.Factory + fun interface Factory { + fun create(@BindsInstance config: GameServerConfig): GameServerComponent + } +} diff --git a/server.game/src/main/kotlin/de/fiereu/openmmo/server/game/di/GameServerModule.kt b/server.game/src/main/kotlin/de/fiereu/openmmo/server/game/di/GameServerModule.kt new file mode 100644 index 0000000..2cf66aa --- /dev/null +++ b/server.game/src/main/kotlin/de/fiereu/openmmo/server/game/di/GameServerModule.kt @@ -0,0 +1,45 @@ +package de.fiereu.openmmo.server.game.di + +import dagger.Module +import dagger.Provides +import de.fiereu.openmmo.common.auth.SessionTokenVerifier +import de.fiereu.openmmo.common.io.PemKeyLoader +import de.fiereu.openmmo.common.io.resource +import de.fiereu.openmmo.server.game.config.GameServerConfig +import io.netty.channel.EventLoopGroup +import io.netty.channel.MultiThreadIoEventLoopGroup +import io.netty.channel.nio.NioIoHandler +import java.security.interfaces.ECPrivateKey +import javax.inject.Named +import javax.inject.Singleton +import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.SupervisorJob + +@Module +object GameServerModule { + + @Provides + @Singleton + fun rootKey(config: GameServerConfig): ECPrivateKey = + PemKeyLoader.loadEcPrivate(resource(config.rootKeyResource)) + + @Provides + @Singleton + fun tokenVerifier(config: GameServerConfig): SessionTokenVerifier = + SessionTokenVerifier(config.sessionSecret) + + @Provides + @Singleton + @Named("boss") + fun bossGroup(): EventLoopGroup = MultiThreadIoEventLoopGroup(1, NioIoHandler.newFactory()) + + @Provides + @Singleton + @Named("worker") + fun workerGroup(): EventLoopGroup = MultiThreadIoEventLoopGroup(0, NioIoHandler.newFactory()) + + @Provides + @Singleton + fun coroutineScope(): CoroutineScope = CoroutineScope(SupervisorJob() + Dispatchers.Default) +} diff --git a/server.game/src/main/kotlin/de/fiereu/openmmo/server/game/handler/GameAppHandler.kt b/server.game/src/main/kotlin/de/fiereu/openmmo/server/game/handler/GameAppHandler.kt new file mode 100644 index 0000000..648a7a1 --- /dev/null +++ b/server.game/src/main/kotlin/de/fiereu/openmmo/server/game/handler/GameAppHandler.kt @@ -0,0 +1,104 @@ +package de.fiereu.openmmo.server.game.handler + +import de.fiereu.network.PacketEvent +import de.fiereu.network.Side +import de.fiereu.network.coroutines.CoroutineProtocolHandler +import de.fiereu.openmmo.common.enums.ChatType +import de.fiereu.openmmo.common.enums.Language +import de.fiereu.openmmo.net.game.GameProtocol +import de.fiereu.openmmo.net.game.packets.ChatMessagePacket +import de.fiereu.openmmo.net.game.packets.CreateCharacterPacket +import de.fiereu.openmmo.net.game.packets.DialogChoicePacket +import de.fiereu.openmmo.net.game.packets.EntityInteractPacket +import de.fiereu.openmmo.net.game.packets.EntityLeavePacket +import de.fiereu.openmmo.net.game.packets.FaceDirectionPacket +import de.fiereu.openmmo.net.game.packets.InteractiveResponsePacket +import de.fiereu.openmmo.net.game.packets.JoinPacket +import de.fiereu.openmmo.net.game.packets.KeepAlivePacket +import de.fiereu.openmmo.net.game.packets.MovementPacket +import de.fiereu.openmmo.net.game.packets.RequestCharactersPacket +import de.fiereu.openmmo.net.game.packets.RequestPlayerPacket +import de.fiereu.openmmo.net.game.packets.SelectCharacterPacket +import de.fiereu.openmmo.server.game.services.DialogService +import de.fiereu.openmmo.server.game.services.InteractionService +import de.fiereu.openmmo.server.game.services.LoginService +import de.fiereu.openmmo.server.game.services.MovementService +import de.fiereu.openmmo.server.game.services.MultiplayerService +import de.fiereu.openmmo.server.game.session.PLAYER_STATE +import de.fiereu.openmmo.server.game.session.SessionRegistry +import de.fiereu.openmmo.server.game.storage.CharacterStore +import io.github.oshai.kotlinlogging.KotlinLogging +import javax.inject.Inject +import kotlinx.coroutines.CoroutineScope + +private val log = KotlinLogging.logger {} + +class GameAppHandler +@Inject +constructor( + private val loginService: LoginService, + private val movementService: MovementService, + private val dialogService: DialogService, + private val interactionService: InteractionService, + private val multiplayerService: MultiplayerService, + private val sessionRegistry: SessionRegistry, + private val characterStore: CharacterStore, + scope: CoroutineScope, +) : CoroutineProtocolHandler(GameProtocol, Side.SERVER, scope) { + + init { + onSuspend { event -> loginService.onJoinGame(event) } + onSuspend { event -> loginService.onCreateCharacter(event) } + onSuspend { event -> loginService.onCharacterRequest(event) } + onSuspend { event -> loginService.onCharacterSelected(event) } + onSuspend { event -> loginService.onRequestPlayer(event) } + + onSuspend { event -> movementService.onMovement(event) } + onSuspend { event -> movementService.onFaceDirection(event) } + + onSuspend { event -> interactionService.onEntityInteract(event) } + onSuspend { event -> dialogService.onInteractive(event) } + onSuspend { event -> dialogService.onDialogChoice(event) } + + on { event -> event.session.send(event.packet) } + on { event -> onChatMessage(event) } + } + + override fun onInactive() { + val state = session.attributes[PLAYER_STATE] ?: return + log.info { "Player ${state.characterId} disconnected." } + val charId = state.characterId + if (charId != null) { + multiplayerService.broadcastExcept(session, EntityLeavePacket(charId)) + sessionRegistry.unbindCharacter(charId) + } + multiplayerService.broadcastMessage( + ChatMessagePacket( + type = ChatType.GAME_NOTIFICATIONS, + language = Language.EN, + message = "A player left the game.", + sender = "", + ), + ) + } + + private fun onChatMessage(event: PacketEvent) { + val state = event.session.attributes[PLAYER_STATE] + if (state == null) { + log.warn { "Chat message from session without PlayerState" } + return + } + val charId = state.characterId ?: return + val sender = characterStore.getCharacter(charId)?.info?.name ?: "Unknown" + val msg = event.packet + log.info { "Chat [${msg.type}] $sender: ${msg.message}" } + multiplayerService.broadcastMessage( + ChatMessagePacket( + type = msg.type, + language = msg.language, + message = msg.message, + sender = sender, + ), + ) + } +} diff --git a/server.game/src/main/kotlin/de/fiereu/openmmo/server/game/protocol/game/GameProtocolHandler.kt b/server.game/src/main/kotlin/de/fiereu/openmmo/server/game/protocol/game/GameProtocolHandler.kt deleted file mode 100644 index e590093..0000000 --- a/server.game/src/main/kotlin/de/fiereu/openmmo/server/game/protocol/game/GameProtocolHandler.kt +++ /dev/null @@ -1,140 +0,0 @@ -package de.fiereu.openmmo.server.game.protocol.game - -import de.fiereu.openmmo.common.enums.ChatType -import de.fiereu.openmmo.common.enums.Language -import de.fiereu.openmmo.protocols.Protocol -import de.fiereu.openmmo.protocols.game.packets.ChatMessagePacket -import de.fiereu.openmmo.protocols.game.packets.CreateCharacterPacket -import de.fiereu.openmmo.protocols.game.packets.DialogChoicePacket -import de.fiereu.openmmo.protocols.game.packets.EntityInteractPacket -import de.fiereu.openmmo.protocols.game.packets.EntityLeavePacket -import de.fiereu.openmmo.protocols.game.packets.FaceDirectionPacket -import de.fiereu.openmmo.protocols.game.packets.InteractiveResponsePacket -import de.fiereu.openmmo.protocols.game.packets.JoinGamePacket -import de.fiereu.openmmo.protocols.game.packets.KeepAlivePacket -import de.fiereu.openmmo.protocols.game.packets.MovementPacket -import de.fiereu.openmmo.protocols.game.packets.RequestCharactersPacket -import de.fiereu.openmmo.protocols.game.packets.RequestPlayerPacket -import de.fiereu.openmmo.protocols.game.packets.SelectCharacterPacket -import de.fiereu.openmmo.server.config.ServerConfig -import de.fiereu.openmmo.server.game.services.DialogService -import de.fiereu.openmmo.server.game.services.InteractionService -import de.fiereu.openmmo.server.game.services.LoginService -import de.fiereu.openmmo.server.game.services.MapLoadService -import de.fiereu.openmmo.server.game.services.MovementService -import de.fiereu.openmmo.server.game.services.MultiplayerService -import de.fiereu.openmmo.server.game.services.NpcService -import de.fiereu.openmmo.server.game.services.PacketSender -import de.fiereu.openmmo.server.game.services.WarpService -import de.fiereu.openmmo.server.game.session.SessionManager -import de.fiereu.openmmo.server.game.storage.CharacterStore -import de.fiereu.openmmo.server.netty.handlers.ProtocolHandler -import de.fiereu.openmmo.server.protocol.PacketEvent -import de.fiereu.openmmo.server.protocol.respond -import io.github.oshai.kotlinlogging.KotlinLogging -import io.netty.channel.ChannelHandlerContext -import kotlinx.coroutines.CoroutineScope -import kotlinx.coroutines.launch - -private val log = KotlinLogging.logger {} - -class GameProtocolHandler( - protocol: Protocol, - serverConfig: ServerConfig, - private val coroutineScope: CoroutineScope, -) : ProtocolHandler(protocol, serverConfig) { - - private val packetSender = PacketSender(compressor) - private val mapLoadService = MapLoadService(packetSender) - private val warpService = WarpService(mapLoadService) - private val npcService = NpcService() - private val multiplayerService = MultiplayerService() - private val movementService = - MovementService(warpService, mapLoadService, npcService, multiplayerService) - private val dialogService = DialogService(packetSender) - private val interactionService = InteractionService(npcService, dialogService, packetSender) - private val loginService = - LoginService(mapLoadService, npcService, multiplayerService, packetSender) - - override fun onActive(ctx: ChannelHandlerContext) { - log.info { "Client ${ctx.channel().remoteAddress()} connected to game server." } - } - - override fun channelInactive(ctx: ChannelHandlerContext) { - val session = SessionManager.getSessionByChannel(ctx.channel()) - if (session != null) { - log.info { "Player ${session.characterId} disconnected." } - - session.characterId?.let { charId -> - multiplayerService.broadcastExcept(ctx.channel(), EntityLeavePacket(charId)) - } - - multiplayerService.broadcastMessage( - ChatMessagePacket( - ChatType.GAME_NOTIFICATIONS, - Language.EN, - "A player left the game.", - "", - )) - SessionManager.removeSession(ctx.channel()) - } - super.channelInactive(ctx) - } - - @Suppress("unchecked_cast") - override fun onPacketReceived(event: PacketEvent<*>) { - coroutineScope.launch { - when (event.packet) { - is JoinGamePacket -> loginService.onJoinGame(event as PacketEvent) - is CreateCharacterPacket -> - loginService.onCreateCharacter(event as PacketEvent) - is RequestCharactersPacket -> - loginService.onCharacterRequest(event as PacketEvent) - is SelectCharacterPacket -> - loginService.onCharacterSelected(event as PacketEvent) - is RequestPlayerPacket -> - loginService.onRequestPlayer(event as PacketEvent) - is MovementPacket -> movementService.onMovement(event as PacketEvent) - is FaceDirectionPacket -> - movementService.onFaceDirection(event as PacketEvent) - is KeepAlivePacket -> onKeepAlive(event as PacketEvent) - is EntityInteractPacket -> - interactionService.onEntityInteract(event as PacketEvent) - is InteractiveResponsePacket -> - dialogService.onInteractive(event as PacketEvent) - is DialogChoicePacket -> - dialogService.onDialogChoice(event as PacketEvent) - is ChatMessagePacket -> onChatMessage(event as PacketEvent) - else -> log.warn { "Unhandled game packet type: ${event.packet::class.simpleName}" } - } - } - } - - private fun onKeepAlive(event: PacketEvent) { - event.respond(event.packet) - } - - private fun onChatMessage(event: PacketEvent) { - val msg = event.packet - val sender = SessionManager.getSessionByChannel(event.ctx.channel()) - - if (sender == null) { - log.warn { "Chat message from unknown sender" } - return - } - - val charId = sender.characterId ?: return - val stored = CharacterStore.getCharacter(charId) - val senderName = stored?.info?.name ?: "Unknown" - - log.info { "Chat [${msg.type}] $senderName: ${msg.message}" } - - multiplayerService.broadcastMessage( - ChatMessagePacket( - type = msg.type, - language = msg.language, - message = msg.message, - sender = senderName, - )) - } -} diff --git a/server.game/src/main/kotlin/de/fiereu/openmmo/server/game/protocol/game/ext/JoinGameResponsePacketExtension.kt b/server.game/src/main/kotlin/de/fiereu/openmmo/server/game/protocol/game/ext/JoinGameResponsePacketExtension.kt deleted file mode 100644 index 0581c67..0000000 --- a/server.game/src/main/kotlin/de/fiereu/openmmo/server/game/protocol/game/ext/JoinGameResponsePacketExtension.kt +++ /dev/null @@ -1,16 +0,0 @@ -package de.fiereu.openmmo.server.game.protocol.game.ext - -import de.fiereu.openmmo.protocols.game.packets.JoinGamePacket -import de.fiereu.openmmo.protocols.game.packets.builders.JoinResponsePacketBuilder -import de.fiereu.openmmo.server.protocol.PacketEvent -import de.fiereu.openmmo.server.protocol.respond - -fun PacketEvent.reject() { - this.respond(JoinResponsePacketBuilder.reject()) -} - -fun PacketEvent.accept() = JoinResponsePacketBuilder.accept() - -fun JoinResponsePacketBuilder.buildAndRespond(event: PacketEvent) { - event.respond(this.build()) -} diff --git a/server.game/src/main/kotlin/de/fiereu/openmmo/server/game/services/DialogService.kt b/server.game/src/main/kotlin/de/fiereu/openmmo/server/game/services/DialogService.kt index ff32ded..fc26d70 100644 --- a/server.game/src/main/kotlin/de/fiereu/openmmo/server/game/services/DialogService.kt +++ b/server.game/src/main/kotlin/de/fiereu/openmmo/server/game/services/DialogService.kt @@ -1,20 +1,21 @@ package de.fiereu.openmmo.server.game.services -import de.fiereu.openmmo.protocols.game.packets.DialogChoicePacket -import de.fiereu.openmmo.protocols.game.packets.DialogStatePacket -import de.fiereu.openmmo.protocols.game.packets.InteractiveResponsePacket +import de.fiereu.network.PacketEvent +import de.fiereu.network.SessionContext +import de.fiereu.openmmo.net.game.packets.DialogChoicePacket +import de.fiereu.openmmo.net.game.packets.DialogStatePacket +import de.fiereu.openmmo.net.game.packets.InteractivePacket +import de.fiereu.openmmo.net.game.packets.InteractiveResponsePacket +import de.fiereu.openmmo.server.game.session.PLAYER_STATE import de.fiereu.openmmo.server.game.session.ScriptPage -import de.fiereu.openmmo.server.game.session.SessionManager -import de.fiereu.openmmo.server.protocol.PacketEvent import io.github.oshai.kotlinlogging.KotlinLogging -import io.netty.buffer.Unpooled -import io.netty.channel.ChannelHandlerContext +import javax.inject.Inject +import javax.inject.Singleton private val log = KotlinLogging.logger {} -class DialogService( - private val packetSender: PacketSender, -) { +@Singleton +class DialogService @Inject constructor() { fun scriptParams(script: String): List? { if (script == "0x0") return null @@ -42,7 +43,7 @@ class DialogService( } fun sendInteractive( - ctx: ChannelHandlerContext, + ctx: SessionContext, id: Int, entityId: Long, type: Int = 0x04, @@ -50,64 +51,60 @@ class DialogService( unk2: Int = 0x1F10, unk3: Int = 0x0708, ) { - val buf = Unpooled.buffer(19) - buf.writeByte(id) - buf.writeByte(type) - buf.writeShortLE(unk1) - buf.writeShortLE(unk2) - buf.writeLongLE(entityId) - buf.writeShortLE(unk3) - buf.writeShortLE(0) - buf.writeByte(0) - val raw = ByteArray(buf.readableBytes()) - buf.readBytes(raw) - buf.release() - packetSender.sendRaw(ctx, 0x21u, raw) + ctx.send( + InteractivePacket( + id = id, + type = type, + unk1 = unk1, + unk2 = unk2, + targetEntityId = entityId, + unk3 = unk3, + unk4 = 0, + )) } fun onInteractive(event: PacketEvent) { - val session = SessionManager.getSessionByChannel(event.ctx.channel()) - if (session == null) return - val charId = session.characterId ?: return + val ctx = event.session + val state = ctx.attributes[PLAYER_STATE] ?: return + val charId = state.characterId ?: return - if (session.inDialog) { + if (state.inDialog) { val respId = event.packet.id log.info { - "Interactive response: id=$respId for char $charId (page ${session.dialogPageIndex + 1}/${session.dialogPages.size})" + "Interactive response: id=$respId for char $charId (page ${state.dialogPageIndex + 1}/${state.dialogPages.size})" } - val nextPageIndex = session.dialogPageIndex + 1 - if (nextPageIndex < session.dialogPages.size) { - val seqId = session.dialogSeqId++ - val page = session.dialogPages[nextPageIndex] - session.dialogPageIndex = nextPageIndex + val nextPageIndex = state.dialogPageIndex + 1 + if (nextPageIndex < state.dialogPages.size) { + val seqId = state.dialogSeqId++ + val page = state.dialogPages[nextPageIndex] + state.dialogPageIndex = nextPageIndex sendInteractive( - event.ctx, + ctx, seqId, - session.dialogNpcEntityId, + state.dialogNpcEntityId, page.type, page.unk1, page.unk2, page.unk3, ) - event.ctx.channel().flush() } else { - event.ctx.channel().writeAndFlush(DialogStatePacket(false)) - session.inDialog = false - session.dialogNpcEntityId = 0 - session.dialogPages = emptyList() - session.dialogPageIndex = 0 + ctx.send(DialogStatePacket(false)) + state.inDialog = false + state.dialogNpcEntityId = 0 + state.dialogPages = emptyList() + state.dialogPageIndex = 0 } } } fun onDialogChoice(event: PacketEvent) { - val session = SessionManager.getSessionByChannel(event.ctx.channel()) - if (session == null) return + val ctx = event.session + val state = ctx.attributes[PLAYER_STATE] ?: return log.info { "Dialog choice received: unk1=${event.packet.unk1}, unk2=${event.packet.unk2}" } - if (session.inDialog) { - event.ctx.channel().writeAndFlush(DialogStatePacket(false)) - session.inDialog = false - session.dialogNpcEntityId = 0 + if (state.inDialog) { + ctx.send(DialogStatePacket(false)) + state.inDialog = false + state.dialogNpcEntityId = 0 } } } diff --git a/server.game/src/main/kotlin/de/fiereu/openmmo/server/game/services/InteractionService.kt b/server.game/src/main/kotlin/de/fiereu/openmmo/server/game/services/InteractionService.kt index 42d5e3a..d05ba23 100644 --- a/server.game/src/main/kotlin/de/fiereu/openmmo/server/game/services/InteractionService.kt +++ b/server.game/src/main/kotlin/de/fiereu/openmmo/server/game/services/InteractionService.kt @@ -1,39 +1,42 @@ package de.fiereu.openmmo.server.game.services +import de.fiereu.network.PacketEvent import de.fiereu.openmmo.common.enums.Direction -import de.fiereu.openmmo.protocols.game.packets.DialogStatePacket -import de.fiereu.openmmo.protocols.game.packets.EntityInteractPacket -import de.fiereu.openmmo.server.game.session.SessionManager +import de.fiereu.openmmo.maps.MapManager +import de.fiereu.openmmo.net.game.packets.DialogStatePacket +import de.fiereu.openmmo.net.game.packets.EntityInteractPacket +import de.fiereu.openmmo.server.game.session.PLAYER_STATE import de.fiereu.openmmo.server.game.storage.CharacterStore -import de.fiereu.openmmo.server.game.world.MapManager -import de.fiereu.openmmo.server.protocol.PacketEvent import io.github.oshai.kotlinlogging.KotlinLogging -import io.netty.buffer.Unpooled +import javax.inject.Inject +import javax.inject.Singleton private val log = KotlinLogging.logger {} -class InteractionService( +@Singleton +class InteractionService +@Inject +constructor( private val npcService: NpcService, private val dialogService: DialogService, - private val packetSender: PacketSender, + private val mapManager: MapManager, + private val characterStore: CharacterStore, ) { fun onEntityInteract(event: PacketEvent) { - val session = SessionManager.getSessionByChannel(event.ctx.channel()) - if (session == null) return - val charId = session.characterId ?: return + val ctx = event.session + val state = ctx.attributes[PLAYER_STATE] ?: return + val charId = state.characterId ?: return val npcEntityId = event.packet.entityId - val stored = CharacterStore.getCharacter(charId) ?: return + val stored = characterStore.getCharacter(charId) ?: return val currentMap = - MapManager.getMap( + mapManager.getMap( stored.info.positionRegionId, stored.info.positionBankId, stored.info.positionMapId, - ) - if (currentMap == null) return + ) ?: return - // Find which NPC this entityId belongs to val bankId = stored.info.positionBankId.toInt() val mapId = stored.info.positionMapId.toInt() for (npc in currentMap.npcs) { @@ -46,25 +49,15 @@ class InteractionService( if (npc.script != "0x0") { val params = dialogService.scriptParams(npc.script) if (params != null) { - log.info { - "NPC entityIdx=${npc.entityIdx} script=${npc.script} — starting dialog (${params.size} pages)" - } - session.inDialog = true - session.dialogNpcEntityId = npcEntityId - session.dialogPages = params - session.dialogPageIndex = 0 - val seqId = session.dialogSeqId++ + state.inDialog = true + state.dialogNpcEntityId = npcEntityId + state.dialogPages = params + state.dialogPageIndex = 0 + val seqId = state.dialogSeqId++ val page = params[0] - event.ctx.channel().write(DialogStatePacket(true)) - val confirmBuf = Unpooled.buffer(9) - confirmBuf.writeLongLE(npcEntityId) - confirmBuf.writeByte(0xFF) - val confirmBytes = ByteArray(9) - confirmBuf.readBytes(confirmBytes) - confirmBuf.release() - packetSender.sendRaw(event.ctx, 0x07u, confirmBytes) + ctx.send(DialogStatePacket(true)) dialogService.sendInteractive( - event.ctx, + ctx, seqId, npcEntityId, page.type, @@ -72,61 +65,45 @@ class InteractionService( page.unk2, page.unk3, ) - event.ctx.channel().flush() - } else { - log.info { "NPC entityIdx=${npc.entityIdx} script=${npc.script} — no known params" } } - } else { - log.info { "NPC entityIdx=${npc.entityIdx} has no script (0x0) — no interaction" } } return } } - // No NPC found — check for bg_event at tile player is facing val facingX = - when (session.facingDirection) { + when (state.facingDirection) { Direction.RIGHT -> stored.info.positionX.toInt() + 1 Direction.LEFT -> stored.info.positionX.toInt() - 1 else -> stored.info.positionX.toInt() } val facingY = - when (session.facingDirection) { + when (state.facingDirection) { Direction.UP -> stored.info.positionY.toInt() - 1 Direction.DOWN -> stored.info.positionY.toInt() + 1 else -> stored.info.positionY.toInt() } val facingDirOk: (String) -> Boolean = { dir -> dir == "BG_EVENT_PLAYER_FACING_ANY" || - (dir == "BG_EVENT_PLAYER_FACING_NORTH" && session.facingDirection == Direction.UP) || - (dir == "BG_EVENT_PLAYER_FACING_SOUTH" && session.facingDirection == Direction.DOWN) || - (dir == "BG_EVENT_PLAYER_FACING_WEST" && session.facingDirection == Direction.LEFT) || - (dir == "BG_EVENT_PLAYER_FACING_EAST" && session.facingDirection == Direction.RIGHT) + (dir == "BG_EVENT_PLAYER_FACING_NORTH" && state.facingDirection == Direction.UP) || + (dir == "BG_EVENT_PLAYER_FACING_SOUTH" && state.facingDirection == Direction.DOWN) || + (dir == "BG_EVENT_PLAYER_FACING_WEST" && state.facingDirection == Direction.LEFT) || + (dir == "BG_EVENT_PLAYER_FACING_EAST" && state.facingDirection == Direction.RIGHT) } val bgEvent = currentMap.bgEvents.find { it.x == facingX && it.y == facingY && facingDirOk(it.facingDir) } if (bgEvent != null) { val params = dialogService.scriptParams(bgEvent.script) if (params != null) { - log.info { - "BG event script=${bgEvent.script} at ($facingX,$facingY) — starting dialog (${params.size} pages)" - } - session.inDialog = true - session.dialogNpcEntityId = npcEntityId - session.dialogPages = params - session.dialogPageIndex = 0 - val seqId = session.dialogSeqId++ + state.inDialog = true + state.dialogNpcEntityId = npcEntityId + state.dialogPages = params + state.dialogPageIndex = 0 + val seqId = state.dialogSeqId++ val page = params[0] - event.ctx.channel().write(DialogStatePacket(true)) - val confirmBuf = Unpooled.buffer(9) - confirmBuf.writeLongLE(npcEntityId) - confirmBuf.writeByte(0xFF) - val confirmBytes = ByteArray(9) - confirmBuf.readBytes(confirmBytes) - confirmBuf.release() - packetSender.sendRaw(event.ctx, 0x07u, confirmBytes) + ctx.send(DialogStatePacket(true)) dialogService.sendInteractive( - event.ctx, + ctx, seqId, npcEntityId, page.type, @@ -134,15 +111,10 @@ class InteractionService( page.unk2, page.unk3, ) - event.ctx.channel().flush() - } else { - log.info { - "BG event interaction: script=${bgEvent.script} at ($facingX,$facingY) — no known params" - } } return } - log.info { "Entity interaction for entity $npcEntityId — not found on current map" } + log.info { "Entity interaction for entity $npcEntityId not found on current map" } } } diff --git a/server.game/src/main/kotlin/de/fiereu/openmmo/server/game/services/LoginService.kt b/server.game/src/main/kotlin/de/fiereu/openmmo/server/game/services/LoginService.kt index 7dfd3f9..8ac9f93 100644 --- a/server.game/src/main/kotlin/de/fiereu/openmmo/server/game/services/LoginService.kt +++ b/server.game/src/main/kotlin/de/fiereu/openmmo/server/game/services/LoginService.kt @@ -1,84 +1,99 @@ package de.fiereu.openmmo.server.game.services +import de.fiereu.network.PacketEvent +import de.fiereu.network.SessionContext +import de.fiereu.openmmo.common.CharacterInfo +import de.fiereu.openmmo.common.Pokemon import de.fiereu.openmmo.common.enums.ChatType +import de.fiereu.openmmo.common.enums.EntityStatus import de.fiereu.openmmo.common.enums.Language import de.fiereu.openmmo.common.enums.PokemonContainer -import de.fiereu.openmmo.protocols.game.packets.CharacterEntry -import de.fiereu.openmmo.protocols.game.packets.CharacterListPacket -import de.fiereu.openmmo.protocols.game.packets.ChatMessagePacket -import de.fiereu.openmmo.protocols.game.packets.CreateCharacterPacket -import de.fiereu.openmmo.protocols.game.packets.JoinGamePacket -import de.fiereu.openmmo.protocols.game.packets.LoadEntityPacket -import de.fiereu.openmmo.protocols.game.packets.PokemonContainerPacket -import de.fiereu.openmmo.protocols.game.packets.RenderScreenPacket -import de.fiereu.openmmo.protocols.game.packets.RequestCharactersPacket -import de.fiereu.openmmo.protocols.game.packets.RequestPlayerPacket -import de.fiereu.openmmo.protocols.game.packets.SelectCharacterPacket -import de.fiereu.openmmo.protocols.game.packets.SelectedCharacterPacket -import de.fiereu.openmmo.protocols.game.packets.codecs.SkinSet -import de.fiereu.openmmo.server.game.protocol.game.ext.accept -import de.fiereu.openmmo.server.game.protocol.game.ext.buildAndRespond -import de.fiereu.openmmo.server.game.session.SessionManager +import de.fiereu.openmmo.maps.MapManager +import de.fiereu.openmmo.net.game.codecs.SkinSet +import de.fiereu.openmmo.net.game.packets.CharacterEntry +import de.fiereu.openmmo.net.game.packets.CharactersListPacket +import de.fiereu.openmmo.net.game.packets.ChatMessagePacket +import de.fiereu.openmmo.net.game.packets.CreateCharacterPacket +import de.fiereu.openmmo.net.game.packets.JoinPacket +import de.fiereu.openmmo.net.game.packets.JoinResponsePacket +import de.fiereu.openmmo.net.game.packets.LoadEntityPacket +import de.fiereu.openmmo.net.game.packets.NewAuthData +import de.fiereu.openmmo.net.game.packets.PokemonContainerPacket +import de.fiereu.openmmo.net.game.packets.RenderScreenPacket +import de.fiereu.openmmo.net.game.packets.RequestCharactersPacket +import de.fiereu.openmmo.net.game.packets.RequestPlayerPacket +import de.fiereu.openmmo.net.game.packets.SelectCharacterPacket +import de.fiereu.openmmo.net.game.packets.SelectedCharacterPacket +import de.fiereu.openmmo.server.game.session.PLAYER_STATE +import de.fiereu.openmmo.server.game.session.PlayerState +import de.fiereu.openmmo.server.game.session.SessionRegistry import de.fiereu.openmmo.server.game.storage.CharacterStore -import de.fiereu.openmmo.server.game.world.MapManager -import de.fiereu.openmmo.server.protocol.PacketEvent -import de.fiereu.openmmo.server.protocol.respond import io.github.oshai.kotlinlogging.KotlinLogging import java.time.LocalDateTime +import javax.inject.Inject +import javax.inject.Singleton private val log = KotlinLogging.logger {} -class LoginService( +@Singleton +class LoginService +@Inject +constructor( private val mapLoadService: MapLoadService, private val npcService: NpcService, private val multiplayerService: MultiplayerService, - private val packetSender: PacketSender, + private val sessionRegistry: SessionRegistry, + private val mapManager: MapManager, + private val characterStore: CharacterStore, ) { - fun onJoinGame(event: PacketEvent) { + fun onJoinGame(event: PacketEvent) { + val ctx = event.session val join = event.packet log.info { "Player joined the game." } val authData = join.authData var userId = 0 - if (authData is de.fiereu.openmmo.protocols.game.packets.NewAuthData) { + if (authData is NewAuthData) { userId = authData.userId log.info { "User $userId joined with session key (${authData.sessionKey.size} bytes)" } } if (userId > 0) { - SessionManager.createSession(event.ctx.channel(), userId) + ctx.attributes[PLAYER_STATE] = PlayerState(userId = userId) + sessionRegistry.register(ctx) log.info { "Session created for user $userId" } } - event.accept().withPlaytime(1337).withRewardPoints(420).withBalance(187).buildAndRespond(event) + ctx.send(JoinResponsePacket.acceptNow(playtime = 1337, rewardPoints = 420, balance = 187)) } fun onCreateCharacter(event: PacketEvent) { - val session = SessionManager.getSessionByChannel(event.ctx.channel()) - if (session == null) { + val ctx = event.session + val state = ctx.attributes[PLAYER_STATE] + if (state == null) { log.warn { "Create character from unknown session" } return } val name = event.packet.name - log.info { "Creating character '$name' for userId=${session.userId}" } - CharacterStore.createCharacter(session.userId, name) - log.info { "Created character '$name'" } - event.respond(buildCharacterList(session.userId)) + log.info { "Creating character '$name' for userId=${state.userId}" } + characterStore.createCharacter(state.userId, name) + ctx.send(buildCharacterList(state.userId)) } fun onCharacterRequest(event: PacketEvent) { - val session = SessionManager.getSessionByChannel(event.ctx.channel()) - if (session != null) { - event.respond(buildCharacterList(session.userId)) + val ctx = event.session + val state = ctx.attributes[PLAYER_STATE] + if (state != null) { + ctx.send(buildCharacterList(state.userId)) } else { log.warn { "Character request from unauthenticated session" } - event.respond(CharacterListPacket(emptyList())) + ctx.send(CharactersListPacket(emptyList())) } } - private fun buildCharacterList(userId: Int): CharacterListPacket { - val characters = CharacterStore.getCharactersByUser(userId) + private fun buildCharacterList(userId: Int): CharactersListPacket { + val characters = characterStore.getCharactersByUser(userId) val entries = characters.map { stored -> CharacterEntry( @@ -88,42 +103,42 @@ class LoginService( pokemon = stored.pokemon.take(1), ) } - return CharacterListPacket(entries) + return CharactersListPacket(entries) } fun onCharacterSelected(event: PacketEvent) { + val ctx = event.session val charId = event.packet.characterId - val stored = CharacterStore.getCharacter(charId) - + val stored = characterStore.getCharacter(charId) if (stored == null) { log.warn { "Character $charId not found" } return } - - val session = SessionManager.getSessionByChannel(event.ctx.channel()) - if (session == null) { + val state = ctx.attributes[PLAYER_STATE] + if (state == null) { log.warn { "No session for channel" } return } - SessionManager.setActiveCharacter(event.ctx.channel(), charId) + state.characterId = charId + sessionRegistry.bindCharacter(ctx, charId) log.info { "Player selected character '${stored.info.name}' (id=$charId)" } val info = stored.info val now = LocalDateTime.now() val updatedInfo = info.copy(lastLogin = now) - CharacterStore.updateCharacter(updatedInfo) + characterStore.updateCharacter(updatedInfo) val containers = mapOf( PokemonContainer.PARTY to stored.pokemon, PokemonContainer.PC to stored.pcStorage, - PokemonContainer.BATTLE_BOX_1 to emptyList(), - PokemonContainer.BATTLE_BOX_2 to emptyList(), - PokemonContainer.DAYCARE to emptyList(), + PokemonContainer.BATTLE_BOX_1 to emptyList(), + PokemonContainer.BATTLE_BOX_2 to emptyList(), + PokemonContainer.DAYCARE to emptyList(), ) for ((container, pokemon) in containers) { - event.respond( + ctx.send( PokemonContainerPacket( container = container, hasChange = true, @@ -132,19 +147,8 @@ class LoginService( )) } - sendRawPackets(event, info) - preloadMapAndJoin(event, charId, session) - } - - private fun sendRawPackets( - event: PacketEvent, - info: de.fiereu.openmmo.common.CharacterInfo - ) { - packetSender.sendRaw(event.ctx, 0x40u, bytesOf(0x01, 0x01, 0x00, 0x00)) - packetSender.sendRaw(event.ctx, 0x55u, bytesOf(0x00, 0x00, 0x00)) - listOf(PokemonContainer.UNKNOWN_13, PokemonContainer.UNKNOWN_14).forEach { container -> - event.respond( + ctx.send( PokemonContainerPacket( container = container, hasChange = true, @@ -153,27 +157,8 @@ class LoginService( )) } - packetSender.sendRaw(event.ctx, 0x67u, bytesOf(0x00, 0x00)) - packetSender.sendRaw(event.ctx, 0x63u, bytesOf(0x00, 0x00)) - packetSender.sendRaw(event.ctx, 0x98u, bytesOf(0x00, 0x00, 0x00, 0x00, 0x00, 0x00)) - packetSender.sendRaw( - event.ctx, 0x0Au, bytesOf(0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00)) - packetSender.sendRaw(event.ctx, 0x29u, bytesOf(0x00, 0x00, 0x00)) - packetSender.sendRaw(event.ctx, 0x29u, hexToBytes("0101006F080100")) - packetSender.sendRaw(event.ctx, 0x29u, bytesOf(0x02, 0x00, 0x00)) - packetSender.sendRaw(event.ctx, 0x29u, bytesOf(0x03, 0x00, 0x00)) - packetSender.sendRaw(event.ctx, 0x29u, bytesOf(0x04, 0x00, 0x00)) - packetSender.sendRaw(event.ctx, 0x29u, bytesOf(0x0A, 0x00, 0x00)) - packetSender.sendRaw(event.ctx, 0x29u, bytesOf(0x80, 0x00, 0x00)) - packetSender.sendRaw(event.ctx, 0x1Cu, bytesOf(0x00, 0x00)) - - event.respond(SelectedCharacterPacket(info)) - - packetSender.sendRaw(event.ctx, 0xF1u, bytesOf(0x05)) - packetSender.sendRaw(event.ctx, 0x4Au, bytesOf(0x00)) - packetSender.sendRaw(event.ctx, 0x4Du, bytesOf(0x18)) - - event.respond( + ctx.send(SelectedCharacterPacket(info)) + ctx.send( ChatMessagePacket( ChatType.GAME_NOTIFICATIONS, Language.EN, @@ -181,97 +166,29 @@ class LoginService( "", )) - packetSender.sendRaw( - event.ctx, - 0xF5u, - bytesOf( - 0x77, - 0x1A, - 0x00, - 0x00, - 0x81, - 0x00, - 0x05, - 0x4A, - 0x00, - 0x6F, - 0x00, - 0x73, - 0x00, - 0x75, - 0x00, - 0x6B, - 0x00, - 0x65, - 0x00, - 0x00, - 0x00, - 0x10, - )) - - packetSender.sendRaw( - event.ctx, - 0x4Fu, - hexToBytes( - "B8009502029202019102029002008F02008C02008902008802028702008602008502008402008302008202008102008002027F02017E02027D02017B02017802037602037402037102026D02026C02016402026102015C02035602015102014F02014302013D02033B02033302023102022B02022902022102021602011202010E0202F10101F00103EE0100ED0100EC0102EB0100EA0100E90100E80101E70100E60100E50101E40100E30100E20100E10100E00100DF0103DE0102DB0103DA0102D90101D80101D50102D40101D10102D00102CE0102CD0101CC0103C60103C20102C00101BD0101BA0102B50101B40103B30103AE0102AD0102A80103A701029701038E01018B01028801018501038201008101018001007F01007E01007D01007C01007B01007A01007901007801017501016401035E01035601014E01034A01024401023F01033401022E01012901032301021E01011A0103170101100103040103010103FE0003FB0000FA0000F90000F80001F50001F40002F30001F20002ED0003E90002E80002E60001E30001E20003DD0003D60002D40001D30003D00003CF0002CD0002C70002C50002C40002C30002BA0002B20003AB0003A90002A000029700009600009500019200039100018F00038D00038700038600038200017900017100016E00016B00036500035E00015B00025200035000014C00034900024400024100033E00033B00033700033100032A00032600022400032200021F0002090003030002080600000F00000C00000B00000D00000700000800000E0000")) - - packetSender.sendRaw(event.ctx, 0xD3u, bytesOf(0x00)) - - packetSender.sendRaw( - event.ctx, - 0xFCu, - hexToBytes( - "10D6B660234D938A916F030CD1B64F9CDD0100040100007F0601000000000000000000000000000000621E0A")) - - packetSender.sendRaw(event.ctx, 0x59u, bytesOf(0x00, 0x00)) - packetSender.sendRaw(event.ctx, 0x59u, bytesOf(0x01, 0x00)) - - packetSender.sendRaw( - event.ctx, - 0x6Eu, - bytesOf( - 0x05, - 0x92, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0xF5, - 0x00, - 0x00)) - - packetSender.sendRaw(event.ctx, 0xB9u, bytesOf(0x00)) + preloadMapAndJoin(ctx, state, info) } private fun preloadMapAndJoin( - event: PacketEvent, - charId: Long, - session: de.fiereu.openmmo.server.game.session.Session, + ctx: SessionContext, + state: PlayerState, + info: CharacterInfo, ) { - val info = CharacterStore.getCharacter(charId)?.info ?: return - - val map = MapManager.getMap(info.positionRegionId, info.positionBankId, info.positionMapId) + val map = mapManager.getMap(info.positionRegionId, info.positionBankId, info.positionMapId) if (map != null) { - event.respond(MapManager.createLoadMapPacket(map, reloadPlayer = true, deleteCache = true)) - mapLoadService.preloadConnectedMaps(event.ctx, map) + ctx.send(mapManager.createLoadMapPacket(map, reloadPlayer = true, deleteCache = true)) + mapLoadService.preloadConnectedMaps(ctx, map) } else { log.warn { "Map not found for position ${info.positionRegionId}:${info.positionBankId}:${info.positionMapId}" } } - session.regionId = info.positionRegionId.toInt() - session.bankId = info.positionBankId.toInt() - session.mapId = info.positionMapId.toInt() - session.x = info.positionX - session.y = info.positionY + state.regionId = info.positionRegionId.toInt() + state.bankId = info.positionBankId.toInt() + state.mapId = info.positionMapId.toInt() + state.x = info.positionX + state.y = info.positionY multiplayerService.broadcastMessage( ChatMessagePacket( @@ -283,72 +200,68 @@ class LoginService( } fun onRequestPlayer(event: PacketEvent) { - log.info { "Received RequestPlayerPacket" } - val session = SessionManager.getSessionByChannel(event.ctx.channel()) - if (session == null) { + val ctx = event.session + val state = ctx.attributes[PLAYER_STATE] + if (state == null) { log.warn { "RequestPlayer from unknown session" } return } - - val charId = session.characterId + val charId = state.characterId if (charId == null) { log.warn { "RequestPlayer without active character" } return } - val stored = CharacterStore.getCharacter(charId) + val stored = characterStore.getCharacter(charId) if (stored == null) { log.warn { "RequestPlayer for unknown character $charId" } return } val info = stored.info - log.info { "Sending LoadEntity + 0x90 for character '${info.name}'" } - val facing = session.facingDirection + log.info { "Sending LoadEntity for character '${info.name}'" } + val facing = state.facingDirection val loadEntity = mapLoadService.createLoadEntity(info, facing) + ctx.send(loadEntity) - event.ctx.channel().writeAndFlush(loadEntity) - mapLoadService.send90(event.ctx, loadEntity.entityId, loadEntity.skin) - npcService.spawnNpcsForMap(event.ctx, info.positionBankId.toInt(), info.positionMapId.toInt()) + npcService.spawnNpcsForMap(ctx, info.positionBankId.toInt(), info.positionMapId.toInt()) val bankId = info.positionBankId.toInt() val mapId = info.positionMapId.toInt() val regionId = info.positionRegionId.toInt() - session.regionId = regionId - session.bankId = bankId - session.mapId = mapId - session.x = info.positionX - session.y = info.positionY + state.regionId = regionId + state.bankId = bankId + state.mapId = mapId + state.x = info.positionX + state.y = info.positionY - val currentParty = CharacterStore.getCharacter(charId)?.pokemon ?: emptyList() + val currentParty = characterStore.getCharacter(charId)?.pokemon ?: emptyList() val hasFollower = currentParty.isNotEmpty() val followerDexId = (currentParty.firstOrNull()?.dexId ?: 0).toShort() - // Send LoadEntity of each existing player in this map to the new player - val others = SessionManager.getOthersInMap(charId, regionId, bankId, mapId) + val others = sessionRegistry.getOthersInMap(charId, regionId, bankId, mapId) for (other in others) { - val otherStored = CharacterStore.getCharacter(other.characterId ?: continue) ?: continue - val otherParty = otherStored.pokemon - event.ctx - .channel() - .write( - LoadEntityPacket( - entityId = other.characterId!!, - skin = SkinSet(), - name = otherStored.info.name, - regionId = other.regionId, - bankId = other.bankId, - mapId = other.mapId, - x = other.x.toInt(), - y = other.y.toInt(), - z = 0, - facing = other.facingDirection, - status = de.fiereu.openmmo.common.enums.EntityStatus.NONE, - hasFollower = otherParty.isNotEmpty(), - followerDexId = (otherParty.firstOrNull()?.dexId ?: 0).toShort(), - )) + val otherState = other.attributes[PLAYER_STATE] ?: continue + val otherCharId = otherState.characterId ?: continue + val otherStored = characterStore.getCharacter(otherCharId) ?: continue + val otherParty: List = otherStored.pokemon + ctx.send( + LoadEntityPacket( + entityId = otherCharId, + skin = SkinSet(), + name = otherStored.info.name, + regionId = otherState.regionId, + bankId = otherState.bankId, + mapId = otherState.mapId, + x = otherState.x.toInt(), + y = otherState.y.toInt(), + z = 0, + facing = otherState.facingDirection, + status = EntityStatus.NONE, + hasFollower = otherParty.isNotEmpty(), + followerDexId = (otherParty.firstOrNull()?.dexId ?: 0).toShort(), + )) } - // Broadcast LoadEntity of new player to all existing players in this map val selfEntity = LoadEntityPacket( entityId = charId, @@ -361,22 +274,15 @@ class LoginService( y = info.positionY.toInt(), z = 0, facing = facing, - status = de.fiereu.openmmo.common.enums.EntityStatus.NONE, + status = EntityStatus.NONE, hasFollower = hasFollower, followerDexId = followerDexId, ) for (other in others) { - other.channel.writeAndFlush(selfEntity) + other.send(selfEntity) } - event.ctx.channel().writeAndFlush(RenderScreenPacket(true)) + ctx.send(RenderScreenPacket(true)) log.info { "Player $charId spawned in bank=$bankId map=$mapId; ${others.size} others present" } } - - private fun bytesOf(vararg ints: Int) = ByteArray(ints.size) { ints[it].toByte() } - - private fun hexToBytes(hex: String): ByteArray { - val hexStr = hex.replace(" ", "").replace("\n", "") - return ByteArray(hexStr.length / 2) { hexStr.substring(it * 2, it * 2 + 2).toInt(16).toByte() } - } } diff --git a/server.game/src/main/kotlin/de/fiereu/openmmo/server/game/services/MapLoadService.kt b/server.game/src/main/kotlin/de/fiereu/openmmo/server/game/services/MapLoadService.kt index f46a0c6..64c77c0 100644 --- a/server.game/src/main/kotlin/de/fiereu/openmmo/server/game/services/MapLoadService.kt +++ b/server.game/src/main/kotlin/de/fiereu/openmmo/server/game/services/MapLoadService.kt @@ -1,19 +1,23 @@ package de.fiereu.openmmo.server.game.services +import de.fiereu.network.SessionContext import de.fiereu.openmmo.common.CharacterInfo import de.fiereu.openmmo.common.enums.Direction -import de.fiereu.openmmo.protocols.game.packets.LoadEntityPacket -import de.fiereu.openmmo.protocols.game.packets.MapData -import de.fiereu.openmmo.protocols.game.packets.codecs.SkinSet -import de.fiereu.openmmo.server.game.world.MapDef -import de.fiereu.openmmo.server.game.world.MapManager -import io.github.oshai.kotlinlogging.KotlinLogging -import io.netty.buffer.Unpooled -import io.netty.channel.ChannelHandlerContext +import de.fiereu.openmmo.common.enums.EntityStatus +import de.fiereu.openmmo.maps.MapDef +import de.fiereu.openmmo.maps.MapManager +import de.fiereu.openmmo.net.game.codecs.SkinSet +import de.fiereu.openmmo.net.game.packets.LoadEntityPacket +import de.fiereu.openmmo.net.game.packets.MapData +import javax.inject.Inject +import javax.inject.Singleton -private val log = KotlinLogging.logger {} - -class MapLoadService(private val packetSender: PacketSender) { +@Singleton +class MapLoadService +@Inject +constructor( + private val mapManager: MapManager, +) { fun createLoadEntity( info: CharacterInfo, @@ -31,47 +35,17 @@ class MapLoadService(private val packetSender: PacketSender) { y = info.positionY.toInt(), z = z, facing = facing, - status = de.fiereu.openmmo.common.enums.EntityStatus.NONE, + status = EntityStatus.NONE, hasFollower = false, followerDexId = 0, ) } - fun send90(ctx: ChannelHandlerContext, entityId: Long, skin: SkinSet) { - val raw90Buf = Unpooled.buffer() - raw90Buf.writeLongLE(entityId) - raw90Buf.writeByte(0x01) - raw90Buf.writeByte(0x00) - raw90Buf.writeByte(0x4C) - raw90Buf.writeByte(0x03) - raw90Buf.writeBytes( - byteArrayOf( - 0x13, - 0xA8.toByte(), - 0x0A, - 0x00, - 0x03, - 0x8C.toByte(), - 0x01, - 0x38.toByte(), - 0x02, - 0x4C, - 0x01)) - val raw90 = ByteArray(raw90Buf.readableBytes()) - raw90Buf.readBytes(raw90) - raw90Buf.release() - log.info { - ">> TX 0x90 payload (${raw90.size}b): ${raw90.joinToString("") { "%02X".format(it) }}" - } - packetSender.sendRaw(ctx, 0x90u, raw90) - } - fun preloadConnectedMaps( - ctx: ChannelHandlerContext, + ctx: SessionContext, map: MapDef, depth: Int = 2, reloadPlayer: Boolean = false, - flush: Boolean = true, ) { val loaded = mutableSetOf() loaded.add("${map.bankId}:${map.mapId}") @@ -80,22 +54,18 @@ class MapLoadService(private val packetSender: PacketSender) { for (conn in connections) { val key = "${conn.targetBank}:${conn.targetMap}" if (!loaded.add(key)) continue - val connected = MapManager.getMap(1, conn.targetBank.toByte(), conn.targetMap.toByte()) + val connected = mapManager.getMap(1, conn.targetBank, conn.targetMap) if (connected != null) { - ctx.channel() - .write( - MapManager.createLoadMapPacket( - connected, - reloadPlayer = reloadPlayer, - deleteCache = false, - )) + ctx.send( + mapManager.createLoadMapPacket( + connected, + reloadPlayer = reloadPlayer, + deleteCache = false, + )) preload(connected.connections, remaining - 1) } } } preload(map.connections, depth) - if (flush) { - ctx.channel().flush() - } } } diff --git a/server.game/src/main/kotlin/de/fiereu/openmmo/server/game/services/MovementService.kt b/server.game/src/main/kotlin/de/fiereu/openmmo/server/game/services/MovementService.kt index f73880d..91adc71 100644 --- a/server.game/src/main/kotlin/de/fiereu/openmmo/server/game/services/MovementService.kt +++ b/server.game/src/main/kotlin/de/fiereu/openmmo/server/game/services/MovementService.kt @@ -1,59 +1,61 @@ package de.fiereu.openmmo.server.game.services +import de.fiereu.network.PacketEvent +import de.fiereu.network.SessionContext import de.fiereu.openmmo.common.enums.Direction -import de.fiereu.openmmo.protocols.game.packets.EntityMovePacket -import de.fiereu.openmmo.protocols.game.packets.FaceDirectionPacket -import de.fiereu.openmmo.protocols.game.packets.MapData -import de.fiereu.openmmo.protocols.game.packets.MovementPacket -import de.fiereu.openmmo.server.game.session.SessionManager +import de.fiereu.openmmo.maps.MapManager +import de.fiereu.openmmo.net.game.packets.EntityMovePacket +import de.fiereu.openmmo.net.game.packets.FaceDirectionPacket +import de.fiereu.openmmo.net.game.packets.MapData +import de.fiereu.openmmo.net.game.packets.MovementPacket +import de.fiereu.openmmo.server.game.session.PLAYER_STATE import de.fiereu.openmmo.server.game.storage.CharacterStore -import de.fiereu.openmmo.server.game.world.MapManager -import de.fiereu.openmmo.server.protocol.PacketEvent import io.github.oshai.kotlinlogging.KotlinLogging -import io.netty.channel.ChannelHandlerContext import java.util.concurrent.atomic.AtomicInteger +import javax.inject.Inject +import javax.inject.Singleton private val log = KotlinLogging.logger {} -class MovementService( +@Singleton +class MovementService +@Inject +constructor( private val warpService: WarpService, private val mapLoadService: MapLoadService, private val npcService: NpcService, private val multiplayerService: MultiplayerService, + private val mapManager: MapManager, + private val characterStore: CharacterStore, ) { private val sequenceCounter = AtomicInteger(0) fun onMovement(event: PacketEvent) { - val session = SessionManager.getSessionByChannel(event.ctx.channel()) - if (session == null) return - - val charId = session.characterId ?: return + val ctx = event.session + val state = ctx.attributes[PLAYER_STATE] ?: return + val charId = state.characterId ?: return val msg = event.packet log.info { "Movement: char=$charId, x=${msg.x}, y=${msg.y}, dir=${msg.direction}" } - session.facingDirection = msg.direction + state.facingDirection = msg.direction - // Store previous position for detecting wall bumps - val prevStored = CharacterStore.getCharacter(charId) + val prevStored = characterStore.getCharacter(charId) val prevX = prevStored?.info?.positionX?.toInt() val prevY = prevStored?.info?.positionY?.toInt() val isWallBump = prevX == msg.x && prevY == msg.y - // Check for warps and edge transitions BEFORE updating position. - val stored = CharacterStore.getCharacter(charId) + val stored = characterStore.getCharacter(charId) if (stored != null) { val currentMap = - MapManager.getMap( + mapManager.getMap( stored.info.positionRegionId, stored.info.positionBankId, stored.info.positionMapId, ) if (currentMap != null) { - // Skip warp check for the first movement after a warp - if (session.justWarped) { - session.justWarped = false + if (state.justWarped) { + state.justWarped = false } else { - // Direct warp: player walked onto a warp tile (not just standing on it) val warp = currentMap.warps.find { w -> w.x == msg.x && @@ -62,14 +64,11 @@ class MovementService( !isWallBump } if (warp != null) { - log.info { - "DIRECT WARP at (${msg.x}, ${msg.y}) facing ${msg.direction} → ${warp.targetRegionId}:${warp.targetBankId}:${warp.targetMapId} (${warp.targetX}, ${warp.targetY})" - } - warpService.executeWarp(event.ctx, charId, warp) + log.info { "DIRECT WARP at (${msg.x}, ${msg.y}) facing ${msg.direction}" } + warpService.executeWarp(ctx, charId, warp) return } - // Adjacent warp: player is standing in front of a door tile, facing it val adjX = msg.x + when (msg.direction) { @@ -91,37 +90,29 @@ class MovementService( (w.facingDirection == null || w.facingDirection == msg.direction) } if (adjWarp != null) { - log.info { - "ADJACENT WARP at (${msg.x}, ${msg.y}) facing ${msg.direction} → tile ($adjX, $adjY) → ${adjWarp.targetRegionId}:${adjWarp.targetBankId}:${adjWarp.targetMapId} (${adjWarp.targetX}, ${adjWarp.targetY})" - } - warpService.executeWarp(event.ctx, charId, adjWarp) + log.info { "ADJACENT WARP at (${msg.x}, ${msg.y}) facing ${msg.direction}" } + warpService.executeWarp(ctx, charId, adjWarp) return } } - // Map edge transition if (prevX != null && prevY != null && !isWallBump) { val dx = kotlin.math.abs(msg.x - prevX) val dy = kotlin.math.abs(msg.y - prevY) - log.info { - "EDGE CHECK: prev=($prevX, $prevY) msg=(${msg.x}, ${msg.y}) dx=$dx dy=$dy map=${currentMap.bankId}:${currentMap.mapId} h=${currentMap.height} w=${currentMap.width}" - } if (dx > 1 || dy > 1) { val gbaDirection = when { - prevY == 0 -> 2 // North - prevY == currentMap.height - 1 -> 1 // South - prevX == 0 -> 3 // West - prevX == currentMap.width - 1 -> 4 // East + prevY == 0 -> 2 + prevY == currentMap.height - 1 -> 1 + prevX == 0 -> 3 + prevX == currentMap.width - 1 -> 4 else -> null } - log.info { "BIG JUMP: gbaDirection=$gbaDirection" } if (gbaDirection != null) { val connection = currentMap.connections.find { it.direction == gbaDirection } - log.info { "Connection found: $connection" } if (connection != null) { val targetMap = - MapManager.getMap( + mapManager.getMap( 1, connection.targetBank.toByte(), connection.targetMap.toByte(), @@ -131,27 +122,16 @@ class MovementService( when (gbaDirection) { 3 -> targetMap.width - 1 4 -> 0 - else -> - (prevX - connection.unknown).coerceIn( - 0, - targetMap.width - 1, - ) + else -> (prevX - connection.unknown).coerceIn(0, targetMap.width - 1) } val targetY = when (gbaDirection) { 1 -> 0 2 -> targetMap.height - 1 - else -> - (prevY - connection.unknown).coerceIn( - 0, - targetMap.height - 1, - ) + else -> (prevY - connection.unknown).coerceIn(0, targetMap.height - 1) } - log.info { - "MAP TRANSITION prev=($prevX, $prevY) dir=${msg.direction} → bank=${connection.targetBank} map=${connection.targetMap} ($targetX, $targetY)" - } edgeTransition( - event.ctx, + ctx, charId, connection, targetX.toByte(), @@ -167,10 +147,9 @@ class MovementService( } } - // No transition: normal movement update + EntityMove broadcast - CharacterStore.updatePosition(charId, msg.x.toShort(), msg.y.toShort()) - session.x = msg.x.toShort() - session.y = msg.y.toShort() + characterStore.updatePosition(charId, msg.x.toShort(), msg.y.toShort()) + state.x = msg.x.toShort() + state.y = msg.y.toShort() if (!isWallBump) { val seq = sequenceCounter.incrementAndGet().toByte() val movePkt = @@ -181,21 +160,20 @@ class MovementService( direction = msg.direction, seq = seq, ) - event.ctx.channel().writeAndFlush(movePkt) - multiplayerService.broadcastExcept(event.ctx.channel(), movePkt) + ctx.send(movePkt) + multiplayerService.broadcastExcept(ctx, movePkt) } } fun onFaceDirection(event: PacketEvent) { - val session = SessionManager.getSessionByChannel(event.ctx.channel()) - if (session == null) return - - val charId = session.characterId ?: return + val ctx = event.session + val state = ctx.attributes[PLAYER_STATE] ?: return + val charId = state.characterId ?: return val msg = event.packet - session.facingDirection = msg.direction + state.facingDirection = msg.direction val seq = sequenceCounter.incrementAndGet().toByte() - val stored = CharacterStore.getCharacter(charId) ?: return + val stored = characterStore.getCharacter(charId) ?: return val movePkt = EntityMovePacket( entityId = charId, @@ -204,12 +182,12 @@ class MovementService( direction = msg.direction, seq = seq, ) - event.ctx.channel().writeAndFlush(movePkt) - multiplayerService.broadcastExcept(event.ctx.channel(), movePkt) + ctx.send(movePkt) + multiplayerService.broadcastExcept(ctx, movePkt) } private fun edgeTransition( - ctx: ChannelHandlerContext, + ctx: SessionContext, charId: Long, connection: MapData.GbaConnection, targetX: Byte, @@ -218,14 +196,16 @@ class MovementService( ) { val targetBank = connection.targetBank.toByte() val targetMap = connection.targetMap.toByte() - val map = MapManager.getMap(1, targetBank, targetMap) ?: return + val map = mapManager.getMap(1, targetBank, targetMap) ?: return - val session = SessionManager.getSessionByCharacterId(charId) - session?.bankId = targetBank.toInt() - session?.mapId = targetMap.toInt() - session?.x = targetX.toShort() - session?.y = targetY.toShort() - CharacterStore.updatePosition( + val state = ctx.attributes[PLAYER_STATE] + if (state != null) { + state.bankId = targetBank.toInt() + state.mapId = targetMap.toInt() + state.x = targetX.toShort() + state.y = targetY.toShort() + } + characterStore.updatePosition( charId, targetX.toShort(), targetY.toShort(), @@ -233,9 +213,7 @@ class MovementService( targetMap, ) - ctx.channel() - .write(MapManager.createLoadMapPacket(map, reloadPlayer = false, deleteCache = false)) - mapLoadService.preloadConnectedMaps(ctx, map, depth = 1, flush = false) + mapLoadService.preloadConnectedMaps(ctx, map, depth = 1) npcService.spawnNpcsForMap(ctx, targetBank.toInt(), targetMap.toInt()) val seq = sequenceCounter.incrementAndGet().toByte() @@ -247,9 +225,8 @@ class MovementService( direction = direction, seq = seq, ) - ctx.channel().write(movePkt) - multiplayerService.broadcastExcept(ctx.channel(), movePkt) - ctx.channel().flush() + ctx.send(movePkt) + multiplayerService.broadcastExcept(ctx, movePkt) log.info { "Player $charId edge-transitioned to bank=$targetBank map=$targetMap" } } } diff --git a/server.game/src/main/kotlin/de/fiereu/openmmo/server/game/services/MultiplayerService.kt b/server.game/src/main/kotlin/de/fiereu/openmmo/server/game/services/MultiplayerService.kt index d5c38da..a713350 100644 --- a/server.game/src/main/kotlin/de/fiereu/openmmo/server/game/services/MultiplayerService.kt +++ b/server.game/src/main/kotlin/de/fiereu/openmmo/server/game/services/MultiplayerService.kt @@ -1,24 +1,31 @@ package de.fiereu.openmmo.server.game.services -import de.fiereu.openmmo.server.game.session.SessionManager -import io.netty.channel.Channel +import de.fiereu.network.SessionContext +import de.fiereu.openmmo.server.game.session.SessionRegistry +import javax.inject.Inject +import javax.inject.Singleton -class MultiplayerService { +@Singleton +class MultiplayerService +@Inject +constructor( + private val sessionRegistry: SessionRegistry, +) { fun broadcastMessage(packet: Any) { - for (characterId in SessionManager.getOnlineCharacterIds()) { - val s = SessionManager.getSessionByCharacterId(characterId) ?: continue - if (s.channel.isActive) { - s.channel.writeAndFlush(packet) + for (characterId in sessionRegistry.onlineCharacterIds()) { + val ctx = sessionRegistry.getByCharacterId(characterId) ?: continue + if (ctx.channel.isActive) { + ctx.send(packet) } } } - fun broadcastExcept(channel: Channel, packet: Any) { - for (characterId in SessionManager.getOnlineCharacterIds()) { - val s = SessionManager.getSessionByCharacterId(characterId) ?: continue - if (s.channel.isActive && s.channel != channel) { - s.channel.writeAndFlush(packet) + fun broadcastExcept(exclude: SessionContext, packet: Any) { + for (characterId in sessionRegistry.onlineCharacterIds()) { + val ctx = sessionRegistry.getByCharacterId(characterId) ?: continue + if (ctx.channel.isActive && ctx.channel != exclude.channel) { + ctx.send(packet) } } } diff --git a/server.game/src/main/kotlin/de/fiereu/openmmo/server/game/services/NpcService.kt b/server.game/src/main/kotlin/de/fiereu/openmmo/server/game/services/NpcService.kt index 3191475..bdc5a67 100644 --- a/server.game/src/main/kotlin/de/fiereu/openmmo/server/game/services/NpcService.kt +++ b/server.game/src/main/kotlin/de/fiereu/openmmo/server/game/services/NpcService.kt @@ -1,14 +1,21 @@ package de.fiereu.openmmo.server.game.services -import de.fiereu.openmmo.protocols.game.packets.NpcSpawnPacket -import de.fiereu.openmmo.server.game.world.MapManager +import de.fiereu.network.SessionContext +import de.fiereu.openmmo.maps.MapManager +import de.fiereu.openmmo.net.game.packets.NpcSpawnPacket import io.github.oshai.kotlinlogging.KotlinLogging -import io.netty.channel.ChannelHandlerContext import java.util.concurrent.atomic.AtomicLong +import javax.inject.Inject +import javax.inject.Singleton private val log = KotlinLogging.logger {} -class NpcService { +@Singleton +class NpcService +@Inject +constructor( + private val mapManager: MapManager, +) { private val npcEntityIdCounter = AtomicLong(0x1A69000000000000L) private val npcEntityIds = mutableMapOf() @@ -17,13 +24,9 @@ class NpcService { return npcEntityIds["$bankId:$mapId:$entityIdx"] } - fun spawnNpcsForMap(ctx: ChannelHandlerContext, bankId: Int, mapId: Int) { - val map = MapManager.getMap(1, bankId.toByte(), mapId.toByte()) - if (map == null) return - val entityIds = mutableListOf() + fun spawnNpcsForMap(ctx: SessionContext, bankId: Int, mapId: Int) { + val map = mapManager.getMap(1, bankId, mapId) ?: return - // Petalburg Woods (bank=74, map=11) — send all 16 NPCs (0-15), - // using exact values from real server packets.db rows 3895-3910 if (bankId == 74 && mapId == 11) { data class NpcEntry( val entityIdx: Int, @@ -34,7 +37,7 @@ class NpcService { val unk3: Int, val unk4: Int, val facing: Int, - val unk6: Int + val unk6: Int, ) val all16 = listOf( @@ -59,7 +62,7 @@ class NpcService { for (npc in all16) { val entityId = baseEntityId or npc.entityIdx.toLong() log.info { - ">> Petalburg NpcSpawn[${npc.entityIdx}] entId=0x${entityId.toString(16)} pos=(${npc.x},${npc.y}) gfx=${npc.gfx} unk3=${npc.unk3} unk4=${npc.unk4}" + ">> Petalburg NpcSpawn[${npc.entityIdx}] entId=0x${entityId.toString(16)} pos=(${npc.x},${npc.y}) gfx=${npc.gfx}" } val spawnPacket = NpcSpawnPacket( @@ -77,13 +80,11 @@ class NpcService { unk5 = 2, unk6 = npc.unk6, ) - ctx.channel().write(spawnPacket) - entityIds.add(entityId) + ctx.send(spawnPacket) } return } - // All other maps: send visible NPCs from MapDef for (npc in map.npcs) { val key = "$bankId:$mapId:${npc.entityIdx}" val entityId = npcEntityIds.getOrPut(key) { npcEntityIdCounter.incrementAndGet() } @@ -110,8 +111,7 @@ class NpcService { unk5 = 2, unk6 = 8, ) - ctx.channel().write(spawnPacket) - entityIds.add(entityId) + ctx.send(spawnPacket) } } } diff --git a/server.game/src/main/kotlin/de/fiereu/openmmo/server/game/services/PacketSender.kt b/server.game/src/main/kotlin/de/fiereu/openmmo/server/game/services/PacketSender.kt deleted file mode 100644 index 77b0598..0000000 --- a/server.game/src/main/kotlin/de/fiereu/openmmo/server/game/services/PacketSender.kt +++ /dev/null @@ -1,24 +0,0 @@ -package de.fiereu.openmmo.server.game.services - -import de.fiereu.openmmo.server.netty.Compressor -import io.netty.buffer.Unpooled -import io.netty.channel.ChannelHandlerContext - -class PacketSender(private val compressor: Compressor) { - - fun sendRaw(ctx: ChannelHandlerContext, opcode: UByte, data: ByteArray) { - val buffer = ctx.alloc().buffer() - buffer.writeByte(opcode.toInt()) - val dataBuf = Unpooled.wrappedBuffer(data) - buffer.writeBytes(compressor.compress(dataBuf)) - ctx.write(buffer) - } - - fun sendRawAndFlush(ctx: ChannelHandlerContext, opcode: UByte, data: ByteArray) { - val buffer = ctx.alloc().buffer() - buffer.writeByte(opcode.toInt()) - val dataBuf = Unpooled.wrappedBuffer(data) - buffer.writeBytes(compressor.compress(dataBuf)) - ctx.writeAndFlush(buffer) - } -} diff --git a/server.game/src/main/kotlin/de/fiereu/openmmo/server/game/services/WarpService.kt b/server.game/src/main/kotlin/de/fiereu/openmmo/server/game/services/WarpService.kt index 0c8f4e0..d90100d 100644 --- a/server.game/src/main/kotlin/de/fiereu/openmmo/server/game/services/WarpService.kt +++ b/server.game/src/main/kotlin/de/fiereu/openmmo/server/game/services/WarpService.kt @@ -1,35 +1,41 @@ package de.fiereu.openmmo.server.game.services +import de.fiereu.network.SessionContext import de.fiereu.openmmo.common.enums.Direction -import de.fiereu.openmmo.protocols.game.packets.EntityLeavePacket -import de.fiereu.openmmo.protocols.game.packets.MapTransitionAckPacket -import de.fiereu.openmmo.protocols.game.packets.MapTransitionPacket -import de.fiereu.openmmo.protocols.game.packets.RenderScreenPacket -import de.fiereu.openmmo.server.game.session.SessionManager +import de.fiereu.openmmo.maps.MapManager +import de.fiereu.openmmo.maps.WarpTile +import de.fiereu.openmmo.net.game.packets.EntityLeavePacket +import de.fiereu.openmmo.net.game.packets.MapTransitionAckPacket +import de.fiereu.openmmo.net.game.packets.MapTransitionPacket +import de.fiereu.openmmo.net.game.packets.RenderScreenPacket +import de.fiereu.openmmo.server.game.session.PLAYER_STATE +import de.fiereu.openmmo.server.game.session.SessionRegistry import de.fiereu.openmmo.server.game.storage.CharacterStore -import de.fiereu.openmmo.server.game.world.MapManager import de.fiereu.openmmo.server.game.world.WarpExitRules -import de.fiereu.openmmo.server.game.world.WarpTile import io.github.oshai.kotlinlogging.KotlinLogging -import io.netty.channel.ChannelHandlerContext +import javax.inject.Inject +import javax.inject.Singleton private val log = KotlinLogging.logger {} -class WarpService( +@Singleton +class WarpService +@Inject +constructor( private val mapLoadService: MapLoadService, + private val mapManager: MapManager, + private val characterStore: CharacterStore, + private val sessionRegistry: SessionRegistry, ) { - fun executeWarp(ctx: ChannelHandlerContext, charId: Long, warp: WarpTile) { - val session = SessionManager.getSessionByCharacterId(charId) - if (session != null) { - session.justWarped = true - } - val stored = CharacterStore.getCharacter(charId) ?: return - - val destMap = MapManager.getMap(warp.targetRegionId, warp.targetBankId, warp.targetMapId) + fun executeWarp(ctx: SessionContext, charId: Long, warp: WarpTile) { + val state = ctx.attributes[PLAYER_STATE] + state?.justWarped = true + val stored = characterStore.getCharacter(charId) ?: return + val destMap = mapManager.getMap(warp.targetRegionId, warp.targetBankId, warp.targetMapId) val sourceMap = - MapManager.getMap( + mapManager.getMap( stored.info.positionRegionId, stored.info.positionBankId, stored.info.positionMapId) val knownOverride = @@ -42,21 +48,19 @@ class WarpService( destMap = destMap, destX = warp.targetX, destY = warp.targetY, - sourceMap = sourceMap) + sourceMap = sourceMap, + ) - session?.facingDirection = warpFacing + state?.facingDirection = warpFacing var offsetX = warp.targetX var offsetY = warp.targetY val shouldAutoStepOffWarp = knownOverride?.autoStep - ?: WarpExitRules.shouldAutoStep( - sourceMap = sourceMap, - destMap = destMap, - ) - if (shouldAutoStepOffWarp) { - val destWarp = destMap?.warps?.find { it.x == offsetX && it.y == offsetY } + ?: WarpExitRules.shouldAutoStep(sourceMap = sourceMap, destMap = destMap) + if (shouldAutoStepOffWarp && destMap != null) { + val destWarp = destMap.warps.find { it.x == offsetX && it.y == offsetY } if (destWarp != null) { when (warpFacing) { Direction.UP -> offsetY-- @@ -64,8 +68,8 @@ class WarpService( Direction.LEFT -> offsetX-- Direction.RIGHT -> offsetX++ } - offsetX = offsetX.coerceIn(0, destMap!!.width - 1) - offsetY = offsetY.coerceIn(0, destMap!!.height - 1) + offsetX = offsetX.coerceIn(0, destMap.width - 1) + offsetY = offsetY.coerceIn(0, destMap.height - 1) } } @@ -74,10 +78,7 @@ class WarpService( ?: warp.targetElevation log.info { - "WARP EXIT: source=${sourceMap?.bankId}:${sourceMap?.mapId} ${sourceMap?.mapType} " + - "dest=${destMap?.bankId}:${destMap?.mapId} ${destMap?.mapType} " + - "target=(${warp.targetX},${warp.targetY}) final=($offsetX,$offsetY) " + - "z=$playerZ facing=$warpFacing autoStep=$shouldAutoStepOffWarp" + "WARP EXIT: source=${sourceMap?.bankId}:${sourceMap?.mapId} dest=${destMap?.bankId}:${destMap?.mapId} target=(${warp.targetX},${warp.targetY}) final=($offsetX,$offsetY) z=$playerZ facing=$warpFacing autoStep=$shouldAutoStepOffWarp" } val newInfo = @@ -88,43 +89,34 @@ class WarpService( positionX = offsetX.toShort(), positionY = offsetY.toShort(), ) - CharacterStore.updateCharacter(newInfo) + characterStore.updateCharacter(newInfo) - // Multiplayer: broadcast EntityLeave to old-map players before position update - val oldRegionId = session?.regionId - val oldBankId = session?.bankId - val oldMapId = session?.mapId + val oldRegionId = state?.regionId + val oldBankId = state?.bankId + val oldMapId = state?.mapId if (oldBankId != null && oldMapId != null) { val oldMapPlayers = - SessionManager.getOthersInMap(charId, oldRegionId ?: 1, oldBankId, oldMapId) + sessionRegistry.getOthersInMap(charId, oldRegionId ?: 1, oldBankId, oldMapId) for (other in oldMapPlayers) { - other.channel.writeAndFlush(EntityLeavePacket(charId)) + other.send(EntityLeavePacket(charId)) } } - // Update session position for multiplayer tracking - if (session != null) { - session.regionId = warp.targetRegionId.toInt() - session.bankId = warp.targetBankId.toInt() - session.mapId = warp.targetMapId.toInt() - session.x = offsetX.toShort() - session.y = offsetY.toShort() + if (state != null) { + state.regionId = warp.targetRegionId.toInt() + state.bankId = warp.targetBankId.toInt() + state.mapId = warp.targetMapId.toInt() + state.x = offsetX.toShort() + state.y = offsetY.toShort() } - // Real server warp sequence (from packets.db): - ctx.channel().writeAndFlush(MapTransitionPacket()) - ctx.channel().writeAndFlush(RenderScreenPacket(false)) - ctx.channel().writeAndFlush(mapLoadService.createLoadEntity(newInfo, warpFacing, playerZ)) - ctx.channel().writeAndFlush(MapTransitionAckPacket(0)) + ctx.send(MapTransitionPacket()) + ctx.send(RenderScreenPacket(false)) + ctx.send(mapLoadService.createLoadEntity(newInfo, warpFacing, playerZ)) + ctx.send(MapTransitionAckPacket(0)) if (destMap != null) { - ctx.channel() - .writeAndFlush( - MapManager.createLoadMapPacket( - destMap, - reloadPlayer = true, - deleteCache = true, - )) + ctx.send(mapManager.createLoadMapPacket(destMap, reloadPlayer = true, deleteCache = true)) mapLoadService.preloadConnectedMaps(ctx, destMap, depth = 1, reloadPlayer = true) } else { log.warn { diff --git a/server.game/src/main/kotlin/de/fiereu/openmmo/server/game/session/PlayerSession.kt b/server.game/src/main/kotlin/de/fiereu/openmmo/server/game/session/PlayerSession.kt deleted file mode 100644 index 4567f99..0000000 --- a/server.game/src/main/kotlin/de/fiereu/openmmo/server/game/session/PlayerSession.kt +++ /dev/null @@ -1,76 +0,0 @@ -package de.fiereu.openmmo.server.game.session - -import de.fiereu.openmmo.common.enums.Direction -import io.netty.channel.Channel -import java.util.concurrent.ConcurrentHashMap - -data class ScriptPage( - val type: Int = 0x04, - val unk1: Int, - val unk2: Int, - val unk3: Int, -) - -data class Session( - val channel: Channel, - val userId: Int, - var characterId: Long? = null, - var justWarped: Boolean = false, - var facingDirection: Direction = Direction.DOWN, - var inDialog: Boolean = false, - var dialogNpcEntityId: Long = 0, - var dialogSeqId: Int = 0, - var dialogPages: List = emptyList(), - var dialogPageIndex: Int = 0, - var regionId: Int = 1, - var bankId: Int = 51, - var mapId: Int = 3, - var x: Short = 4, - var y: Short = 2, -) - -object SessionManager { - private val sessionsByChannel = ConcurrentHashMap() - private val sessionsByCharacter = ConcurrentHashMap() - - fun createSession(channel: Channel, userId: Int): Session { - removeSession(channel) - val session = Session(channel, userId) - sessionsByChannel[channel] = session - return session - } - - fun getSessionByChannel(channel: Channel): Session? = sessionsByChannel[channel] - - fun getSessionByCharacterId(characterId: Long): Session? = sessionsByCharacter[characterId] - - fun setActiveCharacter(channel: Channel, characterId: Long) { - val session = sessionsByChannel[channel] ?: return - sessionsByCharacter[characterId] = session - session.characterId = characterId - } - - fun removeSession(channel: Channel) { - val session = sessionsByChannel.remove(channel) - if (session != null && session.characterId != null) { - sessionsByCharacter.remove(session.characterId) - } - } - - fun getOnlineCharacterIds(): Set = sessionsByCharacter.keys - - fun isOnline(characterId: Long): Boolean = sessionsByCharacter.containsKey(characterId) - - fun getOthersInMap( - excludeCharacterId: Long, - regionId: Int, - bankId: Int, - mapId: Int, - ): List = - sessionsByCharacter.values.filter { session -> - session.characterId != excludeCharacterId && - session.regionId == regionId && - session.bankId == bankId && - session.mapId == mapId - } -} diff --git a/server.game/src/main/kotlin/de/fiereu/openmmo/server/game/session/PlayerState.kt b/server.game/src/main/kotlin/de/fiereu/openmmo/server/game/session/PlayerState.kt new file mode 100644 index 0000000..5b74a30 --- /dev/null +++ b/server.game/src/main/kotlin/de/fiereu/openmmo/server/game/session/PlayerState.kt @@ -0,0 +1,27 @@ +package de.fiereu.openmmo.server.game.session + +import de.fiereu.openmmo.common.enums.Direction + +data class ScriptPage( + val type: Int = 0x04, + val unk1: Int, + val unk2: Int, + val unk3: Int, +) + +data class PlayerState( + val userId: Int, + var characterId: Long? = null, + var justWarped: Boolean = false, + var facingDirection: Direction = Direction.DOWN, + var inDialog: Boolean = false, + var dialogNpcEntityId: Long = 0, + var dialogSeqId: Int = 0, + var dialogPages: List = emptyList(), + var dialogPageIndex: Int = 0, + var regionId: Int = 1, + var bankId: Int = 51, + var mapId: Int = 3, + var x: Short = 4, + var y: Short = 2, +) diff --git a/server.game/src/main/kotlin/de/fiereu/openmmo/server/game/session/SessionAttributes.kt b/server.game/src/main/kotlin/de/fiereu/openmmo/server/game/session/SessionAttributes.kt new file mode 100644 index 0000000..73acf21 --- /dev/null +++ b/server.game/src/main/kotlin/de/fiereu/openmmo/server/game/session/SessionAttributes.kt @@ -0,0 +1,5 @@ +package de.fiereu.openmmo.server.game.session + +import de.fiereu.network.SessionAttribute + +val PLAYER_STATE = SessionAttribute.of("playerState") diff --git a/server.game/src/main/kotlin/de/fiereu/openmmo/server/game/session/SessionRegistry.kt b/server.game/src/main/kotlin/de/fiereu/openmmo/server/game/session/SessionRegistry.kt new file mode 100644 index 0000000..b224a26 --- /dev/null +++ b/server.game/src/main/kotlin/de/fiereu/openmmo/server/game/session/SessionRegistry.kt @@ -0,0 +1,54 @@ +package de.fiereu.openmmo.server.game.session + +import de.fiereu.network.SessionContext +import io.netty.channel.Channel +import java.util.concurrent.ConcurrentHashMap +import javax.inject.Inject +import javax.inject.Singleton + +@Singleton +class SessionRegistry @Inject constructor() { + private val sessionsByChannel = ConcurrentHashMap() + private val sessionsByCharacter = ConcurrentHashMap() + + fun register(ctx: SessionContext) { + sessionsByChannel[ctx.channel] = ctx + } + + fun unregister(ctx: SessionContext) { + sessionsByChannel.remove(ctx.channel) + val state = ctx.attributes[PLAYER_STATE] + val charId = state?.characterId + if (charId != null) { + sessionsByCharacter.remove(charId) + } + } + + fun bindCharacter(ctx: SessionContext, characterId: Long) { + sessionsByCharacter[characterId] = ctx + } + + fun unbindCharacter(characterId: Long) { + sessionsByCharacter.remove(characterId) + } + + fun getByCharacterId(id: Long): SessionContext? = sessionsByCharacter[id] + + fun getOthersInMap( + excludeCharacterId: Long, + regionId: Int, + bankId: Int, + mapId: Int, + ): List = + sessionsByCharacter.values.filter { ctx -> + val state = ctx.attributes[PLAYER_STATE] ?: return@filter false + state.characterId != excludeCharacterId && + state.regionId == regionId && + state.bankId == bankId && + state.mapId == mapId + } + + fun onlineCharacterIds(): Set = sessionsByCharacter.keys + + fun isOnline(id: Long): Boolean = sessionsByCharacter.containsKey(id) +} diff --git a/server.game/src/main/kotlin/de/fiereu/openmmo/server/game/session/SessionRegistryHandler.kt b/server.game/src/main/kotlin/de/fiereu/openmmo/server/game/session/SessionRegistryHandler.kt new file mode 100644 index 0000000..f0db3bb --- /dev/null +++ b/server.game/src/main/kotlin/de/fiereu/openmmo/server/game/session/SessionRegistryHandler.kt @@ -0,0 +1,21 @@ +package de.fiereu.openmmo.server.game.session + +import de.fiereu.network.SessionContext +import io.netty.channel.ChannelHandlerContext +import io.netty.channel.ChannelInboundHandlerAdapter + +class SessionRegistryHandler( + private val registry: SessionRegistry, + private val session: SessionContext, +) : ChannelInboundHandlerAdapter() { + + override fun channelActive(ctx: ChannelHandlerContext) { + registry.register(session) + ctx.fireChannelActive() + } + + override fun channelInactive(ctx: ChannelHandlerContext) { + registry.unregister(session) + ctx.fireChannelInactive() + } +} diff --git a/server.game/src/main/kotlin/de/fiereu/openmmo/server/game/storage/CharacterStore.kt b/server.game/src/main/kotlin/de/fiereu/openmmo/server/game/storage/CharacterStore.kt index e137948..6d7ddc9 100644 --- a/server.game/src/main/kotlin/de/fiereu/openmmo/server/game/storage/CharacterStore.kt +++ b/server.game/src/main/kotlin/de/fiereu/openmmo/server/game/storage/CharacterStore.kt @@ -5,6 +5,8 @@ import de.fiereu.openmmo.common.Pokemon import java.time.LocalDateTime import java.util.concurrent.ConcurrentHashMap import java.util.concurrent.atomic.AtomicLong +import javax.inject.Inject +import javax.inject.Singleton data class StoredCharacter( val info: CharacterInfo, @@ -13,11 +15,11 @@ data class StoredCharacter( val items: MutableMap, ) -object CharacterStore { +@Singleton +class CharacterStore @Inject constructor() { private val characters = ConcurrentHashMap() private val charactersByUser = ConcurrentHashMap>() private val nextCharId = AtomicLong(1) - private val nextPokemonId = AtomicLong(1) init { ensureTestCharacter() diff --git a/server.game/src/main/kotlin/de/fiereu/openmmo/server/game/world/MapManager.kt b/server.game/src/main/kotlin/de/fiereu/openmmo/server/game/world/MapManager.kt deleted file mode 100644 index ca5f034..0000000 --- a/server.game/src/main/kotlin/de/fiereu/openmmo/server/game/world/MapManager.kt +++ /dev/null @@ -1,50236 +0,0 @@ -package de.fiereu.openmmo.server.game.world - -import de.fiereu.openmmo.common.Tile2D -import de.fiereu.openmmo.common.enums.EncounterType -import de.fiereu.openmmo.common.enums.Lighting -import de.fiereu.openmmo.common.enums.MapType -import de.fiereu.openmmo.common.enums.Weather -import de.fiereu.openmmo.protocols.game.packets.LoadMapPacket -import de.fiereu.openmmo.protocols.game.packets.MapData -import de.fiereu.openmmo.protocols.game.packets.MapData.GbaConnection - -class MapDef( - val regionId: Byte, - val bankId: Byte, - val mapId: Byte, - val width: Int = 20, - val height: Int = 15, - val paletteIdx1: Int = 12, - val paletteIdx2: Int = 14, - val borderWidth: Int = 2, - val borderHeight: Int = 2, - val unknownShort: Int = 0, - val unknownByte: Int = 0, - val borderTiles: List = listOf(Tile2D(8, 0), Tile2D(8, 0), Tile2D(8, 0), Tile2D(8, 0)), - val lighting: Lighting = Lighting.REGULAR, - val weather: Weather = Weather.REGULAR_WEATHER, - val mapType: MapType = MapType.CITY, - val encounterType: EncounterType = EncounterType.RANDOM, - val wildEncounters: List = emptyList(), - val connections: List = emptyList(), - val warps: List = emptyList(), - val npcs: List = emptyList(), - val bgEvents: List = emptyList(), -) - -data class WildEncounterTable( - val encounterRate: Int, - val pokemon: List, -) - -data class WildPokemon( - val dexId: Int, - val minLevel: Int, - val maxLevel: Int, - val weight: Int, -) - -data class WarpTile( - val x: Int, - val y: Int, - val elevation: Int = 0, - val targetRegionId: Byte, - val targetBankId: Byte, - val targetMapId: Byte, - val targetX: Int, - val targetY: Int, - val targetElevation: Int = 0, - val facingDirection: de.fiereu.openmmo.common.enums.Direction? = null, -) - -data class NpcDef( - val entityIdx: Int, - val graphicsId: Int, - val x: Int, - val y: Int, - val elevation: Int, - val movementType: Int, - val movementRangeX: Int, - val movementRangeY: Int, - val trainerType: Int, - val facing: Int, - val script: String = "0x0", -) - -data class BgEventDef( - val x: Int, - val y: Int, - val facingDir: String, - val script: String, -) - -object MapManager { - private val maps = mutableMapOf() - - init { - registerDefaultMaps0() - registerDefaultMaps1() - registerDefaultMaps2() - registerDefaultMaps3() - registerDefaultMaps4() - registerDefaultMaps5() - registerDefaultMaps6() - registerDefaultMaps7() - registerDefaultMaps8() - } - - private fun registerDefaultMaps0() { - val allMaps = - listOf( - // PetalburgCity (MAP_PETALBURG_CITY) - MapDef( - regionId = 1, - bankId = 50, - mapId = 0, - width = 30, - height = 30, - paletteIdx1 = 100, - paletteIdx2 = 101, - unknownShort = 362, - unknownByte = 7, - borderTiles = - listOf( - Tile2D(0x01D4, 0), Tile2D(0x01D5, 0), Tile2D(0x01DC, 0), Tile2D(0x01DD, 0)), - lighting = Lighting.REGULAR, - weather = Weather.REGULAR_WEATHER, - mapType = MapType.CITY, - encounterType = EncounterType.RANDOM, - connections = - listOf( - GbaConnection( - direction = 3, unknown = -50, targetBank = 50, targetMap = 19), - GbaConnection(direction = 4, unknown = 10, targetBank = 50, targetMap = 17), - ), - warps = - listOf( - WarpTile( - x = 10, - y = 19, - elevation = 0, - targetRegionId = 1, - targetBankId = 58, - targetMapId = 2, - targetX = 3, - targetY = 8, - targetElevation = 0), - WarpTile( - x = 7, - y = 5, - elevation = 0, - targetRegionId = 1, - targetBankId = 58, - targetMapId = 0, - targetX = 3, - targetY = 7, - targetElevation = 0), - WarpTile( - x = 15, - y = 8, - elevation = 0, - targetRegionId = 1, - targetBankId = 58, - targetMapId = 1, - targetX = 4, - targetY = 111, - targetElevation = 2), - WarpTile( - x = 20, - y = 16, - elevation = 0, - targetRegionId = 1, - targetBankId = 58, - targetMapId = 4, - targetX = 7, - targetY = 8, - targetElevation = 2), - WarpTile( - x = 20, - y = 24, - elevation = 0, - targetRegionId = 1, - targetBankId = 58, - targetMapId = 3, - targetX = 3, - targetY = 7, - targetElevation = 0), - WarpTile( - x = 25, - y = 12, - elevation = 0, - targetRegionId = 1, - targetBankId = 58, - targetMapId = 6, - targetX = 3, - targetY = 7, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 2, - graphicsId = 7, - x = 8, - y = 22, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "PetalburgCity_EventScript_Boy"), - NpcDef( - entityIdx = 3, - graphicsId = 48, - x = 20, - y = 10, - elevation = 3, - movementType = 3, - movementRangeX = 0, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "PetalburgCity_EventScript_Gentleman"), - NpcDef( - entityIdx = 7, - graphicsId = 9, - x = 12, - y = 15, - elevation = 3, - movementType = 1, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "PetalburgCity_EventScript_GymBoy"), - ), - bgEvents = - listOf( - BgEventDef( - x = 17, - y = 10, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "PetalburgCity_EventScript_GymSign"), - BgEventDef( - x = 26, - y = 12, - facingDir = "BG_EVENT_PLAYER_FACING_NORTH", - script = "Common_EventScript_ShowPokemartSign"), - BgEventDef( - x = 21, - y = 16, - facingDir = "BG_EVENT_PLAYER_FACING_NORTH", - script = "Common_EventScript_ShowPokemonCenterSign"), - BgEventDef( - x = 17, - y = 16, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "PetalburgCity_EventScript_CitySign"), - BgEventDef( - x = 22, - y = 16, - facingDir = "BG_EVENT_PLAYER_FACING_NORTH", - script = "Common_EventScript_ShowPokemonCenterSign"), - BgEventDef( - x = 27, - y = 12, - facingDir = "BG_EVENT_PLAYER_FACING_NORTH", - script = "Common_EventScript_ShowPokemartSign"), - BgEventDef( - x = 8, - y = 9, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "PetalburgCity_EventScript_WallyHouseSign"), - BgEventDef( - x = 11, - y = 29, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - ), - ), - // SlateportCity (MAP_SLATEPORT_CITY) - MapDef( - regionId = 1, - bankId = 50, - mapId = 1, - width = 40, - height = 60, - paletteIdx1 = 100, - paletteIdx2 = 104, - unknownShort = 433, - unknownByte = 8, - borderTiles = - listOf( - Tile2D(0x0170, 0), Tile2D(0x0170, 0), Tile2D(0x0170, 0), Tile2D(0x0170, 0)), - lighting = Lighting.REGULAR, - weather = Weather.REGULAR_WEATHER, - mapType = MapType.CITY, - encounterType = EncounterType.RANDOM, - connections = - listOf( - GbaConnection(direction = 2, unknown = 0, targetBank = 50, targetMap = 25), - GbaConnection(direction = 1, unknown = 0, targetBank = 50, targetMap = 24), - GbaConnection(direction = 4, unknown = 0, targetBank = 50, targetMap = 49), - ), - warps = - listOf( - WarpTile( - x = 19, - y = 19, - elevation = 0, - targetRegionId = 1, - targetBankId = 59, - targetMapId = 11, - targetX = 7, - targetY = 8, - targetElevation = 2), - WarpTile( - x = 13, - y = 26, - elevation = 0, - targetRegionId = 1, - targetBankId = 59, - targetMapId = 13, - targetX = 3, - targetY = 7, - targetElevation = 0), - WarpTile( - x = 26, - y = 38, - elevation = 0, - targetRegionId = 1, - targetBankId = 59, - targetMapId = 0, - targetX = 2, - targetY = 14, - targetElevation = 0), - WarpTile( - x = 10, - y = 12, - elevation = 0, - targetRegionId = 1, - targetBankId = 59, - targetMapId = 2, - targetX = 6, - targetY = 9, - targetElevation = 0), - WarpTile( - x = 4, - y = 26, - elevation = 0, - targetRegionId = 1, - targetBankId = 59, - targetMapId = 6, - targetX = 6, - targetY = 10, - targetElevation = 0), - WarpTile( - x = 30, - y = 26, - elevation = 0, - targetRegionId = 1, - targetBankId = 59, - targetMapId = 7, - targetX = 9, - targetY = 8, - targetElevation = 0), - WarpTile( - x = 5, - y = 19, - elevation = 0, - targetRegionId = 1, - targetBankId = 59, - targetMapId = 5, - targetX = 3, - targetY = 7, - targetElevation = 0), - WarpTile( - x = 31, - y = 26, - elevation = 0, - targetRegionId = 1, - targetBankId = 59, - targetMapId = 7, - targetX = 10, - targetY = 8, - targetElevation = 0), - WarpTile( - x = 28, - y = 12, - elevation = 0, - targetRegionId = 1, - targetBankId = 59, - targetMapId = 9, - targetX = 11, - targetY = 14, - targetElevation = 0), - WarpTile( - x = 40, - y = 7, - elevation = 0, - targetRegionId = 1, - targetBankId = 59, - targetMapId = 9, - targetX = 19, - targetY = 15, - targetElevation = 0), - WarpTile( - x = 21, - y = 44, - elevation = 0, - targetRegionId = 1, - targetBankId = 59, - targetMapId = 10, - targetX = 3, - targetY = 7, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 17, - x = 21, - y = 11, - elevation = 3, - movementType = 2, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "SlateportCity_EventScript_FatMan"), - NpcDef( - entityIdx = 1, - graphicsId = 19, - x = 34, - y = 29, - elevation = 3, - movementType = 5, - movementRangeX = 1, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "SlateportCity_EventScript_Man1"), - NpcDef( - entityIdx = 2, - graphicsId = 15, - x = 5, - y = 13, - elevation = 3, - movementType = 2, - movementRangeX = 1, - movementRangeY = 2, - trainerType = 0, - facing = 0, - script = "SlateportCity_EventScript_RichBoy"), - NpcDef( - entityIdx = 3, - graphicsId = 26, - x = 26, - y = 29, - elevation = 3, - movementType = 1, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "SlateportCity_EventScript_Woman1"), - NpcDef( - entityIdx = 5, - graphicsId = 27, - x = 5, - y = 43, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "SlateportCity_EventScript_Cook"), - NpcDef( - entityIdx = 6, - graphicsId = 30, - x = 20, - y = 37, - elevation = 3, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "SlateportCity_EventScript_OldWoman"), - NpcDef( - entityIdx = 7, - graphicsId = 8, - x = 8, - y = 42, - elevation = 3, - movementType = 2, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "SlateportCity_EventScript_Girl"), - NpcDef( - entityIdx = 11, - graphicsId = 49, - x = 37, - y = 41, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 3, - script = "SlateportCity_EventScript_Sailor1"), - NpcDef( - entityIdx = 12, - graphicsId = 49, - x = 28, - y = 46, - elevation = 3, - movementType = 5, - movementRangeX = 1, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "SlateportCity_EventScript_Sailor2"), - NpcDef( - entityIdx = 13, - graphicsId = 18, - x = 9, - y = 50, - elevation = 3, - movementType = 3, - movementRangeX = 0, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "SlateportCity_EventScript_PokefanF"), - NpcDef( - entityIdx = 14, - graphicsId = 33, - x = 16, - y = 46, - elevation = 3, - movementType = 2, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "SlateportCity_EventScript_Man2"), - NpcDef( - entityIdx = 15, - graphicsId = 39, - x = 8, - y = 24, - elevation = 3, - movementType = 3, - movementRangeX = 0, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "SlateportCity_EventScript_Maniac"), - NpcDef( - entityIdx = 16, - graphicsId = 34, - x = 15, - y = 31, - elevation = 3, - movementType = 1, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "SlateportCity_EventScript_Woman2"), - NpcDef( - entityIdx = 19, - graphicsId = 83, - x = 6, - y = 38, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 3, - script = "SlateportCity_EventScript_DecorClerk"), - NpcDef( - entityIdx = 20, - graphicsId = 83, - x = 5, - y = 51, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "SlateportCity_EventScript_DollClerk"), - NpcDef( - entityIdx = 21, - graphicsId = 66, - x = 34, - y = 51, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "SlateportCity_EventScript_Man3"), - NpcDef( - entityIdx = 22, - graphicsId = 34, - x = 4, - y = 47, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "SlateportCity_EventScript_EffortRibbonWoman"), - NpcDef( - entityIdx = 24, - graphicsId = 25, - x = 5, - y = 47, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "SlateportCity_EventScript_EnergyGuru"), - NpcDef( - entityIdx = 33, - graphicsId = 18, - x = 11, - y = 37, - elevation = 3, - movementType = 9, - movementRangeX = 1, - movementRangeY = 2, - trainerType = 0, - facing = 2, - script = "SlateportCity_EventScript_BerryPowderClerk"), - ), - bgEvents = - listOf( - BgEventDef( - x = 8, - y = 19, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "SlateportCity_EventScript_NameRatersHouseSign"), - BgEventDef( - x = 20, - y = 19, - facingDir = "BG_EVENT_PLAYER_FACING_NORTH", - script = "Common_EventScript_ShowPokemonCenterSign"), - BgEventDef( - x = 21, - y = 19, - facingDir = "BG_EVENT_PLAYER_FACING_NORTH", - script = "Common_EventScript_ShowPokemonCenterSign"), - BgEventDef( - x = 14, - y = 26, - facingDir = "BG_EVENT_PLAYER_FACING_NORTH", - script = "Common_EventScript_ShowPokemartSign"), - BgEventDef( - x = 24, - y = 12, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "SlateportCity_EventScript_HarborSign"), - BgEventDef( - x = 15, - y = 26, - facingDir = "BG_EVENT_PLAYER_FACING_NORTH", - script = "Common_EventScript_ShowPokemartSign"), - BgEventDef( - x = 14, - y = 51, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "SlateportCity_EventScript_MarketSign"), - BgEventDef( - x = 26, - y = 26, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "SlateportCity_EventScript_OceanicMuseumSign"), - BgEventDef( - x = 16, - y = 22, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "SlateportCity_EventScript_CitySign"), - BgEventDef( - x = 8, - y = 26, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "SlateportCity_EventScript_PokemonFanClubSign"), - BgEventDef( - x = 7, - y = 13, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "SlateportCity_EventScript_BattleTentSign"), - BgEventDef( - x = 23, - y = 38, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "SlateportCity_EventScript_SternsShipyardSign"), - BgEventDef( - x = 10, - y = 36, - facingDir = "BG_EVENT_PLAYER_FACING_NORTH", - script = "SlateportCity_EventScript_BerryCrushRankingsSign"), - ), - ), - // MauvilleCity (MAP_MAUVILLE_CITY) - MapDef( - regionId = 1, - bankId = 50, - mapId = 2, - width = 40, - height = 20, - paletteIdx1 = 100, - paletteIdx2 = 105, - unknownShort = 399, - unknownByte = 9, - borderTiles = - listOf( - Tile2D(0x0170, 0), Tile2D(0x0170, 0), Tile2D(0x0170, 0), Tile2D(0x0170, 0)), - lighting = Lighting.REGULAR, - weather = Weather.REGULAR_WEATHER, - mapType = MapType.CITY, - encounterType = EncounterType.RANDOM, - connections = - listOf( - GbaConnection(direction = 2, unknown = 0, targetBank = 50, targetMap = 26), - GbaConnection(direction = 1, unknown = 0, targetBank = 50, targetMap = 25), - GbaConnection(direction = 3, unknown = 0, targetBank = 50, targetMap = 32), - GbaConnection(direction = 4, unknown = 0, targetBank = 50, targetMap = 33), - ), - warps = - listOf( - WarpTile( - x = 8, - y = 5, - elevation = 0, - targetRegionId = 1, - targetBankId = 60, - targetMapId = 0, - targetX = 4, - targetY = 20, - targetElevation = 0), - WarpTile( - x = 22, - y = 5, - elevation = 0, - targetRegionId = 1, - targetBankId = 60, - targetMapId = 5, - targetX = 7, - targetY = 8, - targetElevation = 2), - WarpTile( - x = 35, - y = 5, - elevation = 0, - targetRegionId = 1, - targetBankId = 60, - targetMapId = 1, - targetX = 3, - targetY = 8, - targetElevation = 0), - WarpTile( - x = 23, - y = 14, - elevation = 0, - targetRegionId = 1, - targetBankId = 60, - targetMapId = 7, - targetX = 3, - targetY = 7, - targetElevation = 0), - WarpTile( - x = 32, - y = 14, - elevation = 0, - targetRegionId = 1, - targetBankId = 60, - targetMapId = 2, - targetX = 3, - targetY = 7, - targetElevation = 0), - WarpTile( - x = 8, - y = 13, - elevation = 0, - targetRegionId = 1, - targetBankId = 60, - targetMapId = 3, - targetX = 11, - targetY = 10, - targetElevation = 2), - WarpTile( - x = 19, - y = 14, - elevation = 0, - targetRegionId = 1, - targetBankId = 60, - targetMapId = 4, - targetX = 3, - targetY = 8, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 13, - x = 29, - y = 16, - elevation = 3, - movementType = 5, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "MauvilleCity_EventScript_Boy"), - NpcDef( - entityIdx = 1, - graphicsId = 15, - x = 24, - y = 10, - elevation = 3, - movementType = 5, - movementRangeX = 1, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "MauvilleCity_EventScript_RichBoy"), - NpcDef( - entityIdx = 2, - graphicsId = 39, - x = 14, - y = 11, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 3, - script = "MauvilleCity_EventScript_Maniac"), - NpcDef( - entityIdx = 3, - graphicsId = 26, - x = 18, - y = 6, - elevation = 3, - movementType = 1, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "MauvilleCity_EventScript_Woman"), - NpcDef( - entityIdx = 4, - graphicsId = 38, - x = 17, - y = 14, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "MauvilleCity_EventScript_SchoolKidM"), - NpcDef( - entityIdx = 9, - graphicsId = 17, - x = 13, - y = 7, - elevation = 3, - movementType = 9, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 2, - script = "MauvilleCity_EventScript_RolloutTutor"), - ), - bgEvents = - listOf( - BgEventDef( - x = 23, - y = 5, - facingDir = "BG_EVENT_PLAYER_FACING_NORTH", - script = "Common_EventScript_ShowPokemonCenterSign"), - BgEventDef( - x = 11, - y = 6, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "MauvilleCity_EventScript_GymSign"), - BgEventDef( - x = 24, - y = 14, - facingDir = "BG_EVENT_PLAYER_FACING_NORTH", - script = "Common_EventScript_ShowPokemartSign"), - BgEventDef( - x = 25, - y = 14, - facingDir = "BG_EVENT_PLAYER_FACING_NORTH", - script = "Common_EventScript_ShowPokemartSign"), - BgEventDef( - x = 24, - y = 5, - facingDir = "BG_EVENT_PLAYER_FACING_NORTH", - script = "Common_EventScript_ShowPokemonCenterSign"), - BgEventDef( - x = 19, - y = 7, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "MauvilleCity_EventScript_CitySign"), - BgEventDef( - x = 33, - y = 6, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "MauvilleCity_EventScript_BikeShopSign"), - BgEventDef( - x = 11, - y = 15, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "MauvilleCity_EventScript_GameCornerSign"), - ), - ), - // RustboroCity (MAP_RUSTBORO_CITY) - MapDef( - regionId = 1, - bankId = 50, - mapId = 3, - width = 40, - height = 60, - paletteIdx1 = 100, - paletteIdx2 = 102, - unknownShort = 399, - unknownByte = 10, - borderTiles = - listOf( - Tile2D(0x01D4, 0), Tile2D(0x01D5, 0), Tile2D(0x01DC, 0), Tile2D(0x01DD, 0)), - lighting = Lighting.REGULAR, - weather = Weather.REGULAR_WEATHER, - mapType = MapType.CITY, - encounterType = EncounterType.RANDOM, - connections = - listOf( - GbaConnection(direction = 2, unknown = 0, targetBank = 50, targetMap = 30), - GbaConnection(direction = 1, unknown = 0, targetBank = 50, targetMap = 19), - GbaConnection(direction = 4, unknown = 0, targetBank = 50, targetMap = 31), - ), - warps = - listOf( - WarpTile( - x = 27, - y = 19, - elevation = 0, - targetRegionId = 1, - targetBankId = 61, - targetMapId = 3, - targetX = 5, - targetY = 19, - targetElevation = 0), - WarpTile( - x = 13, - y = 30, - elevation = 0, - targetRegionId = 1, - targetBankId = 61, - targetMapId = 8, - targetX = 6, - targetY = 7, - targetElevation = 0), - WarpTile( - x = 16, - y = 45, - elevation = 0, - targetRegionId = 1, - targetBankId = 61, - targetMapId = 7, - targetX = 3, - targetY = 7, - targetElevation = 0), - WarpTile( - x = 16, - y = 38, - elevation = 0, - targetRegionId = 1, - targetBankId = 61, - targetMapId = 5, - targetX = 7, - targetY = 8, - targetElevation = 2), - WarpTile( - x = 27, - y = 34, - elevation = 0, - targetRegionId = 1, - targetBankId = 61, - targetMapId = 4, - targetX = 5, - targetY = 10, - targetElevation = 0), - WarpTile( - x = 11, - y = 15, - elevation = 0, - targetRegionId = 1, - targetBankId = 61, - targetMapId = 0, - targetX = 5, - targetY = 8, - targetElevation = 0), - WarpTile( - x = 12, - y = 15, - elevation = 0, - targetRegionId = 1, - targetBankId = 61, - targetMapId = 0, - targetX = 6, - targetY = 8, - targetElevation = 0), - WarpTile( - x = 33, - y = 19, - elevation = 0, - targetRegionId = 1, - targetBankId = 61, - targetMapId = 10, - targetX = 5, - targetY = 7, - targetElevation = 0), - WarpTile( - x = 9, - y = 38, - elevation = 0, - targetRegionId = 1, - targetBankId = 61, - targetMapId = 11, - targetX = 5, - targetY = 8, - targetElevation = 0), - WarpTile( - x = 30, - y = 28, - elevation = 0, - targetRegionId = 1, - targetBankId = 61, - targetMapId = 12, - targetX = 5, - targetY = 8, - targetElevation = 0), - WarpTile( - x = 5, - y = 51, - elevation = 0, - targetRegionId = 1, - targetBankId = 61, - targetMapId = 13, - targetX = 2, - targetY = 8, - targetElevation = 0), - WarpTile( - x = 26, - y = 46, - elevation = 0, - targetRegionId = 1, - targetBankId = 61, - targetMapId = 16, - targetX = 5, - targetY = 8, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 34, - x = 22, - y = 34, - elevation = 3, - movementType = 3, - movementRangeX = 0, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "RustboroCity_EventScript_Woman"), - NpcDef( - entityIdx = 1, - graphicsId = 17, - x = 19, - y = 13, - elevation = 3, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "RustboroCity_EventScript_FatMan"), - NpcDef( - entityIdx = 2, - graphicsId = 5, - x = 25, - y = 37, - elevation = 3, - movementType = 7, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 1, - script = "RustboroCity_EventScript_NinjaBoy"), - NpcDef( - entityIdx = 3, - graphicsId = 6, - x = 21, - y = 46, - elevation = 3, - movementType = 3, - movementRangeX = 0, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "RustboroCity_EventScript_Twin"), - NpcDef( - entityIdx = 4, - graphicsId = 9, - x = 12, - y = 45, - elevation = 3, - movementType = 1, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "RustboroCity_EventScript_Boy2"), - NpcDef( - entityIdx = 5, - graphicsId = 33, - x = 26, - y = 23, - elevation = 3, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "RustboroCity_EventScript_Man1"), - NpcDef( - entityIdx = 6, - graphicsId = 11, - x = 24, - y = 51, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 3, - script = "RustboroCity_EventScript_LittleBoy"), - NpcDef( - entityIdx = 7, - graphicsId = 12, - x = 25, - y = 51, - elevation = 3, - movementType = 9, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 2, - script = "RustboroCity_EventScript_LittleGirl"), - NpcDef( - entityIdx = 10, - graphicsId = 0, - x = 13, - y = 34, - elevation = 3, - movementType = 2, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "RustboroCity_EventScript_DevonEmployee2"), - NpcDef( - entityIdx = 12, - graphicsId = 65, - x = 19, - y = 27, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "RustboroCity_EventScript_Man2"), - NpcDef( - entityIdx = 15, - graphicsId = 7, - x = 31, - y = 36, - elevation = 3, - movementType = 1, - movementRangeX = 0, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "RustboroCity_EventScript_Boy1"), - ), - bgEvents = - listOf( - BgEventDef( - x = 23, - y = 19, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "RustboroCity_EventScript_GymSign"), - BgEventDef( - x = 25, - y = 35, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "RustboroCity_EventScript_TrainersSchoolSign"), - BgEventDef( - x = 17, - y = 45, - facingDir = "BG_EVENT_PLAYER_FACING_NORTH", - script = "Common_EventScript_ShowPokemartSign"), - BgEventDef( - x = 18, - y = 38, - facingDir = "BG_EVENT_PLAYER_FACING_NORTH", - script = "Common_EventScript_ShowPokemonCenterSign"), - BgEventDef( - x = 19, - y = 49, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "RustboroCity_EventScript_CitySign"), - BgEventDef( - x = 18, - y = 45, - facingDir = "BG_EVENT_PLAYER_FACING_NORTH", - script = "Common_EventScript_ShowPokemartSign"), - BgEventDef( - x = 17, - y = 38, - facingDir = "BG_EVENT_PLAYER_FACING_NORTH", - script = "Common_EventScript_ShowPokemonCenterSign"), - BgEventDef( - x = 17, - y = 20, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "RustboroCity_EventScript_DevonCorpSign"), - BgEventDef( - x = 30, - y = 8, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "RustboroCity_EventScript_TunnelSign"), - BgEventDef( - x = 12, - y = 38, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "RustboroCity_EventScript_CuttersHouseSign"), - ), - ), - // FortreeCity (MAP_FORTREE_CITY) - MapDef( - regionId = 1, - bankId = 50, - mapId = 4, - width = 40, - height = 20, - paletteIdx1 = 100, - paletteIdx2 = 108, - unknownShort = 382, - unknownByte = 11, - borderTiles = - listOf( - Tile2D(0x00C6, 0), Tile2D(0x00C6, 0), Tile2D(0x00C6, 0), Tile2D(0x00C6, 0)), - lighting = Lighting.REGULAR, - weather = Weather.REGULAR_WEATHER, - mapType = MapType.CITY, - encounterType = EncounterType.RANDOM, - connections = - listOf( - GbaConnection(direction = 3, unknown = 0, targetBank = 50, targetMap = 34), - GbaConnection(direction = 4, unknown = 0, targetBank = 50, targetMap = 35), - ), - warps = - listOf( - WarpTile( - x = 5, - y = 6, - elevation = 0, - targetRegionId = 1, - targetBankId = 62, - targetMapId = 2, - targetX = 7, - targetY = 8, - targetElevation = 2), - WarpTile( - x = 10, - y = 3, - elevation = 0, - targetRegionId = 1, - targetBankId = 62, - targetMapId = 0, - targetX = 3, - targetY = 5, - targetElevation = 0), - WarpTile( - x = 22, - y = 11, - elevation = 0, - targetRegionId = 1, - targetBankId = 62, - targetMapId = 1, - targetX = 15, - targetY = 24, - targetElevation = 0), - WarpTile( - x = 4, - y = 14, - elevation = 0, - targetRegionId = 1, - targetBankId = 62, - targetMapId = 4, - targetX = 3, - targetY = 7, - targetElevation = 0), - WarpTile( - x = 17, - y = 3, - elevation = 0, - targetRegionId = 1, - targetBankId = 62, - targetMapId = 5, - targetX = 3, - targetY = 5, - targetElevation = 0), - WarpTile( - x = 25, - y = 3, - elevation = 0, - targetRegionId = 1, - targetBankId = 62, - targetMapId = 6, - targetX = 3, - targetY = 5, - targetElevation = 0), - WarpTile( - x = 32, - y = 2, - elevation = 0, - targetRegionId = 1, - targetBankId = 62, - targetMapId = 7, - targetX = 3, - targetY = 5, - targetElevation = 0), - WarpTile( - x = 12, - y = 13, - elevation = 0, - targetRegionId = 1, - targetBankId = 62, - targetMapId = 8, - targetX = 3, - targetY = 5, - targetElevation = 0), - WarpTile( - x = 37, - y = 13, - elevation = 0, - targetRegionId = 1, - targetBankId = 62, - targetMapId = 9, - targetX = 3, - targetY = 5, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 23, - x = 31, - y = 3, - elevation = 4, - movementType = 1, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "FortreeCity_EventScript_Man"), - NpcDef( - entityIdx = 1, - graphicsId = 8, - x = 32, - y = 16, - elevation = 3, - movementType = 2, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "FortreeCity_EventScript_Girl"), - NpcDef( - entityIdx = 2, - graphicsId = 34, - x = 32, - y = 10, - elevation = 3, - movementType = 3, - movementRangeX = 0, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "FortreeCity_EventScript_Woman"), - NpcDef( - entityIdx = 3, - graphicsId = 7, - x = 11, - y = 14, - elevation = 4, - movementType = 1, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "FortreeCity_EventScript_Boy"), - NpcDef( - entityIdx = 4, - graphicsId = 29, - x = 8, - y = 10, - elevation = 3, - movementType = 1, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "FortreeCity_EventScript_OldMan"), - NpcDef( - entityIdx = 5, - graphicsId = 0, - x = 9, - y = 16, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "FortreeCity_EventScript_GameboyKid"), - ), - bgEvents = - listOf( - BgEventDef( - x = 6, - y = 9, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "FortreeCity_EventScript_CitySign"), - BgEventDef( - x = 7, - y = 6, - facingDir = "BG_EVENT_PLAYER_FACING_NORTH", - script = "Common_EventScript_ShowPokemonCenterSign"), - BgEventDef( - x = 5, - y = 14, - facingDir = "BG_EVENT_PLAYER_FACING_NORTH", - script = "Common_EventScript_ShowPokemartSign"), - BgEventDef( - x = 26, - y = 10, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "FortreeCity_EventScript_GymSign"), - BgEventDef( - x = 6, - y = 6, - facingDir = "BG_EVENT_PLAYER_FACING_NORTH", - script = "Common_EventScript_ShowPokemonCenterSign"), - BgEventDef( - x = 6, - y = 14, - facingDir = "BG_EVENT_PLAYER_FACING_NORTH", - script = "Common_EventScript_ShowPokemartSign"), - ), - ), - // LilycoveCity (MAP_LILYCOVE_CITY) - MapDef( - regionId = 1, - bankId = 50, - mapId = 5, - width = 80, - height = 40, - paletteIdx1 = 100, - paletteIdx2 = 109, - unknownShort = 408, - unknownByte = 12, - borderTiles = - listOf( - Tile2D(0x0170, 0), Tile2D(0x0170, 0), Tile2D(0x0170, 0), Tile2D(0x0170, 0)), - lighting = Lighting.REGULAR, - weather = Weather.REGULAR_WEATHER, - mapType = MapType.CITY, - encounterType = EncounterType.RANDOM, - connections = - listOf( - GbaConnection(direction = 3, unknown = 10, targetBank = 50, targetMap = 36), - GbaConnection( - direction = 4, unknown = -10, targetBank = 50, targetMap = 39), - ), - warps = - listOf( - WarpTile( - x = 27, - y = 6, - elevation = 0, - targetRegionId = 1, - targetBankId = 63, - targetMapId = 16, - targetX = 8, - targetY = 7, - targetElevation = 0), - WarpTile( - x = 37, - y = 24, - elevation = 0, - targetRegionId = 1, - targetBankId = 63, - targetMapId = 0, - targetX = 5, - targetY = 8, - targetElevation = 0), - WarpTile( - x = 24, - y = 14, - elevation = 0, - targetRegionId = 1, - targetBankId = 63, - targetMapId = 6, - targetX = 7, - targetY = 8, - targetElevation = 2), - WarpTile( - x = 11, - y = 5, - elevation = 0, - targetRegionId = 1, - targetBankId = 63, - targetMapId = 2, - targetX = 9, - targetY = 13, - targetElevation = 0), - WarpTile( - x = 23, - y = 24, - elevation = 0, - targetRegionId = 1, - targetBankId = 63, - targetMapId = 4, - targetX = 14, - targetY = 11, - targetElevation = 0), - WarpTile( - x = 39, - y = 14, - elevation = 0, - targetRegionId = 1, - targetBankId = 63, - targetMapId = 9, - targetX = 5, - targetY = 13, - targetElevation = 0), - WarpTile( - x = 70, - y = 5, - elevation = 0, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 23, - targetX = 13, - targetY = 27, - targetElevation = 0), - WarpTile( - x = 36, - y = 6, - elevation = 0, - targetRegionId = 1, - targetBankId = 63, - targetMapId = 11, - targetX = 3, - targetY = 7, - targetElevation = 0), - WarpTile( - x = 42, - y = 6, - elevation = 0, - targetRegionId = 1, - targetBankId = 63, - targetMapId = 12, - targetX = 3, - targetY = 8, - targetElevation = 0), - WarpTile( - x = 55, - y = 15, - elevation = 0, - targetRegionId = 1, - targetBankId = 63, - targetMapId = 13, - targetX = 2, - targetY = 7, - targetElevation = 0), - WarpTile( - x = 11, - y = 22, - elevation = 0, - targetRegionId = 1, - targetBankId = 63, - targetMapId = 14, - targetX = 3, - targetY = 7, - targetElevation = 0), - WarpTile( - x = 12, - y = 14, - elevation = 0, - targetRegionId = 1, - targetBankId = 63, - targetMapId = 15, - targetX = 3, - targetY = 8, - targetElevation = 0), - WarpTile( - x = 12, - y = 32, - elevation = 0, - targetRegionId = 1, - targetBankId = 63, - targetMapId = 10, - targetX = 11, - targetY = 14, - targetElevation = 0), - WarpTile( - x = 12, - y = 5, - elevation = 0, - targetRegionId = 1, - targetBankId = 63, - targetMapId = 2, - targetX = 10, - targetY = 13, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 49, - x = 32, - y = 20, - elevation = 3, - movementType = 3, - movementRangeX = 0, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "LilycoveCity_EventScript_Sailor2"), - NpcDef( - entityIdx = 1, - graphicsId = 8, - x = 15, - y = 18, - elevation = 3, - movementType = 2, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "LilycoveCity_EventScript_Girl"), - NpcDef( - entityIdx = 2, - graphicsId = 19, - x = 28, - y = 28, - elevation = 3, - movementType = 1, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "LilycoveCity_EventScript_Man3"), - NpcDef( - entityIdx = 3, - graphicsId = 15, - x = 21, - y = 15, - elevation = 3, - movementType = 2, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "LilycoveCity_EventScript_RichBoy"), - NpcDef( - entityIdx = 4, - graphicsId = 23, - x = 16, - y = 9, - elevation = 5, - movementType = 5, - movementRangeX = 1, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "LilycoveCity_EventScript_Man2"), - NpcDef( - entityIdx = 5, - graphicsId = 20, - x = 35, - y = 27, - elevation = 3, - movementType = 2, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "LilycoveCity_EventScript_Woman2"), - NpcDef( - entityIdx = 6, - graphicsId = 21, - x = 35, - y = 37, - elevation = 5, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "LilycoveCity_EventScript_ExpertM1"), - NpcDef( - entityIdx = 7, - graphicsId = 22, - x = 34, - y = 37, - elevation = 5, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "LilycoveCity_EventScript_ExpertF"), - NpcDef( - entityIdx = 8, - graphicsId = 21, - x = 57, - y = 17, - elevation = 3, - movementType = 1, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "LilycoveCity_EventScript_ExpertM2"), - NpcDef( - entityIdx = 15, - graphicsId = 48, - x = 50, - y = 7, - elevation = 5, - movementType = 2, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "LilycoveCity_EventScript_BerryGentleman"), - NpcDef( - entityIdx = 17, - graphicsId = 38, - x = 16, - y = 23, - elevation = 3, - movementType = 10, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 3, - script = "LilycoveCity_EventScript_SchoolKidM"), - NpcDef( - entityIdx = 18, - graphicsId = 24, - x = 41, - y = 25, - elevation = 3, - movementType = 9, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 2, - script = "LilycoveCity_EventScript_Woman1"), - NpcDef( - entityIdx = 19, - graphicsId = 23, - x = 40, - y = 25, - elevation = 3, - movementType = 10, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 3, - script = "LilycoveCity_EventScript_Man1"), - NpcDef( - entityIdx = 20, - graphicsId = 49, - x = 16, - y = 34, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "LilycoveCity_EventScript_Sailor1"), - NpcDef( - entityIdx = 21, - graphicsId = 17, - x = 16, - y = 35, - elevation = 3, - movementType = 7, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 1, - script = "LilycoveCity_EventScript_FatMan"), - ), - bgEvents = - listOf( - BgEventDef( - x = 19, - y = 7, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "LilycoveCity_EventScript_MuseumSign"), - BgEventDef( - x = 25, - y = 14, - facingDir = "BG_EVENT_PLAYER_FACING_NORTH", - script = "Common_EventScript_ShowPokemonCenterSign"), - BgEventDef( - x = 29, - y = 7, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "LilycoveCity_EventScript_DepartmentStoreSign"), - BgEventDef( - x = 26, - y = 14, - facingDir = "BG_EVENT_PLAYER_FACING_NORTH", - script = "Common_EventScript_ShowPokemonCenterSign"), - BgEventDef( - x = 6, - y = 15, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "LilycoveCity_EventScript_CitySign"), - BgEventDef( - x = 29, - y = 24, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "LilycoveCity_EventScript_ContestHallSign"), - BgEventDef( - x = 35, - y = 24, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "LilycoveCity_EventScript_MotelSign"), - BgEventDef( - x = 6, - y = 30, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "LilycoveCity_EventScript_HarborSign"), - BgEventDef( - x = 36, - y = 14, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "LilycoveCity_EventScript_TrainerFanClubSign"), - BgEventDef( - x = 34, - y = 6, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "LilycoveCity_EventScript_MoveDeletersHouseSign"), - BgEventDef( - x = 36, - y = 31, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 61, - y = 7, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 64, - y = 31, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - ), - ), - // MossdeepCity (MAP_MOSSDEEP_CITY) - MapDef( - regionId = 1, - bankId = 50, - mapId = 6, - width = 80, - height = 40, - paletteIdx1 = 100, - paletteIdx2 = 110, - unknownShort = 399, - unknownByte = 13, - borderTiles = - listOf( - Tile2D(0x0170, 0), Tile2D(0x0170, 0), Tile2D(0x0170, 0), Tile2D(0x0170, 0)), - lighting = Lighting.REGULAR, - weather = Weather.REGULAR_WEATHER, - mapType = MapType.CITY, - encounterType = EncounterType.RANDOM, - connections = - listOf( - GbaConnection(direction = 2, unknown = 0, targetBank = 50, targetMap = 40), - GbaConnection(direction = 1, unknown = 0, targetBank = 50, targetMap = 42), - GbaConnection( - direction = 3, unknown = -40, targetBank = 50, targetMap = 39), - ), - warps = - listOf( - WarpTile( - x = 28, - y = 9, - elevation = 0, - targetRegionId = 1, - targetBankId = 64, - targetMapId = 1, - targetX = 3, - targetY = 7, - targetElevation = 0), - WarpTile( - x = 38, - y = 9, - elevation = 0, - targetRegionId = 1, - targetBankId = 64, - targetMapId = 0, - targetX = 6, - targetY = 35, - targetElevation = 2), - WarpTile( - x = 28, - y = 16, - elevation = 0, - targetRegionId = 1, - targetBankId = 64, - targetMapId = 3, - targetX = 7, - targetY = 8, - targetElevation = 2), - WarpTile( - x = 67, - y = 25, - elevation = 0, - targetRegionId = 1, - targetBankId = 64, - targetMapId = 2, - targetX = 3, - targetY = 8, - targetElevation = 0), - WarpTile( - x = 37, - y = 18, - elevation = 0, - targetRegionId = 1, - targetBankId = 64, - targetMapId = 5, - targetX = 3, - targetY = 7, - targetElevation = 0), - WarpTile( - x = 49, - y = 6, - elevation = 0, - targetRegionId = 1, - targetBankId = 64, - targetMapId = 6, - targetX = 3, - targetY = 7, - targetElevation = 0), - WarpTile( - x = 19, - y = 10, - elevation = 0, - targetRegionId = 1, - targetBankId = 64, - targetMapId = 7, - targetX = 3, - targetY = 7, - targetElevation = 0), - WarpTile( - x = 18, - y = 16, - elevation = 0, - targetRegionId = 1, - targetBankId = 64, - targetMapId = 8, - targetX = 3, - targetY = 7, - targetElevation = 0), - WarpTile( - x = 64, - y = 15, - elevation = 0, - targetRegionId = 1, - targetBankId = 64, - targetMapId = 9, - targetX = 7, - targetY = 9, - targetElevation = 0), - WarpTile( - x = 36, - y = 24, - elevation = 0, - targetRegionId = 1, - targetBankId = 64, - targetMapId = 11, - targetX = 5, - targetY = 9, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 49, - x = 38, - y = 12, - elevation = 5, - movementType = 2, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "MossdeepCity_EventScript_Sailor"), - NpcDef( - entityIdx = 1, - graphicsId = 21, - x = 50, - y = 34, - elevation = 5, - movementType = 5, - movementRangeX = 1, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "MossdeepCity_EventScript_ExpertM"), - NpcDef( - entityIdx = 2, - graphicsId = 18, - x = 32, - y = 12, - elevation = 5, - movementType = 2, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "MossdeepCity_EventScript_PokefanF"), - NpcDef( - entityIdx = 3, - graphicsId = 5, - x = 26, - y = 21, - elevation = 5, - movementType = 3, - movementRangeX = 0, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "MossdeepCity_EventScript_NinjaBoy"), - NpcDef( - entityIdx = 4, - graphicsId = 8, - x = 45, - y = 18, - elevation = 7, - movementType = 9, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 2, - script = "MossdeepCity_EventScript_Girl"), - NpcDef( - entityIdx = 6, - graphicsId = 19, - x = 55, - y = 5, - elevation = 7, - movementType = 7, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 1, - script = "MossdeepCity_EventScript_Man"), - NpcDef( - entityIdx = 7, - graphicsId = 16, - x = 56, - y = 21, - elevation = 7, - movementType = 10, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 3, - script = "MossdeepCity_EventScript_Woman"), - NpcDef( - entityIdx = 8, - graphicsId = 9, - x = 23, - y = 13, - elevation = 5, - movementType = 2, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "MossdeepCity_EventScript_KingsRockBoy"), - NpcDef( - entityIdx = 14, - graphicsId = 44, - x = 19, - y = 25, - elevation = 3, - movementType = 64, - movementRangeX = 3, - movementRangeY = 3, - trainerType = 0, - facing = 0, - script = "MossdeepCity_EventScript_DynamicPunchTutor"), - NpcDef( - entityIdx = 16, - graphicsId = 44, - x = 31, - y = 29, - elevation = 3, - movementType = 64, - movementRangeX = 3, - movementRangeY = 3, - trainerType = 0, - facing = 0, - script = "MossdeepCity_EventScript_BlackBelt"), - ), - bgEvents = - listOf( - BgEventDef( - x = 25, - y = 16, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "MossdeepCity_EventScript_CitySign"), - BgEventDef( - x = 34, - y = 9, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "MossdeepCity_EventScript_GymSign"), - BgEventDef( - x = 29, - y = 16, - facingDir = "BG_EVENT_PLAYER_FACING_NORTH", - script = "Common_EventScript_ShowPokemonCenterSign"), - BgEventDef( - x = 38, - y = 18, - facingDir = "BG_EVENT_PLAYER_FACING_NORTH", - script = "Common_EventScript_ShowPokemartSign"), - BgEventDef( - x = 66, - y = 16, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "MossdeepCity_EventScript_SpaceCenterSign"), - BgEventDef( - x = 30, - y = 16, - facingDir = "BG_EVENT_PLAYER_FACING_NORTH", - script = "Common_EventScript_ShowPokemonCenterSign"), - BgEventDef( - x = 39, - y = 18, - facingDir = "BG_EVENT_PLAYER_FACING_NORTH", - script = "Common_EventScript_ShowPokemartSign"), - BgEventDef( - x = 57, - y = 21, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "MossdeepCity_EventScript_WhiteRock"), - ), - ), - // SootopolisCity (MAP_SOOTOPOLIS_CITY) - MapDef( - regionId = 1, - bankId = 50, - mapId = 7, - width = 60, - height = 60, - paletteIdx1 = 100, - paletteIdx2 = 113, - unknownShort = 445, - unknownByte = 14, - borderTiles = - listOf( - Tile2D(0x02D9, 0), Tile2D(0x02D9, 0), Tile2D(0x02D9, 0), Tile2D(0x02D9, 0)), - lighting = Lighting.REGULAR, - weather = Weather.REGULAR_WEATHER, - mapType = MapType.CITY, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 43, - y = 31, - elevation = 0, - targetRegionId = 1, - targetBankId = 65, - targetMapId = 2, - targetX = 7, - targetY = 8, - targetElevation = 2), - WarpTile( - x = 17, - y = 29, - elevation = 0, - targetRegionId = 1, - targetBankId = 65, - targetMapId = 4, - targetX = 3, - targetY = 7, - targetElevation = 0), - WarpTile( - x = 31, - y = 32, - elevation = 0, - targetRegionId = 1, - targetBankId = 65, - targetMapId = 0, - targetX = 8, - targetY = 25, - targetElevation = 0), - WarpTile( - x = 31, - y = 16, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 37, - targetX = 9, - targetY = 20, - targetElevation = 2), - WarpTile( - x = 9, - y = 6, - elevation = 0, - targetRegionId = 1, - targetBankId = 65, - targetMapId = 5, - targetX = 3, - targetY = 6, - targetElevation = 0), - WarpTile( - x = 45, - y = 6, - elevation = 0, - targetRegionId = 1, - targetBankId = 65, - targetMapId = 6, - targetX = 3, - targetY = 6, - targetElevation = 0), - WarpTile( - x = 9, - y = 17, - elevation = 0, - targetRegionId = 1, - targetBankId = 65, - targetMapId = 7, - targetX = 3, - targetY = 6, - targetElevation = 0), - WarpTile( - x = 44, - y = 17, - elevation = 0, - targetRegionId = 1, - targetBankId = 65, - targetMapId = 8, - targetX = 3, - targetY = 6, - targetElevation = 0), - WarpTile( - x = 9, - y = 26, - elevation = 0, - targetRegionId = 1, - targetBankId = 65, - targetMapId = 9, - targetX = 3, - targetY = 6, - targetElevation = 0), - WarpTile( - x = 53, - y = 28, - elevation = 0, - targetRegionId = 1, - targetBankId = 65, - targetMapId = 10, - targetX = 3, - targetY = 6, - targetElevation = 0), - WarpTile( - x = 8, - y = 35, - elevation = 0, - targetRegionId = 1, - targetBankId = 65, - targetMapId = 11, - targetX = 3, - targetY = 6, - targetElevation = 0), - WarpTile( - x = 48, - y = 25, - elevation = 0, - targetRegionId = 1, - targetBankId = 65, - targetMapId = 12, - targetX = 3, - targetY = 6, - targetElevation = 0), - WarpTile( - x = 51, - y = 36, - elevation = 0, - targetRegionId = 1, - targetBankId = 65, - targetMapId = 13, - targetX = 3, - targetY = 7, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 21, - x = 31, - y = 18, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "SootopolisCity_EventScript_CaveOfOriginExpert"), - NpcDef( - entityIdx = 2, - graphicsId = 10, - x = 9, - y = 43, - elevation = 3, - movementType = 5, - movementRangeX = 1, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "SootopolisCity_EventScript_Kiri"), - NpcDef( - entityIdx = 3, - graphicsId = 5, - x = 51, - y = 14, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "SootopolisCity_EventScript_NinjaBoy"), - NpcDef( - entityIdx = 4, - graphicsId = 7, - x = 43, - y = 26, - elevation = 3, - movementType = 1, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "SootopolisCity_EventScript_Boy1"), - NpcDef( - entityIdx = 7, - graphicsId = 34, - x = 49, - y = 34, - elevation = 3, - movementType = 3, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "SootopolisCity_EventScript_Woman1"), - ), - bgEvents = - listOf( - BgEventDef( - x = 33, - y = 34, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "SootopolisCity_EventScript_GymSign"), - BgEventDef( - x = 19, - y = 29, - facingDir = "BG_EVENT_PLAYER_FACING_NORTH", - script = "Common_EventScript_ShowPokemartSign"), - BgEventDef( - x = 44, - y = 31, - facingDir = "BG_EVENT_PLAYER_FACING_NORTH", - script = "Common_EventScript_ShowPokemonCenterSign"), - BgEventDef( - x = 45, - y = 31, - facingDir = "BG_EVENT_PLAYER_FACING_NORTH", - script = "Common_EventScript_ShowPokemonCenterSign"), - BgEventDef( - x = 18, - y = 29, - facingDir = "BG_EVENT_PLAYER_FACING_NORTH", - script = "Common_EventScript_ShowPokemartSign"), - BgEventDef( - x = 41, - y = 37, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "SootopolisCity_EventScript_CitySign"), - ), - ), - // EverGrandeCity (MAP_EVER_GRANDE_CITY) - MapDef( - regionId = 1, - bankId = 50, - mapId = 8, - width = 40, - height = 80, - paletteIdx1 = 100, - paletteIdx2 = 111, - unknownShort = 422, - unknownByte = 15, - borderTiles = - listOf( - Tile2D(0x0170, 0), Tile2D(0x0170, 0), Tile2D(0x0170, 0), Tile2D(0x0170, 0)), - lighting = Lighting.REGULAR, - weather = Weather.REGULAR_WEATHER, - mapType = MapType.CITY, - encounterType = EncounterType.RANDOM, - connections = - listOf( - GbaConnection(direction = 3, unknown = 40, targetBank = 50, targetMap = 43), - ), - warps = - listOf( - WarpTile( - x = 18, - y = 5, - elevation = 0, - targetRegionId = 1, - targetBankId = 66, - targetMapId = 10, - targetX = 9, - targetY = 11, - targetElevation = 2), - WarpTile( - x = 27, - y = 48, - elevation = 0, - targetRegionId = 1, - targetBankId = 66, - targetMapId = 12, - targetX = 7, - targetY = 8, - targetElevation = 2), - WarpTile( - x = 18, - y = 41, - elevation = 0, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 43, - targetX = 15, - targetY = 40, - targetElevation = 2), - WarpTile( - x = 18, - y = 27, - elevation = 0, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 43, - targetX = 39, - targetY = 5, - targetElevation = 2), - ), - npcs = emptyList(), - bgEvents = - listOf( - BgEventDef( - x = 19, - y = 43, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "EverGrandeCity_EventScript_VictoryRoadSign"), - BgEventDef( - x = 29, - y = 48, - facingDir = "BG_EVENT_PLAYER_FACING_NORTH", - script = "Common_EventScript_ShowPokemonCenterSign"), - BgEventDef( - x = 18, - y = 52, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "EverGrandeCity_EventScript_CitySign"), - BgEventDef( - x = 23, - y = 15, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "EverGrandeCity_EventScript_PokemonLeagueSign"), - BgEventDef( - x = 28, - y = 48, - facingDir = "BG_EVENT_PLAYER_FACING_NORTH", - script = "Common_EventScript_ShowPokemonCenterSign"), - ), - ), - // LittlerootTown (MAP_LITTLEROOT_TOWN) - MapDef( - regionId = 1, - bankId = 50, - mapId = 9, - width = 20, - height = 20, - paletteIdx1 = 100, - paletteIdx2 = 101, - unknownShort = 405, - unknownByte = 0, - borderTiles = - listOf( - Tile2D(0x01D4, 0), Tile2D(0x01D5, 0), Tile2D(0x01DC, 0), Tile2D(0x01DD, 0)), - lighting = Lighting.REGULAR, - weather = Weather.REGULAR_WEATHER, - mapType = MapType.UNKNOWN_0x01, - encounterType = EncounterType.RANDOM, - connections = - listOf( - GbaConnection(direction = 2, unknown = 0, targetBank = 50, targetMap = 16), - ), - warps = - listOf( - WarpTile( - x = 14, - y = 8, - elevation = 0, - targetRegionId = 1, - targetBankId = 51, - targetMapId = 2, - targetX = 2, - targetY = 8, - targetElevation = 0), - WarpTile( - x = 5, - y = 8, - elevation = 0, - targetRegionId = 1, - targetBankId = 51, - targetMapId = 0, - targetX = 8, - targetY = 8, - targetElevation = 0), - WarpTile( - x = 7, - y = 16, - elevation = 0, - targetRegionId = 1, - targetBankId = 51, - targetMapId = 4, - targetX = 6, - targetY = 12, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 6, - x = 16, - y = 10, - elevation = 3, - movementType = 2, - movementRangeX = 1, - movementRangeY = 2, - trainerType = 0, - facing = 0, - script = "LittlerootTown_EventScript_Twin"), - NpcDef( - entityIdx = 2, - graphicsId = 9, - x = 14, - y = 17, - elevation = 3, - movementType = 2, - movementRangeX = 2, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "LittlerootTown_EventScript_Boy"), - ), - bgEvents = - listOf( - BgEventDef( - x = 15, - y = 13, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "LittlerootTown_EventScript_TownSign"), - BgEventDef( - x = 6, - y = 17, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "LittlerootTown_EventScript_BirchsLabSign"), - BgEventDef( - x = 7, - y = 8, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "LittlerootTown_EventScript_BrendansHouseSign"), - BgEventDef( - x = 12, - y = 8, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "LittlerootTown_EventScript_MaysHouseSign"), - ), - ), - // OldaleTown (MAP_OLDALE_TOWN) - MapDef( - regionId = 1, - bankId = 50, - mapId = 10, - width = 20, - height = 20, - paletteIdx1 = 100, - paletteIdx2 = 101, - unknownShort = 363, - unknownByte = 1, - borderTiles = - listOf( - Tile2D(0x01D4, 0), Tile2D(0x01D5, 0), Tile2D(0x01DC, 0), Tile2D(0x01DD, 0)), - lighting = Lighting.REGULAR, - weather = Weather.REGULAR_WEATHER, - mapType = MapType.UNKNOWN_0x01, - encounterType = EncounterType.RANDOM, - connections = - listOf( - GbaConnection(direction = 2, unknown = 0, targetBank = 50, targetMap = 18), - GbaConnection(direction = 1, unknown = 0, targetBank = 50, targetMap = 16), - GbaConnection(direction = 3, unknown = 0, targetBank = 50, targetMap = 17), - ), - warps = - listOf( - WarpTile( - x = 5, - y = 7, - elevation = 0, - targetRegionId = 1, - targetBankId = 52, - targetMapId = 0, - targetX = 3, - targetY = 8, - targetElevation = 0), - WarpTile( - x = 15, - y = 16, - elevation = 0, - targetRegionId = 1, - targetBankId = 52, - targetMapId = 1, - targetX = 3, - targetY = 7, - targetElevation = 0), - WarpTile( - x = 6, - y = 16, - elevation = 0, - targetRegionId = 1, - targetBankId = 52, - targetMapId = 2, - targetX = 7, - targetY = 8, - targetElevation = 2), - WarpTile( - x = 14, - y = 6, - elevation = 0, - targetRegionId = 1, - targetBankId = 52, - targetMapId = 4, - targetX = 3, - targetY = 7, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 14, - x = 16, - y = 11, - elevation = 3, - movementType = 9, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 2, - script = "OldaleTown_EventScript_Girl"), - NpcDef( - entityIdx = 1, - graphicsId = 83, - x = 13, - y = 7, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "OldaleTown_EventScript_MartEmployee"), - NpcDef( - entityIdx = 2, - graphicsId = 39, - x = 8, - y = 9, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 3, - script = "OldaleTown_EventScript_FootprintsMan"), - ), - bgEvents = - listOf( - BgEventDef( - x = 11, - y = 9, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "OldaleTown_EventScript_TownSign"), - BgEventDef( - x = 7, - y = 16, - facingDir = "BG_EVENT_PLAYER_FACING_NORTH", - script = "Common_EventScript_ShowPokemonCenterSign"), - BgEventDef( - x = 15, - y = 6, - facingDir = "BG_EVENT_PLAYER_FACING_NORTH", - script = "Common_EventScript_ShowPokemartSign"), - BgEventDef( - x = 8, - y = 16, - facingDir = "BG_EVENT_PLAYER_FACING_NORTH", - script = "Common_EventScript_ShowPokemonCenterSign"), - BgEventDef( - x = 16, - y = 6, - facingDir = "BG_EVENT_PLAYER_FACING_NORTH", - script = "Common_EventScript_ShowPokemartSign"), - ), - ), - // DewfordTown (MAP_DEWFORD_TOWN) - MapDef( - regionId = 1, - bankId = 50, - mapId = 11, - width = 20, - height = 20, - paletteIdx1 = 100, - paletteIdx2 = 103, - unknownShort = 427, - unknownByte = 2, - borderTiles = - listOf( - Tile2D(0x0243, 0), Tile2D(0x0243, 0), Tile2D(0x0243, 0), Tile2D(0x0243, 0)), - lighting = Lighting.REGULAR, - weather = Weather.REGULAR_WEATHER, - mapType = MapType.UNKNOWN_0x01, - encounterType = EncounterType.RANDOM, - connections = - listOf( - GbaConnection( - direction = 2, unknown = -60, targetBank = 50, targetMap = 21), - GbaConnection(direction = 4, unknown = 0, targetBank = 50, targetMap = 22), - ), - warps = - listOf( - WarpTile( - x = 3, - y = 3, - elevation = 0, - targetRegionId = 1, - targetBankId = 53, - targetMapId = 4, - targetX = 5, - targetY = 8, - targetElevation = 0), - WarpTile( - x = 2, - y = 10, - elevation = 0, - targetRegionId = 1, - targetBankId = 53, - targetMapId = 1, - targetX = 7, - targetY = 8, - targetElevation = 2), - WarpTile( - x = 8, - y = 17, - elevation = 0, - targetRegionId = 1, - targetBankId = 53, - targetMapId = 3, - targetX = 5, - targetY = 27, - targetElevation = 0), - WarpTile( - x = 17, - y = 14, - elevation = 0, - targetRegionId = 1, - targetBankId = 53, - targetMapId = 0, - targetX = 3, - targetY = 7, - targetElevation = 0), - WarpTile( - x = 8, - y = 8, - elevation = 0, - targetRegionId = 1, - targetBankId = 53, - targetMapId = 5, - targetX = 3, - targetY = 8, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 20, - x = 7, - y = 12, - elevation = 3, - movementType = 5, - movementRangeX = 1, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "DewfordTown_EventScript_Woman"), - NpcDef( - entityIdx = 2, - graphicsId = 50, - x = 12, - y = 14, - elevation = 3, - movementType = 5, - movementRangeX = 1, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "DewfordTown_EventScript_OldRodFisherman"), - NpcDef( - entityIdx = 4, - graphicsId = 7, - x = 1, - y = 6, - elevation = 3, - movementType = 1, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "DewfordTown_EventScript_TrendyPhraseBoy"), - ), - bgEvents = - listOf( - BgEventDef( - x = 10, - y = 10, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "DewfordTown_EventScript_TownSign"), - BgEventDef( - x = 11, - y = 16, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "DewfordTown_EventScript_GymSign"), - BgEventDef( - x = 4, - y = 10, - facingDir = "BG_EVENT_PLAYER_FACING_NORTH", - script = "Common_EventScript_ShowPokemonCenterSign"), - BgEventDef( - x = 3, - y = 10, - facingDir = "BG_EVENT_PLAYER_FACING_NORTH", - script = "Common_EventScript_ShowPokemonCenterSign"), - BgEventDef( - x = 2, - y = 4, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "DewfordTown_EventScript_HallSign"), - ), - ), - // LavaridgeTown (MAP_LAVARIDGE_TOWN) - MapDef( - regionId = 1, - bankId = 50, - mapId = 12, - width = 20, - height = 20, - paletteIdx1 = 100, - paletteIdx2 = 106, - unknownShort = 363, - unknownByte = 3, - borderTiles = - listOf( - Tile2D(0x0271, 0), Tile2D(0x0271, 0), Tile2D(0x0271, 0), Tile2D(0x0271, 0)), - lighting = Lighting.REGULAR, - weather = Weather.REGULAR_WEATHER, - mapType = MapType.UNKNOWN_0x01, - encounterType = EncounterType.RANDOM, - connections = - listOf( - GbaConnection( - direction = 4, unknown = -40, targetBank = 50, targetMap = 27), - ), - warps = - listOf( - WarpTile( - x = 12, - y = 15, - elevation = 0, - targetRegionId = 1, - targetBankId = 54, - targetMapId = 0, - targetX = 3, - targetY = 7, - targetElevation = 0), - WarpTile( - x = 5, - y = 15, - elevation = 0, - targetRegionId = 1, - targetBankId = 54, - targetMapId = 1, - targetX = 13, - targetY = 18, - targetElevation = 2), - WarpTile( - x = 15, - y = 5, - elevation = 0, - targetRegionId = 1, - targetBankId = 54, - targetMapId = 4, - targetX = 3, - targetY = 7, - targetElevation = 0), - WarpTile( - x = 9, - y = 6, - elevation = 0, - targetRegionId = 1, - targetBankId = 54, - targetMapId = 5, - targetX = 7, - targetY = 8, - targetElevation = 2), - WarpTile( - x = 16, - y = 15, - elevation = 0, - targetRegionId = 1, - targetBankId = 54, - targetMapId = 3, - targetX = 3, - targetY = 7, - targetElevation = 0), - WarpTile( - x = 9, - y = 2, - elevation = 2, - targetRegionId = 1, - targetBankId = 54, - targetMapId = 5, - targetX = 2, - targetY = 1, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 22, - x = 8, - y = 7, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "LavaridgeTown_EventScript_ExpertF"), - NpcDef( - entityIdx = 1, - graphicsId = 21, - x = 5, - y = 1, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "LavaridgeTown_EventScript_ExpertM"), - NpcDef( - entityIdx = 2, - graphicsId = 29, - x = 5, - y = 8, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "LavaridgeTown_EventScript_OldMan"), - NpcDef( - entityIdx = 3, - graphicsId = 6, - x = 10, - y = 13, - elevation = 3, - movementType = 3, - movementRangeX = 0, - movementRangeY = 2, - trainerType = 0, - facing = 0, - script = "LavaridgeTown_EventScript_Twin"), - NpcDef( - entityIdx = 4, - graphicsId = 0, - x = 4, - y = 4, - elevation = 3, - movementType = 18, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "LavaridgeTown_EventScript_HotSpringsOldWoman1"), - NpcDef( - entityIdx = 5, - graphicsId = 0, - x = 5, - y = 4, - elevation = 3, - movementType = 17, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "LavaridgeTown_EventScript_HotSpringsOldWoman2"), - NpcDef( - entityIdx = 8, - graphicsId = 22, - x = 4, - y = 7, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "LavaridgeTown_EventScript_EggWoman"), - ), - bgEvents = - listOf( - BgEventDef( - x = 14, - y = 16, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "LavaridgeTown_EventScript_HerbShopSign"), - BgEventDef( - x = 7, - y = 15, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "LavaridgeTown_EventScript_GymSign"), - BgEventDef( - x = 17, - y = 5, - facingDir = "BG_EVENT_PLAYER_FACING_NORTH", - script = "Common_EventScript_ShowPokemartSign"), - BgEventDef( - x = 13, - y = 8, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "LavaridgeTown_EventScript_TownSign"), - BgEventDef( - x = 10, - y = 6, - facingDir = "BG_EVENT_PLAYER_FACING_NORTH", - script = "Common_EventScript_ShowPokemonCenterSign"), - BgEventDef( - x = 16, - y = 5, - facingDir = "BG_EVENT_PLAYER_FACING_NORTH", - script = "Common_EventScript_ShowPokemartSign"), - BgEventDef( - x = 11, - y = 6, - facingDir = "BG_EVENT_PLAYER_FACING_NORTH", - script = "Common_EventScript_ShowPokemonCenterSign"), - BgEventDef( - x = 4, - y = 5, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - ), - ), - // FallarborTown (MAP_FALLARBOR_TOWN) - MapDef( - regionId = 1, - bankId = 50, - mapId = 13, - width = 20, - height = 20, - paletteIdx1 = 100, - paletteIdx2 = 107, - unknownShort = 437, - unknownByte = 4, - borderTiles = - listOf( - Tile2D(0x026B, 0), Tile2D(0x026C, 0), Tile2D(0x0273, 0), Tile2D(0x0274, 0)), - lighting = Lighting.REGULAR, - weather = Weather.REGULAR_WEATHER, - mapType = MapType.UNKNOWN_0x01, - encounterType = EncounterType.RANDOM, - connections = - listOf( - GbaConnection(direction = 3, unknown = 0, targetBank = 50, targetMap = 29), - GbaConnection(direction = 4, unknown = 0, targetBank = 50, targetMap = 28), - ), - warps = - listOf( - WarpTile( - x = 15, - y = 15, - elevation = 0, - targetRegionId = 1, - targetBankId = 55, - targetMapId = 0, - targetX = 3, - targetY = 7, - targetElevation = 0), - WarpTile( - x = 8, - y = 7, - elevation = 0, - targetRegionId = 1, - targetBankId = 55, - targetMapId = 1, - targetX = 6, - targetY = 9, - targetElevation = 0), - WarpTile( - x = 14, - y = 7, - elevation = 0, - targetRegionId = 1, - targetBankId = 55, - targetMapId = 4, - targetX = 7, - targetY = 8, - targetElevation = 2), - WarpTile( - x = 6, - y = 17, - elevation = 0, - targetRegionId = 1, - targetBankId = 55, - targetMapId = 6, - targetX = 3, - targetY = 8, - targetElevation = 0), - WarpTile( - x = 1, - y = 6, - elevation = 0, - targetRegionId = 1, - targetBankId = 55, - targetMapId = 7, - targetX = 3, - targetY = 7, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 8, - x = 8, - y = 11, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "FallarborTown_EventScript_Girl"), - NpcDef( - entityIdx = 1, - graphicsId = 21, - x = 11, - y = 9, - elevation = 3, - movementType = 5, - movementRangeX = 1, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "FallarborTown_EventScript_ExpertM"), - NpcDef( - entityIdx = 2, - graphicsId = 48, - x = 11, - y = 15, - elevation = 3, - movementType = 3, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "FallarborTown_EventScript_Gentleman"), - ), - bgEvents = - listOf( - BgEventDef( - x = 16, - y = 15, - facingDir = "BG_EVENT_PLAYER_FACING_NORTH", - script = "Common_EventScript_ShowPokemartSign"), - BgEventDef( - x = 15, - y = 7, - facingDir = "BG_EVENT_PLAYER_FACING_NORTH", - script = "Common_EventScript_ShowPokemonCenterSign"), - BgEventDef( - x = 6, - y = 8, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "FallarborTown_EventScript_BattleTentSign"), - BgEventDef( - x = 16, - y = 7, - facingDir = "BG_EVENT_PLAYER_FACING_NORTH", - script = "Common_EventScript_ShowPokemonCenterSign"), - BgEventDef( - x = 10, - y = 11, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "FallarborTown_EventScript_TownSign"), - BgEventDef( - x = 17, - y = 15, - facingDir = "BG_EVENT_PLAYER_FACING_NORTH", - script = "Common_EventScript_ShowPokemartSign"), - BgEventDef( - x = 3, - y = 7, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "FallarborTown_EventScript_MoveTutorSign"), - BgEventDef( - x = 2, - y = 15, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - ), - ), - // VerdanturfTown (MAP_VERDANTURF_TOWN) - MapDef( - regionId = 1, - bankId = 50, - mapId = 14, - width = 20, - height = 20, - paletteIdx1 = 100, - paletteIdx2 = 105, - unknownShort = 398, - unknownByte = 5, - borderTiles = - listOf( - Tile2D(0x00C6, 0), Tile2D(0x00C7, 0), Tile2D(0x00C7, 0), Tile2D(0x00C6, 0)), - lighting = Lighting.REGULAR, - weather = Weather.REGULAR_WEATHER, - mapType = MapType.UNKNOWN_0x01, - encounterType = EncounterType.RANDOM, - connections = - listOf( - GbaConnection( - direction = 2, unknown = -80, targetBank = 50, targetMap = 31), - GbaConnection(direction = 4, unknown = 0, targetBank = 50, targetMap = 32), - ), - warps = - listOf( - WarpTile( - x = 3, - y = 7, - elevation = 0, - targetRegionId = 1, - targetBankId = 56, - targetMapId = 0, - targetX = 6, - targetY = 9, - targetElevation = 0), - WarpTile( - x = 12, - y = 3, - elevation = 0, - targetRegionId = 1, - targetBankId = 56, - targetMapId = 3, - targetX = 3, - targetY = 7, - targetElevation = 0), - WarpTile( - x = 16, - y = 3, - elevation = 0, - targetRegionId = 1, - targetBankId = 56, - targetMapId = 4, - targetX = 7, - targetY = 8, - targetElevation = 2), - WarpTile( - x = 10, - y = 14, - elevation = 0, - targetRegionId = 1, - targetBankId = 56, - targetMapId = 6, - targetX = 7, - targetY = 7, - targetElevation = 0), - WarpTile( - x = 8, - y = 1, - elevation = 0, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 4, - targetX = 29, - targetY = 16, - targetElevation = 2), - WarpTile( - x = 1, - y = 14, - elevation = 0, - targetRegionId = 1, - targetBankId = 56, - targetMapId = 7, - targetX = 3, - targetY = 7, - targetElevation = 0), - WarpTile( - x = 17, - y = 15, - elevation = 0, - targetRegionId = 1, - targetBankId = 56, - targetMapId = 8, - targetX = 3, - targetY = 8, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 23, - x = 4, - y = 17, - elevation = 3, - movementType = 5, - movementRangeX = 1, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "VerdanturfTown_EventScript_Man"), - NpcDef( - entityIdx = 1, - graphicsId = 6, - x = 9, - y = 2, - elevation = 3, - movementType = 9, - movementRangeX = 1, - movementRangeY = 0, - trainerType = 0, - facing = 2, - script = "VerdanturfTown_EventScript_Twin"), - NpcDef( - entityIdx = 2, - graphicsId = 7, - x = 7, - y = 11, - elevation = 3, - movementType = 3, - movementRangeX = 0, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "VerdanturfTown_EventScript_Boy"), - NpcDef( - entityIdx = 3, - graphicsId = 31, - x = 7, - y = 6, - elevation = 3, - movementType = 5, - movementRangeX = 1, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "VerdanturfTown_EventScript_Camper"), - ), - bgEvents = - listOf( - BgEventDef( - x = 14, - y = 3, - facingDir = "BG_EVENT_PLAYER_FACING_NORTH", - script = "Common_EventScript_ShowPokemartSign"), - BgEventDef( - x = 14, - y = 6, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "VerdanturfTown_EventScript_TownSign"), - BgEventDef( - x = 17, - y = 3, - facingDir = "BG_EVENT_PLAYER_FACING_NORTH", - script = "Common_EventScript_ShowPokemonCenterSign"), - BgEventDef( - x = 7, - y = 14, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "VerdanturfTown_EventScript_WandasHouseSign"), - BgEventDef( - x = 13, - y = 3, - facingDir = "BG_EVENT_PLAYER_FACING_NORTH", - script = "Common_EventScript_ShowPokemartSign"), - BgEventDef( - x = 18, - y = 3, - facingDir = "BG_EVENT_PLAYER_FACING_NORTH", - script = "Common_EventScript_ShowPokemonCenterSign"), - BgEventDef( - x = 1, - y = 8, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "VerdanturfTown_EventScript_BattleTentSign"), - BgEventDef( - x = 7, - y = 3, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "VerdanturfTown_EventScript_RusturfTunnelSign"), - ), - ), - // PacifidlogTown (MAP_PACIFIDLOG_TOWN) - MapDef( - regionId = 1, - bankId = 50, - mapId = 15, - width = 20, - height = 40, - paletteIdx1 = 100, - paletteIdx2 = 112, - unknownShort = 408, - unknownByte = 6, - borderTiles = - listOf( - Tile2D(0x0170, 0), Tile2D(0x0170, 0), Tile2D(0x0170, 0), Tile2D(0x0170, 0)), - lighting = Lighting.REGULAR, - weather = Weather.REGULAR_WEATHER, - mapType = MapType.UNKNOWN_0x01, - encounterType = EncounterType.RANDOM, - connections = - listOf( - GbaConnection(direction = 3, unknown = 0, targetBank = 50, targetMap = 47), - GbaConnection(direction = 4, unknown = 0, targetBank = 50, targetMap = 46), - ), - warps = - listOf( - WarpTile( - x = 8, - y = 15, - elevation = 0, - targetRegionId = 1, - targetBankId = 57, - targetMapId = 0, - targetX = 7, - targetY = 8, - targetElevation = 2), - WarpTile( - x = 16, - y = 13, - elevation = 0, - targetRegionId = 1, - targetBankId = 57, - targetMapId = 2, - targetX = 4, - targetY = 8, - targetElevation = 0), - WarpTile( - x = 3, - y = 22, - elevation = 0, - targetRegionId = 1, - targetBankId = 57, - targetMapId = 3, - targetX = 4, - targetY = 8, - targetElevation = 0), - WarpTile( - x = 12, - y = 24, - elevation = 0, - targetRegionId = 1, - targetBankId = 57, - targetMapId = 4, - targetX = 4, - targetY = 8, - targetElevation = 0), - WarpTile( - x = 2, - y = 12, - elevation = 0, - targetRegionId = 1, - targetBankId = 57, - targetMapId = 5, - targetX = 4, - targetY = 8, - targetElevation = 0), - WarpTile( - x = 17, - y = 21, - elevation = 0, - targetRegionId = 1, - targetBankId = 57, - targetMapId = 6, - targetX = 4, - targetY = 8, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 8, - x = 10, - y = 23, - elevation = 3, - movementType = 9, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 2, - script = "PacifidlogTown_EventScript_Girl"), - NpcDef( - entityIdx = 1, - graphicsId = 50, - x = 11, - y = 14, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 3, - script = "PacifidlogTown_EventScript_Fisherman"), - NpcDef( - entityIdx = 2, - graphicsId = 5, - x = 9, - y = 16, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "PacifidlogTown_EventScript_NinjaBoy"), - ), - bgEvents = - listOf( - BgEventDef( - x = 9, - y = 15, - facingDir = "BG_EVENT_PLAYER_FACING_NORTH", - script = "Common_EventScript_ShowPokemonCenterSign"), - BgEventDef( - x = 7, - y = 16, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "PacifidlogTown_EventScript_TownSign"), - BgEventDef( - x = 10, - y = 15, - facingDir = "BG_EVENT_PLAYER_FACING_NORTH", - script = "Common_EventScript_ShowPokemonCenterSign"), - ), - ), - // Route101 (MAP_ROUTE101) - MapDef( - regionId = 1, - bankId = 50, - mapId = 16, - width = 20, - height = 20, - paletteIdx1 = 100, - paletteIdx2 = 101, - unknownShort = 359, - unknownByte = 16, - borderTiles = - listOf( - Tile2D(0x01D4, 0), Tile2D(0x01D5, 0), Tile2D(0x01DC, 0), Tile2D(0x01DD, 0)), - lighting = Lighting.REGULAR, - weather = Weather.REGULAR_WEATHER, - mapType = MapType.ROUTE, - encounterType = EncounterType.RANDOM, - connections = - listOf( - GbaConnection(direction = 2, unknown = 0, targetBank = 50, targetMap = 10), - GbaConnection(direction = 1, unknown = 0, targetBank = 50, targetMap = 9), - ), - warps = emptyList(), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 35, - x = 16, - y = 8, - elevation = 3, - movementType = 1, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "Route101_EventScript_Youngster"), - ), - bgEvents = - listOf( - BgEventDef( - x = 5, - y = 9, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "Route101_EventScript_RouteSign"), - ), - ), - // Route102 (MAP_ROUTE102) - MapDef( - regionId = 1, - bankId = 50, - mapId = 17, - width = 50, - height = 20, - paletteIdx1 = 100, - paletteIdx2 = 101, - unknownShort = 359, - unknownByte = 17, - borderTiles = - listOf( - Tile2D(0x01D4, 0), Tile2D(0x01D5, 0), Tile2D(0x01DC, 0), Tile2D(0x01DD, 0)), - lighting = Lighting.REGULAR, - weather = Weather.REGULAR_WEATHER, - mapType = MapType.ROUTE, - encounterType = EncounterType.RANDOM, - connections = - listOf( - GbaConnection(direction = 3, unknown = -10, targetBank = 50, targetMap = 0), - GbaConnection(direction = 4, unknown = 0, targetBank = 50, targetMap = 10), - ), - warps = emptyList(), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 11, - x = 18, - y = 11, - elevation = 3, - movementType = 1, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "Route102_EventScript_LittleBoy"), - NpcDef( - entityIdx = 1, - graphicsId = 35, - x = 33, - y = 14, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "Route102_EventScript_Calvin"), - NpcDef( - entityIdx = 2, - graphicsId = 36, - x = 25, - y = 15, - elevation = 3, - movementType = 7, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 1, - script = "Route102_EventScript_Rick"), - NpcDef( - entityIdx = 3, - graphicsId = 47, - x = 8, - y = 7, - elevation = 3, - movementType = 18, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "Route102_EventScript_Tiana"), - NpcDef( - entityIdx = 4, - graphicsId = 7, - x = 37, - y = 4, - elevation = 3, - movementType = 2, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "Route102_EventScript_Boy"), - NpcDef( - entityIdx = 6, - graphicsId = 60, - x = 24, - y = 2, - elevation = 3, - movementType = 12, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "BerryTreeScript"), - NpcDef( - entityIdx = 7, - graphicsId = 60, - x = 25, - y = 2, - elevation = 3, - movementType = 12, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "BerryTreeScript"), - NpcDef( - entityIdx = 8, - graphicsId = 35, - x = 19, - y = 4, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "Route102_EventScript_Allen"), - ), - bgEvents = - listOf( - BgEventDef( - x = 17, - y = 2, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "Route102_EventScript_RouteSignPetalburg"), - BgEventDef( - x = 40, - y = 9, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "Route102_EventScript_RouteSignOldale"), - ), - ), - // Route103 (MAP_ROUTE103) - MapDef( - regionId = 1, - bankId = 50, - mapId = 18, - width = 80, - height = 22, - paletteIdx1 = 100, - paletteIdx2 = 101, - unknownShort = 359, - unknownByte = 18, - borderTiles = - listOf( - Tile2D(0x01D4, 0), Tile2D(0x01D5, 0), Tile2D(0x01DC, 0), Tile2D(0x01DD, 0)), - lighting = Lighting.REGULAR, - weather = Weather.REGULAR_WEATHER, - mapType = MapType.ROUTE, - encounterType = EncounterType.RANDOM, - connections = - listOf( - GbaConnection(direction = 1, unknown = 0, targetBank = 50, targetMap = 10), - GbaConnection( - direction = 4, unknown = -60, targetBank = 50, targetMap = 25), - ), - warps = - listOf( - WarpTile( - x = 45, - y = 6, - elevation = 0, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 106, - targetX = 18, - targetY = 22, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 33, - x = 49, - y = 12, - elevation = 3, - movementType = 9, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 2, - script = "Route103_EventScript_Man"), - NpcDef( - entityIdx = 2, - graphicsId = 20, - x = 71, - y = 11, - elevation = 3, - movementType = 18, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "Route103_EventScript_Daisy"), - NpcDef( - entityIdx = 3, - graphicsId = 6, - x = 65, - y = 12, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "Route103_EventScript_Liv"), - NpcDef( - entityIdx = 4, - graphicsId = 6, - x = 64, - y = 12, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "Route103_EventScript_Amy"), - NpcDef( - entityIdx = 5, - graphicsId = 50, - x = 50, - y = 8, - elevation = 3, - movementType = 26, - movementRangeX = 0, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "Route103_EventScript_Andrew"), - NpcDef( - entityIdx = 6, - graphicsId = 60, - x = 58, - y = 5, - elevation = 3, - movementType = 12, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "BerryTreeScript"), - NpcDef( - entityIdx = 7, - graphicsId = 60, - x = 59, - y = 5, - elevation = 3, - movementType = 12, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "BerryTreeScript"), - NpcDef( - entityIdx = 8, - graphicsId = 60, - x = 60, - y = 5, - elevation = 3, - movementType = 12, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "BerryTreeScript"), - NpcDef( - entityIdx = 9, - graphicsId = 7, - x = 20, - y = 10, - elevation = 3, - movementType = 2, - movementRangeX = 1, - movementRangeY = 2, - trainerType = 0, - facing = 0, - script = "Route103_EventScript_Boy"), - NpcDef( - entityIdx = 11, - graphicsId = 25, - x = 56, - y = 13, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 3, - script = "Route103_EventScript_Miguel"), - NpcDef( - entityIdx = 15, - graphicsId = 44, - x = 67, - y = 5, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "Route103_EventScript_Rhett"), - NpcDef( - entityIdx = 16, - graphicsId = 66, - x = 67, - y = 9, - elevation = 3, - movementType = 7, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 1, - script = "Route103_EventScript_Marcos"), - NpcDef( - entityIdx = 17, - graphicsId = 43, - x = 36, - y = 6, - elevation = 1, - movementType = 26, - movementRangeX = 1, - movementRangeY = 3, - trainerType = 1, - facing = 0, - script = "Route103_EventScript_Isabelle"), - NpcDef( - entityIdx = 18, - graphicsId = 42, - x = 36, - y = 13, - elevation = 1, - movementType = 25, - movementRangeX = 1, - movementRangeY = 3, - trainerType = 1, - facing = 0, - script = "Route103_EventScript_Pete"), - ), - bgEvents = - listOf( - BgEventDef( - x = 11, - y = 9, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "Route103_EventScript_RouteSign"), - ), - ), - // Route104 (MAP_ROUTE104) - MapDef( - regionId = 1, - bankId = 50, - mapId = 19, - width = 40, - height = 80, - paletteIdx1 = 100, - paletteIdx2 = 102, - unknownShort = 401, - unknownByte = 19, - borderTiles = - listOf( - Tile2D(0x01D4, 0), Tile2D(0x01D5, 0), Tile2D(0x01DC, 0), Tile2D(0x01DD, 0)), - lighting = Lighting.REGULAR, - weather = Weather.REGULAR_WEATHER, - mapType = MapType.ROUTE, - encounterType = EncounterType.RANDOM, - connections = - listOf( - GbaConnection(direction = 2, unknown = 0, targetBank = 50, targetMap = 3), - GbaConnection(direction = 1, unknown = 0, targetBank = 50, targetMap = 20), - GbaConnection(direction = 4, unknown = 50, targetBank = 50, targetMap = 0), - ), - warps = - listOf( - WarpTile( - x = 17, - y = 50, - elevation = 0, - targetRegionId = 1, - targetBankId = 67, - targetMapId = 0, - targetX = 5, - targetY = 8, - targetElevation = 0), - WarpTile( - x = 5, - y = 18, - elevation = 0, - targetRegionId = 1, - targetBankId = 67, - targetMapId = 1, - targetX = 2, - targetY = 8, - targetElevation = 0), - WarpTile( - x = 10, - y = 30, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 11, - targetX = 14, - targetY = 5, - targetElevation = 0), - WarpTile( - x = 11, - y = 30, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 11, - targetX = 15, - targetY = 5, - targetElevation = 0), - WarpTile( - x = 10, - y = 38, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 11, - targetX = 16, - targetY = 38, - targetElevation = 0), - WarpTile( - x = 11, - y = 38, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 11, - targetX = 17, - targetY = 38, - targetElevation = 0), - WarpTile( - x = 32, - y = 42, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 11, - targetX = 36, - targetY = 38, - targetElevation = 0), - WarpTile( - x = 33, - y = 42, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 11, - targetX = 37, - targetY = 38, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 36, - x = 15, - y = 60, - elevation = 3, - movementType = 9, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 2, - script = "Route104_EventScript_BugCatcher"), - NpcDef( - entityIdx = 1, - graphicsId = 10, - x = 25, - y = 49, - elevation = 3, - movementType = 2, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "Route104_EventScript_Girl1"), - NpcDef( - entityIdx = 2, - graphicsId = 47, - x = 31, - y = 24, - elevation = 3, - movementType = 9, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 2, - script = "Route104_EventScript_Haley"), - NpcDef( - entityIdx = 3, - graphicsId = 7, - x = 27, - y = 63, - elevation = 3, - movementType = 3, - movementRangeX = 0, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "Route104_EventScript_Boy1"), - NpcDef( - entityIdx = 4, - graphicsId = 20, - x = 30, - y = 50, - elevation = 3, - movementType = 2, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "Route104_EventScript_Woman"), - NpcDef( - entityIdx = 5, - graphicsId = 14, - x = 28, - y = 74, - elevation = 3, - movementType = 7, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 1, - script = "Route104_EventScript_Girl2"), - NpcDef( - entityIdx = 8, - graphicsId = 50, - x = 29, - y = 8, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "Route104_EventScript_Ivan"), - NpcDef( - entityIdx = 9, - graphicsId = 60, - x = 34, - y = 6, - elevation = 3, - movementType = 12, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "BerryTreeScript"), - NpcDef( - entityIdx = 10, - graphicsId = 60, - x = 35, - y = 6, - elevation = 3, - movementType = 12, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "BerryTreeScript"), - NpcDef( - entityIdx = 11, - graphicsId = 60, - x = 36, - y = 6, - elevation = 3, - movementType = 12, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "BerryTreeScript"), - NpcDef( - entityIdx = 12, - graphicsId = 60, - x = 22, - y = 41, - elevation = 3, - movementType = 12, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "BerryTreeScript"), - NpcDef( - entityIdx = 13, - graphicsId = 60, - x = 23, - y = 41, - elevation = 3, - movementType = 12, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "BerryTreeScript"), - NpcDef( - entityIdx = 14, - graphicsId = 60, - x = 24, - y = 41, - elevation = 3, - movementType = 12, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "BerryTreeScript"), - NpcDef( - entityIdx = 15, - graphicsId = 22, - x = 37, - y = 8, - elevation = 3, - movementType = 9, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 2, - script = "Route104_EventScript_ExpertF"), - NpcDef( - entityIdx = 16, - graphicsId = 60, - x = 3, - y = 22, - elevation = 3, - movementType = 12, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "BerryTreeScript"), - NpcDef( - entityIdx = 17, - graphicsId = 60, - x = 3, - y = 23, - elevation = 3, - movementType = 12, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "BerryTreeScript"), - NpcDef( - entityIdx = 18, - graphicsId = 60, - x = 3, - y = 24, - elevation = 3, - movementType = 12, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "BerryTreeScript"), - NpcDef( - entityIdx = 19, - graphicsId = 60, - x = 3, - y = 25, - elevation = 3, - movementType = 12, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "BerryTreeScript"), - NpcDef( - entityIdx = 22, - graphicsId = 6, - x = 27, - y = 15, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "Route104_EventScript_Gina"), - NpcDef( - entityIdx = 23, - graphicsId = 6, - x = 28, - y = 15, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "Route104_EventScript_Mia"), - NpcDef( - entityIdx = 24, - graphicsId = 15, - x = 21, - y = 25, - elevation = 3, - movementType = 23, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "Route104_EventScript_Winston"), - NpcDef( - entityIdx = 25, - graphicsId = 20, - x = 11, - y = 44, - elevation = 3, - movementType = 16, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "Route104_EventScript_Cindy"), - NpcDef( - entityIdx = 27, - graphicsId = 35, - x = 18, - y = 67, - elevation = 3, - movementType = 0, - movementRangeX = 5, - movementRangeY = 6, - trainerType = 1, - facing = 0, - script = "Route104_EventScript_Billy"), - NpcDef( - entityIdx = 31, - graphicsId = 9, - x = 5, - y = 26, - elevation = 3, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "Route104_EventScript_Boy2"), - NpcDef( - entityIdx = 32, - graphicsId = 50, - x = 15, - y = 59, - elevation = 3, - movementType = 9, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 2, - script = "Route104_EventScript_Darian"), - ), - bgEvents = - listOf( - BgEventDef( - x = 20, - y = 50, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "Route104_EventScript_BrineysCottageSign"), - BgEventDef( - x = 27, - y = 66, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "Route104_EventScript_RouteSignPetalburg"), - BgEventDef( - x = 23, - y = 5, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "Route104_EventScript_RouteSignRustboro"), - BgEventDef( - x = 7, - y = 20, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "Route104_EventScript_FlowerShopSign"), - BgEventDef( - x = 17, - y = 23, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "Route104_EventScript_TrainerTipsDoubleBattles"), - BgEventDef( - x = 7, - y = 6, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 3, - y = 9, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 14, - y = 55, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 16, - y = 72, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 16, - y = 64, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - ), - ), - // Route105 (MAP_ROUTE105) - MapDef( - regionId = 1, - bankId = 50, - mapId = 20, - width = 40, - height = 80, - paletteIdx1 = 100, - paletteIdx2 = 103, - unknownShort = 401, - unknownByte = 20, - borderTiles = - listOf( - Tile2D(0x0170, 0), Tile2D(0x0170, 0), Tile2D(0x0170, 0), Tile2D(0x0170, 0)), - lighting = Lighting.REGULAR, - weather = Weather.REGULAR_WEATHER, - mapType = MapType.ROUTE, - encounterType = EncounterType.RANDOM, - connections = - listOf( - GbaConnection(direction = 2, unknown = 0, targetBank = 50, targetMap = 19), - GbaConnection(direction = 1, unknown = 0, targetBank = 50, targetMap = 21), - GbaConnection(direction = 5, unknown = 0, targetBank = 50, targetMap = 55), - ), - warps = - listOf( - WarpTile( - x = 9, - y = 20, - elevation = 0, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 67, - targetX = 8, - targetY = 29, - targetElevation = 2), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 42, - x = 19, - y = 60, - elevation = 1, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 3, - script = "Route105_EventScript_Luis"), - NpcDef( - entityIdx = 1, - graphicsId = 42, - x = 27, - y = 36, - elevation = 1, - movementType = 27, - movementRangeX = 7, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "Route105_EventScript_Dominik"), - NpcDef( - entityIdx = 2, - graphicsId = 43, - x = 8, - y = 45, - elevation = 1, - movementType = 25, - movementRangeX = 0, - movementRangeY = 7, - trainerType = 1, - facing = 0, - script = "Route105_EventScript_Beverly"), - NpcDef( - entityIdx = 3, - graphicsId = 43, - x = 19, - y = 9, - elevation = 1, - movementType = 24, - movementRangeX = 0, - movementRangeY = 5, - trainerType = 1, - facing = 0, - script = "Route105_EventScript_Imani"), - NpcDef( - entityIdx = 5, - graphicsId = 55, - x = 17, - y = 48, - elevation = 3, - movementType = 26, - movementRangeX = 0, - movementRangeY = 7, - trainerType = 1, - facing = 0, - script = "Route105_EventScript_Foster"), - NpcDef( - entityIdx = 6, - graphicsId = 66, - x = 4, - y = 54, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 2, - trainerType = 1, - facing = 0, - script = "Route105_EventScript_Josue"), - NpcDef( - entityIdx = 7, - graphicsId = 55, - x = 4, - y = 58, - elevation = 3, - movementType = 7, - movementRangeX = 0, - movementRangeY = 2, - trainerType = 1, - facing = 1, - script = "Route105_EventScript_Andres"), - ), - bgEvents = - listOf( - BgEventDef( - x = 15, - y = 68, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 5, - y = 56, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - ), - ), - // Route106 (MAP_ROUTE106) - MapDef( - regionId = 1, - bankId = 50, - mapId = 21, - width = 80, - height = 20, - paletteIdx1 = 100, - paletteIdx2 = 103, - unknownShort = 401, - unknownByte = 21, - borderTiles = - listOf( - Tile2D(0x0243, 0), Tile2D(0x0243, 0), Tile2D(0x0243, 0), Tile2D(0x0243, 0)), - lighting = Lighting.REGULAR, - weather = Weather.REGULAR_WEATHER, - mapType = MapType.ROUTE, - encounterType = EncounterType.RANDOM, - connections = - listOf( - GbaConnection(direction = 2, unknown = 0, targetBank = 50, targetMap = 20), - GbaConnection(direction = 1, unknown = 60, targetBank = 50, targetMap = 11), - ), - warps = - listOf( - WarpTile( - x = 48, - y = 16, - elevation = 0, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 7, - targetX = 37, - targetY = 12, - targetElevation = 2), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 42, - x = 18, - y = 5, - elevation = 1, - movementType = 27, - movementRangeX = 4, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "Route106_EventScript_Douglas"), - NpcDef( - entityIdx = 1, - graphicsId = 43, - x = 29, - y = 10, - elevation = 1, - movementType = 1, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "Route106_EventScript_Kyla"), - NpcDef( - entityIdx = 2, - graphicsId = 50, - x = 51, - y = 14, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 3, - script = "Route106_EventScript_Elliot"), - NpcDef( - entityIdx = 3, - graphicsId = 50, - x = 65, - y = 14, - elevation = 3, - movementType = 1, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "Route106_EventScript_Ned"), - ), - bgEvents = - listOf( - BgEventDef( - x = 41, - y = 11, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 53, - y = 12, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 68, - y = 15, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 59, - y = 13, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "Route106_EventScript_TrainerTipsSign"), - ), - ), - // Route107 (MAP_ROUTE107) - MapDef( - regionId = 1, - bankId = 50, - mapId = 22, - width = 60, - height = 20, - paletteIdx1 = 100, - paletteIdx2 = 103, - unknownShort = 401, - unknownByte = 22, - borderTiles = - listOf( - Tile2D(0x0170, 0), Tile2D(0x0170, 0), Tile2D(0x0170, 0), Tile2D(0x0170, 0)), - lighting = Lighting.REGULAR, - weather = Weather.REGULAR_WEATHER, - mapType = MapType.ROUTE, - encounterType = EncounterType.RANDOM, - connections = - listOf( - GbaConnection(direction = 3, unknown = 0, targetBank = 50, targetMap = 11), - GbaConnection(direction = 4, unknown = 0, targetBank = 50, targetMap = 23), - ), - warps = emptyList(), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 42, - x = 41, - y = 10, - elevation = 1, - movementType = 24, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "Route107_EventScript_Darrin"), - NpcDef( - entityIdx = 1, - graphicsId = 42, - x = 23, - y = 11, - elevation = 1, - movementType = 0, - movementRangeX = 6, - movementRangeY = 2, - trainerType = 1, - facing = 0, - script = "Route107_EventScript_Tony"), - NpcDef( - entityIdx = 2, - graphicsId = 43, - x = 16, - y = 7, - elevation = 1, - movementType = 13, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "Route107_EventScript_Denise"), - NpcDef( - entityIdx = 3, - graphicsId = 43, - x = 50, - y = 11, - elevation = 1, - movementType = 65, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 1, - script = "Route107_EventScript_Beth"), - NpcDef( - entityIdx = 4, - graphicsId = 43, - x = 33, - y = 4, - elevation = 1, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "Route107_EventScript_Lisa"), - NpcDef( - entityIdx = 5, - graphicsId = 0, - x = 32, - y = 4, - elevation = 1, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "Route107_EventScript_Ray"), - NpcDef( - entityIdx = 6, - graphicsId = 42, - x = 50, - y = 5, - elevation = 1, - movementType = 64, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "Route107_EventScript_Camron"), - ), - bgEvents = emptyList(), - ), - // Route108 (MAP_ROUTE108) - MapDef( - regionId = 1, - bankId = 50, - mapId = 23, - width = 60, - height = 20, - paletteIdx1 = 100, - paletteIdx2 = 104, - unknownShort = 401, - unknownByte = 23, - borderTiles = - listOf( - Tile2D(0x0170, 0), Tile2D(0x0170, 0), Tile2D(0x0170, 0), Tile2D(0x0170, 0)), - lighting = Lighting.REGULAR, - weather = Weather.REGULAR_WEATHER, - mapType = MapType.ROUTE, - encounterType = EncounterType.RANDOM, - connections = - listOf( - GbaConnection(direction = 3, unknown = 0, targetBank = 50, targetMap = 22), - GbaConnection( - direction = 4, unknown = -40, targetBank = 50, targetMap = 24), - ), - warps = - listOf( - WarpTile( - x = 29, - y = 6, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 54, - targetX = 13, - targetY = 15, - targetElevation = 2), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 42, - x = 52, - y = 13, - elevation = 1, - movementType = 0, - movementRangeX = 3, - movementRangeY = 3, - trainerType = 1, - facing = 0, - script = "Route108_EventScript_Jerome"), - NpcDef( - entityIdx = 1, - graphicsId = 43, - x = 35, - y = 12, - elevation = 1, - movementType = 13, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "Route108_EventScript_Tara"), - NpcDef( - entityIdx = 2, - graphicsId = 42, - x = 13, - y = 13, - elevation = 1, - movementType = 24, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "Route108_EventScript_Matthew"), - NpcDef( - entityIdx = 3, - graphicsId = 43, - x = 8, - y = 7, - elevation = 1, - movementType = 20, - movementRangeX = 6, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "Route108_EventScript_Missy"), - NpcDef( - entityIdx = 4, - graphicsId = 34, - x = 41, - y = 5, - elevation = 3, - movementType = 10, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 3, - script = "Route108_EventScript_Carolina"), - NpcDef( - entityIdx = 5, - graphicsId = 49, - x = 43, - y = 5, - elevation = 3, - movementType = 9, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 2, - script = "Route108_EventScript_Cory"), - ), - bgEvents = - listOf( - BgEventDef( - x = 38, - y = 14, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - ), - ), - // Route109 (MAP_ROUTE109) - MapDef( - regionId = 1, - bankId = 50, - mapId = 24, - width = 40, - height = 63, - paletteIdx1 = 100, - paletteIdx2 = 104, - unknownShort = 401, - unknownByte = 24, - borderTiles = - listOf( - Tile2D(0x0170, 0), Tile2D(0x0170, 0), Tile2D(0x0170, 0), Tile2D(0x0170, 0)), - lighting = Lighting.REGULAR, - weather = Weather.REGULAR_WEATHER, - mapType = MapType.ROUTE, - encounterType = EncounterType.RANDOM, - connections = - listOf( - GbaConnection(direction = 2, unknown = 0, targetBank = 50, targetMap = 1), - GbaConnection(direction = 3, unknown = 40, targetBank = 50, targetMap = 23), - ), - warps = - listOf( - WarpTile( - x = 12, - y = 5, - elevation = 0, - targetRegionId = 1, - targetBankId = 78, - targetMapId = 0, - targetX = 6, - targetY = 9, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 2, - graphicsId = 42, - x = 12, - y = 36, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 3, - script = "Route109_EventScript_David"), - NpcDef( - entityIdx = 3, - graphicsId = 43, - x = 25, - y = 39, - elevation = 1, - movementType = 15, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "Route109_EventScript_Alice"), - NpcDef( - entityIdx = 4, - graphicsId = 49, - x = 15, - y = 17, - elevation = 4, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "Route109_EventScript_Huey"), - NpcDef( - entityIdx = 5, - graphicsId = 49, - x = 24, - y = 13, - elevation = 3, - movementType = 9, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 2, - script = "Route109_EventScript_Edmond"), - NpcDef( - entityIdx = 6, - graphicsId = 54, - x = 19, - y = 10, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "Route109_EventScript_Ricky"), - NpcDef( - entityIdx = 7, - graphicsId = 53, - x = 22, - y = 7, - elevation = 3, - movementType = 0, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "Route109_EventScript_Lola"), - NpcDef( - entityIdx = 8, - graphicsId = 12, - x = 11, - y = 6, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "Route109_EventScript_SeashoreHouseGirl"), - NpcDef( - entityIdx = 10, - graphicsId = 53, - x = 29, - y = 32, - elevation = 3, - movementType = 13, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "Route109_EventScript_Gwen"), - NpcDef( - entityIdx = 11, - graphicsId = 53, - x = 28, - y = 31, - elevation = 3, - movementType = 17, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "Route109_EventScript_Austina"), - NpcDef( - entityIdx = 12, - graphicsId = 50, - x = 21, - y = 56, - elevation = 3, - movementType = 9, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 2, - script = "Route109_EventScript_Carter"), - NpcDef( - entityIdx = 13, - graphicsId = 54, - x = 24, - y = 18, - elevation = 3, - movementType = 10, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 3, - script = "Route109_EventScript_SandCastleBoy"), - NpcDef( - entityIdx = 14, - graphicsId = 53, - x = 25, - y = 18, - elevation = 3, - movementType = 9, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 2, - script = "Route109_EventScript_SoftSandGirl"), - NpcDef( - entityIdx = 15, - graphicsId = 18, - x = 30, - y = 32, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "Route109_EventScript_Woman"), - NpcDef( - entityIdx = 16, - graphicsId = 26, - x = 8, - y = 41, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "Route109_EventScript_Mel"), - NpcDef( - entityIdx = 17, - graphicsId = 65, - x = 9, - y = 41, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "Route109_EventScript_Paul"), - NpcDef( - entityIdx = 18, - graphicsId = 29, - x = 33, - y = 6, - elevation = 3, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "Route109_EventScript_OldMan"), - NpcDef( - entityIdx = 19, - graphicsId = 0, - x = 32, - y = 6, - elevation = 3, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "Route109_EventScript_Zigzagoon"), - NpcDef( - entityIdx = 20, - graphicsId = 53, - x = 17, - y = 13, - elevation = 3, - movementType = 0, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "Route109_EventScript_Hailey"), - NpcDef( - entityIdx = 21, - graphicsId = 54, - x = 27, - y = 7, - elevation = 3, - movementType = 0, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "Route109_EventScript_Chandler"), - NpcDef( - entityIdx = 23, - graphicsId = 66, - x = 17, - y = 56, - elevation = 3, - movementType = 0, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "Route109_EventScript_Elijah"), - ), - bgEvents = - listOf( - BgEventDef( - x = 15, - y = 5, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "Route109_EventScript_SeashoreHouseSign"), - BgEventDef( - x = 29, - y = 10, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "Route109_EventScript_TrainerTipsSign"), - BgEventDef( - x = 16, - y = 23, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 33, - y = 5, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 9, - y = 10, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 28, - y = 20, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 13, - y = 16, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 8, - y = 42, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - ), - ), - // Route110 (MAP_ROUTE110) - MapDef( - regionId = 1, - bankId = 50, - mapId = 25, - width = 40, - height = 100, - paletteIdx1 = 100, - paletteIdx2 = 105, - unknownShort = 360, - unknownByte = 25, - borderTiles = - listOf( - Tile2D(0x0170, 0), Tile2D(0x0170, 0), Tile2D(0x0170, 0), Tile2D(0x0170, 0)), - lighting = Lighting.REGULAR, - weather = Weather.REGULAR_WEATHER, - mapType = MapType.ROUTE, - encounterType = EncounterType.RANDOM, - connections = - listOf( - GbaConnection(direction = 2, unknown = 0, targetBank = 50, targetMap = 2), - GbaConnection(direction = 1, unknown = 0, targetBank = 50, targetMap = 1), - GbaConnection(direction = 3, unknown = 60, targetBank = 50, targetMap = 18), - ), - warps = - listOf( - WarpTile( - x = 35, - y = 24, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 52, - targetX = 4, - targetY = 6, - targetElevation = 2), - WarpTile( - x = 11, - y = 66, - elevation = 0, - targetRegionId = 1, - targetBankId = 79, - targetMapId = 0, - targetX = 5, - targetY = 7, - targetElevation = 2), - WarpTile( - x = 15, - y = 16, - elevation = 0, - targetRegionId = 1, - targetBankId = 79, - targetMapId = 12, - targetX = 1, - targetY = 5, - targetElevation = 0), - WarpTile( - x = 18, - y = 16, - elevation = 0, - targetRegionId = 1, - targetBankId = 79, - targetMapId = 12, - targetX = 12, - targetY = 5, - targetElevation = 0), - WarpTile( - x = 16, - y = 88, - elevation = 0, - targetRegionId = 1, - targetBankId = 79, - targetMapId = 11, - targetX = 1, - targetY = 5, - targetElevation = 0), - WarpTile( - x = 19, - y = 88, - elevation = 0, - targetRegionId = 1, - targetBankId = 79, - targetMapId = 11, - targetX = 12, - targetY = 5, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 31, - x = 17, - y = 90, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "Route110_EventScript_Boy2"), - NpcDef( - entityIdx = 1, - graphicsId = 56, - x = 29, - y = 79, - elevation = 4, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "Route110_EventScript_CyclingGuy2"), - NpcDef( - entityIdx = 2, - graphicsId = 22, - x = 14, - y = 69, - elevation = 3, - movementType = 3, - movementRangeX = 0, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "Route110_EventScript_OldWoman"), - NpcDef( - entityIdx = 3, - graphicsId = 56, - x = 9, - y = 57, - elevation = 4, - movementType = 2, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "Route110_EventScript_CyclingGuy1"), - NpcDef( - entityIdx = 4, - graphicsId = 21, - x = 10, - y = 11, - elevation = 3, - movementType = 2, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "Route110_EventScript_OldMan"), - NpcDef( - entityIdx = 5, - graphicsId = 57, - x = 27, - y = 24, - elevation = 4, - movementType = 2, - movementRangeX = 1, - movementRangeY = 3, - trainerType = 0, - facing = 0, - script = "Route110_EventScript_CyclingGirl1"), - NpcDef( - entityIdx = 6, - graphicsId = 13, - x = 15, - y = 7, - elevation = 3, - movementType = 2, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "Route110_EventScript_Boy1"), - NpcDef( - entityIdx = 7, - graphicsId = 57, - x = 16, - y = 73, - elevation = 4, - movementType = 0, - movementRangeX = 2, - movementRangeY = 14, - trainerType = 1, - facing = 0, - script = "Route110_EventScript_Jasmine"), - NpcDef( - entityIdx = 8, - graphicsId = 56, - x = 19, - y = 31, - elevation = 4, - movementType = 0, - movementRangeX = 10, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "Route110_EventScript_Anthony"), - NpcDef( - entityIdx = 9, - graphicsId = 57, - x = 30, - y = 31, - elevation = 4, - movementType = 9, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 2, - script = "Route110_EventScript_Abigail"), - NpcDef( - entityIdx = 10, - graphicsId = 56, - x = 16, - y = 55, - elevation = 4, - movementType = 0, - movementRangeX = 4, - movementRangeY = 4, - trainerType = 1, - facing = 0, - script = "Route110_EventScript_Benjamin"), - NpcDef( - entityIdx = 11, - graphicsId = 37, - x = 3, - y = 39, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 3, - script = "Route110_EventScript_Edward"), - NpcDef( - entityIdx = 12, - graphicsId = 47, - x = 33, - y = 15, - elevation = 3, - movementType = 9, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 2, - script = "Route110_EventScript_Jaclyn"), - NpcDef( - entityIdx = 13, - graphicsId = 39, - x = 34, - y = 40, - elevation = 3, - movementType = 67, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 3, - script = "Route110_EventScript_Edwin"), - NpcDef( - entityIdx = 14, - graphicsId = 50, - x = 10, - y = 19, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "Route110_EventScript_Dale"), - NpcDef( - entityIdx = 15, - graphicsId = 60, - x = 5, - y = 11, - elevation = 3, - movementType = 12, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "BerryTreeScript"), - NpcDef( - entityIdx = 16, - graphicsId = 60, - x = 6, - y = 11, - elevation = 3, - movementType = 12, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "BerryTreeScript"), - NpcDef( - entityIdx = 17, - graphicsId = 60, - x = 7, - y = 11, - elevation = 3, - movementType = 12, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "BerryTreeScript"), - NpcDef( - entityIdx = 20, - graphicsId = 56, - x = 27, - y = 92, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "Route110_EventScript_ChallengeGuy"), - NpcDef( - entityIdx = 26, - graphicsId = 56, - x = 21, - y = 78, - elevation = 4, - movementType = 0, - movementRangeX = 7, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "Route110_EventScript_Jacob"), - NpcDef( - entityIdx = 29, - graphicsId = 35, - x = 33, - y = 69, - elevation = 3, - movementType = 14, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "Route110_EventScript_Timmy"), - NpcDef( - entityIdx = 30, - graphicsId = 18, - x = 10, - y = 76, - elevation = 3, - movementType = 9, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 2, - script = "Route110_EventScript_Isabel"), - NpcDef( - entityIdx = 31, - graphicsId = 25, - x = 7, - y = 76, - elevation = 3, - movementType = 10, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 3, - script = "Route110_EventScript_Kaleb"), - NpcDef( - entityIdx = 32, - graphicsId = 57, - x = 10, - y = 39, - elevation = 3, - movementType = 9, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 2, - script = "Route110_EventScript_Alyssa"), - NpcDef( - entityIdx = 33, - graphicsId = 66, - x = 36, - y = 40, - elevation = 3, - movementType = 66, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 2, - script = "Route110_EventScript_Joseph"), - ), - bgEvents = - listOf( - BgEventDef( - x = 15, - y = 25, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "Route110_EventScript_VandalizedSign"), - BgEventDef( - x = 9, - y = 51, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "Route110_EventScript_SeasideParkingSign"), - BgEventDef( - x = 14, - y = 88, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "Route110_EventScript_CyclingRoadSign"), - BgEventDef( - x = 20, - y = 94, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "Route110_EventScript_SlateportCitySign"), - BgEventDef( - x = 7, - y = 79, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "Route110_EventScript_Route103Sign"), - BgEventDef( - x = 3, - y = 17, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "Route110_EventScript_MauvilleCitySign"), - BgEventDef( - x = 16, - y = 25, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 17, - y = 25, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 33, - y = 39, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "Route110_EventScript_TrainerTipsPrlzSleep"), - BgEventDef( - x = 37, - y = 70, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "Route110_EventScript_TrainerTipsRegisterItems"), - BgEventDef( - x = 8, - y = 67, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "Route110_EventScript_TrickHouseSign"), - BgEventDef( - x = 32, - y = 93, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "Route110_EventScript_CyclingRoadResultsSign"), - BgEventDef( - x = 35, - y = 39, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 33, - y = 45, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 4, - y = 35, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 37, - y = 67, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 13, - y = 16, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "Route110_EventScript_CyclingRoadSign"), - ), - ), - // Route111 (MAP_ROUTE111) - MapDef( - regionId = 1, - bankId = 50, - mapId = 26, - width = 40, - height = 140, - paletteIdx1 = 100, - paletteIdx2 = 105, - unknownShort = 360, - unknownByte = 26, - borderTiles = - listOf( - Tile2D(0x0071, 0), Tile2D(0x0071, 0), Tile2D(0x0071, 0), Tile2D(0x0071, 0)), - lighting = Lighting.REGULAR, - weather = Weather.REGULAR_WEATHER, - mapType = MapType.ROUTE, - encounterType = EncounterType.RANDOM, - connections = - listOf( - GbaConnection(direction = 1, unknown = 0, targetBank = 50, targetMap = 2), - GbaConnection(direction = 3, unknown = 0, targetBank = 50, targetMap = 28), - GbaConnection(direction = 3, unknown = 20, targetBank = 50, targetMap = 27), - ), - warps = - listOf( - WarpTile( - x = 13, - y = 113, - elevation = 0, - targetRegionId = 1, - targetBankId = 68, - targetMapId = 0, - targetX = 3, - targetY = 7, - targetElevation = 0), - WarpTile( - x = 29, - y = 87, - elevation = 0, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 6, - targetX = 8, - targetY = 29, - targetElevation = 2), - WarpTile( - x = 26, - y = 18, - elevation = 0, - targetRegionId = 1, - targetBankId = 68, - targetMapId = 1, - targetX = 3, - targetY = 7, - targetElevation = 0), - WarpTile( - x = 19, - y = 58, - elevation = 0, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 94, - targetX = 10, - targetY = 14, - targetElevation = 2), - WarpTile( - x = 31, - y = 113, - elevation = 0, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 60, - targetX = 9, - targetY = 16, - targetElevation = 2), - ), - npcs = - listOf( - NpcDef( - entityIdx = 4, - graphicsId = 32, - x = 28, - y = 51, - elevation = 3, - movementType = 17, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "Route111_EventScript_Heidi"), - NpcDef( - entityIdx = 5, - graphicsId = 60, - x = 22, - y = 5, - elevation = 3, - movementType = 12, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "BerryTreeScript"), - NpcDef( - entityIdx = 6, - graphicsId = 60, - x = 23, - y = 5, - elevation = 3, - movementType = 12, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "BerryTreeScript"), - NpcDef( - entityIdx = 7, - graphicsId = 33, - x = 8, - y = 91, - elevation = 3, - movementType = 2, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "Route111_EventScript_Man1"), - NpcDef( - entityIdx = 8, - graphicsId = 31, - x = 29, - y = 37, - elevation = 3, - movementType = 17, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "Route111_EventScript_Drew"), - NpcDef( - entityIdx = 9, - graphicsId = 55, - x = 27, - y = 69, - elevation = 3, - movementType = 0, - movementRangeX = 2, - movementRangeY = 2, - trainerType = 1, - facing = 0, - script = "Route111_EventScript_Dusty"), - NpcDef( - entityIdx = 10, - graphicsId = 31, - x = 21, - y = 47, - elevation = 3, - movementType = 9, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 2, - script = "Route111_EventScript_Beau"), - NpcDef( - entityIdx = 11, - graphicsId = 32, - x = 32, - y = 66, - elevation = 3, - movementType = 24, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "Route111_EventScript_Becky"), - NpcDef( - entityIdx = 16, - graphicsId = 8, - x = 23, - y = 8, - elevation = 3, - movementType = 5, - movementRangeX = 1, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "Route111_EventScript_Girl"), - NpcDef( - entityIdx = 18, - graphicsId = 60, - x = 18, - y = 5, - elevation = 3, - movementType = 12, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "BerryTreeScript"), - NpcDef( - entityIdx = 19, - graphicsId = 60, - x = 19, - y = 5, - elevation = 3, - movementType = 12, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "BerryTreeScript"), - NpcDef( - entityIdx = 27, - graphicsId = 32, - x = 10, - y = 82, - elevation = 3, - movementType = 14, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "Route111_EventScript_Irene"), - NpcDef( - entityIdx = 28, - graphicsId = 31, - x = 11, - y = 71, - elevation = 3, - movementType = 22, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "Route111_EventScript_Travis"), - NpcDef( - entityIdx = 29, - graphicsId = 44, - x = 32, - y = 29, - elevation = 3, - movementType = 28, - movementRangeX = 1, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "Route111_EventScript_Daisuke"), - NpcDef( - entityIdx = 30, - graphicsId = 34, - x = 11, - y = 11, - elevation = 3, - movementType = 7, - movementRangeX = 4, - movementRangeY = 0, - trainerType = 1, - facing = 1, - script = "Route111_EventScript_Brooke"), - NpcDef( - entityIdx = 31, - graphicsId = 33, - x = 9, - y = 27, - elevation = 3, - movementType = 17, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "Route111_EventScript_Wilton"), - NpcDef( - entityIdx = 33, - graphicsId = 65, - x = 20, - y = 114, - elevation = 3, - movementType = 2, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "Route111_EventScript_Man2"), - NpcDef( - entityIdx = 34, - graphicsId = 31, - x = 26, - y = 132, - elevation = 3, - movementType = 9, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 2, - script = "Route111_EventScript_Tyron"), - NpcDef( - entityIdx = 35, - graphicsId = 20, - x = 20, - y = 132, - elevation = 3, - movementType = 10, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 3, - script = "Route111_EventScript_Celina"), - NpcDef( - entityIdx = 36, - graphicsId = 32, - x = 19, - y = 121, - elevation = 3, - movementType = 7, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 1, - script = "Route111_EventScript_Bianca"), - NpcDef( - entityIdx = 37, - graphicsId = 66, - x = 16, - y = 119, - elevation = 3, - movementType = 10, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 3, - script = "Route111_EventScript_Hayden"), - NpcDef( - entityIdx = 38, - graphicsId = 55, - x = 29, - y = 77, - elevation = 3, - movementType = 14, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "Route111_EventScript_Bryan"), - NpcDef( - entityIdx = 39, - graphicsId = 32, - x = 22, - y = 77, - elevation = 3, - movementType = 10, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 3, - script = "Route111_EventScript_Celia"), - NpcDef( - entityIdx = 40, - graphicsId = 31, - x = 37, - y = 77, - elevation = 3, - movementType = 9, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 2, - script = "Route111_EventScript_Branden"), - NpcDef( - entityIdx = 42, - graphicsId = 55, - x = 14, - y = 56, - elevation = 3, - movementType = 16, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "Route111_EventScript_Hiker"), - ), - bgEvents = - listOf( - BgEventDef( - x = 16, - y = 114, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "Route111_EventScript_WinstrateHouseSign"), - BgEventDef( - x = 24, - y = 126, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "Route111_EventScript_RouteSignMauville"), - BgEventDef( - x = 7, - y = 66, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "Route111_EventScript_RouteSign112"), - BgEventDef( - x = 13, - y = 6, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "Route111_EventScript_RouteSign113"), - BgEventDef( - x = 24, - y = 36, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 34, - y = 50, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 33, - y = 34, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 25, - y = 19, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "Route111_EventScript_OldLadysRestStopSign"), - BgEventDef( - x = 35, - y = 1, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 35, - y = 31, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 26, - y = 70, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 27, - y = 27, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 7, - y = 84, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "Route111_EventScript_TrainerTipsSpAtkSpDef"), - BgEventDef( - x = 14, - y = 19, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 13, - y = 19, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 19, - y = 55, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 35, - y = 66, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 24, - y = 116, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "Route111_EventScript_TrainerHillSign"), - ), - ), - // Route112 (MAP_ROUTE112) - MapDef( - regionId = 1, - bankId = 50, - mapId = 27, - width = 40, - height = 60, - paletteIdx1 = 100, - paletteIdx2 = 106, - unknownShort = 360, - unknownByte = 27, - borderTiles = - listOf( - Tile2D(0x0271, 0), Tile2D(0x0271, 0), Tile2D(0x0271, 0), Tile2D(0x0271, 0)), - lighting = Lighting.REGULAR, - weather = Weather.REGULAR_WEATHER, - mapType = MapType.ROUTE, - encounterType = EncounterType.RANDOM, - connections = - listOf( - GbaConnection( - direction = 2, unknown = -60, targetBank = 50, targetMap = 28), - GbaConnection(direction = 3, unknown = 40, targetBank = 50, targetMap = 12), - GbaConnection( - direction = 4, unknown = -20, targetBank = 50, targetMap = 26), - ), - warps = - listOf( - WarpTile( - x = 28, - y = 27, - elevation = 0, - targetRegionId = 1, - targetBankId = 69, - targetMapId = 0, - targetX = 6, - targetY = 11, - targetElevation = 0), - WarpTile( - x = 29, - y = 27, - elevation = 0, - targetRegionId = 1, - targetBankId = 69, - targetMapId = 0, - targetX = 7, - targetY = 11, - targetElevation = 0), - WarpTile( - x = 6, - y = 46, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 13, - targetX = 14, - targetY = 40, - targetElevation = 2), - WarpTile( - x = 7, - y = 46, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 13, - targetX = 15, - targetY = 40, - targetElevation = 2), - WarpTile( - x = 11, - y = 36, - elevation = 0, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 14, - targetX = 26, - targetY = 36, - targetElevation = 2), - WarpTile( - x = 22, - y = 10, - elevation = 0, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 14, - targetX = 26, - targetY = 4, - targetElevation = 2), - ), - npcs = - listOf( - NpcDef( - entityIdx = 1, - graphicsId = 55, - x = 24, - y = 34, - elevation = 3, - movementType = 14, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "Route112_EventScript_Brice"), - NpcDef( - entityIdx = 2, - graphicsId = 31, - x = 29, - y = 49, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "Route112_EventScript_Larry"), - NpcDef( - entityIdx = 3, - graphicsId = 32, - x = 22, - y = 46, - elevation = 3, - movementType = 23, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "Route112_EventScript_Carol"), - NpcDef( - entityIdx = 4, - graphicsId = 55, - x = 15, - y = 40, - elevation = 3, - movementType = 16, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "Route112_EventScript_Trent"), - NpcDef( - entityIdx = 6, - graphicsId = 60, - x = 27, - y = 6, - elevation = 3, - movementType = 12, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "BerryTreeScript"), - NpcDef( - entityIdx = 7, - graphicsId = 60, - x = 28, - y = 6, - elevation = 3, - movementType = 12, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "BerryTreeScript"), - NpcDef( - entityIdx = 8, - graphicsId = 60, - x = 29, - y = 6, - elevation = 3, - movementType = 12, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "BerryTreeScript"), - NpcDef( - entityIdx = 9, - graphicsId = 60, - x = 30, - y = 6, - elevation = 3, - movementType = 12, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "BerryTreeScript"), - NpcDef( - entityIdx = 10, - graphicsId = 55, - x = 8, - y = 50, - elevation = 3, - movementType = 26, - movementRangeX = 0, - movementRangeY = 3, - trainerType = 0, - facing = 0, - script = "Route112_EventScript_Hiker"), - NpcDef( - entityIdx = 12, - graphicsId = 66, - x = 31, - y = 7, - elevation = 3, - movementType = 18, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "Route112_EventScript_Bryant"), - NpcDef( - entityIdx = 13, - graphicsId = 20, - x = 31, - y = 11, - elevation = 3, - movementType = 15, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "Route112_EventScript_Shayla"), - ), - bgEvents = - listOf( - BgEventDef( - x = 19, - y = 44, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "Route112_EventScript_MtChimneySign"), - BgEventDef( - x = 22, - y = 37, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "Route112_EventScript_MtChimneyCableCarSign"), - BgEventDef( - x = 4, - y = 49, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "Route112_EventScript_RouteSignLavaridge"), - ), - ), - // Route113 (MAP_ROUTE113) - MapDef( - regionId = 1, - bankId = 50, - mapId = 28, - width = 100, - height = 20, - paletteIdx1 = 100, - paletteIdx2 = 107, - unknownShort = 418, - unknownByte = 28, - borderTiles = - listOf( - Tile2D(0x026D, 0), Tile2D(0x026E, 0), Tile2D(0x0275, 0), Tile2D(0x0276, 0)), - lighting = Lighting.REGULAR, - weather = Weather.REGULAR_WEATHER, - mapType = MapType.ROUTE, - encounterType = EncounterType.RANDOM, - connections = - listOf( - GbaConnection(direction = 1, unknown = 60, targetBank = 50, targetMap = 27), - GbaConnection(direction = 3, unknown = 0, targetBank = 50, targetMap = 13), - GbaConnection(direction = 4, unknown = 0, targetBank = 50, targetMap = 26), - ), - warps = - listOf( - WarpTile( - x = 33, - y = 5, - elevation = 0, - targetRegionId = 1, - targetBankId = 80, - targetMapId = 0, - targetX = 3, - targetY = 8, - targetElevation = 0), - WarpTile( - x = 41, - y = 12, - elevation = 0, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 104, - targetX = 8, - targetY = 18, - targetElevation = 0), - WarpTile( - x = 88, - y = 5, - elevation = 0, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 104, - targetX = 8, - targetY = 18, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 5, - x = 66, - y = 12, - elevation = 3, - movementType = 5, - movementRangeX = 1, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "Route113_EventScript_NinjaBoy"), - NpcDef( - entityIdx = 1, - graphicsId = 48, - x = 36, - y = 10, - elevation = 3, - movementType = 3, - movementRangeX = 0, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "Route113_EventScript_Gentleman"), - NpcDef( - entityIdx = 2, - graphicsId = 35, - x = 62, - y = 8, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "Route113_EventScript_Jaylen"), - NpcDef( - entityIdx = 3, - graphicsId = 35, - x = 21, - y = 11, - elevation = 3, - movementType = 17, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "Route113_EventScript_Dillon"), - NpcDef( - entityIdx = 4, - graphicsId = 34, - x = 51, - y = 11, - elevation = 3, - movementType = 23, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "Route113_EventScript_Madeline"), - NpcDef( - entityIdx = 7, - graphicsId = 5, - x = 29, - y = 6, - elevation = 3, - movementType = 0, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "Route113_EventScript_Lao"), - NpcDef( - entityIdx = 8, - graphicsId = 5, - x = 71, - y = 2, - elevation = 3, - movementType = 0, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "Route113_EventScript_Lung"), - NpcDef( - entityIdx = 9, - graphicsId = 6, - x = 45, - y = 6, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "Route113_EventScript_Tori"), - NpcDef( - entityIdx = 10, - graphicsId = 6, - x = 46, - y = 6, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "Route113_EventScript_Tia"), - NpcDef( - entityIdx = 12, - graphicsId = 39, - x = 75, - y = 3, - elevation = 3, - movementType = 9, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 2, - script = "Route113_EventScript_Wyatt"), - NpcDef( - entityIdx = 13, - graphicsId = 31, - x = 71, - y = 4, - elevation = 3, - movementType = 7, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 1, - script = "Route113_EventScript_Lawrence"), - NpcDef( - entityIdx = 14, - graphicsId = 32, - x = 7, - y = 6, - elevation = 3, - movementType = 26, - movementRangeX = 1, - movementRangeY = 3, - trainerType = 1, - facing = 0, - script = "Route113_EventScript_Sophie"), - NpcDef( - entityIdx = 15, - graphicsId = 66, - x = 7, - y = 13, - elevation = 3, - movementType = 25, - movementRangeX = 1, - movementRangeY = 3, - trainerType = 1, - facing = 0, - script = "Route113_EventScript_Coby"), - ), - bgEvents = - listOf( - BgEventDef( - x = 85, - y = 6, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "Route113_EventScript_RouteSign111"), - BgEventDef( - x = 12, - y = 9, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "Route113_EventScript_RouteSignFallarbor"), - BgEventDef( - x = 58, - y = 4, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "Route113_EventScript_TrainerTipsRegisterKeyItems"), - BgEventDef( - x = 31, - y = 5, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "Route113_EventScript_GlassWorkshopSign"), - BgEventDef( - x = 49, - y = 8, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 66, - y = 3, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 22, - y = 5, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 73, - y = 3, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - ), - ), - // Route114 (MAP_ROUTE114) - MapDef( - regionId = 1, - bankId = 50, - mapId = 29, - width = 40, - height = 80, - paletteIdx1 = 100, - paletteIdx2 = 107, - unknownShort = 360, - unknownByte = 29, - borderTiles = - listOf( - Tile2D(0x026B, 0), Tile2D(0x026C, 0), Tile2D(0x0273, 0), Tile2D(0x0274, 0)), - lighting = Lighting.REGULAR, - weather = Weather.REGULAR_WEATHER, - mapType = MapType.ROUTE, - encounterType = EncounterType.RANDOM, - connections = - listOf( - GbaConnection(direction = 3, unknown = 40, targetBank = 50, targetMap = 30), - GbaConnection(direction = 4, unknown = 0, targetBank = 50, targetMap = 13), - ), - warps = - listOf( - WarpTile( - x = 8, - y = 63, - elevation = 0, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 0, - targetX = 27, - targetY = 18, - targetElevation = 3), - WarpTile( - x = 29, - y = 5, - elevation = 0, - targetRegionId = 1, - targetBankId = 70, - targetMapId = 0, - targetX = 4, - targetY = 7, - targetElevation = 0), - WarpTile( - x = 27, - y = 36, - elevation = 0, - targetRegionId = 1, - targetBankId = 70, - targetMapId = 2, - targetX = 5, - targetY = 7, - targetElevation = 0), - WarpTile( - x = 6, - y = 46, - elevation = 0, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 104, - targetX = 8, - targetY = 18, - targetElevation = 0), - WarpTile( - x = 7, - y = 4, - elevation = 0, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 104, - targetX = 8, - targetY = 18, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 60, - x = 31, - y = 43, - elevation = 3, - movementType = 12, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "BerryTreeScript"), - NpcDef( - entityIdx = 1, - graphicsId = 60, - x = 31, - y = 44, - elevation = 3, - movementType = 12, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "BerryTreeScript"), - NpcDef( - entityIdx = 2, - graphicsId = 55, - x = 15, - y = 65, - elevation = 7, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 3, - script = "Route114_EventScript_Lenny"), - NpcDef( - entityIdx = 3, - graphicsId = 55, - x = 30, - y = 72, - elevation = 5, - movementType = 9, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 2, - script = "Route114_EventScript_Lucas"), - NpcDef( - entityIdx = 4, - graphicsId = 31, - x = 22, - y = 50, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 3, - script = "Route114_EventScript_Shane"), - NpcDef( - entityIdx = 5, - graphicsId = 32, - x = 19, - y = 35, - elevation = 3, - movementType = 1, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "Route114_EventScript_Nancy"), - NpcDef( - entityIdx = 6, - graphicsId = 39, - x = 20, - y = 56, - elevation = 3, - movementType = 7, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 1, - script = "Route114_EventScript_Steve"), - NpcDef( - entityIdx = 7, - graphicsId = 60, - x = 31, - y = 45, - elevation = 3, - movementType = 12, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "BerryTreeScript"), - NpcDef( - entityIdx = 11, - graphicsId = 48, - x = 19, - y = 11, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 3, - script = "Route114_EventScript_RoarGentleman"), - NpcDef( - entityIdx = 12, - graphicsId = 0, - x = 19, - y = 12, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 3, - script = "Route114_EventScript_Poochyena"), - NpcDef( - entityIdx = 13, - graphicsId = 65, - x = 27, - y = 42, - elevation = 3, - movementType = 3, - movementRangeX = 0, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "Route114_EventScript_Man"), - NpcDef( - entityIdx = 14, - graphicsId = 50, - x = 25, - y = 6, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "Route114_EventScript_Nolan"), - NpcDef( - entityIdx = 15, - graphicsId = 50, - x = 19, - y = 26, - elevation = 3, - movementType = 9, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 2, - script = "Route114_EventScript_Claude"), - NpcDef( - entityIdx = 16, - graphicsId = 66, - x = 30, - y = 58, - elevation = 5, - movementType = 23, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "Route114_EventScript_Bernie"), - NpcDef( - entityIdx = 21, - graphicsId = 47, - x = 24, - y = 44, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "Route114_EventScript_Ivy"), - NpcDef( - entityIdx = 22, - graphicsId = 47, - x = 23, - y = 44, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "Route114_EventScript_Tyra"), - NpcDef( - entityIdx = 23, - graphicsId = 32, - x = 28, - y = 20, - elevation = 3, - movementType = 7, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 1, - script = "Route114_EventScript_Charlotte"), - NpcDef( - entityIdx = 24, - graphicsId = 32, - x = 26, - y = 72, - elevation = 5, - movementType = 18, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "Route114_EventScript_Angelina"), - NpcDef( - entityIdx = 26, - graphicsId = 50, - x = 28, - y = 16, - elevation = 3, - movementType = 17, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "Route114_EventScript_Kai"), - ), - bgEvents = - listOf( - BgEventDef( - x = 7, - y = 64, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "Route114_EventScript_MeteorFallsSign"), - BgEventDef( - x = 31, - y = 7, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "Route114_EventScript_FossilManiacsHouseSign"), - BgEventDef( - x = 9, - y = 47, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 30, - y = 51, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 11, - y = 62, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 19, - y = 70, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 11, - y = 27, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 12, - y = 27, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 25, - y = 38, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "Route114_EventScript_LanettesHouseSign"), - BgEventDef( - x = 20, - y = 57, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 32, - y = 57, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 7, - y = 30, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - ), - ), - // Route115 (MAP_ROUTE115) - MapDef( - regionId = 1, - bankId = 50, - mapId = 30, - width = 40, - height = 80, - paletteIdx1 = 100, - paletteIdx2 = 107, - unknownShort = 401, - unknownByte = 30, - borderTiles = - listOf( - Tile2D(0x0170, 0), Tile2D(0x0170, 0), Tile2D(0x0170, 0), Tile2D(0x0170, 0)), - lighting = Lighting.REGULAR, - weather = Weather.REGULAR_WEATHER, - mapType = MapType.ROUTE, - encounterType = EncounterType.RANDOM, - connections = - listOf( - GbaConnection(direction = 1, unknown = 0, targetBank = 50, targetMap = 3), - GbaConnection( - direction = 4, unknown = -40, targetBank = 50, targetMap = 29), - ), - warps = - listOf( - WarpTile( - x = 27, - y = 37, - elevation = 0, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 0, - targetX = 6, - targetY = 39, - targetElevation = 2), - WarpTile( - x = 21, - y = 6, - elevation = 0, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 104, - targetX = 8, - targetY = 18, - targetElevation = 0), - WarpTile( - x = 36, - y = 10, - elevation = 0, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 104, - targetX = 8, - targetY = 18, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 20, - x = 18, - y = 68, - elevation = 3, - movementType = 2, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "Route115_EventScript_Woman"), - NpcDef( - entityIdx = 1, - graphicsId = 21, - x = 5, - y = 15, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 3, - script = "Route115_EventScript_Timothy"), - NpcDef( - entityIdx = 2, - graphicsId = 44, - x = 27, - y = 53, - elevation = 3, - movementType = 15, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "Route115_EventScript_Nob"), - NpcDef( - entityIdx = 3, - graphicsId = 60, - x = 12, - y = 5, - elevation = 3, - movementType = 12, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "BerryTreeScript"), - NpcDef( - entityIdx = 4, - graphicsId = 60, - x = 13, - y = 5, - elevation = 3, - movementType = 12, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "BerryTreeScript"), - NpcDef( - entityIdx = 5, - graphicsId = 60, - x = 14, - y = 5, - elevation = 3, - movementType = 12, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "BerryTreeScript"), - NpcDef( - entityIdx = 6, - graphicsId = 14, - x = 15, - y = 50, - elevation = 3, - movementType = 64, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "Route115_EventScript_Cyndy"), - NpcDef( - entityIdx = 7, - graphicsId = 44, - x = 19, - y = 15, - elevation = 3, - movementType = 27, - movementRangeX = 5, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "Route115_EventScript_Koichi"), - NpcDef( - entityIdx = 8, - graphicsId = 39, - x = 24, - y = 62, - elevation = 3, - movementType = 18, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "Route115_EventScript_Hector"), - NpcDef( - entityIdx = 12, - graphicsId = 60, - x = 31, - y = 64, - elevation = 3, - movementType = 12, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "BerryTreeScript"), - NpcDef( - entityIdx = 13, - graphicsId = 60, - x = 31, - y = 65, - elevation = 3, - movementType = 12, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "BerryTreeScript"), - NpcDef( - entityIdx = 16, - graphicsId = 52, - x = 10, - y = 15, - elevation = 3, - movementType = 0, - movementRangeX = 3, - movementRangeY = 3, - trainerType = 1, - facing = 0, - script = "Route115_EventScript_Kyra"), - NpcDef( - entityIdx = 17, - graphicsId = 5, - x = 11, - y = 12, - elevation = 3, - movementType = 0, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "Route115_EventScript_Jaiden"), - NpcDef( - entityIdx = 18, - graphicsId = 14, - x = 15, - y = 7, - elevation = 3, - movementType = 9, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 2, - script = "Route115_EventScript_Helene"), - NpcDef( - entityIdx = 19, - graphicsId = 47, - x = 10, - y = 7, - elevation = 3, - movementType = 10, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 3, - script = "Route115_EventScript_Alix"), - NpcDef( - entityIdx = 20, - graphicsId = 47, - x = 28, - y = 62, - elevation = 3, - movementType = 9, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 2, - script = "Route115_EventScript_Marlene"), - ), - bgEvents = - listOf( - BgEventDef( - x = 32, - y = 6, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 21, - y = 18, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 16, - y = 64, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "Route115_EventScript_RouteSignRustboro"), - BgEventDef( - x = 25, - y = 38, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "Route115_EventScript_MeteorFallsSign"), - BgEventDef( - x = 8, - y = 30, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 32, - y = 39, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 26, - y = 15, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 23, - y = 8, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 32, - y = 46, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 7, - y = 20, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 8, - y = 20, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 25, - y = 24, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 20, - y = 53, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 15, - y = 49, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - ), - ), - // Route116 (MAP_ROUTE116) - MapDef( - regionId = 1, - bankId = 50, - mapId = 31, - width = 100, - height = 20, - paletteIdx1 = 100, - paletteIdx2 = 102, - unknownShort = 401, - unknownByte = 31, - borderTiles = - listOf( - Tile2D(0x01D4, 0), Tile2D(0x01D5, 0), Tile2D(0x01DC, 0), Tile2D(0x01DD, 0)), - lighting = Lighting.REGULAR, - weather = Weather.REGULAR_WEATHER, - mapType = MapType.ROUTE, - encounterType = EncounterType.RANDOM, - connections = - listOf( - GbaConnection(direction = 1, unknown = 80, targetBank = 50, targetMap = 14), - GbaConnection(direction = 3, unknown = 0, targetBank = 50, targetMap = 3), - ), - warps = - listOf( - WarpTile( - x = 47, - y = 8, - elevation = 0, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 4, - targetX = 4, - targetY = 10, - targetElevation = 2), - WarpTile( - x = 38, - y = 8, - elevation = 0, - targetRegionId = 1, - targetBankId = 71, - targetMapId = 0, - targetX = 4, - targetY = 8, - targetElevation = 0), - WarpTile( - x = 65, - y = 10, - elevation = 0, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 4, - targetX = 18, - targetY = 20, - targetElevation = 2), - WarpTile( - x = 59, - y = 13, - elevation = 0, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 104, - targetX = 8, - targetY = 18, - targetElevation = 0), - WarpTile( - x = 79, - y = 6, - elevation = 0, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 104, - targetX = 8, - targetY = 18, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 60, - x = 18, - y = 2, - elevation = 3, - movementType = 12, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "BerryTreeScript"), - NpcDef( - entityIdx = 1, - graphicsId = 60, - x = 19, - y = 2, - elevation = 3, - movementType = 12, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "BerryTreeScript"), - NpcDef( - entityIdx = 2, - graphicsId = 35, - x = 12, - y = 7, - elevation = 3, - movementType = 16, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "Route116_EventScript_Joey"), - NpcDef( - entityIdx = 5, - graphicsId = 36, - x = 13, - y = 17, - elevation = 3, - movementType = 24, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "Route116_EventScript_Jose"), - NpcDef( - entityIdx = 8, - graphicsId = 60, - x = 20, - y = 2, - elevation = 3, - movementType = 12, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "BerryTreeScript"), - NpcDef( - entityIdx = 9, - graphicsId = 60, - x = 21, - y = 2, - elevation = 3, - movementType = 12, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "BerryTreeScript"), - NpcDef( - entityIdx = 12, - graphicsId = 55, - x = 36, - y = 17, - elevation = 3, - movementType = 15, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "Route116_EventScript_Clark"), - NpcDef( - entityIdx = 15, - graphicsId = 47, - x = 26, - y = 6, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 3, - script = "Route116_EventScript_Janice"), - NpcDef( - entityIdx = 16, - graphicsId = 14, - x = 22, - y = 16, - elevation = 3, - movementType = 13, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "Route116_EventScript_Karen"), - NpcDef( - entityIdx = 17, - graphicsId = 38, - x = 28, - y = 8, - elevation = 3, - movementType = 7, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 1, - script = "Route116_EventScript_Jerry"), - NpcDef( - entityIdx = 22, - graphicsId = 20, - x = 33, - y = 8, - elevation = 3, - movementType = 7, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 1, - script = "Route116_EventScript_Sarah"), - NpcDef( - entityIdx = 23, - graphicsId = 9, - x = 33, - y = 5, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "Route116_EventScript_Dawson"), - NpcDef( - entityIdx = 26, - graphicsId = 35, - x = 36, - y = 13, - elevation = 3, - movementType = 18, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "Route116_EventScript_Johnson"), - NpcDef( - entityIdx = 27, - graphicsId = 55, - x = 42, - y = 13, - elevation = 3, - movementType = 9, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 2, - script = "Route116_EventScript_Devan"), - ), - bgEvents = - listOf( - BgEventDef( - x = 5, - y = 10, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "Route116_EventScript_RouteSignRustboro"), - BgEventDef( - x = 48, - y = 9, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "Route116_EventScript_RusturfTunnelSign"), - BgEventDef( - x = 40, - y = 9, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "Route116_EventScript_TunnelersRestHouseSign"), - BgEventDef( - x = 71, - y = 4, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 79, - y = 11, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 16, - y = 12, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "Route116_EventScript_TrainerTipsBToStopEvolution"), - BgEventDef( - x = 29, - y = 10, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "Route116_EventScript_TrainerTipsBagHasPockets"), - BgEventDef( - x = 56, - y = 6, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 55, - y = 15, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 22, - y = 9, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 70, - y = 13, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - ), - ), - // Route117 (MAP_ROUTE117) - MapDef( - regionId = 1, - bankId = 50, - mapId = 32, - width = 60, - height = 20, - paletteIdx1 = 100, - paletteIdx2 = 105, - unknownShort = 360, - unknownByte = 32, - borderTiles = - listOf( - Tile2D(0x00C6, 0), Tile2D(0x00C6, 0), Tile2D(0x00C6, 0), Tile2D(0x00C6, 0)), - lighting = Lighting.REGULAR, - weather = Weather.REGULAR_WEATHER, - mapType = MapType.ROUTE, - encounterType = EncounterType.RANDOM, - connections = - listOf( - GbaConnection(direction = 3, unknown = 0, targetBank = 50, targetMap = 14), - GbaConnection(direction = 4, unknown = 0, targetBank = 50, targetMap = 2), - ), - warps = - listOf( - WarpTile( - x = 51, - y = 5, - elevation = 0, - targetRegionId = 1, - targetBankId = 72, - targetMapId = 0, - targetX = 2, - targetY = 8, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 16, - x = 13, - y = 13, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "Route117_EventScript_Woman"), - NpcDef( - entityIdx = 1, - graphicsId = 11, - x = 25, - y = 5, - elevation = 3, - movementType = 0, - movementRangeX = 2, - movementRangeY = 2, - trainerType = 0, - facing = 0, - script = "Route117_EventScript_LittleBoy"), - NpcDef( - entityIdx = 2, - graphicsId = 29, - x = 47, - y = 4, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "Route117_EventScript_DaycareMan"), - NpcDef( - entityIdx = 3, - graphicsId = 0, - x = 33, - y = 3, - elevation = 3, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "0x0"), - NpcDef( - entityIdx = 4, - graphicsId = 0, - x = 39, - y = 4, - elevation = 3, - movementType = 1, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "0x0"), - NpcDef( - entityIdx = 5, - graphicsId = 0, - x = 42, - y = 2, - elevation = 3, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "0x0"), - NpcDef( - entityIdx = 6, - graphicsId = 0, - x = 49, - y = 2, - elevation = 3, - movementType = 1, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "0x0"), - NpcDef( - entityIdx = 7, - graphicsId = 51, - x = 38, - y = 16, - elevation = 3, - movementType = 28, - movementRangeX = 8, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "Route117_EventScript_Dylan"), - NpcDef( - entityIdx = 8, - graphicsId = 20, - x = 8, - y = 10, - elevation = 3, - movementType = 23, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "Route117_EventScript_Lydia"), - NpcDef( - entityIdx = 9, - graphicsId = 65, - x = 33, - y = 11, - elevation = 3, - movementType = 16, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "Route117_EventScript_Isaac"), - NpcDef( - entityIdx = 10, - graphicsId = 60, - x = 41, - y = 13, - elevation = 3, - movementType = 12, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "BerryTreeScript"), - NpcDef( - entityIdx = 11, - graphicsId = 60, - x = 42, - y = 13, - elevation = 3, - movementType = 12, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "BerryTreeScript"), - NpcDef( - entityIdx = 12, - graphicsId = 60, - x = 43, - y = 13, - elevation = 3, - movementType = 12, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "BerryTreeScript"), - NpcDef( - entityIdx = 16, - graphicsId = 52, - x = 26, - y = 13, - elevation = 3, - movementType = 0, - movementRangeX = 2, - movementRangeY = 2, - trainerType = 1, - facing = 0, - script = "Route117_EventScript_Maria"), - NpcDef( - entityIdx = 17, - graphicsId = 39, - x = 17, - y = 12, - elevation = 3, - movementType = 7, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 1, - script = "Route117_EventScript_Derek"), - NpcDef( - entityIdx = 18, - graphicsId = 47, - x = 43, - y = 6, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "Route117_EventScript_Meg"), - NpcDef( - entityIdx = 19, - graphicsId = 47, - x = 42, - y = 6, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "Route117_EventScript_Anna"), - NpcDef( - entityIdx = 20, - graphicsId = 10, - x = 48, - y = 10, - elevation = 3, - movementType = 2, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "Route117_EventScript_Girl"), - NpcDef( - entityIdx = 21, - graphicsId = 47, - x = 15, - y = 4, - elevation = 3, - movementType = 10, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 3, - script = "Route117_EventScript_Brandi"), - NpcDef( - entityIdx = 22, - graphicsId = 14, - x = 21, - y = 4, - elevation = 3, - movementType = 9, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 2, - script = "Route117_EventScript_Aisha"), - NpcDef( - entityIdx = 23, - graphicsId = 52, - x = 16, - y = 4, - elevation = 3, - movementType = 28, - movementRangeX = 4, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "Route117_EventScript_Melina"), - ), - bgEvents = - listOf( - BgEventDef( - x = 16, - y = 6, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "Route117_EventScript_RouteSignVerdanturf"), - BgEventDef( - x = 49, - y = 12, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "Route117_EventScript_RouteSignMauville"), - BgEventDef( - x = 49, - y = 5, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "Route117_EventScript_DayCareSign"), - BgEventDef( - x = 3, - y = 18, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - ), - ), - // Route118 (MAP_ROUTE118) - MapDef( - regionId = 1, - bankId = 50, - mapId = 33, - width = 80, - height = 20, - paletteIdx1 = 100, - paletteIdx2 = 105, - unknownShort = 0, - unknownByte = 33, - borderTiles = - listOf( - Tile2D(0x0170, 0), Tile2D(0x0170, 0), Tile2D(0x0170, 0), Tile2D(0x0170, 0)), - lighting = Lighting.REGULAR, - weather = Weather.REGULAR_WEATHER, - mapType = MapType.ROUTE, - encounterType = EncounterType.RANDOM, - connections = - listOf( - GbaConnection(direction = 2, unknown = 40, targetBank = 50, targetMap = 34), - GbaConnection(direction = 3, unknown = 0, targetBank = 50, targetMap = 2), - GbaConnection(direction = 4, unknown = 0, targetBank = 50, targetMap = 38), - ), - warps = - listOf( - WarpTile( - x = 42, - y = 6, - elevation = 0, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 104, - targetX = 8, - targetY = 18, - targetElevation = 0), - WarpTile( - x = 9, - y = 6, - elevation = 0, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 104, - targetX = 8, - targetY = 18, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 60, - x = 35, - y = 5, - elevation = 3, - movementType = 12, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "BerryTreeScript"), - NpcDef( - entityIdx = 1, - graphicsId = 60, - x = 36, - y = 5, - elevation = 3, - movementType = 12, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "BerryTreeScript"), - NpcDef( - entityIdx = 2, - graphicsId = 60, - x = 37, - y = 5, - elevation = 3, - movementType = 12, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "BerryTreeScript"), - NpcDef( - entityIdx = 3, - graphicsId = 66, - x = 64, - y = 10, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "Route118_EventScript_Perry"), - NpcDef( - entityIdx = 6, - graphicsId = 10, - x = 12, - y = 10, - elevation = 3, - movementType = 2, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "Route118_EventScript_Girl"), - NpcDef( - entityIdx = 12, - graphicsId = 50, - x = 28, - y = 8, - elevation = 3, - movementType = 9, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 2, - script = "Route118_EventScript_GoodRodFisherman"), - NpcDef( - entityIdx = 13, - graphicsId = 20, - x = 7, - y = 12, - elevation = 3, - movementType = 7, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 1, - script = "Route118_EventScript_Rose"), - NpcDef( - entityIdx = 14, - graphicsId = 50, - x = 14, - y = 14, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "Route118_EventScript_Wade"), - NpcDef( - entityIdx = 15, - graphicsId = 66, - x = 56, - y = 7, - elevation = 3, - movementType = 16, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "Route118_EventScript_Chester"), - NpcDef( - entityIdx = 16, - graphicsId = 50, - x = 39, - y = 15, - elevation = 3, - movementType = 1, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "Route118_EventScript_Barny"), - NpcDef( - entityIdx = 17, - graphicsId = 66, - x = 17, - y = 11, - elevation = 3, - movementType = 15, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "Route118_EventScript_Dalton"), - NpcDef( - entityIdx = 20, - graphicsId = 35, - x = 7, - y = 7, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "Route118_EventScript_Deandre"), - ), - bgEvents = - listOf( - BgEventDef( - x = 47, - y = 14, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 13, - y = 6, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "Route118_EventScript_RouteSignMauville"), - BgEventDef( - x = 56, - y = 8, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "Route118_EventScript_RouteSign119"), - BgEventDef( - x = 67, - y = 6, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 29, - y = 5, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 47, - y = 5, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 46, - y = 5, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 31, - y = 13, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 12, - y = 14, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - ), - ), - // Route119 (MAP_ROUTE119) - MapDef( - regionId = 1, - bankId = 50, - mapId = 34, - width = 40, - height = 140, - paletteIdx1 = 100, - paletteIdx2 = 108, - unknownShort = 402, - unknownByte = 34, - borderTiles = - listOf( - Tile2D(0x00C6, 0), Tile2D(0x00C7, 0), Tile2D(0x00C7, 0), Tile2D(0x00C6, 0)), - lighting = Lighting.REGULAR, - weather = Weather.REGULAR_WEATHER, - mapType = MapType.ROUTE, - encounterType = EncounterType.RANDOM, - connections = - listOf( - GbaConnection( - direction = 1, unknown = -40, targetBank = 50, targetMap = 33), - GbaConnection(direction = 4, unknown = 0, targetBank = 50, targetMap = 4), - ), - warps = - listOf( - WarpTile( - x = 6, - y = 32, - elevation = 0, - targetRegionId = 1, - targetBankId = 82, - targetMapId = 0, - targetX = 9, - targetY = 12, - targetElevation = 0), - WarpTile( - x = 33, - y = 109, - elevation = 0, - targetRegionId = 1, - targetBankId = 82, - targetMapId = 2, - targetX = 3, - targetY = 8, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 60, - x = 24, - y = 5, - elevation = 3, - movementType = 12, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "BerryTreeScript"), - NpcDef( - entityIdx = 1, - graphicsId = 60, - x = 25, - y = 5, - elevation = 3, - movementType = 12, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "BerryTreeScript"), - NpcDef( - entityIdx = 2, - graphicsId = 60, - x = 26, - y = 5, - elevation = 3, - movementType = 12, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "BerryTreeScript"), - NpcDef( - entityIdx = 3, - graphicsId = 36, - x = 12, - y = 123, - elevation = 3, - movementType = 0, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "Route119_EventScript_Greg"), - NpcDef( - entityIdx = 4, - graphicsId = 39, - x = 26, - y = 123, - elevation = 3, - movementType = 0, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "Route119_EventScript_Taylor"), - NpcDef( - entityIdx = 5, - graphicsId = 39, - x = 5, - y = 125, - elevation = 3, - movementType = 0, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "Route119_EventScript_Donald"), - NpcDef( - entityIdx = 6, - graphicsId = 31, - x = 7, - y = 74, - elevation = 3, - movementType = 18, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "Route119_EventScript_Jackson"), - NpcDef( - entityIdx = 7, - graphicsId = 39, - x = 28, - y = 116, - elevation = 3, - movementType = 0, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "Route119_EventScript_Brent"), - NpcDef( - entityIdx = 8, - graphicsId = 32, - x = 35, - y = 83, - elevation = 4, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "Route119_EventScript_Catherine"), - NpcDef( - entityIdx = 9, - graphicsId = 36, - x = 34, - y = 122, - elevation = 3, - movementType = 0, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "Route119_EventScript_Doug"), - NpcDef( - entityIdx = 10, - graphicsId = 36, - x = 17, - y = 128, - elevation = 3, - movementType = 0, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "Route119_EventScript_Kent"), - NpcDef( - entityIdx = 11, - graphicsId = 5, - x = 28, - y = 14, - elevation = 3, - movementType = 0, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "Route119_EventScript_Yasu"), - NpcDef( - entityIdx = 12, - graphicsId = 5, - x = 19, - y = 49, - elevation = 3, - movementType = 0, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "Route119_EventScript_Takashi"), - NpcDef( - entityIdx = 13, - graphicsId = 66, - x = 10, - y = 50, - elevation = 4, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 3, - script = "Route119_EventScript_Hugh"), - NpcDef( - entityIdx = 14, - graphicsId = 66, - x = 8, - y = 63, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "Route119_EventScript_Phil"), - NpcDef( - entityIdx = 25, - graphicsId = 13, - x = 31, - y = 109, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "Route119_EventScript_Boy1"), - NpcDef( - entityIdx = 26, - graphicsId = 60, - x = 8, - y = 23, - elevation = 3, - movementType = 12, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "BerryTreeScript"), - NpcDef( - entityIdx = 27, - graphicsId = 60, - x = 9, - y = 23, - elevation = 3, - movementType = 12, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "BerryTreeScript"), - NpcDef( - entityIdx = 28, - graphicsId = 60, - x = 29, - y = 90, - elevation = 3, - movementType = 12, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "BerryTreeScript"), - NpcDef( - entityIdx = 29, - graphicsId = 60, - x = 30, - y = 90, - elevation = 3, - movementType = 12, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "BerryTreeScript"), - NpcDef( - entityIdx = 30, - graphicsId = 56, - x = 19, - y = 133, - elevation = 3, - movementType = 5, - movementRangeX = 2, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "Route119_EventScript_CyclingTriathleteM"), - NpcDef( - entityIdx = 32, - graphicsId = 9, - x = 35, - y = 93, - elevation = 4, - movementType = 2, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "Route119_EventScript_Boy2"), - NpcDef( - entityIdx = 33, - graphicsId = 5, - x = 29, - y = 6, - elevation = 3, - movementType = 0, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "Route119_EventScript_Hideo"), - NpcDef( - entityIdx = 36, - graphicsId = 50, - x = 13, - y = 104, - elevation = 3, - movementType = 10, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 3, - script = "Route119_EventScript_Chris"), - NpcDef( - entityIdx = 37, - graphicsId = 20, - x = 8, - y = 68, - elevation = 3, - movementType = 7, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 1, - script = "Route119_EventScript_Rachel"), - NpcDef( - entityIdx = 38, - graphicsId = 66, - x = 16, - y = 52, - elevation = 3, - movementType = 10, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 3, - script = "Route119_EventScript_Dayton"), - NpcDef( - entityIdx = 39, - graphicsId = 66, - x = 32, - y = 15, - elevation = 3, - movementType = 9, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 2, - script = "Route119_EventScript_Fabian"), - ), - bgEvents = - listOf( - BgEventDef( - x = 9, - y = 33, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "Route119_EventScript_WeatherInstituteSign"), - BgEventDef( - x = 27, - y = 19, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "Route119_EventScript_RouteSignFortree"), - BgEventDef( - x = 5, - y = 2, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 4, - y = 89, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 5, - y = 15, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 7, - y = 101, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 34, - y = 24, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 31, - y = 73, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 16, - y = 81, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 16, - y = 28, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 17, - y = 82, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 38, - y = 63, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 26, - y = 81, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 19, - y = 76, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 18, - y = 76, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 4, - y = 15, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 6, - y = 2, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 26, - y = 120, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 20, - y = 29, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 28, - y = 9, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "Route119_EventScript_TrainerTipsDecoration"), - ), - ), - // Route120 (MAP_ROUTE120) - MapDef( - regionId = 1, - bankId = 50, - mapId = 35, - width = 40, - height = 100, - paletteIdx1 = 100, - paletteIdx2 = 108, - unknownShort = 361, - unknownByte = 35, - borderTiles = - listOf( - Tile2D(0x00C6, 0), Tile2D(0x00C7, 0), Tile2D(0x00C7, 0), Tile2D(0x00C6, 0)), - lighting = Lighting.REGULAR, - weather = Weather.REGULAR_WEATHER, - mapType = MapType.ROUTE, - encounterType = EncounterType.RANDOM, - connections = - listOf( - GbaConnection(direction = 3, unknown = 0, targetBank = 50, targetMap = 4), - GbaConnection(direction = 4, unknown = 80, targetBank = 50, targetMap = 36), - ), - warps = - listOf( - WarpTile( - x = 7, - y = 55, - elevation = 0, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 68, - targetX = 8, - targetY = 29, - targetElevation = 2), - WarpTile( - x = 19, - y = 23, - elevation = 0, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 73, - targetX = 7, - targetY = 16, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 60, - x = 4, - y = 79, - elevation = 3, - movementType = 12, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "BerryTreeScript"), - NpcDef( - entityIdx = 1, - graphicsId = 60, - x = 5, - y = 79, - elevation = 3, - movementType = 12, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "BerryTreeScript"), - NpcDef( - entityIdx = 2, - graphicsId = 60, - x = 6, - y = 79, - elevation = 3, - movementType = 12, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "BerryTreeScript"), - NpcDef( - entityIdx = 3, - graphicsId = 60, - x = 7, - y = 79, - elevation = 3, - movementType = 12, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "BerryTreeScript"), - NpcDef( - entityIdx = 4, - graphicsId = 60, - x = 34, - y = 24, - elevation = 3, - movementType = 12, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "BerryTreeScript"), - NpcDef( - entityIdx = 5, - graphicsId = 60, - x = 35, - y = 24, - elevation = 3, - movementType = 12, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "BerryTreeScript"), - NpcDef( - entityIdx = 6, - graphicsId = 60, - x = 36, - y = 24, - elevation = 3, - movementType = 12, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "BerryTreeScript"), - NpcDef( - entityIdx = 7, - graphicsId = 60, - x = 9, - y = 92, - elevation = 5, - movementType = 12, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "BerryTreeScript"), - NpcDef( - entityIdx = 8, - graphicsId = 60, - x = 10, - y = 92, - elevation = 5, - movementType = 12, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "BerryTreeScript"), - NpcDef( - entityIdx = 9, - graphicsId = 60, - x = 11, - y = 92, - elevation = 5, - movementType = 12, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "BerryTreeScript"), - NpcDef( - entityIdx = 10, - graphicsId = 66, - x = 5, - y = 22, - elevation = 3, - movementType = 14, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "Route120_EventScript_Colin"), - NpcDef( - entityIdx = 11, - graphicsId = 66, - x = 32, - y = 14, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 3, - script = "Route120_EventScript_Robert"), - NpcDef( - entityIdx = 12, - graphicsId = 31, - x = 27, - y = 51, - elevation = 3, - movementType = 9, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 2, - script = "Route120_EventScript_Lorenzo"), - NpcDef( - entityIdx = 13, - graphicsId = 32, - x = 36, - y = 45, - elevation = 3, - movementType = 9, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 2, - script = "Route120_EventScript_Jenna"), - NpcDef( - entityIdx = 14, - graphicsId = 39, - x = 19, - y = 80, - elevation = 5, - movementType = 15, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "Route120_EventScript_Jeffrey"), - NpcDef( - entityIdx = 22, - graphicsId = 45, - x = 14, - y = 92, - elevation = 5, - movementType = 5, - movementRangeX = 1, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "Route120_EventScript_BerryBeauty"), - NpcDef( - entityIdx = 23, - graphicsId = 34, - x = 31, - y = 37, - elevation = 3, - movementType = 15, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "Route120_EventScript_Jennifer"), - NpcDef( - entityIdx = 24, - graphicsId = 55, - x = 9, - y = 60, - elevation = 3, - movementType = 21, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "Route120_EventScript_Chip"), - NpcDef( - entityIdx = 25, - graphicsId = 34, - x = 16, - y = 6, - elevation = 3, - movementType = 23, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "Route120_EventScript_Clarissa"), - NpcDef( - entityIdx = 26, - graphicsId = 34, - x = 18, - y = 34, - elevation = 3, - movementType = 9, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 2, - script = "Route120_EventScript_Angelica"), - NpcDef( - entityIdx = 33, - graphicsId = 5, - x = 10, - y = 72, - elevation = 3, - movementType = 0, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "Route120_EventScript_Keigo"), - NpcDef( - entityIdx = 34, - graphicsId = 5, - x = 19, - y = 28, - elevation = 3, - movementType = 0, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "Route120_EventScript_Riley"), - NpcDef( - entityIdx = 41, - graphicsId = 14, - x = 19, - y = 32, - elevation = 3, - movementType = 7, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 1, - script = "Route120_EventScript_Callie"), - NpcDef( - entityIdx = 42, - graphicsId = 33, - x = 14, - y = 34, - elevation = 3, - movementType = 10, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 3, - script = "Route120_EventScript_Leonel"), - ), - bgEvents = - listOf( - BgEventDef( - x = 27, - y = 3, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "Route120_EventScript_RouteSignFortree"), - BgEventDef( - x = 38, - y = 88, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "Route120_EventScript_RouteSign121"), - BgEventDef( - x = 28, - y = 62, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 30, - y = 62, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 26, - y = 10, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 29, - y = 85, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 18, - y = 12, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 38, - y = 54, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 31, - y = 23, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 9, - y = 1, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 31, - y = 11, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 0, - y = 86, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 24, - y = 42, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 5, - y = 76, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - ), - ), - // Route121 (MAP_ROUTE121) - MapDef( - regionId = 1, - bankId = 50, - mapId = 36, - width = 80, - height = 20, - paletteIdx1 = 100, - paletteIdx2 = 109, - unknownShort = 361, - unknownByte = 36, - borderTiles = - listOf( - Tile2D(0x01D4, 0), Tile2D(0x01D5, 0), Tile2D(0x01DC, 0), Tile2D(0x01DD, 0)), - lighting = Lighting.REGULAR, - weather = Weather.REGULAR_WEATHER, - mapType = MapType.ROUTE, - encounterType = EncounterType.RANDOM, - connections = - listOf( - GbaConnection(direction = 1, unknown = 20, targetBank = 50, targetMap = 37), - GbaConnection( - direction = 3, unknown = -80, targetBank = 50, targetMap = 35), - GbaConnection(direction = 4, unknown = -10, targetBank = 50, targetMap = 5), - ), - warps = - listOf( - WarpTile( - x = 37, - y = 5, - elevation = 0, - targetRegionId = 1, - targetBankId = 73, - targetMapId = 0, - targetX = 14, - targetY = 13, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 24, - x = 29, - y = 14, - elevation = 3, - movementType = 10, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 3, - script = "Route121_EventScript_Woman"), - NpcDef( - entityIdx = 1, - graphicsId = 60, - x = 14, - y = 2, - elevation = 3, - movementType = 12, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "BerryTreeScript"), - NpcDef( - entityIdx = 2, - graphicsId = 60, - x = 15, - y = 2, - elevation = 3, - movementType = 12, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "BerryTreeScript"), - NpcDef( - entityIdx = 3, - graphicsId = 60, - x = 16, - y = 2, - elevation = 3, - movementType = 12, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "BerryTreeScript"), - NpcDef( - entityIdx = 4, - graphicsId = 60, - x = 17, - y = 2, - elevation = 3, - movementType = 12, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "BerryTreeScript"), - NpcDef( - entityIdx = 5, - graphicsId = 60, - x = 64, - y = 14, - elevation = 3, - movementType = 12, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "BerryTreeScript"), - NpcDef( - entityIdx = 6, - graphicsId = 60, - x = 65, - y = 14, - elevation = 3, - movementType = 12, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "BerryTreeScript"), - NpcDef( - entityIdx = 7, - graphicsId = 60, - x = 66, - y = 14, - elevation = 3, - movementType = 12, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "BerryTreeScript"), - NpcDef( - entityIdx = 8, - graphicsId = 60, - x = 67, - y = 14, - elevation = 3, - movementType = 12, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "BerryTreeScript"), - NpcDef( - entityIdx = 9, - graphicsId = 47, - x = 39, - y = 9, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "Route121_EventScript_Kate"), - NpcDef( - entityIdx = 10, - graphicsId = 47, - x = 40, - y = 9, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "Route121_EventScript_Joy"), - NpcDef( - entityIdx = 16, - graphicsId = 18, - x = 63, - y = 5, - elevation = 3, - movementType = 9, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 2, - script = "Route121_EventScript_Vanessa"), - NpcDef( - entityIdx = 17, - graphicsId = 48, - x = 55, - y = 8, - elevation = 3, - movementType = 9, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 2, - script = "Route121_EventScript_Walter"), - NpcDef( - entityIdx = 18, - graphicsId = 40, - x = 11, - y = 11, - elevation = 3, - movementType = 7, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 1, - script = "Route121_EventScript_Tammy"), - NpcDef( - entityIdx = 19, - graphicsId = 45, - x = 22, - y = 5, - elevation = 3, - movementType = 17, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "Route121_EventScript_Jessica"), - NpcDef( - entityIdx = 22, - graphicsId = 39, - x = 11, - y = 6, - elevation = 3, - movementType = 26, - movementRangeX = 1, - movementRangeY = 4, - trainerType = 1, - facing = 0, - script = "Route121_EventScript_Cale"), - NpcDef( - entityIdx = 23, - graphicsId = 65, - x = 59, - y = 8, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "Route121_EventScript_Myles"), - NpcDef( - entityIdx = 24, - graphicsId = 20, - x = 59, - y = 13, - elevation = 3, - movementType = 7, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 1, - script = "Route121_EventScript_Pat"), - NpcDef( - entityIdx = 25, - graphicsId = 33, - x = 65, - y = 9, - elevation = 3, - movementType = 18, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "Route121_EventScript_Marcel"), - NpcDef( - entityIdx = 26, - graphicsId = 34, - x = 72, - y = 9, - elevation = 3, - movementType = 17, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "Route121_EventScript_Cristin"), - ), - bgEvents = - listOf( - BgEventDef( - x = 32, - y = 14, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "Route121_EventScript_MtPyrePierSign"), - BgEventDef( - x = 40, - y = 11, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 18, - y = 13, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 43, - y = 7, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 42, - y = 7, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 39, - y = 6, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "Route121_EventScript_SafariZoneSign"), - BgEventDef( - x = 23, - y = 10, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 58, - y = 3, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 72, - y = 5, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 68, - y = 8, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - ), - ), - // Route122 (MAP_ROUTE122) - MapDef( - regionId = 1, - bankId = 50, - mapId = 37, - width = 40, - height = 40, - paletteIdx1 = 100, - paletteIdx2 = 109, - unknownShort = 374, - unknownByte = 37, - borderTiles = - listOf( - Tile2D(0x0170, 0), Tile2D(0x0170, 0), Tile2D(0x0170, 0), Tile2D(0x0170, 0)), - lighting = Lighting.REGULAR, - weather = Weather.REGULAR_WEATHER, - mapType = MapType.ROUTE, - encounterType = EncounterType.RANDOM, - connections = - listOf( - GbaConnection( - direction = 2, unknown = -20, targetBank = 50, targetMap = 36), - GbaConnection( - direction = 1, unknown = -100, targetBank = 50, targetMap = 38), - ), - warps = - listOf( - WarpTile( - x = 22, - y = 29, - elevation = 0, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 15, - targetX = 17, - targetY = 18, - targetElevation = 2), - ), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // Route123 (MAP_ROUTE123) - MapDef( - regionId = 1, - bankId = 50, - mapId = 38, - width = 140, - height = 20, - paletteIdx1 = 100, - paletteIdx2 = 109, - unknownShort = 374, - unknownByte = 38, - borderTiles = - listOf( - Tile2D(0x00C6, 0), Tile2D(0x00C7, 0), Tile2D(0x00C7, 0), Tile2D(0x00C6, 0)), - lighting = Lighting.REGULAR, - weather = Weather.REGULAR_WEATHER, - mapType = MapType.ROUTE, - encounterType = EncounterType.RANDOM, - connections = - listOf( - GbaConnection( - direction = 2, unknown = 100, targetBank = 50, targetMap = 37), - GbaConnection(direction = 3, unknown = 0, targetBank = 50, targetMap = 33), - ), - warps = - listOf( - WarpTile( - x = 22, - y = 6, - elevation = 0, - targetRegionId = 1, - targetBankId = 81, - targetMapId = 0, - targetX = 3, - targetY = 7, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 60, - x = 11, - y = 3, - elevation = 3, - movementType = 12, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "BerryTreeScript"), - NpcDef( - entityIdx = 1, - graphicsId = 60, - x = 12, - y = 3, - elevation = 3, - movementType = 12, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "BerryTreeScript"), - NpcDef( - entityIdx = 2, - graphicsId = 60, - x = 14, - y = 3, - elevation = 3, - movementType = 12, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "BerryTreeScript"), - NpcDef( - entityIdx = 3, - graphicsId = 60, - x = 15, - y = 3, - elevation = 3, - movementType = 12, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "BerryTreeScript"), - NpcDef( - entityIdx = 4, - graphicsId = 60, - x = 81, - y = 1, - elevation = 3, - movementType = 12, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "BerryTreeScript"), - NpcDef( - entityIdx = 5, - graphicsId = 60, - x = 82, - y = 1, - elevation = 3, - movementType = 12, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "BerryTreeScript"), - NpcDef( - entityIdx = 6, - graphicsId = 60, - x = 83, - y = 1, - elevation = 3, - movementType = 12, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "BerryTreeScript"), - NpcDef( - entityIdx = 7, - graphicsId = 34, - x = 70, - y = 12, - elevation = 3, - movementType = 24, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "Route123_EventScript_Wendy"), - NpcDef( - entityIdx = 8, - graphicsId = 33, - x = 58, - y = 7, - elevation = 3, - movementType = 17, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "Route123_EventScript_Braxton"), - NpcDef( - entityIdx = 9, - graphicsId = 60, - x = 14, - y = 5, - elevation = 3, - movementType = 12, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "BerryTreeScript"), - NpcDef( - entityIdx = 10, - graphicsId = 60, - x = 15, - y = 5, - elevation = 3, - movementType = 12, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "BerryTreeScript"), - NpcDef( - entityIdx = 11, - graphicsId = 60, - x = 17, - y = 5, - elevation = 3, - movementType = 12, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "BerryTreeScript"), - NpcDef( - entityIdx = 12, - graphicsId = 60, - x = 18, - y = 5, - elevation = 3, - movementType = 12, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "BerryTreeScript"), - NpcDef( - entityIdx = 13, - graphicsId = 60, - x = 17, - y = 3, - elevation = 3, - movementType = 12, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "BerryTreeScript"), - NpcDef( - entityIdx = 14, - graphicsId = 60, - x = 18, - y = 3, - elevation = 3, - movementType = 12, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "BerryTreeScript"), - NpcDef( - entityIdx = 15, - graphicsId = 60, - x = 11, - y = 5, - elevation = 3, - movementType = 12, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "BerryTreeScript"), - NpcDef( - entityIdx = 16, - graphicsId = 60, - x = 12, - y = 5, - elevation = 3, - movementType = 12, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "BerryTreeScript"), - NpcDef( - entityIdx = 21, - graphicsId = 14, - x = 108, - y = 13, - elevation = 3, - movementType = 15, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "Route123_EventScript_GigaDrainGirl"), - NpcDef( - entityIdx = 22, - graphicsId = 60, - x = 109, - y = 13, - elevation = 3, - movementType = 12, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "BerryTreeScript"), - NpcDef( - entityIdx = 23, - graphicsId = 60, - x = 110, - y = 13, - elevation = 3, - movementType = 12, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "BerryTreeScript"), - NpcDef( - entityIdx = 24, - graphicsId = 60, - x = 111, - y = 13, - elevation = 3, - movementType = 12, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "BerryTreeScript"), - NpcDef( - entityIdx = 25, - graphicsId = 20, - x = 18, - y = 9, - elevation = 3, - movementType = 23, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "Route123_EventScript_Violet"), - NpcDef( - entityIdx = 26, - graphicsId = 6, - x = 38, - y = 13, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "Route123_EventScript_Yuki"), - NpcDef( - entityIdx = 27, - graphicsId = 6, - x = 37, - y = 13, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "Route123_EventScript_Miu"), - NpcDef( - entityIdx = 28, - graphicsId = 37, - x = 138, - y = 12, - elevation = 3, - movementType = 9, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 2, - script = "Route123_EventScript_Cameron"), - NpcDef( - entityIdx = 29, - graphicsId = 47, - x = 49, - y = 16, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "Route123_EventScript_Jacki"), - NpcDef( - entityIdx = 30, - graphicsId = 40, - x = 87, - y = 12, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "Route123_EventScript_Kindra"), - NpcDef( - entityIdx = 33, - graphicsId = 5, - x = 138, - y = 14, - elevation = 3, - movementType = 0, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "Route123_EventScript_Jonas"), - NpcDef( - entityIdx = 34, - graphicsId = 20, - x = 138, - y = 16, - elevation = 3, - movementType = 7, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 1, - script = "Route123_EventScript_Kayley"), - NpcDef( - entityIdx = 35, - graphicsId = 39, - x = 87, - y = 17, - elevation = 3, - movementType = 7, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 1, - script = "Route123_EventScript_Ed"), - NpcDef( - entityIdx = 36, - graphicsId = 66, - x = 66, - y = 16, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "Route123_EventScript_Fernando"), - NpcDef( - entityIdx = 37, - graphicsId = 66, - x = 66, - y = 19, - elevation = 3, - movementType = 7, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 1, - script = "Route123_EventScript_Alberto"), - NpcDef( - entityIdx = 38, - graphicsId = 21, - x = 49, - y = 19, - elevation = 3, - movementType = 7, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 1, - script = "Route123_EventScript_Frederick"), - NpcDef( - entityIdx = 40, - graphicsId = 34, - x = 14, - y = 16, - elevation = 3, - movementType = 7, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 1, - script = "Route123_EventScript_Jazmyn"), - NpcDef( - entityIdx = 41, - graphicsId = 35, - x = 14, - y = 12, - elevation = 3, - movementType = 26, - movementRangeX = 1, - movementRangeY = 3, - trainerType = 1, - facing = 0, - script = "Route123_EventScript_Davis"), - ), - bgEvents = - listOf( - BgEventDef( - x = 117, - y = 10, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "Route123_EventScript_RouteSignMtPyre"), - BgEventDef( - x = 47, - y = 3, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 49, - y = 3, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 10, - y = 12, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "Route123_EventScript_RouteSign"), - BgEventDef( - x = 75, - y = 1, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 20, - y = 7, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "Route123_EventScript_BerryMastersHouseSign"), - BgEventDef( - x = 57, - y = 5, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 12, - y = 1, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 91, - y = 15, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 139, - y = 15, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 138, - y = 18, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - ), - ), - // Route124 (MAP_ROUTE124) - MapDef( - regionId = 1, - bankId = 50, - mapId = 39, - width = 80, - height = 80, - paletteIdx1 = 100, - paletteIdx2 = 110, - unknownShort = 361, - unknownByte = 39, - borderTiles = - listOf( - Tile2D(0x0170, 0), Tile2D(0x0170, 0), Tile2D(0x0170, 0), Tile2D(0x0170, 0)), - lighting = Lighting.REGULAR, - weather = Weather.REGULAR_WEATHER, - mapType = MapType.ROUTE, - encounterType = EncounterType.RANDOM, - connections = - listOf( - GbaConnection(direction = 1, unknown = 0, targetBank = 50, targetMap = 41), - GbaConnection(direction = 3, unknown = 10, targetBank = 50, targetMap = 5), - GbaConnection(direction = 4, unknown = 0, targetBank = 50, targetMap = 40), - GbaConnection(direction = 4, unknown = 40, targetBank = 50, targetMap = 6), - GbaConnection(direction = 5, unknown = 0, targetBank = 50, targetMap = 50), - ), - warps = - listOf( - WarpTile( - x = 70, - y = 48, - elevation = 2, - targetRegionId = 1, - targetBankId = 83, - targetMapId = 0, - targetX = 3, - targetY = 8, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 42, - x = 34, - y = 25, - elevation = 1, - movementType = 1, - movementRangeX = 5, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "Route124_EventScript_Spencer"), - NpcDef( - entityIdx = 1, - graphicsId = 42, - x = 61, - y = 74, - elevation = 1, - movementType = 67, - movementRangeX = 5, - movementRangeY = 3, - trainerType = 1, - facing = 3, - script = "Route124_EventScript_Roland"), - NpcDef( - entityIdx = 2, - graphicsId = 43, - x = 49, - y = 45, - elevation = 1, - movementType = 24, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "Route124_EventScript_Jenny"), - NpcDef( - entityIdx = 3, - graphicsId = 43, - x = 7, - y = 23, - elevation = 1, - movementType = 18, - movementRangeX = 6, - movementRangeY = 8, - trainerType = 1, - facing = 0, - script = "Route124_EventScript_Grace"), - NpcDef( - entityIdx = 4, - graphicsId = 42, - x = 58, - y = 58, - elevation = 1, - movementType = 28, - movementRangeX = 7, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "Route124_EventScript_Chad"), - NpcDef( - entityIdx = 8, - graphicsId = 43, - x = 18, - y = 44, - elevation = 1, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "Route124_EventScript_Lila"), - NpcDef( - entityIdx = 9, - graphicsId = 0, - x = 17, - y = 44, - elevation = 1, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "Route124_EventScript_Roy"), - NpcDef( - entityIdx = 10, - graphicsId = 42, - x = 7, - y = 29, - elevation = 1, - movementType = 7, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 1, - script = "Route124_EventScript_Declan"), - NpcDef( - entityIdx = 11, - graphicsId = 43, - x = 69, - y = 74, - elevation = 1, - movementType = 66, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 2, - script = "Route124_EventScript_Isabella"), - ), - bgEvents = - listOf( - BgEventDef( - x = 73, - y = 48, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "Route124_EventScript_HuntersHouseSign"), - ), - ), - // Route125 (MAP_ROUTE125) - MapDef( - regionId = 1, - bankId = 50, - mapId = 40, - width = 80, - height = 40, - paletteIdx1 = 100, - paletteIdx2 = 110, - unknownShort = 361, - unknownByte = 40, - borderTiles = - listOf( - Tile2D(0x0170, 0), Tile2D(0x0170, 0), Tile2D(0x0170, 0), Tile2D(0x0170, 0)), - lighting = Lighting.REGULAR, - weather = Weather.REGULAR_WEATHER, - mapType = MapType.ROUTE, - encounterType = EncounterType.RANDOM, - connections = - listOf( - GbaConnection(direction = 1, unknown = 0, targetBank = 50, targetMap = 6), - GbaConnection(direction = 3, unknown = 0, targetBank = 50, targetMap = 39), - GbaConnection(direction = 5, unknown = 0, targetBank = 50, targetMap = 56), - ), - warps = - listOf( - WarpTile( - x = 22, - y = 19, - elevation = 0, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 46, - targetX = 20, - targetY = 30, - targetElevation = 2), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 42, - x = 7, - y = 31, - elevation = 1, - movementType = 28, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "Route125_EventScript_Nolen"), - NpcDef( - entityIdx = 1, - graphicsId = 42, - x = 45, - y = 9, - elevation = 1, - movementType = 10, - movementRangeX = 2, - movementRangeY = 5, - trainerType = 1, - facing = 3, - script = "Route125_EventScript_Stan"), - NpcDef( - entityIdx = 2, - graphicsId = 43, - x = 38, - y = 24, - elevation = 1, - movementType = 28, - movementRangeX = 6, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "Route125_EventScript_Tanya"), - NpcDef( - entityIdx = 3, - graphicsId = 43, - x = 30, - y = 28, - elevation = 1, - movementType = 0, - movementRangeX = 9, - movementRangeY = 9, - trainerType = 1, - facing = 0, - script = "Route125_EventScript_Sharon"), - NpcDef( - entityIdx = 4, - graphicsId = 49, - x = 21, - y = 30, - elevation = 3, - movementType = 13, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "Route125_EventScript_Ernest"), - NpcDef( - entityIdx = 5, - graphicsId = 47, - x = 17, - y = 19, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "Route125_EventScript_Kim"), - NpcDef( - entityIdx = 6, - graphicsId = 47, - x = 18, - y = 19, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "Route125_EventScript_Iris"), - NpcDef( - entityIdx = 7, - graphicsId = 66, - x = 43, - y = 19, - elevation = 3, - movementType = 28, - movementRangeX = 2, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "Route125_EventScript_Presley"), - NpcDef( - entityIdx = 8, - graphicsId = 21, - x = 48, - y = 19, - elevation = 3, - movementType = 27, - movementRangeX = 2, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "Route125_EventScript_Auron"), - ), - bgEvents = - listOf( - BgEventDef( - x = 53, - y = 10, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 55, - y = 11, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 7, - y = 25, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 24, - y = 32, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - ), - ), - // Route126 (MAP_ROUTE126) - MapDef( - regionId = 1, - bankId = 50, - mapId = 41, - width = 80, - height = 80, - paletteIdx1 = 100, - paletteIdx2 = 110, - unknownShort = 361, - unknownByte = 41, - borderTiles = - listOf( - Tile2D(0x0170, 0), Tile2D(0x0170, 0), Tile2D(0x0170, 0), Tile2D(0x0170, 0)), - lighting = Lighting.REGULAR, - weather = Weather.REGULAR_WEATHER, - mapType = MapType.ROUTE, - encounterType = EncounterType.RANDOM, - connections = - listOf( - GbaConnection(direction = 2, unknown = 0, targetBank = 50, targetMap = 39), - GbaConnection(direction = 4, unknown = 0, targetBank = 50, targetMap = 42), - GbaConnection(direction = 5, unknown = 0, targetBank = 50, targetMap = 51), - ), - warps = emptyList(), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 42, - x = 51, - y = 65, - elevation = 1, - movementType = 0, - movementRangeX = 10, - movementRangeY = 3, - trainerType = 1, - facing = 0, - script = "Route126_EventScript_Barry"), - NpcDef( - entityIdx = 1, - graphicsId = 42, - x = 56, - y = 22, - elevation = 1, - movementType = 28, - movementRangeX = 9, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "Route126_EventScript_Dean"), - NpcDef( - entityIdx = 2, - graphicsId = 43, - x = 63, - y = 43, - elevation = 1, - movementType = 24, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "Route126_EventScript_Nikki"), - NpcDef( - entityIdx = 3, - graphicsId = 43, - x = 9, - y = 48, - elevation = 1, - movementType = 7, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 1, - script = "Route126_EventScript_Brenda"), - NpcDef( - entityIdx = 5, - graphicsId = 43, - x = 15, - y = 66, - elevation = 1, - movementType = 66, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 2, - script = "Route126_EventScript_Sienna"), - NpcDef( - entityIdx = 6, - graphicsId = 42, - x = 7, - y = 66, - elevation = 1, - movementType = 67, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 3, - script = "Route126_EventScript_Pablo"), - NpcDef( - entityIdx = 7, - graphicsId = 43, - x = 64, - y = 5, - elevation = 1, - movementType = 66, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 2, - script = "Route126_EventScript_Isobel"), - NpcDef( - entityIdx = 8, - graphicsId = 42, - x = 56, - y = 5, - elevation = 1, - movementType = 67, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 3, - script = "Route126_EventScript_Leonardo"), - ), - bgEvents = emptyList(), - ), - // Route127 (MAP_ROUTE127) - MapDef( - regionId = 1, - bankId = 50, - mapId = 42, - width = 80, - height = 80, - paletteIdx1 = 100, - paletteIdx2 = 110, - unknownShort = 361, - unknownByte = 42, - borderTiles = - listOf( - Tile2D(0x0170, 0), Tile2D(0x0170, 0), Tile2D(0x0170, 0), Tile2D(0x0170, 0)), - lighting = Lighting.REGULAR, - weather = Weather.REGULAR_WEATHER, - mapType = MapType.ROUTE, - encounterType = EncounterType.RANDOM, - connections = - listOf( - GbaConnection(direction = 2, unknown = 0, targetBank = 50, targetMap = 6), - GbaConnection(direction = 1, unknown = 0, targetBank = 50, targetMap = 43), - GbaConnection(direction = 3, unknown = 0, targetBank = 50, targetMap = 41), - GbaConnection(direction = 5, unknown = 0, targetBank = 50, targetMap = 52), - ), - warps = emptyList(), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 42, - x = 45, - y = 42, - elevation = 1, - movementType = 14, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "Route127_EventScript_Camden"), - NpcDef( - entityIdx = 1, - graphicsId = 43, - x = 18, - y = 68, - elevation = 1, - movementType = 21, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "Route127_EventScript_Donny"), - NpcDef( - entityIdx = 4, - graphicsId = 50, - x = 42, - y = 21, - elevation = 3, - movementType = 9, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 2, - script = "Route127_EventScript_Jonah"), - NpcDef( - entityIdx = 5, - graphicsId = 50, - x = 64, - y = 19, - elevation = 3, - movementType = 10, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 3, - script = "Route127_EventScript_Roger"), - NpcDef( - entityIdx = 6, - graphicsId = 50, - x = 54, - y = 14, - elevation = 3, - movementType = 7, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 1, - script = "Route127_EventScript_Henry"), - NpcDef( - entityIdx = 7, - graphicsId = 66, - x = 15, - y = 23, - elevation = 3, - movementType = 9, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 2, - script = "Route127_EventScript_Aidan"), - NpcDef( - entityIdx = 8, - graphicsId = 44, - x = 63, - y = 63, - elevation = 3, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "Route127_EventScript_Koji"), - NpcDef( - entityIdx = 9, - graphicsId = 34, - x = 12, - y = 23, - elevation = 3, - movementType = 10, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 3, - script = "Route127_EventScript_Athena"), - ), - bgEvents = - listOf( - BgEventDef( - x = 59, - y = 67, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 59, - y = 72, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 67, - y = 63, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 61, - y = 21, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 45, - y = 24, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - ), - ), - // Route128 (MAP_ROUTE128) - MapDef( - regionId = 1, - bankId = 50, - mapId = 43, - width = 120, - height = 40, - paletteIdx1 = 100, - paletteIdx2 = 110, - unknownShort = 361, - unknownByte = 43, - borderTiles = - listOf( - Tile2D(0x0170, 0), Tile2D(0x0170, 0), Tile2D(0x0170, 0), Tile2D(0x0170, 0)), - lighting = Lighting.REGULAR, - weather = Weather.REGULAR_WEATHER, - mapType = MapType.ROUTE, - encounterType = EncounterType.RANDOM, - connections = - listOf( - GbaConnection(direction = 2, unknown = 0, targetBank = 50, targetMap = 42), - GbaConnection(direction = 1, unknown = 0, targetBank = 50, targetMap = 44), - GbaConnection(direction = 4, unknown = -40, targetBank = 50, targetMap = 8), - GbaConnection(direction = 5, unknown = 0, targetBank = 50, targetMap = 53), - ), - warps = emptyList(), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 42, - x = 35, - y = 33, - elevation = 1, - movementType = 0, - movementRangeX = 5, - movementRangeY = 5, - trainerType = 1, - facing = 0, - script = "Route128_EventScript_Isaiah"), - NpcDef( - entityIdx = 1, - graphicsId = 43, - x = 78, - y = 24, - elevation = 1, - movementType = 28, - movementRangeX = 5, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "Route128_EventScript_Katelyn"), - NpcDef( - entityIdx = 5, - graphicsId = 50, - x = 63, - y = 28, - elevation = 3, - movementType = 7, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 1, - script = "Route128_EventScript_Wayne"), - NpcDef( - entityIdx = 6, - graphicsId = 33, - x = 47, - y = 9, - elevation = 3, - movementType = 10, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 3, - script = "Route128_EventScript_Ruben"), - NpcDef( - entityIdx = 7, - graphicsId = 34, - x = 24, - y = 8, - elevation = 3, - movementType = 17, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "Route128_EventScript_Alexa"), - NpcDef( - entityIdx = 8, - graphicsId = 43, - x = 101, - y = 29, - elevation = 1, - movementType = 25, - movementRangeX = 1, - movementRangeY = 3, - trainerType = 1, - facing = 0, - script = "Route128_EventScript_Carlee"), - NpcDef( - entityIdx = 9, - graphicsId = 42, - x = 101, - y = 22, - elevation = 1, - movementType = 26, - movementRangeX = 1, - movementRangeY = 3, - trainerType = 1, - facing = 0, - script = "Route128_EventScript_Harrison"), - ), - bgEvents = - listOf( - BgEventDef( - x = 49, - y = 9, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 57, - y = 21, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 31, - y = 33, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - ), - ), - // Route129 (MAP_ROUTE129) - MapDef( - regionId = 1, - bankId = 50, - mapId = 44, - width = 80, - height = 40, - paletteIdx1 = 100, - paletteIdx2 = 110, - unknownShort = 402, - unknownByte = 44, - borderTiles = - listOf( - Tile2D(0x0170, 0), Tile2D(0x0170, 0), Tile2D(0x0170, 0), Tile2D(0x0170, 0)), - lighting = Lighting.REGULAR, - weather = Weather.REGULAR_WEATHER, - mapType = MapType.ROUTE, - encounterType = EncounterType.RANDOM, - connections = - listOf( - GbaConnection(direction = 2, unknown = 0, targetBank = 50, targetMap = 43), - GbaConnection(direction = 3, unknown = 0, targetBank = 50, targetMap = 45), - GbaConnection(direction = 5, unknown = 0, targetBank = 50, targetMap = 54), - ), - warps = emptyList(), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 42, - x = 28, - y = 16, - elevation = 1, - movementType = 0, - movementRangeX = 3, - movementRangeY = 4, - trainerType = 1, - facing = 0, - script = "Route129_EventScript_Chase"), - NpcDef( - entityIdx = 1, - graphicsId = 43, - x = 10, - y = 14, - elevation = 1, - movementType = 0, - movementRangeX = 5, - movementRangeY = 2, - trainerType = 1, - facing = 0, - script = "Route129_EventScript_Allison"), - NpcDef( - entityIdx = 2, - graphicsId = 43, - x = 13, - y = 22, - elevation = 1, - movementType = 64, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "Route129_EventScript_Tisha"), - NpcDef( - entityIdx = 3, - graphicsId = 42, - x = 35, - y = 9, - elevation = 1, - movementType = 24, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "Route129_EventScript_Reed"), - NpcDef( - entityIdx = 4, - graphicsId = 42, - x = 13, - y = 27, - elevation = 1, - movementType = 65, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 1, - script = "Route129_EventScript_Clarence"), - ), - bgEvents = emptyList(), - ), - // Route130 (MAP_ROUTE130) - MapDef( - regionId = 1, - bankId = 50, - mapId = 45, - width = 80, - height = 40, - paletteIdx1 = 100, - paletteIdx2 = 119, - unknownShort = 402, - unknownByte = 45, - borderTiles = - listOf( - Tile2D(0x0170, 0), Tile2D(0x0170, 0), Tile2D(0x0170, 0), Tile2D(0x0170, 0)), - lighting = Lighting.REGULAR, - weather = Weather.REGULAR_WEATHER, - mapType = MapType.ROUTE, - encounterType = EncounterType.RANDOM, - connections = - listOf( - GbaConnection(direction = 3, unknown = 0, targetBank = 50, targetMap = 46), - GbaConnection(direction = 4, unknown = 0, targetBank = 50, targetMap = 44), - ), - warps = emptyList(), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 42, - x = 70, - y = 21, - elevation = 1, - movementType = 0, - movementRangeX = 3, - movementRangeY = 6, - trainerType = 1, - facing = 0, - script = "Route130_EventScript_Rodney"), - NpcDef( - entityIdx = 1, - graphicsId = 43, - x = 7, - y = 21, - elevation = 1, - movementType = 26, - movementRangeX = 1, - movementRangeY = 4, - trainerType = 1, - facing = 0, - script = "Route130_EventScript_Katie"), - NpcDef( - entityIdx = 3, - graphicsId = 42, - x = 7, - y = 30, - elevation = 1, - movementType = 25, - movementRangeX = 1, - movementRangeY = 4, - trainerType = 1, - facing = 0, - script = "Route130_EventScript_Santiago"), - ), - bgEvents = emptyList(), - ), - // Route131 (MAP_ROUTE131) - MapDef( - regionId = 1, - bankId = 50, - mapId = 46, - width = 60, - height = 40, - paletteIdx1 = 100, - paletteIdx2 = 112, - unknownShort = 402, - unknownByte = 46, - borderTiles = - listOf( - Tile2D(0x0170, 0), Tile2D(0x0170, 0), Tile2D(0x0170, 0), Tile2D(0x0170, 0)), - lighting = Lighting.REGULAR, - weather = Weather.REGULAR_WEATHER, - mapType = MapType.ROUTE, - encounterType = EncounterType.RANDOM, - connections = - listOf( - GbaConnection(direction = 3, unknown = 0, targetBank = 50, targetMap = 15), - GbaConnection(direction = 4, unknown = 0, targetBank = 50, targetMap = 45), - ), - warps = - listOf( - WarpTile( - x = 36, - y = 6, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 77, - targetX = 6, - targetY = 16, - targetElevation = 2), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 42, - x = 41, - y = 32, - elevation = 1, - movementType = 0, - movementRangeX = 5, - movementRangeY = 7, - trainerType = 1, - facing = 0, - script = "Route131_EventScript_Richard"), - NpcDef( - entityIdx = 1, - graphicsId = 42, - x = 18, - y = 19, - elevation = 1, - movementType = 22, - movementRangeX = 0, - movementRangeY = 7, - trainerType = 1, - facing = 0, - script = "Route131_EventScript_Herman"), - NpcDef( - entityIdx = 2, - graphicsId = 43, - x = 10, - y = 22, - elevation = 1, - movementType = 20, - movementRangeX = 6, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "Route131_EventScript_Susie"), - NpcDef( - entityIdx = 3, - graphicsId = 43, - x = 31, - y = 25, - elevation = 1, - movementType = 0, - movementRangeX = 3, - movementRangeY = 5, - trainerType = 1, - facing = 0, - script = "Route131_EventScript_Kara"), - NpcDef( - entityIdx = 4, - graphicsId = 43, - x = 9, - y = 16, - elevation = 1, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "Route131_EventScript_Reli"), - NpcDef( - entityIdx = 5, - graphicsId = 0, - x = 8, - y = 16, - elevation = 1, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "Route131_EventScript_Ian"), - NpcDef( - entityIdx = 6, - graphicsId = 42, - x = 52, - y = 20, - elevation = 1, - movementType = 26, - movementRangeX = 1, - movementRangeY = 3, - trainerType = 1, - facing = 0, - script = "Route131_EventScript_Kevin"), - NpcDef( - entityIdx = 7, - graphicsId = 43, - x = 52, - y = 27, - elevation = 1, - movementType = 25, - movementRangeX = 1, - movementRangeY = 3, - trainerType = 1, - facing = 0, - script = "Route131_EventScript_Talia"), - ), - bgEvents = emptyList(), - ), - // Route132 (MAP_ROUTE132) - MapDef( - regionId = 1, - bankId = 50, - mapId = 47, - width = 80, - height = 40, - paletteIdx1 = 100, - paletteIdx2 = 112, - unknownShort = 402, - unknownByte = 47, - borderTiles = - listOf( - Tile2D(0x0170, 0), Tile2D(0x0170, 0), Tile2D(0x0170, 0), Tile2D(0x0170, 0)), - lighting = Lighting.REGULAR, - weather = Weather.REGULAR_WEATHER, - mapType = MapType.ROUTE, - encounterType = EncounterType.RANDOM, - connections = - listOf( - GbaConnection(direction = 3, unknown = 0, targetBank = 50, targetMap = 48), - GbaConnection(direction = 4, unknown = 0, targetBank = 50, targetMap = 15), - ), - warps = emptyList(), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 42, - x = 40, - y = 13, - elevation = 1, - movementType = 0, - movementRangeX = 3, - movementRangeY = 3, - trainerType = 1, - facing = 0, - script = "Route132_EventScript_Gilbert"), - NpcDef( - entityIdx = 1, - graphicsId = 43, - x = 10, - y = 6, - elevation = 1, - movementType = 0, - movementRangeX = 3, - movementRangeY = 3, - trainerType = 1, - facing = 0, - script = "Route132_EventScript_Dana"), - NpcDef( - entityIdx = 3, - graphicsId = 44, - x = 9, - y = 15, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "Route132_EventScript_Kiyo"), - NpcDef( - entityIdx = 4, - graphicsId = 50, - x = 49, - y = 28, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 3, - script = "Route132_EventScript_Ronald"), - NpcDef( - entityIdx = 5, - graphicsId = 21, - x = 33, - y = 26, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "Route132_EventScript_Paxton"), - NpcDef( - entityIdx = 6, - graphicsId = 34, - x = 33, - y = 31, - elevation = 3, - movementType = 25, - movementRangeX = 1, - movementRangeY = 4, - trainerType = 1, - facing = 0, - script = "Route132_EventScript_Darcy"), - NpcDef( - entityIdx = 7, - graphicsId = 22, - x = 21, - y = 30, - elevation = 3, - movementType = 7, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 1, - script = "Route132_EventScript_Makayla"), - NpcDef( - entityIdx = 8, - graphicsId = 33, - x = 21, - y = 25, - elevation = 3, - movementType = 26, - movementRangeX = 1, - movementRangeY = 4, - trainerType = 1, - facing = 0, - script = "Route132_EventScript_Jonathan"), - ), - bgEvents = emptyList(), - ), - // Route133 (MAP_ROUTE133) - MapDef( - regionId = 1, - bankId = 50, - mapId = 48, - width = 80, - height = 40, - paletteIdx1 = 100, - paletteIdx2 = 112, - unknownShort = 402, - unknownByte = 48, - borderTiles = - listOf( - Tile2D(0x0170, 0), Tile2D(0x0170, 0), Tile2D(0x0170, 0), Tile2D(0x0170, 0)), - lighting = Lighting.REGULAR, - weather = Weather.REGULAR_WEATHER, - mapType = MapType.ROUTE, - encounterType = EncounterType.RANDOM, - connections = - listOf( - GbaConnection(direction = 3, unknown = 0, targetBank = 50, targetMap = 49), - GbaConnection(direction = 4, unknown = 0, targetBank = 50, targetMap = 47), - ), - warps = emptyList(), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 42, - x = 68, - y = 27, - elevation = 1, - movementType = 25, - movementRangeX = 0, - movementRangeY = 2, - trainerType = 1, - facing = 0, - script = "Route133_EventScript_Franklin"), - NpcDef( - entityIdx = 1, - graphicsId = 43, - x = 13, - y = 3, - elevation = 1, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "Route133_EventScript_Linda"), - NpcDef( - entityIdx = 2, - graphicsId = 43, - x = 68, - y = 28, - elevation = 1, - movementType = 26, - movementRangeX = 0, - movementRangeY = 2, - trainerType = 1, - facing = 0, - script = "Route133_EventScript_Debra"), - NpcDef( - entityIdx = 5, - graphicsId = 66, - x = 7, - y = 14, - elevation = 3, - movementType = 18, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "Route133_EventScript_Beck"), - NpcDef( - entityIdx = 6, - graphicsId = 33, - x = 37, - y = 15, - elevation = 3, - movementType = 18, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "Route133_EventScript_Warren"), - NpcDef( - entityIdx = 7, - graphicsId = 22, - x = 56, - y = 11, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "Route133_EventScript_Mollie"), - NpcDef( - entityIdx = 8, - graphicsId = 21, - x = 56, - y = 15, - elevation = 3, - movementType = 16, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "Route133_EventScript_Conor"), - ), - bgEvents = emptyList(), - ), - // Route134 (MAP_ROUTE134) - MapDef( - regionId = 1, - bankId = 50, - mapId = 49, - width = 80, - height = 40, - paletteIdx1 = 100, - paletteIdx2 = 112, - unknownShort = 402, - unknownByte = 49, - borderTiles = - listOf( - Tile2D(0x0170, 0), Tile2D(0x0170, 0), Tile2D(0x0170, 0), Tile2D(0x0170, 0)), - lighting = Lighting.REGULAR, - weather = Weather.REGULAR_WEATHER, - mapType = MapType.ROUTE, - encounterType = EncounterType.RANDOM, - connections = - listOf( - GbaConnection(direction = 3, unknown = 0, targetBank = 50, targetMap = 1), - GbaConnection(direction = 4, unknown = 0, targetBank = 50, targetMap = 48), - ), - warps = emptyList(), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 42, - x = 49, - y = 9, - elevation = 1, - movementType = 0, - movementRangeX = 3, - movementRangeY = 5, - trainerType = 1, - facing = 0, - script = "Route134_EventScript_Jack"), - NpcDef( - entityIdx = 1, - graphicsId = 43, - x = 58, - y = 7, - elevation = 1, - movementType = 1, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "Route134_EventScript_Laurel"), - NpcDef( - entityIdx = 2, - graphicsId = 33, - x = 41, - y = 23, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 3, - script = "Route134_EventScript_Aaron"), - NpcDef( - entityIdx = 3, - graphicsId = 66, - x = 24, - y = 23, - elevation = 3, - movementType = 26, - movementRangeX = 0, - movementRangeY = 3, - trainerType = 1, - facing = 0, - script = "Route134_EventScript_Alex"), - NpcDef( - entityIdx = 4, - graphicsId = 44, - x = 49, - y = 16, - elevation = 3, - movementType = 27, - movementRangeX = 6, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "Route134_EventScript_Hitoshi"), - NpcDef( - entityIdx = 5, - graphicsId = 34, - x = 43, - y = 23, - elevation = 1, - movementType = 9, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 2, - script = "Route134_EventScript_Marley"), - NpcDef( - entityIdx = 6, - graphicsId = 49, - x = 24, - y = 30, - elevation = 3, - movementType = 25, - movementRangeX = 0, - movementRangeY = 3, - trainerType = 1, - facing = 0, - script = "Route134_EventScript_Kelvin"), - NpcDef( - entityIdx = 7, - graphicsId = 14, - x = 50, - y = 16, - elevation = 3, - movementType = 28, - movementRangeX = 6, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "Route134_EventScript_Reyna"), - NpcDef( - entityIdx = 8, - graphicsId = 49, - x = 63, - y = 14, - elevation = 3, - movementType = 18, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "Route134_EventScript_Hudson"), - ), - bgEvents = emptyList(), - ), - // Underwater_Route124 (MAP_UNDERWATER_ROUTE124) - MapDef( - regionId = 1, - bankId = 50, - mapId = 50, - width = 80, - height = 80, - paletteIdx1 = 100, - paletteIdx2 = 144, - unknownShort = 411, - unknownByte = 50, - borderTiles = - listOf( - Tile2D(0x0213, 0), Tile2D(0x0213, 0), Tile2D(0x0213, 0), Tile2D(0x0213, 0)), - lighting = Lighting.REGULAR, - weather = Weather.UNDERWATER_MIST, - mapType = MapType.UNDERWATER, - encounterType = EncounterType.UNKNOWN_0x03, - connections = - listOf( - GbaConnection(direction = 1, unknown = 0, targetBank = 50, targetMap = 51), - GbaConnection(direction = 6, unknown = 0, targetBank = 50, targetMap = 39), - ), - warps = emptyList(), - npcs = emptyList(), - bgEvents = - listOf( - BgEventDef( - x = 42, - y = 51, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 14, - y = 40, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 66, - y = 34, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 64, - y = 54, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 70, - y = 64, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 42, - y = 5, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 45, - y = 36, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - ), - ), - // Underwater_Route126 (MAP_UNDERWATER_ROUTE126) - MapDef( - regionId = 1, - bankId = 50, - mapId = 51, - width = 80, - height = 80, - paletteIdx1 = 100, - paletteIdx2 = 144, - unknownShort = 411, - unknownByte = 51, - borderTiles = - listOf( - Tile2D(0x0213, 0), Tile2D(0x0213, 0), Tile2D(0x0213, 0), Tile2D(0x0213, 0)), - lighting = Lighting.REGULAR, - weather = Weather.UNDERWATER_MIST, - mapType = MapType.UNDERWATER, - encounterType = EncounterType.UNKNOWN_0x03, - connections = - listOf( - GbaConnection(direction = 2, unknown = 0, targetBank = 50, targetMap = 50), - GbaConnection(direction = 4, unknown = 0, targetBank = 50, targetMap = 52), - GbaConnection(direction = 6, unknown = 0, targetBank = 50, targetMap = 41), - ), - warps = - listOf( - WarpTile( - x = 45, - y = 65, - elevation = 0, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 5, - targetX = 9, - targetY = 8, - targetElevation = 0), - ), - npcs = emptyList(), - bgEvents = - listOf( - BgEventDef( - x = 30, - y = 17, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 41, - y = 19, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 63, - y = 19, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 10, - y = 36, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 11, - y = 39, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 12, - y = 35, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 65, - y = 60, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 9, - y = 77, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - ), - ), - // Underwater_Route127 (MAP_UNDERWATER_ROUTE127) - MapDef( - regionId = 1, - bankId = 50, - mapId = 52, - width = 80, - height = 80, - paletteIdx1 = 100, - paletteIdx2 = 144, - unknownShort = 411, - unknownByte = 52, - borderTiles = - listOf( - Tile2D(0x0213, 0), Tile2D(0x0213, 0), Tile2D(0x0213, 0), Tile2D(0x0213, 0)), - lighting = Lighting.REGULAR, - weather = Weather.UNDERWATER_MIST, - mapType = MapType.UNDERWATER, - encounterType = EncounterType.UNKNOWN_0x03, - connections = - listOf( - GbaConnection(direction = 6, unknown = 0, targetBank = 50, targetMap = 42), - GbaConnection(direction = 3, unknown = 0, targetBank = 50, targetMap = 51), - GbaConnection(direction = 1, unknown = 0, targetBank = 50, targetMap = 53), - ), - warps = - listOf( - WarpTile( - x = 57, - y = 5, - elevation = 0, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 101, - targetX = 9, - targetY = 8, - targetElevation = 0), - WarpTile( - x = 67, - y = 38, - elevation = 0, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 101, - targetX = 9, - targetY = 8, - targetElevation = 0), - ), - npcs = emptyList(), - bgEvents = - listOf( - BgEventDef( - x = 12, - y = 42, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 50, - y = 36, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 34, - y = 72, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 72, - y = 20, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - ), - ), - // Underwater_Route128 (MAP_UNDERWATER_ROUTE128) - MapDef( - regionId = 1, - bankId = 50, - mapId = 53, - width = 120, - height = 40, - paletteIdx1 = 100, - paletteIdx2 = 144, - unknownShort = 411, - unknownByte = 53, - borderTiles = - listOf( - Tile2D(0x0213, 0), Tile2D(0x0213, 0), Tile2D(0x0213, 0), Tile2D(0x0213, 0)), - lighting = Lighting.REGULAR, - weather = Weather.UNDERWATER_MIST, - mapType = MapType.UNDERWATER, - encounterType = EncounterType.UNKNOWN_0x03, - connections = - listOf( - GbaConnection(direction = 2, unknown = 0, targetBank = 50, targetMap = 52), - GbaConnection(direction = 6, unknown = 0, targetBank = 50, targetMap = 43), - ), - warps = - listOf( - WarpTile( - x = 38, - y = 26, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 26, - targetX = 6, - targetY = 7, - targetElevation = 0), - ), - npcs = emptyList(), - bgEvents = - listOf( - BgEventDef( - x = 38, - y = 19, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 69, - y = 18, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - ), - ), - // Underwater_Route129 (MAP_UNDERWATER_ROUTE129) - MapDef( - regionId = 1, - bankId = 50, - mapId = 54, - width = 80, - height = 40, - paletteIdx1 = 100, - paletteIdx2 = 144, - unknownShort = 411, - unknownByte = 208, - borderTiles = - listOf( - Tile2D(0x0213, 0), Tile2D(0x0213, 0), Tile2D(0x0213, 0), Tile2D(0x0213, 0)), - lighting = Lighting.REGULAR, - weather = Weather.UNDERWATER_MIST, - mapType = MapType.UNDERWATER, - encounterType = EncounterType.UNKNOWN_0x03, - connections = - listOf( - GbaConnection(direction = 6, unknown = 0, targetBank = 50, targetMap = 44), - ), - warps = - listOf( - WarpTile( - x = 26, - y = 3, - elevation = 0, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 101, - targetX = 9, - targetY = 8, - targetElevation = 0), - WarpTile( - x = 32, - y = 21, - elevation = 0, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 101, - targetX = 9, - targetY = 8, - targetElevation = 0), - ), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // Underwater_Route105 (MAP_UNDERWATER_ROUTE105) - MapDef( - regionId = 1, - bankId = 50, - mapId = 55, - width = 40, - height = 80, - paletteIdx1 = 100, - paletteIdx2 = 144, - unknownShort = 411, - unknownByte = 206, - borderTiles = - listOf( - Tile2D(0x0213, 0), Tile2D(0x0213, 0), Tile2D(0x0213, 0), Tile2D(0x0213, 0)), - lighting = Lighting.REGULAR, - weather = Weather.UNDERWATER_MIST, - mapType = MapType.UNDERWATER, - encounterType = EncounterType.UNKNOWN_0x03, - connections = - listOf( - GbaConnection(direction = 6, unknown = 0, targetBank = 50, targetMap = 20), - ), - warps = - listOf( - WarpTile( - x = 13, - y = 4, - elevation = 0, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 101, - targetX = 9, - targetY = 8, - targetElevation = 0), - WarpTile( - x = 17, - y = 66, - elevation = 0, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 101, - targetX = 9, - targetY = 8, - targetElevation = 0), - ), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // Underwater_Route125 (MAP_UNDERWATER_ROUTE125) - MapDef( - regionId = 1, - bankId = 50, - mapId = 56, - width = 80, - height = 40, - paletteIdx1 = 100, - paletteIdx2 = 144, - unknownShort = 411, - unknownByte = 207, - borderTiles = - listOf( - Tile2D(0x0213, 0), Tile2D(0x0213, 0), Tile2D(0x0213, 0), Tile2D(0x0213, 0)), - lighting = Lighting.REGULAR, - weather = Weather.UNDERWATER_MIST, - mapType = MapType.UNDERWATER, - encounterType = EncounterType.UNKNOWN_0x03, - connections = - listOf( - GbaConnection(direction = 6, unknown = 0, targetBank = 50, targetMap = 40), - ), - warps = - listOf( - WarpTile( - x = 22, - y = 10, - elevation = 0, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 101, - targetX = 9, - targetY = 8, - targetElevation = 0), - WarpTile( - x = 45, - y = 30, - elevation = 0, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 101, - targetX = 9, - targetY = 8, - targetElevation = 0), - ), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // LittlerootTown_BrendansHouse_1F (MAP_LITTLEROOT_TOWN_BRENDANS_HOUSE_1F) - MapDef( - regionId = 1, - bankId = 51, - mapId = 0, - width = 11, - height = 9, - paletteIdx1 = 116, - paletteIdx2 = 142, - unknownShort = 405, - unknownByte = 0, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 9, - y = 8, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 9, - targetX = 5, - targetY = 8, - targetElevation = 0), - WarpTile( - x = 8, - y = 8, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 9, - targetX = 5, - targetY = 8, - targetElevation = 0), - WarpTile( - x = 8, - y = 2, - elevation = 0, - targetRegionId = 1, - targetBankId = 51, - targetMapId = 1, - targetX = 7, - targetY = 1, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 3, - graphicsId = 26, - x = 2, - y = 7, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 3, - script = "RivalsHouse_1F_EventScript_RivalMom"), - NpcDef( - entityIdx = 5, - graphicsId = 5, - x = 1, - y = 5, - elevation = 3, - movementType = 5, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "RivalsHouse_1F_EventScript_RivalSibling"), - ), - bgEvents = emptyList(), - ), - // LittlerootTown_BrendansHouse_2F (MAP_LITTLEROOT_TOWN_BRENDANS_HOUSE_2F) - MapDef( - regionId = 1, - bankId = 51, - mapId = 1, - width = 9, - height = 8, - paletteIdx1 = 116, - paletteIdx2 = 142, - unknownShort = 405, - unknownByte = 0, - borderTiles = - listOf( - Tile2D(0x021F, 0), Tile2D(0x021F, 0), Tile2D(0x021F, 0), Tile2D(0x021F, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 7, - y = 1, - elevation = 0, - targetRegionId = 1, - targetBankId = 51, - targetMapId = 0, - targetX = 8, - targetY = 2, - targetElevation = 0), - ), - npcs = emptyList(), - bgEvents = - listOf( - BgEventDef( - x = 0, - y = 1, - facingDir = "BG_EVENT_PLAYER_FACING_NORTH", - script = "LittlerootTown_BrendansHouse_2F_EventScript_PC"), - BgEventDef( - x = 1, - y = 1, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "PlayersHouse_2F_EventScript_Notebook"), - BgEventDef( - x = 5, - y = 1, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "LittlerootTown_BrendansHouse_2F_EventScript_WallClock"), - BgEventDef( - x = 3, - y = 1, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "PlayersHouse_2F_EventScript_GameCube"), - ), - ), - // LittlerootTown_MaysHouse_1F (MAP_LITTLEROOT_TOWN_MAYS_HOUSE_1F) - MapDef( - regionId = 1, - bankId = 51, - mapId = 2, - width = 11, - height = 9, - paletteIdx1 = 116, - paletteIdx2 = 142, - unknownShort = 405, - unknownByte = 0, - borderTiles = - listOf( - Tile2D(0x021F, 0), Tile2D(0x021F, 0), Tile2D(0x021F, 0), Tile2D(0x021F, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 1, - y = 8, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 9, - targetX = 14, - targetY = 8, - targetElevation = 0), - WarpTile( - x = 2, - y = 8, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 9, - targetX = 14, - targetY = 8, - targetElevation = 0), - WarpTile( - x = 2, - y = 2, - elevation = 0, - targetRegionId = 1, - targetBankId = 51, - targetMapId = 3, - targetX = 1, - targetY = 1, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 215, - x = 8, - y = 6, - elevation = 3, - movementType = 9, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 2, - script = "PlayersHouse_1F_EventScript_Mom"), - ), - bgEvents = emptyList(), - ), - ) - allMaps.forEach { registerMap(it) } - } - - private fun registerDefaultMaps1() { - val allMaps = - listOf( - // LittlerootTown_MaysHouse_2F (MAP_LITTLEROOT_TOWN_MAYS_HOUSE_2F) - MapDef( - regionId = 1, - bankId = 51, - mapId = 3, - width = 9, - height = 8, - paletteIdx1 = 116, - paletteIdx2 = 142, - unknownShort = 405, - unknownByte = 0, - borderTiles = - listOf( - Tile2D(0x021F, 0), Tile2D(0x021F, 0), Tile2D(0x021F, 0), Tile2D(0x021F, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 1, - y = 1, - elevation = 0, - targetRegionId = 1, - targetBankId = 51, - targetMapId = 2, - targetX = 2, - targetY = 2, - targetElevation = 0), - ), - npcs = emptyList(), - bgEvents = - listOf( - BgEventDef( - x = 5, - y = 1, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "PlayersHouse_2F_EventScript_GameCube"), - BgEventDef( - x = 7, - y = 1, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "PlayersHouse_2F_EventScript_Notebook"), - BgEventDef( - x = 3, - y = 1, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "LittlerootTown_MaysHouse_2F_EventScript_WallClock"), - BgEventDef( - x = 8, - y = 1, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "LittlerootTown_MaysHouse_2F_EventScript_PC"), - ), - ), - // LittlerootTown_ProfessorBirchsLab (MAP_LITTLEROOT_TOWN_PROFESSOR_BIRCHS_LAB) - MapDef( - regionId = 1, - bankId = 51, - mapId = 4, - width = 13, - height = 13, - paletteIdx1 = 116, - paletteIdx2 = 143, - unknownShort = 383, - unknownByte = 0, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 6, - y = 12, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 9, - targetX = 7, - targetY = 16, - targetElevation = 0), - WarpTile( - x = 7, - y = 12, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 9, - targetX = 7, - targetY = 16, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 46, - x = 9, - y = 8, - elevation = 3, - movementType = 2, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "LittlerootTown_ProfessorBirchsLab_EventScript_Aide"), - ), - bgEvents = - listOf( - BgEventDef( - x = 10, - y = 7, - facingDir = "BG_EVENT_PLAYER_FACING_NORTH", - script = "LittlerootTown_ProfessorBirchsLab_EventScript_Machine"), - BgEventDef( - x = 11, - y = 7, - facingDir = "BG_EVENT_PLAYER_FACING_NORTH", - script = "LittlerootTown_ProfessorBirchsLab_EventScript_Machine"), - BgEventDef( - x = 7, - y = 1, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "LittlerootTown_ProfessorBirchsLab_EventScript_Book"), - BgEventDef( - x = 8, - y = 1, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "LittlerootTown_ProfessorBirchsLab_EventScript_Book"), - BgEventDef( - x = 1, - y = 1, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "LittlerootTown_ProfessorBirchsLab_EventScript_Bookshelf"), - BgEventDef( - x = 0, - y = 7, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "LittlerootTown_ProfessorBirchsLab_EventScript_Bookshelf"), - BgEventDef( - x = 1, - y = 7, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "LittlerootTown_ProfessorBirchsLab_EventScript_Bookshelf"), - BgEventDef( - x = 2, - y = 7, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "LittlerootTown_ProfessorBirchsLab_EventScript_Bookshelf"), - BgEventDef( - x = 3, - y = 7, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "LittlerootTown_ProfessorBirchsLab_EventScript_Bookshelf"), - BgEventDef( - x = 4, - y = 1, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "LittlerootTown_ProfessorBirchsLab_EventScript_PC"), - BgEventDef( - x = 3, - y = 1, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "LittlerootTown_ProfessorBirchsLab_EventScript_PC"), - BgEventDef( - x = 1, - y = 10, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "LittlerootTown_ProfessorBirchsLab_EventScript_PC"), - BgEventDef( - x = 1, - y = 9, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "LittlerootTown_ProfessorBirchsLab_EventScript_PC"), - BgEventDef( - x = 11, - y = 10, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "LittlerootTown_ProfessorBirchsLab_EventScript_PC"), - BgEventDef( - x = 11, - y = 9, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "LittlerootTown_ProfessorBirchsLab_EventScript_PC"), - ), - ), - // OldaleTown_House1 (MAP_OLDALE_TOWN_HOUSE1) - MapDef( - regionId = 1, - bankId = 52, - mapId = 0, - width = 10, - height = 9, - paletteIdx1 = 116, - paletteIdx2 = 147, - unknownShort = 363, - unknownByte = 1, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 3, - y = 8, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 10, - targetX = 5, - targetY = 7, - targetElevation = 0), - WarpTile( - x = 4, - y = 8, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 10, - targetX = 5, - targetY = 7, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 20, - x = 6, - y = 4, - elevation = 3, - movementType = 2, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "OldaleTown_House1_EventScript_Woman"), - ), - bgEvents = emptyList(), - ), - // OldaleTown_House2 (MAP_OLDALE_TOWN_HOUSE2) - MapDef( - regionId = 1, - bankId = 52, - mapId = 1, - width = 11, - height = 8, - paletteIdx1 = 116, - paletteIdx2 = 147, - unknownShort = 363, - unknownByte = 1, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 3, - y = 7, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 10, - targetX = 15, - targetY = 16, - targetElevation = 0), - WarpTile( - x = 4, - y = 7, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 10, - targetX = 15, - targetY = 16, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 18, - x = 4, - y = 4, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 3, - script = "OldaleTown_House2_EventScript_Woman"), - NpcDef( - entityIdx = 1, - graphicsId = 38, - x = 7, - y = 4, - elevation = 3, - movementType = 9, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 2, - script = "OldaleTown_House2_EventScript_Man"), - ), - bgEvents = emptyList(), - ), - // OldaleTown_PokemonCenter_1F (MAP_OLDALE_TOWN_POKEMON_CENTER_1F) - MapDef( - regionId = 1, - bankId = 52, - mapId = 2, - width = 14, - height = 9, - paletteIdx1 = 116, - paletteIdx2 = 118, - unknownShort = 400, - unknownByte = 1, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 7, - y = 8, - elevation = 2, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 10, - targetX = 6, - targetY = 16, - targetElevation = 0), - WarpTile( - x = 6, - y = 8, - elevation = 2, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 10, - targetX = 6, - targetY = 16, - targetElevation = 0), - WarpTile( - x = 1, - y = 6, - elevation = 3, - targetRegionId = 1, - targetBankId = 52, - targetMapId = 3, - targetX = 1, - targetY = 6, - targetElevation = 3), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 58, - x = 7, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "OldaleTown_PokemonCenter_1F_EventScript_Nurse"), - NpcDef( - entityIdx = 1, - graphicsId = 48, - x = 4, - y = 4, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "OldaleTown_PokemonCenter_1F_EventScript_Gentleman"), - NpcDef( - entityIdx = 2, - graphicsId = 7, - x = 10, - y = 6, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 3, - script = "OldaleTown_PokemonCenter_1F_EventScript_Boy"), - NpcDef( - entityIdx = 3, - graphicsId = 14, - x = 3, - y = 7, - elevation = 3, - movementType = 10, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 3, - script = "OldaleTown_PokemonCenter_1F_EventScript_Girl"), - ), - bgEvents = emptyList(), - ), - // OldaleTown_PokemonCenter_2F (MAP_OLDALE_TOWN_POKEMON_CENTER_2F) - MapDef( - regionId = 1, - bankId = 52, - mapId = 3, - width = 14, - height = 10, - paletteIdx1 = 116, - paletteIdx2 = 118, - unknownShort = 400, - unknownByte = 1, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 1, - y = 6, - elevation = 3, - targetRegionId = 1, - targetBankId = 52, - targetMapId = 2, - targetX = 1, - targetY = 6, - targetElevation = 3), - WarpTile( - x = 5, - y = 1, - elevation = 2, - targetRegionId = 1, - targetBankId = 75, - targetMapId = 60, - targetX = 7, - targetY = 11, - targetElevation = 2), - WarpTile( - x = 9, - y = 1, - elevation = 2, - targetRegionId = 1, - targetBankId = 75, - targetMapId = 25, - targetX = 5, - targetY = 8, - targetElevation = 2), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 0, - x = 6, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "Common_EventScript_UnionRoomAttendant"), - NpcDef( - entityIdx = 1, - graphicsId = 0, - x = 2, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "Common_EventScript_WirelessClubAttendant"), - NpcDef( - entityIdx = 2, - graphicsId = 0, - x = 10, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "Common_EventScript_DirectCornerAttendant"), - ), - bgEvents = emptyList(), - ), - // OldaleTown_Mart (MAP_OLDALE_TOWN_MART) - MapDef( - regionId = 1, - bankId = 52, - mapId = 4, - width = 11, - height = 8, - paletteIdx1 = 116, - paletteIdx2 = 117, - unknownShort = 404, - unknownByte = 1, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 3, - y = 7, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 10, - targetX = 14, - targetY = 6, - targetElevation = 0), - WarpTile( - x = 4, - y = 7, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 10, - targetX = 14, - targetY = 6, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 83, - x = 1, - y = 3, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 3, - script = "OldaleTown_Mart_EventScript_Clerk"), - NpcDef( - entityIdx = 1, - graphicsId = 34, - x = 5, - y = 5, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 3, - script = "OldaleTown_Mart_EventScript_Woman"), - NpcDef( - entityIdx = 2, - graphicsId = 7, - x = 9, - y = 4, - elevation = 3, - movementType = 3, - movementRangeX = 0, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "OldaleTown_Mart_EventScript_Boy"), - ), - bgEvents = emptyList(), - ), - // DewfordTown_House1 (MAP_DEWFORD_TOWN_HOUSE1) - MapDef( - regionId = 1, - bankId = 53, - mapId = 0, - width = 10, - height = 8, - paletteIdx1 = 116, - paletteIdx2 = 147, - unknownShort = 427, - unknownByte = 2, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 3, - y = 7, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 11, - targetX = 17, - targetY = 14, - targetElevation = 0), - WarpTile( - x = 4, - y = 7, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 11, - targetX = 17, - targetY = 14, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 24, - x = 6, - y = 3, - elevation = 3, - movementType = 9, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 2, - script = "DewfordTown_House1_EventScript_Woman"), - NpcDef( - entityIdx = 1, - graphicsId = 19, - x = 3, - y = 3, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 3, - script = "DewfordTown_House1_EventScript_Man"), - NpcDef( - entityIdx = 2, - graphicsId = 0, - x = 4, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 3, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "DewfordTown_House1_EventScript_Zigzagoon"), - ), - bgEvents = emptyList(), - ), - // DewfordTown_PokemonCenter_1F (MAP_DEWFORD_TOWN_POKEMON_CENTER_1F) - MapDef( - regionId = 1, - bankId = 53, - mapId = 1, - width = 14, - height = 9, - paletteIdx1 = 116, - paletteIdx2 = 118, - unknownShort = 400, - unknownByte = 2, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 7, - y = 8, - elevation = 2, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 11, - targetX = 2, - targetY = 10, - targetElevation = 0), - WarpTile( - x = 6, - y = 8, - elevation = 2, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 11, - targetX = 2, - targetY = 10, - targetElevation = 0), - WarpTile( - x = 1, - y = 6, - elevation = 3, - targetRegionId = 1, - targetBankId = 53, - targetMapId = 2, - targetX = 1, - targetY = 6, - targetElevation = 3), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 58, - x = 7, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "DewfordTown_PokemonCenter_1F_EventScript_Nurse"), - NpcDef( - entityIdx = 1, - graphicsId = 18, - x = 10, - y = 6, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 3, - script = "DewfordTown_PokemonCenter_1F_EventScript_PokefanF"), - NpcDef( - entityIdx = 2, - graphicsId = 33, - x = 5, - y = 5, - elevation = 3, - movementType = 5, - movementRangeX = 2, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "DewfordTown_PokemonCenter_1F_EventScript_Man"), - ), - bgEvents = emptyList(), - ), - // DewfordTown_PokemonCenter_2F (MAP_DEWFORD_TOWN_POKEMON_CENTER_2F) - MapDef( - regionId = 1, - bankId = 53, - mapId = 2, - width = 14, - height = 10, - paletteIdx1 = 116, - paletteIdx2 = 118, - unknownShort = 400, - unknownByte = 2, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 1, - y = 6, - elevation = 3, - targetRegionId = 1, - targetBankId = 53, - targetMapId = 1, - targetX = 1, - targetY = 6, - targetElevation = 3), - WarpTile( - x = 5, - y = 1, - elevation = 2, - targetRegionId = 1, - targetBankId = 75, - targetMapId = 60, - targetX = 7, - targetY = 11, - targetElevation = 2), - WarpTile( - x = 9, - y = 1, - elevation = 2, - targetRegionId = 1, - targetBankId = 75, - targetMapId = 25, - targetX = 5, - targetY = 8, - targetElevation = 2), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 0, - x = 6, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "Common_EventScript_UnionRoomAttendant"), - NpcDef( - entityIdx = 1, - graphicsId = 0, - x = 2, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "Common_EventScript_WirelessClubAttendant"), - NpcDef( - entityIdx = 2, - graphicsId = 0, - x = 10, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "Common_EventScript_DirectCornerAttendant"), - ), - bgEvents = emptyList(), - ), - // DewfordTown_Gym (MAP_DEWFORD_TOWN_GYM) - MapDef( - regionId = 1, - bankId = 53, - mapId = 3, - width = 18, - height = 28, - paletteIdx1 = 116, - paletteIdx2 = 150, - unknownShort = 364, - unknownByte = 2, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 5, - y = 27, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 11, - targetX = 8, - targetY = 17, - targetElevation = 0), - WarpTile( - x = 6, - y = 27, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 11, - targetX = 8, - targetY = 17, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 0, - x = 4, - y = 3, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "DewfordTown_Gym_EventScript_Brawly"), - NpcDef( - entityIdx = 1, - graphicsId = 44, - x = 2, - y = 18, - elevation = 3, - movementType = 7, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 1, - script = "DewfordTown_Gym_EventScript_Takao"), - NpcDef( - entityIdx = 2, - graphicsId = 14, - x = 15, - y = 3, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "DewfordTown_Gym_EventScript_Jocelyn"), - NpcDef( - entityIdx = 3, - graphicsId = 14, - x = 12, - y = 25, - elevation = 3, - movementType = 7, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 1, - script = "DewfordTown_Gym_EventScript_Laura"), - NpcDef( - entityIdx = 4, - graphicsId = 23, - x = 5, - y = 24, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "DewfordTown_Gym_EventScript_GymGuide"), - NpcDef( - entityIdx = 5, - graphicsId = 44, - x = 7, - y = 8, - elevation = 1, - movementType = 10, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 3, - script = "DewfordTown_Gym_EventScript_Cristian"), - NpcDef( - entityIdx = 6, - graphicsId = 14, - x = 16, - y = 9, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "DewfordTown_Gym_EventScript_Lilith"), - NpcDef( - entityIdx = 7, - graphicsId = 49, - x = 14, - y = 12, - elevation = 1, - movementType = 10, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 3, - script = "DewfordTown_Gym_EventScript_Brenden"), - ), - bgEvents = - listOf( - BgEventDef( - x = 4, - y = 23, - facingDir = "BG_EVENT_PLAYER_FACING_NORTH", - script = "DewfordTown_Gym_EventScript_LeftGymStatue"), - BgEventDef( - x = 7, - y = 23, - facingDir = "BG_EVENT_PLAYER_FACING_NORTH", - script = "DewfordTown_Gym_EventScript_RightGymStatue"), - BgEventDef( - x = 4, - y = 24, - facingDir = "BG_EVENT_PLAYER_FACING_NORTH", - script = "DewfordTown_Gym_EventScript_LeftGymStatue"), - BgEventDef( - x = 7, - y = 24, - facingDir = "BG_EVENT_PLAYER_FACING_NORTH", - script = "DewfordTown_Gym_EventScript_RightGymStatue"), - ), - ), - // DewfordTown_Hall (MAP_DEWFORD_TOWN_HALL) - MapDef( - regionId = 1, - bankId = 53, - mapId = 4, - width = 17, - height = 9, - paletteIdx1 = 116, - paletteIdx2 = 147, - unknownShort = 427, - unknownByte = 2, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 5, - y = 8, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 11, - targetX = 3, - targetY = 3, - targetElevation = 0), - WarpTile( - x = 6, - y = 8, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 11, - targetX = 3, - targetY = 3, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 10, - x = 4, - y = 6, - elevation = 3, - movementType = 7, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 1, - script = "DewfordTown_Hall_EventScript_Girl"), - NpcDef( - entityIdx = 1, - graphicsId = 20, - x = 1, - y = 5, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 3, - script = "DewfordTown_Hall_EventScript_Woman"), - NpcDef( - entityIdx = 2, - graphicsId = 19, - x = 5, - y = 4, - elevation = 3, - movementType = 9, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 2, - script = "DewfordTown_Hall_EventScript_Man"), - NpcDef( - entityIdx = 3, - graphicsId = 21, - x = 9, - y = 3, - elevation = 3, - movementType = 7, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 1, - script = "DewfordTown_Hall_EventScript_ExpertM"), - NpcDef( - entityIdx = 4, - graphicsId = 6, - x = 5, - y = 2, - elevation = 3, - movementType = 7, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 1, - script = "DewfordTown_Hall_EventScript_Twin"), - NpcDef( - entityIdx = 5, - graphicsId = 11, - x = 14, - y = 7, - elevation = 3, - movementType = 5, - movementRangeX = 1, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "DewfordTown_Hall_EventScript_LittleBoy"), - NpcDef( - entityIdx = 6, - graphicsId = 38, - x = 12, - y = 3, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 3, - script = "DewfordTown_Hall_EventScript_SchoolKidM"), - NpcDef( - entityIdx = 7, - graphicsId = 37, - x = 15, - y = 3, - elevation = 3, - movementType = 9, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 2, - script = "DewfordTown_Hall_EventScript_PsychicM"), - ), - bgEvents = - listOf( - BgEventDef( - x = 0, - y = 1, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "DewfordTown_Hall_EventScript_Bookshelf"), - BgEventDef( - x = 7, - y = 1, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "DewfordTown_Hall_EventScript_Painting"), - ), - ), - // DewfordTown_House2 (MAP_DEWFORD_TOWN_HOUSE2) - MapDef( - regionId = 1, - bankId = 53, - mapId = 5, - width = 10, - height = 9, - paletteIdx1 = 116, - paletteIdx2 = 147, - unknownShort = 427, - unknownByte = 2, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 3, - y = 8, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 11, - targetX = 8, - targetY = 8, - targetElevation = 0), - WarpTile( - x = 4, - y = 8, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 11, - targetX = 8, - targetY = 8, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 33, - x = 6, - y = 5, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 3, - script = "DewfordTown_House2_EventScript_Man"), - NpcDef( - entityIdx = 1, - graphicsId = 9, - x = 2, - y = 3, - elevation = 3, - movementType = 1, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "DewfordTown_House2_EventScript_Boy"), - ), - bgEvents = emptyList(), - ), - // LavaridgeTown_HerbShop (MAP_LAVARIDGE_TOWN_HERB_SHOP) - MapDef( - regionId = 1, - bankId = 54, - mapId = 0, - width = 11, - height = 8, - paletteIdx1 = 116, - paletteIdx2 = 117, - unknownShort = 363, - unknownByte = 3, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 3, - y = 7, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 12, - targetX = 12, - targetY = 15, - targetElevation = 0), - WarpTile( - x = 4, - y = 7, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 12, - targetX = 12, - targetY = 15, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 20, - x = 3, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "LavaridgeTown_HerbShop_EventScript_Clerk"), - NpcDef( - entityIdx = 1, - graphicsId = 29, - x = 7, - y = 5, - elevation = 3, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "LavaridgeTown_HerbShop_EventScript_OldMan"), - NpcDef( - entityIdx = 2, - graphicsId = 21, - x = 9, - y = 3, - elevation = 3, - movementType = 5, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "LavaridgeTown_HerbShop_EventScript_ExpertM"), - ), - bgEvents = emptyList(), - ), - // LavaridgeTown_Gym_1F (MAP_LAVARIDGE_TOWN_GYM_1F) - MapDef( - regionId = 1, - bankId = 54, - mapId = 1, - width = 17, - height = 19, - paletteIdx1 = 116, - paletteIdx2 = 152, - unknownShort = 364, - unknownByte = 3, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.STEADY_MIST, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 13, - y = 18, - elevation = 2, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 12, - targetX = 5, - targetY = 15, - targetElevation = 0), - WarpTile( - x = 14, - y = 18, - elevation = 2, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 12, - targetX = 5, - targetY = 15, - targetElevation = 0), - WarpTile( - x = 10, - y = 18, - elevation = 2, - targetRegionId = 1, - targetBankId = 54, - targetMapId = 2, - targetX = 10, - targetY = 18, - targetElevation = 2), - WarpTile( - x = 8, - y = 9, - elevation = 2, - targetRegionId = 1, - targetBankId = 54, - targetMapId = 2, - targetX = 8, - targetY = 9, - targetElevation = 2), - WarpTile( - x = 4, - y = 18, - elevation = 2, - targetRegionId = 1, - targetBankId = 54, - targetMapId = 2, - targetX = 4, - targetY = 18, - targetElevation = 2), - WarpTile( - x = 5, - y = 14, - elevation = 2, - targetRegionId = 1, - targetBankId = 54, - targetMapId = 2, - targetX = 5, - targetY = 14, - targetElevation = 2), - WarpTile( - x = 0, - y = 17, - elevation = 2, - targetRegionId = 1, - targetBankId = 54, - targetMapId = 2, - targetX = 0, - targetY = 17, - targetElevation = 2), - WarpTile( - x = 5, - y = 9, - elevation = 2, - targetRegionId = 1, - targetBankId = 54, - targetMapId = 2, - targetX = 5, - targetY = 9, - targetElevation = 2), - WarpTile( - x = 2, - y = 15, - elevation = 2, - targetRegionId = 1, - targetBankId = 54, - targetMapId = 2, - targetX = 2, - targetY = 15, - targetElevation = 2), - WarpTile( - x = 3, - y = 14, - elevation = 2, - targetRegionId = 1, - targetBankId = 54, - targetMapId = 2, - targetX = 3, - targetY = 14, - targetElevation = 2), - WarpTile( - x = 1, - y = 14, - elevation = 2, - targetRegionId = 1, - targetBankId = 54, - targetMapId = 2, - targetX = 1, - targetY = 14, - targetElevation = 2), - WarpTile( - x = 0, - y = 10, - elevation = 2, - targetRegionId = 1, - targetBankId = 54, - targetMapId = 2, - targetX = 0, - targetY = 10, - targetElevation = 2), - WarpTile( - x = 3, - y = 10, - elevation = 2, - targetRegionId = 1, - targetBankId = 54, - targetMapId = 2, - targetX = 3, - targetY = 10, - targetElevation = 2), - WarpTile( - x = 0, - y = 6, - elevation = 2, - targetRegionId = 1, - targetBankId = 54, - targetMapId = 2, - targetX = 0, - targetY = 6, - targetElevation = 2), - WarpTile( - x = 3, - y = 6, - elevation = 2, - targetRegionId = 1, - targetBankId = 54, - targetMapId = 2, - targetX = 3, - targetY = 6, - targetElevation = 2), - WarpTile( - x = 5, - y = 6, - elevation = 2, - targetRegionId = 1, - targetBankId = 54, - targetMapId = 2, - targetX = 5, - targetY = 6, - targetElevation = 2), - WarpTile( - x = 2, - y = 3, - elevation = 2, - targetRegionId = 1, - targetBankId = 54, - targetMapId = 2, - targetX = 2, - targetY = 3, - targetElevation = 2), - WarpTile( - x = 5, - y = 2, - elevation = 2, - targetRegionId = 1, - targetBankId = 54, - targetMapId = 2, - targetX = 5, - targetY = 2, - targetElevation = 2), - WarpTile( - x = 7, - y = 2, - elevation = 2, - targetRegionId = 1, - targetBankId = 54, - targetMapId = 2, - targetX = 7, - targetY = 2, - targetElevation = 2), - WarpTile( - x = 8, - y = 6, - elevation = 2, - targetRegionId = 1, - targetBankId = 54, - targetMapId = 2, - targetX = 8, - targetY = 6, - targetElevation = 2), - WarpTile( - x = 10, - y = 6, - elevation = 2, - targetRegionId = 1, - targetBankId = 54, - targetMapId = 2, - targetX = 10, - targetY = 6, - targetElevation = 2), - WarpTile( - x = 4, - y = 16, - elevation = 0, - targetRegionId = 1, - targetBankId = 54, - targetMapId = 2, - targetX = 4, - targetY = 16, - targetElevation = 2), - WarpTile( - x = 12, - y = 3, - elevation = 2, - targetRegionId = 1, - targetBankId = 54, - targetMapId = 2, - targetX = 12, - targetY = 3, - targetElevation = 2), - WarpTile( - x = 14, - y = 6, - elevation = 2, - targetRegionId = 1, - targetBankId = 54, - targetMapId = 2, - targetX = 14, - targetY = 6, - targetElevation = 2), - WarpTile( - x = 13, - y = 17, - elevation = 2, - targetRegionId = 1, - targetBankId = 54, - targetMapId = 2, - targetX = 13, - targetY = 17, - targetElevation = 2), - WarpTile( - x = 12, - y = 12, - elevation = 2, - targetRegionId = 1, - targetBankId = 54, - targetMapId = 2, - targetX = 12, - targetY = 12, - targetElevation = 2), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 0, - x = 13, - y = 9, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "LavaridgeTown_Gym_1F_EventScript_Flannery"), - NpcDef( - entityIdx = 1, - graphicsId = 66, - x = 3, - y = 14, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "LavaridgeTown_Gym_1F_EventScript_Cole"), - NpcDef( - entityIdx = 2, - graphicsId = 33, - x = 2, - y = 15, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "LavaridgeTown_Gym_1F_EventScript_Gerald"), - NpcDef( - entityIdx = 3, - graphicsId = 66, - x = 3, - y = 10, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "LavaridgeTown_Gym_1F_EventScript_Axle"), - NpcDef( - entityIdx = 4, - graphicsId = 14, - x = 5, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "LavaridgeTown_Gym_1F_EventScript_Danielle"), - NpcDef( - entityIdx = 5, - graphicsId = 23, - x = 12, - y = 16, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 3, - script = "LavaridgeTown_Gym_1F_EventScript_GymGuide"), - ), - bgEvents = - listOf( - BgEventDef( - x = 10, - y = 15, - facingDir = "BG_EVENT_PLAYER_FACING_NORTH", - script = "LavaridgeTown_Gym_1F_EventScript_LeftGymStatue"), - BgEventDef( - x = 16, - y = 15, - facingDir = "BG_EVENT_PLAYER_FACING_NORTH", - script = "LavaridgeTown_Gym_1F_EventScript_RightGymStatue"), - ), - ), - // LavaridgeTown_Gym_B1F (MAP_LAVARIDGE_TOWN_GYM_B1F) - MapDef( - regionId = 1, - bankId = 54, - mapId = 2, - width = 17, - height = 19, - paletteIdx1 = 116, - paletteIdx2 = 152, - unknownShort = 364, - unknownByte = 3, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.STEADY_MIST, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 10, - y = 18, - elevation = 2, - targetRegionId = 1, - targetBankId = 54, - targetMapId = 1, - targetX = 10, - targetY = 18, - targetElevation = 2), - WarpTile( - x = 0, - y = 17, - elevation = 2, - targetRegionId = 1, - targetBankId = 54, - targetMapId = 1, - targetX = 0, - targetY = 17, - targetElevation = 2), - WarpTile( - x = 8, - y = 9, - elevation = 2, - targetRegionId = 1, - targetBankId = 54, - targetMapId = 1, - targetX = 8, - targetY = 9, - targetElevation = 2), - WarpTile( - x = 5, - y = 14, - elevation = 2, - targetRegionId = 1, - targetBankId = 54, - targetMapId = 1, - targetX = 5, - targetY = 14, - targetElevation = 2), - WarpTile( - x = 4, - y = 18, - elevation = 2, - targetRegionId = 1, - targetBankId = 54, - targetMapId = 1, - targetX = 4, - targetY = 18, - targetElevation = 2), - WarpTile( - x = 5, - y = 9, - elevation = 2, - targetRegionId = 1, - targetBankId = 54, - targetMapId = 1, - targetX = 5, - targetY = 9, - targetElevation = 2), - WarpTile( - x = 2, - y = 15, - elevation = 2, - targetRegionId = 1, - targetBankId = 54, - targetMapId = 1, - targetX = 2, - targetY = 15, - targetElevation = 2), - WarpTile( - x = 3, - y = 14, - elevation = 2, - targetRegionId = 1, - targetBankId = 54, - targetMapId = 1, - targetX = 3, - targetY = 14, - targetElevation = 2), - WarpTile( - x = 1, - y = 14, - elevation = 2, - targetRegionId = 1, - targetBankId = 54, - targetMapId = 1, - targetX = 1, - targetY = 14, - targetElevation = 2), - WarpTile( - x = 0, - y = 10, - elevation = 2, - targetRegionId = 1, - targetBankId = 54, - targetMapId = 1, - targetX = 0, - targetY = 10, - targetElevation = 2), - WarpTile( - x = 3, - y = 10, - elevation = 2, - targetRegionId = 1, - targetBankId = 54, - targetMapId = 1, - targetX = 3, - targetY = 10, - targetElevation = 2), - WarpTile( - x = 0, - y = 6, - elevation = 2, - targetRegionId = 1, - targetBankId = 54, - targetMapId = 1, - targetX = 0, - targetY = 6, - targetElevation = 2), - WarpTile( - x = 3, - y = 6, - elevation = 2, - targetRegionId = 1, - targetBankId = 54, - targetMapId = 1, - targetX = 3, - targetY = 6, - targetElevation = 2), - WarpTile( - x = 5, - y = 6, - elevation = 2, - targetRegionId = 1, - targetBankId = 54, - targetMapId = 1, - targetX = 5, - targetY = 6, - targetElevation = 2), - WarpTile( - x = 2, - y = 3, - elevation = 2, - targetRegionId = 1, - targetBankId = 54, - targetMapId = 1, - targetX = 2, - targetY = 3, - targetElevation = 2), - WarpTile( - x = 5, - y = 2, - elevation = 2, - targetRegionId = 1, - targetBankId = 54, - targetMapId = 1, - targetX = 5, - targetY = 2, - targetElevation = 2), - WarpTile( - x = 7, - y = 2, - elevation = 2, - targetRegionId = 1, - targetBankId = 54, - targetMapId = 1, - targetX = 7, - targetY = 2, - targetElevation = 2), - WarpTile( - x = 8, - y = 6, - elevation = 2, - targetRegionId = 1, - targetBankId = 54, - targetMapId = 1, - targetX = 8, - targetY = 6, - targetElevation = 2), - WarpTile( - x = 10, - y = 6, - elevation = 2, - targetRegionId = 1, - targetBankId = 54, - targetMapId = 1, - targetX = 10, - targetY = 6, - targetElevation = 2), - WarpTile( - x = 12, - y = 3, - elevation = 2, - targetRegionId = 1, - targetBankId = 54, - targetMapId = 1, - targetX = 12, - targetY = 3, - targetElevation = 2), - WarpTile( - x = 4, - y = 16, - elevation = 2, - targetRegionId = 1, - targetBankId = 54, - targetMapId = 1, - targetX = 4, - targetY = 16, - targetElevation = 0), - WarpTile( - x = 14, - y = 6, - elevation = 2, - targetRegionId = 1, - targetBankId = 54, - targetMapId = 1, - targetX = 14, - targetY = 6, - targetElevation = 2), - WarpTile( - x = 13, - y = 17, - elevation = 2, - targetRegionId = 1, - targetBankId = 54, - targetMapId = 1, - targetX = 13, - targetY = 17, - targetElevation = 2), - WarpTile( - x = 12, - y = 12, - elevation = 2, - targetRegionId = 1, - targetBankId = 54, - targetMapId = 1, - targetX = 12, - targetY = 12, - targetElevation = 2), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 66, - x = 4, - y = 18, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "LavaridgeTown_Gym_B1F_EventScript_Jace"), - NpcDef( - entityIdx = 1, - graphicsId = 66, - x = 3, - y = 6, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "LavaridgeTown_Gym_B1F_EventScript_Keegan"), - NpcDef( - entityIdx = 2, - graphicsId = 66, - x = 13, - y = 17, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "LavaridgeTown_Gym_B1F_EventScript_Jeff"), - NpcDef( - entityIdx = 3, - graphicsId = 55, - x = 4, - y = 16, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "LavaridgeTown_Gym_B1F_EventScript_Eli"), - ), - bgEvents = emptyList(), - ), - // LavaridgeTown_House (MAP_LAVARIDGE_TOWN_HOUSE) - MapDef( - regionId = 1, - bankId = 54, - mapId = 3, - width = 10, - height = 8, - paletteIdx1 = 116, - paletteIdx2 = 147, - unknownShort = 363, - unknownByte = 3, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 3, - y = 7, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 12, - targetX = 16, - targetY = 15, - targetElevation = 0), - WarpTile( - x = 4, - y = 7, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 12, - targetX = 16, - targetY = 15, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 29, - x = 2, - y = 3, - elevation = 3, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "LavaridgeTown_House_EventScript_OldMan"), - NpcDef( - entityIdx = 1, - graphicsId = 0, - x = 6, - y = 6, - elevation = 3, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "LavaridgeTown_House_EventScript_Zigzagoon"), - NpcDef( - entityIdx = 2, - graphicsId = 5, - x = 8, - y = 4, - elevation = 3, - movementType = 2, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "LavaridgeTown_House_EventScript_MimicTutor"), - ), - bgEvents = emptyList(), - ), - // LavaridgeTown_Mart (MAP_LAVARIDGE_TOWN_MART) - MapDef( - regionId = 1, - bankId = 54, - mapId = 4, - width = 11, - height = 8, - paletteIdx1 = 116, - paletteIdx2 = 117, - unknownShort = 404, - unknownByte = 3, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 3, - y = 7, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 12, - targetX = 15, - targetY = 5, - targetElevation = 0), - WarpTile( - x = 4, - y = 7, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 12, - targetX = 15, - targetY = 5, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 83, - x = 1, - y = 3, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 3, - script = "LavaridgeTown_Mart_EventScript_Clerk"), - NpcDef( - entityIdx = 1, - graphicsId = 21, - x = 4, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "LavaridgeTown_Mart_EventScript_ExpertM"), - NpcDef( - entityIdx = 2, - graphicsId = 30, - x = 9, - y = 5, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 3, - script = "LavaridgeTown_Mart_EventScript_OldWoman"), - ), - bgEvents = emptyList(), - ), - // LavaridgeTown_PokemonCenter_1F (MAP_LAVARIDGE_TOWN_POKEMON_CENTER_1F) - MapDef( - regionId = 1, - bankId = 54, - mapId = 5, - width = 14, - height = 9, - paletteIdx1 = 116, - paletteIdx2 = 118, - unknownShort = 400, - unknownByte = 3, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 7, - y = 8, - elevation = 2, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 12, - targetX = 9, - targetY = 6, - targetElevation = 0), - WarpTile( - x = 6, - y = 8, - elevation = 2, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 12, - targetX = 9, - targetY = 6, - targetElevation = 0), - WarpTile( - x = 1, - y = 6, - elevation = 3, - targetRegionId = 1, - targetBankId = 54, - targetMapId = 6, - targetX = 1, - targetY = 6, - targetElevation = 3), - WarpTile( - x = 2, - y = 1, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 12, - targetX = 9, - targetY = 2, - targetElevation = 2), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 58, - x = 7, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "LavaridgeTown_PokemonCenter_1F_EventScript_Nurse"), - NpcDef( - entityIdx = 1, - graphicsId = 35, - x = 11, - y = 8, - elevation = 3, - movementType = 7, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 1, - script = "LavaridgeTown_PokemonCenter_1F_EventScript_Youngster"), - NpcDef( - entityIdx = 2, - graphicsId = 24, - x = 10, - y = 6, - elevation = 3, - movementType = 9, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 2, - script = "LavaridgeTown_PokemonCenter_1F_EventScript_Woman"), - NpcDef( - entityIdx = 3, - graphicsId = 48, - x = 1, - y = 3, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 3, - script = "LavaridgeTown_PokemonCenter_1F_EventScript_Gentleman"), - ), - bgEvents = emptyList(), - ), - // LavaridgeTown_PokemonCenter_2F (MAP_LAVARIDGE_TOWN_POKEMON_CENTER_2F) - MapDef( - regionId = 1, - bankId = 54, - mapId = 6, - width = 14, - height = 10, - paletteIdx1 = 116, - paletteIdx2 = 118, - unknownShort = 400, - unknownByte = 3, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 1, - y = 6, - elevation = 3, - targetRegionId = 1, - targetBankId = 54, - targetMapId = 5, - targetX = 1, - targetY = 6, - targetElevation = 3), - WarpTile( - x = 5, - y = 1, - elevation = 2, - targetRegionId = 1, - targetBankId = 75, - targetMapId = 60, - targetX = 7, - targetY = 11, - targetElevation = 2), - WarpTile( - x = 9, - y = 1, - elevation = 2, - targetRegionId = 1, - targetBankId = 75, - targetMapId = 25, - targetX = 5, - targetY = 8, - targetElevation = 2), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 0, - x = 6, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "Common_EventScript_UnionRoomAttendant"), - NpcDef( - entityIdx = 1, - graphicsId = 0, - x = 2, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "Common_EventScript_WirelessClubAttendant"), - NpcDef( - entityIdx = 2, - graphicsId = 0, - x = 10, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "Common_EventScript_DirectCornerAttendant"), - ), - bgEvents = emptyList(), - ), - // FallarborTown_Mart (MAP_FALLARBOR_TOWN_MART) - MapDef( - regionId = 1, - bankId = 55, - mapId = 0, - width = 11, - height = 8, - paletteIdx1 = 116, - paletteIdx2 = 117, - unknownShort = 404, - unknownByte = 4, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 3, - y = 7, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 13, - targetX = 15, - targetY = 15, - targetElevation = 0), - WarpTile( - x = 4, - y = 7, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 13, - targetX = 15, - targetY = 15, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 83, - x = 1, - y = 3, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 3, - script = "FallarborTown_Mart_EventScript_Clerk"), - NpcDef( - entityIdx = 1, - graphicsId = 20, - x = 5, - y = 3, - elevation = 3, - movementType = 2, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "FallarborTown_Mart_EventScript_Woman"), - NpcDef( - entityIdx = 2, - graphicsId = 25, - x = 9, - y = 6, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "FallarborTown_Mart_EventScript_PokefanM"), - NpcDef( - entityIdx = 3, - graphicsId = 0, - x = 2, - y = 5, - elevation = 3, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "FallarborTown_Mart_EventScript_Skitty"), - NpcDef( - entityIdx = 4, - graphicsId = 10, - x = 7, - y = 2, - elevation = 3, - movementType = 7, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 1, - script = "FallarborTown_Mart_EventScript_MetronomeTutor"), - ), - bgEvents = emptyList(), - ), - // FallarborTown_BattleTentLobby (MAP_FALLARBOR_TOWN_BATTLE_TENT_LOBBY) - MapDef( - regionId = 1, - bankId = 55, - mapId = 1, - width = 13, - height = 10, - paletteIdx1 = 116, - paletteIdx2 = 172, - unknownShort = 384, - unknownByte = 4, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 6, - y = 9, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 13, - targetX = 8, - targetY = 7, - targetElevation = 0), - WarpTile( - x = 7, - y = 9, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 13, - targetX = 8, - targetY = 7, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 44, - x = 6, - y = 5, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "FallarborTown_BattleTentLobby_EventScript_Attendant"), - NpcDef( - entityIdx = 1, - graphicsId = 55, - x = 1, - y = 5, - elevation = 3, - movementType = 5, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "FallarborTown_BattleTentLobby_EventScript_Hiker"), - NpcDef( - entityIdx = 2, - graphicsId = 11, - x = 12, - y = 6, - elevation = 3, - movementType = 3, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "FallarborTown_BattleTentLobby_EventScript_LittleBoy"), - NpcDef( - entityIdx = 3, - graphicsId = 47, - x = 10, - y = 9, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "FallarborTown_BattleTentLobby_EventScript_Lass"), - ), - bgEvents = - listOf( - BgEventDef( - x = 4, - y = 5, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "FallarborTown_BattleTentLobby_EventScript_RulesBoard"), - ), - ), - // FallarborTown_BattleTentCorridor (MAP_FALLARBOR_TOWN_BATTLE_TENT_CORRIDOR) - MapDef( - regionId = 1, - bankId = 55, - mapId = 2, - width = 5, - height = 8, - paletteIdx1 = 116, - paletteIdx2 = 172, - unknownShort = 384, - unknownByte = 4, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = emptyList(), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 44, - x = 2, - y = 6, - elevation = 3, - movementType = 7, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 1, - script = "0x0"), - ), - bgEvents = emptyList(), - ), - // FallarborTown_BattleTentBattleRoom (MAP_FALLARBOR_TOWN_BATTLE_TENT_BATTLE_ROOM) - MapDef( - regionId = 1, - bankId = 55, - mapId = 3, - width = 10, - height = 9, - paletteIdx1 = 116, - paletteIdx2 = 172, - unknownShort = 384, - unknownByte = 4, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = emptyList(), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 0, - x = 4, - y = 8, - elevation = 3, - movementType = 7, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 1, - script = "0x0"), - NpcDef( - entityIdx = 1, - graphicsId = 44, - x = 3, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "0x0"), - NpcDef( - entityIdx = 2, - graphicsId = 240, - x = 5, - y = 1, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "0x0"), - ), - bgEvents = emptyList(), - ), - // FallarborTown_PokemonCenter_1F (MAP_FALLARBOR_TOWN_POKEMON_CENTER_1F) - MapDef( - regionId = 1, - bankId = 55, - mapId = 4, - width = 14, - height = 9, - paletteIdx1 = 116, - paletteIdx2 = 118, - unknownShort = 400, - unknownByte = 4, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 7, - y = 8, - elevation = 2, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 13, - targetX = 14, - targetY = 7, - targetElevation = 0), - WarpTile( - x = 6, - y = 8, - elevation = 2, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 13, - targetX = 14, - targetY = 7, - targetElevation = 0), - WarpTile( - x = 1, - y = 6, - elevation = 3, - targetRegionId = 1, - targetBankId = 55, - targetMapId = 5, - targetX = 1, - targetY = 6, - targetElevation = 3), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 58, - x = 7, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "FallarborTown_PokemonCenter_1F_EventScript_Nurse"), - NpcDef( - entityIdx = 1, - graphicsId = 14, - x = 10, - y = 6, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 3, - script = "FallarborTown_PokemonCenter_1F_EventScript_Girl"), - NpcDef( - entityIdx = 2, - graphicsId = 21, - x = 2, - y = 3, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "FallarborTown_PokemonCenter_1F_EventScript_ExpertM"), - ), - bgEvents = emptyList(), - ), - // FallarborTown_PokemonCenter_2F (MAP_FALLARBOR_TOWN_POKEMON_CENTER_2F) - MapDef( - regionId = 1, - bankId = 55, - mapId = 5, - width = 14, - height = 10, - paletteIdx1 = 116, - paletteIdx2 = 118, - unknownShort = 400, - unknownByte = 4, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 1, - y = 6, - elevation = 3, - targetRegionId = 1, - targetBankId = 55, - targetMapId = 4, - targetX = 1, - targetY = 6, - targetElevation = 3), - WarpTile( - x = 5, - y = 1, - elevation = 2, - targetRegionId = 1, - targetBankId = 75, - targetMapId = 60, - targetX = 7, - targetY = 11, - targetElevation = 2), - WarpTile( - x = 9, - y = 1, - elevation = 2, - targetRegionId = 1, - targetBankId = 75, - targetMapId = 25, - targetX = 5, - targetY = 8, - targetElevation = 2), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 0, - x = 6, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "Common_EventScript_UnionRoomAttendant"), - NpcDef( - entityIdx = 1, - graphicsId = 0, - x = 2, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "Common_EventScript_WirelessClubAttendant"), - NpcDef( - entityIdx = 2, - graphicsId = 0, - x = 10, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "Common_EventScript_DirectCornerAttendant"), - ), - bgEvents = emptyList(), - ), - // FallarborTown_CozmosHouse (MAP_FALLARBOR_TOWN_COZMOS_HOUSE) - MapDef( - regionId = 1, - bankId = 55, - mapId = 6, - width = 10, - height = 9, - paletteIdx1 = 116, - paletteIdx2 = 147, - unknownShort = 437, - unknownByte = 4, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 3, - y = 8, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 13, - targetX = 6, - targetY = 17, - targetElevation = 0), - WarpTile( - x = 4, - y = 8, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 13, - targetX = 6, - targetY = 17, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 1, - graphicsId = 20, - x = 5, - y = 6, - elevation = 3, - movementType = 5, - movementRangeX = 1, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "FallarborTown_CozmosHouse_EventScript_CozmosWife"), - ), - bgEvents = emptyList(), - ), - // FallarborTown_MoveRelearnersHouse (MAP_FALLARBOR_TOWN_MOVE_RELEARNERS_HOUSE) - MapDef( - regionId = 1, - bankId = 55, - mapId = 7, - width = 11, - height = 8, - paletteIdx1 = 116, - paletteIdx2 = 147, - unknownShort = 437, - unknownByte = 4, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 3, - y = 7, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 13, - targetX = 1, - targetY = 6, - targetElevation = 0), - WarpTile( - x = 4, - y = 7, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 13, - targetX = 1, - targetY = 6, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 17, - x = 4, - y = 4, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "FallarborTown_MoveRelearnersHouse_EventScript_MoveRelearner"), - ), - bgEvents = emptyList(), - ), - // VerdanturfTown_BattleTentLobby (MAP_VERDANTURF_TOWN_BATTLE_TENT_LOBBY) - MapDef( - regionId = 1, - bankId = 56, - mapId = 0, - width = 13, - height = 10, - paletteIdx1 = 116, - paletteIdx2 = 172, - unknownShort = 384, - unknownByte = 5, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 6, - y = 9, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 14, - targetX = 3, - targetY = 7, - targetElevation = 0), - WarpTile( - x = 7, - y = 9, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 14, - targetX = 3, - targetY = 7, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 21, - x = 6, - y = 5, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "VerdanturfTown_BattleTentLobby_EventScript_Attendant"), - NpcDef( - entityIdx = 1, - graphicsId = 8, - x = 0, - y = 5, - elevation = 3, - movementType = 2, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "VerdanturfTown_BattleTentLobby_EventScript_AttractGiver"), - NpcDef( - entityIdx = 2, - graphicsId = 13, - x = 9, - y = 7, - elevation = 3, - movementType = 2, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "VerdanturfTown_BattleTentLobby_EventScript_Boy1"), - NpcDef( - entityIdx = 3, - graphicsId = 9, - x = 1, - y = 8, - elevation = 3, - movementType = 10, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 3, - script = "VerdanturfTown_BattleTentLobby_EventScript_Boy2"), - NpcDef( - entityIdx = 5, - graphicsId = 11, - x = 2, - y = 8, - elevation = 3, - movementType = 9, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 2, - script = "VerdanturfTown_BattleTentLobby_EventScript_LittleBoy"), - ), - bgEvents = - listOf( - BgEventDef( - x = 4, - y = 5, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "VerdanturfTown_BattleTentLobby_EventScript_RulesBoard"), - ), - ), - // VerdanturfTown_BattleTentCorridor (MAP_VERDANTURF_TOWN_BATTLE_TENT_CORRIDOR) - MapDef( - regionId = 1, - bankId = 56, - mapId = 1, - width = 5, - height = 8, - paletteIdx1 = 116, - paletteIdx2 = 172, - unknownShort = 384, - unknownByte = 5, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = emptyList(), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 21, - x = 2, - y = 6, - elevation = 3, - movementType = 7, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 1, - script = "0x0"), - ), - bgEvents = emptyList(), - ), - // VerdanturfTown_BattleTentBattleRoom (MAP_VERDANTURF_TOWN_BATTLE_TENT_BATTLE_ROOM) - MapDef( - regionId = 1, - bankId = 56, - mapId = 2, - width = 13, - height = 9, - paletteIdx1 = 100, - paletteIdx2 = 172, - unknownShort = 384, - unknownByte = 5, - borderTiles = - listOf( - Tile2D(0x0023, 0), Tile2D(0x0023, 0), Tile2D(0x0023, 0), Tile2D(0x0023, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = emptyList(), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 0, - x = 2, - y = 8, - elevation = 3, - movementType = 7, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 1, - script = "0x0"), - NpcDef( - entityIdx = 1, - graphicsId = 240, - x = 11, - y = 1, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "0x0"), - NpcDef( - entityIdx = 2, - graphicsId = 21, - x = 2, - y = 4, - elevation = 3, - movementType = 10, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 3, - script = "0x0"), - ), - bgEvents = emptyList(), - ), - // VerdanturfTown_Mart (MAP_VERDANTURF_TOWN_MART) - MapDef( - regionId = 1, - bankId = 56, - mapId = 3, - width = 11, - height = 8, - paletteIdx1 = 116, - paletteIdx2 = 117, - unknownShort = 404, - unknownByte = 5, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 3, - y = 7, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 14, - targetX = 12, - targetY = 3, - targetElevation = 0), - WarpTile( - x = 4, - y = 7, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 14, - targetX = 12, - targetY = 3, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 83, - x = 1, - y = 3, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 3, - script = "VerdanturfTown_Mart_EventScript_Clerk"), - NpcDef( - entityIdx = 1, - graphicsId = 9, - x = 5, - y = 4, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 3, - script = "VerdanturfTown_Mart_EventScript_Boy"), - NpcDef( - entityIdx = 2, - graphicsId = 22, - x = 8, - y = 5, - elevation = 3, - movementType = 9, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 2, - script = "VerdanturfTown_Mart_EventScript_ExpertF"), - NpcDef( - entityIdx = 3, - graphicsId = 47, - x = 3, - y = 2, - elevation = 3, - movementType = 9, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 2, - script = "VerdanturfTown_Mart_EventScript_Lass"), - ), - bgEvents = emptyList(), - ), - // VerdanturfTown_PokemonCenter_1F (MAP_VERDANTURF_TOWN_POKEMON_CENTER_1F) - MapDef( - regionId = 1, - bankId = 56, - mapId = 4, - width = 14, - height = 9, - paletteIdx1 = 116, - paletteIdx2 = 118, - unknownShort = 400, - unknownByte = 5, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 7, - y = 8, - elevation = 2, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 14, - targetX = 16, - targetY = 3, - targetElevation = 0), - WarpTile( - x = 6, - y = 8, - elevation = 2, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 14, - targetX = 16, - targetY = 3, - targetElevation = 0), - WarpTile( - x = 1, - y = 6, - elevation = 3, - targetRegionId = 1, - targetBankId = 56, - targetMapId = 5, - targetX = 1, - targetY = 6, - targetElevation = 3), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 58, - x = 7, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "VerdanturfTown_PokemonCenter_1F_EventScript_Nurse"), - NpcDef( - entityIdx = 1, - graphicsId = 48, - x = 4, - y = 5, - elevation = 3, - movementType = 5, - movementRangeX = 1, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "VerdanturfTown_PokemonCenter_1F_EventScript_Gentleman"), - NpcDef( - entityIdx = 2, - graphicsId = 21, - x = 12, - y = 2, - elevation = 3, - movementType = 7, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 1, - script = "VerdanturfTown_PokemonCenter_1F_EventScript_ExpertM"), - NpcDef( - entityIdx = 3, - graphicsId = 11, - x = 10, - y = 6, - elevation = 3, - movementType = 9, - movementRangeX = 1, - movementRangeY = 0, - trainerType = 0, - facing = 2, - script = "VerdanturfTown_PokemonCenter_1F_EventScript_FuryCutterTutor"), - ), - bgEvents = emptyList(), - ), - // VerdanturfTown_PokemonCenter_2F (MAP_VERDANTURF_TOWN_POKEMON_CENTER_2F) - MapDef( - regionId = 1, - bankId = 56, - mapId = 5, - width = 14, - height = 10, - paletteIdx1 = 116, - paletteIdx2 = 118, - unknownShort = 400, - unknownByte = 5, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 1, - y = 6, - elevation = 3, - targetRegionId = 1, - targetBankId = 56, - targetMapId = 4, - targetX = 1, - targetY = 6, - targetElevation = 3), - WarpTile( - x = 5, - y = 1, - elevation = 2, - targetRegionId = 1, - targetBankId = 75, - targetMapId = 60, - targetX = 7, - targetY = 11, - targetElevation = 2), - WarpTile( - x = 9, - y = 1, - elevation = 2, - targetRegionId = 1, - targetBankId = 75, - targetMapId = 25, - targetX = 5, - targetY = 8, - targetElevation = 2), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 0, - x = 6, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "Common_EventScript_UnionRoomAttendant"), - NpcDef( - entityIdx = 1, - graphicsId = 0, - x = 2, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "Common_EventScript_WirelessClubAttendant"), - NpcDef( - entityIdx = 2, - graphicsId = 0, - x = 10, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "Common_EventScript_DirectCornerAttendant"), - ), - bgEvents = emptyList(), - ), - // VerdanturfTown_WandasHouse (MAP_VERDANTURF_TOWN_WANDAS_HOUSE) - MapDef( - regionId = 1, - bankId = 56, - mapId = 6, - width = 17, - height = 8, - paletteIdx1 = 116, - paletteIdx2 = 147, - unknownShort = 398, - unknownByte = 5, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 7, - y = 7, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 14, - targetX = 10, - targetY = 14, - targetElevation = 0), - WarpTile( - x = 8, - y = 7, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 14, - targetX = 10, - targetY = 14, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 3, - graphicsId = 18, - x = 2, - y = 4, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 3, - script = "VerdanturfTown_WandasHouse_EventScript_WallysAunt"), - ), - bgEvents = emptyList(), - ), - // VerdanturfTown_FriendshipRatersHouse (MAP_VERDANTURF_TOWN_FRIENDSHIP_RATERS_HOUSE) - MapDef( - regionId = 1, - bankId = 56, - mapId = 7, - width = 11, - height = 8, - paletteIdx1 = 116, - paletteIdx2 = 147, - unknownShort = 398, - unknownByte = 5, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 3, - y = 7, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 14, - targetX = 1, - targetY = 14, - targetElevation = 0), - WarpTile( - x = 4, - y = 7, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 14, - targetX = 1, - targetY = 14, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 20, - x = 3, - y = 4, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = - "VerdanturfTown_FriendshipRatersHouse_EventScript_FriendshipRater"), - NpcDef( - entityIdx = 1, - graphicsId = 0, - x = 4, - y = 4, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "VerdanturfTown_FriendshipRatersHouse_EventScript_Pikachu"), - ), - bgEvents = emptyList(), - ), - // VerdanturfTown_House (MAP_VERDANTURF_TOWN_HOUSE) - MapDef( - regionId = 1, - bankId = 56, - mapId = 8, - width = 10, - height = 9, - paletteIdx1 = 116, - paletteIdx2 = 147, - unknownShort = 398, - unknownByte = 5, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 3, - y = 8, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 14, - targetX = 17, - targetY = 15, - targetElevation = 0), - WarpTile( - x = 4, - y = 8, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 14, - targetX = 17, - targetY = 15, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 34, - x = 4, - y = 5, - elevation = 3, - movementType = 7, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 1, - script = "VerdanturfTown_House_EventScript_Woman1"), - NpcDef( - entityIdx = 1, - graphicsId = 34, - x = 4, - y = 4, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "VerdanturfTown_House_EventScript_Woman2"), - ), - bgEvents = emptyList(), - ), - // PacifidlogTown_PokemonCenter_1F (MAP_PACIFIDLOG_TOWN_POKEMON_CENTER_1F) - MapDef( - regionId = 1, - bankId = 57, - mapId = 0, - width = 14, - height = 9, - paletteIdx1 = 116, - paletteIdx2 = 118, - unknownShort = 400, - unknownByte = 6, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 7, - y = 8, - elevation = 2, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 15, - targetX = 8, - targetY = 15, - targetElevation = 0), - WarpTile( - x = 6, - y = 8, - elevation = 2, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 15, - targetX = 8, - targetY = 15, - targetElevation = 0), - WarpTile( - x = 1, - y = 6, - elevation = 3, - targetRegionId = 1, - targetBankId = 57, - targetMapId = 1, - targetX = 1, - targetY = 6, - targetElevation = 3), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 58, - x = 7, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "PacifidlogTown_PokemonCenter_1F_EventScript_Nurse"), - NpcDef( - entityIdx = 1, - graphicsId = 29, - x = 10, - y = 6, - elevation = 3, - movementType = 9, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 2, - script = "PacifidlogTown_PokemonCenter_1F_EventScript_OldMan"), - NpcDef( - entityIdx = 2, - graphicsId = 10, - x = 2, - y = 2, - elevation = 3, - movementType = 7, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 1, - script = "PacifidlogTown_PokemonCenter_1F_EventScript_Girl"), - NpcDef( - entityIdx = 3, - graphicsId = 16, - x = 4, - y = 5, - elevation = 3, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "PacifidlogTown_PokemonCenter_1F_EventScript_Woman"), - NpcDef( - entityIdx = 4, - graphicsId = 66, - x = 12, - y = 8, - elevation = 3, - movementType = 7, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 1, - script = "PacifidlogTown_PokemonCenter_1F_EventScript_ExplosionTutor"), - ), - bgEvents = emptyList(), - ), - // PacifidlogTown_PokemonCenter_2F (MAP_PACIFIDLOG_TOWN_POKEMON_CENTER_2F) - MapDef( - regionId = 1, - bankId = 57, - mapId = 1, - width = 14, - height = 10, - paletteIdx1 = 116, - paletteIdx2 = 118, - unknownShort = 400, - unknownByte = 6, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 1, - y = 6, - elevation = 3, - targetRegionId = 1, - targetBankId = 57, - targetMapId = 0, - targetX = 1, - targetY = 6, - targetElevation = 3), - WarpTile( - x = 5, - y = 1, - elevation = 2, - targetRegionId = 1, - targetBankId = 75, - targetMapId = 60, - targetX = 7, - targetY = 11, - targetElevation = 2), - WarpTile( - x = 9, - y = 1, - elevation = 2, - targetRegionId = 1, - targetBankId = 75, - targetMapId = 25, - targetX = 5, - targetY = 8, - targetElevation = 2), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 0, - x = 6, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "Common_EventScript_UnionRoomAttendant"), - NpcDef( - entityIdx = 1, - graphicsId = 0, - x = 2, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "Common_EventScript_WirelessClubAttendant"), - NpcDef( - entityIdx = 2, - graphicsId = 0, - x = 10, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "Common_EventScript_DirectCornerAttendant"), - ), - bgEvents = emptyList(), - ), - // PacifidlogTown_House1 (MAP_PACIFIDLOG_TOWN_HOUSE1) - MapDef( - regionId = 1, - bankId = 57, - mapId = 2, - width = 10, - height = 9, - paletteIdx1 = 116, - paletteIdx2 = 147, - unknownShort = 408, - unknownByte = 6, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 4, - y = 8, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 15, - targetX = 16, - targetY = 13, - targetElevation = 0), - WarpTile( - x = 5, - y = 8, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 15, - targetX = 16, - targetY = 13, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 66, - x = 3, - y = 5, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "PacifidlogTown_House1_EventScript_Man"), - NpcDef( - entityIdx = 1, - graphicsId = 26, - x = 6, - y = 4, - elevation = 3, - movementType = 9, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 2, - script = "PacifidlogTown_House1_EventScript_Woman"), - ), - bgEvents = emptyList(), - ), - // PacifidlogTown_House2 (MAP_PACIFIDLOG_TOWN_HOUSE2) - MapDef( - regionId = 1, - bankId = 57, - mapId = 3, - width = 10, - height = 9, - paletteIdx1 = 116, - paletteIdx2 = 147, - unknownShort = 408, - unknownByte = 6, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 4, - y = 8, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 15, - targetX = 3, - targetY = 22, - targetElevation = 0), - WarpTile( - x = 5, - y = 8, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 15, - targetX = 3, - targetY = 22, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 48, - x = 3, - y = 5, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "PacifidlogTown_House2_EventScript_FanClubYoungerBrother"), - NpcDef( - entityIdx = 1, - graphicsId = 0, - x = 8, - y = 6, - elevation = 3, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "PacifidlogTown_House2_EventScript_HappyAzurill"), - NpcDef( - entityIdx = 2, - graphicsId = 0, - x = 1, - y = 7, - elevation = 3, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "PacifidlogTown_House2_EventScript_UnhappyAzurill"), - ), - bgEvents = emptyList(), - ), - // PacifidlogTown_House3 (MAP_PACIFIDLOG_TOWN_HOUSE3) - MapDef( - regionId = 1, - bankId = 57, - mapId = 4, - width = 10, - height = 9, - paletteIdx1 = 116, - paletteIdx2 = 147, - unknownShort = 408, - unknownByte = 6, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 4, - y = 8, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 15, - targetX = 12, - targetY = 24, - targetElevation = 0), - WarpTile( - x = 5, - y = 8, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 15, - targetX = 12, - targetY = 24, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 10, - x = 3, - y = 5, - elevation = 3, - movementType = 18, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "PacifidlogTown_House3_EventScript_Girl"), - NpcDef( - entityIdx = 1, - graphicsId = 33, - x = 4, - y = 2, - elevation = 3, - movementType = 10, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 3, - script = "PacifidlogTown_House3_EventScript_Trader"), - ), - bgEvents = emptyList(), - ), - // PacifidlogTown_House4 (MAP_PACIFIDLOG_TOWN_HOUSE4) - MapDef( - regionId = 1, - bankId = 57, - mapId = 5, - width = 10, - height = 9, - paletteIdx1 = 116, - paletteIdx2 = 147, - unknownShort = 408, - unknownByte = 6, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 4, - y = 8, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 15, - targetX = 2, - targetY = 12, - targetElevation = 0), - WarpTile( - x = 5, - y = 8, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 15, - targetX = 2, - targetY = 12, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 20, - x = 3, - y = 4, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "PacifidlogTown_House4_EventScript_Woman"), - NpcDef( - entityIdx = 1, - graphicsId = 12, - x = 7, - y = 5, - elevation = 3, - movementType = 2, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "PacifidlogTown_House4_EventScript_LittleGirl"), - NpcDef( - entityIdx = 2, - graphicsId = 7, - x = 7, - y = 4, - elevation = 3, - movementType = 2, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "PacifidlogTown_House4_EventScript_Boy"), - ), - bgEvents = emptyList(), - ), - // PacifidlogTown_House5 (MAP_PACIFIDLOG_TOWN_HOUSE5) - MapDef( - regionId = 1, - bankId = 57, - mapId = 6, - width = 10, - height = 9, - paletteIdx1 = 116, - paletteIdx2 = 147, - unknownShort = 408, - unknownByte = 6, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 4, - y = 8, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 15, - targetX = 17, - targetY = 21, - targetElevation = 0), - WarpTile( - x = 5, - y = 8, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 15, - targetX = 17, - targetY = 21, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 21, - x = 9, - y = 4, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 3, - script = "PacifidlogTown_House5_EventScript_MirageIslandWatcher"), - NpcDef( - entityIdx = 1, - graphicsId = 48, - x = 3, - y = 4, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 3, - script = "PacifidlogTown_House5_EventScript_Gentleman"), - ), - bgEvents = emptyList(), - ), - // PetalburgCity_WallysHouse (MAP_PETALBURG_CITY_WALLYS_HOUSE) - MapDef( - regionId = 1, - bankId = 58, - mapId = 0, - width = 11, - height = 8, - paletteIdx1 = 116, - paletteIdx2 = 147, - unknownShort = 362, - unknownByte = 7, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 3, - y = 7, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 0, - targetX = 7, - targetY = 5, - targetElevation = 0), - WarpTile( - x = 4, - y = 7, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 0, - targetX = 7, - targetY = 5, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 25, - x = 3, - y = 4, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 3, - script = "PetalburgCity_WallysHouse_EventScript_WallysDad"), - NpcDef( - entityIdx = 1, - graphicsId = 26, - x = 7, - y = 5, - elevation = 3, - movementType = 9, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 2, - script = "PetalburgCity_WallysHouse_EventScript_WallysMom"), - ), - bgEvents = emptyList(), - ), - // PetalburgCity_Gym (MAP_PETALBURG_CITY_GYM) - MapDef( - regionId = 1, - bankId = 58, - mapId = 1, - width = 9, - height = 112, - paletteIdx1 = 116, - paletteIdx2 = 145, - unknownShort = 364, - unknownByte = 7, - borderTiles = - listOf( - Tile2D(0x0208, 0), Tile2D(0x0208, 0), Tile2D(0x0208, 0), Tile2D(0x0208, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 4, - y = 111, - elevation = 2, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 0, - targetX = 15, - targetY = 8, - targetElevation = 0), - WarpTile( - x = 5, - y = 111, - elevation = 2, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 0, - targetX = 15, - targetY = 8, - targetElevation = 0), - WarpTile( - x = 1, - y = 105, - elevation = 2, - targetRegionId = 1, - targetBankId = 58, - targetMapId = 1, - targetX = 7, - targetY = 85, - targetElevation = 2), - WarpTile( - x = 7, - y = 85, - elevation = 2, - targetRegionId = 1, - targetBankId = 58, - targetMapId = 1, - targetX = 1, - targetY = 105, - targetElevation = 2), - WarpTile( - x = 6, - y = 85, - elevation = 2, - targetRegionId = 1, - targetBankId = 58, - targetMapId = 1, - targetX = 1, - targetY = 105, - targetElevation = 2), - WarpTile( - x = 7, - y = 105, - elevation = 2, - targetRegionId = 1, - targetBankId = 58, - targetMapId = 1, - targetX = 1, - targetY = 98, - targetElevation = 2), - WarpTile( - x = 1, - y = 98, - elevation = 2, - targetRegionId = 1, - targetBankId = 58, - targetMapId = 1, - targetX = 7, - targetY = 105, - targetElevation = 2), - WarpTile( - x = 2, - y = 98, - elevation = 2, - targetRegionId = 1, - targetBankId = 58, - targetMapId = 1, - targetX = 7, - targetY = 105, - targetElevation = 2), - WarpTile( - x = 1, - y = 79, - elevation = 2, - targetRegionId = 1, - targetBankId = 58, - targetMapId = 1, - targetX = 7, - targetY = 46, - targetElevation = 2), - WarpTile( - x = 7, - y = 79, - elevation = 2, - targetRegionId = 1, - targetBankId = 58, - targetMapId = 1, - targetX = 1, - targetY = 59, - targetElevation = 2), - WarpTile( - x = 7, - y = 46, - elevation = 2, - targetRegionId = 1, - targetBankId = 58, - targetMapId = 1, - targetX = 1, - targetY = 79, - targetElevation = 2), - WarpTile( - x = 6, - y = 46, - elevation = 2, - targetRegionId = 1, - targetBankId = 58, - targetMapId = 1, - targetX = 1, - targetY = 79, - targetElevation = 2), - WarpTile( - x = 1, - y = 59, - elevation = 2, - targetRegionId = 1, - targetBankId = 58, - targetMapId = 1, - targetX = 7, - targetY = 79, - targetElevation = 2), - WarpTile( - x = 2, - y = 59, - elevation = 2, - targetRegionId = 1, - targetBankId = 58, - targetMapId = 1, - targetX = 7, - targetY = 79, - targetElevation = 2), - WarpTile( - x = 1, - y = 92, - elevation = 2, - targetRegionId = 1, - targetBankId = 58, - targetMapId = 1, - targetX = 7, - targetY = 59, - targetElevation = 2), - WarpTile( - x = 7, - y = 92, - elevation = 2, - targetRegionId = 1, - targetBankId = 58, - targetMapId = 1, - targetX = 1, - targetY = 72, - targetElevation = 2), - WarpTile( - x = 7, - y = 59, - elevation = 2, - targetRegionId = 1, - targetBankId = 58, - targetMapId = 1, - targetX = 1, - targetY = 92, - targetElevation = 2), - WarpTile( - x = 6, - y = 59, - elevation = 2, - targetRegionId = 1, - targetBankId = 58, - targetMapId = 1, - targetX = 1, - targetY = 92, - targetElevation = 2), - WarpTile( - x = 1, - y = 72, - elevation = 2, - targetRegionId = 1, - targetBankId = 58, - targetMapId = 1, - targetX = 7, - targetY = 92, - targetElevation = 2), - WarpTile( - x = 2, - y = 72, - elevation = 2, - targetRegionId = 1, - targetBankId = 58, - targetMapId = 1, - targetX = 7, - targetY = 92, - targetElevation = 2), - WarpTile( - x = 7, - y = 40, - elevation = 2, - targetRegionId = 1, - targetBankId = 58, - targetMapId = 1, - targetX = 1, - targetY = 20, - targetElevation = 2), - WarpTile( - x = 1, - y = 53, - elevation = 2, - targetRegionId = 1, - targetBankId = 58, - targetMapId = 1, - targetX = 7, - targetY = 20, - targetElevation = 2), - WarpTile( - x = 7, - y = 53, - elevation = 2, - targetRegionId = 1, - targetBankId = 58, - targetMapId = 1, - targetX = 1, - targetY = 33, - targetElevation = 2), - WarpTile( - x = 1, - y = 66, - elevation = 2, - targetRegionId = 1, - targetBankId = 58, - targetMapId = 1, - targetX = 7, - targetY = 33, - targetElevation = 2), - WarpTile( - x = 1, - y = 20, - elevation = 2, - targetRegionId = 1, - targetBankId = 58, - targetMapId = 1, - targetX = 7, - targetY = 40, - targetElevation = 2), - WarpTile( - x = 2, - y = 20, - elevation = 2, - targetRegionId = 1, - targetBankId = 58, - targetMapId = 1, - targetX = 7, - targetY = 40, - targetElevation = 2), - WarpTile( - x = 7, - y = 20, - elevation = 2, - targetRegionId = 1, - targetBankId = 58, - targetMapId = 1, - targetX = 1, - targetY = 53, - targetElevation = 2), - WarpTile( - x = 6, - y = 20, - elevation = 2, - targetRegionId = 1, - targetBankId = 58, - targetMapId = 1, - targetX = 1, - targetY = 53, - targetElevation = 2), - WarpTile( - x = 1, - y = 33, - elevation = 2, - targetRegionId = 1, - targetBankId = 58, - targetMapId = 1, - targetX = 7, - targetY = 53, - targetElevation = 2), - WarpTile( - x = 2, - y = 33, - elevation = 2, - targetRegionId = 1, - targetBankId = 58, - targetMapId = 1, - targetX = 7, - targetY = 53, - targetElevation = 2), - WarpTile( - x = 7, - y = 33, - elevation = 2, - targetRegionId = 1, - targetBankId = 58, - targetMapId = 1, - targetX = 1, - targetY = 66, - targetElevation = 2), - WarpTile( - x = 6, - y = 33, - elevation = 2, - targetRegionId = 1, - targetBankId = 58, - targetMapId = 1, - targetX = 1, - targetY = 66, - targetElevation = 2), - WarpTile( - x = 7, - y = 14, - elevation = 2, - targetRegionId = 1, - targetBankId = 58, - targetMapId = 1, - targetX = 1, - targetY = 7, - targetElevation = 2), - WarpTile( - x = 1, - y = 27, - elevation = 2, - targetRegionId = 1, - targetBankId = 58, - targetMapId = 1, - targetX = 7, - targetY = 7, - targetElevation = 2), - WarpTile( - x = 1, - y = 7, - elevation = 2, - targetRegionId = 1, - targetBankId = 58, - targetMapId = 1, - targetX = 7, - targetY = 14, - targetElevation = 2), - WarpTile( - x = 2, - y = 7, - elevation = 2, - targetRegionId = 1, - targetBankId = 58, - targetMapId = 1, - targetX = 7, - targetY = 14, - targetElevation = 2), - WarpTile( - x = 7, - y = 7, - elevation = 2, - targetRegionId = 1, - targetBankId = 58, - targetMapId = 1, - targetX = 1, - targetY = 27, - targetElevation = 2), - WarpTile( - x = 6, - y = 7, - elevation = 2, - targetRegionId = 1, - targetBankId = 58, - targetMapId = 1, - targetX = 1, - targetY = 27, - targetElevation = 2), - ), - npcs = - listOf( - NpcDef( - entityIdx = 1, - graphicsId = 34, - x = 4, - y = 94, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "PetalburgCity_Gym_EventScript_Mary"), - NpcDef( - entityIdx = 2, - graphicsId = 33, - x = 4, - y = 81, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "PetalburgCity_Gym_EventScript_Randall"), - NpcDef( - entityIdx = 3, - graphicsId = 33, - x = 4, - y = 42, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "PetalburgCity_Gym_EventScript_Parker"), - NpcDef( - entityIdx = 4, - graphicsId = 34, - x = 4, - y = 55, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "PetalburgCity_Gym_EventScript_Alexia"), - NpcDef( - entityIdx = 5, - graphicsId = 33, - x = 4, - y = 68, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "PetalburgCity_Gym_EventScript_George"), - NpcDef( - entityIdx = 6, - graphicsId = 34, - x = 4, - y = 16, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "PetalburgCity_Gym_EventScript_Jody"), - NpcDef( - entityIdx = 7, - graphicsId = 33, - x = 4, - y = 29, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "PetalburgCity_Gym_EventScript_Berke"), - ), - bgEvents = - listOf( - BgEventDef( - x = 1, - y = 105, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "PetalburgCity_Gym_EventScript_SpeedRoomDoor"), - BgEventDef( - x = 7, - y = 105, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "PetalburgCity_Gym_EventScript_AccuracyRoomDoor"), - BgEventDef( - x = 1, - y = 79, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "PetalburgCity_Gym_EventScript_ConfusionRoomDoor"), - BgEventDef( - x = 7, - y = 79, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "PetalburgCity_Gym_EventScript_LeftDefenseRoomDoor"), - BgEventDef( - x = 1, - y = 92, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "PetalburgCity_Gym_EventScript_RightDefenseRoomDoor"), - BgEventDef( - x = 7, - y = 92, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "PetalburgCity_Gym_EventScript_RecoveryRoomDoor"), - BgEventDef( - x = 7, - y = 40, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "PetalburgCity_Gym_EventScript_LeftStrengthRoomDoor"), - BgEventDef( - x = 1, - y = 53, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "PetalburgCity_Gym_EventScript_RightStrengthRoomDoor"), - BgEventDef( - x = 7, - y = 53, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "PetalburgCity_Gym_EventScript_LeftOHKORoomDoor"), - BgEventDef( - x = 1, - y = 66, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "PetalburgCity_Gym_EventScript_RightOHKORoomDoor"), - BgEventDef( - x = 7, - y = 14, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "PetalburgCity_Gym_EventScript_LeftGymLeadersRoomDoor"), - BgEventDef( - x = 1, - y = 27, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "PetalburgCity_Gym_EventScript_RightGymLeadersRoomDoor"), - BgEventDef( - x = 1, - y = 110, - facingDir = "BG_EVENT_PLAYER_FACING_NORTH", - script = "PetalburgCity_Gym_EventScript_LeftGymStatue"), - BgEventDef( - x = 7, - y = 110, - facingDir = "BG_EVENT_PLAYER_FACING_NORTH", - script = "PetalburgCity_Gym_EventScript_RightGymStatue"), - ), - ), - // PetalburgCity_House1 (MAP_PETALBURG_CITY_HOUSE1) - MapDef( - regionId = 1, - bankId = 58, - mapId = 2, - width = 10, - height = 9, - paletteIdx1 = 116, - paletteIdx2 = 147, - unknownShort = 362, - unknownByte = 7, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 3, - y = 8, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 0, - targetX = 10, - targetY = 19, - targetElevation = 0), - WarpTile( - x = 4, - y = 8, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 0, - targetX = 10, - targetY = 19, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 8, - x = 7, - y = 4, - elevation = 3, - movementType = 2, - movementRangeX = 2, - movementRangeY = 2, - trainerType = 0, - facing = 0, - script = "PetalburgCity_House1_EventScript_Woman"), - NpcDef( - entityIdx = 1, - graphicsId = 21, - x = 4, - y = 4, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "PetalburgCity_House1_EventScript_Man"), - ), - bgEvents = emptyList(), - ), - // PetalburgCity_House2 (MAP_PETALBURG_CITY_HOUSE2) - MapDef( - regionId = 1, - bankId = 58, - mapId = 3, - width = 10, - height = 8, - paletteIdx1 = 116, - paletteIdx2 = 147, - unknownShort = 362, - unknownByte = 7, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 3, - y = 7, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 0, - targetX = 20, - targetY = 24, - targetElevation = 0), - WarpTile( - x = 4, - y = 7, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 0, - targetX = 20, - targetY = 24, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 18, - x = 2, - y = 5, - elevation = 3, - movementType = 2, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "PetalburgCity_House2_EventScript_Woman"), - NpcDef( - entityIdx = 1, - graphicsId = 38, - x = 7, - y = 5, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "PetalburgCity_House2_EventScript_SchoolKid"), - ), - bgEvents = emptyList(), - ), - // PetalburgCity_PokemonCenter_1F (MAP_PETALBURG_CITY_POKEMON_CENTER_1F) - MapDef( - regionId = 1, - bankId = 58, - mapId = 4, - width = 14, - height = 9, - paletteIdx1 = 116, - paletteIdx2 = 118, - unknownShort = 400, - unknownByte = 7, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 7, - y = 8, - elevation = 2, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 0, - targetX = 20, - targetY = 16, - targetElevation = 0), - WarpTile( - x = 6, - y = 8, - elevation = 2, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 0, - targetX = 20, - targetY = 16, - targetElevation = 0), - WarpTile( - x = 1, - y = 6, - elevation = 3, - targetRegionId = 1, - targetBankId = 58, - targetMapId = 5, - targetX = 1, - targetY = 6, - targetElevation = 3), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 58, - x = 7, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "PetalburgCity_PokemonCenter_1F_EventScript_Nurse"), - NpcDef( - entityIdx = 1, - graphicsId = 65, - x = 11, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "ProfileMan_EventScript_Man"), - NpcDef( - entityIdx = 2, - graphicsId = 17, - x = 2, - y = 3, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "PetalburgCity_PokemonCenter_1F_EventScript_FatMan"), - NpcDef( - entityIdx = 3, - graphicsId = 35, - x = 9, - y = 6, - elevation = 3, - movementType = 2, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "PetalburgCity_PokemonCenter_1F_EventScript_Youngster"), - NpcDef( - entityIdx = 4, - graphicsId = 34, - x = 5, - y = 4, - elevation = 3, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "PetalburgCity_PokemonCenter_1F_EventScript_Woman"), - ), - bgEvents = emptyList(), - ), - // PetalburgCity_PokemonCenter_2F (MAP_PETALBURG_CITY_POKEMON_CENTER_2F) - MapDef( - regionId = 1, - bankId = 58, - mapId = 5, - width = 14, - height = 10, - paletteIdx1 = 116, - paletteIdx2 = 118, - unknownShort = 400, - unknownByte = 7, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 1, - y = 6, - elevation = 3, - targetRegionId = 1, - targetBankId = 58, - targetMapId = 4, - targetX = 1, - targetY = 6, - targetElevation = 3), - WarpTile( - x = 5, - y = 1, - elevation = 2, - targetRegionId = 1, - targetBankId = 75, - targetMapId = 60, - targetX = 7, - targetY = 11, - targetElevation = 2), - WarpTile( - x = 9, - y = 1, - elevation = 2, - targetRegionId = 1, - targetBankId = 75, - targetMapId = 25, - targetX = 5, - targetY = 8, - targetElevation = 2), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 0, - x = 6, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "Common_EventScript_UnionRoomAttendant"), - NpcDef( - entityIdx = 1, - graphicsId = 0, - x = 2, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "Common_EventScript_WirelessClubAttendant"), - NpcDef( - entityIdx = 2, - graphicsId = 0, - x = 10, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "Common_EventScript_DirectCornerAttendant"), - ), - bgEvents = emptyList(), - ), - // PetalburgCity_Mart (MAP_PETALBURG_CITY_MART) - MapDef( - regionId = 1, - bankId = 58, - mapId = 6, - width = 11, - height = 8, - paletteIdx1 = 116, - paletteIdx2 = 117, - unknownShort = 404, - unknownByte = 7, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 3, - y = 7, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 0, - targetX = 25, - targetY = 12, - targetElevation = 0), - WarpTile( - x = 4, - y = 7, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 0, - targetX = 25, - targetY = 12, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 83, - x = 1, - y = 3, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 3, - script = "PetalburgCity_Mart_EventScript_Clerk"), - NpcDef( - entityIdx = 1, - graphicsId = 19, - x = 9, - y = 4, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 3, - script = "PetalburgCity_Mart_EventScript_Man"), - NpcDef( - entityIdx = 2, - graphicsId = 7, - x = 6, - y = 3, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "PetalburgCity_Mart_EventScript_Boy"), - NpcDef( - entityIdx = 3, - graphicsId = 20, - x = 5, - y = 5, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 3, - script = "PetalburgCity_Mart_EventScript_Woman"), - ), - bgEvents = emptyList(), - ), - // SlateportCity_SternsShipyard_1F (MAP_SLATEPORT_CITY_STERNS_SHIPYARD_1F) - MapDef( - regionId = 1, - bankId = 59, - mapId = 0, - width = 21, - height = 15, - paletteIdx1 = 100, - paletteIdx2 = 129, - unknownShort = 433, - unknownByte = 8, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 2, - y = 14, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 1, - targetX = 26, - targetY = 38, - targetElevation = 0), - WarpTile( - x = 3, - y = 14, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 1, - targetX = 26, - targetY = 38, - targetElevation = 0), - WarpTile( - x = 3, - y = 1, - elevation = 0, - targetRegionId = 1, - targetBankId = 59, - targetMapId = 1, - targetX = 3, - targetY = 1, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 19, - x = 5, - y = 5, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "SlateportCity_SternsShipyard_1F_EventScript_Dock"), - NpcDef( - entityIdx = 1, - graphicsId = 46, - x = 10, - y = 7, - elevation = 3, - movementType = 7, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 1, - script = "SlateportCity_SternsShipyard_1F_EventScript_Scientist1"), - NpcDef( - entityIdx = 2, - graphicsId = 46, - x = 18, - y = 8, - elevation = 3, - movementType = 5, - movementRangeX = 1, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "SlateportCity_SternsShipyard_1F_EventScript_Scientist2"), - ), - bgEvents = emptyList(), - ), - // SlateportCity_SternsShipyard_2F (MAP_SLATEPORT_CITY_STERNS_SHIPYARD_2F) - MapDef( - regionId = 1, - bankId = 59, - mapId = 1, - width = 17, - height = 15, - paletteIdx1 = 100, - paletteIdx2 = 129, - unknownShort = 433, - unknownByte = 8, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 3, - y = 1, - elevation = 0, - targetRegionId = 1, - targetBankId = 59, - targetMapId = 0, - targetX = 3, - targetY = 1, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 46, - x = 10, - y = 7, - elevation = 3, - movementType = 7, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 1, - script = "0x0"), - NpcDef( - entityIdx = 1, - graphicsId = 46, - x = 8, - y = 4, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 3, - script = "SlateportCity_SternsShipyard_2F_EventScript_Scientist1"), - NpcDef( - entityIdx = 2, - graphicsId = 46, - x = 0, - y = 9, - elevation = 3, - movementType = 7, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 1, - script = "SlateportCity_SternsShipyard_2F_EventScript_Scientist2"), - ), - bgEvents = emptyList(), - ), - // SlateportCity_BattleTentLobby (MAP_SLATEPORT_CITY_BATTLE_TENT_LOBBY) - MapDef( - regionId = 1, - bankId = 59, - mapId = 2, - width = 13, - height = 10, - paletteIdx1 = 116, - paletteIdx2 = 172, - unknownShort = 384, - unknownByte = 8, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 6, - y = 9, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 1, - targetX = 10, - targetY = 12, - targetElevation = 0), - WarpTile( - x = 7, - y = 9, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 1, - targetX = 10, - targetY = 12, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 46, - x = 6, - y = 5, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "SlateportCity_BattleTentLobby_EventScript_Attendant"), - NpcDef( - entityIdx = 1, - graphicsId = 49, - x = 1, - y = 5, - elevation = 3, - movementType = 2, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "SlateportCity_BattleTentLobby_EventScript_TormentGiver"), - NpcDef( - entityIdx = 2, - graphicsId = 33, - x = 3, - y = 7, - elevation = 3, - movementType = 7, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 1, - script = "SlateportCity_BattleTentLobby_EventScript_Man"), - NpcDef( - entityIdx = 3, - graphicsId = 8, - x = 1, - y = 8, - elevation = 3, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "SlateportCity_BattleTentLobby_EventScript_Girl"), - NpcDef( - entityIdx = 4, - graphicsId = 20, - x = 11, - y = 8, - elevation = 3, - movementType = 9, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 2, - script = "SlateportCity_BattleTentLobby_EventScript_Woman"), - ), - bgEvents = - listOf( - BgEventDef( - x = 4, - y = 5, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "SlateportCity_BattleTentLobby_EventScript_RulesBoard"), - ), - ), - // SlateportCity_BattleTentCorridor (MAP_SLATEPORT_CITY_BATTLE_TENT_CORRIDOR) - MapDef( - regionId = 1, - bankId = 59, - mapId = 3, - width = 5, - height = 8, - paletteIdx1 = 116, - paletteIdx2 = 172, - unknownShort = 384, - unknownByte = 8, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = emptyList(), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 46, - x = 2, - y = 6, - elevation = 3, - movementType = 7, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 1, - script = "0x0"), - ), - bgEvents = emptyList(), - ), - // SlateportCity_BattleTentBattleRoom (MAP_SLATEPORT_CITY_BATTLE_TENT_BATTLE_ROOM) - MapDef( - regionId = 1, - bankId = 59, - mapId = 4, - width = 10, - height = 9, - paletteIdx1 = 116, - paletteIdx2 = 172, - unknownShort = 384, - unknownByte = 8, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = emptyList(), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 46, - x = 1, - y = 4, - elevation = 3, - movementType = 10, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 3, - script = "0x0"), - NpcDef( - entityIdx = 1, - graphicsId = 240, - x = 5, - y = 1, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "0x0"), - NpcDef( - entityIdx = 2, - graphicsId = 0, - x = 4, - y = 8, - elevation = 3, - movementType = 7, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 1, - script = "0x0"), - ), - bgEvents = emptyList(), - ), - // SlateportCity_NameRatersHouse (MAP_SLATEPORT_CITY_NAME_RATERS_HOUSE) - MapDef( - regionId = 1, - bankId = 59, - mapId = 5, - width = 10, - height = 8, - paletteIdx1 = 116, - paletteIdx2 = 147, - unknownShort = 433, - unknownByte = 8, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 3, - y = 7, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 1, - targetX = 5, - targetY = 19, - targetElevation = 0), - WarpTile( - x = 4, - y = 7, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 1, - targetX = 5, - targetY = 19, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 21, - x = 7, - y = 5, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "SlateportCity_NameRatersHouse_EventScript_NameRater"), - ), - bgEvents = emptyList(), - ), - // SlateportCity_PokemonFanClub (MAP_SLATEPORT_CITY_POKEMON_FAN_CLUB) - MapDef( - regionId = 1, - bankId = 59, - mapId = 6, - width = 14, - height = 11, - paletteIdx1 = 116, - paletteIdx2 = 121, - unknownShort = 433, - unknownByte = 8, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 6, - y = 10, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 1, - targetX = 4, - targetY = 26, - targetElevation = 0), - WarpTile( - x = 7, - y = 10, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 1, - targetX = 4, - targetY = 26, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 19, - x = 11, - y = 4, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "SlateportCity_PokemonFanClub_EventScript_Man"), - NpcDef( - entityIdx = 1, - graphicsId = 6, - x = 1, - y = 5, - elevation = 3, - movementType = 3, - movementRangeX = 0, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "SlateportCity_PokemonFanClub_EventScript_Twin"), - NpcDef( - entityIdx = 2, - graphicsId = 68, - x = 11, - y = 5, - elevation = 3, - movementType = 7, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 1, - script = "SlateportCity_PokemonFanClub_EventScript_Reporter"), - NpcDef( - entityIdx = 3, - graphicsId = 26, - x = 6, - y = 2, - elevation = 3, - movementType = 1, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "SlateportCity_PokemonFanClub_EventScript_SootheBellWoman"), - NpcDef( - entityIdx = 4, - graphicsId = 48, - x = 6, - y = 5, - elevation = 4, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "SlateportCity_PokemonFanClub_EventScript_Chairman"), - NpcDef( - entityIdx = 5, - graphicsId = 0, - x = 3, - y = 9, - elevation = 3, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "SlateportCity_PokemonFanClub_EventScript_Zigzagoon"), - NpcDef( - entityIdx = 6, - graphicsId = 0, - x = 8, - y = 3, - elevation = 3, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "SlateportCity_PokemonFanClub_EventScript_Skitty"), - NpcDef( - entityIdx = 7, - graphicsId = 0, - x = 10, - y = 8, - elevation = 3, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "SlateportCity_PokemonFanClub_EventScript_Azumarill"), - NpcDef( - entityIdx = 8, - graphicsId = 65, - x = 11, - y = 8, - elevation = 3, - movementType = 9, - movementRangeX = 0, - movementRangeY = 1, - trainerType = 0, - facing = 2, - script = "SlateportCity_PokemonFanClub_EventScript_SwaggerTutor"), - ), - bgEvents = emptyList(), - ), - // SlateportCity_OceanicMuseum_1F (MAP_SLATEPORT_CITY_OCEANIC_MUSEUM_1F) - MapDef( - regionId = 1, - bankId = 59, - mapId = 7, - width = 20, - height = 9, - paletteIdx1 = 116, - paletteIdx2 = 124, - unknownShort = 375, - unknownByte = 8, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 9, - y = 8, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 1, - targetX = 30, - targetY = 26, - targetElevation = 0), - WarpTile( - x = 10, - y = 8, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 1, - targetX = 31, - targetY = 26, - targetElevation = 0), - WarpTile( - x = 6, - y = 1, - elevation = 0, - targetRegionId = 1, - targetBankId = 59, - targetMapId = 8, - targetX = 6, - targetY = 1, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 45, - x = 7, - y = 7, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 3, - script = - "SlateportCity_OceanicMuseum_1F_EventScript_EntranceAttendant"), - NpcDef( - entityIdx = 6, - graphicsId = 45, - x = 12, - y = 7, - elevation = 3, - movementType = 9, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 2, - script = - "SlateportCity_OceanicMuseum_1F_EventScript_EntranceAttendant"), - ), - bgEvents = - listOf( - BgEventDef( - x = 2, - y = 7, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = - "SlateportCity_OceanicMuseum_1F_EventScript_WhirlpoolExperiment"), - BgEventDef( - x = 2, - y = 4, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = - "SlateportCity_OceanicMuseum_1F_EventScript_WaterfallExperiment"), - BgEventDef( - x = 9, - y = 1, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "SlateportCity_OceanicMuseum_1F_EventScript_OceanSoilDisplay"), - BgEventDef( - x = 12, - y = 1, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "SlateportCity_OceanicMuseum_1F_EventScript_BeachSandDisplay"), - BgEventDef( - x = 10, - y = 1, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "SlateportCity_OceanicMuseum_1F_EventScript_OceanSoilDisplay"), - BgEventDef( - x = 13, - y = 1, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "SlateportCity_OceanicMuseum_1F_EventScript_BeachSandDisplay"), - BgEventDef( - x = 15, - y = 4, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "SlateportCity_OceanicMuseum_1F_EventScript_OceanicMinifact1"), - BgEventDef( - x = 18, - y = 4, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "SlateportCity_OceanicMuseum_1F_EventScript_OceanicMinifact2"), - BgEventDef( - x = 18, - y = 7, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "SlateportCity_OceanicMuseum_1F_EventScript_OceanicMinifact3"), - BgEventDef( - x = 2, - y = 1, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "SlateportCity_OceanicMuseum_1F_EventScript_FossilDisplay"), - BgEventDef( - x = 3, - y = 1, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "SlateportCity_OceanicMuseum_1F_EventScript_FossilDisplay"), - BgEventDef( - x = 16, - y = 1, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = - "SlateportCity_OceanicMuseum_1F_EventScript_DepthMeasuringMachine"), - BgEventDef( - x = 17, - y = 1, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = - "SlateportCity_OceanicMuseum_1F_EventScript_DepthMeasuringMachine"), - ), - ), - // SlateportCity_OceanicMuseum_2F (MAP_SLATEPORT_CITY_OCEANIC_MUSEUM_2F) - MapDef( - regionId = 1, - bankId = 59, - mapId = 8, - width = 20, - height = 9, - paletteIdx1 = 116, - paletteIdx2 = 124, - unknownShort = 375, - unknownByte = 8, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 6, - y = 1, - elevation = 0, - targetRegionId = 1, - targetBankId = 59, - targetMapId = 7, - targetX = 6, - targetY = 1, - targetElevation = 0), - ), - npcs = emptyList(), - bgEvents = - listOf( - BgEventDef( - x = 18, - y = 4, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = - "SlateportCity_OceanicMuseum_2F_EventScript_WaterQualitySample1"), - BgEventDef( - x = 18, - y = 7, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = - "SlateportCity_OceanicMuseum_2F_EventScript_WaterQualitySample2"), - BgEventDef( - x = 4, - y = 3, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = - "SlateportCity_OceanicMuseum_2F_EventScript_SubmersibleReplica"), - BgEventDef( - x = 4, - y = 4, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = - "SlateportCity_OceanicMuseum_2F_EventScript_SubmersibleReplica"), - BgEventDef( - x = 3, - y = 3, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "SlateportCity_OceanicMuseum_2F_EventScript_SubmarineReplica"), - BgEventDef( - x = 2, - y = 3, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "SlateportCity_OceanicMuseum_2F_EventScript_SubmarineReplica"), - BgEventDef( - x = 3, - y = 4, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "SlateportCity_OceanicMuseum_2F_EventScript_SubmarineReplica"), - BgEventDef( - x = 3, - y = 6, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "SlateportCity_OceanicMuseum_2F_EventScript_SSTidalReplica"), - BgEventDef( - x = 4, - y = 6, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "SlateportCity_OceanicMuseum_2F_EventScript_SSTidalReplica"), - BgEventDef( - x = 13, - y = 7, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "SlateportCity_OceanicMuseum_2F_EventScript_SSAnneReplica"), - BgEventDef( - x = 14, - y = 7, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "SlateportCity_OceanicMuseum_2F_EventScript_SSAnneReplica"), - BgEventDef( - x = 18, - y = 1, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = - "SlateportCity_OceanicMuseum_2F_EventScript_SurfaceSeawaterDisplay"), - BgEventDef( - x = 19, - y = 1, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = - "SlateportCity_OceanicMuseum_2F_EventScript_SurfaceSeawaterDisplay"), - BgEventDef( - x = 15, - y = 1, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = - "SlateportCity_OceanicMuseum_2F_EventScript_DeepSeawaterDisplay"), - BgEventDef( - x = 16, - y = 1, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = - "SlateportCity_OceanicMuseum_2F_EventScript_DeepSeawaterDisplay"), - BgEventDef( - x = 8, - y = 1, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "SlateportCity_OceanicMuseum_2F_EventScript_HoennModel"), - BgEventDef( - x = 9, - y = 1, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "SlateportCity_OceanicMuseum_2F_EventScript_HoennModel"), - BgEventDef( - x = 12, - y = 1, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = - "SlateportCity_OceanicMuseum_2F_EventScript_PressureExperiment"), - BgEventDef( - x = 13, - y = 1, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = - "SlateportCity_OceanicMuseum_2F_EventScript_PressureExperiment"), - BgEventDef( - x = 3, - y = 7, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "SlateportCity_OceanicMuseum_2F_EventScript_SSTidalReplica"), - BgEventDef( - x = 4, - y = 7, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "SlateportCity_OceanicMuseum_2F_EventScript_SSTidalReplica"), - ), - ), - ) - allMaps.forEach { registerMap(it) } - } - - private fun registerDefaultMaps2() { - val allMaps = - listOf( - // SlateportCity_Harbor (MAP_SLATEPORT_CITY_HARBOR) - MapDef( - regionId = 1, - bankId = 59, - mapId = 9, - width = 24, - height = 15, - paletteIdx1 = 100, - paletteIdx2 = 129, - unknownShort = 433, - unknownByte = 8, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 11, - y = 14, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 1, - targetX = 28, - targetY = 12, - targetElevation = 0), - WarpTile( - x = 12, - y = 14, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 1, - targetX = 28, - targetY = 12, - targetElevation = 0), - WarpTile( - x = 19, - y = 15, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 1, - targetX = 40, - targetY = 7, - targetElevation = 0), - WarpTile( - x = 20, - y = 15, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 1, - targetX = 40, - targetY = 7, - targetElevation = 0), - ), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // SlateportCity_House (MAP_SLATEPORT_CITY_HOUSE) - MapDef( - regionId = 1, - bankId = 59, - mapId = 10, - width = 11, - height = 8, - paletteIdx1 = 116, - paletteIdx2 = 147, - unknownShort = 433, - unknownByte = 8, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 3, - y = 7, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 1, - targetX = 21, - targetY = 44, - targetElevation = 0), - WarpTile( - x = 4, - y = 7, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 1, - targetX = 21, - targetY = 44, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 25, - x = 4, - y = 4, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 3, - script = "SlateportCity_House_EventScript_PokefanM"), - NpcDef( - entityIdx = 1, - graphicsId = 14, - x = 7, - y = 4, - elevation = 3, - movementType = 9, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 2, - script = "SlateportCity_House_EventScript_Girl"), - ), - bgEvents = emptyList(), - ), - // SlateportCity_PokemonCenter_1F (MAP_SLATEPORT_CITY_POKEMON_CENTER_1F) - MapDef( - regionId = 1, - bankId = 59, - mapId = 11, - width = 14, - height = 9, - paletteIdx1 = 116, - paletteIdx2 = 118, - unknownShort = 400, - unknownByte = 8, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 7, - y = 8, - elevation = 2, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 1, - targetX = 19, - targetY = 19, - targetElevation = 0), - WarpTile( - x = 6, - y = 8, - elevation = 2, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 1, - targetX = 19, - targetY = 19, - targetElevation = 0), - WarpTile( - x = 1, - y = 6, - elevation = 3, - targetRegionId = 1, - targetBankId = 59, - targetMapId = 12, - targetX = 1, - targetY = 6, - targetElevation = 3), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 58, - x = 7, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "SlateportCity_PokemonCenter_1F_EventScript_Nurse"), - NpcDef( - entityIdx = 1, - graphicsId = 49, - x = 2, - y = 3, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "SlateportCity_PokemonCenter_1F_EventScript_Sailor"), - NpcDef( - entityIdx = 2, - graphicsId = 34, - x = 10, - y = 7, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 3, - script = "SlateportCity_PokemonCenter_1F_EventScript_Woman"), - ), - bgEvents = emptyList(), - ), - // SlateportCity_PokemonCenter_2F (MAP_SLATEPORT_CITY_POKEMON_CENTER_2F) - MapDef( - regionId = 1, - bankId = 59, - mapId = 12, - width = 14, - height = 10, - paletteIdx1 = 116, - paletteIdx2 = 118, - unknownShort = 400, - unknownByte = 8, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 1, - y = 6, - elevation = 3, - targetRegionId = 1, - targetBankId = 59, - targetMapId = 11, - targetX = 1, - targetY = 6, - targetElevation = 3), - WarpTile( - x = 5, - y = 1, - elevation = 2, - targetRegionId = 1, - targetBankId = 75, - targetMapId = 60, - targetX = 7, - targetY = 11, - targetElevation = 2), - WarpTile( - x = 9, - y = 1, - elevation = 2, - targetRegionId = 1, - targetBankId = 75, - targetMapId = 25, - targetX = 5, - targetY = 8, - targetElevation = 2), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 0, - x = 6, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "Common_EventScript_UnionRoomAttendant"), - NpcDef( - entityIdx = 1, - graphicsId = 0, - x = 2, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "Common_EventScript_WirelessClubAttendant"), - NpcDef( - entityIdx = 2, - graphicsId = 0, - x = 10, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "Common_EventScript_DirectCornerAttendant"), - ), - bgEvents = emptyList(), - ), - // SlateportCity_Mart (MAP_SLATEPORT_CITY_MART) - MapDef( - regionId = 1, - bankId = 59, - mapId = 13, - width = 11, - height = 8, - paletteIdx1 = 116, - paletteIdx2 = 117, - unknownShort = 404, - unknownByte = 8, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 3, - y = 7, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 1, - targetX = 13, - targetY = 26, - targetElevation = 0), - WarpTile( - x = 4, - y = 7, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 1, - targetX = 13, - targetY = 26, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 83, - x = 1, - y = 3, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 3, - script = "SlateportCity_Mart_EventScript_Clerk"), - NpcDef( - entityIdx = 1, - graphicsId = 44, - x = 4, - y = 2, - elevation = 3, - movementType = 7, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 1, - script = "SlateportCity_Mart_EventScript_BlackBelt"), - NpcDef( - entityIdx = 2, - graphicsId = 33, - x = 5, - y = 5, - elevation = 3, - movementType = 1, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "SlateportCity_Mart_EventScript_Man"), - ), - bgEvents = emptyList(), - ), - // MauvilleCity_Gym (MAP_MAUVILLE_CITY_GYM) - MapDef( - regionId = 1, - bankId = 60, - mapId = 0, - width = 10, - height = 21, - paletteIdx1 = 116, - paletteIdx2 = 151, - unknownShort = 364, - unknownByte = 9, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 4, - y = 20, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 2, - targetX = 8, - targetY = 5, - targetElevation = 0), - WarpTile( - x = 5, - y = 20, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 2, - targetX = 8, - targetY = 5, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 1, - graphicsId = 66, - x = 7, - y = 8, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "MauvilleCity_Gym_EventScript_Shawn"), - NpcDef( - entityIdx = 2, - graphicsId = 14, - x = 1, - y = 16, - elevation = 3, - movementType = 7, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 1, - script = "MauvilleCity_Gym_EventScript_Vivian"), - NpcDef( - entityIdx = 3, - graphicsId = 35, - x = 5, - y = 10, - elevation = 3, - movementType = 9, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 2, - script = "MauvilleCity_Gym_EventScript_Ben"), - NpcDef( - entityIdx = 4, - graphicsId = 66, - x = 1, - y = 13, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "MauvilleCity_Gym_EventScript_Kirk"), - NpcDef( - entityIdx = 5, - graphicsId = 23, - x = 7, - y = 20, - elevation = 3, - movementType = 9, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 2, - script = "MauvilleCity_Gym_EventScript_GymGuide"), - NpcDef( - entityIdx = 6, - graphicsId = 39, - x = 7, - y = 10, - elevation = 3, - movementType = 7, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 1, - script = "MauvilleCity_Gym_EventScript_Angelo"), - ), - bgEvents = - listOf( - BgEventDef( - x = 3, - y = 18, - facingDir = "BG_EVENT_PLAYER_FACING_NORTH", - script = "MauvilleCity_Gym_EventScript_LeftGymStatue"), - BgEventDef( - x = 6, - y = 18, - facingDir = "BG_EVENT_PLAYER_FACING_NORTH", - script = "MauvilleCity_Gym_EventScript_RightGymStatue"), - ), - ), - // MauvilleCity_BikeShop (MAP_MAUVILLE_CITY_BIKE_SHOP) - MapDef( - regionId = 1, - bankId = 60, - mapId = 1, - width = 12, - height = 9, - paletteIdx1 = 100, - paletteIdx2 = 130, - unknownShort = 399, - unknownByte = 9, - borderTiles = - listOf( - Tile2D(0x0208, 0), Tile2D(0x0208, 0), Tile2D(0x0208, 0), Tile2D(0x0208, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 3, - y = 8, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 2, - targetX = 35, - targetY = 5, - targetElevation = 0), - WarpTile( - x = 4, - y = 8, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 2, - targetX = 35, - targetY = 5, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 23, - x = 2, - y = 5, - elevation = 3, - movementType = 9, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 2, - script = "MauvilleCity_BikeShop_EventScript_Rydel"), - NpcDef( - entityIdx = 1, - graphicsId = 66, - x = 7, - y = 6, - elevation = 3, - movementType = 2, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "MauvilleCity_BikeShop_EventScript_Assistant"), - ), - bgEvents = - listOf( - BgEventDef( - x = 8, - y = 1, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "MauvilleCity_BikeShop_EventScript_MachBikeHandbook"), - BgEventDef( - x = 11, - y = 1, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "MauvilleCity_BikeShop_EventScript_AcroBikeHandbook"), - ), - ), - // MauvilleCity_House1 (MAP_MAUVILLE_CITY_HOUSE1) - MapDef( - regionId = 1, - bankId = 60, - mapId = 2, - width = 11, - height = 8, - paletteIdx1 = 116, - paletteIdx2 = 147, - unknownShort = 399, - unknownByte = 9, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 3, - y = 7, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 2, - targetX = 32, - targetY = 14, - targetElevation = 0), - WarpTile( - x = 4, - y = 7, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 2, - targetX = 32, - targetY = 14, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 46, - x = 4, - y = 4, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 3, - script = "MauvilleCity_House1_EventScript_RockSmashDude"), - ), - bgEvents = emptyList(), - ), - // MauvilleCity_GameCorner (MAP_MAUVILLE_CITY_GAME_CORNER) - MapDef( - regionId = 1, - bankId = 60, - mapId = 3, - width = 22, - height = 11, - paletteIdx1 = 116, - paletteIdx2 = 148, - unknownShort = 426, - unknownByte = 9, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 11, - y = 10, - elevation = 2, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 2, - targetX = 8, - targetY = 13, - targetElevation = 0), - WarpTile( - x = 12, - y = 10, - elevation = 2, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 2, - targetX = 8, - targetY = 13, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 20, - x = 12, - y = 7, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "MauvilleCity_GameCorner_EventScript_Woman2"), - NpcDef( - entityIdx = 1, - graphicsId = 48, - x = 16, - y = 5, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "MauvilleCity_GameCorner_EventScript_Gentleman"), - NpcDef( - entityIdx = 2, - graphicsId = 45, - x = 11, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "MauvilleCity_GameCorner_EventScript_CoinsClerk"), - NpcDef( - entityIdx = 3, - graphicsId = 45, - x = 14, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "MauvilleCity_GameCorner_EventScript_PrizeCornerDolls"), - NpcDef( - entityIdx = 4, - graphicsId = 10, - x = 7, - y = 3, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "MauvilleCity_GameCorner_EventScript_Girl"), - NpcDef( - entityIdx = 5, - graphicsId = 25, - x = 19, - y = 4, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "MauvilleCity_GameCorner_EventScript_PokefanM"), - NpcDef( - entityIdx = 6, - graphicsId = 29, - x = 20, - y = 8, - elevation = 3, - movementType = 9, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 2, - script = "MauvilleCity_GameCorner_EventScript_OldMan"), - NpcDef( - entityIdx = 7, - graphicsId = 27, - x = 6, - y = 8, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 3, - script = "MauvilleCity_GameCorner_EventScript_Cook"), - NpcDef( - entityIdx = 8, - graphicsId = 45, - x = 13, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "MauvilleCity_GameCorner_EventScript_PrizeCornerTMs"), - NpcDef( - entityIdx = 9, - graphicsId = 33, - x = 1, - y = 7, - elevation = 3, - movementType = 10, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 3, - script = "MauvilleCity_GameCorner_EventScript_Man"), - NpcDef( - entityIdx = 10, - graphicsId = 39, - x = 9, - y = 8, - elevation = 3, - movementType = 9, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 2, - script = "MauvilleCity_GameCorner_EventScript_Maniac"), - NpcDef( - entityIdx = 11, - graphicsId = 34, - x = 4, - y = 6, - elevation = 3, - movementType = 9, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 2, - script = "MauvilleCity_GameCorner_EventScript_Woman"), - ), - bgEvents = - listOf( - BgEventDef( - x = 2, - y = 6, - facingDir = "BG_EVENT_PLAYER_FACING_EAST", - script = "MauvilleCity_GameCorner_EventScript_SlotMachine0"), - BgEventDef( - x = 2, - y = 8, - facingDir = "BG_EVENT_PLAYER_FACING_EAST", - script = "MauvilleCity_GameCorner_EventScript_SlotMachine1"), - BgEventDef( - x = 2, - y = 9, - facingDir = "BG_EVENT_PLAYER_FACING_EAST", - script = "MauvilleCity_GameCorner_EventScript_SlotMachine2"), - BgEventDef( - x = 3, - y = 7, - facingDir = "BG_EVENT_PLAYER_FACING_WEST", - script = "MauvilleCity_GameCorner_EventScript_SlotMachine3"), - BgEventDef( - x = 3, - y = 8, - facingDir = "BG_EVENT_PLAYER_FACING_WEST", - script = "MauvilleCity_GameCorner_EventScript_SlotMachine4"), - BgEventDef( - x = 3, - y = 9, - facingDir = "BG_EVENT_PLAYER_FACING_WEST", - script = "MauvilleCity_GameCorner_EventScript_SlotMachine5"), - BgEventDef( - x = 7, - y = 6, - facingDir = "BG_EVENT_PLAYER_FACING_EAST", - script = "MauvilleCity_GameCorner_EventScript_SlotMachine6"), - BgEventDef( - x = 7, - y = 7, - facingDir = "BG_EVENT_PLAYER_FACING_EAST", - script = "MauvilleCity_GameCorner_EventScript_SlotMachine7"), - BgEventDef( - x = 7, - y = 9, - facingDir = "BG_EVENT_PLAYER_FACING_EAST", - script = "MauvilleCity_GameCorner_EventScript_SlotMachine8"), - BgEventDef( - x = 8, - y = 6, - facingDir = "BG_EVENT_PLAYER_FACING_WEST", - script = "MauvilleCity_GameCorner_EventScript_SlotMachine9"), - BgEventDef( - x = 8, - y = 7, - facingDir = "BG_EVENT_PLAYER_FACING_WEST", - script = "MauvilleCity_GameCorner_EventScript_SlotMachine10"), - BgEventDef( - x = 8, - y = 9, - facingDir = "BG_EVENT_PLAYER_FACING_WEST", - script = "MauvilleCity_GameCorner_EventScript_SlotMachine11"), - BgEventDef( - x = 14, - y = 6, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "Roulette_EventScript_Table1"), - BgEventDef( - x = 15, - y = 6, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "Roulette_EventScript_Table1"), - BgEventDef( - x = 14, - y = 7, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "Roulette_EventScript_Table1"), - BgEventDef( - x = 15, - y = 7, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "Roulette_EventScript_Table1"), - BgEventDef( - x = 14, - y = 8, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "Roulette_EventScript_Table1"), - BgEventDef( - x = 15, - y = 8, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "Roulette_EventScript_Table1"), - BgEventDef( - x = 18, - y = 6, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "Roulette_EventScript_Table2"), - BgEventDef( - x = 19, - y = 6, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "Roulette_EventScript_Table2"), - BgEventDef( - x = 18, - y = 7, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "Roulette_EventScript_Table2"), - BgEventDef( - x = 19, - y = 7, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "Roulette_EventScript_Table2"), - BgEventDef( - x = 18, - y = 8, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "Roulette_EventScript_Table2"), - BgEventDef( - x = 19, - y = 8, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "Roulette_EventScript_Table2"), - ), - ), - // MauvilleCity_House2 (MAP_MAUVILLE_CITY_HOUSE2) - MapDef( - regionId = 1, - bankId = 60, - mapId = 4, - width = 10, - height = 9, - paletteIdx1 = 116, - paletteIdx2 = 147, - unknownShort = 399, - unknownByte = 9, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 3, - y = 8, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 2, - targetX = 19, - targetY = 14, - targetElevation = 0), - WarpTile( - x = 4, - y = 8, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 2, - targetX = 19, - targetY = 14, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 24, - x = 4, - y = 5, - elevation = 3, - movementType = 9, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 2, - script = "MauvilleCity_House2_EventScript_Woman"), - ), - bgEvents = emptyList(), - ), - // MauvilleCity_PokemonCenter_1F (MAP_MAUVILLE_CITY_POKEMON_CENTER_1F) - MapDef( - regionId = 1, - bankId = 60, - mapId = 5, - width = 14, - height = 9, - paletteIdx1 = 116, - paletteIdx2 = 118, - unknownShort = 400, - unknownByte = 9, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 7, - y = 8, - elevation = 2, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 2, - targetX = 22, - targetY = 5, - targetElevation = 0), - WarpTile( - x = 6, - y = 8, - elevation = 2, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 2, - targetX = 22, - targetY = 5, - targetElevation = 0), - WarpTile( - x = 1, - y = 6, - elevation = 3, - targetRegionId = 1, - targetBankId = 60, - targetMapId = 6, - targetX = 1, - targetY = 6, - targetElevation = 3), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 58, - x = 7, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "MauvilleCity_PokemonCenter_1F_EventScript_Nurse"), - NpcDef( - entityIdx = 1, - graphicsId = 240, - x = 2, - y = 3, - elevation = 3, - movementType = 9, - movementRangeX = 1, - movementRangeY = 0, - trainerType = 0, - facing = 2, - script = "MauvilleCity_PokemonCenter_1F_EventScript_MauvilleOldMan"), - NpcDef( - entityIdx = 2, - graphicsId = 16, - x = 8, - y = 6, - elevation = 3, - movementType = 1, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "MauvilleCity_PokemonCenter_1F_EventScript_Woman1"), - NpcDef( - entityIdx = 3, - graphicsId = 34, - x = 11, - y = 4, - elevation = 3, - movementType = 3, - movementRangeX = 0, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "MauvilleCity_PokemonCenter_1F_EventScript_Woman2"), - NpcDef( - entityIdx = 4, - graphicsId = 35, - x = 2, - y = 8, - elevation = 3, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "MauvilleCity_PokemonCenter_1F_EventScript_Youngster"), - ), - bgEvents = emptyList(), - ), - // MauvilleCity_PokemonCenter_2F (MAP_MAUVILLE_CITY_POKEMON_CENTER_2F) - MapDef( - regionId = 1, - bankId = 60, - mapId = 6, - width = 14, - height = 10, - paletteIdx1 = 116, - paletteIdx2 = 118, - unknownShort = 400, - unknownByte = 9, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 1, - y = 6, - elevation = 3, - targetRegionId = 1, - targetBankId = 60, - targetMapId = 5, - targetX = 1, - targetY = 6, - targetElevation = 3), - WarpTile( - x = 5, - y = 1, - elevation = 2, - targetRegionId = 1, - targetBankId = 75, - targetMapId = 60, - targetX = 7, - targetY = 11, - targetElevation = 2), - WarpTile( - x = 9, - y = 1, - elevation = 2, - targetRegionId = 1, - targetBankId = 75, - targetMapId = 25, - targetX = 5, - targetY = 8, - targetElevation = 2), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 0, - x = 6, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "Common_EventScript_UnionRoomAttendant"), - NpcDef( - entityIdx = 1, - graphicsId = 0, - x = 2, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "Common_EventScript_WirelessClubAttendant"), - NpcDef( - entityIdx = 2, - graphicsId = 0, - x = 10, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "Common_EventScript_DirectCornerAttendant"), - NpcDef( - entityIdx = 4, - graphicsId = 35, - x = 8, - y = 8, - elevation = 3, - movementType = 7, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 1, - script = "MauvilleCity_PokemonCenter_2F_EventScript_Youngster"), - ), - bgEvents = emptyList(), - ), - // MauvilleCity_Mart (MAP_MAUVILLE_CITY_MART) - MapDef( - regionId = 1, - bankId = 60, - mapId = 7, - width = 11, - height = 8, - paletteIdx1 = 116, - paletteIdx2 = 117, - unknownShort = 404, - unknownByte = 9, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 3, - y = 7, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 2, - targetX = 23, - targetY = 14, - targetElevation = 0), - WarpTile( - x = 4, - y = 7, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 2, - targetX = 23, - targetY = 14, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 83, - x = 1, - y = 3, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 3, - script = "MauvilleCity_Mart_EventScript_Clerk"), - NpcDef( - entityIdx = 1, - graphicsId = 21, - x = 5, - y = 4, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 3, - script = "MauvilleCity_Mart_EventScript_ExpertM"), - NpcDef( - entityIdx = 2, - graphicsId = 33, - x = 5, - y = 5, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 3, - script = "MauvilleCity_Mart_EventScript_Man"), - ), - bgEvents = emptyList(), - ), - // RustboroCity_DevonCorp_1F (MAP_RUSTBORO_CITY_DEVON_CORP_1F) - MapDef( - regionId = 1, - bankId = 61, - mapId = 0, - width = 19, - height = 9, - paletteIdx1 = 116, - paletteIdx2 = 129, - unknownShort = 399, - unknownByte = 10, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 5, - y = 8, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 3, - targetX = 11, - targetY = 15, - targetElevation = 0), - WarpTile( - x = 6, - y = 8, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 3, - targetX = 12, - targetY = 15, - targetElevation = 0), - WarpTile( - x = 14, - y = 1, - elevation = 0, - targetRegionId = 1, - targetBankId = 61, - targetMapId = 1, - targetX = 14, - targetY = 1, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 0, - x = 2, - y = 6, - elevation = 3, - movementType = 2, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "RustboroCity_DevonCorp_1F_EventScript_Employee"), - NpcDef( - entityIdx = 1, - graphicsId = 0, - x = 15, - y = 5, - elevation = 3, - movementType = 2, - movementRangeX = 2, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "RustboroCity_DevonCorp_1F_EventScript_StairGuard"), - NpcDef( - entityIdx = 2, - graphicsId = 24, - x = 5, - y = 3, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "RustboroCity_DevonCorp_1F_EventScript_Greeter"), - ), - bgEvents = - listOf( - BgEventDef( - x = 3, - y = 2, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "RustboroCity_DevonCorp_1F_EventScript_ProductsDisplay"), - BgEventDef( - x = 8, - y = 2, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "RustboroCity_DevonCorp_1F_EventScript_RocksMetalDisplay"), - ), - ), - // RustboroCity_DevonCorp_2F (MAP_RUSTBORO_CITY_DEVON_CORP_2F) - MapDef( - regionId = 1, - bankId = 61, - mapId = 1, - width = 19, - height = 9, - paletteIdx1 = 100, - paletteIdx2 = 129, - unknownShort = 399, - unknownByte = 10, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 14, - y = 1, - elevation = 0, - targetRegionId = 1, - targetBankId = 61, - targetMapId = 0, - targetX = 14, - targetY = 1, - targetElevation = 0), - WarpTile( - x = 2, - y = 1, - elevation = 0, - targetRegionId = 1, - targetBankId = 61, - targetMapId = 2, - targetX = 2, - targetY = 1, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 46, - x = 6, - y = 5, - elevation = 3, - movementType = 7, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 1, - script = - "RustboroCity_DevonCorp_2F_EventScript_TalkToPokemonScientist"), - NpcDef( - entityIdx = 1, - graphicsId = 46, - x = 1, - y = 5, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 3, - script = "RustboroCity_DevonCorp_2F_EventScript_BallScientist"), - NpcDef( - entityIdx = 2, - graphicsId = 46, - x = 2, - y = 6, - elevation = 3, - movementType = 15, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "RustboroCity_DevonCorp_2F_EventScript_PokenavScientist"), - NpcDef( - entityIdx = 3, - graphicsId = 46, - x = 10, - y = 5, - elevation = 3, - movementType = 7, - movementRangeX = 0, - movementRangeY = 10, - trainerType = 0, - facing = 1, - script = - "RustboroCity_DevonCorp_2F_EventScript_PokemonDreamsScientist"), - NpcDef( - entityIdx = 4, - graphicsId = 46, - x = 14, - y = 8, - elevation = 3, - movementType = 7, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 1, - script = "RustboroCity_DevonCorp_2F_EventScript_FossilScientist"), - NpcDef( - entityIdx = 5, - graphicsId = 46, - x = 14, - y = 5, - elevation = 3, - movementType = 7, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 1, - script = "RustboroCity_DevonCorp_2F_EventScript_MatchCallScientist"), - ), - bgEvents = emptyList(), - ), - // RustboroCity_DevonCorp_3F (MAP_RUSTBORO_CITY_DEVON_CORP_3F) - MapDef( - regionId = 1, - bankId = 61, - mapId = 2, - width = 19, - height = 9, - paletteIdx1 = 116, - paletteIdx2 = 129, - unknownShort = 399, - unknownByte = 10, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 2, - y = 1, - elevation = 0, - targetRegionId = 1, - targetBankId = 61, - targetMapId = 1, - targetX = 2, - targetY = 1, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 48, - x = 17, - y = 5, - elevation = 3, - movementType = 9, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 2, - script = "RustboroCity_DevonCorp_3F_EventScript_MrStone"), - NpcDef( - entityIdx = 2, - graphicsId = 48, - x = 15, - y = 5, - elevation = 3, - movementType = 76, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "RustboroCity_DevonCorp_3F_EventScript_MrStone"), - ), - bgEvents = - listOf( - BgEventDef( - x = 1, - y = 5, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "RustboroCity_DevonCorp_3F_EventScript_RareRocksDisplay"), - BgEventDef( - x = 1, - y = 7, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "RustboroCity_DevonCorp_3F_EventScript_RareRocksDisplay"), - ), - ), - // RustboroCity_Gym (MAP_RUSTBORO_CITY_GYM) - MapDef( - regionId = 1, - bankId = 61, - mapId = 3, - width = 11, - height = 20, - paletteIdx1 = 116, - paletteIdx2 = 149, - unknownShort = 364, - unknownByte = 10, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 5, - y = 19, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 3, - targetX = 27, - targetY = 19, - targetElevation = 0), - WarpTile( - x = 6, - y = 19, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 3, - targetX = 27, - targetY = 19, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 0, - x = 5, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "RustboroCity_Gym_EventScript_Roxanne"), - NpcDef( - entityIdx = 1, - graphicsId = 35, - x = 5, - y = 13, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "RustboroCity_Gym_EventScript_Josh"), - NpcDef( - entityIdx = 2, - graphicsId = 35, - x = 3, - y = 9, - elevation = 3, - movementType = 9, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 2, - script = "RustboroCity_Gym_EventScript_Tommy"), - NpcDef( - entityIdx = 3, - graphicsId = 23, - x = 3, - y = 18, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "RustboroCity_Gym_EventScript_GymGuide"), - NpcDef( - entityIdx = 4, - graphicsId = 55, - x = 1, - y = 6, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "RustboroCity_Gym_EventScript_Marc"), - ), - bgEvents = - listOf( - BgEventDef( - x = 2, - y = 18, - facingDir = "BG_EVENT_PLAYER_FACING_NORTH", - script = "RustboroCity_Gym_EventScript_LeftGymStatue"), - BgEventDef( - x = 8, - y = 18, - facingDir = "BG_EVENT_PLAYER_FACING_NORTH", - script = "RustboroCity_Gym_EventScript_RightGymStatue"), - ), - ), - // RustboroCity_PokemonSchool (MAP_RUSTBORO_CITY_POKEMON_SCHOOL) - MapDef( - regionId = 1, - bankId = 61, - mapId = 4, - width = 12, - height = 11, - paletteIdx1 = 116, - paletteIdx2 = 120, - unknownShort = 435, - unknownByte = 10, - borderTiles = - listOf( - Tile2D(0x0207, 0), Tile2D(0x0207, 0), Tile2D(0x0207, 0), Tile2D(0x0207, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 5, - y = 10, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 3, - targetX = 27, - targetY = 34, - targetElevation = 0), - WarpTile( - x = 6, - y = 10, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 3, - targetX = 27, - targetY = 34, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 0, - x = 8, - y = 6, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 3, - script = "RustboroCity_PokemonSchool_EventScript_GameboyKid1"), - NpcDef( - entityIdx = 1, - graphicsId = 0, - x = 9, - y = 6, - elevation = 3, - movementType = 9, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 2, - script = "RustboroCity_PokemonSchool_EventScript_GameboyKid2"), - NpcDef( - entityIdx = 2, - graphicsId = 15, - x = 3, - y = 8, - elevation = 3, - movementType = 7, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 1, - script = "RustboroCity_PokemonSchool_EventScript_RichBoy"), - NpcDef( - entityIdx = 3, - graphicsId = 47, - x = 10, - y = 8, - elevation = 3, - movementType = 7, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 1, - script = "RustboroCity_PokemonSchool_EventScript_Lass"), - NpcDef( - entityIdx = 4, - graphicsId = 38, - x = 3, - y = 6, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "RustboroCity_PokemonSchool_EventScript_SchoolKidM"), - NpcDef( - entityIdx = 5, - graphicsId = 48, - x = 5, - y = 3, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "RustboroCity_PokemonSchool_EventScript_Teacher"), - ), - bgEvents = - listOf( - BgEventDef( - x = 5, - y = 2, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "RustboroCity_PokemonSchool_EventScript_Blackboard"), - BgEventDef( - x = 4, - y = 2, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "RustboroCity_PokemonSchool_EventScript_Blackboard"), - BgEventDef( - x = 6, - y = 2, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "RustboroCity_PokemonSchool_EventScript_Blackboard"), - BgEventDef( - x = 7, - y = 2, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "RustboroCity_PokemonSchool_EventScript_Blackboard"), - BgEventDef( - x = 3, - y = 5, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "RustboroCity_PokemonSchool_EventScript_StudentNotebook"), - ), - ), - // RustboroCity_PokemonCenter_1F (MAP_RUSTBORO_CITY_POKEMON_CENTER_1F) - MapDef( - regionId = 1, - bankId = 61, - mapId = 5, - width = 14, - height = 9, - paletteIdx1 = 116, - paletteIdx2 = 118, - unknownShort = 400, - unknownByte = 10, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 7, - y = 8, - elevation = 2, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 3, - targetX = 16, - targetY = 38, - targetElevation = 0), - WarpTile( - x = 6, - y = 8, - elevation = 2, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 3, - targetX = 16, - targetY = 38, - targetElevation = 0), - WarpTile( - x = 1, - y = 6, - elevation = 3, - targetRegionId = 1, - targetBankId = 61, - targetMapId = 6, - targetX = 1, - targetY = 6, - targetElevation = 3), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 58, - x = 7, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "RustboroCity_PokemonCenter_1F_EventScript_Nurse"), - NpcDef( - entityIdx = 1, - graphicsId = 19, - x = 11, - y = 2, - elevation = 3, - movementType = 9, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 2, - script = "RustboroCity_PokemonCenter_1F_EventScript_Man"), - NpcDef( - entityIdx = 2, - graphicsId = 7, - x = 3, - y = 4, - elevation = 3, - movementType = 2, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "RustboroCity_PokemonCenter_1F_EventScript_Boy"), - NpcDef( - entityIdx = 3, - graphicsId = 14, - x = 10, - y = 6, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 3, - script = "RustboroCity_PokemonCenter_1F_EventScript_Girl"), - ), - bgEvents = emptyList(), - ), - // RustboroCity_PokemonCenter_2F (MAP_RUSTBORO_CITY_POKEMON_CENTER_2F) - MapDef( - regionId = 1, - bankId = 61, - mapId = 6, - width = 14, - height = 10, - paletteIdx1 = 116, - paletteIdx2 = 118, - unknownShort = 400, - unknownByte = 10, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 1, - y = 6, - elevation = 3, - targetRegionId = 1, - targetBankId = 61, - targetMapId = 5, - targetX = 1, - targetY = 6, - targetElevation = 3), - WarpTile( - x = 5, - y = 1, - elevation = 2, - targetRegionId = 1, - targetBankId = 75, - targetMapId = 60, - targetX = 7, - targetY = 11, - targetElevation = 2), - WarpTile( - x = 9, - y = 1, - elevation = 2, - targetRegionId = 1, - targetBankId = 75, - targetMapId = 25, - targetX = 5, - targetY = 8, - targetElevation = 2), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 0, - x = 6, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "Common_EventScript_UnionRoomAttendant"), - NpcDef( - entityIdx = 1, - graphicsId = 0, - x = 2, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "Common_EventScript_WirelessClubAttendant"), - NpcDef( - entityIdx = 2, - graphicsId = 0, - x = 10, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "Common_EventScript_DirectCornerAttendant"), - ), - bgEvents = emptyList(), - ), - // RustboroCity_Mart (MAP_RUSTBORO_CITY_MART) - MapDef( - regionId = 1, - bankId = 61, - mapId = 7, - width = 11, - height = 8, - paletteIdx1 = 116, - paletteIdx2 = 117, - unknownShort = 404, - unknownByte = 10, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 3, - y = 7, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 3, - targetX = 16, - targetY = 45, - targetElevation = 0), - WarpTile( - x = 4, - y = 7, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 3, - targetX = 16, - targetY = 45, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 83, - x = 1, - y = 3, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 3, - script = "RustboroCity_Mart_EventScript_Clerk"), - NpcDef( - entityIdx = 1, - graphicsId = 7, - x = 2, - y = 5, - elevation = 3, - movementType = 7, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 1, - script = "RustboroCity_Mart_EventScript_Boy"), - NpcDef( - entityIdx = 2, - graphicsId = 18, - x = 8, - y = 4, - elevation = 3, - movementType = 3, - movementRangeX = 0, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "RustboroCity_Mart_EventScript_PokefanF"), - NpcDef( - entityIdx = 3, - graphicsId = 36, - x = 8, - y = 2, - elevation = 3, - movementType = 7, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 1, - script = "RustboroCity_Mart_EventScript_BugCatcher"), - ), - bgEvents = emptyList(), - ), - // RustboroCity_Flat1_1F (MAP_RUSTBORO_CITY_FLAT1_1F) - MapDef( - regionId = 1, - bankId = 61, - mapId = 8, - width = 14, - height = 8, - paletteIdx1 = 116, - paletteIdx2 = 147, - unknownShort = 399, - unknownByte = 10, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 6, - y = 7, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 3, - targetX = 13, - targetY = 30, - targetElevation = 0), - WarpTile( - x = 7, - y = 7, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 3, - targetX = 13, - targetY = 30, - targetElevation = 0), - WarpTile( - x = 2, - y = 1, - elevation = 0, - targetRegionId = 1, - targetBankId = 61, - targetMapId = 9, - targetX = 2, - targetY = 1, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 33, - x = 9, - y = 4, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 3, - script = "RustboroCity_Flat1_1F_EventScript_Man"), - NpcDef( - entityIdx = 1, - graphicsId = 34, - x = 12, - y = 4, - elevation = 3, - movementType = 9, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 2, - script = "RustboroCity_Flat1_1F_EventScript_Woman"), - ), - bgEvents = emptyList(), - ), - // RustboroCity_Flat1_2F (MAP_RUSTBORO_CITY_FLAT1_2F) - MapDef( - regionId = 1, - bankId = 61, - mapId = 9, - width = 14, - height = 8, - paletteIdx1 = 116, - paletteIdx2 = 147, - unknownShort = 399, - unknownByte = 10, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 2, - y = 1, - elevation = 0, - targetRegionId = 1, - targetBankId = 61, - targetMapId = 8, - targetX = 2, - targetY = 1, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 18, - x = 4, - y = 6, - elevation = 3, - movementType = 5, - movementRangeX = 3, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "RustboroCity_Flat1_2F_EventScript_WaldasMom"), - NpcDef( - entityIdx = 1, - graphicsId = 6, - x = 9, - y = 5, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "0x0"), - NpcDef( - entityIdx = 2, - graphicsId = 0, - x = 9, - y = 4, - elevation = 3, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "RustboroCity_Flat1_2F_EventScript_PokeDoll"), - NpcDef( - entityIdx = 3, - graphicsId = 0, - x = 10, - y = 5, - elevation = 3, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "RustboroCity_Flat1_2F_EventScript_PokeDoll"), - NpcDef( - entityIdx = 4, - graphicsId = 0, - x = 10, - y = 6, - elevation = 3, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "RustboroCity_Flat1_2F_EventScript_PokeDoll"), - NpcDef( - entityIdx = 5, - graphicsId = 19, - x = 8, - y = 5, - elevation = 3, - movementType = 10, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 3, - script = "RustboroCity_Flat1_2F_EventScript_WaldasDad"), - NpcDef( - entityIdx = 6, - graphicsId = 0, - x = 8, - y = 6, - elevation = 3, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "RustboroCity_Flat1_2F_EventScript_PokeDoll"), - NpcDef( - entityIdx = 7, - graphicsId = 0, - x = 9, - y = 7, - elevation = 3, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "RustboroCity_Flat1_2F_EventScript_PokeDoll"), - ), - bgEvents = emptyList(), - ), - // RustboroCity_House1 (MAP_RUSTBORO_CITY_HOUSE1) - MapDef( - regionId = 1, - bankId = 61, - mapId = 10, - width = 13, - height = 8, - paletteIdx1 = 116, - paletteIdx2 = 147, - unknownShort = 399, - unknownByte = 10, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 5, - y = 7, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 3, - targetX = 33, - targetY = 19, - targetElevation = 0), - WarpTile( - x = 6, - y = 7, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 3, - targetX = 33, - targetY = 19, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 31, - x = 6, - y = 4, - elevation = 3, - movementType = 9, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 2, - script = "RustboroCity_House1_EventScript_Trader"), - NpcDef( - entityIdx = 1, - graphicsId = 55, - x = 9, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "RustboroCity_House1_EventScript_Hiker"), - ), - bgEvents = emptyList(), - ), - // RustboroCity_CuttersHouse (MAP_RUSTBORO_CITY_CUTTERS_HOUSE) - MapDef( - regionId = 1, - bankId = 61, - mapId = 11, - width = 11, - height = 9, - paletteIdx1 = 116, - paletteIdx2 = 147, - unknownShort = 399, - unknownByte = 10, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 5, - y = 8, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 3, - targetX = 9, - targetY = 38, - targetElevation = 0), - WarpTile( - x = 6, - y = 8, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 3, - targetX = 9, - targetY = 38, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 25, - x = 7, - y = 5, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 3, - script = "RustboroCity_CuttersHouse_EventScript_Cutter"), - NpcDef( - entityIdx = 1, - graphicsId = 47, - x = 9, - y = 2, - elevation = 3, - movementType = 5, - movementRangeX = 1, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "RustboroCity_CuttersHouse_EventScript_Lass"), - ), - bgEvents = emptyList(), - ), - // RustboroCity_House2 (MAP_RUSTBORO_CITY_HOUSE2) - MapDef( - regionId = 1, - bankId = 61, - mapId = 12, - width = 12, - height = 9, - paletteIdx1 = 116, - paletteIdx2 = 147, - unknownShort = 399, - unknownByte = 10, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 5, - y = 8, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 3, - targetX = 30, - targetY = 28, - targetElevation = 0), - WarpTile( - x = 6, - y = 8, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 3, - targetX = 30, - targetY = 28, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 18, - x = 4, - y = 4, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "RustboroCity_House2_EventScript_PokefanF"), - NpcDef( - entityIdx = 1, - graphicsId = 12, - x = 4, - y = 5, - elevation = 3, - movementType = 7, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 1, - script = "RustboroCity_House2_EventScript_LittleGirl"), - ), - bgEvents = emptyList(), - ), - // RustboroCity_Flat2_1F (MAP_RUSTBORO_CITY_FLAT2_1F) - MapDef( - regionId = 1, - bankId = 61, - mapId = 13, - width = 14, - height = 9, - paletteIdx1 = 116, - paletteIdx2 = 147, - unknownShort = 399, - unknownByte = 10, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 2, - y = 8, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 3, - targetX = 5, - targetY = 51, - targetElevation = 0), - WarpTile( - x = 3, - y = 8, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 3, - targetX = 5, - targetY = 51, - targetElevation = 0), - WarpTile( - x = 3, - y = 1, - elevation = 0, - targetRegionId = 1, - targetBankId = 61, - targetMapId = 14, - targetX = 3, - targetY = 1, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 0, - x = 11, - y = 4, - elevation = 3, - movementType = 9, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 2, - script = "RustboroCity_Flat2_1F_EventScript_Skitty"), - NpcDef( - entityIdx = 1, - graphicsId = 30, - x = 8, - y = 4, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 3, - script = "RustboroCity_Flat2_1F_EventScript_OldWoman"), - ), - bgEvents = emptyList(), - ), - // RustboroCity_Flat2_2F (MAP_RUSTBORO_CITY_FLAT2_2F) - MapDef( - regionId = 1, - bankId = 61, - mapId = 14, - width = 14, - height = 9, - paletteIdx1 = 116, - paletteIdx2 = 147, - unknownShort = 399, - unknownByte = 10, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 3, - y = 1, - elevation = 0, - targetRegionId = 1, - targetBankId = 61, - targetMapId = 13, - targetX = 3, - targetY = 1, - targetElevation = 0), - WarpTile( - x = 1, - y = 1, - elevation = 0, - targetRegionId = 1, - targetBankId = 61, - targetMapId = 15, - targetX = 1, - targetY = 1, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 29, - x = 11, - y = 4, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 3, - script = "RustboroCity_Flat2_2F_EventScript_OldMan"), - NpcDef( - entityIdx = 1, - graphicsId = 5, - x = 7, - y = 3, - elevation = 3, - movementType = 5, - movementRangeX = 2, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "RustboroCity_Flat2_2F_EventScript_NinjaBoy"), - ), - bgEvents = emptyList(), - ), - // RustboroCity_Flat2_3F (MAP_RUSTBORO_CITY_FLAT2_3F) - MapDef( - regionId = 1, - bankId = 61, - mapId = 15, - width = 14, - height = 9, - paletteIdx1 = 116, - paletteIdx2 = 147, - unknownShort = 399, - unknownByte = 10, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 1, - y = 1, - elevation = 0, - targetRegionId = 1, - targetBankId = 61, - targetMapId = 14, - targetX = 1, - targetY = 1, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 0, - x = 7, - y = 3, - elevation = 3, - movementType = 5, - movementRangeX = 2, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "RustboroCity_Flat2_3F_EventScript_DevonEmployee"), - NpcDef( - entityIdx = 1, - graphicsId = 16, - x = 12, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "RustboroCity_Flat2_3F_EventScript_Woman"), - ), - bgEvents = emptyList(), - ), - // RustboroCity_House3 (MAP_RUSTBORO_CITY_HOUSE3) - MapDef( - regionId = 1, - bankId = 61, - mapId = 16, - width = 12, - height = 9, - paletteIdx1 = 116, - paletteIdx2 = 147, - unknownShort = 399, - unknownByte = 10, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 5, - y = 8, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 3, - targetX = 26, - targetY = 46, - targetElevation = 0), - WarpTile( - x = 6, - y = 8, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 3, - targetX = 26, - targetY = 46, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 29, - x = 4, - y = 5, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 3, - script = "RustboroCity_House3_EventScript_OldMan"), - NpcDef( - entityIdx = 1, - graphicsId = 30, - x = 7, - y = 5, - elevation = 3, - movementType = 9, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 2, - script = "RustboroCity_House3_EventScript_OldWoman"), - NpcDef( - entityIdx = 2, - graphicsId = 0, - x = 4, - y = 4, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "RustboroCity_House3_EventScript_Pekachu"), - ), - bgEvents = emptyList(), - ), - // FortreeCity_House1 (MAP_FORTREE_CITY_HOUSE1) - MapDef( - regionId = 1, - bankId = 62, - mapId = 0, - width = 8, - height = 6, - paletteIdx1 = 116, - paletteIdx2 = 147, - unknownShort = 382, - unknownByte = 11, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 3, - y = 5, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 4, - targetX = 10, - targetY = 3, - targetElevation = 0), - WarpTile( - x = 4, - y = 5, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 4, - targetX = 10, - targetY = 3, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 5, - x = 1, - y = 3, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 3, - script = "FortreeCity_House1_EventScript_Trader"), - NpcDef( - entityIdx = 1, - graphicsId = 0, - x = 2, - y = 3, - elevation = 3, - movementType = 9, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 2, - script = "FortreeCity_House1_EventScript_Zigzagoon"), - NpcDef( - entityIdx = 2, - graphicsId = 22, - x = 7, - y = 4, - elevation = 3, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "FortreeCity_House1_EventScript_ExpertF"), - ), - bgEvents = emptyList(), - ), - // FortreeCity_Gym (MAP_FORTREE_CITY_GYM) - MapDef( - regionId = 1, - bankId = 62, - mapId = 1, - width = 20, - height = 25, - paletteIdx1 = 116, - paletteIdx2 = 154, - unknownShort = 364, - unknownByte = 11, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 15, - y = 24, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 4, - targetX = 22, - targetY = 11, - targetElevation = 0), - WarpTile( - x = 16, - y = 24, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 4, - targetX = 22, - targetY = 11, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 0, - x = 15, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "FortreeCity_Gym_EventScript_Winona"), - NpcDef( - entityIdx = 1, - graphicsId = 66, - x = 4, - y = 14, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "FortreeCity_Gym_EventScript_Jared"), - NpcDef( - entityIdx = 2, - graphicsId = 31, - x = 10, - y = 10, - elevation = 3, - movementType = 9, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 2, - script = "FortreeCity_Gym_EventScript_Flint"), - NpcDef( - entityIdx = 3, - graphicsId = 32, - x = 5, - y = 17, - elevation = 3, - movementType = 9, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 2, - script = "FortreeCity_Gym_EventScript_Ashley"), - NpcDef( - entityIdx = 4, - graphicsId = 66, - x = 9, - y = 8, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "FortreeCity_Gym_EventScript_Edwardo"), - NpcDef( - entityIdx = 5, - graphicsId = 23, - x = 15, - y = 21, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "FortreeCity_Gym_EventScript_GymGuide"), - NpcDef( - entityIdx = 6, - graphicsId = 66, - x = 4, - y = 23, - elevation = 3, - movementType = 10, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 3, - script = "FortreeCity_Gym_EventScript_Humberto"), - NpcDef( - entityIdx = 7, - graphicsId = 66, - x = 1, - y = 10, - elevation = 3, - movementType = 7, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 1, - script = "FortreeCity_Gym_EventScript_Darius"), - ), - bgEvents = - listOf( - BgEventDef( - x = 14, - y = 21, - facingDir = "BG_EVENT_PLAYER_FACING_NORTH", - script = "FortreeCity_Gym_EventScript_LeftGymStatue"), - BgEventDef( - x = 17, - y = 21, - facingDir = "BG_EVENT_PLAYER_FACING_NORTH", - script = "FortreeCity_Gym_EventScript_RightGymStatue"), - ), - ), - // FortreeCity_PokemonCenter_1F (MAP_FORTREE_CITY_POKEMON_CENTER_1F) - MapDef( - regionId = 1, - bankId = 62, - mapId = 2, - width = 14, - height = 9, - paletteIdx1 = 116, - paletteIdx2 = 118, - unknownShort = 400, - unknownByte = 11, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 7, - y = 8, - elevation = 2, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 4, - targetX = 5, - targetY = 6, - targetElevation = 0), - WarpTile( - x = 6, - y = 8, - elevation = 2, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 4, - targetX = 5, - targetY = 6, - targetElevation = 0), - WarpTile( - x = 1, - y = 6, - elevation = 3, - targetRegionId = 1, - targetBankId = 62, - targetMapId = 3, - targetX = 1, - targetY = 6, - targetElevation = 3), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 58, - x = 7, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "FortreeCity_PokemonCenter_1F_EventScript_Nurse"), - NpcDef( - entityIdx = 1, - graphicsId = 48, - x = 4, - y = 7, - elevation = 3, - movementType = 1, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "FortreeCity_PokemonCenter_1F_EventScript_Gentleman"), - NpcDef( - entityIdx = 2, - graphicsId = 33, - x = 8, - y = 5, - elevation = 3, - movementType = 1, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "FortreeCity_PokemonCenter_1F_EventScript_Man"), - NpcDef( - entityIdx = 3, - graphicsId = 13, - x = 2, - y = 3, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "FortreeCity_PokemonCenter_1F_EventScript_Boy"), - ), - bgEvents = emptyList(), - ), - // FortreeCity_PokemonCenter_2F (MAP_FORTREE_CITY_POKEMON_CENTER_2F) - MapDef( - regionId = 1, - bankId = 62, - mapId = 3, - width = 14, - height = 10, - paletteIdx1 = 116, - paletteIdx2 = 118, - unknownShort = 400, - unknownByte = 11, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 1, - y = 6, - elevation = 3, - targetRegionId = 1, - targetBankId = 62, - targetMapId = 2, - targetX = 1, - targetY = 6, - targetElevation = 3), - WarpTile( - x = 5, - y = 1, - elevation = 2, - targetRegionId = 1, - targetBankId = 75, - targetMapId = 60, - targetX = 7, - targetY = 11, - targetElevation = 2), - WarpTile( - x = 9, - y = 1, - elevation = 2, - targetRegionId = 1, - targetBankId = 75, - targetMapId = 25, - targetX = 5, - targetY = 8, - targetElevation = 2), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 0, - x = 6, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "Common_EventScript_UnionRoomAttendant"), - NpcDef( - entityIdx = 1, - graphicsId = 0, - x = 2, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "Common_EventScript_WirelessClubAttendant"), - NpcDef( - entityIdx = 2, - graphicsId = 0, - x = 10, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "Common_EventScript_DirectCornerAttendant"), - ), - bgEvents = emptyList(), - ), - // FortreeCity_Mart (MAP_FORTREE_CITY_MART) - MapDef( - regionId = 1, - bankId = 62, - mapId = 4, - width = 11, - height = 8, - paletteIdx1 = 116, - paletteIdx2 = 117, - unknownShort = 404, - unknownByte = 11, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 3, - y = 7, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 4, - targetX = 4, - targetY = 14, - targetElevation = 0), - WarpTile( - x = 4, - y = 7, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 4, - targetX = 4, - targetY = 14, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 83, - x = 1, - y = 3, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 3, - script = "FortreeCity_Mart_EventScript_Clerk"), - NpcDef( - entityIdx = 1, - graphicsId = 20, - x = 9, - y = 3, - elevation = 3, - movementType = 7, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 1, - script = "FortreeCity_Mart_EventScript_Woman"), - NpcDef( - entityIdx = 2, - graphicsId = 14, - x = 8, - y = 5, - elevation = 3, - movementType = 2, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "FortreeCity_Mart_EventScript_Girl"), - NpcDef( - entityIdx = 3, - graphicsId = 9, - x = 5, - y = 6, - elevation = 3, - movementType = 10, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 3, - script = "FortreeCity_Mart_EventScript_Boy"), - ), - bgEvents = emptyList(), - ), - // FortreeCity_House2 (MAP_FORTREE_CITY_HOUSE2) - MapDef( - regionId = 1, - bankId = 62, - mapId = 5, - width = 8, - height = 6, - paletteIdx1 = 116, - paletteIdx2 = 147, - unknownShort = 382, - unknownByte = 11, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 3, - y = 5, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 4, - targetX = 17, - targetY = 3, - targetElevation = 0), - WarpTile( - x = 4, - y = 5, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 4, - targetX = 17, - targetY = 3, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 22, - x = 2, - y = 3, - elevation = 3, - movementType = 5, - movementRangeX = 1, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "FortreeCity_House2_EventScript_HiddenPowerGiver"), - NpcDef( - entityIdx = 1, - graphicsId = 21, - x = 6, - y = 3, - elevation = 3, - movementType = 9, - movementRangeX = 1, - movementRangeY = 0, - trainerType = 0, - facing = 2, - script = "FortreeCity_House2_EventScript_SleepTalkTutor"), - ), - bgEvents = emptyList(), - ), - // FortreeCity_House3 (MAP_FORTREE_CITY_HOUSE3) - MapDef( - regionId = 1, - bankId = 62, - mapId = 6, - width = 8, - height = 6, - paletteIdx1 = 116, - paletteIdx2 = 147, - unknownShort = 382, - unknownByte = 11, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 3, - y = 5, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 4, - targetX = 25, - targetY = 3, - targetElevation = 0), - WarpTile( - x = 4, - y = 5, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 4, - targetX = 25, - targetY = 3, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 39, - x = 0, - y = 3, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 3, - script = "FortreeCity_House3_EventScript_Maniac"), - NpcDef( - entityIdx = 1, - graphicsId = 38, - x = 5, - y = 4, - elevation = 3, - movementType = 2, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "FortreeCity_House3_EventScript_SchoolKidM"), - ), - bgEvents = emptyList(), - ), - // FortreeCity_House4 (MAP_FORTREE_CITY_HOUSE4) - MapDef( - regionId = 1, - bankId = 62, - mapId = 7, - width = 8, - height = 6, - paletteIdx1 = 116, - paletteIdx2 = 147, - unknownShort = 382, - unknownByte = 11, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 3, - y = 5, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 4, - targetX = 32, - targetY = 2, - targetElevation = 0), - WarpTile( - x = 4, - y = 5, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 4, - targetX = 32, - targetY = 2, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 26, - x = 6, - y = 4, - elevation = 3, - movementType = 2, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "FortreeCity_House4_EventScript_Woman"), - NpcDef( - entityIdx = 1, - graphicsId = 13, - x = 1, - y = 3, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "FortreeCity_House4_EventScript_Boy"), - ), - bgEvents = emptyList(), - ), - // FortreeCity_House5 (MAP_FORTREE_CITY_HOUSE5) - MapDef( - regionId = 1, - bankId = 62, - mapId = 8, - width = 8, - height = 6, - paletteIdx1 = 116, - paletteIdx2 = 147, - unknownShort = 382, - unknownByte = 11, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 3, - y = 5, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 4, - targetX = 12, - targetY = 13, - targetElevation = 0), - WarpTile( - x = 4, - y = 5, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 4, - targetX = 12, - targetY = 13, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 18, - x = 6, - y = 4, - elevation = 3, - movementType = 20, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "FortreeCity_House5_EventScript_PokefanF"), - NpcDef( - entityIdx = 1, - graphicsId = 0, - x = 6, - y = 3, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "FortreeCity_House5_EventScript_Zigzagoon"), - NpcDef( - entityIdx = 2, - graphicsId = 19, - x = 2, - y = 4, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 3, - script = "FortreeCity_House5_EventScript_Man"), - ), - bgEvents = emptyList(), - ), - // FortreeCity_DecorationShop (MAP_FORTREE_CITY_DECORATION_SHOP) - MapDef( - regionId = 1, - bankId = 62, - mapId = 9, - width = 8, - height = 6, - paletteIdx1 = 116, - paletteIdx2 = 147, - unknownShort = 382, - unknownByte = 11, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 3, - y = 5, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 4, - targetX = 37, - targetY = 13, - targetElevation = 0), - WarpTile( - x = 4, - y = 5, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 4, - targetX = 37, - targetY = 13, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 25, - x = 6, - y = 5, - elevation = 3, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "FortreeCity_DecorationShop_EventScript_PokefanM"), - NpcDef( - entityIdx = 1, - graphicsId = 14, - x = 0, - y = 4, - elevation = 3, - movementType = 9, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 2, - script = "FortreeCity_DecorationShop_EventScript_Girl"), - NpcDef( - entityIdx = 2, - graphicsId = 83, - x = 1, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "FortreeCity_DecorationShop_EventScript_ClerkDesks"), - NpcDef( - entityIdx = 3, - graphicsId = 83, - x = 6, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "FortreeCity_DecorationShop_EventScript_ClerkChairs"), - ), - bgEvents = emptyList(), - ), - // LilycoveCity_CoveLilyMotel_1F (MAP_LILYCOVE_CITY_COVE_LILY_MOTEL_1F) - MapDef( - regionId = 1, - bankId = 63, - mapId = 0, - width = 12, - height = 9, - paletteIdx1 = 116, - paletteIdx2 = 147, - unknownShort = 408, - unknownByte = 12, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 5, - y = 8, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 5, - targetX = 37, - targetY = 24, - targetElevation = 0), - WarpTile( - x = 6, - y = 8, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 5, - targetX = 37, - targetY = 24, - targetElevation = 0), - WarpTile( - x = 2, - y = 1, - elevation = 0, - targetRegionId = 1, - targetBankId = 63, - targetMapId = 1, - targetX = 2, - targetY = 1, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 19, - x = 10, - y = 3, - elevation = 3, - movementType = 7, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 1, - script = "LilycoveCity_CoveLilyMotel_1F_EventScript_MotelOwner"), - ), - bgEvents = emptyList(), - ), - // LilycoveCity_CoveLilyMotel_2F (MAP_LILYCOVE_CITY_COVE_LILY_MOTEL_2F) - MapDef( - regionId = 1, - bankId = 63, - mapId = 1, - width = 12, - height = 9, - paletteIdx1 = 116, - paletteIdx2 = 147, - unknownShort = 408, - unknownByte = 12, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 2, - y = 1, - elevation = 0, - targetRegionId = 1, - targetBankId = 63, - targetMapId = 0, - targetX = 2, - targetY = 1, - targetElevation = 0), - ), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // LilycoveCity_LilycoveMuseum_1F (MAP_LILYCOVE_CITY_LILYCOVE_MUSEUM_1F) - MapDef( - regionId = 1, - bankId = 63, - mapId = 2, - width = 21, - height = 14, - paletteIdx1 = 116, - paletteIdx2 = 141, - unknownShort = 373, - unknownByte = 12, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 9, - y = 13, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 5, - targetX = 11, - targetY = 5, - targetElevation = 0), - WarpTile( - x = 10, - y = 13, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 5, - targetX = 12, - targetY = 5, - targetElevation = 0), - WarpTile( - x = 16, - y = 1, - elevation = 0, - targetRegionId = 1, - targetBankId = 63, - targetMapId = 3, - targetX = 13, - targetY = 1, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 45, - x = 5, - y = 12, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 3, - script = "LilycoveCity_LilycoveMuseum_1F_EventScript_Greeter"), - NpcDef( - entityIdx = 2, - graphicsId = 38, - x = 13, - y = 7, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 3, - script = "LilycoveCity_LilycoveMuseum_1F_EventScript_SchoolKidM"), - NpcDef( - entityIdx = 3, - graphicsId = 0, - x = 13, - y = 10, - elevation = 3, - movementType = 5, - movementRangeX = 2, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "LilycoveCity_LilycoveMuseum_1F_EventScript_Artist1"), - NpcDef( - entityIdx = 4, - graphicsId = 5, - x = 2, - y = 8, - elevation = 3, - movementType = 7, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 1, - script = "LilycoveCity_LilycoveMuseum_1F_EventScript_NinjaBoy"), - NpcDef( - entityIdx = 5, - graphicsId = 26, - x = 3, - y = 8, - elevation = 3, - movementType = 7, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 1, - script = "LilycoveCity_LilycoveMuseum_1F_EventScript_Woman1"), - ), - bgEvents = - listOf( - BgEventDef( - x = 1, - y = 1, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "LilycoveCity_LilycoveMuseum_1F_EventScript_FantasyPainting"), - BgEventDef( - x = 2, - y = 1, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "LilycoveCity_LilycoveMuseum_1F_EventScript_FantasyPainting"), - BgEventDef( - x = 5, - y = 1, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "LilycoveCity_LilycoveMuseum_1F_EventScript_BerryPainting"), - BgEventDef( - x = 6, - y = 1, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "LilycoveCity_LilycoveMuseum_1F_EventScript_BerryPainting"), - BgEventDef( - x = 9, - y = 1, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "LilycoveCity_LilycoveMuseum_1F_EventScript_OldPainting"), - BgEventDef( - x = 3, - y = 6, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "LilycoveCity_LilycoveMuseum_1F_EventScript_WomanPainting"), - BgEventDef( - x = 2, - y = 6, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "LilycoveCity_LilycoveMuseum_1F_EventScript_WomanPainting"), - BgEventDef( - x = 15, - y = 12, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "LilycoveCity_LilycoveMuseum_EventScript_BirdSculpture"), - BgEventDef( - x = 11, - y = 1, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "LilycoveCity_LilycoveMuseum_1F_EventScript_OldPainting"), - BgEventDef( - x = 6, - y = 6, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = - "LilycoveCity_LilycoveMuseum_1F_EventScript_GrassPokemonPainting"), - BgEventDef( - x = 17, - y = 9, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "LilycoveCity_LilycoveMuseum_1F_EventScript_StoneTablet"), - BgEventDef( - x = 19, - y = 1, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = - "LilycoveCity_LilycoveMuseum_1F_EventScript_LegendaryPokemonPainting"), - BgEventDef( - x = 20, - y = 1, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = - "LilycoveCity_LilycoveMuseum_1F_EventScript_LegendaryPokemonPainting"), - BgEventDef( - x = 18, - y = 9, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "LilycoveCity_LilycoveMuseum_1F_EventScript_StoneTablet"), - BgEventDef( - x = 18, - y = 11, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = - "LilycoveCity_LilycoveMuseum_1F_EventScript_PokeBallSculpture"), - BgEventDef( - x = 16, - y = 9, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "LilycoveCity_LilycoveMuseum_1F_EventScript_StoneTablet"), - ), - ), - // LilycoveCity_LilycoveMuseum_2F (MAP_LILYCOVE_CITY_LILYCOVE_MUSEUM_2F) - MapDef( - regionId = 1, - bankId = 63, - mapId = 3, - width = 22, - height = 13, - paletteIdx1 = 116, - paletteIdx2 = 141, - unknownShort = 373, - unknownByte = 12, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 13, - y = 1, - elevation = 0, - targetRegionId = 1, - targetBankId = 63, - targetMapId = 2, - targetX = 16, - targetY = 1, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 48, - x = 10, - y = 8, - elevation = 3, - movementType = 7, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 1, - script = "LilycoveCity_LilycoveMuseum_2F_EventScript_Curator"), - ), - bgEvents = - listOf( - BgEventDef( - x = 14, - y = 10, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "LilycoveCity_LilycoveMuseum_2F_EventScript_CutePainting"), - BgEventDef( - x = 15, - y = 10, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "LilycoveCity_LilycoveMuseum_2F_EventScript_CutePainting"), - BgEventDef( - x = 3, - y = 6, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "LilycoveCity_LilycoveMuseum_2F_EventScript_ToughPainting"), - BgEventDef( - x = 2, - y = 6, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "LilycoveCity_LilycoveMuseum_2F_EventScript_ToughPainting"), - BgEventDef( - x = 10, - y = 6, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "LilycoveCity_LilycoveMuseum_2F_EventScript_CoolPainting"), - BgEventDef( - x = 11, - y = 6, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "LilycoveCity_LilycoveMuseum_2F_EventScript_CoolPainting"), - BgEventDef( - x = 19, - y = 6, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "LilycoveCity_LilycoveMuseum_2F_EventScript_BeautyPainting"), - BgEventDef( - x = 18, - y = 6, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "LilycoveCity_LilycoveMuseum_2F_EventScript_BeautyPainting"), - BgEventDef( - x = 6, - y = 10, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "LilycoveCity_LilycoveMuseum_2F_EventScript_SmartPainting"), - BgEventDef( - x = 7, - y = 10, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "LilycoveCity_LilycoveMuseum_2F_EventScript_SmartPainting"), - BgEventDef( - x = 11, - y = 2, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "LilycoveCity_LilycoveMuseum_EventScript_BirdSculpture"), - BgEventDef( - x = 15, - y = 2, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "LilycoveCity_LilycoveMuseum_EventScript_BirdSculpture"), - ), - ), - // LilycoveCity_ContestLobby (MAP_LILYCOVE_CITY_CONTEST_LOBBY) - MapDef( - regionId = 1, - bankId = 63, - mapId = 4, - width = 31, - height = 12, - paletteIdx1 = 116, - paletteIdx2 = 140, - unknownShort = 452, - unknownByte = 12, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 14, - y = 11, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 5, - targetX = 23, - targetY = 24, - targetElevation = 0), - WarpTile( - x = 15, - y = 11, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 5, - targetX = 23, - targetY = 24, - targetElevation = 0), - WarpTile( - x = 9, - y = 1, - elevation = 0, - targetRegionId = 1, - targetBankId = 63, - targetMapId = 5, - targetX = 19, - targetY = 32, - targetElevation = 0), - WarpTile( - x = 21, - y = 1, - elevation = 0, - targetRegionId = 1, - targetBankId = 63, - targetMapId = 5, - targetX = 30, - targetY = 32, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 0, - x = 14, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "LilycoveCity_ContestLobby_EventScript_ContestReceptionist"), - NpcDef( - entityIdx = 1, - graphicsId = 0, - x = 15, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = - "LilycoveCity_ContestLobby_EventScript_LinkContestReceptionist"), - NpcDef( - entityIdx = 2, - graphicsId = 65, - x = 26, - y = 9, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 3, - script = "BerryBlender_EventScript_Blender2Man"), - NpcDef( - entityIdx = 4, - graphicsId = 44, - x = 18, - y = 8, - elevation = 3, - movementType = 2, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "LilycoveCity_ContestLobby_EventScript_BlackBelt"), - NpcDef( - entityIdx = 5, - graphicsId = 10, - x = 4, - y = 9, - elevation = 3, - movementType = 2, - movementRangeX = 2, - movementRangeY = 2, - trainerType = 0, - facing = 0, - script = "LilycoveCity_ContestLobby_EventScript_Girl"), - NpcDef( - entityIdx = 6, - graphicsId = 0, - x = 3, - y = 4, - elevation = 3, - movementType = 2, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "LilycoveCity_ContestLobby_EventScript_Artist"), - NpcDef( - entityIdx = 8, - graphicsId = 7, - x = 23, - y = 8, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "LilycoveCity_ContestLobby_EventScript_Blender3Boy"), - NpcDef( - entityIdx = 9, - graphicsId = 6, - x = 28, - y = 9, - elevation = 3, - movementType = 9, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 2, - script = "BerryBlender_EventScript_Blender2Twin"), - NpcDef( - entityIdx = 11, - graphicsId = 50, - x = 5, - y = 6, - elevation = 3, - movementType = 2, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "LilycoveCity_ContestLobby_EventScript_Fisherman"), - NpcDef( - entityIdx = 12, - graphicsId = 17, - x = 0, - y = 8, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 3, - script = "LilycoveCity_ContestLobby_EventScript_FatMan"), - NpcDef( - entityIdx = 13, - graphicsId = 5, - x = 8, - y = 7, - elevation = 3, - movementType = 3, - movementRangeX = 0, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "LilycoveCity_ContestLobby_EventScript_NinjaBoy"), - NpcDef( - entityIdx = 14, - graphicsId = 18, - x = 22, - y = 9, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 3, - script = "BerryBlender_EventScript_Blender3PokefanF"), - NpcDef( - entityIdx = 16, - graphicsId = 8, - x = 24, - y = 9, - elevation = 3, - movementType = 9, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 2, - script = "LilycoveCity_ContestLobby_EventScript_Blender3Girl"), - NpcDef( - entityIdx = 24, - graphicsId = 12, - x = 9, - y = 10, - elevation = 3, - movementType = 10, - movementRangeX = 2, - movementRangeY = 2, - trainerType = 0, - facing = 3, - script = "LilycoveCity_ContestLobby_EventScript_LittleGirl"), - ), - bgEvents = - listOf( - BgEventDef( - x = 23, - y = 5, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "BerryBlender_EventScript_BerryBlenderLink"), - BgEventDef( - x = 23, - y = 9, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "BerryBlender_EventScript_BerryBlender3"), - BgEventDef( - x = 23, - y = 1, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "LilycoveCity_ContestLobby_EventScript_ContestWinner4"), - BgEventDef( - x = 25, - y = 1, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "LilycoveCity_ContestLobby_EventScript_ContestWinner5"), - BgEventDef( - x = 27, - y = 1, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "LilycoveCity_ContestLobby_EventScript_ContestWinner6"), - BgEventDef( - x = 30, - y = 1, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = - "LilycoveCity_ContestLobby_EventScript_BerryBlenderSpeedRecords"), - BgEventDef( - x = 3, - y = 1, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "LilycoveCity_ContestLobby_EventScript_ContestWinner1"), - BgEventDef( - x = 5, - y = 1, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "LilycoveCity_ContestLobby_EventScript_ContestWinner2"), - BgEventDef( - x = 7, - y = 1, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "LilycoveCity_ContestLobby_EventScript_ContestWinner3"), - BgEventDef( - x = 27, - y = 5, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "BerryBlender_EventScript_BerryBlender1"), - BgEventDef( - x = 27, - y = 9, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "BerryBlender_EventScript_BerryBlender2"), - BgEventDef( - x = 18, - y = 3, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "LilycoveCity_ContestLobby_EventScript_LinkContestResults"), - ), - ), - // LilycoveCity_ContestHall (MAP_LILYCOVE_CITY_CONTEST_HALL) - MapDef( - regionId = 1, - bankId = 63, - mapId = 5, - width = 51, - height = 33, - paletteIdx1 = 116, - paletteIdx2 = 140, - unknownShort = 452, - unknownByte = 12, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 19, - y = 32, - elevation = 0, - targetRegionId = 1, - targetBankId = 63, - targetMapId = 4, - targetX = 9, - targetY = 1, - targetElevation = 0), - WarpTile( - x = 30, - y = 32, - elevation = 0, - targetRegionId = 1, - targetBankId = 63, - targetMapId = 4, - targetX = 21, - targetY = 1, - targetElevation = 0), - WarpTile( - x = 20, - y = 32, - elevation = 0, - targetRegionId = 1, - targetBankId = 63, - targetMapId = 4, - targetX = 9, - targetY = 1, - targetElevation = 0), - WarpTile( - x = 31, - y = 32, - elevation = 0, - targetRegionId = 1, - targetBankId = 63, - targetMapId = 4, - targetX = 21, - targetY = 1, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 7, - x = 30, - y = 30, - elevation = 3, - movementType = 2, - movementRangeX = 4, - movementRangeY = 4, - trainerType = 0, - facing = 0, - script = "LilycoveCity_ContestHall_EventScript_Boy1"), - NpcDef( - entityIdx = 1, - graphicsId = 13, - x = 11, - y = 7, - elevation = 3, - movementType = 2, - movementRangeX = 3, - movementRangeY = 3, - trainerType = 0, - facing = 0, - script = "LilycoveCity_ContestHall_EventScript_Boy2"), - NpcDef( - entityIdx = 2, - graphicsId = 14, - x = 40, - y = 8, - elevation = 3, - movementType = 2, - movementRangeX = 2, - movementRangeY = 2, - trainerType = 0, - facing = 0, - script = "LilycoveCity_ContestHall_EventScript_Girl"), - NpcDef( - entityIdx = 3, - graphicsId = 24, - x = 12, - y = 22, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "LilycoveCity_ContestHall_EventScript_SmartContestMC"), - NpcDef( - entityIdx = 4, - graphicsId = 0, - x = 15, - y = 22, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "LilycoveCity_ContestHall_EventScript_SmartContestJudge"), - NpcDef( - entityIdx = 5, - graphicsId = 44, - x = 10, - y = 25, - elevation = 3, - movementType = 7, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 1, - script = "LilycoveCity_ContestHall_EventScript_SmartContestant1"), - NpcDef( - entityIdx = 6, - graphicsId = 21, - x = 12, - y = 25, - elevation = 3, - movementType = 7, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 1, - script = "LilycoveCity_ContestHall_EventScript_SmartContestant2"), - NpcDef( - entityIdx = 7, - graphicsId = 39, - x = 14, - y = 25, - elevation = 3, - movementType = 7, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 1, - script = "LilycoveCity_ContestHall_EventScript_SmartContestant3"), - NpcDef( - entityIdx = 8, - graphicsId = 28, - x = 16, - y = 25, - elevation = 3, - movementType = 7, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 1, - script = "LilycoveCity_ContestHall_EventScript_SmartContestant4"), - NpcDef( - entityIdx = 9, - graphicsId = 22, - x = 8, - y = 24, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 3, - script = "LilycoveCity_ContestHall_EventScript_SmartContestAudience1"), - NpcDef( - entityIdx = 10, - graphicsId = 34, - x = 18, - y = 24, - elevation = 3, - movementType = 9, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 2, - script = "LilycoveCity_ContestHall_EventScript_SmartContestAudience4"), - NpcDef( - entityIdx = 11, - graphicsId = 7, - x = 8, - y = 22, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 3, - script = "LilycoveCity_ContestHall_EventScript_SmartContestAudience2"), - NpcDef( - entityIdx = 12, - graphicsId = 24, - x = 24, - y = 10, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "LilycoveCity_ContestHall_EventScript_BeautyContestMC"), - NpcDef( - entityIdx = 13, - graphicsId = 0, - x = 27, - y = 10, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "LilycoveCity_ContestHall_EventScript_BeautyContestJudge"), - NpcDef( - entityIdx = 14, - graphicsId = 26, - x = 22, - y = 13, - elevation = 3, - movementType = 7, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 1, - script = "LilycoveCity_ContestHall_EventScript_BeautyContestant1"), - NpcDef( - entityIdx = 15, - graphicsId = 6, - x = 24, - y = 13, - elevation = 3, - movementType = 7, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 1, - script = "LilycoveCity_ContestHall_EventScript_BeautyContestant2"), - NpcDef( - entityIdx = 16, - graphicsId = 37, - x = 26, - y = 13, - elevation = 3, - movementType = 7, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 1, - script = "LilycoveCity_ContestHall_EventScript_BeautyContestant3"), - NpcDef( - entityIdx = 17, - graphicsId = 18, - x = 28, - y = 13, - elevation = 3, - movementType = 7, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 1, - script = "LilycoveCity_ContestHall_EventScript_BeautyContestant4"), - NpcDef( - entityIdx = 18, - graphicsId = 20, - x = 20, - y = 10, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 3, - script = "LilycoveCity_ContestHall_EventScript_BeautyContestAudience1"), - NpcDef( - entityIdx = 19, - graphicsId = 16, - x = 30, - y = 11, - elevation = 3, - movementType = 9, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 2, - script = "LilycoveCity_ContestHall_EventScript_BeautyContestAudience3"), - NpcDef( - entityIdx = 20, - graphicsId = 19, - x = 26, - y = 8, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "LilycoveCity_ContestHall_EventScript_BeautyContestAudience2"), - NpcDef( - entityIdx = 21, - graphicsId = 31, - x = 13, - y = 20, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "LilycoveCity_ContestHall_EventScript_SmartContestAudience3"), - NpcDef( - entityIdx = 22, - graphicsId = 24, - x = 36, - y = 22, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "LilycoveCity_ContestHall_EventScript_CuteContestMC"), - NpcDef( - entityIdx = 23, - graphicsId = 0, - x = 39, - y = 22, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "LilycoveCity_ContestHall_EventScript_CuteContestJudge"), - NpcDef( - entityIdx = 24, - graphicsId = 9, - x = 34, - y = 25, - elevation = 3, - movementType = 7, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 1, - script = "LilycoveCity_ContestHall_EventScript_CuteContestant1"), - NpcDef( - entityIdx = 25, - graphicsId = 10, - x = 36, - y = 25, - elevation = 3, - movementType = 7, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 1, - script = "LilycoveCity_ContestHall_EventScript_CuteContestant2"), - NpcDef( - entityIdx = 26, - graphicsId = 13, - x = 38, - y = 25, - elevation = 3, - movementType = 7, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 1, - script = "LilycoveCity_ContestHall_EventScript_CuteContestant3"), - NpcDef( - entityIdx = 27, - graphicsId = 22, - x = 40, - y = 25, - elevation = 3, - movementType = 7, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 1, - script = "LilycoveCity_ContestHall_EventScript_CuteContestant4"), - NpcDef( - entityIdx = 28, - graphicsId = 20, - x = 32, - y = 23, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 3, - script = "LilycoveCity_ContestHall_EventScript_CuteContestAudience1"), - NpcDef( - entityIdx = 29, - graphicsId = 19, - x = 37, - y = 20, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "LilycoveCity_ContestHall_EventScript_CuteContestAudience3"), - NpcDef( - entityIdx = 30, - graphicsId = 12, - x = 42, - y = 24, - elevation = 3, - movementType = 9, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 2, - script = "LilycoveCity_ContestHall_EventScript_CuteContestAudience2"), - NpcDef( - entityIdx = 31, - graphicsId = 49, - x = 23, - y = 26, - elevation = 3, - movementType = 2, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "LilycoveCity_ContestHall_EventScript_Sailor"), - ), - bgEvents = - listOf( - BgEventDef( - x = 27, - y = 16, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "LilycoveCity_ContestHall_EventScript_BeautyStageSign"), - BgEventDef( - x = 39, - y = 28, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "LilycoveCity_ContestHall_EventScript_CuteStageSign"), - BgEventDef( - x = 11, - y = 28, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "LilycoveCity_ContestHall_EventScript_SmartStageSign"), - BgEventDef( - x = 15, - y = 28, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "LilycoveCity_ContestHall_EventScript_SmartStageSign"), - BgEventDef( - x = 23, - y = 16, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "LilycoveCity_ContestHall_EventScript_BeautyStageSign"), - BgEventDef( - x = 35, - y = 28, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "LilycoveCity_ContestHall_EventScript_CuteStageSign"), - ), - ), - // LilycoveCity_PokemonCenter_1F (MAP_LILYCOVE_CITY_POKEMON_CENTER_1F) - MapDef( - regionId = 1, - bankId = 63, - mapId = 6, - width = 14, - height = 9, - paletteIdx1 = 116, - paletteIdx2 = 118, - unknownShort = 400, - unknownByte = 12, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 7, - y = 8, - elevation = 2, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 5, - targetX = 24, - targetY = 14, - targetElevation = 0), - WarpTile( - x = 6, - y = 8, - elevation = 2, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 5, - targetX = 24, - targetY = 14, - targetElevation = 0), - WarpTile( - x = 1, - y = 6, - elevation = 3, - targetRegionId = 1, - targetBankId = 63, - targetMapId = 7, - targetX = 1, - targetY = 6, - targetElevation = 3), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 58, - x = 7, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "LilycoveCity_PokemonCenter_1F_EventScript_Nurse"), - NpcDef( - entityIdx = 1, - graphicsId = 7, - x = 10, - y = 7, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 3, - script = "LilycoveCity_PokemonCenter_1F_EventScript_Boy"), - NpcDef( - entityIdx = 2, - graphicsId = 39, - x = 11, - y = 8, - elevation = 3, - movementType = 7, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 1, - script = "LilycoveCity_PokemonCenter_1F_EventScript_Maniac"), - NpcDef( - entityIdx = 3, - graphicsId = 240, - x = 1, - y = 3, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "LilycoveCity_PokemonCenter_1F_EventScript_LilycoveLady"), - ), - bgEvents = emptyList(), - ), - // LilycoveCity_PokemonCenter_2F (MAP_LILYCOVE_CITY_POKEMON_CENTER_2F) - MapDef( - regionId = 1, - bankId = 63, - mapId = 7, - width = 14, - height = 10, - paletteIdx1 = 116, - paletteIdx2 = 118, - unknownShort = 400, - unknownByte = 12, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 1, - y = 6, - elevation = 3, - targetRegionId = 1, - targetBankId = 63, - targetMapId = 6, - targetX = 1, - targetY = 6, - targetElevation = 3), - WarpTile( - x = 5, - y = 1, - elevation = 2, - targetRegionId = 1, - targetBankId = 75, - targetMapId = 60, - targetX = 7, - targetY = 11, - targetElevation = 2), - WarpTile( - x = 9, - y = 1, - elevation = 2, - targetRegionId = 1, - targetBankId = 75, - targetMapId = 25, - targetX = 5, - targetY = 8, - targetElevation = 2), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 0, - x = 6, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "Common_EventScript_UnionRoomAttendant"), - NpcDef( - entityIdx = 1, - graphicsId = 0, - x = 2, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "Common_EventScript_WirelessClubAttendant"), - NpcDef( - entityIdx = 2, - graphicsId = 0, - x = 10, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "Common_EventScript_DirectCornerAttendant"), - ), - bgEvents = emptyList(), - ), - // LilycoveCity_UnusedMart (MAP_LILYCOVE_CITY_UNUSED_MART) - MapDef( - regionId = 1, - bankId = 63, - mapId = 8, - width = 11, - height = 8, - paletteIdx1 = 116, - paletteIdx2 = 117, - unknownShort = 404, - unknownByte = 12, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 3, - y = 7, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 5, - targetX = 27, - targetY = 6, - targetElevation = 0), - WarpTile( - x = 4, - y = 7, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 5, - targetX = 27, - targetY = 6, - targetElevation = 0), - ), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // LilycoveCity_PokemonTrainerFanClub (MAP_LILYCOVE_CITY_POKEMON_TRAINER_FAN_CLUB) - MapDef( - regionId = 1, - bankId = 63, - mapId = 9, - width = 12, - height = 14, - paletteIdx1 = 116, - paletteIdx2 = 147, - unknownShort = 408, - unknownByte = 12, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 6, - y = 13, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 5, - targetX = 39, - targetY = 14, - targetElevation = 0), - WarpTile( - x = 5, - y = 13, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 5, - targetX = 39, - targetY = 14, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 47, - x = 3, - y = 11, - elevation = 3, - movementType = 7, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 1, - script = "LilycoveCity_PokemonTrainerFanClub_EventScript_Lass"), - NpcDef( - entityIdx = 1, - graphicsId = 65, - x = 8, - y = 10, - elevation = 3, - movementType = 9, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 2, - script = "LilycoveCity_PokemonTrainerFanClub_EventScript_Man"), - NpcDef( - entityIdx = 2, - graphicsId = 25, - x = 6, - y = 11, - elevation = 3, - movementType = 7, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 1, - script = "LilycoveCity_PokemonTrainerFanClub_EventScript_PokefanM"), - NpcDef( - entityIdx = 3, - graphicsId = 12, - x = 5, - y = 8, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "LilycoveCity_PokemonTrainerFanClub_EventScript_LittleGirl"), - ), - bgEvents = emptyList(), - ), - // LilycoveCity_Harbor (MAP_LILYCOVE_CITY_HARBOR) - MapDef( - regionId = 1, - bankId = 63, - mapId = 10, - width = 24, - height = 15, - paletteIdx1 = 100, - paletteIdx2 = 129, - unknownShort = 408, - unknownByte = 12, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 11, - y = 14, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 5, - targetX = 12, - targetY = 32, - targetElevation = 0), - WarpTile( - x = 12, - y = 14, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 5, - targetX = 12, - targetY = 32, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 2, - graphicsId = 49, - x = 3, - y = 13, - elevation = 3, - movementType = 2, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "LilycoveCity_Harbor_EventScript_Sailor"), - ), - bgEvents = emptyList(), - ), - // LilycoveCity_MoveDeletersHouse (MAP_LILYCOVE_CITY_MOVE_DELETERS_HOUSE) - MapDef( - regionId = 1, - bankId = 63, - mapId = 11, - width = 11, - height = 8, - paletteIdx1 = 116, - paletteIdx2 = 147, - unknownShort = 408, - unknownByte = 12, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 3, - y = 7, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 5, - targetX = 36, - targetY = 6, - targetElevation = 0), - WarpTile( - x = 4, - y = 7, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 5, - targetX = 36, - targetY = 6, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 21, - x = 4, - y = 4, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "LilycoveCity_MoveDeletersHouse_EventScript_MoveDeleter"), - ), - bgEvents = emptyList(), - ), - // LilycoveCity_House1 (MAP_LILYCOVE_CITY_HOUSE1) - MapDef( - regionId = 1, - bankId = 63, - mapId = 12, - width = 10, - height = 9, - paletteIdx1 = 116, - paletteIdx2 = 147, - unknownShort = 408, - unknownByte = 12, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 3, - y = 8, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 5, - targetX = 42, - targetY = 6, - targetElevation = 0), - WarpTile( - x = 4, - y = 8, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 5, - targetX = 42, - targetY = 6, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 21, - x = 4, - y = 5, - elevation = 3, - movementType = 9, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 2, - script = "LilycoveCity_House1_EventScript_ExpertM"), - NpcDef( - entityIdx = 1, - graphicsId = 0, - x = 4, - y = 4, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "LilycoveCity_House1_EventScript_Kecleon"), - ), - bgEvents = emptyList(), - ), - // LilycoveCity_House2 (MAP_LILYCOVE_CITY_HOUSE2) - MapDef( - regionId = 1, - bankId = 63, - mapId = 13, - width = 8, - height = 8, - paletteIdx1 = 116, - paletteIdx2 = 147, - unknownShort = 408, - unknownByte = 12, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 2, - y = 7, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 5, - targetX = 55, - targetY = 15, - targetElevation = 0), - WarpTile( - x = 3, - y = 7, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 5, - targetX = 55, - targetY = 15, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 17, - x = 0, - y = 4, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "LilycoveCity_House2_EventScript_FatMan"), - ), - bgEvents = emptyList(), - ), - // LilycoveCity_House3 (MAP_LILYCOVE_CITY_HOUSE3) - MapDef( - regionId = 1, - bankId = 63, - mapId = 14, - width = 11, - height = 8, - paletteIdx1 = 116, - paletteIdx2 = 147, - unknownShort = 408, - unknownByte = 12, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 3, - y = 7, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 5, - targetX = 11, - targetY = 22, - targetElevation = 0), - WarpTile( - x = 4, - y = 7, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 5, - targetX = 11, - targetY = 22, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 0, - x = 3, - y = 4, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "LilycoveCity_House3_EventScript_GameBoyKid4"), - NpcDef( - entityIdx = 1, - graphicsId = 18, - x = 7, - y = 4, - elevation = 3, - movementType = 9, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 2, - script = "LilycoveCity_House3_EventScript_PokefanF"), - NpcDef( - entityIdx = 2, - graphicsId = 0, - x = 1, - y = 4, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "LilycoveCity_House3_EventScript_GameBoyKid2"), - NpcDef( - entityIdx = 3, - graphicsId = 0, - x = 2, - y = 5, - elevation = 3, - movementType = 7, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 1, - script = "LilycoveCity_House3_EventScript_GameBoyKid3"), - NpcDef( - entityIdx = 4, - graphicsId = 0, - x = 2, - y = 3, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "LilycoveCity_House3_EventScript_GameBoyKid1"), - NpcDef( - entityIdx = 5, - graphicsId = 19, - x = 7, - y = 5, - elevation = 3, - movementType = 9, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 2, - script = "LilycoveCity_House3_EventScript_Man"), - ), - bgEvents = emptyList(), - ), - // LilycoveCity_House4 (MAP_LILYCOVE_CITY_HOUSE4) - MapDef( - regionId = 1, - bankId = 63, - mapId = 15, - width = 10, - height = 9, - paletteIdx1 = 116, - paletteIdx2 = 147, - unknownShort = 408, - unknownByte = 12, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 3, - y = 8, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 5, - targetX = 12, - targetY = 14, - targetElevation = 0), - WarpTile( - x = 4, - y = 8, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 5, - targetX = 12, - targetY = 14, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 65, - x = 1, - y = 4, - elevation = 3, - movementType = 2, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "LilycoveCity_House4_EventScript_Man1"), - NpcDef( - entityIdx = 1, - graphicsId = 19, - x = 7, - y = 4, - elevation = 3, - movementType = 2, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "LilycoveCity_House4_EventScript_Man2"), - ), - bgEvents = emptyList(), - ), - // LilycoveCity_DepartmentStore_1F (MAP_LILYCOVE_CITY_DEPARTMENT_STORE_1F) - MapDef( - regionId = 1, - bankId = 63, - mapId = 16, - width = 18, - height = 8, - paletteIdx1 = 116, - paletteIdx2 = 117, - unknownShort = 408, - unknownByte = 12, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 8, - y = 7, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 5, - targetX = 27, - targetY = 6, - targetElevation = 0), - WarpTile( - x = 9, - y = 7, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 5, - targetX = 27, - targetY = 6, - targetElevation = 0), - WarpTile( - x = 16, - y = 1, - elevation = 0, - targetRegionId = 1, - targetBankId = 63, - targetMapId = 17, - targetX = 16, - targetY = 1, - targetElevation = 0), - WarpTile( - x = 2, - y = 1, - elevation = 0, - targetRegionId = 1, - targetBankId = 63, - targetMapId = 22, - targetX = 1, - targetY = 5, - targetElevation = 2), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 45, - x = 8, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "LilycoveCity_DepartmentStore_1F_EventScript_Greeter"), - NpcDef( - entityIdx = 1, - graphicsId = 45, - x = 10, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "LilycoveCity_DepartmentStore_1F_EventScript_LotteryClerk"), - NpcDef( - entityIdx = 2, - graphicsId = 18, - x = 14, - y = 5, - elevation = 3, - movementType = 2, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "LilycoveCity_DepartmentStore_1F_EventScript_PokefanF"), - NpcDef( - entityIdx = 3, - graphicsId = 12, - x = 4, - y = 4, - elevation = 3, - movementType = 2, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "LilycoveCity_DepartmentStore_1F_EventScript_LittleGirl"), - NpcDef( - entityIdx = 4, - graphicsId = 25, - x = 3, - y = 6, - elevation = 3, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "LilycoveCity_DepartmentStore_1F_EventScript_PokefanM"), - NpcDef( - entityIdx = 5, - graphicsId = 0, - x = 2, - y = 6, - elevation = 3, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "LilycoveCity_DepartmentStore_1F_EventScript_Azumarill"), - ), - bgEvents = - listOf( - BgEventDef( - x = 0, - y = 8, - facingDir = "BG_EVENT_PLAYER_FACING_NORTH", - script = "LilycoveCity_DepartmentStore_1F_EventScript_FloorNamesSign"), - ), - ), - // LilycoveCity_DepartmentStore_2F (MAP_LILYCOVE_CITY_DEPARTMENT_STORE_2F) - MapDef( - regionId = 1, - bankId = 63, - mapId = 17, - width = 18, - height = 8, - paletteIdx1 = 116, - paletteIdx2 = 117, - unknownShort = 404, - unknownByte = 12, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 16, - y = 1, - elevation = 0, - targetRegionId = 1, - targetBankId = 63, - targetMapId = 16, - targetX = 16, - targetY = 1, - targetElevation = 0), - WarpTile( - x = 13, - y = 1, - elevation = 0, - targetRegionId = 1, - targetBankId = 63, - targetMapId = 18, - targetX = 13, - targetY = 1, - targetElevation = 0), - WarpTile( - x = 2, - y = 1, - elevation = 0, - targetRegionId = 1, - targetBankId = 63, - targetMapId = 22, - targetX = 1, - targetY = 5, - targetElevation = 2), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 27, - x = 8, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "LilycoveCity_DepartmentStore_2F_EventScript_Cook"), - NpcDef( - entityIdx = 1, - graphicsId = 18, - x = 0, - y = 5, - elevation = 3, - movementType = 2, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "LilycoveCity_DepartmentStore_2F_EventScript_PokefanF"), - NpcDef( - entityIdx = 2, - graphicsId = 49, - x = 13, - y = 5, - elevation = 3, - movementType = 2, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "LilycoveCity_DepartmentStore_2F_EventScript_Sailor"), - NpcDef( - entityIdx = 3, - graphicsId = 24, - x = 10, - y = 6, - elevation = 3, - movementType = 7, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 1, - script = "LilycoveCity_DepartmentStore_2F_EventScript_ClerkRight"), - NpcDef( - entityIdx = 4, - graphicsId = 24, - x = 7, - y = 6, - elevation = 3, - movementType = 7, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 1, - script = "LilycoveCity_DepartmentStore_2F_EventScript_ClerkLeft"), - ), - bgEvents = emptyList(), - ), - // LilycoveCity_DepartmentStore_3F (MAP_LILYCOVE_CITY_DEPARTMENT_STORE_3F) - MapDef( - regionId = 1, - bankId = 63, - mapId = 18, - width = 18, - height = 8, - paletteIdx1 = 116, - paletteIdx2 = 117, - unknownShort = 404, - unknownByte = 12, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 13, - y = 1, - elevation = 0, - targetRegionId = 1, - targetBankId = 63, - targetMapId = 17, - targetX = 13, - targetY = 1, - targetElevation = 0), - WarpTile( - x = 16, - y = 1, - elevation = 0, - targetRegionId = 1, - targetBankId = 63, - targetMapId = 19, - targetX = 16, - targetY = 1, - targetElevation = 0), - WarpTile( - x = 2, - y = 1, - elevation = 0, - targetRegionId = 1, - targetBankId = 63, - targetMapId = 22, - targetX = 1, - targetY = 5, - targetElevation = 2), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 51, - x = 0, - y = 5, - elevation = 3, - movementType = 2, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "LilycoveCity_DepartmentStore_3F_EventScript_TriathleteM"), - NpcDef( - entityIdx = 1, - graphicsId = 25, - x = 7, - y = 7, - elevation = 3, - movementType = 2, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "LilycoveCity_DepartmentStore_3F_EventScript_PokefanM"), - NpcDef( - entityIdx = 2, - graphicsId = 34, - x = 13, - y = 5, - elevation = 3, - movementType = 2, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "LilycoveCity_DepartmentStore_3F_EventScript_Woman"), - NpcDef( - entityIdx = 3, - graphicsId = 24, - x = 8, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "LilycoveCity_DepartmentStore_3F_EventScript_ClerkLeft"), - NpcDef( - entityIdx = 4, - graphicsId = 24, - x = 10, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "LilycoveCity_DepartmentStore_3F_EventScript_ClerkRight"), - ), - bgEvents = emptyList(), - ), - // LilycoveCity_DepartmentStore_4F (MAP_LILYCOVE_CITY_DEPARTMENT_STORE_4F) - MapDef( - regionId = 1, - bankId = 63, - mapId = 19, - width = 18, - height = 8, - paletteIdx1 = 116, - paletteIdx2 = 117, - unknownShort = 404, - unknownByte = 12, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 16, - y = 1, - elevation = 0, - targetRegionId = 1, - targetBankId = 63, - targetMapId = 18, - targetX = 16, - targetY = 1, - targetElevation = 0), - WarpTile( - x = 13, - y = 1, - elevation = 0, - targetRegionId = 1, - targetBankId = 63, - targetMapId = 20, - targetX = 13, - targetY = 1, - targetElevation = 0), - WarpTile( - x = 2, - y = 1, - elevation = 0, - targetRegionId = 1, - targetBankId = 63, - targetMapId = 22, - targetX = 1, - targetY = 5, - targetElevation = 2), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 48, - x = 0, - y = 2, - elevation = 3, - movementType = 2, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "LilycoveCity_DepartmentStore_4F_EventScript_Gentleman"), - NpcDef( - entityIdx = 1, - graphicsId = 20, - x = 6, - y = 2, - elevation = 3, - movementType = 2, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "LilycoveCity_DepartmentStore_4F_EventScript_Woman"), - NpcDef( - entityIdx = 2, - graphicsId = 35, - x = 13, - y = 4, - elevation = 3, - movementType = 2, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "LilycoveCity_DepartmentStore_4F_EventScript_Youngster"), - NpcDef( - entityIdx = 3, - graphicsId = 24, - x = 7, - y = 6, - elevation = 3, - movementType = 7, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 1, - script = "LilycoveCity_DepartmentStore_4F_EventScript_ClerkLeft"), - NpcDef( - entityIdx = 4, - graphicsId = 24, - x = 9, - y = 6, - elevation = 3, - movementType = 7, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 1, - script = "LilycoveCity_DepartmentStore_4F_EventScript_ClerkRight"), - ), - bgEvents = emptyList(), - ), - ) - allMaps.forEach { registerMap(it) } - } - - private fun registerDefaultMaps3() { - val allMaps = - listOf( - // LilycoveCity_DepartmentStore_5F (MAP_LILYCOVE_CITY_DEPARTMENT_STORE_5F) - MapDef( - regionId = 1, - bankId = 63, - mapId = 20, - width = 18, - height = 8, - paletteIdx1 = 116, - paletteIdx2 = 117, - unknownShort = 404, - unknownByte = 12, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 13, - y = 1, - elevation = 0, - targetRegionId = 1, - targetBankId = 63, - targetMapId = 19, - targetX = 13, - targetY = 1, - targetElevation = 0), - WarpTile( - x = 2, - y = 1, - elevation = 0, - targetRegionId = 1, - targetBankId = 63, - targetMapId = 22, - targetX = 1, - targetY = 5, - targetElevation = 2), - WarpTile( - x = 16, - y = 1, - elevation = 0, - targetRegionId = 1, - targetBankId = 63, - targetMapId = 21, - targetX = 13, - targetY = 3, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 12, - x = 1, - y = 6, - elevation = 3, - movementType = 2, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "LilycoveCity_DepartmentStore_5F_EventScript_LittleGirl"), - NpcDef( - entityIdx = 1, - graphicsId = 18, - x = 7, - y = 7, - elevation = 3, - movementType = 17, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "LilycoveCity_DepartmentStore_5F_EventScript_PokefanF"), - NpcDef( - entityIdx = 2, - graphicsId = 24, - x = 7, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "LilycoveCity_DepartmentStore_5F_EventScript_ClerkFarLeft"), - NpcDef( - entityIdx = 3, - graphicsId = 24, - x = 9, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "LilycoveCity_DepartmentStore_5F_EventScript_ClerkMidLeft"), - NpcDef( - entityIdx = 4, - graphicsId = 24, - x = 15, - y = 6, - elevation = 3, - movementType = 9, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 2, - script = "LilycoveCity_DepartmentStore_5F_EventScript_ClerkMidRight"), - NpcDef( - entityIdx = 5, - graphicsId = 24, - x = 17, - y = 6, - elevation = 3, - movementType = 7, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 1, - script = "LilycoveCity_DepartmentStore_5F_EventScript_ClerkFarRight"), - NpcDef( - entityIdx = 6, - graphicsId = 20, - x = 9, - y = 5, - elevation = 3, - movementType = 10, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 3, - script = "LilycoveCity_DepartmentStore_5F_EventScript_Woman"), - ), - bgEvents = emptyList(), - ), - // LilycoveCity_DepartmentStoreRooftop (MAP_LILYCOVE_CITY_DEPARTMENT_STORE_ROOFTOP) - MapDef( - regionId = 1, - bankId = 63, - mapId = 21, - width = 18, - height = 12, - paletteIdx1 = 116, - paletteIdx2 = 117, - unknownShort = 408, - unknownByte = 12, - borderTiles = - listOf( - Tile2D(0x021F, 0), Tile2D(0x021F, 0), Tile2D(0x021F, 0), Tile2D(0x021F, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 13, - y = 3, - elevation = 0, - targetRegionId = 1, - targetBankId = 63, - targetMapId = 20, - targetX = 16, - targetY = 1, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 23, - x = 4, - y = 4, - elevation = 3, - movementType = 7, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 1, - script = "LilycoveCity_DepartmentStoreRooftop_EventScript_Man"), - NpcDef( - entityIdx = 1, - graphicsId = 33, - x = 7, - y = 5, - elevation = 3, - movementType = 5, - movementRangeX = 1, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "LilycoveCity_DepartmentStoreRooftop_EventScript_ThirstyMan"), - NpcDef( - entityIdx = 3, - graphicsId = 24, - x = 15, - y = 5, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = - "LilycoveCity_DepartmentStoreRooftop_EventScript_SubstituteTutor"), - ), - bgEvents = - listOf( - BgEventDef( - x = 9, - y = 1, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = - "LilycoveCity_DepartmentStoreRooftop_EventScript_VendingMachine"), - BgEventDef( - x = 10, - y = 1, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = - "LilycoveCity_DepartmentStoreRooftop_EventScript_VendingMachine"), - ), - ), - // LilycoveCity_DepartmentStoreElevator (MAP_LILYCOVE_CITY_DEPARTMENT_STORE_ELEVATOR) - MapDef( - regionId = 1, - bankId = 63, - mapId = 22, - width = 5, - height = 6, - paletteIdx1 = 116, - paletteIdx2 = 159, - unknownShort = 408, - unknownByte = 12, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = emptyList(), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 0, - x = 0, - y = 5, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "LilycoveCity_DepartmentStoreElevator_EventScript_Attendant"), - ), - bgEvents = emptyList(), - ), - // MossdeepCity_Gym (MAP_MOSSDEEP_CITY_GYM) - MapDef( - regionId = 1, - bankId = 64, - mapId = 0, - width = 26, - height = 36, - paletteIdx1 = 116, - paletteIdx2 = 155, - unknownShort = 364, - unknownByte = 13, - borderTiles = - listOf( - Tile2D(0x0208, 0), Tile2D(0x0208, 0), Tile2D(0x0208, 0), Tile2D(0x0208, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 6, - y = 35, - elevation = 2, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 6, - targetX = 38, - targetY = 9, - targetElevation = 0), - WarpTile( - x = 7, - y = 35, - elevation = 2, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 6, - targetX = 38, - targetY = 9, - targetElevation = 0), - WarpTile( - x = 3, - y = 28, - elevation = 0, - targetRegionId = 1, - targetBankId = 64, - targetMapId = 0, - targetX = 1, - targetY = 23, - targetElevation = 2), - WarpTile( - x = 1, - y = 23, - elevation = 2, - targetRegionId = 1, - targetBankId = 64, - targetMapId = 0, - targetX = 3, - targetY = 28, - targetElevation = 0), - WarpTile( - x = 7, - y = 18, - elevation = 0, - targetRegionId = 1, - targetBankId = 64, - targetMapId = 0, - targetX = 8, - targetY = 12, - targetElevation = 0), - WarpTile( - x = 8, - y = 12, - elevation = 0, - targetRegionId = 1, - targetBankId = 64, - targetMapId = 0, - targetX = 7, - targetY = 18, - targetElevation = 0), - WarpTile( - x = 9, - y = 18, - elevation = 0, - targetRegionId = 1, - targetBankId = 64, - targetMapId = 0, - targetX = 23, - targetY = 20, - targetElevation = 0), - WarpTile( - x = 23, - y = 20, - elevation = 0, - targetRegionId = 1, - targetBankId = 64, - targetMapId = 0, - targetX = 9, - targetY = 18, - targetElevation = 0), - WarpTile( - x = 1, - y = 33, - elevation = 2, - targetRegionId = 1, - targetBankId = 64, - targetMapId = 0, - targetX = 20, - targetY = 24, - targetElevation = 0), - WarpTile( - x = 20, - y = 24, - elevation = 0, - targetRegionId = 1, - targetBankId = 64, - targetMapId = 0, - targetX = 1, - targetY = 33, - targetElevation = 2), - WarpTile( - x = 11, - y = 3, - elevation = 0, - targetRegionId = 1, - targetBankId = 64, - targetMapId = 0, - targetX = 11, - targetY = 35, - targetElevation = 2), - WarpTile( - x = 11, - y = 35, - elevation = 2, - targetRegionId = 1, - targetBankId = 64, - targetMapId = 0, - targetX = 11, - targetY = 3, - targetElevation = 0), - WarpTile( - x = 13, - y = 32, - elevation = 0, - targetRegionId = 1, - targetBankId = 64, - targetMapId = 0, - targetX = 21, - targetY = 10, - targetElevation = 0), - WarpTile( - x = 21, - y = 10, - elevation = 0, - targetRegionId = 1, - targetBankId = 64, - targetMapId = 0, - targetX = 13, - targetY = 32, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 0, - x = 23, - y = 7, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "MossdeepCity_Gym_EventScript_TateAndLiza"), - NpcDef( - entityIdx = 1, - graphicsId = 37, - x = 1, - y = 30, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "MossdeepCity_Gym_EventScript_Preston"), - NpcDef( - entityIdx = 2, - graphicsId = 37, - x = 5, - y = 20, - elevation = 3, - movementType = 7, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 1, - script = "MossdeepCity_Gym_EventScript_Blake"), - NpcDef( - entityIdx = 3, - graphicsId = 47, - x = 4, - y = 29, - elevation = 3, - movementType = 7, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 1, - script = "MossdeepCity_Gym_EventScript_Maura"), - NpcDef( - entityIdx = 4, - graphicsId = 47, - x = 4, - y = 23, - elevation = 3, - movementType = 7, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 1, - script = "MossdeepCity_Gym_EventScript_Samantha"), - NpcDef( - entityIdx = 5, - graphicsId = 37, - x = 6, - y = 9, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "MossdeepCity_Gym_EventScript_Virgil"), - NpcDef( - entityIdx = 6, - graphicsId = 47, - x = 6, - y = 3, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "MossdeepCity_Gym_EventScript_Hannah"), - NpcDef( - entityIdx = 7, - graphicsId = 23, - x = 5, - y = 33, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "MossdeepCity_Gym_EventScript_GymGuide"), - NpcDef( - entityIdx = 8, - graphicsId = 0, - x = 24, - y = 7, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "MossdeepCity_Gym_EventScript_TateAndLiza"), - NpcDef( - entityIdx = 9, - graphicsId = 0, - x = 2, - y = 30, - elevation = 3, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "0x0"), - NpcDef( - entityIdx = 10, - graphicsId = 0, - x = 1, - y = 29, - elevation = 3, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "0x0"), - NpcDef( - entityIdx = 11, - graphicsId = 0, - x = 4, - y = 30, - elevation = 3, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "0x0"), - NpcDef( - entityIdx = 12, - graphicsId = 0, - x = 5, - y = 29, - elevation = 3, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "0x0"), - NpcDef( - entityIdx = 13, - graphicsId = 0, - x = 5, - y = 21, - elevation = 3, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "0x0"), - NpcDef( - entityIdx = 14, - graphicsId = 0, - x = 7, - y = 9, - elevation = 3, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "0x0"), - NpcDef( - entityIdx = 15, - graphicsId = 0, - x = 10, - y = 8, - elevation = 3, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "0x0"), - NpcDef( - entityIdx = 16, - graphicsId = 48, - x = 9, - y = 8, - elevation = 3, - movementType = 7, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 1, - script = "MossdeepCity_Gym_EventScript_Nate"), - NpcDef( - entityIdx = 17, - graphicsId = 40, - x = 7, - y = 5, - elevation = 3, - movementType = 10, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 3, - script = "MossdeepCity_Gym_EventScript_Sylvia"), - NpcDef( - entityIdx = 18, - graphicsId = 0, - x = 6, - y = 6, - elevation = 3, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "0x0"), - NpcDef( - entityIdx = 19, - graphicsId = 0, - x = 12, - y = 5, - elevation = 3, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "0x0"), - NpcDef( - entityIdx = 20, - graphicsId = 0, - x = 11, - y = 5, - elevation = 3, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "0x0"), - NpcDef( - entityIdx = 21, - graphicsId = 0, - x = 11, - y = 34, - elevation = 3, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "0x0"), - NpcDef( - entityIdx = 22, - graphicsId = 0, - x = 12, - y = 33, - elevation = 3, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "0x0"), - NpcDef( - entityIdx = 23, - graphicsId = 0, - x = 12, - y = 34, - elevation = 3, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "0x0"), - NpcDef( - entityIdx = 24, - graphicsId = 48, - x = 22, - y = 25, - elevation = 3, - movementType = 7, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 1, - script = "MossdeepCity_Gym_EventScript_Clifford"), - NpcDef( - entityIdx = 25, - graphicsId = 0, - x = 23, - y = 26, - elevation = 3, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "0x0"), - NpcDef( - entityIdx = 26, - graphicsId = 47, - x = 25, - y = 25, - elevation = 3, - movementType = 9, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 2, - script = "MossdeepCity_Gym_EventScript_Macey"), - NpcDef( - entityIdx = 27, - graphicsId = 40, - x = 22, - y = 23, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "MossdeepCity_Gym_EventScript_Kathleen"), - NpcDef( - entityIdx = 28, - graphicsId = 0, - x = 21, - y = 23, - elevation = 3, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "0x0"), - NpcDef( - entityIdx = 29, - graphicsId = 0, - x = 21, - y = 22, - elevation = 3, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "0x0"), - NpcDef( - entityIdx = 30, - graphicsId = 0, - x = 22, - y = 22, - elevation = 3, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "0x0"), - NpcDef( - entityIdx = 31, - graphicsId = 37, - x = 25, - y = 22, - elevation = 3, - movementType = 7, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 1, - script = "MossdeepCity_Gym_EventScript_Nicholas"), - NpcDef( - entityIdx = 32, - graphicsId = 0, - x = 24, - y = 22, - elevation = 3, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "0x0"), - NpcDef( - entityIdx = 33, - graphicsId = 0, - x = 24, - y = 23, - elevation = 3, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "0x0"), - NpcDef( - entityIdx = 34, - graphicsId = 0, - x = 6, - y = 5, - elevation = 3, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "0x0"), - NpcDef( - entityIdx = 35, - graphicsId = 0, - x = 23, - y = 25, - elevation = 3, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "0x0"), - ), - bgEvents = - listOf( - BgEventDef( - x = 4, - y = 34, - facingDir = "BG_EVENT_PLAYER_FACING_NORTH", - script = "MossdeepCity_Gym_EventScript_LeftGymStatue"), - BgEventDef( - x = 8, - y = 34, - facingDir = "BG_EVENT_PLAYER_FACING_NORTH", - script = "MossdeepCity_Gym_EventScript_RightGymStatue"), - ), - ), - // MossdeepCity_House1 (MAP_MOSSDEEP_CITY_HOUSE1) - MapDef( - regionId = 1, - bankId = 64, - mapId = 1, - width = 11, - height = 8, - paletteIdx1 = 116, - paletteIdx2 = 147, - unknownShort = 399, - unknownByte = 13, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 3, - y = 7, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 6, - targetX = 28, - targetY = 9, - targetElevation = 0), - WarpTile( - x = 4, - y = 7, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 6, - targetX = 28, - targetY = 9, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 44, - x = 3, - y = 3, - elevation = 3, - movementType = 3, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "MossdeepCity_House1_EventScript_BlackBelt"), - NpcDef( - entityIdx = 1, - graphicsId = 20, - x = 7, - y = 4, - elevation = 3, - movementType = 9, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 2, - script = "MossdeepCity_House1_EventScript_Woman"), - ), - bgEvents = emptyList(), - ), - // MossdeepCity_House2 (MAP_MOSSDEEP_CITY_HOUSE2) - MapDef( - regionId = 1, - bankId = 64, - mapId = 2, - width = 10, - height = 9, - paletteIdx1 = 116, - paletteIdx2 = 147, - unknownShort = 399, - unknownByte = 13, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 3, - y = 8, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 6, - targetX = 67, - targetY = 25, - targetElevation = 0), - WarpTile( - x = 4, - y = 8, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 6, - targetX = 67, - targetY = 25, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 65, - x = 6, - y = 6, - elevation = 3, - movementType = 9, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 2, - script = "MossdeepCity_House2_EventScript_Man"), - NpcDef( - entityIdx = 1, - graphicsId = 6, - x = 4, - y = 4, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "MossdeepCity_House2_EventScript_Twin"), - ), - bgEvents = emptyList(), - ), - // MossdeepCity_PokemonCenter_1F (MAP_MOSSDEEP_CITY_POKEMON_CENTER_1F) - MapDef( - regionId = 1, - bankId = 64, - mapId = 3, - width = 14, - height = 9, - paletteIdx1 = 116, - paletteIdx2 = 118, - unknownShort = 400, - unknownByte = 13, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 7, - y = 8, - elevation = 2, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 6, - targetX = 28, - targetY = 16, - targetElevation = 0), - WarpTile( - x = 6, - y = 8, - elevation = 2, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 6, - targetX = 28, - targetY = 16, - targetElevation = 0), - WarpTile( - x = 1, - y = 6, - elevation = 3, - targetRegionId = 1, - targetBankId = 64, - targetMapId = 4, - targetX = 1, - targetY = 6, - targetElevation = 3), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 58, - x = 7, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "MossdeepCity_PokemonCenter_1F_EventScript_Nurse"), - NpcDef( - entityIdx = 1, - graphicsId = 20, - x = 8, - y = 4, - elevation = 3, - movementType = 7, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 1, - script = "MossdeepCity_PokemonCenter_1F_EventScript_Woman"), - NpcDef( - entityIdx = 2, - graphicsId = 8, - x = 3, - y = 5, - elevation = 3, - movementType = 1, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "MossdeepCity_PokemonCenter_1F_EventScript_Girl"), - ), - bgEvents = emptyList(), - ), - // MossdeepCity_PokemonCenter_2F (MAP_MOSSDEEP_CITY_POKEMON_CENTER_2F) - MapDef( - regionId = 1, - bankId = 64, - mapId = 4, - width = 14, - height = 10, - paletteIdx1 = 116, - paletteIdx2 = 118, - unknownShort = 400, - unknownByte = 13, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 1, - y = 6, - elevation = 3, - targetRegionId = 1, - targetBankId = 64, - targetMapId = 3, - targetX = 1, - targetY = 6, - targetElevation = 3), - WarpTile( - x = 5, - y = 1, - elevation = 2, - targetRegionId = 1, - targetBankId = 75, - targetMapId = 60, - targetX = 7, - targetY = 11, - targetElevation = 2), - WarpTile( - x = 9, - y = 1, - elevation = 2, - targetRegionId = 1, - targetBankId = 75, - targetMapId = 25, - targetX = 5, - targetY = 8, - targetElevation = 2), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 0, - x = 6, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "Common_EventScript_UnionRoomAttendant"), - NpcDef( - entityIdx = 1, - graphicsId = 0, - x = 2, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "Common_EventScript_WirelessClubAttendant"), - NpcDef( - entityIdx = 2, - graphicsId = 0, - x = 10, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "Common_EventScript_DirectCornerAttendant"), - NpcDef( - entityIdx = 4, - graphicsId = 34, - x = 11, - y = 7, - elevation = 3, - movementType = 5, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "MossdeepCity_PokemonCenter_2F_EventScript_Woman5"), - ), - bgEvents = emptyList(), - ), - // MossdeepCity_Mart (MAP_MOSSDEEP_CITY_MART) - MapDef( - regionId = 1, - bankId = 64, - mapId = 5, - width = 11, - height = 8, - paletteIdx1 = 116, - paletteIdx2 = 117, - unknownShort = 404, - unknownByte = 13, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 3, - y = 7, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 6, - targetX = 37, - targetY = 18, - targetElevation = 0), - WarpTile( - x = 4, - y = 7, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 6, - targetX = 37, - targetY = 18, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 83, - x = 1, - y = 3, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 3, - script = "MossdeepCity_Mart_EventScript_Clerk"), - NpcDef( - entityIdx = 1, - graphicsId = 34, - x = 1, - y = 5, - elevation = 3, - movementType = 7, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 1, - script = "MossdeepCity_Mart_EventScript_Woman"), - NpcDef( - entityIdx = 2, - graphicsId = 9, - x = 8, - y = 3, - elevation = 3, - movementType = 3, - movementRangeX = 0, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "MossdeepCity_Mart_EventScript_Boy"), - NpcDef( - entityIdx = 3, - graphicsId = 49, - x = 5, - y = 3, - elevation = 3, - movementType = 2, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "MossdeepCity_Mart_EventScript_Sailor"), - ), - bgEvents = emptyList(), - ), - // MossdeepCity_House3 (MAP_MOSSDEEP_CITY_HOUSE3) - MapDef( - regionId = 1, - bankId = 64, - mapId = 6, - width = 11, - height = 8, - paletteIdx1 = 116, - paletteIdx2 = 147, - unknownShort = 399, - unknownByte = 13, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 3, - y = 7, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 6, - targetX = 49, - targetY = 6, - targetElevation = 0), - WarpTile( - x = 4, - y = 7, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 6, - targetX = 49, - targetY = 6, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 50, - x = 4, - y = 4, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 3, - script = "MossdeepCity_House3_EventScript_SuperRodFisherman"), - ), - bgEvents = emptyList(), - ), - // MossdeepCity_StevensHouse (MAP_MOSSDEEP_CITY_STEVENS_HOUSE) - MapDef( - regionId = 1, - bankId = 64, - mapId = 7, - width = 11, - height = 8, - paletteIdx1 = 116, - paletteIdx2 = 147, - unknownShort = 399, - unknownByte = 13, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 3, - y = 7, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 6, - targetX = 19, - targetY = 10, - targetElevation = 0), - WarpTile( - x = 4, - y = 7, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 6, - targetX = 19, - targetY = 10, - targetElevation = 0), - ), - npcs = emptyList(), - bgEvents = - listOf( - BgEventDef( - x = 0, - y = 1, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "MossdeepCity_StevensHouse_EventScript_RockDisplay"), - BgEventDef( - x = 1, - y = 1, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "MossdeepCity_StevensHouse_EventScript_RockDisplay"), - BgEventDef( - x = 10, - y = 4, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "MossdeepCity_StevensHouse_EventScript_RockDisplay"), - BgEventDef( - x = 10, - y = 6, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "MossdeepCity_StevensHouse_EventScript_RockDisplay"), - ), - ), - // MossdeepCity_House4 (MAP_MOSSDEEP_CITY_HOUSE4) - MapDef( - regionId = 1, - bankId = 64, - mapId = 8, - width = 10, - height = 8, - paletteIdx1 = 116, - paletteIdx2 = 147, - unknownShort = 399, - unknownByte = 13, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 4, - y = 7, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 6, - targetX = 18, - targetY = 16, - targetElevation = 0), - WarpTile( - x = 3, - y = 7, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 6, - targetX = 18, - targetY = 16, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 20, - x = 3, - y = 4, - elevation = 3, - movementType = 9, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 2, - script = "MossdeepCity_House4_EventScript_Woman"), - NpcDef( - entityIdx = 1, - graphicsId = 5, - x = 6, - y = 6, - elevation = 3, - movementType = 5, - movementRangeX = 1, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "MossdeepCity_House4_EventScript_NinjaBoy"), - NpcDef( - entityIdx = 2, - graphicsId = 0, - x = 2, - y = 4, - elevation = 3, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "MossdeepCity_House4_EventScript_Skitty"), - ), - bgEvents = emptyList(), - ), - // MossdeepCity_SpaceCenter_1F (MAP_MOSSDEEP_CITY_SPACE_CENTER_1F) - MapDef( - regionId = 1, - bankId = 64, - mapId = 9, - width = 16, - height = 10, - paletteIdx1 = 100, - paletteIdx2 = 129, - unknownShort = 399, - unknownByte = 13, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 7, - y = 9, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 6, - targetX = 64, - targetY = 15, - targetElevation = 0), - WarpTile( - x = 8, - y = 9, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 6, - targetX = 64, - targetY = 15, - targetElevation = 0), - WarpTile( - x = 13, - y = 1, - elevation = 0, - targetRegionId = 1, - targetBankId = 64, - targetMapId = 10, - targetX = 13, - targetY = 1, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 46, - x = 7, - y = 2, - elevation = 3, - movementType = 7, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 1, - script = "MossdeepCity_SpaceCenter_1F_EventScript_RocketLaunchCounter"), - NpcDef( - entityIdx = 1, - graphicsId = 46, - x = 2, - y = 2, - elevation = 3, - movementType = 7, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 1, - script = "MossdeepCity_SpaceCenter_1F_EventScript_Scientist"), - NpcDef( - entityIdx = 2, - graphicsId = 49, - x = 6, - y = 6, - elevation = 3, - movementType = 9, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 2, - script = "MossdeepCity_SpaceCenter_1F_EventScript_SunStoneMan"), - NpcDef( - entityIdx = 3, - graphicsId = 29, - x = 10, - y = 2, - elevation = 3, - movementType = 7, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 1, - script = "MossdeepCity_SpaceCenter_1F_EventScript_OldMan"), - NpcDef( - entityIdx = 4, - graphicsId = 26, - x = 14, - y = 7, - elevation = 3, - movementType = 3, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "MossdeepCity_SpaceCenter_1F_EventScript_Woman"), - ), - bgEvents = emptyList(), - ), - // MossdeepCity_SpaceCenter_2F (MAP_MOSSDEEP_CITY_SPACE_CENTER_2F) - MapDef( - regionId = 1, - bankId = 64, - mapId = 10, - width = 16, - height = 10, - paletteIdx1 = 100, - paletteIdx2 = 129, - unknownShort = 399, - unknownByte = 13, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 13, - y = 1, - elevation = 0, - targetRegionId = 1, - targetBankId = 64, - targetMapId = 9, - targetX = 13, - targetY = 1, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 15, - x = 6, - y = 2, - elevation = 3, - movementType = 7, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 1, - script = "MossdeepCity_SpaceCenter_2F_EventScript_RichBoy"), - NpcDef( - entityIdx = 1, - graphicsId = 48, - x = 11, - y = 8, - elevation = 3, - movementType = 7, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 1, - script = "MossdeepCity_SpaceCenter_2F_EventScript_Gentleman"), - NpcDef( - entityIdx = 2, - graphicsId = 46, - x = 5, - y = 6, - elevation = 3, - movementType = 2, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "MossdeepCity_SpaceCenter_2F_EventScript_Scientist"), - ), - bgEvents = emptyList(), - ), - // MossdeepCity_GameCorner_1F (MAP_MOSSDEEP_CITY_GAME_CORNER_1F) - MapDef( - regionId = 1, - bankId = 64, - mapId = 11, - width = 12, - height = 10, - paletteIdx1 = 116, - paletteIdx2 = 167, - unknownShort = 399, - unknownByte = 13, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 5, - y = 9, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 6, - targetX = 36, - targetY = 24, - targetElevation = 0), - WarpTile( - x = 6, - y = 9, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 6, - targetX = 36, - targetY = 24, - targetElevation = 0), - WarpTile( - x = 2, - y = 0, - elevation = 0, - targetRegionId = 1, - targetBankId = 64, - targetMapId = 12, - targetX = 3, - targetY = 1, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 21, - x = 6, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "MossdeepCity_GameCorner_1F_EventScript_OldMan"), - NpcDef( - entityIdx = 1, - graphicsId = 65, - x = 4, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "MossdeepCity_GameCorner_1F_EventScript_InfoMan"), - ), - bgEvents = - listOf( - BgEventDef( - x = 3, - y = 0, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "RS_MysteryEventsHouse_EventScript_Door"), - BgEventDef( - x = 0, - y = 1, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = - "MossdeepCity_GameCorner_1F_EventScript_DodrioBerryPickingRecords"), - BgEventDef( - x = 1, - y = 1, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "MossdeepCity_GameCorner_1F_EventScript_PokemonJumpRecords"), - ), - ), - // MossdeepCity_GameCorner_B1F (MAP_MOSSDEEP_CITY_GAME_CORNER_B1F) - MapDef( - regionId = 1, - bankId = 64, - mapId = 12, - width = 12, - height = 9, - paletteIdx1 = 116, - paletteIdx2 = 147, - unknownShort = 399, - unknownByte = 13, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 3, - y = 1, - elevation = 0, - targetRegionId = 1, - targetBankId = 64, - targetMapId = 11, - targetX = 2, - targetY = 0, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 240, - x = 6, - y = 5, - elevation = 3, - movementType = 9, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 2, - script = "0x0"), - ), - bgEvents = emptyList(), - ), - // SootopolisCity_Gym_1F (MAP_SOOTOPOLIS_CITY_GYM_1F) - MapDef( - regionId = 1, - bankId = 65, - mapId = 0, - width = 17, - height = 26, - paletteIdx1 = 116, - paletteIdx2 = 146, - unknownShort = 364, - unknownByte = 14, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 8, - y = 25, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 7, - targetX = 31, - targetY = 32, - targetElevation = 0), - WarpTile( - x = 9, - y = 25, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 7, - targetX = 31, - targetY = 32, - targetElevation = 0), - WarpTile( - x = 11, - y = 22, - elevation = 2, - targetRegionId = 1, - targetBankId = 65, - targetMapId = 1, - targetX = 11, - targetY = 22, - targetElevation = 2), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 0, - x = 8, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "SootopolisCity_Gym_1F_EventScript_Juan"), - NpcDef( - entityIdx = 1, - graphicsId = 23, - x = 7, - y = 24, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "SootopolisCity_Gym_1F_EventScript_GymGuide"), - ), - bgEvents = - listOf( - BgEventDef( - x = 6, - y = 24, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "SootopolisCity_Gym_1F_EventScript_LeftGymStatue"), - BgEventDef( - x = 10, - y = 24, - facingDir = "BG_EVENT_PLAYER_FACING_NORTH", - script = "SootopolisCity_Gym_1F_EventScript_RightGymStatue"), - ), - ), - // SootopolisCity_Gym_B1F (MAP_SOOTOPOLIS_CITY_GYM_B1F) - MapDef( - regionId = 1, - bankId = 65, - mapId = 1, - width = 17, - height = 26, - paletteIdx1 = 116, - paletteIdx2 = 146, - unknownShort = 364, - unknownByte = 14, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 11, - y = 22, - elevation = 2, - targetRegionId = 1, - targetBankId = 65, - targetMapId = 0, - targetX = 11, - targetY = 22, - targetElevation = 2), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 47, - x = 7, - y = 17, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 3, - script = "SootopolisCity_Gym_B1F_EventScript_Andrea"), - NpcDef( - entityIdx = 1, - graphicsId = 45, - x = 9, - y = 19, - elevation = 3, - movementType = 9, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 2, - script = "SootopolisCity_Gym_B1F_EventScript_Connie"), - NpcDef( - entityIdx = 2, - graphicsId = 20, - x = 12, - y = 7, - elevation = 3, - movementType = 9, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 2, - script = "SootopolisCity_Gym_B1F_EventScript_Brianna"), - NpcDef( - entityIdx = 3, - graphicsId = 45, - x = 11, - y = 9, - elevation = 3, - movementType = 7, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 1, - script = "SootopolisCity_Gym_B1F_EventScript_Bridget"), - NpcDef( - entityIdx = 4, - graphicsId = 45, - x = 5, - y = 6, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "SootopolisCity_Gym_B1F_EventScript_Tiffany"), - NpcDef( - entityIdx = 5, - graphicsId = 18, - x = 7, - y = 8, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 3, - script = "SootopolisCity_Gym_B1F_EventScript_Bethany"), - NpcDef( - entityIdx = 6, - graphicsId = 47, - x = 4, - y = 8, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 3, - script = "SootopolisCity_Gym_B1F_EventScript_Crissy"), - NpcDef( - entityIdx = 7, - graphicsId = 45, - x = 9, - y = 7, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "SootopolisCity_Gym_B1F_EventScript_Olivia"), - NpcDef( - entityIdx = 8, - graphicsId = 20, - x = 6, - y = 13, - elevation = 3, - movementType = 10, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 3, - script = "SootopolisCity_Gym_B1F_EventScript_Daphne"), - NpcDef( - entityIdx = 9, - graphicsId = 18, - x = 10, - y = 13, - elevation = 3, - movementType = 9, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 2, - script = "SootopolisCity_Gym_B1F_EventScript_Annika"), - ), - bgEvents = emptyList(), - ), - // SootopolisCity_PokemonCenter_1F (MAP_SOOTOPOLIS_CITY_POKEMON_CENTER_1F) - MapDef( - regionId = 1, - bankId = 65, - mapId = 2, - width = 14, - height = 9, - paletteIdx1 = 116, - paletteIdx2 = 118, - unknownShort = 400, - unknownByte = 14, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 7, - y = 8, - elevation = 2, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 7, - targetX = 43, - targetY = 31, - targetElevation = 0), - WarpTile( - x = 6, - y = 8, - elevation = 2, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 7, - targetX = 43, - targetY = 31, - targetElevation = 0), - WarpTile( - x = 1, - y = 6, - elevation = 3, - targetRegionId = 1, - targetBankId = 65, - targetMapId = 3, - targetX = 1, - targetY = 6, - targetElevation = 3), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 58, - x = 7, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "SootopolisCity_PokemonCenter_1F_EventScript_Nurse"), - NpcDef( - entityIdx = 1, - graphicsId = 48, - x = 12, - y = 4, - elevation = 3, - movementType = 2, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "SootopolisCity_PokemonCenter_1F_EventScript_Gentleman"), - NpcDef( - entityIdx = 2, - graphicsId = 34, - x = 4, - y = 7, - elevation = 3, - movementType = 5, - movementRangeX = 1, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "SootopolisCity_PokemonCenter_1F_EventScript_Woman"), - NpcDef( - entityIdx = 3, - graphicsId = 16, - x = 2, - y = 3, - elevation = 3, - movementType = 2, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "SootopolisCity_PokemonCenter_1F_EventScript_DoubleEdgeTutor"), - ), - bgEvents = emptyList(), - ), - // SootopolisCity_PokemonCenter_2F (MAP_SOOTOPOLIS_CITY_POKEMON_CENTER_2F) - MapDef( - regionId = 1, - bankId = 65, - mapId = 3, - width = 14, - height = 10, - paletteIdx1 = 116, - paletteIdx2 = 118, - unknownShort = 400, - unknownByte = 14, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 1, - y = 6, - elevation = 3, - targetRegionId = 1, - targetBankId = 65, - targetMapId = 2, - targetX = 1, - targetY = 6, - targetElevation = 3), - WarpTile( - x = 5, - y = 1, - elevation = 2, - targetRegionId = 1, - targetBankId = 75, - targetMapId = 60, - targetX = 7, - targetY = 11, - targetElevation = 2), - WarpTile( - x = 9, - y = 1, - elevation = 2, - targetRegionId = 1, - targetBankId = 75, - targetMapId = 25, - targetX = 5, - targetY = 8, - targetElevation = 2), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 0, - x = 6, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "Common_EventScript_UnionRoomAttendant"), - NpcDef( - entityIdx = 1, - graphicsId = 0, - x = 2, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "Common_EventScript_WirelessClubAttendant"), - NpcDef( - entityIdx = 2, - graphicsId = 0, - x = 10, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "Common_EventScript_DirectCornerAttendant"), - ), - bgEvents = emptyList(), - ), - // SootopolisCity_Mart (MAP_SOOTOPOLIS_CITY_MART) - MapDef( - regionId = 1, - bankId = 65, - mapId = 4, - width = 11, - height = 8, - paletteIdx1 = 116, - paletteIdx2 = 117, - unknownShort = 404, - unknownByte = 14, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 3, - y = 7, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 7, - targetX = 17, - targetY = 29, - targetElevation = 0), - WarpTile( - x = 4, - y = 7, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 7, - targetX = 17, - targetY = 29, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 83, - x = 1, - y = 3, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 3, - script = "SootopolisCity_Mart_EventScript_Clerk"), - NpcDef( - entityIdx = 1, - graphicsId = 17, - x = 5, - y = 5, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 3, - script = "SootopolisCity_Mart_EventScript_FatMan"), - NpcDef( - entityIdx = 2, - graphicsId = 48, - x = 9, - y = 5, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 3, - script = "SootopolisCity_Mart_EventScript_Gentleman"), - ), - bgEvents = emptyList(), - ), - // SootopolisCity_House1 (MAP_SOOTOPOLIS_CITY_HOUSE1) - MapDef( - regionId = 1, - bankId = 65, - mapId = 5, - width = 8, - height = 7, - paletteIdx1 = 116, - paletteIdx2 = 147, - unknownShort = 445, - unknownByte = 14, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 3, - y = 6, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 7, - targetX = 9, - targetY = 6, - targetElevation = 0), - WarpTile( - x = 4, - y = 6, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 7, - targetX = 9, - targetY = 6, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 44, - x = 2, - y = 4, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 3, - script = "SootopolisCity_House1_EventScript_BrickBreakBlackBelt"), - NpcDef( - entityIdx = 1, - graphicsId = 0, - x = 2, - y = 3, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "SootopolisCity_House1_EventScript_Kecleon"), - ), - bgEvents = emptyList(), - ), - // SootopolisCity_House2 (MAP_SOOTOPOLIS_CITY_HOUSE2) - MapDef( - regionId = 1, - bankId = 65, - mapId = 6, - width = 8, - height = 7, - paletteIdx1 = 116, - paletteIdx2 = 147, - unknownShort = 445, - unknownByte = 14, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 3, - y = 6, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 7, - targetX = 45, - targetY = 6, - targetElevation = 0), - WarpTile( - x = 4, - y = 6, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 7, - targetX = 45, - targetY = 6, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 22, - x = 3, - y = 3, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 3, - script = "SootopolisCity_House2_EventScript_ExpertF"), - ), - bgEvents = emptyList(), - ), - // SootopolisCity_House3 (MAP_SOOTOPOLIS_CITY_HOUSE3) - MapDef( - regionId = 1, - bankId = 65, - mapId = 7, - width = 8, - height = 7, - paletteIdx1 = 116, - paletteIdx2 = 147, - unknownShort = 445, - unknownByte = 14, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 3, - y = 6, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 7, - targetX = 9, - targetY = 17, - targetElevation = 0), - WarpTile( - x = 4, - y = 6, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 7, - targetX = 9, - targetY = 17, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 26, - x = 2, - y = 4, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "SootopolisCity_House3_EventScript_Woman"), - NpcDef( - entityIdx = 1, - graphicsId = 10, - x = 6, - y = 4, - elevation = 3, - movementType = 2, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "SootopolisCity_House3_EventScript_Girl"), - ), - bgEvents = emptyList(), - ), - // SootopolisCity_House4 (MAP_SOOTOPOLIS_CITY_HOUSE4) - MapDef( - regionId = 1, - bankId = 65, - mapId = 8, - width = 8, - height = 7, - paletteIdx1 = 116, - paletteIdx2 = 147, - unknownShort = 445, - unknownByte = 14, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 3, - y = 6, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 7, - targetX = 44, - targetY = 17, - targetElevation = 0), - WarpTile( - x = 4, - y = 6, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 7, - targetX = 44, - targetY = 17, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 19, - x = 2, - y = 4, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 3, - script = "SootopolisCity_House4_EventScript_Man"), - NpcDef( - entityIdx = 1, - graphicsId = 26, - x = 5, - y = 2, - elevation = 3, - movementType = 7, - movementRangeX = 1, - movementRangeY = 2, - trainerType = 0, - facing = 1, - script = "SootopolisCity_House4_EventScript_Woman"), - NpcDef( - entityIdx = 2, - graphicsId = 0, - x = 2, - y = 3, - elevation = 3, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "SootopolisCity_House4_EventScript_Azumarill"), - ), - bgEvents = emptyList(), - ), - // SootopolisCity_House5 (MAP_SOOTOPOLIS_CITY_HOUSE5) - MapDef( - regionId = 1, - bankId = 65, - mapId = 9, - width = 8, - height = 7, - paletteIdx1 = 116, - paletteIdx2 = 147, - unknownShort = 445, - unknownByte = 14, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 3, - y = 6, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 7, - targetX = 9, - targetY = 26, - targetElevation = 0), - WarpTile( - x = 4, - y = 6, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 7, - targetX = 9, - targetY = 26, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 39, - x = 3, - y = 3, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 3, - script = "SootopolisCity_House5_EventScript_Maniac"), - NpcDef( - entityIdx = 1, - graphicsId = 14, - x = 6, - y = 3, - elevation = 3, - movementType = 9, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 2, - script = "SootopolisCity_House5_EventScript_Girl"), - ), - bgEvents = emptyList(), - ), - // SootopolisCity_House6 (MAP_SOOTOPOLIS_CITY_HOUSE6) - MapDef( - regionId = 1, - bankId = 65, - mapId = 10, - width = 8, - height = 7, - paletteIdx1 = 116, - paletteIdx2 = 147, - unknownShort = 445, - unknownByte = 14, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 3, - y = 6, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 7, - targetX = 53, - targetY = 28, - targetElevation = 0), - WarpTile( - x = 4, - y = 6, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 7, - targetX = 53, - targetY = 28, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 20, - x = 4, - y = 3, - elevation = 3, - movementType = 2, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "SootopolisCity_House6_EventScript_Woman"), - ), - bgEvents = emptyList(), - ), - // SootopolisCity_House7 (MAP_SOOTOPOLIS_CITY_HOUSE7) - MapDef( - regionId = 1, - bankId = 65, - mapId = 11, - width = 8, - height = 7, - paletteIdx1 = 116, - paletteIdx2 = 147, - unknownShort = 445, - unknownByte = 14, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 3, - y = 6, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 7, - targetX = 8, - targetY = 35, - targetElevation = 0), - WarpTile( - x = 4, - y = 6, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 7, - targetX = 8, - targetY = 35, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 29, - x = 5, - y = 3, - elevation = 3, - movementType = 9, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 2, - script = "SootopolisCity_House7_EventScript_OldMan"), - NpcDef( - entityIdx = 1, - graphicsId = 18, - x = 1, - y = 4, - elevation = 3, - movementType = 2, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "SootopolisCity_House7_EventScript_PokefanF"), - ), - bgEvents = emptyList(), - ), - // SootopolisCity_LotadAndSeedotHouse (MAP_SOOTOPOLIS_CITY_LOTAD_AND_SEEDOT_HOUSE) - MapDef( - regionId = 1, - bankId = 65, - mapId = 12, - width = 8, - height = 7, - paletteIdx1 = 116, - paletteIdx2 = 147, - unknownShort = 445, - unknownByte = 14, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 3, - y = 6, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 7, - targetX = 48, - targetY = 25, - targetElevation = 0), - WarpTile( - x = 4, - y = 6, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 7, - targetX = 48, - targetY = 25, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 50, - x = 2, - y = 4, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 3, - script = "SootopolisCity_LotadAndSeedotHouse_EventScript_LotadBrother"), - NpcDef( - entityIdx = 1, - graphicsId = 55, - x = 5, - y = 4, - elevation = 3, - movementType = 9, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 2, - script = - "SootopolisCity_LotadAndSeedotHouse_EventScript_SeedotBrother"), - ), - bgEvents = - listOf( - BgEventDef( - x = 5, - y = 1, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = - "SootopolisCity_LotadAndSeedotHouse_EventScript_SeedotSizeRecord"), - BgEventDef( - x = 2, - y = 1, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = - "SootopolisCity_LotadAndSeedotHouse_EventScript_LotadSizeRecord"), - ), - ), - // SootopolisCity_MysteryEventsHouse_1F (MAP_SOOTOPOLIS_CITY_MYSTERY_EVENTS_HOUSE_1F) - MapDef( - regionId = 1, - bankId = 65, - mapId = 13, - width = 11, - height = 8, - paletteIdx1 = 116, - paletteIdx2 = 173, - unknownShort = 445, - unknownByte = 14, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 3, - y = 7, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 7, - targetX = 51, - targetY = 36, - targetElevation = 0), - WarpTile( - x = 4, - y = 7, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 7, - targetX = 51, - targetY = 36, - targetElevation = 0), - WarpTile( - x = 3, - y = 1, - elevation = 2, - targetRegionId = 1, - targetBankId = 65, - targetMapId = 14, - targetX = 3, - targetY = 1, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 29, - x = 6, - y = 4, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 3, - script = "SootopolisCity_MysteryEventsHouse_1F_EventScript_OldMan"), - ), - bgEvents = emptyList(), - ), - // SootopolisCity_MysteryEventsHouse_B1F (MAP_SOOTOPOLIS_CITY_MYSTERY_EVENTS_HOUSE_B1F) - MapDef( - regionId = 1, - bankId = 65, - mapId = 14, - width = 12, - height = 9, - paletteIdx1 = 116, - paletteIdx2 = 173, - unknownShort = 445, - unknownByte = 14, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 3, - y = 1, - elevation = 0, - targetRegionId = 1, - targetBankId = 65, - targetMapId = 13, - targetX = 3, - targetY = 1, - targetElevation = 2), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 240, - x = 6, - y = 5, - elevation = 3, - movementType = 9, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 2, - script = "0x0"), - ), - bgEvents = emptyList(), - ), - // EverGrandeCity_SidneysRoom (MAP_EVER_GRANDE_CITY_SIDNEYS_ROOM) - MapDef( - regionId = 1, - bankId = 66, - mapId = 0, - width = 13, - height = 14, - paletteIdx1 = 116, - paletteIdx2 = 158, - unknownShort = 429, - unknownByte = 15, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 6, - y = 13, - elevation = 2, - targetRegionId = 1, - targetBankId = 66, - targetMapId = 9, - targetX = 5, - targetY = 2, - targetElevation = 0), - WarpTile( - x = 6, - y = 2, - elevation = 0, - targetRegionId = 1, - targetBankId = 66, - targetMapId = 5, - targetX = 5, - targetY = 12, - targetElevation = 2), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 0, - x = 6, - y = 5, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "EverGrandeCity_SidneysRoom_EventScript_Sidney"), - ), - bgEvents = emptyList(), - ), - // EverGrandeCity_PhoebesRoom (MAP_EVER_GRANDE_CITY_PHOEBES_ROOM) - MapDef( - regionId = 1, - bankId = 66, - mapId = 1, - width = 13, - height = 14, - paletteIdx1 = 116, - paletteIdx2 = 158, - unknownShort = 429, - unknownByte = 15, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 6, - y = 13, - elevation = 2, - targetRegionId = 1, - targetBankId = 66, - targetMapId = 5, - targetX = 5, - targetY = 2, - targetElevation = 0), - WarpTile( - x = 6, - y = 2, - elevation = 0, - targetRegionId = 1, - targetBankId = 66, - targetMapId = 6, - targetX = 5, - targetY = 12, - targetElevation = 2), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 0, - x = 6, - y = 5, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "EverGrandeCity_PhoebesRoom_EventScript_Phoebe"), - ), - bgEvents = emptyList(), - ), - // EverGrandeCity_GlaciasRoom (MAP_EVER_GRANDE_CITY_GLACIAS_ROOM) - MapDef( - regionId = 1, - bankId = 66, - mapId = 2, - width = 13, - height = 14, - paletteIdx1 = 116, - paletteIdx2 = 158, - unknownShort = 429, - unknownByte = 15, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 6, - y = 13, - elevation = 2, - targetRegionId = 1, - targetBankId = 66, - targetMapId = 6, - targetX = 5, - targetY = 2, - targetElevation = 0), - WarpTile( - x = 6, - y = 2, - elevation = 0, - targetRegionId = 1, - targetBankId = 66, - targetMapId = 7, - targetX = 5, - targetY = 12, - targetElevation = 2), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 0, - x = 6, - y = 5, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "EverGrandeCity_GlaciasRoom_EventScript_Glacia"), - ), - bgEvents = emptyList(), - ), - // EverGrandeCity_DrakesRoom (MAP_EVER_GRANDE_CITY_DRAKES_ROOM) - MapDef( - regionId = 1, - bankId = 66, - mapId = 3, - width = 13, - height = 14, - paletteIdx1 = 116, - paletteIdx2 = 158, - unknownShort = 429, - unknownByte = 15, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 6, - y = 13, - elevation = 2, - targetRegionId = 1, - targetBankId = 66, - targetMapId = 7, - targetX = 5, - targetY = 2, - targetElevation = 0), - WarpTile( - x = 6, - y = 2, - elevation = 0, - targetRegionId = 1, - targetBankId = 66, - targetMapId = 8, - targetX = 5, - targetY = 33, - targetElevation = 2), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 0, - x = 6, - y = 5, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "EverGrandeCity_DrakesRoom_EventScript_Drake"), - ), - bgEvents = emptyList(), - ), - // EverGrandeCity_ChampionsRoom (MAP_EVER_GRANDE_CITY_CHAMPIONS_ROOM) - MapDef( - regionId = 1, - bankId = 66, - mapId = 4, - width = 13, - height = 13, - paletteIdx1 = 116, - paletteIdx2 = 158, - unknownShort = 429, - unknownByte = 15, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 6, - y = 12, - elevation = 2, - targetRegionId = 1, - targetBankId = 66, - targetMapId = 8, - targetX = 5, - targetY = 2, - targetElevation = 0), - WarpTile( - x = 6, - y = 2, - elevation = 0, - targetRegionId = 1, - targetBankId = 66, - targetMapId = 11, - targetX = 7, - targetY = 11, - targetElevation = 2), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 0, - x = 6, - y = 5, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "0x0"), - ), - bgEvents = emptyList(), - ), - // EverGrandeCity_Hall1 (MAP_EVER_GRANDE_CITY_HALL1) - MapDef( - regionId = 1, - bankId = 66, - mapId = 5, - width = 11, - height = 13, - paletteIdx1 = 116, - paletteIdx2 = 158, - unknownShort = 429, - unknownByte = 15, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 5, - y = 12, - elevation = 2, - targetRegionId = 1, - targetBankId = 66, - targetMapId = 0, - targetX = 6, - targetY = 2, - targetElevation = 0), - WarpTile( - x = 5, - y = 2, - elevation = 0, - targetRegionId = 1, - targetBankId = 66, - targetMapId = 1, - targetX = 6, - targetY = 13, - targetElevation = 2), - WarpTile( - x = 4, - y = 12, - elevation = 2, - targetRegionId = 1, - targetBankId = 66, - targetMapId = 0, - targetX = 6, - targetY = 2, - targetElevation = 0), - WarpTile( - x = 6, - y = 12, - elevation = 2, - targetRegionId = 1, - targetBankId = 66, - targetMapId = 0, - targetX = 6, - targetY = 2, - targetElevation = 0), - ), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // EverGrandeCity_Hall2 (MAP_EVER_GRANDE_CITY_HALL2) - MapDef( - regionId = 1, - bankId = 66, - mapId = 6, - width = 11, - height = 13, - paletteIdx1 = 116, - paletteIdx2 = 158, - unknownShort = 429, - unknownByte = 15, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 5, - y = 12, - elevation = 2, - targetRegionId = 1, - targetBankId = 66, - targetMapId = 1, - targetX = 6, - targetY = 2, - targetElevation = 0), - WarpTile( - x = 5, - y = 2, - elevation = 0, - targetRegionId = 1, - targetBankId = 66, - targetMapId = 2, - targetX = 6, - targetY = 13, - targetElevation = 2), - WarpTile( - x = 4, - y = 12, - elevation = 2, - targetRegionId = 1, - targetBankId = 66, - targetMapId = 1, - targetX = 6, - targetY = 2, - targetElevation = 0), - WarpTile( - x = 6, - y = 12, - elevation = 2, - targetRegionId = 1, - targetBankId = 66, - targetMapId = 1, - targetX = 6, - targetY = 2, - targetElevation = 0), - ), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // EverGrandeCity_Hall3 (MAP_EVER_GRANDE_CITY_HALL3) - MapDef( - regionId = 1, - bankId = 66, - mapId = 7, - width = 11, - height = 13, - paletteIdx1 = 116, - paletteIdx2 = 158, - unknownShort = 429, - unknownByte = 15, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 5, - y = 12, - elevation = 2, - targetRegionId = 1, - targetBankId = 66, - targetMapId = 2, - targetX = 6, - targetY = 2, - targetElevation = 0), - WarpTile( - x = 5, - y = 2, - elevation = 0, - targetRegionId = 1, - targetBankId = 66, - targetMapId = 3, - targetX = 6, - targetY = 13, - targetElevation = 2), - WarpTile( - x = 4, - y = 12, - elevation = 2, - targetRegionId = 1, - targetBankId = 66, - targetMapId = 2, - targetX = 6, - targetY = 2, - targetElevation = 0), - WarpTile( - x = 6, - y = 12, - elevation = 2, - targetRegionId = 1, - targetBankId = 66, - targetMapId = 2, - targetX = 6, - targetY = 2, - targetElevation = 0), - ), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // EverGrandeCity_Hall4 (MAP_EVER_GRANDE_CITY_HALL4) - MapDef( - regionId = 1, - bankId = 66, - mapId = 8, - width = 11, - height = 34, - paletteIdx1 = 116, - paletteIdx2 = 158, - unknownShort = 429, - unknownByte = 15, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 5, - y = 33, - elevation = 2, - targetRegionId = 1, - targetBankId = 66, - targetMapId = 3, - targetX = 6, - targetY = 2, - targetElevation = 0), - WarpTile( - x = 5, - y = 2, - elevation = 0, - targetRegionId = 1, - targetBankId = 66, - targetMapId = 4, - targetX = 6, - targetY = 12, - targetElevation = 2), - ), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // EverGrandeCity_Hall5 (MAP_EVER_GRANDE_CITY_HALL5) - MapDef( - regionId = 1, - bankId = 66, - mapId = 9, - width = 11, - height = 13, - paletteIdx1 = 116, - paletteIdx2 = 158, - unknownShort = 429, - unknownByte = 15, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 5, - y = 12, - elevation = 2, - targetRegionId = 1, - targetBankId = 66, - targetMapId = 10, - targetX = 9, - targetY = 1, - targetElevation = 2), - WarpTile( - x = 5, - y = 2, - elevation = 0, - targetRegionId = 1, - targetBankId = 66, - targetMapId = 0, - targetX = 6, - targetY = 13, - targetElevation = 2), - WarpTile( - x = 4, - y = 12, - elevation = 2, - targetRegionId = 1, - targetBankId = 66, - targetMapId = 10, - targetX = 9, - targetY = 1, - targetElevation = 2), - WarpTile( - x = 6, - y = 12, - elevation = 2, - targetRegionId = 1, - targetBankId = 66, - targetMapId = 10, - targetX = 9, - targetY = 1, - targetElevation = 2), - ), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // EverGrandeCity_PokemonLeague_1F (MAP_EVER_GRANDE_CITY_POKEMON_LEAGUE_1F) - MapDef( - regionId = 1, - bankId = 66, - mapId = 10, - width = 19, - height = 12, - paletteIdx1 = 116, - paletteIdx2 = 118, - unknownShort = 400, - unknownByte = 15, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 9, - y = 11, - elevation = 2, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 8, - targetX = 18, - targetY = 5, - targetElevation = 0), - WarpTile( - x = 10, - y = 11, - elevation = 2, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 8, - targetX = 18, - targetY = 5, - targetElevation = 0), - WarpTile( - x = 9, - y = 1, - elevation = 2, - targetRegionId = 1, - targetBankId = 66, - targetMapId = 9, - targetX = 5, - targetY = 12, - targetElevation = 2), - WarpTile( - x = 10, - y = 1, - elevation = 2, - targetRegionId = 1, - targetBankId = 66, - targetMapId = 9, - targetX = 5, - targetY = 12, - targetElevation = 2), - WarpTile( - x = 1, - y = 7, - elevation = 3, - targetRegionId = 1, - targetBankId = 66, - targetMapId = 14, - targetX = 1, - targetY = 6, - targetElevation = 3), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 58, - x = 3, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "EverGrandeCity_PokemonLeague_1F_EventScript_Nurse"), - NpcDef( - entityIdx = 1, - graphicsId = 83, - x = 16, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "EverGrandeCity_PokemonLeague_1F_EventScript_Clerk"), - NpcDef( - entityIdx = 2, - graphicsId = 33, - x = 8, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "EverGrandeCity_PokemonLeague_1F_EventScript_DoorGuard"), - NpcDef( - entityIdx = 3, - graphicsId = 33, - x = 11, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "EverGrandeCity_PokemonLeague_1F_EventScript_DoorGuard"), - ), - bgEvents = emptyList(), - ), - // EverGrandeCity_HallOfFame (MAP_EVER_GRANDE_CITY_HALL_OF_FAME) - MapDef( - regionId = 1, - bankId = 66, - mapId = 11, - width = 15, - height = 17, - paletteIdx1 = 116, - paletteIdx2 = 125, - unknownShort = 447, - unknownByte = 15, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 7, - y = 11, - elevation = 2, - targetRegionId = 1, - targetBankId = 66, - targetMapId = 4, - targetX = 6, - targetY = 2, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 0, - x = 6, - y = 16, - elevation = 3, - movementType = 7, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 1, - script = "0x0"), - ), - bgEvents = emptyList(), - ), - // EverGrandeCity_PokemonCenter_1F (MAP_EVER_GRANDE_CITY_POKEMON_CENTER_1F) - MapDef( - regionId = 1, - bankId = 66, - mapId = 12, - width = 14, - height = 9, - paletteIdx1 = 116, - paletteIdx2 = 118, - unknownShort = 400, - unknownByte = 15, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 7, - y = 8, - elevation = 2, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 8, - targetX = 27, - targetY = 48, - targetElevation = 0), - WarpTile( - x = 6, - y = 8, - elevation = 2, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 8, - targetX = 27, - targetY = 48, - targetElevation = 0), - WarpTile( - x = 1, - y = 6, - elevation = 3, - targetRegionId = 1, - targetBankId = 66, - targetMapId = 13, - targetX = 1, - targetY = 6, - targetElevation = 3), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 58, - x = 7, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "EverGrandeCity_PokemonCenter_1F_EventScript_Nurse"), - NpcDef( - entityIdx = 1, - graphicsId = 34, - x = 5, - y = 5, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "EverGrandeCity_PokemonCenter_1F_EventScript_Woman"), - NpcDef( - entityIdx = 2, - graphicsId = 21, - x = 10, - y = 7, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 3, - script = "EverGrandeCity_PokemonCenter_1F_EventScript_ExpertM"), - ), - bgEvents = emptyList(), - ), - // EverGrandeCity_PokemonCenter_2F (MAP_EVER_GRANDE_CITY_POKEMON_CENTER_2F) - MapDef( - regionId = 1, - bankId = 66, - mapId = 13, - width = 14, - height = 10, - paletteIdx1 = 116, - paletteIdx2 = 118, - unknownShort = 400, - unknownByte = 15, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 1, - y = 6, - elevation = 3, - targetRegionId = 1, - targetBankId = 66, - targetMapId = 12, - targetX = 1, - targetY = 6, - targetElevation = 3), - WarpTile( - x = 5, - y = 1, - elevation = 2, - targetRegionId = 1, - targetBankId = 75, - targetMapId = 60, - targetX = 7, - targetY = 11, - targetElevation = 2), - WarpTile( - x = 9, - y = 1, - elevation = 2, - targetRegionId = 1, - targetBankId = 75, - targetMapId = 25, - targetX = 5, - targetY = 8, - targetElevation = 2), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 0, - x = 6, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "Common_EventScript_UnionRoomAttendant"), - NpcDef( - entityIdx = 1, - graphicsId = 0, - x = 2, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "Common_EventScript_WirelessClubAttendant"), - NpcDef( - entityIdx = 2, - graphicsId = 0, - x = 10, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "Common_EventScript_DirectCornerAttendant"), - ), - bgEvents = emptyList(), - ), - // EverGrandeCity_PokemonLeague_2F (MAP_EVER_GRANDE_CITY_POKEMON_LEAGUE_2F) - MapDef( - regionId = 1, - bankId = 66, - mapId = 14, - width = 14, - height = 10, - paletteIdx1 = 116, - paletteIdx2 = 118, - unknownShort = 400, - unknownByte = 15, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 1, - y = 6, - elevation = 3, - targetRegionId = 1, - targetBankId = 66, - targetMapId = 10, - targetX = 1, - targetY = 7, - targetElevation = 3), - WarpTile( - x = 5, - y = 1, - elevation = 2, - targetRegionId = 1, - targetBankId = 75, - targetMapId = 60, - targetX = 7, - targetY = 11, - targetElevation = 2), - WarpTile( - x = 9, - y = 1, - elevation = 2, - targetRegionId = 1, - targetBankId = 75, - targetMapId = 25, - targetX = 5, - targetY = 8, - targetElevation = 2), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 0, - x = 6, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "Common_EventScript_UnionRoomAttendant"), - NpcDef( - entityIdx = 1, - graphicsId = 0, - x = 2, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "Common_EventScript_WirelessClubAttendant"), - NpcDef( - entityIdx = 2, - graphicsId = 0, - x = 10, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "Common_EventScript_DirectCornerAttendant"), - ), - bgEvents = emptyList(), - ), - // Route104_MrBrineysHouse (MAP_ROUTE104_MR_BRINEYS_HOUSE) - MapDef( - regionId = 1, - bankId = 67, - mapId = 0, - width = 12, - height = 9, - paletteIdx1 = 116, - paletteIdx2 = 147, - unknownShort = 362, - unknownByte = 19, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 5, - y = 8, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 19, - targetX = 17, - targetY = 50, - targetElevation = 0), - WarpTile( - x = 6, - y = 8, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 19, - targetX = 17, - targetY = 50, - targetElevation = 0), - ), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // Route104_PrettyPetalFlowerShop (MAP_ROUTE104_PRETTY_PETAL_FLOWER_SHOP) - MapDef( - regionId = 1, - bankId = 67, - mapId = 1, - width = 15, - height = 9, - paletteIdx1 = 116, - paletteIdx2 = 127, - unknownShort = 362, - unknownByte = 19, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 2, - y = 8, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 19, - targetX = 5, - targetY = 18, - targetElevation = 0), - WarpTile( - x = 3, - y = 8, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 19, - targetX = 5, - targetY = 18, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 20, - x = 0, - y = 3, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 3, - script = "Route104_PrettyPetalFlowerShop_EventScript_ShopOwner"), - NpcDef( - entityIdx = 1, - graphicsId = 14, - x = 7, - y = 3, - elevation = 3, - movementType = 5, - movementRangeX = 1, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "Route104_PrettyPetalFlowerShop_EventScript_WailmerPailGirl"), - NpcDef( - entityIdx = 2, - graphicsId = 8, - x = 11, - y = 6, - elevation = 4, - movementType = 2, - movementRangeX = 2, - movementRangeY = 2, - trainerType = 0, - facing = 0, - script = "Route104_PrettyPetalFlowerShop_EventScript_RandomBerryGirl"), - ), - bgEvents = emptyList(), - ), - // Route111_WinstrateFamilysHouse (MAP_ROUTE111_WINSTRATE_FAMILYS_HOUSE) - MapDef( - regionId = 1, - bankId = 68, - mapId = 0, - width = 11, - height = 8, - paletteIdx1 = 116, - paletteIdx2 = 147, - unknownShort = 399, - unknownByte = 26, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 3, - y = 7, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 26, - targetX = 13, - targetY = 113, - targetElevation = 0), - WarpTile( - x = 4, - y = 7, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 26, - targetX = 13, - targetY = 113, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 47, - x = 7, - y = 5, - elevation = 3, - movementType = 9, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 2, - script = "Route111_WinstrateFamilysHouse_EventScript_Vivi"), - NpcDef( - entityIdx = 1, - graphicsId = 19, - x = 4, - y = 5, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 3, - script = "Route111_WinstrateFamilysHouse_EventScript_Victor"), - NpcDef( - entityIdx = 2, - graphicsId = 18, - x = 7, - y = 4, - elevation = 3, - movementType = 9, - movementRangeX = 1, - movementRangeY = 0, - trainerType = 0, - facing = 2, - script = "Route111_WinstrateFamilysHouse_EventScript_Victoria"), - NpcDef( - entityIdx = 3, - graphicsId = 22, - x = 4, - y = 4, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 3, - script = "Route111_WinstrateFamilysHouse_EventScript_Vicky"), - ), - bgEvents = emptyList(), - ), - // Route111_OldLadysRestStop (MAP_ROUTE111_OLD_LADYS_REST_STOP) - MapDef( - regionId = 1, - bankId = 68, - mapId = 1, - width = 10, - height = 8, - paletteIdx1 = 116, - paletteIdx2 = 147, - unknownShort = 399, - unknownByte = 26, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 3, - y = 7, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 26, - targetX = 26, - targetY = 18, - targetElevation = 0), - WarpTile( - x = 4, - y = 7, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 26, - targetX = 26, - targetY = 18, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 22, - x = 6, - y = 3, - elevation = 3, - movementType = 9, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 2, - script = "Route111_OldLadysRestStop_EventScript_OldLady"), - ), - bgEvents = emptyList(), - ), - // Route112_CableCarStation (MAP_ROUTE112_CABLE_CAR_STATION) - MapDef( - regionId = 1, - bankId = 69, - mapId = 0, - width = 13, - height = 12, - paletteIdx1 = 100, - paletteIdx2 = 129, - unknownShort = 360, - unknownByte = 27, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 6, - y = 11, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 27, - targetX = 28, - targetY = 27, - targetElevation = 0), - WarpTile( - x = 7, - y = 11, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 27, - targetX = 29, - targetY = 27, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 45, - x = 6, - y = 6, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "Route112_CableCarStation_EventScript_Attendant"), - NpcDef( - entityIdx = 1, - graphicsId = 0, - x = 6, - y = 3, - elevation = 3, - movementType = 1, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "0x0"), - ), - bgEvents = emptyList(), - ), - // MtChimney_CableCarStation (MAP_MT_CHIMNEY_CABLE_CAR_STATION) - MapDef( - regionId = 1, - bankId = 69, - mapId = 1, - width = 13, - height = 12, - paletteIdx1 = 100, - paletteIdx2 = 129, - unknownShort = 360, - unknownByte = 56, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 6, - y = 11, - elevation = 0, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 12, - targetX = 17, - targetY = 36, - targetElevation = 0), - WarpTile( - x = 7, - y = 11, - elevation = 0, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 12, - targetX = 18, - targetY = 36, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 45, - x = 6, - y = 6, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "MtChimney_CableCarStation_EventScript_Attendant"), - NpcDef( - entityIdx = 1, - graphicsId = 0, - x = 6, - y = 3, - elevation = 3, - movementType = 1, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "0x0"), - ), - bgEvents = emptyList(), - ), - // Route114_FossilManiacsHouse (MAP_ROUTE114_FOSSIL_MANIACS_HOUSE) - MapDef( - regionId = 1, - bankId = 70, - mapId = 0, - width = 10, - height = 8, - paletteIdx1 = 116, - paletteIdx2 = 147, - unknownShort = 437, - unknownByte = 29, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 4, - y = 7, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 29, - targetX = 29, - targetY = 5, - targetElevation = 0), - WarpTile( - x = 5, - y = 7, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 29, - targetX = 29, - targetY = 5, - targetElevation = 0), - WarpTile( - x = 4, - y = 1, - elevation = 0, - targetRegionId = 1, - targetBankId = 70, - targetMapId = 1, - targetX = 6, - targetY = 25, - targetElevation = 2), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 5, - x = 3, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = - "Route114_FossilManiacsHouse_EventScript_FossilManiacsBrother"), - ), - bgEvents = - listOf( - BgEventDef( - x = 5, - y = 3, - facingDir = "BG_EVENT_PLAYER_FACING_NORTH", - script = "Route114_FossilManiacsHouse_EventScript_RockDisplay"), - BgEventDef( - x = 6, - y = 3, - facingDir = "BG_EVENT_PLAYER_FACING_NORTH", - script = "Route114_FossilManiacsHouse_EventScript_RockDisplay"), - BgEventDef( - x = 7, - y = 2, - facingDir = "BG_EVENT_PLAYER_FACING_NORTH", - script = "Route114_FossilManiacsHouse_EventScript_Bookshelf"), - BgEventDef( - x = 8, - y = 2, - facingDir = "BG_EVENT_PLAYER_FACING_NORTH", - script = "Route114_FossilManiacsHouse_EventScript_Bookshelf"), - ), - ), - // Route114_FossilManiacsTunnel (MAP_ROUTE114_FOSSIL_MANIACS_TUNNEL) - MapDef( - regionId = 1, - bankId = 70, - mapId = 1, - width = 13, - height = 26, - paletteIdx1 = 100, - paletteIdx2 = 107, - unknownShort = 437, - unknownByte = 29, - borderTiles = - listOf( - Tile2D(0x0277, 0), Tile2D(0x0277, 0), Tile2D(0x0277, 0), Tile2D(0x0277, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 6, - y = 25, - elevation = 2, - targetRegionId = 1, - targetBankId = 70, - targetMapId = 0, - targetX = 4, - targetY = 1, - targetElevation = 0), - WarpTile( - x = 7, - y = 25, - elevation = 2, - targetRegionId = 1, - targetBankId = 70, - targetMapId = 0, - targetX = 4, - targetY = 1, - targetElevation = 0), - WarpTile( - x = 6, - y = 2, - elevation = 0, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 98, - targetX = 10, - targetY = 12, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 39, - x = 5, - y = 3, - elevation = 3, - movementType = 7, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 1, - script = "Route114_FossilManiacsTunnel_EventScript_FossilManiac"), - ), - bgEvents = emptyList(), - ), - // Route114_LanettesHouse (MAP_ROUTE114_LANETTES_HOUSE) - MapDef( - regionId = 1, - bankId = 70, - mapId = 2, - width = 11, - height = 8, - paletteIdx1 = 116, - paletteIdx2 = 143, - unknownShort = 437, - unknownByte = 29, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 5, - y = 7, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 29, - targetX = 27, - targetY = 36, - targetElevation = 0), - WarpTile( - x = 6, - y = 7, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 29, - targetX = 27, - targetY = 36, - targetElevation = 0), - ), - npcs = emptyList(), - bgEvents = - listOf( - BgEventDef( - x = 5, - y = 1, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "Route114_LanettesHouse_EventScript_Notebook"), - BgEventDef( - x = 8, - y = 1, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "Route114_LanettesHouse_EventScript_PC"), - BgEventDef( - x = 7, - y = 1, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "Route114_LanettesHouse_EventScript_PC"), - ), - ), - // Route116_TunnelersRestHouse (MAP_ROUTE116_TUNNELERS_REST_HOUSE) - MapDef( - regionId = 1, - bankId = 71, - mapId = 0, - width = 10, - height = 9, - paletteIdx1 = 116, - paletteIdx2 = 147, - unknownShort = 399, - unknownByte = 31, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 4, - y = 8, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 31, - targetX = 38, - targetY = 8, - targetElevation = 0), - WarpTile( - x = 5, - y = 8, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 31, - targetX = 38, - targetY = 8, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 25, - x = 6, - y = 5, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 3, - script = "Route116_TunnelersRestHouse_EventScript_Tunneler1"), - NpcDef( - entityIdx = 1, - graphicsId = 25, - x = 3, - y = 6, - elevation = 3, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "Route116_TunnelersRestHouse_EventScript_Tunneler3"), - NpcDef( - entityIdx = 2, - graphicsId = 25, - x = 7, - y = 2, - elevation = 3, - movementType = 7, - movementRangeX = 1, - movementRangeY = 0, - trainerType = 0, - facing = 1, - script = "Route116_TunnelersRestHouse_EventScript_Tunneler2"), - ), - bgEvents = emptyList(), - ), - // Route117_PokemonDayCare (MAP_ROUTE117_POKEMON_DAY_CARE) - MapDef( - regionId = 1, - bankId = 72, - mapId = 0, - width = 12, - height = 9, - paletteIdx1 = 116, - paletteIdx2 = 128, - unknownShort = 399, - unknownByte = 32, - borderTiles = - listOf( - Tile2D(0x0203, 0), Tile2D(0x0203, 0), Tile2D(0x0203, 0), Tile2D(0x0203, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 2, - y = 8, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 32, - targetX = 51, - targetY = 5, - targetElevation = 0), - WarpTile( - x = 3, - y = 8, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 32, - targetX = 51, - targetY = 5, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 30, - x = 2, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "Route117_PokemonDayCare_EventScript_DaycareWoman"), - ), - bgEvents = emptyList(), - ), - // Route121_SafariZoneEntrance (MAP_ROUTE121_SAFARI_ZONE_ENTRANCE) - MapDef( - regionId = 1, - bankId = 73, - mapId = 0, - width = 18, - height = 14, - paletteIdx1 = 116, - paletteIdx2 = 117, - unknownShort = 382, - unknownByte = 36, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 2, - y = 5, - elevation = 0, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 3, - targetX = 32, - targetY = 33, - targetElevation = 0), - WarpTile( - x = 3, - y = 5, - elevation = 0, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 3, - targetX = 32, - targetY = 33, - targetElevation = 0), - WarpTile( - x = 14, - y = 13, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 36, - targetX = 37, - targetY = 5, - targetElevation = 0), - WarpTile( - x = 15, - y = 13, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 36, - targetX = 37, - targetY = 5, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 32, - x = 17, - y = 9, - elevation = 3, - movementType = 9, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 2, - script = "Route121_SafariZoneEntrance_EventScript_WelcomeAttendant"), - NpcDef( - entityIdx = 1, - graphicsId = 31, - x = 10, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "Route121_SafariZoneEntrance_EventScript_InfoAttendant"), - NpcDef( - entityIdx = 2, - graphicsId = 31, - x = 8, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "0x0"), - ), - bgEvents = - listOf( - BgEventDef( - x = 15, - y = 1, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "Route121_SafariZoneEntrance_EventScript_TrainerTipSign"), - ), - ), - // MeteorFalls_1F_1R (MAP_METEOR_FALLS_1F_1R) - MapDef( - regionId = 1, - bankId = 74, - mapId = 0, - width = 30, - height = 42, - paletteIdx1 = 100, - paletteIdx2 = 123, - unknownShort = 386, - unknownByte = 63, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.UNDERGROUND, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 27, - y = 18, - elevation = 3, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 29, - targetX = 8, - targetY = 63, - targetElevation = 0), - WarpTile( - x = 6, - y = 39, - elevation = 2, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 30, - targetX = 27, - targetY = 37, - targetElevation = 0), - WarpTile( - x = 10, - y = 3, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 1, - targetX = 10, - targetY = 29, - targetElevation = 2), - WarpTile( - x = 5, - y = 4, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 2, - targetX = 3, - targetY = 23, - targetElevation = 4), - WarpTile( - x = 26, - y = 28, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 2, - targetX = 20, - targetY = 36, - targetElevation = 2), - WarpTile( - x = 4, - y = 2, - elevation = 0, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 107, - targetX = 10, - targetY = 29, - targetElevation = 2), - ), - npcs = emptyList(), - bgEvents = - listOf( - BgEventDef( - x = 9, - y = 58, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "0x0"), - ), - ), - // MeteorFalls_1F_2R (MAP_METEOR_FALLS_1F_2R) - MapDef( - regionId = 1, - bankId = 74, - mapId = 1, - width = 30, - height = 32, - paletteIdx1 = 100, - paletteIdx2 = 123, - unknownShort = 386, - unknownByte = 63, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.UNDERGROUND, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 10, - y = 29, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 0, - targetX = 10, - targetY = 3, - targetElevation = 2), - WarpTile( - x = 4, - y = 14, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 2, - targetX = 5, - targetY = 6, - targetElevation = 3), - WarpTile( - x = 7, - y = 20, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 2, - targetX = 7, - targetY = 11, - targetElevation = 4), - WarpTile( - x = 21, - y = 23, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 2, - targetX = 18, - targetY = 15, - targetElevation = 3), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 33, - x = 13, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "MeteorFalls_1F_2R_EventScript_Nicolas"), - NpcDef( - entityIdx = 1, - graphicsId = 21, - x = 6, - y = 12, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "MeteorFalls_1F_2R_EventScript_John"), - NpcDef( - entityIdx = 2, - graphicsId = 22, - x = 7, - y = 12, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "MeteorFalls_1F_2R_EventScript_Jay"), - ), - bgEvents = - listOf( - BgEventDef( - x = 9, - y = 58, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "0x0"), - ), - ), - ) - allMaps.forEach { registerMap(it) } - } - - private fun registerDefaultMaps4() { - val allMaps = - listOf( - // MeteorFalls_B1F_1R (MAP_METEOR_FALLS_B1F_1R) - MapDef( - regionId = 1, - bankId = 74, - mapId = 2, - width = 29, - height = 38, - paletteIdx1 = 100, - paletteIdx2 = 123, - unknownShort = 386, - unknownByte = 63, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.UNDERGROUND, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 5, - y = 6, - elevation = 3, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 1, - targetX = 4, - targetY = 14, - targetElevation = 2), - WarpTile( - x = 7, - y = 11, - elevation = 4, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 1, - targetX = 7, - targetY = 20, - targetElevation = 2), - WarpTile( - x = 18, - y = 15, - elevation = 3, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 1, - targetX = 21, - targetY = 23, - targetElevation = 2), - WarpTile( - x = 17, - y = 3, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 3, - targetX = 5, - targetY = 15, - targetElevation = 2), - WarpTile( - x = 3, - y = 23, - elevation = 4, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 0, - targetX = 5, - targetY = 4, - targetElevation = 2), - WarpTile( - x = 20, - y = 36, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 0, - targetX = 26, - targetY = 28, - targetElevation = 2), - ), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // MeteorFalls_B1F_2R (MAP_METEOR_FALLS_B1F_2R) - MapDef( - regionId = 1, - bankId = 74, - mapId = 3, - width = 11, - height = 18, - paletteIdx1 = 100, - paletteIdx2 = 123, - unknownShort = 386, - unknownByte = 63, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.UNDERGROUND, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 5, - y = 15, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 2, - targetX = 17, - targetY = 3, - targetElevation = 2), - ), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // RusturfTunnel (MAP_RUSTURF_TUNNEL) - MapDef( - regionId = 1, - bankId = 74, - mapId = 4, - width = 36, - height = 24, - paletteIdx1 = 100, - paletteIdx2 = 131, - unknownShort = 366, - unknownByte = 60, - borderTiles = - listOf( - Tile2D(0x0211, 0), Tile2D(0x0211, 0), Tile2D(0x0211, 0), Tile2D(0x0211, 0)), - lighting = Lighting.REGULAR, - weather = Weather.STEADY_MIST, - mapType = MapType.UNDERGROUND, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 4, - y = 10, - elevation = 2, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 31, - targetX = 47, - targetY = 8, - targetElevation = 0), - WarpTile( - x = 29, - y = 16, - elevation = 2, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 14, - targetX = 8, - targetY = 1, - targetElevation = 0), - WarpTile( - x = 18, - y = 20, - elevation = 2, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 31, - targetX = 65, - targetY = 10, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 8, - graphicsId = 55, - x = 32, - y = 13, - elevation = 3, - movementType = 9, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 2, - script = "RusturfTunnel_EventScript_Mike"), - ), - bgEvents = emptyList(), - ), - // Underwater_SootopolisCity (MAP_UNDERWATER_SOOTOPOLIS_CITY) - MapDef( - regionId = 1, - bankId = 74, - mapId = 5, - width = 20, - height = 10, - paletteIdx1 = 100, - paletteIdx2 = 144, - unknownShort = 411, - unknownByte = 54, - borderTiles = - listOf( - Tile2D(0x0213, 0), Tile2D(0x0213, 0), Tile2D(0x0213, 0), Tile2D(0x0213, 0)), - lighting = Lighting.REGULAR, - weather = Weather.UNDERWATER_MIST, - mapType = MapType.UNDERWATER, - encounterType = EncounterType.UNKNOWN_0x03, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 9, - y = 8, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 51, - targetX = 45, - targetY = 65, - targetElevation = 0), - WarpTile( - x = 10, - y = 8, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 51, - targetX = 45, - targetY = 65, - targetElevation = 0), - ), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // DesertRuins (MAP_DESERT_RUINS) - MapDef( - regionId = 1, - bankId = 74, - mapId = 6, - width = 17, - height = 33, - paletteIdx1 = 100, - paletteIdx2 = 119, - unknownShort = 438, - unknownByte = 82, - borderTiles = - listOf( - Tile2D(0x02D9, 0), Tile2D(0x02D9, 0), Tile2D(0x02D9, 0), Tile2D(0x02D9, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.UNDERGROUND, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 8, - y = 29, - elevation = 2, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 26, - targetX = 29, - targetY = 87, - targetElevation = 0), - WarpTile( - x = 8, - y = 20, - elevation = 0, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 6, - targetX = 8, - targetY = 11, - targetElevation = 2), - WarpTile( - x = 8, - y = 11, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 6, - targetX = 8, - targetY = 20, - targetElevation = 0), - ), - npcs = emptyList(), - bgEvents = - listOf( - BgEventDef( - x = 8, - y = 20, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "DesertRuins_EventScript_CaveEntranceMiddle"), - BgEventDef( - x = 7, - y = 20, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "DesertRuins_EventScript_CaveEntranceSide"), - BgEventDef( - x = 9, - y = 20, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "DesertRuins_EventScript_CaveEntranceSide"), - ), - ), - // GraniteCave_1F (MAP_GRANITE_CAVE_1F) - MapDef( - regionId = 1, - bankId = 74, - mapId = 7, - width = 42, - height = 15, - paletteIdx1 = 100, - paletteIdx2 = 119, - unknownShort = 366, - unknownByte = 55, - borderTiles = - listOf( - Tile2D(0x0211, 0), Tile2D(0x0211, 0), Tile2D(0x0211, 0), Tile2D(0x0211, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.UNDERGROUND, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 37, - y = 12, - elevation = 2, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 21, - targetX = 48, - targetY = 16, - targetElevation = 0), - WarpTile( - x = 35, - y = 3, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 8, - targetX = 25, - targetY = 13, - targetElevation = 2), - WarpTile( - x = 17, - y = 11, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 8, - targetX = 4, - targetY = 21, - targetElevation = 2), - WarpTile( - x = 5, - y = 10, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 10, - targetX = 7, - targetY = 3, - targetElevation = 2), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 55, - x = 36, - y = 9, - elevation = 3, - movementType = 1, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "GraniteCave_1F_EventScript_Hiker"), - ), - bgEvents = emptyList(), - ), - // GraniteCave_B1F (MAP_GRANITE_CAVE_B1F) - MapDef( - regionId = 1, - bankId = 74, - mapId = 8, - width = 32, - height = 26, - paletteIdx1 = 100, - paletteIdx2 = 119, - unknownShort = 366, - unknownByte = 55, - borderTiles = - listOf( - Tile2D(0x0211, 0), Tile2D(0x0211, 0), Tile2D(0x0211, 0), Tile2D(0x0211, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.UNDERGROUND, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 25, - y = 13, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 7, - targetX = 35, - targetY = 3, - targetElevation = 2), - WarpTile( - x = 4, - y = 21, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 7, - targetX = 17, - targetY = 11, - targetElevation = 2), - WarpTile( - x = 29, - y = 13, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 9, - targetX = 29, - targetY = 13, - targetElevation = 2), - WarpTile( - x = 28, - y = 21, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 9, - targetX = 28, - targetY = 21, - targetElevation = 2), - WarpTile( - x = 8, - y = 5, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 9, - targetX = 8, - targetY = 5, - targetElevation = 2), - WarpTile( - x = 12, - y = 3, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 9, - targetX = 12, - targetY = 3, - targetElevation = 2), - WarpTile( - x = 29, - y = 2, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 9, - targetX = 29, - targetY = 2, - targetElevation = 2), - ), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // GraniteCave_B2F (MAP_GRANITE_CAVE_B2F) - MapDef( - regionId = 1, - bankId = 74, - mapId = 9, - width = 32, - height = 26, - paletteIdx1 = 100, - paletteIdx2 = 119, - unknownShort = 366, - unknownByte = 55, - borderTiles = - listOf( - Tile2D(0x0211, 0), Tile2D(0x0211, 0), Tile2D(0x0211, 0), Tile2D(0x0211, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.UNDERGROUND, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 29, - y = 13, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 8, - targetX = 29, - targetY = 13, - targetElevation = 2), - WarpTile( - x = 28, - y = 21, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 8, - targetX = 28, - targetY = 21, - targetElevation = 2), - WarpTile( - x = 8, - y = 5, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 8, - targetX = 8, - targetY = 5, - targetElevation = 2), - WarpTile( - x = 12, - y = 3, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 8, - targetX = 12, - targetY = 3, - targetElevation = 2), - WarpTile( - x = 29, - y = 2, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 8, - targetX = 29, - targetY = 2, - targetElevation = 2), - ), - npcs = emptyList(), - bgEvents = - listOf( - BgEventDef( - x = 28, - y = 6, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 15, - y = 11, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - ), - ), - // GraniteCave_StevensRoom (MAP_GRANITE_CAVE_STEVENS_ROOM) - MapDef( - regionId = 1, - bankId = 74, - mapId = 10, - width = 15, - height = 14, - paletteIdx1 = 100, - paletteIdx2 = 119, - unknownShort = 366, - unknownByte = 55, - borderTiles = - listOf( - Tile2D(0x0211, 0), Tile2D(0x0211, 0), Tile2D(0x0211, 0), Tile2D(0x0211, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.UNDERGROUND, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 7, - y = 3, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 7, - targetX = 5, - targetY = 10, - targetElevation = 2), - ), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // PetalburgWoods (MAP_PETALBURG_WOODS) - MapDef( - regionId = 1, - bankId = 74, - mapId = 11, - width = 48, - height = 44, - paletteIdx1 = 100, - paletteIdx2 = 102, - unknownShort = 366, - unknownByte = 59, - borderTiles = - listOf( - Tile2D(0x01D4, 0), Tile2D(0x01D5, 0), Tile2D(0x01DC, 0), Tile2D(0x01DD, 0)), - lighting = Lighting.REGULAR, - weather = Weather.CLOUDY, - mapType = MapType.ROUTE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 14, - y = 5, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 19, - targetX = 10, - targetY = 30, - targetElevation = 2), - WarpTile( - x = 15, - y = 5, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 19, - targetX = 11, - targetY = 30, - targetElevation = 2), - WarpTile( - x = 16, - y = 38, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 19, - targetX = 10, - targetY = 38, - targetElevation = 2), - WarpTile( - x = 17, - y = 38, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 19, - targetX = 11, - targetY = 38, - targetElevation = 2), - WarpTile( - x = 36, - y = 38, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 19, - targetX = 32, - targetY = 42, - targetElevation = 2), - WarpTile( - x = 37, - y = 38, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 19, - targetX = 33, - targetY = 42, - targetElevation = 2), - ), - npcs = - listOf( - NpcDef( - entityIdx = 7, - graphicsId = 9, - x = 15, - y = 19, - elevation = 3, - movementType = 3, - movementRangeX = 1, - movementRangeY = 2, - trainerType = 0, - facing = 0, - script = "PetalburgWoods_EventScript_Boy1"), - NpcDef( - entityIdx = 8, - graphicsId = 36, - x = 7, - y = 32, - elevation = 3, - movementType = 22, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "PetalburgWoods_EventScript_Lyle"), - NpcDef( - entityIdx = 9, - graphicsId = 36, - x = 4, - y = 14, - elevation = 3, - movementType = 20, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "PetalburgWoods_EventScript_James"), - NpcDef( - entityIdx = 10, - graphicsId = 13, - x = 30, - y = 34, - elevation = 3, - movementType = 2, - movementRangeX = 2, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "PetalburgWoods_EventScript_Boy2"), - NpcDef( - entityIdx = 12, - graphicsId = 10, - x = 33, - y = 5, - elevation = 3, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "PetalburgWoods_EventScript_Girl"), - ), - bgEvents = - listOf( - BgEventDef( - x = 14, - y = 32, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "PetalburgWoods_EventScript_Sign1"), - BgEventDef( - x = 39, - y = 35, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 26, - y = 6, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 40, - y = 29, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 4, - y = 19, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 11, - y = 8, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "PetalburgWoods_EventScript_Sign2"), - ), - ), - // MtChimney (MAP_MT_CHIMNEY) - MapDef( - regionId = 1, - bankId = 74, - mapId = 12, - width = 40, - height = 47, - paletteIdx1 = 100, - paletteIdx2 = 106, - unknownShort = 406, - unknownByte = 56, - borderTiles = - listOf( - Tile2D(0x0271, 0), Tile2D(0x0271, 0), Tile2D(0x0271, 0), Tile2D(0x0271, 0)), - lighting = Lighting.REGULAR, - weather = Weather.DENSE_BRIGHT_MIST, - mapType = MapType.ROUTE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 17, - y = 36, - elevation = 0, - targetRegionId = 1, - targetBankId = 69, - targetMapId = 1, - targetX = 6, - targetY = 11, - targetElevation = 0), - WarpTile( - x = 18, - y = 36, - elevation = 0, - targetRegionId = 1, - targetBankId = 69, - targetMapId = 1, - targetX = 7, - targetY = 11, - targetElevation = 0), - WarpTile( - x = 20, - y = 41, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 13, - targetX = 13, - targetY = 5, - targetElevation = 2), - WarpTile( - x = 21, - y = 41, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 13, - targetX = 14, - targetY = 5, - targetElevation = 2), - ), - npcs = emptyList(), - bgEvents = - listOf( - BgEventDef( - x = 14, - y = 6, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "MtChimney_EventScript_MeteoriteMachine"), - BgEventDef( - x = 24, - y = 37, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "MtChimney_EventScript_RouteSign"), - ), - ), - // JaggedPass (MAP_JAGGED_PASS) - MapDef( - regionId = 1, - bankId = 74, - mapId = 13, - width = 30, - height = 46, - paletteIdx1 = 100, - paletteIdx2 = 106, - unknownShort = 366, - unknownByte = 76, - borderTiles = - listOf( - Tile2D(0x0271, 0), Tile2D(0x0271, 0), Tile2D(0x0271, 0), Tile2D(0x0271, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.ROUTE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 14, - y = 40, - elevation = 2, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 27, - targetX = 6, - targetY = 46, - targetElevation = 2), - WarpTile( - x = 15, - y = 40, - elevation = 2, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 27, - targetX = 7, - targetY = 46, - targetElevation = 2), - WarpTile( - x = 13, - y = 5, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 12, - targetX = 20, - targetY = 41, - targetElevation = 2), - WarpTile( - x = 14, - y = 5, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 12, - targetX = 21, - targetY = 41, - targetElevation = 2), - WarpTile( - x = 16, - y = 18, - elevation = 0, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 86, - targetX = 10, - targetY = 34, - targetElevation = 2), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 55, - x = 10, - y = 8, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 3, - script = "JaggedPass_EventScript_Eric"), - NpcDef( - entityIdx = 1, - graphicsId = 31, - x = 16, - y = 35, - elevation = 3, - movementType = 14, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "JaggedPass_EventScript_Ethan"), - NpcDef( - entityIdx = 3, - graphicsId = 32, - x = 9, - y = 21, - elevation = 3, - movementType = 16, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "JaggedPass_EventScript_Diana"), - NpcDef( - entityIdx = 5, - graphicsId = 32, - x = 14, - y = 25, - elevation = 3, - movementType = 10, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 3, - script = "JaggedPass_EventScript_Autumn"), - NpcDef( - entityIdx = 6, - graphicsId = 56, - x = 18, - y = 25, - elevation = 3, - movementType = 9, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 2, - script = "JaggedPass_EventScript_Julio"), - ), - bgEvents = - listOf( - BgEventDef( - x = 8, - y = 10, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 7, - y = 29, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - ), - ), - // FieryPath (MAP_FIERY_PATH) - MapDef( - regionId = 1, - bankId = 74, - mapId = 14, - width = 35, - height = 38, - paletteIdx1 = 100, - paletteIdx2 = 106, - unknownShort = 366, - unknownByte = 74, - borderTiles = - listOf( - Tile2D(0x0271, 0), Tile2D(0x0271, 0), Tile2D(0x0271, 0), Tile2D(0x0271, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.UNDERGROUND, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 26, - y = 36, - elevation = 2, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 27, - targetX = 11, - targetY = 36, - targetElevation = 0), - WarpTile( - x = 26, - y = 4, - elevation = 2, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 27, - targetX = 22, - targetY = 10, - targetElevation = 0), - ), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // MtPyre_1F (MAP_MT_PYRE_1F) - MapDef( - regionId = 1, - bankId = 74, - mapId = 15, - width = 22, - height = 19, - paletteIdx1 = 100, - paletteIdx2 = 129, - unknownShort = 432, - unknownByte = 65, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 17, - y = 18, - elevation = 2, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 37, - targetX = 22, - targetY = 29, - targetElevation = 0), - WarpTile( - x = 3, - y = 6, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 21, - targetX = 10, - targetY = 42, - targetElevation = 2), - WarpTile( - x = 18, - y = 18, - elevation = 2, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 37, - targetX = 22, - targetY = 29, - targetElevation = 0), - WarpTile( - x = 4, - y = 6, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 21, - targetX = 10, - targetY = 42, - targetElevation = 2), - WarpTile( - x = 11, - y = 1, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 16, - targetX = 2, - targetY = 1, - targetElevation = 2), - WarpTile( - x = 20, - y = 9, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 16, - targetX = 11, - targetY = 9, - targetElevation = 2), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 30, - x = 21, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "MtPyre_1F_EventScript_CleanseTagWoman"), - NpcDef( - entityIdx = 1, - graphicsId = 18, - x = 17, - y = 8, - elevation = 3, - movementType = 7, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 1, - script = "MtPyre_1F_EventScript_PokefanF"), - NpcDef( - entityIdx = 2, - graphicsId = 65, - x = 13, - y = 10, - elevation = 3, - movementType = 9, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 2, - script = "MtPyre_1F_EventScript_Man"), - ), - bgEvents = emptyList(), - ), - // MtPyre_2F (MAP_MT_PYRE_2F) - MapDef( - regionId = 1, - bankId = 74, - mapId = 16, - width = 13, - height = 13, - paletteIdx1 = 100, - paletteIdx2 = 129, - unknownShort = 432, - unknownByte = 65, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 2, - y = 1, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 15, - targetX = 11, - targetY = 1, - targetElevation = 2), - WarpTile( - x = 10, - y = 1, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 17, - targetX = 10, - targetY = 1, - targetElevation = 2), - WarpTile( - x = 10, - y = 12, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 17, - targetX = 10, - targetY = 12, - targetElevation = 2), - WarpTile( - x = 6, - y = 12, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 17, - targetX = 6, - targetY = 12, - targetElevation = 2), - WarpTile( - x = 11, - y = 9, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 15, - targetX = 20, - targetY = 9, - targetElevation = 2), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 39, - x = 3, - y = 6, - elevation = 3, - movementType = 10, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 3, - script = "MtPyre_2F_EventScript_Mark"), - NpcDef( - entityIdx = 2, - graphicsId = 16, - x = 9, - y = 3, - elevation = 3, - movementType = 10, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 3, - script = "MtPyre_2F_EventScript_Woman"), - NpcDef( - entityIdx = 3, - graphicsId = 25, - x = 12, - y = 10, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "MtPyre_2F_EventScript_PokefanM"), - NpcDef( - entityIdx = 4, - graphicsId = 26, - x = 2, - y = 9, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "MtPyre_2F_EventScript_Dez"), - NpcDef( - entityIdx = 5, - graphicsId = 65, - x = 3, - y = 9, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "MtPyre_2F_EventScript_Luke"), - NpcDef( - entityIdx = 6, - graphicsId = 44, - x = 6, - y = 9, - elevation = 3, - movementType = 7, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 1, - script = "MtPyre_2F_EventScript_Zander"), - NpcDef( - entityIdx = 7, - graphicsId = 40, - x = 6, - y = 6, - elevation = 3, - movementType = 17, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "MtPyre_2F_EventScript_Leah"), - ), - bgEvents = emptyList(), - ), - // MtPyre_3F (MAP_MT_PYRE_3F) - MapDef( - regionId = 1, - bankId = 74, - mapId = 17, - width = 13, - height = 13, - paletteIdx1 = 100, - paletteIdx2 = 129, - unknownShort = 432, - unknownByte = 65, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 10, - y = 1, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 16, - targetX = 10, - targetY = 1, - targetElevation = 2), - WarpTile( - x = 2, - y = 1, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 18, - targetX = 2, - targetY = 5, - targetElevation = 2), - WarpTile( - x = 9, - y = 10, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 18, - targetX = 9, - targetY = 10, - targetElevation = 2), - WarpTile( - x = 1, - y = 12, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 18, - targetX = 2, - targetY = 12, - targetElevation = 2), - WarpTile( - x = 10, - y = 12, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 16, - targetX = 10, - targetY = 12, - targetElevation = 2), - WarpTile( - x = 6, - y = 12, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 16, - targetX = 6, - targetY = 12, - targetElevation = 2), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 37, - x = 1, - y = 4, - elevation = 3, - movementType = 18, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "MtPyre_3F_EventScript_William"), - NpcDef( - entityIdx = 1, - graphicsId = 47, - x = 11, - y = 4, - elevation = 3, - movementType = 17, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "MtPyre_3F_EventScript_Kayla"), - NpcDef( - entityIdx = 3, - graphicsId = 20, - x = 6, - y = 4, - elevation = 3, - movementType = 14, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "MtPyre_3F_EventScript_Gabrielle"), - ), - bgEvents = emptyList(), - ), - // MtPyre_4F (MAP_MT_PYRE_4F) - MapDef( - regionId = 1, - bankId = 74, - mapId = 18, - width = 13, - height = 13, - paletteIdx1 = 100, - paletteIdx2 = 129, - unknownShort = 432, - unknownByte = 65, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 10, - y = 1, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 19, - targetX = 10, - targetY = 5, - targetElevation = 2), - WarpTile( - x = 2, - y = 5, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 17, - targetX = 2, - targetY = 1, - targetElevation = 2), - WarpTile( - x = 12, - y = 10, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 19, - targetX = 12, - targetY = 10, - targetElevation = 2), - WarpTile( - x = 12, - y = 12, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 19, - targetX = 12, - targetY = 12, - targetElevation = 2), - WarpTile( - x = 9, - y = 10, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 17, - targetX = 9, - targetY = 10, - targetElevation = 2), - WarpTile( - x = 2, - y = 12, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 17, - targetX = 1, - targetY = 12, - targetElevation = 2), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 40, - x = 11, - y = 7, - elevation = 3, - movementType = 24, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "MtPyre_4F_EventScript_Tasha"), - ), - bgEvents = emptyList(), - ), - // MtPyre_5F (MAP_MT_PYRE_5F) - MapDef( - regionId = 1, - bankId = 74, - mapId = 19, - width = 13, - height = 13, - paletteIdx1 = 100, - paletteIdx2 = 129, - unknownShort = 432, - unknownByte = 65, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 2, - y = 1, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 20, - targetX = 2, - targetY = 1, - targetElevation = 2), - WarpTile( - x = 10, - y = 5, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 18, - targetX = 10, - targetY = 1, - targetElevation = 2), - WarpTile( - x = 1, - y = 10, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 20, - targetX = 1, - targetY = 10, - targetElevation = 2), - WarpTile( - x = 12, - y = 10, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 18, - targetX = 12, - targetY = 10, - targetElevation = 2), - WarpTile( - x = 12, - y = 12, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 18, - targetX = 12, - targetY = 12, - targetElevation = 2), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 44, - x = 3, - y = 7, - elevation = 3, - movementType = 17, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "MtPyre_5F_EventScript_Atsushi"), - ), - bgEvents = emptyList(), - ), - // MtPyre_6F (MAP_MT_PYRE_6F) - MapDef( - regionId = 1, - bankId = 74, - mapId = 20, - width = 13, - height = 13, - paletteIdx1 = 100, - paletteIdx2 = 129, - unknownShort = 432, - unknownByte = 65, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 2, - y = 1, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 19, - targetX = 2, - targetY = 1, - targetElevation = 2), - WarpTile( - x = 1, - y = 10, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 19, - targetX = 1, - targetY = 10, - targetElevation = 2), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 40, - x = 6, - y = 3, - elevation = 3, - movementType = 23, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "MtPyre_6F_EventScript_Valerie"), - NpcDef( - entityIdx = 2, - graphicsId = 37, - x = 10, - y = 3, - elevation = 3, - movementType = 24, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "MtPyre_6F_EventScript_Cedric"), - ), - bgEvents = emptyList(), - ), - // MtPyre_Exterior (MAP_MT_PYRE_EXTERIOR) - MapDef( - regionId = 1, - bankId = 74, - mapId = 21, - width = 38, - height = 51, - paletteIdx1 = 100, - paletteIdx2 = 129, - unknownShort = 434, - unknownByte = 65, - borderTiles = - listOf( - Tile2D(0x00A1, 0), Tile2D(0x00A1, 0), Tile2D(0x00A1, 0), Tile2D(0x00A1, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.ROUTE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 10, - y = 42, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 15, - targetX = 3, - targetY = 6, - targetElevation = 2), - WarpTile( - x = 19, - y = 10, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 22, - targetX = 23, - targetY = 31, - targetElevation = 2), - WarpTile( - x = 20, - y = 10, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 22, - targetX = 23, - targetY = 31, - targetElevation = 2), - ), - npcs = emptyList(), - bgEvents = - listOf( - BgEventDef( - x = 9, - y = 8, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 16, - y = 22, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - ), - ), - // MtPyre_Summit (MAP_MT_PYRE_SUMMIT) - MapDef( - regionId = 1, - bankId = 74, - mapId = 22, - width = 50, - height = 37, - paletteIdx1 = 100, - paletteIdx2 = 129, - unknownShort = 434, - unknownByte = 65, - borderTiles = - listOf( - Tile2D(0x00A1, 0), Tile2D(0x00A1, 0), Tile2D(0x00A1, 0), Tile2D(0x00A1, 0)), - lighting = Lighting.REGULAR, - weather = Weather.STEADY_MIST, - mapType = MapType.ROUTE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 22, - y = 31, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 21, - targetX = 19, - targetY = 10, - targetElevation = 2), - WarpTile( - x = 23, - y = 31, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 21, - targetX = 19, - targetY = 10, - targetElevation = 2), - WarpTile( - x = 24, - y = 31, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 21, - targetX = 19, - targetY = 10, - targetElevation = 2), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 29, - x = 22, - y = 5, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "MtPyre_Summit_EventScript_OldMan"), - NpcDef( - entityIdx = 2, - graphicsId = 22, - x = 23, - y = 5, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "MtPyre_Summit_EventScript_OldLady"), - ), - bgEvents = - listOf( - BgEventDef( - x = 9, - y = 25, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 37, - y = 7, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - ), - ), - // AquaHideout_1F (MAP_AQUA_HIDEOUT_1F) - MapDef( - regionId = 1, - bankId = 74, - mapId = 23, - width = 28, - height = 30, - paletteIdx1 = 100, - paletteIdx2 = 129, - unknownShort = 430, - unknownByte = 197, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 13, - y = 27, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 5, - targetX = 70, - targetY = 5, - targetElevation = 0), - WarpTile( - x = 14, - y = 27, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 5, - targetX = 70, - targetY = 5, - targetElevation = 0), - WarpTile( - x = 22, - y = 1, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 24, - targetX = 29, - targetY = 1, - targetElevation = 2), - ), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // AquaHideout_B1F (MAP_AQUA_HIDEOUT_B1F) - MapDef( - regionId = 1, - bankId = 74, - mapId = 24, - width = 51, - height = 24, - paletteIdx1 = 100, - paletteIdx2 = 129, - unknownShort = 430, - unknownByte = 197, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 29, - y = 1, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 23, - targetX = 22, - targetY = 1, - targetElevation = 2), - WarpTile( - x = 18, - y = 1, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 25, - targetX = 18, - targetY = 1, - targetElevation = 2), - WarpTile( - x = 12, - y = 1, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 25, - targetX = 12, - targetY = 1, - targetElevation = 2), - WarpTile( - x = 3, - y = 3, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 25, - targetX = 3, - targetY = 3, - targetElevation = 2), - WarpTile( - x = 31, - y = 4, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 24, - targetX = 27, - targetY = 12, - targetElevation = 2), - WarpTile( - x = 27, - y = 4, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 24, - targetX = 3, - targetY = 15, - targetElevation = 2), - WarpTile( - x = 20, - y = 4, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 24, - targetX = 32, - targetY = 19, - targetElevation = 2), - WarpTile( - x = 27, - y = 12, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 24, - targetX = 31, - targetY = 4, - targetElevation = 2), - WarpTile( - x = 3, - y = 15, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 24, - targetX = 27, - targetY = 4, - targetElevation = 2), - WarpTile( - x = 3, - y = 20, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 24, - targetX = 45, - targetY = 3, - targetElevation = 2), - WarpTile( - x = 32, - y = 19, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 24, - targetX = 20, - targetY = 4, - targetElevation = 2), - WarpTile( - x = 23, - y = 10, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 24, - targetX = 42, - targetY = 17, - targetElevation = 2), - WarpTile( - x = 45, - y = 3, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 24, - targetX = 3, - targetY = 20, - targetElevation = 2), - WarpTile( - x = 42, - y = 5, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 24, - targetX = 48, - targetY = 9, - targetElevation = 2), - WarpTile( - x = 45, - y = 5, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 24, - targetX = 45, - targetY = 3, - targetElevation = 2), - WarpTile( - x = 48, - y = 5, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 24, - targetX = 42, - targetY = 9, - targetElevation = 2), - WarpTile( - x = 42, - y = 9, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 24, - targetX = 48, - targetY = 5, - targetElevation = 2), - WarpTile( - x = 45, - y = 9, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 24, - targetX = 45, - targetY = 13, - targetElevation = 2), - WarpTile( - x = 48, - y = 9, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 24, - targetX = 42, - targetY = 5, - targetElevation = 2), - WarpTile( - x = 42, - y = 13, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 24, - targetX = 48, - targetY = 17, - targetElevation = 2), - WarpTile( - x = 45, - y = 13, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 24, - targetX = 45, - targetY = 9, - targetElevation = 2), - WarpTile( - x = 48, - y = 13, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 24, - targetX = 45, - targetY = 3, - targetElevation = 2), - WarpTile( - x = 42, - y = 17, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 24, - targetX = 23, - targetY = 10, - targetElevation = 2), - WarpTile( - x = 45, - y = 17, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 24, - targetX = 45, - targetY = 9, - targetElevation = 2), - WarpTile( - x = 48, - y = 17, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 24, - targetX = 42, - targetY = 13, - targetElevation = 2), - ), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // AquaHideout_B2F (MAP_AQUA_HIDEOUT_B2F) - MapDef( - regionId = 1, - bankId = 74, - mapId = 25, - width = 34, - height = 24, - paletteIdx1 = 100, - paletteIdx2 = 129, - unknownShort = 430, - unknownByte = 197, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 18, - y = 1, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 24, - targetX = 18, - targetY = 1, - targetElevation = 2), - WarpTile( - x = 12, - y = 1, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 24, - targetX = 12, - targetY = 1, - targetElevation = 2), - WarpTile( - x = 3, - y = 3, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 24, - targetX = 3, - targetY = 3, - targetElevation = 2), - WarpTile( - x = 31, - y = 8, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 25, - targetX = 5, - targetY = 8, - targetElevation = 2), - WarpTile( - x = 8, - y = 8, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 25, - targetX = 31, - targetY = 17, - targetElevation = 2), - WarpTile( - x = 5, - y = 8, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 25, - targetX = 31, - targetY = 8, - targetElevation = 2), - WarpTile( - x = 18, - y = 13, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 25, - targetX = 12, - targetY = 13, - targetElevation = 2), - WarpTile( - x = 12, - y = 13, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 25, - targetX = 18, - targetY = 13, - targetElevation = 2), - WarpTile( - x = 31, - y = 17, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 25, - targetX = 8, - targetY = 8, - targetElevation = 2), - WarpTile( - x = 32, - y = 20, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 24, - targetX = 31, - targetY = 4, - targetElevation = 2), - ), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // Underwater_SeafloorCavern (MAP_UNDERWATER_SEAFLOOR_CAVERN) - MapDef( - regionId = 1, - bankId = 74, - mapId = 26, - width = 14, - height = 9, - paletteIdx1 = 100, - paletteIdx2 = 144, - unknownShort = 411, - unknownByte = 69, - borderTiles = - listOf( - Tile2D(0x0213, 0), Tile2D(0x0213, 0), Tile2D(0x0213, 0), Tile2D(0x0213, 0)), - lighting = Lighting.REGULAR, - weather = Weather.UNDERWATER_MIST, - mapType = MapType.UNDERWATER, - encounterType = EncounterType.UNKNOWN_0x03, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 6, - y = 7, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 53, - targetX = 38, - targetY = 26, - targetElevation = 2), - ), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // SeafloorCavern_Entrance (MAP_SEAFLOOR_CAVERN_ENTRANCE) - MapDef( - regionId = 1, - bankId = 74, - mapId = 27, - width = 20, - height = 20, - paletteIdx1 = 100, - paletteIdx2 = 119, - unknownShort = 406, - unknownByte = 68, - borderTiles = - listOf( - Tile2D(0x02F1, 0), Tile2D(0x02F1, 0), Tile2D(0x02F1, 0), Tile2D(0x02F1, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.UNDERGROUND, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 10, - y = 18, - elevation = 2, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 53, - targetX = 38, - targetY = 26, - targetElevation = 2), - WarpTile( - x = 10, - y = 1, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 28, - targetX = 5, - targetY = 18, - targetElevation = 2), - ), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // SeafloorCavern_Room1 (MAP_SEAFLOOR_CAVERN_ROOM1) - MapDef( - regionId = 1, - bankId = 74, - mapId = 28, - width = 20, - height = 21, - paletteIdx1 = 100, - paletteIdx2 = 119, - unknownShort = 406, - unknownByte = 68, - borderTiles = - listOf( - Tile2D(0x02F1, 0), Tile2D(0x02F1, 0), Tile2D(0x02F1, 0), Tile2D(0x02F1, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.UNDERGROUND, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 5, - y = 18, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 27, - targetX = 10, - targetY = 1, - targetElevation = 2), - WarpTile( - x = 17, - y = 13, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 32, - targetX = 4, - targetY = 1, - targetElevation = 2), - WarpTile( - x = 6, - y = 2, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 29, - targetX = 10, - targetY = 7, - targetElevation = 2), - ), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // SeafloorCavern_Room2 (MAP_SEAFLOOR_CAVERN_ROOM2) - MapDef( - regionId = 1, - bankId = 74, - mapId = 29, - width = 18, - height = 12, - paletteIdx1 = 100, - paletteIdx2 = 119, - unknownShort = 406, - unknownByte = 68, - borderTiles = - listOf( - Tile2D(0x02F1, 0), Tile2D(0x02F1, 0), Tile2D(0x02F1, 0), Tile2D(0x02F1, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.UNDERGROUND, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 10, - y = 7, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 28, - targetX = 6, - targetY = 2, - targetElevation = 2), - WarpTile( - x = 4, - y = 10, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 31, - targetX = 13, - targetY = 1, - targetElevation = 2), - WarpTile( - x = 6, - y = 1, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 33, - targetX = 11, - targetY = 21, - targetElevation = 2), - WarpTile( - x = 11, - y = 1, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 34, - targetX = 3, - targetY = 23, - targetElevation = 2), - ), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // SeafloorCavern_Room3 (MAP_SEAFLOOR_CAVERN_ROOM3) - MapDef( - regionId = 1, - bankId = 74, - mapId = 30, - width = 16, - height = 17, - paletteIdx1 = 100, - paletteIdx2 = 119, - unknownShort = 406, - unknownByte = 68, - borderTiles = - listOf( - Tile2D(0x02F1, 0), Tile2D(0x02F1, 0), Tile2D(0x02F1, 0), Tile2D(0x02F1, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.UNDERGROUND, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 8, - y = 1, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 35, - targetX = 5, - targetY = 12, - targetElevation = 2), - WarpTile( - x = 9, - y = 13, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 34, - targetX = 5, - targetY = 1, - targetElevation = 2), - WarpTile( - x = 4, - y = 15, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 33, - targetX = 4, - targetY = 1, - targetElevation = 2), - ), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // SeafloorCavern_Room4 (MAP_SEAFLOOR_CAVERN_ROOM4) - MapDef( - regionId = 1, - bankId = 74, - mapId = 31, - width = 18, - height = 19, - paletteIdx1 = 100, - paletteIdx2 = 119, - unknownShort = 406, - unknownByte = 68, - borderTiles = - listOf( - Tile2D(0x02F1, 0), Tile2D(0x02F1, 0), Tile2D(0x02F1, 0), Tile2D(0x02F1, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.UNDERGROUND, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 13, - y = 1, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 29, - targetX = 4, - targetY = 10, - targetElevation = 2), - WarpTile( - x = 4, - y = 1, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 32, - targetX = 15, - targetY = 12, - targetElevation = 2), - WarpTile( - x = 9, - y = 10, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 32, - targetX = 7, - targetY = 17, - targetElevation = 2), - WarpTile( - x = 10, - y = 15, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 27, - targetX = 10, - targetY = 1, - targetElevation = 2), - ), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // SeafloorCavern_Room5 (MAP_SEAFLOOR_CAVERN_ROOM5) - MapDef( - regionId = 1, - bankId = 74, - mapId = 32, - width = 20, - height = 20, - paletteIdx1 = 100, - paletteIdx2 = 119, - unknownShort = 406, - unknownByte = 68, - borderTiles = - listOf( - Tile2D(0x02F1, 0), Tile2D(0x02F1, 0), Tile2D(0x02F1, 0), Tile2D(0x02F1, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.UNDERGROUND, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 4, - y = 1, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 28, - targetX = 17, - targetY = 13, - targetElevation = 2), - WarpTile( - x = 15, - y = 12, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 31, - targetX = 4, - targetY = 1, - targetElevation = 2), - WarpTile( - x = 7, - y = 17, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 31, - targetX = 9, - targetY = 10, - targetElevation = 2), - ), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // SeafloorCavern_Room6 (MAP_SEAFLOOR_CAVERN_ROOM6) - MapDef( - regionId = 1, - bankId = 74, - mapId = 33, - width = 24, - height = 23, - paletteIdx1 = 100, - paletteIdx2 = 112, - unknownShort = 406, - unknownByte = 68, - borderTiles = - listOf( - Tile2D(0x027E, 0), Tile2D(0x027E, 0), Tile2D(0x027E, 0), Tile2D(0x027E, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.UNDERGROUND, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 11, - y = 21, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 29, - targetX = 6, - targetY = 1, - targetElevation = 2), - WarpTile( - x = 4, - y = 1, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 30, - targetX = 4, - targetY = 15, - targetElevation = 2), - WarpTile( - x = 14, - y = 8, - elevation = 0, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 27, - targetX = 10, - targetY = 1, - targetElevation = 2), - ), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // SeafloorCavern_Room7 (MAP_SEAFLOOR_CAVERN_ROOM7) - MapDef( - regionId = 1, - bankId = 74, - mapId = 34, - width = 23, - height = 25, - paletteIdx1 = 100, - paletteIdx2 = 112, - unknownShort = 406, - unknownByte = 68, - borderTiles = - listOf( - Tile2D(0x027E, 0), Tile2D(0x027E, 0), Tile2D(0x027E, 0), Tile2D(0x027E, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.UNDERGROUND, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 3, - y = 23, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 29, - targetX = 11, - targetY = 1, - targetElevation = 2), - WarpTile( - x = 5, - y = 1, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 30, - targetX = 9, - targetY = 13, - targetElevation = 2), - ), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // SeafloorCavern_Room8 (MAP_SEAFLOOR_CAVERN_ROOM8) - MapDef( - regionId = 1, - bankId = 74, - mapId = 35, - width = 11, - height = 14, - paletteIdx1 = 100, - paletteIdx2 = 119, - unknownShort = 406, - unknownByte = 68, - borderTiles = - listOf( - Tile2D(0x02F1, 0), Tile2D(0x02F1, 0), Tile2D(0x02F1, 0), Tile2D(0x02F1, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.UNDERGROUND, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 5, - y = 2, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 36, - targetX = 5, - targetY = 4, - targetElevation = 2), - WarpTile( - x = 5, - y = 12, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 30, - targetX = 8, - targetY = 1, - targetElevation = 2), - ), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // SeafloorCavern_Room9 (MAP_SEAFLOOR_CAVERN_ROOM9) - MapDef( - regionId = 1, - bankId = 74, - mapId = 36, - width = 27, - height = 46, - paletteIdx1 = 100, - paletteIdx2 = 119, - unknownShort = 406, - unknownByte = 68, - borderTiles = - listOf( - Tile2D(0x02F1, 0), Tile2D(0x02F1, 0), Tile2D(0x02F1, 0), Tile2D(0x02F1, 0)), - lighting = Lighting.REGULAR, - weather = Weather.STEADY_MIST, - mapType = MapType.UNDERGROUND, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 5, - y = 4, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 35, - targetX = 5, - targetY = 2, - targetElevation = 2), - ), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // CaveOfOrigin_Entrance (MAP_CAVE_OF_ORIGIN_ENTRANCE) - MapDef( - regionId = 1, - bankId = 74, - mapId = 37, - width = 19, - height = 26, - paletteIdx1 = 100, - paletteIdx2 = 119, - unknownShort = 386, - unknownByte = 72, - borderTiles = - listOf( - Tile2D(0x0333, 0), Tile2D(0x0333, 0), Tile2D(0x0333, 0), Tile2D(0x0333, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.UNDERGROUND, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 9, - y = 20, - elevation = 2, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 7, - targetX = 31, - targetY = 16, - targetElevation = 2), - WarpTile( - x = 9, - y = 5, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 38, - targetX = 11, - targetY = 17, - targetElevation = 2), - ), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // CaveOfOrigin_1F (MAP_CAVE_OF_ORIGIN_1F) - MapDef( - regionId = 1, - bankId = 74, - mapId = 38, - width = 23, - height = 23, - paletteIdx1 = 100, - paletteIdx2 = 119, - unknownShort = 386, - unknownByte = 72, - borderTiles = - listOf( - Tile2D(0x0333, 0), Tile2D(0x0333, 0), Tile2D(0x0333, 0), Tile2D(0x0333, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.UNDERGROUND, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 11, - y = 17, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 37, - targetX = 9, - targetY = 5, - targetElevation = 2), - WarpTile( - x = 14, - y = 5, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 42, - targetX = 9, - targetY = 3, - targetElevation = 2), - ), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // CaveOfOrigin_UnusedRubySapphireMap1 (MAP_CAVE_OF_ORIGIN_UNUSED_RUBY_SAPPHIRE_MAP1) - MapDef( - regionId = 1, - bankId = 74, - mapId = 39, - width = 23, - height = 23, - paletteIdx1 = 100, - paletteIdx2 = 119, - unknownShort = 386, - unknownByte = 72, - borderTiles = - listOf( - Tile2D(0x0333, 0), Tile2D(0x0333, 0), Tile2D(0x0333, 0), Tile2D(0x0333, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.UNDERGROUND, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 13, - y = 5, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 38, - targetX = 14, - targetY = 5, - targetElevation = 2), - WarpTile( - x = 5, - y = 11, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 40, - targetX = 5, - targetY = 10, - targetElevation = 2), - ), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // CaveOfOrigin_UnusedRubySapphireMap2 (MAP_CAVE_OF_ORIGIN_UNUSED_RUBY_SAPPHIRE_MAP2) - MapDef( - regionId = 1, - bankId = 74, - mapId = 40, - width = 21, - height = 21, - paletteIdx1 = 100, - paletteIdx2 = 119, - unknownShort = 386, - unknownByte = 72, - borderTiles = - listOf( - Tile2D(0x0323, 0), Tile2D(0x0323, 0), Tile2D(0x0323, 0), Tile2D(0x0323, 0)), - lighting = Lighting.REGULAR, - weather = Weather.STEADY_MIST, - mapType = MapType.UNDERGROUND, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 5, - y = 10, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 39, - targetX = 5, - targetY = 11, - targetElevation = 2), - WarpTile( - x = 8, - y = 14, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 41, - targetX = 7, - targetY = 14, - targetElevation = 2), - ), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // CaveOfOrigin_UnusedRubySapphireMap3 (MAP_CAVE_OF_ORIGIN_UNUSED_RUBY_SAPPHIRE_MAP3) - MapDef( - regionId = 1, - bankId = 74, - mapId = 41, - width = 19, - height = 21, - paletteIdx1 = 100, - paletteIdx2 = 119, - unknownShort = 386, - unknownByte = 72, - borderTiles = - listOf( - Tile2D(0x0333, 0), Tile2D(0x0333, 0), Tile2D(0x0333, 0), Tile2D(0x0333, 0)), - lighting = Lighting.REGULAR, - weather = Weather.STEADY_MIST, - mapType = MapType.UNDERGROUND, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 7, - y = 14, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 40, - targetX = 8, - targetY = 14, - targetElevation = 2), - WarpTile( - x = 12, - y = 6, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 42, - targetX = 9, - targetY = 3, - targetElevation = 2), - ), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // CaveOfOrigin_B1F (MAP_CAVE_OF_ORIGIN_B1F) - MapDef( - regionId = 1, - bankId = 74, - mapId = 42, - width = 19, - height = 19, - paletteIdx1 = 100, - paletteIdx2 = 119, - unknownShort = 0, - unknownByte = 72, - borderTiles = - listOf( - Tile2D(0x0333, 0), Tile2D(0x0333, 0), Tile2D(0x0333, 0), Tile2D(0x0333, 0)), - lighting = Lighting.REGULAR, - weather = Weather.STEADY_MIST, - mapType = MapType.UNDERGROUND, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 9, - y = 3, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 38, - targetX = 14, - targetY = 5, - targetElevation = 2), - ), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // VictoryRoad_1F (MAP_VICTORY_ROAD_1F) - MapDef( - regionId = 1, - bankId = 74, - mapId = 43, - width = 46, - height = 45, - paletteIdx1 = 100, - paletteIdx2 = 119, - unknownShort = 429, - unknownByte = 70, - borderTiles = - listOf( - Tile2D(0x0211, 0), Tile2D(0x0211, 0), Tile2D(0x0211, 0), Tile2D(0x0211, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.UNDERGROUND, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 15, - y = 40, - elevation = 2, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 8, - targetX = 18, - targetY = 41, - targetElevation = 0), - WarpTile( - x = 39, - y = 5, - elevation = 2, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 8, - targetX = 18, - targetY = 27, - targetElevation = 0), - WarpTile( - x = 21, - y = 32, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 44, - targetX = 20, - targetY = 21, - targetElevation = 2), - WarpTile( - x = 42, - y = 38, - elevation = 3, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 44, - targetX = 42, - targetY = 25, - targetElevation = 2), - WarpTile( - x = 9, - y = 14, - elevation = 3, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 44, - targetX = 8, - targetY = 3, - targetElevation = 2), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 33, - x = 33, - y = 22, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "VictoryRoad_1F_EventScript_Edgar"), - NpcDef( - entityIdx = 1, - graphicsId = 34, - x = 6, - y = 15, - elevation = 4, - movementType = 9, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 2, - script = "VictoryRoad_1F_EventScript_Hope"), - NpcDef( - entityIdx = 2, - graphicsId = 33, - x = 27, - y = 34, - elevation = 3, - movementType = 18, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "VictoryRoad_1F_EventScript_Albert"), - NpcDef( - entityIdx = 7, - graphicsId = 34, - x = 29, - y = 17, - elevation = 3, - movementType = 10, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 3, - script = "VictoryRoad_1F_EventScript_Katelynn"), - NpcDef( - entityIdx = 8, - graphicsId = 33, - x = 32, - y = 17, - elevation = 3, - movementType = 9, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 2, - script = "VictoryRoad_1F_EventScript_Quincy"), - ), - bgEvents = - listOf( - BgEventDef( - x = 30, - y = 39, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - ), - ), - // VictoryRoad_B1F (MAP_VICTORY_ROAD_B1F) - MapDef( - regionId = 1, - bankId = 74, - mapId = 44, - width = 46, - height = 31, - paletteIdx1 = 100, - paletteIdx2 = 119, - unknownShort = 429, - unknownByte = 70, - borderTiles = - listOf( - Tile2D(0x0211, 0), Tile2D(0x0211, 0), Tile2D(0x0211, 0), Tile2D(0x0211, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.UNDERGROUND, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 30, - y = 25, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 45, - targetX = 30, - targetY = 25, - targetElevation = 2), - WarpTile( - x = 17, - y = 16, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 45, - targetX = 19, - targetY = 12, - targetElevation = 2), - WarpTile( - x = 42, - y = 25, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 43, - targetX = 42, - targetY = 38, - targetElevation = 3), - WarpTile( - x = 42, - y = 2, - elevation = 3, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 45, - targetX = 43, - targetY = 2, - targetElevation = 2), - WarpTile( - x = 8, - y = 3, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 43, - targetX = 9, - targetY = 14, - targetElevation = 3), - WarpTile( - x = 20, - y = 21, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 43, - targetX = 21, - targetY = 32, - targetElevation = 2), - WarpTile( - x = 5, - y = 26, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 45, - targetX = 5, - targetY = 26, - targetElevation = 2), - ), - npcs = - listOf( - NpcDef( - entityIdx = 13, - graphicsId = 33, - x = 37, - y = 12, - elevation = 3, - movementType = 9, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 2, - script = "VictoryRoad_B1F_EventScript_Samuel"), - NpcDef( - entityIdx = 14, - graphicsId = 34, - x = 26, - y = 16, - elevation = 3, - movementType = 7, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 1, - script = "VictoryRoad_B1F_EventScript_Shannon"), - NpcDef( - entityIdx = 15, - graphicsId = 34, - x = 5, - y = 21, - elevation = 3, - movementType = 9, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 2, - script = "VictoryRoad_B1F_EventScript_Michelle"), - NpcDef( - entityIdx = 19, - graphicsId = 33, - x = 14, - y = 16, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "VictoryRoad_B1F_EventScript_Mitchell"), - NpcDef( - entityIdx = 20, - graphicsId = 34, - x = 14, - y = 20, - elevation = 3, - movementType = 16, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "VictoryRoad_B1F_EventScript_Halle"), - ), - bgEvents = emptyList(), - ), - // VictoryRoad_B2F (MAP_VICTORY_ROAD_B2F) - MapDef( - regionId = 1, - bankId = 74, - mapId = 45, - width = 46, - height = 31, - paletteIdx1 = 100, - paletteIdx2 = 119, - unknownShort = 429, - unknownByte = 70, - borderTiles = - listOf( - Tile2D(0x0211, 0), Tile2D(0x0211, 0), Tile2D(0x0211, 0), Tile2D(0x0211, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.UNDERGROUND, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 30, - y = 25, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 44, - targetX = 30, - targetY = 25, - targetElevation = 2), - WarpTile( - x = 43, - y = 2, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 44, - targetX = 42, - targetY = 2, - targetElevation = 3), - WarpTile( - x = 19, - y = 12, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 44, - targetX = 17, - targetY = 16, - targetElevation = 2), - WarpTile( - x = 5, - y = 26, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 44, - targetX = 5, - targetY = 26, - targetElevation = 2), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 33, - x = 15, - y = 6, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "VictoryRoad_B2F_EventScript_Vito"), - NpcDef( - entityIdx = 1, - graphicsId = 33, - x = 43, - y = 14, - elevation = 3, - movementType = 7, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 1, - script = "VictoryRoad_B2F_EventScript_Owen"), - NpcDef( - entityIdx = 2, - graphicsId = 34, - x = 2, - y = 17, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "VictoryRoad_B2F_EventScript_Caroline"), - NpcDef( - entityIdx = 3, - graphicsId = 34, - x = 35, - y = 22, - elevation = 3, - movementType = 9, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 2, - script = "VictoryRoad_B2F_EventScript_Julie"), - NpcDef( - entityIdx = 5, - graphicsId = 34, - x = 25, - y = 18, - elevation = 4, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "VictoryRoad_B2F_EventScript_Dianne"), - NpcDef( - entityIdx = 6, - graphicsId = 33, - x = 25, - y = 21, - elevation = 4, - movementType = 7, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 1, - script = "VictoryRoad_B2F_EventScript_Felix"), - ), - bgEvents = - listOf( - BgEventDef( - x = 28, - y = 5, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 37, - y = 1, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - ), - ), - // ShoalCave_LowTideEntranceRoom (MAP_SHOAL_CAVE_LOW_TIDE_ENTRANCE_ROOM) - MapDef( - regionId = 1, - bankId = 74, - mapId = 46, - width = 35, - height = 35, - paletteIdx1 = 100, - paletteIdx2 = 119, - unknownShort = 432, - unknownByte = 67, - borderTiles = - listOf( - Tile2D(0x0211, 0), Tile2D(0x0211, 0), Tile2D(0x0211, 0), Tile2D(0x0211, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.UNDERGROUND, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 20, - y = 30, - elevation = 2, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 40, - targetX = 22, - targetY = 19, - targetElevation = 0), - WarpTile( - x = 19, - y = 5, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 47, - targetX = 34, - targetY = 29, - targetElevation = 2), - WarpTile( - x = 6, - y = 2, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 47, - targetX = 14, - targetY = 33, - targetElevation = 4), - WarpTile( - x = 27, - y = 2, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 47, - targetX = 40, - targetY = 33, - targetElevation = 4), - ), - npcs = - listOf( - NpcDef( - entityIdx = 1, - graphicsId = 21, - x = 18, - y = 15, - elevation = 3, - movementType = 9, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 2, - script = "ShoalCave_LowTideEntranceRoom_EventScript_ShellBellExpert"), - ), - bgEvents = emptyList(), - ), - // ShoalCave_LowTideInnerRoom (MAP_SHOAL_CAVE_LOW_TIDE_INNER_ROOM) - MapDef( - regionId = 1, - bankId = 74, - mapId = 47, - width = 46, - height = 38, - paletteIdx1 = 100, - paletteIdx2 = 119, - unknownShort = 432, - unknownByte = 67, - borderTiles = - listOf( - Tile2D(0x0211, 0), Tile2D(0x0211, 0), Tile2D(0x0211, 0), Tile2D(0x0211, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.UNDERGROUND, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 34, - y = 29, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 46, - targetX = 19, - targetY = 5, - targetElevation = 2), - WarpTile( - x = 38, - y = 15, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 48, - targetX = 3, - targetY = 12, - targetElevation = 2), - WarpTile( - x = 42, - y = 4, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 48, - targetX = 7, - targetY = 4, - targetElevation = 2), - WarpTile( - x = 19, - y = 14, - elevation = 3, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 49, - targetX = 7, - targetY = 2, - targetElevation = 2), - WarpTile( - x = 15, - y = 19, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 49, - targetX = 2, - targetY = 6, - targetElevation = 2), - WarpTile( - x = 30, - y = 25, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 49, - targetX = 19, - targetY = 11, - targetElevation = 2), - WarpTile( - x = 14, - y = 33, - elevation = 4, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 46, - targetX = 6, - targetY = 2, - targetElevation = 2), - WarpTile( - x = 40, - y = 33, - elevation = 4, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 46, - targetX = 27, - targetY = 2, - targetElevation = 2), - ), - npcs = emptyList(), - bgEvents = - listOf( - BgEventDef( - x = 31, - y = 8, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "ShoalCave_LowTideInnerRoom_EventScript_ShoalSalt1"), - BgEventDef( - x = 14, - y = 26, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "ShoalCave_LowTideInnerRoom_EventScript_ShoalSalt2"), - BgEventDef( - x = 41, - y = 20, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "ShoalCave_LowTideInnerRoom_EventScript_ShoalShell1"), - BgEventDef( - x = 41, - y = 10, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "ShoalCave_LowTideInnerRoom_EventScript_ShoalShell2"), - BgEventDef( - x = 6, - y = 9, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "ShoalCave_LowTideInnerRoom_EventScript_ShoalShell3"), - BgEventDef( - x = 16, - y = 13, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "ShoalCave_LowTideInnerRoom_EventScript_ShoalShell4"), - ), - ), - // ShoalCave_LowTideStairsRoom (MAP_SHOAL_CAVE_LOW_TIDE_STAIRS_ROOM) - MapDef( - regionId = 1, - bankId = 74, - mapId = 48, - width = 21, - height = 15, - paletteIdx1 = 100, - paletteIdx2 = 119, - unknownShort = 432, - unknownByte = 67, - borderTiles = - listOf( - Tile2D(0x0211, 0), Tile2D(0x0211, 0), Tile2D(0x0211, 0), Tile2D(0x0211, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.UNDERGROUND, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 3, - y = 12, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 47, - targetX = 38, - targetY = 15, - targetElevation = 2), - WarpTile( - x = 7, - y = 4, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 47, - targetX = 42, - targetY = 4, - targetElevation = 2), - ), - npcs = emptyList(), - bgEvents = - listOf( - BgEventDef( - x = 11, - y = 11, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "ShoalCave_LowTideStairsRoom_EventScript_ShoalSalt3"), - ), - ), - // ShoalCave_LowTideLowerRoom (MAP_SHOAL_CAVE_LOW_TIDE_LOWER_ROOM) - MapDef( - regionId = 1, - bankId = 74, - mapId = 49, - width = 31, - height = 14, - paletteIdx1 = 100, - paletteIdx2 = 119, - unknownShort = 432, - unknownByte = 67, - borderTiles = - listOf( - Tile2D(0x0211, 0), Tile2D(0x0211, 0), Tile2D(0x0211, 0), Tile2D(0x0211, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.UNDERGROUND, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 7, - y = 2, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 47, - targetX = 19, - targetY = 14, - targetElevation = 3), - WarpTile( - x = 2, - y = 6, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 47, - targetX = 15, - targetY = 19, - targetElevation = 2), - WarpTile( - x = 19, - y = 11, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 47, - targetX = 30, - targetY = 25, - targetElevation = 2), - WarpTile( - x = 28, - y = 11, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 83, - targetX = 17, - targetY = 10, - targetElevation = 2), - ), - npcs = - listOf( - NpcDef( - entityIdx = 1, - graphicsId = 44, - x = 11, - y = 4, - elevation = 3, - movementType = 2, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "ShoalCave_LowTideLowerRoom_EventScript_BlackBelt"), - ), - bgEvents = - listOf( - BgEventDef( - x = 18, - y = 2, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "ShoalCave_LowTideLowerRoom_EventScript_ShoalSalt4"), - ), - ), - // ShoalCave_HighTideEntranceRoom (MAP_SHOAL_CAVE_HIGH_TIDE_ENTRANCE_ROOM) - MapDef( - regionId = 1, - bankId = 74, - mapId = 50, - width = 35, - height = 35, - paletteIdx1 = 100, - paletteIdx2 = 119, - unknownShort = 432, - unknownByte = 67, - borderTiles = - listOf( - Tile2D(0x0211, 0), Tile2D(0x0211, 0), Tile2D(0x0211, 0), Tile2D(0x0211, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.UNDERGROUND, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = emptyList(), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // ShoalCave_HighTideInnerRoom (MAP_SHOAL_CAVE_HIGH_TIDE_INNER_ROOM) - MapDef( - regionId = 1, - bankId = 74, - mapId = 51, - width = 46, - height = 38, - paletteIdx1 = 100, - paletteIdx2 = 119, - unknownShort = 432, - unknownByte = 67, - borderTiles = - listOf( - Tile2D(0x0211, 0), Tile2D(0x0211, 0), Tile2D(0x0211, 0), Tile2D(0x0211, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.UNDERGROUND, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = emptyList(), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // NewMauville_Entrance (MAP_NEW_MAUVILLE_ENTRANCE) - MapDef( - regionId = 1, - bankId = 74, - mapId = 52, - width = 9, - height = 9, - paletteIdx1 = 100, - paletteIdx2 = 129, - unknownShort = 432, - unknownByte = 62, - borderTiles = - listOf( - Tile2D(0x0071, 0), Tile2D(0x0071, 0), Tile2D(0x0071, 0), Tile2D(0x0071, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.UNDERGROUND, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 4, - y = 6, - elevation = 2, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 25, - targetX = 35, - targetY = 24, - targetElevation = 2), - WarpTile( - x = 4, - y = 1, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 53, - targetX = 32, - targetY = 33, - targetElevation = 2), - ), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // NewMauville_Inside (MAP_NEW_MAUVILLE_INSIDE) - MapDef( - regionId = 1, - bankId = 74, - mapId = 53, - width = 41, - height = 41, - paletteIdx1 = 100, - paletteIdx2 = 130, - unknownShort = 432, - unknownByte = 62, - borderTiles = - listOf( - Tile2D(0x0208, 0), Tile2D(0x0208, 0), Tile2D(0x0208, 0), Tile2D(0x0208, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.UNDERGROUND, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 32, - y = 33, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 52, - targetX = 4, - targetY = 1, - targetElevation = 2), - ), - npcs = emptyList(), - bgEvents = - listOf( - BgEventDef( - x = 32, - y = 4, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "NewMauville_Inside_EventScript_Generator"), - BgEventDef( - x = 32, - y = 3, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "NewMauville_Inside_EventScript_Generator"), - BgEventDef( - x = 32, - y = 2, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "NewMauville_Inside_EventScript_Generator"), - BgEventDef( - x = 33, - y = 4, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "NewMauville_Inside_EventScript_Generator"), - BgEventDef( - x = 34, - y = 4, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "NewMauville_Inside_EventScript_Generator"), - BgEventDef( - x = 35, - y = 4, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "NewMauville_Inside_EventScript_Generator"), - BgEventDef( - x = 35, - y = 3, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "NewMauville_Inside_EventScript_Generator"), - BgEventDef( - x = 35, - y = 2, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "NewMauville_Inside_EventScript_Generator"), - ), - ), - // AbandonedShip_Deck (MAP_ABANDONED_SHIP_DECK) - MapDef( - regionId = 1, - bankId = 74, - mapId = 54, - width = 23, - height = 21, - paletteIdx1 = 100, - paletteIdx2 = 129, - unknownShort = 381, - unknownByte = 61, - borderTiles = - listOf( - Tile2D(0x0170, 0), Tile2D(0x0170, 0), Tile2D(0x0170, 0), Tile2D(0x0170, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.UNDERGROUND, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 13, - y = 15, - elevation = 2, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 23, - targetX = 29, - targetY = 6, - targetElevation = 2), - WarpTile( - x = 14, - y = 15, - elevation = 2, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 23, - targetX = 29, - targetY = 6, - targetElevation = 2), - WarpTile( - x = 13, - y = 9, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 55, - targetX = 8, - targetY = 11, - targetElevation = 2), - WarpTile( - x = 8, - y = 9, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 55, - targetX = 0, - targetY = 11, - targetElevation = 2), - WarpTile( - x = 12, - y = 5, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 63, - targetX = 7, - targetY = 6, - targetElevation = 2), - ), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // AbandonedShip_Corridors_1F (MAP_ABANDONED_SHIP_CORRIDORS_1F) - MapDef( - regionId = 1, - bankId = 74, - mapId = 55, - width = 18, - height = 12, - paletteIdx1 = 100, - paletteIdx2 = 156, - unknownShort = 381, - unknownByte = 61, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.CLOUDY, - mapType = MapType.UNDERGROUND, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 9, - y = 11, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 54, - targetX = 13, - targetY = 9, - targetElevation = 2), - WarpTile( - x = 8, - y = 11, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 54, - targetX = 13, - targetY = 9, - targetElevation = 2), - WarpTile( - x = 0, - y = 11, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 54, - targetX = 8, - targetY = 9, - targetElevation = 2), - WarpTile( - x = 1, - y = 11, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 54, - targetX = 8, - targetY = 9, - targetElevation = 2), - WarpTile( - x = 11, - y = 9, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 56, - targetX = 4, - targetY = 16, - targetElevation = 2), - WarpTile( - x = 14, - y = 9, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 56, - targetX = 13, - targetY = 16, - targetElevation = 2), - WarpTile( - x = 11, - y = 3, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 56, - targetX = 4, - targetY = 1, - targetElevation = 2), - WarpTile( - x = 14, - y = 3, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 56, - targetX = 13, - targetY = 1, - targetElevation = 2), - WarpTile( - x = 3, - y = 9, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 62, - targetX = 4, - targetY = 16, - targetElevation = 2), - WarpTile( - x = 16, - y = 2, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 57, - targetX = 8, - targetY = 2, - targetElevation = 2), - WarpTile( - x = 5, - y = 2, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 57, - targetX = 0, - targetY = 2, - targetElevation = 2), - WarpTile( - x = 3, - y = 3, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 62, - targetX = 4, - targetY = 1, - targetElevation = 2), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 35, - x = 17, - y = 7, - elevation = 3, - movementType = 2, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "AbandonedShip_Corridors_1F_EventScript_Youngster"), - NpcDef( - entityIdx = 1, - graphicsId = 54, - x = 5, - y = 10, - elevation = 3, - movementType = 0, - movementRangeX = 4, - movementRangeY = 7, - trainerType = 1, - facing = 0, - script = "AbandonedShip_Corridors_1F_EventScript_Charlie"), - ), - bgEvents = emptyList(), - ), - // AbandonedShip_Rooms_1F (MAP_ABANDONED_SHIP_ROOMS_1F) - MapDef( - regionId = 1, - bankId = 74, - mapId = 56, - width = 18, - height = 17, - paletteIdx1 = 100, - paletteIdx2 = 156, - unknownShort = 381, - unknownByte = 61, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.CLOUDY, - mapType = MapType.UNDERGROUND, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 4, - y = 16, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 55, - targetX = 11, - targetY = 9, - targetElevation = 2), - WarpTile( - x = 5, - y = 16, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 55, - targetX = 11, - targetY = 9, - targetElevation = 2), - WarpTile( - x = 4, - y = 1, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 55, - targetX = 11, - targetY = 3, - targetElevation = 2), - WarpTile( - x = 13, - y = 16, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 55, - targetX = 14, - targetY = 9, - targetElevation = 2), - WarpTile( - x = 13, - y = 1, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 55, - targetX = 14, - targetY = 3, - targetElevation = 2), - WarpTile( - x = 14, - y = 16, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 55, - targetX = 14, - targetY = 9, - targetElevation = 2), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 48, - x = 12, - y = 5, - elevation = 3, - movementType = 2, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "AbandonedShip_Rooms_1F_EventScript_Gentleman"), - NpcDef( - entityIdx = 2, - graphicsId = 45, - x = 10, - y = 11, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "AbandonedShip_Rooms_1F_EventScript_Thalia"), - NpcDef( - entityIdx = 3, - graphicsId = 35, - x = 10, - y = 16, - elevation = 3, - movementType = 16, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "AbandonedShip_Rooms_1F_EventScript_Demetrius"), - ), - bgEvents = emptyList(), - ), - // AbandonedShip_Corridors_B1F (MAP_ABANDONED_SHIP_CORRIDORS_B1F) - MapDef( - regionId = 1, - bankId = 74, - mapId = 57, - width = 13, - height = 10, - paletteIdx1 = 100, - paletteIdx2 = 156, - unknownShort = 381, - unknownByte = 61, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.CLOUDY, - mapType = MapType.UNDERGROUND, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 6, - y = 4, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 59, - targetX = 13, - targetY = 7, - targetElevation = 2), - WarpTile( - x = 3, - y = 4, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 59, - targetX = 4, - targetY = 7, - targetElevation = 2), - WarpTile( - x = 5, - y = 7, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 58, - targetX = 4, - targetY = 1, - targetElevation = 2), - WarpTile( - x = 8, - y = 7, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 58, - targetX = 13, - targetY = 1, - targetElevation = 2), - WarpTile( - x = 11, - y = 7, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 58, - targetX = 22, - targetY = 1, - targetElevation = 2), - WarpTile( - x = 11, - y = 4, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 61, - targetX = 4, - targetY = 7, - targetElevation = 2), - WarpTile( - x = 0, - y = 2, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 55, - targetX = 5, - targetY = 2, - targetElevation = 2), - WarpTile( - x = 8, - y = 2, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 55, - targetX = 16, - targetY = 2, - targetElevation = 2), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 54, - x = 2, - y = 8, - elevation = 3, - movementType = 2, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "AbandonedShip_Corridors_B1F_EventScript_TuberM"), - NpcDef( - entityIdx = 1, - graphicsId = 49, - x = 9, - y = 6, - elevation = 3, - movementType = 14, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "AbandonedShip_Corridors_B1F_EventScript_Duncan"), - ), - bgEvents = - listOf( - BgEventDef( - x = 11, - y = 4, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "AbandonedShip_Corridors_B1F_EventScript_StorageRoomDoor"), - ), - ), - // AbandonedShip_Rooms_B1F (MAP_ABANDONED_SHIP_ROOMS_B1F) - MapDef( - regionId = 1, - bankId = 74, - mapId = 58, - width = 27, - height = 8, - paletteIdx1 = 100, - paletteIdx2 = 156, - unknownShort = 381, - unknownByte = 61, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.CLOUDY, - mapType = MapType.UNDERGROUND, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 4, - y = 1, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 57, - targetX = 5, - targetY = 7, - targetElevation = 2), - WarpTile( - x = 13, - y = 1, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 57, - targetX = 8, - targetY = 7, - targetElevation = 2), - WarpTile( - x = 22, - y = 1, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 57, - targetX = 11, - targetY = 7, - targetElevation = 2), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 17, - x = 25, - y = 6, - elevation = 3, - movementType = 9, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 2, - script = "AbandonedShip_Rooms_B1F_EventScript_FatMan"), - ), - bgEvents = emptyList(), - ), - // AbandonedShip_Rooms2_B1F (MAP_ABANDONED_SHIP_ROOMS2_B1F) - MapDef( - regionId = 1, - bankId = 74, - mapId = 59, - width = 18, - height = 8, - paletteIdx1 = 100, - paletteIdx2 = 156, - unknownShort = 381, - unknownByte = 61, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.CLOUDY, - mapType = MapType.UNDERGROUND, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 4, - y = 7, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 57, - targetX = 3, - targetY = 4, - targetElevation = 2), - WarpTile( - x = 5, - y = 7, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 57, - targetX = 3, - targetY = 4, - targetElevation = 2), - WarpTile( - x = 13, - y = 7, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 57, - targetX = 6, - targetY = 4, - targetElevation = 2), - WarpTile( - x = 14, - y = 7, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 57, - targetX = 6, - targetY = 4, - targetElevation = 2), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 31, - x = 3, - y = 4, - elevation = 3, - movementType = 2, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "AbandonedShip_Rooms2_B1F_EventScript_Camper"), - ), - bgEvents = emptyList(), - ), - // AbandonedShip_Underwater1 (MAP_ABANDONED_SHIP_UNDERWATER1) - MapDef( - regionId = 1, - bankId = 74, - mapId = 60, - width = 8, - height = 8, - paletteIdx1 = 100, - paletteIdx2 = 156, - unknownShort = 411, - unknownByte = 61, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.UNDERWATER_MIST, - mapType = MapType.UNDERWATER, - encounterType = EncounterType.UNKNOWN_0x03, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 3, - y = 7, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 64, - targetX = 3, - targetY = 1, - targetElevation = 2), - WarpTile( - x = 4, - y = 7, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 64, - targetX = 3, - targetY = 1, - targetElevation = 2), - ), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // AbandonedShip_Room_B1F (MAP_ABANDONED_SHIP_ROOM_B1F) - MapDef( - regionId = 1, - bankId = 74, - mapId = 61, - width = 9, - height = 8, - paletteIdx1 = 100, - paletteIdx2 = 156, - unknownShort = 381, - unknownByte = 61, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.CLOUDY, - mapType = MapType.UNDERGROUND, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 4, - y = 7, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 57, - targetX = 11, - targetY = 4, - targetElevation = 2), - WarpTile( - x = 5, - y = 7, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 57, - targetX = 11, - targetY = 4, - targetElevation = 2), - ), - npcs = emptyList(), - bgEvents = emptyList(), - ), - ) - allMaps.forEach { registerMap(it) } - } - - private fun registerDefaultMaps5() { - val allMaps = - listOf( - // AbandonedShip_Rooms2_1F (MAP_ABANDONED_SHIP_ROOMS2_1F) - MapDef( - regionId = 1, - bankId = 74, - mapId = 62, - width = 9, - height = 17, - paletteIdx1 = 100, - paletteIdx2 = 156, - unknownShort = 381, - unknownByte = 61, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.CLOUDY, - mapType = MapType.UNDERGROUND, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 4, - y = 16, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 55, - targetX = 3, - targetY = 9, - targetElevation = 2), - WarpTile( - x = 5, - y = 16, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 55, - targetX = 3, - targetY = 9, - targetElevation = 2), - WarpTile( - x = 4, - y = 1, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 55, - targetX = 3, - targetY = 3, - targetElevation = 2), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 65, - x = 7, - y = 13, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "AbandonedShip_Rooms2_1F_EventScript_Dan"), - NpcDef( - entityIdx = 1, - graphicsId = 26, - x = 6, - y = 13, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "AbandonedShip_Rooms2_1F_EventScript_Kira"), - NpcDef( - entityIdx = 3, - graphicsId = 55, - x = 3, - y = 2, - elevation = 3, - movementType = 10, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 3, - script = "AbandonedShip_Rooms2_1F_EventScript_Garrison"), - NpcDef( - entityIdx = 4, - graphicsId = 53, - x = 7, - y = 2, - elevation = 3, - movementType = 9, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 2, - script = "AbandonedShip_Rooms2_1F_EventScript_Jani"), - ), - bgEvents = emptyList(), - ), - // AbandonedShip_CaptainsOffice (MAP_ABANDONED_SHIP_CAPTAINS_OFFICE) - MapDef( - regionId = 1, - bankId = 74, - mapId = 63, - width = 9, - height = 7, - paletteIdx1 = 100, - paletteIdx2 = 129, - unknownShort = 381, - unknownByte = 61, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.CLOUDY, - mapType = MapType.UNDERGROUND, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 7, - y = 6, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 54, - targetX = 12, - targetY = 5, - targetElevation = 2), - WarpTile( - x = 8, - y = 6, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 54, - targetX = 12, - targetY = 5, - targetElevation = 2), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 46, - x = 3, - y = 4, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "AbandonedShip_CaptainsOffice_EventScript_CaptSternAide"), - ), - bgEvents = emptyList(), - ), - // AbandonedShip_Underwater2 (MAP_ABANDONED_SHIP_UNDERWATER2) - MapDef( - regionId = 1, - bankId = 74, - mapId = 64, - width = 21, - height = 7, - paletteIdx1 = 100, - paletteIdx2 = 156, - unknownShort = 411, - unknownByte = 61, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.UNDERWATER_MIST, - mapType = MapType.UNDERWATER, - encounterType = EncounterType.UNKNOWN_0x03, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 3, - y = 1, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 60, - targetX = 3, - targetY = 7, - targetElevation = 2), - ), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // AbandonedShip_HiddenFloorCorridors (MAP_ABANDONED_SHIP_HIDDEN_FLOOR_CORRIDORS) - MapDef( - regionId = 1, - bankId = 74, - mapId = 65, - width = 13, - height = 11, - paletteIdx1 = 100, - paletteIdx2 = 156, - unknownShort = 381, - unknownByte = 61, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.CLOUDY, - mapType = MapType.UNDERGROUND, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 3, - y = 8, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 66, - targetX = 6, - targetY = 14, - targetElevation = 2), - WarpTile( - x = 6, - y = 8, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 66, - targetX = 21, - targetY = 14, - targetElevation = 2), - WarpTile( - x = 9, - y = 8, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 66, - targetX = 36, - targetY = 14, - targetElevation = 2), - WarpTile( - x = 3, - y = 3, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 66, - targetX = 6, - targetY = 1, - targetElevation = 2), - WarpTile( - x = 6, - y = 3, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 66, - targetX = 21, - targetY = 1, - targetElevation = 2), - WarpTile( - x = 9, - y = 3, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 66, - targetX = 36, - targetY = 1, - targetElevation = 2), - ), - npcs = emptyList(), - bgEvents = - listOf( - BgEventDef( - x = 3, - y = 8, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "AbandonedShip_HiddenFloorCorridors_EventScript_Room1Door"), - BgEventDef( - x = 6, - y = 8, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "AbandonedShip_HiddenFloorCorridors_EventScript_Room2Door"), - BgEventDef( - x = 3, - y = 4, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "AbandonedShip_HiddenFloorCorridors_EventScript_Room4Door"), - BgEventDef( - x = 9, - y = 4, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "AbandonedShip_HiddenFloorCorridors_EventScript_Room6Door"), - ), - ), - // AbandonedShip_HiddenFloorRooms (MAP_ABANDONED_SHIP_HIDDEN_FLOOR_ROOMS) - MapDef( - regionId = 1, - bankId = 74, - mapId = 66, - width = 44, - height = 15, - paletteIdx1 = 100, - paletteIdx2 = 156, - unknownShort = 381, - unknownByte = 61, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.CLOUDY, - mapType = MapType.UNDERGROUND, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 6, - y = 14, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 65, - targetX = 3, - targetY = 8, - targetElevation = 2), - WarpTile( - x = 7, - y = 14, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 65, - targetX = 3, - targetY = 8, - targetElevation = 2), - WarpTile( - x = 21, - y = 14, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 65, - targetX = 6, - targetY = 8, - targetElevation = 2), - WarpTile( - x = 22, - y = 14, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 65, - targetX = 6, - targetY = 8, - targetElevation = 2), - WarpTile( - x = 36, - y = 14, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 65, - targetX = 9, - targetY = 8, - targetElevation = 2), - WarpTile( - x = 37, - y = 14, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 65, - targetX = 9, - targetY = 8, - targetElevation = 2), - WarpTile( - x = 6, - y = 1, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 65, - targetX = 3, - targetY = 3, - targetElevation = 2), - WarpTile( - x = 21, - y = 1, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 65, - targetX = 6, - targetY = 3, - targetElevation = 2), - WarpTile( - x = 36, - y = 1, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 65, - targetX = 9, - targetY = 3, - targetElevation = 2), - ), - npcs = emptyList(), - bgEvents = - listOf( - BgEventDef( - x = 42, - y = 10, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 20, - y = 5, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 1, - y = 12, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 1, - y = 2, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 8, - y = 5, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "AbandonedShip_HiddenFloorRooms_EventScript_Trash"), - BgEventDef( - x = 11, - y = 3, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "AbandonedShip_HiddenFloorRooms_EventScript_Trash"), - BgEventDef( - x = 10, - y = 10, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "AbandonedShip_HiddenFloorRooms_EventScript_Trash"), - BgEventDef( - x = 16, - y = 3, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "AbandonedShip_HiddenFloorRooms_EventScript_Trash"), - BgEventDef( - x = 25, - y = 2, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "AbandonedShip_HiddenFloorRooms_EventScript_Trash"), - BgEventDef( - x = 24, - y = 6, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "AbandonedShip_HiddenFloorRooms_EventScript_Trash"), - ), - ), - // IslandCave (MAP_ISLAND_CAVE) - MapDef( - regionId = 1, - bankId = 74, - mapId = 67, - width = 17, - height = 33, - paletteIdx1 = 100, - paletteIdx2 = 119, - unknownShort = 438, - unknownByte = 81, - borderTiles = - listOf( - Tile2D(0x02D9, 0), Tile2D(0x02D9, 0), Tile2D(0x02D9, 0), Tile2D(0x02D9, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.UNDERGROUND, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 8, - y = 29, - elevation = 2, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 20, - targetX = 9, - targetY = 20, - targetElevation = 0), - WarpTile( - x = 8, - y = 20, - elevation = 0, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 67, - targetX = 8, - targetY = 11, - targetElevation = 2), - WarpTile( - x = 8, - y = 11, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 67, - targetX = 8, - targetY = 20, - targetElevation = 0), - ), - npcs = emptyList(), - bgEvents = - listOf( - BgEventDef( - x = 8, - y = 20, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "IslandCave_EventScript_CaveEntranceMiddle"), - BgEventDef( - x = 7, - y = 20, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "IslandCave_EventScript_CaveEntranceSide"), - BgEventDef( - x = 9, - y = 20, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "IslandCave_EventScript_CaveEntranceSide"), - ), - ), - // AncientTomb (MAP_ANCIENT_TOMB) - MapDef( - regionId = 1, - bankId = 74, - mapId = 68, - width = 17, - height = 33, - paletteIdx1 = 100, - paletteIdx2 = 119, - unknownShort = 438, - unknownByte = 83, - borderTiles = - listOf( - Tile2D(0x02D9, 0), Tile2D(0x02D9, 0), Tile2D(0x02D9, 0), Tile2D(0x02D9, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.UNDERGROUND, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 8, - y = 29, - elevation = 2, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 35, - targetX = 7, - targetY = 55, - targetElevation = 0), - WarpTile( - x = 8, - y = 20, - elevation = 0, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 68, - targetX = 8, - targetY = 11, - targetElevation = 2), - WarpTile( - x = 8, - y = 11, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 68, - targetX = 8, - targetY = 20, - targetElevation = 0), - ), - npcs = emptyList(), - bgEvents = - listOf( - BgEventDef( - x = 8, - y = 20, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "AncientTomb_EventScript_CaveEntranceMiddle"), - BgEventDef( - x = 7, - y = 20, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "AncientTomb_EventScript_CaveEntranceSide"), - BgEventDef( - x = 9, - y = 20, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "AncientTomb_EventScript_CaveEntranceSide"), - ), - ), - // Underwater_Route134 (MAP_UNDERWATER_ROUTE134) - MapDef( - regionId = 1, - bankId = 74, - mapId = 69, - width = 18, - height = 10, - paletteIdx1 = 100, - paletteIdx2 = 144, - unknownShort = 411, - unknownByte = 79, - borderTiles = - listOf( - Tile2D(0x0213, 0), Tile2D(0x0213, 0), Tile2D(0x0213, 0), Tile2D(0x0213, 0)), - lighting = Lighting.REGULAR, - weather = Weather.UNDERWATER_MIST, - mapType = MapType.UNDERWATER, - encounterType = EncounterType.UNKNOWN_0x03, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 8, - y = 8, - elevation = 0, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 70, - targetX = 7, - targetY = 1, - targetElevation = 0), - ), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // Underwater_SealedChamber (MAP_UNDERWATER_SEALED_CHAMBER) - MapDef( - regionId = 1, - bankId = 74, - mapId = 70, - width = 22, - height = 48, - paletteIdx1 = 100, - paletteIdx2 = 144, - unknownShort = 411, - unknownByte = 79, - borderTiles = - listOf( - Tile2D(0x0213, 0), Tile2D(0x0213, 0), Tile2D(0x0213, 0), Tile2D(0x0213, 0)), - lighting = Lighting.REGULAR, - weather = Weather.UNDERWATER_MIST, - mapType = MapType.UNDERWATER, - encounterType = EncounterType.UNKNOWN_0x03, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 7, - y = 1, - elevation = 0, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 69, - targetX = 8, - targetY = 8, - targetElevation = 0), - ), - npcs = emptyList(), - bgEvents = - listOf( - BgEventDef( - x = 12, - y = 43, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "Underwater_SealedChamber_EventScript_Braille"), - ), - ), - // SealedChamber_OuterRoom (MAP_SEALED_CHAMBER_OUTER_ROOM) - MapDef( - regionId = 1, - bankId = 74, - mapId = 71, - width = 21, - height = 23, - paletteIdx1 = 100, - paletteIdx2 = 119, - unknownShort = 438, - unknownByte = 78, - borderTiles = - listOf( - Tile2D(0x0023, 0), Tile2D(0x0023, 0), Tile2D(0x0023, 0), Tile2D(0x0023, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.UNDERGROUND, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 10, - y = 2, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 72, - targetX = 10, - targetY = 19, - targetElevation = 2), - ), - npcs = emptyList(), - bgEvents = - listOf( - BgEventDef( - x = 5, - y = 6, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "SealedChamber_OuterRoom_EventScript_BrailleABC"), - BgEventDef( - x = 5, - y = 9, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "SealedChamber_OuterRoom_EventScript_BrailleGHI"), - BgEventDef( - x = 5, - y = 12, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "SealedChamber_OuterRoom_EventScript_BrailleMNO"), - BgEventDef( - x = 5, - y = 15, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "SealedChamber_OuterRoom_EventScript_BrailleTUV"), - BgEventDef( - x = 11, - y = 6, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "SealedChamber_OuterRoom_EventScript_BrailleDEF"), - BgEventDef( - x = 11, - y = 9, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "SealedChamber_OuterRoom_EventScript_BrailleJKL"), - BgEventDef( - x = 11, - y = 12, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "SealedChamber_OuterRoom_EventScript_BraillePQRS"), - BgEventDef( - x = 11, - y = 15, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "SealedChamber_OuterRoom_EventScript_BrailleWXYZ"), - BgEventDef( - x = 16, - y = 6, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "SealedChamber_OuterRoom_EventScript_BraillePeriod"), - BgEventDef( - x = 16, - y = 9, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "SealedChamber_OuterRoom_EventScript_BrailleComma"), - BgEventDef( - x = 10, - y = 2, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "SealedChamber_OuterRoom_EventScript_InnerRoomEntranceWall"), - BgEventDef( - x = 6, - y = 6, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "SealedChamber_OuterRoom_EventScript_BrailleABC"), - BgEventDef( - x = 4, - y = 6, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "SealedChamber_OuterRoom_EventScript_BrailleABC"), - BgEventDef( - x = 4, - y = 9, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "SealedChamber_OuterRoom_EventScript_BrailleGHI"), - BgEventDef( - x = 6, - y = 9, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "SealedChamber_OuterRoom_EventScript_BrailleGHI"), - BgEventDef( - x = 4, - y = 12, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "SealedChamber_OuterRoom_EventScript_BrailleMNO"), - BgEventDef( - x = 6, - y = 12, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "SealedChamber_OuterRoom_EventScript_BrailleMNO"), - BgEventDef( - x = 4, - y = 15, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "SealedChamber_OuterRoom_EventScript_BrailleTUV"), - BgEventDef( - x = 6, - y = 15, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "SealedChamber_OuterRoom_EventScript_BrailleTUV"), - BgEventDef( - x = 10, - y = 6, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "SealedChamber_OuterRoom_EventScript_BrailleDEF"), - BgEventDef( - x = 12, - y = 6, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "SealedChamber_OuterRoom_EventScript_BrailleDEF"), - BgEventDef( - x = 10, - y = 9, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "SealedChamber_OuterRoom_EventScript_BrailleJKL"), - BgEventDef( - x = 12, - y = 9, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "SealedChamber_OuterRoom_EventScript_BrailleJKL"), - BgEventDef( - x = 10, - y = 12, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "SealedChamber_OuterRoom_EventScript_BraillePQRS"), - BgEventDef( - x = 12, - y = 12, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "SealedChamber_OuterRoom_EventScript_BraillePQRS"), - BgEventDef( - x = 10, - y = 15, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "SealedChamber_OuterRoom_EventScript_BrailleWXYZ"), - BgEventDef( - x = 12, - y = 15, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "SealedChamber_OuterRoom_EventScript_BrailleWXYZ"), - BgEventDef( - x = 9, - y = 2, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "SealedChamber_OuterRoom_EventScript_BrailleDigHere"), - BgEventDef( - x = 11, - y = 2, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "SealedChamber_OuterRoom_EventScript_BrailleDigHere"), - ), - ), - // SealedChamber_InnerRoom (MAP_SEALED_CHAMBER_INNER_ROOM) - MapDef( - regionId = 1, - bankId = 74, - mapId = 72, - width = 21, - height = 23, - paletteIdx1 = 100, - paletteIdx2 = 119, - unknownShort = 438, - unknownByte = 78, - borderTiles = - listOf( - Tile2D(0x0023, 0), Tile2D(0x0023, 0), Tile2D(0x0023, 0), Tile2D(0x0023, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.UNDERGROUND, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 10, - y = 19, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 71, - targetX = 10, - targetY = 2, - targetElevation = 2), - ), - npcs = emptyList(), - bgEvents = - listOf( - BgEventDef( - x = 10, - y = 4, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "SealedChamber_InnerRoom_EventScript_BrailleBackWall"), - BgEventDef( - x = 6, - y = 8, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "SealedChamber_InnerRoom_EventScript_BrailleStoryPart1"), - BgEventDef( - x = 14, - y = 8, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "SealedChamber_InnerRoom_EventScript_BrailleStoryPart2"), - BgEventDef( - x = 4, - y = 13, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "SealedChamber_InnerRoom_EventScript_BrailleStoryPart3"), - BgEventDef( - x = 16, - y = 13, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "SealedChamber_InnerRoom_EventScript_BrailleStoryPart4"), - BgEventDef( - x = 6, - y = 18, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "SealedChamber_InnerRoom_EventScript_BrailleStoryPart5"), - BgEventDef( - x = 14, - y = 18, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "SealedChamber_InnerRoom_EventScript_BrailleStoryPart6"), - BgEventDef( - x = 9, - y = 4, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "SealedChamber_InnerRoom_EventScript_BrailleBackWall"), - BgEventDef( - x = 11, - y = 4, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "SealedChamber_InnerRoom_EventScript_BrailleBackWall"), - ), - ), - // ScorchedSlab (MAP_SCORCHED_SLAB) - MapDef( - regionId = 1, - bankId = 74, - mapId = 73, - width = 15, - height = 20, - paletteIdx1 = 100, - paletteIdx2 = 119, - unknownShort = 366, - unknownByte = 80, - borderTiles = - listOf( - Tile2D(0x0211, 0), Tile2D(0x0211, 0), Tile2D(0x0211, 0), Tile2D(0x0211, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.UNDERGROUND, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 7, - y = 16, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 35, - targetX = 19, - targetY = 23, - targetElevation = 0), - ), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // AquaHideout_UnusedRubyMap1 (MAP_AQUA_HIDEOUT_UNUSED_RUBY_MAP1) - MapDef( - regionId = 1, - bankId = 74, - mapId = 74, - width = 28, - height = 30, - paletteIdx1 = 100, - paletteIdx2 = 129, - unknownShort = 430, - unknownByte = 197, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.UNDERGROUND, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = emptyList(), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // AquaHideout_UnusedRubyMap2 (MAP_AQUA_HIDEOUT_UNUSED_RUBY_MAP2) - MapDef( - regionId = 1, - bankId = 74, - mapId = 75, - width = 62, - height = 24, - paletteIdx1 = 100, - paletteIdx2 = 129, - unknownShort = 430, - unknownByte = 197, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.UNDERGROUND, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = emptyList(), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // AquaHideout_UnusedRubyMap3 (MAP_AQUA_HIDEOUT_UNUSED_RUBY_MAP3) - MapDef( - regionId = 1, - bankId = 74, - mapId = 76, - width = 34, - height = 24, - paletteIdx1 = 100, - paletteIdx2 = 129, - unknownShort = 430, - unknownByte = 197, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.UNDERGROUND, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = emptyList(), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // SkyPillar_Entrance (MAP_SKY_PILLAR_ENTRANCE) - MapDef( - regionId = 1, - bankId = 74, - mapId = 77, - width = 18, - height = 18, - paletteIdx1 = 100, - paletteIdx2 = 119, - unknownShort = 406, - unknownByte = 85, - borderTiles = - listOf( - Tile2D(0x0211, 0), Tile2D(0x0211, 0), Tile2D(0x0211, 0), Tile2D(0x0211, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.UNDERGROUND, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 6, - y = 16, - elevation = 2, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 46, - targetX = 36, - targetY = 6, - targetElevation = 2), - WarpTile( - x = 14, - y = 4, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 78, - targetX = 17, - targetY = 13, - targetElevation = 2), - ), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // SkyPillar_Outside (MAP_SKY_PILLAR_OUTSIDE) - MapDef( - regionId = 1, - bankId = 74, - mapId = 78, - width = 28, - height = 23, - paletteIdx1 = 100, - paletteIdx2 = 112, - unknownShort = 406, - unknownByte = 85, - borderTiles = - listOf( - Tile2D(0x0170, 0), Tile2D(0x0170, 0), Tile2D(0x0170, 0), Tile2D(0x0170, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.ROUTE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 17, - y = 13, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 77, - targetX = 14, - targetY = 4, - targetElevation = 2), - WarpTile( - x = 14, - y = 5, - elevation = 0, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 79, - targetX = 6, - targetY = 13, - targetElevation = 2), - ), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // SkyPillar_1F (MAP_SKY_PILLAR_1F) - MapDef( - regionId = 1, - bankId = 74, - mapId = 79, - width = 14, - height = 14, - paletteIdx1 = 100, - paletteIdx2 = 112, - unknownShort = 406, - unknownByte = 85, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.UNDERGROUND, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 6, - y = 13, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 78, - targetX = 14, - targetY = 5, - targetElevation = 0), - WarpTile( - x = 7, - y = 13, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 78, - targetX = 14, - targetY = 5, - targetElevation = 0), - WarpTile( - x = 10, - y = 1, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 80, - targetX = 10, - targetY = 1, - targetElevation = 2), - ), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // SkyPillar_2F (MAP_SKY_PILLAR_2F) - MapDef( - regionId = 1, - bankId = 74, - mapId = 80, - width = 14, - height = 14, - paletteIdx1 = 100, - paletteIdx2 = 112, - unknownShort = 406, - unknownByte = 85, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.UNDERGROUND, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 10, - y = 1, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 79, - targetX = 10, - targetY = 1, - targetElevation = 2), - WarpTile( - x = 3, - y = 1, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 81, - targetX = 3, - targetY = 1, - targetElevation = 2), - ), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // SkyPillar_3F (MAP_SKY_PILLAR_3F) - MapDef( - regionId = 1, - bankId = 74, - mapId = 81, - width = 14, - height = 14, - paletteIdx1 = 100, - paletteIdx2 = 112, - unknownShort = 406, - unknownByte = 85, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.UNDERGROUND, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 3, - y = 1, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 80, - targetX = 3, - targetY = 1, - targetElevation = 2), - WarpTile( - x = 11, - y = 1, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 82, - targetX = 11, - targetY = 1, - targetElevation = 2), - WarpTile( - x = 7, - y = 1, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 82, - targetX = 7, - targetY = 1, - targetElevation = 2), - ), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // SkyPillar_4F (MAP_SKY_PILLAR_4F) - MapDef( - regionId = 1, - bankId = 74, - mapId = 82, - width = 14, - height = 14, - paletteIdx1 = 100, - paletteIdx2 = 112, - unknownShort = 406, - unknownByte = 85, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.UNDERGROUND, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 11, - y = 1, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 81, - targetX = 11, - targetY = 1, - targetElevation = 2), - WarpTile( - x = 7, - y = 1, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 81, - targetX = 7, - targetY = 1, - targetElevation = 2), - WarpTile( - x = 3, - y = 1, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 84, - targetX = 3, - targetY = 1, - targetElevation = 2), - ), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // ShoalCave_LowTideIceRoom (MAP_SHOAL_CAVE_LOW_TIDE_ICE_ROOM) - MapDef( - regionId = 1, - bankId = 74, - mapId = 83, - width = 20, - height = 30, - paletteIdx1 = 100, - paletteIdx2 = 119, - unknownShort = 432, - unknownByte = 67, - borderTiles = - listOf( - Tile2D(0x0381, 0), Tile2D(0x0381, 0), Tile2D(0x0381, 0), Tile2D(0x0381, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.UNDERGROUND, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 17, - y = 10, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 49, - targetX = 28, - targetY = 11, - targetElevation = 2), - ), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // SkyPillar_5F (MAP_SKY_PILLAR_5F) - MapDef( - regionId = 1, - bankId = 74, - mapId = 84, - width = 14, - height = 14, - paletteIdx1 = 100, - paletteIdx2 = 112, - unknownShort = 406, - unknownByte = 85, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.UNDERGROUND, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 3, - y = 1, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 82, - targetX = 3, - targetY = 1, - targetElevation = 2), - WarpTile( - x = 10, - y = 1, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 85, - targetX = 16, - targetY = 14, - targetElevation = 2), - ), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // SkyPillar_Top (MAP_SKY_PILLAR_TOP) - MapDef( - regionId = 1, - bankId = 74, - mapId = 85, - width = 27, - height = 24, - paletteIdx1 = 100, - paletteIdx2 = 112, - unknownShort = 406, - unknownByte = 85, - borderTiles = - listOf( - Tile2D(0x02C1, 0), Tile2D(0x02C1, 0), Tile2D(0x02C1, 0), Tile2D(0x02C1, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.ROUTE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 16, - y = 14, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 84, - targetX = 10, - targetY = 1, - targetElevation = 2), - ), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // MagmaHideout_1F (MAP_MAGMA_HIDEOUT_1F) - MapDef( - regionId = 1, - bankId = 74, - mapId = 86, - width = 37, - height = 38, - paletteIdx1 = 100, - paletteIdx2 = 106, - unknownShort = 430, - unknownByte = 198, - borderTiles = - listOf( - Tile2D(0x0271, 0), Tile2D(0x0271, 0), Tile2D(0x0271, 0), Tile2D(0x0271, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.UNDERGROUND, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 10, - y = 34, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 13, - targetX = 16, - targetY = 18, - targetElevation = 0), - WarpTile( - x = 25, - y = 34, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 87, - targetX = 8, - targetY = 2, - targetElevation = 0), - WarpTile( - x = 31, - y = 3, - elevation = 0, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 88, - targetX = 36, - targetY = 4, - targetElevation = 0), - WarpTile( - x = 20, - y = 22, - elevation = 0, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 93, - targetX = 16, - targetY = 1, - targetElevation = 0), - ), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // MagmaHideout_2F_1R (MAP_MAGMA_HIDEOUT_2F_1R) - MapDef( - regionId = 1, - bankId = 74, - mapId = 87, - width = 33, - height = 39, - paletteIdx1 = 100, - paletteIdx2 = 106, - unknownShort = 430, - unknownByte = 198, - borderTiles = - listOf( - Tile2D(0x0271, 0), Tile2D(0x0271, 0), Tile2D(0x0271, 0), Tile2D(0x0271, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.UNDERGROUND, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 11, - y = 23, - elevation = 0, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 88, - targetX = 10, - targetY = 22, - targetElevation = 2), - WarpTile( - x = 8, - y = 2, - elevation = 0, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 86, - targetX = 25, - targetY = 34, - targetElevation = 2), - WarpTile( - x = 17, - y = 33, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 89, - targetX = 23, - targetY = 3, - targetElevation = 0), - ), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // MagmaHideout_2F_2R (MAP_MAGMA_HIDEOUT_2F_2R) - MapDef( - regionId = 1, - bankId = 74, - mapId = 88, - width = 49, - height = 28, - paletteIdx1 = 100, - paletteIdx2 = 106, - unknownShort = 430, - unknownByte = 198, - borderTiles = - listOf( - Tile2D(0x0271, 0), Tile2D(0x0271, 0), Tile2D(0x0271, 0), Tile2D(0x0271, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.UNDERGROUND, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 10, - y = 22, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 87, - targetX = 11, - targetY = 23, - targetElevation = 0), - WarpTile( - x = 36, - y = 4, - elevation = 0, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 86, - targetX = 31, - targetY = 3, - targetElevation = 0), - ), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // MagmaHideout_3F_1R (MAP_MAGMA_HIDEOUT_3F_1R) - MapDef( - regionId = 1, - bankId = 74, - mapId = 89, - width = 28, - height = 24, - paletteIdx1 = 100, - paletteIdx2 = 106, - unknownShort = 430, - unknownByte = 198, - borderTiles = - listOf( - Tile2D(0x0271, 0), Tile2D(0x0271, 0), Tile2D(0x0271, 0), Tile2D(0x0271, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.UNDERGROUND, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 7, - y = 21, - elevation = 0, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 91, - targetX = 46, - targetY = 7, - targetElevation = 0), - WarpTile( - x = 21, - y = 9, - elevation = 0, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 90, - targetX = 12, - targetY = 15, - targetElevation = 0), - WarpTile( - x = 23, - y = 3, - elevation = 0, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 87, - targetX = 17, - targetY = 33, - targetElevation = 2), - ), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // MagmaHideout_3F_2R (MAP_MAGMA_HIDEOUT_3F_2R) - MapDef( - regionId = 1, - bankId = 74, - mapId = 90, - width = 24, - height = 17, - paletteIdx1 = 100, - paletteIdx2 = 106, - unknownShort = 430, - unknownByte = 198, - borderTiles = - listOf( - Tile2D(0x0271, 0), Tile2D(0x0271, 0), Tile2D(0x0271, 0), Tile2D(0x0271, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.UNDERGROUND, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 12, - y = 15, - elevation = 0, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 89, - targetX = 21, - targetY = 9, - targetElevation = 0), - ), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // MagmaHideout_4F (MAP_MAGMA_HIDEOUT_4F) - MapDef( - regionId = 1, - bankId = 74, - mapId = 91, - width = 59, - height = 28, - paletteIdx1 = 100, - paletteIdx2 = 106, - unknownShort = 430, - unknownByte = 198, - borderTiles = - listOf( - Tile2D(0x0271, 0), Tile2D(0x0271, 0), Tile2D(0x0271, 0), Tile2D(0x0271, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.UNDERGROUND, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 46, - y = 7, - elevation = 0, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 89, - targetX = 7, - targetY = 21, - targetElevation = 0), - WarpTile( - x = 20, - y = 21, - elevation = 0, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 92, - targetX = 16, - targetY = 21, - targetElevation = 0), - ), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // MagmaHideout_3F_3R (MAP_MAGMA_HIDEOUT_3F_3R) - MapDef( - regionId = 1, - bankId = 74, - mapId = 92, - width = 33, - height = 24, - paletteIdx1 = 100, - paletteIdx2 = 106, - unknownShort = 430, - unknownByte = 198, - borderTiles = - listOf( - Tile2D(0x0271, 0), Tile2D(0x0271, 0), Tile2D(0x0271, 0), Tile2D(0x0271, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.UNDERGROUND, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 16, - y = 1, - elevation = 0, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 93, - targetX = 16, - targetY = 13, - targetElevation = 0), - WarpTile( - x = 16, - y = 21, - elevation = 0, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 91, - targetX = 20, - targetY = 21, - targetElevation = 0), - ), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // MagmaHideout_2F_3R (MAP_MAGMA_HIDEOUT_2F_3R) - MapDef( - regionId = 1, - bankId = 74, - mapId = 93, - width = 60, - height = 19, - paletteIdx1 = 100, - paletteIdx2 = 106, - unknownShort = 430, - unknownByte = 198, - borderTiles = - listOf( - Tile2D(0x0271, 0), Tile2D(0x0271, 0), Tile2D(0x0271, 0), Tile2D(0x0271, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.UNDERGROUND, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 16, - y = 1, - elevation = 0, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 86, - targetX = 20, - targetY = 22, - targetElevation = 0), - WarpTile( - x = 16, - y = 13, - elevation = 0, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 92, - targetX = 16, - targetY = 1, - targetElevation = 0), - ), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // MirageTower_1F (MAP_MIRAGE_TOWER_1F) - MapDef( - regionId = 1, - bankId = 74, - mapId = 94, - width = 21, - height = 17, - paletteIdx1 = 100, - paletteIdx2 = 166, - unknownShort = 406, - unknownByte = 199, - borderTiles = - listOf( - Tile2D(0x0245, 0), Tile2D(0x0245, 0), Tile2D(0x0245, 0), Tile2D(0x0245, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.UNDERGROUND, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 10, - y = 14, - elevation = 2, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 26, - targetX = 19, - targetY = 58, - targetElevation = 0), - WarpTile( - x = 15, - y = 2, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 95, - targetX = 15, - targetY = 2, - targetElevation = 2), - ), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // MirageTower_2F (MAP_MIRAGE_TOWER_2F) - MapDef( - regionId = 1, - bankId = 74, - mapId = 95, - width = 21, - height = 17, - paletteIdx1 = 100, - paletteIdx2 = 166, - unknownShort = 406, - unknownByte = 199, - borderTiles = - listOf( - Tile2D(0x0245, 0), Tile2D(0x0245, 0), Tile2D(0x0245, 0), Tile2D(0x0245, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.UNDERGROUND, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 18, - y = 12, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 96, - targetX = 18, - targetY = 12, - targetElevation = 2), - WarpTile( - x = 15, - y = 2, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 94, - targetX = 15, - targetY = 2, - targetElevation = 2), - ), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // MirageTower_3F (MAP_MIRAGE_TOWER_3F) - MapDef( - regionId = 1, - bankId = 74, - mapId = 96, - width = 21, - height = 17, - paletteIdx1 = 100, - paletteIdx2 = 166, - unknownShort = 406, - unknownByte = 199, - borderTiles = - listOf( - Tile2D(0x0245, 0), Tile2D(0x0245, 0), Tile2D(0x0245, 0), Tile2D(0x0245, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.UNDERGROUND, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 18, - y = 12, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 95, - targetX = 18, - targetY = 12, - targetElevation = 2), - WarpTile( - x = 2, - y = 4, - elevation = 0, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 97, - targetX = 1, - targetY = 4, - targetElevation = 2), - ), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // MirageTower_4F (MAP_MIRAGE_TOWER_4F) - MapDef( - regionId = 1, - bankId = 74, - mapId = 97, - width = 13, - height = 10, - paletteIdx1 = 100, - paletteIdx2 = 166, - unknownShort = 406, - unknownByte = 199, - borderTiles = - listOf( - Tile2D(0x0245, 0), Tile2D(0x0245, 0), Tile2D(0x0245, 0), Tile2D(0x0245, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.UNDERGROUND, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 1, - y = 4, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 96, - targetX = 2, - targetY = 4, - targetElevation = 0), - ), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // DesertUnderpass (MAP_DESERT_UNDERPASS) - MapDef( - regionId = 1, - bankId = 74, - mapId = 98, - width = 139, - height = 23, - paletteIdx1 = 100, - paletteIdx2 = 119, - unknownShort = 406, - unknownByte = 209, - borderTiles = - listOf( - Tile2D(0x0211, 0), Tile2D(0x0211, 0), Tile2D(0x0211, 0), Tile2D(0x0211, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.UNDERGROUND, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 10, - y = 12, - elevation = 0, - targetRegionId = 1, - targetBankId = 70, - targetMapId = 1, - targetX = 6, - targetY = 2, - targetElevation = 0), - ), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // ArtisanCave_B1F (MAP_ARTISAN_CAVE_B1F) - MapDef( - regionId = 1, - bankId = 74, - mapId = 99, - width = 46, - height = 54, - paletteIdx1 = 100, - paletteIdx2 = 119, - unknownShort = 366, - unknownByte = 202, - borderTiles = - listOf( - Tile2D(0x0211, 0), Tile2D(0x0211, 0), Tile2D(0x0211, 0), Tile2D(0x0211, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.UNDERGROUND, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 8, - y = 48, - elevation = 0, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 4, - targetX = 39, - targetY = 55, - targetElevation = 0), - WarpTile( - x = 38, - y = 5, - elevation = 0, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 100, - targetX = 6, - targetY = 5, - targetElevation = 0), - ), - npcs = emptyList(), - bgEvents = - listOf( - BgEventDef( - x = 32, - y = 29, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 27, - y = 8, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 7, - y = 5, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 19, - y = 43, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - ), - ), - // ArtisanCave_1F (MAP_ARTISAN_CAVE_1F) - MapDef( - regionId = 1, - bankId = 74, - mapId = 100, - width = 21, - height = 22, - paletteIdx1 = 100, - paletteIdx2 = 119, - unknownShort = 366, - unknownByte = 202, - borderTiles = - listOf( - Tile2D(0x0211, 0), Tile2D(0x0211, 0), Tile2D(0x0211, 0), Tile2D(0x0211, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.UNDERGROUND, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 10, - y = 17, - elevation = 0, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 14, - targetX = 28, - targetY = 7, - targetElevation = 0), - WarpTile( - x = 6, - y = 5, - elevation = 0, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 99, - targetX = 38, - targetY = 5, - targetElevation = 0), - ), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // Underwater_MarineCave (MAP_UNDERWATER_MARINE_CAVE) - MapDef( - regionId = 1, - bankId = 74, - mapId = 101, - width = 20, - height = 10, - paletteIdx1 = 100, - paletteIdx2 = 144, - unknownShort = 366, - unknownByte = 204, - borderTiles = - listOf( - Tile2D(0x0213, 0), Tile2D(0x0213, 0), Tile2D(0x0213, 0), Tile2D(0x0213, 0)), - lighting = Lighting.REGULAR, - weather = Weather.UNDERWATER_MIST, - mapType = MapType.UNDERWATER, - encounterType = EncounterType.UNKNOWN_0x03, - connections = emptyList(), - warps = emptyList(), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // MarineCave_Entrance (MAP_MARINE_CAVE_ENTRANCE) - MapDef( - regionId = 1, - bankId = 74, - mapId = 102, - width = 20, - height = 20, - paletteIdx1 = 100, - paletteIdx2 = 119, - unknownShort = 366, - unknownByte = 203, - borderTiles = - listOf( - Tile2D(0x02F1, 0), Tile2D(0x02F1, 0), Tile2D(0x02F1, 0), Tile2D(0x02F1, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.UNDERGROUND, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 14, - y = 1, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 103, - targetX = 20, - targetY = 4, - targetElevation = 0), - ), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // MarineCave_End (MAP_MARINE_CAVE_END) - MapDef( - regionId = 1, - bankId = 74, - mapId = 103, - width = 27, - height = 30, - paletteIdx1 = 100, - paletteIdx2 = 119, - unknownShort = 366, - unknownByte = 203, - borderTiles = - listOf( - Tile2D(0x02F1, 0), Tile2D(0x02F1, 0), Tile2D(0x02F1, 0), Tile2D(0x02F1, 0)), - lighting = Lighting.REGULAR, - weather = Weather.STEADY_MIST, - mapType = MapType.UNDERGROUND, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 20, - y = 4, - elevation = 0, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 102, - targetX = 14, - targetY = 1, - targetElevation = 2), - ), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // TerraCave_Entrance (MAP_TERRA_CAVE_ENTRANCE) - MapDef( - regionId = 1, - bankId = 74, - mapId = 104, - width = 20, - height = 20, - paletteIdx1 = 100, - paletteIdx2 = 119, - unknownShort = 366, - unknownByte = 205, - borderTiles = - listOf( - Tile2D(0x02F1, 0), Tile2D(0x02F1, 0), Tile2D(0x02F1, 0), Tile2D(0x02F1, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.UNDERGROUND, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 14, - y = 1, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 105, - targetX = 5, - targetY = 4, - targetElevation = 2), - ), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // TerraCave_End (MAP_TERRA_CAVE_END) - MapDef( - regionId = 1, - bankId = 74, - mapId = 105, - width = 27, - height = 30, - paletteIdx1 = 100, - paletteIdx2 = 119, - unknownShort = 366, - unknownByte = 205, - borderTiles = - listOf( - Tile2D(0x02F1, 0), Tile2D(0x02F1, 0), Tile2D(0x02F1, 0), Tile2D(0x02F1, 0)), - lighting = Lighting.REGULAR, - weather = Weather.STEADY_MIST, - mapType = MapType.UNDERGROUND, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 5, - y = 4, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 104, - targetX = 14, - targetY = 1, - targetElevation = 2), - ), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // AlteringCave (MAP_ALTERING_CAVE) - MapDef( - regionId = 1, - bankId = 74, - mapId = 106, - width = 32, - height = 24, - paletteIdx1 = 100, - paletteIdx2 = 119, - unknownShort = 543, - unknownByte = 210, - borderTiles = - listOf( - Tile2D(0x0211, 0), Tile2D(0x0211, 0), Tile2D(0x0211, 0), Tile2D(0x0211, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.UNDERGROUND, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 18, - y = 22, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 18, - targetX = 45, - targetY = 6, - targetElevation = 0), - ), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // MeteorFalls_StevensCave (MAP_METEOR_FALLS_STEVENS_CAVE) - MapDef( - regionId = 1, - bankId = 74, - mapId = 107, - width = 30, - height = 32, - paletteIdx1 = 100, - paletteIdx2 = 123, - unknownShort = 386, - unknownByte = 63, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.UNDERGROUND, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 10, - y = 29, - elevation = 2, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 0, - targetX = 4, - targetY = 2, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 0, - x = 19, - y = 3, - elevation = 3, - movementType = 7, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 1, - script = "MeteorFalls_StevensCave_EventScript_Steven"), - ), - bgEvents = emptyList(), - ), - // SecretBase_RedCave1 (MAP_SECRET_BASE_RED_CAVE1) - MapDef( - regionId = 1, - bankId = 75, - mapId = 0, - width = 11, - height = 9, - paletteIdx1 = 157, - paletteIdx2 = 137, - unknownShort = 382, - unknownByte = 86, - borderTiles = - listOf( - Tile2D(0x0210, 0), Tile2D(0x0210, 0), Tile2D(0x0210, 0), Tile2D(0x0210, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.SECRET_BASE, - encounterType = EncounterType.UNKNOWN_0x03, - connections = emptyList(), - warps = emptyList(), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // SecretBase_BrownCave1 (MAP_SECRET_BASE_BROWN_CAVE1) - MapDef( - regionId = 1, - bankId = 75, - mapId = 1, - width = 11, - height = 9, - paletteIdx1 = 157, - paletteIdx2 = 132, - unknownShort = 382, - unknownByte = 86, - borderTiles = - listOf( - Tile2D(0x0210, 0), Tile2D(0x0210, 0), Tile2D(0x0210, 0), Tile2D(0x0210, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.SECRET_BASE, - encounterType = EncounterType.UNKNOWN_0x03, - connections = emptyList(), - warps = emptyList(), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // SecretBase_BlueCave1 (MAP_SECRET_BASE_BLUE_CAVE1) - MapDef( - regionId = 1, - bankId = 75, - mapId = 2, - width = 11, - height = 9, - paletteIdx1 = 157, - paletteIdx2 = 135, - unknownShort = 382, - unknownByte = 86, - borderTiles = - listOf( - Tile2D(0x0210, 0), Tile2D(0x0210, 0), Tile2D(0x0210, 0), Tile2D(0x0210, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.SECRET_BASE, - encounterType = EncounterType.UNKNOWN_0x03, - connections = emptyList(), - warps = emptyList(), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // SecretBase_YellowCave1 (MAP_SECRET_BASE_YELLOW_CAVE1) - MapDef( - regionId = 1, - bankId = 75, - mapId = 3, - width = 11, - height = 9, - paletteIdx1 = 157, - paletteIdx2 = 136, - unknownShort = 382, - unknownByte = 86, - borderTiles = - listOf( - Tile2D(0x0210, 0), Tile2D(0x0210, 0), Tile2D(0x0210, 0), Tile2D(0x0210, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.SECRET_BASE, - encounterType = EncounterType.UNKNOWN_0x03, - connections = emptyList(), - warps = emptyList(), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // SecretBase_Tree1 (MAP_SECRET_BASE_TREE1) - MapDef( - regionId = 1, - bankId = 75, - mapId = 4, - width = 11, - height = 9, - paletteIdx1 = 157, - paletteIdx2 = 133, - unknownShort = 382, - unknownByte = 86, - borderTiles = - listOf( - Tile2D(0x0208, 0), Tile2D(0x0208, 0), Tile2D(0x0208, 0), Tile2D(0x0208, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.SECRET_BASE, - encounterType = EncounterType.UNKNOWN_0x03, - connections = emptyList(), - warps = emptyList(), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // SecretBase_Shrub1 (MAP_SECRET_BASE_SHRUB1) - MapDef( - regionId = 1, - bankId = 75, - mapId = 5, - width = 11, - height = 9, - paletteIdx1 = 157, - paletteIdx2 = 134, - unknownShort = 382, - unknownByte = 86, - borderTiles = - listOf( - Tile2D(0x0208, 0), Tile2D(0x0208, 0), Tile2D(0x0208, 0), Tile2D(0x0208, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.SECRET_BASE, - encounterType = EncounterType.UNKNOWN_0x03, - connections = emptyList(), - warps = emptyList(), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // SecretBase_RedCave2 (MAP_SECRET_BASE_RED_CAVE2) - MapDef( - regionId = 1, - bankId = 75, - mapId = 6, - width = 7, - height = 16, - paletteIdx1 = 157, - paletteIdx2 = 137, - unknownShort = 382, - unknownByte = 86, - borderTiles = - listOf( - Tile2D(0x0210, 0), Tile2D(0x0210, 0), Tile2D(0x0210, 0), Tile2D(0x0210, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.SECRET_BASE, - encounterType = EncounterType.UNKNOWN_0x03, - connections = emptyList(), - warps = emptyList(), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // SecretBase_BrownCave2 (MAP_SECRET_BASE_BROWN_CAVE2) - MapDef( - regionId = 1, - bankId = 75, - mapId = 7, - width = 14, - height = 9, - paletteIdx1 = 157, - paletteIdx2 = 132, - unknownShort = 382, - unknownByte = 86, - borderTiles = - listOf( - Tile2D(0x0210, 0), Tile2D(0x0210, 0), Tile2D(0x0210, 0), Tile2D(0x0210, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.SECRET_BASE, - encounterType = EncounterType.UNKNOWN_0x03, - connections = emptyList(), - warps = emptyList(), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // SecretBase_BlueCave2 (MAP_SECRET_BASE_BLUE_CAVE2) - MapDef( - regionId = 1, - bankId = 75, - mapId = 8, - width = 15, - height = 7, - paletteIdx1 = 157, - paletteIdx2 = 135, - unknownShort = 382, - unknownByte = 86, - borderTiles = - listOf( - Tile2D(0x0210, 0), Tile2D(0x0210, 0), Tile2D(0x0210, 0), Tile2D(0x0210, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.SECRET_BASE, - encounterType = EncounterType.UNKNOWN_0x03, - connections = emptyList(), - warps = emptyList(), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // SecretBase_YellowCave2 (MAP_SECRET_BASE_YELLOW_CAVE2) - MapDef( - regionId = 1, - bankId = 75, - mapId = 9, - width = 14, - height = 9, - paletteIdx1 = 157, - paletteIdx2 = 136, - unknownShort = 382, - unknownByte = 86, - borderTiles = - listOf( - Tile2D(0x0210, 0), Tile2D(0x0210, 0), Tile2D(0x0210, 0), Tile2D(0x0210, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.SECRET_BASE, - encounterType = EncounterType.UNKNOWN_0x03, - connections = emptyList(), - warps = emptyList(), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // SecretBase_Tree2 (MAP_SECRET_BASE_TREE2) - MapDef( - regionId = 1, - bankId = 75, - mapId = 10, - width = 7, - height = 16, - paletteIdx1 = 157, - paletteIdx2 = 133, - unknownShort = 382, - unknownByte = 86, - borderTiles = - listOf( - Tile2D(0x0208, 0), Tile2D(0x0208, 0), Tile2D(0x0208, 0), Tile2D(0x0208, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.SECRET_BASE, - encounterType = EncounterType.UNKNOWN_0x03, - connections = emptyList(), - warps = emptyList(), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // SecretBase_Shrub2 (MAP_SECRET_BASE_SHRUB2) - MapDef( - regionId = 1, - bankId = 75, - mapId = 11, - width = 15, - height = 7, - paletteIdx1 = 157, - paletteIdx2 = 134, - unknownShort = 382, - unknownByte = 86, - borderTiles = - listOf( - Tile2D(0x0208, 0), Tile2D(0x0208, 0), Tile2D(0x0208, 0), Tile2D(0x0208, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.SECRET_BASE, - encounterType = EncounterType.UNKNOWN_0x03, - connections = emptyList(), - warps = emptyList(), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // SecretBase_RedCave3 (MAP_SECRET_BASE_RED_CAVE3) - MapDef( - regionId = 1, - bankId = 75, - mapId = 12, - width = 15, - height = 8, - paletteIdx1 = 157, - paletteIdx2 = 137, - unknownShort = 382, - unknownByte = 86, - borderTiles = - listOf( - Tile2D(0x0210, 0), Tile2D(0x0210, 0), Tile2D(0x0210, 0), Tile2D(0x0210, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.SECRET_BASE, - encounterType = EncounterType.UNKNOWN_0x03, - connections = emptyList(), - warps = emptyList(), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // SecretBase_BrownCave3 (MAP_SECRET_BASE_BROWN_CAVE3) - MapDef( - regionId = 1, - bankId = 75, - mapId = 13, - width = 15, - height = 11, - paletteIdx1 = 157, - paletteIdx2 = 132, - unknownShort = 382, - unknownByte = 86, - borderTiles = - listOf( - Tile2D(0x0210, 0), Tile2D(0x0210, 0), Tile2D(0x0210, 0), Tile2D(0x0210, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.SECRET_BASE, - encounterType = EncounterType.UNKNOWN_0x03, - connections = emptyList(), - warps = emptyList(), - npcs = emptyList(), - bgEvents = emptyList(), - ), - ) - allMaps.forEach { registerMap(it) } - } - - private fun registerDefaultMaps6() { - val allMaps = - listOf( - // SecretBase_BlueCave3 (MAP_SECRET_BASE_BLUE_CAVE3) - MapDef( - regionId = 1, - bankId = 75, - mapId = 14, - width = 10, - height = 17, - paletteIdx1 = 157, - paletteIdx2 = 135, - unknownShort = 382, - unknownByte = 86, - borderTiles = - listOf( - Tile2D(0x0210, 0), Tile2D(0x0210, 0), Tile2D(0x0210, 0), Tile2D(0x0210, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.SECRET_BASE, - encounterType = EncounterType.UNKNOWN_0x03, - connections = emptyList(), - warps = emptyList(), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // SecretBase_YellowCave3 (MAP_SECRET_BASE_YELLOW_CAVE3) - MapDef( - regionId = 1, - bankId = 75, - mapId = 15, - width = 12, - height = 11, - paletteIdx1 = 157, - paletteIdx2 = 136, - unknownShort = 382, - unknownByte = 86, - borderTiles = - listOf( - Tile2D(0x0210, 0), Tile2D(0x0210, 0), Tile2D(0x0210, 0), Tile2D(0x0210, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.SECRET_BASE, - encounterType = EncounterType.UNKNOWN_0x03, - connections = emptyList(), - warps = emptyList(), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // SecretBase_Tree3 (MAP_SECRET_BASE_TREE3) - MapDef( - regionId = 1, - bankId = 75, - mapId = 16, - width = 17, - height = 8, - paletteIdx1 = 157, - paletteIdx2 = 133, - unknownShort = 382, - unknownByte = 86, - borderTiles = - listOf( - Tile2D(0x0208, 0), Tile2D(0x0208, 0), Tile2D(0x0208, 0), Tile2D(0x0208, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.SECRET_BASE, - encounterType = EncounterType.UNKNOWN_0x03, - connections = emptyList(), - warps = emptyList(), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // SecretBase_Shrub3 (MAP_SECRET_BASE_SHRUB3) - MapDef( - regionId = 1, - bankId = 75, - mapId = 17, - width = 13, - height = 11, - paletteIdx1 = 157, - paletteIdx2 = 134, - unknownShort = 382, - unknownByte = 86, - borderTiles = - listOf( - Tile2D(0x0208, 0), Tile2D(0x0208, 0), Tile2D(0x0208, 0), Tile2D(0x0208, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.SECRET_BASE, - encounterType = EncounterType.UNKNOWN_0x03, - connections = emptyList(), - warps = emptyList(), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // SecretBase_RedCave4 (MAP_SECRET_BASE_RED_CAVE4) - MapDef( - regionId = 1, - bankId = 75, - mapId = 18, - width = 9, - height = 15, - paletteIdx1 = 157, - paletteIdx2 = 137, - unknownShort = 382, - unknownByte = 86, - borderTiles = - listOf( - Tile2D(0x0210, 0), Tile2D(0x0210, 0), Tile2D(0x0210, 0), Tile2D(0x0210, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.SECRET_BASE, - encounterType = EncounterType.UNKNOWN_0x03, - connections = emptyList(), - warps = emptyList(), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // SecretBase_BrownCave4 (MAP_SECRET_BASE_BROWN_CAVE4) - MapDef( - regionId = 1, - bankId = 75, - mapId = 19, - width = 14, - height = 12, - paletteIdx1 = 157, - paletteIdx2 = 132, - unknownShort = 382, - unknownByte = 86, - borderTiles = - listOf( - Tile2D(0x0210, 0), Tile2D(0x0210, 0), Tile2D(0x0210, 0), Tile2D(0x0210, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.SECRET_BASE, - encounterType = EncounterType.UNKNOWN_0x03, - connections = emptyList(), - warps = emptyList(), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // SecretBase_BlueCave4 (MAP_SECRET_BASE_BLUE_CAVE4) - MapDef( - regionId = 1, - bankId = 75, - mapId = 20, - width = 9, - height = 17, - paletteIdx1 = 157, - paletteIdx2 = 135, - unknownShort = 382, - unknownByte = 86, - borderTiles = - listOf( - Tile2D(0x0210, 0), Tile2D(0x0210, 0), Tile2D(0x0210, 0), Tile2D(0x0210, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.SECRET_BASE, - encounterType = EncounterType.UNKNOWN_0x03, - connections = emptyList(), - warps = emptyList(), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // SecretBase_YellowCave4 (MAP_SECRET_BASE_YELLOW_CAVE4) - MapDef( - regionId = 1, - bankId = 75, - mapId = 21, - width = 13, - height = 14, - paletteIdx1 = 157, - paletteIdx2 = 136, - unknownShort = 382, - unknownByte = 86, - borderTiles = - listOf( - Tile2D(0x0210, 0), Tile2D(0x0210, 0), Tile2D(0x0210, 0), Tile2D(0x0210, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.SECRET_BASE, - encounterType = EncounterType.UNKNOWN_0x03, - connections = emptyList(), - warps = emptyList(), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // SecretBase_Tree4 (MAP_SECRET_BASE_TREE4) - MapDef( - regionId = 1, - bankId = 75, - mapId = 22, - width = 14, - height = 14, - paletteIdx1 = 157, - paletteIdx2 = 133, - unknownShort = 382, - unknownByte = 86, - borderTiles = - listOf( - Tile2D(0x0208, 0), Tile2D(0x0208, 0), Tile2D(0x0208, 0), Tile2D(0x0208, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.SECRET_BASE, - encounterType = EncounterType.UNKNOWN_0x03, - connections = emptyList(), - warps = emptyList(), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // SecretBase_Shrub4 (MAP_SECRET_BASE_SHRUB4) - MapDef( - regionId = 1, - bankId = 75, - mapId = 23, - width = 14, - height = 11, - paletteIdx1 = 157, - paletteIdx2 = 134, - unknownShort = 382, - unknownByte = 86, - borderTiles = - listOf( - Tile2D(0x0208, 0), Tile2D(0x0208, 0), Tile2D(0x0208, 0), Tile2D(0x0208, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.SECRET_BASE, - encounterType = EncounterType.UNKNOWN_0x03, - connections = emptyList(), - warps = emptyList(), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // BattleColosseum_2P (MAP_BATTLE_COLOSSEUM_2P) - MapDef( - regionId = 1, - bankId = 75, - mapId = 24, - width = 14, - height = 9, - paletteIdx1 = 116, - paletteIdx2 = 125, - unknownShort = 422, - unknownByte = 87, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = emptyList(), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 28, - x = 9, - y = 3, - elevation = 3, - movementType = 9, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 2, - script = "BattleColosseum_2P_EventScript_Attendant"), - ), - bgEvents = emptyList(), - ), - // TradeCenter (MAP_TRADE_CENTER) - MapDef( - regionId = 1, - bankId = 75, - mapId = 25, - width = 12, - height = 9, - paletteIdx1 = 116, - paletteIdx2 = 125, - unknownShort = 422, - unknownByte = 87, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = emptyList(), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 28, - x = 9, - y = 6, - elevation = 3, - movementType = 9, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 2, - script = "TradeCenter_EventScript_Attendant"), - ), - bgEvents = emptyList(), - ), - // RecordCorner (MAP_RECORD_CORNER) - MapDef( - regionId = 1, - bankId = 75, - mapId = 26, - width = 20, - height = 10, - paletteIdx1 = 116, - paletteIdx2 = 125, - unknownShort = 422, - unknownByte = 87, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = emptyList(), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 28, - x = 10, - y = 5, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "RecordCorner_EventScript_Attendant"), - ), - bgEvents = emptyList(), - ), - // BattleColosseum_4P (MAP_BATTLE_COLOSSEUM_4P) - MapDef( - regionId = 1, - bankId = 75, - mapId = 27, - width = 14, - height = 9, - paletteIdx1 = 116, - paletteIdx2 = 125, - unknownShort = 422, - unknownByte = 87, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = emptyList(), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // ContestHall (MAP_CONTEST_HALL) - MapDef( - regionId = 1, - bankId = 75, - mapId = 28, - width = 15, - height = 11, - paletteIdx1 = 100, - paletteIdx2 = 140, - unknownShort = 440, - unknownByte = 87, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = emptyList(), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 24, - x = 6, - y = 4, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "0x0"), - NpcDef( - entityIdx = 1, - graphicsId = 0, - x = 7, - y = 4, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "0x0"), - NpcDef( - entityIdx = 2, - graphicsId = 240, - x = 4, - y = 7, - elevation = 3, - movementType = 7, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 1, - script = "0x0"), - NpcDef( - entityIdx = 3, - graphicsId = 0, - x = 6, - y = 7, - elevation = 3, - movementType = 7, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 1, - script = "0x0"), - NpcDef( - entityIdx = 4, - graphicsId = 0, - x = 8, - y = 7, - elevation = 3, - movementType = 7, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 1, - script = "0x0"), - NpcDef( - entityIdx = 5, - graphicsId = 0, - x = 2, - y = 6, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 3, - script = "0x0"), - NpcDef( - entityIdx = 6, - graphicsId = 0, - x = 4, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "0x0"), - NpcDef( - entityIdx = 7, - graphicsId = 0, - x = 5, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "0x0"), - NpcDef( - entityIdx = 8, - graphicsId = 0, - x = 9, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "0x0"), - NpcDef( - entityIdx = 9, - graphicsId = 0, - x = 10, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "0x0"), - NpcDef( - entityIdx = 10, - graphicsId = 0, - x = 12, - y = 5, - elevation = 3, - movementType = 9, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 2, - script = "0x0"), - NpcDef( - entityIdx = 11, - graphicsId = 0, - x = 2, - y = 5, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 3, - script = "0x0"), - NpcDef( - entityIdx = 13, - graphicsId = 0, - x = 10, - y = 7, - elevation = 3, - movementType = 7, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 1, - script = "0x0"), - NpcDef( - entityIdx = 14, - graphicsId = 0, - x = 12, - y = 6, - elevation = 3, - movementType = 9, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 2, - script = "0x0"), - ), - bgEvents = emptyList(), - ), - // UnusedContestHall1 (MAP_UNUSED_CONTEST_HALL1) - MapDef( - regionId = 1, - bankId = 75, - mapId = 29, - width = 1, - height = 1, - paletteIdx1 = 116, - paletteIdx2 = 140, - unknownShort = 357, - unknownByte = 87, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = emptyList(), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // UnusedContestHall2 (MAP_UNUSED_CONTEST_HALL2) - MapDef( - regionId = 1, - bankId = 75, - mapId = 30, - width = 1, - height = 1, - paletteIdx1 = 116, - paletteIdx2 = 140, - unknownShort = 357, - unknownByte = 87, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = emptyList(), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // UnusedContestHall3 (MAP_UNUSED_CONTEST_HALL3) - MapDef( - regionId = 1, - bankId = 75, - mapId = 31, - width = 1, - height = 1, - paletteIdx1 = 116, - paletteIdx2 = 140, - unknownShort = 357, - unknownByte = 87, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = emptyList(), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // UnusedContestHall4 (MAP_UNUSED_CONTEST_HALL4) - MapDef( - regionId = 1, - bankId = 75, - mapId = 32, - width = 1, - height = 1, - paletteIdx1 = 116, - paletteIdx2 = 140, - unknownShort = 357, - unknownByte = 87, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = emptyList(), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // UnusedContestHall5 (MAP_UNUSED_CONTEST_HALL5) - MapDef( - regionId = 1, - bankId = 75, - mapId = 33, - width = 1, - height = 1, - paletteIdx1 = 116, - paletteIdx2 = 140, - unknownShort = 357, - unknownByte = 87, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = emptyList(), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // UnusedContestHall6 (MAP_UNUSED_CONTEST_HALL6) - MapDef( - regionId = 1, - bankId = 75, - mapId = 34, - width = 1, - height = 1, - paletteIdx1 = 116, - paletteIdx2 = 140, - unknownShort = 357, - unknownByte = 87, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = emptyList(), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // ContestHallBeauty (MAP_CONTEST_HALL_BEAUTY) - MapDef( - regionId = 1, - bankId = 75, - mapId = 35, - width = 15, - height = 11, - paletteIdx1 = 100, - paletteIdx2 = 140, - unknownShort = 440, - unknownByte = 87, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = emptyList(), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // ContestHallTough (MAP_CONTEST_HALL_TOUGH) - MapDef( - regionId = 1, - bankId = 75, - mapId = 36, - width = 15, - height = 11, - paletteIdx1 = 100, - paletteIdx2 = 140, - unknownShort = 440, - unknownByte = 87, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = emptyList(), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // ContestHallCool (MAP_CONTEST_HALL_COOL) - MapDef( - regionId = 1, - bankId = 75, - mapId = 37, - width = 15, - height = 11, - paletteIdx1 = 100, - paletteIdx2 = 140, - unknownShort = 440, - unknownByte = 87, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = emptyList(), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // ContestHallSmart (MAP_CONTEST_HALL_SMART) - MapDef( - regionId = 1, - bankId = 75, - mapId = 38, - width = 15, - height = 11, - paletteIdx1 = 100, - paletteIdx2 = 140, - unknownShort = 440, - unknownByte = 87, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = emptyList(), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // ContestHallCute (MAP_CONTEST_HALL_CUTE) - MapDef( - regionId = 1, - bankId = 75, - mapId = 39, - width = 15, - height = 11, - paletteIdx1 = 100, - paletteIdx2 = 140, - unknownShort = 440, - unknownByte = 87, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = emptyList(), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // InsideOfTruck (MAP_INSIDE_OF_TRUCK) - MapDef( - regionId = 1, - bankId = 75, - mapId = 40, - width = 5, - height = 5, - paletteIdx1 = 100, - paletteIdx2 = 138, - unknownShort = 0, - unknownByte = 84, - borderTiles = - listOf( - Tile2D(0x0206, 0), Tile2D(0x0206, 0), Tile2D(0x0206, 0), Tile2D(0x0206, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = emptyList(), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 0, - x = 0, - y = 0, - elevation = 8, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "InsideOfTruck_EventScript_MovingBox"), - NpcDef( - entityIdx = 1, - graphicsId = 0, - x = 0, - y = 3, - elevation = 8, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "InsideOfTruck_EventScript_MovingBox"), - NpcDef( - entityIdx = 2, - graphicsId = 0, - x = 2, - y = 3, - elevation = 8, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "InsideOfTruck_EventScript_MovingBox"), - ), - bgEvents = - listOf( - BgEventDef( - x = 1, - y = 0, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "InsideOfTruck_EventScript_MovingBox"), - BgEventDef( - x = 3, - y = 4, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "InsideOfTruck_EventScript_MovingBox"), - BgEventDef( - x = 2, - y = 3, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "InsideOfTruck_EventScript_MovingBox"), - BgEventDef( - x = 0, - y = 1, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "InsideOfTruck_EventScript_MovingBox"), - BgEventDef( - x = 0, - y = 2, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "InsideOfTruck_EventScript_MovingBox"), - ), - ), - // SSTidalCorridor (MAP_SS_TIDAL_CORRIDOR) - MapDef( - regionId = 1, - bankId = 75, - mapId = 41, - width = 18, - height = 13, - paletteIdx1 = 100, - paletteIdx2 = 156, - unknownShort = 431, - unknownByte = 87, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 4, - y = 9, - elevation = 2, - targetRegionId = 1, - targetBankId = 75, - targetMapId = 43, - targetX = 4, - targetY = 16, - targetElevation = 0), - WarpTile( - x = 7, - y = 9, - elevation = 2, - targetRegionId = 1, - targetBankId = 75, - targetMapId = 43, - targetX = 13, - targetY = 16, - targetElevation = 0), - WarpTile( - x = 10, - y = 9, - elevation = 2, - targetRegionId = 1, - targetBankId = 75, - targetMapId = 43, - targetX = 22, - targetY = 16, - targetElevation = 0), - WarpTile( - x = 13, - y = 9, - elevation = 2, - targetRegionId = 1, - targetBankId = 75, - targetMapId = 43, - targetX = 31, - targetY = 16, - targetElevation = 0), - WarpTile( - x = 4, - y = 3, - elevation = 2, - targetRegionId = 1, - targetBankId = 75, - targetMapId = 43, - targetX = 4, - targetY = 1, - targetElevation = 0), - WarpTile( - x = 7, - y = 3, - elevation = 2, - targetRegionId = 1, - targetBankId = 75, - targetMapId = 43, - targetX = 13, - targetY = 1, - targetElevation = 0), - WarpTile( - x = 10, - y = 3, - elevation = 2, - targetRegionId = 1, - targetBankId = 75, - targetMapId = 43, - targetX = 22, - targetY = 1, - targetElevation = 0), - WarpTile( - x = 13, - y = 3, - elevation = 2, - targetRegionId = 1, - targetBankId = 75, - targetMapId = 43, - targetX = 31, - targetY = 1, - targetElevation = 0), - WarpTile( - x = 16, - y = 2, - elevation = 2, - targetRegionId = 1, - targetBankId = 75, - targetMapId = 42, - targetX = 15, - targetY = 2, - targetElevation = 2), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 49, - x = 1, - y = 11, - elevation = 3, - movementType = 7, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 1, - script = "SSTidalCorridor_EventScript_ExitSailor"), - NpcDef( - entityIdx = 1, - graphicsId = 49, - x = 16, - y = 7, - elevation = 3, - movementType = 3, - movementRangeX = 0, - movementRangeY = 2, - trainerType = 0, - facing = 0, - script = "SSTidalCorridor_EventScript_Sailor"), - ), - bgEvents = - listOf( - BgEventDef( - x = 2, - y = 1, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "SSTidalCorridor_EventScript_Porthole"), - BgEventDef( - x = 4, - y = 1, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "SSTidalCorridor_EventScript_Porthole"), - BgEventDef( - x = 6, - y = 1, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "SSTidalCorridor_EventScript_Porthole"), - BgEventDef( - x = 8, - y = 1, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "SSTidalCorridor_EventScript_Porthole"), - BgEventDef( - x = 10, - y = 1, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "SSTidalCorridor_EventScript_Porthole"), - BgEventDef( - x = 12, - y = 1, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "SSTidalCorridor_EventScript_Porthole"), - BgEventDef( - x = 14, - y = 1, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "SSTidalCorridor_EventScript_Porthole"), - BgEventDef( - x = 16, - y = 1, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "SSTidalCorridor_EventScript_Porthole"), - BgEventDef( - x = 5, - y = 9, - facingDir = "BG_EVENT_PLAYER_FACING_NORTH", - script = "SSTidalCorridor_EventScript_Cabin1Sign"), - BgEventDef( - x = 8, - y = 9, - facingDir = "BG_EVENT_PLAYER_FACING_NORTH", - script = "SSTidalCorridor_EventScript_Cabin2Sign"), - BgEventDef( - x = 11, - y = 9, - facingDir = "BG_EVENT_PLAYER_FACING_NORTH", - script = "SSTidalCorridor_EventScript_Cabin3Sign"), - BgEventDef( - x = 14, - y = 9, - facingDir = "BG_EVENT_PLAYER_FACING_NORTH", - script = "SSTidalCorridor_EventScript_Cabin4Sign"), - ), - ), - // SSTidalLowerDeck (MAP_SS_TIDAL_LOWER_DECK) - MapDef( - regionId = 1, - bankId = 75, - mapId = 42, - width = 17, - height = 13, - paletteIdx1 = 100, - paletteIdx2 = 156, - unknownShort = 431, - unknownByte = 87, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 15, - y = 2, - elevation = 2, - targetRegionId = 1, - targetBankId = 75, - targetMapId = 41, - targetX = 16, - targetY = 2, - targetElevation = 2), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 49, - x = 10, - y = 4, - elevation = 3, - movementType = 0, - movementRangeX = 4, - movementRangeY = 4, - trainerType = 1, - facing = 0, - script = "SSTidalLowerDeck_EventScript_Phillip"), - NpcDef( - entityIdx = 1, - graphicsId = 49, - x = 7, - y = 4, - elevation = 3, - movementType = 0, - movementRangeX = 7, - movementRangeY = 4, - trainerType = 1, - facing = 0, - script = "SSTidalLowerDeck_EventScript_Leonard"), - ), - bgEvents = - listOf( - BgEventDef( - x = 0, - y = 2, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - ), - ), - // SSTidalRooms (MAP_SS_TIDAL_ROOMS) - MapDef( - regionId = 1, - bankId = 75, - mapId = 43, - width = 36, - height = 18, - paletteIdx1 = 100, - paletteIdx2 = 156, - unknownShort = 431, - unknownByte = 87, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 4, - y = 16, - elevation = 0, - targetRegionId = 1, - targetBankId = 75, - targetMapId = 41, - targetX = 4, - targetY = 9, - targetElevation = 2), - WarpTile( - x = 5, - y = 16, - elevation = 0, - targetRegionId = 1, - targetBankId = 75, - targetMapId = 41, - targetX = 4, - targetY = 9, - targetElevation = 2), - WarpTile( - x = 13, - y = 16, - elevation = 0, - targetRegionId = 1, - targetBankId = 75, - targetMapId = 41, - targetX = 7, - targetY = 9, - targetElevation = 2), - WarpTile( - x = 14, - y = 16, - elevation = 0, - targetRegionId = 1, - targetBankId = 75, - targetMapId = 41, - targetX = 7, - targetY = 9, - targetElevation = 2), - WarpTile( - x = 22, - y = 16, - elevation = 0, - targetRegionId = 1, - targetBankId = 75, - targetMapId = 41, - targetX = 10, - targetY = 9, - targetElevation = 2), - WarpTile( - x = 23, - y = 16, - elevation = 0, - targetRegionId = 1, - targetBankId = 75, - targetMapId = 41, - targetX = 10, - targetY = 9, - targetElevation = 2), - WarpTile( - x = 31, - y = 16, - elevation = 0, - targetRegionId = 1, - targetBankId = 75, - targetMapId = 41, - targetX = 13, - targetY = 9, - targetElevation = 2), - WarpTile( - x = 32, - y = 16, - elevation = 0, - targetRegionId = 1, - targetBankId = 75, - targetMapId = 41, - targetX = 13, - targetY = 9, - targetElevation = 2), - WarpTile( - x = 4, - y = 1, - elevation = 0, - targetRegionId = 1, - targetBankId = 75, - targetMapId = 41, - targetX = 4, - targetY = 3, - targetElevation = 2), - WarpTile( - x = 13, - y = 1, - elevation = 0, - targetRegionId = 1, - targetBankId = 75, - targetMapId = 41, - targetX = 7, - targetY = 3, - targetElevation = 2), - WarpTile( - x = 22, - y = 1, - elevation = 0, - targetRegionId = 1, - targetBankId = 75, - targetMapId = 41, - targetX = 10, - targetY = 3, - targetElevation = 2), - WarpTile( - x = 31, - y = 1, - elevation = 0, - targetRegionId = 1, - targetBankId = 75, - targetMapId = 41, - targetX = 13, - targetY = 3, - targetElevation = 2), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 25, - x = 4, - y = 7, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 3, - script = "SSTidalRooms_EventScript_Colton"), - NpcDef( - entityIdx = 1, - graphicsId = 48, - x = 34, - y = 11, - elevation = 3, - movementType = 9, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 2, - script = "SSTidalRooms_EventScript_Micah"), - NpcDef( - entityIdx = 2, - graphicsId = 48, - x = 21, - y = 5, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 3, - script = "SSTidalRooms_EventScript_Thomas"), - NpcDef( - entityIdx = 3, - graphicsId = 65, - x = 5, - y = 14, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "SSTidalRooms_EventScript_Jed"), - NpcDef( - entityIdx = 4, - graphicsId = 26, - x = 4, - y = 14, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "SSTidalRooms_EventScript_Lea"), - NpcDef( - entityIdx = 5, - graphicsId = 15, - x = 22, - y = 11, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "SSTidalRooms_EventScript_Garret"), - NpcDef( - entityIdx = 6, - graphicsId = 20, - x = 15, - y = 6, - elevation = 3, - movementType = 9, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 2, - script = "SSTidalRooms_EventScript_Naomi"), - ), - bgEvents = - listOf( - BgEventDef( - x = 15, - y = 11, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "SSTidalRooms_EventScript_Bed"), - BgEventDef( - x = 15, - y = 12, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "SSTidalRooms_EventScript_Bed"), - ), - ), - // BattlePyramidSquare01 (MAP_BATTLE_PYRAMID_SQUARE01) - MapDef( - regionId = 1, - bankId = 75, - mapId = 44, - width = 8, - height = 8, - paletteIdx1 = 116, - paletteIdx2 = 165, - unknownShort = 0, - unknownByte = 87, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = emptyList(), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 5, - x = 2, - y = 3, - elevation = 4, - movementType = 18, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "BattlePyramid_TrainerBattle"), - NpcDef( - entityIdx = 1, - graphicsId = 14, - x = 5, - y = 3, - elevation = 4, - movementType = 17, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "BattlePyramid_TrainerBattle"), - NpcDef( - entityIdx = 2, - graphicsId = 15, - x = 2, - y = 6, - elevation = 4, - movementType = 16, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "BattlePyramid_TrainerBattle"), - NpcDef( - entityIdx = 3, - graphicsId = 9, - x = 6, - y = 6, - elevation = 4, - movementType = 9, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 2, - script = "BattlePyramid_TrainerBattle"), - NpcDef( - entityIdx = 4, - graphicsId = 59, - x = 4, - y = 1, - elevation = 4, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "BattlePyramid_FindItemBall"), - NpcDef( - entityIdx = 5, - graphicsId = 59, - x = 7, - y = 4, - elevation = 4, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "BattlePyramid_FindItemBall"), - NpcDef( - entityIdx = 6, - graphicsId = 59, - x = 0, - y = 4, - elevation = 4, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "BattlePyramid_FindItemBall"), - ), - bgEvents = emptyList(), - ), - // BattlePyramidSquare02 (MAP_BATTLE_PYRAMID_SQUARE02) - MapDef( - regionId = 1, - bankId = 75, - mapId = 45, - width = 8, - height = 8, - paletteIdx1 = 116, - paletteIdx2 = 165, - unknownShort = 0, - unknownByte = 87, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = emptyList(), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 13, - x = 2, - y = 1, - elevation = 4, - movementType = 18, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "BattlePyramid_TrainerBattle"), - NpcDef( - entityIdx = 1, - graphicsId = 18, - x = 5, - y = 6, - elevation = 4, - movementType = 15, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "BattlePyramid_TrainerBattle"), - NpcDef( - entityIdx = 2, - graphicsId = 17, - x = 2, - y = 6, - elevation = 4, - movementType = 16, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "BattlePyramid_TrainerBattle"), - NpcDef( - entityIdx = 3, - graphicsId = 6, - x = 5, - y = 1, - elevation = 4, - movementType = 17, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "BattlePyramid_TrainerBattle"), - NpcDef( - entityIdx = 4, - graphicsId = 59, - x = 6, - y = 5, - elevation = 4, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "BattlePyramid_FindItemBall"), - NpcDef( - entityIdx = 5, - graphicsId = 59, - x = 7, - y = 0, - elevation = 4, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "BattlePyramid_FindItemBall"), - NpcDef( - entityIdx = 6, - graphicsId = 59, - x = 0, - y = 2, - elevation = 4, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "BattlePyramid_FindItemBall"), - ), - bgEvents = emptyList(), - ), - // BattlePyramidSquare03 (MAP_BATTLE_PYRAMID_SQUARE03) - MapDef( - regionId = 1, - bankId = 75, - mapId = 46, - width = 8, - height = 8, - paletteIdx1 = 116, - paletteIdx2 = 165, - unknownShort = 0, - unknownByte = 87, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = emptyList(), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 7, - x = 2, - y = 1, - elevation = 4, - movementType = 18, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "BattlePyramid_TrainerBattle"), - NpcDef( - entityIdx = 1, - graphicsId = 11, - x = 6, - y = 1, - elevation = 4, - movementType = 17, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "BattlePyramid_TrainerBattle"), - NpcDef( - entityIdx = 2, - graphicsId = 50, - x = 6, - y = 4, - elevation = 4, - movementType = 15, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "BattlePyramid_TrainerBattle"), - NpcDef( - entityIdx = 3, - graphicsId = 33, - x = 3, - y = 4, - elevation = 4, - movementType = 18, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "BattlePyramid_TrainerBattle"), - NpcDef( - entityIdx = 4, - graphicsId = 59, - x = 4, - y = 2, - elevation = 4, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "BattlePyramid_FindItemBall"), - NpcDef( - entityIdx = 5, - graphicsId = 59, - x = 0, - y = 3, - elevation = 4, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "BattlePyramid_FindItemBall"), - NpcDef( - entityIdx = 6, - graphicsId = 59, - x = 2, - y = 7, - elevation = 4, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "BattlePyramid_FindItemBall"), - ), - bgEvents = emptyList(), - ), - // BattlePyramidSquare04 (MAP_BATTLE_PYRAMID_SQUARE04) - MapDef( - regionId = 1, - bankId = 75, - mapId = 47, - width = 8, - height = 8, - paletteIdx1 = 116, - paletteIdx2 = 165, - unknownShort = 0, - unknownByte = 87, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = emptyList(), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 20, - x = 7, - y = 2, - elevation = 4, - movementType = 17, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "BattlePyramid_TrainerBattle"), - NpcDef( - entityIdx = 1, - graphicsId = 8, - x = 7, - y = 7, - elevation = 4, - movementType = 15, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "BattlePyramid_TrainerBattle"), - NpcDef( - entityIdx = 2, - graphicsId = 15, - x = 1, - y = 4, - elevation = 4, - movementType = 18, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "BattlePyramid_TrainerBattle"), - NpcDef( - entityIdx = 3, - graphicsId = 14, - x = 6, - y = 4, - elevation = 4, - movementType = 15, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "BattlePyramid_TrainerBattle"), - NpcDef( - entityIdx = 4, - graphicsId = 59, - x = 2, - y = 6, - elevation = 4, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "BattlePyramid_FindItemBall"), - NpcDef( - entityIdx = 5, - graphicsId = 59, - x = 5, - y = 3, - elevation = 4, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "BattlePyramid_FindItemBall"), - NpcDef( - entityIdx = 6, - graphicsId = 59, - x = 3, - y = 0, - elevation = 4, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "BattlePyramid_FindItemBall"), - ), - bgEvents = emptyList(), - ), - // BattlePyramidSquare05 (MAP_BATTLE_PYRAMID_SQUARE05) - MapDef( - regionId = 1, - bankId = 75, - mapId = 48, - width = 8, - height = 8, - paletteIdx1 = 116, - paletteIdx2 = 165, - unknownShort = 0, - unknownByte = 87, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = emptyList(), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 9, - x = 6, - y = 4, - elevation = 4, - movementType = 7, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 1, - script = "BattlePyramid_TrainerBattle"), - NpcDef( - entityIdx = 1, - graphicsId = 9, - x = 3, - y = 7, - elevation = 4, - movementType = 16, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "BattlePyramid_TrainerBattle"), - NpcDef( - entityIdx = 2, - graphicsId = 9, - x = 3, - y = 1, - elevation = 4, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "BattlePyramid_TrainerBattle"), - NpcDef( - entityIdx = 3, - graphicsId = 9, - x = 6, - y = 0, - elevation = 4, - movementType = 17, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "BattlePyramid_TrainerBattle"), - NpcDef( - entityIdx = 4, - graphicsId = 59, - x = 0, - y = 3, - elevation = 4, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "BattlePyramid_FindItemBall"), - NpcDef( - entityIdx = 5, - graphicsId = 59, - x = 7, - y = 6, - elevation = 4, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "BattlePyramid_FindItemBall"), - NpcDef( - entityIdx = 6, - graphicsId = 59, - x = 4, - y = 3, - elevation = 4, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "BattlePyramid_FindItemBall"), - ), - bgEvents = emptyList(), - ), - // BattlePyramidSquare06 (MAP_BATTLE_PYRAMID_SQUARE06) - MapDef( - regionId = 1, - bankId = 75, - mapId = 49, - width = 8, - height = 8, - paletteIdx1 = 116, - paletteIdx2 = 165, - unknownShort = 0, - unknownByte = 87, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = emptyList(), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 10, - x = 5, - y = 2, - elevation = 4, - movementType = 17, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "BattlePyramid_TrainerBattle"), - NpcDef( - entityIdx = 1, - graphicsId = 10, - x = 2, - y = 5, - elevation = 4, - movementType = 16, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "BattlePyramid_TrainerBattle"), - NpcDef( - entityIdx = 2, - graphicsId = 10, - x = 5, - y = 5, - elevation = 4, - movementType = 15, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "BattlePyramid_TrainerBattle"), - NpcDef( - entityIdx = 3, - graphicsId = 10, - x = 2, - y = 2, - elevation = 4, - movementType = 18, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "BattlePyramid_TrainerBattle"), - NpcDef( - entityIdx = 4, - graphicsId = 59, - x = 7, - y = 7, - elevation = 4, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "BattlePyramid_FindItemBall"), - NpcDef( - entityIdx = 5, - graphicsId = 59, - x = 4, - y = 3, - elevation = 4, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "BattlePyramid_FindItemBall"), - NpcDef( - entityIdx = 6, - graphicsId = 59, - x = 0, - y = 0, - elevation = 4, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "BattlePyramid_FindItemBall"), - ), - bgEvents = emptyList(), - ), - // BattlePyramidSquare07 (MAP_BATTLE_PYRAMID_SQUARE07) - MapDef( - regionId = 1, - bankId = 75, - mapId = 50, - width = 8, - height = 8, - paletteIdx1 = 116, - paletteIdx2 = 165, - unknownShort = 0, - unknownByte = 87, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = emptyList(), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 11, - x = 0, - y = 6, - elevation = 4, - movementType = 10, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 3, - script = "BattlePyramid_TrainerBattle"), - NpcDef( - entityIdx = 1, - graphicsId = 11, - x = 4, - y = 0, - elevation = 4, - movementType = 17, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "BattlePyramid_TrainerBattle"), - NpcDef( - entityIdx = 2, - graphicsId = 11, - x = 6, - y = 0, - elevation = 4, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "BattlePyramid_TrainerBattle"), - NpcDef( - entityIdx = 3, - graphicsId = 11, - x = 4, - y = 4, - elevation = 4, - movementType = 15, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "BattlePyramid_TrainerBattle"), - NpcDef( - entityIdx = 4, - graphicsId = 59, - x = 7, - y = 4, - elevation = 4, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "BattlePyramid_FindItemBall"), - NpcDef( - entityIdx = 5, - graphicsId = 59, - x = 1, - y = 1, - elevation = 4, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "BattlePyramid_FindItemBall"), - NpcDef( - entityIdx = 6, - graphicsId = 59, - x = 3, - y = 7, - elevation = 4, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "BattlePyramid_FindItemBall"), - ), - bgEvents = emptyList(), - ), - // BattlePyramidSquare08 (MAP_BATTLE_PYRAMID_SQUARE08) - MapDef( - regionId = 1, - bankId = 75, - mapId = 51, - width = 8, - height = 8, - paletteIdx1 = 116, - paletteIdx2 = 165, - unknownShort = 0, - unknownByte = 87, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = emptyList(), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 12, - x = 1, - y = 2, - elevation = 4, - movementType = 18, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "BattlePyramid_TrainerBattle"), - NpcDef( - entityIdx = 1, - graphicsId = 12, - x = 6, - y = 5, - elevation = 4, - movementType = 15, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "BattlePyramid_TrainerBattle"), - NpcDef( - entityIdx = 2, - graphicsId = 12, - x = 1, - y = 5, - elevation = 4, - movementType = 16, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "BattlePyramid_TrainerBattle"), - NpcDef( - entityIdx = 3, - graphicsId = 12, - x = 6, - y = 2, - elevation = 4, - movementType = 15, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "BattlePyramid_TrainerBattle"), - NpcDef( - entityIdx = 4, - graphicsId = 59, - x = 4, - y = 3, - elevation = 4, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "BattlePyramid_FindItemBall"), - NpcDef( - entityIdx = 5, - graphicsId = 59, - x = 3, - y = 6, - elevation = 4, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "BattlePyramid_FindItemBall"), - NpcDef( - entityIdx = 6, - graphicsId = 59, - x = 1, - y = 0, - elevation = 4, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "BattlePyramid_FindItemBall"), - ), - bgEvents = emptyList(), - ), - // BattlePyramidSquare09 (MAP_BATTLE_PYRAMID_SQUARE09) - MapDef( - regionId = 1, - bankId = 75, - mapId = 52, - width = 8, - height = 8, - paletteIdx1 = 116, - paletteIdx2 = 165, - unknownShort = 0, - unknownByte = 87, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = emptyList(), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 12, - x = 3, - y = 0, - elevation = 4, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "BattlePyramid_TrainerBattle"), - NpcDef( - entityIdx = 1, - graphicsId = 12, - x = 6, - y = 4, - elevation = 4, - movementType = 15, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "BattlePyramid_TrainerBattle"), - NpcDef( - entityIdx = 2, - graphicsId = 12, - x = 6, - y = 0, - elevation = 4, - movementType = 17, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "BattlePyramid_TrainerBattle"), - NpcDef( - entityIdx = 3, - graphicsId = 12, - x = 3, - y = 5, - elevation = 4, - movementType = 15, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "BattlePyramid_TrainerBattle"), - NpcDef( - entityIdx = 4, - graphicsId = 59, - x = 7, - y = 0, - elevation = 4, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "BattlePyramid_FindItemBall"), - NpcDef( - entityIdx = 5, - graphicsId = 59, - x = 1, - y = 0, - elevation = 4, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "BattlePyramid_FindItemBall"), - NpcDef( - entityIdx = 6, - graphicsId = 59, - x = 1, - y = 6, - elevation = 4, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "BattlePyramid_FindItemBall"), - ), - bgEvents = emptyList(), - ), - // BattlePyramidSquare10 (MAP_BATTLE_PYRAMID_SQUARE10) - MapDef( - regionId = 1, - bankId = 75, - mapId = 53, - width = 8, - height = 8, - paletteIdx1 = 116, - paletteIdx2 = 165, - unknownShort = 0, - unknownByte = 87, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = emptyList(), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 14, - x = 3, - y = 0, - elevation = 4, - movementType = 17, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "BattlePyramid_TrainerBattle"), - NpcDef( - entityIdx = 1, - graphicsId = 14, - x = 0, - y = 3, - elevation = 4, - movementType = 10, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 3, - script = "BattlePyramid_TrainerBattle"), - NpcDef( - entityIdx = 2, - graphicsId = 14, - x = 6, - y = 5, - elevation = 4, - movementType = 9, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 2, - script = "BattlePyramid_TrainerBattle"), - NpcDef( - entityIdx = 3, - graphicsId = 14, - x = 0, - y = 5, - elevation = 4, - movementType = 10, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 3, - script = "BattlePyramid_TrainerBattle"), - NpcDef( - entityIdx = 4, - graphicsId = 59, - x = 3, - y = 6, - elevation = 4, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "BattlePyramid_FindItemBall"), - NpcDef( - entityIdx = 5, - graphicsId = 59, - x = 5, - y = 3, - elevation = 4, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "BattlePyramid_FindItemBall"), - NpcDef( - entityIdx = 6, - graphicsId = 59, - x = 1, - y = 1, - elevation = 4, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "BattlePyramid_FindItemBall"), - ), - bgEvents = emptyList(), - ), - // BattlePyramidSquare11 (MAP_BATTLE_PYRAMID_SQUARE11) - MapDef( - regionId = 1, - bankId = 75, - mapId = 54, - width = 8, - height = 8, - paletteIdx1 = 116, - paletteIdx2 = 165, - unknownShort = 0, - unknownByte = 87, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = emptyList(), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 15, - x = 3, - y = 2, - elevation = 4, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "BattlePyramid_TrainerBattle"), - NpcDef( - entityIdx = 1, - graphicsId = 15, - x = 3, - y = 6, - elevation = 4, - movementType = 14, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "BattlePyramid_TrainerBattle"), - NpcDef( - entityIdx = 2, - graphicsId = 15, - x = 6, - y = 4, - elevation = 4, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "BattlePyramid_TrainerBattle"), - NpcDef( - entityIdx = 3, - graphicsId = 15, - x = 6, - y = 7, - elevation = 4, - movementType = 7, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 1, - script = "BattlePyramid_TrainerBattle"), - NpcDef( - entityIdx = 4, - graphicsId = 59, - x = 6, - y = 2, - elevation = 4, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "BattlePyramid_FindItemBall"), - NpcDef( - entityIdx = 5, - graphicsId = 59, - x = 1, - y = 2, - elevation = 4, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "BattlePyramid_FindItemBall"), - NpcDef( - entityIdx = 6, - graphicsId = 59, - x = 1, - y = 5, - elevation = 4, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "BattlePyramid_FindItemBall"), - ), - bgEvents = emptyList(), - ), - // BattlePyramidSquare12 (MAP_BATTLE_PYRAMID_SQUARE12) - MapDef( - regionId = 1, - bankId = 75, - mapId = 55, - width = 8, - height = 8, - paletteIdx1 = 116, - paletteIdx2 = 165, - unknownShort = 0, - unknownByte = 87, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = emptyList(), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 16, - x = 7, - y = 5, - elevation = 4, - movementType = 9, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 2, - script = "BattlePyramid_TrainerBattle"), - NpcDef( - entityIdx = 1, - graphicsId = 16, - x = 0, - y = 5, - elevation = 4, - movementType = 10, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 3, - script = "BattlePyramid_TrainerBattle"), - NpcDef( - entityIdx = 2, - graphicsId = 16, - x = 3, - y = 0, - elevation = 4, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "BattlePyramid_TrainerBattle"), - NpcDef( - entityIdx = 3, - graphicsId = 16, - x = 3, - y = 3, - elevation = 4, - movementType = 7, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 1, - script = "BattlePyramid_TrainerBattle"), - NpcDef( - entityIdx = 4, - graphicsId = 59, - x = 7, - y = 2, - elevation = 4, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "BattlePyramid_FindItemBall"), - NpcDef( - entityIdx = 5, - graphicsId = 59, - x = 0, - y = 3, - elevation = 4, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "BattlePyramid_FindItemBall"), - NpcDef( - entityIdx = 6, - graphicsId = 59, - x = 7, - y = 7, - elevation = 4, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "BattlePyramid_FindItemBall"), - ), - bgEvents = emptyList(), - ), - // BattlePyramidSquare13 (MAP_BATTLE_PYRAMID_SQUARE13) - MapDef( - regionId = 1, - bankId = 75, - mapId = 56, - width = 8, - height = 8, - paletteIdx1 = 116, - paletteIdx2 = 165, - unknownShort = 0, - unknownByte = 87, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = emptyList(), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 17, - x = 5, - y = 1, - elevation = 4, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "BattlePyramid_TrainerBattle"), - NpcDef( - entityIdx = 1, - graphicsId = 17, - x = 5, - y = 6, - elevation = 4, - movementType = 7, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 1, - script = "BattlePyramid_TrainerBattle"), - NpcDef( - entityIdx = 2, - graphicsId = 17, - x = 1, - y = 1, - elevation = 4, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "BattlePyramid_TrainerBattle"), - NpcDef( - entityIdx = 3, - graphicsId = 17, - x = 1, - y = 6, - elevation = 4, - movementType = 7, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 1, - script = "BattlePyramid_TrainerBattle"), - NpcDef( - entityIdx = 4, - graphicsId = 59, - x = 3, - y = 1, - elevation = 4, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "BattlePyramid_FindItemBall"), - NpcDef( - entityIdx = 5, - graphicsId = 59, - x = 7, - y = 0, - elevation = 4, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "BattlePyramid_FindItemBall"), - NpcDef( - entityIdx = 6, - graphicsId = 59, - x = 0, - y = 3, - elevation = 4, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "BattlePyramid_FindItemBall"), - ), - bgEvents = emptyList(), - ), - // BattlePyramidSquare14 (MAP_BATTLE_PYRAMID_SQUARE14) - MapDef( - regionId = 1, - bankId = 75, - mapId = 57, - width = 8, - height = 8, - paletteIdx1 = 116, - paletteIdx2 = 165, - unknownShort = 0, - unknownByte = 87, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = emptyList(), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 18, - x = 7, - y = 1, - elevation = 4, - movementType = 17, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "BattlePyramid_TrainerBattle"), - NpcDef( - entityIdx = 1, - graphicsId = 18, - x = 1, - y = 1, - elevation = 4, - movementType = 18, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "BattlePyramid_TrainerBattle"), - NpcDef( - entityIdx = 2, - graphicsId = 18, - x = 6, - y = 5, - elevation = 4, - movementType = 15, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "BattlePyramid_TrainerBattle"), - NpcDef( - entityIdx = 3, - graphicsId = 18, - x = 0, - y = 5, - elevation = 4, - movementType = 16, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "BattlePyramid_TrainerBattle"), - NpcDef( - entityIdx = 4, - graphicsId = 59, - x = 5, - y = 3, - elevation = 4, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "BattlePyramid_FindItemBall"), - NpcDef( - entityIdx = 5, - graphicsId = 59, - x = 0, - y = 7, - elevation = 4, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "BattlePyramid_FindItemBall"), - NpcDef( - entityIdx = 6, - graphicsId = 59, - x = 7, - y = 5, - elevation = 4, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "BattlePyramid_FindItemBall"), - ), - bgEvents = emptyList(), - ), - // BattlePyramidSquare15 (MAP_BATTLE_PYRAMID_SQUARE15) - MapDef( - regionId = 1, - bankId = 75, - mapId = 58, - width = 8, - height = 8, - paletteIdx1 = 116, - paletteIdx2 = 165, - unknownShort = 0, - unknownByte = 87, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = emptyList(), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 18, - x = 2, - y = 5, - elevation = 4, - movementType = 16, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "BattlePyramid_TrainerBattle"), - NpcDef( - entityIdx = 1, - graphicsId = 18, - x = 2, - y = 1, - elevation = 4, - movementType = 18, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "BattlePyramid_TrainerBattle"), - NpcDef( - entityIdx = 2, - graphicsId = 18, - x = 6, - y = 4, - elevation = 4, - movementType = 15, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "BattlePyramid_TrainerBattle"), - NpcDef( - entityIdx = 3, - graphicsId = 18, - x = 6, - y = 0, - elevation = 4, - movementType = 17, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "BattlePyramid_TrainerBattle"), - NpcDef( - entityIdx = 4, - graphicsId = 59, - x = 0, - y = 7, - elevation = 4, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "BattlePyramid_FindItemBall"), - NpcDef( - entityIdx = 5, - graphicsId = 59, - x = 7, - y = 5, - elevation = 4, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "BattlePyramid_FindItemBall"), - NpcDef( - entityIdx = 6, - graphicsId = 59, - x = 1, - y = 2, - elevation = 4, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "BattlePyramid_FindItemBall"), - ), - bgEvents = emptyList(), - ), - // BattlePyramidSquare16 (MAP_BATTLE_PYRAMID_SQUARE16) - MapDef( - regionId = 1, - bankId = 75, - mapId = 59, - width = 8, - height = 8, - paletteIdx1 = 116, - paletteIdx2 = 165, - unknownShort = 0, - unknownByte = 87, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = emptyList(), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 18, - x = 0, - y = 6, - elevation = 4, - movementType = 16, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "BattlePyramid_TrainerBattle"), - NpcDef( - entityIdx = 1, - graphicsId = 18, - x = 1, - y = 0, - elevation = 3, - movementType = 18, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "BattlePyramid_TrainerBattle"), - NpcDef( - entityIdx = 2, - graphicsId = 18, - x = 6, - y = 7, - elevation = 4, - movementType = 15, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "BattlePyramid_TrainerBattle"), - NpcDef( - entityIdx = 3, - graphicsId = 18, - x = 6, - y = 0, - elevation = 4, - movementType = 17, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "BattlePyramid_TrainerBattle"), - NpcDef( - entityIdx = 4, - graphicsId = 59, - x = 0, - y = 7, - elevation = 4, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "BattlePyramid_FindItemBall"), - NpcDef( - entityIdx = 5, - graphicsId = 59, - x = 7, - y = 7, - elevation = 4, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "BattlePyramid_FindItemBall"), - NpcDef( - entityIdx = 6, - graphicsId = 59, - x = 5, - y = 2, - elevation = 4, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "BattlePyramid_FindItemBall"), - ), - bgEvents = emptyList(), - ), - // UnionRoom (MAP_UNION_ROOM) - MapDef( - regionId = 1, - bankId = 75, - mapId = 60, - width = 15, - height = 12, - paletteIdx1 = 116, - paletteIdx2 = 174, - unknownShort = 422, - unknownByte = 87, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = emptyList(), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 0, - x = 3, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "UnionRoom_EventScript_Attendant"), - ), - bgEvents = emptyList(), - ), - // SafariZone_Northwest (MAP_SAFARI_ZONE_NORTHWEST) - MapDef( - regionId = 1, - bankId = 76, - mapId = 0, - width = 40, - height = 40, - paletteIdx1 = 100, - paletteIdx2 = 109, - unknownShort = 428, - unknownByte = 57, - borderTiles = - listOf( - Tile2D(0x01D4, 0), Tile2D(0x01D5, 0), Tile2D(0x01DC, 0), Tile2D(0x01DD, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.ROUTE, - encounterType = EncounterType.RANDOM, - connections = - listOf( - GbaConnection(direction = 4, unknown = 0, targetBank = 76, targetMap = 1), - GbaConnection(direction = 1, unknown = 0, targetBank = 76, targetMap = 2), - ), - warps = emptyList(), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 19, - x = 8, - y = 8, - elevation = 5, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "SafariZone_Northwest_EventScript_Man"), - ), - bgEvents = emptyList(), - ), - // SafariZone_North (MAP_SAFARI_ZONE_NORTH) - MapDef( - regionId = 1, - bankId = 76, - mapId = 1, - width = 40, - height = 40, - paletteIdx1 = 100, - paletteIdx2 = 109, - unknownShort = 428, - unknownByte = 57, - borderTiles = - listOf( - Tile2D(0x01D4, 0), Tile2D(0x01D5, 0), Tile2D(0x01DC, 0), Tile2D(0x01DD, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.ROUTE, - encounterType = EncounterType.RANDOM, - connections = - listOf( - GbaConnection(direction = 3, unknown = 0, targetBank = 76, targetMap = 0), - GbaConnection(direction = 1, unknown = 0, targetBank = 76, targetMap = 3), - GbaConnection(direction = 4, unknown = 0, targetBank = 76, targetMap = 12), - ), - warps = emptyList(), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 50, - x = 22, - y = 9, - elevation = 3, - movementType = 2, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "SafariZone_North_EventScript_Fisherman"), - NpcDef( - entityIdx = 1, - graphicsId = 65, - x = 6, - y = 29, - elevation = 3, - movementType = 2, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "SafariZone_North_EventScript_Man"), - ), - bgEvents = emptyList(), - ), - // SafariZone_Southwest (MAP_SAFARI_ZONE_SOUTHWEST) - MapDef( - regionId = 1, - bankId = 76, - mapId = 2, - width = 40, - height = 40, - paletteIdx1 = 100, - paletteIdx2 = 109, - unknownShort = 428, - unknownByte = 57, - borderTiles = - listOf( - Tile2D(0x01D4, 0), Tile2D(0x01D5, 0), Tile2D(0x01DC, 0), Tile2D(0x01DD, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.ROUTE, - encounterType = EncounterType.RANDOM, - connections = - listOf( - GbaConnection(direction = 2, unknown = 0, targetBank = 76, targetMap = 0), - GbaConnection(direction = 4, unknown = 0, targetBank = 76, targetMap = 3), - ), - warps = - listOf( - WarpTile( - x = 29, - y = 7, - elevation = 2, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 11, - targetX = 3, - targetY = 8, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 20, - x = 22, - y = 9, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "SafariZone_Southwest_EventScript_Woman"), - ), - bgEvents = - listOf( - BgEventDef( - x = 32, - y = 7, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "SafariZone_Southwest_EventScript_RestHouseSign"), - ), - ), - // SafariZone_South (MAP_SAFARI_ZONE_SOUTH) - MapDef( - regionId = 1, - bankId = 76, - mapId = 3, - width = 40, - height = 40, - paletteIdx1 = 100, - paletteIdx2 = 109, - unknownShort = 428, - unknownByte = 57, - borderTiles = - listOf( - Tile2D(0x01D4, 0), Tile2D(0x01D5, 0), Tile2D(0x01DC, 0), Tile2D(0x01DD, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.ROUTE, - encounterType = EncounterType.RANDOM, - connections = - listOf( - GbaConnection(direction = 2, unknown = 0, targetBank = 76, targetMap = 1), - GbaConnection(direction = 3, unknown = 0, targetBank = 76, targetMap = 2), - GbaConnection(direction = 4, unknown = 0, targetBank = 76, targetMap = 13), - ), - warps = - listOf( - WarpTile( - x = 32, - y = 33, - elevation = 0, - targetRegionId = 1, - targetBankId = 73, - targetMapId = 0, - targetX = 2, - targetY = 5, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 31, - x = 32, - y = 34, - elevation = 4, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "SafariZone_South_EventScript_ExitAttendant"), - NpcDef( - entityIdx = 1, - graphicsId = 7, - x = 26, - y = 28, - elevation = 3, - movementType = 2, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "SafariZone_South_EventScript_Boy"), - NpcDef( - entityIdx = 2, - graphicsId = 65, - x = 16, - y = 6, - elevation = 5, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "SafariZone_South_EventScript_Man"), - NpcDef( - entityIdx = 3, - graphicsId = 35, - x = 15, - y = 31, - elevation = 3, - movementType = 2, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "SafariZone_South_EventScript_Youngster"), - ), - bgEvents = emptyList(), - ), - // BattleFrontier_OutsideWest (MAP_BATTLE_FRONTIER_OUTSIDE_WEST) - MapDef( - regionId = 1, - bankId = 76, - mapId = 4, - width = 56, - height = 72, - paletteIdx1 = 100, - paletteIdx2 = 114, - unknownShort = 457, - unknownByte = 58, - borderTiles = - listOf( - Tile2D(0x0170, 0), Tile2D(0x0170, 0), Tile2D(0x0170, 0), Tile2D(0x0170, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.ROUTE, - encounterType = EncounterType.RANDOM, - connections = - listOf( - GbaConnection(direction = 4, unknown = 0, targetBank = 76, targetMap = 14), - ), - warps = - listOf( - WarpTile( - x = 42, - y = 27, - elevation = 0, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 34, - targetX = 5, - targetY = 12, - targetElevation = 0), - WarpTile( - x = 19, - y = 17, - elevation = 0, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 18, - targetX = 11, - targetY = 16, - targetElevation = 0), - WarpTile( - x = 11, - y = 38, - elevation = 0, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 31, - targetX = 9, - targetY = 11, - targetElevation = 0), - WarpTile( - x = 45, - y = 44, - elevation = 0, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 43, - targetX = 1, - targetY = 7, - targetElevation = 0), - WarpTile( - x = 51, - y = 51, - elevation = 0, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 55, - targetX = 3, - targetY = 7, - targetElevation = 0), - WarpTile( - x = 44, - y = 5, - elevation = 0, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 46, - targetX = 2, - targetY = 7, - targetElevation = 2), - WarpTile( - x = 53, - y = 44, - elevation = 0, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 45, - targetX = 4, - targetY = 9, - targetElevation = 0), - WarpTile( - x = 5, - y = 20, - elevation = 0, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 49, - targetX = 4, - targetY = 9, - targetElevation = 0), - WarpTile( - x = 26, - y = 65, - elevation = 0, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 50, - targetX = 4, - targetY = 13, - targetElevation = 0), - WarpTile( - x = 26, - y = 61, - elevation = 0, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 50, - targetX = 4, - targetY = 1, - targetElevation = 0), - WarpTile( - x = 39, - y = 55, - elevation = 0, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 99, - targetX = 8, - targetY = 48, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 9, - x = 26, - y = 38, - elevation = 3, - movementType = 2, - movementRangeX = 2, - movementRangeY = 2, - trainerType = 0, - facing = 0, - script = "BattleFrontier_OutsideWest_EventScript_Boy1"), - NpcDef( - entityIdx = 1, - graphicsId = 0, - x = 20, - y = 70, - elevation = 3, - movementType = 10, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 3, - script = "0x0"), - NpcDef( - entityIdx = 2, - graphicsId = 45, - x = 19, - y = 68, - elevation = 3, - movementType = 7, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 1, - script = "BattleFrontier_OutsideWest_EventScript_FerryAttendant"), - NpcDef( - entityIdx = 3, - graphicsId = 21, - x = 26, - y = 20, - elevation = 3, - movementType = 5, - movementRangeX = 8, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "BattleFrontier_OutsideWest_EventScript_ExpertM"), - NpcDef( - entityIdx = 4, - graphicsId = 33, - x = 27, - y = 30, - elevation = 3, - movementType = 2, - movementRangeX = 1, - movementRangeY = 3, - trainerType = 0, - facing = 0, - script = "BattleFrontier_OutsideWest_EventScript_Man1"), - NpcDef( - entityIdx = 5, - graphicsId = 34, - x = 33, - y = 41, - elevation = 3, - movementType = 2, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "BattleFrontier_OutsideWest_EventScript_Woman1"), - NpcDef( - entityIdx = 6, - graphicsId = 17, - x = 28, - y = 43, - elevation = 3, - movementType = 3, - movementRangeX = 0, - movementRangeY = 3, - trainerType = 0, - facing = 0, - script = "BattleFrontier_OutsideWest_EventScript_FatMan1"), - NpcDef( - entityIdx = 7, - graphicsId = 48, - x = 17, - y = 20, - elevation = 3, - movementType = 2, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "BattleFrontier_OutsideWest_EventScript_Gentleman"), - NpcDef( - entityIdx = 8, - graphicsId = 39, - x = 13, - y = 44, - elevation = 3, - movementType = 7, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 1, - script = "BattleFrontier_OutsideWest_EventScript_Maniac1"), - NpcDef( - entityIdx = 9, - graphicsId = 39, - x = 14, - y = 44, - elevation = 3, - movementType = 7, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 1, - script = "BattleFrontier_OutsideWest_EventScript_Maniac2"), - NpcDef( - entityIdx = 10, - graphicsId = 66, - x = 23, - y = 47, - elevation = 3, - movementType = 15, - movementRangeX = 2, - movementRangeY = 2, - trainerType = 0, - facing = 0, - script = "BattleFrontier_OutsideWest_EventScript_Man2"), - NpcDef( - entityIdx = 11, - graphicsId = 8, - x = 38, - y = 27, - elevation = 3, - movementType = 2, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "BattleFrontier_OutsideWest_EventScript_Girl"), - NpcDef( - entityIdx = 12, - graphicsId = 24, - x = 45, - y = 18, - elevation = 3, - movementType = 3, - movementRangeX = 1, - movementRangeY = 3, - trainerType = 0, - facing = 0, - script = "BattleFrontier_OutsideWest_EventScript_Woman2"), - NpcDef( - entityIdx = 13, - graphicsId = 31, - x = 9, - y = 47, - elevation = 3, - movementType = 15, - movementRangeX = 1, - movementRangeY = 2, - trainerType = 0, - facing = 0, - script = "BattleFrontier_OutsideWest_EventScript_Camper"), - NpcDef( - entityIdx = 14, - graphicsId = 47, - x = 35, - y = 5, - elevation = 3, - movementType = 2, - movementRangeX = 2, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "BattleFrontier_OutsideWest_EventScript_Lass"), - NpcDef( - entityIdx = 15, - graphicsId = 23, - x = 11, - y = 66, - elevation = 3, - movementType = 9, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 2, - script = "BattleFrontier_OutsideWest_EventScript_Man3"), - NpcDef( - entityIdx = 16, - graphicsId = 50, - x = 31, - y = 31, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "BattleFrontier_OutsideWest_EventScript_Fisherman1"), - NpcDef( - entityIdx = 17, - graphicsId = 50, - x = 42, - y = 48, - elevation = 3, - movementType = 18, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "BattleFrontier_OutsideWest_EventScript_Fisherman2"), - NpcDef( - entityIdx = 18, - graphicsId = 17, - x = 38, - y = 22, - elevation = 3, - movementType = 3, - movementRangeX = 0, - movementRangeY = 3, - trainerType = 0, - facing = 0, - script = "BattleFrontier_OutsideWest_EventScript_FatMan2"), - NpcDef( - entityIdx = 19, - graphicsId = 20, - x = 12, - y = 9, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "BattleFrontier_OutsideWest_EventScript_Woman3"), - NpcDef( - entityIdx = 20, - graphicsId = 7, - x = 12, - y = 10, - elevation = 3, - movementType = 7, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 1, - script = "BattleFrontier_OutsideWest_EventScript_Boy2"), - NpcDef( - entityIdx = 21, - graphicsId = 29, - x = 11, - y = 10, - elevation = 3, - movementType = 23, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "BattleFrontier_OutsideWest_EventScript_OldMan"), - NpcDef( - entityIdx = 22, - graphicsId = 65, - x = 8, - y = 5, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "BattleFrontier_OutsideWest_EventScript_Man4"), - NpcDef( - entityIdx = 23, - graphicsId = 18, - x = 4, - y = 26, - elevation = 3, - movementType = 24, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "BattleFrontier_OutsideWest_EventScript_PokefanF"), - ), - bgEvents = - listOf( - BgEventDef( - x = 15, - y = 18, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "BattleFrontier_OutsideWest_EventScript_BattleDomeSign"), - BgEventDef( - x = 45, - y = 30, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "BattleFrontier_OutsideWest_EventScript_BattlePikeSign"), - BgEventDef( - x = 16, - y = 43, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "BattleFrontier_OutsideWest_EventScript_BattleFactorySign"), - BgEventDef( - x = 52, - y = 51, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "Common_EventScript_ShowPokemartSign"), - BgEventDef( - x = 53, - y = 51, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "Common_EventScript_ShowPokemartSign"), - ), - ), - // BattleFrontier_BattleTowerLobby (MAP_BATTLE_FRONTIER_BATTLE_TOWER_LOBBY) - MapDef( - regionId = 1, - bankId = 76, - mapId = 5, - width = 25, - height = 10, - paletteIdx1 = 116, - paletteIdx2 = 159, - unknownShort = 465, - unknownByte = 58, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 12, - y = 9, - elevation = 2, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 14, - targetX = 16, - targetY = 14, - targetElevation = 0), - WarpTile( - x = 13, - y = 9, - elevation = 2, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 14, - targetX = 16, - targetY = 14, - targetElevation = 0), - WarpTile( - x = 6, - y = 1, - elevation = 0, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 8, - targetX = 5, - targetY = 8, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 0, - x = 6, - y = 5, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = - "BattleFrontier_BattleTowerLobby_EventScript_SinglesAttendant"), - NpcDef( - entityIdx = 1, - graphicsId = 65, - x = 23, - y = 5, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "BattleFrontier_BattleTowerLobby_EventScript_FeelingsMan"), - NpcDef( - entityIdx = 2, - graphicsId = 34, - x = 17, - y = 8, - elevation = 3, - movementType = 2, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "BattleFrontier_BattleTowerLobby_EventScript_Woman"), - NpcDef( - entityIdx = 3, - graphicsId = 7, - x = 15, - y = 9, - elevation = 3, - movementType = 2, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "BattleFrontier_BattleTowerLobby_EventScript_Boy"), - NpcDef( - entityIdx = 6, - graphicsId = 0, - x = 10, - y = 5, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = - "BattleFrontier_BattleTowerLobby_EventScript_DoublesAttendant"), - NpcDef( - entityIdx = 7, - graphicsId = 0, - x = 14, - y = 5, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "BattleFrontier_BattleTowerLobby_EventScript_MultisAttendant"), - NpcDef( - entityIdx = 8, - graphicsId = 0, - x = 18, - y = 5, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = - "BattleFrontier_BattleTowerLobby_EventScript_LinkMultisAttendant"), - ), - bgEvents = - listOf( - BgEventDef( - x = 4, - y = 5, - facingDir = "BG_EVENT_PLAYER_FACING_NORTH", - script = - "BattleFrontier_BattleTowerLobby_EventScript_ShowSinglesResults"), - BgEventDef( - x = 8, - y = 5, - facingDir = "BG_EVENT_PLAYER_FACING_NORTH", - script = - "BattleFrontier_BattleTowerLobby_EventScript_ShowDoublesResults"), - BgEventDef( - x = 12, - y = 5, - facingDir = "BG_EVENT_PLAYER_FACING_NORTH", - script = - "BattleFrontier_BattleTowerLobby_EventScript_ShowMultisResults"), - BgEventDef( - x = 16, - y = 5, - facingDir = "BG_EVENT_PLAYER_FACING_NORTH", - script = - "BattleFrontier_BattleTowerLobby_EventScript_ShowLinkMultisResults"), - BgEventDef( - x = 2, - y = 1, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "BattleFrontier_BattleTowerLobby_EventScript_RulesBoard"), - ), - ), - // BattleFrontier_BattleTowerElevator (MAP_BATTLE_FRONTIER_BATTLE_TOWER_ELEVATOR) - MapDef( - regionId = 1, - bankId = 76, - mapId = 6, - width = 5, - height = 7, - paletteIdx1 = 116, - paletteIdx2 = 159, - unknownShort = 465, - unknownByte = 58, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = emptyList(), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 0, - x = 1, - y = 5, - elevation = 3, - movementType = 7, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 1, - script = "0x0"), - ), - bgEvents = emptyList(), - ), - // BattleFrontier_BattleTowerCorridor (MAP_BATTLE_FRONTIER_BATTLE_TOWER_CORRIDOR) - MapDef( - regionId = 1, - bankId = 76, - mapId = 7, - width = 17, - height = 5, - paletteIdx1 = 116, - paletteIdx2 = 159, - unknownShort = 465, - unknownByte = 58, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = emptyList(), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 0, - x = 9, - y = 2, - elevation = 3, - movementType = 9, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 2, - script = "0x0"), - ), - bgEvents = emptyList(), - ), - // BattleFrontier_BattleTowerBattleRoom (MAP_BATTLE_FRONTIER_BATTLE_TOWER_BATTLE_ROOM) - MapDef( - regionId = 1, - bankId = 76, - mapId = 8, - width = 10, - height = 9, - paletteIdx1 = 116, - paletteIdx2 = 159, - unknownShort = 465, - unknownByte = 58, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 5, - y = 8, - elevation = 0, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 5, - targetX = 6, - targetY = 1, - targetElevation = 0), - WarpTile( - x = 6, - y = 8, - elevation = 0, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 5, - targetX = 6, - targetY = 1, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 1, - graphicsId = 0, - x = 1, - y = 7, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 3, - script = "0x0"), - NpcDef( - entityIdx = 2, - graphicsId = 0, - x = 4, - y = 8, - elevation = 3, - movementType = 7, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 1, - script = "0x0"), - ), - bgEvents = emptyList(), - ), - // SouthernIsland_Exterior (MAP_SOUTHERN_ISLAND_EXTERIOR) - MapDef( - regionId = 1, - bankId = 76, - mapId = 9, - width = 33, - height = 30, - paletteIdx1 = 100, - paletteIdx2 = 102, - unknownShort = 381, - unknownByte = 73, - borderTiles = - listOf( - Tile2D(0x0170, 0), Tile2D(0x0170, 0), Tile2D(0x0170, 0), Tile2D(0x0170, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.ROUTE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 14, - y = 5, - elevation = 2, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 10, - targetX = 13, - targetY = 18, - targetElevation = 2), - WarpTile( - x = 15, - y = 5, - elevation = 2, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 10, - targetX = 14, - targetY = 18, - targetElevation = 2), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 49, - x = 13, - y = 23, - elevation = 3, - movementType = 7, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 1, - script = "SouthernIsland_Exterior_EventScript_Sailor"), - NpcDef( - entityIdx = 1, - graphicsId = 0, - x = 13, - y = 25, - elevation = 1, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 3, - script = "0x0"), - ), - bgEvents = - listOf( - BgEventDef( - x = 16, - y = 7, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "SouthernIsland_Exterior_EventScript_Sign"), - ), - ), - // SouthernIsland_Interior (MAP_SOUTHERN_ISLAND_INTERIOR) - MapDef( - regionId = 1, - bankId = 76, - mapId = 10, - width = 27, - height = 24, - paletteIdx1 = 100, - paletteIdx2 = 102, - unknownShort = 381, - unknownByte = 73, - borderTiles = - listOf( - Tile2D(0x01D4, 0), Tile2D(0x01D5, 0), Tile2D(0x01DC, 0), Tile2D(0x01DD, 0)), - lighting = Lighting.REGULAR, - weather = Weather.CLOUDY, - mapType = MapType.ROUTE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 13, - y = 18, - elevation = 2, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 9, - targetX = 14, - targetY = 5, - targetElevation = 2), - WarpTile( - x = 14, - y = 18, - elevation = 2, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 9, - targetX = 15, - targetY = 5, - targetElevation = 2), - ), - npcs = emptyList(), - bgEvents = - listOf( - BgEventDef( - x = 13, - y = 11, - facingDir = "BG_EVENT_PLAYER_FACING_NORTH", - script = "SouthernIsland_Interior_EventScript_TryLatiEncounter"), - ), - ), - // SafariZone_RestHouse (MAP_SAFARI_ZONE_REST_HOUSE) - MapDef( - regionId = 1, - bankId = 76, - mapId = 11, - width = 10, - height = 9, - paletteIdx1 = 116, - paletteIdx2 = 147, - unknownShort = 428, - unknownByte = 57, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 3, - y = 8, - elevation = 0, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 2, - targetX = 29, - targetY = 7, - targetElevation = 2), - WarpTile( - x = 4, - y = 8, - elevation = 0, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 2, - targetX = 29, - targetY = 7, - targetElevation = 2), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 35, - x = 7, - y = 4, - elevation = 3, - movementType = 10, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 3, - script = "SafariZone_RestHouse_EventScript_Youngster"), - NpcDef( - entityIdx = 1, - graphicsId = 37, - x = 8, - y = 4, - elevation = 3, - movementType = 9, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 2, - script = "SafariZone_RestHouse_EventScript_PsychicM"), - NpcDef( - entityIdx = 2, - graphicsId = 17, - x = 2, - y = 5, - elevation = 3, - movementType = 10, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 3, - script = "SafariZone_RestHouse_EventScript_FatMan"), - ), - bgEvents = emptyList(), - ), - // SafariZone_Northeast (MAP_SAFARI_ZONE_NORTHEAST) - MapDef( - regionId = 1, - bankId = 76, - mapId = 12, - width = 40, - height = 40, - paletteIdx1 = 100, - paletteIdx2 = 109, - unknownShort = 428, - unknownByte = 57, - borderTiles = - listOf( - Tile2D(0x01D4, 0), Tile2D(0x01D5, 0), Tile2D(0x01DC, 0), Tile2D(0x01DD, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.ROUTE, - encounterType = EncounterType.RANDOM, - connections = - listOf( - GbaConnection(direction = 3, unknown = 0, targetBank = 76, targetMap = 1), - GbaConnection(direction = 1, unknown = 0, targetBank = 76, targetMap = 13), - ), - warps = emptyList(), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 13, - x = 8, - y = 20, - elevation = 3, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "SafariZone_Northeast_EventScript_Boy"), - NpcDef( - entityIdx = 1, - graphicsId = 14, - x = 30, - y = 22, - elevation = 3, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "SafariZone_Northeast_EventScript_Girl"), - NpcDef( - entityIdx = 3, - graphicsId = 16, - x = 13, - y = 35, - elevation = 3, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "SafariZone_Northeast_EventScript_Woman"), - ), - bgEvents = - listOf( - BgEventDef( - x = 31, - y = 35, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 21, - y = 5, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - ), - ), - ) - allMaps.forEach { registerMap(it) } - } - - private fun registerDefaultMaps7() { - val allMaps = - listOf( - // SafariZone_Southeast (MAP_SAFARI_ZONE_SOUTHEAST) - MapDef( - regionId = 1, - bankId = 76, - mapId = 13, - width = 40, - height = 40, - paletteIdx1 = 100, - paletteIdx2 = 109, - unknownShort = 428, - unknownByte = 57, - borderTiles = - listOf( - Tile2D(0x01D4, 0), Tile2D(0x01D5, 0), Tile2D(0x01DC, 0), Tile2D(0x01DD, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.ROUTE, - encounterType = EncounterType.RANDOM, - connections = - listOf( - GbaConnection(direction = 3, unknown = 0, targetBank = 76, targetMap = 3), - GbaConnection(direction = 2, unknown = 0, targetBank = 76, targetMap = 12), - ), - warps = emptyList(), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 15, - x = 7, - y = 7, - elevation = 3, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "SafariZone_Southeast_EventScript_RichBoy"), - NpcDef( - entityIdx = 1, - graphicsId = 17, - x = 20, - y = 30, - elevation = 3, - movementType = 2, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "SafariZone_Southeast_EventScript_FatMan"), - NpcDef( - entityIdx = 2, - graphicsId = 12, - x = 8, - y = 26, - elevation = 3, - movementType = 2, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "SafariZone_Southeast_EventScript_LittleGirl"), - ), - bgEvents = - listOf( - BgEventDef( - x = 19, - y = 36, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - BgEventDef( - x = 32, - y = 33, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - ), - ), - // BattleFrontier_OutsideEast (MAP_BATTLE_FRONTIER_OUTSIDE_EAST) - MapDef( - regionId = 1, - bankId = 76, - mapId = 14, - width = 72, - height = 72, - paletteIdx1 = 100, - paletteIdx2 = 115, - unknownShort = 457, - unknownByte = 58, - borderTiles = - listOf( - Tile2D(0x0170, 0), Tile2D(0x0170, 0), Tile2D(0x0170, 0), Tile2D(0x0170, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.ROUTE, - encounterType = EncounterType.RANDOM, - connections = - listOf( - GbaConnection(direction = 3, unknown = 0, targetBank = 76, targetMap = 4), - ), - warps = - listOf( - WarpTile( - x = 16, - y = 14, - elevation = 0, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 5, - targetX = 12, - targetY = 9, - targetElevation = 2), - WarpTile( - x = 39, - y = 29, - elevation = 0, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 28, - targetX = 7, - targetY = 12, - targetElevation = 2), - WarpTile( - x = 45, - y = 56, - elevation = 0, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 22, - targetX = 12, - targetY = 11, - targetElevation = 0), - WarpTile( - x = 58, - y = 14, - elevation = 0, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 25, - targetX = 7, - targetY = 17, - targetElevation = 3), - WarpTile( - x = 35, - y = 12, - elevation = 2, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 40, - targetX = 26, - targetY = 14, - targetElevation = 2), - WarpTile( - x = 4, - y = 44, - elevation = 0, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 41, - targetX = 4, - targetY = 9, - targetElevation = 0), - WarpTile( - x = 10, - y = 28, - elevation = 0, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 42, - targetX = 7, - targetY = 10, - targetElevation = 0), - WarpTile( - x = 22, - y = 51, - elevation = 0, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 47, - targetX = 1, - targetY = 7, - targetElevation = 0), - WarpTile( - x = 5, - y = 8, - elevation = 0, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 48, - targetX = 4, - targetY = 9, - targetElevation = 0), - WarpTile( - x = 65, - y = 31, - elevation = 0, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 44, - targetX = 4, - targetY = 9, - targetElevation = 0), - WarpTile( - x = 14, - y = 51, - elevation = 0, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 51, - targetX = 4, - targetY = 9, - targetElevation = 0), - WarpTile( - x = 21, - y = 45, - elevation = 0, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 52, - targetX = 1, - targetY = 9, - targetElevation = 0), - WarpTile( - x = 3, - y = 51, - elevation = 0, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 53, - targetX = 7, - targetY = 8, - targetElevation = 2), - WarpTile( - x = 28, - y = 7, - elevation = 0, - targetRegionId = 1, - targetBankId = 74, - targetMapId = 100, - targetX = 10, - targetY = 17, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 5, - x = 20, - y = 17, - elevation = 3, - movementType = 27, - movementRangeX = 3, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "BattleFrontier_OutsideEast_EventScript_NinjaBoy"), - NpcDef( - entityIdx = 1, - graphicsId = 33, - x = 42, - y = 15, - elevation = 3, - movementType = 2, - movementRangeX = 1, - movementRangeY = 3, - trainerType = 0, - facing = 0, - script = "BattleFrontier_OutsideEast_EventScript_Man1"), - NpcDef( - entityIdx = 2, - graphicsId = 55, - x = 53, - y = 6, - elevation = 3, - movementType = 8, - movementRangeX = 2, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "BattleFrontier_OutsideEast_EventScript_Hiker"), - NpcDef( - entityIdx = 3, - graphicsId = 40, - x = 54, - y = 16, - elevation = 3, - movementType = 2, - movementRangeX = 2, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "BattleFrontier_OutsideEast_EventScript_HexManiac"), - NpcDef( - entityIdx = 4, - graphicsId = 44, - x = 37, - y = 32, - elevation = 3, - movementType = 7, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 1, - script = "BattleFrontier_OutsideEast_EventScript_BlackBelt1"), - NpcDef( - entityIdx = 5, - graphicsId = 27, - x = 41, - y = 56, - elevation = 3, - movementType = 9, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 2, - script = "BattleFrontier_OutsideEast_EventScript_Cook"), - NpcDef( - entityIdx = 6, - graphicsId = 22, - x = 8, - y = 46, - elevation = 3, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "BattleFrontier_OutsideEast_EventScript_ExpertF"), - NpcDef( - entityIdx = 7, - graphicsId = 51, - x = 34, - y = 41, - elevation = 3, - movementType = 28, - movementRangeX = 3, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "BattleFrontier_OutsideEast_EventScript_TriathleteM"), - NpcDef( - entityIdx = 8, - graphicsId = 15, - x = 45, - y = 47, - elevation = 3, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "BattleFrontier_OutsideEast_EventScript_RichBoy"), - NpcDef( - entityIdx = 9, - graphicsId = 57, - x = 59, - y = 35, - elevation = 3, - movementType = 26, - movementRangeX = 1, - movementRangeY = 6, - trainerType = 0, - facing = 0, - script = "BattleFrontier_OutsideEast_EventScript_TriathleteF"), - NpcDef( - entityIdx = 10, - graphicsId = 6, - x = 18, - y = 40, - elevation = 3, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "BattleFrontier_OutsideEast_EventScript_Twin"), - NpcDef( - entityIdx = 11, - graphicsId = 19, - x = 17, - y = 40, - elevation = 3, - movementType = 10, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 3, - script = "BattleFrontier_OutsideEast_EventScript_Man2"), - NpcDef( - entityIdx = 12, - graphicsId = 0, - x = 40, - y = 56, - elevation = 3, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "BattleFrontier_OutsideEast_EventScript_Zigzagoon"), - NpcDef( - entityIdx = 14, - graphicsId = 39, - x = 42, - y = 34, - elevation = 3, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "BattleFrontier_OutsideEast_EventScript_Maniac1"), - NpcDef( - entityIdx = 15, - graphicsId = 14, - x = 51, - y = 53, - elevation = 3, - movementType = 2, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "BattleFrontier_OutsideEast_EventScript_Girl"), - NpcDef( - entityIdx = 16, - graphicsId = 37, - x = 62, - y = 18, - elevation = 3, - movementType = 0, - movementRangeX = 2, - movementRangeY = 6, - trainerType = 0, - facing = 0, - script = "BattleFrontier_OutsideEast_EventScript_PsychicM"), - NpcDef( - entityIdx = 17, - graphicsId = 33, - x = 11, - y = 21, - elevation = 3, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "BattleFrontier_OutsideEast_EventScript_Man3"), - NpcDef( - entityIdx = 18, - graphicsId = 34, - x = 10, - y = 21, - elevation = 3, - movementType = 10, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 3, - script = "BattleFrontier_OutsideEast_EventScript_Woman1"), - NpcDef( - entityIdx = 19, - graphicsId = 34, - x = 16, - y = 30, - elevation = 3, - movementType = 2, - movementRangeX = 3, - movementRangeY = 2, - trainerType = 0, - facing = 0, - script = "BattleFrontier_OutsideEast_EventScript_Woman2"), - NpcDef( - entityIdx = 20, - graphicsId = 44, - x = 33, - y = 14, - elevation = 3, - movementType = 7, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 1, - script = "BattleFrontier_OutsideEast_EventScript_BlackBelt2"), - NpcDef( - entityIdx = 21, - graphicsId = 39, - x = 54, - y = 31, - elevation = 3, - movementType = 9, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 2, - script = "BattleFrontier_OutsideEast_EventScript_Maniac2"), - NpcDef( - entityIdx = 22, - graphicsId = 26, - x = 54, - y = 32, - elevation = 3, - movementType = 7, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 1, - script = "BattleFrontier_OutsideEast_EventScript_Woman3"), - NpcDef( - entityIdx = 23, - graphicsId = 30, - x = 58, - y = 55, - elevation = 3, - movementType = 17, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "BattleFrontier_OutsideEast_EventScript_OldWoman"), - NpcDef( - entityIdx = 24, - graphicsId = 48, - x = 48, - y = 41, - elevation = 3, - movementType = 7, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 1, - script = "BattleFrontier_OutsideEast_EventScript_Gentleman"), - NpcDef( - entityIdx = 25, - graphicsId = 31, - x = 29, - y = 14, - elevation = 3, - movementType = 7, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 1, - script = "BattleFrontier_OutsideEast_EventScript_Camper"), - ), - bgEvents = - listOf( - BgEventDef( - x = 13, - y = 17, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "BattleFrontier_OutsideEast_EventScript_BattleTowerSign"), - BgEventDef( - x = 43, - y = 56, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "BattleFrontier_OutsideEast_EventScript_BattlePalaceSign"), - BgEventDef( - x = 36, - y = 34, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "BattleFrontier_OutsideEast_EventScript_BattleArenaSign"), - BgEventDef( - x = 62, - y = 15, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "BattleFrontier_OutsideEast_EventScript_BattlePyramidSign"), - BgEventDef( - x = 7, - y = 29, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "BattleFrontier_OutsideEast_EventScript_ExchangeCornerSign"), - BgEventDef( - x = 32, - y = 13, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "BattleFrontier_OutsideEast_EventScript_RankingHallSign"), - BgEventDef( - x = 4, - y = 51, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "Common_EventScript_ShowPokemonCenterSign"), - BgEventDef( - x = 5, - y = 51, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "Common_EventScript_ShowPokemonCenterSign"), - ), - ), - // BattleFrontier_BattleTowerMultiPartnerRoom - // (MAP_BATTLE_FRONTIER_BATTLE_TOWER_MULTI_PARTNER_ROOM) - MapDef( - regionId = 1, - bankId = 76, - mapId = 15, - width = 21, - height = 15, - paletteIdx1 = 116, - paletteIdx2 = 159, - unknownShort = 465, - unknownByte = 58, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = emptyList(), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 0, - x = 11, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = - "BattleFrontier_BattleTowerMultiPartnerRoom_EventScript_Attendant"), - ), - bgEvents = emptyList(), - ), - // BattleFrontier_BattleTowerMultiCorridor - // (MAP_BATTLE_FRONTIER_BATTLE_TOWER_MULTI_CORRIDOR) - MapDef( - regionId = 1, - bankId = 76, - mapId = 16, - width = 17, - height = 5, - paletteIdx1 = 116, - paletteIdx2 = 159, - unknownShort = 465, - unknownByte = 58, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = emptyList(), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 0, - x = 1, - y = 1, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "0x0"), - NpcDef( - entityIdx = 1, - graphicsId = 0, - x = 14, - y = 3, - elevation = 3, - movementType = 7, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 1, - script = "0x0"), - NpcDef( - entityIdx = 2, - graphicsId = 0, - x = 1, - y = 3, - elevation = 3, - movementType = 7, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 1, - script = "0x0"), - NpcDef( - entityIdx = 3, - graphicsId = 0, - x = 14, - y = 1, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "0x0"), - ), - bgEvents = emptyList(), - ), - // BattleFrontier_BattleTowerMultiBattleRoom - // (MAP_BATTLE_FRONTIER_BATTLE_TOWER_MULTI_BATTLE_ROOM) - MapDef( - regionId = 1, - bankId = 76, - mapId = 17, - width = 10, - height = 9, - paletteIdx1 = 116, - paletteIdx2 = 159, - unknownShort = 465, - unknownByte = 58, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = emptyList(), - npcs = - listOf( - NpcDef( - entityIdx = 1, - graphicsId = 0, - x = 1, - y = 4, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 3, - script = "0x0"), - NpcDef( - entityIdx = 2, - graphicsId = 0, - x = 1, - y = 5, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 3, - script = "0x0"), - NpcDef( - entityIdx = 4, - graphicsId = 0, - x = 4, - y = 8, - elevation = 3, - movementType = 7, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 1, - script = "0x0"), - NpcDef( - entityIdx = 5, - graphicsId = 0, - x = 5, - y = 8, - elevation = 3, - movementType = 7, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 1, - script = "0x0"), - ), - bgEvents = emptyList(), - ), - // BattleFrontier_BattleDomeLobby (MAP_BATTLE_FRONTIER_BATTLE_DOME_LOBBY) - MapDef( - regionId = 1, - bankId = 76, - mapId = 18, - width = 23, - height = 17, - paletteIdx1 = 116, - paletteIdx2 = 161, - unknownShort = 473, - unknownByte = 58, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 11, - y = 16, - elevation = 0, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 4, - targetX = 19, - targetY = 17, - targetElevation = 0), - WarpTile( - x = 12, - y = 16, - elevation = 0, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 4, - targetX = 19, - targetY = 17, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 0, - x = 5, - y = 10, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "BattleFrontier_BattleDomeLobby_EventScript_SinglesAttendant"), - NpcDef( - entityIdx = 1, - graphicsId = 33, - x = 1, - y = 11, - elevation = 3, - movementType = 2, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "BattleFrontier_BattleDomeLobby_EventScript_Man"), - NpcDef( - entityIdx = 2, - graphicsId = 47, - x = 14, - y = 14, - elevation = 3, - movementType = 2, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "BattleFrontier_BattleDomeLobby_EventScript_Lass"), - NpcDef( - entityIdx = 3, - graphicsId = 17, - x = 18, - y = 14, - elevation = 3, - movementType = 2, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "BattleFrontier_BattleDomeLobby_EventScript_FatMan"), - NpcDef( - entityIdx = 4, - graphicsId = 39, - x = 8, - y = 14, - elevation = 3, - movementType = 2, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "BattleFrontier_BattleDomeLobby_EventScript_Maniac"), - NpcDef( - entityIdx = 5, - graphicsId = 0, - x = 17, - y = 10, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "BattleFrontier_BattleDomeLobby_EventScript_DoublesAttendant"), - ), - bgEvents = - listOf( - BgEventDef( - x = 4, - y = 10, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = - "BattleFrontier_BattleDomeLobby_EventScript_ShowSinglesResults"), - BgEventDef( - x = 7, - y = 10, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = - "BattleFrontier_BattleDomeLobby_EventScript_ShowPrevTourneyTree"), - BgEventDef( - x = 18, - y = 10, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = - "BattleFrontier_BattleDomeLobby_EventScript_ShowDoublesResults"), - BgEventDef( - x = 15, - y = 10, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "BattleFrontier_BattleDomeLobby_EventScript_RulesBoard"), - ), - ), - // BattleFrontier_BattleDomeCorridor (MAP_BATTLE_FRONTIER_BATTLE_DOME_CORRIDOR) - MapDef( - regionId = 1, - bankId = 76, - mapId = 19, - width = 48, - height = 7, - paletteIdx1 = 116, - paletteIdx2 = 161, - unknownShort = 473, - unknownByte = 58, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 6, - y = 8, - elevation = 2, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 4, - targetX = 19, - targetY = 17, - targetElevation = 0), - WarpTile( - x = 7, - y = 8, - elevation = 2, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 4, - targetX = 19, - targetY = 17, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 0, - x = 23, - y = 5, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "0x0"), - ), - bgEvents = emptyList(), - ), - // BattleFrontier_BattleDomePreBattleRoom - // (MAP_BATTLE_FRONTIER_BATTLE_DOME_PRE_BATTLE_ROOM) - MapDef( - regionId = 1, - bankId = 76, - mapId = 20, - width = 9, - height = 8, - paletteIdx1 = 116, - paletteIdx2 = 161, - unknownShort = 467, - unknownByte = 58, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 6, - y = 8, - elevation = 2, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 4, - targetX = 19, - targetY = 17, - targetElevation = 0), - WarpTile( - x = 7, - y = 8, - elevation = 2, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 4, - targetX = 19, - targetY = 17, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 0, - x = 5, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "0x0"), - ), - bgEvents = emptyList(), - ), - // BattleFrontier_BattleDomeBattleRoom (MAP_BATTLE_FRONTIER_BATTLE_DOME_BATTLE_ROOM) - MapDef( - regionId = 1, - bankId = 76, - mapId = 21, - width = 20, - height = 10, - paletteIdx1 = 116, - paletteIdx2 = 161, - unknownShort = 467, - unknownByte = 58, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = emptyList(), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 67, - x = 5, - y = 4, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "0x0"), - NpcDef( - entityIdx = 1, - graphicsId = 6, - x = 7, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "0x0"), - NpcDef( - entityIdx = 2, - graphicsId = 7, - x = 9, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "0x0"), - NpcDef( - entityIdx = 3, - graphicsId = 9, - x = 11, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "0x0"), - NpcDef( - entityIdx = 4, - graphicsId = 5, - x = 16, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "0x0"), - NpcDef( - entityIdx = 5, - graphicsId = 19, - x = 4, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "0x0"), - NpcDef( - entityIdx = 6, - graphicsId = 21, - x = 16, - y = 1, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "0x0"), - NpcDef( - entityIdx = 7, - graphicsId = 31, - x = 8, - y = 1, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "0x0"), - NpcDef( - entityIdx = 8, - graphicsId = 23, - x = 0, - y = 4, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "0x0"), - NpcDef( - entityIdx = 9, - graphicsId = 17, - x = 12, - y = 1, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "0x0"), - NpcDef( - entityIdx = 10, - graphicsId = 10, - x = 13, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "0x0"), - NpcDef( - entityIdx = 11, - graphicsId = 8, - x = 10, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "0x0"), - NpcDef( - entityIdx = 12, - graphicsId = 0, - x = 4, - y = 9, - elevation = 4, - movementType = 7, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 1, - script = "0x0"), - NpcDef( - entityIdx = 13, - graphicsId = 24, - x = 14, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "0x0"), - NpcDef( - entityIdx = 14, - graphicsId = 240, - x = 11, - y = 6, - elevation = 3, - movementType = 9, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 2, - script = "0x0"), - ), - bgEvents = emptyList(), - ), - // BattleFrontier_BattlePalaceLobby (MAP_BATTLE_FRONTIER_BATTLE_PALACE_LOBBY) - MapDef( - regionId = 1, - bankId = 76, - mapId = 22, - width = 25, - height = 12, - paletteIdx1 = 116, - paletteIdx2 = 160, - unknownShort = 463, - unknownByte = 58, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 12, - y = 11, - elevation = 0, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 14, - targetX = 45, - targetY = 56, - targetElevation = 0), - WarpTile( - x = 13, - y = 11, - elevation = 0, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 14, - targetX = 45, - targetY = 56, - targetElevation = 0), - WarpTile( - x = 5, - y = 4, - elevation = 2, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 23, - targetX = 8, - targetY = 13, - targetElevation = 2), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 21, - x = 5, - y = 6, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = - "BattleFrontier_BattlePalaceLobby_EventScript_SinglesAttendant"), - NpcDef( - entityIdx = 1, - graphicsId = 44, - x = 11, - y = 8, - elevation = 3, - movementType = 2, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "BattleFrontier_BattlePalaceLobby_EventScript_BlackBelt"), - NpcDef( - entityIdx = 2, - graphicsId = 39, - x = 24, - y = 5, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "BattleFrontier_BattlePalaceLobby_EventScript_Maniac"), - NpcDef( - entityIdx = 3, - graphicsId = 33, - x = 18, - y = 10, - elevation = 3, - movementType = 2, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "BattleFrontier_BattlePalaceLobby_EventScript_Man"), - NpcDef( - entityIdx = 4, - graphicsId = 45, - x = 2, - y = 10, - elevation = 3, - movementType = 2, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "BattleFrontier_BattlePalaceLobby_EventScript_Beauty"), - NpcDef( - entityIdx = 5, - graphicsId = 21, - x = 19, - y = 6, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = - "BattleFrontier_BattlePalaceLobby_EventScript_DoublesAttendant"), - ), - bgEvents = - listOf( - BgEventDef( - x = 2, - y = 7, - facingDir = "BG_EVENT_PLAYER_FACING_NORTH", - script = - "BattleFrontier_BattlePalaceLobby_EventScript_ShowSinglesResults"), - BgEventDef( - x = 16, - y = 7, - facingDir = "BG_EVENT_PLAYER_FACING_NORTH", - script = - "BattleFrontier_BattlePalaceLobby_EventScript_ShowDoublesResults"), - BgEventDef( - x = 10, - y = 4, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "BattleFrontier_BattlePalaceLobby_EventScript_RulesBoard"), - ), - ), - // BattleFrontier_BattlePalaceCorridor (MAP_BATTLE_FRONTIER_BATTLE_PALACE_CORRIDOR) - MapDef( - regionId = 1, - bankId = 76, - mapId = 23, - width = 17, - height = 14, - paletteIdx1 = 100, - paletteIdx2 = 160, - unknownShort = 463, - unknownByte = 58, - borderTiles = - listOf( - Tile2D(0x0023, 0), Tile2D(0x0023, 0), Tile2D(0x0023, 0), Tile2D(0x0023, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 8, - y = 13, - elevation = 2, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 22, - targetX = 5, - targetY = 4, - targetElevation = 2), - WarpTile( - x = 9, - y = 13, - elevation = 2, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 22, - targetX = 5, - targetY = 4, - targetElevation = 2), - WarpTile( - x = 6, - y = 3, - elevation = 2, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 24, - targetX = 0, - targetY = 9, - targetElevation = 2), - WarpTile( - x = 10, - y = 3, - elevation = 2, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 24, - targetX = 0, - targetY = 9, - targetElevation = 2), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 21, - x = 8, - y = 12, - elevation = 3, - movementType = 7, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 1, - script = "0x0"), - NpcDef( - entityIdx = 1, - graphicsId = 0, - x = 3, - y = 5, - elevation = 3, - movementType = 2, - movementRangeX = 1, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "0x0"), - NpcDef( - entityIdx = 2, - graphicsId = 0, - x = 12, - y = 6, - elevation = 3, - movementType = 14, - movementRangeX = 0, - movementRangeY = 2, - trainerType = 0, - facing = 0, - script = "0x0"), - NpcDef( - entityIdx = 3, - graphicsId = 0, - x = 15, - y = 5, - elevation = 3, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "0x0"), - NpcDef( - entityIdx = 4, - graphicsId = 0, - x = 4, - y = 9, - elevation = 3, - movementType = 14, - movementRangeX = 0, - movementRangeY = 2, - trainerType = 0, - facing = 0, - script = "0x0"), - NpcDef( - entityIdx = 5, - graphicsId = 0, - x = 13, - y = 9, - elevation = 3, - movementType = 1, - movementRangeX = 0, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "0x0"), - NpcDef( - entityIdx = 6, - graphicsId = 0, - x = 3, - y = 10, - elevation = 3, - movementType = 2, - movementRangeX = 1, - movementRangeY = 2, - trainerType = 0, - facing = 0, - script = "0x0"), - ), - bgEvents = emptyList(), - ), - // BattleFrontier_BattlePalaceBattleRoom (MAP_BATTLE_FRONTIER_BATTLE_PALACE_BATTLE_ROOM) - MapDef( - regionId = 1, - bankId = 76, - mapId = 24, - width = 15, - height = 10, - paletteIdx1 = 100, - paletteIdx2 = 160, - unknownShort = 463, - unknownByte = 58, - borderTiles = - listOf( - Tile2D(0x0023, 0), Tile2D(0x0023, 0), Tile2D(0x0023, 0), Tile2D(0x0023, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 0, - y = 9, - elevation = 2, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 23, - targetX = 6, - targetY = 3, - targetElevation = 2), - WarpTile( - x = 1, - y = 9, - elevation = 2, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 23, - targetX = 6, - targetY = 3, - targetElevation = 2), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 0, - x = 1, - y = 9, - elevation = 3, - movementType = 7, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 1, - script = "0x0"), - NpcDef( - entityIdx = 1, - graphicsId = 240, - x = 13, - y = 1, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "0x0"), - NpcDef( - entityIdx = 2, - graphicsId = 21, - x = 1, - y = 4, - elevation = 3, - movementType = 10, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 3, - script = "0x0"), - NpcDef( - entityIdx = 3, - graphicsId = 0, - x = 13, - y = 1, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "0x0"), - NpcDef( - entityIdx = 4, - graphicsId = 0, - x = 13, - y = 1, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "0x0"), - ), - bgEvents = emptyList(), - ), - // BattleFrontier_BattlePyramidLobby (MAP_BATTLE_FRONTIER_BATTLE_PYRAMID_LOBBY) - MapDef( - regionId = 1, - bankId = 76, - mapId = 25, - width = 15, - height = 18, - paletteIdx1 = 116, - paletteIdx2 = 165, - unknownShort = 461, - unknownByte = 58, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 7, - y = 17, - elevation = 3, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 14, - targetX = 58, - targetY = 14, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 55, - x = 7, - y = 12, - elevation = 4, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "BattleFrontier_BattlePyramidLobby_EventScript_Attendant"), - NpcDef( - entityIdx = 1, - graphicsId = 40, - x = 14, - y = 13, - elevation = 4, - movementType = 9, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 2, - script = "BattleFrontier_BattlePyramidLobby_EventScript_HintGiver"), - NpcDef( - entityIdx = 2, - graphicsId = 24, - x = 2, - y = 15, - elevation = 4, - movementType = 2, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "BattleFrontier_BattlePyramidLobby_EventScript_Woman"), - NpcDef( - entityIdx = 3, - graphicsId = 17, - x = 12, - y = 16, - elevation = 4, - movementType = 2, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "BattleFrontier_BattlePyramidLobby_EventScript_FatMan"), - ), - bgEvents = - listOf( - BgEventDef( - x = 5, - y = 12, - facingDir = "BG_EVENT_PLAYER_FACING_NORTH", - script = "BattleFrontier_BattlePyramidLobby_EventScript_ShowResults"), - BgEventDef( - x = 1, - y = 12, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "BattleFrontier_BattlePyramidLobby_EventScript_RulesBoard"), - ), - ), - // BattleFrontier_BattlePyramidFloor (MAP_BATTLE_FRONTIER_BATTLE_PYRAMID_FLOOR) - MapDef( - regionId = 1, - bankId = 76, - mapId = 26, - width = 8, - height = 8, - paletteIdx1 = 116, - paletteIdx2 = 165, - unknownShort = 0, - unknownByte = 58, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = emptyList(), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 5, - x = 0, - y = 0, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "0x0"), - NpcDef( - entityIdx = 1, - graphicsId = 100, - x = 1, - y = 0, - elevation = 3, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "0x0"), - NpcDef( - entityIdx = 2, - graphicsId = 100, - x = 2, - y = 0, - elevation = 3, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "0x0"), - NpcDef( - entityIdx = 3, - graphicsId = 100, - x = 3, - y = 0, - elevation = 3, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "0x0"), - NpcDef( - entityIdx = 4, - graphicsId = 100, - x = 4, - y = 0, - elevation = 3, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "0x0"), - NpcDef( - entityIdx = 5, - graphicsId = 100, - x = 5, - y = 0, - elevation = 3, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "0x0"), - NpcDef( - entityIdx = 6, - graphicsId = 100, - x = 6, - y = 0, - elevation = 3, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "0x0"), - NpcDef( - entityIdx = 7, - graphicsId = 100, - x = 7, - y = 0, - elevation = 3, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "0x0"), - NpcDef( - entityIdx = 8, - graphicsId = 100, - x = 0, - y = 1, - elevation = 3, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "0x0"), - NpcDef( - entityIdx = 9, - graphicsId = 100, - x = 1, - y = 1, - elevation = 3, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "0x0"), - NpcDef( - entityIdx = 10, - graphicsId = 100, - x = 3, - y = 1, - elevation = 3, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "0x0"), - NpcDef( - entityIdx = 11, - graphicsId = 100, - x = 4, - y = 1, - elevation = 3, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "0x0"), - NpcDef( - entityIdx = 12, - graphicsId = 100, - x = 5, - y = 1, - elevation = 3, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "0x0"), - NpcDef( - entityIdx = 13, - graphicsId = 100, - x = 6, - y = 1, - elevation = 3, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "0x0"), - NpcDef( - entityIdx = 14, - graphicsId = 100, - x = 7, - y = 1, - elevation = 3, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "0x0"), - NpcDef( - entityIdx = 15, - graphicsId = 100, - x = 2, - y = 1, - elevation = 3, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "0x0"), - ), - bgEvents = emptyList(), - ), - // BattleFrontier_BattlePyramidTop (MAP_BATTLE_FRONTIER_BATTLE_PYRAMID_TOP) - MapDef( - regionId = 1, - bankId = 76, - mapId = 27, - width = 34, - height = 23, - paletteIdx1 = 116, - paletteIdx2 = 165, - unknownShort = 0, - unknownByte = 58, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = emptyList(), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 55, - x = 17, - y = 11, - elevation = 6, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "BattleFrontier_BattlePyramidTop_EventScript_Attendant"), - NpcDef( - entityIdx = 1, - graphicsId = 0, - x = 17, - y = 7, - elevation = 3, - movementType = 7, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 1, - script = "0x0"), - ), - bgEvents = emptyList(), - ), - // BattleFrontier_BattleArenaLobby (MAP_BATTLE_FRONTIER_BATTLE_ARENA_LOBBY) - MapDef( - regionId = 1, - bankId = 76, - mapId = 28, - width = 16, - height = 13, - paletteIdx1 = 116, - paletteIdx2 = 164, - unknownShort = 458, - unknownByte = 58, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 7, - y = 12, - elevation = 2, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 14, - targetX = 39, - targetY = 29, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 44, - x = 7, - y = 7, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "BattleFrontier_BattleArenaLobby_EventScript_Attendant"), - NpcDef( - entityIdx = 1, - graphicsId = 34, - x = 2, - y = 10, - elevation = 3, - movementType = 2, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "BattleFrontier_BattleArenaLobby_EventScript_Woman"), - NpcDef( - entityIdx = 2, - graphicsId = 66, - x = 14, - y = 11, - elevation = 3, - movementType = 9, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 2, - script = "BattleFrontier_BattleArenaLobby_EventScript_Man"), - NpcDef( - entityIdx = 3, - graphicsId = 31, - x = 14, - y = 12, - elevation = 3, - movementType = 9, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 2, - script = "BattleFrontier_BattleArenaLobby_EventScript_Camper"), - NpcDef( - entityIdx = 4, - graphicsId = 35, - x = 14, - y = 10, - elevation = 3, - movementType = 9, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 2, - script = "BattleFrontier_BattleArenaLobby_EventScript_Youngster"), - ), - bgEvents = - listOf( - BgEventDef( - x = 5, - y = 9, - facingDir = "BG_EVENT_PLAYER_FACING_NORTH", - script = "BattleFrontier_BattleArenaLobby_EventScript_ShowResults"), - BgEventDef( - x = 1, - y = 7, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "BattleFrontier_BattleArenaLobby_EventScript_RulesBoard"), - ), - ), - // BattleFrontier_BattleArenaCorridor (MAP_BATTLE_FRONTIER_BATTLE_ARENA_CORRIDOR) - MapDef( - regionId = 1, - bankId = 76, - mapId = 29, - width = 18, - height = 14, - paletteIdx1 = 116, - paletteIdx2 = 164, - unknownShort = 458, - unknownByte = 58, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = emptyList(), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 44, - x = 9, - y = 12, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "0x0"), - ), - bgEvents = emptyList(), - ), - // BattleFrontier_BattleArenaBattleRoom (MAP_BATTLE_FRONTIER_BATTLE_ARENA_BATTLE_ROOM) - MapDef( - regionId = 1, - bankId = 76, - mapId = 30, - width = 16, - height = 11, - paletteIdx1 = 116, - paletteIdx2 = 164, - unknownShort = 458, - unknownByte = 58, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = emptyList(), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 44, - x = 5, - y = 3, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "0x0"), - NpcDef( - entityIdx = 1, - graphicsId = 44, - x = 10, - y = 3, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "0x0"), - NpcDef( - entityIdx = 2, - graphicsId = 44, - x = 5, - y = 9, - elevation = 3, - movementType = 7, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 1, - script = "0x0"), - NpcDef( - entityIdx = 3, - graphicsId = 44, - x = 10, - y = 9, - elevation = 3, - movementType = 7, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 1, - script = "0x0"), - NpcDef( - entityIdx = 4, - graphicsId = 44, - x = 4, - y = 5, - elevation = 3, - movementType = 10, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 3, - script = "0x0"), - NpcDef( - entityIdx = 5, - graphicsId = 44, - x = 11, - y = 5, - elevation = 3, - movementType = 9, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 2, - script = "0x0"), - NpcDef( - entityIdx = 6, - graphicsId = 240, - x = 15, - y = 6, - elevation = 3, - movementType = 9, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 2, - script = "0x0"), - NpcDef( - entityIdx = 7, - graphicsId = 0, - x = 0, - y = 6, - elevation = 3, - movementType = 10, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 3, - script = "0x0"), - NpcDef( - entityIdx = 8, - graphicsId = 44, - x = 7, - y = 4, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "0x0"), - ), - bgEvents = emptyList(), - ), - // BattleFrontier_BattleFactoryLobby (MAP_BATTLE_FRONTIER_BATTLE_FACTORY_LOBBY) - MapDef( - regionId = 1, - bankId = 76, - mapId = 31, - width = 19, - height = 12, - paletteIdx1 = 116, - paletteIdx2 = 162, - unknownShort = 469, - unknownByte = 58, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 9, - y = 11, - elevation = 0, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 4, - targetX = 11, - targetY = 38, - targetElevation = 0), - WarpTile( - x = 10, - y = 11, - elevation = 0, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 4, - targetX = 11, - targetY = 38, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 46, - x = 4, - y = 7, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = - "BattleFrontier_BattleFactoryLobby_EventScript_SinglesAttendant"), - NpcDef( - entityIdx = 1, - graphicsId = 16, - x = 3, - y = 11, - elevation = 3, - movementType = 2, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "BattleFrontier_BattleFactoryLobby_EventScript_Woman"), - NpcDef( - entityIdx = 2, - graphicsId = 31, - x = 14, - y = 11, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "BattleFrontier_BattleFactoryLobby_EventScript_Camper"), - NpcDef( - entityIdx = 3, - graphicsId = 32, - x = 13, - y = 11, - elevation = 3, - movementType = 10, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 3, - script = "BattleFrontier_BattleFactoryLobby_EventScript_Picnicker"), - NpcDef( - entityIdx = 4, - graphicsId = 17, - x = 6, - y = 10, - elevation = 3, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "BattleFrontier_BattleFactoryLobby_EventScript_FatMan"), - NpcDef( - entityIdx = 5, - graphicsId = 46, - x = 14, - y = 7, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = - "BattleFrontier_BattleFactoryLobby_EventScript_DoublesAttendant"), - ), - bgEvents = - listOf( - BgEventDef( - x = 2, - y = 7, - facingDir = "BG_EVENT_PLAYER_FACING_NORTH", - script = - "BattleFrontier_BattleFactoryLobby_EventScript_ShowSinglesResults"), - BgEventDef( - x = 11, - y = 7, - facingDir = "BG_EVENT_PLAYER_FACING_NORTH", - script = - "BattleFrontier_BattleFactoryLobby_EventScript_ShowDoublesResults"), - BgEventDef( - x = 9, - y = 4, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "BattleFrontier_BattleFactoryLobby_EventScript_RulesBoard"), - ), - ), - // BattleFrontier_BattleFactoryPreBattleRoom - // (MAP_BATTLE_FRONTIER_BATTLE_FACTORY_PRE_BATTLE_ROOM) - MapDef( - regionId = 1, - bankId = 76, - mapId = 32, - width = 17, - height = 14, - paletteIdx1 = 116, - paletteIdx2 = 162, - unknownShort = 469, - unknownByte = 58, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = emptyList(), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 46, - x = 8, - y = 12, - elevation = 3, - movementType = 7, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 1, - script = "0x0"), - ), - bgEvents = emptyList(), - ), - // BattleFrontier_BattleFactoryBattleRoom - // (MAP_BATTLE_FRONTIER_BATTLE_FACTORY_BATTLE_ROOM) - MapDef( - regionId = 1, - bankId = 76, - mapId = 33, - width = 13, - height = 12, - paletteIdx1 = 116, - paletteIdx2 = 162, - unknownShort = 469, - unknownByte = 58, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = emptyList(), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 46, - x = 0, - y = 6, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "0x0"), - NpcDef( - entityIdx = 1, - graphicsId = 240, - x = 7, - y = 4, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "0x0"), - NpcDef( - entityIdx = 2, - graphicsId = 46, - x = 0, - y = 4, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "0x0"), - NpcDef( - entityIdx = 3, - graphicsId = 46, - x = 0, - y = 8, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "0x0"), - NpcDef( - entityIdx = 4, - graphicsId = 46, - x = 12, - y = 4, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "0x0"), - NpcDef( - entityIdx = 5, - graphicsId = 46, - x = 12, - y = 6, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "0x0"), - NpcDef( - entityIdx = 6, - graphicsId = 46, - x = 12, - y = 8, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "0x0"), - NpcDef( - entityIdx = 7, - graphicsId = 0, - x = 5, - y = 11, - elevation = 3, - movementType = 7, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 1, - script = "0x0"), - ), - bgEvents = emptyList(), - ), - // BattleFrontier_BattlePikeLobby (MAP_BATTLE_FRONTIER_BATTLE_PIKE_LOBBY) - MapDef( - regionId = 1, - bankId = 76, - mapId = 34, - width = 11, - height = 13, - paletteIdx1 = 116, - paletteIdx2 = 163, - unknownShort = 468, - unknownByte = 58, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 5, - y = 12, - elevation = 0, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 4, - targetX = 42, - targetY = 27, - targetElevation = 0), - WarpTile( - x = 4, - y = 12, - elevation = 0, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 4, - targetX = 42, - targetY = 27, - targetElevation = 0), - WarpTile( - x = 6, - y = 12, - elevation = 0, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 4, - targetX = 42, - targetY = 27, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 28, - x = 5, - y = 5, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "BattleFrontier_BattlePikeLobby_EventScript_Attendant"), - NpcDef( - entityIdx = 1, - graphicsId = 55, - x = 10, - y = 9, - elevation = 3, - movementType = 7, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 1, - script = "BattleFrontier_BattlePikeLobby_EventScript_Hiker"), - NpcDef( - entityIdx = 2, - graphicsId = 6, - x = 0, - y = 5, - elevation = 3, - movementType = 9, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 2, - script = "BattleFrontier_BattlePikeLobby_EventScript_Twin"), - NpcDef( - entityIdx = 3, - graphicsId = 45, - x = 8, - y = 9, - elevation = 3, - movementType = 2, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "BattleFrontier_BattlePikeLobby_EventScript_Beauty"), - ), - bgEvents = - listOf( - BgEventDef( - x = 8, - y = 3, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "BattleFrontier_BattlePikeLobby_EventScript_ShowResults"), - BgEventDef( - x = 1, - y = 3, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "BattleFrontier_BattlePikeLobby_EventScript_RulesBoard"), - ), - ), - // BattleFrontier_BattlePikeCorridor (MAP_BATTLE_FRONTIER_BATTLE_PIKE_CORRIDOR) - MapDef( - regionId = 1, - bankId = 76, - mapId = 35, - width = 14, - height = 8, - paletteIdx1 = 116, - paletteIdx2 = 163, - unknownShort = 468, - unknownByte = 58, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = emptyList(), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 28, - x = 6, - y = 6, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "0x0"), - ), - bgEvents = emptyList(), - ), - // BattleFrontier_BattlePikeThreePathRoom - // (MAP_BATTLE_FRONTIER_BATTLE_PIKE_THREE_PATH_ROOM) - MapDef( - regionId = 1, - bankId = 76, - mapId = 36, - width = 13, - height = 11, - paletteIdx1 = 116, - paletteIdx2 = 163, - unknownShort = 468, - unknownByte = 58, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = emptyList(), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 28, - x = 4, - y = 10, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 3, - script = - "BattleFrontier_BattlePikeThreePathRoom_EventScript_Attendant"), - NpcDef( - entityIdx = 1, - graphicsId = 28, - x = 8, - y = 5, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = - "BattleFrontier_BattlePikeThreePathRoom_EventScript_HintGiver"), - ), - bgEvents = emptyList(), - ), - // BattleFrontier_BattlePikeRoomNormal (MAP_BATTLE_FRONTIER_BATTLE_PIKE_ROOM_NORMAL) - MapDef( - regionId = 1, - bankId = 76, - mapId = 37, - width = 9, - height = 8, - paletteIdx1 = 116, - paletteIdx2 = 163, - unknownShort = 468, - unknownByte = 58, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = emptyList(), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 240, - x = 4, - y = 4, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "BattleFrontier_BattlePikeRoomNormal_EventScript_NPC"), - NpcDef( - entityIdx = 1, - graphicsId = 0, - x = 3, - y = 4, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "BattleFrontier_BattlePikeRoomNormal_EventScript_StatusMon"), - ), - bgEvents = emptyList(), - ), - // BattleFrontier_BattlePikeRoomFinal (MAP_BATTLE_FRONTIER_BATTLE_PIKE_ROOM_FINAL) - MapDef( - regionId = 1, - bankId = 76, - mapId = 38, - width = 5, - height = 8, - paletteIdx1 = 116, - paletteIdx2 = 163, - unknownShort = 468, - unknownByte = 58, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = emptyList(), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 28, - x = 2, - y = 4, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "0x0"), - ), - bgEvents = emptyList(), - ), - // BattleFrontier_BattlePikeRoomWildMons - // (MAP_BATTLE_FRONTIER_BATTLE_PIKE_ROOM_WILD_MONS) - MapDef( - regionId = 1, - bankId = 76, - mapId = 39, - width = 9, - height = 20, - paletteIdx1 = 116, - paletteIdx2 = 163, - unknownShort = 468, - unknownByte = 58, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = emptyList(), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // BattleFrontier_RankingHall (MAP_BATTLE_FRONTIER_RANKING_HALL) - MapDef( - regionId = 1, - bankId = 76, - mapId = 40, - width = 53, - height = 15, - paletteIdx1 = 116, - paletteIdx2 = 171, - unknownShort = 373, - unknownByte = 58, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 26, - y = 14, - elevation = 2, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 14, - targetX = 35, - targetY = 12, - targetElevation = 2), - WarpTile( - x = 27, - y = 14, - elevation = 2, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 14, - targetX = 35, - targetY = 12, - targetElevation = 2), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 0, - x = 24, - y = 13, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "BattleFrontier_RankingHall_EventScript_Attendant"), - NpcDef( - entityIdx = 1, - graphicsId = 5, - x = 4, - y = 10, - elevation = 3, - movementType = 2, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "BattleFrontier_RankingHall_EventScript_NinjaBoy"), - NpcDef( - entityIdx = 2, - graphicsId = 13, - x = 44, - y = 11, - elevation = 3, - movementType = 2, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "BattleFrontier_RankingHall_EventScript_Boy"), - ), - bgEvents = - listOf( - BgEventDef( - x = 26, - y = 9, - facingDir = "BG_EVENT_PLAYER_FACING_NORTH", - script = "BattleFrontier_RankingHall_EventScript_TowerSinglesRecords"), - BgEventDef( - x = 23, - y = 8, - facingDir = "BG_EVENT_PLAYER_FACING_NORTH", - script = "BattleFrontier_RankingHall_EventScript_TowerDoublesRecords"), - BgEventDef( - x = 26, - y = 5, - facingDir = "BG_EVENT_PLAYER_FACING_NORTH", - script = "BattleFrontier_RankingHall_EventScript_TowerMultisRecords"), - BgEventDef( - x = 29, - y = 8, - facingDir = "BG_EVENT_PLAYER_FACING_NORTH", - script = "BattleFrontier_RankingHall_EventScript_TowerLinkRecords"), - BgEventDef( - x = 42, - y = 9, - facingDir = "BG_EVENT_PLAYER_FACING_NORTH", - script = "BattleFrontier_RankingHall_EventScript_ArenaRecords"), - BgEventDef( - x = 46, - y = 9, - facingDir = "BG_EVENT_PLAYER_FACING_NORTH", - script = "BattleFrontier_RankingHall_EventScript_PalaceRecords"), - BgEventDef( - x = 10, - y = 9, - facingDir = "BG_EVENT_PLAYER_FACING_NORTH", - script = "BattleFrontier_RankingHall_EventScript_FactoryRecords"), - BgEventDef( - x = 8, - y = 7, - facingDir = "BG_EVENT_PLAYER_FACING_NORTH", - script = "BattleFrontier_RankingHall_EventScript_DomeRecords"), - BgEventDef( - x = 6, - y = 9, - facingDir = "BG_EVENT_PLAYER_FACING_NORTH", - script = "BattleFrontier_RankingHall_EventScript_PikeRecords"), - BgEventDef( - x = 44, - y = 7, - facingDir = "BG_EVENT_PLAYER_FACING_NORTH", - script = "BattleFrontier_RankingHall_EventScript_PyramidRecords"), - BgEventDef( - x = 16, - y = 8, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = - "BattleFrontier_RankingHall_EventScript_DomePikeFactoryRecordsSign"), - BgEventDef( - x = 36, - y = 8, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = - "BattleFrontier_RankingHall_EventScript_PalaceArenaPyramidRecordsSIgn"), - ), - ), - // BattleFrontier_Lounge1 (MAP_BATTLE_FRONTIER_LOUNGE1) - MapDef( - regionId = 1, - bankId = 76, - mapId = 41, - width = 9, - height = 10, - paletteIdx1 = 116, - paletteIdx2 = 159, - unknownShort = 384, - unknownByte = 58, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 4, - y = 9, - elevation = 0, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 14, - targetX = 4, - targetY = 44, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 29, - x = 0, - y = 6, - elevation = 3, - movementType = 10, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 3, - script = "BattleFrontier_Lounge1_EventScript_Breeder"), - NpcDef( - entityIdx = 1, - graphicsId = 13, - x = 7, - y = 6, - elevation = 3, - movementType = 2, - movementRangeX = 1, - movementRangeY = 2, - trainerType = 0, - facing = 0, - script = "BattleFrontier_Lounge1_EventScript_Boy1"), - NpcDef( - entityIdx = 2, - graphicsId = 9, - x = 5, - y = 4, - elevation = 3, - movementType = 2, - movementRangeX = 2, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "BattleFrontier_Lounge1_EventScript_Boy2"), - ), - bgEvents = emptyList(), - ), - // BattleFrontier_ExchangeServiceCorner (MAP_BATTLE_FRONTIER_EXCHANGE_SERVICE_CORNER) - MapDef( - regionId = 1, - bankId = 76, - mapId = 42, - width = 15, - height = 11, - paletteIdx1 = 116, - paletteIdx2 = 159, - unknownShort = 384, - unknownByte = 58, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 7, - y = 10, - elevation = 0, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 14, - targetX = 10, - targetY = 28, - targetElevation = 0), - WarpTile( - x = 6, - y = 10, - elevation = 0, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 14, - targetX = 10, - targetY = 28, - targetElevation = 0), - WarpTile( - x = 8, - y = 10, - elevation = 0, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 14, - targetX = 10, - targetY = 28, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 0, - x = 4, - y = 4, - elevation = 3, - movementType = 9, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 2, - script = - "BattleFrontier_ExchangeServiceCorner_EventScript_DecorClerk1"), - NpcDef( - entityIdx = 1, - graphicsId = 15, - x = 0, - y = 5, - elevation = 3, - movementType = 10, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 3, - script = "BattleFrontier_ExchangeServiceCorner_EventScript_RichBoy"), - NpcDef( - entityIdx = 2, - graphicsId = 18, - x = 0, - y = 4, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "BattleFrontier_ExchangeServiceCorner_EventScript_PokefanF"), - NpcDef( - entityIdx = 3, - graphicsId = 49, - x = 14, - y = 6, - elevation = 3, - movementType = 2, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "BattleFrontier_ExchangeServiceCorner_EventScript_Sailor"), - NpcDef( - entityIdx = 4, - graphicsId = 66, - x = 1, - y = 9, - elevation = 3, - movementType = 2, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "BattleFrontier_ExchangeServiceCorner_EventScript_Man"), - NpcDef( - entityIdx = 5, - graphicsId = 0, - x = 5, - y = 5, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = - "BattleFrontier_ExchangeServiceCorner_EventScript_DecorClerk2"), - NpcDef( - entityIdx = 6, - graphicsId = 0, - x = 9, - y = 5, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = - "BattleFrontier_ExchangeServiceCorner_EventScript_VitaminClerk"), - NpcDef( - entityIdx = 7, - graphicsId = 0, - x = 10, - y = 4, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 3, - script = - "BattleFrontier_ExchangeServiceCorner_EventScript_HoldItemClerk"), - NpcDef( - entityIdx = 8, - graphicsId = 8, - x = 12, - y = 10, - elevation = 3, - movementType = 2, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "BattleFrontier_ExchangeServiceCorner_EventScript_Girl"), - ), - bgEvents = emptyList(), - ), - // BattleFrontier_Lounge2 (MAP_BATTLE_FRONTIER_LOUNGE2) - MapDef( - regionId = 1, - bankId = 76, - mapId = 43, - width = 13, - height = 8, - paletteIdx1 = 116, - paletteIdx2 = 159, - unknownShort = 384, - unknownByte = 58, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 1, - y = 7, - elevation = 0, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 4, - targetX = 45, - targetY = 44, - targetElevation = 0), - WarpTile( - x = 2, - y = 7, - elevation = 0, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 4, - targetX = 45, - targetY = 44, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 39, - x = 8, - y = 4, - elevation = 3, - movementType = 10, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 3, - script = "BattleFrontier_Lounge2_EventScript_FrontierManiac"), - NpcDef( - entityIdx = 1, - graphicsId = 39, - x = 10, - y = 4, - elevation = 3, - movementType = 9, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 2, - script = "BattleFrontier_Lounge2_EventScript_Maniac1"), - NpcDef( - entityIdx = 2, - graphicsId = 39, - x = 10, - y = 3, - elevation = 3, - movementType = 9, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 2, - script = "BattleFrontier_Lounge2_EventScript_Maniac2"), - NpcDef( - entityIdx = 3, - graphicsId = 52, - x = 4, - y = 6, - elevation = 3, - movementType = 2, - movementRangeX = 1, - movementRangeY = 2, - trainerType = 0, - facing = 0, - script = "BattleFrontier_Lounge2_EventScript_TriathleteF"), - NpcDef( - entityIdx = 4, - graphicsId = 39, - x = 10, - y = 5, - elevation = 3, - movementType = 9, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 2, - script = "BattleFrontier_Lounge2_EventScript_Maniac3"), - ), - bgEvents = emptyList(), - ), - // BattleFrontier_Lounge3 (MAP_BATTLE_FRONTIER_LOUNGE3) - MapDef( - regionId = 1, - bankId = 76, - mapId = 44, - width = 9, - height = 10, - paletteIdx1 = 116, - paletteIdx2 = 159, - unknownShort = 384, - unknownByte = 58, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 4, - y = 9, - elevation = 0, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 14, - targetX = 65, - targetY = 31, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 55, - x = 4, - y = 6, - elevation = 3, - movementType = 7, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 1, - script = "BattleFrontier_Lounge3_EventScript_Gambler"), - NpcDef( - entityIdx = 1, - graphicsId = 17, - x = 4, - y = 4, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "BattleFrontier_Lounge3_EventScript_FatMan"), - NpcDef( - entityIdx = 2, - graphicsId = 20, - x = 3, - y = 5, - elevation = 3, - movementType = 10, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 3, - script = "BattleFrontier_Lounge3_EventScript_Woman"), - NpcDef( - entityIdx = 3, - graphicsId = 18, - x = 5, - y = 5, - elevation = 3, - movementType = 9, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 2, - script = "BattleFrontier_Lounge3_EventScript_PokefanF"), - NpcDef( - entityIdx = 4, - graphicsId = 33, - x = 0, - y = 6, - elevation = 3, - movementType = 2, - movementRangeX = 0, - movementRangeY = 3, - trainerType = 0, - facing = 0, - script = "BattleFrontier_Lounge3_EventScript_Man"), - ), - bgEvents = emptyList(), - ), - // BattleFrontier_Lounge4 (MAP_BATTLE_FRONTIER_LOUNGE4) - MapDef( - regionId = 1, - bankId = 76, - mapId = 45, - width = 9, - height = 10, - paletteIdx1 = 116, - paletteIdx2 = 159, - unknownShort = 384, - unknownByte = 58, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 4, - y = 9, - elevation = 0, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 4, - targetX = 53, - targetY = 44, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 24, - x = 4, - y = 4, - elevation = 3, - movementType = 7, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 1, - script = "BattleFrontier_Lounge4_EventScript_Woman"), - NpcDef( - entityIdx = 1, - graphicsId = 27, - x = 6, - y = 6, - elevation = 3, - movementType = 2, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "BattleFrontier_Lounge4_EventScript_Cook"), - NpcDef( - entityIdx = 2, - graphicsId = 33, - x = 0, - y = 5, - elevation = 3, - movementType = 10, - movementRangeX = 2, - movementRangeY = 1, - trainerType = 0, - facing = 3, - script = "BattleFrontier_Lounge4_EventScript_Man"), - ), - bgEvents = emptyList(), - ), - // BattleFrontier_ScottsHouse (MAP_BATTLE_FRONTIER_SCOTTS_HOUSE) - MapDef( - regionId = 1, - bankId = 76, - mapId = 46, - width = 6, - height = 8, - paletteIdx1 = 116, - paletteIdx2 = 159, - unknownShort = 384, - unknownByte = 58, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 2, - y = 7, - elevation = 2, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 4, - targetX = 44, - targetY = 5, - targetElevation = 0), - WarpTile( - x = 3, - y = 7, - elevation = 2, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 4, - targetX = 44, - targetY = 5, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 0, - x = 2, - y = 3, - elevation = 3, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "BattleFrontier_ScottsHouse_EventScript_Scott"), - ), - bgEvents = emptyList(), - ), - // BattleFrontier_Lounge5 (MAP_BATTLE_FRONTIER_LOUNGE5) - MapDef( - regionId = 1, - bankId = 76, - mapId = 47, - width = 13, - height = 8, - paletteIdx1 = 116, - paletteIdx2 = 159, - unknownShort = 384, - unknownByte = 58, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 1, - y = 7, - elevation = 0, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 14, - targetX = 22, - targetY = 51, - targetElevation = 0), - WarpTile( - x = 2, - y = 7, - elevation = 0, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 14, - targetX = 22, - targetY = 51, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 12, - x = 12, - y = 4, - elevation = 4, - movementType = 9, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 2, - script = "BattleFrontier_Lounge5_EventScript_NatureGirl"), - NpcDef( - entityIdx = 1, - graphicsId = 48, - x = 0, - y = 4, - elevation = 3, - movementType = 10, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 3, - script = "BattleFrontier_Lounge5_EventScript_Gentleman"), - NpcDef( - entityIdx = 2, - graphicsId = 44, - x = 6, - y = 5, - elevation = 3, - movementType = 2, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "BattleFrontier_Lounge5_EventScript_BlackBelt"), - NpcDef( - entityIdx = 3, - graphicsId = 11, - x = 11, - y = 7, - elevation = 3, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "BattleFrontier_Lounge5_EventScript_LittleBoy"), - ), - bgEvents = emptyList(), - ), - // BattleFrontier_Lounge6 (MAP_BATTLE_FRONTIER_LOUNGE6) - MapDef( - regionId = 1, - bankId = 76, - mapId = 48, - width = 9, - height = 10, - paletteIdx1 = 116, - paletteIdx2 = 159, - unknownShort = 384, - unknownByte = 58, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 4, - y = 9, - elevation = 0, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 14, - targetX = 5, - targetY = 8, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 45, - x = 2, - y = 4, - elevation = 3, - movementType = 10, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 3, - script = "BattleFrontier_Lounge6_EventScript_Trader"), - ), - bgEvents = emptyList(), - ), - // BattleFrontier_Lounge7 (MAP_BATTLE_FRONTIER_LOUNGE7) - MapDef( - regionId = 1, - bankId = 76, - mapId = 49, - width = 9, - height = 10, - paletteIdx1 = 116, - paletteIdx2 = 159, - unknownShort = 384, - unknownByte = 58, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 4, - y = 9, - elevation = 0, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 4, - targetX = 5, - targetY = 20, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 49, - x = 0, - y = 7, - elevation = 3, - movementType = 2, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "BattleFrontier_Lounge7_EventScript_Sailor"), - NpcDef( - entityIdx = 1, - graphicsId = 22, - x = 2, - y = 5, - elevation = 3, - movementType = 10, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 3, - script = "BattleFrontier_Lounge7_EventScript_LeftMoveTutor"), - NpcDef( - entityIdx = 2, - graphicsId = 22, - x = 6, - y = 5, - elevation = 3, - movementType = 9, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 2, - script = "BattleFrontier_Lounge7_EventScript_RightMoveTutor"), - NpcDef( - entityIdx = 3, - graphicsId = 48, - x = 8, - y = 3, - elevation = 3, - movementType = 9, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 2, - script = "BattleFrontier_Lounge7_EventScript_Gentleman"), - ), - bgEvents = emptyList(), - ), - // BattleFrontier_ReceptionGate (MAP_BATTLE_FRONTIER_RECEPTION_GATE) - MapDef( - regionId = 1, - bankId = 76, - mapId = 50, - width = 9, - height = 14, - paletteIdx1 = 100, - paletteIdx2 = 159, - unknownShort = 384, - unknownByte = 58, - borderTiles = - listOf( - Tile2D(0x0023, 0), Tile2D(0x0023, 0), Tile2D(0x0023, 0), Tile2D(0x0023, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 4, - y = 13, - elevation = 0, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 4, - targetX = 26, - targetY = 65, - targetElevation = 0), - WarpTile( - x = 4, - y = 1, - elevation = 0, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 4, - targetX = 26, - targetY = 61, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 0, - x = 0, - y = 11, - elevation = 3, - movementType = 10, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 3, - script = "BattleFrontier_ReceptionGate_EventScript_Greeter"), - NpcDef( - entityIdx = 1, - graphicsId = 0, - x = 8, - y = 11, - elevation = 3, - movementType = 9, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 2, - script = "BattleFrontier_ReceptionGate_EventScript_FacilityGuide"), - NpcDef( - entityIdx = 2, - graphicsId = 23, - x = 8, - y = 4, - elevation = 3, - movementType = 9, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 2, - script = "BattleFrontier_ReceptionGate_EventScript_RulesGuide"), - NpcDef( - entityIdx = 4, - graphicsId = 23, - x = 0, - y = 4, - elevation = 3, - movementType = 10, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 3, - script = "BattleFrontier_ReceptionGate_EventScript_FrontierPassGuide"), - ), - bgEvents = emptyList(), - ), - // BattleFrontier_Lounge8 (MAP_BATTLE_FRONTIER_LOUNGE8) - MapDef( - regionId = 1, - bankId = 76, - mapId = 51, - width = 9, - height = 10, - paletteIdx1 = 116, - paletteIdx2 = 159, - unknownShort = 384, - unknownByte = 58, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 4, - y = 9, - elevation = 0, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 14, - targetX = 14, - targetY = 51, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 5, - x = 4, - y = 5, - elevation = 3, - movementType = 2, - movementRangeX = 2, - movementRangeY = 2, - trainerType = 0, - facing = 0, - script = "BattleFrontier_Lounge8_EventScript_NinjaBoy"), - NpcDef( - entityIdx = 1, - graphicsId = 33, - x = 8, - y = 7, - elevation = 3, - movementType = 9, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 2, - script = "BattleFrontier_Lounge8_EventScript_Man"), - NpcDef( - entityIdx = 2, - graphicsId = 34, - x = 8, - y = 4, - elevation = 3, - movementType = 9, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 2, - script = "BattleFrontier_Lounge8_EventScript_Woman"), - ), - bgEvents = emptyList(), - ), - // BattleFrontier_Lounge9 (MAP_BATTLE_FRONTIER_LOUNGE9) - MapDef( - regionId = 1, - bankId = 76, - mapId = 52, - width = 9, - height = 10, - paletteIdx1 = 116, - paletteIdx2 = 159, - unknownShort = 384, - unknownByte = 58, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 1, - y = 9, - elevation = 0, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 14, - targetX = 21, - targetY = 45, - targetElevation = 0), - WarpTile( - x = 2, - y = 9, - elevation = 0, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 14, - targetX = 21, - targetY = 45, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 10, - x = 6, - y = 3, - elevation = 3, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "0x0"), - ), - bgEvents = emptyList(), - ), - // BattleFrontier_PokemonCenter_1F (MAP_BATTLE_FRONTIER_POKEMON_CENTER_1F) - MapDef( - regionId = 1, - bankId = 76, - mapId = 53, - width = 14, - height = 9, - paletteIdx1 = 116, - paletteIdx2 = 118, - unknownShort = 400, - unknownByte = 58, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 7, - y = 8, - elevation = 2, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 14, - targetX = 3, - targetY = 51, - targetElevation = 0), - WarpTile( - x = 6, - y = 8, - elevation = 2, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 14, - targetX = 3, - targetY = 51, - targetElevation = 0), - WarpTile( - x = 1, - y = 6, - elevation = 3, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 54, - targetX = 1, - targetY = 6, - targetElevation = 3), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 58, - x = 7, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "BattleFrontier_PokemonCenter_1F_EventScript_Nurse"), - NpcDef( - entityIdx = 1, - graphicsId = 38, - x = 4, - y = 5, - elevation = 3, - movementType = 14, - movementRangeX = 1, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "BattleFrontier_PokemonCenter_1F_EventScript_SchoolKid"), - NpcDef( - entityIdx = 2, - graphicsId = 33, - x = 11, - y = 4, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "BattleFrontier_PokemonCenter_1F_EventScript_Man"), - NpcDef( - entityIdx = 3, - graphicsId = 32, - x = 2, - y = 3, - elevation = 3, - movementType = 9, - movementRangeX = 1, - movementRangeY = 0, - trainerType = 0, - facing = 2, - script = "BattleFrontier_PokemonCenter_1F_EventScript_Picnicker"), - NpcDef( - entityIdx = 4, - graphicsId = 0, - x = 1, - y = 3, - elevation = 3, - movementType = 10, - movementRangeX = 1, - movementRangeY = 0, - trainerType = 0, - facing = 3, - script = "BattleFrontier_PokemonCenter_1F_EventScript_Skitty"), - ), - bgEvents = emptyList(), - ), - // BattleFrontier_PokemonCenter_2F (MAP_BATTLE_FRONTIER_POKEMON_CENTER_2F) - MapDef( - regionId = 1, - bankId = 76, - mapId = 54, - width = 14, - height = 10, - paletteIdx1 = 116, - paletteIdx2 = 118, - unknownShort = 400, - unknownByte = 58, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 1, - y = 6, - elevation = 3, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 53, - targetX = 1, - targetY = 6, - targetElevation = 3), - WarpTile( - x = 5, - y = 1, - elevation = 2, - targetRegionId = 1, - targetBankId = 75, - targetMapId = 60, - targetX = 7, - targetY = 11, - targetElevation = 2), - WarpTile( - x = 9, - y = 1, - elevation = 2, - targetRegionId = 1, - targetBankId = 75, - targetMapId = 25, - targetX = 5, - targetY = 8, - targetElevation = 2), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 0, - x = 6, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "Common_EventScript_UnionRoomAttendant"), - NpcDef( - entityIdx = 1, - graphicsId = 0, - x = 2, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "Common_EventScript_WirelessClubAttendant"), - NpcDef( - entityIdx = 2, - graphicsId = 0, - x = 10, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "Common_EventScript_DirectCornerAttendant"), - ), - bgEvents = emptyList(), - ), - // BattleFrontier_Mart (MAP_BATTLE_FRONTIER_MART) - MapDef( - regionId = 1, - bankId = 76, - mapId = 55, - width = 11, - height = 8, - paletteIdx1 = 116, - paletteIdx2 = 117, - unknownShort = 404, - unknownByte = 58, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 3, - y = 7, - elevation = 0, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 4, - targetX = 51, - targetY = 51, - targetElevation = 0), - WarpTile( - x = 4, - y = 7, - elevation = 0, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 4, - targetX = 51, - targetY = 51, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 83, - x = 1, - y = 3, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 3, - script = "BattleFrontier_Mart_EventScript_Clerk"), - NpcDef( - entityIdx = 1, - graphicsId = 30, - x = 5, - y = 4, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 3, - script = "BattleFrontier_Mart_EventScript_OldWoman"), - NpcDef( - entityIdx = 2, - graphicsId = 29, - x = 5, - y = 5, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 3, - script = "BattleFrontier_Mart_EventScript_OldMan"), - NpcDef( - entityIdx = 3, - graphicsId = 9, - x = 8, - y = 4, - elevation = 3, - movementType = 9, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 2, - script = "BattleFrontier_Mart_EventScript_Boy"), - ), - bgEvents = emptyList(), - ), - // FarawayIsland_Entrance (MAP_FARAWAY_ISLAND_ENTRANCE) - MapDef( - regionId = 1, - bankId = 76, - mapId = 56, - width = 34, - height = 46, - paletteIdx1 = 100, - paletteIdx2 = 102, - unknownShort = 381, - unknownByte = 201, - borderTiles = - listOf( - Tile2D(0x0170, 0), Tile2D(0x0170, 0), Tile2D(0x0170, 0), Tile2D(0x0170, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 22, - y = 7, - elevation = 2, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 57, - targetX = 12, - targetY = 19, - targetElevation = 0), - WarpTile( - x = 23, - y = 7, - elevation = 2, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 57, - targetX = 13, - targetY = 19, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 49, - x = 13, - y = 39, - elevation = 3, - movementType = 7, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 1, - script = "FarawayIsland_Entrance_EventScript_Sailor"), - NpcDef( - entityIdx = 1, - graphicsId = 0, - x = 13, - y = 41, - elevation = 1, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 3, - script = "0x0"), - ), - bgEvents = - listOf( - BgEventDef( - x = 3, - y = 32, - facingDir = "BG_EVENT_PLAYER_FACING_NORTH", - script = "FarawayIsland_Entrance_EventScript_Sign"), - ), - ), - // FarawayIsland_Interior (MAP_FARAWAY_ISLAND_INTERIOR) - MapDef( - regionId = 1, - bankId = 76, - mapId = 57, - width = 29, - height = 26, - paletteIdx1 = 100, - paletteIdx2 = 108, - unknownShort = 381, - unknownByte = 201, - borderTiles = - listOf( - Tile2D(0x00C6, 0), Tile2D(0x00C6, 0), Tile2D(0x00C6, 0), Tile2D(0x00C6, 0)), - lighting = Lighting.REGULAR, - weather = Weather.CLOUDY, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 12, - y = 19, - elevation = 0, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 56, - targetX = 22, - targetY = 7, - targetElevation = 2), - WarpTile( - x = 13, - y = 19, - elevation = 0, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 56, - targetX = 23, - targetY = 7, - targetElevation = 2), - ), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // BirthIsland_Exterior (MAP_BIRTH_ISLAND_EXTERIOR) - MapDef( - regionId = 1, - bankId = 76, - mapId = 58, - width = 30, - height = 30, - paletteIdx1 = 100, - paletteIdx2 = 103, - unknownShort = 0, - unknownByte = 200, - borderTiles = - listOf( - Tile2D(0x0170, 0), Tile2D(0x0170, 0), Tile2D(0x0170, 0), Tile2D(0x0170, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 15, - y = 24, - elevation = 0, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 59, - targetX = 8, - targetY = 2, - targetElevation = 0), - ), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // BirthIsland_Harbor (MAP_BIRTH_ISLAND_HARBOR) - MapDef( - regionId = 1, - bankId = 76, - mapId = 59, - width = 17, - height = 13, - paletteIdx1 = 100, - paletteIdx2 = 168, - unknownShort = 0, - unknownByte = 200, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 8, - y = 2, - elevation = 0, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 58, - targetX = 15, - targetY = 24, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 49, - x = 8, - y = 5, - elevation = 3, - movementType = 7, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 1, - script = "BirthIsland_Harbor_EventScript_Sailor"), - NpcDef( - entityIdx = 1, - graphicsId = 0, - x = 8, - y = 7, - elevation = 1, - movementType = 10, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 3, - script = "0x0"), - ), - bgEvents = emptyList(), - ), - // TrainerHill_Entrance (MAP_TRAINER_HILL_ENTRANCE) - MapDef( - regionId = 1, - bankId = 76, - mapId = 60, - width = 19, - height = 17, - paletteIdx1 = 116, - paletteIdx2 = 169, - unknownShort = 384, - unknownByte = 212, - borderTiles = - listOf( - Tile2D(0x0208, 0), Tile2D(0x0208, 0), Tile2D(0x0208, 0), Tile2D(0x0208, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 9, - y = 16, - elevation = 2, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 26, - targetX = 31, - targetY = 113, - targetElevation = 0), - WarpTile( - x = 10, - y = 16, - elevation = 2, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 26, - targetX = 31, - targetY = 113, - targetElevation = 0), - WarpTile( - x = 9, - y = 1, - elevation = 2, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 61, - targetX = 2, - targetY = 1, - targetElevation = 2), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 0, - x = 11, - y = 6, - elevation = 3, - movementType = 9, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 2, - script = "TrainerHill_Entrance_EventScript_Attendant"), - NpcDef( - entityIdx = 1, - graphicsId = 58, - x = 4, - y = 9, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "TrainerHill_Entrance_EventScript_Nurse"), - NpcDef( - entityIdx = 2, - graphicsId = 83, - x = 14, - y = 9, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "TrainerHill_Entrance_EventScript_Clerk"), - NpcDef( - entityIdx = 3, - graphicsId = 14, - x = 5, - y = 14, - elevation = 3, - movementType = 2, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "TrainerHill_Entrance_EventScript_Girl"), - NpcDef( - entityIdx = 4, - graphicsId = 33, - x = 14, - y = 15, - elevation = 3, - movementType = 2, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "TrainerHill_Entrance_EventScript_Man"), - ), - bgEvents = - listOf( - BgEventDef( - x = 8, - y = 10, - facingDir = "BG_EVENT_PLAYER_FACING_NORTH", - script = "TrainerHill_Entrance_EventScript_Records"), - ), - ), - // TrainerHill_1F (MAP_TRAINER_HILL_1F) - MapDef( - regionId = 1, - bankId = 76, - mapId = 61, - width = 16, - height = 21, - paletteIdx1 = 116, - paletteIdx2 = 169, - unknownShort = 384, - unknownByte = 212, - borderTiles = - listOf( - Tile2D(0x0208, 0), Tile2D(0x0208, 0), Tile2D(0x0208, 0), Tile2D(0x0208, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 2, - y = 1, - elevation = 2, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 60, - targetX = 9, - targetY = 1, - targetElevation = 2), - WarpTile( - x = 12, - y = 1, - elevation = 2, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 62, - targetX = 2, - targetY = 1, - targetElevation = 2), - ), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // TrainerHill_2F (MAP_TRAINER_HILL_2F) - MapDef( - regionId = 1, - bankId = 76, - mapId = 62, - width = 16, - height = 21, - paletteIdx1 = 116, - paletteIdx2 = 169, - unknownShort = 384, - unknownByte = 212, - borderTiles = - listOf( - Tile2D(0x0208, 0), Tile2D(0x0208, 0), Tile2D(0x0208, 0), Tile2D(0x0208, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 2, - y = 1, - elevation = 2, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 61, - targetX = 12, - targetY = 1, - targetElevation = 2), - WarpTile( - x = 12, - y = 1, - elevation = 2, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 63, - targetX = 2, - targetY = 1, - targetElevation = 2), - ), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // TrainerHill_3F (MAP_TRAINER_HILL_3F) - MapDef( - regionId = 1, - bankId = 76, - mapId = 63, - width = 16, - height = 21, - paletteIdx1 = 116, - paletteIdx2 = 169, - unknownShort = 384, - unknownByte = 212, - borderTiles = - listOf( - Tile2D(0x0208, 0), Tile2D(0x0208, 0), Tile2D(0x0208, 0), Tile2D(0x0208, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 2, - y = 1, - elevation = 2, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 62, - targetX = 12, - targetY = 1, - targetElevation = 2), - WarpTile( - x = 12, - y = 1, - elevation = 2, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 64, - targetX = 2, - targetY = 1, - targetElevation = 2), - ), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // TrainerHill_4F (MAP_TRAINER_HILL_4F) - MapDef( - regionId = 1, - bankId = 76, - mapId = 64, - width = 16, - height = 21, - paletteIdx1 = 116, - paletteIdx2 = 169, - unknownShort = 384, - unknownByte = 212, - borderTiles = - listOf( - Tile2D(0x0208, 0), Tile2D(0x0208, 0), Tile2D(0x0208, 0), Tile2D(0x0208, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 2, - y = 1, - elevation = 2, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 63, - targetX = 12, - targetY = 1, - targetElevation = 2), - WarpTile( - x = 12, - y = 1, - elevation = 2, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 65, - targetX = 9, - targetY = 5, - targetElevation = 2), - ), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // TrainerHill_Roof (MAP_TRAINER_HILL_ROOF) - MapDef( - regionId = 1, - bankId = 76, - mapId = 65, - width = 25, - height = 16, - paletteIdx1 = 116, - paletteIdx2 = 169, - unknownShort = 384, - unknownByte = 212, - borderTiles = - listOf( - Tile2D(0x0208, 0), Tile2D(0x0208, 0), Tile2D(0x0208, 0), Tile2D(0x0208, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 9, - y = 5, - elevation = 2, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 64, - targetX = 12, - targetY = 1, - targetElevation = 2), - WarpTile( - x = 15, - y = 5, - elevation = 0, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 88, - targetX = 2, - targetY = 6, - targetElevation = 2), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 48, - x = 12, - y = 7, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "TrainerHill_Roof_EventScript_Owner"), - ), - bgEvents = emptyList(), - ), - // NavelRock_Exterior (MAP_NAVEL_ROCK_EXTERIOR) - MapDef( - regionId = 1, - bankId = 76, - mapId = 66, - width = 21, - height = 24, - paletteIdx1 = 100, - paletteIdx2 = 103, - unknownShort = 545, - unknownByte = 211, - borderTiles = - listOf( - Tile2D(0x0170, 0), Tile2D(0x0170, 0), Tile2D(0x0170, 0), Tile2D(0x0170, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 10, - y = 18, - elevation = 0, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 67, - targetX = 8, - targetY = 2, - targetElevation = 0), - WarpTile( - x = 10, - y = 10, - elevation = 0, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 68, - targetX = 10, - targetY = 26, - targetElevation = 2), - ), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // NavelRock_Harbor (MAP_NAVEL_ROCK_HARBOR) - MapDef( - regionId = 1, - bankId = 76, - mapId = 67, - width = 17, - height = 13, - paletteIdx1 = 100, - paletteIdx2 = 168, - unknownShort = 545, - unknownByte = 211, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 8, - y = 2, - elevation = 0, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 66, - targetX = 10, - targetY = 18, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 49, - x = 8, - y = 5, - elevation = 3, - movementType = 7, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 1, - script = "NavelRock_Harbor_EventScript_Sailor"), - NpcDef( - entityIdx = 1, - graphicsId = 0, - x = 8, - y = 7, - elevation = 1, - movementType = 10, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 3, - script = "0x0"), - ), - bgEvents = emptyList(), - ), - // NavelRock_Entrance (MAP_NAVEL_ROCK_ENTRANCE) - MapDef( - regionId = 1, - bankId = 76, - mapId = 68, - width = 21, - height = 32, - paletteIdx1 = 100, - paletteIdx2 = 170, - unknownShort = 543, - unknownByte = 211, - borderTiles = - listOf( - Tile2D(0x0211, 0), Tile2D(0x0211, 0), Tile2D(0x0211, 0), Tile2D(0x0211, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.UNDERGROUND, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 10, - y = 5, - elevation = 2, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 69, - targetX = 4, - targetY = 3, - targetElevation = 2), - WarpTile( - x = 10, - y = 26, - elevation = 2, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 66, - targetX = 10, - targetY = 10, - targetElevation = 0), - ), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // NavelRock_B1F (MAP_NAVEL_ROCK_B1F) - MapDef( - regionId = 1, - bankId = 76, - mapId = 69, - width = 23, - height = 11, - paletteIdx1 = 100, - paletteIdx2 = 170, - unknownShort = 543, - unknownByte = 211, - borderTiles = - listOf( - Tile2D(0x0211, 0), Tile2D(0x0211, 0), Tile2D(0x0211, 0), Tile2D(0x0211, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.UNDERGROUND, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 4, - y = 3, - elevation = 2, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 68, - targetX = 10, - targetY = 5, - targetElevation = 2), - WarpTile( - x = 18, - y = 9, - elevation = 2, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 70, - targetX = 11, - targetY = 79, - targetElevation = 2), - ), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // NavelRock_Fork (MAP_NAVEL_ROCK_FORK) - MapDef( - regionId = 1, - bankId = 76, - mapId = 70, - width = 27, - height = 86, - paletteIdx1 = 100, - paletteIdx2 = 170, - unknownShort = 543, - unknownByte = 211, - borderTiles = - listOf( - Tile2D(0x0211, 0), Tile2D(0x0211, 0), Tile2D(0x0211, 0), Tile2D(0x0211, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.UNDERGROUND, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 4, - y = 6, - elevation = 2, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 71, - targetX = 5, - targetY = 5, - targetElevation = 2), - WarpTile( - x = 11, - y = 79, - elevation = 2, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 69, - targetX = 18, - targetY = 9, - targetElevation = 2), - WarpTile( - x = 22, - y = 6, - elevation = 2, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 76, - targetX = 3, - targetY = 3, - targetElevation = 2), - ), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // NavelRock_Up1 (MAP_NAVEL_ROCK_UP1) - MapDef( - regionId = 1, - bankId = 76, - mapId = 71, - width = 9, - height = 8, - paletteIdx1 = 100, - paletteIdx2 = 170, - unknownShort = 543, - unknownByte = 211, - borderTiles = - listOf( - Tile2D(0x0211, 0), Tile2D(0x0211, 0), Tile2D(0x0211, 0), Tile2D(0x0211, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.UNDERGROUND, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 5, - y = 5, - elevation = 2, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 70, - targetX = 4, - targetY = 6, - targetElevation = 2), - WarpTile( - x = 3, - y = 3, - elevation = 2, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 72, - targetX = 3, - targetY = 3, - targetElevation = 2), - ), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // NavelRock_Up2 (MAP_NAVEL_ROCK_UP2) - MapDef( - regionId = 1, - bankId = 76, - mapId = 72, - width = 9, - height = 8, - paletteIdx1 = 100, - paletteIdx2 = 170, - unknownShort = 543, - unknownByte = 211, - borderTiles = - listOf( - Tile2D(0x0211, 0), Tile2D(0x0211, 0), Tile2D(0x0211, 0), Tile2D(0x0211, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.UNDERGROUND, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 3, - y = 3, - elevation = 2, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 71, - targetX = 3, - targetY = 3, - targetElevation = 2), - WarpTile( - x = 5, - y = 5, - elevation = 2, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 73, - targetX = 5, - targetY = 5, - targetElevation = 2), - ), - npcs = emptyList(), - bgEvents = emptyList(), - ), - ) - allMaps.forEach { registerMap(it) } - } - - private fun registerDefaultMaps8() { - val allMaps = - listOf( - // NavelRock_Up3 (MAP_NAVEL_ROCK_UP3) - MapDef( - regionId = 1, - bankId = 76, - mapId = 73, - width = 9, - height = 8, - paletteIdx1 = 100, - paletteIdx2 = 170, - unknownShort = 543, - unknownByte = 211, - borderTiles = - listOf( - Tile2D(0x0211, 0), Tile2D(0x0211, 0), Tile2D(0x0211, 0), Tile2D(0x0211, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.UNDERGROUND, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 5, - y = 5, - elevation = 2, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 72, - targetX = 5, - targetY = 5, - targetElevation = 2), - WarpTile( - x = 3, - y = 3, - elevation = 2, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 74, - targetX = 3, - targetY = 3, - targetElevation = 2), - ), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // NavelRock_Up4 (MAP_NAVEL_ROCK_UP4) - MapDef( - regionId = 1, - bankId = 76, - mapId = 74, - width = 9, - height = 8, - paletteIdx1 = 100, - paletteIdx2 = 170, - unknownShort = 543, - unknownByte = 211, - borderTiles = - listOf( - Tile2D(0x0211, 0), Tile2D(0x0211, 0), Tile2D(0x0211, 0), Tile2D(0x0211, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.UNDERGROUND, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 3, - y = 3, - elevation = 2, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 73, - targetX = 3, - targetY = 3, - targetElevation = 2), - WarpTile( - x = 5, - y = 5, - elevation = 2, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 75, - targetX = 13, - targetY = 20, - targetElevation = 2), - ), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // NavelRock_Top (MAP_NAVEL_ROCK_TOP) - MapDef( - regionId = 1, - bankId = 76, - mapId = 75, - width = 25, - height = 28, - paletteIdx1 = 100, - paletteIdx2 = 170, - unknownShort = 543, - unknownByte = 211, - borderTiles = - listOf( - Tile2D(0x033C, 0), Tile2D(0x033C, 0), Tile2D(0x033C, 0), Tile2D(0x033C, 0)), - lighting = Lighting.REGULAR, - weather = Weather.CLOUDY, - mapType = MapType.UNDERGROUND, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 13, - y = 20, - elevation = 2, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 74, - targetX = 5, - targetY = 5, - targetElevation = 2), - ), - npcs = emptyList(), - bgEvents = - listOf( - BgEventDef( - x = 12, - y = 9, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - ), - ), - // NavelRock_Down01 (MAP_NAVEL_ROCK_DOWN01) - MapDef( - regionId = 1, - bankId = 76, - mapId = 76, - width = 9, - height = 8, - paletteIdx1 = 100, - paletteIdx2 = 170, - unknownShort = 543, - unknownByte = 211, - borderTiles = - listOf( - Tile2D(0x0211, 0), Tile2D(0x0211, 0), Tile2D(0x0211, 0), Tile2D(0x0211, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.UNDERGROUND, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 3, - y = 3, - elevation = 2, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 70, - targetX = 22, - targetY = 6, - targetElevation = 2), - WarpTile( - x = 5, - y = 5, - elevation = 2, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 77, - targetX = 5, - targetY = 5, - targetElevation = 2), - ), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // NavelRock_Down02 (MAP_NAVEL_ROCK_DOWN02) - MapDef( - regionId = 1, - bankId = 76, - mapId = 77, - width = 9, - height = 8, - paletteIdx1 = 100, - paletteIdx2 = 170, - unknownShort = 543, - unknownByte = 211, - borderTiles = - listOf( - Tile2D(0x0211, 0), Tile2D(0x0211, 0), Tile2D(0x0211, 0), Tile2D(0x0211, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.UNDERGROUND, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 5, - y = 5, - elevation = 2, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 76, - targetX = 5, - targetY = 5, - targetElevation = 2), - WarpTile( - x = 3, - y = 3, - elevation = 2, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 78, - targetX = 3, - targetY = 3, - targetElevation = 2), - ), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // NavelRock_Down03 (MAP_NAVEL_ROCK_DOWN03) - MapDef( - regionId = 1, - bankId = 76, - mapId = 78, - width = 9, - height = 8, - paletteIdx1 = 100, - paletteIdx2 = 170, - unknownShort = 543, - unknownByte = 211, - borderTiles = - listOf( - Tile2D(0x0211, 0), Tile2D(0x0211, 0), Tile2D(0x0211, 0), Tile2D(0x0211, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.UNDERGROUND, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 3, - y = 3, - elevation = 2, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 77, - targetX = 3, - targetY = 3, - targetElevation = 2), - WarpTile( - x = 5, - y = 5, - elevation = 2, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 79, - targetX = 5, - targetY = 5, - targetElevation = 2), - ), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // NavelRock_Down04 (MAP_NAVEL_ROCK_DOWN04) - MapDef( - regionId = 1, - bankId = 76, - mapId = 79, - width = 9, - height = 8, - paletteIdx1 = 100, - paletteIdx2 = 170, - unknownShort = 543, - unknownByte = 211, - borderTiles = - listOf( - Tile2D(0x0211, 0), Tile2D(0x0211, 0), Tile2D(0x0211, 0), Tile2D(0x0211, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.UNDERGROUND, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 5, - y = 5, - elevation = 2, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 78, - targetX = 5, - targetY = 5, - targetElevation = 2), - WarpTile( - x = 3, - y = 3, - elevation = 2, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 80, - targetX = 3, - targetY = 3, - targetElevation = 2), - ), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // NavelRock_Down05 (MAP_NAVEL_ROCK_DOWN05) - MapDef( - regionId = 1, - bankId = 76, - mapId = 80, - width = 9, - height = 8, - paletteIdx1 = 100, - paletteIdx2 = 170, - unknownShort = 543, - unknownByte = 211, - borderTiles = - listOf( - Tile2D(0x0211, 0), Tile2D(0x0211, 0), Tile2D(0x0211, 0), Tile2D(0x0211, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.UNDERGROUND, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 3, - y = 3, - elevation = 2, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 79, - targetX = 3, - targetY = 3, - targetElevation = 2), - WarpTile( - x = 5, - y = 5, - elevation = 2, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 81, - targetX = 5, - targetY = 5, - targetElevation = 2), - ), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // NavelRock_Down06 (MAP_NAVEL_ROCK_DOWN06) - MapDef( - regionId = 1, - bankId = 76, - mapId = 81, - width = 9, - height = 8, - paletteIdx1 = 100, - paletteIdx2 = 170, - unknownShort = 543, - unknownByte = 211, - borderTiles = - listOf( - Tile2D(0x0211, 0), Tile2D(0x0211, 0), Tile2D(0x0211, 0), Tile2D(0x0211, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.UNDERGROUND, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 5, - y = 5, - elevation = 2, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 80, - targetX = 5, - targetY = 5, - targetElevation = 2), - WarpTile( - x = 3, - y = 3, - elevation = 2, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 82, - targetX = 3, - targetY = 3, - targetElevation = 2), - ), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // NavelRock_Down07 (MAP_NAVEL_ROCK_DOWN07) - MapDef( - regionId = 1, - bankId = 76, - mapId = 82, - width = 9, - height = 8, - paletteIdx1 = 100, - paletteIdx2 = 170, - unknownShort = 543, - unknownByte = 211, - borderTiles = - listOf( - Tile2D(0x0211, 0), Tile2D(0x0211, 0), Tile2D(0x0211, 0), Tile2D(0x0211, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.UNDERGROUND, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 3, - y = 3, - elevation = 2, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 81, - targetX = 3, - targetY = 3, - targetElevation = 2), - WarpTile( - x = 5, - y = 5, - elevation = 2, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 83, - targetX = 5, - targetY = 5, - targetElevation = 2), - ), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // NavelRock_Down08 (MAP_NAVEL_ROCK_DOWN08) - MapDef( - regionId = 1, - bankId = 76, - mapId = 83, - width = 9, - height = 8, - paletteIdx1 = 100, - paletteIdx2 = 170, - unknownShort = 543, - unknownByte = 211, - borderTiles = - listOf( - Tile2D(0x0211, 0), Tile2D(0x0211, 0), Tile2D(0x0211, 0), Tile2D(0x0211, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.UNDERGROUND, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 5, - y = 5, - elevation = 2, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 82, - targetX = 5, - targetY = 5, - targetElevation = 2), - WarpTile( - x = 3, - y = 3, - elevation = 2, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 84, - targetX = 3, - targetY = 3, - targetElevation = 2), - ), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // NavelRock_Down09 (MAP_NAVEL_ROCK_DOWN09) - MapDef( - regionId = 1, - bankId = 76, - mapId = 84, - width = 9, - height = 8, - paletteIdx1 = 100, - paletteIdx2 = 170, - unknownShort = 543, - unknownByte = 211, - borderTiles = - listOf( - Tile2D(0x0211, 0), Tile2D(0x0211, 0), Tile2D(0x0211, 0), Tile2D(0x0211, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.UNDERGROUND, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 3, - y = 3, - elevation = 2, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 83, - targetX = 3, - targetY = 3, - targetElevation = 2), - WarpTile( - x = 5, - y = 5, - elevation = 2, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 85, - targetX = 5, - targetY = 5, - targetElevation = 2), - ), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // NavelRock_Down10 (MAP_NAVEL_ROCK_DOWN10) - MapDef( - regionId = 1, - bankId = 76, - mapId = 85, - width = 9, - height = 8, - paletteIdx1 = 100, - paletteIdx2 = 170, - unknownShort = 543, - unknownByte = 211, - borderTiles = - listOf( - Tile2D(0x0211, 0), Tile2D(0x0211, 0), Tile2D(0x0211, 0), Tile2D(0x0211, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.UNDERGROUND, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 5, - y = 5, - elevation = 2, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 84, - targetX = 5, - targetY = 5, - targetElevation = 2), - WarpTile( - x = 3, - y = 3, - elevation = 2, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 86, - targetX = 3, - targetY = 3, - targetElevation = 2), - ), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // NavelRock_Down11 (MAP_NAVEL_ROCK_DOWN11) - MapDef( - regionId = 1, - bankId = 76, - mapId = 86, - width = 9, - height = 8, - paletteIdx1 = 100, - paletteIdx2 = 170, - unknownShort = 543, - unknownByte = 211, - borderTiles = - listOf( - Tile2D(0x0211, 0), Tile2D(0x0211, 0), Tile2D(0x0211, 0), Tile2D(0x0211, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.UNDERGROUND, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 5, - y = 5, - elevation = 2, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 87, - targetX = 14, - targetY = 19, - targetElevation = 0), - WarpTile( - x = 3, - y = 3, - elevation = 2, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 85, - targetX = 3, - targetY = 3, - targetElevation = 2), - ), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // NavelRock_Bottom (MAP_NAVEL_ROCK_BOTTOM) - MapDef( - regionId = 1, - bankId = 76, - mapId = 87, - width = 22, - height = 22, - paletteIdx1 = 100, - paletteIdx2 = 170, - unknownShort = 543, - unknownByte = 211, - borderTiles = - listOf( - Tile2D(0x0211, 0), Tile2D(0x0211, 0), Tile2D(0x0211, 0), Tile2D(0x0211, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.UNDERGROUND, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 14, - y = 19, - elevation = 0, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 86, - targetX = 5, - targetY = 5, - targetElevation = 2), - ), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // TrainerHill_Elevator (MAP_TRAINER_HILL_ELEVATOR) - MapDef( - regionId = 1, - bankId = 76, - mapId = 88, - width = 5, - height = 7, - paletteIdx1 = 116, - paletteIdx2 = 159, - unknownShort = 384, - unknownByte = 212, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 1, - y = 6, - elevation = 2, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 65, - targetX = 15, - targetY = 5, - targetElevation = 0), - WarpTile( - x = 2, - y = 6, - elevation = 2, - targetRegionId = 1, - targetBankId = 76, - targetMapId = 65, - targetX = 15, - targetY = 5, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 0, - x = 0, - y = 6, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "TrainerHill_Elevator_EventScript_Attendant"), - ), - bgEvents = emptyList(), - ), - // Route104_Prototype (MAP_ROUTE104_PROTOTYPE) - MapDef( - regionId = 1, - bankId = 77, - mapId = 0, - width = 1, - height = 1, - paletteIdx1 = 100, - paletteIdx2 = 102, - unknownShort = 401, - unknownByte = 19, - borderTiles = - listOf( - Tile2D(0x01D4, 0), Tile2D(0x01D5, 0), Tile2D(0x01DC, 0), Tile2D(0x01DD, 0)), - lighting = Lighting.REGULAR, - weather = Weather.REGULAR_WEATHER, - mapType = MapType.ROUTE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = emptyList(), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // Route104_PrototypePrettyPetalFlowerShop - // (MAP_ROUTE104_PROTOTYPE_PRETTY_PETAL_FLOWER_SHOP) - MapDef( - regionId = 1, - bankId = 77, - mapId = 1, - width = 15, - height = 9, - paletteIdx1 = 116, - paletteIdx2 = 127, - unknownShort = 401, - unknownByte = 19, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = emptyList(), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // Route109_SeashoreHouse (MAP_ROUTE109_SEASHORE_HOUSE) - MapDef( - regionId = 1, - bankId = 78, - mapId = 0, - width = 15, - height = 10, - paletteIdx1 = 116, - paletteIdx2 = 126, - unknownShort = 427, - unknownByte = 24, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 6, - y = 9, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 24, - targetX = 12, - targetY = 5, - targetElevation = 0), - WarpTile( - x = 7, - y = 9, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 24, - targetX = 12, - targetY = 5, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 25, - x = 6, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "Route109_SeashoreHouse_EventScript_Owner"), - NpcDef( - entityIdx = 1, - graphicsId = 49, - x = 2, - y = 3, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "Route109_SeashoreHouse_EventScript_Dwayne"), - NpcDef( - entityIdx = 2, - graphicsId = 54, - x = 14, - y = 9, - elevation = 3, - movementType = 9, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 2, - script = "Route109_SeashoreHouse_EventScript_Simon"), - NpcDef( - entityIdx = 3, - graphicsId = 45, - x = 10, - y = 5, - elevation = 3, - movementType = 14, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "Route109_SeashoreHouse_EventScript_Johanna"), - ), - bgEvents = emptyList(), - ), - // Route110_TrickHouseEntrance (MAP_ROUTE110_TRICK_HOUSE_ENTRANCE) - MapDef( - regionId = 1, - bankId = 79, - mapId = 0, - width = 12, - height = 8, - paletteIdx1 = 116, - paletteIdx2 = 147, - unknownShort = 448, - unknownByte = 25, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 5, - y = 7, - elevation = 2, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 25, - targetX = 11, - targetY = 66, - targetElevation = 0), - WarpTile( - x = 6, - y = 7, - elevation = 2, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 25, - targetX = 11, - targetY = 66, - targetElevation = 0), - WarpTile( - x = 5, - y = 2, - elevation = 2, - targetRegionId = 1, - targetBankId = 79, - targetMapId = 3, - targetX = 0, - targetY = 21, - targetElevation = 2), - ), - npcs = emptyList(), - bgEvents = - listOf( - BgEventDef( - x = 5, - y = 1, - facingDir = "BG_EVENT_PLAYER_FACING_NORTH", - script = "Route110_TrickHouseEntrance_EventScript_Door"), - ), - ), - // Route110_TrickHouseEnd (MAP_ROUTE110_TRICK_HOUSE_END) - MapDef( - regionId = 1, - bankId = 79, - mapId = 1, - width = 12, - height = 8, - paletteIdx1 = 116, - paletteIdx2 = 147, - unknownShort = 448, - unknownByte = 25, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 10, - y = 1, - elevation = 2, - targetRegionId = 1, - targetBankId = 79, - targetMapId = 3, - targetX = 13, - targetY = 1, - targetElevation = 2), - WarpTile( - x = 2, - y = 1, - elevation = 2, - targetRegionId = 1, - targetBankId = 79, - targetMapId = 2, - targetX = 13, - targetY = 3, - targetElevation = 2), - ), - npcs = emptyList(), - bgEvents = - listOf( - BgEventDef( - x = 4, - y = 5, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "undefined"), - ), - ), - // Route110_TrickHouseCorridor (MAP_ROUTE110_TRICK_HOUSE_CORRIDOR) - MapDef( - regionId = 1, - bankId = 79, - mapId = 2, - width = 15, - height = 24, - paletteIdx1 = 116, - paletteIdx2 = 147, - unknownShort = 448, - unknownByte = 25, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 13, - y = 3, - elevation = 2, - targetRegionId = 1, - targetBankId = 79, - targetMapId = 1, - targetX = 2, - targetY = 1, - targetElevation = 2), - WarpTile( - x = 14, - y = 3, - elevation = 2, - targetRegionId = 1, - targetBankId = 79, - targetMapId = 1, - targetX = 2, - targetY = 1, - targetElevation = 2), - WarpTile( - x = 4, - y = 23, - elevation = 2, - targetRegionId = 1, - targetBankId = 79, - targetMapId = 0, - targetX = 5, - targetY = 2, - targetElevation = 2), - WarpTile( - x = 5, - y = 23, - elevation = 2, - targetRegionId = 1, - targetBankId = 79, - targetMapId = 0, - targetX = 5, - targetY = 2, - targetElevation = 2), - ), - npcs = emptyList(), - bgEvents = emptyList(), - ), - // Route110_TrickHousePuzzle1 (MAP_ROUTE110_TRICK_HOUSE_PUZZLE1) - MapDef( - regionId = 1, - bankId = 79, - mapId = 3, - width = 15, - height = 22, - paletteIdx1 = 116, - paletteIdx2 = 153, - unknownShort = 448, - unknownByte = 25, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 0, - y = 21, - elevation = 2, - targetRegionId = 1, - targetBankId = 79, - targetMapId = 0, - targetX = 5, - targetY = 2, - targetElevation = 2), - WarpTile( - x = 1, - y = 21, - elevation = 2, - targetRegionId = 1, - targetBankId = 79, - targetMapId = 0, - targetX = 5, - targetY = 2, - targetElevation = 2), - WarpTile( - x = 13, - y = 1, - elevation = 2, - targetRegionId = 1, - targetBankId = 79, - targetMapId = 1, - targetX = 10, - targetY = 1, - targetElevation = 2), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 47, - x = 14, - y = 20, - elevation = 3, - movementType = 9, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 2, - script = "Route110_TrickHousePuzzle1_EventScript_Sally"), - NpcDef( - entityIdx = 1, - graphicsId = 35, - x = 14, - y = 8, - elevation = 3, - movementType = 9, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 2, - script = "Route110_TrickHousePuzzle1_EventScript_Eddie"), - NpcDef( - entityIdx = 2, - graphicsId = 47, - x = 2, - y = 15, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "Route110_TrickHousePuzzle1_EventScript_Robin"), - ), - bgEvents = - listOf( - BgEventDef( - x = 3, - y = 16, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "Route110_TrickHousePuzzle1_EventScript_Scroll"), - ), - ), - // Route110_TrickHousePuzzle2 (MAP_ROUTE110_TRICK_HOUSE_PUZZLE2) - MapDef( - regionId = 1, - bankId = 79, - mapId = 4, - width = 15, - height = 22, - paletteIdx1 = 116, - paletteIdx2 = 153, - unknownShort = 448, - unknownByte = 25, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 0, - y = 21, - elevation = 2, - targetRegionId = 1, - targetBankId = 79, - targetMapId = 0, - targetX = 5, - targetY = 2, - targetElevation = 2), - WarpTile( - x = 1, - y = 21, - elevation = 2, - targetRegionId = 1, - targetBankId = 79, - targetMapId = 0, - targetX = 5, - targetY = 2, - targetElevation = 2), - WarpTile( - x = 13, - y = 1, - elevation = 2, - targetRegionId = 1, - targetBankId = 79, - targetMapId = 1, - targetX = 10, - targetY = 1, - targetElevation = 2), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 38, - x = 13, - y = 10, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 3, - script = "Route110_TrickHousePuzzle2_EventScript_Ted"), - NpcDef( - entityIdx = 1, - graphicsId = 38, - x = 10, - y = 17, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "Route110_TrickHousePuzzle2_EventScript_Paul"), - NpcDef( - entityIdx = 2, - graphicsId = 14, - x = 11, - y = 9, - elevation = 3, - movementType = 9, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 2, - script = "Route110_TrickHousePuzzle2_EventScript_Georgia"), - ), - bgEvents = - listOf( - BgEventDef( - x = 14, - y = 14, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "Route110_TrickHousePuzzle2_EventScript_Scroll"), - ), - ), - // Route110_TrickHousePuzzle3 (MAP_ROUTE110_TRICK_HOUSE_PUZZLE3) - MapDef( - regionId = 1, - bankId = 79, - mapId = 5, - width = 15, - height = 22, - paletteIdx1 = 116, - paletteIdx2 = 153, - unknownShort = 448, - unknownByte = 25, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 0, - y = 21, - elevation = 2, - targetRegionId = 1, - targetBankId = 79, - targetMapId = 0, - targetX = 5, - targetY = 2, - targetElevation = 2), - WarpTile( - x = 1, - y = 21, - elevation = 2, - targetRegionId = 1, - targetBankId = 79, - targetMapId = 0, - targetX = 5, - targetY = 2, - targetElevation = 2), - WarpTile( - x = 13, - y = 1, - elevation = 2, - targetRegionId = 1, - targetBankId = 79, - targetMapId = 1, - targetX = 10, - targetY = 1, - targetElevation = 2), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 31, - x = 7, - y = 19, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "Route110_TrickHousePuzzle3_EventScript_Justin"), - NpcDef( - entityIdx = 1, - graphicsId = 32, - x = 4, - y = 4, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 3, - script = "Route110_TrickHousePuzzle3_EventScript_Martha"), - NpcDef( - entityIdx = 2, - graphicsId = 55, - x = 10, - y = 10, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "Route110_TrickHousePuzzle3_EventScript_Alan"), - ), - bgEvents = - listOf( - BgEventDef( - x = 0, - y = 14, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "Route110_TrickHousePuzzle3_EventScript_Scroll"), - ), - ), - // Route110_TrickHousePuzzle4 (MAP_ROUTE110_TRICK_HOUSE_PUZZLE4) - MapDef( - regionId = 1, - bankId = 79, - mapId = 6, - width = 15, - height = 22, - paletteIdx1 = 116, - paletteIdx2 = 153, - unknownShort = 448, - unknownByte = 25, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 0, - y = 21, - elevation = 2, - targetRegionId = 1, - targetBankId = 79, - targetMapId = 0, - targetX = 5, - targetY = 2, - targetElevation = 2), - WarpTile( - x = 1, - y = 21, - elevation = 2, - targetRegionId = 1, - targetBankId = 79, - targetMapId = 0, - targetX = 5, - targetY = 2, - targetElevation = 2), - WarpTile( - x = 13, - y = 1, - elevation = 2, - targetRegionId = 1, - targetBankId = 79, - targetMapId = 1, - targetX = 10, - targetY = 1, - targetElevation = 2), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 14, - x = 2, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 0, - script = "Route110_TrickHousePuzzle4_EventScript_Cora"), - NpcDef( - entityIdx = 1, - graphicsId = 14, - x = 14, - y = 7, - elevation = 3, - movementType = 9, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 2, - script = "Route110_TrickHousePuzzle4_EventScript_Paula"), - NpcDef( - entityIdx = 2, - graphicsId = 44, - x = 2, - y = 14, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 3, - script = "Route110_TrickHousePuzzle4_EventScript_Yuji"), - ), - bgEvents = - listOf( - BgEventDef( - x = 14, - y = 13, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "Route110_TrickHousePuzzle4_EventScript_Scroll"), - ), - ), - // Route110_TrickHousePuzzle5 (MAP_ROUTE110_TRICK_HOUSE_PUZZLE5) - MapDef( - regionId = 1, - bankId = 79, - mapId = 7, - width = 15, - height = 22, - paletteIdx1 = 116, - paletteIdx2 = 153, - unknownShort = 448, - unknownByte = 25, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 0, - y = 21, - elevation = 2, - targetRegionId = 1, - targetBankId = 79, - targetMapId = 0, - targetX = 5, - targetY = 2, - targetElevation = 2), - WarpTile( - x = 1, - y = 21, - elevation = 2, - targetRegionId = 1, - targetBankId = 79, - targetMapId = 0, - targetX = 5, - targetY = 2, - targetElevation = 2), - WarpTile( - x = 13, - y = 1, - elevation = 2, - targetRegionId = 1, - targetBankId = 79, - targetMapId = 1, - targetX = 10, - targetY = 1, - targetElevation = 2), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 19, - x = 6, - y = 17, - elevation = 3, - movementType = 9, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 2, - script = "Route110_TrickHousePuzzle5_EventScript_Mechadoll1"), - NpcDef( - entityIdx = 1, - graphicsId = 19, - x = 0, - y = 7, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 3, - script = "Route110_TrickHousePuzzle5_EventScript_Mechadoll2"), - NpcDef( - entityIdx = 2, - graphicsId = 19, - x = 14, - y = 10, - elevation = 3, - movementType = 9, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 2, - script = "Route110_TrickHousePuzzle5_EventScript_Mechadoll3"), - NpcDef( - entityIdx = 3, - graphicsId = 19, - x = 14, - y = 19, - elevation = 3, - movementType = 9, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 2, - script = "Route110_TrickHousePuzzle5_EventScript_Mechadoll4"), - NpcDef( - entityIdx = 4, - graphicsId = 19, - x = 10, - y = 4, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 3, - script = "Route110_TrickHousePuzzle5_EventScript_Mechadoll5"), - ), - bgEvents = - listOf( - BgEventDef( - x = 11, - y = 21, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "Route110_TrickHousePuzzle5_EventScript_Scroll"), - ), - ), - // Route110_TrickHousePuzzle6 (MAP_ROUTE110_TRICK_HOUSE_PUZZLE6) - MapDef( - regionId = 1, - bankId = 79, - mapId = 8, - width = 15, - height = 22, - paletteIdx1 = 116, - paletteIdx2 = 153, - unknownShort = 448, - unknownByte = 25, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 0, - y = 21, - elevation = 2, - targetRegionId = 1, - targetBankId = 79, - targetMapId = 0, - targetX = 5, - targetY = 2, - targetElevation = 2), - WarpTile( - x = 1, - y = 21, - elevation = 2, - targetRegionId = 1, - targetBankId = 79, - targetMapId = 0, - targetX = 5, - targetY = 2, - targetElevation = 2), - WarpTile( - x = 13, - y = 1, - elevation = 2, - targetRegionId = 1, - targetBankId = 79, - targetMapId = 1, - targetX = 10, - targetY = 1, - targetElevation = 2), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 32, - x = 7, - y = 9, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 3, - script = "Route110_TrickHousePuzzle6_EventScript_Sophia"), - NpcDef( - entityIdx = 1, - graphicsId = 66, - x = 11, - y = 10, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 3, - script = "Route110_TrickHousePuzzle6_EventScript_Benny"), - NpcDef( - entityIdx = 2, - graphicsId = 31, - x = 4, - y = 5, - elevation = 3, - movementType = 7, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 1, - script = "Route110_TrickHousePuzzle6_EventScript_Sebastian"), - ), - bgEvents = - listOf( - BgEventDef( - x = 0, - y = 10, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "Route110_TrickHousePuzzle6_EventScript_Scroll"), - ), - ), - // Route110_TrickHousePuzzle7 (MAP_ROUTE110_TRICK_HOUSE_PUZZLE7) - MapDef( - regionId = 1, - bankId = 79, - mapId = 9, - width = 15, - height = 22, - paletteIdx1 = 116, - paletteIdx2 = 153, - unknownShort = 448, - unknownByte = 25, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 0, - y = 21, - elevation = 2, - targetRegionId = 1, - targetBankId = 79, - targetMapId = 0, - targetX = 5, - targetY = 2, - targetElevation = 2), - WarpTile( - x = 1, - y = 21, - elevation = 2, - targetRegionId = 1, - targetBankId = 79, - targetMapId = 0, - targetX = 5, - targetY = 2, - targetElevation = 2), - WarpTile( - x = 13, - y = 1, - elevation = 2, - targetRegionId = 1, - targetBankId = 79, - targetMapId = 1, - targetX = 10, - targetY = 1, - targetElevation = 2), - WarpTile( - x = 13, - y = 4, - elevation = 0, - targetRegionId = 1, - targetBankId = 79, - targetMapId = 9, - targetX = 7, - targetY = 3, - targetElevation = 0), - WarpTile( - x = 7, - y = 3, - elevation = 0, - targetRegionId = 1, - targetBankId = 79, - targetMapId = 9, - targetX = 13, - targetY = 4, - targetElevation = 0), - WarpTile( - x = 13, - y = 11, - elevation = 0, - targetRegionId = 1, - targetBankId = 79, - targetMapId = 9, - targetX = 4, - targetY = 3, - targetElevation = 0), - WarpTile( - x = 4, - y = 3, - elevation = 0, - targetRegionId = 1, - targetBankId = 79, - targetMapId = 9, - targetX = 13, - targetY = 11, - targetElevation = 0), - WarpTile( - x = 1, - y = 17, - elevation = 0, - targetRegionId = 1, - targetBankId = 79, - targetMapId = 9, - targetX = 0, - targetY = 11, - targetElevation = 0), - WarpTile( - x = 0, - y = 11, - elevation = 0, - targetRegionId = 1, - targetBankId = 79, - targetMapId = 9, - targetX = 1, - targetY = 17, - targetElevation = 0), - WarpTile( - x = 2, - y = 3, - elevation = 0, - targetRegionId = 1, - targetBankId = 79, - targetMapId = 9, - targetX = 4, - targetY = 13, - targetElevation = 0), - WarpTile( - x = 4, - y = 13, - elevation = 0, - targetRegionId = 1, - targetBankId = 79, - targetMapId = 9, - targetX = 2, - targetY = 3, - targetElevation = 0), - WarpTile( - x = 1, - y = 3, - elevation = 0, - targetRegionId = 1, - targetBankId = 79, - targetMapId = 9, - targetX = 8, - targetY = 12, - targetElevation = 0), - WarpTile( - x = 8, - y = 12, - elevation = 0, - targetRegionId = 1, - targetBankId = 79, - targetMapId = 9, - targetX = 1, - targetY = 3, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 37, - x = 9, - y = 20, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 3, - script = "Route110_TrickHousePuzzle7_EventScript_Joshua"), - NpcDef( - entityIdx = 1, - graphicsId = 47, - x = 10, - y = 2, - elevation = 3, - movementType = 7, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 1, - script = "Route110_TrickHousePuzzle7_EventScript_Alexis"), - NpcDef( - entityIdx = 2, - graphicsId = 40, - x = 8, - y = 17, - elevation = 3, - movementType = 9, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 2, - script = "Route110_TrickHousePuzzle7_EventScript_Patricia"), - NpcDef( - entityIdx = 4, - graphicsId = 37, - x = 9, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 0, - script = "Route110_TrickHousePuzzle7_EventScript_Alvaro"), - NpcDef( - entityIdx = 5, - graphicsId = 47, - x = 8, - y = 13, - elevation = 3, - movementType = 7, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 1, - script = "Route110_TrickHousePuzzle7_EventScript_Mariela"), - NpcDef( - entityIdx = 6, - graphicsId = 48, - x = 9, - y = 12, - elevation = 3, - movementType = 9, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 1, - facing = 2, - script = "Route110_TrickHousePuzzle7_EventScript_Everett"), - NpcDef( - entityIdx = 7, - graphicsId = 0, - x = 4, - y = 17, - elevation = 3, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "0x0"), - NpcDef( - entityIdx = 8, - graphicsId = 0, - x = 4, - y = 6, - elevation = 3, - movementType = 1, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "0x0"), - ), - bgEvents = - listOf( - BgEventDef( - x = 6, - y = 17, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "Route110_TrickHousePuzzle7_EventScript_Scroll"), - ), - ), - // Route110_TrickHousePuzzle8 (MAP_ROUTE110_TRICK_HOUSE_PUZZLE8) - MapDef( - regionId = 1, - bankId = 79, - mapId = 10, - width = 15, - height = 22, - paletteIdx1 = 116, - paletteIdx2 = 153, - unknownShort = 448, - unknownByte = 25, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 0, - y = 21, - elevation = 2, - targetRegionId = 1, - targetBankId = 79, - targetMapId = 0, - targetX = 5, - targetY = 2, - targetElevation = 2), - WarpTile( - x = 1, - y = 21, - elevation = 2, - targetRegionId = 1, - targetBankId = 79, - targetMapId = 0, - targetX = 5, - targetY = 2, - targetElevation = 2), - WarpTile( - x = 13, - y = 1, - elevation = 0, - targetRegionId = 1, - targetBankId = 79, - targetMapId = 1, - targetX = 10, - targetY = 1, - targetElevation = 2), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 33, - x = 1, - y = 10, - elevation = 3, - movementType = 7, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 1, - script = "Route110_TrickHousePuzzle8_EventScript_Vincent"), - NpcDef( - entityIdx = 1, - graphicsId = 33, - x = 4, - y = 2, - elevation = 3, - movementType = 10, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 3, - script = "Route110_TrickHousePuzzle8_EventScript_Leroy"), - NpcDef( - entityIdx = 2, - graphicsId = 34, - x = 8, - y = 17, - elevation = 3, - movementType = 9, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 1, - facing = 2, - script = "Route110_TrickHousePuzzle8_EventScript_Keira"), - ), - bgEvents = - listOf( - BgEventDef( - x = 3, - y = 21, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "Route110_TrickHousePuzzle8_EventScript_Scroll"), - ), - ), - // Route110_SeasideCyclingRoadSouthEntrance - // (MAP_ROUTE110_SEASIDE_CYCLING_ROAD_SOUTH_ENTRANCE) - MapDef( - regionId = 1, - bankId = 79, - mapId = 11, - width = 15, - height = 6, - paletteIdx1 = 116, - paletteIdx2 = 117, - unknownShort = 433, - unknownByte = 25, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 1, - y = 5, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 25, - targetX = 16, - targetY = 88, - targetElevation = 0), - WarpTile( - x = 2, - y = 5, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 25, - targetX = 16, - targetY = 88, - targetElevation = 0), - WarpTile( - x = 12, - y = 5, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 25, - targetX = 19, - targetY = 88, - targetElevation = 0), - WarpTile( - x = 13, - y = 5, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 25, - targetX = 19, - targetY = 88, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 83, - x = 7, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "Route110_SeasideCyclingRoadSouthEntrance_EventScript_Clerk"), - ), - bgEvents = emptyList(), - ), - // Route110_SeasideCyclingRoadNorthEntrance - // (MAP_ROUTE110_SEASIDE_CYCLING_ROAD_NORTH_ENTRANCE) - MapDef( - regionId = 1, - bankId = 79, - mapId = 12, - width = 15, - height = 6, - paletteIdx1 = 116, - paletteIdx2 = 117, - unknownShort = 433, - unknownByte = 25, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 1, - y = 5, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 25, - targetX = 15, - targetY = 16, - targetElevation = 0), - WarpTile( - x = 2, - y = 5, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 25, - targetX = 15, - targetY = 16, - targetElevation = 0), - WarpTile( - x = 12, - y = 5, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 25, - targetX = 18, - targetY = 16, - targetElevation = 0), - WarpTile( - x = 13, - y = 5, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 25, - targetX = 18, - targetY = 16, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 83, - x = 7, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "Route110_SeasideCyclingRoadNorthEntrance_EventScript_Clerk"), - ), - bgEvents = emptyList(), - ), - // Route113_GlassWorkshop (MAP_ROUTE113_GLASS_WORKSHOP) - MapDef( - regionId = 1, - bankId = 80, - mapId = 0, - width = 10, - height = 9, - paletteIdx1 = 116, - paletteIdx2 = 147, - unknownShort = 399, - unknownByte = 28, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 3, - y = 8, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 28, - targetX = 33, - targetY = 5, - targetElevation = 0), - WarpTile( - x = 4, - y = 8, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 28, - targetX = 33, - targetY = 5, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 19, - x = 2, - y = 3, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "Route113_GlassWorkshop_EventScript_GlassWorker"), - NpcDef( - entityIdx = 1, - graphicsId = 5, - x = 5, - y = 4, - elevation = 3, - movementType = 2, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "Route113_GlassWorkshop_EventScript_NinjaBoy"), - ), - bgEvents = emptyList(), - ), - // Route123_BerryMastersHouse (MAP_ROUTE123_BERRY_MASTERS_HOUSE) - MapDef( - regionId = 1, - bankId = 81, - mapId = 0, - width = 11, - height = 8, - paletteIdx1 = 116, - paletteIdx2 = 147, - unknownShort = 399, - unknownByte = 38, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 3, - y = 7, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 38, - targetX = 22, - targetY = 6, - targetElevation = 0), - WarpTile( - x = 4, - y = 7, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 38, - targetX = 22, - targetY = 6, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 21, - x = 4, - y = 4, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "Route123_BerryMastersHouse_EventScript_BerryMaster"), - NpcDef( - entityIdx = 1, - graphicsId = 30, - x = 7, - y = 4, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "Route123_BerryMastersHouse_EventScript_BerryMastersWife"), - ), - bgEvents = emptyList(), - ), - // Route119_WeatherInstitute_1F (MAP_ROUTE119_WEATHER_INSTITUTE_1F) - MapDef( - regionId = 1, - bankId = 82, - mapId = 0, - width = 20, - height = 13, - paletteIdx1 = 116, - paletteIdx2 = 143, - unknownShort = 399, - unknownByte = 34, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 9, - y = 12, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 34, - targetX = 6, - targetY = 32, - targetElevation = 0), - WarpTile( - x = 10, - y = 12, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 34, - targetX = 6, - targetY = 32, - targetElevation = 0), - WarpTile( - x = 17, - y = 1, - elevation = 0, - targetRegionId = 1, - targetBankId = 82, - targetMapId = 1, - targetX = 17, - targetY = 1, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 4, - graphicsId = 5, - x = 14, - y = 11, - elevation = 3, - movementType = 2, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "Route119_WeatherInstitute_1F_EventScript_LittleBoy"), - ), - bgEvents = - listOf( - BgEventDef( - x = 1, - y = 2, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "Route119_WeatherInstitute_1F_EventScript_Bed"), - BgEventDef( - x = 1, - y = 3, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "Route119_WeatherInstitute_1F_EventScript_Bed"), - BgEventDef( - x = 0, - y = 2, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "Route119_WeatherInstitute_1F_EventScript_Bed"), - BgEventDef( - x = 0, - y = 3, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = "Route119_WeatherInstitute_1F_EventScript_Bed"), - ), - ), - // Route119_WeatherInstitute_2F (MAP_ROUTE119_WEATHER_INSTITUTE_2F) - MapDef( - regionId = 1, - bankId = 82, - mapId = 1, - width = 20, - height = 11, - paletteIdx1 = 116, - paletteIdx2 = 143, - unknownShort = 399, - unknownByte = 34, - borderTiles = - listOf( - Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0), Tile2D(0x0201, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 17, - y = 1, - elevation = 0, - targetRegionId = 1, - targetBankId = 82, - targetMapId = 0, - targetX = 17, - targetY = 1, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 4, - graphicsId = 46, - x = 18, - y = 6, - elevation = 3, - movementType = 1, - movementRangeX = 2, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "Route119_WeatherInstitute_2F_EventScript_WeatherScientist"), - ), - bgEvents = emptyList(), - ), - // Route119_House (MAP_ROUTE119_HOUSE) - MapDef( - regionId = 1, - bankId = 82, - mapId = 2, - width = 10, - height = 9, - paletteIdx1 = 116, - paletteIdx2 = 147, - unknownShort = 399, - unknownByte = 34, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 3, - y = 8, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 34, - targetX = 33, - targetY = 109, - targetElevation = 0), - WarpTile( - x = 4, - y = 8, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 34, - targetX = 33, - targetY = 109, - targetElevation = 0), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 26, - x = 7, - y = 2, - elevation = 3, - movementType = 8, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 0, - script = "Route119_House_EventScript_Woman"), - NpcDef( - entityIdx = 1, - graphicsId = 0, - x = 1, - y = 6, - elevation = 3, - movementType = 2, - movementRangeX = 2, - movementRangeY = 2, - trainerType = 0, - facing = 0, - script = "Route119_House_EventScript_Wingull"), - NpcDef( - entityIdx = 2, - graphicsId = 0, - x = 0, - y = 4, - elevation = 3, - movementType = 2, - movementRangeX = 3, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "Route119_House_EventScript_Wingull"), - NpcDef( - entityIdx = 3, - graphicsId = 0, - x = 2, - y = 2, - elevation = 3, - movementType = 2, - movementRangeX = 1, - movementRangeY = 1, - trainerType = 0, - facing = 0, - script = "Route119_House_EventScript_Wingull"), - NpcDef( - entityIdx = 4, - graphicsId = 0, - x = 8, - y = 5, - elevation = 3, - movementType = 2, - movementRangeX = 3, - movementRangeY = 2, - trainerType = 0, - facing = 0, - script = "Route119_House_EventScript_Wingull"), - NpcDef( - entityIdx = 5, - graphicsId = 0, - x = 6, - y = 6, - elevation = 3, - movementType = 2, - movementRangeX = 2, - movementRangeY = 2, - trainerType = 0, - facing = 0, - script = "Route119_House_EventScript_Wingull"), - NpcDef( - entityIdx = 6, - graphicsId = 0, - x = 5, - y = 3, - elevation = 3, - movementType = 2, - movementRangeX = 1, - movementRangeY = 3, - trainerType = 0, - facing = 0, - script = "Route119_House_EventScript_Wingull"), - ), - bgEvents = emptyList(), - ), - // Route124_DivingTreasureHuntersHouse (MAP_ROUTE124_DIVING_TREASURE_HUNTERS_HOUSE) - MapDef( - regionId = 1, - bankId = 83, - mapId = 0, - width = 10, - height = 9, - paletteIdx1 = 116, - paletteIdx2 = 147, - unknownShort = 408, - unknownByte = 39, - borderTiles = - listOf( - Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0), Tile2D(0x0001, 0)), - lighting = Lighting.REGULAR, - weather = Weather.IN_HOUSE_WEATHER, - mapType = MapType.INSIDE, - encounterType = EncounterType.RANDOM, - connections = emptyList(), - warps = - listOf( - WarpTile( - x = 3, - y = 8, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 39, - targetX = 70, - targetY = 48, - targetElevation = 2), - WarpTile( - x = 4, - y = 8, - elevation = 0, - targetRegionId = 1, - targetBankId = 50, - targetMapId = 39, - targetX = 70, - targetY = 48, - targetElevation = 2), - ), - npcs = - listOf( - NpcDef( - entityIdx = 0, - graphicsId = 66, - x = 5, - y = 4, - elevation = 3, - movementType = 9, - movementRangeX = 0, - movementRangeY = 0, - trainerType = 0, - facing = 2, - script = - "Route124_DivingTreasureHuntersHouse_EventScript_TreasureHunter"), - ), - bgEvents = - listOf( - BgEventDef( - x = 7, - y = 1, - facingDir = "BG_EVENT_PLAYER_FACING_ANY", - script = - "Route124_DivingTreasureHuntersHouse_EventScript_ShardTradeBoard"), - ), - ), - ) - allMaps.forEach { registerMap(it) } - } - - fun registerMap(map: MapDef) { - maps[key(map.regionId, map.bankId, map.mapId)] = map - } - - fun getMap(regionId: Byte, bankId: Byte, mapId: Byte): MapDef? { - return maps[key(regionId, bankId, mapId)] - } - - fun createLoadMapPacket( - map: MapDef, - reloadPlayer: Boolean = false, - deleteCache: Boolean = false, - ): LoadMapPacket { - return LoadMapPacket( - reloadPlayer = reloadPlayer, - deleteCache = deleteCache, - regionId = map.regionId.toInt(), - bankId = map.bankId.toInt(), - mapId = map.mapId.toInt(), - mapData = - MapData.GbaMapData( - width = map.width, - height = map.height, - paletteIdx1 = map.paletteIdx1, - paletteIdx2 = map.paletteIdx2, - borderWidth = map.borderWidth, - borderHeight = map.borderHeight, - unknownShort = map.unknownShort, - unknownByte = map.unknownByte, - borderTiles = map.borderTiles, - lighting = map.lighting, - weather = map.weather, - mapType = map.mapType, - encounterType = map.encounterType, - connections = map.connections, - ), - ) - } - - data class EncounterResult(val dexId: Int, val level: Int) - - fun getEncounter(map: MapDef): EncounterResult? { - val tables = map.wildEncounters - if (tables.isEmpty()) return null - val totalWeight = tables.sumOf { it.encounterRate } - if (totalWeight <= 0) return null - var roll = (0 until totalWeight).random() - for (table in tables) { - roll -= table.encounterRate - if (roll < 0) { - val pokemon = table.pokemon - val totalPokeWeight = pokemon.sumOf { it.weight } - if (totalPokeWeight <= 0) return null - var pokeRoll = (0 until totalPokeWeight).random() - for (poke in pokemon) { - pokeRoll -= poke.weight - if (pokeRoll < 0) { - val level = (poke.minLevel..poke.maxLevel).random() - return EncounterResult(poke.dexId, level) - } - } - } - } - return null - } - - private fun key(regionId: Byte, bankId: Byte, mapId: Byte) = "$regionId:$bankId:$mapId" -} diff --git a/server.game/src/main/kotlin/de/fiereu/openmmo/server/game/world/WarpExitRules.kt b/server.game/src/main/kotlin/de/fiereu/openmmo/server/game/world/WarpExitRules.kt index c017cbf..be8facd 100644 --- a/server.game/src/main/kotlin/de/fiereu/openmmo/server/game/world/WarpExitRules.kt +++ b/server.game/src/main/kotlin/de/fiereu/openmmo/server/game/world/WarpExitRules.kt @@ -2,6 +2,7 @@ package de.fiereu.openmmo.server.game.world import de.fiereu.openmmo.common.enums.Direction import de.fiereu.openmmo.common.enums.MapType +import de.fiereu.openmmo.maps.MapDef data class WarpExitOverride( val facing: Direction, @@ -19,11 +20,9 @@ object WarpExitRules { ): Direction { if (destMap == null) return Direction.DOWN - // Future proper tile-behavior support. when (destTileBehavior) { "MB_NON_ANIMATED_DOOR", "MB_ANIMATED_DOOR" -> return Direction.DOWN - "MB_NORTH_ARROW_WARP" -> return Direction.DOWN "MB_SOUTH_ARROW_WARP" -> return Direction.UP "MB_WEST_ARROW_WARP" -> return Direction.RIGHT @@ -32,27 +31,22 @@ object WarpExitRules { val sourceMapType = sourceMap?.mapType - // Temporary hardcoded special cases until tile behavior is parsed. getKnownOverride(sourceMap, destMap, destX, destY)?.let { return it.facing } - // Entering a cave/tunnel from outside. if (isUndergroundMap(destMap.mapType) && !isUndergroundMap(sourceMapType)) { return Direction.UP } - // Entering a building from outside. if (isBuildingMap(destMap.mapType) && !isBuildingMap(sourceMapType)) { return Direction.UP } - // Exiting a building to outside. if (isBuildingMap(sourceMapType) && !isBuildingMap(destMap.mapType)) { return Direction.DOWN } - // Room-to-room. if (isBuildingMap(sourceMapType) && isBuildingMap(destMap.mapType)) { return Direction.DOWN } @@ -68,7 +62,6 @@ object WarpExitRules { ): WarpExitOverride? { if (destMap == null) return null - // Rusturf Tunnel: face UP into the tunnel, no auto-step. if (destMap.bankId.toInt() == 74 && destMap.mapId.toInt() == 4) { return when { destX == 4 && destY == 10 -> WarpExitOverride(Direction.UP, autoStep = false) @@ -78,17 +71,14 @@ object WarpExitRules { } } - // Petalburg Woods: facing only, no auto-step. if (destMap.bankId.toInt() == 74 && destMap.mapId.toInt() == 11) { return when { (destX == 14 && destY == 5) || (destX == 15 && destY == 5) -> WarpExitOverride(Direction.DOWN, autoStep = false) - (destX == 16 && destY == 38) || (destX == 17 && destY == 38) || (destX == 36 && destY == 38) || (destX == 37 && destY == 38) -> WarpExitOverride(Direction.UP, autoStep = false) - else -> null } } @@ -124,10 +114,7 @@ object WarpExitRules { val enteringUnderground = destMap.mapType == MapType.UNDERGROUND && sourceMap.mapType != MapType.UNDERGROUND - // House/building exit to outside. if (sourceBuilding && !destBuilding) return true - - // Cave/tunnel entrance from outside. if (enteringUnderground) return true return false diff --git a/server.game/src/main/resources/.gitignore b/server.game/src/main/resources/.gitignore new file mode 100644 index 0000000..40d270c --- /dev/null +++ b/server.game/src/main/resources/.gitignore @@ -0,0 +1,2 @@ +game.private.pem +game.public.pem \ No newline at end of file diff --git a/server.game/src/main/resources/application.conf b/server.game/src/main/resources/application.conf index 130b091..ef532ef 100644 --- a/server.game/src/main/resources/application.conf +++ b/server.game/src/main/resources/application.conf @@ -1 +1,8 @@ -server.port = 2106 \ No newline at end of file +server { + host = "0.0.0.0" + port = 7777 + checksumSize = 2 + rootKeyResource = "game.private.pem" + sessionSecret = "dev-only-secret-do-not-use-in-production" + sessionSecret = ${?OPENMMO_SESSION_SECRET} +} diff --git a/server.game/src/main/resources/db/migration/V1__init.sql b/server.game/src/main/resources/db/migration/V1__init.sql deleted file mode 100644 index 8365e47..0000000 --- a/server.game/src/main/resources/db/migration/V1__init.sql +++ /dev/null @@ -1,75 +0,0 @@ -create extension if not exists pgcrypto; - -create table "character" ( - id bigserial not null, - user_id int not null, - name varchar(16) not null unique, - name_prefix varchar(16) not null default '', - rival_sex smallint not null default 0, - created_at timestamp not null default current_timestamp, - last_login timestamp not null default current_timestamp, - money int not null default 3000, - permissions int not null default 0, - remaining_safari_steps smallint not null default 0, - remaining_safari_balls smallint not null default 0, - pc_extra_slots smallint not null default 0, - battle_box_extra_slots smallint not null default 0, - template_amount smallint not null default 0, - position_region_id smallint not null default 0, - position_bank_id smallint not null default 1, - position_map_id smallint not null default 1, - position_x smallint not null default 100, - position_y smallint not null default 100, - repel_left smallint not null default 0, - repel_item_id smallint not null default 0, - lure_left smallint not null default 0, - lure_item_id smallint not null default 0, - primary key (id) -); - -create table pokemon ( - id bigserial not null, - character_id bigint not null, - container smallint not null default 0, - container_slot smallint not null default 0, - dex_id int not null, - seed int not null, - ot varchar(16) not null, - nickname varchar(32) not null, - level smallint not null default 1, - hp smallint not null default 10, - xp int not null default 0, - ivs int not null default 0, - ev_hp smallint not null default 0, - ev_atk smallint not null default 0, - ev_def smallint not null default 0, - ev_spatk smallint not null default 0, - ev_spdef smallint not null default 0, - ev_spd smallint not null default 0, - move1_id smallint not null default 0, - move1_pp smallint not null default 0, - move2_id smallint not null default 0, - move2_pp smallint not null default 0, - move3_id smallint not null default 0, - move3_pp smallint not null default 0, - move4_id smallint not null default 0, - move4_pp smallint not null default 0, - is_shiny boolean not null default false, - has_hidden_ability boolean not null default false, - is_alpha boolean not null default false, - is_secret boolean not null default false, - is_fateful_encounter boolean not null default false, - is_raid_encounter boolean not null default false, - caught_at timestamp not null default current_timestamp, - primary key (id), - foreign key (character_id) references "character"(id) on delete cascade -); - -create table item ( - id bigserial not null, - character_id bigint not null, - item_id int not null, - amount int not null default 1, - primary key (id), - foreign key (character_id) references "character"(id) on delete cascade -); diff --git a/server.game/src/main/resources/logback.xml b/server.game/src/main/resources/logback.xml index bc29b59..abfed40 100644 --- a/server.game/src/main/resources/logback.xml +++ b/server.game/src/main/resources/logback.xml @@ -1,11 +1,10 @@ - - - %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n - - - - - - - \ No newline at end of file + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + diff --git a/server.game/src/test/kotlin/de/fiereu/openmmo/server/game/handler/GameAppHandlerTest.kt b/server.game/src/test/kotlin/de/fiereu/openmmo/server/game/handler/GameAppHandlerTest.kt new file mode 100644 index 0000000..6d959c3 --- /dev/null +++ b/server.game/src/test/kotlin/de/fiereu/openmmo/server/game/handler/GameAppHandlerTest.kt @@ -0,0 +1,30 @@ +package de.fiereu.openmmo.server.game.handler + +import de.fiereu.openmmo.net.game.packets.ChatMessagePacket +import de.fiereu.openmmo.net.game.packets.JoinPacket +import de.fiereu.openmmo.net.game.packets.KeepAlivePacket +import de.fiereu.openmmo.net.game.packets.MovementPacket +import de.fiereu.openmmo.server.game.config.GameServerConfig +import de.fiereu.openmmo.server.game.di.DaggerGameServerComponent +import io.kotest.core.spec.style.FunSpec +import io.kotest.matchers.shouldBe + +class GameAppHandlerTest : + FunSpec({ + test("dagger graph builds and handler registers expected packet types") { + val config = + GameServerConfig( + host = "127.0.0.1", + port = 0, + checksumSize = 2, + rootKeyResource = "game.private.pem", + sessionSecret = "test-secret".toByteArray(), + ) + val component = DaggerGameServerComponent.factory().create(config) + val handler = component.handlerProvider().get() + handler.isRegistered(JoinPacket::class) shouldBe true + handler.isRegistered(MovementPacket::class) shouldBe true + handler.isRegistered(ChatMessagePacket::class) shouldBe true + handler.isRegistered(KeepAlivePacket::class) shouldBe true + } + }) diff --git a/server.login/.gitignore b/server.login/.gitignore deleted file mode 100644 index 31fce6d..0000000 --- a/server.login/.gitignore +++ /dev/null @@ -1 +0,0 @@ -src/main/resources/game.*.pem \ No newline at end of file diff --git a/server.login/Dockerfile b/server.login/Dockerfile deleted file mode 100644 index b510ee8..0000000 --- a/server.login/Dockerfile +++ /dev/null @@ -1,61 +0,0 @@ -# Multi-stage build for OpenMMO Login Server -FROM azul/zulu-openjdk:24-latest AS builder - -WORKDIR /app - -# Copy gradle files first for better caching -COPY ./gradle gradle/ -COPY ./gradlew gradlew.bat gradle.properties settings.gradle.kts gradle.env ./ -COPY ./buildSrc buildSrc/ - -# remove all includ("...") from settings.gradle.kts -RUN sed -i '/include(/d' settings.gradle.kts -# manually include only the required modules -RUN echo 'include("common")' >> settings.gradle.kts -RUN echo 'include("keys")' >> settings.gradle.kts -RUN echo 'include("protocol")' >> settings.gradle.kts -RUN echo 'include("protocol.tls")' >> settings.gradle.kts -RUN echo 'include("protocol.login")' >> settings.gradle.kts -RUN echo 'include("server")' >> settings.gradle.kts -RUN echo 'include("server.login")' >> settings.gradle.kts - -# Copy all module build files -COPY ./build.gradle.kts ./ -COPY ./common/build.gradle.kts common/ -COPY ./keys/build.gradle.kts keys/ -COPY ./protocol/build.gradle.kts protocol/ -COPY ./protocol.tls/build.gradle.kts protocol.tls/ -COPY ./protocol.login/build.gradle.kts protocol.login/ -COPY ./server/build.gradle.kts server/ -COPY ./server.login/build.gradle.kts server.login/ - -# Download dependencies -RUN ./gradlew dependencies --no-daemon - -# Copy source code -COPY ./common/src common/src/ -COPY ./protocol/src protocol/src/ -COPY ./protocol.tls/src protocol.tls/src/ -COPY ./protocol.login/src protocol.login/src/ -COPY ./server/src server/src/ -COPY ./server.login/src server.login/src/ - -# Build the application -RUN ./gradlew :server.login:distTar --no-daemon - -# Extract the distribution -RUN cd server.login/build/distributions && \ - tar -xf server.login-*.tar && \ - mv server.login-*/ server.login/ - -# Runtime stage -FROM azul/zulu-openjdk:24-jre-latest - -WORKDIR /app - -# Copy the extracted distribution from builder -COPY --from=builder /app/server.login/build/distributions/server.login/ . - -EXPOSE 2106 - -ENTRYPOINT ["./bin/server.login"] \ No newline at end of file diff --git a/server.login/README.md b/server.login/README.md deleted file mode 100644 index 4bdb542..0000000 --- a/server.login/README.md +++ /dev/null @@ -1,56 +0,0 @@ -# Server.Login Module - -The server.login module implements the login server for OpenMMO with authentication and database integration. - -## Contents - -### Main Application -- **LoginServer**: Main application entry point that configures and starts the login server on port 2106 -- **LoginProtocolHandler**: Protocol handler for processing login-specific packets - -### Configuration -- Server runs on port 2106 -- Uses ECDSA game keys for packet signing/verification -- Configured with TLS checksum size of 16 bytes (partial HMAC-SHA256) - -### Database Integration -- **PostgreSQL**: Primary database for user authentication -- **Flyway**: Database migration management -- **jOOQ**: Type-safe database queries with code generation - -### Key Features -- User authentication & management -- Integration with protocol.login for packet handling -- TLS-secured communication -- Docker support with dedicated Dockerfile - -### Configuration Files -- **application.conf**: HOCON configuration for server settings -- **logback.xml**: Logging configuration -- **db.migrations**: SQL scripts for schema management - -### Docker Support -The module includes a Dockerfile for containerized deployment: -- Multi-stage build using Zulu OpenJDK 24 -- Exposes port 2106 -- Includes all necessary dependencies and keys - -## Dependencies -- Server module for core framework -- Protocol.login module for authentication packets -- PostgreSQL driver for database connectivity -- jOOQ for database operations -- Flyway for schema management -- Logback for logging -- Kotlinx.coroutines for async processing - -## Environment Variables -The application requires database configuration through environment variables: -- Database connection settings (host, port, name, user, password) -- Configured via gradle.properties or environment - -## Development -- Run with: `./gradlew :server.login:run` -- Database setup: `./gradlew cleanMigrateAndGenerate` -- Code generation: `./gradlew jooqCodegen` -- Docker build: `docker build -t openmmo-login server.login/` diff --git a/server.login/build.gradle.kts b/server.login/build.gradle.kts index 98f4ef5..fa52cd6 100644 --- a/server.login/build.gradle.kts +++ b/server.login/build.gradle.kts @@ -1,131 +1,35 @@ -import org.flywaydb.gradle.task.AbstractFlywayTask - -buildscript { dependencies { classpath(libs.flyway.postgresql) } } - plugins { application - distribution id("buildsrc.convention.kotlin-jvm") id("buildsrc.convention.spotless") + id("buildsrc.convention.sonarlint") id("buildsrc.common.keys") - alias(libs.plugins.kotlin.serialization) - alias(libs.plugins.jooq) - alias(libs.plugins.flyway) + alias(libs.plugins.ksp) } group = "de.fiereu.openmmo" version = "0.1.0" +application { mainClass.set("de.fiereu.openmmo.server.login.MainKt") } + dependencies { - implementation(project(":server")) - implementation(project(":protocol.login")) - implementation(libs.logback) + api(project(":network")) + api(project(":protocols.login")) + api(project(":common")) + + implementation(libs.dagger) + ksp(libs.dagger.compiler) + + implementation(libs.typesafe.config) implementation(libs.kotlinx.coroutines) - - runtimeOnly(libs.postgresql) - - implementation(libs.bundles.jooq) - jooqCodegen(libs.postgresql) - - implementation(libs.flyway.core) - implementation(libs.flyway.postgresql) + implementation(libs.kotlin.logging) + implementation(libs.logback) testImplementation(libs.bundles.kotest) testImplementation(libs.kotlinx.coroutines.test) - testImplementation(libs.mockk) } -application { mainClass.set("de.fiereu.openmmo.server.login.LoginServerKt") } - -fun env(key: String): Any { - val value = - property(key) - ?: System.getenv(key) - ?: throw IllegalArgumentException( - "Environment variable or system property '$key' is not set.") - fun interpolate(value: String): Any { - val PATTERN_WORD = Regex("\\$([a-zA-Z0-9_]+)") - val PATTERN_MULTI = Regex("\\$\\{([a-zA-Z0-9_]+)\\}") - return (PATTERN_WORD.findAll(value) + PATTERN_MULTI.findAll(value)).distinct().fold(value) { - acc, - match -> - val envName = match.groupValues[1] - val envValue = System.getProperty(envName) ?: System.getProperty(envName) - if (envValue == null) { - throw IllegalArgumentException( - "Environment variable or system property '$envName' is not set.") - } - acc.replace(match.value, envValue) - } - } - return if (value is String && (value.contains('$') || value.contains('{'))) { - interpolate(value) - } else value +listOf("classes", "processResources").forEach { taskName -> + tasks.named(taskName) { dependsOn("copyPublicKeyGame", "copyPrivateKeyGame") } } - -val dbPort = env("openmmo.db.login.port") as String -val dbName = env("openmmo.db.login.name") as String -val dbUser = env("openmmo.db.login.user") as String -val dbPassword = env("openmmo.db.login.password") as String - -jooq { - configuration { - jdbc { - driver = "org.postgresql.Driver" - url = "jdbc:postgresql://localhost:$dbPort/$dbName" - user = dbUser - password = dbPassword - } - generator { - database { - name = "org.jooq.meta.postgres.PostgresDatabase" - includes = ".*" - excludes = - """ - flyway_schema_history | - pgp_armor_headers - """ - inputSchema = "public" - } - - generate { name = "org.jooq.codegen.KotlinGenerator" } - target { - packageName = "de.fiereu.openmmo.server.login.jooq" - directory = "src/main/jooq" - } - } - } -} - -flyway { - driver = "org.postgresql.Driver" - url = "jdbc:postgresql://localhost:$dbPort/$dbName" - user = dbUser - password = dbPassword - schemas = arrayOf("public") - locations = arrayOf("filesystem:src/main/resources/db/migration") - cleanDisabled = false -} - -// Fuck this shit uhh we are not gonna update our gradle plugin bc all our enterprise customers are -// stuck on Java 1.6 and gradle 5 anyway -tasks.withType().configureEach { - notCompatibleWithConfigurationCache("https://github.com/flyway/flyway/issues/3550") -} - -tasks.register("cleanMigrateAndGenerate") { - group = "openmmo" - description = "Cleans the database, migrates it and generates the jOOQ classes." - dependsOn("flywayClean", "flywayMigrate", "jooqCodegen") -} - -spotless { kotlin { targetExclude("src/main/jooq/**") } } - -// If someone knows a better way then this please please please help me :( -listOf("classes", "processResources", "spotlessKotlin", "spotlessKotlinGradle", "spotlessMisc") - .forEach { taskName -> - tasks.named(taskName) { - listOf("copyPublicKeyGame", "copyPrivateKeyGame").forEach { dependsOn(it) } - } - } diff --git a/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/DefaultCatalog.kt b/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/DefaultCatalog.kt deleted file mode 100644 index c278926..0000000 --- a/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/DefaultCatalog.kt +++ /dev/null @@ -1,43 +0,0 @@ -/* - * This file is generated by jOOQ. - */ -package de.fiereu.openmmo.server.login.jooq - - -import kotlin.collections.List - -import org.jooq.Constants -import org.jooq.Schema -import org.jooq.impl.CatalogImpl - - -/** - * This class is generated by jOOQ. - */ -@Suppress("warnings") -open class DefaultCatalog : CatalogImpl("") { - companion object { - - /** - * The reference instance of DEFAULT_CATALOG - */ - val DEFAULT_CATALOG: DefaultCatalog = DefaultCatalog() - } - - /** - * standard public schema - */ - val PUBLIC: Public get(): Public = Public.PUBLIC - - override fun getSchemas(): List = listOf( - Public.PUBLIC - ) - - /** - * A reference to the 3.20 minor release of the code generator. If this - * doesn't compile, it's because the runtime library uses an older minor - * release, namely: 3.20. You can turn off the generation of this reference - * by specifying /configuration/generator/generate/jooqVersionReference - */ - private val REQUIRE_RUNTIME_JOOQ_VERSION = Constants.VERSION_3_20 -} diff --git a/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/Public.kt b/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/Public.kt deleted file mode 100644 index fd1dc83..0000000 --- a/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/Public.kt +++ /dev/null @@ -1,40 +0,0 @@ -/* - * This file is generated by jOOQ. - */ -package de.fiereu.openmmo.server.login.jooq - - -import de.fiereu.openmmo.server.login.jooq.tables.User - -import kotlin.collections.List - -import org.jooq.Catalog -import org.jooq.Table -import org.jooq.impl.DSL -import org.jooq.impl.SchemaImpl - - -/** - * standard public schema - */ -@Suppress("warnings") -open class Public : SchemaImpl(DSL.name("public"), DefaultCatalog.DEFAULT_CATALOG, DSL.comment("standard public schema")) { - companion object { - - /** - * The reference instance of public - */ - val PUBLIC: Public = Public() - } - - /** - * The table public.user. - */ - val USER: User get() = User.USER - - override fun getCatalog(): Catalog = DefaultCatalog.DEFAULT_CATALOG - - override fun getTables(): List> = listOf( - User.USER - ) -} diff --git a/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/keys/Keys.kt b/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/keys/Keys.kt deleted file mode 100644 index 525a3c2..0000000 --- a/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/keys/Keys.kt +++ /dev/null @@ -1,22 +0,0 @@ -@file:Suppress("warnings") -/* - * This file is generated by jOOQ. - */ -package de.fiereu.openmmo.server.login.jooq.keys - - -import de.fiereu.openmmo.server.login.jooq.tables.User -import de.fiereu.openmmo.server.login.jooq.tables.records.UserRecord - -import org.jooq.UniqueKey -import org.jooq.impl.DSL -import org.jooq.impl.Internal - - - -// ------------------------------------------------------------------------- -// UNIQUE and PRIMARY KEY definitions -// ------------------------------------------------------------------------- - -val USER_PKEY: UniqueKey = Internal.createUniqueKey(User.USER, DSL.name("user_pkey"), arrayOf(User.USER.ID), true) -val USER_USERNAME_KEY: UniqueKey = Internal.createUniqueKey(User.USER, DSL.name("user_username_key"), arrayOf(User.USER.USERNAME), true) diff --git a/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/Armor1.kt b/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/Armor1.kt deleted file mode 100644 index de877ab..0000000 --- a/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/Armor1.kt +++ /dev/null @@ -1,53 +0,0 @@ -/* - * This file is generated by jOOQ. - */ -package de.fiereu.openmmo.server.login.jooq.routines - - -import de.fiereu.openmmo.server.login.jooq.Public - -import org.jooq.Field -import org.jooq.Parameter -import org.jooq.impl.AbstractRoutine -import org.jooq.impl.DSL -import org.jooq.impl.Internal -import org.jooq.impl.SQLDataType - - -/** - * This class is generated by jOOQ. - */ -@Suppress("warnings") -open class Armor1 : AbstractRoutine("armor", Public.PUBLIC, DSL.comment(""), SQLDataType.CLOB) { - companion object { - - /** - * The parameter public.armor.RETURN_VALUE. - */ - val RETURN_VALUE: Parameter = Internal.createParameter("RETURN_VALUE", SQLDataType.CLOB, false, false) - - /** - * The parameter public.armor._1. - */ - val _1: Parameter = Internal.createParameter("_1", SQLDataType.BLOB, false, true) - } - - init { - returnParameter = Armor1.RETURN_VALUE - addInParameter(Armor1._1) - setOverloaded(true) - } - - /** - * Set the _1 parameter IN value to the routine - */ - fun set__1(value: ByteArray?): Unit = setValue(Armor1._1, value) - - /** - * Set the _1 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - fun set__1(field: Field): Unit { - setField(Armor1._1, field) - } -} diff --git a/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/Armor2.kt b/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/Armor2.kt deleted file mode 100644 index 24ff94b..0000000 --- a/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/Armor2.kt +++ /dev/null @@ -1,91 +0,0 @@ -/* - * This file is generated by jOOQ. - */ -package de.fiereu.openmmo.server.login.jooq.routines - - -import de.fiereu.openmmo.server.login.jooq.Public - -import org.jooq.Field -import org.jooq.Parameter -import org.jooq.impl.AbstractRoutine -import org.jooq.impl.DSL -import org.jooq.impl.Internal -import org.jooq.impl.SQLDataType - - -/** - * This class is generated by jOOQ. - */ -@Suppress("warnings") -open class Armor2 : AbstractRoutine("armor", Public.PUBLIC, DSL.comment(""), SQLDataType.CLOB) { - companion object { - - /** - * The parameter public.armor.RETURN_VALUE. - */ - val RETURN_VALUE: Parameter = Internal.createParameter("RETURN_VALUE", SQLDataType.CLOB, false, false) - - /** - * The parameter public.armor._1. - */ - val _1: Parameter = Internal.createParameter("_1", SQLDataType.BLOB, false, true) - - /** - * The parameter public.armor._2. - */ - val _2: Parameter?> = Internal.createParameter("_2", SQLDataType.CLOB.array(), false, true) - - /** - * The parameter public.armor._3. - */ - val _3: Parameter?> = Internal.createParameter("_3", SQLDataType.CLOB.array(), false, true) - } - - init { - returnParameter = Armor2.RETURN_VALUE - addInParameter(Armor2._1) - addInParameter(Armor2._2) - addInParameter(Armor2._3) - setOverloaded(true) - } - - /** - * Set the _1 parameter IN value to the routine - */ - fun set__1(value: ByteArray?): Unit = setValue(Armor2._1, value) - - /** - * Set the _1 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - fun set__1(field: Field): Unit { - setField(Armor2._1, field) - } - - /** - * Set the _2 parameter IN value to the routine - */ - fun set__2(value: Array?): Unit = setValue(Armor2._2, value) - - /** - * Set the _2 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - fun set__2(field: Field?>): Unit { - setField(Armor2._2, field) - } - - /** - * Set the _3 parameter IN value to the routine - */ - fun set__3(value: Array?): Unit = setValue(Armor2._3, value) - - /** - * Set the _3 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - fun set__3(field: Field?>): Unit { - setField(Armor2._3, field) - } -} diff --git a/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/Crypt.kt b/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/Crypt.kt deleted file mode 100644 index 1e91680..0000000 --- a/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/Crypt.kt +++ /dev/null @@ -1,71 +0,0 @@ -/* - * This file is generated by jOOQ. - */ -package de.fiereu.openmmo.server.login.jooq.routines - - -import de.fiereu.openmmo.server.login.jooq.Public - -import org.jooq.Field -import org.jooq.Parameter -import org.jooq.impl.AbstractRoutine -import org.jooq.impl.DSL -import org.jooq.impl.Internal -import org.jooq.impl.SQLDataType - - -/** - * This class is generated by jOOQ. - */ -@Suppress("warnings") -open class Crypt : AbstractRoutine("crypt", Public.PUBLIC, DSL.comment(""), SQLDataType.CLOB) { - companion object { - - /** - * The parameter public.crypt.RETURN_VALUE. - */ - val RETURN_VALUE: Parameter = Internal.createParameter("RETURN_VALUE", SQLDataType.CLOB, false, false) - - /** - * The parameter public.crypt._1. - */ - val _1: Parameter = Internal.createParameter("_1", SQLDataType.CLOB, false, true) - - /** - * The parameter public.crypt._2. - */ - val _2: Parameter = Internal.createParameter("_2", SQLDataType.CLOB, false, true) - } - - init { - returnParameter = Crypt.RETURN_VALUE - addInParameter(Crypt._1) - addInParameter(Crypt._2) - } - - /** - * Set the _1 parameter IN value to the routine - */ - fun set__1(value: String?): Unit = setValue(Crypt._1, value) - - /** - * Set the _1 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - fun set__1(field: Field): Unit { - setField(Crypt._1, field) - } - - /** - * Set the _2 parameter IN value to the routine - */ - fun set__2(value: String?): Unit = setValue(Crypt._2, value) - - /** - * Set the _2 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - fun set__2(field: Field): Unit { - setField(Crypt._2, field) - } -} diff --git a/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/Dearmor.kt b/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/Dearmor.kt deleted file mode 100644 index 55fd4fc..0000000 --- a/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/Dearmor.kt +++ /dev/null @@ -1,52 +0,0 @@ -/* - * This file is generated by jOOQ. - */ -package de.fiereu.openmmo.server.login.jooq.routines - - -import de.fiereu.openmmo.server.login.jooq.Public - -import org.jooq.Field -import org.jooq.Parameter -import org.jooq.impl.AbstractRoutine -import org.jooq.impl.DSL -import org.jooq.impl.Internal -import org.jooq.impl.SQLDataType - - -/** - * This class is generated by jOOQ. - */ -@Suppress("warnings") -open class Dearmor : AbstractRoutine("dearmor", Public.PUBLIC, DSL.comment(""), SQLDataType.BLOB) { - companion object { - - /** - * The parameter public.dearmor.RETURN_VALUE. - */ - val RETURN_VALUE: Parameter = Internal.createParameter("RETURN_VALUE", SQLDataType.BLOB, false, false) - - /** - * The parameter public.dearmor._1. - */ - val _1: Parameter = Internal.createParameter("_1", SQLDataType.CLOB, false, true) - } - - init { - returnParameter = Dearmor.RETURN_VALUE - addInParameter(Dearmor._1) - } - - /** - * Set the _1 parameter IN value to the routine - */ - fun set__1(value: String?): Unit = setValue(Dearmor._1, value) - - /** - * Set the _1 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - fun set__1(field: Field): Unit { - setField(Dearmor._1, field) - } -} diff --git a/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/Decrypt.kt b/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/Decrypt.kt deleted file mode 100644 index 380b51a..0000000 --- a/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/Decrypt.kt +++ /dev/null @@ -1,90 +0,0 @@ -/* - * This file is generated by jOOQ. - */ -package de.fiereu.openmmo.server.login.jooq.routines - - -import de.fiereu.openmmo.server.login.jooq.Public - -import org.jooq.Field -import org.jooq.Parameter -import org.jooq.impl.AbstractRoutine -import org.jooq.impl.DSL -import org.jooq.impl.Internal -import org.jooq.impl.SQLDataType - - -/** - * This class is generated by jOOQ. - */ -@Suppress("warnings") -open class Decrypt : AbstractRoutine("decrypt", Public.PUBLIC, DSL.comment(""), SQLDataType.BLOB) { - companion object { - - /** - * The parameter public.decrypt.RETURN_VALUE. - */ - val RETURN_VALUE: Parameter = Internal.createParameter("RETURN_VALUE", SQLDataType.BLOB, false, false) - - /** - * The parameter public.decrypt._1. - */ - val _1: Parameter = Internal.createParameter("_1", SQLDataType.BLOB, false, true) - - /** - * The parameter public.decrypt._2. - */ - val _2: Parameter = Internal.createParameter("_2", SQLDataType.BLOB, false, true) - - /** - * The parameter public.decrypt._3. - */ - val _3: Parameter = Internal.createParameter("_3", SQLDataType.CLOB, false, true) - } - - init { - returnParameter = Decrypt.RETURN_VALUE - addInParameter(Decrypt._1) - addInParameter(Decrypt._2) - addInParameter(Decrypt._3) - } - - /** - * Set the _1 parameter IN value to the routine - */ - fun set__1(value: ByteArray?): Unit = setValue(Decrypt._1, value) - - /** - * Set the _1 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - fun set__1(field: Field): Unit { - setField(Decrypt._1, field) - } - - /** - * Set the _2 parameter IN value to the routine - */ - fun set__2(value: ByteArray?): Unit = setValue(Decrypt._2, value) - - /** - * Set the _2 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - fun set__2(field: Field): Unit { - setField(Decrypt._2, field) - } - - /** - * Set the _3 parameter IN value to the routine - */ - fun set__3(value: String?): Unit = setValue(Decrypt._3, value) - - /** - * Set the _3 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - fun set__3(field: Field): Unit { - setField(Decrypt._3, field) - } -} diff --git a/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/DecryptIv.kt b/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/DecryptIv.kt deleted file mode 100644 index f884146..0000000 --- a/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/DecryptIv.kt +++ /dev/null @@ -1,109 +0,0 @@ -/* - * This file is generated by jOOQ. - */ -package de.fiereu.openmmo.server.login.jooq.routines - - -import de.fiereu.openmmo.server.login.jooq.Public - -import org.jooq.Field -import org.jooq.Parameter -import org.jooq.impl.AbstractRoutine -import org.jooq.impl.DSL -import org.jooq.impl.Internal -import org.jooq.impl.SQLDataType - - -/** - * This class is generated by jOOQ. - */ -@Suppress("warnings") -open class DecryptIv : AbstractRoutine("decrypt_iv", Public.PUBLIC, DSL.comment(""), SQLDataType.BLOB) { - companion object { - - /** - * The parameter public.decrypt_iv.RETURN_VALUE. - */ - val RETURN_VALUE: Parameter = Internal.createParameter("RETURN_VALUE", SQLDataType.BLOB, false, false) - - /** - * The parameter public.decrypt_iv._1. - */ - val _1: Parameter = Internal.createParameter("_1", SQLDataType.BLOB, false, true) - - /** - * The parameter public.decrypt_iv._2. - */ - val _2: Parameter = Internal.createParameter("_2", SQLDataType.BLOB, false, true) - - /** - * The parameter public.decrypt_iv._3. - */ - val _3: Parameter = Internal.createParameter("_3", SQLDataType.BLOB, false, true) - - /** - * The parameter public.decrypt_iv._4. - */ - val _4: Parameter = Internal.createParameter("_4", SQLDataType.CLOB, false, true) - } - - init { - returnParameter = DecryptIv.RETURN_VALUE - addInParameter(DecryptIv._1) - addInParameter(DecryptIv._2) - addInParameter(DecryptIv._3) - addInParameter(DecryptIv._4) - } - - /** - * Set the _1 parameter IN value to the routine - */ - fun set__1(value: ByteArray?): Unit = setValue(DecryptIv._1, value) - - /** - * Set the _1 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - fun set__1(field: Field): Unit { - setField(DecryptIv._1, field) - } - - /** - * Set the _2 parameter IN value to the routine - */ - fun set__2(value: ByteArray?): Unit = setValue(DecryptIv._2, value) - - /** - * Set the _2 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - fun set__2(field: Field): Unit { - setField(DecryptIv._2, field) - } - - /** - * Set the _3 parameter IN value to the routine - */ - fun set__3(value: ByteArray?): Unit = setValue(DecryptIv._3, value) - - /** - * Set the _3 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - fun set__3(field: Field): Unit { - setField(DecryptIv._3, field) - } - - /** - * Set the _4 parameter IN value to the routine - */ - fun set__4(value: String?): Unit = setValue(DecryptIv._4, value) - - /** - * Set the _4 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - fun set__4(field: Field): Unit { - setField(DecryptIv._4, field) - } -} diff --git a/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/Digest1.kt b/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/Digest1.kt deleted file mode 100644 index 0230a94..0000000 --- a/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/Digest1.kt +++ /dev/null @@ -1,72 +0,0 @@ -/* - * This file is generated by jOOQ. - */ -package de.fiereu.openmmo.server.login.jooq.routines - - -import de.fiereu.openmmo.server.login.jooq.Public - -import org.jooq.Field -import org.jooq.Parameter -import org.jooq.impl.AbstractRoutine -import org.jooq.impl.DSL -import org.jooq.impl.Internal -import org.jooq.impl.SQLDataType - - -/** - * This class is generated by jOOQ. - */ -@Suppress("warnings") -open class Digest1 : AbstractRoutine("digest", Public.PUBLIC, DSL.comment(""), SQLDataType.BLOB) { - companion object { - - /** - * The parameter public.digest.RETURN_VALUE. - */ - val RETURN_VALUE: Parameter = Internal.createParameter("RETURN_VALUE", SQLDataType.BLOB, false, false) - - /** - * The parameter public.digest._1. - */ - val _1: Parameter = Internal.createParameter("_1", SQLDataType.CLOB, false, true) - - /** - * The parameter public.digest._2. - */ - val _2: Parameter = Internal.createParameter("_2", SQLDataType.CLOB, false, true) - } - - init { - returnParameter = Digest1.RETURN_VALUE - addInParameter(Digest1._1) - addInParameter(Digest1._2) - setOverloaded(true) - } - - /** - * Set the _1 parameter IN value to the routine - */ - fun set__1(value: String?): Unit = setValue(Digest1._1, value) - - /** - * Set the _1 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - fun set__1(field: Field): Unit { - setField(Digest1._1, field) - } - - /** - * Set the _2 parameter IN value to the routine - */ - fun set__2(value: String?): Unit = setValue(Digest1._2, value) - - /** - * Set the _2 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - fun set__2(field: Field): Unit { - setField(Digest1._2, field) - } -} diff --git a/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/Digest2.kt b/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/Digest2.kt deleted file mode 100644 index 1bb0acd..0000000 --- a/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/Digest2.kt +++ /dev/null @@ -1,72 +0,0 @@ -/* - * This file is generated by jOOQ. - */ -package de.fiereu.openmmo.server.login.jooq.routines - - -import de.fiereu.openmmo.server.login.jooq.Public - -import org.jooq.Field -import org.jooq.Parameter -import org.jooq.impl.AbstractRoutine -import org.jooq.impl.DSL -import org.jooq.impl.Internal -import org.jooq.impl.SQLDataType - - -/** - * This class is generated by jOOQ. - */ -@Suppress("warnings") -open class Digest2 : AbstractRoutine("digest", Public.PUBLIC, DSL.comment(""), SQLDataType.BLOB) { - companion object { - - /** - * The parameter public.digest.RETURN_VALUE. - */ - val RETURN_VALUE: Parameter = Internal.createParameter("RETURN_VALUE", SQLDataType.BLOB, false, false) - - /** - * The parameter public.digest._1. - */ - val _1: Parameter = Internal.createParameter("_1", SQLDataType.BLOB, false, true) - - /** - * The parameter public.digest._2. - */ - val _2: Parameter = Internal.createParameter("_2", SQLDataType.CLOB, false, true) - } - - init { - returnParameter = Digest2.RETURN_VALUE - addInParameter(Digest2._1) - addInParameter(Digest2._2) - setOverloaded(true) - } - - /** - * Set the _1 parameter IN value to the routine - */ - fun set__1(value: ByteArray?): Unit = setValue(Digest2._1, value) - - /** - * Set the _1 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - fun set__1(field: Field): Unit { - setField(Digest2._1, field) - } - - /** - * Set the _2 parameter IN value to the routine - */ - fun set__2(value: String?): Unit = setValue(Digest2._2, value) - - /** - * Set the _2 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - fun set__2(field: Field): Unit { - setField(Digest2._2, field) - } -} diff --git a/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/Encrypt.kt b/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/Encrypt.kt deleted file mode 100644 index 7e69735..0000000 --- a/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/Encrypt.kt +++ /dev/null @@ -1,90 +0,0 @@ -/* - * This file is generated by jOOQ. - */ -package de.fiereu.openmmo.server.login.jooq.routines - - -import de.fiereu.openmmo.server.login.jooq.Public - -import org.jooq.Field -import org.jooq.Parameter -import org.jooq.impl.AbstractRoutine -import org.jooq.impl.DSL -import org.jooq.impl.Internal -import org.jooq.impl.SQLDataType - - -/** - * This class is generated by jOOQ. - */ -@Suppress("warnings") -open class Encrypt : AbstractRoutine("encrypt", Public.PUBLIC, DSL.comment(""), SQLDataType.BLOB) { - companion object { - - /** - * The parameter public.encrypt.RETURN_VALUE. - */ - val RETURN_VALUE: Parameter = Internal.createParameter("RETURN_VALUE", SQLDataType.BLOB, false, false) - - /** - * The parameter public.encrypt._1. - */ - val _1: Parameter = Internal.createParameter("_1", SQLDataType.BLOB, false, true) - - /** - * The parameter public.encrypt._2. - */ - val _2: Parameter = Internal.createParameter("_2", SQLDataType.BLOB, false, true) - - /** - * The parameter public.encrypt._3. - */ - val _3: Parameter = Internal.createParameter("_3", SQLDataType.CLOB, false, true) - } - - init { - returnParameter = Encrypt.RETURN_VALUE - addInParameter(Encrypt._1) - addInParameter(Encrypt._2) - addInParameter(Encrypt._3) - } - - /** - * Set the _1 parameter IN value to the routine - */ - fun set__1(value: ByteArray?): Unit = setValue(Encrypt._1, value) - - /** - * Set the _1 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - fun set__1(field: Field): Unit { - setField(Encrypt._1, field) - } - - /** - * Set the _2 parameter IN value to the routine - */ - fun set__2(value: ByteArray?): Unit = setValue(Encrypt._2, value) - - /** - * Set the _2 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - fun set__2(field: Field): Unit { - setField(Encrypt._2, field) - } - - /** - * Set the _3 parameter IN value to the routine - */ - fun set__3(value: String?): Unit = setValue(Encrypt._3, value) - - /** - * Set the _3 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - fun set__3(field: Field): Unit { - setField(Encrypt._3, field) - } -} diff --git a/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/EncryptIv.kt b/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/EncryptIv.kt deleted file mode 100644 index de16476..0000000 --- a/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/EncryptIv.kt +++ /dev/null @@ -1,109 +0,0 @@ -/* - * This file is generated by jOOQ. - */ -package de.fiereu.openmmo.server.login.jooq.routines - - -import de.fiereu.openmmo.server.login.jooq.Public - -import org.jooq.Field -import org.jooq.Parameter -import org.jooq.impl.AbstractRoutine -import org.jooq.impl.DSL -import org.jooq.impl.Internal -import org.jooq.impl.SQLDataType - - -/** - * This class is generated by jOOQ. - */ -@Suppress("warnings") -open class EncryptIv : AbstractRoutine("encrypt_iv", Public.PUBLIC, DSL.comment(""), SQLDataType.BLOB) { - companion object { - - /** - * The parameter public.encrypt_iv.RETURN_VALUE. - */ - val RETURN_VALUE: Parameter = Internal.createParameter("RETURN_VALUE", SQLDataType.BLOB, false, false) - - /** - * The parameter public.encrypt_iv._1. - */ - val _1: Parameter = Internal.createParameter("_1", SQLDataType.BLOB, false, true) - - /** - * The parameter public.encrypt_iv._2. - */ - val _2: Parameter = Internal.createParameter("_2", SQLDataType.BLOB, false, true) - - /** - * The parameter public.encrypt_iv._3. - */ - val _3: Parameter = Internal.createParameter("_3", SQLDataType.BLOB, false, true) - - /** - * The parameter public.encrypt_iv._4. - */ - val _4: Parameter = Internal.createParameter("_4", SQLDataType.CLOB, false, true) - } - - init { - returnParameter = EncryptIv.RETURN_VALUE - addInParameter(EncryptIv._1) - addInParameter(EncryptIv._2) - addInParameter(EncryptIv._3) - addInParameter(EncryptIv._4) - } - - /** - * Set the _1 parameter IN value to the routine - */ - fun set__1(value: ByteArray?): Unit = setValue(EncryptIv._1, value) - - /** - * Set the _1 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - fun set__1(field: Field): Unit { - setField(EncryptIv._1, field) - } - - /** - * Set the _2 parameter IN value to the routine - */ - fun set__2(value: ByteArray?): Unit = setValue(EncryptIv._2, value) - - /** - * Set the _2 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - fun set__2(field: Field): Unit { - setField(EncryptIv._2, field) - } - - /** - * Set the _3 parameter IN value to the routine - */ - fun set__3(value: ByteArray?): Unit = setValue(EncryptIv._3, value) - - /** - * Set the _3 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - fun set__3(field: Field): Unit { - setField(EncryptIv._3, field) - } - - /** - * Set the _4 parameter IN value to the routine - */ - fun set__4(value: String?): Unit = setValue(EncryptIv._4, value) - - /** - * Set the _4 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - fun set__4(field: Field): Unit { - setField(EncryptIv._4, field) - } -} diff --git a/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/GenRandomBytes.kt b/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/GenRandomBytes.kt deleted file mode 100644 index c0292b4..0000000 --- a/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/GenRandomBytes.kt +++ /dev/null @@ -1,52 +0,0 @@ -/* - * This file is generated by jOOQ. - */ -package de.fiereu.openmmo.server.login.jooq.routines - - -import de.fiereu.openmmo.server.login.jooq.Public - -import org.jooq.Field -import org.jooq.Parameter -import org.jooq.impl.AbstractRoutine -import org.jooq.impl.DSL -import org.jooq.impl.Internal -import org.jooq.impl.SQLDataType - - -/** - * This class is generated by jOOQ. - */ -@Suppress("warnings") -open class GenRandomBytes : AbstractRoutine("gen_random_bytes", Public.PUBLIC, DSL.comment(""), SQLDataType.BLOB) { - companion object { - - /** - * The parameter public.gen_random_bytes.RETURN_VALUE. - */ - val RETURN_VALUE: Parameter = Internal.createParameter("RETURN_VALUE", SQLDataType.BLOB, false, false) - - /** - * The parameter public.gen_random_bytes._1. - */ - val _1: Parameter = Internal.createParameter("_1", SQLDataType.INTEGER, false, true) - } - - init { - returnParameter = GenRandomBytes.RETURN_VALUE - addInParameter(GenRandomBytes._1) - } - - /** - * Set the _1 parameter IN value to the routine - */ - fun set__1(value: Int?): Unit = setValue(GenRandomBytes._1, value) - - /** - * Set the _1 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - fun set__1(field: Field): Unit { - setField(GenRandomBytes._1, field) - } -} diff --git a/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/GenRandomUuid.kt b/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/GenRandomUuid.kt deleted file mode 100644 index 93c72bb..0000000 --- a/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/GenRandomUuid.kt +++ /dev/null @@ -1,34 +0,0 @@ -/* - * This file is generated by jOOQ. - */ -package de.fiereu.openmmo.server.login.jooq.routines - - -import de.fiereu.openmmo.server.login.jooq.Public - -import java.util.UUID - -import org.jooq.Parameter -import org.jooq.impl.AbstractRoutine -import org.jooq.impl.DSL -import org.jooq.impl.Internal -import org.jooq.impl.SQLDataType - - -/** - * This class is generated by jOOQ. - */ -@Suppress("warnings") -open class GenRandomUuid : AbstractRoutine("gen_random_uuid", Public.PUBLIC, DSL.comment(""), SQLDataType.UUID) { - companion object { - - /** - * The parameter public.gen_random_uuid.RETURN_VALUE. - */ - val RETURN_VALUE: Parameter = Internal.createParameter("RETURN_VALUE", SQLDataType.UUID, false, false) - } - - init { - returnParameter = GenRandomUuid.RETURN_VALUE - } -} diff --git a/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/GenSalt1.kt b/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/GenSalt1.kt deleted file mode 100644 index bd52f73..0000000 --- a/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/GenSalt1.kt +++ /dev/null @@ -1,53 +0,0 @@ -/* - * This file is generated by jOOQ. - */ -package de.fiereu.openmmo.server.login.jooq.routines - - -import de.fiereu.openmmo.server.login.jooq.Public - -import org.jooq.Field -import org.jooq.Parameter -import org.jooq.impl.AbstractRoutine -import org.jooq.impl.DSL -import org.jooq.impl.Internal -import org.jooq.impl.SQLDataType - - -/** - * This class is generated by jOOQ. - */ -@Suppress("warnings") -open class GenSalt1 : AbstractRoutine("gen_salt", Public.PUBLIC, DSL.comment(""), SQLDataType.CLOB) { - companion object { - - /** - * The parameter public.gen_salt.RETURN_VALUE. - */ - val RETURN_VALUE: Parameter = Internal.createParameter("RETURN_VALUE", SQLDataType.CLOB, false, false) - - /** - * The parameter public.gen_salt._1. - */ - val _1: Parameter = Internal.createParameter("_1", SQLDataType.CLOB, false, true) - } - - init { - returnParameter = GenSalt1.RETURN_VALUE - addInParameter(GenSalt1._1) - setOverloaded(true) - } - - /** - * Set the _1 parameter IN value to the routine - */ - fun set__1(value: String?): Unit = setValue(GenSalt1._1, value) - - /** - * Set the _1 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - fun set__1(field: Field): Unit { - setField(GenSalt1._1, field) - } -} diff --git a/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/GenSalt2.kt b/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/GenSalt2.kt deleted file mode 100644 index 6215ae5..0000000 --- a/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/GenSalt2.kt +++ /dev/null @@ -1,72 +0,0 @@ -/* - * This file is generated by jOOQ. - */ -package de.fiereu.openmmo.server.login.jooq.routines - - -import de.fiereu.openmmo.server.login.jooq.Public - -import org.jooq.Field -import org.jooq.Parameter -import org.jooq.impl.AbstractRoutine -import org.jooq.impl.DSL -import org.jooq.impl.Internal -import org.jooq.impl.SQLDataType - - -/** - * This class is generated by jOOQ. - */ -@Suppress("warnings") -open class GenSalt2 : AbstractRoutine("gen_salt", Public.PUBLIC, DSL.comment(""), SQLDataType.CLOB) { - companion object { - - /** - * The parameter public.gen_salt.RETURN_VALUE. - */ - val RETURN_VALUE: Parameter = Internal.createParameter("RETURN_VALUE", SQLDataType.CLOB, false, false) - - /** - * The parameter public.gen_salt._1. - */ - val _1: Parameter = Internal.createParameter("_1", SQLDataType.CLOB, false, true) - - /** - * The parameter public.gen_salt._2. - */ - val _2: Parameter = Internal.createParameter("_2", SQLDataType.INTEGER, false, true) - } - - init { - returnParameter = GenSalt2.RETURN_VALUE - addInParameter(GenSalt2._1) - addInParameter(GenSalt2._2) - setOverloaded(true) - } - - /** - * Set the _1 parameter IN value to the routine - */ - fun set__1(value: String?): Unit = setValue(GenSalt2._1, value) - - /** - * Set the _1 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - fun set__1(field: Field): Unit { - setField(GenSalt2._1, field) - } - - /** - * Set the _2 parameter IN value to the routine - */ - fun set__2(value: Int?): Unit = setValue(GenSalt2._2, value) - - /** - * Set the _2 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - fun set__2(field: Field): Unit { - setField(GenSalt2._2, field) - } -} diff --git a/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/Hmac1.kt b/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/Hmac1.kt deleted file mode 100644 index 84fbd18..0000000 --- a/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/Hmac1.kt +++ /dev/null @@ -1,91 +0,0 @@ -/* - * This file is generated by jOOQ. - */ -package de.fiereu.openmmo.server.login.jooq.routines - - -import de.fiereu.openmmo.server.login.jooq.Public - -import org.jooq.Field -import org.jooq.Parameter -import org.jooq.impl.AbstractRoutine -import org.jooq.impl.DSL -import org.jooq.impl.Internal -import org.jooq.impl.SQLDataType - - -/** - * This class is generated by jOOQ. - */ -@Suppress("warnings") -open class Hmac1 : AbstractRoutine("hmac", Public.PUBLIC, DSL.comment(""), SQLDataType.BLOB) { - companion object { - - /** - * The parameter public.hmac.RETURN_VALUE. - */ - val RETURN_VALUE: Parameter = Internal.createParameter("RETURN_VALUE", SQLDataType.BLOB, false, false) - - /** - * The parameter public.hmac._1. - */ - val _1: Parameter = Internal.createParameter("_1", SQLDataType.CLOB, false, true) - - /** - * The parameter public.hmac._2. - */ - val _2: Parameter = Internal.createParameter("_2", SQLDataType.CLOB, false, true) - - /** - * The parameter public.hmac._3. - */ - val _3: Parameter = Internal.createParameter("_3", SQLDataType.CLOB, false, true) - } - - init { - returnParameter = Hmac1.RETURN_VALUE - addInParameter(Hmac1._1) - addInParameter(Hmac1._2) - addInParameter(Hmac1._3) - setOverloaded(true) - } - - /** - * Set the _1 parameter IN value to the routine - */ - fun set__1(value: String?): Unit = setValue(Hmac1._1, value) - - /** - * Set the _1 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - fun set__1(field: Field): Unit { - setField(Hmac1._1, field) - } - - /** - * Set the _2 parameter IN value to the routine - */ - fun set__2(value: String?): Unit = setValue(Hmac1._2, value) - - /** - * Set the _2 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - fun set__2(field: Field): Unit { - setField(Hmac1._2, field) - } - - /** - * Set the _3 parameter IN value to the routine - */ - fun set__3(value: String?): Unit = setValue(Hmac1._3, value) - - /** - * Set the _3 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - fun set__3(field: Field): Unit { - setField(Hmac1._3, field) - } -} diff --git a/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/Hmac2.kt b/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/Hmac2.kt deleted file mode 100644 index b28272c..0000000 --- a/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/Hmac2.kt +++ /dev/null @@ -1,91 +0,0 @@ -/* - * This file is generated by jOOQ. - */ -package de.fiereu.openmmo.server.login.jooq.routines - - -import de.fiereu.openmmo.server.login.jooq.Public - -import org.jooq.Field -import org.jooq.Parameter -import org.jooq.impl.AbstractRoutine -import org.jooq.impl.DSL -import org.jooq.impl.Internal -import org.jooq.impl.SQLDataType - - -/** - * This class is generated by jOOQ. - */ -@Suppress("warnings") -open class Hmac2 : AbstractRoutine("hmac", Public.PUBLIC, DSL.comment(""), SQLDataType.BLOB) { - companion object { - - /** - * The parameter public.hmac.RETURN_VALUE. - */ - val RETURN_VALUE: Parameter = Internal.createParameter("RETURN_VALUE", SQLDataType.BLOB, false, false) - - /** - * The parameter public.hmac._1. - */ - val _1: Parameter = Internal.createParameter("_1", SQLDataType.BLOB, false, true) - - /** - * The parameter public.hmac._2. - */ - val _2: Parameter = Internal.createParameter("_2", SQLDataType.BLOB, false, true) - - /** - * The parameter public.hmac._3. - */ - val _3: Parameter = Internal.createParameter("_3", SQLDataType.CLOB, false, true) - } - - init { - returnParameter = Hmac2.RETURN_VALUE - addInParameter(Hmac2._1) - addInParameter(Hmac2._2) - addInParameter(Hmac2._3) - setOverloaded(true) - } - - /** - * Set the _1 parameter IN value to the routine - */ - fun set__1(value: ByteArray?): Unit = setValue(Hmac2._1, value) - - /** - * Set the _1 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - fun set__1(field: Field): Unit { - setField(Hmac2._1, field) - } - - /** - * Set the _2 parameter IN value to the routine - */ - fun set__2(value: ByteArray?): Unit = setValue(Hmac2._2, value) - - /** - * Set the _2 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - fun set__2(field: Field): Unit { - setField(Hmac2._2, field) - } - - /** - * Set the _3 parameter IN value to the routine - */ - fun set__3(value: String?): Unit = setValue(Hmac2._3, value) - - /** - * Set the _3 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - fun set__3(field: Field): Unit { - setField(Hmac2._3, field) - } -} diff --git a/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/PgpKeyId.kt b/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/PgpKeyId.kt deleted file mode 100644 index 9d61e5b..0000000 --- a/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/PgpKeyId.kt +++ /dev/null @@ -1,52 +0,0 @@ -/* - * This file is generated by jOOQ. - */ -package de.fiereu.openmmo.server.login.jooq.routines - - -import de.fiereu.openmmo.server.login.jooq.Public - -import org.jooq.Field -import org.jooq.Parameter -import org.jooq.impl.AbstractRoutine -import org.jooq.impl.DSL -import org.jooq.impl.Internal -import org.jooq.impl.SQLDataType - - -/** - * This class is generated by jOOQ. - */ -@Suppress("warnings") -open class PgpKeyId : AbstractRoutine("pgp_key_id", Public.PUBLIC, DSL.comment(""), SQLDataType.CLOB) { - companion object { - - /** - * The parameter public.pgp_key_id.RETURN_VALUE. - */ - val RETURN_VALUE: Parameter = Internal.createParameter("RETURN_VALUE", SQLDataType.CLOB, false, false) - - /** - * The parameter public.pgp_key_id._1. - */ - val _1: Parameter = Internal.createParameter("_1", SQLDataType.BLOB, false, true) - } - - init { - returnParameter = PgpKeyId.RETURN_VALUE - addInParameter(PgpKeyId._1) - } - - /** - * Set the _1 parameter IN value to the routine - */ - fun set__1(value: ByteArray?): Unit = setValue(PgpKeyId._1, value) - - /** - * Set the _1 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - fun set__1(field: Field): Unit { - setField(PgpKeyId._1, field) - } -} diff --git a/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/PgpPubDecrypt1.kt b/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/PgpPubDecrypt1.kt deleted file mode 100644 index bbbae0a..0000000 --- a/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/PgpPubDecrypt1.kt +++ /dev/null @@ -1,72 +0,0 @@ -/* - * This file is generated by jOOQ. - */ -package de.fiereu.openmmo.server.login.jooq.routines - - -import de.fiereu.openmmo.server.login.jooq.Public - -import org.jooq.Field -import org.jooq.Parameter -import org.jooq.impl.AbstractRoutine -import org.jooq.impl.DSL -import org.jooq.impl.Internal -import org.jooq.impl.SQLDataType - - -/** - * This class is generated by jOOQ. - */ -@Suppress("warnings") -open class PgpPubDecrypt1 : AbstractRoutine("pgp_pub_decrypt", Public.PUBLIC, DSL.comment(""), SQLDataType.CLOB) { - companion object { - - /** - * The parameter public.pgp_pub_decrypt.RETURN_VALUE. - */ - val RETURN_VALUE: Parameter = Internal.createParameter("RETURN_VALUE", SQLDataType.CLOB, false, false) - - /** - * The parameter public.pgp_pub_decrypt._1. - */ - val _1: Parameter = Internal.createParameter("_1", SQLDataType.BLOB, false, true) - - /** - * The parameter public.pgp_pub_decrypt._2. - */ - val _2: Parameter = Internal.createParameter("_2", SQLDataType.BLOB, false, true) - } - - init { - returnParameter = PgpPubDecrypt1.RETURN_VALUE - addInParameter(PgpPubDecrypt1._1) - addInParameter(PgpPubDecrypt1._2) - setOverloaded(true) - } - - /** - * Set the _1 parameter IN value to the routine - */ - fun set__1(value: ByteArray?): Unit = setValue(PgpPubDecrypt1._1, value) - - /** - * Set the _1 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - fun set__1(field: Field): Unit { - setField(PgpPubDecrypt1._1, field) - } - - /** - * Set the _2 parameter IN value to the routine - */ - fun set__2(value: ByteArray?): Unit = setValue(PgpPubDecrypt1._2, value) - - /** - * Set the _2 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - fun set__2(field: Field): Unit { - setField(PgpPubDecrypt1._2, field) - } -} diff --git a/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/PgpPubDecrypt2.kt b/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/PgpPubDecrypt2.kt deleted file mode 100644 index 2775cb2..0000000 --- a/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/PgpPubDecrypt2.kt +++ /dev/null @@ -1,91 +0,0 @@ -/* - * This file is generated by jOOQ. - */ -package de.fiereu.openmmo.server.login.jooq.routines - - -import de.fiereu.openmmo.server.login.jooq.Public - -import org.jooq.Field -import org.jooq.Parameter -import org.jooq.impl.AbstractRoutine -import org.jooq.impl.DSL -import org.jooq.impl.Internal -import org.jooq.impl.SQLDataType - - -/** - * This class is generated by jOOQ. - */ -@Suppress("warnings") -open class PgpPubDecrypt2 : AbstractRoutine("pgp_pub_decrypt", Public.PUBLIC, DSL.comment(""), SQLDataType.CLOB) { - companion object { - - /** - * The parameter public.pgp_pub_decrypt.RETURN_VALUE. - */ - val RETURN_VALUE: Parameter = Internal.createParameter("RETURN_VALUE", SQLDataType.CLOB, false, false) - - /** - * The parameter public.pgp_pub_decrypt._1. - */ - val _1: Parameter = Internal.createParameter("_1", SQLDataType.BLOB, false, true) - - /** - * The parameter public.pgp_pub_decrypt._2. - */ - val _2: Parameter = Internal.createParameter("_2", SQLDataType.BLOB, false, true) - - /** - * The parameter public.pgp_pub_decrypt._3. - */ - val _3: Parameter = Internal.createParameter("_3", SQLDataType.CLOB, false, true) - } - - init { - returnParameter = PgpPubDecrypt2.RETURN_VALUE - addInParameter(PgpPubDecrypt2._1) - addInParameter(PgpPubDecrypt2._2) - addInParameter(PgpPubDecrypt2._3) - setOverloaded(true) - } - - /** - * Set the _1 parameter IN value to the routine - */ - fun set__1(value: ByteArray?): Unit = setValue(PgpPubDecrypt2._1, value) - - /** - * Set the _1 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - fun set__1(field: Field): Unit { - setField(PgpPubDecrypt2._1, field) - } - - /** - * Set the _2 parameter IN value to the routine - */ - fun set__2(value: ByteArray?): Unit = setValue(PgpPubDecrypt2._2, value) - - /** - * Set the _2 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - fun set__2(field: Field): Unit { - setField(PgpPubDecrypt2._2, field) - } - - /** - * Set the _3 parameter IN value to the routine - */ - fun set__3(value: String?): Unit = setValue(PgpPubDecrypt2._3, value) - - /** - * Set the _3 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - fun set__3(field: Field): Unit { - setField(PgpPubDecrypt2._3, field) - } -} diff --git a/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/PgpPubDecrypt3.kt b/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/PgpPubDecrypt3.kt deleted file mode 100644 index 3f6ab63..0000000 --- a/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/PgpPubDecrypt3.kt +++ /dev/null @@ -1,110 +0,0 @@ -/* - * This file is generated by jOOQ. - */ -package de.fiereu.openmmo.server.login.jooq.routines - - -import de.fiereu.openmmo.server.login.jooq.Public - -import org.jooq.Field -import org.jooq.Parameter -import org.jooq.impl.AbstractRoutine -import org.jooq.impl.DSL -import org.jooq.impl.Internal -import org.jooq.impl.SQLDataType - - -/** - * This class is generated by jOOQ. - */ -@Suppress("warnings") -open class PgpPubDecrypt3 : AbstractRoutine("pgp_pub_decrypt", Public.PUBLIC, DSL.comment(""), SQLDataType.CLOB) { - companion object { - - /** - * The parameter public.pgp_pub_decrypt.RETURN_VALUE. - */ - val RETURN_VALUE: Parameter = Internal.createParameter("RETURN_VALUE", SQLDataType.CLOB, false, false) - - /** - * The parameter public.pgp_pub_decrypt._1. - */ - val _1: Parameter = Internal.createParameter("_1", SQLDataType.BLOB, false, true) - - /** - * The parameter public.pgp_pub_decrypt._2. - */ - val _2: Parameter = Internal.createParameter("_2", SQLDataType.BLOB, false, true) - - /** - * The parameter public.pgp_pub_decrypt._3. - */ - val _3: Parameter = Internal.createParameter("_3", SQLDataType.CLOB, false, true) - - /** - * The parameter public.pgp_pub_decrypt._4. - */ - val _4: Parameter = Internal.createParameter("_4", SQLDataType.CLOB, false, true) - } - - init { - returnParameter = PgpPubDecrypt3.RETURN_VALUE - addInParameter(PgpPubDecrypt3._1) - addInParameter(PgpPubDecrypt3._2) - addInParameter(PgpPubDecrypt3._3) - addInParameter(PgpPubDecrypt3._4) - setOverloaded(true) - } - - /** - * Set the _1 parameter IN value to the routine - */ - fun set__1(value: ByteArray?): Unit = setValue(PgpPubDecrypt3._1, value) - - /** - * Set the _1 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - fun set__1(field: Field): Unit { - setField(PgpPubDecrypt3._1, field) - } - - /** - * Set the _2 parameter IN value to the routine - */ - fun set__2(value: ByteArray?): Unit = setValue(PgpPubDecrypt3._2, value) - - /** - * Set the _2 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - fun set__2(field: Field): Unit { - setField(PgpPubDecrypt3._2, field) - } - - /** - * Set the _3 parameter IN value to the routine - */ - fun set__3(value: String?): Unit = setValue(PgpPubDecrypt3._3, value) - - /** - * Set the _3 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - fun set__3(field: Field): Unit { - setField(PgpPubDecrypt3._3, field) - } - - /** - * Set the _4 parameter IN value to the routine - */ - fun set__4(value: String?): Unit = setValue(PgpPubDecrypt3._4, value) - - /** - * Set the _4 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - fun set__4(field: Field): Unit { - setField(PgpPubDecrypt3._4, field) - } -} diff --git a/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/PgpPubDecryptBytea1.kt b/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/PgpPubDecryptBytea1.kt deleted file mode 100644 index c0f18a8..0000000 --- a/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/PgpPubDecryptBytea1.kt +++ /dev/null @@ -1,72 +0,0 @@ -/* - * This file is generated by jOOQ. - */ -package de.fiereu.openmmo.server.login.jooq.routines - - -import de.fiereu.openmmo.server.login.jooq.Public - -import org.jooq.Field -import org.jooq.Parameter -import org.jooq.impl.AbstractRoutine -import org.jooq.impl.DSL -import org.jooq.impl.Internal -import org.jooq.impl.SQLDataType - - -/** - * This class is generated by jOOQ. - */ -@Suppress("warnings") -open class PgpPubDecryptBytea1 : AbstractRoutine("pgp_pub_decrypt_bytea", Public.PUBLIC, DSL.comment(""), SQLDataType.BLOB) { - companion object { - - /** - * The parameter public.pgp_pub_decrypt_bytea.RETURN_VALUE. - */ - val RETURN_VALUE: Parameter = Internal.createParameter("RETURN_VALUE", SQLDataType.BLOB, false, false) - - /** - * The parameter public.pgp_pub_decrypt_bytea._1. - */ - val _1: Parameter = Internal.createParameter("_1", SQLDataType.BLOB, false, true) - - /** - * The parameter public.pgp_pub_decrypt_bytea._2. - */ - val _2: Parameter = Internal.createParameter("_2", SQLDataType.BLOB, false, true) - } - - init { - returnParameter = PgpPubDecryptBytea1.RETURN_VALUE - addInParameter(PgpPubDecryptBytea1._1) - addInParameter(PgpPubDecryptBytea1._2) - setOverloaded(true) - } - - /** - * Set the _1 parameter IN value to the routine - */ - fun set__1(value: ByteArray?): Unit = setValue(PgpPubDecryptBytea1._1, value) - - /** - * Set the _1 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - fun set__1(field: Field): Unit { - setField(PgpPubDecryptBytea1._1, field) - } - - /** - * Set the _2 parameter IN value to the routine - */ - fun set__2(value: ByteArray?): Unit = setValue(PgpPubDecryptBytea1._2, value) - - /** - * Set the _2 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - fun set__2(field: Field): Unit { - setField(PgpPubDecryptBytea1._2, field) - } -} diff --git a/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/PgpPubDecryptBytea2.kt b/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/PgpPubDecryptBytea2.kt deleted file mode 100644 index 052bb1c..0000000 --- a/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/PgpPubDecryptBytea2.kt +++ /dev/null @@ -1,91 +0,0 @@ -/* - * This file is generated by jOOQ. - */ -package de.fiereu.openmmo.server.login.jooq.routines - - -import de.fiereu.openmmo.server.login.jooq.Public - -import org.jooq.Field -import org.jooq.Parameter -import org.jooq.impl.AbstractRoutine -import org.jooq.impl.DSL -import org.jooq.impl.Internal -import org.jooq.impl.SQLDataType - - -/** - * This class is generated by jOOQ. - */ -@Suppress("warnings") -open class PgpPubDecryptBytea2 : AbstractRoutine("pgp_pub_decrypt_bytea", Public.PUBLIC, DSL.comment(""), SQLDataType.BLOB) { - companion object { - - /** - * The parameter public.pgp_pub_decrypt_bytea.RETURN_VALUE. - */ - val RETURN_VALUE: Parameter = Internal.createParameter("RETURN_VALUE", SQLDataType.BLOB, false, false) - - /** - * The parameter public.pgp_pub_decrypt_bytea._1. - */ - val _1: Parameter = Internal.createParameter("_1", SQLDataType.BLOB, false, true) - - /** - * The parameter public.pgp_pub_decrypt_bytea._2. - */ - val _2: Parameter = Internal.createParameter("_2", SQLDataType.BLOB, false, true) - - /** - * The parameter public.pgp_pub_decrypt_bytea._3. - */ - val _3: Parameter = Internal.createParameter("_3", SQLDataType.CLOB, false, true) - } - - init { - returnParameter = PgpPubDecryptBytea2.RETURN_VALUE - addInParameter(PgpPubDecryptBytea2._1) - addInParameter(PgpPubDecryptBytea2._2) - addInParameter(PgpPubDecryptBytea2._3) - setOverloaded(true) - } - - /** - * Set the _1 parameter IN value to the routine - */ - fun set__1(value: ByteArray?): Unit = setValue(PgpPubDecryptBytea2._1, value) - - /** - * Set the _1 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - fun set__1(field: Field): Unit { - setField(PgpPubDecryptBytea2._1, field) - } - - /** - * Set the _2 parameter IN value to the routine - */ - fun set__2(value: ByteArray?): Unit = setValue(PgpPubDecryptBytea2._2, value) - - /** - * Set the _2 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - fun set__2(field: Field): Unit { - setField(PgpPubDecryptBytea2._2, field) - } - - /** - * Set the _3 parameter IN value to the routine - */ - fun set__3(value: String?): Unit = setValue(PgpPubDecryptBytea2._3, value) - - /** - * Set the _3 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - fun set__3(field: Field): Unit { - setField(PgpPubDecryptBytea2._3, field) - } -} diff --git a/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/PgpPubDecryptBytea3.kt b/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/PgpPubDecryptBytea3.kt deleted file mode 100644 index be2f7bd..0000000 --- a/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/PgpPubDecryptBytea3.kt +++ /dev/null @@ -1,110 +0,0 @@ -/* - * This file is generated by jOOQ. - */ -package de.fiereu.openmmo.server.login.jooq.routines - - -import de.fiereu.openmmo.server.login.jooq.Public - -import org.jooq.Field -import org.jooq.Parameter -import org.jooq.impl.AbstractRoutine -import org.jooq.impl.DSL -import org.jooq.impl.Internal -import org.jooq.impl.SQLDataType - - -/** - * This class is generated by jOOQ. - */ -@Suppress("warnings") -open class PgpPubDecryptBytea3 : AbstractRoutine("pgp_pub_decrypt_bytea", Public.PUBLIC, DSL.comment(""), SQLDataType.BLOB) { - companion object { - - /** - * The parameter public.pgp_pub_decrypt_bytea.RETURN_VALUE. - */ - val RETURN_VALUE: Parameter = Internal.createParameter("RETURN_VALUE", SQLDataType.BLOB, false, false) - - /** - * The parameter public.pgp_pub_decrypt_bytea._1. - */ - val _1: Parameter = Internal.createParameter("_1", SQLDataType.BLOB, false, true) - - /** - * The parameter public.pgp_pub_decrypt_bytea._2. - */ - val _2: Parameter = Internal.createParameter("_2", SQLDataType.BLOB, false, true) - - /** - * The parameter public.pgp_pub_decrypt_bytea._3. - */ - val _3: Parameter = Internal.createParameter("_3", SQLDataType.CLOB, false, true) - - /** - * The parameter public.pgp_pub_decrypt_bytea._4. - */ - val _4: Parameter = Internal.createParameter("_4", SQLDataType.CLOB, false, true) - } - - init { - returnParameter = PgpPubDecryptBytea3.RETURN_VALUE - addInParameter(PgpPubDecryptBytea3._1) - addInParameter(PgpPubDecryptBytea3._2) - addInParameter(PgpPubDecryptBytea3._3) - addInParameter(PgpPubDecryptBytea3._4) - setOverloaded(true) - } - - /** - * Set the _1 parameter IN value to the routine - */ - fun set__1(value: ByteArray?): Unit = setValue(PgpPubDecryptBytea3._1, value) - - /** - * Set the _1 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - fun set__1(field: Field): Unit { - setField(PgpPubDecryptBytea3._1, field) - } - - /** - * Set the _2 parameter IN value to the routine - */ - fun set__2(value: ByteArray?): Unit = setValue(PgpPubDecryptBytea3._2, value) - - /** - * Set the _2 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - fun set__2(field: Field): Unit { - setField(PgpPubDecryptBytea3._2, field) - } - - /** - * Set the _3 parameter IN value to the routine - */ - fun set__3(value: String?): Unit = setValue(PgpPubDecryptBytea3._3, value) - - /** - * Set the _3 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - fun set__3(field: Field): Unit { - setField(PgpPubDecryptBytea3._3, field) - } - - /** - * Set the _4 parameter IN value to the routine - */ - fun set__4(value: String?): Unit = setValue(PgpPubDecryptBytea3._4, value) - - /** - * Set the _4 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - fun set__4(field: Field): Unit { - setField(PgpPubDecryptBytea3._4, field) - } -} diff --git a/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/PgpPubEncrypt1.kt b/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/PgpPubEncrypt1.kt deleted file mode 100644 index 54e2519..0000000 --- a/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/PgpPubEncrypt1.kt +++ /dev/null @@ -1,72 +0,0 @@ -/* - * This file is generated by jOOQ. - */ -package de.fiereu.openmmo.server.login.jooq.routines - - -import de.fiereu.openmmo.server.login.jooq.Public - -import org.jooq.Field -import org.jooq.Parameter -import org.jooq.impl.AbstractRoutine -import org.jooq.impl.DSL -import org.jooq.impl.Internal -import org.jooq.impl.SQLDataType - - -/** - * This class is generated by jOOQ. - */ -@Suppress("warnings") -open class PgpPubEncrypt1 : AbstractRoutine("pgp_pub_encrypt", Public.PUBLIC, DSL.comment(""), SQLDataType.BLOB) { - companion object { - - /** - * The parameter public.pgp_pub_encrypt.RETURN_VALUE. - */ - val RETURN_VALUE: Parameter = Internal.createParameter("RETURN_VALUE", SQLDataType.BLOB, false, false) - - /** - * The parameter public.pgp_pub_encrypt._1. - */ - val _1: Parameter = Internal.createParameter("_1", SQLDataType.CLOB, false, true) - - /** - * The parameter public.pgp_pub_encrypt._2. - */ - val _2: Parameter = Internal.createParameter("_2", SQLDataType.BLOB, false, true) - } - - init { - returnParameter = PgpPubEncrypt1.RETURN_VALUE - addInParameter(PgpPubEncrypt1._1) - addInParameter(PgpPubEncrypt1._2) - setOverloaded(true) - } - - /** - * Set the _1 parameter IN value to the routine - */ - fun set__1(value: String?): Unit = setValue(PgpPubEncrypt1._1, value) - - /** - * Set the _1 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - fun set__1(field: Field): Unit { - setField(PgpPubEncrypt1._1, field) - } - - /** - * Set the _2 parameter IN value to the routine - */ - fun set__2(value: ByteArray?): Unit = setValue(PgpPubEncrypt1._2, value) - - /** - * Set the _2 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - fun set__2(field: Field): Unit { - setField(PgpPubEncrypt1._2, field) - } -} diff --git a/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/PgpPubEncrypt2.kt b/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/PgpPubEncrypt2.kt deleted file mode 100644 index 891c7b5..0000000 --- a/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/PgpPubEncrypt2.kt +++ /dev/null @@ -1,91 +0,0 @@ -/* - * This file is generated by jOOQ. - */ -package de.fiereu.openmmo.server.login.jooq.routines - - -import de.fiereu.openmmo.server.login.jooq.Public - -import org.jooq.Field -import org.jooq.Parameter -import org.jooq.impl.AbstractRoutine -import org.jooq.impl.DSL -import org.jooq.impl.Internal -import org.jooq.impl.SQLDataType - - -/** - * This class is generated by jOOQ. - */ -@Suppress("warnings") -open class PgpPubEncrypt2 : AbstractRoutine("pgp_pub_encrypt", Public.PUBLIC, DSL.comment(""), SQLDataType.BLOB) { - companion object { - - /** - * The parameter public.pgp_pub_encrypt.RETURN_VALUE. - */ - val RETURN_VALUE: Parameter = Internal.createParameter("RETURN_VALUE", SQLDataType.BLOB, false, false) - - /** - * The parameter public.pgp_pub_encrypt._1. - */ - val _1: Parameter = Internal.createParameter("_1", SQLDataType.CLOB, false, true) - - /** - * The parameter public.pgp_pub_encrypt._2. - */ - val _2: Parameter = Internal.createParameter("_2", SQLDataType.BLOB, false, true) - - /** - * The parameter public.pgp_pub_encrypt._3. - */ - val _3: Parameter = Internal.createParameter("_3", SQLDataType.CLOB, false, true) - } - - init { - returnParameter = PgpPubEncrypt2.RETURN_VALUE - addInParameter(PgpPubEncrypt2._1) - addInParameter(PgpPubEncrypt2._2) - addInParameter(PgpPubEncrypt2._3) - setOverloaded(true) - } - - /** - * Set the _1 parameter IN value to the routine - */ - fun set__1(value: String?): Unit = setValue(PgpPubEncrypt2._1, value) - - /** - * Set the _1 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - fun set__1(field: Field): Unit { - setField(PgpPubEncrypt2._1, field) - } - - /** - * Set the _2 parameter IN value to the routine - */ - fun set__2(value: ByteArray?): Unit = setValue(PgpPubEncrypt2._2, value) - - /** - * Set the _2 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - fun set__2(field: Field): Unit { - setField(PgpPubEncrypt2._2, field) - } - - /** - * Set the _3 parameter IN value to the routine - */ - fun set__3(value: String?): Unit = setValue(PgpPubEncrypt2._3, value) - - /** - * Set the _3 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - fun set__3(field: Field): Unit { - setField(PgpPubEncrypt2._3, field) - } -} diff --git a/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/PgpPubEncryptBytea1.kt b/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/PgpPubEncryptBytea1.kt deleted file mode 100644 index eb56f21..0000000 --- a/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/PgpPubEncryptBytea1.kt +++ /dev/null @@ -1,72 +0,0 @@ -/* - * This file is generated by jOOQ. - */ -package de.fiereu.openmmo.server.login.jooq.routines - - -import de.fiereu.openmmo.server.login.jooq.Public - -import org.jooq.Field -import org.jooq.Parameter -import org.jooq.impl.AbstractRoutine -import org.jooq.impl.DSL -import org.jooq.impl.Internal -import org.jooq.impl.SQLDataType - - -/** - * This class is generated by jOOQ. - */ -@Suppress("warnings") -open class PgpPubEncryptBytea1 : AbstractRoutine("pgp_pub_encrypt_bytea", Public.PUBLIC, DSL.comment(""), SQLDataType.BLOB) { - companion object { - - /** - * The parameter public.pgp_pub_encrypt_bytea.RETURN_VALUE. - */ - val RETURN_VALUE: Parameter = Internal.createParameter("RETURN_VALUE", SQLDataType.BLOB, false, false) - - /** - * The parameter public.pgp_pub_encrypt_bytea._1. - */ - val _1: Parameter = Internal.createParameter("_1", SQLDataType.BLOB, false, true) - - /** - * The parameter public.pgp_pub_encrypt_bytea._2. - */ - val _2: Parameter = Internal.createParameter("_2", SQLDataType.BLOB, false, true) - } - - init { - returnParameter = PgpPubEncryptBytea1.RETURN_VALUE - addInParameter(PgpPubEncryptBytea1._1) - addInParameter(PgpPubEncryptBytea1._2) - setOverloaded(true) - } - - /** - * Set the _1 parameter IN value to the routine - */ - fun set__1(value: ByteArray?): Unit = setValue(PgpPubEncryptBytea1._1, value) - - /** - * Set the _1 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - fun set__1(field: Field): Unit { - setField(PgpPubEncryptBytea1._1, field) - } - - /** - * Set the _2 parameter IN value to the routine - */ - fun set__2(value: ByteArray?): Unit = setValue(PgpPubEncryptBytea1._2, value) - - /** - * Set the _2 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - fun set__2(field: Field): Unit { - setField(PgpPubEncryptBytea1._2, field) - } -} diff --git a/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/PgpPubEncryptBytea2.kt b/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/PgpPubEncryptBytea2.kt deleted file mode 100644 index 63fc8f7..0000000 --- a/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/PgpPubEncryptBytea2.kt +++ /dev/null @@ -1,91 +0,0 @@ -/* - * This file is generated by jOOQ. - */ -package de.fiereu.openmmo.server.login.jooq.routines - - -import de.fiereu.openmmo.server.login.jooq.Public - -import org.jooq.Field -import org.jooq.Parameter -import org.jooq.impl.AbstractRoutine -import org.jooq.impl.DSL -import org.jooq.impl.Internal -import org.jooq.impl.SQLDataType - - -/** - * This class is generated by jOOQ. - */ -@Suppress("warnings") -open class PgpPubEncryptBytea2 : AbstractRoutine("pgp_pub_encrypt_bytea", Public.PUBLIC, DSL.comment(""), SQLDataType.BLOB) { - companion object { - - /** - * The parameter public.pgp_pub_encrypt_bytea.RETURN_VALUE. - */ - val RETURN_VALUE: Parameter = Internal.createParameter("RETURN_VALUE", SQLDataType.BLOB, false, false) - - /** - * The parameter public.pgp_pub_encrypt_bytea._1. - */ - val _1: Parameter = Internal.createParameter("_1", SQLDataType.BLOB, false, true) - - /** - * The parameter public.pgp_pub_encrypt_bytea._2. - */ - val _2: Parameter = Internal.createParameter("_2", SQLDataType.BLOB, false, true) - - /** - * The parameter public.pgp_pub_encrypt_bytea._3. - */ - val _3: Parameter = Internal.createParameter("_3", SQLDataType.CLOB, false, true) - } - - init { - returnParameter = PgpPubEncryptBytea2.RETURN_VALUE - addInParameter(PgpPubEncryptBytea2._1) - addInParameter(PgpPubEncryptBytea2._2) - addInParameter(PgpPubEncryptBytea2._3) - setOverloaded(true) - } - - /** - * Set the _1 parameter IN value to the routine - */ - fun set__1(value: ByteArray?): Unit = setValue(PgpPubEncryptBytea2._1, value) - - /** - * Set the _1 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - fun set__1(field: Field): Unit { - setField(PgpPubEncryptBytea2._1, field) - } - - /** - * Set the _2 parameter IN value to the routine - */ - fun set__2(value: ByteArray?): Unit = setValue(PgpPubEncryptBytea2._2, value) - - /** - * Set the _2 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - fun set__2(field: Field): Unit { - setField(PgpPubEncryptBytea2._2, field) - } - - /** - * Set the _3 parameter IN value to the routine - */ - fun set__3(value: String?): Unit = setValue(PgpPubEncryptBytea2._3, value) - - /** - * Set the _3 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - fun set__3(field: Field): Unit { - setField(PgpPubEncryptBytea2._3, field) - } -} diff --git a/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/PgpSymDecrypt1.kt b/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/PgpSymDecrypt1.kt deleted file mode 100644 index 7728250..0000000 --- a/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/PgpSymDecrypt1.kt +++ /dev/null @@ -1,72 +0,0 @@ -/* - * This file is generated by jOOQ. - */ -package de.fiereu.openmmo.server.login.jooq.routines - - -import de.fiereu.openmmo.server.login.jooq.Public - -import org.jooq.Field -import org.jooq.Parameter -import org.jooq.impl.AbstractRoutine -import org.jooq.impl.DSL -import org.jooq.impl.Internal -import org.jooq.impl.SQLDataType - - -/** - * This class is generated by jOOQ. - */ -@Suppress("warnings") -open class PgpSymDecrypt1 : AbstractRoutine("pgp_sym_decrypt", Public.PUBLIC, DSL.comment(""), SQLDataType.CLOB) { - companion object { - - /** - * The parameter public.pgp_sym_decrypt.RETURN_VALUE. - */ - val RETURN_VALUE: Parameter = Internal.createParameter("RETURN_VALUE", SQLDataType.CLOB, false, false) - - /** - * The parameter public.pgp_sym_decrypt._1. - */ - val _1: Parameter = Internal.createParameter("_1", SQLDataType.BLOB, false, true) - - /** - * The parameter public.pgp_sym_decrypt._2. - */ - val _2: Parameter = Internal.createParameter("_2", SQLDataType.CLOB, false, true) - } - - init { - returnParameter = PgpSymDecrypt1.RETURN_VALUE - addInParameter(PgpSymDecrypt1._1) - addInParameter(PgpSymDecrypt1._2) - setOverloaded(true) - } - - /** - * Set the _1 parameter IN value to the routine - */ - fun set__1(value: ByteArray?): Unit = setValue(PgpSymDecrypt1._1, value) - - /** - * Set the _1 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - fun set__1(field: Field): Unit { - setField(PgpSymDecrypt1._1, field) - } - - /** - * Set the _2 parameter IN value to the routine - */ - fun set__2(value: String?): Unit = setValue(PgpSymDecrypt1._2, value) - - /** - * Set the _2 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - fun set__2(field: Field): Unit { - setField(PgpSymDecrypt1._2, field) - } -} diff --git a/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/PgpSymDecrypt2.kt b/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/PgpSymDecrypt2.kt deleted file mode 100644 index 8102972..0000000 --- a/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/PgpSymDecrypt2.kt +++ /dev/null @@ -1,91 +0,0 @@ -/* - * This file is generated by jOOQ. - */ -package de.fiereu.openmmo.server.login.jooq.routines - - -import de.fiereu.openmmo.server.login.jooq.Public - -import org.jooq.Field -import org.jooq.Parameter -import org.jooq.impl.AbstractRoutine -import org.jooq.impl.DSL -import org.jooq.impl.Internal -import org.jooq.impl.SQLDataType - - -/** - * This class is generated by jOOQ. - */ -@Suppress("warnings") -open class PgpSymDecrypt2 : AbstractRoutine("pgp_sym_decrypt", Public.PUBLIC, DSL.comment(""), SQLDataType.CLOB) { - companion object { - - /** - * The parameter public.pgp_sym_decrypt.RETURN_VALUE. - */ - val RETURN_VALUE: Parameter = Internal.createParameter("RETURN_VALUE", SQLDataType.CLOB, false, false) - - /** - * The parameter public.pgp_sym_decrypt._1. - */ - val _1: Parameter = Internal.createParameter("_1", SQLDataType.BLOB, false, true) - - /** - * The parameter public.pgp_sym_decrypt._2. - */ - val _2: Parameter = Internal.createParameter("_2", SQLDataType.CLOB, false, true) - - /** - * The parameter public.pgp_sym_decrypt._3. - */ - val _3: Parameter = Internal.createParameter("_3", SQLDataType.CLOB, false, true) - } - - init { - returnParameter = PgpSymDecrypt2.RETURN_VALUE - addInParameter(PgpSymDecrypt2._1) - addInParameter(PgpSymDecrypt2._2) - addInParameter(PgpSymDecrypt2._3) - setOverloaded(true) - } - - /** - * Set the _1 parameter IN value to the routine - */ - fun set__1(value: ByteArray?): Unit = setValue(PgpSymDecrypt2._1, value) - - /** - * Set the _1 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - fun set__1(field: Field): Unit { - setField(PgpSymDecrypt2._1, field) - } - - /** - * Set the _2 parameter IN value to the routine - */ - fun set__2(value: String?): Unit = setValue(PgpSymDecrypt2._2, value) - - /** - * Set the _2 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - fun set__2(field: Field): Unit { - setField(PgpSymDecrypt2._2, field) - } - - /** - * Set the _3 parameter IN value to the routine - */ - fun set__3(value: String?): Unit = setValue(PgpSymDecrypt2._3, value) - - /** - * Set the _3 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - fun set__3(field: Field): Unit { - setField(PgpSymDecrypt2._3, field) - } -} diff --git a/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/PgpSymDecryptBytea1.kt b/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/PgpSymDecryptBytea1.kt deleted file mode 100644 index 72c2329..0000000 --- a/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/PgpSymDecryptBytea1.kt +++ /dev/null @@ -1,72 +0,0 @@ -/* - * This file is generated by jOOQ. - */ -package de.fiereu.openmmo.server.login.jooq.routines - - -import de.fiereu.openmmo.server.login.jooq.Public - -import org.jooq.Field -import org.jooq.Parameter -import org.jooq.impl.AbstractRoutine -import org.jooq.impl.DSL -import org.jooq.impl.Internal -import org.jooq.impl.SQLDataType - - -/** - * This class is generated by jOOQ. - */ -@Suppress("warnings") -open class PgpSymDecryptBytea1 : AbstractRoutine("pgp_sym_decrypt_bytea", Public.PUBLIC, DSL.comment(""), SQLDataType.BLOB) { - companion object { - - /** - * The parameter public.pgp_sym_decrypt_bytea.RETURN_VALUE. - */ - val RETURN_VALUE: Parameter = Internal.createParameter("RETURN_VALUE", SQLDataType.BLOB, false, false) - - /** - * The parameter public.pgp_sym_decrypt_bytea._1. - */ - val _1: Parameter = Internal.createParameter("_1", SQLDataType.BLOB, false, true) - - /** - * The parameter public.pgp_sym_decrypt_bytea._2. - */ - val _2: Parameter = Internal.createParameter("_2", SQLDataType.CLOB, false, true) - } - - init { - returnParameter = PgpSymDecryptBytea1.RETURN_VALUE - addInParameter(PgpSymDecryptBytea1._1) - addInParameter(PgpSymDecryptBytea1._2) - setOverloaded(true) - } - - /** - * Set the _1 parameter IN value to the routine - */ - fun set__1(value: ByteArray?): Unit = setValue(PgpSymDecryptBytea1._1, value) - - /** - * Set the _1 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - fun set__1(field: Field): Unit { - setField(PgpSymDecryptBytea1._1, field) - } - - /** - * Set the _2 parameter IN value to the routine - */ - fun set__2(value: String?): Unit = setValue(PgpSymDecryptBytea1._2, value) - - /** - * Set the _2 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - fun set__2(field: Field): Unit { - setField(PgpSymDecryptBytea1._2, field) - } -} diff --git a/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/PgpSymDecryptBytea2.kt b/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/PgpSymDecryptBytea2.kt deleted file mode 100644 index 34af81b..0000000 --- a/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/PgpSymDecryptBytea2.kt +++ /dev/null @@ -1,91 +0,0 @@ -/* - * This file is generated by jOOQ. - */ -package de.fiereu.openmmo.server.login.jooq.routines - - -import de.fiereu.openmmo.server.login.jooq.Public - -import org.jooq.Field -import org.jooq.Parameter -import org.jooq.impl.AbstractRoutine -import org.jooq.impl.DSL -import org.jooq.impl.Internal -import org.jooq.impl.SQLDataType - - -/** - * This class is generated by jOOQ. - */ -@Suppress("warnings") -open class PgpSymDecryptBytea2 : AbstractRoutine("pgp_sym_decrypt_bytea", Public.PUBLIC, DSL.comment(""), SQLDataType.BLOB) { - companion object { - - /** - * The parameter public.pgp_sym_decrypt_bytea.RETURN_VALUE. - */ - val RETURN_VALUE: Parameter = Internal.createParameter("RETURN_VALUE", SQLDataType.BLOB, false, false) - - /** - * The parameter public.pgp_sym_decrypt_bytea._1. - */ - val _1: Parameter = Internal.createParameter("_1", SQLDataType.BLOB, false, true) - - /** - * The parameter public.pgp_sym_decrypt_bytea._2. - */ - val _2: Parameter = Internal.createParameter("_2", SQLDataType.CLOB, false, true) - - /** - * The parameter public.pgp_sym_decrypt_bytea._3. - */ - val _3: Parameter = Internal.createParameter("_3", SQLDataType.CLOB, false, true) - } - - init { - returnParameter = PgpSymDecryptBytea2.RETURN_VALUE - addInParameter(PgpSymDecryptBytea2._1) - addInParameter(PgpSymDecryptBytea2._2) - addInParameter(PgpSymDecryptBytea2._3) - setOverloaded(true) - } - - /** - * Set the _1 parameter IN value to the routine - */ - fun set__1(value: ByteArray?): Unit = setValue(PgpSymDecryptBytea2._1, value) - - /** - * Set the _1 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - fun set__1(field: Field): Unit { - setField(PgpSymDecryptBytea2._1, field) - } - - /** - * Set the _2 parameter IN value to the routine - */ - fun set__2(value: String?): Unit = setValue(PgpSymDecryptBytea2._2, value) - - /** - * Set the _2 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - fun set__2(field: Field): Unit { - setField(PgpSymDecryptBytea2._2, field) - } - - /** - * Set the _3 parameter IN value to the routine - */ - fun set__3(value: String?): Unit = setValue(PgpSymDecryptBytea2._3, value) - - /** - * Set the _3 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - fun set__3(field: Field): Unit { - setField(PgpSymDecryptBytea2._3, field) - } -} diff --git a/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/PgpSymEncrypt1.kt b/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/PgpSymEncrypt1.kt deleted file mode 100644 index e0bf215..0000000 --- a/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/PgpSymEncrypt1.kt +++ /dev/null @@ -1,72 +0,0 @@ -/* - * This file is generated by jOOQ. - */ -package de.fiereu.openmmo.server.login.jooq.routines - - -import de.fiereu.openmmo.server.login.jooq.Public - -import org.jooq.Field -import org.jooq.Parameter -import org.jooq.impl.AbstractRoutine -import org.jooq.impl.DSL -import org.jooq.impl.Internal -import org.jooq.impl.SQLDataType - - -/** - * This class is generated by jOOQ. - */ -@Suppress("warnings") -open class PgpSymEncrypt1 : AbstractRoutine("pgp_sym_encrypt", Public.PUBLIC, DSL.comment(""), SQLDataType.BLOB) { - companion object { - - /** - * The parameter public.pgp_sym_encrypt.RETURN_VALUE. - */ - val RETURN_VALUE: Parameter = Internal.createParameter("RETURN_VALUE", SQLDataType.BLOB, false, false) - - /** - * The parameter public.pgp_sym_encrypt._1. - */ - val _1: Parameter = Internal.createParameter("_1", SQLDataType.CLOB, false, true) - - /** - * The parameter public.pgp_sym_encrypt._2. - */ - val _2: Parameter = Internal.createParameter("_2", SQLDataType.CLOB, false, true) - } - - init { - returnParameter = PgpSymEncrypt1.RETURN_VALUE - addInParameter(PgpSymEncrypt1._1) - addInParameter(PgpSymEncrypt1._2) - setOverloaded(true) - } - - /** - * Set the _1 parameter IN value to the routine - */ - fun set__1(value: String?): Unit = setValue(PgpSymEncrypt1._1, value) - - /** - * Set the _1 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - fun set__1(field: Field): Unit { - setField(PgpSymEncrypt1._1, field) - } - - /** - * Set the _2 parameter IN value to the routine - */ - fun set__2(value: String?): Unit = setValue(PgpSymEncrypt1._2, value) - - /** - * Set the _2 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - fun set__2(field: Field): Unit { - setField(PgpSymEncrypt1._2, field) - } -} diff --git a/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/PgpSymEncrypt2.kt b/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/PgpSymEncrypt2.kt deleted file mode 100644 index b23fc6e..0000000 --- a/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/PgpSymEncrypt2.kt +++ /dev/null @@ -1,91 +0,0 @@ -/* - * This file is generated by jOOQ. - */ -package de.fiereu.openmmo.server.login.jooq.routines - - -import de.fiereu.openmmo.server.login.jooq.Public - -import org.jooq.Field -import org.jooq.Parameter -import org.jooq.impl.AbstractRoutine -import org.jooq.impl.DSL -import org.jooq.impl.Internal -import org.jooq.impl.SQLDataType - - -/** - * This class is generated by jOOQ. - */ -@Suppress("warnings") -open class PgpSymEncrypt2 : AbstractRoutine("pgp_sym_encrypt", Public.PUBLIC, DSL.comment(""), SQLDataType.BLOB) { - companion object { - - /** - * The parameter public.pgp_sym_encrypt.RETURN_VALUE. - */ - val RETURN_VALUE: Parameter = Internal.createParameter("RETURN_VALUE", SQLDataType.BLOB, false, false) - - /** - * The parameter public.pgp_sym_encrypt._1. - */ - val _1: Parameter = Internal.createParameter("_1", SQLDataType.CLOB, false, true) - - /** - * The parameter public.pgp_sym_encrypt._2. - */ - val _2: Parameter = Internal.createParameter("_2", SQLDataType.CLOB, false, true) - - /** - * The parameter public.pgp_sym_encrypt._3. - */ - val _3: Parameter = Internal.createParameter("_3", SQLDataType.CLOB, false, true) - } - - init { - returnParameter = PgpSymEncrypt2.RETURN_VALUE - addInParameter(PgpSymEncrypt2._1) - addInParameter(PgpSymEncrypt2._2) - addInParameter(PgpSymEncrypt2._3) - setOverloaded(true) - } - - /** - * Set the _1 parameter IN value to the routine - */ - fun set__1(value: String?): Unit = setValue(PgpSymEncrypt2._1, value) - - /** - * Set the _1 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - fun set__1(field: Field): Unit { - setField(PgpSymEncrypt2._1, field) - } - - /** - * Set the _2 parameter IN value to the routine - */ - fun set__2(value: String?): Unit = setValue(PgpSymEncrypt2._2, value) - - /** - * Set the _2 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - fun set__2(field: Field): Unit { - setField(PgpSymEncrypt2._2, field) - } - - /** - * Set the _3 parameter IN value to the routine - */ - fun set__3(value: String?): Unit = setValue(PgpSymEncrypt2._3, value) - - /** - * Set the _3 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - fun set__3(field: Field): Unit { - setField(PgpSymEncrypt2._3, field) - } -} diff --git a/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/PgpSymEncryptBytea1.kt b/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/PgpSymEncryptBytea1.kt deleted file mode 100644 index b7df61e..0000000 --- a/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/PgpSymEncryptBytea1.kt +++ /dev/null @@ -1,72 +0,0 @@ -/* - * This file is generated by jOOQ. - */ -package de.fiereu.openmmo.server.login.jooq.routines - - -import de.fiereu.openmmo.server.login.jooq.Public - -import org.jooq.Field -import org.jooq.Parameter -import org.jooq.impl.AbstractRoutine -import org.jooq.impl.DSL -import org.jooq.impl.Internal -import org.jooq.impl.SQLDataType - - -/** - * This class is generated by jOOQ. - */ -@Suppress("warnings") -open class PgpSymEncryptBytea1 : AbstractRoutine("pgp_sym_encrypt_bytea", Public.PUBLIC, DSL.comment(""), SQLDataType.BLOB) { - companion object { - - /** - * The parameter public.pgp_sym_encrypt_bytea.RETURN_VALUE. - */ - val RETURN_VALUE: Parameter = Internal.createParameter("RETURN_VALUE", SQLDataType.BLOB, false, false) - - /** - * The parameter public.pgp_sym_encrypt_bytea._1. - */ - val _1: Parameter = Internal.createParameter("_1", SQLDataType.BLOB, false, true) - - /** - * The parameter public.pgp_sym_encrypt_bytea._2. - */ - val _2: Parameter = Internal.createParameter("_2", SQLDataType.CLOB, false, true) - } - - init { - returnParameter = PgpSymEncryptBytea1.RETURN_VALUE - addInParameter(PgpSymEncryptBytea1._1) - addInParameter(PgpSymEncryptBytea1._2) - setOverloaded(true) - } - - /** - * Set the _1 parameter IN value to the routine - */ - fun set__1(value: ByteArray?): Unit = setValue(PgpSymEncryptBytea1._1, value) - - /** - * Set the _1 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - fun set__1(field: Field): Unit { - setField(PgpSymEncryptBytea1._1, field) - } - - /** - * Set the _2 parameter IN value to the routine - */ - fun set__2(value: String?): Unit = setValue(PgpSymEncryptBytea1._2, value) - - /** - * Set the _2 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - fun set__2(field: Field): Unit { - setField(PgpSymEncryptBytea1._2, field) - } -} diff --git a/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/PgpSymEncryptBytea2.kt b/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/PgpSymEncryptBytea2.kt deleted file mode 100644 index 216b465..0000000 --- a/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/PgpSymEncryptBytea2.kt +++ /dev/null @@ -1,91 +0,0 @@ -/* - * This file is generated by jOOQ. - */ -package de.fiereu.openmmo.server.login.jooq.routines - - -import de.fiereu.openmmo.server.login.jooq.Public - -import org.jooq.Field -import org.jooq.Parameter -import org.jooq.impl.AbstractRoutine -import org.jooq.impl.DSL -import org.jooq.impl.Internal -import org.jooq.impl.SQLDataType - - -/** - * This class is generated by jOOQ. - */ -@Suppress("warnings") -open class PgpSymEncryptBytea2 : AbstractRoutine("pgp_sym_encrypt_bytea", Public.PUBLIC, DSL.comment(""), SQLDataType.BLOB) { - companion object { - - /** - * The parameter public.pgp_sym_encrypt_bytea.RETURN_VALUE. - */ - val RETURN_VALUE: Parameter = Internal.createParameter("RETURN_VALUE", SQLDataType.BLOB, false, false) - - /** - * The parameter public.pgp_sym_encrypt_bytea._1. - */ - val _1: Parameter = Internal.createParameter("_1", SQLDataType.BLOB, false, true) - - /** - * The parameter public.pgp_sym_encrypt_bytea._2. - */ - val _2: Parameter = Internal.createParameter("_2", SQLDataType.CLOB, false, true) - - /** - * The parameter public.pgp_sym_encrypt_bytea._3. - */ - val _3: Parameter = Internal.createParameter("_3", SQLDataType.CLOB, false, true) - } - - init { - returnParameter = PgpSymEncryptBytea2.RETURN_VALUE - addInParameter(PgpSymEncryptBytea2._1) - addInParameter(PgpSymEncryptBytea2._2) - addInParameter(PgpSymEncryptBytea2._3) - setOverloaded(true) - } - - /** - * Set the _1 parameter IN value to the routine - */ - fun set__1(value: ByteArray?): Unit = setValue(PgpSymEncryptBytea2._1, value) - - /** - * Set the _1 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - fun set__1(field: Field): Unit { - setField(PgpSymEncryptBytea2._1, field) - } - - /** - * Set the _2 parameter IN value to the routine - */ - fun set__2(value: String?): Unit = setValue(PgpSymEncryptBytea2._2, value) - - /** - * Set the _2 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - fun set__2(field: Field): Unit { - setField(PgpSymEncryptBytea2._2, field) - } - - /** - * Set the _3 parameter IN value to the routine - */ - fun set__3(value: String?): Unit = setValue(PgpSymEncryptBytea2._3, value) - - /** - * Set the _3 parameter to the function to be used with a - * {@link org.jooq.Select} statement - */ - fun set__3(field: Field): Unit { - setField(PgpSymEncryptBytea2._3, field) - } -} diff --git a/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/references/Routines.kt b/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/references/Routines.kt deleted file mode 100644 index 87a654d..0000000 --- a/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/references/Routines.kt +++ /dev/null @@ -1,1662 +0,0 @@ -@file:Suppress("warnings") -/* - * This file is generated by jOOQ. - */ -package de.fiereu.openmmo.server.login.jooq.routines.references - - -import de.fiereu.openmmo.server.login.jooq.routines.Armor1 -import de.fiereu.openmmo.server.login.jooq.routines.Armor2 -import de.fiereu.openmmo.server.login.jooq.routines.Crypt -import de.fiereu.openmmo.server.login.jooq.routines.Dearmor -import de.fiereu.openmmo.server.login.jooq.routines.Decrypt -import de.fiereu.openmmo.server.login.jooq.routines.DecryptIv -import de.fiereu.openmmo.server.login.jooq.routines.Digest1 -import de.fiereu.openmmo.server.login.jooq.routines.Digest2 -import de.fiereu.openmmo.server.login.jooq.routines.Encrypt -import de.fiereu.openmmo.server.login.jooq.routines.EncryptIv -import de.fiereu.openmmo.server.login.jooq.routines.GenRandomBytes -import de.fiereu.openmmo.server.login.jooq.routines.GenRandomUuid -import de.fiereu.openmmo.server.login.jooq.routines.GenSalt1 -import de.fiereu.openmmo.server.login.jooq.routines.GenSalt2 -import de.fiereu.openmmo.server.login.jooq.routines.Hmac1 -import de.fiereu.openmmo.server.login.jooq.routines.Hmac2 -import de.fiereu.openmmo.server.login.jooq.routines.PgpKeyId -import de.fiereu.openmmo.server.login.jooq.routines.PgpPubDecrypt1 -import de.fiereu.openmmo.server.login.jooq.routines.PgpPubDecrypt2 -import de.fiereu.openmmo.server.login.jooq.routines.PgpPubDecrypt3 -import de.fiereu.openmmo.server.login.jooq.routines.PgpPubDecryptBytea1 -import de.fiereu.openmmo.server.login.jooq.routines.PgpPubDecryptBytea2 -import de.fiereu.openmmo.server.login.jooq.routines.PgpPubDecryptBytea3 -import de.fiereu.openmmo.server.login.jooq.routines.PgpPubEncrypt1 -import de.fiereu.openmmo.server.login.jooq.routines.PgpPubEncrypt2 -import de.fiereu.openmmo.server.login.jooq.routines.PgpPubEncryptBytea1 -import de.fiereu.openmmo.server.login.jooq.routines.PgpPubEncryptBytea2 -import de.fiereu.openmmo.server.login.jooq.routines.PgpSymDecrypt1 -import de.fiereu.openmmo.server.login.jooq.routines.PgpSymDecrypt2 -import de.fiereu.openmmo.server.login.jooq.routines.PgpSymDecryptBytea1 -import de.fiereu.openmmo.server.login.jooq.routines.PgpSymDecryptBytea2 -import de.fiereu.openmmo.server.login.jooq.routines.PgpSymEncrypt1 -import de.fiereu.openmmo.server.login.jooq.routines.PgpSymEncrypt2 -import de.fiereu.openmmo.server.login.jooq.routines.PgpSymEncryptBytea1 -import de.fiereu.openmmo.server.login.jooq.routines.PgpSymEncryptBytea2 - -import java.util.UUID - -import org.jooq.Configuration -import org.jooq.Field - - - -/** - * Call public.armor - */ -fun armor1( - configuration: Configuration - , __1: ByteArray? -): String? { - val f = Armor1() - f.set__1(__1) - - f.execute(configuration) - return f.returnValue -} - -/** - * Get public.armor as a field. - */ -fun armor1( - __1: ByteArray? -): Field { - val f = Armor1() - f.set__1(__1) - - return f.asField() -} - -/** - * Get public.armor as a field. - */ -fun armor1( - __1: Field -): Field { - val f = Armor1() - f.set__1(__1) - - return f.asField() -} - -/** - * Call public.armor - */ -fun armor2( - configuration: Configuration - , __1: ByteArray? - , __2: Array? - , __3: Array? -): String? { - val f = Armor2() - f.set__1(__1) - f.set__2(__2) - f.set__3(__3) - - f.execute(configuration) - return f.returnValue -} - -/** - * Get public.armor as a field. - */ -fun armor2( - __1: ByteArray? - , __2: Array? - , __3: Array? -): Field { - val f = Armor2() - f.set__1(__1) - f.set__2(__2) - f.set__3(__3) - - return f.asField() -} - -/** - * Get public.armor as a field. - */ -fun armor2( - __1: Field - , __2: Field?> - , __3: Field?> -): Field { - val f = Armor2() - f.set__1(__1) - f.set__2(__2) - f.set__3(__3) - - return f.asField() -} - -/** - * Call public.crypt - */ -fun crypt( - configuration: Configuration - , __1: String? - , __2: String? -): String? { - val f = Crypt() - f.set__1(__1) - f.set__2(__2) - - f.execute(configuration) - return f.returnValue -} - -/** - * Get public.crypt as a field. - */ -fun crypt( - __1: String? - , __2: String? -): Field { - val f = Crypt() - f.set__1(__1) - f.set__2(__2) - - return f.asField() -} - -/** - * Get public.crypt as a field. - */ -fun crypt( - __1: Field - , __2: Field -): Field { - val f = Crypt() - f.set__1(__1) - f.set__2(__2) - - return f.asField() -} - -/** - * Call public.dearmor - */ -fun dearmor( - configuration: Configuration - , __1: String? -): ByteArray? { - val f = Dearmor() - f.set__1(__1) - - f.execute(configuration) - return f.returnValue -} - -/** - * Get public.dearmor as a field. - */ -fun dearmor( - __1: String? -): Field { - val f = Dearmor() - f.set__1(__1) - - return f.asField() -} - -/** - * Get public.dearmor as a field. - */ -fun dearmor( - __1: Field -): Field { - val f = Dearmor() - f.set__1(__1) - - return f.asField() -} - -/** - * Call public.decrypt - */ -fun decrypt( - configuration: Configuration - , __1: ByteArray? - , __2: ByteArray? - , __3: String? -): ByteArray? { - val f = Decrypt() - f.set__1(__1) - f.set__2(__2) - f.set__3(__3) - - f.execute(configuration) - return f.returnValue -} - -/** - * Get public.decrypt as a field. - */ -fun decrypt( - __1: ByteArray? - , __2: ByteArray? - , __3: String? -): Field { - val f = Decrypt() - f.set__1(__1) - f.set__2(__2) - f.set__3(__3) - - return f.asField() -} - -/** - * Get public.decrypt as a field. - */ -fun decrypt( - __1: Field - , __2: Field - , __3: Field -): Field { - val f = Decrypt() - f.set__1(__1) - f.set__2(__2) - f.set__3(__3) - - return f.asField() -} - -/** - * Call public.decrypt_iv - */ -fun decryptIv( - configuration: Configuration - , __1: ByteArray? - , __2: ByteArray? - , __3: ByteArray? - , __4: String? -): ByteArray? { - val f = DecryptIv() - f.set__1(__1) - f.set__2(__2) - f.set__3(__3) - f.set__4(__4) - - f.execute(configuration) - return f.returnValue -} - -/** - * Get public.decrypt_iv as a field. - */ -fun decryptIv( - __1: ByteArray? - , __2: ByteArray? - , __3: ByteArray? - , __4: String? -): Field { - val f = DecryptIv() - f.set__1(__1) - f.set__2(__2) - f.set__3(__3) - f.set__4(__4) - - return f.asField() -} - -/** - * Get public.decrypt_iv as a field. - */ -fun decryptIv( - __1: Field - , __2: Field - , __3: Field - , __4: Field -): Field { - val f = DecryptIv() - f.set__1(__1) - f.set__2(__2) - f.set__3(__3) - f.set__4(__4) - - return f.asField() -} - -/** - * Call public.digest - */ -fun digest1( - configuration: Configuration - , __1: String? - , __2: String? -): ByteArray? { - val f = Digest1() - f.set__1(__1) - f.set__2(__2) - - f.execute(configuration) - return f.returnValue -} - -/** - * Get public.digest as a field. - */ -fun digest1( - __1: String? - , __2: String? -): Field { - val f = Digest1() - f.set__1(__1) - f.set__2(__2) - - return f.asField() -} - -/** - * Get public.digest as a field. - */ -fun digest1( - __1: Field - , __2: Field -): Field { - val f = Digest1() - f.set__1(__1) - f.set__2(__2) - - return f.asField() -} - -/** - * Call public.digest - */ -fun digest2( - configuration: Configuration - , __1: ByteArray? - , __2: String? -): ByteArray? { - val f = Digest2() - f.set__1(__1) - f.set__2(__2) - - f.execute(configuration) - return f.returnValue -} - -/** - * Get public.digest as a field. - */ -fun digest2( - __1: ByteArray? - , __2: String? -): Field { - val f = Digest2() - f.set__1(__1) - f.set__2(__2) - - return f.asField() -} - -/** - * Get public.digest as a field. - */ -fun digest2( - __1: Field - , __2: Field -): Field { - val f = Digest2() - f.set__1(__1) - f.set__2(__2) - - return f.asField() -} - -/** - * Call public.encrypt - */ -fun encrypt( - configuration: Configuration - , __1: ByteArray? - , __2: ByteArray? - , __3: String? -): ByteArray? { - val f = Encrypt() - f.set__1(__1) - f.set__2(__2) - f.set__3(__3) - - f.execute(configuration) - return f.returnValue -} - -/** - * Get public.encrypt as a field. - */ -fun encrypt( - __1: ByteArray? - , __2: ByteArray? - , __3: String? -): Field { - val f = Encrypt() - f.set__1(__1) - f.set__2(__2) - f.set__3(__3) - - return f.asField() -} - -/** - * Get public.encrypt as a field. - */ -fun encrypt( - __1: Field - , __2: Field - , __3: Field -): Field { - val f = Encrypt() - f.set__1(__1) - f.set__2(__2) - f.set__3(__3) - - return f.asField() -} - -/** - * Call public.encrypt_iv - */ -fun encryptIv( - configuration: Configuration - , __1: ByteArray? - , __2: ByteArray? - , __3: ByteArray? - , __4: String? -): ByteArray? { - val f = EncryptIv() - f.set__1(__1) - f.set__2(__2) - f.set__3(__3) - f.set__4(__4) - - f.execute(configuration) - return f.returnValue -} - -/** - * Get public.encrypt_iv as a field. - */ -fun encryptIv( - __1: ByteArray? - , __2: ByteArray? - , __3: ByteArray? - , __4: String? -): Field { - val f = EncryptIv() - f.set__1(__1) - f.set__2(__2) - f.set__3(__3) - f.set__4(__4) - - return f.asField() -} - -/** - * Get public.encrypt_iv as a field. - */ -fun encryptIv( - __1: Field - , __2: Field - , __3: Field - , __4: Field -): Field { - val f = EncryptIv() - f.set__1(__1) - f.set__2(__2) - f.set__3(__3) - f.set__4(__4) - - return f.asField() -} - -/** - * Call public.gen_random_bytes - */ -fun genRandomBytes( - configuration: Configuration - , __1: Int? -): ByteArray? { - val f = GenRandomBytes() - f.set__1(__1) - - f.execute(configuration) - return f.returnValue -} - -/** - * Get public.gen_random_bytes as a field. - */ -fun genRandomBytes( - __1: Int? -): Field { - val f = GenRandomBytes() - f.set__1(__1) - - return f.asField() -} - -/** - * Get public.gen_random_bytes as a field. - */ -fun genRandomBytes( - __1: Field -): Field { - val f = GenRandomBytes() - f.set__1(__1) - - return f.asField() -} - -/** - * Call public.gen_random_uuid - */ -fun genRandomUuid( - configuration: Configuration -): UUID? { - val f = GenRandomUuid() - - f.execute(configuration) - return f.returnValue -} - -/** - * Get public.gen_random_uuid as a field. - */ -fun genRandomUuid(): Field { - val f = GenRandomUuid() - - return f.asField() -} - -/** - * Call public.gen_salt - */ -fun genSalt1( - configuration: Configuration - , __1: String? -): String? { - val f = GenSalt1() - f.set__1(__1) - - f.execute(configuration) - return f.returnValue -} - -/** - * Get public.gen_salt as a field. - */ -fun genSalt1( - __1: String? -): Field { - val f = GenSalt1() - f.set__1(__1) - - return f.asField() -} - -/** - * Get public.gen_salt as a field. - */ -fun genSalt1( - __1: Field -): Field { - val f = GenSalt1() - f.set__1(__1) - - return f.asField() -} - -/** - * Call public.gen_salt - */ -fun genSalt2( - configuration: Configuration - , __1: String? - , __2: Int? -): String? { - val f = GenSalt2() - f.set__1(__1) - f.set__2(__2) - - f.execute(configuration) - return f.returnValue -} - -/** - * Get public.gen_salt as a field. - */ -fun genSalt2( - __1: String? - , __2: Int? -): Field { - val f = GenSalt2() - f.set__1(__1) - f.set__2(__2) - - return f.asField() -} - -/** - * Get public.gen_salt as a field. - */ -fun genSalt2( - __1: Field - , __2: Field -): Field { - val f = GenSalt2() - f.set__1(__1) - f.set__2(__2) - - return f.asField() -} - -/** - * Call public.hmac - */ -fun hmac1( - configuration: Configuration - , __1: String? - , __2: String? - , __3: String? -): ByteArray? { - val f = Hmac1() - f.set__1(__1) - f.set__2(__2) - f.set__3(__3) - - f.execute(configuration) - return f.returnValue -} - -/** - * Get public.hmac as a field. - */ -fun hmac1( - __1: String? - , __2: String? - , __3: String? -): Field { - val f = Hmac1() - f.set__1(__1) - f.set__2(__2) - f.set__3(__3) - - return f.asField() -} - -/** - * Get public.hmac as a field. - */ -fun hmac1( - __1: Field - , __2: Field - , __3: Field -): Field { - val f = Hmac1() - f.set__1(__1) - f.set__2(__2) - f.set__3(__3) - - return f.asField() -} - -/** - * Call public.hmac - */ -fun hmac2( - configuration: Configuration - , __1: ByteArray? - , __2: ByteArray? - , __3: String? -): ByteArray? { - val f = Hmac2() - f.set__1(__1) - f.set__2(__2) - f.set__3(__3) - - f.execute(configuration) - return f.returnValue -} - -/** - * Get public.hmac as a field. - */ -fun hmac2( - __1: ByteArray? - , __2: ByteArray? - , __3: String? -): Field { - val f = Hmac2() - f.set__1(__1) - f.set__2(__2) - f.set__3(__3) - - return f.asField() -} - -/** - * Get public.hmac as a field. - */ -fun hmac2( - __1: Field - , __2: Field - , __3: Field -): Field { - val f = Hmac2() - f.set__1(__1) - f.set__2(__2) - f.set__3(__3) - - return f.asField() -} - -/** - * Call public.pgp_key_id - */ -fun pgpKeyId( - configuration: Configuration - , __1: ByteArray? -): String? { - val f = PgpKeyId() - f.set__1(__1) - - f.execute(configuration) - return f.returnValue -} - -/** - * Get public.pgp_key_id as a field. - */ -fun pgpKeyId( - __1: ByteArray? -): Field { - val f = PgpKeyId() - f.set__1(__1) - - return f.asField() -} - -/** - * Get public.pgp_key_id as a field. - */ -fun pgpKeyId( - __1: Field -): Field { - val f = PgpKeyId() - f.set__1(__1) - - return f.asField() -} - -/** - * Call public.pgp_pub_decrypt - */ -fun pgpPubDecrypt1( - configuration: Configuration - , __1: ByteArray? - , __2: ByteArray? -): String? { - val f = PgpPubDecrypt1() - f.set__1(__1) - f.set__2(__2) - - f.execute(configuration) - return f.returnValue -} - -/** - * Get public.pgp_pub_decrypt as a field. - */ -fun pgpPubDecrypt1( - __1: ByteArray? - , __2: ByteArray? -): Field { - val f = PgpPubDecrypt1() - f.set__1(__1) - f.set__2(__2) - - return f.asField() -} - -/** - * Get public.pgp_pub_decrypt as a field. - */ -fun pgpPubDecrypt1( - __1: Field - , __2: Field -): Field { - val f = PgpPubDecrypt1() - f.set__1(__1) - f.set__2(__2) - - return f.asField() -} - -/** - * Call public.pgp_pub_decrypt - */ -fun pgpPubDecrypt2( - configuration: Configuration - , __1: ByteArray? - , __2: ByteArray? - , __3: String? -): String? { - val f = PgpPubDecrypt2() - f.set__1(__1) - f.set__2(__2) - f.set__3(__3) - - f.execute(configuration) - return f.returnValue -} - -/** - * Get public.pgp_pub_decrypt as a field. - */ -fun pgpPubDecrypt2( - __1: ByteArray? - , __2: ByteArray? - , __3: String? -): Field { - val f = PgpPubDecrypt2() - f.set__1(__1) - f.set__2(__2) - f.set__3(__3) - - return f.asField() -} - -/** - * Get public.pgp_pub_decrypt as a field. - */ -fun pgpPubDecrypt2( - __1: Field - , __2: Field - , __3: Field -): Field { - val f = PgpPubDecrypt2() - f.set__1(__1) - f.set__2(__2) - f.set__3(__3) - - return f.asField() -} - -/** - * Call public.pgp_pub_decrypt - */ -fun pgpPubDecrypt3( - configuration: Configuration - , __1: ByteArray? - , __2: ByteArray? - , __3: String? - , __4: String? -): String? { - val f = PgpPubDecrypt3() - f.set__1(__1) - f.set__2(__2) - f.set__3(__3) - f.set__4(__4) - - f.execute(configuration) - return f.returnValue -} - -/** - * Get public.pgp_pub_decrypt as a field. - */ -fun pgpPubDecrypt3( - __1: ByteArray? - , __2: ByteArray? - , __3: String? - , __4: String? -): Field { - val f = PgpPubDecrypt3() - f.set__1(__1) - f.set__2(__2) - f.set__3(__3) - f.set__4(__4) - - return f.asField() -} - -/** - * Get public.pgp_pub_decrypt as a field. - */ -fun pgpPubDecrypt3( - __1: Field - , __2: Field - , __3: Field - , __4: Field -): Field { - val f = PgpPubDecrypt3() - f.set__1(__1) - f.set__2(__2) - f.set__3(__3) - f.set__4(__4) - - return f.asField() -} - -/** - * Call public.pgp_pub_decrypt_bytea - */ -fun pgpPubDecryptBytea1( - configuration: Configuration - , __1: ByteArray? - , __2: ByteArray? -): ByteArray? { - val f = PgpPubDecryptBytea1() - f.set__1(__1) - f.set__2(__2) - - f.execute(configuration) - return f.returnValue -} - -/** - * Get public.pgp_pub_decrypt_bytea as a field. - */ -fun pgpPubDecryptBytea1( - __1: ByteArray? - , __2: ByteArray? -): Field { - val f = PgpPubDecryptBytea1() - f.set__1(__1) - f.set__2(__2) - - return f.asField() -} - -/** - * Get public.pgp_pub_decrypt_bytea as a field. - */ -fun pgpPubDecryptBytea1( - __1: Field - , __2: Field -): Field { - val f = PgpPubDecryptBytea1() - f.set__1(__1) - f.set__2(__2) - - return f.asField() -} - -/** - * Call public.pgp_pub_decrypt_bytea - */ -fun pgpPubDecryptBytea2( - configuration: Configuration - , __1: ByteArray? - , __2: ByteArray? - , __3: String? -): ByteArray? { - val f = PgpPubDecryptBytea2() - f.set__1(__1) - f.set__2(__2) - f.set__3(__3) - - f.execute(configuration) - return f.returnValue -} - -/** - * Get public.pgp_pub_decrypt_bytea as a field. - */ -fun pgpPubDecryptBytea2( - __1: ByteArray? - , __2: ByteArray? - , __3: String? -): Field { - val f = PgpPubDecryptBytea2() - f.set__1(__1) - f.set__2(__2) - f.set__3(__3) - - return f.asField() -} - -/** - * Get public.pgp_pub_decrypt_bytea as a field. - */ -fun pgpPubDecryptBytea2( - __1: Field - , __2: Field - , __3: Field -): Field { - val f = PgpPubDecryptBytea2() - f.set__1(__1) - f.set__2(__2) - f.set__3(__3) - - return f.asField() -} - -/** - * Call public.pgp_pub_decrypt_bytea - */ -fun pgpPubDecryptBytea3( - configuration: Configuration - , __1: ByteArray? - , __2: ByteArray? - , __3: String? - , __4: String? -): ByteArray? { - val f = PgpPubDecryptBytea3() - f.set__1(__1) - f.set__2(__2) - f.set__3(__3) - f.set__4(__4) - - f.execute(configuration) - return f.returnValue -} - -/** - * Get public.pgp_pub_decrypt_bytea as a field. - */ -fun pgpPubDecryptBytea3( - __1: ByteArray? - , __2: ByteArray? - , __3: String? - , __4: String? -): Field { - val f = PgpPubDecryptBytea3() - f.set__1(__1) - f.set__2(__2) - f.set__3(__3) - f.set__4(__4) - - return f.asField() -} - -/** - * Get public.pgp_pub_decrypt_bytea as a field. - */ -fun pgpPubDecryptBytea3( - __1: Field - , __2: Field - , __3: Field - , __4: Field -): Field { - val f = PgpPubDecryptBytea3() - f.set__1(__1) - f.set__2(__2) - f.set__3(__3) - f.set__4(__4) - - return f.asField() -} - -/** - * Call public.pgp_pub_encrypt - */ -fun pgpPubEncrypt1( - configuration: Configuration - , __1: String? - , __2: ByteArray? -): ByteArray? { - val f = PgpPubEncrypt1() - f.set__1(__1) - f.set__2(__2) - - f.execute(configuration) - return f.returnValue -} - -/** - * Get public.pgp_pub_encrypt as a field. - */ -fun pgpPubEncrypt1( - __1: String? - , __2: ByteArray? -): Field { - val f = PgpPubEncrypt1() - f.set__1(__1) - f.set__2(__2) - - return f.asField() -} - -/** - * Get public.pgp_pub_encrypt as a field. - */ -fun pgpPubEncrypt1( - __1: Field - , __2: Field -): Field { - val f = PgpPubEncrypt1() - f.set__1(__1) - f.set__2(__2) - - return f.asField() -} - -/** - * Call public.pgp_pub_encrypt - */ -fun pgpPubEncrypt2( - configuration: Configuration - , __1: String? - , __2: ByteArray? - , __3: String? -): ByteArray? { - val f = PgpPubEncrypt2() - f.set__1(__1) - f.set__2(__2) - f.set__3(__3) - - f.execute(configuration) - return f.returnValue -} - -/** - * Get public.pgp_pub_encrypt as a field. - */ -fun pgpPubEncrypt2( - __1: String? - , __2: ByteArray? - , __3: String? -): Field { - val f = PgpPubEncrypt2() - f.set__1(__1) - f.set__2(__2) - f.set__3(__3) - - return f.asField() -} - -/** - * Get public.pgp_pub_encrypt as a field. - */ -fun pgpPubEncrypt2( - __1: Field - , __2: Field - , __3: Field -): Field { - val f = PgpPubEncrypt2() - f.set__1(__1) - f.set__2(__2) - f.set__3(__3) - - return f.asField() -} - -/** - * Call public.pgp_pub_encrypt_bytea - */ -fun pgpPubEncryptBytea1( - configuration: Configuration - , __1: ByteArray? - , __2: ByteArray? -): ByteArray? { - val f = PgpPubEncryptBytea1() - f.set__1(__1) - f.set__2(__2) - - f.execute(configuration) - return f.returnValue -} - -/** - * Get public.pgp_pub_encrypt_bytea as a field. - */ -fun pgpPubEncryptBytea1( - __1: ByteArray? - , __2: ByteArray? -): Field { - val f = PgpPubEncryptBytea1() - f.set__1(__1) - f.set__2(__2) - - return f.asField() -} - -/** - * Get public.pgp_pub_encrypt_bytea as a field. - */ -fun pgpPubEncryptBytea1( - __1: Field - , __2: Field -): Field { - val f = PgpPubEncryptBytea1() - f.set__1(__1) - f.set__2(__2) - - return f.asField() -} - -/** - * Call public.pgp_pub_encrypt_bytea - */ -fun pgpPubEncryptBytea2( - configuration: Configuration - , __1: ByteArray? - , __2: ByteArray? - , __3: String? -): ByteArray? { - val f = PgpPubEncryptBytea2() - f.set__1(__1) - f.set__2(__2) - f.set__3(__3) - - f.execute(configuration) - return f.returnValue -} - -/** - * Get public.pgp_pub_encrypt_bytea as a field. - */ -fun pgpPubEncryptBytea2( - __1: ByteArray? - , __2: ByteArray? - , __3: String? -): Field { - val f = PgpPubEncryptBytea2() - f.set__1(__1) - f.set__2(__2) - f.set__3(__3) - - return f.asField() -} - -/** - * Get public.pgp_pub_encrypt_bytea as a field. - */ -fun pgpPubEncryptBytea2( - __1: Field - , __2: Field - , __3: Field -): Field { - val f = PgpPubEncryptBytea2() - f.set__1(__1) - f.set__2(__2) - f.set__3(__3) - - return f.asField() -} - -/** - * Call public.pgp_sym_decrypt - */ -fun pgpSymDecrypt1( - configuration: Configuration - , __1: ByteArray? - , __2: String? -): String? { - val f = PgpSymDecrypt1() - f.set__1(__1) - f.set__2(__2) - - f.execute(configuration) - return f.returnValue -} - -/** - * Get public.pgp_sym_decrypt as a field. - */ -fun pgpSymDecrypt1( - __1: ByteArray? - , __2: String? -): Field { - val f = PgpSymDecrypt1() - f.set__1(__1) - f.set__2(__2) - - return f.asField() -} - -/** - * Get public.pgp_sym_decrypt as a field. - */ -fun pgpSymDecrypt1( - __1: Field - , __2: Field -): Field { - val f = PgpSymDecrypt1() - f.set__1(__1) - f.set__2(__2) - - return f.asField() -} - -/** - * Call public.pgp_sym_decrypt - */ -fun pgpSymDecrypt2( - configuration: Configuration - , __1: ByteArray? - , __2: String? - , __3: String? -): String? { - val f = PgpSymDecrypt2() - f.set__1(__1) - f.set__2(__2) - f.set__3(__3) - - f.execute(configuration) - return f.returnValue -} - -/** - * Get public.pgp_sym_decrypt as a field. - */ -fun pgpSymDecrypt2( - __1: ByteArray? - , __2: String? - , __3: String? -): Field { - val f = PgpSymDecrypt2() - f.set__1(__1) - f.set__2(__2) - f.set__3(__3) - - return f.asField() -} - -/** - * Get public.pgp_sym_decrypt as a field. - */ -fun pgpSymDecrypt2( - __1: Field - , __2: Field - , __3: Field -): Field { - val f = PgpSymDecrypt2() - f.set__1(__1) - f.set__2(__2) - f.set__3(__3) - - return f.asField() -} - -/** - * Call public.pgp_sym_decrypt_bytea - */ -fun pgpSymDecryptBytea1( - configuration: Configuration - , __1: ByteArray? - , __2: String? -): ByteArray? { - val f = PgpSymDecryptBytea1() - f.set__1(__1) - f.set__2(__2) - - f.execute(configuration) - return f.returnValue -} - -/** - * Get public.pgp_sym_decrypt_bytea as a field. - */ -fun pgpSymDecryptBytea1( - __1: ByteArray? - , __2: String? -): Field { - val f = PgpSymDecryptBytea1() - f.set__1(__1) - f.set__2(__2) - - return f.asField() -} - -/** - * Get public.pgp_sym_decrypt_bytea as a field. - */ -fun pgpSymDecryptBytea1( - __1: Field - , __2: Field -): Field { - val f = PgpSymDecryptBytea1() - f.set__1(__1) - f.set__2(__2) - - return f.asField() -} - -/** - * Call public.pgp_sym_decrypt_bytea - */ -fun pgpSymDecryptBytea2( - configuration: Configuration - , __1: ByteArray? - , __2: String? - , __3: String? -): ByteArray? { - val f = PgpSymDecryptBytea2() - f.set__1(__1) - f.set__2(__2) - f.set__3(__3) - - f.execute(configuration) - return f.returnValue -} - -/** - * Get public.pgp_sym_decrypt_bytea as a field. - */ -fun pgpSymDecryptBytea2( - __1: ByteArray? - , __2: String? - , __3: String? -): Field { - val f = PgpSymDecryptBytea2() - f.set__1(__1) - f.set__2(__2) - f.set__3(__3) - - return f.asField() -} - -/** - * Get public.pgp_sym_decrypt_bytea as a field. - */ -fun pgpSymDecryptBytea2( - __1: Field - , __2: Field - , __3: Field -): Field { - val f = PgpSymDecryptBytea2() - f.set__1(__1) - f.set__2(__2) - f.set__3(__3) - - return f.asField() -} - -/** - * Call public.pgp_sym_encrypt - */ -fun pgpSymEncrypt1( - configuration: Configuration - , __1: String? - , __2: String? -): ByteArray? { - val f = PgpSymEncrypt1() - f.set__1(__1) - f.set__2(__2) - - f.execute(configuration) - return f.returnValue -} - -/** - * Get public.pgp_sym_encrypt as a field. - */ -fun pgpSymEncrypt1( - __1: String? - , __2: String? -): Field { - val f = PgpSymEncrypt1() - f.set__1(__1) - f.set__2(__2) - - return f.asField() -} - -/** - * Get public.pgp_sym_encrypt as a field. - */ -fun pgpSymEncrypt1( - __1: Field - , __2: Field -): Field { - val f = PgpSymEncrypt1() - f.set__1(__1) - f.set__2(__2) - - return f.asField() -} - -/** - * Call public.pgp_sym_encrypt - */ -fun pgpSymEncrypt2( - configuration: Configuration - , __1: String? - , __2: String? - , __3: String? -): ByteArray? { - val f = PgpSymEncrypt2() - f.set__1(__1) - f.set__2(__2) - f.set__3(__3) - - f.execute(configuration) - return f.returnValue -} - -/** - * Get public.pgp_sym_encrypt as a field. - */ -fun pgpSymEncrypt2( - __1: String? - , __2: String? - , __3: String? -): Field { - val f = PgpSymEncrypt2() - f.set__1(__1) - f.set__2(__2) - f.set__3(__3) - - return f.asField() -} - -/** - * Get public.pgp_sym_encrypt as a field. - */ -fun pgpSymEncrypt2( - __1: Field - , __2: Field - , __3: Field -): Field { - val f = PgpSymEncrypt2() - f.set__1(__1) - f.set__2(__2) - f.set__3(__3) - - return f.asField() -} - -/** - * Call public.pgp_sym_encrypt_bytea - */ -fun pgpSymEncryptBytea1( - configuration: Configuration - , __1: ByteArray? - , __2: String? -): ByteArray? { - val f = PgpSymEncryptBytea1() - f.set__1(__1) - f.set__2(__2) - - f.execute(configuration) - return f.returnValue -} - -/** - * Get public.pgp_sym_encrypt_bytea as a field. - */ -fun pgpSymEncryptBytea1( - __1: ByteArray? - , __2: String? -): Field { - val f = PgpSymEncryptBytea1() - f.set__1(__1) - f.set__2(__2) - - return f.asField() -} - -/** - * Get public.pgp_sym_encrypt_bytea as a field. - */ -fun pgpSymEncryptBytea1( - __1: Field - , __2: Field -): Field { - val f = PgpSymEncryptBytea1() - f.set__1(__1) - f.set__2(__2) - - return f.asField() -} - -/** - * Call public.pgp_sym_encrypt_bytea - */ -fun pgpSymEncryptBytea2( - configuration: Configuration - , __1: ByteArray? - , __2: String? - , __3: String? -): ByteArray? { - val f = PgpSymEncryptBytea2() - f.set__1(__1) - f.set__2(__2) - f.set__3(__3) - - f.execute(configuration) - return f.returnValue -} - -/** - * Get public.pgp_sym_encrypt_bytea as a field. - */ -fun pgpSymEncryptBytea2( - __1: ByteArray? - , __2: String? - , __3: String? -): Field { - val f = PgpSymEncryptBytea2() - f.set__1(__1) - f.set__2(__2) - f.set__3(__3) - - return f.asField() -} - -/** - * Get public.pgp_sym_encrypt_bytea as a field. - */ -fun pgpSymEncryptBytea2( - __1: Field - , __2: Field - , __3: Field -): Field { - val f = PgpSymEncryptBytea2() - f.set__1(__1) - f.set__2(__2) - f.set__3(__3) - - return f.asField() -} diff --git a/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/tables/User.kt b/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/tables/User.kt deleted file mode 100644 index 792a668..0000000 --- a/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/tables/User.kt +++ /dev/null @@ -1,186 +0,0 @@ -/* - * This file is generated by jOOQ. - */ -package de.fiereu.openmmo.server.login.jooq.tables - - -import de.fiereu.openmmo.server.login.jooq.Public -import de.fiereu.openmmo.server.login.jooq.keys.USER_PKEY -import de.fiereu.openmmo.server.login.jooq.keys.USER_USERNAME_KEY -import de.fiereu.openmmo.server.login.jooq.tables.records.UserRecord - -import java.time.LocalDateTime - -import kotlin.collections.Collection -import kotlin.collections.List - -import org.jooq.Condition -import org.jooq.Field -import org.jooq.ForeignKey -import org.jooq.Identity -import org.jooq.InverseForeignKey -import org.jooq.Name -import org.jooq.PlainSQL -import org.jooq.QueryPart -import org.jooq.Record -import org.jooq.SQL -import org.jooq.Schema -import org.jooq.Select -import org.jooq.Stringly -import org.jooq.Table -import org.jooq.TableField -import org.jooq.TableOptions -import org.jooq.UniqueKey -import org.jooq.impl.DSL -import org.jooq.impl.SQLDataType -import org.jooq.impl.TableImpl - - -/** - * This class is generated by jOOQ. - */ -@Suppress("warnings") -open class User( - alias: Name, - path: Table?, - childPath: ForeignKey?, - parentPath: InverseForeignKey?, - aliased: Table?, - parameters: Array?>?, - where: Condition? -): TableImpl( - alias, - Public.PUBLIC, - path, - childPath, - parentPath, - aliased, - parameters, - DSL.comment(""), - TableOptions.table(), - where, -) { - companion object { - - /** - * The reference instance of public.user - */ - val USER: User = User() - } - - /** - * The class holding records for this type - */ - override fun getRecordType(): Class = UserRecord::class.java - - /** - * The column public.user.id. - */ - val ID: TableField = createField(DSL.name("id"), SQLDataType.INTEGER.nullable(false).identity(true), this, "") - - /** - * The column public.user.created_at. - */ - val CREATED_AT: TableField = createField(DSL.name("created_at"), SQLDataType.LOCALDATETIME(6).nullable(false).defaultValue(DSL.field(DSL.raw("CURRENT_TIMESTAMP"), SQLDataType.LOCALDATETIME)), this, "") - - /** - * The column public.user.username. - */ - val USERNAME: TableField = createField(DSL.name("username"), SQLDataType.VARCHAR(12).nullable(false), this, "") - - /** - * The column public.user.password. - */ - val PASSWORD: TableField = createField(DSL.name("password"), SQLDataType.BLOB.nullable(false), this, "") - - private constructor(alias: Name, aliased: Table?): this(alias, null, null, null, aliased, null, null) - private constructor(alias: Name, aliased: Table?, parameters: Array?>?): this(alias, null, null, null, aliased, parameters, null) - private constructor(alias: Name, aliased: Table?, where: Condition?): this(alias, null, null, null, aliased, null, where) - - /** - * Create an aliased public.user table reference - */ - constructor(alias: String): this(DSL.name(alias)) - - /** - * Create an aliased public.user table reference - */ - constructor(alias: Name): this(alias, null) - - /** - * Create a public.user table reference - */ - constructor(): this(DSL.name("user"), null) - override fun getSchema(): Schema? = if (aliased()) null else Public.PUBLIC - override fun getIdentity(): Identity = super.getIdentity() as Identity - override fun getPrimaryKey(): UniqueKey = USER_PKEY - override fun getUniqueKeys(): List> = listOf(USER_USERNAME_KEY) - override fun `as`(alias: String): User = User(DSL.name(alias), this) - override fun `as`(alias: Name): User = User(alias, this) - override fun `as`(alias: Table<*>): User = User(alias.qualifiedName, this) - - /** - * Rename this table - */ - override fun rename(name: String): User = User(DSL.name(name), null) - - /** - * Rename this table - */ - override fun rename(name: Name): User = User(name, null) - - /** - * Rename this table - */ - override fun rename(name: Table<*>): User = User(name.qualifiedName, null) - - /** - * Create an inline derived table from this table - */ - override fun where(condition: Condition?): User = User(qualifiedName, if (aliased()) this else null, condition) - - /** - * Create an inline derived table from this table - */ - override fun where(conditions: Collection): User = where(DSL.and(conditions)) - - /** - * Create an inline derived table from this table - */ - override fun where(vararg conditions: Condition?): User = where(DSL.and(*conditions)) - - /** - * Create an inline derived table from this table - */ - override fun where(condition: Field?): User = where(DSL.condition(condition)) - - /** - * Create an inline derived table from this table - */ - @PlainSQL override fun where(condition: SQL): User = where(DSL.condition(condition)) - - /** - * Create an inline derived table from this table - */ - @PlainSQL override fun where(@Stringly.SQL condition: String): User = where(DSL.condition(condition)) - - /** - * Create an inline derived table from this table - */ - @PlainSQL override fun where(@Stringly.SQL condition: String, vararg binds: Any?): User = where(DSL.condition(condition, *binds)) - - /** - * Create an inline derived table from this table - */ - @PlainSQL override fun where(@Stringly.SQL condition: String, vararg parts: QueryPart): User = where(DSL.condition(condition, *parts)) - - /** - * Create an inline derived table from this table - */ - override fun whereExists(select: Select<*>): User = where(DSL.exists(select)) - - /** - * Create an inline derived table from this table - */ - override fun whereNotExists(select: Select<*>): User = where(DSL.notExists(select)) -} diff --git a/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/tables/records/UserRecord.kt b/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/tables/records/UserRecord.kt deleted file mode 100644 index 4dd7aa2..0000000 --- a/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/tables/records/UserRecord.kt +++ /dev/null @@ -1,53 +0,0 @@ -/* - * This file is generated by jOOQ. - */ -package de.fiereu.openmmo.server.login.jooq.tables.records - - -import de.fiereu.openmmo.server.login.jooq.tables.User - -import java.time.LocalDateTime - -import org.jooq.Record1 -import org.jooq.impl.UpdatableRecordImpl - - -/** - * This class is generated by jOOQ. - */ -@Suppress("warnings") -open class UserRecord() : UpdatableRecordImpl(User.USER) { - - open var id: Int? - set(value): Unit = set(0, value) - get(): Int? = get(0) as Int? - - open var createdAt: LocalDateTime? - set(value): Unit = set(1, value) - get(): LocalDateTime? = get(1) as LocalDateTime? - - open var username: String? - set(value): Unit = set(2, value) - get(): String? = get(2) as String? - - open var password: ByteArray? - set(value): Unit = set(3, value) - get(): ByteArray? = get(3) as ByteArray? - - // ------------------------------------------------------------------------- - // Primary key information - // ------------------------------------------------------------------------- - - override fun key(): Record1 = super.key() as Record1 - - /** - * Create a detached, initialised UserRecord - */ - constructor(id: Int? = null, createdAt: LocalDateTime? = null, username: String? = null, password: ByteArray? = null): this() { - this.id = id - this.createdAt = createdAt - this.username = username - this.password = password - resetTouchedOnNotNull() - } -} diff --git a/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/tables/references/Tables.kt b/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/tables/references/Tables.kt deleted file mode 100644 index 89472a7..0000000 --- a/server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/tables/references/Tables.kt +++ /dev/null @@ -1,15 +0,0 @@ -@file:Suppress("warnings") -/* - * This file is generated by jOOQ. - */ -package de.fiereu.openmmo.server.login.jooq.tables.references - - -import de.fiereu.openmmo.server.login.jooq.tables.User - - - -/** - * The table public.user. - */ -val USER: User = User.USER diff --git a/server.login/src/main/kotlin/de/fiereu/openmmo/server/login/LoginServer.kt b/server.login/src/main/kotlin/de/fiereu/openmmo/server/login/LoginServer.kt index 447af43..736e024 100644 --- a/server.login/src/main/kotlin/de/fiereu/openmmo/server/login/LoginServer.kt +++ b/server.login/src/main/kotlin/de/fiereu/openmmo/server/login/LoginServer.kt @@ -1,32 +1,56 @@ package de.fiereu.openmmo.server.login -import de.fiereu.openmmo.protocols.tls.LoginServerProtocol -import de.fiereu.openmmo.server.ServerBuilder -import de.fiereu.openmmo.server.config.ServerConfig -import de.fiereu.openmmo.server.config.TlsConfig -import de.fiereu.openmmo.server.io.resource -import de.fiereu.openmmo.server.keys.KeyLoader -import de.fiereu.openmmo.server.login.auth.InMemoryUserStore -import de.fiereu.openmmo.server.login.protocol.login.LoginProtocolHandler -import kotlinx.coroutines.CoroutineScope -import kotlinx.coroutines.Dispatchers -import kotlinx.coroutines.SupervisorJob +import de.fiereu.network.PipelineOptions +import de.fiereu.network.SessionIdentity +import de.fiereu.network.installNetwork +import de.fiereu.openmmo.net.login.LoginProtocol +import de.fiereu.openmmo.server.login.config.LoginServerConfig +import de.fiereu.openmmo.server.login.handler.LoginAppHandler +import io.github.oshai.kotlinlogging.KotlinLogging +import io.netty.bootstrap.ServerBootstrap +import io.netty.channel.ChannelOption +import io.netty.channel.EventLoopGroup +import io.netty.channel.socket.nio.NioServerSocketChannel +import java.security.interfaces.ECPrivateKey +import javax.inject.Inject +import javax.inject.Named +import javax.inject.Provider +import javax.inject.Singleton -fun main() { - val serverConfig = ServerConfig(port = 2106) - val tlsConfig = TlsConfig(checksumSize = 16) - val coroutineScope = CoroutineScope(SupervisorJob() + Dispatchers.Default) - val userService = InMemoryUserStore() - val server = - ServerBuilder.create() - .withCoroutineScope(coroutineScope) - .withConfig(serverConfig) - .withTlsConfig(tlsConfig) - .withPublicKey(KeyLoader.loadPemECPublicKey(resource("game.public.pem"))) - .withPrivateKey(KeyLoader.loadPemECPrivateKey(resource("game.private.pem"))) - .withChannelHandlerProvider { - LoginProtocolHandler(LoginServerProtocol(), serverConfig, coroutineScope, userService) - } - .build() - server.start() +private val log = KotlinLogging.logger {} + +@Singleton +class LoginServer +@Inject +constructor( + private val config: LoginServerConfig, + @Named("boss") private val bossGroup: EventLoopGroup, + @Named("worker") private val workerGroup: EventLoopGroup, + private val rootKey: ECPrivateKey, + private val handlerProvider: Provider, +) { + fun start() { + val channel = + ServerBootstrap() + .group(bossGroup, workerGroup) + .channel(NioServerSocketChannel::class.java) + .option(ChannelOption.SO_BACKLOG, 128) + .childOption(ChannelOption.TCP_NODELAY, true) + .installNetwork( + identity = SessionIdentity.ServerRoot(rootKey), + applicationProtocol = LoginProtocol, + applicationHandlerFactory = { handlerProvider.get() }, + options = PipelineOptions(checksumSize = config.checksumSize), + ) + .bind(config.host, config.port) + .sync() + .channel() + log.info { "Login server listening on ${channel.localAddress()}" } + channel.closeFuture().sync() + } + + fun shutdown() { + workerGroup.shutdownGracefully() + bossGroup.shutdownGracefully() + } } diff --git a/server.login/src/main/kotlin/de/fiereu/openmmo/server/login/Main.kt b/server.login/src/main/kotlin/de/fiereu/openmmo/server/login/Main.kt new file mode 100644 index 0000000..63a338e --- /dev/null +++ b/server.login/src/main/kotlin/de/fiereu/openmmo/server/login/Main.kt @@ -0,0 +1,10 @@ +package de.fiereu.openmmo.server.login + +import de.fiereu.openmmo.server.login.config.ConfigLoader +import de.fiereu.openmmo.server.login.di.DaggerLoginServerComponent + +fun main() { + val config = ConfigLoader.load() + val component = DaggerLoginServerComponent.factory().create(config) + component.server().start() +} diff --git a/server.login/src/main/kotlin/de/fiereu/openmmo/server/login/auth/UserService.kt b/server.login/src/main/kotlin/de/fiereu/openmmo/server/login/auth/UserService.kt index 2ff7f0d..1d2ad40 100644 --- a/server.login/src/main/kotlin/de/fiereu/openmmo/server/login/auth/UserService.kt +++ b/server.login/src/main/kotlin/de/fiereu/openmmo/server/login/auth/UserService.kt @@ -1,9 +1,11 @@ package de.fiereu.openmmo.server.login.auth import de.fiereu.openmmo.common.enums.LoginState +import java.security.MessageDigest import java.util.concurrent.ConcurrentHashMap - -private val log = io.github.oshai.kotlinlogging.KotlinLogging.logger {} +import java.util.concurrent.atomic.AtomicInteger +import javax.inject.Inject +import javax.inject.Singleton interface UserService { data class AuthResult(val state: LoginState, val userId: Int? = null) @@ -13,26 +15,24 @@ interface UserService { fun getUserId(username: String): Int? } -class InMemoryUserStore : UserService { - private val users = ConcurrentHashMap() - private val nextId = java.util.concurrent.atomic.AtomicInteger(1) +@Singleton +class InMemoryUserStore @Inject constructor() : UserService { - data class UserInfo(val id: Int, val passwordHash: String, val username: String) + private data class UserInfo(val id: Int, val passwordHash: String, val username: String) + + private val users = ConcurrentHashMap() + private val nextId = AtomicInteger(1) init { addUser("admin", "admin") addUser("test", "test") } - /** - * PokeMMO client sends a transformed password hash. We store the value the client sends and - * compare directly. For initial setup, we compute SHA-1 as a best guess. - */ + @Suppress("kotlin:S4790") fun addUser(username: String, password: String): Int { val id = nextId.getAndIncrement() - val sha1 = java.security.MessageDigest.getInstance("SHA-1") - val hashBytes = sha1.digest(password.toByteArray()) - val hex = hashBytes.joinToString("") { "%02x".format(it) } + val sha1 = MessageDigest.getInstance("SHA-1").digest(password.toByteArray()) + val hex = sha1.joinToString("") { "%02x".format(it) } users[username.lowercase()] = UserInfo(id, hex, username) return id } @@ -46,7 +46,5 @@ class InMemoryUserStore : UserService { return UserService.AuthResult(LoginState.AUTHED, user.id) } - override fun getUserId(username: String): Int? { - return users[username.lowercase()]?.id - } + override fun getUserId(username: String): Int? = users[username.lowercase()]?.id } diff --git a/server.login/src/main/kotlin/de/fiereu/openmmo/server/login/catalog/GameServerCatalog.kt b/server.login/src/main/kotlin/de/fiereu/openmmo/server/login/catalog/GameServerCatalog.kt new file mode 100644 index 0000000..f558aa7 --- /dev/null +++ b/server.login/src/main/kotlin/de/fiereu/openmmo/server/login/catalog/GameServerCatalog.kt @@ -0,0 +1,46 @@ +package de.fiereu.openmmo.server.login.catalog + +import com.github.maltalex.ineter.base.IPAddress +import com.github.maltalex.ineter.base.IPv4Address +import com.github.maltalex.ineter.base.IPv6Address +import de.fiereu.openmmo.net.login.packets.GameServer +import de.fiereu.openmmo.net.login.packets.GameServerNode +import javax.inject.Inject +import javax.inject.Singleton + +data class GameServerEntry( + val server: GameServer, + val node: GameServerNode, + val localAddress: IPAddress, + val localHostname: String, +) + +@Singleton +class GameServerCatalog @Inject constructor() { + private val entries: List = + listOf( + GameServerEntry( + server = + GameServer( + id = 0x00u, + name = "OpenMMO", + currentPlayers = 0u, + maxPlayers = 1u, + joinable = true, + ), + node = + GameServerNode( + iPv4Address = IPv4Address.of("127.0.0.1"), + iPv6Address = IPv6Address.of("::1"), + port = 7777u, + weight = 0x01u, + ), + localAddress = IPAddress.of("127.0.0.1"), + localHostname = "localhost", + ), + ) + + fun list(): List = entries.map { it.server } + + fun find(id: UByte): GameServerEntry? = entries.firstOrNull { it.server.id == id } +} diff --git a/server.login/src/main/kotlin/de/fiereu/openmmo/server/login/config/ConfigLoader.kt b/server.login/src/main/kotlin/de/fiereu/openmmo/server/login/config/ConfigLoader.kt new file mode 100644 index 0000000..c85d349 --- /dev/null +++ b/server.login/src/main/kotlin/de/fiereu/openmmo/server/login/config/ConfigLoader.kt @@ -0,0 +1,18 @@ +package de.fiereu.openmmo.server.login.config + +import com.typesafe.config.ConfigFactory + +object ConfigLoader { + fun load(): LoginServerConfig { + val config = ConfigFactory.load() + val secret = config.getString("server.sessionSecret") + require(secret.isNotEmpty()) { "server.sessionSecret must not be empty" } + return LoginServerConfig( + host = config.getString("server.host"), + port = config.getInt("server.port"), + checksumSize = config.getInt("server.checksumSize"), + rootKeyResource = config.getString("server.rootKeyResource"), + sessionSecret = secret.toByteArray(Charsets.UTF_8), + ) + } +} diff --git a/server.login/src/main/kotlin/de/fiereu/openmmo/server/login/config/LoginServerConfig.kt b/server.login/src/main/kotlin/de/fiereu/openmmo/server/login/config/LoginServerConfig.kt new file mode 100644 index 0000000..63d6385 --- /dev/null +++ b/server.login/src/main/kotlin/de/fiereu/openmmo/server/login/config/LoginServerConfig.kt @@ -0,0 +1,26 @@ +package de.fiereu.openmmo.server.login.config + +data class LoginServerConfig( + val host: String, + val port: Int, + val checksumSize: Int, + val rootKeyResource: String, + val sessionSecret: ByteArray, +) { + override fun equals(other: Any?): Boolean = + other is LoginServerConfig && + host == other.host && + port == other.port && + checksumSize == other.checksumSize && + rootKeyResource == other.rootKeyResource && + sessionSecret.contentEquals(other.sessionSecret) + + override fun hashCode(): Int { + var h = host.hashCode() + h = h * 31 + port + h = h * 31 + checksumSize + h = h * 31 + rootKeyResource.hashCode() + h = h * 31 + sessionSecret.contentHashCode() + return h + } +} diff --git a/server.login/src/main/kotlin/de/fiereu/openmmo/server/login/di/LoginServerComponent.kt b/server.login/src/main/kotlin/de/fiereu/openmmo/server/login/di/LoginServerComponent.kt new file mode 100644 index 0000000..ccaf6a7 --- /dev/null +++ b/server.login/src/main/kotlin/de/fiereu/openmmo/server/login/di/LoginServerComponent.kt @@ -0,0 +1,23 @@ +package de.fiereu.openmmo.server.login.di + +import dagger.BindsInstance +import dagger.Component +import de.fiereu.openmmo.server.login.LoginServer +import de.fiereu.openmmo.server.login.config.LoginServerConfig +import de.fiereu.openmmo.server.login.handler.LoginAppHandler +import javax.inject.Provider +import javax.inject.Singleton + +@Singleton +@Component(modules = [LoginServerModule::class]) +interface LoginServerComponent { + + fun server(): LoginServer + + fun handlerProvider(): Provider + + @Component.Factory + fun interface Factory { + fun create(@BindsInstance config: LoginServerConfig): LoginServerComponent + } +} diff --git a/server.login/src/main/kotlin/de/fiereu/openmmo/server/login/di/LoginServerModule.kt b/server.login/src/main/kotlin/de/fiereu/openmmo/server/login/di/LoginServerModule.kt new file mode 100644 index 0000000..f960bc1 --- /dev/null +++ b/server.login/src/main/kotlin/de/fiereu/openmmo/server/login/di/LoginServerModule.kt @@ -0,0 +1,52 @@ +package de.fiereu.openmmo.server.login.di + +import dagger.Binds +import dagger.Module +import dagger.Provides +import de.fiereu.openmmo.common.auth.SessionTokenIssuer +import de.fiereu.openmmo.common.io.PemKeyLoader +import de.fiereu.openmmo.common.io.resource +import de.fiereu.openmmo.server.login.auth.InMemoryUserStore +import de.fiereu.openmmo.server.login.auth.UserService +import de.fiereu.openmmo.server.login.config.LoginServerConfig +import io.netty.channel.EventLoopGroup +import io.netty.channel.MultiThreadIoEventLoopGroup +import io.netty.channel.nio.NioIoHandler +import java.security.interfaces.ECPrivateKey +import javax.inject.Named +import javax.inject.Singleton +import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.SupervisorJob + +@Module +abstract class LoginServerModule { + + @Binds @Singleton abstract fun userService(impl: InMemoryUserStore): UserService + + companion object { + @Provides + @Singleton + fun rootKey(config: LoginServerConfig): ECPrivateKey = + PemKeyLoader.loadEcPrivate(resource(config.rootKeyResource)) + + @Provides + @Singleton + fun tokenIssuer(config: LoginServerConfig): SessionTokenIssuer = + SessionTokenIssuer(config.sessionSecret) + + @Provides + @Singleton + @Named("boss") + fun bossGroup(): EventLoopGroup = MultiThreadIoEventLoopGroup(1, NioIoHandler.newFactory()) + + @Provides + @Singleton + @Named("worker") + fun workerGroup(): EventLoopGroup = MultiThreadIoEventLoopGroup(0, NioIoHandler.newFactory()) + + @Provides + @Singleton + fun coroutineScope(): CoroutineScope = CoroutineScope(SupervisorJob() + Dispatchers.Default) + } +} diff --git a/server.login/src/main/kotlin/de/fiereu/openmmo/server/login/handler/LoginAppHandler.kt b/server.login/src/main/kotlin/de/fiereu/openmmo/server/login/handler/LoginAppHandler.kt new file mode 100644 index 0000000..1e763f4 --- /dev/null +++ b/server.login/src/main/kotlin/de/fiereu/openmmo/server/login/handler/LoginAppHandler.kt @@ -0,0 +1,86 @@ +package de.fiereu.openmmo.server.login.handler + +import de.fiereu.network.PacketEvent +import de.fiereu.network.Side +import de.fiereu.network.coroutines.CoroutineProtocolHandler +import de.fiereu.openmmo.common.auth.SessionTokenIssuer +import de.fiereu.openmmo.common.enums.LoginState +import de.fiereu.openmmo.net.login.LoginProtocol +import de.fiereu.openmmo.net.login.packets.GameServerData +import de.fiereu.openmmo.net.login.packets.GameServerListPacket +import de.fiereu.openmmo.net.login.packets.GameServerNodesPacket +import de.fiereu.openmmo.net.login.packets.JoinGameServerPacket +import de.fiereu.openmmo.net.login.packets.LoginRequestPacket +import de.fiereu.openmmo.net.login.packets.LoginResponsePacket +import de.fiereu.openmmo.net.login.packets.PasswordLogin +import de.fiereu.openmmo.net.login.packets.RequestGameServerListPacket +import de.fiereu.openmmo.server.login.auth.UserService +import de.fiereu.openmmo.server.login.catalog.GameServerCatalog +import io.github.oshai.kotlinlogging.KotlinLogging +import javax.inject.Inject +import kotlinx.coroutines.CoroutineScope + +private val log = KotlinLogging.logger {} + +class LoginAppHandler +@Inject +constructor( + private val users: UserService, + private val catalog: GameServerCatalog, + private val tokenIssuer: SessionTokenIssuer, + scope: CoroutineScope, +) : CoroutineProtocolHandler(LoginProtocol, Side.SERVER, scope) { + + init { + onSuspend { event -> onLoginRequest(event) } + onSuspend { event -> onServerListRequest(event) } + onSuspend { event -> onJoinGameServer(event) } + } + + private fun onLoginRequest(event: PacketEvent) { + val packet = event.packet + val method = packet.method + if (method !is PasswordLogin) { + log.warn { "Unsupported login method ${method::class.simpleName} for ${packet.username}" } + event.session.send(LoginResponsePacket(LoginState.INVALID_PASSWORD)) + return + } + val result = users.authenticate(packet.username, method.password) + log.info { "Login attempt for ${packet.username}: ${result.state}" } + event.session.send(LoginResponsePacket(result.state)) + } + + private fun onServerListRequest(event: PacketEvent) { + event.session.send(GameServerListPacket(catalog.list())) + } + + private fun onJoinGameServer(event: PacketEvent) { + val entry = catalog.find(event.packet.gameServerId) + if (entry == null) { + log.warn { "Unknown game server id ${event.packet.gameServerId}" } + event.session.send(GameServerNodesPacket(LoginState.NO_GS_AVAILABLE)) + return + } + val token = tokenIssuer.issue(userId = ANONYMOUS_USER_ID) + val data = + GameServerData( + gameServerId = entry.server.id, + userId = ANONYMOUS_USER_ID.toInt(), + sessionToken = token.bytes, + localAddress = entry.localAddress, + localHostname = entry.localHostname, + port = entry.node.port, + ) + event.session.send( + GameServerNodesPacket( + loginState = LoginState.AUTHED, + gameServerData = data, + nodes = listOf(entry.node), + ), + ) + } + + companion object { + private const val ANONYMOUS_USER_ID = 1L + } +} diff --git a/server.login/src/main/kotlin/de/fiereu/openmmo/server/login/protocol/login/LoginProtocolHandler.kt b/server.login/src/main/kotlin/de/fiereu/openmmo/server/login/protocol/login/LoginProtocolHandler.kt deleted file mode 100644 index f19252c..0000000 --- a/server.login/src/main/kotlin/de/fiereu/openmmo/server/login/protocol/login/LoginProtocolHandler.kt +++ /dev/null @@ -1,97 +0,0 @@ -package de.fiereu.openmmo.server.login.protocol.login - -import com.github.maltalex.ineter.base.IPAddress -import com.github.maltalex.ineter.base.IPv4Address -import com.github.maltalex.ineter.base.IPv6Address -import de.fiereu.openmmo.common.enums.LoginState -import de.fiereu.openmmo.protocols.Protocol -import de.fiereu.openmmo.protocols.tls.packets.GameServer -import de.fiereu.openmmo.protocols.tls.packets.GameServerNode -import de.fiereu.openmmo.protocols.tls.packets.JoinGameServerPacket -import de.fiereu.openmmo.protocols.tls.packets.LoginRequestPacket -import de.fiereu.openmmo.protocols.tls.packets.RequestGameServerListPacket -import de.fiereu.openmmo.server.config.ServerConfig -import de.fiereu.openmmo.server.login.auth.UserService -import de.fiereu.openmmo.server.login.protocol.login.ext.respondForAuthedUser -import de.fiereu.openmmo.server.login.protocol.login.ext.respondTo -import de.fiereu.openmmo.server.login.protocol.login.ext.respondWithServers -import de.fiereu.openmmo.server.login.protocol.login.ext.respondWithState -import de.fiereu.openmmo.server.netty.handlers.ProtocolHandler -import de.fiereu.openmmo.server.protocol.PacketEvent -import io.github.oshai.kotlinlogging.KotlinLogging -import io.netty.channel.ChannelHandlerContext -import kotlinx.coroutines.CoroutineScope -import kotlinx.coroutines.launch - -private val log = KotlinLogging.logger {} - -class LoginProtocolHandler( - protocol: Protocol, - serverConfig: ServerConfig, - private val coroutineScope: CoroutineScope, - private val userService: UserService, -) : ProtocolHandler(protocol, serverConfig) { - - override fun onActive(ctx: ChannelHandlerContext) { - log.info { "Client ${ctx.channel().remoteAddress()} swapped to login protocol." } - } - - @Suppress("unchecked_cast") // Every cast is personally checked and signed off by me AT RUNTIME :P - override fun onPacketReceived(event: PacketEvent<*>) { - coroutineScope.launch { - when (event.packet) { - is LoginRequestPacket -> onLoginRequest(event as PacketEvent) - is RequestGameServerListPacket -> - onGameServerListRequest(event as PacketEvent) - is JoinGameServerPacket -> onServerSelection(event as PacketEvent) - else -> log.warn { "Unhandled login packet type: ${event.packet::class.simpleName}" } - } - } - } - - fun onLoginRequest(event: PacketEvent) { - val username = event.packet.username - val method = event.packet.method - if (method !is de.fiereu.openmmo.protocols.tls.packets.PasswordLogin) { - log.warn { "Unsupported login method: ${method::class.simpleName}" } - event.respondWithState(LoginState.INVALID_PASSWORD) - return - } - val password = method.password - log.info { "Login attempt for user '$username'" } - val result = userService.authenticate(username, password) - if (result.state != LoginState.AUTHED) { - log.warn { "Failed login for user '$username': ${result.state}" } - } else { - log.info { "Successful login for user '$username' (userId=${result.userId})" } - } - event.respondWithState(result.state) - } - - fun onGameServerListRequest(event: PacketEvent) { - log.info { "Received game server list request" } - // TODO replace hardcoded server list with actual server list from database or config - event.respondWithServers(listOf(GameServer(0x00u, "OpenMMO", 0u, 1u, true))) - } - - fun onServerSelection(event: PacketEvent) { - log.info { "Received server selection for server id ${event.packet.gameServerId}" } - // TODO proper server node selection handling (depends on onGameServerListRequest - // implementation) - // Example refuse connection: event.respondWithState(LoginState.INVALID_PASSWORD) - event - .respondForAuthedUser(userId = 1, sessionToken = ByteArray(16) { 0x42 }) - .withLocalEndpoint( - address = IPAddress.of("127.0.0.1"), hostname = "localhost", port = 7777u) - .withNodes( - listOf( - GameServerNode( - iPv4Address = IPv4Address.of("127.0.0.1"), - iPv6Address = IPv6Address.of("::1"), - port = 7777u, - weight = - 0x01u // Always select this node (only one node available in this example) - ))) - .respondTo(event) - } -} diff --git a/server.login/src/main/kotlin/de/fiereu/openmmo/server/login/protocol/login/ext/JoinGameServerPacketExtension.kt b/server.login/src/main/kotlin/de/fiereu/openmmo/server/login/protocol/login/ext/JoinGameServerPacketExtension.kt deleted file mode 100644 index 7b518e3..0000000 --- a/server.login/src/main/kotlin/de/fiereu/openmmo/server/login/protocol/login/ext/JoinGameServerPacketExtension.kt +++ /dev/null @@ -1,24 +0,0 @@ -package de.fiereu.openmmo.server.login.protocol.login.ext - -import de.fiereu.openmmo.common.enums.LoginState -import de.fiereu.openmmo.protocols.tls.packets.JoinGameServerPacket -import de.fiereu.openmmo.protocols.tls.packets.builders.AuthedPacketBuilder -import de.fiereu.openmmo.protocols.tls.packets.builders.GameServerNodesPacketBuilder -import de.fiereu.openmmo.server.protocol.PacketEvent -import de.fiereu.openmmo.server.protocol.respond - -fun PacketEvent.respondWithErrorState(state: LoginState) { - this.respond(GameServerNodesPacketBuilder.forState(state)) -} - -fun PacketEvent.respondForAuthedUser( - userId: Int, - sessionToken: ByteArray -): AuthedPacketBuilder { - return GameServerNodesPacketBuilder.forAuthedUser( - userId = userId, sessionToken = sessionToken, gameServerId = this.packet.gameServerId) -} - -fun AuthedPacketBuilder.respondTo(event: PacketEvent<*>) { - event.respond(this.build()) -} diff --git a/server.login/src/main/kotlin/de/fiereu/openmmo/server/login/protocol/login/ext/LoginRequestPacketExtensions.kt b/server.login/src/main/kotlin/de/fiereu/openmmo/server/login/protocol/login/ext/LoginRequestPacketExtensions.kt deleted file mode 100644 index aeb8964..0000000 --- a/server.login/src/main/kotlin/de/fiereu/openmmo/server/login/protocol/login/ext/LoginRequestPacketExtensions.kt +++ /dev/null @@ -1,19 +0,0 @@ -package de.fiereu.openmmo.server.login.protocol.login.ext - -import de.fiereu.openmmo.common.enums.LoginState -import de.fiereu.openmmo.protocols.tls.packets.LoginRequestPacket -import de.fiereu.openmmo.protocols.tls.packets.builders.LoginResponsePacketBuilder -import de.fiereu.openmmo.server.protocol.PacketEvent -import de.fiereu.openmmo.server.protocol.respond -import java.time.LocalDateTime - -fun PacketEvent.respondWithState(state: LoginState) { - this.respond(LoginResponsePacketBuilder.withState(state)) -} - -fun PacketEvent.respondWithRateLimit( - state: LoginState, - ratelimitEnd: LocalDateTime -) { - this.respond(LoginResponsePacketBuilder.withRateLimit(state, ratelimitEnd)) -} diff --git a/server.login/src/main/kotlin/de/fiereu/openmmo/server/login/protocol/login/ext/RequestGameServerListPacketExtensions.kt b/server.login/src/main/kotlin/de/fiereu/openmmo/server/login/protocol/login/ext/RequestGameServerListPacketExtensions.kt deleted file mode 100644 index 4520bef..0000000 --- a/server.login/src/main/kotlin/de/fiereu/openmmo/server/login/protocol/login/ext/RequestGameServerListPacketExtensions.kt +++ /dev/null @@ -1,23 +0,0 @@ -package de.fiereu.openmmo.server.login.protocol.login.ext - -import de.fiereu.openmmo.protocols.tls.packets.GameServer -import de.fiereu.openmmo.protocols.tls.packets.RequestGameServerListPacket -import de.fiereu.openmmo.protocols.tls.packets.builders.GameServerListPacketBuilder -import de.fiereu.openmmo.server.protocol.PacketEvent -import de.fiereu.openmmo.server.protocol.respond - -fun PacketEvent.respondWithServers(servers: List) { - this.respond(GameServerListPacketBuilder.withServers(servers)) -} - -fun PacketEvent.respondWithEmptyList() { - this.respond(GameServerListPacketBuilder.empty()) -} - -fun PacketEvent.respondWithServerList(): GameServerListPacketBuilder { - return GameServerListPacketBuilder.create() -} - -fun GameServerListPacketBuilder.respondTo(event: PacketEvent<*>) { - event.respond(this.build()) -} diff --git a/server.login/src/main/resources/.gitignore b/server.login/src/main/resources/.gitignore new file mode 100644 index 0000000..40d270c --- /dev/null +++ b/server.login/src/main/resources/.gitignore @@ -0,0 +1,2 @@ +game.private.pem +game.public.pem \ No newline at end of file diff --git a/server.login/src/main/resources/application.conf b/server.login/src/main/resources/application.conf index 130b091..b8ca8c6 100644 --- a/server.login/src/main/resources/application.conf +++ b/server.login/src/main/resources/application.conf @@ -1 +1,8 @@ -server.port = 2106 \ No newline at end of file +server { + host = "0.0.0.0" + port = 2106 + checksumSize = 16 + rootKeyResource = "game.private.pem" + sessionSecret = "dev-only-secret-do-not-use-in-production" + sessionSecret = ${?OPENMMO_SESSION_SECRET} +} diff --git a/server.login/src/main/resources/db/migration/V1__init.sql b/server.login/src/main/resources/db/migration/V1__init.sql deleted file mode 100644 index 211623c..0000000 --- a/server.login/src/main/resources/db/migration/V1__init.sql +++ /dev/null @@ -1,17 +0,0 @@ -create extension if not exists pgcrypto; - -create table - "user" -( - id serial not null, - created_at timestamp not null default current_timestamp, - username varchar(12) not null unique, - password bytea not null, -- SHA-1 hash of the password - primary key (id) -); - -insert into "user"(username, password) -select 'admin', - digest('admin', 'sha1') -where not exists(select 1 - from "user"); \ No newline at end of file diff --git a/server.login/src/main/resources/logback.xml b/server.login/src/main/resources/logback.xml index bc29b59..abfed40 100644 --- a/server.login/src/main/resources/logback.xml +++ b/server.login/src/main/resources/logback.xml @@ -1,11 +1,10 @@ - - - %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n - - - - - - - \ No newline at end of file + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + diff --git a/server.login/src/test/kotlin/de/fiereu/openmmo/server/login/auth/InMemoryUserStoreTest.kt b/server.login/src/test/kotlin/de/fiereu/openmmo/server/login/auth/InMemoryUserStoreTest.kt new file mode 100644 index 0000000..cdceaa2 --- /dev/null +++ b/server.login/src/test/kotlin/de/fiereu/openmmo/server/login/auth/InMemoryUserStoreTest.kt @@ -0,0 +1,52 @@ +package de.fiereu.openmmo.server.login.auth + +import de.fiereu.openmmo.common.enums.LoginState +import io.kotest.core.spec.style.FunSpec +import io.kotest.matchers.shouldBe +import io.kotest.matchers.shouldNotBe + +class InMemoryUserStoreTest : + FunSpec({ + test("seeds the admin and test users") { + val store = InMemoryUserStore() + store.getUserId("admin") shouldNotBe null + store.getUserId("test") shouldNotBe null + } + + test("authenticate succeeds when password hash matches SHA-1 hex") { + val store = InMemoryUserStore() + val sha1Hex = sha1HexOf("admin") + val result = store.authenticate("admin", sha1Hex) + result.state shouldBe LoginState.AUTHED + result.userId shouldBe store.getUserId("admin") + } + + test("authenticate is case-insensitive on username") { + val store = InMemoryUserStore() + val sha1Hex = sha1HexOf("test") + val result = store.authenticate("TEST", sha1Hex) + result.state shouldBe LoginState.AUTHED + } + + test("authenticate fails for unknown user") { + val store = InMemoryUserStore() + store.authenticate("nobody", "whatever").state shouldBe LoginState.INVALID_PASSWORD + } + + test("authenticate fails for wrong password") { + val store = InMemoryUserStore() + store.authenticate("admin", "wrong").state shouldBe LoginState.INVALID_PASSWORD + } + + test("addUser assigns ascending ids") { + val store = InMemoryUserStore() + val a = store.addUser("alice", "pw") + val b = store.addUser("bob", "pw") + (b > a) shouldBe true + } + }) + +private fun sha1HexOf(input: String): String { + val digest = java.security.MessageDigest.getInstance("SHA-1").digest(input.toByteArray()) + return digest.joinToString("") { "%02x".format(it) } +} diff --git a/server.login/src/test/kotlin/de/fiereu/openmmo/server/login/handler/LoginAppHandlerTest.kt b/server.login/src/test/kotlin/de/fiereu/openmmo/server/login/handler/LoginAppHandlerTest.kt new file mode 100644 index 0000000..2dcbd39 --- /dev/null +++ b/server.login/src/test/kotlin/de/fiereu/openmmo/server/login/handler/LoginAppHandlerTest.kt @@ -0,0 +1,28 @@ +package de.fiereu.openmmo.server.login.handler + +import de.fiereu.openmmo.net.login.packets.JoinGameServerPacket +import de.fiereu.openmmo.net.login.packets.LoginRequestPacket +import de.fiereu.openmmo.net.login.packets.RequestGameServerListPacket +import de.fiereu.openmmo.server.login.config.LoginServerConfig +import de.fiereu.openmmo.server.login.di.DaggerLoginServerComponent +import io.kotest.core.spec.style.FunSpec +import io.kotest.matchers.shouldBe + +class LoginAppHandlerTest : + FunSpec({ + test("dagger component constructs the handler with all three packet types registered") { + val config = + LoginServerConfig( + host = "127.0.0.1", + port = 0, + checksumSize = 16, + rootKeyResource = "game.private.pem", + sessionSecret = "test-secret-for-unit-tests".toByteArray(), + ) + val component = DaggerLoginServerComponent.factory().create(config) + val handler = component.handlerProvider().get() + handler.isRegistered(LoginRequestPacket::class) shouldBe true + handler.isRegistered(RequestGameServerListPacket::class) shouldBe true + handler.isRegistered(JoinGameServerPacket::class) shouldBe true + } + }) diff --git a/server/README.md b/server/README.md deleted file mode 100644 index 570d042..0000000 --- a/server/README.md +++ /dev/null @@ -1,63 +0,0 @@ -# Server Module - -The server module provides the core server framework for OpenMMO using Netty for networking and protocol handling. - -## Contents - -### Core Classes -- **Server**: Main server class with lifecycle management (start/stop) -- **ServerBuilder**: Builder pattern for server configuration and setup -- **NettyServer**: Netty-based server implementation for async I/O - -### Configuration -- **ServerConfig**: Main server configuration settings -- **TlsConfig**: TLS-specific configuration for secure communication -- **ConfigLoader**: Configuration loading utilities - -### Networking Components -- **ChannelHandlerProvider**: Interface for providing Netty channel handlers -- **DefaultChannelHandlerProvider**: Default implementation of channel handler provider - -### Netty Handlers -- **ProtocolHandler**: Main protocol routing and packet handling -- **PacketFrameDecoder/Encoder**: Packet framing with length prefixing -- **ChecksumFrameDecoder/Encoder**: Packet integrity validation (CRC16 and HMAC-SHA256) -- **TlsDecryptionHandler/TlsEncryptionHandler**: TLS-like encryption/decryption - -### Protocol System -- **TlsContext**: TLS session context management -- **TlsProtocolHandler**: TLS protocol implementation -- **PacketEvent**: Event system for packet processing - -### Cryptography -- **KeyLoader**: Utility for loading ECDSA keys from PEM files -- **Checksum**: Abstraction for packet integrity validation - - **Crc16Checksum**: CRC16 implementation - - **HmacSha256Checksum**: HMAC-SHA256 implementation - -### Dependency Injection -- **ServerComponent**: Dagger component for dependency injection -- **ServerModule**: Dagger module providing server dependencies - -## Features -- Asynchronous networking using Netty -- Custom TLS-like protocol for secure communication -- Packet framing and integrity validation -- Protocol switching (TLS handshake → application protocols) -- ECDSA key management for packet signing/verification -- Configurable coroutine scopes for async operations - -## Dependencies -- Netty for networking -- Dagger 2 for dependency injection -- BouncyCastle for cryptography -- Kotlinx.coroutines for async operations -- Kotlinx.serialization for configuration -- TypeSafe Config for configuration management -- Protocol and Protocol.TLS modules - -## Testing -- Comprehensive unit tests using Kotest -- Integration tests for Netty pipeline components -- TLS handler tests with helper utilities -- MockK for mocking dependencies \ No newline at end of file diff --git a/server/build.gradle.kts b/server/build.gradle.kts deleted file mode 100644 index a3a2035..0000000 --- a/server/build.gradle.kts +++ /dev/null @@ -1,32 +0,0 @@ -plugins { - `java-library` - id("buildsrc.convention.kotlin-jvm") - alias(libs.plugins.kotlin.serialization) - alias(libs.plugins.ksp) -} - -group = "de.fiereu.openmmo" - -version = "0.1.0" - -dependencies { - api(libs.typesafe.config) - api(libs.slf4j) - api(libs.kotlin.logging) - api(libs.kotlinx.serialization.core) - api(libs.kotlinx.coroutines) - api(libs.dagger) - api(project(":protocol")) - api(project(":protocol.tls")) - - ksp(libs.dagger.compiler) - - implementation(libs.kotlin.reflect) - implementation(libs.netty) - implementation(libs.kotlinx.serialization.json) - implementation(libs.bundles.crypto) - - testImplementation(libs.bundles.kotest) - testImplementation(libs.kotlinx.coroutines.test) - testImplementation(libs.mockk) -} diff --git a/server/src/main/kotlin/de/fiereu/openmmo/server/Server.kt b/server/src/main/kotlin/de/fiereu/openmmo/server/Server.kt deleted file mode 100644 index b16547a..0000000 --- a/server/src/main/kotlin/de/fiereu/openmmo/server/Server.kt +++ /dev/null @@ -1,54 +0,0 @@ -package de.fiereu.openmmo.server - -import de.fiereu.openmmo.server.netty.NettyServer -import io.github.oshai.kotlinlogging.KotlinLogging -import javax.inject.Inject -import javax.inject.Singleton - -private val log = KotlinLogging.logger {} - -@Singleton -class Server @Inject constructor( - private val nettyServer: NettyServer -) { - @Volatile - private var isStarted = false - val isRunning: Boolean - get() = isStarted && nettyServer.isRunning - - fun start() { - if (isStarted) { - log.warn { "Server is already started" } - return - } - - log.info { "Starting server..." } - - try { - nettyServer.start() - isStarted = true - log.info { "Server started successfully" } - } catch (e: Exception) { - log.error(e) { "Failed to start server" } - throw e - } - } - - fun stop() { - if (!isStarted) { - log.warn { "Server is not started" } - return - } - - log.info { "Stopping server..." } - - try { - nettyServer.stop() - isStarted = false - log.info { "Server stopped successfully" } - } catch (e: Exception) { - log.error(e) { "Error during server shutdown" } - throw e - } - } -} \ No newline at end of file diff --git a/server/src/main/kotlin/de/fiereu/openmmo/server/ServerBuilder.kt b/server/src/main/kotlin/de/fiereu/openmmo/server/ServerBuilder.kt deleted file mode 100644 index 0beee8e..0000000 --- a/server/src/main/kotlin/de/fiereu/openmmo/server/ServerBuilder.kt +++ /dev/null @@ -1,87 +0,0 @@ -package de.fiereu.openmmo.server - -import de.fiereu.openmmo.server.config.ServerConfig -import de.fiereu.openmmo.server.config.TlsConfig -import de.fiereu.openmmo.server.di.DaggerServerComponent -import de.fiereu.openmmo.server.di.ServerModule -import de.fiereu.openmmo.server.netty.ChannelHandlerProvider -import de.fiereu.openmmo.server.netty.handlers.ProtocolHandler -import kotlinx.coroutines.CoroutineScope -import kotlinx.coroutines.Dispatchers -import kotlinx.coroutines.SupervisorJob -import java.security.interfaces.ECPrivateKey -import java.security.interfaces.ECPublicKey - -class ServerBuilder { - private var coroutineScope: CoroutineScope? = null - private var serverConfig: ServerConfig? = null - private var tlsConfig: TlsConfig? = null - private var privateKey: ECPrivateKey? = null - private var publicKey: ECPublicKey? = null - private var protocolProvider: (() -> ProtocolHandler)? = null - - fun withCoroutineScope(scope: CoroutineScope): ServerBuilder = apply { - this.coroutineScope = scope - } - - fun withConfig(config: ServerConfig): ServerBuilder = apply { - this.serverConfig = config - } - - fun withTlsConfig(tlsConfig: TlsConfig): ServerBuilder = apply { - this.tlsConfig = tlsConfig - } - - fun withPrivateKey(privateKey: ECPrivateKey): ServerBuilder = apply { - this.privateKey = privateKey - } - - fun withPublicKey(publicKey: ECPublicKey): ServerBuilder = apply { - this.publicKey = publicKey - } - - fun withChannelHandlerProvider(provider: () -> ProtocolHandler): ServerBuilder = apply { - this.protocolProvider = provider - } - - fun build(): Server { - val coroutineScope = coroutineScope ?: throw IllegalStateException("CoroutineScope must be provided") - val config = serverConfig ?: throw IllegalStateException("ServerConfig must be provided") - val tlsConfig = tlsConfig ?: throw IllegalStateException("TlsConfig must be provided") - val privKey = privateKey ?: throw IllegalStateException("PrivateKey must be provided") - val pubKey = publicKey ?: throw IllegalStateException("PublicKey must be provided") - val protocolProvider = protocolProvider ?: throw IllegalStateException("ChannelHandlerProvider must be provided") - - val component = DaggerServerComponent.builder() - .serverModule(ServerModule( - coroutineScope, - config, - tlsConfig, - Pair(privKey, pubKey), - protocolProvider - )) - .build() - - return component.server() - } - - companion object { - fun create(): ServerBuilder = ServerBuilder() - - fun create( - config: ServerConfig, - tlsConfig: TlsConfig, - privateKey: ECPrivateKey, - publicKey: ECPublicKey, - handlerProvider: () -> ProtocolHandler - ): Server { - return ServerBuilder() - .withConfig(config) - .withTlsConfig(tlsConfig) - .withPrivateKey(privateKey) - .withPublicKey(publicKey) - .withChannelHandlerProvider(handlerProvider) - .build() - } - } -} \ No newline at end of file diff --git a/server/src/main/kotlin/de/fiereu/openmmo/server/config/ConfigLoader.kt b/server/src/main/kotlin/de/fiereu/openmmo/server/config/ConfigLoader.kt deleted file mode 100644 index 41fe86a..0000000 --- a/server/src/main/kotlin/de/fiereu/openmmo/server/config/ConfigLoader.kt +++ /dev/null @@ -1,59 +0,0 @@ -package de.fiereu.openmmo.server.config - -import com.typesafe.config.Config -import com.typesafe.config.ConfigFactory -import kotlinx.serialization.DeserializationStrategy -import kotlinx.serialization.json.Json -import kotlinx.serialization.json.JsonElement -import kotlinx.serialization.json.buildJsonObject -import kotlinx.serialization.serializer -import kotlin.reflect.typeOf - -object ConfigLoader { - private val json = Json { - ignoreUnknownKeys = true - isLenient = true - } - - @Suppress("UNCHECKED_CAST") - inline fun load(path: String): T { - return load(path, serializer(typeOf()) as DeserializationStrategy) - } - - fun load(path: String, deserializer: DeserializationStrategy): T { - val config = ConfigFactory.load(path) - val jsonElement = configToJsonElement(config.root()) - return json.decodeFromJsonElement(deserializer, jsonElement) - } - - inline fun loadWithDefaults(path: String, defaults: T): T { - return try { - load(path) - } catch (e: Exception) { - defaults - } - } - - private fun configToJsonElement(config: Any?): JsonElement { - return when (config) { - is Config -> buildJsonObject { - config.entrySet().forEach { (key, value) -> - put(key, configToJsonElement(value.unwrapped())) - } - } - is Map<*, *> -> buildJsonObject { - config.forEach { (key, value) -> - put(key.toString(), configToJsonElement(value)) - } - } - is List<*> -> kotlinx.serialization.json.buildJsonArray { - config.forEach { add(configToJsonElement(it)) } - } - is String -> kotlinx.serialization.json.JsonPrimitive(config) - is Number -> kotlinx.serialization.json.JsonPrimitive(config) - is Boolean -> kotlinx.serialization.json.JsonPrimitive(config) - null -> kotlinx.serialization.json.JsonNull - else -> kotlinx.serialization.json.JsonPrimitive(config.toString()) - } - } -} \ No newline at end of file diff --git a/server/src/main/kotlin/de/fiereu/openmmo/server/config/ServerConfig.kt b/server/src/main/kotlin/de/fiereu/openmmo/server/config/ServerConfig.kt deleted file mode 100644 index daf441b..0000000 --- a/server/src/main/kotlin/de/fiereu/openmmo/server/config/ServerConfig.kt +++ /dev/null @@ -1,17 +0,0 @@ -package de.fiereu.openmmo.server.config - -import kotlinx.serialization.Serializable - -@Serializable -data class ServerConfig( - val host: String = "0.0.0.0", - val port: Int, - val workerThreads: Int = Runtime.getRuntime().availableProcessors(), - val bossThreads: Int = 1, - val tcpNoDelay: Boolean = true, - val keepAlive: Boolean = true, - val soBacklog: Int = 128, - val receiveBufferSize: Int = 65536, - val sendBufferSize: Int = 65536, - val writeTimeoutSeconds: Long = 1500L // 25 minutes default -) \ No newline at end of file diff --git a/server/src/main/kotlin/de/fiereu/openmmo/server/config/TlsConfig.kt b/server/src/main/kotlin/de/fiereu/openmmo/server/config/TlsConfig.kt deleted file mode 100644 index 8a87d20..0000000 --- a/server/src/main/kotlin/de/fiereu/openmmo/server/config/TlsConfig.kt +++ /dev/null @@ -1,5 +0,0 @@ -package de.fiereu.openmmo.server.config - -data class TlsConfig( - val checksumSize: Int, -) diff --git a/server/src/main/kotlin/de/fiereu/openmmo/server/di/ServerComponent.kt b/server/src/main/kotlin/de/fiereu/openmmo/server/di/ServerComponent.kt deleted file mode 100644 index f116d4d..0000000 --- a/server/src/main/kotlin/de/fiereu/openmmo/server/di/ServerComponent.kt +++ /dev/null @@ -1,21 +0,0 @@ -package de.fiereu.openmmo.server.di - -import dagger.Component -import de.fiereu.openmmo.server.Server -import de.fiereu.openmmo.server.config.ServerConfig -import de.fiereu.openmmo.server.netty.NettyServer -import javax.inject.Singleton - -@Singleton -@Component(modules = [ServerModule::class]) -interface ServerComponent { - fun server(): Server - fun nettyServer(): NettyServer - fun serverConfig(): ServerConfig - - @Component.Builder - interface Builder { - fun serverModule(module: ServerModule): Builder - fun build(): ServerComponent - } -} \ No newline at end of file diff --git a/server/src/main/kotlin/de/fiereu/openmmo/server/di/ServerModule.kt b/server/src/main/kotlin/de/fiereu/openmmo/server/di/ServerModule.kt deleted file mode 100644 index 20b3306..0000000 --- a/server/src/main/kotlin/de/fiereu/openmmo/server/di/ServerModule.kt +++ /dev/null @@ -1,64 +0,0 @@ -package de.fiereu.openmmo.server.di - -import dagger.Module -import dagger.Provides -import de.fiereu.openmmo.protocols.tls.TlsServerProtocol -import de.fiereu.openmmo.server.config.ServerConfig -import de.fiereu.openmmo.server.config.TlsConfig -import de.fiereu.openmmo.server.netty.ChannelHandlerProvider -import de.fiereu.openmmo.server.netty.DefaultChannelHandlerProvider -import de.fiereu.openmmo.server.netty.handlers.ProtocolHandler -import io.netty.channel.EventLoopGroup -import io.netty.channel.MultiThreadIoEventLoopGroup -import io.netty.channel.nio.NioIoHandler -import kotlinx.coroutines.CoroutineScope -import java.security.interfaces.ECPrivateKey -import java.security.interfaces.ECPublicKey -import javax.inject.Named -import javax.inject.Singleton - -@Module -class ServerModule( - private val coroutineScope: CoroutineScope, - private val config: ServerConfig, - private val tlsConfig: TlsConfig, - private val serverKeyPair: Pair, - private val protocolProvider: () -> ProtocolHandler -) { - - @Provides - @Singleton - fun provideServerConfig(): ServerConfig = config - - @Provides - @Singleton - fun provideTlsProtocol(): TlsServerProtocol = TlsServerProtocol( - serverKeyPair - ) - - @Provides - @Singleton - fun provideChannelHandlerProvider( - serverConfig: ServerConfig, - tlsProtocol: TlsServerProtocol - ): ChannelHandlerProvider = DefaultChannelHandlerProvider( - serverConfig, - tlsConfig, - tlsProtocol, - protocolProvider - ) - - @Provides - @Singleton - @Named("boss") - fun provideBossEventLoopGroup(): EventLoopGroup { - return MultiThreadIoEventLoopGroup(config.bossThreads, NioIoHandler.newFactory()) - } - - @Provides - @Singleton - @Named("worker") - fun provideWorkerEventLoopGroup(): EventLoopGroup { - return MultiThreadIoEventLoopGroup(config.workerThreads, NioIoHandler.newFactory()) - } -} \ No newline at end of file diff --git a/server/src/main/kotlin/de/fiereu/openmmo/server/io/IO.kt b/server/src/main/kotlin/de/fiereu/openmmo/server/io/IO.kt deleted file mode 100644 index 1563929..0000000 --- a/server/src/main/kotlin/de/fiereu/openmmo/server/io/IO.kt +++ /dev/null @@ -1,11 +0,0 @@ -package de.fiereu.openmmo.server.io - -import java.io.FileInputStream -import java.io.InputStream - -fun resource(path: String): InputStream - = Thread.currentThread().contextClassLoader.getResourceAsStream(path) - ?: throw IllegalArgumentException("Resource not found: $path") - -fun file(path: String): InputStream - = FileInputStream(path) \ No newline at end of file diff --git a/server/src/main/kotlin/de/fiereu/openmmo/server/keys/KeyLoader.kt b/server/src/main/kotlin/de/fiereu/openmmo/server/keys/KeyLoader.kt deleted file mode 100644 index 1da2f44..0000000 --- a/server/src/main/kotlin/de/fiereu/openmmo/server/keys/KeyLoader.kt +++ /dev/null @@ -1,29 +0,0 @@ -package de.fiereu.openmmo.server.keys - -import io.github.oshai.kotlinlogging.KotlinLogging -import org.bouncycastle.util.io.pem.PemReader -import java.io.InputStream -import java.security.interfaces.ECPublicKey -import java.security.spec.X509EncodedKeySpec - -val log = KotlinLogging.logger {} - -object KeyLoader { - fun loadPemECPublicKey(inputStream: InputStream): ECPublicKey { - PemReader(inputStream.reader()).use { pemReader -> - val pemObject = pemReader.readPemObject() - val keySpec = X509EncodedKeySpec(pemObject.content) - val keyFactory = java.security.KeyFactory.getInstance("EC") - return keyFactory.generatePublic(keySpec) as ECPublicKey - } - } - - fun loadPemECPrivateKey(inputStream: InputStream): java.security.interfaces.ECPrivateKey { - PemReader(inputStream.reader()).use { pemReader -> - val pemObject = pemReader.readPemObject() - val keySpec = java.security.spec.PKCS8EncodedKeySpec(pemObject.content) - val keyFactory = java.security.KeyFactory.getInstance("EC") - return keyFactory.generatePrivate(keySpec) as java.security.interfaces.ECPrivateKey - } - } -} \ No newline at end of file diff --git a/server/src/main/kotlin/de/fiereu/openmmo/server/netty/ChannelHandlerProvider.kt b/server/src/main/kotlin/de/fiereu/openmmo/server/netty/ChannelHandlerProvider.kt deleted file mode 100644 index 0667c94..0000000 --- a/server/src/main/kotlin/de/fiereu/openmmo/server/netty/ChannelHandlerProvider.kt +++ /dev/null @@ -1,17 +0,0 @@ -package de.fiereu.openmmo.server.netty - -import io.netty.channel.ChannelPipeline - -/** - * Interface for providing channel handlers to be configured in a Netty pipeline. - * Implementations should define how the pipeline is set up with specific handlers. - */ -interface ChannelHandlerProvider { - /** - * Configures the provided [pipeline] with the necessary channel handlers. - * This method should be implemented to add specific handlers to the pipeline. - * - * @param pipeline The [ChannelPipeline] to configure with handlers. - */ - fun configurePipeline(pipeline: ChannelPipeline) -} \ No newline at end of file diff --git a/server/src/main/kotlin/de/fiereu/openmmo/server/netty/Compressor.kt b/server/src/main/kotlin/de/fiereu/openmmo/server/netty/Compressor.kt deleted file mode 100644 index 4b74315..0000000 --- a/server/src/main/kotlin/de/fiereu/openmmo/server/netty/Compressor.kt +++ /dev/null @@ -1,55 +0,0 @@ -package de.fiereu.openmmo.server.netty - -import de.fiereu.openmmo.server.config.ServerConfig -import io.netty.buffer.ByteBuf -import io.netty.buffer.Unpooled -import io.netty.channel.ChannelHandlerContext -import io.netty.handler.codec.MessageToMessageEncoder -import java.util.zip.Deflater - -class Compressor( - serverConfig: ServerConfig, -) { - private val deflater = Deflater(Deflater.DEFAULT_COMPRESSION, true) - /** - * At which packet size we need to compress the packet. - */ - private val threshold: Int = (serverConfig.sendBufferSize * 0.9).toInt() - - fun compress( - msg: ByteBuf - ) : ByteBuf { - val dataLength = msg.readableBytes() - if (dataLength < threshold) { - val outputBuffer = Unpooled - .buffer(dataLength + 1) - .writeBoolean(false) - .writeBytes(msg) - - return outputBuffer - } - - // Maybe use pre-allocated buffer? - val inputBuffer = Unpooled.copiedBuffer(msg) - .writeShortLE(0xFFFF) - - deflater.setInput( - inputBuffer.array(), - inputBuffer.arrayOffset() + inputBuffer.readerIndex(), - inputBuffer.readableBytes() - ) - val outputBuffer = Unpooled - .buffer(dataLength + 1) - .writeBoolean(true) - - val buffer = ByteArray(Short.MAX_VALUE.toInt()) - do { - val read = deflater.deflate(buffer) - if (read == 0) break - - outputBuffer.writeBytes(buffer, 0, read) - } while (true) - - return outputBuffer - } -} \ No newline at end of file diff --git a/server/src/main/kotlin/de/fiereu/openmmo/server/netty/DefaultChannelHandlerProvider.kt b/server/src/main/kotlin/de/fiereu/openmmo/server/netty/DefaultChannelHandlerProvider.kt deleted file mode 100644 index fd8d56d..0000000 --- a/server/src/main/kotlin/de/fiereu/openmmo/server/netty/DefaultChannelHandlerProvider.kt +++ /dev/null @@ -1,112 +0,0 @@ -package de.fiereu.openmmo.server.netty - -import de.fiereu.openmmo.protocols.tls.TlsServerProtocol -import de.fiereu.openmmo.server.config.ServerConfig -import de.fiereu.openmmo.server.config.TlsConfig -import de.fiereu.openmmo.server.netty.handlers.ProtocolHandler -import de.fiereu.openmmo.server.netty.handlers.checksum.ChecksumFrameDecoder -import de.fiereu.openmmo.server.netty.handlers.checksum.ChecksumFrameEncoder -import de.fiereu.openmmo.server.netty.handlers.frame.PacketFrameDecoder -import de.fiereu.openmmo.server.netty.handlers.frame.PacketFrameEncoder -import de.fiereu.openmmo.server.netty.handlers.tls.TlsDecryptionHandler -import de.fiereu.openmmo.server.netty.handlers.tls.TlsEncryptionHandler -import de.fiereu.openmmo.server.protocol.tls.NoOpTlsContext -import de.fiereu.openmmo.server.protocol.tls.TlsContext -import de.fiereu.openmmo.server.protocol.tls.TlsProtocolHandler -import de.fiereu.openmmo.server.protocol.tls.checksum.Checksum -import de.fiereu.openmmo.server.protocol.tls.checksum.NoOpChecksum -import io.netty.channel.ChannelHandlerContext -import io.netty.channel.ChannelPipeline -import io.netty.handler.logging.LogLevel -import io.netty.handler.logging.LoggingHandler -import io.netty.handler.timeout.WriteTimeoutHandler -import java.util.concurrent.TimeUnit - -/** - * Base class for configuring Netty channel handlers in the server. - * Default handlers: - * - Timeout handler (Timeout defined in [ServerConfig]) - * - Packet frame codec - * - Checksum frame codec (initially NoOp, can be switched dynamically) - * - TLS encryption/decryption handlers (initially NoOp, can be switched dynamically) - */ -class DefaultChannelHandlerProvider( - private val serverConfig: ServerConfig, - private val tlsConfig: TlsConfig, - private val tlsProtocol: TlsServerProtocol, - private val protocolProvider: () -> ProtocolHandler, -) : ChannelHandlerProvider { - - override fun configurePipeline(pipeline: ChannelPipeline) { - pipeline.addLast("timeout", WriteTimeoutHandler(serverConfig.writeTimeoutSeconds, TimeUnit.SECONDS)) - - pipeline.addLast("frame-logger", LoggingHandler("frame-logger", LogLevel.TRACE)) - pipeline.addLast("frame-decoder", PacketFrameDecoder()) - pipeline.addLast("frame-encoder", PacketFrameEncoder()) - - pipeline.addLast("checksum-decoder", ChecksumFrameDecoder(NoOpChecksum())) - pipeline.addLast("checksum-encoder", ChecksumFrameEncoder(NoOpChecksum())) - - val tlsContext = NoOpTlsContext() - pipeline.addLast("tls-decryption", TlsDecryptionHandler(tlsContext)) - pipeline.addLast("tls-encryption", TlsEncryptionHandler(tlsContext)) - - pipeline.addLast("protocol-logger", LoggingHandler("protocol-logger", LogLevel.TRACE)) - pipeline.addLast("protocol", TlsProtocolHandler(tlsProtocol, serverConfig, tlsConfig, this)) - } - - /** - * Switches the checksum algorithm used in the pipeline. - * - * Will be called from the [TlsProtocolHandler] once the handshake is complete and a checksum algorithm is negotiated. - * - * @param ctx The channel handler context. - * @param newChecksumIncoming The new checksum algorithm for incoming packets. - * @param newChecksumOutgoing The new checksum algorithm for outgoing packets. - */ - fun switchChecksum(ctx: ChannelHandlerContext, newChecksumIncoming: Checksum, newChecksumOutgoing: Checksum) { - val pipeline = ctx.pipeline() - - if (pipeline.get("checksum-decoder") != null) { - pipeline.replace("checksum-decoder", "checksum-decoder", ChecksumFrameDecoder(newChecksumIncoming)) - } - - if (pipeline.get("checksum-encoder") != null) { - pipeline.replace("checksum-encoder", "checksum-encoder", ChecksumFrameEncoder(newChecksumOutgoing)) - } - } - - /** - * Switches the TLS context used in the pipeline. - * - * Will be called from the [TlsProtocolHandler] once the handshake is complete and a TLS context is established. - * - * @param ctx The channel handler context. - * @param newTlsContext The new TLS context to use. - */ - fun switchTlsContext(ctx: ChannelHandlerContext, newTlsContext: TlsContext) { - val pipeline = ctx.pipeline() - - if (pipeline.get("tls-decryption") != null) { - pipeline.replace("tls-decryption", "tls-decryption", TlsDecryptionHandler(newTlsContext)) - } - - if (pipeline.get("tls-encryption") != null) { - pipeline.replace("tls-encryption", "tls-encryption", TlsEncryptionHandler(newTlsContext)) - } - } - - /** - * Will enable the actual protocol handler after the TLS handshake is complete. - * Initially a [TlsProtocolHandler] is used to handle the handshake. - * Once the handshake is complete, this method replaces it with the actual protocol handler provided by [protocolProvider]. - * - * @param ctx The channel handler context. - */ - fun enableProtocolHandler(ctx: ChannelHandlerContext) { - val pipeline = ctx.pipeline() - if (pipeline.get("protocol") != null) { - pipeline.replace("protocol", "protocol", protocolProvider()) - } - } -} \ No newline at end of file diff --git a/server/src/main/kotlin/de/fiereu/openmmo/server/netty/NettyServer.kt b/server/src/main/kotlin/de/fiereu/openmmo/server/netty/NettyServer.kt deleted file mode 100644 index 325f5a8..0000000 --- a/server/src/main/kotlin/de/fiereu/openmmo/server/netty/NettyServer.kt +++ /dev/null @@ -1,56 +0,0 @@ -package de.fiereu.openmmo.server.netty - -import de.fiereu.openmmo.server.config.ServerConfig -import io.github.oshai.kotlinlogging.KotlinLogging -import io.netty.bootstrap.ServerBootstrap -import io.netty.channel.ChannelFuture -import io.netty.channel.ChannelInitializer -import io.netty.channel.ChannelOption -import io.netty.channel.EventLoopGroup -import io.netty.channel.socket.SocketChannel -import io.netty.channel.socket.nio.NioServerSocketChannel -import javax.inject.Inject -import javax.inject.Named -import javax.inject.Singleton - -private val log = KotlinLogging.logger {} - -@Singleton -class NettyServer @Inject constructor( - private val config: ServerConfig, - @param:Named("boss") private val bossGroup: EventLoopGroup, - @param:Named("worker") private val workerGroup: EventLoopGroup, - private val channelHandlerProvider: ChannelHandlerProvider -) { - private var channelFuture: ChannelFuture? = null - val isRunning: Boolean - get() = channelFuture?.channel()?.isActive == true - - fun start() { - log.info { "Starting Netty server on ${config.host}:${config.port}" } - val bootstrap = ServerBootstrap() - .group(bossGroup, workerGroup) - .channel(NioServerSocketChannel::class.java) - .childHandler(object : ChannelInitializer() { - override fun initChannel(ch: SocketChannel) { - channelHandlerProvider.configurePipeline(ch.pipeline()) - } - }) - .option(ChannelOption.SO_BACKLOG, config.soBacklog) - .childOption(ChannelOption.SO_KEEPALIVE, config.keepAlive) - .childOption(ChannelOption.TCP_NODELAY, config.tcpNoDelay) - .childOption(ChannelOption.SO_RCVBUF, config.receiveBufferSize) - .childOption(ChannelOption.SO_SNDBUF, config.sendBufferSize) - - channelFuture = bootstrap.bind(config.host, config.port).await() - log.info { "Netty server started and listening on ${config.host}:${config.port}" } - } - - fun stop() { - log.info { "Stopping Netty server" } - channelFuture?.channel()?.close()?.await() - bossGroup.shutdownGracefully().await() - workerGroup.shutdownGracefully().await() - log.info { "Netty server stopped" } - } -} \ No newline at end of file diff --git a/server/src/main/kotlin/de/fiereu/openmmo/server/netty/handlers/ProtocolHandler.kt b/server/src/main/kotlin/de/fiereu/openmmo/server/netty/handlers/ProtocolHandler.kt deleted file mode 100644 index f5b0ae5..0000000 --- a/server/src/main/kotlin/de/fiereu/openmmo/server/netty/handlers/ProtocolHandler.kt +++ /dev/null @@ -1,128 +0,0 @@ -package de.fiereu.openmmo.server.netty.handlers - -import de.fiereu.openmmo.protocols.PacketDirection -import de.fiereu.openmmo.protocols.Protocol -import de.fiereu.openmmo.protocols.getDeserializer -import de.fiereu.openmmo.server.config.ServerConfig -import de.fiereu.openmmo.server.netty.Compressor -import de.fiereu.openmmo.server.protocol.PacketEvent -import io.github.oshai.kotlinlogging.KotlinLogging -import io.netty.buffer.ByteBuf -import io.netty.buffer.Unpooled -import io.netty.channel.ChannelDuplexHandler -import io.netty.channel.ChannelHandlerContext -import io.netty.channel.ChannelPromise - -private val log = KotlinLogging.logger {} - -abstract class ProtocolHandler( - val protocol: Protocol, - serverConfig: ServerConfig -) : ChannelDuplexHandler() { - - protected val compressor = Compressor(serverConfig) - - override fun channelRead(ctx: ChannelHandlerContext, msg: Any) { - if (msg !is ByteBuf) { - log.warn { "Received non-ByteBuf message: ${msg::class.simpleName}" } - return - } - - try { - if (!msg.isReadable) { - log.warn { "Empty packet received" } - return - } - val opcodeValue = msg.readUnsignedByte().toUByte() - val remainingBytes = msg.readableBytes() - - log.debug { "<< RX $opcodeValue (${remainingBytes}b) from ${ctx.channel().remoteAddress()}" } - - val deserializer = protocol.getDeserializer(opcodeValue) - if (deserializer == null) { - log.warn { "No deserializer found for ${PacketDirection.CLIENT_TO_SERVER} opcode $opcodeValue (${remainingBytes}b remaining)" } - return - } - - val packetData = deserializer.deserialize(msg) - - /* - * We cant call the onPacketReceived function asynchronously directly here, - * because the TLS protocol expects a synchronous flow. Meaning that the client already sends the next packet - * after the ClientReady packet, so if we would process the ClientReady packet asynchronously, - * the next packet would be processed before the ClientReady packet is fully processed. - * -> It would be processed by the TLS protocol before and not by the next protocol (e.g. login protocol). - */ - onPacketReceived(PacketEvent(ctx, packetData)) - } catch (e: Exception) { - log.error(e) { "Error processing packet: ${e.message}" } - } finally { - msg.release() - } - } - - override fun write( - ctx: ChannelHandlerContext, - msg: Any, - promise: ChannelPromise - ) { - try { - val opcode = protocol.getOpcode(msg::class) - if (opcode == null) { - log.warn { "No opcode found for packet type: ${msg::class.simpleName}" } - return - } - val serializer = protocol.getSerializer(opcode) - if (serializer == null) { - log.warn { "No serializer found for ${PacketDirection.SERVER_TO_CLIENT} opcode $opcode" } - return - } - - val buffer = ctx.alloc().buffer() - buffer.writeByte(opcode.value.toInt()) - - /* - * If the protocol requires compression (e.g. Game protocol), - * we need to compress the serialized packet before adding the opcode. - */ - if (!protocol.compressed) { - serializer.serializeObject(msg, buffer) - log.debug { ">> TX $opcode (${buffer.readableBytes() - 1}b payload)" } - } else { - val uncompressedBuffer = Unpooled.buffer() - serializer.serializeObject(msg, uncompressedBuffer) - val uncompressedSize = uncompressedBuffer.readableBytes() - val compressed = compressor.compress(uncompressedBuffer) - buffer.writeBytes(compressed) - log.debug { ">> TX $opcode (payload: ${uncompressedSize}b -> ${compressed.readableBytes()}b compressed)" } - } - - ctx.write(buffer, promise) - } catch (e: Exception) { - log.error(e) { "Error processing packet: ${e.message}" } - } - } - - override fun channelActive(ctx: ChannelHandlerContext) { - onActive(ctx) - } - - protected fun sendRaw(ctx: ChannelHandlerContext, opcode: UByte, data: ByteArray) { - val buffer = ctx.alloc().buffer() - buffer.writeByte(opcode.toInt()) - val dataBuf = Unpooled.wrappedBuffer(data) - buffer.writeBytes(compressor.compress(dataBuf)) - ctx.write(buffer) - } - - protected fun sendRawAndFlush(ctx: ChannelHandlerContext, opcode: UByte, data: ByteArray) { - val buffer = ctx.alloc().buffer() - buffer.writeByte(opcode.toInt()) - val dataBuf = Unpooled.wrappedBuffer(data) - buffer.writeBytes(compressor.compress(dataBuf)) - ctx.writeAndFlush(buffer) - } - - abstract fun onPacketReceived(event: PacketEvent<*>) - abstract fun onActive(ctx: ChannelHandlerContext) -} \ No newline at end of file diff --git a/server/src/main/kotlin/de/fiereu/openmmo/server/netty/handlers/checksum/ChecksumFrameDecoder.kt b/server/src/main/kotlin/de/fiereu/openmmo/server/netty/handlers/checksum/ChecksumFrameDecoder.kt deleted file mode 100644 index ff4bf04..0000000 --- a/server/src/main/kotlin/de/fiereu/openmmo/server/netty/handlers/checksum/ChecksumFrameDecoder.kt +++ /dev/null @@ -1,49 +0,0 @@ -package de.fiereu.openmmo.server.netty.handlers.checksum - -import de.fiereu.openmmo.server.protocol.tls.checksum.Checksum -import io.github.oshai.kotlinlogging.KotlinLogging -import io.netty.buffer.ByteBuf -import io.netty.channel.ChannelHandlerContext -import io.netty.handler.codec.ByteToMessageDecoder - -private val log = KotlinLogging.logger {} - -class ChecksumFrameDecoder( - private val checksum: Checksum -) : ByteToMessageDecoder() { - - override fun decode(ctx: ChannelHandlerContext, buffer: ByteBuf, out: MutableList) { - // The regular FrameDecoder already handled length field extraction - // We receive the complete packet data here - - if (checksum.size > 0) { - if (buffer.readableBytes() < checksum.size) { - log.warn { "Packet too small for checksum verification" } - return - } - - // Extract checksum from end of packet - val checksumBytes = ByteArray(checksum.size) - buffer.getBytes(buffer.readableBytes() - checksum.size, checksumBytes) - - // Verify checksum (excluding the checksum bytes themselves) - val dataToVerify = buffer.slice(0, buffer.readableBytes() - checksum.size) - if (!checksum.verify(dataToVerify, checksumBytes)) { - log.warn { "Checksum verification failed, dropping packet" } - return - } - - // Remove checksum from packet data and pass it on - // Use slice() instead of readSlice() to avoid modifying the buffer's reader index - val packetWithoutChecksum = buffer.slice(buffer.readerIndex(), buffer.readableBytes() - checksum.size) - out.add(packetWithoutChecksum.retain()) - // Advance the reader index to mark the data as consumed - buffer.readerIndex(buffer.writerIndex()) - } else { // We could use the NoOpChecksum here but this is faster - // No checksum, pass through as-is - out.add(buffer.slice(buffer.readerIndex(), buffer.readableBytes()).retain()) - // Advance the reader index to mark the data as consumed - buffer.readerIndex(buffer.writerIndex()) - } - } -} \ No newline at end of file diff --git a/server/src/main/kotlin/de/fiereu/openmmo/server/netty/handlers/checksum/ChecksumFrameEncoder.kt b/server/src/main/kotlin/de/fiereu/openmmo/server/netty/handlers/checksum/ChecksumFrameEncoder.kt deleted file mode 100644 index 1602d60..0000000 --- a/server/src/main/kotlin/de/fiereu/openmmo/server/netty/handlers/checksum/ChecksumFrameEncoder.kt +++ /dev/null @@ -1,30 +0,0 @@ -package de.fiereu.openmmo.server.netty.handlers.checksum - -import de.fiereu.openmmo.server.protocol.tls.checksum.Checksum -import io.netty.buffer.ByteBuf -import io.netty.channel.ChannelHandlerContext -import io.netty.handler.codec.MessageToByteEncoder - -class ChecksumFrameEncoder( - private val checksum: Checksum -) : MessageToByteEncoder() { - - override fun encode(ctx: ChannelHandlerContext, msg: ByteBuf, out: ByteBuf) { - val dataLength = msg.readableBytes() - - // Calculate checksum on the original data (before adding length) - val checksumBytes = if (checksum.size > 0) { - checksum.calculate(msg) - } else { - ByteArray(0) - } - - // Write the packet data - out.writeBytes(msg, msg.readerIndex(), dataLength) - - // Append checksum if needed - if (checksumBytes.isNotEmpty()) { - out.writeBytes(checksumBytes) - } - } -} \ No newline at end of file diff --git a/server/src/main/kotlin/de/fiereu/openmmo/server/netty/handlers/frame/PacketFrameDecoder.kt b/server/src/main/kotlin/de/fiereu/openmmo/server/netty/handlers/frame/PacketFrameDecoder.kt deleted file mode 100644 index 44bf949..0000000 --- a/server/src/main/kotlin/de/fiereu/openmmo/server/netty/handlers/frame/PacketFrameDecoder.kt +++ /dev/null @@ -1,14 +0,0 @@ -package de.fiereu.openmmo.server.netty.handlers.frame - -import io.netty.handler.codec.LengthFieldBasedFrameDecoder -import java.nio.ByteOrder - -class PacketFrameDecoder : LengthFieldBasedFrameDecoder( - ByteOrder.LITTLE_ENDIAN, - UShort.MAX_VALUE.toInt(), - 0, - UShort.SIZE_BYTES, - -UShort.SIZE_BYTES, // Length includes the length field itself, so subtract 2 - UShort.SIZE_BYTES, - false -) \ No newline at end of file diff --git a/server/src/main/kotlin/de/fiereu/openmmo/server/netty/handlers/frame/PacketFrameEncoder.kt b/server/src/main/kotlin/de/fiereu/openmmo/server/netty/handlers/frame/PacketFrameEncoder.kt deleted file mode 100644 index f2eedc5..0000000 --- a/server/src/main/kotlin/de/fiereu/openmmo/server/netty/handlers/frame/PacketFrameEncoder.kt +++ /dev/null @@ -1,11 +0,0 @@ -package de.fiereu.openmmo.server.netty.handlers.frame - -import io.netty.handler.codec.LengthFieldPrepender -import java.nio.ByteOrder - -class PacketFrameEncoder : LengthFieldPrepender( - ByteOrder.LITTLE_ENDIAN, - UShort.SIZE_BYTES, - 0, - true -) \ No newline at end of file diff --git a/server/src/main/kotlin/de/fiereu/openmmo/server/netty/handlers/tls/TlsDecryptionHandler.kt b/server/src/main/kotlin/de/fiereu/openmmo/server/netty/handlers/tls/TlsDecryptionHandler.kt deleted file mode 100644 index 04520f3..0000000 --- a/server/src/main/kotlin/de/fiereu/openmmo/server/netty/handlers/tls/TlsDecryptionHandler.kt +++ /dev/null @@ -1,25 +0,0 @@ -package de.fiereu.openmmo.server.netty.handlers.tls - -import de.fiereu.openmmo.server.protocol.tls.TlsContext -import io.netty.buffer.ByteBuf -import io.netty.channel.ChannelHandlerContext -import io.netty.handler.codec.ByteToMessageDecoder - -class TlsDecryptionHandler( - private val tlsContext: TlsContext -) : ByteToMessageDecoder() { - - override fun decode(ctx: ChannelHandlerContext, buffer: ByteBuf, out: MutableList) { - val dataLength = buffer.readableBytes() - if (dataLength == 0) return - - val encryptedBytes = ByteArray(dataLength) - buffer.readBytes(encryptedBytes) - - val decryptedBytes = tlsContext.decrypt(encryptedBytes) - - val decryptedBuffer = ctx.alloc().buffer(decryptedBytes.size) - decryptedBuffer.writeBytes(decryptedBytes) - out.add(decryptedBuffer) - } -} \ No newline at end of file diff --git a/server/src/main/kotlin/de/fiereu/openmmo/server/netty/handlers/tls/TlsEncryptionHandler.kt b/server/src/main/kotlin/de/fiereu/openmmo/server/netty/handlers/tls/TlsEncryptionHandler.kt deleted file mode 100644 index 2fb2197..0000000 --- a/server/src/main/kotlin/de/fiereu/openmmo/server/netty/handlers/tls/TlsEncryptionHandler.kt +++ /dev/null @@ -1,21 +0,0 @@ -package de.fiereu.openmmo.server.netty.handlers.tls - -import de.fiereu.openmmo.server.protocol.tls.TlsContext -import io.netty.buffer.ByteBuf -import io.netty.channel.ChannelHandlerContext -import io.netty.handler.codec.MessageToByteEncoder - -class TlsEncryptionHandler( - private val tlsContext: TlsContext -) : MessageToByteEncoder() { - - override fun encode(ctx: ChannelHandlerContext, msg: ByteBuf, out: ByteBuf) { - val dataLength = msg.readableBytes() - val inputBytes = ByteArray(dataLength) - msg.readBytes(inputBytes) - - val encryptedBytes = tlsContext.encrypt(inputBytes) - - out.writeBytes(encryptedBytes) - } -} \ No newline at end of file diff --git a/server/src/main/kotlin/de/fiereu/openmmo/server/protocol/PacketEvent.kt b/server/src/main/kotlin/de/fiereu/openmmo/server/protocol/PacketEvent.kt deleted file mode 100644 index bb899fc..0000000 --- a/server/src/main/kotlin/de/fiereu/openmmo/server/protocol/PacketEvent.kt +++ /dev/null @@ -1,20 +0,0 @@ -package de.fiereu.openmmo.server.protocol - -import io.github.oshai.kotlinlogging.KotlinLogging -import io.netty.channel.ChannelHandlerContext - -val log = KotlinLogging.logger {} - -data class PacketEvent( - val ctx: ChannelHandlerContext, - val packet: T -) - -fun PacketEvent.disconnect(reason: () -> String = { "No reason provided" }) { - log.info { "Stopping server for client ${ctx.channel().remoteAddress()}: ${reason()}" } - ctx.close() -} - -fun PacketEvent.respond(packet: Any) { - ctx.channel().writeAndFlush(packet) // need to write to channel otherwise the ProtocolHandler will be skipped -} \ No newline at end of file diff --git a/server/src/main/kotlin/de/fiereu/openmmo/server/protocol/tls/TlsContext.kt b/server/src/main/kotlin/de/fiereu/openmmo/server/protocol/tls/TlsContext.kt deleted file mode 100644 index e2820e2..0000000 --- a/server/src/main/kotlin/de/fiereu/openmmo/server/protocol/tls/TlsContext.kt +++ /dev/null @@ -1,81 +0,0 @@ -package de.fiereu.openmmo.server.protocol.tls - -import java.security.MessageDigest -import java.security.PrivateKey -import java.security.PublicKey -import javax.crypto.Cipher -import javax.crypto.KeyAgreement -import javax.crypto.spec.IvParameterSpec -import javax.crypto.spec.SecretKeySpec - -interface TlsContext { - fun encrypt(data: ByteArray): ByteArray - fun decrypt(data: ByteArray): ByteArray -} - -class NoOpTlsContext : TlsContext { - override fun encrypt(data: ByteArray): ByteArray = data - override fun decrypt(data: ByteArray): ByteArray = data -} - -class DefaultTlsContext( - privateKey: PrivateKey, - publicKey: PublicKey -) : TlsContext { - companion object { - private val COMMON_IV = "IVDERIV".toByteArray() - private val CLIENT_KEY_SALT = "KeySalt".toByteArray() + byteArrayOf(1) - private val SERVER_KEY_SALT = "KeySalt".toByteArray() + byteArrayOf(2) - } - - private var clientSeed = byteArrayOf(63, 24, -15, 98, 114, 7, 68, 24, -12, 109, -111, -105, 66, -96, -2, -55) - private var serverSeed = byteArrayOf(31, -102, -128, 60, -103, 38, 10, -117, -105, -50, 2, 116, -83, 57, 39, -76) - - private val encryptionCipher: Cipher // Server to client - private val decryptionCipher: Cipher // Client to server - - fun getClientSeed(): ByteArray = clientSeed.copyOf() - fun getServerSeed(): ByteArray = serverSeed.copyOf() - - init { - val sharedSecret = performKeyAgreement(privateKey, publicKey) - - if (sharedSecret.size * 8 >= 128) { - clientSeed = tripleHash(sharedSecret, CLIENT_KEY_SALT) - serverSeed = tripleHash(sharedSecret, SERVER_KEY_SALT) - } - - encryptionCipher = createCipher(Cipher.ENCRYPT_MODE, serverSeed) // Server encrypts outgoing - decryptionCipher = createCipher(Cipher.DECRYPT_MODE, clientSeed) // Server decrypts incoming - } - - private fun performKeyAgreement(privateKey: PrivateKey, publicKey: PublicKey): ByteArray { - val keyAgreement = KeyAgreement.getInstance("ECDH") - keyAgreement.init(privateKey) - keyAgreement.doPhase(publicKey, true) - return keyAgreement.generateSecret() - } - - private fun tripleHash(data1: ByteArray, data2: ByteArray): ByteArray { - val sha256 = MessageDigest.getInstance("SHA-256") - sha256.update(data2) - sha256.update(data1) - sha256.update(data2) - val digest = sha256.digest() - return digest.copyOfRange(0, 16) - } - - private fun createCipher(mode: Int, seed: ByteArray): Cipher { - val cipher = Cipher.getInstance("AES/CTR/NoPadding") - val key = SecretKeySpec(seed, "AES") - val iv = IvParameterSpec(tripleHash(seed, COMMON_IV)) - cipher.init(mode, key, iv) - return cipher - } - - override fun encrypt(data: ByteArray): ByteArray = - encryptionCipher.update(data) - - override fun decrypt(data: ByteArray): ByteArray = - decryptionCipher.update(data) -} \ No newline at end of file diff --git a/server/src/main/kotlin/de/fiereu/openmmo/server/protocol/tls/TlsProtocolHandler.kt b/server/src/main/kotlin/de/fiereu/openmmo/server/protocol/tls/TlsProtocolHandler.kt deleted file mode 100644 index 1861e5d..0000000 --- a/server/src/main/kotlin/de/fiereu/openmmo/server/protocol/tls/TlsProtocolHandler.kt +++ /dev/null @@ -1,78 +0,0 @@ -package de.fiereu.openmmo.server.protocol.tls - -import de.fiereu.openmmo.protocols.Protocol -import de.fiereu.openmmo.protocols.tls.packets.ClientHelloPacket -import de.fiereu.openmmo.protocols.tls.packets.ClientReadyPacket -import de.fiereu.openmmo.protocols.tls.packets.ServerHelloPacket -import de.fiereu.openmmo.server.config.ServerConfig -import de.fiereu.openmmo.server.config.TlsConfig -import de.fiereu.openmmo.server.netty.DefaultChannelHandlerProvider -import de.fiereu.openmmo.server.netty.handlers.ProtocolHandler -import de.fiereu.openmmo.server.protocol.PacketEvent -import de.fiereu.openmmo.server.protocol.disconnect -import de.fiereu.openmmo.server.protocol.respond -import de.fiereu.openmmo.server.protocol.tls.checksum.ChecksumFactory -import io.github.oshai.kotlinlogging.KotlinLogging -import io.netty.buffer.ByteBuf -import io.netty.channel.ChannelHandlerContext -import java.security.KeyPairGenerator -import java.security.interfaces.ECPrivateKey -import java.security.interfaces.ECPublicKey -import java.security.spec.ECGenParameterSpec - -private val log = KotlinLogging.logger {} - -class TlsProtocolHandler( - protocol: Protocol, - serverConfig: ServerConfig, - private val tlsConfig: TlsConfig, - private val channelHandlerProvider: DefaultChannelHandlerProvider -) : ProtocolHandler(protocol, serverConfig) { - - private val packetBuffer: MutableList = mutableListOf() - private val connectionKeyPair: Pair - - init { - val keyPairGenerator = KeyPairGenerator.getInstance("EC") - keyPairGenerator.initialize(ECGenParameterSpec("secp256r1")) - keyPairGenerator.generateKeyPair().let { - connectionKeyPair = Pair(it.public as ECPublicKey, it.private as ECPrivateKey) - } - } - - @Suppress("unchecked_cast") // The cast is in fact checked :D - override fun onPacketReceived(event: PacketEvent<*>) { - when (val packet = event.packet) { - is ClientHelloPacket -> onClientHello(event as PacketEvent) - is ClientReadyPacket -> onClientReady(event as PacketEvent) - else -> log.warn { "Unhandled TLS packet type: ${packet::class.simpleName}" } - } - } - - override fun onActive(ctx: ChannelHandlerContext) { - log.info { "New client connected: ${ctx.channel().remoteAddress()}" } - } - - fun onClientHello(event: PacketEvent) { - if (System.currentTimeMillis() - event.packet.timestamp > 10_000) { // 10 seconds is arbitrary - event.disconnect { "Received stale ClientHello packet" } - return - } - - event.respond(ServerHelloPacket(connectionKeyPair.first, tlsConfig.checksumSize)) - } - - fun onClientReady(event: PacketEvent) { - val tlsContext = DefaultTlsContext( - connectionKeyPair.second, - event.packet.clientPublicKey - ) - val checksumIncoming = ChecksumFactory.create(tlsConfig.checksumSize, tlsContext.getClientSeed()) - val checksumOutgoing = ChecksumFactory.create(tlsConfig.checksumSize, tlsContext.getServerSeed()) - - channelHandlerProvider.switchChecksum(event.ctx, checksumIncoming, checksumOutgoing) - channelHandlerProvider.switchTlsContext(event.ctx, tlsContext) - channelHandlerProvider.enableProtocolHandler(event.ctx) - log.info { "Client ${event.ctx.channel().remoteAddress()} completed TLS handshake. Switching to next protocol." } - } -} \ No newline at end of file diff --git a/server/src/main/kotlin/de/fiereu/openmmo/server/protocol/tls/checksum/Checksum.kt b/server/src/main/kotlin/de/fiereu/openmmo/server/protocol/tls/checksum/Checksum.kt deleted file mode 100644 index f9c3245..0000000 --- a/server/src/main/kotlin/de/fiereu/openmmo/server/protocol/tls/checksum/Checksum.kt +++ /dev/null @@ -1,33 +0,0 @@ -package de.fiereu.openmmo.server.protocol.tls.checksum - -import io.netty.buffer.ByteBuf - -interface Checksum { - val size: Int - - fun calculate(data: ByteBuf): ByteArray - fun verify(data: ByteBuf, expectedChecksum: ByteArray): Boolean -} - -class NoOpChecksum : Checksum { - override val size: Int = 0 - - override fun calculate(data: ByteBuf): ByteArray = ByteArray(0) - - override fun verify(data: ByteBuf, expectedChecksum: ByteArray): Boolean = true -} - -object ChecksumFactory { - fun create(checksumSize: Int): Checksum { - return create(checksumSize, ByteArray(0)) - } - - fun create(checksumSize: Int, key: ByteArray): Checksum { - return when (checksumSize) { - 0 -> NoOpChecksum() - 2 -> Crc16Checksum() - in 4..32 -> HmacSha256Checksum(checksumSize, key) - else -> throw IllegalArgumentException("Unsupported checksum size: $checksumSize") - } - } -} \ No newline at end of file diff --git a/server/src/main/kotlin/de/fiereu/openmmo/server/protocol/tls/checksum/Crc16Checksum.kt b/server/src/main/kotlin/de/fiereu/openmmo/server/protocol/tls/checksum/Crc16Checksum.kt deleted file mode 100644 index d424f51..0000000 --- a/server/src/main/kotlin/de/fiereu/openmmo/server/protocol/tls/checksum/Crc16Checksum.kt +++ /dev/null @@ -1,70 +0,0 @@ -package de.fiereu.openmmo.server.protocol.tls.checksum - -import io.netty.buffer.ByteBuf - -class Crc16Checksum : Checksum { - override val size: Int = 2 - - companion object { - private val table = intArrayOf( - 0x0000, 0xc0c1, 0xc181, 0x0140, 0xc301, 0x03c0, 0x0280, 0xc241, - 0xc601, 0x06c0, 0x0780, 0xc741, 0x0500, 0xc5c1, 0xc481, 0x0440, - 0xcc01, 0x0cc0, 0x0d80, 0xcd41, 0x0f00, 0xcfc1, 0xce81, 0x0e40, - 0x0a00, 0xcac1, 0xcb81, 0x0b40, 0xc901, 0x09c0, 0x0880, 0xc841, - 0xd801, 0x18c0, 0x1980, 0xd941, 0x1b00, 0xdbc1, 0xda81, 0x1a40, - 0x1e00, 0xdec1, 0xdf81, 0x1f40, 0xdd01, 0x1dc0, 0x1c80, 0xdc41, - 0x1400, 0xd4c1, 0xd581, 0x1540, 0xd701, 0x17c0, 0x1680, 0xd641, - 0xd201, 0x12c0, 0x1380, 0xd341, 0x1100, 0xd1c1, 0xd081, 0x1040, - 0xf001, 0x30c0, 0x3180, 0xf141, 0x3300, 0xf3c1, 0xf281, 0x3240, - 0x3600, 0xf6c1, 0xf781, 0x3740, 0xf501, 0x35c0, 0x3480, 0xf441, - 0x3c00, 0xfcc1, 0xfd81, 0x3d40, 0xff01, 0x3fc0, 0x3e80, 0xfe41, - 0xfa01, 0x3ac0, 0x3b80, 0xfb41, 0x3900, 0xf9c1, 0xf881, 0x3840, - 0x2800, 0xe8c1, 0xe981, 0x2940, 0xeb01, 0x2bc0, 0x2a80, 0xea41, - 0xee01, 0x2ec0, 0x2f80, 0xef41, 0x2d00, 0xedc1, 0xec81, 0x2c40, - 0xe401, 0x24c0, 0x2580, 0xe541, 0x2700, 0xe7c1, 0xe681, 0x2640, - 0x2200, 0xe2c1, 0xe381, 0x2340, 0xe101, 0x21c0, 0x2080, 0xe041, - 0xa001, 0x60c0, 0x6180, 0xa141, 0x6300, 0xa3c1, 0xa281, 0x6240, - 0x6600, 0xa6c1, 0xa781, 0x6740, 0xa501, 0x65c0, 0x6480, 0xa441, - 0x6c00, 0xacc1, 0xad81, 0x6d40, 0xaf01, 0x6fc0, 0x6e80, 0xae41, - 0xaa01, 0x6ac0, 0x6b80, 0xab41, 0x6900, 0xa9c1, 0xa881, 0x6840, - 0x7800, 0xb8c1, 0xb981, 0x7940, 0xbb01, 0x7bc0, 0x7a80, 0xba41, - 0xbe01, 0x7ec0, 0x7f80, 0xbf41, 0x7d00, 0xbdc1, 0xbc81, 0x7c40, - 0xb401, 0x74c0, 0x7580, 0xb541, 0x7700, 0xb7c1, 0xb681, 0x7640, - 0x7200, 0xb2c1, 0xb381, 0x7340, 0xb101, 0x71c0, 0x7080, 0xb041, - 0x5000, 0x90c1, 0x9181, 0x5140, 0x9301, 0x53c0, 0x5280, 0x9241, - 0x9601, 0x56c0, 0x5780, 0x9741, 0x5500, 0x95c1, 0x9481, 0x5440, - 0x9c01, 0x5cc0, 0x5d80, 0x9d41, 0x5f00, 0x9fc1, 0x9e81, 0x5e40, - 0x5a00, 0x9ac1, 0x9b81, 0x5b40, 0x9901, 0x59c0, 0x5880, 0x9841, - 0x8801, 0x48c0, 0x4980, 0x8941, 0x4b00, 0x8bc1, 0x8a81, 0x4a40, - 0x4e00, 0x8ec1, 0x8f81, 0x4f40, 0x8d01, 0x4dc0, 0x4c80, 0x8c41, - 0x4400, 0x84c1, 0x8581, 0x4540, 0x8701, 0x47c0, 0x4680, 0x8641, - 0x8201, 0x42c0, 0x4380, 0x8341, 0x4100, 0x81c1, 0x8081, 0x4040 - ) - } - - override fun calculate(data: ByteBuf): ByteArray { - val sum = hash(data) - return byteArrayOf((sum and 0xff).toByte(), ((sum shr 8) and 0xff).toByte()) - } - - override fun verify(data: ByteBuf, expectedChecksum: ByteArray): Boolean { - if (expectedChecksum.size != 2) return false - - val calculatedSum = hash(data) - val expectedSum = ((expectedChecksum[1].toInt() and 0xff) shl 8) or (expectedChecksum[0].toInt() and 0xff) - - return calculatedSum == expectedSum - } - - private fun hash(data: ByteBuf): Int { - var sum = 0 - val readerIndex = data.readerIndex() - - for (i in readerIndex until data.writerIndex()) { - val b = data.getByte(i) - sum = (sum ushr 8) xor table[(sum xor (b.toInt() and 0xff)) and 0xff] - } - - return (sum and 0xffff) - } -} \ No newline at end of file diff --git a/server/src/main/kotlin/de/fiereu/openmmo/server/protocol/tls/checksum/HmacSha256Checksum.kt b/server/src/main/kotlin/de/fiereu/openmmo/server/protocol/tls/checksum/HmacSha256Checksum.kt deleted file mode 100644 index a3eabb2..0000000 --- a/server/src/main/kotlin/de/fiereu/openmmo/server/protocol/tls/checksum/HmacSha256Checksum.kt +++ /dev/null @@ -1,63 +0,0 @@ -package de.fiereu.openmmo.server.protocol.tls.checksum - -import io.netty.buffer.ByteBuf -import java.security.MessageDigest -import javax.crypto.Mac -import javax.crypto.spec.SecretKeySpec - -class HmacSha256Checksum( - override val size: Int, - key: ByteArray -) : Checksum { - - private val mac: Mac - private var hashRound = 0 - private var verifyRound = 0 - - init { - require(size in 4..32) { "HMAC-SHA256 size must be between 4 and 32 bytes" } - - mac = Mac.getInstance("HmacSHA256") - mac.init(SecretKeySpec(key, "HmacSHA256")) - } - - override fun calculate(data: ByteBuf): ByteArray { - // Read data without modifying the buffer's reader index - val dataBytes = ByteArray(data.readableBytes()) - data.getBytes(data.readerIndex(), dataBytes) - - mac.update(dataBytes) - mac.update(getBytes(hashRound++)) - val result = mac.doFinal() - return result.copyOfRange(0, size) - } - - override fun verify(data: ByteBuf, expectedChecksum: ByteArray): Boolean { - if (expectedChecksum.size != size) return false - - // Read data without modifying the buffer's reader index - val dataBytes = ByteArray(data.readableBytes()) - data.getBytes(data.readerIndex(), dataBytes) - - mac.update(dataBytes) - mac.update(getBytes(verifyRound++)) - val result = mac.doFinal() - val actualChecksum = result.copyOfRange(0, size) - - return MessageDigest.isEqual(actualChecksum, expectedChecksum) - } - - /** - * Convert an integer to a big endian byte array. - * @param value The integer to convert. - * @return The big endian byte array. - */ - private fun getBytes(value: Int): ByteArray { - return byteArrayOf( - ((value shr 24) and 0xFF).toByte(), - ((value shr 16) and 0xFF).toByte(), - ((value shr 8) and 0xFF).toByte(), - (value and 0xFF).toByte() - ) - } -} \ No newline at end of file diff --git a/server/src/test/kotlin/de/fiereu/openmmo/server/netty/ChannelExt.kt b/server/src/test/kotlin/de/fiereu/openmmo/server/netty/ChannelExt.kt deleted file mode 100644 index a2644a1..0000000 --- a/server/src/test/kotlin/de/fiereu/openmmo/server/netty/ChannelExt.kt +++ /dev/null @@ -1,29 +0,0 @@ -package de.fiereu.openmmo.server.netty - -import io.netty.buffer.ByteBuf -import io.netty.buffer.Unpooled -import io.netty.channel.embedded.EmbeddedChannel - -fun EmbeddedChannel.readAllOutbound(): ByteBuf { - val encoded = Unpooled.buffer() - var buf: ByteBuf? - while (true) { - buf = this.readOutbound() - if (buf == null) break - encoded.writeBytes(buf) - buf.release() - } - return encoded -} - -fun EmbeddedChannel.readAllInbound(): ByteBuf { - val encoded = Unpooled.buffer() - var buf: ByteBuf? - while (true) { - buf = this.readInbound() - if (buf == null) break - encoded.writeBytes(buf) - buf.release() - } - return encoded -} \ No newline at end of file diff --git a/server/src/test/kotlin/de/fiereu/openmmo/server/netty/ChecksumFrameCodecTest.kt b/server/src/test/kotlin/de/fiereu/openmmo/server/netty/ChecksumFrameCodecTest.kt deleted file mode 100644 index 1d49ad4..0000000 --- a/server/src/test/kotlin/de/fiereu/openmmo/server/netty/ChecksumFrameCodecTest.kt +++ /dev/null @@ -1,340 +0,0 @@ -package de.fiereu.openmmo.server.netty - -import de.fiereu.openmmo.server.protocol.tls.checksum.ChecksumFactory -import de.fiereu.openmmo.server.protocol.tls.checksum.Crc16Checksum -import de.fiereu.openmmo.server.protocol.tls.checksum.HmacSha256Checksum -import de.fiereu.openmmo.server.protocol.tls.checksum.NoOpChecksum -import de.fiereu.openmmo.server.netty.handlers.checksum.ChecksumFrameDecoder -import de.fiereu.openmmo.server.netty.handlers.checksum.ChecksumFrameEncoder -import io.kotest.core.spec.style.FunSpec -import io.kotest.matchers.shouldBe -import io.netty.buffer.ByteBuf -import io.netty.buffer.Unpooled -import io.netty.channel.embedded.EmbeddedChannel - -class ChecksumFrameCodecTest : FunSpec({ - - test("NoOpChecksum - encoder should not add checksum") { - val checksum = NoOpChecksum() - val encoder = ChecksumFrameEncoder(checksum) - val channel = EmbeddedChannel(encoder) - - val payload = Unpooled.buffer() - .writeByte(0xAB) - .writeByte(0xCD) - - channel.writeOutbound(payload) - - val encoded = channel.readAllOutbound() - encoded.readableBytes() shouldBe 2 // 2 bytes payload (no checksum) - - // Check payload - encoded.readByte() shouldBe 0xAB.toByte() - encoded.readByte() shouldBe 0xCD.toByte() - - encoded.release() - channel.close() - } - - test("NoOpChecksum - decoder should pass through without verification") { - val checksum = NoOpChecksum() - val decoder = ChecksumFrameDecoder(checksum) - val channel = EmbeddedChannel(decoder) - - val input = Unpooled.buffer() - .writeByte(0xAB) - .writeByte(0xCD) - - channel.writeInbound(input) - - val decoded = channel.readAllInbound() - decoded.readableBytes() shouldBe 2 - decoded.readByte() shouldBe 0xAB.toByte() - decoded.readByte() shouldBe 0xCD.toByte() - - decoded.release() - channel.close() - } - - test("CRC16 - encoder should append 2-byte checksum") { - val checksum = Crc16Checksum() - val encoder = ChecksumFrameEncoder(checksum) - val channel = EmbeddedChannel(encoder) - - val payload = Unpooled.buffer() - .writeByte(0xAB) - .writeByte(0xCD) - - channel.writeOutbound(payload) - - val encoded = channel.readAllOutbound() - encoded.readableBytes() shouldBe 4 // 2 bytes payload + 2 bytes CRC16 - - // Check payload - encoded.readByte() shouldBe 0xAB.toByte() - encoded.readByte() shouldBe 0xCD.toByte() - - // Check that checksum bytes are present (we don't verify exact values here) - encoded.readableBytes() shouldBe 2 // Should have 2 checksum bytes left - - encoded.release() - channel.close() - } - - test("CRC16 - decoder should verify and remove checksum") { - val checksum = Crc16Checksum() - val decoder = ChecksumFrameDecoder(checksum) - val channel = EmbeddedChannel(decoder) - - // Create data and calculate its checksum - val originalData = Unpooled.buffer() - .writeByte(0xAB) - .writeByte(0xCD) - - val checksumBytes = checksum.calculate(originalData) - - // Create input with data + checksum - val input = Unpooled.buffer() - .writeByte(0xAB) - .writeByte(0xCD) - .writeBytes(checksumBytes) - - channel.writeInbound(input) - - val decoded = channel.readAllInbound() - decoded.readableBytes() shouldBe 2 // Checksum should be removed - decoded.readByte() shouldBe 0xAB.toByte() - decoded.readByte() shouldBe 0xCD.toByte() - - originalData.release() - decoded.release() - channel.close() - } - - test("CRC16 - decoder should drop packet with invalid checksum") { - val checksum = Crc16Checksum() - val decoder = ChecksumFrameDecoder(checksum) - val channel = EmbeddedChannel(decoder) - - // Create input with data + invalid checksum - val input = Unpooled.buffer() - .writeByte(0xAB) - .writeByte(0xCD) - .writeByte(0xFF) // Invalid checksum - .writeByte(0xFF) - - channel.writeInbound(input) - - // Should not produce any output due to checksum failure - channel.readInbound() shouldBe null - - channel.close() - } - - test("HMAC-SHA256 - encoder should append variable-size checksum") { - val key = byteArrayOf(0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08) - val checksum = HmacSha256Checksum(8, key) // 8-byte HMAC - val encoder = ChecksumFrameEncoder(checksum) - val channel = EmbeddedChannel(encoder) - - val payload = Unpooled.buffer() - .writeByte(0xAB) - .writeByte(0xCD) - - channel.writeOutbound(payload) - - val encoded = channel.readAllOutbound() - encoded.readableBytes() shouldBe 10 // 2 bytes payload + 8 bytes HMAC - - // Check payload - encoded.readByte() shouldBe 0xAB.toByte() - encoded.readByte() shouldBe 0xCD.toByte() - - // Check that HMAC bytes are present - encoded.readableBytes() shouldBe 8 // Should have 8 HMAC bytes left - - encoded.release() - channel.close() - } - - test("HMAC-SHA256 - decoder should verify and remove checksum") { - val key = byteArrayOf(0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08) - val checksum = HmacSha256Checksum(4, key) // 4-byte HMAC - val decoder = ChecksumFrameDecoder(checksum) - val channel = EmbeddedChannel(decoder) - - // Create data and calculate its checksum - val originalData = Unpooled.buffer() - .writeByte(0xAB) - .writeByte(0xCD) - - val checksumBytes = checksum.calculate(originalData) - - // Create input with data + checksum - val input = Unpooled.buffer() - .writeByte(0xAB) - .writeByte(0xCD) - .writeBytes(checksumBytes) - - channel.writeInbound(input) - - val decoded = channel.readAllInbound() - decoded.readableBytes() shouldBe 2 // Checksum should be removed - decoded.readByte() shouldBe 0xAB.toByte() - decoded.readByte() shouldBe 0xCD.toByte() - - originalData.release() - decoded.release() - channel.close() - } - - test("HMAC-SHA256 - decoder should drop packet with invalid checksum") { - val key = byteArrayOf(0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08) - val checksum = HmacSha256Checksum(4, key) - val decoder = ChecksumFrameDecoder(checksum) - val channel = EmbeddedChannel(decoder) - - // Create input with data + invalid checksum - val input = Unpooled.buffer() - .writeByte(0xAB) - .writeByte(0xCD) - .writeByte(0xFF) // Invalid checksum - .writeByte(0xFF) - .writeByte(0xFF) - .writeByte(0xFF) - - channel.writeInbound(input) - - // Should not produce any output due to checksum failure - channel.readInbound() shouldBe null - - channel.close() - } - - test("roundtrip - NoOpChecksum encoding and decoding") { - val checksum = NoOpChecksum() - val encoder = ChecksumFrameEncoder(checksum) - val decoder = ChecksumFrameDecoder(checksum) - val channel = EmbeddedChannel(encoder, decoder) - - val originalPayload = byteArrayOf(0xDE.toByte(), 0xAD.toByte(), 0xBE.toByte(), 0xEF.toByte()) - val input = Unpooled.buffer().writeBytes(originalPayload) - - // Encode then decode - channel.writeOutbound(input) shouldBe true - val encoded = channel.readAllOutbound() - - channel.writeInbound(encoded) shouldBe true - val decoded = channel.readAllInbound() - - decoded.readableBytes() shouldBe originalPayload.size - for (expectedByte in originalPayload) { - decoded.readByte() shouldBe expectedByte - } - - decoded.release() - channel.close() - } - - test("roundtrip - CRC16 encoding and decoding") { - val encoderChecksum = Crc16Checksum() - val decoderChecksum = Crc16Checksum() - val encoder = ChecksumFrameEncoder(encoderChecksum) - val decoder = ChecksumFrameDecoder(decoderChecksum) - - val originalPayload = byteArrayOf(0xDE.toByte(), 0xAD.toByte(), 0xBE.toByte(), 0xEF.toByte()) - val input = Unpooled.buffer().writeBytes(originalPayload) - - // Encode - val encoderChannel = EmbeddedChannel(encoder) - encoderChannel.writeOutbound(input) shouldBe true - val encoded = encoderChannel.readAllOutbound() - - encoded.readableBytes() shouldBe 6 // 4 bytes payload + 2 bytes CRC16 - - // Decode - val decoderChannel = EmbeddedChannel(decoder) - decoderChannel.writeInbound(encoded) shouldBe true - val decoded = decoderChannel.readAllInbound() - - decoded.readableBytes() shouldBe originalPayload.size - for (expectedByte in originalPayload) { - decoded.readByte() shouldBe expectedByte - } - - decoded.release() - encoderChannel.close() - decoderChannel.close() - } - - test("roundtrip - HMAC-SHA256 encoding and decoding") { - val key = byteArrayOf(0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08) - val encoderChecksum = HmacSha256Checksum(16, key) - val decoderChecksum = HmacSha256Checksum(16, key) - val encoder = ChecksumFrameEncoder(encoderChecksum) - val decoder = ChecksumFrameDecoder(decoderChecksum) - - val originalPayload = byteArrayOf(0xDE.toByte(), 0xAD.toByte(), 0xBE.toByte(), 0xEF.toByte()) - val input = Unpooled.buffer().writeBytes(originalPayload) - - // Encode - val encoderChannel = EmbeddedChannel(encoder) - encoderChannel.writeOutbound(input) shouldBe true - val encoded = encoderChannel.readAllOutbound() - - encoded.readableBytes() shouldBe 20 // 4 bytes payload + 16 bytes HMAC - - // Decode - val decoderChannel = EmbeddedChannel(decoder) - decoderChannel.writeInbound(encoded) shouldBe true - val decoded = decoderChannel.readAllInbound() - - decoded.readableBytes() shouldBe originalPayload.size - for (expectedByte in originalPayload) { - decoded.readByte() shouldBe expectedByte - } - - decoded.release() - encoderChannel.close() - decoderChannel.close() - } - - test("decoder should handle packet too small for checksum") { - val checksum = Crc16Checksum() - val decoder = ChecksumFrameDecoder(checksum) - val channel = EmbeddedChannel(decoder) - - // Send packet smaller than checksum size - val input = Unpooled.buffer() - .writeByte(0xAB) // Only 1 byte, but CRC16 needs 2 bytes - - channel.writeInbound(input) - - // Should not produce any output - channel.readInbound() shouldBe null - - channel.close() - } - - test("ChecksumFactory - create with size only") { - val noOpChecksum = ChecksumFactory.create(0) - (noOpChecksum is NoOpChecksum) shouldBe true - - val crc16Checksum = ChecksumFactory.create(2) - (crc16Checksum is Crc16Checksum) shouldBe true - } - - test("ChecksumFactory - create with size and key") { - val key = byteArrayOf(0x01, 0x02, 0x03, 0x04) - - val noOpChecksum = ChecksumFactory.create(0, key) - (noOpChecksum is NoOpChecksum) shouldBe true - - val crc16Checksum = ChecksumFactory.create(2, key) - (crc16Checksum is Crc16Checksum) shouldBe true - - val hmacChecksum = ChecksumFactory.create(8, key) - (hmacChecksum is HmacSha256Checksum) shouldBe true - hmacChecksum.size shouldBe 8 - } -}) \ No newline at end of file diff --git a/server/src/test/kotlin/de/fiereu/openmmo/server/netty/PacketFrameCodecTest.kt b/server/src/test/kotlin/de/fiereu/openmmo/server/netty/PacketFrameCodecTest.kt deleted file mode 100644 index e829ec4..0000000 --- a/server/src/test/kotlin/de/fiereu/openmmo/server/netty/PacketFrameCodecTest.kt +++ /dev/null @@ -1,179 +0,0 @@ -package de.fiereu.openmmo.server.netty - -import de.fiereu.openmmo.server.netty.handlers.frame.PacketFrameDecoder -import de.fiereu.openmmo.server.netty.handlers.frame.PacketFrameEncoder -import io.kotest.core.spec.style.FunSpec -import io.kotest.matchers.shouldBe -import io.kotest.matchers.nulls.shouldBeNull -import io.netty.buffer.ByteBuf -import io.netty.buffer.Unpooled -import io.netty.channel.embedded.EmbeddedChannel - -class PacketFrameCodecTest : FunSpec({ - - test("decoder should decode frame with correct length prefix") { - val decoder = PacketFrameDecoder() - val channel = EmbeddedChannel(decoder) - - // Create input: length 4 (0x0004) + payload [0xAB, 0xCD] - // Length field includes itself (2 bytes) + payload (2 bytes) = 4 total - val input = Unpooled.buffer() - .writeShortLE(4) // Length field (little endian) - .writeByte(0xAB) - .writeByte(0xCD) - - channel.writeInbound(input) - - val decoded = channel.readAllInbound() - decoded.readableBytes() shouldBe 2 - decoded.readByte() shouldBe 0xAB.toByte() - decoded.readByte() shouldBe 0xCD.toByte() - - decoded.release() - channel.close() - } - - test("decoder should handle empty payload") { - val decoder = PacketFrameDecoder() - val channel = EmbeddedChannel(decoder) - - // Create input: length 2 (only the length field itself) - val input = Unpooled.buffer() - .writeShortLE(2) // Length field (little endian) - - channel.writeInbound(input) - - val decoded = channel.readAllInbound() - decoded.readableBytes() shouldBe 0 - - decoded.release() - channel.close() - } - - test("decoder should handle larger payload") { - val decoder = PacketFrameDecoder() - val channel = EmbeddedChannel(decoder) - - val payload = byteArrayOf(0x01, 0x02, 0x03, 0x04, 0x05) - val input = Unpooled.buffer() - .writeShortLE(payload.size + 2) // Length includes length field - .writeBytes(payload) - - channel.writeInbound(input) - - val decoded = channel.readAllInbound() - decoded.readableBytes() shouldBe payload.size - for (expectedByte in payload) { - decoded.readByte() shouldBe expectedByte - } - - decoded.release() - channel.close() - } - - test("decoder should not decode incomplete frame") { - val decoder = PacketFrameDecoder() - val channel = EmbeddedChannel(decoder) - - // Send only the length field without payload - val input = Unpooled.buffer() - .writeShortLE(10) // Claims 10 bytes total but we only send 2 - - channel.writeInbound(input) - - val decoded = channel.readInbound() - decoded.shouldBeNull() - - channel.close() - } - - test("encoder should prepend correct length field") { - val encoder = PacketFrameEncoder() - val channel = EmbeddedChannel(encoder) - - val payload = Unpooled.buffer() - .writeByte(0xAB) - .writeByte(0xCD) - - channel.writeOutbound(payload) - - val encoded = channel.readAllOutbound() - encoded.readableBytes() shouldBe 4 - - // Check length field (should be 4: 2 bytes length + 2 bytes payload) - encoded.readUnsignedShortLE() shouldBe 4 - - // Check payload - encoded.readByte() shouldBe 0xAB.toByte() - encoded.readByte() shouldBe 0xCD.toByte() - - encoded.release() - channel.close() - } - - test("encoder should handle empty payload") { - val encoder = PacketFrameEncoder() - val channel = EmbeddedChannel(encoder) - - val payload = Unpooled.buffer() - - channel.writeOutbound(payload) - - val encoded = channel.readAllOutbound() - encoded.readableBytes() shouldBe 2 - - // Check length field (should be 2: only the length field) - encoded.readUnsignedShortLE() shouldBe 2 - - encoded.release() - channel.close() - } - - test("encoder should handle larger payload") { - val encoder = PacketFrameEncoder() - val channel = EmbeddedChannel(encoder) - - val payloadData = byteArrayOf(0x01, 0x02, 0x03, 0x04, 0x05) - val payload = Unpooled.buffer().writeBytes(payloadData) - - channel.writeOutbound(payload) - - val encoded = channel.readAllOutbound() - encoded.readableBytes() shouldBe (payloadData.size + 2) - - // Check length field - encoded.readUnsignedShortLE() shouldBe (payloadData.size + 2) - - // Check payload - for (expectedByte in payloadData) { - encoded.readByte() shouldBe expectedByte - } - - encoded.release() - channel.close() - } - - test("roundtrip encoding and decoding should work correctly") { - val encoder = PacketFrameEncoder() - val decoder = PacketFrameDecoder() - val channel = EmbeddedChannel(encoder, decoder) - - val originalPayload = byteArrayOf(0xDE.toByte(), 0xAD.toByte(), 0xBE.toByte(), 0xEF.toByte()) - val input = Unpooled.buffer().writeBytes(originalPayload) - - // Encode then decode - channel.writeOutbound(input) shouldBe true - val encoded = channel.readAllOutbound() - - channel.writeInbound(encoded) shouldBe true - val decoded = channel.readAllInbound() - - decoded.readableBytes() shouldBe originalPayload.size - for (expectedByte in originalPayload) { - decoded.readByte() shouldBe expectedByte - } - - decoded.release() - channel.close() - } -}) \ No newline at end of file diff --git a/server/src/test/kotlin/de/fiereu/openmmo/server/netty/PipelineIntegrationTest.kt b/server/src/test/kotlin/de/fiereu/openmmo/server/netty/PipelineIntegrationTest.kt deleted file mode 100644 index 89311f7..0000000 --- a/server/src/test/kotlin/de/fiereu/openmmo/server/netty/PipelineIntegrationTest.kt +++ /dev/null @@ -1,380 +0,0 @@ -package de.fiereu.openmmo.server.netty - -import de.fiereu.openmmo.server.protocol.tls.checksum.Crc16Checksum -import de.fiereu.openmmo.server.protocol.tls.checksum.HmacSha256Checksum -import de.fiereu.openmmo.server.protocol.tls.checksum.NoOpChecksum -import de.fiereu.openmmo.server.netty.handlers.checksum.ChecksumFrameDecoder -import de.fiereu.openmmo.server.netty.handlers.checksum.ChecksumFrameEncoder -import de.fiereu.openmmo.server.netty.handlers.frame.PacketFrameDecoder -import de.fiereu.openmmo.server.netty.handlers.frame.PacketFrameEncoder -import de.fiereu.openmmo.server.netty.handlers.tls.TlsDecryptionHandler -import de.fiereu.openmmo.server.netty.handlers.tls.TlsEncryptionHandler -import de.fiereu.openmmo.server.protocol.tls.DefaultTlsContext -import io.kotest.core.spec.style.FunSpec -import io.kotest.matchers.shouldBe -import io.kotest.matchers.shouldNotBe -import io.netty.buffer.ByteBuf -import io.netty.buffer.Unpooled -import io.netty.channel.embedded.EmbeddedChannel -import io.mockk.every -import io.mockk.mockk -import javax.crypto.Cipher - -class PipelineIntegrationTest : FunSpec({ - - test("complete outbound pipeline - TLS encryption -> checksum -> frame encoding (NoOpChecksum)") { - val tlsContext = createMockTlsContext() - val checksum = NoOpChecksum() - - // Create outbound pipeline: TLS encryption -> checksum -> frame encoding - // Note: In Netty outbound pipeline, handlers are processed in REVERSE order - val tlsEncoder = TlsEncryptionHandler(tlsContext) - val checksumEncoder = ChecksumFrameEncoder(checksum) - val frameEncoder = PacketFrameEncoder() - - val outboundChannel = EmbeddedChannel(frameEncoder, checksumEncoder, tlsEncoder) - - val originalData = byteArrayOf(0xAB.toByte(), 0xCD.toByte(), 0xEF.toByte(), 0x12.toByte()) - val input = Unpooled.buffer().writeBytes(originalData) - - outboundChannel.writeOutbound(input) shouldBe true - val finalOutput = outboundChannel.readAllOutbound() - - // Expected structure: [length (2 bytes)] + [encrypted_data (4 bytes)] + [checksum (0 bytes for NoOp)] - finalOutput.readableBytes() shouldBe 6 // 2 bytes length + 4 bytes encrypted data + 0 bytes checksum - - // Read and verify length field (little endian) - val lengthField = finalOutput.readUnsignedShortLE() - lengthField shouldBe 6 // Length includes itself (2) + encrypted data (4) + checksum (0) - - // Read the encrypted data - val encryptedData = ByteArray(4) - finalOutput.readBytes(encryptedData) - - // Encrypted data should be different from original (XOR with 0x42) - encryptedData shouldNotBe originalData - // Verify it's actually XOR encrypted - val expectedEncrypted = originalData.map { (it.toInt() xor 0x42).toByte() }.toByteArray() - encryptedData shouldBe expectedEncrypted - - finalOutput.release() - outboundChannel.close() - } - - test("complete outbound pipeline - TLS encryption -> checksum -> frame encoding (CRC16)") { - val tlsContext = createMockTlsContext() - val checksum = Crc16Checksum() - - val tlsEncoder = TlsEncryptionHandler(tlsContext) - val checksumEncoder = ChecksumFrameEncoder(checksum) - val frameEncoder = PacketFrameEncoder() - - val outboundChannel = EmbeddedChannel(frameEncoder, checksumEncoder, tlsEncoder) - - val originalData = byteArrayOf(0xAB.toByte(), 0xCD.toByte(), 0xEF.toByte(), 0x12.toByte()) - val input = Unpooled.buffer().writeBytes(originalData) - - outboundChannel.writeOutbound(input) shouldBe true - val finalOutput = outboundChannel.readAllOutbound() - - // Expected structure: [length (2 bytes)] + [encrypted_data (4 bytes)] + [crc16 checksum (2 bytes)] - finalOutput.readableBytes() shouldBe 8 // 2 + 4 + 2 - - val lengthField = finalOutput.readUnsignedShortLE() - lengthField shouldBe 8 - - // Read the encrypted data - val encryptedData = ByteArray(4) - finalOutput.readBytes(encryptedData) - encryptedData shouldNotBe originalData - - // Read the CRC16 checksum - val checksumData = ByteArray(2) - finalOutput.readBytes(checksumData) - // Verify checksum exists (non-zero for this data pattern) - checksumData shouldNotBe byteArrayOf(0, 0) - - finalOutput.release() - outboundChannel.close() - } - - test("complete outbound pipeline - TLS encryption -> checksum -> frame encoding (HMAC-SHA256)") { - val tlsContext = createMockTlsContext() - val key = byteArrayOf(0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08) - val checksum = HmacSha256Checksum(8, key) - - val tlsEncoder = TlsEncryptionHandler(tlsContext) - val checksumEncoder = ChecksumFrameEncoder(checksum) - val frameEncoder = PacketFrameEncoder() - - val outboundChannel = EmbeddedChannel(frameEncoder, checksumEncoder, tlsEncoder) - - val originalData = byteArrayOf(0xAB.toByte(), 0xCD.toByte(), 0xEF.toByte(), 0x12.toByte()) - val input = Unpooled.buffer().writeBytes(originalData) - - outboundChannel.writeOutbound(input) shouldBe true - val finalOutput = outboundChannel.readAllOutbound() - - // Expected structure: [length (2 bytes)] + [encrypted_data (4 bytes)] + [hmac (8 bytes)] - finalOutput.readableBytes() shouldBe 14 // 2 + 4 + 8 - - val lengthField = finalOutput.readUnsignedShortLE() - lengthField shouldBe 14 - - // Read the encrypted data - val encryptedData = ByteArray(4) - finalOutput.readBytes(encryptedData) - encryptedData shouldNotBe originalData - - // Read the HMAC - val hmacData = ByteArray(8) - finalOutput.readBytes(hmacData) - // HMAC should exist and be non-zero - hmacData shouldNotBe ByteArray(8) { 0 } - - finalOutput.release() - outboundChannel.close() - } - - test("complete inbound pipeline - frame decoding -> checksum verification -> TLS decryption (NoOpChecksum)") { - val tlsContext = createMockTlsContext() - val checksum = NoOpChecksum() - - // Create inbound pipeline: frame decoding -> checksum verification -> TLS decryption - val frameDecoder = PacketFrameDecoder() - val checksumDecoder = ChecksumFrameDecoder(checksum) - val tlsDecoder = TlsDecryptionHandler(tlsContext) - - val inboundChannel = EmbeddedChannel(frameDecoder, checksumDecoder, tlsDecoder) - - val originalData = byteArrayOf(0xAB.toByte(), 0xCD.toByte(), 0xEF.toByte(), 0x12.toByte()) - - // First encrypt the data to simulate what would come from the outbound pipeline - val encryptedData = originalData.map { (it.toInt() xor 0x42).toByte() }.toByteArray() - - // Create the complete packet: length + encrypted data (no checksum for NoOp) - val packetLength = 2 + encryptedData.size // length field + data - val completePacket = Unpooled.buffer() - .writeShortLE(packetLength) - .writeBytes(encryptedData) - - inboundChannel.writeInbound(completePacket) shouldBe true - val decryptedOutput = inboundChannel.readAllInbound() - - decryptedOutput.readableBytes() shouldBe originalData.size - val decryptedBytes = ByteArray(decryptedOutput.readableBytes()) - decryptedOutput.readBytes(decryptedBytes) - - // Should get back the original data - decryptedBytes shouldBe originalData - - decryptedOutput.release() - inboundChannel.close() - } - - test("complete inbound pipeline - frame decoding -> checksum verification -> TLS decryption (CRC16)") { - val tlsContext = createMockTlsContext() - val checksum = Crc16Checksum() - - val frameDecoder = PacketFrameDecoder() - val checksumDecoder = ChecksumFrameDecoder(checksum) - val tlsDecoder = TlsDecryptionHandler(tlsContext) - - val inboundChannel = EmbeddedChannel(frameDecoder, checksumDecoder, tlsDecoder) - - val originalData = byteArrayOf(0xAB.toByte(), 0xCD.toByte(), 0xEF.toByte(), 0x12.toByte()) - - // Encrypt the data - val encryptedData = originalData.map { (it.toInt() xor 0x42).toByte() }.toByteArray() - - // Calculate checksum for the encrypted data - val encryptedBuffer = Unpooled.buffer().writeBytes(encryptedData) - val checksumBytes = checksum.calculate(encryptedBuffer) - encryptedBuffer.release() - - // Create the complete packet: length + encrypted data + checksum - val packetLength = 2 + encryptedData.size + checksumBytes.size - val completePacket = Unpooled.buffer() - .writeShortLE(packetLength) - .writeBytes(encryptedData) - .writeBytes(checksumBytes) - - inboundChannel.writeInbound(completePacket) shouldBe true - val decryptedOutput = inboundChannel.readAllInbound() - - decryptedOutput.readableBytes() shouldBe originalData.size - val decryptedBytes = ByteArray(decryptedOutput.readableBytes()) - decryptedOutput.readBytes(decryptedBytes) - - decryptedBytes shouldBe originalData - - decryptedOutput.release() - inboundChannel.close() - } - - test("complete inbound pipeline - frame decoding -> checksum verification -> TLS decryption (HMAC-SHA256)") { - val tlsContext = createMockTlsContext() - val key = byteArrayOf(0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08) - val checksum = HmacSha256Checksum(8, key) - - val frameDecoder = PacketFrameDecoder() - val checksumDecoder = ChecksumFrameDecoder(checksum) - val tlsDecoder = TlsDecryptionHandler(tlsContext) - - val inboundChannel = EmbeddedChannel(frameDecoder, checksumDecoder, tlsDecoder) - - val originalData = byteArrayOf(0xAB.toByte(), 0xCD.toByte(), 0xEF.toByte(), 0x12.toByte()) - - // Encrypt the data - val encryptedData = originalData.map { (it.toInt() xor 0x42).toByte() }.toByteArray() - - // Calculate HMAC for the encrypted data - val encryptedBuffer = Unpooled.buffer().writeBytes(encryptedData) - val hmacBytes = checksum.calculate(encryptedBuffer) - encryptedBuffer.release() - - // Create the complete packet: length + encrypted data + hmac - val packetLength = 2 + encryptedData.size + hmacBytes.size - val completePacket = Unpooled.buffer() - .writeShortLE(packetLength) - .writeBytes(encryptedData) - .writeBytes(hmacBytes) - - inboundChannel.writeInbound(completePacket) shouldBe true - val decryptedOutput = inboundChannel.readAllInbound() - - decryptedOutput.readableBytes() shouldBe originalData.size - val decryptedBytes = ByteArray(decryptedOutput.readableBytes()) - decryptedOutput.readBytes(decryptedBytes) - - decryptedBytes shouldBe originalData - - decryptedOutput.release() - inboundChannel.close() - } - - test("complete roundtrip - outbound then inbound pipeline should preserve original data") { - val tlsContext = createMockTlsContext() - val checksum = Crc16Checksum() - - // Outbound pipeline: TLS encryption -> checksum -> frame encoding - val tlsEncoder = TlsEncryptionHandler(tlsContext) - val checksumEncoder = ChecksumFrameEncoder(checksum) - val frameEncoder = PacketFrameEncoder() - val outboundChannel = EmbeddedChannel(frameEncoder, checksumEncoder, tlsEncoder) - - // Inbound pipeline: frame decoding -> checksum verification -> TLS decryption - val frameDecoder = PacketFrameDecoder() - val checksumDecoder = ChecksumFrameDecoder(checksum) - val tlsDecoder = TlsDecryptionHandler(tlsContext) - val inboundChannel = EmbeddedChannel(frameDecoder, checksumDecoder, tlsDecoder) - - val originalData = byteArrayOf(0xDE.toByte(), 0xAD.toByte(), 0xBE.toByte(), 0xEF.toByte()) - val input = Unpooled.buffer().writeBytes(originalData) - - // Process through outbound pipeline - outboundChannel.writeOutbound(input) shouldBe true - val processedPacket = outboundChannel.readAllOutbound() - - // Process through inbound pipeline - inboundChannel.writeInbound(processedPacket) shouldBe true - val finalOutput = inboundChannel.readAllInbound() - - // Should get back the original data - finalOutput.readableBytes() shouldBe originalData.size - val finalBytes = ByteArray(finalOutput.readableBytes()) - finalOutput.readBytes(finalBytes) - finalBytes shouldBe originalData - - finalOutput.release() - outboundChannel.close() - inboundChannel.close() - } - - test("complete roundtrip with multiple packets should maintain order and content") { - // Create separate TLS contexts for encoder and decoder to avoid stream cipher sync issues - val encoderTlsContext = createMockTlsContext() - val decoderTlsContext = createMockTlsContext() // Same XOR key, but separate cipher state - val key = byteArrayOf(1, 2, 3, 4, 5, 6, 7, 8) - - // Create separate checksum instances for encoder and decoder - // Both start with the same key but maintain separate round counters - val encoderChecksum = HmacSha256Checksum(4, key) - val decoderChecksum = HmacSha256Checksum(4, key) - - // Create pipelines - val tlsEncoder = TlsEncryptionHandler(encoderTlsContext) - val checksumEncoder = ChecksumFrameEncoder(encoderChecksum) - val frameEncoder = PacketFrameEncoder() - val outboundChannel = EmbeddedChannel(frameEncoder, checksumEncoder, tlsEncoder) - - val frameDecoder = PacketFrameDecoder() - val checksumDecoder = ChecksumFrameDecoder(decoderChecksum) - val tlsDecoder = TlsDecryptionHandler(decoderTlsContext) - val inboundChannel = EmbeddedChannel(frameDecoder, checksumDecoder, tlsDecoder) - - val packets = listOf( - byteArrayOf(0x01, 0x02, 0x03), - byteArrayOf(0x04, 0x05, 0x06, 0x07), - byteArrayOf(0x08, 0x09), - byteArrayOf(0x0A, 0x0B, 0x0C, 0x0D, 0x0E) - ) - - val processedPackets = mutableListOf() - - // Process each packet through the complete pipeline - for (originalPacket in packets) { - val input = Unpooled.buffer().writeBytes(originalPacket) - - // Outbound processing - outboundChannel.writeOutbound(input) shouldBe true - val processedPacket = outboundChannel.readAllOutbound() - - // Inbound processing - inboundChannel.writeInbound(processedPacket) shouldBe true - val finalOutput = inboundChannel.readAllInbound() - - val finalBytes = ByteArray(finalOutput.readableBytes()) - finalOutput.readBytes(finalBytes) - processedPackets.add(finalBytes) - - finalOutput.release() - } - - // Verify all packets were processed correctly - packets.forEachIndexed { index, originalPacket -> - processedPackets[index] shouldBe originalPacket - } - - outboundChannel.close() - inboundChannel.close() - } - - test("inbound pipeline should reject packet with invalid checksum") { - val tlsContext = createMockTlsContext() - val checksum = Crc16Checksum() - - val frameDecoder = PacketFrameDecoder() - val checksumDecoder = ChecksumFrameDecoder(checksum) - val tlsDecoder = TlsDecryptionHandler(tlsContext) - val inboundChannel = EmbeddedChannel(frameDecoder, checksumDecoder, tlsDecoder) - - val originalData = byteArrayOf(0xAB.toByte(), 0xCD.toByte(), 0xEF.toByte(), 0x12.toByte()) - val encryptedData = originalData.map { (it.toInt() xor 0x42).toByte() }.toByteArray() - - // Create packet with invalid checksum - val packetLength = 2 + encryptedData.size + 2 // length + data + invalid checksum - val invalidPacket = Unpooled.buffer() - .writeShortLE(packetLength) - .writeBytes(encryptedData) - .writeByte(0xFF) // Invalid checksum - .writeByte(0xFF) - - inboundChannel.writeInbound(invalidPacket) shouldBe false - - // Should not produce any output due to checksum failure - inboundChannel.readInbound() shouldBe null - - inboundChannel.close() - } -}) \ No newline at end of file diff --git a/server/src/test/kotlin/de/fiereu/openmmo/server/netty/TlsHandlerTest.kt b/server/src/test/kotlin/de/fiereu/openmmo/server/netty/TlsHandlerTest.kt deleted file mode 100644 index 40f39c7..0000000 --- a/server/src/test/kotlin/de/fiereu/openmmo/server/netty/TlsHandlerTest.kt +++ /dev/null @@ -1,248 +0,0 @@ -package de.fiereu.openmmo.server.netty - -import de.fiereu.openmmo.server.netty.handlers.tls.TlsDecryptionHandler -import de.fiereu.openmmo.server.netty.handlers.tls.TlsEncryptionHandler -import de.fiereu.openmmo.server.protocol.tls.DefaultTlsContext -import io.kotest.core.spec.style.FunSpec -import io.kotest.matchers.shouldBe -import io.kotest.matchers.shouldNotBe -import io.netty.buffer.ByteBuf -import io.netty.buffer.Unpooled -import io.netty.channel.embedded.EmbeddedChannel -import io.mockk.every -import io.mockk.mockk -import javax.crypto.Cipher - -class TlsHandlerTest : FunSpec({ - - test("TlsEncryptionHandler should encrypt data") { - val tlsContext = createMockTlsContext() - val encoder = TlsEncryptionHandler(tlsContext) - val channel = EmbeddedChannel(encoder) - - val originalData = byteArrayOf(0xAB.toByte(), 0xCD.toByte(), 0xEF.toByte(), 0x12.toByte()) - val input = Unpooled.buffer().writeBytes(originalData) - - channel.writeOutbound(input) - - val encrypted = channel.readAllOutbound() - encrypted.readableBytes() shouldBe originalData.size - - // The encrypted data should be different from the original - val encryptedBytes = ByteArray(encrypted.readableBytes()) - encrypted.readBytes(encryptedBytes) - encryptedBytes shouldNotBe originalData - - encrypted.release() - channel.close() - } - - test("TlsDecryptionHandler should decrypt data") { - val tlsContext = createMockTlsContext() - val decoder = TlsDecryptionHandler(tlsContext) - val channel = EmbeddedChannel(decoder) - - val originalData = byteArrayOf(0xAB.toByte(), 0xCD.toByte(), 0xEF.toByte(), 0x12.toByte()) - - // First encrypt the data using the TLS context directly - val encryptedBytes = tlsContext.encrypt(originalData) - val input = Unpooled.buffer().writeBytes(encryptedBytes) - - channel.writeInbound(input) - - val decrypted = channel.readAllInbound() - decrypted.readableBytes() shouldBe originalData.size - - val decryptedBytes = ByteArray(decrypted.readableBytes()) - decrypted.readBytes(decryptedBytes) - decryptedBytes shouldBe originalData - - decrypted.release() - channel.close() - } - - test("TlsEncryptionHandler should handle empty data") { - val tlsContext = createMockTlsContext() - val encoder = TlsEncryptionHandler(tlsContext) - val channel = EmbeddedChannel(encoder) - - val input = Unpooled.buffer() // Empty buffer - - channel.writeOutbound(input) - - val encrypted = channel.readAllOutbound() - encrypted.readableBytes() shouldBe 0 - - encrypted.release() - channel.close() - } - - test("TlsDecryptionHandler should handle empty data") { - val tlsContext = createMockTlsContext() - val decoder = TlsDecryptionHandler(tlsContext) - val channel = EmbeddedChannel(decoder) - - val input = Unpooled.buffer() // Empty buffer - - channel.writeInbound(input) - - // Should not produce any output for empty input - channel.readInbound() shouldBe null - - channel.close() - } - - test("TlsEncryptionHandler should handle large data") { - val tlsContext = createMockTlsContext() - val encoder = TlsEncryptionHandler(tlsContext) - val channel = EmbeddedChannel(encoder) - - val largeData = ByteArray(1024) { it.toByte() } - val input = Unpooled.buffer().writeBytes(largeData) - - channel.writeOutbound(input) - - val encrypted = channel.readAllOutbound() - encrypted.readableBytes() shouldBe largeData.size - - // The encrypted data should be different from the original - val encryptedBytes = ByteArray(encrypted.readableBytes()) - encrypted.readBytes(encryptedBytes) - encryptedBytes shouldNotBe largeData - - encrypted.release() - channel.close() - } - - test("TlsDecryptionHandler should handle large data") { - val tlsContext = createMockTlsContext() - val decoder = TlsDecryptionHandler(tlsContext) - val channel = EmbeddedChannel(decoder) - - val largeData = ByteArray(1024) { it.toByte() } - - // First encrypt the data using the TLS context directly - val encryptedBytes = tlsContext.encrypt(largeData) - val input = Unpooled.buffer().writeBytes(encryptedBytes) - - channel.writeInbound(input) - - val decrypted = channel.readAllInbound() - decrypted.readableBytes() shouldBe largeData.size - - val decryptedBytes = ByteArray(decrypted.readableBytes()) - decrypted.readBytes(decryptedBytes) - decryptedBytes shouldBe largeData - - decrypted.release() - channel.close() - } - - test("roundtrip - encryption then decryption should preserve data") { - val tlsContext = createMockTlsContext() - val encoder = TlsEncryptionHandler(tlsContext) - val decoder = TlsDecryptionHandler(tlsContext) - - val originalData = byteArrayOf(0xDE.toByte(), 0xAD.toByte(), 0xBE.toByte(), 0xEF.toByte()) - val input = Unpooled.buffer().writeBytes(originalData) - - // Encrypt - val encryptChannel = EmbeddedChannel(encoder) - encryptChannel.writeOutbound(input) shouldBe true - val encrypted = encryptChannel.readAllOutbound() - - // Decrypt - val decryptChannel = EmbeddedChannel(decoder) - decryptChannel.writeInbound(encrypted) shouldBe true - val decrypted = decryptChannel.readAllInbound() - - decrypted.readableBytes() shouldBe originalData.size - val decryptedBytes = ByteArray(decrypted.readableBytes()) - decrypted.readBytes(decryptedBytes) - decryptedBytes shouldBe originalData - - decrypted.release() - encryptChannel.close() - decryptChannel.close() - } - - test("roundtrip - multiple packets should maintain stream cipher state") { - val tlsContext = createMockTlsContext() - val encoder = TlsEncryptionHandler(tlsContext) - val decoder = TlsDecryptionHandler(tlsContext) - - val encryptChannel = EmbeddedChannel(encoder) - val decryptChannel = EmbeddedChannel(decoder) - - val packets = listOf( - byteArrayOf(0x01, 0x02, 0x03), - byteArrayOf(0x04, 0x05), - byteArrayOf(0x06, 0x07, 0x08, 0x09) - ) - - val decryptedPackets = mutableListOf() - - // Process each packet in order (maintaining stream cipher state) - for (packet in packets) { - val input = Unpooled.buffer().writeBytes(packet) - - // Encrypt - encryptChannel.writeOutbound(input) shouldBe true - val encrypted = encryptChannel.readAllOutbound() - - // Decrypt - decryptChannel.writeInbound(encrypted) shouldBe true - val decrypted = decryptChannel.readAllInbound() - - val decryptedBytes = ByteArray(decrypted.readableBytes()) - decrypted.readBytes(decryptedBytes) - decryptedPackets.add(decryptedBytes) - - decrypted.release() - } - - // Verify all packets were decrypted correctly - packets.forEachIndexed { index, originalPacket -> - decryptedPackets[index] shouldBe originalPacket - } - - encryptChannel.close() - decryptChannel.close() - } - - test("two different TlsContexts should produce different ciphertexts") { - val tlsContext1 = createMockTlsContext() - val tlsContext2 = createMockTlsContext(0x24) - - val encoder1 = TlsEncryptionHandler(tlsContext1) - val encoder2 = TlsEncryptionHandler(tlsContext2) - - val channel1 = EmbeddedChannel(encoder1) - val channel2 = EmbeddedChannel(encoder2) - - val originalData = byteArrayOf(0xAB.toByte(), 0xCD.toByte(), 0xEF.toByte(), 0x12.toByte()) - val input1 = Unpooled.buffer().writeBytes(originalData) - val input2 = Unpooled.buffer().writeBytes(originalData) - - channel1.writeOutbound(input1) - channel2.writeOutbound(input2) - - val encrypted1 = channel1.readAllOutbound() - val encrypted2 = channel2.readAllOutbound() - - encrypted1.readableBytes() shouldBe encrypted2.readableBytes() - - val encrypted1Bytes = ByteArray(encrypted1.readableBytes()) - val encrypted2Bytes = ByteArray(encrypted2.readableBytes()) - encrypted1.readBytes(encrypted1Bytes) - encrypted2.readBytes(encrypted2Bytes) - - // Different contexts should produce different ciphertext - encrypted1Bytes shouldNotBe encrypted2Bytes - - encrypted1.release() - encrypted2.release() - channel1.close() - channel2.close() - } -}) \ No newline at end of file diff --git a/server/src/test/kotlin/de/fiereu/openmmo/server/netty/TlsHelper.kt b/server/src/test/kotlin/de/fiereu/openmmo/server/netty/TlsHelper.kt deleted file mode 100644 index a82c831..0000000 --- a/server/src/test/kotlin/de/fiereu/openmmo/server/netty/TlsHelper.kt +++ /dev/null @@ -1,21 +0,0 @@ -package de.fiereu.openmmo.server.netty - -import de.fiereu.openmmo.server.protocol.tls.TlsContext -import io.mockk.every -import io.mockk.mockk - -fun createMockTlsContext(xorKey: Int = 0x42): TlsContext { - val mockTlsContext = mockk(relaxed = true) - - every { mockTlsContext.encrypt(any()) } answers { - val input = firstArg() - input.map { (it.toInt() xor xorKey).toByte() }.toByteArray() - } - - every { mockTlsContext.decrypt(any()) } answers { - val input = firstArg() - input.map { (it.toInt() xor xorKey).toByte() }.toByteArray() - } - - return mockTlsContext -} \ No newline at end of file diff --git a/settings.gradle.kts b/settings.gradle.kts index 813088c..227dce8 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -15,10 +15,9 @@ include(":keys") include(":patcher") include(":common") include(":bytecodec") -include(":protocol") -include(":protocol.tls") -include(":protocol.login") -include(":protocol.game") -include(":server") +include(":network") +include(":protocols.login") +include(":protocols.game") include(":server.login") -include(":server.game") \ No newline at end of file +include(":server.game") +include(":maps")

(buf) + return with(scope) { body() } + } + + final override fun write(buf: WriteBuffer, value: P) { + val scope = WritingScope(buf, value) + with(scope) { body() } + } +} + +fun CodecScope<*>.reserved(byte: Int = 0, strict: Boolean = false) { + structural(de.fiereu.bytecodec.reserved(byte = byte, strict = strict)) +} + +fun CodecScope<*>.padding(n: Int, fill: Byte = 0) { + structural(de.fiereu.bytecodec.padding(n = n, fill = fill)) +} + +fun CodecScope<*>.skip(n: Int) { + structural(de.fiereu.bytecodec.skip(n = n)) +} diff --git a/bytecodec/src/main/kotlin/de/fiereu/bytecodec/test/TestHelpers.kt b/bytecodec/src/main/kotlin/de/fiereu/bytecodec/test/TestHelpers.kt new file mode 100644 index 0000000..c4b9d84 --- /dev/null +++ b/bytecodec/src/main/kotlin/de/fiereu/bytecodec/test/TestHelpers.kt @@ -0,0 +1,47 @@ +package de.fiereu.bytecodec.test + +import de.fiereu.bytecodec.ByteArrayReadBuffer +import de.fiereu.bytecodec.Codec +import de.fiereu.bytecodec.GrowableWriteBuffer + +private fun contentEqual(a: Any?, b: Any?): Boolean = + when { + a is ByteArray && b is ByteArray -> a.contentEquals(b) + a is Array<*> && b is Array<*> -> a.contentDeepEquals(b) + else -> a == b + } + +fun Codec.encodeToBytes(value: T): ByteArray { + val buf = GrowableWriteBuffer() + write(buf, value) + return buf.toByteArray() +} + +fun Codec.decodeBytes(bytes: ByteArray): T { + val buf = ByteArrayReadBuffer(bytes) + val value = read(buf) + check(buf.remaining() == 0) { "decode left ${buf.remaining()} bytes unread" } + return value +} + +fun Codec.assertValueRoundtrip(value: T) { + val bytes = encodeToBytes(value) + val decoded = decodeBytes(bytes) + if (!contentEqual(decoded, value)) { + throw AssertionError( + "value roundtrip mismatch: original=$value decoded=$decoded bytes=${bytes.toHex()}", + ) + } +} + +fun Codec.assertBytesRoundtrip(bytes: ByteArray) { + val value = decodeBytes(bytes) + val reencoded = encodeToBytes(value) + if (!reencoded.contentEquals(bytes)) { + throw AssertionError( + "bytes roundtrip mismatch: original=${bytes.toHex()} reencoded=${reencoded.toHex()} value=$value", + ) + } +} + +private fun ByteArray.toHex(): String = joinToString("") { "%02x".format(it.toInt() and 0xFF) } diff --git a/bytecodec/src/test/kotlin/de/fiereu/bytecodec/AtomsTest.kt b/bytecodec/src/test/kotlin/de/fiereu/bytecodec/AtomsTest.kt new file mode 100644 index 0000000..40f2717 --- /dev/null +++ b/bytecodec/src/test/kotlin/de/fiereu/bytecodec/AtomsTest.kt @@ -0,0 +1,140 @@ +package de.fiereu.bytecodec + +import de.fiereu.bytecodec.test.assertBytesRoundtrip +import de.fiereu.bytecodec.test.assertValueRoundtrip +import de.fiereu.bytecodec.test.decodeBytes +import de.fiereu.bytecodec.test.encodeToBytes +import io.kotest.assertions.throwables.shouldThrow +import io.kotest.core.spec.style.FunSpec +import io.kotest.matchers.shouldBe + +class AtomsTest : + FunSpec({ + test("Bool roundtrips") { + Bool.assertValueRoundtrip(true) + Bool.assertValueRoundtrip(false) + Bool.encodeToBytes(true) shouldBe byteArrayOf(0x01) + Bool.encodeToBytes(false) shouldBe byteArrayOf(0x00) + Bool.decodeBytes(byteArrayOf(0x05)) shouldBe true + } + + test("U8 wire format") { + U8.encodeToBytes(0) shouldBe byteArrayOf(0x00) + U8.encodeToBytes(255) shouldBe byteArrayOf(0xFF.toByte()) + U8.decodeBytes(byteArrayOf(0xFF.toByte())) shouldBe 255 + shouldThrow { U8.encodeToBytes(256) } + } + + test("S8 wire format") { + S8.assertValueRoundtrip(0) + S8.assertValueRoundtrip(-1) + S8.assertValueRoundtrip(127) + S8.assertValueRoundtrip(-128) + } + + test("U16LE wire format") { + U16LE.encodeToBytes(0x1234) shouldBe byteArrayOf(0x34, 0x12) + U16LE.decodeBytes(byteArrayOf(0x34, 0x12)) shouldBe 0x1234 + } + + test("U16BE wire format") { + U16BE.encodeToBytes(0x1234) shouldBe byteArrayOf(0x12, 0x34) + U16BE.decodeBytes(byteArrayOf(0x12, 0x34)) shouldBe 0x1234 + } + + test("S16LE signed") { + S16LE.assertValueRoundtrip((-1).toShort()) + S16LE.assertValueRoundtrip(Short.MIN_VALUE) + S16LE.assertValueRoundtrip(Short.MAX_VALUE) + } + + test("S32LE wire format") { + S32LE.encodeToBytes(0x11223344) shouldBe byteArrayOf(0x44, 0x33, 0x22, 0x11) + S32LE.decodeBytes(byteArrayOf(0x44, 0x33, 0x22, 0x11)) shouldBe 0x11223344 + S32LE.assertValueRoundtrip(Int.MIN_VALUE) + S32LE.assertValueRoundtrip(Int.MAX_VALUE) + } + + test("S32BE wire format") { + S32BE.encodeToBytes(0x11223344) shouldBe byteArrayOf(0x11, 0x22, 0x33, 0x44) + S32BE.assertValueRoundtrip(Int.MIN_VALUE) + } + + test("U32LE roundtrip across full range") { + U32LE.assertValueRoundtrip(0L) + U32LE.assertValueRoundtrip(0xFFFFFFFFL) + U32LE.encodeToBytes(0xFFFFFFFFL) shouldBe + byteArrayOf(0xFF.toByte(), 0xFF.toByte(), 0xFF.toByte(), 0xFF.toByte()) + } + + test("U32BE roundtrip") { + U32BE.encodeToBytes(0x11223344L) shouldBe byteArrayOf(0x11, 0x22, 0x33, 0x44) + } + + test("S64LE wire format") { + S64LE.encodeToBytes(0x0102030405060708L) shouldBe + byteArrayOf(0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01) + S64LE.assertValueRoundtrip(Long.MIN_VALUE) + S64LE.assertValueRoundtrip(Long.MAX_VALUE) + } + + test("S64BE wire format") { + S64BE.encodeToBytes(0x0102030405060708L) shouldBe + byteArrayOf(0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08) + } + + test("F32 / F64 roundtrip") { + F32LE.assertValueRoundtrip(3.14f) + F32BE.assertValueRoundtrip(-0.0f) + F64LE.assertValueRoundtrip(2.718281828) + F64BE.assertValueRoundtrip(Double.NEGATIVE_INFINITY) + } + + test("fixedBytes preserves payload") { + val codec = fixedBytes(4) + val payload = byteArrayOf(0x01, 0x02, 0x03, 0x04) + codec.assertBytesRoundtrip(payload) + shouldThrow { codec.encodeToBytes(byteArrayOf(0, 0, 0)) } + } + + test("unknownBytes is lossless") { + val codec = unknownBytes(3) + codec.assertBytesRoundtrip(byteArrayOf(0xDE.toByte(), 0xAD.toByte(), 0xBE.toByte())) + } + + test("reserved strict checks value") { + val codec = reserved(0xAB, strict = true) + codec.decodeBytes(byteArrayOf(0xAB.toByte())) shouldBe Unit + shouldThrow { codec.decodeBytes(byteArrayOf(0x01)) } + } + + test("reserved non-strict accepts anything on read but writes literal") { + val codec = reserved(0x00) + codec.decodeBytes(byteArrayOf(0xFF.toByte())) shouldBe Unit + codec.encodeToBytes(Unit) shouldBe byteArrayOf(0x00) + } + + test("padding writes fill bytes") { + val codec = padding(3, fill = 0xAA.toByte()) + codec.encodeToBytes(Unit) shouldBe byteArrayOf(0xAA.toByte(), 0xAA.toByte(), 0xAA.toByte()) + } + + test("Utf16LeNullTerminated roundtrip") { + Utf16LeNullTerminated.assertValueRoundtrip("hello") + Utf16LeNullTerminated.assertValueRoundtrip("") + Utf16LeNullTerminated.assertValueRoundtrip("naïve résumé") + Utf16LeNullTerminated.encodeToBytes("ab") shouldBe + byteArrayOf(0x61, 0x00, 0x62, 0x00, 0x00, 0x00) + } + + test("Utf16BeNullTerminated roundtrip") { + Utf16BeNullTerminated.assertValueRoundtrip("hello") + Utf16BeNullTerminated.encodeToBytes("ab") shouldBe + byteArrayOf(0x00, 0x61, 0x00, 0x62, 0x00, 0x00) + } + + test("AsciiNullTerminated roundtrip") { + AsciiNullTerminated.assertValueRoundtrip("hello") + AsciiNullTerminated.encodeToBytes("ab") shouldBe byteArrayOf(0x61, 0x62, 0x00) + } + }) diff --git a/bytecodec/src/test/kotlin/de/fiereu/bytecodec/BuffersTest.kt b/bytecodec/src/test/kotlin/de/fiereu/bytecodec/BuffersTest.kt new file mode 100644 index 0000000..ef5b404 --- /dev/null +++ b/bytecodec/src/test/kotlin/de/fiereu/bytecodec/BuffersTest.kt @@ -0,0 +1,50 @@ +package de.fiereu.bytecodec + +import io.kotest.assertions.throwables.shouldThrow +import io.kotest.core.spec.style.FunSpec +import io.kotest.matchers.shouldBe +import java.nio.ByteBuffer + +class BuffersTest : + FunSpec({ + test("ByteArrayReadBuffer sequential read") { + val buf = ByteArrayReadBuffer(byteArrayOf(1, 2, 3, 4)) + buf.readByte() shouldBe 1 + buf.remaining() shouldBe 3 + val dst = ByteArray(2) + buf.readBytes(dst) + dst shouldBe byteArrayOf(2, 3) + buf.skip(1) + buf.remaining() shouldBe 0 + shouldThrow { buf.readByte() } + } + + test("ByteArrayReadBuffer respects offset and length") { + val buf = ByteArrayReadBuffer(byteArrayOf(9, 1, 2, 3, 9), offset = 1, length = 3) + buf.remaining() shouldBe 3 + val arr = ByteArray(3) + buf.readBytes(arr) + arr shouldBe byteArrayOf(1, 2, 3) + } + + test("GrowableWriteBuffer grows on demand") { + val buf = GrowableWriteBuffer(initialCapacity = 2) + repeat(10) { buf.writeByte(it.toByte()) } + buf.size() shouldBe 10 + buf.toByteArray() shouldBe byteArrayOf(0, 1, 2, 3, 4, 5, 6, 7, 8, 9) + } + + test("NioReadBuffer / NioWriteBuffer interoperate") { + val nio = ByteBuffer.allocate(8) + val write = NioWriteBuffer(nio) + write.writeByte(0x11) + write.writeBytes(byteArrayOf(0x22, 0x33)) + nio.flip() + val read = NioReadBuffer(nio) + read.readByte() shouldBe 0x11 + val arr = ByteArray(2) + read.readBytes(arr) + arr shouldBe byteArrayOf(0x22, 0x33) + read.remaining() shouldBe 0 + } + }) diff --git a/bytecodec/src/test/kotlin/de/fiereu/bytecodec/CombinatorsTest.kt b/bytecodec/src/test/kotlin/de/fiereu/bytecodec/CombinatorsTest.kt new file mode 100644 index 0000000..d2d44c8 --- /dev/null +++ b/bytecodec/src/test/kotlin/de/fiereu/bytecodec/CombinatorsTest.kt @@ -0,0 +1,134 @@ +package de.fiereu.bytecodec + +import de.fiereu.bytecodec.test.assertBytesRoundtrip +import de.fiereu.bytecodec.test.assertValueRoundtrip +import de.fiereu.bytecodec.test.decodeBytes +import de.fiereu.bytecodec.test.encodeToBytes +import io.kotest.assertions.throwables.shouldThrow +import io.kotest.core.spec.style.FunSpec +import io.kotest.matchers.shouldBe + +private enum class Color { + RED, + GREEN, + BLUE +} + +class CombinatorsTest : + FunSpec({ + test("imap lifts an atom") { + val codec = U8.imap(decode = { it + 1 }, encode = { it - 1 }) + codec.encodeToBytes(10) shouldBe byteArrayOf(0x09) + codec.decodeBytes(byteArrayOf(0x09)) shouldBe 10 + } + + test("imapCatching wraps non-CodecException") { + val codec = + U8.imapCatching( + decode = { error("boom") }, + encode = { _: Int -> 0 }, + ) + shouldThrow { codec.decodeBytes(byteArrayOf(0x00)) } + } + + test("listPrefixed with U8 prefix") { + val codec = U16LE.listPrefixed(U8) + codec.assertValueRoundtrip(listOf(1, 2, 3)) + codec.encodeToBytes(emptyList()) shouldBe byteArrayOf(0x00) + codec.encodeToBytes(listOf(0x1234, 0x5678)) shouldBe + byteArrayOf(0x02, 0x34, 0x12, 0x78, 0x56) + } + + test("repeat is fixed-count") { + val codec = U8.repeat(3) + codec.assertBytesRoundtrip(byteArrayOf(1, 2, 3)) + shouldThrow { codec.encodeToBytes(listOf(1, 2)) } + } + + test("bytesPrefixed") { + val codec = bytesPrefixed(U8) + codec.assertBytesRoundtrip(byteArrayOf(0x03, 0xAA.toByte(), 0xBB.toByte(), 0xCC.toByte())) + } + + test("stringPrefixed UTF-8") { + val codec = stringPrefixed(U8, Charsets.UTF_8) + codec.assertValueRoundtrip("hello") + val bytes = "héllo".toByteArray(Charsets.UTF_8) + codec.encodeToBytes("héllo")[0].toInt() shouldBe bytes.size + } + + test("enumByOrdinalByte") { + val codec = enumByOrdinalByte() + codec.assertValueRoundtrip(Color.RED) + codec.assertValueRoundtrip(Color.BLUE) + codec.encodeToBytes(Color.BLUE) shouldBe byteArrayOf(0x02) + shouldThrow { codec.decodeBytes(byteArrayOf(0x05)) } + } + + test("enumBy with custom mapping") { + val keys = mapOf(Color.RED to 10, Color.GREEN to 20, Color.BLUE to 30) + val reverse = keys.entries.associate { (k, v) -> v to k } + val codec = + enumBy( + prefix = U8, + lookup = { reverse[it] ?: throw MalformedPacketException("bad key $it") }, + keyOf = { keys.getValue(it) }, + ) + codec.encodeToBytes(Color.GREEN) shouldBe byteArrayOf(20) + codec.decodeBytes(byteArrayOf(30)) shouldBe Color.BLUE + } + + test("choose dispatches on tag") { + val u8List = U8.listPrefixed(U8) + val codec: Codec = + choose( + tag = U8, + identify = { v -> + when (v) { + is Int -> 0x01 + is String -> 0x02 + else -> error("unhandled $v") + } + }, + 0x01 to U16LE as Codec, + 0x02 to AsciiNullTerminated as Codec, + ) + codec.encodeToBytes(0x1234) shouldBe byteArrayOf(0x01, 0x34, 0x12) + codec.encodeToBytes("ok") shouldBe byteArrayOf(0x02, 0x6F, 0x6B, 0x00) + shouldThrow { codec.decodeBytes(byteArrayOf(0xFE.toByte())) } + u8List.encodeToBytes(emptyList()).size shouldBe 1 + } + + test("optional with explicit flag") { + val codec = U16LE.optional() + codec.assertValueRoundtrip(null) + codec.assertValueRoundtrip(0x1234) + codec.encodeToBytes(null) shouldBe byteArrayOf(0x00) + codec.encodeToBytes(0x1234) shouldBe byteArrayOf(0x01, 0x34, 0x12) + } + + test("then pairs two codecs") { + val codec = U8.then(U16LE) + codec.assertValueRoundtrip(5 to 0x1234) + codec.encodeToBytes(5 to 0x1234) shouldBe byteArrayOf(0x05, 0x34, 0x12) + } + + test("bitsLE roundtrip") { + val codec = + bitsLE(U8) { + bit(0, "a") + bit(3, "b") + bit(7, "c") + } + val set = codec.of("a" to true, "b" to false, "c" to true) + set["a"] shouldBe true + set["b"] shouldBe false + set["c"] shouldBe true + set[0] shouldBe true + val bytes = codec.encodeToBytes(set) + bytes shouldBe byteArrayOf(0b10000001.toByte()) + val decoded = codec.decodeBytes(bytes) + decoded["a"] shouldBe true + decoded["c"] shouldBe true + } + }) diff --git a/bytecodec/src/test/kotlin/de/fiereu/bytecodec/PacketCodecTest.kt b/bytecodec/src/test/kotlin/de/fiereu/bytecodec/PacketCodecTest.kt new file mode 100644 index 0000000..67dae60 --- /dev/null +++ b/bytecodec/src/test/kotlin/de/fiereu/bytecodec/PacketCodecTest.kt @@ -0,0 +1,109 @@ +package de.fiereu.bytecodec + +import de.fiereu.bytecodec.test.assertBytesRoundtrip +import de.fiereu.bytecodec.test.assertValueRoundtrip +import de.fiereu.bytecodec.test.encodeToBytes +import io.kotest.core.spec.style.FunSpec +import io.kotest.matchers.shouldBe + +private data class GameServer( + val id: Int, + val name: String, + val currentPlayers: Int, + val maxPlayers: Int, + val joinable: Boolean, +) + +private object GameServerCodec : PacketCodec() { + override fun CodecScope.body() = + GameServer( + id = field(U8, GameServer::id), + name = field(Utf16LeNullTerminated, GameServer::name), + currentPlayers = field(U16LE, GameServer::currentPlayers), + maxPlayers = field(U16LE, GameServer::maxPlayers), + joinable = field(Bool, GameServer::joinable), + ) +} + +private data class LoadEntityPacket( + val entityId: Long, + val name: String, + val gateA: ByteArray?, + val gateB: Int?, +) { + override fun equals(other: Any?): Boolean = + other is LoadEntityPacket && + entityId == other.entityId && + name == other.name && + (gateA?.contentEquals(other.gateA) ?: (other.gateA == null)) && + gateB == other.gateB + + override fun hashCode(): Int = entityId.hashCode() +} + +private object LoadEntityCodec : PacketCodec() { + override fun CodecScope.body(): LoadEntityPacket { + val entityId = field(S64BE, LoadEntityPacket::entityId) + reserved(0) + val name = field(Utf16LeNullTerminated, LoadEntityPacket::name) + val flags = + field(U16LE) { + var f = 0 + if (it.gateA != null) f = f or 0x01 + if (it.gateB != null) f = f or 0x02 + f + } + val gateA = if (flags and 0x01 != 0) field(unknownBytes(2)) { it.gateA!! } else null + val gateB = if (flags and 0x02 != 0) field(U32LE) { it.gateB!!.toLong() }.toInt() else null + return LoadEntityPacket(entityId, name, gateA, gateB) + } +} + +class PacketCodecTest : + FunSpec({ + test("simple PacketCodec roundtrip") { + val pkt = + GameServer( + id = 1, name = "alpha", currentPlayers = 10, maxPlayers = 100, joinable = true) + GameServerCodec.assertValueRoundtrip(pkt) + } + + test("byte-level layout of GameServer") { + val bytes = GameServerCodec.encodeToBytes(GameServer(7, "ab", 3, 9, false)) + bytes shouldBe + byteArrayOf( + 0x07, + 0x61, + 0x00, + 0x62, + 0x00, + 0x00, + 0x00, + 0x03, + 0x00, + 0x09, + 0x00, + 0x00, + ) + } + + test("complex packet with reserved, flags, optional sections") { + LoadEntityCodec.assertValueRoundtrip( + LoadEntityPacket(42L, "world", gateA = null, gateB = null), + ) + LoadEntityCodec.assertValueRoundtrip( + LoadEntityPacket( + entityId = 0x0102030405060708L, + name = "x", + gateA = byteArrayOf(0xAA.toByte(), 0xBB.toByte()), + gateB = 0x11223344, + ), + ) + } + + test("structural reserved bytes survive bytes roundtrip") { + val pkt = LoadEntityPacket(1L, "y", null, null) + val bytes = LoadEntityCodec.encodeToBytes(pkt) + LoadEntityCodec.assertBytesRoundtrip(bytes) + } + }) diff --git a/settings.gradle.kts b/settings.gradle.kts index bdc7a5b..813088c 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -14,6 +14,7 @@ rootProject.name = "openmmo" include(":keys") include(":patcher") include(":common") +include(":bytecodec") include(":protocol") include(":protocol.tls") include(":protocol.login") From d27a54f3609986fa05a4c7511be74ea5aa0defbe Mon Sep 17 00:00:00 2001 From: Fiereu Date: Sat, 30 May 2026 09:20:28 +0200 Subject: [PATCH 2/2] refactor(network): rework network module, use new bytecodec module and introduce proper packet events --- .gitmodules | 0 buildSrc/build.gradle.kts | 1 + buildSrc/settings.gradle.kts | 1 + buildSrc/src/main/kotlin/keys.gradle.kts | 8 +- buildSrc/src/main/kotlin/sonarlint.gradle.kts | 11 + buildSrc/src/main/kotlin/spotless.gradle.kts | 4 +- bytecodec/build.gradle.kts | 1 + .../kotlin/de/fiereu/bytecodec/Buffers.kt | 2 +- .../kotlin/de/fiereu/bytecodec/Combinators.kt | 15 +- common/build.gradle.kts | 3 + .../openmmo/common/auth/SessionToken.kt | 75 + .../fiereu/openmmo/common/io/PemKeyLoader.kt | 38 + .../openmmo/common/auth/SessionTokenTest.kt | 48 + gradle.properties | 4 +- gradle/libs.versions.toml | 13 +- maps/build.gradle.kts | 99 + maps/src/generator/jte/MapsRegistry.jte | 52 + .../openmmo/maps/generator/Constants.kt | 201 + .../de/fiereu/openmmo/maps/generator/Main.kt | 21 + .../openmmo/maps/generator/MapsRenderer.kt | 31 + .../openmmo/maps/generator/ParsedModel.kt | 63 + .../maps/generator/PokeemeraldParser.kt | 262 + .../de/fiereu/openmmo/maps/BgEventDef.kt | 8 + .../kotlin/de/fiereu/openmmo/maps/MapDef.kt | 32 + .../de/fiereu/openmmo/maps/MapManager.kt | 64 + .../kotlin/de/fiereu/openmmo/maps/NpcDef.kt | 15 + .../kotlin/de/fiereu/openmmo/maps/WarpTile.kt | 16 + .../de/fiereu/openmmo/maps/WildEncounters.kt | 5 + {protocol => network}/build.gradle.kts | 11 +- .../kotlin/de/fiereu/network/Bootstrap.kt | 48 + .../kotlin/de/fiereu/network/Direction.kt | 14 + .../kotlin/de/fiereu/network/Exceptions.kt | 31 + .../kotlin/de/fiereu/network/NettyBuffers.kt | 29 + .../kotlin/de/fiereu/network/PacketEvent.kt | 12 + .../main/kotlin/de/fiereu/network/Pipeline.kt | 76 + .../kotlin/de/fiereu/network/PipelineNames.kt | 16 + .../de/fiereu/network/PipelineOptions.kt | 14 + .../main/kotlin/de/fiereu/network/Protocol.kt | 73 + .../de/fiereu/network/ProtocolHandler.kt | 132 + .../de/fiereu/network/SessionAttribute.kt | 24 + .../de/fiereu/network/SessionContext.kt | 26 + .../de/fiereu/network/SessionIdentity.kt | 10 + .../kotlin/de/fiereu/network/SessionPhase.kt | 7 + .../main/kotlin/de/fiereu/network/Sessions.kt | 7 + .../src/main/kotlin/de/fiereu/network/Side.kt | 6 + .../de/fiereu/network/TypedProtocolHandler.kt | 54 + .../de/fiereu/network/checksum/Checksum.kt | 11 + .../network/checksum/ChecksumFactory.kt | 11 + .../fiereu/network/checksum/Crc16Checksum.kt | 293 + .../network/checksum/HmacSha256Checksum.kt | 48 + .../fiereu/network/checksum/NoOpChecksum.kt | 13 + .../network/cipher/AesCtrSessionCipher.kt | 93 + .../de/fiereu/network/cipher/SessionCipher.kt | 19 + .../coroutines/CoroutineProtocolHandler.kt | 84 + .../network/handlers/ChecksumFrameDecoder.kt | 33 + .../network/handlers/ChecksumFrameEncoder.kt | 19 + .../fiereu/network/handlers/CipherDecoder.kt | 21 + .../fiereu/network/handlers/CipherEncoder.kt | 13 + .../network/handlers/CompressionDecoder.kt | 47 + .../network/handlers/CompressionEncoder.kt | 42 + .../network/handlers/PacketFrameDecoder.kt | 15 + .../network/handlers/PacketFrameEncoder.kt | 12 + .../ClientSessionHandshakeHandler.kt | 76 + .../de/fiereu/network/handshake/EcKeys.kt | 78 + .../network/handshake/HandshakePackets.kt | 69 + .../ServerSessionHandshakeHandler.kt | 85 + .../network/handshake/SessionCryptoState.kt | 32 + .../handshake/SessionHandshakeProtocol.kt | 11 + .../network/internal/MutableSessionContext.kt | 110 + .../de/fiereu/network/NettyBuffersTest.kt | 30 + .../kotlin/de/fiereu/network/ProtocolTest.kt | 73 + .../network/TypedProtocolHandlerTest.kt | 133 + .../fiereu/network/checksum/ChecksumTest.kt | 42 + .../network/cipher/AesCtrSessionCipherTest.kt | 47 + .../CoroutineProtocolHandlerTest.kt | 124 + .../network/handlers/CompressionTest.kt | 52 + .../network/handlers/FrameAndChecksumTest.kt | 83 + .../handshake/EndToEndHandshakeTest.kt | 117 + .../network/handshake/HandshakeCodecsTest.kt | 39 + .../openmmo/patcher/{Agent.kt => Launcher.kt} | 2 +- .../patcher/PatchingClassFileTransformer.kt | 3 - .../openmmo/protocols/game/GameProtocol.kt | 222 - .../game/packets/CharactersListPacket.kt | 71 - .../game/packets/ChatMessagePacket.kt | 57 - .../game/packets/CreateCharacterPacket.kt | 15 - .../game/packets/DialogChoicePacket.kt | 25 - .../game/packets/DialogDataPacket.kt | 27 - .../game/packets/DialogOptionPacket.kt | 19 - .../game/packets/DialogStatePacket.kt | 19 - .../game/packets/EntityInteractPacket.kt | 25 - .../game/packets/EntityLeavePacket.kt | 22 - .../game/packets/EntityMovePacket.kt | 41 - .../game/packets/FaceDirectionPacket.kt | 23 - .../game/packets/InteractivePacket.kt | 40 - .../game/packets/InteractiveResponsePacket.kt | 25 - .../protocols/game/packets/JoinGamePacket.kt | 173 - .../game/packets/JoinResponsePacket.kt | 79 - .../protocols/game/packets/KeepAlivePacket.kt | 26 - .../game/packets/LoadEntityPacket.kt | 140 - .../protocols/game/packets/LoadMapPacket.kt | 234 - .../game/packets/MapTransitionAckPacket.kt | 19 - .../game/packets/MapTransitionPacket.kt | 15 - .../protocols/game/packets/MovementPacket.kt | 29 - .../game/packets/NpcAnimationPacket.kt | 25 - .../protocols/game/packets/NpcSpawnPacket.kt | 59 - .../protocols/game/packets/NpcUpdatePacket.kt | 43 - .../protocols/game/packets/NullPacket.kt | 10 - .../game/packets/PokemonContainerPacket.kt | 53 - .../game/packets/RenderScreenPacket.kt | 19 - .../game/packets/RequestCharactersPacket.kt | 17 - .../game/packets/RequestPlayerPacket.kt | 17 - .../game/packets/SelectCharacterPacket.kt | 25 - .../game/packets/SelectedCharacterPacket.kt | 30 - .../game/packets/TokenPayloadPacket.kt | 21 - .../builders/JoinResponsePacketBuilder.kt | 45 - .../game/packets/codecs/CharacterInfo.kt | 136 - .../protocols/game/packets/codecs/Pokemon.kt | 179 - .../protocols/game/packets/codecs/Skin.kt | 65 - .../protocols/game/packets/codecs/Tile2D.kt | 14 - protocol.login/README.md | 3 - .../openmmo/protocols/tls/LoginProtocol.kt | 76 - .../tls/packets/ExistingSessionPacket.kt | 101 - .../tls/packets/GameServerListPacket.kt | 69 - .../tls/packets/GameServerNodesPacket.kt | 122 - .../tls/packets/JoinGameServerPacket.kt | 20 - .../protocols/tls/packets/LoginKickPacket.kt | 105 - .../tls/packets/LoginRequestPacket.kt | 107 - .../tls/packets/LoginResponsePacket.kt | 47 - .../tls/packets/MfaChallengePacket.kt | 24 - .../tls/packets/MfaResponsePacket.kt | 22 - .../packets/RequestGameServerListPacket.kt | 20 - .../tls/packets/SentCredentialsPacket.kt | 49 - .../tls/packets/ToSConfirmationPacket.kt | 20 - .../protocols/tls/packets/ToSPacket.kt | 49 - .../builders/GameServerListPacketBuilder.kt | 36 - .../builders/GameServerNodesPacketBuilder.kt | 59 - .../builders/LoginResponsePacketBuilder.kt | 23 - protocol.tls/README.md | 35 - protocol.tls/build.gradle.kts | 11 - .../openmmo/protocols/tls/TlsProtocol.kt | 43 - .../tls/packets/ClientHelloPacket.kt | 37 - .../tls/packets/ClientReadyPacket.kt | 32 - .../tls/packets/ServerHelloPacket.kt | 62 - .../protocols/tls/util/ECKeyExtensions.kt | 95 - protocol/README.md | 3 - .../openmmo/protocols/ByteBufExtension.kt | 89 - .../de/fiereu/openmmo/protocols/Protocol.kt | 102 - .../build.gradle.kts | 4 +- .../fiereu/openmmo/net/game/GameProtocol.kt | 129 + .../net/game/codecs/CharacterInfoCodec.kt | 100 + .../openmmo/net/game/codecs/PokemonCodec.kt | 108 + .../openmmo/net/game/codecs/SkinCodec.kt | 53 + .../openmmo/net/game/codecs/Tile2DCodec.kt | 19 + .../net/game/packets/CharactersListPacket.kt | 80 + .../net/game/packets/ChatMessagePacket.kt | 52 + .../net/game/packets/CreateCharacterPacket.kt | 14 + .../net/game/packets/DialogChoicePacket.kt | 16 + .../net/game/packets/DialogDataPacket.kt | 54 + .../net/game/packets/DialogOptionPacket.kt | 13 + .../net/game/packets/DialogStatePacket.kt | 13 + .../net/game/packets/EntityInteractPacket.kt | 15 + .../net/game/packets/EntityLeavePacket.kt | 14 + .../net/game/packets/EntityMovePacket.kt | 33 + .../net/game/packets/FaceDirectionPacket.kt | 17 + .../net/game/packets/InteractivePacket.kt | 31 + .../game/packets/InteractiveResponsePacket.kt | 15 + .../openmmo/net/game/packets/JoinPacket.kt | 203 + .../net/game/packets/JoinResponsePacket.kt | 75 + .../net/game/packets/KeepAlivePacket.kt | 38 + .../net/game/packets/LoadEntityPacket.kt | 82 + .../openmmo/net/game/packets/LoadMapPacket.kt | 191 + .../game/packets/MapTransitionAckPacket.kt | 13 + .../net/game/packets/MapTransitionPacket.kt | 14 + .../net/game/packets/MovementPacket.kt | 20 + .../net/game/packets/NpcAnimationPacket.kt | 16 + .../net/game/packets/NpcSpawnPacket.kt | 43 + .../net/game/packets/NpcUpdatePacket.kt | 32 + .../openmmo/net/game/packets/NullPacket.kt | 24 + .../game/packets/PokemonContainerPacket.kt | 60 + .../net/game/packets/RenderScreenPacket.kt | 14 + .../game/packets/RequestCharactersPacket.kt | 10 + .../net/game/packets/RequestPlayerPacket.kt | 10 + .../net/game/packets/SelectCharacterPacket.kt | 15 + .../game/packets/SelectedCharacterPacket.kt | 18 + .../net/game/packets/TokenPayloadPacket.kt | 34 + .../net/game/GameCodecRoundtripTest.kt | 46 + .../openmmo/net/game/GameProtocolTest.kt | 87 + .../build.gradle.kts | 5 +- .../fiereu/openmmo/net/login/LoginProtocol.kt | 49 + .../login/packets/ExistingSessionPacket.kt | 52 + .../net/login/packets/GameServerListPacket.kt | 48 + .../login/packets/GameServerNodesPacket.kt | 83 + .../openmmo/net/login/packets/IpCodec.kt | 42 + .../net/login/packets/JoinGameServerPacket.kt | 13 + .../net/login/packets/LoginKickPacket.kt | 52 + .../net/login/packets/LoginRequestPacket.kt | 114 + .../net/login/packets/LoginResponsePacket.kt | 36 + .../net/login/packets/MfaChallengePacket.kt | 16 + .../net/login/packets/MfaResponsePacket.kt | 13 + .../packets/RequestGameServerListPacket.kt | 10 + .../login/packets/SentCredentialsPacket.kt | 23 + .../login/packets/ToSConfirmationPacket.kt | 13 + .../openmmo/net/login/packets/ToSPacket.kt | 38 + .../net/login/LoginCodecRoundtripTest.kt | 40 + .../openmmo/net/login/LoginProtocolTest.kt | 57 + server.game/.gitignore | 1 - server.game/Dockerfile | 61 - server.game/README.md | 9 - server.game/build.gradle.kts | 121 +- .../fiereu/openmmo/server/game/GameServer.kt | 100 +- .../de/fiereu/openmmo/server/game/Main.kt | 10 + .../server/game/config/ConfigLoader.kt | 18 + .../server/game/config/GameServerConfig.kt | 26 + .../server/game/di/GameServerComponent.kt | 26 + .../server/game/di/GameServerModule.kt | 45 + .../server/game/handler/GameAppHandler.kt | 104 + .../game/protocol/game/GameProtocolHandler.kt | 140 - .../ext/JoinGameResponsePacketExtension.kt | 16 - .../server/game/services/DialogService.kt | 93 +- .../game/services/InteractionService.kt | 108 +- .../server/game/services/LoginService.kt | 330 +- .../server/game/services/MapLoadService.kt | 78 +- .../server/game/services/MovementService.kt | 147 +- .../game/services/MultiplayerService.kt | 31 +- .../server/game/services/NpcService.kt | 34 +- .../server/game/services/PacketSender.kt | 24 - .../server/game/services/WarpService.kt | 108 +- .../server/game/session/PlayerSession.kt | 76 - .../server/game/session/PlayerState.kt | 27 + .../server/game/session/SessionAttributes.kt | 5 + .../server/game/session/SessionRegistry.kt | 54 + .../game/session/SessionRegistryHandler.kt | 21 + .../server/game/storage/CharacterStore.kt | 6 +- .../openmmo/server/game/world/MapManager.kt | 50236 ---------------- .../server/game/world/WarpExitRules.kt | 15 +- server.game/src/main/resources/.gitignore | 2 + .../src/main/resources/application.conf | 9 +- .../main/resources/db/migration/V1__init.sql | 75 - server.game/src/main/resources/logback.xml | 19 +- .../server/game/handler/GameAppHandlerTest.kt | 30 + server.login/.gitignore | 1 - server.login/Dockerfile | 61 - server.login/README.md | 56 - server.login/build.gradle.kts | 128 +- .../server/login/jooq/DefaultCatalog.kt | 43 - .../openmmo/server/login/jooq/Public.kt | 40 - .../openmmo/server/login/jooq/keys/Keys.kt | 22 - .../server/login/jooq/routines/Armor1.kt | 53 - .../server/login/jooq/routines/Armor2.kt | 91 - .../server/login/jooq/routines/Crypt.kt | 71 - .../server/login/jooq/routines/Dearmor.kt | 52 - .../server/login/jooq/routines/Decrypt.kt | 90 - .../server/login/jooq/routines/DecryptIv.kt | 109 - .../server/login/jooq/routines/Digest1.kt | 72 - .../server/login/jooq/routines/Digest2.kt | 72 - .../server/login/jooq/routines/Encrypt.kt | 90 - .../server/login/jooq/routines/EncryptIv.kt | 109 - .../login/jooq/routines/GenRandomBytes.kt | 52 - .../login/jooq/routines/GenRandomUuid.kt | 34 - .../server/login/jooq/routines/GenSalt1.kt | 53 - .../server/login/jooq/routines/GenSalt2.kt | 72 - .../server/login/jooq/routines/Hmac1.kt | 91 - .../server/login/jooq/routines/Hmac2.kt | 91 - .../server/login/jooq/routines/PgpKeyId.kt | 52 - .../login/jooq/routines/PgpPubDecrypt1.kt | 72 - .../login/jooq/routines/PgpPubDecrypt2.kt | 91 - .../login/jooq/routines/PgpPubDecrypt3.kt | 110 - .../jooq/routines/PgpPubDecryptBytea1.kt | 72 - .../jooq/routines/PgpPubDecryptBytea2.kt | 91 - .../jooq/routines/PgpPubDecryptBytea3.kt | 110 - .../login/jooq/routines/PgpPubEncrypt1.kt | 72 - .../login/jooq/routines/PgpPubEncrypt2.kt | 91 - .../jooq/routines/PgpPubEncryptBytea1.kt | 72 - .../jooq/routines/PgpPubEncryptBytea2.kt | 91 - .../login/jooq/routines/PgpSymDecrypt1.kt | 72 - .../login/jooq/routines/PgpSymDecrypt2.kt | 91 - .../jooq/routines/PgpSymDecryptBytea1.kt | 72 - .../jooq/routines/PgpSymDecryptBytea2.kt | 91 - .../login/jooq/routines/PgpSymEncrypt1.kt | 72 - .../login/jooq/routines/PgpSymEncrypt2.kt | 91 - .../jooq/routines/PgpSymEncryptBytea1.kt | 72 - .../jooq/routines/PgpSymEncryptBytea2.kt | 91 - .../jooq/routines/references/Routines.kt | 1662 - .../openmmo/server/login/jooq/tables/User.kt | 186 - .../login/jooq/tables/records/UserRecord.kt | 53 - .../login/jooq/tables/references/Tables.kt | 15 - .../openmmo/server/login/LoginServer.kt | 80 +- .../de/fiereu/openmmo/server/login/Main.kt | 10 + .../openmmo/server/login/auth/UserService.kt | 30 +- .../server/login/catalog/GameServerCatalog.kt | 46 + .../server/login/config/ConfigLoader.kt | 18 + .../server/login/config/LoginServerConfig.kt | 26 + .../server/login/di/LoginServerComponent.kt | 23 + .../server/login/di/LoginServerModule.kt | 52 + .../server/login/handler/LoginAppHandler.kt | 86 + .../protocol/login/LoginProtocolHandler.kt | 97 - .../ext/JoinGameServerPacketExtension.kt | 24 - .../login/ext/LoginRequestPacketExtensions.kt | 19 - .../RequestGameServerListPacketExtensions.kt | 23 - server.login/src/main/resources/.gitignore | 2 + .../src/main/resources/application.conf | 9 +- .../main/resources/db/migration/V1__init.sql | 17 - server.login/src/main/resources/logback.xml | 19 +- .../login/auth/InMemoryUserStoreTest.kt | 52 + .../login/handler/LoginAppHandlerTest.kt | 28 + server/README.md | 63 - server/build.gradle.kts | 32 - .../kotlin/de/fiereu/openmmo/server/Server.kt | 54 - .../de/fiereu/openmmo/server/ServerBuilder.kt | 87 - .../openmmo/server/config/ConfigLoader.kt | 59 - .../openmmo/server/config/ServerConfig.kt | 17 - .../fiereu/openmmo/server/config/TlsConfig.kt | 5 - .../openmmo/server/di/ServerComponent.kt | 21 - .../fiereu/openmmo/server/di/ServerModule.kt | 64 - .../kotlin/de/fiereu/openmmo/server/io/IO.kt | 11 - .../fiereu/openmmo/server/keys/KeyLoader.kt | 29 - .../server/netty/ChannelHandlerProvider.kt | 17 - .../fiereu/openmmo/server/netty/Compressor.kt | 55 - .../netty/DefaultChannelHandlerProvider.kt | 112 - .../openmmo/server/netty/NettyServer.kt | 56 - .../server/netty/handlers/ProtocolHandler.kt | 128 - .../handlers/checksum/ChecksumFrameDecoder.kt | 49 - .../handlers/checksum/ChecksumFrameEncoder.kt | 30 - .../handlers/frame/PacketFrameDecoder.kt | 14 - .../handlers/frame/PacketFrameEncoder.kt | 11 - .../handlers/tls/TlsDecryptionHandler.kt | 25 - .../handlers/tls/TlsEncryptionHandler.kt | 21 - .../openmmo/server/protocol/PacketEvent.kt | 20 - .../openmmo/server/protocol/tls/TlsContext.kt | 81 - .../server/protocol/tls/TlsProtocolHandler.kt | 78 - .../server/protocol/tls/checksum/Checksum.kt | 33 - .../protocol/tls/checksum/Crc16Checksum.kt | 70 - .../tls/checksum/HmacSha256Checksum.kt | 63 - .../fiereu/openmmo/server/netty/ChannelExt.kt | 29 - .../server/netty/ChecksumFrameCodecTest.kt | 340 - .../server/netty/PacketFrameCodecTest.kt | 179 - .../server/netty/PipelineIntegrationTest.kt | 380 - .../openmmo/server/netty/TlsHandlerTest.kt | 248 - .../fiereu/openmmo/server/netty/TlsHelper.kt | 21 - settings.gradle.kts | 11 +- 340 files changed, 7462 insertions(+), 62719 deletions(-) delete mode 100644 .gitmodules create mode 100644 buildSrc/src/main/kotlin/sonarlint.gradle.kts create mode 100644 common/src/main/kotlin/de/fiereu/openmmo/common/auth/SessionToken.kt create mode 100644 common/src/main/kotlin/de/fiereu/openmmo/common/io/PemKeyLoader.kt create mode 100644 common/src/test/kotlin/de/fiereu/openmmo/common/auth/SessionTokenTest.kt create mode 100644 maps/build.gradle.kts create mode 100644 maps/src/generator/jte/MapsRegistry.jte create mode 100644 maps/src/generator/kotlin/de/fiereu/openmmo/maps/generator/Constants.kt create mode 100644 maps/src/generator/kotlin/de/fiereu/openmmo/maps/generator/Main.kt create mode 100644 maps/src/generator/kotlin/de/fiereu/openmmo/maps/generator/MapsRenderer.kt create mode 100644 maps/src/generator/kotlin/de/fiereu/openmmo/maps/generator/ParsedModel.kt create mode 100644 maps/src/generator/kotlin/de/fiereu/openmmo/maps/generator/PokeemeraldParser.kt create mode 100644 maps/src/main/kotlin/de/fiereu/openmmo/maps/BgEventDef.kt create mode 100644 maps/src/main/kotlin/de/fiereu/openmmo/maps/MapDef.kt create mode 100644 maps/src/main/kotlin/de/fiereu/openmmo/maps/MapManager.kt create mode 100644 maps/src/main/kotlin/de/fiereu/openmmo/maps/NpcDef.kt create mode 100644 maps/src/main/kotlin/de/fiereu/openmmo/maps/WarpTile.kt create mode 100644 maps/src/main/kotlin/de/fiereu/openmmo/maps/WildEncounters.kt rename {protocol => network}/build.gradle.kts (52%) create mode 100644 network/src/main/kotlin/de/fiereu/network/Bootstrap.kt create mode 100644 network/src/main/kotlin/de/fiereu/network/Direction.kt create mode 100644 network/src/main/kotlin/de/fiereu/network/Exceptions.kt create mode 100644 network/src/main/kotlin/de/fiereu/network/NettyBuffers.kt create mode 100644 network/src/main/kotlin/de/fiereu/network/PacketEvent.kt create mode 100644 network/src/main/kotlin/de/fiereu/network/Pipeline.kt create mode 100644 network/src/main/kotlin/de/fiereu/network/PipelineNames.kt create mode 100644 network/src/main/kotlin/de/fiereu/network/PipelineOptions.kt create mode 100644 network/src/main/kotlin/de/fiereu/network/Protocol.kt create mode 100644 network/src/main/kotlin/de/fiereu/network/ProtocolHandler.kt create mode 100644 network/src/main/kotlin/de/fiereu/network/SessionAttribute.kt create mode 100644 network/src/main/kotlin/de/fiereu/network/SessionContext.kt create mode 100644 network/src/main/kotlin/de/fiereu/network/SessionIdentity.kt create mode 100644 network/src/main/kotlin/de/fiereu/network/SessionPhase.kt create mode 100644 network/src/main/kotlin/de/fiereu/network/Sessions.kt create mode 100644 network/src/main/kotlin/de/fiereu/network/Side.kt create mode 100644 network/src/main/kotlin/de/fiereu/network/TypedProtocolHandler.kt create mode 100644 network/src/main/kotlin/de/fiereu/network/checksum/Checksum.kt create mode 100644 network/src/main/kotlin/de/fiereu/network/checksum/ChecksumFactory.kt create mode 100644 network/src/main/kotlin/de/fiereu/network/checksum/Crc16Checksum.kt create mode 100644 network/src/main/kotlin/de/fiereu/network/checksum/HmacSha256Checksum.kt create mode 100644 network/src/main/kotlin/de/fiereu/network/checksum/NoOpChecksum.kt create mode 100644 network/src/main/kotlin/de/fiereu/network/cipher/AesCtrSessionCipher.kt create mode 100644 network/src/main/kotlin/de/fiereu/network/cipher/SessionCipher.kt create mode 100644 network/src/main/kotlin/de/fiereu/network/coroutines/CoroutineProtocolHandler.kt create mode 100644 network/src/main/kotlin/de/fiereu/network/handlers/ChecksumFrameDecoder.kt create mode 100644 network/src/main/kotlin/de/fiereu/network/handlers/ChecksumFrameEncoder.kt create mode 100644 network/src/main/kotlin/de/fiereu/network/handlers/CipherDecoder.kt create mode 100644 network/src/main/kotlin/de/fiereu/network/handlers/CipherEncoder.kt create mode 100644 network/src/main/kotlin/de/fiereu/network/handlers/CompressionDecoder.kt create mode 100644 network/src/main/kotlin/de/fiereu/network/handlers/CompressionEncoder.kt create mode 100644 network/src/main/kotlin/de/fiereu/network/handlers/PacketFrameDecoder.kt create mode 100644 network/src/main/kotlin/de/fiereu/network/handlers/PacketFrameEncoder.kt create mode 100644 network/src/main/kotlin/de/fiereu/network/handshake/ClientSessionHandshakeHandler.kt create mode 100644 network/src/main/kotlin/de/fiereu/network/handshake/EcKeys.kt create mode 100644 network/src/main/kotlin/de/fiereu/network/handshake/HandshakePackets.kt create mode 100644 network/src/main/kotlin/de/fiereu/network/handshake/ServerSessionHandshakeHandler.kt create mode 100644 network/src/main/kotlin/de/fiereu/network/handshake/SessionCryptoState.kt create mode 100644 network/src/main/kotlin/de/fiereu/network/handshake/SessionHandshakeProtocol.kt create mode 100644 network/src/main/kotlin/de/fiereu/network/internal/MutableSessionContext.kt create mode 100644 network/src/test/kotlin/de/fiereu/network/NettyBuffersTest.kt create mode 100644 network/src/test/kotlin/de/fiereu/network/ProtocolTest.kt create mode 100644 network/src/test/kotlin/de/fiereu/network/TypedProtocolHandlerTest.kt create mode 100644 network/src/test/kotlin/de/fiereu/network/checksum/ChecksumTest.kt create mode 100644 network/src/test/kotlin/de/fiereu/network/cipher/AesCtrSessionCipherTest.kt create mode 100644 network/src/test/kotlin/de/fiereu/network/coroutines/CoroutineProtocolHandlerTest.kt create mode 100644 network/src/test/kotlin/de/fiereu/network/handlers/CompressionTest.kt create mode 100644 network/src/test/kotlin/de/fiereu/network/handlers/FrameAndChecksumTest.kt create mode 100644 network/src/test/kotlin/de/fiereu/network/handshake/EndToEndHandshakeTest.kt create mode 100644 network/src/test/kotlin/de/fiereu/network/handshake/HandshakeCodecsTest.kt rename patcher/src/main/kotlin/de/fiereu/openmmo/patcher/{Agent.kt => Launcher.kt} (56%) delete mode 100644 patcher/src/main/kotlin/de/fiereu/openmmo/patcher/PatchingClassFileTransformer.kt delete mode 100644 protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/GameProtocol.kt delete mode 100644 protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/CharactersListPacket.kt delete mode 100644 protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/ChatMessagePacket.kt delete mode 100644 protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/CreateCharacterPacket.kt delete mode 100644 protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/DialogChoicePacket.kt delete mode 100644 protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/DialogDataPacket.kt delete mode 100644 protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/DialogOptionPacket.kt delete mode 100644 protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/DialogStatePacket.kt delete mode 100644 protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/EntityInteractPacket.kt delete mode 100644 protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/EntityLeavePacket.kt delete mode 100644 protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/EntityMovePacket.kt delete mode 100644 protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/FaceDirectionPacket.kt delete mode 100644 protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/InteractivePacket.kt delete mode 100644 protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/InteractiveResponsePacket.kt delete mode 100644 protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/JoinGamePacket.kt delete mode 100644 protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/JoinResponsePacket.kt delete mode 100644 protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/KeepAlivePacket.kt delete mode 100644 protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/LoadEntityPacket.kt delete mode 100644 protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/LoadMapPacket.kt delete mode 100644 protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/MapTransitionAckPacket.kt delete mode 100644 protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/MapTransitionPacket.kt delete mode 100644 protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/MovementPacket.kt delete mode 100644 protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/NpcAnimationPacket.kt delete mode 100644 protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/NpcSpawnPacket.kt delete mode 100644 protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/NpcUpdatePacket.kt delete mode 100644 protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/NullPacket.kt delete mode 100644 protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/PokemonContainerPacket.kt delete mode 100644 protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/RenderScreenPacket.kt delete mode 100644 protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/RequestCharactersPacket.kt delete mode 100644 protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/RequestPlayerPacket.kt delete mode 100644 protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/SelectCharacterPacket.kt delete mode 100644 protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/SelectedCharacterPacket.kt delete mode 100644 protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/TokenPayloadPacket.kt delete mode 100644 protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/builders/JoinResponsePacketBuilder.kt delete mode 100644 protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/codecs/CharacterInfo.kt delete mode 100644 protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/codecs/Pokemon.kt delete mode 100644 protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/codecs/Skin.kt delete mode 100644 protocol.game/src/main/kotlin/de/fiereu/openmmo/protocols/game/packets/codecs/Tile2D.kt delete mode 100644 protocol.login/README.md delete mode 100644 protocol.login/src/main/kotlin/de/fiereu/openmmo/protocols/tls/LoginProtocol.kt delete mode 100644 protocol.login/src/main/kotlin/de/fiereu/openmmo/protocols/tls/packets/ExistingSessionPacket.kt delete mode 100644 protocol.login/src/main/kotlin/de/fiereu/openmmo/protocols/tls/packets/GameServerListPacket.kt delete mode 100644 protocol.login/src/main/kotlin/de/fiereu/openmmo/protocols/tls/packets/GameServerNodesPacket.kt delete mode 100644 protocol.login/src/main/kotlin/de/fiereu/openmmo/protocols/tls/packets/JoinGameServerPacket.kt delete mode 100644 protocol.login/src/main/kotlin/de/fiereu/openmmo/protocols/tls/packets/LoginKickPacket.kt delete mode 100644 protocol.login/src/main/kotlin/de/fiereu/openmmo/protocols/tls/packets/LoginRequestPacket.kt delete mode 100644 protocol.login/src/main/kotlin/de/fiereu/openmmo/protocols/tls/packets/LoginResponsePacket.kt delete mode 100644 protocol.login/src/main/kotlin/de/fiereu/openmmo/protocols/tls/packets/MfaChallengePacket.kt delete mode 100644 protocol.login/src/main/kotlin/de/fiereu/openmmo/protocols/tls/packets/MfaResponsePacket.kt delete mode 100644 protocol.login/src/main/kotlin/de/fiereu/openmmo/protocols/tls/packets/RequestGameServerListPacket.kt delete mode 100644 protocol.login/src/main/kotlin/de/fiereu/openmmo/protocols/tls/packets/SentCredentialsPacket.kt delete mode 100644 protocol.login/src/main/kotlin/de/fiereu/openmmo/protocols/tls/packets/ToSConfirmationPacket.kt delete mode 100644 protocol.login/src/main/kotlin/de/fiereu/openmmo/protocols/tls/packets/ToSPacket.kt delete mode 100644 protocol.login/src/main/kotlin/de/fiereu/openmmo/protocols/tls/packets/builders/GameServerListPacketBuilder.kt delete mode 100644 protocol.login/src/main/kotlin/de/fiereu/openmmo/protocols/tls/packets/builders/GameServerNodesPacketBuilder.kt delete mode 100644 protocol.login/src/main/kotlin/de/fiereu/openmmo/protocols/tls/packets/builders/LoginResponsePacketBuilder.kt delete mode 100644 protocol.tls/README.md delete mode 100644 protocol.tls/build.gradle.kts delete mode 100644 protocol.tls/src/main/kotlin/de/fiereu/openmmo/protocols/tls/TlsProtocol.kt delete mode 100644 protocol.tls/src/main/kotlin/de/fiereu/openmmo/protocols/tls/packets/ClientHelloPacket.kt delete mode 100644 protocol.tls/src/main/kotlin/de/fiereu/openmmo/protocols/tls/packets/ClientReadyPacket.kt delete mode 100644 protocol.tls/src/main/kotlin/de/fiereu/openmmo/protocols/tls/packets/ServerHelloPacket.kt delete mode 100644 protocol.tls/src/main/kotlin/de/fiereu/openmmo/protocols/tls/util/ECKeyExtensions.kt delete mode 100644 protocol/README.md delete mode 100644 protocol/src/main/kotlin/de/fiereu/openmmo/protocols/ByteBufExtension.kt delete mode 100644 protocol/src/main/kotlin/de/fiereu/openmmo/protocols/Protocol.kt rename {protocol.login => protocols.game}/build.gradle.kts (72%) create mode 100644 protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/GameProtocol.kt create mode 100644 protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/codecs/CharacterInfoCodec.kt create mode 100644 protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/codecs/PokemonCodec.kt create mode 100644 protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/codecs/SkinCodec.kt create mode 100644 protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/codecs/Tile2DCodec.kt create mode 100644 protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/CharactersListPacket.kt create mode 100644 protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/ChatMessagePacket.kt create mode 100644 protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/CreateCharacterPacket.kt create mode 100644 protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/DialogChoicePacket.kt create mode 100644 protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/DialogDataPacket.kt create mode 100644 protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/DialogOptionPacket.kt create mode 100644 protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/DialogStatePacket.kt create mode 100644 protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/EntityInteractPacket.kt create mode 100644 protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/EntityLeavePacket.kt create mode 100644 protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/EntityMovePacket.kt create mode 100644 protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/FaceDirectionPacket.kt create mode 100644 protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/InteractivePacket.kt create mode 100644 protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/InteractiveResponsePacket.kt create mode 100644 protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/JoinPacket.kt create mode 100644 protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/JoinResponsePacket.kt create mode 100644 protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/KeepAlivePacket.kt create mode 100644 protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/LoadEntityPacket.kt create mode 100644 protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/LoadMapPacket.kt create mode 100644 protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/MapTransitionAckPacket.kt create mode 100644 protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/MapTransitionPacket.kt create mode 100644 protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/MovementPacket.kt create mode 100644 protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/NpcAnimationPacket.kt create mode 100644 protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/NpcSpawnPacket.kt create mode 100644 protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/NpcUpdatePacket.kt create mode 100644 protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/NullPacket.kt create mode 100644 protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/PokemonContainerPacket.kt create mode 100644 protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/RenderScreenPacket.kt create mode 100644 protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/RequestCharactersPacket.kt create mode 100644 protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/RequestPlayerPacket.kt create mode 100644 protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/SelectCharacterPacket.kt create mode 100644 protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/SelectedCharacterPacket.kt create mode 100644 protocols.game/src/main/kotlin/de/fiereu/openmmo/net/game/packets/TokenPayloadPacket.kt create mode 100644 protocols.game/src/test/kotlin/de/fiereu/openmmo/net/game/GameCodecRoundtripTest.kt create mode 100644 protocols.game/src/test/kotlin/de/fiereu/openmmo/net/game/GameProtocolTest.kt rename {protocol.game => protocols.login}/build.gradle.kts (67%) create mode 100644 protocols.login/src/main/kotlin/de/fiereu/openmmo/net/login/LoginProtocol.kt create mode 100644 protocols.login/src/main/kotlin/de/fiereu/openmmo/net/login/packets/ExistingSessionPacket.kt create mode 100644 protocols.login/src/main/kotlin/de/fiereu/openmmo/net/login/packets/GameServerListPacket.kt create mode 100644 protocols.login/src/main/kotlin/de/fiereu/openmmo/net/login/packets/GameServerNodesPacket.kt create mode 100644 protocols.login/src/main/kotlin/de/fiereu/openmmo/net/login/packets/IpCodec.kt create mode 100644 protocols.login/src/main/kotlin/de/fiereu/openmmo/net/login/packets/JoinGameServerPacket.kt create mode 100644 protocols.login/src/main/kotlin/de/fiereu/openmmo/net/login/packets/LoginKickPacket.kt create mode 100644 protocols.login/src/main/kotlin/de/fiereu/openmmo/net/login/packets/LoginRequestPacket.kt create mode 100644 protocols.login/src/main/kotlin/de/fiereu/openmmo/net/login/packets/LoginResponsePacket.kt create mode 100644 protocols.login/src/main/kotlin/de/fiereu/openmmo/net/login/packets/MfaChallengePacket.kt create mode 100644 protocols.login/src/main/kotlin/de/fiereu/openmmo/net/login/packets/MfaResponsePacket.kt create mode 100644 protocols.login/src/main/kotlin/de/fiereu/openmmo/net/login/packets/RequestGameServerListPacket.kt create mode 100644 protocols.login/src/main/kotlin/de/fiereu/openmmo/net/login/packets/SentCredentialsPacket.kt create mode 100644 protocols.login/src/main/kotlin/de/fiereu/openmmo/net/login/packets/ToSConfirmationPacket.kt create mode 100644 protocols.login/src/main/kotlin/de/fiereu/openmmo/net/login/packets/ToSPacket.kt create mode 100644 protocols.login/src/test/kotlin/de/fiereu/openmmo/net/login/LoginCodecRoundtripTest.kt create mode 100644 protocols.login/src/test/kotlin/de/fiereu/openmmo/net/login/LoginProtocolTest.kt delete mode 100644 server.game/.gitignore delete mode 100644 server.game/Dockerfile delete mode 100644 server.game/README.md create mode 100644 server.game/src/main/kotlin/de/fiereu/openmmo/server/game/Main.kt create mode 100644 server.game/src/main/kotlin/de/fiereu/openmmo/server/game/config/ConfigLoader.kt create mode 100644 server.game/src/main/kotlin/de/fiereu/openmmo/server/game/config/GameServerConfig.kt create mode 100644 server.game/src/main/kotlin/de/fiereu/openmmo/server/game/di/GameServerComponent.kt create mode 100644 server.game/src/main/kotlin/de/fiereu/openmmo/server/game/di/GameServerModule.kt create mode 100644 server.game/src/main/kotlin/de/fiereu/openmmo/server/game/handler/GameAppHandler.kt delete mode 100644 server.game/src/main/kotlin/de/fiereu/openmmo/server/game/protocol/game/GameProtocolHandler.kt delete mode 100644 server.game/src/main/kotlin/de/fiereu/openmmo/server/game/protocol/game/ext/JoinGameResponsePacketExtension.kt delete mode 100644 server.game/src/main/kotlin/de/fiereu/openmmo/server/game/services/PacketSender.kt delete mode 100644 server.game/src/main/kotlin/de/fiereu/openmmo/server/game/session/PlayerSession.kt create mode 100644 server.game/src/main/kotlin/de/fiereu/openmmo/server/game/session/PlayerState.kt create mode 100644 server.game/src/main/kotlin/de/fiereu/openmmo/server/game/session/SessionAttributes.kt create mode 100644 server.game/src/main/kotlin/de/fiereu/openmmo/server/game/session/SessionRegistry.kt create mode 100644 server.game/src/main/kotlin/de/fiereu/openmmo/server/game/session/SessionRegistryHandler.kt delete mode 100644 server.game/src/main/kotlin/de/fiereu/openmmo/server/game/world/MapManager.kt create mode 100644 server.game/src/main/resources/.gitignore delete mode 100644 server.game/src/main/resources/db/migration/V1__init.sql create mode 100644 server.game/src/test/kotlin/de/fiereu/openmmo/server/game/handler/GameAppHandlerTest.kt delete mode 100644 server.login/.gitignore delete mode 100644 server.login/Dockerfile delete mode 100644 server.login/README.md delete mode 100644 server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/DefaultCatalog.kt delete mode 100644 server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/Public.kt delete mode 100644 server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/keys/Keys.kt delete mode 100644 server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/Armor1.kt delete mode 100644 server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/Armor2.kt delete mode 100644 server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/Crypt.kt delete mode 100644 server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/Dearmor.kt delete mode 100644 server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/Decrypt.kt delete mode 100644 server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/DecryptIv.kt delete mode 100644 server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/Digest1.kt delete mode 100644 server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/Digest2.kt delete mode 100644 server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/Encrypt.kt delete mode 100644 server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/EncryptIv.kt delete mode 100644 server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/GenRandomBytes.kt delete mode 100644 server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/GenRandomUuid.kt delete mode 100644 server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/GenSalt1.kt delete mode 100644 server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/GenSalt2.kt delete mode 100644 server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/Hmac1.kt delete mode 100644 server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/Hmac2.kt delete mode 100644 server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/PgpKeyId.kt delete mode 100644 server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/PgpPubDecrypt1.kt delete mode 100644 server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/PgpPubDecrypt2.kt delete mode 100644 server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/PgpPubDecrypt3.kt delete mode 100644 server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/PgpPubDecryptBytea1.kt delete mode 100644 server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/PgpPubDecryptBytea2.kt delete mode 100644 server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/PgpPubDecryptBytea3.kt delete mode 100644 server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/PgpPubEncrypt1.kt delete mode 100644 server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/PgpPubEncrypt2.kt delete mode 100644 server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/PgpPubEncryptBytea1.kt delete mode 100644 server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/PgpPubEncryptBytea2.kt delete mode 100644 server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/PgpSymDecrypt1.kt delete mode 100644 server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/PgpSymDecrypt2.kt delete mode 100644 server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/PgpSymDecryptBytea1.kt delete mode 100644 server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/PgpSymDecryptBytea2.kt delete mode 100644 server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/PgpSymEncrypt1.kt delete mode 100644 server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/PgpSymEncrypt2.kt delete mode 100644 server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/PgpSymEncryptBytea1.kt delete mode 100644 server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/PgpSymEncryptBytea2.kt delete mode 100644 server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/routines/references/Routines.kt delete mode 100644 server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/tables/User.kt delete mode 100644 server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/tables/records/UserRecord.kt delete mode 100644 server.login/src/main/jooq/de/fiereu/openmmo/server/login/jooq/tables/references/Tables.kt create mode 100644 server.login/src/main/kotlin/de/fiereu/openmmo/server/login/Main.kt create mode 100644 server.login/src/main/kotlin/de/fiereu/openmmo/server/login/catalog/GameServerCatalog.kt create mode 100644 server.login/src/main/kotlin/de/fiereu/openmmo/server/login/config/ConfigLoader.kt create mode 100644 server.login/src/main/kotlin/de/fiereu/openmmo/server/login/config/LoginServerConfig.kt create mode 100644 server.login/src/main/kotlin/de/fiereu/openmmo/server/login/di/LoginServerComponent.kt create mode 100644 server.login/src/main/kotlin/de/fiereu/openmmo/server/login/di/LoginServerModule.kt create mode 100644 server.login/src/main/kotlin/de/fiereu/openmmo/server/login/handler/LoginAppHandler.kt delete mode 100644 server.login/src/main/kotlin/de/fiereu/openmmo/server/login/protocol/login/LoginProtocolHandler.kt delete mode 100644 server.login/src/main/kotlin/de/fiereu/openmmo/server/login/protocol/login/ext/JoinGameServerPacketExtension.kt delete mode 100644 server.login/src/main/kotlin/de/fiereu/openmmo/server/login/protocol/login/ext/LoginRequestPacketExtensions.kt delete mode 100644 server.login/src/main/kotlin/de/fiereu/openmmo/server/login/protocol/login/ext/RequestGameServerListPacketExtensions.kt create mode 100644 server.login/src/main/resources/.gitignore delete mode 100644 server.login/src/main/resources/db/migration/V1__init.sql create mode 100644 server.login/src/test/kotlin/de/fiereu/openmmo/server/login/auth/InMemoryUserStoreTest.kt create mode 100644 server.login/src/test/kotlin/de/fiereu/openmmo/server/login/handler/LoginAppHandlerTest.kt delete mode 100644 server/README.md delete mode 100644 server/build.gradle.kts delete mode 100644 server/src/main/kotlin/de/fiereu/openmmo/server/Server.kt delete mode 100644 server/src/main/kotlin/de/fiereu/openmmo/server/ServerBuilder.kt delete mode 100644 server/src/main/kotlin/de/fiereu/openmmo/server/config/ConfigLoader.kt delete mode 100644 server/src/main/kotlin/de/fiereu/openmmo/server/config/ServerConfig.kt delete mode 100644 server/src/main/kotlin/de/fiereu/openmmo/server/config/TlsConfig.kt delete mode 100644 server/src/main/kotlin/de/fiereu/openmmo/server/di/ServerComponent.kt delete mode 100644 server/src/main/kotlin/de/fiereu/openmmo/server/di/ServerModule.kt delete mode 100644 server/src/main/kotlin/de/fiereu/openmmo/server/io/IO.kt delete mode 100644 server/src/main/kotlin/de/fiereu/openmmo/server/keys/KeyLoader.kt delete mode 100644 server/src/main/kotlin/de/fiereu/openmmo/server/netty/ChannelHandlerProvider.kt delete mode 100644 server/src/main/kotlin/de/fiereu/openmmo/server/netty/Compressor.kt delete mode 100644 server/src/main/kotlin/de/fiereu/openmmo/server/netty/DefaultChannelHandlerProvider.kt delete mode 100644 server/src/main/kotlin/de/fiereu/openmmo/server/netty/NettyServer.kt delete mode 100644 server/src/main/kotlin/de/fiereu/openmmo/server/netty/handlers/ProtocolHandler.kt delete mode 100644 server/src/main/kotlin/de/fiereu/openmmo/server/netty/handlers/checksum/ChecksumFrameDecoder.kt delete mode 100644 server/src/main/kotlin/de/fiereu/openmmo/server/netty/handlers/checksum/ChecksumFrameEncoder.kt delete mode 100644 server/src/main/kotlin/de/fiereu/openmmo/server/netty/handlers/frame/PacketFrameDecoder.kt delete mode 100644 server/src/main/kotlin/de/fiereu/openmmo/server/netty/handlers/frame/PacketFrameEncoder.kt delete mode 100644 server/src/main/kotlin/de/fiereu/openmmo/server/netty/handlers/tls/TlsDecryptionHandler.kt delete mode 100644 server/src/main/kotlin/de/fiereu/openmmo/server/netty/handlers/tls/TlsEncryptionHandler.kt delete mode 100644 server/src/main/kotlin/de/fiereu/openmmo/server/protocol/PacketEvent.kt delete mode 100644 server/src/main/kotlin/de/fiereu/openmmo/server/protocol/tls/TlsContext.kt delete mode 100644 server/src/main/kotlin/de/fiereu/openmmo/server/protocol/tls/TlsProtocolHandler.kt delete mode 100644 server/src/main/kotlin/de/fiereu/openmmo/server/protocol/tls/checksum/Checksum.kt delete mode 100644 server/src/main/kotlin/de/fiereu/openmmo/server/protocol/tls/checksum/Crc16Checksum.kt delete mode 100644 server/src/main/kotlin/de/fiereu/openmmo/server/protocol/tls/checksum/HmacSha256Checksum.kt delete mode 100644 server/src/test/kotlin/de/fiereu/openmmo/server/netty/ChannelExt.kt delete mode 100644 server/src/test/kotlin/de/fiereu/openmmo/server/netty/ChecksumFrameCodecTest.kt delete mode 100644 server/src/test/kotlin/de/fiereu/openmmo/server/netty/PacketFrameCodecTest.kt delete mode 100644 server/src/test/kotlin/de/fiereu/openmmo/server/netty/PipelineIntegrationTest.kt delete mode 100644 server/src/test/kotlin/de/fiereu/openmmo/server/netty/TlsHandlerTest.kt delete mode 100644 server/src/test/kotlin/de/fiereu/openmmo/server/netty/TlsHelper.kt diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index e69de29..0000000 diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 4210cd5..c2f462d 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -9,5 +9,6 @@ kotlin { dependencies { implementation(libs.kotlinGradlePlugin) implementation(libs.spotlessGradlePlugin) + implementation(libs.sonarlintGradlePlugin) implementation(libs.junit5) } diff --git a/buildSrc/settings.gradle.kts b/buildSrc/settings.gradle.kts index 9b093a5..d867f5e 100644 --- a/buildSrc/settings.gradle.kts +++ b/buildSrc/settings.gradle.kts @@ -2,6 +2,7 @@ dependencyResolutionManagement { @Suppress("UnstableApiUsage") repositories { mavenCentral() + gradlePluginPortal() } versionCatalogs { diff --git a/buildSrc/src/main/kotlin/keys.gradle.kts b/buildSrc/src/main/kotlin/keys.gradle.kts index 723df51..64e3d47 100644 --- a/buildSrc/src/main/kotlin/keys.gradle.kts +++ b/buildSrc/src/main/kotlin/keys.gradle.kts @@ -60,4 +60,10 @@ tasks.register("copyKeys") { group = "openmmo" description = "Copies all keys from \":keys\" to the current projects resources directory" dependsOn("copyKeysChat", "copyKeysGame") -} \ No newline at end of file +} + +val keyCopyTasks = + listOf("copyPublicKeyChat", "copyPrivateKeyChat", "copyPublicKeyGame", "copyPrivateKeyGame") + +tasks.matching { it.name.startsWith("spotless") || it.name.startsWith("sonarlint") } + .configureEach { mustRunAfter(keyCopyTasks) } \ No newline at end of file diff --git a/buildSrc/src/main/kotlin/sonarlint.gradle.kts b/buildSrc/src/main/kotlin/sonarlint.gradle.kts new file mode 100644 index 0000000..0dc8084 --- /dev/null +++ b/buildSrc/src/main/kotlin/sonarlint.gradle.kts @@ -0,0 +1,11 @@ +package buildsrc.convention + +plugins { id("name.remal.sonarlint") } + +sonarLint { + languages { include("kotlin", "java") } + rules { + disable("kotlin:S1186") + disable("kotlin:S3776") + } +} diff --git a/buildSrc/src/main/kotlin/spotless.gradle.kts b/buildSrc/src/main/kotlin/spotless.gradle.kts index 6a7d1ed..6bf21d7 100644 --- a/buildSrc/src/main/kotlin/spotless.gradle.kts +++ b/buildSrc/src/main/kotlin/spotless.gradle.kts @@ -11,13 +11,13 @@ spotless { lineEndings = LineEnding.UNIX kotlinGradle { target("**/*.gradle.kts") - ktfmt() + ktfmt("0.54") trimTrailingWhitespace() endWithNewline() } kotlin { target("**/src/**/*.kt") - ktfmt() + ktfmt("0.54") trimTrailingWhitespace() endWithNewline() } diff --git a/bytecodec/build.gradle.kts b/bytecodec/build.gradle.kts index 1b734bf..762b81e 100644 --- a/bytecodec/build.gradle.kts +++ b/bytecodec/build.gradle.kts @@ -1,6 +1,7 @@ plugins { id("buildsrc.convention.kotlin-jvm") id("buildsrc.convention.spotless") + id("buildsrc.convention.sonarlint") } dependencies { testImplementation(libs.bundles.kotest) } diff --git a/bytecodec/src/main/kotlin/de/fiereu/bytecodec/Buffers.kt b/bytecodec/src/main/kotlin/de/fiereu/bytecodec/Buffers.kt index 6d3e116..7da825b 100644 --- a/bytecodec/src/main/kotlin/de/fiereu/bytecodec/Buffers.kt +++ b/bytecodec/src/main/kotlin/de/fiereu/bytecodec/Buffers.kt @@ -67,7 +67,7 @@ class NioReadBuffer(private val nio: ByteBuffer) : ReadBuffer { override fun readByte(): Byte = nio.get() override fun readBytes(dst: ByteArray, offset: Int, length: Int) { - nio.get(dst, offset, length) + nio[dst, offset, length] } override fun skip(n: Int) { diff --git a/bytecodec/src/main/kotlin/de/fiereu/bytecodec/Combinators.kt b/bytecodec/src/main/kotlin/de/fiereu/bytecodec/Combinators.kt index da8c450..070f9ab 100644 --- a/bytecodec/src/main/kotlin/de/fiereu/bytecodec/Combinators.kt +++ b/bytecodec/src/main/kotlin/de/fiereu/bytecodec/Combinators.kt @@ -205,7 +205,7 @@ fun Codec.then(other: Codec): Codec> { } } -interface BitsBuilder { +fun interface BitsBuilder { fun bit(index: Int, name: String) } @@ -254,14 +254,11 @@ internal constructor( fun bitsLE(backing: Codec, builder: BitsBuilder.() -> Unit): BitsCodec { val map = LinkedHashMap() - val b = - object : BitsBuilder { - override fun bit(index: Int, name: String) { - require(index in 0..31) { "bit index out of range: $index" } - require(name !in map) { "duplicate bit name: $name" } - map[name] = index - } - } + val b = BitsBuilder { index, name -> + require(index in 0..31) { "bit index out of range: $index" } + require(name !in map) { "duplicate bit name: $name" } + map[name] = index + } b.builder() return BitsCodec(backing, map) } diff --git a/common/build.gradle.kts b/common/build.gradle.kts index b8ff151..762b81e 100644 --- a/common/build.gradle.kts +++ b/common/build.gradle.kts @@ -1,4 +1,7 @@ plugins { id("buildsrc.convention.kotlin-jvm") id("buildsrc.convention.spotless") + id("buildsrc.convention.sonarlint") } + +dependencies { testImplementation(libs.bundles.kotest) } diff --git a/common/src/main/kotlin/de/fiereu/openmmo/common/auth/SessionToken.kt b/common/src/main/kotlin/de/fiereu/openmmo/common/auth/SessionToken.kt new file mode 100644 index 0000000..1a7d4ef --- /dev/null +++ b/common/src/main/kotlin/de/fiereu/openmmo/common/auth/SessionToken.kt @@ -0,0 +1,75 @@ +package de.fiereu.openmmo.common.auth + +import java.nio.ByteBuffer +import java.security.MessageDigest +import java.time.Clock +import java.time.Instant +import javax.crypto.Mac +import javax.crypto.spec.SecretKeySpec + +/** Opaque token issued by the login server and validated by the game server. */ +data class SessionToken( + val userId: Long, + val issuedAt: Instant, + val bytes: ByteArray, +) { + override fun equals(other: Any?): Boolean = + other is SessionToken && + userId == other.userId && + issuedAt == other.issuedAt && + bytes.contentEquals(other.bytes) + + override fun hashCode(): Int = + (userId.hashCode() * 31 + issuedAt.hashCode()) * 31 + bytes.contentHashCode() +} + +class SessionTokenIssuer(secret: ByteArray, private val clock: Clock = Clock.systemUTC()) { + init { + require(secret.isNotEmpty()) { "session token secret must not be empty" } + } + + private val secretKey = SecretKeySpec(secret, MAC_ALGORITHM) + + fun issue(userId: Long): SessionToken { + val issuedAt = clock.instant() + val bytes = build(userId, issuedAt, secretKey) + return SessionToken(userId, issuedAt, bytes) + } +} + +class SessionTokenVerifier(secret: ByteArray) { + init { + require(secret.isNotEmpty()) { "session token secret must not be empty" } + } + + private val secretKey = SecretKeySpec(secret, MAC_ALGORITHM) + + fun verify(bytes: ByteArray): SessionToken? { + if (bytes.size != TOKEN_SIZE) return null + val buf = ByteBuffer.wrap(bytes) + val userId = buf.long + val epochSeconds = buf.long + val issuedAt = Instant.ofEpochSecond(epochSeconds) + val expected = build(userId, issuedAt, secretKey) + if (!MessageDigest.isEqual(bytes, expected)) return null + return SessionToken(userId, issuedAt, bytes) + } +} + +private const val MAC_ALGORITHM = "HmacSHA256" +private const val PREFIX_SIZE = 16 +private const val MAC_SIZE = 16 +private const val TOKEN_SIZE = PREFIX_SIZE + MAC_SIZE + +private fun build(userId: Long, issuedAt: Instant, key: SecretKeySpec): ByteArray { + val out = ByteArray(TOKEN_SIZE) + val prefix = ByteBuffer.wrap(out, 0, PREFIX_SIZE) + prefix.putLong(userId) + prefix.putLong(issuedAt.epochSecond) + val mac = Mac.getInstance(MAC_ALGORITHM) + mac.init(key) + mac.update(out, 0, PREFIX_SIZE) + val tag = mac.doFinal() + System.arraycopy(tag, 0, out, PREFIX_SIZE, MAC_SIZE) + return out +} diff --git a/common/src/main/kotlin/de/fiereu/openmmo/common/io/PemKeyLoader.kt b/common/src/main/kotlin/de/fiereu/openmmo/common/io/PemKeyLoader.kt new file mode 100644 index 0000000..9783ec6 --- /dev/null +++ b/common/src/main/kotlin/de/fiereu/openmmo/common/io/PemKeyLoader.kt @@ -0,0 +1,38 @@ +package de.fiereu.openmmo.common.io + +import java.io.InputStream +import java.security.KeyFactory +import java.security.interfaces.ECPrivateKey +import java.security.interfaces.ECPublicKey +import java.security.spec.PKCS8EncodedKeySpec +import java.security.spec.X509EncodedKeySpec +import java.util.Base64 + +object PemKeyLoader { + fun loadEcPublic(stream: InputStream): ECPublicKey { + val der = readPem(stream) + val spec = X509EncodedKeySpec(der) + return KeyFactory.getInstance("EC").generatePublic(spec) as ECPublicKey + } + + fun loadEcPrivate(stream: InputStream): ECPrivateKey { + val der = readPem(stream) + val spec = PKCS8EncodedKeySpec(der) + return KeyFactory.getInstance("EC").generatePrivate(spec) as ECPrivateKey + } + + private fun readPem(stream: InputStream): ByteArray { + val text = stream.bufferedReader(Charsets.US_ASCII).use { it.readText() } + val body = + text + .lineSequence() + .map(String::trim) + .filter { it.isNotEmpty() && !it.startsWith("-----") } + .joinToString("") + return Base64.getDecoder().decode(body) + } +} + +fun resource(name: String): InputStream = + PemKeyLoader::class.java.classLoader.getResourceAsStream(name) + ?: error("classpath resource not found: $name") diff --git a/common/src/test/kotlin/de/fiereu/openmmo/common/auth/SessionTokenTest.kt b/common/src/test/kotlin/de/fiereu/openmmo/common/auth/SessionTokenTest.kt new file mode 100644 index 0000000..ca33401 --- /dev/null +++ b/common/src/test/kotlin/de/fiereu/openmmo/common/auth/SessionTokenTest.kt @@ -0,0 +1,48 @@ +package de.fiereu.openmmo.common.auth + +import io.kotest.assertions.throwables.shouldThrow +import io.kotest.core.spec.style.FunSpec +import io.kotest.matchers.nulls.shouldNotBeNull +import io.kotest.matchers.shouldBe +import java.time.Clock +import java.time.Instant +import java.time.ZoneOffset + +class SessionTokenTest : + FunSpec({ + val secret = ByteArray(32) { it.toByte() } + + test("issuer + verifier roundtrip recovers userId and issuedAt") { + val fixed = Clock.fixed(Instant.ofEpochSecond(1_700_000_000), ZoneOffset.UTC) + val issuer = SessionTokenIssuer(secret, fixed) + val token = issuer.issue(userId = 42L) + val verified = SessionTokenVerifier(secret).verify(token.bytes) + verified.shouldNotBeNull() + verified.userId shouldBe 42L + verified.issuedAt shouldBe Instant.ofEpochSecond(1_700_000_000) + } + + test("tampered bytes fail verification") { + val token = SessionTokenIssuer(secret).issue(userId = 1L) + val mutated = token.bytes.copyOf() + mutated[0] = (mutated[0] + 1).toByte() + SessionTokenVerifier(secret).verify(mutated) shouldBe null + } + + test("different secret fails verification") { + val token = SessionTokenIssuer(secret).issue(userId = 1L) + val other = ByteArray(32) { (it + 1).toByte() } + SessionTokenVerifier(other).verify(token.bytes) shouldBe null + } + + test("wrong length fails verification fast") { + SessionTokenVerifier(secret).verify(ByteArray(0)) shouldBe null + SessionTokenVerifier(secret).verify(ByteArray(31)) shouldBe null + SessionTokenVerifier(secret).verify(ByteArray(33)) shouldBe null + } + + test("empty secret rejected") { + shouldThrow { SessionTokenIssuer(ByteArray(0)) } + shouldThrow { SessionTokenVerifier(ByteArray(0)) } + } + }) diff --git a/gradle.properties b/gradle.properties index 5787b88..f0d09dc 100644 --- a/gradle.properties +++ b/gradle.properties @@ -15,5 +15,5 @@ openmmo.db.game.password=${GAME_DB_PASSWORD} pokemmo.mainClass=com.pokeemu.client.Client # May be overridden by the user -pokemmo.executable=${HOME}/.local/share/pokemmo/PokeMMO.exe -pokemmo.workingDir=${HOME}/.local/share/pokemmo/ \ No newline at end of file +pokemmo.executable=C:/Program Files/PokeMMO/PokeMMO.exe +pokemmo.workingDir=C:/Program Files/PokeMMO \ No newline at end of file diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 3e9845a..7340b3a 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -5,9 +5,10 @@ kotlinx-coroutines = "1.10.2" kotlin-logging = "7.0.7" # sl4j wrapper for Kotlin logback = "1.5.13" slf4j = "2.0.17" -asm = "9.8" +bytebuddy = "1.17.5" +jte = "3.2.1" spotless = "7.2.1" -shadow = "9.0.2" +sonarlint = "7.1.1" bouncycastle = "1.81" junit5 = "6.0.0-M2" kotest = "6.1.11" @@ -24,6 +25,7 @@ ineter = "0.3.1" [libraries] kotlinGradlePlugin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" } spotlessGradlePlugin = { module = "com.diffplug.spotless:spotless-plugin-gradle", version.ref = "spotless" } +sonarlintGradlePlugin = { module = "name.remal.sonarlint:name.remal.sonarlint.gradle.plugin", version.ref = "sonarlint" } kotlin-reflect = { module = "org.jetbrains.kotlin:kotlin-reflect", version.ref = "kotlin" } kotlinx-serialization-core = { module = "org.jetbrains.kotlinx:kotlinx-serialization-core-jvm", version.ref = "kotlinx-serialization" } kotlinx-serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json-jvm", version.ref = "kotlinx-serialization" } @@ -32,7 +34,10 @@ kotlinx-coroutines-test = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-t kotlin-logging = { module = "io.github.oshai:kotlin-logging-jvm", version.ref = "kotlin-logging" } logback = { module = "ch.qos.logback:logback-classic", version.ref = "logback" } slf4j = { module = "org.slf4j:slf4j-api", version.ref = "slf4j" } -asm = { module = "org.ow2.asm:asm", version.ref = "asm" } +bytebuddy = { module = "net.bytebuddy:byte-buddy", version.ref = "bytebuddy" } +bytebuddy-agent = { module = "net.bytebuddy:byte-buddy-agent", version.ref = "bytebuddy" } +jte = { module = "gg.jte:jte", version.ref = "jte" } +jte-kotlin = { module = "gg.jte:jte-kotlin", version.ref = "jte" } bouncycastle-pkix = { module = "org.bouncycastle:bcpkix-jdk18on", version.ref = "bouncycastle" } bouncycastle-provider = { module = "org.bouncycastle:bcprov-jdk18on", version.ref = "bouncycastle" } junit5 = { module = "org.junit.jupiter:junit-jupiter-api", version.ref = "junit5" } @@ -55,12 +60,12 @@ ineter = { module = "com.github.maltalex:ineter", version.ref = "ineter" } [bundles] crypto = ["bouncycastle-pkix", "bouncycastle-provider"] +bytebuddy = ["bytebuddy", "bytebuddy-agent"] jooq = ["jooq", "jooq-kotlin", "jooq-meta", "jooq-codegen"] kotest = ["kotest-core", "kotest-assertions", "kotest-framework"] [plugins] kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" } -shadow = { id = "com.gradleup.shadow", version.ref = "shadow" } jooq = { id = "org.jooq.jooq-codegen-gradle", version.ref = "jooq" } flyway = { id = "org.flywaydb.flyway", version.ref = "flyway" } ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" } \ No newline at end of file diff --git a/maps/build.gradle.kts b/maps/build.gradle.kts new file mode 100644 index 0000000..4875cda --- /dev/null +++ b/maps/build.gradle.kts @@ -0,0 +1,99 @@ +import javax.inject.Inject +import org.gradle.process.ExecOperations + +plugins { + id("buildsrc.convention.kotlin-jvm") + id("buildsrc.convention.spotless") + id("buildsrc.convention.sonarlint") +} + +dependencies { + api(project(":common")) + api(project(":protocols.game")) + api(libs.dagger) +} + +val generator: SourceSet by sourceSets.creating + +dependencies { + "generatorImplementation"(libs.jte) + "generatorImplementation"(libs.kotlinx.serialization.json) +} + +abstract class CloneOrUpdateGitRepoTask : DefaultTask() { + + @get:Input abstract val remote: Property + + @get:Input abstract val ref: Property + + @get:OutputDirectory abstract val target: DirectoryProperty + + @get:Inject abstract val execOps: ExecOperations + + @TaskAction + fun run() { + val dir = target.get().asFile + val refValue = ref.get() + if (File(dir, ".git").exists()) { + execOps.exec { + workingDir = dir + commandLine("git", "fetch", "--depth", "1", "origin", refValue) + } + execOps.exec { + workingDir = dir + commandLine("git", "checkout", "--detach", "FETCH_HEAD") + } + } else { + if (dir.exists()) dir.deleteRecursively() + dir.parentFile.mkdirs() + execOps.exec { + commandLine( + "git", + "clone", + "--depth", + "1", + "--branch", + refValue, + remote.get(), + dir.absolutePath, + ) + } + } + } +} + +val pokeemeraldRef = providers.gradleProperty("pokemmo.pokeemerald.ref").orElse("master") + +val clonePokeemerald by + tasks.registering(CloneOrUpdateGitRepoTask::class) { + group = "openmmo" + description = "Clone or fast-forward pret/pokeemerald into build/pokeemerald" + remote.set("https://github.com/pret/pokeemerald.git") + ref.set(pokeemeraldRef) + target.set(layout.buildDirectory.dir("pokeemerald")) + } + +val pokeemeraldDir = layout.buildDirectory.dir("pokeemerald") +val generatedSrc = layout.buildDirectory.dir("generated/source/maps/main/kotlin") +val templatesDir = layout.projectDirectory.dir("src/generator/jte") +val jteCacheDir = layout.buildDirectory.dir("jte-classes") + +val pokeemeraldArg = pokeemeraldDir.get().asFile.absolutePath +val generatedArg = generatedSrc.get().asFile.absolutePath +val templatesArg = templatesDir.asFile.absolutePath +val jteCacheArg = jteCacheDir.get().asFile.absolutePath + +val generateMaps by + tasks.registering(JavaExec::class) { + group = "openmmo" + description = "Render MapDefaults.kt from pokeemerald data via JTE" + dependsOn(clonePokeemerald, tasks.named("${generator.name}Classes")) + inputs.dir(pokeemeraldDir) + inputs.dir(templatesDir) + outputs.dir(generatedSrc) + classpath = generator.runtimeClasspath + mainClass.set("de.fiereu.openmmo.maps.generator.Main") + args = listOf(pokeemeraldArg, generatedArg, templatesArg, jteCacheArg) + } + +sourceSets.main { kotlin.srcDir(generateMaps) } diff --git a/maps/src/generator/jte/MapsRegistry.jte b/maps/src/generator/jte/MapsRegistry.jte new file mode 100644 index 0000000..fd9a903 --- /dev/null +++ b/maps/src/generator/jte/MapsRegistry.jte @@ -0,0 +1,52 @@ +@import de.fiereu.openmmo.maps.generator.ParsedMap +@import de.fiereu.openmmo.maps.generator.RenderUtil +@import java.util.List + +@param List> chunks +package de.fiereu.openmmo.maps + +import de.fiereu.openmmo.common.Tile2D +import de.fiereu.openmmo.common.enums.EncounterType +import de.fiereu.openmmo.common.enums.Lighting +import de.fiereu.openmmo.common.enums.MapType +import de.fiereu.openmmo.common.enums.Weather +import de.fiereu.openmmo.net.game.packets.MapData + +internal object MapDefaults { + fun loadInto(mgr: MapManager) { +@for(int i = 0; i < chunks.size(); i++) + chunk${i}(mgr) +@endfor + } + +@for(int chunkIndex = 0; chunkIndex < chunks.size(); chunkIndex++) + private fun chunk${chunkIndex}(mgr: MapManager) { +@for(ParsedMap map : chunks.get(chunkIndex)) + // ${map.getSourceName()} (${map.getMapId()}) + mgr.register( + MapDef( + regionId = ${map.getRegion()}, + bankId = ${map.getBank()}, + mapId = ${map.getIndex()}, + width = ${map.getWidth()}, + height = ${map.getHeight()}, + paletteIdx1 = ${map.getPaletteIdx1()}, + paletteIdx2 = ${map.getPaletteIdx2()}, + unknownShort = ${map.getMusicId()}, + unknownByte = ${map.getMapsecId()}, + borderTiles = ${RenderUtil.INSTANCE.borderTiles(map.getBorderTiles())}, + lighting = ${map.getLighting()}, + weather = ${map.getWeather()}, + mapType = ${map.getMapType()}, + encounterType = ${map.getEncounterType()}, + connections = ${RenderUtil.INSTANCE.connections(map.getConnections())}, + warps = ${RenderUtil.INSTANCE.warps(map.getWarps())}, + npcs = ${RenderUtil.INSTANCE.npcs(map.getVisibleNpcs())}, + bgEvents = ${RenderUtil.INSTANCE.bgEvents(map.getBgEvents())}, + ) + ) +@endfor + } + +@endfor +} diff --git a/maps/src/generator/kotlin/de/fiereu/openmmo/maps/generator/Constants.kt b/maps/src/generator/kotlin/de/fiereu/openmmo/maps/generator/Constants.kt new file mode 100644 index 0000000..9763f45 --- /dev/null +++ b/maps/src/generator/kotlin/de/fiereu/openmmo/maps/generator/Constants.kt @@ -0,0 +1,201 @@ +package de.fiereu.openmmo.maps.generator + +internal const val BANK_GROUP_OFFSET = 50 + +internal val dirMap = + mapOf("down" to 1, "up" to 2, "left" to 3, "right" to 4, "dive" to 5, "emerge" to 6) + +internal val movementTypes = + mapOf( + "MOVEMENT_TYPE_NONE" to 0, + "MOVEMENT_TYPE_LOOK_AROUND" to 1, + "MOVEMENT_TYPE_WANDER_AROUND" to 2, + "MOVEMENT_TYPE_WANDER_UP_AND_DOWN" to 3, + "MOVEMENT_TYPE_WANDER_DOWN_AND_UP" to 4, + "MOVEMENT_TYPE_WANDER_LEFT_AND_RIGHT" to 5, + "MOVEMENT_TYPE_WANDER_RIGHT_AND_LEFT" to 6, + "MOVEMENT_TYPE_FACE_UP" to 7, + "MOVEMENT_TYPE_FACE_DOWN" to 8, + "MOVEMENT_TYPE_FACE_LEFT" to 9, + "MOVEMENT_TYPE_FACE_RIGHT" to 10, + "MOVEMENT_TYPE_PLAYER" to 11, + "MOVEMENT_TYPE_BERRY_TREE_GROWTH" to 12, + "MOVEMENT_TYPE_FACE_DOWN_AND_UP" to 13, + "MOVEMENT_TYPE_FACE_LEFT_AND_RIGHT" to 14, + "MOVEMENT_TYPE_FACE_UP_AND_LEFT" to 15, + "MOVEMENT_TYPE_FACE_UP_AND_RIGHT" to 16, + "MOVEMENT_TYPE_FACE_DOWN_AND_LEFT" to 17, + "MOVEMENT_TYPE_FACE_DOWN_AND_RIGHT" to 18, + "MOVEMENT_TYPE_FACE_DOWN_UP_AND_LEFT" to 19, + "MOVEMENT_TYPE_FACE_DOWN_UP_AND_RIGHT" to 20, + "MOVEMENT_TYPE_FACE_UP_LEFT_AND_RIGHT" to 21, + "MOVEMENT_TYPE_FACE_DOWN_LEFT_AND_RIGHT" to 22, + "MOVEMENT_TYPE_ROTATE_COUNTERCLOCKWISE" to 23, + "MOVEMENT_TYPE_ROTATE_CLOCKWISE" to 24, + "MOVEMENT_TYPE_WALK_UP_AND_DOWN" to 25, + "MOVEMENT_TYPE_WALK_DOWN_AND_UP" to 26, + "MOVEMENT_TYPE_WALK_LEFT_AND_RIGHT" to 27, + "MOVEMENT_TYPE_WALK_RIGHT_AND_LEFT" to 28, + "MOVEMENT_TYPE_WALK_IN_PLACE_DOWN" to 64, + "MOVEMENT_TYPE_WALK_IN_PLACE_UP" to 65, + "MOVEMENT_TYPE_WALK_IN_PLACE_LEFT" to 66, + "MOVEMENT_TYPE_WALK_IN_PLACE_RIGHT" to 67, + "MOVEMENT_TYPE_JOG_IN_PLACE_DOWN" to 68, + "MOVEMENT_TYPE_JOG_IN_PLACE_UP" to 69, + "MOVEMENT_TYPE_JOG_IN_PLACE_LEFT" to 70, + "MOVEMENT_TYPE_JOG_IN_PLACE_RIGHT" to 71, + "MOVEMENT_TYPE_RUN_IN_PLACE_DOWN" to 72, + "MOVEMENT_TYPE_RUN_IN_PLACE_UP" to 73, + "MOVEMENT_TYPE_RUN_IN_PLACE_LEFT" to 74, + "MOVEMENT_TYPE_RUN_IN_PLACE_RIGHT" to 75, + "MOVEMENT_TYPE_INVISIBLE" to 76, + ) + +internal val gfxIds = + mapOf( + "OBJ_EVENT_GFX_BRENDAN_NORMAL" to 0, + "OBJ_EVENT_GFX_BRENDAN_MACH_BIKE" to 1, + "OBJ_EVENT_GFX_BRENDAN_SURFING" to 2, + "OBJ_EVENT_GFX_BRENDAN_FIELD_MOVE" to 3, + "OBJ_EVENT_GFX_QUINTY_PLUMP" to 4, + "OBJ_EVENT_GFX_NINJA_BOY" to 5, + "OBJ_EVENT_GFX_TWIN" to 6, + "OBJ_EVENT_GFX_BOY_1" to 7, + "OBJ_EVENT_GFX_GIRL_1" to 8, + "OBJ_EVENT_GFX_BOY_2" to 9, + "OBJ_EVENT_GFX_GIRL_2" to 10, + "OBJ_EVENT_GFX_LITTLE_BOY" to 11, + "OBJ_EVENT_GFX_LITTLE_GIRL" to 12, + "OBJ_EVENT_GFX_BOY_3" to 13, + "OBJ_EVENT_GFX_GIRL_3" to 14, + "OBJ_EVENT_GFX_RICH_BOY" to 15, + "OBJ_EVENT_GFX_WOMAN_1" to 16, + "OBJ_EVENT_GFX_FAT_MAN" to 17, + "OBJ_EVENT_GFX_POKEFAN_F" to 18, + "OBJ_EVENT_GFX_MAN_1" to 19, + "OBJ_EVENT_GFX_WOMAN_2" to 20, + "OBJ_EVENT_GFX_EXPERT_M" to 21, + "OBJ_EVENT_GFX_EXPERT_F" to 22, + "OBJ_EVENT_GFX_MAN_2" to 23, + "OBJ_EVENT_GFX_WOMAN_3" to 24, + "OBJ_EVENT_GFX_POKEFAN_M" to 25, + "OBJ_EVENT_GFX_WOMAN_4" to 26, + "OBJ_EVENT_GFX_COOK" to 27, + "OBJ_EVENT_GFX_LINK_RECEPTIONIST" to 28, + "OBJ_EVENT_GFX_OLD_MAN" to 29, + "OBJ_EVENT_GFX_OLD_WOMAN" to 30, + "OBJ_EVENT_GFX_CAMPER" to 31, + "OBJ_EVENT_GFX_PICNICKER" to 32, + "OBJ_EVENT_GFX_MAN_3" to 33, + "OBJ_EVENT_GFX_WOMAN_5" to 34, + "OBJ_EVENT_GFX_YOUNGSTER" to 35, + "OBJ_EVENT_GFX_BUG_CATCHER" to 36, + "OBJ_EVENT_GFX_PSYCHIC_M" to 37, + "OBJ_EVENT_GFX_SCHOOL_KID_M" to 38, + "OBJ_EVENT_GFX_MANIAC" to 39, + "OBJ_EVENT_GFX_HEX_MANIAC" to 40, + "OBJ_EVENT_GFX_RAYQUAZA_STILL" to 41, + "OBJ_EVENT_GFX_SWIMMER_M" to 42, + "OBJ_EVENT_GFX_SWIMMER_F" to 43, + "OBJ_EVENT_GFX_BLACK_BELT" to 44, + "OBJ_EVENT_GFX_BEAUTY" to 45, + "OBJ_EVENT_GFX_SCIENTIST_1" to 46, + "OBJ_EVENT_GFX_LASS" to 47, + "OBJ_EVENT_GFX_GENTLEMAN" to 48, + "OBJ_EVENT_GFX_SAILOR" to 49, + "OBJ_EVENT_GFX_FISHERMAN" to 50, + "OBJ_EVENT_GFX_RUNNING_TRIATHLETE_M" to 51, + "OBJ_EVENT_GFX_RUNNING_TRIATHLETE_F" to 52, + "OBJ_EVENT_GFX_TUBER_F" to 53, + "OBJ_EVENT_GFX_TUBER_M" to 54, + "OBJ_EVENT_GFX_HIKER" to 55, + "OBJ_EVENT_GFX_CYCLING_TRIATHLETE_M" to 56, + "OBJ_EVENT_GFX_CYCLING_TRIATHLETE_F" to 57, + "OBJ_EVENT_GFX_NURSE" to 58, + "OBJ_EVENT_GFX_ITEM_BALL" to 59, + "OBJ_EVENT_GFX_BERRY_TREE" to 60, + "OBJ_EVENT_GFX_BERRY_TREE_EARLY_STAGES" to 61, + "OBJ_EVENT_GFX_BERRY_TREE_LATE_STAGES" to 62, + "OBJ_EVENT_GFX_BRENDAN_ACRO_BIKE" to 63, + "OBJ_EVENT_GFX_PROF_BIRCH" to 64, + "OBJ_EVENT_GFX_MAN_4" to 65, + "OBJ_EVENT_GFX_MAN_5" to 66, + "OBJ_EVENT_GFX_REPORTER_M" to 67, + "OBJ_EVENT_GFX_REPORTER_F" to 68, + "OBJ_EVENT_GFX_BARD" to 69, + "OBJ_EVENT_GFX_ANABEL" to 70, + "OBJ_EVENT_GFX_TUCKER" to 71, + "OBJ_EVENT_GFX_GRETA" to 72, + "OBJ_EVENT_GFX_SPENSER" to 73, + "OBJ_EVENT_GFX_NOLAND" to 74, + "OBJ_EVENT_GFX_LUCY" to 75, + "OBJ_EVENT_GFX_MART_EMPLOYEE" to 83, + "OBJ_EVENT_GFX_TRUCK" to 94, + "OBJ_EVENT_GFX_VIGOROTH_CARRYING_BOX" to 95, + "OBJ_EVENT_GFX_VIGOROTH_FACING_AWAY" to 96, + "OBJ_EVENT_GFX_RIVAL_BRENDAN_NORMAL" to 100, + "OBJ_EVENT_GFX_RIVAL_MAY_NORMAL" to 105, + "OBJ_EVENT_GFX_SCIENTIST_2" to 115, + "OBJ_EVENT_GFX_NORMAN" to 129, + "OBJ_EVENT_GFX_MOM" to 215, + "OBJ_EVENT_GFX_VAR_0" to 240, + ) + +internal val weatherMap = + mapOf( + "WEATHER_NONE" to "Weather.IN_HOUSE_WEATHER", + "WEATHER_SUNNY" to "Weather.REGULAR_WEATHER", + "WEATHER_RAIN" to "Weather.RAINY_WEATHER", + "WEATHER_SNOW" to "Weather.THREE_SNOW_FLAKES", + "WEATHER_FOG_HORIZONTAL" to "Weather.STEADY_MIST", + "WEATHER_FOG_DIAGONAL" to "Weather.STEADY_MIST", + "WEATHER_SHADE" to "Weather.CLOUDY", + "WEATHER_UNDERWATER_BUBBLES" to "Weather.UNDERWATER_MIST", + "WEATHER_VOLCANIC_ASH" to "Weather.DENSE_BRIGHT_MIST", + ) + +internal val mapTypeMap = + mapOf( + "MAP_TYPE_INDOOR" to "MapType.INSIDE", + "MAP_TYPE_TOWN" to "MapType.UNKNOWN_0x01", + "MAP_TYPE_CITY" to "MapType.CITY", + "MAP_TYPE_ROUTE" to "MapType.ROUTE", + "MAP_TYPE_UNDERGROUND" to "MapType.UNDERGROUND", + "MAP_TYPE_UNDERWATER" to "MapType.UNDERWATER", + "MAP_TYPE_OCEAN_ROUTE" to "MapType.ROUTE", + "MAP_TYPE_SECRET_BASE" to "MapType.SECRET_BASE", + ) + +private const val ENCOUNTER_RANDOM = "EncounterType.RANDOM" +private const val ENCOUNTER_UNKNOWN_0X03 = "EncounterType.UNKNOWN_0x03" + +internal val encounterMap = + mapOf( + "MAP_TYPE_INDOOR" to ENCOUNTER_RANDOM, + "MAP_TYPE_TOWN" to ENCOUNTER_RANDOM, + "MAP_TYPE_CITY" to ENCOUNTER_RANDOM, + "MAP_TYPE_ROUTE" to ENCOUNTER_RANDOM, + "MAP_TYPE_UNDERGROUND" to ENCOUNTER_RANDOM, + "MAP_TYPE_UNDERWATER" to ENCOUNTER_UNKNOWN_0X03, + "MAP_TYPE_OCEAN_ROUTE" to ENCOUNTER_RANDOM, + "MAP_TYPE_SECRET_BASE" to ENCOUNTER_UNKNOWN_0X03, + ) + +internal val defaultVisibleNpcs = + mapOf( + "LittlerootTown_MaysHouse_1F" to listOf(0), + "LittlerootTown_BrendansHouse_1F" to listOf(3, 5), + "LittlerootTown_ProfessorBirchsLab" to listOf(0), + ) + +internal fun movementToFacingDir(movementType: Int): Int = + when (movementType) { + 7 -> 1 + 8 -> 0 + 9 -> 2 + 10 -> 3 + in 64..67 -> movementType - 64 + in 68..71 -> movementType - 68 + in 72..75 -> movementType - 72 + else -> 0 + } diff --git a/maps/src/generator/kotlin/de/fiereu/openmmo/maps/generator/Main.kt b/maps/src/generator/kotlin/de/fiereu/openmmo/maps/generator/Main.kt new file mode 100644 index 0000000..43007ca --- /dev/null +++ b/maps/src/generator/kotlin/de/fiereu/openmmo/maps/generator/Main.kt @@ -0,0 +1,21 @@ +@file:JvmName("Main") + +package de.fiereu.openmmo.maps.generator + +import java.io.File + +fun main(args: Array) { + require(args.size == 4) { + "Usage: got ${args.toList()}" + } + val pokeemeraldDir = File(args[0]) + val outputDir = File(args[1]) + val templatesDir = File(args[2]) + val classCacheDir = File(args[3]) + + println("[maps] parsing pokeemerald from $pokeemeraldDir") + val maps = PokeemeraldParser(pokeemeraldDir).parseAll() + println("[maps] parsed ${maps.size} maps. writing to $outputDir") + MapsRenderer(templatesDir, outputDir, classCacheDir).render(maps) + println("[maps] done") +} diff --git a/maps/src/generator/kotlin/de/fiereu/openmmo/maps/generator/MapsRenderer.kt b/maps/src/generator/kotlin/de/fiereu/openmmo/maps/generator/MapsRenderer.kt new file mode 100644 index 0000000..255377a --- /dev/null +++ b/maps/src/generator/kotlin/de/fiereu/openmmo/maps/generator/MapsRenderer.kt @@ -0,0 +1,31 @@ +package de.fiereu.openmmo.maps.generator + +import gg.jte.ContentType +import gg.jte.TemplateEngine +import gg.jte.output.FileOutput +import gg.jte.resolve.DirectoryCodeResolver +import java.io.File + +class MapsRenderer( + private val templatesDir: File, + private val outputDir: File, + private val classCacheDir: File, + private val chunkSize: Int = 60, +) { + + fun render(maps: List) { + classCacheDir.mkdirs() + val engine = + TemplateEngine.create( + DirectoryCodeResolver(templatesDir.toPath()), + classCacheDir.toPath(), + ContentType.Plain, + ) + val chunks = maps.chunked(chunkSize) + val target = File(outputDir, "de/fiereu/openmmo/maps/MapDefaults.kt") + target.parentFile.mkdirs() + FileOutput(target.toPath()).use { out -> + engine.render("MapsRegistry.jte", mapOf("chunks" to chunks), out) + } + } +} diff --git a/maps/src/generator/kotlin/de/fiereu/openmmo/maps/generator/ParsedModel.kt b/maps/src/generator/kotlin/de/fiereu/openmmo/maps/generator/ParsedModel.kt new file mode 100644 index 0000000..fa7e743 --- /dev/null +++ b/maps/src/generator/kotlin/de/fiereu/openmmo/maps/generator/ParsedModel.kt @@ -0,0 +1,63 @@ +package de.fiereu.openmmo.maps.generator + +data class ParsedMap( + val sourceName: String, + val mapId: String, + val region: Int, + val bank: Int, + val index: Int, + val width: Int, + val height: Int, + val paletteIdx1: Int, + val paletteIdx2: Int, + val musicId: Int, + val mapsecId: Int, + val borderTiles: List, + val lighting: String, + val weather: String, + val mapType: String, + val encounterType: String, + val connections: List, + val warps: List, + val visibleNpcs: List, + val bgEvents: List, +) + +data class ParsedConnection( + val direction: Int, + val offset: Int, + val targetBank: Int, + val targetMap: Int, +) + +data class ParsedWarp( + val x: Int, + val y: Int, + val elevation: Int, + val targetBank: Int, + val targetMap: Int, + val targetX: Int, + val targetY: Int, + val targetElevation: Int, +) + +data class ParsedNpc( + val entityIdx: Int, + val graphicsId: Int, + val x: Int, + val y: Int, + val elevation: Int, + val movementType: Int, + val movementRangeX: Int, + val movementRangeY: Int, + val trainerType: Int, + val facing: Int, + val script: String, +) + +data class ParsedBgEvent( + val x: Int, + val y: Int, + val facingDir: String, + val script: String, +) diff --git a/maps/src/generator/kotlin/de/fiereu/openmmo/maps/generator/PokeemeraldParser.kt b/maps/src/generator/kotlin/de/fiereu/openmmo/maps/generator/PokeemeraldParser.kt new file mode 100644 index 0000000..67c8926 --- /dev/null +++ b/maps/src/generator/kotlin/de/fiereu/openmmo/maps/generator/PokeemeraldParser.kt @@ -0,0 +1,262 @@ +package de.fiereu.openmmo.maps.generator + +import java.io.File +import java.nio.ByteBuffer +import java.nio.ByteOrder +import kotlinx.serialization.json.Json +import kotlinx.serialization.json.JsonElement +import kotlinx.serialization.json.JsonObject +import kotlinx.serialization.json.contentOrNull +import kotlinx.serialization.json.intOrNull +import kotlinx.serialization.json.jsonArray +import kotlinx.serialization.json.jsonObject +import kotlinx.serialization.json.jsonPrimitive + +class PokeemeraldParser(private val rootDir: File) { + + private val json = Json { ignoreUnknownKeys = true } + + fun parseAll(): List { + val mapGroups = readJson(File(rootDir, "data/maps/map_groups.json")).jsonObject + val groupOrder = + (mapGroups["group_order"] ?: error("group_order missing")).jsonArray.map { + it.jsonPrimitive.content + } + val groupEntries: Map> = + groupOrder.associateWith { group -> + (mapGroups[group]?.jsonArray ?: error("group $group missing")).map { + it.jsonPrimitive.content + } + } + + val layouts: Map = + (readJson(File(rootDir, "data/layouts/layouts.json")).jsonObject["layouts"] + ?: error("layouts missing")) + .jsonArray + .mapNotNull { it as? JsonObject } + .filter { it["id"]?.jsonPrimitive?.contentOrNull != null } + .associateBy { it["id"]?.jsonPrimitive?.content ?: error("layout id") } + + val musicIds = readDefineTable(File(rootDir, "include/constants/songs.h"), "MUS_") + val mapsecIds = readMapsecIds() + val tilesetPaletteIds = readTilesetPaletteIds() + + // Pre-parse every map.json once so warp lookups don't re-read files. + data class Address(val groupIndex: Int, val mapIndex: Int, val mapName: String) + val addresses = mutableMapOf() + val mapJsons = mutableMapOf() + for ((groupIndex, groupName) in groupOrder.withIndex()) { + val maps = groupEntries[groupName] ?: continue + for ((mapIndex, mapDirName) in maps.withIndex()) { + val mapJsonFile = File(rootDir, "data/maps/$mapDirName/map.json") + if (!mapJsonFile.exists()) continue + val parsed = readJson(mapJsonFile).jsonObject + mapJsons[mapDirName] = parsed + addresses[mapDirName] = Address(groupIndex, mapIndex, mapDirName) + val mapId = parsed["id"]?.jsonPrimitive?.contentOrNull + if (mapId != null) addresses[mapId] = Address(groupIndex, mapIndex, mapDirName) + } + } + + val results = mutableListOf() + for ((groupIndex, groupName) in groupOrder.withIndex()) { + val maps = groupEntries[groupName] ?: continue + for ((mapIndex, mapDirName) in maps.withIndex()) { + val mapJson = mapJsons[mapDirName] ?: continue + val layoutId = mapJson["layout"]?.jsonPrimitive?.contentOrNull ?: continue + val layout = layouts[layoutId] ?: continue + + val mapType = mapJson["map_type"]?.jsonPrimitive?.contentOrNull ?: "MAP_TYPE_INDOOR" + val primaryTileset = layout["primary_tileset"]?.jsonPrimitive?.contentOrNull + val secondaryTileset = layout["secondary_tileset"]?.jsonPrimitive?.contentOrNull + val pal1 = tilesetPaletteIds[primaryTileset] ?: 80 + val pal2 = tilesetPaletteIds[secondaryTileset] ?: 82 + val musicName = mapJson["music"]?.jsonPrimitive?.contentOrNull ?: "MUS_NONE" + val mapsecName = + mapJson["region_map_section"]?.jsonPrimitive?.contentOrNull ?: "MAPSEC_NONE" + + val connections = + mapJson["connections"]?.jsonArrayOrNull()?.mapNotNull { conn -> + val obj = conn.jsonObject + val dirName = obj["direction"]?.jsonPrimitive?.contentOrNull ?: return@mapNotNull null + val dir = dirMap[dirName] ?: error("Unknown connection direction '$dirName'") + val mapName = obj["map"]?.jsonPrimitive?.contentOrNull ?: return@mapNotNull null + val addr = addresses[mapName] ?: return@mapNotNull null + val offset = obj["offset"]?.jsonPrimitive?.intOrNull ?: 0 + ParsedConnection( + direction = dir, + offset = offset, + targetBank = addr.groupIndex + BANK_GROUP_OFFSET, + targetMap = addr.mapIndex, + ) + } ?: emptyList() + + val warps = + mapJson["warp_events"]?.jsonArrayOrNull()?.mapNotNull { warp -> + val obj = warp.jsonObject + val destName = obj["dest_map"]?.jsonPrimitive?.contentOrNull ?: return@mapNotNull null + val destAddr = addresses[destName] ?: return@mapNotNull null + val x = obj["x"]?.jsonPrimitive?.intOrNull ?: 0 + val y = obj["y"]?.jsonPrimitive?.intOrNull ?: 0 + val srcElevation = obj["elevation"]?.jsonPrimitive?.intOrNull ?: 0 + val destWarpId = + obj["dest_warp_id"]?.jsonPrimitive?.let { + it.intOrNull ?: it.content.toIntOrNull() + } ?: 0 + val destWarps = + mapJsons[destAddr.mapName]?.get("warp_events")?.jsonArrayOrNull().orEmpty() + val target = + destWarps.getOrNull(destWarpId)?.jsonObject + ?: return@mapNotNull ParsedWarp( + x = x, + y = y, + elevation = (srcElevation - 1).coerceAtLeast(0), + targetBank = destAddr.groupIndex + BANK_GROUP_OFFSET, + targetMap = destAddr.mapIndex, + targetX = x, + targetY = y, + targetElevation = 0, + ) + val tx = target["x"]?.jsonPrimitive?.intOrNull ?: x + val ty = target["y"]?.jsonPrimitive?.intOrNull ?: y + val targetElevation = + ((target["elevation"]?.jsonPrimitive?.intOrNull ?: 0) - 1).coerceAtLeast(0) + ParsedWarp( + x = x, + y = y, + elevation = (srcElevation - 1).coerceAtLeast(0), + targetBank = destAddr.groupIndex + BANK_GROUP_OFFSET, + targetMap = destAddr.mapIndex, + targetX = tx, + targetY = ty, + targetElevation = targetElevation, + ) + } ?: emptyList() + + val rawNpcs = mapJson["object_events"]?.jsonArrayOrNull().orEmpty() + val visibleOverride = defaultVisibleNpcs[mapDirName] + val visibleNpcs = + rawNpcs.mapIndexedNotNull { idx, npcElement -> + val npc = npcElement.jsonObject + val isVisible = + if (visibleOverride != null) idx in visibleOverride + else npc["flag"]?.jsonPrimitive?.contentOrNull == "0" + if (!isVisible) return@mapIndexedNotNull null + val gfxName = + npc["graphics_id"]?.jsonPrimitive?.contentOrNull ?: "OBJ_EVENT_GFX_BOY_1" + val movementName = + npc["movement_type"]?.jsonPrimitive?.contentOrNull ?: "MOVEMENT_TYPE_NONE" + val movement = movementTypes[movementName] ?: 0 + val trainerType = + if (npc["trainer_type"]?.jsonPrimitive?.contentOrNull == "TRAINER_TYPE_NONE") 0 + else 1 + ParsedNpc( + entityIdx = idx, + graphicsId = gfxIds[gfxName] ?: 0, + x = npc["x"]?.jsonPrimitive?.intOrNull ?: 0, + y = npc["y"]?.jsonPrimitive?.intOrNull ?: 0, + elevation = npc["elevation"]?.jsonPrimitive?.intOrNull ?: 3, + movementType = movement, + movementRangeX = npc["movement_range_x"]?.jsonPrimitive?.intOrNull ?: 0, + movementRangeY = npc["movement_range_y"]?.jsonPrimitive?.intOrNull ?: 0, + trainerType = trainerType, + facing = movementToFacingDir(movement), + script = npc["script"]?.jsonPrimitive?.contentOrNull ?: "0x0", + ) + } + + val bgEvents = + mapJson["bg_events"]?.jsonArrayOrNull()?.map { be -> + val obj = be.jsonObject + ParsedBgEvent( + x = obj["x"]?.jsonPrimitive?.intOrNull ?: 0, + y = obj["y"]?.jsonPrimitive?.intOrNull ?: 0, + facingDir = + obj["player_facing_dir"]?.jsonPrimitive?.contentOrNull + ?: "BG_EVENT_PLAYER_FACING_ANY", + script = obj["script"]?.jsonPrimitive?.contentOrNull ?: "0x0", + ) + } ?: emptyList() + + val borderTiles = + layout["border_filepath"]?.jsonPrimitive?.contentOrNull?.let { + readBorderTiles(File(rootDir, it)) + } ?: emptyList() + + results += + ParsedMap( + sourceName = mapDirName, + mapId = mapJson["id"]?.jsonPrimitive?.contentOrNull ?: mapDirName, + region = 1, + bank = groupIndex + BANK_GROUP_OFFSET, + index = mapIndex, + width = layout["width"]?.jsonPrimitive?.intOrNull ?: 20, + height = layout["height"]?.jsonPrimitive?.intOrNull ?: 15, + paletteIdx1 = pal1, + paletteIdx2 = pal2, + musicId = musicIds[musicName] ?: 405, + mapsecId = mapsecIds[mapsecName] ?: 0, + borderTiles = borderTiles, + lighting = "Lighting.REGULAR", + weather = + weatherMap[mapJson["weather"]?.jsonPrimitive?.contentOrNull] + ?: "Weather.REGULAR_WEATHER", + mapType = mapTypeMap[mapType] ?: "MapType.INSIDE", + encounterType = encounterMap[mapType] ?: "EncounterType.RANDOM", + connections = connections, + warps = warps, + visibleNpcs = visibleNpcs, + bgEvents = bgEvents, + ) + } + } + return results + } + + private fun readJson(file: File): JsonElement = json.parseToJsonElement(file.readText()) + + private fun readDefineTable(file: File, prefix: String): Map { + if (!file.exists()) return emptyMap() + val pattern = Regex("""^#define\s+($prefix\w+)\s+(\d+)""") + return file + .readLines() + .mapNotNull { pattern.find(it.trim()) } + .associate { it.groupValues[1] to it.groupValues[2].toInt() } + } + + private fun readMapsecIds(): Map { + val file = File(rootDir, "src/data/region_map/region_map_sections.json") + if (!file.exists()) return emptyMap() + val sections = readJson(file).jsonObject["map_sections"]?.jsonArray ?: return emptyMap() + return sections + .mapIndexedNotNull { i, el -> + el.jsonObject["id"]?.jsonPrimitive?.contentOrNull?.let { it to i } + } + .toMap() + } + + private fun readTilesetPaletteIds(): Map { + val file = File(rootDir, "src/data/tilesets/headers.h") + if (!file.exists()) return emptyMap() + val pattern = Regex("""^const struct Tileset\s+(gTileset_\w+)\s*=""") + var index = 0 + val out = mutableMapOf() + file.forEachLine { line -> + val m = pattern.find(line.trim()) ?: return@forEachLine + out[m.groupValues[1]] = 100 + index + index++ + } + return out + } + + private fun readBorderTiles(file: File): List { + if (!file.exists()) return emptyList() + val bytes = file.readBytes() + val buf = ByteBuffer.wrap(bytes).order(ByteOrder.LITTLE_ENDIAN) + val out = mutableListOf() + while (buf.remaining() >= 2) out += buf.short.toInt() and 0xFFFF + return out + } + + private fun JsonElement.jsonArrayOrNull() = (this as? kotlinx.serialization.json.JsonArray) +} diff --git a/maps/src/main/kotlin/de/fiereu/openmmo/maps/BgEventDef.kt b/maps/src/main/kotlin/de/fiereu/openmmo/maps/BgEventDef.kt new file mode 100644 index 0000000..aa4a4be --- /dev/null +++ b/maps/src/main/kotlin/de/fiereu/openmmo/maps/BgEventDef.kt @@ -0,0 +1,8 @@ +package de.fiereu.openmmo.maps + +data class BgEventDef( + val x: Int, + val y: Int, + val facingDir: String, + val script: String, +) diff --git a/maps/src/main/kotlin/de/fiereu/openmmo/maps/MapDef.kt b/maps/src/main/kotlin/de/fiereu/openmmo/maps/MapDef.kt new file mode 100644 index 0000000..acf83cd --- /dev/null +++ b/maps/src/main/kotlin/de/fiereu/openmmo/maps/MapDef.kt @@ -0,0 +1,32 @@ +package de.fiereu.openmmo.maps + +import de.fiereu.openmmo.common.Tile2D +import de.fiereu.openmmo.common.enums.EncounterType +import de.fiereu.openmmo.common.enums.Lighting +import de.fiereu.openmmo.common.enums.MapType +import de.fiereu.openmmo.common.enums.Weather +import de.fiereu.openmmo.net.game.packets.MapData + +class MapDef( + val regionId: Byte, + val bankId: Byte, + val mapId: Byte, + val width: Int = 20, + val height: Int = 15, + val paletteIdx1: Int = 12, + val paletteIdx2: Int = 14, + val borderWidth: Int = 2, + val borderHeight: Int = 2, + val unknownShort: Int = 0, + val unknownByte: Int = 0, + val borderTiles: List = listOf(Tile2D(8, 0), Tile2D(8, 0), Tile2D(8, 0), Tile2D(8, 0)), + val lighting: Lighting = Lighting.REGULAR, + val weather: Weather = Weather.REGULAR_WEATHER, + val mapType: MapType = MapType.CITY, + val encounterType: EncounterType = EncounterType.RANDOM, + val wildEncounters: List = emptyList(), + val connections: List = emptyList(), + val warps: List = emptyList(), + val npcs: List = emptyList(), + val bgEvents: List = emptyList(), +) diff --git a/maps/src/main/kotlin/de/fiereu/openmmo/maps/MapManager.kt b/maps/src/main/kotlin/de/fiereu/openmmo/maps/MapManager.kt new file mode 100644 index 0000000..11eaafb --- /dev/null +++ b/maps/src/main/kotlin/de/fiereu/openmmo/maps/MapManager.kt @@ -0,0 +1,64 @@ +package de.fiereu.openmmo.maps + +import de.fiereu.openmmo.net.game.packets.LoadMapPacket +import de.fiereu.openmmo.net.game.packets.MapData +import java.util.concurrent.ConcurrentHashMap +import javax.inject.Inject +import javax.inject.Singleton + +@Singleton +class MapManager @Inject constructor() { + + private val maps = ConcurrentHashMap() + + init { + MapDefaults.loadInto(this) + } + + fun register(map: MapDef) { + maps[key(map.regionId, map.bankId, map.mapId)] = map + } + + fun getMap(regionId: Byte, bankId: Byte, mapId: Byte): MapDef? = + maps[key(regionId, bankId, mapId)] + + fun getMap(regionId: Int, bankId: Int, mapId: Int): MapDef? = + getMap(regionId.toByte(), bankId.toByte(), mapId.toByte()) + + fun size(): Int = maps.size + + fun createLoadMapPacket( + map: MapDef, + reloadPlayer: Boolean = false, + deleteCache: Boolean = false, + ): LoadMapPacket = + LoadMapPacket( + reloadPlayer = reloadPlayer, + deleteCache = deleteCache, + regionId = map.regionId.toInt() and 0xFF, + bankId = map.bankId.toInt() and 0xFF, + mapId = map.mapId.toInt() and 0xFF, + mapData = + MapData.GbaMapData( + width = map.width, + height = map.height, + paletteIdx1 = map.paletteIdx1, + paletteIdx2 = map.paletteIdx2, + borderWidth = map.borderWidth, + borderHeight = map.borderHeight, + unknownShort = map.unknownShort, + unknownByte = map.unknownByte, + borderTiles = map.borderTiles, + lighting = map.lighting, + weather = map.weather, + mapType = map.mapType, + encounterType = map.encounterType, + connections = map.connections, + ), + ) + + private fun key(regionId: Byte, bankId: Byte, mapId: Byte): Long = + ((regionId.toLong() and 0xFF) shl 16) or + ((bankId.toLong() and 0xFF) shl 8) or + (mapId.toLong() and 0xFF) +} diff --git a/maps/src/main/kotlin/de/fiereu/openmmo/maps/NpcDef.kt b/maps/src/main/kotlin/de/fiereu/openmmo/maps/NpcDef.kt new file mode 100644 index 0000000..8017067 --- /dev/null +++ b/maps/src/main/kotlin/de/fiereu/openmmo/maps/NpcDef.kt @@ -0,0 +1,15 @@ +package de.fiereu.openmmo.maps + +data class NpcDef( + val entityIdx: Int, + val graphicsId: Int, + val x: Int, + val y: Int, + val elevation: Int, + val movementType: Int, + val movementRangeX: Int, + val movementRangeY: Int, + val trainerType: Int, + val facing: Int, + val script: String = "0x0", +) diff --git a/maps/src/main/kotlin/de/fiereu/openmmo/maps/WarpTile.kt b/maps/src/main/kotlin/de/fiereu/openmmo/maps/WarpTile.kt new file mode 100644 index 0000000..0204ad1 --- /dev/null +++ b/maps/src/main/kotlin/de/fiereu/openmmo/maps/WarpTile.kt @@ -0,0 +1,16 @@ +package de.fiereu.openmmo.maps + +import de.fiereu.openmmo.common.enums.Direction + +data class WarpTile( + val x: Int, + val y: Int, + val elevation: Int = 0, + val targetRegionId: Byte, + val targetBankId: Byte, + val targetMapId: Byte, + val targetX: Int, + val targetY: Int, + val targetElevation: Int = 0, + val facingDirection: Direction? = null, +) diff --git a/maps/src/main/kotlin/de/fiereu/openmmo/maps/WildEncounters.kt b/maps/src/main/kotlin/de/fiereu/openmmo/maps/WildEncounters.kt new file mode 100644 index 0000000..1c36608 --- /dev/null +++ b/maps/src/main/kotlin/de/fiereu/openmmo/maps/WildEncounters.kt @@ -0,0 +1,5 @@ +package de.fiereu.openmmo.maps + +data class WildEncounterTable(val encounterRate: Int, val pokemon: List) + +data class WildPokemon(val dexId: Int, val minLevel: Int, val maxLevel: Int, val weight: Int) diff --git a/protocol/build.gradle.kts b/network/build.gradle.kts similarity index 52% rename from protocol/build.gradle.kts rename to network/build.gradle.kts index 47d4685..2e5b43a 100644 --- a/protocol/build.gradle.kts +++ b/network/build.gradle.kts @@ -1,16 +1,15 @@ plugins { id("buildsrc.convention.kotlin-jvm") id("buildsrc.convention.spotless") + id("buildsrc.convention.sonarlint") } dependencies { - api(libs.kotlinx.serialization.core) + api(project(":bytecodec")) api(libs.netty) - api(libs.ineter) - - implementation(libs.slf4j) + api(libs.kotlinx.coroutines) implementation(libs.kotlin.logging) - implementation(libs.kotlin.reflect) - testImplementation(libs.bundles.kotest) + testImplementation(libs.kotlinx.coroutines.test) + testRuntimeOnly(libs.logback) } diff --git a/network/src/main/kotlin/de/fiereu/network/Bootstrap.kt b/network/src/main/kotlin/de/fiereu/network/Bootstrap.kt new file mode 100644 index 0000000..b6b32e9 --- /dev/null +++ b/network/src/main/kotlin/de/fiereu/network/Bootstrap.kt @@ -0,0 +1,48 @@ +package de.fiereu.network + +import io.netty.bootstrap.Bootstrap +import io.netty.bootstrap.ServerBootstrap +import io.netty.channel.Channel +import io.netty.channel.ChannelInitializer + +fun ServerBootstrap.installNetwork( + identity: SessionIdentity.ServerRoot, + applicationProtocol: Protocol, + applicationHandlerFactory: () -> ProtocolHandler, + options: PipelineOptions = PipelineOptions(), +): ServerBootstrap = + childHandler( + object : ChannelInitializer() { + override fun initChannel(ch: Channel) { + installPipeline( + pipeline = ch.pipeline(), + side = Side.SERVER, + identity = identity, + applicationProtocol = applicationProtocol, + applicationHandlerFactory = applicationHandlerFactory, + options = options, + ) + } + }, + ) + +fun Bootstrap.installNetwork( + identity: SessionIdentity.ClientTrust, + applicationProtocol: Protocol, + applicationHandlerFactory: () -> ProtocolHandler, + options: PipelineOptions = PipelineOptions(), +): Bootstrap = + handler( + object : ChannelInitializer() { + override fun initChannel(ch: Channel) { + installPipeline( + pipeline = ch.pipeline(), + side = Side.CLIENT, + identity = identity, + applicationProtocol = applicationProtocol, + applicationHandlerFactory = applicationHandlerFactory, + options = options, + ) + } + }, + ) diff --git a/network/src/main/kotlin/de/fiereu/network/Direction.kt b/network/src/main/kotlin/de/fiereu/network/Direction.kt new file mode 100644 index 0000000..ebff025 --- /dev/null +++ b/network/src/main/kotlin/de/fiereu/network/Direction.kt @@ -0,0 +1,14 @@ +package de.fiereu.network + +enum class Direction { + C2S, + S2C; + + fun isIncomingFor(side: Side): Boolean = + when (this) { + C2S -> side == Side.SERVER + S2C -> side == Side.CLIENT + } + + fun isOutgoingFor(side: Side): Boolean = !isIncomingFor(side) +} diff --git a/network/src/main/kotlin/de/fiereu/network/Exceptions.kt b/network/src/main/kotlin/de/fiereu/network/Exceptions.kt new file mode 100644 index 0000000..72aed51 --- /dev/null +++ b/network/src/main/kotlin/de/fiereu/network/Exceptions.kt @@ -0,0 +1,31 @@ +package de.fiereu.network + +import kotlin.reflect.KClass + +open class NetworkException(message: String, cause: Throwable? = null) : + RuntimeException(message, cause) + +class UnknownOpcodeException(val opcode: UByte, val side: Side) : + NetworkException("No incoming codec for opcode 0x${opcode.toString(16)} on $side") + +class UnknownPacketTypeException(val type: KClass<*>, val side: Side) : + NetworkException("No outgoing registration for ${type.simpleName} on $side") + +class ChecksumMismatchException : NetworkException("Checksum verification failed") + +class TrailingBytesException(val opcode: UByte, val remaining: Int) : + NetworkException( + "Codec for opcode 0x${opcode.toString(16)} did not consume $remaining trailing byte(s)") + +class EmptyFrameException : NetworkException("Received empty frame") + +open class HandshakeException(message: String, cause: Throwable? = null) : + NetworkException(message, cause) + +class StaleClientHelloException(val skewSeconds: Long) : + HandshakeException("ClientHello timestamp drift: ${skewSeconds}s") + +class InvalidServerSignatureException : + HandshakeException("ServerHello signature does not match trusted root key") + +class HandlerRegistrationException(message: String) : NetworkException(message) diff --git a/network/src/main/kotlin/de/fiereu/network/NettyBuffers.kt b/network/src/main/kotlin/de/fiereu/network/NettyBuffers.kt new file mode 100644 index 0000000..1cb2e8f --- /dev/null +++ b/network/src/main/kotlin/de/fiereu/network/NettyBuffers.kt @@ -0,0 +1,29 @@ +package de.fiereu.network + +import de.fiereu.bytecodec.ReadBuffer +import de.fiereu.bytecodec.WriteBuffer +import io.netty.buffer.ByteBuf + +class NettyReadBuffer(private val buf: ByteBuf) : ReadBuffer { + override fun readByte(): Byte = buf.readByte() + + override fun readBytes(dst: ByteArray, offset: Int, length: Int) { + buf.readBytes(dst, offset, length) + } + + override fun skip(n: Int) { + buf.skipBytes(n) + } + + override fun remaining(): Int = buf.readableBytes() +} + +class NettyWriteBuffer(private val buf: ByteBuf) : WriteBuffer { + override fun writeByte(value: Byte) { + buf.writeByte(value.toInt()) + } + + override fun writeBytes(src: ByteArray, offset: Int, length: Int) { + buf.writeBytes(src, offset, length) + } +} diff --git a/network/src/main/kotlin/de/fiereu/network/PacketEvent.kt b/network/src/main/kotlin/de/fiereu/network/PacketEvent.kt new file mode 100644 index 0000000..23adf3a --- /dev/null +++ b/network/src/main/kotlin/de/fiereu/network/PacketEvent.kt @@ -0,0 +1,12 @@ +package de.fiereu.network + +import io.netty.channel.ChannelFuture + +data class PacketEvent( + val packet: T, + val session: SessionContext, +) + +fun PacketEvent<*>.respond(packet: Any): ChannelFuture = session.send(packet) + +fun PacketEvent<*>.disconnect(reason: () -> String = { "no reason" }) = session.close(reason) diff --git a/network/src/main/kotlin/de/fiereu/network/Pipeline.kt b/network/src/main/kotlin/de/fiereu/network/Pipeline.kt new file mode 100644 index 0000000..a82d1e8 --- /dev/null +++ b/network/src/main/kotlin/de/fiereu/network/Pipeline.kt @@ -0,0 +1,76 @@ +package de.fiereu.network + +import de.fiereu.network.checksum.NoOpChecksum +import de.fiereu.network.cipher.NoOpSessionCipher +import de.fiereu.network.handlers.ChecksumFrameDecoder +import de.fiereu.network.handlers.ChecksumFrameEncoder +import de.fiereu.network.handlers.CipherDecoder +import de.fiereu.network.handlers.CipherEncoder +import de.fiereu.network.handlers.PacketFrameDecoder +import de.fiereu.network.handlers.PacketFrameEncoder +import de.fiereu.network.handshake.ClientSessionHandshakeHandler +import de.fiereu.network.handshake.ServerSessionHandshakeHandler +import de.fiereu.network.internal.MutableSessionContext +import de.fiereu.network.internal.SESSION_KEY +import io.netty.channel.ChannelPipeline +import io.netty.handler.logging.LogLevel +import io.netty.handler.logging.LoggingHandler +import io.netty.handler.timeout.WriteTimeoutHandler +import java.util.concurrent.TimeUnit + +fun installPipeline( + pipeline: ChannelPipeline, + side: Side, + identity: SessionIdentity, + applicationProtocol: Protocol, + applicationHandlerFactory: () -> ProtocolHandler, + options: PipelineOptions = PipelineOptions(), +) { + val channel = pipeline.channel() + val session = MutableSessionContext(side, channel, applicationProtocol) + channel.attr(SESSION_KEY).set(session) + + val handshakeHandler: ProtocolHandler = + when (side) { + Side.SERVER -> { + require(identity is SessionIdentity.ServerRoot) { + "Server side requires SessionIdentity.ServerRoot" + } + ServerSessionHandshakeHandler( + rootPrivate = identity.rootPrivate, + applicationProtocol = applicationProtocol, + applicationHandlerFactory = applicationHandlerFactory, + options = options, + ) + } + Side.CLIENT -> { + require(identity is SessionIdentity.ClientTrust) { + "Client side requires SessionIdentity.ClientTrust" + } + ClientSessionHandshakeHandler( + rootPublic = identity.rootPublic, + applicationProtocol = applicationProtocol, + applicationHandlerFactory = applicationHandlerFactory, + options = options, + ) + } + } + + pipeline.addLast( + PipelineNames.WRITE_TIMEOUT, + WriteTimeoutHandler(options.writeTimeout.inWholeSeconds, TimeUnit.SECONDS), + ) + if (options.frameLogging) { + pipeline.addLast(PipelineNames.FRAME_LOGGER, LoggingHandler(LogLevel.TRACE)) + } + pipeline.addLast(PipelineNames.FRAME_DECODER, PacketFrameDecoder(options.maxFrameLength)) + pipeline.addLast(PipelineNames.FRAME_ENCODER, PacketFrameEncoder()) + pipeline.addLast(PipelineNames.CHECKSUM_DECODER, ChecksumFrameDecoder(NoOpChecksum)) + pipeline.addLast(PipelineNames.CHECKSUM_ENCODER, ChecksumFrameEncoder(NoOpChecksum)) + pipeline.addLast(PipelineNames.CIPHER_DECODER, CipherDecoder(NoOpSessionCipher)) + pipeline.addLast(PipelineNames.CIPHER_ENCODER, CipherEncoder(NoOpSessionCipher)) + if (options.frameLogging) { + pipeline.addLast(PipelineNames.PROTOCOL_LOGGER, LoggingHandler(LogLevel.TRACE)) + } + pipeline.addLast(PipelineNames.PROTOCOL_HANDLER, handshakeHandler) +} diff --git a/network/src/main/kotlin/de/fiereu/network/PipelineNames.kt b/network/src/main/kotlin/de/fiereu/network/PipelineNames.kt new file mode 100644 index 0000000..d189e47 --- /dev/null +++ b/network/src/main/kotlin/de/fiereu/network/PipelineNames.kt @@ -0,0 +1,16 @@ +package de.fiereu.network + +object PipelineNames { + const val WRITE_TIMEOUT = "write-timeout" + const val FRAME_LOGGER = "frame-logger" + const val FRAME_DECODER = "frame-decoder" + const val FRAME_ENCODER = "frame-encoder" + const val CHECKSUM_DECODER = "checksum-decoder" + const val CHECKSUM_ENCODER = "checksum-encoder" + const val CIPHER_DECODER = "cipher-decoder" + const val CIPHER_ENCODER = "cipher-encoder" + const val COMPRESSION_DECODER = "compression-decoder" + const val COMPRESSION_ENCODER = "compression-encoder" + const val PROTOCOL_LOGGER = "protocol-logger" + const val PROTOCOL_HANDLER = "protocol-handler" +} diff --git a/network/src/main/kotlin/de/fiereu/network/PipelineOptions.kt b/network/src/main/kotlin/de/fiereu/network/PipelineOptions.kt new file mode 100644 index 0000000..3265770 --- /dev/null +++ b/network/src/main/kotlin/de/fiereu/network/PipelineOptions.kt @@ -0,0 +1,14 @@ +package de.fiereu.network + +import kotlin.time.Duration +import kotlin.time.Duration.Companion.minutes +import kotlin.time.Duration.Companion.seconds + +data class PipelineOptions( + val checksumSize: Int = 16, + val writeTimeout: Duration = 25.minutes, + val maxFrameLength: Int = 0xFFFF, + val compressionThreshold: Int = 256, + val maxHelloSkew: Duration = 10.seconds, + val frameLogging: Boolean = false, +) diff --git a/network/src/main/kotlin/de/fiereu/network/Protocol.kt b/network/src/main/kotlin/de/fiereu/network/Protocol.kt new file mode 100644 index 0000000..f3992ff --- /dev/null +++ b/network/src/main/kotlin/de/fiereu/network/Protocol.kt @@ -0,0 +1,73 @@ +package de.fiereu.network + +import de.fiereu.bytecodec.Codec +import kotlin.reflect.KClass + +abstract class Protocol { + + open val compressed: Boolean = false + + data class Registration( + val opcode: UByte, + val direction: Direction, + val codec: Codec, + val type: KClass, + ) + + private val mutableRegistrations = mutableListOf>() + private val byOpcode = mutableMapOf, Registration<*>>() + private val byType = mutableMapOf, Direction>, Registration<*>>() + + val registrations: List> + get() = mutableRegistrations + + fun c2s(opcode: UByte, codec: Codec, type: KClass) { + register(Registration(opcode, Direction.C2S, codec, type)) + } + + fun s2c(opcode: UByte, codec: Codec, type: KClass) { + register(Registration(opcode, Direction.S2C, codec, type)) + } + + fun bidi(opcode: UByte, codec: Codec, type: KClass) { + register(Registration(opcode, Direction.C2S, codec, type)) + register(Registration(opcode, Direction.S2C, codec, type)) + } + + private fun register(reg: Registration<*>) { + val opKey = reg.opcode to reg.direction + check(byOpcode.put(opKey, reg) == null) { + "Duplicate registration for opcode 0x${reg.opcode.toString(16)} ${reg.direction}" + } + val typeKey = reg.type to reg.direction + check(byType.put(typeKey, reg) == null) { + "Duplicate registration for ${reg.type.simpleName} ${reg.direction}" + } + mutableRegistrations += reg + } + + fun incomingCodec(side: Side, opcode: UByte): Codec<*>? = + incomingRegistration(side, opcode)?.codec + + fun incomingRegistration(side: Side, opcode: UByte): Registration<*>? { + val direction = if (side == Side.SERVER) Direction.C2S else Direction.S2C + return byOpcode[opcode to direction] + } + + fun outgoingRegistration(side: Side, type: KClass<*>): Registration<*>? { + val direction = if (side == Side.SERVER) Direction.S2C else Direction.C2S + return byType[type to direction] + } +} + +inline fun Protocol.c2s(opcode: UByte, codec: Codec) { + c2s(opcode, codec, T::class) +} + +inline fun Protocol.s2c(opcode: UByte, codec: Codec) { + s2c(opcode, codec, T::class) +} + +inline fun Protocol.bidi(opcode: UByte, codec: Codec) { + bidi(opcode, codec, T::class) +} diff --git a/network/src/main/kotlin/de/fiereu/network/ProtocolHandler.kt b/network/src/main/kotlin/de/fiereu/network/ProtocolHandler.kt new file mode 100644 index 0000000..73fab1f --- /dev/null +++ b/network/src/main/kotlin/de/fiereu/network/ProtocolHandler.kt @@ -0,0 +1,132 @@ +package de.fiereu.network + +import de.fiereu.bytecodec.Codec +import de.fiereu.network.internal.OutgoingPacket +import de.fiereu.network.internal.SESSION_KEY +import io.github.oshai.kotlinlogging.KotlinLogging +import io.netty.buffer.ByteBuf +import io.netty.channel.ChannelDuplexHandler +import io.netty.channel.ChannelHandlerContext +import io.netty.channel.ChannelPromise + +private val log = KotlinLogging.logger {} + +abstract class ProtocolHandler( + val protocol: Protocol, + val side: Side, +) : ChannelDuplexHandler() { + + protected lateinit var session: SessionContext + private set + + override fun handlerAdded(ctx: ChannelHandlerContext) { + val attached = + ctx.channel().attr(SESSION_KEY).get() + ?: error("No SessionContext attached to channel ${ctx.channel()}") + session = attached + } + + override fun channelActive(ctx: ChannelHandlerContext) { + try { + onActive() + } catch (t: Throwable) { + onErrorInternal(ctx, t) + return + } + ctx.fireChannelActive() + } + + override fun channelInactive(ctx: ChannelHandlerContext) { + try { + onInactive() + } finally { + ctx.fireChannelInactive() + } + } + + override fun channelRead(ctx: ChannelHandlerContext, msg: Any) { + if (msg !is ByteBuf) { + ctx.fireChannelRead(msg) + return + } + try { + if (msg.readableBytes() < 1) throw EmptyFrameException() + val opcode = (msg.readByte().toInt() and 0xFF).toUByte() + val registration = protocol.incomingRegistration(side, opcode) + if (registration == null) { + log.error { "No incoming codec for opcode 0x${opcode.toString(16)} on $side" } + return + } + val packet = decode(registration.codec, msg) + val trailing = msg.readableBytes() + if (trailing > 0) throw TrailingBytesException(opcode, trailing) + try { + onPacket(PacketEvent(packet, session)) + } catch (t: Throwable) { + onErrorInternal(ctx, t) + } + } catch (t: Throwable) { + onErrorInternal(ctx, t) + } finally { + msg.release() + } + } + + override fun write(ctx: ChannelHandlerContext, msg: Any, promise: ChannelPromise) { + val (registration, value) = + when (msg) { + is OutgoingPacket -> msg.registration to msg.value + is ByteBuf -> { + ctx.write(msg, promise) + return + } + else -> { + val reg = + protocol.outgoingRegistration(side, msg::class) + ?: throw UnknownPacketTypeException(msg::class, side) + reg to msg + } + } + val buffer = ctx.alloc().buffer() + var success = false + try { + buffer.writeByte(registration.opcode.toInt()) + encode(registration.codec, value, buffer) + success = true + } finally { + if (!success) buffer.release() + } + ctx.write(buffer, promise) + } + + override fun exceptionCaught(ctx: ChannelHandlerContext, cause: Throwable) { + onErrorInternal(ctx, cause) + } + + private fun onErrorInternal(ctx: ChannelHandlerContext, cause: Throwable) { + try { + onError(cause) + } catch (t: Throwable) { + log.error(t) { "onError handler threw; closing channel" } + ctx.close() + } + } + + open fun onActive() {} + + abstract fun onPacket(event: PacketEvent<*>) + + open fun onInactive() {} + + open fun onError(cause: Throwable) { + log.warn(cause) { "Handler error on ${session.remoteAddress}" } + session.close { "Handler error: ${cause.message}" } + } + + private fun decode(codec: Codec, buf: ByteBuf): T = codec.read(NettyReadBuffer(buf)) + + @Suppress("UNCHECKED_CAST") + private fun encode(codec: Codec<*>, value: Any, buf: ByteBuf) { + (codec as Codec).write(NettyWriteBuffer(buf), value) + } +} diff --git a/network/src/main/kotlin/de/fiereu/network/SessionAttribute.kt b/network/src/main/kotlin/de/fiereu/network/SessionAttribute.kt new file mode 100644 index 0000000..43878a4 --- /dev/null +++ b/network/src/main/kotlin/de/fiereu/network/SessionAttribute.kt @@ -0,0 +1,24 @@ +package de.fiereu.network + +import kotlin.reflect.KClass + +class SessionAttribute(val name: String, val type: KClass) { + override fun toString(): String = "SessionAttribute($name)" + + companion object { + inline fun of(name: String): SessionAttribute = + SessionAttribute(name, T::class) + } +} + +interface SessionAttributes { + operator fun get(key: SessionAttribute): T? + + operator fun set(key: SessionAttribute, value: T) + + fun remove(key: SessionAttribute): T? + + fun getOrPut(key: SessionAttribute, default: () -> T): T + + fun contains(key: SessionAttribute<*>): Boolean +} diff --git a/network/src/main/kotlin/de/fiereu/network/SessionContext.kt b/network/src/main/kotlin/de/fiereu/network/SessionContext.kt new file mode 100644 index 0000000..043e58d --- /dev/null +++ b/network/src/main/kotlin/de/fiereu/network/SessionContext.kt @@ -0,0 +1,26 @@ +package de.fiereu.network + +import io.netty.channel.Channel +import io.netty.channel.ChannelFuture +import java.net.SocketAddress +import java.time.Instant + +interface SessionContext { + val side: Side + + val channel: Channel + + val remoteAddress: SocketAddress + + val phase: SessionPhase + + val handshakeCompletedAt: Instant? + + val attributes: SessionAttributes + + fun send(packet: Any): ChannelFuture + + fun close(reason: () -> String = { "no reason" }) + + fun onPhase(phase: SessionPhase, listener: () -> Unit) +} diff --git a/network/src/main/kotlin/de/fiereu/network/SessionIdentity.kt b/network/src/main/kotlin/de/fiereu/network/SessionIdentity.kt new file mode 100644 index 0000000..70e0553 --- /dev/null +++ b/network/src/main/kotlin/de/fiereu/network/SessionIdentity.kt @@ -0,0 +1,10 @@ +package de.fiereu.network + +import java.security.interfaces.ECPrivateKey +import java.security.interfaces.ECPublicKey + +sealed interface SessionIdentity { + data class ServerRoot(val rootPrivate: ECPrivateKey) : SessionIdentity + + data class ClientTrust(val rootPublic: ECPublicKey) : SessionIdentity +} diff --git a/network/src/main/kotlin/de/fiereu/network/SessionPhase.kt b/network/src/main/kotlin/de/fiereu/network/SessionPhase.kt new file mode 100644 index 0000000..72378d1 --- /dev/null +++ b/network/src/main/kotlin/de/fiereu/network/SessionPhase.kt @@ -0,0 +1,7 @@ +package de.fiereu.network + +enum class SessionPhase { + HANDSHAKE, + ESTABLISHED, + CLOSED, +} diff --git a/network/src/main/kotlin/de/fiereu/network/Sessions.kt b/network/src/main/kotlin/de/fiereu/network/Sessions.kt new file mode 100644 index 0000000..a789a52 --- /dev/null +++ b/network/src/main/kotlin/de/fiereu/network/Sessions.kt @@ -0,0 +1,7 @@ +package de.fiereu.network + +import de.fiereu.network.internal.SESSION_KEY +import io.netty.channel.Channel + +/** Look up the [SessionContext] attached by [installPipeline] for this channel. */ +fun Channel.session(): SessionContext? = attr(SESSION_KEY).get() diff --git a/network/src/main/kotlin/de/fiereu/network/Side.kt b/network/src/main/kotlin/de/fiereu/network/Side.kt new file mode 100644 index 0000000..8fd3753 --- /dev/null +++ b/network/src/main/kotlin/de/fiereu/network/Side.kt @@ -0,0 +1,6 @@ +package de.fiereu.network + +enum class Side { + SERVER, + CLIENT, +} diff --git a/network/src/main/kotlin/de/fiereu/network/TypedProtocolHandler.kt b/network/src/main/kotlin/de/fiereu/network/TypedProtocolHandler.kt new file mode 100644 index 0000000..1378642 --- /dev/null +++ b/network/src/main/kotlin/de/fiereu/network/TypedProtocolHandler.kt @@ -0,0 +1,54 @@ +package de.fiereu.network + +import io.github.oshai.kotlinlogging.KotlinLogging +import kotlin.reflect.KClass + +private val log = KotlinLogging.logger {} + +abstract class TypedProtocolHandler