Skip to content

Commit

Permalink
Update friend list info packet
Browse files Browse the repository at this point in the history
  • Loading branch information
Melledy committed May 8, 2024
1 parent 707b73a commit ee17afe
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
2 changes: 0 additions & 2 deletions src/main/java/emu/lunarcore/game/player/Player.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
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;
Expand Down Expand Up @@ -950,7 +949,6 @@ public SimpleInfo toSimpleInfo() {
.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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
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;
Expand Down Expand Up @@ -39,9 +40,21 @@ public PacketGetFriendListInfoScRsp(FriendList friendList) {
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);
}

Expand Down

0 comments on commit ee17afe

Please sign in to comment.