public static void Init(string directory, string settingsJSON) { Logger = HBS.Logging.Logger.GetLogger("CustomFilters", LogLevel.Debug); try { try { Settings = new CustomFiltersSettings(); JSONSerializationUtility.FromJSON(Settings, settingsJSON); HBS.Logging.Logger.SetLoggerLevel(Logger.Name, Settings.LogLevel); } catch (Exception) { Settings = new CustomFiltersSettings(); } Settings.Complete(); SetupLogging(directory); var harmony = HarmonyInstance.Create("io.github.denadan.CustomFilters"); harmony.PatchAll(Assembly.GetExecutingAssembly()); Logger.Log("Loaded CustomFilters v0.1 for bt 1.6.2"); CustomComponents.Registry.RegisterSimpleCustomComponents(Assembly.GetExecutingAssembly()); Logger.LogDebug("done"); Logger.LogDebug(JSONSerializationUtility.ToJSON(Settings)); } catch (Exception e) { Logger.LogError(e); } }
public void SaveSettings <T>(T settings) where T : ModSettings { using (var writer = new StreamWriter(SettingsPath)) { var json = JSONSerializationUtility.ToJSON(settings); writer.Write(json); } }
private void init(string directory, string settingsJSON) { try { Logger = HBS.Logging.Logger.GetLogger(ModName, LogLevel.Debug); try { Settings = new Settings(); JSONSerializationUtility.FromJSON(Settings, settingsJSON); HBS.Logging.Logger.SetLoggerLevel(Logger.Name, LogLevel.Debug); } catch (Exception) { Settings = new Settings(); } if (!Settings.AddLogPrefix) { LogPrefix = ""; } SetupLogging(directory); var harmony = HarmonyInstance.Create($"{ModName}"); harmony.PatchAll(Assembly.GetExecutingAssembly()); Logger.Log("========================================================="); Logger.Log($"Loaded {ModName} v0.5 for bt 1.9"); Logger.Log("========================================================="); if (Settings.ShowSettingsOnLoad) { Logger.LogDebug(JSONSerializationUtility.ToJSON(Settings)); } CustomComponents.Registry.RegisterSimpleCustomComponents(Assembly.GetExecutingAssembly()); if (Settings.FixMechPartCost) { CustomComponents.AutoFixer.Shared.RegisterMechFixer(Extentions.FixVehicleCost, Settings.FakeVehicleTag); } if (Settings.FixUIName) { CustomComponents.AutoFixer.Shared.RegisterMechFixer(Extentions.FixVehicleUIName, Settings.FakeVehicleTag); } if (Settings.AddWeaponToDescription) { CustomComponents.AutoFixer.Shared.RegisterMechFixer(Extentions.FixDescription, Settings.FakeVehicleTag); } Logger.LogDebug("done"); } catch (Exception e) { Logger.LogError(e); } }
public override string GenerateJSONTemplate() { return(JSONSerializationUtility.ToJSON <LanceSpawnedMessage>(new LanceSpawnedMessage(string.Empty, string.Empty))); }
public override string ToJSON() { return(JSONSerializationUtility.ToJSON <LanceSpawnedMessage>(this)); }
public string GenerateJSONTemplate() { return(JSONSerializationUtility.ToJSON(new ModEntry(""))); }
public override string ToJSON() { return(JSONSerializationUtility.ToJSON <SwapPlacementGameLogic>(this)); }
public override string ToJSON() { return(JSONSerializationUtility.ToJSON(this)); }
public override string GenerateJSONTemplate() { return(JSONSerializationUtility.ToJSON <SetChunkStateAtRandomActivator>(new SetChunkStateAtRandomActivator())); }
public static void Init(string directory, string settingsJSON) { Logger = HBS.Logging.Logger.GetLogger("CustomComponents", LogLevel.Debug); SetupLogging(directory); try { try { Settings = new CustomComponentSettings(); JSONSerializationUtility.FromJSON(Settings, settingsJSON); HBS.Logging.Logger.SetLoggerLevel(Logger.Name, Settings.LogLevel); } catch (Exception e) { Logger.LogError("Couldn't load settings", e); Settings = new CustomComponentSettings(); } Logger.LogError($"{Settings.TestEnableAllTags}"); Settings.Complete(); LogDebug(DType.ShowConfig, JSONSerializationUtility.ToJSON(Settings)); var harmony = HarmonyInstance.Create("io.github.denadan.CustomComponents"); harmony.PatchAll(Assembly.GetExecutingAssembly()); Registry.RegisterSimpleCustomComponents(Assembly.GetExecutingAssembly()); Validator.RegisterMechValidator(CategoryController.Shared.ValidateMech, CategoryController.Shared.ValidateMechCanBeFielded); Logger.Log("Loaded CustomComponents v0.9.7.1 for bt 1.5.1"); Validator.RegisterMechValidator(TagRestrictionsHandler.Shared.ValidateMech, TagRestrictionsHandler.Shared.ValidateMechCanBeFielded); Validator.RegisterDropValidator(pre: TagRestrictionsHandler.Shared.ValidateDrop); if (Settings.RunAutofixer) { if (Settings.FixDeletedComponents) { AutoFixer.Shared.RegisterMechFixer(AutoFixer.Shared.RemoveEmptyRefs); } if (Settings.FixSaveGameMech) { AutoFixer.Shared.RegisterSaveMechFixer(AutoFixer.Shared.ReAddFixed); AutoFixer.Shared.RegisterSaveMechFixer(CategoryController.Shared.RemoveExcessDefaults); } if (Settings.FixDefaults) { AutoFixer.Shared.RegisterMechFixer(DefaultFixer.Shared.FixMechs); } } Logger.LogDebug("done"); } catch (Exception e) { Logger.LogError(e); } }
public static void Init(string directory, string settingsJSON) { Logger = HBS.Logging.Logger.GetLogger(ModName, LogLevel.Debug); try { try { Settings = new CustomShopsSettings(); JSONSerializationUtility.FromJSON(Settings, settingsJSON); HBS.Logging.Logger.SetLoggerLevel(Logger.Name, Settings.LogLevel); } catch (Exception) { Settings = new CustomShopsSettings(); } if (!Settings.AddLogPrefix) { LogPrefix = ""; } SetupLogging(directory); var harmony = HarmonyInstance.Create($"{ModName}"); harmony.PatchAll(Assembly.GetExecutingAssembly()); Logger.Log("========================================================="); Logger.Log($"Loaded {ModName} v0.3.1 for bt 1.9"); Logger.Log("========================================================="); Logger.LogDebug("done"); Logger.LogDebug(JSONSerializationUtility.ToJSON(Settings)); State = new GameState(); RefreshEvents = new Dictionary <string, List <IShopDescriptor> >(); RegisterRefreshEvent("Daily"); RegisterRefreshEvent("SystemChange"); RegisterRefreshEvent("MonthEnd"); RegisterRefreshEvent("ContractComplete"); RegisterRefreshEvent("OwnerChange"); if (Settings.SystemShop) { RegisterShop(new SystemShop(), new List <string>() { "systemchange", "monthend" }); } if (Settings.FactionShop) { RegisterShop(new FactionShop(), new List <string>() { "systemchange", "monthend" }); } if (Settings.BlackMarketShop) { RegisterShop(new BlackMarketShop(), new List <string>() { "systemchange", "monthend" }); } if (Settings.BuyBackShop) { BuyBack = new BuyBackShop(); RegisterShop(BuyBack, new List <string>() { "systemchange" }); } } catch (Exception e) { Logger.LogError(e); } }
public override string ToJSON() { return(JSONSerializationUtility.ToJSON <DialogueActivator>(this)); }
public override string GenerateJSONTemplate() { return(JSONSerializationUtility.ToJSON <DialogueActivator>(new DialogueActivator())); }
public override string ToJSON() { return(JSONSerializationUtility.ToJSON <SwapTeamFactionGameLogic>(this)); }
public override string GenerateJSONTemplate() { return(JSONSerializationUtility.ToJSON <SwapTeamFactionGameLogic>(new SwapTeamFactionGameLogic())); }
public override string GenerateJSONTemplate() { return(JSONSerializationUtility.ToJSON <DisablePilotDeathGameLogic>(new DisablePilotDeathGameLogic())); }
public override string ToJSON() { return(JSONSerializationUtility.ToJSON <DisablePilotDeathGameLogic>(this)); }
public override string ToJSON() { return(JSONSerializationUtility.ToJSON <CustomPlayerLanceSpawnerGameLogic>(this)); }
public override string ToJSON() { return(JSONSerializationUtility.ToJSON <SetChunkStateAtRandomActivator>(this)); }
public override string GenerateJSONTemplate() { return(JSONSerializationUtility.ToJSON <CustomPlayerLanceSpawnerGameLogic>(new CustomPlayerLanceSpawnerGameLogic())); }
public override string GenerateJSONTemplate() { return(JSONSerializationUtility.ToJSON(new SystemModDef())); }
public static void Init(string directory, string settingsJSON) { Logger = HBS.Logging.Logger.GetLogger("CustomSalvage", LogLevel.Debug); try { try { Settings = new CustomSalvageSettings(); JSONSerializationUtility.FromJSON(Settings, settingsJSON); HBS.Logging.Logger.SetLoggerLevel(Logger.Name, Settings.LogLevel); } catch (Exception) { Settings = new CustomSalvageSettings(); } Settings.Complete(); SetupLogging(directory); var harmony = HarmonyInstance.Create("io.github.denadan.CustomSalvage"); harmony.PatchAll(Assembly.GetExecutingAssembly()); #if USE_CC Logger.Log("Loaded CustomSalvageCC v0.4.2 for bt 1.8"); #else Logger.Log("Loaded CustomSalvageNonCC v0.4.2 for bt 1.8"); #endif switch (Settings.RecoveryType) { case RecoveryCalculationType.AlwaysRecover: NeedRecovery = (result, contract) => true; break; case RecoveryCalculationType.NeverRecover: NeedRecovery = (result, contract) => false; break; case RecoveryCalculationType.PartDestroyed: NeedRecovery = RecoveryDelegates.PartDestroyed; break; default: NeedRecovery = RecoveryDelegates.VanilaRecovery; break; } switch (Settings.LostMechAction) { case LostMechActionType.ReturnItemsAndPartsToPlayer: LostUnitAction = LostUnitActions.ReturnItemsAndParts; break; case LostMechActionType.MoveItemsToSalvage: LostUnitAction = LostUnitActions.SalvageItems; break; case LostMechActionType.MoveItemsAndPartsToSalvage: LostUnitAction = LostUnitActions.SalvageItemsAndParts; break; default: LostUnitAction = LostUnitActions.ReturnItems; break; } switch (Settings.PartCountType) { case PartCalculationType.VanilaAdjusted: GetNumParts = PartsNumCalculations.VanilaAdjusted; break; case PartCalculationType.PartDestroyed: GetNumParts = PartsNumCalculations.PartDestroyed; break; case PartCalculationType.PartDestroyedIgnoreCT: GetNumParts = PartsNumCalculations.PartDestroyedNoCT; break; default: GetNumParts = PartsNumCalculations.Vanila; break; } #if USE_CC CustomComponents.Registry.RegisterSimpleCustomComponents(Assembly.GetExecutingAssembly()); #endif Logger.LogDebug("done"); Logger.LogDebug(JSONSerializationUtility.ToJSON(Settings)); } catch (Exception e) { Logger.LogError(e); } }