Commit addfb5eb authored by WetABQ's avatar WetABQ Committed by GitHub
Browse files

[BREAKING CHANGE] proto auto compiled by gradle (#226)

* [BREAK] proto auto compiled by gradle

* [BREAK] move proto to submodule

* update gitmodules

* [BREAK] move proto to submodule

* move proto to submodule

* fix merge conflict

* fix github action after merging

* fix merge conflicts and del submodule

* upload the proto
parent 627a2f1e
......@@ -3,13 +3,14 @@ package emu.grasscutter.server.packet.send;
import emu.grasscutter.net.packet.GenshinPacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.GetAuthkeyRspOuterClass.GetAuthkeyRsp;
import emu.grasscutter.net.proto.RetcodeOuterClass;
public class PacketGetAuthkeyRsp extends GenshinPacket {
public PacketGetAuthkeyRsp() {
super(PacketOpcodes.GetAuthkeyRsp);
GetAuthkeyRsp proto = GetAuthkeyRsp.newBuilder().setRetcode(1).build();
GetAuthkeyRsp proto = GetAuthkeyRsp.newBuilder().setRetcode(RetcodeOuterClass.Retcode.RET_SVR_ERROR_VALUE).build();
this.setData(proto);
}
......
......@@ -9,6 +9,7 @@ import emu.grasscutter.net.proto.FriendBriefOuterClass.FriendBrief;
import emu.grasscutter.net.proto.FriendOnlineStateOuterClass.FriendOnlineState;
import emu.grasscutter.net.proto.GetPlayerFriendListRspOuterClass.GetPlayerFriendListRsp;
import emu.grasscutter.net.proto.HeadImageOuterClass.HeadImage;
import emu.grasscutter.net.proto.PlatformTypeOuterClass;
public class PacketGetPlayerFriendListRsp extends GenshinPacket {
......@@ -19,15 +20,15 @@ public class PacketGetPlayerFriendListRsp extends GenshinPacket {
.setUid(GenshinConstants.SERVER_CONSOLE_UID)
.setNickname("Server")
.setLevel(1)
.setAvatar(HeadImage.newBuilder().setAvatarId(GenshinConstants.MAIN_CHARACTER_FEMALE))
.setAvatarId(HeadImage.newBuilder().setAvatarId(GenshinConstants.MAIN_CHARACTER_FEMALE).getAvatarId())
.setWorldLevel(0)
.setSignature("")
.setLastActiveTime((int) (System.currentTimeMillis() / 1000f))
.setNameCardId(210001)
.setOnlineState(FriendOnlineState.FRIEND_ONLINE)
.setParam(1)
.setUnk1(1)
.setUnk2(3)
.setIsGameSource(true)
.setPlatformType(PlatformTypeOuterClass.PlatformType.PC)
.build();
GetPlayerFriendListRsp.Builder proto = GetPlayerFriendListRsp.newBuilder().addFriendList(serverFriend);
......
......@@ -3,6 +3,7 @@ package emu.grasscutter.server.packet.send;
import emu.grasscutter.net.packet.GenshinPacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.GetPlayerSocialDetailRspOuterClass.GetPlayerSocialDetailRsp;
import emu.grasscutter.net.proto.RetcodeOuterClass;
import emu.grasscutter.net.proto.SocialDetailOuterClass.SocialDetail;
public class PacketGetPlayerSocialDetailRsp extends GenshinPacket {
......@@ -15,7 +16,7 @@ public class PacketGetPlayerSocialDetailRsp extends GenshinPacket {
if (detail != null) {
proto.setDetailData(detail);
} else {
proto.setRetcode(1);
proto.setRetcode(RetcodeOuterClass.Retcode.RET_SVR_ERROR_VALUE);
}
this.setData(proto);
......
......@@ -16,18 +16,18 @@ public class PacketGetPlayerTokenRsp extends GenshinPacket {
this.setUseDispatchKey(true);
GetPlayerTokenRsp p = GetPlayerTokenRsp.newBuilder()
.setPlayerUid(session.getAccount().getPlayerUid())
.setAccountToken(session.getAccount().getToken())
.setUid(session.getAccount().getPlayerUid())
.setToken(session.getAccount().getToken())
.setAccountType(1)
.setIsProficientPlayer(doesPlayerExist) // Not sure where this goes
.setSecretKey(Crypto.ENCRYPT_SEED)
.setSecretKeyBuffer(ByteString.copyFrom(Crypto.ENCRYPT_SEED_BUFFER))
.setSecretKeySeed(Crypto.ENCRYPT_SEED)
.setSecurityCmdBuffer(ByteString.copyFrom(Crypto.ENCRYPT_SEED_BUFFER))
.setPlatformType(3)
.setChannelId(1)
.setCountryCode("US")
.setUnk1("c25-314dd05b0b5f")
.setUnk3(3)
.setClientIp(session.getAddress().getAddress().getHostAddress())
.setClientVersionRandomKey("c25-314dd05b0b5f")
.setRegPlatform(3)
.setClientIpStr(session.getAddress().getAddress().getHostAddress())
.build();
this.setData(p.toByteArray());
......
......@@ -8,7 +8,7 @@ import emu.grasscutter.net.proto.PlayerApplyEnterMpResultNotifyOuterClass.Player
public class PacketPlayerApplyEnterMpResultNotify extends GenshinPacket {
public PacketPlayerApplyEnterMpResultNotify(GenshinPlayer target, boolean isAgreed, PlayerApplyEnterMpReason reason) {
public PacketPlayerApplyEnterMpResultNotify(GenshinPlayer target, boolean isAgreed, PlayerApplyEnterMpResultNotify.Reason reason) {
super(PacketOpcodes.PlayerApplyEnterMpResultNotify);
PlayerApplyEnterMpResultNotify proto = PlayerApplyEnterMpResultNotify.newBuilder()
......@@ -21,7 +21,7 @@ public class PacketPlayerApplyEnterMpResultNotify extends GenshinPacket {
this.setData(proto);
}
public PacketPlayerApplyEnterMpResultNotify(int targetId, String targetName, boolean isAgreed, PlayerApplyEnterMpReason reason) {
public PacketPlayerApplyEnterMpResultNotify(int targetId, String targetName, boolean isAgreed, PlayerApplyEnterMpResultNotify.Reason reason) {
super(PacketOpcodes.PlayerApplyEnterMpResultNotify);
PlayerApplyEnterMpResultNotify proto = PlayerApplyEnterMpResultNotify.newBuilder()
......
......@@ -43,7 +43,7 @@ public class PacketPlayerChatNotify extends GenshinPacket {
this.setData(proto);
}
public PacketPlayerChatNotify(GenshinPlayer sender, int channelId, SystemHint systemHint) {
public PacketPlayerChatNotify(GenshinPlayer sender, int channelId, ChatInfo.SystemHint systemHint) {
super(PacketOpcodes.PlayerChatNotify);
ChatInfo info = ChatInfo.newBuilder()
......
......@@ -13,7 +13,7 @@ public class PacketPlayerDataNotify extends GenshinPacket {
PlayerDataNotify.Builder p = PlayerDataNotify.newBuilder()
.setNickName(player.getNickname())
.setClientTime(System.currentTimeMillis())
.setServerTime(System.currentTimeMillis())
.setIsFirstLoginToday(true)
.setRegionId(player.getRegionId());
......
......@@ -5,6 +5,7 @@ import emu.grasscutter.game.entity.EntityAvatar;
import emu.grasscutter.game.inventory.GenshinItem;
import emu.grasscutter.net.packet.GenshinPacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.AbilityControlBlockOuterClass;
import emu.grasscutter.net.proto.AbilitySyncStateInfoOuterClass.AbilitySyncStateInfo;
import emu.grasscutter.net.proto.AvatarEnterSceneInfoOuterClass.AvatarEnterSceneInfo;
import emu.grasscutter.net.proto.MPLevelEntityInfoOuterClass.MPLevelEntityInfo;
......@@ -26,7 +27,7 @@ public class PacketPlayerEnterSceneInfoNotify extends GenshinPacket {
TeamEnterSceneInfo.newBuilder()
.setTeamEntityId(player.getTeamManager().getEntityId()) // 150995833
.setTeamAbilityInfo(empty)
.setUnk(empty)
.setAbilityControlBlock(AbilityControlBlockOuterClass.AbilityControlBlock.newBuilder().build())
);
proto.setMpLevelEntityInfo(
MPLevelEntityInfo.newBuilder()
......
......@@ -23,14 +23,14 @@ public class PacketPlayerEnterSceneNotify extends GenshinPacket {
.setSceneId(player.getSceneId())
.setPos(player.getPos().toProto())
.setSceneBeginTime(System.currentTimeMillis())
.setType(EnterType.EnterSelf)
.setType(EnterType.ENTER_SELF)
.setTargetUid(player.getUid())
.setEnterSceneToken(player.getEnterSceneToken())
.setWorldLevel(player.getWorldLevel())
.setEnterReason(EnterReason.Login.getValue())
.setIsFirstLoginEnterScene(player.isFirstLoginEnterScene())
.setUnk1(1)
.setUnk2("3-" + player.getUid() + "-" + (int) (System.currentTimeMillis() / 1000) + "-" + 18402)
.setWorldType(1)
.setSceneTransaction("3-" + player.getUid() + "-" + (int) (System.currentTimeMillis() / 1000) + "-" + 18402)
.build();
this.setData(proto);
......@@ -62,8 +62,8 @@ public class PacketPlayerEnterSceneNotify extends GenshinPacket {
.addSceneTagIdList(109)
.addSceneTagIdList(113)
.addSceneTagIdList(117)
.setUnk1(1)
.setUnk2(newScene + "-" + target.getUid() + "-" + (int) (System.currentTimeMillis() / 1000) + "-" + 18402)
.setWorldType(1)
.setSceneTransaction(newScene + "-" + target.getUid() + "-" + (int) (System.currentTimeMillis() / 1000) + "-" + 18402)
.build();
this.setData(proto);
......
......@@ -40,8 +40,8 @@ public class PacketPlayerLoginRsp extends GenshinPacket {
QueryCurrRegionHttpRspOuterClass.QueryCurrRegionHttpRsp regionQuery = QueryCurrRegionHttpRspOuterClass.QueryCurrRegionHttpRsp.parseFrom(decodedCurRegion);
RegionInfo serverRegion = regionQuery.getRegionInfo().toBuilder()
.setIp((Grasscutter.getConfig().getGameServerOptions().PublicIp.isEmpty() ? Grasscutter.getConfig().getGameServerOptions().Ip : Grasscutter.getConfig().getGameServerOptions().PublicIp))
.setPort(Grasscutter.getConfig().getGameServerOptions().PublicPort != 0 ? Grasscutter.getConfig().getGameServerOptions().PublicPort : Grasscutter.getConfig().getGameServerOptions().Port)
.setGateserverIp((Grasscutter.getConfig().getGameServerOptions().PublicIp.isEmpty() ? Grasscutter.getConfig().getGameServerOptions().Ip : Grasscutter.getConfig().getGameServerOptions().PublicIp))
.setGateserverPort(Grasscutter.getConfig().getGameServerOptions().PublicPort != 0 ? Grasscutter.getConfig().getGameServerOptions().PublicPort : Grasscutter.getConfig().getGameServerOptions().Port)
.setSecretKey(ByteString.copyFrom(FileUtils.read(Grasscutter.getConfig().KEY_FOLDER + "dispatchSeed.bin")))
.build();
......@@ -64,7 +64,7 @@ public class PacketPlayerLoginRsp extends GenshinPacket {
.setClientSilenceDataVersion(info.getClientSilenceDataVersion())
.setClientMd5(info.getClientDataMd5())
.setClientSilenceMd5(info.getClientSilenceDataMd5())
.setResVersionConfig(info.getConfig())
.setResVersionConfig(info.getResVersionConfig())
.setClientVersionSuffix(info.getClientVersionSuffix())
.setClientSilenceVersionSuffix(info.getClientSilenceVersionSuffix())
.setIsScOpen(false)
......
......@@ -18,7 +18,7 @@ public class PacketPlayerStoreNotify extends GenshinPacket {
this.buildHeader(2);
PlayerStoreNotify.Builder p = PlayerStoreNotify.newBuilder()
.setStoreType(StoreType.StorePack)
.setStoreType(StoreType.STORE_PACK)
.setWeightLimit(Grasscutter.getConfig().getGameServerOptions().InventoryLimitAll);
for (GenshinItem item : player.getInventory()) {
......
......@@ -15,7 +15,7 @@ public class PacketSceneEntityAppearNotify extends GenshinPacket {
super(PacketOpcodes.SceneEntityAppearNotify, true);
SceneEntityAppearNotify.Builder proto = SceneEntityAppearNotify.newBuilder()
.setAppearType(VisionType.VisionBorn)
.setAppearType(VisionType.VISION_BORN)
.addEntityList(entity.toProto());
this.setData(proto.build());
......
......@@ -2,6 +2,7 @@ package emu.grasscutter.server.packet.send;
import emu.grasscutter.net.packet.GenshinPacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.RetcodeOuterClass;
import emu.grasscutter.net.proto.SceneKickPlayerRspOuterClass.SceneKickPlayerRsp;
public class PacketSceneKickPlayerRsp extends GenshinPacket {
......@@ -20,7 +21,7 @@ public class PacketSceneKickPlayerRsp extends GenshinPacket {
super(PacketOpcodes.SceneKickPlayerRsp);
SceneKickPlayerRsp proto = SceneKickPlayerRsp.newBuilder()
.setRetcode(1)
.setRetcode(RetcodeOuterClass.Retcode.RET_SVR_ERROR_VALUE)
.build();
this.setData(proto);
......
......@@ -19,7 +19,7 @@ public class PacketSceneTeamUpdateNotify extends GenshinPacket {
for (GenshinPlayer p : player.getWorld().getPlayers()) {
for (EntityAvatar entityAvatar : p.getTeamManager().getActiveTeam()) {
SceneTeamAvatar.Builder avatarProto = SceneTeamAvatar.newBuilder()
.setPlayerId(p.getUid())
.setPlayerUid(p.getUid())
.setAvatarGuid(entityAvatar.getAvatar().getGuid())
.setSceneId(p.getSceneId())
.setEntityId(entityAvatar.getId())
......
......@@ -5,6 +5,7 @@ import emu.grasscutter.data.custom.ScenePointEntry;
import emu.grasscutter.game.GenshinPlayer;
import emu.grasscutter.net.packet.GenshinPacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.RetcodeOuterClass;
import emu.grasscutter.net.proto.SceneTransToPointRspOuterClass.SceneTransToPointRsp;
import emu.grasscutter.utils.Position;
......@@ -26,7 +27,7 @@ public class PacketSceneTransToPointRsp extends GenshinPacket {
super(PacketOpcodes.SceneTransToPointRsp);
SceneTransToPointRsp proto = SceneTransToPointRsp.newBuilder()
.setRetcode(1) // Internal server error
.setRetcode(RetcodeOuterClass.Retcode.RET_SVR_ERROR_VALUE) // Internal server error
.build();
this.setData(proto);
......
......@@ -4,6 +4,7 @@ import emu.grasscutter.game.GenshinPlayer;
import emu.grasscutter.net.packet.GenshinPacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.SetPlayerBirthdayRspOuterClass.SetPlayerBirthdayRsp;
import emu.grasscutter.net.proto.SetPlayerBornDataReqOuterClass;
public class PacketSetPlayerBirthdayRsp extends GenshinPacket {
......
......@@ -12,7 +12,7 @@ public class PacketSetPlayerHeadImageRsp extends GenshinPacket {
super(PacketOpcodes.SetPlayerHeadImageRsp);
SetPlayerHeadImageRsp proto = SetPlayerHeadImageRsp.newBuilder()
.setAvatar(HeadImage.newBuilder().setAvatarId(player.getHeadImage()))
.setAvatarId(HeadImage.newBuilder().setAvatarId(player.getHeadImage()).getAvatarId())
.build();
this.setData(proto);
......
package emu.grasscutter.server.packet.send;
import emu.grasscutter.net.packet.GenshinPacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.SitRspOuterClass.SitRsp;
import emu.grasscutter.utils.Position;
public class PacketSitRsp extends GenshinPacket {
public PacketSitRsp(long chairId, Position pos, int EntityId) {
super(PacketOpcodes.SitRsp);
SitRsp proto = SitRsp.newBuilder()
.setEntityId(EntityId)
.setPosition(pos.toProto())
.setChairId(chairId)
.build();
this.setData(proto);
}
}
......@@ -18,7 +18,7 @@ public class PacketStoreItemChangeNotify extends GenshinPacket {
this();
StoreItemChangeNotify.Builder proto = StoreItemChangeNotify.newBuilder()
.setStoreType(StoreType.StorePack)
.setStoreType(StoreType.STORE_PACK)
.addItemList(item.toProto());
this.setData(proto);
......@@ -28,9 +28,9 @@ public class PacketStoreItemChangeNotify extends GenshinPacket {
this();
StoreItemChangeNotify.Builder proto = StoreItemChangeNotify.newBuilder()
.setStoreType(StoreType.StorePack);
.setStoreType(StoreType.STORE_PACK);
items.stream().forEach(item -> proto.addItemList(item.toProto()));
items.forEach(item -> proto.addItemList(item.toProto()));
this.setData(proto);
}
......
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