1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

Created bankconfig.json from bankconfig.txt.

This commit is contained in:
Frank Zago 2011-09-03 18:32:37 +00:00
parent 1568e58029
commit c03a5eb4d2
4 changed files with 1224 additions and 183 deletions

1159
config/bankconfig.json Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,88 +0,0 @@
Fight Reward Creatures Artifacts Analysis
Adventure Object Level Chance Upgrade Combat Value (imp = 1) Wood Mercury Ore Sulfur Crystal Gems Gold Treasure Minor Major Relic Overall Value Reward / Difficulty Difficult / Easiest
Cyclops Stockpile
1 30% 20 Cyclopes 50% 0 None 0 None 0 None 506 4 4 4 4 4 4 0 0 None 0 0 0 0 10000 20 100%
2 30% 30 Cyclopes 50% 0 None 0 None 0 None 760 6 6 6 6 6 6 0 0 None 0 0 0 0 15000 20 150%
3 30% 40 Cyclopes 50% 0 None 0 None 0 None 1013 8 8 8 8 8 8 0 0 None 0 0 0 0 20000 20 200%
4 10% 50 Cyclopes 50% 0 None 0 None 0 None 1266 10 10 10 10 10 10 0 0 None 0 0 0 0 25000 20 250%
Dwarven Treasury 1 30% 50 Dwarves 50% 0 None 0 None 0 None 194 0 0 0 0 2 0 2500 0 None 0 0 0 0 3500 18 100%
2 30% 75 Dwarves 50% 0 None 0 None 0 None 291 0 0 0 0 3 0 4000 0 None 0 0 0 0 5500 19 150%
3 30% 100 Dwarves 50% 0 None 0 None 0 None 388 0 0 0 0 5 0 5000 0 None 0 0 0 0 7500 19 200%
4 10% 150 Dwarves 50% 0 None 0 None 0 None 582 0 0 0 0 10 0 7500 0 None 0 0 0 0 12500 21 300%
Griffin Conservatory 1 30% 50 Griffins 50% 0 None 0 None 0 None 351 0 0 0 0 0 0 0 1 Angels 0 0 0 0 3000 9 100%
2 30% 100 Griffins 50% 0 None 0 None 0 None 702 0 0 0 0 0 0 0 2 Angels 0 0 0 0 6000 9 200%
3 30% 150 Griffins 50% 0 None 0 None 0 None 1053 0 0 0 0 0 0 0 3 Angels 0 0 0 0 9000 9 300%
4 10% 200 Griffins 50% 0 None 0 None 0 None 1404 0 0 0 0 0 0 0 4 Angels 0 0 0 0 12000 9 400%
Imp Cache 1 30% 100 Imps 50% 0 None 0 None 0 None 100 0 2 0 0 0 0 1000 0 None 0 0 0 0 2000 20 100%
2 30% 150 Imps 50% 0 None 0 None 0 None 150 0 3 0 0 0 0 1500 0 None 0 0 0 0 3000 20 150%
3 30% 200 Imps 50% 0 None 0 None 0 None 200 0 4 0 0 0 0 2000 0 None 0 0 0 0 4000 20 200%
4 10% 300 Imps 50% 0 None 0 None 0 None 300 0 6 0 0 0 0 3000 0 None 0 0 0 0 6000 20 300%
Medusa Stores 1 30% 20 Medusae 50% 0 None 0 None 0 None 207 0 0 0 5 0 0 2000 0 None 0 0 0 0 4500 22 100%
2 30% 30 Medusae 50% 0 None 0 None 0 None 310 0 0 0 6 0 0 3000 0 None 0 0 0 0 6000 19 150%
3 30% 40 Medusae 50% 0 None 0 None 0 None 414 0 0 0 8 0 0 4000 0 None 0 0 0 0 8000 19 200%
4 10% 50 Medusae 50% 0 None 0 None 0 None 517 0 0 0 10 0 0 5000 0 None 0 0 0 0 10000 19 250%
Naga Bank 1 30% 10 Nagas 50% 0 None 0 None 0 None 403 0 0 0 0 0 8 4000 0 None 0 0 0 0 8000 20 100%
2 30% 15 Nagas 50% 0 None 0 None 0 None 605 0 0 0 0 0 12 6000 0 None 0 0 0 0 12000 20 150%
3 30% 20 Nagas 50% 0 None 0 None 0 None 806 0 0 0 0 0 16 8000 0 None 0 0 0 0 16000 20 200%
4 10% 30 Nagas 50% 0 None 0 None 0 None 1210 0 0 0 0 0 24 12000 0 None 0 0 0 0 24000 20 300%
Dragon Fly Hive 1 30% 30 Dragon Flies 0% 0 None 0 None 0 None 154 0 0 0 0 0 0 0 4 Wyverns 0 0 0 0 3200 21 100%
2 30% 45 Dragon Flies 0% 0 None 0 None 0 None 230 0 0 0 0 0 0 0 6 Wyverns 0 0 0 0 4800 21 150%
3 30% 60 Dragon Flies 0% 0 None 0 None 0 None 307 0 0 0 0 0 0 0 8 Wyverns 0 0 0 0 6400 21 200%
4 10% 90 Dragon Flies 0% 0 None 0 None 0 None 461 0 0 0 0 0 0 0 12 Wyverns 0 0 0 0 9600 21 300%
Shipwreck 1 30% 10 Wights 0% 0 None 0 None 0 None 31 0 0 0 0 0 0 2000 0 None 0 0 0 0 2000 65 100%
2 30% 15 Wights 0% 0 None 0 None 0 None 46 0 0 0 0 0 0 3000 0 None 0 0 0 0 3000 65 150%
3 30% 25 Wights 0% 0 None 0 None 0 None 77 0 0 0 0 0 0 4000 0 None 1 0 0 0 5000 65 250%
4 10% 50 Wights 0% 0 None 0 None 0 None 154 0 0 0 0 0 0 5000 0 None 0 1 0 0 7000 45 500%
Derelict Ship 1 30% 20 Water Elementals 0% 0 None 0 None 0 None 138 0 0 0 0 0 0 3000 0 None 0 0 0 0 3000 22 100%
2 30% 30 Water Elementals 0% 0 None 0 None 0 None 207 0 0 0 0 0 0 3000 0 None 1 0 0 0 4000 19 150%
3 30% 40 Water Elementals 0% 0 None 0 None 0 None 276 0 0 0 0 0 0 4000 0 None 1 0 0 0 5000 18 200%
4 10% 60 Water Elementals 0% 0 None 0 None 0 None 414 0 0 0 0 0 0 6000 0 None 0 1 0 0 8000 19 300%
Crypt 1 30% 30 Skeletons 0% 20 Zombies 0 Wights 0 Vampires 75 0 0 0 0 0 0 1500 0 None 0 0 0 0 1500 20 100%
2 30% 25 Skeletons 0% 20 Zombies 5 Wights 0 Vampires 94 0 0 0 0 0 0 2000 0 None 0 0 0 0 2000 21 126%
3 30% 20 Skeletons 0% 20 Zombies 10 Wights 5 Vampires 169 0 0 0 0 0 0 2500 0 None 1 0 0 0 3500 21 225%
4 10% 20 Skeletons 0% 20 Zombies 10 Wights 10 Vampires 225 0 0 0 0 0 0 5000 0 None 1 0 0 0 6000 27 299%
Dragon Utopia 1 30% 8 Green Dragons 0% 5 Red Dragons 2 Gold Dragons 1 Black Dragons 1769 0 0 0 0 0 0 20000 0 None 1 1 1 1 38000 21 100%
2 30% 8 Green Dragons 0% 6 Red Dragons 3 Gold Dragons 2 Black Dragons 2209 0 0 0 0 0 0 30000 0 None 0 1 1 2 57000 26 125%
3 30% 8 Green Dragons 0% 6 Red Dragons 4 Gold Dragons 3 Black Dragons 2556 0 0 0 0 0 0 40000 0 None 0 0 1 3 75000 29 145%
4 10% 8 Green Dragons 0% 7 Red Dragons 6 Gold Dragons 5 Black Dragons 3343 0 0 0 0 0 0 50000 0 None 0 0 0 4 90000 27 189%
Hunting Lodge 1 30% 3 Dendroid Guard Guard Guard 0% 4 Wood Elf 3 Dendroid Guard 4 Wood Elf 100 15 0 0 0 0 0 500 0 None 0 0 0 0 2000 20 100%
2 30% 4 Dendroid Guard 0% 6 Wood Elf 4 Dendroid Guard 6 Wood Elf 150 20 0 0 0 0 0 500 0 None 0 0 0 0 3000 20 100%
3 30% 5 Dendroid Guard 0% 8 Wood Elf 5 Dendroid Guard 8 Wood Elf 200 25 0 0 0 0 0 500 0 None 0 0 0 0 4000 20 150%
4 10% 6 Dendroid Guard 100% 10 Wood Elf 6 Dendroid Guard 10 Wood Elf 300 40 0 0 0 0 0 1000 0 None 0 0 0 0 6000 20 200%
Snow-covered Grotto 1 30% 5 Iron Golem 0% 20 Master Gremlin 5 Iron Golem 20 Master Gremlin 100 0 0 15 0 0 0 500 0 None 0 0 0 0 2000 20 100%
2 30% 6 Iron Golem 0% 30 Master Gremlin 6 Iron Golem 30 Master Gremlin 150 0 0 20 0 0 0 500 0 None 0 0 0 0 3000 20 100%
3 30% 7 Iron Golem 0% 40 Master Gremlin 7 Iron Golem 40 Master Gremlin 200 0 0 30 0 0 0 500 0 None 0 0 0 0 4000 20 150%
4 10% 8 Iron Golem 0% 50 Master Gremlin 8 Iron Golem 50 Master Gremlin 300 0 0 40 0 0 0 1000 0 None 0 0 0 0 6000 20 200%
Palace of Martial Spirit 1 30% 10 Fire Messenger 0% 10 Fire Messenger 10 Fire Messenger 10 Fire Messenger 2000 0 0 0 0 0 0 0 1 God1War 0 0 0 0 38000 21 100%
2 30% 15 Fire Messenger 0% 15 Fire Messenger 15 Fire Messenger 15 Fire Messenger 2000 0 0 0 0 0 0 0 1 God1War 0 0 0 0 57000 26 125%
3 30% 20 Fire Messenger 0% 20 Fire Messenger 20 Fire Messenger 20 Fire Messenger 2000 0 0 0 0 0 0 0 1 God1War 0 0 0 0 75000 29 145%
4 10% 30 Fire Messenger 0% 30 Fire Messenger 30 Fire Messenger 30 Fire Messenger 2000 0 0 0 0 0 0 0 1 God1War 0 0 0 0 90000 27 189%
Citadel of Pacification 1 30% 10 Earth Messenger 0% 10 Earth Messenger 10 Earth Messenger 10 Earth Messenger 2000 0 0 0 0 0 0 0 1 God2Peace 0 0 0 0 38000 21 100%
2 30% 15 Earth Messenger 0% 15 Earth Messenger 15 Earth Messenger 15 Earth Messenger 2000 0 0 0 0 0 0 0 1 God2Peace 0 0 0 0 57000 26 125%
3 30% 20 Earth Messenger 0% 20 Earth Messenger 20 Earth Messenger 20 Earth Messenger 2000 0 0 0 0 0 0 0 1 God2Peace 0 0 0 0 75000 29 145%
4 10% 30 Earth Messenger 0% 30 Earth Messenger 30 Earth Messenger 30 Earth Messenger 2000 0 0 0 0 0 0 0 1 God2Peace 0 0 0 0 90000 27 189%
Monastery of Magicians 1 30% 10 Air Messenger 0% 10 Air Messenger 10 Air Messenger 10 Air Messenger 2000 0 0 0 0 0 0 0 1 God3Mana 0 0 0 0 38000 21 100%
2 30% 15 Air Messenger 0% 15 Air Messenger 15 Air Messenger 15 Air Messenger 2000 0 0 0 0 0 0 0 1 God3Mana 0 0 0 0 57000 26 125%
3 30% 20 Air Messenger 0% 20 Air Messenger 20 Air Messenger 20 Air Messenger 2000 0 0 0 0 0 0 0 1 God3Mana 0 0 0 0 75000 29 145%
4 10% 30 Air Messenger 0% 30 Air Messenger 30 Air Messenger 30 Air Messenger 2000 0 0 0 0 0 0 0 1 God3Mana 0 0 0 0 90000 27 189%
Library of Legends 1 30% 10 Water Messenger 0% 10 Water Messenger 10 Water Messenger 10 Water Messenger 2000 0 0 0 0 0 0 0 1 God4Lore 0 0 0 0 38000 21 100%
2 30% 15 Water Messenger 0% 15 Water Messenger 15 Water Messenger 15 Water Messenger 2000 0 0 0 0 0 0 0 1 God4Lore 0 0 0 0 57000 26 125%
3 30% 20 Water Messenger 0% 20 Water Messenger 20 Water Messenger 20 Water Messenger 2000 0 0 0 0 0 0 0 1 God4Lore 0 0 0 0 75000 29 145%
4 10% 30 Water Messenger 0% 30 Water Messenger 30 Water Messenger 30 Water Messenger 2000 0 0 0 0 0 0 0 1 God4Lore 0 0 0 0 90000 27 189%
Transylvanian Tavern 1 30% 10 Vampire 0% 0 None 0 None 0 None 100 0 0 0 0 0 0 1500 3 Vampire Lord 0 0 0 0 2000 10 100%
2 30% 15 Vampire 0% 0 None 0 None 0 None 150 0 0 0 0 0 0 2500 5 Vampire Lord 0 0 0 0 3000 10 125%
3 30% 20 Vampire 0% 0 None 0 None 0 None 200 0 0 0 0 0 0 3500 7 Vampire Lord 0 0 0 0 4000 10 145%
4 10% 30 Vampire 0% 0 None 0 None 0 None 250 0 0 0 0 0 0 5000 9 Vampire Lord 0 0 0 0 5000 10 189%
Home of the Bat 1 30% 10 Vampire 50% 0 None 0 None 0 None 100 0 2 0 2 2 2 0 3 Vampire Lord 0 0 0 0 2000 10 100%
2 30% 15 Vampire 70% 0 None 0 None 0 None 150 0 3 0 3 3 3 0 5 Vampire Lord 0 0 0 0 3000 10 125%
3 30% 20 Vampire 80% 0 None 0 None 0 None 200 0 4 0 4 4 4 0 7 Vampire Lord 0 0 0 0 4000 10 145%
4 10% 30 Vampire 90% 0 None 0 None 0 None 250 0 5 0 5 5 5 0 9 Vampire Lord 0 0 0 0 5000 10 189%
Lost Bottle 1 30% 10 Genie 50% 0 None 0 None 0 None 100 0 2 0 2 2 2 0 3 Genie 0 0 0 0 2000 10 100%
2 30% 15 Genie 70% 0 None 0 None 0 None 150 0 3 0 3 3 3 0 5 Genie 0 0 0 0 3000 10 125%
3 30% 20 Genie 80% 0 None 0 None 0 None 200 0 4 0 4 4 4 0 7 Genie 0 0 0 0 4000 10 145%
4 10% 30 Genie 90% 0 None 0 None 0 None 250 0 5 0 5 5 5 0 9 Genie 0 0 0 0 5000 10 189%
Grotto 1 30% 3 Harpy 0 3 Beholder 3 Harpy 3 Beholder 200 20 1000 0 None 0 0 0 0 2000 20 100%
2 30% 4 Harpy 0 4 Beholder 4 Harpy 4 Beholder 300 25 1000 0 None 0 0 0 0 3000 20 150%
3 30% 5 Harpy 0 5 Beholder 5 Harpy 5 Beholder 400 30 1500 0 None 0 0 0 0 4000 20 200%
4 10% 6 Harpy 0 6 Beholder 6 Harpy 6 Beholder 500 35 2000 0 None 0 0 0 0 5000 20 250%
Pyramid 1 100% 20 Gold Golem 0% 10 Diamond Golem 20 Gold Golem 10 Diamond Golem 786 15000 19 100%

View File

@ -93,91 +93,74 @@ bool CPlayersVisited::hasVisited( ui8 player ) const
return vstd::contains(players,player);
}
static void readCreatures(std::istream & is, BankConfig & bc, bool guards) //helper function for void CObjectHandler::loadObjects()
// Bank helper. Find the creature ID and their number, and store the
// result in storage (either guards or reward creatures).
static void readCreatures(const JsonNode &creature, std::vector< std::pair <ui16, ui32> > &storage)
{
const int MAX_BUF = 5000;
char buffer[MAX_BUF + 1];
std::pair<si16, si32> guardInfo = std::make_pair(0, 0);
std::string creName;
std::pair<si16, si32> creInfo = std::make_pair(-1, 0);
std::string creName = creature["name"].String();
is >> guardInfo.second;
//one getline just does not work... probably a kind of left whitespace
is.getline(buffer, MAX_BUF, '\t');
is.getline(buffer, MAX_BUF, '\t');
creName = buffer;
if( std::string(buffer) == "None" ) //no creature to be added
return;
//look for the best creature that is described by given name
if( vstd::contains(VLC->creh->nameToID, creName) )
// Look for the best creature that is described by given name
if (vstd::contains(VLC->creh->nameToID, creName))
{
guardInfo.first = VLC->creh->nameToID[creName];
creInfo.first = VLC->creh->nameToID[creName];
}
else
{
for(int g=0; g<VLC->creh->creatures.size(); ++g)
BOOST_FOREACH(const CCreature *cre, VLC->creh->creatures)
{
if(VLC->creh->creatures[g]->namePl == creName
|| VLC->creh->creatures[g]->nameRef == creName
|| VLC->creh->creatures[g]->nameSing == creName)
{
guardInfo.first = VLC->creh->creatures[g]->idNumber;
}
if (cre->namePl == creName ||
cre->nameRef == creName ||
cre->nameSing == creName)
creInfo.first = cre->idNumber;
}
}
assert(creInfo.first != -1); // ensure we found the creature
if(guards)
bc.guards.push_back(guardInfo);
else //given creatures
bc.creatures.push_back(guardInfo);
creInfo.second = creature["number"].Float();
storage.push_back(creInfo);
}
void CObjectHandler::readConfigLine(std::ifstream &istr, int g)
// Bank helper. Process a bank level.
static void readBankLevel(const JsonNode &level, BankConfig &bc)
{
banksInfo[g].push_back(new BankConfig);
int idx;
BankConfig &bc = *banksInfo[g].back();
std::string buf;
//bc.level is of type char and thus we cannot read directly to it; same for some othre variables
istr >> buf;
bc.level = atoi(buf.c_str());
bc.chance = level["chance"].Float();
istr >> buf;
bc.chance = atoi(buf.c_str());
readCreatures(istr, bc, true);
istr >> buf;
bc.upgradeChance = atoi(buf.c_str());
for(int b=0; b<3; ++b)
readCreatures(istr, bc, true);
istr >> bc.combatValue;
bc.resources.resize(RESOURCE_QUANTITY);
//a dirty trick to make it work if there is no 0 for 0 quantity (like in grotto - last entry)
char buft[52];
istr.getline(buft, 50, '\t');
for(int h=0; h<7; ++h)
BOOST_FOREACH(const JsonNode &creature, level["guards"].Vector())
{
istr.getline(buft, 50, '\t');
if(buft[0] == '\0')
bc.resources[h] = 0;
else
bc.resources[h] = SDL_atoi(buft);
readCreatures(creature, bc.guards);
}
bc.upgradeChance = level["upgrade_chance"].Float();
bc.combatValue = level["combat_value"].Float();
bc.resources.resize(RESOURCE_QUANTITY);
idx = 0;
BOOST_FOREACH(const JsonNode &ressource, level["reward_ressources"].Vector())
{
bc.resources[idx] = ressource.Float();
idx ++;
}
BOOST_FOREACH(const JsonNode &creature, level["reward_creatures"].Vector())
{
readCreatures(creature, bc.creatures);
}
readCreatures(istr, bc, false);
bc.artifacts.resize(4);
for(int b=0; b<4; ++b)
idx = 0;
BOOST_FOREACH(const JsonNode &artifact, level["reward_artifacts"].Vector())
{
istr >> bc.artifacts[b];
bc.artifacts[idx] = artifact.Float();
idx ++;
}
istr >> bc.value;
istr >> bc.rewardDifficulty;
istr >> buf;
bc.easiest = atoi(buf.c_str());
bc.value = level["value"].Float();
bc.rewardDifficulty = level["profitability"].Float();
bc.easiest = level["easiest"].Float();
}
void CObjectHandler::loadObjects()
@ -196,6 +179,7 @@ void CObjectHandler::loadObjects()
}
tlog5 << "\t\tDone loading cregens!\n";
tlog5 << "\t\tReading ressources prices \n";
const JsonNode config2(DATA_DIR "/config/ressources.json");
BOOST_FOREACH(const JsonNode &price, config2["ressources_prices"].Vector())
{
@ -203,40 +187,27 @@ void CObjectHandler::loadObjects()
}
tlog5 << "\t\tDone loading resource prices!\n";
std::ifstream istr;
istr.open(DATA_DIR "/config/bankconfig.txt", std::ios_base::binary);
if(!istr.is_open())
tlog5 << "\t\tReading banks configs \n";
const JsonNode config3(DATA_DIR "/config/bankconfig.json");
int bank_num = 0;
BOOST_FOREACH(const JsonNode &bank, config3["banks"].Vector())
{
tlog1 << "No config/bankconfig.txt file !!!\n";
creBanksNames[bank_num] = bank["name"].String();
int level_num = 0;
BOOST_FOREACH(const JsonNode &level, bank["levels"].Vector())
{
banksInfo[bank_num].push_back(new BankConfig);
BankConfig &bc = *banksInfo[bank_num].back();
bc.level = level_num;
readBankLevel(level, bc);
level_num ++;
}
const int MAX_BUF = 5000;
char buffer[MAX_BUF + 1];
//omitting unnecessary lines
istr.getline(buffer, MAX_BUF);
istr.getline(buffer, MAX_BUF);
for(int g=0; g<21; ++g) //TODO: remove hardcoded value
{
//reading name
istr.getline(buffer, MAX_BUF, '\t');
creBanksNames[g] = std::string(buffer);
//remove trailing new line characters
while(creBanksNames[g][0] == 10 || creBanksNames[g][0] == 13)
creBanksNames[g].erase(creBanksNames[g].begin());
for(int i=0; i<4; ++i) //reading levels
{
readConfigLine(istr,g);
bank_num ++;
}
}
//reading name
istr.getline(buffer, MAX_BUF, '\t');
creBanksNames[21] = std::string(buffer);
while(creBanksNames[21][0] == 10 || creBanksNames[21][0] == 13)
creBanksNames[21].erase(creBanksNames[21].begin());
readConfigLine(istr,21); //pyramid
tlog5 << "\t\tDone loading banks configs \n";
}
int CGObjectInstance::getOwner() const

View File

@ -1303,7 +1303,6 @@ public:
std::vector<ui32> resVals; //default values of resources in gold
void loadObjects();
void readConfigLine(std::ifstream &istr, int g);
template <typename Handler> void serialize(Handler &h, const int version)
{