Update friend list info packet

This commit is contained in:
Melledy
2024-05-08 02:26:19 -07:00
parent 707b73a9d7
commit ee17afeb67
2 changed files with 13 additions and 2 deletions

View File

@@ -47,7 +47,6 @@ import emu.lunarcore.game.scene.Scene;
import emu.lunarcore.game.scene.SceneBuff;
import emu.lunarcore.game.scene.entity.EntityProp;
import emu.lunarcore.game.scene.entity.GameEntity;
import emu.lunarcore.proto.AssistSimpleInfoOuterClass.AssistSimpleInfo;
import emu.lunarcore.proto.BoardDataSyncOuterClass.BoardDataSync;
import emu.lunarcore.proto.FriendOnlineStatusOuterClass.FriendOnlineStatus;
import emu.lunarcore.proto.HeadIconOuterClass.HeadIcon;
@@ -950,7 +949,6 @@ public class Player implements Tickable {
.setOnlineStatus(this.isOnline() ? FriendOnlineStatus.FRIEND_ONLINE_STATUS_ONLINE : FriendOnlineStatus.FRIEND_ONLINE_STATUS_OFFLINE)
.setPlatformType(PlatformType.PC)
.setLastActiveTime(this.getLastActiveTime())
.addAssistSimpleInfo(AssistSimpleInfo.newInstance().setAvatarId(GameConstants.TRAILBLAZER_AVATAR_ID).setLevel(1)) // TODO
.setHeadIcon(this.getHeadIcon());
return proto;

View File

@@ -8,6 +8,7 @@ import emu.lunarcore.proto.FriendListInfoOuterClass.FriendListInfo;
import emu.lunarcore.proto.FriendOnlineStatusOuterClass.FriendOnlineStatus;
import emu.lunarcore.proto.GetFriendListInfoScRspOuterClass.GetFriendListInfoScRsp;
import emu.lunarcore.proto.PlatformTypeOuterClass.PlatformType;
import emu.lunarcore.proto.PlayingStateOuterClass.PlayingState;
import emu.lunarcore.proto.SimpleInfoOuterClass.SimpleInfo;
import emu.lunarcore.server.packet.BasePacket;
import emu.lunarcore.server.packet.CmdId;
@@ -39,9 +40,21 @@ public class PacketGetFriendListInfoScRsp extends BasePacket {
var friend = friendList.getServer().getPlayerByUid(friendship.getFriendUid(), true);
if (friend == null) continue;
// Create friend info
var friendInfo = FriendListInfo.newInstance()
.setSimpleInfo(friend.toSimpleInfo());
// Set playing state
if (friend.isOnline()) {
if (friend.getChallengeInstance() != null && friend.getChallengeInstance().isStory()) {
friendInfo.setPlayingState(PlayingState.PLAYING_CHALLENGE_STORY);
} else if (friend.getChallengeInstance() != null) {
friendInfo.setPlayingState(PlayingState.PLAYING_CHALLENGE_MEMORY);
} else if (friend.getRogueInstance() != null) {
friendInfo.setPlayingState(PlayingState.PLAYING_ROGUE_COSMOS);
}
}
data.addFriendList(friendInfo);
}