mirror of
https://github.com/Melledy/Grasscutter.git
synced 2024-11-25 20:56:28 +00:00
Set setChooseAvatarGuid
properly
This commit is contained in:
parent
0d17c4a088
commit
7254fe1612
@ -642,6 +642,9 @@ public class Player {
|
||||
}
|
||||
|
||||
public void setMainCharacterId(int mainCharacterId) {
|
||||
if (this.mainCharacterId != 0) {
|
||||
return;
|
||||
}
|
||||
this.mainCharacterId = mainCharacterId;
|
||||
}
|
||||
|
||||
|
@ -13,11 +13,11 @@ import emu.grasscutter.net.proto.AvatarTeamOuterClass.AvatarTeam;
|
||||
public class PacketAvatarDataNotify extends BasePacket {
|
||||
|
||||
public PacketAvatarDataNotify(Player player) {
|
||||
super(PacketOpcodes.AvatarDataNotify, 2);
|
||||
super(PacketOpcodes.AvatarDataNotify, true);
|
||||
|
||||
AvatarDataNotify.Builder proto = AvatarDataNotify.newBuilder()
|
||||
.setCurAvatarTeamId(player.getTeamManager().getCurrentTeamId())
|
||||
.setChooseAvatarGuid(player.getTeamManager().getCurrentCharacterGuid())
|
||||
//.setChooseAvatarGuid(player.getTeamManager().getCurrentCharacterGuid())
|
||||
.addAllOwnedFlycloakList(player.getFlyCloakList())
|
||||
.addAllOwnedCostumeList(player.getCostumeList());
|
||||
|
||||
@ -38,6 +38,12 @@ public class PacketAvatarDataNotify extends BasePacket {
|
||||
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());
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user