If you're on an old version of BetterResearching and want to add a toggleable global cost multiplier, follow these quick steps. This multiplies all research costs and can be enabled/disabled via config or command.

1. Update ConfigData Class
In the `ConfigData` class, add this before the `Version` property:

[JsonProperty(PropertyName = "Global Research Cost Multiplier")]
public MultiplierSettings multiplierSettings = new MultiplierSettings();

public class MultiplierSettings
{
[JsonProperty(PropertyName = "Enabled")]
public bool enabled = false;

[JsonProperty(PropertyName = "Multiplier")]
public float multiplier = 1f;

[JsonProperty(PropertyName = "Round To Nearest Integer")]
public bool roundToNearest = true;
}​

2. Handle Existing Config File
- If your config file (`oxide/config/BetterResearching.json`) already exists, the plugin won't auto-add the new section on reload (since you're manually patching an old version).
- **Solution**: Manually edit the JSON file and insert this snippet before the `"Version"` object:
"Global Research Cost Multiplier": {
"Enabled": false,
"Multiplier": 1.0,
"Round To Nearest Integer": true
},​

- Save the file, then reload the plugin (`o.reload BetterResearching`). If it doesn't pick up, delete the config and let it regenerate (back up first!).
- New installs: The section auto-adds on first load.

3. Add Helper Method
Add this method in the `#region Methods` section:
private int GetEffectiveResearchCost(ConfigData.ResearchSettings researchS)
{
if (!configData.multiplierSettings.enabled) return researchS.scrapAmount;
double multiplied = researchS.scrapAmount * configData.multiplierSettings.multiplier;
if (multiplied < 0) multiplied = 0;
return configData.multiplierSettings.roundToNearest ? (int)Math.Round(multiplied) : (int)multiplied;
}​

4. Replace Cost References
Swap `researchS.scrapAmount` with `GetEffectiveResearchCost(researchS)` in these spots:

- In `CanResearchItem`:
int effectiveCost = GetEffectiveResearchCost(researchS);
if (scrapItem.amount < effectiveCost) { /* use effectiveCost in message */ }​

- In `CanResearch`:
scrapAmount = GetEffectiveResearchCost(researchS);
​

- In `OnItemResearched` (success case):
int effectiveCost = GetEffectiveResearchCost(researchS);
return effectiveCost; // on success​

- In `TryConsumeItem` (failure scrap calc):
int effectiveCost = GetEffectiveResearchCost(researchS);
var amount = (int)Math.Round(effectiveCost * consumeS.scrapPercentage / 100f);​

5. (Optional) Add Toggle Command
Add this in `#region Commands`:
[ConsoleCommand("br.multiplier")]
private void CCmdCostMultiplier(ConsoleSystem.Arg arg)
{
if (arg == null || !arg.IsAdmin) return;

if (!arg.HasArgs())
{
Print(arg, $"Global research cost multiplier is currently {(configData.multiplierSettings.enabled ? "ENABLED" : "DISABLED")}.");
Print(arg, $"Multiplier value: {configData.multiplierSettings.multiplier}x");
Print(arg, $"Rounding to nearest integer: {(configData.multiplierSettings.roundToNearest ? "ON" : "OFF")}");
Print(arg, "Usage:");
Print(arg, " br.multiplier enable / on");
Print(arg, " br.multiplier disable / off");
Print(arg, " br.multiplier set <value> (e.g. br.multiplier set 0.5)");
Print(arg, " br.multiplier round on/off");
return;
}

string subCmd = arg.Args[0].ToLower();

if (subCmd == "enable" || subCmd == "on")
{
configData.multiplierSettings.enabled = true;
Print(arg, "Global research cost multiplier ENABLED.");
}
else if (subCmd == "disable" || subCmd == "off")
{
configData.multiplierSettings.enabled = false;
Print(arg, "Global research cost multiplier DISABLED.");
}
else if (subCmd == "set" && arg.Args.Length > 1)
{
if (float.TryParse(arg.Args[1], out float value) && value >= 0f)
{
configData.multiplierSettings.multiplier = value;
Print(arg, $"Global research cost multiplier set to {value}x.");
}
else
{
Print(arg, "Invalid multiplier value (must be >= 0).");
}
}
else if (subCmd == "round" && arg.Args.Length > 1)
{
string mode = arg.Args[1].ToLower();
if (mode == "on" || mode == "true")
{
configData.multiplierSettings.roundToNearest = true;
Print(arg, "Rounding to nearest integer: ON");
}
else if (mode == "off" || mode == "false")
{
configData.multiplierSettings.roundToNearest = false;
Print(arg, "Rounding to nearest integer: OFF");
}
else
{
Print(arg, "Invalid round mode (use on/off).");
}
}
else
{
Print(arg, "Unknown subcommand. Use br.multiplier for help.");
}

SaveConfig();
}​

6. Using the New Command (`br.multiplier`)
- Enter in server console, RCON, or in-game (if admin) via `/br.multiplier` (depending on your setup).
- No args: Shows status (enabled/disabled, multiplier value, rounding).
- `enable` or `on`: Activates multiplier.
- `disable` or `off`: Deactivates (uses base costs).
- `set <value>`: Changes multiplier (e.g., `br.multiplier set 0.5` for half cost).
- `round on/off`: Toggles rounding (on = round nearest, off = floor).
- Changes auto-save to config. Only admins can use it.

Reload the plugin. Test with multiplier 0.5 and enabled=true—costs halve. While 2=Doubled cost!