fix:修复部分等级URL解析失败问题
This commit is contained in:
@@ -73,12 +73,27 @@ object LevelIconHelper : ILog {
|
||||
return null
|
||||
}
|
||||
// https://image.nnbc123.cn/charm_20.png
|
||||
val dotIndex = levelIconUrl.lastIndexOf('.')
|
||||
val separatorIndex = levelIconUrl.lastIndexOf('_') + 1
|
||||
if (dotIndex > 0 && separatorIndex > 0 && dotIndex > separatorIndex) {
|
||||
return levelIconUrl.substring(separatorIndex, dotIndex).toIntOrNull()
|
||||
// https://image.nnbc123.cn/charm_20_1.png
|
||||
val separatorIndex = levelIconUrl.lastIndexOf('/')
|
||||
if (separatorIndex == -1) {
|
||||
return null
|
||||
}
|
||||
return null
|
||||
var numberStart = levelIconUrl.indexOf('_', startIndex = separatorIndex)
|
||||
if (numberStart == -1) {
|
||||
return null
|
||||
}
|
||||
numberStart++
|
||||
if (numberStart >= levelIconUrl.length) {
|
||||
return null
|
||||
}
|
||||
var numberEnd = levelIconUrl.indexOf('_', startIndex = numberStart)
|
||||
if (numberEnd == -1) {
|
||||
numberEnd = levelIconUrl.indexOf('.', startIndex = numberStart)
|
||||
}
|
||||
if (numberEnd == -1) {
|
||||
return null
|
||||
}
|
||||
return levelIconUrl.substring(numberStart, numberEnd).toIntOrNull()
|
||||
}
|
||||
|
||||
private fun getLevelName(level: Int?): String? {
|
||||
|
Reference in New Issue
Block a user