Add: Family Crest

This commit is contained in:
Avi Weinstock 2021-12-22 01:26:10 +00:00 committed by Ceikry
parent b0c231459b
commit f625a8ff01
26 changed files with 1642 additions and 347 deletions

1
.gitattributes vendored Normal file
View file

@ -0,0 +1 @@
Server/data/cache/ filter=lfs diff=lfs merge=lfs -text

View file

@ -77,3 +77,4 @@
- Implemented server performance monitor, many performance improvements
- Fishing and fishing trawler now use closer-to-empirical formulae.
- Server configuration language has been changed from JSON to TOML.
- Add Family Crest quest.

View file

@ -14824,7 +14824,7 @@
{
"minAmount": "1",
"weight": "100.0",
"id": "780",
"id": "781",
"maxAmount": "1"
}
],

View file

@ -1763,6 +1763,10 @@
"npc_id": "659",
"loc_data": "{3052,3373,0,0,0}"
},
{
"npc_id": "663",
"loc_data": "{3290,3290,0,1,2}"
},
{
"npc_id": "665",
"loc_data": "{2986,9811,0,0,0}"
@ -1771,6 +1775,10 @@
"npc_id": "666",
"loc_data": "{2819,3451,0,0,3}"
},
{
"npc_id": "668",
"loc_data": "{3284,3503,1,1,1}"
},
{
"npc_id": "670",
"loc_data": "{2465,3496,0,1,6}"
@ -10135,6 +10143,10 @@
"npc_id": "8151",
"loc_data": "{3241,9998,0,1,6}-{3223,10010,0,1,6}-{3208,10012,0,1,6}-{3209,10026,0,1,6}-{3214,10038,0,1,6}-{3211,10035,0,1,6}-{3214,10037,0,1,6}-{3240,9991,0,1,6}-{3231,10010,0,1,6}-{3210,10007,0,1,6}-{3222,10010,0,1,6}"
},
{
"npc_id": "8171",
"loc_data": "{3281,3403,0,1,6}"
},
{
"npc_id": "8273",
"loc_data": "{2931,3536,0,1,5}"

View file

@ -1,82 +0,0 @@
package core.game.content.dialogue;
import core.game.node.entity.npc.NPC;
import core.plugin.Initializable;
import core.game.node.entity.player.Player;
/**
* Represents the dialogue plugin used with the boot npc.
* @author 'Vexia
* @version 1.0
*/
@Initializable
public final class BootDialogue extends DialoguePlugin {
/**
* Constructs a new {@code BootDialogue} {@code Object}.
*/
public BootDialogue() {
/**
* empty.
*/
}
/**
* Constructs a new {@code BootDialogue} {@code Object}.
* @param player the player.
*/
public BootDialogue(Player player) {
super(player);
}
@Override
public DialoguePlugin newInstance(Player player) {
return new BootDialogue(player);
}
@Override
public boolean open(Object... args) {
npc = (NPC) args[0];
interpreter.sendDialogues(npc, FacialExpression.HALF_GUILTY, "Hello tall person.");
stage = 0;
return true;
}
@Override
public boolean handle(int interfaceId, int buttonId) {
switch (stage) {
case 0:
interpreter.sendOptions("Select an Option", "Hello short person.", "Why are you called boot?");
stage = 1;
break;
case 1:
switch (buttonId) {
case 1:
interpreter.sendDialogues(player, FacialExpression.HALF_GUILTY, "Hello short person.");
stage = 10;
break;
case 2:
interpreter.sendDialogues(player, FacialExpression.HALF_GUILTY, "Why are you called boot?");
stage = 20;
break;
}
break;
case 10:
end();
break;
case 20:
interpreter.sendDialogues(npc, FacialExpression.HALF_GUILTY, "I'm called Boot, because when I was very young, I", "used to sleep, in a large boot.");
stage = 21;
break;
case 21:
end();
break;
}
return true;
}
@Override
public int[] getIds() {
return new int[] { 665 };
}
}

View file

@ -1,80 +0,0 @@
package core.game.content.dialogue;
import core.game.node.entity.npc.NPC;
import core.plugin.Initializable;
import core.game.node.entity.player.Player;
/**
* Represents the gem trade dialogue plugin.
* @author 'Vexia
* @version 1.0
*/
@Initializable
public final class GemTradeDialogue extends DialoguePlugin {
/**
* Constructs a new {@code GemTradeDialogue} {@code Object}.
*/
public GemTradeDialogue() {
/**
* empty.
*/
}
/**
* Constructs a new {@code GemTradeDialogue} {@code Object}.
* @param player the player.
*/
public GemTradeDialogue(Player player) {
super(player);
}
@Override
public DialoguePlugin newInstance(Player player) {
return new GemTradeDialogue(player);
}
@Override
public boolean open(Object... args) {
npc = (NPC) args[0];
interpreter.sendDialogues(npc, FacialExpression.HALF_GUILTY, "Hello adventurer! Can I interest you in any of my gems?");
stage = 0;
return true;
}
@Override
public boolean handle(int interfaceId, int buttonId) {
switch (stage) {
case 0:
interpreter.sendOptions("Select an Option", "Yes!", "No, thanks you.");
stage = 1;
break;
case 1:
switch (buttonId) {
case 1:
interpreter.sendDialogues(player, FacialExpression.HALF_GUILTY, "Yes!");
stage = 10;
break;
case 2:
interpreter.sendDialogues(player, FacialExpression.HALF_GUILTY, "No, thanks though.");
stage = 20;
break;
}
break;
case 10:
end();
npc.openShop(player);
break;
case 20:
end();
break;
}
return true;
}
@Override
public int[] getIds() {
return new int[] { 540 };
}
}

View file

@ -1,63 +0,0 @@
package core.game.content.dialogue;
import core.game.node.entity.npc.NPC;
import core.plugin.Initializable;
import core.game.node.entity.player.Player;
/**
* Represents the kaleb dialogue plugin.
* @author 'Vexia
* @version 1.0
*/
@Initializable
public final class KalebDialgoue extends DialoguePlugin {
/**
* Constructs a new {@code KalebDialgoue} {@code Object}.
*/
public KalebDialgoue() {
/**
* empty.
*/
}
/**
* Constructs a new {@code KalebDialgoue} {@code Object}.
* @param player the player.
*/
public KalebDialgoue(Player player) {
super(player);
}
@Override
public DialoguePlugin newInstance(Player player) {
return new KalebDialgoue(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, "Bye!");
stage = 1;
break;
case 1:
end();
break;
}
return true;
}
@Override
public int[] getIds() {
return new int[] { 666 };
}
}

View file

@ -1,115 +1,115 @@
package core.game.content.dialogue;
import core.plugin.Initializable;
import org.rs09.consts.Items;
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.tools.RandomFunction;
/**
* Handles the man dialogues.
*
* @author 'Vexia
*/
@Initializable
public class ManDialoguePlugin extends DialoguePlugin {
private static final Item CIDER = new Item(Items.CIDER_5763);
/**
* The NPC ids that use this dialogue plugin.
*/
private static final int[] NPC_IDS = {1, 2, 3, 4, 5, 6, 16, 24, 25, 170, 351, 352, 353, 354, 359, 360, 361, 362, 363, 663, 726, 727, 728, 729, 730, 1086, 2675, 2776, 3224, 3225, 3227, 5923, 5924,};
public ManDialoguePlugin() {
}
public ManDialoguePlugin(Player player) {
super(player);
}
@Override
public DialoguePlugin newInstance(Player player) {
return new ManDialoguePlugin(player);
}
@Override
public boolean open(Object... args) {
npc = (NPC) args[0];
if (npc == null)
return false;
if (args.length > 1
&& args[1] instanceof Item
&& ((Item) args[1]).equals(CIDER)
&& player.getInventory().remove(CIDER)) {
// Seers achievement diary
if (!player.getAchievementDiaryManager().getDiary(DiaryType.SEERS_VILLAGE).isComplete(0, 6)) {
if (player.getAttribute("diary:seers:pub-cider", 0) >= 4) {
player.setAttribute("/save:diary:seers:pub-cider", 5);
player.getAchievementDiaryManager().getDiary(DiaryType.SEERS_VILLAGE).updateTask(player, 0, 6, true);
} else {
player.setAttribute("/save:diary:seers:pub-cider", player.getAttribute("diary:seers:pub-cider", 0) + 1);
}
}
npc("Ah, a glass of cider, that's very generous of you. I", "don't mind if I do. Thanks!");
stage = 999;
return true;
}
interpreter.sendDialogues(player, FacialExpression.HALF_GUILTY, "Hello, how's it going?");
stage = RandomFunction.random(0, 5);
if (stage == 1) {
stage = 0;
}
return true;
}
@Override
public boolean handle(int interfaceId, int buttonId) {
switch (stage) {
case 0:
interpreter.sendDialogues(npc, FacialExpression.HALF_GUILTY, "I'm very well thank you.");
stage = 999;
break;
case 999:
end();
break;
case 2:
interpreter.sendDialogues(npc, FacialExpression.HALF_GUILTY, "Who are you?");
stage = 20;
break;
case 3:
interpreter.sendDialogues(npc, FacialExpression.HALF_GUILTY, "I'm fine, how are you?");
stage = 30;
break;
case 4:
interpreter.sendDialogues(npc, FacialExpression.HALF_GUILTY, "No, I don't want to buy anything!");
stage = 999;
break;
case 5:
interpreter.sendDialogues(npc, FacialExpression.HALF_GUILTY, "I think we need a new king. The one we've got isn't", "very good.");
stage = 999;
break;
case 20:
interpreter.sendDialogues(player, FacialExpression.HALF_GUILTY, "I'm a bold adventurer.");
stage = 21;
break;
case 21:
interpreter.sendDialogues(npc, FacialExpression.HALF_GUILTY, "Ah, a very noble profession.");
stage = 999;
break;
case 30:
interpreter.sendDialogues(player, FacialExpression.HALF_GUILTY, "Very well thank you.");
stage = 999;
break;
}
return true;
}
@Override
public int[] getIds() {
return NPC_IDS;
}
}
package core.game.content.dialogue;
import core.plugin.Initializable;
import org.rs09.consts.Items;
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.tools.RandomFunction;
/**
* Handles the man dialogues.
*
* @author 'Vexia
*/
@Initializable
public class ManDialoguePlugin extends DialoguePlugin {
private static final Item CIDER = new Item(Items.CIDER_5763);
/**
* The NPC ids that use this dialogue plugin.
*/
private static final int[] NPC_IDS = {1, 2, 3, 4, 5, 6, 16, 24, 25, 170, 351, 352, 353, 354, 359, 360, 361, 362, 363, 726, 727, 728, 729, 730, 1086, 2675, 2776, 3224, 3225, 3227, 5923, 5924,};
public ManDialoguePlugin() {
}
public ManDialoguePlugin(Player player) {
super(player);
}
@Override
public DialoguePlugin newInstance(Player player) {
return new ManDialoguePlugin(player);
}
@Override
public boolean open(Object... args) {
npc = (NPC) args[0];
if (npc == null)
return false;
if (args.length > 1
&& args[1] instanceof Item
&& ((Item) args[1]).equals(CIDER)
&& player.getInventory().remove(CIDER)) {
// Seers achievement diary
if (!player.getAchievementDiaryManager().getDiary(DiaryType.SEERS_VILLAGE).isComplete(0, 6)) {
if (player.getAttribute("diary:seers:pub-cider", 0) >= 4) {
player.setAttribute("/save:diary:seers:pub-cider", 5);
player.getAchievementDiaryManager().getDiary(DiaryType.SEERS_VILLAGE).updateTask(player, 0, 6, true);
} else {
player.setAttribute("/save:diary:seers:pub-cider", player.getAttribute("diary:seers:pub-cider", 0) + 1);
}
}
npc("Ah, a glass of cider, that's very generous of you. I", "don't mind if I do. Thanks!");
stage = 999;
return true;
}
interpreter.sendDialogues(player, FacialExpression.HALF_GUILTY, "Hello, how's it going?");
stage = RandomFunction.random(0, 5);
if (stage == 1) {
stage = 0;
}
return true;
}
@Override
public boolean handle(int interfaceId, int buttonId) {
switch (stage) {
case 0:
interpreter.sendDialogues(npc, FacialExpression.HALF_GUILTY, "I'm very well thank you.");
stage = 999;
break;
case 999:
end();
break;
case 2:
interpreter.sendDialogues(npc, FacialExpression.HALF_GUILTY, "Who are you?");
stage = 20;
break;
case 3:
interpreter.sendDialogues(npc, FacialExpression.HALF_GUILTY, "I'm fine, how are you?");
stage = 30;
break;
case 4:
interpreter.sendDialogues(npc, FacialExpression.HALF_GUILTY, "No, I don't want to buy anything!");
stage = 999;
break;
case 5:
interpreter.sendDialogues(npc, FacialExpression.HALF_GUILTY, "I think we need a new king. The one we've got isn't", "very good.");
stage = 999;
break;
case 20:
interpreter.sendDialogues(player, FacialExpression.HALF_GUILTY, "I'm a bold adventurer.");
stage = 21;
break;
case 21:
interpreter.sendDialogues(npc, FacialExpression.HALF_GUILTY, "Ah, a very noble profession.");
stage = 999;
break;
case 30:
interpreter.sendDialogues(player, FacialExpression.HALF_GUILTY, "Very well thank you.");
stage = 999;
break;
}
return true;
}
@Override
public int[] getIds() {
return NPC_IDS;
}
}

View file

@ -8,6 +8,7 @@ import org.json.simple.JSONObject;
import java.nio.ByteBuffer;
import java.util.HashMap;
import java.util.TreeMap;
import java.util.Map;
import java.util.Map.Entry;
@ -21,7 +22,7 @@ public final class QuestRepository {
/**
* The static mapping of instanced quests.
*/
private static final Map<String, Quest> QUESTS = new HashMap<>();
private static final Map<String, Quest> QUESTS = new TreeMap<>();
/**
* The mapping of quest indexes with related stages.
@ -277,4 +278,4 @@ public final class QuestRepository {
public Map<Integer, Integer> getQuestList() {return quests;}
}
}

View file

@ -116,14 +116,16 @@ public class StandardCookingPulse extends Pulse {
public boolean isBurned(final Player player, final Scenery object, int food) {
boolean hasGauntlets = player.getEquipment().containsItem(new Item(Items.COOKING_GAUNTLETS_775));
double burn_stop = (double) CookableItems.getBurnLevel(food);
int gauntlets_boost = 0;
CookableItems item = CookableItems.forId(food);
if (hasGauntlets && (food == Items.RAW_SWORDFISH_371 || food == Items.RAW_LOBSTER_377 || food == Items.RAW_SHARK_383)) {
if (hasGauntlets && (food == Items.RAW_SWORDFISH_371 || food == Items.RAW_LOBSTER_377 || food == Items.RAW_MONKFISH_7944 || food == Items.RAW_SHARK_383)) {
burn_stop -= 6;
gauntlets_boost += 6;
}
if (player.getSkills().getLevel(Skills.COOKING) > burn_stop) {
return false;
}
int cook_level = player.getSkills().getLevel(Skills.COOKING);
int cook_level = player.getSkills().getLevel(Skills.COOKING) + gauntlets_boost;
double host_ratio = RandomFunction.randomDouble(100.0);
double low = item.low + (object.getName().contains("fire") ? 0 : (0.1 * item.low));
double high = item.high + (object.getName().contains("fire") ? 0 : (0.1 * item.high));

View file

@ -275,7 +275,7 @@ public enum MiningNode{
COAL_49(42035,452, (byte) 8),
//Gold
GOLD_ORE_0( 2099, 452, (byte) 9),
GOLD_ORE_0( 2099, 452, (byte) 20),
GOLD_ORE_1( 2098, 450, (byte) 9),
GOLD_ORE_2( 2611, 21298, (byte) 9),
GOLD_ORE_3( 2610, 21297, (byte) 9),
@ -572,6 +572,14 @@ public enum MiningNode{
rate = 0.6;
reward = 12630;
level = 46;
break;
case 20:
respawnRate = 50 | 100 << 16;
experience = 17.5;
rate = 0.6;
reward = 446;
level = 46;
break;
}
}
private static HashMap<Integer, MiningNode> NODE_MAP = new HashMap<>();

View file

@ -253,6 +253,13 @@ public final class InteractionPacket implements IncomingPacket {
} else if (objectId == 6899) {
object = new Scenery(6899, new Location(3221, 9618));
}
// Family crest levers don't have varps associated with them, so their state is validated with attributes
// instead, and they always appear as their down/odd variant in the server's map
if(2421 <= objectId && objectId <= 2426 && objectId % 2 == 0) {
object = new Scenery(objectId - 1, new Location(x, y, player.getLocation().getZ()));
objectId -= 1;
}
if (object == null || object.getId() != objectId) {
player.debug("Scenery(" + objectId + ") interaction was " + object + " at location " + x + ", " + y + ".");
PacketRepository.send(ClearMinimapFlag.class, new PlayerContext(player));
@ -397,4 +404,4 @@ public final class InteractionPacket implements IncomingPacket {
return player;
}
}
}

View file

@ -0,0 +1,87 @@
package core.game.content.dialogue
import core.game.node.entity.npc.NPC
import core.game.node.entity.player.Player
import core.plugin.Initializable
/**
* Represents the gem trader Dialogue plugin
* @author plex
* @version 2.0
*/
@Initializable
class GemTraderDialogue (player: Player? = null): DialoguePlugin(player){
override fun newInstance(player: Player?): DialoguePlugin {
return GemTraderDialogue(player)
}
override fun open(vararg args: Any?): Boolean {
npc = (args[0] as NPC).getShownNPC(player)
val qstage = player?.questRepository?.getStage("Family Crest") ?: -1
if(qstage == 12){
npc("Good day to you, traveller. ",
"Would you be interested in buying some gems?")
stage = 1
}
else{
npc("Good day to you, traveller. ",
"Would you be interested in buying some gems?")
stage = 2
}
return true
}
override fun handle(interfaceId: Int, buttonId: Int): Boolean {
when(stage){
1 -> options("Yes, please.", "No, thank you.", "I'm in search of a man named Avan Fitzharmon").also{
stage = 10
}
2 -> options("Yes, please.", "No, thank you.").also{
stage = 20
}
10 -> when(buttonId){
1 -> npc.openShop(player).also { stage = 1000 };
2 -> player("No Thank you").also{stage = 1000}
3 -> npc("Fitzharmon, eh? Hmmm... If I'm not mistaken, ",
"that's the family name of a member ",
"of the Varrockian nobility.").also{stage = 100}
}
20 -> when(buttonId){
1 -> npc.openShop(player).also { stage = 1000 };
2 -> player("No Thank you").also{stage = 1000}
}
100 -> npc("You know, I HAVE seen someone of that" ,
" persuasion around here recently... " ,
"wearing a 'poncey' yellow cape, he was.").also{stage++}
101 -> npc("Came in here all la-di-dah, high and mighty,",
"asking for jewellery made from 'perfect gold' - " ,
"whatever that is - like 'normal' gold just isn't " ,
"good enough for 'little lord fancy pants' there!").also{stage ++}
102 -> npc("I told him to head to the desert 'cos " ,
"I know there's gold out there, in them there sand dunes. " ,
"And if it's not up to his lordship's " ,
"high standards of 'gold perfection', then...").also{stage++}
103 -> npc("Well, maybe we'll all get lucky ",
"and the scorpions will deal with him.").also{
stage = 1000;
player.questRepository.getQuest("Family Crest").setStage(player, 13)
}
1000 -> end()
}
return true
}
override fun getIds(): IntArray {
return intArrayOf(540)
}
}

View file

@ -0,0 +1,216 @@
package core.game.content.quest.members.familycrest
import core.game.content.dialogue.DialoguePlugin
import core.game.node.entity.npc.NPC
import core.game.node.entity.player.Player
import core.game.node.item.Item
import core.plugin.Initializable
@Initializable
class AvanDialogue (player: Player? = null): DialoguePlugin(player) {
val CREST_PIECE_AVAN: Item = Item(779)
override fun newInstance(player: Player?): DialoguePlugin {
return AvanDialogue(player);
}
override fun open(vararg args: Any?): Boolean {
npc = (args[0] as NPC).getShownNPC(player)
val qstage = player?.questRepository?.getStage("Family Crest") ?: -1
if(qstage == 100){
options("Can you enchant these gauntlets for me?", "Nevermind")
stage = 6000
return true
}
if(qstage < 13){
npc("What? Can't you see I'm busy?").also { stage = 1000 }
}else{
when(qstage){
13 -> options("Why are you lurking around a scorpion pit?", "I'm looking for a man... his name is Avan Fitzharmon.").also{stage = 2}
14 -> npc("So how are you doing getting me my perfect gold jewelry?").also{stage = 100}
15 -> npc("So how are you doing getting me my perfect gold jewelry?").also{stage = 200}
16 -> player("Where did you say I could find your brother Johnathon again?").also{stage = 304}
17 -> npc("Greetings again, adventurer. How are you doing on retrieving the crest pieces?").also{stage = 400}
18 -> npc("Greetings again, adventurer. How are you doing on retrieving the crest pieces?").also{stage = 400}
19 -> npc("Greetings again, adventurer. How are you doing on retrieving the crest pieces?").also{stage = 400}
}
}
return true
}
override fun handle(interfaceId: Int, buttonId: Int): Boolean {
when(stage){
1 -> player("Well, sooooorry...").also{stage = 1000}
2->when(buttonId){
1 -> npc("It's a good place to find gold...").also{stage = 1000}
2 -> npc("Then you have found him. My name is Avan Fitzharmon.").also{stage++}
}
3 -> player("You have a part of your family crest. I am on a quest ",
"to retrieve all of the fragmented pieces ",
"and restore the crest.").also{stage++}
4 -> npc("Ha! I suppose one of my worthless brothers ",
"has sent you on this quest then?").also{stage++}
5 -> player("No, it was your father who has asked me to do this for him.").also{stage++}
6 -> npc("My... my father wishes this? Then that is a different matter. ",
"I will let you have my crest shard, adventurer, ",
"but you must first do something for me.").also{stage++}
7 -> npc("There is a certain lady I am trying to impress. ",
"As a man of noble birth, I can not give her just ",
"any gold trinket to show my devotion. ").also{stage++}
8 -> npc("What I intend to give her, is a golden ring, " ,
"embedded with the finest precious red stone available, " ,
"and a necklace to match this ring. ").also { stage++ }
9 -> npc("The problem however for me, is that ",
"not just any old gold will be suitable. ",
"I seek only the purest, the most high quality of gold ",
"what I seek, if you will, is perfect gold.").also{stage++}
10 -> npc("None of the gold around here is even " ,
"remotely suitable in terms of quality. ",
"I have searched far and wide for the perfect gold I desire, ",
"but have had no success so in finding it I am afraid. ").also { stage++ }
11 -> npc("If you can find me my perfect gold, " ,
"make a ring and necklace from it, and add rubies to them, ",
"I will gladly hand over my fragment of " ,
"the family crest to you.").also{stage++}
12 -> player("Can you give me any help on finding this 'perfect gold'?").also{stage++}
13 -> npc("I thought I had found a solid lead on its whereabouts ",
"when I heard of a dwarf who is an expert " ,
"on gold who goes by the name of 'Boot'. ").also { stage++ }
14 -> npc("Unfortunately he has apparently returned to this home,",
"somewhere in the mountains, " ,
"and I have no idea how to find him.").also { stage++}
15 -> player("Well, I'll see what I can do.").also{
stage = 1000
player.questRepository.getQuest("Family Crest").setStage(player, 14)
}
100 -> player("I'm still after that 'perfect gold'.").also { stage++ }
101 -> npc("I know how you feel... for such a long time " ,
"I have searched and searched for the elusive perfect gold... " ,
"I thought I had gotten a good lead on finding it ").also{stage++}
102 -> npc("when I heard talk of a dwarven expert on gold named Boot " ,
"some time back, but unfortunately for me," ,
" he has returned to his mountain home, which I cannot find.").also { stage = 1000}
200 -> if(!player.inventory.containItems(774,773)){
npc("I have spoken to Boot the dwarf about the location " ,
"of 'perfect gold', " ,
"but haven't managed to make you your jewelry yet.").also { stage++ }
}
else{
player("I have the ring and necklace right here.")
stage = 300;
}
201 -> npc("Well, I won't entrust you with my piece of the crest " ,
"until you have brought me a necklace of perfect gold " ,
"with a red precious stone, and a perfect gold ring to match.").also { stage = 1000 }
300 -> sendDialogue("You hand Avan the perfect gold ring and necklace.").also{
player.questRepository.getQuest("Family Crest").setStage(player, 16)
player.inventory.remove(Item(774), Item(773))
player.inventory.add(CREST_PIECE_AVAN)
stage++
}
301 -> npc("These... these are exquisite! E" ,
"XACTLY what I was searching for all of this time! " ,
"Please, take my crest fragment!").also { stage++ }
302 -> npc("Now, I suppose you will be wanting to find my brother " ,
"Johnathon who is in possession of the " ,
"final piece of the family's crest?").also { stage++ }
303 -> player("That's correct.").also{stage++}
304 -> npc("Well, the last I heard of my brother Johnathon," ,
" he was studying the magical arts, " ,
"and trying to hunt some demon or other out in The Wilderness.").also{stage++}
304 -> npc("Unsurprisingly, I do not believe he is doing a particularly good job of things, ",
"and spends most of his time recovering from his injuries " ,
"in some tavern or other near the eastern edge of The Wilderness. " ,
"You'll probably find him still there.").also{stage++}
305 -> player("Thanks Avan.").also { stage = 1000 }
400 -> player("I am still working on it.").also{stage++}
401 -> npc("I hope you succeed for my father's sake.").also{
if(player.inventory.containItems(CREST_PIECE_AVAN.id, 782) || player.bank.containItems(CREST_PIECE_AVAN.id, 782)){
stage = 1000
}
else{
stage++
}
}
402 -> player("I have lost the fragment you gave me...").also{stage++}
403 -> npc("I have a confession myself adventurer... " ,
"I did not fully trust you with the actual part ",
"of my family's crest before, and gave you a " ,
"worthless replica before... ").also{stage++}
404-> npc("In hindsight, it seems I was right. " ,
"I will give you the real piece now, ",
"but please try not to lose it; " ,
"it is a priceless family heirloom.").also{stage = 1000
player.inventory.add(CREST_PIECE_AVAN)}
6000 -> when(buttonId){
1-> if(DoMissingGuantletCheck() != -1){
var gauntletID = DoMissingGuantletCheck()
if(gauntletID == 776){
npc("You already have the Goldsmith guantlets.")
stage = 1000
}
else{
npc("Here you go")
player.inventory.remove(Item(gauntletID))
player.inventory.add(Item(776))
stage = 1000
}
}
else{
npc("You do not have the guantlets with you in your inventory")
stage = 1000
}
2-> player("Never mind").also{stage = 1000}
}
1000 -> end()
}
return true
}
private fun DoMissingGuantletCheck(): Int{
var itemsToCheck = listOf(775, 776, 777, 778)
for(item in itemsToCheck){
if(player.inventory.containItems(item))
return item
}
return -1
}
override fun getIds(): IntArray {
return intArrayOf(663)
}
}

View file

@ -0,0 +1,71 @@
package core.game.content.quest.members.familycrest
import core.game.content.dialogue.DialoguePlugin
import core.game.node.entity.npc.NPC
import core.game.node.entity.player.Player
import core.plugin.Initializable
@Initializable
class BootDialogue (player: Player? = null): DialoguePlugin(player){
override fun newInstance(player: Player?): DialoguePlugin {
return BootDialogue(player)
}
override fun open(vararg args: Any?): Boolean {
npc = (args[0] as NPC).getShownNPC(player)
val qstage = player?.questRepository?.getStage("Family Crest") ?: -1
if(qstage < 14 || qstage > 14){
npc("Hello tall person.")
stage = 1
}
else{
npc("Hello tall person.")
stage = 2
}
return true
}
override fun handle(interfaceId: Int, buttonId: Int): Boolean {
when(stage){
1-> options("Hello short person.", "Why are you called Boot?").also { stage = 10 }
2 -> options("Hello. I'm in search of very high quality gold.", "Hello short person.", "Why are you called Boot?").also { stage= 20}
10 ->when(buttonId){
1-> player("Hello short person.").also { stage = 1000 }
2 -> npc("I'm called Boot, because when I was very young, ",
"I used to sleep, in a large boot.").also{stage++}
}
11 -> player("Yeah, great, I didn't want your life story.").also { stage = 1000}
20 -> when (buttonId){
1 -> npc("High quality gold eh? Hmmm... " ,
"Well, the very best quality gold that I know of " ,
"can be found in an underground ruin near Witchaven.").also{stage++}
2-> player("Hello short person.").also { stage = 1000 }
3 -> npc("I'm called Boot, because when I was very young, ",
"I used to sleep, in a large boot.").also{stage = 11}
}
21 -> npc("I don't believe it's exactly easy to get to though...").also {
stage = 1000;
player.questRepository.getQuest("Family Crest").setStage(player, 15)
}
1000 -> end()
}
return true;
}
override fun getIds(): IntArray {
return intArrayOf(665)
}
}

View file

@ -0,0 +1,251 @@
package core.game.content.quest.members.familycrest
import core.game.content.dialogue.DialoguePlugin
import core.game.node.entity.npc.NPC
import core.game.node.entity.player.Player
import core.game.node.item.Item
import core.plugin.Initializable
@Initializable
class CalebDialogue (player: Player? = null): DialoguePlugin(player) {
val CREST_PIECE: Item = Item(780)
override fun newInstance(player: Player?): DialoguePlugin {
return CalebDialogue(player)
}
override fun open(vararg args: Any?): Boolean {
npc = (args[0] as NPC).getShownNPC(player)
val qstage = player?.questRepository?.getStage("Family Crest") ?: -1
if(qstage == 100){
options("Can you enchant these gauntlets for me?", "Nevermind")
stage = 6000
return true
}
when(qstage){
0-> npc("Who are you? What are you after?").also{stage = 2}
10 -> npc("Who are you? What are you after?").also{stage = 1}
11 -> npc("How is the fish collecting going?").also{stage = 300}
12 -> player("Where did you say I could find Avan again?").also{stage = 400}
13 -> player("Where did you say I could find Avan again?").also{stage = 400}
14 -> player("Where did you say I could find Avan again?").also{stage = 400}
15 -> player("Where did you say I could find Avan again?").also{stage = 400}
16 -> player("How are you doing getting the crest pieces?").also{stage = 402}
17 -> player("How are you doing getting the crest pieces?").also{stage = 402}
18 -> player("How are you doing getting the crest pieces?").also{stage = 402}
19 -> player("How are you doing getting the crest pieces?").also{stage = 402}
}
return true
}
override fun handle(interfaceId: Int, buttonId: Int): Boolean {
when(stage){
1 -> options("Are you Caleb Fitzharmon", "Nothing I will be on my way.", "I see you are a chef... could you cook me anything?").also{stage = 3}
2-> options( "Nothing I will be on my way.", "I see you are a chef... could you cook me anything?").also{stage = 4}
3 -> when(buttonId){
1 -> npc("Why... yes I am, but I don't believe I know you... " ,
"how did you know my name?").also{stage = 5}
2 -> player("Nothing I will be on my way.").also{stage = 1000}
3 -> npc("I would, but I am very busy. I am trying to increase ",
"my renown as one of the world's leading chefs " ,
"by preparing a special and unique fish salad.").also{stage = 1000}
}
4 -> when(buttonId){
1 -> player("Nothing I will be on my way.").also{stage = 1000}
2 -> npc("I would, but I am very busy. I am trying to increase ",
"my renown as one of the world's leading chefs " ,
"by preparing a special and unique fish salad.").also{stage = 1000}
}
5 -> player("I have been sent by your father. ",
"He wishes the Fitzharmon Crest to be restored.").also{stage++}
6 -> npc("Ah... well... hmmm... yes... ",
"I do have a piece of it anyway...").also{stage++}
7 -> options("Uh... what happened to the rest of it?", "So can I have your bit?").also{stage++}
8 -> when(buttonId){
1 -> npc("Well... my brothers and I ",
"had a slight disagreement about it...",
" we all wanted to be heir to my fathers' lands, ",
"and we each ended up with a piece of the crest.").also{stage = 100}
2 -> npc("Well, I am the oldest son, so by the rules of chivalry, ",
"I am most entitled to be the rightful bearer of the crest.").also{stage = 200}
}
100 -> npc("None of us wanted to give up our rights to our brothers, ",
"so we didn't want to give up our pieces of the crest, " ,
"but none of us wanted to face our father by returning to " ,
"him with an incomplete crest... ").also{stage ++}
101 -> npc("We each went our separate ways many years past, " ,
"none of us seeing our father or willing " ,
"to give up our fragments.").also{stage = 7}
200 -> player("It's not really much use without " ,
"the other fragments is it though?").also{stage++}
201 -> npc("Well that is true... " +
"perhaps it is time to put my pride aside... ").also{stage++}
202 -> npc( "I'll tell you what: ",
"I'm struggling to complete this fish salad of mine, ").also{stage++}
203 -> npc( "so if you will assist me in my search for the ingredients, " ,
"then I will let you take my",
"piece as reward for your assistance.").also{stage++}
204 -> player("So what ingredients are you missing?").also{stage++}
205 -> npc("I require the following cooked fish: " ,
"Swordfish, Bass, Tuna, Salmon and Shrimp.").also{stage++}
206 -> options("Ok, I will get those.", "Why don't you just give me the crest?").also{stage++}
207 -> when(buttonId){
1 -> npc("You will? It would help me a lot!").also{stage = 1000}.also{
player.questRepository.getQuest("Family Crest").setStage(player, 11)
}
2 -> npc("It's a valuable family heirloom. " ,
"I think the least you can do is prove you're worthy " ,
"of it before I hand it over.").also{stage = 206}
}
300 -> if(player.inventory.containItems(315, 329, 361, 365, 373)){
player("Got them all with me.").also{stage++}
}else{
player("I didn't manage to get them all yet...").also{stage = 320}
}
301 -> sendDialogue("You exchange the fish for Caleb's piece of the crest.").also{stage++}.also{
player.inventory.remove(Item(315),Item(329), Item(361), Item(365), Item(373))
player.inventory.add(CREST_PIECE)
player.questRepository.getQuest("Family Crest").setStage(player, 12);
}
302 -> options("Uh... what happened to the rest of it?" , "Thank you very much!").also{stage++}
303 -> when(buttonId){
1 -> npc("Well... my brothers and I had a slight disagreement about it... ",
"we all wanted to be the heir of my father's lands ",
"and we each ended up with a piece of the crest.").also{stage++}
2 -> npc("You're welcome.").also{stage = 1000}
}
304 -> npc("None of us wanted to give up our rights to our brothers," ,
"so we didn't want to give up our pieces of the crest, " ,
"but none of us wanted to face our father " ,
"by returning to him with an incomplete crest.").also{stage ++}
305 -> npc("We each went our separate ways many years past,",
"none of us seeing our father or willing to",
"give up our fragments.").also{stage++}
306 -> player("So do you know where I could find any of your brothers?").also{stage++}
307 -> npc("Well, we haven't really kept in touch... ",
"what with the dispute over the crest and all...",
"I did hear from my brother Avan a while ago though..").also{stage++}
308 -> npc("He said he was on some kind of search for treasure,",
"or gold, or something out near Al Kharid somewhere. ",
"Avan always had expensive tastes, so you might try",
"asking the gem trader for his wherebouts.").also{stage ++}
309 -> npc("Be warned though. Avan is quite greedy, ",
"and you may find he is not prepared to hand over " ,
"his crest piece to you as easily as I have.").also{stage = 1000}
320 -> npc("Remember, I want the following cooked fish: ",
"Swordfish, Bass, Tuna, Salmon and Shrimp.").also{stage = 1000}
400 -> npc("Last I heard he was on some " ,
"stupid treasure hunt out in the desert somewhere. " ,
"Your best bet is asking around there.").also{stage++}
401 -> npc("How are you doing getting the crest pieces?").also{stage++}
402 -> player("I am still working on it.").also{stage++}
403 ->
if(player.inventory.containItems(CREST_PIECE.id, 782) || player.bank.containItems(CREST_PIECE.id, 782)) {
npc("Then why are you wasting your time here?")
stage = 1000;
}
else{
player("I have lost the fragment that you gave me...")
stage++;
}
404 -> npc("I have some good news for you then. " ,
"One of my customers found this on their travels " ,
"and recognised it as mine and returned it to me here.").also{stage++}
405 -> sendDialogue("Caleb hands over his crest piece to you again.").also{
stage++
player.inventory.add(CREST_PIECE)
}
406 -> npc("I suggest you be less careless in the future. ",
"The crest is extremely valuable, and utterly irreplacable.").also{stage = 1000}
6000 -> when(buttonId){
1-> if(DoMissingGuantletCheck() != -1){
var gauntletID = DoMissingGuantletCheck()
if(gauntletID == 775){
npc("You already have the Cooking Guantlets.")
stage = 1000
}
else{
npc("Here you go")
player.inventory.remove(Item(gauntletID))
player.inventory.add(Item(775))
stage = 1000
}
}
else{
npc("You do not have the guantlets with you in your inventory")
stage = 1000
}
2-> player("Never mind").also{stage = 1000}
}
1000 -> end()
}
return true
}
private fun DoMissingGuantletCheck(): Int{
var itemsToCheck = listOf(775, 776, 777, 778)
for(item in itemsToCheck){
if(player.inventory.containItems(item))
return item
}
return -1
}
override fun getIds(): IntArray {
return intArrayOf(666)
}
}

View file

@ -0,0 +1,65 @@
package plugin.quest.members.familycrest
import core.game.node.entity.Entity
import core.game.node.entity.player.Player
import core.game.world.map.Location
import core.game.world.map.RegionManager
import core.game.world.map.zone.MapZone
import core.game.world.map.zone.ZoneBorders
import core.game.world.map.zone.ZoneBuilder
import core.plugin.Initializable
import core.plugin.Plugin
@Initializable
class ChronozonCaveZone: MapZone("FC ChronozoneZone", true), Plugin<Unit> {
val triggers = ArrayList<Location>()
var chronozon = ChronozonNPC(667, Location(3086, 9936, 0))
override fun configure() {
register(ZoneBorders(3082, 9929, 3091, 9940))
triggers.add(Location.create(3083, 9939))
triggers.add(Location.create(3084, 9939))
triggers.add(Location.create(3085, 9939))
triggers.add(Location.create(3086, 9939))
triggers.add(Location.create(3087, 9939))
triggers.add(Location.create(3088, 9939))
triggers.add(Location.create(3089, 9939))
triggers.add(Location.create(3090, 9939))
}
override fun move(e: Entity?, from: Location?, to: Location?): Boolean {
return super.move(e, from, to)
}
override fun enter(e: Entity?): Boolean {
if (e != null) {
if (e.isPlayer) {
chronozon = ChronozonNPC(667, Location(3086, 9936, 0))
var player = e as Player
if (player.questRepository.getQuest("Family Crest").getStage(e) == 19 && !RegionManager.getLocalNpcs(
Location(3086, 9936, 0),
5
).contains(chronozon)
) {
chronozon.setPlayer(e);
chronozon.isRespawn = false
chronozon.init()
}
}
return true
}
return false
}
override fun newInstance(arg: Unit?): Plugin<Unit> {
ZoneBuilder.configure(this)
return this
}
override fun fireEvent(identifier: String?, vararg args: Any?): Any {
return UInt
}
}

View file

@ -0,0 +1,106 @@
package plugin.quest.members.familycrest
import core.game.node.entity.Entity
import core.game.node.entity.combat.BattleState
import core.game.node.entity.combat.CombatStyle
import core.game.node.entity.npc.AbstractNPC
import core.game.node.entity.player.Player
import core.game.world.map.Location
class ChronozonNPC(id: Int, location: Location?) : AbstractNPC(667, Location(3086, 9936, 0)){
lateinit var m_targetPlayer: Player
var m_amountOfFireDamageTaken: Int = 0
var m_amountOfAirDamageTaken: Int = 0
var m_amountOfWaterDamageTaken: Int = 0
var m_amountOfEarthDamageTaken: Int = 0
override fun construct(id: Int, location: Location?, vararg objects: Any?): AbstractNPC {
return ChronozonNPC(id, location)
}
override fun getIds(): IntArray {
return intArrayOf(667)
}
override fun handleTickActions() {
super.handleTickActions()
if (!m_targetPlayer.isActive || m_targetPlayer.getLocation().getDistance(getLocation()) > 15) {
clear()
}
}
override fun checkImpact(state: BattleState?) {
if (state != null) {
if(m_amountOfAirDamageTaken == 0 || m_amountOfWaterDamageTaken == 0 ||
m_amountOfEarthDamageTaken == 0 || m_amountOfFireDamageTaken == 0) {
if(state.style != CombatStyle.MAGIC || state.totalDamage >= skills.lifepoints) {
state.neutralizeHits()
}
}
if(state.spell != null) {
if(state.spell.spellId == 24) {
if(state.totalDamage > 0 && m_amountOfAirDamageTaken == 0) {
m_targetPlayer.sendMessage("Chronozon weakens...")
}
m_amountOfAirDamageTaken += state.totalDamage
}
if(state.spell.spellId == 27) {
if(state.totalDamage > 0 && m_amountOfWaterDamageTaken == 0) {
m_targetPlayer.sendMessage("Chronozon weakens...")
}
m_amountOfWaterDamageTaken += state.totalDamage
}
if(state.spell.spellId == 33) {
if(state.totalDamage > 0 && m_amountOfEarthDamageTaken == 0) {
m_targetPlayer.sendMessage("Chronozon weakens...")
}
m_amountOfEarthDamageTaken += state.totalDamage
}
if(state.spell.spellId == 38) {
if(state.totalDamage > 0 && m_amountOfFireDamageTaken == 0) {
m_targetPlayer.sendMessage("Chronozon weakens...")
}
m_amountOfFireDamageTaken += state.totalDamage
}
}
}
}
override fun isAttackable(entity: Entity, style: CombatStyle?): Boolean {
return entity == m_targetPlayer &&
m_targetPlayer.questRepository.getQuest("Family Crest").getStage(m_targetPlayer) == 19 &&
super.isAttackable(entity, style)
}
override fun clear() {
super.clear()
}
override fun finalizeDeath(killer: Entity?) {
if(killer == m_targetPlayer) {
m_targetPlayer.questRepository.getQuest("Family Crest").setStage(m_targetPlayer, 20)
}
clear()
super.finalizeDeath(killer)
}
fun setPlayer(player: Player){
m_targetPlayer = player;
}
}
//3086, 9936, 0

View file

@ -0,0 +1,53 @@
package plugin.quest.members.familycrest
import core.game.interaction.NodeUsageEvent
import core.game.interaction.UseWithHandler
import core.game.node.entity.player.Player
import core.game.node.item.Item
import core.plugin.Initializable
import core.plugin.Plugin
@Initializable
class CrestCombiningInteraction: UseWithHandler(779, 780,781) {
val CREST_AVAN: Item = Item(779)
val CREST_CALEB: Item = Item(780)
val CREST_JOHNATHON: Item = Item(781)
val CREST_FULL: Item = Item(782)
override fun newInstance(arg: Any?): Plugin<Any> {
addHandler(779, ITEM_TYPE, this)
addHandler(780, ITEM_TYPE, this)
addHandler(781, ITEM_TYPE, this)
return this
}
override fun handle(event: NodeUsageEvent?): Boolean {
event ?: return false
val used = event.used
return when(used.id){
779 -> CraftCrest(event.player, event)
780 -> CraftCrest(event.player, event)
781 -> CraftCrest(event.player, event)
else -> false
}
}
private fun CraftCrest(player: Player, event: NodeUsageEvent): Boolean{
return when(event.usedWith.id){
779,780,781 ->{
if(player.inventory.containItems(779, 780, 781)) {
player.inventory.remove(CREST_AVAN)
player.inventory.remove(CREST_CALEB)
player.inventory.remove(CREST_JOHNATHON)
player.inventory.add(CREST_FULL)
true
}
false
}
else -> false
}
}
}

View file

@ -0,0 +1,200 @@
package plugin.quest.members.familycrest
import core.game.content.dialogue.DialoguePlugin
import core.game.node.entity.npc.NPC
import core.game.node.entity.player.Player
import core.game.node.entity.skill.Skills
import core.game.node.item.Item
import core.plugin.Initializable
@Initializable
/**
* Handles DimintheisDialogue Dialogue
* @author Plex
*/
class DimintheisDialogue(player: Player? = null): DialoguePlugin(player) {
override fun newInstance(player: Player?): DialoguePlugin {
return DimintheisDialogue(player)
}
override fun open(vararg args: Any?): Boolean {
npc = (args[0] as NPC).getShownNPC(player)
val qstage = player?.questRepository?.getStage("Family Crest") ?: -1
if(qstage == 100 && !DoMissingGuantletCheck()){
npc("Thank you for saving our family honour, ",
"We will never forget you")
stage = 1000
return true
}
if(qstage == 100 && DoMissingGuantletCheck()){
player("I've lost the guantlets you gave me")
stage = 6000
}
if(qstage == 20 && player.inventory.containItems(782)){
player("I have retrieved your crest.").also{stage = 5000}
return true;
}
when(qstage) {
0 -> npc("Hello. My name is Dimintheis, ",
"of the noble family Fitzharmon.").also { stage = 1 }
10 -> player("Where did you say I could find your son Caleb again?").also { stage = 3000 }
11 -> player("Where did you say I could find your son Caleb again?").also { stage = 3000 }
12 -> npc("Have you found my crest yet?").also{stage = 4000}
13 -> npc("Have you found my crest yet?").also{stage = 4000}
14 -> npc("Have you found my crest yet?").also{stage = 4000}
15 -> npc("Have you found my crest yet?").also{stage = 4000}
16 -> npc("Have you found my crest yet?").also{stage = 4000}
17 -> npc("Have you found my crest yet?").also{stage = 4000}
18 -> npc("Have you found my crest yet?").also{stage = 4000}
19 -> npc("Have you found my crest yet?").also{stage = 4000}
}
return true
}
override fun handle(interfaceId: Int, buttonId: Int): Boolean {
when(stage){
1 -> options(
"Why would a nobleman live in a dump like this?",
"You're rich then? Can i have some money?",
"Hi, i am a bold adventurer.").also {stage++}
2 -> when(buttonId){
1 -> npc("The King has taken my estate from me ",
"until such time as I can show my family crest to him.").also { stage = 3}
2 -> npc("Gah! Lousy beggar! " ,
"Your sort is what's ruining this great land! ",
"Why don't you just go and get a " ,
"job if you need money so badly?").also { stage = 1000}
3 -> npc("An adventurer hmmm? How lucky. I may have an adventure for you. " ,
"I desperately need my family crest returning to me. " ,
"It is of utmost importance.").also { stage = 4 }
}
3 -> options("Why would he do that?",
"So where is this crest?").also {stage = 5}
4 -> options("Why are you so desperate for it?",
"So where is this crest?",
"I'm not interested in that adventure right now").also { stage = 6}
5 -> when(buttonId){
1-> npc("Well, there is a long standing rule of chivalry " ,
"amongst the Varrockian aristocracy,").also{stage = 2000}
2-> npc("Well, my three sons took it with them " ,
"many years ago when they rode ").also { stage = 2007 }
}
6 -> when(buttonId){
1 -> npc("Well, there is a long standing rule of chivalry " ,
"amongst the Varrockian aristocracy,").also{stage = 2000}
2 -> npc("Well, my three sons took it with them " ,
"many years ago when they rode ").also { stage = 2007 }
3 -> npc("I realise it was a lot to ask of a stranger.").also { stage = 1000}
}
2000 -> npc(
"where each noble family is in possession of a unique crest, ",
"which signifies the honour and lineage of the family. ").also { stage++}
2001 -> npc("More than this however, it also represents the ",
"lawful rights of each family to prove their ownership of ",
"their wealth and lands. If the family crest is lost,").also { stage++ }
2002 -> npc( "then the family's estate is handed over to the ",
"current monarch until the crest is restored.").also{stage++}
2003 -> npc("This dates back to the times when there was much in-fighting " ,
"amongst the noble families and their clans, and ",
"was introduced as a way of reducing the bloodshed that was ",
"devastating the ranks of the ruling classes at that time.").also { stage++ }
2004 -> npc("When you captured a rival family's clan, " ,
"you also captured their lands and wealth.").also{ stage++}
2005 -> options("So where is this crest?", "I'm not interested in an adventure right now").also{stage++}
2006 -> when(buttonId){
1-> npc("Well, my three sons took it ",
"with them many years ago when they rode out ").also { stage++ }
2 -> npc("I realise it was a lot to ask of a stranger.").also { stage = 1000}
}
2007 -> npc("to fight in the war against the undead necromancer " ,
"and his army in the battle to save Varrock.").also { stage++}
2008 -> npc("For many years I had assumed them all dead, " ,
"as I had heard no word from them.").also { stage++}
2009 -> npc("Recently I heard that my son Caleb is alive and well, " ,
"trying to earn his fortune as a great fish chef in Catherby.").also { stage++ }
2010 -> options("Ok, I will help you", "I'm not interested in an adventure right now").also { stage++ }
2011 -> when(buttonId){
1 -> npc("I thank you greatly adventurer!").also { stage++}
2 -> npc("I realise it was a lot to ask of a stranger.").also { stage = 1000 }
}
2013 -> if(player.questRepository.getQuest("Family Crest").hasRequirements(player)) {
npc("If you find Caleb, or my other sons... please... ",
"let them know their father still loves them...").also { stage = 1000 }.also { player.questRepository.getQuest("Family Crest").start(player) }.also { player.questRepository.syncronizeTab(player) }
}else{
npc("But im sorry, but you cannot help me right now").also{stage = 1000}
}
3000 ->npc("The only thing I have heard of my son Caleb ",
"is that he is trying to earn his fortune as a great fish chef.").also{stage++}
3001 ->npc("I believe he is staying with a friend ",
"who lives just outside the west gates of Varrock.").also{stage = 1000}
4000 -> player("I'm still looking for it").also{stage = 1000}
5000 -> npc("Adventurer... I can only thank you for your kindness, " ,
"although the words are insufficient " ,
"to express the gratitude I feel!").also{stage++}
5001 -> npc("You are truly a hero in every sense, " ,
"and perhaps your efforts can begin to " ,
"patch the wounds that have torn this family apart...").also{stage++}
5002 -> npc("I know not how I can adequately reward you for your efforts... " ,
"although I do have these mystical gauntlets, " ,
"a family heirloom that through some power unknown to me, " ,
"have always returned to the head of the family whenever lost,").also{stage++}
5003 -> npc(" or if the owner has died. " ,
"I will pledge these to you, " ,
"and if you should lose them return to me, " ,
"and they will be here.").also{stage++
}
5004 -> npc("They can also be granted extra powers. " ,
"Take them to one of my sons, " ,
"they should be able to imbue them with a skill for you.").also{stage = 1000
player.questRepository.getQuest("Family Crest").finish(player)
player.questRepository.getQuest("Family Crest").setStage(player, 100)
}
6000 -> npc("Not to worry, here they are").also{
stage = 1000
player.inventory.add(Item(778))
}
1000 -> end()
}
return true;
}
private fun DoMissingGuantletCheck(): Boolean{
var itemsToCheck = listOf(775, 776, 777, 778)
for(item in itemsToCheck){
if(player.inventory.containItems(item))
return true
if(player.bank.containItems(item))
return true
}
return false
}
override fun getIds(): IntArray {
return intArrayOf(8171)
}
}

View file

@ -0,0 +1,130 @@
package plugin.quest.members.familycrest
import core.game.node.entity.player.Player
import core.game.node.entity.player.link.quest.Quest
import core.game.node.entity.skill.Skills
import core.game.node.item.GroundItemManager
import core.game.node.item.Item
import core.plugin.Initializable
import org.rs09.consts.Items
/**
* Represents the "Family Crest" quest.
* @author Plex
*/
@Initializable
class FamilyCrest: Quest("Family Crest", 59, 58, 1, 148, 0, 1, 11) {
override fun newInstance(`object`: Any?): Quest {
return this
}
override fun drawJournal(player: Player?, stage: Int) {
super.drawJournal(player, stage)
var line = 11
player?: return
if(stage == 0){
line(player, "I can start this quest by speaking to !!Dimintheis??", line++)
line(player, "in east Varrock", line++)
line++
line(player, "To start this quest I require:", line++)
line(player, "!!40 Crafting??", line++, player.skills.getLevel(Skills.CRAFTING) >= 40)
line(player, "!!40 Smithing??", line++, player.skills.getLevel(Skills.SMITHING) >= 40)
line(player, "!!40 Mining??", line++, player.skills.getLevel(Skills.MINING) >= 40)
line(player, "!!59 Magic??", line++, player.skills.getLevel(Skills.MAGIC) >= 59)
}
if(stage >= 10){
line(player, "I have agreed to restore !!Dimintheis'?? family crest to him.", line++, stage >10)
line(player, "He has asked me to find his son Caleb for him", line++, stage >10)
}
if(stage >= 11){
line(player, "I found !!Caleb?? at his house?? in !!Catherby??", line++, stage >11)
line(player, "and told him of my Quest for his father to restore his Family Crest.", line++, stage >11)
line(player, "I gave !!Caleb?? the Swordfish, Bass, Tuna, Salmon and Shrimp he needed for his salad in return for his crest piece", line++, stage >11)
}
if(stage >=12){
line(player, "!!Caleb?? has told me to speak to the !!Gem trader??", line++, stage >12)
line(player, " in !!Al-Kharid?? to find his brother.", line++, stage >12)
}
if(stage >=13){
line(player, "I found !!Avan?? by some gold rocks North of !!Al Kharid??.", line++, stage >13)
}
if(stage >= 14){
line(player, "!!Avan?? has asked me to find the perfect gold, he has heard of a !!dwarf??", line++, stage >14)
line(player, "who might know where to get some", line++, stage >14)
}
if(stage >=15){
line(player, "I have spoken to !!Boot?? and he told me that ", line++, stage >15)
line(player, "i can find perfect gold in the !!Witchaven dungeons??", line++, stage >15)
}
if(stage >=16){
line(player, "!!Avan?? gave me his crest piece in return for a ruby ring ", line++, stage >16)
line(player, "and ruby necklace made of high quality 'perfect gold'.", line++, stage >16)
}
if(stage >= 17){
line(player, "I found !!Johnathon?? looking very ill at the !!Jolly Boar Inn??.", line++, stage >17)
}
if(stage >= 18){
line(player, "He soon recovered when I used an antipoison potion on him.", line++, stage >18)
}
if(stage >= 19){
line(player, "He has told me about the Demon !!Chronozon?? located in the !!Edgeville dungeon??", line++, stage > 19)
}
if(stage >= 20){
line(player, "I defeated the Demon !!Chronozon?? and obtained !!Johnathon??'s crest piece", line++, stage > 20)
}
if(stage == 100){
line(player, "I took all three pieces of the crest back to !!Dimintheis?? in !!Varrock??", line++)
line(player, "As a reward !!Dimintheis?? gave me some !!magical gauntlets?? ", line++)
line(player, "that could be enchanted by his sons", line++)
line(player, "to give them bonuses in specific skillss", line++)
line(player, "and would always return to !!Dimintheis??", line++)
line(player, "for me to reclaim if I ever lost them.", line++)
line++
line(player, "!!QUEST COMPLETE!??.", line++)
}
}
override fun hasRequirements(player: Player?): Boolean {
if (player != null) {
if (player.skills.getLevel(Skills.CRAFTING) < 40)
return false
if (player.skills.getLevel(Skills.SMITHING) < 40)
return false
if(player.skills.getLevel(Skills.MINING) < 40)
return false
if( player.skills.getLevel(Skills.MAGIC) < 59)
return false
return true
}
return false
}
override fun finish(player: Player?) {
super.finish(player)
player ?: return
var ln = 10
player.packetDispatch.sendItemZoomOnInterface(Items.COOKING_GAUNTLETS_775,230,277,5)
drawReward(player,"1 Quest Point",ln++)
drawReward(player,"Family Gauntlets",ln++)
drawReward(player,"A choice of special abilities for the gauntlets",ln++)
drawReward(player,"for the gauntlets",ln++)
if(!player.inventory.add(Item(Items.FAMILY_GAUNTLETS_778))){
GroundItemManager.create(Item(Items.FAMILY_GAUNTLETS_778),player)
}
}
/*override fun getConfig(player: Player?, stage: Int): IntArray {
if(stage == 100) return intArrayOf(1282, 90)
if(stage > 0) return intArrayOf(1282, 1)
else return intArrayOf(1282, 0)
}*/
}

View file

@ -0,0 +1,42 @@
package plugin.quest.members.familycrest
import core.game.interaction.NodeUsageEvent;
import core.game.interaction.UseWithHandler;
import core.game.node.entity.npc.NPC
import core.game.node.item.Item;
import core.plugin.Initializable
import core.plugin.Plugin;
@Initializable
class JohnathonAntiPosionInteraction: UseWithHandler(175, 177, 179, 2446 ) {
override fun newInstance(arg: Any?): Plugin<Any> {
addHandler(668, NPC_TYPE, this)
return this
}
override fun handle(event: NodeUsageEvent?): Boolean {
if (event != null) {
val qstage = event.player.questRepository.getQuest("Family Crest").getStage(event.player)
val itemUsed = event.usedItem.id
if(qstage == 17){
event.player.questRepository.getQuest("Family Crest").setStage(event.player, 18)
when(itemUsed){
2446 -> event.player.inventory.remove(Item(2446)).also{event.player.inventory.add(Item(175))}
175 -> event.player.inventory.remove(Item(175)).also{event.player.inventory.add(Item(177))}
177 -> event.player.inventory.remove(Item(177)).also{event.player.inventory.add(Item(179))}
179 -> event.player.inventory.remove(Item(179)).also{event.player.inventory.add(Item(229))}
}
event.player.getDialogueInterpreter().open(668, NPC(668))
}else{
event.player.sendMessage("Nothing interesting happened.")
}
}
return true;
}
}

View file

@ -0,0 +1,133 @@
package plugin.quest.members.familycrest
import core.game.content.dialogue.DialoguePlugin
import core.game.node.entity.npc.NPC
import core.game.node.entity.player.Player
import core.game.node.item.Item
import core.plugin.Initializable
@Initializable
class JohnathonDialogue(player: Player? = null): DialoguePlugin(player) {
val CREST_PIECE: Item = Item(781)
override fun newInstance(player: Player?): DialoguePlugin {
return JohnathonDialogue(player)
}
override fun open(vararg args: Any?): Boolean {
npc = (args[0] as NPC).getShownNPC(player)
val qstage = player?.questRepository?.getStage("Family Crest") ?: -1
if(qstage == 100){
options("Can you enchant these gauntlets for me?", "Nevermind")
stage = 6000
return true
}
if(qstage < 16){
npc("I dont feel so well... maybe we can talk later")
stage = 1000;
}
else{
when(qstage){
16 -> player("Greetings. Would you happen to be Johnathon Fitzharmon?").also { stage = 1}
17 -> npc("What... what did that spider... DO to me? " ,
"I... I feel so weak... " ,
"I can hardly... think at all...").also { stage = 1000 }
18 -> sendDialogue("You use the potion on Johnathon").also { stage = 100 }
19 -> player("I'm trying to kill this demon Chronozon that you mentioned...").also { stage = 200 }
}
}
return true
}
override fun handle(interfaceId: Int, buttonId: Int): Boolean {
when(stage){
1 -> npc("That... I am...").also { stage++ }
2 -> player("I am here to retrieve your fragment " ,
"of the Fitzharmon family crest.").also { stage++ }
3 -> npc("The... poison... it is all... " ,
"too much... My head... " ,
"will not... stop spinning...").also { stage++ }
4 -> sendDialogue("Sweat is pouring down Jonathons'face.").also { stage = 1000
player.questRepository.getQuest("Family Crest").setStage(player, 17);
}
100 -> npc("Ooooh... thank you... Wow! " ,
"I'm feeling a lot better now! " ,
"That potion really seems to have done the trick!").also{stage++}
101 -> npc("How can I reward you?").also { stage++ }
102 -> player("I've come here for your piece of the Fitzharmon family crest.").also { stage++}
103 -> npc("You have? Unfortunately I don't have it any more... " ,
"in my attempts to slay the fiendish Chronozon, the blood demon, " ,
"I lost a lot of equipment in our last battle when he " ,
"bested me and forced me away from his den. He probably still has it now.").also{
stage = 200
player.questRepository.getQuest("Family Crest").setStage(player, 19)
}
200 -> options("So is this Chronozon hard to defeat?", "Where can I find Chronozon?", "So how did you end up getting poisoned?", "I will be on my way now.").also{stage++}
201 -> when(buttonId){
1-> npc("Well... you will have to be a skilled Mage to defeat him, " ,
"and my powers are not good enough yet. " ,
"You will need to hit him once with each of the four " ,
"elemental spells of death before he will be defeated.").also{stage = 1000}
2->npc("The fiend has made his lair in Edgeville Dungeon. " ,
"When you come in down the ladder in Edgeville, follow" ,
"the corridor north until you reach a room with skeletons. " ,
"That passageway to the left will lead you to him.").also{stage = 1000}
3 -> npc("Those accursed poison spiders that surround " ,
"the entrance to Chronozon's lair... " ,
"I must have taken a nip from one of them " ,
"as I attempted to make my escape.").also{stage = 1000}
4 -> npc("My thanks for the assistance adventure").also{stage = 1000}
}
6000 -> when(buttonId){
1-> if(DoMissingGuantletCheck() != -1){
var gauntletID = DoMissingGuantletCheck()
if(gauntletID == 777){
npc("You already have the Chaos Guantlets.")
stage = 1000
}
else{
npc("Here you go")
player.inventory.remove(Item(gauntletID))
player.inventory.add(Item(777))
stage = 1000
}
}
else{
npc("You do not have the guantlets with you in your inventory")
stage = 1000
}
2-> player("Never mind").also{stage = 1000}
}
1000 -> end()
}
return true;
}
private fun DoMissingGuantletCheck(): Int{
var itemsToCheck = listOf(775, 776, 777, 778)
for(item in itemsToCheck){
if(player.inventory.containItems(item))
return item
}
return -1
}
override fun getIds(): IntArray {
return intArrayOf(668)
}
}

View file

@ -0,0 +1,42 @@
package plugin.quest.members.familycrest
import core.game.interaction.NodeUsageEvent
import core.game.interaction.UseWithHandler
import core.game.node.entity.skill.Skills
import core.game.node.item.Item
import core.game.system.task.Pulse
import rs09.game.world.World.Pulser
import core.plugin.Initializable
import core.plugin.Plugin
import org.rs09.consts.Items
@Initializable
class PerfectGoldSmeltingHandler : UseWithHandler(Items.PERFECT_GOLD_ORE_446){
val furnaceIDs = listOf(2349, 2351, 2353, 2359, 2361, 2363, 2366, 2368, 9467, 11286, 1540, 11710, 11712, 11714, 11666, 11686, 11688, 11692)
override fun newInstance(arg: Any?): Plugin<Any> {
for(furnaces in furnaceIDs){
addHandler(furnaces, OBJECT_TYPE, this)
}
return this
}
override fun handle(event: NodeUsageEvent?): Boolean {
event ?: return false
Pulser.submit(object : Pulse(2, event.player) {
override fun pulse(): Boolean {
event.player.inventory.remove(Item(446))
event.player.inventory.add(Item(2365))
event.player.skills.addExperience(Skills.SMITHING,22.5)
return true
}
})
return true
}
}

View file

@ -0,0 +1,64 @@
package plugin.quest.members.familycrest
import core.game.content.dialogue.DialogueInterpreter
import core.game.content.dialogue.DialoguePlugin
import core.game.node.entity.player.Player
import core.game.node.item.Item
import core.plugin.Initializable
@Initializable
class PerfectJewelryHandler (player: Player? = null): DialoguePlugin(player){
override fun newInstance(player: Player?): DialoguePlugin {
return PerfectJewelryHandler(player)
}
override fun open(vararg args: Any?): Boolean {
println(player.name)
if(player.inventory.containItems(2365, 1603)){
options("Craft perfect ruby ring", "Craft perfect ruby necklace")
stage = 1;
}
return true
}
override fun handle(interfaceId: Int, buttonId: Int): Boolean {
when(stage){
1-> when(buttonId){
1-> if(player.inventory.containItems(2365, 1603,1592)) {
player.inventory.remove(Item(2365), Item(1603))
player.inventory.add(Item(773))
sendDialogue("You made a perfect gold ring.")
stage = 1000
}
else{
sendDialogue("You do not have everything to make this item.")
stage = 1000;
}
2-> if(player.inventory.containItems(2365, 1603) && player.inventory.containItems(1597)){
player.inventory.remove(Item(2365), Item(1603))
player.inventory.add(Item(774))
sendDialogue("You made a perfect gold necklace.")
stage = 1000
}
else{
sendDialogue("You do not have everything to make this item.")
stage = 1000;
}
}
1000 -> end()
}
return true
}
override fun getIds(): IntArray {
return intArrayOf(DialogueInterpreter.getDialogueKey("perfect-jewelry"))
}
}

View file

@ -0,0 +1,28 @@
package plugin.quest.members.familycrest
import org.rs09.consts.Items
import core.game.interaction.NodeUsageEvent
import core.game.interaction.UseWithHandler
import core.plugin.Initializable
import core.plugin.Plugin
@Initializable
class PerfectJewelryOnUseHandler : UseWithHandler(Items.PERFECT_GOLD_BAR_2365){
val furnaceIDs = listOf(2349, 2351, 2353, 2359, 2361, 2363, 2366, 2368, 9467, 11286, 1540, 11710, 11712, 11714, 11666, 11686, 11688, 11692)
override fun newInstance(arg: Any?): Plugin<Any> {
for(furnaces in furnaceIDs){
addHandler(furnaces, OBJECT_TYPE, this)
}
return this
}
override fun handle(event: NodeUsageEvent?): Boolean {
event ?: return false
event.player.dialogueInterpreter.open("perfect-jewelry");
return true
}
}
//event.getPlayer().getDialogueInterpreter().open("perfect-jewelry");