mirror of
https://github.com/tribufu/ServerManagers
synced 2026-05-18 09:35:48 +00:00
source code checkin
This commit is contained in:
parent
5f8fb2c825
commit
7e57b72e35
675 changed files with 168433 additions and 0 deletions
410
src/ARKServerManager/Lib/GameData.cs
Normal file
410
src/ARKServerManager/Lib/GameData.cs
Normal file
|
|
@ -0,0 +1,410 @@
|
|||
using ServerManagerTool.Common.Model;
|
||||
using ServerManagerTool.Enums;
|
||||
using ServerManagerTool.Lib.ViewModel;
|
||||
using ServerManagerTool.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using WPFSharp.Globalizer;
|
||||
|
||||
namespace ServerManagerTool.Lib
|
||||
{
|
||||
public static class GameData
|
||||
{
|
||||
public const string MOD_ALL = "All";
|
||||
public const string MOD_UNKNOWN = "Unknown";
|
||||
|
||||
public static string MainDataFolder = Path.Combine(Environment.CurrentDirectory, Config.Default.GameDataDir);
|
||||
public static string UserDataFolder = Path.Combine(Config.Default.DataDir, Config.Default.GameDataDir);
|
||||
|
||||
public static int DefaultMaxExperiencePointsDino = 10;
|
||||
public static int DefaultMaxExperiencePointsPlayer = 5;
|
||||
|
||||
private static MainGameData gameData = null;
|
||||
|
||||
public static void Initialize()
|
||||
{
|
||||
// read static game data
|
||||
GameDataUtils.ReadAllData(out gameData, MainDataFolder, Config.Default.GameDataExtension, Config.Default.GameDataApplication);
|
||||
|
||||
// read user game data
|
||||
MainGameData userGameData = new MainGameData();
|
||||
if (!UserDataFolder.Equals(MainDataFolder, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
GameDataUtils.ReadAllData(out userGameData, UserDataFolder, Config.Default.GameDataExtension, Config.Default.GameDataApplication, true);
|
||||
}
|
||||
|
||||
// creatures
|
||||
gameData.Creatures.AddRange(userGameData.Creatures);
|
||||
|
||||
dinoSpawns = gameData.Creatures.ConvertAll(item => new DinoSpawn { ClassName = item.ClassName, Mod = item.Mod, KnownDino = true, DinoNameTag = item.NameTag }).ToArray();
|
||||
dinoMultipliers = gameData.Creatures.ConvertAll(item => new ClassMultiplier { ClassName = item.ClassName }).ToArray();
|
||||
|
||||
// engrams
|
||||
gameData.Engrams.AddRange(userGameData.Engrams);
|
||||
|
||||
engrams = gameData.Engrams.ConvertAll(item => new Engram { EngramClassName = item.ClassName, EngramLevelRequirement = item.Level, EngramPointsCost = item.Points, Mod = item.Mod, KnownEngram = true, IsTekgram = item.IsTekGram }).ToArray();
|
||||
|
||||
// items
|
||||
gameData.Items.AddRange(userGameData.Items);
|
||||
|
||||
items = gameData.Items.ConvertAll(item => new PrimalItem { ClassName = item.ClassName, Mod = item.Mod, KnownItem = true, Category = item.Category }).ToArray();
|
||||
|
||||
// resources
|
||||
resourceMultipliers = gameData.Items.Where(item => item.IsHarvestable).ToList().ConvertAll(item => new ResourceClassMultiplier { ClassName = item.ClassName, Mod = item.Mod, KnownResource = true }).ToArray();
|
||||
|
||||
// map spawners
|
||||
gameData.MapSpawners.AddRange(userGameData.MapSpawners);
|
||||
|
||||
mapSpawners = gameData.MapSpawners.ConvertAll(item => new MapSpawner { ClassName = item.ClassName, Mod = item.Mod, KnownSpawner = true }).ToArray();
|
||||
|
||||
// supply crates
|
||||
gameData.SupplyCrates.AddRange(userGameData.SupplyCrates);
|
||||
|
||||
var crates = gameData.SupplyCrates.ConvertAll(item => new SupplyCrate { ClassName = item.ClassName, Mod = item.Mod, KnownSupplyCrate = true });
|
||||
|
||||
// inventories
|
||||
gameData.Inventories.AddRange(userGameData.Inventories);
|
||||
|
||||
crates.AddRange(gameData.Inventories.ConvertAll(item => new SupplyCrate { ClassName = item.ClassName, Mod = item.Mod, KnownSupplyCrate = true }));
|
||||
|
||||
supplyCrates = crates.ToArray();
|
||||
|
||||
// game maps
|
||||
gameData.GameMaps.AddRange(userGameData.GameMaps);
|
||||
|
||||
if (gameData.GameMaps.Count > 0)
|
||||
{
|
||||
var maps1 = gameMaps.ToList();
|
||||
maps1.AddRange(gameData.GameMaps.Where(item => !item.IsSotF).ToList().ConvertAll(item => new ComboBoxItem { ValueMember = item.ClassName, DisplayMember = item.Description }));
|
||||
var maps2 = gameMapsSotF.ToList();
|
||||
maps2.AddRange(gameData.GameMaps.Where(item => item.IsSotF).ToList().ConvertAll(item => new ComboBoxItem { ValueMember = item.ClassName, DisplayMember = item.Description }));
|
||||
|
||||
gameMaps = maps1.ToArray();
|
||||
gameMapsSotF = maps2.ToArray();
|
||||
}
|
||||
|
||||
// total conversion mods
|
||||
gameData.Mods.AddRange(userGameData.Mods);
|
||||
|
||||
if (gameData.Mods.Count > 0)
|
||||
{
|
||||
var mods1 = totalConversions.ToList();
|
||||
mods1.AddRange(gameData.Mods.Where(item => !item.IsSotF).ToList().ConvertAll(item => new ComboBoxItem { ValueMember = item.ClassName, DisplayMember = item.Description }));
|
||||
var mods2 = totalConversionsSotF.ToList();
|
||||
mods2.AddRange(gameData.Mods.Where(item => item.IsSotF).ToList().ConvertAll(item => new ComboBoxItem { ValueMember = item.ClassName, DisplayMember = item.Description }));
|
||||
|
||||
totalConversions = mods1.ToArray();
|
||||
totalConversionsSotF = mods2.ToArray();
|
||||
}
|
||||
|
||||
// creature levels
|
||||
if (userGameData.CreatureLevels.Count > 0)
|
||||
gameData.CreatureLevels = userGameData.CreatureLevels;
|
||||
|
||||
if (gameData.CreatureLevels.Count > 0)
|
||||
{
|
||||
levelsDino = gameData.CreatureLevels.ConvertAll(item => new Level { XPRequired = item.XPRequired }).ToArray();
|
||||
DefaultMaxExperiencePointsDino = levelsDino.Max(l => l.XPRequired) + 1;
|
||||
}
|
||||
|
||||
// player levels
|
||||
if (userGameData.PlayerLevels.Count > 0)
|
||||
gameData.PlayerLevels = userGameData.PlayerLevels;
|
||||
|
||||
LevelsPlayerAdditional = userGameData.PlayerAdditionalLevels;
|
||||
|
||||
if (gameData.PlayerLevels.Count > 0)
|
||||
{
|
||||
levelsPlayer = gameData.PlayerLevels.ConvertAll(item => new Level { EngramPoints = item.EngramPoints, XPRequired = item.XPRequired }).ToArray();
|
||||
DefaultMaxExperiencePointsPlayer = levelsPlayer.Max(l => l.XPRequired) + 1;
|
||||
}
|
||||
|
||||
if (gameData.PlayerAdditionalLevels > LevelsPlayerAdditional)
|
||||
LevelsPlayerAdditional = gameData.PlayerAdditionalLevels;
|
||||
|
||||
// branches
|
||||
gameData.Branches.AddRange(userGameData.Branches);
|
||||
|
||||
if (gameData.Branches.Count > 0)
|
||||
{
|
||||
var branches1 = branches.ToList();
|
||||
branches1.AddRange(gameData.Branches.Where(item => !item.IsSotF).ToList().ConvertAll(item => new ComboBoxItem { ValueMember = item.BranchName, DisplayMember = item.Description }));
|
||||
var branches2 = branchesSotF.ToList();
|
||||
branches2.AddRange(gameData.Branches.Where(item => item.IsSotF).ToList().ConvertAll(item => new ComboBoxItem { ValueMember = item.BranchName, DisplayMember = item.Description }));
|
||||
|
||||
branches = branches1.ToArray();
|
||||
branchesSotF = branches2.ToArray();
|
||||
}
|
||||
|
||||
// events
|
||||
gameData.Events.AddRange(userGameData.Events);
|
||||
|
||||
if (gameData.Events.Count > 0)
|
||||
{
|
||||
var events1 = events.ToList();
|
||||
events1.AddRange(gameData.Events.Where(item => !item.IsSotF).ToList().ConvertAll(item => new ComboBoxItem { ValueMember = item.EventName, DisplayMember = item.Description }));
|
||||
var events2 = eventsSotF.ToList();
|
||||
events2.AddRange(gameData.Events.Where(item => item.IsSotF).ToList().ConvertAll(item => new ComboBoxItem { ValueMember = item.EventName, DisplayMember = item.Description }));
|
||||
|
||||
events = events1.ToArray();
|
||||
eventsSotF = events2.ToArray();
|
||||
}
|
||||
|
||||
// official mods
|
||||
gameData.OfficialMods.AddRange(userGameData.OfficialMods);
|
||||
|
||||
if (gameData.OfficialMods.Count > 0)
|
||||
{
|
||||
ModUtils.AddOfficialMods(gameData.OfficialMods.Where(m => !string.IsNullOrWhiteSpace(m.ModId)).Select(m => m.ModId));
|
||||
}
|
||||
}
|
||||
|
||||
public static string FriendlyNameForClass(string className, bool returnNullIfNotFound = false) => string.IsNullOrWhiteSpace(className) ? (returnNullIfNotFound ? null : string.Empty) : GlobalizedApplication.Instance.GetResourceString(className) ?? (returnNullIfNotFound ? null : className);
|
||||
|
||||
#region Creatures
|
||||
private static DinoSpawn[] dinoSpawns = new DinoSpawn[0];
|
||||
|
||||
public static IEnumerable<DinoSpawn> GetDinoSpawns() => dinoSpawns.Select(d => d.Duplicate<DinoSpawn>());
|
||||
|
||||
public static IEnumerable<NPCReplacement> GetNPCReplacements() => dinoSpawns.Select(d => new NPCReplacement() { FromClassName = d.ClassName, ToClassName = d.ClassName });
|
||||
|
||||
public static bool IsSpawnableForClass(string className) => gameData?.Creatures?.FirstOrDefault(c => c.ClassName.Equals(className))?.IsSpawnable ?? true;
|
||||
|
||||
public static DinoTamable IsTameableForClass(string className) => gameData?.Creatures?.FirstOrDefault(c => c.ClassName.Equals(className))?.IsTameable ?? DinoTamable.True;
|
||||
|
||||
public static string NameTagForClass(string className, bool returnEmptyIfNotFound = false) => gameData?.Creatures?.FirstOrDefault(c => c.ClassName.Equals(className))?.NameTag ?? (returnEmptyIfNotFound ? string.Empty : className);
|
||||
|
||||
public static string FriendlyCreatureNameForClass(string className, bool returnEmptyIfNotFound = false) => string.IsNullOrWhiteSpace(className) ? string.Empty : GlobalizedApplication.Instance.GetResourceString(className) ?? gameData?.Creatures?.FirstOrDefault(i => i.ClassName.Equals(className))?.Description ?? (returnEmptyIfNotFound ? string.Empty : className);
|
||||
|
||||
private static ClassMultiplier[] dinoMultipliers = new ClassMultiplier[0];
|
||||
|
||||
public static IEnumerable<ClassMultiplier> GetDinoMultipliers() => dinoMultipliers.Select(d => d.Duplicate<ClassMultiplier>());
|
||||
#endregion
|
||||
|
||||
#region Engrams
|
||||
private static Engram[] engrams = new Engram[0];
|
||||
|
||||
public static IEnumerable<Engram> GetEngrams() => engrams.Select(d => d.Duplicate());
|
||||
|
||||
public static IEnumerable<EngramEntry> GetEngramEntries() => engrams.Select(d => new EngramEntry() { EngramClassName = d.EngramClassName, EngramLevelRequirement = d.EngramLevelRequirement, EngramPointsCost = d.EngramPointsCost });
|
||||
|
||||
public static Engram GetEngramForClass(string className) => engrams.FirstOrDefault(e => e.EngramClassName.Equals(className));
|
||||
|
||||
public static bool HasEngramForClass(string className) => engrams.Any(e => e.EngramClassName.Equals(className));
|
||||
|
||||
public static bool IsTekgram(string className) => engrams.Any(e => e.EngramClassName.Equals(className) && e.IsTekgram);
|
||||
|
||||
public static string FriendlyEngramNameForClass(string className, bool returnEmptyIfNotFound = false) => string.IsNullOrWhiteSpace(className) ? string.Empty : GlobalizedApplication.Instance.GetResourceString(className) ?? gameData?.Engrams?.FirstOrDefault(i => i.ClassName.Equals(className))?.Description ?? (returnEmptyIfNotFound ? string.Empty : className);
|
||||
#endregion
|
||||
|
||||
#region Items
|
||||
private static PrimalItem[] items = new PrimalItem[0];
|
||||
|
||||
public static IEnumerable<PrimalItem> GetItems() => items.Select(d => d.Duplicate());
|
||||
|
||||
public static PrimalItem GetItemForClass(string className) => items.FirstOrDefault(e => e.ClassName.Equals(className));
|
||||
|
||||
public static bool HasItemForClass(string className) => items.Any(e => e.ClassName.Equals(className));
|
||||
|
||||
public static string FriendlyItemNameForClass(string className, bool returnEmptyIfNotFound = false) => string.IsNullOrWhiteSpace(className) ? string.Empty : GlobalizedApplication.Instance.GetResourceString(className) ?? gameData?.Items?.FirstOrDefault(i => i.ClassName.Equals(className))?.Description ?? (returnEmptyIfNotFound ? string.Empty : className);
|
||||
#endregion
|
||||
|
||||
#region Resources
|
||||
private static ResourceClassMultiplier[] resourceMultipliers = new ResourceClassMultiplier[0];
|
||||
|
||||
public static IEnumerable<ResourceClassMultiplier> GetResourceMultipliers() => resourceMultipliers.Select(d => d.Duplicate<ResourceClassMultiplier>());
|
||||
|
||||
public static ResourceClassMultiplier GetResourceMultiplierForClass(string className) => resourceMultipliers.FirstOrDefault(e => e.ClassName.Equals(className));
|
||||
|
||||
public static bool HasResourceMultiplierForClass(string className) => resourceMultipliers.Any(e => e.ClassName.Equals(className));
|
||||
|
||||
public static string FriendlyResourceNameForClass(string className) => string.IsNullOrWhiteSpace(className) ? string.Empty : GlobalizedApplication.Instance.GetResourceString(className) ?? gameData?.Items?.FirstOrDefault(i => i.ClassName.Equals(className) && i.IsHarvestable)?.Description ?? className;
|
||||
#endregion
|
||||
|
||||
#region Map Spawners
|
||||
private static MapSpawner[] mapSpawners = new MapSpawner[0];
|
||||
|
||||
public static IEnumerable<MapSpawner> GetMapSpawners() => mapSpawners.Select(d => d.Duplicate());
|
||||
|
||||
public static MapSpawner GetMapSpawnerForClass(string className) => mapSpawners.FirstOrDefault(e => e.ClassName.Equals(className));
|
||||
|
||||
public static bool HasMapSpawnerForClass(string className) => mapSpawners.Any(e => e.ClassName.Equals(className));
|
||||
|
||||
public static string FriendlyMapSpawnerNameForClass(string className, bool returnEmptyIfNotFound = false) => string.IsNullOrWhiteSpace(className) ? string.Empty : GlobalizedApplication.Instance.GetResourceString(className) ?? gameData?.MapSpawners?.FirstOrDefault(i => i.ClassName.Equals(className))?.Description ?? (returnEmptyIfNotFound ? string.Empty : className);
|
||||
#endregion
|
||||
|
||||
#region Supply Crates
|
||||
private static SupplyCrate[] supplyCrates = new SupplyCrate[0];
|
||||
|
||||
public static IEnumerable<SupplyCrate> GetSupplyCrates() => supplyCrates.Select(d => d.Duplicate());
|
||||
|
||||
public static SupplyCrate GetSupplyCrateForClass(string className) => supplyCrates.FirstOrDefault(e => e.ClassName.Equals(className));
|
||||
|
||||
public static bool HasSupplyCrateForClass(string className) => supplyCrates.Any(e => e.ClassName.Equals(className));
|
||||
|
||||
public static string FriendlySupplyCrateNameForClass(string className, bool returnEmptyIfNotFound = false) => string.IsNullOrWhiteSpace(className) ? string.Empty : GlobalizedApplication.Instance.GetResourceString(className) ?? gameData?.SupplyCrates?.FirstOrDefault(i => i.ClassName.Equals(className))?.Description ?? (returnEmptyIfNotFound ? string.Empty : className);
|
||||
#endregion
|
||||
|
||||
#region Game Maps
|
||||
private static ComboBoxItem[] gameMaps = new[]
|
||||
{
|
||||
new ComboBoxItem { ValueMember="", DisplayMember="" },
|
||||
};
|
||||
|
||||
public static IEnumerable<ComboBoxItem> GetGameMaps() => gameMaps.Select(d => d.Duplicate());
|
||||
|
||||
public static string FriendlyMapNameForClass(string className, bool returnEmptyIfNotFound = false) => string.IsNullOrWhiteSpace(className) ? string.Empty : GlobalizedApplication.Instance.GetResourceString(className) ?? gameData?.GameMaps?.FirstOrDefault(i => i.ClassName.Equals(className) && !i.IsSotF)?.Description ?? (returnEmptyIfNotFound ? string.Empty : className);
|
||||
|
||||
private static ComboBoxItem[] gameMapsSotF = new[]
|
||||
{
|
||||
new ComboBoxItem { ValueMember="", DisplayMember="" },
|
||||
};
|
||||
|
||||
public static IEnumerable<ComboBoxItem> GetGameMapsSotF() => gameMapsSotF.Select(d => d.Duplicate());
|
||||
|
||||
public static string FriendlyMapSotFNameForClass(string className, bool returnEmptyIfNotFound = false) => string.IsNullOrWhiteSpace(className) ? string.Empty : GlobalizedApplication.Instance.GetResourceString(className) ?? gameData?.GameMaps?.FirstOrDefault(i => i.ClassName.Equals(className) && i.IsSotF)?.Description ?? (returnEmptyIfNotFound ? string.Empty : className);
|
||||
#endregion
|
||||
|
||||
#region Total Conversions
|
||||
private static ComboBoxItem[] totalConversions = new[]
|
||||
{
|
||||
new ComboBoxItem { ValueMember="", DisplayMember="" },
|
||||
};
|
||||
|
||||
public static IEnumerable<ComboBoxItem> GetTotalConversions() => totalConversions.Select(d => d.Duplicate());
|
||||
|
||||
public static string FriendlyTotalConversionNameForClass(string className, bool returnEmptyIfNotFound = false) => string.IsNullOrWhiteSpace(className) ? string.Empty : GlobalizedApplication.Instance.GetResourceString(className) ?? gameData?.Mods?.FirstOrDefault(i => i.ClassName.Equals(className) && !i.IsSotF)?.Description ?? (returnEmptyIfNotFound ? string.Empty : className);
|
||||
|
||||
private static ComboBoxItem[] totalConversionsSotF = new[]
|
||||
{
|
||||
new ComboBoxItem { ValueMember="", DisplayMember="" },
|
||||
};
|
||||
|
||||
public static IEnumerable<ComboBoxItem> GetTotalConversionsSotF() => totalConversionsSotF.Select(d => d.Duplicate());
|
||||
|
||||
public static string FriendlyTotalConversionSotFNameForClass(string className, bool returnEmptyIfNotFound = false) => string.IsNullOrWhiteSpace(className) ? string.Empty : GlobalizedApplication.Instance.GetResourceString(className) ?? gameData?.Mods?.FirstOrDefault(i => i.ClassName.Equals(className) && i.IsSotF)?.Description ?? (returnEmptyIfNotFound ? string.Empty : className);
|
||||
#endregion
|
||||
|
||||
#region Stats Multipliers
|
||||
internal static IEnumerable<float> GetPerLevelStatsMultipliers_DinoWild()
|
||||
{
|
||||
return new float[] { 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f };
|
||||
}
|
||||
|
||||
internal static IEnumerable<float> GetPerLevelStatsMultipliers_DinoTamed()
|
||||
{
|
||||
return new float[] { 0.2f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 0.17f, 1.0f, 1.0f, 1.0f };
|
||||
}
|
||||
|
||||
internal static IEnumerable<float> GetPerLevelStatsMultipliers_DinoTamedAdd()
|
||||
{
|
||||
return new float[] { 0.14f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 0.14f, 1.0f, 1.0f, 1.0f };
|
||||
}
|
||||
|
||||
internal static IEnumerable<float> GetPerLevelStatsMultipliers_DinoTamedAffinity()
|
||||
{
|
||||
return new float[] { 0.44f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 0.44f, 1.0f, 1.0f, 1.0f };
|
||||
}
|
||||
|
||||
internal static IEnumerable<float> GetBaseStatMultipliers_Player()
|
||||
{
|
||||
return new float[] { 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f };
|
||||
}
|
||||
|
||||
internal static IEnumerable<float> GetPerLevelStatsMultipliers_Player()
|
||||
{
|
||||
return new float[] { 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f };
|
||||
}
|
||||
|
||||
internal static bool[] GetStatMultiplierInclusions_DinoWildPerLevel()
|
||||
{
|
||||
return new bool[] { true, true, false, true, true, false, true, true, true, true, false, true };
|
||||
}
|
||||
|
||||
internal static bool[] GetStatMultiplierInclusions_DinoTamedPerLevel()
|
||||
{
|
||||
return new bool[] { true, true, false, true, true, false, true, true, true, true, false, true };
|
||||
}
|
||||
|
||||
internal static bool[] GetStatMultiplierInclusions_DinoTamedAdd()
|
||||
{
|
||||
return new bool[] { true, true, true, true, true, true, true, true, true, true, true, true };
|
||||
}
|
||||
|
||||
internal static bool[] GetStatMultiplierInclusions_DinoTamedAffinity()
|
||||
{
|
||||
return new bool[] { true, true, true, true, true, true, true, true, true, true, true, true };
|
||||
}
|
||||
|
||||
internal static bool[] GetStatMultiplierInclusions_PlayerBase()
|
||||
{
|
||||
return new bool[] { true, true, true, true, true, true, true, true, true, true, true, true };
|
||||
}
|
||||
|
||||
internal static bool[] GetStatMultiplierInclusions_PlayerPerLevel()
|
||||
{
|
||||
return new bool[] { true, true, false, true, true, true, true, true, true, true, true, true };
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Levels
|
||||
private static Level[] levelsDino = new[]
|
||||
{
|
||||
new Level { XPRequired=10 },
|
||||
};
|
||||
|
||||
private static Level[] levelsPlayer = new[]
|
||||
{
|
||||
new Level { XPRequired=5, EngramPoints=8 },
|
||||
};
|
||||
|
||||
public static IEnumerable<Level> LevelsDino => levelsDino.Select(l => l.Duplicate());
|
||||
|
||||
public static IEnumerable<Level> LevelsPlayer => levelsPlayer.Select(l => l.Duplicate());
|
||||
|
||||
public static int LevelsPlayerAdditional = 0;
|
||||
#endregion
|
||||
|
||||
#region Branches
|
||||
private static ComboBoxItem[] branches = new[]
|
||||
{
|
||||
new ComboBoxItem { ValueMember="", DisplayMember=FriendlyNameForClass(Config.Default.DefaultServerBranchName) },
|
||||
};
|
||||
|
||||
public static IEnumerable<ComboBoxItem> GetBranches() => branches.Select(d => d.Duplicate());
|
||||
|
||||
public static string FriendlyBranchName(string branchName, bool returnEmptyIfNotFound = false) => string.IsNullOrWhiteSpace(branchName) ? string.Empty : GlobalizedApplication.Instance.GetResourceString(branchName) ?? gameData?.Branches?.FirstOrDefault(i => i.BranchName.Equals(branchName) && !i.IsSotF)?.Description ?? (returnEmptyIfNotFound ? string.Empty : branchName);
|
||||
|
||||
private static ComboBoxItem[] branchesSotF = new[]
|
||||
{
|
||||
new ComboBoxItem { ValueMember="", DisplayMember=FriendlyNameForClass(Config.Default.DefaultServerBranchName) },
|
||||
};
|
||||
|
||||
public static IEnumerable<ComboBoxItem> GetBranchesSotF() => branchesSotF.Select(d => d.Duplicate());
|
||||
|
||||
public static string FriendlyBranchSotFName(string branchName, bool returnEmptyIfNotFound = false) => string.IsNullOrWhiteSpace(branchName) ? string.Empty : GlobalizedApplication.Instance.GetResourceString(branchName) ?? gameData?.Branches?.FirstOrDefault(i => i.BranchName.Equals(branchName) && i.IsSotF)?.Description ?? (returnEmptyIfNotFound ? string.Empty : branchName);
|
||||
#endregion
|
||||
|
||||
#region Events
|
||||
private static ComboBoxItem[] events = new[]
|
||||
{
|
||||
new ComboBoxItem { ValueMember="", DisplayMember=string.Empty },
|
||||
};
|
||||
|
||||
public static IEnumerable<ComboBoxItem> GetEvents() => events.Select(d => d.Duplicate());
|
||||
|
||||
public static string FriendlyEventName(string eventName, bool returnEmptyIfNotFound = false) => string.IsNullOrWhiteSpace(eventName) ? string.Empty : GlobalizedApplication.Instance.GetResourceString(eventName) ?? gameData?.Events?.FirstOrDefault(i => i.EventName.Equals(eventName) && !i.IsSotF)?.Description ?? (returnEmptyIfNotFound ? string.Empty : eventName);
|
||||
|
||||
private static ComboBoxItem[] eventsSotF = new[]
|
||||
{
|
||||
new ComboBoxItem { ValueMember="", DisplayMember=string.Empty },
|
||||
};
|
||||
|
||||
public static IEnumerable<ComboBoxItem> GetEventsSotF() => eventsSotF.Select(d => d.Duplicate());
|
||||
|
||||
public static string FriendlyEventSotFName(string eventName, bool returnEmptyIfNotFound = false) => string.IsNullOrWhiteSpace(eventName) ? string.Empty : GlobalizedApplication.Instance.GetResourceString(eventName) ?? gameData?.Events?.FirstOrDefault(i => i.EventName.Equals(eventName) && i.IsSotF)?.Description ?? (returnEmptyIfNotFound ? string.Empty : eventName);
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue