RuneHive-Game
Loading...
Searching...
No Matches
Activity_Panel.java
Go to the documentation of this file.
1package com.runehive.content.activity.panel;
2
3import com.runehive.Config;
4import com.runehive.game.world.entity.mob.player.Player;
5import com.runehive.game.world.items.Item;
6import com.runehive.net.packet.out.*;
7
8public abstract class Activity_Panel {
9 private final Player player;
10 private final String header;
11 private final String[] text = new String[7];
12 private String footer = "";
13 private Item item;
14 private int progress;
15
16 protected Activity_Panel(Player player, String header) {
17 this.player = player;
18 this.header = header;
19 }
20
21 public void open() {
22 player.send(new SendString(header, 38003));
23 player.send(new SendString(footer, 38004));
24
25 for (int index = 0; index <= 6; index++)
26 set(index, "");
27
28 if (!player.interfaceManager.isSidebar(Config.ACTIVITY_TAB,38000))
30
31 player.interfaceManager.setSidebar(Config.ACTIVITY_TAB, 38000);
32 }
33
34 public void close() {
36 player.interfaceManager.setSidebar(Config.ACTIVITY_TAB, -1);
37 }
38
39 protected void set(int index, String string) {
40 if (!string.equals(text[index]))
41 player.send(new SendString(text[index] = string, 38005 + index));
42 }
43
44 public void setFooter(String footer) {
45 if (!footer.equals(this.footer))
46 player.send(new SendString(this.footer = footer, 38004));
47 }
48
49 public void setItem(Item item) {
50 if (!item.equals(this.item))
51 player.send(new SendItemOnInterface(38016, this.item = item));
52 }
53
54 public void setProgress(int progress) {
55 if (this.progress != progress)
56 player.send(new SendProgressBar(38015, this.progress = progress));
57 }
58
59 public Player getPlayer() {
60 return player;
61 }
62
63 public int getProgress() {
64 return progress;
65 }
66
67 public Item getItem() {
68 return item;
69 }
70
71 public String getHeader() {
72 return header;
73 }
74
75 public String getFooter() {
76 return footer;
77 }
78
79 public String[] getText() {
80 return text;
81 }
82}
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
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.