2022-04-17 12:43:07 +00:00
|
|
|
package emu.grasscutter.server.packet.send;
|
|
|
|
|
|
|
|
import emu.grasscutter.game.entity.EntityAvatar;
|
2022-04-27 04:21:57 +00:00
|
|
|
import emu.grasscutter.game.inventory.GameItem;
|
2022-04-27 04:24:25 +00:00
|
|
|
import emu.grasscutter.game.player.Player;
|
2022-04-27 04:21:57 +00:00
|
|
|
import emu.grasscutter.net.packet.BasePacket;
|
2022-04-17 12:43:07 +00:00
|
|
|
import emu.grasscutter.net.packet.PacketOpcodes;
|
2022-04-26 21:44:30 +00:00
|
|
|
import emu.grasscutter.net.proto.AbilityControlBlockOuterClass;
|
2022-04-17 12:43:07 +00:00
|
|
|
import emu.grasscutter.net.proto.AbilitySyncStateInfoOuterClass.AbilitySyncStateInfo;
|
|
|
|
import emu.grasscutter.net.proto.AvatarEnterSceneInfoOuterClass.AvatarEnterSceneInfo;
|
|
|
|
import emu.grasscutter.net.proto.MPLevelEntityInfoOuterClass.MPLevelEntityInfo;
|
|
|
|
import emu.grasscutter.net.proto.PlayerEnterSceneInfoNotifyOuterClass.PlayerEnterSceneInfoNotify;
|
|
|
|
import emu.grasscutter.net.proto.TeamEnterSceneInfoOuterClass.TeamEnterSceneInfo;
|
|
|
|
|
2022-04-27 04:21:57 +00:00
|
|
|
public class PacketPlayerEnterSceneInfoNotify extends BasePacket {
|
2022-04-17 12:43:07 +00:00
|
|
|
|
2022-04-27 04:21:57 +00:00
|
|
|
public PacketPlayerEnterSceneInfoNotify(Player player) {
|
2022-04-17 12:43:07 +00:00
|
|
|
super(PacketOpcodes.PlayerEnterSceneInfoNotify);
|
|
|
|
|
|
|
|
AbilitySyncStateInfo empty = AbilitySyncStateInfo.newBuilder().build();
|
|
|
|
|
|
|
|
PlayerEnterSceneInfoNotify.Builder proto = PlayerEnterSceneInfoNotify.newBuilder()
|
|
|
|
.setCurAvatarEntityId(player.getTeamManager().getCurrentAvatarEntity().getId())
|
|
|
|
.setEnterSceneToken(player.getEnterSceneToken());
|
|
|
|
|
|
|
|
proto.setTeamEnterInfo(
|
|
|
|
TeamEnterSceneInfo.newBuilder()
|
|
|
|
.setTeamEntityId(player.getTeamManager().getEntityId()) // 150995833
|
|
|
|
.setTeamAbilityInfo(empty)
|
2022-04-26 21:44:30 +00:00
|
|
|
.setAbilityControlBlock(AbilityControlBlockOuterClass.AbilityControlBlock.newBuilder().build())
|
2022-04-17 12:43:07 +00:00
|
|
|
);
|
|
|
|
proto.setMpLevelEntityInfo(
|
|
|
|
MPLevelEntityInfo.newBuilder()
|
|
|
|
.setEntityId(player.getWorld().getLevelEntityId()) // 184550274
|
|
|
|
.setAuthorityPeerId(player.getWorld().getHostPeerId())
|
|
|
|
.setAbilityInfo(empty)
|
|
|
|
);
|
|
|
|
|
|
|
|
for (EntityAvatar avatarEntity : player.getTeamManager().getActiveTeam()) {
|
2022-04-27 04:21:57 +00:00
|
|
|
GameItem weapon = avatarEntity.getAvatar().getWeapon();
|
2022-04-17 12:43:07 +00:00
|
|
|
long weaponGuid = weapon != null ? weapon.getGuid() : 0;
|
|
|
|
|
|
|
|
AvatarEnterSceneInfo avatarInfo = AvatarEnterSceneInfo.newBuilder()
|
|
|
|
.setAvatarGuid(avatarEntity.getAvatar().getGuid())
|
|
|
|
.setAvatarEntityId(avatarEntity.getId())
|
|
|
|
.setWeaponGuid(weaponGuid)
|
|
|
|
.setWeaponEntityId(avatarEntity.getWeaponEntityId())
|
|
|
|
.setAvatarAbilityInfo(empty)
|
|
|
|
.setWeaponAbilityInfo(empty)
|
|
|
|
.build();
|
|
|
|
|
|
|
|
proto.addAvatarEnterInfo(avatarInfo);
|
|
|
|
}
|
|
|
|
|
|
|
|
this.setData(proto.build());
|
|
|
|
}
|
|
|
|
}
|