Custom Costs

Override repair costs for specific items using pattern matching

CustomRepairCosts is an array of repair cost entries that override the DefaultRepairCost for items matching a specific pattern. Entries are evaluated in order and the first match wins.

If CustomRepairCosts is omitted from the config entirely, the plugin populates it with a built-in default set. If it is present but empty, no overrides are applied.

{
  "CustomRepairCosts": [
    {
      "Match": "*Adamantite*",
      "ItemId": "Ingredient_Bar_Adamantite",
      "Quantity": 2
    }
  ]
}

Fallback Behaviour

Any property not explicitly set on a custom entry will fall back to the resolved value from DefaultRepairCost. This means you only need to specify the properties you want to change.

Property
If omitted from custom entry

ItemId / ResourceTypeId

Falls back to DefaultRepairCost material

Quantity

Falls back to DefaultRepairCost quantity

ScalingFactor

Falls back to DefaultRepairCost scaling factor

RepairMaxDurability

Falls back to DefaultRepairCost value, unless auto-set by MaxDurabilityLoss

MaxDurabilityLoss

Falls back to DefaultRepairCost value


Properties

Match

Type: String | Required

A pattern used to match item IDs. The first entry in the array whose Match pattern matches the item being repaired will be used. Use * as a wildcard character.

Pattern
Matches

*Adamantite*

Any item ID containing Adamantite

Tool_Pickaxe_*

Any item ID starting with Tool_Pickaxe_

*_Sword_*

Any item ID containing _Sword_

Tool_Pickaxe_Iron

Exactly Tool_Pickaxe_Iron only


ItemId

Type: String | Default: Inherited from DefaultRepairCost | Optional

The specific item required to pay for the repair. Overrides the material defined in DefaultRepairCost for matched items.

Only one of ItemId or ResourceTypeId should be set. If both are present, ItemId takes priority.


ResourceTypeId

Type: String | Default: Inherited from DefaultRepairCost | Optional

A resource category accepted as the repair material. Any item belonging to this resource type will be accepted. Overrides the material defined in DefaultRepairCost for matched items.

Only one of ItemId or ResourceTypeId should be set. If both are present, ItemId takes priority.


Quantity

Type: Integer | Default: Inherited from DefaultRepairCost | Optional

The base number of materials required to perform a repair for matched items.


ScalingFactor

Type: Double | Default: Inherited from DefaultRepairCost | Optional

Controls how much the repair cost increases based on damage for matched items. See DefaultRepairCost for the full formula.

Formula:

FinalCost=max(0,Quantity×(1+ScalingFactor×(1CurrentDurabilityMaxDurability))+0.5)\text{FinalCost} = \max\left(0, \left\lfloor \text{Quantity} \times \left(1 + \text{ScalingFactor} \times \left(1 - \frac{\text{CurrentDurability}}{\text{MaxDurability}}\right)\right) + 0.5 \right\rfloor\right)

RepairMaxDurability

Type: Boolean | Default: Inherited from DefaultRepairCost | Optional

Controls whether repairs restore the item's maximum durability for matched items. Must be false for MaxDurabilityLoss to have any effect.

If MaxDurabilityLoss is greater than 0.0 and RepairMaxDurability is not set in the custom entry, the plugin will automatically set RepairMaxDurability to false for that entry and log a notice. This does not affect DefaultRepairCost.

If MaxDurabilityLoss is greater than 0.0 and RepairMaxDurability is explicitly set to true, the plugin will force MaxDurabilityLoss to 0.0 and log a warning.


MaxDurabilityLoss

Type: Double | Default: Inherited from DefaultRepairCost | Optional

The percentage of the damage taken that is permanently removed from the item's maximum durability each time it is repaired. For example, 0.5 means 50% of the damage taken is permanently lost from max durability after repair.

RepairMaxDurability must be false for this to have any effect. If RepairMaxDurability is true on this entry, this value will be forced to 0.0.

If the calculated loss would reduce the item's max durability to 0 or below, the repair is blocked entirely.

Formula:

NewMaxDurability=CurrentMaxDurabilityLossAmount\text{NewMaxDurability} = \text{CurrentMaxDurability} - \text{LossAmount}
LossAmount=max((CurrentMaxDurabilityCurrentDurability)×MaxDurabilityLoss, 1)\text{LossAmount} = \max\left((\text{CurrentMaxDurability} - \text{CurrentDurability}) \times \text{MaxDurabilityLoss},\ 1\right)

The minimum loss is always 1, even if the calculated value rounds lower. If NewMaxDurability is less than or equal to 0, the repair is cancelled.


Rules Summary

Scenario
Outcome
Required

Match

Must be set. Entry will not apply to any item without it.

Yes

ItemId

Falls back to DefaultRepairCost if not set. If set, ResourceTypeId is removed.

No

ResourceTypeId

Falls back to DefaultRepairCost if not set. Removed if ItemId is present.

No

Quantity

Falls back to DefaultRepairCost if not set.

No

ScalingFactor

Falls back to DefaultRepairCost if not set.

No

RepairMaxDurability

Falls back to DefaultRepairCost if not set.

No

MaxDurabilityLoss

Falls back to DefaultRepairCost if not set.

No

RepairMaxDurability: true and MaxDurabilityLoss > 0

MaxDurabilityLoss is forced to 0.0. A warning is logged.

RepairMaxDurability not set and MaxDurabilityLoss > 0

RepairMaxDurability is automatically set to false. A notice is logged.

RepairMaxDurability: false and MaxDurabilityLoss > 0

Permanent durability loss is applied on repair.

MaxDurabilityLoss applied would reduce max durability to 0 or below

Repair is blocked. The player cannot repair the item.

CustomRepairCosts is omitted from config

Built-in defaults are used.

CustomRepairCosts is present but empty

No overrides are applied. DefaultRepairCost is used for all items.


Complete Example

In this example, Adamantite items cost 2 adamantite bars using default scaling. Wood items cost 3 of any wood trunk resource at half the scaling rate. Legendary items cost 5 adamantite bars and each repair permanently removes 25% of the damage taken from the item's max durability.

Last updated