Merge remote-tracking branch 'upstream/master'

This commit is contained in:
skelsoft
2021-07-11 07:19:43 +10:00
27 changed files with 533 additions and 41 deletions
+6
View File
@@ -2266,5 +2266,11 @@
"name": "Norse Code", "name": "Norse Code",
"indexId": "439", "indexId": "439",
"borders": "{2404,3797,2421,3820}" "borders": "{2404,3797,2421,3820}"
},
{
"id": "225",
"name": "Volcanic Vikings",
"indexId": "440",
"borders": "{2304,3785,2635,3818}"
} }
] ]
+5 -1
View File
@@ -7745,7 +7745,7 @@
}, },
{ {
"npc_id": "5529", "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", "npc_id": "5531",
@@ -10682,5 +10682,9 @@
{ {
"npc_id": "5482", "npc_id": "5482",
"loc_data": "{2422,3781,0,1,0}" "loc_data": "{2422,3781,0,1,0}"
},
{
"npc_id": "5463",
"loc_data": "{2324,3809,0,1,0}-{2317,3802,0,1,0}"
} }
] ]
@@ -73,7 +73,9 @@ public final class ClimbActionHandler {
if (SpecialLadders.getDestination(startLadder.getLocation()) != null) { if (SpecialLadders.getDestination(startLadder.getLocation()) != null) {
Location destination = SpecialLadders.getDestination(startLadder.getLocation()); Location destination = SpecialLadders.getDestination(startLadder.getLocation());
climb(player, animation, destination); climb(player, animation, destination);
SpecialLadders.getSpecialLadder(startLadder.getLocation()).checkAchievement(player); if(SpecialLadders.getSpecialLadder(startLadder.getLocation()) != null) {
SpecialLadders.getSpecialLadder(startLadder.getLocation()).checkAchievement(player);
}
return true; return true;
} }
switch (option) { switch (option) {
@@ -25,7 +25,7 @@ public final class WaterSourcePlugin extends UseWithHandler {
/** /**
* Represents the objects to use the buckets on. * 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. * Represents the animation to use.
@@ -63,7 +63,7 @@ public final class WaterSourcePlugin extends UseWithHandler {
* @version 1.0 * @version 1.0
*/ */
public enum WaterRecipient { 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)), VIAL(new Item(229), new Item(227)),
JUG(new Item(1935), new Item(1937)), JUG(new Item(1935), new Item(1937)),
BOWL(new Item(1923), new Item(1921)), BOWL(new Item(1923), new Item(1921)),
@@ -112,6 +112,8 @@ public abstract class MapZone implements Zone {
return false; return false;
} }
public boolean handleUseWith(Player player, Item used, Node with){return false;}
/** /**
* Handles an reward button. * Handles an reward button.
* @param player The player. * @param player The player.
@@ -7,6 +7,7 @@ import core.game.node.entity.combat.CombatStyle;
import core.game.node.entity.player.Player; import core.game.node.entity.player.Player;
import core.game.node.entity.player.link.music.MusicZone; import core.game.node.entity.player.link.music.MusicZone;
import core.game.node.entity.player.link.request.RequestType; import core.game.node.entity.player.link.request.RequestType;
import core.game.node.item.Item;
import core.game.world.map.Location; import core.game.world.map.Location;
import java.util.ArrayList; import java.util.ArrayList;
@@ -149,6 +150,18 @@ public final class ZoneMonitor {
return false; 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. * Checks if the player handled the reward button using a map zone.
* @param interfaceId The interface id. * @param interfaceId The interface id.
@@ -72,6 +72,9 @@ public class ItemActionPacket implements IncomingPacket {
if(InteractionListeners.run(item,npc,2,player)){ if(InteractionListeners.run(item,npc,2,player)){
return; return;
} }
if(player.getZoneMonitor().useWith(used,npc)){
return;
}
event = new NodeUsageEvent(player, interfaceId, item, npc); event = new NodeUsageEvent(player, interfaceId, item, npc);
try { try {
UseWithHandler.run(event); UseWithHandler.run(event);
@@ -97,6 +100,9 @@ public class ItemActionPacket implements IncomingPacket {
if(PluginInteractionManager.handle(player,event)){ if(PluginInteractionManager.handle(player,event)){
return; return;
} }
if(player.getZoneMonitor().useWith(used,player)){
return;
}
event = new NodeUsageEvent(player, interfaceId, item, target); event = new NodeUsageEvent(player, interfaceId, item, target);
try { try {
UseWithHandler.run(event); UseWithHandler.run(event);
@@ -131,6 +137,9 @@ public class ItemActionPacket implements IncomingPacket {
if(InteractionListeners.run(used,with,0,player)){ if(InteractionListeners.run(used,with,0,player)){
return; return;
} }
if(player.getZoneMonitor().useWith(used,with)){
return;
}
if (usedItemId < usedWithItemId) { if (usedItemId < usedWithItemId) {
item = used; item = used;
used = with; used = with;
@@ -182,6 +191,9 @@ public class ItemActionPacket implements IncomingPacket {
if(InteractionListeners.run(used,object,1,player)){ if(InteractionListeners.run(used,object,1,player)){
return; return;
} }
if(player.getZoneMonitor().useWith(used,object)){
return;
}
event = new NodeUsageEvent(player, 0, used, object); event = new NodeUsageEvent(player, 0, used, object);
/** /**
+10
View File
@@ -593,6 +593,16 @@ object ContentAPI {
return RegionManager.getLocalNpcs(entity).firstOrNull { it.id == id } 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<NPC>{
return RegionManager.getSurroundingNPCs(entity).filter { it.id in ids }.toList()
}
/** /**
* Gets the value of an attribute key from the Entity's attributes store * Gets the value of an attribute key from the Entity's attributes store
* @param entity the entity to get the attribute from * @param entity the entity to get the attribute from
@@ -28,14 +28,14 @@ class TowerGuardDialogue(player: Player? = null) : DialoguePlugin(player) {
1 -> playerl(FacialExpression.HALF_THINKING, "No need to shout.").also { stage++ } 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++ } 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++ } 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++ } 5 -> playerl(FacialExpression.ASKING, "Err, why?" ).also { stage++ }
6 -> npc(FacialExpression.NEUTRAL, "THE KING TELLS US TO.").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 King is a strange person.").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++ } 8 -> options("Can I watch? I'm curious.", "Oh well, I'd better get going.").also { stage++ }
9 -> when(buttonId){ 9 -> when(buttonId){
1 -> playerl(FacialExpression.ASKING, "Can I watch? I'm curious.").also { stage++ } 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 { 10 -> npcl(FacialExpression.NEUTRAL, "IF YOU LIKE!").also {
stage = END_DIALOGUE stage = END_DIALOGUE
@@ -46,7 +46,7 @@ class TowerGuardDialogue(player: Player? = null) : DialoguePlugin(player) {
} }
override fun getIds(): IntArray { override fun getIds(): IntArray {
return intArrayOf(NPCs.GUARD_5489) return intArrayOf(NPCs.GUARD_5489, NPCs.GUARD_5490)
} }
} }
@@ -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)
}
}
@@ -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)
}
}
@@ -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)
}
}
@@ -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)
}
}
@@ -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)
}
}
@@ -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)
}
}
@@ -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)
}
}
@@ -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)
}
}
@@ -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)
}
}
@@ -151,6 +151,9 @@ object InteractionListeners {
if(player.locks.isMovementLocked) return false if(player.locks.isMovementLocked) return false
player.pulseManager.run(object : MovementPulse(player, with, flag) { player.pulseManager.run(object : MovementPulse(player, with, flag) {
override fun pulse(): Boolean { override fun pulse(): Boolean {
if (player.zoneMonitor.useWith(used.asItem(), with)) {
return true
}
player.faceLocation(with.location) player.faceLocation(with.location)
if(flipped) method.invoke(player,with,used) if(flipped) method.invoke(player,with,used)
else method.invoke(player,used,with) else method.invoke(player,used,with)
@@ -19,6 +19,7 @@ class JatizsoListeners : InteractionListener() {
val WEST_GATE_ZONE = ZoneBorders(2386,3797,2390,3801) val WEST_GATE_ZONE = ZoneBorders(2386,3797,2390,3801)
val SOUTH_GAE_ZONE = ZoneBorders(2411,3795,2414,3799) val SOUTH_GAE_ZONE = ZoneBorders(2411,3795,2414,3799)
val BELL = 21394 val BELL = 21394
val TOWER_GUARDS = intArrayOf(NPCs.GUARD_5490, NPCs.GUARD_5489)
val GUARDS = intArrayOf(NPCs.GUARD_5491, NPCs.GUARD_5492) val GUARDS = intArrayOf(NPCs.GUARD_5491, NPCs.GUARD_5492)
val KING_CHEST = intArrayOf(21299,21300) val KING_CHEST = intArrayOf(21299,21300)
val LINES = arrayOf( val LINES = arrayOf(
@@ -75,15 +76,15 @@ class JatizsoListeners : InteractionListener() {
return@on true return@on true
} }
on(NPCs.GUARD_5489, NPC, "watch-shouting"){player, node -> on(TOWER_GUARDS, NPC, "watch-shouting"){player, _ ->
val local = ContentAPI.findLocalNPC(player, node.id) val local = ContentAPI.findLocalNPC(player, NPCs.GUARD_5489)
ContentAPI.lock(player, 200) ContentAPI.lock(player, 200)
ContentAPI.face(local!!, Location.create(2371, 3801, 2)) ContentAPI.face(local!!, Location.create(2371, 3801, 2))
local.asNpc().isRespawn = false local.asNpc().isRespawn = false
ContentAPI.submitIndividualPulse(player, object : Pulse(4){ ContentAPI.submitIndividualPulse(player, object : Pulse(4){
var id = node.id var id = NPCs.GUARD_5489
var counter = 0 var counter = 0
val other = ContentAPI.findLocalNPC(player, getOther(node.id)) val other = ContentAPI.findLocalNPC(player, getOther(NPCs.GUARD_5489))
override fun start() { override fun start() {
other?.isRespawn = false other?.isRespawn = false
@@ -92,12 +93,12 @@ class JatizsoListeners : InteractionListener() {
override fun pulse(): Boolean { override fun pulse(): Boolean {
val npc = ContentAPI.findLocalNPC(player, id) ?: return false val npc = ContentAPI.findLocalNPC(player, id) ?: return false
val index = when(id){ val index = when(id){
node.id -> 0 NPCs.GUARD_5489 -> 0
else -> 1 else -> 1
} }
if(index == 1 && counter == 5) return true if(index == 1 && counter == 5) return true
ContentAPI.sendChat(npc, LINES[index][counter]) ContentAPI.sendChat(npc, LINES[index][counter])
if(npc.id != node.id) counter++ if(npc.id != NPCs.GUARD_5489) counter++
id = getOther(id) id = getOther(id)
return false return false
} }
@@ -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))
}
}
@@ -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()
}
}
@@ -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()
}
}
@@ -1,13 +1,20 @@
package rs09.game.system.command.sets package rs09.game.system.command.sets
import api.ContentAPI
import core.game.content.quest.tutorials.tutorialisland.CharacterDesign import core.game.content.quest.tutorials.tutorialisland.CharacterDesign
import core.game.node.entity.npc.NPC import core.game.node.entity.npc.NPC
import core.game.node.entity.player.Player
import core.game.system.task.Pulse import core.game.system.task.Pulse
import core.game.world.map.Location
import core.game.world.map.RegionManager import core.game.world.map.RegionManager
import core.game.world.update.flag.context.Animation import core.game.world.update.flag.context.Animation
import core.plugin.Initializable 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.system.command.Command
import rs09.game.world.GameWorld import rs09.game.world.GameWorld
import rs09.tools.END_DIALOGUE
import java.util.* import java.util.*
@Initializable @Initializable
@@ -116,5 +123,42 @@ class FunCommandSet : CommandSet(Command.Privilege.ADMIN) {
define("makeover", Command.Privilege.MODERATOR){ player, _ -> define("makeover", Command.Privilege.MODERATOR){ player, _ ->
CharacterDesign.open(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()}")
} }
} }
@@ -479,28 +479,5 @@ class MiscCommandSet : CommandSet(Command.Privilege.ADMIN){
notify(player,"No parent NPC found.") 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}")
}
} }
} }
@@ -1,6 +1,7 @@
package rs09.game.system.command.sets package rs09.game.system.command.sets
import core.game.node.entity.player.Player import core.game.node.entity.player.Player
import core.game.node.entity.player.info.Rights
import rs09.game.system.command.Command import rs09.game.system.command.Command
import core.game.system.task.Pulse import core.game.system.task.Pulse
import rs09.game.world.GameWorld 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!") reject(player, "Can not find $name in the player list!")
} }
val NameCheck = name.toLowerCase() if (otherPlayer?.rights == Rights.ADMINISTRATOR){
if (NameCheck == "kermit" || NameCheck == "ceikry"){
reject(player, "You cannot jail $name, they are a god. Nice try though ${player.username}!") reject(player, "You cannot jail $name, they are a god. Nice try though ${player.username}!")
} }
@@ -23,7 +23,6 @@ object PacketWriteQueue {
@JvmStatic @JvmStatic
fun <T> queue(packet: OutgoingPacket<T>, context: T){ fun <T> queue(packet: OutgoingPacket<T>, context: T){
SystemLogger.logInfo("Queueing ${packet.javaClass.simpleName}")
PacketsToWrite.add(QueuedPacket(packet,context)) PacketsToWrite.add(QueuedPacket(packet,context))
} }