Skip to content

Commit

Permalink
Merge pull request #3 from ZhilkinSerg/bugfix2
Browse files Browse the repository at this point in the history
Project files rearrange 2
  • Loading branch information
ZhilkinSerg authored Mar 26, 2017
2 parents 89d53c6 + d0b9097 commit c6fe3b6
Show file tree
Hide file tree
Showing 62 changed files with 451 additions and 769 deletions.
Binary file removed data/img/aboutbg.png
Binary file not shown.
28 changes: 28 additions & 0 deletions data/jschema/skill.jschema
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"properties": {
"description": {
"type": "string",
"required": true
},
"ident": {
"type": "string",
"required": true
},
"name": {
"type": "string",
"required": true
},
"tags": {
"items": {
"type": "string"
},
"type": "array",
"required": false
},
"type": {
"pattern": "skill",
"type": "string",
"required": true
}
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
24 changes: 13 additions & 11 deletions src/CataclysmHelper/Storage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -322,21 +322,21 @@ public static void InitializeFileDefs()

fileDef[(int)FileType.ITEMS] = new CataFile(
"id",
new JsonSchema("jsonschema_items.txt"));
new JsonSchema("schema_items.txt"));
fileDef[(int)FileType.BIONICS] = new CataFile("id");
fileDef[(int)FileType.ITEM_GROUPS] = new CataFile(
"id",
new JsonSchema("jsonschema_itemgroup.txt"));
new JsonSchema("schema_itemgroup.txt"));
fileDef[(int)FileType.MATERIALS] = new CataFile("ident");
fileDef[(int)FileType.MONSTER_GROUPS] = new CataFile("name");
fileDef[(int)FileType.NAMES] = new CataFile("name");
fileDef[(int)FileType.PROFESSIONS] = new CataFile(
"ident",
new JsonSchema("jsonschema_professions.txt"));
new JsonSchema("schema_professions.txt"));
fileDef[(int)FileType.RECIPES] = new CataFile(
"result",
"id_suffix",
new JsonSchema("jsonschema_recipes.txt"));
new JsonSchema("schema_recipes.txt"));
fileDef[(int)FileType.SKILLS] = new CataFile("ident");
fileDef[(int)FileType.SNIPPETS] = null;
fileDef[(int)FileType.NONE] = null;
Expand Down Expand Up @@ -458,11 +458,11 @@ public static void LoadFile(int index)
else if (ftype == FileType.RECIPES)
{
//Default parsing
foreach (Dictionary<string, object> item in (object[])((Dictionary<string, object>)json)["recipes"])
newItems.Add(new ItemDataWrapper(item, index));
////foreach (Dictionary<string, object> item in (object[])((Dictionary<string, object>)json)["recipes"])
//// newItems.Add(new ItemDataWrapper(item, index));

//Remove categories
CraftCategories = (object[])((Dictionary<string, object>)json)["categories"];
////CraftCategories = (object[])((Dictionary<string, object>)json)["categories"];
/*List<string> craftcats = new List<string>();
foreach (ItemDataWrapper c in newItems)
{
Expand All @@ -482,6 +482,7 @@ public static void LoadFile(int index)
}
else if (ftype == FileType.SKILLS)
{
/*
foreach (object[] item in (object[])json)
{
Dictionary<string, object> dict = new Dictionary<string, object>();
Expand All @@ -492,6 +493,7 @@ public static void LoadFile(int index)
dict.Add("tags", item[3]);
newItems.Add(new ItemDataWrapper(dict, index));
}
*/
}
else if (ftype != FileType.NONE)
{
Expand Down Expand Up @@ -589,7 +591,7 @@ public static void SaveJsonItem(string file, object obj, JsonSchema schema, stri

sb.Append("]");

if (Options.DontFormatJson)
if (FormOptions.DontFormatJson)
write.Write(sb.ToString());
else
write.Write(SpaceJson(sb.ToString(), bracketBlockLevel));
Expand Down Expand Up @@ -636,7 +638,7 @@ public static void SaveJsonRecipes(string file, object obj, JsonSchema schema, s

sb.Append("]}");

if (Options.DontFormatJson)
if (FormOptions.DontFormatJson)
write.Write(sb.ToString());
else
write.Write(SpaceJson(sb.ToString(), bracketBlockLevel));
Expand Down Expand Up @@ -679,11 +681,11 @@ public static string SpaceJson(string json, int bracketBlockLevel = 1)
string nlindent = "\n";

string indent = "";
if (Options.IndentWithTabs)
if (FormOptions.IndentWithTabs)
indent = "\t";
else
{
for (int c = 0; c < Options.IndentSpaces; c++)
for (int c = 0; c < FormOptions.IndentSpaces; c++)
indent += " ";
}

Expand Down
Loading

0 comments on commit c6fe3b6

Please sign in to comment.