mirror of
https://github.com/Melledy/LunarCore.git
synced 2025-12-13 13:54:37 +01:00
Add a config option to force unlock all challenges
This commit is contained in:
@@ -86,6 +86,7 @@ public class Config {
|
||||
public boolean autoCreateAccount = true;
|
||||
public int entitySceneLimit = 2000;
|
||||
public boolean spendStamina = true;
|
||||
public boolean unlockAllChallenges = true;
|
||||
public int staminaRecoveryRate = 5 * 60;
|
||||
public int staminaReserveRecoveryRate = 18 * 60;
|
||||
public Set<String> defaultPermissions = Set.of("*");
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
package emu.lunarcore.server.packet.send;
|
||||
|
||||
import emu.lunarcore.LunarCore;
|
||||
import emu.lunarcore.data.GameData;
|
||||
import emu.lunarcore.game.player.Player;
|
||||
import emu.lunarcore.proto.ChallengeOuterClass.Challenge;
|
||||
import emu.lunarcore.proto.GetChallengeScRspOuterClass.GetChallengeScRsp;
|
||||
import emu.lunarcore.server.packet.BasePacket;
|
||||
import emu.lunarcore.server.packet.CmdId;
|
||||
@@ -12,8 +15,22 @@ public class PacketGetChallengeScRsp extends BasePacket {
|
||||
|
||||
var data = GetChallengeScRsp.newInstance();
|
||||
|
||||
for (var history : player.getChallengeManager().getHistory().values()) {
|
||||
data.addChallengeList(history.toProto());
|
||||
if (LunarCore.getConfig().getServerOptions().unlockAllChallenges) {
|
||||
// Add all challenge excels to our challenge list
|
||||
// TODO find out which challenge groups are active so we dont have to send old challenge ids to the client
|
||||
for (var challengeExcel : GameData.getChallengeExcelMap().values()) {
|
||||
var history = player.getChallengeManager().getHistory().get(challengeExcel.getId());
|
||||
|
||||
if (history != null) {
|
||||
data.addChallengeList(history.toProto());
|
||||
} else {
|
||||
data.addChallengeList(Challenge.newInstance().setChallengeId(challengeExcel.getId()));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (var history : player.getChallengeManager().getHistory().values()) {
|
||||
data.addChallengeList(history.toProto());
|
||||
}
|
||||
}
|
||||
|
||||
for (var reward : player.getChallengeManager().getTakenRewards().values()) {
|
||||
|
||||
Reference in New Issue
Block a user