Merge branch 'master' of https://github.com/mcMMO-Dev/mcMMO into fixes

This commit is contained in:
Glitchfinder 2012-11-12 13:48:31 -08:00
commit eebda74bb7
5 changed files with 235 additions and 209 deletions

View File

@ -1,6 +1,7 @@
package com.gmail.nossr50.commands.skills;
import com.gmail.nossr50.commands.SkillCommand;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.skills.gathering.Fishing;
@ -8,6 +9,7 @@ import com.gmail.nossr50.skills.gathering.Fishing;
public class FishingCommand extends SkillCommand {
private int lootTier;
private String magicChance;
private String shakeChance;
private boolean canTreasureHunt;
private boolean canMagicHunt;
@ -21,6 +23,7 @@ public class FishingCommand extends SkillCommand {
protected void dataCalculations() {
lootTier = Fishing.getFishingLootTier(profile);
magicChance = percent.format((float) lootTier / 15);
shakeChance = String.valueOf(Fishing.getShakeChance(lootTier));
}
@Override
@ -66,12 +69,11 @@ public class FishingCommand extends SkillCommand {
}
if (canShake) {
//TODO: Do we really need to display this twice? Not like there are any associated stats.
if (skillValue < 150) {
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template.Lock", new Object[] { LocaleLoader.getString("Fishing.Ability.Locked.0") }));
}
else {
player.sendMessage(LocaleLoader.getString("Fishing.Ability.Shake"));
player.sendMessage(LocaleLoader.getString("Fishing.Ability.Shake", new Object[] { shakeChance }));
}
}
}

View File

@ -153,6 +153,13 @@ public class Config extends ConfigLoader {
public int getFishingTierLevelsTier4() { return config.getInt("Fishing.Tier_Levels.Tier4", 600); }
public int getFishingTierLevelsTier5() { return config.getInt("Fishing.Tier_Levels.Tier5", 800); }
/* Shake */
public int getShakeChanceRank1() { return config.getInt("Shake.Chance.Rank_1", 25); }
public int getShakeChanceRank2() { return config.getInt("Shake.Chance.Rank_2", 40); }
public int getShakeChanceRank3() { return config.getInt("Shake.Chance.Rank_3", 55); }
public int getShakeChanceRank4() { return config.getInt("Shake.Chance.Rank_4", 60); }
public int getShakeChanceRank5() { return config.getInt("Shake.Chance.Rank_5", 75); }
/* Herbalism */
public int getHerbalismXPSugarCane() { return config.getInt("Experience.Herbalism.Sugar_Cane", 30); }
public int getHerbalismXPWheat() { return config.getInt("Experience.Herbalism.Wheat", 50); }

View File

@ -157,7 +157,7 @@ public class Fishing {
int randomChance = 100;
if (player.hasPermission("mcmmo.perks.lucky.fishing")) {
randomChance = (int) (randomChance * 1.25);
randomChance = (int) (randomChance * 0.75);
}
if (random.nextInt(randomChance) <= ENCHANTMENT_CHANCE && Permissions.getInstance().fishingMagic(player)) {
@ -204,15 +204,28 @@ public class Fishing {
int randomChance = 100;
if (event.getPlayer().hasPermission("mcmmo.perks.lucky.fishing")) {
randomChance = (int) (randomChance * 0.75);
randomChance = (int) (randomChance * 1.25);
}
final Player player = event.getPlayer();
final PlayerProfile profile = Users.getProfile(player);
int lootTier = getFishingLootTier(profile);
int dropChance = getShakeChance(lootTier);
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;
LivingEntity le = (LivingEntity) event.getCaught();
EntityType type = le.getType();
Location location = le.getLocation();
if (DROP_CHANCE < dropChance) {
switch (type) {
case BLAZE:
Misc.dropItem(location, new ItemStack(Material.BLAZE_ROD));
@ -221,8 +234,7 @@ public class Fishing {
case CAVE_SPIDER:
if (DROP_NUMBER > 50) {
Misc.dropItem(location, new ItemStack(Material.SPIDER_EYE));
}
else {
} else {
Misc.dropItem(location, new ItemStack(Material.STRING));
}
break;
@ -230,11 +242,9 @@ public class Fishing {
case CHICKEN:
if (DROP_NUMBER > 66) {
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));
}
else {
} else {
Misc.dropItem(location, new ItemStack(Material.EGG));
}
break;
@ -242,11 +252,9 @@ public class Fishing {
case COW:
if (DROP_NUMBER > 99) {
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));
}
else {
} else {
Misc.dropItem(location, new ItemStack(Material.RAW_BEEF));
}
break;
@ -254,8 +262,7 @@ public class Fishing {
case CREEPER:
if (DROP_NUMBER > 99) {
Misc.dropItem(location, new ItemStack(Material.SKULL_ITEM, 1, (short) 4));
}
else {
} else {
Misc.dropItem(location, new ItemStack(Material.SULPHUR));
}
break;
@ -267,8 +274,7 @@ public class Fishing {
case GHAST:
if (DROP_NUMBER > 50) {
Misc.dropItem(location, new ItemStack(Material.SULPHUR));
}
else {
} else {
Misc.dropItem(location, new ItemStack(Material.GHAST_TEAR));
}
break;
@ -276,11 +282,9 @@ public class Fishing {
case IRON_GOLEM:
if (DROP_NUMBER > 99) {
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));
}
else {
} else {
Misc.dropItem(location, new ItemStack(Material.RED_ROSE));
}
break;
@ -292,17 +296,13 @@ public class Fishing {
case MUSHROOM_COW:
if (DROP_NUMBER > 99) {
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));
}
else if (DROP_NUMBER > 66) {
} else if (DROP_NUMBER > 66) {
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));
}
else {
} else {
Misc.dropItems(location, new ItemStack(Material.RED_MUSHROOM), 3);
}
break;
@ -314,20 +314,19 @@ public class Fishing {
case PIG_ZOMBIE:
if (DROP_NUMBER > 50) {
Misc.dropItem(location, new ItemStack(Material.ROTTEN_FLESH));
}
else {
} else {
Misc.dropItem(location, new ItemStack(Material.GOLD_NUGGET));
}
break;
case SHEEP:
Sheep sheep = (Sheep) le;
final Sheep sheep = (Sheep) le;
if (!sheep.isSheared()) {
Wool wool = new Wool();
final Wool wool = new Wool();
wool.setColor(sheep.getColor());
ItemStack theWool = wool.toItemStack();
final ItemStack theWool = wool.toItemStack();
theWool.setAmount(1 + random.nextInt(6));
Misc.dropItem(location, theWool);
@ -336,25 +335,20 @@ public class Fishing {
break;
case SKELETON:
if(((CraftSkeleton) le).getHandle().getSkeletonType() == 1) {
if (((CraftSkeleton) le).getHandle().getSkeletonType() == 1) {
if (DROP_NUMBER > 97) {
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));
}
else {
} else {
Misc.dropItems(location, new ItemStack(Material.COAL), 3);
}
}
else {
} else {
if (DROP_NUMBER > 99) {
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));
}
else {
} else {
Misc.dropItems(location, new ItemStack(Material.ARROW), 3);
}
}
@ -367,8 +361,7 @@ public class Fishing {
case SNOWMAN:
if (DROP_NUMBER > 99) {
Misc.dropItem(location, new ItemStack(Material.PUMPKIN));
}
else {
} else {
Misc.dropItems(location, new ItemStack(Material.SNOW_BALL), 5);
}
break;
@ -376,8 +369,7 @@ public class Fishing {
case SPIDER:
if (DROP_NUMBER > 50) {
Misc.dropItem(location, new ItemStack(Material.SPIDER_EYE));
}
else {
} else {
Misc.dropItem(location, new ItemStack(Material.STRING));
}
break;
@ -389,39 +381,29 @@ public class Fishing {
case WITCH:
final int DROP_NUMBER_2 = random.nextInt(randomChance) + 1;
if (DROP_NUMBER > 97) {
if(DROP_NUMBER_2 > 66) {
if (DROP_NUMBER_2 > 66) {
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));
}
else {
} else {
Misc.dropItem(location, new ItemStack(Material.POTION, 1, (short) 8194));
}
}
else {
if(DROP_NUMBER_2 > 88) {
} else {
if (DROP_NUMBER_2 > 88) {
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));
}
else if(DROP_NUMBER_2 > 63) {
} else if (DROP_NUMBER_2 > 63) {
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));
}
else if(DROP_NUMBER_2 > 38) {
} else if (DROP_NUMBER_2 > 38) {
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));
}
else if(DROP_NUMBER_2 > 13) {
} else if (DROP_NUMBER_2 > 13) {
Misc.dropItem(location, new ItemStack(Material.SUGAR));
}
else {
} else {
Misc.dropItem(location, new ItemStack(Material.POTION));
}
}
@ -430,8 +412,7 @@ public class Fishing {
case ZOMBIE:
if (DROP_NUMBER > 99) {
Misc.dropItem(location, new ItemStack(Material.SKULL_ITEM, 1, (short) 2));
}
else {
} else {
Misc.dropItem(location, new ItemStack(Material.ROTTEN_FLESH));
}
break;
@ -439,7 +420,35 @@ public class Fishing {
default:
break;
}
}
Combat.dealDamage(le, 1);
}
/**
* Gets chance of shake success.
*
* @param rank Treasure hunter rank
* @return The chance of a successful shake
*/
public static int getShakeChance(int lootTier) {
switch (lootTier) {
case 1:
return Config.getInstance().getShakeChanceRank1();
case 2:
return Config.getInstance().getShakeChanceRank2();
case 3:
return Config.getInstance().getShakeChanceRank3();
case 4:
return Config.getInstance().getShakeChanceRank4();
case 5:
return Config.getInstance().getShakeChanceRank5();
default:
return 10;
}
}
}

View File

@ -93,6 +93,14 @@ Fishing:
Tier4: 600
Tier5: 800
Shake:
Chance:
Rank_1: 25
Rank_2: 40
Rank_3: 55
Rank_4: 60
Rank_5: 75
#
# Settings for Abilities
###

View File

@ -102,7 +102,7 @@ Excavation.Skillup=[[YELLOW]]Excavation skill increased by {0}. Total ({1})
Fishing.Ability.Info=[[RED]]Magic Hunter: [[GRAY]] **Improves With Treasure Hunter Rank**
Fishing.Ability.Locked.0=LOCKED UNTIL 150+ SKILL (SHAKE)
Fishing.Ability.Rank=[[RED]]Treasure Hunter Rank: [[YELLOW]]{0}/5
Fishing.Ability.Shake=[[RED]]Shake: [[YELLOW]]Tear items off mobs, mutilating them in the process ;_;
Fishing.Ability.Shake=[[RED]]Shake Chance: [[YELLOW]]{0}%
Fishing.Effect.0=Treasure Hunter (Passive)
Fishing.Effect.1=Fish up misc. objects
Fishing.Effect.2=Magic Hunter
@ -221,8 +221,8 @@ Repair.Skills.Super.Chance=[[RED]]Super Repair Chance: [[YELLOW]]{0}
Repair.Skillup=[[YELLOW]]Repair skill increased by {0}. Total ({1})
##Arcane Forging
Repair.Arcane.Chance.Downgrade=[[GRAY]]AF Downgrade Chance: [[YELLOW]]{0}
Repair.Arcane.Chance.Success=[[GRAY]]AF Success Rate: [[YELLOW]]{0}
Repair.Arcane.Chance.Downgrade=[[GRAY]]AF Downgrade Chance: [[YELLOW]]{0}%
Repair.Arcane.Chance.Success=[[GRAY]]AF Success Rate: [[YELLOW]]{0}%
Repair.Arcane.Downgrade=[[RED]]Arcane power has decreased for this item.
Repair.Arcane.Fail=[[RED]]Arcane power has permanently left the item.
Repair.Arcane.Lost=[[RED]]You were not skilled enough to keep any enchantments.