1package com.osroyale.content.skill.impl.crafting.impl;
3import com.osroyale.Config;
4import com.osroyale.net.packet.out.SendInputAmount;
5import com.osroyale.net.packet.out.SendMessage;
6import com.osroyale.game.action.Action;
7import com.osroyale.game.action.policy.WalkablePolicy;
8import com.osroyale.game.world.entity.mob.player.Player;
9import com.osroyale.content.dialogue.ChatBoxItemDialogue;
10import com.osroyale.game.world.entity.skill.Skill;
11import com.osroyale.game.world.items.Item;
12import com.osroyale.game.world.items.ItemDefinition;
13import com.osroyale.util.Utility;
15import java.util.Arrays;
16import java.util.Optional;
67 SAPPHIRE(1675, 1694, 24),
68 EMERALD(1677, 1696, 31),
70 DIAMOND(1681, 1700, 70),
71 DRAGONSTONE(1683, 1702, 80),
73 ZENYTE(19501, 19541, 98);
78 private final int ingredient;
83 private final int product;
88 private final int level;
98 this.ingredient = ingredient;
99 this.product = product;
109 public static Optional<AmuletData>
forAmulet(
int ingredient) {
110 return Arrays.stream(values()).filter(a -> a.ingredient == ingredient).findAny();
122 if (used.getId() != 1759 && with.getId() != 1759) {
126 Item wool = used.getId() == 1759 ? used : with;
127 Item amulet = wool.getId() == used.getId() ? with : used;
145 player.dialogueFactory.
clear();
148 player.dialogueFactory.
sendStatement(
"You need a crafting level of " + amulet.level +
" to string this!").
execute();
152 if (!player.inventory.
contains(amulet.ingredient) || !player.inventory.
contains(1759)) {
153 player.dialogueFactory.
sendStatement(
"You do not have the required items to do this!").
execute();
160 public void firstOption(
Player player) {
161 player.action.execute(
string(player, amulet, 1),
false);
165 public void secondOption(
Player player) {
166 player.action.execute(
string(player, amulet, 5),
true);
170 public void thirdOption(
Player player) {
171 player.send(
new SendInputAmount(
"Enter amount", 2, input -> player.action.execute(
string(player, amulet, Integer.parseInt(input)),
true)));
175 public void fourthOption(
Player player) {
176 player.action.execute(
string(player, amulet, 14),
true);
194 public void execute() {
195 if (!player.inventory.
contains(amulet.ingredient) || !player.inventory.
contains(1759)) {
201 player.inventory.
remove(amulet.ingredient, 1);
202 player.inventory.
remove(1759, 1);
203 player.inventory.
add(amulet.product, 1);
207 if (++ticks == amount) {
214 public String getName() {
219 public boolean prioritized() {
224 public WalkablePolicy getWalkablePolicy() {
225 return WalkablePolicy.NON_WALKABLE;
static final double CRAFTING_MODIFICATION
final DialogueFactory sendStatement(String... lines)
final DialogueFactory execute()
static void craft(Player player, AmuletData amulet)
static boolean useItem(Player player, Item used, Item with)
static final int CRAFTING
void addExperience(int id, double experience)
static ItemDefinition get(int id)
boolean remove(Item item)
static String getAOrAn(String nextWord)
AmuletData(int ingredient, int product, int level)
static Optional< AmuletData > forAmulet(int ingredient)