From a0b4863437fa746b93177b3b4b54063ac323027f Mon Sep 17 00:00:00 2001 From: ceikry Date: Fri, 9 Jul 2021 19:30:22 -0500 Subject: [PATCH] Misc Jatizso fixes Fixed a bug in the packet write listener Ungoofed the LadderAchievementCheck --- .../global/action/LadderAchievementCheck.java | 9 ++++ .../content/global/action/SpecialLadders.java | 10 +---- Server/src/main/kotlin/api/ContentAPI.kt | 11 +++++ .../jatizso/CitizenDialogue.kt | 2 +- .../{area => region}/jatizso/EricDialogue.kt | 2 +- .../jatizso/GruvaPatrullDialogue.kt | 2 +- .../jatizso/LeftieRightieDialogue.kt | 2 +- .../{area => region}/jatizso/MinerDialogue.kt | 2 +- .../jatizso/MordGunnarsDialogue.kt | 2 +- .../jatizso/TowerGuardDialogue.kt | 2 +- .../region/rellekka/JatizsoListeners.kt | 44 +++++++++++++------ .../rs09/net/packet/PacketWriteQueue.kt | 6 ++- 12 files changed, 65 insertions(+), 29 deletions(-) create mode 100644 Server/src/main/java/core/game/content/global/action/LadderAchievementCheck.java rename Server/src/main/kotlin/rs09/game/content/dialogue/{area => region}/jatizso/CitizenDialogue.kt (98%) rename Server/src/main/kotlin/rs09/game/content/dialogue/{area => region}/jatizso/EricDialogue.kt (94%) rename Server/src/main/kotlin/rs09/game/content/dialogue/{area => region}/jatizso/GruvaPatrullDialogue.kt (96%) rename Server/src/main/kotlin/rs09/game/content/dialogue/{area => region}/jatizso/LeftieRightieDialogue.kt (97%) rename Server/src/main/kotlin/rs09/game/content/dialogue/{area => region}/jatizso/MinerDialogue.kt (98%) rename Server/src/main/kotlin/rs09/game/content/dialogue/{area => region}/jatizso/MordGunnarsDialogue.kt (97%) rename Server/src/main/kotlin/rs09/game/content/dialogue/{area => region}/jatizso/TowerGuardDialogue.kt (97%) diff --git a/Server/src/main/java/core/game/content/global/action/LadderAchievementCheck.java b/Server/src/main/java/core/game/content/global/action/LadderAchievementCheck.java new file mode 100644 index 000000000..30d893514 --- /dev/null +++ b/Server/src/main/java/core/game/content/global/action/LadderAchievementCheck.java @@ -0,0 +1,9 @@ +package core.game.content.global.action; + +import core.game.node.entity.player.Player; + +interface LadderAchievementCheck { + default void checkAchievement(Player player) { + return; + } +} diff --git a/Server/src/main/java/core/game/content/global/action/SpecialLadders.java b/Server/src/main/java/core/game/content/global/action/SpecialLadders.java index 5e55e26ab..1b2f79fee 100644 --- a/Server/src/main/java/core/game/content/global/action/SpecialLadders.java +++ b/Server/src/main/java/core/game/content/global/action/SpecialLadders.java @@ -21,8 +21,8 @@ public enum SpecialLadders implements LadderAchievementCheck { INTRO_LEAVE(Location.create(2522, 4999, 0),Location.create(3230, 3240, 0)), JATIZSO_MINE_UP(Location.create(2406,10188,0),Location.create(2397, 3811, 0)), JATIZSO_MINE_DOWN(Location.create(2397, 3812, 0), Location.create(2405, 10188, 0)), - JATIZSO_TOWER_UP(Location.create(2373, 3800, 2),Location.create(2374, 3800, 0)), - JATIZSO_TOWER_DOWN(Location.create(2373, 3800, 0),Location.create(2374, 3800, 2)), + JATIZSO_SHOUT_TOWER_UP(Location.create(2373, 3800, 2),Location.create(2374, 3800, 0)), + JATIZSO_SHOUT_TOWER_DOWN(Location.create(2373, 3800, 0),Location.create(2374, 3800, 2)), DRAYNOR_SEWER_SOUTHEAST_DOWN(new Location(3118, 3244, 0), new Location(3118, 9643, 0)), DRAYNOR_SEWER_SOUTHEAST_UP(new Location(3118, 9643, 0), new Location(3118, 3243, 0)), @@ -77,10 +77,4 @@ public enum SpecialLadders implements LadderAchievementCheck { return ladderMap.get(loc); } -} - -interface LadderAchievementCheck { - default void checkAchievement(Player player) { - return; - } } \ No newline at end of file diff --git a/Server/src/main/kotlin/api/ContentAPI.kt b/Server/src/main/kotlin/api/ContentAPI.kt index bab015fc6..710d404a9 100644 --- a/Server/src/main/kotlin/api/ContentAPI.kt +++ b/Server/src/main/kotlin/api/ContentAPI.kt @@ -4,6 +4,7 @@ import core.cache.def.impl.ItemDefinition import core.cache.def.impl.SceneryDefinition import core.game.component.Component import core.game.content.dialogue.FacialExpression +import core.game.content.global.action.SpecialLadders import core.game.node.Node import core.game.node.`object`.Scenery import core.game.node.`object`.SceneryBuilder @@ -1125,4 +1126,14 @@ object ContentAPI { fun animateInterface(player: Player, iface: Int, child: Int, anim: Int){ player.packetDispatch.sendAnimationInterface(anim,iface,child) } + + /** + * Adds a climb destination to the ladder handler. + * @param ladderLoc the location of the ladder/stairs object you want to climb. + * @param dest the destination for the climb. + */ + @JvmStatic + fun addClimbDest(ladderLoc: Location, dest: Location){ + SpecialLadders.add(ladderLoc,dest) + } } \ No newline at end of file diff --git a/Server/src/main/kotlin/rs09/game/content/dialogue/area/jatizso/CitizenDialogue.kt b/Server/src/main/kotlin/rs09/game/content/dialogue/region/jatizso/CitizenDialogue.kt similarity index 98% rename from Server/src/main/kotlin/rs09/game/content/dialogue/area/jatizso/CitizenDialogue.kt rename to Server/src/main/kotlin/rs09/game/content/dialogue/region/jatizso/CitizenDialogue.kt index ff6510c05..03ad3458d 100644 --- a/Server/src/main/kotlin/rs09/game/content/dialogue/area/jatizso/CitizenDialogue.kt +++ b/Server/src/main/kotlin/rs09/game/content/dialogue/region/jatizso/CitizenDialogue.kt @@ -1,4 +1,4 @@ -package rs09.game.content.dialogue.area.jatizso +package rs09.game.content.dialogue.region.jatizso import core.game.content.dialogue.DialoguePlugin import core.game.content.dialogue.FacialExpression diff --git a/Server/src/main/kotlin/rs09/game/content/dialogue/area/jatizso/EricDialogue.kt b/Server/src/main/kotlin/rs09/game/content/dialogue/region/jatizso/EricDialogue.kt similarity index 94% rename from Server/src/main/kotlin/rs09/game/content/dialogue/area/jatizso/EricDialogue.kt rename to Server/src/main/kotlin/rs09/game/content/dialogue/region/jatizso/EricDialogue.kt index f3733ca73..354555430 100644 --- a/Server/src/main/kotlin/rs09/game/content/dialogue/area/jatizso/EricDialogue.kt +++ b/Server/src/main/kotlin/rs09/game/content/dialogue/region/jatizso/EricDialogue.kt @@ -1,4 +1,4 @@ -package rs09.game.content.dialogue.area.jatizso +package rs09.game.content.dialogue.region.jatizso import core.game.content.dialogue.DialoguePlugin import core.game.content.dialogue.FacialExpression diff --git a/Server/src/main/kotlin/rs09/game/content/dialogue/area/jatizso/GruvaPatrullDialogue.kt b/Server/src/main/kotlin/rs09/game/content/dialogue/region/jatizso/GruvaPatrullDialogue.kt similarity index 96% rename from Server/src/main/kotlin/rs09/game/content/dialogue/area/jatizso/GruvaPatrullDialogue.kt rename to Server/src/main/kotlin/rs09/game/content/dialogue/region/jatizso/GruvaPatrullDialogue.kt index efe80e78b..b8c641f4c 100644 --- a/Server/src/main/kotlin/rs09/game/content/dialogue/area/jatizso/GruvaPatrullDialogue.kt +++ b/Server/src/main/kotlin/rs09/game/content/dialogue/region/jatizso/GruvaPatrullDialogue.kt @@ -1,4 +1,4 @@ -package rs09.game.content.dialogue.area.jatizso +package rs09.game.content.dialogue.region.jatizso import core.game.content.dialogue.DialoguePlugin import core.game.content.dialogue.FacialExpression diff --git a/Server/src/main/kotlin/rs09/game/content/dialogue/area/jatizso/LeftieRightieDialogue.kt b/Server/src/main/kotlin/rs09/game/content/dialogue/region/jatizso/LeftieRightieDialogue.kt similarity index 97% rename from Server/src/main/kotlin/rs09/game/content/dialogue/area/jatizso/LeftieRightieDialogue.kt rename to Server/src/main/kotlin/rs09/game/content/dialogue/region/jatizso/LeftieRightieDialogue.kt index 11880c6d3..27d961b7b 100644 --- a/Server/src/main/kotlin/rs09/game/content/dialogue/area/jatizso/LeftieRightieDialogue.kt +++ b/Server/src/main/kotlin/rs09/game/content/dialogue/region/jatizso/LeftieRightieDialogue.kt @@ -1,4 +1,4 @@ -package rs09.game.content.dialogue.area.jatizso +package rs09.game.content.dialogue.region.jatizso import api.DialUtils import core.game.content.dialogue.FacialExpression diff --git a/Server/src/main/kotlin/rs09/game/content/dialogue/area/jatizso/MinerDialogue.kt b/Server/src/main/kotlin/rs09/game/content/dialogue/region/jatizso/MinerDialogue.kt similarity index 98% rename from Server/src/main/kotlin/rs09/game/content/dialogue/area/jatizso/MinerDialogue.kt rename to Server/src/main/kotlin/rs09/game/content/dialogue/region/jatizso/MinerDialogue.kt index 9a7c82036..fd2861969 100644 --- a/Server/src/main/kotlin/rs09/game/content/dialogue/area/jatizso/MinerDialogue.kt +++ b/Server/src/main/kotlin/rs09/game/content/dialogue/region/jatizso/MinerDialogue.kt @@ -1,4 +1,4 @@ -package rs09.game.content.dialogue.area.jatizso +package rs09.game.content.dialogue.region.jatizso import core.game.content.dialogue.DialoguePlugin import core.game.content.dialogue.FacialExpression diff --git a/Server/src/main/kotlin/rs09/game/content/dialogue/area/jatizso/MordGunnarsDialogue.kt b/Server/src/main/kotlin/rs09/game/content/dialogue/region/jatizso/MordGunnarsDialogue.kt similarity index 97% rename from Server/src/main/kotlin/rs09/game/content/dialogue/area/jatizso/MordGunnarsDialogue.kt rename to Server/src/main/kotlin/rs09/game/content/dialogue/region/jatizso/MordGunnarsDialogue.kt index 5a1eb28a1..d30a74bdf 100644 --- a/Server/src/main/kotlin/rs09/game/content/dialogue/area/jatizso/MordGunnarsDialogue.kt +++ b/Server/src/main/kotlin/rs09/game/content/dialogue/region/jatizso/MordGunnarsDialogue.kt @@ -1,4 +1,4 @@ -package rs09.game.content.dialogue.area.jatizso +package rs09.game.content.dialogue.region.jatizso import core.game.content.dialogue.DialoguePlugin import core.game.content.dialogue.FacialExpression diff --git a/Server/src/main/kotlin/rs09/game/content/dialogue/area/jatizso/TowerGuardDialogue.kt b/Server/src/main/kotlin/rs09/game/content/dialogue/region/jatizso/TowerGuardDialogue.kt similarity index 97% rename from Server/src/main/kotlin/rs09/game/content/dialogue/area/jatizso/TowerGuardDialogue.kt rename to Server/src/main/kotlin/rs09/game/content/dialogue/region/jatizso/TowerGuardDialogue.kt index 365b17df1..7c1650904 100644 --- a/Server/src/main/kotlin/rs09/game/content/dialogue/area/jatizso/TowerGuardDialogue.kt +++ b/Server/src/main/kotlin/rs09/game/content/dialogue/region/jatizso/TowerGuardDialogue.kt @@ -1,4 +1,4 @@ -package rs09.game.content.dialogue.area.jatizso +package rs09.game.content.dialogue.region.jatizso import core.game.content.dialogue.DialoguePlugin import core.game.content.dialogue.FacialExpression diff --git a/Server/src/main/kotlin/rs09/game/interaction/region/rellekka/JatizsoListeners.kt b/Server/src/main/kotlin/rs09/game/interaction/region/rellekka/JatizsoListeners.kt index ceb9486c7..723a1bb88 100644 --- a/Server/src/main/kotlin/rs09/game/interaction/region/rellekka/JatizsoListeners.kt +++ b/Server/src/main/kotlin/rs09/game/interaction/region/rellekka/JatizsoListeners.kt @@ -1,6 +1,8 @@ package rs09.game.interaction.region.rellekka import api.ContentAPI +import core.game.content.dialogue.FacialExpression +import core.game.content.global.action.SpecialLadders import core.game.node.entity.npc.NPC import core.game.node.entity.player.link.audio.Audio import core.game.system.task.Pulse @@ -8,7 +10,7 @@ import core.game.world.map.Direction import core.game.world.map.Location import core.game.world.map.zone.ZoneBorders import org.rs09.consts.NPCs -import rs09.game.content.dialogue.area.jatizso.LeftieRightieDialogue +import rs09.game.content.dialogue.region.jatizso.LeftieRightieDialogue import rs09.game.interaction.InteractionListener class JatizsoListeners : InteractionListener() { @@ -18,6 +20,7 @@ class JatizsoListeners : InteractionListener() { val SOUTH_GAE_ZONE = ZoneBorders(2411,3795,2414,3799) val BELL = 21394 val GUARDS = intArrayOf(NPCs.GUARD_5491, NPCs.GUARD_5492) + val KING_CHEST = intArrayOf(21299,21300) val LINES = arrayOf( arrayOf( "YOU WOULDN'T KNOW HOW TO FIGHT A TROLL IF IT CAME UP AND BIT YER ARM OFF", @@ -40,32 +43,32 @@ class JatizsoListeners : InteractionListener() { if(NORTH_GATE_ZONE.insideBorder(player)){ if(node.id == GATES_CLOSED.first()){ val other = ContentAPI.getScenery(node.location.transform(1, 0, 0)) ?: return@on true - ContentAPI.replaceScenery(node.asScenery(), node.id + 1, 10, Direction.EAST) - ContentAPI.replaceScenery(other.asScenery(), other.id - 1, 10, Direction.NORTH_EAST) + ContentAPI.replaceScenery(node.asScenery(), node.id + 1, -1, Direction.EAST) + ContentAPI.replaceScenery(other.asScenery(), other.id - 1, -1, Direction.NORTH_EAST) } else { val other = ContentAPI.getScenery(node.location.transform(-1, 0, 0)) ?: return@on true - ContentAPI.replaceScenery(node.asScenery(), node.id + 1, 10, Direction.NORTH_EAST) - ContentAPI.replaceScenery(other.asScenery(), other.id, 10, Direction.EAST) + ContentAPI.replaceScenery(node.asScenery(), node.id + 1, -1, Direction.NORTH_EAST) + ContentAPI.replaceScenery(other.asScenery(), other.id, -1, Direction.EAST) } } else if(WEST_GATE_ZONE.insideBorder(player)){ if(node.id == GATES_CLOSED.first()){ val other = ContentAPI.getScenery(node.location.transform(0, 1, 0)) ?: return@on true - ContentAPI.replaceScenery(node.asScenery(), node.id + 1, 10, Direction.WEST) - ContentAPI.replaceScenery(other.asScenery(), other.id + 1, 10, Direction.NORTH) + ContentAPI.replaceScenery(node.asScenery(), node.id + 1, -1, Direction.WEST) + ContentAPI.replaceScenery(other.asScenery(), other.id + 1, -1, Direction.NORTH) } else { val other = ContentAPI.getScenery(node.location.transform(0, -1, 0)) ?: return@on true - ContentAPI.replaceScenery(node.asScenery(), node.id + 1, 10, Direction.NORTH) - ContentAPI.replaceScenery(other.asScenery(), other.id + 1, 10, Direction.WEST) + ContentAPI.replaceScenery(node.asScenery(), node.id + 1, -1, Direction.NORTH) + ContentAPI.replaceScenery(other.asScenery(), other.id + 1, -1, Direction.WEST) } } else if(SOUTH_GAE_ZONE.insideBorder(player)){ if(node.id == GATES_CLOSED.first()){ val other = ContentAPI.getScenery(node.location.transform(-1, 0, 0)) ?: return@on true - ContentAPI.replaceScenery(node.asScenery(), node.id + 1, 10, Direction.SOUTH) - ContentAPI.replaceScenery(other.asScenery(), other.id - 1, 10, Direction.EAST) + ContentAPI.replaceScenery(node.asScenery(), node.id + 1, -1, Direction.SOUTH) + ContentAPI.replaceScenery(other.asScenery(), other.id - 1, -1, Direction.EAST) } else { val other = ContentAPI.getScenery(node.location.transform(1, 0, 0)) ?: return@on true - ContentAPI.replaceScenery(node.asScenery(), node.id + 1, 10, Direction.EAST) - ContentAPI.replaceScenery(other.asScenery(), other.id, 10, Direction.SOUTH) + ContentAPI.replaceScenery(node.asScenery(), node.id + 1, -1, Direction.EAST) + ContentAPI.replaceScenery(other.asScenery(), other.id, -1, Direction.SOUTH) } } ContentAPI.playAudio(player, ContentAPI.getAudio(81)) @@ -128,8 +131,23 @@ class JatizsoListeners : InteractionListener() { return@on true } + on(KING_CHEST, SCENERY, "open"){player, node -> + ContentAPI.sendPlayerDialogue(player, "I probably shouldn't mess with that.", FacialExpression.HALF_THINKING) + return@on true + } + setDest(NPC, NPCs.MAGNUS_GRAM_5488){_ -> return@setDest Location.create(2416, 3801, 0) } + + //Climb handling for the ladders in the towers around the city walls. + ContentAPI.addClimbDest(Location.create(2388, 3804, 0),Location.create(2387, 3804, 2)) + ContentAPI.addClimbDest(Location.create(2388, 3804, 2),Location.create(2387, 3804, 0)) + ContentAPI.addClimbDest(Location.create(2388, 3793, 0),Location.create(2387, 3793, 2)) + ContentAPI.addClimbDest(Location.create(2388, 3793, 2),Location.create(2387, 3793, 0)) + ContentAPI.addClimbDest(Location.create(2410, 3823, 0),Location.create(2410, 3824, 2)) + ContentAPI.addClimbDest(Location.create(2410, 3823, 2),Location.create(2410, 3824, 0)) + ContentAPI.addClimbDest(Location.create(2421, 3823, 0),Location.create(2421, 3824, 2)) + ContentAPI.addClimbDest(Location.create(2421, 3823, 2),Location.create(2421, 3824, 0)) } } \ No newline at end of file diff --git a/Server/src/main/kotlin/rs09/net/packet/PacketWriteQueue.kt b/Server/src/main/kotlin/rs09/net/packet/PacketWriteQueue.kt index 8e295f332..e25fbf0eb 100644 --- a/Server/src/main/kotlin/rs09/net/packet/PacketWriteQueue.kt +++ b/Server/src/main/kotlin/rs09/net/packet/PacketWriteQueue.kt @@ -11,15 +11,19 @@ object PacketWriteQueue { @JvmStatic fun handle(packet: OutgoingPacket, context: T){ when(packet){ + //Dynamic packets need to be sent immediately is UpdateSceneGraph, is BuildDynamicScene, - is InstancedLocationUpdate -> packet.send(context) + is InstancedLocationUpdate, + is ClearRegionChunk -> packet.send(context) + //Rest get queued up and sent at the end of the tick (authentic) else -> queue(packet,context) } } @JvmStatic fun queue(packet: OutgoingPacket, context: T){ + SystemLogger.logInfo("Queueing ${packet.javaClass.simpleName}") PacketsToWrite.add(QueuedPacket(packet,context)) }