dsp_blueprint_parser 0.2.2 → 0.2.3

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.
@@ -1,46 +1,46 @@
1
- # frozen_string_literal: true
2
-
3
- module DspBlueprintParser
4
- # class to manage the position of byte array while parsing data out of it
5
- class BinaryReader
6
- # @param data [Array<byte>]
7
- def initialize(data)
8
- @data = data
9
- @position = 0
10
- end
11
-
12
- def read_i32
13
- get_integer(4, 'l<')
14
- end
15
-
16
- def read_i16
17
- get_integer(2, 's<')
18
- end
19
-
20
- def read_i8
21
- get_integer(1, 'c')
22
- end
23
-
24
- def read_single
25
- get_integer(4, 'e')
26
- end
27
-
28
- private
29
-
30
- # @param byte_count [Integer]
31
- # @return [String]
32
- def get_string(byte_count)
33
- value = @data[@position..@position + byte_count].pack('C*').force_encoding('UTF-8')
34
- @position += byte_count
35
-
36
- value
37
- end
38
-
39
- # @param byte_count [Integer]
40
- # @param format [String]
41
- # @return [Integer]
42
- def get_integer(byte_count, format)
43
- get_string(byte_count).unpack1(format)
44
- end
45
- end
46
- end
1
+ # frozen_string_literal: true
2
+
3
+ module DspBlueprintParser
4
+ # class to manage the position of byte array while parsing data out of it
5
+ class BinaryReader
6
+ # @param data [Array<byte>]
7
+ def initialize(data)
8
+ @data = data
9
+ @position = 0
10
+ end
11
+
12
+ def read_i32
13
+ get_integer(4, 'l<')
14
+ end
15
+
16
+ def read_i16
17
+ get_integer(2, 's<')
18
+ end
19
+
20
+ def read_i8
21
+ get_integer(1, 'c')
22
+ end
23
+
24
+ def read_single
25
+ get_integer(4, 'e')
26
+ end
27
+
28
+ private
29
+
30
+ # @param byte_count [Integer]
31
+ # @return [String]
32
+ def get_string(byte_count)
33
+ value = @data[@position..@position + byte_count].pack('C*').force_encoding('UTF-8')
34
+ @position += byte_count
35
+
36
+ value
37
+ end
38
+
39
+ # @param byte_count [Integer]
40
+ # @param format [String]
41
+ # @return [Integer]
42
+ def get_integer(byte_count, format)
43
+ get_string(byte_count).unpack1(format)
44
+ end
45
+ end
46
+ end
@@ -1,69 +1,78 @@
1
- # frozen_string_literal: true
2
-
3
- module DspBlueprintParser
4
- # data class for parsed blueprint
5
- class BlueprintData
6
- def initialize
7
- @areas = []
8
- @buildings = []
9
- end
10
-
11
- # @return [DateTime]
12
- attr_accessor :time
13
-
14
- # @return [String]
15
- attr_accessor :game_version
16
-
17
- # @return [String]
18
- attr_accessor :short_description
19
-
20
- # @return [String]
21
- attr_accessor :description
22
-
23
- # Integer is a const value from IconLayout
24
- # @return [Integer]
25
- attr_accessor :icon_layout
26
-
27
- # @return [Integer]
28
- attr_accessor :icon0
29
-
30
- # @return [Integer]
31
- attr_accessor :icon1
32
-
33
- # @return [Integer]
34
- attr_accessor :icon2
35
-
36
- # @return [Integer]
37
- attr_accessor :icon3
38
-
39
- # @return [Integer]
40
- attr_accessor :icon4
41
-
42
- # @return [Integer]
43
- attr_accessor :cursor_offset_x
44
-
45
- # @return [Integer]
46
- attr_accessor :cursor_offset_y
47
-
48
- # @return [Integer]
49
- attr_accessor :cursor_target_area
50
-
51
- # @return [Integer]
52
- attr_accessor :drag_box_size_x
53
-
54
- # @return [Integer]
55
- attr_accessor :drag_box_size_y
56
-
57
- # @return [Integer]
58
- attr_accessor :primary_area_idx
59
-
60
- # @return [Array<Area>]
61
- attr_accessor :areas
62
-
63
- # @return [Array<Building>]
64
- attr_accessor :buildings
65
-
66
- # @return [Integer]
67
- attr_accessor :version
68
- end
69
- end
1
+ # frozen_string_literal: true
2
+
3
+ module DspBlueprintParser
4
+ # data class for parsed blueprint
5
+ class BlueprintData
6
+ def initialize
7
+ @areas = []
8
+ @buildings = []
9
+ end
10
+
11
+ # @return [DateTime]
12
+ attr_accessor :time
13
+
14
+ # @return [String]
15
+ attr_accessor :game_version
16
+
17
+ # @return [String]
18
+ attr_accessor :short_description
19
+
20
+ # @return [String]
21
+ attr_accessor :description
22
+
23
+ # Integer is a const value from IconLayout
24
+ # @return [Integer]
25
+ attr_accessor :icon_layout
26
+
27
+ # @return [Integer]
28
+ attr_accessor :icon0
29
+
30
+ # @return [Integer]
31
+ attr_accessor :icon1
32
+
33
+ # @return [Integer]
34
+ attr_accessor :icon2
35
+
36
+ # @return [Integer]
37
+ attr_accessor :icon3
38
+
39
+ # @return [Integer]
40
+ attr_accessor :icon4
41
+
42
+ # @return [Integer]
43
+ attr_accessor :cursor_offset_x
44
+
45
+ # @return [Integer]
46
+ attr_accessor :cursor_offset_y
47
+
48
+ # @return [Integer]
49
+ attr_accessor :cursor_target_area
50
+
51
+ # @return [Integer]
52
+ attr_accessor :drag_box_size_x
53
+
54
+ # @return [Integer]
55
+ attr_accessor :drag_box_size_y
56
+
57
+ # @return [Integer]
58
+ attr_accessor :primary_area_idx
59
+
60
+ # @return [Array<Area>]
61
+ attr_accessor :areas
62
+
63
+ # @return [Array<Building>]
64
+ attr_accessor :buildings
65
+
66
+ # @return [Integer]
67
+ attr_accessor :version
68
+
69
+ # @return [String, nil]
70
+ attr_accessor :custom_version
71
+
72
+ # @return [String, nil]
73
+ attr_accessor :author
74
+
75
+ # @return [Array<String>, nil]
76
+ attr_accessor :attributes
77
+ end
78
+ end
@@ -1,91 +1,91 @@
1
- # frozen_string_literal: true
2
-
3
- module DspBlueprintParser
4
- # data class for parsed building
5
- class Building
6
- def initialize
7
- @parameters = []
8
- end
9
-
10
- # @return [Integer]
11
- attr_accessor :index
12
-
13
- # @return [Integer]
14
- attr_accessor :area_index
15
-
16
- # @return [Float]
17
- attr_accessor :local_offset_x
18
-
19
- # @return [Float]
20
- attr_accessor :local_offset_y
21
-
22
- # @return [Float]
23
- attr_accessor :local_offset_z
24
-
25
- # @return [Float]
26
- attr_accessor :local_offset_x2
27
-
28
- # @return [Float]
29
- attr_accessor :local_offset_y2
30
-
31
- # @return [Float]
32
- attr_accessor :local_offset_z2
33
-
34
- # @return [Float]
35
- attr_accessor :yaw
36
-
37
- # @return [Float]
38
- attr_accessor :yaw2
39
-
40
- # @return [Float]
41
- attr_accessor :tilt
42
-
43
- # @return [Float]
44
- attr_accessor :tilt2
45
-
46
- # @return [Float]
47
- attr_accessor :pitch
48
-
49
- # @return [Float]
50
- attr_accessor :pitch2
51
-
52
- # @return [Integer]
53
- attr_accessor :item_id
54
-
55
- # @return [Integer]
56
- attr_accessor :model_index
57
-
58
- # @return [Integer]
59
- attr_accessor :temp_output_obj_idx
60
-
61
- # @return [Integer]
62
- attr_accessor :temp_input_obj_idx
63
-
64
- # @return [Integer]
65
- attr_accessor :output_to_slot
66
-
67
- # @return [Integer]
68
- attr_accessor :input_from_slot
69
-
70
- # @return [Integer]
71
- attr_accessor :output_from_slot
72
-
73
- # @return [Integer]
74
- attr_accessor :input_to_slot
75
-
76
- # @return [Integer]
77
- attr_accessor :output_offset
78
-
79
- # @return [Integer]
80
- attr_accessor :input_offset
81
-
82
- # @return [Integer]
83
- attr_accessor :recipe_id
84
-
85
- # @return [Integer]
86
- attr_accessor :filter_fd
87
-
88
- # @return [Array<Integer>]
89
- attr_accessor :parameters
90
- end
91
- end
1
+ # frozen_string_literal: true
2
+
3
+ module DspBlueprintParser
4
+ # data class for parsed building
5
+ class Building
6
+ def initialize
7
+ @parameters = []
8
+ end
9
+
10
+ # @return [Integer]
11
+ attr_accessor :index
12
+
13
+ # @return [Integer]
14
+ attr_accessor :area_index
15
+
16
+ # @return [Float]
17
+ attr_accessor :local_offset_x
18
+
19
+ # @return [Float]
20
+ attr_accessor :local_offset_y
21
+
22
+ # @return [Float]
23
+ attr_accessor :local_offset_z
24
+
25
+ # @return [Float]
26
+ attr_accessor :local_offset_x2
27
+
28
+ # @return [Float]
29
+ attr_accessor :local_offset_y2
30
+
31
+ # @return [Float]
32
+ attr_accessor :local_offset_z2
33
+
34
+ # @return [Float]
35
+ attr_accessor :yaw
36
+
37
+ # @return [Float]
38
+ attr_accessor :yaw2
39
+
40
+ # @return [Float]
41
+ attr_accessor :tilt
42
+
43
+ # @return [Float]
44
+ attr_accessor :tilt2
45
+
46
+ # @return [Float]
47
+ attr_accessor :pitch
48
+
49
+ # @return [Float]
50
+ attr_accessor :pitch2
51
+
52
+ # @return [Integer]
53
+ attr_accessor :item_id
54
+
55
+ # @return [Integer]
56
+ attr_accessor :model_index
57
+
58
+ # @return [Integer]
59
+ attr_accessor :temp_output_obj_idx
60
+
61
+ # @return [Integer]
62
+ attr_accessor :temp_input_obj_idx
63
+
64
+ # @return [Integer]
65
+ attr_accessor :output_to_slot
66
+
67
+ # @return [Integer]
68
+ attr_accessor :input_from_slot
69
+
70
+ # @return [Integer]
71
+ attr_accessor :output_from_slot
72
+
73
+ # @return [Integer]
74
+ attr_accessor :input_to_slot
75
+
76
+ # @return [Integer]
77
+ attr_accessor :output_offset
78
+
79
+ # @return [Integer]
80
+ attr_accessor :input_offset
81
+
82
+ # @return [Integer]
83
+ attr_accessor :recipe_id
84
+
85
+ # @return [Integer]
86
+ attr_accessor :filter_fd
87
+
88
+ # @return [Array<Integer>]
89
+ attr_accessor :parameters
90
+ end
91
+ end