tormenta20 0.2.8 → 0.2.9

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: 4307d85fbff7bd5b5d717f6cfeb0d31516f11ac0b706954430b22b984f3b0b90
4
- data.tar.gz: 76ac8b3fc839b7d3eed1f7edcba049b18626bd121b96120af729020cdea4140c
3
+ metadata.gz: d1b98f4734af48a9e6fc4e34b0b36e20f6341138f52ab2893fd5bef241296719
4
+ data.tar.gz: 6a4a8e722d23d3addc71ae256e3ea7e259f43e6e43905fb0405fd3155bd64217
5
5
  SHA512:
6
- metadata.gz: 1e6cdae56dfe316483ce3a1cc7cd12fabdaa2a51bfbdbae529ffb9afe1f1b260833de4108ef5c6b19628e52a1f8e0fedb42e42738facdbbbcca3cb11b36bb3f2
7
- data.tar.gz: '0282ce25f0d66e926b1b632a2cfc4c46ba5c4d12788f5559b123d360a9b9df7b7445d739b24c67348a554be443daa337b67c8d63da386be1a98ba345ae86d972'
6
+ metadata.gz: 84016ffbdc3b37c630165570215a33c426728c1b7dd94b9ed31ea00d4cbec3d61a95213cdcc8ed0339b9f1cbe15b93d14acddba71edd20359b3f995c7f1a1578
7
+ data.tar.gz: 5f2e29cc1c0d8cf1e750d27574fdaefd61d7e43572dca85783a385a8183a48c3e320226f912c4c749d0dba70309ed587901236c30d3fb4707887ef1088f23f26
data/db/seeds.rb CHANGED
@@ -163,7 +163,7 @@ module Tormenta20
163
163
  json_dir = File.join(JSON_BASE_PATH, "magias")
164
164
  return puts " Directory not found: #{json_dir}" unless Dir.exist?(json_dir)
165
165
 
166
- files = Dir.glob(File.join(json_dir, "*.json"))
166
+ files = Dir.glob(File.join(json_dir, "**", "*.json"))
167
167
  puts " Found #{files.size} magia files"
168
168
 
169
169
  success_count = 0
@@ -249,11 +249,29 @@ module Tormenta20
249
249
  import_itens
250
250
  end
251
251
 
252
+ PROFICIENCIA_TO_CATEGORY = {
253
+ "simples" => "simples",
254
+ "marcial" => "marciais",
255
+ "exotica" => "exoticas",
256
+ "fogo" => "fogo"
257
+ }.freeze
258
+
252
259
  def import_armas
253
260
  import_json_files(
254
261
  "equipamentos/armas",
255
262
  Models::Arma,
256
- %i[id name category price damage damage_type critical range weight properties description]
263
+ %i[id name category price damage damage_type critical range weight properties description],
264
+ transform: lambda { |data|
265
+ data[:category] ||= PROFICIENCIA_TO_CATEGORY[data.delete(:proficiencia).to_s]
266
+ data[:price] ||= data.delete(:preco)
267
+ data[:damage] ||= data.delete(:dano)
268
+ data[:damage_type] ||= data.delete(:tipo_dano)
269
+ data[:critical] ||= data.delete(:critico)
270
+ data[:range] ||= data.delete(:alcance)
271
+ data[:weight] ||= data.delete(:espacos)
272
+ data[:properties] ||= [data.delete(:habilidades), data.delete(:especial)].flatten.compact
273
+ data
274
+ }
257
275
  )
258
276
  end
259
277
 
@@ -261,7 +279,16 @@ module Tormenta20
261
279
  import_json_files(
262
280
  "equipamentos/armaduras",
263
281
  Models::Armadura,
264
- %i[id name category price defense_bonus armor_penalty weight properties description]
282
+ %i[id name category price defense_bonus armor_penalty weight properties description],
283
+ transform: lambda { |data|
284
+ data[:category] ||= data.delete(:categoria)
285
+ data[:price] ||= data.delete(:preco)
286
+ data[:defense_bonus] ||= data.delete(:bonus_defesa)
287
+ data[:armor_penalty] ||= data.delete(:penalidade_armadura)
288
+ data[:weight] ||= data.delete(:espacos)
289
+ data[:properties] ||= [data.delete(:especial)].flatten.compact
290
+ data
291
+ }
265
292
  )
266
293
  end
267
294
 
@@ -284,7 +311,13 @@ module Tormenta20
284
311
  import_json_files(
285
312
  "equipamentos/itens",
286
313
  Models::Item,
287
- %i[id name category price weight description effects]
314
+ %i[id name category price weight description effects],
315
+ transform: lambda { |data|
316
+ data[:category] ||= data.delete(:categoria)
317
+ data[:price] ||= data.delete(:preco)
318
+ data[:weight] ||= data.delete(:espacos)
319
+ data
320
+ }
288
321
  )
289
322
  end
290
323
 
@@ -374,7 +407,7 @@ module Tormenta20
374
407
  return
375
408
  end
376
409
 
377
- files = Dir.glob(File.join(json_dir, "*.json"))
410
+ files = Dir.glob(File.join(json_dir, "**", "*.json"))
378
411
  puts " Found #{files.size} files"
379
412
 
380
413
  return if files.empty?
Binary file
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Tormenta20
4
- VERSION = "0.2.8"
4
+ VERSION = "0.2.9"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tormenta20
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.8
4
+ version: 0.2.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - LuanGB