RuneHive-Tarnish
Neural OSRS Enhancement Framework
Loading...
Searching...
No Matches
WarriorGuildCyclopEvent.java
1package com.osroyale.game.task.impl;
2
3import com.osroyale.game.task.Task;
4import com.osroyale.net.packet.out.SendMessage;
5import com.osroyale.game.world.entity.mob.player.Player;
6import com.osroyale.game.world.items.Item;
7import com.osroyale.game.world.position.Area;
8import com.osroyale.game.world.position.Position;
9
41
42public class WarriorGuildCyclopEvent extends Task {
43
45 private final Player player;
46
49 super(50);
50 this.player = player;
51 this.attach(player);
52 }
53
54 @Override
55 protected boolean canSchedule() {
56 return !player.warriorGuidTask;
57 }
58
59 @Override
60 protected void onSchedule() {
61 player.warriorGuidTask = true;
62 }
63
64 @Override
65 protected void onCancel(boolean logout) {
66 player.warriorGuidTask = false;
67 }
68
69 @Override
70 public void execute() {
71 if (player.isDead() || !player.isValid() || !player.inActivity() || !Area.inCyclops(player)) {
72 cancel();
73 return;
74 }
75
76 if (!player.inventory.contains(new Item(8851, 10))) {
77 if (Area.inCyclops(player)) {
78 player.move(new Position(2846, 3540, 2));
79 }
80 player.dialogueFactory.sendStatement("You have been removed from the Cyclops", "room as you have run out of tokens.").execute();
81 cancel();
82 return;
83 }
84
85 player.inventory.remove(new Item(8851, 10));
86 player.message("10 tokens have been removed from your inventory.");
87
88 if (!player.inventory.contains(new Item(8851, 10))) {
89 if (Area.inCyclops(player)) {
90 player.move(new Position(2846, 3540, 2));
91 }
92 player.dialogueFactory.sendStatement("You have been removed from the Cyclops", "room as you have run out of tokens.").execute();
93 }
94 }
95}
synchronized final void cancel()
Definition Task.java:147
Task attach(Object newKey)
Definition Task.java:182
Task(boolean instant, int delay)
Definition Task.java:75