RuneHive-Game
Loading...
Searching...
No Matches
ActivityPanel.java
Go to the documentation of this file.
1package com.runehive.content.activity.panel;
2
3
4import com.runehive.Config;
5import com.runehive.game.world.World;
6import com.runehive.game.world.entity.mob.player.Player;
7import com.runehive.game.world.items.Item;
8import com.runehive.net.packet.out.SendForceTab;
9import com.runehive.net.packet.out.SendItemOnInterface;
10import com.runehive.net.packet.out.SendProgressBar;
11import com.runehive.net.packet.out.SendString;
12
13/**
14 * Handles the activity panel.
15 *
16 * @author Daniel.
17 */
18public class ActivityPanel {
19 /** Sends all the information for the activity panel. */
20 public static void update(Player player, int amount, String title, String footer, String... strings) {
21 update(player, amount, title, footer, new Item[]{}, strings);
22 }
23
24 /** Sends all the information for the activity panel. */
25 public static void update(Player player, int amount, String title, Item item, String... strings) {
26 update(player, amount, title, "Activity Completion:", new Item[]{item}, strings);
27 }
28
29 /** Sends all the information for the activity panel. */
30 public static void update(Player player, int amount, String header, String footer, Item container, String... strings) {
31 update(player, amount, header, footer, new Item[]{container}, strings);
32 }
33
34 /** Sends all the information for the activity panel. */
35 public static void update(Activity_Panel panel) {
36 update(panel.getPlayer(), panel.getProgress(), panel.getHeader(), panel.getFooter(), new Item[]{panel.getItem()}, panel.getText());
37 }
38
39 /** Sends all the information for the activity panel. */
40 public static void update(Player player, int amount, String header, String footer, Item[] container, String... strings) {
42 if (!player.interfaceManager.isSidebar(Config.ACTIVITY_TAB, 38000)) {
44 }
45 for (int index = 0, string = 38005; index < strings.length; index++, string += 1) {
46 player.send(new SendString(strings[index], string));
47 }
48 if (container != null) {
49 player.send(new SendItemOnInterface(38016, container));
50 }
51 player.send(new SendString(header, 38003));
52 player.send(new SendProgressBar(38015, amount));
53 player.send(new SendString(amount == -1 ? "" : footer, 38004));
54 }
55
56 /** Clears the activity panel. */
57 public static void clear(Player player) {
58 player.send(new SendItemOnInterface(38016));
59 player.send(new SendString("", 38003));
60 player.send(new SendString("", 38004));
61 player.send(new SendString("", 38005));
62 player.send(new SendString("", 38006));
63 player.send(new SendString("", 38007));
64 player.send(new SendString("", 38008));
65 player.send(new SendProgressBar(38008, -1));
68 }
69
70 /** Clears the activity panel after a defined set of time. */
71 public static void timedClear(Player player, int delay) {
72 World.schedule(delay, () -> clear(player));
73 }
74}
The class that contains setting-related constants for the server.
Definition Config.java:24
static final int ACTIVITY_TAB
Definition Config.java:194
static final int INVENTORY_TAB
Definition Config.java:194
static void timedClear(Player player, int delay)
Clears the activity panel after a defined set of time.
static void update(Player player, int amount, String header, String footer, Item[] container, String... strings)
Sends all the information for the activity panel.
static void update(Player player, int amount, String title, String footer, String... strings)
Sends all the information for the activity panel.
static void update(Player player, int amount, String header, String footer, Item container, String... strings)
Sends all the information for the activity panel.
static void clear(Player player)
Clears the activity panel.
static void update(Player player, int amount, String title, Item item, String... strings)
Sends all the information for the activity panel.
static void update(Activity_Panel panel)
Sends all the information for the activity panel.
Represents the game world.
Definition World.java:46
static void schedule(Task task)
Submits a new event.
Definition World.java:247
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
Handles sending the progress bar data to the client.
The OutgoingPacket that sends a string to a Players itemcontainer in the client.