RuneHive-Tarnish
Neural OSRS Enhancement Framework
Loading...
Searching...
No Matches
SlayerTab.java
1package com.osroyale.content.skill.impl.slayer;
2
3import com.osroyale.game.world.entity.mob.player.Player;
4import com.osroyale.game.world.items.Item;
5import com.osroyale.net.packet.out.*;
6import com.osroyale.util.Utility;
7
8import java.util.Arrays;
9import java.util.List;
10
49
50public enum SlayerTab {
52 MAIN(46700),
53
55 DUO(46800),
56
58 UNLOCK(46900),
59
61 REWARD(46500),
62
64 TASK(46300),
65
67 CONFIRM(46400);
68
70 private final int identification;
71
73 SlayerTab(int identification) {
74 this.identification = identification;
75 }
76
78 public int getIdentification() {
79 return identification;
80 }
81
83 public static void refresh(Player player, SlayerTab tab) {
84 if (tab == null) {
85 return;
86 }
87
88 SlayerTask task = player.slayer.getTask();
89 switch (tab) {
90
91 case MAIN:
92 setFrame(player, 0);
93// player.send(new SendNpcDisplay(task == null ? 2044 : task.getNpc()[0], task == null ? 300 : task.getSize()));
94 player.send(new SendString(task == null ? "" : "</col>Name: <col=ffffff>" + task.getName(), 46716));
95 player.send(new SendString(task == null ? "" : "</col>Level: <col=ffffff>" + task.getCombatLevel(), 46717));
96 player.send(new SendString(task == null ? "You do not have a task assigned!" : "</col>Assigned: <col=ffffff>" + player.slayer.getAssigned(), 46718));
97 player.send(new SendString(task == null ? "" : "</col>Remaining: <col=ffffff>" + player.slayer.getAmount(), 46735));
98 player.send(new SendString(task == null ? "" : "</col>Position: <col=ffffff>" + task.getLocation(), 46736));
99 player.send(new SendString("Tasks assigned:\\n<col=ffffff>" + player.slayer.getTotalAssigned(), 46737));
100 player.send(new SendString("Tasks completed:\\n<col=ffffff>" + player.slayer.getTotalCompleted(), 46738));
101 player.send(new SendString("Tasks Cancelled:\\n<col=ffffff>" + player.slayer.getTotalCancelled(), 46739));
102 player.send(new SendString("Accumulated points:\\n<col=ffffff>" + player.slayer.getTotalPoints(), 46740));
103
104 for (int index = 0, string = 46753; index < 5; index++, string += 3) {
105 player.send(new SendTooltip("", string - 1));
106 player.send(new SendString("", string));
107 }
108
109 for (int index = 0, string = 46753; index < player.slayer.getBlocked().size(); index++, string += 3) {
110 String name = player.slayer.getBlocked().get(index).getName();
111 player.send(new SendTooltip("Unblock <col=FF981F>" + name + "</col>", string - 1));
112 player.send(new SendString(name, string));
113 }
114
115 player.send(new SendString(Utility.formatDigits(player.slayer.getPoints()) + "\\nPoints", 46714));
116 player.send(new SendString("Blocked tasks: (" + player.slayer.getBlocked().size() + "/5)", 46728));
117 break;
118
119 case DUO:
120 setFrame(player, 1);
121 player.send(new SendString("Current slayer partner: None!", 46811));
122 break;
123
124 case UNLOCK:
125 setFrame(player, 2);
126 int string = 46911;
127 for (SlayerUnlockable unlockable : SlayerUnlockable.values()) {
128 player.send(new SendTooltip("Purchase <col=FF981F>" + unlockable.getName() + "</col>", string));
129 string++;
130 player.send(new SendString(unlockable.getName(), string));
131 string++;
132 player.send(new SendString(unlockable.getDescription(), string));
133 string++;
134 player.send(new SendString(unlockable.getCost() + " points", string));
135 string++;
136 player.send(new SendConfig(560 + unlockable.ordinal(), player.slayer.getUnlocked().contains(unlockable) ? 0 : 1));
137 string++;
138 player.send(new SendItemOnInterfaceSlot(string, new Item(unlockable.getItem(), 1), 0));
139 string++;
140 }
141 player.send(new SendScrollbar(46910, 310));
142 break;
143
144 case REWARD:
145 player.send(new SendItemOnInterface(46503, Slayer.ITEMS));
146 setFrame(player, 3);
147 break;
148
149 case CONFIRM:
150 SlayerUnlockable unlockable = player.attributes.get("SLAYER_CONFIRM_KEY", SlayerUnlockable.class);
151 player.send(new SendString(unlockable.getName(), 46403));
152 player.send(new SendString(unlockable.getDescription(), 46404));
153 player.send(new SendString("Pay " + Utility.formatDigits(unlockable.getCost()) + " points?", 46405));
154
155 Item[] items = new Item[3];
156 for (int index = 0; index < 3; index++) {
157 items[index] = new Item(unlockable.getItem());
158 items[index].setAmount(0);
159 }
160
161 player.send(new SendItemOnInterface(46414, items));
162 break;
163
164 case TASK:
165 List<SlayerTask> task_list;
166 task_list = Arrays.asList(SlayerTask.values());
167 int line = 46321;
168
169 for (int index = 0; index < 35; index++) {
170 player.send(new SendString("", line + index));
171 }
172
173 for (SlayerTask tasks : task_list) {
174 line++;
175 player.send(new SendString(tasks.getName(), line));
176 line++;
177 player.send(new SendString(tasks.getCombatLevel(), line));
178 line++;
179 player.send(new SendString(tasks.getLevel(), line));
180 line++;
181 }
182
183 player.send(new SendScrollbar(46320, 400));
184 break;
185 }
186 }
187
189 private static void setFrame(Player player, int index) {
190 player.send(new SendConfig(710, index));
191 player.send(new SendString("<col=" + (index == 0 ? "FF981F" : "ff9933") + ">Main", 46710));
192 player.send(new SendString("<col=" + (index == 1 ? "FF981F" : "ff9933") + ">Duo", 46711));
193 player.send(new SendString("<col=" + (index == 2 ? "FF981F" : "ff9933") + ">Unlocks", 46712));
194 player.send(new SendString("<col=" + (index == 3 ? "FF981F" : "ff9933") + ">Store", 46713));
195 }
196}
static String formatDigits(final int amount)
Definition Utility.java:78
static void refresh(Player player, SlayerTab tab)