Values = [];
- public override void AddValue(object value)
+ public override void AddValue(JToken? value)
{
Values.TryAdd(value, 0);
@@ -24,27 +20,27 @@ namespace Pf2eDataScrapper.SchemaBuilder
return Type;
}
- public override bool IsCompatibleValue(object value)
+ public override bool IsCompatibleValue(JToken? value)
{
return ResolveType(value) == Type;
}
public override string ToString()
{
- string result = Type;
- int count = Values.Count;
+ var result = Type;
+ var count = Values.Count;
result += $" (different values: {count})";
- if ((count <= ElementLimit) && (count > 0))
+ if (count is > ElementLimit or <= 0)
{
- result += "\n";
- foreach (var value in Values)
- {
- result += $"{TAB}{value.Key} (x{value.Value})\n";
- }
+ return result.Trim();
}
+ result += "\n";
+
+ result = Values.Aggregate(result, (current, value) => current + $"{Tab}{value.Key} (x{value.Value})\n");
+
return result.Trim();
}
}
diff --git a/Pf2eDataScrapper/test.json b/Pf2eDataScrapper/test.json
new file mode 100644
index 0000000..e6c936f
--- /dev/null
+++ b/Pf2eDataScrapper/test.json
@@ -0,0 +1,239 @@
+{
+ "_id": "XwfcJuskrhI9GIjX",
+ "img": "systems/pf2e/icons/classes/alchemist.webp",
+ "name": "Alchemist",
+ "system": {
+ "ancestryFeatLevels": {
+ "value": [
+ 1,
+ 5,
+ 9,
+ 13,
+ 17
+ ]
+ },
+ "attacks": {
+ "advanced": 0,
+ "martial": 0,
+ "other": {
+ "name": "Alchemical Bombs",
+ "rank": 1
+ },
+ "simple": 1,
+ "unarmed": 1
+ },
+ "classFeatLevels": {
+ "value": [
+ 1,
+ 2,
+ 4,
+ 6,
+ 8,
+ 10,
+ 12,
+ 14,
+ 16,
+ 18,
+ 20
+ ]
+ },
+ "defenses": {
+ "heavy": 0,
+ "light": 1,
+ "medium": 1,
+ "unarmored": 1
+ },
+ "description": {
+ "value": "There's no sight more beautiful to you than a strange brew bubbling in a beaker, and you consume your ingenious elixirs with abandon. You're fascinated by uncovering the secrets of science and the natural world, and you're constantly experimenting in your lab or on the go with inventive concoctions for every eventuality. You are fearless in the face of risk, hurling explosive or toxic creations at your foes. Your unique path toward greatness is lined with alchemical brews that push your mind and body to their limits.
\n@UUID[Compendium.pf2e.journals.JournalEntry.kzxu2dI7tFxv6Ix6.JournalEntryPage.Om4e4tsgNWrComie]{Alchemist}
"
+ },
+ "generalFeatLevels": {
+ "value": [
+ 3,
+ 7,
+ 11,
+ 15,
+ 19
+ ]
+ },
+ "hp": 8,
+ "items": {
+ "4bdrn": {
+ "img": "icons/tools/laboratory/mortar-liquid-pink.webp",
+ "level": 1,
+ "name": "Alchemy",
+ "uuid": "Compendium.pf2e.classfeatures.Item.Alchemy"
+ },
+ "CJ528": {
+ "img": "icons/magic/symbols/question-stone-yellow.webp",
+ "level": 11,
+ "name": "Chemical Hardiness",
+ "uuid": "Compendium.pf2e.classfeatures.Item.Chemical Hardiness"
+ },
+ "JK2gV": {
+ "img": "icons/consumables/potions/potion-round-stopped-yellow-green.webp",
+ "level": 15,
+ "name": "Alchemical Weapon Mastery",
+ "uuid": "Compendium.pf2e.classfeatures.Item.Alchemical Weapon Mastery"
+ },
+ "NY2Su": {
+ "img": "icons/creatures/eyes/human-single-blue.webp",
+ "level": 9,
+ "name": "Perception Expertise",
+ "uuid": "Compendium.pf2e.classfeatures.Item.Perception Expertise"
+ },
+ "Q1cDZ": {
+ "img": "icons/magic/symbols/question-stone-yellow.webp",
+ "level": 15,
+ "name": "Explosion Dodger",
+ "uuid": "Compendium.pf2e.classfeatures.Item.Explosion Dodger"
+ },
+ "SWNkG": {
+ "img": "icons/equipment/chest/breastplate-collared-steel.webp",
+ "level": 19,
+ "name": "Medium Armor Mastery",
+ "uuid": "Compendium.pf2e.classfeatures.Item.Medium Armor Mastery"
+ },
+ "aay1e": {
+ "img": "systems/pf2e/icons/features/classes/walls-of-will.webp",
+ "level": 7,
+ "name": "Will Expertise",
+ "uuid": "Compendium.pf2e.classfeatures.Item.Will Expertise"
+ },
+ "b3ohx": {
+ "img": "icons/magic/symbols/question-stone-yellow.webp",
+ "level": 1,
+ "name": "Research Field",
+ "uuid": "Compendium.pf2e.classfeatures.Item.Research Field"
+ },
+ "cNnDR": {
+ "img": "icons/equipment/chest/breastplate-quilted-brown.webp",
+ "level": 13,
+ "name": "Medium Armor Expertise",
+ "uuid": "Compendium.pf2e.classfeatures.Item.Medium Armor Expertise"
+ },
+ "enfdl": {
+ "img": "systems/pf2e/icons/features/classes/weapon-specialization.webp",
+ "level": 13,
+ "name": "Weapon Specialization",
+ "uuid": "Compendium.pf2e.classfeatures.Item.Weapon Specialization"
+ },
+ "f4a0p": {
+ "img": "icons/magic/light/orbs-hand-gray.webp",
+ "level": 9,
+ "name": "Double Brew",
+ "uuid": "Compendium.pf2e.classfeatures.Item.Double Brew"
+ },
+ "j5xnl": {
+ "img": "systems/pf2e/icons/features/classes/alchemical-weapon-expertise.webp",
+ "level": 7,
+ "name": "Alchemical Weapon Expertise",
+ "uuid": "Compendium.pf2e.classfeatures.Item.Alchemical Weapon Expertise"
+ },
+ "l170j": {
+ "img": "icons/magic/symbols/question-stone-yellow.webp",
+ "level": 13,
+ "name": "(Choice) Greater Field Discovery",
+ "uuid": "Compendium.pf2e.classfeatures.Item.Greater Field Discovery"
+ },
+ "plldb": {
+ "img": "icons/consumables/potions/potion-round-corked-glowing-green.webp",
+ "level": 9,
+ "name": "Alchemical Expertise",
+ "uuid": "Compendium.pf2e.classfeatures.Item.Alchemical Expertise"
+ },
+ "rpCw8": {
+ "img": "icons/magic/symbols/question-stone-yellow.webp",
+ "level": 17,
+ "name": "Abundant Vials",
+ "uuid": "Compendium.pf2e.classfeatures.Item.Abundant Vials"
+ },
+ "vOE57": {
+ "img": "icons/magic/symbols/question-stone-yellow.webp",
+ "level": 11,
+ "name": "Advanced Vials",
+ "uuid": "Compendium.pf2e.classfeatures.Item.Advanced Vials"
+ },
+ "xzcdr": {
+ "img": "icons/magic/symbols/question-stone-yellow.webp",
+ "level": 5,
+ "name": "Field Discovery",
+ "uuid": "Compendium.pf2e.classfeatures.Item.Field Discovery"
+ },
+ "yc9ak": {
+ "img": "icons/commodities/materials/bowl-powder-teal.webp",
+ "level": 5,
+ "name": "Powerful Alchemy",
+ "uuid": "Compendium.pf2e.classfeatures.Item.Powerful Alchemy"
+ },
+ "yy1uz": {
+ "img": "icons/tools/cooking/mortar-stone-yellow.webp",
+ "level": 17,
+ "name": "Alchemical Mastery",
+ "uuid": "Compendium.pf2e.classfeatures.Item.Alchemical Mastery"
+ }
+ },
+ "keyAbility": {
+ "value": [
+ "int"
+ ]
+ },
+ "perception": 1,
+ "publication": {
+ "license": "ORC",
+ "remaster": true,
+ "title": "Pathfinder Player Core 2"
+ },
+ "rules": [
+ {
+ "key": "ActiveEffectLike",
+ "mode": "upgrade",
+ "path": "system.proficiencies.attacks.weapon-base-alchemical-bomb.rank",
+ "value": 1
+ }
+ ],
+ "savingThrows": {
+ "fortitude": 2,
+ "reflex": 2,
+ "will": 1
+ },
+ "skillFeatLevels": {
+ "value": [
+ 2,
+ 4,
+ 6,
+ 8,
+ 10,
+ 12,
+ 14,
+ 16,
+ 18,
+ 20
+ ]
+ },
+ "skillIncreaseLevels": {
+ "value": [
+ 3,
+ 5,
+ 7,
+ 9,
+ 11,
+ 13,
+ 15,
+ 17,
+ 19
+ ]
+ },
+ "spellcasting": 0,
+ "trainedSkills": {
+ "additional": 3,
+ "value": [
+ "crafting"
+ ]
+ },
+ "traits": {
+ "rarity": "common",
+ "value": []
+ }
+ },
+ "type": "class"
+}
\ No newline at end of file