Implement monolith research (most talents not working)

This commit is contained in:
Melledy
2025-11-18 05:16:14 -08:00
parent 4457b43a26
commit 9777f4fc3c
7 changed files with 247 additions and 2 deletions

View File

@@ -2,6 +2,7 @@ package emu.nebula.server.handlers;
import emu.nebula.net.NetHandler;
import emu.nebula.net.NetMsgId;
import emu.nebula.proto.TowerGrowthDetail.TowerGrowthDetailResp;
import emu.nebula.net.HandlerId;
import emu.nebula.net.GameSession;
@@ -10,7 +11,12 @@ public class HandlerTowerGrowthDetailReq extends NetHandler {
@Override
public byte[] handle(GameSession session, byte[] message) throws Exception {
return session.encodeMsg(NetMsgId.tower_growth_detail_succeed_ack);
// Build response
var rsp = TowerGrowthDetailResp.newInstance()
.addAllDetail(session.getPlayer().getProgress().getStarTowerGrowth());
// Encode and send
return session.encodeMsg(NetMsgId.tower_growth_detail_succeed_ack, rsp);
}
}

View File

@@ -0,0 +1,41 @@
package emu.nebula.server.handlers;
import emu.nebula.net.NetHandler;
import emu.nebula.net.NetMsgId;
import emu.nebula.proto.Public.UI32;
import emu.nebula.proto.TowerGrowthGroupNodeUnlock.TowerGrowthGroupNodeUnlockResp;
import it.unimi.dsi.fastutil.ints.IntList;
import emu.nebula.net.HandlerId;
import emu.nebula.net.GameSession;
@HandlerId(NetMsgId.tower_growth_group_node_unlock_req)
public class HandlerTowerGrowthGroupNodeUnlockReq extends NetHandler {
@Override
public byte[] handle(GameSession session, byte[] message) throws Exception {
// Parse request
var req = UI32.parseFrom(message);
// Quick unlock
var change = session.getPlayer().getStarTowerManager().unlockGrowthNodeGroup(req.getValue());
if (change == null) {
session.encodeMsg(NetMsgId.tower_growth_group_node_unlock_failed_ack);
}
// Get list of unlocked nodes
var unlocked = (IntList) change.getExtraData();
// Build response
var rsp = TowerGrowthGroupNodeUnlockResp.newInstance()
.setChangeInfo(change.toProto());
for (int nodeId : unlocked) {
rsp.addNodes(nodeId);
}
// Encode and send
return session.encodeMsg(NetMsgId.tower_growth_group_node_unlock_succeed_ack, rsp);
}
}

View File

@@ -0,0 +1,28 @@
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.tower_growth_node_unlock_req)
public class HandlerTowerGrowthNodeUnlockReq extends NetHandler {
@Override
public byte[] handle(GameSession session, byte[] message) throws Exception {
// Parse request
var req = UI32.parseFrom(message);
// Unlock tower growth node
var change = session.getPlayer().getStarTowerManager().unlockGrowthNode(req.getValue());
if (change == null) {
return session.encodeMsg(NetMsgId.tower_growth_node_unlock_failed_ack);
}
// Encode and send
return session.encodeMsg(NetMsgId.tower_growth_node_unlock_succeed_ack, change.toProto());
}
}