Repository reorganisation

Unified kotlin and java into just src/main
Unified the rs09 and core packages
Took all content out of the core package, and placed it into the new content package
Reorganised all source code relating to content to be easier to find and explore
This commit is contained in:
Ceikry
2023-01-26 13:59:28 +00:00
committed by Ryan
parent e4b799c44a
commit a100affda2
3156 changed files with 24205 additions and 30585 deletions
@@ -0,0 +1,163 @@
package content.region.karamja.quest.tribaltotem
import core.game.dialogue.book.BookLine
import core.game.dialogue.DialoguePlugin
import core.game.dialogue.book.Book
import core.game.dialogue.book.Page
import core.game.dialogue.book.PageSet
import core.game.node.entity.player.Player
import core.plugin.Initializable
/**
* This was some code for a post-tutorial RSPS guide book a long ass
* time ago, but it was using the ID for the guide book for Tribal Totem
* and I kind of need that, bro
*
* @author Splinter
* @author Phil
*/
@Initializable
class ArdougneGuideBook : core.game.dialogue.book.Book {
/**
* Constructs a new `ShieldofArravBook` `Object`.
*/
constructor(player: Player?) : super(player, "Ardougne Guide Book", 1856, *PAGES) {}
/**
* Constructs a new `ShieldofArravBook` `Object`.
*/
constructor() {
/**
* empty.
*/
}
override fun finish() {}
override fun display(set: Array<core.game.dialogue.book.Page>) {
player.lock()
player.interfaceManager.open(getInterface())
player.packetDispatch.sendString("Previous", getInterface().id, 77)
player.packetDispatch.sendString("Next", getInterface().id, 78)
for (i in 55..76) {
player.packetDispatch.sendString("", getInterface().id, i)
}
player.packetDispatch.sendString(getName(), getInterface().id, 6)
for (page in set) {
for (line in page.lines) {
player.packetDispatch.sendString(line.message, getInterface().id, line.child)
}
}
val lastPage = index == sets.size - 1
if (lastPage) {
finish()
}
player.unlock()
}
override fun newInstance(player: Player): core.game.dialogue.DialoguePlugin {
return ArdougneGuideBook(player)
}
override fun getIds(): IntArray {
return intArrayOf(ID)
}
companion object {
/**
* Represents the book id
*/
var ID = 387454
/**
* Represents the array of pages for this book.
*/
private val PAGES = arrayOf(
core.game.dialogue.book.PageSet(
core.game.dialogue.book.Page(
core.game.dialogue.book.BookLine("Introduction", 57),
core.game.dialogue.book.BookLine("This book is your guide to", 59),
core.game.dialogue.book.BookLine("the vibrant city of Ardougne.", 60),
core.game.dialogue.book.BookLine("Ardougne is known as an", 61),
core.game.dialogue.book.BookLine("exciting modern city located", 62),
core.game.dialogue.book.BookLine("on the sun drenched southern", 63),
core.game.dialogue.book.BookLine("coast of Kandarin", 64),
),
core.game.dialogue.book.Page(
core.game.dialogue.book.BookLine("Ardougne: City of Shopping!", 66),
core.game.dialogue.book.BookLine("Come sample the delights of", 67),
core.game.dialogue.book.BookLine("the Ardougne market - the", 68),
core.game.dialogue.book.BookLine("biggest in the known world!", 69),
core.game.dialogue.book.BookLine("From spices to silk, there", 70),
core.game.dialogue.book.BookLine("is something here for", 71),
core.game.dialogue.book.BookLine("everybody! Other popular", 72),
core.game.dialogue.book.BookLine("shopping destinations in", 73),
core.game.dialogue.book.BookLine("the area include the Armoury", 74),
core.game.dialogue.book.BookLine("and the ever popular", 75),
core.game.dialogue.book.BookLine("Adventurers' supply store.", 76)
)
),
core.game.dialogue.book.PageSet(
core.game.dialogue.book.Page(
core.game.dialogue.book.BookLine("Ardougne: City of Fun!", 55),
core.game.dialogue.book.BookLine("If you're looking for", 56),
core.game.dialogue.book.BookLine("entertainment in Ardougne,", 57),
core.game.dialogue.book.BookLine("why not pay a visit to the", 58),
core.game.dialogue.book.BookLine("Ardougne City zoo? Or relax", 59),
core.game.dialogue.book.BookLine("with a drink in the ever", 60),
core.game.dialogue.book.BookLine("popular Flying Horse Inn?", 61),
core.game.dialogue.book.BookLine("And for the adventurous,", 62),
core.game.dialogue.book.BookLine("there are always rats to be", 63),
core.game.dialogue.book.BookLine("slaughtered in the expansive", 64),
core.game.dialogue.book.BookLine("and vermin-ridden sewers", 65)
),
core.game.dialogue.book.Page(
core.game.dialogue.book.BookLine("There is something truly", 66),
core.game.dialogue.book.BookLine("for everybody here!", 67)
)
),
core.game.dialogue.book.PageSet(
core.game.dialogue.book.Page(
core.game.dialogue.book.BookLine("Ardougne: City of History!", 55),
core.game.dialogue.book.BookLine("Ardougne is renowned as an", 56),
core.game.dialogue.book.BookLine("important city of historical", 57),
core.game.dialogue.book.BookLine("interest. One historic building", 58),
core.game.dialogue.book.BookLine("is the magnificent Handelmort", 59),
core.game.dialogue.book.BookLine("Mansion, currently owned by", 60),
core.game.dialogue.book.BookLine("Lord Francis Kurt Handelmort.", 61),
core.game.dialogue.book.BookLine("Also of historical interest is", 62),
core.game.dialogue.book.BookLine("Ardougne Castle in the east of", 63),
core.game.dialogue.book.BookLine("the city recently opened to the", 64),
core.game.dialogue.book.BookLine("public. And of course the Holy", 65)
),
core.game.dialogue.book.Page(
core.game.dialogue.book.BookLine("Order of Paladins still wander", 66),
core.game.dialogue.book.BookLine("the streets of Ardougne, and", 67),
core.game.dialogue.book.BookLine("are often of interest to", 68),
core.game.dialogue.book.BookLine("tourists.", 69)
)
),
core.game.dialogue.book.PageSet(
core.game.dialogue.book.Page(
core.game.dialogue.book.BookLine("Further Fields", 55),
core.game.dialogue.book.BookLine("", 56),
core.game.dialogue.book.BookLine("The area surrounding Ardougne", 57),
core.game.dialogue.book.BookLine("is also of great interest to", 58),
core.game.dialogue.book.BookLine("the cultural tourist. If you", 59),
core.game.dialogue.book.BookLine("want to go further afield, why", 60),
core.game.dialogue.book.BookLine("not have a look at the ominous", 61),
core.game.dialogue.book.BookLine("Pillars of Zanash, the", 62),
core.game.dialogue.book.BookLine("mysterious marble pillars", 63),
core.game.dialogue.book.BookLine("located just West of the city?", 64),
core.game.dialogue.book.BookLine("Or perhaps the town of Brimhaven,", 65)
),
core.game.dialogue.book.Page(
core.game.dialogue.book.BookLine("on the exotic island of Karamja?", 66),
core.game.dialogue.book.BookLine("It's only a short boat trip with", 67),
core.game.dialogue.book.BookLine("regular transport leaving from", 68),
core.game.dialogue.book.BookLine("Ardougne harbor at all times", 69),
core.game.dialogue.book.BookLine("of the day, all year round.", 70)
)
)
)
}
}
@@ -0,0 +1,131 @@
package content.region.karamja.quest.tribaltotem
import core.game.node.entity.impl.Projectile
import core.game.node.entity.npc.NPC
import core.game.node.entity.player.Player
import core.game.system.task.Pulse
import core.game.world.map.Location
import core.game.world.update.flag.context.Animation
import core.game.world.update.flag.context.Graphics
import core.plugin.Initializable
import org.rs09.consts.NPCs
import content.global.travel.EssenceTeleport
import core.game.world.GameWorld
@Initializable
class CrompertyDialogue(player: Player? = null) : core.game.dialogue.DialoguePlugin(player) {
override fun open(vararg args: Any?): Boolean {
npc = args[0] as NPC
npcl(core.game.dialogue.FacialExpression.HAPPY,"Hello ${player.name}, I'm Cromperty. Sedridor has told me about you. As a wizard and an inventor he has aided me in my great invention!")
stage = 0
return true
}
override fun handle(interfaceId: Int, buttonId: Int): Boolean {
when(stage){
0 -> options("Two jobs? that's got to be tough","So what have you invented?","Can you teleport me to the Rune Essence?").also { stage++ }
1 ->when(buttonId){
1 -> playerl(core.game.dialogue.FacialExpression.HAPPY,"Two jobs? That's got to be tough.").also { stage = 5 }
2 -> playerl(core.game.dialogue.FacialExpression.ASKING,"So, what have you invented?").also { stage = 10 }
3 -> playerl(core.game.dialogue.FacialExpression.HAPPY,"Can you teleport me to the Rune Essence?").also {
if(player.questRepository.isComplete("Rune Mysteries")){
EssenceTeleport.teleport(npc,player)
end()
}
else stage = 2
}
}
2 -> npcl(core.game.dialogue.FacialExpression.THINKING,"I have no idea what you're talking about.")
5 -> npcl(core.game.dialogue.FacialExpression.HAPPY,"Not when you combine them it isn't! Invent MAGIC things!").also { stage++ }
6 -> options("So what have you invented?","Well I shall leave you to your inventing").also { stage++ }
7 -> when(buttonId){
1 -> playerl(core.game.dialogue.FacialExpression.ASKING,"So, what have you invented?").also { stage = 10 }
2 -> playerl(core.game.dialogue.FacialExpression.HAPPY,"Well I shall leave you to your inventing").also { stage++ }
}
8 -> npcl(core.game.dialogue.FacialExpression.HAPPY,"Thanks for dropping by! Stop again anytime!").also { stage = 1000 }
10 -> npcl(core.game.dialogue.FacialExpression.HAPPY,"Ah! My latest invention is my patent pending teleportation block! It emits a low level magical signal,").also { stage++ }
11 -> npcl(core.game.dialogue.FacialExpression.HAPPY,"that will allow me to locate it anywhere in the world, and teleport anything directly to it! I hope to revolutionize the entire teleportation system!").also { stage++ }
12 -> npcl(core.game.dialogue.FacialExpression.HAPPY,"Don't you think I'm great? Uh, I mean it's great?").also { stage++ }
13 -> options("So where is the other block?","Can I be teleported please?").also { stage++ }
14 -> when(buttonId){
1 -> playerl(core.game.dialogue.FacialExpression.ASKING,"So where is the other block?").also { stage = 15 }
2 -> playerl(core.game.dialogue.FacialExpression.ASKING,"Can I be teleported please?").also { stage = 25 }
}
15 -> npcl(core.game.dialogue.FacialExpression.THINKING,"Well...Hmm. I would guess somewhere between here and the Wizards' Tower in Misthalin.").also { stage++ }
16 -> npcl(core.game.dialogue.FacialExpression.HAPPY,"All I know is that it hasn't got there yet as the wizards there would have contacted me.").also { stage++ }
17 -> npcl(core.game.dialogue.FacialExpression.THINKING,"I'm using the GPDT for delivery. They assured me it would be delivered promptly.").also { stage++ }
18 -> playerl(core.game.dialogue.FacialExpression.ASKING,"Who are the GPDT?").also { stage++ }
19 -> npcl(core.game.dialogue.FacialExpression.HAPPY,"The Gielinor Parcel Delivery Team. They come very highly recommended.").also { stage++ }
20 -> npcl(core.game.dialogue.FacialExpression.HAPPY,"Their motto is: \"We aim to deliver your stuff at some point after you have paid us!\"").also { stage = 1000 }
25 -> npcl(core.game.dialogue.FacialExpression.HAPPY,"By all means! I'm afraid I can't give you any specifics as to where you will come out however. Presumably wherever the other block is located.").also { stage++ }
26 -> options("Yes, that sounds good. Teleport me!","That sounds dangerous. Leave me here.").also { stage++ }
27 -> when(buttonId){
1 -> playerl(core.game.dialogue.FacialExpression.HAPPY,"Yes, that sounds good. Teleport me!").also { stage = 30 }
2 -> playerl(core.game.dialogue.FacialExpression.THINKING,"That sounds dangerous. Leave me here.").also { stage++ }
}
28 -> npcl(core.game.dialogue.FacialExpression.HAPPY,"As you wish.").also { stage = 1000 }
30 -> npcl(core.game.dialogue.FacialExpression.HAPPY,"Okey dokey! Ready?").also {
stage = if(player.questRepository.hasStarted("Tribal Totem") && player.questRepository.getStage("Tribal Totem") < 50) {
35
}
else 31
}
31 -> npcl(core.game.dialogue.FacialExpression.THINKING,"Hmmm... that's odd... I can't seem to get a signal...").also { stage++ }
32 -> playerl(core.game.dialogue.FacialExpression.SAD,"Oh well, never mind.").also { stage = 1000 }
35 -> npcl(core.game.dialogue.FacialExpression.HAPPY,"Okay, I got a signal. Get ready!").also {
TribalTotemTeleport(player, npc)
end()
}
1000 -> end()
}
return true
}
override fun newInstance(player: Player?): core.game.dialogue.DialoguePlugin {
return CrompertyDialogue(player)
}
override fun getIds(): IntArray {
return intArrayOf(844,NPCs.WIZARD_CROMPERTY_2328)
}
fun TribalTotemTeleport(player : Player, npc: NPC) {
val LOCATIONS = arrayOf(Location.create(2649, 3272, 0),Location.create(2642, 3321, 0))
npc.animate(Animation(437))
npc.faceTemporary(player, 1)
npc.graphics(Graphics(108))
player.lock()
player.audioManager.send(125)
Projectile.create(npc, player, 109).send()
npc.sendChat("Dipsolum sententa sententi!")
GameWorld.Pulser.submit(object : Pulse(1) {
var counter = 0
var delivered = player.questRepository.getStage("Tribal Totem") >= 25
override fun pulse(): Boolean {
when(counter++){
2 -> {
if(delivered) {
player.questRepository.getQuest("Tribal Totem").setStage(player,30)
player.properties.teleportLocation = LOCATIONS[1]
}
else player.properties.teleportLocation = LOCATIONS[0]
}
3 ->{
player.graphics(Graphics(110))
player.unlock()
return true
}
}
return false
}
})
}
}
@@ -0,0 +1,41 @@
package content.region.karamja.quest.tribaltotem
import core.game.dialogue.DialoguePlugin
import core.game.dialogue.FacialExpression
import core.game.node.entity.player.Player
import core.plugin.Initializable
import org.rs09.consts.NPCs
@Initializable
class GPDTEmployeeDialogue(player: Player? = null) : core.game.dialogue.DialoguePlugin(player) {
override fun open(vararg args: Any?): Boolean {
npcl(core.game.dialogue.FacialExpression.HAPPY,"Welcome to G.P.D.T.!")
stage = if(player.questRepository.getStage("Tribal Totem") == 20){
5
}else 0
return true
}
override fun handle(interfaceId: Int, buttonId: Int): Boolean {
when(stage){
0 -> playerl(core.game.dialogue.FacialExpression.HAPPY,"Thank you very much.").also { stage = 1000 }
5 -> playerl(core.game.dialogue.FacialExpression.ASKING,"So, when are you going to deliver this crate?").also { stage++ }
6 -> npcl(core.game.dialogue.FacialExpression.THINKING,"Well... I guess we could do it now...").also {
player.questRepository.getQuest("Tribal Totem").setStage(player,25)
stage = 1000
}
1000 -> end()
}
return true
}
override fun newInstance(player: Player?): core.game.dialogue.DialoguePlugin {
return GPDTEmployeeDialogue(player)
}
override fun getIds(): IntArray {
return intArrayOf(NPCs.RPDT_EMPLOYEE_843)
}
}
@@ -0,0 +1,58 @@
package content.region.karamja.quest.tribaltotem
import core.game.dialogue.DialoguePlugin
import core.game.dialogue.FacialExpression
import core.game.node.entity.player.Player
import core.plugin.Initializable
@Initializable
class HoracioDialogue(player: Player? = null) : core.game.dialogue.DialoguePlugin(player) {
override fun open(vararg args: Any?): Boolean {
if(player.questRepository.hasStarted("Tribal Totem")){
npcl(core.game.dialogue.FacialExpression.HAPPY,"It's a fine day to be out in a garden, isn't it? ")
stage = 5
}
else{
npcl(core.game.dialogue.FacialExpression.HAPPY,"It's a fine day to be out in a garden, isn't it? ")
stage = 0
}
return true
}
override fun handle(interfaceId: Int, buttonId: Int): Boolean {
when(stage){
0 -> playerl(core.game.dialogue.FacialExpression.HAPPY,"Yes it's very nice.").also { stage++ }
1 -> npcl(core.game.dialogue.FacialExpression.HAPPY,"Days like these make me glad to be alive!").also { stage = 1000 }
5 -> playerl(core.game.dialogue.FacialExpression.ASKING,"So... who are you?").also { stage++ }
6 -> npcl(core.game.dialogue.FacialExpression.HAPPY,"My name is Horacio Dobson. I'm a gardener to Lord Handlemort.").also { stage++ }
7 -> npcl(core.game.dialogue.FacialExpression.HAPPY,"Take a look around this beautiful garden, all of this is my handiwork.").also { stage++ }
8 -> options("So... do you garden round the back too?","Do you need any help?").also { stage++ }
9 -> when(buttonId){
1 -> playerl(core.game.dialogue.FacialExpression.THINKING,"So... do you garden round the back, too?").also { stage = 10 }
2 -> playerl(core.game.dialogue.FacialExpression.ASKING,"Do you need any help?").also { stage = 20 }
}
10 -> npcl(core.game.dialogue.FacialExpression.HAPPY,"That I do!").also { stage++ }
11 -> playerl(core.game.dialogue.FacialExpression.ASKING,"Doesn't all of the security around the house get in your way then?").also { stage++ }
12 -> npcl(core.game.dialogue.FacialExpression.HAPPY,"Ah. I'm used to all that. I have my keys, the guard dogs know me, and I know the combination to the door lock.").also { stage++ }
13 -> npcl(core.game.dialogue.FacialExpression.HAPPY,"It's rather easy, it's his middle name.").also { stage++ }
14 -> playerl(core.game.dialogue.FacialExpression.ASKING,"Whose middle name?").also { stage++ }
15 -> npcl(core.game.dialogue.FacialExpression.ANNOYED,"Hum. I probably shouldn't have said that. Forget I mentioned it.").also { stage = 1000 }
20 -> npcl(core.game.dialogue.FacialExpression.ANNOYED,"Trying to muscle in on my job, eh? I'm more than happy to do this all by myself!").also { stage = 1000 }
1000 -> end()
}
return true
}
override fun newInstance(player: Player?): core.game.dialogue.DialoguePlugin {
return HoracioDialogue(player)
}
override fun getIds(): IntArray {
return intArrayOf(845)
}
}
@@ -0,0 +1,91 @@
package content.region.karamja.quest.tribaltotem
import core.api.isQuestComplete
import core.api.removeItem
import core.game.dialogue.DialoguePlugin
import core.game.dialogue.FacialExpression
import core.game.node.entity.player.Player
import core.plugin.Initializable
import org.rs09.consts.Items
@Initializable
class KangaiMauDialogue(player: Player? = null) : core.game.dialogue.DialoguePlugin(player) {
override fun open(vararg args: Any?): Boolean {
if(!player.questRepository.hasStarted("Tribal Totem")){
npcl(core.game.dialogue.FacialExpression.HAPPY,"Hello. I'm Kangai Mau of the Rantuki Tribe.")
stage = 0
} else if(isQuestComplete(player, "Tribal Totem")) {
npcl(core.game.dialogue.FacialExpression.HAPPY, "Many greetings esteemed thief.")
stage = 40
}
else if(player.inventory.containsAtLeastOneItem(Items.TOTEM_1857)){
npcl(core.game.dialogue.FacialExpression.ASKING,"Have you got our totem back?")
stage = 35
}
else if(player.questRepository.hasStarted("Tribal Totem")){
npcl(core.game.dialogue.FacialExpression.ASKING,"Have you got our totem back?")
stage = 30
}
return true
}
override fun handle(interfaceId: Int, buttonId: Int): Boolean {
when(stage){
0 -> options("And what are you doing here in Brimhaven?","I'm in search of adventure!","Who are the Rantuki tribe?").also { stage++ }
1 -> when(buttonId){
1 -> playerl(core.game.dialogue.FacialExpression.ASKING,"And what are you doing here in Brimhaven?").also { stage = 5 }
2 -> playerl(core.game.dialogue.FacialExpression.HAPPY,"I'm in search of adventure!").also { stage = 15 }
3 -> playerl(core.game.dialogue.FacialExpression.ASKING,"Who are the Rantuki Tribe?").also { stage = 10 }
}
5 -> npcl(core.game.dialogue.FacialExpression.HAPPY,"I'm looking for someone brave to go on important mission. Someone skilled in thievery and sneaking about.").also { stage++ }
6 -> npcl(core.game.dialogue.FacialExpression.HAPPY,"I am told I can find such people in Brimhaven.").also { stage++ }
7 -> playerl(core.game.dialogue.FacialExpression.HAPPY,"Yep. I have heard there are many of that type here.").also { stage++ }
8 -> npcl(core.game.dialogue.FacialExpression.THINKING,"Let's hope I find them.").also { stage = 1000 }
10 -> npcl(core.game.dialogue.FacialExpression.HAPPY,"A proud and noble tribe of Karamja.").also { stage++ }
11 -> npcl(core.game.dialogue.FacialExpression.ANGRY,"But now we are few, as men come from across, steal our land, and settle on our hunting grounds").also { stage = 1000 }
15 -> npcl(core.game.dialogue.FacialExpression.HAPPY,"Adventure is something I may be able to give. I need someone to go on a mission to the city of Ardougne.").also { stage++ }
16 -> npcl(core.game.dialogue.FacialExpression.HAPPY,"There you will find the house of Lord Handlemort. In his house he has our tribal totem. We need it back.").also { stage++ }
17 -> playerl(core.game.dialogue.FacialExpression.ASKING,"Why does he have it?").also { stage++ }
18 -> npcl(core.game.dialogue.FacialExpression.ANGRY,"Lord Handlemort is an Ardougnese explorer which means he think he have the right to come to my tribal home,").also { stage++ }
19 -> npcl(core.game.dialogue.FacialExpression.ANGRY,"steal our stuff and put in his private museum.").also { stage++ }
20 -> playerl(core.game.dialogue.FacialExpression.THINKING,"How can I find Handlemoret's house? Ardougne IS a big place...").also { stage++ }
21 -> npcl(core.game.dialogue.FacialExpression.ANNOYED,"I don't know Ardougne. You tell me.").also { stage++ }
22 -> playerl(core.game.dialogue.FacialExpression.HAPPY,"Ok, I will get it back.").also {
player.questRepository.getQuest("Tribal Totem").start(player)
player.questRepository.getQuest("Tribal Totem").setStage(player, 10)
stage++
}
23 -> npcl(core.game.dialogue.FacialExpression.HAPPY,"Best of luck with that adventurer").also { stage = 1000 }
30 -> playerl(core.game.dialogue.FacialExpression.SAD,"Not yet, sorry.").also { stage = 1000 }
35 -> playerl(core.game.dialogue.FacialExpression.HAPPY,"Yes I have.").also { stage++ }
36 -> npcl(core.game.dialogue.FacialExpression.HAPPY,"You have??? Many thanks brave adventurer! Here, have some freshly cooked Karamjan fish, caught specially by my tribe.").also { stage++ }
37 -> sendDialogue("You hand over the totem").also {
if(!isQuestComplete(player, "Tribal Totem") && removeItem(player, Items.TOTEM_1857)) {
player.questRepository.getQuest("Tribal Totem").finish(player)
stage = 1000
} else {
stage = 1000
}
}
40 -> player(core.game.dialogue.FacialExpression.NEUTRAL, "Hey.").also { stage = 1000 }
1000 -> end()
}
return true
}
override fun newInstance(player: Player?): core.game.dialogue.DialoguePlugin {
return KangaiMauDialogue(player)
}
override fun getIds(): IntArray {
return intArrayOf(846)
}
}
@@ -0,0 +1,207 @@
package content.region.karamja.quest.tribaltotem
import core.api.closeInterface
import core.api.sendMessage
import core.api.setInterfaceText
import core.game.world.map.Location
import core.game.interaction.InterfaceListener
class TTDoorCodeInterfaceListener : InterfaceListener {
override fun defineInterfaceListeners() {
val LETTERONEBACK = 10
val LETTERONEFORWARD = 11
val LETTERTWOBACK = 12
val LETTERTWOFORWARD = 13
val LETTERTHREEBACK = 14
val LETTERTHREEFORWARD = 15
val LETTERFOURBACK = 16
val LETTERFOURFORWARD = 17
val ENTER = 18
val DOORLOCKINTERFACE = 285
val LETTERS = arrayOf(
"A",
"B",
"C",
"D",
"E",
"F",
"G",
"H",
"I",
"J",
"K",
"L",
"M",
"N",
"O",
"P",
"Q",
"R",
"S",
"T",
"U",
"V",
"W",
"X",
"Y",
"Z"
)
onOpen(DOORLOCKINTERFACE) { player, component ->
player.setAttribute("tt-letter-one", 0)
player.setAttribute("tt-letter-two", 0)
player.setAttribute("tt-letter-three", 0)
player.setAttribute("tt-letter-four", 0)
return@onOpen true
}
onClose(DOORLOCKINTERFACE) { player, component ->
player.removeAttribute("tt-letter-one")
player.removeAttribute("tt-letter-two")
player.removeAttribute("tt-letter-three")
player.removeAttribute("tt-letter-four")
return@onClose true
}
on(DOORLOCKINTERFACE) { player, component, opcode, buttonID, slot, itemID ->
when (buttonID) {
LETTERONEBACK -> {
if (player.getAttribute("tt-letter-one", 0) == 0) {
player.setAttribute("tt-letter-one", 25)
setInterfaceText(player, LETTERS[player.getAttribute("tt-letter-one", 0)], DOORLOCKINTERFACE, 6)
} else {
(player.incrementAttribute("tt-letter-one", -1))
setInterfaceText(player, LETTERS[player.getAttribute("tt-letter-one", 0)], DOORLOCKINTERFACE, 6)
}
}
LETTERONEFORWARD -> {
if (player.getAttribute("tt-letter-one", 0) == 25) {
player.setAttribute("tt-letter-one", 0)
setInterfaceText(player, LETTERS[player.getAttribute("tt-letter-one", 0)], DOORLOCKINTERFACE, 6)
} else {
(player.incrementAttribute("tt-letter-one", 1))
setInterfaceText(
player,
LETTERS[player.getAttribute("tt-letter-one", 0)],
DOORLOCKINTERFACE,
6
)
}
}
LETTERTWOBACK -> {
if (player.getAttribute("tt-letter-two", 0) == 0) {
player.setAttribute("tt-letter-two", 25)
setInterfaceText(player, LETTERS[player.getAttribute("tt-letter-two", 0)], DOORLOCKINTERFACE, 7)
} else {
(player.incrementAttribute("tt-letter-two", -1))
setInterfaceText(player, LETTERS[player.getAttribute("tt-letter-two", 0)], DOORLOCKINTERFACE, 7)
}
}
LETTERTWOFORWARD -> {
if (player.getAttribute("tt-letter-two", 0) == 25) {
player.setAttribute("tt-letter-two", 0)
setInterfaceText(player, LETTERS[player.getAttribute("tt-letter-two", 0)], DOORLOCKINTERFACE, 7)
} else {
(player.incrementAttribute("tt-letter-two", 1))
setInterfaceText(player, LETTERS[player.getAttribute("tt-letter-two", 0)], DOORLOCKINTERFACE, 7)
}
}
LETTERTHREEBACK -> {
if (player.getAttribute("tt-letter-three", 0) == 0) {
player.setAttribute("tt-letter-three", 25)
setInterfaceText(
player,
LETTERS[player.getAttribute("tt-letter-three", 0)],
DOORLOCKINTERFACE,
8
)
} else {
(player.incrementAttribute("tt-letter-three", -1))
setInterfaceText(
player,
LETTERS[player.getAttribute("tt-letter-three", 0)],
DOORLOCKINTERFACE,
8
)
}
}
LETTERTHREEFORWARD -> {
if (player.getAttribute("tt-letter-three", 0) == 25) {
player.setAttribute("tt-letter-three", 0)
setInterfaceText(
player,
LETTERS[player.getAttribute("tt-letter-three", 0)],
DOORLOCKINTERFACE,
8
)
} else {
(player.incrementAttribute("tt-letter-three", 1))
setInterfaceText(
player,
LETTERS[player.getAttribute("tt-letter-three", 0)],
DOORLOCKINTERFACE,
8
)
}
}
LETTERFOURBACK -> {
if (player.getAttribute("tt-letter-four", 0) == 0) {
player.setAttribute("tt-letter-four", 25)
setInterfaceText(
player,
LETTERS[player.getAttribute("tt-letter-four", 0)],
DOORLOCKINTERFACE,
9
)
} else {
(player.incrementAttribute("tt-letter-four", -1))
setInterfaceText(
player,
LETTERS[player.getAttribute("tt-letter-four", 0)],
DOORLOCKINTERFACE,
9
)
}
}
LETTERFOURFORWARD -> {
if (player.getAttribute("tt-letter-four", 0) == 25) {
player.setAttribute("tt-letter-four", 0)
setInterfaceText(
player,
LETTERS[player.getAttribute("tt-letter-four", 0)],
DOORLOCKINTERFACE,
9
)
} else {
(player.incrementAttribute("tt-letter-four", 1))
setInterfaceText(
player,
LETTERS[player.getAttribute("tt-letter-four", 0)],
DOORLOCKINTERFACE,
9
)
}
}
ENTER -> {
val letterOne = LETTERS[player.getAttribute("tt-letter-one", 0)]
val letterTwo = LETTERS[player.getAttribute("tt-letter-two", 0)]
val letterThree = LETTERS[player.getAttribute("tt-letter-three", 0)]
val letterFour = LETTERS[player.getAttribute("tt-letter-four", 0)]
if (letterOne == "K" && letterTwo == "U" && letterThree == "R" && letterFour == "T") {
player.setAttribute("/save:TT:DoorUnlocked",true)
sendMessage(player, "You hear a satisfying click, signifying that the door has been unlocked")
closeInterface(player)
}
else {
sendMessage(player,"You hear a satisfying click, and then a worrying thunk.")
sendMessage(player,"The floor opens up beneath you sending you plummeting down")
sendMessage(player,"to the sewers.")
player.teleport(Location.create(2641, 9721, 0))
closeInterface(player)
}
}
}
return@on true
}
}
}
@@ -0,0 +1,107 @@
package content.region.karamja.quest.tribaltotem
import core.api.*
import core.game.node.entity.skill.Skills
import core.game.node.scenery.SceneryBuilder
import core.game.world.map.Location
import core.game.world.update.flag.context.Animation
import org.rs09.consts.Items
import core.game.interaction.InteractionListener
import core.game.interaction.IntType
class TribalTotemListeners : InteractionListener {
val frontDoor = 2706
val wizCrate = 2707
val realCrate = 2708
val label = Items.ADDRESS_LABEL_1858
val lockedDoor = 2705
val stairs = 2711
val closedChest = 2709
val openChest = 2710
override fun defineListeners() {
on(frontDoor, IntType.SCENERY, "Open"){ player, door ->
if(player.questRepository.getStage("Tribal Totem") >= 35){
core.game.global.action.DoorActionHandler.handleAutowalkDoor(player,door.asScenery())
}
sendMessage(player,"The door is locked shut.")
return@on true
}
on(realCrate, IntType.SCENERY, "Investigate"){ player, node ->
if(player.questRepository.getStage("Tribal Totem") in 1..19 && !player.inventory.containsAtLeastOneItem(Items.ADDRESS_LABEL_1858)){
sendDialogue(player,"There is a label on this crate. It says; To Lord Handelmort, Handelmort Mansion Ardogune.You carefully peel it off and take it.")
addItem(player,Items.ADDRESS_LABEL_1858,1)
}
else if(player.questRepository.getStage("Tribal Totem") in 1..19 && player.inventory.containsAtLeastOneItem(Items.ADDRESS_LABEL_1858)){
sendDialogue(player,"There was a label on this crate, but it's gone now since you took it!")
}
return@on true
}
on(wizCrate, IntType.SCENERY, "Investigate"){ player, node ->
sendDialogue(player,"There is a label on this crate: Senior Patents Clerk, Chamber of Invention, The Wizards' Tower, Misthalin. The crate is securely fastened shut and ready for delivery.")
return@on true
}
onUseWith(IntType.SCENERY,label,wizCrate){ player, used, with ->
sendDialogue(player,"You carefully place the delivery address label over the existing label, covering it completely.")
removeItem(player,label)
player.questRepository.getQuest("Tribal Totem").setStage(player,20)
return@onUseWith true
}
on(lockedDoor, IntType.SCENERY, "Open"){ player, node ->
if(player.getAttribute("TT:DoorUnlocked",false) == true){
core.game.global.action.DoorActionHandler.handleAutowalkDoor(player,node.asScenery())
}else{
openInterface(player,285)
}
return@on true
}
on(stairs, IntType.SCENERY, "Climb-up"){ player, node ->
if(player.getAttribute("TT:StairsChecked",false)){
core.game.global.action.ClimbActionHandler.climb(player, Animation(828), Location.create(2629, 3324, 1))
}
else{
sendMessage(player,"You set off a trap and the stairs give way under you, dropping you into the sewers.")
player.teleport(Location.create(2641, 9721, 0))
}
return@on true
}
on(stairs, IntType.SCENERY, "Investigate"){ player, node ->
if(player.getSkills().getStaticLevel(Skills.THIEVING) >= 21){
sendDialogue(player,"Your trained senses as a thief enable you to see that there is a trap in these stairs. You make a note of its location for future reference when using these stairs")
player.setAttribute("/save:TT:StairsChecked",true)
}else{
sendDialogue(player,"You don't see anything out of place on these stairs.")
}
return@on true
}
on(closedChest, IntType.SCENERY, "Open"){ player, node ->
SceneryBuilder.replace(node.asScenery(), node.asScenery().transform(2710))
return@on true
}
on(openChest, IntType.SCENERY, "Close"){ player, node ->
SceneryBuilder.replace(node.asScenery(), node.asScenery().transform(2709))
return@on true
}
on(openChest, IntType.SCENERY, "Search"){ player, node ->
if(!player.inventory.containsAtLeastOneItem(Items.TOTEM_1857)){
sendDialogue(player,"Inside the chest you find the tribal totem.")
addItem(player,Items.TOTEM_1857)
}
else{
sendDialogue(player,"Inside the chest you don't find anything because you already took the totem!")
}
return@on true
}
}
}
@@ -0,0 +1,83 @@
package content.region.karamja.quest.tribaltotem
import core.api.rewardXP
import core.game.content.quest.fremtrials.FremennikTrials
import core.game.node.entity.player.Player
import core.game.node.entity.player.link.quest.Quest
import core.game.node.entity.skill.Skills
import core.game.node.item.GroundItemManager
import core.game.node.item.Item
import core.plugin.Initializable
import org.rs09.consts.Items
@Initializable
class TribalTotem : Quest("Tribal Totem",126,125,1,200,0,1,5){
class SkillRequirement(val skill: Int?, val level: Int?)
val requirements = arrayListOf<SkillRequirement>()
override fun drawJournal(player: Player?, stage: Int) {
super.drawJournal(player, stage)
var line = 11
val started = player?.questRepository?.getStage("Tribal Totem")!! > 0
if(!started){
line(player,"I can start this quest by speaking to !!Kangai Mau?? in",line++)
line(player,"!!Shrimp & Parrot?? restaurant in Brimhaven.",line++)
line += 1
line(player,"To complete this quest I need:",line++)
line(player,"!!Level 21 Theiving??",line++, player?.skills?.getStaticLevel(Skills.THIEVING)!! >= 21)
}
else if(started && stage != 100){
if(stage >= 10){
line(player,"I agreed to help !!Kangai Mau?? on Brimhaven recover",line++,stage>15)
line(player,"the tribal totem stolen from his village by",line++,stage>15)
line(player,"!!Lord Handelmort??.",line++,stage>10)
}
if(stage >= 20){
line(player,"I found a package due for delivery to !!Lord Handelmort??",line++,stage>25)
line(player,"at the !!G.P.D.T. Depot??, and swapped the label for the",line++,stage>25)
line(player,"!!Wizard Cromperty's?? experimental teleport block.",line++,stage>25)
}
if(stage >= 30){
line(player,"I got the !!G.P.D.T.?? men to deliver the teleport block to",line++,stage>35)
line(player,"!!Lord Handelmort?? and teleported myself inside.",line++,stage>35)
}
}
else if(stage == 100){
if(stage == 100){
line(player,"After bypassing the traps and security inside the mansion I was able",line++)
line(player,"to reclaim the totem, and take it back to !!Kangai Mau??, who rewarded",line++)
line(player,"me for all of my help.",line++)
line += 1
line(player,"<col=FF0000>QUEST COMPLETE!</col>",line++ +1)
}
}
}
override fun finish(player: Player?) {
super.finish(player)
player ?: return
var ln = 10
player.packetDispatch.sendItemZoomOnInterface(Items.TOTEM_1857,230,277,5)
drawReward(player,"1 Quest point",ln++)
drawReward(player,"1,775 Thieving XP",ln++)
drawReward(player,"5 Swordfish",ln++)
rewardXP(player,Skills.THIEVING,1775.0)
if(!player.inventory.add(Item(Items.SWORDFISH_373,5))){
GroundItemManager.create(Item(Items.SWORDFISH_373,5),player)
}
cleanTTAttributes(player)
}
override fun newInstance(`object`: Any?): Quest {
requirements.add(SkillRequirement(Skills.THIEVING, 21))
return this
}
private fun cleanTTAttributes(player: Player){
player.removeAttribute("TT:StairsChecked")
player.removeAttribute("TT:DoorUnlocked")
}
}