AdvancedConfig.java 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800
  1. package com.gmail.nossr50.config;
  2. import com.gmail.nossr50.datatypes.interactions.NotificationType;
  3. import com.gmail.nossr50.datatypes.skills.SubSkillType;
  4. import com.gmail.nossr50.datatypes.skills.subskills.AbstractSubSkill;
  5. import com.gmail.nossr50.mcMMO;
  6. import net.md_5.bungee.api.ChatColor;
  7. import org.bukkit.entity.LivingEntity;
  8. import org.bukkit.entity.Player;
  9. import org.jetbrains.annotations.NotNull;
  10. import java.util.ArrayList;
  11. import java.util.List;
  12. public class AdvancedConfig extends AutoUpdateConfigLoader {
  13. private static AdvancedConfig instance;
  14. private AdvancedConfig() {
  15. super("advanced.yml");
  16. validate();
  17. }
  18. public static AdvancedConfig getInstance() {
  19. if (instance == null) {
  20. instance = new AdvancedConfig();
  21. }
  22. return instance;
  23. }
  24. @Override
  25. protected boolean validateKeys() {
  26. // Validate all the settings!
  27. List<String> reason = new ArrayList<>();
  28. /* GENERAL */
  29. if (getAbilityLength() < 1) {
  30. reason.add("Skills.General.Ability.Length.<mode>.IncreaseLevel should be at least 1!");
  31. }
  32. if (getEnchantBuff() < 1) {
  33. reason.add("Skills.General.Ability.EnchantBuff should be at least 1!");
  34. }
  35. /* ACROBATICS */
  36. if (getMaximumProbability(SubSkillType.ACROBATICS_DODGE) < 1) {
  37. reason.add("Skills.Acrobatics.Dodge.ChanceMax should be at least 1!");
  38. }
  39. if (getMaxBonusLevel(SubSkillType.ACROBATICS_DODGE) < 1) {
  40. reason.add("Skills.Acrobatics.Dodge.MaxBonusLevel should be at least 1!");
  41. }
  42. if (getDodgeDamageModifier() <= 1) {
  43. reason.add("Skills.Acrobatics.Dodge.DamageModifier should be greater than 1!");
  44. }
  45. if (getMaximumProbability(SubSkillType.ACROBATICS_ROLL) < 1) {
  46. reason.add("Skills.Acrobatics.Roll.ChanceMax should be at least 1!");
  47. }
  48. if (getMaxBonusLevel(SubSkillType.ACROBATICS_ROLL) < 1) {
  49. reason.add("Skills.Acrobatics.Roll.MaxBonusLevel should be at least 1!");
  50. }
  51. if (getRollDamageThreshold() < 0) {
  52. reason.add("Skills.Acrobatics.Roll.DamageThreshold should be at least 0!");
  53. }
  54. if (getGracefulRollDamageThreshold() < 0) {
  55. reason.add("Skills.Acrobatics.GracefulRoll.DamageThreshold should be at least 0!");
  56. }
  57. /* ALCHEMY */
  58. /*if (getCatalysisUnlockLevel() < 0) {
  59. reason.add("Skills.Alchemy.Catalysis.UnlockLevel should be at least 0!");
  60. }
  61. if (getCatalysisMaxBonusLevel() <= getCatalysisUnlockLevel()) {
  62. reason.add("Skills.Alchemy.Catalysis.MaxBonusLevel should be greater than Skills.Alchemy.Catalysis.UnlockLevel!");
  63. }*/
  64. if (getCatalysisMinSpeed() <= 0) {
  65. reason.add("Skills.Alchemy.Catalysis.MinSpeed must be greater than 0!");
  66. }
  67. if (getCatalysisMaxSpeed() < getCatalysisMinSpeed()) {
  68. reason.add("Skills.Alchemy.Catalysis.MaxSpeed should be at least Skills.Alchemy.Catalysis.MinSpeed!");
  69. }
  70. /*List<Alchemy.Tier> alchemyTierList = Arrays.asList(Alchemy.Tier.values());
  71. for (Alchemy.Tier tier : alchemyTierList) {
  72. if (getConcoctionsTierLevel(tier) < 0) {
  73. reason.add("Skills.Alchemy.Rank_Levels.Rank_" + rank + " should be at least 0!");
  74. }
  75. if (tier != Alchemy.Tier.fromNumerical(Alchemy.Tier.values().length)) {
  76. Alchemy.Tier nextTier = alchemyTierList.get(alchemyTierList.indexOf(tier) - 1);
  77. if (getConcoctionsTierLevel(tier) > getConcoctionsTierLevel(nextTier)) {
  78. reason.add("Skills.Alchemy.Rank_Levels.Rank_" + rank + " should be less than or equal to Skills.Alchemy.Rank_Levels.Rank_" + nextrank + "!");
  79. }
  80. }
  81. }*/
  82. /* ARCHERY */
  83. if (getSkillShotRankDamageMultiplier() <= 0) {
  84. reason.add("Skills.Archery.SkillShot.RankDamageMultiplier should be greater than 0!");
  85. }
  86. if (getMaximumProbability(SubSkillType.ARCHERY_DAZE) < 1) {
  87. reason.add("Skills.Archery.Daze.ChanceMax should be at least 1!");
  88. }
  89. if (getMaxBonusLevel(SubSkillType.ARCHERY_DAZE) < 1) {
  90. reason.add("Skills.Archery.Daze.MaxBonusLevel should be at least 1!");
  91. }
  92. if (getDazeBonusDamage() < 0) {
  93. reason.add("Skills.Archery.Daze.BonusDamage should be at least 0!");
  94. }
  95. if (getMaximumProbability(SubSkillType.ARCHERY_ARROW_RETRIEVAL) < 1) {
  96. reason.add("Skills.Archery.Retrieve.ChanceMax should be at least 1!");
  97. }
  98. if (getMaxBonusLevel(SubSkillType.ARCHERY_ARROW_RETRIEVAL) < 1) {
  99. reason.add("Skills.Archery.Retrieve.MaxBonusLevel should be at least 1!");
  100. }
  101. if (getForceMultiplier() < 0) {
  102. reason.add("Skills.Archery.ForceMultiplier should be at least 0!");
  103. }
  104. /* AXES */
  105. if(getAxeMasteryRankDamageMultiplier() < 0)
  106. {
  107. reason.add("Skills.Axes.AxeMastery.RankDamageMultiplier should be at least 0!");
  108. }
  109. if (getMaximumProbability(SubSkillType.AXES_CRITICAL_STRIKES) < 1) {
  110. reason.add("Skills.Axes.CriticalHit.ChanceMax should be at least 1!");
  111. }
  112. if (getMaxBonusLevel(SubSkillType.AXES_CRITICAL_STRIKES) < 1) {
  113. reason.add("Skills.Axes.CriticalHit.MaxBonusLevel should be at least 1!");
  114. }
  115. if (getCriticalStrikesPVPModifier() < 1) {
  116. reason.add("Skills.Axes.CriticalStrikes.PVP_Modifier should be at least 1!");
  117. }
  118. if (getCriticalStrikesPVPModifier() < 1) {
  119. reason.add("Skills.Axes.CriticalStrikes.PVE_Modifier should be at least 1!");
  120. }
  121. if (getGreaterImpactChance() < 1) {
  122. reason.add("Skills.Axes.GreaterImpact.Chance should be at least 1!");
  123. }
  124. if (getGreaterImpactModifier() < 1) {
  125. reason.add("Skills.Axes.GreaterImpact.KnockbackModifier should be at least 1!");
  126. }
  127. if (getGreaterImpactBonusDamage() < 1) {
  128. reason.add("Skills.Axes.GreaterImpact.BonusDamage should be at least 1!");
  129. }
  130. if (getImpactChance() < 1) {
  131. reason.add("Skills.Axes.ArmorImpact.Chance should be at least 1!");
  132. }
  133. if (getSkullSplitterModifier() < 1) {
  134. reason.add("Skills.Axes.SkullSplitter.DamageModifier should be at least 1!");
  135. }
  136. /* FISHING */
  137. /*List<Fishing.Tier> fishingTierList = Arrays.asList(Fishing.Tier.values());
  138. for (int rank : fishingTierList) {
  139. if (getFishingTierLevel(tier) < 0) {
  140. reason.add("Skills.Fishing.Rank_Levels.Rank_" + rank + " should be at least 0!");
  141. }
  142. if (getShakeChance(tier) < 0) {
  143. reason.add("Skills.Fishing.Shake_Chance.Rank_" + rank + " should be at least 0!");
  144. }
  145. if (getFishingVanillaXPModifier(tier) < 0) {
  146. reason.add("Skills.Fishing.VanillaXPMultiplier.Rank_" + rank + " should be at least 0!");
  147. }
  148. if (tier != Fishing.Tier.EIGHT) {
  149. Fishing.Tier nextTier = fishingTierList.get(fishingTierList.indexOf(tier) - 1);
  150. if (getFishingTierLevel(tier) > getFishingTierLevel(nextTier)) {
  151. reason.add("Skills.Fishing.Rank_Levels.Rank_" + rank + " should be less than or equal to Skills.Fishing.Rank_Levels.Rank_" + nextrank + "!");
  152. }
  153. if (getShakeChance(tier) > getShakeChance(nextTier)) {
  154. reason.add("Skills.Fishing.Shake_Chance.Rank_" + rank + " should be less than or equal to Skills.Fishing.Shake_Chance.Rank_" + nextrank + "!");
  155. }
  156. if (getFishingVanillaXPModifier(tier) > getFishingVanillaXPModifier(nextTier)) {
  157. reason.add("Skills.Fishing.VanillaXPMultiplier.Rank_" + rank + " should be less than or equal to Skills.Fishing.VanillaXPMultiplier.Rank_" + nextrank + "!");
  158. }
  159. }
  160. }*/
  161. if (getFishermanDietRankChange() < 1) {
  162. reason.add("Skills.Fishing.FishermansDiet.RankChange should be at least 1!");
  163. }
  164. /*if (getIceFishingUnlockLevel() < 0) {
  165. reason.add("Skills.Fishing.IceFishing.UnlockLevel should be at least 0!");
  166. }
  167. if (getMasterAnglerUnlockLevel() < 0) {
  168. reason.add("Skills.Fishing.MasterAngler.UnlockLevel should be at least 0!");
  169. }*/
  170. if (getMasterAnglerBoatModifier() < 1) {
  171. reason.add("Skills.Fishing.MasterAngler.BoatModifier should be at least 1!");
  172. }
  173. if (getMasterAnglerBiomeModifier() < 1) {
  174. reason.add("Skills.Fishing.MasterAngler.BiomeModifier should be at least 1!");
  175. }
  176. /* HERBALISM */
  177. if (getFarmerDietRankChange() < 1) {
  178. reason.add("Skills.Herbalism.FarmersDiet.RankChange should be at least 1!");
  179. }
  180. if (getGreenThumbStageChange() < 1) {
  181. reason.add("Skills.Herbalism.GreenThumb.StageChange should be at least 1!");
  182. }
  183. if (getMaximumProbability(SubSkillType.HERBALISM_GREEN_THUMB) < 1) {
  184. reason.add("Skills.Herbalism.GreenThumb.ChanceMax should be at least 1!");
  185. }
  186. if (getMaxBonusLevel(SubSkillType.HERBALISM_GREEN_THUMB) < 1) {
  187. reason.add("Skills.Herbalism.GreenThumb.MaxBonusLevel should be at least 1!");
  188. }
  189. if (getMaximumProbability(SubSkillType.HERBALISM_DOUBLE_DROPS) < 1) {
  190. reason.add("Skills.Herbalism.DoubleDrops.ChanceMax should be at least 1!");
  191. }
  192. if (getMaxBonusLevel(SubSkillType.HERBALISM_DOUBLE_DROPS) < 1) {
  193. reason.add("Skills.Herbalism.DoubleDrops.MaxBonusLevel should be at least 1!");
  194. }
  195. if (getMaximumProbability(SubSkillType.HERBALISM_HYLIAN_LUCK) < 1) {
  196. reason.add("Skills.Herbalism.HylianLuck.ChanceMax should be at least 1!");
  197. }
  198. if (getMaxBonusLevel(SubSkillType.HERBALISM_HYLIAN_LUCK) < 1) {
  199. reason.add("Skills.Herbalism.HylianLuck.MaxBonusLevel should be at least 1!");
  200. }
  201. if (getMaximumProbability(SubSkillType.HERBALISM_SHROOM_THUMB) < 1) {
  202. reason.add("Skills.Herbalism.ShroomThumb.ChanceMax should be at least 1!");
  203. }
  204. if (getMaxBonusLevel(SubSkillType.HERBALISM_SHROOM_THUMB) < 1) {
  205. reason.add("Skills.Herbalism.ShroomThumb.MaxBonusLevel should be at least 1!");
  206. }
  207. /* MINING */
  208. if (getMaximumProbability(SubSkillType.MINING_DOUBLE_DROPS) < 1) {
  209. reason.add("Skills.Mining.DoubleDrops.ChanceMax should be at least 1!");
  210. }
  211. if (getMaxBonusLevel(SubSkillType.MINING_DOUBLE_DROPS) < 1) {
  212. reason.add("Skills.Mining.DoubleDrops.MaxBonusLevel should be at least 1!");
  213. }
  214. /* REPAIR */
  215. if (getRepairMasteryMaxBonus() < 1) {
  216. reason.add("Skills.Repair.RepairMastery.MaxBonusPercentage should be at least 1!");
  217. }
  218. if (getRepairMasteryMaxLevel() < 1) {
  219. reason.add("Skills.Repair.RepairMastery.MaxBonusLevel should be at least 1!");
  220. }
  221. if (getMaximumProbability(SubSkillType.REPAIR_SUPER_REPAIR) < 1) {
  222. reason.add("Skills.Repair.SuperRepair.ChanceMax should be at least 1!");
  223. }
  224. if (getMaxBonusLevel(SubSkillType.REPAIR_SUPER_REPAIR) < 1) {
  225. reason.add("Skills.Repair.SuperRepair.MaxBonusLevel should be at least 1!");
  226. }
  227. /* SMELTING */
  228. if (getBurnModifierMaxLevel() < 1) {
  229. reason.add("Skills.Smelting.FuelEfficiency.MaxBonusLevel should be at least 1!");
  230. }
  231. if (getMaxBonusLevel(SubSkillType.SMELTING_SECOND_SMELT) < 1) {
  232. reason.add("Skills.Smelting.SecondSmelt.MaxBonusLevel should be at least 1!");
  233. }
  234. if (getMaximumProbability(SubSkillType.SMELTING_SECOND_SMELT) < 1) {
  235. reason.add("Skills.Smelting.SecondSmelt.ChanceMax should be at least 1!");
  236. }
  237. if (getFluxMiningChance() < 1) {
  238. reason.add("Skills.Smelting.FluxMining.Chance should be at least 1!");
  239. }
  240. /* SWORDS */
  241. if (getMaximumProbability(SubSkillType.SWORDS_COUNTER_ATTACK) < 1) {
  242. reason.add("Skills.Swords.CounterAttack.ChanceMax should be at least 1!");
  243. }
  244. if (getMaxBonusLevel(SubSkillType.SWORDS_COUNTER_ATTACK) < 1) {
  245. reason.add("Skills.Swords.CounterAttack.MaxBonusLevel should be at least 1!");
  246. }
  247. if (getCounterModifier() < 1) {
  248. reason.add("Skills.Swords.CounterAttack.DamageModifier should be at least 1!");
  249. }
  250. if (getSerratedStrikesModifier() < 1) {
  251. reason.add("Skills.Swords.SerratedStrikes.DamageModifier should be at least 1!");
  252. }
  253. if (getSerratedStrikesTicks() < 1) {
  254. reason.add("Skills.Swords.SerratedStrikes.RuptureTicks should be at least 1!");
  255. }
  256. /* TAMING */
  257. if (getMaximumProbability(SubSkillType.TAMING_GORE) < 1) {
  258. reason.add("Skills.Taming.Gore.ChanceMax should be at least 1!");
  259. }
  260. if (getMaxBonusLevel(SubSkillType.TAMING_GORE) < 1) {
  261. reason.add("Skills.Taming.Gore.MaxBonusLevel should be at least 1!");
  262. }
  263. /*if (getGoreRuptureTicks() < 1) {
  264. reason.add("Skills.Taming.Gore.RuptureTicks should be at least 1!");
  265. }*/
  266. if (getGoreModifier() < 1) {
  267. reason.add("Skills.Taming.Gore.Modifier should be at least 1!");
  268. }
  269. /*if (getFastFoodUnlock() < 0) {
  270. reason.add("Skills.Taming.FastFood.UnlockLevel should be at least 0!");
  271. }*/
  272. if (getFastFoodChance() < 1) {
  273. reason.add("Skills.Taming.FastFood.Chance should be at least 1!");
  274. }
  275. /*if (getEnviromentallyAwareUnlock() < 0) {
  276. reason.add("Skills.Taming.EnvironmentallyAware.UnlockLevel should be at least 0!");
  277. }*/
  278. /*if (getThickFurUnlock() < 0) {
  279. reason.add("Skills.Taming.ThickFur.UnlockLevel should be at least 0!");
  280. }*/
  281. if (getThickFurModifier() < 1) {
  282. reason.add("Skills.Taming.ThickFur.Modifier should be at least 1!");
  283. }
  284. /*if (getHolyHoundUnlock() < 0) {
  285. reason.add("Skills.Taming.HolyHound.UnlockLevel should be at least 0!");
  286. }
  287. if (getShockProofUnlock() < 0) {
  288. reason.add("Skills.Taming.ShockProof.UnlockLevel should be at least 0!");
  289. }*/
  290. if (getShockProofModifier() < 1) {
  291. reason.add("Skills.Taming.ShockProof.Modifier should be at least 1!");
  292. }
  293. /*if (getSharpenedClawsUnlock() < 0) {
  294. reason.add("Skills.Taming.SharpenedClaws.UnlockLevel should be at least 0!");
  295. }*/
  296. if (getSharpenedClawsBonus() < 1) {
  297. reason.add("Skills.Taming.SharpenedClaws.Bonus should be at least 1!");
  298. }
  299. if (getMaxHorseJumpStrength() < 0 || getMaxHorseJumpStrength() > 2) {
  300. reason.add("Skills.Taming.CallOfTheWild.MaxHorseJumpStrength should be between 0 and 2!");
  301. }
  302. /* UNARMED */
  303. if (getMaximumProbability(SubSkillType.UNARMED_DISARM) < 1) {
  304. reason.add("Skills.Unarmed.Disarm.ChanceMax should be at least 1!");
  305. }
  306. if (getMaxBonusLevel(SubSkillType.UNARMED_DISARM) < 1) {
  307. reason.add("Skills.Unarmed.Disarm.MaxBonusLevel should be at least 1!");
  308. }
  309. if (getMaximumProbability(SubSkillType.UNARMED_ARROW_DEFLECT) < 1) {
  310. reason.add("Skills.Unarmed.ArrowDeflect.ChanceMax should be at least 1!");
  311. }
  312. if (getMaxBonusLevel(SubSkillType.UNARMED_ARROW_DEFLECT) < 1) {
  313. reason.add("Skills.Unarmed.ArrowDeflect.MaxBonusLevel should be at least 1!");
  314. }
  315. if (getMaximumProbability(SubSkillType.UNARMED_IRON_GRIP) < 1) {
  316. reason.add("Skills.Unarmed.IronGrip.ChanceMax should be at least 1!");
  317. }
  318. if (getMaxBonusLevel(SubSkillType.UNARMED_IRON_GRIP) < 1) {
  319. reason.add("Skills.Unarmed.IronGrip.MaxBonusLevel should be at least 1!");
  320. }
  321. /* WOODCUTTING */
  322. /*if (getLeafBlowUnlockLevel() < 0) {
  323. reason.add("Skills.Woodcutting.LeafBlower.UnlockLevel should be at least 0!");
  324. }*/
  325. if (getMaximumProbability(SubSkillType.WOODCUTTING_HARVEST_LUMBER) < 1) {
  326. reason.add("Skills.Woodcutting.HarvestLumber.ChanceMax should be at least 1!");
  327. }
  328. if (getMaxBonusLevel(SubSkillType.WOODCUTTING_HARVEST_LUMBER) < 1) {
  329. reason.add("Skills.Woodcutting.HarvestLumber.MaxBonusLevel should be at least 1!");
  330. }
  331. return noErrorsInConfig(reason);
  332. }
  333. @Override
  334. protected void loadKeys() {}
  335. /* GENERAL */
  336. public boolean canApplyLimitBreakPVE() { return config.getBoolean("Skills.General.LimitBreak.AllowPVE", false); }
  337. public int getStartingLevel() { return config.getInt("Skills.General.StartingLevel", 1); }
  338. public boolean allowPlayerTips() {
  339. return config.getBoolean("Feedback.PlayerTips", true);
  340. }
  341. /**
  342. * This returns the maximum level at which superabilities will stop lengthening from scaling alongside skill level.
  343. * It returns a different value depending on whether or not the server is in retro mode
  344. * @return the level at which abilities stop increasing in length
  345. */
  346. public int getAbilityLengthCap() {
  347. if(!mcMMO.isRetroModeEnabled())
  348. return config.getInt("Skills.General.Ability.Length.Standard.CapLevel", 50);
  349. else
  350. return config.getInt("Skills.General.Ability.Length.RetroMode.CapLevel", 500);
  351. }
  352. /**
  353. * This returns the frequency at which abilities will increase in length
  354. * It returns a different value depending on whether or not the server is in retro mode
  355. * @return the number of levels required per ability length increase
  356. */
  357. public int getAbilityLength() {
  358. if(!mcMMO.isRetroModeEnabled())
  359. return config.getInt("Skills.General.Ability.Length.Standard.IncreaseLevel", 5);
  360. else
  361. return config.getInt("Skills.General.Ability.Length.RetroMode.IncreaseLevel", 50);
  362. }
  363. public int getEnchantBuff() { return config.getInt("Skills.General.Ability.EnchantBuff", 5); }
  364. /**
  365. * Grabs the max bonus level for a skill used in RNG calculations
  366. * All max level values in the config are multiplied by 10 if the server is in retro mode as the values in the config are based around the new 1-100 skill system scaling
  367. * A value of 10 in the file will be returned as 100 for retro mode servers to accommodate the change in scaling
  368. * @param subSkillType target subskill
  369. * @return the level at which this skills max benefits will be reached on the curve
  370. */
  371. public int getMaxBonusLevel(SubSkillType subSkillType) {
  372. String keyPath = subSkillType.getAdvConfigAddress() + ".MaxBonusLevel.";
  373. return mcMMO.isRetroModeEnabled() ? config.getInt(keyPath+"RetroMode", 1000) : config.getInt(keyPath+"Standard", 100);
  374. }
  375. public int getMaxBonusLevel(AbstractSubSkill abstractSubSkill) {
  376. return getMaxBonusLevel(abstractSubSkill.getSubSkillType());
  377. }
  378. public double getMaximumProbability(SubSkillType subSkillType) {
  379. return config.getDouble(subSkillType.getAdvConfigAddress() + ".ChanceMax", 100.0D);
  380. }
  381. public double getMaximumProbability(AbstractSubSkill abstractSubSkill)
  382. {
  383. return getMaximumProbability(abstractSubSkill.getSubSkillType());
  384. }
  385. /* Notification Settings */
  386. public boolean doesSkillCommandSendBlankLines()
  387. {
  388. return config.getBoolean("Feedback.SkillCommand.BlankLinesAboveHeader", true);
  389. }
  390. public boolean doesNotificationUseActionBar(NotificationType notificationType)
  391. {
  392. return config.getBoolean("Feedback.ActionBarNotifications."+notificationType.toString()+".Enabled", true);
  393. }
  394. public boolean doesNotificationSendCopyToChat(NotificationType notificationType)
  395. {
  396. return config.getBoolean("Feedback.ActionBarNotifications."+notificationType.toString()+".SendCopyOfMessageToChat", false);
  397. }
  398. public boolean useTitlesForXPEvent()
  399. {
  400. return config.getBoolean("Feedback.Events.XP.SendTitles", true);
  401. }
  402. public boolean sendAbilityNotificationToOtherPlayers()
  403. {
  404. return config.getBoolean("Feedback.Events.AbilityActivation.SendNotificationToOtherPlayers", true);
  405. }
  406. /*
  407. * JSON Style Settings
  408. */
  409. /*public ChatColor getJSONStatHoverElementColor(StatType statType, boolean isPrefix)
  410. {
  411. String keyAddress = isPrefix ? "Prefix" : "Value";
  412. String keyLocation = "Style.JSON.Hover.Details." + StringUtils.getCapitalized(statType.toString()) +"."+keyAddress+".Color";
  413. return getChatColorFromKey(keyLocation);
  414. }*/
  415. /**
  416. * Used to color our details header in our JSON Hover Object tooltips
  417. * @return the ChatColor for this element
  418. */
  419. /*public ChatColor getJSONStatHoverDetailsColor()
  420. {
  421. String keyLocation = "Style.JSON.Hover.Details.Header.Color";
  422. return getChatColorFromKey(keyLocation);
  423. }
  424. public boolean isJSONDetailsHeaderBold()
  425. {
  426. return config.getBoolean("Style.JSON.Hover.Details.Header.Bold");
  427. }
  428. public boolean isJSONDetailsHeaderItalic()
  429. {
  430. return config.getBoolean("Style.JSON.Hover.Details.Header.Italics");
  431. }
  432. public boolean isJSONDetailsHeaderUnderlined()
  433. {
  434. return config.getBoolean("Style.JSON.Hover.Details.Header.Underlined");
  435. }
  436. public ChatColor getJSONStatHoverDescriptionColor()
  437. {
  438. String keyLocation = "Style.JSON.Hover.Details.Description.Color";
  439. return getChatColorFromKey(keyLocation);
  440. }
  441. public boolean isJSONDetailsDescriptionBold()
  442. {
  443. return config.getBoolean("Style.JSON.Hover.Details.Description.Bold");
  444. }
  445. public boolean isJSONDetailsDescriptionItalic()
  446. {
  447. return config.getBoolean("Style.JSON.Hover.Details.Description.Italics");
  448. }
  449. public boolean isJSONDetailsDescriptionUnderlined()
  450. {
  451. return config.getBoolean("Style.JSON.Hover.Details.Description.Underlined");
  452. }
  453. public ChatColor getJSONActionBarColor(NotificationType notificationType)
  454. {
  455. return getChatColor(config.getString("Style.JSON.Notification."+notificationType.toString()+".Color"));
  456. }*/
  457. private ChatColor getChatColorFromKey(String keyLocation) {
  458. String colorName = config.getString(keyLocation);
  459. return getChatColor(colorName);
  460. }
  461. private ChatColor getChatColor(String configColor) {
  462. for (ChatColor chatColor : ChatColor.values()) {
  463. if (configColor.equalsIgnoreCase(chatColor.getName()))
  464. return chatColor;
  465. }
  466. //Invalid Color
  467. mcMMO.p.getLogger().warning(configColor + " is an invalid color value");
  468. return ChatColor.WHITE;
  469. }
  470. /*public boolean isJSONStatHoverElementBold(StatType statType, boolean isPrefix)
  471. {
  472. String keyAddress = isPrefix ? "Prefix" : "Value";
  473. String keyLocation = "Style.JSON.Hover.Details." + StringUtils.getCapitalized(statType.toString()) +"."+keyAddress+".Bold";
  474. return config.getBoolean(keyLocation);
  475. }
  476. public boolean isJSONStatHoverElementItalic(StatType statType, boolean isPrefix)
  477. {
  478. String keyAddress = isPrefix ? "Prefix" : "Value";
  479. String keyLocation = "Style.JSON.Hover.Details." + StringUtils.getCapitalized(statType.toString()) +"."+keyAddress+".Italics";
  480. return config.getBoolean(keyLocation);
  481. }
  482. public boolean isJSONStatHoverElementUnderlined(StatType statType, boolean isPrefix)
  483. {
  484. String keyAddress = isPrefix ? "Prefix" : "Value";
  485. String keyLocation = "Style.JSON.Hover.Details." + StringUtils.getCapitalized(statType.toString()) +"."+keyAddress+".Underline";
  486. return config.getBoolean(keyLocation);
  487. }*/
  488. /**
  489. * Some SubSkills have the ability to retain classic functionality
  490. * @param subSkillType SubSkillType with classic functionality
  491. * @return true if the subskill is in classic mode
  492. */
  493. public boolean isSubSkillClassic(SubSkillType subSkillType)
  494. {
  495. return config.getBoolean(subSkillType.getAdvConfigAddress()+".Classic");
  496. }
  497. /* ACROBATICS */
  498. public double getDodgeDamageModifier() { return config.getDouble("Skills.Acrobatics.Dodge.DamageModifier", 2.0D); }
  499. public double getRollDamageThreshold() { return config.getDouble("Skills.Acrobatics.Roll.DamageThreshold", 7.0D); }
  500. public double getGracefulRollDamageThreshold() { return config.getDouble("Skills.Acrobatics.GracefulRoll.DamageThreshold", 14.0D); }
  501. /* ALCHEMY */
  502. public int getCatalysisMaxBonusLevel() { return config.getInt("Skills.Alchemy.Catalysis.MaxBonusLevel", 1000); }
  503. public double getCatalysisMinSpeed() { return config.getDouble("Skills.Alchemy.Catalysis.MinSpeed", 1.0D); }
  504. public double getCatalysisMaxSpeed() { return config.getDouble("Skills.Alchemy.Catalysis.MaxSpeed", 4.0D); }
  505. /* ARCHERY */
  506. public double getSkillShotRankDamageMultiplier() { return config.getDouble("Skills.Archery.SkillShot.RankDamageMultiplier", 10.0D); }
  507. public double getSkillShotDamageMax() { return config.getDouble("Skills.Archery.SkillShot.MaxDamage", 9.0D); }
  508. public double getDazeBonusDamage() { return config.getDouble("Skills.Archery.Daze.BonusDamage", 4.0D); }
  509. public double getForceMultiplier() { return config.getDouble("Skills.Archery.ForceMultiplier", 2.0D); }
  510. /* AXES */
  511. public double getAxeMasteryRankDamageMultiplier() { return config.getDouble("Skills.Axes.AxeMastery.RankDamageMultiplier", 1.0D); }
  512. public double getCriticalStrikesPVPModifier() { return config.getDouble("Skills.Axes.CriticalStrikes.PVP_Modifier", 1.5D); }
  513. public double getCriticalStrikesPVEModifier() { return config.getDouble("Skills.Axes.CriticalStrikes.PVE_Modifier", 2.0D); }
  514. public double getGreaterImpactChance() { return config.getDouble("Skills.Axes.GreaterImpact.Chance", 25.0D); }
  515. public double getGreaterImpactModifier() { return config.getDouble("Skills.Axes.GreaterImpact.KnockbackModifier", 1.5D); }
  516. public double getGreaterImpactBonusDamage() { return config.getDouble("Skills.Axes.GreaterImpact.BonusDamage", 2.0D); }
  517. public double getImpactChance() { return config.getDouble("Skills.Axes.ArmorImpact.Chance", 25.0D); }
  518. public double getImpactDurabilityDamageMultiplier() { return config.getDouble("Skills.Axes.ArmorImpact.DamagePerRank", 6.5D); }
  519. public double getSkullSplitterModifier() { return config.getDouble("Skills.Axes.SkullSplitter.DamageModifier", 2.0D); }
  520. /* EXCAVATION */
  521. //Nothing to configure, everything is already configurable in config.yml
  522. /* FISHING */
  523. public double getShakeChance(int rank) { return config.getDouble("Skills.Fishing.ShakeChance.Rank_" + rank); }
  524. public int getFishingVanillaXPModifier(int rank) { return config.getInt("Skills.Fishing.VanillaXPMultiplier.Rank_" + rank); }
  525. public int getFishingReductionMinWaitTicks() { return config.getInt("Skills.Fishing.MasterAngler.Tick_Reduction_Per_Rank.Min_Wait", 10);}
  526. public int getFishingReductionMaxWaitTicks() { return config.getInt("Skills.Fishing.MasterAngler.Tick_Reduction_Per_Rank.Max_Wait", 30);}
  527. public int getFishingBoatReductionMinWaitTicks() { return config.getInt("Skills.Fishing.MasterAngler.Boat_Tick_Reduction.Min_Wait", 10);}
  528. public int getFishingBoatReductionMaxWaitTicks() { return config.getInt("Skills.Fishing.MasterAngler.Boat_Tick_Reduction.Max_Wait", 30);}
  529. public int getFishingReductionMinWaitCap() { return config.getInt("Skills.Fishing.MasterAngler.Tick_Reduction_Caps.Min_Wait", 40);}
  530. public int getFishingReductionMaxWaitCap() { return config.getInt("Skills.Fishing.MasterAngler.Tick_Reduction_Caps.Max_Wait", 100);}
  531. public int getFishermanDietRankChange() { return config.getInt("Skills.Fishing.FishermansDiet.RankChange", 200); }
  532. public double getMasterAnglerBoatModifier() {return config.getDouble("Skills.Fishing.MasterAngler.BoatModifier", 2.0); }
  533. public double getMasterAnglerBiomeModifier() {return config.getDouble("Skills.Fishing.MasterAngler.BiomeModifier", 2.0); }
  534. /* HERBALISM */
  535. public int getFarmerDietRankChange() { return config.getInt("Skills.Herbalism.FarmersDiet.RankChange", 200); }
  536. public int getGreenThumbStageChange() { return config.getInt("Skills.Herbalism.GreenThumb.StageChange", 200); }
  537. /* MINING */
  538. public boolean getDoubleDropSilkTouchEnabled() { return config.getBoolean("Skills.Mining.DoubleDrops.SilkTouch", true); }
  539. public boolean getAllowMiningTripleDrops() { return config.getBoolean("Skills.Mining.SuperBreaker.AllowTripleDrops", true); }
  540. public int getBlastMiningRankLevel(int rank) { return config.getInt("Skills.Mining.BlastMining.Rank_Levels.Rank_" + rank); }
  541. public double getBlastDamageDecrease(int rank) { return config.getDouble("Skills.Mining.BlastMining.BlastDamageDecrease.Rank_" + rank); }
  542. public double getOreBonus(int rank) { return config.getDouble("Skills.Mining.BlastMining.OreBonus.Rank_" + rank); }
  543. public double getDebrisReduction(int rank) { return config.getDouble("Skills.Mining.BlastMining.DebrisReduction.Rank_" + rank); }
  544. public int getDropMultiplier(int rank) { return config.getInt("Skills.Mining.BlastMining.DropMultiplier.Rank_" + rank); }
  545. public double getBlastRadiusModifier(int rank) { return config.getDouble("Skills.Mining.BlastMining.BlastRadiusModifier.Rank_" + rank); }
  546. /* REPAIR */
  547. public double getRepairMasteryMaxBonus() { return config.getDouble("Skills.Repair.RepairMastery.MaxBonusPercentage", 200.0D); }
  548. public int getRepairMasteryMaxLevel() { return config.getInt("Skills.Repair.RepairMastery.MaxBonusLevel", 100); }
  549. public boolean getArcaneForgingEnchantLossEnabled() { return config.getBoolean("Skills.Repair.ArcaneForging.May_Lose_Enchants", true); }
  550. public double getArcaneForgingKeepEnchantsChance(int rank) { return config.getDouble("Skills.Repair.ArcaneForging.Keep_Enchants_Chance.Rank_" + rank); }
  551. public boolean getArcaneForgingDowngradeEnabled() { return config.getBoolean("Skills.Repair.ArcaneForging.Downgrades_Enabled", true); }
  552. public double getArcaneForgingDowngradeChance(int rank) { return config.getDouble("Skills.Repair.ArcaneForging.Downgrades_Chance.Rank_" + rank); }
  553. public boolean getArcaneSalvageEnchantDowngradeEnabled() { return config.getBoolean("Skills.Salvage.ArcaneSalvage.EnchantDowngradeEnabled", true); }
  554. public boolean getArcaneSalvageEnchantLossEnabled() { return config.getBoolean("Skills.Salvage.ArcaneSalvage.EnchantLossEnabled", true); }
  555. public double getArcaneSalvageExtractFullEnchantsChance(int rank) { return config.getDouble("Skills.Salvage.ArcaneSalvage.ExtractFullEnchant.Rank_" + rank); }
  556. public double getArcaneSalvageExtractPartialEnchantsChance(int rank) { return config.getDouble("Skills.Salvage.ArcaneSalvage.ExtractPartialEnchant.Rank_" + rank); }
  557. /* SMELTING */
  558. public int getBurnModifierMaxLevel() {
  559. if(mcMMO.isRetroModeEnabled())
  560. return config.getInt("Skills.Smelting.FuelEfficiency.RetroMode.MaxBonusLevel", 1000);
  561. else
  562. return config.getInt("Skills.Smelting.FuelEfficiency.Standard.MaxBonusLevel", 100);
  563. }
  564. public double getFluxMiningChance() { return config.getDouble("Skills.Smelting.FluxMining.Chance", 33.0D); }
  565. /* SWORDS */
  566. public double getRuptureTickDamage(boolean isTargetPlayer, int rank) {
  567. String root = "Skills.Swords.Rupture.Rupture_Mechanics.Tick_Interval_Damage.Against_";
  568. String targetType = isTargetPlayer ? "Players" : "Mobs";
  569. String key = root + targetType + ".Rank_" + rank;
  570. return config.getDouble(key, 1.0D);
  571. }
  572. public int getRuptureDurationSeconds(boolean isTargetPlayer) {
  573. String root = "Skills.Swords.Rupture.Rupture_Mechanics.Duration_In_Seconds.Against_";
  574. String targetType = isTargetPlayer ? "Players" : "Mobs";
  575. return config.getInt(root + targetType, 5);
  576. }
  577. public double getRuptureExplosionDamage(boolean isTargetPlayer, int rank) {
  578. String root = "Skills.Swords.Rupture.Rupture_Mechanics.Explosion_Damage.Against_";
  579. String targetType = isTargetPlayer ? "Players" : "Mobs";
  580. String key = root + targetType + ".Rank_" + rank;
  581. return config.getDouble(key, 40.0D);
  582. }
  583. public double getRuptureChanceToApplyOnHit(int rank) {
  584. String root = "Skills.Swords.Rupture.Rupture_Mechanics.Chance_To_Apply_On_Hit.Rank_";
  585. return config.getDouble(root + rank, 33);
  586. }
  587. public double getCounterModifier() { return config.getDouble("Skills.Swords.CounterAttack.DamageModifier", 2.0D); }
  588. public double getSerratedStrikesModifier() { return config.getDouble("Skills.Swords.SerratedStrikes.DamageModifier", 4.0D); }
  589. public int getSerratedStrikesTicks() { return config.getInt("Skills.Swords.SerratedStrikes.RuptureTicks", 5); }
  590. /* TAMING */
  591. public double getGoreModifier() { return config.getDouble("Skills.Taming.Gore.Modifier", 2.0D); }
  592. public double getFastFoodChance() { return config.getDouble("Skills.Taming.FastFoodService.Chance", 50.0D); }
  593. public double getPummelChance() { return config.getDouble("Skills.Taming.Pummel.Chance", 10.0D); }
  594. public double getThickFurModifier() { return config.getDouble("Skills.Taming.ThickFur.Modifier", 2.0D); }
  595. public double getShockProofModifier() { return config.getDouble("Skills.Taming.ShockProof.Modifier", 6.0D); }
  596. public double getSharpenedClawsBonus() { return config.getDouble("Skills.Taming.SharpenedClaws.Bonus", 2.0D); }
  597. public double getMinHorseJumpStrength() { return config.getDouble("Skills.Taming.CallOfTheWild.MinHorseJumpStrength", 0.7D); }
  598. public double getMaxHorseJumpStrength() { return config.getDouble("Skills.Taming.CallOfTheWild.MaxHorseJumpStrength", 2.0D); }
  599. /* UNARMED */
  600. public boolean isSteelArmDamageCustom() { return config.getBoolean("Skills.Unarmed.SteelArmStyle.Damage_Override", false); }
  601. public double getSteelArmOverride(int rank, double def) {
  602. String key = "Rank_" + rank;
  603. return config.getDouble("Skills.Unarmed.SteelArmStyle.Override." + key, def);
  604. }
  605. public boolean getDisarmProtected() { return config.getBoolean("Skills.Unarmed.Disarm.AntiTheft", false); }
  606. /* WOODCUTTING */
  607. public boolean isKnockOnWoodXPOrbEnabled() { return config.getBoolean("Skills.Woodcutting.TreeFeller.Knock_On_Wood.Add_XP_Orbs_To_Drops", true); }
  608. }