Skip to content

Support dbtables and rows #926

@GregHib

Description

@GregHib

Rs3 and OSRS have the concept of dbtables and dbrows which are used to store misc data in a structured way. Essentially a cleaner more scalable way of doing custom definitions but also not in a forced way like enums which I've been migrating too recently #842

*.tables.toml

Flattened

Pros: supports lots of different ways with multiple fields
Cons: Bit verbose when writing multiple columns?

# Table header
[table_name]
types = ["int", "string", "int_array", "int/string", "array<int/string>"]
names = ["field", "another", "array", "test", "list"]
default = [0, null, [], [], null]

[.column]
field = 1
another = "row"
array = [1, 2, 3]
pair = [4, "four"]
list = [[5, "five"]]

Example:

[enchanting]
types = ["int", "int", "item", "item/item", "item/item", "item/item"]
names = ["level", "xp", "ring", "necklace", "bracelet", "amulet"]

[.sapphire]
level = 7
xp = 175
ring = ["sapphire_ring", "ring_of_recoil"]
necklace = ["sapphire_necklace", "games_necklace_8"]
bracelet = ["sapphire_bracelet", "bracelet_of_clay"]
amulet = ["sapphire_amulet", "amulet_of_magic"]

Vertical

# Table header
[table_name]
field = ["int", 0]
another = "string"
array = ["int_array", []]
test = ["int/string", []]
list = ["list<int/string>"]
list = ["list<pair<int, string>>"]
# Table header
[table_name]
row_id = "Int" # The row identifier
field = "Int"
field_default = 0
another = "String"
array = "List<Int>"
array_default = []
test = "Pair<Int, String>"
list = "List<Pair<Int, String>>"

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions