Module: Store
- Defined in:
- lib/lotrd/v-store.rb
Class Method Summary collapse
- .armour_menu ⇒ Object
- .deficit ⇒ Object
- .kick ⇒ Object
- .leave ⇒ Object
- .menu ⇒ Object
- .weapons_menu ⇒ Object
Class Method Details
.armour_menu ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/lotrd/v-store.rb', line 36 def 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 || arm_list.each do |name| .choice "#{name} - Cost: #{arm_stats.fetch(name).fetch(:cost)} gold", -> {::Buy.armour(name)} end .choice "Return to store menu.", -> {::Store.} end end |
.deficit ⇒ Object
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. end |
.kick ⇒ Object
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. end |
.leave ⇒ Object
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. end |
.menu ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/lotrd/v-store.rb', line 10 def system 'clear' puts "Hephy's Forge" + "\n" + "=" * 40 + "\n"*2 prompt = TTY::Prompt.new prompt.select("What would you like to buy today?") do || .choice 'Weapons'.colorize(:light_red), -> {::Store.} .choice 'Armour'.colorize(:light_yellow), -> {::Store.} .choice '"Not buying today, just want to look around!"'.colorize(:light_green), -> {::Store.kick} .choice 'Leave'.colorize(:light_blue), -> {::Store.leave} end end |
.weapons_menu ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/lotrd/v-store.rb', line 22 def 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 || weap_list.each do |name| .choice "#{name} - Cost: #{weap_stats.fetch(name).fetch(:cost)} gold", -> {::Buy.weapon(name)} end .choice "Return to store menu.", -> {::Store.} end end |