module dismantle - magemonkeystudio/divinity GitHub Wiki

๐Ÿ› ๏ธ Dismantle Module

The Dismantle Module allows players to destroy items in exchange for rewards like materials, money, or commands. This system supports gear recycling, item economy balancing, and crafting loops.


๐Ÿ“ฆ How It Works

Dismantling involves:

  1. A dismantle tool item
    โ†’ Located in: plugins/Divinity/modules/dismantle/items

  2. A matching dismantle source file
    โ†’ Located in: plugins/Divinity/modules/dismantle/source

Both must be configured โ€” tools won't function without matching sources.


๐Ÿงฐ Tool Item Format

material: SHEARS
name: Armor Dismantle Tool
tier: common
item-flags:
  - '*'

uses-by-level:
  '1': 1
  '2': 2
  '3': 3

level:
  min: 1
  max: 3

target-requirements:
  type:
    - ARMOR
  level:
    '1': 1
  module:
    - '*'

This defines a dismantle item usable only on armor-type targets with at least level 1.


๐Ÿ“ Source Files (Reward Definitions)

Dismantle sources define:

  • Input module
  • Accepted item IDs/levels
  • Output rewards
  • Preview display
  • Optional cost (e.g., XP)

Example file:

input-module: gems

output-by-item-id-level:
  default:
    '1':
      cost: 15
      output:
        emeralds:
          chance: 10.0
          item:
            material: EMERALD
            amount: 17
            name: '&aEmerald'
          preview:
            material: EMERALD
            amount: 17
            name: '&aEmerald &7(10%)'

        sulphur:
          chance: 100.0
          item:
            material: GUNPOWDER
          preview:
            material: GUNPOWDER
            name: '&8Sulphur &7(100%)'

        nugget:
          chance: 15.0
          commands:
            - '[CONSOLE] eco give %player% 10'
          preview:
            material: GOLD_NUGGET
            name: '&e10$ &7(15%)'

๐ŸŽ Reward Types

  • item: โ†’ Vanilla item with material, amount, and custom name/lore
  • commands: โ†’ Execute server commands like giving money, buffs, or custom drops

You can mix both in one reward entry.


โš  GUI Preview Behavior

Players see all possible rewards in the GUI preview, but only those that pass their chance: roll are granted.

Tips:

  • Use &7(15%) format in preview names
  • Explain mechanics via lore/tutorial signs

๐Ÿ”ง Commands

Command Description Permission
/dismantle help Show help page divinity.dismantle.help
/dismantle open [player] [force:true/false] Open GUI (optionally force another player) divinity.dismantle.open
/dismantle get <id> [level] [amount] Get a dismantle item divinity.dismantle.get
/dismantle give <player> <id> [level] [amount] Give item to a player divinity.dismantle.give
/dismantle drop <world> <x> <y> <z> <id> [level] [amount] Drop a dismantle item at coordinates divinity.dismantle.drop
/dismantle list [page] View registered dismantle items divinity.dismantle.list
/dismantle reload Reload the module divinity.dismantle.reload

๐Ÿงช Usage Tips

  • Use target-requirements to limit dismantling by type, level, or module
  • Add lore to dismantle tools to teach players how they work
  • Pair with modules like loot, crafting, essence, and worth for deep systems

๐Ÿ  Return to Home

โ† Return to Home

โš ๏ธ **GitHub.com Fallback** โš ๏ธ