# Introduction

![](https://1634559869-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6eUJYtcDdfBIbH2W4dLm%2Fuploads%2FDesQPXyX4VezhSit1HQb%2Fbanner%20-%20configuration.png?alt=media\&token=8a20b55c-141a-4766-a8f5-63a43c23ec44)

Edit `worldFolder/mods/BjornV_RepairBench/config.json` to customize the plugin.

### Basic Settings

```json
{
  "DefaultRepairCost": {
    "ItemId": "Ingredient_Bar_Iron",
    "Quantity": 2,
    "ScalingFactor": 1.0,
    "RepairMaxDurability": true
  }
}
```

#### DefaultRepairCost

The default repair cost settings apply to all items unless overridden by a custom repair cost pattern.

**ItemId / ResourceTypeId**

The material used for repairs. **Only one can be used per definition.**

**ItemId** - Use specific ingredient items:

* `Ingredient_Bar_Iron`
* `Ingredient_Stick`
* etc.

**ResourceTypeId** - Use resource types:

* `Wood_Trunk`
* `Stone`
* etc.

Default: `"ItemId": "Ingredient_Bar_Iron"`

**Quantity**

How many of the material to charge for repairs.

Default: `2`

**ScalingFactor**

Multiplier for cost based on damage.

* `0.0` = Fixed cost regardless of damage
* `1.0` = Cost scales with damage (default)
* `2.0` = Double scaling

The formula for calculating the final cost using the scaling factor:

$$
\text{FinalCost} = \max\left(1, \left\lfloor \text{BaseQuantity} \times \left(1 + \text{ScalingFactor} \times \left(1 - \frac{\text{CurrentDurability}}{\text{OriginalMaxDurability}}\right)\right) + 0.5 \right\rfloor\right)
$$

**RepairMaxDurability**

Controls whether repairs can restore permanent durability loss.

Default: `true`

* `true` = Repairs restore both current and maximum durability
* `false` = Repairs only restore current durability

### Custom Repair Costs

Define custom costs for specific item patterns:

```json
{
  "CustomRepairCosts": [
    {
      "Match": "*Adamantite*",
      "ItemId": "Ingredient_Bar_Adamantite",
      "Quantity": 2
    },
    {
      "Match": "*Wood*",
      "ResourceTypeId": "Wood_Trunk",
      "Quantity": 3,
      "ScalingFactor": 0.5,
      "RepairMaxDurability": false
    }
  ]
}
```

#### Match Patterns

Patterns use `*` as a wildcard to match item names:

* `*Adamantite*` = Any item with "Adamantite" in the name
* `*Wood*` = Any item with "Wood" in the name
* `Tool_Pickaxe_*` = All items starting with "Tool\_Pickaxe\_"
* `*_Sword_*` = Any item containing "*Sword*"

#### Per-Pattern Overrides

Each pattern can override the default settings with optional fields:

* `ItemId` or `ResourceTypeId` - The material to charge (required, only use one)
* `Quantity` - Override the default quantity for this pattern
* `ScalingFactor` - Override the default scaling factor for this pattern
* `RepairMaxDurability` - Override the default permanent repair setting for this pattern

If optional fields are omitted, the pattern will use the values from `DefaultRepairCost`.

**Example using default settings:**

```json
{
  "Match": "*Copper*",
  "ItemId": "Ingredient_Bar_Copper",
  "Quantity": 2
}
```

**Example with custom overrides:**

```json
{
  "Match": "*Iron*",
  "ItemId": "Ingredient_Bar_Iron",
  "Quantity": 2,
  "ScalingFactor": 2.0,
  "RepairMaxDurability": false
}
```

**Example using ResourceTypeId:**

```json
{
  "Match": "*Wood*",
  "ResourceTypeId": "Wood_Trunk",
  "Quantity": 3
}
```

### Excluded Matches

Prevent specific items from being repaired:

```json
{
  "ExcludedMatches": [
    "*_State_Filled_Water",
    "Tool_Pickaxe_Legendary",
    "Weapon_*_Cursed"
  ]
}
```

Patterns use the same wildcard matching as custom repair costs. Excluded items will not appear in the repair menu.

Default: `["*_State_Filled_Water"]`

### Resource Type IDs

Common resource types that can be used with `ResourceTypeId`:

> **Note:** This is a partial list. The exact available resource types may vary by game version. If you need a specific resource type ID, check your game's data files or mod documentation.

* `Wood_Trunk` - Wood logs/trunks
* `Stone` - Stone resources
* `Metal_Ore` - Metal ores
* `Clay` - Clay resources
* `Sand` - Sand resources

### Example Configuration

```json
{
  "DefaultRepairCost": {
    "ItemId": "Ingredient_Bar_Iron",
    "Quantity": 2,
    "ScalingFactor": 1.0,
    "RepairMaxDurability": true
  },
  "CustomRepairCosts": [
    {
      "Match": "*Copper*",
      "ItemId": "Ingredient_Bar_Copper",
      "Quantity": 2
    },
    {
      "Match": "*Wood*",
      "ResourceTypeId": "Wood_Trunk",
      "Quantity": 3
    }
  ],
  "ExcludedMatches": [
    "*_State_Filled_Water"
  ]
}
```

### Default Configuration

If no config file exists, the plugin will automatically create one with these defaults:

* **DefaultRepairCost:**
  * ItemId: `Ingredient_Bar_Iron`
  * Quantity: `2`
  * ScalingFactor: `1.0`
  * RepairMaxDurability: `true`
* **CustomRepairCosts:** Includes patterns for Adamantite, Cobalt, Thorium, Iron, Copper, and Wood items
* **ExcludedMatches:** `["*_State_Filled_Water"]`

### Reload Configuration

After editing the config file, reload it without restarting the server:

```
/rbreload
```

Or restart the server to apply changes.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://bjornv.gitbook.io/repair-workbench/introduction.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
