Skip to content

Commit

Permalink
Format code [skip actions]
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Sep 23, 2023
1 parent 0dd9545 commit 5faf39d
Show file tree
Hide file tree
Showing 8 changed files with 65 additions and 53 deletions.
29 changes: 15 additions & 14 deletions src/main/java/emu/grasscutter/data/excels/CoopChapterData.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,22 @@
public class CoopChapterData extends GameResource {
@Getter(onMethod_ = @Override)
int id;

int avatarId;
// int chapterNameTextMapHash;
// int coopPageTitleTextMapHash;
// int chapterSortId;
// int avatarSortId;
// String chapterIcon;
// int chapterNameTextMapHash;
// int coopPageTitleTextMapHash;
// int chapterSortId;
// int avatarSortId;
// String chapterIcon;
List<CoopCondition> unlockCond;
// int [] unlockCondTips;
// int openMaterialId;
// int openMaterialNum;
// String beginTimeStr;
// int confidenceValue;
// String pointGraphPath;
// Double graphXRatio;
// Double graphYRatio;
// int [] unlockCondTips;
// int openMaterialId;
// int openMaterialNum;
// String beginTimeStr;
// int confidenceValue;
// String pointGraphPath;
// Double graphXRatio;
// Double graphYRatio;

@Data
@FieldDefaults(level = AccessLevel.PRIVATE)
Expand All @@ -42,4 +43,4 @@ private static class CoopCondition {
alternate = {"args"})
int[] args;
}
}
}
13 changes: 7 additions & 6 deletions src/main/java/emu/grasscutter/data/excels/CoopPointData.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@
public class CoopPointData extends GameResource {
@Getter(onMethod_ = @Override)
int id;

int chapterId;
String type;
int acceptQuest;
int [] postPointList;
// int pointNameTextMapHash;
// int pointDecTextMapHash;
int[] postPointList;
// int pointNameTextMapHash;
// int pointDecTextMapHash;
int pointPosId;
// long photoMaleHash;
// long photoFemaleHash;
}
// long photoMaleHash;
// long photoFemaleHash;
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ public boolean execute(
return condition.getParam()[0] == params[0]
&& (condition.getParam()[1] == 0 || condition.getParam()[1] == params[1]);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ public class HandlerCancelCoopTaskReq extends PacketHandler {

@Override
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();
Grasscutter.getLogger().warn("Call to unimplemented packet CancelCoopTaskReq");
// TODO: Actually cancel the quests.
session.send(new PacketCancelCoopTaskRsp(chapterId));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,20 @@ public class HandlerStartCoopPointReq extends PacketHandler {

@Override
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 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()) {
var player = session.getPlayer();
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));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ public PacketCancelCoopTaskRsp(int chapterId) {

this.setData(proto);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,32 +14,36 @@ public PacketCoopDataNotify() {
var proto = CoopDataNotifyOuterClass.CoopDataNotify.newBuilder();
proto.setIsHaveProgress(false);



// TODO: implement: determine the actual current progress point.
// Add every chapter and add the start point to each chapter regardless of actual progress.
GameData.getCoopChapterDataMap().values().forEach(i -> {
var chapter = CoopChapterOuterClass.CoopChapter.newBuilder();
chapter.setId(i.getId());

// TODO: implement: look at unlockCond to determine what state each chapter should be in.
// Set every chapter to "Accept" regardless of accept conditions.
chapter.setStateValue(3); // 3 == STATE_ACCEPT

var point = CoopPointOuterClass.CoopPoint.newBuilder();
var pointList = GameData.getCoopPointDataMap().values().stream()
.filter(j -> j.getChapterId() == i.getId() && j.getType().equals("POINT_START"))
.toList();

if (!pointList.isEmpty()) {
int pointId = pointList.get(0).getId();
point.setId(pointId);
chapter.addCoopPointList(point);
}

proto.addChapterList(chapter);
});
GameData.getCoopChapterDataMap()
.values()
.forEach(
i -> {
var chapter = CoopChapterOuterClass.CoopChapter.newBuilder();
chapter.setId(i.getId());

// TODO: implement: look at unlockCond to determine what state each chapter should be
// in.
// Set every chapter to "Accept" regardless of accept conditions.
chapter.setStateValue(3); // 3 == STATE_ACCEPT

var point = CoopPointOuterClass.CoopPoint.newBuilder();
var pointList =
GameData.getCoopPointDataMap().values().stream()
.filter(
j -> j.getChapterId() == i.getId() && j.getType().equals("POINT_START"))
.toList();

if (!pointList.isEmpty()) {
int pointId = pointList.get(0).getId();
point.setId(pointId);
chapter.addCoopPointList(point);
}

proto.addChapterList(chapter);
});

this.setData(proto);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ public PacketStartCoopPointRsp(int coopPoint) {

this.setData(proto);
}
}
}

0 comments on commit 5faf39d

Please sign in to comment.