Format code [skip actions]

This commit is contained in:
github-actions 2023-10-19 13:19:46 +00:00
parent f5703e5964
commit 837e30e04b
3 changed files with 22 additions and 21 deletions

View File

@ -324,7 +324,8 @@ public final class DungeonManager {
p.getBattlePassManager().triggerMission(WatcherTriggerType.TRIGGER_FINISH_DUNGEON); p.getBattlePassManager().triggerMission(WatcherTriggerType.TRIGGER_FINISH_DUNGEON);
} }
}); });
var future = scene var future =
scene
.getScriptManager() .getScriptManager()
.callEvent(new ScriptArgs(0, EventType.EVENT_DUNGEON_SETTLE, successfully ? 1 : 0)); .callEvent(new ScriptArgs(0, EventType.EVENT_DUNGEON_SETTLE, successfully ? 1 : 0));
// Note: There is a possible race condition with calling // Note: There is a possible race condition with calling

View File

@ -47,7 +47,9 @@ public class TowerManager extends BasePlayerManager {
while (stars < currentPossibleStars) { while (stars < currentPossibleStars) {
player player
.getSession() .getSession()
.send(new PacketTowerLevelStarCondNotify(getTowerData().currentFloorId, getCurrentLevel(), currentPossibleStars)); .send(
new PacketTowerLevelStarCondNotify(
getTowerData().currentFloorId, getCurrentLevel(), currentPossibleStars));
currentPossibleStars--; currentPossibleStars--;
} }
} }
@ -117,7 +119,9 @@ public class TowerManager extends BasePlayerManager {
currentPossibleStars = 3; currentPossibleStars = 3;
player player
.getSession() .getSession()
.send(new PacketTowerLevelStarCondNotify(getTowerData().currentFloorId, getCurrentLevel(), currentPossibleStars + 1)); .send(
new PacketTowerLevelStarCondNotify(
getTowerData().currentFloorId, getCurrentLevel(), currentPossibleStars + 1));
} }
public void notifyCurLevelRecordChange() { public void notifyCurLevelRecordChange() {
@ -143,7 +147,8 @@ public class TowerManager extends BasePlayerManager {
var cond = levelData.getCondType(star); var cond = levelData.getCondType(star);
if (cond == TowerLevelData.TowerCondType.TOWER_COND_CHALLENGE_LEFT_TIME_MORE_THAN) { if (cond == TowerLevelData.TowerCondType.TOWER_COND_CHALLENGE_LEFT_TIME_MORE_THAN) {
var params = levelData.getTimeCond(star); var params = levelData.getTimeCond(star);
var timeRemaining = challenge.getTimeLimit() - (scene.getSceneTimeSeconds() - challenge.getStartedAt()); var timeRemaining =
challenge.getTimeLimit() - (scene.getSceneTimeSeconds() - challenge.getStartedAt());
if (timeRemaining >= params.getMinimumTimeInSeconds()) { if (timeRemaining >= params.getMinimumTimeInSeconds()) {
break; break;
} }
@ -151,7 +156,11 @@ public class TowerManager extends BasePlayerManager {
// TODO: Check monolith health // TODO: Check monolith health
break; break;
} else { } else {
Grasscutter.getLogger().error("getCurLevelStars: Tower level {} has no or unknown condition defined for {} stars", getCurrentLevelId(), star + 1); Grasscutter.getLogger()
.error(
"getCurLevelStars: Tower level {} has no or unknown condition defined for {} stars",
getCurrentLevelId(),
star + 1);
continue; continue;
} }
} }
@ -174,8 +183,7 @@ public class TowerManager extends BasePlayerManager {
prevStars = prevRecord.getLevelStars(getCurrentLevelId()); prevStars = prevRecord.getLevelStars(getCurrentLevelId());
} }
if (stars > prevStars) { if (stars > prevStars) {
recordMap.put( recordMap.put(currentFloorId, prevRecord.setLevelStars(getCurrentLevelId(), stars));
currentFloorId, prevRecord.setLevelStars(getCurrentLevelId(), stars));
} }
} }

View File

@ -9,9 +9,7 @@ public class PacketTowerLevelStarCondNotify extends BasePacket {
public PacketTowerLevelStarCondNotify(int floorId, int levelIndex, int lostStar) { public PacketTowerLevelStarCondNotify(int floorId, int levelIndex, int lostStar) {
super(PacketOpcodes.TowerLevelStarCondNotify); super(PacketOpcodes.TowerLevelStarCondNotify);
var proto = TowerLevelStarCondNotify.newBuilder() var proto = TowerLevelStarCondNotify.newBuilder().setFloorId(floorId).setLevelIndex(levelIndex);
.setFloorId(floorId)
.setLevelIndex(levelIndex);
if (1 <= lostStar && lostStar <= 3) { if (1 <= lostStar && lostStar <= 3) {
proto.addCondDataList( proto.addCondDataList(
@ -26,15 +24,9 @@ public class PacketTowerLevelStarCondNotify extends BasePacket {
.build()); .build());
} else { } else {
proto proto
.addCondDataList( .addCondDataList(TowerLevelStarCondData.newBuilder().build())
TowerLevelStarCondData.newBuilder() .addCondDataList(TowerLevelStarCondData.newBuilder().build())
.build()) .addCondDataList(TowerLevelStarCondData.newBuilder().build());
.addCondDataList(
TowerLevelStarCondData.newBuilder()
.build())
.addCondDataList(
TowerLevelStarCondData.newBuilder()
.build());
} }
this.setData(proto.build()); this.setData(proto.build());