Fixed bugs relating to player location and random events
Improved handling of random events when the location of the abducted player is missing from save file Added per-tick auditing of data relating to player location
This commit is contained in:
@@ -79,7 +79,7 @@ class DrillDemonListeners : InteractionListener, MapArea {
|
||||
}
|
||||
|
||||
override fun getRestrictions(): Array<ZoneRestriction> {
|
||||
return arrayOf(ZoneRestriction.RANDOM_EVENTS, ZoneRestriction.CANNON, ZoneRestriction.FOLLOWERS)
|
||||
return arrayOf(ZoneRestriction.RANDOM_EVENTS, ZoneRestriction.CANNON, ZoneRestriction.FOLLOWERS, ZoneRestriction.OFF_MAP)
|
||||
}
|
||||
|
||||
override fun areaEnter(entity: Entity) {
|
||||
@@ -90,4 +90,4 @@ class DrillDemonListeners : InteractionListener, MapArea {
|
||||
setComponentVisibility(entity.asPlayer(), 746, 12, true)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package content.global.ame.events.drilldemon
|
||||
|
||||
import core.ServerConstants
|
||||
import core.api.*
|
||||
import core.game.interaction.QueueStrength
|
||||
import core.game.node.entity.player.Player
|
||||
@@ -67,7 +68,8 @@ object DrillDemonUtils {
|
||||
fun cleanup(player: Player) {
|
||||
player.locks.unlockTeleport()
|
||||
unlock(player)
|
||||
teleport(player, getAttribute(player, DD_KEY_RETURN_LOC, Location.create(3222, 3218, 0)))
|
||||
val destination = getAttribute(player, DD_KEY_RETURN_LOC, ServerConstants.HOME_LOCATION ?: Location.create(3222, 3218, 0))
|
||||
teleport(player, destination)
|
||||
removeAttribute(player, DD_KEY_RETURN_LOC)
|
||||
removeAttribute(player, DD_KEY_TASK)
|
||||
removeAttribute(player, DD_CORRECT_OFFSET)
|
||||
|
||||
@@ -121,7 +121,8 @@ class EvilBobListeners : InteractionListener, MapArea {
|
||||
}
|
||||
3 -> {
|
||||
sendMessage(player, "Welcome back to ${ServerConstants.SERVER_NAME}.")
|
||||
teleport(player, getAttribute(player, EvilBobUtils.prevLocation, Location.create(3222, 3219, 0)))
|
||||
val destination = getAttribute(player, EvilBobUtils.prevLocation, ServerConstants.HOME_LOCATION ?: Location.create(3222, 3218, 0))
|
||||
teleport(player, destination)
|
||||
EvilBobUtils.reward(player)
|
||||
EvilBobUtils.cleanup(player)
|
||||
resetAnimator(player)
|
||||
@@ -139,7 +140,7 @@ class EvilBobListeners : InteractionListener, MapArea {
|
||||
}
|
||||
|
||||
override fun getRestrictions(): Array<ZoneRestriction> {
|
||||
return arrayOf(ZoneRestriction.RANDOM_EVENTS, ZoneRestriction.CANNON, ZoneRestriction.FOLLOWERS)
|
||||
return arrayOf(ZoneRestriction.RANDOM_EVENTS, ZoneRestriction.CANNON, ZoneRestriction.FOLLOWERS, ZoneRestriction.OFF_MAP)
|
||||
}
|
||||
|
||||
override fun areaEnter(entity: Entity) {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package content.global.ame.events.evilbob
|
||||
|
||||
import core.ServerConstants
|
||||
import core.api.*
|
||||
import core.game.node.entity.player.Player
|
||||
import core.game.node.entity.skill.Skills
|
||||
@@ -60,7 +61,7 @@ object EvilBobUtils {
|
||||
|
||||
fun cleanup(player: Player) {
|
||||
player.locks.unlockTeleport()
|
||||
player.properties.teleportLocation = getAttribute(player, prevLocation, null)
|
||||
player.properties.teleportLocation = getAttribute(player, prevLocation, ServerConstants.HOME_LOCATION)
|
||||
removeAttributes(player, assignedFishingZone, eventComplete, prevLocation, attentive, servantHelpDialogueSeen, attentiveNewSpot, startingDialogueSeen)
|
||||
removeAll(player, Items.FISHLIKE_THING_6202)
|
||||
removeAll(player, Items.FISHLIKE_THING_6202, Container.BANK)
|
||||
|
||||
@@ -57,10 +57,10 @@ class FreakListeners : InteractionListener, MapArea {
|
||||
}
|
||||
|
||||
override fun getRestrictions(): Array<ZoneRestriction> {
|
||||
return arrayOf(ZoneRestriction.RANDOM_EVENTS, ZoneRestriction.CANNON, ZoneRestriction.FOLLOWERS)
|
||||
return arrayOf(ZoneRestriction.RANDOM_EVENTS, ZoneRestriction.CANNON, ZoneRestriction.FOLLOWERS, ZoneRestriction.OFF_MAP)
|
||||
}
|
||||
|
||||
override fun areaEnter(entity: Entity) {
|
||||
entity.locks.lockTeleport(1000000)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package content.global.ame.events.freakyforester
|
||||
|
||||
import core.ServerConstants
|
||||
import core.api.*
|
||||
import org.rs09.consts.Items
|
||||
import org.rs09.consts.NPCs
|
||||
@@ -35,7 +36,7 @@ object FreakUtils{
|
||||
|
||||
fun cleanup(player: Player) {
|
||||
player.locks.unlockTeleport()
|
||||
player.properties.teleportLocation = getAttribute(player,freakPreviousLoc,null)
|
||||
player.properties.teleportLocation = getAttribute(player,freakPreviousLoc, ServerConstants.HOME_LOCATION)
|
||||
removeAttributes(player, freakPreviousLoc, freakTask, freakComplete, pheasantKilled)
|
||||
removeAll(player, Items.RAW_PHEASANT_6178)
|
||||
removeAll(player, Items.RAW_PHEASANT_6178, Container.BANK)
|
||||
|
||||
@@ -9,16 +9,17 @@ import org.rs09.consts.NPCs
|
||||
import core.game.interaction.InteractionListener
|
||||
import core.game.interaction.IntType
|
||||
import content.global.handlers.iface.ExperienceInterface
|
||||
import core.api.MapArea
|
||||
import core.game.world.map.zone.ZoneBorders
|
||||
import core.game.world.map.zone.ZoneRestriction
|
||||
|
||||
class SupriseExamListeners : InteractionListener {
|
||||
val MORDAUT = NPCs.MR_MORDAUT_6117
|
||||
val BOOK_OF_KNOWLEDGE = Items.BOOK_OF_KNOWLEDGE_11640
|
||||
class SupriseExamListeners : InteractionListener, MapArea {
|
||||
override fun defineListeners() {
|
||||
|
||||
on(MORDAUT, IntType.NPC, "talk-to"){ player, node ->
|
||||
on(NPCs.MR_MORDAUT_6117, IntType.NPC, "talk-to") { player, node ->
|
||||
player.faceLocation(Location.create(1886, 5024, 0))
|
||||
val examComplete = player.getAttribute(SurpriseExamUtils.SE_KEY_CORRECT,0) == 3
|
||||
player.dialogueInterpreter.open(MordautDialogue(examComplete),node.asNpc())
|
||||
val examComplete = player.getAttribute(SurpriseExamUtils.SE_KEY_CORRECT, 0) == 3
|
||||
player.dialogueInterpreter.open(MordautDialogue(examComplete), node.asNpc())
|
||||
return@on true
|
||||
}
|
||||
|
||||
@@ -39,9 +40,9 @@ class SupriseExamListeners : InteractionListener {
|
||||
return@on true
|
||||
}
|
||||
|
||||
on(BOOK_OF_KNOWLEDGE, IntType.ITEM, "read"){ player, _ ->
|
||||
player.setAttribute("caller"){skill: Int,p: Player ->
|
||||
if(p.inventory.remove(Item(BOOK_OF_KNOWLEDGE))) {
|
||||
on(Items.BOOK_OF_KNOWLEDGE_11640, IntType.ITEM, "read") { player, _ ->
|
||||
player.setAttribute("caller") { skill: Int, p: Player ->
|
||||
if (p.inventory.remove(Item(Items.BOOK_OF_KNOWLEDGE_11640))) {
|
||||
val level = p.skills.getStaticLevel(skill)
|
||||
val experience = level * 15.0
|
||||
p.skills.addExperience(skill, experience)
|
||||
@@ -54,8 +55,16 @@ class SupriseExamListeners : InteractionListener {
|
||||
}
|
||||
|
||||
override fun defineDestinationOverrides() {
|
||||
setDest(IntType.NPC,MORDAUT){ _, _ ->
|
||||
setDest(IntType.NPC, NPCs.MR_MORDAUT_6117) { _, _ ->
|
||||
return@setDest Location.create(1886, 5025, 0)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun defineAreaBorders(): Array<ZoneBorders> {
|
||||
return arrayOf(ZoneBorders.forRegion(7502))
|
||||
}
|
||||
|
||||
override fun getRestrictions(): Array<ZoneRestriction> {
|
||||
return arrayOf(ZoneRestriction.RANDOM_EVENTS, ZoneRestriction.CANNON, ZoneRestriction.FOLLOWERS, ZoneRestriction.OFF_MAP)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package content.global.ame.events.supriseexam
|
||||
|
||||
import core.Server
|
||||
import core.api.*
|
||||
import core.game.node.entity.impl.PulseType
|
||||
import core.game.node.entity.player.Player
|
||||
@@ -40,17 +41,12 @@ object SurpriseExamUtils {
|
||||
}
|
||||
|
||||
fun cleanup(player: Player){
|
||||
player.properties.teleportLocation = player.getAttribute(SE_KEY_LOC,null)
|
||||
player.properties.teleportLocation = player.getAttribute(SE_KEY_LOC, ServerConstants.HOME_LOCATION)
|
||||
clearLogoutListener(player, SE_LOGOUT_KEY)
|
||||
player.removeAttribute(SE_KEY_LOC)
|
||||
player.removeAttribute(SE_KEY_INDEX)
|
||||
player.removeAttribute(SE_KEY_CORRECT)
|
||||
removeAttributes(player, SE_KEY_LOC, SE_KEY_INDEX, SE_KEY_CORRECT)
|
||||
player.pulseManager.run(object : Pulse(2){
|
||||
override fun pulse(): Boolean {
|
||||
val reward = Item(Items.BOOK_OF_KNOWLEDGE_11640)
|
||||
if(!player.inventory.add(reward)){
|
||||
GroundItemManager.create(reward,player)
|
||||
}
|
||||
addItemOrDrop(player, Items.BOOK_OF_KNOWLEDGE_11640)
|
||||
return true
|
||||
}
|
||||
}, PulseType.CUSTOM_1)
|
||||
|
||||
Reference in New Issue
Block a user