From 876d4b2fd46ba989918b952983c4f33274c85be9 Mon Sep 17 00:00:00 2001 From: Auxilor Date: Sat, 21 Aug 2021 14:47:07 +0100 Subject: [PATCH] Added variable reward messages --- .../willfp/ecoskills/config/SkillConfig.kt | 4 ++- .../com/willfp/ecoskills/skills/Skill.kt | 28 +++++++++++++++++-- .../src/main/resources/skills/alchemy.yml | 22 ++++++++------- .../src/main/resources/skills/armory.yml | 14 ++++++---- .../src/main/resources/skills/combat.yml | 14 ++++++---- .../src/main/resources/skills/enchanting.yml | 14 ++++++---- .../src/main/resources/skills/exploration.yml | 10 ++++--- .../src/main/resources/skills/farming.yml | 22 ++++++++------- .../src/main/resources/skills/fishing.yml | 14 ++++++---- .../src/main/resources/skills/mining.yml | 10 ++++--- .../src/main/resources/skills/woodcutting.yml | 10 ++++--- 11 files changed, 102 insertions(+), 60 deletions(-) diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/config/SkillConfig.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/config/SkillConfig.kt index 4966042..5a02dd1 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/config/SkillConfig.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/config/SkillConfig.kt @@ -12,6 +12,8 @@ class SkillConfig( true, plugin, source, - "skills/" + "skills/", + "rewards-messages", + "rewards-gui-lore" ) { } \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/skills/Skill.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/skills/Skill.kt index aabd738..fbe369b 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/skills/Skill.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/skills/Skill.kt @@ -101,17 +101,39 @@ abstract class Skill( return levels } - fun getRewardsMessages(player: Player): MutableList { + fun getRewardsMessages(player: Player, level: Int): MutableList { + var highestLevel = 1 + for (startLevel in this.config.getSubsection("rewards-messages").getKeys(false)) { + if (startLevel.toInt() < level) { + break + } + + if (startLevel.toInt() > highestLevel) { + highestLevel = startLevel.toInt() + } + } + val messages = ArrayList() - for (string in this.config.getStrings("rewards-messages", false)) { + for (string in this.config.getStrings("rewards-messages.$highestLevel", false)) { messages.add(StringUtils.format(string, player)) } return messages } fun getGUIRewardsMessages(player: Player, level: Int): MutableList { + var highestLevel = 1 + for (startLevel in this.config.getSubsection("rewards-gui-lore").getKeys(false)) { + if (startLevel.toInt() < level) { + break + } + + if (startLevel.toInt() > highestLevel) { + highestLevel = startLevel.toInt() + } + } + val lore = ArrayList() - for (string in this.config.getStrings("rewards-gui-lore", false)) { + for (string in this.config.getStrings("rewards-gui-lore.$highestLevel", false)) { var s = string; for (skillObject in Effects.values() union Stats.values()) { diff --git a/eco-core/core-plugin/src/main/resources/skills/alchemy.yml b/eco-core/core-plugin/src/main/resources/skills/alchemy.yml index b3cf389..d25264a 100644 --- a/eco-core/core-plugin/src/main/resources/skills/alchemy.yml +++ b/eco-core/core-plugin/src/main/resources/skills/alchemy.yml @@ -24,18 +24,20 @@ level-up-rewards: - "mystic_resilience::1" rewards-messages: - - " &8» &r&f+2 %ecoskills_crit_chance_name%" - - " &8» &r&f+1 %ecoskills_wisdom_name%" - - " &8» &r&6Potionmaster %ecoskills_potionmaster_numeral%" - - " &8» &r&6Efficient Brewing %ecoskills_efficient_brewing_numeral%" - - " &8» &r&6Mystic Resilience %ecoskills_mystic_resilience_numeral%" + 1: + - " &8» &r&f+2 %ecoskills_crit_chance_name%" + - " &8» &r&f+1 %ecoskills_wisdom_name%" + - " &8» &r&6Potionmaster %ecoskills_potionmaster_numeral%" + - " &8» &r&6Efficient Brewing %ecoskills_efficient_brewing_numeral%" + - " &8» &r&6Mystic Resilience %ecoskills_mystic_resilience_numeral%" rewards-gui-lore: - - " &8» &r&f+2 %ecoskills_crit_chance_name%" - - " &8» &r&f+1 %ecoskills_wisdom_name%" - - " &8» &r&6Potionmaster %ecoskills_potionmaster_numeral%" - - " &8» &r&6Efficient Brewing %ecoskills_efficient_brewing_numeral%" - - " &8» &r&6Mystic Resilience %ecoskills_mystic_resilience_numeral%" + 1: + - " &8» &r&f+2 %ecoskills_crit_chance_name%" + - " &8» &r&f+1 %ecoskills_wisdom_name%" + - " &8» &r&6Potionmaster %ecoskills_potionmaster_numeral%" + - " &8» &r&6Efficient Brewing %ecoskills_efficient_brewing_numeral%" + - " &8» &r&6Mystic Resilience %ecoskills_mystic_resilience_numeral%" # The experience to give for each brewing ingredient xp-rewards: diff --git a/eco-core/core-plugin/src/main/resources/skills/armory.yml b/eco-core/core-plugin/src/main/resources/skills/armory.yml index 7281675..0bee0a5 100644 --- a/eco-core/core-plugin/src/main/resources/skills/armory.yml +++ b/eco-core/core-plugin/src/main/resources/skills/armory.yml @@ -20,14 +20,16 @@ level-up-rewards: - "shamanism::1" rewards-messages: - - " &8» &r&f+2 %ecoskills_defense_name%" - - " &8» &r&f+1 %ecoskills_speed_name%" - - " &8» &r&6Shamanism %ecoskills_shamanism_numeral%" + 1: + - " &8» &r&f+2 %ecoskills_defense_name%" + - " &8» &r&f+1 %ecoskills_speed_name%" + - " &8» &r&6Shamanism %ecoskills_shamanism_numeral%" rewards-gui-lore: - - " &8» &r&f+2 %ecoskills_defense_name%" - - " &8» &r&f+1 %ecoskills_speed_name%" - - " &8» &r&6Shamanism %ecoskills_shamanism_numeral%" + 1: + - " &8» &r&f+2 %ecoskills_defense_name%" + - " &8» &r&f+1 %ecoskills_speed_name%" + - " &8» &r&6Shamanism %ecoskills_shamanism_numeral%" # The experience to give for each hp of damage taken xp-per-hp: 0.72 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/skills/combat.yml b/eco-core/core-plugin/src/main/resources/skills/combat.yml index 278a190..79c147e 100644 --- a/eco-core/core-plugin/src/main/resources/skills/combat.yml +++ b/eco-core/core-plugin/src/main/resources/skills/combat.yml @@ -20,14 +20,16 @@ level-up-rewards: - "serrated_strikes::1" rewards-messages: - - " &8» &r&f+2 %ecoskills_strength_name%" - - " &8» &r&f+1 %ecoskills_crit_damage_name%" - - " &8» &r&6Serrated Strikes %ecoskills_serrated_strikes_numeral%" + 1: + - " &8» &r&f+2 %ecoskills_strength_name%" + - " &8» &r&f+1 %ecoskills_crit_damage_name%" + - " &8» &r&6Serrated Strikes %ecoskills_serrated_strikes_numeral%" rewards-gui-lore: - - " &8» &r&f+2 %ecoskills_strength_name%" - - " &8» &r&f+1 %ecoskills_crit_damage_name%" - - " &8» &r&6Serrated Strikes %ecoskills_serrated_strikes_numeral%" + 1: + - " &8» &r&f+2 %ecoskills_strength_name%" + - " &8» &r&f+1 %ecoskills_crit_damage_name%" + - " &8» &r&6Serrated Strikes %ecoskills_serrated_strikes_numeral%" # The experience to give for each hp of a killed enemy xp-per-heart: 0.33 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/skills/enchanting.yml b/eco-core/core-plugin/src/main/resources/skills/enchanting.yml index 6256cd5..0f41941 100644 --- a/eco-core/core-plugin/src/main/resources/skills/enchanting.yml +++ b/eco-core/core-plugin/src/main/resources/skills/enchanting.yml @@ -20,14 +20,16 @@ level-up-rewards: - "second_chance::1" rewards-messages: - - " &8» &r&f+2 %ecoskills_wisdom_name%" - - " &8» &r&f+1 %ecoskills_crit_chance_name%" - - " &8» &r&6Second Chance %ecoskills_second_chance_numeral%" + 1: + - " &8» &r&f+2 %ecoskills_wisdom_name%" + - " &8» &r&f+1 %ecoskills_crit_chance_name%" + - " &8» &r&6Second Chance %ecoskills_second_chance_numeral%" rewards-gui-lore: - - " &8» &r&f+2 %ecoskills_wisdom_name%" - - " &8» &r&f+1 %ecoskills_crit_chance_name%" - - " &8» &r&6Second Chance %ecoskills_second_chance_numeral%" + 1: + - " &8» &r&f+2 %ecoskills_wisdom_name%" + - " &8» &r&f+1 %ecoskills_crit_chance_name%" + - " &8» &r&6Second Chance %ecoskills_second_chance_numeral%" # The experience to give for each level cost of enchanting xp-per-level: 4 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/skills/exploration.yml b/eco-core/core-plugin/src/main/resources/skills/exploration.yml index 04a7a14..d6a4f46 100644 --- a/eco-core/core-plugin/src/main/resources/skills/exploration.yml +++ b/eco-core/core-plugin/src/main/resources/skills/exploration.yml @@ -18,12 +18,14 @@ level-up-rewards: - "seamless_movement::1" rewards-messages: - - " &8» &r&f+2 %ecoskills_speed_name%" - - " &8» &r&6Seamless Movement %ecoskills_seamless_movement_numeral%" + 1: + - " &8» &r&f+2 %ecoskills_speed_name%" + - " &8» &r&6Seamless Movement %ecoskills_seamless_movement_numeral%" rewards-gui-lore: - - " &8» &r&f+2 %ecoskills_speed_name%" - - " &8» &r&6Seamless Movement %ecoskills_seamless_movement_numeral%" + 1: + - " &8» &r&f+2 %ecoskills_speed_name%" + - " &8» &r&6Seamless Movement %ecoskills_seamless_movement_numeral%" # Chance to give 1 xp every time the player moves xp-on-move-chance: 0.05 diff --git a/eco-core/core-plugin/src/main/resources/skills/farming.yml b/eco-core/core-plugin/src/main/resources/skills/farming.yml index 18a589a..54c927c 100644 --- a/eco-core/core-plugin/src/main/resources/skills/farming.yml +++ b/eco-core/core-plugin/src/main/resources/skills/farming.yml @@ -24,18 +24,20 @@ level-up-rewards: - "golden_yield::1:10:100" rewards-messages: - - " &8» &r&f+2 %ecoskills_crit_damage_name%" - - " &8» &r&f+1 %ecoskills_wisdom_name%" - - " &8» &r&6Bountiful Harvest %ecoskills_bountiful_harvest_numeral%" - - " &8» &r&6Satiation %ecoskills_satiation_numeral%" - - " &8» &r&6Golden Yield %ecoskills_golden_yield_numeral%" + 1: + - " &8» &r&f+2 %ecoskills_crit_damage_name%" + - " &8» &r&f+1 %ecoskills_wisdom_name%" + - " &8» &r&6Bountiful Harvest %ecoskills_bountiful_harvest_numeral%" + - " &8» &r&6Satiation %ecoskills_satiation_numeral%" + - " &8» &r&6Golden Yield %ecoskills_golden_yield_numeral%" rewards-gui-lore: - - " &8» &r&f+2 %ecoskills_crit_damage_name%" - - " &8» &r&f+1 %ecoskills_wisdom_name%" - - " &8» &r&6Bountiful Harvest %ecoskills_bountiful_harvest_numeral%" - - " &8» &r&6Satiation %ecoskills_satiation_numeral%" - - " &8» &r&6Golden Yield %ecoskills_golden_yield_numeral%" + 1: + - " &8» &r&f+2 %ecoskills_crit_damage_name%" + - " &8» &r&f+1 %ecoskills_wisdom_name%" + - " &8» &r&6Bountiful Harvest %ecoskills_bountiful_harvest_numeral%" + - " &8» &r&6Satiation %ecoskills_satiation_numeral%" + - " &8» &r&6Golden Yield %ecoskills_golden_yield_numeral%" # The xp rewards for each crop type # Specify with type:xp diff --git a/eco-core/core-plugin/src/main/resources/skills/fishing.yml b/eco-core/core-plugin/src/main/resources/skills/fishing.yml index a455b4e..da51243 100644 --- a/eco-core/core-plugin/src/main/resources/skills/fishing.yml +++ b/eco-core/core-plugin/src/main/resources/skills/fishing.yml @@ -20,14 +20,16 @@ level-up-rewards: - "eye_of_the_depths::1" rewards-messages: - - " &8» &r&f+2 %ecoskills_defense_name%" - - " &8» &r&f+1 %ecoskills_wisdom_name%" - - " &8» &r&6Eye of the Depths %ecoskills_eye_of_the_depths_numeral%" + 1: + - " &8» &r&f+2 %ecoskills_defense_name%" + - " &8» &r&f+1 %ecoskills_wisdom_name%" + - " &8» &r&6Eye of the Depths %ecoskills_eye_of_the_depths_numeral%" rewards-gui-lore: - - " &8» &r&f+2 %ecoskills_defense_name%" - - " &8» &r&f+1 %ecoskills_wisdom_name%" - - " &8» &r&6Eye of the Depths %ecoskills_eye_of_the_depths_numeral%" + 1: + - " &8» &r&f+2 %ecoskills_defense_name%" + - " &8» &r&f+1 %ecoskills_wisdom_name%" + - " &8» &r&6Eye of the Depths %ecoskills_eye_of_the_depths_numeral%" # The experience to give for each in-game experience dropped xp-per-experience-dropped: 3.5 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/skills/mining.yml b/eco-core/core-plugin/src/main/resources/skills/mining.yml index b4a2ee9..d97e6d4 100644 --- a/eco-core/core-plugin/src/main/resources/skills/mining.yml +++ b/eco-core/core-plugin/src/main/resources/skills/mining.yml @@ -18,12 +18,14 @@ level-up-rewards: - "versatile_tools::1" rewards-messages: - - " &8» &r&f+1 %ecoskills_defense_name%" - - " &8» &r&6Versatile Tools %ecoskills_versatile_tools_numeral%" + 1: + - " &8» &r&f+1 %ecoskills_defense_name%" + - " &8» &r&6Versatile Tools %ecoskills_versatile_tools_numeral%" rewards-gui-lore: - - " &8» &r&f+1 %ecoskills_defense_name%" - - " &8» &r&6Versatile Tools %ecoskills_versatile_tools_numeral%" + 1: + - " &8» &r&f+1 %ecoskills_defense_name%" + - " &8» &r&6Versatile Tools %ecoskills_versatile_tools_numeral%" # The xp rewards for each block type # Specify with type:xp diff --git a/eco-core/core-plugin/src/main/resources/skills/woodcutting.yml b/eco-core/core-plugin/src/main/resources/skills/woodcutting.yml index efb7843..5aa11ed 100644 --- a/eco-core/core-plugin/src/main/resources/skills/woodcutting.yml +++ b/eco-core/core-plugin/src/main/resources/skills/woodcutting.yml @@ -18,12 +18,14 @@ level-up-rewards: - "craftsmanship::1" rewards-messages: - - " &8» &r&f+2 %ecoskills_strength_name%" - - " &8» &r&6Craftsmanship %ecoskills_craftsmanship_numeral%" + 1: + - " &8» &r&f+2 %ecoskills_strength_name%" + - " &8» &r&6Craftsmanship %ecoskills_craftsmanship_numeral%" rewards-gui-lore: - - " &8» &r&f+2 %ecoskills_strength_name%" - - " &8» &r&6Craftsmanship %ecoskills_craftsmanship_numeral%" + 1: + - " &8» &r&f+2 %ecoskills_strength_name%" + - " &8» &r&6Craftsmanship %ecoskills_craftsmanship_numeral%" # The xp rewards for each crop type # Specify with type:xp