mirror of
https://github.com/Melledy/Nebula.git
synced 2025-12-14 21:34:52 +01:00
Implement potential selector in monoliths
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
package emu.nebula.server.handlers;
|
||||
|
||||
import emu.nebula.net.NetHandler;
|
||||
import emu.nebula.net.NetMsgId;
|
||||
import emu.nebula.proto.StarTowerBuildWhetherSave.StarTowerBuildWhetherSaveReq;
|
||||
import emu.nebula.net.HandlerId;
|
||||
import emu.nebula.net.GameSession;
|
||||
|
||||
@HandlerId(NetMsgId.star_tower_build_whether_save_req)
|
||||
public class HandlerStarTowerBuildWhetherSaveReq extends NetHandler {
|
||||
|
||||
@Override
|
||||
public byte[] handle(GameSession session, byte[] message) throws Exception {
|
||||
var req = StarTowerBuildWhetherSaveReq.parseFrom(message);
|
||||
|
||||
// TODO
|
||||
return this.encodeMsg(NetMsgId.star_tower_build_whether_save_succeed_ack);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package emu.nebula.server.handlers;
|
||||
|
||||
import emu.nebula.net.NetHandler;
|
||||
import emu.nebula.net.NetMsgId;
|
||||
import emu.nebula.proto.StarTowerGiveUp.StarTowerGiveUpResp;
|
||||
import emu.nebula.net.HandlerId;
|
||||
import emu.nebula.net.GameSession;
|
||||
|
||||
@HandlerId(NetMsgId.star_tower_give_up_req)
|
||||
public class HandlerStarTowerGiveUpReq extends NetHandler {
|
||||
|
||||
@Override
|
||||
public byte[] handle(GameSession session, byte[] message) throws Exception {
|
||||
var instance = session.getPlayer().getStarTowerManager().giveUp();
|
||||
|
||||
if (instance == null) {
|
||||
return this.encodeMsg(NetMsgId.star_tower_give_up_failed_ack);
|
||||
}
|
||||
|
||||
// Build response
|
||||
var rsp = StarTowerGiveUpResp.newInstance()
|
||||
.setFloor(instance.getFloor());
|
||||
|
||||
rsp.getMutableChange();
|
||||
rsp.setBuild(instance.getBuild().toProto());
|
||||
|
||||
return this.encodeMsg(NetMsgId.star_tower_give_up_succeed_ack, rsp);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user