Rewrote some Varrock plugins

Removed duplicated handlers for many Varrock related stairs and ladders
Fixed the Champions' Guild trapdoor being unable to be closed
Changed the model ID for the logs outside of Seth Groats's house when the axe is taken
The drawers in Guidor's house will no longer disappear. There doesn't appear to be a related open object, so they just won't open
The Benny NPC yells about newspapers again
Knocking on the door in the Varrock bank will start the dialogue with the bankers
The Varrock Census object in the Varrock castle will now open the Varrock Census interface
Added sounds for opening/closing drawers, wardrobes, and cupboards and animations for wardrobes
Added the Kudos overlay in the Varrock Museum
Corrected the spawns for archeologists in the Varrock Museum dig site area
Implemented the Varrock museum map interface to open from the objects and item
The tool shelf in the museum dig site area will now give items
Looking at the displays in the in the Natural History area of the museum will open the interface for the exam and provided some notes
This commit is contained in:
Bonesy 2024-10-06 13:12:33 +00:00 committed by Ryan
parent 3982258500
commit cc8dd4edb4
26 changed files with 612 additions and 808 deletions

View file

@ -157,7 +157,7 @@
},
{
"npc_id": "47",
"loc_data": "{2821,3170,0,1,1}-{3076,3282,0,1,5}-{3089,3266,0,1,4}-{3091,3266,0,1,4}-{3341,3267,0,1,5}-{3097,3364,0,1,3}-{3102,3363,0,1,5}-{3127,3487,0,1,4}-{3125,3486,0,1,6}-{3127,3486,0,1,4}-{2603,9480,0,1,1}-{2600,9477,0,1,0}-{2579,9496,0,1,4}-{2580,9508,0,1,0}-{2571,9522,0,1,4}-{2565,9505,0,1,1}-{2566,9510,0,1,6}-{2594,9497,0,1,4}-{2852,9642,0,1,6}-{2858,9632,0,1,3}-{2568,9620,0,1,0}-{2573,9612,0,1,0}-{2579,9631,0,1,0}-{2580,9600,0,1,0}-{2580,9614,0,1,0}-{2580,9620,0,1,0}-{2580,9626,0,1,0}-{2583,9632,0,1,0}-{2584,9625,0,1,0}-{2584,9637,0,1,0}-{2589,9644,0,1,0}-{2590,9601,0,1,0}-{2590,9638,0,1,0}-{2591,9601,0,1,0}-{2591,9621,0,1,0}-{2594,9636,0,1,0}-{2594,9644,0,1,0}-{2597,9604,0,1,0}-{2607,9615,0,1,0}-{2608,9628,0,1,0}-{2614,9651,0,1,0}-{2614,9656,0,1,0}-{2615,9647,0,1,0}-{2615,9661,0,1,0}-{2616,9633,0,1,0}-{2618,9630,0,1,0}-{3108,9754,0,1,5}-{3110,9754,0,1,5}-{3108,9750,0,1,5}-{2592,9831,0,1,3}-{2588,9825,0,1,6}-{2583,9829,0,1,4}-{2581,9841,0,1,0}-{2597,9823,0,1,2}-{2579,9805,0,1,3}-{2576,9804,0,1,0}-{2573,9805,0,1,5}-{2571,9808,0,1,3}-{2576,9810,0,1,2}-{2587,9802,0,1,2}-{2592,9800,0,1,4}-{2596,9805,0,1,6}-{2601,9802,0,1,5}-{2585,9801,0,1,7}-{2594,9803,0,1,0}-{2590,9806,0,1,3}-{2612,9808,0,1,6}-{2604,9810,0,1,6}-{2579,9821,0,1,2}-{2576,9812,0,1,6}-{2580,9813,0,1,6}-{2600,9813,0,1,4}-{2599,9809,0,1,4}-{3158,3226,0,1,5}-{3160,3202,0,1,4}-{3192,3203,0,1,0}-{3194,3204,0,1,0}-{3196,3206,0,1,0}-{3197,3204,0,1,0}-{2654,9640,0,1,6}-{2655,9637,0,1,4}-{2656,9639,0,1,7}-{2651,9636,0,1,5}-{2648,9637,0,1,4}-{2651,9642,0,1,1}-{2654,9640,0,1,0}-{2654,9635,0,1,6}-{2655,9635,0,1,3}-{2664,9626,0,1,6}-{2664,9624,0,1,1}-{2661,9623,0,1,1}-{2663,9623,0,1,3}-{2664,9626,0,1,6}-{2930,9699,0,1,0}-{2933,9697,0,1,0}-{2932,9685,0,1,0}-{2930,9693,0,1,0}-{3235,3224,0,1,3}-{3229,3220,0,1,4}-{3211,3211,0,1,3}-{3225,3220,0,1,1}-{3237,3215,0,1,5}-{3211,3210,0,1,7}-{3227,3220,0,1,7}-{3233,3227,0,1,5}-{3227,3210,0,1,6}-{3228,3222,0,1,4}-{3229,3226,0,1,0}-{3236,3217,0,1,4}-{3259,3230,0,1,4}-{3233,3237,0,1,7}-{3205,3204,0,1,0}-{3206,3204,0,1,0}-{3205,3203,0,1,0}-{3206,3202,0,1,0}-{3207,3202,0,1,0}-{3208,3203,0,1,0}-{3001,3202,0,1,5}-{3243,3687,0,1,5}-{3249,3669,0,1,3}-{3252,3675,0,1,4}-{3252,3680,0,1,3}-{3259,3683,0,1,0}-{3475,9840,0,1,6}-{3481,9842,0,1,1}-{3486,9843,0,1,7}-{3483,9824,0,1,4}-{3496,9808,0,0,5}-{3490,9815,0,1,1}-{3478,9834,0,0,3}-{3490,9824,0,1,4}-{3225,9862,0,1,4}-{3222,9861,0,1,6}-{3220,9860,0,1,6}-{3219,9865,0,1,6}-{3237,9862,0,1,4}-{2536,2982,0,1,3}-{2531,2980,0,1,0}-{2522,2981,0,1,4}-{2545,2989,0,1,4}-{2523,2970,0,1,2}-{3026,3174,0,1,5}-{3019,3176,0,1,7}-{2801,3158,0,1,2}-{2514,3193,0,1,6}-{2518,3192,0,1,3}-{2507,3181,0,1,3}-{2508,3178,0,1,6}-{2511,3183,0,1,3}-{2515,3182,0,1,1}-{3021,3205,0,1,6}-{3019,3292,0,1,7}-{3018,3295,0,1,7}-{2531,3325,0,1,3}-{2530,3327,0,1,5}-{2521,3331,0,1,3}-{2526,3328,0,1,3}-{2523,3331,0,1,4}-{2523,3334,0,1,1}-{2531,3329,0,1,5}-{2532,3333,0,1,5}-{3276,9871,0,1,1}-{3277,9871,0,1,3}-"
"loc_data": "{2821,3170,0,1,1}-{3341,3267,0,1,5}-{3076,3282,0,1,5}-{3089,3266,0,1,4}-{3091,3266,0,1,4}-{3097,3364,0,1,3}-{3102,3363,0,1,5}-{3127,3487,0,1,4}-{3125,3486,0,1,6}-{3127,3486,0,1,4}-{2603,9480,0,1,1}-{2600,9477,0,1,0}-{2579,9496,0,1,4}-{2580,9508,0,1,0}-{2571,9522,0,1,4}-{2565,9505,0,1,1}-{2566,9510,0,1,6}-{2594,9497,0,1,4}-{2852,9642,0,1,6}-{2858,9632,0,1,3}-{2568,9620,0,1,0}-{2573,9612,0,1,0}-{2579,9631,0,1,0}-{2580,9600,0,1,0}-{2580,9614,0,1,0}-{2580,9620,0,1,0}-{2580,9626,0,1,0}-{2583,9632,0,1,0}-{2584,9625,0,1,0}-{2584,9637,0,1,0}-{2589,9644,0,1,0}-{2590,9601,0,1,0}-{2590,9638,0,1,0}-{2591,9601,0,1,0}-{2591,9621,0,1,0}-{2594,9636,0,1,0}-{2594,9644,0,1,0}-{2597,9604,0,1,0}-{2607,9615,0,1,0}-{2608,9628,0,1,0}-{2614,9651,0,1,0}-{2614,9656,0,1,0}-{2615,9647,0,1,0}-{2615,9661,0,1,0}-{2616,9633,0,1,0}-{2618,9630,0,1,0}-{3108,9754,0,1,5}-{3110,9754,0,1,5}-{3108,9750,0,1,5}-{2592,9831,0,1,3}-{2588,9825,0,1,6}-{2583,9829,0,1,4}-{2581,9841,0,1,0}-{2597,9823,0,1,2}-{2579,9805,0,1,3}-{2576,9804,0,1,0}-{2573,9805,0,1,5}-{2571,9808,0,1,3}-{2576,9810,0,1,2}-{2587,9802,0,1,2}-{2592,9800,0,1,4}-{2596,9805,0,1,6}-{2601,9802,0,1,5}-{2585,9801,0,1,7}-{2594,9803,0,1,0}-{2590,9806,0,1,3}-{2612,9808,0,1,6}-{2604,9810,0,1,6}-{2579,9821,0,1,2}-{2576,9812,0,1,6}-{2580,9813,0,1,6}-{2600,9813,0,1,4}-{2599,9809,0,1,4}-{3158,3226,0,1,5}-{3160,3202,0,1,4}-{3192,3203,0,1,0}-{3194,3204,0,1,0}-{3196,3206,0,1,0}-{3197,3204,0,1,0}-{2654,9640,0,1,6}-{2655,9637,0,1,4}-{2656,9639,0,1,7}-{2651,9636,0,1,5}-{2648,9637,0,1,4}-{2651,9642,0,1,1}-{2654,9640,0,1,0}-{2654,9635,0,1,6}-{2655,9635,0,1,3}-{2664,9626,0,1,6}-{2664,9624,0,1,1}-{2661,9623,0,1,1}-{2663,9623,0,1,3}-{2664,9626,0,1,6}-{2930,9699,0,1,0}-{2933,9697,0,1,0}-{2932,9685,0,1,0}-{2930,9693,0,1,0}-{3235,3224,0,1,3}-{3229,3220,0,1,4}-{3211,3211,0,1,3}-{3225,3220,0,1,1}-{3237,3215,0,1,5}-{3211,3210,0,1,7}-{3227,3220,0,1,7}-{3233,3227,0,1,5}-{3227,3210,0,1,6}-{3228,3222,0,1,4}-{3229,3226,0,1,0}-{3236,3217,0,1,4}-{3259,3230,0,1,4}-{3233,3237,0,1,7}-{3205,3204,0,1,0}-{3206,3204,0,1,0}-{3205,3203,0,1,0}-{3206,3202,0,1,0}-{3207,3202,0,1,0}-{3208,3203,0,1,0}-{3001,3202,0,1,5}-{3243,3687,0,1,5}-{3249,3669,0,1,3}-{3252,3675,0,1,4}-{3252,3680,0,1,3}-{3259,3683,0,1,0}-{3475,9840,0,1,6}-{3481,9842,0,1,1}-{3486,9843,0,1,7}-{3483,9824,0,1,4}-{3496,9808,0,0,5}-{3490,9815,0,1,1}-{3478,9834,0,0,3}-{3490,9824,0,1,4}-{3225,9862,0,1,4}-{3222,9861,0,1,6}-{3220,9860,0,1,6}-{3219,9865,0,1,6}-{3237,9862,0,1,4}-{2536,2982,0,1,3}-{2531,2980,0,1,0}-{2522,2981,0,1,4}-{2545,2989,0,1,4}-{2523,2970,0,1,2}-{3026,3174,0,1,5}-{3019,3176,0,1,7}-{2801,3158,0,1,2}-{2514,3193,0,1,6}-{2518,3192,0,1,3}-{2507,3181,0,1,3}-{2508,3178,0,1,6}-{2511,3183,0,1,3}-{2515,3182,0,1,1}-{3021,3205,0,1,6}-{3019,3292,0,1,7}-{3018,3295,0,1,7}-{2531,3325,0,1,3}-{2530,3327,0,1,5}-{2521,3331,0,1,3}-{2526,3328,0,1,3}-{2523,3331,0,1,4}-{2523,3334,0,1,1}-{2531,3329,0,1,5}-{2532,3333,0,1,5}-{3276,9871,0,1,1}-{3277,9871,0,1,3}-"
},
{
"npc_id": "48",
@ -9677,19 +9677,27 @@
},
{
"npc_id": "5932",
"loc_data": "{3255,3442,0,0,0}-"
"loc_data": "{3253,3445,0,0,6}-"
},
{
"npc_id": "5933",
"loc_data": "{3254,3443,0,0,0}-"
"loc_data": "{3254,3444,0,0,1}-"
},
{
"npc_id": "5934",
"loc_data": "{3259,3443,0,0,0}-"
"loc_data": "{3256,3443,0,0,6}-"
},
{
"npc_id": "5935",
"loc_data": "{3260,3442,0,0,0}-"
"loc_data": "{3257,3442,0,0,1}-"
},
{
"npc_id": "5936",
"loc_data": "{3266,3445,0,0,6}-"
},
{
"npc_id": "5937",
"loc_data": "{3267,3444,0,0,1}-"
},
{
"npc_id": "5938",

View file

@ -114,7 +114,6 @@ class ChampionChallengeListener : InteractionListener, MapArea {
)
private val PORTCULLIS = Scenery.PORTCULLIS_10553
private val LADDER = Scenery.LADDER_10554
private val CHAMPION_STATUE_CLOSED = Scenery.CHAMPION_STATUE_10556
private val CHAMPION_STATUE_OPEN = Scenery.CHAMPION_STATUE_10557
private val TRAPDOOR_CLOSED = Scenery.TRAPDOOR_10558
@ -124,6 +123,13 @@ class ChampionChallengeListener : InteractionListener, MapArea {
private val ARENA_ZONE = 12696
override fun defineListeners() {
// Champion's Guild Basement Ladder to Main Floor
addClimbDest(Location(3190, 9758, 0), Location(3190, 3356, 0))
// Champion Statue Ladder to Arena
addClimbDest(Location(3184, 9758, 0), Location(3182, 9758, 0))
// Arena Ladder to Champion's Guild Basement
addClimbDest(Location(3183, 9758, 0), Location(3185, 9758, 0))
on(LARXUS, IntType.NPC, "talk-to") { player, _ ->
openDialogue(player, LarxusDialogue(false))
return@on true
@ -134,18 +140,18 @@ class ChampionChallengeListener : InteractionListener, MapArea {
return@on true
}
on(TRAPDOOR_CLOSED, IntType.SCENERY, "open") { _, node ->
replaceScenery(node.asScenery(), TRAPDOOR_OPEN, 100, node.location)
return@on true
}
onUseWith(IntType.NPC, ChampionScrollsDropHandler.SCROLLS, NPCs.LARXUS_3050) { player, _, _ ->
openDialogue(player, LarxusDialogue(true))
return@onUseWith true
}
on(TRAPDOOR_CLOSED, IntType.SCENERY, "open") { _, node ->
replaceScenery(node.asScenery(), TRAPDOOR_OPEN, 100, node.location)
return@on true
}
on(TRAPDOOR_OPEN, IntType.SCENERY, "close") { _, node ->
replaceScenery(node.asScenery(), TRAPDOOR_CLOSED, 100, node.location)
replaceScenery(node.asScenery(), TRAPDOOR_CLOSED, -1, node.location)
return@on true
}
@ -154,15 +160,6 @@ class ChampionChallengeListener : InteractionListener, MapArea {
return@on true
}
on(LADDER, IntType.SCENERY, "climb-up") { player, _ ->
teleport(player, Location.create(3185, 9758, 0))
return@on true
}
on(CHAMPION_STATUE_OPEN, IntType.SCENERY, "climb-down") { player, _ ->
teleport(player, Location.create(3182, 9758, 0))
return@on true
}
on(PORTCULLIS, IntType.SCENERY, "open") { player, node ->
if (player.getAttribute("championsarena:start", false) == false) {
sendNPCDialogue(player, NPCs.LARXUS_3050, "You need to arrange a challenge with me before you enter the arena.")
@ -229,4 +226,4 @@ class ChampionChallengeListener : InteractionListener, MapArea {
ZoneRestriction.RANDOM_EVENTS
)
}
}
}

View file

@ -1,39 +0,0 @@
package content.global.handlers.scenery;
import core.cache.def.impl.SceneryDefinition;
import core.game.interaction.OptionHandler;
import core.game.node.Node;
import core.game.node.entity.player.Player;
import core.game.node.item.Item;
import core.plugin.Initializable;
import core.plugin.Plugin;
/**
* Represents the doogle leaf plugin for this object.
* @author 'Vexia
* @version 1.0
*/
public class DoogleLeafPlugin extends OptionHandler {
/**
* Represents the leaf item.
*/
private static final Item LEAF = new Item(1573, 1);
@Override
public Plugin<Object> newInstance(Object arg) throws Throwable {
SceneryDefinition.forId(31155).getHandlers().put("option:pick-leaf", this);
return this;
}
@Override
public boolean handle(Player player, Node node, String option) {
if (!player.getInventory().add(LEAF)) {
player.getPacketDispatch().sendMessage("You don't have have enough space in your inventory.");
} else {
player.getPacketDispatch().sendMessage("You pick some doogle leaves.");
}
return true;
}
}

View file

@ -11,6 +11,9 @@ import core.game.world.map.Location;
import core.game.world.map.RegionManager;
import core.plugin.Initializable;
import core.plugin.Plugin;
import org.rs09.consts.Sounds;
import static core.api.ContentAPIKt.*;
/**
* Plugin used for handling the opening/closing of (double)
@ -39,6 +42,14 @@ public final class DoorManagingPlugin extends OptionHandler {
if (name.contains("drawers") || name.contains("wardrobe") || name.contains("cupboard")) {
switch(option) {
case "open":
if (name.contains("drawers")) {
playAudio(player, Sounds.DRAWER_OPEN_64);
} else if (name.contains("wardrobe")) {
animate(player, 545, false);
playAudio(player, Sounds.WARDROBE_OPEN_96);
} else if (name.contains("cupboard")) {
playAudio(player, Sounds.CUPBOARD_OPEN_58);
}
case "go-through":
if (object.isActive()) {
SceneryBuilder.replace(object, object.transform(object.getId() + 1), 80);
@ -46,6 +57,14 @@ public final class DoorManagingPlugin extends OptionHandler {
return true;
case "close":
case "shut":
if (name.contains("drawers")) {
playAudio(player, Sounds.DRAWER_CLOSE_63);
} else if (name.contains("wardrobe")) {
animate(player, 544, false);
playAudio(player, Sounds.WARDROBE_CLOSE_95);
} else if (name.contains("cupboard")) {
playAudio(player, Sounds.CUPBOARD_CLOSE_57);
}
SceneryBuilder.replace(object, object.transform(object.getId() - 1));
return true;
}

View file

@ -23,6 +23,8 @@ public final class LadderManagingPlugin extends OptionHandler {
SceneryDefinition.setOptionHandler("climb-up", this);
SceneryDefinition.setOptionHandler("climb-down", this);
SceneryDefinition.setOptionHandler("climb", this);
SceneryDefinition.setOptionHandler("walk-up", this);
SceneryDefinition.setOptionHandler("walk-down", this);
return this;
}

View file

@ -1,5 +1,6 @@
package content.region.misthalin.lumbridge.handlers;
import core.api.Container;
import core.cache.def.impl.SceneryDefinition;
import core.game.node.entity.player.link.diary.DiaryType;
import core.game.component.Component;
@ -21,6 +22,9 @@ import core.game.world.map.Location;
import core.game.world.update.flag.context.Animation;
import core.plugin.Initializable;
import core.plugin.Plugin;
import org.rs09.consts.Items;
import static core.api.ContentAPIKt.*;
/**
* Represents the node option handler for lumbridge.
@ -45,6 +49,7 @@ public final class LumbridgeNodePlugin extends OptionHandler {
SceneryDefinition.forId(22114).getHandlers().put("option:open", this);
SceneryDefinition.forId(29355).getHandlers().put("option:climb-up", this);
SceneryDefinition.forId(37655).getHandlers().put("option:view", this);
SceneryDefinition.forId(org.rs09.consts.Scenery.LOGS_36974).getHandlers().put("option:take-axe", this);
return this;
}
@ -114,8 +119,13 @@ public final class LumbridgeNodePlugin extends OptionHandler {
case 37655:
player.getInterfaceManager().open(new Component(270));
break;
case org.rs09.consts.Scenery.LOGS_36974:
if (!addItem(player, Items.BRONZE_AXE_1351, 1, Container.INVENTORY)) {
sendMessage(player, "You don't have enough inventory space to hold that item.");
} else {
replaceScenery(node.asScenery(), org.rs09.consts.Scenery.LOGS_36975, 300, null);
}
return true;
}
return true;
}

View file

@ -0,0 +1,59 @@
package content.region.misthalin.varrock.dialogue
import core.api.lock
import core.api.queueScript
import core.game.dialogue.DialogueFile
import core.game.dialogue.FacialExpression
import core.game.dialogue.Topic
import core.game.node.entity.npc.NPC
import core.game.world.map.Location
import core.tools.END_DIALOGUE
import core.tools.START_DIALOGUE
import org.rs09.consts.NPCs
class KnockAtBankDoor : DialogueFile() {
private val femaleBankerNPC = NPC(NPCs.BANKER_45)
private val maleBankerNPC = NPC(NPCs.BANKER_44)
private val femaleBankerDoorLoc = Location(3182, 3434, 0)
override fun handle(componentID: Int, buttonID: Int) {
npc = if (player!!.location == femaleBankerDoorLoc) femaleBankerNPC else maleBankerNPC
when (stage) {
START_DIALOGUE -> {
player!!.dialogueInterpreter.sendPlainMessage(
true, "<col=08088A>Knock knock..."
).also {
lock(player!!, 3)
queueScript(player!!, 3) {
npcl(FacialExpression.NEUTRAL, "Who's there?")
stage++
return@queueScript true
}
}
}
1 -> showTopics(
Topic("I'm ${player!!.username}. Please let me in.", 10),
Topic("Boo.", 20),
Topic("Kanga.", 30),
Topic("Thank.", 40),
Topic("Doctor.", 50)
)
10 -> npcl("No. Staff only beyond this point. You can't come in here.").also { stage = END_DIALOGUE }
20 -> npcl("Boo who?").also { stage++ }
21 -> playerl("There's no need to cry!").also { stage++ }
22 -> npcl(FacialExpression.FURIOUS, "What? I'm not... oh, just go away!").also { stage = END_DIALOGUE }
30 -> npcl("Kanga who?").also { stage++ }
31 -> playerl("No, 'kangaroo'.").also { stage++ }
32 -> npcl(FacialExpression.FURIOUS, "Stop messing about and go away!").also { stage = END_DIALOGUE }
40 -> npcl("Thank who?").also { stage++ }
41 -> playerl("You're welcome!").also { stage++ }
42 -> npcl(FacialExpression.FURIOUS, "Stop it!").also { stage = END_DIALOGUE }
50 -> npcl(
FacialExpression.FURIOUS,
"Doctor. wh.. hang on, I'm not falling for that one again! Go away."
).also { stage = END_DIALOGUE }
}
}
}

View file

@ -1,88 +0,0 @@
package content.region.misthalin.varrock.dialogue;
import core.game.dialogue.DialoguePlugin;
import core.game.dialogue.FacialExpression;
import core.game.global.action.DoorActionHandler;
import core.game.node.entity.player.Player;
import core.game.world.map.Location;
import core.plugin.Initializable;
import core.game.world.map.RegionManager;
/**
* Represents the museum guard dialogue.
* @author 'Vexia
* @version 1.0
*/
@Initializable
public final class MuseumGuardDialogue extends DialoguePlugin {
/**
* Represents the gate location.
*/
private static final Location LOCATION = new Location(3261, 3446, 0);
/**
* Constructs a new {@code MuseumGuardDialogue} {@code Object}.
*/
public MuseumGuardDialogue() {
/**
* empty.
*/
}
/**
* Constructs a new {@code MuseumGuardDialogue} {@code Object}.
* @param player the player.
*/
public MuseumGuardDialogue(Player player) {
super(player);
}
@Override
public DialoguePlugin newInstance(Player player) {
return new MuseumGuardDialogue(player);
}
@Override
public boolean open(Object... args) {
interpreter.sendDialogues(5941, FacialExpression.HALF_GUILTY, "Welcome! Would you like to go into the Dig Site", "archaeology cleaning area?");
stage = 0;
return true;
}
@Override
public boolean handle(int interfaceId, int buttonId) {
switch (stage) {
case 0:
interpreter.sendOptions("Select an Option", "Yes, I'll go in!", "No thanks, I'll take a look around out there.");
stage = 1;
break;
case 1:
switch (buttonId) {
case 1:
interpreter.sendDialogues(player, FacialExpression.HALF_GUILTY, "Yes, I'll go in!");
stage = 20;
break;
case 2:
interpreter.sendDialogues(player, FacialExpression.HALF_GUILTY, "No thanks, I'll take a look around out there.");
stage = 3;
break;
}
break;
case 3:
end();
break;
case 20:
end();
DoorActionHandler.handleAutowalkDoor(player, RegionManager.getObject(LOCATION));
break;
}
return true;
}
@Override
public int[] getIds() {
return new int[] { 5941 };
}
}

View file

@ -1,69 +0,0 @@
package content.region.misthalin.varrock.dialogue;
import core.game.dialogue.DialoguePlugin;
import core.game.dialogue.FacialExpression;
import core.game.node.entity.npc.NPC;
import core.plugin.Initializable;
import core.game.node.entity.player.Player;
/**
* Handles the MuseumGuardVarrockDialogue dialogue.
* @author 'Vexia
*/
@Initializable
public class MuseumGuardVarrockDialogue extends DialoguePlugin {
public MuseumGuardVarrockDialogue() {
}
public MuseumGuardVarrockDialogue(Player player) {
super(player);
}
@Override
public int[] getIds() {
return new int[] { 5943 };
}
@Override
public boolean handle(int interfaceId, int buttonId) {
switch (stage) {
case 0:
interpreter.sendDialogues(player, FacialExpression.HALF_GUILTY, "Yes, how do I get in?");
stage = 2;
break;
case 2:
interpreter.sendDialogues(npc, FacialExpression.HALF_GUILTY, "Well, the main entrance is 'round the front. Just head", "west then north slightly, you can't miss it!");
stage = 3;
break;
case 3:
interpreter.sendDialogues(player, FacialExpression.HALF_GUILTY, "What about these doors?");
stage = 4;
break;
case 4:
interpreter.sendDialogues(npc, FacialExpression.HALF_GUILTY, "They're primarily for the workmen bringing finds from the", "Dig Site, but you can go through if you want.");
stage = 5;
break;
case 5:
end();
break;
}
return true;
}
@Override
public DialoguePlugin newInstance(Player player) {
return new MuseumGuardVarrockDialogue(player);
}
@Override
public boolean open(Object... args) {
npc = (NPC) args[0];
interpreter.sendDialogues(npc, FacialExpression.HALF_GUILTY, "Hello there. Come to see the new museum?");
stage = 0;
return true;
}
}

View file

@ -0,0 +1,89 @@
package content.region.misthalin.varrock.dialogue
import content.region.misthalin.varrock.handlers.MuseumInteractionListener.Companion.handleMuseumDoor
import core.api.forceWalk
import core.api.getScenery
import core.api.isQuestComplete
import core.game.dialogue.DialoguePlugin
import core.game.dialogue.FacialExpression
import core.game.dialogue.Topic
import core.game.node.entity.player.Player
import core.game.world.map.Location
import core.plugin.Initializable
import core.tools.END_DIALOGUE
import core.tools.START_DIALOGUE
import org.rs09.consts.NPCs
@Initializable
class DoorGuardDialogue(player: Player? = null) : DialoguePlugin(player) {
override fun open(vararg args: Any?): Boolean {
npcl(FacialExpression.NEUTRAL, "Hello there. Come to see the new museum?").also { stage = START_DIALOGUE }
return true
}
override fun handle(interfaceId: Int, buttonId: Int): Boolean {
when (stage) {
START_DIALOGUE -> playerl(FacialExpression.NEUTRAL, "Yes, how do I get in?").also { stage++ }
1 -> npcl(FacialExpression.NEUTRAL, "Well, the main entrance is 'round the front. Just head west then north slightly, you can't miss it!").also { stage++ }
2 -> playerl(FacialExpression.NEUTRAL, "What about these doors?").also { stage++ }
3 -> {
if (isQuestComplete(player, "The Dig Site")) {
npcl(FacialExpression.NEUTRAL, "They're primarily for the workmen bringing finds from the Dig Site, but you can go through if you want.").also { stage++ }
} else {
npcl(FacialExpression.NEUTRAL, "They're for the workmen bringing finds from the Dig Site; sorry, but you can't go through.").also { stage = END_DIALOGUE }
}
}
4 -> playerl(FacialExpression.NEUTRAL, "Okay, thanks.").also { stage++ }
5 -> {
end()
handleMuseumDoor(player, getScenery(3264, 3441, 0))
}
}
return true
}
override fun newInstance(player: Player?): DialoguePlugin {
return DoorGuardDialogue(player)
}
override fun getIds(): IntArray {
return intArrayOf(NPCs.MUSEUM_GUARD_5943)
}
}
@Initializable
class GateGuardDialogue(player: Player? = null) : DialoguePlugin(player) {
override fun open(vararg args: Any?): Boolean {
// Shows the player walking to this spot first https://www.youtube.com/watch?v=t-oeY3a-ZSA&t=53s
if (player.location != Location(3261, 3447)) forceWalk(player, Location(3261, 3447), "smart")
if (isQuestComplete(player, "The Dig Site")) {
npcl(FacialExpression.NEUTRAL, "Welcome! Would you like to go into the Dig Site archaeology cleaning area?").also { stage = START_DIALOGUE }
} else {
npcl(FacialExpression.NEUTRAL, "You're not permitted in this area.").also { stage = END_DIALOGUE }
}
return true
}
override fun handle(interfaceId: Int, buttonId: Int): Boolean {
when (stage) {
START_DIALOGUE -> showTopics(
Topic("Yes, I'll go in!", 1, true),
Topic("No thanks, I'll take a look around out here.", END_DIALOGUE, true)
)
1 -> {
end()
handleMuseumDoor(player, getScenery(3261, 3446, 0))
}
}
return true
}
override fun newInstance(player: Player?): DialoguePlugin {
return GateGuardDialogue(player)
}
override fun getIds(): IntArray {
return intArrayOf(NPCs.MUSEUM_GUARD_5941)
}
}

View file

@ -1,64 +0,0 @@
package content.region.misthalin.varrock.handlers;
import core.game.node.entity.npc.AbstractNPC;
import core.game.world.map.Location;
import core.plugin.Initializable;
import core.tools.RandomFunction;
/**
* Represents the representation of the benny npc.
* @author 'Vexia
* @version 1.0
*/
@Initializable
public final class BennyNPC extends AbstractNPC {
/**
* The NPC ids of NPCs using this plugin.
*/
private static final int[] ID = { 5925 };
/**
* Represents the random messages for benny to display.
*/
private static final String[] MESSAGES = new String[] { "Read all about it!", "Varrock Herald, on sale here!", "Buy your Varrock Herald now!", "Extra! Extra! Read all about it!", "Varrock Herald, now only 50 gold!" };
/**
* Constructs a new {@code BennyNPC} {@code Object}.
*/
public BennyNPC() {
super(0, null);
}
/**
* Constructs a new {@code BennyNPC} {@code Object}.
* @param id the id.
* @param location the location.
*/
private BennyNPC(int id, Location location) {
super(id, location);
}
@Override
public AbstractNPC construct(int id, Location location, Object... objects) {
return new BennyNPC(id, location);
}
@Override
public void tick() {
super.tick();
if (RandomFunction.random(0, 12) == 5) {
sendChat(MESSAGES[RandomFunction.random(MESSAGES.length)]);
}
}
@Override
public int[] getIds() {
return ID;
}
@Override
public int getWalkRadius() {
return 6;
}
}

View file

@ -0,0 +1,39 @@
package content.region.misthalin.varrock.handlers
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 BennyNPC(id: Int = 0, location: Location? = null) : AbstractNPC(id, location) {
override fun construct(id: Int, location: Location?, vararg objects: Any?): AbstractNPC {
return BennyNPC(id, location)
}
override fun getIds(): IntArray {
return intArrayOf(NPCs.BENNY_5925)
}
override fun handleTickActions() {
super.handleTickActions()
if (RandomFunction.roll(12)) {
core.api.sendChat(this, messages.random())
}
}
override fun getWalkRadius(): Int {
return 6
}
companion object {
private val messages = arrayOf(
"Read all about it!",
"Varrock Herald, on sale here!",
"Buy your Varrock Herald now!",
"Extra! Extra! Read all about it!",
"Varrock Herald, now only 50 gold!"
)
}
}

View file

@ -1,43 +0,0 @@
package content.region.misthalin.varrock.handlers;
import core.cache.def.impl.SceneryDefinition;
import core.game.global.action.DoorActionHandler;
import core.game.interaction.OptionHandler;
import core.game.node.Node;
import core.game.node.entity.player.Player;
import core.game.node.scenery.Scenery;
import core.game.world.map.Location;
import core.plugin.Initializable;
import core.plugin.Plugin;
/**
* Represents the plugin used to handle the brass key door plugin.
* @author 'Vexia
* @version 1.0
*/
@Initializable
public final class BrassKeyDoorPlugin extends OptionHandler {
@Override
public boolean handle(Player player, Node node, String option) {
if (player.getInventory().contains(983, 1)) {
DoorActionHandler.handleAutowalkDoor(player, (Scenery) node);
} else {
player.getPacketDispatch().sendMessage("This door is locked.");
return true;
}
return true;
}
@Override
public Plugin<Object> newInstance(Object arg) throws Throwable {
SceneryDefinition.forId(1804).getHandlers().put("option:open", this);
return this;
}
@Override
public Location getDestination(Node node, Node n) {
return DoorActionHandler.getDestination(((Player) node), ((Scenery) n));
}
}

View file

@ -1,37 +0,0 @@
package content.region.misthalin.varrock.handlers;
import core.cache.def.impl.SceneryDefinition;
import core.game.interaction.OptionHandler;
import core.game.node.Node;
import core.game.node.entity.npc.NPC;
import core.game.node.entity.player.Player;
import core.game.node.scenery.Scenery;
import core.plugin.Initializable;
import core.plugin.Plugin;
/**
* Represents the champions arena plugin.
* @author 'Vexia
* @version 1.0
*/
@Initializable
public final class ChampionsArenaPlugin extends OptionHandler {
@Override
public Plugin<Object> newInstance(Object arg) throws Throwable {
SceneryDefinition.forId(10556).getHandlers().put("option:open", this);
return this;
}
@Override
public boolean handle(Player player, Node node, String option) {
int id = node instanceof Scenery ? ((Scenery) node).getId() : ((NPC) node).getId();
switch (id) {
case 10556:
player.getDialogueInterpreter().open(3050, true, true);
break;
}
return true;
}
}

View file

@ -1,30 +0,0 @@
package content.region.misthalin.varrock.handlers;
import core.cache.def.impl.SceneryDefinition;
import core.game.interaction.OptionHandler;
import core.game.node.Node;
import core.game.node.entity.player.Player;
import core.plugin.Initializable;
import core.plugin.Plugin;
/**
* Represents the guidor door plugin.
* @author 'Vexia
* @version 1.0
*/
@Initializable
public final class GuidorDoorPlugin extends OptionHandler {
@Override
public boolean handle(Player player, Node node, String option) {
player.getDialogueInterpreter().open(342, true, true);
return true;
}
@Override
public Plugin<Object> newInstance(Object arg) throws Throwable {
SceneryDefinition.forId(2032).getHandlers().put("option:open", this);
return this;
}
}

View file

@ -1,36 +0,0 @@
package content.region.misthalin.varrock.handlers;
import core.cache.def.impl.SceneryDefinition;
import core.game.global.action.DoorActionHandler;
import core.game.interaction.OptionHandler;
import core.game.node.Node;
import core.game.node.entity.player.Player;
import core.game.node.scenery.Scenery;
import core.plugin.Initializable;
import core.plugin.Plugin;
/**
* Represents the plugin used for the museum gate plugin.
* @author 'Vexia
* @version 1.0
*/
@Initializable
public final class MuseumGatePlugin extends OptionHandler {
@Override
public Plugin<Object> newInstance(Object arg) throws Throwable {
SceneryDefinition.forId(24536).getHandlers().put("option:open", this);
return this;
}
@Override
public boolean handle(Player player, Node node, String option) {
if (player.getLocation().getY() >= 3447) {
player.getDialogueInterpreter().open(5941);
} else {
DoorActionHandler.handleAutowalkDoor(player, (Scenery) node);
return true;
}
return true;
}
}

View file

@ -0,0 +1,125 @@
package content.region.misthalin.varrock.handlers
import core.api.*
import core.game.global.action.DoorActionHandler
import core.game.interaction.IntType
import core.game.interaction.InteractionListener
import core.game.node.entity.player.Player
import core.game.world.map.Location
import core.game.world.update.flag.context.Animation
import org.rs09.consts.Components
import org.rs09.consts.Items
import org.rs09.consts.NPCs
import org.rs09.consts.Scenery
class MuseumInteractionListener : InteractionListener {
override fun defineListeners() {
// Basement Stairs
addClimbDest(Location(3255, 3451, 0), Location(1759, 4958, 0))
addClimbDest(Location(1758, 4959, 0), Location(3258, 3452, 0))
on(mapObject, IntType.SCENERY, "look-at", "take") { player, node ->
if (getUsedOption(player) == "take") {
if (!addItem(player, Items.MUSEUM_MAP_11184)) {
sendMessage(player, "You don't have enough space in your inventory.")
}
} else {
when (node.id) {
Scenery.MAP_24390 -> setAttribute(player, "iface:527:floor", "main")
Scenery.MAP_24391 -> setAttribute(player, "iface:527:floor", "second")
Scenery.MAP_24392 -> setAttribute(player, "iface:527:floor", "top")
}
openInterface(player, Components.VM_MUSEUM_MAP_527)
}
return@on true
}
on(Items.MUSEUM_MAP_11184, IntType.ITEM, "look-at") { player, node ->
openInterface(player, Components.VM_MUSEUM_MAP_527)
return@on true
}
on(Scenery.INFORMATION_BOOTH_24452, IntType.SCENERY, "look-at") { player, node ->
// TODO: I cannot find anything that shows what this does in 2009.
sendMessage(player, "Nothing interesting happens.")
return@on true
}
on(doorsToDigsite, IntType.SCENERY, "open") { player, node ->
if (node.id == Scenery.GATE_24536) {
if (player.location.y <= 3446) {
handleMuseumDoor(player, node.asScenery())
} else {
openDialogue(player, NPCs.MUSEUM_GUARD_5941)
}
return@on true
} else {
if (player.location.y >= 3442) {
handleMuseumDoor(player, node.asScenery())
} else {
openDialogue(player, NPCs.MUSEUM_GUARD_5943)
}
}
return@on true
}
on(Scenery.TOOLS_24535, IntType.SCENERY, "take") { player, node ->
sendDialogueOptions(
player,
"Which tool would you like?",
"Trowel",
"Rock pick",
"Specimen brush",
"Leather gloves",
"Leather boots"
)
addDialogueAction(player) { _, button ->
val item = when (button) {
2 -> Items.TROWEL_676
3 -> Items.ROCK_PICK_675
4 -> Items.SPECIMEN_BRUSH_670
5 -> Items.LEATHER_GLOVES_1059
6 -> Items.LEATHER_BOOTS_1061
else -> return@addDialogueAction
}
val name = item.asItem().name.lowercase()
val word = if (name.startsWith("leather")) "pair of " else ""
if (!addItem(player, item)) {
sendMessage(player, "You don't have enough space in your inventory.")
} else {
sendItemDialogue(player, item, "You take a $word$name from the rack.")
}
}
return@on true
}
on(naturalHistoryPlaques, IntType.SCENERY, "study") { player, node ->
openInterface(player, 533)
return@on true
}
}
companion object {
private val doorsToDigsite = intArrayOf(Scenery.GATE_24536, Scenery.DOOR_24565, Scenery.DOOR_24567)
private val mapObject = intArrayOf(Scenery.MAP_24390, Scenery.MAP_24391, Scenery.MAP_24392)
private val naturalHistoryPlaques = intArrayOf(
Scenery.PLAQUE_24605, Scenery.PLAQUE_24606, Scenery.PLAQUE_24607, Scenery.PLAQUE_24608,
Scenery.PLAQUE_24609, Scenery.PLAQUE_24610, Scenery.PLAQUE_24611, Scenery.PLAQUE_24612,
Scenery.PLAQUE_24613, Scenery.PLAQUE_24614, Scenery.PLAQUE_24615, Scenery.PLAQUE_24616,
Scenery.PLAQUE_24617, Scenery.PLAQUE_24618
)
fun handleMuseumDoor(player: Player, door: core.game.node.scenery.Scenery?) {
val npc = if (door?.id == Scenery.GATE_24536) findLocalNPC(player, NPCs.MUSEUM_GUARD_5941) else findLocalNPC(player, NPCs.MUSEUM_GUARD_5943)
val animation = if (DoorActionHandler.getEndLocation(player, door).y > player.location.y) Animation(6391) else Animation(6392)
if (npc != null) {
animate(npc, animation)
queueScript(player, animationDuration(animation)) { DoorActionHandler.handleAutowalkDoor(player, door) }
} else {
DoorActionHandler.handleAutowalkDoor(player, door)
}
}
}
}

View file

@ -0,0 +1,91 @@
package content.region.misthalin.varrock.handlers
import core.api.*
import core.game.interaction.InterfaceListener
import core.game.node.entity.player.Player
import org.rs09.consts.Components
import org.rs09.consts.NPCs
import org.rs09.consts.Sounds
class MuseumInterfaceListener : InterfaceListener {
override fun defineInterfaceListeners() {
onOpen(Components.VM_MUSEUM_MAP_527) { player, _ ->
showMapFloor(player, getAttribute(player, "iface:527:floor", "main"))
removeAttribute(player, "iface:527:floor")
return@onOpen true
}
on(Components.VM_MUSEUM_MAP_527) { player, _, _, buttonID, _, _ ->
showMapFloor(player, when (buttonID) {
in mapButtonsToBasement -> "basement"
in mapButtonsToMainFloor -> "main"
in mapButtonsToSecondFloor -> "second"
in mapButtonsToTopFloor -> "top"
else -> return@on true
})
return@on true
}
onOpen(NATURAL_HISTORY_EXAM_533) { player, component ->
// The model for each display is confusing as hell. Some are objects and some are NPCs.
val model = getScenery(1763, 4937, 0)?.definition?.modelIds?.first()
player.packetDispatch.sendModelOnInterface(model!!, component.id, 3, 0)
// Showing this child makes child 28 - 31 visible.
setComponentVisibility(player, component.id, 27, false)
// The case number to display.
setInterfaceText(player, "1", component.id, 25)
// The question text.
setInterfaceText(player, "When will the Natural History Quiz be implemented?", component.id, 28)
// The choices.
setInterfaceText(player, "Never.", component.id, 29)
setInterfaceText(player, "In 2 days.", component.id, 30)
setInterfaceText(player, "After Barbarian Assault.", component.id, 31)
return@onOpen true
}
on(NATURAL_HISTORY_EXAM_533) { player, component, opcode, buttonID, slot, itemID ->
if (buttonID in 29..31) {
closeInterface(player)
setVarbit(player, 3637, 1, false)
playAudio(player, Sounds.VM_GAIN_KUDOS_3653)
sendNPCDialogue(player, NPCs.ORLANDO_SMITH_5965, "Nice job, mate. That looks about right.")
}
return@on true
}
}
companion object {
private const val NATURAL_HISTORY_EXAM_533 = 533
private val mapButtonsToBasement = intArrayOf(41, 186)
private val mapButtonsToMainFloor = intArrayOf(117, 120, 187, 188)
private val mapButtonsToSecondFloor = intArrayOf(42, 44, 152, 153)
private val mapButtonsToTopFloor = intArrayOf(42, 44, 118, 119)
private fun showMapFloor(player: Player, floor: String) {
when (floor) {
"basement" -> {
setComponentVisibility(player, Components.VM_MUSEUM_MAP_527, 2, true)
setComponentVisibility(player, Components.VM_MUSEUM_MAP_527, 7, false)
}
"main" -> {
setComponentVisibility(player, Components.VM_MUSEUM_MAP_527, 3, true)
setComponentVisibility(player, Components.VM_MUSEUM_MAP_527, 7, true)
setComponentVisibility(player, Components.VM_MUSEUM_MAP_527, 2, false)
}
"second" -> {
setComponentVisibility(player, Components.VM_MUSEUM_MAP_527, 2, true)
setComponentVisibility(player, Components.VM_MUSEUM_MAP_527, 5, true)
setComponentVisibility(player, Components.VM_MUSEUM_MAP_527, 3, false)
}
"top" -> {
setComponentVisibility(player, Components.VM_MUSEUM_MAP_527, 3, true)
setComponentVisibility(player, Components.VM_MUSEUM_MAP_527, 5, false)
}
}
}
}
}

View file

@ -0,0 +1,29 @@
package content.region.misthalin.varrock.handlers
import core.api.MapArea
import core.api.closeOverlay
import core.api.openOverlay
import core.game.node.entity.Entity
import core.game.node.entity.player.Player
import core.game.world.map.zone.ZoneBorders
import org.rs09.consts.Components
class MuseumMapArea : MapArea {
override fun defineAreaBorders(): Array<ZoneBorders> {
val vmArea = ZoneBorders(3253, 3442, 3267, 3455)
val vmBasementArea = ZoneBorders(1730, 4932, 1788, 4988)
return arrayOf(vmArea, vmBasementArea)
}
override fun areaEnter(entity: Entity) {
if (entity is Player) {
openOverlay(entity.asPlayer(), Components.VM_KUDOS_532)
}
}
override fun areaLeave(entity: Entity, logout: Boolean) {
if (entity is Player) {
closeOverlay(entity.asPlayer())
}
}
}

View file

@ -1,28 +0,0 @@
package content.region.misthalin.varrock.handlers;
import core.cache.def.impl.SceneryDefinition;
import core.game.interaction.OptionHandler;
import core.game.node.Node;
import core.game.node.entity.player.Player;
import core.plugin.Initializable;
import core.plugin.Plugin;
/**
* @author 'Vexia
*/
@Initializable
public class VarrockBrokenCart extends OptionHandler {
@Override
public boolean handle(Player player, Node node, String option) {
player.getDialogueInterpreter().open(70099, "You search the cart but are surprised to find very little there. It's a", "little odd for a travelling trader not to have anything to trade.");
return true;
}
@Override
public Plugin<Object> newInstance(Object arg) throws Throwable {
SceneryDefinition.forId(23055).getHandlers().put("option:search", this);
return this;
}
}

View file

@ -0,0 +1,27 @@
package content.region.misthalin.varrock.handlers
import core.api.getVarbit
import core.api.setVarbit
import core.game.interaction.InterfaceListener
class VarrockCensusInterface : InterfaceListener {
override fun defineInterfaceListeners() {
on(INTERFACE_ID) { player, _, _, buttonID, _, _ ->
when (buttonID) {
2 -> setVarbit(player, VARBIT_ID, getVarbit(player, VARBIT_ID).plus(1))
3 -> setVarbit(player, VARBIT_ID, getVarbit(player, VARBIT_ID).minus(1))
else -> return@on true
}
return@on true
}
onClose(INTERFACE_ID) { player, _ ->
setVarbit(player, VARBIT_ID, 0)
return@onClose true
}
}
companion object {
const val INTERFACE_ID = 794
const val VARBIT_ID = 5390
}
}

View file

@ -0,0 +1,91 @@
package content.region.misthalin.varrock.handlers
import content.region.misthalin.varrock.dialogue.KnockAtBankDoor
import core.api.*
import core.game.global.action.DoorActionHandler
import core.game.interaction.IntType
import core.game.interaction.InteractionListener
import core.game.world.map.Location
import org.rs09.consts.Items
import org.rs09.consts.NPCs
import org.rs09.consts.Scenery
import org.rs09.consts.Sounds
class VarrockInteractionListener : InteractionListener {
override fun defineListeners() {
// Varrock Sewer Manhole
on(VARROCK_MANHOLE, IntType.SCENERY, "open", "close") { player, node ->
if (getUsedOption(player) == "open") {
playAudio(player, Sounds.MANHOLE_OPEN_75)
replaceScenery(node.asScenery(), Scenery.VARROCK_MANHOLE_OPEN_882, 100)
} else {
playAudio(player, Sounds.MANHOLE_CLOSE_74)
replaceScenery(node.asScenery(), Scenery.VARROCK_MANHOLE_CLOSED_881, -1)
}
return@on true
}
// Phoenix Gang Hideout Plaque
on(Scenery.PLAQUE_23636, IntType.SCENERY, "read") { player, _ ->
openInterface(player, VTAM_IFACE)
return@on true
}
// Varrock Census in the palace Library
on(Scenery.VARROCK_CENSUS_37209, IntType.SCENERY, "read") { player, _ ->
sendPlayerDialogue(player, "Hmm. The Varrock Census - year 160. That means it's nine years out of date.")
addDialogueAction(player) { _, buttonID ->
if (buttonID == 6) {
openInterface(player, VARROCK_CENSUS_IFACE)
}
}
return@on true
}
// Broken Cart next to Rat Burgiss
on(Scenery.BROKEN_CART_23055, IntType.SCENERY, "search") { player, node ->
sendDialogue(player, "You search the cart but are surprised to find very little there. " +
"It's a little odd for a travelling trader not to have anything to trade.")
return@on true
}
on(openOptionNodes, IntType.SCENERY, "open") { player, node ->
when (node.id) {
// Guidor's Bedroom Door
Scenery.BEDROOM_DOOR_2032 -> {
openDialogue(player, NPCs.GUIDORS_WIFE_342, true, true)
}
// Guidor's Drawers
Scenery.DRAWERS_17466 -> {
sendMessage(player, "The drawers are locked shut.")
}
// Brass Key Door to Edgeville Dungeon
Scenery.DOOR_1804 -> {
if (inInventory(player, Items.BRASS_KEY_983)) {
DoorActionHandler.handleAutowalkDoor(player, node.asScenery())
} else {
sendMessage(player, "This door is locked.")
}
}
}
return@on true
}
// Varrock West Bank Door
on(Scenery.DOOR_24389, IntType.SCENERY, "knock-at") { player, node ->
openDialogue(player, KnockAtBankDoor())
return@on true
}
// TODO: Cooking Guild
// TODO: Fix Achievements
}
companion object {
private val VARROCK_MANHOLE = intArrayOf(Scenery.VARROCK_MANHOLE_CLOSED_881, Scenery.VARROCK_MANHOLE_OPEN_882)
private val openOptionNodes = intArrayOf(Scenery.BEDROOM_DOOR_2032, Scenery.DRAWERS_17466, Scenery.DOOR_1804)
private const val VTAM_IFACE = 531
private const val VARROCK_CENSUS_IFACE = 794
}
}

View file

@ -1,313 +0,0 @@
package content.region.misthalin.varrock.handlers;
import core.cache.def.impl.SceneryDefinition;
import core.game.component.Component;
import core.game.dialogue.DialoguePlugin;
import core.game.dialogue.FacialExpression;
import core.game.global.action.ClimbActionHandler;
import core.game.interaction.OptionHandler;
import core.game.node.Node;
import core.game.node.entity.player.Player;
import core.game.node.item.Item;
import core.game.node.scenery.Scenery;
import core.game.node.scenery.SceneryBuilder;
import core.game.system.task.Pulse;
import core.game.world.GameWorld;
import core.game.world.map.Location;
import core.game.world.update.flag.context.Animation;
import core.plugin.Initializable;
import core.plugin.Plugin;
/**
* Represents the plugin used to handle node interactions in varrock.
*
* @author 'Vexia
* @version 1.0
*/
@Initializable
public final class VarrockNodePlugin extends OptionHandler {
/**
* Represents the bronze axe item.
*/
private static final Item BRONZE_AXE = new Item(1351);
/**
* Represents the spade item.
*/
private static final Item SPADE = new Item(952);
@Override
public Plugin<Object> newInstance(Object arg) throws Throwable {
SceneryDefinition.forId(24357).getHandlers().put("option:climb-up", this);
SceneryDefinition.forId(24359).getHandlers().put("option:climb-down", this);
SceneryDefinition.forId(5581).getHandlers().put("option:take-axe", this);
SceneryDefinition.forId(36974).getHandlers().put("option:take-axe", this);
SceneryDefinition.forId(24427).getHandlers().put("option:walk-up", this);
SceneryDefinition.forId(24428).getHandlers().put("option:walk-down", this);
SceneryDefinition.forId(1749).getHandlers().put("option:climb-down", this);
SceneryDefinition.forId(23636).getHandlers().put("option:read", this);
SceneryDefinition.forId(24389).getHandlers().put("option:knock-at", this);
SceneryDefinition.forId(9662).getHandlers().put("option:take", this);
SceneryDefinition.forId(29534).getHandlers().put("option:enter", this);
SceneryDefinition.forId(17985).getHandlers().put("option:climb-down", this);
SceneryDefinition.forId(24366).getHandlers().put("option:climb-up", this);
return this;
}
@Override
public boolean handle(final Player player, Node node, String option) {
final int id = node instanceof Scenery ? ((Scenery) node).getId() : ((Item) node).getId();
switch (id) {
case 24366:
ClimbActionHandler.climb(player, ClimbActionHandler.CLIMB_UP, new Location(3237, 3459));
return true;
case 29534:
player.getDialogueInterpreter().open(543543);
return true;
case 17985:
ClimbActionHandler.climb(player, ClimbActionHandler.CLIMB_DOWN, new Location(3204, 9910), "You enter the murky sewers.");
return true;
case 24389:
player.getDialogueInterpreter().open(KnockatDoorDialogue.ID, player.getLocation().getX() == 3182 ? 45 : 44);
break;
case 28094:
player.getDialogueInterpreter().sendDialogues(player, FacialExpression.THINKING, "I don't think I should go inside.");
break;
case 23636:
player.getInterfaceManager().open(new Component(531));
break;
case 1749:
if (player.getLocation().getZ() == 2 && player.getLocation().getDistance(new Location(3096, 3433, 2)) < 4) {
ClimbActionHandler.climb(player, new Animation(827), Location.create(3097, 3432, 1));
return true;
} else if (player.getLocation().getZ() == 1 && player.getLocation().getDistance(new Location(3095, 3433, 1)) < 4) {
ClimbActionHandler.climb(player, new Animation(827), Location.create(3096, 3432, 0));
return true;
}
ClimbActionHandler.climbLadder(player, (Scenery) node, option);
return true;
case 5581:
case 36974:
if (!player.getInventory().add(BRONZE_AXE)) {
player.getPacketDispatch().sendMessage("You don't have enough inventory space.");
return true;
}
SceneryBuilder.replace(((Scenery) node), ((Scenery) node).transform(5582), 5000);
break;
case 24357:
if (player.getLocation().getDistance(Location.create(3188, 3358, 0)) < 3) {
ClimbActionHandler.climb(player, new Animation(828), Location.create(3188, 3354, 1));
return true;
}
if (((Scenery) node).getLocation().equals(new Location(3156, 3435, 0))) {
ClimbActionHandler.climb(player, new Animation(828), Location.create(3155, 3435, 1));
return true;
}
ClimbActionHandler.climbLadder(player, (Scenery) node, option);
return true;
case 24359:
if (player.getLocation().getDistance(Location.create(3231, 3382, 1)) < 3) {
ClimbActionHandler.climb(player, null, Location.create(3231, 3386, 0));
return true;
}
ClimbActionHandler.climbLadder(player, (Scenery) node, option);
return true;
case 24427: //varrock museum stairs that lead upstairs
if (player.getLocation().getDistance(Location.create(1758, 4959, 0)) < 3) {
ClimbActionHandler.climb(player, new Animation(-1), Location.create(3258, 3452, 0));
return true;
}
return true;
case 24428: //varrock museum stairs that lead downstairs
if (player.getLocation().getDistance(Location.create(3255, 3451, 0)) < 4) {
ClimbActionHandler.climb(player, new Animation(-1), Location.create(1759, 4958, 0));
return true;
}
return true;
case 9662:
if (!player.getInventory().hasSpaceFor(SPADE)) {
player.getPacketDispatch().sendMessage("Not enough inventory space.");
return true;
}
player.getInventory().add(SPADE);
SceneryBuilder.replace((Scenery) node, ((Scenery) node).transform(0), 250);
return true;
}
return true;
}
@Override
public boolean isWalk() {
return false;
}
@Override
public boolean isWalk(final Player player, final Node node) {
return !(node instanceof Item);
}
/**
* Represents the dialogue used for the knocking at a door in varrock bank.
*
* @author 'Vexia
* @version 1.0
*/
public final class KnockatDoorDialogue extends DialoguePlugin {
/**
* Represents the id of this dialogue.
*/
private static final int ID = 903042893;
/**
* Represents the id to use.
*/
private int npcId;
/**
* Constructs a new {@code KnockatDoorDialogue} {@code Object}.
*/
public KnockatDoorDialogue() {
/**
* empty.
*/
}
/**
* Constructs a new {@code KnockatDoorDialogue} {@code Object}.
*
* @param player the player.
*/
public KnockatDoorDialogue(final Player player) {
super(player);
}
@Override
public DialoguePlugin newInstance(Player player) {
return new KnockatDoorDialogue(player);
}
@Override
public boolean open(Object... args) {
npcId = (int) args[0];
player("I don't think I'm ever going to be allowed in there.");
return true;
}
@Override
public boolean handle(int interfaceId, int buttonId) {
switch (stage) {
case 0:
player.lock(3);
interpreter.sendPlainMessage(true, "<col=08088A>Knock knock...");
GameWorld.getPulser().submit(new Pulse(3, player) {
@Override
public boolean pulse() {
interpreter.sendDialogues(npcId, null, "Who's there?");
stage = 1;
return true;
}
});
break;
case 1:
options("I'm " + player.getUsername() + ". Please let me in.", "Boo.", "Kanga.", "Thank.", "Doctor.");
stage = 2;
break;
case 2:
switch (buttonId) {
case 1:
player("I'm " + player.getUsername() + ". Please let me in.");
stage = 10;
break;
case 2:
player("Boo.");
stage = 20;
break;
case 3:
player("Kanga.");
stage = 30;
break;
case 4:
player("Thank.");
stage = 40;
break;
case 5:
player("Doctor.");
stage = 50;
break;
}
break;
case 10:
interpreter.sendDialogues(npcId, null, "No. Staff only beyond this point.", "You can't come in here.");
stage = 11;
break;
case 11:
end();
break;
case 20:
interpreter.sendDialogues(npcId, null, "Boo who?");
stage = 21;
break;
case 21:
player("There's no need to cry!");
stage = 22;
break;
case 22:
interpreter.sendDialogues(npcId, FacialExpression.FURIOUS, "What? I'm not... oh, just go away!");
stage = 23;
break;
case 23:
end();
break;
case 30:
interpreter.sendDialogues(npcId, null, "Kanga who?");
stage = 31;
break;
case 31:
player("No, 'kangaroo'.");
stage = 32;
break;
case 32:
interpreter.sendDialogues(npcId, FacialExpression.FURIOUS, "Stop messing about and go away!");
stage = 33;
break;
case 33:
end();
break;
case 40:
interpreter.sendDialogues(npcId, null, "Thank who?");
stage = 41;
break;
case 41:
player("You're welcome!");
stage = 42;
break;
case 42:
interpreter.sendDialogues(npcId, FacialExpression.FURIOUS, "Stop it!");
stage = 43;
break;
case 43:
end();
break;
case 50:
interpreter.sendDialogues(npcId, FacialExpression.FURIOUS, "Doctor. wh.. hang on, I'm not falling for that one again!", "Go away.");
stage = 51;
break;
case 51:
end();
break;
}
return true;
}
@Override
public int[] getIds() {
return new int[]{903042893};
}
}
}

View file

@ -37,9 +37,6 @@ public final class DemonSlayerPlugin extends OptionHandler {
@Override
public Plugin<Object> newInstance(Object arg) throws Throwable {
SceneryDefinition.forId(881).getHandlers().put("option:open", this);
SceneryDefinition.forId(882).getHandlers().put("option:close", this);
SceneryDefinition.forId(882).getHandlers().put("option:climb-down", this);
SceneryDefinition.forId(DRAIN_ID).getHandlers().put("option:search", this);
SceneryDefinition.forId(17429).getHandlers().put("option:take", this);
NPCDefinition.forId(DemonSlayerCutscene.DELRITH).getHandlers().put("option:attack", this);
@ -71,23 +68,6 @@ public final class DemonSlayerPlugin extends OptionHandler {
player.sendMessage("You search the castle drain and find nothing of value.");
}
return true;
case 881:
SceneryBuilder.replace(((Scenery) node), ((Scenery) node).transform(882));
break;
case 882:
switch (option) {
case "climb-down":
if (node.getLocation().equals(new Location(3237, 3458, 0))) {
ClimbActionHandler.climb(player, new Animation(828), SEWER_LOCATION);
} else {
ClimbActionHandler.climbLadder(player, (Scenery) node, option);
}
break;
case "close":
SceneryBuilder.replace(((Scenery) node), ((Scenery) node).transform(881));
break;
}
break;
case 17429:
if (quest.getStage(player) == 20 && player.getInventory().add(DemonSlayer.FIRST_KEY)) {
setVarp(player, 222, 4757762, true);

View file

@ -101,10 +101,6 @@ public final class DragonSlayerPlugin extends OptionHandler {
SceneryDefinition.forId(25161).getHandlers().put("option:climb-over", this);
NPCDefinition.forId(742).getHandlers().put("option:attack", this);
NPCDefinition.forId(745).getHandlers().put("option:attack", this);
// guild
SceneryDefinition.forId(24357).getHandlers().put("option:climb-up", this);
SceneryDefinition.forId(10558).getHandlers().put("option:open", this);
SceneryDefinition.forId(10560).getHandlers().put("option:climb-up", this);
return this;
}
@ -113,12 +109,6 @@ public final class DragonSlayerPlugin extends OptionHandler {
final Quest quest = player.getQuestRepository().getQuest("Dragon Slayer");
final int id = node instanceof Item ? ((Item) node).getId() : node instanceof Scenery ? ((Scenery) node).getId() : ((NPC) node).getId();
switch (id) {
case 10560:
ClimbActionHandler.climb(player, new Animation(828), Location.create(3191, 3355, 0));
break;
case 10558:
ClimbActionHandler.climb(player, new Animation(-1), Location.create(3189, 9758, 0));
return true;
case 1755:
if (player.getLocation().withinDistance(Location.create(2939, 9656, 0))) {
ClimbActionHandler.climb(player, new Animation(828), Location.create(2939, 3256, 0));
@ -127,13 +117,6 @@ public final class DragonSlayerPlugin extends OptionHandler {
return true;
}
break;
case 24357:
if (player.getLocation().getDistance(Location.create(3188, 3358, 0)) < 3) {
ClimbActionHandler.climb(player, new Animation(828), Location.create(3188, 3354, 1));
} else {
ClimbActionHandler.climbLadder(player, (Scenery) node, "climb-up");
}
break;
case 742:
if (player.getQuestRepository().getQuest("Dragon Slayer").getStage(player) == 40 && (player.getInventory().containsItem(DragonSlayer.ELVARG_HEAD))) {
player.getPacketDispatch().sendMessage("You have already slain the dragon. Now you just need to return to Oziach for");

View file

@ -77,9 +77,11 @@ public final class ClimbActionHandler {
}
switch (option) {
case "climb-up":
case "walk-up":
endLadder = getLadder(startLadder, false);
break;
case "climb-down":
case "walk-down":
if (startLadder.getName().equals("Trapdoor")) {
animation = CLIMB_DOWN;
}