Add gachaTimesLimit for beginner banner

Also add some more return codes
This commit is contained in:
AnimeGitB
2022-07-04 01:27:50 +09:30
committed by Luke H-W
parent fe50a42a3c
commit e8371677bd
4 changed files with 60 additions and 116 deletions

View File

@@ -19,12 +19,18 @@ public class PacketDoGachaRsp extends BasePacket {
ItemParamData costItem = banner.getCost(1);
ItemParamData costItem10 = banner.getCost(10);
int gachaTimesLimit = banner.getGachaTimesLimit();
int leftGachaTimes = switch(gachaTimesLimit) {
case Integer.MAX_VALUE -> Integer.MAX_VALUE;
default -> Math.max(gachaTimesLimit - gachaInfo.getTotalPulls(), 0);
};
DoGachaRsp.Builder rsp = DoGachaRsp.newBuilder()
.setGachaType(banner.getGachaType())
.setGachaScheduleId(banner.getScheduleId())
.setGachaTimes(list.size())
.setNewGachaRandom(12345)
.setLeftGachaTimes(Integer.MAX_VALUE)
.setLeftGachaTimes(leftGachaTimes)
.setGachaTimesLimit(gachaTimesLimit)
.setCostItemId(costItem.getId())
.setCostItemNum(costItem.getCount())
.setTenCostItemId(costItem10.getId())