From 9170768d6f13efab7a160cde14679e6b59b3a4d6 Mon Sep 17 00:00:00 2001 From: Melledy <121644117+Melledy@users.noreply.github.com> Date: Mon, 1 Jan 2024 07:58:30 -0800 Subject: [PATCH] Show challenge fail screen when a player loses a challenge --- .../java/emu/lunarcore/game/challenge/ChallengeInstance.java | 2 ++ .../server/packet/send/PacketChallengeSettleNotify.java | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main/java/emu/lunarcore/game/challenge/ChallengeInstance.java b/src/main/java/emu/lunarcore/game/challenge/ChallengeInstance.java index 2603fe49a..258efe75a 100644 --- a/src/main/java/emu/lunarcore/game/challenge/ChallengeInstance.java +++ b/src/main/java/emu/lunarcore/game/challenge/ChallengeInstance.java @@ -157,6 +157,8 @@ public void onBattleFinish(Battle battle, BattleEndStatus result, BattleStatisti default: // Fail challenge this.setStatus(ChallengeStatus.CHALLENGE_FAILED); + // Send challenge result data + player.sendPacket(new PacketChallengeSettleNotify(this)); break; } } diff --git a/src/main/java/emu/lunarcore/server/packet/send/PacketChallengeSettleNotify.java b/src/main/java/emu/lunarcore/server/packet/send/PacketChallengeSettleNotify.java index 6fa4082e8..4be338460 100644 --- a/src/main/java/emu/lunarcore/server/packet/send/PacketChallengeSettleNotify.java +++ b/src/main/java/emu/lunarcore/server/packet/send/PacketChallengeSettleNotify.java @@ -2,7 +2,6 @@ import emu.lunarcore.game.challenge.ChallengeInstance; import emu.lunarcore.proto.ChallengeSettleNotifyOuterClass.ChallengeSettleNotify; -import emu.lunarcore.proto.ItemListOuterClass.ItemList; import emu.lunarcore.server.packet.BasePacket; import emu.lunarcore.server.packet.CmdId; @@ -14,9 +13,11 @@ public PacketChallengeSettleNotify(ChallengeInstance challenge) { var data = ChallengeSettleNotify.newInstance() .setChallengeId(challenge.getExcel().getId()) .setIsWin(challenge.isWin()) - .setReward(ItemList.newInstance()) .setStars(challenge.getStars()); + // Set empty rewards + data.getMutableReward(); + this.setData(data); } }