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,237 +207,242 @@ 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();
switch (type) { if (DROP_CHANCE < dropChance) {
case BLAZE:
Misc.dropItem(location, new ItemStack(Material.BLAZE_ROD));
break;
case CAVE_SPIDER: switch (type) {
if (DROP_NUMBER > 50) { case BLAZE:
Misc.dropItem(location, new ItemStack(Material.SPIDER_EYE)); Misc.dropItem(location, new ItemStack(Material.BLAZE_ROD));
} break;
else {
Misc.dropItem(location, new ItemStack(Material.STRING));
}
break;
case CHICKEN: case CAVE_SPIDER:
if (DROP_NUMBER > 66) { if (DROP_NUMBER > 50) {
Misc.dropItem(location, new ItemStack(Material.FEATHER)); Misc.dropItem(location, new ItemStack(Material.SPIDER_EYE));
} } else {
else if (DROP_NUMBER > 33) { Misc.dropItem(location, new ItemStack(Material.STRING));
Misc.dropItem(location, new ItemStack(Material.RAW_CHICKEN)); }
} break;
else {
Misc.dropItem(location, new ItemStack(Material.EGG));
}
break;
case COW: case CHICKEN:
if (DROP_NUMBER > 99) { if (DROP_NUMBER > 66) {
Misc.dropItem(location, new ItemStack(Material.MILK_BUCKET)); Misc.dropItem(location, new ItemStack(Material.FEATHER));
} } else if (DROP_NUMBER > 33) {
else if (DROP_NUMBER > 50) { Misc.dropItem(location, new ItemStack(Material.RAW_CHICKEN));
Misc.dropItem(location, new ItemStack(Material.LEATHER)); } else {
} Misc.dropItem(location, new ItemStack(Material.EGG));
else { }
Misc.dropItem(location, new ItemStack(Material.RAW_BEEF)); break;
}
break;
case CREEPER: case COW:
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.MILK_BUCKET));
} } else if (DROP_NUMBER > 50) {
else { Misc.dropItem(location, new ItemStack(Material.LEATHER));
Misc.dropItem(location, new ItemStack(Material.SULPHUR)); } else {
} Misc.dropItem(location, new ItemStack(Material.RAW_BEEF));
break; }
break;
case ENDERMAN: case CREEPER:
Misc.dropItem(location, new ItemStack(Material.ENDER_PEARL)); if (DROP_NUMBER > 99) {
break; Misc.dropItem(location, new ItemStack(Material.SKULL_ITEM, 1, (short) 4));
} else {
Misc.dropItem(location, new ItemStack(Material.SULPHUR));
}
break;
case GHAST: case ENDERMAN:
if (DROP_NUMBER > 50) { Misc.dropItem(location, new ItemStack(Material.ENDER_PEARL));
Misc.dropItem(location, new ItemStack(Material.SULPHUR)); break;
}
else {
Misc.dropItem(location, new ItemStack(Material.GHAST_TEAR));
}
break;
case IRON_GOLEM: case GHAST:
if (DROP_NUMBER > 99) { if (DROP_NUMBER > 50) {
Misc.dropItem(location, new ItemStack(Material.PUMPKIN)); Misc.dropItem(location, new ItemStack(Material.SULPHUR));
} } else {
else if (DROP_NUMBER > 90) { Misc.dropItem(location, new ItemStack(Material.GHAST_TEAR));
Misc.dropItem(location, new ItemStack(Material.IRON_INGOT)); }
} break;
else {
Misc.dropItem(location, new ItemStack(Material.RED_ROSE));
}
break;
case MAGMA_CUBE: case IRON_GOLEM:
Misc.dropItem(location, new ItemStack(Material.MAGMA_CREAM)); if (DROP_NUMBER > 99) {
break; Misc.dropItem(location, new ItemStack(Material.PUMPKIN));
} else if (DROP_NUMBER > 90) {
Misc.dropItem(location, new ItemStack(Material.IRON_INGOT));
} else {
Misc.dropItem(location, new ItemStack(Material.RED_ROSE));
}
break;
case MUSHROOM_COW: case MAGMA_CUBE:
if (DROP_NUMBER > 99) { Misc.dropItem(location, new ItemStack(Material.MAGMA_CREAM));
Misc.dropItem(location, new ItemStack(Material.MILK_BUCKET)); break;
}
else if (DROP_NUMBER > 98) {
Misc.dropItem(location, new ItemStack(Material.MUSHROOM_SOUP));
}
else if (DROP_NUMBER > 66) {
Misc.dropItem(location, new ItemStack(Material.LEATHER));
}
else if (DROP_NUMBER > 33) {
Misc.dropItem(location, new ItemStack(Material.RAW_BEEF));
}
else {
Misc.dropItems(location, new ItemStack(Material.RED_MUSHROOM), 3);
}
break;
case PIG: case MUSHROOM_COW:
Misc.dropItem(location, new ItemStack(Material.PORK)); if (DROP_NUMBER > 99) {
break; Misc.dropItem(location, new ItemStack(Material.MILK_BUCKET));
} else if (DROP_NUMBER > 98) {
Misc.dropItem(location, new ItemStack(Material.MUSHROOM_SOUP));
} else if (DROP_NUMBER > 66) {
Misc.dropItem(location, new ItemStack(Material.LEATHER));
} else if (DROP_NUMBER > 33) {
Misc.dropItem(location, new ItemStack(Material.RAW_BEEF));
} else {
Misc.dropItems(location, new ItemStack(Material.RED_MUSHROOM), 3);
}
break;
case PIG_ZOMBIE: case PIG:
if (DROP_NUMBER > 50) { Misc.dropItem(location, new ItemStack(Material.PORK));
Misc.dropItem(location, new ItemStack(Material.ROTTEN_FLESH)); break;
}
else {
Misc.dropItem(location, new ItemStack(Material.GOLD_NUGGET));
}
break;
case SHEEP: case PIG_ZOMBIE:
Sheep sheep = (Sheep) le; if (DROP_NUMBER > 50) {
Misc.dropItem(location, new ItemStack(Material.ROTTEN_FLESH));
} else {
Misc.dropItem(location, new ItemStack(Material.GOLD_NUGGET));
}
break;
if (!sheep.isSheared()) { case SHEEP:
Wool wool = new Wool(); final Sheep sheep = (Sheep) le;
wool.setColor(sheep.getColor());
ItemStack theWool = wool.toItemStack(); if (!sheep.isSheared()) {
theWool.setAmount(1 + random.nextInt(6)); final Wool wool = new Wool();
wool.setColor(sheep.getColor());
Misc.dropItem(location, theWool); final ItemStack theWool = wool.toItemStack();
sheep.setSheared(true); theWool.setAmount(1 + random.nextInt(6));
}
break;
case SKELETON: Misc.dropItem(location, theWool);
if(((CraftSkeleton) le).getHandle().getSkeletonType() == 1) { sheep.setSheared(true);
if (DROP_NUMBER > 97) { }
Misc.dropItem(location, new ItemStack(Material.SKULL_ITEM, 1, (short) 1)); break;
}
else if (DROP_NUMBER > 50) {
Misc.dropItem(location, new ItemStack(Material.BONE));
}
else {
Misc.dropItems(location, new ItemStack(Material.COAL), 3);
}
}
else {
if (DROP_NUMBER > 99) {
Misc.dropItem(location, new ItemStack(Material.SKULL_ITEM));
}
else if (DROP_NUMBER > 50) {
Misc.dropItem(location, new ItemStack(Material.BONE));
}
else {
Misc.dropItems(location, new ItemStack(Material.ARROW), 3);
}
}
break;
case SLIME: case SKELETON:
Misc.dropItem(location, new ItemStack(Material.SLIME_BALL)); if (((CraftSkeleton) le).getHandle().getSkeletonType() == 1) {
break; if (DROP_NUMBER > 97) {
Misc.dropItem(location, new ItemStack(Material.SKULL_ITEM, 1, (short) 1));
} else if (DROP_NUMBER > 50) {
Misc.dropItem(location, new ItemStack(Material.BONE));
} else {
Misc.dropItems(location, new ItemStack(Material.COAL), 3);
}
} else {
if (DROP_NUMBER > 99) {
Misc.dropItem(location, new ItemStack(Material.SKULL_ITEM));
} else if (DROP_NUMBER > 50) {
Misc.dropItem(location, new ItemStack(Material.BONE));
} else {
Misc.dropItems(location, new ItemStack(Material.ARROW), 3);
}
}
break;
case SNOWMAN: case SLIME:
if (DROP_NUMBER > 99) { Misc.dropItem(location, new ItemStack(Material.SLIME_BALL));
Misc.dropItem(location, new ItemStack(Material.PUMPKIN)); break;
}
else {
Misc.dropItems(location, new ItemStack(Material.SNOW_BALL), 5);
}
break;
case SPIDER: case SNOWMAN:
if (DROP_NUMBER > 50) { if (DROP_NUMBER > 99) {
Misc.dropItem(location, new ItemStack(Material.SPIDER_EYE)); Misc.dropItem(location, new ItemStack(Material.PUMPKIN));
} } else {
else { Misc.dropItems(location, new ItemStack(Material.SNOW_BALL), 5);
Misc.dropItem(location, new ItemStack(Material.STRING)); }
} break;
break;
case SQUID: case SPIDER:
Misc.dropItem(location, new ItemStack(Material.INK_SACK, 1, (short) 0, (byte) 0x0)); if (DROP_NUMBER > 50) {
break; Misc.dropItem(location, new ItemStack(Material.SPIDER_EYE));
} else {
Misc.dropItem(location, new ItemStack(Material.STRING));
}
break;
case WITCH: case SQUID:
final int DROP_NUMBER_2 = random.nextInt(randomChance) + 1; Misc.dropItem(location, new ItemStack(Material.INK_SACK, 1, (short) 0, (byte) 0x0));
if (DROP_NUMBER > 97) { break;
if(DROP_NUMBER_2 > 66) {
Misc.dropItem(location, new ItemStack(Material.POTION, 1, (short) 8197));
}
else if(DROP_NUMBER_2 > 33) {
Misc.dropItem(location, new ItemStack(Material.POTION, 1, (short) 8195));
}
else {
Misc.dropItem(location, new ItemStack(Material.POTION, 1, (short) 8194));
}
}
else {
if(DROP_NUMBER_2 > 88) {
Misc.dropItem(location, new ItemStack(Material.GLASS_BOTTLE));
}
else if(DROP_NUMBER_2 > 75) {
Misc.dropItem(location, new ItemStack(Material.GLOWSTONE_DUST));
}
else if(DROP_NUMBER_2 > 63) {
Misc.dropItem(location, new ItemStack(Material.SULPHUR));
}
else if(DROP_NUMBER_2 > 50) {
Misc.dropItem(location, new ItemStack(Material.REDSTONE));
}
else if(DROP_NUMBER_2 > 38) {
Misc.dropItem(location, new ItemStack(Material.SPIDER_EYE));
}
else if(DROP_NUMBER_2 > 25) {
Misc.dropItem(location, new ItemStack(Material.STICK));
}
else if(DROP_NUMBER_2 > 13) {
Misc.dropItem(location, new ItemStack(Material.SUGAR));
}
else {
Misc.dropItem(location, new ItemStack(Material.POTION));
}
}
break;
case ZOMBIE: case WITCH:
if (DROP_NUMBER > 99) { final int DROP_NUMBER_2 = random.nextInt(randomChance) + 1;
Misc.dropItem(location, new ItemStack(Material.SKULL_ITEM, 1, (short) 2)); if (DROP_NUMBER > 97) {
} if (DROP_NUMBER_2 > 66) {
else { Misc.dropItem(location, new ItemStack(Material.POTION, 1, (short) 8197));
Misc.dropItem(location, new ItemStack(Material.ROTTEN_FLESH)); } else if (DROP_NUMBER_2 > 33) {
} Misc.dropItem(location, new ItemStack(Material.POTION, 1, (short) 8195));
break; } else {
Misc.dropItem(location, new ItemStack(Material.POTION, 1, (short) 8194));
}
} else {
if (DROP_NUMBER_2 > 88) {
Misc.dropItem(location, new ItemStack(Material.GLASS_BOTTLE));
} else if (DROP_NUMBER_2 > 75) {
Misc.dropItem(location, new ItemStack(Material.GLOWSTONE_DUST));
} else if (DROP_NUMBER_2 > 63) {
Misc.dropItem(location, new ItemStack(Material.SULPHUR));
} else if (DROP_NUMBER_2 > 50) {
Misc.dropItem(location, new ItemStack(Material.REDSTONE));
} else if (DROP_NUMBER_2 > 38) {
Misc.dropItem(location, new ItemStack(Material.SPIDER_EYE));
} else if (DROP_NUMBER_2 > 25) {
Misc.dropItem(location, new ItemStack(Material.STICK));
} else if (DROP_NUMBER_2 > 13) {
Misc.dropItem(location, new ItemStack(Material.SUGAR));
} else {
Misc.dropItem(location, new ItemStack(Material.POTION));
}
}
break;
default: case ZOMBIE:
break; if (DROP_NUMBER > 99) {
Misc.dropItem(location, new ItemStack(Material.SKULL_ITEM, 1, (short) 2));
} else {
Misc.dropItem(location, new ItemStack(Material.ROTTEN_FLESH));
}
break;
default:
break;
}
} }
Combat.dealDamage(le, 1); Combat.dealDamage(le, 1);