Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restrict Custom Homebrew Item Properties #3

Merged
merged 12 commits into from
Sep 18, 2023
Empty file modified bin/test-file-extensions.js
100644 → 100755
Empty file.
Empty file modified bin/test-file-locations.js
100644 → 100755
Empty file.
Empty file modified bin/test-json-brew.js
100644 → 100755
Empty file.
Empty file modified bin/test-json-ua.js
100644 → 100755
Empty file.
41 changes: 25 additions & 16 deletions schema-template/items-base.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "items-base.json",
"version": "1.5.10",
"version": "1.5.12",
"$defs": {
"itemPropertyLookupArray": {
"type": "array",
Expand Down Expand Up @@ -140,6 +140,9 @@
"type": {
"$ref": "items-shared.json#/$defs/itemType"
},
"typeAlt": {
"$ref": "items-shared.json#/$defs/itemType"
},
"rarity": {
"$ref": "items-shared.json#/$defs/itemRarity"
},
Expand All @@ -151,6 +154,9 @@
"age": {
"$ref": "items-shared.json#/$defs/itemAge"
},
"bonusWeapon": {
"type": "string"
},
"dmg1": {
"type": "string"
},
Expand Down Expand Up @@ -263,6 +269,23 @@
"speed": {
"$ref": "items-shared.json#/$defs/itemSpeed"
},

"charges": {
"type": ["string", "integer"]
},
"recharge": {
"$ref": "items-shared.json#/$defs/itemRecharge"
},
"rechargeAmount": {
"$ref": "items-shared.json#/$defs/itemRechargeAmount"
},

"$$if": {
"modes": ["brew", "ua"],
"value": {
"customProperties": {"$ref": "items-shared.json#/$defs/customProperties"}
}
},
"$$ifBrew": {
"currencyConversion": {
"description": "ID of a value conversion table. Homebrew only.",
Expand Down Expand Up @@ -356,21 +379,7 @@
"hasFluff": {"type": "boolean"},
"hasFluffImages": {"type": "boolean"}
},
"$$if": {
"modes": ["site", "ua"],
"value": {
"additionalProperties": false
}
},
"$$ifBrew": {
"additionalProperties": {
"type": [
"boolean",
"integer",
"string"
]
}
}
"additionalProperties": false
},

"baseitem": {
Expand Down
20 changes: 19 additions & 1 deletion schema-template/items-shared.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

"title": "Shared Item Schema",
"description": "Shared item definitions to be used in item schemas.",
"version": "1.0.4",
"version": "1.0.5",

"$defs" : {
"_itemModifySpeedEqual": {
Expand Down Expand Up @@ -222,6 +222,24 @@
"type": "integer"
},

"$$if": {
"modes": ["brew", "ua"],
"value": {
"customProperties": {
"description": "An unrestricted area for custom properties to be stored.",
"type": "object",
"additionalProperties": {
"type": [
"boolean",
"string",
"number",
"integer"
]
}
}
}
},

"$$ifBrew": {
"fluff": {
"description": "This is intended to be used for Homebrew only - site data should include a fluff file per source.",
Expand Down
24 changes: 8 additions & 16 deletions schema-template/items.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "items.json",
"version": "1.14.1",
"version": "1.14.3",
"type": "object",
"$defs": {
"itemData": {
Expand Down Expand Up @@ -467,6 +467,12 @@
"description": "Whether this item has references within its data to dedicated \"itemEntry\"s."
},

"$$if": {
"modes": ["brew", "ua"],
"value": {
"customProperties": {"$ref": "items-shared.json#/$defs/customProperties"}
}
},
"$$ifBrew": {
"acSpecial": {
"description": "Free text field for homebrew use.",
Expand Down Expand Up @@ -494,21 +500,7 @@
}
}
},
"$$if": {
"modes": ["site", "ua"],
"value": {
"additionalProperties": false
}
},
"$$ifBrew": {
"additionalProperties": {
"type": [
"boolean",
"integer",
"string"
]
}
}
"additionalProperties": false
},

"item": {
Expand Down
126 changes: 84 additions & 42 deletions schema-template/magicvariants.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "magicvariants.json",
"version": "1.8.4",
"version": "1.8.6",
"type": "object",
"properties": {
"magicvariant": {
Expand Down Expand Up @@ -34,24 +34,36 @@
"crossbow": {"type": "boolean"},
"sword": {"type": "boolean"},
"weapon": {"type": "boolean"},
"firearm": {"type": "boolean"},
"mace": {"type": "boolean"},
"spear": {"type": "boolean"},
"hammer": {"type": "boolean"},
"club": {"type": "boolean"},
"dagger": {"type": "boolean"},
"dmgType": {"$ref": "util.json#/$defs/dataDamageTags"},
"name": {"type": "string"},
"source": {"$ref": "util.json#/$defs/source"},
"type": {"$ref": "items-shared.json#/$defs/itemType"},
"scfType": {"$ref": "items-shared.json#/$defs/itemScfType"},
"net": {"type": "boolean"},
"weaponCategory": {"$ref": "items-shared.json#/$defs/itemWeaponCategory"},
"property": {"type": "string"}
},
"$$if": {
"modes": ["site", "ua"],
"value": {
"additionalProperties": false
"property": {"type": "string"},
"$$if": {
"modes": ["brew", "ua"],
"value": {
"customProperties": {
"description": "A more restrictive area for custom boolean-only properties to be stored.",
"type": "object",
"additionalProperties": {
"type": [
"boolean"
]
}
}
}
}
},
"$$ifBrew": {
"additionalProperties": {"type": "boolean"}
}
"additionalProperties": false
}
},
"inherits": {
Expand All @@ -73,6 +85,12 @@
"description": "Properties to remove from the specific variant, if present on the base item.",
"$ref": "items-shared.json#/$defs/itemProperty"
},
"ac": {
"type": "integer"
},
"age": {
"$ref": "items-shared.json#/$defs/itemAge"
},
"bonusAc": {
"type": "string"
},
Expand All @@ -97,6 +115,16 @@
"bonusAbilityCheck": {
"type": "string"
},
"dmg1": {
"type": "string"
},
"dmg2": {
"type": "string",
"description": "The versatile or alternative damage dice of the weapon, e.g. \"1d10\""
},
"dmgType": {
"$ref": "util.json#/$defs/dataDamageTags"
},
"modifySpeed": {
"$ref": "items-shared.json#/$defs/itemModifySpeed"
},
Expand All @@ -117,6 +145,9 @@
"nameRemove": {
"type": "string"
},
"grantsProficiency": {
"type": "boolean"
},
"reqAttune": {
"type": ["string", "boolean"]
},
Expand Down Expand Up @@ -201,6 +232,9 @@
"description": "Expression used to calculate each specific variant's value.",
"type": "string"
},
"weaponCategory": {
"$ref": "items-shared.json#/$defs/itemWeaponCategory"
},
"weightMult": {
"type": "number"
},
Expand All @@ -219,7 +253,20 @@
},
"mastery": {"$ref": "items-shared.json#/$defs/itemMastery"},
"reach": {"$ref": "items-shared.json#/$defs/itemReach"},
"$$if": {
"modes": ["brew", "ua"],
"value": {
"customProperties": {
"description": "An unrestricted area for custom properties to be stored.",
"type": "object"
}
}
},
"$$ifBrew": {
"currencyConversion": {
"description": "ID of a value conversion table. Homebrew only.",
"type": "string"
},
"fluff": {
"$ref": "items-shared.json#/$defs/fluff"
}
Expand All @@ -234,21 +281,7 @@
"source",
"page"
],
"$$if": {
"modes": ["site", "ua"],
"value": {
"additionalProperties": false
}
},
"$$ifBrew": {
"additionalProperties": {
"type": [
"boolean",
"integer",
"string"
]
}
}
"additionalProperties": false
},
"excludes": {
"type": "object",
Expand Down Expand Up @@ -280,25 +313,27 @@
}
]
},
"net": {
"type": "boolean"
}
},
"$$if": {
"modes": ["site", "ua"],
"value": {
"additionalProperties": false
"net": {"type": "boolean"},
"armor": {"type": "boolean"},
"axe": {"type": "boolean"},
"bow": {"type": "boolean"},
"crossbow": {"type": "boolean"},
"sword": {"type": "boolean"},
"weapon": {"type": "boolean"},
"firearm": {"type": "boolean"},
"mace": {"type": "boolean"},
"spear": {"type": "boolean"},
"hammer": {"type": "boolean"},
"club": {"type": "boolean"},
"dagger": {"type": "boolean"},
"$$if": {
"modes": ["brew", "ua"],
"value": {
"customProperties": {"$ref": "items-shared.json#/$defs/customProperties"}
}
}
},
"$$ifBrew": {
"additionalProperties": {
"type": [
"boolean",
"integer",
"string"
]
}
}
"additionalProperties": false
},
"noDisplay": {
"type": "boolean"
Expand All @@ -313,6 +348,7 @@
}
},
"ammo": {
"description": "Adds ammunition text to the header of the generic variant.",
"type": "boolean"
},
"reqAttuneTags": {
Expand All @@ -326,6 +362,12 @@
},
"hasFluff": {"type": "boolean"},
"hasFluffImages": {"type": "boolean"},
"$$if": {
"modes": ["brew", "ua"],
"value": {
"customProperties": {"$ref": "items-shared.json#/$defs/customProperties"}
}
},
"$$ifBrew": {
"fluff": {
"$ref": "items-shared.json#/$defs/fluff"
Expand Down
8 changes: 5 additions & 3 deletions schema-template/makebrew-creature.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "makebrew-creature.json",
"version": "1.1.3",
"version": "1.1.4",
"type": "object",
"properties": {
"#makebrewCreatureTrait": {
Expand Down Expand Up @@ -30,7 +30,8 @@
"name",
{"$$ifBrew_item": "source"},
"entries"
]
],
"additionalProperties": false
}
},
"makebrewCreatureAction": {
Expand All @@ -56,7 +57,8 @@
"name",
{"$$ifBrew_item": "source"},
"entries"
]
],
"additionalProperties": false
}
}
},
Expand Down
Loading