RuneHive-Game
Loading...
Searching...
No Matches
StarterKit.java
Go to the documentation of this file.
1package com.runehive.content;
2
3import com.runehive.game.world.entity.mob.UpdateFlag;
4import com.runehive.game.world.entity.mob.player.Player;
5import com.runehive.game.world.entity.mob.player.PlayerRight;
6import com.runehive.game.world.items.Item;
7import com.runehive.net.packet.out.SendConfig;
8import com.runehive.net.packet.out.SendItemOnInterface;
9import com.runehive.net.packet.out.SendRunEnergy;
10import com.runehive.net.packet.out.SendString;
11
12import java.util.Arrays;
13
14/**
15 * Handles the starter kits.
16 *
17 * @author Daniel
18 */
19public class StarterKit {
20 /** Handles opening the starter kit interface. */
21 public static void open(Player player) {
22 player.locking.lock();
23 refresh(player, KitData.NORMAL);
24 player.interfaceManager.open(45000);
25 }
26
27 /** Handles refreshing the starter kit interface. */
28 public static void refresh(Player player, StarterKit.KitData kit) {
29 player.attributes.set("STARTER_KEY", kit);
30 for (int index = 0, string = 45004; index < 4; index++, string += 1) {
31 String desc = index >= kit.getDescription().length ? "" : kit.getDescription()[index];
32 player.send(new SendString(desc, string));
33 }
34
35 player.equipment.clear();
36 player.movement.setRunningToggled(true);
37 player.send(new SendRunEnergy());
38 if (kit.equipment == null) {
39 player.equipment.clear();
41 } else {
42 Arrays.stream(kit.getEquipment()).forEach(player.equipment::manualWear);
43 }
44
45 player.equipment.refresh();
46 player.send(new SendConfig(1085, kit.ordinal()));
47 player.send(new SendItemOnInterface(45021, kit.getItems()));
48 }
49
50 /** Holds the starter kit data. */
51 public enum KitData {
52 NORMAL(PlayerRight.PLAYER, new String[]{
53 "Play osroyale as a casual player.",
54 "This game mode has no restrictions at all.",
55 "You will be given a pre-made bank containing welfare equipment."
56 }, null,
57 new Item(995, 100000)
58 ),
60 "Playing as an ironman will restrict you from trading, picking up drops from other",
61 "player's kills including pvp or if another player has dealt any damage to a npc,",
62 "access to certain shops, access from using the marketplace, and playing certain minigames",
63 "which include duel arena. You will have access to ironman armour and a distinct rank. "
64 }, new Item[]{new Item(12810), new Item(12812), new Item(12811), new Item(1277), new Item(1173), new Item(4119)},
65 new Item(995, 10000), new Item(1351, 1), new Item(590, 1), new Item(303, 1),
66 new Item(315, 1), new Item(1925, 1), new Item(1931, 1),
67 new Item(2309, 1), new Item(1265, 1), new Item(1205, 1),
68 new Item(1277, 1), new Item(1171, 1), new Item(841, 1),
69 new Item(882, 250), new Item(556, 250), new Item(558, 250),
70 new Item(555, 250), new Item(557, 250), new Item(559, 250)
71 ),
73 "In addition to all the regular ironman rules the following conditions apply as well:",
74 "The use of banking (they are still able to use noted items on bank booths to unnote them)",
75 "Keep any item on death nor use the Protect Item prayer ",
76 }, new Item[]{new Item(12813), new Item(12814), new Item(12815), new Item(1277), new Item(1173), new Item(4119)},
77 new Item(995, 10000), new Item(1351, 1), new Item(590, 1), new Item(303, 1),
78 new Item(315, 1), new Item(1925, 1), new Item(1931, 1),
79 new Item(2309, 1), new Item(1265, 1), new Item(1205, 1),
80 new Item(1277, 1), new Item(1171, 1), new Item(841, 1),
81 new Item(882, 250), new Item(556, 250), new Item(558, 250),
82 new Item(555, 250), new Item(557, 250), new Item(559, 250)
83 ),
85 "Hardcore Ironman players will only have one life, in addition to the standard restrictions",
86 "given to all ironmen. If a hardcore ironman dies, they will be converted to a Ironman",
87 "chat badge standard ironman. Safe deaths, such as those in minigames, will not cause",
88 "the player to become a standard ironman.",
89 }, new Item[]{new Item(20792), new Item(20794), new Item(20796), new Item(1277), new Item(1173), new Item(4119)},
90 new Item(995, 10000), new Item(1351, 1), new Item(590, 1), new Item(303, 1),
91 new Item(315, 1), new Item(1925, 1), new Item(1931, 1),
92 new Item(2309, 1), new Item(1265, 1), new Item(1205, 1),
93 new Item(1277, 1), new Item(1171, 1), new Item(841, 1),
94 new Item(882, 25), new Item(556, 25), new Item(558, 15),
95 new Item(555, 6), new Item(557, 4), new Item(559, 2)
96 );
97
98 /** The player right of the starter kit. */
99 private final PlayerRight right;
100
101 /** The starter kit description. */
102 private final String[] description;
103
104 /** The starter kit equipment items. */
105 private final Item[] equipment;
106
107 /** The starter kit items. */
108 private final Item[] items;
109
110 /** Constructs a new <code>KitData</code>. */
112 this.right = right;
113 this.description = description;
114 this.equipment = equipment;
115 this.items = items;
116 }
117
119 return right;
120 }
121
122 public String[] getDescription() {
123 return description;
124 }
125
126 public Item[] getEquipment() {
127 return equipment;
128 }
129
130 public Item[] getItems() {
131 return items;
132 }
133
134 }
135
136}
Handles the starter kits.
static void refresh(Player player, StarterKit.KitData kit)
Handles refreshing the starter kit interface.
static void open(Player player)
Handles opening the starter kit interface.
final EnumSet< UpdateFlag > updateFlags
Definition Mob.java:94
final GenericAttributes attributes
Definition Mob.java:95
void setRunningToggled(boolean runToggled)
Sets the run toggled flag.
Definition Movement.java:93
void open(int identification)
Opens an interface for the player.
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
void clear()
Removes all of the items from this container.
void refresh()
Forces a refresh of Equipment items to the EQUIPMENT_DISPLAY_ID widget.
The OutgoingPacket responsible for changing settings on a client.
The OutgoingPacket that sends a string to a Players itemcontainer in the client.
public< K, E > void set(K key, E attribute)
Sets a generic attribute.
Holds the starter kit data.
final Item[] equipment
The starter kit equipment items.
KitData(PlayerRight right, String[] description, Item[] equipment, Item... items)
Constructs a new KitData.
final Item[] items
The starter kit items.
final PlayerRight right
The player right of the starter kit.
final String[] description
The starter kit description.