mirror of
https://github.com/tribufu/ServerManagers
synced 2026-05-06 15:17:34 +00:00
source code checkin
This commit is contained in:
parent
5f8fb2c825
commit
7e57b72e35
675 changed files with 168433 additions and 0 deletions
28
src/ARKServerManager.Common/ARKServerManager.Common.csproj
Normal file
28
src/ARKServerManager.Common/ARKServerManager.Common.csproj
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup Label="Globals">
|
||||
<SccProjectName>%24/Development/ServerManagers/Main/ARKServerManager.Common</SccProjectName>
|
||||
<SccProvider>{4CA58AB2-18FA-4F8D-95D4-32DDF27D184C}</SccProvider>
|
||||
<SccAuxPath>https://dev.azure.com/bretthewitson</SccAuxPath>
|
||||
<SccLocalPath>.</SccLocalPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net462</TargetFramework>
|
||||
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
|
||||
<RootNamespace>ServerManagerTool</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
|
||||
<DebugType>none</DebugType>
|
||||
<DebugSymbols>false</DebugSymbols>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Remove="Lib\**" />
|
||||
<EmbeddedResource Remove="Lib\**" />
|
||||
<None Remove="Lib\**" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Remove="ARKServerManager.Common.csproj.vspscc" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\ServerManager.Common\ServerManager.Common.csproj" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
13
src/ARKServerManager.Common/Enums/CreatureTamable.cs
Normal file
13
src/ARKServerManager.Common/Enums/CreatureTamable.cs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
using System.ComponentModel;
|
||||
|
||||
namespace ServerManagerTool.Enums
|
||||
{
|
||||
[DefaultValue(False)]
|
||||
public enum DinoTamable
|
||||
{
|
||||
False,
|
||||
True,
|
||||
ByBreeding,
|
||||
ByCrafting,
|
||||
}
|
||||
}
|
||||
35
src/ARKServerManager.Common/Properties/AssemblyInfo.cs
Normal file
35
src/ARKServerManager.Common/Properties/AssemblyInfo.cs
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("ARKServerManager Common Library")]
|
||||
[assembly: AssemblyDescription("The library is used to provide common functionality to the ark server manager.")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("Bletch1971")]
|
||||
[assembly: AssemblyProduct("Server Managers")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2015-2020")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("dd0a2401-99b8-4de1-b8ed-9b075172f8af")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
303
src/ARKServerManager.Common/Utils/GameDataUtils.cs
Normal file
303
src/ARKServerManager.Common/Utils/GameDataUtils.cs
Normal file
|
|
@ -0,0 +1,303 @@
|
|||
using ServerManagerTool.Common.Utils;
|
||||
using ServerManagerTool.Enums;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace ServerManagerTool.Utils
|
||||
{
|
||||
public static class GameDataUtils
|
||||
{
|
||||
public static void ReadAllData(out MainGameData data, string dataFolder, string extension, string application, bool isUserData = false)
|
||||
{
|
||||
data = new MainGameData();
|
||||
|
||||
if (string.IsNullOrWhiteSpace(dataFolder))
|
||||
return;
|
||||
|
||||
if (!Directory.Exists(dataFolder))
|
||||
return;
|
||||
|
||||
foreach (var file in Directory.GetFiles(dataFolder, $"*{extension}", SearchOption.TopDirectoryOnly))
|
||||
{
|
||||
try
|
||||
{
|
||||
var fileData = MainGameData.Load(file, isUserData);
|
||||
if (fileData == null)
|
||||
continue;
|
||||
|
||||
if (!fileData.Application.Equals(application, StringComparison.OrdinalIgnoreCase))
|
||||
continue;
|
||||
|
||||
data.Creatures.AddRange(fileData.Creatures);
|
||||
data.Engrams.AddRange(fileData.Engrams);
|
||||
data.Items.AddRange(fileData.Items);
|
||||
data.MapSpawners.AddRange(fileData.MapSpawners);
|
||||
data.SupplyCrates.AddRange(fileData.SupplyCrates);
|
||||
data.Inventories.AddRange(fileData.Inventories);
|
||||
data.GameMaps.AddRange(fileData.GameMaps);
|
||||
data.Mods.AddRange(fileData.Mods);
|
||||
data.PlayerLevels.AddRange(fileData.PlayerLevels);
|
||||
data.CreatureLevels.AddRange(fileData.CreatureLevels);
|
||||
data.Branches.AddRange(fileData.Branches);
|
||||
data.Events.AddRange(fileData.Events);
|
||||
data.OfficialMods.AddRange(fileData.OfficialMods);
|
||||
|
||||
if (fileData.PlayerAdditionalLevels > 0 && fileData.PlayerAdditionalLevels > data.PlayerAdditionalLevels)
|
||||
data.PlayerAdditionalLevels = fileData.PlayerAdditionalLevels;
|
||||
}
|
||||
catch
|
||||
{
|
||||
// do nothing, just swallow the error
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
public class BaseGameData
|
||||
{
|
||||
public string GameDataFile = string.Empty;
|
||||
|
||||
[DataMember]
|
||||
public string Application = string.Empty;
|
||||
[DataMember]
|
||||
public string Version = "1.0.0";
|
||||
[DataMember]
|
||||
public DateTime Created = DateTime.UtcNow;
|
||||
[DataMember]
|
||||
public string Color = "White";
|
||||
|
||||
public static BaseGameData Load(string file)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(file) || !File.Exists(file))
|
||||
return null;
|
||||
|
||||
var data = JsonUtils.DeserializeFromFile<BaseGameData>(file);
|
||||
if (data != null)
|
||||
{
|
||||
data.GameDataFile = file;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
public bool Save(string file)
|
||||
{
|
||||
var folder = Path.GetDirectoryName(file);
|
||||
if (!Directory.Exists(folder))
|
||||
Directory.CreateDirectory(folder);
|
||||
|
||||
return JsonUtils.SerializeToFile(this, file);
|
||||
}
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
public class MainGameData : BaseGameData
|
||||
{
|
||||
[DataMember(IsRequired = false)]
|
||||
public List<CreatureDataItem> Creatures = new List<CreatureDataItem>();
|
||||
|
||||
[DataMember(IsRequired = false)]
|
||||
public List<EngramDataItem> Engrams = new List<EngramDataItem>();
|
||||
|
||||
[DataMember(IsRequired = false)]
|
||||
public List<ItemDataItem> Items = new List<ItemDataItem>();
|
||||
|
||||
[DataMember(IsRequired = false)]
|
||||
public List<MapSpawnerDataItem> MapSpawners = new List<MapSpawnerDataItem>();
|
||||
|
||||
[DataMember(IsRequired = false)]
|
||||
public List<SupplyCrateDataItem> SupplyCrates = new List<SupplyCrateDataItem>();
|
||||
|
||||
[DataMember(IsRequired = false)]
|
||||
public List<InventoryDataItem> Inventories = new List<InventoryDataItem>();
|
||||
|
||||
[DataMember(IsRequired = false)]
|
||||
public List<GameMapDataItem> GameMaps = new List<GameMapDataItem>();
|
||||
|
||||
[DataMember(IsRequired = false)]
|
||||
public List<TotalConversionDataItem> Mods = new List<TotalConversionDataItem>();
|
||||
|
||||
[DataMember(IsRequired = false)]
|
||||
public List<PlayerLevelDataItem> PlayerLevels = new List<PlayerLevelDataItem>();
|
||||
|
||||
[DataMember(IsRequired = false)]
|
||||
public int PlayerAdditionalLevels = 0;
|
||||
|
||||
[DataMember(IsRequired = false)]
|
||||
public List<CreatureLevelDataItem> CreatureLevels = new List<CreatureLevelDataItem>();
|
||||
|
||||
[DataMember(IsRequired = false)]
|
||||
public List<BranchDataItem> Branches = new List<BranchDataItem>();
|
||||
|
||||
[DataMember(IsRequired = false)]
|
||||
public List<EventDataItem> Events = new List<EventDataItem>();
|
||||
|
||||
[DataMember(IsRequired = false)]
|
||||
public List<OfficialModItem> OfficialMods = new List<OfficialModItem>();
|
||||
|
||||
public static MainGameData Load(string file, bool isUserData)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(file) || !File.Exists(file))
|
||||
return null;
|
||||
|
||||
var data = JsonUtils.DeserializeFromFile<MainGameData>(file);
|
||||
if (data != null)
|
||||
{
|
||||
data.GameDataFile = file;
|
||||
data.Creatures.ForEach(c => c.IsUserData = isUserData);
|
||||
data.Engrams.ForEach(c => c.IsUserData = isUserData);
|
||||
data.Items.ForEach(c => c.IsUserData = isUserData);
|
||||
data.MapSpawners.ForEach(c => c.IsUserData = isUserData);
|
||||
data.SupplyCrates.ForEach(c => c.IsUserData = isUserData);
|
||||
data.Inventories.ForEach(c => c.IsUserData = isUserData);
|
||||
data.GameMaps.ForEach(c => c.IsUserData = isUserData);
|
||||
data.Mods.ForEach(c => c.IsUserData = isUserData);
|
||||
data.Branches.ForEach(c => c.IsUserData = isUserData);
|
||||
data.Events.ForEach(c => c.IsUserData = isUserData);
|
||||
data.OfficialMods.ForEach(c => c.IsUserData = isUserData);
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
public class BaseDataItem
|
||||
{
|
||||
[DataMember]
|
||||
public string ClassName = string.Empty;
|
||||
[DataMember]
|
||||
public string Description = string.Empty;
|
||||
[DataMember]
|
||||
public string Mod = string.Empty;
|
||||
|
||||
public bool IsUserData = false;
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
public class CreatureDataItem : BaseDataItem
|
||||
{
|
||||
[DataMember]
|
||||
public string NameTag = string.Empty;
|
||||
[DataMember]
|
||||
public bool IsSpawnable = false;
|
||||
[DataMember(Name = "IsTameable")]
|
||||
public string IsTameableString
|
||||
{
|
||||
get
|
||||
{
|
||||
return IsTameable.ToString();
|
||||
}
|
||||
set
|
||||
{
|
||||
if (!Enum.TryParse(value, true, out IsTameable))
|
||||
IsTameable = DinoTamable.False;
|
||||
}
|
||||
}
|
||||
|
||||
public DinoTamable IsTameable = DinoTamable.False;
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
public class EngramDataItem : BaseDataItem
|
||||
{
|
||||
[DataMember]
|
||||
public int Level = 0;
|
||||
[DataMember]
|
||||
public int Points = 0;
|
||||
[DataMember]
|
||||
public bool IsTekGram = false;
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
public class ItemDataItem : BaseDataItem
|
||||
{
|
||||
[DataMember]
|
||||
public string Category = string.Empty;
|
||||
[DataMember]
|
||||
public bool IsHarvestable = false;
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
public class MapSpawnerDataItem : BaseDataItem
|
||||
{
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
public class SupplyCrateDataItem : BaseDataItem
|
||||
{
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
public class InventoryDataItem : BaseDataItem
|
||||
{
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
public class GameMapDataItem : BaseDataItem
|
||||
{
|
||||
[DataMember]
|
||||
public bool IsSotF = false;
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
public class TotalConversionDataItem : BaseDataItem
|
||||
{
|
||||
[DataMember]
|
||||
public bool IsSotF = false;
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
public class PlayerLevelDataItem
|
||||
{
|
||||
[DataMember]
|
||||
public int XPRequired = 0;
|
||||
[DataMember]
|
||||
public int EngramPoints = 0;
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
public class CreatureLevelDataItem
|
||||
{
|
||||
[DataMember]
|
||||
public int XPRequired = 0;
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
public class BranchDataItem
|
||||
{
|
||||
[DataMember]
|
||||
public bool IsSotF = false;
|
||||
[DataMember]
|
||||
public string BranchName = string.Empty;
|
||||
[DataMember]
|
||||
public string Description = string.Empty;
|
||||
|
||||
public bool IsUserData = false;
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
public class EventDataItem
|
||||
{
|
||||
[DataMember]
|
||||
public bool IsSotF = false;
|
||||
[DataMember]
|
||||
public string EventName = string.Empty;
|
||||
[DataMember]
|
||||
public string Description = string.Empty;
|
||||
|
||||
public bool IsUserData = false;
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
public class OfficialModItem
|
||||
{
|
||||
[DataMember]
|
||||
public string ModId = string.Empty;
|
||||
[DataMember]
|
||||
public string ModName = string.Empty;
|
||||
|
||||
public bool IsUserData = false;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue