RuneHive-Game
Loading...
Searching...
No Matches
DuelUtils.java
Go to the documentation of this file.
1package com.runehive.content.activity.impl.duelarena;
2
3import com.runehive.game.world.entity.mob.player.Player;
4import com.runehive.game.world.items.Item;
5
6public final class DuelUtils {
7
8 private DuelUtils() {
9
10 }
11
12 public static boolean hasFunWeapon(Player player, Item item) {
13 if (item == null) {
14 return false;
15 }
16
17 if (item.getName() == null) {
18 return false;
19 }
20
21 final String name = item.getName().toLowerCase();
22
23 return name.equals("fixed device") || name.contains("flowers") || name.equals("gnomeball") || name.equals("mouse toy") || name.equals("noose wand") || name.equals("pet rock") || name.equals("rat pole")
24 || name.equals("rubber chicken") || name.equals("scythe") || name.equals("snowball") || name.equals("trollweiss") || name.equals("undead chicken") || name.equals("large spade") || name.equals("stale baguette")
25 || name.equals("hunting knife") || name.equals("giant present") || name.equals("hand fan");
26 }
27
28 public static String getRuleText(DuelRule rule) {
29 switch(rule) {
30 case LOCK_ITEMS:
31 return "You can not switch items.";
32 case NO_RANGED:
33 return "You can not use ranged attacks.";
34 case NO_MELEE:
35 return "You can not use melee attacks.";
36 case NO_MAGIC:
37 return "You can not use magic attacks.";
38 case NO_SPECIAL_ATTACK:
39 return "You can not use special attacks.";
40 case ONLY_FUN_WEAPONS:
41 return "You can only attack with `fun` weapons.";
42 case NO_FORFEIT:
43 return "You can not forfeit the duel.";
44 case NO_PRAYER:
45 return "You can not use prayer.";
46 case NO_DRINKS:
47 return "You can not use drinks.";
48 case NO_FOOD:
49 return "You can not use food.";
50 case NO_MOVEMENT:
51 return "You can not move during the duel.";
52 case OBSTACLES:
53 return "There will be obsticals in the arena.";
54 case ONLY_WHIP_DDS:
55 return "You can only use whips and dragon daggers.";
56 case NO_HEAD:
57 return "You can not wear items on your head.";
58 case NO_CAPE:
59 return "You can not wear items on your back.";
60 case NO_NECKLACE:
61 return "You can not wear items on your neck.";
62 case NO_AMMO:
63 return "You can not wear items in your quiver.";
64 case NO_WEAPON:
65 return "You can not wield weapons.";
66 case NO_BODY:
67 return "You can not wear items on your chest.";
68 case NO_SHIELD:
69 return "You can not use shields or 2h swords.";
70 case NO_LEGS:
71 return "You can not wear items on your legs.";
72 case NO_GLOVES:
73 return "You can not wear items on your hands.";
74 case NO_BOOTS:
75 return "You can not wear items on your feet.";
76 case NO_RINGS:
77 return "You can not wear items on your fingers.";
78 }
79 return "";
80 }
81
82 public static String getItemNames(Item[] items) {
83 final StringBuilder builder = new StringBuilder();
84 for (int i = 0; i < items.length; i++) {
85 Item item = items[i];
86
87 if (item == null) {
88 continue;
89 }
90
91 builder.append("<col=ff9040>").append(item.getName()).append("<col=ffffff>").append(" x ").append(item.getAmount());
92
93 if (i < items.length - 1) {
94 builder.append("\\n");
95 }
96
97 }
98 final String result = builder.toString();
99 return result.isEmpty() ? "<col=ff9040>Absolutely nothing!" : result;
100 }
101
102}
static boolean hasFunWeapon(Player player, Item item)
This class represents a character controlled by a player.
Definition Player.java:125
The container class that represents an item that can be interacted with.
Definition Item.java:21
final int getAmount()
Gets the quantity of this item.
Definition Item.java:342