# 🔄 Process

***

The Process feature allows items to be converted into other predefined items, enabling players to reuse or recycle items for future use.

<figure><img src="https://1245303946-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEMKTTfYtO1c14jr3rkcH%2Fuploads%2Fn3IV5IhukW2ydPgFnVdX%2Fimage.png?alt=media&#x26;token=b30eb0f9-dd49-4b02-8b7a-cea1a261597e" alt=""><figcaption><p>Process GUI</p></figcaption></figure>

## ⚙️ How Process Works

When you place an item that matches the specified conditions, the GUI will display the possible items that the main item can be processed into. Once you click confirm, you will receive the processed item.

***

## 🔑 Permission

Each station has its own permission requirement in order to be used. Of course, you can customize or change the permission to suit your needs.

```yaml
settings:
  permission: nwmmoupgrade.process.sword
```

***

## 🌟 Features

***

### **1. Material Item**

If enabled, this means the operation of the station will require the specified materials in order to function as intended. You can define one or more material items, and the station will only execute if the player provides the required materials.

```yaml
materials:
  enabled: false
  items:
    - type: MATERIAL
      id: STEEL_INGOT
      amount: 5
      slot: 30
      #match-item-type: SWORD #filter option
      #match-tier-type: RARE #filter option
      #match-item:
      # - SWORD:KATANA
```

**Note:**\
type is the type of the MMOItem.\
id is the ID of the MMOItem.\
amount is the quantity of the material required.\
slot is the GUI slot where the material must be placed.

#### Options

These are additional conditions that enhance material requirements:

* **match-item-type:** The material will only be accepted if the item placed in the item slot has the matching type specified here.
* **match-item-tier:** The material will only be accepted if the item placed in the item slot has the matching tier specified here.
* **match-item:** The material will only be accepted if the item placed in the item slot has the matching According to the item defined in match-item specified here.

***

### **2. Chance Item**

If enabled and used in conjunction with chance-based mechanics, the Chance Item provides an additional success rate boost on top of the existing base chance. This item acts as a support to increase the overall likelihood of success during actions such as upgrading

```yaml
chance-item:
  enabled: false
  items:
    - type: MATERIAL
      id: RARE_DIAMOND
      amount: 5
      slot: 32
      chance: 50
      #match-item-type: SWORD #filter option
      #match-tier-type: RARE #filter option
      #match-item:
      # - SWORD:KATANA
    - type: MATERIAL
      id: SILVER_INGOT
      amount: 1
      slot: 32
      chance: 50
      #match-item-type: ARMOR #filter option
      #match-tier-type: RARE #filter option
      #match-item:
      # - SWORD:KATANA
```

**Note:**\
type is the type of the MMOItem.\
id is the ID of the MMOItem.\
amount is the quantity of the material required.\
slot is the GUI slot where the material must be placed.\
chance This sets the success chance for the Chance Item

#### Options

These are additional conditions that enhance material requirements:

* match-item-type
* match-item-tier
* match-item

***

### **3. Material Formula**

The Material Formula feature provides a highly flexible way to dynamically calculate the cost and material requirements for item.

#### **Material Increase**

When this feature is enabled (enabled: true), the quantity of material items required for an gem add socket will increase as the item's level rises. This ensures that higher-level upgrades demand a greater investment from players, providing a more balanced progression.\
The increase is determined by a custom formula you define, giving you precise control over the scaling.

**In Short:**\
Level Up = Material Requirements.

#### **Formula Configuration**

Basic: you can use the basic default chance calculation or create your own custom formula to control how the chance is calculated.\
Custom Placeholders: The formula supports specific placeholders that will be replaced with dynamic values during calculation.

```yaml
material-formula:
  enabled: true
  formula: "1"
```

***

### **4. Cost**

This feature allows you to use currencies such as PlayerPoints, CoinsEngine, or Vault.

```yaml
cost:
    enabled: true
    currency: pp
    amount: 5000
```

```yaml
cost:
    enabled: true # Enable/disable cost system
    currency: ce;nwcoin
    amount: "{global_custom_advance_cost_item}" # cost amount
```

```yaml
cost:
    enabled: true # Enable/disable cost system
    amount: 100 # cost amount
```

***

### **5. Default Chance**

This feature allows you to set the success chance of this station yourself, in cases where Tier is not enabled.

```yaml
options:
    ....
    default-chance: 0
```

***

### **6. Tiers**

This feature allows you to set the success chance based on the tiers of the item placed in the item slot.\
If the item's tier matches the specified tiers, the chance will be applied accordingly. If none of the tier conditions are met, the chance will be taken from the `no-tier-chance` setting.

```yaml
options:
    ....
    tiers:
      enabled: false
      no-tier-chance: 10
      tier-list:
        - tier: COMMON
          chance: 2
        - tier: RARE
          chance: 15
```

***

## 🔁 7. Process Item

The process item feature supports processing multiple items at once. You can insert as many items as needed into the GUI, and the system will process all of them simultaneously based on your configuration.

***

### **7.1 Default Process Item**

You must define the MMOItems ID under the process-item section for the feature to function properly.\
The process system is divided into several parts:

***

#### **1. Conditions**

These are requirements that must be met for the item to be processed. If the condition involves items, it will check the player's inventory.

***

#### **2. Process-Items**

Process-items are the results that players receive when the process is successfully completed.

Here is a table of condition types and their formats:

<table data-header-hidden><thead><tr><th></th><th width="216"></th><th width="223"></th><th></th></tr></thead><tbody><tr><td><strong>Type</strong></td><td><strong>Format</strong></td><td><strong>Example</strong></td><td><strong>Description</strong></td></tr><tr><td>MMOItems</td><td><code>MMOITEM;&#x3C;type>;&#x3C;id>;&#x3C;amount></code></td><td><code>MMOITEM;MATERIAL;RARE_DIAMOND;10</code></td><td>Requires a specific MMOItem and amount</td></tr><tr><td>Vanilla</td><td><code>VANILLA;&#x3C;material>;&#x3C;amount></code></td><td><code>VANILLA;STONE;15</code></td><td>Requires a specific vanilla item and amount</td></tr><tr><td>Placeholder</td><td><code>PLACEHOLDER;&#x3C;placeholder>;&#x3C;syntax>;&#x3C;result></code></td><td><code>PLACEHOLDER;%luckperms_groups%;==;default</code></td><td>Checks placeholder value matches result</td></tr><tr><td>Vault</td><td><code>vault;&#x3C;amount></code></td><td><code>vault;123</code></td><td>Requires the player to have a certain amount of money</td></tr><tr><td>Level</td><td><code>LEVEL;&#x3C;amount></code></td><td><code>LEVEL;123</code></td><td>Requires the player to have a certain level</td></tr><tr><td>CoinsEngine</td><td><code>COINSENGINE;&#x3C;currency>;&#x3C;amount></code></td><td><code>COINSENGINE;nwcoin;100</code></td><td>Requires the player to have a certain amount of money</td></tr><tr><td>PlayerPoint</td><td>playerpoint;&#x3C;amount></td><td><code>playerpoint;100</code></td><td>Requires the player to have a certain amount of money</td></tr><tr><td>Nexo</td><td><code>nexo;&#x3C;material>;&#x3C;amount></code></td><td><code>Nexo;Custom_block;15</code></td><td>Requires a specific nexo item and amount</td></tr><tr><td>ItemsAdder</td><td><code>ia;&#x3C;namespace>;&#x3C;amount></code></td><td><code>ia;&#x3C;test:test>;1</code></td><td>Requires a specific ItemsAdder item and amount</td></tr></tbody></table>

These conditions give you a flexible way to control when a player is allowed to process items.

#### **Explanation of \<syntax>**

PLACEHOLDER;\<placeholder>;\<syntax>;\<result>

Available \<syntax> Options:

Example Usages:

* `"PLACEHOLDER;%player_level%;>=;30"`
* `"PLACEHOLDER;%luckperms_group%;==;vip"`
* `"PLACEHOLDER;%player_health%;<;10"`
* `"PLACEHOLDER;%some_placeholder%;has_value"`

***

#### **3. Display**

Display is used to define where the item should appear on the GUI for process-items, including the specific slots. It also supports showing display items for types like Placeholder, Level, and Vault.

```yaml
process-item:
  KATANA:
    result:
      conditions:
        - "PLACEHOLDER;%luckperms_groups%;==;default;display-<red>Default Group"
        - "MMOITEM;MATERIAL;RARE_DIAMOND;10;display-<blue> {name} <red> want {amount}"
        - "vault;123;display-&fwant your cost is {amount}"
      process-items:
        - "MMOITEM;MATERIAL;RARE_DIAMOND;10"
        - "vault;5000"
      display:
        process-items:
          slot: [ 21,22,23,24,25 ]
        vault-item:
          material: GOLD_INGOT
          name: "Cost: {cost}"
          cmd: 100
```

```yaml
  WARDEN_SWORD:
    result:
      conditions:
        - "MMOITEM;MATERIAL;RARE_DIAMOND;10"
        - "PLACEHOLDER;%luckperms_groups%;==;newbie"
        - "LEVEL;1"
        - "vault;5000"
      process-items:
        - "MMOITEM;MATERIAL;RARE_DIAMOND;10"
        - "PLACEHOLDER;%luckperms_groups%;==;newbie"
        - "MMOITEM;MATERIAL;STEEL_INGOT;5"
      display:
        process-items:
          slot: [ 21,22,23,24,25 ]
        vault-item:
          material: GOLD_INGOT
          name: "Cost: {cost}"
          cmd: 100
        placeholder-item:
          material: GOLD_INGOT
          name: "Placeholder "
          cmd: 100
        level-item:
          material: GOLD_INGOT
          name: "Level "
          cmd: 100
```

***

### **4. Required Upgrade-level & Amount**

required-upgrade-level:\
This is an optional setting. When you press Confirm, if the item does not have the required upgrade level, the process will be blocked.

required-amount:\
This is also checked when you press Confirm.

```yaml
process-item:
    STEEL_INGOT:
      result:
        required-upgrade-level: 10
        required-amount: 17
```

***

## 🎚 8.2 Process Item Groups

process-items-groups works by grouping output items based on the tier of the item placed in the GUI.

```yaml
process-items-groups:
  enabled: true
  groups:
    default:
      conditions:
      - "MMOITEM;SWORD;WITHER_SWORD;1"
      - "vault;5000"
      process-items:
        - "MMOITEM;MATERIAL;RARE_DIAMOND;10"
        - "PLACEHOLDER;%luckperms_groups%;==;newbie"
        - "MMOITEM;MATERIAL;STEEL_INGOT;5"
      display:
        process-items:
          slot: [ 1,2,3,4,5 ]
        vault-item:
          material: GOLD_INGOT
          name: "Cost: {cost}"
          cmd: 100
        placeholder-item:
          material: GOLD_INGOT
          name: "Placeholder "
          cmd: 100
        level-item:
          material: GOLD_INGOT
          name: "Level "
          cmd: 100
```

```yaml
    rare:
      conditions:
        - "MMOITEM;MATERIAL;RARE_DIAMOND;10"
        - "vault;5000"
      process-items:
        - "MMOITEM;MATERIAL;RARE_DIAMOND;10"
        - "PLACEHOLDER;%luckperms_groups%;==;newbie"
        - "MMOITEM;MATERIAL;STEEL_INGOT;5"
      display:
        process-items:
          slot: [ 1,2,3,4,5 ]
        vault-item:
          material: GOLD_INGOT
          name: "Cost: {cost}"
          cmd: 100
        placeholder-item:
          material: GOLD_INGOT
          name: "Placeholder "
          cmd: 100
        level-item:
          material: GOLD_INGOT
          name: "Level "
          cmd: 100
```

***

**Example Full Config**

```yaml
##########################################################################
#
#                         nwMMOUpgrade - Process
#      Created By Discord NN#7999 (Newworld Server)
#
#      Supports RGB and standard color codes.
#      1.RGB = &#ffffff
#      2.Standard = &f
#      3. MiniMessage = <red>
#      4. Legacy Hex = &x
#      https://www.birdflop.com/resources/rgb/
#
##########################################################################

#Contact&Support: https://discord.gg/gwXcr7c6Gq

#MMOItems Type
applies-to:
  - SWORD
  - MATERIAL

# Sound settings
#https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/Sound.html
sounds:
  confirm-success: ENTITY_EXPERIENCE_ORB_PICKUP
  confirm-fail: BLOCK_ANVIL_DESTROY
  confirm-no-item: BLOCK_NOTE_BLOCK_PLING

#GUI customization
gui:
  #GUI title, should support images normally.
  title: "&#FF008BM&#FF0590e&#FF0994n&#FF0E99u&#FF129D: &#FF1CA6P&#FF20ABr&#FF25AFo&#FF29B4c&#FF2EB8e&#FF32BDs&#FF37C1s"
  rows: 6 #GUI slots
  display-slots:
    item:
      material: LIME_STAINED_GLASS_PANE
      name: "<color:#00FF4F>Place the item to upgrade<color:#57E342>"
      lore:
        - "&7Drag and drop your item here"
      cmd: 1
    material:
      material: YELLOW_STAINED_GLASS_PANE
      name: "<color:#E7FF00>Place the materials<color:#F2FF08>"
      lore:
        - "&7Drag and drop the required materials here"
      cmd: 1
    chance:
      material: PINK_STAINED_GLASS_PANE
      name: "<color:#FF00F8>Place a chance-enhancing stone (if any)<color:#E68DFF>"
      lore:
        - "&7Drag and drop the chance-enhancing stone here"
      cmd: 1
  slots:
    #Slot for the item you want to add Gem slots to.
    item: 19
    confirm:
      material: BRICK
      name: "&a&lConfirm" #Button name
      lore: #Add your messages here.
        - "&7Click to add a Process Item"
        # - ""
        # - "&fCost: &a{cost}"
        # - "&fSuccess Chance: &6{chance}%"
        # - "&fMaterials:"
        # - "{material}" # edit custom line -> missing-material-line: "- &4<gray>{material} <red>{amount}"
        - "&aConditions"
        - "{conditions}"
      slot:
        - 48-50
      #Supports custom model data.
      cmd: 2600
    filter:
      name: "&f" #Name
      material: BLACK_STAINED_GLASS_PANE
      cmd: 1

  process-item:
    KATANA:
      result:
        conditions:
          - "PLACEHOLDER;%luckperms_groups%;==;default;display-<red>Default Group" #display- options จะใส่หรือไม่ใส่ก็ได้
          - "MMOITEM;MATERIAL;RARE_DIAMOND;10;display-<blue> {name} <red> want {amount}" #display- options จะใส่หรือไม่ใส่ก็ได้
          - "vault;123;display-&fwant your cost is {amount}" #display- options จะใส่หรือไม่ใส่ก็ได้
        process-items:
          - "MMOITEM;MATERIAL;RARE_DIAMOND;10"
          - "vault;5000"
          # - "MMOITEM;MATERIAL;STEEL_INGOT;5"
          # - "MMOITEM;MATERIAL;SILVER_INGOT;15"
          # - "VANILLA;STONE;15"
          # - "PLACEHOLDER;%money%;5000"
        display:
          process-items:
            slot: [ 21,22,23,24,25 ]
          vault-item:
            material: GOLD_INGOT
            name: "Cost: {cost}"
            cmd: 100

    WARDEN_SWORD:
      result:
        conditions:
          - "MMOITEM;MATERIAL;RARE_DIAMOND;10"
          - "PLACEHOLDER;%luckperms_groups%;==;newbie"
          - "LEVEL;1"
          - "vault;5000"
        process-items:
          - "MMOITEM;MATERIAL;RARE_DIAMOND;10"
#            - "PLACEHOLDER;%luckperms_groups%;==;newbie"
          - "MMOITEM;MATERIAL;STEEL_INGOT;5"
        display:
          process-items:
            slot: [ 21,22,23,24,25 ]
          vault-item:
            material: GOLD_INGOT
            name: "Cost: {cost}"
            cmd: 100

materials:
  enabled: false
  items:
    - type: MATERIAL
      id: STEEL_INGOT
      amount: 1
      slot: 30
      #match-item-type: SWORD #จะใส่หรือไม่ใส่ก็ได้
      #match-result-type: GEM_STONE #จะใส่หรือไม่ใส่ก็ได้
      #match-tier-type: RARE #จะใส่หรือไม่ใส่ก็ได้

chance-item:
  enabled: false
  items:
    - type: MATERIAL
      id: RARE_DIAMOND
      amount: 1
      slot: 31
      chance: 100
      # match-item-type: SWORD #จะใส่หรือไม่ใส่ก็ได้
      # match-result-type: GEM_STONE #จะใส่หรือไม่ใส่ก็ได้
      # match-tier-type: RARE #จะใส่หรือไม่ใส่ก็ได้


settings:
  permission: nwmmoupgrade.process.default
  cost:
    enabled: false #Cost
    amount: 5000
  options:
    material-formula:
      enabled: false
      formula: 1
    default-chance: 100
    tiers:
      enabled: false
      no-tier-chance: 10
      tier-list:
        - tier: COMMON
          chance: 5
        - tier: RARE
          chance: 50
    process-items-groups:
      enabled: false
      groups:
        default:
          # conditions:
          # - "MMOITEM;SWORD;WITHER_SWORD;1"
          # - "vault;5000"
          process-items:
            - "MMOITEM;MATERIAL;RARE_DIAMOND;10"
            #            - "PLACEHOLDER;%luckperms_groups%;==;newbie"
            - "MMOITEM;MATERIAL;STEEL_INGOT;5"
          display:
            process-items:
              slot: [ 1,2,3,4,5 ]
            vault-item:
              material: GOLD_INGOT
              name: "Cost: {cost}"
              cmd: 100
        rare:
          conditions:
            # - "MMOITEM;MATERIAL;RARE_DIAMOND;10"
            - "vault;5000"
          process-items:
            - "MMOITEM;MATERIAL;RARE_DIAMOND;10"
            #            - "PLACEHOLDER;%luckperms_groups%;==;newbie"
            - "MMOITEM;MATERIAL;STEEL_INGOT;5"
          display:
            process-items:
              slot: [ 1,2,3,4,5 ]
            vault-item:
              material: GOLD_INGOT
              name: "Cost: {cost}"
              cmd: 100

      enabled: false
      formula: 1
    default-chance: 100
    tiers:
      enabled: false
      no-tier-chance: 10
      tier-list:
        - tier: COMMON
          chance: 5
        - tier: RARE
          chance: 50
    process-items-groups:
      enabled: false
      groups:
        default:
          conditions:
          - "MMOITEM;SWORD;WITHER_SWORD;1"
          - "vault;5000"
          process-items:
            - "MMOITEM;MATERIAL;RARE_DIAMOND;10"
            - "PLACEHOLDER;%luckperms_groups%;==;newbie"
            - "MMOITEM;MATERIAL;STEEL_INGOT;5"
          display:
            process-items:
              slot: [ 1,2,3,4,5 ]
            vault-item:
              material: GOLD_INGOT
              name: "Cost: {cost}"
              cmd: 100
            placeholder-item:
              material: GOLD_INGOT
              name: "Placeholder "
              cmd: 100
            level-item:
              material: GOLD_INGOT
              name: "Level "
              cmd: 100
        rare:
          conditions:
            - "MMOITEM;MATERIAL;RARE_DIAMOND;10"
            - "vault;5000"
          process-items:
            - "MMOITEM;MATERIAL;RARE_DIAMOND;10"
            - "PLACEHOLDER;%luckperms_groups%;==;newbie"
            - "MMOITEM;MATERIAL;STEEL_INGOT;5"
          display:
            process-items:
              slot: [ 1,2,3,4,5 ]
            vault-item:
              material: GOLD_INGOT
              name: "Cost: {cost}"
              cmd: 100
            placeholder-item:
              material: GOLD_INGOT
              name: "Placeholder "
              cmd: 100
            level-item:
              material: GOLD_INGOT
              name: "Level "
              cmd: 100

```
