Code cleanup

Reorganised imports
Removed redundant qualifiers
This commit is contained in:
bushtail
2023-08-19 15:07:23 +00:00
committed by Ryan
parent 0eca9521bc
commit 1b4e0aafaa
346 changed files with 2871 additions and 2886 deletions
@@ -1,7 +1,7 @@
package content.data.consumables.effects package content.data.consumables.effects
import core.api.* import core.api.registerTimer
import core.game.system.timer.impl.PoisonImmunity import core.api.spawnTimer
import core.game.consumable.ConsumableEffect import core.game.consumable.ConsumableEffect
import core.game.node.entity.player.Player import core.game.node.entity.player.Player
@@ -1,15 +1,11 @@
package content.global.activity.penguinhns package content.global.activity.penguinhns
import org.json.simple.JSONObject
import core.ServerStore import core.ServerStore
import core.api.StartupListener import core.api.StartupListener
import core.api.log import core.api.log
import core.game.worldevents.PluginSet
import core.game.worldevents.WorldEvent
import core.game.world.GameWorld
import core.plugin.ClassScanner import core.plugin.ClassScanner
import core.tools.Log import core.tools.Log
import core.tools.SystemLogger import org.json.simple.JSONObject
class PenguinHNSEvent : StartupListener { class PenguinHNSEvent : StartupListener {
val manager = PenguinManager() val manager = PenguinManager()
@@ -89,7 +89,7 @@ class ShootingStarMiningPulse(player: Player?, node: Scenery?, val star: Shootin
if(bonusXp > 0) { if(bonusXp > 0) {
val delta = Math.min(bonusXp, xp) val delta = Math.min(bonusXp, xp)
player.incrementAttribute("/save:shooting-star:bonus-xp", (-delta).toInt()) player.incrementAttribute("/save:shooting-star:bonus-xp", (-delta).toInt())
xp += delta; xp += delta
if(player.getAttribute("shooting-star:bonus-xp", 0) <= 0) { if(player.getAttribute("shooting-star:bonus-xp", 0) <= 0) {
player.sendMessage("You have obtained all of your bonus xp from the star.") player.sendMessage("You have obtained all of your bonus xp from the star.")
} }
@@ -53,7 +53,7 @@ object DrillDemonUtils {
setVarbit(player, tempOffsetList[i], tempList[i]) setVarbit(player, tempOffsetList[i], tempList[i])
} }
player.dialogueInterpreter.sendDialogues(NPCs.SERGEANT_DAMIEN_2790, core.game.dialogue.FacialExpression.OLD_NORMAL,when(task){ player.dialogueInterpreter.sendDialogues(NPCs.SERGEANT_DAMIEN_2790, FacialExpression.OLD_NORMAL,when(task){
DD_SIGN_JOG -> "Get over there and jog in place!" DD_SIGN_JOG -> "Get over there and jog in place!"
DD_SIGN_JUMP -> "I need 40 jumping jacks stat!" DD_SIGN_JUMP -> "I need 40 jumping jacks stat!"
DD_SIGN_PUSHUP -> "Get over there and give me 20 pushups!" DD_SIGN_PUSHUP -> "Get over there and give me 20 pushups!"
@@ -3,12 +3,12 @@ package content.global.ame.events.drilldemon
import core.game.dialogue.DialoguePlugin import core.game.dialogue.DialoguePlugin
import core.game.node.entity.player.Player import core.game.node.entity.player.Player
import core.plugin.Initializable import core.plugin.Initializable
import org.rs09.consts.NPCs
import core.tools.END_DIALOGUE import core.tools.END_DIALOGUE
import org.rs09.consts.NPCs
@Initializable @Initializable
class SeargentDamienDefaultPlugin(player: Player? = null) : core.game.dialogue.DialoguePlugin(player) { class SeargentDamienDefaultPlugin(player: Player? = null) : DialoguePlugin(player) {
override fun newInstance(player: Player?): core.game.dialogue.DialoguePlugin { override fun newInstance(player: Player?): DialoguePlugin {
return SeargentDamienDefaultPlugin(player) return SeargentDamienDefaultPlugin(player)
} }
@@ -31,7 +31,7 @@ class EvilBobListeners : InteractionListener, MapArea {
if (getAttribute(player!!, EvilBobUtils.attentiveNewSpot, false) || getAttribute(player!!, EvilBobUtils.eventComplete, false)) { if (getAttribute(player!!, EvilBobUtils.attentiveNewSpot, false) || getAttribute(player!!, EvilBobUtils.eventComplete, false)) {
sendDialogue(player, "You don't know if this is a good place to go fishing. Perhaps you should ask someone, like one of the human servants.") sendDialogue(player, "You don't know if this is a good place to go fishing. Perhaps you should ask someone, like one of the human servants.")
} else if (!inInventory(player, Items.SMALL_FISHING_NET_303)) { } else if (!inInventory(player, Items.SMALL_FISHING_NET_303)) {
sendNPCDialogue(player, NPCs.SERVANT_2481, "You'll need a fishing net. There are plenty scattered around the beach.", FacialExpression.SAD); sendNPCDialogue(player, NPCs.SERVANT_2481, "You'll need a fishing net. There are plenty scattered around the beach.", FacialExpression.SAD)
} else if (freeSlots(player) == 0) { } else if (freeSlots(player) == 0) {
sendDialogue(player, "You don't have enough space in your inventory.") sendDialogue(player, "You don't have enough space in your inventory.")
} else if (getAttribute(player, EvilBobUtils.fishCaught, false)) { } else if (getAttribute(player, EvilBobUtils.fishCaught, false)) {
@@ -9,7 +9,7 @@ import core.tools.END_DIALOGUE
class GenieDialogue : DialogueFile() { class GenieDialogue : DialogueFile() {
override fun handle(componentID: Int, buttonID: Int) { override fun handle(componentID: Int, buttonID: Int) {
val assigned = player!!.getAttribute("genie:item",0) val assigned = player!!.getAttribute("genie:item",0)
npcl(core.game.dialogue.FacialExpression.NEUTRAL, "Ah, so you are there, ${player!!.name.capitalize()}. I'm so glad you summoned me. Please take this lamp and make your wish.") npcl(FacialExpression.NEUTRAL, "Ah, so you are there, ${player!!.name.capitalize()}. I'm so glad you summoned me. Please take this lamp and make your wish.")
addItemOrDrop(player!!, assigned) addItemOrDrop(player!!, assigned)
AntiMacro.terminateEventNpc(player!!) AntiMacro.terminateEventNpc(player!!)
stage = END_DIALOGUE stage = END_DIALOGUE
@@ -60,6 +60,6 @@ class MordautDialogue(val examComplete: Boolean, val questionCorrect: Boolean =
} }
override fun npc(vararg messages: String?): Component? { override fun npc(vararg messages: String?): Component? {
return super.npc(core.game.dialogue.FacialExpression.OLD_NORMAL,*messages) return super.npc(FacialExpression.OLD_NORMAL,*messages)
} }
} }
@@ -582,7 +582,7 @@ class Adventurer(val style: CombatStyle): Script() {
// At the Crumbling Wall in Falador // At the Crumbling Wall in Falador
ZoneBorders(2937,3356,2936,3353) to { it: Adventurer -> ZoneBorders(2937,3356,2936,3353) to { it: Adventurer ->
// Interact with the Crumbling Wall // Interact with the Crumbling Wall
val wall = it.scriptAPI.getNearestNode("Crumbling wall", true); val wall = it.scriptAPI.getNearestNode("Crumbling wall", true)
if (wall == null) { if (wall == null) {
it.refresh() it.refresh()
it.ticks = 0 it.ticks = 0
@@ -155,7 +155,7 @@ class CannonballSmelter : Script() {
val furnace = scriptAPI.getNearestNode(11666, true) val furnace = scriptAPI.getNearestNode(11666, true)
scriptAPI.interact(bot, furnace, "smelt") scriptAPI.interact(bot, furnace, "smelt")
// TODO: should bots use real interfaces? // TODO: should bots use real interfaces?
bot.pulseManager.run(SmeltingPulse(bot, null, Bar.STEEL, 9)); bot.pulseManager.run(SmeltingPulse(bot, null, Bar.STEEL, 9))
} else { } else {
state = State.SMELTING_CBALLS state = State.SMELTING_CBALLS
} }
@@ -273,6 +273,6 @@ class CannonballSmelter : Script() {
skills.put(Skills.HITPOINTS,99) skills.put(Skills.HITPOINTS,99)
skills.put(Skills.DEFENCE,99) skills.put(Skills.DEFENCE,99)
skills.put(Skills.SMITHING,35) skills.put(Skills.SMITHING,35)
quests.add("Dwarf Cannon"); quests.add("Dwarf Cannon")
} }
} }
@@ -144,7 +144,7 @@ class GenericSlayerBot : Script() {
bot.inventory.clear() bot.inventory.clear()
for(item in inventory) for(item in inventory)
bot.inventory.add(item) bot.inventory.add(item)
scriptAPI.withdraw(org.rs09.consts.Items.LOBSTER_379,10) scriptAPI.withdraw(Items.LOBSTER_379,10)
bot.fullRestore() bot.fullRestore()
if(assignment.amount <= 0){ if(assignment.amount <= 0){
@@ -31,8 +31,8 @@ import core.game.node.entity.player.Player
class BookInterface : InterfaceListener { class BookInterface : InterfaceListener {
companion object { companion object {
const val CALLBACK_ATTRIBUTE = "bookInterfaceCallback"; const val CALLBACK_ATTRIBUTE = "bookInterfaceCallback"
const val CURRENT_PAGE_ATTRIBUTE = "bookInterfaceCurrentPage"; const val CURRENT_PAGE_ATTRIBUTE = "bookInterfaceCurrentPage"
/* These should be in org.rs09.consts.Components but currently are not. */ /* These should be in org.rs09.consts.Components but currently are not. */
const val FANCY_BOOK_26 = 26 // This is a 15-Lines per page book. const val FANCY_BOOK_26 = 26 // This is a 15-Lines per page book.
@@ -45,13 +45,13 @@ class BookInterface : InterfaceListener {
val FANCY_BOOK_3_49_LINE_IDS = arrayOf(6, 77, 78, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76) val FANCY_BOOK_3_49_LINE_IDS = arrayOf(6, 77, 78, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76)
/* Button IDs. [Left button, Right button, (opt)index button, ...(opt)click lines 1 to X] */ /* Button IDs. [Left button, Right button, (opt)index button, ...(opt)click lines 1 to X] */
val FANCY_BOOK_26_BUTTON_IDS = arrayOf(61, 63); val FANCY_BOOK_26_BUTTON_IDS = arrayOf(61, 63)
val FANCY_BOOK_2_27_BUTTON_IDS = arrayOf(1, 3, 159, 100, 102, 104, 106, 108, 110, 112, 114, 116, 118, 120, 122, 124, 126, 128, 130, 132, 134, 136, 138, 140, 142, 144, 146, 148, 150, 152, 154, 156, 158) val FANCY_BOOK_2_27_BUTTON_IDS = arrayOf(1, 3, 159, 100, 102, 104, 106, 108, 110, 112, 114, 116, 118, 120, 122, 124, 126, 128, 130, 132, 134, 136, 138, 140, 142, 144, 146, 148, 150, 152, 154, 156, 158)
val FANCY_BOOK_3_49_BUTTON_IDS = arrayOf(51, 53); val FANCY_BOOK_3_49_BUTTON_IDS = arrayOf(51, 53)
/* Image IDs. [...lines 1 to X] */ /* Image IDs. [...lines 1 to X] */
val FANCY_BOOK_2_27_IMAGE_ENABLE_DRAW_IDS = arrayOf(9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 69, 71, 73, 75, 77, 79, 81, 83, 85, 87, 89, 91, 93, 95, 97); val FANCY_BOOK_2_27_IMAGE_ENABLE_DRAW_IDS = arrayOf(9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 69, 71, 73, 75, 77, 79, 81, 83, 85, 87, 89, 91, 93, 95, 97)
val FANCY_BOOK_2_27_IMAGE_DRAW_IDS = arrayOf(10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 68, 70, 72, 74, 76, 78, 80, 82, 84, 86, 88, 90, 92, 94, 96, 98); val FANCY_BOOK_2_27_IMAGE_DRAW_IDS = arrayOf(10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 68, 70, 72, 74, 76, 78, 80, 82, 84, 86, 88, 90, 92, 94, 96, 98)
/** Opens the book interface. Call this only once in the defineListeners() at the start of opening a book. */ /** Opens the book interface. Call this only once in the defineListeners() at the start of opening a book. */
fun openBook(player: Player, bookComponent: Int, displayCallback: (player: Player, pageNum: Int, buttonId: Int) -> Boolean) { fun openBook(player: Player, bookComponent: Int, displayCallback: (player: Player, pageNum: Int, buttonId: Int) -> Boolean) {
@@ -72,29 +72,29 @@ class BookInterface : InterfaceListener {
fun pageSetup(player: Player, bookComponent: Int, title: String, contents: Array<PageSet>, hasPagination: Boolean = true) { fun pageSetup(player: Player, bookComponent: Int, title: String, contents: Array<PageSet>, hasPagination: Boolean = true) {
val currentPage = getAttribute(player, CURRENT_PAGE_ATTRIBUTE, 0) val currentPage = getAttribute(player, CURRENT_PAGE_ATTRIBUTE, 0)
if (bookComponent == FANCY_BOOK_26) { if (bookComponent == FANCY_BOOK_26) {
clearBookLines(player, FANCY_BOOK_26, FANCY_BOOK_26_LINE_IDS); clearBookLines(player, FANCY_BOOK_26, FANCY_BOOK_26_LINE_IDS)
clearButtons(player, FANCY_BOOK_26, FANCY_BOOK_26_BUTTON_IDS); clearButtons(player, FANCY_BOOK_26, FANCY_BOOK_26_BUTTON_IDS)
setTitle(player, FANCY_BOOK_26, FANCY_BOOK_26_LINE_IDS, title); setTitle(player, FANCY_BOOK_26, FANCY_BOOK_26_LINE_IDS, title)
if (hasPagination) { if (hasPagination) {
setPagination(player, FANCY_BOOK_26, FANCY_BOOK_26_LINE_IDS, FANCY_BOOK_26_BUTTON_IDS, currentPage, contents.size, contents[currentPage].pages.size == 1) setPagination(player, FANCY_BOOK_26, FANCY_BOOK_26_LINE_IDS, FANCY_BOOK_26_BUTTON_IDS, currentPage, contents.size, contents[currentPage].pages.size == 1)
} }
setPageContent(player, FANCY_BOOK_26, FANCY_BOOK_26_LINE_IDS, FANCY_BOOK_26_BUTTON_IDS, currentPage, contents); setPageContent(player, FANCY_BOOK_26, FANCY_BOOK_26_LINE_IDS, FANCY_BOOK_26_BUTTON_IDS, currentPage, contents)
} else if (bookComponent == FANCY_BOOK_2_27) { } else if (bookComponent == FANCY_BOOK_2_27) {
clearBookLines(player, FANCY_BOOK_2_27, FANCY_BOOK_2_27_LINE_IDS); clearBookLines(player, FANCY_BOOK_2_27, FANCY_BOOK_2_27_LINE_IDS)
clearButtons(player, FANCY_BOOK_2_27, FANCY_BOOK_2_27_BUTTON_IDS); clearButtons(player, FANCY_BOOK_2_27, FANCY_BOOK_2_27_BUTTON_IDS)
setTitle(player, FANCY_BOOK_2_27, FANCY_BOOK_2_27_LINE_IDS, title); setTitle(player, FANCY_BOOK_2_27, FANCY_BOOK_2_27_LINE_IDS, title)
if (hasPagination) { if (hasPagination) {
setPagination(player, FANCY_BOOK_2_27, FANCY_BOOK_2_27_LINE_IDS, FANCY_BOOK_2_27_BUTTON_IDS, currentPage, contents.size, contents[currentPage].pages.size == 1) setPagination(player, FANCY_BOOK_2_27, FANCY_BOOK_2_27_LINE_IDS, FANCY_BOOK_2_27_BUTTON_IDS, currentPage, contents.size, contents[currentPage].pages.size == 1)
} }
setPageContent(player, FANCY_BOOK_2_27, FANCY_BOOK_2_27_LINE_IDS, FANCY_BOOK_2_27_BUTTON_IDS, currentPage, contents); setPageContent(player, FANCY_BOOK_2_27, FANCY_BOOK_2_27_LINE_IDS, FANCY_BOOK_2_27_BUTTON_IDS, currentPage, contents)
} else if (bookComponent == FANCY_BOOK_3_49) { } else if (bookComponent == FANCY_BOOK_3_49) {
clearBookLines(player, FANCY_BOOK_3_49, FANCY_BOOK_3_49_LINE_IDS); clearBookLines(player, FANCY_BOOK_3_49, FANCY_BOOK_3_49_LINE_IDS)
clearButtons(player, FANCY_BOOK_3_49, FANCY_BOOK_3_49_BUTTON_IDS); clearButtons(player, FANCY_BOOK_3_49, FANCY_BOOK_3_49_BUTTON_IDS)
setTitle(player, FANCY_BOOK_3_49, FANCY_BOOK_3_49_LINE_IDS, title); setTitle(player, FANCY_BOOK_3_49, FANCY_BOOK_3_49_LINE_IDS, title)
if (hasPagination) { if (hasPagination) {
setPagination(player, FANCY_BOOK_3_49, FANCY_BOOK_3_49_LINE_IDS, FANCY_BOOK_3_49_BUTTON_IDS, currentPage, contents.size, contents[currentPage].pages.size == 1) setPagination(player, FANCY_BOOK_3_49, FANCY_BOOK_3_49_LINE_IDS, FANCY_BOOK_3_49_BUTTON_IDS, currentPage, contents.size, contents[currentPage].pages.size == 1)
} }
setPageContent(player, FANCY_BOOK_3_49, FANCY_BOOK_3_49_LINE_IDS, FANCY_BOOK_3_49_BUTTON_IDS, currentPage, contents); setPageContent(player, FANCY_BOOK_3_49, FANCY_BOOK_3_49_LINE_IDS, FANCY_BOOK_3_49_BUTTON_IDS, currentPage, contents)
} }
} }
@@ -166,7 +166,7 @@ class BookInterface : InterfaceListener {
/** Function to check if player read to the last page. For quest triggers. */ /** Function to check if player read to the last page. For quest triggers. */
fun isLastPage(pageNum: Int, totalPages: Int): Boolean { fun isLastPage(pageNum: Int, totalPages: Int): Boolean {
return pageNum == totalPages - 1; return pageNum == totalPages - 1
} }
/** PRIVATE: Increments the current page and invokes the callback function. */ /** PRIVATE: Increments the current page and invokes the callback function. */
@@ -144,7 +144,7 @@ class HairDresserInterface : ComponentPlugin(){
} }
sendPlayerOnInterface(player, usedInterface, player_model_child) sendPlayerOnInterface(player, usedInterface, player_model_child)
sendPlayerOnInterface(player, usedInterface, player_head_child) sendPlayerOnInterface(player, usedInterface, player_head_child)
sendAnimationOnInterface(player, core.game.dialogue.FacialExpression.HAPPY.animationId, usedInterface, player_head_child) sendAnimationOnInterface(player, FacialExpression.HAPPY.animationId, usedInterface, player_head_child)
player.toggleWardrobe(true) player.toggleWardrobe(true)
component?.setCloseEvent{pl,_ -> component?.setCloseEvent{pl,_ ->
@@ -33,8 +33,8 @@ class MakeOverInterface : ComponentPlugin(){
player.packetDispatch.sendNpcOnInterface(1,component.id, MALE_CHILD_ID) player.packetDispatch.sendNpcOnInterface(1,component.id, MALE_CHILD_ID)
player.packetDispatch.sendNpcOnInterface(5,component.id, FEMALE_CHILD_ID) player.packetDispatch.sendNpcOnInterface(5,component.id, FEMALE_CHILD_ID)
//Send chathead animations to interface //Send chathead animations to interface
player.packetDispatch.sendAnimationInterface(core.game.dialogue.FacialExpression.SILENT.animationId,component.id, MALE_CHILD_ID) player.packetDispatch.sendAnimationInterface(FacialExpression.SILENT.animationId,component.id, MALE_CHILD_ID)
player.packetDispatch.sendAnimationInterface(core.game.dialogue.FacialExpression.SILENT.animationId,component.id, FEMALE_CHILD_ID) player.packetDispatch.sendAnimationInterface(FacialExpression.SILENT.animationId,component.id, FEMALE_CHILD_ID)
//Check for makeover voucher and then change interface text if it's there //Check for makeover voucher and then change interface text if it's there
if(player.inventory.containsAtLeastOneItem(Items.MAKEOVER_VOUCHER_5606)){ if(player.inventory.containsAtLeastOneItem(Items.MAKEOVER_VOUCHER_5606)){
@@ -34,7 +34,7 @@ object RulesAndInfo {
val pin = getAttribute(player, "rules:pin", RandomFunction.random(1000,9999)) val pin = getAttribute(player, "rules:pin", RandomFunction.random(1000,9999))
setAttribute(player, "/save:rules:pin", pin) setAttribute(player, "/save:rules:pin", pin)
var ln = setBaseRulesAndInfo(player); var ln = setBaseRulesAndInfo(player)
setInterfaceText(player, "<col=ffffff>If you agree to the above, type ::confirmrules $pin", 384, ln++) setInterfaceText(player, "<col=ffffff>If you agree to the above, type ::confirmrules $pin", 384, ln++)
setInterfaceText(player, "", 384, ln) setInterfaceText(player, "", 384, ln)
@@ -24,7 +24,7 @@ class ScrollInterface {
closeInterface(player) // Important: Close previous interfaces. closeInterface(player) // Important: Close previous interfaces.
if (scrollComponent == Components.MESSAGESCROLL_220) { if (scrollComponent == Components.MESSAGESCROLL_220) {
openInterface(player, Components.MESSAGESCROLL_220) openInterface(player, Components.MESSAGESCROLL_220)
setPageContent(player, Components.MESSAGESCROLL_220, MESSAGESCROLL_220_LINE_IDS, contents); setPageContent(player, Components.MESSAGESCROLL_220, MESSAGESCROLL_220_LINE_IDS, contents)
} }
} }
@@ -54,11 +54,11 @@ class BankInterface : InterfaceListener {
private const val OP_SET_TAB = 155 private const val OP_SET_TAB = 155
private const val OP_COLLAPSE_TAB = 196 private const val OP_COLLAPSE_TAB = 196
private const val THRESHOLD_TO_DISPLAY_EXACT_QUANTITY_ON_EXAMINE = 100000; private const val THRESHOLD_TO_DISPLAY_EXACT_QUANTITY_ON_EXAMINE = 100000
} }
private fun onBankInterfaceOpen(player: Player, component: Component): Boolean { private fun onBankInterfaceOpen(player: Player, component: Component): Boolean {
player.bank.sendBankSpace(); player.bank.sendBankSpace()
val settings = IfaceSettingsBuilder() val settings = IfaceSettingsBuilder()
.enableAllOptions() .enableAllOptions()
@@ -73,7 +73,7 @@ class EnchantJewelleryTabListener : InteractionListener {
addItem(player, product) addItem(player, product)
playAudio(player, Audio(979), false) playAudio(player, Audio(979), false)
animate(player, 4069, true) animate(player, 4069, true)
break; break
} }
} }
} }
@@ -7,7 +7,7 @@ object SpadeDigListener {
val listeners = HashMap<Location,(Player) -> Unit>() val listeners = HashMap<Location,(Player) -> Unit>()
fun registerListener(location: Location, method: (Player) -> Unit){ fun registerListener(location: Location, method: (Player) -> Unit){
listeners.putIfAbsent(location,method); listeners.putIfAbsent(location,method)
} }
@JvmStatic @JvmStatic
@@ -52,7 +52,7 @@ class SalamanderSwingHandler(private var style: CombatStyle) : CombatSwingHandle
if (entity is Player) { if (entity is Player) {
state.weapon = Weapon(entity.equipment[3]) state.weapon = Weapon(entity.equipment[3])
} }
if (state!!.weapon == null || !SalamanderSwingHandler.hasAmmo(entity, state)) { if (state!!.weapon == null || !hasAmmo(entity, state)) {
entity!!.properties.combatPulse.stop() entity!!.properties.combatPulse.stop()
return -1 return -1
} }
@@ -67,7 +67,7 @@ class SalamanderSwingHandler(private var style: CombatStyle) : CombatSwingHandle
return -1 return -1
} }
if(state.estimatedHit > victim.skills.lifepoints) state.estimatedHit = victim.skills.lifepoints if(state.estimatedHit > victim.skills.lifepoints) state.estimatedHit = victim.skills.lifepoints
SalamanderSwingHandler.useAmmo(entity, state) useAmmo(entity, state)
return 1 return 1
} }
@@ -50,7 +50,7 @@ class CatOnArdougneCivilian: InteractionListener {
player.familiarManager.removeDetails(used.id) player.familiarManager.removeDetails(used.id)
removeItem(player,used,Container.INVENTORY) removeItem(player,used,Container.INVENTORY)
addItem(player,Items.DEATH_RUNE_560,100) addItem(player,Items.DEATH_RUNE_560,100)
return@onUseWith true; return@onUseWith true
} }
} }
} }
@@ -31,7 +31,7 @@ class BarbarianOutpostCourse
*/ */
@JvmOverloads constructor(player: Player? = null) : AgilityCourse(player, 6, 46.2) { @JvmOverloads constructor(player: Player? = null) : AgilityCourse(player, 6, 46.2) {
override fun createInstance(player: Player): AgilityCourse { override fun createInstance(player: Player): AgilityCourse {
return content.global.skill.agility.BarbarianOutpostCourse(player) return BarbarianOutpostCourse(player)
} }
override fun handle(player: Player, node: Node, option: String): Boolean { override fun handle(player: Player, node: Node, option: String): Boolean {
@@ -88,7 +88,7 @@ class BarbarianOutpostCourse
sendMessage(player, "You cannot do that from here.") sendMessage(player, "You cannot do that from here.")
return return
} }
if (content.global.skill.agility.BarbarianOutpostCourse.Companion.ropeDelay > GameWorld.ticks) { if (ropeDelay > GameWorld.ticks) {
sendMessage(player, "The rope is being used.") sendMessage(player, "The rope is being used.")
return return
} }
@@ -96,7 +96,7 @@ class BarbarianOutpostCourse
AgilityHandler.fail(player, 0, Location.create(2549, 9951, 0), null, getHitAmount(player), "You slip and fall to the pit below.") AgilityHandler.fail(player, 0, Location.create(2549, 9951, 0), null, getHitAmount(player), "You slip and fall to the pit below.")
return return
} }
content.global.skill.agility.BarbarianOutpostCourse.Companion.ropeDelay = GameWorld.ticks + 2 ropeDelay = GameWorld.ticks + 2
player.packetDispatch.sendSceneryAnimation(`object`, Animation.create(497), true) player.packetDispatch.sendSceneryAnimation(`object`, Animation.create(497), true)
AgilityHandler.forceWalk(player, 0, player.location, Location.create(2551, 3549, 0), Animation.create(751), 50, 22.0, "You skillfully swing across.", 1) AgilityHandler.forceWalk(player, 0, player.location, Location.create(2551, 3549, 0), Animation.create(751), 50, 22.0, "You skillfully swing across.", 1)
} }
@@ -176,7 +176,7 @@ class BarbarianOutpostCourse
NPCDefinition.forId(385).handlers["option:pick-up"] = this NPCDefinition.forId(385).handlers["option:pick-up"] = this
NPCDefinition.forId(386).handlers["option:pick-up"] = this NPCDefinition.forId(386).handlers["option:pick-up"] = this
NPCDefinition.forId(387).handlers["option:pick-up"] = this NPCDefinition.forId(387).handlers["option:pick-up"] = this
ClassScanner.definePlugin(content.global.skill.agility.BarbarianOutpostCourse.BarbarianGuardDialogue()) ClassScanner.definePlugin(BarbarianGuardDialogue())
} }
override fun getDestination(node: Node, n: Node): Location? { override fun getDestination(node: Node, n: Node): Location? {
@@ -209,7 +209,7 @@ class BarbarianOutpostCourse
constructor(player: Player?) : super(player) {} constructor(player: Player?) : super(player) {}
override fun newInstance(player: Player): core.game.dialogue.DialoguePlugin { override fun newInstance(player: Player): core.game.dialogue.DialoguePlugin {
return content.global.skill.agility.BarbarianOutpostCourse.BarbarianGuardDialogue(player) return BarbarianGuardDialogue(player)
} }
override fun open(vararg args: Any): Boolean { override fun open(vararg args: Any): Boolean {
@@ -30,25 +30,25 @@ class GnomeStrongholdCourse
val `object` = node as Scenery val `object` = node as Scenery
when (`object`.id) { when (`object`.id) {
2295 -> { 2295 -> {
content.global.skill.agility.GnomeStrongholdCourse.Companion.TRAINERS[0]!!.sendChat("Okay get over that log, quick quick!") TRAINERS[0]!!.sendChat("Okay get over that log, quick quick!")
sendMessage(player, "You walk carefully across the slippery log...") sendMessage(player, "You walk carefully across the slippery log...")
AgilityHandler.walk(player, 0, Location.create(2474, 3436, 0), Location.create(2474, 3429, 0), Animation.create(155), 7.5, "...You make it safely to the other side.") AgilityHandler.walk(player, 0, Location.create(2474, 3436, 0), Location.create(2474, 3429, 0), Animation.create(155), 7.5, "...You make it safely to the other side.")
return true return true
} }
2285 -> { 2285 -> {
content.global.skill.agility.GnomeStrongholdCourse.Companion.TRAINERS[1]!!.sendChat("Move it, move it, move it!") TRAINERS[1]!!.sendChat("Move it, move it, move it!")
sendMessage(player, "You climb the netting...") sendMessage(player, "You climb the netting...")
AgilityHandler.climb(player, 1, Animation.create(828), `object`.location.transform(0, -1, 1), 7.5, null) AgilityHandler.climb(player, 1, Animation.create(828), `object`.location.transform(0, -1, 1), 7.5, null)
return true return true
} }
35970 -> { 35970 -> {
content.global.skill.agility.GnomeStrongholdCourse.Companion.TRAINERS[2]!!.sendChat("That's it - straight up.") TRAINERS[2]!!.sendChat("That's it - straight up.")
sendMessage(player, "You climb the tree..") sendMessage(player, "You climb the tree..")
AgilityHandler.climb(player, 2, Animation.create(828), Location.create(2473, 3420, 2), 5.0, "...To the platform above.") AgilityHandler.climb(player, 2, Animation.create(828), Location.create(2473, 3420, 2), 5.0, "...To the platform above.")
return true return true
} }
2312 -> { 2312 -> {
content.global.skill.agility.GnomeStrongholdCourse.Companion.TRAINERS[3]!!.sendChat("Come on scaredy cat, get across that rope!") TRAINERS[3]!!.sendChat("Come on scaredy cat, get across that rope!")
sendMessage(player, "You carefully cross the tightrope.") sendMessage(player, "You carefully cross the tightrope.")
AgilityHandler.walk(player, 3, Location.create(2477, 3420, 2), Location.create(2483, 3420, 2), Animation.create(155), 7.5, null) AgilityHandler.walk(player, 3, Location.create(2477, 3420, 2), Location.create(2483, 3420, 2), Animation.create(155), 7.5, null)
return true return true
@@ -63,7 +63,7 @@ class GnomeStrongholdCourse
return true return true
} }
2286 -> { 2286 -> {
content.global.skill.agility.GnomeStrongholdCourse.Companion.TRAINERS[4]!!.sendChat("My Granny can move faster than you.") TRAINERS[4]!!.sendChat("My Granny can move faster than you.")
player.faceLocation(player.location.transform(0, 2, 0)) player.faceLocation(player.location.transform(0, 2, 0))
sendMessage(player, "You climb the netting...") sendMessage(player, "You climb the netting...")
AgilityHandler.climb(player, 5, Animation.create(828), player.location.transform(0, 2, 0), 7.5, null) AgilityHandler.climb(player, 5, Animation.create(828), player.location.transform(0, 2, 0), 7.5, null)
@@ -76,11 +76,11 @@ class GnomeStrongholdCourse
sendMessage(player, "You can't do that from here.") sendMessage(player, "You can't do that from here.")
return true return true
} }
if (content.global.skill.agility.GnomeStrongholdCourse.Companion.USED_PIPES[index] > GameWorld.ticks) { if (USED_PIPES[index] > GameWorld.ticks) {
sendMessage(player, "The pipe is being used.") sendMessage(player, "The pipe is being used.")
return true return true
} }
content.global.skill.agility.GnomeStrongholdCourse.Companion.USED_PIPES[index] = GameWorld.ticks + 10 USED_PIPES[index] = GameWorld.ticks + 10
player.lock() player.lock()
//Animations and force walking //Animations and force walking
@@ -117,12 +117,12 @@ class GnomeStrongholdCourse
} }
override fun configure() { override fun configure() {
content.global.skill.agility.GnomeStrongholdCourse.Companion.TRAINERS[0] = NPC.create(162, Location.create(2473, 3438, 0)) TRAINERS[0] = NPC.create(162, Location.create(2473, 3438, 0))
content.global.skill.agility.GnomeStrongholdCourse.Companion.TRAINERS[1] = NPC.create(162, Location.create(2478, 3426, 0)) TRAINERS[1] = NPC.create(162, Location.create(2478, 3426, 0))
content.global.skill.agility.GnomeStrongholdCourse.Companion.TRAINERS[2] = NPC.create(162, Location.create(2474, 3422, 1)) TRAINERS[2] = NPC.create(162, Location.create(2474, 3422, 1))
content.global.skill.agility.GnomeStrongholdCourse.Companion.TRAINERS[3] = NPC.create(162, Location.create(2472, 3419, 2)) TRAINERS[3] = NPC.create(162, Location.create(2472, 3419, 2))
content.global.skill.agility.GnomeStrongholdCourse.Companion.TRAINERS[4] = NPC.create(162, Location.create(2489, 3425, 0)) TRAINERS[4] = NPC.create(162, Location.create(2489, 3425, 0))
for (npc in content.global.skill.agility.GnomeStrongholdCourse.Companion.TRAINERS) { for (npc in TRAINERS) {
npc!!.init() npc!!.init()
npc.walkRadius = 3 npc.walkRadius = 3
} }
@@ -139,7 +139,7 @@ class GnomeStrongholdCourse
} }
override fun createInstance(player: Player): AgilityCourse { override fun createInstance(player: Player): AgilityCourse {
return content.global.skill.agility.GnomeStrongholdCourse(player) return GnomeStrongholdCourse(player)
} }
companion object { companion object {
@@ -153,7 +153,7 @@ class WildernessCourse
sendMessage(player, "You cannot do that from here.") sendMessage(player, "You cannot do that from here.")
return return
} }
if (content.global.skill.agility.WildernessCourse.Companion.ropeDelay > GameWorld.ticks) { if (ropeDelay > GameWorld.ticks) {
sendMessage(player, "The rope is being used.") sendMessage(player, "The rope is being used.")
return return
} }
@@ -161,7 +161,7 @@ class WildernessCourse
AgilityHandler.fail(player, 0, Location.create(3005, 10357, 0), null, getHitAmount(player), "You slip and fall to the pit below.") AgilityHandler.fail(player, 0, Location.create(3005, 10357, 0), null, getHitAmount(player), "You slip and fall to the pit below.")
return return
} }
content.global.skill.agility.WildernessCourse.Companion.ropeDelay = GameWorld.ticks + 2 ropeDelay = GameWorld.ticks + 2
player.packetDispatch.sendSceneryAnimation(`object`, Animation.create(497), true) player.packetDispatch.sendSceneryAnimation(`object`, Animation.create(497), true)
AgilityHandler.forceWalk(player, 1, player.location, Location.create(3005, 3958, 0), Animation.create(751), 50, 20.0, "You skillfully swing across.", 1) AgilityHandler.forceWalk(player, 1, player.location, Location.create(3005, 3958, 0), Animation.create(751), 50, 20.0, "You skillfully swing across.", 1)
} }
@@ -254,7 +254,7 @@ class WildernessCourse
} }
override fun createInstance(player: Player): AgilityCourse { override fun createInstance(player: Player): AgilityCourse {
return content.global.skill.agility.WildernessCourse(player) return WildernessCourse(player)
} }
companion object { companion object {
@@ -42,16 +42,16 @@ class BasaltRockShortcut : AgilityShortcut {
* 2522, 3600 R1, 3601, 3602 R2 * 2522, 3600 R1, 3601, 3602 R2
*/ */
override fun newInstance(arg: Any?): Plugin<Any> { override fun newInstance(arg: Any?): Plugin<Any> {
configure(content.global.skill.agility.shortcuts.BasaltRockShortcut(intArrayOf(4550), 1, 0.0, "jump-to")) //Beach South* configure(BasaltRockShortcut(intArrayOf(4550), 1, 0.0, "jump-to")) //Beach South*
configure(content.global.skill.agility.shortcuts.BasaltRockShortcut(intArrayOf(4551), 1, 0.0, "jump-across")) //Beach South Rock 1* configure(BasaltRockShortcut(intArrayOf(4551), 1, 0.0, "jump-across")) //Beach South Rock 1*
configure(content.global.skill.agility.shortcuts.BasaltRockShortcut(intArrayOf(4552), 1, 0.0, "jump-across")) //South Rock 2 configure(BasaltRockShortcut(intArrayOf(4552), 1, 0.0, "jump-across")) //South Rock 2
configure(content.global.skill.agility.shortcuts.BasaltRockShortcut(intArrayOf(4553), 1, 0.0, "jump-across")) //South Rock 2 (other side) configure(BasaltRockShortcut(intArrayOf(4553), 1, 0.0, "jump-across")) //South Rock 2 (other side)
configure(content.global.skill.agility.shortcuts.BasaltRockShortcut(intArrayOf(4554), 1, 0.0, "jump-across")) //Middle Rock 3 configure(BasaltRockShortcut(intArrayOf(4554), 1, 0.0, "jump-across")) //Middle Rock 3
configure(content.global.skill.agility.shortcuts.BasaltRockShortcut(intArrayOf(4555), 1, 0.0, "jump-across")) //Middle Rock 3 (other side) configure(BasaltRockShortcut(intArrayOf(4555), 1, 0.0, "jump-across")) //Middle Rock 3 (other side)
configure(content.global.skill.agility.shortcuts.BasaltRockShortcut(intArrayOf(4556), 1, 0.0, "jump-across")) //North Rock 4 configure(BasaltRockShortcut(intArrayOf(4556), 1, 0.0, "jump-across")) //North Rock 4
configure(content.global.skill.agility.shortcuts.BasaltRockShortcut(intArrayOf(4557), 1, 0.0, "jump-across")) //North Rock 4 (other side) configure(BasaltRockShortcut(intArrayOf(4557), 1, 0.0, "jump-across")) //North Rock 4 (other side)
configure(content.global.skill.agility.shortcuts.BasaltRockShortcut(intArrayOf(4558), 1, 0.0, "jump-across")) //Rocky Shore North Rock 5* configure(BasaltRockShortcut(intArrayOf(4558), 1, 0.0, "jump-across")) //Rocky Shore North Rock 5*
configure(content.global.skill.agility.shortcuts.BasaltRockShortcut(intArrayOf(4559), 1, 0.0, "jump-to")) //Rocky Shore North* configure(BasaltRockShortcut(intArrayOf(4559), 1, 0.0, "jump-to")) //Rocky Shore North*
return this return this
} }
@@ -1,7 +1,5 @@
package content.global.skill.construction package content.global.skill.construction
import content.global.skill.construction.BuildHotspot
/** /**
* Represents a hotspot. * Represents a hotspot.
* @author Emperor * @author Emperor
@@ -39,11 +39,11 @@ class ConstructionDoorPlugin : OptionHandler() {
override fun handle(player: Player, node: Node, option: String): Boolean { override fun handle(player: Player, node: Node, option: String): Boolean {
val `object` = node as Scenery val `object` = node as Scenery
val second = core.game.global.action.DoorActionHandler.getSecondDoor(`object`, player) val second = DoorActionHandler.getSecondDoor(`object`, player)
when (option) { when (option) {
"pick-lock", "force" -> return false //TODO "pick-lock", "force" -> return false //TODO
} }
core.game.global.action.DoorActionHandler.open(`object`, second, getReplaceId(`object`), getReplaceId(second), true, 500, false) DoorActionHandler.open(`object`, second, getReplaceId(`object`), getReplaceId(second), true, 500, false)
return true return true
} }
@@ -25,7 +25,7 @@ class WardrobeHandler : OptionHandler() {
} else { } else {
player.interfaceManager.open(Component(594)) player.interfaceManager.open(Component(594))
} }
return true; return true
} }
} }
@@ -10,7 +10,7 @@ import core.plugin.Initializable
* @author Ceikry * @author Ceikry
*/ */
@Initializable @Initializable
class PortalChamberDialogue(player: Player? = null) : core.game.dialogue.DialoguePlugin(player) { class PortalChamberDialogue(player: Player? = null) : DialoguePlugin(player) {
var portal = "none" var portal = "none"
override fun handle(interfaceId: Int, buttonId: Int): Boolean { override fun handle(interfaceId: Int, buttonId: Int): Boolean {
when(stage){ when(stage){
@@ -41,7 +41,7 @@ class PortalChamberDialogue(player: Player? = null) : core.game.dialogue.Dialogu
return true return true
} }
override fun newInstance(player: Player?): core.game.dialogue.DialoguePlugin { override fun newInstance(player: Player?): DialoguePlugin {
return PortalChamberDialogue(player) return PortalChamberDialogue(player)
} }
@@ -2,7 +2,7 @@ package content.global.skill.construction.decoration.questhall
import core.api.teleport import core.api.teleport
import core.game.node.entity.player.Player import core.game.node.entity.player.Player
import core.game.node.entity.player.link.audio.Audio; import core.game.node.entity.player.link.audio.Audio
import core.game.system.task.Pulse import core.game.system.task.Pulse
import core.game.world.map.Location import core.game.world.map.Location
import core.game.world.update.flag.context.Animation import core.game.world.update.flag.context.Animation
@@ -53,7 +53,7 @@ class MountedGlory : InteractionListener {
1 -> { 1 -> {
player.lock(5) player.lock(5)
player.visualize(Animation(714), Graphics(308, 100, 50)) player.visualize(Animation(714), Graphics(308, 100, 50))
player.getAudioManager().send(Audio(200), true); player.getAudioManager().send(Audio(200), true)
} }
4 -> player.animator.reset().also { teleport(player, TELEPORTS[int]) } 4 -> player.animator.reset().also { teleport(player, TELEPORTS[int]) }
} }
@@ -92,7 +92,7 @@ class LecternPlugin : OptionHandler() {
for (item in requiredItems) { for (item in requiredItems) {
val staff = MagicStaff.forId(item.id) val staff = MagicStaff.forId(item.id)
if (staff != null && player.equipment.containsAtLeastOneItem(staff.staves)) { if (staff != null && player.equipment.containsAtLeastOneItem(staff.staves)) {
continue; continue
} }
if (!player.inventory.containsItem(item)) { if (!player.inventory.containsItem(item)) {
//TODO staffs //TODO staffs
@@ -171,7 +171,7 @@ class LecternPlugin : OptionHandler() {
if (ttb != null && ttb.canMake(player)) { if (ttb != null && ttb.canMake(player)) {
player.interfaceManager.close() player.interfaceManager.close()
var requiredItemsCountingStaves = ttb.requiredItems.filter({ item -> var requiredItemsCountingStaves = ttb.requiredItems.filter({ item ->
val staff = MagicStaff.forId(item.id); val staff = MagicStaff.forId(item.id)
!(staff != null && player.equipment.containsAtLeastOneItem(staff.staves)) !(staff != null && player.equipment.containsAtLeastOneItem(staff.staves))
}).toTypedArray() }).toTypedArray()
player.pulseManager.run(object : Pulse(1) { player.pulseManager.run(object : Pulse(1) {
@@ -57,8 +57,8 @@ class ArmourStand : UseWithHandler(494, 468, 496, 470, 498, 472, 500, 502, 474,
return true return true
} }
@Initializable @Initializable
class RepairDialogue(player: Player? = null) : core.game.dialogue.DialoguePlugin(player){ class RepairDialogue(player: Player? = null) : DialoguePlugin(player){
override fun newInstance(player: Player?): core.game.dialogue.DialoguePlugin { override fun newInstance(player: Player?): DialoguePlugin {
return RepairDialogue(player) return RepairDialogue(player)
} }
var item: Item? = null var item: Item? = null
@@ -1,11 +1,10 @@
package content.global.skill.farming package content.global.skill.farming
import core.api.* import content.global.skill.farming.timers.Compost
import core.api.getOrStartTimer
import core.cache.def.impl.SceneryDefinition import core.cache.def.impl.SceneryDefinition
import core.cache.def.impl.VarbitDefinition
import core.game.node.scenery.Scenery
import core.game.node.entity.player.Player import core.game.node.entity.player.Player
import content.global.skill.farming.timers.* import core.game.node.scenery.Scenery
enum class CompostBins(val varbit: Int) { enum class CompostBins(val varbit: Int) {
FALADOR_COMPOST(740), FALADOR_COMPOST(740),
@@ -6,7 +6,7 @@ import core.game.interaction.OptionHandler
import core.game.node.Node import core.game.node.Node
import content.global.skill.summoning.familiar.GiantEntNPC import content.global.skill.summoning.familiar.GiantEntNPC
import core.game.node.entity.player.Player import core.game.node.entity.player.Player
import core.game.node.entity.player.link.audio.Audio; import core.game.node.entity.player.link.audio.Audio
import core.game.node.entity.skill.Skills import core.game.node.entity.skill.Skills
import core.game.node.item.Item import core.game.node.item.Item
import core.game.system.task.Pulse import core.game.system.task.Pulse
@@ -10,10 +10,10 @@ import core.game.world.update.flag.context.Animation
import core.plugin.Initializable import core.plugin.Initializable
@Initializable @Initializable
class DigUpPatchDialogue(player: Player? = null) : core.game.dialogue.DialoguePlugin(player) { class DigUpPatchDialogue(player: Player? = null) : DialoguePlugin(player) {
var patch: Patch? = null var patch: Patch? = null
override fun newInstance(player: Player?): core.game.dialogue.DialoguePlugin { override fun newInstance(player: Player?): DialoguePlugin {
return DigUpPatchDialogue(player) return DigUpPatchDialogue(player)
} }
@@ -299,7 +299,7 @@ class Patch(val player: Player, val patch: FarmingPatch, var plantable: Plantabl
if(patch.type == PatchType.TREE) { if(patch.type == PatchType.TREE) {
// Willow branches // Willow branches
if(harvestAmt < 6) { if(harvestAmt < 6) {
harvestAmt++; harvestAmt++
} }
} }
@@ -21,7 +21,7 @@ class CropGrowth : PersistTimer (500, "farming:crops", isSoft = true) {
//Sync the 5 minute run cycles with :05 on realtime clocks - authentic //Sync the 5 minute run cycles with :05 on realtime clocks - authentic
override fun getInitialRunDelay() : Int { override fun getInitialRunDelay() : Int {
val now = LocalTime.now(); val now = LocalTime.now()
val minsUntil5MinSync = 5 - (now.getMinute() % 5) val minsUntil5MinSync = 5 - (now.getMinute() % 5)
val ticks = secondsToTicks (minsUntil5MinSync * 60) val ticks = secondsToTicks (minsUntil5MinSync * 60)
player.debug("[CropGrowth] Scheduled first growth cycle for $ticks ticks from now.") player.debug("[CropGrowth] Scheduled first growth cycle for $ticks ticks from now.")
@@ -2,8 +2,6 @@ package content.global.skill.gather
import content.global.skill.fishing.FishingSpot import content.global.skill.fishing.FishingSpot
import content.global.skill.gather.fishing.FishingPulse import content.global.skill.gather.fishing.FishingPulse
import content.global.skill.gather.mining.MiningSkillPulse
import core.game.interaction.IntType
import core.game.interaction.InteractionListener import core.game.interaction.InteractionListener
import core.game.node.Node import core.game.node.Node
import core.game.node.entity.npc.NPC import core.game.node.entity.npc.NPC
@@ -76,7 +76,7 @@ class MiningListener : InteractionListener {
if(reward == Items.CLAY_434){ if(reward == Items.CLAY_434){
val bracelet = getItemFromEquipment(player, EquipmentSlot.HANDS) val bracelet = getItemFromEquipment(player, EquipmentSlot.HANDS)
if(bracelet != null && bracelet.id == Items.BRACELET_OF_CLAY_11074){ if(bracelet != null && bracelet.id == Items.BRACELET_OF_CLAY_11074){
var charges = player.getAttribute("jewellery-charges:bracelet-of-clay", 28); var charges = player.getAttribute("jewellery-charges:bracelet-of-clay", 28)
charges-- charges--
reward = Items.SOFT_CLAY_1761 reward = Items.SOFT_CLAY_1761
sendMessage(player, "Your bracelet of clay softens the clay for you.") sendMessage(player, "Your bracelet of clay softens the clay for you.")
@@ -141,7 +141,7 @@ class MiningSkillPulse(private val player: Player, private val node: Node) : Pul
if(reward == Items.CLAY_434){ if(reward == Items.CLAY_434){
val bracelet = getItemFromEquipment(player, EquipmentSlot.HANDS) val bracelet = getItemFromEquipment(player, EquipmentSlot.HANDS)
if(bracelet != null && bracelet.id == Items.BRACELET_OF_CLAY_11074){ if(bracelet != null && bracelet.id == Items.BRACELET_OF_CLAY_11074){
var charges = player.getAttribute("jewellery-charges:bracelet-of-clay", 28); var charges = player.getAttribute("jewellery-charges:bracelet-of-clay", 28)
charges-- charges--
reward = Items.SOFT_CLAY_1761 reward = Items.SOFT_CLAY_1761
sendMessage(player, "Your bracelet of clay softens the clay for you.") sendMessage(player, "Your bracelet of clay softens the clay for you.")
@@ -7,7 +7,7 @@ import core.game.world.map.path.ClipMaskSupplier
import core.game.node.entity.npc.* import core.game.node.entity.npc.*
import core.game.node.entity.Entity import core.game.node.entity.Entity
import core.game.node.entity.player.Player import core.game.node.entity.player.Player
import core.game.node.entity.player.link.SpellBookManager; import core.game.node.entity.player.link.SpellBookManager
import core.game.node.item.Item import core.game.node.item.Item
import core.game.node.entity.combat.CombatStyle import core.game.node.entity.combat.CombatStyle
import content.global.skill.magic.spellconsts.Modern import content.global.skill.magic.spellconsts.Modern
@@ -34,19 +34,19 @@ class ImplingBehavior : NPCBehavior (*Impling.getIds()) {
} }
override fun canBeAttackedBy(self: NPC, attacker: Entity, style: CombatStyle, shouldSendMessage: Boolean) : Boolean { override fun canBeAttackedBy(self: NPC, attacker: Entity, style: CombatStyle, shouldSendMessage: Boolean) : Boolean {
if (attacker !is Player) return false; if (attacker !is Player) return false
if (style != CombatStyle.MAGIC) { if (style != CombatStyle.MAGIC) {
if (shouldSendMessage) if (shouldSendMessage)
sendMessage (attacker, "You can't do that.") sendMessage (attacker, "You can't do that.")
return false; return false
} }
val spellBook = attacker.spellBookManager.spellBook val spellBook = attacker.spellBookManager.spellBook
if (spellBook != SpellBookManager.SpellBook.MODERN.interfaceId) { if (spellBook != SpellBookManager.SpellBook.MODERN.interfaceId) {
if (shouldSendMessage) if (shouldSendMessage)
sendMessage (attacker, "The impling is too fast for that.") sendMessage (attacker, "The impling is too fast for that.")
return false; return false
} }
val spellId = attacker.properties.spell.spellId val spellId = attacker.properties.spell.spellId
@@ -172,7 +172,7 @@ enum class ImplingSpawnLocations (val type: ImplingSpawnTypes, vararg val locati
object ImplingClipper : ClipMaskSupplier { object ImplingClipper : ClipMaskSupplier {
override fun getClippingFlag (z: Int, x: Int, y: Int) : Int { override fun getClippingFlag (z: Int, x: Int, y: Int) : Int {
var flag = RegionManager.getClippingFlag(z, x, y); var flag = RegionManager.getClippingFlag(z, x, y)
return flag and (RegionFlags.SOLID_TILE.inv()) and (RegionFlags.TILE_OBJECT.inv()) //Allow walking on water and flying over small objects, but keep all other tile flags the same. return flag and (RegionFlags.SOLID_TILE.inv()) and (RegionFlags.TILE_OBJECT.inv()) //Allow walking on water and flying over small objects, but keep all other tile flags the same.
} }
} }
@@ -1,9 +1,9 @@
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit
import core.api.* import core.api.*
import core.game.node.entity.Entity import core.game.node.entity.Entity
import core.game.node.entity.combat.CombatStyle import core.game.node.entity.combat.CombatStyle
import core.game.node.entity.impl.Animator.Priority; import core.game.node.entity.impl.Animator.Priority
import core.game.node.entity.impl.ForceMovement import core.game.node.entity.impl.ForceMovement
import core.game.node.entity.npc.AbstractNPC import core.game.node.entity.npc.AbstractNPC
import core.game.node.entity.player.Player import core.game.node.entity.player.Player
@@ -167,7 +167,7 @@ class PitfallListeners : InteractionListener {
return@setDest dst return@setDest dst
} }
on(PIT, IntType.SCENERY, "trap") { player, node -> on(PIT, IntType.SCENERY, "trap") { player, node ->
val pit = node as Scenery; val pit = node as Scenery
// TODO: check hunter level, remove logs // TODO: check hunter level, remove logs
if(player.skills.getLevel(Skills.HUNTER) < 31) { if(player.skills.getLevel(Skills.HUNTER) < 31) {
player.sendMessage("You need a hunter level of 31 to set a pitfall trap.") player.sendMessage("You need a hunter level of 31 to set a pitfall trap.")
@@ -204,12 +204,12 @@ class PitfallListeners : InteractionListener {
return@on true return@on true
} }
on(SPIKED_PIT, IntType.SCENERY, "jump") { player, node -> on(SPIKED_PIT, IntType.SCENERY, "jump") { player, node ->
val pit = node as Scenery; val pit = node as Scenery
val src = player.getLocation() val src = player.getLocation()
val dir = pitJumpSpots(pit.getLocation())!![src] val dir = pitJumpSpots(pit.getLocation())!![src]
if(dir != null) { if(dir != null) {
val dst = src.transform(dir, 3) val dst = src.transform(dir, 3)
ForceMovement.run(player, src, dst, ForceMovement.WALK_ANIMATION, Animation(1603), dir, 16); ForceMovement.run(player, src, dst, ForceMovement.WALK_ANIMATION, Animation(1603), dir, 16)
playAudio(player, getAudio(Sounds.HUNTING_JUMP_2635)) playAudio(player, getAudio(Sounds.HUNTING_JUMP_2635))
val pitfall_npc: Entity? = player.getAttribute("pitfall_npc", null) val pitfall_npc: Entity? = player.getAttribute("pitfall_npc", null)
if(pitfall_npc != null && pitfall_npc.getLocation().getDistance(src) < 3.0) { if(pitfall_npc != null && pitfall_npc.getLocation().getDistance(src) < 3.0) {
@@ -247,7 +247,7 @@ class PitfallListeners : InteractionListener {
return@on true return@on true
} }
on(SPIKED_PIT, IntType.SCENERY, "dismantle") { player, node -> on(SPIKED_PIT, IntType.SCENERY, "dismantle") { player, node ->
val pit = node as Scenery; val pit = node as Scenery
playAudio(player, getAudio(Sounds.HUNTING_TAKEBRANCHES_2649)) playAudio(player, getAudio(Sounds.HUNTING_TAKEBRANCHES_2649))
player.removeAttribute("pitfall:timestamp:${pit.location.x}:${pit.location.y}") player.removeAttribute("pitfall:timestamp:${pit.location.x}:${pit.location.y}")
player.incrementAttribute("pitfall:count", -1) player.incrementAttribute("pitfall:count", -1)
@@ -289,11 +289,11 @@ class PitfallListeners : InteractionListener {
fun lootCorpse(player: Player, pit: Scenery, xp: Double, goodFur: Int, badFur: Int) { fun lootCorpse(player: Player, pit: Scenery, xp: Double, goodFur: Int, badFur: Int) {
if(player.inventory.freeSlots() < 2) { if(player.inventory.freeSlots() < 2) {
player.sendMessage("You don't have enough inventory space. You need 2 more free slots."); player.sendMessage("You don't have enough inventory space. You need 2 more free slots.")
return return
} }
setPitState(player, pit.location, 0) setPitState(player, pit.location, 0)
player.getSkills().addExperience(Skills.HUNTER, xp, true); player.getSkills().addExperience(Skills.HUNTER, xp, true)
player.inventory.add(Item(Items.BIG_BONES_532)) player.inventory.add(Item(Items.BIG_BONES_532))
playAudio(player, getAudio(Sounds.HUNTING_TAKEBRANCHES_2649)) playAudio(player, getAudio(Sounds.HUNTING_TAKEBRANCHES_2649))
// TODO: what's the actual probability of tatty vs perfect fur? // TODO: what's the actual probability of tatty vs perfect fur?
@@ -87,7 +87,7 @@ class ModernListeners : SpellListener("modern"){
onCast(Modern.CAMELOT_TELEPORT, NONE){ player, _-> onCast(Modern.CAMELOT_TELEPORT, NONE){ player, _->
requires(player,45, arrayOf(Item(Items.AIR_RUNE_556,5),Item(Items.LAW_RUNE_563))) requires(player,45, arrayOf(Item(Items.AIR_RUNE_556,5),Item(Items.LAW_RUNE_563)))
player.achievementDiaryManager.finishTask(player, DiaryType.SEERS_VILLAGE, 1, 5); player.achievementDiaryManager.finishTask(player, DiaryType.SEERS_VILLAGE, 1, 5)
sendTeleport(player,55.5, Location.create(2758, 3478, 0)) sendTeleport(player,55.5, Location.create(2758, 3478, 0))
} }
@@ -1,10 +1,11 @@
package content.global.skill.magic.modern package content.global.skill.magic.modern
import core.api.* import core.api.getAudio
import org.json.simple.* import core.api.playAudio
import core.game.system.timer.* import core.api.sendMessage
import core.game.node.entity.Entity import core.game.node.entity.Entity
import core.game.node.entity.player.Player import core.game.node.entity.player.Player
import core.game.system.timer.PersistTimer
class SpellCharge : PersistTimer (700, "magic:spellcharge") { class SpellCharge : PersistTimer (700, "magic:spellcharge") {
override fun run (entity: Entity) : Boolean { override fun run (entity: Entity) : Boolean {
@@ -220,7 +220,7 @@ enum class SkillcapePerks(val attribute: String, val effect: ((Player) -> Unit)?
override fun open(vararg args: Any?): Boolean { override fun open(vararg args: Any?): Boolean {
options("Air","Mind","Water","Earth","More...") options("Air","Mind","Water","Earth","More...")
stage = 0; stage = 0
return true return true
} }
@@ -1,10 +1,6 @@
package content.global.skill.slayer package content.global.skill.slayer
import content.global.handlers.item.equipment.special.DragonfireSwingHandler import content.global.handlers.item.equipment.special.DragonfireSwingHandler
import core.api.EquipmentSlot
import core.api.getItemFromEquipment
import core.game.node.entity.Entity
import core.game.node.entity.combat.BattleState
import core.game.node.entity.combat.CombatStyle import core.game.node.entity.combat.CombatStyle
import core.game.node.entity.combat.CombatSwingHandler import core.game.node.entity.combat.CombatSwingHandler
import core.game.node.entity.combat.MultiSwingHandler import core.game.node.entity.combat.MultiSwingHandler
@@ -12,10 +8,8 @@ import core.game.node.entity.combat.equipment.SwitchAttack
import core.game.node.entity.npc.NPC import core.game.node.entity.npc.NPC
import core.game.node.entity.npc.NPCBehavior import core.game.node.entity.npc.NPCBehavior
import core.game.node.entity.player.Player import core.game.node.entity.player.Player
import core.game.node.entity.player.link.prayer.PrayerType
import core.game.world.update.flag.context.Animation import core.game.world.update.flag.context.Animation
import core.game.world.update.flag.context.Graphics import core.game.world.update.flag.context.Graphics
import core.tools.RandomFunction
import org.rs09.consts.Items import org.rs09.consts.Items
class SkeletalWyvernBehavior : NPCBehavior(*Tasks.SKELETAL_WYVERN.ids) { class SkeletalWyvernBehavior : NPCBehavior(*Tasks.SKELETAL_WYVERN.ids) {
@@ -19,34 +19,34 @@ class SummoningTabListener : InterfaceListener {
player.getPacketDispatch().sendMessage("Your familiar is not a beast of burden.") player.getPacketDispatch().sendMessage("Your familiar is not a beast of burden.")
return@on true return@on true
} }
val beast = player.getFamiliarManager().getFamiliar() as BurdenBeast; val beast = player.getFamiliarManager().getFamiliar() as BurdenBeast
if (beast.getContainer().isEmpty()) { if (beast.getContainer().isEmpty()) {
player.getPacketDispatch().sendMessage("Your familiar is not carrying any items.") player.getPacketDispatch().sendMessage("Your familiar is not carrying any items.")
return@on true return@on true
} }
beast.withdrawAll(); beast.withdrawAll()
return@on true return@on true
} }
player.getPacketDispatch().sendMessage("You don't have a follower."); player.getPacketDispatch().sendMessage("You don't have a follower.")
} }
53 -> { 53 -> {
if (player.getFamiliarManager().hasFamiliar()) { if (player.getFamiliarManager().hasFamiliar()) {
if(opcode == 155) { if(opcode == 155) {
// Dismiss familiar // Dismiss familiar
player.getDialogueInterpreter().open("dismiss_dial"); player.getDialogueInterpreter().open("dismiss_dial")
} else if(opcode == 196) { } else if(opcode == 196) {
// Dismiss now // Dismiss now
player.getFamiliarManager().dismiss(false); player.getFamiliarManager().dismiss(false)
} }
} else { } else {
player.getPacketDispatch().sendMessage("You don't have a follower."); player.getPacketDispatch().sendMessage("You don't have a follower.")
} }
} }
else -> { else -> {
if (player.getFamiliarManager().hasFamiliar()) { if (player.getFamiliarManager().hasFamiliar()) {
player.getFamiliarManager().getFamiliar().executeSpecialMove(FamiliarSpecial(player)); player.getFamiliarManager().getFamiliar().executeSpecialMove(FamiliarSpecial(player))
} else { } else {
player.getPacketDispatch().sendMessage("You don't have a follower."); player.getPacketDispatch().sendMessage("You don't have a follower.")
} }
} }
} }
@@ -51,21 +51,21 @@ object CanoeUtils {
2 -> FROM_BARBARIAN.getOrDefault(destId,0) 2 -> FROM_BARBARIAN.getOrDefault(destId,0)
3 -> FROM_EDGE.getOrDefault(destId,0) 3 -> FROM_EDGE.getOrDefault(destId,0)
4 -> FROM_WILDERNESS.getOrDefault(destId,0) 4 -> FROM_WILDERNESS.getOrDefault(destId,0)
else -> 0; else -> 0
} }
} }
fun getShapeAnimation(axe: SkillingTool): Animation{ fun getShapeAnimation(axe: SkillingTool): Animation{
return when(axe){ return when(axe){
SkillingTool.BRONZE_AXE -> Animation(6744); SkillingTool.BRONZE_AXE -> Animation(6744)
SkillingTool.IRON_AXE -> Animation(6743); SkillingTool.IRON_AXE -> Animation(6743)
SkillingTool.STEEL_AXE -> Animation(6742); SkillingTool.STEEL_AXE -> Animation(6742)
SkillingTool.BLACK_AXE -> Animation(6741); SkillingTool.BLACK_AXE -> Animation(6741)
SkillingTool.MITHRIL_AXE -> Animation(6740); SkillingTool.MITHRIL_AXE -> Animation(6740)
SkillingTool.ADAMANT_AXE -> Animation(6739); SkillingTool.ADAMANT_AXE -> Animation(6739)
SkillingTool.RUNE_AXE -> Animation(6738); SkillingTool.RUNE_AXE -> Animation(6738)
SkillingTool.DRAGON_AXE -> Animation(6745); SkillingTool.DRAGON_AXE -> Animation(6745)
else -> axe.animation; else -> axe.animation
} }
} }
@@ -27,11 +27,11 @@ enum class AFUBeacon(val title: String, val fmLevel: Int, val varbit: Int, val l
PLATEAU("",92,5159,Location.create(2964, 3931, 0),147.9); PLATEAU("",92,5159,Location.create(2964, 3931, 0),147.9);
companion object { companion object {
fun forLocation(location: Location): content.minigame.allfiredup.AFUBeacon { fun forLocation(location: Location): AFUBeacon {
for (beacon in values()) { for (beacon in values()) {
if (beacon.location.equals(location)) return beacon if (beacon.location.equals(location)) return beacon
} }
return content.minigame.allfiredup.AFUBeacon.RIVER_SALVE.also { log(this::class.java, Log.WARN, "Unhandled Beacon Location ${location.toString()}") } return AFUBeacon.RIVER_SALVE.also { log(this::class.java, Log.WARN, "Unhandled Beacon Location ${location.toString()}") }
} }
fun resetAllBeacons(player: Player){ fun resetAllBeacons(player: Player){
@@ -61,7 +61,7 @@ enum class AFUBeacon(val title: String, val fmLevel: Int, val varbit: Int, val l
setVarbit(player, varbit, 1, true) setVarbit(player, varbit, 1, true)
} }
fun getState(player: Player): content.minigame.allfiredup.BeaconState { fun getState(player: Player): BeaconState {
return BeaconState.values()[getVarbit(player, varbit)] return BeaconState.values()[getVarbit(player, varbit)]
} }
} }
@@ -23,26 +23,26 @@ class AFUBeaconListeners : InteractionListener {
override fun defineListeners() { override fun defineListeners() {
on(IntType.SCENERY,"add-logs","light"){ player, node -> on(IntType.SCENERY,"add-logs","light"){ player, node ->
val beacon = content.minigame.allfiredup.AFUBeacon.forLocation(node.location) val beacon = AFUBeacon.forLocation(node.location)
val questComplete = player.questRepository.isComplete("All Fired Up") val questComplete = player.questRepository.isComplete("All Fired Up")
val questStage = player.questRepository.getStage("All Fired Up") val questStage = player.questRepository.getStage("All Fired Up")
if ((beacon != content.minigame.allfiredup.AFUBeacon.RIVER_SALVE && beacon != content.minigame.allfiredup.AFUBeacon.RAG_AND_BONE && !questComplete) if ((beacon != AFUBeacon.RIVER_SALVE && beacon != AFUBeacon.RAG_AND_BONE && !questComplete)
|| (beacon == content.minigame.allfiredup.AFUBeacon.RIVER_SALVE && questStage < 20 && !questComplete) || (beacon == AFUBeacon.RIVER_SALVE && questStage < 20 && !questComplete)
|| (beacon == content.minigame.allfiredup.AFUBeacon.RAG_AND_BONE && questStage < 50 && !questComplete)) { || (beacon == AFUBeacon.RAG_AND_BONE && questStage < 50 && !questComplete)) {
player.dialogueInterpreter.sendDialogues(player, core.game.dialogue.FacialExpression.THINKING, "I probably shouldn't mess with this.") player.dialogueInterpreter.sendDialogues(player, core.game.dialogue.FacialExpression.THINKING, "I probably shouldn't mess with this.")
return@on true return@on true
} }
player.debug(beacon.getState(player).name) player.debug(beacon.getState(player).name)
when (beacon.getState(player)) { when (beacon.getState(player)) {
content.minigame.allfiredup.BeaconState.EMPTY -> fillBeacon(player, beacon, questComplete) BeaconState.EMPTY -> fillBeacon(player, beacon, questComplete)
content.minigame.allfiredup.BeaconState.DYING -> restoreBeacon(player, beacon, questComplete) BeaconState.DYING -> restoreBeacon(player, beacon, questComplete)
content.minigame.allfiredup.BeaconState.FILLED -> lightBeacon(player, beacon, questComplete) BeaconState.FILLED -> lightBeacon(player, beacon, questComplete)
content.minigame.allfiredup.BeaconState.LIT, content.minigame.allfiredup.BeaconState.WARNING -> { BeaconState.LIT, BeaconState.WARNING -> {
player.debug("INVALID BEACON STATE") player.debug("INVALID BEACON STATE")
} }
} }
@@ -50,24 +50,24 @@ class AFUBeaconListeners : InteractionListener {
} }
} }
fun fillBeacon(player: Player, beacon: content.minigame.allfiredup.AFUBeacon, questComplete: Boolean){ fun fillBeacon(player: Player, beacon: AFUBeacon, questComplete: Boolean){
when(beacon){ when(beacon){
content.minigame.allfiredup.AFUBeacon.MONASTERY -> { AFUBeacon.MONASTERY -> {
if(player.skills.getLevel(Skills.PRAYER) < 31){ if(player.skills.getLevel(Skills.PRAYER) < 31){
player.dialogueInterpreter.sendDialogues(NPC(beacon.keeper).getShownNPC(player), core.game.dialogue.FacialExpression.ANGRY,"You must join the monastery to light this beacon!") player.dialogueInterpreter.sendDialogues(NPC(beacon.keeper).getShownNPC(player), core.game.dialogue.FacialExpression.ANGRY,"You must join the monastery to light this beacon!")
return return
} }
} }
content.minigame.allfiredup.AFUBeacon.GWD -> { AFUBeacon.GWD -> {
if(!AFURepairClimbHandler.isRepaired(player, beacon)){ if(!AFURepairClimbHandler.isRepaired(player, beacon)){
player.dialogueInterpreter.sendDialogue("You must repair the windbreak before you","can light this beacon.") player.dialogueInterpreter.sendDialogue("You must repair the windbreak before you","can light this beacon.")
return return
} }
} }
content.minigame.allfiredup.AFUBeacon.GOBLIN_VILLAGE -> { AFUBeacon.GOBLIN_VILLAGE -> {
if(!player.questRepository.isComplete("Lost Tribe")){ if(!player.questRepository.isComplete("Lost Tribe")){
player.dialogueInterpreter.sendDialogues(NPC(beacon.keeper).getShownNPC(player), core.game.dialogue.FacialExpression.THINKING,"We no trust you outsider. You no light our beacon.","(Complete Lost Tribe to use this beacon.)") player.dialogueInterpreter.sendDialogues(NPC(beacon.keeper).getShownNPC(player), core.game.dialogue.FacialExpression.THINKING,"We no trust you outsider. You no light our beacon.","(Complete Lost Tribe to use this beacon.)")
return return
@@ -117,7 +117,7 @@ class AFUBeaconListeners : InteractionListener {
} }
} }
fun lightBeacon(player: Player, beacon: content.minigame.allfiredup.AFUBeacon, questComplete: Boolean){ fun lightBeacon(player: Player, beacon: AFUBeacon, questComplete: Boolean){
var session: AFUSession? = null var session: AFUSession? = null
if(questComplete){ if(questComplete){
session = player.getAttribute("afu-session",null) session = player.getAttribute("afu-session",null)
@@ -164,7 +164,7 @@ class AFUBeaconListeners : InteractionListener {
} }
} }
fun restoreBeacon(player: Player, beacon: content.minigame.allfiredup.AFUBeacon, questComplete: Boolean){ fun restoreBeacon(player: Player, beacon: AFUBeacon, questComplete: Boolean){
var session: AFUSession? = null var session: AFUSession? = null
if(questComplete){ if(questComplete){
session = player.getAttribute("afu-session",null) session = player.getAttribute("afu-session",null)
@@ -129,11 +129,11 @@ class AFURepairClimbHandler : InteractionListener {
} }
companion object { companion object {
fun isRepaired(player: Player, beacon: content.minigame.allfiredup.AFUBeacon): Boolean{ fun isRepaired(player: Player, beacon: AFUBeacon): Boolean{
if(beacon == content.minigame.allfiredup.AFUBeacon.DEATH_PLATEAU) return RepairClimbObject.DEATH_PLATEAU.isRepaired(player) if(beacon == AFUBeacon.DEATH_PLATEAU) return RepairClimbObject.DEATH_PLATEAU.isRepaired(player)
if(beacon == content.minigame.allfiredup.AFUBeacon.BURTHORPE) return RepairClimbObject.BURTHORPE.isRepaired(player) if(beacon == AFUBeacon.BURTHORPE) return RepairClimbObject.BURTHORPE.isRepaired(player)
if(beacon == content.minigame.allfiredup.AFUBeacon.GWD) return RepairClimbObject.GWD.isRepaired(player) if(beacon == AFUBeacon.GWD) return RepairClimbObject.GWD.isRepaired(player)
if(beacon == content.minigame.allfiredup.AFUBeacon.TEMPLE) return RepairClimbObject.TEMPLE.isRepaired(player) if(beacon == AFUBeacon.TEMPLE) return RepairClimbObject.TEMPLE.isRepaired(player)
else return true else return true
} }
} }
@@ -13,7 +13,7 @@ import core.tools.colorize
* @author Ceikry * @author Ceikry
*/ */
class AFUSession(val player: Player? = null) : LogoutListener { class AFUSession(val player: Player? = null) : LogoutListener {
private val beaconTimers = Array(14){i -> BeaconTimer(0, content.minigame.allfiredup.AFUBeacon.values()[i]) } private val beaconTimers = Array(14){i -> BeaconTimer(0, AFUBeacon.values()[i]) }
private val logInventories = Array(14){Item(0,0)} private val logInventories = Array(14){Item(0,0)}
private val beaconWatched = Array(14){false} private val beaconWatched = Array(14){false}
private var isActive = false private var isActive = false
@@ -61,7 +61,7 @@ class AFUSession(val player: Player? = null) : LogoutListener {
beaconTimers[beaconIndex].ticks = ticks beaconTimers[beaconIndex].ticks = ticks
} }
fun refreshTimer(beacon: content.minigame.allfiredup.AFUBeacon, logID: Int){ fun refreshTimer(beacon: AFUBeacon, logID: Int){
val ticks = getTicks(logID) * 5 val ticks = getTicks(logID) * 5
beaconTimers.forEach { beaconTimers.forEach {
if(it.beacon.ordinal == beacon.ordinal) it.ticks += ticks if(it.beacon.ordinal == beacon.ordinal) it.ticks += ticks
@@ -111,11 +111,11 @@ class AFUSession(val player: Player? = null) : LogoutListener {
} }
override fun logout(player: Player) { override fun logout(player: Player) {
content.minigame.allfiredup.AFUBeacon.resetAllBeacons(player) AFUBeacon.resetAllBeacons(player)
val session: AFUSession? = player.getAttribute("afu-session",null) val session: AFUSession? = player.getAttribute("afu-session",null)
session?.end() session?.end()
player.removeAttribute("afu-session") player.removeAttribute("afu-session")
} }
internal class BeaconTimer(var ticks: Int, val beacon: content.minigame.allfiredup.AFUBeacon) internal class BeaconTimer(var ticks: Int, val beacon: AFUBeacon)
} }
@@ -14,22 +14,22 @@ private val VALID_LOGS = arrayOf(Items.LOGS_1511, Items.OAK_LOGS_1521, Items.WIL
@Initializable @Initializable
//TODO: Add requirements for beacon keepers to watch beacons, most of the requirements were not possible to implement at the time of writing this. //TODO: Add requirements for beacon keepers to watch beacons, most of the requirements were not possible to implement at the time of writing this.
class BeaconTenderDialogue(player: Player? = null) : core.game.dialogue.DialoguePlugin(player) { class BeaconTenderDialogue(player: Player? = null) : DialoguePlugin(player) {
var index = 0 var index = 0
override fun newInstance(player: Player?): core.game.dialogue.DialoguePlugin { override fun newInstance(player: Player?): DialoguePlugin {
return BeaconTenderDialogue(player) return BeaconTenderDialogue(player)
} }
override fun open(vararg args: Any?): Boolean { override fun open(vararg args: Any?): Boolean {
npc = (args[0] as NPC).getShownNPC(player) npc = (args[0] as NPC).getShownNPC(player)
index = getIndexOf((args[0] as NPC).originalId) index = getIndexOf((args[0] as NPC).originalId)
if(index == content.minigame.allfiredup.AFUBeacon.GWD.ordinal && player.skills.getLevel(Skills.SUMMONING) < 81){ if(index == AFUBeacon.GWD.ordinal && player.skills.getLevel(Skills.SUMMONING) < 81){
npc("Awwf uurrrhur","(You need 81 Summoning to communicate with Nanuq.)") npc("Awwf uurrrhur","(You need 81 Summoning to communicate with Nanuq.)")
stage = 1000 stage = 1000
return true return true
} }
if(index == content.minigame.allfiredup.AFUBeacon.MONASTERY.ordinal && player.skills.getLevel(Skills.PRAYER) < 53){ if(index == AFUBeacon.MONASTERY.ordinal && player.skills.getLevel(Skills.PRAYER) < 53){
npc("I will aid you when your devotion is","strong enough.","(You need 53 Prayer for him to assist you.)") npc("I will aid you when your devotion is","strong enough.","(You need 53 Prayer for him to assist you.)")
stage = 1000 stage = 1000
return true return true
@@ -39,12 +39,12 @@ class BeaconTenderDialogue(player: Player? = null) : core.game.dialogue.Dialogue
} }
override fun handle(interfaceId: Int, buttonId: Int): Boolean { override fun handle(interfaceId: Int, buttonId: Int): Boolean {
val beacon = content.minigame.allfiredup.AFUBeacon.values()[index] val beacon = AFUBeacon.values()[index]
val logs = getLogs(player,5) val logs = getLogs(player,5)
val session: AFUSession? = player.getAttribute("afu-session",null) val session: AFUSession? = player.getAttribute("afu-session",null)
when(stage){ when(stage){
0 -> player("Hello!").also { stage++ } 0 -> player("Hello!").also { stage++ }
1 -> if(beacon.getState(player) == content.minigame.allfiredup.BeaconState.LIT && session?.isWatched(index) == false){ 1 -> if(beacon.getState(player) == BeaconState.LIT && session?.isWatched(index) == false){
options("Can you watch this beacon for me?","Nevermind.").also { stage = 10 } options("Can you watch this beacon for me?","Nevermind.").also { stage = 10 }
} else { } else {
npc("Carry on, adventurer.").also { stage = 1000 } npc("Carry on, adventurer.").also { stage = 1000 }
@@ -14,14 +14,14 @@ import java.time.temporal.ChronoUnit
import java.util.* import java.util.*
@Initializable @Initializable
class CaptainCainDialogue(player: Player? = null) : core.game.dialogue.DialoguePlugin(player) { class CaptainCainDialogue(player: Player? = null) : DialoguePlugin(player) {
val sdf = SimpleDateFormat("ddMMyyyy") val sdf = SimpleDateFormat("ddMMyyyy")
override fun newInstance(player: Player?): core.game.dialogue.DialoguePlugin { override fun newInstance(player: Player?): DialoguePlugin {
return CaptainCainDialogue(player) return CaptainCainDialogue(player)
} }
override fun open(vararg args: Any?): Boolean { override fun open(vararg args: Any?): Boolean {
npcl(core.game.dialogue.FacialExpression.FRIENDLY, "Hello, there, adventurer. Say, you wouldn't happen to be interested in purchasing a Fighter Torso would you?") npcl(FacialExpression.FRIENDLY, "Hello, there, adventurer. Say, you wouldn't happen to be interested in purchasing a Fighter Torso would you?")
stage = 0 stage = 0
return true return true
} }
@@ -31,26 +31,26 @@ class CaptainCainDialogue(player: Player? = null) : core.game.dialogue.DialogueP
val now = Date().toInstant() val now = Date().toInstant()
val days = ChronoUnit.DAYS.between(start,now) val days = ChronoUnit.DAYS.between(start,now)
when(stage){ when(stage){
0 -> npcl(core.game.dialogue.FacialExpression.ANNOYED,"I'm having to offer this service because it's been $days days since Ryan promised to give us barbarian assault.").also { stage++ } 0 -> npcl(FacialExpression.ANNOYED,"I'm having to offer this service because it's been $days days since Ryan promised to give us barbarian assault.").also { stage++ }
1 -> options("Yes, please.","No, thanks.").also { stage++ } 1 -> options("Yes, please.","No, thanks.").also { stage++ }
2 -> when(buttonId){ 2 -> when(buttonId){
1 -> playerl(core.game.dialogue.FacialExpression.FRIENDLY, "Yes, please.").also { stage = 10 } 1 -> playerl(FacialExpression.FRIENDLY, "Yes, please.").also { stage = 10 }
2 -> playerl(core.game.dialogue.FacialExpression.HALF_THINKING, "No, thanks.").also { stage = END_DIALOGUE } 2 -> playerl(FacialExpression.HALF_THINKING, "No, thanks.").also { stage = END_DIALOGUE }
} }
10 -> npcl(core.game.dialogue.FacialExpression.FRIENDLY, "Alright, then, that'll be 7,500,000 gold please.").also { stage++ } 10 -> npcl(FacialExpression.FRIENDLY, "Alright, then, that'll be 7,500,000 gold please.").also { stage++ }
11 -> options("Here you go!","Nevermind.").also { stage++ } 11 -> options("Here you go!","Nevermind.").also { stage++ }
12 -> when(buttonId){ 12 -> when(buttonId){
1 -> if(inInventory(player, 995, 7500000)) 1 -> if(inInventory(player, 995, 7500000))
playerl(core.game.dialogue.FacialExpression.FRIENDLY, "Here you go!").also { stage = 20 } playerl(FacialExpression.FRIENDLY, "Here you go!").also { stage = 20 }
else else
playerl(core.game.dialogue.FacialExpression.HALF_GUILTY, "Actually, I don't have that much.").also { stage = END_DIALOGUE } playerl(FacialExpression.HALF_GUILTY, "Actually, I don't have that much.").also { stage = END_DIALOGUE }
2 -> playerl(core.game.dialogue.FacialExpression.FRIENDLY, "On second thought, nevermind.").also { stage = END_DIALOGUE } 2 -> playerl(FacialExpression.FRIENDLY, "On second thought, nevermind.").also { stage = END_DIALOGUE }
} }
20 -> { 20 -> {
npcl(core.game.dialogue.FacialExpression.FRIENDLY, "Thank you much, kind sir. And here's your torso.") npcl(FacialExpression.FRIENDLY, "Thank you much, kind sir. And here's your torso.")
if(removeItem(player, Item(995,7500000), Container.INVENTORY)) { if(removeItem(player, Item(995,7500000), Container.INVENTORY)) {
addItem(player, Items.FIGHTER_TORSO_10551, 1) addItem(player, Items.FIGHTER_TORSO_10551, 1)
} }
@@ -93,7 +93,7 @@ object RewardChest {
player.interfaceManager.open(Component(Components.TRAIL_REWARD_364)) player.interfaceManager.open(Component(Components.TRAIL_REWARD_364))
BossKillCounter.addtoBarrowsCount(player) BossKillCounter.addtoBarrowsCount(player)
for(item in rewards){ for(item in rewards){
announceIfRare(player, item); announceIfRare(player, item)
if(!player.inventory.add(item)){ if(!player.inventory.add(item)){
GroundItemManager.create(item,player) GroundItemManager.create(item,player)
} }
@@ -185,7 +185,7 @@ object BlastFurnace {
if(bar.product.id == Items.GOLD_BAR_2357 && if(bar.product.id == Items.GOLD_BAR_2357 &&
player.equipment[EquipmentContainer.SLOT_HANDS] != null && player.equipment[EquipmentContainer.SLOT_HANDS] != null &&
player.equipment[EquipmentContainer.SLOT_HANDS].id == GOLDSMITH_GAUNTLETS_776) { player.equipment[EquipmentContainer.SLOT_HANDS].id == GOLDSMITH_GAUNTLETS_776) {
experience *= 2.5; experience *= 2.5
} }
rewardXP(player, Skills.SMITHING, experience) rewardXP(player, Skills.SMITHING, experience)
totalAmount = barsAmount + oreAmount totalAmount = barsAmount + oreAmount
@@ -19,13 +19,13 @@ import core.tools.START_DIALOGUE
* @author vddCore * @author vddCore
*/ */
@Initializable @Initializable
class MaximillianSackvilleDialogue(player: Player? = null) : core.game.dialogue.DialoguePlugin(player) { class MaximillianSackvilleDialogue(player: Player? = null) : DialoguePlugin(player) {
override fun handle(interfaceId: Int, buttonId: Int): Boolean { override fun handle(interfaceId: Int, buttonId: Int): Boolean {
when (stage) { when (stage) {
START_DIALOGUE -> when { START_DIALOGUE -> when {
hasIronmanRestriction(player, IronmanMode.ULTIMATE) -> { hasIronmanRestriction(player, IronmanMode.ULTIMATE) -> {
npcl( npcl(
core.game.dialogue.FacialExpression.NEUTRAL, FacialExpression.NEUTRAL,
"My apologies, dear ${if (player.isMale) "sir" else "madam"}, " + "My apologies, dear ${if (player.isMale) "sir" else "madam"}, " +
"our services are not available for Ultimate ${if (player.isMale) "Ironmen" else "Ironwomen"}." "our services are not available for Ultimate ${if (player.isMale) "Ironmen" else "Ironwomen"}."
).also { stage = END_DIALOGUE } ).also { stage = END_DIALOGUE }
@@ -33,7 +33,7 @@ class MaximillianSackvilleDialogue(player: Player? = null) : core.game.dialogue.
else -> { else -> {
npcl( npcl(
core.game.dialogue.FacialExpression.NEUTRAL, FacialExpression.NEUTRAL,
"Good day, how may I help you?" "Good day, how may I help you?"
).also { ).also {
if (hasAwaitingGrandExchangeCollections(player)) { if (hasAwaitingGrandExchangeCollections(player)) {
@@ -46,44 +46,44 @@ class MaximillianSackvilleDialogue(player: Player? = null) : core.game.dialogue.
} }
1 -> npcl( 1 -> npcl(
core.game.dialogue.FacialExpression.NEUTRAL, FacialExpression.NEUTRAL,
"Before we go any further, I should inform you that you " + "Before we go any further, I should inform you that you " +
"have items ready for collection from the Grand Exchange." "have items ready for collection from the Grand Exchange."
).also { stage++ } ).also { stage++ }
2 -> playerl( 2 -> playerl(
core.game.dialogue.FacialExpression.ASKING, FacialExpression.ASKING,
"Who are you?" "Who are you?"
).also { stage++ } ).also { stage++ }
3 -> npcl( 3 -> npcl(
core.game.dialogue.FacialExpression.NEUTRAL, FacialExpression.NEUTRAL,
"How inconsiderate of me, dear ${if (player.isMale) "sir" else "madam"}. " + "How inconsiderate of me, dear ${if (player.isMale) "sir" else "madam"}. " +
"My name is Maximillian Sackville and I conduct operations here on behalf " + "My name is Maximillian Sackville and I conduct operations here on behalf " +
"of The Bank of Gielinor." "of The Bank of Gielinor."
).also { stage++ } ).also { stage++ }
4 -> showTopics( 4 -> showTopics(
Topic(core.game.dialogue.FacialExpression.NEUTRAL, "I'd like to access my bank account.", 10), Topic(FacialExpression.NEUTRAL, "I'd like to access my bank account.", 10),
IfTopic( IfTopic(
core.game.dialogue.FacialExpression.NEUTRAL, FacialExpression.NEUTRAL,
"I'd like to switch to my ${getBankAccountName(player, true)} bank account.", "I'd like to switch to my ${getBankAccountName(player, true)} bank account.",
11, 11,
hasActivatedSecondaryBankAccount(player) hasActivatedSecondaryBankAccount(player)
), ),
Topic(core.game.dialogue.FacialExpression.NEUTRAL, "I'd like to check my PIN settings.", 12), Topic(FacialExpression.NEUTRAL, "I'd like to check my PIN settings.", 12),
Topic(core.game.dialogue.FacialExpression.NEUTRAL, "I'd like to collect items.", 13), Topic(FacialExpression.NEUTRAL, "I'd like to collect items.", 13),
Topic(core.game.dialogue.FacialExpression.ASKING, "Aren't you afraid of working in the Wilderness?", 5) Topic(FacialExpression.ASKING, "Aren't you afraid of working in the Wilderness?", 5)
) )
5 -> npcl( 5 -> npcl(
core.game.dialogue.FacialExpression.NEUTRAL, FacialExpression.NEUTRAL,
"While the Wilderness is quite a dangerous place, The Bank of Gielinor offers " + "While the Wilderness is quite a dangerous place, The Bank of Gielinor offers " +
"us - roving bankers - extraordinary benefits for our hard work in hazardous environments." "us - roving bankers - extraordinary benefits for our hard work in hazardous environments."
).also { stage++ } ).also { stage++ }
6 -> npcl( 6 -> npcl(
core.game.dialogue.FacialExpression.NEUTRAL, FacialExpression.NEUTRAL,
"This allows us to provide our services to customers regardless of their current " + "This allows us to provide our services to customers regardless of their current " +
"whereabouts. Our desire to serve is stronger than our fear of the Wilderness." "whereabouts. Our desire to serve is stronger than our fear of the Wilderness."
).also { stage = END_DIALOGUE } ).also { stage = END_DIALOGUE }
@@ -97,7 +97,7 @@ class MaximillianSackvilleDialogue(player: Player? = null) : core.game.dialogue.
toggleBankAccount(player) toggleBankAccount(player)
npcl( npcl(
core.game.dialogue.FacialExpression.NEUTRAL, FacialExpression.NEUTRAL,
"Naturally. You can now access your ${getBankAccountName(player)} bank account." "Naturally. You can now access your ${getBankAccountName(player)} bank account."
).also { stage = END_DIALOGUE } ).also { stage = END_DIALOGUE }
} }
@@ -14,9 +14,9 @@ object CastleWarsOverlay {
@JvmStatic @JvmStatic
fun sendGameUpdate(player: Player) { fun sendGameUpdate(player: Player) {
// Todo - Figure out underground mine/etc // Todo - Figure out underground mine/etc
setVarbit(player, 143, 0); // Flag status - safe = 0, taken = 1, dropped = 2 setVarbit(player, 143, 0) // Flag status - safe = 0, taken = 1, dropped = 2
setVarbit(player, 145, 5); // Saradomin's score setVarbit(player, 145, 5) // Saradomin's score
setVarbit(player, 153, 0); // Flag status - safe = 0, taken = 1, dropped = 2 setVarbit(player, 153, 0) // Flag status - safe = 0, taken = 1, dropped = 2
setVarbit(player, 155, 7); // Zamorak's score setVarbit(player, 155, 7) // Zamorak's score
} }
} }
@@ -11,12 +11,12 @@ import core.plugin.Initializable
*/ */
@Initializable @Initializable
class AfrahDialogue : core.game.dialogue.DialoguePlugin { class AfrahDialogue : DialoguePlugin {
private val conversations = arrayOf (0, 4, 10, 11, 15, 17, 20, 22, 23, 24, 29, 32) private val conversations = arrayOf (0, 4, 10, 11, 15, 17, 20, 22, 23, 24, 29, 32)
override fun open(vararg args: Any): Boolean { override fun open(vararg args: Any): Boolean {
player(core.game.dialogue.FacialExpression.ASKING, "Hi!") player(FacialExpression.ASKING, "Hi!")
stage = conversations.random() stage = conversations.random()
npc = args[0] as NPC npc = args[0] as NPC
return true return true
@@ -32,135 +32,135 @@ class AfrahDialogue : core.game.dialogue.DialoguePlugin {
override fun handle(interfaceId: Int, buttonId: Int): Boolean { override fun handle(interfaceId: Int, buttonId: Int): Boolean {
when (stage) { when (stage) {
0 -> { 0 -> {
npc(core.game.dialogue.FacialExpression.ASKING, "Ooh. This is exciting!") npc(FacialExpression.ASKING, "Ooh. This is exciting!")
stage++ stage++
} }
1 -> { 1 -> {
player(core.game.dialogue.FacialExpression.ASKING, "Yup!") player(FacialExpression.ASKING, "Yup!")
stage = 99 stage = 99
} }
2 -> { 2 -> {
npc(core.game.dialogue.FacialExpression.ASKING, "I wouldn't want to be the poor guy that has to", "clean up after the duels.") npc(FacialExpression.ASKING, "I wouldn't want to be the poor guy that has to", "clean up after the duels.")
stage++ stage++
} }
3 -> { 3 -> {
player(core.game.dialogue.FacialExpression.ASKING, "Me neither.") player(FacialExpression.ASKING, "Me neither.")
stage = 99 stage = 99
} }
4 -> { 4 -> {
npc(core.game.dialogue.FacialExpression.ASKING, "My son just won his first duel!") npc(FacialExpression.ASKING, "My son just won his first duel!")
stage++ stage++
} }
5 -> { 5 -> {
player(core.game.dialogue.FacialExpression.ASKING, "Congratulations!") player(FacialExpression.ASKING, "Congratulations!")
stage++ stage++
} }
6 -> { 6 -> {
npc(core.game.dialogue.FacialExpression.ASKING, "He ripped his opponent in half!") npc(FacialExpression.ASKING, "He ripped his opponent in half!")
stage++ stage++
} }
7 -> { 7 -> {
player(core.game.dialogue.FacialExpression.ASKING, "That's gotta hurt!") player(FacialExpression.ASKING, "That's gotta hurt!")
stage++ stage++
} }
8 -> { 8 -> {
npc(core.game.dialogue.FacialExpression.ASKING, "He's only 10 as well!") npc(FacialExpression.ASKING, "He's only 10 as well!")
stage++ stage++
} }
9 -> { 9 -> {
player(core.game.dialogue.FacialExpression.ASKING, "You gotta start 'em young!") player(FacialExpression.ASKING, "You gotta start 'em young!")
stage = 99 stage = 99
} }
10 -> { 10 -> {
npc(core.game.dialogue.FacialExpression.ASKING, "Hmph.") npc(FacialExpression.ASKING, "Hmph.")
stage = 99 stage = 99
} }
11 -> { 11 -> {
npc(core.game.dialogue.FacialExpression.ASKING, "My favourite fighter is Mubariz!") npc(FacialExpression.ASKING, "My favourite fighter is Mubariz!")
stage++ stage++
} }
12 -> { 12 -> {
player(core.game.dialogue.FacialExpression.ASKING, "The guy at the information kiosk?") player(FacialExpression.ASKING, "The guy at the information kiosk?")
stage++ stage++
} }
13 -> { 13 -> {
npc(core.game.dialogue.FacialExpression.ASKING, "Yeah! He rocks!") npc(FacialExpression.ASKING, "Yeah! He rocks!")
stage++ stage++
} }
14 -> { 14 -> {
player(core.game.dialogue.FacialExpression.ASKING, "Takes all sorts, I guess.") player(FacialExpression.ASKING, "Takes all sorts, I guess.")
stage = 99 stage = 99
} }
15 -> { 15 -> {
npc(core.game.dialogue.FacialExpression.ASKING, "Hi! I'm here to watch the duels!") npc(FacialExpression.ASKING, "Hi! I'm here to watch the duels!")
stage++ stage++
} }
16 -> { 16 -> {
player(core.game.dialogue.FacialExpression.ASKING, "Me too!") player(FacialExpression.ASKING, "Me too!")
stage = 99 stage = 99
} }
17 -> { 17 -> {
npc(core.game.dialogue.FacialExpression.ASKING, "Did you know they think this place dates","back to the second age?!") npc(FacialExpression.ASKING, "Did you know they think this place dates","back to the second age?!")
stage++ stage++
} }
18 -> { 18 -> {
player(core.game.dialogue.FacialExpression.ASKING, "Really?") player(FacialExpression.ASKING, "Really?")
stage++ stage++
} }
19 -> { 19 -> {
npc(core.game.dialogue.FacialExpression.ASKING, "Yeah. The guy at the information kiosk was telling me.") npc(FacialExpression.ASKING, "Yeah. The guy at the information kiosk was telling me.")
stage = 99 stage = 99
} }
20 -> { 20 -> {
npc(core.game.dialogue.FacialExpression.ANGRY, "Can't you see I'm watching the duels?") npc(FacialExpression.ANGRY, "Can't you see I'm watching the duels?")
stage++ stage++
} }
21 -> { 21 -> {
player(core.game.dialogue.FacialExpression.SAD, "I'm sorry!") player(FacialExpression.SAD, "I'm sorry!")
stage = 99 stage = 99
} }
22 -> { 22 -> {
npc(core.game.dialogue.FacialExpression.ASKING, "Well. This beats doing the shopping!") npc(FacialExpression.ASKING, "Well. This beats doing the shopping!")
stage = 99 stage = 99
} }
23 -> { 23 -> {
npc(core.game.dialogue.FacialExpression.ASKING, "Hi!") npc(FacialExpression.ASKING, "Hi!")
stage = 99 stage = 99
} }
24 -> { 24 -> {
npc(core.game.dialogue.FacialExpression.ASKING, "Knock knock!") npc(FacialExpression.ASKING, "Knock knock!")
stage++ stage++
} }
25 -> { 25 -> {
player(core.game.dialogue.FacialExpression.ASKING, "Who's there?") player(FacialExpression.ASKING, "Who's there?")
stage++ stage++
} }
26 -> { 26 -> {
npc(core.game.dialogue.FacialExpression.ASKING, "Boo!") npc(FacialExpression.ASKING, "Boo!")
stage++ stage++
} }
27 -> { 27 -> {
player(core.game.dialogue.FacialExpression.ASKING, "Boo who?") player(FacialExpression.ASKING, "Boo who?")
stage++ stage++
} }
28 -> { 28 -> {
npc(core.game.dialogue.FacialExpression.LAUGH, "Don't cry, it's just me!") npc(FacialExpression.LAUGH, "Don't cry, it's just me!")
stage = 99 stage = 99
} }
29 -> { 29 -> {
npc(core.game.dialogue.FacialExpression.ASKING, "Why did the skeleton burp?") npc(FacialExpression.ASKING, "Why did the skeleton burp?")
stage++ stage++
} }
30 -> { 30 -> {
player(core.game.dialogue.FacialExpression.ASKING, "I don't know?") player(FacialExpression.ASKING, "I don't know?")
stage++ stage++
} }
31 -> { 31 -> {
npc(core.game.dialogue.FacialExpression.ASKING, "'Cause it didn't have the guts to fart!") npc(FacialExpression.ASKING, "'Cause it didn't have the guts to fart!")
stage = 99 stage = 99
} }
32 -> { 32 -> {
npc(core.game.dialogue.FacialExpression.ASKING, "Waaaaassssssuuuuupp?!.") npc(FacialExpression.ASKING, "Waaaaassssssuuuuupp?!.")
stage = 99 stage = 99
} }
99 -> end() 99 -> end()
@@ -168,7 +168,7 @@ class AfrahDialogue : core.game.dialogue.DialoguePlugin {
return true return true
} }
override fun newInstance(player: Player): core.game.dialogue.DialoguePlugin { override fun newInstance(player: Player): DialoguePlugin {
return AfrahDialogue(player) return AfrahDialogue(player)
} }
} }
@@ -26,8 +26,8 @@ class FogInteractionHandler : PluginInteraction(30204, 30203){
override fun pulse(): Boolean { override fun pulse(): Boolean {
player.faceLocation(obj.location) player.faceLocation(obj.location)
when(obj.id) { when(obj.id) {
30204 -> core.game.global.action.ClimbActionHandler.climbLadder(player, obj, "climb-down") 30204 -> ClimbActionHandler.climbLadder(player, obj, "climb-down")
30203 -> core.game.global.action.ClimbActionHandler.climbLadder(player,obj,"climb-up") 30203 -> ClimbActionHandler.climbLadder(player,obj,"climb-up")
} }
return true return true
} }
@@ -50,7 +50,7 @@ class GnomeCrunchyInterface : ComponentPlugin() {
for(item in crunchy.requiredItems){ for(item in crunchy.requiredItems){
if(!player.inventory.containsItem(item)){ if(!player.inventory.containsItem(item)){
hasAll = false hasAll = false
break; break
} }
} }
@@ -86,7 +86,7 @@ class EnchantSpell : MagicSpell {
} }
} }
if (pizazz != 0) { if (pizazz != 0) {
content.minigame.mta.impl.EnchantingZone.ZONE.incrementPoints(entity, content.minigame.mta.MTAType.ENCHANTERS.ordinal, pizazz) content.minigame.mta.impl.EnchantingZone.ZONE.incrementPoints(entity, MTAType.ENCHANTERS.ordinal, pizazz)
} }
} }
return true return true
@@ -18,7 +18,7 @@ class MTAListeners : InteractionListener {
return@on true return@on true
} }
setDest(IntType.NPC, intArrayOf(NPCs.MAZE_GUARDIAN_3102), "talk-to") { player, node -> setDest(IntType.NPC, intArrayOf(NPCs.MAZE_GUARDIAN_3102), "talk-to") { player, node ->
return@setDest node.location.transform(Direction.getDirection(player.location, node.location), -1); return@setDest node.location.transform(Direction.getDirection(player.location, node.location), -1)
} }
} }
} }
@@ -61,12 +61,12 @@ object PestControlHelper {
return false return false
} }
fun getMyPestControlSession1(p: PestControlTestBot): content.minigame.pestcontrol.PestControlSession? { fun getMyPestControlSession1(p: PestControlTestBot): PestControlSession? {
return p.getExtension(content.minigame.pestcontrol.PestControlSession::class.java) return p.getExtension(PestControlSession::class.java)
} }
fun getMyPestControlSession2(p: PestControlTestBot2): content.minigame.pestcontrol.PestControlSession? { fun getMyPestControlSession2(p: PestControlTestBot2): PestControlSession? {
return p.getExtension(content.minigame.pestcontrol.PestControlSession::class.java) return p.getExtension(PestControlSession::class.java)
} }
} }
@@ -32,7 +32,7 @@ class CombatState(val bot: PestControlTestBot) {
removeList.add(port) removeList.add(port)
} else { } else {
portal = port portal = port
break; break
} }
} }
sesh.aportals.removeAll(removeList) sesh.aportals.removeAll(removeList)
@@ -31,7 +31,7 @@ class CombatStateIntermediate(val bot: PestControlTestBot2) {
removeList.add(port) removeList.add(port)
} else { } else {
portal = port portal = port
break; break
} }
} }
sesh.aportals.removeAll(removeList) sesh.aportals.removeAll(removeList)
@@ -34,7 +34,7 @@ class PestControlTestBot2(l: Location) : PvMBots(legitimizeLocation(l)) {
init { init {
val random100 = Random().nextInt(100) val random100 = Random().nextInt(100)
if (random100 < 30) { if (random100 < 30) {
setAttribute("pc_role","defend_squire"); setAttribute("pc_role","defend_squire")
} else } else
{ {
setAttribute("pc_role","attack_portals") setAttribute("pc_role","attack_portals")
@@ -160,8 +160,8 @@ class PestControlTestBot2(l: Location) : PvMBots(legitimizeLocation(l)) {
this.walkToPosSmart(myBoat.outsideBoatBorder.randomLoc) this.walkToPosSmart(myBoat.outsideBoatBorder.randomLoc)
movetimer += RandomFunction.normalPlusWeightRandDist(400, 200) movetimer += RandomFunction.normalPlusWeightRandDist(400, 200)
} }
movetimer = RandomFunction.normalPlusWeightRandDist(100, 50); movetimer = RandomFunction.normalPlusWeightRandDist(100, 50)
return; return
} }
val test = getClosestNodeWithEntry(15, myBoat.ladderId) val test = getClosestNodeWithEntry(15, myBoat.ladderId)
test ?: randomWalk(1,1) test ?: randomWalk(1,1)
@@ -34,7 +34,7 @@ class PestControlTestBot(l: Location) : PvMBots(legitimizeLocation(l)){
init { init {
val random100 = Random().nextInt(100) val random100 = Random().nextInt(100)
if (random100 < 30) { if (random100 < 30) {
setAttribute("pc_role","defend_squire"); setAttribute("pc_role","defend_squire")
} else } else
{ {
setAttribute("pc_role","attack_portals") setAttribute("pc_role","attack_portals")
@@ -156,8 +156,8 @@ class PestControlTestBot(l: Location) : PvMBots(legitimizeLocation(l)){
this.walkToPosSmart(myBoat.outsideBoatBorder.randomLoc) this.walkToPosSmart(myBoat.outsideBoatBorder.randomLoc)
movetimer += RandomFunction.normalPlusWeightRandDist(400, 200) movetimer += RandomFunction.normalPlusWeightRandDist(400, 200)
} }
movetimer = RandomFunction.normalPlusWeightRandDist(100, 50); movetimer = RandomFunction.normalPlusWeightRandDist(100, 50)
return; return
} }
val test = getClosestNodeWithEntry(15, myBoat.ladderId) val test = getClosestNodeWithEntry(15, myBoat.ladderId)
test ?: randomWalk(1,1) test ?: randomWalk(1,1)
@@ -9,52 +9,52 @@ import org.rs09.consts.NPCs
import core.tools.END_DIALOGUE import core.tools.END_DIALOGUE
@Initializable @Initializable
class GuardianMummyDialogue(player: Player? = null) : core.game.dialogue.DialoguePlugin(player) { class GuardianMummyDialogue(player: Player? = null) : DialoguePlugin(player) {
override fun open(vararg args: Any?): Boolean { override fun open(vararg args: Any?): Boolean {
npcl(core.game.dialogue.FacialExpression.OLD_NOT_INTERESTED, "*sigh* Not another one.") npcl(FacialExpression.OLD_NOT_INTERESTED, "*sigh* Not another one.")
return true return true
} }
override fun handle(interfaceId: Int, buttonId: Int): Boolean { override fun handle(interfaceId: Int, buttonId: Int): Boolean {
when(stage){ when(stage){
0 -> playerl(core.game.dialogue.FacialExpression.HALF_ASKING, "Another what?").also { stage++ } 0 -> playerl(FacialExpression.HALF_ASKING, "Another what?").also { stage++ }
1 -> npcl(core.game.dialogue.FacialExpression.OLD_NOT_INTERESTED, "Another 'archaeologist'. I'm not going to let you plunder my master's tomb you know.").also { stage++ } 1 -> npcl(FacialExpression.OLD_NOT_INTERESTED, "Another 'archaeologist'. I'm not going to let you plunder my master's tomb you know.").also { stage++ }
2 -> playerl(core.game.dialogue.FacialExpression.NEUTRAL, "That's a shame. Have you got anything else I could do while I'm here?").also { stage++ } 2 -> playerl(FacialExpression.NEUTRAL, "That's a shame. Have you got anything else I could do while I'm here?").also { stage++ }
3 -> npcl(core.game.dialogue.FacialExpression.OLD_NOT_INTERESTED, "If it will keep you out of mischief I suppose I could set something up for you... I have a few rooms full of some things you humans might consider valuable, do you want to give it a go?").also { stage++ } 3 -> npcl(FacialExpression.OLD_NOT_INTERESTED, "If it will keep you out of mischief I suppose I could set something up for you... I have a few rooms full of some things you humans might consider valuable, do you want to give it a go?").also { stage++ }
4 -> player.dialogueInterpreter.sendOptions("Play Pyramid Plunder?", "That sounds like fun; what do I do?", "Not right now.", "I know what I'm doing, so let's get on with it.").also { stage++ } 4 -> player.dialogueInterpreter.sendOptions("Play Pyramid Plunder?", "That sounds like fun; what do I do?", "Not right now.", "I know what I'm doing, so let's get on with it.").also { stage++ }
5 -> when(buttonId) 5 -> when(buttonId)
{ {
1 -> playerl(core.game.dialogue.FacialExpression.FRIENDLY, "That sounds like fun; what do I do?").also { stage = 10 } 1 -> playerl(FacialExpression.FRIENDLY, "That sounds like fun; what do I do?").also { stage = 10 }
2 -> playerl(core.game.dialogue.FacialExpression.NEUTRAL, "Not right now.").also { stage = END_DIALOGUE } 2 -> playerl(FacialExpression.NEUTRAL, "Not right now.").also { stage = END_DIALOGUE }
3 -> playerl(core.game.dialogue.FacialExpression.ANNOYED, "I know what I'm doing, so let's get on with it.").also { stage = 100 } 3 -> playerl(FacialExpression.ANNOYED, "I know what I'm doing, so let's get on with it.").also { stage = 100 }
} }
10 -> npcl(core.game.dialogue.FacialExpression.OLD_NOT_INTERESTED, "You have five minutes to explore the treasure rooms and collect as many artefacts as you can. The artefacts are in the urns, chests and sarcophagi found in each room.").also { stage++ } 10 -> npcl(FacialExpression.OLD_NOT_INTERESTED, "You have five minutes to explore the treasure rooms and collect as many artefacts as you can. The artefacts are in the urns, chests and sarcophagi found in each room.").also { stage++ }
11 -> npcl(core.game.dialogue.FacialExpression.OLD_NOT_INTERESTED, "There are eight treasure rooms, each subsequent room requires higher thieving skills to both enter the room and thieve from the urns and other containers.").also { stage++ } 11 -> npcl(FacialExpression.OLD_NOT_INTERESTED, "There are eight treasure rooms, each subsequent room requires higher thieving skills to both enter the room and thieve from the urns and other containers.").also { stage++ }
12 -> npcl(core.game.dialogue.FacialExpression.OLD_NOT_INTERESTED, "The rewards also become more lucrative the further into the tomb you go. You will also have to deactivate a trap in order to enter the main part of each room.").also { stage++ } 12 -> npcl(FacialExpression.OLD_NOT_INTERESTED, "The rewards also become more lucrative the further into the tomb you go. You will also have to deactivate a trap in order to enter the main part of each room.").also { stage++ }
13 -> npcl(core.game.dialogue.FacialExpression.OLD_NOT_INTERESTED, "When you want to move onto the next room you need to find the correct door first.").also { stage++ } 13 -> npcl(FacialExpression.OLD_NOT_INTERESTED, "When you want to move onto the next room you need to find the correct door first.").also { stage++ }
14 -> npcl(core.game.dialogue.FacialExpression.OLD_NOT_INTERESTED, "There are four possible exits... you must open the door before finding out whether it is the exit or not. Opening the doors require picking their locks. Having a lockpick will make this easier.").also { stage++ } 14 -> npcl(FacialExpression.OLD_NOT_INTERESTED, "There are four possible exits... you must open the door before finding out whether it is the exit or not. Opening the doors require picking their locks. Having a lockpick will make this easier.").also { stage++ }
15 -> player.dialogueInterpreter.sendOptions("Do you have any more questions?", "How do I leave the game?", "How do I get the artefacts?", "What do I do with the artefacts I collect?", "I'm ready to give it a go now.").also { stage++ } 15 -> player.dialogueInterpreter.sendOptions("Do you have any more questions?", "How do I leave the game?", "How do I get the artefacts?", "What do I do with the artefacts I collect?", "I'm ready to give it a go now.").also { stage++ }
16 -> when(buttonId) 16 -> when(buttonId)
{ {
1 -> playerl(core.game.dialogue.FacialExpression.FRIENDLY, "How do I leave the game?").also { stage = 20 } 1 -> playerl(FacialExpression.FRIENDLY, "How do I leave the game?").also { stage = 20 }
2 -> playerl(core.game.dialogue.FacialExpression.FRIENDLY, "How do I get the artefacts?").also { stage = 30 } 2 -> playerl(FacialExpression.FRIENDLY, "How do I get the artefacts?").also { stage = 30 }
3 -> playerl(core.game.dialogue.FacialExpression.FRIENDLY, "What do I do with the artefacts?").also { stage = 40 } 3 -> playerl(FacialExpression.FRIENDLY, "What do I do with the artefacts?").also { stage = 40 }
4 -> playerl(core.game.dialogue.FacialExpression.FRIENDLY, "I'm ready to give it a go now.").also { stage = 100 } 4 -> playerl(FacialExpression.FRIENDLY, "I'm ready to give it a go now.").also { stage = 100 }
} }
20 -> npcl(core.game.dialogue.FacialExpression.OLD_NOT_INTERESTED, "If at any point you decide you need to leave just use a glowing door. The game will end and you will be taken out of the pyramid").also { stage = 15 } 20 -> npcl(FacialExpression.OLD_NOT_INTERESTED, "If at any point you decide you need to leave just use a glowing door. The game will end and you will be taken out of the pyramid").also { stage = 15 }
30 -> npcl(core.game.dialogue.FacialExpression.OLD_NOT_INTERESTED, "The artefacts are in the urns, chests and sarcophagi. Urns contain snakes that guard them. The sarcophagi take some strength to open. They take a while to open.").also { stage++ } 30 -> npcl(FacialExpression.OLD_NOT_INTERESTED, "The artefacts are in the urns, chests and sarcophagi. Urns contain snakes that guard them. The sarcophagi take some strength to open. They take a while to open.").also { stage++ }
31 -> npcl(core.game.dialogue.FacialExpression.OLD_NOT_INTERESTED, "Of course, Mummies have been known to take a nap in the sarcophagi, so beware. The golden chests generally contain better artefacts, but are also trapped with scarabs!").also { stage = 15 } 31 -> npcl(FacialExpression.OLD_NOT_INTERESTED, "Of course, Mummies have been known to take a nap in the sarcophagi, so beware. The golden chests generally contain better artefacts, but are also trapped with scarabs!").also { stage = 15 }
40 -> npcl(core.game.dialogue.FacialExpression.OLD_NOT_INTERESTED, "There are a number of different artefacts, of three main types. The least valuable are the pottery statuettes and scarabs, and the ivory combs.").also { stage++ } 40 -> npcl(FacialExpression.OLD_NOT_INTERESTED, "There are a number of different artefacts, of three main types. The least valuable are the pottery statuettes and scarabs, and the ivory combs.").also { stage++ }
41 -> npcl(core.game.dialogue.FacialExpression.OLD_NOT_INTERESTED, "Next are the stone scarabs, statuettes and seals, and finally the gold versions of those artefacts. They are not old, but are well made.").also { stage++ } 41 -> npcl(FacialExpression.OLD_NOT_INTERESTED, "Next are the stone scarabs, statuettes and seals, and finally the gold versions of those artefacts. They are not old, but are well made.").also { stage++ }
42 -> playerl(core.game.dialogue.FacialExpression.HALF_ASKING, "What do I do with artefacts once I've collected them?").also { stage++ } 42 -> playerl(FacialExpression.HALF_ASKING, "What do I do with artefacts once I've collected them?").also { stage++ }
43 -> npcl(core.game.dialogue.FacialExpression.OLD_NOT_INTERESTED, "That Simon Simpleton, I mean Templeton, will probably give you some money for them. He couldn't spot a real artefact if it came up to him and bit him in the face.").also { stage++ } 43 -> npcl(FacialExpression.OLD_NOT_INTERESTED, "That Simon Simpleton, I mean Templeton, will probably give you some money for them. He couldn't spot a real artefact if it came up to him and bit him in the face.").also { stage++ }
44 -> npcl(core.game.dialogue.FacialExpression.OLD_NOT_INTERESTED, "He usually slinks about near the pyramid north-east of Sophanem. I expect he's trying to get some poor fools to steal things from that pyramid as well.").also { stage = 15 } 44 -> npcl(FacialExpression.OLD_NOT_INTERESTED, "He usually slinks about near the pyramid north-east of Sophanem. I expect he's trying to get some poor fools to steal things from that pyramid as well.").also { stage = 15 }
100 -> npcl(core.game.dialogue.FacialExpression.OLD_NOT_INTERESTED, "Alright, fine.").also { stage++ } 100 -> npcl(FacialExpression.OLD_NOT_INTERESTED, "Alright, fine.").also { stage++ }
101 -> { 101 -> {
end() end()
PyramidPlunderMinigame.join(player) PyramidPlunderMinigame.join(player)
@@ -68,7 +68,7 @@ class GuardianMummyDialogue(player: Player? = null) : core.game.dialogue.Dialogu
return intArrayOf(NPCs.GUARDIAN_MUMMY_4476) return intArrayOf(NPCs.GUARDIAN_MUMMY_4476)
} }
override fun newInstance(player: Player?): core.game.dialogue.DialoguePlugin { override fun newInstance(player: Player?): DialoguePlugin {
return GuardianMummyDialogue(player) return GuardianMummyDialogue(player)
} }
} }
@@ -172,7 +172,7 @@ object PlunderUtils {
fun getDoor(player: Player) : Int fun getDoor(player: Player) : Int
{ {
if (getRoom(player) == null) if (getRoom(player) == null)
return -1; return -1
val room = getRoom(player)!!.room val room = getRoom(player)!!.room
return PlunderData.doors[room - 1] return PlunderData.doors[room - 1]
} }
@@ -210,7 +210,7 @@ class PyramidPlunderMinigame : InteractionListener, TickListener, LogoutListener
rewardXP(player, Skills.STRENGTH, PlunderUtils.getSarcophagusXp(player)) rewardXP(player, Skills.STRENGTH, PlunderUtils.getSarcophagusXp(player))
if(RandomFunction.roll(25)) if(RandomFunction.roll(25))
{ {
val mummy = content.minigame.pyramidplunder.PyramidPlunderMummyNPC(player.location, player) val mummy = PyramidPlunderMummyNPC(player.location, player)
mummy.isRespawn = false mummy.isRespawn = false
mummy.init() mummy.init()
mummy.attack(player) mummy.attack(player)
@@ -235,7 +235,7 @@ class PyramidPlunderMinigame : InteractionListener, TickListener, LogoutListener
runTask(player){ runTask(player){
if(RandomFunction.roll(25)) if(RandomFunction.roll(25))
{ {
val swarm = content.minigame.pyramidplunder.PyramidPlunderSwarmNPC(player.location, player) val swarm = PyramidPlunderSwarmNPC(player.location, player)
swarm.isRespawn = false swarm.isRespawn = false
swarm.init() swarm.init()
swarm.attack(player) swarm.attack(player)
@@ -452,7 +452,7 @@ class GardenObjectsPlugin : InteractionListener {
@Throws(Throwable::class) @Throws(Throwable::class)
override fun newInstance(arg: Any?): Plugin<Any?> { override fun newInstance(arg: Any?): Plugin<Any?> {
UseWithHandler.addHandler(233, UseWithHandler.ITEM_TYPE, this) addHandler(233, ITEM_TYPE, this)
return this return this
} }
@@ -215,7 +215,7 @@ class Vinesweeper : InteractionListener, InterfaceListener, MapArea {
// TODO: more precise formula // TODO: more precise formula
val points_per_xp = if (level < 40) { 2.0*(40.0 - level.toDouble())/10.0 } else { 1.0 } val points_per_xp = if (level < 40) { 2.0*(40.0 - level.toDouble())/10.0 } else { 1.0 }
val points = player.getAttribute("vinesweeper:points", 0) val points = player.getAttribute("vinesweeper:points", 0)
val xp = points / points_per_xp; val xp = points / points_per_xp
player.skills.addExperience(Skills.FARMING, xp) player.skills.addExperience(Skills.FARMING, xp)
player.setAttribute("/save:vinesweeper:points", 0) player.setAttribute("/save:vinesweeper:points", 0)
sendUpdatedPoints(player) sendUpdatedPoints(player)
@@ -360,7 +360,7 @@ class Vinesweeper : InteractionListener, InterfaceListener, MapArea {
val VINESWEEPER_BORDERS = ZoneBorders(1600,4672,1663,4735) val VINESWEEPER_BORDERS = ZoneBorders(1600,4672,1663,4735)
fun sendUpdatedPoints(player: Player) { fun sendUpdatedPoints(player: Player) {
val points = player.getAttribute("vinesweeper:points", 0); val points = player.getAttribute("vinesweeper:points", 0)
setVarbit(player, 4449, points) setVarbit(player, 4449, points)
} }
@@ -431,7 +431,7 @@ class Vinesweeper : InteractionListener, InterfaceListener, MapArea {
val oldPoints = player.getAttribute("vinesweeper:points", 0) val oldPoints = player.getAttribute("vinesweeper:points", 0)
player.setAttribute("/save:vinesweeper:points", Math.max(oldPoints-10, 0)) player.setAttribute("/save:vinesweeper:points", Math.max(oldPoints-10, 0))
sendUpdatedPoints(player) sendUpdatedPoints(player)
player.sendMessage("Oh dear! It looks like you dug up a potato seed by mistake."); player.sendMessage("Oh dear! It looks like you dug up a potato seed by mistake.")
scheduleNPCs(player, loc, false, false) scheduleNPCs(player, loc, false, false)
val scenery = getScenery(loc) val scenery = getScenery(loc)
if(scenery != null) { if(scenery != null) {
@@ -534,7 +534,8 @@ class Vinesweeper : InteractionListener, InterfaceListener, MapArea {
@Initializable @Initializable
class VinesweeperNPC : AbstractNPC { class VinesweeperNPC : AbstractNPC {
var seedDestinations: ArrayList<Vinesweeper.SeedDestination> = ArrayList(); var seedDestinations: ArrayList<Vinesweeper.SeedDestination> = ArrayList()
constructor() : super(RABBITS[0], null, true) {} constructor() : super(RABBITS[0], null, true) {}
private constructor(id: Int, location: Location) : super(id, location) {} private constructor(id: Int, location: Location) : super(id, location) {}
override fun construct(id: Int, location: Location, vararg objects: Any?): AbstractNPC { override fun construct(id: Int, location: Location, vararg objects: Any?): AbstractNPC {
@@ -11,11 +11,11 @@ import core.plugin.Initializable
*/ */
@Initializable @Initializable
class AchiettiesDialogue(player: Player? = null) : core.game.dialogue.DialoguePlugin(player){ class AchiettiesDialogue(player: Player? = null) : DialoguePlugin(player){
override fun open(vararg args: Any?): Boolean { override fun open(vararg args: Any?): Boolean {
npc = args[0] as NPC npc = args[0] as NPC
npc(core.game.dialogue.FacialExpression.FRIENDLY,"Greetings. Welcome to the Heroes' Guild.") npc(FacialExpression.FRIENDLY,"Greetings. Welcome to the Heroes' Guild.")
stage = 99 stage = 99
return true return true
} }
@@ -27,7 +27,7 @@ class AchiettiesDialogue(player: Player? = null) : core.game.dialogue.DialoguePl
return true return true
} }
override fun newInstance(player: Player?): core.game.dialogue.DialoguePlugin { override fun newInstance(player: Player?): DialoguePlugin {
return AchiettiesDialogue(player) return AchiettiesDialogue(player)
} }
@@ -46,9 +46,9 @@ class BurthorpeSoldierDialogue(player: Player? = null) : DialoguePlugin(player)
"Braccae tuae aperiuntur.", "Braccae tuae aperiuntur.",
"Vescere bracis meis.", "Vescere bracis meis.",
"Corripe cervisiam!", "Corripe cervisiam!",
); )
val randomStages = arrayOf(10, 20, 30, 40, 50); val randomStages = arrayOf(10, 20, 30, 40, 50)
} }
override fun handle(interfaceId: Int, buttonId: Int): Boolean { override fun handle(interfaceId: Int, buttonId: Int): Boolean {
@@ -18,17 +18,17 @@ import core.tools.START_DIALOGUE
* @author vddCore * @author vddCore
*/ */
@Initializable @Initializable
class EmeraldBenedictDialogue(player: Player? = null) : core.game.dialogue.DialoguePlugin(player) { class EmeraldBenedictDialogue(player: Player? = null) : DialoguePlugin(player) {
override fun handle(interfaceId: Int, buttonId: Int): Boolean { override fun handle(interfaceId: Int, buttonId: Int): Boolean {
when (stage) { when (stage) {
START_DIALOGUE -> if(hasIronmanRestriction(player, IronmanMode.ULTIMATE)) { START_DIALOGUE -> if(hasIronmanRestriction(player, IronmanMode.ULTIMATE)) {
npcl( npcl(
core.game.dialogue.FacialExpression.ANNOYED, FacialExpression.ANNOYED,
"Get lost, tin can." "Get lost, tin can."
).also { stage = END_DIALOGUE } ).also { stage = END_DIALOGUE }
} else { } else {
npcl( npcl(
core.game.dialogue.FacialExpression.SUSPICIOUS, FacialExpression.SUSPICIOUS,
"Got anything you don't want to lose?" "Got anything you don't want to lose?"
).also { ).also {
if (hasAwaitingGrandExchangeCollections(player)) { if (hasAwaitingGrandExchangeCollections(player)) {
@@ -40,22 +40,22 @@ class EmeraldBenedictDialogue(player: Player? = null) : core.game.dialogue.Dialo
} }
1 -> npcl( 1 -> npcl(
core.game.dialogue.FacialExpression.SUSPICIOUS, FacialExpression.SUSPICIOUS,
"By the way, a little bird told me you got some stuff waiting for you " + "By the way, a little bird told me you got some stuff waiting for you " +
"on the Grand Exchange." "on the Grand Exchange."
).also { stage++ } ).also { stage++ }
2 -> showTopics( 2 -> showTopics(
Topic(core.game.dialogue.FacialExpression.ASKING, "Yes, actually. Can you help?", 3), Topic(FacialExpression.ASKING, "Yes, actually. Can you help?", 3),
IfTopic( IfTopic(
core.game.dialogue.FacialExpression.ASKING, FacialExpression.ASKING,
"Yes, but can you switch my bank accounts?", "Yes, but can you switch my bank accounts?",
4, 4,
hasActivatedSecondaryBankAccount(player) hasActivatedSecondaryBankAccount(player)
), ),
Topic(core.game.dialogue.FacialExpression.ASKING, "Yes, but can you show me my PIN settings?", 5), Topic(FacialExpression.ASKING, "Yes, but can you show me my PIN settings?", 5),
Topic(core.game.dialogue.FacialExpression.ASKING, "Yes, but can you show me my collection box?", 6), Topic(FacialExpression.ASKING, "Yes, but can you show me my collection box?", 6),
Topic(core.game.dialogue.FacialExpression.ANNOYED, "Yes, thanks. And I'll keep hold of it too.", END_DIALOGUE) Topic(FacialExpression.ANNOYED, "Yes, thanks. And I'll keep hold of it too.", END_DIALOGUE)
) )
3 -> { 3 -> {
@@ -66,7 +66,7 @@ class EmeraldBenedictDialogue(player: Player? = null) : core.game.dialogue.Dialo
4 -> { 4 -> {
toggleBankAccount(player) toggleBankAccount(player)
npcl( npcl(
core.game.dialogue.FacialExpression.SUSPICIOUS, FacialExpression.SUSPICIOUS,
"Sure thing. Feel free to rummage through whatever's in your ${getBankAccountName(player)} now." "Sure thing. Feel free to rummage through whatever's in your ${getBankAccountName(player)} now."
).also { stage = END_DIALOGUE } ).also { stage = END_DIALOGUE }
} }
@@ -18,19 +18,19 @@ import core.tools.START_DIALOGUE
* @author vddCore * @author vddCore
*/ */
@Initializable @Initializable
class JadeDialogue(player: Player? = null) : core.game.dialogue.DialoguePlugin(player) { class JadeDialogue(player: Player? = null) : DialoguePlugin(player) {
override fun handle(interfaceId: Int, buttonId: Int): Boolean { override fun handle(interfaceId: Int, buttonId: Int): Boolean {
when (stage) { when (stage) {
START_DIALOGUE -> if (hasIronmanRestriction(player, IronmanMode.ULTIMATE)) { START_DIALOGUE -> if (hasIronmanRestriction(player, IronmanMode.ULTIMATE)) {
npcl( npcl(
core.game.dialogue.FacialExpression.NEUTRAL, FacialExpression.NEUTRAL,
"Greetings, warrior. I wish I could help you, but " + "Greetings, warrior. I wish I could help you, but " +
"our services are not available for Ultimate ${if (player.isMale) "Ironmen" else "Ironwomen"}." "our services are not available for Ultimate ${if (player.isMale) "Ironmen" else "Ironwomen"}."
).also { stage = END_DIALOGUE } ).also { stage = END_DIALOGUE }
} }
else { else {
npcl( npcl(
core.game.dialogue.FacialExpression.NEUTRAL, FacialExpression.NEUTRAL,
"Greetings warrior, how may I help you?" "Greetings warrior, how may I help you?"
).also { ).also {
if (hasAwaitingGrandExchangeCollections(player)) { if (hasAwaitingGrandExchangeCollections(player)) {
@@ -42,36 +42,36 @@ class JadeDialogue(player: Player? = null) : core.game.dialogue.DialoguePlugin(p
} }
1 -> npcl( 1 -> npcl(
core.game.dialogue.FacialExpression.NEUTRAL, FacialExpression.NEUTRAL,
"Before we go any further, I should inform you that you " + "Before we go any further, I should inform you that you " +
"have items ready for collection from the Grand Exchange." "have items ready for collection from the Grand Exchange."
).also { stage++ } ).also { stage++ }
2 -> showTopics( 2 -> showTopics(
Topic(core.game.dialogue.FacialExpression.NEUTRAL, "I'd like to access my bank account, please.", 10), Topic(FacialExpression.NEUTRAL, "I'd like to access my bank account, please.", 10),
IfTopic( IfTopic(
core.game.dialogue.FacialExpression.NEUTRAL, FacialExpression.NEUTRAL,
"I'd like to switch to my ${getBankAccountName(player, true)} bank account.", "I'd like to switch to my ${getBankAccountName(player, true)} bank account.",
13, 13,
hasActivatedSecondaryBankAccount(player) hasActivatedSecondaryBankAccount(player)
), ),
Topic(core.game.dialogue.FacialExpression.NEUTRAL, "I'd like to check my PIN settings.", 11), Topic(FacialExpression.NEUTRAL, "I'd like to check my PIN settings.", 11),
Topic(core.game.dialogue.FacialExpression.NEUTRAL, "I'd like to see my collection box.", 12), Topic(FacialExpression.NEUTRAL, "I'd like to see my collection box.", 12),
Topic(core.game.dialogue.FacialExpression.ASKING, "How long have you worked here?", 3) Topic(FacialExpression.ASKING, "How long have you worked here?", 3)
) )
3 -> npcl( 3 -> npcl(
core.game.dialogue.FacialExpression.FRIENDLY, FacialExpression.FRIENDLY,
"Oh, ever since the Guild opened. I like it here." "Oh, ever since the Guild opened. I like it here."
).also { stage++ } ).also { stage++ }
4 -> playerl( 4 -> playerl(
core.game.dialogue.FacialExpression.ASKING, FacialExpression.ASKING,
"Why's that?" "Why's that?"
).also { stage++ } ).also { stage++ }
5 -> npcl( 5 -> npcl(
core.game.dialogue.FacialExpression.FRIENDLY, FacialExpression.FRIENDLY,
"Well... What with all these warriors around, there's not much chance of my bank being robbed, is there?" "Well... What with all these warriors around, there's not much chance of my bank being robbed, is there?"
).also { stage = 2 } ).also { stage = 2 }
@@ -93,7 +93,7 @@ class JadeDialogue(player: Player? = null) : core.game.dialogue.DialoguePlugin(p
13 -> { 13 -> {
toggleBankAccount(player) toggleBankAccount(player)
npcl( npcl(
core.game.dialogue.FacialExpression.FRIENDLY, FacialExpression.FRIENDLY,
"Of course! Your ${getBankAccountName(player)} account is now active!" "Of course! Your ${getBankAccountName(player)} account is now active!"
).also { stage = END_DIALOGUE } ).also { stage = END_DIALOGUE }
} }
@@ -34,7 +34,7 @@ class HaroldDialogueFile : DialogueFile() {
// This jumpStage is needed to resume the conversation after the dice interface. // This jumpStage is needed to resume the conversation after the dice interface.
// The dice interface closes the dialogue file. // The dice interface closes the dialogue file.
if(getAttribute(player!!, ATTRIBUTE_JUMPSTAGE, 0) != 0) { if(getAttribute(player!!, ATTRIBUTE_JUMPSTAGE, 0) != 0) {
stage = getAttribute(player!!, ATTRIBUTE_JUMPSTAGE, 0); stage = getAttribute(player!!, ATTRIBUTE_JUMPSTAGE, 0)
setAttribute(player!!, ATTRIBUTE_JUMPSTAGE, 0) setAttribute(player!!, ATTRIBUTE_JUMPSTAGE, 0)
} }
println(getAttribute(player!!, ATTRIBUTE_HAROLD_MONEY, -1)) println(getAttribute(player!!, ATTRIBUTE_HAROLD_MONEY, -1))
@@ -198,7 +198,7 @@ class HaroldDialogueFile : DialogueFile() {
sendMessage(player!!, "Harold has given you some of your winnings!") sendMessage(player!!, "Harold has given you some of your winnings!")
val haroldAmount = getAttribute(player!!, ATTRIBUTE_HAROLD_MONEY, 200) val haroldAmount = getAttribute(player!!, ATTRIBUTE_HAROLD_MONEY, 200)
setAttribute(player!!, ATTRIBUTE_HAROLD_MONEY,0) setAttribute(player!!, ATTRIBUTE_HAROLD_MONEY,0)
addItemOrDrop(player!!, Items.COINS_995, haroldAmount); addItemOrDrop(player!!, Items.COINS_995, haroldAmount)
stage++ stage++
} }
37 -> npcl(FacialExpression.FRIENDLY, "I'll write you out an IOU for the rest.").also { stage++ } 37 -> npcl(FacialExpression.FRIENDLY, "I'll write you out an IOU for the rest.").also { stage++ }
@@ -286,7 +286,7 @@ class HaroldDialogueFile : DialogueFile() {
sendMessage(player!!, "Harold has given you some of your winnings!") sendMessage(player!!, "Harold has given you some of your winnings!")
val haroldAmount = getAttribute(player!!, ATTRIBUTE_HAROLD_MONEY, 200) val haroldAmount = getAttribute(player!!, ATTRIBUTE_HAROLD_MONEY, 200)
setAttribute(player!!, ATTRIBUTE_HAROLD_MONEY,0) setAttribute(player!!, ATTRIBUTE_HAROLD_MONEY,0)
addItemOrDrop(player!!, Items.COINS_995, haroldAmount); addItemOrDrop(player!!, Items.COINS_995, haroldAmount)
stage++ stage++
} }
34 -> npcl(FacialExpression.DRUNK, "I owe you the resht!").also { stage++ } 34 -> npcl(FacialExpression.DRUNK, "I owe you the resht!").also { stage++ }
@@ -304,7 +304,7 @@ class HaroldDialogueFile : DialogueFile() {
if (inInventory(player!!, Items.IOU_3103)){ if (inInventory(player!!, Items.IOU_3103)){
stage = 5 stage = 5
} else { } else {
stage++; stage++
} }
} }
1 -> playerl(FacialExpression.FRIENDLY, "I've lost the IOU you gave me.").also { stage++ } 1 -> playerl(FacialExpression.FRIENDLY, "I've lost the IOU you gave me.").also { stage++ }
@@ -355,7 +355,7 @@ class HaroldDialogueFile : DialogueFile() {
if (inInventory(player!!, Items.COMBINATION_3102) || inInventory(player!!, Items.IOU_3103)){ if (inInventory(player!!, Items.COMBINATION_3102) || inInventory(player!!, Items.IOU_3103)){
stage = 5 stage = 5
} else { } else {
stage++; stage++
} }
} }
1 -> playerl(FacialExpression.FRIENDLY, "I've lost the IOU you gave me.").also { stage++ } 1 -> playerl(FacialExpression.FRIENDLY, "I've lost the IOU you gave me.").also { stage++ }
@@ -17,40 +17,40 @@ import core.tools.END_DIALOGUE
*/ */
@Initializable @Initializable
class MasterCrafterDialogue(player: Player? = null) : core.game.dialogue.DialoguePlugin(player) { class MasterCrafterDialogue(player: Player? = null) : DialoguePlugin(player) {
var CAPE = Items.CRAFTING_CAPE_9780 var CAPE = Items.CRAFTING_CAPE_9780
var COIN = Items.COINS_995 var COIN = Items.COINS_995
override fun newInstance(player: Player) : core.game.dialogue.DialoguePlugin { override fun newInstance(player: Player) : DialoguePlugin {
return MasterCrafterDialogue(player) return MasterCrafterDialogue(player)
} }
override fun handle(interfaceId: Int, buttonId: Int) : Boolean { override fun handle(interfaceId: Int, buttonId: Int) : Boolean {
when(stage) { when(stage) {
0 -> if(hasLevelStat(player, Skills.CRAFTING, 99)) { 0 -> if(hasLevelStat(player, Skills.CRAFTING, 99)) {
player(core.game.dialogue.FacialExpression.ASKING, "Hey, could I buy a Skillcape of Crafting?").also{ stage = 10 } player(FacialExpression.ASKING, "Hey, could I buy a Skillcape of Crafting?").also{ stage = 10 }
} else { } else {
player(core.game.dialogue.FacialExpression.ASKING,"Hey, what is that cape you're wearing? I don't recognize it.").also { stage++ } player(FacialExpression.ASKING,"Hey, what is that cape you're wearing? I don't recognize it.").also { stage++ }
} }
1 -> npcl(core.game.dialogue.FacialExpression.FRIENDLY, "This? This is a Skillcape of Crafting. It is a symbol of my ability " + 1 -> npcl(FacialExpression.FRIENDLY, "This? This is a Skillcape of Crafting. It is a symbol of my ability " +
"and standing here in the Crafting Guild. If you should ever achieve level 99 Crafting come and talk to me " + "and standing here in the Crafting Guild. If you should ever achieve level 99 Crafting come and talk to me " +
"and we'll see if we can sort you out with one.").also{ stage = END_DIALOGUE } "and we'll see if we can sort you out with one.").also{ stage = END_DIALOGUE }
10 -> npcl(core.game.dialogue.FacialExpression.HAPPY, "Certainly! Right after you pay me 99000 coins.").also{ stage++ } 10 -> npcl(FacialExpression.HAPPY, "Certainly! Right after you pay me 99000 coins.").also{ stage++ }
11 -> options("Okay, here you go.", "No thanks.").also{ stage++ } 11 -> options("Okay, here you go.", "No thanks.").also{ stage++ }
12 -> when(buttonId) { 12 -> when(buttonId) {
1 -> player(core.game.dialogue.FacialExpression.FRIENDLY, "Okay, here you go.").also{ stage++ } 1 -> player(FacialExpression.FRIENDLY, "Okay, here you go.").also{ stage++ }
2 -> player(core.game.dialogue.FacialExpression.HALF_THINKING, "No, thanks.").also{ stage = END_DIALOGUE } 2 -> player(FacialExpression.HALF_THINKING, "No, thanks.").also{ stage = END_DIALOGUE }
} }
13 -> if(inInventory(player, COIN, 99000)) { 13 -> if(inInventory(player, COIN, 99000)) {
removeItem(player, Item(COIN, 99000), Container.INVENTORY) removeItem(player, Item(COIN, 99000), Container.INVENTORY)
addItem(player, CAPE, 1) addItem(player, CAPE, 1)
npcl(core.game.dialogue.FacialExpression.HAPPY, "There you go! Enjoy.").also{ stage = END_DIALOGUE } npcl(FacialExpression.HAPPY, "There you go! Enjoy.").also{ stage = END_DIALOGUE }
} else { } else {
npcl(core.game.dialogue.FacialExpression.NEUTRAL, "You don't have enough coins for a cape.").also{ stage = END_DIALOGUE } npcl(FacialExpression.NEUTRAL, "You don't have enough coins for a cape.").also{ stage = END_DIALOGUE }
} }
20 -> npcl(core.game.dialogue.FacialExpression.NEUTRAL, "Where's your brown apron? You can't come in here unless you're wearing one.").also{ stage++ } 20 -> npcl(FacialExpression.NEUTRAL, "Where's your brown apron? You can't come in here unless you're wearing one.").also{ stage++ }
21 -> player(core.game.dialogue.FacialExpression.HALF_GUILTY, "Err... I haven't got one.").also{ stage = END_DIALOGUE } 21 -> player(FacialExpression.HALF_GUILTY, "Err... I haven't got one.").also{ stage = END_DIALOGUE }
} }
return true return true
} }
@@ -13,15 +13,15 @@ import core.tools.END_DIALOGUE
*/ */
@Initializable @Initializable
class TannerDialogue(player: Player? = null) : core.game.dialogue.DialoguePlugin(player) { class TannerDialogue(player: Player? = null) : DialoguePlugin(player) {
override fun newInstance(player: Player) : core.game.dialogue.DialoguePlugin { override fun newInstance(player: Player) : DialoguePlugin {
return TannerDialogue(player) return TannerDialogue(player)
} }
override fun open(vararg args: Any?) : Boolean { override fun open(vararg args: Any?) : Boolean {
npc = args[0] as NPC npc = args[0] as NPC
npcl(core.game.dialogue.FacialExpression.NEUTRAL, "Greetings friend. I am a manufacturer of leather.") npcl(FacialExpression.NEUTRAL, "Greetings friend. I am a manufacturer of leather.")
stage = 0 stage = 0
return true return true
} }
@@ -30,19 +30,19 @@ class TannerDialogue(player: Player? = null) : core.game.dialogue.DialoguePlugin
when(stage) { when(stage) {
0 -> options("Can I buy some leather then?", "Leather is rather weak stuff.").also{ stage++ } 0 -> options("Can I buy some leather then?", "Leather is rather weak stuff.").also{ stage++ }
1 -> when(buttonId) { 1 -> when(buttonId) {
1 -> player(core.game.dialogue.FacialExpression.ASKING,"Can I buy some leather then?").also{ stage = 10 } 1 -> player(FacialExpression.ASKING,"Can I buy some leather then?").also{ stage = 10 }
2 -> player(core.game.dialogue.FacialExpression.SUSPICIOUS, "Leather is rather weak stuff.").also { stage = 20 } 2 -> player(FacialExpression.SUSPICIOUS, "Leather is rather weak stuff.").also { stage = 20 }
} }
10 -> npcl(core.game.dialogue.FacialExpression.FRIENDLY, "Certainly!").also { stage = END_DIALOGUE }.also{ npc.openShop(player) } 10 -> npcl(FacialExpression.FRIENDLY, "Certainly!").also { stage = END_DIALOGUE }.also{ npc.openShop(player) }
20 -> npcl(core.game.dialogue.FacialExpression.NOD_YES, "Normal leather may be quite weak, but it's very cheap - I " + 20 -> npcl(FacialExpression.NOD_YES, "Normal leather may be quite weak, but it's very cheap - I " +
"make it from cowhides for only 1 gp per hide - and it's so easy to craft that anyone can work with it.").also{ stage++ } "make it from cowhides for only 1 gp per hide - and it's so easy to craft that anyone can work with it.").also{ stage++ }
21 -> npcl(core.game.dialogue.FacialExpression.HALF_THINKING, "Alternatively you could try hard leather. It's not so easy " + 21 -> npcl(FacialExpression.HALF_THINKING, "Alternatively you could try hard leather. It's not so easy " +
"to craft, but I only charge 3 gp per cowhide to prepare it, and it makes much sturdier armour.").also{ stage++ } "to craft, but I only charge 3 gp per cowhide to prepare it, and it makes much sturdier armour.").also{ stage++ }
22 -> npcl(core.game.dialogue.FacialExpression.FRIENDLY, "I can also tan snake hides and dragonhides, suitable for crafting" + 22 -> npcl(FacialExpression.FRIENDLY, "I can also tan snake hides and dragonhides, suitable for crafting" +
"into the highest quality armour for rangers.").also{ stage++ } "into the highest quality armour for rangers.").also{ stage++ }
23 -> player(core.game.dialogue.FacialExpression.NEUTRAL, "Thanks, I'll bear it in mind.").also { stage = END_DIALOGUE } 23 -> player(FacialExpression.NEUTRAL, "Thanks, I'll bear it in mind.").also { stage = END_DIALOGUE }
} }
return true return true
} }
@@ -15,14 +15,14 @@ class TheDoorDialogues(val it: Int) : DialogueFile() {
npc = NPC(NPCs.MASTER_CRAFTER_805) npc = NPC(NPCs.MASTER_CRAFTER_805)
when(it) { when(it) {
0 -> when(stage) { 0 -> when(stage) {
0 -> npcl(core.game.dialogue.FacialExpression.FRIENDLY, "Welcome to the Guild of Master craftsmen.").also{ stage = END_DIALOGUE } 0 -> npcl(FacialExpression.FRIENDLY, "Welcome to the Guild of Master craftsmen.").also{ stage = END_DIALOGUE }
} }
1 -> when(stage) { 1 -> when(stage) {
0 -> npcl(core.game.dialogue.FacialExpression.ASKING, "Where's your brown apron? You can't come in here unless you're wearing one.").also{ stage++ } 0 -> npcl(FacialExpression.ASKING, "Where's your brown apron? You can't come in here unless you're wearing one.").also{ stage++ }
1 -> player(core.game.dialogue.FacialExpression.SAD, "Err... I haven't got one.").also { stage = END_DIALOGUE } 1 -> player(FacialExpression.SAD, "Err... I haven't got one.").also { stage = END_DIALOGUE }
} }
2 -> when(stage) { 2 -> when(stage) {
0 -> npcl(core.game.dialogue.FacialExpression.NEUTRAL, "Sorry, only experienced crafters are allowed in here. You must be level 40 or above to enter.").also{ stage = END_DIALOGUE } 0 -> npcl(FacialExpression.NEUTRAL, "Sorry, only experienced crafters are allowed in here. You must be level 40 or above to enter.").also{ stage = END_DIALOGUE }
} }
} }
@@ -14,34 +14,34 @@ import core.tools.END_DIALOGUE
* @author bushtail * @author bushtail
*/ */
@Initializable @Initializable
class ZandarHorfyreDialogue(player: Player? = null) : core.game.dialogue.DialoguePlugin(player) { class ZandarHorfyreDialogue(player: Player? = null) : DialoguePlugin(player) {
override fun newInstance(player: Player) : core.game.dialogue.DialoguePlugin { override fun newInstance(player: Player) : DialoguePlugin {
return ZandarHorfyreDialogue(player) return ZandarHorfyreDialogue(player)
} }
override fun open(vararg args: Any?) : Boolean { override fun open(vararg args: Any?) : Boolean {
npc = args[0] as NPC npc = args[0] as NPC
player(core.game.dialogue.FacialExpression.HALF_THINKING,"Who are you?") player(FacialExpression.HALF_THINKING,"Who are you?")
stage = -1 stage = -1
return true return true
} }
override fun handle(interfaceId: Int, buttonId: Int) : Boolean { override fun handle(interfaceId: Int, buttonId: Int) : Boolean {
when (stage) { when (stage) {
-1 -> npcl(core.game.dialogue.FacialExpression.NEUTRAL,"My name is Zandar Horfyre, and you ${ player.name } are trespassing in my tower, not to mention attacking my students! I thank you to leave immediately!").also{ stage++ } -1 -> npcl(FacialExpression.NEUTRAL,"My name is Zandar Horfyre, and you ${ player.name } are trespassing in my tower, not to mention attacking my students! I thank you to leave immediately!").also{ stage++ }
0 -> options("Ok, I was going anyway.", "No, I think I'll stay for a bit.").also{ stage++ } 0 -> options("Ok, I was going anyway.", "No, I think I'll stay for a bit.").also{ stage++ }
1 -> when(buttonId) { 1 -> when(buttonId) {
1 -> player("Ok, I was going anyway.").also{ stage = 10 } 1 -> player("Ok, I was going anyway.").also{ stage = 10 }
2 -> player("No, I think I'll stay for a bit.").also{ stage = 20 } 2 -> player("No, I think I'll stay for a bit.").also{ stage = 20 }
} }
10 -> npcl(core.game.dialogue.FacialExpression.NEUTRAL,"Good! And don't forget to close the door behind you!").also{ stage++ } 10 -> npcl(FacialExpression.NEUTRAL,"Good! And don't forget to close the door behind you!").also{ stage++ }
11 -> stage = END_DIALOGUE 11 -> stage = END_DIALOGUE
20 -> npcl(core.game.dialogue.FacialExpression.ANNOYED,"Actually, that wasn't an invitation. I've tried being polite, now we'll do it the hard way!").also{ teleport(player, Location.create(3217, 3177, 0), TeleportManager.TeleportType.INSTANT) }.also{ stage++ } 20 -> npcl(FacialExpression.ANNOYED,"Actually, that wasn't an invitation. I've tried being polite, now we'll do it the hard way!").also{ teleport(player, Location.create(3217, 3177, 0), TeleportManager.TeleportType.INSTANT) }.also{ stage++ }
21 -> player(core.game.dialogue.FacialExpression.ANGRY, "Zamorak curse that mage!").also{ stage++ } 21 -> player(FacialExpression.ANGRY, "Zamorak curse that mage!").also{ stage++ }
22 -> player(core.game.dialogue.FacialExpression.LAUGH, "Actually, I guess he already has!").also{ stage++ } 22 -> player(FacialExpression.LAUGH, "Actually, I guess he already has!").also{ stage++ }
23 -> end() 23 -> end()
} }
return true return true
@@ -12,11 +12,11 @@ import org.rs09.consts.NPCs
*/ */
@Initializable @Initializable
class DrogoDialogue(player: Player? = null) : core.game.dialogue.DialoguePlugin(player){ class DrogoDialogue(player: Player? = null) : DialoguePlugin(player){
override fun open(vararg args: Any?): Boolean { override fun open(vararg args: Any?): Boolean {
npc = args[0] as NPC npc = args[0] as NPC
npc(core.game.dialogue.FacialExpression.OLD_DEFAULT,"'Ello. Welcome to my Mining shop, friend.").also { stage = 0 } npc(FacialExpression.OLD_DEFAULT,"'Ello. Welcome to my Mining shop, friend.").also { stage = 0 }
return true return true
} }
@@ -24,21 +24,21 @@ class DrogoDialogue(player: Player? = null) : core.game.dialogue.DialoguePlugin(
when(stage){ when(stage){
0 -> options("Do you want to trade?", "Hello, shorty.", "Why don't you ever restock ores and bars?").also { stage++ } 0 -> options("Do you want to trade?", "Hello, shorty.", "Why don't you ever restock ores and bars?").also { stage++ }
1 -> when (buttonId) { 1 -> when (buttonId) {
1 -> player(core.game.dialogue.FacialExpression.FRIENDLY, "Do you want to trade?").also { stage = 10 } 1 -> player(FacialExpression.FRIENDLY, "Do you want to trade?").also { stage = 10 }
2 -> player(core.game.dialogue.FacialExpression.FRIENDLY, "Hello, shorty.").also { stage = 20 } 2 -> player(FacialExpression.FRIENDLY, "Hello, shorty.").also { stage = 20 }
3 -> player(core.game.dialogue.FacialExpression.FRIENDLY, "Why don't you ever restock ores and bars?").also { stage = 30 } 3 -> player(FacialExpression.FRIENDLY, "Why don't you ever restock ores and bars?").also { stage = 30 }
} }
10 -> end().also { npc.openShop(player) } 10 -> end().also { npc.openShop(player) }
20 -> npc(core.game.dialogue.FacialExpression.OLD_ANGRY1,"I may be short, but at least I've got manners.").also { stage = 99 } 20 -> npc(FacialExpression.OLD_ANGRY1,"I may be short, but at least I've got manners.").also { stage = 99 }
30 -> npc(core.game.dialogue.FacialExpression.OLD_DEFAULT,"The only ores and bars I sell are those sold to me.").also { stage = 99 } 30 -> npc(FacialExpression.OLD_DEFAULT,"The only ores and bars I sell are those sold to me.").also { stage = 99 }
99 -> end() 99 -> end()
} }
return true return true
} }
override fun newInstance(player: Player?): core.game.dialogue.DialoguePlugin { override fun newInstance(player: Player?): DialoguePlugin {
return DrogoDialogue(player) return DrogoDialogue(player)
} }
@@ -12,29 +12,29 @@ import org.rs09.consts.NPCs
*/ */
@Initializable @Initializable
class DwarvenMineGuardDialogue(player: Player? = null) : core.game.dialogue.DialoguePlugin(player){ class DwarvenMineGuardDialogue(player: Player? = null) : DialoguePlugin(player){
override fun open(vararg args: Any?): Boolean { override fun open(vararg args: Any?): Boolean {
npc = args[0] as NPC npc = args[0] as NPC
player(core.game.dialogue.FacialExpression.FRIENDLY,"Hello.").also { stage = 0 } player(FacialExpression.FRIENDLY,"Hello.").also { stage = 0 }
return true return true
} }
override fun handle(interfaceId: Int, buttonId: Int): Boolean { override fun handle(interfaceId: Int, buttonId: Int): Boolean {
when(stage){ when(stage){
0 -> npcl(core.game.dialogue.FacialExpression.OLD_ANGRY1, "Don't distract me while I'm on duty! This mine has to be protected!").also { stage++ } 0 -> npcl(FacialExpression.OLD_ANGRY1, "Don't distract me while I'm on duty! This mine has to be protected!").also { stage++ }
1 -> player(core.game.dialogue.FacialExpression.FRIENDLY, "What's going to attack a mine?").also { stage++ } 1 -> player(FacialExpression.FRIENDLY, "What's going to attack a mine?").also { stage++ }
2 -> npcl(core.game.dialogue.FacialExpression.OLD_ANGRY1, "Goblins! They wander everywhere, attacking anyone they think is small enough to be an easy victim. We need more cannons to fight them off properly.").also { stage++ } 2 -> npcl(FacialExpression.OLD_ANGRY1, "Goblins! They wander everywhere, attacking anyone they think is small enough to be an easy victim. We need more cannons to fight them off properly.").also { stage++ }
3 -> player(core.game.dialogue.FacialExpression.FRIENDLY, "Well, I've done my bit to help with that.").also { stage++ } 3 -> player(FacialExpression.FRIENDLY, "Well, I've done my bit to help with that.").also { stage++ }
4 -> npcl(core.game.dialogue.FacialExpression.OLD_ANGRY1, "Yes, I heard. Now please let me get on with my guard duties.").also { stage++ } 4 -> npcl(FacialExpression.OLD_ANGRY1, "Yes, I heard. Now please let me get on with my guard duties.").also { stage++ }
5 -> player(core.game.dialogue.FacialExpression.FRIENDLY, "Alright, I'll leave you alone now.").also { stage = 99 } 5 -> player(FacialExpression.FRIENDLY, "Alright, I'll leave you alone now.").also { stage = 99 }
99 -> end() 99 -> end()
} }
return true return true
} }
override fun newInstance(player: Player?): core.game.dialogue.DialoguePlugin { override fun newInstance(player: Player?): DialoguePlugin {
return DwarvenMineGuardDialogue(player) return DwarvenMineGuardDialogue(player)
} }
@@ -14,11 +14,11 @@ import org.rs09.consts.NPCs
*/ */
@Initializable @Initializable
class NurmofDialogue(player: Player? = null) : core.game.dialogue.DialoguePlugin(player){ class NurmofDialogue(player: Player? = null) : DialoguePlugin(player){
override fun open(vararg args: Any?): Boolean { override fun open(vararg args: Any?): Boolean {
npc = args[0] as NPC npc = args[0] as NPC
npcl(core.game.dialogue.FacialExpression.OLD_NORMAL,"Greetings and welcome to my pickaxe shop. Do you want to buy my premium quality pickaxes?").also { stage = 0 } npcl(FacialExpression.OLD_NORMAL,"Greetings and welcome to my pickaxe shop. Do you want to buy my premium quality pickaxes?").also { stage = 0 }
return true return true
} }
@@ -28,19 +28,19 @@ class NurmofDialogue(player: Player? = null) : core.game.dialogue.DialoguePlugin
1 -> when (buttonId) { 1 -> when (buttonId) {
1 -> end().also { npc.openShop(player) } 1 -> end().also { npc.openShop(player) }
2 -> player(core.game.dialogue.FacialExpression.FRIENDLY, "No thank you.").also { stage = 99 } 2 -> player(FacialExpression.FRIENDLY, "No thank you.").also { stage = 99 }
3 -> player(core.game.dialogue.FacialExpression.HALF_ASKING, "Are your pickaxes better than other pickaxes, then?").also { stage = 10 } 3 -> player(FacialExpression.HALF_ASKING, "Are your pickaxes better than other pickaxes, then?").also { stage = 10 }
} }
10 -> npcl(core.game.dialogue.FacialExpression.OLD_NORMAL,"Of course they are! My pickaxes are made of higher grade metal than your ordinary bronze pickaxes, allowing you to mine ore just that little bit faster.").also { 10 -> npcl(FacialExpression.OLD_NORMAL,"Of course they are! My pickaxes are made of higher grade metal than your ordinary bronze pickaxes, allowing you to mine ore just that little bit faster.").also {
if(!getAttribute(player, "pre-dq:said-hi", true)) { if(!getAttribute(player, "pre-dq:said-hi", true)) {
stage++ stage++
} else { } else {
stage = 99 stage = 99
} }
} }
11 -> playerl(core.game.dialogue.FacialExpression.FRIENDLY, "By the way, Doric says hello!").also { stage++ } 11 -> playerl(FacialExpression.FRIENDLY, "By the way, Doric says hello!").also { stage++ }
12 -> npcl(core.game.dialogue.FacialExpression.OLD_HAPPY, "Oh! Thank you for telling me, adventurer!").also { stage = 99 } 12 -> npcl(FacialExpression.OLD_HAPPY, "Oh! Thank you for telling me, adventurer!").also { stage = 99 }
99 -> { 99 -> {
setAttribute(player, "pre-dq:said-hi", true) setAttribute(player, "pre-dq:said-hi", true)
end() end()
@@ -49,7 +49,7 @@ class NurmofDialogue(player: Player? = null) : core.game.dialogue.DialoguePlugin
return true return true
} }
override fun newInstance(player: Player?): core.game.dialogue.DialoguePlugin { override fun newInstance(player: Player?): DialoguePlugin {
return NurmofDialogue(player) return NurmofDialogue(player)
} }
@@ -13,38 +13,38 @@ import org.rs09.consts.NPCs
*/ */
@Initializable @Initializable
class AmbassadorSpanfippleDialogue(player: Player? = null) : core.game.dialogue.DialoguePlugin(player){ class AmbassadorSpanfippleDialogue(player: Player? = null) : DialoguePlugin(player){
override fun open(vararg args: Any?): Boolean { override fun open(vararg args: Any?): Boolean {
npc = args[0] as NPC npc = args[0] as NPC
npc(core.game.dialogue.FacialExpression.OLD_DEFAULT,"It's all very white round here, isn't it?").also { stage = 0 } npc(FacialExpression.OLD_DEFAULT,"It's all very white round here, isn't it?").also { stage = 0 }
return true return true
} }
override fun handle(interfaceId: Int, buttonId: Int): Boolean { override fun handle(interfaceId: Int, buttonId: Int): Boolean {
when(stage){ when(stage){
0 -> { 0 -> {
player(core.game.dialogue.FacialExpression.THINKING, "Well, it is the White Knights' Castle.").also { stage++ } player(FacialExpression.THINKING, "Well, it is the White Knights' Castle.").also { stage++ }
} }
1 -> { 1 -> {
npcl(core.game.dialogue.FacialExpression.OLD_DEFAULT, "I think it would all look better in pink. At least then I wouldn't be squinting all the time.").also { stage++ } npcl(FacialExpression.OLD_DEFAULT, "I think it would all look better in pink. At least then I wouldn't be squinting all the time.").also { stage++ }
} }
2 -> { 2 -> {
playerl(core.game.dialogue.FacialExpression.FRIENDLY, "Yes, but then they'd have to become the Pink Knights. I think they'd have problems recruiting then.").also { stage++ } playerl(FacialExpression.FRIENDLY, "Yes, but then they'd have to become the Pink Knights. I think they'd have problems recruiting then.").also { stage++ }
} }
3 -> { 3 -> {
npc(core.game.dialogue.FacialExpression.OLD_DEFAULT, "You're probably right. Maybe brown, then.").also { stage++ } npc(FacialExpression.OLD_DEFAULT, "You're probably right. Maybe brown, then.").also { stage++ }
} }
4 -> { 4 -> {
player(core.game.dialogue.FacialExpression.HALF_THINKING, "I think that may be worse...").also { stage++ } player(FacialExpression.HALF_THINKING, "I think that may be worse...").also { stage++ }
} }
5 -> { 5 -> {
npc(core.game.dialogue.FacialExpression.OLD_ANGRY1, "Bah, humans have no sense of style...").also { stage = 99 } npc(FacialExpression.OLD_ANGRY1, "Bah, humans have no sense of style...").also { stage = 99 }
} }
99 -> end() 99 -> end()
@@ -52,7 +52,7 @@ class AmbassadorSpanfippleDialogue(player: Player? = null) : core.game.dialogue.
return true return true
} }
override fun newInstance(player: Player?): core.game.dialogue.DialoguePlugin { override fun newInstance(player: Player?): DialoguePlugin {
return AmbassadorSpanfippleDialogue(player) return AmbassadorSpanfippleDialogue(player)
} }
@@ -12,29 +12,29 @@ import org.rs09.consts.NPCs
*/ */
@Initializable @Initializable
class ApprenticeWorkmanDialogue(player: Player? = null) : core.game.dialogue.DialoguePlugin(player){ class ApprenticeWorkmanDialogue(player: Player? = null) : DialoguePlugin(player){
override fun open(vararg args: Any?): Boolean { override fun open(vararg args: Any?): Boolean {
npc = args[0] as NPC npc = args[0] as NPC
player(core.game.dialogue.FacialExpression.FRIENDLY,"Hiya.").also { stage = 0 } player(FacialExpression.FRIENDLY,"Hiya.").also { stage = 0 }
return true return true
} }
override fun handle(interfaceId: Int, buttonId: Int): Boolean { override fun handle(interfaceId: Int, buttonId: Int): Boolean {
when(stage){ when(stage){
0 -> { 0 -> {
npc(core.game.dialogue.FacialExpression.FRIENDLY, "Sorry, I haven't got time to chat.", npc(FacialExpression.FRIENDLY, "Sorry, I haven't got time to chat.",
"We've only just finished a collossal order of furniture", "We've only just finished a collossal order of furniture",
"for the Varrock area, and already there's more work", "for the Varrock area, and already there's more work",
"coming in.").also { stage++ } "coming in.").also { stage++ }
} }
1 -> { 1 -> {
player(core.game.dialogue.FacialExpression.ASKING, "Varrock?").also { stage++ } player(FacialExpression.ASKING, "Varrock?").also { stage++ }
} }
2 -> { 2 -> {
npc(core.game.dialogue.FacialExpression.FRIENDLY, "Yeah, the Council's had it redecorated.").also { stage++ } npc(FacialExpression.FRIENDLY, "Yeah, the Council's had it redecorated.").also { stage++ }
} }
3 -> { 3 -> {
@@ -42,11 +42,11 @@ class ApprenticeWorkmanDialogue(player: Player? = null) : core.game.dialogue.Dia
} }
4 -> { 4 -> {
npc(core.game.dialogue.FacialExpression.FRIENDLY, "You'd better let me get on with my work.").also { stage++ } npc(FacialExpression.FRIENDLY, "You'd better let me get on with my work.").also { stage++ }
} }
5 -> { 5 -> {
player(core.game.dialogue.FacialExpression.FRIENDLY, "Ok, bye.").also { stage = 99 } player(FacialExpression.FRIENDLY, "Ok, bye.").also { stage = 99 }
} }
99 -> end() 99 -> end()
@@ -54,7 +54,7 @@ class ApprenticeWorkmanDialogue(player: Player? = null) : core.game.dialogue.Dia
return true return true
} }
override fun newInstance(player: Player?): core.game.dialogue.DialoguePlugin { override fun newInstance(player: Player?): DialoguePlugin {
return ApprenticeWorkmanDialogue(player) return ApprenticeWorkmanDialogue(player)
} }
@@ -12,43 +12,43 @@ import org.rs09.consts.NPCs
*/ */
@Initializable @Initializable
class DrunkenManDialogue(player: Player? = null) : core.game.dialogue.DialoguePlugin(player){ class DrunkenManDialogue(player: Player? = null) : DialoguePlugin(player){
override fun open(vararg args: Any?): Boolean { override fun open(vararg args: Any?): Boolean {
npc = args[0] as NPC npc = args[0] as NPC
player(core.game.dialogue.FacialExpression.FRIENDLY,"Hello.").also { stage = 0 } player(FacialExpression.FRIENDLY,"Hello.").also { stage = 0 }
return true return true
} }
override fun handle(interfaceId: Int, buttonId: Int): Boolean { override fun handle(interfaceId: Int, buttonId: Int): Boolean {
when(stage){ when(stage){
0 -> { 0 -> {
npc(core.game.dialogue.FacialExpression.DRUNK, "... whassup?").also { stage++ } npc(FacialExpression.DRUNK, "... whassup?").also { stage++ }
} }
1 -> { 1 -> {
player(core.game.dialogue.FacialExpression.ASKING, "Are you alright?").also { stage++ } player(FacialExpression.ASKING, "Are you alright?").also { stage++ }
} }
2 -> { 2 -> {
npc(core.game.dialogue.FacialExpression.DRUNK, "... see... two of you... why there two of you?").also { stage++ } npc(FacialExpression.DRUNK, "... see... two of you... why there two of you?").also { stage++ }
} }
3 -> { 3 -> {
player(core.game.dialogue.FacialExpression.FRIENDLY, "There's only one of me, friend.").also { stage++ } player(FacialExpression.FRIENDLY, "There's only one of me, friend.").also { stage++ }
} }
4 -> { 4 -> {
npc(core.game.dialogue.FacialExpression.DRUNK, "... no, two of you... you can't count...", npc(FacialExpression.DRUNK, "... no, two of you... you can't count...",
"... maybe you drunk too much...").also { stage++ } "... maybe you drunk too much...").also { stage++ }
} }
5 -> { 5 -> {
player(core.game.dialogue.FacialExpression.FRIENDLY, "Whatever you say, friend.").also { stage++ } player(FacialExpression.FRIENDLY, "Whatever you say, friend.").also { stage++ }
} }
6 -> { 6 -> {
npc(core.game.dialogue.FacialExpression.DRUNK, "... giant hairy cabbages...").also { stage = 99 } npc(FacialExpression.DRUNK, "... giant hairy cabbages...").also { stage = 99 }
} }
99 -> end() 99 -> end()
@@ -56,7 +56,7 @@ class DrunkenManDialogue(player: Player? = null) : core.game.dialogue.DialoguePl
return true return true
} }
override fun newInstance(player: Player?): core.game.dialogue.DialoguePlugin { override fun newInstance(player: Player?): DialoguePlugin {
return DrunkenManDialogue(player) return DrunkenManDialogue(player)
} }
@@ -20,15 +20,15 @@ import core.tools.START_DIALOGUE
* @author vddCore * @author vddCore
*/ */
@Initializable @Initializable
class RisingSunInnBartenderDialogue(player: Player? = null) : core.game.dialogue.DialoguePlugin(player) { class RisingSunInnBartenderDialogue(player: Player? = null) : DialoguePlugin(player) {
override fun newInstance(player: Player): core.game.dialogue.DialoguePlugin override fun newInstance(player: Player): DialoguePlugin
= RisingSunInnBartenderDialogue(player) = RisingSunInnBartenderDialogue(player)
override fun open(vararg args: Any?): Boolean { override fun open(vararg args: Any?): Boolean {
npc = args[0] as NPC npc = args[0] as NPC
npcl( npcl(
core.game.dialogue.FacialExpression.HAPPY, FacialExpression.HAPPY,
"Hi! What can I get you?" "Hi! What can I get you?"
) )
@@ -39,25 +39,25 @@ class RisingSunInnBartenderDialogue(player: Player? = null) : core.game.dialogue
when (stage) { when (stage) {
START_DIALOGUE -> if (hasAnyBeerGlasses()) { START_DIALOGUE -> if (hasAnyBeerGlasses()) {
showTopics( showTopics(
Topic(core.game.dialogue.FacialExpression.ASKING, "What ales are you serving?", 10), Topic(FacialExpression.ASKING, "What ales are you serving?", 10),
Topic(core.game.dialogue.FacialExpression.HAPPY, "I've got some beer glasses...", 20) Topic(FacialExpression.HAPPY, "I've got some beer glasses...", 20)
) )
} else { } else {
playerl(core.game.dialogue.FacialExpression.ASKING, "What ales are you serving?") playerl(FacialExpression.ASKING, "What ales are you serving?")
.also { stage = 10 } .also { stage = 10 }
} }
10 -> npcl( 10 -> npcl(
core.game.dialogue.FacialExpression.FRIENDLY, FacialExpression.FRIENDLY,
"Well, we've got Asgarnian Ale, Wizard's Mind Bomb and Dwarven Stout. " "Well, we've got Asgarnian Ale, Wizard's Mind Bomb and Dwarven Stout. "
+ "Each for only 3 coins." + "Each for only 3 coins."
).also { stage++ } ).also { stage++ }
11 -> showTopics( 11 -> showTopics(
Topic(core.game.dialogue.FacialExpression.HAPPY, "One Asgarnian Ale, please.", 12), Topic(FacialExpression.HAPPY, "One Asgarnian Ale, please.", 12),
Topic(core.game.dialogue.FacialExpression.HAPPY, "I'll try the Mind Bomb.", 13), Topic(FacialExpression.HAPPY, "I'll try the Mind Bomb.", 13),
Topic(core.game.dialogue.FacialExpression.ASKING, "Can I have a Dwarven Stout?", 14), Topic(FacialExpression.ASKING, "Can I have a Dwarven Stout?", 14),
Topic(core.game.dialogue.FacialExpression.NEUTRAL, "I don't feel like any of those.", END_DIALOGUE) Topic(FacialExpression.NEUTRAL, "I don't feel like any of those.", END_DIALOGUE)
) )
12 -> if (ensureHasMoney()) { 12 -> if (ensureHasMoney()) {
@@ -74,27 +74,27 @@ class RisingSunInnBartenderDialogue(player: Player? = null) : core.game.dialogue
20 -> { 20 -> {
npcl( npcl(
core.game.dialogue.FacialExpression.HALF_GUILTY, FacialExpression.HALF_GUILTY,
"Oh, we will buy those from you if you're interested. We offer 2 coins for each glass." "Oh, we will buy those from you if you're interested. We offer 2 coins for each glass."
).also { stage ++ } ).also { stage ++ }
} }
21 -> showTopics( 21 -> showTopics(
Topic(core.game.dialogue.FacialExpression.HAPPY, "Yes, please!", 22), Topic(FacialExpression.HAPPY, "Yes, please!", 22),
Topic(core.game.dialogue.FacialExpression.NEUTRAL, "No thanks, I like my empty beer glasses.", END_DIALOGUE) Topic(FacialExpression.NEUTRAL, "No thanks, I like my empty beer glasses.", END_DIALOGUE)
) )
22 -> { 22 -> {
trySellAllBeerGlasses() trySellAllBeerGlasses()
npcl( npcl(
core.game.dialogue.FacialExpression.FRIENDLY, FacialExpression.FRIENDLY,
"There you go!" "There you go!"
).also { stage = END_DIALOGUE } ).also { stage = END_DIALOGUE }
} }
30 -> { 30 -> {
playerl(core.game.dialogue.FacialExpression.FRIENDLY, "Thanks, ${npc.name}.") playerl(FacialExpression.FRIENDLY, "Thanks, ${npc.name}.")
.also { stage = END_DIALOGUE } .also { stage = END_DIALOGUE }
} }
} }
@@ -109,7 +109,7 @@ class RisingSunInnBartenderDialogue(player: Player? = null) : core.game.dialogue
private fun ensureHasMoney(): Boolean { private fun ensureHasMoney(): Boolean {
if (!inInventory(player, Items.COINS_995, 3)) { if (!inInventory(player, Items.COINS_995, 3)) {
npcl(core.game.dialogue.FacialExpression.ANGRY, "No freeloaders!") npcl(FacialExpression.ANGRY, "No freeloaders!")
.also { .also {
sendMessage(player, "You don't have enough money to buy that.") sendMessage(player, "You don't have enough money to buy that.")
stage = END_DIALOGUE stage = END_DIALOGUE
@@ -12,26 +12,26 @@ import org.rs09.consts.NPCs.WORKMAN_3236
*/ */
@Initializable @Initializable
class WorkmanDialogue(player: Player? = null) : core.game.dialogue.DialoguePlugin(player){ class WorkmanDialogue(player: Player? = null) : DialoguePlugin(player){
override fun open(vararg args: Any?): Boolean { override fun open(vararg args: Any?): Boolean {
npc = args[0] as NPC npc = args[0] as NPC
player(core.game.dialogue.FacialExpression.FRIENDLY,"Hiya.").also { stage = 0 } player(FacialExpression.FRIENDLY,"Hiya.").also { stage = 0 }
return true return true
} }
override fun handle(interfaceId: Int, buttonId: Int): Boolean { override fun handle(interfaceId: Int, buttonId: Int): Boolean {
when(stage){ when(stage){
0 -> { 0 -> {
npc(core.game.dialogue.FacialExpression.ASKING, "What do you want? I've got work to do!").also { stage++ } npc(FacialExpression.ASKING, "What do you want? I've got work to do!").also { stage++ }
} }
1 -> { 1 -> {
player(core.game.dialogue.FacialExpression.ASKING, "Can you teach me anything?").also { stage++ } player(FacialExpression.ASKING, "Can you teach me anything?").also { stage++ }
} }
2 -> { 2 -> {
npcl(core.game.dialogue.FacialExpression.ANNOYED, "No - I've got one lousy apprentice already, and that's quite enough hassle! Go away!").also { stage = 99 } npcl(FacialExpression.ANNOYED, "No - I've got one lousy apprentice already, and that's quite enough hassle! Go away!").also { stage = 99 }
} }
99 -> end() 99 -> end()
@@ -39,7 +39,7 @@ class WorkmanDialogue(player: Player? = null) : core.game.dialogue.DialoguePlugi
return true return true
} }
override fun newInstance(player: Player?): core.game.dialogue.DialoguePlugin { override fun newInstance(player: Player?): DialoguePlugin {
return WorkmanDialogue(player) return WorkmanDialogue(player)
} }
@@ -11,16 +11,16 @@ import org.rs09.consts.NPCs
import core.tools.END_DIALOGUE import core.tools.END_DIALOGUE
@Initializable @Initializable
class VelrakDialogue(player: Player? = null) : core.game.dialogue.DialoguePlugin(player) { class VelrakDialogue(player: Player? = null) : DialoguePlugin(player) {
override fun newInstance(player: Player?): core.game.dialogue.DialoguePlugin { override fun newInstance(player: Player?): DialoguePlugin {
return VelrakDialogue(player) return VelrakDialogue(player)
} }
override fun open(vararg args: Any?): Boolean { override fun open(vararg args: Any?): Boolean {
if(inInventory(player, Items.DUSTY_KEY_1590)){ if(inInventory(player, Items.DUSTY_KEY_1590)){
playerl(core.game.dialogue.FacialExpression.HALF_THINKING, "Are you still here?").also { stage = 100 } playerl(FacialExpression.HALF_THINKING, "Are you still here?").also { stage = 100 }
} else { } else {
npcl(core.game.dialogue.FacialExpression.FRIENDLY, "Thank you for rescuing me! It isn't very comfy in this cell.") npcl(FacialExpression.FRIENDLY, "Thank you for rescuing me! It isn't very comfy in this cell.")
removeItem(player, Items.JAIL_KEY_1591, Container.INVENTORY) removeItem(player, Items.JAIL_KEY_1591, Container.INVENTORY)
} }
return true return true
@@ -30,26 +30,26 @@ class VelrakDialogue(player: Player? = null) : core.game.dialogue.DialoguePlugin
when(stage){ when(stage){
0 -> options("So... do you know anywhere good to explore?","Do I get a reward for freeing you?").also { stage++ } 0 -> options("So... do you know anywhere good to explore?","Do I get a reward for freeing you?").also { stage++ }
1 -> when(buttonId){ 1 -> when(buttonId){
1 -> playerl(core.game.dialogue.FacialExpression.HALF_THINKING, "So... do you know anywhere good to explore?").also { stage = 10 } 1 -> playerl(FacialExpression.HALF_THINKING, "So... do you know anywhere good to explore?").also { stage = 10 }
2 -> playerl(core.game.dialogue.FacialExpression.FRIENDLY, "Do I get a reward for freeing you?").also { stage = 20 } 2 -> playerl(FacialExpression.FRIENDLY, "Do I get a reward for freeing you?").also { stage = 20 }
} }
10 -> npcl(core.game.dialogue.FacialExpression.HALF_THINKING, "Well, this dungeon was quite good to explore...until I got captured, anyway. I was given a key to an inner part of this dungeon by a mysterious stranger!").also { stage++ } 10 -> npcl(FacialExpression.HALF_THINKING, "Well, this dungeon was quite good to explore...until I got captured, anyway. I was given a key to an inner part of this dungeon by a mysterious stranger!").also { stage++ }
11 -> npcl(core.game.dialogue.FacialExpression.NEUTRAL, "It's rather tough for me to get that far into the dungeon however. I just keep getting captured! Would you like to give it a go?").also { stage++ } 11 -> npcl(FacialExpression.NEUTRAL, "It's rather tough for me to get that far into the dungeon however. I just keep getting captured! Would you like to give it a go?").also { stage++ }
12 -> options("Yes, please!", "No, it's too dangerous for me too.").also { stage++ } 12 -> options("Yes, please!", "No, it's too dangerous for me too.").also { stage++ }
13 -> when(buttonId){ 13 -> when(buttonId){
1 -> playerl(core.game.dialogue.FacialExpression.FRIENDLY, "Yes, please!").also { stage++ } 1 -> playerl(FacialExpression.FRIENDLY, "Yes, please!").also { stage++ }
2 -> playerl(core.game.dialogue.FacialExpression.NEUTRAL, "No, it's too dangerous for me too.").also { stage = 15 } 2 -> playerl(FacialExpression.NEUTRAL, "No, it's too dangerous for me too.").also { stage = 15 }
} }
14 -> sendItemDialogue(player, Items.DUSTY_KEY_1590, "Velrak reaches somewhere mysterious and passes you a key.").also { addItem(player, Items.DUSTY_KEY_1590, 1); stage = END_DIALOGUE } 14 -> sendItemDialogue(player, Items.DUSTY_KEY_1590, "Velrak reaches somewhere mysterious and passes you a key.").also { addItem(player, Items.DUSTY_KEY_1590, 1); stage = END_DIALOGUE }
15 -> npcl(core.game.dialogue.FacialExpression.FRIENDLY, "I don't blame you!").also { stage = END_DIALOGUE } 15 -> npcl(FacialExpression.FRIENDLY, "I don't blame you!").also { stage = END_DIALOGUE }
20 -> npcl(core.game.dialogue.FacialExpression.HALF_GUILTY, "Well, not really. The Black Knights took all of my stuff before throwing me in here to rot!").also { stage = 0 } 20 -> npcl(FacialExpression.HALF_GUILTY, "Well, not really. The Black Knights took all of my stuff before throwing me in here to rot!").also { stage = 0 }
100 -> npcl(core.game.dialogue.FacialExpression.HALF_THINKING, "Yes... I'm still plucking up the courage to run out past those Black Knights.").also { stage++ } 100 -> npcl(FacialExpression.HALF_THINKING, "Yes... I'm still plucking up the courage to run out past those Black Knights.").also { stage++ }
101 -> playerl(core.game.dialogue.FacialExpression.FRIENDLY, "Oh, go on. You can do it!").also { stage = END_DIALOGUE } 101 -> playerl(FacialExpression.FRIENDLY, "Oh, go on. You can do it!").also { stage = END_DIALOGUE }
} }
return true return true
@@ -122,7 +122,7 @@ class WitchesDiaryBook : InteractionListener {
private fun display(player:Player, pageNum: Int, buttonID: Int) : Boolean { private fun display(player:Player, pageNum: Int, buttonID: Int) : Boolean {
BookInterface.pageSetup(player, BookInterface.FANCY_BOOK_3_49, TITLE, CONTENTS) BookInterface.pageSetup(player, BookInterface.FANCY_BOOK_3_49, TITLE, CONTENTS)
if (BookInterface.isLastPage(pageNum, CONTENTS.size)) { if (BookInterface.isLastPage(pageNum, CONTENTS.size)) {
setAttribute(player, "/save:readWitchsBook", true); setAttribute(player, "/save:readWitchsBook", true)
} }
return true return true
} }
@@ -25,7 +25,7 @@ class KnightsNotes : InteractionListener {
ScrollLine("know how I am going to get this message to you, why is that",11), ScrollLine("know how I am going to get this message to you, why is that",11),
ScrollLine("talking skull never around when he's needed? Your comrade,",12), ScrollLine("talking skull never around when he's needed? Your comrade,",12),
ScrollLine("Sir Gerry.",13), ScrollLine("Sir Gerry.",13),
); )
} }
override fun defineListeners() { override fun defineListeners() {
@@ -36,7 +36,7 @@ class KnightsNotes : InteractionListener {
player!!.packetDispatch.sendInterfaceConfig(228, 9, false) // childId 7 is left 8 is right player!!.packetDispatch.sendInterfaceConfig(228, 9, false) // childId 7 is left 8 is right
addDialogueAction(player) { player, button -> addDialogueAction(player) { player, button ->
if (button == 2) { if (button == 2) {
sendMessage(player, "You break the wax seal and open the scroll."); sendMessage(player, "You break the wax seal and open the scroll.")
if (removeItem(player, Items.KNIGHTS_NOTES_11734)) { if (removeItem(player, Items.KNIGHTS_NOTES_11734)) {
addItem(player, Items.KNIGHTS_NOTES_11735) addItem(player, Items.KNIGHTS_NOTES_11735)
ScrollInterface.scrollSetup(player, Components.MESSAGESCROLL_220, CONTENTS) ScrollInterface.scrollSetup(player, Components.MESSAGESCROLL_220, CONTENTS)
@@ -1,7 +1,7 @@
package content.region.desert.alkharid.dialogue package content.region.desert.alkharid.dialogue
import core.game.dialogue.DialoguePlugin; import core.game.dialogue.DialoguePlugin
import core.game.dialogue.FacialExpression; import core.game.dialogue.FacialExpression
import core.game.node.entity.npc.NPC import core.game.node.entity.npc.NPC
import core.game.node.entity.player.Player import core.game.node.entity.player.Player
import core.plugin.Initializable import core.plugin.Initializable
@@ -46,7 +46,7 @@ class GemTraderDialogue (player: Player? = null): DialoguePlugin(player){
} }
10 -> when(buttonId){ 10 -> when(buttonId){
1 -> npc.openShop(player).also { stage = 1000 }; 1 -> npc.openShop(player).also { stage = 1000 }
2 -> player("No, thank you.").also{stage = 1000} 2 -> player("No, thank you.").also{stage = 1000}
3 -> npc("Fitzharmon, eh? Hmmm... If I'm not mistaken, ", 3 -> npc("Fitzharmon, eh? Hmmm... If I'm not mistaken, ",
"that's the family name of a member ", "that's the family name of a member ",
@@ -54,7 +54,7 @@ class GemTraderDialogue (player: Player? = null): DialoguePlugin(player){
} }
20 -> when(buttonId){ 20 -> when(buttonId){
1 -> npc.openShop(player).also { stage = 1000 }; 1 -> npc.openShop(player).also { stage = 1000 }
2 -> player("No, thank you.").also{stage = 1000} 2 -> player("No, thank you.").also{stage = 1000}
} }
@@ -73,8 +73,8 @@ class GemTraderDialogue (player: Player? = null): DialoguePlugin(player){
"high standards of 'gold perfection', then...").also{stage++} "high standards of 'gold perfection', then...").also{stage++}
103 -> npc("Well, maybe we'll all get lucky ", 103 -> npc("Well, maybe we'll all get lucky ",
"and the scorpions will deal with him.").also{ "and the scorpions will deal with him.").also{
stage = 1000; stage = 1000
player.questRepository.getQuest("Family Crest").setStage(player, 13) player.questRepository.getQuest("Family Crest").setStage(player, 13)
} }
1000 -> end() 1000 -> end()
@@ -2,8 +2,8 @@ package content.region.desert.alkharid.dialogue
import core.api.animate import core.api.animate
import core.api.getStatLevel import core.api.getStatLevel
import core.game.dialogue.DialoguePlugin; import core.game.dialogue.DialoguePlugin
import core.game.dialogue.FacialExpression; import core.game.dialogue.FacialExpression
import core.game.dialogue.Topic import core.game.dialogue.Topic
import core.game.node.entity.npc.NPC import core.game.node.entity.npc.NPC
import core.game.node.entity.player.Player import core.game.node.entity.player.Player
@@ -1,4 +1,4 @@
package content.region.desert.alkharid.handlers; package content.region.desert.alkharid.handlers
import core.api.* import core.api.*
import core.cache.def.impl.SceneryDefinition import core.cache.def.impl.SceneryDefinition
@@ -30,7 +30,7 @@ class AlKharidStairsPlugin : OptionHandler() {
if(node.location == zekeDoorOpened.location || node.location == craftingDoorOpened.location){ if(node.location == zekeDoorOpened.location || node.location == craftingDoorOpened.location){
sendMessage(player,"This door appears to be stuck open.") sendMessage(player,"This door appears to be stuck open.")
} else{ } else{
core.game.global.action.DoorActionHandler.handleDoor(player,node.asScenery()) DoorActionHandler.handleDoor(player,node.asScenery())
} }
return true return true
} }
@@ -12,18 +12,18 @@ import org.rs09.consts.NPCs
*/ */
@Initializable @Initializable
class Nkuku(player: Player? = null) : core.game.dialogue.DialoguePlugin(player){ class Nkuku(player: Player? = null) : DialoguePlugin(player){
override fun open(vararg args: Any?): Boolean { override fun open(vararg args: Any?): Boolean {
npc = args[0] as NPC npc = args[0] as NPC
player(core.game.dialogue.FacialExpression.FRIENDLY,"Good day to you.").also { stage = 0 } player(FacialExpression.FRIENDLY,"Good day to you.").also { stage = 0 }
return true return true
} }
override fun handle(interfaceId: Int, buttonId: Int): Boolean { override fun handle(interfaceId: Int, buttonId: Int): Boolean {
when(stage){ when(stage){
0 -> { 0 -> {
npc(core.game.dialogue.FacialExpression.FRIENDLY, "May Saradomin be with you.").also { stage = 99 } npc(FacialExpression.FRIENDLY, "May Saradomin be with you.").also { stage = 99 }
} }
99 -> end() 99 -> end()
@@ -31,7 +31,7 @@ class Nkuku(player: Player? = null) : core.game.dialogue.DialoguePlugin(player){
return true return true
} }
override fun newInstance(player: Player?): core.game.dialogue.DialoguePlugin { override fun newInstance(player: Player?): DialoguePlugin {
return Nkuku(player) return Nkuku(player)
} }
@@ -11,35 +11,35 @@ import core.plugin.Initializable
*/ */
@Initializable @Initializable
class AliTheHagDialogue(player: Player? = null) : core.game.dialogue.DialoguePlugin(player){ class AliTheHagDialogue(player: Player? = null) : DialoguePlugin(player){
override fun open(vararg args: Any?): Boolean { override fun open(vararg args: Any?): Boolean {
npc = args[0] as NPC npc = args[0] as NPC
player(core.game.dialogue.FacialExpression.FRIENDLY,"Good day, old hag.") player(FacialExpression.FRIENDLY,"Good day, old hag.")
stage = 0 stage = 0
return true return true
} }
override fun handle(interfaceId: Int, buttonId: Int): Boolean { override fun handle(interfaceId: Int, buttonId: Int): Boolean {
when(stage){ when(stage){
0 -> npc(core.game.dialogue.FacialExpression.LAUGH,"Old hag indeed! I have a name you know!").also { stage++ } 0 -> npc(FacialExpression.LAUGH,"Old hag indeed! I have a name you know!").also { stage++ }
1 -> player(core.game.dialogue.FacialExpression.THINKING,"Let me guess it wouldn't be Ali would it?").also { stage++ } 1 -> player(FacialExpression.THINKING,"Let me guess it wouldn't be Ali would it?").also { stage++ }
2 -> npc(core.game.dialogue.FacialExpression.ANNOYED,"Well how else would you abbreviate Alice then?", "And no, you can't call me Al!").also { stage++ } 2 -> npc(FacialExpression.ANNOYED,"Well how else would you abbreviate Alice then?", "And no, you can't call me Al!").also { stage++ }
3 -> npc( 3 -> npc(
core.game.dialogue.FacialExpression.ASKING,"Now what do you want from the Old hag of Pollnivneach?", FacialExpression.ASKING,"Now what do you want from the Old hag of Pollnivneach?",
"To hex someone? Power, beauty, eternal youth", "or something else drab like that?").also { stage++ } "To hex someone? Power, beauty, eternal youth", "or something else drab like that?").also { stage++ }
4 -> player(core.game.dialogue.FacialExpression.HALF_GUILTY,"Actually none of those, I'm new in town and", "I just wanted to get to know the locals.").also { stage++ } 4 -> player(FacialExpression.HALF_GUILTY,"Actually none of those, I'm new in town and", "I just wanted to get to know the locals.").also { stage++ }
5 -> npc( 5 -> npc(
core.game.dialogue.FacialExpression.ANNOYED,"I'm busy brewing potions, so if you ", FacialExpression.ANNOYED,"I'm busy brewing potions, so if you ",
"disturb me again without reason,","I will turn you into a frog!").also { stage++ } "disturb me again without reason,","I will turn you into a frog!").also { stage++ }
6 -> player(core.game.dialogue.FacialExpression.SCARED,"Oh I'm sorry I won't let it happen again.").also { stage = 99 } 6 -> player(FacialExpression.SCARED,"Oh I'm sorry I won't let it happen again.").also { stage = 99 }
99 -> end() 99 -> end()
} }
return true return true
} }
override fun newInstance(player: Player?): core.game.dialogue.DialoguePlugin { override fun newInstance(player: Player?): DialoguePlugin {
return AliTheHagDialogue(player) return AliTheHagDialogue(player)
} }
@@ -11,12 +11,12 @@ import core.plugin.Initializable
*/ */
@Initializable @Initializable
class AliTheMayorDialogue(player: Player? = null) : core.game.dialogue.DialoguePlugin(player){ class AliTheMayorDialogue(player: Player? = null) : DialoguePlugin(player){
override fun open(vararg args: Any?): Boolean { override fun open(vararg args: Any?): Boolean {
npc = args[0] as NPC npc = args[0] as NPC
npc( npc(
core.game.dialogue.FacialExpression.FRIENDLY,"Welcome adventurer to the town of Pollnivneach,", FacialExpression.FRIENDLY,"Welcome adventurer to the town of Pollnivneach,",
"the gateway to Menaphos and Al-Kharid. My name is Ali", "the gateway to Menaphos and Al-Kharid. My name is Ali",
"and I'm the mayor of this town.", "and I'm the mayor of this town.",
"I hope you enjoy your stay here.") "I hope you enjoy your stay here.")
@@ -27,21 +27,21 @@ class AliTheMayorDialogue(player: Player? = null) : core.game.dialogue.DialogueP
override fun handle(interfaceId: Int, buttonId: Int): Boolean { override fun handle(interfaceId: Int, buttonId: Int): Boolean {
when(stage){ when(stage){
0 -> player( 0 -> player(
core.game.dialogue.FacialExpression.FRIENDLY, "Thank you.", FacialExpression.FRIENDLY, "Thank you.",
"That is the warmest welcome I've had anywhere", "That is the warmest welcome I've had anywhere",
"for a while at least. People generally treat", "for a while at least. People generally treat",
"travelling adventurers with suspicion.").also { stage++ } "travelling adventurers with suspicion.").also { stage++ }
1 -> npc( 1 -> npc(
core.game.dialogue.FacialExpression.FRIENDLY,"All are welcome here, such is the way", FacialExpression.FRIENDLY,"All are welcome here, such is the way",
"of things in border regions.", "of things in border regions.",
"Now more than ever I suppose.").also { stage++ } "Now more than ever I suppose.").also { stage++ }
2 -> player(core.game.dialogue.FacialExpression.FRIENDLY,"What do you mean by that?").also { stage++ } 2 -> player(FacialExpression.FRIENDLY,"What do you mean by that?").also { stage++ }
3 -> npc(core.game.dialogue.FacialExpression.FRIENDLY,"There's trouble in town, and a lot of ", "villagers have left as a result.").also { stage++ } 3 -> npc(FacialExpression.FRIENDLY,"There's trouble in town, and a lot of ", "villagers have left as a result.").also { stage++ }
4 -> player(core.game.dialogue.FacialExpression.FRIENDLY,"I'm looking for someone called Ali.").also { stage++ } 4 -> player(FacialExpression.FRIENDLY,"I'm looking for someone called Ali.").also { stage++ }
5 -> npc(core.game.dialogue.FacialExpression.FRIENDLY,"I doubt that's easy in Pollnivneach.").also { stage++ } 5 -> npc(FacialExpression.FRIENDLY,"I doubt that's easy in Pollnivneach.").also { stage++ }
6 -> player(core.game.dialogue.FacialExpression.FRIENDLY,"Well can you help me?").also { stage++ } 6 -> player(FacialExpression.FRIENDLY,"Well can you help me?").also { stage++ }
7 -> npc( 7 -> npc(
core.game.dialogue.FacialExpression.FRIENDLY,"I'm more than a little busy at the moment, ", FacialExpression.FRIENDLY,"I'm more than a little busy at the moment, ",
"I'm sure there are plenty of people ", "in town who could help you.").also { stage = 99 } "I'm sure there are plenty of people ", "in town who could help you.").also { stage = 99 }
99 -> end() 99 -> end()
@@ -49,7 +49,7 @@ class AliTheMayorDialogue(player: Player? = null) : core.game.dialogue.DialogueP
return true return true
} }
override fun newInstance(player: Player?): core.game.dialogue.DialoguePlugin { override fun newInstance(player: Player?): DialoguePlugin {
return AliTheMayorDialogue(player) return AliTheMayorDialogue(player)
} }

Some files were not shown because too many files have changed in this diff Show More