-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
…o more dependencies from `kgstats-srv` to `kgparser-srv`!!!
- Loading branch information
1 parent
013f49c
commit bbea121
Showing
28 changed files
with
158 additions
and
159 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,131 @@ | ||
package ru.klavogonki.common | ||
|
||
/** | ||
* Ранг игрока. Различается в зависимости от рекорда в обычном режиме. | ||
*/ | ||
@Suppress("MagicNumber") | ||
enum class Rank( | ||
|
||
/** | ||
* Имя в API клавогонок. Все буквы в нижнем регистре. | ||
* | ||
* // todo: на самом деле, в API Клавогонок нет таких буквенных обозначений, только числовой код ранга. | ||
*/ | ||
@Suppress("unused") | ||
@JvmField val klavogonkiName: String, | ||
|
||
/** | ||
* Числовой код ранга (level). | ||
*/ | ||
@JvmField val level: Int, | ||
|
||
/** | ||
* Русское название ранга для отображения. | ||
*/ | ||
@JvmField val displayName: String, | ||
|
||
/** | ||
* Цвет на КГ, соответствующий рангу, в форме "#00FF02". | ||
*/ | ||
@JvmField val color: String | ||
) { | ||
/** | ||
* Новичок. Рекорд < 100. | ||
*/ | ||
novice("novice", 1, "Новичок", "#8D8D8D"), | ||
|
||
/** | ||
* Любитель. Рекорд от 100 до 199. | ||
*/ | ||
amateur("amateur", 2, "Любитель", "#4F9A97"), | ||
|
||
/** | ||
* Таксист. Рекорд от 200 до 299. | ||
*/ | ||
cabman("cabman", 3, "Таксист", "#187818"), | ||
|
||
/** | ||
* Профи. Рекорд от 300 до 399. | ||
*/ | ||
pro("pro", 4, "Профи", "#8C8100"), | ||
|
||
/** | ||
* Гонщик. Рекорд от 400 до 499. | ||
*/ | ||
racer("racer", 5, "Гонщик", "#BA5800"), | ||
|
||
/** | ||
* Маньяк. Рекорд от 500 до 599. | ||
*/ | ||
maniac("maniac", 6, "Маньяк", "#BC0143"), | ||
|
||
/** | ||
* Супермен. Рекорд от 600 до 699. | ||
*/ | ||
superman("superman", 7, "Супермен", "#5E0B9E"), | ||
|
||
/** | ||
* Кибергонщик. Рекорд от 700 до 799. | ||
*/ | ||
cyberracer("cyberracer", 8, "Кибергонщик", "#00037C"), | ||
|
||
/** | ||
* Экстракибер. Рекорд >= 800. | ||
*/ | ||
extracyber("extracyber", 9, "Экстракибер", "#061956"), | ||
; | ||
|
||
companion object { | ||
/** | ||
* @param normalRecord рекорд в [режиме "Обычный"][StandardDictionary.normal] | ||
* @return ранг, соответствующий указанному рекорду | ||
*/ | ||
@JvmStatic | ||
@Suppress("MagicNumber", "ReturnCount") | ||
fun getRankByNormalRecord(normalRecord: Int): Rank { | ||
if (normalRecord < 100) return novice | ||
|
||
if (normalRecord < 200) return amateur | ||
|
||
if (normalRecord < 300) return cabman | ||
|
||
if (normalRecord < 400) return pro | ||
|
||
if (normalRecord < 500) return racer | ||
|
||
if (normalRecord < 600) return maniac | ||
|
||
if (normalRecord < 700) return superman | ||
|
||
if (normalRecord < 800) return cyberracer | ||
|
||
return extracyber // рекорд в обычном >= 700 -> экстракибер | ||
} | ||
|
||
@JvmStatic | ||
fun getDisplayName(level: Int): String { | ||
return getRank(level).displayName | ||
} | ||
|
||
/** | ||
* @param level числовой код ранга | ||
* @return ранг с указанным числовым кодом | ||
*/ | ||
@JvmStatic | ||
fun getRank(level: Int): Rank { | ||
return entries | ||
.firstOrNull { it.level == level } | ||
?: throw IllegalArgumentException("Incorrect rank level: $level.") | ||
} | ||
|
||
/** | ||
* Цвет игрока-гостя. | ||
*/ | ||
const val GUEST_COLOR: String = "#222222" | ||
|
||
/** | ||
* У клавомехаников свойство `title` заполнено словом "Клавомеханик", а не названием ранга. | ||
*/ | ||
const val KLAVO_MECHANIC_TITLE: String = "Клавомеханик" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
137 changes: 0 additions & 137 deletions
137
kgparserSrv/src/main/java/ru/klavogonki/kgparser/Rank.java
This file was deleted.
Oops, something went wrong.
2 changes: 2 additions & 0 deletions
2
kgparserSrv/src/main/java/ru/klavogonki/kgparser/RankComparator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
package ru.klavogonki.kgparser; | ||
|
||
import ru.klavogonki.common.Rank; | ||
|
||
import java.util.Comparator; | ||
|
||
/** | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...serWeb/src/main/java/ru/klavogonki/kgparser/servlet/model/basic_info/PlayerBasicInfo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
kgstatsSrv/src/main/java/ru/klavogonki/statistics/dto/PlayerDto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
kgstatsSrv/src/main/java/ru/klavogonki/statistics/dto/PlayerVocabularyDto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
kgstatsSrv/src/main/java/ru/klavogonki/statistics/dto/PlayersByRankCount.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.