Module: Store

Defined in:
lib/lotrd/v-store.rb

Class Method Summary collapse

Class Method Details

.armour_menuObject



36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/lotrd/v-store.rb', line 36

def armour_menu
    system 'clear'
    puts "Hephy's Forge -> Armours Menu" + "\n" + "=" * 40 + "\n"*2
    arm_stats = YAML.load(File.read("m-arm_stats.yml"))
    arm_list = arm_stats.keys
    prompt = TTY::Prompt.new
    prompt.select("Here's what we have in stock today:") do |menu|
        arm_list.each do |name|
        menu.choice "#{name} - Cost: #{arm_stats.fetch(name).fetch(:cost)} gold", -> {::Buy.armour(name)}
        end
        menu.choice "Return to store menu.", -> {::Store.menu}  
    end
end

.deficitObject



67
68
69
70
71
72
73
74
# File 'lib/lotrd/v-store.rb', line 67

def deficit
    system 'clear'
    puts "Hephy's Forge" + "\n" + "=" * 40 + "\n"*2
    puts "Hephy growls at you, \"Does it look like I'm running a charity here?\""
    puts "You should probably come back when you have enough gold on you."
    sleep(3)
    ::Store.menu
end

.kickObject



50
51
52
53
54
55
56
# File 'lib/lotrd/v-store.rb', line 50

def kick
    system 'clear'
    puts "Hephy's Forge" + "\n" + "=" * 40 + "\n"*2
    puts '"Does this look like an art gallery to you? Scram!"'
    sleep(3)
    ::Town.menu
end

.leaveObject



58
59
60
61
62
63
64
65
# File 'lib/lotrd/v-store.rb', line 58

def leave
    system 'clear'
    player = YAML.load(File.read("model/playerdata.yml"))
    puts "Hephy's Forge" + "\n" + "=" * 40 + "\n"*2
    puts "Stay alive out there, #{player.name.colorize(:yellow)}!"
    sleep(3)
    ::Town.menu
end


10
11
12
13
14
15
16
17
18
19
20
# File 'lib/lotrd/v-store.rb', line 10

def menu
    system 'clear'
    puts "Hephy's Forge" + "\n" + "=" * 40 + "\n"*2
    prompt = TTY::Prompt.new
    prompt.select("What would you like to buy today?") do |menu|
        menu.choice 'Weapons'.colorize(:light_red), -> {::Store.weapons_menu}
        menu.choice 'Armour'.colorize(:light_yellow), -> {::Store.armour_menu}
        menu.choice '"Not buying today, just want to look around!"'.colorize(:light_green), -> {::Store.kick}
        menu.choice 'Leave'.colorize(:light_blue), -> {::Store.leave}
    end
end

.weapons_menuObject



22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/lotrd/v-store.rb', line 22

def weapons_menu
    system 'clear'
    puts "Hephy's Forge -> Weapons Menu" + "\n" + "=" * 40 + "\n"*2
    weap_stats = YAML.load(File.read("m-weap_stats.yml"))
    weap_list = weap_stats.keys
    prompt = TTY::Prompt.new
    prompt.select("Here's what we have in stock today:") do |menu|
        weap_list.each do |name|
        menu.choice "#{name} - Cost: #{weap_stats.fetch(name).fetch(:cost)} gold", -> {::Buy.weapon(name)}
        end
        menu.choice "Return to store menu.", -> {::Store.menu}
    end
end