diff --git a/Core/Callbacks/LauncherCallbacks.cs b/Core/Callbacks/LauncherCallbacks.cs
index d672d167..a616dd84 100644
--- a/Core/Callbacks/LauncherCallbacks.cs
+++ b/Core/Callbacks/LauncherCallbacks.cs
@@ -1,12 +1,26 @@
-using Core.Models.Eft.Common;
+using Core.Annotations;
+using Core.Controllers;
+using Core.Models.Eft.Common;
using Core.Models.Eft.Launcher;
+using Core.Servers;
+using Core.Utils;
namespace Core.Callbacks;
+[Injectable]
public class LauncherCallbacks
{
- public LauncherCallbacks()
+ protected HttpResponseUtil _httpResponseUtil;
+ protected LauncherController _launcherController;
+ protected SaveServer _saveServer;
+ protected Watermark _watermark;
+ public LauncherCallbacks(
+ HttpResponseUtil httpResponse,
+ LauncherController launcherController,
+ SaveServer saveServer,
+ Watermark watermark)
{
+
}
public string Connect()
@@ -73,4 +87,4 @@ public class LauncherCallbacks
{
throw new NotImplementedException();
}
-}
\ No newline at end of file
+}
diff --git a/Core/Controllers/LauncherController.cs b/Core/Controllers/LauncherController.cs
index 50f2aab5..787783cc 100644
--- a/Core/Controllers/LauncherController.cs
+++ b/Core/Controllers/LauncherController.cs
@@ -1,9 +1,11 @@
+using Core.Annotations;
using Core.Models.Eft.Launcher;
using Core.Models.Eft.Profile;
using Core.Models.Spt.Mod;
namespace Core.Controllers;
+[Injectable]
public class LauncherController
{
///
@@ -144,4 +146,4 @@ public class LauncherController
{
throw new NotImplementedException();
}
-}
\ No newline at end of file
+}
diff --git a/Core/DI/Router.cs b/Core/DI/Router.cs
index 68756a31..1865fdf8 100644
--- a/Core/DI/Router.cs
+++ b/Core/DI/Router.cs
@@ -1,7 +1,9 @@
+using System.Text.Json;
using Core.Models.Eft.Common;
using Core.Models.Eft.ItemEvent;
using Core.Models.Eft.Profile;
using Core.Models.Utils;
+using Core.Utils;
namespace Core.DI;
@@ -39,22 +41,27 @@ public abstract class Router
.Where((r) => !r.dynamic)
.Any((r) => r.route == url);
}
-
- public abstract Type? GetBodyDeserializationType();
}
public abstract class StaticRouter : Router
{
- private List> actions;
+ private List actions;
+ private JsonUtil _jsonUtil;
- public StaticRouter(List> routes) : base()
+ public StaticRouter(JsonUtil jsonUtil, List routes) : base()
{
actions = routes;
+ _jsonUtil = jsonUtil;
}
- public object HandleStatic(string url, IRequestData? info, string sessionID, string output)
+ public object HandleStatic(string url, string? body, string sessionID, string output)
{
- return actions.Single(route => route.url == url).action(url, info, sessionID, output);
+ var action = actions.Single(route => route.url == url);
+ var type = action.bodyType;
+ IRequestData? info = null;
+ if (type != null && !string.IsNullOrEmpty(body))
+ info = (IRequestData?) _jsonUtil.Deserialize(body, type);
+ return action.action(url, info, sessionID, output);
}
protected override List GetHandledRoutes()
@@ -65,16 +72,23 @@ public abstract class StaticRouter : Router
public abstract class DynamicRouter : Router
{
- private List> actions;
+ private List actions;
+ private JsonUtil _jsonUtil;
- public DynamicRouter(List> routes) : base()
+ public DynamicRouter(JsonUtil jsonUtil, List routes) : base()
{
actions = routes;
+ _jsonUtil = jsonUtil;
}
- public object HandleDynamic(string url, IRequestData? info, string sessionID, string output)
+ public object HandleDynamic(string url, string? body, string sessionID, string output)
{
- return actions.First(r => url.Contains(r.url)).action(url, info, sessionID, output);
+ var action = actions.First(r => url.Contains(r.url));
+ var type = action.bodyType;
+ IRequestData? info = null;
+ if (type != null && !string.IsNullOrEmpty(body))
+ info = (IRequestData?) _jsonUtil.Deserialize(body, type);
+ return action.action(url, info, sessionID, output);
}
protected override List GetHandledRoutes()
@@ -103,5 +117,9 @@ public abstract class SaveLoadRouter : Router
public record HandledRoute(string route, bool dynamic);
-public record RouteAction(string url, Func action) where T : IRequestData;
+public record RouteAction(
+ string url,
+ Func action,
+ Type? bodyType = null
+);
//public action: (url: string, info: any, sessionID: string, output: string) => Promise,
diff --git a/Core/Models/Common/MinMax.cs b/Core/Models/Common/MinMax.cs
index c229d2f7..5aa35d40 100644
--- a/Core/Models/Common/MinMax.cs
+++ b/Core/Models/Common/MinMax.cs
@@ -4,9 +4,11 @@ namespace Core.Models.Common;
public class MinMax
{
+ [JsonPropertyName("type")]
+ public string? Type { get; set; }
[JsonPropertyName("max")]
public double? Max { get; set; }
[JsonPropertyName("min")]
public double? Min { get; set; }
-}
\ No newline at end of file
+}
diff --git a/Core/Models/Eft/Common/Tables/Item.cs b/Core/Models/Eft/Common/Tables/Item.cs
index 954e7bd5..e018f0ad 100644
--- a/Core/Models/Eft/Common/Tables/Item.cs
+++ b/Core/Models/Eft/Common/Tables/Item.cs
@@ -18,6 +18,9 @@ public class Item
[JsonPropertyName("location")]
public object? Location { get; set; } // TODO: Can be IItemLocation or number
+
+ [JsonPropertyName("desc")]
+ public string? Desc { get; set; }
[JsonPropertyName("upd")]
public Upd? Update { get; set; }
@@ -254,4 +257,4 @@ public class UpdCultistAmulet
{
[JsonPropertyName("NumberOfUsages")]
public double? NumberOfUsages { get; set; }
-}
\ No newline at end of file
+}
diff --git a/Core/Models/Eft/Launcher/LoginRequestData.cs b/Core/Models/Eft/Launcher/LoginRequestData.cs
index 5545bfc4..a17c130f 100644
--- a/Core/Models/Eft/Launcher/LoginRequestData.cs
+++ b/Core/Models/Eft/Launcher/LoginRequestData.cs
@@ -1,12 +1,13 @@
using System.Text.Json.Serialization;
+using Core.Models.Utils;
namespace Core.Models.Eft.Launcher;
-public class LoginRequestData
+public class LoginRequestData : IRequestData
{
[JsonPropertyName("username")]
public string? Username { get; set; }
[JsonPropertyName("password")]
public string? Password { get; set; }
-}
\ No newline at end of file
+}
diff --git a/Core/Models/Spt/Config/AirdropConfig.cs b/Core/Models/Spt/Config/AirdropConfig.cs
index dff76614..60e2ff93 100644
--- a/Core/Models/Spt/Config/AirdropConfig.cs
+++ b/Core/Models/Spt/Config/AirdropConfig.cs
@@ -58,7 +58,8 @@ public class AirdropChancePercent
///
public class AirdropLoot
{
- [JsonPropertyName("Icon")]
+ [JsonPropertyName("icon")]
+ [JsonConverter(typeof(JsonStringEnumConverter))]
public AirdropTypeEnum Icon { get; set; }
///
@@ -126,4 +127,4 @@ public class AirdropLoot
[JsonPropertyName("forcedLoot")]
public Dictionary? ForcedLoot { get; set; }
-}
\ No newline at end of file
+}
diff --git a/Core/Models/Spt/Config/BotConfig.cs b/Core/Models/Spt/Config/BotConfig.cs
index 905056f9..5ca80ef9 100644
--- a/Core/Models/Spt/Config/BotConfig.cs
+++ b/Core/Models/Spt/Config/BotConfig.cs
@@ -138,6 +138,15 @@ public class PresetBatch
[JsonPropertyName("bossKnight")]
public int BossKnight { get; set; }
+ [JsonPropertyName("bossZryachiy")]
+ public int BossZryachiy { get; set; }
+
+ [JsonPropertyName("bossKolontay")]
+ public int BossKolontay { get; set; }
+
+ [JsonPropertyName("bossPartisan")]
+ public int BossPartisan { get; set; }
+
[JsonPropertyName("bossTest")]
public int BossTest { get; set; }
@@ -180,6 +189,21 @@ public class PresetBatch
[JsonPropertyName("followerBoar")]
public int FollowerBoar { get; set; }
+ [JsonPropertyName("followerBoarClose1")]
+ public int FollowerBoarClose1 { get; set; }
+
+ [JsonPropertyName("followerBoarClose2")]
+ public int FollowerBoarClose2 { get; set; }
+
+ [JsonPropertyName("followerZryachiy")]
+ public int FollowerZryachiy { get; set; }
+
+ [JsonPropertyName("followerKolontayAssault")]
+ public int FollowerKolontayAssault { get; set; }
+
+ [JsonPropertyName("followerKolontaySecurity")]
+ public int FollowerKolontaySecurity { get; set; }
+
[JsonPropertyName("marksman")]
public int Marksman { get; set; }
@@ -221,6 +245,12 @@ public class PresetBatch
[JsonPropertyName("pmcBEAR")]
public int PmcBEAR { get; set; }
+
+ [JsonPropertyName("shooterBTR")]
+ public int ShooterBTR { get; set; }
+
+ [JsonExtensionData]
+ public IDictionary AdditionalData { get; set; }
}
public class WalletLootSettings
@@ -288,7 +318,7 @@ public class EquipmentFilters
///
/// Chance NODS are down/active during the day
///
- [JsonPropertyName("NvgIsActiveChanceDayPercent")]
+ [JsonPropertyName("nvgIsActiveChanceDayPercent")]
public float? NvgIsActiveChanceDayPercent { get; set; }
///
@@ -522,4 +552,4 @@ public class RandomisedResourceValues
///
[JsonPropertyName("chanceMaxResourcePercent")]
public float ChanceMaxResourcePercent { get; set; }
-}
\ No newline at end of file
+}
diff --git a/Core/Models/Spt/Config/BotDurability.cs b/Core/Models/Spt/Config/BotDurability.cs
index c4cd51f7..b45fa1d6 100644
--- a/Core/Models/Spt/Config/BotDurability.cs
+++ b/Core/Models/Spt/Config/BotDurability.cs
@@ -11,43 +11,43 @@ public class BotDurability
public PmcDurability Pmc { get; set; }
[JsonPropertyName("boss")]
- public BotDurability Boss { get; set; }
+ public PmcDurability Boss { get; set; }
[JsonPropertyName("follower")]
- public BotDurability Follower { get; set; }
+ public PmcDurability Follower { get; set; }
[JsonPropertyName("assault")]
- public BotDurability Assault { get; set; }
+ public PmcDurability Assault { get; set; }
[JsonPropertyName("cursedassault")]
- public BotDurability CursedAssault { get; set; }
+ public PmcDurability CursedAssault { get; set; }
[JsonPropertyName("marksman")]
- public BotDurability Marksman { get; set; }
+ public PmcDurability Marksman { get; set; }
[JsonPropertyName("pmcbot")]
- public BotDurability PmcBot { get; set; }
+ public PmcDurability PmcBot { get; set; }
[JsonPropertyName("arenafighterevent")]
- public BotDurability ArenaFighterEvent { get; set; }
+ public PmcDurability ArenaFighterEvent { get; set; }
[JsonPropertyName("arenafighter")]
- public BotDurability ArenaFighter { get; set; }
+ public PmcDurability ArenaFighter { get; set; }
[JsonPropertyName("crazyassaultevent")]
- public BotDurability CrazyAssaultEvent { get; set; }
+ public PmcDurability CrazyAssaultEvent { get; set; }
[JsonPropertyName("exusec")]
- public BotDurability Exusec { get; set; }
+ public PmcDurability Exusec { get; set; }
[JsonPropertyName("gifter")]
- public BotDurability Gifter { get; set; }
+ public PmcDurability Gifter { get; set; }
[JsonPropertyName("sectantpriest")]
- public BotDurability SectantPriest { get; set; }
+ public PmcDurability SectantPriest { get; set; }
[JsonPropertyName("sectantwarrior")]
- public BotDurability SectantWarrior { get; set; }
+ public PmcDurability SectantWarrior { get; set; }
}
/** Durability values to be used when a more specific bot type can't be found */
@@ -82,6 +82,9 @@ public class PmcDurabilityArmor
[JsonPropertyName("minDelta")]
public double MinDelta { get; set; }
+
+ [JsonPropertyName("minLimitPercent")]
+ public double MinLimitPercent { get; set; }
}
public class ArmorDurability
@@ -112,4 +115,4 @@ public class WeaponDurability
[JsonPropertyName("minLimitPercent")]
public double MinLimitPercent { get; set; }
-}
\ No newline at end of file
+}
diff --git a/Core/Models/Spt/Config/GiftsConfig.cs b/Core/Models/Spt/Config/GiftsConfig.cs
index 61e6e6ee..ceeebed8 100644
--- a/Core/Models/Spt/Config/GiftsConfig.cs
+++ b/Core/Models/Spt/Config/GiftsConfig.cs
@@ -73,4 +73,8 @@ public class Gift
[JsonPropertyName("maxToSendPlayer")]
public int? MaxToSendPlayer { get; set; }
-}
\ No newline at end of file
+
+
+ [JsonPropertyName("maxToSendToPlayer")]
+ public int? MaxToSendToPlayer { get; set; }
+}
diff --git a/Core/Models/Spt/Config/InventoryConfig.cs b/Core/Models/Spt/Config/InventoryConfig.cs
index 1e16431d..66d747d5 100644
--- a/Core/Models/Spt/Config/InventoryConfig.cs
+++ b/Core/Models/Spt/Config/InventoryConfig.cs
@@ -33,6 +33,9 @@ public class InventoryConfig : BaseConfig
public class RewardDetails
{
+ [JsonPropertyName("_type")]
+ public string? Type { get; set; }
+
[JsonPropertyName("rewardCount")]
public int RewardCount { get; set; }
@@ -69,4 +72,4 @@ public class SealedAirdropContainerSettings
[JsonPropertyName("allowBossItems")]
public bool AllowBossItems { get; set; }
-}
\ No newline at end of file
+}
diff --git a/Core/Models/Spt/Config/LocationConfig.cs b/Core/Models/Spt/Config/LocationConfig.cs
index 4ea124c4..35576369 100644
--- a/Core/Models/Spt/Config/LocationConfig.cs
+++ b/Core/Models/Spt/Config/LocationConfig.cs
@@ -254,6 +254,9 @@ public class LootMultiplier
[JsonPropertyName("sandbox")]
public double Sandbox { get; set; }
+
+ [JsonPropertyName("sandbox_high")]
+ public double SandboxHigh { get; set; }
}
public class ContainerRandomisationSettings
@@ -316,4 +319,4 @@ public class ScavRaidTimeLocationSettings
/** Should bot waves be removed / spawn times be adjusted */
[JsonPropertyName("adjustWaves")]
public bool AdjustWaves { get; set; }
-}
\ No newline at end of file
+}
diff --git a/Core/Models/Spt/Config/LostOnDeathConfig.cs b/Core/Models/Spt/Config/LostOnDeathConfig.cs
index 19176c31..972fec44 100644
--- a/Core/Models/Spt/Config/LostOnDeathConfig.cs
+++ b/Core/Models/Spt/Config/LostOnDeathConfig.cs
@@ -60,4 +60,10 @@ public class LostEquipment
[JsonPropertyName("Scabbard")]
public bool Scabbard { get; set; }
-}
\ No newline at end of file
+
+ [JsonPropertyName("Compass")]
+ public bool Compass { get; set; }
+
+ [JsonPropertyName("SecuredContainer")]
+ public bool SecuredContainer { get; set; }
+}
diff --git a/Core/Models/Spt/Config/MatchConfig.cs b/Core/Models/Spt/Config/MatchConfig.cs
index 46807fe3..7bca1837 100644
--- a/Core/Models/Spt/Config/MatchConfig.cs
+++ b/Core/Models/Spt/Config/MatchConfig.cs
@@ -9,4 +9,7 @@ public class MatchConfig : BaseConfig
[JsonPropertyName("enabled")]
public bool Enabled { get; set; }
-}
\ No newline at end of file
+
+ [JsonPropertyName("randomiseMapContainers")]
+ public Dictionary RandomiseMapContainers { get; set; }
+}
diff --git a/Core/Models/Spt/Config/PlayerScavConfig.cs b/Core/Models/Spt/Config/PlayerScavConfig.cs
index bc52102e..370e1329 100644
--- a/Core/Models/Spt/Config/PlayerScavConfig.cs
+++ b/Core/Models/Spt/Config/PlayerScavConfig.cs
@@ -26,6 +26,9 @@ public class KarmaLevel
[JsonPropertyName("equipmentBlacklist")]
public Dictionary EquipmentBlacklist { get; set; }
+ [JsonPropertyName("labsAccessCardChancePercent")]
+ public double? LabsAccessCardChancePercent { get; set; }
+
[JsonPropertyName("lootItemsToAddChancePercent")]
public Dictionary LootItemsToAddChancePercent { get; set; }
}
@@ -58,4 +61,4 @@ public class ItemLimits
[JsonPropertyName("grenades")]
public GenerationData Grenades { get; set; }
-}
\ No newline at end of file
+}
diff --git a/Core/Models/Spt/Config/PmcConfig.cs b/Core/Models/Spt/Config/PmcConfig.cs
index a7afabd0..e2ab433b 100644
--- a/Core/Models/Spt/Config/PmcConfig.cs
+++ b/Core/Models/Spt/Config/PmcConfig.cs
@@ -53,6 +53,9 @@ public class PmcConfig : BaseConfig
[JsonPropertyName("looseWeaponInBackpackLootMinMax")]
public MinMax LooseWeaponInBackpackLootMinMax { get; set; }
+ [JsonPropertyName("_isUsec")]
+ public string? IsUsecDescription { get; set; }
+
/** Percentage chance PMC will be USEC */
[JsonPropertyName("isUsec")]
public double IsUsec { get; set; }
@@ -65,6 +68,9 @@ public class PmcConfig : BaseConfig
[JsonPropertyName("bearType")]
public string BearType { get; set; }
+ [JsonPropertyName("_pmcType")]
+ public string? PmcTypeDescription { get; set; }
+
/** What 'brain' does a PMC use, keyed by map and side (USEC/BEAR) key: map location, value: type for usec/bear */
[JsonPropertyName("pmcType")]
public Dictionary>> PmcType { get; set; }
@@ -106,6 +112,9 @@ public class PmcConfig : BaseConfig
/** Should secure container loot from usec.json/bear.json be added to pmc bots secure */
[JsonPropertyName("addSecureContainerLootFromBotConfig")]
public bool AddSecureContainerLootFromBotConfig { get; set; }
+
+ [JsonPropertyName("addPrefixToSameNamePMCAsPlayerChance")]
+ public int? AddPrefixToSameNamePMCAsPlayerChance { get; set; }
}
public class HostilitySettings
@@ -159,4 +168,4 @@ public class IMinMaxLootValue : MinMax
{
[JsonPropertyName("value")]
public double Value { get; set; }
-}
\ No newline at end of file
+}
diff --git a/Core/Models/Spt/Config/QuestConfig.cs b/Core/Models/Spt/Config/QuestConfig.cs
index c7830a02..7994515c 100644
--- a/Core/Models/Spt/Config/QuestConfig.cs
+++ b/Core/Models/Spt/Config/QuestConfig.cs
@@ -56,14 +56,17 @@ public class PlayerTypeQuestIds
public class QuestTypeIds
{
- [JsonPropertyName("Elimination")]
+ [JsonPropertyName("elimination")]
public string Elimination { get; set; }
- [JsonPropertyName("Completion")]
+ [JsonPropertyName("completion")]
public string Completion { get; set; }
- [JsonPropertyName("Exploration")]
+ [JsonPropertyName("exploration")]
public string Exploration { get; set; }
+
+ [JsonPropertyName("pickup")]
+ public string Pickup { get; set; }
}
public class EventQuestData
@@ -173,6 +176,8 @@ public class RewardScaling
public class TraderWhitelist
{
+ [JsonPropertyName("name")]
+ public string Name { get; set; }
[JsonPropertyName("traderId")]
public string TraderId { get; set; }
@@ -253,6 +258,11 @@ public class Pickup : BaseQuestConfig
{
[JsonPropertyName("ItemTypeToFetchWithMaxCount")]
public List ItemTypeToFetchWithMaxCount { get; set; }
+
+ public List ItemTypesToFetch { get; set; }
+
+ [JsonPropertyName("maxItemFetchCount")]
+ public int? MaxItemFetchCount { get; set; }
}
public class PickupTypeWithMaxCount
@@ -370,4 +380,4 @@ public class ProbabilityObject
[JsonPropertyName("data")]
public object Data { get; set; }
-}
\ No newline at end of file
+}
diff --git a/Core/Models/Spt/Config/RagfairConfig.cs b/Core/Models/Spt/Config/RagfairConfig.cs
index 49498e51..79034349 100644
--- a/Core/Models/Spt/Config/RagfairConfig.cs
+++ b/Core/Models/Spt/Config/RagfairConfig.cs
@@ -116,7 +116,7 @@ public class Dynamic
[JsonPropertyName("condition")]
/** Settings to control the durability range of item items listed on flea */
- public Condition Condition { get; set; }
+ public Dictionary Condition { get; set; }
[JsonPropertyName("stackablePercent")]
/** Size stackable items should be listed for in percent of max stack size */
@@ -138,6 +138,9 @@ public class Dynamic
/** A multipler to apply to individual tpls price just prior to item quality adjustment */
public Dictionary ItemPriceMultiplier { get; set; }
+ [JsonPropertyName("_currencies")]
+ public string? CurrenciesDescription { get; set; }
+
[JsonPropertyName("currencies")]
/** Percentages to sell offers in each currency */
public Dictionary Currencies { get; set; }
@@ -265,6 +268,9 @@ public class Condition
[JsonPropertyName("max")]
public MinMax Max { get; set; }
+
+ [JsonPropertyName("_name")]
+ public string Name { get; set; }
}
public class RagfairBlacklist
@@ -352,6 +358,9 @@ public class UnreasonableModPrices
///
[JsonPropertyName("newPriceHandbookMultiplier")]
public int NewPriceHandbookMultiplier { get; set; }
+
+ [JsonPropertyName("itemType")]
+ public string ItemType { get; set; }
}
public class ArmorSettings
@@ -386,8 +395,9 @@ public class TieredFlea
[JsonPropertyName("unlocksType")]
public Dictionary UnlocksType { get; set; }
- public bool AmmoTiersEnabled { get; set; }
-
[JsonPropertyName("ammoTplUnlocks")]
public Dictionary AmmoTplUnlocks { get; set; }
-}
\ No newline at end of file
+
+ [JsonPropertyName("ammoTiersEnabled")]
+ public bool AmmoTiersEnabled { get; set; }
+}
diff --git a/Core/Models/Spt/Config/RepairConfig.cs b/Core/Models/Spt/Config/RepairConfig.cs
index a585e591..145ad5be 100644
--- a/Core/Models/Spt/Config/RepairConfig.cs
+++ b/Core/Models/Spt/Config/RepairConfig.cs
@@ -82,6 +82,12 @@ public class RepairKit
[JsonPropertyName("weapon")]
public BonusSettings Weapon { get; set; }
+
+ [JsonPropertyName("vest")]
+ public BonusSettings Vest { get; set; }
+
+ [JsonPropertyName("headwear")]
+ public BonusSettings Headwear { get; set; }
}
public class BonusSettings
@@ -92,10 +98,10 @@ public class BonusSettings
[JsonPropertyName("bonusTypeWeight")]
public Dictionary BonusTypeWeight { get; set; }
- [JsonPropertyName("common")]
+ [JsonPropertyName("Common")]
public Dictionary Common { get; set; }
- [JsonPropertyName("rare")]
+ [JsonPropertyName("Rare")]
public Dictionary Rare { get; set; }
}
@@ -107,4 +113,4 @@ public class BonusValues
/** What dura is buff active between (min max of current max) */
[JsonPropertyName("activeDurabilityPercentMinMax")]
public MinMax ActiveDurabilityPercentMinMax { get; set; }
-}
\ No newline at end of file
+}
diff --git a/Core/Models/Spt/Config/SeasonalEventConfig.cs b/Core/Models/Spt/Config/SeasonalEventConfig.cs
index 81eb8aa7..8a117b3e 100644
--- a/Core/Models/Spt/Config/SeasonalEventConfig.cs
+++ b/Core/Models/Spt/Config/SeasonalEventConfig.cs
@@ -1,6 +1,7 @@
using System.Text.Json.Serialization;
using Core.Models.Eft.Common;
using Core.Models.Enums;
+using Core.Utils.Json.Converters;
namespace Core.Models.Spt.Config;
@@ -20,6 +21,7 @@ public class SeasonalEventConfig : BaseConfig
[JsonPropertyName("eventLoot")]
public Dictionary>>> EventLoot { get; set; }
+ [JsonPropertyName("events")]
public List Events { get; set; }
[JsonPropertyName("eventBotMapping")]
@@ -59,19 +61,26 @@ public class SeasonalEvent
public SeasonalEventType Type { get; set; }
[JsonPropertyName("startDay")]
+ [JsonConverter(typeof(StringToNumberFactoryConverter))]
public int StartDay { get; set; }
[JsonPropertyName("startMonth")]
+ [JsonConverter(typeof(StringToNumberFactoryConverter))]
public int StartMonth { get; set; }
[JsonPropertyName("endDay")]
+ [JsonConverter(typeof(StringToNumberFactoryConverter))]
public int EndDay { get; set; }
[JsonPropertyName("endMonth")]
+ [JsonConverter(typeof(StringToNumberFactoryConverter))]
public int EndMonth { get; set; }
[JsonPropertyName("settings")]
public Dictionary Settings { get; set; } // TODO: Type was Record
+
+ [JsonPropertyName("setting")]
+ public Dictionary SettingsDoNOTUse { set => Settings = value; }
}
public class SeasonalEventSettings
@@ -102,4 +111,4 @@ public class GifterSetting
[JsonPropertyName("spawnChance")]
public int SpawnChance { get; set; }
-}
\ No newline at end of file
+}
diff --git a/Core/Models/Spt/Config/TraderConfig.cs b/Core/Models/Spt/Config/TraderConfig.cs
index f565ee92..74d834a2 100644
--- a/Core/Models/Spt/Config/TraderConfig.cs
+++ b/Core/Models/Spt/Config/TraderConfig.cs
@@ -34,6 +34,9 @@ public class TraderConfig : BaseConfig
public class UpdateTime
{
+ [JsonPropertyName("_name")]
+ public string Name { get; set; }
+
[JsonPropertyName("traderId")]
public string TraderId { get; set; }
@@ -139,6 +142,9 @@ public class CoopExtractReward : LootRequest
{
[JsonPropertyName("sendGift")]
public bool SendGift { get; set; }
+
+ [JsonPropertyName("useRewarditemBlacklist")]
+ public bool UseRewarditemBlacklist { get; set; }
[JsonPropertyName("messageLocaleIds")]
public List MessageLocaleIds { get; set; }
@@ -171,4 +177,4 @@ public class ModdedTraders
/** Trader Ids to enable the clothing service for */
[JsonPropertyName("clothingService")]
public List ClothingService { get; set; }
-}
\ No newline at end of file
+}
diff --git a/Core/Models/Spt/Dialog/SendMessageDetails.cs b/Core/Models/Spt/Dialog/SendMessageDetails.cs
index ec0c2ed1..d8e2ebc3 100644
--- a/Core/Models/Spt/Dialog/SendMessageDetails.cs
+++ b/Core/Models/Spt/Dialog/SendMessageDetails.cs
@@ -93,6 +93,9 @@ public class ProfileChangeEvent
[JsonPropertyName("entity")]
public string? Entity { get; set; }
+
+ [JsonPropertyName("data")]
+ public string? Data { get; set; }
}
public enum ProfileChangeEventType
@@ -105,4 +108,4 @@ public enum ProfileChangeEventType
UnlockTrader,
AssortmentUnlockRule,
HideoutAreaLevel
-}
\ No newline at end of file
+}
diff --git a/Core/Routers/Dynamic/HttpDynamicRouter.cs b/Core/Routers/Dynamic/HttpDynamicRouter.cs
index a97bc98e..9c659fdc 100644
--- a/Core/Routers/Dynamic/HttpDynamicRouter.cs
+++ b/Core/Routers/Dynamic/HttpDynamicRouter.cs
@@ -1,12 +1,14 @@
using Core.Annotations;
using Core.DI;
+using Core.Utils;
namespace Core.Routers.Dynamic;
[Injectable(InjectableTypeOverride = typeof(DynamicRouter))]
public class HttpDynamicRouter : DynamicRouter
{
- public HttpDynamicRouter(ImageRouter imageRouter) : base(
+ public HttpDynamicRouter(ImageRouter imageRouter, JsonUtil jsonUtil) : base(
+ jsonUtil,
[
new(".jpg", (_, _, _, _) => imageRouter.GetImage()),
new(".png", (_, _, _, _) => imageRouter.GetImage()),
@@ -15,9 +17,4 @@ public class HttpDynamicRouter : DynamicRouter
)
{
}
-
- public override Type? GetBodyDeserializationType()
- {
- return null;
- }
}
diff --git a/Core/Routers/HttpRouter.cs b/Core/Routers/HttpRouter.cs
index b66d8103..a05ef642 100644
--- a/Core/Routers/HttpRouter.cs
+++ b/Core/Routers/HttpRouter.cs
@@ -73,13 +73,10 @@ public class HttpRouter
foreach (var route in routers)
{
if (route.CanHandle(url, dynamic)) {
- var type = route.GetBodyDeserializationType();
- if (type != null && !string.IsNullOrEmpty(body))
- deserializedObject = JsonSerializer.Deserialize(body, type);
if (dynamic) {
- wrapper.Output = (route as DynamicRouter).HandleDynamic(url, deserializedObject, sessionID, wrapper.Output) as string;
+ wrapper.Output = (route as DynamicRouter).HandleDynamic(url, body, sessionID, wrapper.Output) as string;
} else {
- wrapper.Output = (route as StaticRouter).HandleStatic(url, deserializedObject, sessionID, wrapper.Output) as string;
+ wrapper.Output = (route as StaticRouter).HandleStatic(url, body, sessionID, wrapper.Output) as string;
}
matched = true;
}
diff --git a/Core/Routers/Static/LauncherStaticRouter.cs b/Core/Routers/Static/LauncherStaticRouter.cs
index 97d1528f..1aa5ae37 100644
--- a/Core/Routers/Static/LauncherStaticRouter.cs
+++ b/Core/Routers/Static/LauncherStaticRouter.cs
@@ -2,59 +2,68 @@ using Core.Annotations;
using Core.Callbacks;
using Core.DI;
using Core.Models.Eft.Common;
+using Core.Models.Eft.Launcher;
+using Core.Utils;
namespace Core.Routers.Static;
[Injectable(InjectableTypeOverride = typeof(StaticRouter))]
-public class LauncherStaticRouter : StaticRouter {
-
- public LauncherStaticRouter(LauncherCallbacks launcherCallbacks) : base([
- new RouteAction(
- "/launcher/ping",
- (url, _, sessionID, _) => launcherCallbacks.Ping(url, null, sessionID)),
- new RouteAction(
- "/launcher/server/connect",
- (_, _, _, _) => launcherCallbacks.Connect()),
- new RouteAction(
- "/launcher/profile/login",
- (url, info, sessionID, _) => launcherCallbacks.Login(url, info, sessionID)),
- new RouteAction(
- "/launcher/profile/register",
- (url, info, sessionID, _) => launcherCallbacks.Register(url, info, sessionID)),
- new RouteAction(
- "/launcher/profile/get",
- (url, info, sessionID, _) => launcherCallbacks.Get(url, info, sessionID)),
- new RouteAction(
- "/launcher/profile/change/username",
- (url, info, sessionID, _) => launcherCallbacks.ChangeUsername(url, info, sessionID)),
- new RouteAction(
- "/launcher/profile/change/password",
- (url, info, sessionID, _) => launcherCallbacks.ChangePassword(url, info, sessionID)),
- new RouteAction(
- "/launcher/profile/change/wipe",
- (url, info, sessionID, _) => launcherCallbacks.Wipe(url, info, sessionID)),
- new RouteAction(
- "/launcher/profile/remove",
- (url, info, sessionID, _) => launcherCallbacks.RemoveProfile(url, info, sessionID)),
- new RouteAction(
- "/launcher/profile/compatibleTarkovVersion",
- (_, _, _, _) => launcherCallbacks.GetCompatibleTarkovVersion()),
- new RouteAction(
- "/launcher/server/version",
- (_, _, _, _) => launcherCallbacks.GetServerVersion()),
- new RouteAction(
- "/launcher/server/loadedServerMods",
- (_, _, _, _) => launcherCallbacks.GetLoadedServerMods()),
- new RouteAction(
- "/launcher/server/serverModsUsedByProfile",
- (url, info, sessionID, _) => launcherCallbacks.GetServerModsProfileUsed(url, info, sessionID)),
- ])
+public class LauncherStaticRouter : StaticRouter
+{
+ public LauncherStaticRouter(LauncherCallbacks launcherCallbacks, JsonUtil jsonUtil) : base(
+ jsonUtil,
+ [
+ new RouteAction(
+ "/launcher/ping",
+ (url, _, sessionID, _) => launcherCallbacks.Ping(url, null, sessionID)),
+ new RouteAction(
+ "/launcher/server/connect",
+ (_, _, _, _) => launcherCallbacks.Connect()),
+ new RouteAction(
+ "/launcher/profile/login",
+ (url, info, sessionID, _) => launcherCallbacks.Login(url, info as LoginRequestData, sessionID),
+ typeof(LoginRequestData)),
+ new RouteAction(
+ "/launcher/profile/register",
+ (url, info, sessionID, _) => launcherCallbacks.Register(url, info as RegisterData, sessionID),
+ typeof(RegisterData)),
+ new RouteAction(
+ "/launcher/profile/get",
+ (url, info, sessionID, _) => launcherCallbacks.Get(url, info as LoginRequestData, sessionID),
+ typeof(LoginRequestData)),
+ new RouteAction(
+ "/launcher/profile/change/username",
+ (url, info, sessionID, _) =>
+ launcherCallbacks.ChangeUsername(url, info as ChangeRequestData, sessionID),
+ typeof(ChangeRequestData)),
+ new RouteAction(
+ "/launcher/profile/change/password",
+ (url, info, sessionID, _) =>
+ launcherCallbacks.ChangePassword(url, info as ChangeRequestData, sessionID),
+ typeof(ChangeRequestData)),
+ new RouteAction(
+ "/launcher/profile/change/wipe",
+ (url, info, sessionID, _) => launcherCallbacks.Wipe(url, info as RegisterData, sessionID),
+ typeof(RegisterData)),
+ new RouteAction(
+ "/launcher/profile/remove",
+ (url, info, sessionID, _) => launcherCallbacks.RemoveProfile(url, info as RemoveProfileData, sessionID),
+ typeof(RemoveProfileData)),
+ new RouteAction(
+ "/launcher/profile/compatibleTarkovVersion",
+ (_, _, _, _) => launcherCallbacks.GetCompatibleTarkovVersion()),
+ new RouteAction(
+ "/launcher/server/version",
+ (_, _, _, _) => launcherCallbacks.GetServerVersion()),
+ new RouteAction(
+ "/launcher/server/loadedServerMods",
+ (_, _, _, _) => launcherCallbacks.GetLoadedServerMods()),
+ new RouteAction(
+ "/launcher/server/serverModsUsedByProfile",
+ (url, info, sessionID, _) =>
+ launcherCallbacks.GetServerModsProfileUsed(url, info as EmptyRequestData, sessionID),
+ typeof(EmptyRequestData))
+ ])
{
}
-
- public override Type? GetBodyDeserializationType()
- {
- throw new NotImplementedException();
- }
-}
}
diff --git a/Core/Servers/ConfigServer.cs b/Core/Servers/ConfigServer.cs
index 92c8d4bd..1231bc25 100644
--- a/Core/Servers/ConfigServer.cs
+++ b/Core/Servers/ConfigServer.cs
@@ -4,6 +4,7 @@ using System.Text.Json.Serialization;
using Core.Annotations;
using Core.Models.Enums;
using Core.Models.Spt.Config;
+using Core.Utils;
using ILogger = Core.Models.Utils.ILogger;
namespace Core.Servers;
@@ -11,16 +12,18 @@ namespace Core.Servers;
[Injectable(InjectionType.Singleton)]
public class ConfigServer
{
- private ILogger _logger;
+ protected ILogger _logger;
+ protected JsonUtil _jsonUtil;
protected Dictionary configs = new();
protected readonly string[] acceptableFileExtensions = [".json", ".jsonc"];
public ConfigServer(
- ILogger logger
- // TODO: We need JsonUtil here => JsonUtil jsonUtil,
+ ILogger logger,
+ JsonUtil jsonUtil
)
{
_logger = logger;
+ _jsonUtil = jsonUtil;
Initialize();
}
@@ -50,8 +53,7 @@ public class ConfigServer
{
var fileContent = File.ReadAllText(file);
var type = GetConfigTypeByFilename(file);
- var deserializedContent =
- JsonSerializer.Deserialize(fileContent, type, new JsonSerializerOptions() { Converters = { new JsonStringEnumConverter() } });
+ var deserializedContent = _jsonUtil.Deserialize(fileContent, type);
if (deserializedContent == null)
{
@@ -78,4 +80,4 @@ public class ConfigServer
.First(en => en.GetValue().Contains(Path.GetFileNameWithoutExtension(filename)));
return type.GetConfigType();
}
-}
\ No newline at end of file
+}
diff --git a/Core/Servers/Http/SptHttpListener.cs b/Core/Servers/Http/SptHttpListener.cs
index b54f144c..434cfa1d 100644
--- a/Core/Servers/Http/SptHttpListener.cs
+++ b/Core/Servers/Http/SptHttpListener.cs
@@ -19,12 +19,13 @@ public class SptHttpListener : IHttpListener
protected readonly ILogger _logger;
protected readonly HttpResponseUtil _httpResponseUtil;
protected readonly LocalisationService _localisationService;
+ protected readonly JsonUtil _jsonUtil;
public SptHttpListener(
HttpRouter httpRouter, // TODO: delay required
IEnumerable serializers,
ILogger logger,
// TODO: requestsLogger: ILogger,
- // TODO: JsonUtil jsonUtil,
+ JsonUtil jsonUtil,
HttpResponseUtil httpHttpResponseUtil,
LocalisationService localisationService
)
@@ -34,6 +35,7 @@ public class SptHttpListener : IHttpListener
_logger = logger;
_httpResponseUtil = httpHttpResponseUtil;
_localisationService = localisationService;
+ _jsonUtil = jsonUtil;
}
private static readonly ImmutableHashSet SupportedMethods = ["GET", "PUT", "POST"];
@@ -98,8 +100,8 @@ public class SptHttpListener : IHttpListener
)
{
if (body == null)
- body = "{}";
- var bodyInfo = JsonSerializer.Serialize(body);
+ body = new object();
+ var bodyInfo = _jsonUtil.Serialize(body);
if (IsDebugRequest(req)) {
// Send only raw response without transformation
@@ -160,7 +162,7 @@ public class SptHttpListener : IHttpListener
/* route doesn't exist or response is not properly set up */
if (string.IsNullOrEmpty(output)) {
_logger.Error(_localisationService.GetText("unhandled_response", req.Path));
- _logger.Info(JsonSerializer.Serialize(deserializedObject));
+ _logger.Info(_jsonUtil.Serialize(deserializedObject));
output = _httpResponseUtil.GetBody