RuneHive-Tarnish
Neural OSRS Enhancement Framework
Loading...
Searching...
No Matches
Activity_Panel.java
1package com.osroyale.content.activity.panel;
2
3import com.osroyale.Config;
4import com.osroyale.game.world.entity.mob.player.Player;
5import com.osroyale.game.world.items.Item;
6import com.osroyale.net.packet.out.*;
7
41
42public abstract class Activity_Panel {
43 private final Player player;
44 private final String header;
45 private final String[] text = new String[7];
46 private String footer = "";
47 private Item item;
48 private int progress;
49
50 protected Activity_Panel(Player player, String header) {
51 this.player = player;
52 this.header = header;
53 }
54
55 public void open() {
56 player.send(new SendString(header, 38003));
57 player.send(new SendString(footer, 38004));
58
59 for (int index = 0; index <= 6; index++)
60 set(index, "");
61
62 if (!player.interfaceManager.isSidebar(Config.ACTIVITY_TAB,38000))
63 player.send(new SendForceTab(Config.ACTIVITY_TAB));
64
65 player.interfaceManager.setSidebar(Config.ACTIVITY_TAB, 38000);
66 }
67
68 public void close() {
69 player.send(new SendForceTab(Config.INVENTORY_TAB));
70 player.interfaceManager.setSidebar(Config.ACTIVITY_TAB, -1);
71 }
72
73 protected void set(int index, String string) {
74 if (!string.equals(text[index]))
75 player.send(new SendString(text[index] = string, 38005 + index));
76 }
77
78 public void setFooter(String footer) {
79 if (!footer.equals(this.footer))
80 player.send(new SendString(this.footer = footer, 38004));
81 }
82
83 public void setItem(Item item) {
84 if (!item.equals(this.item))
85 player.send(new SendItemOnInterface(38016, this.item = item));
86 }
87
88 public void setProgress(int progress) {
89 if (this.progress != progress)
90 player.send(new SendProgressBar(38015, this.progress = progress));
91 }
92
93 public Player getPlayer() {
94 return player;
95 }
96
97 public int getProgress() {
98 return progress;
99 }
100
101 public Item getItem() {
102 return item;
103 }
104
105 public String getHeader() {
106 return header;
107 }
108
109 public String getFooter() {
110 return footer;
111 }
112
113 public String[] getText() {
114 return text;
115 }
116}