Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
ziqian zhang
Grasscutter
Commits
247412b1
Commit
247412b1
authored
Jun 17, 2022
by
Akka
Committed by
Melledy
Jun 17, 2022
Browse files
fix the rot of furniture
parent
211d7d6f
Changes
8
Show whitespace changes
Inline
Side-by-side
src/main/java/emu/grasscutter/game/home/HomeBlockItem.java
View file @
247412b1
...
@@ -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
();
}
}
}
}
src/main/java/emu/grasscutter/game/home/HomeFurnitureItem.java
View file @
247412b1
...
@@ -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
();
}
}
...
...
src/main/java/emu/grasscutter/game/home/HomeSceneItem.java
View file @
247412b1
...
@@ -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
());
...
...
src/main/java/emu/grasscutter/game/managers/FurnitureManager.java
View file @
247412b1
...
@@ -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
());
...
...
src/main/java/emu/grasscutter/server/packet/send/PacketFurnitureCurModuleArrangeCountNotify.java
View file @
247412b1
...
@@ -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
);
}
}
...
...
src/main/java/emu/grasscutter/server/packet/send/PacketHomeBasicInfoNotify.java
View file @
247412b1
...
@@ -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
);
...
...
src/main/java/emu/grasscutter/server/packet/send/PacketHomeComfortInfoNotify.java
View file @
247412b1
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
()
);
);
}
}
...
...
src/main/java/emu/grasscutter/server/packet/send/PacketHomeSceneInitFinishRsp.java
View file @
247412b1
...
@@ -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
=
HomeScene
ArrangementInfo
OuterClass
.
HomeScene
ArrangementInfo
.
newBuilder
();
var
proto
=
HomeScene
InitFinishReq
OuterClass
.
HomeScene
InitFinishReq
.
newBuilder
();
this
.
setData
(
proto
);
this
.
setData
(
proto
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment