2013-03-01 06:52:01 +01:00
|
|
|
package com.gmail.nossr50.commands.skills;
|
|
|
|
|
|
|
|
import com.gmail.nossr50.config.AdvancedConfig;
|
|
|
|
import com.gmail.nossr50.datatypes.skills.SkillType;
|
|
|
|
import com.gmail.nossr50.locale.LocaleLoader;
|
|
|
|
import com.gmail.nossr50.skills.fishing.Fishing;
|
|
|
|
import com.gmail.nossr50.util.Permissions;
|
2013-03-03 16:09:41 +01:00
|
|
|
import com.gmail.nossr50.util.player.UserManager;
|
2013-03-01 06:52:01 +01:00
|
|
|
|
|
|
|
public class FishingCommand extends SkillCommand {
|
|
|
|
private int lootTier;
|
|
|
|
private String magicChance;
|
|
|
|
private String magicChanceLucky;
|
|
|
|
private String chanceRaining = "";
|
|
|
|
private String shakeChance;
|
|
|
|
private String shakeChanceLucky;
|
2013-03-12 21:25:42 +01:00
|
|
|
private int fishermansDietRank;
|
2013-04-09 17:32:07 +02:00
|
|
|
private String biteChance;
|
2013-03-01 06:52:01 +01:00
|
|
|
|
|
|
|
private boolean canTreasureHunt;
|
|
|
|
private boolean canMagicHunt;
|
|
|
|
private boolean canShake;
|
|
|
|
private boolean canFishermansDiet;
|
2013-04-09 17:32:07 +02:00
|
|
|
private boolean canMasterAngler;
|
2013-03-01 06:52:01 +01:00
|
|
|
|
|
|
|
public FishingCommand() {
|
|
|
|
super(SkillType.FISHING);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected void dataCalculations() {
|
2013-04-09 17:32:07 +02:00
|
|
|
boolean isStorming = player.getWorld().hasStorm();
|
|
|
|
|
2013-03-01 06:52:01 +01:00
|
|
|
// TREASURE HUNTER
|
2013-03-12 21:25:42 +01:00
|
|
|
if (canTreasureHunt) {
|
|
|
|
lootTier = mcMMOPlayer.getFishingManager().getLootTier();
|
|
|
|
double enchantChance = lootTier * AdvancedConfig.getInstance().getFishingMagicMultiplier();
|
2013-03-01 06:52:01 +01:00
|
|
|
|
2013-04-09 17:32:07 +02:00
|
|
|
if (isStorming) {
|
2013-03-12 21:25:42 +01:00
|
|
|
chanceRaining = LocaleLoader.getString("Fishing.Chance.Raining");
|
|
|
|
enchantChance *= 1.1D;
|
|
|
|
}
|
2013-03-01 06:52:01 +01:00
|
|
|
|
2013-03-12 21:25:42 +01:00
|
|
|
String[] treasureHunterStrings = calculateAbilityDisplayValues(enchantChance);
|
|
|
|
magicChance = treasureHunterStrings[0];
|
|
|
|
magicChanceLucky = treasureHunterStrings[1];
|
|
|
|
}
|
2013-03-01 06:52:01 +01:00
|
|
|
|
|
|
|
// SHAKE
|
2013-03-12 21:25:42 +01:00
|
|
|
if (canShake) {
|
|
|
|
String[] shakeStrings = calculateAbilityDisplayValues(UserManager.getPlayer(player).getFishingManager().getShakeProbability());
|
|
|
|
shakeChance = shakeStrings[0];
|
|
|
|
shakeChanceLucky = shakeStrings[1];
|
|
|
|
}
|
2013-03-01 06:52:01 +01:00
|
|
|
|
|
|
|
// FISHERMAN'S DIET
|
2013-03-12 21:25:42 +01:00
|
|
|
if (canFishermansDiet) {
|
|
|
|
fishermansDietRank = calculateRank(Fishing.fishermansDietMaxLevel, Fishing.fishermansDietRankLevel1);
|
|
|
|
}
|
2013-04-09 17:32:07 +02:00
|
|
|
|
|
|
|
// MASTER ANGLER
|
|
|
|
if (canMasterAngler) {
|
2013-04-11 00:44:11 +02:00
|
|
|
biteChance = calculateAbilityDisplayValues((skillValue / 10) / (isStorming ? 300 : 500))[0];
|
2013-04-09 17:32:07 +02:00
|
|
|
}
|
2013-03-01 06:52:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected void permissionsCheck() {
|
|
|
|
canTreasureHunt = Permissions.fishingTreasureHunter(player);
|
|
|
|
canMagicHunt = Permissions.magicHunter(player);
|
|
|
|
canShake = Permissions.shake(player);
|
|
|
|
canFishermansDiet = Permissions.fishermansDiet(player);
|
2013-04-09 17:32:07 +02:00
|
|
|
canMasterAngler = Permissions.masterAngler(player);
|
2013-03-01 06:52:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected boolean effectsHeaderPermissions() {
|
2013-04-09 17:33:33 +02:00
|
|
|
return canTreasureHunt || canMagicHunt || canShake || canMasterAngler || canFishermansDiet;
|
2013-03-01 06:52:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected void effectsDisplay() {
|
|
|
|
luckyEffectsDisplay();
|
|
|
|
|
|
|
|
if (canTreasureHunt) {
|
|
|
|
player.sendMessage(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Fishing.Effect.0"), LocaleLoader.getString("Fishing.Effect.1")));
|
|
|
|
}
|
|
|
|
|
|
|
|
if (canMagicHunt) {
|
|
|
|
player.sendMessage(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Fishing.Effect.2"), LocaleLoader.getString("Fishing.Effect.3")));
|
|
|
|
}
|
|
|
|
|
|
|
|
if (canShake) {
|
|
|
|
player.sendMessage(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Fishing.Effect.4"), LocaleLoader.getString("Fishing.Effect.5")));
|
|
|
|
}
|
|
|
|
|
|
|
|
if (canFishermansDiet) {
|
|
|
|
player.sendMessage(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Fishing.Effect.6"), LocaleLoader.getString("Fishing.Effect.7")));
|
|
|
|
}
|
2013-04-09 17:32:07 +02:00
|
|
|
|
|
|
|
if (canMasterAngler) {
|
|
|
|
player.sendMessage(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Fishing.Effect.8"), LocaleLoader.getString("Fishing.Effect.9")));
|
|
|
|
}
|
2013-03-01 06:52:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected boolean statsHeaderPermissions() {
|
2013-04-09 17:33:33 +02:00
|
|
|
return canTreasureHunt || canMagicHunt || canShake || canMasterAngler || canFishermansDiet;
|
2013-03-01 06:52:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected void statsDisplay() {
|
2013-04-09 17:32:07 +02:00
|
|
|
if (canMasterAngler) {
|
|
|
|
player.sendMessage(LocaleLoader.getString("Fishing.Ability.Chance", biteChance));
|
|
|
|
}
|
|
|
|
|
2013-03-01 06:52:01 +01:00
|
|
|
if (canTreasureHunt) {
|
|
|
|
player.sendMessage(LocaleLoader.getString("Fishing.Ability.Rank", lootTier));
|
|
|
|
}
|
|
|
|
|
|
|
|
if (canMagicHunt) {
|
2013-03-12 21:25:42 +01:00
|
|
|
player.sendMessage(LocaleLoader.getString("Fishing.Enchant.Chance", magicChance) + chanceRaining + (isLucky ? LocaleLoader.getString("Perks.lucky.bonus", magicChanceLucky) : ""));
|
2013-03-01 06:52:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (canShake) {
|
2013-03-12 21:25:42 +01:00
|
|
|
int unlockLevel = AdvancedConfig.getInstance().getShakeUnlockLevel();
|
|
|
|
|
|
|
|
if (skillValue < unlockLevel) {
|
|
|
|
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template.Lock", LocaleLoader.getString("Fishing.Ability.Locked.0", unlockLevel)));
|
2013-03-01 06:52:01 +01:00
|
|
|
}
|
|
|
|
else {
|
2013-03-12 21:25:42 +01:00
|
|
|
player.sendMessage(LocaleLoader.getString("Fishing.Ability.Shake", shakeChance) + (isLucky ? LocaleLoader.getString("Perks.lucky.bonus", shakeChanceLucky) : ""));
|
2013-03-01 06:52:01 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (canFishermansDiet) {
|
|
|
|
player.sendMessage(LocaleLoader.getString("Fishing.Ability.FD", fishermansDietRank));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|