Implemented the signpost for varrock guards

This commit is contained in:
Ceikry
2021-07-04 15:02:39 +00:00
parent 368ad16469
commit ad9f817cd6
4 changed files with 51 additions and 1 deletions
@@ -245,7 +245,7 @@ public abstract class MapZone implements Zone {
/** /**
* Configures this map zone. * Configures this map zone.
*/ */
public abstract void configure(); public void configure(){};
/** /**
* Cleans items from a players inventory, equipment and bank. * Cleans items from a players inventory, equipment and bank.
+14
View File
@@ -25,6 +25,9 @@ import core.game.system.task.Pulse
import core.game.world.map.Location import core.game.world.map.Location
import core.game.world.map.RegionManager import core.game.world.map.RegionManager
import core.game.world.map.path.Pathfinder import core.game.world.map.path.Pathfinder
import core.game.world.map.zone.MapZone
import core.game.world.map.zone.ZoneBorders
import core.game.world.map.zone.ZoneBuilder
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 core.tools.RandomFunction
@@ -1022,4 +1025,15 @@ object ContentAPI {
fun sceneryDefinition(id: Int): SceneryDefinition{ fun sceneryDefinition(id: Int): SceneryDefinition{
return SceneryDefinition.forId(id) return SceneryDefinition.forId(id)
} }
/**
* Register a map zone
* @param zone the zone to register
* @param borders the ZoneBorders that compose the zone
*/
@JvmStatic
fun registerMapZone(zone: MapZone, borders: ZoneBorders){
ZoneBuilder.configure(zone)
zone.register(borders)
}
} }
@@ -2,6 +2,7 @@ package rs09.game.interaction
import core.game.interaction.DestinationFlag import core.game.interaction.DestinationFlag
import core.game.interaction.MovementPulse import core.game.interaction.MovementPulse
import core.game.interaction.Option
import core.game.node.Node import core.game.node.Node
import core.game.node.entity.player.Player import core.game.node.entity.player.Player
import core.game.world.map.Location import core.game.world.map.Location
@@ -171,6 +172,8 @@ object InteractionListeners {
else -> DestinationFlag.OBJECT else -> DestinationFlag.OBJECT
} }
if(player.zoneMonitor.interact(node, Option(option, 0))) return true
if(player.locks.isInteractionLocked) return false if(player.locks.isInteractionLocked) return false
val method = get(id,type,option) ?: get(option,type) ?: return false val method = get(id,type,option) ?: get(option,type) ?: return false
@@ -0,0 +1,33 @@
package rs09.game.interaction.`object`
import api.ContentAPI
import core.game.interaction.Option
import core.game.node.Node
import core.game.node.entity.Entity
import core.game.world.map.zone.MapZone
import core.game.world.map.zone.ZoneBorders
import rs09.game.interaction.InteractionListener
class VarrockGuardSignpost : InteractionListener() {
override fun defineListeners() {
val zone = object : MapZone("Varrock Guards", true){
var pickpocketCounter = 0
override fun interact(e: Entity?, target: Node?, option: Option?): Boolean {
if(option != null && option.name.toLowerCase().contains("pickpocket") && target != null && target.name.toLowerCase().contains("guard")){
pickpocketCounter++
}
return false
}
}
ContentAPI.registerMapZone(zone, ZoneBorders(3225,3445,3198,3471))
ContentAPI.registerMapZone(zone, ZoneBorders(3222,3375,3199,3387))
ContentAPI.registerMapZone(zone, ZoneBorders(3180,3420,3165,3435))
ContentAPI.registerMapZone(zone, ZoneBorders(3280,3422,3266,3435))
on(31298, SCENERY, "read"){player, node ->
ContentAPI.sendDialogue(player, "Guards in the Varrock Palace are on full alert due to increasing levels of pickpocketing. So far today, ${zone.pickpocketCounter} guards have had their money pickpocketed in the palace or at the city gates.")
return@on true
}
}
}