diff --git a/src/main/java/emu/grasscutter/game/home/HomeBlockItem.java b/src/main/java/emu/grasscutter/game/home/HomeBlockItem.java index 7401b7a6c..4ceaf4224 100644 --- a/src/main/java/emu/grasscutter/game/home/HomeBlockItem.java +++ b/src/main/java/emu/grasscutter/game/home/HomeBlockItem.java @@ -4,6 +4,7 @@ import dev.morphia.annotations.Entity; import dev.morphia.annotations.Id; import emu.grasscutter.data.binout.HomeworldDefaultSaveData; import emu.grasscutter.net.proto.HomeBlockArrangementInfoOuterClass.HomeBlockArrangementInfo; +import emu.grasscutter.utils.Position; import lombok.AccessLevel; import lombok.Builder; import lombok.Data; @@ -20,6 +21,7 @@ public class HomeBlockItem { int blockId; boolean unlocked; List deployFurnitureList; + List persistentFurnitureList; List deployAnimalList; List deployNPCList; @@ -30,6 +32,10 @@ public class HomeBlockItem { .map(HomeFurnitureItem::parseFrom) .toList(); + this.persistentFurnitureList = homeBlockArrangementInfo.getPersistentFurnitureListList().stream() + .map(HomeFurnitureItem::parseFrom) + .toList(); + this.deployAnimalList = homeBlockArrangementInfo.getDeployAnimalListList().stream() .map(HomeAnimalItem::parseFrom) .toList(); @@ -52,6 +58,7 @@ public class HomeBlockItem { .setComfortValue(calComfort()); this.deployFurnitureList.forEach(f -> proto.addDeployFurniureList(f.toProto())); + this.persistentFurnitureList.forEach(f -> proto.addDeployFurniureList(f.toProto())); this.deployAnimalList.forEach(f -> proto.addDeployAnimalList(f.toProto())); this.deployNPCList.forEach(f -> proto.addDeployNpcList(f.toProto())); @@ -59,7 +66,7 @@ public class HomeBlockItem { } public static HomeBlockItem parseFrom(HomeworldDefaultSaveData.HomeBlock homeBlock) { - + // create from default setting return HomeBlockItem.of() .blockId(homeBlock.getBlockId()) .unlocked(homeBlock.getFurnitures() != null) @@ -70,6 +77,7 @@ public class HomeBlockItem { .toList()) .deployAnimalList(List.of()) .deployNPCList(List.of()) + .persistentFurnitureList(List.of()) .build(); } } diff --git a/src/main/java/emu/grasscutter/game/home/HomeFurnitureItem.java b/src/main/java/emu/grasscutter/game/home/HomeFurnitureItem.java index 34a50d833..7c5f197ef 100644 --- a/src/main/java/emu/grasscutter/game/home/HomeFurnitureItem.java +++ b/src/main/java/emu/grasscutter/game/home/HomeFurnitureItem.java @@ -6,6 +6,7 @@ import emu.grasscutter.data.binout.HomeworldDefaultSaveData; import emu.grasscutter.data.excels.ItemData; import emu.grasscutter.net.proto.HomeFurnitureDataOuterClass; import emu.grasscutter.net.proto.HomeMarkPointFurnitureDataOuterClass; +import emu.grasscutter.net.proto.VectorOuterClass; import emu.grasscutter.utils.Position; import lombok.AccessLevel; import lombok.Builder; @@ -22,7 +23,7 @@ public class HomeFurnitureItem { int parentFurnitureIndex; Position spawnPos; Position spawnRot; - + int version; public HomeFurnitureDataOuterClass.HomeFurnitureData toProto(){ return HomeFurnitureDataOuterClass.HomeFurnitureData.newBuilder() .setFurnitureId(furnitureId) @@ -30,6 +31,7 @@ public class HomeFurnitureItem { .setParentFurnitureIndex(parentFurnitureIndex) .setSpawnPos(spawnPos.toProto()) .setSpawnRot(spawnRot.toProto()) + .setVersion(version) .build(); } @@ -50,6 +52,7 @@ public class HomeFurnitureItem { .parentFurnitureIndex(homeFurnitureData.getParentFurnitureIndex()) .spawnPos(new Position(homeFurnitureData.getSpawnPos())) .spawnRot(new Position(homeFurnitureData.getSpawnRot())) + .version(homeFurnitureData.getVersion()) .build(); } diff --git a/src/main/java/emu/grasscutter/game/home/HomeSceneItem.java b/src/main/java/emu/grasscutter/game/home/HomeSceneItem.java index 352ba18db..8313390e3 100644 --- a/src/main/java/emu/grasscutter/game/home/HomeSceneItem.java +++ b/src/main/java/emu/grasscutter/game/home/HomeSceneItem.java @@ -26,7 +26,7 @@ public class HomeSceneItem { Position bornRot; Position djinnPos; HomeFurnitureItem mainHouse; - + int tmpVersion; public static HomeSceneItem parseFrom(HomeworldDefaultSaveData defaultItem, int sceneId) { return HomeSceneItem.of() .sceneId(sceneId) @@ -56,6 +56,7 @@ public class HomeSceneItem { this.bornRot = new Position(arrangementInfo.getBornRot()); this.djinnPos = new Position(arrangementInfo.getDjinnPos()); this.mainHouse = HomeFurnitureItem.parseFrom(arrangementInfo.getMainHouse()); + this.tmpVersion = arrangementInfo.getTmpVersion(); } public int getRoomSceneId(){ @@ -81,7 +82,7 @@ public class HomeSceneItem { .setDjinnPos(djinnPos.toProto()) .setIsSetBornPos(true) .setSceneId(sceneId) - .setTmpVersion(1); + .setTmpVersion(tmpVersion); if(mainHouse != null){ proto.setMainHouse(mainHouse.toProto()); diff --git a/src/main/java/emu/grasscutter/game/managers/FurnitureManager.java b/src/main/java/emu/grasscutter/game/managers/FurnitureManager.java index 814bc7d6f..33d771df9 100644 --- a/src/main/java/emu/grasscutter/game/managers/FurnitureManager.java +++ b/src/main/java/emu/grasscutter/game/managers/FurnitureManager.java @@ -124,10 +124,10 @@ public class FurnitureManager { } // check if player can take - if(slotItem.get().getBeginTime() + slotItem.get().getDurTime() >= Utils.getCurrentSeconds() && !isFastFinish){ - player.getSession().send(new PacketTakeFurnitureMakeRsp(Retcode.RET_FURNITURE_MAKE_UNFINISH_VALUE, makeId, null, null)); - return; - } +// if(slotItem.get().getBeginTime() + slotItem.get().getDurTime() >= Utils.getCurrentSeconds() && !isFastFinish){ +// player.getSession().send(new PacketTakeFurnitureMakeRsp(Retcode.RET_FURNITURE_MAKE_UNFINISH_VALUE, makeId, null, null)); +// return; +// } player.getInventory().addItem(makeData.getFurnitureItemID(), makeData.getCount()); player.getHome().getFurnitureMakeSlotItemList().remove(slotItem.get()); diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketFurnitureCurModuleArrangeCountNotify.java b/src/main/java/emu/grasscutter/server/packet/send/PacketFurnitureCurModuleArrangeCountNotify.java index 9dfe4ac0f..b773daf5b 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketFurnitureCurModuleArrangeCountNotify.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketFurnitureCurModuleArrangeCountNotify.java @@ -12,45 +12,7 @@ public class PacketFurnitureCurModuleArrangeCountNotify extends BasePacket { var proto = FurnitureCurModuleArrangeCountNotifyOuterClass.FurnitureCurModuleArrangeCountNotify.newBuilder(); - proto.addFurnitureArrangeCountList(Uint32PairOuterClass.Uint32Pair.newBuilder() - .setKey(360101) - .setValue(7) - .build()); - - proto.addFurnitureArrangeCountList(Uint32PairOuterClass.Uint32Pair.newBuilder() - .setKey(360201) - .setValue(7) - .build()); - - proto.addFurnitureArrangeCountList(Uint32PairOuterClass.Uint32Pair.newBuilder() - .setKey(360301) - .setValue(7) - .build()); - - proto.addFurnitureArrangeCountList(Uint32PairOuterClass.Uint32Pair.newBuilder() - .setKey(360401) - .setValue(2) - .build()); - - proto.addFurnitureArrangeCountList(Uint32PairOuterClass.Uint32Pair.newBuilder() - .setKey(360402) - .setValue(4) - .build()); - - proto.addFurnitureArrangeCountList(Uint32PairOuterClass.Uint32Pair.newBuilder() - .setKey(364301) - .setValue(1) - .build()); - - proto.addFurnitureArrangeCountList(Uint32PairOuterClass.Uint32Pair.newBuilder() - .setKey(364401) - .setValue(1) - .build()); - - proto.addFurnitureArrangeCountList(Uint32PairOuterClass.Uint32Pair.newBuilder() - .setKey(3750102) - .setValue(1) - .build()); + // TODO this.setData(proto); } diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketHomeBasicInfoNotify.java b/src/main/java/emu/grasscutter/server/packet/send/PacketHomeBasicInfoNotify.java index f67fed13f..846069f5e 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketHomeBasicInfoNotify.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketHomeBasicInfoNotify.java @@ -27,22 +27,9 @@ public class PacketHomeBasicInfoNotify extends BasePacket { .setCurRoomSceneId(homeScene.getRoomSceneId()) .setIsInEditMode(editMode) .setHomeOwnerUid(player.getUid()) - .setLevel(1) + .setLevel(player.getHome().getLevel()) .setOwnerNickName(player.getNickname()) - .setLimitedShopInfo(HomeLimitedShopInfoOuterClass.HomeLimitedShopInfo.newBuilder() - .setDjinnPos(VectorOuterClass.Vector.newBuilder() - .setZ(192) - .setX(792) - .setY(316.7f) - .build()) - .setDjinnRot(VectorOuterClass.Vector.newBuilder() - .setY(176) - .build()) - .setNextCloseTime(Integer.MAX_VALUE) - .setNextGuestOpenTime(0) - .setNextOpenTime(0) - .setUid(player.getUid()) - .build()) + // TODO limit shop .build()); this.setData(proto); diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketHomeComfortInfoNotify.java b/src/main/java/emu/grasscutter/server/packet/send/PacketHomeComfortInfoNotify.java index 374fa415b..0b38b836d 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketHomeComfortInfoNotify.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketHomeComfortInfoNotify.java @@ -1,5 +1,6 @@ package emu.grasscutter.server.packet.send; +import emu.grasscutter.game.home.HomeBlockItem; import emu.grasscutter.game.player.Player; import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; @@ -22,14 +23,17 @@ public class PacketHomeComfortInfoNotify extends BasePacket { List comfortInfoList = new ArrayList<>(); for (int moduleId : player.getRealmList()) { + var homeScene = player.getHome().getHomeSceneItem(moduleId + 2000); + var blockComfortList = homeScene.getBlockItems().values().stream() + .map(HomeBlockItem::calComfort) + .toList(); + var homeRoomScene = player.getHome().getHomeSceneItem(homeScene.getRoomSceneId()); + comfortInfoList.add( HomeModuleComfortInfoOuterClass.HomeModuleComfortInfo.newBuilder() .setModuleId(moduleId) - .setRoomSceneComfortValue(1050) - .addWorldSceneBlockComfortValueList(750) - .addWorldSceneBlockComfortValueList(0) - .addWorldSceneBlockComfortValueList(0) - .addWorldSceneBlockComfortValueList(0) + .setRoomSceneComfortValue(homeRoomScene.calComfort()) + .addAllWorldSceneBlockComfortValueList(blockComfortList) .build() ); } diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketHomeSceneInitFinishRsp.java b/src/main/java/emu/grasscutter/server/packet/send/PacketHomeSceneInitFinishRsp.java index 4acf45722..66b529759 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketHomeSceneInitFinishRsp.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketHomeSceneInitFinishRsp.java @@ -3,13 +3,14 @@ package emu.grasscutter.server.packet.send; import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.HomeSceneArrangementInfoOuterClass; +import emu.grasscutter.net.proto.HomeSceneInitFinishReqOuterClass; public class PacketHomeSceneInitFinishRsp extends BasePacket { public PacketHomeSceneInitFinishRsp() { super(PacketOpcodes.HomeSceneInitFinishRsp); - var proto = HomeSceneArrangementInfoOuterClass.HomeSceneArrangementInfo.newBuilder(); + var proto = HomeSceneInitFinishReqOuterClass.HomeSceneInitFinishReq.newBuilder(); this.setData(proto);