Changed shake drops from guaranteed to based upon fishing level and perks.

This commit is contained in:
TfT_02 2012-11-07 13:30:20 +01:00
parent b8d37cb223
commit 2bdeeb2d6e

View File

@ -207,12 +207,48 @@ public class Fishing {
randomChance = (int) (randomChance * 0.75); randomChance = (int) (randomChance * 0.75);
} }
final Player player = event.getPlayer();
final PlayerProfile profile = Users.getProfile(player);
int dropChance = 10;
switch (getFishingLootTier(profile)) {
case 1:
dropChance = 10;
break;
case 2:
dropChance = 30;
break;
case 3:
dropChance = 50;
break;
case 4:
dropChance = 60;
break;
case 5:
dropChance = 75;
break;
default:
break;
}
if (event.getPlayer().hasPermission("mcmmo.perks.lucky.fishing")) {
dropChance = (int) (dropChance * 1.25); //With lucky perk on max level tier, its 100%
}
final int DROP_CHANCE = random.nextInt(100);
final int DROP_NUMBER = random.nextInt(randomChance) + 1; final int DROP_NUMBER = random.nextInt(randomChance) + 1;
LivingEntity le = (LivingEntity) event.getCaught(); LivingEntity le = (LivingEntity) event.getCaught();
EntityType type = le.getType(); EntityType type = le.getType();
Location location = le.getLocation(); Location location = le.getLocation();
if (DROP_CHANCE < dropChance) {
switch (type) { switch (type) {
case BLAZE: case BLAZE:
Misc.dropItem(location, new ItemStack(Material.BLAZE_ROD)); Misc.dropItem(location, new ItemStack(Material.BLAZE_ROD));
@ -221,8 +257,7 @@ public class Fishing {
case CAVE_SPIDER: case CAVE_SPIDER:
if (DROP_NUMBER > 50) { if (DROP_NUMBER > 50) {
Misc.dropItem(location, new ItemStack(Material.SPIDER_EYE)); Misc.dropItem(location, new ItemStack(Material.SPIDER_EYE));
} } else {
else {
Misc.dropItem(location, new ItemStack(Material.STRING)); Misc.dropItem(location, new ItemStack(Material.STRING));
} }
break; break;
@ -230,11 +265,9 @@ public class Fishing {
case CHICKEN: case CHICKEN:
if (DROP_NUMBER > 66) { if (DROP_NUMBER > 66) {
Misc.dropItem(location, new ItemStack(Material.FEATHER)); Misc.dropItem(location, new ItemStack(Material.FEATHER));
} } else if (DROP_NUMBER > 33) {
else if (DROP_NUMBER > 33) {
Misc.dropItem(location, new ItemStack(Material.RAW_CHICKEN)); Misc.dropItem(location, new ItemStack(Material.RAW_CHICKEN));
} } else {
else {
Misc.dropItem(location, new ItemStack(Material.EGG)); Misc.dropItem(location, new ItemStack(Material.EGG));
} }
break; break;
@ -242,11 +275,9 @@ public class Fishing {
case COW: case COW:
if (DROP_NUMBER > 99) { if (DROP_NUMBER > 99) {
Misc.dropItem(location, new ItemStack(Material.MILK_BUCKET)); Misc.dropItem(location, new ItemStack(Material.MILK_BUCKET));
} } else if (DROP_NUMBER > 50) {
else if (DROP_NUMBER > 50) {
Misc.dropItem(location, new ItemStack(Material.LEATHER)); Misc.dropItem(location, new ItemStack(Material.LEATHER));
} } else {
else {
Misc.dropItem(location, new ItemStack(Material.RAW_BEEF)); Misc.dropItem(location, new ItemStack(Material.RAW_BEEF));
} }
break; break;
@ -254,8 +285,7 @@ public class Fishing {
case CREEPER: case CREEPER:
if (DROP_NUMBER > 99) { if (DROP_NUMBER > 99) {
Misc.dropItem(location, new ItemStack(Material.SKULL_ITEM, 1, (short) 4)); Misc.dropItem(location, new ItemStack(Material.SKULL_ITEM, 1, (short) 4));
} } else {
else {
Misc.dropItem(location, new ItemStack(Material.SULPHUR)); Misc.dropItem(location, new ItemStack(Material.SULPHUR));
} }
break; break;
@ -267,8 +297,7 @@ public class Fishing {
case GHAST: case GHAST:
if (DROP_NUMBER > 50) { if (DROP_NUMBER > 50) {
Misc.dropItem(location, new ItemStack(Material.SULPHUR)); Misc.dropItem(location, new ItemStack(Material.SULPHUR));
} } else {
else {
Misc.dropItem(location, new ItemStack(Material.GHAST_TEAR)); Misc.dropItem(location, new ItemStack(Material.GHAST_TEAR));
} }
break; break;
@ -276,11 +305,9 @@ public class Fishing {
case IRON_GOLEM: case IRON_GOLEM:
if (DROP_NUMBER > 99) { if (DROP_NUMBER > 99) {
Misc.dropItem(location, new ItemStack(Material.PUMPKIN)); Misc.dropItem(location, new ItemStack(Material.PUMPKIN));
} } else if (DROP_NUMBER > 90) {
else if (DROP_NUMBER > 90) {
Misc.dropItem(location, new ItemStack(Material.IRON_INGOT)); Misc.dropItem(location, new ItemStack(Material.IRON_INGOT));
} } else {
else {
Misc.dropItem(location, new ItemStack(Material.RED_ROSE)); Misc.dropItem(location, new ItemStack(Material.RED_ROSE));
} }
break; break;
@ -292,17 +319,13 @@ public class Fishing {
case MUSHROOM_COW: case MUSHROOM_COW:
if (DROP_NUMBER > 99) { if (DROP_NUMBER > 99) {
Misc.dropItem(location, new ItemStack(Material.MILK_BUCKET)); Misc.dropItem(location, new ItemStack(Material.MILK_BUCKET));
} } else if (DROP_NUMBER > 98) {
else if (DROP_NUMBER > 98) {
Misc.dropItem(location, new ItemStack(Material.MUSHROOM_SOUP)); Misc.dropItem(location, new ItemStack(Material.MUSHROOM_SOUP));
} } else if (DROP_NUMBER > 66) {
else if (DROP_NUMBER > 66) {
Misc.dropItem(location, new ItemStack(Material.LEATHER)); Misc.dropItem(location, new ItemStack(Material.LEATHER));
} } else if (DROP_NUMBER > 33) {
else if (DROP_NUMBER > 33) {
Misc.dropItem(location, new ItemStack(Material.RAW_BEEF)); Misc.dropItem(location, new ItemStack(Material.RAW_BEEF));
} } else {
else {
Misc.dropItems(location, new ItemStack(Material.RED_MUSHROOM), 3); Misc.dropItems(location, new ItemStack(Material.RED_MUSHROOM), 3);
} }
break; break;
@ -314,20 +337,19 @@ public class Fishing {
case PIG_ZOMBIE: case PIG_ZOMBIE:
if (DROP_NUMBER > 50) { if (DROP_NUMBER > 50) {
Misc.dropItem(location, new ItemStack(Material.ROTTEN_FLESH)); Misc.dropItem(location, new ItemStack(Material.ROTTEN_FLESH));
} } else {
else {
Misc.dropItem(location, new ItemStack(Material.GOLD_NUGGET)); Misc.dropItem(location, new ItemStack(Material.GOLD_NUGGET));
} }
break; break;
case SHEEP: case SHEEP:
Sheep sheep = (Sheep) le; final Sheep sheep = (Sheep) le;
if (!sheep.isSheared()) { if (!sheep.isSheared()) {
Wool wool = new Wool(); final Wool wool = new Wool();
wool.setColor(sheep.getColor()); wool.setColor(sheep.getColor());
ItemStack theWool = wool.toItemStack(); final ItemStack theWool = wool.toItemStack();
theWool.setAmount(1 + random.nextInt(6)); theWool.setAmount(1 + random.nextInt(6));
Misc.dropItem(location, theWool); Misc.dropItem(location, theWool);
@ -339,22 +361,17 @@ public class Fishing {
if (((CraftSkeleton) le).getHandle().getSkeletonType() == 1) { if (((CraftSkeleton) le).getHandle().getSkeletonType() == 1) {
if (DROP_NUMBER > 97) { if (DROP_NUMBER > 97) {
Misc.dropItem(location, new ItemStack(Material.SKULL_ITEM, 1, (short) 1)); Misc.dropItem(location, new ItemStack(Material.SKULL_ITEM, 1, (short) 1));
} } else if (DROP_NUMBER > 50) {
else if (DROP_NUMBER > 50) {
Misc.dropItem(location, new ItemStack(Material.BONE)); Misc.dropItem(location, new ItemStack(Material.BONE));
} } else {
else {
Misc.dropItems(location, new ItemStack(Material.COAL), 3); Misc.dropItems(location, new ItemStack(Material.COAL), 3);
} }
} } else {
else {
if (DROP_NUMBER > 99) { if (DROP_NUMBER > 99) {
Misc.dropItem(location, new ItemStack(Material.SKULL_ITEM)); Misc.dropItem(location, new ItemStack(Material.SKULL_ITEM));
} } else if (DROP_NUMBER > 50) {
else if (DROP_NUMBER > 50) {
Misc.dropItem(location, new ItemStack(Material.BONE)); Misc.dropItem(location, new ItemStack(Material.BONE));
} } else {
else {
Misc.dropItems(location, new ItemStack(Material.ARROW), 3); Misc.dropItems(location, new ItemStack(Material.ARROW), 3);
} }
} }
@ -367,8 +384,7 @@ public class Fishing {
case SNOWMAN: case SNOWMAN:
if (DROP_NUMBER > 99) { if (DROP_NUMBER > 99) {
Misc.dropItem(location, new ItemStack(Material.PUMPKIN)); Misc.dropItem(location, new ItemStack(Material.PUMPKIN));
} } else {
else {
Misc.dropItems(location, new ItemStack(Material.SNOW_BALL), 5); Misc.dropItems(location, new ItemStack(Material.SNOW_BALL), 5);
} }
break; break;
@ -376,8 +392,7 @@ public class Fishing {
case SPIDER: case SPIDER:
if (DROP_NUMBER > 50) { if (DROP_NUMBER > 50) {
Misc.dropItem(location, new ItemStack(Material.SPIDER_EYE)); Misc.dropItem(location, new ItemStack(Material.SPIDER_EYE));
} } else {
else {
Misc.dropItem(location, new ItemStack(Material.STRING)); Misc.dropItem(location, new ItemStack(Material.STRING));
} }
break; break;
@ -391,37 +406,27 @@ public class Fishing {
if (DROP_NUMBER > 97) { if (DROP_NUMBER > 97) {
if (DROP_NUMBER_2 > 66) { if (DROP_NUMBER_2 > 66) {
Misc.dropItem(location, new ItemStack(Material.POTION, 1, (short) 8197)); Misc.dropItem(location, new ItemStack(Material.POTION, 1, (short) 8197));
} } else if (DROP_NUMBER_2 > 33) {
else if(DROP_NUMBER_2 > 33) {
Misc.dropItem(location, new ItemStack(Material.POTION, 1, (short) 8195)); Misc.dropItem(location, new ItemStack(Material.POTION, 1, (short) 8195));
} } else {
else {
Misc.dropItem(location, new ItemStack(Material.POTION, 1, (short) 8194)); Misc.dropItem(location, new ItemStack(Material.POTION, 1, (short) 8194));
} }
} } else {
else {
if (DROP_NUMBER_2 > 88) { if (DROP_NUMBER_2 > 88) {
Misc.dropItem(location, new ItemStack(Material.GLASS_BOTTLE)); Misc.dropItem(location, new ItemStack(Material.GLASS_BOTTLE));
} } else if (DROP_NUMBER_2 > 75) {
else if(DROP_NUMBER_2 > 75) {
Misc.dropItem(location, new ItemStack(Material.GLOWSTONE_DUST)); Misc.dropItem(location, new ItemStack(Material.GLOWSTONE_DUST));
} } else if (DROP_NUMBER_2 > 63) {
else if(DROP_NUMBER_2 > 63) {
Misc.dropItem(location, new ItemStack(Material.SULPHUR)); Misc.dropItem(location, new ItemStack(Material.SULPHUR));
} } else if (DROP_NUMBER_2 > 50) {
else if(DROP_NUMBER_2 > 50) {
Misc.dropItem(location, new ItemStack(Material.REDSTONE)); Misc.dropItem(location, new ItemStack(Material.REDSTONE));
} } else if (DROP_NUMBER_2 > 38) {
else if(DROP_NUMBER_2 > 38) {
Misc.dropItem(location, new ItemStack(Material.SPIDER_EYE)); Misc.dropItem(location, new ItemStack(Material.SPIDER_EYE));
} } else if (DROP_NUMBER_2 > 25) {
else if(DROP_NUMBER_2 > 25) {
Misc.dropItem(location, new ItemStack(Material.STICK)); Misc.dropItem(location, new ItemStack(Material.STICK));
} } else if (DROP_NUMBER_2 > 13) {
else if(DROP_NUMBER_2 > 13) {
Misc.dropItem(location, new ItemStack(Material.SUGAR)); Misc.dropItem(location, new ItemStack(Material.SUGAR));
} } else {
else {
Misc.dropItem(location, new ItemStack(Material.POTION)); Misc.dropItem(location, new ItemStack(Material.POTION));
} }
} }
@ -430,8 +435,7 @@ public class Fishing {
case ZOMBIE: case ZOMBIE:
if (DROP_NUMBER > 99) { if (DROP_NUMBER > 99) {
Misc.dropItem(location, new ItemStack(Material.SKULL_ITEM, 1, (short) 2)); Misc.dropItem(location, new ItemStack(Material.SKULL_ITEM, 1, (short) 2));
} } else {
else {
Misc.dropItem(location, new ItemStack(Material.ROTTEN_FLESH)); Misc.dropItem(location, new ItemStack(Material.ROTTEN_FLESH));
} }
break; break;
@ -439,6 +443,7 @@ public class Fishing {
default: default:
break; break;
} }
}
Combat.dealDamage(le, 1); Combat.dealDamage(le, 1);
} }