Beispiel #1
0
        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);
                }
            }