Implemented The Dig Site quest

This commit is contained in:
Oven Bread
2024-03-17 07:53:59 +00:00
committed by Ryan
parent ca53059131
commit 06038dbbdc
29 changed files with 3253 additions and 394 deletions
@@ -1,50 +0,0 @@
package content.global.handlers.item.withnpc
import core.api.openDialogue
import org.rs09.consts.Items
import org.rs09.consts.NPCs
import content.region.misthalin.digsite.dialogue.ArchaeologistcalExpertUsedOnDialogueFile
import core.game.interaction.InteractionListener
import core.game.interaction.IntType
open class ArchaeologicalExpertListener() : InteractionListener {
val staff = Items.ANCIENT_STAFF_4675
val unidentifiedLiquid = Items.UNIDENTIFIED_LIQUID_702
val nitroglycerin = Items.NITROGLYCERIN_703
val ammoniumNitrate = Items.AMMONIUM_NITRATE_701
val nuggets = Items.NUGGETS_680
val needle = Items.NEEDLE_1733
val rottenApple = Items.ROTTEN_APPLE_1984
val brokenGlass = Items.BROKEN_GLASS_1469
val brokenArrow = Items.BROKEN_ARROW_687
val panningTray = Items.PANNING_TRAY_677
val bones = Items.BONES_526
val buttons = Items.BUTTONS_688
val crackedSample = Items.CRACKED_SAMPLE_674
val oldTooth = Items.OLD_TOOTH_695
val rustySword = Items.RUSTY_SWORD_686
val brokenStaff = Items.BROKEN_STAFF_689
val brokenArmour = Items.BROKEN_ARMOUR_698
val damagedArmour = Items.DAMAGED_ARMOUR_697
val ceramicRemains = Items.CERAMIC_REMAINS_694
val beltBuckle = Items.BELT_BUCKLE_684
val animalSkull = Items.ANIMAL_SKULL_671
val specialCup = Items.SPECIAL_CUP_672
val teddy = Items.TEDDY_673
val stoneTablet = Items.STONE_TABLET_699
val items = intArrayOf(staff, unidentifiedLiquid, nitroglycerin, ammoniumNitrate, nuggets, needle, rottenApple,
brokenGlass, brokenArrow, panningTray, bones, buttons, crackedSample, oldTooth, rustySword, brokenStaff, brokenArmour,
damagedArmour, ceramicRemains, beltBuckle, animalSkull, specialCup, teddy, stoneTablet)
val archy = NPCs.ARCHAEOLOGICAL_EXPERT_619
val lol = arrayOf(Items)
override fun defineListeners() {
onUseWith(IntType.NPC, items, archy) {
player, used, with -> openDialogue(player, ArchaeologistcalExpertUsedOnDialogueFile(used.id))
return@onUseWith false
}
}
}
@@ -1,120 +0,0 @@
package content.global.handlers.scenery;
import core.cache.def.impl.SceneryDefinition;
import core.game.component.CloseEvent;
import core.game.component.Component;
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.net.packet.PacketRepository;
import core.net.packet.context.MinimapStateContext;
import core.net.packet.out.MinimapState;
import core.plugin.Initializable;
import core.plugin.Plugin;
/**
* Handles the reading of a sign post.
* @author 'Vexia
*/
@Initializable
public class ReadSignPostPlugin extends OptionHandler {
/**
* Represents the areas on the sign.
* @author 'Vexia
*/
public enum Signs {
NEAR_LUMBRIDGE(18493, "North to farms and<br> Varrock.", "The River Lum lies to<br> the south.", "West to<br>Lumbridge.", "East to Al<br>Kharid - toll<br>gate; bring some<br>money."), NEAR_VARROCK(24263, "Sheep lay this way.", "South through farms<br> to Al Kharid and<br> Lumbridge", "West to Champion's Guild<br> and Varrock south<br> gate.", "East to Al Kharid mine and<br> follow the path north to<br> Varrock east gate.");
public static Signs forId(int id) {
for (Signs sign : Signs.values()) {
if (sign == null) {
continue;
}
if (sign.object == id) {
return sign;
}
}
return null;
}
/**
* The object id.
*/
private int object;
/**
* The directions.
*/
private String directions[];
/**
* Constructs a new {@code ReadSignPostPlugin.java} {@code Object}.
* @param object the object.
* @param directions the directions.
*/
Signs(int object, String... directions) {
this.object = object;
this.directions = directions;
}
}
@Override
public boolean handle(Player player, Node node, String option) {
PacketRepository.send(MinimapState.class, new MinimapStateContext(player, 2));
player.getInterfaceManager().open(new Component(135)).setCloseEvent(new CloseEvent() {
@Override
public boolean close(Player player, Component c) {
PacketRepository.send(MinimapState.class, new MinimapStateContext(player, 0));
return true;
}
});
final Scenery object = (Scenery) node;
Signs sign = Signs.forId(object.getId());
if (sign == null) {
return false;
}
String[] dirs = sign.directions;
if (object.getLocation().getX() == 3107 && object.getLocation().getY() == 3296) {
dirs[0] = "North to Draynor<br> Manor";
dirs[1] = "South to Draynor<br> Village";
dirs[2] = "West to Port<br> Sarim";
dirs[3] = "East to<br> Lumbridge";
}
player.getPacketDispatch().sendString(dirs[0], 135, 3); // North
player.getPacketDispatch().sendString(dirs[1], 135, 9); // South
player.getPacketDispatch().sendString(dirs[2], 135, 12); // West
player.getPacketDispatch().sendString(dirs[3], 135, 8); // East
return true;
}
@Override
public Plugin<Object> newInstance(Object arg) throws Throwable {
SceneryDefinition.forId(2366).getHandlers().put("option:read", this);
SceneryDefinition.forId(2367).getHandlers().put("option:read", this);
SceneryDefinition.forId(2368).getHandlers().put("option:read", this);
SceneryDefinition.forId(2369).getHandlers().put("option:read", this);
SceneryDefinition.forId(2370).getHandlers().put("option:read", this);
SceneryDefinition.forId(2371).getHandlers().put("option:read", this);
SceneryDefinition.forId(4132).getHandlers().put("option:read", this);
SceneryDefinition.forId(4133).getHandlers().put("option:read", this);
SceneryDefinition.forId(4134).getHandlers().put("option:read", this);
SceneryDefinition.forId(4135).getHandlers().put("option:read", this);
SceneryDefinition.forId(5164).getHandlers().put("option:read", this);
SceneryDefinition.forId(10090).getHandlers().put("option:read", this);
SceneryDefinition.forId(13873).getHandlers().put("option:read", this);
SceneryDefinition.forId(15522).getHandlers().put("option:read", this);
SceneryDefinition.forId(18493).getHandlers().put("option:read", this);
SceneryDefinition.forId(24263).getHandlers().put("option:read", this);
SceneryDefinition.forId(25397).getHandlers().put("option:read", this);
SceneryDefinition.forId(30039).getHandlers().put("option:read", this);
SceneryDefinition.forId(30040).getHandlers().put("option:read", this);
SceneryDefinition.forId(31296).getHandlers().put("option:read", this);
SceneryDefinition.forId(31298).getHandlers().put("option:read", this);
SceneryDefinition.forId(31299).getHandlers().put("option:read", this);
SceneryDefinition.forId(31300).getHandlers().put("option:read", this);
// ObjectDefinition.forId(31301).getConfigurations().put("option:read", this);//goblin village
return this;
}
}
@@ -0,0 +1,175 @@
package content.global.handlers.scenery
import core.api.*
import core.game.interaction.IntType
import core.game.interaction.InteractionListener
import core.game.world.map.Location
import org.rs09.consts.Components
import org.rs09.consts.Scenery
class SignpostListener : InteractionListener {
override fun defineListeners() {
on(Scenery.SIGNPOST_18493, IntType.SCENERY, "read") { player, node ->
if (node.asScenery().location.equals(Location(3235, 3228))) {
setInterfaceText(player, "Head north towards Fred's farm, and the windmill.", 135, 3) // North
setInterfaceText(player, "South to the swamps of Lumbridge.", 135, 9) // South
setInterfaceText(player, "Cross the bridge and head east to Al Kharid or north to Varrock.", 135, 8) // East
setInterfaceText(player, "West to the Lumbridge Castle and Draynor Village. Beware the goblins!", 135, 12) // West
openInterface(player, Components.AIDE_COMPASS_135)
} else if (node.asScenery().location.equals(Location(3261, 3230))) {
setInterfaceText(player, "North to farms and Varrock.", 135, 3) // North
setInterfaceText(player, "The River Lum lies to the south.", 135, 9) // South
setInterfaceText(player, "East to Al Kharid - toll gate; bring some money.", 135, 8) // East
setInterfaceText(player, "West to Lumbridge.", 135, 12) // West
openInterface(player, Components.AIDE_COMPASS_135)
} else if (node.asScenery().location.equals(Location(2983, 3278))) {
setInterfaceText(player, "North to the glorious White Knights' city of Falador.", 135, 3) // North
setInterfaceText(player, "South to Rimmington.", 135, 9) // South
setInterfaceText(player, "East to Port Sarim and Draynor Village.", 135, 8) // East
setInterfaceText(player, "West to the Crafting Guild.", 135, 12) // West
openInterface(player, Components.AIDE_COMPASS_135)
} else if (node.asScenery().location.equals(Location(3107, 3296))) {
setInterfaceText(player, "North to Draynor Manor.", 135, 3) // North
setInterfaceText(player, "South to Draynor Village and the Wizards' Tower.", 135, 9) // South
setInterfaceText(player, "East to Lumbridge.", 135, 8) // East
setInterfaceText(player, "West to Port Sarim.", 135, 12) // West
openInterface(player, Components.AIDE_COMPASS_135)
} else {
setInterfaceText(player, "North to unknown.", 135, 3) // North
setInterfaceText(player, "South to unknown.", 135, 9) // South
setInterfaceText(player, "East to unknown.", 135, 8) // East
setInterfaceText(player, "West to unknown.", 135, 12) // West
openInterface(player, Components.AIDE_COMPASS_135)
}
return@on true
}
on(Scenery.SIGNPOST_24263, IntType.SCENERY, "read") { player, node ->
if (node.asScenery().location.equals(Location(3268, 3332))) {
setInterfaceText(player, "Sheep lay this way.", 135, 3) // North
setInterfaceText(player, "South through farms to Al Kharid and Lumbridge.", 135, 9) // South
setInterfaceText(player, "East to Al Kharid mine and follow the path north to Varrock east gate.", 135, 8) // East
setInterfaceText(player, "West to Champion's Guild and Varrock south gate.", 135, 12) // West
openInterface(player, Components.AIDE_COMPASS_135)
} else if (node.asScenery().location.equals(Location(3283, 3333))) {
setInterfaceText(player, "North to Varrock mine and Varrock east gate.", 135, 3) // North
setInterfaceText(player, "South to large Mining area and Al Kharid.", 135, 9) // South
setInterfaceText(player, "Follow the path east to the Dig Site.", 135, 8) // East
setInterfaceText(player, "West to Champion's Guild and Varrock south gate.", 135, 12) // West
openInterface(player, Components.AIDE_COMPASS_135)
} else {
setInterfaceText(player, "North to unknown.", 135, 3) // North
setInterfaceText(player, "South to unknown.", 135, 9) // South
setInterfaceText(player, "East to unknown.", 135, 8) // East
setInterfaceText(player, "West to unknown.", 135, 12) // West
openInterface(player, Components.AIDE_COMPASS_135)
}
return@on true
}
on(Scenery.SIGNPOST_4132, IntType.SCENERY, "read") { player, node ->
if (node.asScenery().location.equals(Location(3166, 3286))) {
setInterfaceText(player, "North to the windmill.", 135, 3) // North
setInterfaceText(player, "South to a fishing pond next to Fred's farm.", 135, 9) // South
setInterfaceText(player, "East to Lumbridge.", 135, 8) // East
setInterfaceText(player, "West to Port Sarim and Draynor Village.", 135, 12) // West
openInterface(player, Components.AIDE_COMPASS_135)
} else if (node.asScenery().location.equals(Location(3285, 3430))) {
setInterfaceText(player, "North to the Lumber Yard.", 135, 3) // North
setInterfaceText(player, "South to Al Kharid and Lumbridge.", 135, 9) // South
setInterfaceText(player, "East to the Dig Site.", 135, 8) // East
setInterfaceText(player, "West to Varrock.", 135, 12) // West
openInterface(player, Components.AIDE_COMPASS_135)
} else if (node.asScenery().location.equals(Location(2734, 3485))) {
setInterfaceText(player, "North to Sinclair Mansion.", 135, 3) // North
setInterfaceText(player, "South to the Courthouse.", 135, 9) // South
setInterfaceText(player, "East to Camelot Castle and Catherby.", 135, 8) // East
setInterfaceText(player, "Follow the path west to Ardougne.", 135, 12) // West
openInterface(player, Components.AIDE_COMPASS_135)
} else if (node.asScenery().location.equals(Location(2604, 3240))) {
setInterfaceText(player, "North to the Ardougne City Zoo.", 135, 3) // North
setInterfaceText(player, "South to the Monastery.", 135, 9) // South
setInterfaceText(player, "East to the Tower of Life.", 135, 8) // East
setInterfaceText(player, "West to the Clocktower.", 135, 12) // West
openInterface(player, Components.AIDE_COMPASS_135)
} else if (node.asScenery().location.equals(Location(2605, 3298))) {
setInterfaceText(player, "North to the Fishing Guild and Hemenster.", 135, 3) // North
setInterfaceText(player, "South to the Ardougne City Zoo.", 135, 9) // South
setInterfaceText(player, "East to Ardougne Market.", 135, 8) // East
setInterfaceText(player, "West to Ardougne Castle and West Ardougne.", 135, 12) // West
openInterface(player, Components.AIDE_COMPASS_135)
} else if (node.asScenery().location.equals(Location(2646, 3404))) {
setInterfaceText(player, "North to the Ranging Guild and Seer's Village.", 135, 3) // North
setInterfaceText(player, "South to the Ardougne City.", 135, 9) // South
setInterfaceText(player, "East to the Sorcerer's Tower.", 135, 8) // East
setInterfaceText(player, "West to the Fishing Guild.", 135, 12) // West
openInterface(player, Components.AIDE_COMPASS_135)
} else {
setInterfaceText(player, "North to unknown.", 135, 3) // North
setInterfaceText(player, "South to unknown.", 135, 9) // South
setInterfaceText(player, "East to unknown.", 135, 8) // East
setInterfaceText(player, "West to unknown.", 135, 12) // West
openInterface(player, Components.AIDE_COMPASS_135)
}
return@on true
}
on(Scenery.SIGNPOST_4134, IntType.SCENERY, "read") { player, node ->
if (node.asScenery().location.equals(Location(2651, 3606))) {
setInterfaceText(player, "North to Rellekka.", 135, 3) // North
setInterfaceText(player, "South to Seers' Village.", 135, 9) // South
setInterfaceText(player, "East to Death Plateau.", 135, 8) // East
setInterfaceText(player, "West to the Lighthouse.", 135, 12) // West
openInterface(player, Components.AIDE_COMPASS_135)
} else if (node.asScenery().location.equals(Location(3100, 3418))) {
setInterfaceText(player, "North to Edgeville.", 135, 3) // North
setInterfaceText(player, "South to Draynor Manor.", 135, 9) // South
setInterfaceText(player, "East to Varrock west gate.", 135, 8) // East
setInterfaceText(player, "West to Barbarian Village.", 135, 12) // West
openInterface(player, Components.AIDE_COMPASS_135)
} else {
setInterfaceText(player, "North to unknown.", 135, 3) // North
setInterfaceText(player, "South to unknown.", 135, 9) // South
setInterfaceText(player, "East to unknown.", 135, 8) // East
setInterfaceText(player, "West to unknown.", 135, 12) // West
openInterface(player, Components.AIDE_COMPASS_135)
}
return@on true
}
}
/**
* Old handlers of Signpost. Not all should be opening the AIDE_COMPASS.
*
* @Override
* public Plugin<Object> newInstance(Object arg) throws Throwable {
* SceneryDefinition.forId(4132).getHandlers().put("option:read", this);
* SceneryDefinition.forId(4133).getHandlers().put("option:read", this);
* SceneryDefinition.forId(4134).getHandlers().put("option:read", this);
* SceneryDefinition.forId(4135).getHandlers().put("option:read", this);
* SceneryDefinition.forId(5164).getHandlers().put("option:read", this);
* SceneryDefinition.forId(10090).getHandlers().put("option:read", this);
* SceneryDefinition.forId(13873).getHandlers().put("option:read", this);
* SceneryDefinition.forId(15522).getHandlers().put("option:read", this);
* SceneryDefinition.forId(25397).getHandlers().put("option:read", this);
* SceneryDefinition.forId(30039).getHandlers().put("option:read", this);
* SceneryDefinition.forId(30040).getHandlers().put("option:read", this);
* SceneryDefinition.forId(31296).getHandlers().put("option:read", this);
* SceneryDefinition.forId(31298).getHandlers().put("option:read", this);
* SceneryDefinition.forId(31299).getHandlers().put("option:read", this);
* SceneryDefinition.forId(31300).getHandlers().put("option:read", this);
* // ObjectDefinition.forId(31301).getConfigurations().put("option:read", this);//goblin village
* return this;
* }
*
* Was technically supposed to hide the map
* @Override
* public boolean handle(Player player, Node node, String option) {
* PacketRepository.send(MinimapState.class, new MinimapStateContext(player, 2));
* player.getInterfaceManager().open(new Component(135)).setCloseEvent(new CloseEvent() {
* @Override
* public boolean close(Player player, Component c) {
* PacketRepository.send(MinimapState.class, new MinimapStateContext(player, 0));
* return true;
* }
* });
* return true;
* }
*/
}
@@ -2,6 +2,7 @@ package content.global.skill.thieving
import content.global.skill.skillcapeperks.SkillcapePerks
import core.api.*
import core.api.utils.WeightBasedTable
import core.game.node.entity.combat.ImpactHandler
import core.game.node.entity.impl.Animator
import core.game.node.entity.skill.Skills
@@ -10,18 +11,44 @@ import core.tools.RandomFunction
import org.rs09.consts.Items
import core.game.interaction.InteractionListener
import core.game.interaction.IntType
import core.game.node.entity.player.Player
import core.game.node.item.Item
import org.rs09.consts.Sounds
class ThievingListeners : InteractionListener {
private val PICKPOCKET_ANIM = Animation(881,Animator.Priority.HIGH)
private val NPC_ANIM = Animation(422)
companion object {
val PICKPOCKET_ANIM = Animation(881,Animator.Priority.HIGH)
val NPC_ANIM = Animation(422)
/** Standalone pickpocketing function. For thieving other stuff outside of normal pickpocketing tables. */
fun pickpocketRoll(player: Player, low: Double, high: Double, table: WeightBasedTable): ArrayList<Item>? {
// Able to pickpocket
var successMod = 0.0
if(SkillcapePerks.isActive(SkillcapePerks.SMOOTH_HANDS, player)) {
successMod += 25
}
if (player.equipment.contains(Items.GLOVES_OF_SILENCE_10075,1)){
successMod += 3
}
val chance = RandomFunction.randomDouble(1.0, 100.0)
val failThreshold = RandomFunction.getSkillSuccessChance(low, high ,player.skills.getLevel(Skills.THIEVING)) + successMod
if (chance > failThreshold) {
// Fail Pickpocket
return null // Returns a null, different from an empty table.
} else {
// Success Pickpocket
return table.roll() // You could also successfully pickpocket nothing when the table returns a blank array.
}
}
}
override fun defineListeners() {
on(IntType.NPC,"pickpocket","pick-pocket"){ player, node ->
val pickpocketData = Pickpockets.forID(node.id) ?: return@on false
var successMod = 0.0
if(player.inCombat()){
player.sendMessage("You can't pickpocket while in combat.")
@@ -38,18 +65,9 @@ class ThievingListeners : InteractionListener {
return@on true
}
if(SkillcapePerks.isActive(SkillcapePerks.SMOOTH_HANDS, player)) {
successMod += 25
}
if (player.equipment.contains(Items.GLOVES_OF_SILENCE_10075,1)){
successMod += 3
}
player.animator.animate(PICKPOCKET_ANIM)
val chance = RandomFunction.randomDouble(1.0,100.0)
val failThreshold = pickpocketData.getSuccessChance(player) + successMod
if(chance > failThreshold){
val lootTable = pickpocketRoll(player, pickpocketData.low, pickpocketData.high, pickpocketData.table)
if(lootTable == null){
node.asNpc().face(player)
node.asNpc().animator.animate(NPC_ANIM)
@@ -63,7 +81,7 @@ class ThievingListeners : InteractionListener {
} else {
playAudio(player, Sounds.PICK_2581)
player.lock(2)
pickpocketData.table.roll().forEach { player.inventory.add(it) }
lootTable.forEach { player.inventory.add(it) }
player.skills.addExperience(Skills.THIEVING,pickpocketData.experience)
}