diff --git a/Server/data/configs/music_configs.json b/Server/data/configs/music_configs.json index 91060a7b3..6aee332d7 100644 --- a/Server/data/configs/music_configs.json +++ b/Server/data/configs/music_configs.json @@ -2266,5 +2266,11 @@ "name": "Norse Code", "indexId": "439", "borders": "{2404,3797,2421,3820}" + }, + { + "id": "225", + "name": "Volcanic Vikings", + "indexId": "440", + "borders": "{2304,3785,2635,3818}" } ] diff --git a/Server/data/configs/npc_spawns.json b/Server/data/configs/npc_spawns.json index 323111de9..e36f69155 100644 --- a/Server/data/configs/npc_spawns.json +++ b/Server/data/configs/npc_spawns.json @@ -7745,7 +7745,7 @@ }, { "npc_id": "5529", - "loc_data": "{2323,3790,0,1,1}-{2323,3795,0,1,0}-{2322,3795,0,1,0}-{2317,3794,0,1,6}-{2317,3790,0,1,3}-{2321,3792,0,1,6}-{2327,3796,0,1,7}-{2319,3791,0,1,6}" + "loc_data": "{2323,3790,0,1,1}-{2323,3795,0,1,0}-{2322,3795,0,1,0}-{2317,3794,0,1,6}-{2317,3790,0,1,3}-{2321,3792,0,1,6}" }, { "npc_id": "5531", @@ -10682,5 +10682,9 @@ { "npc_id": "5482", "loc_data": "{2422,3781,0,1,0}" + }, + { + "npc_id": "5463", + "loc_data": "{2324,3809,0,1,0}-{2317,3802,0,1,0}" } ] \ No newline at end of file diff --git a/Server/src/main/java/core/game/content/global/action/ClimbActionHandler.java b/Server/src/main/java/core/game/content/global/action/ClimbActionHandler.java index 4a1309405..3f716136b 100644 --- a/Server/src/main/java/core/game/content/global/action/ClimbActionHandler.java +++ b/Server/src/main/java/core/game/content/global/action/ClimbActionHandler.java @@ -73,7 +73,9 @@ public final class ClimbActionHandler { if (SpecialLadders.getDestination(startLadder.getLocation()) != null) { Location destination = SpecialLadders.getDestination(startLadder.getLocation()); climb(player, animation, destination); - SpecialLadders.getSpecialLadder(startLadder.getLocation()).checkAchievement(player); + if(SpecialLadders.getSpecialLadder(startLadder.getLocation()) != null) { + SpecialLadders.getSpecialLadder(startLadder.getLocation()).checkAchievement(player); + } return true; } switch (option) { diff --git a/Server/src/main/java/core/game/interaction/item/withobject/WaterSourcePlugin.java b/Server/src/main/java/core/game/interaction/item/withobject/WaterSourcePlugin.java index d981b72c2..9d9a44dad 100644 --- a/Server/src/main/java/core/game/interaction/item/withobject/WaterSourcePlugin.java +++ b/Server/src/main/java/core/game/interaction/item/withobject/WaterSourcePlugin.java @@ -25,7 +25,7 @@ public final class WaterSourcePlugin extends UseWithHandler { /** * Represents the objects to use the buckets on. */ - private static final int[] OBJECTS = new int[] { 16302, 6827, 11661, 24160, 34577, 15936, 15937, 15938, 23920, 35469, 24265, 153, 879, 880, 2864, 6232, 10436, 10437, 10827, 11007, 11759, 21764, 22973, 24161, 24214, 24265, 28662, 30223, 30820, 34579, 36781, 873, 874, 4063, 6151, 8699, 9143, 9684, 10175, 12279, 12974, 13563, 13564, 14868, 14917, 15678, 16704, 16705, 20358, 22715, 24112, 24314, 25729, 25929, 26966, 29105, 33458, 34082, 34411, 34496, 34547, 34566, 35762, 36971, 37154, 37155, 878, 884, 3264, 3305, 3359, 4004, 4005, 6097, 6249, 6549, 8747, 8927, 11793, 12201, 12897, 24166, 26945, 31359, 32023, 32024, 34576, 35671, 40063, 13561, 13563, 13559 }; + private static final int[] OBJECTS = new int[] { 21355, 16302, 6827, 11661, 24160, 34577, 15936, 15937, 15938, 23920, 35469, 24265, 153, 879, 880, 2864, 6232, 10436, 10437, 10827, 11007, 11759, 21764, 22973, 24161, 24214, 24265, 28662, 30223, 30820, 34579, 36781, 873, 874, 4063, 6151, 8699, 9143, 9684, 10175, 12279, 12974, 13563, 13564, 14868, 14917, 15678, 16704, 16705, 20358, 22715, 24112, 24314, 25729, 25929, 26966, 29105, 33458, 34082, 34411, 34496, 34547, 34566, 35762, 36971, 37154, 37155, 878, 884, 3264, 3305, 3359, 4004, 4005, 6097, 6249, 6549, 8747, 8927, 11793, 12201, 12897, 24166, 26945, 31359, 32023, 32024, 34576, 35671, 40063, 13561, 13563, 13559 }; /** * Represents the animation to use. @@ -63,7 +63,7 @@ public final class WaterSourcePlugin extends UseWithHandler { * @version 1.0 */ public enum WaterRecipient { - BUCKET(new Item(1925), new Item(1929)), + BUCKET(new Item(1925), new Item(1929), "You fill the bucket with water."), VIAL(new Item(229), new Item(227)), JUG(new Item(1935), new Item(1937)), BOWL(new Item(1923), new Item(1921)), diff --git a/Server/src/main/java/core/game/world/map/zone/MapZone.java b/Server/src/main/java/core/game/world/map/zone/MapZone.java index 66d828336..48d93b0fb 100644 --- a/Server/src/main/java/core/game/world/map/zone/MapZone.java +++ b/Server/src/main/java/core/game/world/map/zone/MapZone.java @@ -112,6 +112,8 @@ public abstract class MapZone implements Zone { return false; } + public boolean handleUseWith(Player player, Item used, Node with){return false;} + /** * Handles an reward button. * @param player The player. diff --git a/Server/src/main/java/core/game/world/map/zone/ZoneMonitor.java b/Server/src/main/java/core/game/world/map/zone/ZoneMonitor.java index e5256624d..470b59bb4 100644 --- a/Server/src/main/java/core/game/world/map/zone/ZoneMonitor.java +++ b/Server/src/main/java/core/game/world/map/zone/ZoneMonitor.java @@ -7,6 +7,7 @@ import core.game.node.entity.combat.CombatStyle; import core.game.node.entity.player.Player; import core.game.node.entity.player.link.music.MusicZone; import core.game.node.entity.player.link.request.RequestType; +import core.game.node.item.Item; import core.game.world.map.Location; import java.util.ArrayList; @@ -149,6 +150,18 @@ public final class ZoneMonitor { return false; } + /** + * Checks if a zone handles a useWith interaction + */ + public boolean useWith(Item used, Node with){ + for (RegionZone z : zones) { + if (z.getZone().handleUseWith(entity.asPlayer(), used,with)) { + return true; + } + } + return false; + } + /** * Checks if the player handled the reward button using a map zone. * @param interfaceId The interface id. diff --git a/Server/src/main/java/core/net/packet/in/ItemActionPacket.java b/Server/src/main/java/core/net/packet/in/ItemActionPacket.java index b913a2164..7d1b09f09 100644 --- a/Server/src/main/java/core/net/packet/in/ItemActionPacket.java +++ b/Server/src/main/java/core/net/packet/in/ItemActionPacket.java @@ -72,6 +72,9 @@ public class ItemActionPacket implements IncomingPacket { if(InteractionListeners.run(item,npc,2,player)){ return; } + if(player.getZoneMonitor().useWith(used,npc)){ + return; + } event = new NodeUsageEvent(player, interfaceId, item, npc); try { UseWithHandler.run(event); @@ -97,6 +100,9 @@ public class ItemActionPacket implements IncomingPacket { if(PluginInteractionManager.handle(player,event)){ return; } + if(player.getZoneMonitor().useWith(used,player)){ + return; + } event = new NodeUsageEvent(player, interfaceId, item, target); try { UseWithHandler.run(event); @@ -131,6 +137,9 @@ public class ItemActionPacket implements IncomingPacket { if(InteractionListeners.run(used,with,0,player)){ return; } + if(player.getZoneMonitor().useWith(used,with)){ + return; + } if (usedItemId < usedWithItemId) { item = used; used = with; @@ -182,6 +191,9 @@ public class ItemActionPacket implements IncomingPacket { if(InteractionListeners.run(used,object,1,player)){ return; } + if(player.getZoneMonitor().useWith(used,object)){ + return; + } event = new NodeUsageEvent(player, 0, used, object); /** diff --git a/Server/src/main/kotlin/api/ContentAPI.kt b/Server/src/main/kotlin/api/ContentAPI.kt index 710d404a9..df3981d11 100644 --- a/Server/src/main/kotlin/api/ContentAPI.kt +++ b/Server/src/main/kotlin/api/ContentAPI.kt @@ -593,6 +593,16 @@ object ContentAPI { return RegionManager.getLocalNpcs(entity).firstOrNull { it.id == id } } + /** + * Gets a list of nearby NPCs that match the given IDs. + * @param entity the entity to check around + * @param ids the IDs of the NPCs to look for + */ + @JvmStatic + fun findLocalNPCs(entity: Entity, ids: IntArray): List{ + return RegionManager.getSurroundingNPCs(entity).filter { it.id in ids }.toList() + } + /** * Gets the value of an attribute key from the Entity's attributes store * @param entity the entity to get the attribute from diff --git a/Server/src/main/kotlin/rs09/game/content/dialogue/region/jatizso/TowerGuardDialogue.kt b/Server/src/main/kotlin/rs09/game/content/dialogue/region/jatizso/TowerGuardDialogue.kt index 7c1650904..095aaf348 100644 --- a/Server/src/main/kotlin/rs09/game/content/dialogue/region/jatizso/TowerGuardDialogue.kt +++ b/Server/src/main/kotlin/rs09/game/content/dialogue/region/jatizso/TowerGuardDialogue.kt @@ -28,14 +28,14 @@ class TowerGuardDialogue(player: Player? = null) : DialoguePlugin(player) { 1 -> playerl(FacialExpression.HALF_THINKING, "No need to shout.").also { stage++ } 2 -> npc(FacialExpression.NEUTRAL, "I'M SORRY I'VE BEEN SHOUTING","INSULTS SO LONG I CAN'T HELP IT!").also { stage++ } 3 -> playerl(FacialExpression.HALF_THINKING, "Who are you insulting?").also { stage++ } - 4 -> npc(FacialExpression.NEUTRAL, "THE TOWER IN NEITIZNOT.","THEY SHOUT INSULTS BACK.").also { stage++ } + 4 -> npc(FacialExpression.NEUTRAL, "THE TOWER IN ${if(npc.id == NPCs.GUARD_5489) "NEITIZNOT" else "JATIZSO"}.","THEY SHOUT INSULTS BACK.").also { stage++ } 5 -> playerl(FacialExpression.ASKING, "Err, why?" ).also { stage++ } - 6 -> npc(FacialExpression.NEUTRAL, "THE KING TELLS US TO.").also { stage++ } - 7 -> playerl(FacialExpression.HALF_THINKING, "Your King is a strange person.").also { stage++ } + 6 -> npc(FacialExpression.NEUTRAL, "THE ${if(npc.id == NPCs.GUARD_5489) "KING" else "BURGHER"} TELLS US TO.").also { stage++ } + 7 -> playerl(FacialExpression.HALF_THINKING, "Your ${if(npc.id == NPCs.GUARD_5489) "King" else "Burgher"} is a strange person.").also { stage++ } 8 -> options("Can I watch? I'm curious.", "Oh well, I'd better get going.").also { stage++ } 9 -> when(buttonId){ 1 -> playerl(FacialExpression.ASKING, "Can I watch? I'm curious.").also { stage++ } - 2 -> npcl(FacialExpression.HALF_THINKING, "Oh well, I'd better get going.").also { stage = END_DIALOGUE } + 2 -> playerl(FacialExpression.HALF_THINKING, "Oh well, I'd better get going.").also { stage = END_DIALOGUE } } 10 -> npcl(FacialExpression.NEUTRAL, "IF YOU LIKE!").also { stage = END_DIALOGUE @@ -46,7 +46,7 @@ class TowerGuardDialogue(player: Player? = null) : DialoguePlugin(player) { } override fun getIds(): IntArray { - return intArrayOf(NPCs.GUARD_5489) + return intArrayOf(NPCs.GUARD_5489, NPCs.GUARD_5490) } } \ No newline at end of file diff --git a/Server/src/main/kotlin/rs09/game/content/dialogue/region/neitiznot/FridleifShieldsonDialogue.kt b/Server/src/main/kotlin/rs09/game/content/dialogue/region/neitiznot/FridleifShieldsonDialogue.kt new file mode 100644 index 000000000..c3e46ded2 --- /dev/null +++ b/Server/src/main/kotlin/rs09/game/content/dialogue/region/neitiznot/FridleifShieldsonDialogue.kt @@ -0,0 +1,32 @@ +package rs09.game.content.dialogue.region.neitiznot + +import core.game.content.dialogue.DialoguePlugin +import core.game.content.dialogue.FacialExpression +import core.game.node.entity.player.Player +import core.plugin.Initializable +import org.rs09.consts.NPCs +import rs09.tools.END_DIALOGUE + +@Initializable +class FridleifShieldsonDialogue(player: Player? = null) : DialoguePlugin(player) { + override fun newInstance(player: Player?): DialoguePlugin { + return FridleifShieldsonDialogue(player) + } + + override fun open(vararg args: Any?): Boolean { + npcl(FacialExpression.FRIENDLY, "Greetings!") + return true + } + + override fun handle(interfaceId: Int, buttonId: Int): Boolean { + when(stage){ + 0 -> playerl(FacialExpression.FRIENDLY, "Hello!").also { stage = END_DIALOGUE } + } + return true + } + + override fun getIds(): IntArray { + return intArrayOf(NPCs.FRIDLEIF_SHIELDSON_5505) + } + +} \ No newline at end of file diff --git a/Server/src/main/kotlin/rs09/game/content/dialogue/region/neitiznot/GunnarHoldstromDialogue.kt b/Server/src/main/kotlin/rs09/game/content/dialogue/region/neitiznot/GunnarHoldstromDialogue.kt new file mode 100644 index 000000000..a8a241124 --- /dev/null +++ b/Server/src/main/kotlin/rs09/game/content/dialogue/region/neitiznot/GunnarHoldstromDialogue.kt @@ -0,0 +1,34 @@ +package rs09.game.content.dialogue.region.neitiznot + +import core.game.content.dialogue.DialoguePlugin +import core.game.content.dialogue.FacialExpression +import core.game.node.entity.player.Player +import core.plugin.Initializable +import org.rs09.consts.NPCs +import rs09.tools.END_DIALOGUE + +@Initializable +class GunnarHoldstromDialogue(player: Player? = null) : DialoguePlugin(player) { + override fun newInstance(player: Player?): DialoguePlugin { + return GunnarHoldstromDialogue(player) + } + + override fun open(vararg args: Any?): Boolean { + npcl(FacialExpression.HAPPY, "Ah, isn't it a lovely day?") + return true + } + + override fun handle(interfaceId: Int, buttonId: Int): Boolean { + when(stage){ + 0 -> playerl(FacialExpression.ASKING, "It's not bad. What puts you in such a good mood?").also { stage++ } + 1 -> npcl(FacialExpression.HAPPY, "Oh, I just love my job. The smell of the sea breeze, the smell of the arctic pine sap, the smell of the yaks. I find it all so bracing.").also { stage++ } + 2 -> playerl(FacialExpression.ASKING, "Bracing? Hmmm. I think I might have chosen a different word.").also { stage = END_DIALOGUE } + } + return true + } + + override fun getIds(): IntArray { + return intArrayOf(NPCs.GUNNAR_HOLDSTROM_5511) + } + +} \ No newline at end of file diff --git a/Server/src/main/kotlin/rs09/game/content/dialogue/region/neitiznot/JofridrMordstatterDialogue.kt b/Server/src/main/kotlin/rs09/game/content/dialogue/region/neitiznot/JofridrMordstatterDialogue.kt new file mode 100644 index 000000000..ea658b0cd --- /dev/null +++ b/Server/src/main/kotlin/rs09/game/content/dialogue/region/neitiznot/JofridrMordstatterDialogue.kt @@ -0,0 +1,47 @@ +package rs09.game.content.dialogue.region.neitiznot + +import core.game.content.dialogue.DialoguePlugin +import core.game.content.dialogue.FacialExpression +import core.game.node.entity.npc.NPC +import core.game.node.entity.player.Player +import core.plugin.Initializable +import org.rs09.consts.NPCs +import rs09.tools.END_DIALOGUE + +@Initializable +class JofridrMordstatterDialogue(player: Player? = null) : DialoguePlugin(player) { + override fun newInstance(player: Player?): DialoguePlugin { + return JofridrMordstatterDialogue(player) + } + + override fun open(vararg args: Any?): Boolean { + npc = args[0] as NPC + npcl(FacialExpression.NEUTRAL, "Hello there. Would you like to see the goods I have for sale?") + return true + } + + override fun handle(interfaceId: Int, buttonId: Int): Boolean { + when (stage) { + 0 -> options("Yes please, Jofridr.", "No thank you, Jofridr.", "Why do you have so much wool in your store?").also { stage++ } + 1 -> when (buttonId) { + 1 -> playerl(FacialExpression.NEUTRAL, "Yes please, Jofridr.").also { stage = END_DIALOGUE }.also { npc.openShop(player) } + 2 -> playerl(FacialExpression.NEUTRAL, "No thank you, Jofridr.").also { stage = 5 } + 3 -> playerl(FacialExpression.THINKING, "Why do you have so much wool in your store? I haven't seen any sheep anywhere.").also { stage = 11} + } + 5 -> npcl(FacialExpression.NEUTRAL,"Fair thee well.").also { stage = END_DIALOGUE } + + 11 -> npcl(FacialExpression.FRIENDLY,"Ah, I have contacts on the mainland. I have a sailor friend who brings me crates of wool on a regular basis.").also { stage++ } + 12 -> playerl(FacialExpression.ASKING,"What do you trade for it?").also { stage++ } + 13 -> npcl(FacialExpression.FRIENDLY,"Rope of course! What else can we sell? Fish would go off before it got so far south.").also { stage++ } + 14 -> playerl(FacialExpression.ASKING,"Where does all this rope go?").also { stage++ } + 15 -> npcl(FacialExpression.THINKING,"Err, I don't remember the name of the place very well. Dreinna? Drennor? Something like that.").also { stage++ } + 16 -> playerl(FacialExpression.NEUTRAL,"That's very interesting. Thanks Jofridr.").also { stage = END_DIALOGUE } + } + return true + } + + override fun getIds(): IntArray { + return intArrayOf(NPCs.JOFRIDR_MORDSTATTER_5509) + } + +} \ No newline at end of file diff --git a/Server/src/main/kotlin/rs09/game/content/dialogue/region/neitiznot/KjedeligUppsenDialogue.kt b/Server/src/main/kotlin/rs09/game/content/dialogue/region/neitiznot/KjedeligUppsenDialogue.kt new file mode 100644 index 000000000..f396415aa --- /dev/null +++ b/Server/src/main/kotlin/rs09/game/content/dialogue/region/neitiznot/KjedeligUppsenDialogue.kt @@ -0,0 +1,32 @@ +package rs09.game.content.dialogue.region.neitiznot + +import core.game.content.dialogue.DialoguePlugin +import core.game.content.dialogue.FacialExpression +import core.game.node.entity.player.Player +import core.plugin.Initializable +import org.rs09.consts.NPCs +import rs09.tools.END_DIALOGUE + +@Initializable +class KjedeligUppsenDialogue(player: Player? = null) : DialoguePlugin(player) { + override fun newInstance(player: Player?): DialoguePlugin { + return KjedeligUppsenDialogue(player) + } + + override fun open(vararg args: Any?): Boolean { + npcl(FacialExpression.NEUTRAL, "I'm guarding the king, I cannot speak.") + return true + } + + override fun handle(interfaceId: Int, buttonId: Int): Boolean { + when(stage){ + 0 -> playerl(FacialExpression.NEUTRAL, "Sorry.").also { stage = END_DIALOGUE } + } + return true + } + + override fun getIds(): IntArray { + return intArrayOf(NPCs.KJEDELIG_UPPSEN_5518) + } + +} \ No newline at end of file diff --git a/Server/src/main/kotlin/rs09/game/content/dialogue/region/neitiznot/LisseIsaaksonDialogue.kt b/Server/src/main/kotlin/rs09/game/content/dialogue/region/neitiznot/LisseIsaaksonDialogue.kt new file mode 100644 index 000000000..dd24b0e1b --- /dev/null +++ b/Server/src/main/kotlin/rs09/game/content/dialogue/region/neitiznot/LisseIsaaksonDialogue.kt @@ -0,0 +1,38 @@ +package rs09.game.content.dialogue.region.neitiznot + +import core.game.content.dialogue.DialoguePlugin +import core.game.content.dialogue.FacialExpression +import core.game.node.entity.player.Player +import core.plugin.Initializable +import org.rs09.consts.NPCs +import rs09.tools.END_DIALOGUE + +@Initializable +class LisseIsaaksonDialogue(player: Player? = null) : DialoguePlugin(player) { + override fun newInstance(player: Player?): DialoguePlugin { + return LisseIsaaksonDialogue(player) + } + + override fun open(vararg args: Any?): Boolean { + npcl(FacialExpression.FRIENDLY, "Hello, visitor!") + return true + } + + override fun handle(interfaceId: Int, buttonId: Int): Boolean { + when(stage){ + 0 -> playerl(FacialExpression.ASKING, "Hello. What are you up to?").also { stage++ } + 1 -> npcl(FacialExpression.FRIENDLY, "Ah, I was about to collect some yak's milk to make yak cheese.").also { stage++ } + 2 -> playerl(FacialExpression.HALF_WORRIED, "Eughr! Though I am curious. Can I try some?").also { stage++ } + 3 -> npcl(FacialExpression.SAD, "Sorry, no. The last outlander who ate my cheese was ill for a month.").also { stage++ } + 4 -> playerl(FacialExpression.ASKING, "So why don't you get ill as well?").also { stage++ } + 5 -> npcl(FacialExpression.FRIENDLY, "Well, we eat yak milk products every day, from when we're born. So I suppose we're used to it. Anyway I should stop yakking - haha - and get on with my work.").also { stage++ } + 6 -> playerl(FacialExpression.HAPPY, "I'm glad to see that puns are common everywhere in Gielinor; even here.").also { stage = END_DIALOGUE } + } + return true + } + + override fun getIds(): IntArray { + return intArrayOf(NPCs.LISSE_ISAAKSON_5513) + } + +} \ No newline at end of file diff --git a/Server/src/main/kotlin/rs09/game/content/dialogue/region/neitiznot/MortenHoldstromDialogue.kt b/Server/src/main/kotlin/rs09/game/content/dialogue/region/neitiznot/MortenHoldstromDialogue.kt new file mode 100644 index 000000000..c1dd5c240 --- /dev/null +++ b/Server/src/main/kotlin/rs09/game/content/dialogue/region/neitiznot/MortenHoldstromDialogue.kt @@ -0,0 +1,38 @@ +package rs09.game.content.dialogue.region.neitiznot + +import core.game.content.dialogue.DialoguePlugin +import core.game.content.dialogue.FacialExpression +import core.game.node.entity.player.Player +import core.plugin.Initializable +import org.rs09.consts.NPCs +import rs09.tools.END_DIALOGUE + +@Initializable +class MortenHoldstromDialogue(player: Player? = null) : DialoguePlugin(player) { + override fun newInstance(player: Player?): DialoguePlugin { + return MortenHoldstromDialogue(player) + } + + override fun open(vararg args: Any?): Boolean { + npcl(FacialExpression.NEUTRAL, "Good day to you.") + return true + } + + override fun handle(interfaceId: Int, buttonId: Int): Boolean { + when(stage){ + 0 -> playerl(FacialExpression.ASKING, "Hello. What are you up to?").also { stage++ } + 1 -> npcl(FacialExpression.HAPPY, "Ah, today is a surströmming day! The herring I buried six months ago is ready to be dug up.").also { stage++ } + 2 -> playerl(FacialExpression.DISGUSTED, "Eughr! What are you going to do with it?").also { stage++ } + 3 -> npcl(FacialExpression.HAPPY, "Eat it, of course! It will be fermented just-right by now.").also { stage++ } + 4 -> playerl(FacialExpression.ASKING, "Fermented? You eat rotten fish?").also { stage++ } + 5 -> npcl(FacialExpression.HAPPY, "Hmmm, tasty. I'm guessing you don't want to come round and try it?").also { stage++ } + 6 -> playerl(FacialExpression.ANNOYED, "You guess correctly.").also { stage = END_DIALOGUE } + } + return true + } + + override fun getIds(): IntArray { + return intArrayOf(NPCs.MORTEN_HOLDSTROM_5510) + } + +} \ No newline at end of file diff --git a/Server/src/main/kotlin/rs09/game/content/dialogue/region/neitiznot/SlugHemliggsenDialogue.kt b/Server/src/main/kotlin/rs09/game/content/dialogue/region/neitiznot/SlugHemliggsenDialogue.kt new file mode 100644 index 000000000..418b55d14 --- /dev/null +++ b/Server/src/main/kotlin/rs09/game/content/dialogue/region/neitiznot/SlugHemliggsenDialogue.kt @@ -0,0 +1,31 @@ +package rs09.game.content.dialogue.region.neitiznot + +import core.game.content.dialogue.DialoguePlugin +import core.game.content.dialogue.FacialExpression +import core.game.node.entity.player.Player +import core.plugin.Initializable +import org.rs09.consts.NPCs +import rs09.tools.END_DIALOGUE + +@Initializable +class SlugHemliggsenDialogue(player: Player? = null) : DialoguePlugin(player) { + override fun newInstance(player: Player?): DialoguePlugin { + return SlugHemliggsenDialogue(player) + } + + override fun open(vararg args: Any?): Boolean { + npcl(FacialExpression.WORRIED, "Shhh. Go away. I'm not allowed to talk to you.") + return true + } + + override fun handle(interfaceId: Int, buttonId: Int): Boolean { + playerl(FacialExpression.ANNOYED, "Fine, whatever ...") + stage = END_DIALOGUE + return true + } + + override fun getIds(): IntArray { + return intArrayOf(NPCs.SLUG_HEMLIGSSEN_5520) + } + +} \ No newline at end of file diff --git a/Server/src/main/kotlin/rs09/game/content/dialogue/region/neitiznot/ThakkradSigmundsonDialogue.kt b/Server/src/main/kotlin/rs09/game/content/dialogue/region/neitiznot/ThakkradSigmundsonDialogue.kt new file mode 100644 index 000000000..37eaa75dd --- /dev/null +++ b/Server/src/main/kotlin/rs09/game/content/dialogue/region/neitiznot/ThakkradSigmundsonDialogue.kt @@ -0,0 +1,32 @@ +package rs09.game.content.dialogue.region.neitiznot + +import core.game.content.dialogue.DialoguePlugin +import core.game.content.dialogue.FacialExpression +import core.game.node.entity.player.Player +import core.plugin.Initializable +import org.rs09.consts.NPCs +import rs09.tools.END_DIALOGUE + +@Initializable +class ThakkradSigmundsonDialogue(player: Player? = null) : DialoguePlugin(player) { + override fun newInstance(player: Player?): DialoguePlugin { + return ThakkradSigmundsonDialogue(player) + } + + override fun open(vararg args: Any?): Boolean { + npcl(FacialExpression.FRIENDLY, "Greetings! I can cure your Yak Hides if you'd like!") + return true + } + + override fun handle(interfaceId: Int, buttonId: Int): Boolean { + when(stage){ + 0 -> playerl(FacialExpression.FRIENDLY, "Good to know!").also { stage = END_DIALOGUE } + } + return true + } + + override fun getIds(): IntArray { + return intArrayOf(NPCs.THAKKRAD_SIGMUNDSON_5506) + } + +} \ No newline at end of file diff --git a/Server/src/main/kotlin/rs09/game/content/dialogue/region/neitiznot/TrogenKonungardeDialogue.kt b/Server/src/main/kotlin/rs09/game/content/dialogue/region/neitiznot/TrogenKonungardeDialogue.kt new file mode 100644 index 000000000..244e9f499 --- /dev/null +++ b/Server/src/main/kotlin/rs09/game/content/dialogue/region/neitiznot/TrogenKonungardeDialogue.kt @@ -0,0 +1,32 @@ +package rs09.game.content.dialogue.region.neitiznot + +import core.game.content.dialogue.DialoguePlugin +import core.game.content.dialogue.FacialExpression +import core.game.node.entity.player.Player +import core.plugin.Initializable +import org.rs09.consts.NPCs +import rs09.tools.END_DIALOGUE + +@Initializable +class TrogenKonungardeDialogue(player: Player? = null) : DialoguePlugin(player) { + override fun newInstance(player: Player?): DialoguePlugin { + return TrogenKonungardeDialogue(player) + } + + override fun open(vararg args: Any?): Boolean { + npcl(FacialExpression.NEUTRAL, "I'm guarding the king, I cannot speak.") + return true + } + + override fun handle(interfaceId: Int, buttonId: Int): Boolean { + when(stage){ + 0 -> playerl(FacialExpression.NEUTRAL, "Sorry.").also { stage = END_DIALOGUE } + } + return true + } + + override fun getIds(): IntArray { + return intArrayOf(NPCs.TROGEN_KONUNGARDE_5519) + } + +} \ No newline at end of file diff --git a/Server/src/main/kotlin/rs09/game/interaction/InteractionListeners.kt b/Server/src/main/kotlin/rs09/game/interaction/InteractionListeners.kt index afb8f8587..415b2b56c 100644 --- a/Server/src/main/kotlin/rs09/game/interaction/InteractionListeners.kt +++ b/Server/src/main/kotlin/rs09/game/interaction/InteractionListeners.kt @@ -151,6 +151,9 @@ object InteractionListeners { if(player.locks.isMovementLocked) return false player.pulseManager.run(object : MovementPulse(player, with, flag) { override fun pulse(): Boolean { + if (player.zoneMonitor.useWith(used.asItem(), with)) { + return true + } player.faceLocation(with.location) if(flipped) method.invoke(player,with,used) else method.invoke(player,used,with) 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 723a1bb88..ef36111a2 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 @@ -19,6 +19,7 @@ class JatizsoListeners : InteractionListener() { val WEST_GATE_ZONE = ZoneBorders(2386,3797,2390,3801) val SOUTH_GAE_ZONE = ZoneBorders(2411,3795,2414,3799) val BELL = 21394 + val TOWER_GUARDS = intArrayOf(NPCs.GUARD_5490, NPCs.GUARD_5489) val GUARDS = intArrayOf(NPCs.GUARD_5491, NPCs.GUARD_5492) val KING_CHEST = intArrayOf(21299,21300) val LINES = arrayOf( @@ -75,15 +76,15 @@ class JatizsoListeners : InteractionListener() { return@on true } - on(NPCs.GUARD_5489, NPC, "watch-shouting"){player, node -> - val local = ContentAPI.findLocalNPC(player, node.id) + on(TOWER_GUARDS, NPC, "watch-shouting"){player, _ -> + val local = ContentAPI.findLocalNPC(player, NPCs.GUARD_5489) ContentAPI.lock(player, 200) ContentAPI.face(local!!, Location.create(2371, 3801, 2)) local.asNpc().isRespawn = false ContentAPI.submitIndividualPulse(player, object : Pulse(4){ - var id = node.id + var id = NPCs.GUARD_5489 var counter = 0 - val other = ContentAPI.findLocalNPC(player, getOther(node.id)) + val other = ContentAPI.findLocalNPC(player, getOther(NPCs.GUARD_5489)) override fun start() { other?.isRespawn = false @@ -92,12 +93,12 @@ class JatizsoListeners : InteractionListener() { override fun pulse(): Boolean { val npc = ContentAPI.findLocalNPC(player, id) ?: return false val index = when(id){ - node.id -> 0 + NPCs.GUARD_5489 -> 0 else -> 1 } if(index == 1 && counter == 5) return true ContentAPI.sendChat(npc, LINES[index][counter]) - if(npc.id != node.id) counter++ + if(npc.id != NPCs.GUARD_5489) counter++ id = getOther(id) return false } diff --git a/Server/src/main/kotlin/rs09/game/interaction/region/rellekka/NeitiznotListeners.kt b/Server/src/main/kotlin/rs09/game/interaction/region/rellekka/NeitiznotListeners.kt new file mode 100644 index 000000000..2526bdbde --- /dev/null +++ b/Server/src/main/kotlin/rs09/game/interaction/region/rellekka/NeitiznotListeners.kt @@ -0,0 +1,39 @@ +package rs09.game.interaction.region.rellekka + +import api.ContentAPI +import core.game.content.dialogue.FacialExpression +import core.game.node.Node +import core.game.node.entity.npc.NPC +import core.game.node.entity.player.Player +import core.game.node.item.Item +import core.game.world.map.Location +import core.game.world.map.zone.MapZone +import core.game.world.map.zone.ZoneBorders +import org.rs09.consts.NPCs +import rs09.game.interaction.InteractionListener + +class NeitiznotListeners : InteractionListener() { + val STUMP = 21305 + + override fun defineListeners() { + + on(STUMP, SCENERY, "cut-wood"){player, _ -> + ContentAPI.sendPlayerDialogue(player, "I should probably leave this alone.", FacialExpression.HALF_THINKING) + return@on true + } + + val zone = object : MapZone("Yakzone", true){ + override fun handleUseWith(player: Player, used: Item?, with: Node?): Boolean { + if(with is NPC && with.id == NPCs.YAK_5529){ + ContentAPI.sendMessage(player, "The cow doesn't want that.") + return true + } + return false + } + } + + ContentAPI.registerMapZone(zone, ZoneBorders(2313,3786,2331,3802)) + ContentAPI.addClimbDest(Location.create(2363, 3799, 0), Location.create(2364, 3799, 2)) + ContentAPI.addClimbDest(Location.create(2363, 3799, 2), Location.create(2362, 3799, 0)) + } +} \ No newline at end of file diff --git a/Server/src/main/kotlin/rs09/game/node/entity/npc/other/IceTrollJatizsoCaves.kt b/Server/src/main/kotlin/rs09/game/node/entity/npc/other/IceTrollJatizsoCaves.kt new file mode 100644 index 000000000..3cbd154a5 --- /dev/null +++ b/Server/src/main/kotlin/rs09/game/node/entity/npc/other/IceTrollJatizsoCaves.kt @@ -0,0 +1,34 @@ +package rs09.game.node.entity.npc.other + +import api.ContentAPI +import core.game.node.entity.npc.AbstractNPC +import core.game.world.map.Location +import core.plugin.Initializable +import core.tools.RandomFunction +import org.rs09.consts.NPCs +import rs09.game.system.SystemLogger + +@Initializable +class IceTrollJatizsoCaves : AbstractNPC { + //Constructor spaghetti because Arios I guess + constructor() : super(NPCs.ICE_TROLL_MALE_5474, null, true) {} + private constructor(id: Int, location: Location) : super(id, location) {} + + override fun construct(id: Int, location: Location, vararg objects: Any?): AbstractNPC { + return IceTrollJatizsoCaves(id, location) + } + + override fun getIds(): IntArray { + return intArrayOf(NPCs.ICE_TROLL_MALE_5474,NPCs.ICE_TROLL_RUNT_5473,NPCs.ICE_TROLL_FEMALE_5475) + } + + override fun tick() { + val nearbyMiner = ContentAPI.findLocalNPC(this, NPCs.MINER_5497) ?: return super.tick() + if(!inCombat() && nearbyMiner.location.withinDistance(location, 8)){ + attack(nearbyMiner) + } + super.tick() + } + + +} \ No newline at end of file diff --git a/Server/src/main/kotlin/rs09/game/node/entity/npc/other/YakNPC.kt b/Server/src/main/kotlin/rs09/game/node/entity/npc/other/YakNPC.kt new file mode 100644 index 000000000..c26ba2803 --- /dev/null +++ b/Server/src/main/kotlin/rs09/game/node/entity/npc/other/YakNPC.kt @@ -0,0 +1,30 @@ +package rs09.game.node.entity.npc.other + +import core.game.node.entity.npc.AbstractNPC +import core.game.world.map.Location +import core.plugin.Initializable +import core.tools.RandomFunction +import org.rs09.consts.NPCs + +@Initializable +class YakNPC : AbstractNPC { + //Constructor spaghetti because Arios I guess + constructor() : super(NPCs.ICE_TROLL_MALE_5474, null, true) {} + private constructor(id: Int, location: Location) : super(id, location) {} + + override fun construct(id: Int, location: Location, vararg objects: Any?): AbstractNPC { + return YakNPC(id,location) + } + + override fun getIds(): IntArray { + return intArrayOf(NPCs.YAK_5529) + } + + override fun tick() { + if(RandomFunction.roll(20)){ + sendChat("Moo") + } + super.tick() + } + +} \ No newline at end of file diff --git a/Server/src/main/kotlin/rs09/game/system/command/sets/FunCommandSet.kt b/Server/src/main/kotlin/rs09/game/system/command/sets/FunCommandSet.kt index 1878789e2..c6e6cf2bf 100644 --- a/Server/src/main/kotlin/rs09/game/system/command/sets/FunCommandSet.kt +++ b/Server/src/main/kotlin/rs09/game/system/command/sets/FunCommandSet.kt @@ -1,13 +1,20 @@ package rs09.game.system.command.sets +import api.ContentAPI import core.game.content.quest.tutorials.tutorialisland.CharacterDesign import core.game.node.entity.npc.NPC +import core.game.node.entity.player.Player import core.game.system.task.Pulse +import core.game.world.map.Location import core.game.world.map.RegionManager import core.game.world.update.flag.context.Animation import core.plugin.Initializable +import rs09.game.content.dialogue.DialogueFile +import rs09.game.interaction.InteractionListeners +import rs09.game.interaction.SpadeDigListener import rs09.game.system.command.Command import rs09.game.world.GameWorld +import rs09.tools.END_DIALOGUE import java.util.* @Initializable @@ -116,5 +123,42 @@ class FunCommandSet : CommandSet(Command.Privilege.ADMIN) { define("makeover", Command.Privilege.MODERATOR){ player, _ -> CharacterDesign.open(player) } + + /** + * Bury inventory at current location + */ + define("bury"){player, _ -> + if(player.inventory.isEmpty){ + reject(player, "You have no items to bury.") + } + + player.dialogueInterpreter.open(object : DialogueFile(){ + override fun handle(componentID: Int, buttonID: Int) { + when(stage){ + 0 -> dialogue("This will bury your whole inventory in this spot.","Are you sure?").also { stage++ } + 1 -> options("Yes","No").also { stage++ } + 2 -> when(buttonID){ + 1 -> bury(player).also { end() } + 2 -> stage = END_DIALOGUE + } + } + } + }) + + } + } + + fun bury(player: Player){ + val loc = Location.create(player.location) + val inv = player.inventory.toArray().filterNotNull() + SpadeDigListener.registerListener(player.location){p -> + for(item in inv){ + ContentAPI.addItemOrDrop(p, item.id, item.amount) + ContentAPI.sendMessage(p, "You dig and find ${if(item.amount > 1) "some" else "a"} ${item.name}") + } + SpadeDigListener.listeners.remove(loc) + } + player.inventory.clear() + notify(player, "You have buried your loot at ${loc.toString()}") } } diff --git a/Server/src/main/kotlin/rs09/game/system/command/sets/MiscCommandSet.kt b/Server/src/main/kotlin/rs09/game/system/command/sets/MiscCommandSet.kt index f9142922b..85be2c318 100644 --- a/Server/src/main/kotlin/rs09/game/system/command/sets/MiscCommandSet.kt +++ b/Server/src/main/kotlin/rs09/game/system/command/sets/MiscCommandSet.kt @@ -479,28 +479,5 @@ class MiscCommandSet : CommandSet(Command.Privilege.ADMIN){ notify(player,"No parent NPC found.") } } - - - define("bury"){player,args -> - if(args.size < 2){ - reject(player,"Usage: ::bury itemid") - } - - val itemId = args[1].toInt() - val def = ItemDefinition.forId(itemId) - - SpadeDigListener.registerListener(player.location){pl -> - if(player.getAttribute("${player.location.toString()}:$itemId",false)){ - pl.sendMessage("You dig and find nothing.") - return@registerListener - } - pl.dialogueInterpreter.sendDialogue("You dig and find a ${def.name}!") - player.inventory.add(Item(itemId)) - player.setExpirableAttribute("/save:${player.location.toString()}:$itemId",true,TimeUnit.SECONDS.toMillis(10)) - } - - notify(player,"You buried a ${def.name} at ${player.location}") - } - } } \ No newline at end of file diff --git a/Server/src/main/kotlin/rs09/game/system/command/sets/ModerationCommandSet.kt b/Server/src/main/kotlin/rs09/game/system/command/sets/ModerationCommandSet.kt index 756463cff..d6a9e47d6 100644 --- a/Server/src/main/kotlin/rs09/game/system/command/sets/ModerationCommandSet.kt +++ b/Server/src/main/kotlin/rs09/game/system/command/sets/ModerationCommandSet.kt @@ -1,6 +1,7 @@ package rs09.game.system.command.sets import core.game.node.entity.player.Player +import core.game.node.entity.player.info.Rights import rs09.game.system.command.Command import core.game.system.task.Pulse import rs09.game.world.GameWorld @@ -59,8 +60,7 @@ class ModerationCommandSet : CommandSet(Command.Privilege.MODERATOR){ reject(player, "Can not find $name in the player list!") } - val NameCheck = name.toLowerCase() - if (NameCheck == "kermit" || NameCheck == "ceikry"){ + if (otherPlayer?.rights == Rights.ADMINISTRATOR){ reject(player, "You cannot jail $name, they are a god. Nice try though ${player.username}!") } diff --git a/Server/src/main/kotlin/rs09/net/packet/PacketWriteQueue.kt b/Server/src/main/kotlin/rs09/net/packet/PacketWriteQueue.kt index e25fbf0eb..cd20b29f9 100644 --- a/Server/src/main/kotlin/rs09/net/packet/PacketWriteQueue.kt +++ b/Server/src/main/kotlin/rs09/net/packet/PacketWriteQueue.kt @@ -23,7 +23,6 @@ object PacketWriteQueue { @JvmStatic fun queue(packet: OutgoingPacket, context: T){ - SystemLogger.logInfo("Queueing ${packet.javaClass.simpleName}") PacketsToWrite.add(QueuedPacket(packet,context)) }