1package com.runehive.content.activity.impl.duelarena;
3import com.google.common.collect.ImmutableSet;
4import com.runehive.content.activity.Activity;
5import com.runehive.game.world.entity.mob.player.Player;
6import com.runehive.game.world.items.Item;
7import com.runehive.game.world.items.ItemDefinition;
8import com.runehive.game.world.items.containers.equipment.Equipment;
9import com.runehive.net.packet.out.SendConfig;
10import com.runehive.net.packet.out.SendMessage;
11import com.runehive.net.packet.out.SendString;
12import com.runehive.net.packet.out.SendToggle;
14import java.util.EnumSet;
15import java.util.Optional;
22 player.
send(
new SendMessage(
"You must have at least one combat type checked."));
34 player.
send(
new SendMessage(
"You must have at least one combat type checked."));
39 player.
message(
"You can't have No Melee, No Magic, Nothing in your Right Hand, how would you fight?");
44 player.
send(
new SendMessage(
"You can't have No Forfeit and No Melee, you could run out of ammo."));
49 player.
send(
new SendMessage(
"You cannot select no melee when only fun weapons selected."));
54 player.
send(
new SendMessage(
"You cannot use whip and dragon dagger if melee is off."));
65 player.
send(
new SendMessage(
"You must have at least one combat type checked."));
70 player.
message(
"You can't have No Melee, No Magic, Nothing in your Right Hand, how would you fight?");
81 player.
send(
new SendMessage(
"You cannot select only fun weapons when no weapons selected."));
91 player.
send(
new SendMessage(
"You can't have No Forfeit and No Melee, you could run out of ammo."));
96 player.
send(
new SendMessage(
"You cannot have no-movement and obstacles on at the same time."));
109 player.
send(
new SendMessage(
"You cannot have no-movement and obstacles on at the same time."));
119 player.
send(
new SendMessage(
"You cannot have no-movement and obstacles on at the same time."));
123 player.
message(
"Obstacles are permanently disabled.");
126 player.
message(
"Obstacles are permanently disabled.");
134 player.
send(
new SendMessage(
"You cannot select only whip and dds when no weapons selected."));
138 player.
send(
new SendMessage(
"You cannot select only whip and dds when lock items is selected."));
148 player.
send(
new SendMessage(
"You cannot select lock items when only whip and dds is selected."));
162 player.
message(
"You can't have No Melee, No Magic, Nothing in your Right Hand, how would you fight?");
167 player.
send(
new SendMessage(
"You cannot select no weapons when only fun weapons selected."));
172 player.
send(
new SendMessage(
"You cannot select no weapons when only whip and dds only is selected."));
231 public static final ImmutableSet<DuelRule>
EQUIPMENT_RULES = ImmutableSet.of(
NO_HEAD,
NO_CAPE,
NO_NECKLACE,
NO_AMMO,
NO_WEAPON,
NO_BODY,
NO_SHIELD,
NO_LEGS,
NO_GLOVES,
NO_BOOTS,
NO_RINGS);
235 if (rules.getButtonId() ==
button) {
236 return Optional.of(rules);
239 return Optional.empty();
251 if (!
condition.canSelect(player, rules)) {
295 public boolean set(
Player player,
boolean showMessage) {
304 boolean meets =
condition.canSelect(player, rules);
311 player.send(
new SendMessage(
"You do not have enough inventory space."));
318 player.send(
new SendMessage(
"The other player does not have enough space."));
342 EnumSet<DuelRule> tempRules = EnumSet.copyOf(rules.
getFlags());
346 if (tempRules.contains(
DuelRule.NO_HEAD)) {
352 if (tempRules.contains(
DuelRule.NO_NECKLACE)) {
360 String name = item.
getName().toLowerCase();
362 if (tempRules.contains(
DuelRule.NO_WEAPON)) {
366 if (tempRules.contains(
DuelRule.ONLY_WHIP_DDS)) {
367 if (!(name.contains(
"whip") || name.contains(
"abyssal tentacle") || name.contains(
"dragon dagger"))) {
375 if (tempRules.contains(
DuelRule.NO_CAPE)) {
381 if (tempRules.contains(
DuelRule.NO_AMMO)) {
387 if (tempRules.contains(
DuelRule.NO_BODY)) {
392 if (tempRules.contains(
DuelRule.NO_SHIELD)) {
400 if (weapon !=
null) {
404 if (def !=
null && def.isTwoHanded()) {
412 if (tempRules.contains(
DuelRule.NO_LEGS)) {
418 if (tempRules.contains(
DuelRule.NO_GLOVES)) {
424 if (tempRules.contains(
DuelRule.NO_BOOTS)) {
430 if (tempRules.contains(
DuelRule.NO_RINGS)) {
A Activity object constructs an in-game activity and sequences it through the start() and finish() me...
static< T extends Activity > Optional< T > search(Player player, Class< T > clazz)
EnumSet< DuelRule > getFlags()
void alternate(DuelRule flag)
boolean contains(DuelRule rule)
This class represents a character controlled by a player.
final Inventory inventory
void message(String message)
final Equipment equipment
boolean equals(Object obj)
void send(OutgoingPacket encoder)
Represents all of an in-game Item's attributes.
static ItemDefinition get(int id)
Gets an item definition.
The container class that represents an item that can be interacted with.
final int getId()
Gets the identification of this item.
final Item get(int index)
Gets the Item located on index.
The container that manages the equipment for a player.
static final int CHEST_SLOT
static final int RING_SLOT
static final int AMULET_SLOT
static final int WEAPON_SLOT
static final int SHIELD_SLOT
static final int FEET_SLOT
static final int LEGS_SLOT
static final int ARROWS_SLOT
static final int HELM_SLOT
static final int HANDS_SLOT
static final int CAPE_SLOT
The OutgoingPacket responsible for changing settings on a client.
The OutgoingPacket that sends a message to a Players chatbox in the client.
The OutgoingPacket that sends a string to a Players itemcontainer in the client.
boolean canSet(Player player)
DuelRule(int button, int value, RuleCondition condition)
Creates a new DuelRule.
final int value
The value for the config.
static final ImmutableSet< DuelRule > EQUIPMENT_RULES
static Optional< DuelRule > forButton(int button)
DuelRule(int button, int value, int slot, RuleCondition condition)
Creates a new DuelRule.
static void validateEquipmentRules(Player player)
static void showRules(DuelArenaActivity activity, Player player, Player other)
static int inventorySlotsRequired(Player player, DuelRules rules, DuelRule rule)
final RuleCondition condition
The condition for this rule.
final int button
The button for this rule.
RuleCondition getCondition()
boolean canSelect(final Player player, final DuelRules rules)