Fixed dungeon challenge scoreboard and implement dungeon drops

Also fixed a few dungeon script handlers
This commit is contained in:
Melledy
2022-05-03 23:13:42 -07:00
parent bf3e5566c8
commit e7276a75d3
18 changed files with 321 additions and 24 deletions

View File

@@ -8,12 +8,14 @@ import emu.grasscutter.net.proto.DungeonChallengeBeginNotifyOuterClass.DungeonCh
public class PacketDungeonChallengeBeginNotify extends BasePacket {
public PacketDungeonChallengeBeginNotify(DungeonChallenge challenge) {
super(PacketOpcodes.DungeonChallengeBeginNotify);
super(PacketOpcodes.DungeonChallengeBeginNotify, true);
DungeonChallengeBeginNotify proto = DungeonChallengeBeginNotify.newBuilder()
.setChallengeId(challenge.getChallengeId())
.setChallengeIndex(challenge.getChallengeIndex())
.setGroupId(challenge.getGroup().id)
.addParamList(challenge.getObjective())
.addParamList(challenge.getTimeLimit())
.build();
this.setData(proto);

View File

@@ -8,13 +8,12 @@ import emu.grasscutter.net.proto.DungeonChallengeFinishNotifyOuterClass.DungeonC
public class PacketDungeonChallengeFinishNotify extends BasePacket {
public PacketDungeonChallengeFinishNotify(DungeonChallenge challenge) {
super(PacketOpcodes.DungeonChallengeFinishNotify);
super(PacketOpcodes.DungeonChallengeFinishNotify, true);
DungeonChallengeFinishNotify proto = DungeonChallengeFinishNotify.newBuilder()
.setChallengeIndex(challenge.getChallengeIndex())
.setIsSuccess(challenge.isSuccess())
.setUnk1(challenge.getChallengeId())
.setUnk2(30)
.setUnk1(2)
.build();
this.setData(proto);

View File

@@ -0,0 +1,22 @@
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;
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);
}
}

View File

@@ -0,0 +1,22 @@
package emu.grasscutter.server.packet.send;
import java.util.Collection;
import emu.grasscutter.game.inventory.GameItem;
import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.GadgetAutoPickDropInfoNotifyOuterClass.GadgetAutoPickDropInfoNotify;
import emu.grasscutter.net.proto.GadgetAutoPickDropInfoNotifyOuterClass.GadgetAutoPickDropInfoNotify.Builder;
public class PacketGadgetAutoPickDropInfoNotify extends BasePacket {
public PacketGadgetAutoPickDropInfoNotify(Collection<GameItem> items) {
super(PacketOpcodes.GadgetAutoPickDropInfoNotify);
GadgetAutoPickDropInfoNotify.Builder proto = GadgetAutoPickDropInfoNotify.newBuilder();
items.forEach(item -> proto.addItemList(item.toProto()));
this.setData(proto);
}
}