mirror of
https://github.com/Melledy/Grasscutter.git
synced 2024-11-22 06:31:26 +00:00
Format code [skip actions]
This commit is contained in:
parent
9c25060c78
commit
decf494234
@ -12,7 +12,6 @@ import emu.grasscutter.game.props.SceneType;
|
||||
import emu.grasscutter.net.proto.HomeAvatarTalkFinishInfoOuterClass;
|
||||
import emu.grasscutter.server.packet.send.*;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
||||
|
||||
import java.time.ZonedDateTime;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.*;
|
||||
@ -70,12 +69,12 @@ public class GameHome {
|
||||
|
||||
public static GameHome create(Integer uid) {
|
||||
return GameHome.of()
|
||||
.ownerUid(uid)
|
||||
.level(1)
|
||||
.sceneMap(new ConcurrentHashMap<>())
|
||||
.unlockedHomeBgmList(new HashSet<>())
|
||||
.finishedTalkIdMap(new HashMap<>())
|
||||
.build();
|
||||
.ownerUid(uid)
|
||||
.level(1)
|
||||
.sceneMap(new ConcurrentHashMap<>())
|
||||
.unlockedHomeBgmList(new HashSet<>())
|
||||
.finishedTalkIdMap(new HashMap<>())
|
||||
.build();
|
||||
}
|
||||
|
||||
public void save() {
|
||||
@ -157,17 +156,21 @@ public class GameHome {
|
||||
return this.finishedTalkIdMap.get(avatarId);
|
||||
}
|
||||
|
||||
public List<HomeAvatarTalkFinishInfoOuterClass.HomeAvatarTalkFinishInfo> toAvatarTalkFinishInfoProto() {
|
||||
public List<HomeAvatarTalkFinishInfoOuterClass.HomeAvatarTalkFinishInfo>
|
||||
toAvatarTalkFinishInfoProto() {
|
||||
if (this.finishedTalkIdMap == null) {
|
||||
this.finishedTalkIdMap = new HashMap<>();
|
||||
}
|
||||
|
||||
return this.finishedTalkIdMap.entrySet().stream().map(e -> {
|
||||
return HomeAvatarTalkFinishInfoOuterClass.HomeAvatarTalkFinishInfo.newBuilder()
|
||||
.setAvatarId(e.getKey())
|
||||
.addAllFinishTalkIdList(e.getValue())
|
||||
.build();
|
||||
}).toList();
|
||||
return this.finishedTalkIdMap.entrySet().stream()
|
||||
.map(
|
||||
e -> {
|
||||
return HomeAvatarTalkFinishInfoOuterClass.HomeAvatarTalkFinishInfo.newBuilder()
|
||||
.setAvatarId(e.getKey())
|
||||
.addAllFinishTalkIdList(e.getValue())
|
||||
.build();
|
||||
})
|
||||
.toList();
|
||||
}
|
||||
|
||||
public boolean addUnlockedHomeBgm(int homeBgmId) {
|
||||
|
@ -13,7 +13,12 @@ public class HandlerHomeAvatarTalkReq extends PacketHandler {
|
||||
@Override
|
||||
public void handle(GameSession session, byte[] header, byte[] payload) throws Exception {
|
||||
var req = HomeAvatarTalkReqOuterClass.HomeAvatarTalkReq.parseFrom(payload);
|
||||
var talkIdSet = session.getPlayer().getCurHomeWorld().getHome().onTalkedWithAvatar(req.getAvatarId(), req.getTalkId());
|
||||
var talkIdSet =
|
||||
session
|
||||
.getPlayer()
|
||||
.getCurHomeWorld()
|
||||
.getHome()
|
||||
.onTalkedWithAvatar(req.getAvatarId(), req.getTalkId());
|
||||
session.send(new PacketHomeAvatarTalkFinishInfoNotify(session.getPlayer()));
|
||||
session.send(new PacketHomeAvatarTalkRsp(req.getAvatarId(), talkIdSet));
|
||||
}
|
||||
|
@ -9,7 +9,8 @@ public class PacketHomeAvatarTalkFinishInfoNotify extends BasePacket {
|
||||
public PacketHomeAvatarTalkFinishInfoNotify(Player homeOwner) {
|
||||
super(PacketOpcodes.HomeAvatarTalkFinishInfoNotify);
|
||||
|
||||
this.setData(HomeAvatarTalkFinishInfoNotifyOuterClass.HomeAvatarTalkFinishInfoNotify.newBuilder()
|
||||
.addAllAvatarTalkInfoList(homeOwner.getHome().toAvatarTalkFinishInfoProto()));
|
||||
this.setData(
|
||||
HomeAvatarTalkFinishInfoNotifyOuterClass.HomeAvatarTalkFinishInfoNotify.newBuilder()
|
||||
.addAllAvatarTalkInfoList(homeOwner.getHome().toAvatarTalkFinishInfoProto()));
|
||||
}
|
||||
}
|
||||
|
@ -4,17 +4,18 @@ import emu.grasscutter.net.packet.BasePacket;
|
||||
import emu.grasscutter.net.packet.PacketOpcodes;
|
||||
import emu.grasscutter.net.proto.HomeAvatarTalkFinishInfoOuterClass;
|
||||
import emu.grasscutter.net.proto.HomeAvatarTalkRspOuterClass;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
public class PacketHomeAvatarTalkRsp extends BasePacket {
|
||||
public PacketHomeAvatarTalkRsp(int avatarId, Set<Integer> talkIdSet) {
|
||||
super(PacketOpcodes.HomeAvatarTalkRsp);
|
||||
|
||||
this.setData(HomeAvatarTalkRspOuterClass.HomeAvatarTalkRsp.newBuilder()
|
||||
.setAvatarTalkInfo(HomeAvatarTalkFinishInfoOuterClass.HomeAvatarTalkFinishInfo.newBuilder()
|
||||
.setAvatarId(avatarId)
|
||||
.addAllFinishTalkIdList(talkIdSet)
|
||||
.build()));
|
||||
this.setData(
|
||||
HomeAvatarTalkRspOuterClass.HomeAvatarTalkRsp.newBuilder()
|
||||
.setAvatarTalkInfo(
|
||||
HomeAvatarTalkFinishInfoOuterClass.HomeAvatarTalkFinishInfo.newBuilder()
|
||||
.setAvatarId(avatarId)
|
||||
.addAllFinishTalkIdList(talkIdSet)
|
||||
.build()));
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user