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

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

* 123
This commit is contained in:
诗音澄鸢 镜苑芳依 2022-06-18 14:50:55 +08:00 committed by GitHub
parent 45438cd2a7
commit af6c27a002
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 131 additions and 0 deletions

View File

@ -0,0 +1,12 @@
syntax = "proto3";
option java_package = "emu.grasscutter.net.proto";
import "DungeonEntryInfo.proto";
message DailyDungeonEntryInfo {
uint32 dungeon_entry_id = 1;
uint32 dungeon_entry_config_id = 2;
uint32 recommend_dungeon_id = 3;
DungeonEntryInfo recommend_dungeon_entry_info = 4;
}

View File

@ -0,0 +1,11 @@
syntax = "proto3";
option java_package = "emu.grasscutter.net.proto";
// CmdId: 929
// EnetChannelId: 0
// EnetIsReliable: true
// IsAllowClient: true
message GetDailyDungeonEntryInfoReq {
uint32 scene_id = 11;
}

View File

@ -0,0 +1,13 @@
syntax = "proto3";
option java_package = "emu.grasscutter.net.proto";
import "DailyDungeonEntryInfo.proto";
// CmdId: 925
// EnetChannelId: 0
// EnetIsReliable: true
message GetDailyDungeonEntryInfoRsp {
int32 retcode = 9;
repeated DailyDungeonEntryInfo daily_dungeon_info_list = 4;
}

View File

@ -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) -> {

View File

@ -0,0 +1,25 @@
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() {
}
}

View File

@ -0,0 +1,21 @@
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()));
}
}

View File

@ -0,0 +1,43 @@
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();
}
}