Update Mods to be foldered/ own csproj/ ref dll

This commit is contained in:
CWX
2025-02-10 15:04:40 +00:00
parent ed54312f35
commit 7cd8ef9179
49 changed files with 361 additions and 121 deletions
@@ -0,0 +1,22 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<RootNamespace>_3EditSptConfig</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<!-- TODO: Change to Nuget Package -->
<ItemGroup>
<Reference Include="Core">
<HintPath>..\TempReferences\Core.dll</HintPath>
</Reference>
<Reference Include="SptCommon">
<HintPath>..\TempReferences\SptCommon.dll</HintPath>
</Reference>
<Reference Include="SptDependencyInjection">
<HintPath>..\TempReferences\SptDependencyInjection.dll</HintPath>
</Reference>
</ItemGroup>
</Project>
+86
View File
@@ -0,0 +1,86 @@
using Core.Models.Enums;
using Core.Models.External;
using Core.Models.Spt.Config;
using Core.Models.Utils;
using Core.Servers;
using SptCommon.Annotations;
namespace _3EditSptConfig;
[Injectable]
public class EditConfigs : IPostDBLoadMod
{
private readonly AirdropConfig _airdropConfig;
private readonly BotConfig _botConfig;
private readonly ConfigServer _configServer;
private readonly HideoutConfig _hideoutConfig;
private readonly ISptLogger<EditConfigs> _logger;
private readonly PmcChatResponse _pmcChatResponseConfig;
private readonly PmcConfig _pmcConfig;
private readonly QuestConfig _questConfig;
private readonly WeatherConfig _weatherConfig;
// We access configs via ConfigServer
public EditConfigs(
ConfigServer configServer,
ISptLogger<EditConfigs> logger
)
{
_configServer = configServer;
_logger = logger;
// We get the bot config by calling GetConfig and passing the configs 'type' within the diamond brackets
_botConfig = _configServer.GetConfig<BotConfig>();
_hideoutConfig = _configServer.GetConfig<HideoutConfig>();
_weatherConfig = _configServer.GetConfig<WeatherConfig>();
_airdropConfig = _configServer.GetConfig<AirdropConfig>();
_pmcChatResponseConfig = _configServer.GetConfig<PmcChatResponse>();
_questConfig = _configServer.GetConfig<QuestConfig>();
_pmcConfig = _configServer.GetConfig<PmcConfig>();
}
public void PostDBLoad()
{
// Let's edit the weather config to force the season to winter
_weatherConfig.OverrideSeason = Season.WINTER;
// Let's edit the hideout config to Make all crafts take 60 seconds
_hideoutConfig.OverrideCraftTimeSeconds = 60;
// Let's edit the hideout config to Make all upgrades take 60 seconds
_hideoutConfig.OverrideBuildTimeSeconds = 60;
// Let's edit the airdrop config to Make weapon/armor drops REALLY common
_airdropConfig.AirdropTypeWeightings[SptAirdropTypeEnum.weaponArmor] = 999;
// Let's edit the airdrop config to Make weapon/armor drops always have 3 sealed weapon crates
var weaponCrateMinMax = _airdropConfig.Loot["weaponArmor"].WeaponCrateCount;
weaponCrateMinMax.Min = 3;
weaponCrateMinMax.Max = 3;
// Let's make PMCs always mail you when they kill you
_pmcChatResponseConfig.Killer.ResponseChancePercent = 100;
// Let's make quest rewards sent to you via mail last for over a week for unheard profiles
_questConfig.MailRedeemTimeHours["unheard_edition"] = 168;
// Let's make the interchange bot cap huge
_botConfig.MaxBotCap["interchange"] = 50;
// Let's disable loot on scavs
_botConfig.DisableLootOnBotTypes.Add("assault");
// Let's make the conversion rate of scavs to pmcs 100% on factory day
var factory4DayConversionSettings = _pmcConfig.ConvertIntoPmcChance["factory4_day"];
// We get assault bot settings for factory day
var assaultConversionSettings = factory4DayConversionSettings["assault"];
// Set min and max to 100%
assaultConversionSettings.Min = 100;
assaultConversionSettings.Max = 100;
_logger.Success("Finished Editing Configs");
}
}
+13
View File
@@ -0,0 +1,13 @@
{
"Name": "3EditSptConfig",
"Version": "1.0.0",
"SptVersion": "~4.0",
"LoadBefore": [],
"LoadAfter": [],
"IncompatibileMods": [],
"Url": "https://github.com/sp-tarkov/server-csharp/tree/develop/ExampleMods/Mods",
"IsBundleMod": false,
"Author": "SPT",
"Contributors": [],
"Licence": "MIT"
}