1package com.runehive.content.skill.impl.crafting;
3import com.runehive.Config;
4import com.runehive.content.skillcape.SkillCape;
5import com.runehive.content.activity.randomevent.RandomEventHandler;
6import com.runehive.content.store.Store;
7import com.runehive.net.packet.out.SendInputAmount;
8import com.runehive.net.packet.out.SendChatBoxInterface;
9import com.runehive.net.packet.out.SendItemOnInterfaceZoom;
10import com.runehive.net.packet.out.SendMessage;
11import com.runehive.net.packet.out.SendString;
12import com.runehive.game.Animation;
13import com.runehive.game.action.Action;
14import com.runehive.game.action.policy.WalkablePolicy;
15import com.runehive.game.world.entity.mob.player.Player;
16import com.runehive.content.event.impl.*;
17import com.runehive.content.skill.impl.crafting.impl.*;
18import com.runehive.game.world.entity.skill.Skill;
19import com.runehive.game.world.items.Item;
20import com.runehive.game.world.object.GameObject;
21import com.runehive.util.Utility;
23import java.util.HashMap;
36 private final static HashMap<Integer, Craftable>
CRAFTABLES =
new HashMap<>();
55 System.out.println(
"[Crafting] Conflicting item values: " + craftable.
getWith().
getId() +
" Type: " + craftable.
getName());
65 if (
event.getObject().getId() == 4309 &&
event.getOpcode() == 1) {
70 if (
event.getObject().getId() == 11601 &&
event.getOpcode() == 0) {
80 if (
event.getNpc().id == 5811) {
81 if (
event.getOpcode() == 0) {
83 }
else if (
event.getOpcode() == 1) {
94 Item item =
event.getItem();
97 if (
object.getId() == 16469 && (item.
getId() == 1783 || item.
getId() == 1781)) {
107 Item first =
event.getFirst();
108 Item second =
event.getSecond();
114 if (first.
getId() == 1785 && second.
getId() == 1775 || first.
getId() == 1775 && second.
getId() == 1785) {
119 if ((first.
getId() == 1733 && second.
getId() == 1741) || (first.
getId() == 1741 && second.
getId() == 1733)) {
127 if (craftable ==
null) {
181 player.
send(
new SendString(
"\\n \\n \\n \\n".concat(
"Body"), 8949));
182 player.
send(
new SendString(
"\\n \\n \\n \\n".concat(
"Chaps"), 8953));
183 player.
send(
new SendString(
"\\n \\n \\n \\n".concat(
"Vambraces"), 8957));
184 player.
send(
new SendString(
"\\n \\n \\n \\n".concat(
"Bandana"), 8961));
185 player.
send(
new SendString(
"\\n \\n \\n \\n".concat(
"Boots"), 8965));
208 int button =
event.getButton();
210 if (button == 2422) {
216 if ((
int) i[0] == button) {
239 start(player, craftable, 0, 1);
248 start(player, craftable, 0, 5);
257 start(player, craftable, 0, 10);
266 player.
send(
new SendInputAmount(
"Enter amount", 10, input ->
start(player, craftable, 0, Integer.parseInt(input))));
274 start(player, craftable, 1, 1);
282 start(player, craftable, 1, 5);
290 start(player, craftable, 1, 10);
298 player.
send(
new SendInputAmount(
"Enter amount", 10, input ->
start(player, craftable, 1, Integer.parseInt(input))));
305 start(player, craftable, 2, 1);
312 start(player, craftable, 2, 5);
319 start(player, craftable, 2, 10);
326 player.
send(
new SendInputAmount(
"Enter amount", 10, input ->
start(player, craftable, 2, Integer.parseInt(input))));
332 start(player, craftable, 3, 1);
338 start(player, craftable, 3, 5);
344 start(player, craftable, 3, 10);
350 player.
send(
new SendInputAmount(
"Enter amount", 10, input ->
start(player, craftable, 3, Integer.parseInt(input))));
355 start(player, craftable, 4, 1);
360 start(player, craftable, 4, 5);
365 start(player, craftable, 4, 10);
370 player.
send(
new SendInputAmount(
"Enter amount", 10, input ->
start(player, craftable, 4, Integer.parseInt(input))));
380 return start(player, craftable, index, amount);
384 if (craftable ==
null) {
402 String productAmount =
"";
404 if (product.
getName().contains(
"vamb")) {
405 productAmount =
" pair of";
406 }
else if (!product.
getName().endsWith(
"s")) {
410 player.
send(
new SendMessage(
"You need " + requiredItem.
getAmount() +
" piece" + (requiredItem.
getAmount() > 1 ?
"s" :
"") +
" of " + requiredItem.
getName().toLowerCase() +
" to make" + productAmount +
" " + product.
getName().toLowerCase() +
"."));
423 public void execute() {
443 if (++iterations == amount) {
450 player.
send(
new SendMessage(
"<col=369>You have run out of materials."));
461 public boolean prioritized() {
The class that contains setting-related constants for the server.
static final double CRAFTING_MODIFICATION
The experience modification for crafting.
static void trigger(Player player)
final DialogueFactory execute()
Retrieves the next dialogue in the chain and executes it.
final DialogueFactory sendStatement(String... lines)
Appends a StatementDialogue to the current dialogue chain.
int getLevel()
Gets the level required.
double getExperience()
Gets the experience rewarded.
Item getProduct()
Gets the product item.
Item getRequiredItem()
Gets the required items.
static void addCraftable(Craftable craftable)
static final HashMap< Integer, Craftable > CRAFTABLES
The craftable map.
boolean useItem(Player player, ItemOnItemInteractionEvent event)
static final String CRAFTABLE_KEY
The craftable key.
boolean clickNpc(Player player, NpcInteractionEvent event)
boolean clickObject(Player player, ObjectInteractionEvent event)
boolean start(Player player, Craftable craftable, int index, int amount)
Crafting(int level, double experience)
static final Object[][] LEATHER_ARMOR_IDS
The leather armour data.
boolean craft(Player player, int index, int amount)
boolean clickButton(Player player, ClickButtonInteractionEvent event)
boolean useItem(Player player, ItemOnObjectInteractionEvent event)
static Craftable getCraftable(int use, int with)
Action< Player > craft(Player player, Craftable craftable, CraftableItem item, int index, int amount)
Handles the glass crafting.
static boolean click(Player player, int button)
Handles clicking on the interface.
static void craft(Player player, GlassData glass, int amount)
Handles crafting the glass.
static void open(Player player)
Handles opening the glass crafting interface.
Handles crafting jewellery.
static void open(Player player)
Opens the jewellery creation itemcontainer.
Handles spinning items on the spinning wheel.
static void open(Player player)
Handles opening the spinning dialogue.
Handles stringing amulets.
static boolean useItem(Player player, Item used, Item with)
Handles using item.
Handles tanning leathers.
static boolean click(Player player, int button)
Handles clicking the tan buttons on the itemcontainer.
static void open(Player player)
Handles opening the tanning itemcontainer.
The class which holds support for further abstraction for shops.
static Map< String, Store > STORES
A mapping of each shop by it's name.
Class that models a single animation used by an entity.
Represents an action an entity can execute.
public< A extends Action<?> > void execute(A action)
final SkillManager skills
final GenericAttributes attributes
void animate(int animation)
void close(int interfaceId)
void open(int identification)
Opens an interface for the player.
void activateSkilling(int amount)
This class represents a character controlled by a player.
final Inventory inventory
void message(String message)
DialogueFactory dialogueFactory
final InterfaceManager interfaceManager
void send(OutgoingPacket encoder)
final PlayerAssistant playerAssistant
static String getName(int skill)
Gets the name for a skill id.
double experience
The current skill experience.
int level
The current level of the skill.
Skill(int skill, int level, double experience)
Constructs a new Skill.
void addExperience(int id, double experience)
Adds experience to a given skill.
int getLevel(int id)
Gets the level of a skill.
The container class that represents an item that can be interacted with.
final int getId()
Gets the identification of this item.
final int getAmount()
Gets the quantity of this item.
boolean equalIds(Item other)
final int computeAmountForId(int id)
Computes the total quantity of the Items in this container with id.
boolean removeAll(Collection<? extends Item > items)
Attempts to withdraw items in bulk from this container.
final boolean containsAll(int... identifiers)
Determines if this container contains all identifiers.
void addOrDrop(List< Item > items)
Attempts to deposit an item to the players inventory, if there is no space it'll bank the item instea...
Handles sending the SendItemOnInterfaceZoom packet.
The OutgoingPacket that sends a message to a Players chatbox in the client.
The OutgoingPacket that sends a string to a Players itemcontainer in the client.
Handles miscellaneous methods.
static int random(int bound)
static String getAOrAn(String nextWord)
A or an.
public< K, E > E get(K key)
Gets a generic attribute.
public< K > Object getObject(K key)
Gets a generic attribute.
public< K > void remove(K key)
Removes a generic attribute.
public< K, E > void set(K key, E attribute)
Sets a generic attribute.
public< K > boolean has(K key)
Checks if a key is in the list of generic attribute.
Holds all the glass data.
static boolean isEquipped(Player player, SkillCape cape)
A queue policy determines whether the action can occur while walking.
NON_WALKABLE
This indicates actions cannot occur while walking.
The craftable itemcontainer.
Item[] getIngredients(int index)
Gets the craftable ingredients.
Item getUse()
Gets the craftable used item.
CraftableItem[] getCraftableItems()
Gets the craftable items.
String getName()
Gets the craftable name.
String getProductionMessage()
Gets the craftable production message.
Item getWith()
Gets the craftable item used with.
int getAnimation()
Gets the craftable animation.
Represents a game object.