feat(Documents) Notes/Docs page improvements and warning cleanup
This commit is contained in:
+121
-83
@@ -1,40 +1,37 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Model.Immortal.Entity.Data;
|
||||
using Model.Immortal.Entity.Parts;
|
||||
using Model.Immortal.Types;
|
||||
using Model.Entity.Data;
|
||||
using Model.Entity.Parts;
|
||||
using Model.Types;
|
||||
using YamlDotNet.Serialization;
|
||||
|
||||
namespace Model.Immortal.Entity;
|
||||
namespace Model.Entity;
|
||||
|
||||
public class EntityModel {
|
||||
public class EntityModel
|
||||
{
|
||||
public static readonly string GameVersion = "0.0.6.8900a";
|
||||
|
||||
private static Dictionary<string, EntityModel> _database;
|
||||
private static Dictionary<string, EntityModel> _database;
|
||||
|
||||
private static List<EntityModel> entityModels;
|
||||
private static List<EntityModel> entityModels;
|
||||
|
||||
private static List<EntityModel> entityModelsOnlyHotkey;
|
||||
private static List<EntityModel> entityModelsOnlyHotkey;
|
||||
|
||||
private static Dictionary<string, List<EntityModel>> entityModelsByHotkey;
|
||||
private static Dictionary<string, List<EntityModel>> entityModelsByHotkey;
|
||||
|
||||
|
||||
public EntityModel() { }
|
||||
public EntityModel()
|
||||
{
|
||||
}
|
||||
|
||||
public EntityModel(string data, string entity, bool isSpeculative = false) {
|
||||
public EntityModel(string data, string entity, bool isSpeculative = false)
|
||||
{
|
||||
DataType = data;
|
||||
EntityType = entity;
|
||||
IsSpeculative = isSpeculative;
|
||||
}
|
||||
|
||||
public string AsYaml() {
|
||||
var stringBuilder = new StringBuilder();
|
||||
var serializer = new Serializer();
|
||||
stringBuilder.AppendLine(serializer.Serialize(this));
|
||||
return stringBuilder.ToString();
|
||||
}
|
||||
|
||||
public string DataType { get; set; }
|
||||
|
||||
// TODO Serilization currently being used for build orders
|
||||
@@ -45,50 +42,64 @@ public class EntityModel {
|
||||
public bool IsSpeculative { get; set; }
|
||||
|
||||
public string Descriptive { get; set; } = DescriptiveType.None;
|
||||
|
||||
public EntityModel Clone() {
|
||||
|
||||
public string AsYaml()
|
||||
{
|
||||
var stringBuilder = new StringBuilder();
|
||||
var serializer = new Serializer();
|
||||
stringBuilder.AppendLine(serializer.Serialize(this));
|
||||
return stringBuilder.ToString();
|
||||
}
|
||||
|
||||
public EntityModel Clone()
|
||||
{
|
||||
return (EntityModel)MemberwiseClone();
|
||||
}
|
||||
|
||||
|
||||
public void Copy(EntityModel entity) {
|
||||
|
||||
public void Copy(EntityModel entity)
|
||||
{
|
||||
DataType = entity.DataType;
|
||||
EntityType = entity.EntityType;
|
||||
EntityParts = entity.EntityParts.ToList();
|
||||
}
|
||||
|
||||
|
||||
public EntityModel AddPart(IEntityPartInterface unitPart) {
|
||||
|
||||
public EntityModel AddPart(IEntityPartInterface unitPart)
|
||||
{
|
||||
EntityParts.Add(unitPart);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public static Dictionary<string, EntityModel> GetDictionary() {
|
||||
|
||||
public static Dictionary<string, EntityModel> GetDictionary()
|
||||
{
|
||||
if (_database == null) _database = DATA.Get();
|
||||
|
||||
return _database;
|
||||
}
|
||||
|
||||
|
||||
public static EntityModel Get(string entity) {
|
||||
|
||||
public static EntityModel Get(string entity)
|
||||
{
|
||||
if (_database == null) _database = DATA.Get();
|
||||
|
||||
return _database[entity];
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public static List<EntityModel> GetList() {
|
||||
|
||||
public static List<EntityModel> GetList()
|
||||
{
|
||||
if (entityModels == null) entityModels = DATA.Get().Values.ToList();
|
||||
|
||||
return entityModels;
|
||||
}
|
||||
|
||||
|
||||
public static List<EntityModel> GetListOnlyHotkey() {
|
||||
if (entityModelsOnlyHotkey == null) {
|
||||
|
||||
public static List<EntityModel> GetListOnlyHotkey()
|
||||
{
|
||||
if (entityModelsOnlyHotkey == null)
|
||||
{
|
||||
entityModelsOnlyHotkey = new List<EntityModel>();
|
||||
|
||||
foreach (var entity in DATA.Get().Values)
|
||||
@@ -99,14 +110,18 @@ public class EntityModel {
|
||||
return entityModelsOnlyHotkey;
|
||||
}
|
||||
|
||||
|
||||
public static Dictionary<string, List<EntityModel>> GetEntitiesByHotkey() {
|
||||
if (entityModelsByHotkey == null) {
|
||||
|
||||
public static Dictionary<string, List<EntityModel>> GetEntitiesByHotkey()
|
||||
{
|
||||
if (entityModelsByHotkey == null)
|
||||
{
|
||||
entityModelsByHotkey = new Dictionary<string, List<EntityModel>>();
|
||||
|
||||
foreach (var entity in GetList()) {
|
||||
foreach (var entity in GetList())
|
||||
{
|
||||
var entityHotkey = entity.Hotkey();
|
||||
if (entityHotkey != null) {
|
||||
if (entityHotkey != null)
|
||||
{
|
||||
if (!entityModelsByHotkey.ContainsKey(entityHotkey.Hotkey))
|
||||
entityModelsByHotkey[entityHotkey.Hotkey] = new List<EntityModel>();
|
||||
|
||||
@@ -119,9 +134,10 @@ public class EntityModel {
|
||||
return entityModelsByHotkey;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static EntityModel GetFrom(string hotkey, string hotkeyGroup, bool holdSpace, string faction,
|
||||
string immortal) {
|
||||
string immortal)
|
||||
{
|
||||
if (hotkey == null || hotkey == "") return null;
|
||||
|
||||
//TODO
|
||||
@@ -142,121 +158,143 @@ public class EntityModel {
|
||||
return found;
|
||||
}
|
||||
|
||||
|
||||
public EntityInfoModel Info() {
|
||||
|
||||
public EntityInfoModel Info()
|
||||
{
|
||||
return (EntityInfoModel)EntityParts.Find(x => x.GetType() == typeof(EntityInfoModel));
|
||||
}
|
||||
|
||||
|
||||
public EntitySupplyModel Supply() {
|
||||
|
||||
public EntitySupplyModel Supply()
|
||||
{
|
||||
return (EntitySupplyModel)EntityParts.Find(x => x.GetType() == typeof(EntitySupplyModel));
|
||||
}
|
||||
|
||||
|
||||
public EntityTierModel Tier() {
|
||||
|
||||
public EntityTierModel Tier()
|
||||
{
|
||||
return (EntityTierModel)EntityParts.Find(x => x.GetType() == typeof(EntityTierModel));
|
||||
}
|
||||
|
||||
|
||||
public EntityProductionModel Production() {
|
||||
|
||||
public EntityProductionModel Production()
|
||||
{
|
||||
return (EntityProductionModel)EntityParts.Find(x => x.GetType() == typeof(EntityProductionModel));
|
||||
}
|
||||
|
||||
|
||||
public EntityMovementModel Movement() {
|
||||
|
||||
public EntityMovementModel Movement()
|
||||
{
|
||||
return (EntityMovementModel)EntityParts.Find(x => x.GetType() == typeof(EntityMovementModel));
|
||||
}
|
||||
|
||||
|
||||
public EntityVitalityModel Vitality() {
|
||||
|
||||
public EntityVitalityModel Vitality()
|
||||
{
|
||||
return (EntityVitalityModel)EntityParts.Find(x => x.GetType() == typeof(EntityVitalityModel));
|
||||
}
|
||||
|
||||
|
||||
public List<EntityRequirementModel> Requirements() {
|
||||
|
||||
public List<EntityRequirementModel> Requirements()
|
||||
{
|
||||
return EntityParts.FindAll(x => x.GetType() == typeof(EntityRequirementModel))
|
||||
.Cast<EntityRequirementModel>().ToList();
|
||||
}
|
||||
|
||||
|
||||
public List<EntityWeaponModel> Weapons() {
|
||||
|
||||
public List<EntityWeaponModel> Weapons()
|
||||
{
|
||||
return EntityParts.FindAll(x => x.GetType() == typeof(EntityWeaponModel))
|
||||
.Cast<EntityWeaponModel>().ToList();
|
||||
}
|
||||
|
||||
|
||||
public List<EntityVanguardReplacedModel> Replaceds() {
|
||||
|
||||
public List<EntityVanguardReplacedModel> Replaceds()
|
||||
{
|
||||
return EntityParts.FindAll(x => x.GetType() == typeof(EntityVanguardReplacedModel))
|
||||
.Cast<EntityVanguardReplacedModel>().ToList();
|
||||
}
|
||||
|
||||
|
||||
public EntityVanguardAddedModel VanguardAdded() {
|
||||
|
||||
public EntityVanguardAddedModel VanguardAdded()
|
||||
{
|
||||
return (EntityVanguardAddedModel)EntityParts.Find(x => x.GetType() == typeof(EntityVanguardAddedModel));
|
||||
}
|
||||
|
||||
|
||||
public EntityHotkeyModel Hotkey() {
|
||||
|
||||
public EntityHotkeyModel Hotkey()
|
||||
{
|
||||
return (EntityHotkeyModel)EntityParts.Find(x => x.GetType() == typeof(EntityHotkeyModel));
|
||||
}
|
||||
|
||||
|
||||
public EntityFactionModel Faction() {
|
||||
|
||||
public EntityFactionModel Faction()
|
||||
{
|
||||
return (EntityFactionModel)EntityParts.Find(x => x.GetType() == typeof(EntityFactionModel));
|
||||
}
|
||||
|
||||
|
||||
public EntityHarvestModel Harvest() {
|
||||
|
||||
public EntityHarvestModel Harvest()
|
||||
{
|
||||
return (EntityHarvestModel)EntityParts.Find(x => x.GetType() == typeof(EntityHarvestModel));
|
||||
}
|
||||
|
||||
|
||||
public List<EntityIdAbilityModel> IdAbilities() {
|
||||
|
||||
public List<EntityIdAbilityModel> IdAbilities()
|
||||
{
|
||||
return EntityParts.FindAll(x => x.GetType() == typeof(EntityIdAbilityModel))
|
||||
.Cast<EntityIdAbilityModel>().ToList();
|
||||
}
|
||||
|
||||
|
||||
public List<EntityIdArmyModel> IdArmies() {
|
||||
|
||||
public List<EntityIdArmyModel> IdArmies()
|
||||
{
|
||||
return EntityParts.FindAll(x => x.GetType() == typeof(EntityIdArmyModel))
|
||||
.Cast<EntityIdArmyModel>().ToList();
|
||||
}
|
||||
|
||||
|
||||
public List<EntityIdPassiveModel> IdPassives() {
|
||||
|
||||
public List<EntityIdPassiveModel> IdPassives()
|
||||
{
|
||||
return EntityParts.FindAll(x => x.GetType() == typeof(EntityIdPassiveModel))
|
||||
.Cast<EntityIdPassiveModel>().ToList();
|
||||
}
|
||||
|
||||
|
||||
public List<EntityIdUpgradeModel> IdUpgrades() {
|
||||
|
||||
public List<EntityIdUpgradeModel> IdUpgrades()
|
||||
{
|
||||
return EntityParts.FindAll(x => x.GetType() == typeof(EntityIdUpgradeModel))
|
||||
.Cast<EntityIdUpgradeModel>().ToList();
|
||||
}
|
||||
|
||||
|
||||
public List<EntityIdVanguardModel> IdVanguards() {
|
||||
|
||||
public List<EntityIdVanguardModel> IdVanguards()
|
||||
{
|
||||
return EntityParts.FindAll(x => x.GetType() == typeof(EntityIdVanguardModel))
|
||||
.Cast<EntityIdVanguardModel>().ToList();
|
||||
}
|
||||
|
||||
|
||||
public List<EntityIdPyreSpellModel> IdPyreSpells() {
|
||||
|
||||
public List<EntityIdPyreSpellModel> IdPyreSpells()
|
||||
{
|
||||
return EntityParts.FindAll(x => x.GetType() == typeof(EntityIdPyreSpellModel))
|
||||
.Cast<EntityIdPyreSpellModel>().ToList();
|
||||
}
|
||||
|
||||
public List<EntityMechanicModel> Mechanics() {
|
||||
public List<EntityMechanicModel> Mechanics()
|
||||
{
|
||||
return EntityParts.FindAll(x => x.GetType() == typeof(EntityMechanicModel))
|
||||
.Cast<EntityMechanicModel>().ToList();
|
||||
}
|
||||
|
||||
public List<EntityPassiveModel> Passives() {
|
||||
public List<EntityPassiveModel> Passives()
|
||||
{
|
||||
return EntityParts.FindAll(x => x.GetType() == typeof(EntityPassiveModel))
|
||||
.Cast<EntityPassiveModel>().ToList();
|
||||
}
|
||||
|
||||
public List<EntityStrategyModel> Strategies() {
|
||||
public List<EntityStrategyModel> Strategies()
|
||||
{
|
||||
return EntityParts.FindAll(x => x.GetType() == typeof(EntityStrategyModel))
|
||||
.Cast<EntityStrategyModel>().ToList();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user