Rework how story is handled, fixes choices not saving

This commit is contained in:
Melledy
2025-12-12 01:31:31 -08:00
parent 11ea526a35
commit c51268bcb8
10 changed files with 320 additions and 30 deletions
@@ -3,7 +3,6 @@ package emu.nebula.server.handlers;
import emu.nebula.net.NetHandler;
import emu.nebula.net.NetMsgId;
import emu.nebula.proto.StorySett.StorySettleReq;
import it.unimi.dsi.fastutil.ints.IntArrayList;
import emu.nebula.net.HandlerId;
import emu.nebula.net.GameSession;
@@ -15,18 +14,14 @@ public class HandlerStorySettleReq extends NetHandler {
// Parse request
var req = StorySettleReq.parseFrom(message);
// Get list of settled story ids
var list = new IntArrayList();
for (var settle : req.getList()) {
list.add(settle.getIdx());
}
// Settle
var changes = session.getPlayer().getStoryManager().settle(list);
var change = session.getPlayer().getStoryManager().settle(req.getList(), req.getEvidences());
// Handle client events for achievements
session.getPlayer().getAchievementManager().handleClientEvents(req.getEvents());
// Send response
return session.encodeMsg(NetMsgId.story_settle_succeed_ack, changes.toProto());
return session.encodeMsg(NetMsgId.story_settle_succeed_ack, change.toProto());
}
}