From 13a5a820d04b033b207e07d43c86fc5eab9ad498 Mon Sep 17 00:00:00 2001 From: DjWarmonger Date: Wed, 14 Nov 2012 15:26:33 +0000 Subject: [PATCH] - Fixed #1032 - Fixed upgrades not working after recent changes. Now all upgrades will be handled by creature names. --- config/bankconfig.json | 8 +-- config/creatures.json | 126 +++++++++++++++++++-------------------- lib/CCreatureHandler.cpp | 2 +- lib/CModHandler.cpp | 10 ++++ 4 files changed, 78 insertions(+), 68 deletions(-) diff --git a/config/bankconfig.json b/config/bankconfig.json index 31ddbbdda..1eb1b1e5c 100644 --- a/config/bankconfig.json +++ b/config/bankconfig.json @@ -285,7 +285,7 @@ "levels": [ { "chance": 30, - "guards": [ { "number": 30, "id": 104} ], + "guards": [ { "number": 30, "id": 105} ], "upgrade_chance": 30, "combat_value": 154, "reward_creatures": [ { "number": 4, "id": 108 } ], @@ -295,7 +295,7 @@ }, { "chance": 30, - "guards": [ { "number": 45, "id": 104 } ], + "guards": [ { "number": 45, "id": 105 } ], "upgrade_chance": 0, "combat_value": 230, "reward_creatures": [ { "number": 6, "id": 108 } ], @@ -305,7 +305,7 @@ }, { "chance": 30, - "guards": [ { "number": 60, "id": 104 } ], + "guards": [ { "number": 60, "id": 105 } ], "upgrade_chance": 0, "combat_value": 307, "reward_creatures": [ { "number": 8, "id": 108 } ], @@ -315,7 +315,7 @@ }, { "chance": 10, - "guards": [ { "number": 90, "id": 104 } ], + "guards": [ { "number": 90, "id": 105 } ], "upgrade_chance": 0, "combat_value": 461, "reward_creatures": [ { "number": 12, "id": 108 } ], diff --git a/config/creatures.json b/config/creatures.json index 13d11bc77..d742ecf66 100644 --- a/config/creatures.json +++ b/config/creatures.json @@ -23,7 +23,7 @@ "level": 1, "name": [ "Pikeman" ], "faction": 0, - "upgrades": [1], + "upgrades": ["Halberdier"], "ability_add": [ [ "CHARGE_IMMUNITY", 0, 0, 0 ] ], //pikeman immunity to Champion charge bonus "defname": "CPKMAN.DEF" }, @@ -42,7 +42,7 @@ "level": 2, "name": [ "Archer", "LightCrossbowman" ], "faction": 0, - "upgrades": [3], + "upgrades": ["HeavyCrossbowman"], "defname": "CLCBOW.DEF", "projectile_defname": "PLCBOWX.DEF", "projectile_spin": false @@ -64,7 +64,7 @@ "name": [ "Griffin" ], "faction": 0, "ability_add": [ [ "ADDITIONAL_RETALIATION", 1, 0, 0 ] ], //griffins retaliate twice - "upgrades": [5], + "upgrades": ["RoyalGriffin"], "defname": "CGRIFF.DEF" }, @@ -82,7 +82,7 @@ "level": 4, "name": [ "Swordsman" ], "faction": 0, - "upgrades": [7], + "upgrades": ["Crusader"], "defname": "CSWORD.DEF" }, @@ -99,7 +99,7 @@ "level": 5, "name": [ "Monk" ], "faction": 0, - "upgrades": [9], + "upgrades": ["Zealot"], "defname": "CMONKK.DEF", "projectile_defname": "CPRZEAX.DEF", "projectile_spin": false @@ -120,7 +120,7 @@ "level": 6, "name": [ "Cavalier" ], "faction": 0, - "upgrades": [11], + "upgrades": ["Champion"], "defname": "CCAVLR.DEF" }, @@ -139,7 +139,7 @@ "faction": 0, "ability_add": [ [ "HATE", 50, 55, 0 ], //angels hate archdevils [ "HATE", 50, 54, 0 ] ], //angels hate devils - "upgrades": [13], + "upgrades": ["Archangel"], "defname": "CANGEL.DEF" }, @@ -161,7 +161,7 @@ "level": 1, "name": [ "Centaur" ], "faction": 1, - "upgrades": [15], + "upgrades": ["EliteCentaur"], "defname": "CCENTR.DEF" }, @@ -179,7 +179,7 @@ "name": [ "Dwarf" ], "faction": 1, "ability_add": [ [ "MAGIC_RESISTANCE", 20, 0, 0 ] ], //dwarf's magic resistance 20% - "upgrades": [17], + "upgrades": ["BattleDwarf"], "defname": "CDWARF.DEF" }, @@ -197,7 +197,7 @@ "level": 3, "name": [ "WoodElf" ], "faction": 1, - "upgrades": [19], + "upgrades": ["GrandElf"], "defname": "CELF.DEF", "projectile_defname": "PELFX.DEF", "projectile_spin": false @@ -219,7 +219,7 @@ "name": [ "Pegasus" ], "faction": 1, "ability_add": [ [ "CHANGES_SPELL_COST_FOR_ENEMY", 2, 0, 0 ] ], //pegasus makes spell cost higher for enemy mage - "upgrades": [21], + "upgrades": ["SilverPegasus"], "defname": "CPEGAS.DEF" }, @@ -238,7 +238,7 @@ "name": [ "Treefolk" ], "faction": 1, "ability_add": [ [ "SPELL_AFTER_ATTACK", 100, 72, 0 ] ], //dendroids cast bind - "upgrades": [23], + "upgrades": ["BriarTreefolk"], "defname": "CTREE.DEF" }, @@ -258,7 +258,7 @@ "faction": 1, "ability_add": [ [ "SPELL_RESISTANCE_AURA", 0, 55, 0 ], //unicorn [ "SPELL_AFTER_ATTACK", 20, 62, 0 ] ], //unicorns cast blind with 20% probability - "upgrades": [25], + "upgrades": ["WarUnicorn"], "defname": "CUNICO.DEF" }, @@ -280,7 +280,7 @@ "ability_add": [ [ "DRAGON_NATURE", 0, 0, 0 ], //green dragon is a dragon [ "TWO_HEX_ATTACK_BREATH", 0, 0, 0 ], //green dragon's breath [ "LEVEL_SPELL_IMMUNITY", 3, 0, 0 ] ], //green dragon's spell immunity - "upgrades": [27], + "upgrades": ["GoldDragon"], "defname": "CGDRAG.DEF" }, @@ -300,7 +300,7 @@ "level": 1, "name": [ "ApprenticeGremlin" ], "faction": 2, - "upgrades": [29], + "upgrades": ["MasterGremlin"], "defname": "CGREMA.DEF" }, @@ -320,7 +320,7 @@ "name": [ "StoneGargoyle" ], "faction": 2, "ability_add": [ [ "NON_LIVING", 0, 0, 0 ] ], //stone gargoyles are non-living - "upgrades": [31], + "upgrades": ["ObsidianGargoyle"], "defname": "CGARGO.DEF" }, @@ -340,7 +340,7 @@ "faction": 2, "ability_add": [ [ "SPELL_DAMAGE_REDUCTION", 50, -1, 0 ], //stone golems reduce dmg from spells [ "NON_LIVING", 0, 0, 0 ] ], //stone golems are non-living - "upgrades": [33], + "upgrades": ["StoneGolem"], //? "defname": "CSGOLE.DEF" }, @@ -360,7 +360,7 @@ "name": [ "Mage" ], "faction": 2, "ability_add": [ [ "CHANGES_SPELL_COST_FOR_ALLY", 2, 0, 0 ] ], //mages reduce spell cost - "upgrades": [35], + "upgrades": ["ArchMage"], "defname": "CMAGE.DEF", "projectile_defname": "PMAGEX.DEF", "projectile_spin": false @@ -384,7 +384,7 @@ "faction": 2, "ability_add": [ [ "HATE", 50, 53, 0 ], //master genies hate efreets [ "HATE", 50, 52, 0 ] ], //genies hate efreet sultans - "upgrades": [37], + "upgrades": ["Caliph"], "defname": "CGENIE.DEF" }, @@ -407,7 +407,7 @@ "name": [ "NagaSentinel" ], "faction": 2, "ability_add": [ [ "BLOCKS_RETALIATION", 0, 0, 0 ] ], //nagas block retaliation - "upgrades": [39], + "upgrades": ["NagaGuardian"], "defname": "CNAGA.DEF" }, @@ -426,7 +426,7 @@ "name": [ "LesserTitan" ], "faction": 2, "ability_add": [ ["MIND_IMMUNITY", 0, 0, 0] ], //giants are immune to mind spells - "upgrades": [41], + "upgrades": ["GreaterTitan"], "defname": "CLTITA.DEF" }, @@ -447,7 +447,7 @@ "level": 1, "name": [ "Imp" ], "faction": 3, - "upgrades": [43], + "upgrades": ["Familiar"], "defname": "CIMP.DEF" }, @@ -465,7 +465,7 @@ "level": 2, "name": [ "Gog" ], "faction": 3, - "upgrades": [45], + "upgrades": ["Magog"], "defname": "CGOG.DEF", "projectile_defname": "CPRGOGX.DEF", "projectile_spin": false @@ -487,7 +487,7 @@ "level": 3, "name": [ "HellHound" ], "faction": 3, - "upgrades": [47], + "upgrades": ["Cerberus"], "ability_remove": [ "FLYING" ], //hell hound doesn't fly "defname": "CHHOUN.DEF" }, @@ -508,7 +508,7 @@ "level": 4, "name": [ "Single-HornedDemon" ], "faction": 3, - "upgrades": [49], + "upgrades": ["Dual-HornedDemon"], "defname": "COHDEM.DEF" }, @@ -525,7 +525,7 @@ "level": 5, "name": [ "PitFiend" ], "faction": 3, - "upgrades": [51], + "upgrades": ["PitFoe"], "defname": "CPFIEN.DEF" }, @@ -548,7 +548,7 @@ [ "HATE", 50, 36, 0 ], [ "FLYING", 0, 0, 0 ], //efreeti hate master genies [ "FIRE_IMMUNITY", 0, 0, 0 ] ], //efreeti hate genies - "upgrades": [53], + "upgrades": ["EfreetSultan"], "defname": "CEFREE.DEF" }, @@ -576,7 +576,7 @@ [ "HATE", 50, 12, 0 ], [ "ENEMY_LUCK_DECREASING", 1, 0, 0 ], //devils //devils hate archangles [ "BLOCKS_RETALIATION", 0, 0, 0 ] ], //devils //devils hate angels - "upgrades": [55], + "upgrades": ["ArchDevil"], "defname": "CDEVIL.DEF" }, @@ -599,7 +599,7 @@ "level": 1, "name": [ "Skeleton" ], "faction": 4, - "upgrades": [57], + "upgrades": ["SkeletonWarrior"], "defname": "CSKELE.DEF" }, @@ -616,7 +616,7 @@ "level": 2, "name": [ "Zombie" ], "faction": 4, - "upgrades": [59], + "upgrades": ["ZombieLord"], "defname": "CZOMBI.DEF" }, @@ -634,7 +634,7 @@ "name": [ "Wight" ], "faction": 4, "ability_add": [ [ "FULL_HP_REGENERATION", 0, 1, 0 ] ], //wight - "upgrades": [61], + "upgrades": ["Wraith"], "defname": "CWIGHT.DEF" }, @@ -654,7 +654,7 @@ "name": [ "Vampire" ], "faction": 4, "ability_add": [ [ "BLOCKS_RETALIATION", 0, 0, 0 ] ], //vampires //vampire lords - "upgrades": [63], + "upgrades": ["Nosferatu"], "defname": "CVAMP.DEF" }, @@ -674,7 +674,7 @@ "name": [ "Lich" ], "faction": 4, "ability_add": [ [ "SPELL_LIKE_ATTACK", 0, 76, 0 ] ], //liches - "upgrades": [65], + "upgrades": ["PowerLich"], "defname": "CLICH.DEF", "projectile_defname": "PLICH.DEF", "projectile_spin": false @@ -697,7 +697,7 @@ "name": [ "BlackKnight" ], "faction": 4, "ability_add": [ [ "SPELL_AFTER_ATTACK", 20, 42, 0 ] ], //black knights - "upgrades": [67], + "upgrades": ["BlackLord"], "defname": "CBKNIG.DEF" }, @@ -717,7 +717,7 @@ "name": [ "BoneDragon" ], "faction": 4, "ability_add": [ [ "DRAGON_NATURE", 0, 0, 0 ] ], //bone dragon is a dragon - "upgrades": [69], + "upgrades": ["GhostDragon"], "defname": "CNDRGN.DEF" }, @@ -737,7 +737,7 @@ "name": [ "Troglodyte" ], "faction": 5, "ability_add": [ [ "SPELL_IMMUNITY", 0, 62, 0 ] ], //troglodytes are immune to blind - "upgrades": [71], + "upgrades": ["InfernalTroglodyte"], "defname": "CTROGL.DEF" }, @@ -756,7 +756,7 @@ "name": [ "Harpy" ], "faction": 5, "ability_add": [ [ "RETURN_AFTER_STRIKE", 0, 0, 0 ] ], //Harpies return after attack - "upgrades": [73], + "upgrades": ["HarpyHag"], "defname": "CHARPY.DEF" }, @@ -775,7 +775,7 @@ "level": 3, "name": [ "Beholder" ], "faction": 5, - "upgrades": [75], + "upgrades": ["EvilEye"], "defname": "CBEHOL.DEF", "projectile_defname": "SMBALX.DEF", "projectile_spin": false @@ -797,7 +797,7 @@ "name": [ "Medusa", "Medusae" ], "faction": 5, "ability_add": [ [ "SPELL_AFTER_ATTACK", 20, 70, 2000 ] ], //medusas //minotaurs - "upgrades": [77], + "upgrades": ["MedusaQueen"], "defname": "CMEDUS.DEF", "projectile_defname": "PMEDUSX.DEF", "projectile_spin": false @@ -820,7 +820,7 @@ "name": [ "Minotaur" ], "faction": 5, "ability_add": [ [ "SELF_MORALE", 0, 0, 0 ] ], - "upgrades": [79], + "upgrades": ["MinotaurKing"], "defname": "CMINOT.DEF" }, @@ -838,7 +838,7 @@ "level": 6, "name": [ "Manticore" ], "faction": 5, - "upgrades": [81], + "upgrades": ["Scorpicore"], "defname": "CMCORE.DEF" }, @@ -859,7 +859,7 @@ "ability_add": [ [ "DRAGON_NATURE", 0, 0, 0 ], //red dragon is a dragon [ "TWO_HEX_ATTACK_BREATH", 0, 0, 0 ], //Red Dragon has breath attack [ "LEVEL_SPELL_IMMUNITY", 3, 0, 0 ] ], //red dragon's spell immunity - "upgrades": [83], + "upgrades": ["BlackDragon"], "defname": "CRDRGN.DEF" }, @@ -881,7 +881,7 @@ "level": 1, "name": [ "Goblin" ], "faction": 6, - "upgrades": [85], + "upgrades": ["Hobgoblin"], "defname": "CGOBLI.DEF" }, @@ -898,7 +898,7 @@ "level": 2, "name": [ "GoblinWolfRider" ], "faction": 6, - "upgrades": [87], + "upgrades": ["HobgoblinWolfRider"], "defname": "CBWLFR.DEF" }, @@ -916,7 +916,7 @@ "level": 3, "name": [ "Orc" ], "faction": 6, - "upgrades": [89], + "upgrades": ["OrcChieftain"], "defname": "CORC.DEF", "projectile_defname": "PORCHX.DEF", "projectile_spin": true @@ -937,7 +937,7 @@ "level": 4, "name": [ "Ogre" ], "faction": 6, - "upgrades": [91], + "upgrades": ["OgreMage"], "defname": "COGRE.DEF" }, @@ -957,7 +957,7 @@ "level": 5, "name": [ "Roc" ], "faction": 6, - "upgrades": [93], + "upgrades": ["Thunderbird"], "defname": "CROC.DEF" }, @@ -976,7 +976,7 @@ "level": 6, "name": [ "Cyclops" ], "faction": 6, - "upgrades": [95], + "upgrades": ["CyclopsLord"], "defname": "CCYCLR.DEF", "projectile_defname": "PCYCLBX.DEF", "projectile_spin": true @@ -998,7 +998,7 @@ "name": [ "YoungBehemoth" ], "faction": 6, "ability_add": [ [ "ENEMY_DEFENCE_REDUCTION", 40, 0, 0 ] ], //behemots - "upgrades": [97], + "upgrades": ["AncientBehemoth"], "defname": "CYBEHE.DEF" }, @@ -1016,7 +1016,7 @@ "level": 1, "name": [ "Gnoll" ], "faction": 7, - "upgrades": [99], + "upgrades": ["GnollMarauder"], "defname": "CGNOLL.DEF" }, @@ -1033,7 +1033,7 @@ "level": 2, "name": [ "PrimitiveLizardman" ], "faction": 7, - "upgrades": [101], + "upgrades": ["AdvancedLizardman"], "defname": "CPLIZA.DEF", "projectile_defname": "PPLIZAX.DEF", "projectile_spin": false @@ -1054,7 +1054,7 @@ "level": 5, "name": [ "CopperGorgon" ], "faction": 7, - "upgrades": [103], + "upgrades": ["BronzeGorgon"], "defname": "CCGORG.DEF" }, @@ -1073,7 +1073,7 @@ "name": [ "Dragonflies", "DragonFly", "SerpentFly" ], "faction": 7, "ability_add": [ [ "SPELL_AFTER_ATTACK", 100, 78, 0 ] ], //serpent fly - "upgrades": [105], + "upgrades": ["FireDragonFly"], "defname": "CDRFLY.DEF" }, @@ -1093,7 +1093,7 @@ "name": [ "Basilisk" ], "faction": 7, "ability_add": [ [ "SPELL_AFTER_ATTACK", 20, 70, 0 ] ], //basilisks - "upgrades": [107], + "upgrades": ["GreaterBasilisk"], "defname": "CBASIL.DEF" }, @@ -1111,7 +1111,7 @@ "level": 6, "name": [ "Wyvern" ], "faction": 7, - "upgrades": [109], + "upgrades": ["WyvernMonarch"], "defname": "CWYVER.DEF" }, @@ -1131,7 +1131,7 @@ "faction": 7, "ability_add": [ [ "BLOCKS_RETALIATION", 0, 0, 0 ], //hydras [ "ATTACKS_ALL_ADJACENT", 0, 0, 0 ] ], //hydras - "upgrades": [111], + "upgrades": ["ChaosHydra"], "defname": "CHYDRA.DEF" }, @@ -1158,7 +1158,7 @@ [ "NON_LIVING", 0, 0, 0 ], [ "MORE_DAMAGE_FROM_SPELL", 100, 19, 0 ], //air elementals are vulnerable to chain lightning [ "MORE_DAMAGE_FROM_SPELL", 100, 17, 0 ] ], //air elementals are vulnerable to lightning bolt //air elementals are non-living - "upgrades": [127], + "upgrades": ["StormElemental"], "defname": "CAELEM.DEF" }, @@ -1175,7 +1175,7 @@ [ "SPELL_IMMUNITY", 0, 17, 0 ], //earth elementals are immune to lightning bolt [ "NON_LIVING", 0, 0, 0 ], [ "MORE_DAMAGE_FROM_SPELL", 100, 23, 0 ] ], //earth elementals are vulnerable to meteor shower - "upgrades": [125], + "upgrades": ["StoneElemental"], "defname": "CEELEM.DEF" }, @@ -1192,7 +1192,7 @@ [ "MORE_DAMAGE_FROM_SPELL", 100, 20, 0 ], //fire elementals are vulnerable to frost ring [ "MORE_DAMAGE_FROM_SPELL", 100, 16, 0 ], //fire elementals are vulnerable to ice bolt [ "FIRE_IMMUNITY", 0, 0, 0 ] ], //fire elementals are immune to fire spells - "upgrades": [129], + "upgrades": ["ElectricityElemental"], "defname": "CFELEM.DEF" }, @@ -1213,7 +1213,7 @@ [ "MORE_DAMAGE_FROM_SPELL", 100, 21, 0 ], //water elementals are vulnerable to fireball [ "MORE_DAMAGE_FROM_SPELL", 100, 13, 0 ], //water elementals are vulnerable to fire wall [ "DOUBLE_WIDE", 0, 0, 0 ] ], - "upgrades": [123], + "upgrades": ["IceElemental"], "defname": "CWELEM.DEF" }, @@ -1242,7 +1242,7 @@ "level": 1, "name": [ "Pixie", "Pixies" ], "faction": 8, - "upgrades": [119], + "upgrades": ["Sprite"], "defname": "CPIXIE.DEF" }, @@ -1261,7 +1261,7 @@ "faction": 8, "ability_add": [ [ "NON_LIVING", 0, 0, 0 ] ], //magic elementals shouldn't get morale "ability_remove": [ "DOUBLE_WIDE" ], - "upgrades": [121], + "upgrades": ["MagicElemental"], "defname": "CPSYEL.DEF" }, @@ -1334,7 +1334,7 @@ "level": 7, "name": [ "Firebird" ], "faction": 8, - "upgrades": [131], + "upgrades": ["Pheonix"], "defname": "CFBIRD.DEF" }, diff --git a/lib/CCreatureHandler.cpp b/lib/CCreatureHandler.cpp index ca2fc8c3c..ced3de05b 100644 --- a/lib/CCreatureHandler.cpp +++ b/lib/CCreatureHandler.cpp @@ -332,7 +332,7 @@ void CCreatureHandler::loadCreatures() BOOST_FOREACH(const JsonNode &value, creature["upgrades"].Vector()) { - c->upgrades.insert(value.Float()); + c->upgradeNames.insert(value.String()); } value = &creature["projectile_defname"]; diff --git a/lib/CModHandler.cpp b/lib/CModHandler.cpp index 905eec33d..57e1f2e6b 100644 --- a/lib/CModHandler.cpp +++ b/lib/CModHandler.cpp @@ -118,6 +118,16 @@ void CModHandler::reload() VLC->dobjinfo->gobjs[Obj::MONSTER][crea->idNumber] = info; } + BOOST_FOREACH(auto up, crea->upgradeNames) + { + auto it = VLC->creh->nameToID.find(up); + if (it != VLC->creh->nameToID.end()) + { + crea->upgrades.insert (it->second); + } + else + tlog2 << "Not found upgrade with name " << up << "\n"; + } } }