RuneHive-Tarnish
Neural OSRS Enhancement Framework
Loading...
Searching...
No Matches
ShootingStarData.java
1package com.osroyale.content.shootingstar;
2
3import com.osroyale.Config;
4import com.osroyale.game.world.World;
5import com.osroyale.game.world.entity.mob.player.Player;
6import com.osroyale.game.world.entity.skill.Skill;
7import com.osroyale.game.world.items.Item;
8import com.osroyale.game.world.object.CustomGameObject;
9import com.osroyale.util.RandomUtils;
10
47
48public class ShootingStarData {
49
53 private boolean decreaseDouble = false;
54
59
63 public int starLevel;
64
68 public int availableDust;
69
73 public int maxDust;
74
78 public int[] starIds = { 41229, 41228, 41227, 41226, 41225, 41224, 41223, 41021, };
79
83 public int[] possibleDust = { 1200, 700, 430, 250, 175, 80, 40, 40, 15 };
84
88 public int[] xpDrops = { 12, 22, 26, 31, 48, 74, 123, 162, 244 };
89
94
98 public int[] doubleChance = { 2, 6, 12, 20, 30, 42, 56, 72, 90 };
99
100 public ShootingStarData() {
104 starLocation = ShootingStarLocations.values()[RandomUtils.inclusive(0, ShootingStarLocations.values().length - 1)];
105
106 System.out.println("starLocation.starPosition " + starLocation.starPosition);
109 }
110
114 public void decreaseDust(Player player) {
116 int amount = 1;
117
118 //Handles the double stardust chance
119 int roll = RandomUtils.inclusive(0, 100);
120 if(roll <= doubleChance[starLevel]) amount *= 2;
121
122 player.inventory.add(new Item(25527, amount));
123 availableDust -= decreaseDouble ? amount : amount / 2;
124
125 if(availableDust <= 0) {
127 for(Player p : World.getPlayers()) {
128 if(p == null || !(p.action.getCurrentAction() instanceof ShootingStarAction)) continue;
129
130 System.out.println("Reset the mining action for all the players with a shooting star action...");
131 p.action.cancel();
132 p.resetFace();
133 p.skills.get(Skill.MINING).setDoingSkill(false);
134 }
135 }
136 }
137
141 public void decreaseLevel() {
142 starLevel--;
143 if(starLevel < 0) {
144 destruct();
145 return;
146 }
147
150 starObject.transform(getObjectId());
151 }
152
156 public void destruct() {
157 starObject.unregister();
158 starObject = null;
159 }
160
165 public int getLevel() {
166 int[] chances = { 0, 16, 18, 20, 17, 12, 9, 5 }; //, 3
167
168 for (int index = chances.length - 1; index > 0; index--) {
169 int roll = RandomUtils.inclusive(0, 100);
170 if (roll < chances[index])
171 return index;
172 }
173 return 2;
174 }
175
180 public int getObjectId() {
181 return starIds[starLevel];
182 }
183
188 public int getMiningLevel() {
189 return (starLevel + 1) * 10;
190 }
191
196 public int getPercentage() {
197 return (maxDust - availableDust) * 100 / maxDust;
198 }
199
204 public int getXPDrop() {
205 return xpDrops[starLevel];
206 }
207
212 public String getLocationName() {
213 return starLocation.location[0];
214 }
215
220 public String getHint() {
221 return starLocation.location[1];
222 }
223}
static final double MINING_MODIFICATION
Definition Config.java:313
void addExperience(int id, double experience)