-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #148 from Lixuhuilll/ArkLevelOpen
热度排行实现降低未开放关卡权重的功能
- Loading branch information
Showing
15 changed files
with
403 additions
and
31 deletions.
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
src/main/java/plus/maa/backend/common/utils/ArkLevelUtil.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 |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package plus.maa.backend.common.utils; | ||
|
||
import org.jetbrains.annotations.NotNull; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
import java.util.regex.Pattern; | ||
|
||
public class ArkLevelUtil { | ||
|
||
private static final Pattern NOT_KEY_INFO = Pattern.compile( | ||
// level_、各种难度前缀、season_、前导零、以-或者_划分的后缀 | ||
"^level_|^easy_|^hard_|^tough_|^main_|season_|(?<!\\d)0+(?=\\d)|[-_]+[^-_]+($|[-_]+\\D+$)" | ||
); | ||
|
||
/** | ||
* 从 stageId 或者 seasonId 中提取一个地图系列的唯一标识 | ||
* | ||
* @param id stageId 或者 seasonId | ||
* @return 地图系列的唯一标识 <br> | ||
* 例如:a1(骑兵与猎人)、act11d0(沃伦姆德的薄暮)、act11mini(未尽篇章)、crisis_v2_1(浊燃作战) | ||
*/ | ||
@NotNull | ||
public static String getKeyInfoById(@Nullable String id) { | ||
if (id == null) { | ||
return ""; | ||
} | ||
// 去除所有非关键信息 | ||
return NOT_KEY_INFO.matcher(id).replaceAll(""); | ||
} | ||
|
||
} |
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
13 changes: 8 additions & 5 deletions
13
src/main/java/plus/maa/backend/repository/ArkLevelRepository.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
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
16 changes: 16 additions & 0 deletions
16
src/main/java/plus/maa/backend/repository/entity/gamedata/ArkCrisisV2Info.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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package plus.maa.backend.repository.entity.gamedata; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Data | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public class ArkCrisisV2Info { | ||
private String seasonId; | ||
private String name; | ||
// 时间戳,单位:秒 | ||
private long startTs; | ||
private long endTs; | ||
} |
20 changes: 20 additions & 0 deletions
20
src/main/java/plus/maa/backend/repository/entity/gamedata/MaaArkStage.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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package plus.maa.backend.repository.entity.gamedata; | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||
import lombok.Data; | ||
|
||
@Data | ||
// 忽略对服务器无用的数据 | ||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
public class MaaArkStage { | ||
|
||
/** | ||
* 例: CB-EX8 | ||
*/ | ||
private String code; | ||
|
||
/** | ||
* 例: act5d0_ex08 | ||
*/ | ||
private String stageId; | ||
} |
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.