mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2025-01-23 11:22:55 +08:00
Format code [skip actions]
This commit is contained in:
parent
ed97201473
commit
f8fb6732de
@ -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.*;
|
||||||
@ -86,7 +85,10 @@ public class GameHome {
|
|||||||
// Data fixer.
|
// Data fixer.
|
||||||
private void fixMainHouseIfOld() {
|
private void fixMainHouseIfOld() {
|
||||||
if (this.getMainHouseMap() == null) {
|
if (this.getMainHouseMap() == null) {
|
||||||
Grasscutter.getLogger().debug("Player {}'s main house will be deleted due to GC update! (ps. sorry XD)", this.getPlayer().getUid());
|
Grasscutter.getLogger()
|
||||||
|
.debug(
|
||||||
|
"Player {}'s main house will be deleted due to GC update! (ps. sorry XD)",
|
||||||
|
this.getPlayer().getUid());
|
||||||
this.mainHouseMap = new ConcurrentHashMap<>(); // assign.
|
this.mainHouseMap = new ConcurrentHashMap<>(); // assign.
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -121,16 +123,22 @@ public class GameHome {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public HomeSceneItem getMainHouseItem(int outdoorSceneId) {
|
public HomeSceneItem getMainHouseItem(int outdoorSceneId) {
|
||||||
return this.getMainHouseMap().computeIfAbsent(outdoorSceneId, integer -> {
|
return this.getMainHouseMap()
|
||||||
|
.computeIfAbsent(
|
||||||
|
outdoorSceneId,
|
||||||
|
integer -> {
|
||||||
var curHomeSceneItem = this.getHomeSceneItem(outdoorSceneId);
|
var curHomeSceneItem = this.getHomeSceneItem(outdoorSceneId);
|
||||||
var roomSceneId = curHomeSceneItem.getRoomSceneId();
|
var roomSceneId = curHomeSceneItem.getRoomSceneId();
|
||||||
var defaultItem = GameData.getHomeworldDefaultSaveData().get(roomSceneId);
|
var defaultItem = GameData.getHomeworldDefaultSaveData().get(roomSceneId);
|
||||||
if (defaultItem == null) {
|
if (defaultItem == null) {
|
||||||
Grasscutter.getLogger().info("defaultItem == null! returns Liyue style house.");
|
Grasscutter.getLogger().info("defaultItem == null! returns Liyue style house.");
|
||||||
return HomeSceneItem.parseFrom(GameData.getHomeworldDefaultSaveData().get(2202), 2202); // Liyue style
|
return HomeSceneItem.parseFrom(
|
||||||
|
GameData.getHomeworldDefaultSaveData().get(2202), 2202); // Liyue style
|
||||||
}
|
}
|
||||||
|
|
||||||
Grasscutter.getLogger().info("Set player {} main house {} to initial setting", this.ownerUid, roomSceneId);
|
Grasscutter.getLogger()
|
||||||
|
.info(
|
||||||
|
"Set player {} main house {} to initial setting", this.ownerUid, roomSceneId);
|
||||||
return HomeSceneItem.parseFrom(defaultItem, roomSceneId);
|
return HomeSceneItem.parseFrom(defaultItem, roomSceneId);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,6 @@ import emu.grasscutter.data.GameData;
|
|||||||
import emu.grasscutter.data.binout.HomeworldDefaultSaveData;
|
import emu.grasscutter.data.binout.HomeworldDefaultSaveData;
|
||||||
import emu.grasscutter.data.excels.ItemData;
|
import emu.grasscutter.data.excels.ItemData;
|
||||||
import emu.grasscutter.game.world.Position;
|
import emu.grasscutter.game.world.Position;
|
||||||
|
|
||||||
import emu.grasscutter.net.proto.*;
|
import emu.grasscutter.net.proto.*;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
@ -9,7 +9,6 @@ import emu.grasscutter.game.entity.EntityHomeAnimal;
|
|||||||
import emu.grasscutter.game.world.Position;
|
import emu.grasscutter.game.world.Position;
|
||||||
import emu.grasscutter.game.world.Scene;
|
import emu.grasscutter.game.world.Scene;
|
||||||
import emu.grasscutter.net.proto.HomeSceneArrangementInfoOuterClass.HomeSceneArrangementInfo;
|
import emu.grasscutter.net.proto.HomeSceneArrangementInfoOuterClass.HomeSceneArrangementInfo;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -8,7 +8,6 @@ import emu.grasscutter.net.packet.PacketOpcodes;
|
|||||||
import emu.grasscutter.net.proto.HomeChangeModuleReqOuterClass;
|
import emu.grasscutter.net.proto.HomeChangeModuleReqOuterClass;
|
||||||
import emu.grasscutter.server.event.player.PlayerTeleportEvent.TeleportType;
|
import emu.grasscutter.server.event.player.PlayerTeleportEvent.TeleportType;
|
||||||
import emu.grasscutter.server.game.GameSession;
|
import emu.grasscutter.server.game.GameSession;
|
||||||
|
|
||||||
import emu.grasscutter.server.packet.send.PacketHomeAvatarTalkFinishInfoNotify;
|
import emu.grasscutter.server.packet.send.PacketHomeAvatarTalkFinishInfoNotify;
|
||||||
import emu.grasscutter.server.packet.send.PacketHomeChangeModuleRsp;
|
import emu.grasscutter.server.packet.send.PacketHomeChangeModuleRsp;
|
||||||
import emu.grasscutter.server.packet.send.PacketHomeComfortInfoNotify;
|
import emu.grasscutter.server.packet.send.PacketHomeComfortInfoNotify;
|
||||||
|
@ -5,9 +5,8 @@ import emu.grasscutter.net.packet.PacketHandler;
|
|||||||
import emu.grasscutter.net.packet.PacketOpcodes;
|
import emu.grasscutter.net.packet.PacketOpcodes;
|
||||||
import emu.grasscutter.net.proto.HomeUpdateArrangementInfoReqOuterClass;
|
import emu.grasscutter.net.proto.HomeUpdateArrangementInfoReqOuterClass;
|
||||||
import emu.grasscutter.server.game.GameSession;
|
import emu.grasscutter.server.game.GameSession;
|
||||||
|
|
||||||
import emu.grasscutter.server.packet.send.PacketHomeBasicInfoNotify;
|
|
||||||
import emu.grasscutter.server.packet.send.PacketHomeAvatarTalkFinishInfoNotify;
|
import emu.grasscutter.server.packet.send.PacketHomeAvatarTalkFinishInfoNotify;
|
||||||
|
import emu.grasscutter.server.packet.send.PacketHomeBasicInfoNotify;
|
||||||
import emu.grasscutter.server.packet.send.PacketHomeMarkPointNotify;
|
import emu.grasscutter.server.packet.send.PacketHomeMarkPointNotify;
|
||||||
import emu.grasscutter.server.packet.send.PacketHomeUpdateArrangementInfoRsp;
|
import emu.grasscutter.server.packet.send.PacketHomeUpdateArrangementInfoRsp;
|
||||||
|
|
||||||
@ -28,7 +27,8 @@ public class HandlerHomeUpdateArrangementInfoReq extends PacketHandler {
|
|||||||
session.getPlayer().getHome().onMainHouseChanged();
|
session.getPlayer().getHome().onMainHouseChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
session.send(new PacketHomeBasicInfoNotify(session.getPlayer(), session.getPlayer().isInEditMode()));
|
session.send(
|
||||||
|
new PacketHomeBasicInfoNotify(session.getPlayer(), session.getPlayer().isInEditMode()));
|
||||||
session.send(new PacketHomeAvatarTalkFinishInfoNotify(session.getPlayer()));
|
session.send(new PacketHomeAvatarTalkFinishInfoNotify(session.getPlayer()));
|
||||||
session.send(new PacketHomeMarkPointNotify(session.getPlayer()));
|
session.send(new PacketHomeMarkPointNotify(session.getPlayer()));
|
||||||
|
|
||||||
|
@ -22,7 +22,8 @@ public class PacketHomeChangeModuleRsp extends BasePacket {
|
|||||||
public PacketHomeChangeModuleRsp() {
|
public PacketHomeChangeModuleRsp() {
|
||||||
super(PacketOpcodes.HomeChangeModuleRsp);
|
super(PacketOpcodes.HomeChangeModuleRsp);
|
||||||
|
|
||||||
this.setData(HomeChangeModuleRspOuterClass.HomeChangeModuleRsp.newBuilder()
|
this.setData(
|
||||||
|
HomeChangeModuleRspOuterClass.HomeChangeModuleRsp.newBuilder()
|
||||||
.setRetcode(RetcodeOuterClass.Retcode.RET_HOME_HAS_GUEST_VALUE));
|
.setRetcode(RetcodeOuterClass.Retcode.RET_HOME_HAS_GUEST_VALUE));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,6 @@ package emu.grasscutter.server.packet.send;
|
|||||||
import emu.grasscutter.game.home.HomeBlockItem;
|
import emu.grasscutter.game.home.HomeBlockItem;
|
||||||
import emu.grasscutter.game.home.HomeMarkPointProtoFactory;
|
import emu.grasscutter.game.home.HomeMarkPointProtoFactory;
|
||||||
import emu.grasscutter.game.player.Player;
|
import emu.grasscutter.game.player.Player;
|
||||||
|
|
||||||
import emu.grasscutter.net.packet.*;
|
import emu.grasscutter.net.packet.*;
|
||||||
import emu.grasscutter.net.proto.*;
|
import emu.grasscutter.net.proto.*;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
@ -28,7 +27,9 @@ public class PacketHomeMarkPointNotify extends BasePacket {
|
|||||||
var homeScene = home.getHomeSceneItem(moduleId + 2000);
|
var homeScene = home.getHomeSceneItem(moduleId + 2000);
|
||||||
var mainHouse = home.getMainHouseItem(moduleId + 2000);
|
var mainHouse = home.getMainHouseItem(moduleId + 2000);
|
||||||
|
|
||||||
Set.of(homeScene, mainHouse).forEach(homeSceneItem -> {
|
Set.of(homeScene, mainHouse)
|
||||||
|
.forEach(
|
||||||
|
homeSceneItem -> {
|
||||||
var markPointData =
|
var markPointData =
|
||||||
HomeMarkPointSceneDataOuterClass.HomeMarkPointSceneData.newBuilder()
|
HomeMarkPointSceneDataOuterClass.HomeMarkPointSceneData.newBuilder()
|
||||||
.setModuleId(moduleId)
|
.setModuleId(moduleId)
|
||||||
@ -36,11 +37,16 @@ public class PacketHomeMarkPointNotify extends BasePacket {
|
|||||||
|
|
||||||
if (!homeSceneItem.isRoom()) {
|
if (!homeSceneItem.isRoom()) {
|
||||||
var config = world.getSceneById(moduleId + 2000).getScriptManager().getConfig();
|
var config = world.getSceneById(moduleId + 2000).getScriptManager().getConfig();
|
||||||
markPointData.setSafePointPos(config == null ? homeSceneItem.getBornPos().toProto() : config.born_pos.toProto())
|
markPointData
|
||||||
|
.setSafePointPos(
|
||||||
|
config == null
|
||||||
|
? homeSceneItem.getBornPos().toProto()
|
||||||
|
: config.born_pos.toProto())
|
||||||
.setTeapotSpiritPos(homeSceneItem.getDjinnPos().toProto());
|
.setTeapotSpiritPos(homeSceneItem.getDjinnPos().toProto());
|
||||||
}
|
}
|
||||||
|
|
||||||
var marks = homeSceneItem.getBlockItems().values().stream()
|
var marks =
|
||||||
|
homeSceneItem.getBlockItems().values().stream()
|
||||||
.map(HomeBlockItem::getMarkPointProtoFactories)
|
.map(HomeBlockItem::getMarkPointProtoFactories)
|
||||||
.flatMap(Collection::stream)
|
.flatMap(Collection::stream)
|
||||||
.filter(HomeMarkPointProtoFactory::isProtoConvertible)
|
.filter(HomeMarkPointProtoFactory::isProtoConvertible)
|
||||||
|
Loading…
Reference in New Issue
Block a user