admiral_stats_parser 1.11.0 → 1.12.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b57c6abd0b22c110362073c2741df23ba9117246
4
- data.tar.gz: 567a990136ae2c89eb653eba5b0528ba215dbffa
3
+ metadata.gz: 121279fe462bbc901ea7211a30f7243ca55feab2
4
+ data.tar.gz: 600fb60625d3e628bf5d3aa30cb5a6298a83c6e5
5
5
  SHA512:
6
- metadata.gz: adef4c2139224f3da128a955e7ec1b6018603c6b61caaf56b1c3f30ee4e1c8a4b988e32b597a37714ab9d57ca652cfa969248f8e44f5e55651de0fabcc377049
7
- data.tar.gz: f6128ae306b4d80d44dc912777f698293b509f4d54a72c2bf25de468532bd21ae7613e44a012b23ee0b0dad4f91d26ab6b87429db6e15521b3c8a41f92683882
6
+ metadata.gz: bafcd00e25c4006784d0a0c82e5d7866906bf54a4392c2f623cf6dd3b7fa9e314bf808f935324d781e70bccb541f5caf8b9020b2f4f5f5a8aa837406958dd9da
7
+ data.tar.gz: 6f3a6bf69c4adfbdeb07e63908fe8f49cf8c67d5d9e85d05cc416e9dcd8cbba0123372ed8585d54b0429305145dc7a5669fadea46f19fd82712a4e4553d6d638
data/README.md CHANGED
@@ -66,7 +66,8 @@ AdmiralStatsParser は、以下の API version をサポートしています。
66
66
  | 8 | 2017-06-01 〜 2017-07-30 |
67
67
  | 9 | 2017-07-31 〜 2017-09-20 |
68
68
  | 10 | 2017-09-21 〜 2018-01-31 |
69
- | 11 | 2018-02-01 (VERSION A REVISION 3 のリリース日) 〜 |
69
+ | 11 | 2018-02-01 (VERSION A REVISION 3 のリリース日) 〜 2018-02-15 |
70
+ | 12 | 2018-02-16 (ケッコンカッコカリの実装日) 〜 |
70
71
 
71
72
  各 API version でパースできる JSON の種類は以下の通りです。また、同じ情報でも、API version によって、含まれる情報量が異なる場合があります。その場合は Supported (1), Supported (2) のように記載して区別しています。
72
73
 
@@ -76,6 +77,7 @@ AdmiralStatsParser は、以下の API version をサポートしています。
76
77
  | 2 〜 6 | Supported (2) | Supported (2) | Supported (2) | Supported |
77
78
  | 7 〜 10 | Supported (3) | Supported (3) | Supported (2) | Supported |
78
79
  | 11 | Supported (3) | Supported (4) | Supported (2) | Supported |
80
+ | 12 | Supported (3) | Supported (4) | Supported (3) | Supported |
79
81
 
80
82
  | API version | 艦娘一覧 | 装備一覧 | イベント海域情報 |
81
83
  |------------:|:-----|:-----|:-----|
@@ -86,12 +88,13 @@ AdmiralStatsParser は、以下の API version をサポートしています。
86
88
  | 5 〜 6 | Supported (3) | Supported (1) | Supported (1) |
87
89
  | 7 〜 8 | Supported (4) | Supported (1) | Supported (2) |
88
90
  | 9 〜 11 | Supported (4) | Supported (2) | Supported (2) |
91
+ | 12 | Supported (5) | Supported (2) | Supported (2) |
89
92
 
90
93
  | API version | 改装設計図一覧 |
91
94
  |------------:|:-----|
92
95
  | 1 〜 6 | Unsupported |
93
96
  | 7 | Supported (1) |
94
- | 8 〜 11 | Supported (2) |
97
+ | 8 〜 12 | Supported (2) |
95
98
 
96
99
  ## Development
97
100
 
@@ -73,6 +73,9 @@ class CharacterListInfo
73
73
  # 改装設計図の枚数 (From API version 7)
74
74
  attr_accessor :blueprint_total_num
75
75
 
76
+ # ケッコンカッコカリ済みかどうかを表すフラグ(boolean)
77
+ attr_accessor :married
78
+
76
79
  # 累計経験値表
77
80
  EXP_TABLE = {
78
81
  92 => 584500,
@@ -44,4 +44,13 @@ class TcBookInfo
44
44
  # Array
45
45
  # 未取得の場合は、空の Array
46
46
  attr_accessor :status_img
47
+
48
+ # ケッコンカッコカリ済みかどうかを表す配列
49
+ # その図鑑No. にノーマルと改があれば要素数2、ノーマルしかなければ要素数1の配列
50
+ # 要素数2の場合、1個目の要素がノーマル、2個目の要素が改を表す
51
+ attr_accessor :is_married
52
+
53
+ # ケッコンカッコカリ済み画像の配列
54
+ # その図鑑No. にノーマルと改があっても、ノーマルのみでも、要素数1
55
+ attr_accessor :married_img
47
56
  end
@@ -67,6 +67,30 @@ class CharacterListInfoParser
67
67
  slot_img: Array,
68
68
  blueprint_total_num: Integer,
69
69
  },
70
+ 5 => {
71
+ book_no: Integer,
72
+ lv: Integer,
73
+ ship_type: String,
74
+ ship_sort_no: Integer,
75
+ remodel_lv: Integer,
76
+ ship_name: String,
77
+ status_img: String,
78
+ star_num: Integer,
79
+ ship_class: String,
80
+ ship_class_index: Integer,
81
+ tc_img: String,
82
+ exp_percent: Integer,
83
+ max_hp: Integer,
84
+ real_hp: Integer,
85
+ damage_status: String,
86
+ slot_num: Integer,
87
+ slot_equip_name: Array,
88
+ slot_amount: Array,
89
+ slot_disp: Array,
90
+ slot_img: Array,
91
+ blueprint_total_num: Integer,
92
+ married: :boolean,
93
+ },
70
94
  }
71
95
 
72
96
  def self.parse(json, api_version)
@@ -87,9 +111,15 @@ class CharacterListInfoParser
87
111
  raise "Mandatory key #{key} does not exist"
88
112
  end
89
113
 
90
- # 結果のクラスが合わなければエラー
91
- unless items[camel_case_key].is_a?(key_class)
92
- raise "Mandatory key #{key} is not class #{key_class}"
114
+ # ruby には Boolean クラスがないので、そこだけ特別な処理を用意する
115
+ if key_class == :boolean
116
+ unless [true, false].include?(items[camel_case_key])
117
+ raise "Mandatory key #{key} is not boolean"
118
+ end
119
+ else
120
+ unless items[camel_case_key].is_a?(key_class)
121
+ raise "Mandatory key #{key} is not class #{key_class}"
122
+ end
93
123
  end
94
124
 
95
125
  result.instance_variable_set("@#{key.to_s}", items[camel_case_key])
@@ -28,7 +28,29 @@ class TcBookInfoParser
28
28
  acquire_num: Integer,
29
29
  lv: Integer,
30
30
  status_img: Array,
31
- }
31
+ },
32
+ 3 => {
33
+ book_no: Integer,
34
+ ship_class: String,
35
+ ship_class_index: Integer,
36
+ ship_type: String,
37
+ ship_name: String,
38
+ card_index_img: String,
39
+ card_img_list: Array,
40
+ variation_num: Integer,
41
+ acquire_num: Integer,
42
+ lv: Integer,
43
+ status_img: Array,
44
+ },
45
+ }
46
+
47
+ OPTIONAL_KEYS = {
48
+ 1 => {},
49
+ 2 => {},
50
+ 3 => {
51
+ is_married: Array,
52
+ married_img: Array,
53
+ }
32
54
  }
33
55
 
34
56
  def self.parse(json, api_version)
@@ -57,6 +79,19 @@ class TcBookInfoParser
57
79
  result.instance_variable_set("@#{key.to_s}", items[camel_case_key])
58
80
  end
59
81
 
82
+ OPTIONAL_KEYS[api_version].each do |key, key_class|
83
+ # キーが含まれなければ、処理をスキップ
84
+ camel_case_key = key.to_s.split('_').inject([]){ |buffer,e| buffer.push(buffer.empty? ? e : e.capitalize) }.join
85
+ next unless items.include?(camel_case_key)
86
+
87
+ # 結果のクラスが合わなければエラー
88
+ unless items[camel_case_key].is_a?(key_class)
89
+ raise "Optional key #{key} is not class #{key_class}"
90
+ end
91
+
92
+ result.instance_variable_set("@#{key.to_s}", items[camel_case_key])
93
+ end
94
+
60
95
  results << result
61
96
  end
62
97
 
@@ -1,3 +1,3 @@
1
1
  module AdmiralStatsParser
2
- VERSION = "1.11.0"
2
+ VERSION = "1.12.0"
3
3
  end
@@ -12,7 +12,7 @@ require 'admiral_stats_parser/parser/blueprint_list_info_parser'
12
12
  module AdmiralStatsParser
13
13
  # 最新の API バージョンを返します。
14
14
  def self.get_latest_api_version
15
- return 11
15
+ return 12
16
16
  end
17
17
 
18
18
  # エクスポート時刻を元に、API バージョンを推測して返します。
@@ -47,6 +47,9 @@ module AdmiralStatsParser
47
47
  # version 11 の開始日
48
48
  return 10 if exported_at < Time.parse('2018-02-01T07:00:00+0900')
49
49
 
50
+ # version 12 の開始日
51
+ return 11 if exported_at < Time.parse('2018-02-16T07:00:00+0900')
52
+
50
53
  return self.get_latest_api_version
51
54
  end
52
55
 
@@ -57,7 +60,7 @@ module AdmiralStatsParser
57
60
  PersonalBasicInfoParser.parse(json, 1)
58
61
  when 2..6
59
62
  PersonalBasicInfoParser.parse(json, 2)
60
- when 7..11
63
+ when 7..12
61
64
  PersonalBasicInfoParser.parse(json, 3)
62
65
  else
63
66
  raise 'unsupported API version'
@@ -73,7 +76,7 @@ module AdmiralStatsParser
73
76
  AreaCaptureInfoParser.parse(json, 2)
74
77
  when 7..10
75
78
  AreaCaptureInfoParser.parse(json, 3)
76
- when 11
79
+ when 11..12
77
80
  AreaCaptureInfoParser.parse(json, 4)
78
81
  else
79
82
  raise 'unsupported API version'
@@ -87,6 +90,8 @@ module AdmiralStatsParser
87
90
  TcBookInfoParser.parse(json, 1)
88
91
  when 2..11
89
92
  TcBookInfoParser.parse(json, 2)
93
+ when 12
94
+ TcBookInfoParser.parse(json, 3)
90
95
  else
91
96
  raise 'unsupported API version'
92
97
  end
@@ -95,7 +100,7 @@ module AdmiralStatsParser
95
100
  # 装備図鑑をパースします。
96
101
  def self.parse_equip_book_info(json, api_version)
97
102
  case api_version
98
- when 1..11
103
+ when 1..12
99
104
  EquipBookInfoParser.parse(json)
100
105
  else
101
106
  raise 'unsupported API version'
@@ -115,6 +120,8 @@ module AdmiralStatsParser
115
120
  CharacterListInfoParser.parse(json, 3)
116
121
  when 7..11
117
122
  CharacterListInfoParser.parse(json, 4)
123
+ when 12
124
+ CharacterListInfoParser.parse(json, 5)
118
125
  else
119
126
  raise 'unsupported API version'
120
127
  end
@@ -127,7 +134,7 @@ module AdmiralStatsParser
127
134
  raise 'API version 1 does not support equip list info'
128
135
  when 2..8
129
136
  EquipListInfoParser.parse(json, 1)
130
- when 9..11
137
+ when 9..12
131
138
  EquipListInfoParser.parse(json, 2)
132
139
  else
133
140
  raise 'unsupported API version'
@@ -139,7 +146,7 @@ module AdmiralStatsParser
139
146
  case api_version
140
147
  when 1..8
141
148
  EquipListInfoParser.parse_max_slot_num(json, 1)
142
- when 9..11
149
+ when 9..12
143
150
  EquipListInfoParser.parse_max_slot_num(json, 2)
144
151
  else
145
152
  raise 'unsupported API version'
@@ -153,7 +160,7 @@ module AdmiralStatsParser
153
160
  raise "API version #{api_version} does not support event info"
154
161
  when 4..6
155
162
  EventInfoParser.parse(json, 1)
156
- when 7..11
163
+ when 7..12
157
164
  EventInfoParser.parse(json, 2)
158
165
  else
159
166
  raise 'unsupported API version'
@@ -165,7 +172,7 @@ module AdmiralStatsParser
165
172
  case api_version
166
173
  when 1..3
167
174
  raise "API version #{api_version} does not support event info"
168
- when 4..11
175
+ when 4..12
169
176
  {
170
177
  opened: EventInfoParser.opened?(event_info_list, level, period),
171
178
  all_cleared: EventInfoParser.all_cleared?(event_info_list, level, period),
@@ -186,7 +193,7 @@ module AdmiralStatsParser
186
193
  raise "API version #{api_version} does not support blueprint list info"
187
194
  when 7
188
195
  BlueprintListInfoParser.parse(json, 1)
189
- when 8..11
196
+ when 8..12
190
197
  BlueprintListInfoParser.parse(json, 2)
191
198
  else
192
199
  raise 'unsupported API version'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: admiral_stats_parser
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.11.0
4
+ version: 1.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Masahiro Yoshizawa
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-02-12 00:00:00.000000000 Z
11
+ date: 2018-02-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler