From f7250cfe670c0d56cbccd969c8ce0a73ea94158a Mon Sep 17 00:00:00 2001 From: Mark7625 <72366279+Mark7625@users.noreply.github.com> Date: Wed, 29 Oct 2025 02:15:29 +0000 Subject: [PATCH 1/4] , --- .../main/kotlin/org/alter/impl/TeleTabs.kt | 167 ++++++++++++++++++ data/cfg/rscm2/dbrows.rscm | 36 ++++ data/cfg/rscm2/enums.rscm | 1 + data/cfg/rscm2/tables.rscm | 2 + .../skills/prayer/teleport_tablet_data.toml | 48 +++++ 5 files changed, 254 insertions(+) create mode 100644 cache/src/main/kotlin/org/alter/impl/TeleTabs.kt create mode 100644 data/raw-cache/configs/server/skills/prayer/teleport_tablet_data.toml diff --git a/cache/src/main/kotlin/org/alter/impl/TeleTabs.kt b/cache/src/main/kotlin/org/alter/impl/TeleTabs.kt new file mode 100644 index 00000000..66fdf1b4 --- /dev/null +++ b/cache/src/main/kotlin/org/alter/impl/TeleTabs.kt @@ -0,0 +1,167 @@ +package org.alter.impl + +import dev.openrune.definition.dbtables.dbTable +import dev.openrune.definition.util.VarType + +object TeleTabs { + + fun teleTabs() = dbTable("tables.teleport_tablets") { + column("magic_level", 0, arrayOf(VarType.INT)) + column("location", 1, arrayOf(VarType.INT)) + + // Standard Teleport Tablets + row("dbrows.varrock_teleport_tablet") { + column(0, arrayOf(25)) + column(1, arrayOf(1)) + } + row("dbrows.lumbridge_teleport_tablet") { + column(0, arrayOf(31)) + column(1, arrayOf(1)) + } + row("dbrows.falador_teleport_tablet") { + column(0, arrayOf(37)) + column(1, arrayOf(1)) + } + row("dbrows.camelot_teleport_tablet") { + column(0, arrayOf(45)) + column(1, arrayOf(1)) + } + row("dbrows.kourend_castle_teleport_tablet") { + column(0, arrayOf(48)) + column(1, arrayOf(1)) + } + row("dbrows.ardougne_teleport_tablet") { + column(0, arrayOf(51)) + column(1, arrayOf(1)) + } + row("dbrows.civitas_illa_fortis_teleport_tablet") { + column(0, arrayOf(54)) + column(1, arrayOf(1)) + } + row("dbrows.watchtower_teleport_tablet") { + column(0, arrayOf(58)) + column(1, arrayOf(1)) + } + row("dbrows.teleport_to_house_tablet") { + column(0, arrayOf(40)) + column(1, arrayOf(1)) + } + + + // Arceuus Teleport Tablets + row("dbrows.arceuus_library_teleport_tablet") { + column(0, arrayOf(6)) + column(1, arrayOf(1)) + } + row("dbrows.draynor_manor_teleport_tablet") { + column(0, arrayOf(17)) + column(1, arrayOf(1)) + } + row("dbrows.battlefront_teleport_tablet") { + column(0, arrayOf(23)) + column(1, arrayOf(1)) + } + row("dbrows.mind_altar_teleport_tablet") { + column(0, arrayOf(28)) + column(1, arrayOf(1)) + } + row("dbrows.salve_graveyard_teleport_tablet") { + column(0, arrayOf(40)) + column(1, arrayOf(1)) + } + row("dbrows.fenkenstrains_castle_teleport_tablet") { + column(0, arrayOf(48)) + column(1, arrayOf(1)) + } + row("dbrows.west_ardougne_teleport_tablet") { + column(0, arrayOf(61)) + column(1, arrayOf(1)) + } + row("dbrows.harmony_island_teleport_tablet") { + column(0, arrayOf(65)) + column(1, arrayOf(1)) + } + row("dbrows.cemetery_teleport_tablet") { + column(0, arrayOf(71)) + column(1, arrayOf(1)) + } + row("dbrows.barrows_teleport_tablet") { + column(0, arrayOf(83)) + column(1, arrayOf(1)) + } + row("dbrows.ape_atoll_teleport_tablet") { + column(0, arrayOf(90)) + column(1, arrayOf(1)) + } + +// Ancient Magicks Teleport Tablets + row("dbrows.paddewwa_teleport_tablet") { + column(0, arrayOf(54)) + column(1, arrayOf(1)) + } + row("dbrows.senntisten_teleport_tablet") { + column(0, arrayOf(60)) + column(1, arrayOf(1)) + } + row("dbrows.kharyrll_teleport_tablet") { + column(0, arrayOf(66)) + column(1, arrayOf(1)) + } + row("dbrows.lassar_teleport_tablet") { + column(0, arrayOf(72)) + column(1, arrayOf(1)) + } + row("dbrows.dareeyak_teleport_tablet") { + column(0, arrayOf(78)) + column(1, arrayOf(1)) + } + row("dbrows.carrallanger_teleport_tablet") { + column(0, arrayOf(84)) + column(1, arrayOf(1)) + } + row("dbrows.annakarl_teleport_tablet") { + column(0, arrayOf(90)) + column(1, arrayOf(1)) + } + row("dbrows.ghorrock_teleport_tablet") { + column(0, arrayOf(96)) + column(1, arrayOf(1)) + } + + // Lunar Teleport Tablets + row("dbrows.moonclan_teleport_tablet") { + column(0, arrayOf(69)) + column(1, arrayOf(1)) + } + row("dbrows.ourania_teleport_tablet") { + column(0, arrayOf(71)) + column(1, arrayOf(1)) + } + row("dbrows.waterbirth_teleport_tablet") { + column(0, arrayOf(72)) + column(1, arrayOf(1)) + } + row("dbrows.barbarian_teleport_tablet") { + column(0, arrayOf(75)) + column(1, arrayOf(1)) + } + row("dbrows.khazard_teleport_tablet") { + column(0, arrayOf(78)) + column(1, arrayOf(1)) + } + row("dbrows.fishing_guild_teleport_tablet") { + column(0, arrayOf(85)) + column(1, arrayOf(1)) + } + row("dbrows.catherby_teleport_tablet") { + column(0, arrayOf(87)) + column(1, arrayOf(1)) + } + row("dbrows.ice_plateau_teleport_tablet") { + column(0, arrayOf(89)) + column(1, arrayOf(1)) + } + + } + +} \ No newline at end of file diff --git a/data/cfg/rscm2/dbrows.rscm b/data/cfg/rscm2/dbrows.rscm index 79d1306d..6bb72bff 100644 --- a/data/cfg/rscm2/dbrows.rscm +++ b/data/cfg/rscm2/dbrows.rscm @@ -6921,6 +6921,42 @@ ui_highlighting_style_tutorial_cta=7034 ui_highlighting_fx_pulse_tutorial_cta=7035 ui_highlighting_style_tutorial_alert=7036 ui_highlighting_fx_pulse_tutorial_alert=7037 +ice_plateau_teleport_tablet=97036 +catherby_teleport_tablet=97035 +fishing_guild_teleport_tablet=97034 +khazard_teleport_tablet=97033 +barbarian_teleport_tablet=97032 +waterbirth_teleport_tablet=97031 +ourania_teleport_tablet=97030 +moonclan_teleport_tablet=97029 +ghorrock_teleport_tablet=97028 +annakarl_teleport_tablet=97027 +carrallanger_teleport_tablet=97026 +dareeyak_teleport_tablet=97025 +lassar_teleport_tablet=97024 +kharyrll_teleport_tablet=97023 +senntisten_teleport_tablet=97022 +paddewwa_teleport_tablet=97021 +ape_atoll_teleport_tablet=97020 +barrows_teleport_tablet=97019 +cemetery_teleport_tablet=97018 +harmony_island_teleport_tablet=97017 +west_ardougne_teleport_tablet=97016 +fenkenstrains_castle_teleport_tablet=97015 +salve_graveyard_teleport_tablet=97014 +mind_altar_teleport_tablet=97013 +battlefront_teleport_tablet=97012 +draynor_manor_teleport_tablet=97011 +arceuus_library_teleport_tablet=97010 +teleport_to_house_tablet=97009 +watchtower_teleport_tablet=97008 +civitas_illa_fortis_teleport_tablet=97007 +ardougne_teleport_tablet=97006 +kourend_castle_teleport_tablet=97005 +camelot_teleport_tablet=97004 +falador_teleport_tablet=97003 +lumbridge_teleport_tablet=97002 +varrock_teleport_tablet=97001 infernalashes=97002 abyssalashes=97003 maliciousashes=97004 diff --git a/data/cfg/rscm2/enums.rscm b/data/cfg/rscm2/enums.rscm index f01cbacf..ad8c4247 100644 --- a/data/cfg/rscm2/enums.rscm +++ b/data/cfg/rscm2/enums.rscm @@ -1 +1,2 @@ +teleport_tablets=29999 bone_data=30000 \ No newline at end of file diff --git a/data/cfg/rscm2/tables.rscm b/data/cfg/rscm2/tables.rscm index 6996d791..79e51869 100644 --- a/data/cfg/rscm2/tables.rscm +++ b/data/cfg/rscm2/tables.rscm @@ -124,4 +124,6 @@ teleport_generic=123 poll_filters=124 ui_highlighting_fx_pulse=125 ui_highlighting_style_border=126 + +teleport_tablets=1227 skill_prayer=1226 \ No newline at end of file diff --git a/data/raw-cache/configs/server/skills/prayer/teleport_tablet_data.toml b/data/raw-cache/configs/server/skills/prayer/teleport_tablet_data.toml new file mode 100644 index 00000000..9d258d89 --- /dev/null +++ b/data/raw-cache/configs/server/skills/prayer/teleport_tablet_data.toml @@ -0,0 +1,48 @@ +[[enum]] +id="enums.teleport_tablets" +keyType="OBJ" +valueType="DBROW" + +default = "dbrows.bones" + +[enum.values] +"items.varrock_teleport_tablet" = "dbrows.varrock_teleport_tablet" +"items.lumbridge_teleport_tablet" = "dbrows.lumbridge_teleport_tablet" +"items.falador_teleport_tablet" = "dbrows.falador_teleport_tablet" +"items.camelot_teleport_tablet" = "dbrows.camelot_teleport_tablet" +"items.kourend_castle_teleport_tablet" = "dbrows.kourend_castle_teleport_tablet" +"items.ardougne_teleport_tablet" = "dbrows.ardougne_teleport_tablet" +"items.civitas_illa_fortis_teleport_tablet" = "dbrows.civitas_illa_fortis_teleport_tablet" +"items.watchtower_teleport_tablet" = "dbrows.watchtower_teleport_tablet" +"items.teleport_to_house_tablet" = "dbrows.teleport_to_house_tablet" + + +"items.arceuus_library_teleport_tablet" = "dbrows.arceuus_library_teleport_tablet" +"items.draynor_manor_teleport_tablet" = "dbrows.draynor_manor_teleport_tablet" +"items.battlefront_teleport_tablet" = "dbrows.battlefront_teleport_tablet" +"items.mind_altar_teleport_tablet" = "dbrows.mind_altar_teleport_tablet" +"items.salve_graveyard_teleport_tablet" = "dbrows.salve_graveyard_teleport_tablet" +"items.fenkenstrains_castle_teleport_tablet" = "dbrows.fenkenstrains_castle_teleport_tablet" +"items.west_ardougne_teleport_tablet" = "dbrows.west_ardougne_teleport_tablet" +"items.harmony_island_teleport_tablet" = "dbrows.harmony_island_teleport_tablet" +"items.cemetery_teleport_tablet" = "dbrows.cemetery_teleport_tablet" +"items.barrows_teleport_tablet" = "dbrows.barrows_teleport_tablet" +"items.ape_atoll_teleport_tablet" = "dbrows.ape_atoll_teleport_tablet" + +"items.paddewwa_teleport_tablet" = "dbrows.paddewwa_teleport_tablet" +"items.senntisten_teleport_tablet" = "dbrows.senntisten_teleport_tablet" +"items.kharyrll_teleport_tablet" = "dbrows.kharyrll_teleport_tablet" +"items.lassar_teleport_tablet" = "dbrows.lassar_teleport_tablet" +"items.dareeyak_teleport_tablet" = "dbrows.dareeyak_teleport_tablet" +"items.carrallanger_teleport_tablet" = "dbrows.carrallanger_teleport_tablet" +"items.annakarl_teleport_tablet" = "dbrows.annakarl_teleport_tablet" +"items.ghorrock_teleport_tablet" = "dbrows.ghorrock_teleport_tablet" + +"items.moonclan_teleport_tablet" = "dbrows.moonclan_teleport_tablet" +"items.ourania_teleport_tablet" = "dbrows.ourania_teleport_tablet" +"items.waterbirth_teleport_tablet" = "dbrows.waterbirth_teleport_tablet" +"items.barbarian_teleport_tablet" = "dbrows.barbarian_teleport_tablet" +"items.khazard_teleport_tablet" = "dbrows.khazard_teleport_tablet" +"items.fishing_guild_teleport_tablet" = "dbrows.fishing_guild_teleport_tablet" +"items.catherby_teleport_tablet" = "dbrows.catherby_teleport_tablet" +"items.ice_plateau_teleport_tablet" = "dbrows.ice_plateau_teleport_tablet" \ No newline at end of file From 2d5b49da3e98546d7cf331c28e6064fe2dff13b0 Mon Sep 17 00:00:00 2001 From: Mark7625 <72366279+Mark7625@users.noreply.github.com> Date: Wed, 29 Oct 2025 02:28:40 +0000 Subject: [PATCH 2/4] . --- data/cfg/rscm2/dbrows.rscm | 1 - .../skills/prayer/teleport_tablet_data.toml | 74 +++++++++---------- 2 files changed, 36 insertions(+), 39 deletions(-) diff --git a/data/cfg/rscm2/dbrows.rscm b/data/cfg/rscm2/dbrows.rscm index 6bb72bff..0a67d300 100644 --- a/data/cfg/rscm2/dbrows.rscm +++ b/data/cfg/rscm2/dbrows.rscm @@ -6948,7 +6948,6 @@ mind_altar_teleport_tablet=97013 battlefront_teleport_tablet=97012 draynor_manor_teleport_tablet=97011 arceuus_library_teleport_tablet=97010 -teleport_to_house_tablet=97009 watchtower_teleport_tablet=97008 civitas_illa_fortis_teleport_tablet=97007 ardougne_teleport_tablet=97006 diff --git a/data/raw-cache/configs/server/skills/prayer/teleport_tablet_data.toml b/data/raw-cache/configs/server/skills/prayer/teleport_tablet_data.toml index 9d258d89..ef128883 100644 --- a/data/raw-cache/configs/server/skills/prayer/teleport_tablet_data.toml +++ b/data/raw-cache/configs/server/skills/prayer/teleport_tablet_data.toml @@ -3,46 +3,44 @@ id="enums.teleport_tablets" keyType="OBJ" valueType="DBROW" -default = "dbrows.bones" +default = "dbrows.varrock_teleport_tablet" [enum.values] -"items.varrock_teleport_tablet" = "dbrows.varrock_teleport_tablet" -"items.lumbridge_teleport_tablet" = "dbrows.lumbridge_teleport_tablet" -"items.falador_teleport_tablet" = "dbrows.falador_teleport_tablet" -"items.camelot_teleport_tablet" = "dbrows.camelot_teleport_tablet" -"items.kourend_castle_teleport_tablet" = "dbrows.kourend_castle_teleport_tablet" -"items.ardougne_teleport_tablet" = "dbrows.ardougne_teleport_tablet" -"items.civitas_illa_fortis_teleport_tablet" = "dbrows.civitas_illa_fortis_teleport_tablet" -"items.watchtower_teleport_tablet" = "dbrows.watchtower_teleport_tablet" -"items.teleport_to_house_tablet" = "dbrows.teleport_to_house_tablet" +"items.poh_tablet_varrockteleport" = "dbrows.varrock_teleport_tablet" +"items.poh_tablet_lumbridgeteleport" = "dbrows.lumbridge_teleport_tablet" +"items.poh_tablet_faladorteleport" = "dbrows.falador_teleport_tablet" +"items.poh_tablet_camelotteleport" = "dbrows.camelot_teleport_tablet" +"items.poh_tablet_kourendteleport" = "dbrows.kourend_castle_teleport_tablet" +"items.poh_tablet_ardougneteleport" = "dbrows.ardougne_teleport_tablet" +"items.poh_tablet_fortisteleport" = "dbrows.civitas_illa_fortis_teleport_tablet" +"items.poh_tablet_watchtowerteleport" = "dbrows.watchtower_teleport_tablet" +"items.teletab_lumbridge" = "dbrows.arceuus_library_teleport_tablet" +"items.teletab_draynor" = "dbrows.draynor_manor_teleport_tablet" +"items.teletab_battlefront" = "dbrows.battlefront_teleport_tablet" +"items.teletab_mind_altar" = "dbrows.mind_altar_teleport_tablet" +"items.teletab_salve" = "dbrows.salve_graveyard_teleport_tablet" +"items.teletab_fenk" = "dbrows.fenkenstrains_castle_teleport_tablet" +"items.teletab_westardy" = "dbrows.west_ardougne_teleport_tablet" +"items.teletab_harmony" = "dbrows.harmony_island_teleport_tablet" +"items.teletab_cemetery" = "dbrows.cemetery_teleport_tablet" +"items.teletab_barrows" = "dbrows.barrows_teleport_tablet" +"items.teletab_ape" = "dbrows.ape_atoll_teleport_tablet" -"items.arceuus_library_teleport_tablet" = "dbrows.arceuus_library_teleport_tablet" -"items.draynor_manor_teleport_tablet" = "dbrows.draynor_manor_teleport_tablet" -"items.battlefront_teleport_tablet" = "dbrows.battlefront_teleport_tablet" -"items.mind_altar_teleport_tablet" = "dbrows.mind_altar_teleport_tablet" -"items.salve_graveyard_teleport_tablet" = "dbrows.salve_graveyard_teleport_tablet" -"items.fenkenstrains_castle_teleport_tablet" = "dbrows.fenkenstrains_castle_teleport_tablet" -"items.west_ardougne_teleport_tablet" = "dbrows.west_ardougne_teleport_tablet" -"items.harmony_island_teleport_tablet" = "dbrows.harmony_island_teleport_tablet" -"items.cemetery_teleport_tablet" = "dbrows.cemetery_teleport_tablet" -"items.barrows_teleport_tablet" = "dbrows.barrows_teleport_tablet" -"items.ape_atoll_teleport_tablet" = "dbrows.ape_atoll_teleport_tablet" +"items.paddewwa_teleport" = "dbrows.paddewwa_teleport_tablet" +"items.senntisten_teleport" = "dbrows.senntisten_teleport_tablet" +"items.kharyrll_teleport" = "dbrows.kharyrll_teleport_tablet" +"items.lassar_teleport" = "dbrows.lassar_teleport_tablet" +"items.dareeyak_teleport" = "dbrows.dareeyak_teleport_tablet" +"items.carrallanger_teleport" = "dbrows.carrallanger_teleport_tablet" +"items.annakarl_teleport" = "dbrows.annakarl_teleport_tablet" +"items.ghorrock_teleport" = "dbrows.ghorrock_teleport_tablet" -"items.paddewwa_teleport_tablet" = "dbrows.paddewwa_teleport_tablet" -"items.senntisten_teleport_tablet" = "dbrows.senntisten_teleport_tablet" -"items.kharyrll_teleport_tablet" = "dbrows.kharyrll_teleport_tablet" -"items.lassar_teleport_tablet" = "dbrows.lassar_teleport_tablet" -"items.dareeyak_teleport_tablet" = "dbrows.dareeyak_teleport_tablet" -"items.carrallanger_teleport_tablet" = "dbrows.carrallanger_teleport_tablet" -"items.annakarl_teleport_tablet" = "dbrows.annakarl_teleport_tablet" -"items.ghorrock_teleport_tablet" = "dbrows.ghorrock_teleport_tablet" - -"items.moonclan_teleport_tablet" = "dbrows.moonclan_teleport_tablet" -"items.ourania_teleport_tablet" = "dbrows.ourania_teleport_tablet" -"items.waterbirth_teleport_tablet" = "dbrows.waterbirth_teleport_tablet" -"items.barbarian_teleport_tablet" = "dbrows.barbarian_teleport_tablet" -"items.khazard_teleport_tablet" = "dbrows.khazard_teleport_tablet" -"items.fishing_guild_teleport_tablet" = "dbrows.fishing_guild_teleport_tablet" -"items.catherby_teleport_tablet" = "dbrows.catherby_teleport_tablet" -"items.ice_plateau_teleport_tablet" = "dbrows.ice_plateau_teleport_tablet" \ No newline at end of file +"items.moonclan_teleport" = "dbrows.moonclan_teleport_tablet" +"items.ourania_teleport" = "dbrows.ourania_teleport_tablet" +"items.waterbirth_teleport" = "dbrows.waterbirth_teleport_tablet" +"items.barbarian_teleport" = "dbrows.barbarian_teleport_tablet" +"items.khazard_teleport" = "dbrows.khazard_teleport_tablet" +"items.fishing_guild_teleport" = "dbrows.fishing_guild_teleport_tablet" +"items.catherby_teleport" = "dbrows.catherby_teleport_tablet" +"items.ice_plateau_teleport" = "dbrows.ice_plateau_teleport_tablet" \ No newline at end of file From 7aabe53cd44fbd46b43bf2a9cc514c1bfaaa2763 Mon Sep 17 00:00:00 2001 From: Mark7625 <72366279+Mark7625@users.noreply.github.com> Date: Wed, 29 Oct 2025 09:16:48 +0000 Subject: [PATCH 3/4] Added dbFind and table --- build.gradle.kts | 2 +- cache/src/main/kotlin/org/alter/CacheTools.kt | 11 +- .../main/kotlin/org/alter/impl/PrayerTable.kt | 191 +++++++++++------- .../main/kotlin/org/alter/impl/TeleTabs.kt | 189 +++++++++-------- .../kotlin/org/alter/skills/prayer/Bones.kt | 10 +- .../alter/skills/prayer/GildedAlterEvents.kt | 2 + .../alter/skills/prayer/PrayerBuryEvents.kt | 7 +- data/cfg/rscm2/columns.rscm | 8 +- data/cfg/rscm2/dbrows.rscm | 70 +++---- data/cfg/rscm2/tables.rscm | 5 +- .../server/skills/prayer/prayer_data.toml | 44 ---- .../skills/prayer/teleport_tablet_data.toml | 46 ----- .../kotlin/org/alter/game/util/DbHelper.kt | 57 ++++++ 13 files changed, 342 insertions(+), 300 deletions(-) delete mode 100644 data/raw-cache/configs/server/skills/prayer/prayer_data.toml delete mode 100644 data/raw-cache/configs/server/skills/prayer/teleport_tablet_data.toml diff --git a/build.gradle.kts b/build.gradle.kts index 13f0b00b..b6544572 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -22,7 +22,7 @@ allprojects { val lib = rootProject.project.libs dependencies { - implementation("dev.or2:all:2.2.5") + implementation("dev.or2:all:2.2.6") implementation(lib.kotlin.logging) implementation(lib.logback.classic) implementation(lib.fastutil) diff --git a/cache/src/main/kotlin/org/alter/CacheTools.kt b/cache/src/main/kotlin/org/alter/CacheTools.kt index 1c060d33..6d11ec38 100644 --- a/cache/src/main/kotlin/org/alter/CacheTools.kt +++ b/cache/src/main/kotlin/org/alter/CacheTools.kt @@ -14,6 +14,7 @@ import dev.openrune.filesystem.Cache import dev.openrune.tools.PackServerConfig import io.github.oshai.kotlinlogging.KotlinLogging import org.alter.impl.PrayerTable +import org.alter.impl.TeleTabs import java.io.File import java.nio.file.Files import java.nio.file.StandardCopyOption @@ -53,7 +54,10 @@ fun downloadRev(type : TaskType) { builder.environment(CacheEnvironment.valueOf(rev.third)) val tasksNew = tasks.toMutableList() - tasksNew.add(PackDBTables(listOf(PrayerTable.skillTable()))) + tasksNew.add(PackDBTables(listOf( + PrayerTable.skillTable(), + TeleTabs.teleTabs() + ))) builder.extraTasks(*tasksNew.toTypedArray()).build().initialize() @@ -69,7 +73,10 @@ fun downloadRev(type : TaskType) { builder.revision(rev.first) val tasksNew = tasks.toMutableList() - tasksNew.add(PackDBTables(listOf(PrayerTable.skillTable()))) + tasksNew.add(PackDBTables(listOf( + PrayerTable.skillTable(), + TeleTabs.teleTabs() + ))) builder.extraTasks(*tasksNew.toTypedArray()).build().initialize() diff --git a/cache/src/main/kotlin/org/alter/impl/PrayerTable.kt b/cache/src/main/kotlin/org/alter/impl/PrayerTable.kt index 8746cc1e..571a7d32 100644 --- a/cache/src/main/kotlin/org/alter/impl/PrayerTable.kt +++ b/cache/src/main/kotlin/org/alter/impl/PrayerTable.kt @@ -6,189 +6,224 @@ import dev.openrune.definition.util.VarType object PrayerTable { fun skillTable() = dbTable("tables.skill_prayer") { - column("exp", 0, arrayOf(VarType.INT)) - column("ashes", 1, arrayOf(VarType.BOOLEAN)) - + column("item", 0, arrayOf(VarType.OBJ)) + column("exp", 1, arrayOf(VarType.INT)) + column("ashes", 2, arrayOf(VarType.BOOLEAN)) + row("dbrows.bones") { - column(0, arrayOf(5)) - column(1, arrayOf(false)) + columnRSCM(0, arrayOf("items.bones")) + column(1, arrayOf(5)) + column(2, arrayOf(false)) } row("dbrows.wolfbones") { - column(0, arrayOf(5)) - column(1, arrayOf(false)) + columnRSCM(0, arrayOf("items.wolf_bones")) + column(1, arrayOf(5)) + column(2, arrayOf(false)) } row("dbrows.burntbones") { - column(0, arrayOf(5)) - column(1, arrayOf(false)) + columnRSCM(0, arrayOf("items.bones_burnt")) + column(1, arrayOf(5)) + column(2, arrayOf(false)) } row("dbrows.monkeybones") { - column(0, arrayOf(5)) - column(1, arrayOf(false)) + columnRSCM(0, arrayOf("items.mm_normal_monkey_bones")) + column(1, arrayOf(5)) + column(2, arrayOf(false)) } row("dbrows.batbones") { - column(0, arrayOf(5)) - column(1, arrayOf(false)) + columnRSCM(0, arrayOf("items.bat_bones")) + column(1, arrayOf(5)) + column(2, arrayOf(false)) } row("dbrows.bigbones") { - column(0, arrayOf(15)) - column(1, arrayOf(false)) + columnRSCM(0, arrayOf("items.big_bones")) + column(1, arrayOf(15)) + column(2, arrayOf(false)) } row("dbrows.jogrebones") { - column(0, arrayOf(15)) - column(1, arrayOf(false)) + columnRSCM(0, arrayOf("items.tbwt_jogre_bones")) + column(1, arrayOf(15)) + column(2, arrayOf(false)) } row("dbrows.wyrmlingbones") { - column(0, arrayOf(21)) - column(1, arrayOf(false)) + columnRSCM(0, arrayOf("items.babywyrm_bones")) + column(1, arrayOf(21)) + column(2, arrayOf(false)) } row("dbrows.zogrebones") { - column(0, arrayOf(23)) - column(1, arrayOf(false)) + columnRSCM(0, arrayOf("items.zogre_bones")) + column(1, arrayOf(23)) + column(2, arrayOf(false)) } row("dbrows.shaikahanbones") { - column(0, arrayOf(25)) - column(1, arrayOf(false)) + columnRSCM(0, arrayOf("items.tbwt_beast_bones")) + column(1, arrayOf(25)) + column(2, arrayOf(false)) } row("dbrows.babydragonbones") { - column(0, arrayOf(30)) - column(1, arrayOf(false)) + columnRSCM(0, arrayOf("items.babydragon_bones")) + column(1, arrayOf(30)) + column(2, arrayOf(false)) } row("dbrows.wyrmbones") { - column(0, arrayOf(50)) - column(1, arrayOf(false)) + columnRSCM(0, arrayOf("items.wyrm_bones")) + column(1, arrayOf(50)) + column(2, arrayOf(false)) } row("dbrows.wyvernbones") { - column(0, arrayOf(72)) - column(1, arrayOf(false)) + columnRSCM(0, arrayOf("items.wyvern_bones")) + column(1, arrayOf(72)) + column(2, arrayOf(false)) } row("dbrows.dragonbones") { - column(0, arrayOf(72)) - column(1, arrayOf(false)) + columnRSCM(0, arrayOf("items.dragon_bones")) + column(1, arrayOf(72)) + column(2, arrayOf(false)) } row("dbrows.drakebones") { - column(0, arrayOf(80)) - column(1, arrayOf(false)) + columnRSCM(0, arrayOf("items.drake_bones")) + column(1, arrayOf(80)) + column(2, arrayOf(false)) } row("dbrows.fayrgbones") { - column(0, arrayOf(84)) - column(1, arrayOf(false)) + columnRSCM(0, arrayOf("items.zogre_ancestral_bones_fayg")) + column(1, arrayOf(84)) + column(2, arrayOf(false)) } row("dbrows.lavadragonbones") { - column(0, arrayOf(85)) - column(1, arrayOf(false)) + columnRSCM(0, arrayOf("items.lava_dragon_bones")) + column(1, arrayOf(85)) + column(2, arrayOf(false)) } row("dbrows.raurgbones") { - column(0, arrayOf(96)) - column(1, arrayOf(false)) + columnRSCM(0, arrayOf("items.zogre_ancestral_bones_raurg")) + column(1, arrayOf(96)) + column(2, arrayOf(false)) } row("dbrows.hydrabones") { - column(0, arrayOf(110)) - column(1, arrayOf(false)) + columnRSCM(0, arrayOf("items.hydra_bones")) + column(1, arrayOf(110)) + column(2, arrayOf(false)) } row("dbrows.dagannothbones") { - column(0, arrayOf(125)) - column(1, arrayOf(false)) + columnRSCM(0, arrayOf("items.dagannoth_king_bones")) + column(1, arrayOf(125)) + column(2, arrayOf(false)) } row("dbrows.ourgbones") { - column(0, arrayOf(140)) - column(1, arrayOf(false)) + columnRSCM(0, arrayOf("items.zogre_ancestral_bones_ourg")) + column(1, arrayOf(140)) + column(2, arrayOf(false)) } row("dbrows.superiordragonbones") { - column(0, arrayOf(150)) - column(1, arrayOf(false)) + columnRSCM(0, arrayOf("items.dragon_bones_superior")) + column(1, arrayOf(150)) + column(2, arrayOf(false)) } row("dbrows.alansbones") { - column(0, arrayOf(3)) - column(1, arrayOf(false)) + columnRSCM(0, arrayOf("items.alan_bones")) + column(1, arrayOf(3)) + column(2, arrayOf(false)) } row("dbrows.bonesapeatoll") { - column(0, arrayOf(3)) - column(1, arrayOf(false)) + columnRSCM(0, arrayOf("items.mm_skeleton_bones")) + column(1, arrayOf(3)) + column(2, arrayOf(false)) } row("dbrows.bleachedbones") { - column(0, arrayOf(5)) - column(1, arrayOf(false)) + columnRSCM(0, arrayOf("items.shade_bleached_bones")) + column(1, arrayOf(5)) + column(2, arrayOf(false)) } row("dbrows.smallzombiemonkeybones") { - column(0, arrayOf(5)) - column(1, arrayOf(false)) + columnRSCM(0, arrayOf("items.mm_small_zombie_monkey_bones")) + column(1, arrayOf(5)) + column(2, arrayOf(false)) } row("dbrows.largezombiemonkeybones") { - column(0, arrayOf(5)) - column(1, arrayOf(false)) + columnRSCM(0, arrayOf("items.mm_large_zombie_monkey_bones")) + column(1, arrayOf(5)) + column(2, arrayOf(false)) } row("dbrows.smallninjamonkeybones") { - column(0, arrayOf(16)) - column(1, arrayOf(false)) + columnRSCM(0, arrayOf("items.mm_small_ninja_monkey_bones")) + column(1, arrayOf(16)) + column(2, arrayOf(false)) } row("dbrows.mediumninjamonkeybones") { - column(0, arrayOf(18)) - column(1, arrayOf(false)) + columnRSCM(0, arrayOf("items.mm_medium_ninja_monkey_bones")) + column(1, arrayOf(18)) + column(2, arrayOf(false)) } row("dbrows.gorillabones") { - column(0, arrayOf(18)) - column(1, arrayOf(false)) + columnRSCM(0, arrayOf("items.mm_normal_gorilla_monkey_bones")) + column(1, arrayOf(18)) + column(2, arrayOf(false)) } row("dbrows.beardedgorillabones") { - column(0, arrayOf(18)) - column(1, arrayOf(true)) + columnRSCM(0, arrayOf("items.mm_bearded_gorilla_monkey_bones")) + column(1, arrayOf(18)) + column(2, arrayOf(true)) } row("dbrows.fiendishashes") { - column(0, arrayOf(10)) - column(1, arrayOf(true)) + columnRSCM(0, arrayOf("items.fiendish_ashes")) + column(1, arrayOf(10)) + column(2, arrayOf(true)) } row("dbrows.vileashes") { - column(0, arrayOf(25)) - column(1, arrayOf(true)) + columnRSCM(0, arrayOf("items.vile_ashes")) + column(1, arrayOf(25)) + column(2, arrayOf(true)) } row("dbrows.maliciousashes") { - column(0, arrayOf(65)) - column(1, arrayOf(true)) + columnRSCM(0, arrayOf("items.malicious_ashes")) + column(1, arrayOf(65)) + column(2, arrayOf(true)) } row("dbrows.abyssalashes") { - column(0, arrayOf(85)) - column(1, arrayOf(true)) + columnRSCM(0, arrayOf("items.abyssal_ashes")) + column(1, arrayOf(85)) + column(2, arrayOf(true)) } row("dbrows.infernalashes") { - column(0, arrayOf(110)) - column(1, arrayOf(true)) + columnRSCM(0, arrayOf("items.infernal_ashes")) + column(1, arrayOf(110)) + column(2, arrayOf(true)) } - } - -} \ No newline at end of file +} diff --git a/cache/src/main/kotlin/org/alter/impl/TeleTabs.kt b/cache/src/main/kotlin/org/alter/impl/TeleTabs.kt index 66fdf1b4..d443cac9 100644 --- a/cache/src/main/kotlin/org/alter/impl/TeleTabs.kt +++ b/cache/src/main/kotlin/org/alter/impl/TeleTabs.kt @@ -6,162 +6,191 @@ import dev.openrune.definition.util.VarType object TeleTabs { fun teleTabs() = dbTable("tables.teleport_tablets") { - column("magic_level", 0, arrayOf(VarType.INT)) - column("location", 1, arrayOf(VarType.INT)) + column("item", 0, arrayOf(VarType.OBJ)) + column("magic_level", 1, arrayOf(VarType.INT)) + column("location", 2, arrayOf(VarType.INT)) // Standard Teleport Tablets row("dbrows.varrock_teleport_tablet") { - column(0, arrayOf(25)) - column(1, arrayOf(1)) + columnRSCM(0, arrayOf("items.poh_tablet_varrockteleport")) + column(1, arrayOf(25)) + column(2, arrayOf(1)) } row("dbrows.lumbridge_teleport_tablet") { - column(0, arrayOf(31)) - column(1, arrayOf(1)) + columnRSCM(0, arrayOf("items.poh_tablet_lumbridgeteleport")) + column(1, arrayOf(31)) + column(2, arrayOf(1)) } row("dbrows.falador_teleport_tablet") { - column(0, arrayOf(37)) - column(1, arrayOf(1)) + columnRSCM(0, arrayOf("items.poh_tablet_faladorteleport")) + column(1, arrayOf(37)) + column(2, arrayOf(1)) } row("dbrows.camelot_teleport_tablet") { - column(0, arrayOf(45)) - column(1, arrayOf(1)) + columnRSCM(0, arrayOf("items.poh_tablet_camelotteleport")) + column(1, arrayOf(45)) + column(2, arrayOf(1)) } row("dbrows.kourend_castle_teleport_tablet") { - column(0, arrayOf(48)) - column(1, arrayOf(1)) + columnRSCM(0, arrayOf("items.poh_tablet_kourendteleport")) + column(1, arrayOf(48)) + column(2, arrayOf(1)) } row("dbrows.ardougne_teleport_tablet") { - column(0, arrayOf(51)) - column(1, arrayOf(1)) + columnRSCM(0, arrayOf("items.poh_tablet_ardougneteleport")) + column(1, arrayOf(51)) + column(2, arrayOf(1)) } row("dbrows.civitas_illa_fortis_teleport_tablet") { - column(0, arrayOf(54)) - column(1, arrayOf(1)) + columnRSCM(0, arrayOf("items.poh_tablet_fortisteleport")) + column(1, arrayOf(54)) + column(2, arrayOf(1)) } row("dbrows.watchtower_teleport_tablet") { - column(0, arrayOf(58)) - column(1, arrayOf(1)) + columnRSCM(0, arrayOf("items.poh_tablet_watchtowerteleport")) + column(1, arrayOf(58)) + column(2, arrayOf(1)) } - row("dbrows.teleport_to_house_tablet") { - column(0, arrayOf(40)) - column(1, arrayOf(1)) - } - // Arceuus Teleport Tablets row("dbrows.arceuus_library_teleport_tablet") { - column(0, arrayOf(6)) - column(1, arrayOf(1)) + columnRSCM(0, arrayOf("items.teletab_lumbridge")) + column(1, arrayOf(6)) + column(2, arrayOf(1)) } row("dbrows.draynor_manor_teleport_tablet") { - column(0, arrayOf(17)) - column(1, arrayOf(1)) + columnRSCM(0, arrayOf("items.teletab_draynor")) + column(1, arrayOf(17)) + column(2, arrayOf(1)) } row("dbrows.battlefront_teleport_tablet") { - column(0, arrayOf(23)) - column(1, arrayOf(1)) + columnRSCM(0, arrayOf("items.teletab_battlefront")) + column(1, arrayOf(23)) + column(2, arrayOf(1)) } row("dbrows.mind_altar_teleport_tablet") { - column(0, arrayOf(28)) - column(1, arrayOf(1)) + columnRSCM(0, arrayOf("items.teletab_mind_altar")) + column(1, arrayOf(28)) + column(2, arrayOf(1)) } row("dbrows.salve_graveyard_teleport_tablet") { - column(0, arrayOf(40)) - column(1, arrayOf(1)) + columnRSCM(0, arrayOf("items.teletab_salve")) + column(1, arrayOf(40)) + column(2, arrayOf(1)) } row("dbrows.fenkenstrains_castle_teleport_tablet") { - column(0, arrayOf(48)) - column(1, arrayOf(1)) + columnRSCM(0, arrayOf("items.teletab_fenk")) + column(1, arrayOf(48)) + column(2, arrayOf(1)) } row("dbrows.west_ardougne_teleport_tablet") { - column(0, arrayOf(61)) - column(1, arrayOf(1)) + columnRSCM(0, arrayOf("items.teletab_westardy")) + column(1, arrayOf(61)) + column(2, arrayOf(1)) } row("dbrows.harmony_island_teleport_tablet") { - column(0, arrayOf(65)) - column(1, arrayOf(1)) + columnRSCM(0, arrayOf("items.teletab_harmony")) + column(1, arrayOf(65)) + column(2, arrayOf(1)) } row("dbrows.cemetery_teleport_tablet") { - column(0, arrayOf(71)) - column(1, arrayOf(1)) + columnRSCM(0, arrayOf("items.teletab_cemetery")) + column(1, arrayOf(71)) + column(2, arrayOf(1)) } row("dbrows.barrows_teleport_tablet") { - column(0, arrayOf(83)) - column(1, arrayOf(1)) + columnRSCM(0, arrayOf("items.teletab_barrows")) + column(1, arrayOf(83)) + column(2, arrayOf(1)) } row("dbrows.ape_atoll_teleport_tablet") { - column(0, arrayOf(90)) - column(1, arrayOf(1)) + columnRSCM(0, arrayOf("items.teletab_ape")) + column(1, arrayOf(90)) + column(2, arrayOf(1)) } -// Ancient Magicks Teleport Tablets + // Ancient Magicks Teleport Tablets row("dbrows.paddewwa_teleport_tablet") { - column(0, arrayOf(54)) - column(1, arrayOf(1)) + columnRSCM(0, arrayOf("items.tablet_paddewa")) + column(1, arrayOf(54)) + column(2, arrayOf(1)) } row("dbrows.senntisten_teleport_tablet") { - column(0, arrayOf(60)) - column(1, arrayOf(1)) + columnRSCM(0, arrayOf("items.tablet_senntisten")) + column(1, arrayOf(60)) + column(2, arrayOf(1)) } row("dbrows.kharyrll_teleport_tablet") { - column(0, arrayOf(66)) - column(1, arrayOf(1)) + columnRSCM(0, arrayOf("items.tablet_kharyll")) + column(1, arrayOf(66)) + column(2, arrayOf(1)) } row("dbrows.lassar_teleport_tablet") { - column(0, arrayOf(72)) - column(1, arrayOf(1)) + columnRSCM(0, arrayOf("items.tablet_lassar")) + column(1, arrayOf(72)) + column(2, arrayOf(1)) } row("dbrows.dareeyak_teleport_tablet") { - column(0, arrayOf(78)) - column(1, arrayOf(1)) + columnRSCM(0, arrayOf("items.tablet_dareeyak")) + column(1, arrayOf(78)) + column(2, arrayOf(1)) } row("dbrows.carrallanger_teleport_tablet") { - column(0, arrayOf(84)) - column(1, arrayOf(1)) + columnRSCM(0, arrayOf("items.tablet_carrallangar")) + column(1, arrayOf(84)) + column(2, arrayOf(1)) } row("dbrows.annakarl_teleport_tablet") { - column(0, arrayOf(90)) - column(1, arrayOf(1)) + columnRSCM(0, arrayOf("items.tablet_annakarl")) + column(1, arrayOf(90)) + column(2, arrayOf(1)) } row("dbrows.ghorrock_teleport_tablet") { - column(0, arrayOf(96)) - column(1, arrayOf(1)) + columnRSCM(0, arrayOf("items.tablet_ghorrock")) + column(1, arrayOf(96)) + column(2, arrayOf(1)) } // Lunar Teleport Tablets row("dbrows.moonclan_teleport_tablet") { - column(0, arrayOf(69)) - column(1, arrayOf(1)) + columnRSCM(0, arrayOf("items.lunar_tablet_moonclan_teleport")) + column(1, arrayOf(69)) + column(2, arrayOf(1)) } row("dbrows.ourania_teleport_tablet") { - column(0, arrayOf(71)) - column(1, arrayOf(1)) + columnRSCM(0, arrayOf("items.lunar_tablet_ourania_teleport")) + column(1, arrayOf(71)) + column(2, arrayOf(1)) } row("dbrows.waterbirth_teleport_tablet") { - column(0, arrayOf(72)) - column(1, arrayOf(1)) + columnRSCM(0, arrayOf("items.lunar_tablet_waterbirth_teleport")) + column(1, arrayOf(72)) + column(2, arrayOf(1)) } row("dbrows.barbarian_teleport_tablet") { - column(0, arrayOf(75)) - column(1, arrayOf(1)) + columnRSCM(0, arrayOf("items.lunar_tablet_barbarian_teleport")) + column(1, arrayOf(75)) + column(2, arrayOf(1)) } row("dbrows.khazard_teleport_tablet") { - column(0, arrayOf(78)) - column(1, arrayOf(1)) + columnRSCM(0, arrayOf("items.lunar_tablet_khazard_teleport")) + column(1, arrayOf(78)) + column(2, arrayOf(1)) } row("dbrows.fishing_guild_teleport_tablet") { - column(0, arrayOf(85)) - column(1, arrayOf(1)) + columnRSCM(0, arrayOf("items.lunar_tablet_fishing_guild_teleport")) + column(1, arrayOf(85)) + column(2, arrayOf(1)) } row("dbrows.catherby_teleport_tablet") { - column(0, arrayOf(87)) - column(1, arrayOf(1)) + columnRSCM(0, arrayOf("items.lunar_tablet_catherby_teleport")) + column(1, arrayOf(87)) + column(2, arrayOf(1)) } row("dbrows.ice_plateau_teleport_tablet") { - column(0, arrayOf(89)) - column(1, arrayOf(1)) + columnRSCM(0, arrayOf("items.lunar_tablet_ice_plateau_teleport")) + column(1, arrayOf(89)) + column(2, arrayOf(1)) } - } - } \ No newline at end of file diff --git a/content/src/main/kotlin/org/alter/skills/prayer/Bones.kt b/content/src/main/kotlin/org/alter/skills/prayer/Bones.kt index 42f59125..51af0985 100644 --- a/content/src/main/kotlin/org/alter/skills/prayer/Bones.kt +++ b/content/src/main/kotlin/org/alter/skills/prayer/Bones.kt @@ -1,12 +1,10 @@ package org.alter.skills.prayer -import org.alter.game.util.enum -import org.alter.game.util.DbHelper.Companion.row +import org.alter.game.util.DbHelper.Companion.table import org.alter.game.util.column import org.alter.game.util.vars.BooleanType import org.alter.game.util.vars.IntType import org.alter.game.util.vars.ObjType -import org.alter.game.util.vars.RowType object Bones { @@ -16,10 +14,8 @@ object Bones { val isAshes: Boolean ) - val boneEnum = enum("enums.bone_data", ObjType, RowType) - - val bones: List = boneEnum.map { (boneId, rowId) -> - val row = row(rowId) + val bones: List = table("tables.skill_prayer").map { row -> + val boneId = row.column("columns.skill_prayer:item", ObjType) val xp = row.column("columns.skill_prayer:exp", IntType) val isAshes = row.column("columns.skill_prayer:ashes", BooleanType) BoneData(boneId, xp, isAshes) diff --git a/content/src/main/kotlin/org/alter/skills/prayer/GildedAlterEvents.kt b/content/src/main/kotlin/org/alter/skills/prayer/GildedAlterEvents.kt index 9402295e..44c3c00c 100644 --- a/content/src/main/kotlin/org/alter/skills/prayer/GildedAlterEvents.kt +++ b/content/src/main/kotlin/org/alter/skills/prayer/GildedAlterEvents.kt @@ -12,6 +12,7 @@ import org.alter.game.model.entity.GameObject import org.alter.game.model.entity.Player import org.alter.game.pluginnew.PluginEvent import org.alter.game.pluginnew.event.impl.ItemOnObject +import org.alter.game.pluginnew.event.impl.ObjectClickEvent import org.alter.rscm.RSCM.asRSCM class GildedAlterEvents : PluginEvent() { @@ -28,6 +29,7 @@ class GildedAlterEvents : PluginEvent() { override fun init() { Bones.bones.forEach { bone -> if (!bone.isAshes) { + on { where { item.id == bone.id && gameObject.id == "objects.chaosaltar".asRSCM() } then { startAlter(player, bone.id, bone.xp, true, gameObject) } diff --git a/content/src/main/kotlin/org/alter/skills/prayer/PrayerBuryEvents.kt b/content/src/main/kotlin/org/alter/skills/prayer/PrayerBuryEvents.kt index 55a09ca8..f1592646 100644 --- a/content/src/main/kotlin/org/alter/skills/prayer/PrayerBuryEvents.kt +++ b/content/src/main/kotlin/org/alter/skills/prayer/PrayerBuryEvents.kt @@ -2,7 +2,9 @@ package org.alter.skills.prayer import org.alter.api.ChatMessageType import org.alter.api.Skills -import org.alter.api.ext.* +import org.alter.api.ext.message +import org.alter.api.ext.options +import org.alter.api.ext.playSound import org.alter.game.model.LockState import org.alter.game.model.entity.Player import org.alter.game.model.move.stopMovement @@ -56,4 +58,5 @@ class PrayerBuryEvents : PluginEvent() { } } -} \ No newline at end of file +} + diff --git a/data/cfg/rscm2/columns.rscm b/data/cfg/rscm2/columns.rscm index 68440de6..e9f4d23a 100644 --- a/data/cfg/rscm2/columns.rscm +++ b/data/cfg/rscm2/columns.rscm @@ -856,5 +856,9 @@ ui_highlighting_style_border:width=8257536 ui_highlighting_style_border:colour=8257537 ui_highlighting_style_border:padding=8257538 ui_highlighting_style_border:fx=8257539 -skill_prayer:exp=80347136 -skill_prayer:ashes=80347137 \ No newline at end of file +skill_prayer:item=80347136 +skill_prayer:exp=80347137 +skill_prayer:ashes=80347138 +teleport_tablets:item=80412672 +teleport_tablets:magic_level=80412673 +teleport_tablets:location=80412674 \ No newline at end of file diff --git a/data/cfg/rscm2/dbrows.rscm b/data/cfg/rscm2/dbrows.rscm index 0a67d300..4175f05d 100644 --- a/data/cfg/rscm2/dbrows.rscm +++ b/data/cfg/rscm2/dbrows.rscm @@ -6921,41 +6921,41 @@ ui_highlighting_style_tutorial_cta=7034 ui_highlighting_fx_pulse_tutorial_cta=7035 ui_highlighting_style_tutorial_alert=7036 ui_highlighting_fx_pulse_tutorial_alert=7037 -ice_plateau_teleport_tablet=97036 -catherby_teleport_tablet=97035 -fishing_guild_teleport_tablet=97034 -khazard_teleport_tablet=97033 -barbarian_teleport_tablet=97032 -waterbirth_teleport_tablet=97031 -ourania_teleport_tablet=97030 -moonclan_teleport_tablet=97029 -ghorrock_teleport_tablet=97028 -annakarl_teleport_tablet=97027 -carrallanger_teleport_tablet=97026 -dareeyak_teleport_tablet=97025 -lassar_teleport_tablet=97024 -kharyrll_teleport_tablet=97023 -senntisten_teleport_tablet=97022 -paddewwa_teleport_tablet=97021 -ape_atoll_teleport_tablet=97020 -barrows_teleport_tablet=97019 -cemetery_teleport_tablet=97018 -harmony_island_teleport_tablet=97017 -west_ardougne_teleport_tablet=97016 -fenkenstrains_castle_teleport_tablet=97015 -salve_graveyard_teleport_tablet=97014 -mind_altar_teleport_tablet=97013 -battlefront_teleport_tablet=97012 -draynor_manor_teleport_tablet=97011 -arceuus_library_teleport_tablet=97010 -watchtower_teleport_tablet=97008 -civitas_illa_fortis_teleport_tablet=97007 -ardougne_teleport_tablet=97006 -kourend_castle_teleport_tablet=97005 -camelot_teleport_tablet=97004 -falador_teleport_tablet=97003 -lumbridge_teleport_tablet=97002 -varrock_teleport_tablet=97001 +varrock_teleport_tablet=96967 +lumbridge_teleport_tablet=96968 +falador_teleport_tablet=96969 +camelot_teleport_tablet=96970 +kourend_castle_teleport_tablet=96971 +ardougne_teleport_tablet=96972 +civitas_illa_fortis_teleport_tablet=96973 +watchtower_teleport_tablet=96974 +arceuus_library_teleport_tablet=96975 +draynor_manor_teleport_tablet=96976 +battlefront_teleport_tablet=96977 +mind_altar_teleport_tablet=96978 +salve_graveyard_teleport_tablet=96979 +fenkenstrains_castle_teleport_tablet=96980 +west_ardougne_teleport_tablet=96981 +harmony_island_teleport_tablet=96982 +cemetery_teleport_tablet=96983 +barrows_teleport_tablet=96984 +ape_atoll_teleport_tablet=96985 +paddewwa_teleport_tablet=96986 +senntisten_teleport_tablet=96987 +kharyrll_teleport_tablet=96988 +lassar_teleport_tablet=96989 +dareeyak_teleport_tablet=96990 +carrallanger_teleport_tablet=96991 +annakarl_teleport_tablet=96992 +ghorrock_teleport_tablet=96993 +moonclan_teleport_tablet=96994 +ourania_teleport_tablet=96995 +waterbirth_teleport_tablet=96996 +barbarian_teleport_tablet=96997 +khazard_teleport_tablet=96998 +fishing_guild_teleport_tablet=96999 +catherby_teleport_tablet=97000 +ice_plateau_teleport_tablet=97001 infernalashes=97002 abyssalashes=97003 maliciousashes=97004 diff --git a/data/cfg/rscm2/tables.rscm b/data/cfg/rscm2/tables.rscm index 79e51869..f8ed7f96 100644 --- a/data/cfg/rscm2/tables.rscm +++ b/data/cfg/rscm2/tables.rscm @@ -124,6 +124,5 @@ teleport_generic=123 poll_filters=124 ui_highlighting_fx_pulse=125 ui_highlighting_style_border=126 - -teleport_tablets=1227 -skill_prayer=1226 \ No newline at end of file +skill_prayer=1226 +teleport_tablets=1227 \ No newline at end of file diff --git a/data/raw-cache/configs/server/skills/prayer/prayer_data.toml b/data/raw-cache/configs/server/skills/prayer/prayer_data.toml deleted file mode 100644 index 6fe1f4d4..00000000 --- a/data/raw-cache/configs/server/skills/prayer/prayer_data.toml +++ /dev/null @@ -1,44 +0,0 @@ -[[enum]] -id="enums.bone_data" -keyType="OBJ" -valueType="DBROW" - -default = "dbrows.bones" - -[enum.values] -"items.bones" = "dbrows.bones" -"items.wolf_bones" = "dbrows.wolfbones" -"items.bones_burnt" = "dbrows.burntbones" -"items.mm_normal_monkey_bones" = "dbrows.monkeybones" -"items.bat_bones" = "dbrows.batbones" -"items.big_bones" = "dbrows.bigbones" -"items.tbwt_jogre_bones" = "dbrows.jogrebones" -"items.babywyrm_bones" = "dbrows.wyrmlingbones" -"items.zogre_bones" = "dbrows.zogrebones" -"items.tbwt_beast_bones" = "dbrows.shaikahanbones" -"items.babydragon_bones" = "dbrows.babydragonbones" -"items.wyrm_bones" = "dbrows.wyrmbones" -"items.wyvern_bones" = "dbrows.wyvernbones" -"items.dragon_bones" = "dbrows.dragonbones" -"items.drake_bones" = "dbrows.drakebones" -"items.zogre_ancestral_bones_fayg" = "dbrows.fayrgbones" -"items.lava_dragon_bones" = "dbrows.lavadragonbones" -"items.zogre_ancestral_bones_raurg" = "dbrows.raurgbones" -"items.hydra_bones" = "dbrows.hydrabones" -"items.dagannoth_king_bones" = "dbrows.dagannothbones" -"items.zogre_ancestral_bones_ourg" = "dbrows.ourgbones" -"items.dragon_bones_superior" = "dbrows.superiordragonbones" -"items.alan_bones" = "dbrows.alansbones" -"items.mm_skeleton_bones" = "dbrows.bonesapeatoll" -"items.shade_bleached_bones" = "dbrows.bleachedbones" -"items.mm_small_zombie_monkey_bones" = "dbrows.smallzombiemonkeybones" -"items.mm_large_zombie_monkey_bones" = "dbrows.largezombiemonkeybones" -"items.mm_small_ninja_monkey_bones" = "dbrows.smallninjamonkeybones" -"items.mm_medium_ninja_monkey_bones" = "dbrows.mediumninjamonkeybones" -"items.mm_normal_gorilla_monkey_bones" = "dbrows.gorillabones" -"items.mm_bearded_gorilla_monkey_bones" = "dbrows.beardedgorillabones" -"items.fiendish_ashes" = "dbrows.fiendishashes" -"items.vile_ashes" = "dbrows.vileashes" -"items.malicious_ashes" = "dbrows.maliciousashes" -"items.abyssal_ashes" = "dbrows.abyssalashes" -"items.infernal_ashes" = "dbrows.infernalashes" \ No newline at end of file diff --git a/data/raw-cache/configs/server/skills/prayer/teleport_tablet_data.toml b/data/raw-cache/configs/server/skills/prayer/teleport_tablet_data.toml deleted file mode 100644 index ef128883..00000000 --- a/data/raw-cache/configs/server/skills/prayer/teleport_tablet_data.toml +++ /dev/null @@ -1,46 +0,0 @@ -[[enum]] -id="enums.teleport_tablets" -keyType="OBJ" -valueType="DBROW" - -default = "dbrows.varrock_teleport_tablet" - -[enum.values] -"items.poh_tablet_varrockteleport" = "dbrows.varrock_teleport_tablet" -"items.poh_tablet_lumbridgeteleport" = "dbrows.lumbridge_teleport_tablet" -"items.poh_tablet_faladorteleport" = "dbrows.falador_teleport_tablet" -"items.poh_tablet_camelotteleport" = "dbrows.camelot_teleport_tablet" -"items.poh_tablet_kourendteleport" = "dbrows.kourend_castle_teleport_tablet" -"items.poh_tablet_ardougneteleport" = "dbrows.ardougne_teleport_tablet" -"items.poh_tablet_fortisteleport" = "dbrows.civitas_illa_fortis_teleport_tablet" -"items.poh_tablet_watchtowerteleport" = "dbrows.watchtower_teleport_tablet" - -"items.teletab_lumbridge" = "dbrows.arceuus_library_teleport_tablet" -"items.teletab_draynor" = "dbrows.draynor_manor_teleport_tablet" -"items.teletab_battlefront" = "dbrows.battlefront_teleport_tablet" -"items.teletab_mind_altar" = "dbrows.mind_altar_teleport_tablet" -"items.teletab_salve" = "dbrows.salve_graveyard_teleport_tablet" -"items.teletab_fenk" = "dbrows.fenkenstrains_castle_teleport_tablet" -"items.teletab_westardy" = "dbrows.west_ardougne_teleport_tablet" -"items.teletab_harmony" = "dbrows.harmony_island_teleport_tablet" -"items.teletab_cemetery" = "dbrows.cemetery_teleport_tablet" -"items.teletab_barrows" = "dbrows.barrows_teleport_tablet" -"items.teletab_ape" = "dbrows.ape_atoll_teleport_tablet" - -"items.paddewwa_teleport" = "dbrows.paddewwa_teleport_tablet" -"items.senntisten_teleport" = "dbrows.senntisten_teleport_tablet" -"items.kharyrll_teleport" = "dbrows.kharyrll_teleport_tablet" -"items.lassar_teleport" = "dbrows.lassar_teleport_tablet" -"items.dareeyak_teleport" = "dbrows.dareeyak_teleport_tablet" -"items.carrallanger_teleport" = "dbrows.carrallanger_teleport_tablet" -"items.annakarl_teleport" = "dbrows.annakarl_teleport_tablet" -"items.ghorrock_teleport" = "dbrows.ghorrock_teleport_tablet" - -"items.moonclan_teleport" = "dbrows.moonclan_teleport_tablet" -"items.ourania_teleport" = "dbrows.ourania_teleport_tablet" -"items.waterbirth_teleport" = "dbrows.waterbirth_teleport_tablet" -"items.barbarian_teleport" = "dbrows.barbarian_teleport_tablet" -"items.khazard_teleport" = "dbrows.khazard_teleport_tablet" -"items.fishing_guild_teleport" = "dbrows.fishing_guild_teleport_tablet" -"items.catherby_teleport" = "dbrows.catherby_teleport_tablet" -"items.ice_plateau_teleport" = "dbrows.ice_plateau_teleport_tablet" \ No newline at end of file diff --git a/game-server/src/main/kotlin/org/alter/game/util/DbHelper.kt b/game-server/src/main/kotlin/org/alter/game/util/DbHelper.kt index d1d9cfb7..2bbb93fa 100644 --- a/game-server/src/main/kotlin/org/alter/game/util/DbHelper.kt +++ b/game-server/src/main/kotlin/org/alter/game/util/DbHelper.kt @@ -7,6 +7,7 @@ import dev.openrune.definition.util.VarType import org.alter.game.util.vars.BooleanVarType import org.alter.game.util.vars.VarTypeImpl import org.alter.rscm.RSCM.asRSCM +import java.util.concurrent.ConcurrentHashMap fun DbHelper.column(name: String, type: VarTypeImpl): V = getNValue(name, type, 0) @@ -104,6 +105,43 @@ class DbHelper private constructor(private val row: DBRowType) { } companion object { + + fun table(table: String): List { + require(table.startsWith("tables.")) { "Expected table reference to start with 'tables.', got '$table'" } + + return DbQueryCache.getTable(table) { + val tableId = table.asRSCM() + ServerCacheManager.getRows() + .asSequence() + .filter { it.value.tableId == tableId } + .map { DbHelper(it.value) } + .distinctBy { it.id } + .toList() + } + } + + fun dbFind(column: String, value: V, type: VarTypeImpl): List { + require(column.startsWith("columns.")) { "Expected column reference starting with 'columns.', got '$column'" } + + return DbQueryCache.getColumn(column, value, type) { + val tableName = "tables." + column.removePrefix("columns.").substringBefore(':') + val tableId = tableName.asRSCM() + val columnId = column.asRSCM() and 0xFFFF + + ServerCacheManager.getRows() + .asSequence() + .filter { it.value.tableId == tableId } + .filter { (_, row) -> + val col = row.columns[columnId] ?: return@filter false + val values = col.values ?: return@filter false + values.any { raw -> type.convertTo(raw as K) == value } + } + .map { (_, row) -> DbHelper(row) } + .distinctBy { it.id } + .toList() + } + } + private fun load(rowId: Int): DbHelper = ServerCacheManager.getDbrow(rowId)?.let(::DbHelper) ?: throw NoSuchElementException("DBRow $rowId not found") @@ -112,3 +150,22 @@ class DbHelper private constructor(private val row: DBRowType) { fun row(rowId: Int): DbHelper = load(rowId) } } + +object DbQueryCache { + private val tableCache = ConcurrentHashMap>() + private val columnCache = ConcurrentHashMap>, List>() + + fun getTable(table: String, supplier: () -> List): List { + return tableCache.computeIfAbsent(table) { supplier() } + } + + fun getColumn(column: String, value: V, type: VarTypeImpl, supplier: () -> List): List { + val key = Triple(column, value as Any, type as VarTypeImpl<*, *>) + return columnCache.computeIfAbsent(key) { supplier() } + } + + fun clear() { + tableCache.clear() + columnCache.clear() + } +} \ No newline at end of file From e5913a56f0abe6dec3548dd83ba1d2aa11b1d06d Mon Sep 17 00:00:00 2001 From: Mark7625 <72366279+Mark7625@users.noreply.github.com> Date: Wed, 29 Oct 2025 19:12:27 +0000 Subject: [PATCH 4/4] Working Teleport Tablets --- build.gradle.kts | 2 +- cache/src/main/kotlin/org/alter/CacheTools.kt | 1 - .../main/kotlin/org/alter/impl/TeleTabs.kt | 219 +++++++++--------- .../items/teleports/TeleportTabEvents.kt | 77 ++++++ .../main/kotlin/org/alter/api/ext/PawnExt.kt | 5 + .../consumables/teletabs/TeleportTabPlugin.kt | 82 ------- .../alter/plugins/content/magic/PawnExt.kt | 6 +- .../main/kotlin/org/alter/game/model/Tile.kt | 48 ++++ .../org/alter/game/model/entity/Player.kt | 2 +- .../org/alter/game/pluginnew/MenuOption.kt | 13 +- .../kotlin/org/alter/game/util/DbHelper.kt | 49 ++++ 11 files changed, 300 insertions(+), 204 deletions(-) create mode 100644 content/src/main/kotlin/org/alter/items/teleports/TeleportTabEvents.kt delete mode 100644 game-plugins/src/main/kotlin/org/alter/plugins/content/items/consumables/teletabs/TeleportTabPlugin.kt diff --git a/build.gradle.kts b/build.gradle.kts index b6544572..ce702c3e 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -22,7 +22,7 @@ allprojects { val lib = rootProject.project.libs dependencies { - implementation("dev.or2:all:2.2.6") + implementation("dev.or2:all:2.2.7") implementation(lib.kotlin.logging) implementation(lib.logback.classic) implementation(lib.fastutil) diff --git a/cache/src/main/kotlin/org/alter/CacheTools.kt b/cache/src/main/kotlin/org/alter/CacheTools.kt index 6d11ec38..263dd679 100644 --- a/cache/src/main/kotlin/org/alter/CacheTools.kt +++ b/cache/src/main/kotlin/org/alter/CacheTools.kt @@ -40,7 +40,6 @@ fun downloadRev(type : TaskType) { logger.error { "Using Revision: $rev" } val tasks : List = listOf( - PackConfig(File("../data/raw-cache/configs/")), PackServerConfig(), ).toMutableList() diff --git a/cache/src/main/kotlin/org/alter/impl/TeleTabs.kt b/cache/src/main/kotlin/org/alter/impl/TeleTabs.kt index d443cac9..baf21d06 100644 --- a/cache/src/main/kotlin/org/alter/impl/TeleTabs.kt +++ b/cache/src/main/kotlin/org/alter/impl/TeleTabs.kt @@ -5,192 +5,195 @@ import dev.openrune.definition.util.VarType object TeleTabs { + const val COL_ITEM = 0 + const val COL_MAGIC_LEVEL = 1 + const val COL_LOCATION = 2 + fun teleTabs() = dbTable("tables.teleport_tablets") { - column("item", 0, arrayOf(VarType.OBJ)) - column("magic_level", 1, arrayOf(VarType.INT)) - column("location", 2, arrayOf(VarType.INT)) + + column("item", COL_ITEM, arrayOf(VarType.OBJ)) + column("magic_level", COL_MAGIC_LEVEL, arrayOf(VarType.INT)) + column("location", COL_LOCATION, arrayOf(VarType.INT)) // Standard Teleport Tablets row("dbrows.varrock_teleport_tablet") { - columnRSCM(0, arrayOf("items.poh_tablet_varrockteleport")) - column(1, arrayOf(25)) - column(2, arrayOf(1)) + columnRSCM(COL_ITEM, arrayOf("items.poh_tablet_varrockteleport")) + column(COL_MAGIC_LEVEL, arrayOf(25)) } row("dbrows.lumbridge_teleport_tablet") { - columnRSCM(0, arrayOf("items.poh_tablet_lumbridgeteleport")) - column(1, arrayOf(31)) - column(2, arrayOf(1)) + columnRSCM(COL_ITEM, arrayOf("items.poh_tablet_lumbridgeteleport")) + column(COL_MAGIC_LEVEL, arrayOf(31)) + column(COL_LOCATION, arrayOf(52776082)) } row("dbrows.falador_teleport_tablet") { - columnRSCM(0, arrayOf("items.poh_tablet_faladorteleport")) - column(1, arrayOf(37)) - column(2, arrayOf(1)) + columnRSCM(COL_ITEM, arrayOf("items.poh_tablet_faladorteleport")) + column(COL_MAGIC_LEVEL, arrayOf(37)) + column(COL_LOCATION, arrayOf(48565554)) } row("dbrows.camelot_teleport_tablet") { - columnRSCM(0, arrayOf("items.poh_tablet_camelotteleport")) - column(1, arrayOf(45)) - column(2, arrayOf(1)) + columnRSCM(COL_ITEM, arrayOf("items.poh_tablet_camelotteleport")) + column(COL_MAGIC_LEVEL, arrayOf(45)) + column(COL_LOCATION, arrayOf(45174167)) } row("dbrows.kourend_castle_teleport_tablet") { - columnRSCM(0, arrayOf("items.poh_tablet_kourendteleport")) - column(1, arrayOf(48)) - column(2, arrayOf(1)) + columnRSCM(COL_ITEM, arrayOf("items.poh_tablet_kourendteleport")) + column(COL_MAGIC_LEVEL, arrayOf(48)) + column(COL_LOCATION, arrayOf(26857052)) } row("dbrows.ardougne_teleport_tablet") { - columnRSCM(0, arrayOf("items.poh_tablet_ardougneteleport")) - column(1, arrayOf(51)) - column(2, arrayOf(1)) + columnRSCM(COL_ITEM, arrayOf("items.poh_tablet_ardougneteleport")) + column(COL_MAGIC_LEVEL, arrayOf(51)) + column(COL_LOCATION, arrayOf(43617513)) } row("dbrows.civitas_illa_fortis_teleport_tablet") { - columnRSCM(0, arrayOf("items.poh_tablet_fortisteleport")) - column(1, arrayOf(54)) - column(2, arrayOf(1)) + columnRSCM(COL_ITEM, arrayOf("items.poh_tablet_fortisteleport")) + column(COL_MAGIC_LEVEL, arrayOf(54)) + column(COL_LOCATION, arrayOf(27544637)) } row("dbrows.watchtower_teleport_tablet") { - columnRSCM(0, arrayOf("items.poh_tablet_watchtowerteleport")) - column(1, arrayOf(58)) - column(2, arrayOf(1)) + columnRSCM(COL_ITEM, arrayOf("items.poh_tablet_watchtowerteleport")) + column(COL_MAGIC_LEVEL, arrayOf(58)) } // Arceuus Teleport Tablets row("dbrows.arceuus_library_teleport_tablet") { - columnRSCM(0, arrayOf("items.teletab_lumbridge")) - column(1, arrayOf(6)) - column(2, arrayOf(1)) + columnRSCM(COL_ITEM, arrayOf("items.teletab_lumbridge")) + column(COL_MAGIC_LEVEL, arrayOf(6)) + column(COL_LOCATION, arrayOf(26758910)) } row("dbrows.draynor_manor_teleport_tablet") { - columnRSCM(0, arrayOf("items.teletab_draynor")) - column(1, arrayOf(17)) - column(2, arrayOf(1)) + columnRSCM(COL_ITEM, arrayOf("items.teletab_draynor")) + column(COL_MAGIC_LEVEL, arrayOf(17)) + column(COL_LOCATION, arrayOf(50924825)) } row("dbrows.battlefront_teleport_tablet") { - columnRSCM(0, arrayOf("items.teletab_battlefront")) - column(1, arrayOf(23)) - column(2, arrayOf(1)) + columnRSCM(COL_ITEM, arrayOf("items.teletab_battlefront")) + column(COL_MAGIC_LEVEL, arrayOf(23)) + column(COL_LOCATION, arrayOf(22072988)) } row("dbrows.mind_altar_teleport_tablet") { - columnRSCM(0, arrayOf("items.teletab_mind_altar")) - column(1, arrayOf(28)) - column(2, arrayOf(1)) + columnRSCM(COL_ITEM, arrayOf("items.teletab_mind_altar")) + column(COL_MAGIC_LEVEL, arrayOf(28)) + column(COL_LOCATION, arrayOf(48827829)) } row("dbrows.salve_graveyard_teleport_tablet") { - columnRSCM(0, arrayOf("items.teletab_salve")) - column(1, arrayOf(40)) - column(2, arrayOf(1)) + columnRSCM(COL_ITEM, arrayOf("items.teletab_salve")) + column(COL_MAGIC_LEVEL, arrayOf(40)) + column(COL_LOCATION, arrayOf(56233349)) } row("dbrows.fenkenstrains_castle_teleport_tablet") { - columnRSCM(0, arrayOf("items.teletab_fenk")) - column(1, arrayOf(48)) - column(2, arrayOf(1)) + columnRSCM(COL_ITEM, arrayOf("items.teletab_fenk")) + column(COL_MAGIC_LEVEL, arrayOf(48)) + column(COL_LOCATION, arrayOf(58133961)) } row("dbrows.west_ardougne_teleport_tablet") { - columnRSCM(0, arrayOf("items.teletab_westardy")) - column(1, arrayOf(61)) - column(2, arrayOf(1)) + columnRSCM(COL_ITEM, arrayOf("items.teletab_westardy")) + column(COL_MAGIC_LEVEL, arrayOf(61)) + column(COL_LOCATION, arrayOf(40963291)) } row("dbrows.harmony_island_teleport_tablet") { - columnRSCM(0, arrayOf("items.teletab_harmony")) - column(1, arrayOf(65)) - column(2, arrayOf(1)) + columnRSCM(COL_ITEM, arrayOf("items.teletab_harmony")) + column(COL_MAGIC_LEVEL, arrayOf(65)) + column(COL_LOCATION, arrayOf(62212915)) } row("dbrows.cemetery_teleport_tablet") { - columnRSCM(0, arrayOf("items.teletab_cemetery")) - column(1, arrayOf(71)) - column(2, arrayOf(1)) + columnRSCM(COL_ITEM, arrayOf("items.teletab_cemetery")) + column(COL_MAGIC_LEVEL, arrayOf(71)) + column(COL_LOCATION, arrayOf(48828083)) } row("dbrows.barrows_teleport_tablet") { - columnRSCM(0, arrayOf("items.teletab_barrows")) - column(1, arrayOf(83)) - column(2, arrayOf(1)) + columnRSCM(COL_ITEM, arrayOf("items.teletab_barrows")) + column(COL_MAGIC_LEVEL, arrayOf(83)) + column(COL_LOCATION, arrayOf(58412274)) } row("dbrows.ape_atoll_teleport_tablet") { - columnRSCM(0, arrayOf("items.teletab_ape")) - column(1, arrayOf(90)) - column(2, arrayOf(1)) + columnRSCM(COL_ITEM, arrayOf("items.teletab_ape")) + column(COL_MAGIC_LEVEL, arrayOf(90)) + column(COL_LOCATION, arrayOf(45409166)) } // Ancient Magicks Teleport Tablets row("dbrows.paddewwa_teleport_tablet") { - columnRSCM(0, arrayOf("items.tablet_paddewa")) - column(1, arrayOf(54)) - column(2, arrayOf(1)) + columnRSCM(COL_ITEM, arrayOf("items.tablet_paddewa")) + column(COL_MAGIC_LEVEL, arrayOf(54)) + column(COL_LOCATION, arrayOf(50800283)) } row("dbrows.senntisten_teleport_tablet") { - columnRSCM(0, arrayOf("items.tablet_senntisten")) - column(1, arrayOf(60)) - column(2, arrayOf(1)) + columnRSCM(COL_ITEM, arrayOf("items.tablet_senntisten")) + column(COL_MAGIC_LEVEL, arrayOf(60)) + column(COL_LOCATION, arrayOf(54398217)) } row("dbrows.kharyrll_teleport_tablet") { - columnRSCM(0, arrayOf("items.tablet_kharyll")) - column(1, arrayOf(66)) - column(2, arrayOf(1)) + columnRSCM(COL_ITEM, arrayOf("items.tablet_kharyll")) + column(COL_MAGIC_LEVEL, arrayOf(66)) + column(COL_LOCATION, arrayOf(57249169)) } row("dbrows.lassar_teleport_tablet") { - columnRSCM(0, arrayOf("items.tablet_lassar")) - column(1, arrayOf(72)) - column(2, arrayOf(1)) + columnRSCM(COL_ITEM, arrayOf("items.tablet_lassar")) + column(COL_MAGIC_LEVEL, arrayOf(72)) + column(COL_LOCATION, arrayOf(49188238)) } row("dbrows.dareeyak_teleport_tablet") { - columnRSCM(0, arrayOf("items.tablet_dareeyak")) - column(1, arrayOf(78)) - column(2, arrayOf(1)) + columnRSCM(COL_ITEM, arrayOf("items.tablet_dareeyak")) + column(COL_MAGIC_LEVEL, arrayOf(78)) + column(COL_LOCATION, arrayOf(48631408)) } row("dbrows.carrallanger_teleport_tablet") { - columnRSCM(0, arrayOf("items.tablet_carrallangar")) - column(1, arrayOf(84)) - column(2, arrayOf(1)) + columnRSCM(COL_ITEM, arrayOf("items.tablet_carrallangar")) + column(COL_MAGIC_LEVEL, arrayOf(84)) + column(COL_LOCATION, arrayOf(51744338)) } row("dbrows.annakarl_teleport_tablet") { - columnRSCM(0, arrayOf("items.tablet_annakarl")) - column(1, arrayOf(90)) - column(2, arrayOf(1)) + columnRSCM(COL_ITEM, arrayOf("items.tablet_annakarl")) + column(COL_MAGIC_LEVEL, arrayOf(90)) + column(COL_LOCATION, arrayOf(53858096)) } row("dbrows.ghorrock_teleport_tablet") { - columnRSCM(0, arrayOf("items.tablet_ghorrock")) - column(1, arrayOf(96)) - column(2, arrayOf(1)) + columnRSCM(COL_ITEM, arrayOf("items.tablet_ghorrock")) + column(COL_MAGIC_LEVEL, arrayOf(96)) + column(COL_LOCATION, arrayOf(48729889)) } // Lunar Teleport Tablets row("dbrows.moonclan_teleport_tablet") { - columnRSCM(0, arrayOf("items.lunar_tablet_moonclan_teleport")) - column(1, arrayOf(69)) - column(2, arrayOf(1)) + columnRSCM(COL_ITEM, arrayOf("items.lunar_tablet_moonclan_teleport")) + column(COL_MAGIC_LEVEL, arrayOf(69)) + column(COL_LOCATION, arrayOf(34623307)) } row("dbrows.ourania_teleport_tablet") { - columnRSCM(0, arrayOf("items.lunar_tablet_ourania_teleport")) - column(1, arrayOf(71)) - column(2, arrayOf(1)) + columnRSCM(COL_ITEM, arrayOf("items.lunar_tablet_ourania_teleport")) + column(COL_MAGIC_LEVEL, arrayOf(71)) + column(COL_LOCATION, arrayOf(40438958)) } row("dbrows.waterbirth_teleport_tablet") { - columnRSCM(0, arrayOf("items.lunar_tablet_waterbirth_teleport")) - column(1, arrayOf(72)) - column(2, arrayOf(1)) + columnRSCM(COL_ITEM, arrayOf("items.lunar_tablet_waterbirth_teleport")) + column(COL_MAGIC_LEVEL, arrayOf(72)) + column(COL_LOCATION, arrayOf(41717420)) } row("dbrows.barbarian_teleport_tablet") { - columnRSCM(0, arrayOf("items.lunar_tablet_barbarian_teleport")) - column(1, arrayOf(75)) - column(2, arrayOf(1)) + columnRSCM(COL_ITEM, arrayOf("items.lunar_tablet_barbarian_teleport")) + column(COL_MAGIC_LEVEL, arrayOf(75)) + column(COL_LOCATION, arrayOf(41668081)) } row("dbrows.khazard_teleport_tablet") { - columnRSCM(0, arrayOf("items.lunar_tablet_khazard_teleport")) - column(1, arrayOf(78)) - column(2, arrayOf(1)) + columnRSCM(COL_ITEM, arrayOf("items.lunar_tablet_khazard_teleport")) + column(COL_MAGIC_LEVEL, arrayOf(78)) + column(COL_LOCATION, arrayOf(43191391)) } row("dbrows.fishing_guild_teleport_tablet") { - columnRSCM(0, arrayOf("items.lunar_tablet_fishing_guild_teleport")) - column(1, arrayOf(85)) - column(2, arrayOf(1)) + columnRSCM(COL_ITEM, arrayOf("items.lunar_tablet_fishing_guild_teleport")) + column(COL_MAGIC_LEVEL, arrayOf(85)) + column(COL_LOCATION, arrayOf(42814783)) } row("dbrows.catherby_teleport_tablet") { - columnRSCM(0, arrayOf("items.lunar_tablet_catherby_teleport")) - column(1, arrayOf(87)) - column(2, arrayOf(1)) + columnRSCM(COL_ITEM, arrayOf("items.lunar_tablet_catherby_teleport")) + column(COL_MAGIC_LEVEL, arrayOf(87)) + column(COL_LOCATION, arrayOf(45895033)) } row("dbrows.ice_plateau_teleport_tablet") { - columnRSCM(0, arrayOf("items.lunar_tablet_ice_plateau_teleport")) - column(1, arrayOf(89)) - column(2, arrayOf(1)) + columnRSCM(COL_ITEM, arrayOf("items.lunar_tablet_ice_plateau_teleport")) + column(COL_MAGIC_LEVEL, arrayOf(89)) + column(COL_LOCATION, arrayOf(48746338)) } } } \ No newline at end of file diff --git a/content/src/main/kotlin/org/alter/items/teleports/TeleportTabEvents.kt b/content/src/main/kotlin/org/alter/items/teleports/TeleportTabEvents.kt new file mode 100644 index 00000000..b144667e --- /dev/null +++ b/content/src/main/kotlin/org/alter/items/teleports/TeleportTabEvents.kt @@ -0,0 +1,77 @@ +package org.alter.items.teleports + +import org.alter.api.ext.message +import org.alter.api.ext.prepareForTeleport +import org.alter.game.model.LockState +import org.alter.game.model.Tile +import org.alter.game.model.entity.Player +import org.alter.game.model.move.moveTo +import org.alter.game.pluginnew.MenuOption +import org.alter.game.pluginnew.PluginEvent +import org.alter.game.pluginnew.event.impl.ItemClickEvent +import org.alter.game.util.DbHelper.Companion.table +import org.alter.game.util.column +import org.alter.game.util.columnOptional +import org.alter.game.util.vars.IntType +import org.alter.game.util.vars.ObjType +import org.alter.rscm.RSCM.asRSCM + +class TeleportTabEvents : PluginEvent() { + + override fun init() { + table("tables.teleport_tablets").forEach { tablet -> + val itemId = tablet.column("columns.teleport_tablets:item", ObjType) + val location = tablet.columnOptional("columns.teleport_tablets:location", IntType) + + on { + where { item == itemId } + then { + when (option) { + MenuOption.OP2 -> location?.let { + teleport(player, item, it) + } ?: teleportSpecial(player, item, MenuOption.OP3) + + MenuOption.OP3,MenuOption.OP4 -> teleportSpecial(player, item, option) + else -> player.message("Unhandled teleport tablet option: ${option.name.lowercase()} ($item)") + } + } + } + } + } + + private fun teleportSpecial(player: Player, item: Int, option: MenuOption) { + val targetLocation = when { + item == "items.poh_tablet_varrockteleport".asRSCM() && option == MenuOption.OP3 -> Tile(3213, 3424) + item == "items.poh_tablet_watchtowerteleport".asRSCM() && option == MenuOption.OP3 -> Tile(2549, 3112, 2) + item == "items.poh_tablet_varrockteleport".asRSCM() && option == MenuOption.OP4 -> Tile(3165, 3479) + item == "items.poh_tablet_watchtowerteleport".asRSCM() && option == MenuOption.OP4 -> Tile(2584, 3097) + else -> null + } + + targetLocation?.let { teleport(player, item, it.as30BitInteger) } + } + + private fun teleport(player: Player, item: Int, location: Int) { + player.queue { + if (!player.inventory.contains(item)) return@queue + + player.inventory.remove(item) + player.prepareForTeleport() + player.lock = LockState.FULL_WITH_DAMAGE_IMMUNITY + + player.animate("sequences.poh_smash_magic_tablet".asRSCM(), delay = 16) + player.playSound("jingles.artistry".asRSCM(), volume = 1, delay = 15) + + wait(cycles = 3) + player.graphic("spotanims.poh_absorb_tablet_magic".asRSCM()) + player.animate("sequences.poh_absorb_tablet_teleport".asRSCM()) + + wait(cycles = 2) + player.animate(-1) + player.unlock() + + val destination = Tile.from30BitHash(location).radius(2).random() + player.moveTo(destination) + } + } +} diff --git a/game-api/src/main/kotlin/org/alter/api/ext/PawnExt.kt b/game-api/src/main/kotlin/org/alter/api/ext/PawnExt.kt index 29cd24b3..2fd2895e 100644 --- a/game-api/src/main/kotlin/org/alter/api/ext/PawnExt.kt +++ b/game-api/src/main/kotlin/org/alter/api/ext/PawnExt.kt @@ -15,6 +15,11 @@ import org.alter.game.model.move.stopMovement import org.alter.game.model.timer.FROZEN_TIMER import org.alter.game.model.timer.STUN_TIMER +fun Pawn.prepareForTeleport() { + resetInteractions() + clearHits() +} + fun Pawn.getCommandArgs(): Array = attr[COMMAND_ARGS_ATTR]!! fun Pawn.getInteractingSlot(): Int = attr[INTERACTING_SLOT_ATTR]!! diff --git a/game-plugins/src/main/kotlin/org/alter/plugins/content/items/consumables/teletabs/TeleportTabPlugin.kt b/game-plugins/src/main/kotlin/org/alter/plugins/content/items/consumables/teletabs/TeleportTabPlugin.kt deleted file mode 100644 index 487033c9..00000000 --- a/game-plugins/src/main/kotlin/org/alter/plugins/content/items/consumables/teletabs/TeleportTabPlugin.kt +++ /dev/null @@ -1,82 +0,0 @@ -package org.alter.plugins.content.items.consumables.teletabs - -import org.alter.api.ext.* -import org.alter.game.* -import org.alter.game.model.* -import org.alter.game.model.entity.* -import org.alter.game.model.move.moveTo -import org.alter.game.model.queue.* -import org.alter.game.plugin.* -import org.alter.plugins.content.magic.TeleportType -import org.alter.plugins.content.magic.canTeleport -import org.alter.plugins.content.magic.prepareForTeleport -import org.alter.rscm.RSCM.getRSCM - -class TeleportTabPlugin( - r: PluginRepository, - world: World, - server: Server -) : KotlinPlugin(r, world, server) { - - private val LOCATIONS = - mapOf( - "items.poh_tablet_varrockteleport" to Area(3210, 3423, 3216, 3425), - "items.poh_tablet_faladorteleport" to Area(2961, 3376, 2969, 3385), - "items.poh_tablet_lumbridgeteleport" to Area(3221, 3218, 3222, 3219), - "items.poh_tablet_camelotteleport" to Area(2756, 3476, 2758, 3480), - "items.poh_tablet_ardougneteleport" to Area(2659, 3300, 2665, 3310), - "items.poh_tablet_watchtowerteleport" to Area(2551, 3113, 2553, 3116), - "items.nzone_teletab_rimmington" to Area(2953, 3222, 2956, 3226), - "items.nzone_teletab_taverley" to Area(2893, 3463, 2894, 3467), - "items.nzone_teletab_pollnivneach" to Area(3338, 3003, 3342, 3004), - "items.nzone_teletab_kourend" to Area(1742, 3515, 1743, 3518), - "items.nzone_teletab_rellekka" to Area(2668, 3631, 2671, 3632), - "items.nzone_teletab_brimhaven" to Area(2757, 3176, 2758, 3179), - "items.nzone_teletab_yanille" to Area(2542, 3095, 2545, 3096), - "items.nzone_teletab_trollheim" to Area(2888, 3678, 2893, 3681), - "items.lunar_tablet_catherby_teleport" to Area(2800, 3449, 2801, 3450), - "items.lunar_tablet_barbarian_teleport" to Area(2543, 3570, 2544, 3571), - // Items.LUMBRIDGE_GRAVEYARD_TELEPORT to Area(1632, 3839, 1633, 3840), - "items.teletab_draynor" to Area(3108, 3352, 3108, 3352), - // Items.FELDIP_HILLS_TELEPORT to Area(2542, 2925, 2542, 2925), -> Teleport - "items.lunar_tablet_fishing_guild_teleport" to Area(2612, 3391, 2612, 3391), - "items.lunar_tablet_khazard_teleport" to Area(2637, 3166, 2637, 3166), - "items.teletab_mind_altar" to Area(2979, 3509, 2979, 3509), - // Items.LU - // @TODO Items.APE_ATOLL_TELEPORT , Need to have Monkey Madness and Receive 10th Squad Training from Daero - ) - - init { - LOCATIONS.forEach { item, endTile -> - onItemOption(item = item, option = "break") { - player.queue(TaskPriority.STRONG) { - player.teleport(this, endTile, getRSCM(item)) - } - } - } - } - -// Items.DIGSITE_TELEPORT to Tile(3324, 3411) -// Items.LUMBERYARD_TELEPORT to Tile(3302, 3488) - - suspend fun Player.teleport( - it: QueueTask, - endArea: Area, - tab: Int, - ) { - if (canTeleport(TeleportType.MODERN) && inventory.contains(tab)) { - inventory.remove(item = tab) - prepareForTeleport() - lock = LockState.FULL_WITH_DAMAGE_IMMUNITY - animate(id = 4069, delay = 16) - playSound(id = 965, volume = 1, delay = 15) - it.wait(cycles = 3) - graphic(id = 678) - animate(id = 4071) - it.wait(cycles = 2) - animate(id = -1) - unlock() - moveTo(tile = endArea.randomTile) - } - } -} diff --git a/game-plugins/src/main/kotlin/org/alter/plugins/content/magic/PawnExt.kt b/game-plugins/src/main/kotlin/org/alter/plugins/content/magic/PawnExt.kt index 7ce342da..f0d1c180 100644 --- a/game-plugins/src/main/kotlin/org/alter/plugins/content/magic/PawnExt.kt +++ b/game-plugins/src/main/kotlin/org/alter/plugins/content/magic/PawnExt.kt @@ -3,6 +3,7 @@ package org.alter.plugins.content.magic import dev.openrune.ServerCacheManager.getAnim import org.alter.api.ext.getWildernessLevel import org.alter.api.ext.message +import org.alter.api.ext.prepareForTeleport import org.alter.game.model.LockState import org.alter.game.model.Tile import org.alter.game.model.entity.Pawn @@ -27,11 +28,6 @@ fun Player.canTeleport(type: TeleportType): Boolean { return true } -fun Pawn.prepareForTeleport() { - resetInteractions() - clearHits() -} - fun Pawn.teleport( endTile: Tile, type: TeleportType, diff --git a/game-server/src/main/kotlin/org/alter/game/model/Tile.kt b/game-server/src/main/kotlin/org/alter/game/model/Tile.kt index 4f74245c..00e91135 100644 --- a/game-server/src/main/kotlin/org/alter/game/model/Tile.kt +++ b/game-server/src/main/kotlin/org/alter/game/model/Tile.kt @@ -5,6 +5,7 @@ import org.alter.game.model.region.Chunk import org.alter.game.model.region.ChunkCoords import kotlin.math.abs import kotlin.math.max +import kotlin.random.Random /** * A 3D point in the world. It wraps an internal bit-packed integer that @@ -190,6 +191,8 @@ value class Tile(val coordinate: Int) { operator fun plus(other: Tile): Tile = Tile(x + other.x, z + other.z, height + other.height) + fun radius(radius: Int): TileArea = TileArea(this, radius) + companion object { /** * The total amount of height levels that can be used in the game. @@ -217,3 +220,48 @@ value class Tile(val coordinate: Int) { } } } + +data class TileArea(val center: Tile, val radius: Int) : Iterable { + + val minX: Int get() = center.x - radius + val maxX: Int get() = center.x + radius + val minZ: Int get() = center.z - radius + val maxZ: Int get() = center.z + radius + val height: Int get() = center.height + + /** + * Returns all tiles within this square area. + */ + val tiles: List by lazy { + buildList { + for (x in minX..maxX) { + for (z in minZ..maxZ) { + add(Tile(x, z, height)) + } + } + } + } + + override fun iterator(): Iterator = tiles.iterator() + + /** + * Checks if a tile is inside this area. + */ + operator fun contains(tile: Tile): Boolean { + return tile.height == height && + tile.x in minX..maxX && + tile.z in minZ..maxZ + } + + /** + * Returns a random tile within this area. + */ + fun random(random: Random = Random): Tile { + val x = random.nextInt(minX, maxX + 1) + val z = random.nextInt(minZ, maxZ + 1) + return Tile(x, z, height) + } + + override fun toString(): String = + "TileArea(center=$center, radius=$radius, size=${tiles.size})" +} \ No newline at end of file diff --git a/game-server/src/main/kotlin/org/alter/game/model/entity/Player.kt b/game-server/src/main/kotlin/org/alter/game/model/entity/Player.kt index 740a2d80..5b409d77 100644 --- a/game-server/src/main/kotlin/org/alter/game/model/entity/Player.kt +++ b/game-server/src/main/kotlin/org/alter/game/model/entity/Player.kt @@ -614,7 +614,7 @@ open class Player(world: World) : Pawn(world) { write(MessageGame(type = 0, message = message)) } - internal fun playSound( + fun playSound( id: Int, volume: Int = 1, delay: Int = 0, diff --git a/game-server/src/main/kotlin/org/alter/game/pluginnew/MenuOption.kt b/game-server/src/main/kotlin/org/alter/game/pluginnew/MenuOption.kt index 86be2ee4..9d3cb2ea 100644 --- a/game-server/src/main/kotlin/org/alter/game/pluginnew/MenuOption.kt +++ b/game-server/src/main/kotlin/org/alter/game/pluginnew/MenuOption.kt @@ -1,12 +1,13 @@ package org.alter.game.pluginnew enum class MenuOption(val id: Int) { - OP1(0), - OP2(1), - OP3(2), - OP4(3), - OP5(4), - OP6(5), + OP0(0), + OP1(1), + OP2(2), + OP3(3), + OP4(4), + OP5(5), + OP6(6), OP7(7), OP8(8), OP9(9), diff --git a/game-server/src/main/kotlin/org/alter/game/util/DbHelper.kt b/game-server/src/main/kotlin/org/alter/game/util/DbHelper.kt index 2bbb93fa..af82c4c8 100644 --- a/game-server/src/main/kotlin/org/alter/game/util/DbHelper.kt +++ b/game-server/src/main/kotlin/org/alter/game/util/DbHelper.kt @@ -12,6 +12,11 @@ import java.util.concurrent.ConcurrentHashMap fun DbHelper.column(name: String, type: VarTypeImpl): V = getNValue(name, type, 0) + +fun DbHelper.columnOptional(name: String, type: VarTypeImpl): V? = + getNValueOrNull(name, type, 0) + + fun row(row: String) = DbHelper.row(row) /** @@ -42,6 +47,41 @@ fun DbHelper.multiColumn( return result } +fun DbHelper.multiColumnOptional( + columnName: String, + type1: VarTypeImpl, + type2: VarTypeImpl +): List> { + val column = try { + getColumn(columnName) + } catch (_: Exception) { + return emptyList() + } + + val values = column.column.values ?: return emptyList() + val result = mutableListOf>() + + var i = 0 + while (i < values.size - 1) { + val v1 = try { + column.get(i, type1) as V1 + } catch (_: Exception) { + null + } + + val v2 = try { + column.get(i + 1, type2) as V2 + } catch (_: Exception) { + null + } + + result.add(EnumPair(v1, v2)) + i += 2 + } + + return result +} + @Suppress("UNCHECKED_CAST") class DbHelper private constructor(private val row: DBRowType) { @@ -51,6 +91,15 @@ class DbHelper private constructor(private val row: DBRowType) { override fun toString(): String = "DbHelper(id=$id, table=$tableId, columns=${row.columns.keys.joinToString()})" + fun DbHelper.getNValueOrNull(name: String, type: VarTypeImpl, index: Int = 0): V? = + try { + val value = getColumn(name).get(index, type) + @Suppress("UNCHECKED_CAST") + if (type is BooleanVarType) type.convertToAny(value) as V else type.convertTo(value as K) + } catch (_: Exception) { + null + } + fun getNValue(name: String, type: VarTypeImpl, index: Int): V { val value = getColumn(name).get(index, type) @Suppress("UNCHECKED_CAST")