mirror of
https://gitlab.com/2009scape/2009scape.git
synced 2025-12-09 16:45:44 -07:00
Converted all item -> withnpc plugins to listeners
This commit is contained in:
parent
ea1db77145
commit
a8b00c25a2
13 changed files with 192 additions and 364 deletions
|
|
@ -117,11 +117,7 @@ enum class Bones
|
||||||
for (i in bones.keys) {
|
for (i in bones.keys) {
|
||||||
list.add(i)
|
list.add(i)
|
||||||
}
|
}
|
||||||
val array = IntArray(list.size)
|
return list.toIntArray()
|
||||||
for (i in list.indices) {
|
|
||||||
array[i] = list[i]
|
|
||||||
}
|
|
||||||
return array
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -1,50 +0,0 @@
|
||||||
package core.game.interaction.item.withnpc;
|
|
||||||
|
|
||||||
import org.rs09.consts.Items;
|
|
||||||
import core.game.interaction.NodeUsageEvent;
|
|
||||||
import core.game.interaction.UseWithHandler;
|
|
||||||
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.zone.ZoneBorders;
|
|
||||||
import core.plugin.Initializable;
|
|
||||||
import core.plugin.Plugin;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Represents the plugin used to "poison" King Arthur.
|
|
||||||
* @author afaroutdude
|
|
||||||
*/
|
|
||||||
@Initializable
|
|
||||||
public final class ForestersArmsCiderPlugin extends UseWithHandler {
|
|
||||||
private static final Item CIDER = new Item(Items.CIDER_5763);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructs a new {@code LadyKeliRopePlugin} {@code Object}.
|
|
||||||
*/
|
|
||||||
public ForestersArmsCiderPlugin() {
|
|
||||||
super(Items.CIDER_5763);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
|
||||||
int[] ids = {1,2,3,4,5};
|
|
||||||
for (int id : ids) {
|
|
||||||
addHandler(id, NPC_TYPE, this);
|
|
||||||
}
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean handle(NodeUsageEvent event) {
|
|
||||||
final Player player = event.getPlayer();
|
|
||||||
if (!new ZoneBorders(2689, 3488, 2700, 3498, 0).insideBorder(player)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
final NPC npc = event.getUsedWith() instanceof NPC ? event.getUsedWith().asNpc() : null;
|
|
||||||
if (npc != null) {
|
|
||||||
player.getDialogueInterpreter().open(npc.getId(), npc, CIDER);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,106 +0,0 @@
|
||||||
package core.game.interaction.item.withnpc;
|
|
||||||
|
|
||||||
import core.game.interaction.NodeUsageEvent;
|
|
||||||
import core.game.interaction.UseWithHandler;
|
|
||||||
import core.game.node.entity.npc.NPC;
|
|
||||||
import core.game.node.entity.player.Player;
|
|
||||||
import core.game.node.entity.player.link.quest.Quest;
|
|
||||||
import core.game.node.item.Item;
|
|
||||||
import core.game.system.task.Pulse;
|
|
||||||
import rs09.game.world.World;
|
|
||||||
import core.game.world.map.Location;
|
|
||||||
import core.game.world.map.path.Path;
|
|
||||||
import core.game.world.map.path.Pathfinder;
|
|
||||||
import core.game.world.update.flag.context.Animation;
|
|
||||||
import core.plugin.Initializable;
|
|
||||||
import core.plugin.Plugin;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Represents the plugin used to handle the use with interactions.
|
|
||||||
* @author 'Vexia
|
|
||||||
* @version 1.0
|
|
||||||
*/
|
|
||||||
@Initializable
|
|
||||||
public final class GertrudeCatUsePlugin extends UseWithHandler {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Represents the animation of bending down.
|
|
||||||
*/
|
|
||||||
private static final Animation BEND_DOWN = Animation.create(827);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Represents the empty bucket.
|
|
||||||
*/
|
|
||||||
private static final Item EMPTY_BUCKET = new Item(1925);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructs a new {@code GertrudeCatUsePlugin} {@code Object}.
|
|
||||||
*/
|
|
||||||
public GertrudeCatUsePlugin() {
|
|
||||||
super(1927, 1552, 327, 13236);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
|
||||||
addHandler(2997, NPC_TYPE, this);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean handle(NodeUsageEvent event) {
|
|
||||||
final Player player = event.getPlayer();
|
|
||||||
final NPC npc = ((NPC) event.getUsedWith());
|
|
||||||
final Quest quest = player.getQuestRepository().getQuest("Gertrude's Cat");
|
|
||||||
if (event.getUsedItem().getId() == 1927 && quest.getStage(player) == 20) {
|
|
||||||
if (player.getInventory().remove(event.getUsedItem())) {
|
|
||||||
player.getInventory().add(EMPTY_BUCKET);
|
|
||||||
player.animate(BEND_DOWN);
|
|
||||||
npc.sendChat("Mew!");
|
|
||||||
quest.setStage(player, 30);
|
|
||||||
}
|
|
||||||
} else if (event.getUsedItem().getId() == 1552 && quest.getStage(player) == 30) {
|
|
||||||
if (player.getInventory().remove(event.getUsedItem())) {
|
|
||||||
player.animate(BEND_DOWN);
|
|
||||||
npc.sendChat("Mew!");
|
|
||||||
quest.setStage(player, 40);
|
|
||||||
}
|
|
||||||
} else if (event.getUsedItem().getId() == 327 && quest.getStage(player) == 50) {
|
|
||||||
player.getDialogueInterpreter().sendDialogue("The cat doesn't seem interested in that.");
|
|
||||||
} else if (event.getUsedItem().getId() == 13236) {
|
|
||||||
if (player.getInventory().remove(event.getUsedItem())) {
|
|
||||||
quest.setStage(player, 60);
|
|
||||||
player.lock(5);
|
|
||||||
World.getPulser().submit(new Pulse(1) {
|
|
||||||
int count = 0;
|
|
||||||
final NPC kitten = NPC.create(761, player.getLocation());
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean pulse() {
|
|
||||||
switch (count) {
|
|
||||||
case 0:
|
|
||||||
kitten.init();
|
|
||||||
kitten.face(npc);
|
|
||||||
npc.face(kitten);
|
|
||||||
npc.sendChat("Pur...");
|
|
||||||
kitten.sendChat("Pur...");
|
|
||||||
final Path path = Pathfinder.find(npc, new Location(3310, 3510, 1));
|
|
||||||
path.walk(npc);
|
|
||||||
final Path pathh = Pathfinder.find(kitten, new Location(3310, 3510, 1));
|
|
||||||
pathh.walk(kitten);
|
|
||||||
break;
|
|
||||||
case 5:
|
|
||||||
kitten.clear();
|
|
||||||
player.setAttribute("hidefluff", System.currentTimeMillis() + 60000);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
count++;
|
|
||||||
return count == 6;
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,43 +0,0 @@
|
||||||
package core.game.interaction.item.withnpc;
|
|
||||||
|
|
||||||
import org.rs09.consts.Items;
|
|
||||||
import core.game.interaction.NodeUsageEvent;
|
|
||||||
import core.game.interaction.UseWithHandler;
|
|
||||||
import core.game.node.entity.npc.NPC;
|
|
||||||
import core.game.node.entity.player.Player;
|
|
||||||
import core.game.node.item.Item;
|
|
||||||
import core.plugin.Initializable;
|
|
||||||
import core.plugin.Plugin;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Represents the plugin used to "poison" King Arthur.
|
|
||||||
* @author afaroutdude
|
|
||||||
*/
|
|
||||||
@Initializable
|
|
||||||
public final class KingArthurPoisonChalicePlugin extends UseWithHandler {
|
|
||||||
private static final Item POISON_CHALICE = new Item(Items.POISON_CHALICE_197);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructs a new {@code LadyKeliRopePlugin} {@code Object}.
|
|
||||||
*/
|
|
||||||
public KingArthurPoisonChalicePlugin() {
|
|
||||||
super(POISON_CHALICE.getId());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
|
||||||
addHandler(251, NPC_TYPE, this);
|
|
||||||
return new KingArthurPoisonChalicePlugin();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean handle(NodeUsageEvent event) {
|
|
||||||
final Player player = event.getPlayer();
|
|
||||||
final NPC npc = event.getUsedWith() instanceof NPC ? event.getUsedWith().asNpc() : null;
|
|
||||||
if (npc != null) {
|
|
||||||
player.getDialogueInterpreter().open(npc.getId(), npc, POISON_CHALICE);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,57 +0,0 @@
|
||||||
package core.game.interaction.item.withnpc;
|
|
||||||
|
|
||||||
import core.game.interaction.NodeUsageEvent;
|
|
||||||
import core.game.interaction.UseWithHandler;
|
|
||||||
import core.game.node.entity.player.Player;
|
|
||||||
import core.game.node.entity.player.link.quest.Quest;
|
|
||||||
import core.game.node.item.Item;
|
|
||||||
import rs09.game.world.World;
|
|
||||||
import core.plugin.Initializable;
|
|
||||||
import core.plugin.Plugin;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Represents the plugin used to tie up lady keli.
|
|
||||||
* @author 'Vexia
|
|
||||||
* @version 1.0
|
|
||||||
*/
|
|
||||||
@Initializable
|
|
||||||
public final class LadyKeliRopePlugin extends UseWithHandler {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Represents the rope item.
|
|
||||||
*/
|
|
||||||
private static final Item ROPE = new Item(954);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructs a new {@code LadyKeliRopePlugin} {@code Object}.
|
|
||||||
*/
|
|
||||||
public LadyKeliRopePlugin() {
|
|
||||||
super(954);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
|
||||||
addHandler(919, NPC_TYPE, this);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean handle(NodeUsageEvent event) {
|
|
||||||
final Player player = event.getPlayer();
|
|
||||||
final Quest quest = player.getQuestRepository().getQuest("Prince Ali Rescue");
|
|
||||||
if (quest.getStage(player) >= 40 && player.getAttribute("guard-drunk", false) && quest.getStage(player) != 100) {
|
|
||||||
if (player.getInventory().remove(ROPE)) {
|
|
||||||
player.getDialogueInterpreter().sendDialogue("You overpower Keli, tie her up, and put her in a cupboard.");
|
|
||||||
quest.setStage(player, 50);
|
|
||||||
player.setAttribute("keli-gone", World.getTicks() + 350);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (quest.getStage(player) == 40) {
|
|
||||||
player.getPacketDispatch().sendMessage("You need to do something about the guard first.");
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,51 +0,0 @@
|
||||||
package core.game.interaction.item.withnpc;
|
|
||||||
|
|
||||||
import core.game.interaction.NodeUsageEvent;
|
|
||||||
import core.game.interaction.UseWithHandler;
|
|
||||||
import core.plugin.Initializable;
|
|
||||||
import core.plugin.Plugin;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Represents the needle on a cow plugin.
|
|
||||||
* @author 'Vexia
|
|
||||||
* @date 18/11/2013
|
|
||||||
*/
|
|
||||||
@Initializable
|
|
||||||
public class NeedleCowPlugin extends UseWithHandler {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructs a new {@code NeedleCowPlugin} {@code Object}.
|
|
||||||
*/
|
|
||||||
public NeedleCowPlugin() {
|
|
||||||
super(1733);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
|
||||||
addHandler(81, NPC_TYPE, this);
|
|
||||||
addHandler(397, NPC_TYPE, this);
|
|
||||||
addHandler(955, NPC_TYPE, this);
|
|
||||||
addHandler(1691, NPC_TYPE, this);
|
|
||||||
addHandler(1766, NPC_TYPE, this);
|
|
||||||
addHandler(1767, NPC_TYPE, this);
|
|
||||||
addHandler(1768, NPC_TYPE, this);
|
|
||||||
addHandler(1886, NPC_TYPE, this);
|
|
||||||
addHandler(1998, NPC_TYPE, this);
|
|
||||||
addHandler(1999, NPC_TYPE, this);
|
|
||||||
addHandler(2000, NPC_TYPE, this);
|
|
||||||
addHandler(2310, NPC_TYPE, this);
|
|
||||||
addHandler(3309, NPC_TYPE, this);
|
|
||||||
addHandler(5210, NPC_TYPE, this);
|
|
||||||
addHandler(5211, NPC_TYPE, this);
|
|
||||||
addHandler(5603, NPC_TYPE, this);
|
|
||||||
addHandler(7484, NPC_TYPE, this);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean handle(NodeUsageEvent event) {
|
|
||||||
event.getPlayer().getPacketDispatch().sendMessage("The cow doesn't want that.");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,52 +0,0 @@
|
||||||
package core.game.interaction.item.withnpc;
|
|
||||||
|
|
||||||
import core.game.interaction.NodeUsageEvent;
|
|
||||||
import core.game.interaction.UseWithHandler;
|
|
||||||
import core.game.node.entity.npc.NPC;
|
|
||||||
import core.game.node.entity.player.Player;
|
|
||||||
import core.game.node.entity.player.link.diary.DiaryType;
|
|
||||||
import core.game.node.item.Item;
|
|
||||||
import core.plugin.Initializable;
|
|
||||||
import core.plugin.Plugin;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Handles the bones on stray dogs plugin.
|
|
||||||
* @author Vexia
|
|
||||||
*/
|
|
||||||
@Initializable
|
|
||||||
public class StrayDogBonesPlugin extends UseWithHandler {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The dog ids.
|
|
||||||
*/
|
|
||||||
private static final int[] DOGS = new int[] { 4766, 4767, 5917, 5918 };
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructs a new {@code StrayDogBonesPlugin} {@code Object}
|
|
||||||
*/
|
|
||||||
public StrayDogBonesPlugin() {
|
|
||||||
super(526, 528, 530, 532, 534, 536, 2530, 2859, 3123, 3125, 3127, 3128, 3129, 3130, 3131, 3132, 3133, 3179, 3180, 3181, 3182, 3183, 3185, 3186, 3187, 4812, 4830, 4832, 4834, 6729, 6812, 11806);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
|
||||||
for (int id : DOGS) {
|
|
||||||
addHandler(id, NPC_TYPE, this);
|
|
||||||
}
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean handle(NodeUsageEvent event) {
|
|
||||||
final Item item = event.getUsedItem();
|
|
||||||
final Player player = event.getPlayer();
|
|
||||||
final NPC npc = event.getUsedWith().asNpc();
|
|
||||||
if (player.getInventory().remove(item)) {
|
|
||||||
player.sendMessage("You feed your dog bones.");
|
|
||||||
npc.sendChat("Woof");
|
|
||||||
player.getAchievementDiaryManager().finishTask(player, DiaryType.VARROCK, 0, 8);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -18,6 +18,7 @@ import core.game.node.entity.player.Player
|
||||||
import core.game.node.entity.player.link.TeleportManager
|
import core.game.node.entity.player.link.TeleportManager
|
||||||
import core.game.node.entity.player.link.audio.Audio
|
import core.game.node.entity.player.link.audio.Audio
|
||||||
import core.game.node.entity.player.link.emote.Emotes
|
import core.game.node.entity.player.link.emote.Emotes
|
||||||
|
import core.game.node.entity.player.link.quest.QuestRepository
|
||||||
import core.game.node.entity.skill.gather.SkillingTool
|
import core.game.node.entity.skill.gather.SkillingTool
|
||||||
import core.game.node.item.GroundItem
|
import core.game.node.item.GroundItem
|
||||||
import core.game.node.item.GroundItemManager
|
import core.game.node.item.GroundItemManager
|
||||||
|
|
@ -775,6 +776,20 @@ fun location(x: Int, y: Int, z: Int): Location{
|
||||||
return Location.create(x,y,z)
|
return Location.create(x,y,z)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if the given entity is within the given ZoneBorders
|
||||||
|
*/
|
||||||
|
fun inBorders(entity: Entity, borders: ZoneBorders): Boolean{
|
||||||
|
return borders.insideBorder(entity)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if the given entity is within the given borders
|
||||||
|
*/
|
||||||
|
fun inBorders(entity: Entity, swX: Int, swY: Int, neX: Int, neY: Int): Boolean {
|
||||||
|
return ZoneBorders(swX,swY,neX,neY).insideBorder(entity)
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AHeals the given entity for the given number of hitpoints
|
* AHeals the given entity for the given number of hitpoints
|
||||||
*/
|
*/
|
||||||
|
|
@ -1248,6 +1263,20 @@ fun getQP(player: Player): Int{
|
||||||
return player.questRepository.points
|
return player.questRepository.points
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the stage for the given quest for the given player
|
||||||
|
*/
|
||||||
|
fun questStage(player: Player, quest: String): Int{
|
||||||
|
return player.questRepository.getStage(quest)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the stage for the given quest for the given player
|
||||||
|
*/
|
||||||
|
fun setQuestStage(player: Player, quest: String, stage: Int) {
|
||||||
|
player.questRepository.setStage(QuestRepository.getQuests()[quest]!!, stage)
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets a scenery definition from the given ID
|
* Gets a scenery definition from the given ID
|
||||||
* @param id the ID of the scenery to get the definition for.
|
* @param id the ID of the scenery to get the definition for.
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,25 @@
|
||||||
|
package rs09.game.interaction.item.withnpc
|
||||||
|
|
||||||
|
import api.removeItem
|
||||||
|
import api.sendChat
|
||||||
|
import api.sendMessage
|
||||||
|
import core.game.content.global.Bones
|
||||||
|
import core.game.node.entity.player.link.diary.DiaryType
|
||||||
|
import org.rs09.consts.NPCs
|
||||||
|
import rs09.game.interaction.InteractionListener
|
||||||
|
|
||||||
|
class BonesOnStrayDog : InteractionListener() {
|
||||||
|
override fun defineListeners() {
|
||||||
|
val bones = Bones.array
|
||||||
|
val dogs = intArrayOf(NPCs.STRAY_DOG_4766, NPCs.STRAY_DOG_4767, NPCs.STRAY_DOG_5917, NPCs.STRAY_DOG_5918)
|
||||||
|
|
||||||
|
onUseWith(NPC, bones, *dogs){player, used, with ->
|
||||||
|
if(removeItem(player, used.asItem())){
|
||||||
|
sendMessage(player, "You feed your dog bones.")
|
||||||
|
sendChat(with.asNpc(), "Woof")
|
||||||
|
player.achievementDiaryManager.finishTask(player, DiaryType.VARROCK, 0, 8)
|
||||||
|
}
|
||||||
|
return@onUseWith true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,20 @@
|
||||||
|
package rs09.game.interaction.item.withnpc
|
||||||
|
|
||||||
|
import api.inBorders
|
||||||
|
import api.openDialogue
|
||||||
|
import org.rs09.consts.Items
|
||||||
|
import rs09.game.interaction.InteractionListener
|
||||||
|
|
||||||
|
class CiderOnForester : InteractionListener() {
|
||||||
|
override fun defineListeners() {
|
||||||
|
val ids = intArrayOf(1,2,3,4,5)
|
||||||
|
|
||||||
|
onUseWith(NPC, Items.CIDER_5763, *ids){player, used, with ->
|
||||||
|
if(inBorders(player, 2689, 3488, 2700, 3498)){
|
||||||
|
openDialogue(player, with.id, with.asNpc(), used.asItem())
|
||||||
|
return@onUseWith true
|
||||||
|
}
|
||||||
|
return@onUseWith false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,75 @@
|
||||||
|
package rs09.game.interaction.item.withnpc
|
||||||
|
|
||||||
|
import api.*
|
||||||
|
import core.game.system.task.Pulse
|
||||||
|
import core.game.world.map.Location
|
||||||
|
import core.game.world.map.path.Path
|
||||||
|
import core.game.world.map.path.Pathfinder
|
||||||
|
import org.rs09.consts.Items
|
||||||
|
import org.rs09.consts.NPCs
|
||||||
|
import rs09.game.interaction.InteractionListener
|
||||||
|
import rs09.game.world.World.Pulser
|
||||||
|
|
||||||
|
class GCItemOnCat : InteractionListener() {
|
||||||
|
override fun defineListeners() {
|
||||||
|
val GERTCAT = "Gertrude's Cat"
|
||||||
|
val BEND_DOWN = 827
|
||||||
|
|
||||||
|
onUseWith(NPC, Items.BUCKET_OF_MILK_1927, NPCs.GERTRUDES_CAT_2997) {player, used, with ->
|
||||||
|
if(questStage(player, GERTCAT) == 20 && removeItem(player, used.asItem())){
|
||||||
|
addItem(player, Items.EMPTY_BUCKET_3727)
|
||||||
|
animate(player, BEND_DOWN) //bend down
|
||||||
|
sendChat(with.asNpc(), "Mew!")
|
||||||
|
setQuestStage(player, GERTCAT, 30)
|
||||||
|
}
|
||||||
|
return@onUseWith true
|
||||||
|
}
|
||||||
|
|
||||||
|
onUseWith(NPC, Items.DOOGLE_SARDINE_1552, NPCs.GERTRUDES_CAT_2997){player, used, with ->
|
||||||
|
if(questStage(player, GERTCAT) == 30 && removeItem(player, used.asItem())){
|
||||||
|
animate(player, BEND_DOWN)
|
||||||
|
sendChat(with.asNpc(), "Mew!")
|
||||||
|
setQuestStage(player, GERTCAT, 40)
|
||||||
|
}
|
||||||
|
return@onUseWith true
|
||||||
|
}
|
||||||
|
|
||||||
|
onUseWith(NPC, Items.RAW_SARDINE_327, NPCs.GERTRUDES_CAT_2997){player, _, _ ->
|
||||||
|
sendMessage(player, "The cat doesn't seem interested in that.")
|
||||||
|
return@onUseWith true
|
||||||
|
}
|
||||||
|
|
||||||
|
onUseWith(NPC, Items.THREE_LITTLE_KITTENS_13236, NPCs.GERTRUDES_CAT_2997){player, used, with ->
|
||||||
|
if(removeItem(player, used.asItem())){
|
||||||
|
//below copied verbatim from original, I don't like it.
|
||||||
|
Pulser.submit(object : Pulse(1) {
|
||||||
|
var count = 0
|
||||||
|
val kitten = core.game.node.entity.npc.NPC.create(761, player.location)
|
||||||
|
override fun pulse(): Boolean {
|
||||||
|
when (count) {
|
||||||
|
0 -> {
|
||||||
|
kitten.init()
|
||||||
|
kitten.face(with.asNpc())
|
||||||
|
with.asNpc().face(kitten)
|
||||||
|
with.asNpc().sendChat("Pur...")
|
||||||
|
kitten.sendChat("Pur...")
|
||||||
|
val path: Path = Pathfinder.find(with.asNpc(), Location(3310, 3510, 1))
|
||||||
|
path.walk(with.asNpc())
|
||||||
|
val pathh = Pathfinder.find(kitten, Location(3310, 3510, 1))
|
||||||
|
pathh.walk(kitten)
|
||||||
|
}
|
||||||
|
5 -> {
|
||||||
|
kitten.clear()
|
||||||
|
player.setAttribute("hidefluff", System.currentTimeMillis() + 60000)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
count++
|
||||||
|
return count == 6
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
return@onUseWith true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,15 @@
|
||||||
|
package rs09.game.interaction.item.withnpc
|
||||||
|
|
||||||
|
import api.openDialogue
|
||||||
|
import org.rs09.consts.Items
|
||||||
|
import org.rs09.consts.NPCs
|
||||||
|
import rs09.game.interaction.InteractionListener
|
||||||
|
|
||||||
|
class PoisonChaliceOnKingArthur : InteractionListener() {
|
||||||
|
override fun defineListeners() {
|
||||||
|
onUseWith(NPC, Items.POISON_CHALICE_197, NPCs.KING_ARTHUR_251){player, used, with ->
|
||||||
|
openDialogue(player, with.id, with.asNpc(), used.asItem())
|
||||||
|
return@onUseWith true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,27 @@
|
||||||
|
package rs09.game.interaction.item.withnpc
|
||||||
|
|
||||||
|
import api.*
|
||||||
|
import org.rs09.consts.Items
|
||||||
|
import org.rs09.consts.NPCs
|
||||||
|
import rs09.game.interaction.InteractionListener
|
||||||
|
|
||||||
|
class RopeOnLadyKeli : InteractionListener() {
|
||||||
|
override fun defineListeners() {
|
||||||
|
val PAR = "Prince Ali Rescue"
|
||||||
|
|
||||||
|
onUseWith(NPC, Items.ROPE_954, NPCs.LADY_KELI_919) {player, used, with ->
|
||||||
|
if(questStage(player, PAR) in 40..50 && getAttribute(player, "guard-drunk", false)){
|
||||||
|
if(removeItem(player, used.asItem())){
|
||||||
|
sendDialogue(player, "You overpower Keli, tie her up, and put her in a cupboard.")
|
||||||
|
setQuestStage(player, PAR, 50)
|
||||||
|
setAttribute(player, "keli-gone", getWorldTicks() + 350)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (questStage(player, PAR) == 40){
|
||||||
|
sendMessage(player, "You need to do something about the guard first.")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return@onUseWith true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue