gemwarrior 0.9.14 → 0.9.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 93bc49273b5962d3094e927e1f2b604fcd4190b9
4
- data.tar.gz: c7219c8675e8549d72e2df4db0e5caf860ab3b47
3
+ metadata.gz: 88c3d3747f9e71c879c9a889c2db0fb90f87993c
4
+ data.tar.gz: 1199dc2eef209dfcbdebee5d62b538be222f1624
5
5
  SHA512:
6
- metadata.gz: 1efa9aa0504e57f90d77bcf29e1dc6677a7709ba1114016256cf280cf626f3d2e5bd6eed100c5f72eb093f8f52bb1eab16964c454f0c043ef5fb709d1271277c
7
- data.tar.gz: 4d80c518aad9e8eff5fc8f0c916b38031b01b234e3fc13f87ff4eb73c45cc6af4a1cd6538013cb94e6ca82dae2ea727cc9982c80b64d5d7ad94657c1fb0ad165
6
+ metadata.gz: 3e90899c3aa09af280d7950d535deb1d050e9691ee5c7a885aaba685e7623e29677c0909983dcd9269ce2083fe12d1ff185bdf5a4d1b35748354945fa3f87ac3
7
+ data.tar.gz: 774da2943ac2a4a788253f9eb43d6813c051590a48bbb343ae861eafd4fda7acad319a9205e1c9945ca096fe421386fcf1f264ceeef3313d9dd578b093352c32
@@ -35,7 +35,7 @@ module Gemwarrior
35
35
  at_exit do
36
36
  pl = world.player
37
37
  duration = clocker.stop
38
- print_stats(duration, pl)
38
+ log_stats(duration, pl)
39
39
  end
40
40
 
41
41
  clocker.clock {
@@ -116,6 +116,7 @@ module Gemwarrior
116
116
  puts ' (N)ew Game'
117
117
  puts ' (A)bout'
118
118
  puts ' (H)elp'
119
+ puts ' (L)og'
119
120
  puts ' (E)xit'
120
121
  puts '======================='
121
122
  puts
@@ -145,6 +146,10 @@ module Gemwarrior
145
146
  puts choice
146
147
  print_help
147
148
  run_main_menu
149
+ when 'l'
150
+ puts choice
151
+ display_log
152
+ run_main_menu
148
153
  when 'e', 'x'
149
154
  puts choice
150
155
  puts MAIN_MENU_QUIT_MESSAGE
@@ -154,7 +159,18 @@ module Gemwarrior
154
159
  end
155
160
  end
156
161
 
157
- def print_stats(duration, pl)
162
+ def get_log_file_path
163
+ "#{Dir.home}/.gemwarrior"
164
+ end
165
+
166
+ def display_log
167
+ File.open(get_log_file_path).readlines.each do |line|
168
+ puts line
169
+ end
170
+ end
171
+
172
+
173
+ def log_stats(duration, pl)
158
174
  puts '######################################################################'
159
175
  print 'Gem Warrior'.colorize(:color => :white, :background => :black)
160
176
  print " played for #{duration[:mins].to_s.colorize(:color => :white, :background => :black)} minutes, #{duration[:secs].to_s.colorize(:color => :white, :background => :black)} seconds, and #{duration[:ms].to_s.colorize(:color => :white, :background => :black)} milliseconds\n"
@@ -168,6 +184,11 @@ module Gemwarrior
168
184
  print "rested #{pl.rests_taken.to_s.colorize(:color => :white, :background => :black)} time(s)"
169
185
  print "\n"
170
186
  puts '######################################################################'
187
+
188
+ # log stats to file in home directory
189
+ File.open(get_log_file_path, 'a') do |f|
190
+ f.write "#{Time.now} #{pl.name.rjust(10)} - LV:#{pl.level} XP:#{pl.xp} $:#{pl.rox} KIL:#{pl.monsters_killed} ITM:#{pl.items_taken} MOV:#{pl.movements_made} RST:#{pl.rests_taken}\n"
191
+ end
171
192
  end
172
193
 
173
194
  def setup_screen(initialCommand = nil)
@@ -2,5 +2,5 @@
2
2
  # Version of Gem Warrior
3
3
 
4
4
  module Gemwarrior
5
- VERSION = '0.9.14'
5
+ VERSION = '0.9.15'
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gemwarrior
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.14
4
+ version: 0.9.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Chadwick