Clear current player level ids when settling

This commit is contained in:
Melledy
2025-12-13 00:49:55 -08:00
parent 31e56ae17f
commit 9599877005
5 changed files with 34 additions and 4 deletions
@@ -16,8 +16,13 @@ public class HandlerInfinityTowerSettleReq extends NetHandler {
// Parse request
var req = InfinityTowerSettleReq.parseFrom(message);
// Settle
// Get manager and save current level/build
var manager = session.getPlayer().getInfinityTowerManager();
int level = manager.getLevelId();
long build = manager.getBuildId();
// Settle
var change = manager.settle(req.getValue());
if (change == null) {
@@ -25,10 +30,10 @@ public class HandlerInfinityTowerSettleReq extends NetHandler {
}
// Get next level
int nextLevel = manager.getLevelId() + 1;
int nextLevel = level + 1;
// Try to apply for next level
if (!manager.apply(nextLevel, -1)) {
if (!manager.apply(nextLevel, build)) {
nextLevel = 0;
}
@@ -2,6 +2,7 @@ package emu.nebula.server.handlers;
import emu.nebula.net.NetHandler;
import emu.nebula.net.NetMsgId;
import emu.nebula.proto.StoryApply.StoryApplyReq;
import emu.nebula.net.HandlerId;
import emu.nebula.net.GameSession;
@@ -10,6 +11,13 @@ public class HandlerStoryApplyReq extends NetHandler {
@Override
public byte[] handle(GameSession session, byte[] message) throws Exception {
// Parse request
var req = StoryApplyReq.parseFrom(message);
// Apply for story
session.getPlayer().getStoryManager().apply(req.getIdx());
// Encode response
return session.encodeMsg(NetMsgId.story_apply_succeed_ack);
}