1package com.runehive.content.skill.impl;
3import com.google.common.base.Preconditions;
4import com.runehive.net.packet.out.SendMessage;
5import com.runehive.game.action.Action;
6import com.runehive.game.action.policy.WalkablePolicy;
7import com.runehive.game.world.entity.mob.Mob;
8import com.runehive.game.world.entity.mob.player.Player;
9import com.runehive.content.skill.SkillAction;
10import com.runehive.game.world.items.Item;
11import com.runehive.game.world.position.Position;
12import com.runehive.util.RandomGen;
13import com.runehive.util.StringUtils;
15import java.util.Optional;
111 if (
getMob().isPlayer()) {
113 if (
getMob().isPlayer() &&
getMob().getPlayer().inventory.remaining() < 1) {
114 getMob().getPlayer().send(
new SendMessage(
"You do not have any space left in your inventory."));
121 for (
Item item :
remove) {
138 double boost = (factor * 0.01);
143 if (
getMob().isPlayer()) {
SkillAction(Mob mob, Optional< Position > position, int delay, boolean instant)
Creates a new Action randomevent.
final Optional< Position > position
The position we should face.
abstract double experience()
The experience given from this action.
abstract int skill()
The skill we should hand to experience to.
boolean prioritized()
Determines if this action is prioritized.
static final int SUCCESS_FACTOR
The factor boost that determines the success rate for harvesting based on skill level.
WalkablePolicy getWalkablePolicy()
Gets the WalkablePolicy of this action.
abstract Item[] harvestItems()
The items to be harvested upon a successful harvest.
final boolean canRun()
Determines if the task can be ran.
DoubleReward doubleReward()
If mob will get a double onReward.
final RandomGen random
The random generator instance that will generate random numbers.
abstract Optional< Item[]> removeItems()
The items to be removed upon a successful harvest.
void onExecute()
The method which is called on intervals of the specified #delay;.
HarvestingSkillAction(Mob mob, Optional< Position > position, boolean instant)
Creates a new Action randomevent.
void onHarvest(Item[] items, boolean success)
The method executed upon harvest of the items.
abstract double successFactor()
The success factor for the harvest.
HarvestingSkillAction(Mob mob, Optional< Position > position, int delay, boolean instant)
Creates a new Action randomevent.
T getMob()
Gets the player.
final T mob
The Mob associated with this ActionEvent.
final boolean instant
If execution happens instantly upon being scheduled.
int delay
The cyclic delay.
This class represents a character controlled by a player.
final Inventory inventory
void send(OutgoingPacket encoder)
The container class that represents an item that can be interacted with.
boolean contains(int id)
Determines if this container contains id.
final boolean containsAll(int... identifiers)
Determines if this container contains all identifiers.
The OutgoingPacket that sends a message to a Players chatbox in the client.
The ThreadLocalRandom wrapper that provides additional functionality for generating pseudo-random num...
static String appendIndefiniteArticle(String thing)
Appends the determined indefinite article to thing.
The double onReward types.
A queue policy determines whether the action can occur while walking.
NON_WALKABLE
This indicates actions cannot occur while walking.