CoC-Calc 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/bin/CoC-Calc +2 -0
  3. data/lib/CoC-Calc.rb +40 -32
  4. metadata +4 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9b6f91f5cccf742958d38cbec043d0e2ef18250c
4
- data.tar.gz: 7c50f2414670efa703bc5a59fc37b179dcc6de79
3
+ metadata.gz: 102dd1f37707efd35885c487ad872bffd353377d
4
+ data.tar.gz: 9d564ea37daf6679ac3e97174a35c6c76be13669
5
5
  SHA512:
6
- metadata.gz: ffdd285b90a027da91d85f1daecb502e203f9ea25c87dcdc3de6b2cc9e798a45da48b3457c717e85c129168af71d1ae57d56402976aef6456deed2c8d686a102
7
- data.tar.gz: 5456c275740778cdbfe96ec576891a023199e41843c434e98cd65e8b542cf8ea061c547d3f177916541d1f45500de551e8aa6a5b37e86f9ebf1729fa42be793c
6
+ metadata.gz: 7d21e14163c689d1ee83f52643e569cf9afdb25b5451e986ad6ded3690af2a8dafc08f67eea6b3b80722a6a030f7d182345b937cd9757fe1f0ab0166048813d5
7
+ data.tar.gz: aa6398cfd2cecf44429750c521d36f3faf543069683ba7e9e56adcf50a01111a49d811e9d2e222b5afdd1142e99637634a2dbee3962595768adad762b4c16878
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env ruby
2
+ require 'CoC-Calc'
@@ -32,7 +32,9 @@ def initPuts
32
32
 
33
33
  if $lvlSaveContent == ""
34
34
  puts "You need to enter the levels of your troops by running 'ruby CoC-Calc.rb set_troop_lvl' if you need futher help run 'ruby CoC-Calc.rb set_troop_lvl help'!"
35
- end
35
+ else
36
+ puts "Tests were successful!"
37
+ end
36
38
 
37
39
  $lvls = $lvlSaveContent.split('||')
38
40
  $lvls.each do |i|
@@ -225,44 +227,48 @@ def set_troop_lvl
225
227
  end
226
228
 
227
229
  def calc
228
- if ARGV[1].downcase == 'help'
229
- puts 'Calc the training time and cost of your troops run "ruby CoC-Calc.rb calc [amount of barbarians] [amount of archers] [amount of goblins] [amount of giants] [amount of wallbreakers] [amount of ballons] [amount of wizards] [amount of healers] [amount of dragons] [amount of pekkas]"'
230
- elsif File.file? "/CoC-Calc-Saves/lvl.txt"
231
- totalCost = 0
232
- totalTime = 0
230
+ if ARGV[1].is_a? String
231
+ if ARGV[1].downcase == 'help'
232
+ puts 'Calc the training time and cost of your troops run "ruby CoC-Calc.rb calc [amount of barbarians] [amount of archers] [amount of goblins] [amount of giants] [amount of wallbreakers] [amount of ballons] [amount of wizards] [amount of healers] [amount of dragons] [amount of pekkas]"'
233
+ elsif File.file? "/CoC-Calc-Saves/lvl.txt"
234
+ totalCost = 0
235
+ totalTime = 0
233
236
 
234
- get_troop_cost
237
+ get_troop_cost
235
238
 
236
- if $troopLvlErr
239
+ if $troopLvlErr
237
240
 
238
- else
239
- totalCost += ARGV[1].to_i * $cost_barbarians
240
- totalCost += ARGV[2].to_i * $cost_archers
241
- totalCost += ARGV[3].to_i * $cost_goblins
242
- totalCost += ARGV[4].to_i * $cost_giants
243
- totalCost += ARGV[5].to_i * $cost_wallbreakers
244
- totalCost += ARGV[6].to_i * $cost_ballons
245
- totalCost += ARGV[7].to_i * $cost_wizards
246
- totalCost += ARGV[8].to_i * $cost_healers
247
- totalCost += ARGV[9].to_i * $cost_dragons
248
- totalCost += ARGV[10].to_i * $cost_pekkas
241
+ else
242
+ totalCost += ARGV[1].to_i * $cost_barbarians
243
+ totalCost += ARGV[2].to_i * $cost_archers
244
+ totalCost += ARGV[3].to_i * $cost_goblins
245
+ totalCost += ARGV[4].to_i * $cost_giants
246
+ totalCost += ARGV[5].to_i * $cost_wallbreakers
247
+ totalCost += ARGV[6].to_i * $cost_ballons
248
+ totalCost += ARGV[7].to_i * $cost_wizards
249
+ totalCost += ARGV[8].to_i * $cost_healers
250
+ totalCost += ARGV[9].to_i * $cost_dragons
251
+ totalCost += ARGV[10].to_i * $cost_pekkas
249
252
 
250
- totalTime += ARGV[1].to_i * 20
251
- totalTime += ARGV[2].to_i * 25
252
- totalTime += ARGV[3].to_i * 30
253
- totalTime += ARGV[4].to_i * 120
254
- totalTime += ARGV[5].to_i * 120
255
- totalTime += ARGV[6].to_i * 380
256
- totalTime += ARGV[7].to_i * 380
257
- totalTime += ARGV[8].to_i * 900
258
- totalTime += ARGV[9].to_i * 1800
259
- totalTime += ARGV[10].to_i * 2700
253
+ totalTime += ARGV[1].to_i * 20
254
+ totalTime += ARGV[2].to_i * 25
255
+ totalTime += ARGV[3].to_i * 30
256
+ totalTime += ARGV[4].to_i * 120
257
+ totalTime += ARGV[5].to_i * 120
258
+ totalTime += ARGV[6].to_i * 380
259
+ totalTime += ARGV[7].to_i * 380
260
+ totalTime += ARGV[8].to_i * 900
261
+ totalTime += ARGV[9].to_i * 1800
262
+ totalTime += ARGV[10].to_i * 2700
260
263
 
261
- puts "Your Troops will cost #{totalCost} elixir."
262
- puts "Your total training time is #{totalTime}s."
264
+ puts "Your Troops will cost #{totalCost} elixir."
265
+ puts "Your total training time is #{totalTime}s."
266
+ end
267
+ else
268
+ puts "You need to enter the levels of your troops by running 'ruby CoC-Calc.rb set_troop_lvl' if you need futher help run 'ruby CoC-Calc.rb set_troop_lvl help'!"
263
269
  end
264
270
  else
265
- puts "You need to enter the levels of your troops by running 'ruby CoC-Calc.rb set_troop_lvl' if you need futher help run 'ruby CoC-Calc.rb set_troop_lvl help'!"
271
+ puts "You need to supply an argument (run 'CoC-Calc cost help' for help)"
266
272
  end
267
273
  end
268
274
 
@@ -274,4 +280,6 @@ elsif ARGV[0] == 'set_troop_lvl'
274
280
  set_troop_lvl
275
281
  elsif ARGV[0]== 'calc'
276
282
  calc
283
+ else
284
+ puts "CoC-Calc up and running, Sir!"
277
285
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: CoC-Calc
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Bals
@@ -13,10 +13,12 @@ dependencies: []
13
13
  description: Calculate your troop training cost and time for Clash of Clans! Written
14
14
  in Ruby (runns on Mac, Windows and Linux)
15
15
  email: benjustusbals@gmail.com
16
- executables: []
16
+ executables:
17
+ - CoC-Calc
17
18
  extensions: []
18
19
  extra_rdoc_files: []
19
20
  files:
21
+ - bin/CoC-Calc
20
22
  - lib/CoC-Calc.rb
21
23
  homepage: https://github.com/BenBals/CoC-Calc
22
24
  licenses: