mirror of
https://github.com/2006-Scape/2006Scape.git
synced 2026-07-07 16:49:07 +00:00
Fix gem check being rolled twice. (#474)
This commit is contained in:
@@ -17,21 +17,20 @@ public class Mining {
|
|||||||
private static final int[] GLORIES = {1706, 1708, 1710, 1712};
|
private static final int[] GLORIES = {1706, 1708, 1710, 1712};
|
||||||
|
|
||||||
public boolean giveGem(Player player) {
|
public boolean giveGem(Player player) {
|
||||||
|
int chance = 256;
|
||||||
for (int i = 0; i < GLORIES.length; i++) {
|
for (int i = 0; i < GLORIES.length; i++) {
|
||||||
if ((player.playerEquipment[player.playerAmulet] == GLORIES[i] && Misc.random(86) == 1) || Misc.random(256) == 1) {
|
if (player.playerEquipment[player.playerAmulet] == GLORIES[i]) {
|
||||||
return true;
|
chance = 86;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return Misc.random(chance) == 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void obtainGem(Player player) {
|
public void obtainGem(Player player) {
|
||||||
int reward = RANDOM_GEMS[(int)(RANDOM_GEMS.length * Math.random())];
|
int reward = RANDOM_GEMS[(int)(RANDOM_GEMS.length * Math.random())];
|
||||||
if (giveGem(player)) {
|
|
||||||
player.getItemAssistant().addItem(reward, 1);
|
player.getItemAssistant().addItem(reward, 1);
|
||||||
player.getPacketSender().sendMessage("You found an " + ItemAssistant.getItemName(reward) + ".");
|
player.getPacketSender().sendMessage("You found an " + ItemAssistant.getItemName(reward) + ".");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public final int[][] Pick_Settings = {
|
public final int[][] Pick_Settings = {
|
||||||
{1265, 1, 1, 625}, //Bronze
|
{1265, 1, 1, 625}, //Bronze
|
||||||
|
|||||||
Reference in New Issue
Block a user