module Bank

Public Class Methods

balance() click to toggle source
# File lib/lotrd/view/bank.rb, line 29
    def balance
            system 'clear'
    player = YAML.load(File.read(ENV['HOME'] + "/." + "playerdata.yml"))
    gold = player.gold
            balance = player.balance
            puts "Hazelwood Bank => Balance" + "\n" + "=" * 40 + "\n"*2
    puts "You are currently holding #{gold} gold and have #{balance} gold stored with us."
    sleep(3)
    ::Bank.menu
end
deficit() click to toggle source
# File lib/lotrd/view/bank.rb, line 72
def deficit
        system 'clear'
        puts "Hazelwood Bank" + "\n" + "=" * 40 + "\n"*2
        puts "You do not have enough gold for this transaction!"
        sleep(3)
        ::Bank.menu
end
depositConfirm(dep, gold, balance) click to toggle source
# File lib/lotrd/view/bank.rb, line 64
def depositConfirm(dep, gold, balance)
        system 'clear'
        puts "Hazelwood Bank => Deposited Gold" + "\n" + "=" * 40 + "\n"*2
        puts "You have successfully deposited #{dep} gold. You are now holding #{gold} gold and have #{balance} gold stored with us."
        sleep(3)
        ::Bank.menu
end
depositMenu() click to toggle source
# File lib/lotrd/view/bank.rb, line 56
def depositMenu
        system 'clear'
        puts "Hazelwood Bank => Deposit Gold" + "\n" + "=" * 40 + "\n"*2
        puts "How much would you like to deposit?"
        dep = gets.chomp.to_i
        ::BankController.deposit(dep)
end
invalid() click to toggle source
# File lib/lotrd/view/bank.rb, line 80
def invalid
        system 'clear'
        puts "Hazelwood Bank" + "\n" + "=" * 40 + "\n"*2
        puts "That is not a valid amount for this transaction!"
        sleep(3)
        ::Bank.menu
end
leave() click to toggle source
# File lib/lotrd/view/bank.rb, line 88
def leave
        system 'clear'
        puts "Hazelwood Bank" + "\n" + "=" * 40 + "\n"*2
        puts "Take care out there, #{@player.name.colorize(:yellow)}"
        sleep(3)
        ::Town.menu
end
menu() click to toggle source
start() click to toggle source
# File lib/lotrd/view/bank.rb, line 8
def start
        system 'clear'
        puts "Hazelwood Bank" + "\n" + "=" * 40 + "\n"*2
@player = YAML.load(File.read(ENV['HOME'] + "/." + "playerdata.yml"))
        puts "#{@player.name.colorize(:yellow)}, welcome to Hazelwood bank!"
        sleep(3)
        menu
end
withdrawConfirm(wdw, gold, balance) click to toggle source
# File lib/lotrd/view/bank.rb, line 48
def withdrawConfirm(wdw, gold, balance)
        system 'clear'
        puts "Hazelwood Bank => Withdrawn Gold" + "\n" + "=" * 40 + "\n"*2
        puts "You have successfully withdrawn #{wdw} gold. You are now holding #{gold} gold and have #{balance} gold stored with us."
        sleep(3)
        ::Bank.menu
end
withdrawMenu() click to toggle source
# File lib/lotrd/view/bank.rb, line 40
def withdrawMenu
        system 'clear'
        puts "Hazelwood Bank => Withdraw Gold" + "\n" + "=" * 40 + "\n"*2
        puts "How much would you like to withdraw?"
        wdw = gets.chomp.to_i
        ::BankController.withdraw(wdw)
end

Private Instance Methods

balance() click to toggle source
# File lib/lotrd/view/bank.rb, line 29
    def balance
            system 'clear'
    player = YAML.load(File.read(ENV['HOME'] + "/." + "playerdata.yml"))
    gold = player.gold
            balance = player.balance
            puts "Hazelwood Bank => Balance" + "\n" + "=" * 40 + "\n"*2
    puts "You are currently holding #{gold} gold and have #{balance} gold stored with us."
    sleep(3)
    ::Bank.menu
end
deficit() click to toggle source
# File lib/lotrd/view/bank.rb, line 72
def deficit
        system 'clear'
        puts "Hazelwood Bank" + "\n" + "=" * 40 + "\n"*2
        puts "You do not have enough gold for this transaction!"
        sleep(3)
        ::Bank.menu
end
depositConfirm(dep, gold, balance) click to toggle source
# File lib/lotrd/view/bank.rb, line 64
def depositConfirm(dep, gold, balance)
        system 'clear'
        puts "Hazelwood Bank => Deposited Gold" + "\n" + "=" * 40 + "\n"*2
        puts "You have successfully deposited #{dep} gold. You are now holding #{gold} gold and have #{balance} gold stored with us."
        sleep(3)
        ::Bank.menu
end
depositMenu() click to toggle source
# File lib/lotrd/view/bank.rb, line 56
def depositMenu
        system 'clear'
        puts "Hazelwood Bank => Deposit Gold" + "\n" + "=" * 40 + "\n"*2
        puts "How much would you like to deposit?"
        dep = gets.chomp.to_i
        ::BankController.deposit(dep)
end
invalid() click to toggle source
# File lib/lotrd/view/bank.rb, line 80
def invalid
        system 'clear'
        puts "Hazelwood Bank" + "\n" + "=" * 40 + "\n"*2
        puts "That is not a valid amount for this transaction!"
        sleep(3)
        ::Bank.menu
end
leave() click to toggle source
# File lib/lotrd/view/bank.rb, line 88
def leave
        system 'clear'
        puts "Hazelwood Bank" + "\n" + "=" * 40 + "\n"*2
        puts "Take care out there, #{@player.name.colorize(:yellow)}"
        sleep(3)
        ::Town.menu
end
menu() click to toggle source
start() click to toggle source
# File lib/lotrd/view/bank.rb, line 8
def start
        system 'clear'
        puts "Hazelwood Bank" + "\n" + "=" * 40 + "\n"*2
@player = YAML.load(File.read(ENV['HOME'] + "/." + "playerdata.yml"))
        puts "#{@player.name.colorize(:yellow)}, welcome to Hazelwood bank!"
        sleep(3)
        menu
end
withdrawConfirm(wdw, gold, balance) click to toggle source
# File lib/lotrd/view/bank.rb, line 48
def withdrawConfirm(wdw, gold, balance)
        system 'clear'
        puts "Hazelwood Bank => Withdrawn Gold" + "\n" + "=" * 40 + "\n"*2
        puts "You have successfully withdrawn #{wdw} gold. You are now holding #{gold} gold and have #{balance} gold stored with us."
        sleep(3)
        ::Bank.menu
end
withdrawMenu() click to toggle source
# File lib/lotrd/view/bank.rb, line 40
def withdrawMenu
        system 'clear'
        puts "Hazelwood Bank => Withdraw Gold" + "\n" + "=" * 40 + "\n"*2
        puts "How much would you like to withdraw?"
        wdw = gets.chomp.to_i
        ::BankController.withdraw(wdw)
end