Пример #1
0
        public static LoanQuest Start(
            Settlement settlement,
            Hero banker,
            int loanAmount,
            CampaignTime loanStartDate,
            CampaignTime loanEndDate
            )
        {
            var loanQuest = new LoanQuest(settlement, banker, loanEndDate);

            loanQuest.StartQuest();
            loanQuest.AddLog(new TextObject($"You took out a loan of {loanAmount}<img src=\"Icons\\Coin@2x\"> from the bank of {settlement.Name} on {loanStartDate}. You must repay the loan by {loanEndDate}."), true);
            return(loanQuest);
        }
        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");
        }