Implemented Gaze of Saradomin

Fixed respawn bugs
This commit is contained in:
Player Name 2025-02-01 13:23:42 +00:00 committed by Ryan
parent 064edfbbe4
commit edc6f9cf07
5 changed files with 41 additions and 34 deletions

View file

@ -52,6 +52,22 @@ class SirTiffyCashienDialogue (player: Player? = null) : DialoguePlugin(player)
// Move this to Wanted!! Quest. // Move this to Wanted!! Quest.
class SirTiffyCashienAfterRecruitmentDriveQuestDialogueFile : DialogueBuilderFile() { class SirTiffyCashienAfterRecruitmentDriveQuestDialogueFile : DialogueBuilderFile() {
private fun dialogueChangeSpawnPoint(builder: DialogueBuilder, place: String, location: Location, tiffyLine1: String, tiffyLine2: String): DialogueBuilder {
return builder.npcl("${tiffyLine1} Are you sure?")
.options().let { optionBuilder ->
optionBuilder.option("Yes, I want to respawn in $place.")
.playerl("Yes, I want to respawn in $place.")
.npcl(tiffyLine2)
.endWith { _, player ->
setAttribute(player, "/save:spawnLocation", location)
player.properties.spawnLocation = location
}
optionBuilder.option("Actually, no thanks. I like my respawn point.")
.playerl("Actually, no thanks. I like my respawn point.")
.npcl("As you wish, what? Ta-ta for now.")
}
}
override fun create(b: DialogueBuilder) { override fun create(b: DialogueBuilder) {
b.onPredicate { _ -> true } b.onPredicate { _ -> true }
.npc(FacialExpression.HAPPY, "What ho, @g[sirrah,milady].", "Jolly good show on the old training grounds thingy,", "what?") .npc(FacialExpression.HAPPY, "What ho, @g[sirrah,milady].", "Jolly good show on the old training grounds thingy,", "what?")
@ -79,28 +95,26 @@ class SirTiffyCashienAfterRecruitmentDriveQuestDialogueFile : DialogueBuilderFil
.endWith { _, player -> .endWith { _, player ->
openNpcShop(player, npc!!.id) openNpcShop(player, npc!!.id)
} }
optionBuilder.option_playerl("Can I switch respawns please?") optionBuilder.option("Can I switch respawns please?")
.npcl("I'm sorry dear @g[boy,gal], I'm afraid I can't switch your respawn point at the moment.") .branch { player -> if (player.properties.spawnLocation == ServerConstants.HOME_LOCATION) { 1 } else { 0 } }
.end() .let { branch ->
// I have no idea how to do this properly. dialogueChangeSpawnPoint(
// optionBuilder.option("Can I switch respawns please?") branch.onValue(1),
// .branch { player -> if(player.properties.spawnLocation == Location(2997, 3375, 0)) { 1 } else { 0 } } "Falador", Location(2971, 3340, 0), //https://www.youtube.com/watch?v=Mm15dHuIaVg
// .let { branch -> "Ah, so you'd like to respawn in Falador, the good old homestead!",
// branch.onValue(1) "Top-hole, what? Good old Fally is definitely the hot-spot nowadays!"
// .npcl("Ah, so you'd like to respawn in Falador, the good old homestead! Are you sure?") )
// .endWith { _, player -> dialogueChangeSpawnPoint(
// player.properties.spawnLocation = Location(2997, 3375, 0) branch.onValue(0),
// } "Lumbridge", ServerConstants.HOME_LOCATION ?: Location(3222, 3218, 0),
// branch.onValue(0) "What? You're saying you want to respawn in Lumbridge?",
// .npcl("What? You're saying you want to respawn in Lumbridge? Are you sure?") "Why anyone would want to visit that smelly little swamp village of oiks is quite beyond me, I'm afraid, but the deed is done now."
// .endWith { _, player -> )
// player.properties.spawnLocation = ServerConstants.HOME_LOCATION }
// }
// }
optionBuilder.option("Goodbye.") optionBuilder.option("Goodbye.")
.playerl("Well, see you around Tiffy.") .playerl("Well, see you around Tiffy.")
.npcl(FacialExpression.HAPPY,"Ta-ta for now, old bean!") .npcl(FacialExpression.HAPPY,"Ta-ta for now, old bean!")
.end() .end()
} }
} }
} }

View file

@ -326,10 +326,8 @@ public class Player extends Entity {
@Override @Override
public void init() { public void init() {
if(!artificial)
log(this.getClass(), Log.INFO, getUsername() + " initialising...");
if (!artificial) { if (!artificial) {
getProperties().setSpawnLocation(ServerConstants.HOME_LOCATION); log(this.getClass(), Log.INFO, getUsername() + " initialising...");
getDetails().getSession().setObject(this); getDetails().getSession().setObject(this);
} }
super.init(); super.init();

View file

@ -1,11 +1,12 @@
package core.game.node.entity.player.info.login package core.game.node.entity.player.info.login
import core.ServerConstants
import core.api.* import core.api.*
import core.auth.AuthResponse
import core.game.node.entity.player.Player import core.game.node.entity.player.Player
import core.game.node.entity.player.info.PlayerDetails import core.game.node.entity.player.info.PlayerDetails
import core.game.system.SystemManager import core.game.system.SystemManager
import core.game.system.task.Pulse import core.game.system.task.Pulse
import core.auth.AuthResponse
import core.game.world.GameWorld import core.game.world.GameWorld
import core.game.world.GameWorld.loginListeners import core.game.world.GameWorld.loginListeners
import core.game.world.repository.Repository import core.game.world.repository.Repository
@ -27,8 +28,7 @@ class LoginParser(val details: PlayerDetails) {
parser = PlayerParser.parse(player) parser = PlayerParser.parse(player)
?: throw IllegalStateException("Failed parsing save for: " + player.username) //Parse core ?: throw IllegalStateException("Failed parsing save for: " + player.username) //Parse core
} }
catch (e: Exception) catch (e: Exception) {
{
e.printStackTrace() e.printStackTrace()
Repository.removePlayer(player) Repository.removePlayer(player)
flag(AuthResponse.ErrorLoadingProfile) flag(AuthResponse.ErrorLoadingProfile)
@ -37,6 +37,7 @@ class LoginParser(val details: PlayerDetails) {
override fun pulse(): Boolean { override fun pulse(): Boolean {
try { try {
if (details.session.isActive) { if (details.session.isActive) {
player.properties.spawnLocation = getAttribute(player, "/save:spawnLocation", ServerConstants.HOME_LOCATION)
loginListeners.forEach(Consumer { listener: LoginListener -> listener.login(player) }) //Run our login hooks loginListeners.forEach(Consumer { listener: LoginListener -> listener.login(player) }) //Run our login hooks
parser.runContentHooks() //Run our saved-content-parsing hooks parser.runContentHooks() //Run our saved-content-parsing hooks
player.details.session.setObject(player) player.details.session.setObject(player)

View file

@ -1,7 +1,5 @@
package core.game.node.entity.player.info.login package core.game.node.entity.player.info.login
import content.global.skill.farming.CompostBins
import content.global.skill.farming.FarmingPatch
import core.JSONUtils import core.JSONUtils
import core.api.PersistPlayer import core.api.PersistPlayer
import core.game.node.entity.combat.spell.CombatSpell import core.game.node.entity.combat.spell.CombatSpell
@ -18,7 +16,6 @@ import core.ServerConstants
import core.api.log import core.api.log
import core.game.node.entity.combat.graves.GraveController import core.game.node.entity.combat.graves.GraveController
import core.game.node.entity.combat.graves.GraveType import core.game.node.entity.combat.graves.GraveType
import core.tools.SystemLogger
import core.game.world.GameWorld import core.game.world.GameWorld
import core.tools.Log import core.tools.Log
import java.io.File import java.io.File

View file

@ -1,14 +1,12 @@
package core.game.system.command.sets package core.game.system.command.sets
import content.global.activity.jobs.JobManager import content.global.activity.jobs.JobManager
import content.global.skill.slayer.Master
import core.api.* import core.api.*
import core.cache.Cache import core.cache.Cache
import core.cache.def.impl.DataMap import core.cache.def.impl.DataMap
import core.cache.def.impl.NPCDefinition import core.cache.def.impl.NPCDefinition
import core.cache.def.impl.VarbitDefinition import core.cache.def.impl.VarbitDefinition
import core.cache.def.impl.Struct import core.cache.def.impl.Struct
import core.game.dialogue.DialogueFile
import core.game.node.entity.combat.ImpactHandler.HitsplatType import core.game.node.entity.combat.ImpactHandler.HitsplatType
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
@ -20,7 +18,6 @@ import core.plugin.Initializable
import kotlinx.coroutines.GlobalScope import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import org.rs09.consts.Items import org.rs09.consts.Items
import core.tools.SystemLogger
import core.game.system.command.Privilege import core.game.system.command.Privilege
import java.io.BufferedWriter import java.io.BufferedWriter
import java.io.File import java.io.File
@ -28,10 +25,10 @@ import java.io.FileWriter
import java.util.Arrays import java.util.Arrays
import core.net.packet.PacketWriteQueue import core.net.packet.PacketWriteQueue
import core.tools.Log import core.tools.Log
import core.game.world.update.flag.* import core.game.node.entity.player.info.Rights
import core.game.world.update.flag.context.* import core.game.node.entity.skill.Skills
import core.game.node.entity.impl.*
import core.game.world.map.Location import core.game.world.map.Location
import core.game.world.repository.Repository
@Initializable @Initializable
class DevelopmentCommandSet : CommandSet(Privilege.ADMIN) { class DevelopmentCommandSet : CommandSet(Privilege.ADMIN) {