mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
- h3 hero classes and artifacts can be modified via json
- commander artifacts are now merged into main artifacts.json, todo - split 2.5k file into something manageable
This commit is contained in:
parent
3fe7c61131
commit
5082dafd62
@ -262,6 +262,26 @@ int main(int argc, char** argv)
|
|||||||
|
|
||||||
preinitDLL(::console, logfile);
|
preinitDLL(::console, logfile);
|
||||||
|
|
||||||
|
// Some basic data validation to produce better error messages in cases of incorrect install
|
||||||
|
auto testFile = [](std::string filename, std::string message) -> bool
|
||||||
|
{
|
||||||
|
if (CResourceHandler::get()->existsResource(ResourceID(filename)))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
tlog1 << "Error: " << message << " was not found!\n";
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
|
if (!testFile("DATA/HELP.TXT", "Heroes III data") &&
|
||||||
|
!testFile("DATA/ZELP.TXT", "In the Wake of Gods data") &&
|
||||||
|
!testFile("MODS/VCMI/MOD.JSON", "VCMI mod") &&
|
||||||
|
!testFile("DATA/StackQueueBgBig.PCX", "VCMI data"))
|
||||||
|
exit(1); // These are unrecoverable errors
|
||||||
|
|
||||||
|
// these two are optional + some installs have them on CD and not in data directory
|
||||||
|
testFile("VIDEO/GOOD1A.SMK", "campaign movies");
|
||||||
|
testFile("SOUNDS/G1A.WAV", "campaign music"); //technically not a music but voiced intro sounds
|
||||||
|
|
||||||
settings.init();
|
settings.init();
|
||||||
conf.init();
|
conf.init();
|
||||||
tlog0 <<"Loading settings: "<<pomtime.getDiff() << std::endl;
|
tlog0 <<"Loading settings: "<<pomtime.getDiff() << std::endl;
|
||||||
|
@ -2356,7 +2356,17 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"id" : 146,
|
"id" : 146,
|
||||||
"type" : ["COMMANDER"]
|
"type" : ["COMMANDER"],
|
||||||
|
"growing":
|
||||||
|
{
|
||||||
|
"bonusesPerLevel":
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"level": 6,
|
||||||
|
"bonus": ["PRIMARY_SKILL", 1, "primSkill.attack", 0]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"mithrilMail":
|
"mithrilMail":
|
||||||
{
|
{
|
||||||
@ -2368,7 +2378,17 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"id" : 147,
|
"id" : 147,
|
||||||
"type" : ["COMMANDER"]
|
"type" : ["COMMANDER"],
|
||||||
|
"growing":
|
||||||
|
{
|
||||||
|
"bonusesPerLevel":
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"level": 1,
|
||||||
|
"bonus": ["STACK_HEALTH", 1, 0, 0]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"swordOfSharpness":
|
"swordOfSharpness":
|
||||||
{
|
{
|
||||||
@ -2381,7 +2401,17 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"id" : 148,
|
"id" : 148,
|
||||||
"type" : ["COMMANDER"]
|
"type" : ["COMMANDER"],
|
||||||
|
"growing":
|
||||||
|
{
|
||||||
|
"bonusesPerLevel":
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"level": 1,
|
||||||
|
"bonus": ["CREATURE_DAMAGE", 1, 0, 0]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"helmOfImmortality": //TODO: implement
|
"helmOfImmortality": //TODO: implement
|
||||||
{
|
{
|
||||||
@ -2398,7 +2428,17 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"id" : 150,
|
"id" : 150,
|
||||||
"type" : ["COMMANDER"]
|
"type" : ["COMMANDER"],
|
||||||
|
"growing":
|
||||||
|
{
|
||||||
|
"bonusesPerLevel":
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"level": 10,
|
||||||
|
"bonus": ["CREATURE_ENCHANT_POWER", 1, 0, 0]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"bootsOfHaste":
|
"bootsOfHaste":
|
||||||
{
|
{
|
||||||
@ -2410,17 +2450,46 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"id" : 151,
|
"id" : 151,
|
||||||
"type" : ["COMMANDER"]
|
"type" : ["COMMANDER"],
|
||||||
|
"growing":
|
||||||
|
{
|
||||||
|
"bonusesPerLevel":
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"level": 10,
|
||||||
|
"bonus": ["STACKS_SPEED", 1, 0, 0]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"bowOfSeeking":
|
"bowOfSeeking":
|
||||||
{
|
{
|
||||||
"id" : 152,
|
"id" : 152,
|
||||||
"type" : ["COMMANDER"]
|
"type" : ["COMMANDER"],
|
||||||
|
"growing":
|
||||||
|
{
|
||||||
|
"id": 152, //bow of seeking
|
||||||
|
"thresholdBonuses":
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"level": 5,
|
||||||
|
"bonus": ["SHOOTER", 0, 0, 0]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"level": 25,
|
||||||
|
"bonus": ["NO_WALL_PENALTY", 0, 0, 0]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"level": 50,
|
||||||
|
"bonus": ["NO_DISTANCE_PENALTY", 0, 0, 0]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"dragonEyeRing": //TODO: implement
|
"dragonEyeRing": //TODO: implement
|
||||||
{
|
{
|
||||||
"id" : 153,
|
"id" : 153,
|
||||||
"type" : ["COMMANDER"]
|
"type" : ["COMMANDER"],
|
||||||
},
|
},
|
||||||
"hardenedShield":
|
"hardenedShield":
|
||||||
{
|
{
|
||||||
@ -2433,7 +2502,18 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"id" : 154,
|
"id" : 154,
|
||||||
"type" : ["COMMANDER"]
|
"type" : ["COMMANDER"],
|
||||||
|
"growing":
|
||||||
|
{
|
||||||
|
"id": 153, //hardened shield
|
||||||
|
"bonusesPerLevel":
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"level": 6,
|
||||||
|
"bonus": ["PRIMARY_SKILL", 1, "primSkill.defence", 0]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"slavasRingOfPower": //TODO: implement if possible
|
"slavasRingOfPower": //TODO: implement if possible
|
||||||
{
|
{
|
||||||
|
@ -37,86 +37,5 @@
|
|||||||
{"ability": ["JOUSTING", 0, 0, 0 ], "skills": [3, 4]},
|
{"ability": ["JOUSTING", 0, 0, 0 ], "skills": [3, 4]},
|
||||||
{"ability": ["DEATH_STARE", 1, 1, 0 ], "skills": [3,5]},
|
{"ability": ["DEATH_STARE", 1, 1, 0 ], "skills": [3,5]},
|
||||||
{"ability": ["FLYING", 0, 0, 0 ], "skills": [4,5]}
|
{"ability": ["FLYING", 0, 0, 0 ], "skills": [4,5]}
|
||||||
],
|
|
||||||
"artifacts":
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"id": 146, //axe of smashing
|
|
||||||
"bonusesPerLevel":
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"level": 6,
|
|
||||||
"bonus": ["PRIMARY_SKILL", 1, "primSkill.attack", 0]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": 147, //mithril mail
|
|
||||||
"bonusesPerLevel":
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"level": 1,
|
|
||||||
"bonus": ["STACK_HEALTH", 1, 0, 0]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": 148, //sword of sharpness
|
|
||||||
"bonusesPerLevel":
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"level": 1,
|
|
||||||
"bonus": ["CREATURE_DAMAGE", 1, 0, 0]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": 150, //pendant of sorcery
|
|
||||||
"bonusesPerLevel":
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"level": 10,
|
|
||||||
"bonus": ["CREATURE_ENCHANT_POWER", 1, 0, 0]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": 151, //boots of haste
|
|
||||||
"bonusesPerLevel":
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"level": 10,
|
|
||||||
"bonus": ["STACKS_SPEED", 1, 0, 0]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": 152, //bow of seeking
|
|
||||||
"thresholdBonuses":
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"level": 5,
|
|
||||||
"bonus": ["SHOOTER", 0, 0, 0]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"level": 25,
|
|
||||||
"bonus": ["NO_WALL_PENALTY", 0, 0, 0]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"level": 50,
|
|
||||||
"bonus": ["NO_DISTANCE_PENALTY", 0, 0, 0]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": 153, //hardened shield
|
|
||||||
"bonusesPerLevel":
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"level": 6,
|
|
||||||
"bonus": ["PRIMARY_SKILL", 1, "primSkill.defence", 0]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -168,12 +168,12 @@
|
|||||||
{ "id" : 15, "requires" : [ 14 ] },
|
{ "id" : 15, "requires" : [ 14 ] },
|
||||||
{ "id" : 16 },
|
{ "id" : 16 },
|
||||||
{ "id" : 18, "upgrades" : 30 },
|
{ "id" : 18, "upgrades" : 30 },
|
||||||
{ "id" : 19, "upgrades" : 37, "requires" : [ 18, 19 ], "mode" : "auto" },
|
{ "id" : 19, "upgrades" : 37, "requires" : [ 18 ], "mode" : "auto" },
|
||||||
{ "id" : 21, "requires" : [ 7 ] },
|
{ "id" : 21, "requires" : [ 7 ] },
|
||||||
{ "id" : 22, "requires" : [ 8 ] },
|
{ "id" : 22, "requires" : [ 8 ] },
|
||||||
{ "id" : 23, "requires" : [ 0 ] },
|
{ "id" : 23, "requires" : [ 0 ] },
|
||||||
{ "id" : 24, "upgrades" : 32 },
|
{ "id" : 24, "upgrades" : 32 },
|
||||||
{ "id" : 25, "upgrades" : 39, "requires" : [ 24, 25 ], "mode" : "auto" },
|
{ "id" : 25, "upgrades" : 39, "requires" : [ 24 ], "mode" : "auto" },
|
||||||
{ "id" : 26, "mode" : "grail"},
|
{ "id" : 26, "mode" : "grail"},
|
||||||
{ "id" : 27, "requires" : [ 11 ], "mode" : "auto" },
|
{ "id" : 27, "requires" : [ 11 ], "mode" : "auto" },
|
||||||
{ "id" : 28, "requires" : [ 12 ], "mode" : "auto" },
|
{ "id" : 28, "requires" : [ 12 ], "mode" : "auto" },
|
||||||
|
@ -1,38 +1,182 @@
|
|||||||
{
|
{
|
||||||
// battle animations for heroes, ordered by faction
|
"knight":
|
||||||
"heroBattleAnim" :
|
{
|
||||||
[
|
"id": 0,
|
||||||
{ "male" : "CH00.DEF", "female" : "CH01.DEF" },
|
"faction" : "castle",
|
||||||
{ "male" : "CH02.DEF", "female" : "CH03.DEF" },
|
"animation":
|
||||||
{ "male" : "CH05.DEF", "female" : "CH04.DEF" },
|
{
|
||||||
{ "male" : "CH06.DEF", "female" : "CH07.DEF" },
|
"battle" : { "male" : "CH00.DEF", "female" : "CH01.DEF" },
|
||||||
{ "male" : "CH08.DEF", "female" : "CH09.DEF" },
|
"map": { "male" : "AH00_.def", "female" : "AH00_.def" }
|
||||||
{ "male" : "CH010.DEF", "female" : "CH11.DEF" },
|
}
|
||||||
{ "male" : "CH013.DEF", "female" : "CH012.DEF" },
|
},
|
||||||
{ "male" : "CH014.DEF", "female" : "CH015.DEF" },
|
"cleric" :
|
||||||
{ "male" : "CH16.DEF", "female" : "CH17.DEF" }
|
{
|
||||||
],
|
"id": 1,
|
||||||
|
"faction" : "castle",
|
||||||
// map animations for heroes, ordered by hero class
|
"animation":
|
||||||
"heroMapAnim" :
|
{
|
||||||
[
|
"battle" : { "male" : "CH00.DEF", "female" : "CH01.DEF" },
|
||||||
"AH00_.def",
|
"map": { "male" : "AH01_.def", "female" : "AH01_.def" }
|
||||||
"AH01_.def",
|
}
|
||||||
"AH02_.def",
|
},
|
||||||
"AH03_.def",
|
"ranger" :
|
||||||
"AH04_.def",
|
{
|
||||||
"AH05_.def",
|
"id": 2,
|
||||||
"AH06_.def",
|
"faction" : "rampart",
|
||||||
"AH07_.def",
|
"animation":
|
||||||
"AH08_.def",
|
{
|
||||||
"AH09_.def",
|
"battle" : { "male" : "CH02.DEF", "female" : "CH03.DEF" },
|
||||||
"AH10_.def",
|
"map": { "male" : "AH02_.def", "female" : "AH02_.def" }
|
||||||
"AH11_.def",
|
}
|
||||||
"AH12_.def",
|
},
|
||||||
"AH13_.def",
|
"druid" :
|
||||||
"AH14_.def",
|
{
|
||||||
"AH15_.def",
|
"id": 3,
|
||||||
"AH16_.def",
|
"faction" : "rampart",
|
||||||
"AH17_.def"
|
"animation":
|
||||||
]
|
{
|
||||||
|
"battle" : { "male" : "CH02.DEF", "female" : "CH03.DEF" },
|
||||||
|
"map": { "male" : "AH03_.def", "female" : "AH03_.def" }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"alchemist" :
|
||||||
|
{
|
||||||
|
"id": 4,
|
||||||
|
"faction" : "tower",
|
||||||
|
"animation":
|
||||||
|
{
|
||||||
|
"battle" : { "male" : "CH05.DEF", "female" : "CH04.DEF" },
|
||||||
|
"map": { "male" : "AH04_.def", "female" : "AH04_.def" }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"wizard" :
|
||||||
|
{
|
||||||
|
"id": 5,
|
||||||
|
"faction" : "tower",
|
||||||
|
"animation":
|
||||||
|
{
|
||||||
|
"battle" : { "male" : "CH05.DEF", "female" : "CH04.DEF" },
|
||||||
|
"map": { "male" : "AH05_.def", "female" : "AH05_.def" }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"demoniac" :
|
||||||
|
{
|
||||||
|
"id": 6,
|
||||||
|
"faction" : "inferno",
|
||||||
|
"animation":
|
||||||
|
{
|
||||||
|
"battle" : { "male" : "CH06.DEF", "female" : "CH07.DEF" },
|
||||||
|
"map": { "male" : "AH06_.def", "female" : "AH06_.def" }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"heretic" :
|
||||||
|
{
|
||||||
|
"id": 7,
|
||||||
|
"faction" : "inferno",
|
||||||
|
"animation":
|
||||||
|
{
|
||||||
|
"battle" : { "male" : "CH06.DEF", "female" : "CH07.DEF" },
|
||||||
|
"map": { "male" : "AH07_.def", "female" : "AH07_.def" }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"deathknight" :
|
||||||
|
{
|
||||||
|
"id": 8,
|
||||||
|
"faction" : "necropolis",
|
||||||
|
"animation":
|
||||||
|
{
|
||||||
|
"battle" : { "male" : "CH08.DEF", "female" : "CH09.DEF" },
|
||||||
|
"map": { "male" : "AH08_.def", "female" : "AH08_.def" }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"necromancer" :
|
||||||
|
{
|
||||||
|
"id": 9,
|
||||||
|
"faction" : "necropolis",
|
||||||
|
"animation":
|
||||||
|
{
|
||||||
|
"battle" : { "male" : "CH08.DEF", "female" : "CH09.DEF" },
|
||||||
|
"map": { "male" : "AH09_.def", "female" : "AH09_.def" }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"warlock" :
|
||||||
|
{
|
||||||
|
"id": 10,
|
||||||
|
"faction" : "dungeon",
|
||||||
|
"animation":
|
||||||
|
{
|
||||||
|
"battle" : { "male" : "CH010.DEF", "female" : "CH11.DEF" },
|
||||||
|
"map": { "male" : "AH10_.def", "female" : "AH10_.def" }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"overlord" :
|
||||||
|
{
|
||||||
|
"id": 11,
|
||||||
|
"faction" : "dungeon",
|
||||||
|
"animation":
|
||||||
|
{
|
||||||
|
"battle" : { "male" : "CH010.DEF", "female" : "CH11.DEF" },
|
||||||
|
"map": { "male" : "AH11_.def", "female" : "AH11_.def" }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"barbarian" :
|
||||||
|
{
|
||||||
|
"id": 12,
|
||||||
|
"faction" : "stronghold",
|
||||||
|
"animation":
|
||||||
|
{
|
||||||
|
"battle" : { "male" : "CH013.DEF", "female" : "CH012.DEF" },
|
||||||
|
"map": { "male" : "AH12_.def", "female" : "AH12_.def" }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"battlemage" :
|
||||||
|
{
|
||||||
|
"id": 13,
|
||||||
|
"faction" : "stronghold",
|
||||||
|
"animation":
|
||||||
|
{
|
||||||
|
"battle" : { "male" : "CH013.DEF", "female" : "CH012.DEF" },
|
||||||
|
"map": { "male" : "AH13_.def", "female" : "AH13_.def" }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"beastmaster" :
|
||||||
|
{
|
||||||
|
"id": 14,
|
||||||
|
"faction" : "fortress",
|
||||||
|
"animation":
|
||||||
|
{
|
||||||
|
"battle" : { "male" : "CH014.DEF", "female" : "CH015.DEF" },
|
||||||
|
"map": { "male" : "AH14_.def", "female" : "AH14_.def" }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"witch" :
|
||||||
|
{
|
||||||
|
"id": 15,
|
||||||
|
"faction" : "fortress",
|
||||||
|
"animation":
|
||||||
|
{
|
||||||
|
"battle" : { "male" : "CH014.DEF", "female" : "CH015.DEF" },
|
||||||
|
"map": { "male" : "AH15_.def", "female" : "AH15_.def" }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"planeswalker" :
|
||||||
|
{
|
||||||
|
"id": 16,
|
||||||
|
"faction" : "conflux",
|
||||||
|
"animation":
|
||||||
|
{
|
||||||
|
"battle" : { "male" : "CH16.DEF", "female" : "CH17.DEF" },
|
||||||
|
"map": { "male" : "AH16_.def", "female" : "AH16_.def" }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"elementalist" :
|
||||||
|
{
|
||||||
|
"id": 17,
|
||||||
|
"faction" : "conflux",
|
||||||
|
"animation":
|
||||||
|
{
|
||||||
|
"battle" : { "male" : "CH16.DEF", "female" : "CH17.DEF" },
|
||||||
|
"map": { "male" : "AH17_.def", "female" : "AH17_.def" }
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,40 +24,27 @@ using namespace boost::assign;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
extern boost::rand48 ran;
|
extern boost::rand48 ran;
|
||||||
|
// Note: list must match entries in ArtTraits.txt
|
||||||
const std::map<std::string, CArtifact::EartClass> artifactClassMap = boost::assign::map_list_of
|
#define ART_POS_LIST \
|
||||||
("TREASURE", CArtifact::ART_TREASURE)
|
ART_POS(SPELLBOOK) \
|
||||||
("MINOR", CArtifact::ART_MINOR)
|
ART_POS(MACH4) \
|
||||||
("MAJOR", CArtifact::ART_MAJOR)
|
ART_POS(MACH3) \
|
||||||
("RELIC", CArtifact::ART_RELIC)
|
ART_POS(MACH2) \
|
||||||
("SPECIAL", CArtifact::ART_SPECIAL);
|
ART_POS(MACH1) \
|
||||||
|
ART_POS(MISC5) \
|
||||||
#define ART_BEARER(x) ( #x, ArtBearer::x )
|
ART_POS(MISC4) \
|
||||||
const std::map<std::string, int> artifactBearerMap = boost::assign::map_list_of ART_BEARER_LIST;
|
ART_POS(MISC3) \
|
||||||
#undef ART_BEARER
|
ART_POS(MISC2) \
|
||||||
|
ART_POS(MISC1) \
|
||||||
#define ART_POS(x) ( #x, ArtifactPosition::x )
|
ART_POS(FEET) \
|
||||||
|
ART_POS(LEFT_RING) \
|
||||||
const std::map<std::string, ArtifactPosition> artifactPositionMap = boost::assign::map_list_of
|
ART_POS(RIGHT_RING) \
|
||||||
ART_POS(HEAD)
|
ART_POS(TORSO) \
|
||||||
ART_POS(SHOULDERS)
|
ART_POS(LEFT_HAND) \
|
||||||
ART_POS(NECK)
|
ART_POS(RIGHT_HAND) \
|
||||||
ART_POS(RIGHT_HAND)
|
ART_POS(NECK) \
|
||||||
ART_POS(LEFT_HAND)
|
ART_POS(SHOULDERS) \
|
||||||
ART_POS(TORSO)
|
ART_POS(HEAD);
|
||||||
ART_POS(RIGHT_RING)
|
|
||||||
ART_POS(LEFT_RING)
|
|
||||||
ART_POS(FEET)
|
|
||||||
ART_POS(MISC1)
|
|
||||||
ART_POS(MISC2)
|
|
||||||
ART_POS(MISC3)
|
|
||||||
ART_POS(MISC4)
|
|
||||||
ART_POS(MISC5)
|
|
||||||
ART_POS(MACH1)
|
|
||||||
ART_POS(MACH2)
|
|
||||||
ART_POS(MACH3)
|
|
||||||
ART_POS(MACH4)
|
|
||||||
ART_POS(SPELLBOOK); //no need to specify commander / stack position?
|
|
||||||
|
|
||||||
const std::string & CArtifact::Name() const
|
const std::string & CArtifact::Name() const
|
||||||
{
|
{
|
||||||
@ -166,15 +153,12 @@ void CArtHandler::load(bool onlyTxt)
|
|||||||
if (onlyTxt)
|
if (onlyTxt)
|
||||||
return; // looks to be broken anyway...
|
return; // looks to be broken anyway...
|
||||||
|
|
||||||
std::vector<ui16> artSlots;
|
#define ART_POS(x) ( #x)
|
||||||
artSlots += 17, 16, 15, 14, 13, 18, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0;
|
const std::vector<std::string> artSlots = boost::assign::list_of ART_POS_LIST;
|
||||||
|
#undef ART_POS
|
||||||
|
|
||||||
growingArtifacts += ArtifactID::AXE_OF_SMASHING, ArtifactID::MITHRIL_MAIL,
|
static std::map<char, std::string> classes =
|
||||||
ArtifactID::SWORD_OF_SHARPNESS, ArtifactID::PENDANT_OF_SORCERY, ArtifactID::BOOTS_OF_HASTE,
|
map_list_of('S',"SPECIAL")('T',"TREASURE")('N',"MINOR")('J',"MAJOR")('R',"RELIC");
|
||||||
ArtifactID::BOW_OF_SEEKING, ArtifactID::DRAGON_EYE_RING;
|
|
||||||
|
|
||||||
static std::map<char, CArtifact::EartClass> classes =
|
|
||||||
map_list_of('S',CArtifact::ART_SPECIAL)('T',CArtifact::ART_TREASURE)('N',CArtifact::ART_MINOR)('J',CArtifact::ART_MAJOR)('R',CArtifact::ART_RELIC);
|
|
||||||
|
|
||||||
CLegacyConfigParser parser("DATA/ARTRAITS.TXT");
|
CLegacyConfigParser parser("DATA/ARTRAITS.TXT");
|
||||||
CLegacyConfigParser events("DATA/ARTEVENT.TXT");
|
CLegacyConfigParser events("DATA/ARTEVENT.TXT");
|
||||||
@ -184,74 +168,54 @@ void CArtHandler::load(bool onlyTxt)
|
|||||||
|
|
||||||
std::map<ui32,ui8>::iterator itr;
|
std::map<ui32,ui8>::iterator itr;
|
||||||
|
|
||||||
for (ArtifactID i=ArtifactID(0); i<GameConstants::ARTIFACTS_QUANTITY; i.advance(1))
|
std::vector<JsonNode> h3Data;
|
||||||
{
|
|
||||||
CArtifact *art;
|
|
||||||
if (vstd::contains (growingArtifacts, i))
|
|
||||||
{
|
|
||||||
art = new CGrowingArtifact();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
art = new CArtifact();
|
|
||||||
}
|
|
||||||
art->id=i;
|
|
||||||
art->iconIndex=i;
|
|
||||||
art->name = parser.readString();
|
|
||||||
art->eventText = events.readString();
|
|
||||||
events.endLine();
|
|
||||||
|
|
||||||
art->price= parser.readNumber();
|
for (size_t i = 0; i < GameConstants::ARTIFACTS_QUANTITY; i++)
|
||||||
|
{
|
||||||
|
JsonNode artData;
|
||||||
|
|
||||||
|
artData["graphics"]["iconIndex"].Float() = i;
|
||||||
|
artData["text"]["name"].String() = parser.readString();
|
||||||
|
artData["text"]["event"].String() = events.readString();
|
||||||
|
artData["value"].Float() = parser.readNumber();
|
||||||
|
|
||||||
for(int j=0; j<artSlots.size(); j++)
|
for(int j=0; j<artSlots.size(); j++)
|
||||||
{
|
{
|
||||||
if(parser.readString() == "x")
|
if(parser.readString() == "x")
|
||||||
art->possibleSlots[ArtBearer::HERO].push_back(ArtifactPosition(artSlots[j]));
|
{
|
||||||
|
artData["slot"].Vector().push_back(JsonNode());
|
||||||
|
artData["slot"].Vector().back().String() = artSlots.at(j);
|
||||||
}
|
}
|
||||||
art->aClass = classes[parser.readString()[0]];
|
}
|
||||||
|
artData["class"].String() = classes[parser.readString()[0]];
|
||||||
//load description and remove quotation marks
|
artData["text"]["description"].String() = parser.readString();
|
||||||
art->description = parser.readString();
|
|
||||||
|
|
||||||
parser.endLine();
|
parser.endLine();
|
||||||
|
events.endLine();
|
||||||
if(onlyTxt) // FIXME: pointer to art will be lost. Bug?
|
h3Data.push_back(artData);
|
||||||
continue;
|
|
||||||
|
|
||||||
artifacts.push_back(art);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (VLC->modh->modules.COMMANDERS)
|
artifacts.resize(GameConstants::ARTIFACTS_QUANTITY);
|
||||||
{ //TODO: move all artifacts config to separate json file
|
|
||||||
const JsonNode config(ResourceID("config/commanders.json"));
|
|
||||||
BOOST_FOREACH(const JsonNode &artifact, config["artifacts"].Vector())
|
|
||||||
{
|
|
||||||
auto ga = dynamic_cast <CGrowingArtifact *>(artifacts[artifact["id"].Float()].get());
|
|
||||||
BOOST_FOREACH (auto b, artifact["bonusesPerLevel"].Vector())
|
|
||||||
{
|
|
||||||
ga->bonusesPerLevel.push_back (std::pair <ui16, Bonus> (b["level"].Float(), *JsonUtils::parseBonus (b["bonus"].Vector())));
|
|
||||||
}
|
|
||||||
BOOST_FOREACH (auto b, artifact["thresholdBonuses"].Vector())
|
|
||||||
{
|
|
||||||
ga->thresholdBonuses.push_back (std::pair <ui16, Bonus> (b["level"].Float(), *JsonUtils::parseBonus (b["bonus"].Vector())));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(onlyTxt)
|
|
||||||
return;
|
|
||||||
|
|
||||||
JsonNode config(ResourceID("config/artifacts.json"));
|
JsonNode config(ResourceID("config/artifacts.json"));
|
||||||
|
|
||||||
BOOST_FOREACH(auto & node, config["artifacts"].Struct())
|
BOOST_FOREACH(auto & node, config["artifacts"].Struct())
|
||||||
{
|
{
|
||||||
int numeric = node.second["id"].Float();
|
int numeric = node.second["id"].Float();
|
||||||
CArtifact * art = artifacts[numeric];
|
JsonNode & artData = h3Data[numeric];
|
||||||
|
JsonUtils::merge(artData, node.second);
|
||||||
|
|
||||||
loadArtifactJson(art, node.second);
|
artifacts[numeric] = loadArtifact(artData);
|
||||||
|
artifacts[numeric]->id = ArtifactID(numeric);
|
||||||
|
|
||||||
VLC->modh->identifiers.registerObject ("artifact." + node.first, numeric);
|
VLC->modh->identifiers.registerObject ("artifact." + node.first, numeric);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (size_t i=0; i < artifacts.size(); i++)
|
||||||
|
{
|
||||||
|
if (artifacts[i] == nullptr)
|
||||||
|
tlog0 << "Warning: artifact with id " << i << " is missing!\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CArtHandler::load(std::string objectID, const JsonNode & node)
|
void CArtHandler::load(std::string objectID, const JsonNode & node)
|
||||||
@ -266,7 +230,16 @@ void CArtHandler::load(std::string objectID, const JsonNode & node)
|
|||||||
|
|
||||||
CArtifact * CArtHandler::loadArtifact(const JsonNode & node)
|
CArtifact * CArtHandler::loadArtifact(const JsonNode & node)
|
||||||
{
|
{
|
||||||
CArtifact * art = new CArtifact;
|
CArtifact * art;
|
||||||
|
|
||||||
|
if (!VLC->modh->modules.COMMANDERS || node["growing"].isNull())
|
||||||
|
art = new CArtifact();
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CGrowingArtifact * growing = new CGrowingArtifact();
|
||||||
|
loadGrowingArt(growing, node);
|
||||||
|
art = growing;
|
||||||
|
}
|
||||||
|
|
||||||
const JsonNode & text = node["text"];
|
const JsonNode & text = node["text"];
|
||||||
art->name = text["name"].String();
|
art->name = text["name"].String();
|
||||||
@ -283,7 +256,71 @@ CArtifact * CArtHandler::loadArtifact(const JsonNode & node)
|
|||||||
art->advMapDef = graphics["map"].String();
|
art->advMapDef = graphics["map"].String();
|
||||||
|
|
||||||
art->price = node["value"].Float();
|
art->price = node["value"].Float();
|
||||||
|
|
||||||
|
loadSlots(art, node);
|
||||||
|
loadClass(art, node);
|
||||||
|
loadType(art, node);
|
||||||
|
loadComponents(art, node);
|
||||||
|
|
||||||
|
BOOST_FOREACH (auto b, node["bonuses"].Vector())
|
||||||
{
|
{
|
||||||
|
auto bonus = JsonUtils::parseBonus (b);
|
||||||
|
bonus->sid = art->id;
|
||||||
|
art->addNewBonus (bonus);
|
||||||
|
}
|
||||||
|
return art;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CArtHandler::addSlot(CArtifact * art, const std::string & slotID)
|
||||||
|
{
|
||||||
|
#define ART_POS(x) ( #x, ArtifactPosition::x )
|
||||||
|
static const std::map<std::string, ArtifactPosition> artifactPositionMap = boost::assign::map_list_of ART_POS_LIST;
|
||||||
|
#undef ART_POS
|
||||||
|
|
||||||
|
if (slotID == "MISC")
|
||||||
|
{
|
||||||
|
art->possibleSlots[ArtBearer::HERO] += ArtifactPosition::MISC1, ArtifactPosition::MISC2, ArtifactPosition::MISC3, ArtifactPosition::MISC4, ArtifactPosition::MISC5;
|
||||||
|
}
|
||||||
|
else if (slotID == "RING")
|
||||||
|
{
|
||||||
|
art->possibleSlots[ArtBearer::HERO] += ArtifactPosition::LEFT_RING, ArtifactPosition::RIGHT_RING;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
auto it = artifactPositionMap.find (slotID);
|
||||||
|
if (it != artifactPositionMap.end())
|
||||||
|
{
|
||||||
|
auto slot = it->second;
|
||||||
|
art->possibleSlots[ArtBearer::HERO].push_back (slot);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
tlog2 << "Warning! Artifact slot " << slotID << " not recognized!";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CArtHandler::loadSlots(CArtifact * art, const JsonNode & node)
|
||||||
|
{
|
||||||
|
if (!node["slot"].isNull()) //we assume non-hero slots are irrelevant?
|
||||||
|
{
|
||||||
|
if (node["slot"].getType() == JsonNode::DATA_STRING)
|
||||||
|
addSlot(art, node["slot"].String());
|
||||||
|
else
|
||||||
|
{
|
||||||
|
BOOST_FOREACH (const JsonNode & slot, node["slot"].Vector())
|
||||||
|
addSlot(art, slot.String());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CArtHandler::loadClass(CArtifact * art, const JsonNode & node)
|
||||||
|
{
|
||||||
|
static const std::map<std::string, CArtifact::EartClass> artifactClassMap = boost::assign::map_list_of
|
||||||
|
("TREASURE", CArtifact::ART_TREASURE)
|
||||||
|
("MINOR", CArtifact::ART_MINOR)
|
||||||
|
("MAJOR", CArtifact::ART_MAJOR)
|
||||||
|
("RELIC", CArtifact::ART_RELIC)
|
||||||
|
("SPECIAL", CArtifact::ART_SPECIAL);
|
||||||
|
|
||||||
auto it = artifactClassMap.find (node["class"].String());
|
auto it = artifactClassMap.find (node["class"].String());
|
||||||
if (it != artifactClassMap.end())
|
if (it != artifactClassMap.end())
|
||||||
{
|
{
|
||||||
@ -296,46 +333,13 @@ CArtifact * CArtHandler::loadArtifact(const JsonNode & node)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!node["slot"].isNull()) //we assume non-hero slots are irrelevant?
|
void CArtHandler::loadType(CArtifact * art, const JsonNode & node)
|
||||||
{
|
|
||||||
std::string slotName = node["slot"].String();
|
|
||||||
if (slotName == "MISC")
|
|
||||||
{
|
|
||||||
//unfortunatelly slot ids aare not continuous
|
|
||||||
art->possibleSlots[ArtBearer::HERO] += ArtifactPosition::MISC1, ArtifactPosition::MISC2, ArtifactPosition::MISC3, ArtifactPosition::MISC4, ArtifactPosition::MISC5;
|
|
||||||
}
|
|
||||||
else if (slotName == "RING")
|
|
||||||
{
|
|
||||||
art->possibleSlots[ArtBearer::HERO] += ArtifactPosition::LEFT_RING, ArtifactPosition::RIGHT_RING;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
|
#define ART_BEARER(x) ( #x, ArtBearer::x )
|
||||||
|
static const std::map<std::string, int> artifactBearerMap = boost::assign::map_list_of ART_BEARER_LIST;
|
||||||
|
#undef ART_BEARER
|
||||||
|
|
||||||
auto it = artifactPositionMap.find (slotName);
|
BOOST_FOREACH (const JsonNode & b, node["type"].Vector())
|
||||||
if (it != artifactPositionMap.end())
|
|
||||||
{
|
|
||||||
auto slot = it->second;
|
|
||||||
art->possibleSlots[ArtBearer::HERO].push_back (slot);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
tlog2 << "Warning! Artifact slot " << node["slot"].String() << " not recognized!";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
loadArtifactJson(art, node);
|
|
||||||
|
|
||||||
return art;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CArtHandler::loadArtifactJson(CArtifact * art, const JsonNode & artifact)
|
|
||||||
{
|
|
||||||
BOOST_FOREACH (auto b, artifact["bonuses"].Vector())
|
|
||||||
{
|
|
||||||
auto bonus = JsonUtils::parseBonus (b);
|
|
||||||
bonus->sid = art->id;
|
|
||||||
art->addNewBonus (bonus);
|
|
||||||
}
|
|
||||||
BOOST_FOREACH (const JsonNode & b, artifact["type"].Vector())
|
|
||||||
{
|
{
|
||||||
auto it = artifactBearerMap.find (b.String());
|
auto it = artifactBearerMap.find (b.String());
|
||||||
if (it != artifactBearerMap.end())
|
if (it != artifactBearerMap.end())
|
||||||
@ -356,11 +360,14 @@ void CArtHandler::loadArtifactJson(CArtifact * art, const JsonNode & artifact)
|
|||||||
else
|
else
|
||||||
tlog2 << "Warning! Artifact type " << b.String() << " not recognized!";
|
tlog2 << "Warning! Artifact type " << b.String() << " not recognized!";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!artifact["components"].isNull())
|
void CArtHandler::loadComponents(CArtifact * art, const JsonNode & node)
|
||||||
|
{
|
||||||
|
if (!node["components"].isNull())
|
||||||
{
|
{
|
||||||
art->constituents.reset(new std::vector<CArtifact *>());
|
art->constituents.reset(new std::vector<CArtifact *>());
|
||||||
BOOST_FOREACH (auto component, artifact["components"].Vector())
|
BOOST_FOREACH (auto component, node["components"].Vector())
|
||||||
{
|
{
|
||||||
VLC->modh->identifiers.requestIdentifier("artifact." + component.String(), [=](si32 id)
|
VLC->modh->identifiers.requestIdentifier("artifact." + component.String(), [=](si32 id)
|
||||||
{
|
{
|
||||||
@ -373,6 +380,18 @@ void CArtHandler::loadArtifactJson(CArtifact * art, const JsonNode & artifact)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CArtHandler::loadGrowingArt(CGrowingArtifact * art, const JsonNode & node)
|
||||||
|
{
|
||||||
|
BOOST_FOREACH (auto b, node["growing"]["bonusesPerLevel"].Vector())
|
||||||
|
{
|
||||||
|
art->bonusesPerLevel.push_back (std::pair <ui16, Bonus> (b["level"].Float(), *JsonUtils::parseBonus (b["bonus"].Vector())));
|
||||||
|
}
|
||||||
|
BOOST_FOREACH (auto b, node["growing"]["thresholdBonuses"].Vector())
|
||||||
|
{
|
||||||
|
art->thresholdBonuses.push_back (std::pair <ui16, Bonus> (b["level"].Float(), *JsonUtils::parseBonus (b["bonus"].Vector())));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ArtifactID CArtHandler::creatureToMachineID(CreatureID id)
|
ArtifactID CArtHandler::creatureToMachineID(CreatureID id)
|
||||||
{
|
{
|
||||||
int dif = 142;
|
int dif = 142;
|
||||||
|
@ -59,8 +59,8 @@ public:
|
|||||||
bool isBig () const;
|
bool isBig () const;
|
||||||
|
|
||||||
int getArtClassSerial() const; //0 - treasure, 1 - minor, 2 - major, 3 - relic, 4 - spell scroll, 5 - other
|
int getArtClassSerial() const; //0 - treasure, 1 - minor, 2 - major, 3 - relic, 4 - spell scroll, 5 - other
|
||||||
std::string nodeName() const OVERRIDE;
|
std::string nodeName() const override;
|
||||||
void addNewBonus(Bonus *b) OVERRIDE;
|
void addNewBonus(Bonus *b) override;
|
||||||
|
|
||||||
virtual void levelUpArtifact (CArtifactInstance * art){};
|
virtual void levelUpArtifact (CArtifactInstance * art){};
|
||||||
|
|
||||||
@ -112,7 +112,7 @@ public:
|
|||||||
|
|
||||||
//CArtifactInstance(int aid);
|
//CArtifactInstance(int aid);
|
||||||
|
|
||||||
std::string nodeName() const OVERRIDE;
|
std::string nodeName() const override;
|
||||||
void deserializationFix();
|
void deserializationFix();
|
||||||
void setType(CArtifact *Art);
|
void setType(CArtifact *Art);
|
||||||
|
|
||||||
@ -161,11 +161,11 @@ public:
|
|||||||
|
|
||||||
std::vector<ConstituentInfo> constituentsInfo;
|
std::vector<ConstituentInfo> constituentsInfo;
|
||||||
|
|
||||||
bool canBePutAt(const CArtifactSet *artSet, ArtifactPosition slot, bool assumeDestRemoved = false) const OVERRIDE;
|
bool canBePutAt(const CArtifactSet *artSet, ArtifactPosition slot, bool assumeDestRemoved = false) const override;
|
||||||
bool canBeDisassembled() const OVERRIDE;
|
bool canBeDisassembled() const override;
|
||||||
void putAt(ArtifactLocation al) OVERRIDE;
|
void putAt(ArtifactLocation al) override;
|
||||||
void removeFrom(ArtifactLocation al) OVERRIDE;
|
void removeFrom(ArtifactLocation al) override;
|
||||||
bool isPart(const CArtifactInstance *supposedPart) const OVERRIDE;
|
bool isPart(const CArtifactInstance *supposedPart) const override;
|
||||||
|
|
||||||
void createConstituents();
|
void createConstituents();
|
||||||
void addAsConstituent(CArtifactInstance *art, ArtifactPosition slot);
|
void addAsConstituent(CArtifactInstance *art, ArtifactPosition slot);
|
||||||
@ -187,6 +187,13 @@ public:
|
|||||||
|
|
||||||
class DLL_LINKAGE CArtHandler //handles artifacts
|
class DLL_LINKAGE CArtHandler //handles artifacts
|
||||||
{
|
{
|
||||||
|
void addSlot(CArtifact * art, const std::string & slotID);
|
||||||
|
void loadSlots(CArtifact * art, const JsonNode & node);
|
||||||
|
void loadClass(CArtifact * art, const JsonNode & node);
|
||||||
|
void loadType(CArtifact * art, const JsonNode & node);
|
||||||
|
void loadComponents(CArtifact * art, const JsonNode & node);
|
||||||
|
void loadGrowingArt(CGrowingArtifact * art, const JsonNode & node);
|
||||||
|
|
||||||
void giveArtBonus(ArtifactID aid, Bonus::BonusType type, int val, int subtype = -1, Bonus::ValueType valType = Bonus::BASE_NUMBER, shared_ptr<ILimiter> limiter = shared_ptr<ILimiter>(), int additionalinfo = 0);
|
void giveArtBonus(ArtifactID aid, Bonus::BonusType type, int val, int subtype = -1, Bonus::ValueType valType = Bonus::BASE_NUMBER, shared_ptr<ILimiter> limiter = shared_ptr<ILimiter>(), int additionalinfo = 0);
|
||||||
void giveArtBonus(ArtifactID aid, Bonus::BonusType type, int val, int subtype, shared_ptr<IPropagator> propagator, int additionalinfo = 0);
|
void giveArtBonus(ArtifactID aid, Bonus::BonusType type, int val, int subtype, shared_ptr<IPropagator> propagator, int additionalinfo = 0);
|
||||||
void giveArtBonus(ArtifactID aid, Bonus *bonus);
|
void giveArtBonus(ArtifactID aid, Bonus *bonus);
|
||||||
@ -204,8 +211,6 @@ public:
|
|||||||
/// load one artifact from json config
|
/// load one artifact from json config
|
||||||
CArtifact * loadArtifact(const JsonNode & node);
|
CArtifact * loadArtifact(const JsonNode & node);
|
||||||
|
|
||||||
void loadArtifactJson(CArtifact * art, const JsonNode & node);
|
|
||||||
|
|
||||||
void addBonuses(CArtifact *art, const JsonNode &bonusList);
|
void addBonuses(CArtifact *art, const JsonNode &bonusList);
|
||||||
|
|
||||||
void fillList(std::vector<CArtifact*> &listToBeFilled, CArtifact::EartClass artifactClass); //fills given empty list with allowed artifacts of gibven class. No side effects
|
void fillList(std::vector<CArtifact*> &listToBeFilled, CArtifact::EartClass artifactClass); //fills given empty list with allowed artifacts of gibven class. No side effects
|
||||||
|
@ -85,49 +85,54 @@ void CHeroClassHandler::load()
|
|||||||
parser.endLine(); // header
|
parser.endLine(); // header
|
||||||
parser.endLine();
|
parser.endLine();
|
||||||
|
|
||||||
|
std::vector<JsonNode> h3Data;
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
CHeroClass * hc = new CHeroClass;
|
JsonNode entry;
|
||||||
|
|
||||||
hc->name = parser.readString();
|
entry["name"].String() = parser.readString();
|
||||||
hc->aggression = parser.readNumber();
|
|
||||||
hc->id = heroClasses.size();
|
|
||||||
|
|
||||||
hc->primarySkillInitial = parser.readNumArray<int>(GameConstants::PRIMARY_SKILLS);
|
parser.readNumber(); // unused aggression
|
||||||
hc->primarySkillLowLevel = parser.readNumArray<int>(GameConstants::PRIMARY_SKILLS);
|
|
||||||
hc->primarySkillHighLevel = parser.readNumArray<int>(GameConstants::PRIMARY_SKILLS);
|
|
||||||
|
|
||||||
hc->secSkillProbability = parser.readNumArray<int>(GameConstants::SKILL_QUANTITY);
|
for (size_t i=0; i < GameConstants::PRIMARY_SKILLS; i++)
|
||||||
|
entry["primarySkills"][PrimarySkill::names[i]].Float() = parser.readNumber();
|
||||||
|
|
||||||
for(int dd=0; dd<GameConstants::F_NUMBER; ++dd)
|
for (size_t i=0; i < GameConstants::PRIMARY_SKILLS; i++)
|
||||||
{
|
entry["lowLevelChance"][PrimarySkill::names[i]].Float() = parser.readNumber();
|
||||||
hc->selectionProbability[dd] = parser.readNumber();
|
|
||||||
}
|
|
||||||
|
|
||||||
VLC->modh->identifiers.requestIdentifier("faction." + ETownType::names[heroClasses.size()/2],
|
for (size_t i=0; i < GameConstants::PRIMARY_SKILLS; i++)
|
||||||
[=](si32 faction)
|
entry["highLevelChance"][PrimarySkill::names[i]].Float() = parser.readNumber();
|
||||||
{
|
|
||||||
hc->faction = faction;
|
|
||||||
});
|
|
||||||
|
|
||||||
heroClasses.push_back(hc);
|
for (size_t i=0; i < GameConstants::SKILL_QUANTITY; i++)
|
||||||
VLC->modh->identifiers.registerObject("heroClass." + GameConstants::HERO_CLASSES_NAMES[hc->id], hc->id);
|
entry["secondarySkills"][NSecondarySkill::names[i]].Float() = parser.readNumber();
|
||||||
|
|
||||||
|
for(size_t i = 0; i < GameConstants::F_NUMBER; i++)
|
||||||
|
entry["tavern"][ETownType::names[i]].Float() = parser.readNumber();
|
||||||
|
|
||||||
|
h3Data.push_back(entry);
|
||||||
}
|
}
|
||||||
while (parser.endLine() && !parser.isNextEntryEmpty());
|
while (parser.endLine() && !parser.isNextEntryEmpty());
|
||||||
|
|
||||||
const JsonNode & heroGraphics = JsonNode(ResourceID("config/heroClasses.json"));
|
JsonNode classConf = JsonNode(ResourceID("config/heroClasses.json"));
|
||||||
|
heroClasses.resize(GameConstants::F_NUMBER * 2);
|
||||||
|
|
||||||
|
BOOST_FOREACH(auto & node, classConf.Struct())
|
||||||
|
{
|
||||||
|
int numeric = node.second["id"].Float();
|
||||||
|
JsonNode & classData = h3Data[numeric];
|
||||||
|
JsonUtils::merge(classData, node.second);
|
||||||
|
|
||||||
|
heroClasses[numeric] = loadClass(classData);
|
||||||
|
heroClasses[numeric]->id = numeric;
|
||||||
|
|
||||||
|
VLC->modh->identifiers.registerObject ("heroClass." + node.first, numeric);
|
||||||
|
}
|
||||||
|
|
||||||
for (size_t i=0; i < heroClasses.size(); i++)
|
for (size_t i=0; i < heroClasses.size(); i++)
|
||||||
{
|
{
|
||||||
const JsonNode & battle = heroGraphics["heroBattleAnim"].Vector()[i/2];
|
if (heroClasses[i] == nullptr)
|
||||||
|
tlog0 << "Warning: class with id " << i << " is missing!\n";
|
||||||
heroClasses[i]->imageBattleFemale = battle["female"].String();
|
|
||||||
heroClasses[i]->imageBattleMale = battle["male"].String();
|
|
||||||
|
|
||||||
const JsonNode & map = heroGraphics["heroMapAnim"].Vector()[i];
|
|
||||||
|
|
||||||
heroClasses[i]->imageMapMale = map.String();
|
|
||||||
heroClasses[i]->imageMapFemale = map.String();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@ class DLL_LINKAGE CHeroClass
|
|||||||
public:
|
public:
|
||||||
std::string identifier;
|
std::string identifier;
|
||||||
std::string name; // translatable
|
std::string name; // translatable
|
||||||
double aggression;
|
//double aggression; // not used in vcmi.
|
||||||
TFaction faction;
|
TFaction faction;
|
||||||
ui8 id;
|
ui8 id;
|
||||||
|
|
||||||
@ -119,7 +119,7 @@ public:
|
|||||||
|
|
||||||
template <typename Handler> void serialize(Handler &h, const int version)
|
template <typename Handler> void serialize(Handler &h, const int version)
|
||||||
{
|
{
|
||||||
h & identifier & name & faction & aggression;
|
h & identifier & name & faction;// & aggression;
|
||||||
h & primarySkillInitial & primarySkillLowLevel;
|
h & primarySkillInitial & primarySkillLowLevel;
|
||||||
h & primarySkillHighLevel & secSkillProbability;
|
h & primarySkillHighLevel & secSkillProbability;
|
||||||
h & selectionProbability;
|
h & selectionProbability;
|
||||||
|
@ -26,11 +26,6 @@ namespace GameConstants
|
|||||||
"wood", "mercury", "ore", "sulfur", "crystal", "gems", "gold", "mithril"
|
"wood", "mercury", "ore", "sulfur", "crystal", "gems", "gold", "mithril"
|
||||||
};
|
};
|
||||||
|
|
||||||
const std::string HERO_CLASSES_NAMES [F_NUMBER * 2] = {
|
|
||||||
"knight", "cleric", "ranger", "druid", "alchemist", "wizard",
|
|
||||||
"demoniac", "heretic", "deathknight", "necromancer", "warlock", "overlord",
|
|
||||||
"barbarian", "battlemage", "beastmaster", "witch", "planeswalker", "elementalist"
|
|
||||||
};
|
|
||||||
const std::string PLAYER_COLOR_NAMES [PlayerColor::PLAYER_LIMIT_I] = {
|
const std::string PLAYER_COLOR_NAMES [PlayerColor::PLAYER_LIMIT_I] = {
|
||||||
"red", "blue", "tan", "green", "orange", "purple", "teal", "pink"
|
"red", "blue", "tan", "green", "orange", "purple", "teal", "pink"
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user