Commit 7254fe16 authored by Melledy's avatar Melledy
Browse files

Set `setChooseAvatarGuid` properly

parent 0d17c4a0
......@@ -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());
}
......
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