| 310 | } |
| 311 | |
| 312 | Json MonsterDatabase::mergeFinalParameters(JsonArray const& parameters) { |
| 313 | JsonObject mergedParameters; |
| 314 | |
| 315 | for (auto const& applyParams : parameters) { |
| 316 | for (auto const& pair : applyParams.iterateObject()) { |
| 317 | Json value = mergedParameters.value(pair.first); |
| 318 | |
| 319 | // Hard-coded merge for scripts and skills parameters, otherwise merge. |
| 320 | if (pair.first == "scripts" || pair.first == "skills" || pair.first == "specialSkills" |
| 321 | || pair.first == "baseSkills") { |
| 322 | auto array = value.optArray().value(); |
| 323 | array.appendAll(pair.second.optArray().value()); |
| 324 | value = std::move(array); |
| 325 | } else { |
| 326 | value = jsonMerge(value, pair.second); |
| 327 | } |
| 328 | |
| 329 | mergedParameters[pair.first] = value; |
| 330 | } |
| 331 | } |
| 332 | |
| 333 | return mergedParameters; |
| 334 | } |
| 335 | |
| 336 | void MonsterDatabase::readCommonParameters(MonsterVariant& variant) { |
| 337 | variant.shortDescription = variant.parameters.optString("shortdescription").orMaybe(variant.shortDescription); |
nothing calls this directly
no test coverage detected