Skip to content

Commit 26287e0

Browse files
committed
支持新表,不再兼容旧表
1 parent b0a82eb commit 26287e0

File tree

2 files changed

+23
-7
lines changed

2 files changed

+23
-7
lines changed

src/main/kotlin/Spell.kt

+7-1
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,11 @@ data class Spell(
99
var rank: String,
1010
var star: Int,
1111
var desc: String,
12-
val id: Int
12+
val id: Int,
13+
val fastest: Float,
14+
val one: Float,
15+
val two: Float,
16+
val three: Float,
17+
val final: Float,
18+
val bonusRate: Float,
1319
) : Serializable

src/main/kotlin/SpellConfig.kt

+16-6
Original file line numberDiff line numberDiff line change
@@ -139,30 +139,40 @@ object SpellConfig {
139139
fun getSpellById(type: Int, id: Int): Spell? = cache[type]?.spellsByIndex?.get(id)
140140

141141
private fun buildNormalSpell(row: XSSFRow): Spell? {
142-
if (row.lastCellNum < 6) return null
142+
if (row.lastCellNum < 15) return null
143143
return Spell(
144144
index = row.getCell(0).numericCellValue.toInt(),
145145
game = row.getCell(1).numericCellValue.toInt().toString(),
146146
name = row.getCell(3).stringCellValue.trim(),
147147
rank = row.getCell(5).stringCellValue.trim(),
148148
star = row.getCell(6).numericCellValue.toInt(),
149149
desc = row.getCell(4)?.stringCellValue?.trim() ?: "",
150-
id = if (row.lastCellNum < 8) 0
151-
else row.getCell(8)?.numericCellValue?.toInt() ?: 0
150+
id = row.getCell(8).numericCellValue.toInt(),
151+
fastest = row.getCell(9).numericCellValue.toFloat(),
152+
one = row.getCell(10).numericCellValue.toFloat(),
153+
two = row.getCell(11).numericCellValue.toFloat(),
154+
three = row.getCell(12).numericCellValue.toFloat(),
155+
final = row.getCell(13).numericCellValue.toFloat(),
156+
bonusRate = row.getCell(14).numericCellValue.toFloat(),
152157
)
153158
}
154159

155160
private fun buildBPSpell(row: XSSFRow): Spell? {
156-
if (row.lastCellNum < 7) return null
161+
if (row.lastCellNum < 15) return null
157162
return Spell(
158163
index = row.getCell(0).numericCellValue.toInt(),
159164
game = row.getCell(1).numericCellValue.toInt().toString(),
160165
name = row.getCell(3).stringCellValue.trim(),
161166
rank = row.getCell(5).stringCellValue.trim(),
162167
star = row.getCell(7).numericCellValue.toInt(),
163168
desc = row.getCell(4)?.stringCellValue?.trim() ?: "",
164-
id = if (row.lastCellNum < 8) 0
165-
else row.getCell(8)?.numericCellValue?.toInt() ?: 0
169+
id = row.getCell(8).numericCellValue.toInt(),
170+
fastest = row.getCell(9).numericCellValue.toFloat(),
171+
one = row.getCell(10).numericCellValue.toFloat(),
172+
two = row.getCell(11).numericCellValue.toFloat(),
173+
three = row.getCell(12).numericCellValue.toFloat(),
174+
final = row.getCell(13).numericCellValue.toFloat(),
175+
bonusRate = row.getCell(14).numericCellValue.toFloat(),
166176
)
167177
}
168178

0 commit comments

Comments
 (0)