1package com.runehive.content.skill.impl.cooking;
3import com.runehive.Config;
4import com.runehive.content.activity.randomevent.RandomEventHandler;
5import com.runehive.content.dialogue.ChatBoxItemDialogue;
6import com.runehive.content.event.impl.ItemOnObjectInteractionEvent;
7import com.runehive.content.skillcape.SkillCape;
8import com.runehive.game.Animation;
9import com.runehive.game.action.Action;
10import com.runehive.game.action.policy.WalkablePolicy;
11import com.runehive.game.world.entity.mob.player.Player;
12import com.runehive.game.world.entity.skill.Skill;
13import com.runehive.game.world.items.Item;
14import com.runehive.game.world.items.ItemDefinition;
15import com.runehive.game.world.object.GameObject;
16import com.runehive.net.packet.out.SendInputAmount;
17import com.runehive.net.packet.out.SendMessage;
18import com.runehive.util.Utility;
20import java.util.Arrays;
29 private transient final String[]
objects = {
"range",
"fire",
"oven",
"stove",
"cooking range",
"fireplace" };
36 String name =
object.getDefinition().getName().toLowerCase();
37 return Arrays.stream(
objects).anyMatch(name::contains);
47 double burn_chance = (45.0 - burn_bonus);
49 double multi_a = ((double) noBurn - (double)
level);
50 double burn_dec = (burn_chance / multi_a);
51 double multi_b = (cook_level - (double)
level);
52 burn_chance -= (multi_b * burn_dec);
54 return burn_chance <= random_number;
64 Item item =
event.getItem();
93 public void firstOption(
Player player) {
98 public void secondOption(
Player player) {
103 public void thirdOption(
Player player) {
108 public void fourthOption(
Player player) {
121 protected void onSchedule() {
126 public void execute() {
134 player.
send(
new SendMessage(
"<col=369>You have run out of materials."));
144 player.
send(
new SendMessage(
"You successfully cook the " + name +
".",
true));
149 player.
send(
new SendMessage(
"You accidently burn the " + name +
".",
true));
152 if (++ticks == amount) {
158 protected void onCancel(
boolean logout) {
169 public boolean prioritized() {
The class that contains setting-related constants for the server.
static final double COOKING_MODIFICATION
The experience modification for cooking.
static void trigger(Player player)
static void sendInterface(Player player, int interfaceId, Item item, int zoom)
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.
Cooking(int level, double experience)
Action< Player > cook(Player player, CookData cook, int amount)
boolean cookableObject(GameObject object)
transient final String[] objects
boolean useItem(Player player, ItemOnObjectInteractionEvent event)
boolean success(Player player, int level, int noBurn)
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
void animate(int animation)
void resetFace()
Resets the mob's face location.
void activateSkilling(int amount)
This class represents a character controlled by a player.
final Inventory inventory
final Equipment equipment
DialogueFactory dialogueFactory
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 getLevel()
Gets the current skill level.
int level
The current level of the skill.
void setDoingSkill(boolean doingSkill)
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.
Skill get(int id)
Gets the skill for an id.
Represents all of an in-game Item's attributes.
static ItemDefinition get(int id)
Gets an item definition.
String getName()
Gets the item name.
The container class that represents an item that can be interacted with.
final int getId()
Gets the identification of this item.
final int computeAmountForId(int id)
Computes the total quantity of the Items in this container with id.
boolean remove(Item item)
Attempts to withdraw item from this container.
boolean add(Item item)
Attempts to deposit item into this container.
boolean contains(int id)
Determines if this container contains id.
boolean contains(int[] bowsWithNoArrowsRequired)
The OutgoingPacket that sends a message to a Players chatbox in the client.
Handles miscellaneous methods.
static int random(int bound)
static Optional< CookData > 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.
Represents a game object.