Fix whitespace [skip actions]

This commit is contained in:
github-actions
2022-08-21 11:33:54 +00:00
parent a746d11b6f
commit c517b8a2c9
919 changed files with 754457 additions and 3136 deletions

View File

@@ -11,40 +11,40 @@ import emu.grasscutter.net.proto.AvatarDataNotifyOuterClass.AvatarDataNotify;
import emu.grasscutter.net.proto.AvatarTeamOuterClass.AvatarTeam;
public class PacketAvatarDataNotify extends BasePacket {
public PacketAvatarDataNotify(Player player) {
super(PacketOpcodes.AvatarDataNotify, true);
AvatarDataNotify.Builder proto = AvatarDataNotify.newBuilder()
.setCurAvatarTeamId(player.getTeamManager().getCurrentTeamId())
//.setChooseAvatarGuid(player.getTeamManager().getCurrentCharacterGuid())
.addAllOwnedFlycloakList(player.getFlyCloakList())
.addAllOwnedCostumeList(player.getCostumeList());
for (Avatar avatar : player.getAvatars()) {
proto.addAvatarList(avatar.toProto());
}
for (Entry<Integer, TeamInfo> entry : player.getTeamManager().getTeams().entrySet()) {
TeamInfo teamInfo = entry.getValue();
AvatarTeam.Builder avatarTeam = AvatarTeam.newBuilder()
.setTeamName(teamInfo.getName());
for (int i = 0; i < teamInfo.getAvatars().size(); i++) {
Avatar avatar = player.getAvatars().getAvatarById(teamInfo.getAvatars().get(i));
avatarTeam.addAvatarGuidList(avatar.getGuid());
}
proto.putAvatarTeamMap(entry.getKey(), avatarTeam.build());
}
// Set main character
Avatar mainCharacter = player.getAvatars().getAvatarById(player.getMainCharacterId());
if (mainCharacter != null) {
proto.setChooseAvatarGuid(mainCharacter.getGuid());
}
this.setData(proto.build());
}
public PacketAvatarDataNotify(Player player) {
super(PacketOpcodes.AvatarDataNotify, true);
AvatarDataNotify.Builder proto = AvatarDataNotify.newBuilder()
.setCurAvatarTeamId(player.getTeamManager().getCurrentTeamId())
//.setChooseAvatarGuid(player.getTeamManager().getCurrentCharacterGuid())
.addAllOwnedFlycloakList(player.getFlyCloakList())
.addAllOwnedCostumeList(player.getCostumeList());
for (Avatar avatar : player.getAvatars()) {
proto.addAvatarList(avatar.toProto());
}
for (Entry<Integer, TeamInfo> entry : player.getTeamManager().getTeams().entrySet()) {
TeamInfo teamInfo = entry.getValue();
AvatarTeam.Builder avatarTeam = AvatarTeam.newBuilder()
.setTeamName(teamInfo.getName());
for (int i = 0; i < teamInfo.getAvatars().size(); i++) {
Avatar avatar = player.getAvatars().getAvatarById(teamInfo.getAvatars().get(i));
avatarTeam.addAvatarGuidList(avatar.getGuid());
}
proto.putAvatarTeamMap(entry.getKey(), avatarTeam.build());
}
// Set main character
Avatar mainCharacter = player.getAvatars().getAvatarById(player.getMainCharacterId());
if (mainCharacter != null) {
proto.setChooseAvatarGuid(mainCharacter.getGuid());
}
this.setData(proto.build());
}
}

View File

@@ -16,4 +16,4 @@ public class PacketAvatarExpeditionCallBackRsp extends BasePacket {
this.setData(proto.build());
}
}
}

View File

@@ -10,4 +10,4 @@ public class PacketBlossomBriefInfoNotify extends BasePacket {
super(PacketOpcodes.BlossomBriefInfoNotify);
this.setData(BlossomBriefInfoNotifyOuterClass.BlossomBriefInfoNotify.newBuilder().addAllBriefInfoList(blossoms));
}
}
}

View File

@@ -9,18 +9,18 @@ import emu.grasscutter.net.proto.FinishedParentQuestNotifyOuterClass.FinishedPar
public class PacketFinishedParentQuestNotify extends BasePacket {
public PacketFinishedParentQuestNotify(Player player) {
super(PacketOpcodes.FinishedParentQuestNotify, true);
public PacketFinishedParentQuestNotify(Player player) {
super(PacketOpcodes.FinishedParentQuestNotify, true);
FinishedParentQuestNotify.Builder proto = FinishedParentQuestNotify.newBuilder();
FinishedParentQuestNotify.Builder proto = FinishedParentQuestNotify.newBuilder();
for (GameMainQuest mainQuest : player.getQuestManager().getMainQuests().values()) {
for (GameMainQuest mainQuest : player.getQuestManager().getMainQuests().values()) {
//Canceled Quests do not appear in this packet
if(mainQuest.getState() != ParentQuestState.PARENT_QUEST_STATE_CANCELED) {
if (mainQuest.getState() != ParentQuestState.PARENT_QUEST_STATE_CANCELED) {
proto.addParentQuestList(mainQuest.toProto());
}
}
}
this.setData(proto);
}
this.setData(proto);
}
}

View File

@@ -9,22 +9,22 @@ import java.util.List;
public class PacketFinishedParentQuestUpdateNotify extends BasePacket {
public PacketFinishedParentQuestUpdateNotify(GameMainQuest quest) {
super(PacketOpcodes.FinishedParentQuestUpdateNotify);
public PacketFinishedParentQuestUpdateNotify(GameMainQuest quest) {
super(PacketOpcodes.FinishedParentQuestUpdateNotify);
FinishedParentQuestUpdateNotify proto = FinishedParentQuestUpdateNotify.newBuilder()
.addParentQuestList(quest.toProto())
.build();
FinishedParentQuestUpdateNotify proto = FinishedParentQuestUpdateNotify.newBuilder()
.addParentQuestList(quest.toProto())
.build();
this.setData(proto);
}
this.setData(proto);
}
public PacketFinishedParentQuestUpdateNotify(List<GameMainQuest> quests) {
super(PacketOpcodes.FinishedParentQuestUpdateNotify);
var proto = FinishedParentQuestUpdateNotify.newBuilder();
for(GameMainQuest mainQuest : quests) {
for (GameMainQuest mainQuest : quests) {
proto.addParentQuestList(mainQuest.toProto());
}
proto.build();

View File

@@ -7,25 +7,25 @@ import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.GetScenePointRspOuterClass.GetScenePointRsp;
public class PacketGetScenePointRsp extends BasePacket {
public PacketGetScenePointRsp(Player player, int sceneId) {
super(PacketOpcodes.GetScenePointRsp);
GetScenePointRsp.Builder p = GetScenePointRsp.newBuilder()
.setSceneId(sceneId);
if (GameData.getScenePointIdList().size() == 0) {
for (int i = 1; i < 1000; i++) {
p.addUnlockedPointList(i);
}
} else {
p.addAllUnlockedPointList(player.getUnlockedScenePoints(sceneId));
}
for (int i = 1; i < 9; i++) {
p.addUnlockAreaList(i);
}
public PacketGetScenePointRsp(Player player, int sceneId) {
super(PacketOpcodes.GetScenePointRsp);
this.setData(p);
}
GetScenePointRsp.Builder p = GetScenePointRsp.newBuilder()
.setSceneId(sceneId);
if (GameData.getScenePointIdList().size() == 0) {
for (int i = 1; i < 1000; i++) {
p.addUnlockedPointList(i);
}
} else {
p.addAllUnlockedPointList(player.getUnlockedScenePoints(sceneId));
}
for (int i = 1; i < 9; i++) {
p.addUnlockAreaList(i);
}
this.setData(p);
}
}

View File

@@ -18,7 +18,7 @@ public class PacketOpenStateChangeNotify extends BasePacket {
this.setData(proto);
}
public PacketOpenStateChangeNotify(Map<Integer, Integer> map) {
super(PacketOpcodes.OpenStateChangeNotify);

View File

@@ -30,7 +30,7 @@ public class PacketOpenStateUpdateNotify extends BasePacket {
if (player.getOpenStates().containsKey(id)) {
proto.putOpenStateMap(id, player.getProgressManager().getOpenState(id));
}
// Otherwise, add the state if it is contained in the set of default open states.
// Otherwise, add the state if it is contained in the set of default open states.
else if (PlayerProgressManager.DEFAULT_OPEN_STATES.contains(id)) {
proto.putOpenStateMap(id, 1);
}

View File

@@ -14,8 +14,8 @@ import java.util.stream.Collectors;
public class PacketPersonalLineAllDataRsp extends BasePacket {
public PacketPersonalLineAllDataRsp(Collection<GameMainQuest> gameMainQuestList) {
super(PacketOpcodes.PersonalLineAllDataRsp);
public PacketPersonalLineAllDataRsp(Collection<GameMainQuest> gameMainQuestList) {
super(PacketOpcodes.PersonalLineAllDataRsp);
var proto = PersonalLineAllDataRspOuterClass.PersonalLineAllDataRsp.newBuilder();
@@ -31,5 +31,5 @@ public class PacketPersonalLineAllDataRsp extends BasePacket {
.forEach(i -> proto.addCanBeUnlockedPersonalLineList(i.getId()));
this.setData(proto);
}
}
}

View File

@@ -8,17 +8,17 @@ import emu.grasscutter.net.proto.PlayerPropChangeNotifyOuterClass.PlayerPropChan
import emu.grasscutter.utils.ProtoHelper;
public class PacketPlayerPropChangeNotify extends BasePacket {
public PacketPlayerPropChangeNotify(Player player, PlayerProperty prop, int delta) {
super(PacketOpcodes.PlayerPropChangeNotify);
this.buildHeader(0);
PlayerPropChangeNotify proto = PlayerPropChangeNotify.newBuilder()
.setPropType(prop.getId())
.setPropDelta(delta)
.build();
this.setData(proto);
}
public PacketPlayerPropChangeNotify(Player player, PlayerProperty prop, int delta) {
super(PacketOpcodes.PlayerPropChangeNotify);
this.buildHeader(0);
PlayerPropChangeNotify proto = PlayerPropChangeNotify.newBuilder()
.setPropType(prop.getId())
.setPropDelta(delta)
.build();
this.setData(proto);
}
}

View File

@@ -8,19 +8,19 @@ import emu.grasscutter.net.proto.PlayerPropChangeReasonNotifyOuterClass.PlayerPr
import emu.grasscutter.net.proto.PropChangeReasonOuterClass.PropChangeReason;
public class PacketPlayerPropChangeReasonNotify extends BasePacket {
public PacketPlayerPropChangeReasonNotify(Player player, PlayerProperty prop, int oldValue, int newValue, PropChangeReason changeReason) {
super(PacketOpcodes.PlayerPropChangeReasonNotify);
this.buildHeader(0);
PlayerPropChangeReasonNotify proto = PlayerPropChangeReasonNotify.newBuilder()
.setPropType(prop.getId())
.setReason(changeReason)
.setOldValue(oldValue)
.setCurValue(newValue)
.build();
this.setData(proto);
}
public PacketPlayerPropChangeReasonNotify(Player player, PlayerProperty prop, int oldValue, int newValue, PropChangeReason changeReason) {
super(PacketOpcodes.PlayerPropChangeReasonNotify);
this.buildHeader(0);
PlayerPropChangeReasonNotify proto = PlayerPropChangeReasonNotify.newBuilder()
.setPropType(prop.getId())
.setReason(changeReason)
.setOldValue(oldValue)
.setCurValue(newValue)
.build();
this.setData(proto);
}
}

View File

@@ -10,17 +10,17 @@ import emu.grasscutter.net.proto.QuestListNotifyOuterClass.QuestListNotify;
public class PacketQuestListNotify extends BasePacket {
public PacketQuestListNotify(Player player) {
super(PacketOpcodes.QuestListNotify, true);
public PacketQuestListNotify(Player player) {
super(PacketOpcodes.QuestListNotify, true);
QuestListNotify.Builder proto = QuestListNotify.newBuilder();
QuestListNotify.Builder proto = QuestListNotify.newBuilder();
player.getQuestManager().forEachQuest(quest -> {
if(quest.getState() != QuestState.QUEST_STATE_UNSTARTED) {
player.getQuestManager().forEachQuest(quest -> {
if (quest.getState() != QuestState.QUEST_STATE_UNSTARTED) {
proto.addQuestList(quest.toProto());
}
});
});
this.setData(proto);
}
this.setData(proto);
}
}

View File

@@ -10,20 +10,20 @@ import java.util.List;
public class PacketQuestListUpdateNotify extends BasePacket {
public PacketQuestListUpdateNotify(GameQuest quest) {
super(PacketOpcodes.QuestListUpdateNotify);
public PacketQuestListUpdateNotify(GameQuest quest) {
super(PacketOpcodes.QuestListUpdateNotify);
QuestListUpdateNotify proto = QuestListUpdateNotify.newBuilder()
.addQuestList(quest.toProto())
.build();
QuestListUpdateNotify proto = QuestListUpdateNotify.newBuilder()
.addQuestList(quest.toProto())
.build();
this.setData(proto);
}
this.setData(proto);
}
public PacketQuestListUpdateNotify(List<GameQuest> quests) {
super(PacketOpcodes.QuestListUpdateNotify);
var proto = QuestListUpdateNotify.newBuilder();
for(GameQuest quest : quests) {
for (GameQuest quest : quests) {
proto.addQuestList(quest.toProto());
}
proto.build();

View File

@@ -8,23 +8,23 @@ import emu.grasscutter.net.proto.QuestProgressUpdateNotifyOuterClass.QuestProgre
public class PacketQuestProgressUpdateNotify extends BasePacket {
public PacketQuestProgressUpdateNotify(GameQuest quest) {
super(PacketOpcodes.QuestProgressUpdateNotify);
public PacketQuestProgressUpdateNotify(GameQuest quest) {
super(PacketOpcodes.QuestProgressUpdateNotify);
QuestProgressUpdateNotify.Builder proto = QuestProgressUpdateNotify.newBuilder().setQuestId(quest.getSubQuestId());
QuestProgressUpdateNotify.Builder proto = QuestProgressUpdateNotify.newBuilder().setQuestId(quest.getSubQuestId());
if (quest.getFinishProgressList() != null) {
for (int i : quest.getFinishProgressList()) {
proto.addFinishProgressList(i);
}
}
if (quest.getFinishProgressList() != null) {
for (int i : quest.getFinishProgressList()) {
proto.addFinishProgressList(i);
}
}
if (quest.getFailProgressList() != null) {
for (int i : quest.getFailProgressList()) {
proto.addFailProgressList(i);
}
}
if (quest.getFailProgressList() != null) {
for (int i : quest.getFailProgressList()) {
proto.addFailProgressList(i);
}
}
this.setData(proto);
}
this.setData(proto);
}
}

View File

@@ -5,23 +5,23 @@ import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.ScenePointUnlockNotifyOuterClass.ScenePointUnlockNotify;
public class PacketScenePointUnlockNotify extends BasePacket {
public PacketScenePointUnlockNotify(int sceneId, int pointId) {
super(PacketOpcodes.ScenePointUnlockNotify);
public PacketScenePointUnlockNotify(int sceneId, int pointId) {
super(PacketOpcodes.ScenePointUnlockNotify);
ScenePointUnlockNotify.Builder p = ScenePointUnlockNotify.newBuilder()
.setSceneId(sceneId)
.addPointList(pointId);
ScenePointUnlockNotify.Builder p = ScenePointUnlockNotify.newBuilder()
.setSceneId(sceneId)
.addPointList(pointId);
this.setData(p);
}
this.setData(p);
}
public PacketScenePointUnlockNotify(int sceneId, Iterable<Integer> pointIds) {
super(PacketOpcodes.ScenePointUnlockNotify);
public PacketScenePointUnlockNotify(int sceneId, Iterable<Integer> pointIds) {
super(PacketOpcodes.ScenePointUnlockNotify);
ScenePointUnlockNotify.Builder p = ScenePointUnlockNotify.newBuilder()
.setSceneId(sceneId)
.addAllPointList(pointIds);
ScenePointUnlockNotify.Builder p = ScenePointUnlockNotify.newBuilder()
.setSceneId(sceneId)
.addAllPointList(pointIds);
this.setData(p);
}
this.setData(p);
}
}

View File

@@ -11,34 +11,34 @@ import emu.grasscutter.net.proto.ServerBuffChangeNotifyOuterClass.ServerBuffChan
import emu.grasscutter.net.proto.ServerBuffChangeNotifyOuterClass.ServerBuffChangeNotify.ServerBuffChangeType;
public class PacketServerBuffChangeNotify extends BasePacket {
public PacketServerBuffChangeNotify(Player player, ServerBuffChangeType changeType, PlayerBuff buff) {
super(PacketOpcodes.ServerBuffChangeNotify);
var proto = ServerBuffChangeNotify.newBuilder();
for (EntityAvatar entity : player.getTeamManager().getActiveTeam()) {
proto.addAvatarGuidList(entity.getAvatar().getGuid());
}
proto.setServerBuffChangeType(changeType);
proto.addServerBuffList(buff.toProto());
this.setData(proto);
}
public PacketServerBuffChangeNotify(Player player, ServerBuffChangeType changeType, Collection<PlayerBuff> buffs) {
public PacketServerBuffChangeNotify(Player player, ServerBuffChangeType changeType, PlayerBuff buff) {
super(PacketOpcodes.ServerBuffChangeNotify);
var proto = ServerBuffChangeNotify.newBuilder();
for (EntityAvatar entity : player.getTeamManager().getActiveTeam()) {
proto.addAvatarGuidList(entity.getAvatar().getGuid());
}
proto.setServerBuffChangeType(changeType);
proto.addServerBuffList(buff.toProto());
this.setData(proto);
}
public PacketServerBuffChangeNotify(Player player, ServerBuffChangeType changeType, Collection<PlayerBuff> buffs) {
super(PacketOpcodes.ServerBuffChangeNotify);
var proto = ServerBuffChangeNotify.newBuilder();
for (EntityAvatar entity : player.getTeamManager().getActiveTeam()) {
proto.addAvatarGuidList(entity.getAvatar().getGuid());
}
proto.setServerBuffChangeType(changeType);
proto.addAllServerBuffList(buffs.stream().map(PlayerBuff::toProto).toList());
this.setData(proto);
}
}

View File

@@ -11,33 +11,33 @@ import java.util.Set;
public class PacketServerCondMeetQuestListUpdateNotify extends BasePacket {
public PacketServerCondMeetQuestListUpdateNotify(Player player) {
super(PacketOpcodes.ServerCondMeetQuestListUpdateNotify);
public PacketServerCondMeetQuestListUpdateNotify(Player player) {
super(PacketOpcodes.ServerCondMeetQuestListUpdateNotify);
ServerCondMeetQuestListUpdateNotify.Builder proto = ServerCondMeetQuestListUpdateNotify.newBuilder();
ServerCondMeetQuestListUpdateNotify.Builder proto = ServerCondMeetQuestListUpdateNotify.newBuilder();
/*
player.getQuestManager().forEachQuest(quest -> {
if (quest.getState().getValue() <= 2) {
proto.addAddQuestIdList(quest.getQuestId());
}
});
*/
/*
player.getQuestManager().forEachQuest(quest -> {
if (quest.getState().getValue() <= 2) {
proto.addAddQuestIdList(quest.getQuestId());
}
});
*/
this.setData(proto);
}
this.setData(proto);
}
public PacketServerCondMeetQuestListUpdateNotify(List<GameQuest> quests) {
super(PacketOpcodes.ServerCondMeetQuestListUpdateNotify);
public PacketServerCondMeetQuestListUpdateNotify(List<GameQuest> quests) {
super(PacketOpcodes.ServerCondMeetQuestListUpdateNotify);
ServerCondMeetQuestListUpdateNotify.Builder proto = ServerCondMeetQuestListUpdateNotify.newBuilder();
ServerCondMeetQuestListUpdateNotify.Builder proto = ServerCondMeetQuestListUpdateNotify.newBuilder();
for (GameQuest quest : quests) {
proto.addAddQuestIdList(quest.getSubQuestId());
}
proto.build();
this.setData(proto);
}
this.setData(proto);
}
public PacketServerCondMeetQuestListUpdateNotify() {
super(PacketOpcodes.ServerCondMeetQuestListUpdateNotify);
@@ -45,6 +45,6 @@ public class PacketServerCondMeetQuestListUpdateNotify extends BasePacket {
ServerCondMeetQuestListUpdateNotify.Builder proto = ServerCondMeetQuestListUpdateNotify.newBuilder();
proto.build();
this.setData(proto);
}
this.setData(proto);
}
}

View File

@@ -7,13 +7,13 @@ import emu.grasscutter.net.proto.RetcodeOuterClass.Retcode;
import emu.grasscutter.net.proto.UnlockTransPointRspOuterClass.UnlockTransPointRsp;
public class PacketUnlockTransPointRsp extends BasePacket {
public PacketUnlockTransPointRsp(Retcode retcode) {
super(PacketOpcodes.UnlockTransPointRsp);
UnlockTransPointRsp proto = UnlockTransPointRsp.newBuilder()
.setRetcode(retcode.getNumber())
.build();
this.setData(proto);
}
public PacketUnlockTransPointRsp(Retcode retcode) {
super(PacketOpcodes.UnlockTransPointRsp);
UnlockTransPointRsp proto = UnlockTransPointRsp.newBuilder()
.setRetcode(retcode.getNumber())
.build();
this.setData(proto);
}
}