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,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 };
}
}
@@ -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 };
}
}
@@ -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 };
}
}
@@ -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;
}
}
@@ -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;}
}
}
@@ -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));
@@ -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<>();
@@ -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;
}
}
}