Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package world.gregs.voidps.cache.definition.data

import world.gregs.voidps.cache.Definition
import world.gregs.voidps.cache.definition.Extra
import world.gregs.voidps.type.random

data class EnumDefinition(
override var id: Int = -1,
Expand All @@ -17,11 +18,15 @@ data class EnumDefinition(
Extra {
fun getKey(value: Any) = map?.filterValues { it == value }?.keys?.lastOrNull() ?: -1

fun getInt(id: Int) = map?.get(id) as? Int ?: defaultInt
fun int(id: Int) = map?.get(id) as? Int ?: defaultInt

fun randomInt() = map?.values?.random() as? Int ?: defaultInt
fun randomInt() = map?.values?.random(random) as? Int ?: defaultInt

fun getString(id: Int) = map?.get(id) as? String ?: defaultString
fun string(id: Int) = map?.get(id) as? String ?: defaultString

override fun toString(): String {
return "EnumDefinition(id=$id, keyType=${EnumTypes.name(keyType)}, valueType=${EnumTypes.name(valueType)}, defaultString=$defaultString, defaultInt=$defaultInt, length=$length, map=$map, stringId=$stringId, extras=$extras)"
}

companion object {
val EMPTY = EnumDefinition()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
package world.gregs.voidps.cache.definition.data

object EnumTypes {
const val STRING = 's'
const val INT = 'i'
const val STRUCT = 'J'
const val JINGLE = 'j'
const val ITEM = 'o'
const val ITEM_2 = 'O'
const val SPRITE = 'd'
const val MODEL = 'm'
const val ID_KIT = 'K'
const val COMPONENT = 'I'
const val MAP_AREA = '`'
const val SKILL = 'S'
const val TILE = 'C'
const val CHAT_TYPE = 'c'
const val ANIM = 'A'
const val NPC = 'n'
const val ENUM = 'g'
const val INV = 'v'

fun name(char: Char) = when (char) {
STRING -> "string"
INT -> "int"
STRUCT -> "struct"
JINGLE -> "jingle"
ITEM -> "item"
ITEM_2 -> "item"
SPRITE -> "sprite"
MODEL -> "model"
ID_KIT -> "idkit"
COMPONENT -> "interface"
MAP_AREA -> "map_area"
SKILL -> "skill"
TILE -> "tile"
CHAT_TYPE -> "chat type"
ANIM -> "anim"
NPC -> "npc"
ENUM -> "enum"
INV -> "inv"
else -> "null"
}

fun char(name: String) = when (name) {
"string" -> STRING
"int" -> INT
"struct" -> STRUCT
"jingle" -> JINGLE
"item" -> ITEM
"sprite" -> SPRITE
"model" -> MODEL
"id_kit" -> ID_KIT
"interface" -> COMPONENT
"map_area" -> MAP_AREA
"skill" -> SKILL
"tile" -> TILE
"chat_type" -> CHAT_TYPE
"anim" -> ANIM
"npc" -> NPC
"enum" -> ENUM
"inv" -> INV
else -> null
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ data class FontDefinition(
var wordStart = 0
var tagStart = -1
var lastChar = -1
var colour: String? = null
for (index in input.indices) {
var current: Int = charToByte(input[index]) and 0xff
var extraWidth = 0
Expand Down Expand Up @@ -194,7 +195,12 @@ data class FontDefinition(
"euro" -> addKernelWidth(8364)
"copy" -> addKernelWidth(169)
"reg" -> addKernelWidth(174)
else -> {
"blue", "orange", "green", "red", "red_orange", "yellow", "lime", "gold", "white",
"black", "navy", "maroon", "purple", "brown", "violet", "dark_green", "dark_red",
-> colour = tag
else -> if (tag.startsWith("col=")) {
colour = tag
} else {
totalWidth += spriteWidth(tag, icons) ?: continue
lastChar = -1
}
Expand All @@ -215,13 +221,21 @@ data class FontDefinition(
}
if (totalWidth > widths[if (widths.size > output.size) output.size else widths.size - 1]) {
if (lineLength >= 0) {
output.add(input.substring(lineStart, lineLength + 1 - wordStart))
if (colour != null && output.isNotEmpty()) {
output.add("<${colour}>${input.substring(lineStart, lineLength + 1 - wordStart)}")
} else {
output.add(input.substring(lineStart, lineLength + 1 - wordStart))
}
lineStart = lineLength + 1
lastChar = -1
lineLength = -1
totalWidth -= wordWidth
} else {
output.add(input.substring(lineStart, currentWidth))
if (colour != null && output.isNotEmpty()) {
output.add("<${colour}>${input.substring(lineStart, currentWidth)}")
} else {
output.add(input.substring(lineStart, currentWidth))
}
lineStart = currentWidth
lastChar = -1
lineLength = -1
Expand All @@ -235,7 +249,11 @@ data class FontDefinition(
}
}
if (lineStart < input.length) {
output.add(input.substring(lineStart))
if (colour != null && output.isNotEmpty()) {
output.add("<${colour}>${input.substring(lineStart)}")
} else {
output.add(input.substring(lineStart))
}
}
return output
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ data class QuickChatPhraseDefinition(
else -> 0
}
val string = when (type) {
QuickChatType.MultipleChoice -> enums[ids[index].first()].getString(key)
QuickChatType.MultipleChoice -> enums[ids[index].first()].string(key)
QuickChatType.AllItems, QuickChatType.TradeItems -> items[key].name
QuickChatType.SlayerAssignment -> {
enums[ids[index].first()].getString(key)
enums[ids[index].first()].string(key)
}
QuickChatType.ClanRank, QuickChatType.SkillExperience -> enums[ids[index].first()].getString(key)
QuickChatType.ClanRank, QuickChatType.SkillExperience -> enums[ids[index].first()].string(key)
else -> key.toString()
}
append(string)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import world.gregs.voidps.cache.definition.Parameters
import world.gregs.voidps.cache.definition.data.NPCDefinition

class NPCDecoder(
val member: Boolean,
val member: Boolean = true,
private val parameters: Parameters = Parameters.EMPTY,
) : DefinitionDecoder<NPCDefinition>(NPCS) {

Expand Down
16 changes: 14 additions & 2 deletions data/area/asgarnia/port_sarim/port_sarim.areas.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,19 @@ x = [3008, 3064]
y = [3171, 3263]

[greater_port_sarim]
x = [2962,2962,2909,2909,3071,3071]
y = [3136,3187,3187,3263,3263,3136]
x = [2962, 2962, 2909, 2909, 3071, 3071]
y = [3136, 3187, 3187, 3263, 3263, 3136]
tags = ["penguin_area"]
hint = "near Port Sarim."

[gerrants_fish_shop]
x = [3011, 3017]
y = [3223, 3229]

[brians_battleaxe_shop]
x = [3023, 3030]
y = [3245, 3253]

[betties_magic_shop]
x = [3011, 3016]
y = [3256, 3261]
136 changes: 136 additions & 0 deletions data/area/asgarnia/port_sarim/port_sarim.nav-edges.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
edges = [
{ from = { x = 3071, y = 3266 }, to = { x = 3071, y = 3276 } },
{ from = { x = 3071, y = 3276 }, to = { x = 3069, y = 3276 } },
{ from = { x = 3069, y = 3276 }, to = { x = 3066, y = 3269 } },
{ from = { x = 3066, y = 3269 }, to = { x = 3063, y = 3260 } },
{ from = { x = 3066, y = 3269 }, to = { x = 3057, y = 3265 } },
{ from = { x = 3057, y = 3265 }, to = { x = 3051, y = 3265 } },
{ from = { x = 3063, y = 3260 }, to = { x = 3060, y = 3254 } },
{ from = { x = 3063, y = 3260 }, to = { x = 3053, y = 3261 } },
{ from = { x = 3060, y = 3254 }, to = { x = 3053, y = 3247 } },
{ from = { x = 3053, y = 3247 }, to = { x = 3042, y = 3247 } },
{ from = { x = 3053, y = 3261 }, to = { x = 3051, y = 3265 } },
{ from = { x = 3051, y = 3265 }, to = { x = 3041, y = 3263 } },
{ from = { x = 3041, y = 3263 }, to = { x = 3036, y = 3255 } },
{ from = { x = 3041, y = 3263 }, to = { x = 3032, y = 3265 } },
{ from = { x = 3032, y = 3265 }, to = { x = 3027, y = 3268 } },
{ from = { x = 3027, y = 3268 }, to = { x = 3019, y = 3263 } },
{ from = { x = 3027, y = 3268 }, to = { x = 3038, y = 3276 } },
{ from = { x = 3038, y = 3276 }, to = { x = 3055, y = 3276 } },
{ from = { x = 3055, y = 3276 }, to = { x = 3069, y = 3276 } },
{ from = { x = 3055, y = 3276 }, to = { x = 3057, y = 3265 } },
{ from = { x = 3069, y = 3276 }, to = { x = 3071, y = 3276 } },
{ from = { x = 3019, y = 3263 }, to = { x = 3019, y = 3258 } },
{ from = { x = 3053, y = 3261 }, to = { x = 3057, y = 3265 } },
{ from = { x = 3042, y = 3247 }, to = { x = 3035, y = 3248 } },
{ from = { x = 3042, y = 3247 }, to = { x = 3036, y = 3255 } },
{ from = { x = 3036, y = 3255 }, to = { x = 3026, y = 3256 } },
{ from = { x = 3026, y = 3256 }, to = { x = 3019, y = 3258 } },
{ from = { x = 3019, y = 3258 }, to = { x = 3017, y = 3258 } },
{ from = { x = 3017, y = 3258 }, to = { x = 3016, y = 3258 },
actions = [
{ object = {
option = "Open",
id = "door_668_closed",
x = 3017,
y = 3259,
success = { object = { id = "door_668_opened", x = 3016, y = 3259 } }
} },
{ tile = { x = 3016, y = 3258, radius = 1 } }
]
},
{ from = { x = 3016, y = 3258 }, to = { x = 3017, y = 3258 },
actions = [
{ object = {
option = "Open",
id = "door_668_closed",
x = 3017,
y = 3259,
success = { object = { id = "door_668_opened", x = 3016, y = 3259 } }
} },
{ tile = { x = 3017, y = 3258, radius = 1 } }
]
},
{ from = { x = 3019, y = 3258 }, to = { x = 3019, y = 3247 } },
{ from = { x = 3035, y = 3248 }, to = { x = 3031, y = 3248 } },
{ from = { x = 3035, y = 3248 }, to = { x = 3026, y = 3242 } },
{ from = { x = 3031, y = 3248 }, to = { x = 3026, y = 3242 } },
{ from = { x = 3031, y = 3248 }, to = { x = 3030, y = 3248 },
actions = [
{ object = {
option = "Open",
id = "door_668_closed",
x = 3031,
y = 3248,
success = { object = { id = "door_668_opened", x = 3030, y = 3248 } }
} },
{ tile = { x = 3030, y = 3248, radius = 1 } }
]
},
{ from = { x = 3030, y = 3248 }, to = { x = 3031, y = 3248 },
actions = [
{ object = {
option = "Open",
id = "door_668_closed",
x = 3031,
y = 3248,
success = { object = { id = "door_668_opened", x = 3030, y = 3248 } }
} },
{ tile = { x = 3031, y = 3248, radius = 1 } }
]
},
{ from = { x = 3030, y = 3248 }, to = { x = 3026, y = 3245 } },
{ from = { x = 3026, y = 3242 }, to = { x = 3026, y = 3244 } },
{ from = { x = 3026, y = 3242 }, to = { x = 3019, y = 3247 } },
{ from = { x = 3026, y = 3242 }, to = { x = 3021, y = 3237 } },
{ from = { x = 3026, y = 3244 }, to = { x = 3026, y = 3245 },
actions = [
{ object = {
option = "Open",
id = "door_668_closed",
x = 3026,
y = 3244,
success = { object = { id = "door_668_opened", x = 3026, y = 3245 } }
} },
{ tile = { x = 3026, y = 3245, radius = 1 } }
]
},
{ from = { x = 3026, y = 3245 }, to = { x = 3026, y = 3244 },
actions = [
{ object = {
option = "Open",
id = "door_668_closed",
x = 3026,
y = 3244,
success = { object = { id = "door_668_opened", x = 3026, y = 3245 } }
} },
{ tile = { x = 3026, y = 3244, radius = 1 } }
]
},
{ from = { x = 3019, y = 3247 }, to = { x = 3021, y = 3237 } },
{ from = { x = 3021, y = 3237 }, to = { x = 3019, y = 3224 } },
{ from = { x = 3019, y = 3224 }, to = { x = 3016, y = 3217 } },
{ from = { x = 3016, y = 3217 }, to = { x = 3013, y = 3219 } },
{ from = { x = 3013, y = 3219 }, to = { x = 3013, y = 3220 },
actions = [
{ object = {
option = "Open",
id = "door_668_closed",
x = 3013,
y = 3219,
success = { object = { id = "door_668_opened", x = 3013, y = 3220 } }
} },
{ tile = { x = 3013, y = 3220, radius = 1 } }
]
},
{ from = { x = 3013, y = 3220 }, to = { x = 3013, y = 3219 }, actions = [
{ object = {
option = "Open",
id = "door_668_closed",
x = 3013,
y = 3219,
success = { object = { id = "door_668_opened", x = 3013, y = 3220 } }
} },
{ tile = { x = 3013, y = 3219, radius = 1 } }
] },
]
4 changes: 2 additions & 2 deletions data/area/misthalin/draynor/draynor.areas.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ x = [3075, 3085]
y = [3265, 3274]

[draynor_bank]
x = [3088, 3097]
y = [3240, 3246]
x = [3092, 3095]
y = [3241, 3245]
tags = ["bank"]

[draynor_fishing_area]
Expand Down
19 changes: 0 additions & 19 deletions data/area/misthalin/draynor/draynor.npcs.toml
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,6 @@ attack_bonus = 9
respawn_delay = 50
examine = "He guards the Draynor Market stalls from thieves."

[bed_draynor]
id = 2254

[bank_guard_draynor]
id = 2574
examine = "He's guarding the bank."
Expand All @@ -168,9 +165,6 @@ id = 3299
pickpocket = { level = 38, stun_ticks = 8, stun_hit = 30, xp = 43.0, chance_min = 90, chance_max = 240, table = "master_farmer" }
examine = "A master at gardening."

[wise_old_man_2]
id = 3820

[fortunato]
id = 3671
shop = "fortunatos_fine_wine"
Expand Down Expand Up @@ -225,25 +219,12 @@ examine = "The hat's a dead giveaway."
[chicken_draynor_2]
id = 288

[wise_old_man_2_2]
id = 2253

[wise_old_man_2_3]
id = 11569

[ava_2]
id = 5198

[scout_draynor_2]
id = 5569

[thing_under_the_bed]
id = 2255
hitpoints = 250
def = 5
style = "melee"
max_hit_melee = 10

[fishing_spot_small_net_bait_draynor]
id = 327
fishing_net = { items = ["small_fishing_net"], bait = { none = ["raw_shrimps", "raw_anchovies"] } }
Expand Down
Loading