1package com.runehive.content.skill.impl.mining;
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.pet.PetData;
9import com.runehive.content.pet.Pets;
10import com.runehive.content.prestige.PrestigePerk;
11import com.runehive.content.skill.impl.smithing.SmeltingData;
12import com.runehive.content.skillcape.SkillCape;
13import com.runehive.game.Animation;
14import com.runehive.game.action.Action;
15import com.runehive.game.action.policy.WalkablePolicy;
16import com.runehive.game.task.impl.ObjectReplacementEvent;
17import com.runehive.game.world.World;
18import com.runehive.game.world.entity.mob.player.Player;
19import com.runehive.game.world.entity.skill.Skill;
20import com.runehive.game.world.items.Item;
21import com.runehive.game.world.items.containers.equipment.Equipment;
22import com.runehive.game.world.object.GameObject;
23import com.runehive.game.world.position.Area;
24import com.runehive.net.packet.out.SendMessage;
25import com.runehive.util.RandomUtils;
26import com.runehive.util.Utility;
38 super(player, 3,
false);
46 getMob().message(
"You need a pickaxe to mine this rock.");
50 if (
getMob().inventory.getFreeSlots() == 0) {
51 getMob().dialogueFactory.sendStatement(
"You can't carry anymore ore.").execute();
58 if (
object ==
null || !
object.active()) {
62 int harvest =
ore.ore;
63 boolean gem = harvest == -1;
73 if (harvest == 453 &&
getMob().inventory.contains(24480) &&
getMob().coalBag.container.hasCapacityFor(
new Item(harvest)))
74 getMob().coalBag.container.add(
new Item(harvest));
76 getMob().inventory.add(harvest, 1);
80 getMob().inventory.add(harvest, 1);
84 getMob().playerAssistant.activateSkilling(1);
94 getMob().inventory.addOrDrop(
new Item(harvest, 1));
99 int base_chance =
ore.ordinal() * 45;
100 int modified_chance = base_chance;
103 if (
getMob().inventory.getFreeSlots() != 0 && !gem) {
105 getMob().inventory.add(item);
113 getMob().resetAnimation();
114 object.getGenericAttributes().set(
"ores", -1);
118 object.getGenericAttributes().set(
"ores", ore.oreCount);
126 if (!
getMob().equipment.containsAny(25541, 25545)) {
130 if (
getMob().celestialRingCharges <= 0) {
131 getMob().equipment.replace(25541, 25539,
true);
136 if(oreId == 453 &&
getMob().inventory.contains(24480) &&
getMob().coalBag.container.hasCapacityFor(
new Item(oreId))) {
137 getMob().coalBag.container.add(
new Item(oreId));
139 getMob().inventory.add(oreId, 1);
142 getMob().message(
"You receive an additional ore from your Celestial ring.");
146 getMob().celestialRingCharges--;
156 if (!
object.getGenericAttributes().has(
"ores")) {
157 object.getGenericAttributes().set(
"ores",
ore.oreCount);
169 if (
object ==
null || !
object.active() ||
object.getGenericAttributes() ==
null) {
192 return "mining-action";
The class that contains setting-related constants for the server.
static final double MINING_MODIFICATION
The experience modification for mining.
static final double SMITHING_MODIFICATION
The experience modification for smithing.
Handles the achievements.
static void activate(Player player, AchievementKey achievement)
Activates the achievement for the individual player.
static void trigger(Player player)
Handles spawning, rewarding and picking up of pets.
static void onReward(Player player, int item, int chance)
Handles calculating the chance of a player receiving a skilling pet.
String getName()
Gets the name of this action.
WalkablePolicy getWalkablePolicy()
Gets the WalkablePolicy of this action.
boolean canSchedule()
A function executed on registration.
void onCancel(boolean logout)
A function executed on cancellation.
final PickaxeData pickaxe
void onSchedule()
A function executed on registration.
void execute()
A function representing the unit of work that will be carried out.
MiningAction(Player player, GameObject object, OreData ore, PickaxeData pickaxe)
void handleCelestialRing(int oreId)
Handles the mining skill.
static final Chance< Item > GEM_ITEMS
static boolean success(Player player, OreData ore, PickaxeData pickaxe)
Class that models a single animation used by an entity.
static final Animation RESET
T getMob()
Gets the player.
Action(T mob, int delay, boolean instant)
Creates a new Action randomevent.
synchronized final void cancel()
Cancels all subsequent executions.
An randomevent which replaces an object with another object.
Represents the game world.
static void schedule(Task task)
Submits a new event.
This class represents a character controlled by a player.
Represents a trainable and usable skill.
static final int SMITHING
The smithing skill id.
static final int MINING
The mining skill id.
The container class that represents an item that can be interacted with.
final int getId()
Gets the identification of this item.
The container that manages the equipment for a player.
static final int[] PICKAXES
Handles checking if mobs are in a certain area.
static boolean inRegularDonatorZone(Interactable entity)
static boolean inSuperDonatorZone(Interactable entity)
The OutgoingPacket that sends a message to a Players chatbox in the client.
A static-util class that provides additional functionality for generating pseudo-random numbers.
static boolean success(double value)
Determines if a pseudorandomly generated double rounded to two decimal places is below or equal to va...
Handles miscellaneous methods.
static int random(int bound)
static boolean hasOneOutOf(double chance)
static String getAOrAn(String nextWord)
A or an.
Handles the perk rewards from prestiging.
Represents types of axes.
The enumerated type whose elements represent definitions for each smeltable bar.
static SmeltingData getSmeltData(int itemId)
final Item[] produced
he produced items for smelting the required items.
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.