2022-04-17 12:43:07 +00:00
|
|
|
package emu.grasscutter.server.packet.send;
|
|
|
|
|
2022-04-27 04:21:57 +00:00
|
|
|
import emu.grasscutter.game.Player;
|
|
|
|
import emu.grasscutter.net.packet.BasePacket;
|
2022-04-17 12:43:07 +00:00
|
|
|
import emu.grasscutter.net.packet.PacketOpcodes;
|
|
|
|
import emu.grasscutter.net.proto.AbilitySyncStateInfoOuterClass.AbilitySyncStateInfo;
|
|
|
|
import emu.grasscutter.net.proto.SyncTeamEntityNotifyOuterClass.SyncTeamEntityNotify;
|
|
|
|
import emu.grasscutter.net.proto.TeamEntityInfoOuterClass.TeamEntityInfo;
|
|
|
|
|
2022-04-27 04:21:57 +00:00
|
|
|
public class PacketSyncTeamEntityNotify extends BasePacket {
|
2022-04-17 12:43:07 +00:00
|
|
|
|
2022-04-27 04:21:57 +00:00
|
|
|
public PacketSyncTeamEntityNotify(Player player) {
|
2022-04-17 12:43:07 +00:00
|
|
|
super(PacketOpcodes.SyncTeamEntityNotify);
|
|
|
|
|
|
|
|
SyncTeamEntityNotify.Builder proto = SyncTeamEntityNotify.newBuilder()
|
|
|
|
.setSceneId(player.getSceneId());
|
|
|
|
|
|
|
|
if (player.getWorld().isMultiplayer()) {
|
2022-04-27 04:21:57 +00:00
|
|
|
for (Player p : player.getWorld().getPlayers()) {
|
2022-04-17 12:43:07 +00:00
|
|
|
// Skip if same player
|
|
|
|
if (player == p) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Set info
|
|
|
|
TeamEntityInfo info = TeamEntityInfo.newBuilder()
|
|
|
|
.setTeamEntityId(p.getTeamManager().getEntityId())
|
|
|
|
.setAuthorityPeerId(p.getPeerId())
|
|
|
|
.setTeamAbilityInfo(AbilitySyncStateInfo.newBuilder())
|
|
|
|
.build();
|
|
|
|
|
|
|
|
proto.addTeamEntityInfoList(info);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
this.setData(proto);
|
|
|
|
}
|
|
|
|
}
|