Skip to content

Commit

Permalink
*0.5
Browse files Browse the repository at this point in the history
  • Loading branch information
Morphyum committed Jul 29, 2018
1 parent 222f331 commit cda39da
Show file tree
Hide file tree
Showing 9,431 changed files with 194,938 additions and 206,605 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
64 changes: 59 additions & 5 deletions DocsToSystemJSON/DocsToSystemJSON/Converter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ class Converter {
private string yearFolder = "/IS3025/";
private string OriginalData;
private bool keepKamea;
public static List<string> AllFactions = new List<string>() { "ComStar","Betrayers","AuriganDirectorate","AuriganMercenaries","AuriganPirates","AuriganRestoration",
"Davion","Kurita","Liao","Locals", "MagistracyCentrella",
"MagistracyOfCanopus","MajestyMetals", "Marik","Nautilus",
"Steiner","TaurianConcordat" };

public Converter(string dataPath, string arrayName, string OutputPath, string BlueprintPath, bool is3040, string OriginalData, bool keepKamea) {

Expand Down Expand Up @@ -50,16 +54,23 @@ public void newMap() {
newSystemJObject["Position"]["x"] = systemJObject["x"];
newSystemJObject["Position"]["y"] = systemJObject["y"];
newSystemJObject["Owner"] = getOwner(systemJObject);
newSystemJObject["ContractEmployers"] = JArray.FromObject(getEmployees((string)newSystemJObject["Owner"]));
newSystemJObject["ContractTargets"] = JArray.FromObject(getTargets((string)newSystemJObject["Owner"]));
newSystemJObject["SupportedBiomes"] = JArray.FromObject(getBiomes(systemJObject));
string year = "Faction3025";
if (is3040) {
year = "Faction3040";
}
(new FileInfo(OutputPath + yearFolder + systemJObject[year] + "/" + newSystemJObject["Description"]["Id"] + ".json")).Directory.Create();
File.WriteAllText(OutputPath + yearFolder + systemJObject[year] + "/" + newSystemJObject["Description"]["Id"] + ".json", newSystemJObject.ToString());
string path = OutputPath + yearFolder + systemJObject[year] + "/" + newSystemJObject["Description"]["Id"] + ".json";
path = path.Replace("\n", "");
(new FileInfo(path)).Directory.Create();
File.WriteAllText(path, newSystemJObject.ToString());

path = OriginalData + "/" + newSystemJObject["Description"]["Id"] + ".json";
path = path.Replace("\n", "");
if (!File.Exists(OriginalData + "/" + newSystemJObject["Description"]["Id"] + ".json")) {
string filepath = OutputPath + "/StarSystems/" + newSystemJObject["Description"]["Id"] + ".json";
filepath = filepath.Replace("\n", "");
(new FileInfo(filepath)).Directory.Create();
File.WriteAllText(filepath, newSystemJObject.ToString());
}
Expand Down Expand Up @@ -359,7 +370,12 @@ public string getOwner(JObject systemJObject) {
case "Aurigan Coalition":
return "AuriganRestoration";
case "ComStar":
return "ComStar";
if (is3040) {
return "Locals";
}
else {
return "ComStar";
}
case "Magistracy of Canopus":
return "MagistracyOfCanopus";
case "Taurian Concordat":
Expand All @@ -375,13 +391,32 @@ public string getOwner(JObject systemJObject) {
case "Circinus Federation":
return "Nautilus";
case "Illyrian Palatinate":
return "AuriganMercenaries";
if (is3040) {
return "Locals";
}
else {
return "AuriganMercenaries";
}
case "Free Rasalhague Republic":
if (is3040) {
return "AuriganMercenaries";
}
else {
return "Locals";
}
case "St. Ives Compact":
if (is3040) {
return "ComStar";
}
else {
return "Locals";
}
case "Abandoned":
return "NoFaction";
case "Undiscovered":
return "NoFaction";
default:
return "Locals";
return "NoFaction";
}
}
public List<string> createTags(JObject systemJObject) {
Expand Down Expand Up @@ -743,5 +778,24 @@ public List<string> createTags(JObject systemJObject) {
return tagList;
}

public static List<string> getEmployees(string faction) {
List<string> employees = new List<string>();
if (faction.Equals("NoFaction")) {
return employees;
}
employees.Add(faction);
employees.Add("Locals");
return employees;
}

public static List<string> getTargets(string faction) {
List<string> targets = AllFactions;
if (faction.Equals("NoFaction")) {
return targets;
}
targets.Remove(faction);
return targets;
}

}
}
Loading

0 comments on commit cda39da

Please sign in to comment.