Browse Source

More string ID's for buildings:
- town hall slots now use string ID's
- converted building requirements to new format
- "upgrades" property from buildings now uses string ID's
- several fixes for improved support of alternative creatures
- removed no longer needed "id" property from structures

Old mods should still work but will produce error messages during
validation

Ivan Savenko 12 years ago
parent
commit
122db9963b

+ 74 - 71
config/factions/castle.json

@@ -76,43 +76,43 @@
 			"structures" :
 			{
 				"extraAnimation": { "animation" : "TBCSEXT2.def", "x" : 46,  "y" : 119 },
-				"mageGuild1":     { "id" : 0,  "animation" : "TBCSMAGE.def", "x" : 707, "y" : 166, "z" : 1, "border" : "TOCSMAG1.bmp", "area" : "TZCSMAG1.bmp" },
-				"mageGuild2":     { "id" : 1,  "animation" : "TBCSMAG2.def", "x" : 706, "y" : 135, "z" : 1, "border" : "TOCSMAG2.bmp", "area" : "TZCSMAG2.bmp" },
-				"mageGuild3":     { "id" : 2,  "animation" : "TBCSMAG3.def", "x" : 704, "y" : 107, "z" : 1, "border" : "TOCSM301.bmp", "area" : "TZCSM301.bmp" },
-				"mageGuild4":     { "id" : 3,  "animation" : "TBCSMAG4.def", "x" : 704, "y" : 76,  "z" : 1, "border" : "TOCSM401.bmp", "area" : "TZCSM401.bmp" },
-				"tavern":         { "id" : 5,  "animation" : "TBCSTVRN.def", "x" : 0,   "y" : 230, "z" : 1, "border" : "TOCSTAV1.bmp", "area" : "TZCSTAV1.bmp" },
-				"shipyard":       { "id" : 6,  "animation" : "TBCSDOCK.def", "x" : 478, "y" : 134, "border" : "TOCSDKMS.bmp", "area" : "TZCSDKMS.bmp" },
-				"fort":           { "id" : 7,  "animation" : "TBCSCSTL.def", "x" : 595, "y" : 66,  "border" : "TOCSCAS1.bmp", "area" : "TZCSCAS1.bmp" },
-				"citadel":        { "id" : 8,  "animation" : "TBCSCAS2.def", "x" : 478, "y" : 66,  "border" : "TOCSCAS2.bmp", "area" : "TZCSCAS2.bmp" },
-				"castle":         { "id" : 9,  "animation" : "TBCSCAS3.def", "x" : 478, "y" : 37,  "border" : "TOCSCAS3.bmp", "area" : "TZCSCAS3.bmp" },
-				"villageHall":    { "id" : 10, "animation" : "TBCSHALL.def", "x" : 0,   "y" : 209, "border" : "TOCSH101.bmp", "area" : "TZCSH101.bmp" },
-				"townHall":       { "id" : 11, "animation" : "TBCSHAL2.def", "x" : 0,   "y" : 176, "border" : "TOCSH201.bmp", "area" : "TZCSH201.bmp" },
-				"cityHall":       { "id" : 12, "animation" : "TBCSHAL3.def", "x" : 0,   "y" : 164, "border" : "TOCSH301.bmp", "area" : "TZCSH301.bmp" },
-				"capitol":        { "id" : 13, "animation" : "TBCSHAL4.def", "x" : 0,   "y" : 154, "border" : "TOCSH401.bmp", "area" : "TZCSH401.bmp" },
-				"marketplace":    { "id" : 14, "animation" : "TBCSMARK.def", "x" : 413, "y" : 264, "border" : "TOCSMRK1.bmp", "area" : "TZCSMRK1.bmp" },
-				"resourceSilo":  { "id" : 15, "animation" : "TBCSSILO.def", "x" : 488, "y" : 228, "border" : "TOCSMRK2.bmp", "area" : "TZCSMRK2.bmp" },
-				"blacksmith":     { "id" : 16, "animation" : "TBCSBLAK.def", "x" : 213, "y" : 251, "border" : "TOCSBLAK.bmp", "area" : "TZCSBLAK.bmp" },
-				"special1":       { "id" : 17, "animation" : "TBCSSPEC.def", "x" : 533, "y" : 71,  "border" : "TOCSLT01.bmp", "area" : "TZCSLT01.bmp" },
-				"horde1":         { "id" : 18, "animation" : "TBCSHRD1.def", "x" : 76,  "y" : 53,  "border" : "TOCSGR1H.bmp", "area" : "TZCSGR1H.bmp", "hidden" : true },
-				"horde1Upgr":     { "id" : 19, "animation" : "TBCSHRD2.def", "x" : 76,  "y" : 35,  "border" : "TOCSGR2H.bmp", "area" : "TZCSGR2H.bmp", "hidden" : true, "builds" : 18 },
-				"ship":           { "id" : 20, "animation" : "TBCSBOAT.def", "x" : 478, "y" : 134, "border" : "TOCSDKMN.bmp", "area" : "TZCSDKMN.bmp", "hidden" : true },
-				"special2":       { "id" : 21, "animation" : "TBCSEXT0.def", "x" : 384, "y" : 193, "z" : -2, "border" : "TOCSCAVM.bmp", "area" : "TZCSCAVM.bmp" },
-				"special3":       { "id" : 22, "animation" : "TBCSEXT1.def", "x" : 0,   "y" : 198, "z" :  1, "border" : "TOCSTAV2.bmp", "area" : "TZCSTAV2.bmp" },
-				"grail":          { "id" : 26, "animation" : "TBCSHOLY.def", "x" : 456, "y" : 109, "z" : -1, "border" : "TOCSHOLY.bmp", "area" : "TZCSHOLY.bmp" },
-				"dwellingLvl1":   { "id" : 30, "animation" : "TBCSDW_0.def", "x" : 304, "y" : 92,  "border" : "TOCSPIK1.bmp", "area" : "TZCSPIK1.bmp" },
-				"dwellingLvl2":   { "id" : 31, "animation" : "TBCSDW_1.def", "x" : 360, "y" : 130, "border" : "TOCSCRS1.bmp", "area" : "TZCSCRS1.bmp" },
-				"dwellingLvl3":   { "id" : 32, "animation" : "TBCSDW_2.def", "x" : 76,  "y" : 57,  "border" : "TOCSGR1N.bmp", "area" : "TZCSGR1N.bmp" },
-				"dwellingLvl4":   { "id" : 33, "animation" : "TBCSDW_3.def", "x" : 176, "y" : 101, "border" : "TOCSSWD1.bmp", "area" : "TZCSSWD1.bmp" },
-				"dwellingLvl5":   { "id" : 34, "animation" : "TBCSDW_4.def", "x" : 563, "y" : 211, "z" : 1,  "border" : "TOCSMON1.bmp", "area" : "TZCSMON1.bmp" },
-				"dwellingLvl6":   { "id" : 35, "animation" : "TBCSDW_5.def", "x" : 174, "y" : 190, "z" : -1, "border" : "TOCSC101.bmp", "area" : "TZCSCAV1.bmp" },
-				"dwellingLvl7":   { "id" : 36, "animation" : "TBCSDW_6.def", "x" : 303, "y" : 0,   "z" : -1, "border" : "TOCSANG1.bmp", "area" : "TZCSANG1.bmp" },
-				"dwellingUpLvl1": { "id" : 37, "animation" : "TBCSUP_0.def", "x" : 304, "y" : 65,  "border" : "TOCSPIK2.bmp", "area" : "TZCSPIK2.bmp" },
-				"dwellingUpLvl2": { "id" : 38, "animation" : "TBCSUP_1.def", "x" : 360, "y" : 115, "border" : "TOCSCRS2.bmp", "area" : "TZCSCRS2.bmp" },
-				"dwellingUpLvl3": { "id" : 39, "animation" : "TBCSUP_2.def", "x" : 76,  "y" : 35,  "border" : "TOCSGR2N.bmp", "area" : "TZCSGR2N.bmp" },
-				"dwellingUpLvl4": { "id" : 40, "animation" : "TBCSUP_3.def", "x" : 176, "y" : 85,  "border" : "TOCSSWD2.bmp", "area" : "TZCSSWD2.bmp" },
-				"dwellingUpLvl5": { "id" : 41, "animation" : "TBCSUP_4.def", "x" : 563, "y" : 173, "z" : 1,  "border" : "TOCSMON2.bmp", "area" : "TZCSMON2.bmp" },
-				"dwellingUpLvl6": { "id" : 42, "animation" : "TBCSUP_5.def", "x" : 160, "y" : 190, "z" : -1, "border" : "TOCSCAV2.bmp", "area" : "TZCSCAV2.bmp" },
-				"dwellingUpLvl7": { "id" : 43, "animation" : "TBCSUP_6.def", "x" : 303, "y" : 0,   "z" : -1, "border" : "TOCSANG2.bmp", "area" : "TZCSANG2.bmp" }
+				"mageGuild1":     { "animation" : "TBCSMAGE.def", "x" : 707, "y" : 166, "z" : 1, "border" : "TOCSMAG1.bmp", "area" : "TZCSMAG1.bmp" },
+				"mageGuild2":     { "animation" : "TBCSMAG2.def", "x" : 706, "y" : 135, "z" : 1, "border" : "TOCSMAG2.bmp", "area" : "TZCSMAG2.bmp" },
+				"mageGuild3":     { "animation" : "TBCSMAG3.def", "x" : 704, "y" : 107, "z" : 1, "border" : "TOCSM301.bmp", "area" : "TZCSM301.bmp" },
+				"mageGuild4":     { "animation" : "TBCSMAG4.def", "x" : 704, "y" : 76,  "z" : 1, "border" : "TOCSM401.bmp", "area" : "TZCSM401.bmp" },
+				"tavern":         { "animation" : "TBCSTVRN.def", "x" : 0,   "y" : 230, "z" : 1, "border" : "TOCSTAV1.bmp", "area" : "TZCSTAV1.bmp" },
+				"shipyard":       { "animation" : "TBCSDOCK.def", "x" : 478, "y" : 134, "border" : "TOCSDKMS.bmp", "area" : "TZCSDKMS.bmp" },
+				"fort":           { "animation" : "TBCSCSTL.def", "x" : 595, "y" : 66,  "border" : "TOCSCAS1.bmp", "area" : "TZCSCAS1.bmp" },
+				"citadel":        { "animation" : "TBCSCAS2.def", "x" : 478, "y" : 66,  "border" : "TOCSCAS2.bmp", "area" : "TZCSCAS2.bmp" },
+				"castle":         { "animation" : "TBCSCAS3.def", "x" : 478, "y" : 37,  "border" : "TOCSCAS3.bmp", "area" : "TZCSCAS3.bmp" },
+				"villageHall":    { "animation" : "TBCSHALL.def", "x" : 0,   "y" : 209, "border" : "TOCSH101.bmp", "area" : "TZCSH101.bmp" },
+				"townHall":       { "animation" : "TBCSHAL2.def", "x" : 0,   "y" : 176, "border" : "TOCSH201.bmp", "area" : "TZCSH201.bmp" },
+				"cityHall":       { "animation" : "TBCSHAL3.def", "x" : 0,   "y" : 164, "border" : "TOCSH301.bmp", "area" : "TZCSH301.bmp" },
+				"capitol":        { "animation" : "TBCSHAL4.def", "x" : 0,   "y" : 154, "border" : "TOCSH401.bmp", "area" : "TZCSH401.bmp" },
+				"marketplace":    { "animation" : "TBCSMARK.def", "x" : 413, "y" : 264, "border" : "TOCSMRK1.bmp", "area" : "TZCSMRK1.bmp" },
+				"resourceSilo":   { "animation" : "TBCSSILO.def", "x" : 488, "y" : 228, "border" : "TOCSMRK2.bmp", "area" : "TZCSMRK2.bmp" },
+				"blacksmith":     { "animation" : "TBCSBLAK.def", "x" : 213, "y" : 251, "border" : "TOCSBLAK.bmp", "area" : "TZCSBLAK.bmp" },
+				"special1":       { "animation" : "TBCSSPEC.def", "x" : 533, "y" : 71,  "border" : "TOCSLT01.bmp", "area" : "TZCSLT01.bmp" },
+				"horde1":         { "animation" : "TBCSHRD1.def", "x" : 76,  "y" : 53,  "border" : "TOCSGR1H.bmp", "area" : "TZCSGR1H.bmp", "hidden" : true },
+				"horde1Upgr":     { "animation" : "TBCSHRD2.def", "x" : 76,  "y" : 35,  "border" : "TOCSGR2H.bmp", "area" : "TZCSGR2H.bmp", "hidden" : true, "builds" : "horde1" },
+				"ship":           { "animation" : "TBCSBOAT.def", "x" : 478, "y" : 134, "border" : "TOCSDKMN.bmp", "area" : "TZCSDKMN.bmp", "hidden" : true },
+				"special2":       { "animation" : "TBCSEXT0.def", "x" : 384, "y" : 193, "z" : -2, "border" : "TOCSCAVM.bmp", "area" : "TZCSCAVM.bmp" },
+				"special3":       { "animation" : "TBCSEXT1.def", "x" : 0,   "y" : 198, "z" :  1, "border" : "TOCSTAV2.bmp", "area" : "TZCSTAV2.bmp" },
+				"grail":          { "animation" : "TBCSHOLY.def", "x" : 456, "y" : 109, "z" : -1, "border" : "TOCSHOLY.bmp", "area" : "TZCSHOLY.bmp" },
+				"dwellingLvl1":   { "animation" : "TBCSDW_0.def", "x" : 304, "y" : 92,  "border" : "TOCSPIK1.bmp", "area" : "TZCSPIK1.bmp" },
+				"dwellingLvl2":   { "animation" : "TBCSDW_1.def", "x" : 360, "y" : 130, "border" : "TOCSCRS1.bmp", "area" : "TZCSCRS1.bmp" },
+				"dwellingLvl3":   { "animation" : "TBCSDW_2.def", "x" : 76,  "y" : 57,  "border" : "TOCSGR1N.bmp", "area" : "TZCSGR1N.bmp" },
+				"dwellingLvl4":   { "animation" : "TBCSDW_3.def", "x" : 176, "y" : 101, "border" : "TOCSSWD1.bmp", "area" : "TZCSSWD1.bmp" },
+				"dwellingLvl5":   { "animation" : "TBCSDW_4.def", "x" : 563, "y" : 211, "z" : 1,  "border" : "TOCSMON1.bmp", "area" : "TZCSMON1.bmp" },
+				"dwellingLvl6":   { "animation" : "TBCSDW_5.def", "x" : 174, "y" : 190, "z" : -1, "border" : "TOCSC101.bmp", "area" : "TZCSCAV1.bmp" },
+				"dwellingLvl7":   { "animation" : "TBCSDW_6.def", "x" : 303, "y" : 0,   "z" : -1, "border" : "TOCSANG1.bmp", "area" : "TZCSANG1.bmp" },
+				"dwellingUpLvl1": { "animation" : "TBCSUP_0.def", "x" : 304, "y" : 65,  "border" : "TOCSPIK2.bmp", "area" : "TZCSPIK2.bmp" },
+				"dwellingUpLvl2": { "animation" : "TBCSUP_1.def", "x" : 360, "y" : 115, "border" : "TOCSCRS2.bmp", "area" : "TZCSCRS2.bmp" },
+				"dwellingUpLvl3": { "animation" : "TBCSUP_2.def", "x" : 76,  "y" : 35,  "border" : "TOCSGR2N.bmp", "area" : "TZCSGR2N.bmp" },
+				"dwellingUpLvl4": { "animation" : "TBCSUP_3.def", "x" : 176, "y" : 85,  "border" : "TOCSSWD2.bmp", "area" : "TZCSSWD2.bmp" },
+				"dwellingUpLvl5": { "animation" : "TBCSUP_4.def", "x" : 563, "y" : 173, "z" : 1,  "border" : "TOCSMON2.bmp", "area" : "TZCSMON2.bmp" },
+				"dwellingUpLvl6": { "animation" : "TBCSUP_5.def", "x" : 160, "y" : 190, "z" : -1, "border" : "TOCSCAV2.bmp", "area" : "TZCSCAV2.bmp" },
+				"dwellingUpLvl7": { "animation" : "TBCSUP_6.def", "x" : 303, "y" : 0,   "z" : -1, "border" : "TOCSANG2.bmp", "area" : "TZCSANG2.bmp" }
 			},
 
 			"musicTheme" : "music/CstleTown",
@@ -124,11 +124,11 @@
 			"hallBackground": "TPTHBKCS.BMP",
 			"hallSlots":
 			[
-				[ [ 10, 11, 12, 13 ], [ 7, 8, 9 ], [ 5, 22 ], [ 16 ] ],
-				[ [ 14, 15 ], [ 0, 1, 2, 3 ], [ 6, 17 ] ],
-				[ [ 21 ], [ 18, 19 ] ],
-				[ [ 30, 37 ], [ 31, 38 ], [ 32, 39 ], [ 33, 40 ] ],
-				[ [ 34, 41 ], [ 35, 42 ], [ 36, 43 ] ]
+				[ [ "villageHall", "townHall", "cityHall", "capitol" ], [ "fort", "citadel", "castle" ], [ "tavern", "special3" ], [ "blacksmith" ] ],
+				[ [ "marketplace", "resourceSilo" ], [ "mageGuild1", "mageGuild2", "mageGuild3", "mageGuild4" ], [ "shipyard", "special1" ] ],
+				[ [ "special2" ], [ "horde1", "horde1Upgr" ] ],
+				[ [ "dwellingLvl1", "dwellingUpLvl1" ], [ "dwellingLvl2", "dwellingUpLvl2" ], [ "dwellingLvl3", "dwellingUpLvl3" ], [ "dwellingLvl4", "dwellingUpLvl4" ] ],
+				[ [ "dwellingLvl5", "dwellingUpLvl5" ], [ "dwellingLvl6", "dwellingUpLvl6" ], [ "dwellingLvl7", "dwellingUpLvl7" ] ]
 			],
 			"creatures" :
 			[
@@ -148,42 +148,45 @@
 			"buildings" :
 			{
 				"mageGuild1":     { "id" : 0 },
-				"mageGuild2":     { "id" : 1,  "upgrades" : 0 },
-				"mageGuild3":     { "id" : 2,  "upgrades" : 1 },
-				"mageGuild4":     { "id" : 3,  "upgrades" : 2 },
+				"mageGuild2":     { "id" : 1,  "upgrades" : "mageGuild1" },
+				"mageGuild3":     { "id" : 2,  "upgrades" : "mageGuild2" },
+				"mageGuild4":     { "id" : 3,  "upgrades" : "mageGuild3" },
 				"tavern":         { "id" : 5 },
 				"shipyard":       { "id" : 6 },
 				"fort":           { "id" : 7 },
-				"citadel":        { "id" : 8,  "upgrades" : 7 },
-				"castle":         { "id" : 9,  "upgrades" : 8 },
+				"citadel":        { "id" : 8,  "upgrades" : "fort" },
+				"castle":         { "id" : 9,  "upgrades" : "castle" },
 				"villageHall":    { "id" : 10, "mode" : "auto" },
-				"townHall":       { "id" : 11, "upgrades" : 10, "requires" : [ 5 ] },
-				"cityHall":       { "id" : 12, "upgrades" : 11, "requires" : [ 0, 14, 16 ] },
-				"capitol":        { "id" : 13, "upgrades" : 12, "requires" : [ 9 ] },
+				"townHall":       { "id" : 11, "upgrades" : "villageHall", "requires" : [ "tavern" ] },
+				"cityHall":       { "id" : 12, "upgrades" : "townHall", "requires" : [ "allOf", [ "mageGuild1" ], [ "marketplace" ], [ "blacksmith" ] ] },
+				"capitol":        { "id" : 13, "upgrades" : "cityHall", "requires" : [ "castle" ] },
 				"marketplace":    { "id" : 14 },
-				"resourceSilo":  { "id" : 15, "requires" : [ 14 ] },
+				"resourceSilo":   { "id" : 15, "requires" : [ "marketplace" ] },
 				"blacksmith":     { "id" : 16 },
-				"special1":       { "id" : 17, "requires" : [ 6 ] },
-				"horde1":         { "id" : 18, "upgrades" : 32 },
-				"horde1Upgr":     { "id" : 19, "upgrades" : 39, "requires" : [ 18 ], "mode" : "auto" },
-				"ship":           { "id" : 20, "upgrades" : 6 },
-				"special2":       { "id" : 21, "requires" : [ 33 ] },
-				"special3":       { "id" : 22, "upgrades" : 5 },
+
+				"special1":       { "id" : 17, "requires" : [ "shipyard" ] },
+				"horde1":         { "id" : 18, "upgrades" : "dwellingLvl3" },
+				"horde1Upgr":     { "id" : 19, "upgrades" : "dwellingUpLvl3", "requires" : [ "horde1" ], "mode" : "auto" },
+				"ship":           { "id" : 20, "upgrades" : "shipyard" },
+				"special2":       { "id" : 21, "requires" : [ "dwellingLvl4" ] },
+				"special3":       { "id" : 22, "upgrades" : "tavern" },
 				"grail":          { "id" : 26, "mode" : "grail"},
-				"dwellingLvl1":   { "id" : 30, "requires" : [ 7 ] },
-				"dwellingLvl2":   { "id" : 31, "requires" : [ 30 ] },
-				"dwellingLvl3":   { "id" : 32, "requires" : [ 33 ] },
-				"dwellingLvl4":   { "id" : 33, "requires" : [ 16, 30 ] },
-				"dwellingLvl5":   { "id" : 34, "requires" : [ 0, 33 ] },
-				"dwellingLvl6":   { "id" : 35, "requires" : [ 21 ] },
-				"dwellingLvl7":   { "id" : 36, "requires" : [ 34 ] },
-				"dwellingUpLvl1": { "id" : 37, "upgrades" : 30 },
-				"dwellingUpLvl2": { "id" : 38, "upgrades" : 31 },
-				"dwellingUpLvl3": { "id" : 39, "upgrades" : 32 },
-				"dwellingUpLvl4": { "id" : 40, "upgrades" : 33 },
-				"dwellingUpLvl5": { "id" : 41, "upgrades" : 34 },
-				"dwellingUpLvl6": { "id" : 42, "upgrades" : 35 },
-				"dwellingUpLvl7": { "id" : 43, "upgrades" : 36 },
+
+				"dwellingLvl1":   { "id" : 30, "requires" : [ "fort" ] },
+				"dwellingLvl2":   { "id" : 31, "requires" : [ "dwellingLvl1" ] },
+				"dwellingLvl3":   { "id" : 32, "requires" : [ "dwellingLvl4" ] },
+				"dwellingLvl4":   { "id" : 33, "requires" : [ "allOf", [ "blacksmith" ], [ "dwellingLvl1" ] ] },
+				"dwellingLvl5":   { "id" : 34, "requires" : [ "allOf", [ "mageGuild1" ], [ "dwellingLvl4" ] ] },
+				"dwellingLvl6":   { "id" : 35, "requires" : [ "special2" ] },
+				"dwellingLvl7":   { "id" : 36, "requires" : [ "dwellingLvl5" ] },
+
+				"dwellingUpLvl1": { "id" : 37, "upgrades" : "dwellingLvl1" },
+				"dwellingUpLvl2": { "id" : 38, "upgrades" : "dwellingLvl2" },
+				"dwellingUpLvl3": { "id" : 39, "upgrades" : "dwellingLvl3" },
+				"dwellingUpLvl4": { "id" : 40, "upgrades" : "dwellingLvl4" },
+				"dwellingUpLvl5": { "id" : 41, "upgrades" : "dwellingLvl5" },
+				"dwellingUpLvl6": { "id" : 42, "upgrades" : "dwellingLvl6" },
+				"dwellingUpLvl7": { "id" : 43, "upgrades" : "dwellingLvl7" },
 
 				"horde2" : null,
 				"horde2Upgr" : null,

+ 80 - 77
config/factions/conflux.json

@@ -77,46 +77,46 @@
 			{
 				"extraAnimation2":{ "animation" : "TBELEXT5.def", "x" : 682, "y" : 183,  "z" : -1 },
 				"extraAnimation": { "animation" : "TBELEXT1.def", "x" : 23,  "y" : 218 },
-				"mageGuild1":     { "id" : 0,  "animation" : "TBELMAGE.def", "x" : 206, "y" : 58,  "z" : 4,  "border" : "TOELMAGE.bmp", "area" : "TZELMAGE.bmp" },
-				"mageGuild2":     { "id" : 1,  "animation" : "TBELMAG2.def", "x" : 206, "y" : 58,  "z" : 4,  "border" : "TOELMAG2.bmp", "area" : "TZELMAG2.bmp" },
-				"mageGuild3":     { "id" : 2,  "animation" : "TBELMAG3.def", "x" : 206, "y" : 58,  "z" : 4,  "border" : "TOELMAG3.bmp", "area" : "TZELMAG3.bmp" },
-				"mageGuild4":     { "id" : 3,  "animation" : "TBELMAG4.def", "x" : 206, "y" : 58,  "z" : 4,  "border" : "TOELMAG4.bmp", "area" : "TZELMAG4.bmp" },
-				"mageGuild5":     { "id" : 4,  "animation" : "TBELMAG5.def", "x" : 206, "y" : 58,  "z" : 4,  "border" : "TOELMAG5.bmp", "area" : "TZELMAG5.bmp" },
-				"tavern":         { "id" : 5,  "animation" : "TBELTVRN.def", "x" : 553, "y" : 203, "z" : 1,  "border" : "TOELTVRN.bmp", "area" : "TZELTVRN.bmp" },
-				"shipyard":       { "id" : 6,  "animation" : "TBELDOCK.def", "x" : 239, "y" : 215, "z" : 2,  "border" : "TOELDOCK.bmp", "area" : "TZELDOCK.bmp" },
-				"fort":           { "id" : 7,  "animation" : "TBELCSTL.def", "x" : 349, "y" : 101, "z" : -1, "border" : "TOELCSTL.bmp", "area" : "TZELCSTL.bmp" },
-				"citadel":        { "id" : 8,  "animation" : "TBELCAS2.def", "x" : 349, "y" : 101, "z" : -1, "border" : "TOELCAS2.bmp", "area" : "TZELCAS2.bmp" },
-				"castle":         { "id" : 9,  "animation" : "TBELCAS3.def", "x" : 349, "y" : 101, "z" : -1, "border" : "TOELCAS3.bmp", "area" : "TZELCAS3.bmp" },
-				"villageHall":    { "id" : 10, "animation" : "TBELHALL.def", "x" : -1,  "y" : 164, "z" : 5,  "border" : "TOELHALL.bmp", "area" : "TZELHALL.bmp" },
-				"townHall":       { "id" : 11, "animation" : "TBELHAL2.def", "x" : 0,   "y" : 165, "z" : 5,  "border" : "TOELHAL2.bmp", "area" : "TZELHAL2.bmp" },
-				"cityHall":       { "id" : 12, "animation" : "TBELHAL3.def", "x" : 0,   "y" : 165, "z" : 5,  "border" : "TOELHAL3.bmp", "area" : "TZELHAL3.bmp" },
-				"capitol":        { "id" : 13, "animation" : "TBELHAL4.def", "x" : 0,   "y" : 164, "z" : 5,  "border" : "TOELHAL4.bmp", "area" : "TZELHAL4.bmp" },
-				"marketplace":    { "id" : 14, "animation" : "TBELMARK.def", "x" : 347, "y" : 216, "z" : 4,  "border" : "TOELMARK.bmp", "area" : "TZELMARK.bmp" },
-				"resourceSilo":  { "id" : 15, "animation" : "TBELSILO.def", "x" : 372, "y" : 171, "z" : 2,  "border" : "TOELSILO.bmp", "area" : "TZELSILO.bmp" },
-				"blacksmith":     { "id" : 16, "animation" : "TBELBLAK.def", "x" : 449, "y" : 151, "z" : 1,  "border" : "TOELBLAK.bmp", "area" : "TZELBLAK.bmp" },
-				"special1":       { "id" : 17, "animation" : "TBELSPEC.def", "x" : 284, "y" : 246, "z" : 4,  "border" : "TOELSPEC.bmp", "area" : "TZELSPEC.bmp" },
-				"horde1":         { "id" : 18, "animation" : "TBELHRD1.def", "x" : 689, "y" : 250, "border" : "TOELHRD1.bmp", "area" : "TZELHRD1.bmp", "hidden" : true },
-				"horde1Upgr":     { "id" : 19, "animation" : "TBELHRD2.def", "x" : 689, "y" : 250, "border" : "TOELHRD2.bmp", "area" : "TZELHRD2.bmp", "hidden" : true, "builds" : 18 },
-				"ship":           { "id" : 20, "animation" : "TBELBOAT.def", "x" : 239, "y" : 215, "z" : 2,  "border" : "TOELBOAT.bmp", "area" : "TZELBOAT.bmp", "hidden" : true },
-				"special2":       { "id" : 21, "animation" : "TBELEXT6.def", "x" : 104, "y" : 170, "z" : 3,  "border" : "TOELEXT6.bmp", "area" : "TZELEXT6.bmp" },
-				"grail":          { "id" : 26, "animation" : "TBELHOLY.def", "x" : 307, "y" : 2,   "border" : "TOELHOLY.bmp", "area" : "TZELHOLY.bmp" },
-				"extraTownHall":  { "id" : 27, "animation" : "TBELEXT2.def", "x" : 232, "y" : 205 },
-				"extraCityHall":  { "id" : 28, "animation" : "TBELEXT3.def", "x" : 516, "y" : 223, "z" : 1 },
-				"extraCapitol":   { "id" : 29, "animation" : "TBELEXT4.def", "x" : 0,   "y" : 252, "z" : 6 },
-				"dwellingLvl1":   { "id" : 30, "animation" : "TBELDW_0.def", "x" : 689, "y" : 250, "border" : "TOELDW_0.bmp", "area" : "TZELDW_0.bmp" },
-				"dwellingLvl2":   { "id" : 31, "animation" : "TBELDW_1.def", "x" : 630, "y" : 50,  "border" : "TOELDW_1.bmp", "area" : "TZELDW_1.bmp" },
-				"dwellingLvl3":   { "id" : 32, "animation" : "TBELDW_2.def", "x" : 709, "y" : 210, "z" : -1, "border" : "TOELDW_2.bmp", "area" : "TZELDW_2.bmp" },
-				"dwellingLvl4":   { "id" : 33, "animation" : "TBELDW_3.def", "x" : 108, "y" : 131, "z" : -1, "border" : "TOELDW_3.bmp", "area" : "TZELDW_3.bmp" },
-				"dwellingLvl5":   { "id" : 34, "animation" : "TBELDW_4.def", "x" : 264, "y" : 168, "z" : -1, "border" : "TOELDW_4.bmp", "area" : "TZELDW_4.bmp" },
-				"dwellingLvl6":   { "id" : 35, "animation" : "TBELDW_5.def", "x" : 394, "y" : 283, "z" : 2,  "border" : "TOELDW_5.bmp", "area" : "TZELDW_5.bmp" },
-				"dwellingLvl7":   { "id" : 36, "animation" : "TBELDW_6.def", "x" : 43,  "y" : 16,  "z" : -2, "border" : "TOELDW_6.bmp", "area" : "TZELDW_6.bmp" },
-				"dwellingUpLvl1": { "id" : 37, "animation" : "TBELUP_0.def", "x" : 689, "y" : 250, "border" : "TOELUP_0.bmp", "area" : "TZELUP_0.bmp" },
-				"dwellingUpLvl2": { "id" : 38, "animation" : "TBELUP_1.def", "x" : 630, "y" : 50,  "border" : "TOELUP_1.bmp", "area" : "TZELUP_1.bmp" },
-				"dwellingUpLvl3": { "id" : 39, "animation" : "TBELUP_2.def", "x" : 709, "y" : 210, "z" : -1, "border" : "TOELUP_2.bmp", "area" : "TZELUP_2.bmp" },
-				"dwellingUpLvl4": { "id" : 40, "animation" : "TBELUP_3.def", "x" : 108, "y" : 131, "z" : -1, "border" : "TOELUP_3.bmp", "area" : "TZELUP_3.bmp" },
-				"dwellingUpLvl5": { "id" : 41, "animation" : "TBELUP_4.def", "x" : 264, "y" : 168, "z" : -1, "border" : "TOELUP_4.bmp", "area" : "TZELUP_4.bmp" },
-				"dwellingUpLvl6": { "id" : 42, "animation" : "TBELUP_5.def", "x" : 394, "y" : 283, "z" : 2,  "border" : "TOELUP_5.bmp", "area" : "TZELUP_5.bmp" },
-				"dwellingUpLvl7": { "id" : 43, "animation" : "TBELUP_6.def", "x" : 43,  "y" : 0,   "z" : -2, "border" : "TOELUP_6.bmp", "area" : "TZELUP_6.bmp" }
+				"mageGuild1":     { "animation" : "TBELMAGE.def", "x" : 206, "y" : 58,  "z" : 4,  "border" : "TOELMAGE.bmp", "area" : "TZELMAGE.bmp" },
+				"mageGuild2":     { "animation" : "TBELMAG2.def", "x" : 206, "y" : 58,  "z" : 4,  "border" : "TOELMAG2.bmp", "area" : "TZELMAG2.bmp" },
+				"mageGuild3":     { "animation" : "TBELMAG3.def", "x" : 206, "y" : 58,  "z" : 4,  "border" : "TOELMAG3.bmp", "area" : "TZELMAG3.bmp" },
+				"mageGuild4":     { "animation" : "TBELMAG4.def", "x" : 206, "y" : 58,  "z" : 4,  "border" : "TOELMAG4.bmp", "area" : "TZELMAG4.bmp" },
+				"mageGuild5":     { "animation" : "TBELMAG5.def", "x" : 206, "y" : 58,  "z" : 4,  "border" : "TOELMAG5.bmp", "area" : "TZELMAG5.bmp" },
+				"tavern":         { "animation" : "TBELTVRN.def", "x" : 553, "y" : 203, "z" : 1,  "border" : "TOELTVRN.bmp", "area" : "TZELTVRN.bmp" },
+				"shipyard":       { "animation" : "TBELDOCK.def", "x" : 239, "y" : 215, "z" : 2,  "border" : "TOELDOCK.bmp", "area" : "TZELDOCK.bmp" },
+				"fort":           { "animation" : "TBELCSTL.def", "x" : 349, "y" : 101, "z" : -1, "border" : "TOELCSTL.bmp", "area" : "TZELCSTL.bmp" },
+				"citadel":        { "animation" : "TBELCAS2.def", "x" : 349, "y" : 101, "z" : -1, "border" : "TOELCAS2.bmp", "area" : "TZELCAS2.bmp" },
+				"castle":         { "animation" : "TBELCAS3.def", "x" : 349, "y" : 101, "z" : -1, "border" : "TOELCAS3.bmp", "area" : "TZELCAS3.bmp" },
+				"villageHall":    { "animation" : "TBELHALL.def", "x" : -1,  "y" : 164, "z" : 5,  "border" : "TOELHALL.bmp", "area" : "TZELHALL.bmp" },
+				"townHall":       { "animation" : "TBELHAL2.def", "x" : 0,   "y" : 165, "z" : 5,  "border" : "TOELHAL2.bmp", "area" : "TZELHAL2.bmp" },
+				"cityHall":       { "animation" : "TBELHAL3.def", "x" : 0,   "y" : 165, "z" : 5,  "border" : "TOELHAL3.bmp", "area" : "TZELHAL3.bmp" },
+				"capitol":        { "animation" : "TBELHAL4.def", "x" : 0,   "y" : 164, "z" : 5,  "border" : "TOELHAL4.bmp", "area" : "TZELHAL4.bmp" },
+				"marketplace":    { "animation" : "TBELMARK.def", "x" : 347, "y" : 216, "z" : 4,  "border" : "TOELMARK.bmp", "area" : "TZELMARK.bmp" },
+				"resourceSilo":   { "animation" : "TBELSILO.def", "x" : 372, "y" : 171, "z" : 2,  "border" : "TOELSILO.bmp", "area" : "TZELSILO.bmp" },
+				"blacksmith":     { "animation" : "TBELBLAK.def", "x" : 449, "y" : 151, "z" : 1,  "border" : "TOELBLAK.bmp", "area" : "TZELBLAK.bmp" },
+				"special1":       { "animation" : "TBELSPEC.def", "x" : 284, "y" : 246, "z" : 4,  "border" : "TOELSPEC.bmp", "area" : "TZELSPEC.bmp" },
+				"horde1":         { "animation" : "TBELHRD1.def", "x" : 689, "y" : 250, "border" : "TOELHRD1.bmp", "area" : "TZELHRD1.bmp", "hidden" : true },
+				"horde1Upgr":     { "animation" : "TBELHRD2.def", "x" : 689, "y" : 250, "border" : "TOELHRD2.bmp", "area" : "TZELHRD2.bmp", "hidden" : true, "builds" : "horde1" },
+				"ship":           { "animation" : "TBELBOAT.def", "x" : 239, "y" : 215, "z" : 2,  "border" : "TOELBOAT.bmp", "area" : "TZELBOAT.bmp", "hidden" : true },
+				"special2":       { "animation" : "TBELEXT6.def", "x" : 104, "y" : 170, "z" : 3,  "border" : "TOELEXT6.bmp", "area" : "TZELEXT6.bmp" },
+				"grail":          { "animation" : "TBELHOLY.def", "x" : 307, "y" : 2,   "border" : "TOELHOLY.bmp", "area" : "TZELHOLY.bmp" },
+				"extraTownHall":  { "animation" : "TBELEXT2.def", "x" : 232, "y" : 205 },
+				"extraCityHall":  { "animation" : "TBELEXT3.def", "x" : 516, "y" : 223, "z" : 1 },
+				"extraCapitol":   { "animation" : "TBELEXT4.def", "x" : 0,   "y" : 252, "z" : 6 },
+				"dwellingLvl1":   { "animation" : "TBELDW_0.def", "x" : 689, "y" : 250, "border" : "TOELDW_0.bmp", "area" : "TZELDW_0.bmp" },
+				"dwellingLvl2":   { "animation" : "TBELDW_1.def", "x" : 630, "y" : 50,  "border" : "TOELDW_1.bmp", "area" : "TZELDW_1.bmp" },
+				"dwellingLvl3":   { "animation" : "TBELDW_2.def", "x" : 709, "y" : 210, "z" : -1, "border" : "TOELDW_2.bmp", "area" : "TZELDW_2.bmp" },
+				"dwellingLvl4":   { "animation" : "TBELDW_3.def", "x" : 108, "y" : 131, "z" : -1, "border" : "TOELDW_3.bmp", "area" : "TZELDW_3.bmp" },
+				"dwellingLvl5":   { "animation" : "TBELDW_4.def", "x" : 264, "y" : 168, "z" : -1, "border" : "TOELDW_4.bmp", "area" : "TZELDW_4.bmp" },
+				"dwellingLvl6":   { "animation" : "TBELDW_5.def", "x" : 394, "y" : 283, "z" : 2,  "border" : "TOELDW_5.bmp", "area" : "TZELDW_5.bmp" },
+				"dwellingLvl7":   { "animation" : "TBELDW_6.def", "x" : 43,  "y" : 16,  "z" : -2, "border" : "TOELDW_6.bmp", "area" : "TZELDW_6.bmp" },
+				"dwellingUpLvl1": { "animation" : "TBELUP_0.def", "x" : 689, "y" : 250, "border" : "TOELUP_0.bmp", "area" : "TZELUP_0.bmp" },
+				"dwellingUpLvl2": { "animation" : "TBELUP_1.def", "x" : 630, "y" : 50,  "border" : "TOELUP_1.bmp", "area" : "TZELUP_1.bmp" },
+				"dwellingUpLvl3": { "animation" : "TBELUP_2.def", "x" : 709, "y" : 210, "z" : -1, "border" : "TOELUP_2.bmp", "area" : "TZELUP_2.bmp" },
+				"dwellingUpLvl4": { "animation" : "TBELUP_3.def", "x" : 108, "y" : 131, "z" : -1, "border" : "TOELUP_3.bmp", "area" : "TZELUP_3.bmp" },
+				"dwellingUpLvl5": { "animation" : "TBELUP_4.def", "x" : 264, "y" : 168, "z" : -1, "border" : "TOELUP_4.bmp", "area" : "TZELUP_4.bmp" },
+				"dwellingUpLvl6": { "animation" : "TBELUP_5.def", "x" : 394, "y" : 283, "z" : 2,  "border" : "TOELUP_5.bmp", "area" : "TZELUP_5.bmp" },
+				"dwellingUpLvl7": { "animation" : "TBELUP_6.def", "x" : 43,  "y" : 0,   "z" : -2, "border" : "TOELUP_6.bmp", "area" : "TZELUP_6.bmp" }
 			},
 
 			"musicTheme" : "music/ElemTown",
@@ -128,11 +128,11 @@
 			"hallBackground": "TPTHBKFR.BMP",
 			"hallSlots":
 			[
-				[ [ 10, 11, 12, 13 ], [ 7, 8, 9 ], [ 5 ], [ 16 ] ],
-				[ [ 14, 15 ], [ 0, 1, 2, 3, 4 ], [ 6 ] ],
-				[ [ 21 ], [ 17 ], [ 18, 19 ] ],
-				[ [ 30, 37 ], [ 31, 38 ], [ 32, 39 ], [ 33, 40 ] ],
-				[ [ 34, 41 ], [ 35, 42 ], [ 36, 43 ] ]
+				[ [ "villageHall", "townHall", "cityHall", "capitol" ], [ "fort", "citadel", "castle" ], [ "tavern" ], [ "blacksmith" ] ],
+				[ [ "marketplace", "resourceSilo" ], [ "mageGuild1", "mageGuild2", "mageGuild3", "mageGuild4", "mageGuild5" ], [ "shipyard" ] ],
+				[ [ "special2" ], [ "special1" ], [ "horde1", "horde1Upgr" ] ],
+				[ [ "dwellingLvl1", "dwellingUpLvl1" ], [ "dwellingLvl2", "dwellingUpLvl2" ], [ "dwellingLvl3", "dwellingUpLvl3" ], [ "dwellingLvl4", "dwellingUpLvl4" ] ],
+				[ [ "dwellingLvl5", "dwellingUpLvl5" ], [ "dwellingLvl6", "dwellingUpLvl6" ], [ "dwellingLvl7", "dwellingUpLvl7" ] ]
 			],
 			"creatures" :
 			[
@@ -153,45 +153,48 @@
 			"buildings" :
 			{
 				"mageGuild1":     { "id" : 0 },
-				"mageGuild2":     { "id" : 1,  "upgrades" : 0 },
-				"mageGuild3":     { "id" : 2,  "upgrades" : 1 },
-				"mageGuild4":     { "id" : 3,  "upgrades" : 2 },
-				"mageGuild5":     { "id" : 4,  "upgrades" : 3 },
+				"mageGuild2":     { "id" : 1,  "upgrades" : "mageGuild1" },
+				"mageGuild3":     { "id" : 2,  "upgrades" : "mageGuild2" },
+				"mageGuild4":     { "id" : 3,  "upgrades" : "mageGuild3" },
+				"mageGuild5":     { "id" : 4,  "upgrades" : "mageGuild4" },
 				"tavern":         { "id" : 5 },
 				"shipyard":       { "id" : 6 },
 				"fort":           { "id" : 7 },
-				"citadel":        { "id" : 8,  "upgrades" : 7 },
-				"castle":         { "id" : 9,  "upgrades" : 8 },
+				"citadel":        { "id" : 8,  "upgrades" : "fort" },
+				"castle":         { "id" : 9,  "upgrades" : "castle" },
 				"villageHall":    { "id" : 10, "mode" : "auto" },
-				"townHall":       { "id" : 11, "upgrades" : 10, "requires" : [ 5 ] },
-				"cityHall":       { "id" : 12, "upgrades" : 11, "requires" : [ 0, 14, 16 ] },
-				"capitol":        { "id" : 13, "upgrades" : 12, "requires" : [ 9 ] },
+				"townHall":       { "id" : 11, "upgrades" : "villageHall", "requires" : [ "tavern" ] },
+				"cityHall":       { "id" : 12, "upgrades" : "townHall", "requires" : [ "allOf", [ "mageGuild1" ], [ "marketplace" ], [ "blacksmith" ] ] },
+				"capitol":        { "id" : 13, "upgrades" : "cityHall", "requires" : [ "castle" ] },
 				"marketplace":    { "id" : 14 },
-				"resourceSilo":  { "id" : 15, "requires" : [ 14 ] },
+				"resourceSilo":   { "id" : 15, "requires" : [ "marketplace" ] },
 				"blacksmith":     { "id" : 16 },
-				"special1":       { "id" : 17, "requires" : [ 14 ] },
-				"horde1":         { "id" : 18, "upgrades" : 30 },
-				"horde1Upgr":     { "id" : 19, "upgrades" : 37, "requires" : [ 18 ], "mode" : "auto" },
-				"ship":           { "id" : 20, "upgrades" : 6 },
-				"special2":       { "id" : 21, "requires" : [ 0 ] },
+
+				"special1":       { "id" : 17, "requires" : [ "marketplace" ] },
+				"horde1":         { "id" : 18, "upgrades" : "dwellingLvl1" },
+				"horde1Upgr":     { "id" : 19, "upgrades" : "dwellingUpLvl1", "requires" : [ "horde1" ], "mode" : "auto" },
+				"ship":           { "id" : 20, "upgrades" : "shipyard" },
+				"special2":       { "id" : 21, "requires" : [ "mageGuild1" ] },
 				"grail":          { "id" : 26, "mode" : "grail"},
-				"extraTownHall":  { "id" : 27, "requires" : [ 11 ], "mode" : "auto" },
-				"extraCityHall":  { "id" : 28, "requires" : [ 12 ], "mode" : "auto" },
-				"extraCapitol":   { "id" : 29, "requires" : [ 13 ], "mode" : "auto" },
-				"dwellingLvl1":   { "id" : 30, "requires" : [ 7 ] },
-				"dwellingLvl2":   { "id" : 31, "requires" : [ 30, 0 ] },
-				"dwellingLvl3":   { "id" : 32, "requires" : [ 30, 0 ] },
-				"dwellingLvl4":   { "id" : 33, "requires" : [ 31 ] },
-				"dwellingLvl5":   { "id" : 34, "requires" : [ 32 ] },
-				"dwellingLvl6":   { "id" : 35, "requires" : [ 33, 34 ] },
-				"dwellingLvl7":   { "id" : 36, "requires" : [ 35 ] },
-				"dwellingUpLvl1": { "id" : 37, "upgrades" : 30 },
-				"dwellingUpLvl2": { "id" : 38, "upgrades" : 31 },
-				"dwellingUpLvl3": { "id" : 39, "upgrades" : 32 },
-				"dwellingUpLvl4": { "id" : 40, "upgrades" : 33, "requires" : [ 31 ] },
-				"dwellingUpLvl5": { "id" : 41, "upgrades" : 34 },
-				"dwellingUpLvl6": { "id" : 42, "upgrades" : 35, "requires" : [ 1 ] },
-				"dwellingUpLvl7": { "id" : 43, "upgrades" : 36 },
+				"extraTownHall":  { "id" : 27, "requires" : [ "townHall" ], "mode" : "auto" },
+				"extraCityHall":  { "id" : 28, "requires" : [ "cityHall" ], "mode" : "auto" },
+				"extraCapitol":   { "id" : 29, "requires" : [ "capitol" ], "mode" : "auto" },
+
+				"dwellingLvl1":   { "id" : 30, "requires" : [ "fort" ] },
+				"dwellingLvl2":   { "id" : 31, "requires" : [ "allOf", [ "dwellingLvl1" ], [ "mageGuild1" ] ] },
+				"dwellingLvl3":   { "id" : 32, "requires" : [ "allOf", [ "dwellingLvl1" ], [ "mageGuild1" ] ] },
+				"dwellingLvl4":   { "id" : 33, "requires" : [ "dwellingLvl2" ] },
+				"dwellingLvl5":   { "id" : 34, "requires" : [ "dwellingLvl3" ] },
+				"dwellingLvl6":   { "id" : 35, "requires" : [ "allOf", [ "dwellingLvl4" ], [ "dwellingLvl5" ] ] },
+				"dwellingLvl7":   { "id" : 36, "requires" : [ "dwellingLvl6" ] },
+
+				"dwellingUpLvl1": { "id" : 37, "upgrades" : "dwellingLvl1" },
+				"dwellingUpLvl2": { "id" : 38, "upgrades" : "dwellingLvl2" },
+				"dwellingUpLvl3": { "id" : 39, "upgrades" : "dwellingLvl3" },
+				"dwellingUpLvl4": { "id" : 40, "upgrades" : "dwellingLvl4", "requires" : [ "dwellingLvl2" ] },
+				"dwellingUpLvl5": { "id" : 41, "upgrades" : "dwellingLvl5" },
+				"dwellingUpLvl6": { "id" : 42, "upgrades" : "dwellingLvl6", "requires" : [ "mageGuild2" ] },
+				"dwellingUpLvl7": { "id" : 43, "upgrades" : "dwellingLvl7" },
 
 				"horde2" : null,
 				"horde2Upgr" : null,

+ 73 - 70
config/factions/dungeon.json

@@ -75,43 +75,43 @@
 			},
 			"structures" :
 			{
-				"mageGuild1":     { "id" : 0,  "animation" : "TBDNMAGE.def", "x" : 164, "y" : 119, "z" : -1, "border" : "TODMAG1.bmp",  "area" : "TZDMAG1.bmp" },
-				"mageGuild2":     { "id" : 1,  "animation" : "TBDNMAG2.def", "x" : 164, "y" : 97,  "z" : -1, "border" : "TODMAG2.bmp",  "area" : "TZDMAG2.bmp" },
-				"mageGuild3":     { "id" : 2,  "animation" : "TBDNMAG3.def", "x" : 164, "y" : 77,  "z" : -1, "border" : "TODMAG3.bmp",  "area" : "TZDMAG3.bmp" },
-				"mageGuild4":     { "id" : 3,  "animation" : "TBDNMAG4.def", "x" : 164, "y" : 61,  "z" : -1, "border" : "TODMAG4.bmp",  "area" : "TZDMAG4.bmp" },
-				"mageGuild5":     { "id" : 4,  "animation" : "TBDNMAG5.def", "x" : 164, "y" : 15,  "z" : -1, "border" : "TODMAG5.bmp",  "area" : "TZDMAG5.bmp" },
-				"tavern":         { "id" : 5,  "animation" : "TBDNTVRN.def", "x" : 211, "y" : 297, "border" : "TODTAV.bmp",   "area" : "TZDTAV.bmp" },
-				"fort":           { "id" : 7,  "animation" : "TBDNCSTL.def", "x" : 363, "y" : 87,  "z" : 2,  "border" : "TODCAS1.bmp",  "area" : "TZDCAS1.bmp" },
-				"citadel":        { "id" : 8,  "animation" : "TBDNCAS2.def", "x" : 363, "y" : 87,  "z" : 2,  "border" : "TODCAS2.bmp",  "area" : "TZDCAS2.bmp" },
-				"castle":         { "id" : 9,  "animation" : "TBDNCAS3.def", "x" : 363, "y" : 87,  "z" : 2,  "border" : "TODCAS3.bmp",  "area" : "TZDCAS3.bmp" },
-				"villageHall":    { "id" : 10, "animation" : "TBDNHALL.def", "x" : 0,   "y" : 234, "border" : "TODHALL1.bmp", "area" : "TZDHALL1.bmp" },
-				"townHall":       { "id" : 11, "animation" : "TBDNHAL2.def", "x" : 0,   "y" : 223, "border" : "TODHALL2.bmp", "area" : "TZDHALL2.bmp" },
-				"cityHall":       { "id" : 12, "animation" : "TBDNHAL3.def", "x" : 0,   "y" : 223, "border" : "TODHALL3.bmp", "area" : "TZDHALL3.bmp" },
-				"capitol":        { "id" : 13, "animation" : "TBDNHAL4.def", "x" : 0,   "y" : 203, "z" : -1, "border" : "TODHALL4.bmp", "area" : "TZDHALL4.bmp" },
-				"marketplace":    { "id" : 14, "animation" : "TBDNMARK.def", "x" : 590, "y" : 318, "z" : -2, "border" : "TODMARK.bmp",  "area" : "TZDMARK.bmp" },
-				"resourceSilo":  { "id" : 15, "animation" : "TBDNSILO.def", "x" : 624, "y" : 335, "z" : 1,  "border" : "TODSILO.bmp",  "area" : "TZDSILO.bmp" },
-				"blacksmith":     { "id" : 16, "animation" : "TBDNBLAK.def", "x" : 544, "y" : 248, "z" : -3, "border" : "TODSMITH.bmp", "area" : "TZDSMITH.bmp" },
-				"special1":       { "id" : 17, "animation" : "TBDNSPEC.def", "x" : 746, "y" : 294, "z" : 1,  "border" : "TODART.bmp",   "area" : "TZDART.bmp" },
-				"horde1":         { "id" : 18, "animation" : "TBDNHRD1.def", "x" : 0,   "y" : 326, "z" : 2,  "border" : "TODTR1HA.bmp", "area" : "TZDTR1HA.bmp", "hidden" : true },
-				"horde1Upgr":     { "id" : 19, "animation" : "TBDNHRD2.def", "x" : 0,   "y" : 300, "z" : 2,  "border" : "TODTR2HA.bmp", "area" : "TZDTR2HA.bmp", "hidden" : true, "builds" : 18 },
-				"special2":       { "id" : 21, "animation" : "TBDNEXT0.def", "x" : 131, "y" : 26 , "border" : "TODVOR1A.bmp", "area" : "TZDVOR1A.bmp" },
-				"special3":       { "id" : 22, "animation" : "TBDNEXT1.def", "x" : 687, "y" : 177, "border" : "TODPORTA.bmp", "area" : "TZDPORTA.bmp" },
-				"special4":       { "id" : 23, "animation" : "TBDNEXT2.def", "x" : 313, "y" : 298, "border" : "TODACAD.bmp",  "area" : "TZDACAD.bmp" },
-				"grail":          { "id" : 26, "animation" : "TBDNHOLY.def", "x" : 562, "y" : 24,  "z" : 1,  "border" : "TODHOLY.bmp",  "area" : "TZDHOLY.bmp" },
-				"dwellingLvl1":   { "id" : 30, "animation" : "TBDNDW_0.def", "x" : 0,   "y" : 326, "z" : 2,  "border" : "TODTRG1A.bmp", "area" : "TZDTRG1A.bmp" },
-				"dwellingLvl2":   { "id" : 31, "animation" : "TBDNDW_1.def", "x" : 0,   "y" : 26,  "border" : "TODHAR1.bmp",  "area" : "TZDHAR1.bmp" },
-				"dwellingLvl3":   { "id" : 32, "animation" : "TBDNDW_2.def", "x" : 118, "y" : 308, "z" : 1,  "border" : "TODBEH1A.bmp", "area" : "TZDBEH1A.bmp" },
-				"dwellingLvl4":   { "id" : 33, "animation" : "TBDNDW_3.def", "x" : 300, "y" : 29,  "z" : -1, "border" : "TODMED1.bmp",  "area" : "TZDMED1.bmp" },
-				"dwellingLvl5":   { "id" : 34, "animation" : "TBDNDW_4.def", "x" : 551, "y" : 186, "z" : 1,  "border" : "TODMIN1.bmp",  "area" : "TZDMIN1.bmp" },
-				"dwellingLvl6":   { "id" : 35, "animation" : "TBDNDW_5.def", "x" : 270, "y" : 253, "z" : -1, "border" : "TODMAN1.bmp",  "area" : "TZDMAN1.bmp" },
-				"dwellingLvl7":   { "id" : 36, "animation" : "TBDNDW_6.def", "x" : 550, "y" : 0,   "z" : -1, "border" : "TODDRA1A.bmp", "area" : "TZDDRA1A.bmp" },
-				"dwellingUpLvl1": { "id" : 37, "animation" : "TBDNUP_0.def", "x" : 0,   "y" : 300, "z" : 2,  "border" : "TODTRG2A.bmp", "area" : "TZDTRG2A.bmp" },
-				"dwellingUpLvl2": { "id" : 38, "animation" : "TBDNUP_1.def", "x" : 0,   "y" : 26,  "border" : "TODHAR2.bmp",  "area" : "TZDHAR2.bmp" },
-				"dwellingUpLvl3": { "id" : 39, "animation" : "TBDNUP_2.def", "x" : 118, "y" : 256, "z" : 1,  "border" : "TODBEH2A.bmp", "area" : "TZDBEH2A.bmp" },
-				"dwellingUpLvl4": { "id" : 40, "animation" : "TBDNUP_3.def", "x" : 300, "y" : 29,  "z" : -1, "border" : "TODMED2.bmp",  "area" : "TZDMED2.bmp" },
-				"dwellingUpLvl5": { "id" : 41, "animation" : "TBDNUP_4.def", "x" : 519, "y" : 172, "z" : 1,  "border" : "TODMIN2.bmp",  "area" : "TZDMIN2.bmp" },
-				"dwellingUpLvl6": { "id" : 42, "animation" : "TBDNUP_5.def", "x" : 270, "y" : 253, "z" : -1, "border" : "TODMAN2.bmp",  "area" : "TZDMAN2.bmp" },
-				"dwellingUpLvl7": { "id" : 43, "animation" : "TBDNUP_6.def", "x" : 550, "y" : 0,   "z" : -1, "border" : "TODDRA2A.bmp", "area" : "TZDDRA2A.bmp" }
+				"mageGuild1":     { "animation" : "TBDNMAGE.def", "x" : 164, "y" : 119, "z" : -1, "border" : "TODMAG1.bmp",  "area" : "TZDMAG1.bmp" },
+				"mageGuild2":     { "animation" : "TBDNMAG2.def", "x" : 164, "y" : 97,  "z" : -1, "border" : "TODMAG2.bmp",  "area" : "TZDMAG2.bmp" },
+				"mageGuild3":     { "animation" : "TBDNMAG3.def", "x" : 164, "y" : 77,  "z" : -1, "border" : "TODMAG3.bmp",  "area" : "TZDMAG3.bmp" },
+				"mageGuild4":     { "animation" : "TBDNMAG4.def", "x" : 164, "y" : 61,  "z" : -1, "border" : "TODMAG4.bmp",  "area" : "TZDMAG4.bmp" },
+				"mageGuild5":     { "animation" : "TBDNMAG5.def", "x" : 164, "y" : 15,  "z" : -1, "border" : "TODMAG5.bmp",  "area" : "TZDMAG5.bmp" },
+				"tavern":         { "animation" : "TBDNTVRN.def", "x" : 211, "y" : 297, "border" : "TODTAV.bmp",   "area" : "TZDTAV.bmp" },
+				"fort":           { "animation" : "TBDNCSTL.def", "x" : 363, "y" : 87,  "z" : 2,  "border" : "TODCAS1.bmp",  "area" : "TZDCAS1.bmp" },
+				"citadel":        { "animation" : "TBDNCAS2.def", "x" : 363, "y" : 87,  "z" : 2,  "border" : "TODCAS2.bmp",  "area" : "TZDCAS2.bmp" },
+				"castle":         { "animation" : "TBDNCAS3.def", "x" : 363, "y" : 87,  "z" : 2,  "border" : "TODCAS3.bmp",  "area" : "TZDCAS3.bmp" },
+				"villageHall":    { "animation" : "TBDNHALL.def", "x" : 0,   "y" : 234, "border" : "TODHALL1.bmp", "area" : "TZDHALL1.bmp" },
+				"townHall":       { "animation" : "TBDNHAL2.def", "x" : 0,   "y" : 223, "border" : "TODHALL2.bmp", "area" : "TZDHALL2.bmp" },
+				"cityHall":       { "animation" : "TBDNHAL3.def", "x" : 0,   "y" : 223, "border" : "TODHALL3.bmp", "area" : "TZDHALL3.bmp" },
+				"capitol":        { "animation" : "TBDNHAL4.def", "x" : 0,   "y" : 203, "z" : -1, "border" : "TODHALL4.bmp", "area" : "TZDHALL4.bmp" },
+				"marketplace":    { "animation" : "TBDNMARK.def", "x" : 590, "y" : 318, "z" : -2, "border" : "TODMARK.bmp",  "area" : "TZDMARK.bmp" },
+				"resourceSilo":   { "animation" : "TBDNSILO.def", "x" : 624, "y" : 335, "z" : 1,  "border" : "TODSILO.bmp",  "area" : "TZDSILO.bmp" },
+				"blacksmith":     { "animation" : "TBDNBLAK.def", "x" : 544, "y" : 248, "z" : -3, "border" : "TODSMITH.bmp", "area" : "TZDSMITH.bmp" },
+				"special1":       { "animation" : "TBDNSPEC.def", "x" : 746, "y" : 294, "z" : 1,  "border" : "TODART.bmp",   "area" : "TZDART.bmp" },
+				"horde1":         { "animation" : "TBDNHRD1.def", "x" : 0,   "y" : 326, "z" : 2,  "border" : "TODTR1HA.bmp", "area" : "TZDTR1HA.bmp", "hidden" : true },
+				"horde1Upgr":     { "animation" : "TBDNHRD2.def", "x" : 0,   "y" : 300, "z" : 2,  "border" : "TODTR2HA.bmp", "area" : "TZDTR2HA.bmp", "hidden" : true, "builds" : "horde1" },
+				"special2":       { "animation" : "TBDNEXT0.def", "x" : 131, "y" : 26 , "border" : "TODVOR1A.bmp", "area" : "TZDVOR1A.bmp" },
+				"special3":       { "animation" : "TBDNEXT1.def", "x" : 687, "y" : 177, "border" : "TODPORTA.bmp", "area" : "TZDPORTA.bmp" },
+				"special4":       { "animation" : "TBDNEXT2.def", "x" : 313, "y" : 298, "border" : "TODACAD.bmp",  "area" : "TZDACAD.bmp" },
+				"grail":          { "animation" : "TBDNHOLY.def", "x" : 562, "y" : 24,  "z" : 1,  "border" : "TODHOLY.bmp",  "area" : "TZDHOLY.bmp" },
+				"dwellingLvl1":   { "animation" : "TBDNDW_0.def", "x" : 0,   "y" : 326, "z" : 2,  "border" : "TODTRG1A.bmp", "area" : "TZDTRG1A.bmp" },
+				"dwellingLvl2":   { "animation" : "TBDNDW_1.def", "x" : 0,   "y" : 26,  "border" : "TODHAR1.bmp",  "area" : "TZDHAR1.bmp" },
+				"dwellingLvl3":   { "animation" : "TBDNDW_2.def", "x" : 118, "y" : 308, "z" : 1,  "border" : "TODBEH1A.bmp", "area" : "TZDBEH1A.bmp" },
+				"dwellingLvl4":   { "animation" : "TBDNDW_3.def", "x" : 300, "y" : 29,  "z" : -1, "border" : "TODMED1.bmp",  "area" : "TZDMED1.bmp" },
+				"dwellingLvl5":   { "animation" : "TBDNDW_4.def", "x" : 551, "y" : 186, "z" : 1,  "border" : "TODMIN1.bmp",  "area" : "TZDMIN1.bmp" },
+				"dwellingLvl6":   { "animation" : "TBDNDW_5.def", "x" : 270, "y" : 253, "z" : -1, "border" : "TODMAN1.bmp",  "area" : "TZDMAN1.bmp" },
+				"dwellingLvl7":   { "animation" : "TBDNDW_6.def", "x" : 550, "y" : 0,   "z" : -1, "border" : "TODDRA1A.bmp", "area" : "TZDDRA1A.bmp" },
+				"dwellingUpLvl1": { "animation" : "TBDNUP_0.def", "x" : 0,   "y" : 300, "z" : 2,  "border" : "TODTRG2A.bmp", "area" : "TZDTRG2A.bmp" },
+				"dwellingUpLvl2": { "animation" : "TBDNUP_1.def", "x" : 0,   "y" : 26,  "border" : "TODHAR2.bmp",  "area" : "TZDHAR2.bmp" },
+				"dwellingUpLvl3": { "animation" : "TBDNUP_2.def", "x" : 118, "y" : 256, "z" : 1,  "border" : "TODBEH2A.bmp", "area" : "TZDBEH2A.bmp" },
+				"dwellingUpLvl4": { "animation" : "TBDNUP_3.def", "x" : 300, "y" : 29,  "z" : -1, "border" : "TODMED2.bmp",  "area" : "TZDMED2.bmp" },
+				"dwellingUpLvl5": { "animation" : "TBDNUP_4.def", "x" : 519, "y" : 172, "z" : 1,  "border" : "TODMIN2.bmp",  "area" : "TZDMIN2.bmp" },
+				"dwellingUpLvl6": { "animation" : "TBDNUP_5.def", "x" : 270, "y" : 253, "z" : -1, "border" : "TODMAN2.bmp",  "area" : "TZDMAN2.bmp" },
+				"dwellingUpLvl7": { "animation" : "TBDNUP_6.def", "x" : 550, "y" : 0,   "z" : -1, "border" : "TODDRA2A.bmp", "area" : "TZDDRA2A.bmp" }
 			},
 
 			"musicTheme" : "music/Dungeon",
@@ -123,11 +123,11 @@
 			"hallBackground": "TPTHBKDG.BMP",
 			"hallSlots":
 			[
-				[ [ 10, 11, 12, 13 ], [ 7, 8, 9 ], [ 5 ], [ 16 ] ],
-				[ [ 14, 15 ], [ 0, 1, 2, 3, 4 ], [ 21 ], [ 22 ] ],
-				[ [ 17 ], [ 23 ], [ 18, 19 ] ],
-				[ [ 30, 37 ], [ 31, 38 ], [ 32, 39 ], [ 33, 40 ] ],
-				[ [ 34, 41 ], [ 35, 42 ], [ 36, 43 ] ]
+				[ [ "villageHall", "townHall", "cityHall", "capitol" ], [ "fort", "citadel", "castle" ], [ "tavern" ], [ "blacksmith" ] ],
+				[ [ "marketplace", "resourceSilo" ], [ "mageGuild1", "mageGuild2", "mageGuild3", "mageGuild4", "mageGuild5" ], [ "special2" ], [ "special3" ] ],
+				[ [ "special1" ], [ "special4" ], [ "horde1", "horde1Upgr" ] ],
+				[ [ "dwellingLvl1", "dwellingUpLvl1" ], [ "dwellingLvl2", "dwellingUpLvl2" ], [ "dwellingLvl3", "dwellingUpLvl3" ], [ "dwellingLvl4", "dwellingUpLvl4" ] ],
+				[ [ "dwellingLvl5", "dwellingUpLvl5" ], [ "dwellingLvl6", "dwellingUpLvl6" ], [ "dwellingLvl7", "dwellingUpLvl7" ] ]
 			],
 			"creatures" :
 			[
@@ -148,42 +148,45 @@
 			"buildings" :
 			{
 				"mageGuild1":     { "id" : 0 },
-				"mageGuild2":     { "id" : 1,  "upgrades" : 0 },
-				"mageGuild3":     { "id" : 2,  "upgrades" : 1 },
-				"mageGuild4":     { "id" : 3,  "upgrades" : 2 },
-				"mageGuild5":     { "id" : 4,  "upgrades" : 3 },
+				"mageGuild2":     { "id" : 1,  "upgrades" : "mageGuild1" },
+				"mageGuild3":     { "id" : 2,  "upgrades" : "mageGuild2" },
+				"mageGuild4":     { "id" : 3,  "upgrades" : "mageGuild3" },
+				"mageGuild5":     { "id" : 4,  "upgrades" : "mageGuild4" },
 				"tavern":         { "id" : 5 },
 				"fort":           { "id" : 7 },
-				"citadel":        { "id" : 8,  "upgrades" : 7 },
-				"castle":         { "id" : 9,  "upgrades" : 8 },
+				"citadel":        { "id" : 8,  "upgrades" : "fort" },
+				"castle":         { "id" : 9,  "upgrades" : "castle" },
 				"villageHall":    { "id" : 10, "mode" : "auto" },
-				"townHall":       { "id" : 11, "upgrades" : 10, "requires" : [ 5 ] },
-				"cityHall":       { "id" : 12, "upgrades" : 11, "requires" : [ 0, 14, 16 ] },
-				"capitol":        { "id" : 13, "upgrades" : 12, "requires" : [ 9 ] },
+				"townHall":       { "id" : 11, "upgrades" : "villageHall", "requires" : [ "tavern" ] },
+				"cityHall":       { "id" : 12, "upgrades" : "townHall", "requires" : [ "allOf", [ "mageGuild1" ], [ "marketplace" ], [ "blacksmith" ] ] },
+				"capitol":        { "id" : 13, "upgrades" : "cityHall", "requires" : [ "castle" ] },
 				"marketplace":    { "id" : 14 },
-				"resourceSilo":  { "id" : 15, "requires" : [ 14 ] },
+				"resourceSilo":   { "id" : 15, "requires" : [ "marketplace" ] },
 				"blacksmith":     { "id" : 16 },
-				"special1":       { "id" : 17, "requires" : [ 14 ] },
-				"horde1":         { "id" : 18, "upgrades" : 30 },
-				"horde1Upgr":     { "id" : 19, "upgrades" : 37, "requires" : [ 18 ], "mode" : "auto" },
-				"special2":       { "id" : 21, "requires" : [ 0 ] },
+
+				"special1":       { "id" : 17, "requires" : [ "marketplace" ] },
+				"horde1":         { "id" : 18, "upgrades" : "dwellingLvl1" },
+				"horde1Upgr":     { "id" : 19, "upgrades" : "dwellingUpLvl1", "requires" : [ "horde1" ], "mode" : "auto" },
+				"special2":       { "id" : 21, "requires" : [ "mageGuild1" ] },
 				"special3":       { "id" : 22 },
 				"special4":       { "id" : 23 },
 				"grail":          { "id" : 26, "mode" : "grail"},
-				"dwellingLvl1":   { "id" : 30, "requires" : [ 7 ] },
-				"dwellingLvl2":   { "id" : 31, "requires" : [ 30 ] },
-				"dwellingLvl3":   { "id" : 32, "requires" : [ 30 ] },
-				"dwellingLvl4":   { "id" : 33, "requires" : [ 31, 32 ] },
-				"dwellingLvl5":   { "id" : 34, "requires" : [ 33 ] },
-				"dwellingLvl6":   { "id" : 35, "requires" : [ 33 ] },
-				"dwellingLvl7":   { "id" : 36, "requires" : [ 1, 34, 35 ] },
-				"dwellingUpLvl1": { "id" : 37, "upgrades" : 30 },
-				"dwellingUpLvl2": { "id" : 38, "upgrades" : 31 },
-				"dwellingUpLvl3": { "id" : 39, "upgrades" : 32 },
-				"dwellingUpLvl4": { "id" : 40, "upgrades" : 33 },
-				"dwellingUpLvl5": { "id" : 41, "upgrades" : 34 },
-				"dwellingUpLvl6": { "id" : 42, "upgrades" : 35 },
-				"dwellingUpLvl7": { "id" : 43, "upgrades" : 36, "requires" : [ 2 ] },
+
+				"dwellingLvl1":   { "id" : 30, "requires" : [ "fort" ] },
+				"dwellingLvl2":   { "id" : 31, "requires" : [ "dwellingLvl1" ] },
+				"dwellingLvl3":   { "id" : 32, "requires" : [ "dwellingLvl1" ] },
+				"dwellingLvl4":   { "id" : 33, "requires" : [ "allOf", [ "dwellingLvl2" ], [ "dwellingLvl3" ] ] },
+				"dwellingLvl5":   { "id" : 34, "requires" : [ "dwellingLvl4" ] },
+				"dwellingLvl6":   { "id" : 35, "requires" : [ "dwellingLvl4" ] },
+				"dwellingLvl7":   { "id" : 36, "requires" : [ "allOf", [ "mageGuild2" ], [ "dwellingLvl5" ], [ "dwellingLvl6" ] ] },
+
+				"dwellingUpLvl1": { "id" : 37, "upgrades" : "dwellingLvl1" },
+				"dwellingUpLvl2": { "id" : 38, "upgrades" : "dwellingLvl2" },
+				"dwellingUpLvl3": { "id" : 39, "upgrades" : "dwellingLvl3" },
+				"dwellingUpLvl4": { "id" : 40, "upgrades" : "dwellingLvl4" },
+				"dwellingUpLvl5": { "id" : 41, "upgrades" : "dwellingLvl5" },
+				"dwellingUpLvl6": { "id" : 42, "upgrades" : "dwellingLvl6" },
+				"dwellingUpLvl7": { "id" : 43, "upgrades" : "dwellingLvl7", "requires" : [ "mageGuild3" ] },
 				
 				"horde2" : null,
 				"horde2Upgr" : null,

+ 74 - 71
config/factions/fortress.json

@@ -76,43 +76,43 @@
 			"structures" :
 			{
 				"extraAnimation": { "animation" : "TBFREXT2.def", "x" : 372, "y" : 227 },
-				"mageGuild1":     { "id" : 0,  "animation" : "TBFRMAGE.def", "x" : 0,   "y" : 200, "z" : -1, "border" : "TOFMAG1A.bmp", "area" : "TZFMAG1A.bmp" },
-				"mageGuild2":     { "id" : 1,  "animation" : "TBFRMAG2.def", "x" : 0,   "y" : 177, "z" : -1, "border" : "TOFMAG2A.bmp", "area" : "TZFMAG2A.bmp" },
-				"mageGuild3":     { "id" : 2,  "animation" : "TBFRMAG3.def", "x" : 0,   "y" : 135, "z" : -1, "border" : "TOFMAG3A.bmp", "area" : "TZFMAG3A.bmp" },
-				"tavern":         { "id" : 5,  "animation" : "TBFRTVRN.def", "x" : 634, "y" : 219, "z" : 3,  "border" : "TOFTAVA.bmp",  "area" : "TZFTAVA.bmp" },
-				"shipyard":       { "id" : 6,  "animation" : "TBFRDOCK.def", "x" : 197, "y" : 294, "border" : "TOFDCK2.bmp",  "area" : "TZFDCK2.bmp" },
-				"fort":           { "id" : 7,  "animation" : "TBFRCSTL.def", "x" : 368, "y" : 118, "z" : -1, "border" : "TOFCAS1.bmp",  "area" : "TZFCAS1.bmp" },
-				"citadel":        { "id" : 8,  "animation" : "TBFRCAS2.def", "x" : 368, "y" : 98,  "z" : -1, "border" : "TOFCAS2.bmp",  "area" : "TZFCAS2.bmp" },
-				"castle":         { "id" : 9,  "animation" : "TBFRCAS3.def", "x" : 368, "y" : 55,  "z" : -1, "border" : "TOFCAS3.bmp",  "area" : "TZFCAS3.bmp" },
-				"villageHall":    { "id" : 10, "animation" : "TBFRHALL.def", "x" : 166, "y" : 128, "z" : 1,  "border" : "TOFHAL1.bmp",  "area" : "TZFHAL1.bmp" },
-				"townHall":       { "id" : 11, "animation" : "TBFRHAL2.def", "x" : 166, "y" : 97,  "z" : 1,  "border" : "TOFHAL2.bmp",  "area" : "TZFHAL2.bmp" },
-				"cityHall":       { "id" : 12, "animation" : "TBFRHAL3.def", "x" : 166, "y" : 51,  "z" : 1,  "border" : "TOFHAL3.bmp",  "area" : "TZFHAL3.bmp" },
-				"capitol":        { "id" : 13, "animation" : "TBFRHAL4.def", "x" : 166, "y" : 2,   "z" : 1,  "border" : "TOFHAL4.bmp",  "area" : "TZFHAL4.bmp" },
-				"marketplace":    { "id" : 14, "animation" : "TBFRMARK.def", "x" : 382, "y" : 219, "z" : 4,  "border" : "TOFMRKAA.bmp", "area" : "TZFMRKAA.bmp" },
-				"resourceSilo":  { "id" : 15, "animation" : "TBFRSILO.def", "x" : 448, "y" : 210, "z" : 2,  "border" : "TOFMRK2A.bmp", "area" : "TZFMRK2A.bmp" },
-				"blacksmith":     { "id" : 16, "animation" : "TBFRBLAK.def", "x" : 360, "y" : 160, "border" : "TOFAIDA.bmp",  "area" : "TZFAIDA.bmp" },
-				"special1":       { "id" : 17, "animation" : "TBFRSPEC.def", "x" : 703, "y" : 36,  "border" : "TOFCAGE.bmp",  "area" : "TZFCAGE.bmp" },
-				"horde1":         { "id" : 18, "animation" : "TBFRHRD1.def", "x" : 641, "y" : 121, "z" : 1,  "border" : "TOFGNL1H.bmp", "area" : "TZFGNL1H.bmp", "hidden" : true },
-				"horde1Upgr":     { "id" : 19, "animation" : "TBFRHRD2.def", "x" : 641, "y" : 68,  "z" : 1,  "border" : "TOFGNL2H.bmp", "area" : "TZFGNL2H.bmp", "hidden" : true, "builds" : 18 },
-				"ship":           { "id" : 20, "animation" : "TBFRBOAT.def", "x" : 197, "y" : 294, "z" : 1,  "border" : "TOFDCK1.bmp",  "area" : "TZFDCK1.bmp", "hidden" : true },
-				"special2":       { "id" : 21, "animation" : "TBFREXT0.def", "x" : 341, "y" : 174, "border" : "TOFCASD.bmp",  "area" : "TZFCASD.bmp" },
-				"special3":       { "id" : 22, "animation" : "TBFREXT1.def", "x" : 349, "y" : 79,  "z" : -2, "border" : "TOFCASA.bmp",  "area" : "TZFCASA.bmp" },
-				"grail":          { "id" : 26, "animation" : "TBFRHOLY.def", "x" : 468, "y" : 260, "z" : 5,  "border" : "TOFHLYAA.bmp", "area" : "TZFHLYAA.bmp" },
-				"extraCapitol":   { "id" : 29, "animation" : "TBFRWTRW.def", "x" : 320, "y" : 141 },
-				"dwellingLvl1":   { "id" : 30, "animation" : "TBFRDW_0.def", "x" : 641, "y" : 168, "z" : 1,  "border" : "TOFGNL1.bmp",  "area" : "TZFGNL1.bmp" },
-				"dwellingLvl2":   { "id" : 31, "animation" : "TBFRDW_1.def", "x" : 141, "y" : 178, "border" : "TOFLIZ1.bmp",  "area" : "TZFLIZ1.bmp" },
-				"dwellingLvl3":   { "id" : 32, "animation" : "TBFRDW_3.def", "x" : 192, "y" : 85,  "border" : "TOFFLY1A.bmp", "area" : "TZFFLY1A.bmp" },
-				"dwellingLvl4":   { "id" : 33, "animation" : "TBFRDW_4.def", "x" : 0,   "y" : 292, "border" : "TOFBAS1.bmp",  "area" : "TZFBAS1.bmp" },
-				"dwellingLvl5":   { "id" : 34, "animation" : "TBFRDW_2.def", "x" : 15,  "y" : 127, "z" : -2, "border" : "TOFGOR1.bmp",  "area" : "TZFGOR1.bmp" },
-				"dwellingLvl6":   { "id" : 35, "animation" : "TBFRDW_5.def", "x" : 0,   "y" : 4,   "border" : "TOFWYV1.bmp",  "area" : "TZFWYV1.bmp" },
-				"dwellingLvl7":   { "id" : 36, "animation" : "TBFRDW_6.def", "x" : 612, "y" : 291, "z" : 5,  "border" : "TOFHYD1A.bmp", "area" : "TZFHYD1A.bmp" },
-				"dwellingUpLvl1": { "id" : 37, "animation" : "TBFRUP_0.def", "x" : 641, "y" : 107, "z" : 1,  "border" : "TOFGNL2.bmp",  "area" : "TZFGNL2.bmp" },
-				"dwellingUpLvl2": { "id" : 38, "animation" : "TBFRUP_1.def", "x" : 125, "y" : 163, "border" : "TOFLIZ2.bmp",  "area" : "TZFLIZ2.bmp" },
-				"dwellingUpLvl3": { "id" : 39, "animation" : "TBFRUP_3.def", "x" : 159, "y" : 19,  "border" : "TOFFLY2A.bmp", "area" : "TZFFLY2A.bmp" },
-				"dwellingUpLvl4": { "id" : 40, "animation" : "TBFRUP_4.def", "x" : 0,   "y" : 257, "border" : "TOFBAS2.bmp",  "area" : "TZFBAS2.bmp" },
-				"dwellingUpLvl5": { "id" : 41, "animation" : "TBFRUP_2.def", "x" : 15,  "y" : 69,  "z" : -2, "border" : "TOFGOR2.bmp",  "area" : "TZFGOR2.bmp" },
-				"dwellingUpLvl6": { "id" : 42, "animation" : "TBFRUP_5.def", "x" : 0,   "y" : 4,   "border" : "TOFWYV2.bmp",  "area" : "TZFWYV2.bmp" },
-				"dwellingUpLvl7": { "id" : 43, "animation" : "TBFRUP_6.def", "x" : 587, "y" : 263, "z" : 5,  "border" : "TOFHYD2A.bmp", "area" : "TZFHYD2A.bmp" }
+				"mageGuild1":     { "animation" : "TBFRMAGE.def", "x" : 0,   "y" : 200, "z" : -1, "border" : "TOFMAG1A.bmp", "area" : "TZFMAG1A.bmp" },
+				"mageGuild2":     { "animation" : "TBFRMAG2.def", "x" : 0,   "y" : 177, "z" : -1, "border" : "TOFMAG2A.bmp", "area" : "TZFMAG2A.bmp" },
+				"mageGuild3":     { "animation" : "TBFRMAG3.def", "x" : 0,   "y" : 135, "z" : -1, "border" : "TOFMAG3A.bmp", "area" : "TZFMAG3A.bmp" },
+				"tavern":         { "animation" : "TBFRTVRN.def", "x" : 634, "y" : 219, "z" : 3,  "border" : "TOFTAVA.bmp",  "area" : "TZFTAVA.bmp" },
+				"shipyard":       { "animation" : "TBFRDOCK.def", "x" : 197, "y" : 294, "border" : "TOFDCK2.bmp",  "area" : "TZFDCK2.bmp" },
+				"fort":           { "animation" : "TBFRCSTL.def", "x" : 368, "y" : 118, "z" : -1, "border" : "TOFCAS1.bmp",  "area" : "TZFCAS1.bmp" },
+				"citadel":        { "animation" : "TBFRCAS2.def", "x" : 368, "y" : 98,  "z" : -1, "border" : "TOFCAS2.bmp",  "area" : "TZFCAS2.bmp" },
+				"castle":         { "animation" : "TBFRCAS3.def", "x" : 368, "y" : 55,  "z" : -1, "border" : "TOFCAS3.bmp",  "area" : "TZFCAS3.bmp" },
+				"villageHall":    { "animation" : "TBFRHALL.def", "x" : 166, "y" : 128, "z" : 1,  "border" : "TOFHAL1.bmp",  "area" : "TZFHAL1.bmp" },
+				"townHall":       { "animation" : "TBFRHAL2.def", "x" : 166, "y" : 97,  "z" : 1,  "border" : "TOFHAL2.bmp",  "area" : "TZFHAL2.bmp" },
+				"cityHall":       { "animation" : "TBFRHAL3.def", "x" : 166, "y" : 51,  "z" : 1,  "border" : "TOFHAL3.bmp",  "area" : "TZFHAL3.bmp" },
+				"capitol":        { "animation" : "TBFRHAL4.def", "x" : 166, "y" : 2,   "z" : 1,  "border" : "TOFHAL4.bmp",  "area" : "TZFHAL4.bmp" },
+				"marketplace":    { "animation" : "TBFRMARK.def", "x" : 382, "y" : 219, "z" : 4,  "border" : "TOFMRKAA.bmp", "area" : "TZFMRKAA.bmp" },
+				"resourceSilo":   { "animation" : "TBFRSILO.def", "x" : 448, "y" : 210, "z" : 2,  "border" : "TOFMRK2A.bmp", "area" : "TZFMRK2A.bmp" },
+				"blacksmith":     { "animation" : "TBFRBLAK.def", "x" : 360, "y" : 160, "border" : "TOFAIDA.bmp",  "area" : "TZFAIDA.bmp" },
+				"special1":       { "animation" : "TBFRSPEC.def", "x" : 703, "y" : 36,  "border" : "TOFCAGE.bmp",  "area" : "TZFCAGE.bmp" },
+				"horde1":         { "animation" : "TBFRHRD1.def", "x" : 641, "y" : 121, "z" : 1,  "border" : "TOFGNL1H.bmp", "area" : "TZFGNL1H.bmp", "hidden" : true },
+				"horde1Upgr":     { "animation" : "TBFRHRD2.def", "x" : 641, "y" : 68,  "z" : 1,  "border" : "TOFGNL2H.bmp", "area" : "TZFGNL2H.bmp", "hidden" : true, "builds" : "horde1" },
+				"ship":           { "animation" : "TBFRBOAT.def", "x" : 197, "y" : 294, "z" : 1,  "border" : "TOFDCK1.bmp",  "area" : "TZFDCK1.bmp", "hidden" : true },
+				"special2":       { "animation" : "TBFREXT0.def", "x" : 341, "y" : 174, "border" : "TOFCASD.bmp",  "area" : "TZFCASD.bmp" },
+				"special3":       { "animation" : "TBFREXT1.def", "x" : 349, "y" : 79,  "z" : -2, "border" : "TOFCASA.bmp",  "area" : "TZFCASA.bmp" },
+				"grail":          { "animation" : "TBFRHOLY.def", "x" : 468, "y" : 260, "z" : 5,  "border" : "TOFHLYAA.bmp", "area" : "TZFHLYAA.bmp" },
+				"extraCapitol":   { "animation" : "TBFRWTRW.def", "x" : 320, "y" : 141 },
+				"dwellingLvl1":   { "animation" : "TBFRDW_0.def", "x" : 641, "y" : 168, "z" : 1,  "border" : "TOFGNL1.bmp",  "area" : "TZFGNL1.bmp" },
+				"dwellingLvl2":   { "animation" : "TBFRDW_1.def", "x" : 141, "y" : 178, "border" : "TOFLIZ1.bmp",  "area" : "TZFLIZ1.bmp" },
+				"dwellingLvl3":   { "animation" : "TBFRDW_3.def", "x" : 192, "y" : 85,  "border" : "TOFFLY1A.bmp", "area" : "TZFFLY1A.bmp" },
+				"dwellingLvl4":   { "animation" : "TBFRDW_4.def", "x" : 0,   "y" : 292, "border" : "TOFBAS1.bmp",  "area" : "TZFBAS1.bmp" },
+				"dwellingLvl5":   { "animation" : "TBFRDW_2.def", "x" : 15,  "y" : 127, "z" : -2, "border" : "TOFGOR1.bmp",  "area" : "TZFGOR1.bmp" },
+				"dwellingLvl6":   { "animation" : "TBFRDW_5.def", "x" : 0,   "y" : 4,   "border" : "TOFWYV1.bmp",  "area" : "TZFWYV1.bmp" },
+				"dwellingLvl7":   { "animation" : "TBFRDW_6.def", "x" : 612, "y" : 291, "z" : 5,  "border" : "TOFHYD1A.bmp", "area" : "TZFHYD1A.bmp" },
+				"dwellingUpLvl1": { "animation" : "TBFRUP_0.def", "x" : 641, "y" : 107, "z" : 1,  "border" : "TOFGNL2.bmp",  "area" : "TZFGNL2.bmp" },
+				"dwellingUpLvl2": { "animation" : "TBFRUP_1.def", "x" : 125, "y" : 163, "border" : "TOFLIZ2.bmp",  "area" : "TZFLIZ2.bmp" },
+				"dwellingUpLvl3": { "animation" : "TBFRUP_3.def", "x" : 159, "y" : 19,  "border" : "TOFFLY2A.bmp", "area" : "TZFFLY2A.bmp" },
+				"dwellingUpLvl4": { "animation" : "TBFRUP_4.def", "x" : 0,   "y" : 257, "border" : "TOFBAS2.bmp",  "area" : "TZFBAS2.bmp" },
+				"dwellingUpLvl5": { "animation" : "TBFRUP_2.def", "x" : 15,  "y" : 69,  "z" : -2, "border" : "TOFGOR2.bmp",  "area" : "TZFGOR2.bmp" },
+				"dwellingUpLvl6": { "animation" : "TBFRUP_5.def", "x" : 0,   "y" : 4,   "border" : "TOFWYV2.bmp",  "area" : "TZFWYV2.bmp" },
+				"dwellingUpLvl7": { "animation" : "TBFRUP_6.def", "x" : 587, "y" : 263, "z" : 5,  "border" : "TOFHYD2A.bmp", "area" : "TZFHYD2A.bmp" }
 			},
 
 			"musicTheme" : "music/FortressTown",
@@ -124,11 +124,11 @@
 			"hallBackground": "TPTHBKFR.BMP",
 			"hallSlots":
 			[
-				[ [ 10, 11, 12, 13 ], [ 7, 8, 9 ], [ 5 ], [ 16 ] ],
-				[ [ 14, 15 ], [ 0, 1, 2 ], [ 6 ] ],
-				[ [ 17 ], [ 21, 22 ], [ 18, 19 ] ],
-				[ [ 30, 37 ], [ 31, 38 ], [ 32, 39 ], [ 33, 40 ] ],
-				[ [ 34, 41 ], [ 35, 42 ], [ 36, 43 ] ]
+				[ [ "villageHall", "townHall", "cityHall", "capitol" ], [ "fort", "citadel", "castle" ], [ "tavern" ], [ "blacksmith" ] ],
+				[ [ "marketplace", "resourceSilo" ], [ "mageGuild1", "mageGuild2", "mageGuild3" ], [ "shipyard" ] ],
+				[ [ "special1" ], [ "special2", "special3" ], [ "horde1", "horde1Upgr" ] ],
+				[ [ "dwellingLvl1", "dwellingUpLvl1" ], [ "dwellingLvl2", "dwellingUpLvl2" ], [ "dwellingLvl3", "dwellingUpLvl3" ], [ "dwellingLvl4", "dwellingUpLvl4" ] ],
+				[ [ "dwellingLvl5", "dwellingUpLvl5" ], [ "dwellingLvl6", "dwellingUpLvl6" ], [ "dwellingLvl7", "dwellingUpLvl7" ] ]
 			],
 			"creatures" :
 			[
@@ -148,42 +148,45 @@
 			"buildings" :
 			{
 				"mageGuild1":     { "id" : 0 },
-				"mageGuild2":     { "id" : 1,  "upgrades" : 0 },
-				"mageGuild3":     { "id" : 2,  "upgrades" : 1 },
+				"mageGuild2":     { "id" : 1,  "upgrades" : "mageGuild1" },
+				"mageGuild3":     { "id" : 2,  "upgrades" : "mageGuild2" },
 				"tavern":         { "id" : 5 },
 				"shipyard":       { "id" : 6 },
 				"fort":           { "id" : 7 },
-				"citadel":        { "id" : 8,  "upgrades" : 7 },
-				"castle":         { "id" : 9,  "upgrades" : 8 },
+				"citadel":        { "id" : 8,  "upgrades" : "fort" },
+				"castle":         { "id" : 9,  "upgrades" : "castle" },
 				"villageHall":    { "id" : 10, "mode" : "auto" },
-				"townHall":       { "id" : 11, "upgrades" : 10, "requires" : [ 5 ] },
-				"cityHall":       { "id" : 12, "upgrades" : 11, "requires" : [ 0, 14, 16 ] },
-				"capitol":        { "id" : 13, "upgrades" : 12, "requires" : [ 9 ] },
+				"townHall":       { "id" : 11, "upgrades" : "villageHall", "requires" : [ "tavern" ] },
+				"cityHall":       { "id" : 12, "upgrades" : "townHall", "requires" : [ "allOf", [ "mageGuild1" ], [ "marketplace" ], [ "blacksmith" ] ] },
+				"capitol":        { "id" : 13, "upgrades" : "cityHall", "requires" : [ "castle" ] },
 				"marketplace":    { "id" : 14 },
-				"resourceSilo":  { "id" : 15, "requires" : [ 14 ] },
+				"resourceSilo":   { "id" : 15, "requires" : [ "marketplace" ] },
 				"blacksmith":     { "id" : 16 },
-				"special1":       { "id" : 17, "requires" : [ 11, 21 ] },
-				"horde1":         { "id" : 18, "upgrades" : 30 },
-				"horde1Upgr":     { "id" : 19, "upgrades" : 37, "requires" : [ 18 ], "mode" : "auto" },
-				"ship":           { "id" : 20, "upgrades" : 6 },
-				"special2":       { "id" : 21, "requires" : [ 7 ] },
-				"special3":       { "id" : 22, "requires" : [ 21 ] },
+
+				"special1":       { "id" : 17, "requires" : [ "allOf", [ "townHall" ], [ "special2" ] ] },
+				"horde1":         { "id" : 18, "upgrades" : "dwellingLvl1" },
+				"horde1Upgr":     { "id" : 19, "upgrades" : "dwellingUpLvl1", "requires" : [ "horde1" ], "mode" : "auto" },
+				"ship":           { "id" : 20, "upgrades" : "shipyard" },
+				"special2":       { "id" : 21, "requires" : [ "fort" ] },
+				"special3":       { "id" : 22, "requires" : [ "special2" ] },
 				"grail":          { "id" : 26, "mode" : "grail"},
-				"extraCapitol":   { "id" : 29, "requires" : [ 13 ], "mode" : "auto" },
-				"dwellingLvl1":   { "id" : 30, "requires" : [ 7 ] },
-				"dwellingLvl2":   { "id" : 31, "requires" : [ 30 ] },
-				"dwellingLvl3":   { "id" : 32, "requires" : [ 30 ] },
-				"dwellingLvl4":   { "id" : 33, "requires" : [ 32 ] },
-				"dwellingLvl5":   { "id" : 34, "requires" : [ 31, 32 ] },
-				"dwellingLvl6":   { "id" : 35, "requires" : [ 31 ] },
-				"dwellingLvl7":   { "id" : 36, "requires" : [ 33, 35 ] },
-				"dwellingUpLvl1": { "id" : 37, "upgrades" : 30, "requires" : [ 5 ] },
-				"dwellingUpLvl2": { "id" : 38, "upgrades" : 31 },
-				"dwellingUpLvl3": { "id" : 39, "upgrades" : 32 },
-				"dwellingUpLvl4": { "id" : 40, "upgrades" : 33 },
-				"dwellingUpLvl5": { "id" : 41, "upgrades" : 34, "requires" : [ 15 ] },
-				"dwellingUpLvl6": { "id" : 42, "upgrades" : 35 },
-				"dwellingUpLvl7": { "id" : 43, "upgrades" : 36 },
+				"extraCapitol":   { "id" : 29, "requires" : [ "capitol" ], "mode" : "auto" },
+
+				"dwellingLvl1":   { "id" : 30, "requires" : [ "fort" ] },
+				"dwellingLvl2":   { "id" : 31, "requires" : [ "dwellingLvl1" ] },
+				"dwellingLvl3":   { "id" : 32, "requires" : [ "dwellingLvl1" ] },
+				"dwellingLvl4":   { "id" : 33, "requires" : [ "dwellingLvl3" ] },
+				"dwellingLvl5":   { "id" : 34, "requires" : [ "allOf", [ "dwellingLvl2" ], [ "dwellingLvl3" ] ] },
+				"dwellingLvl6":   { "id" : 35, "requires" : [ "dwellingLvl2" ] },
+				"dwellingLvl7":   { "id" : 36, "requires" : [ "allOf", [ "dwellingLvl4" ], [ "dwellingLvl6" ] ] },
+
+				"dwellingUpLvl1": { "id" : 37, "upgrades" : "dwellingLvl1", "requires" : [ "tavern" ] },
+				"dwellingUpLvl2": { "id" : 38, "upgrades" : "dwellingLvl2" },
+				"dwellingUpLvl3": { "id" : 39, "upgrades" : "dwellingLvl3" },
+				"dwellingUpLvl4": { "id" : 40, "upgrades" : "dwellingLvl4" },
+				"dwellingUpLvl5": { "id" : 41, "upgrades" : "dwellingLvl5", "requires" : [ "resourceSilo" ] },
+				"dwellingUpLvl6": { "id" : 42, "upgrades" : "dwellingLvl6" },
+				"dwellingUpLvl7": { "id" : 43, "upgrades" : "dwellingLvl7" },
 
 				"horde2" : null,
 				"horde2Upgr" : null,

+ 77 - 74
config/factions/inferno.json

@@ -75,44 +75,44 @@
 			},
 			"structures" :
 			{
-				"mageGuild1":     { "id" : 0,  "animation" : "TBINMAGE.def", "x" : 667, "y" : 127, "border" : "TOIMAG1A.bmp", "area" : "TZIMAG1A.bmp" },
-				"mageGuild2":     { "id" : 1,  "animation" : "TBINMAG2.def", "x" : 667, "y" : 101, "border" : "TOIMAG2A.bmp", "area" : "TZIMAG2A.bmp" },
-				"mageGuild3":     { "id" : 2,  "animation" : "TBINMAG3.def", "x" : 667, "y" : 83,  "border" : "TOIMAG3A.bmp", "area" : "TZIMAG3A.bmp" },
-				"mageGuild4":     { "id" : 3,  "animation" : "TBINMAG4.def", "x" : 667, "y" : 56,  "border" : "TOIMAG4A.bmp", "area" : "TZIMAG4A.bmp" },
-				"mageGuild5":     { "id" : 4,  "animation" : "TBINMAG5.def", "x" : 667, "y" : 35,  "border" : "TOIMAG5A.bmp", "area" : "TZIMAG5A.bmp" },
-				"tavern":         { "id" : 5,  "animation" : "TBINTVRN.def", "x" : 105, "y" : 219, "z" : 1,  "border" : "TOITAV.bmp",   "area" : "TZITAV.bmp" },
-				"fort":           { "id" : 7,  "animation" : "TBINCSTL.def", "x" : 222, "y" : 44,  "border" : "TOICAS2A.bmp", "area" : "TZICAS2A.bmp" },
-				"citadel":        { "id" : 8,  "animation" : "TBINCAS2.def", "x" : 222, "y" : 44,  "border" : "TOICAS1A.bmp", "area" : "TZICAS1A.bmp" },
-				"castle":         { "id" : 9,  "animation" : "TBINCAS3.def", "x" : 222, "y" : 18,  "border" : "TOICAS3A.bmp", "area" : "TZICAS3A.bmp" },
-				"villageHall":    { "id" : 10, "animation" : "TBINHALL.def", "x" : 0,   "y" : 174, "border" : "TOIHAL1.bmp",  "area" : "TZIHAL1.bmp"  },
-				"townHall":       { "id" : 11, "animation" : "TBINHAL2.def", "x" : 0,   "y" : 174, "border" : "TOIHAL2.bmp",  "area" : "TZIHAL2.bmp"  },
-				"cityHall":       { "id" : 12, "animation" : "TBINHAL3.def", "x" : 0,   "y" : 174, "border" : "TOIHAL3.bmp",  "area" : "TZIHAL3.bmp"  },
-				"capitol":        { "id" : 13, "animation" : "TBINHAL4.def", "x" : 0,   "y" : 131, "border" : "TOIHAL4.bmp",  "area" : "TZIHAL4.bmp"  },
-				"marketplace":    { "id" : 14, "animation" : "TBINMARK.def", "x" : 511, "y" : 301, "z" : 4,  "border" : "TOIMAR1.bmp",  "area" : "TZIMAR1.bmp" },
-				"resourceSilo":  { "id" : 15, "animation" : "TBINSILO.def", "x" : 497, "y" : 337, "z" : 5,  "border" : "TOIMAR2.bmp",  "area" : "TZIMAR2.bmp" },
-				"blacksmith":     { "id" : 16, "animation" : "TBINBLAK.def", "x" : 684, "y" : 253, "z" : 1,  "border" : "TOIBLKA.bmp",  "area" : "TZIBLKA.bmp" },
-				"horde1":         { "id" : 18, "animation" : "TBINHRD1.def", "x" : 614, "y" : 256, "border" : "TOIMP1HA.bmp", "area" : "TZIMP1HA.bmp", "hidden" : true },
-				"horde1Upgr":     { "id" : 19, "animation" : "TBINHRD2.def", "x" : 614, "y" : 221, "border" : "TOIMP2HA.bmp", "area" : "TZIMP2HA.bmp", "hidden" : true, "builds" : 18 },
-				"special2":       { "id" : 21, "animation" : "TBINEXT0.def", "x" : 297, "y" : 0,   "z" : -1, "border" : "TOICAB1A.bmp", "area" : "TZICAB1A.bmp" },
-				"special3":       { "id" : 22, "animation" : "TBINEXT1.def", "x" : 227, "y" : 174, "z" : 2,  "border" : "TOICASGA.bmp", "area" : "TZICASGA.bmp" },
-				"special4":       { "id" : 23, "animation" : "TBINEXT2.def", "x" : 593, "y" : 104, "border" : "TOIPAIN.bmp",  "area" : "TZIPAIN.bmp"  },
-				"horde2":         { "id" : 24, "animation" : "TBINHRD3.def", "x" : 10,  "y" : 301, "border" : "TOIHND1H.bmp", "area" : "TZIHND1H.bmp", "hidden" : true },
-				"horde2Upgr":     { "id" : 25, "animation" : "TBINHRD4.def", "x" : 9,   "y" : 273, "border" : "TOIHND2H.bmp", "area" : "TZIHND2H.bmp", "hidden" : true, "builds" : 24 },
-				"grail":          { "id" : 26, "animation" : "TBINHOLY.def", "x" : 24,  "y" : 10,  "z" : -1, "border" : "TOIHOLY.bmp",  "area" : "TZIHOLY.bmp" },
-				"dwellingLvl1":   { "id" : 30, "animation" : "TBINDW_0.def", "x" : 614, "y" : 256, "border" : "TOIMP1A.bmp",  "area" : "TZIMP1A.bmp"  },
-				"dwellingLvl2":   { "id" : 31, "animation" : "TBINDW_1.def", "x" : 187, "y" : 248, "z" : 4,  "border" : "TOIGOG1A.bmp", "area" : "TZIGOG1A.bmp" },
-				"dwellingLvl3":   { "id" : 32, "animation" : "TBINDW_2.def", "x" : 9,   "y" : 325, "border" : "TOIHND1.bmp",  "area" : "TZIHND1.bmp"  },
-				"dwellingLvl4":   { "id" : 33, "animation" : "TBINDW_3.def", "x" : 414, "y" : 204, "z" : 2,  "border" : "TOIDMN1.bmp",  "area" : "TZIDMN1.bmp" },
-				"dwellingLvl5":   { "id" : 34, "animation" : "TBINDW_4.def", "x" : 359, "y" : 296, "z" : 3,  "border" : "TOIPIT1.bmp",  "area" : "TZIPIT1.bmp" },
-				"dwellingLvl6":   { "id" : 35, "animation" : "TBINDW_5.def", "x" : 220, "y" : 350, "z" : 5,  "border" : "TOIEFR1.bmp",  "area" : "TZIEFR1.bmp" },
-				"dwellingLvl7":   { "id" : 36, "animation" : "TBINDW_6.def", "x" : 420, "y" : 153, "z" : -1, "border" : "TOIDVL1.bmp",  "area" : "TZIDVL1.bmp" },
-				"dwellingUpLvl1": { "id" : 37, "animation" : "TBINUP_0.def", "x" : 614, "y" : 221, "border" : "TOIMP2A.bmp",  "area" : "TZIMP2A.bmp"  },
-				"dwellingUpLvl2": { "id" : 38, "animation" : "TBINUP_1.def", "x" : 187, "y" : 212, "z" : 4,  "border" : "TOIGOG2A.bmp", "area" : "TZIGOG2A.bmp" },
-				"dwellingUpLvl3": { "id" : 39, "animation" : "TBINUP_2.def", "x" : 9,   "y" : 273, "border" : "TOIHND2.bmp",  "area" : "TZIHND2.bmp"  },
-				"dwellingUpLvl4": { "id" : 40, "animation" : "TBINUP_3.def", "x" : 412, "y" : 197, "z" : 2,  "border" : "TOIDMN2.bmp",  "area" : "TZIDMN2.bmp" },
-				"dwellingUpLvl5": { "id" : 41, "animation" : "TBINUP_4.def", "x" : 359, "y" : 244, "z" : 3,  "border" : "TOIPIT2.bmp",  "area" : "TZIPIT2.bmp" },
-				"dwellingUpLvl6": { "id" : 42, "animation" : "TBINUP_5.def", "x" : 220, "y" : 282, "z" : 5,  "border" : "TOIEFR2.bmp",  "area" : "TZIEFR2.bmp" },
-				"dwellingUpLvl7": { "id" : 43, "animation" : "TBINUP_6.def", "x" : 420, "y" : 105, "z" : -1, "border" : "TOIDVL2.bmp",  "area" : "TZIDVL2.bmp" }
+				"mageGuild1":     { "animation" : "TBINMAGE.def", "x" : 667, "y" : 127, "border" : "TOIMAG1A.bmp", "area" : "TZIMAG1A.bmp" },
+				"mageGuild2":     { "animation" : "TBINMAG2.def", "x" : 667, "y" : 101, "border" : "TOIMAG2A.bmp", "area" : "TZIMAG2A.bmp" },
+				"mageGuild3":     { "animation" : "TBINMAG3.def", "x" : 667, "y" : 83,  "border" : "TOIMAG3A.bmp", "area" : "TZIMAG3A.bmp" },
+				"mageGuild4":     { "animation" : "TBINMAG4.def", "x" : 667, "y" : 56,  "border" : "TOIMAG4A.bmp", "area" : "TZIMAG4A.bmp" },
+				"mageGuild5":     { "animation" : "TBINMAG5.def", "x" : 667, "y" : 35,  "border" : "TOIMAG5A.bmp", "area" : "TZIMAG5A.bmp" },
+				"tavern":         { "animation" : "TBINTVRN.def", "x" : 105, "y" : 219, "z" : 1,  "border" : "TOITAV.bmp",   "area" : "TZITAV.bmp" },
+				"fort":           { "animation" : "TBINCSTL.def", "x" : 222, "y" : 44,  "border" : "TOICAS2A.bmp", "area" : "TZICAS2A.bmp" },
+				"citadel":        { "animation" : "TBINCAS2.def", "x" : 222, "y" : 44,  "border" : "TOICAS1A.bmp", "area" : "TZICAS1A.bmp" },
+				"castle":         { "animation" : "TBINCAS3.def", "x" : 222, "y" : 18,  "border" : "TOICAS3A.bmp", "area" : "TZICAS3A.bmp" },
+				"villageHall":    { "animation" : "TBINHALL.def", "x" : 0,   "y" : 174, "border" : "TOIHAL1.bmp",  "area" : "TZIHAL1.bmp"  },
+				"townHall":       { "animation" : "TBINHAL2.def", "x" : 0,   "y" : 174, "border" : "TOIHAL2.bmp",  "area" : "TZIHAL2.bmp"  },
+				"cityHall":       { "animation" : "TBINHAL3.def", "x" : 0,   "y" : 174, "border" : "TOIHAL3.bmp",  "area" : "TZIHAL3.bmp"  },
+				"capitol":        { "animation" : "TBINHAL4.def", "x" : 0,   "y" : 131, "border" : "TOIHAL4.bmp",  "area" : "TZIHAL4.bmp"  },
+				"marketplace":    { "animation" : "TBINMARK.def", "x" : 511, "y" : 301, "z" : 4,  "border" : "TOIMAR1.bmp",  "area" : "TZIMAR1.bmp" },
+				"resourceSilo":   { "animation" : "TBINSILO.def", "x" : 497, "y" : 337, "z" : 5,  "border" : "TOIMAR2.bmp",  "area" : "TZIMAR2.bmp" },
+				"blacksmith":     { "animation" : "TBINBLAK.def", "x" : 684, "y" : 253, "z" : 1,  "border" : "TOIBLKA.bmp",  "area" : "TZIBLKA.bmp" },
+				"horde1":         { "animation" : "TBINHRD1.def", "x" : 614, "y" : 256, "border" : "TOIMP1HA.bmp", "area" : "TZIMP1HA.bmp", "hidden" : true },
+				"horde1Upgr":     { "animation" : "TBINHRD2.def", "x" : 614, "y" : 221, "border" : "TOIMP2HA.bmp", "area" : "TZIMP2HA.bmp", "hidden" : true, "builds" : "horde1" },
+				"special2":       { "animation" : "TBINEXT0.def", "x" : 297, "y" : 0,   "z" : -1, "border" : "TOICAB1A.bmp", "area" : "TZICAB1A.bmp" },
+				"special3":       { "animation" : "TBINEXT1.def", "x" : 227, "y" : 174, "z" : 2,  "border" : "TOICASGA.bmp", "area" : "TZICASGA.bmp" },
+				"special4":       { "animation" : "TBINEXT2.def", "x" : 593, "y" : 104, "border" : "TOIPAIN.bmp",  "area" : "TZIPAIN.bmp"  },
+				"horde2":         { "animation" : "TBINHRD3.def", "x" : 10,  "y" : 301, "border" : "TOIHND1H.bmp", "area" : "TZIHND1H.bmp", "hidden" : true },
+				"horde2Upgr":     { "animation" : "TBINHRD4.def", "x" : 9,   "y" : 273, "border" : "TOIHND2H.bmp", "area" : "TZIHND2H.bmp", "hidden" : true, "builds" : "horde2" },
+				"grail":          { "animation" : "TBINHOLY.def", "x" : 24,  "y" : 10,  "z" : -1, "border" : "TOIHOLY.bmp",  "area" : "TZIHOLY.bmp" },
+				"dwellingLvl1":   { "animation" : "TBINDW_0.def", "x" : 614, "y" : 256, "border" : "TOIMP1A.bmp",  "area" : "TZIMP1A.bmp"  },
+				"dwellingLvl2":   { "animation" : "TBINDW_1.def", "x" : 187, "y" : 248, "z" : 4,  "border" : "TOIGOG1A.bmp", "area" : "TZIGOG1A.bmp" },
+				"dwellingLvl3":   { "animation" : "TBINDW_2.def", "x" : 9,   "y" : 325, "border" : "TOIHND1.bmp",  "area" : "TZIHND1.bmp"  },
+				"dwellingLvl4":   { "animation" : "TBINDW_3.def", "x" : 414, "y" : 204, "z" : 2,  "border" : "TOIDMN1.bmp",  "area" : "TZIDMN1.bmp" },
+				"dwellingLvl5":   { "animation" : "TBINDW_4.def", "x" : 359, "y" : 296, "z" : 3,  "border" : "TOIPIT1.bmp",  "area" : "TZIPIT1.bmp" },
+				"dwellingLvl6":   { "animation" : "TBINDW_5.def", "x" : 220, "y" : 350, "z" : 5,  "border" : "TOIEFR1.bmp",  "area" : "TZIEFR1.bmp" },
+				"dwellingLvl7":   { "animation" : "TBINDW_6.def", "x" : 420, "y" : 153, "z" : -1, "border" : "TOIDVL1.bmp",  "area" : "TZIDVL1.bmp" },
+				"dwellingUpLvl1": { "animation" : "TBINUP_0.def", "x" : 614, "y" : 221, "border" : "TOIMP2A.bmp",  "area" : "TZIMP2A.bmp"  },
+				"dwellingUpLvl2": { "animation" : "TBINUP_1.def", "x" : 187, "y" : 212, "z" : 4,  "border" : "TOIGOG2A.bmp", "area" : "TZIGOG2A.bmp" },
+				"dwellingUpLvl3": { "animation" : "TBINUP_2.def", "x" : 9,   "y" : 273, "border" : "TOIHND2.bmp",  "area" : "TZIHND2.bmp"  },
+				"dwellingUpLvl4": { "animation" : "TBINUP_3.def", "x" : 412, "y" : 197, "z" : 2,  "border" : "TOIDMN2.bmp",  "area" : "TZIDMN2.bmp" },
+				"dwellingUpLvl5": { "animation" : "TBINUP_4.def", "x" : 359, "y" : 244, "z" : 3,  "border" : "TOIPIT2.bmp",  "area" : "TZIPIT2.bmp" },
+				"dwellingUpLvl6": { "animation" : "TBINUP_5.def", "x" : 220, "y" : 282, "z" : 5,  "border" : "TOIEFR2.bmp",  "area" : "TZIEFR2.bmp" },
+				"dwellingUpLvl7": { "animation" : "TBINUP_6.def", "x" : 420, "y" : 105, "z" : -1, "border" : "TOIDVL2.bmp",  "area" : "TZIDVL2.bmp" }
 			},
 
 			"musicTheme" : "music/InfernoTown",
@@ -124,11 +124,11 @@
 			"hallBackground": "TPTHBKIN.BMP",
 			"hallSlots":
 			[
-				[ [ 10, 11, 12, 13 ], [ 7, 8, 9 ], [ 5 ], [ 16 ] ],
-				[ [ 14, 15 ], [ 0, 1, 2, 3, 4 ], [ 23 ], [ 21 ] ],
-				[ [ 22 ], [ 18, 19 ], [ 24, 25 ] ],
-				[ [ 30, 37 ], [ 31, 38 ], [ 32, 39 ], [ 33, 40 ] ],
-				[ [ 34, 41 ], [ 35, 42 ], [ 36, 43 ] ]
+				[ [ "villageHall", "townHall", "cityHall", "capitol" ], [ "fort", "citadel", "castle" ], [ "tavern" ], [ "blacksmith" ] ],
+				[ [ "marketplace", "resourceSilo" ], [ "mageGuild1", "mageGuild2", "mageGuild3", "mageGuild4", "mageGuild5" ], [ "special4" ], [ "special2" ] ],
+				[ [ "special3" ], [ "horde1", "horde1Upgr" ], [ "horde2", "horde2Upgr" ] ],
+				[ [ "dwellingLvl1", "dwellingUpLvl1" ], [ "dwellingLvl2", "dwellingUpLvl2" ], [ "dwellingLvl3", "dwellingUpLvl3" ], [ "dwellingLvl4", "dwellingUpLvl4" ] ],
+				[ [ "dwellingLvl5", "dwellingUpLvl5" ], [ "dwellingLvl6", "dwellingUpLvl6" ], [ "dwellingLvl7", "dwellingUpLvl7" ] ]
 			],
 			"creatures" :
 			[
@@ -149,43 +149,46 @@
 			"buildings" :
 			{
 				"mageGuild1":     { "id" : 0 },
-				"mageGuild2":     { "id" : 1,  "upgrades" : 0 },
-				"mageGuild3":     { "id" : 2,  "upgrades" : 1 },
-				"mageGuild4":     { "id" : 3,  "upgrades" : 2 },
-				"mageGuild5":     { "id" : 4,  "upgrades" : 3 },
+				"mageGuild2":     { "id" : 1,  "upgrades" : "mageGuild1" },
+				"mageGuild3":     { "id" : 2,  "upgrades" : "mageGuild2" },
+				"mageGuild4":     { "id" : 3,  "upgrades" : "mageGuild3" },
+				"mageGuild5":     { "id" : 4,  "upgrades" : "mageGuild4" },
 				"tavern":         { "id" : 5 },
 				"fort":           { "id" : 7 },
-				"citadel":        { "id" : 8,  "upgrades" : 7 },
-				"castle":         { "id" : 9,  "upgrades" : 8 },
+				"citadel":        { "id" : 8,  "upgrades" : "fort" },
+				"castle":         { "id" : 9,  "upgrades" : "castle" },
 				"villageHall":    { "id" : 10, "mode" : "auto" },
-				"townHall":       { "id" : 11, "upgrades" : 10, "requires" : [ 5 ] },
-				"cityHall":       { "id" : 12, "upgrades" : 11, "requires" : [ 0, 14, 16 ] },
-				"capitol":        { "id" : 13, "upgrades" : 12, "requires" : [ 9 ] },
+				"townHall":       { "id" : 11, "upgrades" : "villageHall", "requires" : [ "tavern" ] },
+				"cityHall":       { "id" : 12, "upgrades" : "townHall", "requires" : [ "allOf", [ "mageGuild1" ], [ "marketplace" ], [ "blacksmith" ] ] },
+				"capitol":        { "id" : 13, "upgrades" : "cityHall", "requires" : [ "castle" ] },
 				"marketplace":    { "id" : 14 },
-				"resourceSilo":  { "id" : 15, "requires" : [ 14 ] },
+				"resourceSilo":   { "id" : 15, "requires" : [ "marketplace" ] },
 				"blacksmith":     { "id" : 16 },
-				"horde1":         { "id" : 18, "upgrades" : 30 },
-				"horde1Upgr":     { "id" : 19, "upgrades" : 37, "requires" : [ 18 ], "mode" : "auto" },
-				"special2":       { "id" : 21, "requires" : [ 7 ] },
-				"special3":       { "id" : 22, "requires" : [ 8 ] },
-				"special4":       { "id" : 23, "requires" : [ 0 ] },
-				"horde2":         { "id" : 24, "upgrades" : 32 },
-				"horde2Upgr":     { "id" : 25, "upgrades" : 39, "requires" : [ 24 ], "mode" : "auto" },
+
+				"horde1":         { "id" : 18, "upgrades" : "dwellingLvl1" },
+				"horde1Upgr":     { "id" : 19, "upgrades" : "dwellingUpLvl1", "requires" : [ "horde1" ], "mode" : "auto" },
+				"special2":       { "id" : 21, "requires" : [ "fort" ] },
+				"special3":       { "id" : 22, "requires" : [ "citadel" ] },
+				"special4":       { "id" : 23, "requires" : [ "mageGuild1" ] },
+				"horde2":         { "id" : 24, "upgrades" : "dwellingLvl3" },
+				"horde2Upgr":     { "id" : 25, "upgrades" : "dwellingUpLvl3", "requires" : [ "horde2" ], "mode" : "auto" },
 				"grail":          { "id" : 26, "mode" : "grail"},
-				"dwellingLvl1":   { "id" : 30, "requires" : [ 7 ] },
-				"dwellingLvl2":   { "id" : 31, "requires" : [ 30 ] },
-				"dwellingLvl3":   { "id" : 32, "requires" : [ 30 ] },
-				"dwellingLvl4":   { "id" : 33, "requires" : [ 31 ] },
-				"dwellingLvl5":   { "id" : 34, "requires" : [ 33 ] },
-				"dwellingLvl6":   { "id" : 35, "requires" : [ 0, 33 ] },
-				"dwellingLvl7":   { "id" : 36, "requires" : [ 34, 35 ] },
-				"dwellingUpLvl1": { "id" : 37, "upgrades" : 30 },
-				"dwellingUpLvl2": { "id" : 38, "upgrades" : 31 },
-				"dwellingUpLvl3": { "id" : 39, "upgrades" : 32 },
-				"dwellingUpLvl4": { "id" : 40, "upgrades" : 33 },
-				"dwellingUpLvl5": { "id" : 41, "upgrades" : 34, "requires" : [ 1 ] },
-				"dwellingUpLvl6": { "id" : 42, "upgrades" : 35 },
-				"dwellingUpLvl7": { "id" : 43, "upgrades" : 36 },
+
+				"dwellingLvl1":   { "id" : 30, "requires" : [ "fort" ] },
+				"dwellingLvl2":   { "id" : 31, "requires" : [ "dwellingLvl1" ] },
+				"dwellingLvl3":   { "id" : 32, "requires" : [ "dwellingLvl1" ] },
+				"dwellingLvl4":   { "id" : 33, "requires" : [ "dwellingLvl2" ] },
+				"dwellingLvl5":   { "id" : 34, "requires" : [ "dwellingLvl4" ] },
+				"dwellingLvl6":   { "id" : 35, "requires" : [ "allOf", [ "mageGuild1" ], [ "dwellingLvl4" ] ] },
+				"dwellingLvl7":   { "id" : 36, "requires" : [ "allOf", [ "dwellingLvl5" ], [ "dwellingLvl6" ] ] },
+
+				"dwellingUpLvl1": { "id" : 37, "upgrades" : "dwellingLvl1" },
+				"dwellingUpLvl2": { "id" : 38, "upgrades" : "dwellingLvl2" },
+				"dwellingUpLvl3": { "id" : 39, "upgrades" : "dwellingLvl3" },
+				"dwellingUpLvl4": { "id" : 40, "upgrades" : "dwellingLvl4" },
+				"dwellingUpLvl5": { "id" : 41, "upgrades" : "dwellingLvl5", "requires" : [ "mageGuild2" ] },
+				"dwellingUpLvl6": { "id" : 42, "upgrades" : "dwellingLvl6" },
+				"dwellingUpLvl7": { "id" : 43, "upgrades" : "dwellingLvl7" },
 
 				"ship" : null,
 				"shipyard" : null,

+ 82 - 79
config/factions/necropolis.json

@@ -76,47 +76,47 @@
 			"structures" :
 			{
 				"extraAnimation": { "animation" : "TBNCEXT2.def", "x" : 25,  "y" : 279 },
-				"mageGuild1":     { "id" : 0,  "animation" : "TBNCMAGE.def", "x" : 341, "y" : 116, "z" : -1, "border" : "TONMAG1.bmp",  "area" : "TZNMAG1.bmp" },
-				"mageGuild2":     { "id" : 1,  "animation" : "TBNCMAG2.def", "x" : 341, "y" : 97,  "z" : -1, "border" : "TONMAG2.bmp",  "area" : "TZNMAG2.bmp" },
-				"mageGuild3":     { "id" : 2,  "animation" : "TBNCMAG3.def", "x" : 341, "y" : 78,  "z" : -1, "border" : "TONMAG3.bmp",  "area" : "TZNMAG3.bmp" },
-				"mageGuild4":     { "id" : 3,  "animation" : "TBNCMAG4.def", "x" : 340, "y" : 62,  "z" : -1, "border" : "TONMAG4.bmp",  "area" : "TZNMAG4.bmp" },
-				"mageGuild5":     { "id" : 4,  "animation" : "TBNCMAG5.def", "x" : 343, "y" : 35,  "z" : -1, "border" : "TONMAG5.bmp",  "area" : "TZNMAG5.bmp" },
-				"tavern":         { "id" : 5,  "animation" : "TBNCTVRN.def", "x" : 508, "y" : 189, "border" : "TONTAV.bmp",   "area" : "TZNTAV.bmp"  },
-				"shipyard":       { "id" : 6,  "animation" : "TBNCDOCK.def", "x" : 617, "y" : 265, "z" : -2, "border" : "TONSHPBA.bmp", "area" : "TZNSHPBA.bmp" },
-				"fort":           { "id" : 7,  "animation" : "TBNCCSTL.def", "x" : 138, "y" : 66,  "border" : "TONCAS1.bmp",  "area" : "TZNCAS1.bmp" },
-				"citadel":        { "id" : 8,  "animation" : "TBNCCAS2.def", "x" : 139, "y" : 66,  "border" : "TONCAS2.bmp",  "area" : "TZNCAS2.bmp" },
-				"castle":         { "id" : 9,  "animation" : "TBNCCAS3.def", "x" : 34,  "y" : 18,  "border" : "TONCAS3.bmp",  "area" : "TZNCAS3.bmp" },
-				"villageHall":    { "id" : 10, "animation" : "TBNCHALL.def", "x" : 468, "y" : 76,  "z" : -1, "border" : "TONHAL1.bmp",  "area" : "TZNHAL1.bmp" },
-				"townHall":       { "id" : 11, "animation" : "TBNCHAL2.def", "x" : 482, "y" : 56,  "z" : -1, "border" : "TONHAL2.bmp",  "area" : "TZNHAL2.bmp" },
-				"cityHall":       { "id" : 12, "animation" : "TBNCHAL3.def", "x" : 478, "y" : 26,  "z" : -1, "border" : "TONHAL3.bmp",  "area" : "TZNHAL3.bmp" },
-				"capitol":        { "id" : 13, "animation" : "TBNCHAL4.def", "x" : 481, "y" : 26,  "z" : -1, "border" : "TONHAL4.bmp",  "area" : "TZNHAL4.bmp" },
-				"marketplace":    { "id" : 14, "animation" : "TBNCMARK.def", "x" : 347, "y" : 215, "z" : 2,  "border" : "TONMRK1.bmp",  "area" : "TZNMRK1.bmp" },
-				"resourceSilo":  { "id" : 15, "animation" : "TBNCSILO.def", "x" : 276, "y" : 185, "z" : 1,  "border" : "TONMRK2.bmp",  "area" : "TZNMRK2.bmp" },
-				"blacksmith":     { "id" : 16, "animation" : "TBNCBLAK.def", "x" : 382, "y" : 252, "z" : 4,  "border" : "TONSMITA.bmp", "area" : "TZNSMITA.bmp" },
-				"special1":       { "id" : 17, "animation" : "TBNCSPEC.def", "x" : 18,  "y" : 0,   "z" : -1, "border" : "TONSHRDA.bmp", "area" : "TZNSHRDA.bmp" },
-				"horde1":         { "id" : 18, "animation" : "TBNCHRD1.def", "x" : 80,  "y" : 222, "z" : 4, "border" : "TONSKE1H.bmp", "area" : "TZNSKE1H.bmp", "hidden" : true },
-				"horde1Upgr":     { "id" : 19, "animation" : "TBNCHRD2.def", "x" : 64,  "y" : 222, "z" : 4, "border" : "TONSKE2H.bmp", "area" : "TZNSKE2H.bmp", "hidden" : true, "builds" : 18 },
-				"ship":           { "id" : 20, "animation" : "TBNCBOAT.def", "x" : 617, "y" : 265, "z" : -2, "border" : "TONSHPNA.bmp", "area" : "TZNSHPNA.bmp", "hidden" : true },
-				"special2":       { "id" : 21, "animation" : "TBNCEXT0.def", "x" : 307, "y" : 61,  "z" : -2, "border" : "TONNECRA.bmp", "area" : "TZNNECRA.bmp" },
-				"special3":       { "id" : 22, "animation" : "TBNCEXT1.def", "x" : 247, "y" : 275, "z" : 4,  "border" : "TONSKELT.bmp", "area" : "TZNSKELT.bmp" },
-				"grail":          { "id" : 26, "animation" : "TBNCHOLY.def", "x" : 410, "y" : 88,  "border" : "TONHOLYA.bmp", "area" : "TZNHOLYA.bmp" },
-				"extraTownHall":  { "id" : 27, "animation" : "TBNCEXT3.def", "x" : 0,   "y" : 241 },
-				"extraCityHall":  { "id" : 28, "animation" : "TBNCEXT4.def", "x" : 321, "y" : 255 },
-				"extraCapitol":   { "id" : 29, "animation" : "TBNCEXT5.def", "x" : 475, "y" : 257 },
-				"dwellingLvl1":   { "id" : 30, "animation" : "TBNCDW_0.def", "x" : 80,  "y" : 222, "z" : 4, "border" : "TONSKEL1.bmp", "area" : "TZNSKEL1.bmp" },
-				"dwellingLvl2":   { "id" : 31, "animation" : "TBNCDW_1.def", "x" : 502, "y" : 223, "border" : "TONZOMB1.bmp", "area" : "TZNZOMB1.bmp" },
-				"dwellingLvl3":   { "id" : 32, "animation" : "TBNCDW_2.def", "x" : 0,   "y" : 187, "z" : 2, "border" : "TONWIGH1.bmp", "area" : "TZNWIGH1.bmp" },
-				"dwellingLvl4":   { "id" : 33, "animation" : "TBNCDW_3.def", "x" : 607, "y" : 212, "z" : 2, "border" : "TONVAM1.bmp",  "area" : "TZNVAM1.bmp" },
-				"dwellingLvl5":   { "id" : 34, "animation" : "TBNCDW_4.def", "x" : 206, "y" : 207, "z" : 3, "border" : "TONLICH1.bmp", "area" : "TZNLICH1.bmp" },
-				"dwellingLvl6":   { "id" : 35, "animation" : "TBNCDW_5.def", "x" : 0,   "y" : 31,  "border" : "TONBKN1.bmp",  "area" : "TZNBKN1.bmp" },
-				"dwellingLvl7":   { "id" : 36, "animation" : "TBNCDW_6.def", "x" : 663, "y" : 25,  "border" : "TONBON1.bmp",  "area" : "TZNBON1.bmp" },
-				"dwellingUpLvl1": { "id" : 37, "animation" : "TBNCUP_0.def", "x" : 64,  "y" : 222, "z" : 4, "border" : "TONSKEL2.bmp", "area" : "TZNSKEL2.bmp" },
-				"dwellingUpLvl2": { "id" : 38, "animation" : "TBNCUP_1.def", "x" : 498, "y" : 224, "border" : "TONZOMB2.bmp", "area" : "TZNZOMB2.bmp" },
-				"dwellingUpLvl3": { "id" : 39, "animation" : "TBNCUP_2.def", "x" : 0,   "y" : 179, "z" : 2, "border" : "TONWIGH2.bmp", "area" : "TZNWIGH2.bmp" },
-				"dwellingUpLvl4": { "id" : 40, "animation" : "TBNCUP_3.def", "x" : 615, "y" : 193, "z" : 2, "border" : "TONVAM2.bmp",  "area" : "TZNVAM2.bmp" },
-				"dwellingUpLvl5": { "id" : 41, "animation" : "TBNCUP_4.def", "x" : 222, "y" : 171, "z" : 3, "border" : "TONLICH2.bmp", "area" : "TZNLICH2.bmp" },
-				"dwellingUpLvl6": { "id" : 42, "animation" : "TBNCUP_5.def", "x" : 0,   "y" : 30,  "border" : "TONBKN2.bmp",  "area" : "TZNBKN2.bmp" },
-				"dwellingUpLvl7": { "id" : 43, "animation" : "TBNCUP_6.def", "x" : 662, "y" : 23,  "border" : "TONBON2.bmp",  "area" : "TZNBON2.bmp" }
+				"mageGuild1":     { "animation" : "TBNCMAGE.def", "x" : 341, "y" : 116, "z" : -1, "border" : "TONMAG1.bmp",  "area" : "TZNMAG1.bmp" },
+				"mageGuild2":     { "animation" : "TBNCMAG2.def", "x" : 341, "y" : 97,  "z" : -1, "border" : "TONMAG2.bmp",  "area" : "TZNMAG2.bmp" },
+				"mageGuild3":     { "animation" : "TBNCMAG3.def", "x" : 341, "y" : 78,  "z" : -1, "border" : "TONMAG3.bmp",  "area" : "TZNMAG3.bmp" },
+				"mageGuild4":     { "animation" : "TBNCMAG4.def", "x" : 340, "y" : 62,  "z" : -1, "border" : "TONMAG4.bmp",  "area" : "TZNMAG4.bmp" },
+				"mageGuild5":     { "animation" : "TBNCMAG5.def", "x" : 343, "y" : 35,  "z" : -1, "border" : "TONMAG5.bmp",  "area" : "TZNMAG5.bmp" },
+				"tavern":         { "animation" : "TBNCTVRN.def", "x" : 508, "y" : 189, "border" : "TONTAV.bmp",   "area" : "TZNTAV.bmp"  },
+				"shipyard":       { "animation" : "TBNCDOCK.def", "x" : 617, "y" : 265, "z" : -2, "border" : "TONSHPBA.bmp", "area" : "TZNSHPBA.bmp" },
+				"fort":           { "animation" : "TBNCCSTL.def", "x" : 138, "y" : 66,  "border" : "TONCAS1.bmp",  "area" : "TZNCAS1.bmp" },
+				"citadel":        { "animation" : "TBNCCAS2.def", "x" : 139, "y" : 66,  "border" : "TONCAS2.bmp",  "area" : "TZNCAS2.bmp" },
+				"castle":         { "animation" : "TBNCCAS3.def", "x" : 34,  "y" : 18,  "border" : "TONCAS3.bmp",  "area" : "TZNCAS3.bmp" },
+				"villageHall":    { "animation" : "TBNCHALL.def", "x" : 468, "y" : 76,  "z" : -1, "border" : "TONHAL1.bmp",  "area" : "TZNHAL1.bmp" },
+				"townHall":       { "animation" : "TBNCHAL2.def", "x" : 482, "y" : 56,  "z" : -1, "border" : "TONHAL2.bmp",  "area" : "TZNHAL2.bmp" },
+				"cityHall":       { "animation" : "TBNCHAL3.def", "x" : 478, "y" : 26,  "z" : -1, "border" : "TONHAL3.bmp",  "area" : "TZNHAL3.bmp" },
+				"capitol":        { "animation" : "TBNCHAL4.def", "x" : 481, "y" : 26,  "z" : -1, "border" : "TONHAL4.bmp",  "area" : "TZNHAL4.bmp" },
+				"marketplace":    { "animation" : "TBNCMARK.def", "x" : 347, "y" : 215, "z" : 2,  "border" : "TONMRK1.bmp",  "area" : "TZNMRK1.bmp" },
+				"resourceSilo":   { "animation" : "TBNCSILO.def", "x" : 276, "y" : 185, "z" : 1,  "border" : "TONMRK2.bmp",  "area" : "TZNMRK2.bmp" },
+				"blacksmith":     { "animation" : "TBNCBLAK.def", "x" : 382, "y" : 252, "z" : 4,  "border" : "TONSMITA.bmp", "area" : "TZNSMITA.bmp" },
+				"special1":       { "animation" : "TBNCSPEC.def", "x" : 18,  "y" : 0,   "z" : -1, "border" : "TONSHRDA.bmp", "area" : "TZNSHRDA.bmp" },
+				"horde1":         { "animation" : "TBNCHRD1.def", "x" : 80,  "y" : 222, "z" : 4, "border" : "TONSKE1H.bmp", "area" : "TZNSKE1H.bmp", "hidden" : true },
+				"horde1Upgr":     { "animation" : "TBNCHRD2.def", "x" : 64,  "y" : 222, "z" : 4, "border" : "TONSKE2H.bmp", "area" : "TZNSKE2H.bmp", "hidden" : true, "builds" : "horde1" },
+				"ship":           { "animation" : "TBNCBOAT.def", "x" : 617, "y" : 265, "z" : -2, "border" : "TONSHPNA.bmp", "area" : "TZNSHPNA.bmp", "hidden" : true },
+				"special2":       { "animation" : "TBNCEXT0.def", "x" : 307, "y" : 61,  "z" : -2, "border" : "TONNECRA.bmp", "area" : "TZNNECRA.bmp" },
+				"special3":       { "animation" : "TBNCEXT1.def", "x" : 247, "y" : 275, "z" : 4,  "border" : "TONSKELT.bmp", "area" : "TZNSKELT.bmp" },
+				"grail":          { "animation" : "TBNCHOLY.def", "x" : 410, "y" : 88,  "border" : "TONHOLYA.bmp", "area" : "TZNHOLYA.bmp" },
+				"extraTownHall":  { "animation" : "TBNCEXT3.def", "x" : 0,   "y" : 241 },
+				"extraCityHall":  { "animation" : "TBNCEXT4.def", "x" : 321, "y" : 255 },
+				"extraCapitol":   { "animation" : "TBNCEXT5.def", "x" : 475, "y" : 257 },
+				"dwellingLvl1":   { "animation" : "TBNCDW_0.def", "x" : 80,  "y" : 222, "z" : 4, "border" : "TONSKEL1.bmp", "area" : "TZNSKEL1.bmp" },
+				"dwellingLvl2":   { "animation" : "TBNCDW_1.def", "x" : 502, "y" : 223, "border" : "TONZOMB1.bmp", "area" : "TZNZOMB1.bmp" },
+				"dwellingLvl3":   { "animation" : "TBNCDW_2.def", "x" : 0,   "y" : 187, "z" : 2, "border" : "TONWIGH1.bmp", "area" : "TZNWIGH1.bmp" },
+				"dwellingLvl4":   { "animation" : "TBNCDW_3.def", "x" : 607, "y" : 212, "z" : 2, "border" : "TONVAM1.bmp",  "area" : "TZNVAM1.bmp" },
+				"dwellingLvl5":   { "animation" : "TBNCDW_4.def", "x" : 206, "y" : 207, "z" : 3, "border" : "TONLICH1.bmp", "area" : "TZNLICH1.bmp" },
+				"dwellingLvl6":   { "animation" : "TBNCDW_5.def", "x" : 0,   "y" : 31,  "border" : "TONBKN1.bmp",  "area" : "TZNBKN1.bmp" },
+				"dwellingLvl7":   { "animation" : "TBNCDW_6.def", "x" : 663, "y" : 25,  "border" : "TONBON1.bmp",  "area" : "TZNBON1.bmp" },
+				"dwellingUpLvl1": { "animation" : "TBNCUP_0.def", "x" : 64,  "y" : 222, "z" : 4, "border" : "TONSKEL2.bmp", "area" : "TZNSKEL2.bmp" },
+				"dwellingUpLvl2": { "animation" : "TBNCUP_1.def", "x" : 498, "y" : 224, "border" : "TONZOMB2.bmp", "area" : "TZNZOMB2.bmp" },
+				"dwellingUpLvl3": { "animation" : "TBNCUP_2.def", "x" : 0,   "y" : 179, "z" : 2, "border" : "TONWIGH2.bmp", "area" : "TZNWIGH2.bmp" },
+				"dwellingUpLvl4": { "animation" : "TBNCUP_3.def", "x" : 615, "y" : 193, "z" : 2, "border" : "TONVAM2.bmp",  "area" : "TZNVAM2.bmp" },
+				"dwellingUpLvl5": { "animation" : "TBNCUP_4.def", "x" : 222, "y" : 171, "z" : 3, "border" : "TONLICH2.bmp", "area" : "TZNLICH2.bmp" },
+				"dwellingUpLvl6": { "animation" : "TBNCUP_5.def", "x" : 0,   "y" : 30,  "border" : "TONBKN2.bmp",  "area" : "TZNBKN2.bmp" },
+				"dwellingUpLvl7": { "animation" : "TBNCUP_6.def", "x" : 662, "y" : 23,  "border" : "TONBON2.bmp",  "area" : "TZNBON2.bmp" }
 			},
 
 			"musicTheme" : "music/NecroTown",
@@ -128,11 +128,11 @@
 			"hallBackground": "TPTHBKNC.BMP",
 			"hallSlots":
 			[
-				[ [ 10, 11, 12, 13 ], [ 7, 8, 9 ], [ 5 ], [ 16 ] ],
-				[ [ 14, 15 ], [ 0, 1, 2, 3, 4 ], [ 21 ], [ 6 ] ],
-				[ [ 17 ], [ 22 ], [ 18, 19 ] ],
-				[ [ 30, 37 ], [ 31, 38 ], [ 32, 39 ], [ 33, 40 ] ],
-				[ [ 34, 41 ], [ 35, 42 ], [ 36, 43 ] ]
+				[ [ "villageHall", "townHall", "cityHall", "capitol" ], [ "fort", "citadel", "castle" ], [ "tavern" ], [ "blacksmith" ] ],
+				[ [ "marketplace", "resourceSilo" ], [ "mageGuild1", "mageGuild2", "mageGuild3", "mageGuild4", "mageGuild5" ], [ "special2" ], [ "shipyard" ] ],
+				[ [ "special1" ], [ "special3" ], [ "horde1", "horde1Upgr" ] ],
+				[ [ "dwellingLvl1", "dwellingUpLvl1" ], [ "dwellingLvl2", "dwellingUpLvl2" ], [ "dwellingLvl3", "dwellingUpLvl3" ], [ "dwellingLvl4", "dwellingUpLvl4" ] ],
+				[ [ "dwellingLvl5", "dwellingUpLvl5" ], [ "dwellingLvl6", "dwellingUpLvl6" ], [ "dwellingLvl7", "dwellingUpLvl7" ] ]
 			],
 			"creatures" :
 			[
@@ -152,46 +152,49 @@
 			"buildings" :
 			{
 				"mageGuild1":     { "id" : 0 },
-				"mageGuild2":     { "id" : 1,  "upgrades" : 0 },
-				"mageGuild3":     { "id" : 2,  "upgrades" : 1 },
-				"mageGuild4":     { "id" : 3,  "upgrades" : 2 },
-				"mageGuild5":     { "id" : 4,  "upgrades" : 3 },
+				"mageGuild2":     { "id" : 1,  "upgrades" : "mageGuild1" },
+				"mageGuild3":     { "id" : 2,  "upgrades" : "mageGuild2" },
+				"mageGuild4":     { "id" : 3,  "upgrades" : "mageGuild3" },
+				"mageGuild5":     { "id" : 4,  "upgrades" : "mageGuild4" },
 				"tavern":         { "id" : 5 },
 				"shipyard":       { "id" : 6 },
 				"fort":           { "id" : 7 },
-				"citadel":        { "id" : 8,  "upgrades" : 7 },
-				"castle":         { "id" : 9,  "upgrades" : 8 },
+				"citadel":        { "id" : 8,  "upgrades" : "fort" },
+				"castle":         { "id" : 9,  "upgrades" : "castle" },
 				"villageHall":    { "id" : 10, "mode" : "auto" },
-				"townHall":       { "id" : 11, "upgrades" : 10, "requires" : [ 5 ] },
-				"cityHall":       { "id" : 12, "upgrades" : 11, "requires" : [ 0, 14, 16 ] },
-				"capitol":        { "id" : 13, "upgrades" : 12, "requires" : [ 9 ] },
+				"townHall":       { "id" : 11, "upgrades" : "villageHall", "requires" : [ "tavern" ] },
+				"cityHall":       { "id" : 12, "upgrades" : "townHall", "requires" : [ "allOf", [ "mageGuild1" ], [ "marketplace" ], [ "blacksmith" ] ] },
+				"capitol":        { "id" : 13, "upgrades" : "cityHall", "requires" : [ "castle" ] },
 				"marketplace":    { "id" : 14 },
-				"resourceSilo":  { "id" : 15, "requires" : [ 14 ] },
+				"resourceSilo":   { "id" : 15, "requires" : [ "marketplace" ] },
 				"blacksmith":     { "id" : 16 },
-				"special1":       { "id" : 17, "requires" : [ 7 ] },
-				"horde1":         { "id" : 18, "upgrades" : 30, "requires" : [ 22 ] },
-				"horde1Upgr":     { "id" : 19, "upgrades" : 37, "requires" : [ 18 ], "mode" : "auto" },
-				"ship":           { "id" : 20, "upgrades" : 6 },
-				"special2":       { "id" : 21, "requires" : [ 0 ] },
-				"special3":       { "id" : 22, "requires" : [ 30 ] },
+
+				"special1":       { "id" : 17, "requires" : [ "fort" ] },
+				"horde1":         { "id" : 18, "upgrades" : "dwellingLvl1", "requires" : [ "special3" ] },
+				"horde1Upgr":     { "id" : 19, "upgrades" : "dwellingUpLvl1", "requires" : [ "horde1" ], "mode" : "auto" },
+				"ship":           { "id" : 20, "upgrades" : "shipyard" },
+				"special2":       { "id" : 21, "requires" : [ "mageGuild1" ] },
+				"special3":       { "id" : 22, "requires" : [ "dwellingLvl1" ] },
 				"grail":          { "id" : 26, "mode" : "grail"},
-				"extraTownHall":  { "id" : 27, "requires" : [ 11 ], "mode" : "auto" },
-				"extraCityHall":  { "id" : 28, "requires" : [ 12 ], "mode" : "auto" },
-				"extraCapitol":   { "id" : 29, "requires" : [ 13 ], "mode" : "auto" },
-				"dwellingLvl1":   { "id" : 30, "requires" : [ 7 ] },
-				"dwellingLvl2":   { "id" : 31, "requires" : [ 30 ] },
-				"dwellingLvl3":   { "id" : 32, "requires" : [ 30 ] },
-				"dwellingLvl4":   { "id" : 33, "requires" : [ 31 ] },
-				"dwellingLvl5":   { "id" : 34, "requires" : [ 0, 31 ] },
-				"dwellingLvl6":   { "id" : 35, "requires" : [ 33, 34 ] },
-				"dwellingLvl7":   { "id" : 36, "requires" : [ 35 ] },
-				"dwellingUpLvl1": { "id" : 37, "upgrades" : 30 },
-				"dwellingUpLvl2": { "id" : 38, "upgrades" : 31 },
-				"dwellingUpLvl3": { "id" : 39, "upgrades" : 32 },
-				"dwellingUpLvl4": { "id" : 40, "upgrades" : 33, "requires" : [ 21 ] },
-				"dwellingUpLvl5": { "id" : 41, "upgrades" : 34 },
-				"dwellingUpLvl6": { "id" : 42, "upgrades" : 35 },
-				"dwellingUpLvl7": { "id" : 43, "upgrades" : 36 },
+				"extraTownHall":  { "id" : 27, "requires" : [ "townHall" ], "mode" : "auto" },
+				"extraCityHall":  { "id" : 28, "requires" : [ "cityHall" ], "mode" : "auto" },
+				"extraCapitol":   { "id" : 29, "requires" : [ "capitol" ], "mode" : "auto" },
+
+				"dwellingLvl1":   { "id" : 30, "requires" : [ "fort" ] },
+				"dwellingLvl2":   { "id" : 31, "requires" : [ "dwellingLvl1" ] },
+				"dwellingLvl3":   { "id" : 32, "requires" : [ "dwellingLvl1" ] },
+				"dwellingLvl4":   { "id" : 33, "requires" : [ "dwellingLvl2" ] },
+				"dwellingLvl5":   { "id" : 34, "requires" : [ "allOf", [ "mageGuild1"  ], [ "dwellingLvl2" ] ] },
+				"dwellingLvl6":   { "id" : 35, "requires" : [ "allOf", [ "dwellingLvl4" ], [ "dwellingLvl5" ] ] },
+				"dwellingLvl7":   { "id" : 36, "requires" : [ "dwellingLvl6" ] },
+
+				"dwellingUpLvl1": { "id" : 37, "upgrades" : "dwellingLvl1" },
+				"dwellingUpLvl2": { "id" : 38, "upgrades" : "dwellingLvl2" },
+				"dwellingUpLvl3": { "id" : 39, "upgrades" : "dwellingLvl3" },
+				"dwellingUpLvl4": { "id" : 40, "upgrades" : "dwellingLvl4", "requires" : [ "special2" ] },
+				"dwellingUpLvl5": { "id" : 41, "upgrades" : "dwellingLvl5" },
+				"dwellingUpLvl6": { "id" : 42, "upgrades" : "dwellingLvl6" },
+				"dwellingUpLvl7": { "id" : 43, "upgrades" : "dwellingLvl7" },
 				
 				"horde2" : null,
 				"horde2Upgr" : null,

+ 81 - 78
config/factions/rampart.json

@@ -76,47 +76,47 @@
 			"structures" :
 			{
 				"extraAnimation": { "animation" : "TBRMEXT2.def", "x" : 327, "y" : 236 },
-				"mageGuild1":     { "id" : 0,  "animation" : "TBRMMAGE.def", "x" : 454, "y" : 200, "z" : -1, "border" : "TORMAG1.bmp",  "area" : "TZRMAG1.bmp" },
-				"mageGuild2":     { "id" : 1,  "animation" : "TBRMMAG2.def", "x" : 438, "y" : 178, "z" : -1, "border" : "TORMAG2.bmp",  "area" : "TZRMAG2.bmp" },
-				"mageGuild3":     { "id" : 2,  "animation" : "TBRMMAG3.def", "x" : 418, "y" : 153, "z" : -1, "border" : "TORMAG3.bmp",  "area" : "TZRMAG3.bmp" },
-				"mageGuild4":     { "id" : 3,  "animation" : "TBRMMAG4.def", "x" : 406, "y" : 129, "z" : -1, "border" : "TORMAG4.bmp",  "area" : "TZRMAG4.bmp" },
-				"mageGuild5":     { "id" : 4,  "animation" : "TBRMMAG5.def", "x" : 384, "y" : 104, "z" : -1, "border" : "TORMAG5.bmp",  "area" : "TZRMAG5.bmp" },
-				"tavern":         { "id" : 5,  "animation" : "TBRMTVRN.def", "x" : 181, "y" : 229, "z" : 1,  "border" : "TORTAV.bmp",   "area" : "TZRTAV.bmp" },
-				"fort":           { "id" : 7,  "animation" : "TBRMCSTL.def", "x" : 63,  "y" : 25,  "z" : -2, "border" : "TORCAS1.bmp",  "area" : "TZRCAS1.bmp" },
-				"citadel":        { "id" : 8,  "animation" : "TBRMCAS2.def", "x" : 79,  "y" : 18,  "z" : -2, "border" : "TORCAS3.bmp",  "area" : "TZRCAS3.bmp" },
-				"castle":         { "id" : 9,  "animation" : "TBRMCAS3.def", "x" : 79,  "y" : 18,  "z" : -2, "border" : "TORCAS2.bmp",  "area" : "TZRCAS2.bmp" },
-				"villageHall":    { "id" : 10, "animation" : "TBRMHALL.def", "x" : 565, "y" : 216, "border" : "TORHAL1.bmp",  "area" : "TZRHAL1.bmp" },
-				"townHall":       { "id" : 11, "animation" : "TBRMHAL2.def", "x" : 538, "y" : 187, "border" : "TORHAL2.bmp",  "area" : "TZRHAL2.bmp" },
-				"cityHall":       { "id" : 12, "animation" : "TBRMHAL3.def", "x" : 538, "y" : 187, "border" : "TORHAL3.bmp",  "area" : "TZRHAL3.bmp" },
-				"capitol":        { "id" : 13, "animation" : "TBRMHAL4.def", "x" : 534, "y" : 187, "border" : "TORHAL4.bmp",  "area" : "TZRHAL4.bmp" },
-				"marketplace":    { "id" : 14, "animation" : "TBRMMARK.def", "x" : 129, "y" : 301, "z" : 3,  "border" : "TORMRK1.bmp",  "area" : "TZRMRK1.bmp" },
-				"resourceSilo":  { "id" : 15, "animation" : "TBRMSILO.def", "x" : 245, "y" : 324, "z" : 4,  "border" : "TORMRK2.bmp",  "area" : "TZRMRK2.bmp" },
-				"blacksmith":     { "id" : 16, "animation" : "TBRMBLAK.def", "x" : 558, "y" : 105, "z" : -3, "border" : "TORAID.bmp",   "area" : "TZRAID.bmp" },
-				"special1":       { "id" : 17, "animation" : "TBRMSPEC.def", "x" : 555, "y" : 297, "border" : "TORGAR1A.bmp", "area" : "TZRGAR1A.bmp" },
-				"horde1":         { "id" : 18, "animation" : "TBRMHRD1.def", "x" : 0,   "y" : 154, "border" : "TORDWF1H.bmp", "area" : "TZRDWF1H.bmp", "hidden" : true },
-				"horde1Upgr":     { "id" : 19, "animation" : "TBRMHRD2.def", "x" : 0,   "y" : 143, "border" : "TORDWF2H.bmp", "area" : "TZRDWF2H.bmp", "hidden" : true, "builds" : 18 },
-				"special2":       { "id" : 21, "animation" : "TBRMEXT0.def", "x" : 555, "y" : 297, "z" : 2, "border" : "TORGAR2A.bmp", "area" : "TZRGAR2A.bmp" },
-				"special3":       { "id" : 22, "animation" : "TBRMEXT1.def", "x" : 0,   "y" : 181, "z" : 1, "border" : "TORDWFT.bmp",  "area" : "TZRDWFT.bmp" },
-				"horde2":         { "id" : 24, "animation" : "TBRMHRD3.def", "x" : 47,  "y" : 142, "z" : -1, "border" : "TORTRE1H.bmp", "area" : "TZRTRE1H.bmp", "hidden" : true },
-				"horde2Upgr":     { "id" : 25, "animation" : "TBRMHRD4.def", "x" : 47,  "y" : 142, "z" : -1, "border" : "TORTRE2H.bmp", "area" : "TZRTRE2H.bmp", "hidden" : true, "builds" : 24 },
-				"grail":          { "id" : 26, "animation" : "TBRMHOLY.def", "x" : 0,   "y" : 54,  "z" : -1, "border" : "TORHOLY.bmp",  "area" : "TZRHOLY.bmp" },
-				"extraTownHall":  { "id" : 27, "animation" : "TBRMEXT3.def", "x" : 293, "y" : 235 },
-				"extraCityHall":  { "id" : 28, "animation" : "TBRMEXT4.def", "x" : 295, "y" : 191 },
-				"extraCapitol":   { "id" : 29, "animation" : "TBRMEXT5.def", "x" : 260, "y" : 171 },
-				"dwellingLvl1":   { "id" : 30, "animation" : "TBRMDW_0.def", "x" : 0,   "y" : 236, "z" : 2,  "border" : "TORCEN1A.bmp", "area" : "TZRCEN1A.bmp" },
-				"dwellingLvl2":   { "id" : 31, "animation" : "TBRMDW_1.def", "x" : 0,   "y" : 154, "border" : "TORDWF1.bmp",  "area" : "TZRDWF1.bmp" },
-				"dwellingLvl3":   { "id" : 32, "animation" : "TBRMDW_2.def", "x" : 668, "y" : 101, "border" : "TORELF1.bmp",  "area" : "TZRELF1.bmp" },
-				"dwellingLvl4":   { "id" : 33, "animation" : "TBRMDW_3.def", "x" : 287, "y" : 73,  "z" : -1, "border" : "TORPEG1A.bmp", "area" : "TZRPEG1A.bmp" },
-				"dwellingLvl5":   { "id" : 34, "animation" : "TBRMDW_4.def", "x" : 68,  "y" : 146, "z" : -1, "border" : "TORTRE1.bmp",  "area" : "TZRTRE1.bmp" },
-				"dwellingLvl6":   { "id" : 35, "animation" : "TBRMDW_5.def", "x" : 362, "y" : 90,  "z" : -2, "border" : "TORUNI1.bmp",  "area" : "TZRUNI1.bmp" },
-				"dwellingLvl7":   { "id" : 36, "animation" : "TBRMDW_6.def", "x" : 502, "y" : 27,  "z" : -5, "border" : "TORDR1AA.bmp", "area" : "TZRDR1AA.bmp" },
-				"dwellingUpLvl1": { "id" : 37, "animation" : "TBRMUP_0.def", "x" : 0,   "y" : 236, "z" : 2,  "border" : "TORCEN2A.bmp", "area" : "TZRCEN2A.bmp" },
-				"dwellingUpLvl2": { "id" : 38, "animation" : "TBRMUP_1.def", "x" : 0,   "y" : 143, "border" : "TORDWF2.bmp",  "area" : "TZRDWF2.bmp" },
-				"dwellingUpLvl3": { "id" : 39, "animation" : "TBRMUP_2.def", "x" : 665, "y" : 101, "border" : "TORELF2.bmp",  "area" : "TZRELF2.bmp" },
-				"dwellingUpLvl4": { "id" : 40, "animation" : "TBRMUP_3.def", "x" : 287, "y" : 28,  "z" : -1, "border" : "TORPEG2A.bmp", "area" : "TZRPEG2A.bmp" },
-				"dwellingUpLvl5": { "id" : 41, "animation" : "TBRMUP_4.def", "x" : 63,  "y" : 146, "z" : -1, "border" : "TORTRE2.bmp",  "area" : "TZRTRE2.bmp" },
-				"dwellingUpLvl6": { "id" : 42, "animation" : "TBRMUP_5.def", "x" : 362, "y" : 90,  "z" : -2, "border" : "TORUNI2.bmp",  "area" : "TZRUNI2.bmp" },
-				"dwellingUpLvl7": { "id" : 43, "animation" : "TBRMUP_6.def", "x" : 502, "y" : 5,   "z" : -5, "border" : "TORDR2AA.bmp", "area" : "TZRDR2AA.bmp" }
+				"mageGuild1":     { "animation" : "TBRMMAGE.def", "x" : 454, "y" : 200, "z" : -1, "border" : "TORMAG1.bmp",  "area" : "TZRMAG1.bmp" },
+				"mageGuild2":     { "animation" : "TBRMMAG2.def", "x" : 438, "y" : 178, "z" : -1, "border" : "TORMAG2.bmp",  "area" : "TZRMAG2.bmp" },
+				"mageGuild3":     { "animation" : "TBRMMAG3.def", "x" : 418, "y" : 153, "z" : -1, "border" : "TORMAG3.bmp",  "area" : "TZRMAG3.bmp" },
+				"mageGuild4":     { "animation" : "TBRMMAG4.def", "x" : 406, "y" : 129, "z" : -1, "border" : "TORMAG4.bmp",  "area" : "TZRMAG4.bmp" },
+				"mageGuild5":     { "animation" : "TBRMMAG5.def", "x" : 384, "y" : 104, "z" : -1, "border" : "TORMAG5.bmp",  "area" : "TZRMAG5.bmp" },
+				"tavern":         { "animation" : "TBRMTVRN.def", "x" : 181, "y" : 229, "z" : 1,  "border" : "TORTAV.bmp",   "area" : "TZRTAV.bmp" },
+				"fort":           { "animation" : "TBRMCSTL.def", "x" : 63,  "y" : 25,  "z" : -2, "border" : "TORCAS1.bmp",  "area" : "TZRCAS1.bmp" },
+				"citadel":        { "animation" : "TBRMCAS2.def", "x" : 79,  "y" : 18,  "z" : -2, "border" : "TORCAS3.bmp",  "area" : "TZRCAS3.bmp" },
+				"castle":         { "animation" : "TBRMCAS3.def", "x" : 79,  "y" : 18,  "z" : -2, "border" : "TORCAS2.bmp",  "area" : "TZRCAS2.bmp" },
+				"villageHall":    { "animation" : "TBRMHALL.def", "x" : 565, "y" : 216, "border" : "TORHAL1.bmp",  "area" : "TZRHAL1.bmp" },
+				"townHall":       { "animation" : "TBRMHAL2.def", "x" : 538, "y" : 187, "border" : "TORHAL2.bmp",  "area" : "TZRHAL2.bmp" },
+				"cityHall":       { "animation" : "TBRMHAL3.def", "x" : 538, "y" : 187, "border" : "TORHAL3.bmp",  "area" : "TZRHAL3.bmp" },
+				"capitol":        { "animation" : "TBRMHAL4.def", "x" : 534, "y" : 187, "border" : "TORHAL4.bmp",  "area" : "TZRHAL4.bmp" },
+				"marketplace":    { "animation" : "TBRMMARK.def", "x" : 129, "y" : 301, "z" : 3,  "border" : "TORMRK1.bmp",  "area" : "TZRMRK1.bmp" },
+				"resourceSilo":   { "animation" : "TBRMSILO.def", "x" : 245, "y" : 324, "z" : 4,  "border" : "TORMRK2.bmp",  "area" : "TZRMRK2.bmp" },
+				"blacksmith":     { "animation" : "TBRMBLAK.def", "x" : 558, "y" : 105, "z" : -3, "border" : "TORAID.bmp",   "area" : "TZRAID.bmp" },
+				"special1":       { "animation" : "TBRMSPEC.def", "x" : 555, "y" : 297, "border" : "TORGAR1A.bmp", "area" : "TZRGAR1A.bmp" },
+				"horde1":         { "animation" : "TBRMHRD1.def", "x" : 0,   "y" : 154, "border" : "TORDWF1H.bmp", "area" : "TZRDWF1H.bmp", "hidden" : true },
+				"horde1Upgr":     { "animation" : "TBRMHRD2.def", "x" : 0,   "y" : 143, "border" : "TORDWF2H.bmp", "area" : "TZRDWF2H.bmp", "hidden" : true, "builds" : "horde1" },
+				"special2":       { "animation" : "TBRMEXT0.def", "x" : 555, "y" : 297, "z" : 2, "border" : "TORGAR2A.bmp", "area" : "TZRGAR2A.bmp" },
+				"special3":       { "animation" : "TBRMEXT1.def", "x" : 0,   "y" : 181, "z" : 1, "border" : "TORDWFT.bmp",  "area" : "TZRDWFT.bmp" },
+				"horde2":         { "animation" : "TBRMHRD3.def", "x" : 47,  "y" : 142, "z" : -1, "border" : "TORTRE1H.bmp", "area" : "TZRTRE1H.bmp", "hidden" : true },
+				"horde2Upgr":     { "animation" : "TBRMHRD4.def", "x" : 47,  "y" : 142, "z" : -1, "border" : "TORTRE2H.bmp", "area" : "TZRTRE2H.bmp", "hidden" : true, "builds" : "horde2" },
+				"grail":          { "animation" : "TBRMHOLY.def", "x" : 0,   "y" : 54,  "z" : -1, "border" : "TORHOLY.bmp",  "area" : "TZRHOLY.bmp" },
+				"extraTownHall":  { "animation" : "TBRMEXT3.def", "x" : 293, "y" : 235 },
+				"extraCityHall":  { "animation" : "TBRMEXT4.def", "x" : 295, "y" : 191 },
+				"extraCapitol":   { "animation" : "TBRMEXT5.def", "x" : 260, "y" : 171 },
+				"dwellingLvl1":   { "animation" : "TBRMDW_0.def", "x" : 0,   "y" : 236, "z" : 2,  "border" : "TORCEN1A.bmp", "area" : "TZRCEN1A.bmp" },
+				"dwellingLvl2":   { "animation" : "TBRMDW_1.def", "x" : 0,   "y" : 154, "border" : "TORDWF1.bmp",  "area" : "TZRDWF1.bmp" },
+				"dwellingLvl3":   { "animation" : "TBRMDW_2.def", "x" : 668, "y" : 101, "border" : "TORELF1.bmp",  "area" : "TZRELF1.bmp" },
+				"dwellingLvl4":   { "animation" : "TBRMDW_3.def", "x" : 287, "y" : 73,  "z" : -1, "border" : "TORPEG1A.bmp", "area" : "TZRPEG1A.bmp" },
+				"dwellingLvl5":   { "animation" : "TBRMDW_4.def", "x" : 68,  "y" : 146, "z" : -1, "border" : "TORTRE1.bmp",  "area" : "TZRTRE1.bmp" },
+				"dwellingLvl6":   { "animation" : "TBRMDW_5.def", "x" : 362, "y" : 90,  "z" : -2, "border" : "TORUNI1.bmp",  "area" : "TZRUNI1.bmp" },
+				"dwellingLvl7":   { "animation" : "TBRMDW_6.def", "x" : 502, "y" : 27,  "z" : -5, "border" : "TORDR1AA.bmp", "area" : "TZRDR1AA.bmp" },
+				"dwellingUpLvl1": { "animation" : "TBRMUP_0.def", "x" : 0,   "y" : 236, "z" : 2,  "border" : "TORCEN2A.bmp", "area" : "TZRCEN2A.bmp" },
+				"dwellingUpLvl2": { "animation" : "TBRMUP_1.def", "x" : 0,   "y" : 143, "border" : "TORDWF2.bmp",  "area" : "TZRDWF2.bmp" },
+				"dwellingUpLvl3": { "animation" : "TBRMUP_2.def", "x" : 665, "y" : 101, "border" : "TORELF2.bmp",  "area" : "TZRELF2.bmp" },
+				"dwellingUpLvl4": { "animation" : "TBRMUP_3.def", "x" : 287, "y" : 28,  "z" : -1, "border" : "TORPEG2A.bmp", "area" : "TZRPEG2A.bmp" },
+				"dwellingUpLvl5": { "animation" : "TBRMUP_4.def", "x" : 63,  "y" : 146, "z" : -1, "border" : "TORTRE2.bmp",  "area" : "TZRTRE2.bmp" },
+				"dwellingUpLvl6": { "animation" : "TBRMUP_5.def", "x" : 362, "y" : 90,  "z" : -2, "border" : "TORUNI2.bmp",  "area" : "TZRUNI2.bmp" },
+				"dwellingUpLvl7": { "animation" : "TBRMUP_6.def", "x" : 502, "y" : 5,   "z" : -5, "border" : "TORDR2AA.bmp", "area" : "TZRDR2AA.bmp" }
 			},
 
 			"musicTheme" : "music/Rampart",
@@ -128,11 +128,11 @@
 			"hallBackground": "TPTHBKRM.BMP",
 			"hallSlots":
 			[
-				[ [ 10, 11, 12, 13 ], [ 7, 8, 9 ], [ 5 ], [ 16 ] ],
-				[ [ 14, 15 ], [ 0, 1, 2, 3, 4 ], [ 17, 21 ] ],
-				[ [ 22 ], [ 24, 25 ], [ 18, 19 ] ],
-				[ [ 30, 37 ], [ 31, 38 ], [ 32, 39 ], [ 33, 40 ] ],
-				[ [ 34, 41 ], [ 35, 42 ], [ 36, 43 ] ]
+				[ [ "villageHall", "townHall", "cityHall", "capitol" ], [ "fort", "citadel", "castle" ], [ "tavern" ], [ "blacksmith" ] ],
+				[ [ "marketplace", "resourceSilo" ], [ "mageGuild1", "mageGuild2", "mageGuild3", "mageGuild4", "mageGuild5" ], [ "special1", "special2" ] ],
+				[ [ "special3" ], [ "horde2", "horde2Upgr" ], [ "horde1", "horde1Upgr" ] ],
+				[ [ "dwellingLvl1", "dwellingUpLvl1" ], [ "dwellingLvl2", "dwellingUpLvl2" ], [ "dwellingLvl3", "dwellingUpLvl3" ], [ "dwellingLvl4", "dwellingUpLvl4" ] ],
+				[ [ "dwellingLvl5", "dwellingUpLvl5" ], [ "dwellingLvl6", "dwellingUpLvl6" ], [ "dwellingLvl7", "dwellingUpLvl7" ] ]
 			],
 			"creatures" :
 			[
@@ -153,46 +153,49 @@
 			"buildings" :
 			{
 				"mageGuild1":     { "id" : 0 },
-				"mageGuild2":     { "id" : 1,  "upgrades" : 0 },
-				"mageGuild3":     { "id" : 2,  "upgrades" : 1 },
-				"mageGuild4":     { "id" : 3,  "upgrades" : 2 },
-				"mageGuild5":     { "id" : 4,  "upgrades" : 3 },
+				"mageGuild2":     { "id" : 1,  "upgrades" : "mageGuild1" },
+				"mageGuild3":     { "id" : 2,  "upgrades" : "mageGuild2" },
+				"mageGuild4":     { "id" : 3,  "upgrades" : "mageGuild3" },
+				"mageGuild5":     { "id" : 4,  "upgrades" : "mageGuild4" },
 				"tavern":         { "id" : 5 },
 				"fort":           { "id" : 7 },
-				"citadel":        { "id" : 8,  "upgrades" : 7 },
-				"castle":         { "id" : 9,  "upgrades" : 8 },
+				"citadel":        { "id" : 8,  "upgrades" : "fort" },
+				"castle":         { "id" : 9,  "upgrades" : "castle" },
 				"villageHall":    { "id" : 10, "mode" : "auto" },
-				"townHall":       { "id" : 11, "upgrades" : 10, "requires" : [ 5 ] },
-				"cityHall":       { "id" : 12, "upgrades" : 11, "requires" : [ 0, 14, 16 ] },
-				"capitol":        { "id" : 13, "upgrades" : 12, "requires" : [ 9 ] },
+				"townHall":       { "id" : 11, "upgrades" : "villageHall", "requires" : [ "tavern" ] },
+				"cityHall":       { "id" : 12, "upgrades" : "townHall", "requires" : [ "allOf", [ "mageGuild1" ], [ "marketplace" ], [ "blacksmith" ] ] },
+				"capitol":        { "id" : 13, "upgrades" : "cityHall", "requires" : [ "castle" ] },
 				"marketplace":    { "id" : 14 },
-				"resourceSilo":  { "id" : 15, "requires" : [ 14 ] },
+				"resourceSilo":   { "id" : 15, "requires" : [ "marketplace" ] },
 				"blacksmith":     { "id" : 16 },
+
 				"special1":       { "id" : 17 },
-				"horde1":         { "id" : 18, "upgrades" : 31 },
-				"horde1Upgr":     { "id" : 19, "upgrades" : 38, "requires" : [ 18 ], "mode" : "auto" },
-				"special2":       { "id" : 21, "requires" : [ 17 ] },
-				"special3":       { "id" : 22, "requires" : [ 18 ] },
-				"horde2":         { "id" : 24, "upgrades" : 34 },
-				"horde2Upgr":     { "id" : 25, "upgrades" : 41, "requires" : [ 24 ], "mode" : "auto" },
+				"horde1":         { "id" : 18, "upgrades" : "dwellingLvl2" },
+				"horde1Upgr":     { "id" : 19, "upgrades" : "dwellingUpLvl2", "requires" : [ "horde1" ], "mode" : "auto" },
+				"special2":       { "id" : 21, "requires" : [ "special1" ] },
+				"special3":       { "id" : 22, "requires" : [ "horde1" ] },
+				"horde2":         { "id" : 24, "upgrades" : "dwellingLvl5" },
+				"horde2Upgr":     { "id" : 25, "upgrades" : "dwellingUpLvl5", "requires" : [ "horde2" ], "mode" : "auto" },
 				"grail":          { "id" : 26, "mode" : "grail"},
-				"extraTownHall":  { "id" : 27, "requires" : [ 11 ], "mode" : "auto" },
-				"extraCityHall":  { "id" : 28, "requires" : [ 12 ], "mode" : "auto" },
-				"extraCapitol":   { "id" : 29, "requires" : [ 13 ], "mode" : "auto" },
-				"dwellingLvl1":   { "id" : 30, "requires" : [ 7 ] },
-				"dwellingLvl2":   { "id" : 31, "requires" : [ 30 ] },
-				"dwellingLvl3":   { "id" : 32, "requires" : [ 30 ] },
-				"dwellingLvl4":   { "id" : 33, "requires" : [ 32 ] },
-				"dwellingLvl5":   { "id" : 34, "requires" : [ 32 ] },
+				"extraTownHall":  { "id" : 27, "requires" : [ "townHall" ], "mode" : "auto" },
+				"extraCityHall":  { "id" : 28, "requires" : [ "cityHall" ], "mode" : "auto" },
+				"extraCapitol":   { "id" : 29, "requires" : [ "capitol" ], "mode" : "auto" },
+
+				"dwellingLvl1":   { "id" : 30, "requires" : [ "fort" ] },
+				"dwellingLvl2":   { "id" : 31, "requires" : [ "dwellingLvl1" ] },
+				"dwellingLvl3":   { "id" : 32, "requires" : [ "dwellingLvl1" ] },
+				"dwellingLvl4":   { "id" : 33, "requires" : [ "dwellingLvl3" ] },
+				"dwellingLvl5":   { "id" : 34, "requires" : [ "dwellingLvl3" ] },
 				"dwellingLvl6":   { "id" : 35, "requires" : [ "allOf", [ "dwellingLvl3" ], [ "dwellingLvl4" ] ] },
-				"dwellingLvl7":   { "id" : 36, "requires" : [ 35, 1 ] },
-				"dwellingUpLvl1": { "id" : 37, "upgrades" : 30 },
-				"dwellingUpLvl2": { "id" : 38, "upgrades" : 31 },
-				"dwellingUpLvl3": { "id" : 39, "upgrades" : 32 },
-				"dwellingUpLvl4": { "id" : 40, "upgrades" : 33 },
-				"dwellingUpLvl5": { "id" : 41, "upgrades" : 34 },
-				"dwellingUpLvl6": { "id" : 42, "upgrades" : 35 },
-				"dwellingUpLvl7": { "id" : 43, "upgrades" : 36, "requires" : [ 2 ] },
+				"dwellingLvl7":   { "id" : 36, "requires" : [ "allOf", [ "dwellingLvl6" ], [ "mageGuild2" ] ] },
+
+				"dwellingUpLvl1": { "id" : 37, "upgrades" : "dwellingLvl1" },
+				"dwellingUpLvl2": { "id" : 38, "upgrades" : "dwellingLvl2" },
+				"dwellingUpLvl3": { "id" : 39, "upgrades" : "dwellingLvl3" },
+				"dwellingUpLvl4": { "id" : 40, "upgrades" : "dwellingLvl4" },
+				"dwellingUpLvl5": { "id" : 41, "upgrades" : "dwellingLvl5" },
+				"dwellingUpLvl6": { "id" : 42, "upgrades" : "dwellingLvl6" },
+				"dwellingUpLvl7": { "id" : 43, "upgrades" : "dwellingLvl7", "requires" : [ "mageGuild3" ] },
 				
 				"ship" : null,
 				"shipyard" : null,

+ 71 - 68
config/factions/stronghold.json

@@ -76,41 +76,41 @@
 			"structures" :
 			{
 				"extraAnimation": { "animation" : "TBSTEXT3.def", "x" : 23,  "y" : 20 },
-				"mageGuild1":     { "id" : 0,  "animation" : "TBSTMAGE.def", "x" : 473, "y" : 67,  "z" : -1, "border" : "TOSMAG1.bmp",  "area" : "TZSMAG1.bmp" },
-				"mageGuild2":     { "id" : 1,  "animation" : "TBSTMAG2.def", "x" : 473, "y" : 37,  "z" : -1, "border" : "TOSMAG2.bmp",  "area" : "TZSMAG2.bmp" },
-				"mageGuild3":     { "id" : 2,  "animation" : "TBSTMAG3.def", "x" : 473, "y" : 1,   "z" : -1, "border" : "TOSMAG3.bmp",  "area" : "TZSMAG3.bmp" },
-				"tavern":         { "id" : 5,  "animation" : "TBSTTVRN.def", "x" : 170, "y" : 280, "z" : 2,  "border" : "TOSTAV.bmp",   "area" : "TZSTAV.bmp" },
-				"fort":           { "id" : 7,  "animation" : "TBSTCSTL.def", "x" : 402, "y" : 148, "z" : -1, "border" : "TOSCA1.bmp",   "area" : "TZSCA1.bmp" },
-				"citadel":        { "id" : 8,  "animation" : "TBSTCAS2.def", "x" : 402, "y" : 114, "z" : -1, "border" : "TOSCA2.bmp",   "area" : "TZSCA2.bmp" },
-				"castle":         { "id" : 9,  "animation" : "TBSTCAS3.def", "x" : 402, "y" : 114, "z" : -1, "border" : "TOSCA3.bmp",   "area" : "TZSCA3.bmp" },
-				"villageHall":    { "id" : 10, "animation" : "TBSTHALL.def", "x" : 0,   "y" : 259, "border" : "TOSHAL1A.bmp", "area" : "TZSHAL1A.bmp" },
-				"townHall":       { "id" : 11, "animation" : "TBSTHAL2.def", "x" : 0,   "y" : 225, "border" : "TOSHAL2A.bmp", "area" : "TZSHAL2A.bmp" },
-				"cityHall":       { "id" : 12, "animation" : "TBSTHAL3.def", "x" : 0,   "y" : 201, "border" : "TOSHAL3A.bmp", "area" : "TZSHAL3A.bmp" },
-				"capitol":        { "id" : 13, "animation" : "TBSTHAL4.def", "x" : 0,   "y" : 148, "border" : "TOSHAL4A.bmp", "area" : "TZSHAL4A.bmp" },
-				"marketplace":    { "id" : 14, "animation" : "TBSTMARK.def", "x" : 397, "y" : 308, "z" : 1,  "border" : "TOSMRK1.bmp",  "area" : "TZSMRK1.bmp" },
-				"resourceSilo":  { "id" : 15, "animation" : "TBSTSILO.def", "x" : 458, "y" : 248, "z" : 1,  "border" : "TOSMRK2.bmp",  "area" : "TZSMRK2.bmp" },
-				"blacksmith":     { "id" : 16, "animation" : "TBSTBLAK.def", "x" : 660, "y" : 286, "border" : "TOSBLK1.bmp",  "area" : "TZSBLK1.bmp" },
-				"special1":       { "id" : 17, "animation" : "TBSTSPEC.def", "x" : 550, "y" : 229, "border" : "TOSCA1EA.bmp", "area" : "TZSCA1EA.bmp" },
-				"horde1":         { "id" : 18, "animation" : "TBSTHRD1.def", "x" : 373, "y" : 239, "border" : "TOSGOB1H.bmp", "area" : "TZSGOB1H.bmp", "hidden" : true },
-				"horde1Upgr":     { "id" : 19, "animation" : "TBSTHRD2.def", "x" : 373, "y" : 220, "border" : "TOSGOB2H.bmp", "area" : "TZSGOB2H.bmp", "hidden" : true, "builds" : 18 },
-				"special2":       { "id" : 21, "animation" : "TBSTEXT0.def", "x" : 473, "y" : 282, "z" : 3,  "border" : "TOSMRK1C.bmp", "area" : "TZSMRK1C.bmp" },
-				"special3":       { "id" : 22, "animation" : "TBSTEXT1.def", "x" : 617, "y" : 286, "z" : 1,  "border" : "TOSBLK2.bmp",  "area" : "TZSBLK2.bmp" },
-				"special4":       { "id" : 23, "animation" : "TBSTEXT2.def", "x" : 313, "y" : 13,  "z" : -1, "border" : "TOSVAH.bmp",   "area" : "TZSVAH.bmp" },
-				"grail":          { "id" : 26, "animation" : "TBSTHOLY.def", "x" : 321, "y" : 105, "z" : 2,  "border" : "TOSHOLYA.bmp", "area" : "TZSHOLYA.bmp" },
-				"dwellingLvl1":   { "id" : 30, "animation" : "TBSTDW_0.def", "x" : 373, "y" : 239, "border" : "TOSGOB1.bmp",  "area" : "TZSGOB1.bmp" },
-				"dwellingLvl2":   { "id" : 31, "animation" : "TBSTDW_1.def", "x" : 266, "y" : 246, "z" : 1,  "border" : "TOSWOL1.bmp",  "area" : "TZSWOL1.bmp" },
-				"dwellingLvl3":   { "id" : 32, "animation" : "TBSTDW_2.def", "x" : 566, "y" : 232, "z" : 2,  "border" : "TOSORC1.bmp",  "area" : "TZSORC1.bmp" },
-				"dwellingLvl4":   { "id" : 33, "animation" : "TBSTDW_3.def", "x" : 197, "y" : 204, "border" : "TOSOGR1.bmp",  "area" : "TZSOGR1.bmp" },
-				"dwellingLvl5":   { "id" : 34, "animation" : "TBSTDW_4.def", "x" : 137, "y" : 30,  "z" : -1, "border" : "TOSROC1.bmp",  "area" : "TZSROC1.bmp" },
-				"dwellingLvl6":   { "id" : 35, "animation" : "TBSTDW_5.def", "x" : 622, "y" : 160, "z" : -2, "border" : "TOSCYC1.bmp",  "area" : "TZSCYC1.bmp" },
-				"dwellingLvl7":   { "id" : 36, "animation" : "TBSTDW_6.def", "x" : 604, "y" : 0,   "border" : "TOSBEH1A.bmp", "area" : "TZSBEH1A.bmp" },
-				"dwellingUpLvl1": { "id" : 37, "animation" : "TBSTUP_0.def", "x" : 373, "y" : 220, "border" : "TOSGOB2.bmp",  "area" : "TZSGOB2.bmp" },
-				"dwellingUpLvl2": { "id" : 38, "animation" : "TBSTUP_1.def", "x" : 266, "y" : 225, "z" : 1,  "border" : "TOSWOL2.bmp",  "area" : "TZSWOL2.bmp" },
-				"dwellingUpLvl3": { "id" : 39, "animation" : "TBSTUP_2.def", "x" : 566, "y" : 158, "z" : 2,  "border" : "TOSORC2.bmp",  "area" : "TZSORC2.bmp" },
-				"dwellingUpLvl4": { "id" : 40, "animation" : "TBSTUP_3.def", "x" : 197, "y" : 137, "border" : "TOSOGR2.bmp",  "area" : "TZSOGR2.bmp" },
-				"dwellingUpLvl5": { "id" : 41, "animation" : "TBSTUP_4.def", "x" : 129, "y" : 15,  "z" : -1, "border" : "TOSROC2.bmp",  "area" : "TZSROC2.bmp" },
-				"dwellingUpLvl6": { "id" : 42, "animation" : "TBSTUP_5.def", "x" : 616, "y" : 93,  "z" : -2, "border" : "TOSCYC2A.bmp", "area" : "TZSCYC2A.bmp" },
-				"dwellingUpLvl7": { "id" : 43, "animation" : "TBSTUP_6.def", "x" : 604, "y" : 0,   "border" : "TOSBEH2A.bmp", "area" : "TZSBEH2A.bmp" }
+				"mageGuild1":     { "animation" : "TBSTMAGE.def", "x" : 473, "y" : 67,  "z" : -1, "border" : "TOSMAG1.bmp",  "area" : "TZSMAG1.bmp" },
+				"mageGuild2":     { "animation" : "TBSTMAG2.def", "x" : 473, "y" : 37,  "z" : -1, "border" : "TOSMAG2.bmp",  "area" : "TZSMAG2.bmp" },
+				"mageGuild3":     { "animation" : "TBSTMAG3.def", "x" : 473, "y" : 1,   "z" : -1, "border" : "TOSMAG3.bmp",  "area" : "TZSMAG3.bmp" },
+				"tavern":         { "animation" : "TBSTTVRN.def", "x" : 170, "y" : 280, "z" : 2,  "border" : "TOSTAV.bmp",   "area" : "TZSTAV.bmp" },
+				"fort":           { "animation" : "TBSTCSTL.def", "x" : 402, "y" : 148, "z" : -1, "border" : "TOSCA1.bmp",   "area" : "TZSCA1.bmp" },
+				"citadel":        { "animation" : "TBSTCAS2.def", "x" : 402, "y" : 114, "z" : -1, "border" : "TOSCA2.bmp",   "area" : "TZSCA2.bmp" },
+				"castle":         { "animation" : "TBSTCAS3.def", "x" : 402, "y" : 114, "z" : -1, "border" : "TOSCA3.bmp",   "area" : "TZSCA3.bmp" },
+				"villageHall":    { "animation" : "TBSTHALL.def", "x" : 0,   "y" : 259, "border" : "TOSHAL1A.bmp", "area" : "TZSHAL1A.bmp" },
+				"townHall":       { "animation" : "TBSTHAL2.def", "x" : 0,   "y" : 225, "border" : "TOSHAL2A.bmp", "area" : "TZSHAL2A.bmp" },
+				"cityHall":       { "animation" : "TBSTHAL3.def", "x" : 0,   "y" : 201, "border" : "TOSHAL3A.bmp", "area" : "TZSHAL3A.bmp" },
+				"capitol":        { "animation" : "TBSTHAL4.def", "x" : 0,   "y" : 148, "border" : "TOSHAL4A.bmp", "area" : "TZSHAL4A.bmp" },
+				"marketplace":    { "animation" : "TBSTMARK.def", "x" : 397, "y" : 308, "z" : 1,  "border" : "TOSMRK1.bmp",  "area" : "TZSMRK1.bmp" },
+				"resourceSilo":   { "animation" : "TBSTSILO.def", "x" : 458, "y" : 248, "z" : 1,  "border" : "TOSMRK2.bmp",  "area" : "TZSMRK2.bmp" },
+				"blacksmith":     { "animation" : "TBSTBLAK.def", "x" : 660, "y" : 286, "border" : "TOSBLK1.bmp",  "area" : "TZSBLK1.bmp" },
+				"special1":       { "animation" : "TBSTSPEC.def", "x" : 550, "y" : 229, "border" : "TOSCA1EA.bmp", "area" : "TZSCA1EA.bmp" },
+				"horde1":         { "animation" : "TBSTHRD1.def", "x" : 373, "y" : 239, "border" : "TOSGOB1H.bmp", "area" : "TZSGOB1H.bmp", "hidden" : true },
+				"horde1Upgr":     { "animation" : "TBSTHRD2.def", "x" : 373, "y" : 220, "border" : "TOSGOB2H.bmp", "area" : "TZSGOB2H.bmp", "hidden" : true, "builds" : "horde1" },
+				"special2":       { "animation" : "TBSTEXT0.def", "x" : 473, "y" : 282, "z" : 3,  "border" : "TOSMRK1C.bmp", "area" : "TZSMRK1C.bmp" },
+				"special3":       { "animation" : "TBSTEXT1.def", "x" : 617, "y" : 286, "z" : 1,  "border" : "TOSBLK2.bmp",  "area" : "TZSBLK2.bmp" },
+				"special4":       { "animation" : "TBSTEXT2.def", "x" : 313, "y" : 13,  "z" : -1, "border" : "TOSVAH.bmp",   "area" : "TZSVAH.bmp" },
+				"grail":          { "animation" : "TBSTHOLY.def", "x" : 321, "y" : 105, "z" : 2,  "border" : "TOSHOLYA.bmp", "area" : "TZSHOLYA.bmp" },
+				"dwellingLvl1":   { "animation" : "TBSTDW_0.def", "x" : 373, "y" : 239, "border" : "TOSGOB1.bmp",  "area" : "TZSGOB1.bmp" },
+				"dwellingLvl2":   { "animation" : "TBSTDW_1.def", "x" : 266, "y" : 246, "z" : 1,  "border" : "TOSWOL1.bmp",  "area" : "TZSWOL1.bmp" },
+				"dwellingLvl3":   { "animation" : "TBSTDW_2.def", "x" : 566, "y" : 232, "z" : 2,  "border" : "TOSORC1.bmp",  "area" : "TZSORC1.bmp" },
+				"dwellingLvl4":   { "animation" : "TBSTDW_3.def", "x" : 197, "y" : 204, "border" : "TOSOGR1.bmp",  "area" : "TZSOGR1.bmp" },
+				"dwellingLvl5":   { "animation" : "TBSTDW_4.def", "x" : 137, "y" : 30,  "z" : -1, "border" : "TOSROC1.bmp",  "area" : "TZSROC1.bmp" },
+				"dwellingLvl6":   { "animation" : "TBSTDW_5.def", "x" : 622, "y" : 160, "z" : -2, "border" : "TOSCYC1.bmp",  "area" : "TZSCYC1.bmp" },
+				"dwellingLvl7":   { "animation" : "TBSTDW_6.def", "x" : 604, "y" : 0,   "border" : "TOSBEH1A.bmp", "area" : "TZSBEH1A.bmp" },
+				"dwellingUpLvl1": { "animation" : "TBSTUP_0.def", "x" : 373, "y" : 220, "border" : "TOSGOB2.bmp",  "area" : "TZSGOB2.bmp" },
+				"dwellingUpLvl2": { "animation" : "TBSTUP_1.def", "x" : 266, "y" : 225, "z" : 1,  "border" : "TOSWOL2.bmp",  "area" : "TZSWOL2.bmp" },
+				"dwellingUpLvl3": { "animation" : "TBSTUP_2.def", "x" : 566, "y" : 158, "z" : 2,  "border" : "TOSORC2.bmp",  "area" : "TZSORC2.bmp" },
+				"dwellingUpLvl4": { "animation" : "TBSTUP_3.def", "x" : 197, "y" : 137, "border" : "TOSOGR2.bmp",  "area" : "TZSOGR2.bmp" },
+				"dwellingUpLvl5": { "animation" : "TBSTUP_4.def", "x" : 129, "y" : 15,  "z" : -1, "border" : "TOSROC2.bmp",  "area" : "TZSROC2.bmp" },
+				"dwellingUpLvl6": { "animation" : "TBSTUP_5.def", "x" : 616, "y" : 93,  "z" : -2, "border" : "TOSCYC2A.bmp", "area" : "TZSCYC2A.bmp" },
+				"dwellingUpLvl7": { "animation" : "TBSTUP_6.def", "x" : 604, "y" : 0,   "border" : "TOSBEH2A.bmp", "area" : "TZSBEH2A.bmp" }
 			},
 
 			"musicTheme" : "music/Stronghold",
@@ -122,11 +122,11 @@
 			"hallBackground": "TPTHBKTW.BMP",
 			"hallSlots":
 			[
-				[ [ 10, 11, 12, 13 ], [ 7, 8, 9 ], [ 5 ], [ 16 ] ],
-				[ [ 14, 15 ], [ 0, 1, 2 ], [ 23 ], [ 17 ] ],
-				[ [ 21 ], [ 22 ], [ 18, 19 ] ],
-				[ [ 30, 37 ], [ 31, 38 ], [ 32, 39 ], [ 33, 40 ] ],
-				[ [ 34, 41 ], [ 35, 42 ], [ 36, 43 ] ]
+				[ [ "villageHall", "townHall", "cityHall", "capitol" ], [ "fort", "citadel", "castle" ], [ "tavern" ], [ "blacksmith" ] ],
+				[ [ "marketplace", "resourceSilo" ], [ "mageGuild1", "mageGuild2", "mageGuild3" ], [ "special4" ], [ "special1" ] ],
+				[ [ "special2" ], [ "special3" ], [ "horde1", "horde1Upgr" ] ],
+				[ [ "dwellingLvl1", "dwellingUpLvl1" ], [ "dwellingLvl2", "dwellingUpLvl2" ], [ "dwellingLvl3", "dwellingUpLvl3" ], [ "dwellingLvl4", "dwellingUpLvl4" ] ],
+				[ [ "dwellingLvl5", "dwellingUpLvl5" ], [ "dwellingLvl6", "dwellingUpLvl6" ], [ "dwellingLvl7", "dwellingUpLvl7" ] ]
 			],
 			"creatures" :
 			[
@@ -146,40 +146,43 @@
 			"buildings" :
 			{
 				"mageGuild1":     { "id" : 0 },
-				"mageGuild2":     { "id" : 1,  "upgrades" : 0 },
-				"mageGuild3":     { "id" : 2,  "upgrades" : 1 },
+				"mageGuild2":     { "id" : 1,  "upgrades" : "mageGuild1" },
+				"mageGuild3":     { "id" : 2,  "upgrades" : "mageGuild2" },
 				"tavern":         { "id" : 5 },
 				"fort":           { "id" : 7 },
-				"citadel":        { "id" : 8,  "upgrades" : 7 },
-				"castle":         { "id" : 9,  "upgrades" : 8 },
+				"citadel":        { "id" : 8,  "upgrades" : "fort" },
+				"castle":         { "id" : 9,  "upgrades" : "castle" },
 				"villageHall":    { "id" : 10, "mode" : "auto" },
-				"townHall":       { "id" : 11, "upgrades" : 10, "requires" : [ 5 ] },
-				"cityHall":       { "id" : 12, "upgrades" : 11, "requires" : [ 0, 14, 16 ] },
-				"capitol":        { "id" : 13, "upgrades" : 12, "requires" : [ 9 ] },
+				"townHall":       { "id" : 11, "upgrades" : "villageHall", "requires" : [ "tavern" ] },
+				"cityHall":       { "id" : 12, "upgrades" : "townHall", "requires" : [ "allOf", [ "mageGuild1" ], [ "marketplace" ], [ "blacksmith" ] ] },
+				"capitol":        { "id" : 13, "upgrades" : "cityHall", "requires" : [ "castle" ] },
 				"marketplace":    { "id" : 14 },
-				"resourceSilo":  { "id" : 15, "requires" : [ 14 ] },
+				"resourceSilo":   { "id" : 15, "requires" : [ "marketplace" ] },
 				"blacksmith":     { "id" : 16 },
-				"special1":       { "id" : 17, "requires" : [ 7 ] },
-				"horde1":         { "id" : 18, "upgrades" : 30 },
-				"horde1Upgr":     { "id" : 19, "upgrades" : 37, "requires" : [ 18 ], "mode" : "auto" },
-				"special2":       { "id" : 21, "requires" : [ 14 ] },
-				"special3":       { "id" : 22, "requires" : [ 16 ] },
-				"special4":       { "id" : 23, "requires" : [ 7 ] },
+
+				"special1":       { "id" : 17, "requires" : [ "fort" ] },
+				"horde1":         { "id" : 18, "upgrades" : "dwellingLvl1" },
+				"horde1Upgr":     { "id" : 19, "upgrades" : "dwellingUpLvl1", "requires" : [ "horde1" ], "mode" : "auto" },
+				"special2":       { "id" : 21, "requires" : [ "marketplace" ] },
+				"special3":       { "id" : 22, "requires" : [ "blacksmith" ] },
+				"special4":       { "id" : 23, "requires" : [ "fort" ] },
 				"grail":          { "id" : 26, "mode" : "grail"},
-				"dwellingLvl1":   { "id" : 30, "requires" : [ 7 ] },
-				"dwellingLvl2":   { "id" : 31, "requires" : [ 30 ] },
-				"dwellingLvl3":   { "id" : 32, "requires" : [ 30 ] },
-				"dwellingLvl4":   { "id" : 33, "requires" : [ 32 ] },
-				"dwellingLvl5":   { "id" : 34, "requires" : [ 31 ] },
-				"dwellingLvl6":   { "id" : 35, "requires" : [ 33 ] },
-				"dwellingLvl7":   { "id" : 36, "requires" : [ 34 ] },
-				"dwellingUpLvl1": { "id" : 37, "upgrades" : 30 },
-				"dwellingUpLvl2": { "id" : 38, "upgrades" : 31, "requires" : [ 37 ] },
-				"dwellingUpLvl3": { "id" : 39, "upgrades" : 32, "requires" : [ 16 ] },
-				"dwellingUpLvl4": { "id" : 40, "upgrades" : 33, "requires" : [ 0 ] },
-				"dwellingUpLvl5": { "id" : 41, "upgrades" : 34 },
-				"dwellingUpLvl6": { "id" : 42, "upgrades" : 35 },
-				"dwellingUpLvl7": { "id" : 43, "upgrades" : 36 },
+
+				"dwellingLvl1":   { "id" : 30, "requires" : [ "fort" ] },
+				"dwellingLvl2":   { "id" : 31, "requires" : [ "dwellingLvl1" ] },
+				"dwellingLvl3":   { "id" : 32, "requires" : [ "dwellingLvl1" ] },
+				"dwellingLvl4":   { "id" : 33, "requires" : [ "dwellingLvl3" ] },
+				"dwellingLvl5":   { "id" : 34, "requires" : [ "dwellingLvl2" ] },
+				"dwellingLvl6":   { "id" : 35, "requires" : [ "dwellingLvl4" ] },
+				"dwellingLvl7":   { "id" : 36, "requires" : [ "dwellingLvl5" ] },
+
+				"dwellingUpLvl1": { "id" : 37, "upgrades" : "dwellingLvl1" },
+				"dwellingUpLvl2": { "id" : 38, "upgrades" : "dwellingLvl2", "requires" : [ "dwellingUpLvl1" ] },
+				"dwellingUpLvl3": { "id" : 39, "upgrades" : "dwellingLvl3", "requires" : [ "blacksmith" ] },
+				"dwellingUpLvl4": { "id" : 40, "upgrades" : "dwellingLvl4", "requires" : [ "mageGuild1" ] },
+				"dwellingUpLvl5": { "id" : 41, "upgrades" : "dwellingLvl5" },
+				"dwellingUpLvl6": { "id" : 42, "upgrades" : "dwellingLvl6" },
+				"dwellingUpLvl7": { "id" : 43, "upgrades" : "dwellingLvl7" },
 				
 				"horde2" : null,
 				"horde2Upgr" : null,

+ 75 - 72
config/factions/tower.json

@@ -75,43 +75,43 @@
 			},
 			"structures" :
 			{
-				"mageGuild1":     { "id" : 0,  "animation" : "TBTWMAGE.def", "x" : 597, "y" : 82,  "border" : "TOTGLD1.bmp",  "area" : "TZTGLD1.bmp" },
-				"mageGuild2":     { "id" : 1,  "animation" : "TBTWMAG2.def", "x" : 593, "y" : 65,  "border" : "TOTGLD2.bmp",  "area" : "TZTGLD2.bmp" },
-				"mageGuild3":     { "id" : 2,  "animation" : "TBTWMAG3.def", "x" : 593, "y" : 48,  "border" : "TOTGLD3.bmp",  "area" : "TZTGLD3.bmp" },
-				"mageGuild4":     { "id" : 3,  "animation" : "TBTWMAG4.def", "x" : 593, "y" : 31,  "border" : "TOTGLD4.bmp",  "area" : "TZTGLD4.bmp" },
-				"mageGuild5":     { "id" : 4,  "animation" : "TBTWMAG5.def", "x" : 593, "y" : 14,  "border" : "TOTGLD5.bmp",  "area" : "TZTGLD5.bmp" },
-				"tavern":         { "id" : 5,  "animation" : "TBTWTVRN.def", "x" : 375, "y" : 278, "z" : 1, "border" : "TOTTAV.bmp",   "area" : "TZTTAV.bmp" },
-				"fort":           { "id" : 7,  "animation" : "TBTWCSTL.def", "x" : 304, "y" : 0,   "border" : "TOTCAS1.bmp",  "area" : "TZTCAS1.bmp" },
-				"citadel":        { "id" : 8,  "animation" : "TBTWCAS2.def", "x" : 301, "y" : 0,   "border" : "TOTCAS2.bmp",  "area" : "TZTCAS2.bmp" },
-				"castle":         { "id" : 9,  "animation" : "TBTWCAS3.def", "x" : 301, "y" : 0,   "border" : "TOTCAS3.bmp",  "area" : "TZTCAS3.bmp" },
-				"villageHall":    { "id" : 10, "animation" : "TBTWHALL.def", "x" : 0,   "y" : 259, "z" : 1,  "border" : "TOTHAL1.bmp",  "area" : "TZTHAL1.bmp" },
-				"townHall":       { "id" : 11, "animation" : "TBTWHAL2.def", "x" : 0,   "y" : 220, "z" : 1,  "border" : "TOTHAL2.bmp",  "area" : "TZTHAL2.bmp" },
-				"cityHall":       { "id" : 12, "animation" : "TBTWHAL3.def", "x" : 0,   "y" : 82,  "z" : 1,  "border" : "TOTHAL3.bmp",  "area" : "TZTHAL3.bmp" },
-				"capitol":        { "id" : 13, "animation" : "TBTWHAL4.def", "x" : 0,   "y" : 82,  "z" : 1,  "border" : "TOTHAL4.bmp",  "area" : "TZTHAL4.bmp" },
-				"marketplace":    { "id" : 14, "animation" : "TBTWMARK.def", "x" : 614, "y" : 292, "border" : "TOTMRK.bmp",   "area" : "TZTMRK.bmp" },
-				"resourceSilo":  { "id" : 15, "animation" : "TBTWSILO.def", "x" : 763, "y" : 214, "z" : 3, "border" : "TOTMRKS.bmp",  "area" : "TZTMRKS.bmp" },
-				"blacksmith":     { "id" : 16, "animation" : "TBTWBLAK.def", "x" : 478, "y" : 211, "border" : "TOTBLKA.bmp",  "area" : "TZTBLKA.bmp" },
-				"special1":       { "id" : 17, "animation" : "TBTWSPEC.def", "x" : 674, "y" : 276, "z" : 2, "border" : "TOTMRKA.bmp",  "area" : "TZTMRKA.bmp" },
-				"horde1":         { "id" : 18, "animation" : "TBTWHRD1.def", "x" : 0,   "y" : 47,  "border" : "TOTGAR1H.bmp", "area" : "TZTGAR1H.bmp", "hidden" : true },
-				"horde1Upgr":     { "id" : 19, "animation" : "TBTWHRD2.def", "x" : 0,   "y" : 28,  "border" : "TOTGAR2H.bmp", "area" : "TZTGAR2H.bmp", "hidden" : true, "builds" : 18 },
-				"special2":       { "id" : 21, "animation" : "TBTWEXT0.def", "x" : 409, "y" : 82,  "border" : "TOTCASW.bmp",  "area" : "TZTCASW.bmp" },
-				"special3":       { "id" : 22, "animation" : "TBTWEXT1.def", "x" : 702, "y" : 115, "border" : "TOTGLDL.bmp",  "area" : "TZTGLDL.bmp" },
-				"special4":       { "id" : 23, "animation" : "TBTWEXT2.def", "x" : 592, "y" : 189, "z" : 1,  "border" : "TOTGLDW.bmp",  "area" : "TZTGLDW.bmp" },
-				"grail":          { "id" : 26, "animation" : "TBTWHOLY.def", "x" : 237, "y" : 14,  "z" : -1, "border" : "TOTHOLYA.bmp", "area" : "TZTHOLYA.bmp" },
-				"dwellingLvl1":   { "id" : 30, "animation" : "TBTWDW_0.def", "x" : 453, "y" : 221, "z" : 1,  "border" : "TOTGRM1A.bmp", "area" : "TZTGRM1A.bmp" },
-				"dwellingLvl2":   { "id" : 31, "animation" : "TBTWDW_1.def", "x" : 4,   "y" : 46,  "border" : "TOTGAR1.bmp",  "area" : "TZTGAR1.bmp" },
-				"dwellingLvl3":   { "id" : 32, "animation" : "TBTWDW_2.def", "x" : 209, "y" : 177, "z" : 1,  "border" : "TOTGOL1A.bmp", "area" : "TZTGOL1A.bmp" },
-				"dwellingLvl4":   { "id" : 33, "animation" : "TBTWDW_3.def", "x" : 613, "y" : 95,  "border" : "TOTMAG1.bmp",  "area" : "TZTMAG1.bmp" },
-				"dwellingLvl5":   { "id" : 34, "animation" : "TBTWDW_4.def", "x" : 511, "y" : 75,  "border" : "TOTGEN1.bmp",  "area" : "TZTGEN1.bmp" },
-				"dwellingLvl6":   { "id" : 35, "animation" : "TBTWDW_5.def", "x" : 681, "y" : 208, "z" : 2,  "border" : "TOTNAG1.bmp",  "area" : "TZTNAG1.bmp" },
-				"dwellingLvl7":   { "id" : 36, "animation" : "TBTWDW_6.def", "x" : 75,  "y" : 144, "z" : -1, "border" : "TOTTIT1.bmp",  "area" : "TZTTIT1.bmp" },
-				"dwellingUpLvl1": { "id" : 37, "animation" : "TBTWUP_0.def", "x" : 446, "y" : 221, "z" : 1,  "border" : "TOTGRM2A.bmp", "area" : "TZTGRM2A.bmp" },
-				"dwellingUpLvl2": { "id" : 38, "animation" : "TBTWUP_1.def", "x" : 4,   "y" : 28,  "border" : "TOTGAR2.bmp",  "area" : "TZTGAR2.bmp" },
-				"dwellingUpLvl3": { "id" : 39, "animation" : "TBTWUP_2.def", "x" : 209, "y" : 177, "z" : 1,  "border" : "TOTGOL2A.bmp", "area" : "TZTGOL2A.bmp" },
-				"dwellingUpLvl4": { "id" : 40, "animation" : "TBTWUP_3.def", "x" : 613, "y" : 74,  "border" : "TOTMAG2.bmp",  "area" : "TZTMAG2.bmp" },
-				"dwellingUpLvl5": { "id" : 41, "animation" : "TBTWUP_4.def", "x" : 511, "y" : 8,   "border" : "TOTGEN2.bmp",  "area" : "TZTGEN2.bmp" },
-				"dwellingUpLvl6": { "id" : 42, "animation" : "TBTWUP_5.def", "x" : 681, "y" : 157, "z" : 2,  "border" : "TOTNAG2.bmp",  "area" : "TZTNAG2.bmp" },
-				"dwellingUpLvl7": { "id" : 43, "animation" : "TBTWUP_6.def", "x" : 75,  "y" : 91,  "z" : -1, "border" : "TOTTIT2.bmp",  "area" : "TZTTIT2.bmp" }
+				"mageGuild1":     { "animation" : "TBTWMAGE.def", "x" : 597, "y" : 82,  "border" : "TOTGLD1.bmp",  "area" : "TZTGLD1.bmp" },
+				"mageGuild2":     { "animation" : "TBTWMAG2.def", "x" : 593, "y" : 65,  "border" : "TOTGLD2.bmp",  "area" : "TZTGLD2.bmp" },
+				"mageGuild3":     { "animation" : "TBTWMAG3.def", "x" : 593, "y" : 48,  "border" : "TOTGLD3.bmp",  "area" : "TZTGLD3.bmp" },
+				"mageGuild4":     { "animation" : "TBTWMAG4.def", "x" : 593, "y" : 31,  "border" : "TOTGLD4.bmp",  "area" : "TZTGLD4.bmp" },
+				"mageGuild5":     { "animation" : "TBTWMAG5.def", "x" : 593, "y" : 14,  "border" : "TOTGLD5.bmp",  "area" : "TZTGLD5.bmp" },
+				"tavern":         { "animation" : "TBTWTVRN.def", "x" : 375, "y" : 278, "z" : 1, "border" : "TOTTAV.bmp",   "area" : "TZTTAV.bmp" },
+				"fort":           { "animation" : "TBTWCSTL.def", "x" : 304, "y" : 0,   "border" : "TOTCAS1.bmp",  "area" : "TZTCAS1.bmp" },
+				"citadel":        { "animation" : "TBTWCAS2.def", "x" : 301, "y" : 0,   "border" : "TOTCAS2.bmp",  "area" : "TZTCAS2.bmp" },
+				"castle":         { "animation" : "TBTWCAS3.def", "x" : 301, "y" : 0,   "border" : "TOTCAS3.bmp",  "area" : "TZTCAS3.bmp" },
+				"villageHall":    { "animation" : "TBTWHALL.def", "x" : 0,   "y" : 259, "z" : 1,  "border" : "TOTHAL1.bmp",  "area" : "TZTHAL1.bmp" },
+				"townHall":       { "animation" : "TBTWHAL2.def", "x" : 0,   "y" : 220, "z" : 1,  "border" : "TOTHAL2.bmp",  "area" : "TZTHAL2.bmp" },
+				"cityHall":       { "animation" : "TBTWHAL3.def", "x" : 0,   "y" : 82,  "z" : 1,  "border" : "TOTHAL3.bmp",  "area" : "TZTHAL3.bmp" },
+				"capitol":        { "animation" : "TBTWHAL4.def", "x" : 0,   "y" : 82,  "z" : 1,  "border" : "TOTHAL4.bmp",  "area" : "TZTHAL4.bmp" },
+				"marketplace":    { "animation" : "TBTWMARK.def", "x" : 614, "y" : 292, "border" : "TOTMRK.bmp",   "area" : "TZTMRK.bmp" },
+				"resourceSilo":   { "animation" : "TBTWSILO.def", "x" : 763, "y" : 214, "z" : 3, "border" : "TOTMRKS.bmp",  "area" : "TZTMRKS.bmp" },
+				"blacksmith":     { "animation" : "TBTWBLAK.def", "x" : 478, "y" : 211, "border" : "TOTBLKA.bmp",  "area" : "TZTBLKA.bmp" },
+				"special1":       { "animation" : "TBTWSPEC.def", "x" : 674, "y" : 276, "z" : 2, "border" : "TOTMRKA.bmp",  "area" : "TZTMRKA.bmp" },
+				"horde1":         { "animation" : "TBTWHRD1.def", "x" : 0,   "y" : 47,  "border" : "TOTGAR1H.bmp", "area" : "TZTGAR1H.bmp", "hidden" : true },
+				"horde1Upgr":     { "animation" : "TBTWHRD2.def", "x" : 0,   "y" : 28,  "border" : "TOTGAR2H.bmp", "area" : "TZTGAR2H.bmp", "hidden" : true, "builds" : "horde1" },
+				"special2":       { "animation" : "TBTWEXT0.def", "x" : 409, "y" : 82,  "border" : "TOTCASW.bmp",  "area" : "TZTCASW.bmp" },
+				"special3":       { "animation" : "TBTWEXT1.def", "x" : 702, "y" : 115, "border" : "TOTGLDL.bmp",  "area" : "TZTGLDL.bmp" },
+				"special4":       { "animation" : "TBTWEXT2.def", "x" : 592, "y" : 189, "z" : 1,  "border" : "TOTGLDW.bmp",  "area" : "TZTGLDW.bmp" },
+				"grail":          { "animation" : "TBTWHOLY.def", "x" : 237, "y" : 14,  "z" : -1, "border" : "TOTHOLYA.bmp", "area" : "TZTHOLYA.bmp" },
+				"dwellingLvl1":   { "animation" : "TBTWDW_0.def", "x" : 453, "y" : 221, "z" : 1,  "border" : "TOTGRM1A.bmp", "area" : "TZTGRM1A.bmp" },
+				"dwellingLvl2":   { "animation" : "TBTWDW_1.def", "x" : 4,   "y" : 46,  "border" : "TOTGAR1.bmp",  "area" : "TZTGAR1.bmp" },
+				"dwellingLvl3":   { "animation" : "TBTWDW_2.def", "x" : 209, "y" : 177, "z" : 1,  "border" : "TOTGOL1A.bmp", "area" : "TZTGOL1A.bmp" },
+				"dwellingLvl4":   { "animation" : "TBTWDW_3.def", "x" : 613, "y" : 95,  "border" : "TOTMAG1.bmp",  "area" : "TZTMAG1.bmp" },
+				"dwellingLvl5":   { "animation" : "TBTWDW_4.def", "x" : 511, "y" : 75,  "border" : "TOTGEN1.bmp",  "area" : "TZTGEN1.bmp" },
+				"dwellingLvl6":   { "animation" : "TBTWDW_5.def", "x" : 681, "y" : 208, "z" : 2,  "border" : "TOTNAG1.bmp",  "area" : "TZTNAG1.bmp" },
+				"dwellingLvl7":   { "animation" : "TBTWDW_6.def", "x" : 75,  "y" : 144, "z" : -1, "border" : "TOTTIT1.bmp",  "area" : "TZTTIT1.bmp" },
+				"dwellingUpLvl1": { "animation" : "TBTWUP_0.def", "x" : 446, "y" : 221, "z" : 1,  "border" : "TOTGRM2A.bmp", "area" : "TZTGRM2A.bmp" },
+				"dwellingUpLvl2": { "animation" : "TBTWUP_1.def", "x" : 4,   "y" : 28,  "border" : "TOTGAR2.bmp",  "area" : "TZTGAR2.bmp" },
+				"dwellingUpLvl3": { "animation" : "TBTWUP_2.def", "x" : 209, "y" : 177, "z" : 1,  "border" : "TOTGOL2A.bmp", "area" : "TZTGOL2A.bmp" },
+				"dwellingUpLvl4": { "animation" : "TBTWUP_3.def", "x" : 613, "y" : 74,  "border" : "TOTMAG2.bmp",  "area" : "TZTMAG2.bmp" },
+				"dwellingUpLvl5": { "animation" : "TBTWUP_4.def", "x" : 511, "y" : 8,   "border" : "TOTGEN2.bmp",  "area" : "TZTGEN2.bmp" },
+				"dwellingUpLvl6": { "animation" : "TBTWUP_5.def", "x" : 681, "y" : 157, "z" : 2,  "border" : "TOTNAG2.bmp",  "area" : "TZTNAG2.bmp" },
+				"dwellingUpLvl7": { "animation" : "TBTWUP_6.def", "x" : 75,  "y" : 91,  "z" : -1, "border" : "TOTTIT2.bmp",  "area" : "TZTTIT2.bmp" }
 			},
 
 			"musicTheme" : "music/TowerTown",
@@ -123,11 +123,11 @@
 			"hallBackground": "TPTHBKTW.BMP",
 			"hallSlots":
 			[
-				[ [ 10, 11, 12, 13 ], [ 7, 8, 9 ], [ 5 ], [ 16 ] ],
-				[ [ 14, 15 ], [ 0, 1, 2, 3, 4 ], [ 22 ], [ 23 ] ],
-				[ [ 17 ], [ 21 ], [ 18, 19 ] ],
-				[ [ 30, 37 ], [ 31, 38 ], [ 32, 39 ], [ 33, 40 ] ],
-				[ [ 34, 41 ], [ 35, 42 ], [ 36, 43 ] ]
+				[ [ "villageHall", "townHall", "cityHall", "capitol" ], [ "fort", "citadel", "castle" ], [ "tavern" ], [ "blacksmith" ] ],
+				[ [ "marketplace", "resourceSilo" ], [ "mageGuild1", "mageGuild2", "mageGuild3", "mageGuild4", "mageGuild5" ], [ "special3" ], [ "special4" ] ],
+				[ [ "special1" ], [ "special2" ], [ "horde1", "horde1Upgr" ] ],
+				[ [ "dwellingLvl1", "dwellingUpLvl1" ], [ "dwellingLvl2", "dwellingUpLvl2" ], [ "dwellingLvl3", "dwellingUpLvl3" ], [ "dwellingLvl4", "dwellingUpLvl4" ] ],
+				[ [ "dwellingLvl5", "dwellingUpLvl5" ], [ "dwellingLvl6", "dwellingUpLvl6" ], [ "dwellingLvl7", "dwellingUpLvl7" ] ]
 			],
 			"creatures" :
 			[
@@ -148,42 +148,45 @@
 			"buildings" :
 			{
 				"mageGuild1":     { "id" : 0 },
-				"mageGuild2":     { "id" : 1,  "upgrades" : 0 },
-				"mageGuild3":     { "id" : 2,  "upgrades" : 1 },
-				"mageGuild4":     { "id" : 3,  "upgrades" : 2 },
-				"mageGuild5":     { "id" : 4,  "upgrades" : 3 },
+				"mageGuild2":     { "id" : 1,  "upgrades" : "mageGuild1" },
+				"mageGuild3":     { "id" : 2,  "upgrades" : "mageGuild2" },
+				"mageGuild4":     { "id" : 3,  "upgrades" : "mageGuild3" },
+				"mageGuild5":     { "id" : 4,  "upgrades" : "mageGuild4" },
 				"tavern":         { "id" : 5 },
 				"fort":           { "id" : 7 },
-				"citadel":        { "id" : 8,  "upgrades" : 7 },
-				"castle":         { "id" : 9,  "upgrades" : 8 },
+				"citadel":        { "id" : 8,  "upgrades" : "fort" },
+				"castle":         { "id" : 9,  "upgrades" : "castle" },
 				"villageHall":    { "id" : 10, "mode" : "auto" },
-				"townHall":       { "id" : 11, "upgrades" : 10, "requires" : [ 5 ] },
-				"cityHall":       { "id" : 12, "upgrades" : 11, "requires" : [ 0, 14, 16 ] },
-				"capitol":        { "id" : 13, "upgrades" : 12, "requires" : [ 9 ] },
+				"townHall":       { "id" : 11, "upgrades" : "villageHall", "requires" : [ "tavern" ] },
+				"cityHall":       { "id" : 12, "upgrades" : "townHall", "requires" : [ "allOf", [ "mageGuild1" ], [ "marketplace" ], [ "blacksmith" ] ] },
+				"capitol":        { "id" : 13, "upgrades" : "cityHall", "requires" : [ "castle" ] },
 				"marketplace":    { "id" : 14 },
-				"resourceSilo":  { "id" : 15, "requires" : [ 14 ] },
+				"resourceSilo":   { "id" : 15, "requires" : [ "marketplace" ] },
 				"blacksmith":     { "id" : 16 },
-				"special1":       { "id" : 17, "requires" : [ 14 ] },
-				"horde1":         { "id" : 18, "upgrades" : 31 },
-				"horde1Upgr":     { "id" : 19, "upgrades" : 38, "requires" : [ 18 ], "mode" : "auto" },
-				"special2":       { "id" : 21, "requires" : [ 7 ] },
-				"special3":       { "id" : 22, "requires" : [ 0 ] },
-				"special4":       { "id" : 23, "requires" : [ 0 ] },
+
+				"special1":       { "id" : 17, "requires" : [ "marketplace" ] },
+				"horde1":         { "id" : 18, "upgrades" : "dwellingLvl2" },
+				"horde1Upgr":     { "id" : 19, "upgrades" : "dwellingUpLvl2", "requires" : [ "horde1" ], "mode" : "auto" },
+				"special2":       { "id" : 21, "requires" : [ "fort" ] },
+				"special3":       { "id" : 22, "requires" : [ "mageGuild1" ] },
+				"special4":       { "id" : 23, "requires" : [ "mageGuild1" ] },
 				"grail":          { "id" : 26, "mode" : "grail"},
-				"dwellingLvl1":   { "id" : 30, "requires" : [ 7 ] },
-				"dwellingLvl2":   { "id" : 31, "requires" : [ 30 ] },
-				"dwellingLvl3":   { "id" : 32, "requires" : [ 30 ] },
-				"dwellingLvl4":   { "id" : 33, "requires" : [ 0, 31, 32 ] },
-				"dwellingLvl5":   { "id" : 34, "requires" : [ 33 ] },
-				"dwellingLvl6":   { "id" : 35, "requires" : [ 33 ] },
-				"dwellingLvl7":   { "id" : 36, "requires" : [ 34, 35 ] },
-				"dwellingUpLvl1": { "id" : 37, "upgrades" : 30 },
-				"dwellingUpLvl2": { "id" : 38, "upgrades" : 31 },
-				"dwellingUpLvl3": { "id" : 39, "upgrades" : 32 },
-				"dwellingUpLvl4": { "id" : 40, "upgrades" : 33, "requires" : [ 22 ] },
-				"dwellingUpLvl5": { "id" : 41, "upgrades" : 34 },
-				"dwellingUpLvl6": { "id" : 42, "upgrades" : 35 },
-				"dwellingUpLvl7": { "id" : 43, "upgrades" : 36 },
+
+				"dwellingLvl1":   { "id" : 30, "requires" : [ "fort" ] },
+				"dwellingLvl2":   { "id" : 31, "requires" : [ "dwellingLvl1" ] },
+				"dwellingLvl3":   { "id" : 32, "requires" : [ "dwellingLvl1" ] },
+				"dwellingLvl4":   { "id" : 33, "requires" : [ "allOf", [ "mageGuild1" ], [ "dwellingLvl2" ], [ "dwellingLvl3" ] ] },
+				"dwellingLvl5":   { "id" : 34, "requires" : [ "dwellingLvl4" ] },
+				"dwellingLvl6":   { "id" : 35, "requires" : [ "dwellingLvl4" ] },
+				"dwellingLvl7":   { "id" : 36, "requires" : [ "dwellingLvl5", "dwellingLvl6" ] },
+
+				"dwellingUpLvl1": { "id" : 37, "upgrades" : "dwellingLvl1" },
+				"dwellingUpLvl2": { "id" : 38, "upgrades" : "dwellingLvl2" },
+				"dwellingUpLvl3": { "id" : 39, "upgrades" : "dwellingLvl3" },
+				"dwellingUpLvl4": { "id" : 40, "upgrades" : "dwellingLvl4", "requires" : [ "special3" ] },
+				"dwellingUpLvl5": { "id" : 41, "upgrades" : "dwellingLvl5" },
+				"dwellingUpLvl6": { "id" : 42, "upgrades" : "dwellingLvl6" },
+				"dwellingUpLvl7": { "id" : 43, "upgrades" : "dwellingLvl7" },
 
 				"horde2" : null,
 				"horde2Upgr" : null,

+ 1 - 1
config/schemas/faction.json

@@ -220,7 +220,7 @@
 						"items" : {
 							"type" : "array",
 							"description" : "List of buildings available in one slot",
-							"items" : { "type" : "number" }
+							"items" : { "type" : "string" }
 						}
 					}
 				},

+ 22 - 6
config/schemas/townBuilding.json

@@ -5,6 +5,25 @@
 	"title" : "VCMI town building format",
 	"description" : "Format used to define town buildings in VCMI",
 	"required": [ "id" ],
+
+	"definitions" :
+	{
+		"buildingRequirement" : {
+			"type" : "array",
+			"items" : [
+				{
+					"description" : "First item that indicates type of following expression",
+					"type" : "string"
+				}
+			],
+			"additionalItems" :
+			{
+				"description" : "Following items that contain expression elements",
+				"$ref" : "#/definitions/buidingRequirement"				
+			}
+		} 
+	},
+
 	"properties":{
 		"id": {
 			"type":"number",
@@ -16,15 +35,12 @@
 			"description" : "Mode in which this building will be built"
 		},
 		"requires": {
-			"type":"array",
-			"description" : "List of town buildings that must be built before this one",
-			"items": {
-				"type":"number"
-			}
+			"$ref" : "#/definitions/buildingRequirement",
+			"description" : "List of town buildings that must be built before this one"
 		},
 		"upgrades": {
 			"description" : "If this building is upgrade, identifier of base building",
-			"type":"number"
+			"type":"string"
 		},
 		"name" : {
 			"description" : "Name of this building",

+ 1 - 5
config/schemas/townStructure.json

@@ -22,17 +22,13 @@
 			"format" : "imageFile"
 		},
 		"builds": {
-			"type":"number",
+			"type" : "string",
 			"description" : ""
 		},
 		"hidden": {
 			"type":"boolean",
 			"description" : "If upgrade, this building will replace parent animation but will not alter its behaviour"
 		},
-		"id": {
-			"type":"number",
-			"description" : "Numeric identifier of building"
-		},
 		"x": {
 			"type":"number",
 			"description" : "Position on screen"

+ 1 - 1
lib/CObjectHandler.cpp

@@ -2134,7 +2134,7 @@ GrowthInfo CGTownInstance::getGrowthInfo(int level) const
 
 	if (level<0 || level >=GameConstants::CREATURES_PER_TOWN)
 		return ret;
-	if (!hasBuilt(BuildingID(BuildingID::DWELL_FIRST+level)))
+	if (creatures[level].second.empty())
 		return ret; //no dwelling
 
 	const CCreature *creature = VLC->creh->creatures[creatures[level].second.back()];

+ 38 - 9
lib/CTownHandler.cpp

@@ -302,7 +302,18 @@ void CTownHandler::loadBuilding(CTown &town, const std::string & stringID, const
 	loadBuildingRequirements(town, *ret, source["requires"]);
 
 	if (!source["upgrades"].isNull())
-		ret->upgrade = BuildingID(source["upgrades"].Float());
+	{
+		//MODS COMPATIBILITY
+		if (source["upgrades"].getType() == JsonNode::DATA_FLOAT)
+			ret->upgrade = BuildingID(source["upgrades"].Float());
+		else
+		{
+			VLC->modh->identifiers.requestIdentifier("building." + town.faction->identifier, source["upgrades"], [=](si32 identifier)
+			{
+				ret->upgrade = BuildingID(identifier);
+			});
+		}
+	}
 	else
 		ret->upgrade = BuildingID::NONE;
 
@@ -380,21 +391,39 @@ void CTownHandler::loadStructures(CTown &town, const JsonNode & source)
 
 void CTownHandler::loadTownHall(CTown &town, const JsonNode & source)
 {
-	for(const JsonNode &row : source.Vector())
+	auto & dstSlots = town.clientInfo.hallSlots;
+	auto & srcSlots = source.Vector();
+	dstSlots.resize(srcSlots.size());
+
+	for(size_t i=0; i<dstSlots.size(); i++)
 	{
-		std::vector< std::vector<BuildingID> > hallRow;
+		auto & dstRow = dstSlots[i];
+		auto & srcRow = srcSlots[i].Vector();
+		dstRow.resize(srcRow.size());
 
-		for(const JsonNode &box : row.Vector())
+		for(size_t j=0; j < dstRow.size(); j++)
 		{
-			std::vector<BuildingID> hallBox;
+			auto & dstBox = dstRow[j];
+			auto & srcBox = srcRow[j].Vector();
+			dstBox.resize(srcBox.size());
 
-			for(const JsonNode &value : box.Vector())
+			for(size_t k=0; k<dstBox.size(); k++)
 			{
-				hallBox.push_back(BuildingID(value.Float()));
+				auto & dst = dstBox[k];
+				auto & src = srcBox[k];
+
+				//MODS COMPATIBILITY
+				if (src.getType() == JsonNode::DATA_FLOAT)
+					dst = BuildingID(src.Float());
+				else
+				{
+					VLC->modh->identifiers.requestIdentifier("building." + town.faction->identifier, src, [&](si32 identifier)
+					{
+						dst = BuildingID(identifier);
+					});
+				}
 			}
-			hallRow.push_back(hallBox);
 		}
-		town.clientInfo.hallSlots.push_back(hallRow);
 	}
 }
 

+ 1 - 1
lib/JsonDetail.cpp

@@ -603,7 +603,7 @@ namespace
 			//Local reference. Turn it into more easy to handle remote ref
 			if (boost::algorithm::starts_with(URI, "#"))
 				URI = validator.usedSchemas.back() + URI;
-			return check(JsonUtils::getSchema(URI), data, validator);
+			return check(URI, data, validator);
 		}
 
 		std::string formatCheck(Validation::ValidationData & validator, const JsonNode & baseSchema, const JsonNode & schema, const JsonNode & data)

+ 1 - 17
lib/JsonNode.cpp

@@ -715,25 +715,9 @@ void JsonUtils::merge(JsonNode & dest, JsonNode & source)
 		case JsonNode::DATA_BOOL:
 		case JsonNode::DATA_FLOAT:
 		case JsonNode::DATA_STRING:
-		{
-			std::swap(dest, source);
-			break;
-		}
 		case JsonNode::DATA_VECTOR:
 		{
-			size_t total = std::min(source.Vector().size(), dest.Vector().size());
-
-			for (size_t i=0; i< total; i++)
-				merge(dest.Vector()[i], source.Vector()[i]);
-
-			if (dest.Vector().size() < source.Vector().size())
-			{
-				//reserve place and *move* remaining data from source to dest
-				source.Vector().reserve(source.Vector().size() + dest.Vector().size());
-
-				std::move(source.Vector().begin() + total, source.Vector().end(),
-				          std::back_inserter(dest.Vector()));
-			}
+			std::swap(dest, source);
 			break;
 		}
 		case JsonNode::DATA_STRUCT:

+ 1 - 1
server/CGameHandler.cpp

@@ -2402,7 +2402,7 @@ bool CGameHandler::buildStructure( ObjectInstanceID tid, BuildingID requestedID,
 			SetAvailableCreatures ssi;
 			ssi.tid = t->id;
 			ssi.creatures = t->creatures;
-			if (buildingID <= BuildingID::DWELL_LAST)
+			if (ssi.creatures[level].second.empty()) // first creature in a dwelling
 				ssi.creatures[level].first = crea->growth;
 			ssi.creatures[level].second.push_back(crea->idNumber);
 			sendAndApply(&ssi);