From 5c62b3b467f956a8e5bb37a490ca9533569147b3 Mon Sep 17 00:00:00 2001 From: Auxilor Date: Wed, 17 Jul 2024 17:46:49 +0100 Subject: [PATCH] Added hot potato book example --- .../com/willfp/ecoscrolls/EcoScrollsPlugin.kt | 2 +- .../src/main/resources/scrolls/_example.yml | 6 +- .../resources/scrolls/hot_potato_book.yml | 134 ++++++++++++++++++ 3 files changed, 140 insertions(+), 2 deletions(-) create mode 100644 eco-core/core-plugin/src/main/resources/scrolls/hot_potato_book.yml diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoscrolls/EcoScrollsPlugin.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoscrolls/EcoScrollsPlugin.kt index 67dfc86..4482ba1 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoscrolls/EcoScrollsPlugin.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoscrolls/EcoScrollsPlugin.kt @@ -63,7 +63,7 @@ class EcoScrollsPlugin : LibreforgePlugin() { } PlaceholderManager.registerPlaceholder( - object : DynamicPlaceholder(plugin, Pattern.compile("scroll_([a-z]+)_([a-zA-Z0-9_]+)")) { + object : DynamicPlaceholder(plugin, Pattern.compile("scroll_([a-z0-9_]+)_([a-zA-Z0-9_]+)")) { override fun getValue(args: String, context: PlaceholderContext): String? { val matcher = pattern.matcher(args) diff --git a/eco-core/core-plugin/src/main/resources/scrolls/_example.yml b/eco-core/core-plugin/src/main/resources/scrolls/_example.yml index ccd5a0b..e15b565 100644 --- a/eco-core/core-plugin/src/main/resources/scrolls/_example.yml +++ b/eco-core/core-plugin/src/main/resources/scrolls/_example.yml @@ -22,6 +22,8 @@ item: lore: - "&7This is an example scroll." - "&7It does nothing." + + # Options for crafting, read here: https://plugins.auxilor.io/all-plugins/the-item-lookup-system#crafting-recipes craftable: false recipe: [ ] @@ -32,6 +34,8 @@ inscription: conditions: [ ] # The effects that will be run when the item is inscribed + # If your scroll works by modifying the item (e.g. adding enchantments, changing durability), + # then put those effects here. effects: [ ] # Read https://plugins.auxilor.io/all-plugins/prices @@ -74,7 +78,7 @@ lore: # Item placeholders for dynamic lore in plugins like EcoItems # The placeholder is %ecoscrolls_scroll__%, e.g. -# %ecoscrolls_scoll_example_bonus% +# %ecoscrolls_scroll_example_bonus% placeholders: bonus: "%level% * 2" diff --git a/eco-core/core-plugin/src/main/resources/scrolls/hot_potato_book.yml b/eco-core/core-plugin/src/main/resources/scrolls/hot_potato_book.yml new file mode 100644 index 0000000..835510e --- /dev/null +++ b/eco-core/core-plugin/src/main/resources/scrolls/hot_potato_book.yml @@ -0,0 +1,134 @@ +# The ID of the scroll is the name of the .yml file, +# for example coins_on_kill.yml has the ID of coins_on_kill +# You can place scrolls anywhere in this folder, +# including in subfolders if you want to organize your scroll configs +# _example.yml is not loaded. + +# The name of the scroll +name: "&cHot Potato Book" + +# The max level of the scroll +max-level: 10 + +# The amount of times the scroll can be used +max-uses: 1 + +# Options for the physical scroll item +item: + item: book unbreaking:1 hide_enchants + + # Name and lore can use %uses%, %max_uses%, and %uses_left% placeholders + name: "&cHot Potato Book" + lore: + - "&7When inscribed on armor, grants" + - "&f+2 %ecoskills_defense_name% &7and &f+1 %ecoskills_health_name%&7." + - "" + - "&7When inscribed to weapons, grants" + - "&f+2 %ecoskills_strength_name% &7and &f+4 %ecoskills_crit_damage_name%&7." + - "" + - "&7This can be inscribed up to &a10 &7times" + - "&7on an item!" + + # Options for crafting, read here: https://plugins.auxilor.io/all-plugins/the-item-lookup-system#crafting-recipes + craftable: false + recipe: [ ] + +# Options for inscribing items with the scroll +inscription: + # The conditions required to inscribe the item + # not-met-effects will run if someone tries to inscribe the item without meeting the conditions + conditions: [ ] + + # The effects that will be run when the item is inscribed + # If your scroll works by modifying the item (e.g. adding enchantments, changing durability), + # then put those effects here. + effects: [ ] + + # Read https://plugins.auxilor.io/all-plugins/prices + # The price to inscribe the item + price: + value: 100 + type: coins + display: "&e%value% coins" + + # The formula to multiply the price depending on the level. + # The %level% placeholder is the *current* level of the scroll + price-level-multiplier: "1 + %level% * 0.5" + + # If the scroll can be applied to items via drag-and-drop + drag-and-drop: true + + # If the scroll can be applied to items via the inscription table + inscription-table: true + +# The items that the scroll can be applied to, see targets.yml +targets: + - sword + - axe + - armor + +# The conflicts that the scroll has with other scrolls +conflicts: [ ] + +# The scroll(s) that must be applied to the item before this scroll can be applied +requirements: [ ] + +# If inscribing this scroll should remove the required scrolls +remove-requirements: false + +# The lore added to items when inscribed with the scroll +lore: [ ] + +# Item placeholders for dynamic lore in plugins like EcoItems +# The placeholder is %ecoscrolls_scroll__%, e.g. +# %ecoscrolls_scroll_example_bonus% +placeholders: + # For EcoItems items, use %ecoscrolls_scroll_hot_potato_book_defense% in lore + defense: " &8(&e{^{%level% * 2}}&8)" + # Same as above, but for health / strength / crit_damage + health: " &8(&e{^{%level%}}&8)" + strength: " &8(&e{^{%level% * 2}}&8)" + crit_damage: " &8(&e{^{%level% * 4}}&8)" + +# Read https://plugins.auxilor.io/effects/configuring-an-effect +# The effects for the scroll to give +effects: + # Armor effects + - id: add_stat + args: + stat: defense + amount: "%level% * 2" + conditions: + - id: in_slot + args: + slot: armor + - id: add_stat + args: + stat: health + amount: "%level%" + conditions: + - id: in_slot + args: + slot: armor + + # Weapon effects + - id: add_stat + args: + stat: strength + amount: "%level% * 2" + conditions: + - id: in_slot + args: + slot: mainhand + - id: add_stat + args: + stat: crit_damage + amount: "%level% * 4" + conditions: + - id: in_slot + args: + slot: mainhand + +# Read https://plugins.auxilor.io/effects/configuring-a-condition +# The conditions for the scroll to work +conditions: [ ]