2022-05-04 06:13:42 +00:00
|
|
|
package emu.grasscutter.server.packet.send;
|
|
|
|
|
|
|
|
import emu.grasscutter.game.dungeons.DungeonChallenge;
|
|
|
|
import emu.grasscutter.net.packet.BasePacket;
|
|
|
|
import emu.grasscutter.net.packet.PacketOpcodes;
|
|
|
|
import emu.grasscutter.net.proto.DungeonSettleNotifyOuterClass.DungeonSettleNotify;
|
2022-05-06 16:11:54 +00:00
|
|
|
import emu.grasscutter.net.proto.ItemParamOuterClass;
|
|
|
|
import emu.grasscutter.net.proto.TowerLevelEndNotifyOuterClass.TowerLevelEndNotify;
|
2022-05-04 06:13:42 +00:00
|
|
|
|
|
|
|
public class PacketDungeonSettleNotify extends BasePacket {
|
|
|
|
|
|
|
|
public PacketDungeonSettleNotify(DungeonChallenge challenge) {
|
|
|
|
super(PacketOpcodes.DungeonSettleNotify);
|
|
|
|
|
|
|
|
DungeonSettleNotify proto = DungeonSettleNotify.newBuilder()
|
|
|
|
.setDungeonId(challenge.getScene().getDungeonData().getId())
|
|
|
|
.setIsSuccess(challenge.isSuccess())
|
|
|
|
.setCloseTime(challenge.getScene().getAutoCloseTime())
|
|
|
|
.setResult(challenge.isSuccess() ? 1 : 0)
|
|
|
|
.build();
|
|
|
|
|
|
|
|
this.setData(proto);
|
|
|
|
}
|
2022-05-06 16:11:54 +00:00
|
|
|
|
|
|
|
public PacketDungeonSettleNotify(DungeonChallenge challenge,
|
|
|
|
boolean canJump,
|
|
|
|
boolean hasNextLevel,
|
|
|
|
int nextFloorId
|
|
|
|
) {
|
|
|
|
super(PacketOpcodes.DungeonSettleNotify);
|
|
|
|
|
2022-05-28 06:58:12 +00:00
|
|
|
var continueStatus = TowerLevelEndNotify.ContinueStateType.CONTINUE_STATE_TYPE_CAN_NOT_CONTINUE_VALUE;
|
2022-05-06 16:11:54 +00:00
|
|
|
if(challenge.isSuccess() && canJump){
|
2022-05-28 06:58:12 +00:00
|
|
|
continueStatus = hasNextLevel ? TowerLevelEndNotify.ContinueStateType.CONTINUE_STATE_TYPE_CAN_ENTER_NEXT_LEVEL_VALUE
|
|
|
|
: TowerLevelEndNotify.ContinueStateType.CONTINUE_STATE_TYPE_CAN_ENTER_NEXT_FLOOR_VALUE;
|
2022-05-06 16:11:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
var towerLevelEndNotify = TowerLevelEndNotify.newBuilder()
|
|
|
|
.setIsSuccess(challenge.isSuccess())
|
|
|
|
.setContinueState(continueStatus)
|
|
|
|
.addFinishedStarCondList(1)
|
|
|
|
.addFinishedStarCondList(2)
|
|
|
|
.addFinishedStarCondList(3)
|
|
|
|
.addRewardItemList(ItemParamOuterClass.ItemParam.newBuilder()
|
|
|
|
.setItemId(201)
|
|
|
|
.setCount(1000)
|
|
|
|
.build())
|
|
|
|
;
|
2022-05-08 09:11:02 +00:00
|
|
|
if(nextFloorId > 0 && canJump){
|
2022-05-06 16:11:54 +00:00
|
|
|
towerLevelEndNotify.setNextFloorId(nextFloorId);
|
|
|
|
}
|
|
|
|
|
|
|
|
DungeonSettleNotify proto = DungeonSettleNotify.newBuilder()
|
|
|
|
.setDungeonId(challenge.getScene().getDungeonData().getId())
|
|
|
|
.setIsSuccess(challenge.isSuccess())
|
|
|
|
.setCloseTime(challenge.getScene().getAutoCloseTime())
|
|
|
|
.setResult(challenge.isSuccess() ? 1 : 0)
|
|
|
|
.setTowerLevelEndNotify(towerLevelEndNotify.build())
|
|
|
|
.build();
|
|
|
|
|
|
|
|
this.setData(proto);
|
|
|
|
}
|
2022-05-04 06:13:42 +00:00
|
|
|
}
|