| 93 | } |
| 94 | |
| 95 | SpawnProfile constructSpawnProfile(Json const& config, uint64_t seed) { |
| 96 | SpawnProfile spawnProfile; |
| 97 | auto commonGroups = Root::singleton().assets()->json("/spawning.config:spawnGroups"); |
| 98 | for (auto group : config.get("groups", JsonArray()).iterateArray()) { |
| 99 | auto poolNameOrConfig = group.get("pool"); |
| 100 | WeightedPool<String> typePool; |
| 101 | if (poolNameOrConfig.canConvert(Json::Type::String)) |
| 102 | typePool = jsonToWeightedPool<String>(commonGroups.get(poolNameOrConfig.toString())); |
| 103 | else |
| 104 | typePool = jsonToWeightedPool<String>(poolNameOrConfig); |
| 105 | |
| 106 | spawnProfile.spawnTypes.addAll(typePool.selectUniques(group.getUInt("select"), ++seed)); |
| 107 | } |
| 108 | |
| 109 | spawnProfile.monsterParameters = config.getObject("monsterParameters", JsonObject()); |
| 110 | |
| 111 | return spawnProfile; |
| 112 | } |
| 113 | |
| 114 | SpawnTypeDatabase::SpawnTypeDatabase() { |
| 115 | auto assets = Root::singleton().assets(); |
no test coverage detected