diff --git a/JsonLib/Classes/DatabaseRelated/Achievement.cs b/JsonLib/Classes/DatabaseRelated/Achievement.cs new file mode 100644 index 0000000..0d992f0 --- /dev/null +++ b/JsonLib/Classes/DatabaseRelated/Achievement.cs @@ -0,0 +1,53 @@ +using JsonLib.Classes.QuestRelated; +using Newtonsoft.Json; + +namespace JsonLib.Classes.DatabaseRelated +{ + public class Achievement + { + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore, NullValueHandling = NullValueHandling.Ignore)] + public string id { get; set; } + + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore, NullValueHandling = NullValueHandling.Ignore)] + public string imageUrl { get; set; } + + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore, NullValueHandling = NullValueHandling.Ignore)] + public string assetPath { get; set; } + + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore, NullValueHandling = NullValueHandling.Ignore)] + public List rewards { get; set; } + + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore, NullValueHandling = NullValueHandling.Ignore)] + public Quest.Conditions conditions { get; set; } + + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore, NullValueHandling = NullValueHandling.Ignore)] + public bool instantComplete { get; set; } + + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore, NullValueHandling = NullValueHandling.Ignore)] + public bool showNotificationsInGame { get; set; } + + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore, NullValueHandling = NullValueHandling.Ignore)] + public bool showProgress { get; set; } + + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore, NullValueHandling = NullValueHandling.Ignore)] + public string prefab { get; set; } + + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore, NullValueHandling = NullValueHandling.Ignore)] + public string rarity { get; set; } + + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore, NullValueHandling = NullValueHandling.Ignore)] + public bool hidden { get; set; } + + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore, NullValueHandling = NullValueHandling.Ignore)] + public bool showConditions { get; set; } + + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore, NullValueHandling = NullValueHandling.Ignore)] + public bool progressBarEnabled { get; set; } + + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore, NullValueHandling = NullValueHandling.Ignore)] + public string side { get; set; } + + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore, NullValueHandling = NullValueHandling.Ignore)] + public int index { get; set; } + } +} diff --git a/JsonLib/Classes/DatabaseRelated/DatabaseCore.cs b/JsonLib/Classes/DatabaseRelated/DatabaseCore.cs index 9d940e5..8990cb8 100644 --- a/JsonLib/Classes/DatabaseRelated/DatabaseCore.cs +++ b/JsonLib/Classes/DatabaseRelated/DatabaseCore.cs @@ -65,5 +65,7 @@ public class trader public Dictionary Weather { get; set; } = new(); public LootBase Loot { get; set; } = new(); + + public List Achievements { get; set; } = new(); } } diff --git a/JsonLib/Classes/ProfileRelated/Character.cs b/JsonLib/Classes/ProfileRelated/Character.cs index b1e7f50..d212eb0 100644 --- a/JsonLib/Classes/ProfileRelated/Character.cs +++ b/JsonLib/Classes/ProfileRelated/Character.cs @@ -1,5 +1,4 @@ using JsonLib.Classes.ItemRelated; -using JsonLib.Classes.QuestRelated; using JsonLib.Classes.TradeRelated; using JsonLib.Enums; using Newtonsoft.Json; @@ -26,6 +25,9 @@ public class Base [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] public Customization Customization { get; set; } + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public Dictionary Encyclopedia { get; set; } + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] public Health Health { get; set; } @@ -33,52 +35,76 @@ public class Base public Inventory Inventory { get; set; } [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] - public Skills Skills { get; set; } + public List InsuredItems { get; set; } [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] - public Stats Stats { get; set; } + public List QuestItems { get; set; } [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] - public Dictionary Encyclopedia { get; set; } + public Skills Skills { get; set; } [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] - public ConditionCounters ConditionCounters { get; set; } + public _Notes Notes { get; set; } [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] - public Dictionary BackendCounters { get; set; } + public Dictionary TaskConditionCounters { get; set; } [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] - public List InsuredItems { get; set; } + public List Quests { get; set; } [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] - public Hideout Hideout { get; set; } + public Dictionary Achievements { get; set; } [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] - public List Quests { get; set; } + public UnlockedInfo UnlockedInfo { get; set; } [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] - public Dictionary TradersInfo { get; set; } + public List Bonuses { get; set; } [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] - public UnlockedInfo UnlockedInfo { get; set; } + public Hideout Hideout { get; set; } [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] public RagfairInfo RagfairInfo { get; set; } [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] - public List RepeatableQuests { get; set; } + public List WishList { get; set; } [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] - public List Bonuses { get; set; } + public Stats Stats { get; set; } [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] - public _Notes Notes { get; set; } + public Dictionary BackendCounters { get; set; } + + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public Dictionary TradersInfo { get; set; } [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore, NullValueHandling = NullValueHandling.Ignore)] public string SurvivorClass { get; set; } + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore, NullValueHandling = NullValueHandling.Ignore)] + public Dictionary CheckedMagazines { get; set; } + + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore, NullValueHandling = NullValueHandling.Ignore)] + public List CheckedChambers { get; set; } + + [JsonProperty(NullValueHandling = NullValueHandling.Include)] + public object BonusController { get; set; } + + [JsonProperty(NullValueHandling = NullValueHandling.Include)] + public Skills SkillsInfo { get; set; } + + [JsonProperty(NullValueHandling = NullValueHandling.Include)] + public Inventory InventoryInfo { get; set; } + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] - public List WishList { get; set; } + public int Experience { get; set; } + + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public string Side { get; set; } + + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public int MagDrillsMastering { get; set; } } @@ -90,9 +116,6 @@ public class UnlockedInfo } public class Info { - [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] - public string EntryPoint { get; set; } - [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] public string Nickname { get; set; } @@ -102,59 +125,44 @@ public class Info [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] public string Side { get; set; } - [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore, NullValueHandling = NullValueHandling.Ignore)] - public bool SquadnviteRestriction { get; set; } - - [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] - public string Voice { get; set; } - [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] - public int Level { get; set; } + public int RegistrationDate { get; set; } [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] - public int Experience { get; set; } - + public int SavageLockTime { get; set; } + public string GroupId { get; set; } + public string TeamId { get; set; } + public string EntryPoint { get; set; } [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] - public int RegistrationDate { get; set; } + public int NicknameChangeDate { get; set; } [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] public string GameVersion { get; set; } [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] - public int AccountType { get; set; } - - [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] - public EMemberCategory MemberCategory { get; set; } + public string Voice { get; set; } [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] - public bool lockedMoveCommands { get; set; } + public bool IsStreamerModeAvailable { get; set; } - [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] - public double SavageLockTime { get; set; } + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore, NullValueHandling = NullValueHandling.Ignore)] + public bool SquadnviteRestriction { get; set; } [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] - public int LastTimePlayedAsSavage { get; set; } + public List Bans { get; set; } [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] public Settings Settings { get; set; } [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] - public int NicknameChangeDate { get; set; } - - [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] - public List NeedWipeOptions { get; set; } - - [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] - public List Bans { get; set; } + public EMemberCategory MemberCategory { get; set; } [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] - public bool BannedState { get; set; } + public int Experience { get; set; } - [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] - public int BannedUntil { get; set; } [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] - public bool IsStreamerModeAvailable { get; set; } + public int Level { get; set; } } public class Settings @@ -472,12 +480,7 @@ public class CounterKeyValue public int Value { get; set; } } - public class ConditionCounters - { - [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] - public List Counters { get; set; } - } public class Counter { [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] @@ -487,7 +490,10 @@ public class Counter public int value { get; set; } [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] - public string qid { get; set; } + public string sourceId { get; set; } + + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public string type { get; set; } } public class Aggressor @@ -552,33 +558,6 @@ public class LethalDamage [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] public int ImpactsCount { get; set; } - } - public class BodyPartsDamageHistory - { - [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] - public List Head { get; set; } - - [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] - public List Chest { get; set; } - - [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] - public List Stomach { get; set; } - - [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] - public List LeftArm { get; set; } - - [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] - public List RightArm { get; set; } - - [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] - public List LeftLeg { get; set; } - - [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] - public List RightLeg { get; set; } - - [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] - public List Common { get; set; } - } public class DamageStats { @@ -663,7 +642,17 @@ public class InsuredItem [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] public string itemId { get; set; } + } + public class QuestItem + { + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public string _id { get; set; } + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public string _tpl { get; set; } + + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public string parentId { get; set; } } public class Hideout { @@ -805,6 +794,16 @@ public class _Notes [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] public List Notes { get; set; } + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public _TransactionInProcess TransactionInProcess { get; set; } + + public class _TransactionInProcess + { + public object Handlers { get; set; } + public bool HasHandlers { get; set; } + public bool HasCheckChanges { get; set; } + } + } public class Quest { diff --git a/JsonLib/Classes/QuestRelated/Quest.cs b/JsonLib/Classes/QuestRelated/Quest.cs index 24008c5..900b4e1 100644 --- a/JsonLib/Classes/QuestRelated/Quest.cs +++ b/JsonLib/Classes/QuestRelated/Quest.cs @@ -10,7 +10,7 @@ public class Base { [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] public string QuestName { get; set; } - + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] public string _id { get; set; } @@ -47,9 +47,6 @@ public class Base [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] public bool isKey { get; set; } - [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] - public object questStatus { get; set; } - [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] public bool restartable { get; set; } @@ -65,6 +62,15 @@ public class Base [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] public string successMessageText { get; set; } + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public string acceptPlayerMessage { get; set; } + + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public string declinePlayerMessage { get; set; } + + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public string completePlayerMessage { get; set; } + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] public string templateId { get; set; } @@ -87,34 +93,23 @@ public class Base public class Conditions { [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] - public List Started { get; set; } + public List Started { get; set; } [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] - public List AvailableForFinish { get; set; } + public List AvailableForFinish { get; set; } [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] - public List AvailableForStart { get; set; } + public List AvailableForStart { get; set; } [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] - public List Success { get; set; } + public List Success { get; set; } [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] - public List Fail { get; set; } + public List Fail { get; set; } } - public class AvailableForConditions - { - [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] - public string _parent { get; set; } - [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] - public AvailableForProps _props { get; set; } - - [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] - public bool dynamicLocale { get; set; } - - } - public class AvailableForProps + public class Condition { [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] public string id { get; set; } @@ -123,26 +118,29 @@ public class AvailableForProps public int index { get; set; } [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] - public string parentId { get; set; } - - [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] - public bool isEncoded { get; set; } + public string compareMethod { get; set; } [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] public bool dynamicLocale { get; set; } [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] - public string value { get; set; } + public List visibilityConditions { get; set; } [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] - public string compareMethod { get; set; } + public string globalQuestCounterId { get; set; } [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] - public List visibilityConditions { get; set; } + public string parentId { get; set; } [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] public QuestTarget? target { get; set; } + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public string value { get; set; } + + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public object type { get; set; } + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] public List status { get; set; } //EQuestStatus @@ -171,7 +169,7 @@ public class AvailableForProps public int minDurability { get; set; } [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] - public AvailableForCounter counter { get; set; } + public ConditionCounter counter { get; set; } [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] public int plantTime { get; set; } @@ -180,41 +178,76 @@ public class AvailableForProps public string zoneId { get; set; } [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] - public object type { get; set; } + public bool countInRaid { get; set; } [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] - public bool countInRaid { get; set; } + public int completeInSeconds { get; set; } + + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public bool isEncoded { get; set; } + + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public string conditionType { get; set; } } - public class AvailableForCounter + public class VisibilityCondition { [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] public string id { get; set; } [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] - public List conditions { get; set; } + public string target { get; set; } + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public int value { get; set; } + + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public bool dynamicLocale { get; set; } + + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public bool oneSessionOnly { get; set; } + + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public string conditionType { get; set; } } - public class CounterCondition + public class ConditionCounter { [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] - public string _parent { get; set; } + public string id { get; set; } [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] - public CounterProps _props { get; set; } + public List conditions { get; set; } } - public class CounterProps + public class ConditionCounterCondition { [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] public string id { get; set; } + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public bool dynamicLocale { get; set; } + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] public QuestTarget? target { get; set; } + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public int completeInSeconds { get; set; } + + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public ValueCompare energy { get; set; } + + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public string exitName { get; set; } + + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public ValueCompare hydration { get; set; } + + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public ValueCompare time { get; set; } + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] public string compareMethod { get; set; } @@ -224,12 +257,30 @@ public class CounterProps [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] public List weapon { get; set; } + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public ConditionDistance distance { get; set; } + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] public List> equipmentInclusive { get; set; } [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] public List> weaponModsInclusive { get; set; } + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public List> weaponModsExclusive { get; set; } + + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public List> enemyEquipmentInclusive { get; set; } + + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public List> enemyEquipmentExclusive { get; set; } + + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public List weaponCaliber { get; set; } + + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public List savageRole { get; set; } + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] public List status { get; set; } @@ -239,33 +290,54 @@ public class CounterProps [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] public DaytimeCounter daytime { get; set; } + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public string conditionType { get; set; } + + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public List enemyHealthEffects { get; set; } + + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public bool resetOnSessionEnd { get; set; } } - public class DaytimeCounter + public class DaytimeCounter { [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] public int from { get; set; } [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] public int to { get; set; } - } - public class VisibilityCondition + public class ValueCompare { [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] - public string id { get; set; } + public string compareMethod { get; set; } [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] public int value { get; set; } + } + public class EnemyHealthEffect + { [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] - public bool dynamicLocale { get; set; } + public List bodyParts { get; set; } [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] - public bool oneSessionOnly { get; set; } + public List effects { get; set; } + } + + public class ConditionDistance + { + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public int value { get; set; } + + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public string compareMethod { get; set; } } + + public class Rewards { [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] @@ -290,22 +362,22 @@ public class Rewards public List Expired { get; set; } } - public class Reward : Item.Base + public class Reward { [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] - public string value { get; set; } + public double value { get; set; } [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] public string id { get; set; } [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] - public string type { get; set; } + public string type { get; set; } //QuestRewardType [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] public int index { get; set; } [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] - public string target { get; set; } + public QuestTarget target { get; set; } [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] public List items { get; set; } diff --git a/JsonLib/Classes/Response/Achievements.cs b/JsonLib/Classes/Response/Achievements.cs new file mode 100644 index 0000000..a022922 --- /dev/null +++ b/JsonLib/Classes/Response/Achievements.cs @@ -0,0 +1,14 @@ +using JsonLib.Classes.DatabaseRelated; + +namespace JsonLib.Classes.Response +{ + public class GetAchievements + { + public List elements { get; set; } + } + + public class AchievementStatistic + { + public Dictionary elements { get; set; } + } +} diff --git a/Plugins/TestPlugin/Class1.cs b/Plugins/TestPlugin/Class1.cs index 33dad5e..b291ac2 100644 --- a/Plugins/TestPlugin/Class1.cs +++ b/Plugins/TestPlugin/Class1.cs @@ -45,7 +45,7 @@ await Task.Run(() => { Console.WriteLine("yeetteete"); } - + Console.WriteLine(Directory.GetCurrentDirectory()); }); diff --git a/Plugins/TestServer/Messages/InitConnection.cs b/Plugins/TestServer/Messages/InitConnection.cs new file mode 100644 index 0000000..17272f9 --- /dev/null +++ b/Plugins/TestServer/Messages/InitConnection.cs @@ -0,0 +1,47 @@ +using ModdableWebServer; +using ModdableWebServer.Helper; +using ServerLib.Controllers; +using ServerLib.Web; +using Newtonsoft.Json; + +namespace TestServer.Messages +{ + public class InitConnection + { + public static void Work(BinaryReader binaryReader, WebSocketStruct socketStruct, string id) + { + var Location = binaryReader.ReadString(); + Console.WriteLine($"[TS.Messages.InitConnection] Unity Server ({id}) sent InitConnection, wants to host Map: {Location}"); + MemoryStream memoryStream = new MemoryStream(); + BinaryWriter binaryWriter = new(memoryStream); + binaryWriter.Write((byte)MessageId.InitConnectionRsp); + bool loadResult = ServerController.RequestLoadMap(Location); + binaryWriter.Write(loadResult); + if (loadResult) + { + var compressed = ResponseControl.CompressRsp(ServerController.GetMap(Location)); + binaryWriter.Write((byte)0); //location + binaryWriter.Write(compressed.Length); + binaryWriter.Write(compressed); + //Get random loot + binaryWriter.Write((byte)1); //random loot + binaryWriter.Write(0); //location + + //get random searching loot. + binaryWriter.Write((byte)2); //random loot + binaryWriter.Write(0); //location + + + var weather = DatabaseController.DataBase.Weather["sun"]; + compressed = ResponseControl.CompressRsp($"[{JsonConvert.SerializeObject(weather)}]"); + binaryWriter.Write((byte)3); //location + binaryWriter.Write(compressed.Length); + binaryWriter.Write(compressed); + } + binaryWriter.Flush(); + binaryWriter.Close(); + binaryWriter.Dispose(); + socketStruct.SendWebSocketByteArray(memoryStream.ToArray()); + } + } +} diff --git a/Plugins/TestServer/Messages/KeepAlive.cs b/Plugins/TestServer/Messages/KeepAlive.cs new file mode 100644 index 0000000..d865584 --- /dev/null +++ b/Plugins/TestServer/Messages/KeepAlive.cs @@ -0,0 +1,27 @@ +using ModdableWebServer; +using ModdableWebServer.Helper; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace TestServer.Messages +{ + public class KeepAlive + { + public static void Work(BinaryReader binaryReader, WebSocketStruct socketStruct, string id) + { + var ServerSendTime = binaryReader.ReadInt64(); + Console.WriteLine($"[TS.Messages.KeepAlive] Unity Server ({id}) sent KeepAlive with the current time: {DateTimeOffset.FromUnixTimeMilliseconds(ServerSendTime).ToString("O")}"); + MemoryStream memoryStream = new MemoryStream(); + BinaryWriter binaryWriter = new(memoryStream); + binaryWriter.Write((byte)MessageId.KeepAlive); + binaryWriter.Write((long)DateTimeOffset.UtcNow.ToUnixTimeMilliseconds()); + binaryWriter.Flush(); + binaryWriter.Close(); + binaryWriter.Dispose(); + socketStruct.SendWebSocketByteArray(memoryStream.ToArray()); + } + } +} diff --git a/Plugins/TestServer/Messages/MessageId.cs b/Plugins/TestServer/Messages/MessageId.cs new file mode 100644 index 0000000..b224324 --- /dev/null +++ b/Plugins/TestServer/Messages/MessageId.cs @@ -0,0 +1,18 @@ +namespace TestServer.Messages +{ + public enum MessageId : byte + { + KeepAlive, + InitConnection, + InitConnectionRsp, + NewUserConnected, + NewUserConRsp, + UserDisconnected, + UserDisconnectedRsp, + SpawnUser, + SpawnUserRsp, + DespawnUser, + DespawnUserRsp, + MatchRestarting, + } +} diff --git a/Plugins/TestServer/ServerController.cs b/Plugins/TestServer/ServerController.cs new file mode 100644 index 0000000..58bd848 --- /dev/null +++ b/Plugins/TestServer/ServerController.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace TestServer +{ + internal class ServerController + { + // Map stuff + public static bool RequestLoadMap(string map) + { + if (File.Exists($"TestServer/{map}.json")) //Interactibles + { + return true; + } + return false; + } + + public static string GetMap(string map) + { + return File.ReadAllText($"TestServer/{map}.json"); + } + } +} diff --git a/Plugins/TestServer/TestServer.csproj b/Plugins/TestServer/TestServer.csproj index a22181e..d5baa90 100644 --- a/Plugins/TestServer/TestServer.csproj +++ b/Plugins/TestServer/TestServer.csproj @@ -7,6 +7,7 @@ + diff --git a/Plugins/TestServer/URLs.cs b/Plugins/TestServer/URLs.cs index 7a76724..046b2a4 100644 --- a/Plugins/TestServer/URLs.cs +++ b/Plugins/TestServer/URLs.cs @@ -8,13 +8,13 @@ namespace TestServer { public class URLs { - [HTTP("POST", "/testserver/")] + [HTTP("POST", "/testserver")] public static bool TestServer(HttpRequest request, ServerStruct serverStruct) { Console.WriteLine(request.Body); serverStruct.Response.MakeGetResponse("HELLO"); serverStruct.SendResponse(); return true; - } + } } } diff --git a/Plugins/TestServer/WS_MessageController.cs b/Plugins/TestServer/WS_MessageController.cs new file mode 100644 index 0000000..64a5bdf --- /dev/null +++ b/Plugins/TestServer/WS_MessageController.cs @@ -0,0 +1,39 @@ +using ModdableWebServer; +using TestServer.Messages; + +namespace TestServer +{ + public class WS_MessageController + { + public static void Work(WebSocketStruct socketStruct, string Id) + { + var req = socketStruct.WSRequest!.Value; + var bytes = req.buffer.Skip((int)req.offset).Take((int)req.size).ToArray(); + + BinaryReader binaryReader = new(new MemoryStream(bytes)); + MessageId msgId = (MessageId)binaryReader.ReadByte(); + switch (msgId) + { + case MessageId.KeepAlive: + KeepAlive.Work(binaryReader, socketStruct, Id); + break; + case MessageId.InitConnection: + break; + case MessageId.NewUserConnected: + break; + case MessageId.UserDisconnected: + break; + case MessageId.SpawnUser: + break; + case MessageId.DespawnUser: + break; + case MessageId.MatchRestarting: + break; + default: + break; + } + binaryReader.Close(); + binaryReader.Dispose(); + } + } +} diff --git a/Plugins/TestServer/WS_Server.cs b/Plugins/TestServer/WS_Server.cs new file mode 100644 index 0000000..f2f08a1 --- /dev/null +++ b/Plugins/TestServer/WS_Server.cs @@ -0,0 +1,36 @@ +using ModdableWebServer.Attributes; +using ModdableWebServer; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace TestServer +{ + internal class WS_Server + { + [WS("/socket_server/{id}")] + public static void WS_Server_Socket(WebSocketStruct socketStruct) + { + var id = socketStruct.Request.Parameters["id"]; + Console.WriteLine("websocket hit!"); + if (socketStruct.IsConnected) + { + /* + if (!SocketUsers.ContainsKey(id)) + { + SocketUsers.Add(id, socketStruct); + }*/ + if (socketStruct.WSRequest != null) + { + WS_MessageController.Work(socketStruct, id); + } + } + else if (!socketStruct.IsConnecting) + { + //SocketUsers.Remove(id); + } + } + } +} diff --git a/ServerFiles/Files/locations/bigmap/looseLoot.json b/ServerFiles/Files/locations/bigmap/looseLoot.json deleted file mode 100644 index 22ddf83..0000000 --- a/ServerFiles/Files/locations/bigmap/looseLoot.json +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:99c28902515caef64fec4dd89847c2d653d90043b044a8408af89bfdd682270e -size 11152123 diff --git a/ServerFiles/Files/locations/factory4_day/looseLoot.json b/ServerFiles/Files/locations/factory4_day/looseLoot.json deleted file mode 100644 index dae7045..0000000 --- a/ServerFiles/Files/locations/factory4_day/looseLoot.json +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:98ee434a61f87ae5493bc0893b28dcba01339b77fc809c89259f73c4609bd8e0 -size 540877 diff --git a/ServerFiles/Files/locations/factory4_night/looseLoot.json b/ServerFiles/Files/locations/factory4_night/looseLoot.json deleted file mode 100644 index dae7045..0000000 --- a/ServerFiles/Files/locations/factory4_night/looseLoot.json +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:98ee434a61f87ae5493bc0893b28dcba01339b77fc809c89259f73c4609bd8e0 -size 540877 diff --git a/ServerFiles/Files/locations/interchange/looseLoot.json b/ServerFiles/Files/locations/interchange/looseLoot.json deleted file mode 100644 index 8446428..0000000 --- a/ServerFiles/Files/locations/interchange/looseLoot.json +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:7a895953046b650c8c866041e5755532d466fc721d1c744d5950777a05bf9788 -size 20276732 diff --git a/ServerFiles/Files/locations/laboratory/looseLoot.json b/ServerFiles/Files/locations/laboratory/looseLoot.json deleted file mode 100644 index c1b5f10..0000000 --- a/ServerFiles/Files/locations/laboratory/looseLoot.json +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:6d1246d77ad1b8955c57ac5d2e9e7a1b954d2f4e8184bb4b67a8a07e35a21267 -size 7940909 diff --git a/ServerFiles/Files/locations/lighthouse/looseLoot.json b/ServerFiles/Files/locations/lighthouse/looseLoot.json deleted file mode 100644 index ee699eb..0000000 --- a/ServerFiles/Files/locations/lighthouse/looseLoot.json +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:eed83c3435ff9af51641620abbdda7a565b61155b12be17f9eafac5aea8449d0 -size 35623443 diff --git a/ServerFiles/Files/locations/private area/base.json b/ServerFiles/Files/locations/privatearea/base.json similarity index 100% rename from ServerFiles/Files/locations/private area/base.json rename to ServerFiles/Files/locations/privatearea/base.json diff --git a/ServerFiles/Files/locations/rezervbase/looseLoot.json b/ServerFiles/Files/locations/rezervbase/looseLoot.json deleted file mode 100644 index 1274982..0000000 --- a/ServerFiles/Files/locations/rezervbase/looseLoot.json +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:29a77e5118973a4db7ade77cc190df8b226a1b8118688e09433b4fc9ddb6ab3d -size 24222079 diff --git a/ServerFiles/Files/locations/shoreline/looseLoot.json b/ServerFiles/Files/locations/shoreline/looseLoot.json deleted file mode 100644 index e028bc6..0000000 --- a/ServerFiles/Files/locations/shoreline/looseLoot.json +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:7acecf280be2f06725487e3616d95fdcec376cc53e480b2b93929e1cf56d7df8 -size 4762642 diff --git a/ServerFiles/Files/locations/tarkovstreets/looseLoot.json b/ServerFiles/Files/locations/tarkovstreets/looseLoot.json deleted file mode 100644 index 5959820..0000000 --- a/ServerFiles/Files/locations/tarkovstreets/looseLoot.json +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:93aaf27ab9e70c480ed135d85988d22536a7ae3b9e6872d975dd44fc49db2088 -size 37674234 diff --git a/ServerFiles/Files/locations/woods/looseLoot.json b/ServerFiles/Files/locations/woods/looseLoot.json deleted file mode 100644 index d5bdfb0..0000000 --- a/ServerFiles/Files/locations/woods/looseLoot.json +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:72bb60daa7e30442cec06d56c0ba3210a114ff7266748980acca7d2fad753b30 -size 8014350 diff --git a/ServerLib/Controllers/AchievementController.cs b/ServerLib/Controllers/AchievementController.cs new file mode 100644 index 0000000..512ea75 --- /dev/null +++ b/ServerLib/Controllers/AchievementController.cs @@ -0,0 +1,50 @@ +using JsonLib.Classes.DatabaseRelated; + +namespace ServerLib.Controllers +{ + public class AchievementController + { + static List Achievements; + + static AchievementController() + { + Achievements = DatabaseController.DataBase.Achievements; + } + + public static bool GrantAchievement(string AchievementId, string SessionId, long time = -1) + { + if (Achievements.Where(x => x.id == AchievementId).Any()) + { + var profile = ProfileController.GetProfile(SessionId); + if (profile != null) + { + if (time == -1) + time = DateTimeOffset.UtcNow.ToUnixTimeSeconds(); + return profile.Characters.Pmc.Achievements.TryAdd(AchievementId, (int)time); + } + } + return false; + } + + public static JsonLib.Classes.Response.AchievementStatistic GetAchievementStatistics() + { + Dictionary pairs = new(); + foreach (var item in Achievements) + { + pairs.Add(item.id, 0); + } + return new() + { + elements = pairs + }; + } + + public static JsonLib.Classes.Response.GetAchievements GetAchievements() + { + return new() + { + elements = Achievements + }; + } + } +} diff --git a/ServerLib/Controllers/CharacterController.cs b/ServerLib/Controllers/CharacterController.cs index e7c814d..21e7b31 100644 --- a/ServerLib/Controllers/CharacterController.cs +++ b/ServerLib/Controllers/CharacterController.cs @@ -88,7 +88,7 @@ public static void CreateCharacter(string SessionId, string JSON) character.Health.UpdateTime = time; character.Customization.Head = createReq.HeadId; character.Quests = new(); - character.RepeatableQuests = new(); + character.Achievements = new(); character.Info.SavageLockTime = 1000000; character.Inventory = InventoryController.AssingInventory(character.Inventory); SaveHandler.Save(SessionId, "Character", SaveHandler.GetCharacterPath(SessionId), JsonHelper.FromCharacterBase(character)); diff --git a/ServerLib/Controllers/DatabaseController.cs b/ServerLib/Controllers/DatabaseController.cs index fc86911..77298af 100644 --- a/ServerLib/Controllers/DatabaseController.cs +++ b/ServerLib/Controllers/DatabaseController.cs @@ -72,7 +72,7 @@ public static void Init() DataBase.Others.Customization = JsonConvert.DeserializeObject>(File.ReadAllText("Files/others/customization.json"), new JsonConverter[] { - CustomizationItemPrefabConverter.Singleton + CustomizationItemPrefabConverter.Singleton }); Debug.PrintTime($"Customization Taken {sw.ElapsedMilliseconds}ms"); }), @@ -85,6 +85,15 @@ public static void Init() staticLoot = JsonConvert.DeserializeObject>(File.ReadAllText("Files/loot/staticLoot.json")) }; Debug.PrintTime($"Loot Taken {sw.ElapsedMilliseconds}ms"); + }), + Task.Run(() => + { + DataBase.Achievements = JsonConvert.DeserializeObject>(File.ReadAllText("Files/others/achievements.json"), + new JsonConverter[] + { + QuestTargetConverter.Singleton + }); + Debug.PrintTime($"Achievements Taken {sw.ElapsedMilliseconds}ms"); }) }; Task.WhenAll(tasks.AsParallel().Select(task => task)).Wait(); diff --git a/ServerLib/Utilities/Version.cs b/ServerLib/Utilities/Version.cs index d99b95e..13764be 100644 --- a/ServerLib/Utilities/Version.cs +++ b/ServerLib/Utilities/Version.cs @@ -2,7 +2,7 @@ { public class Versions { - public static string ServerVersion = "v20240202.0"; + public static string ServerVersion = "v20240209.0"; public static string TarkovVersion = "0.14.0.1.28476"; public virtual string LoadVersion { get; set; } = ServerVersion; } diff --git a/ServerLib/Web/ClientAchievement.cs b/ServerLib/Web/ClientAchievement.cs new file mode 100644 index 0000000..e7888f9 --- /dev/null +++ b/ServerLib/Web/ClientAchievement.cs @@ -0,0 +1,34 @@ +using ModdableWebServer.Attributes; +using ModdableWebServer; +using NetCoreServer; +using ServerLib.Utilities.Helpers; +using Newtonsoft.Json; +using ServerLib.Controllers; + +namespace ServerLib.Web +{ + internal class ClientAchievement + { + [HTTP("POST", "/client/achievement/list")] + public static bool AchievementList(HttpRequest request, ServerStruct serverStruct) + { + ServerHelper.PrintRequest(request, serverStruct); + string SessionId = serverStruct.Headers.GetSessionId(); + + var rsp = ResponseControl.GetBody(JsonConvert.SerializeObject(AchievementController.GetAchievements())); + ServerHelper.SendUnityResponse(request, serverStruct, rsp); + return true; + } + + [HTTP("POST", "/client/achievement/statistic")] + public static bool AchievementStatistic(HttpRequest request, ServerStruct serverStruct) + { + ServerHelper.PrintRequest(request, serverStruct); + string SessionId = serverStruct.Headers.GetSessionId(); + + var rsp = ResponseControl.GetBody(JsonConvert.SerializeObject(AchievementController.GetAchievementStatistics())); + ServerHelper.SendUnityResponse(request, serverStruct, rsp); + return true; + } + } +}