diff --git a/src/generated/main/emu/lunarcore/proto/SceneEnterStageCsReqOuterClass.java b/src/generated/main/emu/lunarcore/proto/SceneEnterStageCsReqOuterClass.java
index 5750310..ab08142 100644
--- a/src/generated/main/emu/lunarcore/proto/SceneEnterStageCsReqOuterClass.java
+++ b/src/generated/main/emu/lunarcore/proto/SceneEnterStageCsReqOuterClass.java
@@ -19,7 +19,7 @@ public final class SceneEnterStageCsReqOuterClass {
private static final long serialVersionUID = 0L;
/**
- * optional uint32 stage_id = 1;
+ * optional uint32 stage_id = 2;
*/
private int stageId;
@@ -34,7 +34,7 @@ public final class SceneEnterStageCsReqOuterClass {
}
/**
- * optional uint32 stage_id = 1;
+ * optional uint32 stage_id = 2;
* @return whether the stageId field is set
*/
public boolean hasStageId() {
@@ -42,7 +42,7 @@ public final class SceneEnterStageCsReqOuterClass {
}
/**
- * optional uint32 stage_id = 1;
+ * optional uint32 stage_id = 2;
* @return this
*/
public SceneEnterStageCsReq clearStageId() {
@@ -52,7 +52,7 @@ public final class SceneEnterStageCsReqOuterClass {
}
/**
- * optional uint32 stage_id = 1;
+ * optional uint32 stage_id = 2;
* @return the stageId
*/
public int getStageId() {
@@ -60,7 +60,7 @@ public final class SceneEnterStageCsReqOuterClass {
}
/**
- * optional uint32 stage_id = 1;
+ * optional uint32 stage_id = 2;
* @param value the stageId to set
* @return this
*/
@@ -129,7 +129,7 @@ public final class SceneEnterStageCsReqOuterClass {
@Override
public void writeTo(final ProtoSink output) throws IOException {
if ((bitField0_ & 0x00000001) != 0) {
- output.writeRawByte((byte) 8);
+ output.writeRawByte((byte) 16);
output.writeUInt32NoTag(stageId);
}
}
@@ -150,7 +150,7 @@ public final class SceneEnterStageCsReqOuterClass {
int tag = input.readTag();
while (true) {
switch (tag) {
- case 8: {
+ case 16: {
// stageId
stageId = input.readUInt32();
bitField0_ |= 0x00000001;
diff --git a/src/main/java/emu/lunarcore/data/GameData.java b/src/main/java/emu/lunarcore/data/GameData.java
index f80b0b6..5be0cee 100644
--- a/src/main/java/emu/lunarcore/data/GameData.java
+++ b/src/main/java/emu/lunarcore/data/GameData.java
@@ -71,6 +71,7 @@ public class GameData {
private static Int2ObjectMap equipmentPromotionExcelMap = new Int2ObjectOpenHashMap<>();
private static Int2ObjectMap mazeBuffExcelMap = new Int2ObjectOpenHashMap<>();
private static Int2ObjectMap cocoonExcelMap = new Int2ObjectOpenHashMap<>();
+ private static Int2ObjectMap planeEventExcelMap = new Int2ObjectOpenHashMap<>();
private static Int2ObjectMap mappingInfoExcelMap = new Int2ObjectOpenHashMap<>();
private static Int2ObjectMap monsterDropExcelMap = new Int2ObjectOpenHashMap<>();
@@ -199,6 +200,10 @@ public class GameData {
public static CocoonExcel getCocoonExcel(int cocoonId, int worldLevel) {
return cocoonExcelMap.get((cocoonId << 8) + worldLevel);
}
+
+ public static PlaneEventExcel getPlaneEventExcel(int eventId, int worldLevel) {
+ return planeEventExcelMap.get((eventId << 8) + worldLevel);
+ }
public static MappingInfoExcel getMappingInfoExcel(int mappingInfoId, int worldLevel) {
return mappingInfoExcelMap.get((mappingInfoId << 8) + worldLevel);
diff --git a/src/main/java/emu/lunarcore/data/config/MainMissionInfo.java b/src/main/java/emu/lunarcore/data/config/MainMissionInfo.java
index 8360c68..1135eea 100644
--- a/src/main/java/emu/lunarcore/data/config/MainMissionInfo.java
+++ b/src/main/java/emu/lunarcore/data/config/MainMissionInfo.java
@@ -25,6 +25,9 @@ public class MainMissionInfo {
@SerializedName("MainMissionID")
private int mainMissionID;
+
+ @SerializedName("TakeParamIntList")
+ private Integer[] takeParamIntList;
}
diff --git a/src/main/java/emu/lunarcore/data/excel/PlaneEventExcel.java b/src/main/java/emu/lunarcore/data/excel/PlaneEventExcel.java
new file mode 100644
index 0000000..36906ac
--- /dev/null
+++ b/src/main/java/emu/lunarcore/data/excel/PlaneEventExcel.java
@@ -0,0 +1,28 @@
+package emu.lunarcore.data.excel;
+
+import emu.lunarcore.data.GameResource;
+import emu.lunarcore.data.ResourceType;
+import emu.lunarcore.game.player.PlayerGender;
+import lombok.Getter;
+
+@Getter
+@ResourceType(name = {"PlaneEvent.json"})
+public class PlaneEventExcel extends GameResource {
+ private int EventID;
+ private int WorldLevel;
+ private int StageID;
+
+ @Override
+ public int getId() {
+ return (EventID << 8) + WorldLevel;
+ }
+
+ public int getEventId() {
+ return EventID;
+ }
+
+ public int getStageId() {
+ return StageID;
+ }
+
+}
diff --git a/src/main/java/emu/lunarcore/game/battle/BattleService.java b/src/main/java/emu/lunarcore/game/battle/BattleService.java
index ea8e373..8669f84 100644
--- a/src/main/java/emu/lunarcore/game/battle/BattleService.java
+++ b/src/main/java/emu/lunarcore/game/battle/BattleService.java
@@ -22,6 +22,7 @@ import emu.lunarcore.proto.BattleStatisticsOuterClass.BattleStatistics;
import emu.lunarcore.server.game.BaseGameService;
import emu.lunarcore.server.game.GameServer;
import emu.lunarcore.server.packet.send.*;
+import emu.lunarcore.LunarCore;
import it.unimi.dsi.fastutil.ints.IntSet;
public class BattleService extends BaseGameService {
@@ -179,8 +180,14 @@ public class BattleService extends BaseGameService {
// Get stage
StageExcel stage = GameData.getStageExcelMap().get(stageId);
if (stage == null) {
- player.sendPacket(new PacketSceneCastSkillScRsp());
- return;
+ // Check if its in PlaneEvent excel
+ if (GameData.getPlaneEventExcel(stageId, player.getWorldLevel()) != null) {
+ int newStageId = GameData.getPlaneEventExcel(stageId, player.getWorldLevel()).getStageId();
+ stage = GameData.getStageExcelMap().get(newStageId);
+ } else {
+ player.sendPacket(new PacketSceneCastSkillScRsp());
+ return;
+ }
}
// Create new battle for player
diff --git a/src/main/java/emu/lunarcore/server/packet/recv/HandlerFinishTalkMissionCsReq.java b/src/main/java/emu/lunarcore/server/packet/recv/HandlerFinishTalkMissionCsReq.java
index c560209..df7a85d 100644
--- a/src/main/java/emu/lunarcore/server/packet/recv/HandlerFinishTalkMissionCsReq.java
+++ b/src/main/java/emu/lunarcore/server/packet/recv/HandlerFinishTalkMissionCsReq.java
@@ -14,7 +14,7 @@ public class HandlerFinishTalkMissionCsReq extends PacketHandler {
public void handle(GameSession session, byte[] data) throws Exception {
var req = FinishTalkMissionCsReq.parseFrom(data);
- session.send(new PacketFinishTalkMissionScRsp(req));
+ session.send(new PacketFinishTalkMissionScRsp(req, session.getPlayer()));
}
}
diff --git a/src/main/java/emu/lunarcore/server/packet/send/PacketFinishTalkMissionScRsp.java b/src/main/java/emu/lunarcore/server/packet/send/PacketFinishTalkMissionScRsp.java
index 888713b..9d6a2e6 100644
--- a/src/main/java/emu/lunarcore/server/packet/send/PacketFinishTalkMissionScRsp.java
+++ b/src/main/java/emu/lunarcore/server/packet/send/PacketFinishTalkMissionScRsp.java
@@ -2,16 +2,41 @@ package emu.lunarcore.server.packet.send;
import emu.lunarcore.proto.FinishTalkMissionCsReqOuterClass.FinishTalkMissionCsReq;
import emu.lunarcore.proto.FinishTalkMissionScRspOuterClass.FinishTalkMissionScRsp;
+import emu.lunarcore.proto.MissionStatusOuterClass.MissionStatus;
+import emu.lunarcore.server.packet.send.PacketStartFinishMainMissionScNotify;
+import emu.lunarcore.data.config.MainMissionInfo;
+import emu.lunarcore.data.GameData;
+import emu.lunarcore.game.player.Player;
import emu.lunarcore.server.packet.BasePacket;
import emu.lunarcore.server.packet.CmdId;
public class PacketFinishTalkMissionScRsp extends BasePacket {
- public PacketFinishTalkMissionScRsp(FinishTalkMissionCsReq req) {
+ public PacketFinishTalkMissionScRsp(FinishTalkMissionCsReq req, Player target) {
super(CmdId.FinishTalkMissionScRsp);
+
+ int submissionid = req.getSubMissionId();
+ if (submissionid != target.getSubMissionId()) {
+ submissionid = Integer.valueOf(req.getTalkStr().replace("Mission_", ""));
+ }
+
+ int nextSubMissionId = getNextMissionId(target, submissionid);
+
+ if (nextSubMissionId != 0) {
+ target.setSubMissionId(nextSubMissionId);
+ target.sendPacket(new PacketPlayerSyncScNotify(target.getMainMissionId(), submissionid, MissionStatus.MISSION_FINISH));
+ target.sendPacket(new PacketPlayerSyncScNotify(target.getMainMissionId(), nextSubMissionId, MissionStatus.MISSION_DOING));
+ } else {
+ target.sendPacket(new PacketStartFinishMainMissionScNotify(target.getMainMissionId()));
+ target.sendPacket(new PacketPlayerSyncScNotify(target.getMainMissionId(), submissionid, MissionStatus.MISSION_FINISH));
+ target.setMainMissionId(0);
+ target.setSubMissionId(0);
+ }
+
+
var data = FinishTalkMissionScRsp.newInstance()
- .setSubMissionId(req.getSubMissionId())
+ .setSubMissionId(submissionid)
.setTalkStr(req.getTalkStr());
for (var item : req.getCustomValueList()) {
@@ -20,4 +45,18 @@ public class PacketFinishTalkMissionScRsp extends BasePacket {
this.setData(data);
}
+
+ private int getNextMissionId(Player target, int submissionid) {
+ int nextId = 0;
+ MainMissionInfo missionInfo = GameData.getMainMissionInfos(target.getMainMissionId());
+ for (MainMissionInfo.SubMissionInfo subMissionInfo : missionInfo.getSubMissionList()) {
+ if (subMissionInfo.getTakeParamIntList() == null) {
+ continue;
+ }
+ if (subMissionInfo.getTakeParamIntList()[0] == submissionid) {
+ nextId = subMissionInfo.getId();
+ }
+ }
+ return nextId;
+ }
}