Custom Teams (#1731)

* Add support for creating and deleting custom teams.

* Add support for creating and deleting custom teams.

* Move some logic to TeamInfo::toProto
This commit is contained in:
GanyusLeftHorn
2022-09-01 02:21:47 +02:00
committed by GitHub
parent 4f015c1077
commit 712d17631f
17 changed files with 3678 additions and 125 deletions

View File

@@ -7,6 +7,7 @@ import java.util.List;
import dev.morphia.annotations.Entity;
import emu.grasscutter.game.avatar.Avatar;
import emu.grasscutter.net.proto.AvatarTeamOuterClass.AvatarTeam;
@Entity
public class TeamInfo {
@@ -81,4 +82,16 @@ public class TeamInfo {
this.getAvatars().add(id);
}
}
public AvatarTeam toProto(Player player) {
AvatarTeam.Builder avatarTeam = AvatarTeam.newBuilder()
.setTeamName(this.getName());
for (int i = 0; i < this.getAvatars().size(); i++) {
Avatar avatar = player.getAvatars().getAvatarById(this.getAvatars().get(i));
avatarTeam.addAvatarGuidList(avatar.getGuid());
}
return avatarTeam.build();
}
}