public static DaggerfallMessageBox CreateBankingStatusBox(IUserInterfaceWindow previous = null) { const string textDatabase = "DaggerfallUI"; DaggerfallMessageBox bankingBox = new DaggerfallMessageBox(DaggerfallUI.Instance.UserInterfaceManager, previous); bankingBox.SetHighlightColor(DaggerfallUI.DaggerfallUnityStatDrainedTextColor); List <TextFile.Token> messages = new List <TextFile.Token>(); bool found = false; messages.AddRange(GetLoansLine( TextManager.Instance.GetText(textDatabase, "region"), TextManager.Instance.GetText(textDatabase, "account"), TextManager.Instance.GetText(textDatabase, "loan"), TextManager.Instance.GetText(textDatabase, "dueDate"))); messages.Add(TextFile.NewLineToken); for (int regionIndex = 0; regionIndex < DaggerfallBankManager.BankAccounts.Length; regionIndex++) { if (DaggerfallBankManager.GetAccountTotal(regionIndex) > 0 || DaggerfallBankManager.HasLoan(regionIndex)) { TextFile.Formatting formatting = DaggerfallBankManager.HasDefaulted(regionIndex) ? TextFile.Formatting.TextHighlight : TextFile.Formatting.Text; messages.AddRange(GetLoansLine(ShortenName(MapsFile.RegionNames[regionIndex], 12), DaggerfallBankManager.GetAccountTotal(regionIndex).ToString(), DaggerfallBankManager.GetLoanedTotal(regionIndex).ToString(), DaggerfallBankManager.GetLoanDueDateString(regionIndex), formatting)); found = true; } } if (!found) { TextFile.Token noneToken = TextFile.CreateTextToken(TextManager.Instance.GetText(textDatabase, "noAccount")); messages.Add(noneToken); messages.Add(TextFile.NewLineToken); } bankingBox.SetTextTokens(messages.ToArray()); bankingBox.ClickAnywhereToClose = true; return(bankingBox); }
private static void OverdueLoan(int regionIndex) { // Try to repay the loan off player's account int transferAmount = (int)Math.Min(DaggerfallBankManager.GetLoanedTotal(regionIndex), DaggerfallBankManager.GetAccountTotal(regionIndex)); DaggerfallBankManager.MakeTransaction(TransactionType.Repaying_loan_from_account, transferAmount, regionIndex); if (!DaggerfallBankManager.HasLoan(regionIndex)) { return; } // Only apply reputation drop once if (DaggerfallBankManager.HasDefaulted(regionIndex)) { return; } // Set hasDefaulted flag (Note: Does not seem to ever be set in classic) DaggerfallBankManager.SetDefaulted(regionIndex, true); PlayerEntity playerEntity = GameManager.Instance.PlayerEntity; // Should that be weighted by the amount? playerEntity.LowerRepForCrime(regionIndex, PlayerEntity.Crimes.LoanDefault); }
void loanBorrowButton_OnMouseClick(BaseScreenComponent sender, Vector2 position) { if (DaggerfallBankManager.HasLoan(regionIndex)) { GeneratePopup(TransactionResult.ALREADY_HAVE_LOAN); ToggleTransactionInput(TransactionType.None); } else { ToggleTransactionInput(TransactionType.Borrowing_loan); } }
void UpdateButtons() { depoGoldButton.Enabled = transactionType == TransactionType.None; drawGoldButton.Enabled = transactionType == TransactionType.None; depoLOCButton.Enabled = transactionType == TransactionType.None; drawLOCButton.Enabled = transactionType == TransactionType.None; depoLOCButton.Enabled = transactionType == TransactionType.None; loanBorrowButton.Enabled = transactionType == TransactionType.None; loanRepayButton.Enabled = (transactionType == TransactionType.None && DaggerfallBankManager.HasLoan(regionIndex)); buyHouseButton.Enabled = transactionType == TransactionType.None; sellHouseButton.Enabled = transactionType == TransactionType.None; buyShipButton.Enabled = transactionType == TransactionType.None; sellShipButton.Enabled = transactionType == TransactionType.None; }
void LoanBorrowButton_OnMouseClick(BaseScreenComponent sender, Vector2 position) { DaggerfallUI.Instance.PlayOneShot(SoundClips.ButtonClick); if (DaggerfallBankManager.HasDefaulted(regionIndex)) { GeneratePopup(TransactionResult.ALREADY_DEFAULTED); ToggleTransactionInput(TransactionType.None); } else if (DaggerfallBankManager.HasLoan(regionIndex)) { GeneratePopup(TransactionResult.ALREADY_HAVE_LOAN); ToggleTransactionInput(TransactionType.None); } else { ToggleTransactionInput(TransactionType.Borrowing_loan); } }