gemwarrior 0.15.16 → 0.15.18

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
  SHA256:
3
- metadata.gz: af41531f83649ddfdb29e63eb5dd8dabf1da21c4cae9874a3a531fa4559c3c22
4
- data.tar.gz: e1249f0aec95bfabd4a8ef0e69a645bee74da5db6ce9d60aaea2bd0dae556bee
3
+ metadata.gz: ce326e3393bebcd6d56b485f4917f1def84b3e69eb2a447bd5ec9db075cd5061
4
+ data.tar.gz: 8b1e6a56da8f254f265f33c43fac9e376928825afdaa98b6a3f1ed01210e85a6
5
5
  SHA512:
6
- metadata.gz: e118be36f9aa2ecbd5c22f79ac098d71f672341652ca0e92e7755ce5ca3a09f45504707607a070eec0632f36b1cfaa553d82f15d98a97b03d9c14ba8ed24874a
7
- data.tar.gz: c77c150026e63e7ba0d8d7de76513baf01ccc6f7b5b3bfb6b6a0ccd545e72e33008ff662ea2c56be1c86dda64d1c8adebd71f69ac1dd12d5559d25f17b79c3c6
6
+ metadata.gz: d3b7c1241202972cb8b8819d0789257ebe0bcf809e0b9f8476e08d21c7f3f5571ec4374b6aba067404e0403771feb30627b0bb18ce46e6d4df0fa5037d8bb232
7
+ data.tar.gz: aa622e3a42077a681f1a94c4ff538a5caeda7cdbe809955a56c0b05f0a299b674bcfc07b9dabccc798d3cee0d8a943bbf76577059bd386067d97fe1647ed43b0
data/gemwarrior.gemspec CHANGED
@@ -4,28 +4,34 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  require 'gemwarrior/version'
6
6
 
7
+ source_uri = 'https://github.com/michaelchadwick/gemwarrior'
8
+ rubygem_uri = 'http://rubygems.org/gems/gemwarrior'
9
+
7
10
  Gem::Specification.new do |spec|
8
- # required
9
- spec.name = 'gemwarrior'
10
- spec.summary = 'RubyGem text adventure'
11
- spec.version = Gemwarrior::VERSION
12
- spec.authors = ['Michael Chadwick']
13
- spec.files = `git ls-files`.split("\n")
11
+ spec.name = 'gemwarrior'
12
+ spec.summary = 'RubyGem text adventure'
13
+ spec.version = Gemwarrior::VERSION
14
+ spec.platform = Gem::Platform::RUBY
15
+ spec.authors = ['Michael Chadwick']
16
+ spec.email = ['mike@neb.host']
17
+ spec.homepage = rubygem_uri
18
+ spec.license = 'MIT'
19
+ spec.description = 'A fun text adventure in the form of a RubyGem!'
20
+
21
+ spec.files = `git ls-files`.split("\n")
22
+ spec.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
23
+ spec.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
24
+ spec.require_paths = ['lib']
14
25
 
15
- # recommended
16
- spec.description = 'A fun text adventure in the form of a RubyGem!'
17
- spec.email = 'mike@neb.host'
18
- spec.homepage = 'https://github.com/michaelchadwick/gemwarrior'
19
- spec.license = 'MIT'
20
- spec.metadata = {
21
- "documentation_uri" => "https://github.com/michaelchadwick/gemwarrior",
22
- "homepage_uri" => "https://github.com/michaelchadwick/gemwarrior",
23
- "source_code_uri" => "https://github.com/michaelchadwick/gemwarrior"
24
- }
26
+ spec.metadata = {
27
+ "documentation_uri" => source_uri,
28
+ "homepage_uri" => source_uri,
29
+ "source_code_uri" => source_uri
30
+ }
25
31
  spec.required_ruby_version = '~> 2.0'
32
+ spec.post_install_message = "Type 'gemwarrior' to start adventuring!"
26
33
 
27
- # additional
28
- ## runtime deps
34
+ ## required deps
29
35
  spec.add_runtime_dependency 'clocker', '~> 0.1.6'
30
36
  spec.add_runtime_dependency 'colorize', '~> 1.0'
31
37
  spec.add_runtime_dependency 'gems', '~> 1.2'
@@ -34,13 +40,11 @@ Gem::Specification.new do |spec|
34
40
  spec.add_runtime_dependency 'matrext', '~> 1.0'
35
41
  spec.add_runtime_dependency 'os', '~> 0.9', '>= 0.9.6'
36
42
  spec.add_runtime_dependency 'psych', '~> 5.1'
37
- ## sound systems
38
- #spec.add_runtime_dependency 'feep', '~> 0.1.3'
39
- #spec.add_runtime_dependency 'win32-sound', '~> 0.6.0'
40
- #spec.add_runtime_dependency 'bloopsaphone', '>= 0.4'
41
- # spec.platform = Gem::Platform::RUBY
42
- spec.post_install_message = "Type 'gemwarrior' to start adventuring!"
43
- # spec.require_paths = ['lib']
43
+ ## optional sound systems
44
+ # spec.add_runtime_dependency 'bloopsaphone', '>= 0.4'
45
+ # spec.add_runtime_dependency 'feep', '~> 0.1.3'
46
+ # spec.add_runtime_dependency 'win32-sound', '~> 0.6.0'
47
+
44
48
  ## development deps
45
49
  spec.add_development_dependency 'awesome_print', '~> 1.9'
46
50
  spec.add_development_dependency 'bundler', '~> 2.4'
@@ -49,7 +49,10 @@ module Gemwarrior
49
49
  # create new world based on yaml/marshall data
50
50
  self.world = init_world
51
51
 
52
- # update some player aspects to make more dynamic
52
+ # spawn bosses inside world
53
+ self.init_bosses
54
+
55
+ # update some aspects of world's player to make more dynamic
53
56
  self.world.player.name = world.player.generate_name
54
57
  self.world.player.face = world.player.generate_face
55
58
  self.world.player.hands = world.player.generate_hands
@@ -63,9 +66,6 @@ module Gemwarrior
63
66
  self.world.shifty_to_jewel = false
64
67
  self.world.shifty_has_jeweled = false
65
68
 
66
- # # spawn bosses
67
- self.init_bosses
68
-
69
69
  # mark home as visited
70
70
  self.world.location_by_name('home').visited = true
71
71
 
@@ -8,7 +8,11 @@ require_relative '../game_options'
8
8
  module Gemwarrior
9
9
  module Audio
10
10
  # CONSTANTS
11
- ERROR_SOUND_NOT_ENABLED = 'Sound is disabled! Enable in main options to hear sound.'
11
+ ERROR_SOUND_NOT_ENABLED = 'Sound is disabled! Enable in main options to hear sound.'
12
+ ERROR_SOUND_SYSTEM_NOT_CHOSEN = 'Sound system not chosen! Choose one in main options to hear sound.'
13
+ ERROR_BLOOPS_NOT_FOUND = 'bloopsaphone gem not found. Try \'gem install bloopsaphone\'.'
14
+ ERROR_FEEP_NOT_FOUND = 'feep gem not found. Try \'gem install feep\'.'
15
+ ERROR_WIN32_NOT_FOUND = 'win32-sound gem not found. Try \'gem install win32-sound\'.'
12
16
 
13
17
  def self.init
14
18
  if GameOptions.data['sound_system'].eql?('win32-sound')
@@ -49,76 +53,92 @@ module Gemwarrior
49
53
 
50
54
  def self.play_synth(audio_cue_symbol)
51
55
  if GameOptions.data['sound_enabled']
52
- case GameOptions.data['sound_system']
53
- when 'win32-sound'
54
- require_relative 'audio_cues'
55
- require_relative 'musical_notes'
56
+ if GameOptions.data['sound_system']
57
+ case GameOptions.data['sound_system']
58
+ when 'win32-sound'
59
+ if system('gem list -ie win32-sound')
60
+ require_relative 'audio_cues'
61
+ require_relative 'musical_notes'
56
62
 
57
- if AudioCues.cues[audio_cue_symbol]
58
- Thread.start do
59
- AudioCues.cues[audio_cue_symbol][:synth].each do |seq|
60
- threads = []
61
- seq[:frequencies].split(',').each do |note|
62
- threads << Thread.new do
63
- Win32::Sound::play_freq(Notes::NOTE_FREQ[note], seq[:duration], GameOptions.data['sound_volume'])
63
+ if AudioCues.cues[audio_cue_symbol]
64
+ Thread.start do
65
+ AudioCues.cues[audio_cue_symbol][:synth].each do |seq|
66
+ threads = []
67
+ seq[:frequencies].split(',').each do |note|
68
+ threads << Thread.new do
69
+ Win32::Sound::play_freq(Notes::NOTE_FREQ[note], seq[:duration], GameOptions.data['sound_volume'])
70
+ end
71
+ end
72
+ threads.each { |th| th.join }
64
73
  end
65
74
  end
66
- threads.each { |th| th.join }
67
75
  end
76
+ else
77
+ GameOptions.data['errors'] = ERROR_WIN32_NOT_FOUND
68
78
  end
69
- end
70
- when 'feep'
71
- require_relative 'audio_cues'
79
+ when 'feep'
80
+ if system('gem list -ie feep')
81
+ require_relative 'audio_cues'
72
82
 
73
- feep_defaults = {
74
- frequencies: '440',
75
- waveform: 'sine',
76
- volume: GameOptions.data['sound_volume'],
77
- duration: 500,
78
- notext: true
79
- }
83
+ feep_defaults = {
84
+ frequencies: '440',
85
+ waveform: 'sine',
86
+ volume: GameOptions.data['sound_volume'],
87
+ duration: 500,
88
+ notext: true
89
+ }
80
90
 
81
- if AudioCues.cues[audio_cue_symbol]
82
- Thread.start do
83
- AudioCues.cues[audio_cue_symbol][:synth].each do |seq|
84
- seq = feep_defaults.merge(seq)
91
+ if AudioCues.cues[audio_cue_symbol]
92
+ Thread.start do
93
+ AudioCues.cues[audio_cue_symbol][:synth].each do |seq|
94
+ seq = feep_defaults.merge(seq)
85
95
 
86
- Feep::Base.new({
87
- freq_or_note: seq[:frequencies],
88
- waveform: seq[:waveform],
89
- volume: seq[:volume],
90
- duration: seq[:duration],
91
- notext: seq[:notext]
92
- })
96
+ Feep::Base.new({
97
+ freq_or_note: seq[:frequencies],
98
+ waveform: seq[:waveform],
99
+ volume: seq[:volume],
100
+ duration: seq[:duration],
101
+ notext: seq[:notext]
102
+ })
103
+ end
104
+ end
93
105
  end
106
+ else
107
+ GameOptions.data['errors'] = ERROR_FEEP_NOT_FOUND
94
108
  end
95
- end
96
- when 'bloops'
97
- require_relative 'bloops_cues'
109
+ when 'bloops'
110
+ if system('gem list -ie bloops')
111
+ require_relative 'bloops_cues'
98
112
 
99
- if BloopsCues.cues[audio_cue_symbol]
100
- Thread.start do
101
- BloopsCues.cues[audio_cue_symbol][:synth].each do |seq|
102
- threads = []
113
+ if BloopsCues.cues[audio_cue_symbol]
114
+ Thread.start do
115
+ BloopsCues.cues[audio_cue_symbol][:synth].each do |seq|
116
+ threads = []
103
117
 
104
- seq.each do |note|
105
- threads << Thread.new do
106
- b = Bloops.new
107
- b.tempo = 240
108
- snd = b.sound Bloops::SQUARE
109
- snd.punch = GameOptions.data['sound_volume']/2
110
- snd.sustain = 0.7
111
- snd.decay = 0.2
112
- b.tune snd, note[1]
113
- b.play
114
- sleep 0.1 while !b.stopped?
118
+ seq.each do |note|
119
+ threads << Thread.new do
120
+ b = Bloops.new
121
+ b.tempo = 240
122
+ snd = b.sound Bloops::SQUARE
123
+ snd.punch = GameOptions.data['sound_volume']/2
124
+ snd.sustain = 0.7
125
+ snd.decay = 0.2
126
+ b.tune snd, note[1]
127
+ b.play
128
+ sleep 0.1 while !b.stopped?
129
+ end
130
+ end
131
+
132
+ threads.each { |th| th.join }
115
133
  end
116
134
  end
117
-
118
- threads.each { |th| th.join }
119
135
  end
136
+ else
137
+ GameOptions.data['errors'] = ERROR_BLOOPS_NOT_FOUND
120
138
  end
121
139
  end
140
+ else
141
+ GameOptions.data['errors'] = ERROR_SOUND_SYSTEM_NOT_CHOSEN
122
142
  end
123
143
  else
124
144
  GameOptions.data['errors'] = ERROR_SOUND_NOT_ENABLED
@@ -255,17 +255,21 @@ module Gemwarrior
255
255
  if OS.windows?
256
256
  puts answer
257
257
  GameOptions.add 'sound_system', 'win32-sound'
258
+ Audio.init
258
259
  else
259
- puts
260
+ puts answer
261
+ puts "Sorry, but your system doesn't seem to be running Windows."
260
262
  end
261
263
  print_options_sound_sytem
262
264
  when '2'
263
265
  puts answer
264
266
  GameOptions.add 'sound_system', 'feep'
267
+ Audio.init
265
268
  print_options_sound_sytem
266
269
  when '3'
267
270
  puts answer
268
271
  GameOptions.add 'sound_system', 'bloops'
272
+ Audio.init
269
273
  print_options_sound_sytem
270
274
  when 't'
271
275
  puts answer
@@ -304,6 +308,9 @@ module Gemwarrior
304
308
  when '1'
305
309
  print answer
306
310
  GameOptions.data['sound_enabled'] = !GameOptions.data['sound_enabled']
311
+ if GameOptions.data['sound_enabled']
312
+ Audio.init
313
+ end
307
314
  print_options
308
315
  when '2'
309
316
  print answer
@@ -2,5 +2,5 @@
2
2
  # Version of Gem Warrior
3
3
 
4
4
  module Gemwarrior
5
- VERSION = '0.15.16'
5
+ VERSION = '0.15.18'
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gemwarrior
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.15.16
4
+ version: 0.15.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Chadwick
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-09-06 00:00:00.000000000 Z
11
+ date: 2023-09-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: clocker
@@ -269,8 +269,10 @@ dependencies:
269
269
  - !ruby/object:Gem::Version
270
270
  version: '1.50'
271
271
  description: A fun text adventure in the form of a RubyGem!
272
- email: mike@neb.host
273
- executables: []
272
+ email:
273
+ - mike@neb.host
274
+ executables:
275
+ - gemwarrior
274
276
  extensions: []
275
277
  extra_rdoc_files: []
276
278
  files:
@@ -399,7 +401,7 @@ files:
399
401
  - tests/test-save-load/save.conf
400
402
  - tests/test-singleton/game.rb
401
403
  - tests/test-singleton/game_options.rb
402
- homepage: https://github.com/michaelchadwick/gemwarrior
404
+ homepage: http://rubygems.org/gems/gemwarrior
403
405
  licenses:
404
406
  - MIT
405
407
  metadata:
@@ -425,4 +427,6 @@ rubygems_version: 3.4.19
425
427
  signing_key:
426
428
  specification_version: 4
427
429
  summary: RubyGem text adventure
428
- test_files: []
430
+ test_files:
431
+ - spec/gemwarrior_spec.rb
432
+ - spec/spec_helper.rb