Split up mod examples into separate repository
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
<PropertyGroup>
|
||||
<PackageId>SPTarkov.Server.Core</PackageId>
|
||||
<Authors>Single Player Tarkov</Authors>
|
||||
<Description>Core libaries for the Single Player Tarkov server.</Description>
|
||||
<Description>Core library for the Single Player Tarkov server.</Description>
|
||||
<Copyright>Copyright (c) Single Player Tarkov 2025</Copyright>
|
||||
<PackageLicenseFile>LICENSE</PackageLicenseFile>
|
||||
<PackageProjectUrl>https://sp-tarkov.com</PackageProjectUrl>
|
||||
|
||||
@@ -1,9 +1,14 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<PackageId>SPT.Assets</PackageId>
|
||||
<Authors>SPT Team</Authors>
|
||||
<PackageId>SPTarkov.Server.Assets</PackageId>
|
||||
<Authors>Single Player Tarkov</Authors>
|
||||
<Description>Asset library for the Single Player Tarkov server.</Description>
|
||||
<Copyright>Copyright (c) Single Player Tarkov 2025</Copyright>
|
||||
<PackageLicenseFile>LICENSE</PackageLicenseFile>
|
||||
<PackageProjectUrl>https://sp-tarkov.com</PackageProjectUrl>
|
||||
<RepositoryUrl>https://github.com/sp-tarkov/server-csharp</RepositoryUrl>
|
||||
<RepositoryType>git</RepositoryType>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
@@ -19,4 +24,8 @@
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Include="..\..\LICENSE" Pack="true" Visible="false" PackagePath=""/>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -1,9 +1,14 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<PackageId>SPT.Common</PackageId>
|
||||
<Authors>SPT Team</Authors>
|
||||
<PackageId>SPTarkov.Common</PackageId>
|
||||
<Authors>Single Player Tarkov</Authors>
|
||||
<Description>Common shared library for the Single Player Tarkov projects.</Description>
|
||||
<Copyright>Copyright (c) Single Player Tarkov 2025</Copyright>
|
||||
<PackageLicenseFile>LICENSE</PackageLicenseFile>
|
||||
<PackageProjectUrl>https://sp-tarkov.com</PackageProjectUrl>
|
||||
<RepositoryUrl>https://github.com/sp-tarkov/server-csharp</RepositoryUrl>
|
||||
<RepositoryType>git</RepositoryType>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
@@ -15,4 +20,8 @@
|
||||
<PackageReference Include="SemanticVersioning" Version="3.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Include="..\..\LICENSE" Pack="true" Visible="false" PackagePath=""/>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -1,9 +1,14 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<PackageId>SPT.Server.DI</PackageId>
|
||||
<Authors>SPT Team</Authors>
|
||||
<PackageId>SPTarkov.DI</PackageId>
|
||||
<Authors>Single Player Tarkov</Authors>
|
||||
<Description>Dependency injection shared library for the Single Player Tarkov projects.</Description>
|
||||
<Copyright>Copyright (c) Single Player Tarkov 2025</Copyright>
|
||||
<PackageLicenseFile>LICENSE</PackageLicenseFile>
|
||||
<PackageProjectUrl>https://sp-tarkov.com</PackageProjectUrl>
|
||||
<RepositoryUrl>https://github.com/sp-tarkov/server-csharp</RepositoryUrl>
|
||||
<RepositoryType>git</RepositoryType>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
@@ -19,4 +24,8 @@
|
||||
<ProjectReference Include="..\SptCommon\SptCommon.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Include="..\..\LICENSE" Pack="true" Visible="false" PackagePath=""/>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<RootNamespace>_10CustomRoute</RootNamespace>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<OutputType>Library</OutputType>
|
||||
<Version>0.0.1</Version>
|
||||
<!-- The two lines below will set the output path for the binaries -->
|
||||
<OutputPath>bin\$(Configuration)\$(ProjectName)\$(AssemblyName)-$(Version)\</OutputPath>
|
||||
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- TODO: Change to Nuget Package -->
|
||||
<ItemGroup>
|
||||
<Reference Include="Core">
|
||||
<HintPath>..\TempReferences\Core.dll</HintPath>
|
||||
<Private>false</Private>
|
||||
<CopyLocal>false</CopyLocal>
|
||||
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
||||
</Reference>
|
||||
<Reference Include="SptCommon">
|
||||
<HintPath>..\TempReferences\SptCommon.dll</HintPath>
|
||||
<Private>false</Private>
|
||||
<CopyLocal>false</CopyLocal>
|
||||
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
||||
</Reference>
|
||||
<Reference Include="SptDependencyInjection">
|
||||
<HintPath>..\TempReferences\SptDependencyInjection.dll</HintPath>
|
||||
<Private>false</Private>
|
||||
<CopyLocal>false</CopyLocal>
|
||||
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -1,46 +0,0 @@
|
||||
using Core.DI;
|
||||
using Core.Models.Utils;
|
||||
using Core.Utils;
|
||||
using SptCommon.Annotations;
|
||||
|
||||
namespace _10CustomRoute;
|
||||
|
||||
// Flag our mod as a type of static router
|
||||
[Injectable(InjectableTypeOverride = typeof(StaticRouter))]
|
||||
public class CustomStaticRouter : StaticRouter
|
||||
{
|
||||
public CustomStaticRouter(
|
||||
JsonUtil jsonUtil) : base(
|
||||
jsonUtil,
|
||||
// Add an array of routes we want to add
|
||||
GetCustomRoutes()
|
||||
)
|
||||
{
|
||||
}
|
||||
|
||||
private static List<RouteAction> GetCustomRoutes()
|
||||
{
|
||||
return
|
||||
[
|
||||
new RouteAction(
|
||||
"/example/route/static",
|
||||
(
|
||||
url,
|
||||
info,
|
||||
sessionId,
|
||||
output
|
||||
) => HandleRoute(url, info as ExampleStaticRequestData, sessionId)
|
||||
)
|
||||
];
|
||||
}
|
||||
|
||||
private static string HandleRoute(string url, ExampleStaticRequestData info, string sessionId)
|
||||
{
|
||||
// Stuff goes here
|
||||
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
public class ExampleStaticRequestData : IRequestData
|
||||
{
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
{
|
||||
"name": "10CustomStaticRouter",
|
||||
"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"
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<RootNamespace>_11RegisterClassesInDI</RootNamespace>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<OutputType>Library</OutputType>
|
||||
<Version>0.0.1</Version>
|
||||
<!-- The two lines below will set the output path for the binaries -->
|
||||
<OutputPath>bin\$(Configuration)\$(ProjectName)\$(AssemblyName)-$(Version)\</OutputPath>
|
||||
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- TODO: Change to Nuget Package -->
|
||||
<ItemGroup>
|
||||
<Reference Include="Core">
|
||||
<HintPath>..\TempReferences\Core.dll</HintPath>
|
||||
<Private>false</Private>
|
||||
<CopyLocal>false</CopyLocal>
|
||||
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
||||
</Reference>
|
||||
<Reference Include="SptCommon">
|
||||
<HintPath>..\TempReferences\SptCommon.dll</HintPath>
|
||||
<Private>false</Private>
|
||||
<CopyLocal>false</CopyLocal>
|
||||
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
||||
</Reference>
|
||||
<Reference Include="SptDependencyInjection">
|
||||
<HintPath>..\TempReferences\SptDependencyInjection.dll</HintPath>
|
||||
<Private>false</Private>
|
||||
<CopyLocal>false</CopyLocal>
|
||||
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -1,76 +0,0 @@
|
||||
using Core.Models.External;
|
||||
using Core.Models.Utils;
|
||||
using SptCommon.Annotations;
|
||||
|
||||
namespace _11RegisterClassesInDI;
|
||||
|
||||
[Injectable]
|
||||
public class Bundle : IPostDBLoadMod // Run after db has loaded
|
||||
{
|
||||
private readonly SingletonClassExample _singletonClassExample;
|
||||
private readonly TransientClassExample _transientClassExample;
|
||||
|
||||
// We inject 2 classes (singleton and transient) we've made below
|
||||
public Bundle(
|
||||
SingletonClassExample singletonClassExample,
|
||||
TransientClassExample transientClassExample)
|
||||
{
|
||||
_singletonClassExample = singletonClassExample;
|
||||
_transientClassExample = transientClassExample;
|
||||
}
|
||||
|
||||
public void PostDBLoad()
|
||||
{
|
||||
_singletonClassExample.IncrementCounterAndLog();
|
||||
_singletonClassExample.IncrementCounterAndLog();
|
||||
_singletonClassExample.IncrementCounterAndLog();
|
||||
|
||||
_transientClassExample.IncrementCounterAndLog();
|
||||
_transientClassExample.IncrementCounterAndLog();
|
||||
_transientClassExample.IncrementCounterAndLog();
|
||||
}
|
||||
}
|
||||
|
||||
// This class is registered as a singleton. This means ONE and only ONE instance
|
||||
// of this class will ever exist.
|
||||
[Injectable(InjectionType.Singleton)]
|
||||
public class SingletonClassExample
|
||||
{
|
||||
private readonly ISptLogger<SingletonClassExample> _logger;
|
||||
private int _counter;
|
||||
|
||||
public SingletonClassExample(
|
||||
ISptLogger<SingletonClassExample> logger)
|
||||
{
|
||||
_logger = logger;
|
||||
_counter = 0;
|
||||
}
|
||||
|
||||
public void IncrementCounterAndLog()
|
||||
{
|
||||
_counter++;
|
||||
_logger.Success($"{_counter}");
|
||||
}
|
||||
}
|
||||
|
||||
// This class is being registered as default or transient. This means that
|
||||
// every time a class requests an instance of this type a new one will be created
|
||||
[Injectable(InjectionType.Transient)] // [Injectable] is the same as doing this
|
||||
public class TransientClassExample
|
||||
{
|
||||
private readonly ISptLogger<TransientClassExample> _logger;
|
||||
private int _counter;
|
||||
|
||||
public TransientClassExample(
|
||||
ISptLogger<TransientClassExample> logger)
|
||||
{
|
||||
_logger = logger;
|
||||
_counter = 0;
|
||||
}
|
||||
|
||||
public void IncrementCounterAndLog()
|
||||
{
|
||||
_counter++;
|
||||
_logger.Success($"{_counter}");
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
{
|
||||
"name": "11RegisterClassesInDI",
|
||||
"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"
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<RootNamespace>_12Bundle</RootNamespace>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<OutputType>Library</OutputType>
|
||||
<Version>0.0.1</Version>
|
||||
<!-- The two lines below will set the output path for the binaries -->
|
||||
<OutputPath>bin\$(Configuration)\$(ProjectName)\$(AssemblyName)-$(Version)\</OutputPath>
|
||||
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- TODO: Change to Nuget Package -->
|
||||
<ItemGroup>
|
||||
<Reference Include="Core">
|
||||
<HintPath>..\TempReferences\Core.dll</HintPath>
|
||||
<Private>false</Private>
|
||||
<CopyLocal>false</CopyLocal>
|
||||
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
||||
</Reference>
|
||||
<Reference Include="SptCommon">
|
||||
<HintPath>..\TempReferences\SptCommon.dll</HintPath>
|
||||
<Private>false</Private>
|
||||
<CopyLocal>false</CopyLocal>
|
||||
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
||||
</Reference>
|
||||
<Reference Include="SptDependencyInjection">
|
||||
<HintPath>..\TempReferences\SptDependencyInjection.dll</HintPath>
|
||||
<Private>false</Private>
|
||||
<CopyLocal>false</CopyLocal>
|
||||
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -1,28 +0,0 @@
|
||||
using System.Reflection;
|
||||
using Core.Loaders;
|
||||
using Core.Models.External;
|
||||
using SptCommon.Annotations;
|
||||
|
||||
namespace _12Bundle;
|
||||
|
||||
[Injectable]
|
||||
public class Bundle : IPostDBLoadMod
|
||||
{
|
||||
private readonly BundleLoader _bundleLoader;
|
||||
|
||||
public Bundle(
|
||||
BundleLoader bundleLoader)
|
||||
{
|
||||
_bundleLoader = bundleLoader;
|
||||
}
|
||||
|
||||
public void PostDBLoad()
|
||||
{
|
||||
// must be a relative path.
|
||||
// for example "./user/mods/Mod3"
|
||||
// . being the server.exe or root directory
|
||||
// follow all the way to your mods folder name
|
||||
// you will be only changing from "./user/mods/" onwards
|
||||
_bundleLoader.AddBundles("./user/mods/Mod3");
|
||||
}
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
{
|
||||
"manifest": [
|
||||
{
|
||||
"key": "assets/content/weapons/usable_items/item_bottle/textures/client_assets.bundle",
|
||||
"dependencyKeys": []
|
||||
}
|
||||
]
|
||||
}
|
||||
BIN
Binary file not shown.
@@ -1,13 +0,0 @@
|
||||
{
|
||||
"name": "12Bundle",
|
||||
"version": "1.0.0",
|
||||
"sptVersion": "~4.0",
|
||||
"loadBefore": [],
|
||||
"loadAfter": [],
|
||||
"IncompatibileMods": [],
|
||||
"url": "https://github.com/sp-tarkov/server-csharp/tree/develop/ExampleMods/Mods",
|
||||
"isBundleMod": true,
|
||||
"author": "SPT",
|
||||
"contributors": [],
|
||||
"licence": "MIT"
|
||||
}
|
||||
Binary file not shown.
@@ -1,36 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<RootNamespace>_13._1AddTraderWithDynamicAssorts</RootNamespace>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<OutputType>Library</OutputType>
|
||||
<Version>0.0.1</Version>
|
||||
<!-- The two lines below will set the output path for the binaries -->
|
||||
<OutputPath>bin\$(Configuration)\$(ProjectName)\$(AssemblyName)-$(Version)\</OutputPath>
|
||||
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- TODO: Change to Nuget Package -->
|
||||
<ItemGroup>
|
||||
<Reference Include="Core">
|
||||
<HintPath>..\TempReferences\Core.dll</HintPath>
|
||||
<Private>false</Private>
|
||||
<CopyLocal>false</CopyLocal>
|
||||
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
||||
</Reference>
|
||||
<Reference Include="SptCommon">
|
||||
<HintPath>..\TempReferences\SptCommon.dll</HintPath>
|
||||
<Private>false</Private>
|
||||
<CopyLocal>false</CopyLocal>
|
||||
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
||||
</Reference>
|
||||
<Reference Include="SptDependencyInjection">
|
||||
<HintPath>..\TempReferences\SptDependencyInjection.dll</HintPath>
|
||||
<Private>false</Private>
|
||||
<CopyLocal>false</CopyLocal>
|
||||
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -1,181 +0,0 @@
|
||||
using Core.Models.Common;
|
||||
using Core.Models.Eft.Common.Tables;
|
||||
using Core.Models.Spt.Config;
|
||||
using Core.Models.Spt.Server;
|
||||
using Core.Utils;
|
||||
using Core.Utils.Cloners;
|
||||
|
||||
namespace _13._1AddTraderWithDynamicAssorts
|
||||
{
|
||||
public class AddTraderHelper
|
||||
{
|
||||
/**
|
||||
* Add record to trader config to set the refresh time of trader in seconds (default is 60 minutes)
|
||||
* @param traderConfig trader config to add our trader to
|
||||
* @param baseJson json file for trader (db/base.json)
|
||||
* @param refreshTimeSecondsMin How many seconds between trader stock refresh min time
|
||||
* @param refreshTimeSecondsMax How many seconds between trader stock refresh max time
|
||||
*/
|
||||
public void SetTraderUpdateTime(TraderConfig traderConfig, TraderBase baseJson, int refreshTimeSecondsMin, int refreshTimeSecondsMax)
|
||||
{
|
||||
// Add refresh time in seconds to config
|
||||
var traderRefreshRecord = new UpdateTime
|
||||
{
|
||||
TraderId = baseJson.Id,
|
||||
Seconds = new MinMax<int>(refreshTimeSecondsMin, refreshTimeSecondsMax)
|
||||
};
|
||||
|
||||
|
||||
traderConfig.UpdateTime.Add(traderRefreshRecord);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add our new trader to the database
|
||||
* @param traderDetailsToAdd trader details
|
||||
* @param tables database
|
||||
* @param jsonUtil json utility class
|
||||
*/
|
||||
public void AddTraderToDb(TraderBase traderDetailsToAdd, DatabaseTables tables, ICloner cloner, TraderAssort assort)
|
||||
{
|
||||
// Create trader data ready to add to database
|
||||
var traderDataToAdd = new Trader
|
||||
{
|
||||
Assort = cloner.Clone(assort),
|
||||
Base = cloner.Clone(traderDetailsToAdd),
|
||||
QuestAssort = new Dictionary<string, Dictionary<string, string>> // quest assort is empty as trader has no assorts unlocked by quests
|
||||
{
|
||||
{ "Started", new Dictionary<string, string>() },
|
||||
{ "Success", new Dictionary<string, string>() },
|
||||
{ "Fail", new Dictionary<string, string>() }
|
||||
}
|
||||
};
|
||||
|
||||
// Add trader to trader table, key is the traders id
|
||||
tables.Traders.Add(traderDetailsToAdd.Id, traderDataToAdd);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add traders name/location/description to the locale table
|
||||
* @param baseJson json file for trader (db/base.json)
|
||||
* @param tables database tables
|
||||
* @param fullName Complete name of trader
|
||||
* @param firstName First name of trader
|
||||
* @param nickName Nickname of trader
|
||||
* @param location Location of trader (e.g. "Here in the cat shop")
|
||||
* @param description Description of trader
|
||||
*/
|
||||
public void AddTraderToLocales(TraderBase baseJson, DatabaseTables tables, string fullName, string firstName, string nickName, string location, string description)
|
||||
{
|
||||
// For each language, add locale for the new trader
|
||||
var locales = tables.Locales.Global;
|
||||
|
||||
foreach (var (key, value) in locales) {
|
||||
value.Value[$"{baseJson.Id} FullName"] = fullName;
|
||||
value.Value[$"{baseJson.Id} FirstName"] = firstName;
|
||||
value.Value[$"{baseJson.Id} Nickname"] = nickName;
|
||||
value.Value[$"{baseJson.Id} Location"] = location;
|
||||
value.Value[$"{baseJson.Id} Description"] = description;
|
||||
}
|
||||
}
|
||||
|
||||
public List<Item> CreateGlock()
|
||||
{
|
||||
// Create an array ready to hold weapon + all mods
|
||||
var glock = new List<Item>();
|
||||
|
||||
// Add the base first
|
||||
glock.Add(new Item { // Add the base weapon first
|
||||
Id =
|
||||
NewItemIds.GLOCK_BASE, // Ids matter, MUST BE UNIQUE
|
||||
Template =
|
||||
"5a7ae0c351dfba0017554310", // This is the weapons tpl, found on: https://db.sp-tarkov.com/search
|
||||
});
|
||||
|
||||
// Add barrel
|
||||
glock.Add(new Item {
|
||||
Id =
|
||||
NewItemIds.GLOCK_BARREL,
|
||||
Template =
|
||||
"5a6b60158dc32e000a31138b",
|
||||
ParentId =
|
||||
NewItemIds.GLOCK_BASE, // This is a sub item, you need to define its parent its attached to / inserted into
|
||||
SlotId =
|
||||
"mod_barrel", // Required for mods, you need to define what 'slot' the mod will fill on the weapon
|
||||
});
|
||||
|
||||
// Add receiver
|
||||
glock.Add( new Item {
|
||||
Id =
|
||||
NewItemIds.GLOCK_RECIEVER,
|
||||
Template =
|
||||
"5a9685b1a2750c0032157104",
|
||||
ParentId =
|
||||
NewItemIds.GLOCK_BASE,
|
||||
SlotId =
|
||||
"mod_reciever",
|
||||
});
|
||||
|
||||
// Add compensator
|
||||
glock.Add(new Item {
|
||||
Id =
|
||||
NewItemIds.GLOCK_COMPENSATOR,
|
||||
Template =
|
||||
"5a7b32a2e899ef00135e345a",
|
||||
ParentId =
|
||||
NewItemIds.GLOCK_RECIEVER, // The parent of this mod is the receiver NOT weapon, be careful to get the correct parent
|
||||
SlotId =
|
||||
"mod_muzzle",
|
||||
});
|
||||
|
||||
// Add Pistol grip
|
||||
glock.Add(new Item {
|
||||
Id =
|
||||
NewItemIds.GLOCK_PISTOL_GRIP,
|
||||
Template =
|
||||
"5a7b4960e899ef197b331a2d",
|
||||
ParentId =
|
||||
NewItemIds.GLOCK_BASE,
|
||||
SlotId =
|
||||
"mod_pistol_grip",
|
||||
});
|
||||
|
||||
// Add front sight
|
||||
glock.Add(new Item {
|
||||
Id =
|
||||
NewItemIds.GLOCK_FRONT_SIGHT,
|
||||
Template =
|
||||
"5a6f5d528dc32e00094b97d9",
|
||||
ParentId =
|
||||
NewItemIds.GLOCK_RECIEVER,
|
||||
SlotId =
|
||||
"mod_sight_rear",
|
||||
});
|
||||
|
||||
// Add rear sight
|
||||
glock.Add(new Item {
|
||||
Id =
|
||||
NewItemIds.GLOCK_REAR_SIGHT,
|
||||
Template =
|
||||
"5a6f58f68dc32e000a311390",
|
||||
ParentId =
|
||||
NewItemIds.GLOCK_RECIEVER,
|
||||
SlotId =
|
||||
"mod_sight_front",
|
||||
});
|
||||
|
||||
// Add magazine
|
||||
glock.Add(new Item {
|
||||
Id =
|
||||
NewItemIds.GLOCK_MAGAZINE,
|
||||
Template =
|
||||
"630769c4962d0247b029dc60",
|
||||
ParentId =
|
||||
NewItemIds.GLOCK_BASE,
|
||||
SlotId =
|
||||
"mod_magazine",
|
||||
});
|
||||
|
||||
return glock;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,145 +0,0 @@
|
||||
using Core.Helpers;
|
||||
using System.Reflection;
|
||||
using Core.Models.Eft.Common.Tables;
|
||||
using Core.Models.Enums;
|
||||
using Core.Models.External;
|
||||
using Core.Models.Spt.Config;
|
||||
using Core.Models.Utils;
|
||||
using Core.Routers;
|
||||
using Core.Servers;
|
||||
using Core.Services;
|
||||
using Core.Utils;
|
||||
using Core.Utils.Cloners;
|
||||
using SptCommon.Annotations;
|
||||
using Path = System.IO.Path;
|
||||
|
||||
namespace _13._1AddTraderWithDynamicAssorts;
|
||||
|
||||
[Injectable]
|
||||
public class AddTraderWithDynamicAssorts : IPostDBLoadMod
|
||||
{
|
||||
private readonly ISptLogger<AddTraderWithDynamicAssorts> _logger;
|
||||
private readonly ModHelper _modHelper;
|
||||
private readonly HashUtil _hashUtil;
|
||||
private readonly JsonUtil _jsonUtil;
|
||||
private readonly FileUtil _fileUtil;
|
||||
private readonly DatabaseService _databaseService;
|
||||
private readonly ImageRouter _imageRouter;
|
||||
private readonly ConfigServer _configServer;
|
||||
private readonly ICloner _cloner;
|
||||
private readonly TraderConfig _traderConfig;
|
||||
private readonly RagfairConfig _ragfairConfig;
|
||||
|
||||
// This MUST match the folder name of the mod in the user/mods folder
|
||||
private const string _modName = "13.1AddTraderWithDynamicAssorts";
|
||||
|
||||
public AddTraderWithDynamicAssorts(
|
||||
ISptLogger<AddTraderWithDynamicAssorts> logger,
|
||||
ModHelper modHelper,
|
||||
HashUtil hashUtil,
|
||||
JsonUtil jsonUtil,
|
||||
FileUtil fileUtil,
|
||||
DatabaseService databaseService,
|
||||
ImageRouter imageRouter,
|
||||
ConfigServer configServer,
|
||||
ICloner cloner )
|
||||
{
|
||||
_logger = logger;
|
||||
_modHelper = modHelper;
|
||||
_hashUtil = hashUtil;
|
||||
_jsonUtil = jsonUtil;
|
||||
_fileUtil = fileUtil;
|
||||
_databaseService = databaseService;
|
||||
_imageRouter = imageRouter;
|
||||
_configServer = configServer;
|
||||
_cloner = cloner;
|
||||
|
||||
_traderConfig = _configServer.GetConfig<TraderConfig>();
|
||||
_ragfairConfig = _configServer.GetConfig<RagfairConfig>();
|
||||
}
|
||||
|
||||
public void PostDBLoad()
|
||||
{
|
||||
var pathToMod = _modHelper.GetAbsolutePathToModFolder(Assembly.GetExecutingAssembly());
|
||||
|
||||
var traderImagePath = Path.Combine(pathToMod, "db/cat.jpg");
|
||||
var traderBase = _modHelper.GetJsonDataFromFile<TraderBase>(pathToMod, "db/base.json");
|
||||
|
||||
// Create helper class and use it to register our traders image/icon + set its stock refresh time
|
||||
var addTraderHelper = new AddTraderHelper();
|
||||
_imageRouter.AddRoute(traderBase.Avatar.Replace(".jpg", ""), traderImagePath);
|
||||
addTraderHelper.SetTraderUpdateTime(_traderConfig, traderBase, 3600, 4000);
|
||||
|
||||
// Add trader to flea market
|
||||
_ragfairConfig.Traders[traderBase.Id] = true;
|
||||
|
||||
// Get a reference to the database tables
|
||||
var tables = _databaseService.GetTables();
|
||||
|
||||
addTraderHelper.AddTraderToDb(
|
||||
traderBase,
|
||||
_databaseService.GetTables(),
|
||||
_cloner,
|
||||
new TraderAssort {Items = [], BarterScheme = new Dictionary<string, List<List<BarterScheme>>>(), LoyalLevelItems = new Dictionary<string, int>()});
|
||||
_logger.Success("added trader base");
|
||||
var fluentAssortCreator = new FluentTraderAssortCreator(_logger, _hashUtil);
|
||||
|
||||
// Add milk
|
||||
fluentAssortCreator
|
||||
.CreateSingleAssortItem(ItemTpl.DRINK_PACK_OF_MILK)
|
||||
.AddStackCount(200)
|
||||
.AddBuyRestriction(10)
|
||||
.AddMoneyCost(Money.ROUBLES, 2000)
|
||||
.AddLoyaltyLevel(1)
|
||||
.Export(tables.Traders[traderBase.Id]);
|
||||
|
||||
// Add 3x bitcoin + salewa for milk barter
|
||||
fluentAssortCreator
|
||||
.CreateSingleAssortItem(ItemTpl.DRINK_PACK_OF_MILK)
|
||||
.AddStackCount(100)
|
||||
.AddBarterCost(ItemTpl.BARTER_PHYSICAL_BITCOIN, 3)
|
||||
.AddBarterCost(ItemTpl.MEDKIT_SALEWA_FIRST_AID_KIT, 1)
|
||||
.AddLoyaltyLevel(1)
|
||||
.Export(tables.Traders[traderBase.Id]);
|
||||
|
||||
|
||||
// Add glock as a money purchase
|
||||
fluentAssortCreator
|
||||
.CreateComplexAssortItem(addTraderHelper.CreateGlock())
|
||||
.AddUnlimitedStackCount()
|
||||
.AddMoneyCost(Money.ROUBLES, 20000)
|
||||
.AddBuyRestriction(3)
|
||||
.AddLoyaltyLevel(1)
|
||||
.Export(tables.Traders[traderBase.Id]);
|
||||
|
||||
// Add mp133 preset as a barter for mayonase
|
||||
fluentAssortCreator
|
||||
.CreateComplexAssortItem(tables.Globals.ItemPresets["584148f2245977598f1ad387"].Items) // Weapon preset id comes from globals.json
|
||||
.AddStackCount(200)
|
||||
.AddBarterCost(ItemTpl.FOOD_JAR_OF_DEVILDOG_MAYO, 1)
|
||||
.AddBuyRestriction(3)
|
||||
.AddLoyaltyLevel(1)
|
||||
.Export(tables.Traders[traderBase.Id]);
|
||||
|
||||
addTraderHelper.AddTraderToLocales(
|
||||
traderBase,
|
||||
_databaseService.GetTables(),
|
||||
traderBase.Name,
|
||||
"Cat",
|
||||
traderBase.Nickname,
|
||||
traderBase.Location,
|
||||
"This is the cat shop. Meow.");
|
||||
}
|
||||
}
|
||||
|
||||
public static class NewItemIds
|
||||
{
|
||||
public static string GLOCK_BASE = "66eeef3b2a166b73d2066a74";
|
||||
public static string GLOCK_BARREL = "66eeef3b2a166b73d2066a75";
|
||||
public static string GLOCK_RECIEVER = "66eeef3b2a166b73d2066a76";
|
||||
public static string GLOCK_COMPENSATOR = "66eeef3b2a166b73d2066a77";
|
||||
public static string GLOCK_PISTOL_GRIP = "66eeef3b2a166b73d2066a78";
|
||||
public static string GLOCK_REAR_SIGHT = "66eeef3b2a166b73d2066a79";
|
||||
public static string GLOCK_FRONT_SIGHT = "66eeef3b2a166b73d2066a7a";
|
||||
public static string GLOCK_MAGAZINE = "66eeef3b2a166b73d2066a7b";
|
||||
}
|
||||
@@ -1,172 +0,0 @@
|
||||
using Core.Models.Eft.Common.Tables;
|
||||
using Core.Models.Utils;
|
||||
using Core.Utils;
|
||||
|
||||
namespace _13._1AddTraderWithDynamicAssorts;
|
||||
|
||||
public class FluentTraderAssortCreator
|
||||
{
|
||||
private readonly ISptLogger<AddTraderWithDynamicAssorts> _logger;
|
||||
private readonly HashUtil _hashUtil;
|
||||
|
||||
private readonly List<Item> _itemsToSell = [];
|
||||
private readonly Dictionary<string, List<List<BarterScheme>>> _barterScheme = new();
|
||||
private readonly Dictionary<string, int> _loyaltyLevel = new();
|
||||
|
||||
public FluentTraderAssortCreator(
|
||||
ISptLogger<AddTraderWithDynamicAssorts> logger,
|
||||
HashUtil hashUtil)
|
||||
{
|
||||
_logger = logger;
|
||||
_hashUtil = hashUtil;
|
||||
}
|
||||
|
||||
public FluentTraderAssortCreator CreateSingleAssortItem(string itemTpl, string? itemId = null)
|
||||
{
|
||||
// Create item ready for insertion into assort table
|
||||
var newItemToAdd = new Item
|
||||
{
|
||||
Id = itemId ?? _hashUtil.Generate(),
|
||||
Template = itemTpl,
|
||||
ParentId = "hideout", // Should always be "hideout"
|
||||
SlotId = "hideout", // Should always be "hideout"
|
||||
Upd = new Upd
|
||||
{
|
||||
UnlimitedCount = false,
|
||||
StackObjectsCount = 100
|
||||
}
|
||||
};
|
||||
|
||||
_itemsToSell.Add(newItemToAdd);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public FluentTraderAssortCreator CreateComplexAssortItem(List<Item> items)
|
||||
{
|
||||
items[0].ParentId = "hideout";
|
||||
items[0].SlotId = "hideout";
|
||||
|
||||
items[0].Upd ??= new Upd();
|
||||
|
||||
items[0].Upd.UnlimitedCount = false;
|
||||
items[0].Upd.StackObjectsCount = 100;
|
||||
|
||||
_itemsToSell.AddRange(items);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public FluentTraderAssortCreator AddStackCount(int stackCount)
|
||||
{
|
||||
_itemsToSell[0].Upd.StackObjectsCount = stackCount;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public FluentTraderAssortCreator AddUnlimitedStackCount()
|
||||
{
|
||||
_itemsToSell[0].Upd.StackObjectsCount = 999999;
|
||||
_itemsToSell[0].Upd.UnlimitedCount = true;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public FluentTraderAssortCreator MakeStackCountUnlimited()
|
||||
{
|
||||
_itemsToSell[0].Upd.StackObjectsCount = 999999;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public FluentTraderAssortCreator AddBuyRestriction(int maxBuyLimit)
|
||||
{
|
||||
_itemsToSell[0].Upd.BuyRestrictionMax = maxBuyLimit;
|
||||
_itemsToSell[0].Upd.BuyRestrictionCurrent = 0;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public FluentTraderAssortCreator AddLoyaltyLevel(int level)
|
||||
{
|
||||
_loyaltyLevel[_itemsToSell[0].Id] = level;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public FluentTraderAssortCreator AddMoneyCost(string currencyType, int amount)
|
||||
{
|
||||
var dataToAdd = new BarterScheme
|
||||
{
|
||||
Count = amount,
|
||||
Template = currencyType
|
||||
};
|
||||
|
||||
_barterScheme.Add(_itemsToSell[0].Id, [[dataToAdd]]);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public FluentTraderAssortCreator AddBarterCost(string itemTpl, int count)
|
||||
{
|
||||
var sellableItemId = _itemsToSell[0].Id;
|
||||
|
||||
// No data at all, create
|
||||
if (_barterScheme.Count == 0)
|
||||
{
|
||||
var dataToAdd = new BarterScheme
|
||||
{
|
||||
Count = count,
|
||||
Template = itemTpl
|
||||
};
|
||||
|
||||
_barterScheme[sellableItemId] = [[dataToAdd]];
|
||||
}
|
||||
else
|
||||
{
|
||||
// Item already exists, add to
|
||||
var existingData = _barterScheme[sellableItemId][0].FirstOrDefault(x => x.Template == itemTpl);
|
||||
if (existingData is not null)
|
||||
{
|
||||
// itemtpl already a barter for item, add to count
|
||||
existingData.Count += count;
|
||||
}
|
||||
else
|
||||
{
|
||||
// No barter for item, add it fresh
|
||||
_barterScheme[sellableItemId][0].Add(new BarterScheme
|
||||
{
|
||||
Count = count,
|
||||
Template = itemTpl
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset objet ready for reuse
|
||||
* @returns
|
||||
*/
|
||||
public FluentTraderAssortCreator? Export(Trader data)
|
||||
{
|
||||
var itemBeingSoldId = _itemsToSell[0].Id;
|
||||
if (!data.Assort.Items.Exists(x => x.Id == itemBeingSoldId))
|
||||
{
|
||||
_logger.Error($"Unable to add complex item with item key: {_itemsToSell[0].Id}, key already used");
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
data.Assort.Items.AddRange(_itemsToSell);
|
||||
data.Assort.BarterScheme[itemBeingSoldId] = _barterScheme[itemBeingSoldId];
|
||||
data.Assort.LoyalLevelItems[itemBeingSoldId] = _loyaltyLevel[itemBeingSoldId];
|
||||
|
||||
_itemsToSell.Clear();
|
||||
_barterScheme.Clear();
|
||||
_loyaltyLevel.Clear();
|
||||
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -1,66 +0,0 @@
|
||||
{
|
||||
"_id": "66eeef8b2a166b73d2066a7e",
|
||||
"working": true,
|
||||
"availableInRaid": false,
|
||||
"items_buy": {
|
||||
"category": [
|
||||
"5422acb9af1c889c16000029",
|
||||
"5448e8d04bdc2ddf718b4569"
|
||||
],
|
||||
"id_list": []
|
||||
},
|
||||
"items_buy_prohibited": {},
|
||||
"customization_seller": false,
|
||||
"name": "Cat",
|
||||
"surname": " ",
|
||||
"nickname": "Maxwell",
|
||||
"location": "Downtown tarkov",
|
||||
"avatar": "/files/trader/avatar/cat.jpg",
|
||||
"balance_rub": 5000000,
|
||||
"balance_dol": 0,
|
||||
"balance_eur": 0,
|
||||
"unlockedByDefault": true,
|
||||
"discount": 0,
|
||||
"discount_end": 0,
|
||||
"buyer_up": true,
|
||||
"currency": "RUB",
|
||||
"nextResupply": 1615141448,
|
||||
"repair": {
|
||||
"availability": false,
|
||||
"quality": "2",
|
||||
"excluded_id_list": [],
|
||||
"excluded_category": [],
|
||||
"currency": "5449016a4bdc2d6f028b456f",
|
||||
"currency_coefficient": 1,
|
||||
"price_rate": 10
|
||||
},
|
||||
"insurance": {
|
||||
"availability": false,
|
||||
"min_payment": 0,
|
||||
"min_return_hour": 0,
|
||||
"max_return_hour": 0,
|
||||
"max_storage_time": 99,
|
||||
"excluded_category": []
|
||||
},
|
||||
"gridHeight": 150,
|
||||
"loyaltyLevels": [{
|
||||
"minLevel": 1,
|
||||
"minSalesSum": 0,
|
||||
"minStanding": 0,
|
||||
"buy_price_coef": 38,
|
||||
"repair_price_coef": 175,
|
||||
"insurance_price_coef": 10,
|
||||
"exchange_price_coef": 0,
|
||||
"heal_price_coef": 0
|
||||
}
|
||||
],
|
||||
"sell_category": [
|
||||
"575146b724597720a27126d5",
|
||||
"635a758bfefc88a93f021b8a",
|
||||
"55d45d3f4bdc2d972f8b456c",
|
||||
"5b363dd25acfc4001a598fd2",
|
||||
"5d1b36a186f7742523398433",
|
||||
"59e3577886f774176a362503",
|
||||
"5d6e67fba4b9361bc73bc779"
|
||||
]
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
{
|
||||
"name": "13.1AddTraderWithDynamicAssorts",
|
||||
"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"
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<RootNamespace>_13AddTraderWithAssortJson</RootNamespace>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<OutputType>Library</OutputType>
|
||||
<Version>0.0.1</Version>
|
||||
<!-- The two lines below will set the output path for the binaries -->
|
||||
<OutputPath>bin\$(Configuration)\$(ProjectName)\$(AssemblyName)-$(Version)\</OutputPath>
|
||||
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- TODO: Change to Nuget Package -->
|
||||
<ItemGroup>
|
||||
<Reference Include="Core">
|
||||
<HintPath>..\TempReferences\Core.dll</HintPath>
|
||||
<Private>false</Private>
|
||||
<CopyLocal>false</CopyLocal>
|
||||
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
||||
</Reference>
|
||||
<Reference Include="SptCommon">
|
||||
<HintPath>..\TempReferences\SptCommon.dll</HintPath>
|
||||
<Private>false</Private>
|
||||
<CopyLocal>false</CopyLocal>
|
||||
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
||||
</Reference>
|
||||
<Reference Include="SptDependencyInjection">
|
||||
<HintPath>..\TempReferences\SptDependencyInjection.dll</HintPath>
|
||||
<Private>false</Private>
|
||||
<CopyLocal>false</CopyLocal>
|
||||
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -1,81 +0,0 @@
|
||||
using Core.Models.Common;
|
||||
using Core.Models.Eft.Common.Tables;
|
||||
using Core.Models.Spt.Config;
|
||||
using Core.Models.Spt.Server;
|
||||
using Core.Utils;
|
||||
using Core.Utils.Cloners;
|
||||
|
||||
namespace _13AddTraderWithAssortJson
|
||||
{
|
||||
public class AddTraderHelper
|
||||
{
|
||||
/**
|
||||
* Add record to trader config to set the refresh time of trader in seconds (default is 60 minutes)
|
||||
* @param traderConfig trader config to add our trader to
|
||||
* @param baseJson json file for trader (db/base.json)
|
||||
* @param refreshTimeSecondsMin How many seconds between trader stock refresh min time
|
||||
* @param refreshTimeSecondsMax How many seconds between trader stock refresh max time
|
||||
*/
|
||||
public void SetTraderUpdateTime(TraderConfig traderConfig, TraderBase baseJson, int refreshTimeSecondsMin, int refreshTimeSecondsMax)
|
||||
{
|
||||
// Add refresh time in seconds to config
|
||||
var traderRefreshRecord = new UpdateTime
|
||||
{
|
||||
TraderId = baseJson.Id,
|
||||
Seconds = new MinMax<int>(refreshTimeSecondsMin, refreshTimeSecondsMax)
|
||||
};
|
||||
|
||||
|
||||
traderConfig.UpdateTime.Add(traderRefreshRecord);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add our new trader to the database
|
||||
* @param traderDetailsToAdd trader details
|
||||
* @param tables database
|
||||
* @param jsonUtil json utility class
|
||||
*/
|
||||
public void AddTraderToDb(TraderBase traderDetailsToAdd, DatabaseTables tables, ICloner cloner, TraderAssort assortJson)
|
||||
{
|
||||
// Create trader data ready to add to database
|
||||
var traderDataToAdd = new Trader
|
||||
{
|
||||
Assort = cloner.Clone(assortJson), // Clone the data before saving it so we dont mess up any references
|
||||
Base = cloner.Clone(traderDetailsToAdd),
|
||||
QuestAssort = new Dictionary<string, Dictionary<string, string>> // questassort is empty as trader has no assorts unlocked by quests
|
||||
{
|
||||
{ "Started", new Dictionary<string, string>() },
|
||||
{ "Success", new Dictionary<string, string>() },
|
||||
{ "Fail", new Dictionary<string, string>() }
|
||||
}
|
||||
};
|
||||
|
||||
// Add trader to trader table, key is the traders id
|
||||
tables.Traders.Add(traderDetailsToAdd.Id, traderDataToAdd);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add traders name/location/description to the locale table
|
||||
* @param baseJson json file for trader (db/base.json)
|
||||
* @param tables database tables
|
||||
* @param fullName Complete name of trader
|
||||
* @param firstName First name of trader
|
||||
* @param nickName Nickname of trader
|
||||
* @param location Location of trader (e.g. "Here in the cat shop")
|
||||
* @param description Description of trader
|
||||
*/
|
||||
public void AddTraderToLocales(TraderBase baseJson, DatabaseTables tables, string fullName, string firstName, string nickName, string location, string description)
|
||||
{
|
||||
// For each language, add locale for the new trader
|
||||
var locales = tables.Locales.Global;
|
||||
|
||||
foreach (var (key, value) in locales) {
|
||||
value.Value[$"{baseJson.Id} FullName"] = fullName;
|
||||
value.Value[$"{baseJson.Id} FirstName"] = firstName;
|
||||
value.Value[$"{baseJson.Id} Nickname"] = nickName;
|
||||
value.Value[$"{baseJson.Id} Location"] = location;
|
||||
value.Value[$"{baseJson.Id} Description"] = description;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,89 +0,0 @@
|
||||
using Core.Helpers;
|
||||
using System.Reflection;
|
||||
using Core.Models.Eft.Common.Tables;
|
||||
using Core.Models.External;
|
||||
using Core.Models.Spt.Config;
|
||||
using Core.Models.Utils;
|
||||
using Core.Routers;
|
||||
using Core.Servers;
|
||||
using Core.Services;
|
||||
using Core.Utils.Cloners;
|
||||
using SptCommon.Annotations;
|
||||
using Path = System.IO.Path;
|
||||
|
||||
namespace _13AddTraderWithAssortJson;
|
||||
|
||||
[Injectable]
|
||||
public class AddTraderWithAssortJson : IPostDBLoadMod
|
||||
{
|
||||
private readonly ISptLogger<AddTraderWithAssortJson> _logger;
|
||||
private readonly ModHelper _modHelper;
|
||||
private readonly DatabaseService _databaseService;
|
||||
private readonly ImageRouter _imageRouter;
|
||||
private readonly ConfigServer _configServer;
|
||||
private readonly ICloner _cloner;
|
||||
private readonly TraderConfig _traderConfig;
|
||||
private readonly RagfairConfig _ragfairConfig;
|
||||
|
||||
public AddTraderWithAssortJson(
|
||||
ISptLogger<AddTraderWithAssortJson> logger,
|
||||
ModHelper modHelper,
|
||||
DatabaseService databaseService,
|
||||
ImageRouter imageRouter,
|
||||
ConfigServer configServer,
|
||||
ICloner cloner)
|
||||
{
|
||||
_logger = logger;
|
||||
_modHelper = modHelper;
|
||||
_databaseService = databaseService;
|
||||
_imageRouter = imageRouter;
|
||||
_configServer = configServer;
|
||||
_cloner = cloner;
|
||||
|
||||
_traderConfig = _configServer.GetConfig<TraderConfig>();
|
||||
_ragfairConfig = _configServer.GetConfig<RagfairConfig>();
|
||||
}
|
||||
|
||||
public void PostDBLoad()
|
||||
{
|
||||
var pathToMod = _modHelper.GetAbsolutePathToModFolder(Assembly.GetExecutingAssembly());
|
||||
|
||||
var traderImagePath = Path.Combine(pathToMod, "db/cat.jpg");
|
||||
var traderBase = _modHelper.GetJsonDataFromFile<TraderBase>(pathToMod, "db/base.json");
|
||||
|
||||
var assort = _modHelper.GetJsonDataFromFile<TraderAssort>(pathToMod, "db/assort.json");
|
||||
|
||||
// Create helper class and use it to register our traders image/icon + set its stock refresh time
|
||||
var addTraderHelper = new AddTraderHelper();
|
||||
_imageRouter.AddRoute(traderBase.Avatar.Replace(".jpg", ""), traderImagePath);
|
||||
addTraderHelper.SetTraderUpdateTime(_traderConfig, traderBase, 3600, 4000);
|
||||
|
||||
// Add trader to flea market
|
||||
_ragfairConfig.Traders[traderBase.Id] = true;
|
||||
|
||||
// Add new trader to the trader dictionary in DatabaseServer - this is where the assort json is loaded
|
||||
/*
|
||||
* The assortJSON includes the following:
|
||||
* Milk available for roubles at LL1
|
||||
* Milk available for item barter at LL1
|
||||
* Helmet w/ soft armour available for roubles at LL1
|
||||
* Helmet w/ soft armour available for item barter at LL1
|
||||
*
|
||||
* It is *REQUIRED* to use MongoIDs for IDs in the assort
|
||||
*/
|
||||
addTraderHelper.AddTraderToDb(
|
||||
traderBase,
|
||||
_databaseService.GetTables(),
|
||||
_cloner,
|
||||
assort);
|
||||
|
||||
addTraderHelper.AddTraderToLocales(
|
||||
traderBase,
|
||||
_databaseService.GetTables(),
|
||||
traderBase.Name,
|
||||
"Cat",
|
||||
traderBase.Nickname,
|
||||
traderBase.Location,
|
||||
"This is the cat shop. Meow.");
|
||||
}
|
||||
}
|
||||
@@ -1,132 +0,0 @@
|
||||
{
|
||||
"items": [
|
||||
{
|
||||
"_name": "milk",
|
||||
"_id": "6751d7d0ac6207409b0823a0",
|
||||
"_tpl": "575146b724597720a27126d5",
|
||||
"parentId": "hideout",
|
||||
"slotId": "hideout",
|
||||
"upd": {
|
||||
"UnlimitedCount": false,
|
||||
"StackObjectsCount": 200,
|
||||
"BuyRestrictionMax": 10,
|
||||
"BuyRestrictionCurrent": 0
|
||||
}
|
||||
},
|
||||
{
|
||||
"_name": "milk barter",
|
||||
"_id": "6751d7d0ac6207409b0823a1",
|
||||
"_tpl": "575146b724597720a27126d5",
|
||||
"parentId": "hideout",
|
||||
"slotId": "hideout",
|
||||
"upd": {
|
||||
"UnlimitedCount": false,
|
||||
"StackObjectsCount": 200,
|
||||
"BuyRestrictionMax": 10,
|
||||
"BuyRestrictionCurrent": 0
|
||||
}
|
||||
},
|
||||
{
|
||||
"_name": "helmet",
|
||||
"_id": "6751d7d0ac6207409b0823a2",
|
||||
"_tpl": "5b40e3f35acfc40016388218",
|
||||
"parentId": "hideout",
|
||||
"slotId": "hideout",
|
||||
"upd": {
|
||||
"UnlimitedCount": false,
|
||||
"StackObjectsCount": 200,
|
||||
"BuyRestrictionMax": 10,
|
||||
"BuyRestrictionCurrent": 0
|
||||
}
|
||||
},
|
||||
{
|
||||
"_name": "HELMET_SOFT_ARMOUR_TOP",
|
||||
"_id": "6751d7d0ac6207409b0823a3",
|
||||
"_tpl": "657f95bff92cd718b701550c",
|
||||
"parentId": "HELMET_ID",
|
||||
"slotId": "Helmet_top"
|
||||
},
|
||||
{
|
||||
"_name": "HELMET_SOFT_ARMOUR_BACK_ID",
|
||||
"_id": "6751d7d0ac6207409b0823a4",
|
||||
"_tpl": "657f9605f4c82973640b2358",
|
||||
"parentId": "HELMET_ID",
|
||||
"slotId": "Helmet_back"
|
||||
},
|
||||
{
|
||||
"_name": "HELMET_ID_BARTER",
|
||||
"_id": "6751d7d0ac6207409b0823a5",
|
||||
"_tpl": "5b40e3f35acfc40016388218",
|
||||
"parentId": "hideout",
|
||||
"slotId": "hideout",
|
||||
"upd": {
|
||||
"UnlimitedCount": false,
|
||||
"StackObjectsCount": 200,
|
||||
"BuyRestrictionMax": 10,
|
||||
"BuyRestrictionCurrent": 0
|
||||
}
|
||||
},
|
||||
{
|
||||
"_name": "HELMET_SOFT_ARMOUR_TOP_ID_BARTER",
|
||||
"_id": "6751d7d0ac6207409b0823a5",
|
||||
"_tpl": "657f95bff92cd718b701550c",
|
||||
"parentId": "HELMET_ID_BARTER",
|
||||
"slotId": "Helmet_top"
|
||||
},
|
||||
{
|
||||
"_name": "HELMET_SOFT_ARMOUR_BACK_ID_BARTER",
|
||||
"_id": "6751d7d0ac6207409b0823a6",
|
||||
"_tpl": "657f9605f4c82973640b2358",
|
||||
"parentId": "HELMET_ID_BARTER",
|
||||
"slotId": "Helmet_back"
|
||||
}
|
||||
],
|
||||
"barter_scheme": {
|
||||
"6751d7d0ac6207409b0823a0": [
|
||||
[
|
||||
{
|
||||
"count": 2000,
|
||||
"_tpl": "5449016a4bdc2d6f028b456f"
|
||||
}
|
||||
]
|
||||
],
|
||||
"6751d7d0ac6207409b0823a1": [
|
||||
[
|
||||
{
|
||||
"count": 3,
|
||||
"_tpl": "59faff1d86f7746c51718c9c"
|
||||
},
|
||||
{
|
||||
"count": 1,
|
||||
"_tpl": "544fb45d4bdc2dee738b4568"
|
||||
}
|
||||
]
|
||||
],
|
||||
"6751d7d0ac6207409b0823a2": [
|
||||
[
|
||||
{
|
||||
"count": 2000,
|
||||
"_tpl": "5449016a4bdc2d6f028b456f"
|
||||
}
|
||||
]
|
||||
],
|
||||
"6751d7d0ac6207409b0823a5": [
|
||||
[
|
||||
{
|
||||
"count": 3,
|
||||
"_tpl": "59faff1d86f7746c51718c9c"
|
||||
},
|
||||
{
|
||||
"count": 1,
|
||||
"_tpl": "544fb45d4bdc2dee738b4568"
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"loyal_level_items": {
|
||||
"6751d7d0ac6207409b0823a0": 1,
|
||||
"6751d7d0ac6207409b0823a1": 1,
|
||||
"6751d7d0ac6207409b0823a2": 1,
|
||||
"6751d7d0ac6207409b0823a5": 1
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
{
|
||||
"name": "1313AddTraderWithAssortJson",
|
||||
"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"
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<RootNamespace>_14AfterDBLoadHook</RootNamespace>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<OutputType>Library</OutputType>
|
||||
<Version>0.0.1</Version>
|
||||
<!-- The two lines below will set the output path for the binaries -->
|
||||
<OutputPath>bin\$(Configuration)\$(ProjectName)\$(AssemblyName)-$(Version)\</OutputPath>
|
||||
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- TODO: Change to Nuget Package -->
|
||||
<ItemGroup>
|
||||
<Reference Include="Core">
|
||||
<HintPath>..\TempReferences\Core.dll</HintPath>
|
||||
<Private>false</Private>
|
||||
<CopyLocal>false</CopyLocal>
|
||||
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
||||
</Reference>
|
||||
<Reference Include="SptCommon">
|
||||
<HintPath>..\TempReferences\SptCommon.dll</HintPath>
|
||||
<Private>false</Private>
|
||||
<CopyLocal>false</CopyLocal>
|
||||
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
||||
</Reference>
|
||||
<Reference Include="SptDependencyInjection">
|
||||
<HintPath>..\TempReferences\SptDependencyInjection.dll</HintPath>
|
||||
<Private>false</Private>
|
||||
<CopyLocal>false</CopyLocal>
|
||||
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -1,62 +0,0 @@
|
||||
using Core.Models.Eft.Common.Tables;
|
||||
using Core.Models.External;
|
||||
using Core.Models.Logging;
|
||||
using Core.Models.Utils;
|
||||
using Core.Servers;
|
||||
using SptCommon.Annotations;
|
||||
|
||||
namespace _14AfterDBLoadHook;
|
||||
|
||||
[Injectable(InjectableTypeOverride = typeof(IPostDBLoadMod))]
|
||||
[Injectable(InjectableTypeOverride = typeof(IPostSptLoadMod))]
|
||||
public class AfterDBLoadHook : IPostDBLoadMod, IPostSptLoadMod
|
||||
{
|
||||
private readonly ConfigServer _configServer;
|
||||
private readonly DatabaseServer _databaseServer;
|
||||
private readonly ISptLogger<AfterDBLoadHook> _logger;
|
||||
private Dictionary<string, TemplateItem>? _itemsDb;
|
||||
|
||||
public AfterDBLoadHook(
|
||||
ConfigServer configServer,
|
||||
DatabaseServer databaseServer,
|
||||
ISptLogger<AfterDBLoadHook> logger
|
||||
)
|
||||
{
|
||||
_configServer = configServer;
|
||||
_databaseServer = databaseServer;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public void PostDBLoad()
|
||||
{
|
||||
_itemsDb = _databaseServer.GetTables().Templates.Items;
|
||||
|
||||
// Database will be loaded, this is the fresh state of the DB so NOTHING from the SPT
|
||||
// logic has modified anything yet. This is the DB loaded straight from the JSON files
|
||||
_logger.LogWithColor($"Database item size: {_itemsDb.Count}", LogTextColor.Red, LogBackgroundColor.Yellow);
|
||||
|
||||
// lets do a quick modification and see how this reflect later on, on the postSptLoad()
|
||||
// find the nvgs item by its Id
|
||||
// this also checks if the item exists before giving you the item
|
||||
// if it doesn't, this if check will fail
|
||||
if (_itemsDb.TryGetValue("5c0558060db834001b735271", out var nvgs))
|
||||
{
|
||||
// Lets log the state before the modification
|
||||
_logger.LogWithColor($"NVGs default CanSellOnRagfair: {nvgs.Properties.CanSellOnRagfair}", LogTextColor.Red, LogBackgroundColor.Yellow);
|
||||
// Update one of its properties to be true
|
||||
nvgs.Properties.CanSellOnRagfair = true;
|
||||
}
|
||||
}
|
||||
|
||||
public void PostSptLoad()
|
||||
{
|
||||
// The modification we made above would have been processed by now by SPT, so any values we changed had
|
||||
// already been passed through the initial lifecycles (OnLoad) of SPT.
|
||||
|
||||
if (_itemsDb.TryGetValue("5c0558060db834001b735271", out var nvgs))
|
||||
{
|
||||
// Lets log the state after the modification
|
||||
_logger.LogWithColor($"NVGs default CanSellOnRagfair: {nvgs.Properties.CanSellOnRagfair}", LogTextColor.Red, LogBackgroundColor.Yellow);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
{
|
||||
"name": "14AfterDBLoadHook",
|
||||
"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"
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<RootNamespace>_15HttpListenerExample</RootNamespace>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<OutputType>Library</OutputType>
|
||||
<Version>0.0.1</Version>
|
||||
<!-- The two lines below will set the output path for the binaries -->
|
||||
<OutputPath>bin\$(Configuration)\$(ProjectName)\$(AssemblyName)-$(Version)\</OutputPath>
|
||||
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- TODO: Change to Nuget Package -->
|
||||
<ItemGroup>
|
||||
<Reference Include="Core">
|
||||
<HintPath>..\TempReferences\Core.dll</HintPath>
|
||||
<Private>false</Private>
|
||||
<CopyLocal>false</CopyLocal>
|
||||
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
||||
</Reference>
|
||||
<Reference Include="SptCommon">
|
||||
<HintPath>..\TempReferences\SptCommon.dll</HintPath>
|
||||
<Private>false</Private>
|
||||
<CopyLocal>false</CopyLocal>
|
||||
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
||||
</Reference>
|
||||
<Reference Include="SptDependencyInjection">
|
||||
<HintPath>..\TempReferences\SptDependencyInjection.dll</HintPath>
|
||||
<Private>false</Private>
|
||||
<CopyLocal>false</CopyLocal>
|
||||
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.Http" Version="9.0.1"/>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -1,22 +0,0 @@
|
||||
using System.Text;
|
||||
using Core.Servers.Http;
|
||||
using SptCommon.Annotations;
|
||||
|
||||
namespace _15HttpListenerExample;
|
||||
|
||||
[Injectable]
|
||||
public class HttpListenerExample : IHttpListener
|
||||
{
|
||||
public bool CanHandle(string sessionId, HttpRequest req)
|
||||
{
|
||||
return req.Method == "GET" && req.Method.Contains("/type-custom-url");
|
||||
}
|
||||
|
||||
public void Handle(string sessionId, HttpRequest req, HttpResponse resp)
|
||||
{
|
||||
resp.StatusCode = 200;
|
||||
resp.Body.WriteAsync(Encoding.UTF8.GetBytes("[1] This is the first example of a mod hooking into the HttpServer")).AsTask().Wait();
|
||||
resp.StartAsync().Wait();
|
||||
resp.CompleteAsync().Wait();
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
{
|
||||
"name": "15HttpListenerExample",
|
||||
"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"
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<RootNamespace>_18._1CustomItemServiceLootBox</RootNamespace>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<OutputType>Library</OutputType>
|
||||
<Version>0.0.1</Version>
|
||||
<!-- The two lines below will set the output path for the binaries -->
|
||||
<OutputPath>bin\$(Configuration)\$(ProjectName)\$(AssemblyName)-$(Version)\</OutputPath>
|
||||
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- TODO: Change to Nuget Package -->
|
||||
<ItemGroup>
|
||||
<Reference Include="Core">
|
||||
<HintPath>..\TempReferences\Core.dll</HintPath>
|
||||
<Private>false</Private>
|
||||
<CopyLocal>false</CopyLocal>
|
||||
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
||||
</Reference>
|
||||
<Reference Include="SptCommon">
|
||||
<HintPath>..\TempReferences\SptCommon.dll</HintPath>
|
||||
<Private>false</Private>
|
||||
<CopyLocal>false</CopyLocal>
|
||||
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
||||
</Reference>
|
||||
<Reference Include="SptDependencyInjection">
|
||||
<HintPath>..\TempReferences\SptDependencyInjection.dll</HintPath>
|
||||
<Private>false</Private>
|
||||
<CopyLocal>false</CopyLocal>
|
||||
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -1,117 +0,0 @@
|
||||
using Core.Models.Eft.Common.Tables;
|
||||
using Core.Models.External;
|
||||
using Core.Models.Spt.Config;
|
||||
using Core.Models.Spt.Mod;
|
||||
using Core.Models.Utils;
|
||||
using Core.Servers;
|
||||
using Core.Services.Mod;
|
||||
using SptCommon.Annotations;
|
||||
|
||||
namespace _18._1CustomItemServiceLootBox;
|
||||
|
||||
[Injectable]
|
||||
public class CustomItemServiceLootBox : IPostDBLoadMod, IPostSptLoadMod
|
||||
{
|
||||
private CustomItemService _customItemService;
|
||||
private DatabaseServer _databaseServer;
|
||||
private ConfigServer _configServer;
|
||||
private readonly ISptLogger<CustomItemServiceLootBox> _logger;
|
||||
private Dictionary<string, TemplateItem> _itemDb;
|
||||
|
||||
private InventoryConfig _inventoryConfig;
|
||||
|
||||
public CustomItemServiceLootBox(
|
||||
DatabaseServer databaseServer,
|
||||
ConfigServer configServer,
|
||||
ISptLogger<CustomItemServiceLootBox> logger,
|
||||
CustomItemService customItemService
|
||||
)
|
||||
{
|
||||
_databaseServer = databaseServer;
|
||||
_configServer = configServer;
|
||||
_logger = logger;
|
||||
_customItemService = customItemService;
|
||||
|
||||
_inventoryConfig = _configServer.GetConfig<InventoryConfig>();
|
||||
}
|
||||
|
||||
public void PostDBLoad()
|
||||
{
|
||||
_itemDb = _databaseServer.GetTables().Templates.Items;
|
||||
|
||||
// Example of adding new item by cloning existing item using createclonedetails
|
||||
var crateId = "new_crate_with_randomized_content";
|
||||
var exampleCloneItem = new NewItemFromCloneDetails
|
||||
{
|
||||
// The item we want to clone, in this example i will cloning the sealed weapon crate
|
||||
ItemTplToClone = "6489b2b131a2135f0d7d0fcb",
|
||||
// ParentId refers to the Node item the container will be under, you can check it in https://db.sp-tarkov.com/search
|
||||
ParentId = "62f109593b54472778797866",
|
||||
// The new id of our cloned item
|
||||
NewId = crateId,
|
||||
FleaPriceRoubles = 50000,
|
||||
HandbookPriceRoubles = 42500,
|
||||
// Handbook Parent Id refers to the category the container will be under
|
||||
// Handbook parent can be found in SPT_Data\Server\database\templates.
|
||||
HandbookParentId = "62f109593b54472778797866",
|
||||
Locales = new Dictionary<string, LocaleDetails>
|
||||
{
|
||||
{"en", new LocaleDetails
|
||||
{
|
||||
Name = "Custom Lootbox",
|
||||
ShortName = "Custom Lootbox",
|
||||
Description = "A custom lootbox container"
|
||||
}
|
||||
}
|
||||
},
|
||||
OverrideProperties = new Props
|
||||
{
|
||||
Name = "Custom Lootbox",
|
||||
ShortName = "Custom Lootbox",
|
||||
Description = "A custom lootbox container",
|
||||
Weight = 15
|
||||
},
|
||||
};
|
||||
|
||||
// Basically calls the function and tell the server to add our Cloned new item into the server
|
||||
_customItemService.CreateItemFromClone(exampleCloneItem);
|
||||
|
||||
// Change item _name to remove it from the *actual* sealed weapon crate logic, this removes it from airdrops and allows easier access to change the contents
|
||||
|
||||
var customItemInDb = _itemDb.GetValueOrDefault(crateId);
|
||||
customItemInDb.Name = crateId;
|
||||
|
||||
// Add to inventory config with custom item pool
|
||||
_inventoryConfig.RandomLootContainers[crateId] = new RewardDetails
|
||||
{
|
||||
RewardCount = 6,
|
||||
FoundInRaid = true,
|
||||
RewardTplPool = new Dictionary<string, double>
|
||||
{
|
||||
{"57514643245977207f2c2d09", 1},
|
||||
{"544fb62a4bdc2dfb738b4568", 1},
|
||||
{"57513f07245977207e26a311", 1},
|
||||
{"57513f9324597720a7128161", 1},
|
||||
{"57513fcc24597720a31c09a6", 1},
|
||||
{"5e8f3423fd7471236e6e3b64", 1},
|
||||
{"60b0f93284c20f0feb453da7", 1},
|
||||
{"5734773724597737fd047c14", 1},
|
||||
{"59e3577886f774176a362503", 1},
|
||||
{"57505f6224597709a92585a9", 1},
|
||||
{"544fb6cc4bdc2d34748b456e", 1}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// Check if our item is in the server or not
|
||||
public void PostSptLoad()
|
||||
{
|
||||
if (_itemDb.TryGetValue("new_crate_with_randomized_content", out var crate))
|
||||
{
|
||||
_logger.LogWithColor("Item Exists in DB");
|
||||
return;
|
||||
}
|
||||
|
||||
_logger.LogWithColor("Item Doesn't Exist in DB");
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
{
|
||||
"name": "18.1CustomItemServiceLootBox",
|
||||
"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"
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<RootNamespace>_18CustomItemService</RootNamespace>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<OutputType>Library</OutputType>
|
||||
<Version>0.0.1</Version>
|
||||
<!-- The two lines below will set the output path for the binaries -->
|
||||
<OutputPath>bin\$(Configuration)\$(ProjectName)\$(AssemblyName)-$(Version)\</OutputPath>
|
||||
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- TODO: Change to Nuget Package -->
|
||||
<ItemGroup>
|
||||
<Reference Include="Core">
|
||||
<HintPath>..\TempReferences\Core.dll</HintPath>
|
||||
<Private>false</Private>
|
||||
<CopyLocal>false</CopyLocal>
|
||||
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
||||
</Reference>
|
||||
<Reference Include="SptCommon">
|
||||
<HintPath>..\TempReferences\SptCommon.dll</HintPath>
|
||||
<Private>false</Private>
|
||||
<CopyLocal>false</CopyLocal>
|
||||
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
||||
</Reference>
|
||||
<Reference Include="SptDependencyInjection">
|
||||
<HintPath>..\TempReferences\SptDependencyInjection.dll</HintPath>
|
||||
<Private>false</Private>
|
||||
<CopyLocal>false</CopyLocal>
|
||||
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -1,119 +0,0 @@
|
||||
using Core.Models.Eft.Common.Tables;
|
||||
using Core.Models.External;
|
||||
using Core.Models.Logging;
|
||||
using Core.Models.Spt.Mod;
|
||||
using Core.Models.Utils;
|
||||
using Core.Servers;
|
||||
using Core.Services.Mod;
|
||||
using SptCommon.Annotations;
|
||||
|
||||
namespace _18CustomItemService;
|
||||
|
||||
[Injectable]
|
||||
public class CustomItemServiceExample : IPostDBLoadMod, IPostSptLoadMod
|
||||
{
|
||||
private readonly CustomItemService _customItemService;
|
||||
private readonly ISptLogger<CustomItemServiceExample> _logger;
|
||||
private readonly DatabaseServer _databaseServer;
|
||||
|
||||
public CustomItemServiceExample(
|
||||
CustomItemService customItemService,
|
||||
ISptLogger<CustomItemServiceExample> logger,
|
||||
DatabaseServer databaseServer
|
||||
)
|
||||
{
|
||||
_customItemService = customItemService;
|
||||
_logger = logger;
|
||||
_databaseServer = databaseServer;
|
||||
}
|
||||
|
||||
public void PostDBLoad()
|
||||
{
|
||||
//Example of adding new item by cloning an existing item using `createCloneDetails`
|
||||
var exampleCloneItem = new NewItemFromCloneDetails
|
||||
{
|
||||
ItemTplToClone = ItemTpl.SHOTGUN_MP18_762X54R_SINGLESHOT_RIFLE,
|
||||
// ParentId refers to the Node item the gun will be under, you can check it in https://db.sp-tarkov.com/search
|
||||
ParentId = "5447b6094bdc2dc3278b4567",
|
||||
// The new id of our cloned item - MUST be a valid mongo id, search online for mongo id generators
|
||||
NewId = "677eed5f2e040616bc7246b6",
|
||||
// Flea price of item
|
||||
FleaPriceRoubles = 50000,
|
||||
// Price of item in handbook
|
||||
HandbookPriceRoubles = 42500,
|
||||
// Handbook Parent Id refers to the category the gun will be under
|
||||
HandbookParentId = "5b5f78e986f77447ed5636b1",
|
||||
//you see those side box tab thing that only select gun under specific icon? Handbook parent can be found in Spt_Data\Server\database\templates.
|
||||
Locales = new Dictionary<string, LocaleDetails>
|
||||
{
|
||||
{
|
||||
"en", new LocaleDetails
|
||||
{
|
||||
Name = "MP-18 12g",
|
||||
ShortName = "Custom MP18",
|
||||
Description = "A custom MP18 chambered in 12G"
|
||||
}
|
||||
}
|
||||
},
|
||||
OverrideProperties = new Props
|
||||
{
|
||||
Chambers =
|
||||
[
|
||||
new Slot
|
||||
{
|
||||
Name = "patron_in_weapon_000",
|
||||
Id = "61f7c9e189e6fb1a5e3ea791",
|
||||
Parent = "CustomMP18",
|
||||
Props = new SlotProps
|
||||
{
|
||||
Filters =
|
||||
[
|
||||
new SlotFilter
|
||||
{
|
||||
Filter =
|
||||
[
|
||||
"560d5e524bdc2d25448b4571",
|
||||
"5d6e6772a4b936088465b17c",
|
||||
"5d6e67fba4b9361bc73bc779",
|
||||
"5d6e6806a4b936088465b17e",
|
||||
"5d6e68dea4b9361bcc29e659",
|
||||
"5d6e6911a4b9361bd5780d52",
|
||||
"5c0d591486f7744c505b416f",
|
||||
"58820d1224597753c90aeb13",
|
||||
"5d6e68c4a4b9361b93413f79",
|
||||
"5d6e68a8a4b9360b6c0d54e2",
|
||||
"5d6e68e6a4b9361c140bcfe0",
|
||||
"5d6e6869a4b9361c140bcfde",
|
||||
"5d6e68b3a4b9361bca7e50b5",
|
||||
"5d6e6891a4b9361bd473feea",
|
||||
"5d6e689ca4b9361bc8618956",
|
||||
"5d6e68d1a4b93622fe60e845"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
Required = false,
|
||||
MergeSlotWithChildren = false,
|
||||
Proto = "55d4af244bdc2d962f8b4571"
|
||||
}
|
||||
]
|
||||
},
|
||||
};
|
||||
|
||||
_customItemService.CreateItemFromClone(exampleCloneItem); // Send our data to the function that creates our item
|
||||
}
|
||||
|
||||
// Optional - check if our item is in the server or not
|
||||
public void PostSptLoad()
|
||||
{
|
||||
var items = _databaseServer.GetTables().Templates.Items;
|
||||
|
||||
if (items.TryGetValue("677eed5f2e040616bc7246b6", out var item))
|
||||
{
|
||||
_logger.LogWithColor("Item exists in DB", LogTextColor.Red, LogBackgroundColor.Yellow);
|
||||
return;
|
||||
}
|
||||
|
||||
_logger.LogWithColor("Item was not found in DB", LogTextColor.Red, LogBackgroundColor.Yellow);
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
{
|
||||
"name": "18CustomItemService",
|
||||
"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"
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<RootNamespace>_1Logging</RootNamespace>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<OutputType>Library</OutputType>
|
||||
<Version>0.0.1</Version>
|
||||
<!-- The two lines below will set the output path for the binaries -->
|
||||
<OutputPath>bin\$(Configuration)\$(ProjectName)\$(AssemblyName)-$(Version)\</OutputPath>
|
||||
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- TODO: Change to Nuget Package -->
|
||||
<ItemGroup>
|
||||
<Reference Include="Core">
|
||||
<HintPath>..\TempReferences\Core.dll</HintPath>
|
||||
<Private>false</Private>
|
||||
<CopyLocal>false</CopyLocal>
|
||||
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
||||
</Reference>
|
||||
<Reference Include="SptCommon">
|
||||
<HintPath>..\TempReferences\SptCommon.dll</HintPath>
|
||||
<Private>false</Private>
|
||||
<CopyLocal>false</CopyLocal>
|
||||
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
||||
</Reference>
|
||||
<Reference Include="SptDependencyInjection">
|
||||
<HintPath>..\TempReferences\SptDependencyInjection.dll</HintPath>
|
||||
<Private>false</Private>
|
||||
<CopyLocal>false</CopyLocal>
|
||||
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -1,36 +0,0 @@
|
||||
using Core.Models.External;
|
||||
using Core.Models.Logging;
|
||||
using Core.Models.Utils;
|
||||
using SptCommon.Annotations;
|
||||
|
||||
namespace _1Logging;
|
||||
|
||||
[Injectable]
|
||||
public class Logging : IPostSptLoadMod // Using this interface means our mod will run AFTER SPT has finished loading
|
||||
{
|
||||
// Our logger we create in the constructor below
|
||||
private readonly ISptLogger<Logging> _logger;
|
||||
|
||||
// Constructor - Inject a 'ISptLogger' with your mods Class inside the diamond brackets
|
||||
public Logging(
|
||||
ISptLogger<Logging> logger
|
||||
)
|
||||
{
|
||||
// Save the logger we're injecting into a private variable that is scoped to this class (only this class has access to it)
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public void PostSptLoad()
|
||||
{
|
||||
// We can access the logger to assigned in the constructor here
|
||||
_logger.Success("This is a success message");
|
||||
_logger.Warning("This is a warning message");
|
||||
_logger.Error("This is an error message");
|
||||
_logger.Info("This is an info message");
|
||||
_logger.Critical("this is a critical message");
|
||||
|
||||
// Logging with colors requires you to 'pass' the text color and background color
|
||||
_logger.LogWithColor("This is a message with custom colors", LogTextColor.Red, LogBackgroundColor.Black);
|
||||
_logger.Debug("This is a debug message that gets written to the log file, not the console");
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
{
|
||||
"name": "1Logging",
|
||||
"author": "SPT",
|
||||
"contributors": [],
|
||||
"version": "1.0.0",
|
||||
"sptVersion": "~4.0",
|
||||
"loadBefore": [],
|
||||
"loadAfter": [],
|
||||
"incompatibilities": [],
|
||||
"dependencies": [],
|
||||
"url": "https://github.com/sp-tarkov/server-csharp/tree/develop/ExampleMods/Mods",
|
||||
"isBundleMod": false,
|
||||
"licence": "MIT"
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<RootNamespace>_20CustomChatBot</RootNamespace>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<OutputType>Library</OutputType>
|
||||
<Version>0.0.1</Version>
|
||||
<!-- The two lines below will set the output path for the binaries -->
|
||||
<OutputPath>bin\$(Configuration)\$(ProjectName)\$(AssemblyName)-$(Version)\</OutputPath>
|
||||
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- TODO: Change to Nuget Package -->
|
||||
<ItemGroup>
|
||||
<Reference Include="Core">
|
||||
<HintPath>..\TempReferences\Core.dll</HintPath>
|
||||
<Private>false</Private>
|
||||
<CopyLocal>false</CopyLocal>
|
||||
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
||||
</Reference>
|
||||
<Reference Include="SptCommon">
|
||||
<HintPath>..\TempReferences\SptCommon.dll</HintPath>
|
||||
<Private>false</Private>
|
||||
<CopyLocal>false</CopyLocal>
|
||||
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
||||
</Reference>
|
||||
<Reference Include="SptDependencyInjection">
|
||||
<HintPath>..\TempReferences\SptDependencyInjection.dll</HintPath>
|
||||
<Private>false</Private>
|
||||
<CopyLocal>false</CopyLocal>
|
||||
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -1,48 +0,0 @@
|
||||
using Core.Helpers.Dialogue;
|
||||
using Core.Models.Eft.Dialog;
|
||||
using Core.Models.Eft.Profile;
|
||||
using Core.Models.Enums;
|
||||
using Core.Services;
|
||||
using SptCommon.Annotations;
|
||||
|
||||
namespace _20CustomChatBot;
|
||||
|
||||
[Injectable]
|
||||
public class CustomChatBot : IDialogueChatBot
|
||||
{
|
||||
private MailSendService _mailSendService;
|
||||
|
||||
public CustomChatBot(
|
||||
MailSendService mailSendService
|
||||
)
|
||||
{
|
||||
_mailSendService = mailSendService;
|
||||
}
|
||||
|
||||
public UserDialogInfo GetChatBot()
|
||||
{
|
||||
return new UserDialogInfo
|
||||
{
|
||||
Id = "modderBuddy",
|
||||
Aid = 9999999,
|
||||
Info = new UserDialogDetails
|
||||
{
|
||||
Nickname = "Buddy",
|
||||
Side = "Usec",
|
||||
Level = 69,
|
||||
MemberCategory = MemberCategory.Sherpa,
|
||||
SelectedMemberCategory = MemberCategory.Sherpa
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public string? HandleMessage(string sessionId, SendMessageRequest request)
|
||||
{
|
||||
_mailSendService.SendUserMessageToPlayer(
|
||||
sessionId,
|
||||
GetChatBot(),
|
||||
$"Im Buddy! I just reply back what you typed to me!\n{request.Text}");
|
||||
|
||||
return request.DialogId;
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
{
|
||||
"name": "20CustomChatBot",
|
||||
"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"
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<RootNamespace>_21CustomCommandoCommand</RootNamespace>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<OutputType>Library</OutputType>
|
||||
<Version>0.0.1</Version>
|
||||
<!-- The two lines below will set the output path for the binaries -->
|
||||
<OutputPath>bin\$(Configuration)\$(ProjectName)\$(AssemblyName)-$(Version)\</OutputPath>
|
||||
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- TODO: Change to Nuget Package -->
|
||||
<ItemGroup>
|
||||
<Reference Include="Core">
|
||||
<HintPath>..\TempReferences\Core.dll</HintPath>
|
||||
<Private>false</Private>
|
||||
<CopyLocal>false</CopyLocal>
|
||||
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
||||
</Reference>
|
||||
<Reference Include="SptCommon">
|
||||
<HintPath>..\TempReferences\SptCommon.dll</HintPath>
|
||||
<Private>false</Private>
|
||||
<CopyLocal>false</CopyLocal>
|
||||
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
||||
</Reference>
|
||||
<Reference Include="SptDependencyInjection">
|
||||
<HintPath>..\TempReferences\SptDependencyInjection.dll</HintPath>
|
||||
<Private>false</Private>
|
||||
<CopyLocal>false</CopyLocal>
|
||||
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -1,56 +0,0 @@
|
||||
using Core.Helpers.Dialog.Commando;
|
||||
using Core.Models.Eft.Dialog;
|
||||
using Core.Models.Eft.Profile;
|
||||
using Core.Servers;
|
||||
using Core.Services;
|
||||
using SptCommon.Annotations;
|
||||
|
||||
namespace _21CustomCommandoCommand;
|
||||
|
||||
[Injectable]
|
||||
public class CustomCommandoCommand : IChatCommand
|
||||
{
|
||||
private DatabaseServer _databaseServer;
|
||||
private MailSendService _mailSendService;
|
||||
|
||||
public CustomCommandoCommand(
|
||||
DatabaseServer databaseServer,
|
||||
MailSendService mailSendService
|
||||
)
|
||||
{
|
||||
_databaseServer = databaseServer;
|
||||
_mailSendService = mailSendService;
|
||||
}
|
||||
|
||||
public string GetCommandPrefix()
|
||||
{
|
||||
return "test";
|
||||
}
|
||||
|
||||
public string? GetCommandHelp(string command)
|
||||
{
|
||||
if (command == "talk")
|
||||
{
|
||||
return "Usage: test talk";
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<string> GetCommands()
|
||||
{
|
||||
return ["talk"];
|
||||
}
|
||||
|
||||
// spelling of sessionId is fixed in server
|
||||
public string? Handle(string command, UserDialogInfo commandHandler, string sessionId, SendMessageRequest request)
|
||||
{
|
||||
if (command == "talk")
|
||||
{
|
||||
_mailSendService.SendUserMessageToPlayer(sessionId, commandHandler, $"IM TALKING! OKAY?!\nHere's the walk speed X config from the DB: {_databaseServer.GetTables().Globals.Configuration.WalkSpeed.X}");
|
||||
return request.DialogId;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
{
|
||||
"name": "21CustomCommandoCommand",
|
||||
"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"
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<RootNamespace>_22CustomSptCommand</RootNamespace>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<OutputType>Library</OutputType>
|
||||
<Version>0.0.1</Version>
|
||||
<!-- The two lines below will set the output path for the binaries -->
|
||||
<OutputPath>bin\$(Configuration)\$(ProjectName)\$(AssemblyName)-$(Version)\</OutputPath>
|
||||
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- TODO: Change to Nuget Package -->
|
||||
<ItemGroup>
|
||||
<Reference Include="Core">
|
||||
<HintPath>..\TempReferences\Core.dll</HintPath>
|
||||
<Private>false</Private>
|
||||
<CopyLocal>false</CopyLocal>
|
||||
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
||||
</Reference>
|
||||
<Reference Include="SptCommon">
|
||||
<HintPath>..\TempReferences\SptCommon.dll</HintPath>
|
||||
<Private>false</Private>
|
||||
<CopyLocal>false</CopyLocal>
|
||||
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
||||
</Reference>
|
||||
<Reference Include="SptDependencyInjection">
|
||||
<HintPath>..\TempReferences\SptDependencyInjection.dll</HintPath>
|
||||
<Private>false</Private>
|
||||
<CopyLocal>false</CopyLocal>
|
||||
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Update="package.json">
|
||||
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -1,41 +0,0 @@
|
||||
using Core.Helpers;
|
||||
using Core.Helpers.Dialog.Commando.SptCommands;
|
||||
using Core.Models.Eft.Dialog;
|
||||
using Core.Models.Eft.Profile;
|
||||
using Core.Services;
|
||||
using SptCommon.Annotations;
|
||||
|
||||
namespace _22CustomSptCommand;
|
||||
|
||||
[Injectable]
|
||||
public class CustomSptCommand : ISptCommand
|
||||
{
|
||||
private readonly MailSendService _mailSendService;
|
||||
private readonly ItemHelper _itemHelper;
|
||||
|
||||
public CustomSptCommand(
|
||||
MailSendService mailSendService,
|
||||
ItemHelper itemHelper
|
||||
)
|
||||
{
|
||||
_mailSendService = mailSendService;
|
||||
_itemHelper = itemHelper;
|
||||
}
|
||||
|
||||
public string GetCommand()
|
||||
{
|
||||
return "getName";
|
||||
}
|
||||
|
||||
public string GetCommandHelp()
|
||||
{
|
||||
return "Usage: spt getName tplId";
|
||||
}
|
||||
|
||||
public string PerformAction(UserDialogInfo commandHandler, string sessionId, SendMessageRequest request)
|
||||
{
|
||||
var splitCommand = request.Text.Split(" ");
|
||||
_mailSendService.SendUserMessageToPlayer(sessionId, commandHandler, $"That templateId belongs to item {_itemHelper.GetItem(splitCommand[2]).Value?.Properties?.Name ?? ""}");
|
||||
return request.DialogId;
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
{
|
||||
"name": "22CustomSptCommand",
|
||||
"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"
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<RootNamespace>_23CustomAbstractChatBot</RootNamespace>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<OutputType>Library</OutputType>
|
||||
<Version>0.0.1</Version>
|
||||
<!-- The two lines below will set the output path for the binaries -->
|
||||
<OutputPath>bin\$(Configuration)\$(ProjectName)\$(AssemblyName)-$(Version)\</OutputPath>
|
||||
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- TODO: Change to Nuget Package -->
|
||||
<ItemGroup>
|
||||
<Reference Include="Core">
|
||||
<HintPath>..\TempReferences\Core.dll</HintPath>
|
||||
<Private>false</Private>
|
||||
<CopyLocal>false</CopyLocal>
|
||||
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
||||
</Reference>
|
||||
<Reference Include="SptCommon">
|
||||
<HintPath>..\TempReferences\SptCommon.dll</HintPath>
|
||||
<Private>false</Private>
|
||||
<CopyLocal>false</CopyLocal>
|
||||
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
||||
</Reference>
|
||||
<Reference Include="SptDependencyInjection">
|
||||
<HintPath>..\TempReferences\SptDependencyInjection.dll</HintPath>
|
||||
<Private>false</Private>
|
||||
<CopyLocal>false</CopyLocal>
|
||||
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Update="package.json">
|
||||
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -1,49 +0,0 @@
|
||||
using Core.Helpers.Dialog.Commando;
|
||||
using Core.Models.Eft.Dialog;
|
||||
using Core.Models.Eft.Profile;
|
||||
using Core.Services;
|
||||
|
||||
namespace _23CustomAbstractChatBot.Commands;
|
||||
|
||||
public class AnotherCoolCommand : IChatCommand
|
||||
{
|
||||
private readonly MailSendService _mailSendService;
|
||||
|
||||
public AnotherCoolCommand(
|
||||
MailSendService mailSendService
|
||||
)
|
||||
{
|
||||
_mailSendService = mailSendService;
|
||||
}
|
||||
|
||||
public string GetCommandPrefix()
|
||||
{
|
||||
return "anotherExample";
|
||||
}
|
||||
|
||||
public string? GetCommandHelp(string command)
|
||||
{
|
||||
if (command == "test")
|
||||
{
|
||||
return "Usage: anotherExample test";
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<string> GetCommands()
|
||||
{
|
||||
return ["test"];
|
||||
}
|
||||
|
||||
public string? Handle(string command, UserDialogInfo commandHandler, string sessionId, SendMessageRequest request)
|
||||
{
|
||||
if (command == "test")
|
||||
{
|
||||
_mailSendService.SendUserMessageToPlayer(sessionId, commandHandler, $"This is another test message shown as a different example!");
|
||||
return request.DialogId;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
using Core.Helpers.Dialog.Commando;
|
||||
using Core.Models.Eft.Dialog;
|
||||
using Core.Models.Eft.Profile;
|
||||
using Core.Services;
|
||||
|
||||
namespace _23CustomAbstractChatBot.Commands;
|
||||
|
||||
public class MyCoolCommand : IChatCommand
|
||||
{
|
||||
private readonly MailSendService _mailSendService;
|
||||
|
||||
public MyCoolCommand(
|
||||
MailSendService mailSendService
|
||||
)
|
||||
{
|
||||
_mailSendService = mailSendService;
|
||||
}
|
||||
|
||||
public string GetCommandPrefix()
|
||||
{
|
||||
return "example";
|
||||
}
|
||||
|
||||
public string? GetCommandHelp(string command)
|
||||
{
|
||||
if (command == "test")
|
||||
{
|
||||
return "Usage: example test";
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<string> GetCommands()
|
||||
{
|
||||
return ["test"];
|
||||
}
|
||||
|
||||
public string? Handle(string command, UserDialogInfo commandHandler, string sessionId, SendMessageRequest request)
|
||||
{
|
||||
if (command == "test")
|
||||
{
|
||||
_mailSendService.SendUserMessageToPlayer(sessionId, commandHandler, $"This is a test message shown as an example!");
|
||||
return request.DialogId;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
using Core.Helpers.Dialog.Commando;
|
||||
using Core.Helpers.Dialogue;
|
||||
using Core.Helpers.Dialogue.SPTFriend.Commands;
|
||||
using Core.Models.Eft.Profile;
|
||||
using Core.Models.Enums;
|
||||
using Core.Models.Utils;
|
||||
using Core.Services;
|
||||
|
||||
namespace _23CustomAbstractChatBot;
|
||||
|
||||
public class CustomAbstractChatBot : AbstractDialogChatBot
|
||||
{
|
||||
public CustomAbstractChatBot(
|
||||
ISptLogger<AbstractDialogChatBot> _logger,
|
||||
MailSendService _mailSendService,
|
||||
IEnumerable<IChatCommand> _chatCommands,
|
||||
IEnumerable<IChatMessageHandler> _chatMessageHandlers
|
||||
) : base(_logger, _mailSendService, _chatCommands)
|
||||
{
|
||||
}
|
||||
|
||||
public override UserDialogInfo GetChatBot()
|
||||
{
|
||||
return new UserDialogInfo
|
||||
{
|
||||
Id = "674db14ed849a3727ef24da0", // REQUIRES a valid monogo_id, use online generator to create one
|
||||
Aid = 1234566,
|
||||
Info = new UserDialogDetails
|
||||
{
|
||||
Level = 69,
|
||||
MemberCategory = MemberCategory.Developer,
|
||||
SelectedMemberCategory = MemberCategory.Developer,
|
||||
Nickname = "CoolAbstractChatBot",
|
||||
Side = "Bear"
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
protected override string GetUnrecognizedCommandMessage()
|
||||
{
|
||||
return "No clue what you are talking about bud!";
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
{
|
||||
"name": "23CustomAbstractChatBot",
|
||||
"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"
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<RootNamespace>_24Websocket</RootNamespace>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<OutputType>Library</OutputType>
|
||||
<Version>0.0.1</Version>
|
||||
<!-- The two lines below will set the output path for the binaries -->
|
||||
<OutputPath>bin\$(Configuration)\$(ProjectName)\$(AssemblyName)-$(Version)\</OutputPath>
|
||||
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- TODO: Change to Nuget Package -->
|
||||
<ItemGroup>
|
||||
<Reference Include="Core">
|
||||
<HintPath>..\TempReferences\Core.dll</HintPath>
|
||||
<Private>false</Private>
|
||||
<CopyLocal>false</CopyLocal>
|
||||
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
||||
</Reference>
|
||||
<Reference Include="SptCommon">
|
||||
<HintPath>..\TempReferences\SptCommon.dll</HintPath>
|
||||
<Private>false</Private>
|
||||
<CopyLocal>false</CopyLocal>
|
||||
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
||||
</Reference>
|
||||
<Reference Include="SptDependencyInjection">
|
||||
<HintPath>..\TempReferences\SptDependencyInjection.dll</HintPath>
|
||||
<Private>false</Private>
|
||||
<CopyLocal>false</CopyLocal>
|
||||
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Update="package.json">
|
||||
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -1,52 +0,0 @@
|
||||
using System.Net.WebSockets;
|
||||
using System.Text;
|
||||
using Core.Models.Utils;
|
||||
using Core.Servers.Ws;
|
||||
using SptCommon.Annotations;
|
||||
|
||||
namespace _24Websocket;
|
||||
[Injectable(InjectionType = InjectionType.Singleton)]
|
||||
public class CustomWebSocketConnectionHandler: IWebSocketConnectionHandler
|
||||
{
|
||||
private readonly ISptLogger<CustomWebSocketConnectionHandler> _logger;
|
||||
public CustomWebSocketConnectionHandler(
|
||||
ISptLogger<CustomWebSocketConnectionHandler> logger
|
||||
)
|
||||
{
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public string GetHookUrl()
|
||||
{
|
||||
return "/custom/socket/";
|
||||
}
|
||||
|
||||
public string GetSocketId()
|
||||
{
|
||||
return "My Custom WebSocket";
|
||||
}
|
||||
|
||||
public Task OnConnection(WebSocket ws, HttpContext context)
|
||||
{
|
||||
_logger.Info("Custom web socket is now connected!");
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public Task OnMessage(byte[] rawData, WebSocketMessageType messageType, WebSocket ws, HttpContext context)
|
||||
{
|
||||
var msg = Encoding.UTF8.GetString(rawData);
|
||||
|
||||
if (msg == "toodaloo")
|
||||
{
|
||||
return ws.SendAsync(Encoding.UTF8.GetBytes("toodaloo back!"), WebSocketMessageType.Text, true, CancellationToken.None);
|
||||
}
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public Task OnClose(WebSocket ws, HttpContext context)
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
using System.Net.WebSockets;
|
||||
using Core.Models.Utils;
|
||||
using Core.Servers.Ws.Message;
|
||||
|
||||
namespace _24Websocket;
|
||||
|
||||
public class WebsocketMessageHandler : ISptWebSocketMessageHandler
|
||||
{
|
||||
private readonly ISptLogger<WebsocketMessageHandler> _logger;
|
||||
|
||||
public WebsocketMessageHandler(
|
||||
ISptLogger<WebsocketMessageHandler> logger
|
||||
)
|
||||
{
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public Task OnSptMessage(string sessionID, WebSocket client, byte[] rawData)
|
||||
{
|
||||
_logger.Info($"Custom SPT WebSocket Message handler received a message for {sessionID}: {rawData.ToString()}");
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
{
|
||||
"name": "24Websocket",
|
||||
"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"
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<RootNamespace>_2EditDatabase</RootNamespace>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<OutputType>Library</OutputType>
|
||||
<Version>0.0.1</Version>
|
||||
<!-- The two lines below will set the output path for the binaries -->
|
||||
<OutputPath>bin\$(Configuration)\$(ProjectName)\$(AssemblyName)-$(Version)\</OutputPath>
|
||||
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- TODO: Change to Nuget Package -->
|
||||
<ItemGroup>
|
||||
<Reference Include="Core">
|
||||
<HintPath>..\TempReferences\Core.dll</HintPath>
|
||||
<Private>false</Private>
|
||||
<CopyLocal>false</CopyLocal>
|
||||
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
||||
</Reference>
|
||||
<Reference Include="SptCommon">
|
||||
<HintPath>..\TempReferences\SptCommon.dll</HintPath>
|
||||
<Private>false</Private>
|
||||
<CopyLocal>false</CopyLocal>
|
||||
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
||||
</Reference>
|
||||
<Reference Include="SptDependencyInjection">
|
||||
<HintPath>..\TempReferences\SptDependencyInjection.dll</HintPath>
|
||||
<Private>false</Private>
|
||||
<CopyLocal>false</CopyLocal>
|
||||
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -1,196 +0,0 @@
|
||||
using Core.Models.Enums;
|
||||
using Core.Models.External;
|
||||
using Core.Models.Utils;
|
||||
using Core.Services;
|
||||
using SptCommon.Annotations;
|
||||
|
||||
namespace _2EditDatabase;
|
||||
|
||||
[Injectable]
|
||||
public class EditDatabaseValues : IPostDBLoadMod // Using this interface means our mod will run AFTER the SPT database has finished loading but BEFORE SPT code has run
|
||||
{
|
||||
private readonly DatabaseService _databaseService;
|
||||
private readonly ISptLogger<EditDatabaseValues> _logger;
|
||||
|
||||
// Our constructor
|
||||
public EditDatabaseValues(
|
||||
DatabaseService databaseService,
|
||||
ISptLogger<EditDatabaseValues> logger
|
||||
)
|
||||
{
|
||||
_databaseService = databaseService;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public void PostDBLoad()
|
||||
{
|
||||
// When SPT starts, it stores all the data found in (SPT_Data\Server\database) in memory
|
||||
// We can use the '_databaseService' we injected to access this data, this includes files from EFT and SPT
|
||||
|
||||
// Lets edit some globals settings to make the game easier
|
||||
EditGlobals();
|
||||
|
||||
// Lets edit the BTR to have the christmas tarcola skin
|
||||
EditBtr();
|
||||
|
||||
// Let's edit the hideout so it's easier to upgrade the lavatory
|
||||
EditHideout();
|
||||
|
||||
// Lets edit the default scav (assault.json) to have different settings
|
||||
EditScavSettings();
|
||||
|
||||
// Lets edit Customs
|
||||
EditCustoms();
|
||||
|
||||
_logger.Success("Finished Editing Database");
|
||||
}
|
||||
|
||||
private void EditGlobals()
|
||||
{
|
||||
// Let's edit settings in the GLOBALS file (database/globals.json)
|
||||
var globals = _databaseService.GetGlobals();
|
||||
|
||||
// Let's edit the scav cooldown to be 1 second
|
||||
globals.Configuration.SavagePlayCooldown = 1;
|
||||
|
||||
// Now lets try editing the ragfair unlock level, lets get the ragfair settings first
|
||||
var ragfairSettings = globals.Configuration.RagFair;
|
||||
|
||||
// Lets set the level you need to be to access flea to be 1
|
||||
ragfairSettings.MinUserLevel = 1;
|
||||
|
||||
|
||||
// Now lets increase the number of offers you can have listed at one time
|
||||
// The max is stored in a list, different flea ratings give different offer amounts
|
||||
|
||||
// We loop over all the settings, setting all of them to be 20
|
||||
foreach (var offerCountSettings in ragfairSettings.MaxActiveOfferCount)
|
||||
{
|
||||
offerCountSettings.Count = 20;
|
||||
}
|
||||
}
|
||||
|
||||
private void EditBtr()
|
||||
{
|
||||
// BTR setting can be found in the GLOBALS file too
|
||||
var globals = _databaseService.GetGlobals();
|
||||
|
||||
// We get the BTR settings from globals first
|
||||
var btrSettings = globals.Configuration.BTRSettings;
|
||||
|
||||
// Let's get the settings for woods specifically, we use 'tryGetValue' for this, the settings will be stored in 'woodsBtrSettings'
|
||||
btrSettings.MapsConfigs.TryGetValue("Woods", out var woodsBtrSettings);
|
||||
|
||||
// Lets set the BTR to use the christmas skin
|
||||
woodsBtrSettings.BtrSkin = "Tarcola";
|
||||
}
|
||||
|
||||
private void EditHideout()
|
||||
{
|
||||
// Hideout data can be found in (SPT_Data\Server\database\hideout)
|
||||
var hideout = _databaseService.GetHideout();
|
||||
|
||||
// We want the areas, they're stored in a list
|
||||
var hideoutAreas = hideout.Areas;
|
||||
|
||||
// We find the toilet, we use 'firstOrDefault', if we cant find the lavatory, 'lavatoryArea' will be null
|
||||
var lavatoryArea = hideoutAreas.FirstOrDefault(area => area.Type == HideoutAreas.LAVATORY);
|
||||
|
||||
|
||||
// Now we have the toilet, we can find the requirements to craft, all data is stored by stage
|
||||
var toiletStages = lavatoryArea.Stages;
|
||||
|
||||
// Stages are stored in a dictionary, a dictionary has a 'key' and a 'value'
|
||||
// In this case, the 'key' is the upgrade stage, e.g. "1", or "2"
|
||||
// We reference to each stage as a 'stageKvP' this means 'Key value Pair', every key has a value (key = stage number, value = data for that stage)
|
||||
foreach (var stageKvP in toiletStages)
|
||||
{
|
||||
// while we're here, we can make the stages craft really fast (60 seconds)
|
||||
stageKvP.Value.ConstructionTime = 60;
|
||||
|
||||
// Let's get the stage requirements, they're a list
|
||||
var stageRequirements = stageKvP.Value.Requirements;
|
||||
|
||||
// We empty the requirements out, now it can be built straight away
|
||||
stageRequirements.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
private void EditScavSettings()
|
||||
{
|
||||
var bots = _databaseService.GetBots();
|
||||
|
||||
// Same as the above example, we use 'TryGetValue' to get the 'assault' bot (assault is the internal name for scavs)
|
||||
bots.Types.TryGetValue("assault", out var assaultBot);
|
||||
|
||||
// Let's make the chance to get a good backpack really high
|
||||
assaultBot.BotInventory.Equipment.TryGetValue(EquipmentSlots.Backpack, out var backPacks);
|
||||
|
||||
// We access the backpacks dictionary by key directly using square brackets, we use ItemTpl to get the items ID
|
||||
// Alternately, we could have typed backPacks["59e763f286f7742ee57895da"] and done the same thing, ItemTpl makes it easier to read
|
||||
backPacks[ItemTpl.BACKPACK_PILGRIM_TOURIST] = 999999;
|
||||
|
||||
|
||||
// Now lets make them always have an M4A1
|
||||
assaultBot.BotInventory.Equipment.TryGetValue(EquipmentSlots.FirstPrimaryWeapon, out var primaryWeapons);
|
||||
|
||||
// We edit the weight value (pick chance) that is already there to be massive, making the item more likely to be picked
|
||||
primaryWeapons[ItemTpl.ASSAULTRIFLE_COLT_M4A1_556X45_ASSAULT_RIFLE] = 999999;
|
||||
|
||||
|
||||
// Now lets make them always have the first name of Gary
|
||||
// We start by removing all the existing names
|
||||
assaultBot.FirstNames.Clear();
|
||||
|
||||
// We add the new name Gary, very menacing
|
||||
assaultBot.FirstNames.Add("Gary");
|
||||
}
|
||||
|
||||
private void EditCustoms()
|
||||
{
|
||||
// Let's get all the maps (called locations)
|
||||
var locations = _databaseService.GetLocations();
|
||||
|
||||
// Customs is called 'bigmap' in eft
|
||||
var customs = locations.Bigmap;
|
||||
|
||||
// Lets get the exits and make them all 100% chance to appear
|
||||
var exits = customs.Base.Exits;
|
||||
|
||||
// They're stored as a list so we can loop over them
|
||||
foreach (var exit in exits)
|
||||
{
|
||||
// I can't remember which one is used, you'd assume ChancePVE is used in pve, but this is BSG we're dealing with
|
||||
// So we set both
|
||||
exit.Chance = 100;
|
||||
exit.ChancePVE = 100;
|
||||
}
|
||||
|
||||
|
||||
// Lets try editing the airdrops on customs to be better
|
||||
var airdropSettings = customs.Base.AirdropParameters;
|
||||
|
||||
// They're stored in an array but there's only one bunch of settings, it means we have to get the first item from the list,
|
||||
// An alternate way to access the first item is done by using square brackets with the 'index' of the item we want,
|
||||
// indexes start at 0 so we want to type "[0]" to access the first item in the list,
|
||||
var actualAirdropSettings = airdropSettings.First();
|
||||
|
||||
// Make it spawn 100%
|
||||
actualAirdropSettings.PlaneAirdropChance = 1; // Number between 0 and 1
|
||||
|
||||
// Make it spawn as early as start of raid
|
||||
actualAirdropSettings.PlaneAirdropStartMin = 1;
|
||||
|
||||
|
||||
// Let's make bosses spawn 100% of the time
|
||||
|
||||
// We get all the bosses, they're stored in a list
|
||||
var bosses = customs.Base.BossLocationSpawn;
|
||||
|
||||
// Let's get Reshala, we use "FirstOrDefault" and look for the first boss with the name "bossBully"
|
||||
var reshala = bosses.FirstOrDefault(boss => boss.BossName == "bossBully");
|
||||
|
||||
// Set him to 100%
|
||||
reshala.BossChance = 100;
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
{
|
||||
"name": "2EditDatabase",
|
||||
"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"
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<RootNamespace>_3EditSptConfig</RootNamespace>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<OutputType>Library</OutputType>
|
||||
<Version>0.0.1</Version>
|
||||
<!-- The two lines below will set the output path for the binaries -->
|
||||
<OutputPath>bin\$(Configuration)\$(ProjectName)\$(AssemblyName)-$(Version)\</OutputPath>
|
||||
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- TODO: Change to Nuget Package -->
|
||||
<ItemGroup>
|
||||
<Reference Include="Core">
|
||||
<HintPath>..\TempReferences\Core.dll</HintPath>
|
||||
<Private>false</Private>
|
||||
<CopyLocal>false</CopyLocal>
|
||||
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
||||
</Reference>
|
||||
<Reference Include="SptCommon">
|
||||
<HintPath>..\TempReferences\SptCommon.dll</HintPath>
|
||||
<Private>false</Private>
|
||||
<CopyLocal>false</CopyLocal>
|
||||
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
||||
</Reference>
|
||||
<Reference Include="SptDependencyInjection">
|
||||
<HintPath>..\TempReferences\SptDependencyInjection.dll</HintPath>
|
||||
<Private>false</Private>
|
||||
<CopyLocal>false</CopyLocal>
|
||||
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -1,76 +0,0 @@
|
||||
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");
|
||||
|
||||
_logger.Success("Finished Editing Configs");
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
{
|
||||
"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"
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<RootNamespace>_4ReadCustomJson5Config</RootNamespace>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<OutputType>Library</OutputType>
|
||||
<Version>0.0.1</Version>
|
||||
<!-- The two lines below will set the output path for the binaries -->
|
||||
<OutputPath>bin\$(Configuration)\$(ProjectName)\$(AssemblyName)-$(Version)\</OutputPath>
|
||||
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="fastJSON5" Version="1.0.4" >
|
||||
<Private>true</Private>
|
||||
<CopyLocal>true</CopyLocal>
|
||||
<CopyLocalSatelliteAssemblies>true</CopyLocalSatelliteAssemblies>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
<!-- TODO: Change to Nuget Package -->
|
||||
<ItemGroup>
|
||||
<Reference Include="Core">
|
||||
<HintPath>..\TempReferences\Core.dll</HintPath>
|
||||
<Private>false</Private>
|
||||
<CopyLocal>false</CopyLocal>
|
||||
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
||||
</Reference>
|
||||
<Reference Include="SptCommon">
|
||||
<HintPath>..\TempReferences\SptCommon.dll</HintPath>
|
||||
<Private>false</Private>
|
||||
<CopyLocal>false</CopyLocal>
|
||||
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
||||
</Reference>
|
||||
<Reference Include="SptDependencyInjection">
|
||||
<HintPath>..\TempReferences\SptDependencyInjection.dll</HintPath>
|
||||
<Private>false</Private>
|
||||
<CopyLocal>false</CopyLocal>
|
||||
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Remove="config.json5" />
|
||||
<Content Include="config.json5">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -1,40 +0,0 @@
|
||||
using Core.Helpers;
|
||||
using System.Reflection;
|
||||
using Core.Models.External;
|
||||
using Core.Models.Utils;
|
||||
using fastJSON5;
|
||||
using SptCommon.Annotations;
|
||||
|
||||
namespace _4ReadCustomJson5Config
|
||||
{
|
||||
[Injectable]
|
||||
public class ReadJson5Config: IPreSptLoadMod
|
||||
{
|
||||
private readonly ISptLogger<ReadJson5Config> _logger;
|
||||
private readonly ModHelper _modHelper;
|
||||
|
||||
public ReadJson5Config(
|
||||
ISptLogger<ReadJson5Config> logger,
|
||||
ModHelper modHelper)
|
||||
{
|
||||
_logger = logger;
|
||||
_modHelper = modHelper;
|
||||
}
|
||||
|
||||
public void PreSptLoad()
|
||||
{
|
||||
var pathToMod = _modHelper.GetAbsolutePathToModFolder(Assembly.GetExecutingAssembly());
|
||||
|
||||
// To use JSON5, you will have to find and provide your own JSON5 library to decode it
|
||||
var json5Config = JSON5.ToObject<ModConfig>(_modHelper.GetRawFileData(pathToMod, "config.json5"));
|
||||
|
||||
_logger.Success($"Read property: 'ExampleProperty' from config with value: {json5Config.ExampleProperty}");
|
||||
}
|
||||
}
|
||||
|
||||
// This class should represent your config structure
|
||||
public class ModConfig
|
||||
{
|
||||
public string ExampleProperty { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
{
|
||||
// Comment goes here, wow
|
||||
"ExampleProperty": "boop"
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
{
|
||||
"name": "4ReadCustomJson5Config",
|
||||
"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",
|
||||
"dependencies": [
|
||||
{
|
||||
"name": "fastJSON5",
|
||||
"version": "1.0.4"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<RootNamespace>_5ReadCustomJsonConfig</RootNamespace>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<OutputType>Library</OutputType>
|
||||
<Version>0.0.1</Version>
|
||||
<!-- The two lines below will set the output path for the binaries -->
|
||||
<OutputPath>bin\$(Configuration)\$(ProjectName)\$(AssemblyName)-$(Version)\</OutputPath>
|
||||
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- TODO: Change to Nuget Package -->
|
||||
<ItemGroup>
|
||||
<Reference Include="Core">
|
||||
<HintPath>..\TempReferences\Core.dll</HintPath>
|
||||
<Private>false</Private>
|
||||
<CopyLocal>false</CopyLocal>
|
||||
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
||||
</Reference>
|
||||
<Reference Include="SptCommon">
|
||||
<HintPath>..\TempReferences\SptCommon.dll</HintPath>
|
||||
<Private>false</Private>
|
||||
<CopyLocal>false</CopyLocal>
|
||||
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
||||
</Reference>
|
||||
<Reference Include="SptDependencyInjection">
|
||||
<HintPath>..\TempReferences\SptDependencyInjection.dll</HintPath>
|
||||
<Private>false</Private>
|
||||
<CopyLocal>false</CopyLocal>
|
||||
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -1,44 +0,0 @@
|
||||
using System.Reflection;
|
||||
using Core.Helpers;
|
||||
using Core.Models.External;
|
||||
using Core.Models.Utils;
|
||||
using Core.Utils;
|
||||
using SptCommon.Annotations;
|
||||
|
||||
namespace _5ReadCustomJsonConfig
|
||||
{
|
||||
[Injectable]
|
||||
public class ReadJsonConfig : IPreSptLoadMod
|
||||
{
|
||||
private readonly ISptLogger<ReadJsonConfig> _logger;
|
||||
private readonly ModHelper _modHelper;
|
||||
|
||||
public ReadJsonConfig(
|
||||
ISptLogger<ReadJsonConfig> logger,
|
||||
ModHelper modHelper)
|
||||
{
|
||||
_logger = logger;
|
||||
_modHelper = modHelper;
|
||||
}
|
||||
|
||||
public void PreSptLoad()
|
||||
{
|
||||
// This will get us the full path to the mod, e.g. C:\spt\user\mods\5ReadCustomJsonConfig-0.0.1
|
||||
var pathToMod = _modHelper.GetAbsolutePathToModFolder(Assembly.GetExecutingAssembly());
|
||||
|
||||
// We give the path to the mod folder and the file we want to get, giving us the config, supply the files 'type' between the diamond brackets
|
||||
var config = _modHelper.GetJsonDataFromFile<ModConfig>(pathToMod, "config.json");
|
||||
|
||||
_logger.Success($"Read property: 'ExampleProperty' from config with value: {config.ExampleProperty}");
|
||||
}
|
||||
}
|
||||
|
||||
// This class should represent your config structure
|
||||
public class ModConfig
|
||||
{
|
||||
public string ExampleProperty
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"ExampleProperty": "boop"
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
{
|
||||
"name": "5ReadCustomConfig",
|
||||
"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"
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<RootNamespace>_6OverrideMethod</RootNamespace>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<OutputType>Library</OutputType>
|
||||
<Version>0.0.1</Version>
|
||||
<!-- The two lines below will set the output path for the binaries -->
|
||||
<OutputPath>bin\$(Configuration)\$(ProjectName)\$(AssemblyName)-$(Version)\</OutputPath>
|
||||
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- TODO: Change to Nuget Package -->
|
||||
<ItemGroup>
|
||||
<Reference Include="Core">
|
||||
<HintPath>..\TempReferences\Core.dll</HintPath>
|
||||
<Private>false</Private>
|
||||
<CopyLocal>false</CopyLocal>
|
||||
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
||||
</Reference>
|
||||
<Reference Include="SptCommon">
|
||||
<HintPath>..\TempReferences\SptCommon.dll</HintPath>
|
||||
<Private>false</Private>
|
||||
<CopyLocal>false</CopyLocal>
|
||||
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
||||
</Reference>
|
||||
<Reference Include="SptDependencyInjection">
|
||||
<HintPath>..\TempReferences\SptDependencyInjection.dll</HintPath>
|
||||
<Private>false</Private>
|
||||
<CopyLocal>false</CopyLocal>
|
||||
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -1,29 +0,0 @@
|
||||
using Core.Models.Utils;
|
||||
using Core.Servers;
|
||||
using Core.Services;
|
||||
using Core.Utils;
|
||||
using SptCommon.Annotations;
|
||||
|
||||
namespace _6OverrideMethod
|
||||
{
|
||||
[Injectable(InjectableTypeOverride = typeof(Watermark))]
|
||||
public class OverrideMethod: Watermark
|
||||
{
|
||||
public OverrideMethod(
|
||||
ISptLogger<Watermark> logger, // The logger needs to use the same type as the overriden type (in this case, Watermark)
|
||||
ConfigServer configServer,
|
||||
LocalisationService localisationService,
|
||||
WatermarkLocale watermarkLocale)
|
||||
: base(logger, configServer, localisationService, watermarkLocale) // You must provide the parameters the overridden type requires
|
||||
{ }
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
// We add a log message to the init method
|
||||
_logger.Success("This is a watermark mod override!");
|
||||
|
||||
// This runs the original method (optional)
|
||||
base.Initialize();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
{
|
||||
"name": "6OverrideMethod",
|
||||
"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"
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<RootNamespace>_7UseMultipleClasses</RootNamespace>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<OutputType>Library</OutputType>
|
||||
<Version>0.0.1</Version>
|
||||
<!-- The two lines below will set the output path for the binaries -->
|
||||
<OutputPath>bin\$(Configuration)\$(ProjectName)\$(AssemblyName)-$(Version)\</OutputPath>
|
||||
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- TODO: Change to Nuget Package -->
|
||||
<ItemGroup>
|
||||
<Reference Include="Core">
|
||||
<HintPath>..\TempReferences\Core.dll</HintPath>
|
||||
<Private>false</Private>
|
||||
<CopyLocal>false</CopyLocal>
|
||||
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
||||
</Reference>
|
||||
<Reference Include="SptCommon">
|
||||
<HintPath>..\TempReferences\SptCommon.dll</HintPath>
|
||||
<Private>false</Private>
|
||||
<CopyLocal>false</CopyLocal>
|
||||
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
||||
</Reference>
|
||||
<Reference Include="SptDependencyInjection">
|
||||
<HintPath>..\TempReferences\SptDependencyInjection.dll</HintPath>
|
||||
<Private>false</Private>
|
||||
<CopyLocal>false</CopyLocal>
|
||||
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -1,12 +0,0 @@
|
||||
using System;
|
||||
|
||||
namespace _7UseMultipleClasses
|
||||
{
|
||||
public class SecondClass
|
||||
{
|
||||
public string GetText()
|
||||
{
|
||||
return "test text";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
using Core.Models.External;
|
||||
using Core.Models.Utils;
|
||||
|
||||
namespace _7UseMultipleClasses
|
||||
{
|
||||
/// <summary>
|
||||
/// Having multiple classes can make keeping your code maintainable easier, you can split related code into their own class
|
||||
/// </summary>
|
||||
public class UseMultipleClasses : IPostDBLoadMod
|
||||
{
|
||||
private readonly ISptLogger<UseMultipleClasses> _logger;
|
||||
|
||||
public UseMultipleClasses(
|
||||
ISptLogger<UseMultipleClasses> logger)
|
||||
{
|
||||
this._logger = logger;
|
||||
}
|
||||
|
||||
public void PostDBLoad()
|
||||
{
|
||||
// We create an instance of the other class
|
||||
var otherClass = new SecondClass();
|
||||
|
||||
// We call the "GetText" method that exists in the other class
|
||||
var text = otherClass.GetText();
|
||||
|
||||
// Log the result to the server console
|
||||
_logger.Info($"The SecondClass returned the text: {text}");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
{
|
||||
"name": "7UseMultipleClasses",
|
||||
"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"
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<RootNamespace>_8OnLoad</RootNamespace>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<OutputType>Library</OutputType>
|
||||
<Version>0.0.1</Version>
|
||||
<!-- The two lines below will set the output path for the binaries -->
|
||||
<OutputPath>bin\$(Configuration)\$(ProjectName)\$(AssemblyName)-$(Version)\</OutputPath>
|
||||
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- TODO: Change to Nuget Package -->
|
||||
<ItemGroup>
|
||||
<Reference Include="Core">
|
||||
<HintPath>..\TempReferences\Core.dll</HintPath>
|
||||
<Private>false</Private>
|
||||
<CopyLocal>false</CopyLocal>
|
||||
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
||||
</Reference>
|
||||
<Reference Include="SptCommon">
|
||||
<HintPath>..\TempReferences\SptCommon.dll</HintPath>
|
||||
<Private>false</Private>
|
||||
<CopyLocal>false</CopyLocal>
|
||||
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
||||
</Reference>
|
||||
<Reference Include="SptDependencyInjection">
|
||||
<HintPath>..\TempReferences\SptDependencyInjection.dll</HintPath>
|
||||
<Private>false</Private>
|
||||
<CopyLocal>false</CopyLocal>
|
||||
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -1,33 +0,0 @@
|
||||
using Core.DI;
|
||||
using Core.Models.Utils;
|
||||
using SptCommon.Annotations;
|
||||
|
||||
namespace _8OnLoad
|
||||
{
|
||||
// Flag class as being OnLoad and give it a load priority, check `OnLoadOrder` for list of possible choices
|
||||
[Injectable(InjectableTypeOverride = typeof(IOnLoad), TypePriority = OnLoadOrder.PostSptDatabase)] // Can also give an int value for fine-grained control
|
||||
[Injectable(InjectableTypeOverride = typeof(OnLoadExample))]
|
||||
public class OnLoadExample : IOnLoad // Must implement the IOnLoad interface
|
||||
{
|
||||
private readonly ISptLogger<OnLoadExample> _logger;
|
||||
|
||||
public OnLoadExample(
|
||||
ISptLogger<OnLoadExample> logger)
|
||||
{
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public Task OnLoad()
|
||||
{
|
||||
// Can do work here
|
||||
_logger.Success($"Mod loaded after database!");
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public string GetRoute()
|
||||
{
|
||||
return "mod-load-example";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
{
|
||||
"name": "8OnLoadExample",
|
||||
"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"
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<RootNamespace>_9OnUpdate</RootNamespace>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<OutputType>Library</OutputType>
|
||||
<Version>0.0.1</Version>
|
||||
<!-- The two lines below will set the output path for the binaries -->
|
||||
<OutputPath>bin\$(Configuration)\$(ProjectName)\$(AssemblyName)-$(Version)\</OutputPath>
|
||||
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- TODO: Change to Nuget Package -->
|
||||
<ItemGroup>
|
||||
<Reference Include="Core">
|
||||
<HintPath>..\TempReferences\Core.dll</HintPath>
|
||||
<Private>false</Private>
|
||||
<CopyLocal>false</CopyLocal>
|
||||
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
||||
</Reference>
|
||||
<Reference Include="SptCommon">
|
||||
<HintPath>..\TempReferences\SptCommon.dll</HintPath>
|
||||
<Private>false</Private>
|
||||
<CopyLocal>false</CopyLocal>
|
||||
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
||||
</Reference>
|
||||
<Reference Include="SptDependencyInjection">
|
||||
<HintPath>..\TempReferences\SptDependencyInjection.dll</HintPath>
|
||||
<Private>false</Private>
|
||||
<CopyLocal>false</CopyLocal>
|
||||
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -1,33 +0,0 @@
|
||||
using Core.DI;
|
||||
using Core.Models.Utils;
|
||||
using SptCommon.Annotations;
|
||||
|
||||
namespace _9OnUpdate
|
||||
{
|
||||
// Flag class as being OnLoad and give it a load priority, check `OnLoadOrder` for list of possible choices
|
||||
[Injectable(InjectableTypeOverride = typeof(IOnUpdate), TypePriority = OnUpdateOrder.PostSptUpdate)] // Can also give it an int value for more fine-grained control
|
||||
[Injectable(InjectableTypeOverride = typeof(OnUpdateExample))]
|
||||
public class OnUpdateExample : IOnUpdate // Must implement the IOnUpdate interface
|
||||
{
|
||||
private readonly ISptLogger<OnUpdateExample> _logger;
|
||||
|
||||
public OnUpdateExample(
|
||||
ISptLogger<OnUpdateExample> logger)
|
||||
{
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public bool OnUpdate(long timeSinceLastRun)
|
||||
{
|
||||
// Can do work here
|
||||
_logger.Success($"Mod running update after SPT updates have run!");
|
||||
|
||||
return true; // Return true for a success, false for failure
|
||||
}
|
||||
|
||||
public string GetRoute()
|
||||
{
|
||||
return "mod-update-example";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
{
|
||||
"name": "9OnUpdateExample",
|
||||
"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"
|
||||
}
|
||||
@@ -1,154 +0,0 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.12.35527.113
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "1Logging", "1Logging\1Logging.csproj", "{98270ED7-04C7-4F90-91B1-820C672CE123}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "2EditDatabase", "2EditDatabase\2EditDatabase.csproj", "{42BF3751-D744-4373-B5CC-704A0CCA0106}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "3EditSptConfig", "3EditSptConfig\3EditSptConfig.csproj", "{CE1A0F24-D1CB-4E12-8462-13641A7FB964}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "4ReadCustomJson5Config", "4ReadCustomJson5Config\4ReadCustomJson5Config.csproj", "{CEFCC99D-C0C7-4894-93D9-3B6F3BAFD92F}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "5ReadCustomJsonConfig", "5ReadCustomJsonConfig\5ReadCustomJsonConfig.csproj", "{00CE855D-299F-4700-84C2-0567060593DF}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "6OverrideMethod", "6OverrideMethod\6OverrideMethod.csproj", "{494C6DB5-EAD2-4DCA-871A-34675D2452DE}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "7UseMultipleClasses", "7UseMultipleClasses\7UseMultipleClasses.csproj", "{B6DE92DC-7ADB-4E5E-BECF-68C829D7CBCA}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "8OnLoad", "8OnLoad\8OnLoad.csproj", "{556E07A1-E399-4761-89C0-AC74E6A20BA1}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "9OnUpdate", "9OnUpdate\9OnUpdate.csproj", "{113E9B1C-25E4-4DB3-9724-A48684A40B91}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "10CustomRoute", "10CustomRoute\10CustomRoute.csproj", "{4AF609A6-91C8-48CC-8D4B-9454864C98E2}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "11RegisterClassesInDI", "11RegisterClassesInDI\11RegisterClassesInDI.csproj", "{5B705F9E-7F4F-491A-8215-30EE5B5D77B0}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "12Bundle", "12Bundle\12Bundle.csproj", "{FE769EA8-4F31-4426-90A3-A1EFA8A43D6E}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "13AddTraderWithAssortJson", "13AddTraderWithAssortJson\13AddTraderWithAssortJson.csproj", "{636D5797-E37F-425A-B8DB-E3FBE4573F71}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "14AfterDBLoadHook", "14AfterDBLoadHook\14AfterDBLoadHook.csproj", "{B4DDC0E8-99D1-405E-9E01-823523FE642B}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "15HttpListenerExample", "15HttpListenerExample\15HttpListenerExample.csproj", "{15F2B434-439E-498E-9B85-B7BBC2F4AFA4}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "18CustomItemService", "18CustomItemService\18CustomItemService.csproj", "{ADE10F29-58D6-4C13-B217-7C737DFB413A}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "18.1CustomItemServiceLootBox", "18.1CustomItemServiceLootBox\18.1CustomItemServiceLootBox.csproj", "{B870C285-B435-4C40-89C4-0220D34CB9BE}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "20CustomChatBot", "20CustomChatBot\20CustomChatBot.csproj", "{32271491-8CF1-4014-9A8E-E1EA22EA4292}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "13.1AddTraderWithDynamicAssorts", "13.1AddTraderWithDynamicAssorts\13.1AddTraderWithDynamicAssorts.csproj", "{9038FA64-E484-4549-9728-C50F12BBE643}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "21CustomCommandoCommand", "21CustomCommandoCommand\21CustomCommandoCommand.csproj", "{A7D491BC-94C0-4AC9-9190-1FCA05D09B19}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "22CustomSptCommand", "22CustomSptCommand\22CustomSptCommand.csproj", "{7FB8C9B5-CEBF-4E76-9EC3-670EE57B328B}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "23CustomAbstractChatBot", "23CustomAbstractChatBot\23CustomAbstractChatBot.csproj", "{B97A7EE2-04DD-4690-866E-9179F5E01908}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "24Websocket", "24Websocket\24Websocket.csproj", "{94B1B1E4-C47D-4AA7-BA3A-88F3D30439DF}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{98270ED7-04C7-4F90-91B1-820C672CE123}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{98270ED7-04C7-4F90-91B1-820C672CE123}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{98270ED7-04C7-4F90-91B1-820C672CE123}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{98270ED7-04C7-4F90-91B1-820C672CE123}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{42BF3751-D744-4373-B5CC-704A0CCA0106}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{42BF3751-D744-4373-B5CC-704A0CCA0106}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{42BF3751-D744-4373-B5CC-704A0CCA0106}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{42BF3751-D744-4373-B5CC-704A0CCA0106}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{CE1A0F24-D1CB-4E12-8462-13641A7FB964}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{CE1A0F24-D1CB-4E12-8462-13641A7FB964}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{CE1A0F24-D1CB-4E12-8462-13641A7FB964}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{CE1A0F24-D1CB-4E12-8462-13641A7FB964}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{CEFCC99D-C0C7-4894-93D9-3B6F3BAFD92F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{CEFCC99D-C0C7-4894-93D9-3B6F3BAFD92F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{CEFCC99D-C0C7-4894-93D9-3B6F3BAFD92F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{CEFCC99D-C0C7-4894-93D9-3B6F3BAFD92F}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{00CE855D-299F-4700-84C2-0567060593DF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{00CE855D-299F-4700-84C2-0567060593DF}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{00CE855D-299F-4700-84C2-0567060593DF}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{00CE855D-299F-4700-84C2-0567060593DF}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{494C6DB5-EAD2-4DCA-871A-34675D2452DE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{494C6DB5-EAD2-4DCA-871A-34675D2452DE}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{494C6DB5-EAD2-4DCA-871A-34675D2452DE}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{494C6DB5-EAD2-4DCA-871A-34675D2452DE}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{B6DE92DC-7ADB-4E5E-BECF-68C829D7CBCA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{B6DE92DC-7ADB-4E5E-BECF-68C829D7CBCA}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{B6DE92DC-7ADB-4E5E-BECF-68C829D7CBCA}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{B6DE92DC-7ADB-4E5E-BECF-68C829D7CBCA}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{556E07A1-E399-4761-89C0-AC74E6A20BA1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{556E07A1-E399-4761-89C0-AC74E6A20BA1}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{556E07A1-E399-4761-89C0-AC74E6A20BA1}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{556E07A1-E399-4761-89C0-AC74E6A20BA1}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{113E9B1C-25E4-4DB3-9724-A48684A40B91}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{113E9B1C-25E4-4DB3-9724-A48684A40B91}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{113E9B1C-25E4-4DB3-9724-A48684A40B91}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{113E9B1C-25E4-4DB3-9724-A48684A40B91}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{4AF609A6-91C8-48CC-8D4B-9454864C98E2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{4AF609A6-91C8-48CC-8D4B-9454864C98E2}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{4AF609A6-91C8-48CC-8D4B-9454864C98E2}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{4AF609A6-91C8-48CC-8D4B-9454864C98E2}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{5B705F9E-7F4F-491A-8215-30EE5B5D77B0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{5B705F9E-7F4F-491A-8215-30EE5B5D77B0}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{5B705F9E-7F4F-491A-8215-30EE5B5D77B0}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{5B705F9E-7F4F-491A-8215-30EE5B5D77B0}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{FE769EA8-4F31-4426-90A3-A1EFA8A43D6E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{FE769EA8-4F31-4426-90A3-A1EFA8A43D6E}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{FE769EA8-4F31-4426-90A3-A1EFA8A43D6E}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{FE769EA8-4F31-4426-90A3-A1EFA8A43D6E}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{636D5797-E37F-425A-B8DB-E3FBE4573F71}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{636D5797-E37F-425A-B8DB-E3FBE4573F71}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{636D5797-E37F-425A-B8DB-E3FBE4573F71}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{636D5797-E37F-425A-B8DB-E3FBE4573F71}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{B4DDC0E8-99D1-405E-9E01-823523FE642B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{B4DDC0E8-99D1-405E-9E01-823523FE642B}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{B4DDC0E8-99D1-405E-9E01-823523FE642B}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{B4DDC0E8-99D1-405E-9E01-823523FE642B}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{15F2B434-439E-498E-9B85-B7BBC2F4AFA4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{15F2B434-439E-498E-9B85-B7BBC2F4AFA4}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{15F2B434-439E-498E-9B85-B7BBC2F4AFA4}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{15F2B434-439E-498E-9B85-B7BBC2F4AFA4}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{ADE10F29-58D6-4C13-B217-7C737DFB413A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{ADE10F29-58D6-4C13-B217-7C737DFB413A}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{ADE10F29-58D6-4C13-B217-7C737DFB413A}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{ADE10F29-58D6-4C13-B217-7C737DFB413A}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{B870C285-B435-4C40-89C4-0220D34CB9BE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{B870C285-B435-4C40-89C4-0220D34CB9BE}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{B870C285-B435-4C40-89C4-0220D34CB9BE}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{B870C285-B435-4C40-89C4-0220D34CB9BE}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{32271491-8CF1-4014-9A8E-E1EA22EA4292}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{32271491-8CF1-4014-9A8E-E1EA22EA4292}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{32271491-8CF1-4014-9A8E-E1EA22EA4292}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{32271491-8CF1-4014-9A8E-E1EA22EA4292}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{9038FA64-E484-4549-9728-C50F12BBE643}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{9038FA64-E484-4549-9728-C50F12BBE643}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{9038FA64-E484-4549-9728-C50F12BBE643}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{9038FA64-E484-4549-9728-C50F12BBE643}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{A7D491BC-94C0-4AC9-9190-1FCA05D09B19}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{A7D491BC-94C0-4AC9-9190-1FCA05D09B19}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{A7D491BC-94C0-4AC9-9190-1FCA05D09B19}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{A7D491BC-94C0-4AC9-9190-1FCA05D09B19}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{7FB8C9B5-CEBF-4E76-9EC3-670EE57B328B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{7FB8C9B5-CEBF-4E76-9EC3-670EE57B328B}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{7FB8C9B5-CEBF-4E76-9EC3-670EE57B328B}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{7FB8C9B5-CEBF-4E76-9EC3-670EE57B328B}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{B97A7EE2-04DD-4690-866E-9179F5E01908}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{B97A7EE2-04DD-4690-866E-9179F5E01908}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{B97A7EE2-04DD-4690-866E-9179F5E01908}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{B97A7EE2-04DD-4690-866E-9179F5E01908}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{94B1B1E4-C47D-4AA7-BA3A-88F3D30439DF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{94B1B1E4-C47D-4AA7-BA3A-88F3D30439DF}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{94B1B1E4-C47D-4AA7-BA3A-88F3D30439DF}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{94B1B1E4-C47D-4AA7-BA3A-88F3D30439DF}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
+11
-2
@@ -1,9 +1,14 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<PackageId>SPT.Server</PackageId>
|
||||
<Authors>SPT Team</Authors>
|
||||
<PackageId>SPTarkov.Server</PackageId>
|
||||
<Authors>Single Player Tarkov</Authors>
|
||||
<Description>Single Player Tarkov server launcher.</Description>
|
||||
<Copyright>Copyright (c) Single Player Tarkov 2025</Copyright>
|
||||
<PackageLicenseFile>LICENSE</PackageLicenseFile>
|
||||
<PackageProjectUrl>https://sp-tarkov.com</PackageProjectUrl>
|
||||
<RepositoryUrl>https://github.com/sp-tarkov/server-csharp</RepositoryUrl>
|
||||
<RepositoryType>git</RepositoryType>
|
||||
<ServerGarbageCollection>true</ServerGarbageCollection>
|
||||
<EnableDefaultContentItems>false</EnableDefaultContentItems>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
@@ -43,4 +48,8 @@
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Include="..\LICENSE" Pack="true" Visible="false" PackagePath=""/>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
Reference in New Issue
Block a user