private static void Postfix(ItemObject outputItem, Town town, Workshop workshop, int count, bool doNotEffectCapital, int __state)
 {
     if (Campaign.Current.GameStarted && !doNotEffectCapital && BannerlordTweaksSettings.Instance is { } settings&& settings.EnableWorkshopSellTweak)
     {
         float num = Math.Min(1000, __state) * count * (settings.WorkshopSellTweak - 1f);
         workshop.ChangeGold((int)num);
         town.ChangeGold((int)-num);
     }
 }
 private static void CalculateOwnerIncomeFromWorkshop(DefaultClanFinanceModel __instance, ref int __result, Workshop workshop)
 {
     if (workshop.Owner != null &&
         (workshop.Owner.Clan == Clan.PlayerClan &&
          workshop.Owner.Clan.MapFaction.IsAtWarWith(workshop.Settlement.MapFaction)) &&
         !workshop.Owner.Clan.Leader.GetPerkValue(DefaultPerks.Trade.RapidDevelopment))
     {
         workshop.ChangeGold(-__result);
         __result = 0;
     }
 }
Exemplo n.º 3
0
        static bool Prefix(ItemObject outputItem, Town town, Workshop workshop, int count, bool doNotEffectCapital)
        {
            int multiplier = int.Parse(Settings.LoadSetting("WorkshopIncomeMultiplier"));

            int itemPrice = town.GetItemPrice(outputItem, null, false);

            town.Owner.ItemRoster.AddToCounts(outputItem, count, true);
            if (Campaign.Current.GameStarted && !doNotEffectCapital)
            {
                int num = itemPrice * count * multiplier;
                workshop.ChangeGold(num);
                town.ChangeGold(-num);
            }

            CampaignEventDispatcher.Instance.GetType()
            .GetMethod("OnItemProduced", BindingFlags.NonPublic | BindingFlags.Instance)
            .Invoke(CampaignEventDispatcher.Instance, new object[] { outputItem, town.Owner.Settlement, count });

            return(false);
        }
 /// <summary>
 /// Change workshop income
 /// </summary>
 /// <param name="w">Workshop</param>
 /// <param name="v">integer for changing workshop income</param>
 private void ChangeWorkshopIncomeValue(Workshop w, int v)
 {
     w.ChangeGold(v);
 }