Initial commit

This commit is contained in:
GrapeshotGames 2018-12-22 10:02:57 -05:00
parent 1aecbe009b
commit a172b4ab3b
469 changed files with 119758 additions and 0 deletions

View file

@ -0,0 +1,64 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{8A276721-FE14-4414-8C0A-1B3ECC282195}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>AtlasGridDataLibrary</RootNamespace>
<AssemblyName>AtlasGridDataLibrary</AssemblyName>
<TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json, Version=11.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.11.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="DeploymentOverrideAttribute.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ServerGrid.cs" />
<Compile Include="ServerGrid_ServerOnly.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View file

@ -0,0 +1,42 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
namespace AtlasGridDataLibrary
{
public class DeploymentAttribute : Attribute
{
}
public class DeploymentOverrideAttribute : DeploymentAttribute
{
}
public class DeploymentConstAttribute : DeploymentAttribute
{
}
public class DeploymentOverrideShouldSerializeContractResolver : DefaultContractResolver
{
//public new static readonly ShouldSerializeContractResolver Instance = new ShouldSerializeContractResolver();
protected override JsonProperty CreateProperty(MemberInfo member, MemberSerialization memberSerialization)
{
JsonProperty property = base.CreateProperty(member, memberSerialization);
bool bShouldSersialize = member.GetCustomAttributes().OfType<DeploymentAttribute>().Any();
property.ShouldSerialize =
instance =>
{
return bShouldSersialize;
};
return property;
}
}
}

View file

@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
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("AtlasGridDataLibrary")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("AtlasGridDataLibrary")]
[assembly: AssemblyCopyright("Copyright © 2018")]
[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("8a276721-fe14-4414-8c0a-1b3ecc282195")]
// 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.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View file

@ -0,0 +1,381 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AtlasGridDataLibrary
{
public static class AtlasDataGridLoader
{
private static string GetBaseDir()
{
return Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location) + "//";//GetExecutingAssembly().Location) + "//";
}
public static AtlasGridData Load()
{
return LoadAbsolutePath(GetBaseDir() + "ServerGrid.json");
}
public static AtlasGridData Load(string RelativePath)
{
return LoadAbsolutePath(GetBaseDir() + RelativePath);
}
public static AtlasGridData LoadAbsolutePath(string Path)
{
AtlasGridData LoadedConfig = new AtlasGridData(); //Default Object or null?
string JsonString = File.ReadAllText(Path);
LoadedConfig = JsonConvert.DeserializeObject<AtlasGridData>(JsonString);
return LoadedConfig;
}
public static void Save(AtlasGridData config)
{
SaveAbsolutePath(config, GetBaseDir() + "ServerGrid.json");
}
public static void Save(AtlasGridData config, string RelativePath)
{
SaveAbsolutePath(config, GetBaseDir() + RelativePath);
}
public static void SaveAbsolutePath(AtlasGridData config, string Path)
{
string JsonData = JsonConvert.SerializeObject(config, Formatting.Indented, new JsonSerializerSettings
{
NullValueHandling = NullValueHandling.Ignore
});
File.WriteAllText(Path, JsonData);
}
}
public class AtlasGridData
{
[DeploymentOverrideAttribute]
public string BaseServerArgs = "";
public float gridSize;
[DeploymentOverrideAttribute]
public string MetaWorldURL = "";
[DeploymentOverrideAttribute]
public string WorldFriendlyName = "";
[DeploymentOverrideAttribute]
public string WorldAtlasId = "";
[DeploymentOverrideAttribute]
public string AuthListURL = "";
[DeploymentOverrideAttribute]
public string WorldAtlasPassword = "";
[DeploymentOverrideAttribute]
public string ModIDs = "";
[DeploymentOverrideAttribute]
public string MapImageURL = "";
public int totalGridsX = 0;
public int totalGridsY = 0;
public bool bUseUTCTime = false;
public float columnUTCOffset = 0.0f;
public string Day0 = "";
public float globalTransitionMinZ = 0.0f;
public string AdditionalCmdLineParams;
public Dictionary<string, string> OverrideShooterGameModeDefaultGameIni = new Dictionary<string, string>();
public string LocalS3URL = null;
public string LocalS3AccessKeyId = "";
public string LocalS3SecretKey = "";
public string LocalS3BucketName = "";
public string LocalS3Region = "";
public string globalGameplaySetup = "";
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Populate)]
public TribeLogConfigInfo TribeLogConfig = new TribeLogConfigInfo();
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Populate)]
public SharedLogConfigInfo SharedLogConfig = new SharedLogConfigInfo();
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Populate)]
public BackupConfigInfo TravelDataConfig = new BackupConfigInfo();
public List<DatabaseConnectionInfo> DatabaseConnections = new List<DatabaseConnectionInfo>();
[DefaultValue(0.01f)]
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Populate, NullValueHandling = NullValueHandling.Include)]
public float coordsScaling = 0.01f;
[DefaultValue(true)]
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Populate, NullValueHandling = NullValueHandling.Include)]
public bool showServerInfo = true;
[DefaultValue(true)]
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Populate, NullValueHandling = NullValueHandling.Include)]
public bool showDiscoZoneInfo = true;
[DefaultValue(true)]
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Populate, NullValueHandling = NullValueHandling.Include)]
public bool showShipPathsInfo = true;
[DefaultValue(true)]
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Populate, NullValueHandling = NullValueHandling.Include)]
public bool showIslandNames = true;
[DefaultValue(false)]
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Populate, NullValueHandling = NullValueHandling.Include)]
public bool exportPngs = false;
[DefaultValue(true)]
[JsonProperty(DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate)]
public bool showLines = true;
[DefaultValue(false)]
[JsonProperty(DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate)]
public bool alphaBackground = false;
[DefaultValue(false)]
[JsonProperty(DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate)]
public bool showBackground = false;
[DefaultValue(false)]
[JsonProperty(DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate)]
public bool showForeground = false;
public string backgroundImgPath = null;
public string foregroundImgPath = null;
[DefaultValue("Resources/discoZoneBox.png")]
public string discoZonesImagePath = null;
[DeploymentConstAttribute]
public List<ServerData> servers = new List<ServerData>();
// public List<ServerSerializationObject> originalServers = new List<ServerSerializationObject>();
public List<SpawnerInfoData> spawnerOverrideTemplates = new List<SpawnerInfoData>();
[DefaultValue(0)]
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Populate)]
public int idGenerator;
[DefaultValue(0)]
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Populate)]
public int regionsIdGenerator;
[DefaultValue(0)]
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Populate)]
public int shipPathsIdGenerator;
public List<ShipPathData> shipPaths = new List<ShipPathData>();
public DateTime lastImageOverride;
public List<ServerTemplateData> serverTemplates = new List<ServerTemplateData>();
}
// ==== SERVER INFO ===========================================
public class ServerData
{
[DeploymentConstAttribute]
public int gridX = 0;
[DeploymentConstAttribute]
public int gridY = 0;
[DeploymentOverrideAttribute]
public string MachineIdTag = "";
[DeploymentOverrideAttribute]
public string ip = "127.0.0.1";
[DeploymentOverrideAttribute]
public string name = "Unnamed Server";
[DeploymentOverrideAttribute]
public int port = 50000;
[DeploymentOverrideAttribute]
public int gamePort = 6666;
[DefaultValue(27000)]
[DeploymentOverrideAttribute]
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Populate)]
public int seamlessDataPort = 27000;
public bool isHomeServer = false;
public string AdditionalCmdLineParams = "";
public Dictionary<string, string> OverrideShooterGameModeDefaultGameIni = new Dictionary<string, string>();
public int floorZDist = 0;
public int utcOffset = 0;
public int transitionMinZ = 0;
public string GlobalBiomeSeamlessServerGridPreOffsetValues = "";
public string GlobalBiomeSeamlessServerGridPreOffsetValuesOceanWater = "";
public string OceanDinoDepthEntriesOverride = "";
[DefaultValue("")]
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
public string OceanEpicSpawnEntriesOverrideValues = "";
public string oceanFloatsamCratesOverride = "";
public string treasureMapLootTablesOverride = "";
public string oceanEpicSpawnEntriesOverrideTemplateName = "";
public string NPCShipSpawnEntriesOverrideTemplateName = "";
public string regionOverrides = "";
public float waterColorR = 0;
public float waterColorG = 0;
public float waterColorB = 0;
public int skyStyleIndex = 0;
[DefaultValue("")]
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
public string ServerCustomDatas1 = "";
[DefaultValue("")]
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
public string ServerCustomDatas2 = "";
[DefaultValue("")]
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
public string ClientCustomDatas1 = "";
[DefaultValue("")]
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
public string ClientCustomDatas2 = "";
public List<SublevelSerializationObject> sublevels = new List<SublevelSerializationObject>();
public DateTime lastModified;
public DateTime lastImageOverride;
public bool islandLocked = false;
public bool discoLocked = false;
public bool pathsLocked = false;
public List<string> extraSublevels = new List<string>();
public List<string> totalExtraSublevels = new List<string>();
//[DefaultValue(null)]
//[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore, NullValueHandling = NullValueHandling.Ignore)]
public List<IslandInstanceData> islandInstances = new List<IslandInstanceData>();
public List<DiscoveryZoneData> discoZones = new List<DiscoveryZoneData>();
public List<SpawnRegionData> spawnRegions = new List<SpawnRegionData>();
[DefaultValue("")]
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
public string serverTemplateName = "";
public string GetGridLocationHumanReadable()
{
const string letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
var Column = "";
if (gridX >= letters.Length)
Column += letters[gridX / letters.Length - 1];
Column += letters[gridX % letters.Length];
return Column + (gridY + 1);
}
}
public class ServerTemplateData : ServerData
{
public float templateColorR = 0;
public float templateColorG = 0;
public float templateColorB = 0;
}
public class SublevelSerializationObject
{
public string name = "";
public float additionalTranslationX = 0;
public float additionalTranslationY = 0;
public float additionalTranslationZ = 0;
public float additionalRotationPitch = 0;
public float additionalRotationYaw = 0;
public float additionalRotationRoll = 0;
public int id = 0;
public int landscapeMaterialOverride = -1;
}
public abstract class MoveableObjectData
{
public float worldX, worldY;
public float rotation;
}
public class IslandInstanceData : MoveableObjectData
{
public string name;
public int id;
public Dictionary<string, string> spawnerOverrides = new Dictionary<string, string>();
public float minTreasureQuality = -1;
public float maxTreasureQuality = -1;
public bool useNpcVolumesForTreasures = false;
public bool useLevelBoundsForTreasures = true;
public bool prioritizeVolumesForTreasures = false;
public string islandTreasureBottleSupplyCrateOverrides = "";
[DefaultValue(-1)]
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
public int spawnPointRegionOverride = -1;
[DefaultValue(1.0f)]
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
public float finalNPCLevelMultiplier = 1.0f;
[DefaultValue(0)]
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
public int finalNPCLevelOffset = 0;
[DefaultValue(1.0f)]
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
public float instanceTreasureQualityMultiplier = 1.0f;
[DefaultValue(0.0f)]
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
public float instanceTreasureQualityAddition = 0.0f;
[DefaultValue("")]
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
public string IslandInstanceCustomDatas1 = "";
[DefaultValue("")]
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
public string IslandInstanceCustomDatas2 = "";
[DefaultValue("")]
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
public string IslandInstanceClientCustomDatas1 = "";
[DefaultValue("")]
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
public string IslandInstanceClientCustomDatas2 = "";
}
public class DiscoveryZoneData : MoveableObjectData
{
public string name;
[NonSerialized]
public float startWorldX;
[NonSerialized]
public float startWorldY;
public float sizeX, sizeY, sizeZ;
public int id;
public float xp;
public bool bIsManuallyPlaced = false;
[DefaultValue("")]
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
public string ManualVolumeName = "";
public int explorerNoteIndex;
public bool allowSea;
}
public class SpawnRegionData
{
public string name { get; set; }
[NonSerialized]
public int X;
[NonSerialized]
public int Y;
}
// ==== MISC INFO ===========================================
public class SpawnerInfoData
{
public string Name { get; set; }
public string NPCSpawnEntries { get; set; }
public string NPCSpawnLimits { get; set; }
public float MaxDesiredNumEnemiesMultiplier { get; set; }
}
public class ShipPathData
{
public List<BezierNodeData> Nodes = new List<BezierNodeData>();
public int PathId;
public bool isLooping = false;
public string PathName = "";
public string AutoSpawnShipClass = "";
public int AutoSpawnEveryUTCInterval = 0;
[DefaultValue(true)]
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Populate, NullValueHandling = NullValueHandling.Include)]
public bool autoSpawn = true;
}
public class BezierNodeData : MoveableObjectData
{
[JsonIgnore]
public ShipPathData shipPath;
public float controlPointsDistance;
}
}

View file

@ -0,0 +1,127 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AtlasGridDataLibrary
{
public class ServerGrid_ServerOnlyData
{
public string LocalS3URL = "";
public string LocalS3AccessKeyId = "";
public string LocalS3SecretKey = "";
public string LocalS3BucketName = "";
public string LocalS3Region = "";
public TribeLogConfigInfo TribeLogConfig = new TribeLogConfigInfo();
public SharedLogConfigInfo SharedLogConfig = new SharedLogConfigInfo();
public BackupConfigInfo TravelDataConfig = new BackupConfigInfo();
public List<DatabaseConnectionInfo> DatabaseConnections = new List<DatabaseConnectionInfo>();
public static AtlasGridData LoadAbsolutePath(string Path)
{
AtlasGridData LoadedConfig = new AtlasGridData();
string JsonString = File.ReadAllText(Path);
LoadedConfig = JsonConvert.DeserializeObject<AtlasGridData>(JsonString);
return LoadedConfig;
}
//public static void SaveAbsolutePath(AtlasGridData config, string Path)
//{
// string JsonData = JsonConvert.SerializeObject(config, Formatting.Indented, new JsonSerializerSettings
// {
// NullValueHandling = NullValueHandling.Ignore
// });
// File.WriteAllText(Path, JsonData);
//}
}
public class SharedLogConfigData
{
[DefaultValue(60)]
public int FetchRateSec = 60;
[DefaultValue(900)]
public int SnapshotCleanupSec = 900;
[DefaultValue(1800)]
public int SnapshotRateSec = 1800;
[DefaultValue(48)]
public int SnapshotExpirationHours = 48;
}
public class BackupConfigInfo
{
[DefaultValue("off")]
public string BackupMode = "off";
[DefaultValue(10)]
public int MaxFileHistory = 10; // shared log and tribe log
[DefaultValue("")]
public string HttpBackupURL = "";
[DefaultValue("")]
public string HttpAPIKey = "";
[DefaultValue("")]
public string S3KeyPrefix = "";
public void CopyFrom(BackupConfigInfo In)
{
BackupMode = In.BackupMode;
MaxFileHistory = In.MaxFileHistory;
HttpBackupURL = In.HttpBackupURL;
HttpAPIKey = In.HttpAPIKey;
S3KeyPrefix = In.S3KeyPrefix;
}
}
public class TribeLogConfigInfo : BackupConfigInfo
{
[DefaultValue(1000)]
public int MaxRedisEntries = 1000;
public void CopyFrom(TribeLogConfigInfo In)
{
base.CopyFrom(In);
MaxRedisEntries = In.MaxRedisEntries;
}
}
public class SharedLogConfigInfo : BackupConfigInfo
{
[DefaultValue(60)]
public int FetchRateSec = 60;
[DefaultValue(900)]
public int SnapshotCleanupSec = 900;
[DefaultValue(1800)]
public int SnapshotRateSec = 1800;
[DefaultValue(48)]
public int SnapshotExpirationHours = 48;
public void CopyFrom(SharedLogConfigInfo In)
{
base.CopyFrom(In);
FetchRateSec = In.FetchRateSec;
SnapshotCleanupSec = In.SnapshotCleanupSec;
SnapshotRateSec = In.SnapshotRateSec;
SnapshotExpirationHours = In.SnapshotExpirationHours;
}
}
public class DatabaseConnectionInfo
{
public string Name = ""; //public string Name { get; set; }
public string URL = ""; //public string URL { get; set; }
public int Port = 0; //public int Port { get; set; }
public string Password = ""; //public string Password { get; set; }
}
}

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Newtonsoft.Json" version="11.0.2" targetFramework="net451" />
</packages>