AdvancedConfig.java 33 KB

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