1package com.runehive.content.skill.impl.slayer;
3import com.runehive.Config;
4import com.runehive.content.achievement.AchievementHandler;
5import com.runehive.content.achievement.AchievementKey;
6import com.runehive.content.skillcape.SkillCape;
7import com.runehive.content.store.StoreItem;
8import com.runehive.game.world.entity.mob.npc.Npc;
9import com.runehive.game.world.entity.mob.player.Player;
10import com.runehive.game.world.entity.mob.player.PlayerRight;
11import com.runehive.game.world.entity.skill.Skill;
12import com.runehive.game.world.items.Item;
13import com.runehive.net.packet.out.SendString;
14import com.runehive.util.Utility;
16import java.util.HashSet;
17import java.util.LinkedList;
55 private List<SlayerTask>
blocked =
new LinkedList<>();
68 player.attributes.set(
"SLAYER_KEY", tab);
75 player.message(
"You currently have a task assigned!");
81 if (toAssign ==
null) {
82 player.dialogueFactory.sendNpcChat(6797,
"There are no tasks available for you!",
"This can be because you do not have a valid",
"slayer level or you haven't unlocked any tasks.");
101 player.message(
"You have been assigned " +
amount +
"x " +
task.getName() +
".");
105 public boolean cancel(
boolean requiresCost) {
107 player.message(
"You do not have a task to cancel.");
114 player.message(
"You need " + cost +
" slayer points to cancel a task.");
123 player.message(
"Your task has been cancelled.");
130 player.message(
"You do not have a task to block.");
135 player.message(
"You need 100 slayer points to block a task.");
140 player.message(
"You can only block up to 5 tasks.");
145 player.message(
"This task is already blocked... but how did you get it again? mmm...");
155 player.message(
"Your task has been blocked.");
164 player.message(
"You have unblocked the task " +
task.getName() +
".");
167 player.message(
"There is no task to unblock.");
181 player.message(
"Congratulations, you have completed your assigned task! You have earned " + rewardPoints +
" slayer points!");
191 int index = Math.abs((-18625 - button) / 6);
195 player.attributes.set(
"SLAYER_CONFIRM_KEY", unlockable);
205 player.message(
"You do not have enough points to purchase this!");
209 if (
unlocked.contains(unlockable)) {
211 player.message(
"You have already activated this perk!");
217 player.message(
"You have purchased the " + unlockable.
getName() +
" Slayer perk.");
241 ITEMS[index] =
new Item(storeItem.getId(), storeItem.getAmount());
256 String price = cost == 0 ?
"is free!" :
"costs " +
Utility.
formatDigits(cost) +
" slayer points.";
261 if (
player.inventory.remaining() == 0) {
262 player.message(
"You do not have enough inventory space to buy that.");
274 int price = cost *
amount;
277 player.message(
"You do not have enough slayer points to make this purchase!");
283 player.inventory.add(item);
The class that contains setting-related constants for the server.
static final double SLAYER_MODIFICATION
The experience modification for Slayer.
Handles the achievements.
static void activate(Player player, AchievementKey achievement)
Activates the achievement for the individual player.
List< SlayerTask > blocked
The list of all blocked slayer tasks.
int totalCompleted
The total tasks completed.
void setTask(SlayerTask task)
void setAmount(int amount)
int totalAssigned
The total tasks assigned.
void store(int slot, int amount, boolean value)
Handles purchasing items from the slayer shop.
List< SlayerTask > getBlocked()
boolean cancel(boolean requiresCost)
Cancel's the current assigned slayer task.
Player player
The player instance.
int totalPoints
The total points accumulated.
Set< SlayerUnlockable > unlocked
The Set of all unlockable slayer perks.
void purchase()
Handles purchasing a slayer perk.
void open(SlayerTab tab)
Opens the slayer itemcontainer.
SlayerTask task
The slayer task.
void setUnlocked(Set< SlayerUnlockable > unlocked)
int assigned
The slayer task assigned amount.
void setTotalCompleted(int totalCompleted)
void setBlocked(List< SlayerTask > blocked)
Set< SlayerUnlockable > getUnlocked()
void confirm(int button)
Opens the confirm itemcontainer for purchasing a perk.
int amount
The current slayer task amount.
static final StoreItem[] STORE_ITEMS
void setPoints(int points)
void setTotalPoints(int totalPoints)
void activate(Npc npc, int killAmount)
Activates killing a slayer npc.
void setTotalAssigned(int totalAssigned)
Slayer(Player player)
Constructs a new Slayer.
int points
The slayer points.
void unblock(int index)
Unblocks the slayer task.
int totalCancelled
The total tasks cancelled.
void setTotalCancelled(int totalCancelled)
void assign(TaskDifficulty difficulty)
Assigns a slayer task to the player.
void block()
Blocks the current assigned slayer task.
void setAssigned(int assigned)
A simple wrapper class which holds extra attributes for the item object.
Represents a non-player character in the in-game world.
String getName()
Gets the name of this entity.
This class represents a character controlled by a player.
Represents a trainable and usable skill.
static final int SLAYER
The slayer skill id.
The container class that represents an item that can be interacted with.
final void setAmount(int amount)
Sets the quantity of this item.
final int getAmount()
Gets the quantity of this item.
The OutgoingPacket that sends a string to a Players itemcontainer in the client.
Handles miscellaneous methods.
static int random(int bound)
static String formatDigits(final int amount)
Formats digits for integers.
UNLOCK
The unlock itemcontainer - holds all the unlockable perks.
int getIdentification()
Gets the itemcontainer identification.
CONFIRM
The confirm itemcontainer - keeps player confirmation on purchase.
static void refresh(Player player, SlayerTab tab)
Refreshes the tab itemcontainer.
Holds all the slayer task data.
static int getPoints(TaskDifficulty difficulty)
TaskDifficulty getDifficulty()
Gets the difficulty of the slayer task.
static SlayerTask assign(Player player, TaskDifficulty difficulty)
Assigns a slayer task for the player.
static int getCompletionExperience(TaskDifficulty difficulty)
Holds all the unlockable slayer rewards and tasks.
String getName()
Gets a the unlockable name.
static Optional< SlayerUnlockable > get(int ordinal)
Gets the slayer unlockable data based on the ordinal.
int getCost()
Gets the unlockable cost.
The slayer task difficulties.
Holds all the player right data.
static boolean isDonator(Player player)
Checks if the player has donator status.