0
0
mirror of https://github.com/sp-tarkov/loot-dump-processor.git synced 2025-02-13 06:30:44 -05:00

Refactored model classes to use records and improved immutability

This commit is contained in:
bluextx 2025-01-11 12:15:01 +03:00
parent 9e9933bd32
commit 12746997e7
44 changed files with 263 additions and 652 deletions

View File

@ -3,12 +3,4 @@ using System.Text.Json.Serialization;
namespace LootDumpProcessor.Model; namespace LootDumpProcessor.Model;
public class FireMode : ICloneable public readonly record struct FireMode([property: JsonPropertyName("FireMode")] string FireModeType);
{
[JsonPropertyName("FireMode")] public string? FireModeType { get; set; }
public object Clone() => new FireMode
{
FireModeType = FireModeType
};
}

View File

@ -1,11 +1,3 @@
namespace LootDumpProcessor.Model; namespace LootDumpProcessor.Model;
public class Foldable : ICloneable public readonly record struct Foldable(bool Folded);
{
public bool? Folded { get; set; }
public object Clone() => new Foldable
{
Folded = Folded
};
}

View File

@ -1,26 +1,17 @@
using LootDumpProcessor.Utils;
namespace LootDumpProcessor.Model; namespace LootDumpProcessor.Model;
public class GroupPosition : ICloneable public class GroupPosition : ICloneable
{ {
public string? Name { get; set; } public string Name { get; set; }
public int Weight { get; set; }
public Vector3 Position { get; set; }
public int? Weight { get; set; } public Vector3 Rotation { get; set; }
public Vector3? Position { get; set; }
public Vector3? Rotation { get; set; }
public object Clone() => new GroupPosition public object Clone() => new GroupPosition
{ {
Name = Name, Name = Name,
Weight = Weight, Weight = Weight,
Position = ProcessorUtil.Copy(Position), Position = Position,
Rotation = ProcessorUtil.Copy(Rotation) Rotation = Rotation
}; };
} }

View File

@ -1,16 +1,15 @@
namespace LootDumpProcessor.Model.Input; namespace LootDumpProcessor.Model.Input;
public class AdditionalHostilitySetting public readonly record struct AdditionalHostilitySetting(
{ string BotRole,
public string? BotRole { get; set; } IReadOnlyList<string> AlwaysEnemies,
public List<string>? AlwaysEnemies { get; set; } IReadOnlyList<ChancedEnemy> ChancedEnemies,
public List<ChancedEnemy>? ChancedEnemies { get; set; } IReadOnlyList<string> Warn,
public List<string>? Warn { get; set; } IReadOnlyList<string> Neutral,
public List<string>? Neutral { get; set; } IReadOnlyList<string> AlwaysFriends,
public List<string>? AlwaysFriends { get; set; } string SavagePlayerBehaviour,
public string? SavagePlayerBehaviour { get; set; } string BearPlayerBehaviour,
public string? BearPlayerBehaviour { get; set; } int BearEnemyChance,
public int? BearEnemyChance { get; set; } string UsecPlayerBehaviour,
public string? UsecPlayerBehaviour { get; set; } int UsecEnemyChance
public int? UsecEnemyChance { get; set; } );
}

View File

@ -1,15 +1,14 @@
namespace LootDumpProcessor.Model.Input; namespace LootDumpProcessor.Model.Input;
public class AirdropParameter public readonly record struct AirdropParameter(
{ int PlaneAirdropStartMin,
public int? PlaneAirdropStartMin { get; set; } int PlaneAirdropStartMax,
public int? PlaneAirdropStartMax { get; set; } int PlaneAirdropEnd,
public int? PlaneAirdropEnd { get; set; } float PlaneAirdropChance,
public float? PlaneAirdropChance { get; set; } int PlaneAirdropMax,
public int? PlaneAirdropMax { get; set; } int PlaneAirdropCooldownMin,
public int? PlaneAirdropCooldownMin { get; set; } int PlaneAirdropCooldownMax,
public int? PlaneAirdropCooldownMax { get; set; } int AirdropPointDeactivateDistance,
public int? AirdropPointDeactivateDistance { get; set; } int MinPlayersCountToSpawnAirdrop,
public int? MinPlayersCountToSpawnAirdrop { get; set; } int UnsuccessfulTryPenalty
public int? UnsuccessfulTryPenalty { get; set; } );
}

View File

@ -1,20 +1,19 @@
namespace LootDumpProcessor.Model.Input; namespace LootDumpProcessor.Model.Input;
public class BTRServerSettings public readonly record struct BTRServerSettings(
{ float ChanceSpawn,
public float? ChanceSpawn { get; set; } Vector3 SpawnPeriod,
public Vector3? SpawnPeriod { get; set; } float MoveSpeed,
public float? MoveSpeed { get; set; } float ReadyToDepartureTime,
public float? ReadyToDepartureTime { get; set; } float CheckTurnDistanceTime,
public float? CheckTurnDistanceTime { get; set; } float TurnCheckSensitivity,
public float? TurnCheckSensitivity { get; set; } float DecreaseSpeedOnTurnLimit,
public float? DecreaseSpeedOnTurnLimit { get; set; } float EndSplineDecelerationDistance,
public float? EndSplineDecelerationDistance { get; set; } float AccelerationSpeed,
public float? AccelerationSpeed { get; set; } float DecelerationSpeed,
public float? DecelerationSpeed { get; set; } Vector3 PauseDurationRange,
public Vector3? PauseDurationRange { get; set; } float BodySwingReturnSpeed,
public float? BodySwingReturnSpeed { get; set; } float BodySwingDamping,
public float? BodySwingDamping { get; set; } float BodySwingIntensity,
public float? BodySwingIntensity { get; set; } ServerMapBTRSettings ServerMapBTRSettings
public ServerMapBTRSettings? ServerMapBTRSettings { get; set; } );
}

View File

@ -1,7 +1,6 @@
namespace LootDumpProcessor.Model.Input; namespace LootDumpProcessor.Model.Input;
public class Banner public readonly record struct Banner(
{ string Id,
public string? Id { get; set; } Pic Pic
public Pic? Pic { get; set; } );
}

View File

@ -1,19 +1,18 @@
namespace LootDumpProcessor.Model.Input; namespace LootDumpProcessor.Model.Input;
public class BotLocationModifier public readonly record struct BotLocationModifier(
{ float AccuracySpeed,
public float? AccuracySpeed { get; set; } float Scattering,
public float? Scattering { get; set; } float GainSight,
public float? GainSight { get; set; } float MarksmanAccuratyCoef,
public float? MarksmanAccuratyCoef { get; set; } float VisibleDistance,
public float? VisibleDistance { get; set; } float DistToPersueAxemanCoef,
public float? DistToPersueAxemanCoef { get; set; } int KhorovodChance,
public int? KhorovodChance { get; set; } float MinExfiltrationTime,
public float? MinExfiltrationTime { get; set; } float MaxExfiltrationTime,
public float? MaxExfiltrationTime { get; set; } float DistToActivatePvE,
public float? DistToActivatePvE { get; set; } float DistToSleepPvE,
public float? DistToSleepPvE { get; set; } float DistToActivate,
public float? DistToActivate { get; set; } float DistToSleep,
public float? DistToSleep { get; set; } IReadOnlyList<AdditionalHostilitySetting> AdditionalHostilitySettings
public List<AdditionalHostilitySetting>? AdditionalHostilitySettings { get; set; } );
}

View File

@ -1,7 +1,6 @@
namespace LootDumpProcessor.Model.Input; namespace LootDumpProcessor.Model.Input;
public class ChancedEnemy public readonly record struct ChancedEnemy(
{ int EnemyChance,
public int? EnemyChance { get; set; } string Role
public string? Role { get; set; } );
}

View File

@ -1,7 +1,6 @@
namespace LootDumpProcessor.Model.Input; namespace LootDumpProcessor.Model.Input;
public class ColliderParams public readonly record struct ColliderParams(
{ string Parent,
public string? Parent { get; set; } Props Props
public Props? Props { get; set; } );
}

View File

@ -1,6 +1,3 @@
namespace LootDumpProcessor.Model.Input; namespace LootDumpProcessor.Model.Input;
public class CompletedQuest public readonly record struct CompletedQuest(string QuestId);
{
public string? QuestID { get; set; }
}

View File

@ -1,9 +1,8 @@
namespace LootDumpProcessor.Model.Input; namespace LootDumpProcessor.Model.Input;
public class Data public readonly record struct Data(
{ string ServerId,
public string? ServerID { get; set; } ServerSettings ServerSettings,
public ServerSettings? ServerSettings { get; set; } object Profile,
public object? Profile { get; set; } LocationLoot LocationLoot
public required LocationLoot LocationLoot { get; set; } );
}

View File

@ -1,25 +1,24 @@
namespace LootDumpProcessor.Model.Input; namespace LootDumpProcessor.Model.Input;
public class Exit public readonly record struct Exit(
{ string Name,
public string? Name { get; set; } string EntryPoints,
public string? EntryPoints { get; set; } float Chance,
public float? Chance { get; set; } int MinTime,
public int? MinTime { get; set; } int MaxTime,
public int? MaxTime { get; set; } int PlayersCount,
public int? PlayersCount { get; set; } float ExfiltrationTime,
public float? ExfiltrationTime { get; set; } string PassageRequirement,
public string? PassageRequirement { get; set; } string ExfiltrationType,
public string? ExfiltrationType { get; set; } string RequiredSlot,
public string? RequiredSlot { get; set; } string Id,
public string? Id { get; set; } string RequirementTip,
public string? RequirementTip { get; set; } int Count,
public int? Count { get; set; } bool EventAvailable,
public bool? EventAvailable { get; set; } int MinTimePve,
public int? MinTimePVE { get; set; } int MaxTimePve,
public int? MaxTimePVE { get; set; } float ChancePve,
public float? ChancePVE { get; set; } int CountPve,
public int? CountPVE { get; set; } float ExfiltrationTimePve,
public float? ExfiltrationTimePVE { get; set; } int PlayersCountPve
public int? PlayersCountPVE { get; set; } );
}

View File

@ -1,6 +1,3 @@
namespace LootDumpProcessor.Model.Input; namespace LootDumpProcessor.Model.Input;
public class ItemCost public readonly record struct ItemCost(int Count);
{
public int? Count { get; set; }
}

View File

@ -1,193 +1,100 @@
using System.Text.Json.Serialization; using System.Text.Json.Serialization;
namespace LootDumpProcessor.Model.Input; namespace LootDumpProcessor.Model.Input;
public class LocationLoot public record LocationLoot(
{ bool Enabled,
public bool? Enabled { get; set; } bool EnableCoop,
public bool? EnableCoop { get; set; } bool ForceOnlineRaidInPve,
public bool? ForceOnlineRaidInPVE { get; set; } bool Locked,
public bool? Locked { get; set; } bool Insurance,
public bool? Insurance { get; set; } bool SafeLocation,
public bool? SafeLocation { get; set; } string Name,
public string? Name { get; set; } string Description,
public string? Description { get; set; } Scene Scene,
public Scene? Scene { get; set; } float Area,
public float? Area { get; set; } int RequiredPlayerLevelMin,
public int? RequiredPlayerLevelMin { get; set; } int RequiredPlayerLevelMax,
public int? RequiredPlayerLevelMax { get; set; } int PmcMaxPlayersInGroup,
public int? PmcMaxPlayersInGroup { get; set; } int ScavMaxPlayersInGroup,
public int? ScavMaxPlayersInGroup { get; set; } int MinPlayers,
public int? MinPlayers { get; set; } int MaxPlayers,
public int? MaxPlayers { get; set; } int MaxCoopGroup,
public int? MaxCoopGroup { get; set; } int ExitCount,
public int? ExitCount { get; set; } int ExitAccessTime,
public int? ExitAccessTime { get; set; } int ExitTime,
public int? ExitTime { get; set; } Preview Preview,
public Preview? Preview { get; set; } int IconX,
public int? IconX { get; set; } int IconY,
public int? IconY { get; set; } IReadOnlyList<object> FilterEx,
public List<object>? FilterEx { get; set; } IReadOnlyList<object> Waves,
public List<object>? Waves { get; set; } IReadOnlyList<object> Limits,
public List<object>? Limits { get; set; } int AveragePlayTime,
public int? AveragePlayTime { get; set; } int AveragePlayerLevel,
public int? AveragePlayerLevel { get; set; } int EscapeTimeLimit,
public int? EscapeTimeLimit { get; set; } int EscapeTimeLimitPve,
public int? EscapeTimeLimitPVE { get; set; } int EscapeTimeLimitCoop,
public int? EscapeTimeLimitCoop { get; set; } string Rules,
public string? Rules { get; set; } bool IsSecret,
public bool? IsSecret { get; set; } IReadOnlyList<object> Doors,
public List<object>? Doors { get; set; } [property: JsonPropertyName("tmp_location_field_remove_me")] int TmpLocationFieldRemoveMe,
[JsonPropertyName("tmp_location_field_remove_me")] public int? TmpLocationFieldRemoveMe { get; set; } int MinDistToExitPoint,
public int? MinDistToExitPoint { get; set; } int MaxDistToFreePoint,
public int? MaxDistToFreePoint { get; set; } int MinDistToFreePoint,
public int? MinDistToFreePoint { get; set; } int MaxBotPerZone,
public int? MaxBotPerZone { get; set; } string OpenZones,
public string? OpenZones { get; set; } bool OcculsionCullingEnabled,
public bool? OcculsionCullingEnabled { get; set; } float GlobalLootChanceModifier,
public float? GlobalLootChanceModifier { get; set; } float GlobalLootChanceModifierPvE,
public float? GlobalLootChanceModifierPvE { get; set; } bool OldSpawn,
public bool? OldSpawn { get; set; } bool OfflineOldSpawn,
public bool? OfflineOldSpawn { get; set; } bool NewSpawn,
public bool? NewSpawn { get; set; } bool OfflineNewSpawn,
public bool? OfflineNewSpawn { get; set; } int BotMax,
public int? BotMax { get; set; } int BotMaxPvE,
int BotStart,
int BotStartPlayer,
public int? BotMaxPvE { get; set; } int BotStop,
int BotMaxTimePlayer,
int BotSpawnTimeOnMin,
public int? BotStart { get; set; } int BotSpawnTimeOnMax,
int BotSpawnTimeOffMin,
int BotSpawnTimeOffMax,
public int? BotStartPlayer { get; set; } int BotMaxPlayer,
int BotEasy,
int BotNormal,
public int? BotStop { get; set; } int BotHard,
int BotImpossible,
int BotAssault,
public int? BotMaxTimePlayer { get; set; } int BotMarksman,
string DisabledScavExits,
int MinPlayerLvlAccessKeys,
public int? BotSpawnTimeOnMin { get; set; } IReadOnlyList<object> AccessKeys,
int UnixDateTime,
[property: JsonPropertyName("users_gather_seconds")] int UsersGatherSeconds,
public int? BotSpawnTimeOnMax { get; set; } [property: JsonPropertyName("users_spawn_seconds_n")] int UsersSpawnSecondsN,
[property: JsonPropertyName("users_spawn_seconds_n2")] int UsersSpawnSecondsN2,
[property: JsonPropertyName("users_summon_seconds")] int UsersSummonSeconds,
public int? BotSpawnTimeOffMin { get; set; } [property: JsonPropertyName("sav_summon_seconds")] int SavSummonSeconds,
[property: JsonPropertyName("matching_min_seconds")] int MatchingMinSeconds,
bool GenerateLocalLootCache,
public int? BotSpawnTimeOffMax { get; set; } int PlayersRequestCount,
NonWaveGroupScenario NonWaveGroupScenario,
int BotSpawnCountStep,
public int? BotMaxPlayer { get; set; } int BotSpawnPeriodCheck,
float GlobalContainerChanceModifier,
IReadOnlyList<object> MinMaxBots,
public int? BotEasy { get; set; } BotLocationModifier BotLocationModifier,
IReadOnlyList<Exit> Exits,
bool DisabledForScav,
public int? BotNormal { get; set; } IReadOnlyList<object> BossLocationSpawn,
IReadOnlyList<SpawnPointParam> SpawnPointParams,
IReadOnlyList<object> MaxItemCountInLocation,
public int? BotHard { get; set; } IReadOnlyList<AirdropParameter> AirdropParameters,
IReadOnlyList<MatchMakerMinPlayersByWaitTime> MatchMakerMinPlayersByWaitTime,
IReadOnlyList<Transit> Transits,
public int? BotImpossible { get; set; } string Id,
[property: JsonPropertyName("_Id")] string Id0,
IReadOnlyList<Template> Loot,
public int? BotAssault { get; set; } IReadOnlyList<Banner> Banners
);
public int? BotMarksman { get; set; }
public string? DisabledScavExits { get; set; }
public int? MinPlayerLvlAccessKeys { get; set; }
public List<object>? AccessKeys { get; set; }
public int? UnixDateTime { get; set; }
[JsonPropertyName("users_gather_seconds")] public int? UsersGatherSeconds { get; set; }
[JsonPropertyName("users_spawn_seconds_n")] public int? UsersSpawnSecondsN { get; set; }
[JsonPropertyName("users_spawn_seconds_n2")] public int? UsersSpawnSecondsN2 { get; set; }
[JsonPropertyName("users_summon_seconds")] public int? UsersSummonSeconds { get; set; }
[JsonPropertyName("sav_summon_seconds")] public int? SavSummonSeconds { get; set; }
[JsonPropertyName("matching_min_seconds")] public int? MatchingMinSeconds { get; set; }
public bool? GenerateLocalLootCache { get; set; }
public int? PlayersRequestCount { get; set; }
public NonWaveGroupScenario? NonWaveGroupScenario { get; set; }
public int? BotSpawnCountStep { get; set; }
public int? BotSpawnPeriodCheck { get; set; }
public float? GlobalContainerChanceModifier { get; set; }
public List<object>? MinMaxBots { get; set; }
public BotLocationModifier? BotLocationModifier { get; set; }
public List<Exit>? Exits { get; set; }
public bool? DisabledForScav { get; set; }
public List<object>? BossLocationSpawn { get; set; }
public List<SpawnPointParam>? SpawnPointParams { get; set; }
public List<object>? MaxItemCountInLocation { get; set; }
public List<AirdropParameter>? AirdropParameters { get; set; }
public List<MatchMakerMinPlayersByWaitTime>? MatchMakerMinPlayersByWaitTime { get; set; }
public List<Transit>? Transits { get; set; }
public required string Id { get; set; }
[JsonPropertyName("_Id")] public string? Id0 { get; set; }
public required List<Template> Loot { get; set; }
public List<Banner>? Banners { get; set; }
}

View File

@ -1,48 +1,8 @@
namespace LootDumpProcessor.Model.Input; namespace LootDumpProcessor.Model.Input;
public class MapSettings public readonly record struct MapSettings(
{ string MapId, float ChanceSpawn, Vector3 SpawnPeriod, float MoveSpeed, float ReadyToDepartureTime,
public string? MapID { get; set; } float CheckTurnDistanceTime, float TurnCheckSensitivity, float DecreaseSpeedOnTurnLimit,
float EndSplineDecelerationDistance, float AccelerationSpeed, float DecelerationSpeed, Vector3 PauseDurationRange,
float BodySwingReturnSpeed, float BodySwingDamping, float BodySwingIntensity
public float? ChanceSpawn { get; set; } );
public Vector3? SpawnPeriod { get; set; }
public float? MoveSpeed { get; set; }
public float? ReadyToDepartureTime { get; set; }
public float? CheckTurnDistanceTime { get; set; }
public float? TurnCheckSensitivity { get; set; }
public float? DecreaseSpeedOnTurnLimit { get; set; }
public float? EndSplineDecelerationDistance { get; set; }
public float? AccelerationSpeed { get; set; }
public float? DecelerationSpeed { get; set; }
public Vector3? PauseDurationRange { get; set; }
public float? BodySwingReturnSpeed { get; set; }
public float? BodySwingDamping { get; set; }
public float? BodySwingIntensity { get; set; }
}

View File

@ -1,9 +1,3 @@
namespace LootDumpProcessor.Model.Input; namespace LootDumpProcessor.Model.Input;
public class MatchMakerMinPlayersByWaitTime public readonly record struct MatchMakerMinPlayersByWaitTime(int Time, int MinPlayers);
{
public int? Time { get; set; }
public int? MinPlayers { get; set; }
}

View File

@ -1,15 +1,3 @@
namespace LootDumpProcessor.Model.Input; namespace LootDumpProcessor.Model.Input;
public class NonWaveGroupScenario public readonly record struct NonWaveGroupScenario(int MinToBeGroup, int MaxToBeGroup, float Chance, bool Enabled);
{
public int? MinToBeGroup { get; set; }
public int? MaxToBeGroup { get; set; }
public float? Chance { get; set; }
public bool? Enabled { get; set; }
}

View File

@ -1,9 +1,3 @@
namespace LootDumpProcessor.Model.Input; namespace LootDumpProcessor.Model.Input;
public class Pic public readonly record struct Pic(string? Path, string? Rcid);
{
public string? Path { get; set; }
public string? Rcid { get; set; }
}

View File

@ -1,9 +1,3 @@
namespace LootDumpProcessor.Model.Input; namespace LootDumpProcessor.Model.Input;
public class Preview public readonly record struct Preview(string? Path, string? Rcid);
{
public string? Path { get; set; }
public string? Rcid { get; set; }
}

View File

@ -1,9 +1,3 @@
namespace LootDumpProcessor.Model.Input; namespace LootDumpProcessor.Model.Input;
public class Props public readonly record struct Props(Vector3 Center, float Radius);
{
public Vector3? Center { get; set; }
public float? Radius { get; set; }
}

View File

@ -1,9 +1,3 @@
namespace LootDumpProcessor.Model.Input; namespace LootDumpProcessor.Model.Input;
public class Requirements public readonly record struct Requirements(IReadOnlyList<CompletedQuest> CompletedQuests, object Standings);
{
public List<CompletedQuest>? CompletedQuests { get; set; }
public object? Standings { get; set; }
}

View File

@ -1,12 +1,3 @@
namespace LootDumpProcessor.Model.Input; namespace LootDumpProcessor.Model.Input;
public class RootData public record RootData(int Err, Data Data, object Errmsg);
{
public int? Err { get; set; }
public required Data Data { get; set; }
public object? Errmsg { get; set; }
}

View File

@ -1,9 +1,3 @@
namespace LootDumpProcessor.Model.Input; namespace LootDumpProcessor.Model.Input;
public class Scene public readonly record struct Scene(string Path, string Rcid);
{
public string? Path { get; set; }
public string? Rcid { get; set; }
}

View File

@ -1,12 +1,3 @@
namespace LootDumpProcessor.Model.Input; namespace LootDumpProcessor.Model.Input;
public class ServerMapBTRSettings public readonly record struct ServerMapBTRSettings(MapSettings Develop, MapSettings TarkovStreets, MapSettings Woods);
{
public MapSettings? Develop { get; set; }
public MapSettings? TarkovStreets { get; set; }
public MapSettings? Woods { get; set; }
}

View File

@ -1,9 +1,5 @@
namespace LootDumpProcessor.Model.Input; namespace LootDumpProcessor.Model.Input;
public class ServerSettings public readonly record struct ServerSettings(
{ TraderServerSettings TraderServerSettings, BTRServerSettings BtrServerSettings
public TraderServerSettings? TraderServerSettings { get; set; } );
public BTRServerSettings? BTRServerSettings { get; set; }
}

View File

@ -1,6 +1,3 @@
namespace LootDumpProcessor.Model.Input; namespace LootDumpProcessor.Model.Input;
public class ServiceItemCost public readonly record struct ServiceItemCost(IReadOnlyDictionary<string, ItemCost> Costs);
{
public Dictionary<string, ItemCost>? Costs { get; set; }
}

View File

@ -1,33 +1,7 @@
namespace LootDumpProcessor.Model.Input; namespace LootDumpProcessor.Model.Input;
public class SpawnPointParam public readonly record struct SpawnPointParam(
{ string Id, Vector3 Position, float Rotation, IReadOnlyList<string> Sides, IReadOnlyList<string> Categories,
public string? Id { get; set; } string Infiltration,
float DelayToCanSpawnSec, ColliderParams ColliderParams, string BotZoneName, int CorePointId
);
public Vector3? Position { get; set; }
public float? Rotation { get; set; }
public List<string>? Sides { get; set; }
public List<string>? Categories { get; set; }
public string? Infiltration { get; set; }
public float? DelayToCanSpawnSec { get; set; }
public ColliderParams? ColliderParams { get; set; }
public string? BotZoneName { get; set; }
public int? CorePointId { get; set; }
}

View File

@ -1,6 +1,3 @@
namespace LootDumpProcessor.Model.Input; namespace LootDumpProcessor.Model.Input;
public class Standing public readonly record struct Standing(float Value);
{
public float? Value { get; set; }
}

View File

@ -1,6 +1,3 @@
namespace LootDumpProcessor.Model.Input; namespace LootDumpProcessor.Model.Input;
public class TraderServerSettings public readonly record struct TraderServerSettings(TraderServices? TraderServices);
{
public TraderServices? TraderServices { get; set; }
}

View File

@ -1,18 +1,6 @@
namespace LootDumpProcessor.Model.Input; namespace LootDumpProcessor.Model.Input;
public class TraderService public readonly record struct TraderService(
{ string TraderId, string TraderServiceType, Requirements Requirements, object ServiceItemCost,
public string? TraderID { get; set; } IReadOnlyList<object> UniqueItems
);
public string? TraderServiceType { get; set; }
public Requirements? Requirements { get; set; }
public object? ServiceItemCost { get; set; }
public List<object>? UniqueItems { get; set; }
}

View File

@ -1,24 +1,6 @@
namespace LootDumpProcessor.Model.Input; namespace LootDumpProcessor.Model.Input;
public class TraderServices public readonly record struct TraderServices(
{ TraderService? ExUsecLoyalty, TraderService? ZryachiyAid, TraderService? CultistsAid, TraderService? PlayerTaxi,
public TraderService? ExUsecLoyalty { get; set; } TraderService? BtrItemsDelivery, TraderService? BtrBotCover, TraderService? TransitItemsDelivery
);
public TraderService? ZryachiyAid { get; set; }
public TraderService? CultistsAid { get; set; }
public TraderService? PlayerTaxi { get; set; }
public TraderService? BtrItemsDelivery { get; set; }
public TraderService? BtrBotCover { get; set; }
public TraderService? TransitItemsDelivery { get; set; }
}

View File

@ -1,30 +1,6 @@
namespace LootDumpProcessor.Model.Input; namespace LootDumpProcessor.Model.Input;
public class Transit public readonly record struct Transit(
{ int Id, bool Active, string Name, string Location, string Description, int ActivateAfterSec, string Target,
public int? Id { get; set; } int Time, string Conditions
);
public bool? Active { get; set; }
public string? Name { get; set; }
public string? Location { get; set; }
public string? Description { get; set; }
public int? ActivateAfterSec { get; set; }
public string? Target { get; set; }
public int? Time { get; set; }
public string? Conditions { get; set; }
}

View File

@ -1,6 +1,3 @@
namespace LootDumpProcessor.Model.Input; namespace LootDumpProcessor.Model.Input;
public class Update public readonly record struct Update(int StackObjectsCount);
{
public int? StackObjectsCount { get; set; }
}

View File

@ -1,5 +1,4 @@
using System.Text.Json.Serialization; using System.Text.Json.Serialization;
using LootDumpProcessor.Utils;
namespace LootDumpProcessor.Model; namespace LootDumpProcessor.Model;
@ -39,6 +38,6 @@ public class Item : ICloneable
ParentId = ParentId, ParentId = ParentId,
SlotId = SlotId, SlotId = SlotId,
Location = Location, Location = Location,
Upd = ProcessorUtil.Copy(Upd) Upd = Upd
}; };
} }

View File

@ -1,15 +1,3 @@
namespace LootDumpProcessor.Model; namespace LootDumpProcessor.Model;
public class Repairable : ICloneable public readonly record struct Repairable(int Durability, int MaxDurability);
{
public int? Durability { get; set; }
public int? MaxDurability { get; set; }
public object Clone() => new Repairable
{
Durability = Durability,
MaxDurability = MaxDurability
};
}

View File

@ -58,8 +58,8 @@ public class Template : IKeyable, ICloneable
IsContainer, IsContainer,
UseGravity, UseGravity,
RandomRotation, RandomRotation,
ProcessorUtil.Copy(Position), Position,
ProcessorUtil.Copy(Rotation), Rotation,
IsGroupPosition, IsGroupPosition,
ProcessorUtil.Copy(GroupPositions), ProcessorUtil.Copy(GroupPositions),
IsAlwaysSpawn, IsAlwaysSpawn,

View File

@ -1,26 +1,5 @@
using LootDumpProcessor.Utils;
namespace LootDumpProcessor.Model; namespace LootDumpProcessor.Model;
public class Upd : ICloneable public readonly record struct Upd(
{ object? StackObjectsCount, FireMode FireMode, Foldable Foldable, Repairable Repairable
public object? StackObjectsCount { get; set; } );
public FireMode? FireMode { get; set; }
public Foldable? Foldable { get; set; }
public Repairable? Repairable { get; set; }
public object Clone() => new Upd
{
StackObjectsCount = StackObjectsCount,
FireMode = ProcessorUtil.Copy(FireMode),
Foldable = ProcessorUtil.Copy(Foldable),
Repairable = ProcessorUtil.Copy(Repairable)
};
}

View File

@ -1,19 +1,3 @@
namespace LootDumpProcessor.Model; namespace LootDumpProcessor.Model;
public class Vector3 : ICloneable public readonly record struct Vector3(float X, float Y, float Z);
{
public float? X { get; set; }
public float? Y { get; set; }
public float? Z { get; set; }
public object Clone() => new Vector3
{
X = X,
Y = Y,
Z = Z
};
}

View File

@ -1,14 +1,11 @@
using System.Collections.Concurrent; using System.Collections.Concurrent;
using System.Text.Json; using System.Text.Json;
using LootDumpProcessor;
using LootDumpProcessor.Model; using LootDumpProcessor.Model;
using LootDumpProcessor.Model.Input; using LootDumpProcessor.Model.Input;
using LootDumpProcessor.Model.Output; using LootDumpProcessor.Model.Output;
using LootDumpProcessor.Model.Output.LooseLoot; using LootDumpProcessor.Model.Output.LooseLoot;
using LootDumpProcessor.Model.Output.StaticContainer; using LootDumpProcessor.Model.Output.StaticContainer;
using LootDumpProcessor.Model.Processing; using LootDumpProcessor.Model.Processing;
using LootDumpProcessor.Process;
using LootDumpProcessor.Process.Processor.DumpProcessor;
using LootDumpProcessor.Process.Processor.v2.AmmoProcessor; using LootDumpProcessor.Process.Processor.v2.AmmoProcessor;
using LootDumpProcessor.Process.Processor.v2.LooseLootProcessor; using LootDumpProcessor.Process.Processor.v2.LooseLootProcessor;
using LootDumpProcessor.Process.Processor.v2.StaticContainersProcessor; using LootDumpProcessor.Process.Processor.v2.StaticContainersProcessor;
@ -19,6 +16,8 @@ using LootDumpProcessor.Storage.Collections;
using LootDumpProcessor.Utils; using LootDumpProcessor.Utils;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
namespace LootDumpProcessor.Process.Processor.DumpProcessor;
public class MultithreadSteppedDumpProcessor( public class MultithreadSteppedDumpProcessor(
IStaticLootProcessor staticLootProcessor, IStaticLootProcessor staticLootProcessor,
IStaticContainersProcessor staticContainersProcessor, IStaticContainersProcessor staticContainersProcessor,

View File

@ -1,11 +1,12 @@
using LootDumpProcessor.Model; using LootDumpProcessor.Model;
using LootDumpProcessor.Model.Processing; using LootDumpProcessor.Model.Processing;
using LootDumpProcessor.Process.Processor.FileProcessor;
using LootDumpProcessor.Process.Processor.v2.LooseLootProcessor; using LootDumpProcessor.Process.Processor.v2.LooseLootProcessor;
using LootDumpProcessor.Process.Processor.v2.StaticLootProcessor; using LootDumpProcessor.Process.Processor.v2.StaticLootProcessor;
using LootDumpProcessor.Storage; using LootDumpProcessor.Storage;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
namespace LootDumpProcessor.Process.Processor.FileProcessor;
public class FileProcessor : IFileProcessor public class FileProcessor : IFileProcessor
{ {
private readonly IStaticLootProcessor _staticLootProcessor; private readonly IStaticLootProcessor _staticLootProcessor;

View File

@ -3,8 +3,8 @@ using LootDumpProcessor.Model.Input;
using LootDumpProcessor.Model.Output.StaticContainer; using LootDumpProcessor.Model.Output.StaticContainer;
using LootDumpProcessor.Utils; using LootDumpProcessor.Utils;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using LootDumpProcessor;
using LootDumpProcessor.Process.Processor.v2.StaticContainersProcessor; namespace LootDumpProcessor.Process.Processor.v2.StaticContainersProcessor;
public class StaticContainersProcessor : IStaticContainersProcessor public class StaticContainersProcessor : IStaticContainersProcessor
{ {

View File

@ -1,13 +1,13 @@
using System.Collections.Concurrent; using System.Collections.Concurrent;
using System.Text.Json; using System.Text.Json;
using LootDumpProcessor;
using LootDumpProcessor.Model.Input; using LootDumpProcessor.Model.Input;
using LootDumpProcessor.Model.Processing; using LootDumpProcessor.Model.Processing;
using LootDumpProcessor.Process.Reader.Intake;
using LootDumpProcessor.Serializers.Json; using LootDumpProcessor.Serializers.Json;
using LootDumpProcessor.Utils; using LootDumpProcessor.Utils;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
namespace LootDumpProcessor.Process.Reader.Intake;
public class JsonFileIntakeReader(ILogger<JsonFileIntakeReader> logger) : IIntakeReader public class JsonFileIntakeReader(ILogger<JsonFileIntakeReader> logger) : IIntakeReader
{ {
private readonly ILogger<JsonFileIntakeReader> _logger = logger ?? throw new ArgumentNullException(nameof(logger)); private readonly ILogger<JsonFileIntakeReader> _logger = logger ?? throw new ArgumentNullException(nameof(logger));
@ -43,7 +43,7 @@ public class JsonFileIntakeReader(ILogger<JsonFileIntakeReader> logger) : IIntak
_logger.LogError("Could not parse date from file: {File}", file); _logger.LogError("Could not parse date from file: {File}", file);
var fi = JsonSerializer.Deserialize<RootData>(fileData, JsonSerializerSettings.Default); var fi = JsonSerializer.Deserialize<RootData>(fileData, JsonSerializerSettings.Default);
if (fi?.Data?.LocationLoot?.Name != null && (!_ignoredLocations?.Contains(fi.Data.LocationLoot.Name) ?? true)) if (fi?.Data.LocationLoot.Name != null && (!_ignoredLocations?.Contains(fi.Data.LocationLoot.Name) ?? true))
{ {
var mapName = fi.Data.LocationLoot.Name; var mapName = fi.Data.LocationLoot.Name;
var mapId = fi.Data.LocationLoot.Id.ToLower(); var mapId = fi.Data.LocationLoot.Id.ToLower();

View File

@ -7,8 +7,8 @@ namespace LootDumpProcessor.Utils;
public static class ProcessorUtil public static class ProcessorUtil
{ {
public static string GetSaneId(this Template x) => public static string GetSaneId(this Template x) =>
$"({x.Position.X}, {x.Position.Y}, {x.Position.Z}, {Math.Round(x.Rotation.X ?? 0, 3)}," + $"({x.Position.X}, {x.Position.Y}, {x.Position.Z}, {Math.Round(x.Rotation.X, 3)}," +
$" {Math.Round(x.Rotation.Y ?? 0, 3)}, {Math.Round(x.Rotation.Z ?? 0, 3)}," + $" {Math.Round(x.Rotation.Y, 3)}, {Math.Round(x.Rotation.Z, 3)}," +
$" {x.UseGravity}, {x.IsGroupPosition})"; $" {x.UseGravity}, {x.IsGroupPosition})";
public static string GetLocationId(this Template x) => $"({x.Position.X}, {x.Position.Y}, {x.Position.Z})"; public static string GetLocationId(this Template x) => $"({x.Position.X}, {x.Position.Y}, {x.Position.Z})";
@ -25,9 +25,5 @@ public static class ProcessorUtil
return obj?.Select(o => o.Clone()).Cast<T>().ToList(); return obj?.Select(o => o.Clone()).Cast<T>().ToList();
} }
public static string HashFile(string text) public static string HashFile(string text) => Convert.ToBase64String(SHA256.HashData(Encoding.UTF8.GetBytes(text)));
{
var sha256 = SHA256.Create();
return Convert.ToBase64String(sha256.ComputeHash(Encoding.UTF8.GetBytes(text)));
}
} }