Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5693fa8ce8 | ||
|
|
c1b70a12eb |
@@ -90,6 +90,8 @@ internal class AonprdDataBuilder(AonprdLoader loader)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SubProcessProgressBar.Refresh(0, "");
|
||||||
|
|
||||||
SubProcessProgressBar.Max = Compendium.Count([item.Attribute.Type]);
|
SubProcessProgressBar.Max = Compendium.Count([item.Attribute.Type]);
|
||||||
|
|
||||||
foreach (AonprdLoader.LoaderEntry entry in Loader.Entries(item.Attribute.Type))
|
foreach (AonprdLoader.LoaderEntry entry in Loader.Entries(item.Attribute.Type))
|
||||||
|
|||||||
+1
-1
@@ -9,7 +9,7 @@ using Pf2eModel.Model.Structure;
|
|||||||
|
|
||||||
namespace Pf2eDataScrapper.Importers.Implementations.Aonprd.DataBuilder.Processors.Subclasses;
|
namespace Pf2eDataScrapper.Importers.Implementations.Aonprd.DataBuilder.Processors.Subclasses;
|
||||||
|
|
||||||
[AonprdProcessor("apparition", ["class", "spell", "trainings"])]
|
[AonprdProcessor("apparition", ["class", "spell", "skill"])]
|
||||||
internal class ApparitionProcessor(AonprdProcessorInput input) : AbstractSubclassProcessor(input)
|
internal class ApparitionProcessor(AonprdProcessorInput input) : AbstractSubclassProcessor(input)
|
||||||
{
|
{
|
||||||
public override Subclass Object { get; } = new();
|
public override Subclass Object { get; } = new();
|
||||||
|
|||||||
+69
-8
@@ -1,4 +1,5 @@
|
|||||||
using Pf2eModel.Model.Common.I18n;
|
using Newtonsoft.Json.Linq;
|
||||||
|
using Pf2eModel.Model.Common.I18n;
|
||||||
using Pf2eModel.Model.Enum;
|
using Pf2eModel.Model.Enum;
|
||||||
using Pf2eModel.Model.Structure;
|
using Pf2eModel.Model.Structure;
|
||||||
using Pf2eModel.Model.Structure.SpellRelation;
|
using Pf2eModel.Model.Structure.SpellRelation;
|
||||||
@@ -21,6 +22,15 @@ internal class SpellProcessor(AonprdProcessorInput input) : AbstractEntityProces
|
|||||||
Object.Level = Input.GetRequired<int>("level");
|
Object.Level = Input.GetRequired<int>("level");
|
||||||
Object.Actions = Input.EnumOptional("actions", ActionEnum.Unknown);
|
Object.Actions = Input.EnumOptional("actions", ActionEnum.Unknown);
|
||||||
Object.IsFocus = Input.GetRequired<string>("spell_type") == "Focus";
|
Object.IsFocus = Input.GetRequired<string>("spell_type") == "Focus";
|
||||||
|
Object.Duration = Input.GetOptional<int>("duration", -1);
|
||||||
|
Object.Range = Input.GetOptional<int>("range", -1);
|
||||||
|
|
||||||
|
Object.Trigger = Input.GetOptionalLocale("trigger_markdown", LocaleType.English);
|
||||||
|
Object.Target = Input.GetOptionalLocale("target_markdown", LocaleType.English);
|
||||||
|
|
||||||
|
Object.Traditions = (Input.GetOptional<JArray>("tradition") ?? [])
|
||||||
|
.Select(token => Input.Enum<SpellTradition>(token.ToString()))
|
||||||
|
.ToArray();
|
||||||
|
|
||||||
switch (Input.GetRequired<string>("spell_type"))
|
switch (Input.GetRequired<string>("spell_type"))
|
||||||
{
|
{
|
||||||
@@ -32,25 +42,78 @@ internal class SpellProcessor(AonprdProcessorInput input) : AbstractEntityProces
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (string areaType in Input.GetOptional<string[]>("area_type") ?? [])
|
ProcessArea();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ProcessArea()
|
||||||
|
{
|
||||||
|
List<string> areaTypes = (Input.GetOptional<string[]>("area_type") ?? []).ToList();
|
||||||
|
|
||||||
|
switch (areaTypes.Count)
|
||||||
{
|
{
|
||||||
Object.SpellAreas.Add(
|
case 0:
|
||||||
|
return;
|
||||||
|
|
||||||
|
case 1:
|
||||||
|
A(
|
||||||
|
new()
|
||||||
|
{
|
||||||
|
Spell = Object,
|
||||||
|
Type = Input.Enum<SpellAreaType>(areaTypes[0]),
|
||||||
|
Details = Input.GetOptionalLocale("area_raw", LocaleType.English),
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<string> areaDetails = (Input.GetOptional<string>("area_raw") ?? "")
|
||||||
|
.Replace(", or", ",")
|
||||||
|
.Replace(" or ", ", ")
|
||||||
|
.Split(", ")
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
if (areaTypes.Remove("square"))
|
||||||
|
{
|
||||||
|
A(new() { Spell = Object, Type = SpellAreaType.Square });
|
||||||
|
}
|
||||||
|
|
||||||
|
if (areaTypes.Count != areaDetails.Count)
|
||||||
|
{
|
||||||
|
throw new(
|
||||||
|
$"Area details count does not match area types count for spell {Entity.Name[LocaleType.English]}"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < areaTypes.Count; i++)
|
||||||
|
{
|
||||||
|
A(
|
||||||
new()
|
new()
|
||||||
{
|
{
|
||||||
Spell = Object,
|
Spell = Object,
|
||||||
Type = Input.EnumRequired<SpellAreaType>(areaType),
|
Type = Input.Enum<SpellAreaType>(areaTypes[i]),
|
||||||
Value = 0,
|
Details = new() { [LocaleType.English] = areaDetails[i] },
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
|
||||||
|
void A(SpellArea spellArea)
|
||||||
|
{
|
||||||
|
Object.SpellAreas.Add(spellArea);
|
||||||
|
Context.SpellAreas.Add(spellArea);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override string GetDescription() =>
|
protected override string GetDescription() =>
|
||||||
base.GetDescription()
|
base.GetDescription()
|
||||||
+ AddedDescription(
|
+ AddedDescription(
|
||||||
[
|
[
|
||||||
"area_raw",
|
"range",
|
||||||
|
"range_raw",
|
||||||
"bloodline_markdown",
|
"bloodline_markdown",
|
||||||
|
"cost_markdown",
|
||||||
"deity_markdown",
|
"deity_markdown",
|
||||||
"domain_markdown",
|
"domain_markdown",
|
||||||
"lesson_markdown",
|
"lesson_markdown",
|
||||||
@@ -59,9 +122,7 @@ internal class SpellProcessor(AonprdProcessorInput input) : AbstractEntityProces
|
|||||||
"summary_markdown",
|
"summary_markdown",
|
||||||
"tradition_markdown",
|
"tradition_markdown",
|
||||||
"patron_theme_markdown",
|
"patron_theme_markdown",
|
||||||
"trigger_markdown",
|
|
||||||
"saving_throw_markdown",
|
"saving_throw_markdown",
|
||||||
"target_markdown",
|
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
using NpgsqlTypes;
|
using NpgsqlTypes;
|
||||||
|
using Pf2eModel.Model.Common.I18n;
|
||||||
|
|
||||||
namespace Pf2eDataScrapper.Importers;
|
namespace Pf2eDataScrapper.Importers;
|
||||||
|
|
||||||
@@ -24,6 +25,16 @@ internal class ProcessorInput(JObject input)
|
|||||||
: token.ToObject<T>() ?? default;
|
: token.ToObject<T>() ?? default;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public virtual T GetOptional<T>(string path, T defaultValue)
|
||||||
|
{
|
||||||
|
JToken? token = Input.SelectToken(path) ?? null;
|
||||||
|
if (token is null || token.Type == JTokenType.Null)
|
||||||
|
{
|
||||||
|
return defaultValue;
|
||||||
|
}
|
||||||
|
return token.ToObject<T>() ?? defaultValue;
|
||||||
|
}
|
||||||
|
|
||||||
public virtual T EnumRequired<T>(string path)
|
public virtual T EnumRequired<T>(string path)
|
||||||
where T : Enum
|
where T : Enum
|
||||||
{
|
{
|
||||||
@@ -54,6 +65,21 @@ internal class ProcessorInput(JObject input)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public virtual LocaleString GetRequiredLocale(string path, LocaleType type)
|
||||||
|
{
|
||||||
|
return new() { [type] = GetRequired<string>(path) };
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual LocaleString? GetOptionalLocale(string path, LocaleType type)
|
||||||
|
{
|
||||||
|
string? value = GetOptional<string>(path);
|
||||||
|
if (value is null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return new() { [type] = value };
|
||||||
|
}
|
||||||
|
|
||||||
public virtual T Enum<T>(string value)
|
public virtual T Enum<T>(string value)
|
||||||
where T : Enum
|
where T : Enum
|
||||||
{
|
{
|
||||||
|
|||||||
+59
-90
@@ -13,7 +13,7 @@ using Pf2eModel.Model.Enum;
|
|||||||
namespace Pf2eModel.Migrations
|
namespace Pf2eModel.Migrations
|
||||||
{
|
{
|
||||||
[DbContext(typeof(Pf2eDbContext))]
|
[DbContext(typeof(Pf2eDbContext))]
|
||||||
[Migration("20250505114131_1")]
|
[Migration("20250505211157_1")]
|
||||||
partial class _1
|
partial class _1
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
@@ -25,6 +25,7 @@ namespace Pf2eModel.Migrations
|
|||||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||||
|
|
||||||
NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "action_category", new[] { "unknown", "archetype", "class-feature", "class-feat", "offensive", "defensive", "interaction", "familiar", "army_tactic", "army_war_action", "kingdom_activity", "kingdom_feat", "kingdom_feature" });
|
NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "action_category", new[] { "unknown", "archetype", "class-feature", "class-feat", "offensive", "defensive", "interaction", "familiar", "army_tactic", "army_war_action", "kingdom_activity", "kingdom_feat", "kingdom_feature" });
|
||||||
|
NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "action_enum", new[] { "unknown", "1", "2", "3", "reaction", "free", "passive", "other", "1-3", "1-2", "2-3", "2/2 rounds", "reaction/1", "reaction/2", "reaction/3", "free/1", "1 minute", "5 minutes", "10 minutes", "30 minutes", "1 hour" });
|
||||||
NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "ancestry_vision", new[] { "normal", "low-light-vision", "dark-vision" });
|
NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "ancestry_vision", new[] { "normal", "low-light-vision", "dark-vision" });
|
||||||
NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "attribute_values", new[] { "free", "str", "dex", "con", "int", "wis", "cha" });
|
NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "attribute_values", new[] { "free", "str", "dex", "con", "int", "wis", "cha" });
|
||||||
NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "class_progression_type", new[] { "entity", "ancestry_feat", "class_feat", "general_feat", "skill_feat", "skill_increase" });
|
NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "class_progression_type", new[] { "entity", "ancestry_feat", "class_feat", "general_feat", "skill_feat", "skill_increase" });
|
||||||
@@ -39,9 +40,10 @@ namespace Pf2eModel.Migrations
|
|||||||
NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "locale_type", new[] { "english", "legacy_english", "russian", "legacy", "hobby", "other" });
|
NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "locale_type", new[] { "english", "legacy_english", "russian", "legacy", "hobby", "other" });
|
||||||
NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "size", new[] { "tiny", "small", "medium", "large" });
|
NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "size", new[] { "tiny", "small", "medium", "large" });
|
||||||
NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "source_category", new[] { "rulebook", "adventure-path", "lost-omens", "adventures", "comics", "blog-posts", "society" });
|
NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "source_category", new[] { "rulebook", "adventure-path", "lost-omens", "adventures", "comics", "blog-posts", "society" });
|
||||||
NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "spell_area_type", new[] { "burst", "emanation", "cone", "line", "square", "cube", "cylinder" });
|
NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "spell_area_type", new[] { "burst", "emanation", "cone", "line", "square", "cube", "cylinder", "varies", "cuboid", "circle", "other" });
|
||||||
NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "spell_damage_category", new[] { "persistent", "splash" });
|
NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "spell_damage_category", new[] { "persistent", "splash" });
|
||||||
NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "spell_damage_kinds", new[] { "damage", "healing", "any" });
|
NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "spell_damage_kinds", new[] { "damage", "healing", "any" });
|
||||||
|
NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "spell_tradition", new[] { "none", "divine", "occult", "arcane", "primal", "elemental", "all" });
|
||||||
NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "training_stage", new[] { "untrained", "trained", "expert", "master", "legendary" });
|
NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "training_stage", new[] { "untrained", "trained", "expert", "master", "legendary" });
|
||||||
NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "trait_type", new[] { "regular", "class", "tradition" });
|
NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "trait_type", new[] { "regular", "class", "tradition" });
|
||||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||||
@@ -305,19 +307,19 @@ namespace Pf2eModel.Migrations
|
|||||||
b.Property<int>("EntityId")
|
b.Property<int>("EntityId")
|
||||||
.HasColumnType("integer")
|
.HasColumnType("integer")
|
||||||
.HasColumnName("entity_id")
|
.HasColumnName("entity_id")
|
||||||
.HasColumnOrder(0);
|
.HasColumnOrder(1);
|
||||||
|
|
||||||
b.Property<int>("TargetId")
|
b.Property<int>("TargetId")
|
||||||
.HasColumnType("integer")
|
.HasColumnType("integer")
|
||||||
.HasColumnName("target_id")
|
.HasColumnName("target_id")
|
||||||
.HasColumnOrder(1);
|
.HasColumnOrder(2);
|
||||||
|
|
||||||
b.Property<string>("Md5")
|
b.Property<string>("Md5")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasMaxLength(32)
|
.HasMaxLength(32)
|
||||||
.HasColumnType("character varying(32)")
|
.HasColumnType("character varying(32)")
|
||||||
.HasColumnName("md5")
|
.HasColumnName("md5")
|
||||||
.HasColumnOrder(3)
|
.HasColumnOrder(5)
|
||||||
.HasComment("Контроль версии объекта");
|
.HasComment("Контроль версии объекта");
|
||||||
|
|
||||||
b.Property<string>("Suffix")
|
b.Property<string>("Suffix")
|
||||||
@@ -325,7 +327,7 @@ namespace Pf2eModel.Migrations
|
|||||||
.HasMaxLength(255)
|
.HasMaxLength(255)
|
||||||
.HasColumnType("character varying(255)")
|
.HasColumnType("character varying(255)")
|
||||||
.HasColumnName("suffix")
|
.HasColumnName("suffix")
|
||||||
.HasColumnOrder(2)
|
.HasColumnOrder(4)
|
||||||
.HasComment("Часть URL до объекта. Для источников Foundry - полный UUID объекта");
|
.HasComment("Часть URL до объекта. Для источников Foundry - полный UUID объекта");
|
||||||
|
|
||||||
b.HasKey("EntityId", "TargetId")
|
b.HasKey("EntityId", "TargetId")
|
||||||
@@ -439,35 +441,15 @@ namespace Pf2eModel.Migrations
|
|||||||
.HasColumnName("id")
|
.HasColumnName("id")
|
||||||
.HasColumnOrder(1);
|
.HasColumnOrder(1);
|
||||||
|
|
||||||
b.Property<int?>("Actions")
|
b.Property<ActionEnum>("Actions")
|
||||||
.HasColumnType("integer")
|
.HasColumnType("action_enum")
|
||||||
.HasColumnName("actions")
|
.HasColumnName("actions")
|
||||||
.HasColumnOrder(3);
|
.HasColumnOrder(2);
|
||||||
|
|
||||||
b.Property<string>("Extra")
|
b.Property<string>("Extra")
|
||||||
.HasColumnType("text")
|
.HasColumnType("text")
|
||||||
.HasColumnName("extra")
|
.HasColumnName("extra")
|
||||||
.HasColumnOrder(6);
|
.HasColumnOrder(3);
|
||||||
|
|
||||||
b.Property<bool>("IsFreeAction")
|
|
||||||
.HasColumnType("boolean")
|
|
||||||
.HasColumnName("is_free_action")
|
|
||||||
.HasColumnOrder(6);
|
|
||||||
|
|
||||||
b.Property<bool>("IsPassive")
|
|
||||||
.HasColumnType("boolean")
|
|
||||||
.HasColumnName("is_passive")
|
|
||||||
.HasColumnOrder(6);
|
|
||||||
|
|
||||||
b.Property<bool>("IsReaction")
|
|
||||||
.HasColumnType("boolean")
|
|
||||||
.HasColumnName("is_reaction")
|
|
||||||
.HasColumnOrder(5);
|
|
||||||
|
|
||||||
b.Property<int?>("MaxActions")
|
|
||||||
.HasColumnType("integer")
|
|
||||||
.HasColumnName("max_actions")
|
|
||||||
.HasColumnOrder(4);
|
|
||||||
|
|
||||||
b.HasKey("Id")
|
b.HasKey("Id")
|
||||||
.HasName("pk_actions");
|
.HasName("pk_actions");
|
||||||
@@ -775,8 +757,8 @@ namespace Pf2eModel.Migrations
|
|||||||
.HasColumnName("spellcasting")
|
.HasColumnName("spellcasting")
|
||||||
.HasColumnOrder(5);
|
.HasColumnOrder(5);
|
||||||
|
|
||||||
b.Property<int>("Tradition")
|
b.Property<SpellTradition>("Tradition")
|
||||||
.HasColumnType("integer")
|
.HasColumnType("spell_tradition")
|
||||||
.HasColumnName("tradition")
|
.HasColumnName("tradition")
|
||||||
.HasColumnOrder(6);
|
.HasColumnOrder(6);
|
||||||
|
|
||||||
@@ -1263,65 +1245,47 @@ namespace Pf2eModel.Migrations
|
|||||||
.HasColumnName("id")
|
.HasColumnName("id")
|
||||||
.HasColumnOrder(1);
|
.HasColumnOrder(1);
|
||||||
|
|
||||||
b.Property<bool>("CanHeightening")
|
b.Property<ActionEnum>("Actions")
|
||||||
.HasColumnType("boolean")
|
.HasColumnType("action_enum")
|
||||||
.HasColumnName("can_heightening")
|
.HasColumnName("actions")
|
||||||
.HasColumnOrder(11);
|
|
||||||
|
|
||||||
b.Property<int>("Cost")
|
|
||||||
.HasColumnType("integer")
|
|
||||||
.HasColumnName("cost")
|
|
||||||
.HasColumnOrder(3);
|
.HasColumnOrder(3);
|
||||||
|
|
||||||
b.Property<bool>("Counteraction")
|
b.Property<int?>("Duration")
|
||||||
.HasColumnType("boolean")
|
.HasMaxLength(255)
|
||||||
.HasColumnName("counteraction")
|
.HasColumnType("integer")
|
||||||
|
.HasColumnName("duration")
|
||||||
.HasColumnOrder(4);
|
.HasColumnOrder(4);
|
||||||
|
|
||||||
b.Property<string>("Duration")
|
b.Property<bool>("IsFocus")
|
||||||
.IsRequired()
|
.HasColumnType("boolean")
|
||||||
.HasMaxLength(255)
|
.HasColumnName("is_focus")
|
||||||
.HasColumnType("character varying(255)")
|
.HasColumnOrder(5);
|
||||||
.HasColumnName("duration")
|
|
||||||
.HasColumnOrder(6);
|
|
||||||
|
|
||||||
b.Property<int>("Level")
|
b.Property<int>("Level")
|
||||||
.HasColumnType("integer")
|
.HasColumnType("integer")
|
||||||
.HasColumnName("level")
|
.HasColumnName("level")
|
||||||
.HasColumnOrder(2);
|
.HasColumnOrder(2);
|
||||||
|
|
||||||
b.Property<string>("Range")
|
b.Property<int>("Range")
|
||||||
.IsRequired()
|
.HasColumnType("integer")
|
||||||
.HasMaxLength(255)
|
|
||||||
.HasColumnType("character varying(255)")
|
|
||||||
.HasColumnName("range")
|
.HasColumnName("range")
|
||||||
.HasColumnOrder(7);
|
.HasColumnOrder(6);
|
||||||
|
|
||||||
b.Property<string>("Requirements")
|
|
||||||
.IsRequired()
|
|
||||||
.HasMaxLength(255)
|
|
||||||
.HasColumnType("character varying(255)")
|
|
||||||
.HasColumnName("requirements")
|
|
||||||
.HasColumnOrder(8);
|
|
||||||
|
|
||||||
b.Property<bool>("Sustained")
|
|
||||||
.HasColumnType("boolean")
|
|
||||||
.HasColumnName("sustained")
|
|
||||||
.HasColumnOrder(5);
|
|
||||||
|
|
||||||
b.Property<string>("Target")
|
b.Property<string>("Target")
|
||||||
.IsRequired()
|
.HasColumnType("jsonb")
|
||||||
.HasMaxLength(255)
|
|
||||||
.HasColumnType("character varying(255)")
|
|
||||||
.HasColumnName("target")
|
.HasColumnName("target")
|
||||||
.HasColumnOrder(9);
|
.HasColumnOrder(8);
|
||||||
|
|
||||||
b.Property<string>("Time")
|
b.PrimitiveCollection<SpellTradition[]>("Traditions")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasMaxLength(255)
|
.HasColumnType("spell_tradition[]")
|
||||||
.HasColumnType("character varying(255)")
|
.HasColumnName("traditions")
|
||||||
.HasColumnName("time")
|
.HasColumnOrder(6);
|
||||||
.HasColumnOrder(10);
|
|
||||||
|
b.Property<string>("Trigger")
|
||||||
|
.HasColumnType("jsonb")
|
||||||
|
.HasColumnName("trigger")
|
||||||
|
.HasColumnOrder(7);
|
||||||
|
|
||||||
b.HasKey("Id")
|
b.HasKey("Id")
|
||||||
.HasName("pk_spells");
|
.HasName("pk_spells");
|
||||||
@@ -1331,30 +1295,36 @@ namespace Pf2eModel.Migrations
|
|||||||
|
|
||||||
modelBuilder.Entity("Pf2eModel.Model.Structure.SpellRelation.SpellArea", b =>
|
modelBuilder.Entity("Pf2eModel.Model.Structure.SpellRelation.SpellArea", b =>
|
||||||
{
|
{
|
||||||
b.Property<int>("SpellId")
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
.HasColumnType("integer")
|
.HasColumnType("integer")
|
||||||
.HasColumnName("spell_id")
|
.HasColumnName("id")
|
||||||
.HasColumnOrder(1);
|
.HasColumnOrder(1);
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
b.Property<string>("Details")
|
b.Property<string>("Details")
|
||||||
.HasMaxLength(255)
|
.HasMaxLength(255)
|
||||||
.HasColumnType("character varying(255)")
|
.HasColumnType("jsonb")
|
||||||
.HasColumnName("details")
|
.HasColumnName("details")
|
||||||
|
.HasColumnOrder(3);
|
||||||
|
|
||||||
|
b.Property<int>("SpellId")
|
||||||
|
.HasColumnType("integer")
|
||||||
|
.HasColumnName("spell_id")
|
||||||
.HasColumnOrder(2);
|
.HasColumnOrder(2);
|
||||||
|
|
||||||
b.Property<SpellAreaType>("Type")
|
b.Property<SpellAreaType>("Type")
|
||||||
.HasColumnType("spell_area_type")
|
.HasColumnType("spell_area_type")
|
||||||
.HasColumnName("type")
|
.HasColumnName("type")
|
||||||
.HasColumnOrder(3);
|
|
||||||
|
|
||||||
b.Property<int>("Value")
|
|
||||||
.HasColumnType("integer")
|
|
||||||
.HasColumnName("value")
|
|
||||||
.HasColumnOrder(4);
|
.HasColumnOrder(4);
|
||||||
|
|
||||||
b.HasKey("SpellId")
|
b.HasKey("Id")
|
||||||
.HasName("pk_spell_areas");
|
.HasName("pk_spell_areas");
|
||||||
|
|
||||||
|
b.HasIndex("SpellId")
|
||||||
|
.HasDatabaseName("ix_spell_areas_spell_id");
|
||||||
|
|
||||||
b.ToTable("spell_areas", (string)null);
|
b.ToTable("spell_areas", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -2109,9 +2079,10 @@ namespace Pf2eModel.Migrations
|
|||||||
modelBuilder.Entity("Pf2eModel.Model.Structure.SpellRelation.SpellArea", b =>
|
modelBuilder.Entity("Pf2eModel.Model.Structure.SpellRelation.SpellArea", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("Pf2eModel.Model.Structure.Spell", "Spell")
|
b.HasOne("Pf2eModel.Model.Structure.Spell", "Spell")
|
||||||
.WithOne("SpellArea")
|
.WithMany("SpellAreas")
|
||||||
.HasForeignKey("Pf2eModel.Model.Structure.SpellRelation.SpellArea", "SpellId")
|
.HasForeignKey("SpellId")
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired()
|
||||||
.HasConstraintName("fk_spell_areas_spells_spell_id");
|
.HasConstraintName("fk_spell_areas_spells_spell_id");
|
||||||
|
|
||||||
b.Navigation("Spell");
|
b.Navigation("Spell");
|
||||||
@@ -2120,7 +2091,7 @@ namespace Pf2eModel.Migrations
|
|||||||
modelBuilder.Entity("Pf2eModel.Model.Structure.SpellRelation.SpellDamage", b =>
|
modelBuilder.Entity("Pf2eModel.Model.Structure.SpellRelation.SpellDamage", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("Pf2eModel.Model.Structure.Spell", "Spell")
|
b.HasOne("Pf2eModel.Model.Structure.Spell", "Spell")
|
||||||
.WithMany("SpellDamages")
|
.WithMany()
|
||||||
.HasForeignKey("SpellId")
|
.HasForeignKey("SpellId")
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
@@ -2276,9 +2247,7 @@ namespace Pf2eModel.Migrations
|
|||||||
|
|
||||||
modelBuilder.Entity("Pf2eModel.Model.Structure.Spell", b =>
|
modelBuilder.Entity("Pf2eModel.Model.Structure.Spell", b =>
|
||||||
{
|
{
|
||||||
b.Navigation("SpellArea");
|
b.Navigation("SpellAreas");
|
||||||
|
|
||||||
b.Navigation("SpellDamages");
|
|
||||||
|
|
||||||
b.Navigation("SpellDefenses");
|
b.Navigation("SpellDefenses");
|
||||||
|
|
||||||
+22
-20
@@ -15,6 +15,7 @@ namespace Pf2eModel.Migrations
|
|||||||
{
|
{
|
||||||
migrationBuilder.AlterDatabase()
|
migrationBuilder.AlterDatabase()
|
||||||
.Annotation("Npgsql:Enum:action_category", "unknown,archetype,class-feature,class-feat,offensive,defensive,interaction,familiar,army_tactic,army_war_action,kingdom_activity,kingdom_feat,kingdom_feature")
|
.Annotation("Npgsql:Enum:action_category", "unknown,archetype,class-feature,class-feat,offensive,defensive,interaction,familiar,army_tactic,army_war_action,kingdom_activity,kingdom_feat,kingdom_feature")
|
||||||
|
.Annotation("Npgsql:Enum:action_enum", "unknown,1,2,3,reaction,free,passive,other,1-3,1-2,2-3,2/2 rounds,reaction/1,reaction/2,reaction/3,free/1,1 minute,5 minutes,10 minutes,30 minutes,1 hour")
|
||||||
.Annotation("Npgsql:Enum:ancestry_vision", "normal,low-light-vision,dark-vision")
|
.Annotation("Npgsql:Enum:ancestry_vision", "normal,low-light-vision,dark-vision")
|
||||||
.Annotation("Npgsql:Enum:attribute_values", "free,str,dex,con,int,wis,cha")
|
.Annotation("Npgsql:Enum:attribute_values", "free,str,dex,con,int,wis,cha")
|
||||||
.Annotation("Npgsql:Enum:class_progression_type", "entity,ancestry_feat,class_feat,general_feat,skill_feat,skill_increase")
|
.Annotation("Npgsql:Enum:class_progression_type", "entity,ancestry_feat,class_feat,general_feat,skill_feat,skill_increase")
|
||||||
@@ -29,9 +30,10 @@ namespace Pf2eModel.Migrations
|
|||||||
.Annotation("Npgsql:Enum:locale_type", "english,legacy_english,russian,legacy,hobby,other")
|
.Annotation("Npgsql:Enum:locale_type", "english,legacy_english,russian,legacy,hobby,other")
|
||||||
.Annotation("Npgsql:Enum:size", "tiny,small,medium,large")
|
.Annotation("Npgsql:Enum:size", "tiny,small,medium,large")
|
||||||
.Annotation("Npgsql:Enum:source_category", "rulebook,adventure-path,lost-omens,adventures,comics,blog-posts,society")
|
.Annotation("Npgsql:Enum:source_category", "rulebook,adventure-path,lost-omens,adventures,comics,blog-posts,society")
|
||||||
.Annotation("Npgsql:Enum:spell_area_type", "burst,emanation,cone,line,square,cube,cylinder")
|
.Annotation("Npgsql:Enum:spell_area_type", "burst,emanation,cone,line,square,cube,cylinder,varies,cuboid,circle,other")
|
||||||
.Annotation("Npgsql:Enum:spell_damage_category", "persistent,splash")
|
.Annotation("Npgsql:Enum:spell_damage_category", "persistent,splash")
|
||||||
.Annotation("Npgsql:Enum:spell_damage_kinds", "damage,healing,any")
|
.Annotation("Npgsql:Enum:spell_damage_kinds", "damage,healing,any")
|
||||||
|
.Annotation("Npgsql:Enum:spell_tradition", "none,divine,occult,arcane,primal,elemental,all")
|
||||||
.Annotation("Npgsql:Enum:training_stage", "untrained,trained,expert,master,legendary")
|
.Annotation("Npgsql:Enum:training_stage", "untrained,trained,expert,master,legendary")
|
||||||
.Annotation("Npgsql:Enum:trait_type", "regular,class,tradition");
|
.Annotation("Npgsql:Enum:trait_type", "regular,class,tradition");
|
||||||
|
|
||||||
@@ -133,11 +135,7 @@ namespace Pf2eModel.Migrations
|
|||||||
columns: table => new
|
columns: table => new
|
||||||
{
|
{
|
||||||
id = table.Column<int>(type: "integer", nullable: false),
|
id = table.Column<int>(type: "integer", nullable: false),
|
||||||
actions = table.Column<int>(type: "integer", nullable: true),
|
actions = table.Column<ActionEnum>(type: "action_enum", nullable: false),
|
||||||
max_actions = table.Column<int>(type: "integer", nullable: true),
|
|
||||||
is_reaction = table.Column<bool>(type: "boolean", nullable: false),
|
|
||||||
is_free_action = table.Column<bool>(type: "boolean", nullable: false),
|
|
||||||
is_passive = table.Column<bool>(type: "boolean", nullable: false),
|
|
||||||
extra = table.Column<string>(type: "text", nullable: true)
|
extra = table.Column<string>(type: "text", nullable: true)
|
||||||
},
|
},
|
||||||
constraints: table =>
|
constraints: table =>
|
||||||
@@ -197,7 +195,7 @@ namespace Pf2eModel.Migrations
|
|||||||
hp = table.Column<int>(type: "integer", nullable: false),
|
hp = table.Column<int>(type: "integer", nullable: false),
|
||||||
perception = table.Column<int>(type: "integer", nullable: false),
|
perception = table.Column<int>(type: "integer", nullable: false),
|
||||||
spellcasting = table.Column<bool>(type: "boolean", nullable: false),
|
spellcasting = table.Column<bool>(type: "boolean", nullable: false),
|
||||||
tradition = table.Column<int>(type: "integer", nullable: false),
|
tradition = table.Column<SpellTradition>(type: "spell_tradition", nullable: false),
|
||||||
additional_trained_skills = table.Column<int>(type: "integer", nullable: false)
|
additional_trained_skills = table.Column<int>(type: "integer", nullable: false)
|
||||||
},
|
},
|
||||||
constraints: table =>
|
constraints: table =>
|
||||||
@@ -301,15 +299,13 @@ namespace Pf2eModel.Migrations
|
|||||||
{
|
{
|
||||||
id = table.Column<int>(type: "integer", nullable: false),
|
id = table.Column<int>(type: "integer", nullable: false),
|
||||||
level = table.Column<int>(type: "integer", nullable: false),
|
level = table.Column<int>(type: "integer", nullable: false),
|
||||||
cost = table.Column<int>(type: "integer", nullable: false),
|
actions = table.Column<ActionEnum>(type: "action_enum", nullable: false),
|
||||||
counteraction = table.Column<bool>(type: "boolean", nullable: false),
|
duration = table.Column<int>(type: "integer", maxLength: 255, nullable: true),
|
||||||
sustained = table.Column<bool>(type: "boolean", nullable: false),
|
is_focus = table.Column<bool>(type: "boolean", nullable: false),
|
||||||
duration = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: false),
|
traditions = table.Column<SpellTradition[]>(type: "spell_tradition[]", nullable: false),
|
||||||
range = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: false),
|
range = table.Column<int>(type: "integer", nullable: false),
|
||||||
requirements = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: false),
|
trigger = table.Column<string>(type: "jsonb", nullable: true),
|
||||||
target = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: false),
|
target = table.Column<string>(type: "jsonb", nullable: true)
|
||||||
time = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: false),
|
|
||||||
can_heightening = table.Column<bool>(type: "boolean", nullable: false)
|
|
||||||
},
|
},
|
||||||
constraints: table =>
|
constraints: table =>
|
||||||
{
|
{
|
||||||
@@ -861,14 +857,15 @@ namespace Pf2eModel.Migrations
|
|||||||
name: "spell_areas",
|
name: "spell_areas",
|
||||||
columns: table => new
|
columns: table => new
|
||||||
{
|
{
|
||||||
|
id = table.Column<int>(type: "integer", nullable: false)
|
||||||
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||||
spell_id = table.Column<int>(type: "integer", nullable: false),
|
spell_id = table.Column<int>(type: "integer", nullable: false),
|
||||||
details = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: true),
|
details = table.Column<string>(type: "jsonb", maxLength: 255, nullable: true),
|
||||||
type = table.Column<SpellAreaType>(type: "spell_area_type", nullable: false),
|
type = table.Column<SpellAreaType>(type: "spell_area_type", nullable: false)
|
||||||
value = table.Column<int>(type: "integer", nullable: false)
|
|
||||||
},
|
},
|
||||||
constraints: table =>
|
constraints: table =>
|
||||||
{
|
{
|
||||||
table.PrimaryKey("pk_spell_areas", x => x.spell_id);
|
table.PrimaryKey("pk_spell_areas", x => x.id);
|
||||||
table.ForeignKey(
|
table.ForeignKey(
|
||||||
name: "fk_spell_areas_spells_spell_id",
|
name: "fk_spell_areas_spells_spell_id",
|
||||||
column: x => x.spell_id,
|
column: x => x.spell_id,
|
||||||
@@ -1206,6 +1203,11 @@ namespace Pf2eModel.Migrations
|
|||||||
table: "languages",
|
table: "languages",
|
||||||
column: "entity_id");
|
column: "entity_id");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "ix_spell_areas_spell_id",
|
||||||
|
table: "spell_areas",
|
||||||
|
column: "spell_id");
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
migrationBuilder.CreateIndex(
|
||||||
name: "ix_spell_damages_spell_id",
|
name: "ix_spell_damages_spell_id",
|
||||||
table: "spell_damages",
|
table: "spell_damages",
|
||||||
@@ -22,6 +22,7 @@ namespace Pf2eModel.Migrations
|
|||||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||||
|
|
||||||
NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "action_category", new[] { "unknown", "archetype", "class-feature", "class-feat", "offensive", "defensive", "interaction", "familiar", "army_tactic", "army_war_action", "kingdom_activity", "kingdom_feat", "kingdom_feature" });
|
NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "action_category", new[] { "unknown", "archetype", "class-feature", "class-feat", "offensive", "defensive", "interaction", "familiar", "army_tactic", "army_war_action", "kingdom_activity", "kingdom_feat", "kingdom_feature" });
|
||||||
|
NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "action_enum", new[] { "unknown", "1", "2", "3", "reaction", "free", "passive", "other", "1-3", "1-2", "2-3", "2/2 rounds", "reaction/1", "reaction/2", "reaction/3", "free/1", "1 minute", "5 minutes", "10 minutes", "30 minutes", "1 hour" });
|
||||||
NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "ancestry_vision", new[] { "normal", "low-light-vision", "dark-vision" });
|
NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "ancestry_vision", new[] { "normal", "low-light-vision", "dark-vision" });
|
||||||
NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "attribute_values", new[] { "free", "str", "dex", "con", "int", "wis", "cha" });
|
NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "attribute_values", new[] { "free", "str", "dex", "con", "int", "wis", "cha" });
|
||||||
NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "class_progression_type", new[] { "entity", "ancestry_feat", "class_feat", "general_feat", "skill_feat", "skill_increase" });
|
NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "class_progression_type", new[] { "entity", "ancestry_feat", "class_feat", "general_feat", "skill_feat", "skill_increase" });
|
||||||
@@ -36,9 +37,10 @@ namespace Pf2eModel.Migrations
|
|||||||
NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "locale_type", new[] { "english", "legacy_english", "russian", "legacy", "hobby", "other" });
|
NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "locale_type", new[] { "english", "legacy_english", "russian", "legacy", "hobby", "other" });
|
||||||
NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "size", new[] { "tiny", "small", "medium", "large" });
|
NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "size", new[] { "tiny", "small", "medium", "large" });
|
||||||
NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "source_category", new[] { "rulebook", "adventure-path", "lost-omens", "adventures", "comics", "blog-posts", "society" });
|
NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "source_category", new[] { "rulebook", "adventure-path", "lost-omens", "adventures", "comics", "blog-posts", "society" });
|
||||||
NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "spell_area_type", new[] { "burst", "emanation", "cone", "line", "square", "cube", "cylinder" });
|
NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "spell_area_type", new[] { "burst", "emanation", "cone", "line", "square", "cube", "cylinder", "varies", "cuboid", "circle", "other" });
|
||||||
NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "spell_damage_category", new[] { "persistent", "splash" });
|
NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "spell_damage_category", new[] { "persistent", "splash" });
|
||||||
NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "spell_damage_kinds", new[] { "damage", "healing", "any" });
|
NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "spell_damage_kinds", new[] { "damage", "healing", "any" });
|
||||||
|
NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "spell_tradition", new[] { "none", "divine", "occult", "arcane", "primal", "elemental", "all" });
|
||||||
NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "training_stage", new[] { "untrained", "trained", "expert", "master", "legendary" });
|
NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "training_stage", new[] { "untrained", "trained", "expert", "master", "legendary" });
|
||||||
NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "trait_type", new[] { "regular", "class", "tradition" });
|
NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "trait_type", new[] { "regular", "class", "tradition" });
|
||||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||||
@@ -302,19 +304,19 @@ namespace Pf2eModel.Migrations
|
|||||||
b.Property<int>("EntityId")
|
b.Property<int>("EntityId")
|
||||||
.HasColumnType("integer")
|
.HasColumnType("integer")
|
||||||
.HasColumnName("entity_id")
|
.HasColumnName("entity_id")
|
||||||
.HasColumnOrder(0);
|
.HasColumnOrder(1);
|
||||||
|
|
||||||
b.Property<int>("TargetId")
|
b.Property<int>("TargetId")
|
||||||
.HasColumnType("integer")
|
.HasColumnType("integer")
|
||||||
.HasColumnName("target_id")
|
.HasColumnName("target_id")
|
||||||
.HasColumnOrder(1);
|
.HasColumnOrder(2);
|
||||||
|
|
||||||
b.Property<string>("Md5")
|
b.Property<string>("Md5")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasMaxLength(32)
|
.HasMaxLength(32)
|
||||||
.HasColumnType("character varying(32)")
|
.HasColumnType("character varying(32)")
|
||||||
.HasColumnName("md5")
|
.HasColumnName("md5")
|
||||||
.HasColumnOrder(3)
|
.HasColumnOrder(5)
|
||||||
.HasComment("Контроль версии объекта");
|
.HasComment("Контроль версии объекта");
|
||||||
|
|
||||||
b.Property<string>("Suffix")
|
b.Property<string>("Suffix")
|
||||||
@@ -322,7 +324,7 @@ namespace Pf2eModel.Migrations
|
|||||||
.HasMaxLength(255)
|
.HasMaxLength(255)
|
||||||
.HasColumnType("character varying(255)")
|
.HasColumnType("character varying(255)")
|
||||||
.HasColumnName("suffix")
|
.HasColumnName("suffix")
|
||||||
.HasColumnOrder(2)
|
.HasColumnOrder(4)
|
||||||
.HasComment("Часть URL до объекта. Для источников Foundry - полный UUID объекта");
|
.HasComment("Часть URL до объекта. Для источников Foundry - полный UUID объекта");
|
||||||
|
|
||||||
b.HasKey("EntityId", "TargetId")
|
b.HasKey("EntityId", "TargetId")
|
||||||
@@ -436,35 +438,15 @@ namespace Pf2eModel.Migrations
|
|||||||
.HasColumnName("id")
|
.HasColumnName("id")
|
||||||
.HasColumnOrder(1);
|
.HasColumnOrder(1);
|
||||||
|
|
||||||
b.Property<int?>("Actions")
|
b.Property<ActionEnum>("Actions")
|
||||||
.HasColumnType("integer")
|
.HasColumnType("action_enum")
|
||||||
.HasColumnName("actions")
|
.HasColumnName("actions")
|
||||||
.HasColumnOrder(3);
|
.HasColumnOrder(2);
|
||||||
|
|
||||||
b.Property<string>("Extra")
|
b.Property<string>("Extra")
|
||||||
.HasColumnType("text")
|
.HasColumnType("text")
|
||||||
.HasColumnName("extra")
|
.HasColumnName("extra")
|
||||||
.HasColumnOrder(6);
|
.HasColumnOrder(3);
|
||||||
|
|
||||||
b.Property<bool>("IsFreeAction")
|
|
||||||
.HasColumnType("boolean")
|
|
||||||
.HasColumnName("is_free_action")
|
|
||||||
.HasColumnOrder(6);
|
|
||||||
|
|
||||||
b.Property<bool>("IsPassive")
|
|
||||||
.HasColumnType("boolean")
|
|
||||||
.HasColumnName("is_passive")
|
|
||||||
.HasColumnOrder(6);
|
|
||||||
|
|
||||||
b.Property<bool>("IsReaction")
|
|
||||||
.HasColumnType("boolean")
|
|
||||||
.HasColumnName("is_reaction")
|
|
||||||
.HasColumnOrder(5);
|
|
||||||
|
|
||||||
b.Property<int?>("MaxActions")
|
|
||||||
.HasColumnType("integer")
|
|
||||||
.HasColumnName("max_actions")
|
|
||||||
.HasColumnOrder(4);
|
|
||||||
|
|
||||||
b.HasKey("Id")
|
b.HasKey("Id")
|
||||||
.HasName("pk_actions");
|
.HasName("pk_actions");
|
||||||
@@ -772,8 +754,8 @@ namespace Pf2eModel.Migrations
|
|||||||
.HasColumnName("spellcasting")
|
.HasColumnName("spellcasting")
|
||||||
.HasColumnOrder(5);
|
.HasColumnOrder(5);
|
||||||
|
|
||||||
b.Property<int>("Tradition")
|
b.Property<SpellTradition>("Tradition")
|
||||||
.HasColumnType("integer")
|
.HasColumnType("spell_tradition")
|
||||||
.HasColumnName("tradition")
|
.HasColumnName("tradition")
|
||||||
.HasColumnOrder(6);
|
.HasColumnOrder(6);
|
||||||
|
|
||||||
@@ -1260,65 +1242,47 @@ namespace Pf2eModel.Migrations
|
|||||||
.HasColumnName("id")
|
.HasColumnName("id")
|
||||||
.HasColumnOrder(1);
|
.HasColumnOrder(1);
|
||||||
|
|
||||||
b.Property<bool>("CanHeightening")
|
b.Property<ActionEnum>("Actions")
|
||||||
.HasColumnType("boolean")
|
.HasColumnType("action_enum")
|
||||||
.HasColumnName("can_heightening")
|
.HasColumnName("actions")
|
||||||
.HasColumnOrder(11);
|
|
||||||
|
|
||||||
b.Property<int>("Cost")
|
|
||||||
.HasColumnType("integer")
|
|
||||||
.HasColumnName("cost")
|
|
||||||
.HasColumnOrder(3);
|
.HasColumnOrder(3);
|
||||||
|
|
||||||
b.Property<bool>("Counteraction")
|
b.Property<int?>("Duration")
|
||||||
.HasColumnType("boolean")
|
.HasMaxLength(255)
|
||||||
.HasColumnName("counteraction")
|
.HasColumnType("integer")
|
||||||
|
.HasColumnName("duration")
|
||||||
.HasColumnOrder(4);
|
.HasColumnOrder(4);
|
||||||
|
|
||||||
b.Property<string>("Duration")
|
b.Property<bool>("IsFocus")
|
||||||
.IsRequired()
|
.HasColumnType("boolean")
|
||||||
.HasMaxLength(255)
|
.HasColumnName("is_focus")
|
||||||
.HasColumnType("character varying(255)")
|
.HasColumnOrder(5);
|
||||||
.HasColumnName("duration")
|
|
||||||
.HasColumnOrder(6);
|
|
||||||
|
|
||||||
b.Property<int>("Level")
|
b.Property<int>("Level")
|
||||||
.HasColumnType("integer")
|
.HasColumnType("integer")
|
||||||
.HasColumnName("level")
|
.HasColumnName("level")
|
||||||
.HasColumnOrder(2);
|
.HasColumnOrder(2);
|
||||||
|
|
||||||
b.Property<string>("Range")
|
b.Property<int>("Range")
|
||||||
.IsRequired()
|
.HasColumnType("integer")
|
||||||
.HasMaxLength(255)
|
|
||||||
.HasColumnType("character varying(255)")
|
|
||||||
.HasColumnName("range")
|
.HasColumnName("range")
|
||||||
.HasColumnOrder(7);
|
.HasColumnOrder(6);
|
||||||
|
|
||||||
b.Property<string>("Requirements")
|
|
||||||
.IsRequired()
|
|
||||||
.HasMaxLength(255)
|
|
||||||
.HasColumnType("character varying(255)")
|
|
||||||
.HasColumnName("requirements")
|
|
||||||
.HasColumnOrder(8);
|
|
||||||
|
|
||||||
b.Property<bool>("Sustained")
|
|
||||||
.HasColumnType("boolean")
|
|
||||||
.HasColumnName("sustained")
|
|
||||||
.HasColumnOrder(5);
|
|
||||||
|
|
||||||
b.Property<string>("Target")
|
b.Property<string>("Target")
|
||||||
.IsRequired()
|
.HasColumnType("jsonb")
|
||||||
.HasMaxLength(255)
|
|
||||||
.HasColumnType("character varying(255)")
|
|
||||||
.HasColumnName("target")
|
.HasColumnName("target")
|
||||||
.HasColumnOrder(9);
|
.HasColumnOrder(8);
|
||||||
|
|
||||||
b.Property<string>("Time")
|
b.PrimitiveCollection<SpellTradition[]>("Traditions")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasMaxLength(255)
|
.HasColumnType("spell_tradition[]")
|
||||||
.HasColumnType("character varying(255)")
|
.HasColumnName("traditions")
|
||||||
.HasColumnName("time")
|
.HasColumnOrder(6);
|
||||||
.HasColumnOrder(10);
|
|
||||||
|
b.Property<string>("Trigger")
|
||||||
|
.HasColumnType("jsonb")
|
||||||
|
.HasColumnName("trigger")
|
||||||
|
.HasColumnOrder(7);
|
||||||
|
|
||||||
b.HasKey("Id")
|
b.HasKey("Id")
|
||||||
.HasName("pk_spells");
|
.HasName("pk_spells");
|
||||||
@@ -1328,30 +1292,36 @@ namespace Pf2eModel.Migrations
|
|||||||
|
|
||||||
modelBuilder.Entity("Pf2eModel.Model.Structure.SpellRelation.SpellArea", b =>
|
modelBuilder.Entity("Pf2eModel.Model.Structure.SpellRelation.SpellArea", b =>
|
||||||
{
|
{
|
||||||
b.Property<int>("SpellId")
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
.HasColumnType("integer")
|
.HasColumnType("integer")
|
||||||
.HasColumnName("spell_id")
|
.HasColumnName("id")
|
||||||
.HasColumnOrder(1);
|
.HasColumnOrder(1);
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
b.Property<string>("Details")
|
b.Property<string>("Details")
|
||||||
.HasMaxLength(255)
|
.HasMaxLength(255)
|
||||||
.HasColumnType("character varying(255)")
|
.HasColumnType("jsonb")
|
||||||
.HasColumnName("details")
|
.HasColumnName("details")
|
||||||
|
.HasColumnOrder(3);
|
||||||
|
|
||||||
|
b.Property<int>("SpellId")
|
||||||
|
.HasColumnType("integer")
|
||||||
|
.HasColumnName("spell_id")
|
||||||
.HasColumnOrder(2);
|
.HasColumnOrder(2);
|
||||||
|
|
||||||
b.Property<SpellAreaType>("Type")
|
b.Property<SpellAreaType>("Type")
|
||||||
.HasColumnType("spell_area_type")
|
.HasColumnType("spell_area_type")
|
||||||
.HasColumnName("type")
|
.HasColumnName("type")
|
||||||
.HasColumnOrder(3);
|
|
||||||
|
|
||||||
b.Property<int>("Value")
|
|
||||||
.HasColumnType("integer")
|
|
||||||
.HasColumnName("value")
|
|
||||||
.HasColumnOrder(4);
|
.HasColumnOrder(4);
|
||||||
|
|
||||||
b.HasKey("SpellId")
|
b.HasKey("Id")
|
||||||
.HasName("pk_spell_areas");
|
.HasName("pk_spell_areas");
|
||||||
|
|
||||||
|
b.HasIndex("SpellId")
|
||||||
|
.HasDatabaseName("ix_spell_areas_spell_id");
|
||||||
|
|
||||||
b.ToTable("spell_areas", (string)null);
|
b.ToTable("spell_areas", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -2106,9 +2076,10 @@ namespace Pf2eModel.Migrations
|
|||||||
modelBuilder.Entity("Pf2eModel.Model.Structure.SpellRelation.SpellArea", b =>
|
modelBuilder.Entity("Pf2eModel.Model.Structure.SpellRelation.SpellArea", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("Pf2eModel.Model.Structure.Spell", "Spell")
|
b.HasOne("Pf2eModel.Model.Structure.Spell", "Spell")
|
||||||
.WithOne("SpellArea")
|
.WithMany("SpellAreas")
|
||||||
.HasForeignKey("Pf2eModel.Model.Structure.SpellRelation.SpellArea", "SpellId")
|
.HasForeignKey("SpellId")
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired()
|
||||||
.HasConstraintName("fk_spell_areas_spells_spell_id");
|
.HasConstraintName("fk_spell_areas_spells_spell_id");
|
||||||
|
|
||||||
b.Navigation("Spell");
|
b.Navigation("Spell");
|
||||||
@@ -2117,7 +2088,7 @@ namespace Pf2eModel.Migrations
|
|||||||
modelBuilder.Entity("Pf2eModel.Model.Structure.SpellRelation.SpellDamage", b =>
|
modelBuilder.Entity("Pf2eModel.Model.Structure.SpellRelation.SpellDamage", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("Pf2eModel.Model.Structure.Spell", "Spell")
|
b.HasOne("Pf2eModel.Model.Structure.Spell", "Spell")
|
||||||
.WithMany("SpellDamages")
|
.WithMany()
|
||||||
.HasForeignKey("SpellId")
|
.HasForeignKey("SpellId")
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
@@ -2273,9 +2244,7 @@ namespace Pf2eModel.Migrations
|
|||||||
|
|
||||||
modelBuilder.Entity("Pf2eModel.Model.Structure.Spell", b =>
|
modelBuilder.Entity("Pf2eModel.Model.Structure.Spell", b =>
|
||||||
{
|
{
|
||||||
b.Navigation("SpellArea");
|
b.Navigation("SpellAreas");
|
||||||
|
|
||||||
b.Navigation("SpellDamages");
|
|
||||||
|
|
||||||
b.Navigation("SpellDefenses");
|
b.Navigation("SpellDefenses");
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,9 @@ public enum SpellTradition
|
|||||||
[PgName("primal")]
|
[PgName("primal")]
|
||||||
Primal,
|
Primal,
|
||||||
|
|
||||||
|
[PgName("elemental")]
|
||||||
|
Elemental,
|
||||||
|
|
||||||
[PgName("all")]
|
[PgName("all")]
|
||||||
All,
|
All,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,20 +24,31 @@ public class Spell : IEntity
|
|||||||
public ActionEnum Actions { get; set; } = ActionEnum.Other;
|
public ActionEnum Actions { get; set; } = ActionEnum.Other;
|
||||||
|
|
||||||
[Column(Order = 4)]
|
[Column(Order = 4)]
|
||||||
|
[MaxLength(255)]
|
||||||
|
public int? Duration { get; set; } = null;
|
||||||
|
|
||||||
|
[Column(Order = 5)]
|
||||||
public bool IsFocus { get; set; }
|
public bool IsFocus { get; set; }
|
||||||
|
|
||||||
// ---
|
[Column(Order = 6)]
|
||||||
|
public SpellTradition[] Traditions { get; set; } = [];
|
||||||
|
|
||||||
|
[Column(Order = 6)]
|
||||||
|
public int Range { get; set; }
|
||||||
|
|
||||||
|
[Column(Order = 7)]
|
||||||
|
public LocaleString? Trigger { get; set; } = null;
|
||||||
|
|
||||||
|
[Column(Order = 8)]
|
||||||
|
public LocaleString? Target { get; set; } = null;
|
||||||
|
|
||||||
|
/*
|
||||||
[Column(Order = 4)]
|
[Column(Order = 4)]
|
||||||
public bool Counteraction { get; set; }
|
public bool Counteraction { get; set; }
|
||||||
|
|
||||||
[Column(Order = 5)]
|
[Column(Order = 5)]
|
||||||
public bool Sustained { get; set; }
|
public bool Sustained { get; set; }
|
||||||
|
|
||||||
[Column(Order = 6)]
|
|
||||||
[MaxLength(255)]
|
|
||||||
public string Duration { get; set; } = null!;
|
|
||||||
|
|
||||||
[Column(Order = 7)]
|
[Column(Order = 7)]
|
||||||
[MaxLength(255)]
|
[MaxLength(255)]
|
||||||
public string Range { get; set; } = null!;
|
public string Range { get; set; } = null!;
|
||||||
@@ -56,14 +67,11 @@ public class Spell : IEntity
|
|||||||
|
|
||||||
[Column(Order = 11)]
|
[Column(Order = 11)]
|
||||||
public bool CanHeightening { get; set; }
|
public bool CanHeightening { get; set; }
|
||||||
|
*/
|
||||||
// ---
|
|
||||||
|
|
||||||
public virtual ICollection<SpellArea> SpellAreas { get; set; } = [];
|
public virtual ICollection<SpellArea> SpellAreas { get; set; } = [];
|
||||||
|
|
||||||
public virtual SpellRitual? SpellRitual { get; set; }
|
public virtual SpellRitual? SpellRitual { get; set; }
|
||||||
|
|
||||||
public virtual ICollection<SpellDamage> SpellDamages { get; set; } = new List<SpellDamage>();
|
|
||||||
|
|
||||||
public virtual ICollection<SpellDefense> SpellDefenses { get; set; } = new List<SpellDefense>();
|
public virtual ICollection<SpellDefense> SpellDefenses { get; set; } = new List<SpellDefense>();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
using Pf2eModel.Model.Common.I18n;
|
||||||
using Pf2eModel.Model.Enum;
|
using Pf2eModel.Model.Enum;
|
||||||
|
|
||||||
namespace Pf2eModel.Model.Structure.SpellRelation;
|
namespace Pf2eModel.Model.Structure.SpellRelation;
|
||||||
@@ -7,7 +8,7 @@ namespace Pf2eModel.Model.Structure.SpellRelation;
|
|||||||
public class SpellArea
|
public class SpellArea
|
||||||
{
|
{
|
||||||
[Key]
|
[Key]
|
||||||
[DatabaseGenerated(DatabaseGeneratedOption.None)]
|
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||||
[Column(Order = 1)]
|
[Column(Order = 1)]
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
|
|
||||||
@@ -16,13 +17,10 @@ public class SpellArea
|
|||||||
|
|
||||||
[Column(Order = 3)]
|
[Column(Order = 3)]
|
||||||
[MaxLength(255)]
|
[MaxLength(255)]
|
||||||
public string? Details { get; set; }
|
public LocaleString? Details { get; set; }
|
||||||
|
|
||||||
[Column(Order = 4)]
|
[Column(Order = 4)]
|
||||||
public SpellAreaType Type { get; set; }
|
public SpellAreaType Type { get; set; }
|
||||||
|
|
||||||
[Column(Order = 5)]
|
|
||||||
public int Value { get; set; }
|
|
||||||
|
|
||||||
public virtual Spell Spell { get; set; } = null!;
|
public virtual Spell Spell { get; set; } = null!;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -123,6 +123,7 @@ public partial class Pf2eDbContext : DbContext
|
|||||||
builder =>
|
builder =>
|
||||||
{
|
{
|
||||||
builder
|
builder
|
||||||
|
.MapEnum<ActionEnum>()
|
||||||
.MapEnum<EntityType>()
|
.MapEnum<EntityType>()
|
||||||
.MapEnum<EntityRarity>()
|
.MapEnum<EntityRarity>()
|
||||||
.MapEnum<LocaleType>()
|
.MapEnum<LocaleType>()
|
||||||
@@ -140,6 +141,7 @@ public partial class Pf2eDbContext : DbContext
|
|||||||
.MapEnum<SpellAreaType>()
|
.MapEnum<SpellAreaType>()
|
||||||
.MapEnum<SpellDamageCategory>()
|
.MapEnum<SpellDamageCategory>()
|
||||||
.MapEnum<SpellDamageKinds>()
|
.MapEnum<SpellDamageKinds>()
|
||||||
|
.MapEnum<SpellTradition>()
|
||||||
.MapEnum<AttributeValues>()
|
.MapEnum<AttributeValues>()
|
||||||
.MapEnum<TrainingStage>()
|
.MapEnum<TrainingStage>()
|
||||||
.MapEnum<SourceCategory>();
|
.MapEnum<SourceCategory>();
|
||||||
|
|||||||
@@ -46,26 +46,22 @@ public partial class Pf2eDbContext
|
|||||||
|
|
||||||
private void BindLocaleString<T>(
|
private void BindLocaleString<T>(
|
||||||
EntityTypeBuilder<T> entity,
|
EntityTypeBuilder<T> entity,
|
||||||
Expression<Func<T, LocaleString>> func
|
Expression<Func<T, LocaleString?>> func,
|
||||||
|
bool required = true
|
||||||
)
|
)
|
||||||
where T : class
|
where T : class
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
entity.OwnsMany(func, d =>
|
|
||||||
{
|
|
||||||
d.ToJson();
|
|
||||||
});
|
|
||||||
*/
|
|
||||||
|
|
||||||
entity
|
entity
|
||||||
.Property(func)
|
.Property(func)
|
||||||
.HasConversion(v => v.Serialize(), v => LocaleString.Deserialize(v))
|
.HasConversion(v => v.Serialize(), v => LocaleString.Deserialize(v))
|
||||||
.HasColumnType("jsonb");
|
.HasColumnType("jsonb")
|
||||||
|
.IsRequired(required);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DefineEnums(ModelBuilder modelBuilder)
|
private void DefineEnums(ModelBuilder modelBuilder)
|
||||||
{
|
{
|
||||||
modelBuilder
|
modelBuilder
|
||||||
|
.HasPostgresEnum<ActionEnum>()
|
||||||
.HasPostgresEnum<EntityType>()
|
.HasPostgresEnum<EntityType>()
|
||||||
.HasPostgresEnum<EntityRarity>()
|
.HasPostgresEnum<EntityRarity>()
|
||||||
.HasPostgresEnum<LocaleType>()
|
.HasPostgresEnum<LocaleType>()
|
||||||
@@ -83,6 +79,7 @@ public partial class Pf2eDbContext
|
|||||||
.HasPostgresEnum<SpellAreaType>()
|
.HasPostgresEnum<SpellAreaType>()
|
||||||
.HasPostgresEnum<SpellDamageCategory>()
|
.HasPostgresEnum<SpellDamageCategory>()
|
||||||
.HasPostgresEnum<SpellDamageKinds>()
|
.HasPostgresEnum<SpellDamageKinds>()
|
||||||
|
.HasPostgresEnum<SpellTradition>()
|
||||||
.HasPostgresEnum<AttributeValues>()
|
.HasPostgresEnum<AttributeValues>()
|
||||||
.HasPostgresEnum<TrainingStage>()
|
.HasPostgresEnum<TrainingStage>()
|
||||||
.HasPostgresEnum<SourceCategory>();
|
.HasPostgresEnum<SourceCategory>();
|
||||||
@@ -437,6 +434,9 @@ public partial class Pf2eDbContext
|
|||||||
{
|
{
|
||||||
BindEntity(entity);
|
BindEntity(entity);
|
||||||
|
|
||||||
|
BindLocaleString(entity, s => s.Trigger, false);
|
||||||
|
BindLocaleString(entity, s => s.Target, false);
|
||||||
|
|
||||||
entity
|
entity
|
||||||
.HasMany(e => e.SpellAreas)
|
.HasMany(e => e.SpellAreas)
|
||||||
.WithOne(e => e.Spell)
|
.WithOne(e => e.Spell)
|
||||||
@@ -450,20 +450,16 @@ public partial class Pf2eDbContext
|
|||||||
.OnDelete(DeleteBehavior.Cascade)
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
.IsRequired(false);
|
.IsRequired(false);
|
||||||
|
|
||||||
entity
|
|
||||||
.HasMany(e => e.SpellDamages)
|
|
||||||
.WithOne(e => e.Spell)
|
|
||||||
.HasForeignKey(e => e.SpellId)
|
|
||||||
.OnDelete(DeleteBehavior.Cascade);
|
|
||||||
|
|
||||||
entity
|
entity
|
||||||
.HasMany(e => e.SpellDefenses)
|
.HasMany(e => e.SpellDefenses)
|
||||||
.WithOne(e => e.Spell)
|
.WithOne(e => e.Spell)
|
||||||
.HasForeignKey(e => e.SpellId)
|
.HasForeignKey(e => e.SpellId)
|
||||||
.OnDelete(DeleteBehavior.Cascade);
|
.OnDelete(DeleteBehavior.Cascade);
|
||||||
});
|
});
|
||||||
modelBuilder.Entity<SpellArea>(entity => { });
|
modelBuilder.Entity<SpellArea>(entity =>
|
||||||
modelBuilder.Entity<SpellDamage>(entity => { });
|
{
|
||||||
|
BindLocaleString(entity, a => a.Details, false);
|
||||||
|
});
|
||||||
modelBuilder.Entity<SpellDefense>(entity => { });
|
modelBuilder.Entity<SpellDefense>(entity => { });
|
||||||
modelBuilder.Entity<SpellRitual>(entity => { });
|
modelBuilder.Entity<SpellRitual>(entity => { });
|
||||||
|
|
||||||
|
|||||||
@@ -49,7 +49,11 @@ internal class DatabaseQueryPerformer
|
|||||||
|
|
||||||
int count = query.Count();
|
int count = query.Count();
|
||||||
|
|
||||||
List<Entity> entities = query.Skip((Page - 1) * PerPage).Take(PerPage).ToList();
|
List<Entity> entities = query
|
||||||
|
.OrderBy(e => e.Id)
|
||||||
|
.Skip((Page - 1) * PerPage)
|
||||||
|
.Take(PerPage)
|
||||||
|
.ToList();
|
||||||
|
|
||||||
DatabaseQueryResult result = new(count, entities);
|
DatabaseQueryResult result = new(count, entities);
|
||||||
|
|
||||||
|
|||||||
@@ -207,7 +207,10 @@ public partial class DatabaseViewerControl : UserControl
|
|||||||
DataGridView,
|
DataGridView,
|
||||||
view =>
|
view =>
|
||||||
{
|
{
|
||||||
view.DataSource = result.Entities.Select(e => new EntityGridRow(e)).ToList();
|
view.DataSource = result
|
||||||
|
.Entities.Select(e => new EntityGridRow(e))
|
||||||
|
.OrderBy(r => r.Id)
|
||||||
|
.ToList();
|
||||||
|
|
||||||
SetBusyStatus(false);
|
SetBusyStatus(false);
|
||||||
|
|
||||||
|
|||||||
@@ -47,6 +47,20 @@ public sealed partial class EntityTreeViewerControl : UserControl
|
|||||||
}
|
}
|
||||||
private int _depthSize = 20;
|
private int _depthSize = 20;
|
||||||
|
|
||||||
|
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
|
||||||
|
[Category("Entity Render")]
|
||||||
|
[Description("The size of tab.")]
|
||||||
|
public float TypeFontSize
|
||||||
|
{
|
||||||
|
get => _typeFontSize;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_typeFontSize = value;
|
||||||
|
UpdateView();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private float _typeFontSize = 9.5f;
|
||||||
|
|
||||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
|
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
|
||||||
[Category("Entity Render")]
|
[Category("Entity Render")]
|
||||||
[Description("The size of plus/minus button.")]
|
[Description("The size of plus/minus button.")]
|
||||||
|
|||||||
@@ -26,6 +26,20 @@ internal class EntityTreeViewerControlRow
|
|||||||
}
|
}
|
||||||
private Image? _cache;
|
private Image? _cache;
|
||||||
|
|
||||||
|
public Image HoveredCache
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_hoveredCache == null)
|
||||||
|
{
|
||||||
|
UpdateCache();
|
||||||
|
}
|
||||||
|
return _hoveredCache!;
|
||||||
|
}
|
||||||
|
set => _hoveredCache = value;
|
||||||
|
}
|
||||||
|
private Image? _hoveredCache;
|
||||||
|
|
||||||
public List<LadderType> Ladder
|
public List<LadderType> Ladder
|
||||||
{
|
{
|
||||||
get => _ladder;
|
get => _ladder;
|
||||||
@@ -92,6 +106,11 @@ internal class EntityTreeViewerControlRow
|
|||||||
get => ParentControl.ButtonSize;
|
get => ParentControl.ButtonSize;
|
||||||
set => ParentControl.ButtonSize = value;
|
set => ParentControl.ButtonSize = value;
|
||||||
}
|
}
|
||||||
|
public float TypeFontSize
|
||||||
|
{
|
||||||
|
get => ParentControl.TypeFontSize;
|
||||||
|
set => ParentControl.TypeFontSize = value;
|
||||||
|
}
|
||||||
|
|
||||||
// ValueText functions
|
// ValueText functions
|
||||||
|
|
||||||
@@ -120,7 +139,9 @@ internal class EntityTreeViewerControlRow
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public Font TypeFont => new(Font.FontFamily, Font.Size * 0.6f, FontStyle.Italic);
|
|
||||||
|
// public Font TypeFont => new(Font.FontFamily, TypeFontSize, FontStyle.Italic);
|
||||||
|
public Font TypeFont => new(Font.FontFamily, TypeFontSize);
|
||||||
|
|
||||||
public string ValueText => Item.GetValueString();
|
public string ValueText => Item.GetValueString();
|
||||||
public Font ValueFont =>
|
public Font ValueFont =>
|
||||||
@@ -181,21 +202,29 @@ internal class EntityTreeViewerControlRow
|
|||||||
|
|
||||||
public void UpdateCache()
|
public void UpdateCache()
|
||||||
{
|
{
|
||||||
Cache = new Bitmap(Width, Height);
|
Cache = RenderCache(BackColor);
|
||||||
Graphics g = Graphics.FromImage(Cache);
|
HoveredCache = RenderCache(HoverColor);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Image RenderCache(Color backColor)
|
||||||
|
{
|
||||||
|
Image cache = new Bitmap(Width, Height);
|
||||||
|
Graphics g = Graphics.FromImage(cache);
|
||||||
|
|
||||||
|
g.FillRectangle(new SolidBrush(backColor), 0, 0, Width, Height);
|
||||||
|
|
||||||
RenderLadder(g);
|
RenderLadder(g);
|
||||||
RenderContent(g);
|
RenderContent(g);
|
||||||
|
|
||||||
g.Save();
|
g.Save();
|
||||||
|
return cache;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Invalidate(Graphics? g = null)
|
public void Invalidate(Graphics? g = null)
|
||||||
{
|
{
|
||||||
g ??= Graphics.FromImage(ParentControl.ContentImage);
|
g ??= Graphics.FromImage(ParentControl.ContentImage);
|
||||||
|
|
||||||
g.FillRectangle(new SolidBrush(Hovered ? HoverColor : BackColor), Target);
|
g.DrawImage(Hovered ? HoveredCache : Cache, Target);
|
||||||
g.DrawImage(Cache, Target);
|
|
||||||
|
|
||||||
UpdateButton();
|
UpdateButton();
|
||||||
}
|
}
|
||||||
@@ -329,6 +358,7 @@ internal class EntityTreeViewerControlRow
|
|||||||
_ => ForeColor,
|
_ => ForeColor,
|
||||||
},
|
},
|
||||||
StructureFieldEnum => BlendColor(Color.Red),
|
StructureFieldEnum => BlendColor(Color.Red),
|
||||||
|
StructureFieldNull => BlendColor(BackColor),
|
||||||
_ => ForeColor,
|
_ => ForeColor,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,130 +0,0 @@
|
|||||||
namespace Pf2eViewer.EntityTreeViewer;
|
|
||||||
|
|
||||||
sealed partial class EntityTreeViewerRow
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Обязательная переменная конструктора.
|
|
||||||
/// </summary>
|
|
||||||
private System.ComponentModel.IContainer components = null;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Освободить все используемые ресурсы.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="disposing">истинно, если управляемый ресурс должен быть удален; иначе ложно.</param>
|
|
||||||
protected override void Dispose(bool disposing)
|
|
||||||
{
|
|
||||||
if (disposing && (components != null))
|
|
||||||
{
|
|
||||||
components.Dispose();
|
|
||||||
}
|
|
||||||
base.Dispose(disposing);
|
|
||||||
}
|
|
||||||
|
|
||||||
#region Код, автоматически созданный конструктором компонентов
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Требуемый метод для поддержки конструктора — не изменяйте
|
|
||||||
/// содержимое этого метода с помощью редактора кода.
|
|
||||||
/// </summary>
|
|
||||||
private void InitializeComponent()
|
|
||||||
{
|
|
||||||
NameLabel = new Label();
|
|
||||||
IconPictureBox = new PictureBox();
|
|
||||||
NamePanel = new Panel();
|
|
||||||
ValuePanel = new Panel();
|
|
||||||
TypeLabel = new Label();
|
|
||||||
ValueLabel = new Label();
|
|
||||||
((System.ComponentModel.ISupportInitialize) IconPictureBox).BeginInit();
|
|
||||||
NamePanel.SuspendLayout();
|
|
||||||
ValuePanel.SuspendLayout();
|
|
||||||
SuspendLayout();
|
|
||||||
//
|
|
||||||
// NameLabel
|
|
||||||
//
|
|
||||||
NameLabel.Dock = DockStyle.Fill;
|
|
||||||
NameLabel.Location = new Point(0, 0);
|
|
||||||
NameLabel.Margin = new Padding(0);
|
|
||||||
NameLabel.Name = "NameLabel";
|
|
||||||
NameLabel.Size = new Size(200, 38);
|
|
||||||
NameLabel.TabIndex = 0;
|
|
||||||
NameLabel.Text = "Name";
|
|
||||||
NameLabel.TextAlign = ContentAlignment.MiddleLeft;
|
|
||||||
//
|
|
||||||
// IconPictureBox
|
|
||||||
//
|
|
||||||
IconPictureBox.Dock = DockStyle.Left;
|
|
||||||
IconPictureBox.Location = new Point(0, 0);
|
|
||||||
IconPictureBox.Margin = new Padding(0);
|
|
||||||
IconPictureBox.Name = "IconPictureBox";
|
|
||||||
IconPictureBox.Size = new Size(20, 38);
|
|
||||||
IconPictureBox.TabIndex = 1;
|
|
||||||
IconPictureBox.TabStop = false;
|
|
||||||
IconPictureBox.Click += IconPictureBox_Click;
|
|
||||||
//
|
|
||||||
// NamePanel
|
|
||||||
//
|
|
||||||
NamePanel.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left;
|
|
||||||
NamePanel.Controls.Add(NameLabel);
|
|
||||||
NamePanel.Controls.Add(IconPictureBox);
|
|
||||||
NamePanel.Location = new Point(0, 0);
|
|
||||||
NamePanel.Name = "NamePanel";
|
|
||||||
NamePanel.Size = new Size(200, 38);
|
|
||||||
NamePanel.TabIndex = 2;
|
|
||||||
//
|
|
||||||
// ValuePanel
|
|
||||||
//
|
|
||||||
ValuePanel.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
|
||||||
ValuePanel.BackColor = SystemColors.Control;
|
|
||||||
ValuePanel.Controls.Add(ValueLabel);
|
|
||||||
ValuePanel.Controls.Add(TypeLabel);
|
|
||||||
ValuePanel.Location = new Point(200, 0);
|
|
||||||
ValuePanel.Margin = new Padding(0);
|
|
||||||
ValuePanel.Name = "ValuePanel";
|
|
||||||
ValuePanel.Size = new Size(288, 38);
|
|
||||||
ValuePanel.TabIndex = 4;
|
|
||||||
//
|
|
||||||
// TypeLabel
|
|
||||||
//
|
|
||||||
TypeLabel.Dock = DockStyle.Left;
|
|
||||||
TypeLabel.Location = new Point(0, 0);
|
|
||||||
TypeLabel.Margin = new Padding(0);
|
|
||||||
TypeLabel.Name = "TypeLabel";
|
|
||||||
TypeLabel.Size = new Size(57, 38);
|
|
||||||
TypeLabel.TabIndex = 3;
|
|
||||||
TypeLabel.Text = "TypeText";
|
|
||||||
TypeLabel.TextAlign = ContentAlignment.MiddleLeft;
|
|
||||||
//
|
|
||||||
// ValueLabel
|
|
||||||
//
|
|
||||||
ValueLabel.AutoEllipsis = true;
|
|
||||||
ValueLabel.Dock = DockStyle.Fill;
|
|
||||||
ValueLabel.Location = new Point(0, 0);
|
|
||||||
ValueLabel.Name = "ValueLabel";
|
|
||||||
ValueLabel.Size = new Size(288, 38);
|
|
||||||
ValueLabel.TabIndex = 4;
|
|
||||||
ValueLabel.Text = "ValueText";
|
|
||||||
ValueLabel.TextAlign = ContentAlignment.MiddleLeft;
|
|
||||||
//
|
|
||||||
// EntityTreeViewerRow
|
|
||||||
//
|
|
||||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
|
||||||
Controls.Add(NamePanel);
|
|
||||||
Controls.Add(ValuePanel);
|
|
||||||
Name = "EntityTreeViewerRow";
|
|
||||||
Size = new Size(488, 38);
|
|
||||||
((System.ComponentModel.ISupportInitialize) IconPictureBox).EndInit();
|
|
||||||
NamePanel.ResumeLayout(false);
|
|
||||||
ValuePanel.ResumeLayout(false);
|
|
||||||
ResumeLayout(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private Label NameLabel;
|
|
||||||
private PictureBox IconPictureBox;
|
|
||||||
private Panel NamePanel;
|
|
||||||
private Panel ValuePanel;
|
|
||||||
private Label TypeLabel;
|
|
||||||
private Label ValueLabel;
|
|
||||||
}
|
|
||||||
@@ -1,273 +0,0 @@
|
|||||||
using System.ComponentModel;
|
|
||||||
using System.Diagnostics.CodeAnalysis;
|
|
||||||
using System.Windows.Markup;
|
|
||||||
using FontAwesome.Sharp;
|
|
||||||
|
|
||||||
namespace Pf2eViewer.EntityTreeViewer;
|
|
||||||
|
|
||||||
internal sealed partial class EntityTreeViewerRow : UserControl
|
|
||||||
{
|
|
||||||
public readonly EntityTreeViewerControl ParentControl;
|
|
||||||
|
|
||||||
public readonly StructureField Item;
|
|
||||||
|
|
||||||
public int ViewIndex = 0;
|
|
||||||
|
|
||||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
|
||||||
public Bitmap IconCache
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if (_iconCache == null)
|
|
||||||
{
|
|
||||||
UpdateCache();
|
|
||||||
}
|
|
||||||
return _iconCache!;
|
|
||||||
}
|
|
||||||
set => _iconCache = value;
|
|
||||||
}
|
|
||||||
private Bitmap? _iconCache;
|
|
||||||
|
|
||||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
|
||||||
public List<LadderType> Ladder
|
|
||||||
{
|
|
||||||
get => _ladder;
|
|
||||||
set
|
|
||||||
{
|
|
||||||
_ladder = value;
|
|
||||||
_iconCache = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private List<LadderType> _ladder = [];
|
|
||||||
|
|
||||||
[AllowNull]
|
|
||||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
|
|
||||||
public override Font Font
|
|
||||||
{
|
|
||||||
get => ParentControl.Font;
|
|
||||||
set => ParentControl.Font = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
|
|
||||||
public override Color ForeColor
|
|
||||||
{
|
|
||||||
get => ParentControl.ForeColor;
|
|
||||||
set => ParentControl.ForeColor = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
|
|
||||||
public override Color BackColor
|
|
||||||
{
|
|
||||||
get => ParentControl.BackColor;
|
|
||||||
set => ParentControl.BackColor = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
|
||||||
public int ItemHeight
|
|
||||||
{
|
|
||||||
get => ParentControl.ItemHeight;
|
|
||||||
set => ParentControl.ItemHeight = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
|
||||||
public int DepthSize
|
|
||||||
{
|
|
||||||
get => ParentControl.ItemHeight;
|
|
||||||
set => ParentControl.ItemHeight = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ValueText functions
|
|
||||||
|
|
||||||
public bool HasButton => Item.FieldType == StructureFieldType.Complex;
|
|
||||||
public int Depth => Item.Depth;
|
|
||||||
public int NameWidth => TextRenderer.MeasureText(NameLabel.Text, Font).Width + DepthSize;
|
|
||||||
|
|
||||||
public EntityTreeViewerRow(EntityTreeViewerControl parent, StructureField item)
|
|
||||||
{
|
|
||||||
ParentControl = parent;
|
|
||||||
|
|
||||||
Item = item;
|
|
||||||
|
|
||||||
InitializeComponent();
|
|
||||||
ApplyItem();
|
|
||||||
Refresh();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ApplyItem()
|
|
||||||
{
|
|
||||||
TypeLabel.Font = new(Font.FontFamily, Font.Size - 2, FontStyle.Italic);
|
|
||||||
|
|
||||||
NameLabel.Text = Item.Name;
|
|
||||||
TypeLabel.Text = Item.GetTypeString();
|
|
||||||
if (TypeLabel.Text != "")
|
|
||||||
{
|
|
||||||
TypeLabel.Text = $@"({TypeLabel.Text})";
|
|
||||||
}
|
|
||||||
|
|
||||||
ValueLabel.Text = Item.GetValueString();
|
|
||||||
TypeLabel.ForeColor = ValueLabel.ForeColor = GetValueColor();
|
|
||||||
|
|
||||||
if (Item.FieldType == StructureFieldType.Complex)
|
|
||||||
{
|
|
||||||
ValueLabel.Font = new(Font, FontStyle.Italic);
|
|
||||||
}
|
|
||||||
|
|
||||||
UpdateCache();
|
|
||||||
Refresh();
|
|
||||||
}
|
|
||||||
|
|
||||||
public new void Refresh()
|
|
||||||
{
|
|
||||||
base.Refresh();
|
|
||||||
|
|
||||||
Left = 0;
|
|
||||||
Top = ViewIndex * ParentControl.ItemHeight;
|
|
||||||
Width = ParentControl.ContentWidth - Left - SystemInformation.VerticalScrollBarWidth;
|
|
||||||
Height = ParentControl.ItemHeight;
|
|
||||||
|
|
||||||
// Name Panel
|
|
||||||
NamePanel.Left = 0;
|
|
||||||
NamePanel.Width = ParentControl.NameWidth - NamePanel.Left;
|
|
||||||
|
|
||||||
IconPictureBox.Width = IconCache.Width;
|
|
||||||
IconPictureBox.Image = IconCache;
|
|
||||||
|
|
||||||
NameLabel.Left = IconPictureBox.Width;
|
|
||||||
NameLabel.Width = NamePanel.Width - NameLabel.Left;
|
|
||||||
|
|
||||||
// ValueText Panel
|
|
||||||
ValuePanel.Left = NamePanel.Left + NamePanel.Width;
|
|
||||||
ValuePanel.Width = Width - ValuePanel.Left;
|
|
||||||
|
|
||||||
Size typeSize = TextRenderer.MeasureText(TypeLabel.Text, TypeLabel.Font);
|
|
||||||
TypeLabel.Width = typeSize.Width + 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
private Color BlendColor(Color color, double rate = 0.5)
|
|
||||||
{
|
|
||||||
return BlendColor(ForeColor, color, rate);
|
|
||||||
}
|
|
||||||
|
|
||||||
private Color BlendColor(Color color1, Color color2, double rate)
|
|
||||||
{
|
|
||||||
return Color.FromArgb(
|
|
||||||
Mix(color1.A, color2.A),
|
|
||||||
Mix(color1.R, color2.R),
|
|
||||||
Mix(color1.G, color2.G),
|
|
||||||
Mix(color1.B, color2.B)
|
|
||||||
);
|
|
||||||
|
|
||||||
int Mix(int a, int b) => Convert.ToInt32(Math.Round(a * rate + b * (1 - rate)));
|
|
||||||
}
|
|
||||||
|
|
||||||
public Color GetValueColor()
|
|
||||||
{
|
|
||||||
return Item switch
|
|
||||||
{
|
|
||||||
StructureFieldPrimitive primitive => Type.GetTypeCode(primitive.Type) switch
|
|
||||||
{
|
|
||||||
TypeCode.Boolean => BlendColor(Color.DarkGoldenrod),
|
|
||||||
TypeCode.Int32 => BlendColor(Color.Blue),
|
|
||||||
TypeCode.Double => BlendColor(Color.Aqua),
|
|
||||||
TypeCode.String => BlendColor(Color.Green),
|
|
||||||
_ => ForeColor,
|
|
||||||
},
|
|
||||||
StructureFieldEnum => BlendColor(Color.Red),
|
|
||||||
_ => ForeColor,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
// Events
|
|
||||||
|
|
||||||
private void IconPictureBox_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (Item.GetType() != typeof(StructureFieldComplex))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
StructureFieldComplex complex = (StructureFieldComplex)Item;
|
|
||||||
|
|
||||||
complex.Collapsed = !complex.Collapsed;
|
|
||||||
ParentControl.UpdateView();
|
|
||||||
}
|
|
||||||
|
|
||||||
private Bitmap? GetIconImage()
|
|
||||||
{
|
|
||||||
if (Item.GetType() != typeof(StructureFieldComplex))
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
StructureFieldComplex complex = (StructureFieldComplex)Item;
|
|
||||||
|
|
||||||
int size = Convert.ToInt32(Math.Round(DepthSize * 0.6));
|
|
||||||
|
|
||||||
return complex.Collapsed
|
|
||||||
? IconChar.PlusSquare.ToBitmap(IconFont.Auto, size, ForeColor)
|
|
||||||
: IconChar.MinusSquare.ToBitmap(IconFont.Auto, size, ForeColor);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void UpdateCache()
|
|
||||||
{
|
|
||||||
int n = Depth;
|
|
||||||
int h = ItemHeight;
|
|
||||||
int w = DepthSize;
|
|
||||||
|
|
||||||
_iconCache = new(w * (n + 1), h);
|
|
||||||
|
|
||||||
if (_ladder.Count < Depth)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Graphics g = Graphics.FromImage(_iconCache);
|
|
||||||
|
|
||||||
Pen pen = new(Color.FromArgb(127, ForeColor.R, ForeColor.G, ForeColor.B), 1);
|
|
||||||
pen.DashStyle = System.Drawing.Drawing2D.DashStyle.Dot;
|
|
||||||
|
|
||||||
float cy = 0.5f * h;
|
|
||||||
|
|
||||||
for (int i = 0; i < n; i++)
|
|
||||||
{
|
|
||||||
float cx = (i + 1.5f) * w;
|
|
||||||
|
|
||||||
switch (_ladder[i])
|
|
||||||
{
|
|
||||||
case LadderType.Last:
|
|
||||||
g.DrawLine(pen, cx, 0, cx, cy);
|
|
||||||
break;
|
|
||||||
case LadderType.Through:
|
|
||||||
g.DrawLine(pen, cx, 0, cx, h);
|
|
||||||
break;
|
|
||||||
case LadderType.Empty:
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (i == n - 1)
|
|
||||||
{
|
|
||||||
g.DrawLine(pen, cx, cy, (i + 2) * w, cy);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Bitmap? icon = GetIconImage();
|
|
||||||
|
|
||||||
if (icon is not null)
|
|
||||||
{
|
|
||||||
float cx = (n + 0.5f) * w;
|
|
||||||
|
|
||||||
g.FillRectangle(
|
|
||||||
new SolidBrush(BackColor),
|
|
||||||
cx - 0.5f * icon.Width - 1,
|
|
||||||
cy - 0.5f * icon.Height - 1,
|
|
||||||
icon.Width + 2,
|
|
||||||
icon.Height + 2
|
|
||||||
);
|
|
||||||
|
|
||||||
g.DrawImage(icon, new PointF(cx - 0.5f * icon.Width, cy - 0.5f * icon.Height));
|
|
||||||
}
|
|
||||||
|
|
||||||
g.Save();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,120 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<root>
|
|
||||||
<!--
|
|
||||||
Microsoft ResX Schema
|
|
||||||
|
|
||||||
Version 2.0
|
|
||||||
|
|
||||||
The primary goals of this format is to allow a simple XML format
|
|
||||||
that is mostly human readable. The generation and parsing of the
|
|
||||||
various data types are done through the TypeConverter classes
|
|
||||||
associated with the data types.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
... ado.net/XML headers & schema ...
|
|
||||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
|
||||||
<resheader name="version">2.0</resheader>
|
|
||||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
|
||||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
|
||||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
|
||||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
|
||||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
|
||||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
|
||||||
</data>
|
|
||||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
|
||||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
|
||||||
<comment>This is a comment</comment>
|
|
||||||
</data>
|
|
||||||
|
|
||||||
There are any number of "resheader" rows that contain simple
|
|
||||||
name/value pairs.
|
|
||||||
|
|
||||||
Each data row contains a name, and value. The row also contains a
|
|
||||||
type or mimetype. Type corresponds to a .NET class that support
|
|
||||||
text/value conversion through the TypeConverter architecture.
|
|
||||||
Classes that don't support this are serialized and stored with the
|
|
||||||
mimetype set.
|
|
||||||
|
|
||||||
The mimetype is used for serialized objects, and tells the
|
|
||||||
ResXResourceReader how to depersist the object. This is currently not
|
|
||||||
extensible. For a given mimetype the value must be set accordingly:
|
|
||||||
|
|
||||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
|
||||||
that the ResXResourceWriter will generate, however the reader can
|
|
||||||
read any of the formats listed below.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.binary.base64
|
|
||||||
value : The object must be serialized with
|
|
||||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.soap.base64
|
|
||||||
value : The object must be serialized with
|
|
||||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
|
||||||
value : The object must be serialized into a byte array
|
|
||||||
: using a System.ComponentModel.TypeConverter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
-->
|
|
||||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
|
||||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
|
||||||
<xsd:element name="root" msdata:IsDataSet="true">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:choice maxOccurs="unbounded">
|
|
||||||
<xsd:element name="metadata">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="assembly">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:attribute name="alias" type="xsd:string" />
|
|
||||||
<xsd:attribute name="name" type="xsd:string" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="data">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="resheader">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:choice>
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:schema>
|
|
||||||
<resheader name="resmimetype">
|
|
||||||
<value>text/microsoft-resx</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="version">
|
|
||||||
<value>2.0</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="reader">
|
|
||||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="writer">
|
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
</root>
|
|
||||||
@@ -174,11 +174,6 @@ internal abstract class StructureField(StructureBuilder builder, string name, in
|
|||||||
|
|
||||||
public abstract string GetValueString();
|
public abstract string GetValueString();
|
||||||
|
|
||||||
public virtual ICollection<EntityTreeViewerRow> GetTextRows(EntityTreeViewerControl control)
|
|
||||||
{
|
|
||||||
return [new(control, this)];
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual ICollection<T> GetRows<T>(Func<StructureField, T> func)
|
public virtual ICollection<T> GetRows<T>(Func<StructureField, T> func)
|
||||||
{
|
{
|
||||||
StructureField[] q = [this];
|
StructureField[] q = [this];
|
||||||
@@ -351,15 +346,6 @@ internal class StructureFieldComplex : StructureField
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override ICollection<EntityTreeViewerRow> GetTextRows(EntityTreeViewerControl control)
|
|
||||||
{
|
|
||||||
List<EntityTreeViewerRow> rows = base.GetTextRows(control).ToList();
|
|
||||||
|
|
||||||
rows.AddRange(Fields.SelectMany(f => f.GetTextRows(control)).ToList());
|
|
||||||
|
|
||||||
return rows;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override ICollection<T> GetRows<T>(Func<StructureField, T> func)
|
public override ICollection<T> GetRows<T>(Func<StructureField, T> func)
|
||||||
{
|
{
|
||||||
return [.. base.GetRows(func), .. Fields.SelectMany(f => f.GetRows(func)).ToList()];
|
return [.. base.GetRows(func), .. Fields.SelectMany(f => f.GetRows(func)).ToList()];
|
||||||
|
|||||||
@@ -75,6 +75,10 @@ public class EntityView
|
|||||||
context =>
|
context =>
|
||||||
context.Feats.Include(f => f.Archetypes).ThenInclude(a => a.Entity).AsQueryable()
|
context.Feats.Include(f => f.Archetypes).ThenInclude(a => a.Entity).AsQueryable()
|
||||||
),
|
),
|
||||||
|
new Getter<Spell>(
|
||||||
|
EntityType.Spell,
|
||||||
|
context => context.Spells.Include(s => s.SpellAreas).Include(s => s.SpellDefenses)
|
||||||
|
),
|
||||||
];
|
];
|
||||||
|
|
||||||
private abstract class Getter(EntityType type)
|
private abstract class Getter(EntityType type)
|
||||||
|
|||||||
Generated
+9
-5
@@ -34,9 +34,9 @@ partial class MainViewForm
|
|||||||
RootSplitContainer = new SplitContainer();
|
RootSplitContainer = new SplitContainer();
|
||||||
InnerSplitContainer = new SplitContainer();
|
InnerSplitContainer = new SplitContainer();
|
||||||
TypesListBox = new ListBox();
|
TypesListBox = new ListBox();
|
||||||
|
DatabaseViewer = new DatabaseViewerControl();
|
||||||
ResultSplitContainer = new SplitContainer();
|
ResultSplitContainer = new SplitContainer();
|
||||||
EntityTreeViewerControl = new Pf2eViewer.EntityTreeViewer.EntityTreeViewerControl();
|
EntityTreeViewerControl = new Pf2eViewer.EntityTreeViewer.EntityTreeViewerControl();
|
||||||
DatabaseViewer = new DatabaseViewerControl();
|
|
||||||
DescriptionTextBox = new TextBox();
|
DescriptionTextBox = new TextBox();
|
||||||
((System.ComponentModel.ISupportInitialize)RootSplitContainer).BeginInit();
|
((System.ComponentModel.ISupportInitialize)RootSplitContainer).BeginInit();
|
||||||
RootSplitContainer.Panel1.SuspendLayout();
|
RootSplitContainer.Panel1.SuspendLayout();
|
||||||
@@ -44,6 +44,7 @@ partial class MainViewForm
|
|||||||
RootSplitContainer.SuspendLayout();
|
RootSplitContainer.SuspendLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)InnerSplitContainer).BeginInit();
|
((System.ComponentModel.ISupportInitialize)InnerSplitContainer).BeginInit();
|
||||||
InnerSplitContainer.Panel1.SuspendLayout();
|
InnerSplitContainer.Panel1.SuspendLayout();
|
||||||
|
InnerSplitContainer.Panel2.SuspendLayout();
|
||||||
InnerSplitContainer.SuspendLayout();
|
InnerSplitContainer.SuspendLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)ResultSplitContainer).BeginInit();
|
((System.ComponentModel.ISupportInitialize)ResultSplitContainer).BeginInit();
|
||||||
ResultSplitContainer.Panel1.SuspendLayout();
|
ResultSplitContainer.Panel1.SuspendLayout();
|
||||||
@@ -80,13 +81,13 @@ partial class MainViewForm
|
|||||||
// InnerSplitContainer.Panel1
|
// InnerSplitContainer.Panel1
|
||||||
//
|
//
|
||||||
InnerSplitContainer.Panel1.Controls.Add(TypesListBox);
|
InnerSplitContainer.Panel1.Controls.Add(TypesListBox);
|
||||||
InnerSplitContainer.Size = new Size(322, 861);
|
|
||||||
InnerSplitContainer.SplitterDistance = 127;
|
|
||||||
InnerSplitContainer.TabIndex = 1;
|
|
||||||
//
|
//
|
||||||
// InnerSplitContainer.Panel2
|
// InnerSplitContainer.Panel2
|
||||||
//
|
//
|
||||||
InnerSplitContainer.Panel2.Controls.Add(DatabaseViewer);
|
InnerSplitContainer.Panel2.Controls.Add(DatabaseViewer);
|
||||||
|
InnerSplitContainer.Size = new Size(322, 861);
|
||||||
|
InnerSplitContainer.SplitterDistance = 126;
|
||||||
|
InnerSplitContainer.TabIndex = 1;
|
||||||
//
|
//
|
||||||
// TypesListBox
|
// TypesListBox
|
||||||
//
|
//
|
||||||
@@ -94,7 +95,7 @@ partial class MainViewForm
|
|||||||
TypesListBox.FormattingEnabled = true;
|
TypesListBox.FormattingEnabled = true;
|
||||||
TypesListBox.Location = new Point(0, 0);
|
TypesListBox.Location = new Point(0, 0);
|
||||||
TypesListBox.Name = "TypesListBox";
|
TypesListBox.Name = "TypesListBox";
|
||||||
TypesListBox.Size = new Size(322, 127);
|
TypesListBox.Size = new Size(322, 126);
|
||||||
TypesListBox.TabIndex = 0;
|
TypesListBox.TabIndex = 0;
|
||||||
TypesListBox.SelectedIndexChanged += TypesListBox_SelectedIndexChanged;
|
TypesListBox.SelectedIndexChanged += TypesListBox_SelectedIndexChanged;
|
||||||
//
|
//
|
||||||
@@ -103,6 +104,7 @@ partial class MainViewForm
|
|||||||
DatabaseViewer.Dock = DockStyle.Fill;
|
DatabaseViewer.Dock = DockStyle.Fill;
|
||||||
DatabaseViewer.Location = new Point(0, 0);
|
DatabaseViewer.Location = new Point(0, 0);
|
||||||
DatabaseViewer.Name = "DatabaseViewer";
|
DatabaseViewer.Name = "DatabaseViewer";
|
||||||
|
DatabaseViewer.Size = new Size(322, 731);
|
||||||
DatabaseViewer.TabIndex = 1;
|
DatabaseViewer.TabIndex = 1;
|
||||||
//
|
//
|
||||||
// ResultSplitContainer
|
// ResultSplitContainer
|
||||||
@@ -135,6 +137,7 @@ partial class MainViewForm
|
|||||||
EntityTreeViewerControl.Name = "EntityTreeViewerControl";
|
EntityTreeViewerControl.Name = "EntityTreeViewerControl";
|
||||||
EntityTreeViewerControl.Size = new Size(582, 861);
|
EntityTreeViewerControl.Size = new Size(582, 861);
|
||||||
EntityTreeViewerControl.TabIndex = 0;
|
EntityTreeViewerControl.TabIndex = 0;
|
||||||
|
EntityTreeViewerControl.TypeFontSize = 7F;
|
||||||
//
|
//
|
||||||
// DescriptionTextBox
|
// DescriptionTextBox
|
||||||
//
|
//
|
||||||
@@ -161,6 +164,7 @@ partial class MainViewForm
|
|||||||
((System.ComponentModel.ISupportInitialize)RootSplitContainer).EndInit();
|
((System.ComponentModel.ISupportInitialize)RootSplitContainer).EndInit();
|
||||||
RootSplitContainer.ResumeLayout(false);
|
RootSplitContainer.ResumeLayout(false);
|
||||||
InnerSplitContainer.Panel1.ResumeLayout(false);
|
InnerSplitContainer.Panel1.ResumeLayout(false);
|
||||||
|
InnerSplitContainer.Panel2.ResumeLayout(false);
|
||||||
((System.ComponentModel.ISupportInitialize)InnerSplitContainer).EndInit();
|
((System.ComponentModel.ISupportInitialize)InnerSplitContainer).EndInit();
|
||||||
InnerSplitContainer.ResumeLayout(false);
|
InnerSplitContainer.ResumeLayout(false);
|
||||||
ResultSplitContainer.Panel1.ResumeLayout(false);
|
ResultSplitContainer.Panel1.ResumeLayout(false);
|
||||||
|
|||||||
Reference in New Issue
Block a user