Skip to content

Commit

Permalink
Format code [skip actions]
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Oct 19, 2023
1 parent f5703e5 commit 837e30e
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -324,9 +324,10 @@ public void notifyEndDungeon(boolean successfully) {
p.getBattlePassManager().triggerMission(WatcherTriggerType.TRIGGER_FINISH_DUNGEON);
}
});
var future = scene
.getScriptManager()
.callEvent(new ScriptArgs(0, EventType.EVENT_DUNGEON_SETTLE, successfully ? 1 : 0));
var future =
scene
.getScriptManager()
.callEvent(new ScriptArgs(0, EventType.EVENT_DUNGEON_SETTLE, successfully ? 1 : 0));
// Note: There is a possible race condition with calling
// EVENT_DUNGEON_SETTLE here asynchronously:
// 1. EVENT_DUNGEON_SETTLE triggers some Lua-side logic,
Expand Down
20 changes: 14 additions & 6 deletions src/main/java/emu/grasscutter/game/tower/TowerManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ public void onTick() {
while (stars < currentPossibleStars) {
player
.getSession()
.send(new PacketTowerLevelStarCondNotify(getTowerData().currentFloorId, getCurrentLevel(), currentPossibleStars));
.send(
new PacketTowerLevelStarCondNotify(
getTowerData().currentFloorId, getCurrentLevel(), currentPossibleStars));
currentPossibleStars--;
}
}
Expand Down Expand Up @@ -117,7 +119,9 @@ public void enterLevel(int enterPointId) {
currentPossibleStars = 3;
player
.getSession()
.send(new PacketTowerLevelStarCondNotify(getTowerData().currentFloorId, getCurrentLevel(), currentPossibleStars + 1));
.send(
new PacketTowerLevelStarCondNotify(
getTowerData().currentFloorId, getCurrentLevel(), currentPossibleStars + 1));
}

public void notifyCurLevelRecordChange() {
Expand All @@ -143,15 +147,20 @@ public int getCurLevelStars() {
var cond = levelData.getCondType(star);
if (cond == TowerLevelData.TowerCondType.TOWER_COND_CHALLENGE_LEFT_TIME_MORE_THAN) {
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()) {
break;
}
} else if (cond == TowerLevelData.TowerCondType.TOWER_COND_LEFT_HP_GREATER_THAN) {
// TODO: Check monolith health
break;
} 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;
}
}
Expand All @@ -174,8 +183,7 @@ public void notifyCurLevelRecordChangeWhenDone(int stars) {
prevStars = prevRecord.getLevelStars(getCurrentLevelId());
}
if (stars > prevStars) {
recordMap.put(
currentFloorId, prevRecord.setLevelStars(getCurrentLevelId(), stars));
recordMap.put(currentFloorId, prevRecord.setLevelStars(getCurrentLevelId(), stars));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ public class PacketTowerLevelStarCondNotify extends BasePacket {
public PacketTowerLevelStarCondNotify(int floorId, int levelIndex, int lostStar) {
super(PacketOpcodes.TowerLevelStarCondNotify);

var proto = TowerLevelStarCondNotify.newBuilder()
.setFloorId(floorId)
.setLevelIndex(levelIndex);
var proto = TowerLevelStarCondNotify.newBuilder().setFloorId(floorId).setLevelIndex(levelIndex);

if (1 <= lostStar && lostStar <= 3) {
proto.addCondDataList(
Expand All @@ -26,15 +24,9 @@ public PacketTowerLevelStarCondNotify(int floorId, int levelIndex, int lostStar)
.build());
} else {
proto
.addCondDataList(
TowerLevelStarCondData.newBuilder()
.build())
.addCondDataList(
TowerLevelStarCondData.newBuilder()
.build())
.addCondDataList(
TowerLevelStarCondData.newBuilder()
.build());
.addCondDataList(TowerLevelStarCondData.newBuilder().build())
.addCondDataList(TowerLevelStarCondData.newBuilder().build())
.addCondDataList(TowerLevelStarCondData.newBuilder().build());
}

this.setData(proto.build());
Expand Down

0 comments on commit 837e30e

Please sign in to comment.