Converted some Al-Kharidian NPCs to listeners:

Ali the Leaflet Dropper
A'abla
Fadli
Surgeon General Tafani
Sabreen
Jaraah
This commit is contained in:
bushtail 2022-06-16 10:29:02 +00:00 committed by Ryan
parent 0e74cf0495
commit c5d0173282
18 changed files with 541 additions and 1054 deletions

View file

@ -1,137 +0,0 @@
package core.game.content.dialogue;
import core.game.node.entity.skill.Skills;
import core.game.node.entity.npc.NPC;
import core.game.node.entity.player.Player;
import core.game.system.task.Pulse;
import rs09.game.world.GameWorld;
import core.plugin.Initializable;
import core.game.world.update.flag.context.Animation;
/**
* Represents the npc aabla's dialogue.
* @author 'Vexia
* @version 1.0
*/
@Initializable
public final class AablaDialogue extends DialoguePlugin {
/**
* Represents the npc animation to use.
*/
private static final Animation ANIMATION = new Animation(881);
/**
* Constructs a new {@code AablaDialogue} {@code Object}.
*/
public AablaDialogue() {
/**
* empty.
*/
}
/**
* Constructs a new {@code AablaDialogue} {@code Object}.
* @param player the player.
*/
public AablaDialogue(Player player) {
super(player);
}
@Override
public DialoguePlugin newInstance(Player player) {
return new AablaDialogue(player);
}
@Override
public boolean open(Object... args) {
npc = (NPC) args[0];
player("Hi!");
stage = 0;
return true;
}
@Override
public boolean handle(int interfaceId, int buttonId) {
switch (stage) {
case 0:
npc("Hi. How can I help?");
stage = 1;
break;
case 1:
interpreter.sendOptions("Select an Option", "Can you heal me?", "Do you see a lot of injured fighters?", "Do you come here often?");
stage = 2;
break;
case 2:
switch (buttonId) {
case 1:
player("Can you heal me?");
stage = 10;
break;
case 2:
player("Do you see a lot of injured fighters?");
stage = 30;
break;
case 3:
player("Do you come here often?");
stage = 20;
break;
}
break;
case 10:
npc("Of course!");
stage = 11;
break;
case 11:
npc.faceTemporary(player, 2);
npc.animate(ANIMATION);
player.lock(4);
close();
GameWorld.getPulser().submit(new Pulse(3, player) {
@Override
public boolean pulse() {
if (player.getSkills().getLifepoints() == player.getSkills().getStaticLevel(Skills.HITPOINTS)) {
npc("You look healthy to me!");
} else {
player.getSkills().heal(20);
npc("There you go!");
}
stage = 12;
return true;
}
});
break;
case 12:
end();
break;
case 20:
npc("I work here, so yes!");
stage = 21;
break;
case 21:
end();
break;
case 30:
npc("Yes I do. Thankfully we can cope with almost aything.", "Jaraah really is a wonderful surgeon, his methods are a", "little unorthodox but he gets the job done.");
stage = 31;
break;
case 31:
npc("I shouldn't tell you this but his nickname is 'The", "Butcher'.");
stage = 32;
break;
case 32:
player("That's reassuring.");
stage = 33;
break;
case 33:
end();
break;
}
return true;
}
@Override
public int[] getIds() {
return new int[] { 959 };
}
}

View file

@ -1,168 +0,0 @@
package core.game.content.dialogue;
import core.cache.def.impl.NPCDefinition;
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.plugin.Initializable;
import core.plugin.Plugin;
/**
* Represents the fadli dialogue plugin.
* @author 'Vexia
* @version 1.0
*/
@Initializable
public final class FadliDialogue extends DialoguePlugin {
/**
* Constructs a new {@code FadliDialogue} {@code Object}.
*/
public FadliDialogue() {
/**
* empty.
*/
}
/**
* Constructs a new {@code FadliDialogue} {@code Object}.
* @param player the player.
*/
public FadliDialogue(Player player) {
super(player);
}
@Override
public DialoguePlugin newInstance(Player player) {
return new FadliDialogue(player);
}
@Override
public void init() {
super.init();
try {
new FadliPlugin().newInstance(null);
} catch (Throwable e) {
e.printStackTrace();
}
}
@Override
public boolean open(Object... args) {
npc = (NPC) args[0];
interpreter.sendDialogues(player, FacialExpression.HALF_GUILTY, "Hi!");
stage = 0;
return true;
}
@Override
public boolean handle(int interfaceId, int buttonId) {
switch (stage) {
case 0:
interpreter.sendDialogues(npc, FacialExpression.HALF_GUILTY, "What?");
stage = 1;
break;
case 1:
interpreter.sendOptions("Select an Option", "What do you do?", "What is this place?", "I'd like to store some items please.", "Do you watch any matches?");
stage = 2;
break;
case 2:
switch (buttonId) {
case 1:
interpreter.sendDialogues(player, FacialExpression.HALF_GUILTY, "What do you do?");
stage = 10;
break;
case 2:
interpreter.sendDialogues(player, FacialExpression.HALF_GUILTY, "What is this place?");
stage = 20;
break;
case 3:
interpreter.sendDialogues(player, FacialExpression.HALF_GUILTY, "I'd like to store some items please.");
stage = 30;
break;
case 4:
interpreter.sendDialogues(player, FacialExpression.HALF_GUILTY, "Do you watch any matches?");
stage = 40;
break;
case 40:
interpreter.sendDialogues(npc, FacialExpression.HALF_GUILTY, "When I can.");
stage = 40;
break;
}
break;
case 10:
interpreter.sendDialogues(npc, FacialExpression.HALF_GUILTY, "You can store your stuff here if you want. You can", "dump anything you don't want to carry whilst your", "fighting duels and then pick it up again on the way out.");
stage = 11;
break;
case 11:
interpreter.sendDialogues(npc, FacialExpression.HALF_GUILTY, "To be honest I'm wasted here.");
stage = 12;
break;
case 12:
interpreter.sendDialogues(npc, FacialExpression.HALF_GUILTY, "I should be winning duels in an arena! I'm the best", "warrior in Al Kharid!");
stage = 13;
break;
case 13:
interpreter.sendDialogues(player, FacialExpression.HALF_GUILTY, "Easy, tiger!");
stage = 14;
break;
case 14:
end();
break;
case 20:
interpreter.sendDialogues(npc, FacialExpression.HALF_GUILTY, "Isn't it obvious?");
stage = 21;
break;
case 21:
interpreter.sendDialogues(npc, FacialExpression.HALF_GUILTY, "This is the Duel Arena...duh!");
stage = 22;
break;
case 22:
end();
break;
case 30:
interpreter.sendDialogues(npc, FacialExpression.HALF_GUILTY, "Sure.");
stage = 31;
break;
case 31:
end();
player.getBank().open();
break;
case 40:
interpreter.sendDialogues(npc, FacialExpression.HALF_GUILTY, "Most aren't any good so I throw rotten fruit at them!");
stage = 41;
break;
case 41:
end();
break;
}
return true;
}
@Override
public int[] getIds() {
return new int[] { 958 };
}
/**
* Represents the faldi interaction plugin.
* @author 'Vexia
* @version 1.0
*/
public final class FadliPlugin extends OptionHandler {
@Override
public Plugin<Object> newInstance(Object arg) throws Throwable {
NPCDefinition.forId(958).getHandlers().put("option:buy", this);
return this;
}
@Override
public boolean handle(Player player, Node node, String option) {
node.asNpc().openShop(player);
return true;
}
}
}

View file

@ -1,118 +0,0 @@
package core.game.content.dialogue;
import core.plugin.Initializable;
import core.game.node.entity.skill.Skills;
import core.game.node.entity.npc.NPC;
import core.game.node.entity.player.Player;
import core.game.world.update.flag.context.Animation;
/**
* Represents the jaraah dialogue plugin.
* @author 'Vexia
* @version 1.0
*/
@Initializable
public final class JaraahDialogue extends DialoguePlugin {
/**
* Represents the animation to use.
*/
private static final Animation ANIMATION = new Animation(881);
/**
* Constructs a new {@code JaraahDialogue} {@code Object}.
*/
public JaraahDialogue() {
/**
* empty.
*/
}
/**
* Constructs a new {@code JaraahDialogue} {@code Object}.
* @param player the player.
*/
public JaraahDialogue(Player player) {
super(player);
}
@Override
public DialoguePlugin newInstance(Player player) {
return new JaraahDialogue(player);
}
@Override
public boolean open(Object... args) {
npc = (NPC) args[0];
interpreter.sendDialogues(player, FacialExpression.HALF_GUILTY, "Hi!");
stage = 0;
return true;
}
@Override
public boolean handle(int interfaceId, int buttonId) {
switch (stage) {
case 0:
interpreter.sendDialogues(npc, FacialExpression.HALF_GUILTY, "What? Can't you see I'm busy?!");
stage = 1;
break;
case 1:
interpreter.sendOptions("Select an Option", "Can you heal me?", "You must see some gruesome things?", "Why do they call you 'The Butcher'?");
stage = 2;
break;
case 2:
switch (buttonId) {
case 1:
interpreter.sendDialogues(player, FacialExpression.HALF_GUILTY, "Can you heal me?");
stage = 10;
break;
case 2:
interpreter.sendDialogues(player, FacialExpression.HALF_GUILTY, "You must see some gruesome things?");
stage = 20;
break;
case 3:
interpreter.sendDialogues(player, FacialExpression.HALF_GUILTY, "Why do they call you 'The Butcher'?");
stage = 30;
break;
}
break;
case 10:
interpreter.sendDialogues(npc, FacialExpression.HALF_GUILTY, "OK. This will hurt you more than it will me.");
stage = 11;
break;
case 11:
npc.animate(ANIMATION);
if (player.getSkills().getLifepoints() == player.getSkills().getStaticLevel(Skills.HITPOINTS)) {
interpreter.sendDialogues(npc, FacialExpression.HALF_GUILTY, "You look healthy to me!");
} else {
player.getSkills().heal(player.getSkills().getStaticLevel(Skills.HITPOINTS));
interpreter.sendDialogues(npc, FacialExpression.HALF_GUILTY, "There you go!");
}
stage = 12;
break;
case 12:
end();
break;
case 20:
interpreter.sendDialogues(npc, FacialExpression.HALF_GUILTY, "It's a gruesome business and with the tools they give", "me it gets more gruesome before it gets better!");
stage = 21;
break;
case 21:
end();
break;
case 30:
interpreter.sendDialogues(npc, FacialExpression.HALF_GUILTY, "I often have to amputate peoples limbs!");
stage = 31;
break;
case 31:
end();
break;
}
return true;
}
@Override
public int[] getIds() {
return new int[] { 962 };
}
}

View file

@ -1,112 +0,0 @@
package core.game.content.dialogue;
import core.plugin.Initializable;
import core.game.node.entity.skill.Skills;
import core.game.node.entity.npc.NPC;
import core.game.node.entity.player.Player;
import core.game.world.update.flag.context.Animation;
/**
* @author 'Vexia
*/
@Initializable
public class SabreenDialogue extends DialoguePlugin {
public SabreenDialogue() {
}
public SabreenDialogue(Player player) {
super(player);
}
@Override
public DialoguePlugin newInstance(Player player) {
return new SabreenDialogue(player);
}
@Override
public boolean open(Object... args) {
npc = (NPC) args[0];
interpreter.sendDialogues(player, FacialExpression.HALF_GUILTY, "Hi!");
stage = 0;
return true;
}
@Override
public boolean handle(int interfaceId, int buttonId) {
switch (stage) {
case 0:
interpreter.sendDialogues(npc, FacialExpression.HALF_GUILTY, "Hi. How can I help?");
stage = 1;
break;
case 1:
interpreter.sendOptions("Select an Option", "Can you heal me?", "Do you see a lot of injured fighters?", "Do you come here often?");
stage = 2;
break;
case 2:
switch (buttonId) {
case 1:
interpreter.sendDialogues(player, FacialExpression.HALF_GUILTY, "Can you heal me?");
stage = 10;
break;
case 2:
interpreter.sendDialogues(player, FacialExpression.HALF_GUILTY, "Do you see a lot of injured fighters?");
stage = 30;
break;
case 3:
interpreter.sendDialogues(player, FacialExpression.HALF_GUILTY, "Do you come here often?");
stage = 20;
break;
}
break;
case 10:
interpreter.sendDialogues(npc, FacialExpression.HALF_GUILTY, "Of course!");
stage = 11;
break;
case 11:
npc.animate(new Animation(881));
if (player.getSkills().getLifepoints() == player.getSkills().getStaticLevel(Skills.HITPOINTS)) {
interpreter.sendDialogues(npc, FacialExpression.HALF_GUILTY, "You look healthy to me!");
} else {
player.getSkills().heal(player.getSkills().getStaticLevel(Skills.HITPOINTS));
interpreter.sendDialogues(npc, FacialExpression.HALF_GUILTY, "There you go!");
}
stage = 12;
break;
case 12:
end();
break;
case 20:
interpreter.sendDialogues(npc, FacialExpression.HALF_GUILTY, "I work here, so yes!");
stage = 21;
break;
case 21:
end();
break;
case 30:
interpreter.sendDialogues(npc, FacialExpression.HALF_GUILTY, "Yes I do. Thankfully we can cope with almost aything.", "Jaraah really is a wonderful surgeon, this methods are a", "little unorthodox but he gets the job done.");
stage = 31;
break;
case 31:
interpreter.sendDialogues(npc, FacialExpression.HALF_GUILTY, "I shouldn't tell you this but his nickname is 'The", "Butcher'.");
stage = 32;
break;
case 32:
interpreter.sendDialogues(player, FacialExpression.HALF_GUILTY, "That's reassuring.");
stage = 33;
break;
case 33:
end();
break;
}
return true;
}
@Override
public int[] getIds() {
return new int[] { 960 };
}
}

View file

@ -1,195 +0,0 @@
package core.game.content.dialogue;
import core.game.content.global.Skillcape;
import core.game.node.entity.skill.Skills;
import core.game.node.entity.npc.NPC;
import core.game.node.entity.player.Player;
import core.plugin.Initializable;
import core.game.world.update.flag.context.Animation;
/**
* Represents the dialogue plugin used for surgeon general tafani.
* @author 'Vexia
* @version 1.0
*/
@Initializable
public final class SurgeonGeneralTafani extends DialoguePlugin {
/**
* Constructs a new {@code SurgeonGeneralTafani} {@code Object}
*/
public SurgeonGeneralTafani() {
/**
* empty.
*/
}
/**
* Constructs a new {@code SurgeonGeneralTafani} {@code Object}.
* @param player the player.
*/
public SurgeonGeneralTafani(Player player) {
super(player);
}
@Override
public DialoguePlugin newInstance(Player player) {
return new SurgeonGeneralTafani(player);
}
@Override
public boolean open(Object... args) {
npc = (NPC) args[0];
interpreter.sendDialogues(player, FacialExpression.HALF_GUILTY, "Hi!");
stage = 0;
return true;
}
@Override
public boolean handle(int interfaceId, int buttonId) {
switch (stage) {
case 0:
interpreter.sendDialogues(npc, FacialExpression.HALF_GUILTY, "Hi. How can I help?");
stage = 1;
break;
case 1:
if (Skillcape.isMaster(player, Skills.HITPOINTS)) {
interpreter.sendOptions("Select an Option", "Can you heal me?", "Do you see a lot of injured fighters?", "Do you come here often?", "Can I buy a Skillcape of Hitpoints from you?");
stage = 80;
} else {
interpreter.sendOptions("Select an Option", "Can you heal me?", "Do you see a lot of injured fighters?", "Do you come here often?", "Where can I get a cape like yours?");
stage = 2;
}
break;
case 2:
switch (buttonId) {
case 1:
interpreter.sendDialogues(player, FacialExpression.HALF_GUILTY, "Can you heal me?");
stage = 10;
break;
case 2:
interpreter.sendDialogues(player, FacialExpression.HALF_GUILTY, "Do you see a lot of injured fighters?");
stage = 30;
break;
case 3:
interpreter.sendDialogues(player, FacialExpression.HALF_GUILTY, "Do you come here often?");
stage = 20;
break;
case 4:
interpreter.sendDialogues(player, FacialExpression.HALF_GUILTY, "Where can I get a cape like yours?");
stage = 40;
break;
}
break;
case 10:
interpreter.sendDialogues(npc, FacialExpression.HALF_GUILTY, "Of course!");
stage = 11;
break;
case 11:
npc.animate(new Animation(881));
if (player.getSkills().getLifepoints() == player.getSkills().getStaticLevel(Skills.HITPOINTS)) {
interpreter.sendDialogues(npc, FacialExpression.HALF_GUILTY, "You look healthy to me!");
} else {
player.getSkills().heal(player.getSkills().getStaticLevel(Skills.HITPOINTS));
interpreter.sendDialogues(npc, FacialExpression.HALF_GUILTY, "There you go!");
}
stage = 12;
break;
case 12:
end();
break;
case 20:
interpreter.sendDialogues(npc, FacialExpression.HALF_GUILTY, "I work here, so yes!");
stage = 21;
break;
case 21:
end();
break;
case 30:
interpreter.sendDialogues(npc, FacialExpression.HALF_GUILTY, "Yes I do. Thankfully we can cope with almost aything.", "Jaraah really is a wonderful surgeon, this methods are a", "little unorthodox but he gets the job done.");
stage = 31;
break;
case 31:
interpreter.sendDialogues(npc, FacialExpression.HALF_GUILTY, "I shouldn't tell you this but his nickname is 'The", "Butcher'.");
stage = 32;
break;
case 32:
interpreter.sendDialogues(player, FacialExpression.HALF_GUILTY, "That's reassuring.");
stage = 33;
break;
case 33:
end();
break;
case 40:
interpreter.sendDialogues(npc, FacialExpression.HALF_GUILTY, "Well, these capes are only available for people who have", "achieved a Hitpoint level of 99. You should go and train", "some more and come back to me when your Hitpoints", "are higher.");
stage = 41;
break;
case 41:
end();
break;
case 80:
switch (buttonId) {
case 1:
interpreter.sendDialogues(player, FacialExpression.HALF_GUILTY, "Can you heal me?");
stage = 10;
break;
case 2:
interpreter.sendDialogues(player, FacialExpression.HALF_GUILTY, "Do you see a lot of injured fighters?");
stage = 30;
break;
case 3:
interpreter.sendDialogues(player, FacialExpression.HALF_GUILTY, "Do you come here often?");
stage = 20;
break;
case 4:
player("Can I buy a Skillcape of Hitpoints from you?");
stage = 81;
break;
}
break;
case 81:
npc("Why, certainly my friend. However, owning such an item", "makes you part of an elite group and that privilege will", "cost you 99000 coins.");
stage = 82;
break;
case 82:
options("Sorry, that's much too pricey.", "Sure, that's not too expensive for such a magnificent cape.");
stage = 83;
break;
case 83:
switch (buttonId) {
case 1:
player("Sorry, that's much too pricey.");
stage = 84;
break;
case 2:
player("Sure, that's not too expensive for such a magnificent", "cape.");
stage = 86;
break;
}
break;
case 84:
npc("I'm sorry you feel that way. Still if you change", "your mind...");
stage = 85;
break;
case 85:
end();
break;
case 86:
if (Skillcape.purchase(player, Skills.HITPOINTS)) {
npc("There you go! I hope you enjoy it.");
}
stage = 87;
break;
case 87:
end();
break;
}
return true;
}
@Override
public int[] getIds() {
return new int[] { 961 };
}
}

View file

@ -1,30 +0,0 @@
package core.game.interaction.npc;
import core.cache.def.impl.NPCDefinition;
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 plugin used for ali the leaflet npc.
* @author 'Vexia
* @version 1.0
*/
@Initializable
public final class AlKahridLeafletPlugin extends OptionHandler {
@Override
public boolean handle(Player player, Node node, String option) {
player.getDialogueInterpreter().open(3680, node, true);
return true;
}
@Override
public Plugin<Object> newInstance(Object arg) throws Throwable {
NPCDefinition.forId(3680).getHandlers().put("option:take-flyer", this);
return this;
}
}

View file

@ -1,35 +0,0 @@
package core.game.interaction.npc;
import core.cache.def.impl.NPCDefinition;
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.plugin.Initializable;
import core.plugin.Plugin;
/**
* Represents the plugin used for the npcs in alkharid which can heal you.
* @author 'Vexia
* @version 1.0
*/
@Initializable
public final class AlkharidHealPlugin extends OptionHandler {
@Override
public Plugin<Object> newInstance(Object arg) throws Throwable {
NPCDefinition.forId(962).getHandlers().put("option:heal", this);
NPCDefinition.forId(961).getHandlers().put("option:heal", this);
NPCDefinition.forId(960).getHandlers().put("option:heal", this);
NPCDefinition.forId(959).getHandlers().put("option:heal", this);
NPCDefinition.forId(958).getHandlers().put("option:heal", this);
return this;
}
@Override
public boolean handle(Player player, Node node, String option) {
player.getDialogueInterpreter().open(((NPC) node).getId(), ((NPC) node));
return true;
}
}

View file

@ -1,82 +0,0 @@
package core.game.node.entity.npc.city.alkharid;
import core.game.content.dialogue.DialoguePlugin;
import core.game.content.dialogue.FacialExpression;
import core.game.node.entity.npc.NPC;
import core.plugin.Initializable;
import core.game.node.entity.player.Player;
/**
* Represents the dialogue plugin used for the al kharid shop keepers.
* @author 'Vexia
* @version 1.0
*/
@Initializable
public final class AlKharidShopKeeperDialogue extends DialoguePlugin {
/**
* Constructs a new {@code AlKahridShopKeeperDialogue} {@code Object}.
*/
public AlKharidShopKeeperDialogue() {
/**
* empty.
*/
}
/**
* Constructs a new {@code AlKahridShopKeeperDialogue} {@code Object}.
* @param player the player.
*/
public AlKharidShopKeeperDialogue(Player player) {
super(player);
}
@Override
public DialoguePlugin newInstance(Player player) {
return new AlKharidShopKeeperDialogue(player);
}
@Override
public boolean open(Object... args) {
npc = (NPC) args[0];
interpreter.sendDialogues(npc, FacialExpression.HALF_GUILTY, "Can I help you at all?");
stage = 0;
return true;
}
@Override
public boolean handle(int interfaceId, int buttonId) {
switch (stage) {
case 0:
interpreter.sendOptions("Select an Option", "Yes, please. What are you selling?", "How should I use your shop?", "No, thanks.");
stage = 1;
break;
case 1:
switch (buttonId) {
case 1:
end();
npc.openShop(player);
break;
case 2:
interpreter.sendDialogues(npc, FacialExpression.HALF_GUILTY, "I'm glad you ask! You can buy as many of the items", "stocked as you wish. You can also sell most items to the", "shop.");
stage = 20;
break;
case 3:
end();
break;
}
break;
case 20:
end();
break;
}
return true;
}
@Override
public int[] getIds() {
return new int[] { 525, 524 };
}
}

View file

@ -1,177 +0,0 @@
package core.game.node.entity.npc.city.alkharid;
import core.game.content.dialogue.DialoguePlugin;
import core.game.node.entity.npc.NPC;
import core.game.node.entity.player.Player;
import core.plugin.Initializable;
import core.game.node.item.Item;
/**
* Represents the dialogue plugin used for ali the leaflet dropper npc.
* @author 'Vexia
* @version 1.9
*/
@Initializable
public final class AliTheLeafletDropper extends DialoguePlugin {
/**
* Represents the flyer item.
*/
private static final Item FLYER = new Item(7922);
/**
* Constructs a new {@code AliTheLeafletDropper} {@code Object}.
*/
public AliTheLeafletDropper() {
/**
* empty.
*/
}
/**
* Constructs a new {@code AliTheLeafletDropper} {@code Object}.
* @param player the player.
*/
public AliTheLeafletDropper(Player player) {
super(player);
}
@Override
public DialoguePlugin newInstance(Player player) {
return new AliTheLeafletDropper(player);
}
@Override
public boolean open(Object... args) {
npc = (NPC) args[0];
if (args.length == 2) {
if (player.getInventory().freeSlots() == 0) {
npc("Looks like your hands are full. come back when you", "have space for my flyer.");
stage = 0;
return true;
}
if (player.getInventory().contains(7922, 1) || player.getBank().contains(7922, 1)) {
npc("Are you trying to be funny or has age turned your", "brain to mush? You already have a flyer!");
stage = 0;
return true;
}
}
npc("I don't have time to talk right now! Ali Morrisane is", "paying me to hand out these flyers.");
stage = 700;
if (args.length == 2) {
player.getInventory().add(FLYER);
npc("Here take one and let me get back to work!");
stage = 600;
return true;
}
return true;
}
@Override
public boolean handle(int interfaceId, int buttonId) {
switch (stage) {
case 0:
end();
break;
case 600:
npc("I still have hundreds of these flyers to hand out, I", "wonder if Ali would notice if I quietly dumped them", "somewhere?");
stage = 601;
break;
case 601:
end();
break;
case 700:
interpreter.sendOptions("Select an Option", "Who is Ali Morrisane?", "What are the flyers for?", "What is there to do round here, boy?");
stage = 701;
break;
case 701:
switch (buttonId) {
case 1:
player("Who is Ali Morrisane?");
stage = 710;
break;
case 2:
player("What are the flyers for?");
stage = 720;
break;
case 3:
player("What is there to do round here, boy?");
stage = 300;
break;
}
break;
case 710:
npc("Ali Morrisane is the greatest merchant in the east!");
stage = 711;
break;
case 711:
player("Were you paid to say that?");
stage = 712;
break;
case 712:
npc("Of course I was! You can find him on the north edge", "of town");
stage = 713;
break;
case 713:
end();
break;
case 720:
npc("Well, ali Morrisane isn't too popular with the other", "traders in Al Kharid, mainly because he's from", "Pollnivneach and they feel he has no business trading in", "their town.");
stage = 721;
break;
case 721:
npc("I think they're just sour because he's better at making", "money than them.");
stage = 722;
break;
case 722:
npc("The flyers advertises the different shops you can find in", "Al Kharid.");
stage = 723;
break;
case 723:
npc("It also entitles you to money off your next purchase in", "any of the shops listed on it. It's Ali's way of getting on", "the good side of the traders.");
stage = 724;
break;
case 724:
player("Which shops?");
stage = 725;
break;
case 725:
npc("The flyer will dicuss them all.");
stage = 0;
break;
case 300:
npc("I'm very busy, so listen carefully! I shall say this only", "once.");
stage = 301;
break;
case 301:
npc("Apart from a busy and wonderous market place in Al", "Kharid to the south, there is the Duel Arena to the", "south-east where you can challenge other players to a", "fight.");
stage = 302;
break;
case 302:
npc("If you're here to make money, there is a mine to the", "south.");
stage = 303;
break;
case 303:
npc("Watch out for scorpions though, they'll take a pop at", "you if you go too near them. To avoid them just follow", "the western fence as you travel south.");
stage = 304;
break;
case 304:
npc("If you're in the mood for a little rest and relaxation,", "there are a couple of nice fishing spots south of the", "town.");
stage = 305;
break;
case 305:
player("Thanks for the help!");
stage = 306;
break;
case 306:
end();
break;
}
return true;
}
@Override
public int[] getIds() {
return new int[] { 3680 };
}
}

View file

@ -0,0 +1,49 @@
package rs09.game.node.entity.npc.city.alkharid
import core.game.content.dialogue.DialoguePlugin
import core.game.content.dialogue.FacialExpression
import core.game.node.entity.npc.NPC
import core.game.node.entity.player.Player
import core.plugin.Initializable
import org.rs09.consts.NPCs
import rs09.game.content.dialogue.DialogueFile
import rs09.game.content.dialogue.Topic
import rs09.tools.END_DIALOGUE
/**
* @author bushtail
*/
@Initializable
class AablaDialogue(player: Player? = null) : DialoguePlugin(player) {
override fun newInstance(player: Player?): DialoguePlugin {
return AablaDialogue(player)
}
override fun open(vararg args: Any?): Boolean {
npc = args[0] as NPC
player(FacialExpression.FRIENDLY, "Hi!").also { stage = 0 }
return true
}
override fun handle(interfaceId: Int, buttonId: Int): Boolean {
when(stage) {
0 -> showTopics(
Topic("Can you heal me?", AlKharidHealDialogue(true)),
Topic("Do you see a lot of injured fighters?", 101),
Topic("Do you come here often?", 201)
)
101 -> npcl(FacialExpression.FRIENDLY, "I work here, so yes!").also { stage = END_DIALOGUE }
201 -> npcl(FacialExpression.HALF_THINKING, "Yes I do. Thankfully we can cope with almost anything. Jaraah really is a wonderful surgeon, his methods are a little unorthodox but he gets the job done.").also { stage++ }
202 -> npcl(FacialExpression.HALF_GUILTY, "I shouldn't tell you this but his nickname is 'The Butcher'.").also { stage++ }
203 -> player(FacialExpression.HALF_WORRIED, "That's reassuring.").also { stage = END_DIALOGUE }
}
return true
}
override fun getIds(): IntArray {
return intArrayOf(NPCs.AABLA_959)
}
}

View file

@ -0,0 +1,53 @@
package rs09.game.node.entity.npc.city.alkharid
import api.*
import core.game.content.dialogue.FacialExpression
import core.game.node.entity.npc.NPC
import core.game.node.entity.skill.Skills
import org.rs09.consts.Animations
import org.rs09.consts.NPCs
import rs09.game.content.dialogue.DialogueFile
import rs09.game.interaction.InteractionListener
import rs09.tools.END_DIALOGUE
/**
* @author bushtail
*/
class AlKharidHealListener : InteractionListener {
override fun defineListeners() {
on(getIds(), NPC, "heal") { player, node ->
openDialogue(player, AlKharidHealDialogue(false), node.asNpc())
return@on true
}
}
fun getIds() : IntArray {
return intArrayOf(
NPCs.AABLA_959,
NPCs.SABREEN_960,
NPCs.SURGEON_GENERAL_TAFANI_961,
NPCs.JARAAH_962
)
}
}
class AlKharidHealDialogue(val skipFirst: Boolean) : DialogueFile() {
override fun handle(componentID: Int, buttonID: Int) {
if (stage == 0 && skipFirst) stage++
when(stage) {
0 -> player(FacialExpression.ASKING, "Can you heal me?").also { stage++ }
1 -> npcl(FacialExpression.FRIENDLY, "Of course!").also { stage++ }
2 -> {
animate(npc!!, Animations.HUMAN_PICKPOCKETING_881)
if(player!!.skills.lifepoints < getStatLevel(player!!, Skills.HITPOINTS)) {
player!!.skills.heal(21)
npcl(FacialExpression.FRIENDLY, "There you go!")
} else {
npcl(FacialExpression.FRIENDLY, "You look healthy to me!")
}
stage = END_DIALOGUE
}
}
}
}

View file

@ -0,0 +1,55 @@
package rs09.game.node.entity.npc.city.alkharid
import core.game.content.dialogue.DialoguePlugin
import core.game.content.dialogue.FacialExpression
import core.game.node.entity.npc.NPC
import core.game.node.entity.player.Player
import core.plugin.Initializable
import org.rs09.consts.NPCs
import rs09.tools.END_DIALOGUE
/**
* @author bushtail
* "Henceforth, you shall be called... Craig."
*/
@Initializable
class AlKharidShopKeeperDialogue(player: Player? = null) : DialoguePlugin() {
override fun newInstance(player: Player?): DialoguePlugin {
return AlKharidShopKeeperDialogue(player)
}
override fun open(vararg args: Any?): Boolean {
npc = args[0] as NPC
npcl(FacialExpression.HALF_ASKING, "Can I help you at all?")
stage = 100
return true
}
override fun handle(interfaceId: Int, buttonId: Int): Boolean {
when(stage) {
100 -> options(
"Yes, please. What are you selling?",
"How should I use your shop?",
"No, thanks."
).also { stage++ }
101 -> when(buttonId) {
1 -> {
stage = END_DIALOGUE
npc.openShop(player)
}
2 -> player(FacialExpression.ASKING, "How should I use your shop?").also { stage = 201 }
3 -> player(FacialExpression.NEUTRAL, "No, thanks.").also { stage = END_DIALOGUE }
}
201 -> npcl(FacialExpression.FRIENDLY, "I'm glad you ask! You can buy as many of the items stocked as you wish. You can also sell most items to the shop.").also { stage = END_DIALOGUE }
}
return true
}
override fun getIds(): IntArray {
return intArrayOf(
NPCs.SHOPKEEPER_524,
NPCs.SHOP_ASSISTANT_525
)
}
}

View file

@ -0,0 +1,83 @@
package rs09.game.node.entity.npc.city.alkharid
import api.addItem
import core.game.content.dialogue.DialoguePlugin
import core.game.content.dialogue.FacialExpression
import core.game.node.entity.npc.NPC
import core.game.node.entity.player.Player
import core.plugin.Initializable
import org.rs09.consts.Items
import org.rs09.consts.NPCs
import rs09.tools.END_DIALOGUE
/**
* @author bushtail
* Converts AliTheLeafletDropper.java with a Kotlin implementation
*/
@Initializable
class AliTheLeafletDropperDialogue(player: Player? = null) : DialoguePlugin(player) {
override fun newInstance(player: Player?): DialoguePlugin {
return AliTheLeafletDropperDialogue(player)
}
override fun open(vararg args: Any?): Boolean {
npc = args[0] as NPC
npcl(FacialExpression.CHILD_NORMAL, "I don't have the time to talk right now! Ali Morrisane is paying me to hand out these flyers.")
stage = 100
return true
}
override fun handle(interfaceId: Int, buttonId: Int): Boolean {
when(stage) {
100 -> options(
"Who is Ali Morissane?",
"What are the flyers for?",
"What is there to do round here, boy?"
).also { stage++ }
101 -> when(buttonId) {
1 -> {
player(FacialExpression.ASKING, "Who is Ali Morissane?").also{ stage = 201 }
}
2 -> {
player(FacialExpression.ASKING, "What are the flyers for?").also { stage = 301 }
}
3 -> {
player(FacialExpression.ASKING, "What is there to do round here, boy?").also { stage = 401 }
}
}
201 -> npcl(FacialExpression.CHILD_FRIENDLY, "Ali Morrisane is the greatest merchant in the east!").also { stage++ }
202 -> player(FacialExpression.HALF_ASKING, "Were you paid to say that?").also { stage++ }
203 -> npcl(FacialExpression.CHILD_LOUDLY_LAUGHING, "Of course I was! You can find him on the north edge of town.").also { stage = END_DIALOGUE }
301 -> npcl(FacialExpression.CHILD_THINKING, "Well, Ali Morrisane isn't too popular with the other traders in Al Kharid, mainly because he's from Pollnivneach and they feel he has no business trading in their town.").also { stage++ }
302 -> npcl(FacialExpression.CHILD_FRIENDLY, "I think they're just sour because he's better at making money than them.").also { stage++ }
303 -> npcl(FacialExpression.CHILD_FRIENDLY, "The flyer advertises the different shops you can find in Al Kharid.").also { stage++ }
304 -> npcl(FacialExpression.CHILD_THINKING, "It also entitles you to money off your next purchase in any of the shops listed on it. It's Ali's way of getting on the good side of the traders.").also { stage++ }
305 -> player(FacialExpression.ASKING, "Which shops?").also {
if(player.inventory.containItems(Items.AL_KHARID_FLYER_7922)) {
npcl(FacialExpression.CHILD_SUSPICIOUS, "Are you trying to be funny or has age turned your brain to mush? Look at the flyer you already have!").also { stage = END_DIALOGUE }
} else {
if(addItem(player, Items.AL_KHARID_FLYER_7922)) {
npcl(FacialExpression.CHILD_FRIENDLY, "Here! Take one and let me get back to work.").also { stage = END_DIALOGUE }
} else {
end()
}
}
}
401 -> npcl(FacialExpression.CHILD_NORMAL, "I'm very busy, so listen carefully! I shall say this only once.").also { stage++ }
402 -> npcl(FacialExpression.CHILD_THINKING, "Apart from a busy and wonderous market place in Al Kharid to the south, there is the Duel Arena to the south-east where you can challenge other players to a fight.").also { stage++ }
403 -> npcl(FacialExpression.CHILD_NORMAL, "If you're here to make money, there is a mine to the south.").also { stage++ }
404 -> npcl(FacialExpression.CHILD_SUSPICIOUS, "Watch out for scorpions though, they'll take a pop at you if you go too near them. To avoid them just follow the western fence as you travel south.").also { stage++ }
405 -> npcl(FacialExpression.CHILD_FRIENDLY, "If you're in the mood for a little rest and relaxation, there are a couple of nice fishing spots south of the town.").also { stage++ }
406 -> player(FacialExpression.FRIENDLY, "Thanks for the help!").also { stage = END_DIALOGUE }
}
return true
}
override fun getIds(): IntArray {
return intArrayOf(NPCs.ALI_THE_LEAFLET_DROPPER_3680)
}
}

View file

@ -0,0 +1,45 @@
package rs09.game.node.entity.npc.city.alkharid
import api.addItem
import api.openDialogue
import core.game.content.dialogue.FacialExpression
import core.game.node.entity.npc.NPC
import org.rs09.consts.Items
import org.rs09.consts.NPCs
import rs09.game.content.dialogue.DialogueFile
import rs09.game.interaction.InteractionListener
import rs09.tools.END_DIALOGUE
/**
* @author bushtail
*/
class AliTheLeafletDropperListener : InteractionListener {
override fun defineListeners() {
on(NPCs.ALI_THE_LEAFLET_DROPPER_3680, NPC, "Take-flyer") { player, node ->
if(player.inventory.containItems(Items.AL_KHARID_FLYER_7922)) {
openDialogue(player, DropperDialogue(2), node as NPC)
} else {
if(addItem(player, Items.AL_KHARID_FLYER_7922)) {
openDialogue(player, DropperDialogue(1), node as NPC)
} else {
return@on false
}
}
return@on true
}
}
}
class DropperDialogue(val it : Int) : DialogueFile() {
override fun handle(componentID: Int, buttonID: Int) {
when(it) {
1 -> when(stage) {
0 -> npcl(FacialExpression.CHILD_NORMAL, "Here! Take one and let me get back to work.").also { stage++ }
1 -> npcl(FacialExpression.CHILD_THINKING, "I still have hundreds of these flyers to hand out. I wonder if Ali would notice if I quietly dumped them somewhere?").also { stage = END_DIALOGUE }
}
2 -> npcl(FacialExpression.CHILD_SUSPICIOUS, "Are you trying to be funny or has age turned your brain to mush? You already have a flyer!").also { stage = END_DIALOGUE }
}
}
}

View file

@ -0,0 +1,71 @@
package rs09.game.node.entity.npc.city.alkharid
import core.game.content.dialogue.DialoguePlugin
import core.game.content.dialogue.FacialExpression
import core.game.node.entity.npc.NPC
import core.game.node.entity.player.Player
import core.plugin.Initializable
import org.rs09.consts.NPCs
import rs09.game.content.dialogue.Topic
import rs09.game.interaction.InteractionListener
import rs09.tools.END_DIALOGUE
/**
* @author bushtail
*/
@Initializable
class FadliDialogue(player: Player? = null) : DialoguePlugin(player) {
override fun newInstance(player: Player?): DialoguePlugin {
return FadliDialogue(player)
}
override fun open(vararg args: Any?): Boolean {
npc = args[0] as NPC
player(FacialExpression.FRIENDLY, "Hi!").also { stage = 0 }
return true
}
override fun handle(interfaceId: Int, buttonId: Int): Boolean {
when(stage) {
0 -> npcl(FacialExpression.HALF_ASKING, "What?").also { stage++ }
1 -> showTopics(
Topic("What do you do?", 101),
Topic("What is this place?", 201),
Topic(FacialExpression.FRIENDLY,"I'd like to store some items, please.", 301),
Topic("Do you watch any matches?", 401)
)
101 -> npcl(FacialExpression.FRIENDLY, "You can store your stuff here if you want. You can dump anything you don't want to carry whilst your fighting duels and then pick it up again on the way out.").also { stage++ }
102 -> npcl(FacialExpression.SAD, "To be honest I'm wasted here.").also { stage++ }
103 -> npcl(FacialExpression.EVIL_LAUGH, "I should be winning duels in an arena! I'm the best warrior in Al Kharid!").also { stage++ }
104 -> player(FacialExpression.HALF_WORRIED, "Easy, tiger!").also { stage = END_DIALOGUE }
201 -> npcl(FacialExpression.LAUGH, "Isn't it obvious?").also { stage++ }
202 -> npcl(FacialExpression.ANNOYED, "This is the Duel Arena...duh!").also { stage = END_DIALOGUE }
301 -> npcl(FacialExpression.FRIENDLY, "Sure.").also {
end()
player.bank.open()
}
401 -> npcl(FacialExpression.LAUGH, "Most aren't any good so I throw rotten fruit at them!").also { stage = END_DIALOGUE }
}
return true
}
override fun getIds(): IntArray {
return intArrayOf(NPCs.FADLI_958)
}
}
class FadliListener : InteractionListener {
override fun defineListeners() {
on(NPCs.FADLI_958, NPC, "buy") { player, node ->
if(node.asNpc().openShop(player)) {
return@on true
}
return@on false
}
}
}

View file

@ -0,0 +1,67 @@
package rs09.game.node.entity.npc.city.alkharid
import api.animate
import api.getDynLevel
import api.getStatLevel
import core.game.content.dialogue.DialoguePlugin
import core.game.content.dialogue.FacialExpression
import core.game.node.entity.npc.NPC
import core.game.node.entity.player.Player
import core.game.node.entity.skill.Skills
import core.plugin.Initializable
import org.rs09.consts.Animations
import org.rs09.consts.NPCs
import rs09.game.content.dialogue.Topic
import rs09.tools.END_DIALOGUE
/**
* @author bushtail
*/
@Initializable
class JaraahDialogue(player: Player? = null) : DialoguePlugin(player) {
override fun newInstance(player: Player?): DialoguePlugin {
return JaraahDialogue(player)
}
override fun open(vararg args: Any?): Boolean {
npc = args[0] as NPC
player(FacialExpression.FRIENDLY, "Hi!").also { stage = 0 }
return true
}
override fun handle(interfaceId: Int, buttonId: Int): Boolean {
when(stage) {
0 -> npcl(FacialExpression.ANNOYED, "What? Can't you see I'm busy?!").also { stage++ }
1 -> showTopics(
Topic("Can you heal me?", 101),
Topic("You must see some gruesome things?", 201),
Topic("Why do they call you 'The Butcher'?", 301)
)
// Jaraah has to be special and have different dialogue for the heal listener so I am repeating it here.
101 -> {
animate(npc!!, Animations.HUMAN_PICKPOCKETING_881)
if(player!!.skills.lifepoints < getStatLevel(player!!, Skills.HITPOINTS)) {
player!!.skills.heal(21)
npcl(FacialExpression.FRIENDLY, "There you go!")
} else {
npcl(FacialExpression.FRIENDLY, "Okay, this will hurt you more than it will me.")
}
stage = END_DIALOGUE
}
201 -> npcl(FacialExpression.FRIENDLY, "It's a gruesome business and with the tools they give me it gets mroe gruesome before it gets better!").also { stage = END_DIALOGUE }
301 -> npcl(FacialExpression.HALF_THINKING, "'The Butcher'?").also { stage++ }
302 -> npcl(FacialExpression.LAUGH, "Ha!").also { stage++ }
303 -> npcl(FacialExpression.HALF_ASKING, "Would you like me to demonstrate?").also { stage++ }
304 -> player(FacialExpression.AFRAID, "Er...I'll give it a miss, thanks.").also { stage = END_DIALOGUE }
}
return true
}
override fun getIds(): IntArray {
return intArrayOf(NPCs.JARAAH_962)
}
}

View file

@ -0,0 +1,49 @@
package rs09.game.node.entity.npc.city.alkharid
import core.game.content.dialogue.DialoguePlugin
import core.game.content.dialogue.FacialExpression
import core.game.node.entity.npc.NPC
import core.game.node.entity.player.Player
import core.plugin.Initializable
import org.rs09.consts.NPCs
import rs09.game.content.dialogue.DialogueFile
import rs09.game.content.dialogue.Topic
import rs09.tools.END_DIALOGUE
/**
* @author bushtail
*/
@Initializable
class SabreenDialogue(player: Player? = null) : DialoguePlugin(player) {
override fun newInstance(player: Player?): DialoguePlugin {
return SabreenDialogue(player)
}
override fun open(vararg args: Any?): Boolean {
npc = args[0] as NPC
player(FacialExpression.FRIENDLY, "Hi!").also { stage = 0 }
return true
}
override fun handle(interfaceId: Int, buttonId: Int): Boolean {
when(stage) {
0 -> showTopics(
Topic("Can you heal me?", AlKharidHealDialogue(true)),
Topic("Do you see a lot of injured fighters?", 101),
Topic("Do you come here often?", 201)
)
101 -> npcl(FacialExpression.FRIENDLY, "I work here, so yes!").also { stage = END_DIALOGUE }
201 -> npcl(FacialExpression.HALF_THINKING, "Yes I do. Thankfully we can cope with almost anything. Jaraah really is a wonderful surgeon, his methods are a little unorthodox but he gets the job done.").also { stage++ }
202 -> npcl(FacialExpression.HALF_GUILTY, "I shouldn't tell you this but his nickname is 'The Butcher'.").also { stage++ }
203 -> player(FacialExpression.HALF_WORRIED, "That's reassuring.").also { stage = END_DIALOGUE }
}
return true
}
override fun getIds(): IntArray {
return intArrayOf(NPCs.SABREEN_960)
}
}

View file

@ -0,0 +1,69 @@
package rs09.game.node.entity.npc.city.alkharid
import core.game.content.dialogue.DialoguePlugin
import api.*
import core.game.content.dialogue.FacialExpression
import core.game.content.global.Skillcape
import core.game.node.entity.npc.NPC
import core.game.node.entity.player.Player
import core.game.node.entity.skill.Skills
import core.plugin.Initializable
import org.rs09.consts.NPCs
import rs09.game.content.dialogue.*
import rs09.tools.END_DIALOGUE
/**
* @author bushtail
*/
@Initializable
class SurgeonGeneralTafaniDialogue(player: Player? = null) : DialoguePlugin(player) {
override fun newInstance(player: Player?): DialoguePlugin {
return SurgeonGeneralTafaniDialogue(player)
}
override fun open(vararg args: Any?): Boolean {
npc = args[0] as NPC
npcl(FacialExpression.FRIENDLY, "Hi. How can I help?").also { stage = 100 }
return true
}
override fun handle(interfaceId: Int, buttonId: Int): Boolean {
when(stage) {
100 -> showTopics(
Topic("Can you heal me?", AlKharidHealDialogue(true)),
Topic("Do you see a lot of injured fighters?", 201),
Topic("Do you come here often?", 301),
IfTopic("Can I buy a Skillcape of Hitpoints from you?", 401, hasLevelStat(player, Skills.HITPOINTS, 99)),
IfTopic("Where can I get a cape like yours?", 501, !hasLevelStat(player, Skills.HITPOINTS, 99))
)
201 -> npcl(FacialExpression.HALF_THINKING, "Yes I do. Thankfully we can cope with almost anything. Jaraah really is a wonderful surgeon, his methods are a little unorthodox but he gets the job done.").also { stage++ }
202 -> npcl(FacialExpression.HALF_GUILTY, "I shouldn't tell you this but his nickname is 'The Butcher'.").also { stage++ }
203 -> player(FacialExpression.HALF_WORRIED, "That's reassuring.").also { stage = END_DIALOGUE }
301 -> npcl(FacialExpression.LAUGH, "I work here, so yes!").also { stage = END_DIALOGUE }
401 -> npcl(FacialExpression.FRIENDLY, "Why, certainly my friend. However, owning such an item makes you part of an elite group and that privilege will cost you 99000 coins.").also { stage++ }
402 -> showTopics(
Topic(FacialExpression.HALF_GUILTY, "Sorry, that's much too pricey.", 411),
Topic(FacialExpression.HAPPY, "Sure, that's not too expensive for such a magnificent cape.", 421)
)
411 -> npcl(FacialExpression.NEUTRAL, "I'm sorry you feel that way. Still, if you change your mind...").also { stage = END_DIALOGUE }
421 -> if(Skillcape.purchase(player, Skills.HITPOINTS)) {
npcl(FacialExpression.FRIENDLY, "There you go! I hope you enjoy it.").also { stage = END_DIALOGUE }
} else {
npcl(FacialExpression.HALF_GUILTY, "Sorry, you can't buy that right now.").also { stage = END_DIALOGUE }
}
501 -> npcl(FacialExpression.HALF_THINKING, "Well, these capes are only available for people who have achieved a Hitpoint level of 99. You should go and train some more and come back to me when your Hitpoints are higher.").also { stage = END_DIALOGUE }
}
return true
}
override fun getIds(): IntArray {
return intArrayOf(NPCs.SURGEON_GENERAL_TAFANI_961)
}
}