Browse Source

Moved configuration of rewardable town building to 'configuration' entry

Ivan Savenko 1 year ago
parent
commit
2151a7fc88

+ 10 - 8
config/factions/castle.json

@@ -177,14 +177,16 @@
 				"special2":       {
 					"type" : "configurable",
 					"requires" : [ "dwellingLvl4" ],
-					"visitMode" : "bonus",
-					"rewards" : [
-						{
-							"message" : "@core.genrltxt.580",
-							"movePoints" : 400,
-							"bonuses" : [ { "type" : "MOVEMENT", "subtype" : "heroMovementLand",  "val" : 400, "valueType" : "ADDITIVE_VALUE", "duration" : "ONE_WEEK"} ]
-						}
-					]
+					"configuration" : {
+						"visitMode" : "bonus",
+						"rewards" : [
+							{
+								"message" : "@core.genrltxt.580",
+								"movePoints" : 400,
+								"bonuses" : [ { "type" : "MOVEMENT", "subtype" : "heroMovementLand",  "val" : 400, "valueType" : "ADDITIVE_VALUE", "duration" : "ONE_WEEK"} ]
+							}
+						]
+					}
 				},
 				"special3":       { "type" : "brotherhoodOfSword", "upgrades" : "tavern" },
 				"grail":          { "id" : 26, "mode" : "grail", "produce": { "gold": 5000 }, "bonuses": [ { "type": "MORALE", "val": 2, "propagator": "PLAYER_PROPAGATOR" } ] },

+ 25 - 21
config/factions/dungeon.json

@@ -177,31 +177,35 @@
 				"special2":       {
 					"type" : "configurable",
 					"requires" : [ "mageGuild1" ],
-					"resetParameters" : {
-						"period" : 7,
-						"visitors" : true
-					},
-					"visitMode" : "hero", // Should be 'once' to match (somewhat buggy) H3 logic
-					"rewards" : [
-						{
-							"limiter" : {
-								"noneOf" : [ { "manaPercentage" : 200 } ]
-							},
-							"message" : "@core.genrltxt.579",
-							"manaPercentage" : 200
-						}
-					]
+					"configuration" : {
+						"resetParameters" : {
+							"period" : 7,
+							"visitors" : true
+						},
+						"visitMode" : "hero", // Should be 'once' to match (somewhat buggy) H3 logic
+						"rewards" : [
+							{
+								"limiter" : {
+									"noneOf" : [ { "manaPercentage" : 200 } ]
+								},
+								"message" : "@core.genrltxt.579",
+								"manaPercentage" : 200
+							}
+						]
+					}
 				},
 				"special3":       { "type" : "portalOfSummoning" },
 				"special4":       {
 					"type" : "configurable",
-					"visitMode" : "hero",
-					"rewards" : [
-						{
-							"message" : "@core.genrltxt.583",
-							"experience" : 1000
-						}
-					]
+					"configuration" : {
+						"visitMode" : "hero",
+						"rewards" : [
+							{
+								"message" : "@core.genrltxt.583",
+								"experience" : 1000
+							}
+						]
+					}
 				},
 				"grail":          { "id" : 26, "mode" : "grail", "produce": { "gold": 5000 },
 					"bonuses": [ { "type": "PRIMARY_SKILL", "subtype": "primarySkill.spellpower", "val": 12 } ] },

+ 9 - 7
config/factions/fortress.json

@@ -172,13 +172,15 @@
 				"special1":       {
 					"type" : "configurable",
 					"requires" : [ "allOf", [ "townHall" ], [ "special2" ] ],
-					"visitMode" : "hero",
-					"rewards" : [
-						{
-							"message" : "@core.genrltxt.585",
-							"primary" : { "defence" : 1 }
-						}
-					]
+					"configuration" : {
+						"visitMode" : "hero",
+						"rewards" : [
+							{
+								"message" : "@core.genrltxt.585",
+								"primary" : { "defence" : 1 }
+							}
+						]
+					}
 				},
 				"horde1":         { "id" : 18, "upgrades" : "dwellingLvl1" },
 				"horde1Upgr":     { "id" : 19, "upgrades" : "dwellingUpLvl1", "requires" : [ "horde1" ], "mode" : "auto" },

+ 10 - 8
config/factions/inferno.json

@@ -178,14 +178,16 @@
 				"special4":       {
 					"type" : "configurable",
 					"requires" : [ "mageGuild1" ],
-					"visitMode" : "hero",
-					"rewards" : [
-						{
-							"message" : "@core.genrltxt.582",
-							"primary" : { "spellpower" : 1 }
-						}
-					]
-					},
+					"configuration" : {
+						"visitMode" : "hero",
+						"rewards" : [
+							{
+								"message" : "@core.genrltxt.582",
+								"primary" : { "spellpower" : 1 }
+							}
+						]
+					}
+				},
 				"horde2":         { "id" : 24, "upgrades" : "dwellingLvl3" },
 				"horde2Upgr":     { "id" : 25, "upgrades" : "dwellingUpLvl3", "requires" : [ "horde2" ], "mode" : "auto" },
 				"grail":          { "id" : 26, "mode" : "grail", "produce": { "gold": 5000 }},

+ 9 - 7
config/factions/stronghold.json

@@ -174,13 +174,15 @@
 				"special4":       { 
 					"type" : "configurable",
 					"requires" : [ "fort" ],
-					"visitMode" : "hero",
-					"rewards" : [
-						{
-							"message" : "@core.genrltxt.584",
-							"primary" : { "attack" : 1 }
-						}
-					]
+					"configuration" : {
+						"visitMode" : "hero",
+						"rewards" : [
+							{
+								"message" : "@core.genrltxt.584",
+								"primary" : { "attack" : 1 }
+							}
+						]
+					}
 				},
 				"grail":          { "id" : 26, "mode" : "grail", "produce": { "gold": 5000 },
 					"bonuses": [ { "type": "PRIMARY_SKILL", "subtype": "primarySkill.attack", "val": 20 } ] },

+ 9 - 7
config/factions/tower.json

@@ -177,13 +177,15 @@
 				"special4":       {
 					"type" : "configurable",
 					"requires" : [ "mageGuild1" ],
-					"visitMode" : "hero",
-					"rewards" : [
-						{
-							"message" : "@core.genrltxt.581",
-							"primary" : { "knowledge" : 1 }
-						}
-					]
+					"configuration" : {
+						"visitMode" : "hero",
+						"rewards" : [
+							{
+								"message" : "@core.genrltxt.581",
+								"primary" : { "knowledge" : 1 }
+							}
+						]
+					}
 				},
 				"grail":          { "height" : "skyship",  "produce" : { "gold": 5000 }, "bonuses": [ { "type": "PRIMARY_SKILL", "subtype": "primarySkill.knowledge", "val": 15 } ] },
 

+ 7 - 1
config/schemas/townBuilding.json

@@ -31,7 +31,7 @@
 			"type" : "string"
 		},
 		"description" : {
-			"description" : "Localizable decsription of this building",
+			"description" : "Localizable description of this building",
 			"type" : "string"
 		},
 		"type" : {
@@ -57,6 +57,12 @@
 			"description" : "Optional, indicates that this building upgrades another base building",
 			"type" : "string"
 		},
+		"configuration" : {
+			"description" : "Configuration of building. Only used if 'type' is set to 'configurable'",
+			//"$ref" : "#/definitions/rewardable",// TODO
+			"type" : "object",
+			"additionalProperties" : true
+		}
 		"cost" : {
 			"type" : "object",
 			"additionalProperties" : false,

+ 1 - 1
lib/entities/faction/CTownHandler.cpp

@@ -377,7 +377,7 @@ void CTownHandler::loadBuilding(CTown * town, const std::string & stringID, cons
 		}
 		
 		if(ret->subId == BuildingSubID::CUSTOM_VISITING_REWARD)
-			ret->rewardableObjectInfo.init(source, ret->getBaseTextID());
+			ret->rewardableObjectInfo.init(source["configuration"], ret->getBaseTextID());
 	}
 	//MODS COMPATIBILITY FOR 0.96
 	if(!ret->produce.nonZero())