mirror of
https://github.com/Melledy/LunarCore.git
synced 2025-12-15 06:45:04 +01:00
Update start challenge retcodes
This commit is contained in:
@@ -13,6 +13,7 @@ import emu.lunarcore.game.player.Player;
|
|||||||
import emu.lunarcore.game.player.lineup.PlayerLineup;
|
import emu.lunarcore.game.player.lineup.PlayerLineup;
|
||||||
import emu.lunarcore.proto.ExtraLineupTypeOuterClass.ExtraLineupType;
|
import emu.lunarcore.proto.ExtraLineupTypeOuterClass.ExtraLineupType;
|
||||||
import emu.lunarcore.proto.StartChallengeStoryBuffInfoOuterClass.StartChallengeStoryBuffInfo;
|
import emu.lunarcore.proto.StartChallengeStoryBuffInfoOuterClass.StartChallengeStoryBuffInfo;
|
||||||
|
import emu.lunarcore.server.packet.Retcode;
|
||||||
import emu.lunarcore.server.packet.send.PacketStartChallengeScRsp;
|
import emu.lunarcore.server.packet.send.PacketStartChallengeScRsp;
|
||||||
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
||||||
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
|
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
|
||||||
@@ -33,7 +34,7 @@ public class ChallengeManager extends BasePlayerManager {
|
|||||||
// Get challenge excel
|
// Get challenge excel
|
||||||
ChallengeExcel excel = GameData.getChallengeExcelMap().get(challengeId);
|
ChallengeExcel excel = GameData.getChallengeExcelMap().get(challengeId);
|
||||||
if (excel == null) {
|
if (excel == null) {
|
||||||
getPlayer().sendPacket(new PacketStartChallengeScRsp());
|
getPlayer().sendPacket(new PacketStartChallengeScRsp(Retcode.CHALLENGE_NOT_EXIST));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -42,7 +43,10 @@ public class ChallengeManager extends BasePlayerManager {
|
|||||||
// Get lineup
|
// Get lineup
|
||||||
PlayerLineup lineup = getPlayer().getLineupManager().getExtraLineupByType(ExtraLineupType.LINEUP_CHALLENGE_VALUE);
|
PlayerLineup lineup = getPlayer().getLineupManager().getExtraLineupByType(ExtraLineupType.LINEUP_CHALLENGE_VALUE);
|
||||||
// Make sure this lineup has avatars set
|
// Make sure this lineup has avatars set
|
||||||
if (lineup.getAvatars().size() == 0) return;
|
if (lineup.getAvatars().size() == 0) {
|
||||||
|
getPlayer().sendPacket(new PacketStartChallengeScRsp(Retcode.CHALLENGE_LINEUP_EMPTY));
|
||||||
|
return;
|
||||||
|
}
|
||||||
// Reset hp/sp
|
// Reset hp/sp
|
||||||
lineup.forEachAvatar(avatar -> {
|
lineup.forEachAvatar(avatar -> {
|
||||||
avatar.setCurrentHp(lineup, 10000);
|
avatar.setCurrentHp(lineup, 10000);
|
||||||
@@ -56,7 +60,10 @@ public class ChallengeManager extends BasePlayerManager {
|
|||||||
// Get lineup
|
// Get lineup
|
||||||
PlayerLineup lineup = getPlayer().getLineupManager().getExtraLineupByType(ExtraLineupType.LINEUP_CHALLENGE_2_VALUE);
|
PlayerLineup lineup = getPlayer().getLineupManager().getExtraLineupByType(ExtraLineupType.LINEUP_CHALLENGE_2_VALUE);
|
||||||
// Make sure this lineup has avatars set
|
// Make sure this lineup has avatars set
|
||||||
if (lineup.getAvatars().size() == 0) return;
|
if (lineup.getAvatars().size() == 0) {
|
||||||
|
getPlayer().sendPacket(new PacketStartChallengeScRsp(Retcode.CHALLENGE_LINEUP_EMPTY));
|
||||||
|
return;
|
||||||
|
}
|
||||||
// Reset hp/sp
|
// Reset hp/sp
|
||||||
lineup.forEachAvatar(avatar -> {
|
lineup.forEachAvatar(avatar -> {
|
||||||
avatar.setCurrentHp(lineup, 10000);
|
avatar.setCurrentHp(lineup, 10000);
|
||||||
@@ -80,7 +87,7 @@ public class ChallengeManager extends BasePlayerManager {
|
|||||||
getPlayer().getLineupManager().setCurrentExtraLineup(0, false);
|
getPlayer().getLineupManager().setCurrentExtraLineup(0, false);
|
||||||
getPlayer().setChallengeInstance(null);
|
getPlayer().setChallengeInstance(null);
|
||||||
// Send error packet
|
// Send error packet
|
||||||
getPlayer().sendPacket(new PacketStartChallengeScRsp());
|
getPlayer().sendPacket(new PacketStartChallengeScRsp(Retcode.CHALLENGE_NOT_EXIST));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,14 +4,15 @@ import emu.lunarcore.game.player.Player;
|
|||||||
import emu.lunarcore.proto.StartChallengeScRspOuterClass.StartChallengeScRsp;
|
import emu.lunarcore.proto.StartChallengeScRspOuterClass.StartChallengeScRsp;
|
||||||
import emu.lunarcore.server.packet.BasePacket;
|
import emu.lunarcore.server.packet.BasePacket;
|
||||||
import emu.lunarcore.server.packet.CmdId;
|
import emu.lunarcore.server.packet.CmdId;
|
||||||
|
import emu.lunarcore.server.packet.Retcode;
|
||||||
|
|
||||||
public class PacketStartChallengeScRsp extends BasePacket {
|
public class PacketStartChallengeScRsp extends BasePacket {
|
||||||
|
|
||||||
public PacketStartChallengeScRsp() {
|
public PacketStartChallengeScRsp(Retcode retcode) {
|
||||||
super(CmdId.StartChallengeScRsp);
|
super(CmdId.StartChallengeScRsp);
|
||||||
|
|
||||||
var data = StartChallengeScRsp.newInstance()
|
var data = StartChallengeScRsp.newInstance()
|
||||||
.setRetcode(1);
|
.setRetcode(retcode.getVal());
|
||||||
|
|
||||||
this.setData(data);
|
this.setData(data);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user