Initial Commit

This commit is contained in:
Melledy
2025-10-27 02:02:26 -07:00
commit f58951fe2a
378 changed files with 315914 additions and 0 deletions
@@ -0,0 +1,33 @@
package emu.nebula.server.handlers;
import emu.nebula.net.NetHandler;
import emu.nebula.net.NetMsgId;
import emu.nebula.proto.Public.UI32;
import emu.nebula.net.HandlerId;
import emu.nebula.net.GameSession;
@HandlerId(NetMsgId.char_advance_req)
public class HandlerCharAdvanceReq extends NetHandler {
@Override
public byte[] handle(GameSession session, byte[] message) throws Exception {
var req = UI32.parseFrom(message);
// Get character
var character = session.getPlayer().getCharacters().getCharacterById(req.getValue());
if (character == null) {
return this.encodeMsg(NetMsgId.char_advance_failed_ack);
}
// Advance character
var change = character.advance();
if (change == null) {
return this.encodeMsg(NetMsgId.char_advance_failed_ack);
}
return this.encodeMsg(NetMsgId.char_advance_succeed_ack, change.toProto());
}
}