1package com.osroyale.content.activity.impl.warriorguild;
3import com.osroyale.Config;
4import com.osroyale.content.activity.Activity;
5import com.osroyale.content.activity.ActivityDeathType;
6import com.osroyale.content.activity.ActivityType;
7import com.osroyale.content.activity.panel.ActivityPanel;
8import com.osroyale.content.collectionlog.CollectionLog;
9import com.osroyale.content.collectionlog.CollectionLogData;
10import com.osroyale.content.dialogue.impl.KamfreenaDialogue;
11import com.osroyale.content.event.impl.ItemOnObjectInteractionEvent;
12import com.osroyale.content.event.impl.NpcInteractionEvent;
13import com.osroyale.content.event.impl.ObjectInteractionEvent;
14import com.osroyale.content.event.impl.PickupItemInteractionEvent;
15import com.osroyale.content.skillcape.SkillCape;
16import com.osroyale.content.store.Store;
17import com.osroyale.game.Animation;
18import com.osroyale.game.UpdatePriority;
19import com.osroyale.game.task.Task;
20import com.osroyale.game.task.impl.WarriorGuildCyclopEvent;
21import com.osroyale.game.world.World;
22import com.osroyale.game.world.entity.mob.Mob;
23import com.osroyale.game.world.entity.mob.data.LockType;
24import com.osroyale.game.world.entity.mob.npc.Npc;
25import com.osroyale.game.world.entity.mob.npc.NpcDeath;
26import com.osroyale.game.world.entity.mob.player.Player;
27import com.osroyale.game.world.items.Item;
28import com.osroyale.game.world.position.Area;
29import com.osroyale.game.world.position.Position;
30import com.osroyale.net.packet.out.SendEntityHintArrow;
31import com.osroyale.net.packet.out.SendMessage;
32import com.osroyale.util.Utility;
34import java.util.Optional;
74* This
class handles the warrior's guild activity.
81 private final Player player;
95 private WarriorGuild(
Player player) {
96 super(3,
Mob.DEFAULT_INSTANCE);
102 WarriorGuild minigame =
new WarriorGuild(player);
104 minigame.
add(player);
119 animated.owner = player;
120 animated.setVisible(
false);
124 player.locking.lock(
LockType.MASTER_WITH_MOVEMENT);
134 protected void execute() {
136 player.animate(
new Animation(827, UpdatePriority.HIGH));
137 player.send(
new SendMessage(
"You place the armour pieces inside the animator..."));
138 }
else if (count == 2) {
139 player.send(
new SendMessage(
"The animator begins to hum, something appears to be working..."));
141 }
else if (count == 7) {
142 animated.setVisible(
true);
143 animated.animate(4166);
144 animated.
speak(
"I'M ALIVE!");
146 player.
face(animated);
147 player.send(
new SendEntityHintArrow(animated));
148 player.send(
new SendMessage(
"The animated armour comes to life!"));
155 protected void onCancel(
boolean logout) {
156 player.blockFace =
false;
158 player.movement.
reset();
178 if (animated !=
null) {
185 int object =
event.getObject().getId();
186 if (
object == 16671) {
190 if (
object == 24303) {
194 if (
object == 24306 ||
object == 24309) {
195 if (
state == WarriorGuildState.ANIMATOR) {
196 if (!SkillCape.isEquipped(player, SkillCape.ATTACK)) {
197 if (!player.inventory.
contains(
new Item(8851, 25))) {
198 player.dialogueFactory.
sendStatement(
"You need at least 25 warrior guild tokens to enter.").
execute();
202 player.inventory.
remove(
new Item(8851, 25));
203 state = WarriorGuildState.CYCLOPS;
206 }
else if (
state == WarriorGuildState.CYCLOPS) {
207 player.
move(
new Position(player.
getX() - 2, player.
getY(), 2));
208 state = WarriorGuildState.ANIMATOR;
216 protected boolean clickNpc(Player player, NpcInteractionEvent event) {
217 int npc =
event.getNpc().id;
219 player.dialogueFactory.sendDialogue(
new KamfreenaDialogue());
223 Store.STORES.get(
"Shanomi's Armour Store").open(player);
230 protected boolean useItem(Player player, ItemOnObjectInteractionEvent event) {
231 if (animated !=
null) {
232 player.dialogueFactory.sendStatement(
"You already have an animated armour spawned!").execute();
236 int object =
event.getObject().getId();
238 if (
object != 23955) {
242 Item used =
event.getItem();
243 int armourIndex = WarriorGuildUtility.contains(player, used.getId());
245 if (armourIndex == -1) {
249 Optional<AnimatorData> animator = AnimatorData.
getAnimator(event.getObject().getPosition());
251 if (!animator.isPresent()) {
255 if (!player.getPosition().equals(animator.get().standPosition)) {
256 player.dialogueFactory.sendStatement(
"Please stand in front of the animator!").execute();
260 summon(armourIndex, animator.get());
265 protected boolean pickupItem(Player player, PickupItemInteractionEvent event) {
266 if (WarriorGuildUtility.getDefender(player) == event.getItem().getId()) {
267 player.pickup(event.getItem(), event.getPosition());
268 CollectionLog.logItem(player, CollectionLogData.WARRIORS_GUILD, item.getId(), 1);
277 player.move(
new Position(2846, 3540, 2));
284 if (!
Area.inWarriorGuild(player)) {
285 if (animated !=
null) {
286 player.send(
new SendMessage(
"The animated armour vanishes as you have leave the region, taking your armour"));
315 ActivityPanel.
update(player, progress,
"Warrior Guild", defender,
"Cyclops will be dropping:",
"<col=FF5500>" + defender.getName(),
"Chance: <col=FF5500>1/20</col>");
335 return Optional.of(listener);
static final Position DEFAULT_POSITION
Activity(int cooldown, int instance)
void onRegionChange(Player player)
void onLogout(Player player)
Optional< WarriorGuildActivityListener > getListener()
boolean canTeleport(Player player)
static WarriorGuild create(Player player)
static int getDefender(Player player)
static void clear(Player player)
static void update(Player player, int amount, String title, String footer, String... strings)
final DialogueFactory sendStatement(String... lines)
final DialogueFactory execute()
static void schedule(Task task)
void move(Position position)
void face(GameObject object)
void speak(String forceChat)
boolean isRunningToggled()
void setRunningToggled(boolean runToggled)
Combat< Npc > getCombat()
boolean remove(Item item)
static double getPercentageAmount(int progress, int total)
final Position objectPosition
final Position walkToPosition
static Optional< AnimatorData > getAnimator(Position position)