Commit 9fc8cc1c authored by Kengxxiao's avatar Kengxxiao Committed by GitHub
Browse files

Merge pull request #1 from Grasscutters/development

merge
parents 627a2f1e d1fc8c1f
package emu.grasscutter.server.packet.send; package emu.grasscutter.server.packet.send;
import emu.grasscutter.game.GenshinPlayer; import emu.grasscutter.game.player.Player;
import emu.grasscutter.net.packet.GenshinPacket; import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.PostEnterSceneRspOuterClass.PostEnterSceneRsp; import emu.grasscutter.net.proto.PostEnterSceneRspOuterClass.PostEnterSceneRsp;
public class PacketPostEnterSceneRsp extends GenshinPacket { public class PacketPostEnterSceneRsp extends BasePacket {
public PacketPostEnterSceneRsp(GenshinPlayer player) { public PacketPostEnterSceneRsp(Player player) {
super(PacketOpcodes.PostEnterSceneRsp); super(PacketOpcodes.PostEnterSceneRsp);
PostEnterSceneRsp p = PostEnterSceneRsp.newBuilder() PostEnterSceneRsp p = PostEnterSceneRsp.newBuilder()
......
package emu.grasscutter.server.packet.send; package emu.grasscutter.server.packet.send;
import emu.grasscutter.net.packet.GenshinPacket; import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.ChatInfoOuterClass.ChatInfo; import emu.grasscutter.net.proto.ChatInfoOuterClass.ChatInfo;
import emu.grasscutter.net.proto.PrivateChatNotifyOuterClass.PrivateChatNotify; import emu.grasscutter.net.proto.PrivateChatNotifyOuterClass.PrivateChatNotify;
public class PacketPrivateChatNotify extends GenshinPacket { public class PacketPrivateChatNotify extends BasePacket {
public PacketPrivateChatNotify(int senderId, int recvId, String message) { public PacketPrivateChatNotify(int senderId, int recvId, String message) {
super(PacketOpcodes.PrivateChatNotify); super(PacketOpcodes.PrivateChatNotify);
......
package emu.grasscutter.server.packet.send; package emu.grasscutter.server.packet.send;
import emu.grasscutter.game.avatar.GenshinAvatar; import emu.grasscutter.game.avatar.Avatar;
import emu.grasscutter.net.packet.GenshinPacket; import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.ProudSkillChangeNotifyOuterClass.ProudSkillChangeNotify; import emu.grasscutter.net.proto.ProudSkillChangeNotifyOuterClass.ProudSkillChangeNotify;
public class PacketProudSkillChangeNotify extends GenshinPacket { public class PacketProudSkillChangeNotify extends BasePacket {
public PacketProudSkillChangeNotify(GenshinAvatar avatar) { public PacketProudSkillChangeNotify(Avatar avatar) {
super(PacketOpcodes.ProudSkillChangeNotify); super(PacketOpcodes.ProudSkillChangeNotify);
ProudSkillChangeNotify proto = ProudSkillChangeNotify.newBuilder() ProudSkillChangeNotify proto = ProudSkillChangeNotify.newBuilder()
......
package emu.grasscutter.server.packet.send; package emu.grasscutter.server.packet.send;
import emu.grasscutter.game.avatar.GenshinAvatar; import emu.grasscutter.game.avatar.Avatar;
import emu.grasscutter.net.packet.GenshinPacket; import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.ProudSkillExtraLevelNotifyOuterClass.ProudSkillExtraLevelNotify; import emu.grasscutter.net.proto.ProudSkillExtraLevelNotifyOuterClass.ProudSkillExtraLevelNotify;
public class PacketProudSkillExtraLevelNotify extends GenshinPacket { public class PacketProudSkillExtraLevelNotify extends BasePacket {
public PacketProudSkillExtraLevelNotify(GenshinAvatar avatar, int talentIndex) { public PacketProudSkillExtraLevelNotify(Avatar avatar, int talentIndex) {
super(PacketOpcodes.ProudSkillExtraLevelNotify); super(PacketOpcodes.ProudSkillExtraLevelNotify);
ProudSkillExtraLevelNotify proto = ProudSkillExtraLevelNotify.newBuilder() ProudSkillExtraLevelNotify proto = ProudSkillExtraLevelNotify.newBuilder()
......
package emu.grasscutter.server.packet.send; package emu.grasscutter.server.packet.send;
import emu.grasscutter.net.packet.GenshinPacket; import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.PullPrivateChatRspOuterClass.PullPrivateChatRsp; import emu.grasscutter.net.proto.PullPrivateChatRspOuterClass.PullPrivateChatRsp;
public class PacketPullPrivateChatRsp extends GenshinPacket { public class PacketPullPrivateChatRsp extends BasePacket {
public PacketPullPrivateChatRsp() { public PacketPullPrivateChatRsp() {
super(PacketOpcodes.PullPrivateChatRsp); super(PacketOpcodes.PullPrivateChatRsp);
......
package emu.grasscutter.server.packet.send; package emu.grasscutter.server.packet.send;
import emu.grasscutter.Config.GameServerOptions; import emu.grasscutter.Config.GameServerOptions;
import emu.grasscutter.GenshinConstants; import emu.grasscutter.game.player.Player;
import emu.grasscutter.GameConstants;
import emu.grasscutter.Grasscutter; import emu.grasscutter.Grasscutter;
import emu.grasscutter.game.GenshinPlayer; import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.GenshinPacket;
import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.ChatInfoOuterClass.ChatInfo; import emu.grasscutter.net.proto.ChatInfoOuterClass.ChatInfo;
import emu.grasscutter.net.proto.PullRecentChatRspOuterClass.PullRecentChatRsp; import emu.grasscutter.net.proto.PullRecentChatRspOuterClass.PullRecentChatRsp;
import emu.grasscutter.utils.Utils; import emu.grasscutter.utils.Utils;
public class PacketPullRecentChatRsp extends GenshinPacket { public class PacketPullRecentChatRsp extends BasePacket {
public PacketPullRecentChatRsp(GenshinPlayer player) { public PacketPullRecentChatRsp(Player player) {
super(PacketOpcodes.PullRecentChatRsp); super(PacketOpcodes.PullRecentChatRsp);
GameServerOptions serverOptions = Grasscutter.getConfig().getGameServerOptions(); GameServerOptions serverOptions = Grasscutter.getConfig().getGameServerOptions();
...@@ -20,7 +20,7 @@ public class PacketPullRecentChatRsp extends GenshinPacket { ...@@ -20,7 +20,7 @@ public class PacketPullRecentChatRsp extends GenshinPacket {
if (serverOptions.WelcomeEmotes != null && serverOptions.WelcomeEmotes.length > 0) { if (serverOptions.WelcomeEmotes != null && serverOptions.WelcomeEmotes.length > 0) {
ChatInfo welcomeEmote = ChatInfo.newBuilder() ChatInfo welcomeEmote = ChatInfo.newBuilder()
.setTime((int) (System.currentTimeMillis() / 1000)) .setTime((int) (System.currentTimeMillis() / 1000))
.setUid(GenshinConstants.SERVER_CONSOLE_UID) .setUid(GameConstants.SERVER_CONSOLE_UID)
.setToUid(player.getUid()) .setToUid(player.getUid())
.setIcon(serverOptions.WelcomeEmotes[Utils.randomRange(0, serverOptions.WelcomeEmotes.length - 1)]) .setIcon(serverOptions.WelcomeEmotes[Utils.randomRange(0, serverOptions.WelcomeEmotes.length - 1)])
.build(); .build();
...@@ -31,7 +31,7 @@ public class PacketPullRecentChatRsp extends GenshinPacket { ...@@ -31,7 +31,7 @@ public class PacketPullRecentChatRsp extends GenshinPacket {
if (serverOptions.WelcomeMotd != null && serverOptions.WelcomeMotd.length() > 0) { if (serverOptions.WelcomeMotd != null && serverOptions.WelcomeMotd.length() > 0) {
ChatInfo welcomeMotd = ChatInfo.newBuilder() ChatInfo welcomeMotd = ChatInfo.newBuilder()
.setTime((int) (System.currentTimeMillis() / 1000)) .setTime((int) (System.currentTimeMillis() / 1000))
.setUid(GenshinConstants.SERVER_CONSOLE_UID) .setUid(GameConstants.SERVER_CONSOLE_UID)
.setToUid(player.getUid()) .setToUid(player.getUid())
.setText(Grasscutter.getConfig().getGameServerOptions().WelcomeMotd) .setText(Grasscutter.getConfig().getGameServerOptions().WelcomeMotd)
.build(); .build();
......
...@@ -2,14 +2,14 @@ package emu.grasscutter.server.packet.send; ...@@ -2,14 +2,14 @@ package emu.grasscutter.server.packet.send;
import java.util.List; import java.util.List;
import emu.grasscutter.game.inventory.GenshinItem; import emu.grasscutter.game.inventory.GameItem;
import emu.grasscutter.net.packet.GenshinPacket; import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.ReliquaryUpgradeRspOuterClass.ReliquaryUpgradeRsp; import emu.grasscutter.net.proto.ReliquaryUpgradeRspOuterClass.ReliquaryUpgradeRsp;
public class PacketReliquaryUpgradeRsp extends GenshinPacket { public class PacketReliquaryUpgradeRsp extends BasePacket {
public PacketReliquaryUpgradeRsp(GenshinItem relic, int rate, int oldLevel, List<Integer> oldAppendPropIdList) { public PacketReliquaryUpgradeRsp(GameItem relic, int rate, int oldLevel, List<Integer> oldAppendPropIdList) {
super(PacketOpcodes.ReliquaryUpgradeRsp); super(PacketOpcodes.ReliquaryUpgradeRsp);
ReliquaryUpgradeRsp proto = ReliquaryUpgradeRsp.newBuilder() ReliquaryUpgradeRsp proto = ReliquaryUpgradeRsp.newBuilder()
......
package emu.grasscutter.server.packet.send; package emu.grasscutter.server.packet.send;
import emu.grasscutter.game.GenshinPlayer; import emu.grasscutter.game.player.Player;
import emu.grasscutter.game.World; import emu.grasscutter.game.world.World;
import emu.grasscutter.net.packet.GenshinPacket; import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.SceneAreaWeatherNotifyOuterClass.SceneAreaWeatherNotify; import emu.grasscutter.net.proto.SceneAreaWeatherNotifyOuterClass.SceneAreaWeatherNotify;
public class PacketSceneAreaWeatherNotify extends GenshinPacket { public class PacketSceneAreaWeatherNotify extends BasePacket {
public PacketSceneAreaWeatherNotify(GenshinPlayer player) { public PacketSceneAreaWeatherNotify(Player player) {
super(PacketOpcodes.SceneAreaWeatherNotify); super(PacketOpcodes.SceneAreaWeatherNotify);
SceneAreaWeatherNotify proto = SceneAreaWeatherNotify.newBuilder() SceneAreaWeatherNotify proto = SceneAreaWeatherNotify.newBuilder()
......
...@@ -2,26 +2,26 @@ package emu.grasscutter.server.packet.send; ...@@ -2,26 +2,26 @@ package emu.grasscutter.server.packet.send;
import java.util.Collection; import java.util.Collection;
import emu.grasscutter.game.GenshinPlayer; import emu.grasscutter.game.entity.GameEntity;
import emu.grasscutter.game.entity.GenshinEntity; import emu.grasscutter.game.player.Player;
import emu.grasscutter.net.packet.GenshinPacket; import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.SceneEntityAppearNotifyOuterClass.SceneEntityAppearNotify; import emu.grasscutter.net.proto.SceneEntityAppearNotifyOuterClass.SceneEntityAppearNotify;
import emu.grasscutter.net.proto.VisionTypeOuterClass.VisionType; import emu.grasscutter.net.proto.VisionTypeOuterClass.VisionType;
public class PacketSceneEntityAppearNotify extends GenshinPacket { public class PacketSceneEntityAppearNotify extends BasePacket {
public PacketSceneEntityAppearNotify(GenshinEntity entity) { public PacketSceneEntityAppearNotify(GameEntity entity) {
super(PacketOpcodes.SceneEntityAppearNotify, true); super(PacketOpcodes.SceneEntityAppearNotify, true);
SceneEntityAppearNotify.Builder proto = SceneEntityAppearNotify.newBuilder() SceneEntityAppearNotify.Builder proto = SceneEntityAppearNotify.newBuilder()
.setAppearType(VisionType.VisionBorn) .setAppearType(VisionType.VISION_BORN)
.addEntityList(entity.toProto()); .addEntityList(entity.toProto());
this.setData(proto.build()); this.setData(proto.build());
} }
public PacketSceneEntityAppearNotify(GenshinEntity entity, VisionType vision, int param) { public PacketSceneEntityAppearNotify(GameEntity entity, VisionType vision, int param) {
super(PacketOpcodes.SceneEntityAppearNotify, true); super(PacketOpcodes.SceneEntityAppearNotify, true);
SceneEntityAppearNotify.Builder proto = SceneEntityAppearNotify.newBuilder() SceneEntityAppearNotify.Builder proto = SceneEntityAppearNotify.newBuilder()
...@@ -32,11 +32,11 @@ public class PacketSceneEntityAppearNotify extends GenshinPacket { ...@@ -32,11 +32,11 @@ public class PacketSceneEntityAppearNotify extends GenshinPacket {
this.setData(proto.build()); this.setData(proto.build());
} }
public PacketSceneEntityAppearNotify(GenshinPlayer player) { public PacketSceneEntityAppearNotify(Player player) {
this(player.getTeamManager().getCurrentAvatarEntity()); this(player.getTeamManager().getCurrentAvatarEntity());
} }
public PacketSceneEntityAppearNotify(Collection<GenshinEntity> entities, VisionType visionType) { public PacketSceneEntityAppearNotify(Collection<GameEntity> entities, VisionType visionType) {
super(PacketOpcodes.SceneEntityAppearNotify, true); super(PacketOpcodes.SceneEntityAppearNotify, true);
SceneEntityAppearNotify.Builder proto = SceneEntityAppearNotify.newBuilder() SceneEntityAppearNotify.Builder proto = SceneEntityAppearNotify.newBuilder()
......
...@@ -3,15 +3,15 @@ package emu.grasscutter.server.packet.send; ...@@ -3,15 +3,15 @@ package emu.grasscutter.server.packet.send;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
import emu.grasscutter.game.entity.GenshinEntity; import emu.grasscutter.game.entity.GameEntity;
import emu.grasscutter.net.packet.GenshinPacket; import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.SceneEntityDisappearNotifyOuterClass.SceneEntityDisappearNotify; import emu.grasscutter.net.proto.SceneEntityDisappearNotifyOuterClass.SceneEntityDisappearNotify;
import emu.grasscutter.net.proto.VisionTypeOuterClass.VisionType; import emu.grasscutter.net.proto.VisionTypeOuterClass.VisionType;
public class PacketSceneEntityDisappearNotify extends GenshinPacket { public class PacketSceneEntityDisappearNotify extends BasePacket {
public PacketSceneEntityDisappearNotify(GenshinEntity entity, VisionType disappearType) { public PacketSceneEntityDisappearNotify(GameEntity entity, VisionType disappearType) {
super(PacketOpcodes.SceneEntityDisappearNotify); super(PacketOpcodes.SceneEntityDisappearNotify);
SceneEntityDisappearNotify proto = SceneEntityDisappearNotify.newBuilder() SceneEntityDisappearNotify proto = SceneEntityDisappearNotify.newBuilder()
...@@ -22,7 +22,7 @@ public class PacketSceneEntityDisappearNotify extends GenshinPacket { ...@@ -22,7 +22,7 @@ public class PacketSceneEntityDisappearNotify extends GenshinPacket {
this.setData(proto); this.setData(proto);
} }
public PacketSceneEntityDisappearNotify(Collection<GenshinEntity> entities, VisionType disappearType) { public PacketSceneEntityDisappearNotify(Collection<GameEntity> entities, VisionType disappearType) {
super(PacketOpcodes.SceneEntityDisappearNotify); super(PacketOpcodes.SceneEntityDisappearNotify);
SceneEntityDisappearNotify.Builder proto = SceneEntityDisappearNotify.newBuilder() SceneEntityDisappearNotify.Builder proto = SceneEntityDisappearNotify.newBuilder()
......
package emu.grasscutter.server.packet.send;
import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.SceneEntityDrownRspOuterClass.SceneEntityDrownRsp;
public class PacketSceneEntityDrownRsp extends BasePacket {
public PacketSceneEntityDrownRsp(int entityId) {
super(PacketOpcodes.SceneEntityDrownRsp);
SceneEntityDrownRsp proto = SceneEntityDrownRsp.newBuilder().setEntityId(entityId).build();
this.setData(proto);
}
}
package emu.grasscutter.server.packet.send; package emu.grasscutter.server.packet.send;
import emu.grasscutter.net.packet.GenshinPacket; import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.EntityMoveInfoOuterClass.EntityMoveInfo; import emu.grasscutter.net.proto.EntityMoveInfoOuterClass.EntityMoveInfo;
import emu.grasscutter.net.proto.SceneEntityMoveNotifyOuterClass.SceneEntityMoveNotify; import emu.grasscutter.net.proto.SceneEntityMoveNotifyOuterClass.SceneEntityMoveNotify;
public class PacketSceneEntityMoveNotify extends GenshinPacket { public class PacketSceneEntityMoveNotify extends BasePacket {
public PacketSceneEntityMoveNotify(EntityMoveInfo moveInfo) { public PacketSceneEntityMoveNotify(EntityMoveInfo moveInfo) {
super(PacketOpcodes.SceneEntityMoveNotify, true); super(PacketOpcodes.SceneEntityMoveNotify, true);
......
package emu.grasscutter.server.packet.send; package emu.grasscutter.server.packet.send;
import emu.grasscutter.game.GenshinPlayer; import emu.grasscutter.game.player.Player;
import emu.grasscutter.net.packet.GenshinPacket; import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.SceneInitFinishRspOuterClass.SceneInitFinishRsp; import emu.grasscutter.net.proto.SceneInitFinishRspOuterClass.SceneInitFinishRsp;
public class PacketSceneInitFinishRsp extends GenshinPacket { public class PacketSceneInitFinishRsp extends BasePacket {
public PacketSceneInitFinishRsp(GenshinPlayer player) { public PacketSceneInitFinishRsp(Player player) {
super(PacketOpcodes.SceneInitFinishRsp, 11); super(PacketOpcodes.SceneInitFinishRsp, 11);
SceneInitFinishRsp p = SceneInitFinishRsp.newBuilder().setEnterSceneToken(player.getEnterSceneToken()).build(); SceneInitFinishRsp p = SceneInitFinishRsp.newBuilder().setEnterSceneToken(player.getEnterSceneToken()).build();
......
package emu.grasscutter.server.packet.send; package emu.grasscutter.server.packet.send;
import emu.grasscutter.net.packet.GenshinPacket; import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.RetcodeOuterClass;
import emu.grasscutter.net.proto.SceneKickPlayerRspOuterClass.SceneKickPlayerRsp; import emu.grasscutter.net.proto.SceneKickPlayerRspOuterClass.SceneKickPlayerRsp;
public class PacketSceneKickPlayerRsp extends GenshinPacket { public class PacketSceneKickPlayerRsp extends BasePacket {
public PacketSceneKickPlayerRsp(int targetUid) { public PacketSceneKickPlayerRsp(int targetUid) {
super(PacketOpcodes.SceneKickPlayerRsp); super(PacketOpcodes.SceneKickPlayerRsp);
...@@ -20,7 +21,7 @@ public class PacketSceneKickPlayerRsp extends GenshinPacket { ...@@ -20,7 +21,7 @@ public class PacketSceneKickPlayerRsp extends GenshinPacket {
super(PacketOpcodes.SceneKickPlayerRsp); super(PacketOpcodes.SceneKickPlayerRsp);
SceneKickPlayerRsp proto = SceneKickPlayerRsp.newBuilder() SceneKickPlayerRsp proto = SceneKickPlayerRsp.newBuilder()
.setRetcode(1) .setRetcode(RetcodeOuterClass.Retcode.RET_SVR_ERROR_VALUE)
.build(); .build();
this.setData(proto); this.setData(proto);
......
package emu.grasscutter.server.packet.send; package emu.grasscutter.server.packet.send;
import emu.grasscutter.game.GenshinPlayer; import emu.grasscutter.game.player.Player;
import emu.grasscutter.game.World; import emu.grasscutter.game.world.World;
import emu.grasscutter.net.packet.GenshinPacket; import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.ScenePlayerInfoNotifyOuterClass.ScenePlayerInfoNotify; import emu.grasscutter.net.proto.ScenePlayerInfoNotifyOuterClass.ScenePlayerInfoNotify;
import emu.grasscutter.net.proto.ScenePlayerInfoOuterClass.ScenePlayerInfo; import emu.grasscutter.net.proto.ScenePlayerInfoOuterClass.ScenePlayerInfo;
public class PacketScenePlayerInfoNotify extends GenshinPacket { public class PacketScenePlayerInfoNotify extends BasePacket {
public PacketScenePlayerInfoNotify(World world) { public PacketScenePlayerInfoNotify(World world) {
super(PacketOpcodes.ScenePlayerInfoNotify); super(PacketOpcodes.ScenePlayerInfoNotify);
...@@ -15,7 +15,7 @@ public class PacketScenePlayerInfoNotify extends GenshinPacket { ...@@ -15,7 +15,7 @@ public class PacketScenePlayerInfoNotify extends GenshinPacket {
ScenePlayerInfoNotify.Builder proto = ScenePlayerInfoNotify.newBuilder(); ScenePlayerInfoNotify.Builder proto = ScenePlayerInfoNotify.newBuilder();
for (int i = 0; i < world.getPlayers().size(); i++) { for (int i = 0; i < world.getPlayers().size(); i++) {
GenshinPlayer p = world.getPlayers().get(i); Player p = world.getPlayers().get(i);
ScenePlayerInfo pInfo = ScenePlayerInfo.newBuilder() ScenePlayerInfo pInfo = ScenePlayerInfo.newBuilder()
.setUid(p.getUid()) .setUid(p.getUid())
......
package emu.grasscutter.server.packet.send; package emu.grasscutter.server.packet.send;
import emu.grasscutter.game.GenshinPlayer; import emu.grasscutter.game.player.Player;
import emu.grasscutter.game.GenshinScene; import emu.grasscutter.game.world.Scene;
import emu.grasscutter.net.packet.GenshinPacket; import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.ScenePlayerLocationNotifyOuterClass.ScenePlayerLocationNotify; import emu.grasscutter.net.proto.ScenePlayerLocationNotifyOuterClass.ScenePlayerLocationNotify;
public class PacketScenePlayerLocationNotify extends GenshinPacket { public class PacketScenePlayerLocationNotify extends BasePacket {
public PacketScenePlayerLocationNotify(GenshinScene scene) { public PacketScenePlayerLocationNotify(Scene scene) {
super(PacketOpcodes.ScenePlayerLocationNotify); super(PacketOpcodes.ScenePlayerLocationNotify);
ScenePlayerLocationNotify.Builder proto = ScenePlayerLocationNotify.newBuilder() ScenePlayerLocationNotify.Builder proto = ScenePlayerLocationNotify.newBuilder()
.setSceneId(scene.getId()); .setSceneId(scene.getId());
for (GenshinPlayer p : scene.getPlayers()) { for (Player p : scene.getPlayers()) {
proto.addPlayerLocList(p.getPlayerLocationInfo()); proto.addPlayerLocList(p.getPlayerLocationInfo());
} }
......
package emu.grasscutter.server.packet.send; package emu.grasscutter.server.packet.send;
import emu.grasscutter.game.GenshinPlayer;
import emu.grasscutter.game.entity.EntityAvatar; import emu.grasscutter.game.entity.EntityAvatar;
import emu.grasscutter.net.packet.GenshinPacket; import emu.grasscutter.game.player.Player;
import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.AbilitySyncStateInfoOuterClass.AbilitySyncStateInfo; import emu.grasscutter.net.proto.AbilitySyncStateInfoOuterClass.AbilitySyncStateInfo;
import emu.grasscutter.net.proto.SceneTeamAvatarOuterClass.SceneTeamAvatar; import emu.grasscutter.net.proto.SceneTeamAvatarOuterClass.SceneTeamAvatar;
import emu.grasscutter.net.proto.SceneTeamUpdateNotifyOuterClass.SceneTeamUpdateNotify; import emu.grasscutter.net.proto.SceneTeamUpdateNotifyOuterClass.SceneTeamUpdateNotify;
public class PacketSceneTeamUpdateNotify extends GenshinPacket { public class PacketSceneTeamUpdateNotify extends BasePacket {
public PacketSceneTeamUpdateNotify(GenshinPlayer player) { public PacketSceneTeamUpdateNotify(Player player) {
super(PacketOpcodes.SceneTeamUpdateNotify); super(PacketOpcodes.SceneTeamUpdateNotify);
SceneTeamUpdateNotify.Builder proto = SceneTeamUpdateNotify.newBuilder() SceneTeamUpdateNotify.Builder proto = SceneTeamUpdateNotify.newBuilder()
.setIsInMp(player.getWorld().isMultiplayer()); .setIsInMp(player.getWorld().isMultiplayer());
for (GenshinPlayer p : player.getWorld().getPlayers()) { for (Player p : player.getWorld().getPlayers()) {
for (EntityAvatar entityAvatar : p.getTeamManager().getActiveTeam()) { for (EntityAvatar entityAvatar : p.getTeamManager().getActiveTeam()) {
SceneTeamAvatar.Builder avatarProto = SceneTeamAvatar.newBuilder() SceneTeamAvatar.Builder avatarProto = SceneTeamAvatar.newBuilder()
.setPlayerId(p.getUid()) .setPlayerUid(p.getUid())
.setAvatarGuid(entityAvatar.getAvatar().getGuid()) .setAvatarGuid(entityAvatar.getAvatar().getGuid())
.setSceneId(p.getSceneId()) .setSceneId(p.getSceneId())
.setEntityId(entityAvatar.getId()) .setEntityId(entityAvatar.getId())
......
package emu.grasscutter.server.packet.send; package emu.grasscutter.server.packet.send;
import emu.grasscutter.game.GenshinPlayer; import emu.grasscutter.game.player.Player;
import emu.grasscutter.net.packet.GenshinPacket; import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.SceneTimeNotifyOuterClass.SceneTimeNotify; import emu.grasscutter.net.proto.SceneTimeNotifyOuterClass.SceneTimeNotify;
public class PacketSceneTimeNotify extends GenshinPacket { public class PacketSceneTimeNotify extends BasePacket {
public PacketSceneTimeNotify(GenshinPlayer player) { public PacketSceneTimeNotify(Player player) {
super(PacketOpcodes.SceneTimeNotify); super(PacketOpcodes.SceneTimeNotify);
SceneTimeNotify proto = SceneTimeNotify.newBuilder() SceneTimeNotify proto = SceneTimeNotify.newBuilder()
......
package emu.grasscutter.server.packet.send; package emu.grasscutter.server.packet.send;
import emu.grasscutter.data.GenshinData; import emu.grasscutter.data.GameData;
import emu.grasscutter.data.custom.ScenePointEntry; import emu.grasscutter.data.custom.ScenePointEntry;
import emu.grasscutter.game.GenshinPlayer; import emu.grasscutter.game.player.Player;
import emu.grasscutter.net.packet.GenshinPacket; import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.RetcodeOuterClass;
import emu.grasscutter.net.proto.SceneTransToPointRspOuterClass.SceneTransToPointRsp; import emu.grasscutter.net.proto.SceneTransToPointRspOuterClass.SceneTransToPointRsp;
import emu.grasscutter.utils.Position; import emu.grasscutter.utils.Position;
public class PacketSceneTransToPointRsp extends GenshinPacket { public class PacketSceneTransToPointRsp extends BasePacket {
public PacketSceneTransToPointRsp(GenshinPlayer player, int pointId, int sceneId) { public PacketSceneTransToPointRsp(Player player, int pointId, int sceneId) {
super(PacketOpcodes.SceneTransToPointRsp); super(PacketOpcodes.SceneTransToPointRsp);
SceneTransToPointRsp proto = SceneTransToPointRsp.newBuilder() SceneTransToPointRsp proto = SceneTransToPointRsp.newBuilder()
...@@ -26,7 +27,7 @@ public class PacketSceneTransToPointRsp extends GenshinPacket { ...@@ -26,7 +27,7 @@ public class PacketSceneTransToPointRsp extends GenshinPacket {
super(PacketOpcodes.SceneTransToPointRsp); super(PacketOpcodes.SceneTransToPointRsp);
SceneTransToPointRsp proto = SceneTransToPointRsp.newBuilder() SceneTransToPointRsp proto = SceneTransToPointRsp.newBuilder()
.setRetcode(1) // Internal server error .setRetcode(RetcodeOuterClass.Retcode.RET_SVR_ERROR_VALUE) // Internal server error
.build(); .build();
this.setData(proto); this.setData(proto);
......
package emu.grasscutter.server.packet.send; package emu.grasscutter.server.packet.send;
import emu.grasscutter.net.packet.GenshinPacket; import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.SceneUnlockInfoNotifyOuterClass.SceneUnlockInfoNotify; import emu.grasscutter.net.proto.SceneUnlockInfoNotifyOuterClass.SceneUnlockInfoNotify;
import emu.grasscutter.net.proto.SceneUnlockInfoOuterClass.SceneUnlockInfo; import emu.grasscutter.net.proto.SceneUnlockInfoOuterClass.SceneUnlockInfo;
public class PacketSceneUnlockInfoNotify extends GenshinPacket { public class PacketSceneUnlockInfoNotify extends BasePacket {
public PacketSceneUnlockInfoNotify() { public PacketSceneUnlockInfoNotify() {
super(PacketOpcodes.SceneUnlockInfoNotify); // Rename opcode later super(PacketOpcodes.SceneUnlockInfoNotify); // Rename opcode later
......
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