Commit 79e4172c authored by 诗音澄鸢 镜苑芳依's avatar 诗音澄鸢 镜苑芳依 Committed by GitHub
Browse files

Fix daily dungeon didn't display in note(笔记) (#1296)

* Fix Daily dungeon didn't display in note(笔记) -- Buggy

* 123
parent 2915b14c
......@@ -78,6 +78,8 @@ public class GameData {
private static final Int2ObjectMap<WorldAreaData> worldAreaDataMap = new Int2ObjectOpenHashMap<>();
private static final Int2ObjectMap<WorldLevelData> worldLevelDataMap = new Int2ObjectOpenHashMap<>();
private static final Int2ObjectMap<DailyDungeonData> dailyDungeonDataMap = new Int2ObjectOpenHashMap<>();
private static final Int2ObjectMap<DungeonEntryData> dungeonEntryDataMap = new Int2ObjectOpenHashMap<>();
private static final Int2ObjectMap<DungeonData> dungeonDataMap = new Int2ObjectOpenHashMap<>();
private static final Int2ObjectMap<QuestData> questDataMap = new Int2ObjectOpenHashMap<>();
private static final Int2ObjectMap<ShopGoodsData> shopGoodsDataMap = new Int2ObjectOpenHashMap<>();
......@@ -346,6 +348,10 @@ public class GameData {
return dailyDungeonDataMap;
}
public static Int2ObjectMap<DungeonEntryData> getDungeonEntryDatatMap(){
return dungeonEntryDataMap;
}
public static Map<Integer, List<ShopGoodsData>> getShopGoodsDataEntries() {
if (shopGoods.isEmpty()) {
shopGoodsDataMap.forEach((k, v) -> {
......
package emu.grasscutter.data.excels;
import emu.grasscutter.data.GameResource;
import emu.grasscutter.data.ResourceType;
import lombok.Getter;
import lombok.Setter;
@ResourceType(name = "DungeonEntryExcelConfigData.json")
@Getter
@Setter
public class DungeonEntryData extends GameResource {
private int dungeonEntryId;
private int sceneId;
private int id;
@Override
public int getId() {
return this.id;
}
@Override
public void onLoad() {
}
}
package emu.grasscutter.server.packet.recv;
import emu.grasscutter.Grasscutter;
import emu.grasscutter.net.packet.Opcodes;
import emu.grasscutter.net.packet.PacketHandler;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.GetDailyDungeonEntryInfoReqOuterClass;
import emu.grasscutter.server.game.GameSession;
import emu.grasscutter.server.packet.send.PacketGetDailyDungeonEntryInfoRsp;
@Opcodes(PacketOpcodes.GetDailyDungeonEntryInfoReq)
public class HandlerGetDailyDungeonEntryInfoReq extends PacketHandler {
@Override
public void handle(GameSession session, byte[] header, byte[] payload) throws Exception {
var req=
GetDailyDungeonEntryInfoReqOuterClass.GetDailyDungeonEntryInfoReq.parseFrom(payload);
session.send(new PacketGetDailyDungeonEntryInfoRsp(req.getSceneId()));
}
}
package emu.grasscutter.server.packet.send;
import emu.grasscutter.Grasscutter;
import emu.grasscutter.data.GameData;
import emu.grasscutter.data.excels.DungeonEntryData;
import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.DailyDungeonEntryInfoOuterClass;
import emu.grasscutter.net.proto.DungeonEntryInfoOuterClass;
import emu.grasscutter.net.proto.GetDailyDungeonEntryInfoRspOuterClass;
import java.util.List;
public class PacketGetDailyDungeonEntryInfoRsp extends BasePacket {
public PacketGetDailyDungeonEntryInfoRsp(Integer sceneID) {
super(PacketOpcodes.GetDailyDungeonEntryInfoRsp);
var resp= GetDailyDungeonEntryInfoRspOuterClass.GetDailyDungeonEntryInfoRsp.newBuilder();
for (var info : GameData.getDungeonEntryDatatMap().values().parallelStream().filter(d -> d.getSceneId() == sceneID).map(this::getDungonEntryInfo).toList())
resp.addDailyDungeonInfoList(info);
this.setData(resp.build());
}
private DailyDungeonEntryInfoOuterClass.DailyDungeonEntryInfo getDungonEntryInfo(DungeonEntryData data) {
var dungeonEntryId = data.getDungeonEntryId();
var id = data.getId();
//TODO: 来个爹把这块整活了吧 咚咚咚
DungeonEntryInfoOuterClass.DungeonEntryInfo dungeonEntryInfo
= DungeonEntryInfoOuterClass.DungeonEntryInfo.newBuilder().setDungeonId(130).build();
var builder = DailyDungeonEntryInfoOuterClass.DailyDungeonEntryInfo.newBuilder();
builder.setDungeonEntryId(dungeonEntryId);
builder.setDungeonEntryConfigId(id);
builder.setRecommendDungeonEntryInfo(dungeonEntryInfo);
return builder.build();
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment