Implement vampire survivor talent unlocking

This commit is contained in:
Melledy
2025-11-14 20:16:25 -08:00
parent 139fe2cf27
commit b19667315d
6 changed files with 139 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
package emu.nebula.server.handlers;
import emu.nebula.net.NetHandler;
import emu.nebula.net.NetMsgId;
import emu.nebula.net.HandlerId;
import emu.nebula.net.GameSession;
@HandlerId(NetMsgId.vampire_talent_reset_req)
public class HandlerVampireTalentResetReq extends NetHandler {
@Override
public byte[] handle(GameSession session, byte[] message) throws Exception {
// Reset talents
session.getPlayer().getVampireSurvivorManager().resetTalents();
// Encode and send
return session.encodeMsg(NetMsgId.vampire_talent_reset_succeed_ack);
}
}

View File

@@ -0,0 +1,24 @@
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.vampire_talent_unlock_req)
public class HandlerVampireTalentUnlockReq extends NetHandler {
@Override
public byte[] handle(GameSession session, byte[] message) throws Exception {
// Parse request
var req = UI32.parseFrom(message);
// Unlock talent
boolean success = session.getPlayer().getVampireSurvivorManager().unlockTalent(req.getValue());
// Encode and send
return session.encodeMsg(success ? NetMsgId.vampire_talent_unlock_succeed_ack : NetMsgId.vampire_talent_unlock_failed_ack);
}
}