diff --git a/Das_Schwarze_Auge_4-1/dsa4_1_character_sheet_roll20.html b/Das_Schwarze_Auge_4-1/dsa4_1_character_sheet_roll20.html index 3475e8fd3b..cf81976672 100644 --- a/Das_Schwarze_Auge_4-1/dsa4_1_character_sheet_roll20.html +++ b/Das_Schwarze_Auge_4-1/dsa4_1_character_sheet_roll20.html @@ -16813,6 +16813,25 @@ function DSAsane (value, type) { return !errors; } +/* + Property Checker + Checks whether properties (given in an array of strings) are available in an object. + Does not check whether the array contains strings only. + Returns an object with the error count (missing properties) and a string array of missing properties. +*/ +function checkRequiredProperties(properties, values) { + var errors = 0; + var missing = []; + + for (req of properties) { + if (!values.hasOwnProperty(req)) { + errors += 1; + missing.push(req); + } + } + return { "errors": errors, "missing": missing.toString() }; +} + // Berechne BE-Basis aus dem gesamten Rüstungs BE und der BE durch Last on("change:Ges_BE change:BE_Last", function(eventInfo) { getAttrs(["Ges_BE", "BE_Last"], function(values) {