mirror of
https://github.com/Anime-Game-Servers/AGSLunarCore.git
synced 2024-11-23 04:19:48 +00:00
some progress
This commit is contained in:
parent
1c251fa5d4
commit
30e0f61206
@ -19,7 +19,7 @@ public final class SceneEnterStageCsReqOuterClass {
|
||||
private static final long serialVersionUID = 0L;
|
||||
|
||||
/**
|
||||
* <code>optional uint32 stage_id = 1;</code>
|
||||
* <code>optional uint32 stage_id = 2;</code>
|
||||
*/
|
||||
private int stageId;
|
||||
|
||||
@ -34,7 +34,7 @@ public final class SceneEnterStageCsReqOuterClass {
|
||||
}
|
||||
|
||||
/**
|
||||
* <code>optional uint32 stage_id = 1;</code>
|
||||
* <code>optional uint32 stage_id = 2;</code>
|
||||
* @return whether the stageId field is set
|
||||
*/
|
||||
public boolean hasStageId() {
|
||||
@ -42,7 +42,7 @@ public final class SceneEnterStageCsReqOuterClass {
|
||||
}
|
||||
|
||||
/**
|
||||
* <code>optional uint32 stage_id = 1;</code>
|
||||
* <code>optional uint32 stage_id = 2;</code>
|
||||
* @return this
|
||||
*/
|
||||
public SceneEnterStageCsReq clearStageId() {
|
||||
@ -52,7 +52,7 @@ public final class SceneEnterStageCsReqOuterClass {
|
||||
}
|
||||
|
||||
/**
|
||||
* <code>optional uint32 stage_id = 1;</code>
|
||||
* <code>optional uint32 stage_id = 2;</code>
|
||||
* @return the stageId
|
||||
*/
|
||||
public int getStageId() {
|
||||
@ -60,7 +60,7 @@ public final class SceneEnterStageCsReqOuterClass {
|
||||
}
|
||||
|
||||
/**
|
||||
* <code>optional uint32 stage_id = 1;</code>
|
||||
* <code>optional uint32 stage_id = 2;</code>
|
||||
* @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;
|
||||
|
@ -71,6 +71,7 @@ public class GameData {
|
||||
private static Int2ObjectMap<EquipmentPromotionExcel> equipmentPromotionExcelMap = new Int2ObjectOpenHashMap<>();
|
||||
private static Int2ObjectMap<MazeBuffExcel> mazeBuffExcelMap = new Int2ObjectOpenHashMap<>();
|
||||
private static Int2ObjectMap<CocoonExcel> cocoonExcelMap = new Int2ObjectOpenHashMap<>();
|
||||
private static Int2ObjectMap<PlaneEventExcel> planeEventExcelMap = new Int2ObjectOpenHashMap<>();
|
||||
private static Int2ObjectMap<MappingInfoExcel> mappingInfoExcelMap = new Int2ObjectOpenHashMap<>();
|
||||
private static Int2ObjectMap<MonsterDropExcel> 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);
|
||||
|
@ -25,6 +25,9 @@ public class MainMissionInfo {
|
||||
|
||||
@SerializedName("MainMissionID")
|
||||
private int mainMissionID;
|
||||
|
||||
@SerializedName("TakeParamIntList")
|
||||
private Integer[] takeParamIntList;
|
||||
}
|
||||
|
||||
|
||||
|
28
src/main/java/emu/lunarcore/data/excel/PlaneEventExcel.java
Normal file
28
src/main/java/emu/lunarcore/data/excel/PlaneEventExcel.java
Normal file
@ -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;
|
||||
}
|
||||
|
||||
}
|
@ -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
|
||||
|
@ -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()));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user