mirror of
https://github.com/Melledy/Grasscutter.git
synced 2024-11-22 17:51:53 +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.net.proto.HomeAvatarTalkFinishInfoOuterClass;
|
||||||
import emu.grasscutter.server.packet.send.*;
|
import emu.grasscutter.server.packet.send.*;
|
||||||
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
||||||
|
|
||||||
import java.time.ZonedDateTime;
|
import java.time.ZonedDateTime;
|
||||||
import java.time.temporal.ChronoUnit;
|
import java.time.temporal.ChronoUnit;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
@ -157,17 +156,21 @@ public class GameHome {
|
|||||||
return this.finishedTalkIdMap.get(avatarId);
|
return this.finishedTalkIdMap.get(avatarId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<HomeAvatarTalkFinishInfoOuterClass.HomeAvatarTalkFinishInfo> toAvatarTalkFinishInfoProto() {
|
public List<HomeAvatarTalkFinishInfoOuterClass.HomeAvatarTalkFinishInfo>
|
||||||
|
toAvatarTalkFinishInfoProto() {
|
||||||
if (this.finishedTalkIdMap == null) {
|
if (this.finishedTalkIdMap == null) {
|
||||||
this.finishedTalkIdMap = new HashMap<>();
|
this.finishedTalkIdMap = new HashMap<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.finishedTalkIdMap.entrySet().stream().map(e -> {
|
return this.finishedTalkIdMap.entrySet().stream()
|
||||||
|
.map(
|
||||||
|
e -> {
|
||||||
return HomeAvatarTalkFinishInfoOuterClass.HomeAvatarTalkFinishInfo.newBuilder()
|
return HomeAvatarTalkFinishInfoOuterClass.HomeAvatarTalkFinishInfo.newBuilder()
|
||||||
.setAvatarId(e.getKey())
|
.setAvatarId(e.getKey())
|
||||||
.addAllFinishTalkIdList(e.getValue())
|
.addAllFinishTalkIdList(e.getValue())
|
||||||
.build();
|
.build();
|
||||||
}).toList();
|
})
|
||||||
|
.toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean addUnlockedHomeBgm(int homeBgmId) {
|
public boolean addUnlockedHomeBgm(int homeBgmId) {
|
||||||
|
@ -13,7 +13,12 @@ public class HandlerHomeAvatarTalkReq extends PacketHandler {
|
|||||||
@Override
|
@Override
|
||||||
public void handle(GameSession session, byte[] header, byte[] payload) throws Exception {
|
public void handle(GameSession session, byte[] header, byte[] payload) throws Exception {
|
||||||
var req = HomeAvatarTalkReqOuterClass.HomeAvatarTalkReq.parseFrom(payload);
|
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 PacketHomeAvatarTalkFinishInfoNotify(session.getPlayer()));
|
||||||
session.send(new PacketHomeAvatarTalkRsp(req.getAvatarId(), talkIdSet));
|
session.send(new PacketHomeAvatarTalkRsp(req.getAvatarId(), talkIdSet));
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,8 @@ public class PacketHomeAvatarTalkFinishInfoNotify extends BasePacket {
|
|||||||
public PacketHomeAvatarTalkFinishInfoNotify(Player homeOwner) {
|
public PacketHomeAvatarTalkFinishInfoNotify(Player homeOwner) {
|
||||||
super(PacketOpcodes.HomeAvatarTalkFinishInfoNotify);
|
super(PacketOpcodes.HomeAvatarTalkFinishInfoNotify);
|
||||||
|
|
||||||
this.setData(HomeAvatarTalkFinishInfoNotifyOuterClass.HomeAvatarTalkFinishInfoNotify.newBuilder()
|
this.setData(
|
||||||
|
HomeAvatarTalkFinishInfoNotifyOuterClass.HomeAvatarTalkFinishInfoNotify.newBuilder()
|
||||||
.addAllAvatarTalkInfoList(homeOwner.getHome().toAvatarTalkFinishInfoProto()));
|
.addAllAvatarTalkInfoList(homeOwner.getHome().toAvatarTalkFinishInfoProto()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,15 +4,16 @@ import emu.grasscutter.net.packet.BasePacket;
|
|||||||
import emu.grasscutter.net.packet.PacketOpcodes;
|
import emu.grasscutter.net.packet.PacketOpcodes;
|
||||||
import emu.grasscutter.net.proto.HomeAvatarTalkFinishInfoOuterClass;
|
import emu.grasscutter.net.proto.HomeAvatarTalkFinishInfoOuterClass;
|
||||||
import emu.grasscutter.net.proto.HomeAvatarTalkRspOuterClass;
|
import emu.grasscutter.net.proto.HomeAvatarTalkRspOuterClass;
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
public class PacketHomeAvatarTalkRsp extends BasePacket {
|
public class PacketHomeAvatarTalkRsp extends BasePacket {
|
||||||
public PacketHomeAvatarTalkRsp(int avatarId, Set<Integer> talkIdSet) {
|
public PacketHomeAvatarTalkRsp(int avatarId, Set<Integer> talkIdSet) {
|
||||||
super(PacketOpcodes.HomeAvatarTalkRsp);
|
super(PacketOpcodes.HomeAvatarTalkRsp);
|
||||||
|
|
||||||
this.setData(HomeAvatarTalkRspOuterClass.HomeAvatarTalkRsp.newBuilder()
|
this.setData(
|
||||||
.setAvatarTalkInfo(HomeAvatarTalkFinishInfoOuterClass.HomeAvatarTalkFinishInfo.newBuilder()
|
HomeAvatarTalkRspOuterClass.HomeAvatarTalkRsp.newBuilder()
|
||||||
|
.setAvatarTalkInfo(
|
||||||
|
HomeAvatarTalkFinishInfoOuterClass.HomeAvatarTalkFinishInfo.newBuilder()
|
||||||
.setAvatarId(avatarId)
|
.setAvatarId(avatarId)
|
||||||
.addAllFinishTalkIdList(talkIdSet)
|
.addAllFinishTalkIdList(talkIdSet)
|
||||||
.build()));
|
.build()));
|
||||||
|
Loading…
Reference in New Issue
Block a user