diff --git a/proto/DungeonChallengeFinishNotify.proto b/proto/DungeonChallengeFinishNotify.proto index cad685381..abababed3 100644 --- a/proto/DungeonChallengeFinishNotify.proto +++ b/proto/DungeonChallengeFinishNotify.proto @@ -17,4 +17,6 @@ message DungeonChallengeFinishNotify { uint32 challenge_record_type = 4; uint32 current_value = 5; map strengthen_point_data_map = 6; + uint32 unk1 = 7; + uint32 unk2 = 8; } diff --git a/proto/DungeonSettleNotify.proto b/proto/DungeonSettleNotify.proto new file mode 100644 index 000000000..c190b38e7 --- /dev/null +++ b/proto/DungeonSettleNotify.proto @@ -0,0 +1,16 @@ +syntax = "proto3"; + +option java_package = "emu.grasscutter.net.proto"; + +import "ParamList.proto"; +import "StrengthenPointData.proto"; + +message DungeonSettleNotify { + uint32 dungeon_id = 1; + bool is_success = 2; + repeated uint32 fail_cond_list = 3; + map settle_show = 4; + uint32 close_time = 5; + map strengthen_point_data_map = 6; + uint32 result = 7; +} diff --git a/proto/ParamList.proto b/proto/ParamList.proto new file mode 100644 index 000000000..d3f812a9c --- /dev/null +++ b/proto/ParamList.proto @@ -0,0 +1,7 @@ +syntax = "proto3"; + +option java_package = "emu.grasscutter.net.proto"; + +message ParamList { + repeated uint32 param_list_ = 1; +} diff --git a/src/main/java/emu/grasscutter/game/dungeons/DungeonChallenge.java b/src/main/java/emu/grasscutter/game/dungeons/DungeonChallenge.java index 1b595723a..686f6023e 100644 --- a/src/main/java/emu/grasscutter/game/dungeons/DungeonChallenge.java +++ b/src/main/java/emu/grasscutter/game/dungeons/DungeonChallenge.java @@ -12,6 +12,7 @@ import emu.grasscutter.net.proto.VisionTypeOuterClass.VisionType; import emu.grasscutter.scripts.constants.EventType; import emu.grasscutter.scripts.data.SceneGroup; import emu.grasscutter.scripts.data.SceneMonster; +import emu.grasscutter.server.packet.send.PacketChallengeDataNotify; import emu.grasscutter.server.packet.send.PacketDungeonChallengeBeginNotify; import emu.grasscutter.server.packet.send.PacketDungeonChallengeFinishNotify; import emu.grasscutter.server.packet.send.PacketSceneEntityAppearNotify; @@ -66,6 +67,10 @@ public class DungeonChallenge { this.isSuccess = isSuccess; } + public int getScore() { + return score; + } + public void start() { getScene().broadcastPacket(new PacketDungeonChallengeBeginNotify(this)); } @@ -81,9 +86,11 @@ public class DungeonChallenge { } public void onMonsterDie(EntityMonster entity) { - score++; + score = getScore() + 1; - if (score >= objective) { + getScene().broadcastPacket(new PacketChallengeDataNotify(this, 1, getScore())); + + if (getScore() >= objective) { this.setSuccess(true); finish(); } diff --git a/src/main/java/emu/grasscutter/game/dungeons/DungeonManager.java b/src/main/java/emu/grasscutter/game/dungeons/DungeonManager.java index 5662abf4d..6011c1f7c 100644 --- a/src/main/java/emu/grasscutter/game/dungeons/DungeonManager.java +++ b/src/main/java/emu/grasscutter/game/dungeons/DungeonManager.java @@ -44,6 +44,8 @@ public class DungeonManager { return; } + Grasscutter.getLogger().info(player.getNickname() + " is trying to enter dungeon " + dungeonId); + int sceneId = data.getSceneId(); player.getScene().setPrevScene(sceneId); diff --git a/src/main/java/emu/grasscutter/scripts/ScriptLib.java b/src/main/java/emu/grasscutter/scripts/ScriptLib.java index 87881db51..05b129f2d 100644 --- a/src/main/java/emu/grasscutter/scripts/ScriptLib.java +++ b/src/main/java/emu/grasscutter/scripts/ScriptLib.java @@ -139,6 +139,10 @@ public class ScriptLib { return 0; } + public int AddExtraGroupSuite(int groupId, int param2) { + return 0; + } + public int ActiveChallenge(int challengeId, int challengeIndex, int param3, int groupId, int param4, int param5) { SceneGroup group = getSceneScriptManager().getGroupById(groupId); diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketChallengeDataNotify.java b/src/main/java/emu/grasscutter/server/packet/send/PacketChallengeDataNotify.java new file mode 100644 index 000000000..452ca7118 --- /dev/null +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketChallengeDataNotify.java @@ -0,0 +1,21 @@ +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.ChallengeDataNotifyOuterClass.ChallengeDataNotify; + +public class PacketChallengeDataNotify extends BasePacket { + + public PacketChallengeDataNotify(DungeonChallenge challenge, int index, int value) { + super(PacketOpcodes.ChallengeDataNotify); + + ChallengeDataNotify proto = ChallengeDataNotify.newBuilder() + .setChallengeIndex(challenge.getChallengeIndex()) + .setParamIndex(index) + .setValue(value) + .build(); + + this.setData(proto); + } +} diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketDungeonChallengeBeginNotify.java b/src/main/java/emu/grasscutter/server/packet/send/PacketDungeonChallengeBeginNotify.java index 2dd734cf5..2b8112728 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketDungeonChallengeBeginNotify.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketDungeonChallengeBeginNotify.java @@ -13,6 +13,7 @@ public class PacketDungeonChallengeBeginNotify extends BasePacket { DungeonChallengeBeginNotify proto = DungeonChallengeBeginNotify.newBuilder() .setChallengeId(challenge.getChallengeId()) .setChallengeIndex(challenge.getChallengeIndex()) + .setGroupId(challenge.getGroup().id) .build(); this.setData(proto); diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketDungeonChallengeFinishNotify.java b/src/main/java/emu/grasscutter/server/packet/send/PacketDungeonChallengeFinishNotify.java index 323528aae..0fbcd9570 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketDungeonChallengeFinishNotify.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketDungeonChallengeFinishNotify.java @@ -11,8 +11,10 @@ public class PacketDungeonChallengeFinishNotify extends BasePacket { super(PacketOpcodes.DungeonChallengeFinishNotify); DungeonChallengeFinishNotify proto = DungeonChallengeFinishNotify.newBuilder() - .setChallengeIndex(challenge.getChallengeId()) + .setChallengeIndex(challenge.getChallengeIndex()) .setIsSuccess(challenge.isSuccess()) + .setUnk1(challenge.getChallengeId()) + .setUnk2(30) .build(); this.setData(proto);