示例#1
0
        static void Postfix()
        {
            if (Hero.MainHero.Gold < mainHeroGold_beforeTransaction)
            {
                // presume transaction occurred
                if (Hero.MainHero.IsHumanPlayerCharacter &&
                    Hero.MainHero.CharacterObject.GetFeatValue(DefaultFeats.Cultural.AseraiCheapCaravans))
                {
                    int creditAmount = mainHeroGold_beforeTransaction - Hero.MainHero.Gold;  // will modify later
                    if (DefaultFeats.Cultural.AseraiCheapCaravans.EffectBonus == 0f)
                    {
                        // Assume 30%
                        creditAmount = (int)(creditAmount * 0.30f);
                    }
                    else
                    {
                        creditAmount = (int)(creditAmount * (1.0f - DefaultFeats.Cultural.AseraiCheapCaravans.EffectBonus));
                    }

                    // Flavor text
                    TextObject textObject = new TextObject("An Aserai clerk nods to you and slips a coinpurse into your hands.");
                    // StringHelpers.SetCharacterProperties("HERO", Hero.MainHero.CharacterObject, null, textObject);
                    InformationManager.DisplayMessage(new InformationMessage(textObject.ToString()));

                    // Apply credit
                    GiveGoldAction.ApplyForSettlementToCharacter(Settlement.CurrentSettlement, Hero.MainHero, creditAmount, false);
                }
            }
        }
示例#2
0
        public static void ApplyReward(TournamentManager __instance)
        {
            Settlement giverSettlement = Settlement.CurrentSettlement;
            Hero       reciepientHero  = Hero.MainHero;
            int        goldAmount      = Settings.goldEarned * Settings.round;

            Settings.round++;
            if (Settings.round >= 5)
            {
                GiveGoldAction.ApplyForSettlementToCharacter(giverSettlement, reciepientHero, goldAmount);
                InformationManager.DisplayMessage(new InformationMessage(goldAmount.ToString() + " bonus Denars awarded by " + giverSettlement.Name.ToString() + " for winning the tournament "));
            }
            else
            {
                GiveGoldAction.ApplyForSettlementToCharacter(giverSettlement, reciepientHero, goldAmount);
                InformationManager.DisplayMessage(new InformationMessage(goldAmount.ToString() + " bonus Denars awarded by " + giverSettlement.Name.ToString() + " for proceeding to round " + Settings.round.ToString()));
            }
        }
        private void Withdraw(int amount, Settlement settlement)
        {
            var bankData = GetBankDataAtSettlement(settlement);

            if (amount > bankData.Balance)
            {
                InformationManager.DisplayMessage(new InformationMessage("You do not have enough money to withdraw."));
                return;
            }
            var settlementFundsInfo = GetSettlementFundsInfo(settlement);

            if (amount > settlementFundsInfo.AvailableFunds)
            {
                InformationManager.DisplayMessage(new InformationMessage($"The bank does not have enough funds available for you to withdraw. Only {settlementFundsInfo.AvailableFunds}<img src=\"Icons\\Coin@2x\"> is available."));
                return;
            }
            bankData.Balance -= amount;
            GiveGoldAction.ApplyForSettlementToCharacter(settlement, Hero.MainHero, amount, true);
            InformationManager.DisplayMessage(new InformationMessage($"You withdrew {amount}<img src=\"Icons\\Coin@2x\">.", "event:/ui/notification/coins_positive"));
            UpdateBankMenuTextVariables();
            GameMenu.SwitchToMenu("bank_account");
        }
示例#4
0
        public static void SellPlot(VillageData villageData)
        {
            var scrapItems = new List <(string, int)> {
                ("tools", 3)
            };
            int sellPrice = villageData.AcreBuyPrice;

            if (villageData.playerAcres > 0)
            {
                villageData.sellAcre();
                // Getting back our sweet materials.
                foreach (var scrap in scrapItems)
                {
                    ItemObject scrapItem = Items.FindFirst(item => item.StringId.Equals(scrap.Item1));
                    Hero.MainHero.PartyBelongedTo.ItemRoster.AddToCounts(scrapItem, scrap.Item2);
                }
                GiveGoldAction.ApplyForSettlementToCharacter(Settlement.CurrentSettlement, Hero.MainHero, sellPrice);
            }
            else
            {
                InformationManager.DisplayMessage(new InformationMessage("You have no plots to sell."));
            }
        }
        private void TakeOutLoan(int amount, Settlement settlement)
        {
            var bankData            = GetBankDataAtSettlement(settlement);
            var settlementComponent = settlement.GetSettlementComponent();

            if (amount > settlementComponent.Gold)
            {
                InformationManager.DisplayMessage(new InformationMessage($"This bank does not have enough funds to loan to you. Only {settlementComponent.Gold}<img src=\"Icons\\Coin@2x\"> is available."));
                return;
            }
            bankData.LoanStartDate = CampaignTime.Now;
            bankData.LastLoanRecurringRetaliationDate = CampaignTime.Never;
            bankData.OriginalLoanAmount      = amount;
            bankData.RemainingUnpaidLoan     = amount;
            bankData.LoanLateFeeInterestRate = CalculateLoanLateFeeInterestAtSettlement(settlement);
            bankData.LoanQuest = LoanQuest.Start(settlement, bankData.Banker, amount, bankData.LoanStartDate, bankData.LoanEndDate);
            var loanRenownCost = CalculateRenownCostForLoanAmount(amount);

            Hero.MainHero.Clan.Renown -= loanRenownCost;
            GiveGoldAction.ApplyForSettlementToCharacter(settlement, Hero.MainHero, amount, true);
            InformationManager.DisplayMessage(new InformationMessage($"You took out a loan for {amount}<img src=\"Icons\\Coin@2x\">. Lost {loanRenownCost:0.00} renown.", "event:/ui/notification/coins_positive"));
            UpdateBankMenuTextVariables();
            GameMenu.SwitchToMenu("bank_account");
        }