reinforce 0.2.3 → 0.3.0
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 +4 -4
- data/generated/abilities.json +1 -1
- data/generated/ebps.json +1 -1
- data/generated/sbps.json +1 -1
- data/generated/upgrade.json +1 -1
- data/lib/reinforce/attributes/ability.rb +0 -3
- data/lib/reinforce/attributes/entity.rb +2 -6
- data/lib/reinforce/attributes/squad.rb +1 -4
- data/lib/reinforce/attributes/upgrade.rb +0 -3
- data/lib/reinforce/command.rb +1 -1
- data/lib/reinforce/dictionary.rb +29 -0
- data/lib/reinforce/factory.rb +1 -1
- data/lib/reinforce/version.rb +1 -1
- data/lib/reinforce.rb +5 -0
- metadata +3 -2
@@ -99,9 +99,6 @@ module Reinforce
|
|
99
99
|
|
100
100
|
def parse_ability_bag(data, path)
|
101
101
|
locstring = data.dig('ability_bag', 'ui_info', 'screen_name', 'locstring', 'value')
|
102
|
-
|
103
|
-
return if locstring.nil? || locstring == '0'
|
104
|
-
|
105
102
|
icon_name = data.dig('ability_bag', 'ui_info', 'icon_name')
|
106
103
|
builds = data.dig('ability_bag', 'cursor_ghost_ebp', 'instance_reference')
|
107
104
|
|
@@ -32,11 +32,7 @@ module Reinforce
|
|
32
32
|
end
|
33
33
|
|
34
34
|
def parse_extensions(data, path)
|
35
|
-
locstring
|
36
|
-
|
37
|
-
return if locstring.nil? || locstring == '0'
|
38
|
-
|
39
|
-
new(locstring:,
|
35
|
+
new(locstring: parse_locstring(data),
|
40
36
|
icon_name: parse_icon_name(data),
|
41
37
|
path:,
|
42
38
|
spawns: parse_spawns(data),
|
@@ -51,7 +47,7 @@ module Reinforce
|
|
51
47
|
|
52
48
|
def parse_icon_name(data)
|
53
49
|
ext_data = data['extensions'].find { |ext| ext['exts'].key?('screen_name') }
|
54
|
-
ext_data
|
50
|
+
ext_data&.dig('exts', 'icon_name')
|
55
51
|
end
|
56
52
|
|
57
53
|
def parse_spawns(data)
|
@@ -26,10 +26,7 @@ module Reinforce
|
|
26
26
|
def parse_extensions(data, path)
|
27
27
|
squad_data = squad_data_from(data)
|
28
28
|
locstring = squad_data&.dig('race_data', 'info', 'screen_name', 'locstring', 'value')
|
29
|
-
|
30
|
-
return if locstring.nil? || locstring == '0'
|
31
|
-
|
32
|
-
icon_name = squad_data.dig('race_data', 'info', 'icon_name')
|
29
|
+
icon_name = squad_data&.dig('race_data', 'info', 'icon_name')
|
33
30
|
|
34
31
|
new(locstring:,
|
35
32
|
icon_name:,
|
@@ -25,9 +25,6 @@ module Reinforce
|
|
25
25
|
|
26
26
|
def parse_upgrade_bag(data, path)
|
27
27
|
locstring = data.dig('upgrade_bag', 'ui_info', 'screen_name', 'locstring', 'value')
|
28
|
-
|
29
|
-
return if locstring.nil? || locstring == '0'
|
30
|
-
|
31
28
|
icon_name = data.dig('upgrade_bag', 'ui_info', 'icon_name')
|
32
29
|
|
33
30
|
new(locstring:,
|
data/lib/reinforce/command.rb
CHANGED
@@ -11,7 +11,7 @@ module Reinforce
|
|
11
11
|
@pbgid = command_hash.values.first[:pbgid]
|
12
12
|
@source = command_hash.values.first[:source_identifier]
|
13
13
|
@index = command_hash.values.first[:queue_index]
|
14
|
-
@details =
|
14
|
+
@details = Reinforce.dictionary.get_by_pbgid(@pbgid, build: build_number)
|
15
15
|
@cancelled = false
|
16
16
|
@suspect_from_tick = nil
|
17
17
|
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'forwardable'
|
4
|
+
require 'singleton'
|
5
|
+
|
6
|
+
module Reinforce
|
7
|
+
class Dictionary
|
8
|
+
include Singleton
|
9
|
+
extend Forwardable
|
10
|
+
|
11
|
+
def_delegators :@collection, :get_by_pbgid, :get_by_path
|
12
|
+
|
13
|
+
def initialize
|
14
|
+
@collection = Attributes::Collection.new
|
15
|
+
|
16
|
+
[Attributes::Ability, Attributes::Entity, Attributes::Squad, Attributes::Upgrade].each do |klass|
|
17
|
+
generated_path = File.join(Reinforce.root, 'generated', klass::FILENAME)
|
18
|
+
File.open(generated_path) do |file|
|
19
|
+
data = JSON.parse(file.read)
|
20
|
+
data.each do |build, attributes|
|
21
|
+
@collection.populate(build, attributes.map { |a| klass.new(**a.transform_keys(&:to_sym)) }, rehash: false)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
@collection.rehash_all
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
data/lib/reinforce/factory.rb
CHANGED
@@ -100,7 +100,7 @@ module Reinforce
|
|
100
100
|
commands.each_with_index do |command, idx|
|
101
101
|
next unless command.suspect?
|
102
102
|
|
103
|
-
building_details =
|
103
|
+
building_details = Reinforce.dictionary.get_by_path(command.details&.builds, build: @build_number)
|
104
104
|
remaining = commands[(idx + 1)..]
|
105
105
|
relevant = remaining.take_while { |c| c.pbgid != command.pbgid }
|
106
106
|
|
data/lib/reinforce/version.rb
CHANGED
data/lib/reinforce.rb
CHANGED
@@ -12,6 +12,7 @@ require_relative 'reinforce/attributes/upgrade'
|
|
12
12
|
require_relative 'reinforce/attributes/collection'
|
13
13
|
|
14
14
|
require_relative 'reinforce/command'
|
15
|
+
require_relative 'reinforce/dictionary'
|
15
16
|
require_relative 'reinforce/factory'
|
16
17
|
|
17
18
|
require_relative 'reinforce/version'
|
@@ -32,6 +33,10 @@ module Reinforce
|
|
32
33
|
Factory.new(player, build_number).build(with_cancellations:)
|
33
34
|
end
|
34
35
|
|
36
|
+
def self.dictionary
|
37
|
+
Dictionary.instance
|
38
|
+
end
|
39
|
+
|
35
40
|
# Parses data into structures for build order generation
|
36
41
|
def self.generate(pretty: false)
|
37
42
|
[
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: reinforce
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ryantaylor
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-09-
|
11
|
+
date: 2024-09-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: vault_coh
|
@@ -51,6 +51,7 @@ files:
|
|
51
51
|
- lib/reinforce/attributes/squad.rb
|
52
52
|
- lib/reinforce/attributes/upgrade.rb
|
53
53
|
- lib/reinforce/command.rb
|
54
|
+
- lib/reinforce/dictionary.rb
|
54
55
|
- lib/reinforce/factory.rb
|
55
56
|
- lib/reinforce/version.rb
|
56
57
|
homepage: https://github.com/ryantaylor/reinforce
|