Skip to content

Commit 4a90991

Browse files
committed
Fix json parsing.
Fuck it!..
1 parent c9c7492 commit 4a90991

File tree

5 files changed

+13
-13
lines changed

5 files changed

+13
-13
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
package com.github.azurapi.azurapikotlin.internal.exceptions
22

3-
class ApiException(message: String = "") : Exception(message)
3+
open class ApiException(message: String = "") : Exception(message)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
package com.github.azurapi.azurapikotlin.internal.exceptions
22

3-
class DatabaseException(message: String = "") : Exception(message)
3+
class DatabaseException(message: String = "") : ApiException(message)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
package com.github.azurapi.azurapikotlin.internal.exceptions
22

3-
class ShipNotFoundException(message: String = "") : Exception(message)
3+
class ShipNotFoundException(message: String = "") : ApiException(message)

src/main/kotlin/com/github/azurapi/azurapikotlin/utils/ShipParser.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ object ShipParser {
4545
} catch (e: NumberFormatException) {
4646
0
4747
},
48-
isLive2D = json.getBoolean("live2DModel")
48+
isLive2D = json.getString("live2dModel") == "Yes"
4949
)
5050
} catch (e: JSONException) {
5151
throw e
@@ -77,7 +77,7 @@ object ShipParser {
7777
try {
7878
return StatsDetails(
7979
speed = json.getInt("speed"),
80-
accuracy = json.getInt("accuracyHit"),
80+
accuracy = json.getInt("accuracy"),
8181
antiAir = json.getInt("antiair"),
8282
antiSub = json.getInt("antisubmarineWarfare"),
8383
armor = json.getString("armor"),

src/test/kotlin/com/github/azurapi/azurapikotlin/json/ShipParserTestCase.kt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class ShipParserTestCase : StringSpec() {
4949
"antiair": "178",
5050
"aviation": "0",
5151
"oilConsumption": "12",
52-
"accuracyHit": "134",
52+
"accuracy": "134",
5353
"antisubmarineWarfare": "0"
5454
},
5555
"level100": {
@@ -64,7 +64,7 @@ class ShipParserTestCase : StringSpec() {
6464
"antiair": "155",
6565
"aviation": "0",
6666
"oilConsumption": "12",
67-
"accuracyHit": "119",
67+
"accuracy": "119",
6868
"antisubmarineWarfare": "0"
6969
},
7070
"baseStats": {
@@ -79,7 +79,7 @@ class ShipParserTestCase : StringSpec() {
7979
"antiair": "33",
8080
"aviation": "0",
8181
"oilConsumption": "4",
82-
"accuracyHit": "46",
82+
"accuracy": "46",
8383
"antisubmarineWarfare": "0"
8484
}
8585
},
@@ -245,7 +245,7 @@ class ShipParserTestCase : StringSpec() {
245245
"chibi": "https://raw.githubusercontent.com/AzurAPI/azurapi-js-setup/master/images/skins/201/Default/chibi.png",
246246
"info": {
247247
"obtainedFrom": "Default",
248-
"live2DModel": false
248+
"live2dModel": "No"
249249
}
250250
},
251251
{
@@ -258,7 +258,7 @@ class ShipParserTestCase : StringSpec() {
258258
"cnClient": "白花的誓言",
259259
"jpClient": "白き約束",
260260
"obtainedFrom": "Oath",
261-
"live2DModel": false
261+
"live2dModel": "No"
262262
}
263263
},
264264
{
@@ -272,7 +272,7 @@ class ShipParserTestCase : StringSpec() {
272272
"jpClient": "真夏の行進曲",
273273
"obtainedFrom": "Skin Shop",
274274
"cost": 700,
275-
"live2DModel": true
275+
"live2dModel": "Yes"
276276
}
277277
},
278278
{
@@ -286,7 +286,7 @@ class ShipParserTestCase : StringSpec() {
286286
"jpClient": "冬の風物詩",
287287
"obtainedFrom": "Skin Shop",
288288
"cost": 780,
289-
"live2DModel": false
289+
"live2dModel": "No"
290290
}
291291
},
292292
{
@@ -300,7 +300,7 @@ class ShipParserTestCase : StringSpec() {
300300
"jpClient": "学園トロイメライ",
301301
"obtainedFrom": "Skin Shop",
302302
"cost": 880,
303-
"live2DModel": false
303+
"live2dModel": "No"
304304
}
305305
}
306306
]

0 commit comments

Comments
 (0)