Reimplement gacha (#32)

* Fix some grammar warning

* Reimplement gacha

* Update GachaResult#toSpinResp declaration

---------

Co-authored-by: Yostarcc <lubenwei7758258@gmail.com>
This commit is contained in:
Yostarcc
2026-05-05 21:49:21 -07:00
committed by GitHub
co-authored by Yostarcc
parent c285c878f1
commit 1316654c15
32 changed files with 1992 additions and 450 deletions
@@ -0,0 +1,25 @@
package emu.nebula.server.handlers;
import emu.nebula.Nebula;
import emu.nebula.net.GameSession;
import emu.nebula.net.HandlerId;
import emu.nebula.net.NetHandler;
import emu.nebula.net.NetMsgId;
import emu.nebula.proto.GachaNewbieSave.GachaNewbieSaveReq;
@HandlerId(NetMsgId.gacha_newbie_save_req)
public class HandlerGachaNewbieSaveReq extends NetHandler {
@Override
public byte[] handle(GameSession session, byte[] message) throws Exception {
var req = GachaNewbieSaveReq.parseFrom(message);
Integer index = req.hasIdx() ? req.getIdx() : null;
boolean succeeded = Nebula.getGameContext().getGachaModule().saveNewbie(session.getPlayer(), req.getId(), index);
if (!succeeded) {
return session.encodeMsg(NetMsgId.gacha_newbie_save_failed_ack);
}
return session.encodeMsg(NetMsgId.gacha_newbie_save_succeed_ack);
}
}