Format code [skip actions]

This commit is contained in:
github-actions 2023-09-23 17:45:57 +00:00
parent 0dd95450b1
commit 5faf39d359
8 changed files with 61 additions and 49 deletions

View File

@ -13,21 +13,22 @@ import lombok.experimental.FieldDefaults;
public class CoopChapterData extends GameResource { public class CoopChapterData extends GameResource {
@Getter(onMethod_ = @Override) @Getter(onMethod_ = @Override)
int id; int id;
int avatarId; int avatarId;
// int chapterNameTextMapHash; // int chapterNameTextMapHash;
// int coopPageTitleTextMapHash; // int coopPageTitleTextMapHash;
// int chapterSortId; // int chapterSortId;
// int avatarSortId; // int avatarSortId;
// String chapterIcon; // String chapterIcon;
List<CoopCondition> unlockCond; List<CoopCondition> unlockCond;
// int [] unlockCondTips; // int [] unlockCondTips;
// int openMaterialId; // int openMaterialId;
// int openMaterialNum; // int openMaterialNum;
// String beginTimeStr; // String beginTimeStr;
// int confidenceValue; // int confidenceValue;
// String pointGraphPath; // String pointGraphPath;
// Double graphXRatio; // Double graphXRatio;
// Double graphYRatio; // Double graphYRatio;
@Data @Data
@FieldDefaults(level = AccessLevel.PRIVATE) @FieldDefaults(level = AccessLevel.PRIVATE)

View File

@ -11,13 +11,14 @@ import lombok.experimental.FieldDefaults;
public class CoopPointData extends GameResource { public class CoopPointData extends GameResource {
@Getter(onMethod_ = @Override) @Getter(onMethod_ = @Override)
int id; int id;
int chapterId; int chapterId;
String type; String type;
int acceptQuest; int acceptQuest;
int [] postPointList; int[] postPointList;
// int pointNameTextMapHash; // int pointNameTextMapHash;
// int pointDecTextMapHash; // int pointDecTextMapHash;
int pointPosId; int pointPosId;
// long photoMaleHash; // long photoMaleHash;
// long photoFemaleHash; // long photoFemaleHash;
} }

View File

@ -11,7 +11,8 @@ public class HandlerCancelCoopTaskReq extends PacketHandler {
@Override @Override
public void handle(GameSession session, byte[] header, byte[] payload) throws Exception { public void handle(GameSession session, byte[] header, byte[] payload) throws Exception {
CancelCoopTaskReqOuterClass.CancelCoopTaskReq req = CancelCoopTaskReqOuterClass.CancelCoopTaskReq.parseFrom(payload); CancelCoopTaskReqOuterClass.CancelCoopTaskReq req =
CancelCoopTaskReqOuterClass.CancelCoopTaskReq.parseFrom(payload);
var chapterId = req.getChapterId(); var chapterId = req.getChapterId();
Grasscutter.getLogger().warn("Call to unimplemented packet CancelCoopTaskReq"); Grasscutter.getLogger().warn("Call to unimplemented packet CancelCoopTaskReq");
// TODO: Actually cancel the quests. // TODO: Actually cancel the quests.

View File

@ -12,14 +12,19 @@ public class HandlerStartCoopPointReq extends PacketHandler {
@Override @Override
public void handle(GameSession session, byte[] header, byte[] payload) throws Exception { public void handle(GameSession session, byte[] header, byte[] payload) throws Exception {
StartCoopPointReqOuterClass.StartCoopPointReq req = StartCoopPointReqOuterClass.StartCoopPointReq.parseFrom(payload); StartCoopPointReqOuterClass.StartCoopPointReq req =
StartCoopPointReqOuterClass.StartCoopPointReq.parseFrom(payload);
var coopPoint = req.getCoopPoint(); var coopPoint = req.getCoopPoint();
var coopPointData = GameData.getCoopPointDataMap().values().stream().filter(i -> i.getId() == coopPoint).toList(); var coopPointData =
GameData.getCoopPointDataMap().values().stream()
.filter(i -> i.getId() == coopPoint)
.toList();
if (!coopPointData.isEmpty()) { if (!coopPointData.isEmpty()) {
var player = session.getPlayer(); var player = session.getPlayer();
var questManager = player.getQuestManager(); var questManager = player.getQuestManager();
questManager.queueEvent(QuestCond.QUEST_COND_MAIN_COOP_START, coopPointData.get(0).getChapterId(), 0); questManager.queueEvent(
QuestCond.QUEST_COND_MAIN_COOP_START, coopPointData.get(0).getChapterId(), 0);
} }
session.send(new PacketStartCoopPointRsp(coopPoint)); session.send(new PacketStartCoopPointRsp(coopPoint));
} }

View File

@ -14,21 +14,25 @@ public class PacketCoopDataNotify extends BasePacket {
var proto = CoopDataNotifyOuterClass.CoopDataNotify.newBuilder(); var proto = CoopDataNotifyOuterClass.CoopDataNotify.newBuilder();
proto.setIsHaveProgress(false); proto.setIsHaveProgress(false);
// TODO: implement: determine the actual current progress point. // TODO: implement: determine the actual current progress point.
// Add every chapter and add the start point to each chapter regardless of actual progress. // Add every chapter and add the start point to each chapter regardless of actual progress.
GameData.getCoopChapterDataMap().values().forEach(i -> { GameData.getCoopChapterDataMap()
.values()
.forEach(
i -> {
var chapter = CoopChapterOuterClass.CoopChapter.newBuilder(); var chapter = CoopChapterOuterClass.CoopChapter.newBuilder();
chapter.setId(i.getId()); chapter.setId(i.getId());
// TODO: implement: look at unlockCond to determine what state each chapter should be in. // TODO: implement: look at unlockCond to determine what state each chapter should be
// in.
// Set every chapter to "Accept" regardless of accept conditions. // Set every chapter to "Accept" regardless of accept conditions.
chapter.setStateValue(3); // 3 == STATE_ACCEPT chapter.setStateValue(3); // 3 == STATE_ACCEPT
var point = CoopPointOuterClass.CoopPoint.newBuilder(); var point = CoopPointOuterClass.CoopPoint.newBuilder();
var pointList = GameData.getCoopPointDataMap().values().stream() var pointList =
.filter(j -> j.getChapterId() == i.getId() && j.getType().equals("POINT_START")) GameData.getCoopPointDataMap().values().stream()
.filter(
j -> j.getChapterId() == i.getId() && j.getType().equals("POINT_START"))
.toList(); .toList();
if (!pointList.isEmpty()) { if (!pointList.isEmpty()) {