80 private int totalAssigned;
83 private int totalCompleted;
86 private int totalCancelled;
89 private int totalPoints;
92 private List<SlayerTask> blocked =
new LinkedList<>();
95 private Set<SlayerUnlockable> unlocked =
new HashSet<>(
SlayerUnlockable.values().length);
105 player.attributes.set(
"SLAYER_KEY", tab);
112 player.message(
"You currently have a task assigned!");
118 if (toAssign ==
null) {
119 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.");
125 assignment =
Utility.random(35, 75);
127 assignment =
Utility.random(45, 80);
129 assignment =
Utility.random(60, 100);
131 assignment =
Utility.random(30, 50);
138 player.message(
"You have been assigned " + amount +
"x " + task.getName() +
".");
142 public boolean cancel(
boolean requiresCost) {
144 player.message(
"You do not have a task to cancel.");
151 player.message(
"You need " + cost +
" slayer points to cancel a task.");
160 player.message(
"Your task has been cancelled.");
167 player.message(
"You do not have a task to block.");
172 player.message(
"You need 100 slayer points to block a task.");
176 if (blocked.size() >= 5) {
177 player.message(
"You can only block up to 5 tasks.");
181 if (blocked.contains(task)) {
182 player.message(
"This task is already blocked... but how did you get it again? mmm...");
192 player.message(
"Your task has been blocked.");
197 if (!blocked.isEmpty() && index < blocked.size()) {
199 blocked.remove(task);
201 player.message(
"You have unblocked the task " + task.getName() +
".");
204 player.message(
"There is no task to unblock.");
209 if (task !=
null && task.valid(npc.
getName())) {
210 amount -= killAmount;
212 int rewardPoints =
SlayerTask.getPoints(task.getDifficulty());
213 points += rewardPoints;
218 player.message(
"Congratulations, you have completed your assigned task! You have earned " + rewardPoints +
" slayer points!");
228 int index = Math.abs((-18625 - button) / 6);
232 player.attributes.set(
"SLAYER_CONFIRM_KEY", unlockable);
240 if (points < unlockable.
getCost()) {
242 player.message(
"You do not have enough points to purchase this!");
246 if (unlocked.contains(unlockable)) {
248 player.message(
"You have already activated this perk!");
252 points -= unlockable.
getCost();
253 unlocked.add(unlockable);
254 player.message(
"You have purchased the " + unlockable.
getName() +
" Slayer perk.");
258 private final static StoreItem[] STORE_ITEMS = {
259 new StoreItem(4155, 1, 0),
260 new StoreItem(11941, 1, 150),
261 new StoreItem(11866, 1, 75),
262 new StoreItem(4166, 1, 5),
263 new StoreItem(4168, 1, 5),
264 new StoreItem(4164, 1, 5),
265 new StoreItem(4551, 1, 5),
266 new StoreItem(8901, 1, 200),
267 new StoreItem(10551, 1, 200),
268 new StoreItem(11738, 1, 25),
269 new StoreItem(13116, 1, 200),
270 new StoreItem(25781, 1, 200)
273 static Item[] ITEMS =
new Item[STORE_ITEMS.length];
277 for (StoreItem storeItem : STORE_ITEMS) {
278 ITEMS[index] =
new Item(storeItem.getId(), storeItem.getAmount());
284 public void store(
int slot,
int amount,
boolean value) {
285 if (slot < 0 && slot > STORE_ITEMS.length) {
289 StoreItem item = STORE_ITEMS[slot];
290 int cost = item.getShopValue();
293 String price = cost == 0 ?
"is free!" :
"costs " +
Utility.
formatDigits(cost) +
" slayer points.";
294 player.message(item.getName() +
" " + price);
298 if (player.inventory.remaining() == 0) {
299 player.message(
"You do not have enough inventory space to buy that.");
303 if (!item.isStackable()) {
304 if (amount > player.inventory.remaining()) {
305 amount = player.inventory.remaining();
308 amount *= item.getAmount();
311 int price = cost * amount;
313 if (getPoints() < price) {
314 player.message(
"You do not have enough slayer points to make this purchase!");
318 item.setAmount(amount);
320 player.inventory.add(item);
324 public int getPoints() {
328 public void setPoints(
int points) {
329 this.points = points;
332 public SlayerTask getTask() {
336 public void setTask(SlayerTask task) {
340 public int getAmount() {
344 public void setAmount(
int amount) {
345 this.amount = amount;
348 public int getAssigned() {
352 public void setAssigned(
int assigned) {
353 this.assigned = assigned;
356 public int getTotalAssigned() {
357 return totalAssigned;
360 public void setTotalAssigned(
int totalAssigned) {
361 this.totalAssigned = totalAssigned;
364 public int getTotalCompleted() {
365 return totalCompleted;
368 public void setTotalCompleted(
int totalCompleted) {
369 this.totalCompleted = totalCompleted;
372 public int getTotalCancelled() {
373 return totalCancelled;
376 public void setTotalCancelled(
int totalCancelled) {
377 this.totalCancelled = totalCancelled;
380 public int getTotalPoints() {
384 public void setTotalPoints(
int totalPoints) {
385 this.totalPoints = totalPoints;
388 public List<SlayerTask> getBlocked() {
392 public void setBlocked(List<SlayerTask> blocked) {
393 this.blocked = blocked;
396 public Set<SlayerUnlockable> getUnlocked() {
400 public void setUnlocked(Set<SlayerUnlockable> unlocked) {
401 this.unlocked = unlocked;
static void activate(Player player, AchievementKey achievement)
void assign(TaskDifficulty difficulty)
void activate(Npc npc, int killAmount)
boolean cancel(boolean requiresCost)
void store(int slot, int amount, boolean value)
static void refresh(Player player, SlayerTab tab)
TaskDifficulty getDifficulty()
static SlayerTask assign(Player player, TaskDifficulty difficulty)
static Optional< SlayerUnlockable > get(int ordinal)