32public class MiningAction
extends Action<Player> {
38 super(player, 3,
false);
41 this.pickaxe = pickaxe;
44 private boolean mine() {
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();
55 getMob().animate(pickaxe.animation);
58 if (
object ==
null || !
object.active()) {
62 int harvest = ore.ore;
63 boolean gem = harvest == -1;
66 harvest =
Mining.GEM_ITEMS.next().getId();
70 boolean combust = smeltingData !=
null && pickaxe == PickaxeData.INFERNO_ADZE &&
Utility.random(3) == 0;
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);
78 harvest = smeltingData.
produced[0].getId();
80 getMob().inventory.add(harvest, 1);
84 getMob().playerAssistant.activateSkilling(1);
94 getMob().inventory.addOrDrop(
new Item(harvest, 1));
97 if (!gem) { handleCelestialRing(harvest); }
99 int base_chance = ore.ordinal() * 45;
100 int modified_chance = base_chance;
102 if (
Utility.random(modified_chance) == 1) {
103 if (
getMob().inventory.getFreeSlots() != 0 && !gem) {
104 Item item =
Mining.GEM_ITEMS.next();
105 getMob().inventory.add(item);
111 if (
object.active() && (!ore.equals(
OreData.RUNE_ESSENCE) &&
Utility.random(8) <= 0 && !
Area.inSuperDonatorZone(
object) && !
Area.inRegularDonatorZone(
object))) {
113 getMob().resetAnimation();
114 object.getGenericAttributes().set(
"ores", -1);
118 object.getGenericAttributes().set(
"ores", ore.oreCount);
125 private void handleCelestialRing(
int oreId) {
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);
160 getMob().animate(pickaxe.animation);
169 if (
object ==
null || !
object.active() ||
object.getGenericAttributes() ==
null) {
192 return "mining-action";
static void activate(Player player, AchievementKey achievement)
static void onReward(Player player, int item, int chance)
WalkablePolicy getWalkablePolicy()
void onCancel(boolean logout)