mirror of
https://github.com/Melledy/Nebula.git
synced 2026-09-20 01:29:54 +02:00
Clear current player level ids when settling
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user