1package com.runehive.content.combat.cannon;
3import com.runehive.game.world.items.Item;
4import com.runehive.game.world.position.Area;
5import com.runehive.net.packet.out.SendMessage;
6import com.runehive.game.Animation;
7import com.runehive.game.Projectile;
8import com.runehive.game.world.entity.mob.npc.Npc;
9import com.runehive.game.world.entity.mob.player.Player;
10import com.runehive.game.world.World;
11import com.runehive.game.world.region.Region;
12import com.runehive.util.Utility;
14import java.util.ArrayList;
15import java.util.HashMap;
56 if (
cannon.getStage().ordinal() != 0) {
57 player.
send(
new SendMessage(
"You have already started setting up a cannon!"));
62 if (other.getPosition().isWithinDistance(player.
getPosition(), 5)) {
63 player.
send(
new SendMessage(
"You are trying to build too close to another cannon!"));
86 if(
cannon.getAmmunition() != 0)
89 int[] ids = { 6, 8, 10, 12 };
90 for(
int index = 0; index < ids.length; index++)
110 if(
cannon.getAmmunition() != 0)
120 if(
cannon ==
null)
return;
123 if(
cannon.getAmmunition() != 0)
126 int[] ids = { 6, 8, 10, 12 };
127 for(
int index = 0; index < ids.length; index++)
152 int needed = 30 -
cannon.getAmmunition();
161 if (cannon_balls <= needed) {
163 player.
send(
new SendMessage(
"You load the last of your cannon balls"));
164 cannon.setAmmunition(
cannon.getAmmunition() + cannon_balls);
167 player.
send(
new SendMessage(
"You load " + needed +
" balls into the cannon."));
188 ArrayList<Npc> attack =
new ArrayList<>();
199 if (!npc.definition.isAttackable()) {
206 Npc[] npc =
new Npc[attack.size()];
208 for (
int i = 0; i < npc.
length; i++) {
209 npc[i] = attack.get(i);
216 switch (
cannon.getRotation()) {
Created by Daniel on 2017-12-12.
Handles the dwarf cannon.
static void test(Player player)
static void pickup(Player player)
static void load(Player player)
static Map< String, Cannon > ACTIVE_CANNONS
static Projectile getCannonFire()
static Npc[] getNpc(Cannon cannon)
static void empty(Player player)
static void rotate(Cannon cannon)
static void drop(Player player, Cannon cannon)
static void logout(Player player)
Class that models a single animation used by an entity.
void setStartHeight(int startHeight)
void setEndHeight(int endHeight)
Represents the game world.
static void schedule(Task task)
Submits a new event.
static MobList< Npc > getNpcs()
static void sendObjectAnimation(int animation, GameObject object)
Sends a world object animation.
void animate(int animation)
Represents a non-player character in the in-game world.
This class represents a character controlled by a player.
final Inventory inventory
String getName()
Gets the name of this entity.
void send(OutgoingPacket encoder)
The container class that represents an item that can be interacted with.
final int computeAmountForId(int id)
Computes the total quantity of the Items in this container with id.
boolean remove(Item item)
Attempts to withdraw item from this container.
boolean add(Item item)
Attempts to deposit item into this container.
boolean contains(int id)
Determines if this container contains id.
Handles checking if mobs are in a certain area.
static boolean inCatacombs(Interactable entity)
Represents a single region.
static final int VIEW_DISTANCE
The OutgoingPacket that sends a message to a Players chatbox in the client.
Handles miscellaneous methods.
static boolean withinDistance(Interactable source, Interactable target, int radius)