1package com.runehive.content.skill.impl.fletching;
3import com.runehive.Config;
4import com.runehive.content.achievement.AchievementHandler;
5import com.runehive.content.achievement.AchievementKey;
6import com.runehive.content.activity.randomevent.RandomEventHandler;
7import com.runehive.content.clanchannel.content.ClanTaskKey;
8import com.runehive.content.event.impl.ClickButtonInteractionEvent;
9import com.runehive.content.event.impl.ItemOnItemInteractionEvent;
10import com.runehive.content.skill.impl.firemaking.FiremakingData;
11import com.runehive.content.skill.impl.fletching.impl.Arrow;
12import com.runehive.content.skill.impl.fletching.impl.Carvable;
13import com.runehive.content.skill.impl.fletching.impl.Stringable;
14import com.runehive.content.skillcape.SkillCape;
15import com.runehive.game.Animation;
16import com.runehive.game.Graphic;
17import com.runehive.game.action.Action;
18import com.runehive.game.action.policy.WalkablePolicy;
19import com.runehive.game.world.entity.mob.player.Player;
20import com.runehive.game.world.entity.skill.Skill;
21import com.runehive.game.world.items.Item;
22import com.runehive.net.packet.out.*;
23import com.runehive.util.Utility;
24import org.apache.logging.log4j.LogManager;
25import org.apache.logging.log4j.Logger;
27import java.util.HashMap;
40 private final static HashMap<Integer, Fletchable>
FLETCHABLES =
new HashMap<>();
48 System.out.println(
"[Fletching] Conflicting item values: " + fletchable.
getWith().
getId() +
" Type: " + fletchable.getClass().getSimpleName());
63 Item first =
event.getFirst();
64 Item second =
event.getSecond();
72 if (fletchable ==
null || first.
getId() == 590 || second.
getId() == 590 || first.
getId() == 8792 || second.
getId() == 8792) {
95 player.
send(
new SendString(
"\\n \\n \\n \\n".concat(prefix +
" Short Bow"), 8874));
96 player.
send(
new SendString(
"\\n \\n \\n \\n".concat(prefix +
" Long Bow"), 8878));
104 player.
send(
new SendString(
"\\n \\n \\n \\n".concat(
"Arrow heads"), 8889));
105 player.
send(
new SendString(
"\\n \\n \\n \\n".concat(prefix +
" Short Bow"), 8893));
106 player.
send(
new SendString(
"\\n \\n \\n \\n".concat(prefix +
" Long Bow"), 8897));
116 String[] productNames;
118 productNames =
new String[]{
"Arrowtips",
"Bolt tips",
"Javelin heads",
"Dart tips"};
120 productNames =
new String[]{
"Arrow Shafts",
"Short Bow",
"Long Bow",
"Crossbow Stock"};
123 player.
send(
new SendString(
"\\n \\n \\n \\n".concat(productNames[0]), 8909));
124 player.
send(
new SendString(
"\\n \\n \\n \\n".concat(productNames[1]), 8913));
125 player.
send(
new SendString(
"\\n \\n \\n \\n".concat(productNames[2]), 8917));
126 player.
send(
new SendString(
"\\n \\n \\n \\n".concat(productNames[3]), 8921));
142 int button =
event.getButton();
148 start(player, fletchable, 0, 15);
156 start(player, fletchable, 0, 1);
164 start(player, fletchable, 0, 5);
171 start(player, fletchable, 0, 10);
183 start(player, fletchable, 0, Integer.parseInt(input))));
185 }
catch (Exception ex) {
186 logger.error(String.format(
"player=%s error fletching option1: make-x", player.
getName()), ex);
194 start(player, fletchable, 1, 1);
201 start(player, fletchable, 1, 5);
208 start(player, fletchable, 1, 10);
216 player.
send(
new SendInputAmount(
"Enter amount", 2, input ->
start(player, fletchable, 1, Integer.parseInt(input))));
217 }
catch (Exception ex) {
218 logger.error(String.format(
"player=%s error fletching option2: make-x", player.
getName()), ex);
225 start(player, fletchable, 2, 1);
231 start(player, fletchable, 2, 5);
237 start(player, fletchable, 2, 10);
244 player.
send(
new SendInputAmount(
"Enter amount", 2, input ->
start(player, fletchable, 2, Integer.parseInt(input))));
245 }
catch (Exception ex) {
246 logger.error(String.format(
"player=%s error fletching option3: make-x", player.
getName()), ex);
252 start(player, fletchable, 3, 1);
257 start(player, fletchable, 3, 5);
262 start(player, fletchable, 3, 10);
269 player.
send(
new SendInputAmount(
"Enter amount", 2, input ->
start(player, fletchable, 3, Integer.parseInt(input))));
270 }
catch (Exception ex) {
271 logger.error(String.format(
"player=%s error fletching option3: make-x", player.
getName()), ex);
283 if (fletchable ==
null) {
287 return start(player, fletchable, index, amount);
292 if (fletchable ==
null) {
306 String firstName = fletchable.
getUse().
getName().toLowerCase();
310 firstName = firstName.concat(
"s");
314 secondName = secondName.concat(
"s");
318 firstName = firstName.substring(0, firstName.length() - 1);
322 secondName = secondName.substring(0, secondName.length() - 1);
325 final String firstAmount;
333 final String secondAmount;
341 String firstRequirement = firstAmount +
" " + firstName;
342 String secondRequirement = secondAmount +
" " + secondName;
343 player.
send(
new SendMessage(
"You need " + firstRequirement +
" and " + secondRequirement +
" to do that."));
356 public void execute() {
384 }
else if (fletchable instanceof
Arrow) {
391 player.
send(
new SendMessage(
"<col=369>You have run out of materials."));
404 public boolean prioritized() {
The class that contains setting-related constants for the server.
static final double FLETCHING_MODIFICATION
The experience modification for fletching.
Handles the achievements.
static void activate(Player player, AchievementKey achievement)
Activates the achievement for the individual player.
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.
static final String FLETCHABLE_KEY
static final Logger logger
Fletchable getFletchable(int use, int with)
boolean useItem(Player player, ItemOnItemInteractionEvent event)
boolean clickButton(Player player, ClickButtonInteractionEvent event)
boolean fletch(Player player, int index, int amount)
Action< Player > fletch(Player player, Fletchable fletchable, FletchableItem item, int amount)
Fletching(int level, double experience)
boolean start(Player player, Fletchable fletchable, int index, int amount)
static void addFletchable(Fletchable fletchable)
static final HashMap< Integer, Fletchable > FLETCHABLES
Class that models a single animation used by an entity.
Represents a single graphic that can be used by entities.
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)
Optional< Graphic > graphic
void close(int interfaceId)
void activateSkilling(int amount)
This class represents a character controlled by a player.
final Inventory inventory
void message(String message)
String getName()
Gets the name of this entity.
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)
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 > void remove(K key)
Removes a generic attribute.
public< K, E > void set(K key, E attribute)
Sets a generic attribute.
static Optional< FiremakingData > forId(int id)
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.
FletchableItem[] getFletchableItems()
String getProductionMessage()