mirror of
https://github.com/Melledy/LunarCore.git
synced 2025-12-12 13:24:36 +01:00
Warn the server owner if RogueMapGen isnt found in the data folder
This commit is contained in:
@@ -366,7 +366,10 @@ public class ResourceLoader {
|
||||
|
||||
private static void loadRogueMapGen() {
|
||||
File file = new File(LunarCore.getConfig().getDataDir() + "/RogueMapGen.json");
|
||||
if (!file.exists()) return;
|
||||
if (!file.exists()) {
|
||||
LunarCore.getLogger().warn("RogueMapGen not found in data folder. Simulated universe will not work.");
|
||||
return;
|
||||
}
|
||||
|
||||
try (FileReader reader = new FileReader(file)) {
|
||||
Map<Integer, int[]> rogue = gson.fromJson(reader, TypeToken.getParameterized(Map.class, Integer.class, int[].class).getType());
|
||||
|
||||
@@ -23,6 +23,7 @@ import emu.lunarcore.proto.RogueTalentInfoOuterClass.RogueTalentInfo;
|
||||
import emu.lunarcore.proto.RogueTalentOuterClass.RogueTalent;
|
||||
import emu.lunarcore.proto.RogueTalentStatusOuterClass.RogueTalentStatus;
|
||||
import emu.lunarcore.server.packet.CmdId;
|
||||
import emu.lunarcore.server.packet.Retcode;
|
||||
import emu.lunarcore.server.packet.send.PacketLeaveRogueScRsp;
|
||||
import emu.lunarcore.server.packet.send.PacketStartRogueScRsp;
|
||||
import emu.lunarcore.server.packet.send.PacketSyncRogueFinishScNotify;
|
||||
@@ -71,6 +72,12 @@ public class RogueManager extends BasePlayerManager {
|
||||
}
|
||||
|
||||
public void startRogue(int areaId, int aeonId, RepeatedInt avatarIdList) {
|
||||
// Check if map gen is loaded
|
||||
if (GameDepot.getRogueMapGen().size() == 0) {
|
||||
getPlayer().sendPacket(new PacketStartRogueScRsp(Retcode.ROGUE_AREA_INVALID.getVal()));
|
||||
return;
|
||||
}
|
||||
|
||||
// Make sure player already isnt in a rogue instance
|
||||
if (getPlayer().getRogueInstance() != null) {
|
||||
getPlayer().sendPacket(new PacketStartRogueScRsp());
|
||||
|
||||
@@ -4,20 +4,22 @@ import emu.lunarcore.game.player.Player;
|
||||
import emu.lunarcore.proto.StartRogueScRspOuterClass.StartRogueScRsp;
|
||||
import emu.lunarcore.server.packet.BasePacket;
|
||||
import emu.lunarcore.server.packet.CmdId;
|
||||
import lombok.SneakyThrows;
|
||||
|
||||
public class PacketStartRogueScRsp extends BasePacket {
|
||||
|
||||
public PacketStartRogueScRsp() {
|
||||
this(1);
|
||||
}
|
||||
|
||||
public PacketStartRogueScRsp(int retcode) {
|
||||
super(CmdId.StartRogueScRsp);
|
||||
|
||||
var data = StartRogueScRsp.newInstance()
|
||||
.setRetcode(1);
|
||||
.setRetcode(retcode);
|
||||
|
||||
this.setData(data);
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
public PacketStartRogueScRsp(Player player) {
|
||||
super(CmdId.StartRogueScRsp);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user