Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2b8b3fc74e | ||
|
|
54ec385800 | ||
|
|
5fefe8eba9 |
@ -6,19 +6,23 @@ using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Runtime;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Jsarus
|
||||
{
|
||||
internal class Program
|
||||
{
|
||||
public static string version = "1.1.1";
|
||||
public static string version = "1.3.0";
|
||||
public static string cd = Directory.GetCurrentDirectory();
|
||||
public static Process p = new Process();
|
||||
private static ConsoleKeyInfo keyInfo;
|
||||
static void Main(string[] args)
|
||||
{
|
||||
WebClient wc = new WebClient();
|
||||
Message.Splash("Jsarus", "mikx");
|
||||
Message.CMW("Creating directories...", true, 1);
|
||||
if (!Directory.Exists($@"Data\Modded")) { Directory.CreateDirectory($@"Data\Modded"); }
|
||||
@ -28,32 +32,69 @@ namespace Jsarus
|
||||
|
||||
string ModName = settings["ModName"].ToObject<string>();
|
||||
string GameContentPath = settings["GameContentPath"].ToObject<string>();
|
||||
bool KeepData = settings["KeepData"].ToObject<bool>();
|
||||
string[] CopyList = settings["CopyList"].ToObject<string[]>();
|
||||
|
||||
int ItemWeight = settings["D_Itemable"]["ItemWeight"].ToObject<int>();
|
||||
int ItemStack = settings["D_Itemable"]["ItemStack"].ToObject<int>();
|
||||
if (!File.Exists("data.json")) { wc.DownloadFile("https://mxio.ovh/icarus/jsarus/data.json", "data.json"); }
|
||||
|
||||
int ExperienceMultiplier = settings["D_ExperienceEvents"]["ExperienceMultiplier"].ToObject<int>();
|
||||
JObject data = JObject.Parse(File.ReadAllText("data.json"));
|
||||
int DataVersion = data["version"].ToObject<int>();
|
||||
JObject dataRemote = JObject.Parse(wc.DownloadString("https://mxio.ovh/icarus/jsarus/data.json"));
|
||||
int DataVersionRemote = dataRemote["version"].ToObject<int>();
|
||||
|
||||
string[] ActionList = settings["D_StaminaActionCosts"]["ActionList"].ToObject<string>().Split('|');
|
||||
int DivideCostPer = settings["D_StaminaActionCosts"]["DivideCostPer"].ToObject<int>();
|
||||
if (KeepData)
|
||||
{
|
||||
Message.CMW("Keeping your custom data.", true, 1);
|
||||
if (DataVersion < DataVersionRemote)
|
||||
{
|
||||
Message.CMW("Consider setting \"KeepData\" to \"true\" in your \"settings.json\"!", true, 1);
|
||||
Message.CMW("Your data is outdated. Should we update it? (y/n)", true, 3);
|
||||
Message.CMW("If you are not sure, answer \"y\".", true, 1);
|
||||
keyInfo = Console.ReadKey(true);
|
||||
if (keyInfo.Key == ConsoleKey.Y)
|
||||
{
|
||||
Message.CMW("Getting the latest data...", true, 1);
|
||||
if (File.Exists("data.json")) { File.Copy("data.json", "data.backup.json", true); }
|
||||
Message.CMW("A backup has been made to \"data.backup.json\".", true, 1);
|
||||
wc.DownloadFile("https://mxio.ovh/icarus/jsarus/data.json", "data.json");
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Message.CMW("Getting the latest data...", true, 1);
|
||||
wc.DownloadFile("https://mxio.ovh/icarus/jsarus/data.json", "data.json");
|
||||
}
|
||||
|
||||
string[] PickList = settings["D_ToolDamage"]["PickList"].ToObject<string>().Split('|');
|
||||
string[] PickEfficiencyList = settings["D_ToolDamage"]["PickEfficiencyList"].ToObject<string>().Split('|');
|
||||
int ItemWeight = data["D_Itemable"]["ItemWeight"].ToObject<int>();
|
||||
int ItemStack = data["D_Itemable"]["ItemStack"].ToObject<int>();
|
||||
|
||||
string[] AxeList = settings["D_ToolDamage"]["AxeList"].ToObject<string>().Split('|');
|
||||
string[] AxeEfficiencyList = settings["D_ToolDamage"]["AxeEfficiencyList"].ToObject<string>().Split('|');
|
||||
int ExperienceMultiplier = data["D_ExperienceEvents"]["ExperienceMultiplier"].ToObject<int>();
|
||||
|
||||
string[] RecipeListOre = settings["D_ProcessorRecipes"]["RecipeListOre"].ToObject<string>().Split('|');
|
||||
string[] RecipeList = settings["D_ProcessorRecipes"]["RecipeList"].ToObject<string>().Split('|');
|
||||
string[] RecipeListStack = settings["D_ProcessorRecipes"]["RecipeListStack"].ToObject<string>().Split('|');
|
||||
int RequiredMillijoules = settings["D_ProcessorRecipes"]["RequiredMillijoules"].ToObject<int>();
|
||||
int RequiredAmount = settings["D_ProcessorRecipes"]["RequiredAmount"].ToObject<int>();
|
||||
int CraftedAmount = settings["D_ProcessorRecipes"]["CraftedAmount"].ToObject<int>();
|
||||
string[] ActionList = data["D_StaminaActionCosts"]["ActionList"].ToObject<string>().Split('|');
|
||||
int DivideCostPer = data["D_StaminaActionCosts"]["DivideCostPer"].ToObject<int>();
|
||||
|
||||
int ÞlayerInventorySize = settings["D_InventoryInfo"]["ÞlayerInventorySize"].ToObject<int>();
|
||||
string[] PickList = data["D_ToolDamage"]["PickList"].ToObject<string>().Split('|');
|
||||
string[] PickEfficiencyList = data["D_ToolDamage"]["PickEfficiencyList"].ToObject<string>().Split('|');
|
||||
|
||||
string[] supportedJson = { @"Traits\D_Itemable.json", @"Experience\D_ExperienceEvents.json", @"Tools\D_StaminaActionCosts.json", @"Tools\D_ToolDamage.json", @"Crafting\D_ProcessorRecipes.json", @"Inventory\D_InventoryInfo.json" };
|
||||
string[] AxeList = data["D_ToolDamage"]["AxeList"].ToObject<string>().Split('|');
|
||||
string[] AxeEfficiencyList = data["D_ToolDamage"]["AxeEfficiencyList"].ToObject<string>().Split('|');
|
||||
|
||||
string[] RecipeListOre = data["D_ProcessorRecipes"]["RecipeListOre"].ToObject<string>().Split('|');
|
||||
string[] RecipeList = data["D_ProcessorRecipes"]["RecipeList"].ToObject<string>().Split('|');
|
||||
string[] RecipeListStack = data["D_ProcessorRecipes"]["RecipeListStack"].ToObject<string>().Split('|');
|
||||
int RequiredMillijoules = data["D_ProcessorRecipes"]["RequiredMillijoules"].ToObject<int>();
|
||||
int RequiredAmount = data["D_ProcessorRecipes"]["RequiredAmount"].ToObject<int>();
|
||||
int CraftedAmount = data["D_ProcessorRecipes"]["CraftedAmount"].ToObject<int>();
|
||||
|
||||
string[] InventoryList = data["D_InventoryInfo"]["InventoryList"].ToObject<string>().Split('|');
|
||||
int InventorySize = data["D_InventoryInfo"]["InventorySize"].ToObject<int>();
|
||||
|
||||
string[] GeneratorList = data["D_Generator"]["GeneratorList"].ToObject<string>().Split('|');
|
||||
int GenerationRate = data["D_Generator"]["GenerationRate"].ToObject<int>();
|
||||
int GenerationRatio = data["D_Generator"]["GenerationRatio"].ToObject<int>();
|
||||
|
||||
string[] supportedJson = { @"Traits\D_Itemable.json", @"Experience\D_ExperienceEvents.json", @"Tools\D_StaminaActionCosts.json", @"Tools\D_ToolDamage.json", @"Crafting\D_ProcessorRecipes.json", @"Inventory\D_InventoryInfo.json", @"Traits\D_Generator.json" };
|
||||
|
||||
var dir = Directory.GetDirectories(@"Data\Vanilla");
|
||||
|
||||
@ -74,9 +115,29 @@ namespace Jsarus
|
||||
Message.CMW($"Copied {sj.Split('\\')[1]}.", true, 2);
|
||||
}
|
||||
|
||||
Message.CMW($"We extracted the data, should we continue and mod it? (y/n)", true, 1);
|
||||
ConsoleKeyInfo keyInfo = Console.ReadKey(true);
|
||||
if (keyInfo.Key == ConsoleKey.N) { return; } else
|
||||
Message.CMW("Generating the Item Database for dynamic modding...", true, 1);
|
||||
JArray itemsDB = new JArray();
|
||||
JObject items = new JObject();
|
||||
JObject item = JObject.Parse(File.ReadAllText(@"Data\Vanilla\Traits\D_Itemable.json"));
|
||||
foreach (var i in item["Rows"])
|
||||
{
|
||||
string iname = i["Name"].ToObject<string>().Substring(5);
|
||||
int iweight = 0;
|
||||
if (i["Weight"] != null) { iweight = i["Weight"].ToObject<int>(); } else { iweight = 0; }
|
||||
bool istack = false;
|
||||
int istacksize = 1;
|
||||
if (i["MaxStack"] != null) { istack = true; istacksize = i["MaxStack"].ToObject<int>(); }
|
||||
items = new JObject()
|
||||
{
|
||||
{ "name", iname },
|
||||
{ "weight", iweight },
|
||||
{ "dostack", istack },
|
||||
{ "stack", istacksize }
|
||||
};
|
||||
itemsDB.Add(items);
|
||||
}
|
||||
var rawDB = JsonConvert.SerializeObject(itemsDB, Formatting.Indented);
|
||||
File.WriteAllText($@"Data/itemDB.json", rawDB);
|
||||
|
||||
foreach (var d in dir)
|
||||
{
|
||||
@ -167,8 +228,11 @@ namespace Jsarus
|
||||
break;
|
||||
|
||||
case "D_ProcessorRecipes.json":
|
||||
JArray itemDB = JArray.Parse(File.ReadAllText(@"Data\itemDB.json"));
|
||||
foreach (var r in job["Rows"])
|
||||
{
|
||||
//JToken entry = itemDB.FirstOrDefault(t => (bool)(t["name"]?.ToString().Contains(r["Name"]?.ToString())));
|
||||
|
||||
if (r["Inputs"].Count() > 0)
|
||||
{
|
||||
if (RecipeListOre.Contains(r["Name"].ToString()))
|
||||
@ -202,15 +266,30 @@ namespace Jsarus
|
||||
r["Outputs"][0]["Count"] = CraftedAmount;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
case "D_InventoryInfo.json":
|
||||
foreach (var r in job["Rows"])
|
||||
{
|
||||
if (r["Name"].ToObject<string>() == "Backpack")
|
||||
if (InventoryList.Contains(r["Name"].ToString()))
|
||||
{
|
||||
r["StartingSlots"] = ÞlayerInventorySize;
|
||||
r["StartingSlots"] = InventorySize;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case "D_Generator.json":
|
||||
foreach (var r in job["Rows"])
|
||||
{
|
||||
if (GeneratorList.Contains(r["Name"].ToString()))
|
||||
{
|
||||
r["GenerationRate"] = GenerationRate;
|
||||
if (r["GenerationRatio"] != null)
|
||||
{
|
||||
r["GenerationRatio"] = GenerationRatio;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
24
README.md
24
README.md
@ -4,18 +4,28 @@
|
||||
Official MxIcarus Modding Tool for Icarus.
|
||||
|
||||
## Features
|
||||
* Extract json data from your client.
|
||||
* Mod your extracted json data according to the settings.json config.
|
||||
* Create a pak file, ready to use on your client/server.
|
||||
* Can copy the created pak file to a user specified list of path.
|
||||
1. Extract json data from your client.
|
||||
2. Mod your extracted json data according to the settings.json config.
|
||||
3. Create a pak file, ready to use on your client/server.
|
||||
4. Can copy the created pak file to a user specified list of path.
|
||||
- Set all stackable item stack size and weight. (Edited in settings.json)
|
||||
- Set all non-stackable item weight. (Edited in settings.json)
|
||||
- Multiply all experience gain. (Edited in settings.json)
|
||||
- Divide stamina cost of listed action list. (Edited in settings.json)
|
||||
- Set efficiency of listed pickaxe and axe from a list. (Edited in settings.json)
|
||||
- Set ore recipe crafting speed. (Edited in settings.json)
|
||||
- Reduce all required mats of a recipe to 1, using a list. (Edited in settings.json)
|
||||
- Set output of all stacking recipes to a specified value. (Edited in settings.json)
|
||||
- Adjust the size of all inventory specified in a list. (Edited in settings.json)
|
||||
- Adjust the energy produced and the biofuel consumed by all specified generator in a list. (Edited in settings.json)
|
||||
|
||||
## How-To
|
||||
1. Download the latest release. (https://mxgit.ovh/Icarus/Jsarus/releases)
|
||||
1. Download the latest [release](https://mxgit.ovh/Icarus/Jsarus/releases).
|
||||
2. Copy the archive content in an empty folder on your disk.
|
||||
3. Open "settings.json" and edit the "ModName" and "GameContentPath".
|
||||
4. IMPORTANT: Escape "\" in your path with "/". Ex.: "C:\/SteamLibrary\/steamapps\/common\/Icarus\/Icarus\/Content"
|
||||
4. IMPORTANT: Escape "\\" in your path with "\\\\". Ex.: "C:\\\\SteamLibrary\\\\steamapps\\\\common\\\\Icarus\\\\Icarus\\\\Content"
|
||||
5. Save the "settings.json" file and run "Jsarus.exe".
|
||||
6. Jsarus will extract your game data, press "y" when asked to mod it and generate a mod pak.
|
||||
6. Jsarus will extract your game data and mod it.
|
||||
7. Copy the created pak file from the "Paks" folder to your game "mods" folder.
|
||||
8. "mods" location exemple: "C:\SteamLibrary\steamapps\common\Icarus\Icarus\Content\Paks\mods"
|
||||
9. If you don't have a "mods" folder, create one first.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user