2013-03-01 06:52:01 +01:00
|
|
|
package com.gmail.nossr50.commands.skills;
|
|
|
|
|
|
|
|
import org.bukkit.Material;
|
|
|
|
|
|
|
|
import com.gmail.nossr50.datatypes.skills.SkillType;
|
|
|
|
import com.gmail.nossr50.locale.LocaleLoader;
|
|
|
|
import com.gmail.nossr50.skills.herbalism.Herbalism;
|
|
|
|
import com.gmail.nossr50.util.Permissions;
|
|
|
|
|
|
|
|
public class HerbalismCommand extends SkillCommand {
|
|
|
|
private String greenTerraLength;
|
|
|
|
private String greenTerraLengthEndurance;
|
|
|
|
private String greenThumbChance;
|
|
|
|
private String greenThumbChanceLucky;
|
2013-03-12 21:25:42 +01:00
|
|
|
private int greenThumbStage;
|
|
|
|
private int farmersDietRank;
|
2013-03-01 06:52:01 +01:00
|
|
|
private String doubleDropChance;
|
|
|
|
private String doubleDropChanceLucky;
|
|
|
|
private String hylianLuckChance;
|
|
|
|
private String hylianLuckChanceLucky;
|
|
|
|
private String shroomThumbChance;
|
|
|
|
private String shroomThumbChanceLucky;
|
|
|
|
|
|
|
|
private boolean hasHylianLuck;
|
|
|
|
private boolean canGreenTerra;
|
2013-03-12 21:25:42 +01:00
|
|
|
private boolean canGreenThumbPlants;
|
2013-03-01 06:52:01 +01:00
|
|
|
private boolean canGreenThumbBlocks;
|
|
|
|
private boolean canFarmersDiet;
|
|
|
|
private boolean canDoubleDrop;
|
|
|
|
private boolean canShroomThumb;
|
|
|
|
|
|
|
|
public HerbalismCommand() {
|
|
|
|
super(SkillType.HERBALISM);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected void dataCalculations() {
|
|
|
|
// GREEN TERRA
|
2013-03-12 21:25:42 +01:00
|
|
|
if (canGreenTerra) {
|
|
|
|
String[] greenTerraStrings = calculateLengthDisplayValues();
|
|
|
|
greenTerraLength = greenTerraStrings[0];
|
|
|
|
greenTerraLengthEndurance = greenTerraStrings[1];
|
|
|
|
}
|
2013-03-01 06:52:01 +01:00
|
|
|
|
|
|
|
// FARMERS DIET
|
2013-03-12 21:25:42 +01:00
|
|
|
if (canFarmersDiet) {
|
|
|
|
farmersDietRank = calculateRank(Herbalism.farmersDietMaxLevel, Herbalism.farmersDietRankLevel1);
|
|
|
|
}
|
2013-03-01 06:52:01 +01:00
|
|
|
|
|
|
|
// GREEN THUMB
|
2013-03-12 21:25:42 +01:00
|
|
|
if (canGreenThumbBlocks || canGreenThumbPlants) {
|
|
|
|
greenThumbStage = calculateRank(Herbalism.greenThumbStageMaxLevel, Herbalism.greenThumbStageChangeLevel);
|
2013-03-01 06:52:01 +01:00
|
|
|
|
2013-03-12 21:25:42 +01:00
|
|
|
String[] greenThumbStrings = calculateAbilityDisplayValues(Herbalism.greenThumbMaxLevel, Herbalism.greenThumbMaxChance);
|
|
|
|
greenThumbChance = greenThumbStrings[0];
|
|
|
|
greenThumbChanceLucky = greenThumbStrings[1];
|
|
|
|
}
|
2013-03-01 06:52:01 +01:00
|
|
|
|
|
|
|
// DOUBLE DROPS
|
2013-03-12 21:25:42 +01:00
|
|
|
if (canDoubleDrop) {
|
|
|
|
String[] doubleDropStrings = calculateAbilityDisplayValues(Herbalism.doubleDropsMaxLevel, Herbalism.doubleDropsMaxChance);
|
|
|
|
doubleDropChance = doubleDropStrings[0];
|
|
|
|
doubleDropChanceLucky = doubleDropStrings[1];
|
|
|
|
}
|
2013-03-01 06:52:01 +01:00
|
|
|
|
|
|
|
// HYLIAN LUCK
|
2013-03-12 21:25:42 +01:00
|
|
|
if (hasHylianLuck) {
|
|
|
|
String[] hylianLuckStrings = calculateAbilityDisplayValues(Herbalism.hylianLuckMaxLevel, Herbalism.hylianLuckMaxChance);
|
|
|
|
hylianLuckChance = hylianLuckStrings[0];
|
|
|
|
hylianLuckChanceLucky = hylianLuckStrings[1];
|
|
|
|
}
|
2013-03-01 06:52:01 +01:00
|
|
|
|
|
|
|
// SHROOM THUMB
|
2013-03-12 21:25:42 +01:00
|
|
|
if (canShroomThumb) {
|
|
|
|
String[] shroomThumbStrings = calculateAbilityDisplayValues(Herbalism.shroomThumbMaxLevel, Herbalism.shroomThumbMaxChance);
|
|
|
|
shroomThumbChance = shroomThumbStrings[0];
|
|
|
|
shroomThumbChanceLucky = shroomThumbStrings[1];
|
|
|
|
}
|
2013-03-01 06:52:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected void permissionsCheck() {
|
|
|
|
hasHylianLuck = Permissions.hylianLuck(player);
|
|
|
|
canGreenTerra = Permissions.greenTerra(player);
|
2013-03-12 21:25:42 +01:00
|
|
|
canGreenThumbPlants = Permissions.greenThumbPlant(player, Material.CROPS) || Permissions.greenThumbPlant(player, Material.CARROT) || Permissions.greenThumbPlant(player, Material.POTATO) || Permissions.greenThumbPlant(player, Material.NETHER_WARTS) || Permissions.greenThumbPlant(player, Material.COCOA);
|
|
|
|
canGreenThumbBlocks = Permissions.greenThumbBlock(player, Material.DIRT) || Permissions.greenThumbBlock(player, Material.COBBLESTONE) || Permissions.greenThumbBlock(player, Material.COBBLE_WALL) || Permissions.greenThumbBlock(player, Material.SMOOTH_BRICK);
|
2013-03-01 06:52:01 +01:00
|
|
|
canFarmersDiet = Permissions.farmersDiet(player);
|
2013-03-12 21:25:42 +01:00
|
|
|
canDoubleDrop = Permissions.doubleDrops(player, skill) && !skill.getDoubleDropsDisabled();
|
2013-03-01 06:52:01 +01:00
|
|
|
canShroomThumb = Permissions.shroomThumb(player);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected boolean effectsHeaderPermissions() {
|
2013-03-12 21:25:42 +01:00
|
|
|
return canGreenTerra || canDoubleDrop || canFarmersDiet || canGreenThumbBlocks || canGreenThumbPlants || canShroomThumb;
|
2013-03-01 06:52:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected void effectsDisplay() {
|
|
|
|
luckyEffectsDisplay();
|
|
|
|
|
|
|
|
if (canGreenTerra) {
|
|
|
|
player.sendMessage(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Herbalism.Effect.0"), LocaleLoader.getString("Herbalism.Effect.1")));
|
|
|
|
}
|
|
|
|
|
2013-03-12 21:25:42 +01:00
|
|
|
if (canGreenThumbPlants) {
|
2013-03-01 06:52:01 +01:00
|
|
|
player.sendMessage(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Herbalism.Effect.2"), LocaleLoader.getString("Herbalism.Effect.3")));
|
|
|
|
}
|
|
|
|
|
|
|
|
if (canGreenThumbBlocks) {
|
|
|
|
player.sendMessage(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Herbalism.Effect.4"), LocaleLoader.getString("Herbalism.Effect.5")));
|
|
|
|
}
|
|
|
|
|
|
|
|
if (canFarmersDiet) {
|
|
|
|
player.sendMessage(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Herbalism.Effect.6"), LocaleLoader.getString("Herbalism.Effect.7")));
|
|
|
|
}
|
|
|
|
|
|
|
|
if (hasHylianLuck) {
|
|
|
|
player.sendMessage(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Herbalism.Effect.10"), LocaleLoader.getString("Herbalism.Effect.11")));
|
|
|
|
}
|
|
|
|
|
|
|
|
if (canShroomThumb) {
|
|
|
|
player.sendMessage(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Herbalism.Effect.12"), LocaleLoader.getString("Herbalism.Effect.13")));
|
|
|
|
}
|
|
|
|
|
2013-03-12 21:25:42 +01:00
|
|
|
if (canDoubleDrop) {
|
2013-03-01 06:52:01 +01:00
|
|
|
player.sendMessage(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Herbalism.Effect.8"), LocaleLoader.getString("Herbalism.Effect.9")));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected boolean statsHeaderPermissions() {
|
2013-03-12 21:25:42 +01:00
|
|
|
return canGreenTerra || canDoubleDrop || canFarmersDiet || canGreenThumbBlocks || canGreenThumbPlants || canShroomThumb;
|
2013-03-01 06:52:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected void statsDisplay() {
|
|
|
|
if (canGreenTerra) {
|
2013-03-12 21:25:42 +01:00
|
|
|
player.sendMessage(LocaleLoader.getString("Herbalism.Ability.GTe.Length", greenTerraLength) + (hasEndurance ? LocaleLoader.getString("Perks.activationtime.bonus", greenTerraLengthEndurance) : ""));
|
2013-03-01 06:52:01 +01:00
|
|
|
}
|
|
|
|
|
2013-03-12 21:25:42 +01:00
|
|
|
if (canGreenThumbBlocks || canGreenThumbPlants) {
|
|
|
|
player.sendMessage(LocaleLoader.getString("Herbalism.Ability.GTh.Chance", greenThumbChance) + (isLucky ? LocaleLoader.getString("Perks.lucky.bonus", greenThumbChanceLucky) : ""));
|
2013-03-01 06:52:01 +01:00
|
|
|
}
|
|
|
|
|
2013-03-12 21:25:42 +01:00
|
|
|
if (canGreenThumbPlants) {
|
2013-03-01 06:52:01 +01:00
|
|
|
player.sendMessage(LocaleLoader.getString("Herbalism.Ability.GTh.Stage", greenThumbStage));
|
|
|
|
}
|
|
|
|
|
|
|
|
if (canFarmersDiet) {
|
|
|
|
player.sendMessage(LocaleLoader.getString("Herbalism.Ability.FD", farmersDietRank));
|
|
|
|
}
|
|
|
|
|
|
|
|
if (hasHylianLuck) {
|
2013-03-12 21:25:42 +01:00
|
|
|
player.sendMessage(LocaleLoader.getString("Herbalism.Ability.HylianLuck", hylianLuckChance) + (isLucky ? LocaleLoader.getString("Perks.lucky.bonus", hylianLuckChanceLucky) : ""));
|
2013-03-01 06:52:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (canShroomThumb) {
|
2013-03-12 21:25:42 +01:00
|
|
|
player.sendMessage(LocaleLoader.getString("Herbalism.Ability.ShroomThumb.Chance", shroomThumbChance) + (isLucky ? LocaleLoader.getString("Perks.lucky.bonus", shroomThumbChanceLucky) : ""));
|
|
|
|
}
|
|
|
|
|
|
|
|
if (canDoubleDrop) {
|
|
|
|
player.sendMessage(LocaleLoader.getString("Herbalism.Ability.DoubleDropChance", doubleDropChance) + (isLucky ? LocaleLoader.getString("Perks.lucky.bonus", doubleDropChanceLucky) : ""));
|
2013-03-01 06:52:01 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|