Skip to content

Commit

Permalink
fix(takao): fix parsing on ship stats
Browse files Browse the repository at this point in the history
  • Loading branch information
sylux6 committed Jul 18, 2020
1 parent 5d0760b commit ed7aed6
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 14 deletions.
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
# Changelog

## 3.1.3 (2020-18-02)
## 3.1.4 (2020-07-19)

### Bug fixes

- Fix errors on ship stats parsing: optional value if it doesn't exist

## 3.1.3 (2020-02-18)

### Bug fixes

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,20 +74,19 @@ private fun jsonToSkins(jsonArray: JSONArray): List<Skin> {
private fun jsonToStatsDetails(json: JSONObject): StatsDetails {
try {
return StatsDetails(
speed = json.getInt("speed"),
accuracy = json.getInt("accuracy"),
antiAir = json.getInt("antiair"),
antiSub = json.getInt("antisubmarineWarfare"),
armor = json.getString("armor"),
aviation = json.getInt("aviation"),
evasion = json.getInt("evasion"),
firepower = json.getInt("firepower"),
health = json.getInt("health"),
luck = json.getInt("luck"),
// FIXME: it should be defined
speed = json.optInt("speed"),
accuracy = json.optInt("accuracy"),
antiAir = json.optInt("antiair"),
antiSub = json.optInt("antisubmarineWarfare"),
armor = json.optString("armor"),
aviation = json.optInt("aviation"),
evasion = json.optInt("evasion"),
firepower = json.optInt("firepower"),
health = json.optInt("health"),
luck = json.optInt("luck"),
oil = json.optInt("oilConsumption"),
reload = json.getInt("reload"),
torpedo = json.getInt("torpedo")
reload = json.optInt("reload"),
torpedo = json.optInt("torpedo")
)
} catch (e: JSONException) {
throw e
Expand Down

0 comments on commit ed7aed6

Please sign in to comment.