2
0
Эх сурвалжийг харах

loading secondary skill bonuses from config/skills.json works (kind of)

Henning Koehler 8 жил өмнө
parent
commit
05cf95400c

+ 4 - 0
config/gameConfig.json

@@ -76,5 +76,9 @@
 		"config/spells/other.json",
 		"config/spells/timed.json",
 		"config/spells/ability.json"
+	],
+	"skills" :
+	[
+        "config/skills.json"
 	]
 }

+ 33 - 0
config/schemas/skill.json

@@ -0,0 +1,33 @@
+{
+
+	"type":"object",
+	"$schema": "http://json-schema.org/draft-04/schema",
+
+	"title" : "VCMI skill format",
+	"description" : "Format used to replace bonuses provided by secondary skills in VCMI",
+
+	"definitions" : {
+
+        "skillBonus":{
+            "description": "Set of bonuses provided by skill at given level",
+            "type": "array",
+            "items":{
+                "$ref" : "vcmi:bonus"
+            }
+        },
+
+        "required" : ["basic", "advanced", "expert"],
+
+        "properties": {
+            "basic":{
+                "$ref" : "#/definitions/skillBonus"
+            },
+            "advanced":{
+                "$ref" : "#/definitions/skillBonus"
+            },
+            "expert":{
+                "$ref" : "#/definitions/skillBonus"
+            },
+        }
+	}
+}

+ 29 - 0
config/skills.json

@@ -0,0 +1,29 @@
+{
+    "estates" : {
+        "index" : 13,
+        "basic" : [
+            {
+                "subtype" : 13,
+                "type" : "SECONDARY_SKILL_PREMY",
+                "val" : 250,
+                "valueType" : "BASE_NUMBER"
+            }
+        ],
+        "advanced" : [
+            {
+                "subtype" : 13,
+                "type" : "SECONDARY_SKILL_PREMY",
+                "val" : 500,
+                "valueType" : "BASE_NUMBER"
+            }
+        ],
+        "expert" : [
+            {
+                "subtype" : 13,
+                "type" : "SECONDARY_SKILL_PREMY",
+                "val" : 1000,
+                "valueType" : "BASE_NUMBER"
+            }
+        ]
+    }
+}

+ 2 - 0
lib/CModHandler.cpp

@@ -23,6 +23,7 @@
 #include "CStopWatch.h"
 #include "IHandlerBase.h"
 #include "spells/CSpellHandler.h"
+#include "CSkillHandler.h"
 
 CIdentifierStorage::CIdentifierStorage():
 	state(LOADING)
@@ -420,6 +421,7 @@ CContentHandler::CContentHandler()
 	handlers.insert(std::make_pair("objects", ContentTypeHandler(VLC->objtypeh, "object")));
 	handlers.insert(std::make_pair("heroes", ContentTypeHandler(VLC->heroh, "hero")));
 	handlers.insert(std::make_pair("spells", ContentTypeHandler(VLC->spellh, "spell")));
+	handlers.insert(std::make_pair("skills", ContentTypeHandler(VLC->skillh, "skill")));
 	handlers.insert(std::make_pair("templates", ContentTypeHandler((IHandlerBase *)VLC->tplh, "template")));
 
 	//TODO: any other types of moddables?