public bool mod_CanBuild(BlueprintSettlementBuilding building) { if (!KingmakerPatchSettings.CurrencyFallback.Enabled) { return(this.source_CanBuild(building)); } if (!KingdomCurrencyFallback.CanSpend(this.GetActualCost(building))) { UberDebug.LogSystem("[fireundubh] mod_CanBuild: Cannot spend"); return(false); } SpecialSlotType specialSlot = building.SpecialSlot; if (specialSlot != SpecialSlotType.None) { if (this.IsSpecialSlotFilled(specialSlot)) { return(false); } } else if (this.alias_m_SlotsLeft < building.SlotCount) { return(false); } return(this.alias_CanBuildByLevel(building)); }
static bool Prefix(SettlementState __instance, ref bool __result, BlueprintSettlementBuilding building, int ___m_SlotsLeft) { try { if (!Main.enabled) { return(true); } if (!Main.settings.currencyFallback) { return(true); } if (!KingdomCurrencyFallback.CanSpend(__instance.GetActualCost(building))) { UberDebug.LogSystem("[KingdomResolution] SettlementState_CanBuild_Patch: Cannot spend"); __result = false; return(false); } SpecialSlotType specialSlot = building.SpecialSlot; if (specialSlot != SpecialSlotType.None) { if (__instance.IsSpecialSlotFilled(specialSlot)) { return(false); } } else if (___m_SlotsLeft < building.SlotCount) { return(false); } __result = CanBuildByLevel(__instance, building); return(false); } catch (Exception ex) { Main.Error(ex); return(true); } }
public void mod_Awake() { if (!KingmakerPatchSettings.Game.Logging) { this.source_Awake(); return; } try { string persistentDataPath = ApplicationPaths.persistentDataPath; Application.SetStackTraceLogType(LogType.Log, StackTraceLogType.None); UberLogger.Logger.Enabled = true; if (UberLogger.Logger.Enabled) { string text = Path.Combine(persistentDataPath, "GameLog.txt"); if (File.Exists(text)) { File.Copy(text, Path.Combine(persistentDataPath, "GameLogPrev.txt"), true); // just clear the old log, instead of deleting it so we can keep it open File.Create(text).Close(); } UberLogger.Logger.AddLogger(new UberLoggerFile(Application.isEditor ? "EditorLogFull.txt" : "GameLogFull.txt", persistentDataPath)); UberLogger.Logger.AddLogger(new UberLoggerFilter(new UberLoggerFile(Application.isEditor ? "EditorLog.txt" : "GameLog.txt", persistentDataPath), LogSeverity.Warning, "MatchLight")); } } catch (Exception exception) { Debug.LogError("Can't initialize log file"); Debug.LogException(exception); } AkSoundEngine.SetRTPCValue("AudioLevel", this.MasterVolume.NormalizedValue * 100f, null, 0); AkSoundEngine.SetRTPCValue("MusicLevel", this.MusicVolume.NormalizedValue * 100f, null, 0); StoreManager.InitializeStore(); UberDebug.LogSystem("GameStarter.Awake finished"); }