Commit 247412b1 authored by Akka's avatar Akka Committed by Melledy
Browse files

fix the rot of furniture

parent 211d7d6f
...@@ -4,6 +4,7 @@ import dev.morphia.annotations.Entity; ...@@ -4,6 +4,7 @@ import dev.morphia.annotations.Entity;
import dev.morphia.annotations.Id; import dev.morphia.annotations.Id;
import emu.grasscutter.data.binout.HomeworldDefaultSaveData; import emu.grasscutter.data.binout.HomeworldDefaultSaveData;
import emu.grasscutter.net.proto.HomeBlockArrangementInfoOuterClass.HomeBlockArrangementInfo; import emu.grasscutter.net.proto.HomeBlockArrangementInfoOuterClass.HomeBlockArrangementInfo;
import emu.grasscutter.utils.Position;
import lombok.AccessLevel; import lombok.AccessLevel;
import lombok.Builder; import lombok.Builder;
import lombok.Data; import lombok.Data;
...@@ -20,6 +21,7 @@ public class HomeBlockItem { ...@@ -20,6 +21,7 @@ public class HomeBlockItem {
int blockId; int blockId;
boolean unlocked; boolean unlocked;
List<HomeFurnitureItem> deployFurnitureList; List<HomeFurnitureItem> deployFurnitureList;
List<HomeFurnitureItem> persistentFurnitureList;
List<HomeAnimalItem> deployAnimalList; List<HomeAnimalItem> deployAnimalList;
List<HomeNPCItem> deployNPCList; List<HomeNPCItem> deployNPCList;
...@@ -30,6 +32,10 @@ public class HomeBlockItem { ...@@ -30,6 +32,10 @@ public class HomeBlockItem {
.map(HomeFurnitureItem::parseFrom) .map(HomeFurnitureItem::parseFrom)
.toList(); .toList();
this.persistentFurnitureList = homeBlockArrangementInfo.getPersistentFurnitureListList().stream()
.map(HomeFurnitureItem::parseFrom)
.toList();
this.deployAnimalList = homeBlockArrangementInfo.getDeployAnimalListList().stream() this.deployAnimalList = homeBlockArrangementInfo.getDeployAnimalListList().stream()
.map(HomeAnimalItem::parseFrom) .map(HomeAnimalItem::parseFrom)
.toList(); .toList();
...@@ -52,6 +58,7 @@ public class HomeBlockItem { ...@@ -52,6 +58,7 @@ public class HomeBlockItem {
.setComfortValue(calComfort()); .setComfortValue(calComfort());
this.deployFurnitureList.forEach(f -> proto.addDeployFurniureList(f.toProto())); 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.deployAnimalList.forEach(f -> proto.addDeployAnimalList(f.toProto()));
this.deployNPCList.forEach(f -> proto.addDeployNpcList(f.toProto())); this.deployNPCList.forEach(f -> proto.addDeployNpcList(f.toProto()));
...@@ -59,7 +66,7 @@ public class HomeBlockItem { ...@@ -59,7 +66,7 @@ public class HomeBlockItem {
} }
public static HomeBlockItem parseFrom(HomeworldDefaultSaveData.HomeBlock homeBlock) { public static HomeBlockItem parseFrom(HomeworldDefaultSaveData.HomeBlock homeBlock) {
// create from default setting
return HomeBlockItem.of() return HomeBlockItem.of()
.blockId(homeBlock.getBlockId()) .blockId(homeBlock.getBlockId())
.unlocked(homeBlock.getFurnitures() != null) .unlocked(homeBlock.getFurnitures() != null)
...@@ -70,6 +77,7 @@ public class HomeBlockItem { ...@@ -70,6 +77,7 @@ public class HomeBlockItem {
.toList()) .toList())
.deployAnimalList(List.of()) .deployAnimalList(List.of())
.deployNPCList(List.of()) .deployNPCList(List.of())
.persistentFurnitureList(List.of())
.build(); .build();
} }
} }
...@@ -6,6 +6,7 @@ import emu.grasscutter.data.binout.HomeworldDefaultSaveData; ...@@ -6,6 +6,7 @@ import emu.grasscutter.data.binout.HomeworldDefaultSaveData;
import emu.grasscutter.data.excels.ItemData; import emu.grasscutter.data.excels.ItemData;
import emu.grasscutter.net.proto.HomeFurnitureDataOuterClass; import emu.grasscutter.net.proto.HomeFurnitureDataOuterClass;
import emu.grasscutter.net.proto.HomeMarkPointFurnitureDataOuterClass; import emu.grasscutter.net.proto.HomeMarkPointFurnitureDataOuterClass;
import emu.grasscutter.net.proto.VectorOuterClass;
import emu.grasscutter.utils.Position; import emu.grasscutter.utils.Position;
import lombok.AccessLevel; import lombok.AccessLevel;
import lombok.Builder; import lombok.Builder;
...@@ -22,7 +23,7 @@ public class HomeFurnitureItem { ...@@ -22,7 +23,7 @@ public class HomeFurnitureItem {
int parentFurnitureIndex; int parentFurnitureIndex;
Position spawnPos; Position spawnPos;
Position spawnRot; Position spawnRot;
int version;
public HomeFurnitureDataOuterClass.HomeFurnitureData toProto(){ public HomeFurnitureDataOuterClass.HomeFurnitureData toProto(){
return HomeFurnitureDataOuterClass.HomeFurnitureData.newBuilder() return HomeFurnitureDataOuterClass.HomeFurnitureData.newBuilder()
.setFurnitureId(furnitureId) .setFurnitureId(furnitureId)
...@@ -30,6 +31,7 @@ public class HomeFurnitureItem { ...@@ -30,6 +31,7 @@ public class HomeFurnitureItem {
.setParentFurnitureIndex(parentFurnitureIndex) .setParentFurnitureIndex(parentFurnitureIndex)
.setSpawnPos(spawnPos.toProto()) .setSpawnPos(spawnPos.toProto())
.setSpawnRot(spawnRot.toProto()) .setSpawnRot(spawnRot.toProto())
.setVersion(version)
.build(); .build();
} }
...@@ -50,6 +52,7 @@ public class HomeFurnitureItem { ...@@ -50,6 +52,7 @@ public class HomeFurnitureItem {
.parentFurnitureIndex(homeFurnitureData.getParentFurnitureIndex()) .parentFurnitureIndex(homeFurnitureData.getParentFurnitureIndex())
.spawnPos(new Position(homeFurnitureData.getSpawnPos())) .spawnPos(new Position(homeFurnitureData.getSpawnPos()))
.spawnRot(new Position(homeFurnitureData.getSpawnRot())) .spawnRot(new Position(homeFurnitureData.getSpawnRot()))
.version(homeFurnitureData.getVersion())
.build(); .build();
} }
......
...@@ -26,7 +26,7 @@ public class HomeSceneItem { ...@@ -26,7 +26,7 @@ public class HomeSceneItem {
Position bornRot; Position bornRot;
Position djinnPos; Position djinnPos;
HomeFurnitureItem mainHouse; HomeFurnitureItem mainHouse;
int tmpVersion;
public static HomeSceneItem parseFrom(HomeworldDefaultSaveData defaultItem, int sceneId) { public static HomeSceneItem parseFrom(HomeworldDefaultSaveData defaultItem, int sceneId) {
return HomeSceneItem.of() return HomeSceneItem.of()
.sceneId(sceneId) .sceneId(sceneId)
...@@ -56,6 +56,7 @@ public class HomeSceneItem { ...@@ -56,6 +56,7 @@ public class HomeSceneItem {
this.bornRot = new Position(arrangementInfo.getBornRot()); this.bornRot = new Position(arrangementInfo.getBornRot());
this.djinnPos = new Position(arrangementInfo.getDjinnPos()); this.djinnPos = new Position(arrangementInfo.getDjinnPos());
this.mainHouse = HomeFurnitureItem.parseFrom(arrangementInfo.getMainHouse()); this.mainHouse = HomeFurnitureItem.parseFrom(arrangementInfo.getMainHouse());
this.tmpVersion = arrangementInfo.getTmpVersion();
} }
public int getRoomSceneId(){ public int getRoomSceneId(){
...@@ -81,7 +82,7 @@ public class HomeSceneItem { ...@@ -81,7 +82,7 @@ public class HomeSceneItem {
.setDjinnPos(djinnPos.toProto()) .setDjinnPos(djinnPos.toProto())
.setIsSetBornPos(true) .setIsSetBornPos(true)
.setSceneId(sceneId) .setSceneId(sceneId)
.setTmpVersion(1); .setTmpVersion(tmpVersion);
if(mainHouse != null){ if(mainHouse != null){
proto.setMainHouse(mainHouse.toProto()); proto.setMainHouse(mainHouse.toProto());
......
...@@ -124,10 +124,10 @@ public class FurnitureManager { ...@@ -124,10 +124,10 @@ public class FurnitureManager {
} }
// check if player can take // check if player can take
if(slotItem.get().getBeginTime() + slotItem.get().getDurTime() >= Utils.getCurrentSeconds() && !isFastFinish){ // if(slotItem.get().getBeginTime() + slotItem.get().getDurTime() >= Utils.getCurrentSeconds() && !isFastFinish){
player.getSession().send(new PacketTakeFurnitureMakeRsp(Retcode.RET_FURNITURE_MAKE_UNFINISH_VALUE, makeId, null, null)); // player.getSession().send(new PacketTakeFurnitureMakeRsp(Retcode.RET_FURNITURE_MAKE_UNFINISH_VALUE, makeId, null, null));
return; // return;
} // }
player.getInventory().addItem(makeData.getFurnitureItemID(), makeData.getCount()); player.getInventory().addItem(makeData.getFurnitureItemID(), makeData.getCount());
player.getHome().getFurnitureMakeSlotItemList().remove(slotItem.get()); player.getHome().getFurnitureMakeSlotItemList().remove(slotItem.get());
......
...@@ -12,45 +12,7 @@ public class PacketFurnitureCurModuleArrangeCountNotify extends BasePacket { ...@@ -12,45 +12,7 @@ public class PacketFurnitureCurModuleArrangeCountNotify extends BasePacket {
var proto = FurnitureCurModuleArrangeCountNotifyOuterClass.FurnitureCurModuleArrangeCountNotify.newBuilder(); var proto = FurnitureCurModuleArrangeCountNotifyOuterClass.FurnitureCurModuleArrangeCountNotify.newBuilder();
proto.addFurnitureArrangeCountList(Uint32PairOuterClass.Uint32Pair.newBuilder() // TODO
.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());
this.setData(proto); this.setData(proto);
} }
......
...@@ -27,22 +27,9 @@ public class PacketHomeBasicInfoNotify extends BasePacket { ...@@ -27,22 +27,9 @@ public class PacketHomeBasicInfoNotify extends BasePacket {
.setCurRoomSceneId(homeScene.getRoomSceneId()) .setCurRoomSceneId(homeScene.getRoomSceneId())
.setIsInEditMode(editMode) .setIsInEditMode(editMode)
.setHomeOwnerUid(player.getUid()) .setHomeOwnerUid(player.getUid())
.setLevel(1) .setLevel(player.getHome().getLevel())
.setOwnerNickName(player.getNickname()) .setOwnerNickName(player.getNickname())
.setLimitedShopInfo(HomeLimitedShopInfoOuterClass.HomeLimitedShopInfo.newBuilder() // TODO limit shop
.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())
.build()); .build());
this.setData(proto); this.setData(proto);
......
package emu.grasscutter.server.packet.send; package emu.grasscutter.server.packet.send;
import emu.grasscutter.game.home.HomeBlockItem;
import emu.grasscutter.game.player.Player; import emu.grasscutter.game.player.Player;
import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.packet.PacketOpcodes;
...@@ -22,14 +23,17 @@ public class PacketHomeComfortInfoNotify extends BasePacket { ...@@ -22,14 +23,17 @@ public class PacketHomeComfortInfoNotify extends BasePacket {
List<HomeModuleComfortInfoOuterClass.HomeModuleComfortInfo> comfortInfoList = new ArrayList<>(); List<HomeModuleComfortInfoOuterClass.HomeModuleComfortInfo> comfortInfoList = new ArrayList<>();
for (int moduleId : player.getRealmList()) { 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( comfortInfoList.add(
HomeModuleComfortInfoOuterClass.HomeModuleComfortInfo.newBuilder() HomeModuleComfortInfoOuterClass.HomeModuleComfortInfo.newBuilder()
.setModuleId(moduleId) .setModuleId(moduleId)
.setRoomSceneComfortValue(1050) .setRoomSceneComfortValue(homeRoomScene.calComfort())
.addWorldSceneBlockComfortValueList(750) .addAllWorldSceneBlockComfortValueList(blockComfortList)
.addWorldSceneBlockComfortValueList(0)
.addWorldSceneBlockComfortValueList(0)
.addWorldSceneBlockComfortValueList(0)
.build() .build()
); );
} }
......
...@@ -3,13 +3,14 @@ package emu.grasscutter.server.packet.send; ...@@ -3,13 +3,14 @@ package emu.grasscutter.server.packet.send;
import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.HomeSceneArrangementInfoOuterClass; import emu.grasscutter.net.proto.HomeSceneArrangementInfoOuterClass;
import emu.grasscutter.net.proto.HomeSceneInitFinishReqOuterClass;
public class PacketHomeSceneInitFinishRsp extends BasePacket { public class PacketHomeSceneInitFinishRsp extends BasePacket {
public PacketHomeSceneInitFinishRsp() { public PacketHomeSceneInitFinishRsp() {
super(PacketOpcodes.HomeSceneInitFinishRsp); super(PacketOpcodes.HomeSceneInitFinishRsp);
var proto = HomeSceneArrangementInfoOuterClass.HomeSceneArrangementInfo.newBuilder(); var proto = HomeSceneInitFinishReqOuterClass.HomeSceneInitFinishReq.newBuilder();
this.setData(proto); this.setData(proto);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment