|
|
@@ -1206,45 +1206,52 @@ CGObjectInstance * CMapLoaderH3M::readScholar(const int3 & position, std::shared
|
|
|
auto bonusType = static_cast<ScholarBonusType>(bonusTypeRaw);
|
|
|
auto bonusID = reader->readUInt8();
|
|
|
|
|
|
- switch (bonusType)
|
|
|
+ if (rewardable)
|
|
|
{
|
|
|
- case ScholarBonusType::PRIM_SKILL:
|
|
|
- {
|
|
|
- JsonNode variable;
|
|
|
- JsonNode dice;
|
|
|
- variable.String() = NPrimarySkill::names[bonusID];
|
|
|
- variable.setMeta(ModScope::scopeGame());
|
|
|
- dice.Integer() = 80;
|
|
|
- rewardable->configuration.presetVariable("primarySkill", "gainedStat", variable);
|
|
|
- rewardable->configuration.presetVariable("dice", "0", dice);
|
|
|
- break;
|
|
|
- }
|
|
|
- case ScholarBonusType::SECONDARY_SKILL:
|
|
|
- {
|
|
|
- JsonNode variable;
|
|
|
- JsonNode dice;
|
|
|
- variable.String() = VLC->skills()->getByIndex(bonusID)->getJsonKey();
|
|
|
- variable.setMeta(ModScope::scopeGame());
|
|
|
- dice.Integer() = 50;
|
|
|
- rewardable->configuration.presetVariable("secondarySkill", "gainedSkill", variable);
|
|
|
- rewardable->configuration.presetVariable("dice", "0", dice);
|
|
|
- break;
|
|
|
- }
|
|
|
- case ScholarBonusType::SPELL:
|
|
|
+ switch (bonusType)
|
|
|
{
|
|
|
- JsonNode variable;
|
|
|
- JsonNode dice;
|
|
|
- variable.String() = VLC->spells()->getByIndex(bonusID)->getJsonKey();
|
|
|
- variable.setMeta(ModScope::scopeGame());
|
|
|
- dice.Integer() = 20;
|
|
|
- rewardable->configuration.presetVariable("spell", "gainedSpell", variable);
|
|
|
- rewardable->configuration.presetVariable("dice", "0", dice);
|
|
|
- break;
|
|
|
+ case ScholarBonusType::PRIM_SKILL:
|
|
|
+ {
|
|
|
+ JsonNode variable;
|
|
|
+ JsonNode dice;
|
|
|
+ variable.String() = NPrimarySkill::names[bonusID];
|
|
|
+ variable.setMeta(ModScope::scopeGame());
|
|
|
+ dice.Integer() = 80;
|
|
|
+ rewardable->configuration.presetVariable("primarySkill", "gainedStat", variable);
|
|
|
+ rewardable->configuration.presetVariable("dice", "0", dice);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ case ScholarBonusType::SECONDARY_SKILL:
|
|
|
+ {
|
|
|
+ JsonNode variable;
|
|
|
+ JsonNode dice;
|
|
|
+ variable.String() = VLC->skills()->getByIndex(bonusID)->getJsonKey();
|
|
|
+ variable.setMeta(ModScope::scopeGame());
|
|
|
+ dice.Integer() = 50;
|
|
|
+ rewardable->configuration.presetVariable("secondarySkill", "gainedSkill", variable);
|
|
|
+ rewardable->configuration.presetVariable("dice", "0", dice);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ case ScholarBonusType::SPELL:
|
|
|
+ {
|
|
|
+ JsonNode variable;
|
|
|
+ JsonNode dice;
|
|
|
+ variable.String() = VLC->spells()->getByIndex(bonusID)->getJsonKey();
|
|
|
+ variable.setMeta(ModScope::scopeGame());
|
|
|
+ dice.Integer() = 20;
|
|
|
+ rewardable->configuration.presetVariable("spell", "gainedSpell", variable);
|
|
|
+ rewardable->configuration.presetVariable("dice", "0", dice);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ case ScholarBonusType::RANDOM:
|
|
|
+ break;// No-op
|
|
|
+ default:
|
|
|
+ logGlobal->warn("Map '%s': Invalid Scholar settings! Ignoring...", mapName);
|
|
|
}
|
|
|
- case ScholarBonusType::RANDOM:
|
|
|
- break;// No-op
|
|
|
- default:
|
|
|
- logGlobal->warn("Map '%s': Invalid Scholar settings! Ignoring...", mapName);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ logGlobal->warn("Failed to set reward parameters for a Scholar! Object is not rewardable!");
|
|
|
}
|
|
|
|
|
|
reader->skipZero(6);
|