Merge remote-tracking branch 'origin/master'

This commit is contained in:
Woah
2021-03-12 23:59:11 -05:00
14 changed files with 348 additions and 452 deletions
@@ -1,22 +1,17 @@
package rs09.game.content.activity.allfiredup package rs09.game.content.activity.allfiredup
import core.cache.def.impl.ObjectDefinition
import core.game.content.dialogue.FacialExpression import core.game.content.dialogue.FacialExpression
import core.game.interaction.OptionHandler
import core.game.node.Node
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.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
import core.game.world.update.flag.context.Animation import core.game.world.update.flag.context.Animation
import core.plugin.Initializable
import core.plugin.Plugin
import org.rs09.consts.Items import org.rs09.consts.Items
import rs09.game.interaction.OptionListener
import rs09.game.world.GameWorld import rs09.game.world.GameWorld
private val VALID_LOGS = arrayOf(Items.LOGS_1511, private val VALID_LOGS = intArrayOf(Items.LOGS_1511, Items.OAK_LOGS_1521,Items.WILLOW_LOGS_1519,Items.MAPLE_LOGS_1517,Items.YEW_LOGS_1515,Items.MAGIC_LOGS_1513)
Items.OAK_LOGS_1521,Items.WILLOW_LOGS_1519,Items.MAPLE_LOGS_1517,Items.YEW_LOGS_1515,Items.MAGIC_LOGS_1513)
private val FILL_ANIM = Animation(9136) private val FILL_ANIM = Animation(9136)
private val LIGHT_ANIM = Animation(7307) private val LIGHT_ANIM = Animation(7307)
@@ -24,20 +19,10 @@ private val LIGHT_ANIM = Animation(7307)
* Handles interactions for beacons * Handles interactions for beacons
* @author Ceikry * @author Ceikry
*/ */
@Initializable class AFUBeaconListeners : OptionListener(){
class AFUBeaconHandler : OptionHandler(){
override fun newInstance(arg: Any?): Plugin<Any> {
for(i in 38448..38461)
ObjectDefinition.forId(i).childrenIds.forEach {
ObjectDefinition.forId(it).handlers["option:add-logs"] = this
ObjectDefinition.forId(it).handlers["option:light"] = this
}
return this
}
override fun handle(player: Player?, node: Node?, option: String?): Boolean { override fun defineListeners() {
player ?: return false on(OBJECT,"add-logs","light"){player,node ->
node ?: return false
val beacon = 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")
@@ -46,7 +31,7 @@ class AFUBeaconHandler : OptionHandler(){
|| (beacon == AFUBeacon.RIVER_SALVE && questStage < 20 && !questComplete) || (beacon == AFUBeacon.RIVER_SALVE && questStage < 20 && !questComplete)
|| (beacon == AFUBeacon.RAG_AND_BONE && questStage < 50 && !questComplete)) { || (beacon == AFUBeacon.RAG_AND_BONE && questStage < 50 && !questComplete)) {
player.dialogueInterpreter.sendDialogues(player, FacialExpression.THINKING, "I probably shouldn't mess with this.") player.dialogueInterpreter.sendDialogues(player, FacialExpression.THINKING, "I probably shouldn't mess with this.")
return true return@on true
} }
player.debug(beacon.getState(player).name) player.debug(beacon.getState(player).name)
@@ -61,7 +46,8 @@ class AFUBeaconHandler : OptionHandler(){
player.debug("INVALID BEACON STATE") player.debug("INVALID BEACON STATE")
} }
} }
return true return@on true
}
} }
fun fillBeacon(player: Player, beacon: AFUBeacon, questComplete: Boolean){ fun fillBeacon(player: Player, beacon: AFUBeacon, questComplete: Boolean){
@@ -1,8 +1,5 @@
package rs09.game.content.activity.allfiredup package rs09.game.content.activity.allfiredup
import core.cache.def.impl.ObjectDefinition
import core.game.interaction.OptionHandler
import core.game.node.Node
import core.game.node.entity.impl.ForceMovement import core.game.node.entity.impl.ForceMovement
import core.game.node.entity.player.Player import core.game.node.entity.player.Player
import core.game.node.entity.skill.Skills import core.game.node.entity.skill.Skills
@@ -12,8 +9,8 @@ import core.game.world.map.Direction
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
import core.plugin.Initializable import core.plugin.Initializable
import core.plugin.Plugin
import org.rs09.consts.Items import org.rs09.consts.Items
import rs09.game.interaction.OptionListener
import java.util.* import java.util.*
/** /**
@@ -21,27 +18,27 @@ import java.util.*
* @author Ceikry * @author Ceikry
*/ */
@Initializable @Initializable
class AFURepairClimbHandler : OptionHandler() { class AFURepairClimbHandler : OptionListener() {
override fun newInstance(arg: Any?): Plugin<Any> {
ObjectDefinition.forId(38480).handlers["option:repair"] = this
ObjectDefinition.forId(38470).handlers["option:repair"] = this
ObjectDefinition.forId(38494).handlers["option:repair"] = this
ObjectDefinition.forId(38469).handlers["option:climb"] = this
ObjectDefinition.forId(38471).handlers["option:climb"] = this
ObjectDefinition.forId(38486).handlers["option:climb"] = this
ObjectDefinition.forId(38481).handlers["option:climb"] = this
ObjectDefinition.forId(38469).handlers["option:climb"] = this
return this
}
override fun handle(player: Player?, node: Node?, option: String?): Boolean { val repairIDs = intArrayOf(38480,38470,38494)
player ?: return false val climbIDs = intArrayOf(38469,38471,38486,38481,38469)
node ?: return false
override fun defineListeners() {
on(repairIDs,OBJECT,"repair"){player,_ ->
var rco: RepairClimbObject = RepairClimbObject.GWD var rco: RepairClimbObject = RepairClimbObject.GWD
for(ent in RepairClimbObject.values()) if(ent.destinationDown?.withinDistance(player.location,2) == true || ent.destinationUp?.withinDistance(player.location,2) == true) rco = ent for(ent in RepairClimbObject.values()) if(ent.destinationDown?.withinDistance(player.location,2) == true || ent.destinationUp?.withinDistance(player.location,2) == true) rco = ent
repair(player,rco)
return@on true
}
on(climbIDs,OBJECT,"climb"){player,node ->
var rco: RepairClimbObject = RepairClimbObject.GWD
for(ent in RepairClimbObject.values()) if(ent.destinationDown?.withinDistance(player.location,2) == true || ent.destinationUp?.withinDistance(player.location,2) == true) rco = ent
climb(player,rco,node.location)
return@on true
}
if(option.equals("repair")) repair(player,rco) else climb(player,rco,node.location)
return true
} }
private fun repair(player: Player,rco: RepairClimbObject){ private fun repair(player: Player,rco: RepairClimbObject){
@@ -1,12 +1,8 @@
package rs09.game.content.activity.fishingtrawler package rs09.game.content.activity.fishingtrawler
import core.cache.def.impl.ItemDefinition
import core.cache.def.impl.ObjectDefinition
import core.game.content.activity.ActivityManager import core.game.content.activity.ActivityManager
import core.game.content.dialogue.DialoguePlugin import core.game.content.dialogue.DialoguePlugin
import core.game.content.dialogue.FacialExpression import core.game.content.dialogue.FacialExpression
import core.game.interaction.OptionHandler
import core.game.node.Node
import core.game.node.entity.player.Player import core.game.node.entity.player.Player
import core.game.node.entity.skill.Skills import core.game.node.entity.skill.Skills
import core.game.node.item.GroundItemManager import core.game.node.item.GroundItemManager
@@ -15,8 +11,8 @@ 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
import core.plugin.Initializable import core.plugin.Initializable
import core.plugin.Plugin
import org.rs09.consts.Items import org.rs09.consts.Items
import rs09.game.interaction.OptionListener
import rs09.game.node.entity.player.info.stats.FISHING_TRAWLER_LEAKS_PATCHED import rs09.game.node.entity.player.info.stats.FISHING_TRAWLER_LEAKS_PATCHED
import rs09.game.node.entity.player.info.stats.STATS_BASE import rs09.game.node.entity.player.info.stats.STATS_BASE
import rs09.tools.stringtools.colorize import rs09.tools.stringtools.colorize
@@ -27,36 +23,40 @@ import kotlin.math.ceil
* @author Ceikry * @author Ceikry
*/ */
@Initializable @Initializable
class FishingTrawlerOptionHandler : OptionHandler() { class FishingTrawlerOptionHandler : OptionListener() {
override fun newInstance(arg: Any?): Plugin<Any> { val ENTRANCE_PLANK = 2178
ObjectDefinition.forId(2178).handlers["option:cross"] = this val EXIT_PLANK = 2179
ObjectDefinition.forId(2167).handlers["option:fill"] = this val HOLE = 2167
ObjectDefinition.forId(2164).handlers["option:inspect"] = this val NETIDs = intArrayOf(2164,2165)
ObjectDefinition.forId(2165).handlers["option:inspect"] = this val REWARD_NET = 2166
ObjectDefinition.forId(2166).handlers["option:inspect"] = this val BARREL_IDS = intArrayOf(2159,2160)
ObjectDefinition.forId(2160).handlers["option:climb-on"] = this val BAILING_BUCKET = 583
ObjectDefinition.forId(2159).handlers["option:climb-on"] = this val FULL_BAIL_BUCKET = 585
ObjectDefinition.forId(2179).handlers["option:cross"] = this
ObjectDefinition.forId(255).handlers["option:operate"] = this
ItemDefinition.forId(583).handlers["option:bail-with"] = this
ItemDefinition.forId(585).handlers["option:empty"] = this
return this
}
override fun handle(player: Player?, node: Node?, option: String?): Boolean { override fun defineListeners() {
player ?: return false
when(node?.id){ on(ENTRANCE_PLANK,OBJECT,"cross"){player,_ ->
2178 -> { //Cross plank onto boat
if(player.skills.getLevel(Skills.FISHING) < 15){ if(player.skills.getLevel(Skills.FISHING) < 15){
player.dialogueInterpreter.sendDialogue("You need to be at least level 15 fishing to play.") player.dialogueInterpreter.sendDialogue("You need to be at least level 15 fishing to play.")
return true return@on true
} }
player.properties.teleportLocation = Location.create(2672, 3170, 1) player.properties.teleportLocation = Location.create(2672, 3170, 1)
(ActivityManager.getActivity("fishing trawler") as FishingTrawlerActivity).addPlayer(player) (ActivityManager.getActivity("fishing trawler") as FishingTrawlerActivity).addPlayer(player)
return@on true
} }
2167 -> { //Fill hole
on(EXIT_PLANK,OBJECT,"cross"){player,_ ->
player.properties.teleportLocation = Location.create(2676, 3170, 0)
(ActivityManager.getActivity("fishing trawler") as FishingTrawlerActivity).removePlayer(player)
val session: FishingTrawlerSession? = player.getAttribute("ft-session",null) val session: FishingTrawlerSession? = player.getAttribute("ft-session",null)
session ?: return false session?.players?.remove(player)
player.logoutPlugins.clear()
return@on true
}
on(HOLE,OBJECT,"fill"){player,node ->
val session: FishingTrawlerSession? = player.getAttribute("ft-session",null)
session ?: return@on false
player.lock() player.lock()
player.pulseManager.run(object : Pulse(){ player.pulseManager.run(object : Pulse(){
var counter = 0 var counter = 0
@@ -69,41 +69,64 @@ class FishingTrawlerOptionHandler : OptionHandler() {
return false return false
} }
}) })
return@on true
} }
2164,2165 -> { //inspect net
on(NETIDs,OBJECT,"inspect"){player,_ ->
player.dialogueInterpreter.open(18237583) player.dialogueInterpreter.open(18237583)
return@on true
} }
2166 -> { //inspect reward net
on(REWARD_NET,OBJECT,"inspect"){player,_ ->
val session: FishingTrawlerSession? = player.getAttribute("ft-session",null) val session: FishingTrawlerSession? = player.getAttribute("ft-session",null)
if(session == null || session.boatSank){ if(session == null || session.boatSank){
player.dialogueInterpreter.sendDialogues(player, FacialExpression.GUILTY,"I'd better not go stealing other people's fish.") player.dialogueInterpreter.sendDialogues(player, FacialExpression.GUILTY,"I'd better not go stealing other people's fish.")
return true return@on true
} }
player.dialogueInterpreter.open(18237582) player.dialogueInterpreter.open(18237582)
return@on true
} }
2179 -> { //plank from boat to dock
player.properties.teleportLocation = Location.create(2676, 3170, 0) on(BARREL_IDS,OBJECT,"climb-on"){player,_ ->
(ActivityManager.getActivity("fishing trawler") as FishingTrawlerActivity).removePlayer(player)
val session: FishingTrawlerSession? = player.getAttribute("ft-session",null)
session?.players?.remove(player)
player.logoutPlugins.clear()
}
2159,2160 -> { //barrel
player.properties.teleportLocation = Location.create(2672, 3222, 0) player.properties.teleportLocation = Location.create(2672, 3222, 0)
player.dialogueInterpreter.sendDialogue("You climb onto the floating barrel and begin to kick your way to the","shore.","You make it to the shore tired and weary.") player.dialogueInterpreter.sendDialogue("You climb onto the floating barrel and begin to kick your way to the","shore.","You make it to the shore tired and weary.")
player.logoutPlugins.clear() player.logoutPlugins.clear()
player.appearance.setDefaultAnimations() player.appearance.setDefaultAnimations()
player.appearance.sync() player.appearance.sync()
return@on true
}
on(FULL_BAIL_BUCKET,ITEM,"empty"){player,node ->
player.lock()
player.pulseManager.run(
object : Pulse(){
var counter = 0
override fun pulse(): Boolean {
when(counter++){
0 -> player.animator.animate(Animation(2450))
1 -> {
if(player.inventory.remove(node.asItem()))
player.inventory.add(Item(Items.BAILING_BUCKET_583))
player.unlock()
return true
}
} }
583 -> { //bail-with bucket
val session: FishingTrawlerSession? = player.getAttribute("ft-session",null)
session ?: return false
if(!session.isActive){
return false return false
} }
}
)
return@on true
}
on(BAILING_BUCKET,ITEM,"bail-with") { player, node ->
val session: FishingTrawlerSession? = player.getAttribute("ft-session",null)
session ?: return@on false
if(!session.isActive){
return@on false
}
if(player.location.y > 0){ if(player.location.y > 0){
player.sendMessage("You can't scoop water out up here.") player.sendMessage("You can't scoop water out up here.")
return true return@on true
} }
player.lock() player.lock()
player.pulseManager.run( player.pulseManager.run(
@@ -128,34 +151,9 @@ class FishingTrawlerOptionHandler : OptionHandler() {
} }
} }
) )
} return@on true
585 -> { //Empty bailing bucket
player.lock()
player.pulseManager.run(
object : Pulse(){
var counter = 0
override fun pulse(): Boolean {
when(counter++){
0 -> player.animator.animate(Animation(2450))
1 -> {
if(player.inventory.remove(node.asItem()))
player.inventory.add(Item(Items.BAILING_BUCKET_583))
player.unlock()
return true
} }
} }
return false
}
}
)
}
255 -> {//operate winch
player.sendMessage("It seems the winch is jammed - I can't move it.")
}
}
return true
}
} }
@Initializable @Initializable
@@ -1,4 +1,4 @@
package core.plugin.quest.fremtrials package rs09.game.content.quest.members.thefremenniktrials
import core.game.content.dialogue.FacialExpression import core.game.content.dialogue.FacialExpression
import core.game.content.quest.PluginInteraction import core.game.content.quest.PluginInteraction
@@ -0,0 +1,32 @@
package rs09.game.interaction.city
import core.game.world.map.Location
import core.plugin.Initializable
import rs09.game.interaction.OptionListener
/**
* File to be used for anything Isafdar related.
* Handles the summoning/altar cave enter and exit in Isafdar.
* @author Sir Kermit
*/
@Initializable
class IsafdarListeners : OptionListener() {
val CAVE_ENTRANCE = 4006
val CAVE_EXIT = 4007
val outside = Location.create(2312, 3217, 0)
val inside = Location.create(2314, 9624, 0)
override fun defineListeners() {
on(CAVE_ENTRANCE,OBJECT,"enter"){player,node ->
player.teleport(inside)
return@on true
}
on(CAVE_EXIT,OBJECT,"exit"){player,node ->
player.teleport(outside)
return@on true
}
}
}
@@ -1,58 +0,0 @@
package rs09.game.interaction.city
import core.cache.def.impl.ObjectDefinition
import core.game.interaction.OptionHandler
import core.game.node.Node
import core.game.node.`object`.GameObject
import core.game.node.entity.player.Player
import core.game.world.map.Location
import core.plugin.Initializable
import core.plugin.Plugin
/**
* File to be used for anything Isafdar related.
* Handles the summoning/altar cave enter and exit in Isafdar.
* @author Sir Kermit
*/
@Initializable
class IsafdarPlugin : OptionHandler() {
@Throws(Throwable::class)
override fun newInstance(arg: Any?): Plugin<Any?> {
//Outside Cave
ObjectDefinition.forId(4006).handlers["option:enter"] = this
//Inside Cave
ObjectDefinition.forId(4007).handlers["option:exit"] = this
return this
}
override fun handle(player: Player, node: Node, option: String): Boolean {
val id = (node as GameObject).id
val outside = Location.create(2312, 3217, 0)
val inside = Location.create(2314, 9624, 0)
when (id) {
//Handles sending the player inside of the cave.
4006 -> {
if (node.id == 4006) {
player.teleport(inside)
return true
}
}
//Handles sending the player outside of the cave.
4007 -> {
if (node.id == 4007) {
player.teleport(outside)
return true
}
}
}
return false
}
}
@@ -0,0 +1,47 @@
package rs09.game.interaction.city
import core.game.node.entity.impl.ForceMovement
import core.game.world.map.Direction
import core.game.world.map.Location
import core.game.world.update.flag.context.Animation
import core.plugin.Initializable
import rs09.game.interaction.OptionListener
/**
* File to be used for anything Morytania related.
* Handles the summoning/altar cave enter and exit in Morytania.
* @author Sir Kermit
*/
@Initializable
class MorytaniaListeners : OptionListener() {
val GROTTO_ENTRANCE = 3516
val GROTTO_EXIT = 3526
val GROTTO_BRIDGE = 3522
val outside = Location.create(3439, 3337, 0)
val inside = Location.create(3442, 9734, 1)
private val RUNNING_ANIM = Animation(1995)
private val JUMP_ANIM = Animation(1603)
override fun defineListeners() {
on(GROTTO_ENTRANCE,OBJECT,"enter"){player,node ->
player.teleport(inside)
return@on true
}
on(GROTTO_EXIT,OBJECT,"exit"){player,node ->
player.teleport(outside)
return@on true
}
on(GROTTO_BRIDGE,OBJECT,"jump"){player,node ->
if (player.location.y == 3328) {
ForceMovement.run(player, node.location, node.location.transform(0, 3, 0), RUNNING_ANIM, JUMP_ANIM, Direction.NORTH, 15).endAnimation = Animation.RESET
} else if (player.location.y == 3332){
ForceMovement.run(player, node.location, node.location.transform(0, -3, 0), RUNNING_ANIM, JUMP_ANIM, Direction.SOUTH, 15).endAnimation = Animation.RESET
}
return@on true
}
}
}
@@ -1,67 +0,0 @@
package rs09.game.interaction.city
import core.cache.def.impl.ObjectDefinition
import core.game.interaction.OptionHandler
import core.game.node.Node
import core.game.node.`object`.GameObject
import core.game.node.entity.impl.ForceMovement
import core.game.node.entity.player.Player
import core.game.world.map.Direction
import core.game.world.map.Location
import core.game.world.update.flag.context.Animation
import core.plugin.Initializable
import core.plugin.Plugin
/**
* File to be used for anything Morytania related.
* Handles the summoning/altar cave enter and exit in Morytania.
* @author Sir Kermit
*/
@Initializable
class MorytaniaPlugin : OptionHandler() {
@Throws(Throwable::class)
override fun newInstance(arg: Any?): Plugin<Any?> {
//Outside Grotto
ObjectDefinition.forId(3516).handlers["option:enter"] = this
//Inside Grotto
ObjectDefinition.forId(3526).handlers["option:exit"] = this
//Bridge Outside Grotto
ObjectDefinition.forId(3522).handlers["option:jump"] = this
return this
}
private val RUNNING_ANIM = Animation(1995)
private val JUMP_ANIM = Animation(1603)
override fun handle(player: Player, node: Node, option: String): Boolean {
val id = (node as GameObject).id
val outside = Location.create(3439, 3337, 0)
val inside = Location.create(3442, 9734, 1)
when (id) {
//Handles sending the player inside of the cave.
3516 -> {
if (node.id == 3516) {
player.teleport(inside)
return true
}
}
//Handles sending the player outside of the cave.
3526 -> {
if (node.id == 3526) {
player.teleport(outside)
return true
}
}
//Handles Jumping over grotto bridge
3522 -> if (player.location.y == 3328) {
ForceMovement.run(player, node.location, node.location.transform(0, 3, 0), RUNNING_ANIM, JUMP_ANIM, Direction.NORTH, 15).endAnimation = Animation.RESET
} else if (player.location.y == 3332){
ForceMovement.run(player, node.location, node.location.transform(0, -3, 0), RUNNING_ANIM, JUMP_ANIM, Direction.SOUTH, 15).endAnimation = Animation.RESET
}
}
return false
}
}
@@ -1,32 +1,23 @@
package rs09.game.interaction.item package rs09.game.interaction.item
import core.cache.def.impl.ItemDefinition import rs09.game.interaction.OptionListener
import core.game.interaction.OptionHandler
import core.game.node.Node
import core.game.node.entity.player.Player
import core.plugin.Initializable
import core.plugin.Plugin
/** /**
* Handles the bracelet of clay operate option. * Handles the bracelet of clay operate option.
* @author Ceikry * @author Ceikry
*/ */
@Initializable class BraceletOfClayPlugin : OptionListener() {
class BraceletOfClayPlugin : OptionHandler() {
override fun newInstance(arg: Any?): Plugin<Any>? { val BRACELET = 11074
ItemDefinition.forId(11074).handlers["option:operate"] = this
return this
}
override fun handle(player: Player, node: Node, option: String): Boolean { override fun defineListeners() {
on(BRACELET,ITEM,"operate"){player,node ->
var charge = node.asItem().charge var charge = node.asItem().charge
if (charge > 28) charge = 28 if (charge > 28) charge = 28
player.sendMessage("You have $charge uses left.") player.sendMessage("You have $charge uses left.")
return true return@on true
} }
override fun isWalk(): Boolean {
return false
} }
} }
@@ -1,28 +1,19 @@
package rs09.game.interaction.`object` package rs09.game.interaction.`object`
import core.cache.def.impl.ObjectDefinition
import core.game.interaction.OptionHandler
import core.game.node.Node
import core.game.node.entity.player.Player
import core.game.node.entity.player.link.diary.DiaryType import core.game.node.entity.player.link.diary.DiaryType
import core.game.node.entity.player.link.emote.Emotes import core.game.node.entity.player.link.emote.Emotes
import core.game.world.map.RegionManager import core.game.world.map.RegionManager
import core.plugin.Initializable import rs09.game.interaction.OptionListener
import core.plugin.Plugin
@Initializable
/** /**
* Handles taunting of the demon in the wizard's tower * Handles taunting of the demon in the wizard's tower
* @author afaroutdude / Ceikry * @author afaroutdude / Ceikry
*/ */
class DemonTauntHandler : OptionHandler(){ private const val BARS = 37668
override fun newInstance(arg: Any?): Plugin<Any> { class DemonTauntHandler : OptionListener(){
ObjectDefinition.forId(37668).handlers["option:taunt-through"] = this
return this
}
override fun handle(player: Player?, node: Node?, option: String?): Boolean { override fun defineListeners() {
player ?: return false on(BARS,OBJECT,"taunt-through"){player,_ ->
player.packetDispatch.sendMessage("You taunt the demon, making it growl.") player.packetDispatch.sendMessage("You taunt the demon, making it growl.")
val localNpcs = RegionManager.getLocalNpcs(player) val localNpcs = RegionManager.getLocalNpcs(player)
player.animator.animate(Emotes.RASPBERRY.animation) player.animator.animate(Emotes.RASPBERRY.animation)
@@ -33,6 +24,8 @@ class DemonTauntHandler : OptionHandler(){
} }
} }
player.achievementDiaryManager.finishTask(player, DiaryType.LUMBRIDGE, 1, 13) player.achievementDiaryManager.finishTask(player, DiaryType.LUMBRIDGE, 1, 13)
return true return@on true
}
} }
} }
@@ -1,14 +1,10 @@
package rs09.game.interaction.`object` package rs09.game.interaction.`object`
import core.cache.def.impl.ObjectDefinition
import core.game.component.Component import core.game.component.Component
import core.game.interaction.OptionHandler
import core.game.node.Node
import core.game.node.entity.player.Player import core.game.node.entity.player.Player
import core.game.node.entity.player.link.TeleportManager.TeleportType import core.game.node.entity.player.link.TeleportManager.TeleportType
import core.game.world.map.Location import core.game.world.map.Location
import core.plugin.Initializable import rs09.game.interaction.OptionListener
import core.plugin.Plugin
/** /**
* Handles interactions with fairy rings * Handles interactions with fairy rings
@@ -19,30 +15,28 @@ private val RINGS = intArrayOf(12003, 12094, 12095, 14058, 14061, 14064, 14067,
private const val MAIN_RING = 12128 private const val MAIN_RING = 12128
@Initializable class FairyRingPlugin : OptionListener() {
class FairyRingPlugin : OptionHandler() {
override fun newInstance(arg: Any?): Plugin<Any> {
for (i in RINGS) {
ObjectDefinition.forId(i).handlers["option:use"] = this
}
ObjectDefinition.forId(MAIN_RING).handlers["option:use"] = this
return this
}
override fun handle(player: Player, node: Node, option: String): Boolean { override fun defineListeners() {
when (option) {
"use" -> { on(RINGS,OBJECT,"use"){player,_ ->
if (!player.equipment.contains(772, 1) && !player.equipment.contains(9084, 1)) { if (!player.equipment.contains(772, 1) && !player.equipment.contains(9084, 1)) {
player.sendMessage("The fairy ring only works for those who wield fairy magic.") player.sendMessage("The fairy ring only works for those who wield fairy magic.")
return true return@on true
} }
when (node.id) { player.teleporter.send(Location.create(2412, 4434, 0), TeleportType.FAIRY_RING)
MAIN_RING -> openFairyRing(player) return@on true
else -> player.teleporter.send(Location.create(2412, 4434, 0), TeleportType.FAIRY_RING)
} }
on(MAIN_RING,OBJECT,"use"){player,_ ->
if (!player.equipment.contains(772, 1) && !player.equipment.contains(9084, 1)) {
player.sendMessage("The fairy ring only works for those who wield fairy magic.")
return@on true
} }
openFairyRing(player)
return@on true
} }
return true
} }
private fun reset(player: Player) { private fun reset(player: Player) {
@@ -1,8 +1,5 @@
package rs09.game.interaction.`object` package rs09.game.interaction.`object`
import core.cache.def.impl.ObjectDefinition
import core.game.interaction.OptionHandler
import core.game.node.Node
import core.game.node.`object`.GameObject import core.game.node.`object`.GameObject
import core.game.node.`object`.ObjectBuilder import core.game.node.`object`.ObjectBuilder
import core.game.node.entity.npc.NPC import core.game.node.entity.npc.NPC
@@ -11,24 +8,22 @@ import core.game.node.item.GroundItemManager
import core.game.node.item.Item import core.game.node.item.Item
import core.game.system.task.Pulse import core.game.system.task.Pulse
import core.game.world.update.flag.context.Animation import core.game.world.update.flag.context.Animation
import core.plugin.Initializable
import core.plugin.Plugin
import org.rs09.consts.Items import org.rs09.consts.Items
import rs09.game.interaction.OptionListener
import rs09.game.world.GameWorld import rs09.game.world.GameWorld
import java.util.concurrent.TimeUnit import java.util.concurrent.TimeUnit
@Initializable private const val CHEST = 2827
class GutanothChestOptionHandler : OptionHandler(){ class GutanothChestOptionHandler : OptionListener(){
override fun handle(player: Player?, node: Node?, option: String?): Boolean {
player ?: return false override fun defineListeners() {
on(CHEST,OBJECT,"open"){player,node ->
val delay = player.getAttribute("gutanoth-chest-delay", 0L) val delay = player.getAttribute("gutanoth-chest-delay", 0L)
GameWorld.Pulser.submit(ChestPulse(player,System.currentTimeMillis() > delay, node as GameObject)) GameWorld.Pulser.submit(ChestPulse(player,System.currentTimeMillis() > delay, node as GameObject))
return true return@on true
} }
override fun newInstance(arg: Any?): Plugin<Any> {
ObjectDefinition.forId(2827).handlers["option:open"] = this
return this
} }
class ChestPulse(val player: Player, val isLoot: Boolean, val chest: GameObject): Pulse(){ class ChestPulse(val player: Player, val isLoot: Boolean, val chest: GameObject): Pulse(){
@@ -1,38 +1,28 @@
package rs09.game.interaction.`object` package rs09.game.interaction.`object`
import core.cache.def.impl.ObjectDefinition
import core.game.interaction.OptionHandler
import core.game.node.Node
import core.game.node.`object`.GameObject import core.game.node.`object`.GameObject
import core.game.node.`object`.ObjectBuilder import core.game.node.`object`.ObjectBuilder
import core.game.node.entity.player.Player import core.game.node.entity.player.Player
import core.game.node.item.Item import core.game.node.item.Item
import core.game.system.task.Pulse import core.game.system.task.Pulse
import core.game.world.update.flag.context.Animation import core.game.world.update.flag.context.Animation
import core.plugin.Initializable
import core.plugin.Plugin
import org.rs09.consts.Items import org.rs09.consts.Items
import rs09.game.interaction.OptionListener
import rs09.game.world.GameWorld import rs09.game.world.GameWorld
/** /**
* Handles the chopping down of dense jungle, mainly to grant access to the Kharazi Jungle. * Handles the chopping down of dense jungle, mainly to grant access to the Kharazi Jungle.
* @author Ceikry * @author Ceikry
*/ */
@Initializable class JungleBushHandler : OptionListener(){
class JungleBushHandler : OptionHandler(){
val chopped_bush = 2895 val chopped_bush = 2895
val chop_a = Animation(910) val chop_a = Animation(910)
val chop_b = Animation(2382) val chop_b = Animation(2382)
val ids = intArrayOf(2892,2893)
override fun newInstance(arg: Any?): Plugin<Any> { override fun defineListeners() {
ObjectDefinition.forId(2892).handlers["option:chop-down"] = this
ObjectDefinition.forId(2893).handlers["option:chop-down"] = this
return this
}
override fun handle(player: Player?, node: Node?, option: String?): Boolean { on(ids,OBJECT,"chop-down"){player,node ->
player ?: return false
node ?: return false
val toChop = node.asObject() val toChop = node.asObject()
if(checkRequirement(player)){ if(checkRequirement(player)){
GameWorld.Pulser.submit(object : Pulse(0){ GameWorld.Pulser.submit(object : Pulse(0){
@@ -51,7 +41,9 @@ class JungleBushHandler : OptionHandler(){
} else { } else {
player.sendMessage("You need a machete to get through this dense jungle.") player.sendMessage("You need a machete to get through this dense jungle.")
} }
return true return@on true
}
} }
fun checkRequirement(player: Player): Boolean{ fun checkRequirement(player: Player): Boolean{
@@ -1,32 +1,26 @@
package rs09.game.interaction.`object` package rs09.game.interaction.`object`
import core.cache.def.impl.ObjectDefinition
import core.game.interaction.OptionHandler
import core.game.node.Node
import core.game.node.`object`.GameObject import core.game.node.`object`.GameObject
import core.game.node.`object`.ObjectBuilder import core.game.node.`object`.ObjectBuilder
import core.game.node.entity.player.Player
import core.game.node.item.GroundItemManager import core.game.node.item.GroundItemManager
import core.game.node.item.Item import core.game.node.item.Item
import core.game.world.update.flag.context.Animation import core.game.world.update.flag.context.Animation
import core.plugin.Initializable import core.plugin.Initializable
import core.plugin.Plugin
import org.rs09.consts.Items import org.rs09.consts.Items
import rs09.game.interaction.OptionListener
@Initializable @Initializable
/** /**
* Handles the muddy chest * Handles the muddy chest
* @author Ceikry * @author Ceikry
*/ */
class MuddyChestHandler : OptionHandler() { class MuddyChestHandler : OptionListener() {
override fun newInstance(arg: Any?): Plugin<Any> {
ObjectDefinition.forId(170).handlers["option:open"] = this
return this
}
override fun handle(player: Player?, node: Node?, option: String?): Boolean { private val CHEST = 170
player ?: return false
node ?: return false override fun defineListeners() {
on(CHEST,OBJECT,"open"){player,node ->
val key = Item(Items.MUDDY_KEY_991) val key = Item(Items.MUDDY_KEY_991)
if(player.inventory.containsItem(key)){ if(player.inventory.containsItem(key)){
player.inventory.remove(key) player.inventory.remove(key)
@@ -38,10 +32,12 @@ class MuddyChestHandler : OptionHandler() {
} else { } else {
player.sendMessage("This chest is locked and needs some sort of key.") player.sendMessage("This chest is locked and needs some sort of key.")
} }
return true return@on true
} }
val chestLoot = arrayListOf( }
val chestLoot = arrayOf(
Item(Items.UNCUT_RUBY_1619), Item(Items.UNCUT_RUBY_1619),
Item(Items.MITHRIL_BAR_2359), Item(Items.MITHRIL_BAR_2359),
Item(Items.MITHRIL_DAGGER_1209), Item(Items.MITHRIL_DAGGER_1209),