mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2025-01-25 03:12:52 +08:00
fix the rot of furniture
This commit is contained in:
parent
211d7d6fbf
commit
247412b17e
@ -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<HomeFurnitureItem> deployFurnitureList;
|
||||
List<HomeFurnitureItem> persistentFurnitureList;
|
||||
List<HomeAnimalItem> deployAnimalList;
|
||||
List<HomeNPCItem> 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();
|
||||
}
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
@ -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());
|
||||
|
@ -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());
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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<HomeModuleComfortInfoOuterClass.HomeModuleComfortInfo> 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()
|
||||
);
|
||||
}
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user