RuneHive-Game
Loading...
Searching...
No Matches
OldToNew.kt
Go to the documentation of this file.
1package org.jire.runehiveps
2
3import it.unimi.dsi.fastutil.ints.Int2IntMap
4import it.unimi.dsi.fastutil.ints.Int2IntOpenHashMap
5import java.io.File
6
7/**
8 * @author Jire
9 */
10object OldToNew {
11
12 private lateinit var map: Int2IntMap
13
14 @JvmStatic
15 fun load() {
16 val lines = File("data/def/npc/oldtonew.txt").readLines()
17 map = Int2IntOpenHashMap(lines.size)
18 lines.forEach {
19 if (it.indexOf('=') != -1) {
20 val split = it.split('=')
21 val old = split[0].toInt()
22 val new = split[1].toInt()
23 map.put(old, new)
24 }
25 }
26 }
27 //315=308
28 @JvmStatic
29 operator fun get(oldId: Int) = map.getOrDefault(oldId, -1)
30
31}