mirror of
https://github.com/Melledy/Nebula.git
synced 2025-12-25 10:44:37 +01:00
Implement monolith research (most talents not working)
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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());
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user