Skip to content

Commit

Permalink
Merge pull request #149 from Lixuhuilll/crisis
Browse files Browse the repository at this point in the history
地图数据适配新危机合约
  • Loading branch information
dragove authored Dec 13, 2023
2 parents f55e691 + 30116a6 commit 6919a6d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public static ArkLevelType fromLevelId(String levelId) {
case "activities" -> ACTIVITIES;
case "campaign" -> CAMPAIGN;
case "memory" -> MEMORY;
case "rune" -> RUNE;
case "rune", "crisis" -> RUNE;
case "legion" -> LEGION;
case "roguelike" -> ROGUELIKE;
case "training" -> TRAINING;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
package plus.maa.backend.service.model.parser;

import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;
import plus.maa.backend.repository.entity.ArkLevel;
import plus.maa.backend.repository.entity.gamedata.ArkCrisisV2Info;
import plus.maa.backend.repository.entity.gamedata.ArkTilePos;
import plus.maa.backend.service.ArkGameDataService;
import plus.maa.backend.service.model.ArkLevelType;

import java.util.Optional;

@Component
@RequiredArgsConstructor
public class RuneParser implements ArkLevelParser {

private final ArkGameDataService dataService;

@Override
public boolean supportType(ArkLevelType type) {
return ArkLevelType.RUNE.equals(type);
Expand All @@ -15,7 +24,12 @@ public boolean supportType(ArkLevelType type) {
@Override
public ArkLevel parseLevel(ArkLevel level, ArkTilePos tilePos) {
level.setCatOne(ArkLevelType.RUNE.getDisplay());
level.setCatTwo(tilePos.getCode());
level.setCatTwo(
Optional.ofNullable(level.getStageId())
.map(dataService::findCrisisV2InfoById)
.map(ArkCrisisV2Info::getName)
.orElse(tilePos.getCode())
);
level.setCatThree(level.getName());
return level;
}
Expand Down

0 comments on commit 6919a6d

Please sign in to comment.