mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
- Bonus subtype will now be resolved using string identifiers.
- Registered secondary skills and resource names in identifier pool
This commit is contained in:
parent
91175f377b
commit
1807a8a536
@ -910,7 +910,7 @@
|
|||||||
{
|
{
|
||||||
"bonuses" : [
|
"bonuses" : [
|
||||||
{
|
{
|
||||||
"subtype" : 1,
|
"subtype" : "skill.archery",
|
||||||
"type" : "SECONDARY_SKILL_PREMY",
|
"type" : "SECONDARY_SKILL_PREMY",
|
||||||
"val" : 5,
|
"val" : 5,
|
||||||
"valueType" : "ADDITIVE_VALUE"
|
"valueType" : "ADDITIVE_VALUE"
|
||||||
@ -923,7 +923,7 @@
|
|||||||
{
|
{
|
||||||
"bonuses" : [
|
"bonuses" : [
|
||||||
{
|
{
|
||||||
"subtype" : 1,
|
"subtype" : "skill.archery",
|
||||||
"type" : "SECONDARY_SKILL_PREMY",
|
"type" : "SECONDARY_SKILL_PREMY",
|
||||||
"val" : 10,
|
"val" : 10,
|
||||||
"valueType" : "ADDITIVE_VALUE"
|
"valueType" : "ADDITIVE_VALUE"
|
||||||
@ -936,7 +936,7 @@
|
|||||||
{
|
{
|
||||||
"bonuses" : [
|
"bonuses" : [
|
||||||
{
|
{
|
||||||
"subtype" : 1,
|
"subtype" : "skill.archery",
|
||||||
"type" : "SECONDARY_SKILL_PREMY",
|
"type" : "SECONDARY_SKILL_PREMY",
|
||||||
"val" : 15,
|
"val" : 15,
|
||||||
"valueType" : "ADDITIVE_VALUE"
|
"valueType" : "ADDITIVE_VALUE"
|
||||||
@ -949,7 +949,7 @@
|
|||||||
{
|
{
|
||||||
"bonuses" : [
|
"bonuses" : [
|
||||||
{
|
{
|
||||||
"subtype" : 11,
|
"subtype" : "skill.eagleEye",
|
||||||
"type" : "SECONDARY_SKILL_PREMY",
|
"type" : "SECONDARY_SKILL_PREMY",
|
||||||
"val" : 5,
|
"val" : 5,
|
||||||
"valueType" : "ADDITIVE_VALUE"
|
"valueType" : "ADDITIVE_VALUE"
|
||||||
@ -962,7 +962,7 @@
|
|||||||
{
|
{
|
||||||
"bonuses" : [
|
"bonuses" : [
|
||||||
{
|
{
|
||||||
"subtype" : 11,
|
"subtype" : "skill.eagleEye",
|
||||||
"type" : "SECONDARY_SKILL_PREMY",
|
"type" : "SECONDARY_SKILL_PREMY",
|
||||||
"val" : 10,
|
"val" : 10,
|
||||||
"valueType" : "ADDITIVE_VALUE"
|
"valueType" : "ADDITIVE_VALUE"
|
||||||
@ -975,7 +975,7 @@
|
|||||||
{
|
{
|
||||||
"bonuses" : [
|
"bonuses" : [
|
||||||
{
|
{
|
||||||
"subtype" : 11,
|
"subtype" : "skill.eagleEye",
|
||||||
"type" : "SECONDARY_SKILL_PREMY",
|
"type" : "SECONDARY_SKILL_PREMY",
|
||||||
"val" : 15,
|
"val" : 15,
|
||||||
"valueType" : "ADDITIVE_VALUE"
|
"valueType" : "ADDITIVE_VALUE"
|
||||||
@ -1401,7 +1401,7 @@
|
|||||||
{
|
{
|
||||||
"bonuses" : [
|
"bonuses" : [
|
||||||
{
|
{
|
||||||
"subtype" : 59,
|
"subtype" : "spell.berserk",
|
||||||
"type" : "SPELL_IMMUNITY",
|
"type" : "SPELL_IMMUNITY",
|
||||||
"val" : 0,
|
"val" : 0,
|
||||||
"valueType" : "BASE_NUMBER"
|
"valueType" : "BASE_NUMBER"
|
||||||
@ -1414,7 +1414,7 @@
|
|||||||
{
|
{
|
||||||
"bonuses" : [
|
"bonuses" : [
|
||||||
{
|
{
|
||||||
"subtype" : 62,
|
"subtype" : "spell.blind",
|
||||||
"type" : "SPELL_IMMUNITY",
|
"type" : "SPELL_IMMUNITY",
|
||||||
"val" : 0,
|
"val" : 0,
|
||||||
"valueType" : "BASE_NUMBER"
|
"valueType" : "BASE_NUMBER"
|
||||||
@ -1427,7 +1427,7 @@
|
|||||||
{
|
{
|
||||||
"bonuses" : [
|
"bonuses" : [
|
||||||
{
|
{
|
||||||
"subtype" : 42,
|
"subtype" : "spell.curse",
|
||||||
"type" : "SPELL_IMMUNITY",
|
"type" : "SPELL_IMMUNITY",
|
||||||
"val" : 0,
|
"val" : 0,
|
||||||
"valueType" : "BASE_NUMBER"
|
"valueType" : "BASE_NUMBER"
|
||||||
@ -1440,7 +1440,7 @@
|
|||||||
{
|
{
|
||||||
"bonuses" : [
|
"bonuses" : [
|
||||||
{
|
{
|
||||||
"subtype" : 24,
|
"subtype" : "spell.deathRipple",
|
||||||
"type" : "SPELL_IMMUNITY",
|
"type" : "SPELL_IMMUNITY",
|
||||||
"val" : 0,
|
"val" : 0,
|
||||||
"valueType" : "BASE_NUMBER"
|
"valueType" : "BASE_NUMBER"
|
||||||
@ -1454,7 +1454,7 @@
|
|||||||
"bonuses" : [
|
"bonuses" : [
|
||||||
{
|
{
|
||||||
"limiter" : "IS_UNDEAD",
|
"limiter" : "IS_UNDEAD",
|
||||||
"subtype" : 25,
|
"subtype" : "spell.destroyUndead",
|
||||||
"type" : "SPELL_IMMUNITY",
|
"type" : "SPELL_IMMUNITY",
|
||||||
"val" : 0,
|
"val" : 0,
|
||||||
"valueType" : "BASE_NUMBER"
|
"valueType" : "BASE_NUMBER"
|
||||||
@ -1467,7 +1467,7 @@
|
|||||||
{
|
{
|
||||||
"bonuses" : [
|
"bonuses" : [
|
||||||
{
|
{
|
||||||
"subtype" : 60,
|
"subtype" : "spell.hypnotize",
|
||||||
"type" : "SPELL_IMMUNITY",
|
"type" : "SPELL_IMMUNITY",
|
||||||
"val" : 0,
|
"val" : 0,
|
||||||
"valueType" : "BASE_NUMBER"
|
"valueType" : "BASE_NUMBER"
|
||||||
@ -1480,13 +1480,13 @@
|
|||||||
{
|
{
|
||||||
"bonuses" : [
|
"bonuses" : [
|
||||||
{
|
{
|
||||||
"subtype" : 17,
|
"subtype" : "spell.lightningBolt",
|
||||||
"type" : "SPELL_IMMUNITY",
|
"type" : "SPELL_IMMUNITY",
|
||||||
"val" : 0,
|
"val" : 0,
|
||||||
"valueType" : "BASE_NUMBER"
|
"valueType" : "BASE_NUMBER"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"subtype" : 19,
|
"subtype" : "spell.chainLightning",
|
||||||
"type" : "SPELL_IMMUNITY",
|
"type" : "SPELL_IMMUNITY",
|
||||||
"val" : 0,
|
"val" : 0,
|
||||||
"valueType" : "BASE_NUMBER"
|
"valueType" : "BASE_NUMBER"
|
||||||
@ -1499,7 +1499,7 @@
|
|||||||
{
|
{
|
||||||
"bonuses" : [
|
"bonuses" : [
|
||||||
{
|
{
|
||||||
"subtype" : 61,
|
"subtype" : "spell.forgetfulness",
|
||||||
"type" : "SPELL_IMMUNITY",
|
"type" : "SPELL_IMMUNITY",
|
||||||
"val" : 0,
|
"val" : 0,
|
||||||
"valueType" : "BASE_NUMBER"
|
"valueType" : "BASE_NUMBER"
|
||||||
@ -1529,7 +1529,7 @@
|
|||||||
{
|
{
|
||||||
"bonuses" : [
|
"bonuses" : [
|
||||||
{
|
{
|
||||||
"subtype" : 4,
|
"subtype" : "resource.crystal",
|
||||||
"type" : "GENERATE_RESOURCE",
|
"type" : "GENERATE_RESOURCE",
|
||||||
"val" : 1,
|
"val" : 1,
|
||||||
"valueType" : "BASE_NUMBER"
|
"valueType" : "BASE_NUMBER"
|
||||||
@ -1542,7 +1542,7 @@
|
|||||||
{
|
{
|
||||||
"bonuses" : [
|
"bonuses" : [
|
||||||
{
|
{
|
||||||
"subtype" : 5,
|
"subtype" : "resource.gems",
|
||||||
"type" : "GENERATE_RESOURCE",
|
"type" : "GENERATE_RESOURCE",
|
||||||
"val" : 1,
|
"val" : 1,
|
||||||
"valueType" : "BASE_NUMBER"
|
"valueType" : "BASE_NUMBER"
|
||||||
@ -1555,7 +1555,7 @@
|
|||||||
{
|
{
|
||||||
"bonuses" : [
|
"bonuses" : [
|
||||||
{
|
{
|
||||||
"subtype" : 1,
|
"subtype" : "resource.mercury",
|
||||||
"type" : "GENERATE_RESOURCE",
|
"type" : "GENERATE_RESOURCE",
|
||||||
"val" : 1,
|
"val" : 1,
|
||||||
"valueType" : "BASE_NUMBER"
|
"valueType" : "BASE_NUMBER"
|
||||||
@ -1568,7 +1568,7 @@
|
|||||||
{
|
{
|
||||||
"bonuses" : [
|
"bonuses" : [
|
||||||
{
|
{
|
||||||
"subtype" : 2,
|
"subtype" : "resource.ore",
|
||||||
"type" : "GENERATE_RESOURCE",
|
"type" : "GENERATE_RESOURCE",
|
||||||
"val" : 1,
|
"val" : 1,
|
||||||
"valueType" : "BASE_NUMBER"
|
"valueType" : "BASE_NUMBER"
|
||||||
@ -1581,7 +1581,7 @@
|
|||||||
{
|
{
|
||||||
"bonuses" : [
|
"bonuses" : [
|
||||||
{
|
{
|
||||||
"subtype" : 3,
|
"subtype" : "resource.sulfur",
|
||||||
"type" : "GENERATE_RESOURCE",
|
"type" : "GENERATE_RESOURCE",
|
||||||
"val" : 1,
|
"val" : 1,
|
||||||
"valueType" : "BASE_NUMBER"
|
"valueType" : "BASE_NUMBER"
|
||||||
@ -1594,7 +1594,7 @@
|
|||||||
{
|
{
|
||||||
"bonuses" : [
|
"bonuses" : [
|
||||||
{
|
{
|
||||||
"subtype" : 0,
|
"subtype" : "resource.wood",
|
||||||
"type" : "GENERATE_RESOURCE",
|
"type" : "GENERATE_RESOURCE",
|
||||||
"val" : 1,
|
"val" : 1,
|
||||||
"valueType" : "BASE_NUMBER"
|
"valueType" : "BASE_NUMBER"
|
||||||
@ -1607,7 +1607,7 @@
|
|||||||
{
|
{
|
||||||
"bonuses" : [
|
"bonuses" : [
|
||||||
{
|
{
|
||||||
"subtype" : 6,
|
"subtype" : "resource.gold",
|
||||||
"type" : "GENERATE_RESOURCE",
|
"type" : "GENERATE_RESOURCE",
|
||||||
"val" : 1000,
|
"val" : 1000,
|
||||||
"valueType" : "BASE_NUMBER"
|
"valueType" : "BASE_NUMBER"
|
||||||
@ -1620,7 +1620,7 @@
|
|||||||
{
|
{
|
||||||
"bonuses" : [
|
"bonuses" : [
|
||||||
{
|
{
|
||||||
"subtype" : 6,
|
"subtype" : "resource.gold",
|
||||||
"type" : "GENERATE_RESOURCE",
|
"type" : "GENERATE_RESOURCE",
|
||||||
"val" : 750,
|
"val" : 750,
|
||||||
"valueType" : "BASE_NUMBER"
|
"valueType" : "BASE_NUMBER"
|
||||||
@ -1633,7 +1633,7 @@
|
|||||||
{
|
{
|
||||||
"bonuses" : [
|
"bonuses" : [
|
||||||
{
|
{
|
||||||
"subtype" : 6,
|
"subtype" : "resource.gold",
|
||||||
"type" : "GENERATE_RESOURCE",
|
"type" : "GENERATE_RESOURCE",
|
||||||
"val" : 500,
|
"val" : 500,
|
||||||
"valueType" : "BASE_NUMBER"
|
"valueType" : "BASE_NUMBER"
|
||||||
@ -1681,13 +1681,13 @@
|
|||||||
"valueType" : "BASE_NUMBER"
|
"valueType" : "BASE_NUMBER"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"subtype" : 0,
|
"subtype" : "spell.summonBoat",
|
||||||
"type" : "SPELL",
|
"type" : "SPELL",
|
||||||
"val" : 3,
|
"val" : 3,
|
||||||
"valueType" : "INDEPENDENT_MAX"
|
"valueType" : "INDEPENDENT_MAX"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"subtype" : 1,
|
"subtype" : "spell.scuttleBoat",
|
||||||
"type" : "SPELL",
|
"type" : "SPELL",
|
||||||
"val" : 3,
|
"val" : 3,
|
||||||
"valueType" : "INDEPENDENT_MAX"
|
"valueType" : "INDEPENDENT_MAX"
|
||||||
@ -1744,13 +1744,13 @@
|
|||||||
{
|
{
|
||||||
"bonuses" : [
|
"bonuses" : [
|
||||||
{
|
{
|
||||||
"subtype" : 26,
|
"subtype" : "spell.armageddon",
|
||||||
"type" : "SPELL",
|
"type" : "SPELL",
|
||||||
"val" : 3,
|
"val" : 3,
|
||||||
"valueType" : "INDEPENDENT_MAX"
|
"valueType" : "INDEPENDENT_MAX"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"subtype" : 26,
|
"subtype" : "spell.armageddon",
|
||||||
"type" : "SPELL_IMMUNITY",
|
"type" : "SPELL_IMMUNITY",
|
||||||
"val" : 0,
|
"val" : 0,
|
||||||
"valueType" : "BASE_NUMBER"
|
"valueType" : "BASE_NUMBER"
|
||||||
@ -1792,7 +1792,7 @@
|
|||||||
"valueType" : "BASE_NUMBER"
|
"valueType" : "BASE_NUMBER"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"subtype" : 48,
|
"subtype" : "spell.prayer",
|
||||||
"type" : "OPENING_BATTLE_SPELL",
|
"type" : "OPENING_BATTLE_SPELL",
|
||||||
"val" : 10,
|
"val" : 10,
|
||||||
"valueType" : "BASE_NUMBER"
|
"valueType" : "BASE_NUMBER"
|
||||||
@ -1855,25 +1855,25 @@
|
|||||||
{
|
{
|
||||||
"bonuses" : [
|
"bonuses" : [
|
||||||
{
|
{
|
||||||
"subtype" : 54,
|
"subtype" : "spell.slow",
|
||||||
"type" : "OPENING_BATTLE_SPELL",
|
"type" : "OPENING_BATTLE_SPELL",
|
||||||
"val" : 50,
|
"val" : 50,
|
||||||
"valueType" : "BASE_NUMBER"
|
"valueType" : "BASE_NUMBER"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"subtype" : 47,
|
"subtype" : "spell.curse",
|
||||||
"type" : "OPENING_BATTLE_SPELL",
|
"type" : "OPENING_BATTLE_SPELL",
|
||||||
"val" : 50,
|
"val" : 50,
|
||||||
"valueType" : "BASE_NUMBER"
|
"valueType" : "BASE_NUMBER"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"subtype" : 45,
|
"subtype" : "spell.weakness",
|
||||||
"type" : "OPENING_BATTLE_SPELL",
|
"type" : "OPENING_BATTLE_SPELL",
|
||||||
"val" : 50,
|
"val" : 50,
|
||||||
"valueType" : "BASE_NUMBER"
|
"valueType" : "BASE_NUMBER"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"subtype" : 52,
|
"subtype" : "spell.misfortune",
|
||||||
"type" : "OPENING_BATTLE_SPELL",
|
"type" : "OPENING_BATTLE_SPELL",
|
||||||
"val" : 50,
|
"val" : 50,
|
||||||
"valueType" : "BASE_NUMBER"
|
"valueType" : "BASE_NUMBER"
|
||||||
@ -1930,7 +1930,7 @@
|
|||||||
{
|
{
|
||||||
"bonuses" : [
|
"bonuses" : [
|
||||||
{
|
{
|
||||||
"subtype" : 57,
|
"subtype" : "spell.titanBolt",
|
||||||
"type" : "SPELL",
|
"type" : "SPELL",
|
||||||
"val" : 3,
|
"val" : 3,
|
||||||
"valueType" : "BASE_NUMBER"
|
"valueType" : "BASE_NUMBER"
|
||||||
@ -2037,25 +2037,25 @@
|
|||||||
{
|
{
|
||||||
"bonuses" : [
|
"bonuses" : [
|
||||||
{
|
{
|
||||||
"subtype" : 1,
|
"subtype" : "resource.crystal",
|
||||||
"type" : "GENERATE_RESOURCE",
|
"type" : "GENERATE_RESOURCE",
|
||||||
"val" : 4,
|
"val" : 4,
|
||||||
"valueType" : "BASE_NUMBER"
|
"valueType" : "BASE_NUMBER"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"subtype" : 3,
|
"subtype" : "resource.gems",
|
||||||
"type" : "GENERATE_RESOURCE",
|
"type" : "GENERATE_RESOURCE",
|
||||||
"val" : 4,
|
"val" : 4,
|
||||||
"valueType" : "BASE_NUMBER"
|
"valueType" : "BASE_NUMBER"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"subtype" : 4,
|
"subtype" : "resource.mercury",
|
||||||
"type" : "GENERATE_RESOURCE",
|
"type" : "GENERATE_RESOURCE",
|
||||||
"val" : 4,
|
"val" : 4,
|
||||||
"valueType" : "BASE_NUMBER"
|
"valueType" : "BASE_NUMBER"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"subtype" : 5,
|
"subtype" : "resource.sulfur",
|
||||||
"type" : "GENERATE_RESOURCE",
|
"type" : "GENERATE_RESOURCE",
|
||||||
"val" : 4,
|
"val" : 4,
|
||||||
"valueType" : "BASE_NUMBER"
|
"valueType" : "BASE_NUMBER"
|
||||||
@ -2080,13 +2080,13 @@
|
|||||||
"valueType" : "BASE_NUMBER"
|
"valueType" : "BASE_NUMBER"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"subtype" : 18,
|
"subtype" : "spell.implosion",
|
||||||
"type" : "SPELLCASTER",
|
"type" : "SPELLCASTER",
|
||||||
"val" : 0,
|
"val" : 0,
|
||||||
"valueType" : "BASE_NUMBER"
|
"valueType" : "BASE_NUMBER"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"subtype" : 21,
|
"subtype" : "spell.fireball",
|
||||||
"type" : "SPELLCASTER",
|
"type" : "SPELLCASTER",
|
||||||
"val" : 0,
|
"val" : 0,
|
||||||
"valueType" : "BASE_NUMBER"
|
"valueType" : "BASE_NUMBER"
|
||||||
@ -2097,14 +2097,14 @@
|
|||||||
"valueType" : "BASE_NUMBER"
|
"valueType" : "BASE_NUMBER"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"subtype" : 63,
|
"subtype" : "creature.vampireLord",
|
||||||
"type" : "DAEMON_SUMMONING",
|
"type" : "DAEMON_SUMMONING",
|
||||||
"val" : 10,
|
"val" : 10,
|
||||||
"valueType" : "BASE_NUMBER"
|
"valueType" : "BASE_NUMBER"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"additionalInfo" : 2,
|
"additionalInfo" : 2,
|
||||||
"subtype" : 17,
|
"subtype" : "spell.lightningBolt",
|
||||||
"type" : "ENCHANTER",
|
"type" : "ENCHANTER",
|
||||||
"val" : 0,
|
"val" : 0,
|
||||||
"valueType" : "BASE_NUMBER"
|
"valueType" : "BASE_NUMBER"
|
||||||
@ -2166,28 +2166,28 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"additionalInfo" : 1,
|
"additionalInfo" : 1,
|
||||||
"subtype" : 75,
|
"subtype" : "spell.age",
|
||||||
"type" : "SPELL_BEFORE_ATTACK",
|
"type" : "SPELL_BEFORE_ATTACK",
|
||||||
"val" : 50,
|
"val" : 50,
|
||||||
"valueType" : "BASE_NUMBER"
|
"valueType" : "BASE_NUMBER"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"additionalInfo" : 1,
|
"additionalInfo" : 1,
|
||||||
"subtype" : 59,
|
"subtype" : "spell.berserk",
|
||||||
"type" : "SPELL_AFTER_ATTACK",
|
"type" : "SPELL_AFTER_ATTACK",
|
||||||
"val" : 50,
|
"val" : 50,
|
||||||
"valueType" : "BASE_NUMBER"
|
"valueType" : "BASE_NUMBER"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"additionalInfo" : 1,
|
"additionalInfo" : 1,
|
||||||
"subtype" : 71,
|
"subtype" : "spell.poison",
|
||||||
"type" : "SPELL_AFTER_ATTACK",
|
"type" : "SPELL_AFTER_ATTACK",
|
||||||
"val" : 50,
|
"val" : 50,
|
||||||
"valueType" : "BASE_NUMBER"
|
"valueType" : "BASE_NUMBER"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"additionalInfo" : 1,
|
"additionalInfo" : 1,
|
||||||
"subtype" : 47,
|
"subtype" : "spell.disruptingRay",
|
||||||
"type" : "SPELL_AFTER_ATTACK",
|
"type" : "SPELL_AFTER_ATTACK",
|
||||||
"val" : 50,
|
"val" : 50,
|
||||||
"valueType" : "BASE_NUMBER"
|
"valueType" : "BASE_NUMBER"
|
||||||
|
@ -205,7 +205,12 @@ CHeroHandler::~CHeroHandler()
|
|||||||
}
|
}
|
||||||
|
|
||||||
CHeroHandler::CHeroHandler()
|
CHeroHandler::CHeroHandler()
|
||||||
{}
|
{
|
||||||
|
for (int i = 0; i < GameConstants::SKILL_QUANTITY; ++i)
|
||||||
|
{
|
||||||
|
VLC->modh->identifiers.registerObject("skill." + SecondarySkill::names[i], i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void CHeroHandler::load(const JsonNode & input)
|
void CHeroHandler::load(const JsonNode & input)
|
||||||
{
|
{
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
#include "CTownHandler.h"
|
#include "CTownHandler.h"
|
||||||
#include "CHeroHandler.h"
|
#include "CHeroHandler.h"
|
||||||
#include "CObjectHandler.h"
|
#include "CObjectHandler.h"
|
||||||
|
#include "StringConstants.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* CModHandler.h, part of VCMI engine
|
* CModHandler.h, part of VCMI engine
|
||||||
@ -89,6 +90,11 @@ CModHandler::CModHandler()
|
|||||||
{
|
{
|
||||||
VLC->modh = this;
|
VLC->modh = this;
|
||||||
|
|
||||||
|
for (int i = 0; i < GameConstants::RESOURCE_QUANTITY; ++i)
|
||||||
|
{
|
||||||
|
identifiers.registerObject("resource." + GameConstants::RESOURCE_NAMES[i], i);
|
||||||
|
}
|
||||||
|
|
||||||
loadConfigFromFile ("defaultMods");
|
loadConfigFromFile ("defaultMods");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,9 +13,14 @@
|
|||||||
|
|
||||||
#include "HeroBonus.h"
|
#include "HeroBonus.h"
|
||||||
#include "Filesystem/CResourceLoader.h"
|
#include "Filesystem/CResourceLoader.h"
|
||||||
|
#include "VCMI_Lib.h" //for identifier resolution
|
||||||
|
#include "CModHandler.h"
|
||||||
|
|
||||||
using namespace JsonDetail;
|
using namespace JsonDetail;
|
||||||
|
|
||||||
|
class LibClasses;
|
||||||
|
class CModHandler;
|
||||||
|
|
||||||
static const JsonNode nullNode;
|
static const JsonNode nullNode;
|
||||||
|
|
||||||
JsonNode::JsonNode(JsonType Type):
|
JsonNode::JsonNode(JsonType Type):
|
||||||
@ -920,6 +925,29 @@ const T & parseByMap(const std::map<std::string, T> & map, const JsonNode * val,
|
|||||||
return defaultValue;
|
return defaultValue;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void JsonUtils::resolveIdentifier (si32 &var, const JsonNode &node, std::string name)
|
||||||
|
{
|
||||||
|
const JsonNode *value;
|
||||||
|
value = &node[name];
|
||||||
|
if (!value->isNull())
|
||||||
|
{
|
||||||
|
switch (value->getType())
|
||||||
|
{
|
||||||
|
case JsonNode::DATA_FLOAT:
|
||||||
|
var = value->Float();
|
||||||
|
break;
|
||||||
|
case JsonNode::DATA_STRING:
|
||||||
|
VLC->modh->identifiers.requestIdentifier (value->String(), [&](si32 identifier)
|
||||||
|
{
|
||||||
|
var = identifier;
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
tlog2 << "Error! Wrong indentifier used for value of " << name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Bonus * JsonUtils::parseBonus (const JsonNode &ability)
|
Bonus * JsonUtils::parseBonus (const JsonNode &ability)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -935,9 +963,7 @@ Bonus * JsonUtils::parseBonus (const JsonNode &ability)
|
|||||||
}
|
}
|
||||||
b->type = it->second;
|
b->type = it->second;
|
||||||
|
|
||||||
value = &ability["subtype"];
|
resolveIdentifier (b->subtype, ability, "subtype");
|
||||||
if (!value->isNull())
|
|
||||||
b->subtype = value->Float();
|
|
||||||
|
|
||||||
value = &ability["val"];
|
value = &ability["val"];
|
||||||
if (!value->isNull())
|
if (!value->isNull())
|
||||||
|
@ -117,6 +117,7 @@ namespace JsonUtils
|
|||||||
DLL_LINKAGE Bonus * parseBonus (const JsonVector &ability_vec);
|
DLL_LINKAGE Bonus * parseBonus (const JsonVector &ability_vec);
|
||||||
DLL_LINKAGE Bonus * parseBonus (const JsonNode &bonus);
|
DLL_LINKAGE Bonus * parseBonus (const JsonNode &bonus);
|
||||||
DLL_LINKAGE void unparseBonus (JsonNode &node, const Bonus * bonus);
|
DLL_LINKAGE void unparseBonus (JsonNode &node, const Bonus * bonus);
|
||||||
|
DLL_LINKAGE void resolveIdentifier (si32 &var, const JsonNode &node, std::string name);
|
||||||
|
|
||||||
/// recursivly merges source into dest, replacing identical fields
|
/// recursivly merges source into dest, replacing identical fields
|
||||||
/// struct : recursively calls this function
|
/// struct : recursively calls this function
|
||||||
|
Loading…
Reference in New Issue
Block a user