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
e16633e3
Commit
e16633e3
authored
Jun 14, 2022
by
Akka
Committed by
Melledy
Jun 17, 2022
Browse files
Implement the Home System (Serenitea Pot)
parent
399275e8
Changes
38
Hide whitespace changes
Inline
Side-by-side
src/main/java/emu/grasscutter/server/packet/recv/HandlerHomeGetBasicInfoReq.java
0 → 100644
View file @
e16633e3
package
emu.grasscutter.server.packet.recv
;
import
emu.grasscutter.net.packet.Opcodes
;
import
emu.grasscutter.net.packet.PacketHandler
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.server.game.GameSession
;
import
emu.grasscutter.server.packet.send.PacketHomeBasicInfoNotify
;
@Opcodes
(
PacketOpcodes
.
HomeGetBasicInfoReq
)
public
class
HandlerHomeGetBasicInfoReq
extends
PacketHandler
{
@Override
public
void
handle
(
GameSession
session
,
byte
[]
header
,
byte
[]
payload
)
throws
Exception
{
session
.
send
(
new
PacketHomeBasicInfoNotify
(
session
.
getPlayer
(),
false
));
}
}
src/main/java/emu/grasscutter/server/packet/recv/HandlerHomeSceneInitFinishReq.java
0 → 100644
View file @
e16633e3
package
emu.grasscutter.server.packet.recv
;
import
emu.grasscutter.net.packet.Opcodes
;
import
emu.grasscutter.net.packet.PacketHandler
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.server.game.GameSession
;
import
emu.grasscutter.server.packet.send.PacketHomeSceneInitFinishRsp
;
@Opcodes
(
PacketOpcodes
.
HomeSceneInitFinishReq
)
public
class
HandlerHomeSceneInitFinishReq
extends
PacketHandler
{
@Override
public
void
handle
(
GameSession
session
,
byte
[]
header
,
byte
[]
payload
)
throws
Exception
{
session
.
send
(
new
PacketHomeSceneInitFinishRsp
());
}
}
src/main/java/emu/grasscutter/server/packet/recv/HandlerHomeSceneJumpReq.java
0 → 100644
View file @
e16633e3
package
emu.grasscutter.server.packet.recv
;
import
emu.grasscutter.net.packet.Opcodes
;
import
emu.grasscutter.net.packet.PacketHandler
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.HomeSceneJumpReqOuterClass
;
import
emu.grasscutter.server.game.GameSession
;
import
emu.grasscutter.server.packet.send.PacketHomeSceneJumpRsp
;
@Opcodes
(
PacketOpcodes
.
HomeSceneJumpReq
)
public
class
HandlerHomeSceneJumpReq
extends
PacketHandler
{
@Override
public
void
handle
(
GameSession
session
,
byte
[]
header
,
byte
[]
payload
)
throws
Exception
{
var
req
=
HomeSceneJumpReqOuterClass
.
HomeSceneJumpReq
.
parseFrom
(
payload
);
int
realmId
=
2000
+
session
.
getPlayer
().
getCurrentRealmId
();
var
home
=
session
.
getPlayer
().
getHome
();
var
homeScene
=
home
.
getHomeSceneItem
(
realmId
);
home
.
save
();
if
(
req
.
getIsEnterRoomScene
()){
var
roomScene
=
home
.
getHomeSceneItem
(
homeScene
.
getRoomSceneId
());
session
.
getPlayer
().
getWorld
().
transferPlayerToScene
(
session
.
getPlayer
(),
homeScene
.
getRoomSceneId
(),
roomScene
.
getBornPos
()
);
}
else
{
session
.
getPlayer
().
getWorld
().
transferPlayerToScene
(
session
.
getPlayer
(),
realmId
,
homeScene
.
getBornPos
()
);
}
session
.
send
(
new
PacketHomeSceneJumpRsp
(
req
.
getIsEnterRoomScene
()));
}
}
src/main/java/emu/grasscutter/server/packet/recv/HandlerHomeUnknown2Req.java
0 → 100644
View file @
e16633e3
package
emu.grasscutter.server.packet.recv
;
import
emu.grasscutter.net.packet.Opcodes
;
import
emu.grasscutter.net.packet.PacketHandler
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.server.game.GameSession
;
import
emu.grasscutter.server.packet.send.PacketHomeUnknown2Rsp
;
@Opcodes
(
PacketOpcodes
.
HomeUnknown2Req
)
public
class
HandlerHomeUnknown2Req
extends
PacketHandler
{
@Override
public
void
handle
(
GameSession
session
,
byte
[]
header
,
byte
[]
payload
)
throws
Exception
{
/*
* This packet is about the edit mode
*/
session
.
send
(
new
PacketHomeUnknown2Rsp
());
}
}
src/main/java/emu/grasscutter/server/packet/recv/HandlerHomeUpdateArrangementInfoReq.java
0 → 100644
View file @
e16633e3
package
emu.grasscutter.server.packet.recv
;
import
emu.grasscutter.net.packet.Opcodes
;
import
emu.grasscutter.net.packet.PacketHandler
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.HomeUpdateArrangementInfoReqOuterClass
;
import
emu.grasscutter.server.game.GameSession
;
import
emu.grasscutter.server.packet.send.PacketHomeUpdateArrangementInfoRsp
;
@Opcodes
(
PacketOpcodes
.
HomeUpdateArrangementInfoReq
)
public
class
HandlerHomeUpdateArrangementInfoReq
extends
PacketHandler
{
@Override
public
void
handle
(
GameSession
session
,
byte
[]
header
,
byte
[]
payload
)
throws
Exception
{
var
req
=
HomeUpdateArrangementInfoReqOuterClass
.
HomeUpdateArrangementInfoReq
.
parseFrom
(
payload
);
var
homeScene
=
session
.
getPlayer
().
getHome
()
.
getHomeSceneItem
(
session
.
getPlayer
().
getSceneId
());
homeScene
.
update
(
req
.
getSceneArrangementInfo
());
session
.
getPlayer
().
getHome
().
save
();
session
.
send
(
new
PacketHomeUpdateArrangementInfoRsp
());
}
}
src/main/java/emu/grasscutter/server/packet/recv/HandlerTryEnterHomeReq.java
View file @
e16633e3
package
emu.grasscutter.server.packet.recv
;
package
emu.grasscutter.server.packet.recv
;
import
emu.grasscutter.data.GameData
;
import
emu.grasscutter.data.GameData
;
import
emu.grasscutter.database.DatabaseHelper
;
import
emu.grasscutter.game.home.GameHome
;
import
emu.grasscutter.game.world.Scene
;
import
emu.grasscutter.game.world.Scene
;
import
emu.grasscutter.net.packet.Opcodes
;
import
emu.grasscutter.net.packet.Opcodes
;
import
emu.grasscutter.net.packet.PacketHandler
;
import
emu.grasscutter.net.packet.PacketHandler
;
...
@@ -27,13 +29,14 @@ public class HandlerTryEnterHomeReq extends PacketHandler {
...
@@ -27,13 +29,14 @@ public class HandlerTryEnterHomeReq extends PacketHandler {
int
realmId
=
2000
+
session
.
getPlayer
().
getCurrentRealmId
();
int
realmId
=
2000
+
session
.
getPlayer
().
getCurrentRealmId
();
Scene
scene
=
session
.
getPlayer
().
getWorld
().
getSceneById
(
realmId
);
var
home
=
session
.
getPlayer
().
getHome
();
Position
pos
=
scene
.
getScriptManager
().
getConfig
().
born_pos
;
var
homeScene
=
home
.
getHomeSceneItem
(
realmId
);
home
.
save
();
session
.
getPlayer
().
getWorld
().
transferPlayerToScene
(
session
.
getPlayer
().
getWorld
().
transferPlayerToScene
(
session
.
getPlayer
(),
session
.
getPlayer
(),
realmId
,
realmId
,
pos
homeScene
.
getBornPos
()
);
);
...
...
src/main/java/emu/grasscutter/server/packet/send/PacketFurnitureCurModuleArrangeCountNotify.java
0 → 100644
View file @
e16633e3
package
emu.grasscutter.server.packet.send
;
import
emu.grasscutter.net.packet.BasePacket
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.FurnitureCurModuleArrangeCountNotifyOuterClass
;
import
emu.grasscutter.net.proto.Uint32PairOuterClass
;
public
class
PacketFurnitureCurModuleArrangeCountNotify
extends
BasePacket
{
public
PacketFurnitureCurModuleArrangeCountNotify
()
{
super
(
PacketOpcodes
.
FurnitureCurModuleArrangeCountNotify
);
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
());
this
.
setData
(
proto
);
}
}
src/main/java/emu/grasscutter/server/packet/send/PacketHomeBasicInfoNotify.java
0 → 100644
View file @
e16633e3
package
emu.grasscutter.server.packet.send
;
import
emu.grasscutter.game.player.Player
;
import
emu.grasscutter.net.packet.BasePacket
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.HomeBasicInfoNotifyOuterClass
;
import
emu.grasscutter.net.proto.HomeBasicInfoOuterClass
;
import
emu.grasscutter.net.proto.HomeLimitedShopInfoOuterClass
;
import
emu.grasscutter.net.proto.VectorOuterClass
;
public
class
PacketHomeBasicInfoNotify
extends
BasePacket
{
public
PacketHomeBasicInfoNotify
(
Player
player
,
boolean
editMode
)
{
super
(
PacketOpcodes
.
HomeBasicInfoNotify
);
if
(
player
.
getCurrentRealmId
()
==
null
){
return
;
}
var
proto
=
HomeBasicInfoNotifyOuterClass
.
HomeBasicInfoNotify
.
newBuilder
();
var
sceneId
=
player
.
getCurrentRealmId
()
+
2000
;
var
homeScene
=
player
.
getHome
().
getHomeSceneItem
(
sceneId
);
proto
.
setBasicInfo
(
HomeBasicInfoOuterClass
.
HomeBasicInfo
.
newBuilder
()
.
setCurModuleId
(
player
.
getCurrentRealmId
())
.
setCurRoomSceneId
(
homeScene
.
getRoomSceneId
())
.
setIsInEditMode
(
editMode
)
.
setHomeOwnerUid
(
player
.
getUid
())
.
setLevel
(
1
)
.
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
())
.
build
());
this
.
setData
(
proto
);
}
}
src/main/java/emu/grasscutter/server/packet/send/PacketHomeChangeEditModeRsp.java
0 → 100644
View file @
e16633e3
package
emu.grasscutter.server.packet.send
;
import
emu.grasscutter.net.packet.BasePacket
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.HomeChangeEditModeRspOuterClass
;
public
class
PacketHomeChangeEditModeRsp
extends
BasePacket
{
public
PacketHomeChangeEditModeRsp
(
boolean
enterEditMode
)
{
super
(
PacketOpcodes
.
HomeChangeEditModeRsp
);
var
proto
=
HomeChangeEditModeRspOuterClass
.
HomeChangeEditModeRsp
.
newBuilder
();
proto
.
setIsEnterEditMode
(
enterEditMode
);
this
.
setData
(
proto
);
}
}
src/main/java/emu/grasscutter/server/packet/send/PacketHomeComfortInfoNotify.java
View file @
e16633e3
...
@@ -25,6 +25,11 @@ public class PacketHomeComfortInfoNotify extends BasePacket {
...
@@ -25,6 +25,11 @@ public class PacketHomeComfortInfoNotify extends BasePacket {
comfortInfoList
.
add
(
comfortInfoList
.
add
(
HomeModuleComfortInfoOuterClass
.
HomeModuleComfortInfo
.
newBuilder
()
HomeModuleComfortInfoOuterClass
.
HomeModuleComfortInfo
.
newBuilder
()
.
setModuleId
(
moduleId
)
.
setModuleId
(
moduleId
)
.
setRoomSceneComfortValue
(
1050
)
.
addWorldSceneBlockComfortValueList
(
750
)
.
addWorldSceneBlockComfortValueList
(
0
)
.
addWorldSceneBlockComfortValueList
(
0
)
.
addWorldSceneBlockComfortValueList
(
0
)
.
build
()
.
build
()
);
);
}
}
...
...
src/main/java/emu/grasscutter/server/packet/send/PacketHomeGetArrangementInfoRsp.java
0 → 100644
View file @
e16633e3
package
emu.grasscutter.server.packet.send
;
import
emu.grasscutter.game.home.HomeSceneItem
;
import
emu.grasscutter.game.player.Player
;
import
emu.grasscutter.net.packet.BasePacket
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.HomeGetArrangementInfoRspOuterClass
;
import
java.util.List
;
public
class
PacketHomeGetArrangementInfoRsp
extends
BasePacket
{
public
PacketHomeGetArrangementInfoRsp
(
Player
player
,
List
<
Integer
>
sceneIdList
)
{
super
(
PacketOpcodes
.
HomeGetArrangementInfoRsp
);
var
home
=
player
.
getHome
();
var
homeScenes
=
sceneIdList
.
stream
()
.
map
(
home:
:
getHomeSceneItem
)
.
map
(
HomeSceneItem:
:
toProto
)
.
toList
();
home
.
save
();
var
proto
=
HomeGetArrangementInfoRspOuterClass
.
HomeGetArrangementInfoRsp
.
newBuilder
();
proto
.
addAllSceneArrangementInfoList
(
homeScenes
);
this
.
setData
(
proto
);
}
}
src/main/java/emu/grasscutter/server/packet/send/PacketHomeMarkPointNotify.java
0 → 100644
View file @
e16633e3
package
emu.grasscutter.server.packet.send
;
import
emu.grasscutter.game.home.GameHome
;
import
emu.grasscutter.game.player.Player
;
import
emu.grasscutter.net.packet.BasePacket
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.HomeMarkPointNotifyOuterClass
;
public
class
PacketHomeMarkPointNotify
extends
BasePacket
{
public
PacketHomeMarkPointNotify
(
Player
player
,
GameHome
home
)
{
super
(
PacketOpcodes
.
HomeMarkPointNotify
);
var
proto
=
HomeMarkPointNotifyOuterClass
.
HomeMarkPointNotify
.
newBuilder
();
this
.
setData
(
proto
);
}
}
src/main/java/emu/grasscutter/server/packet/send/PacketHomeSceneInitFinishRsp.java
0 → 100644
View file @
e16633e3
package
emu.grasscutter.server.packet.send
;
import
emu.grasscutter.net.packet.BasePacket
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.HomeSceneArrangementInfoOuterClass
;
public
class
PacketHomeSceneInitFinishRsp
extends
BasePacket
{
public
PacketHomeSceneInitFinishRsp
()
{
super
(
PacketOpcodes
.
HomeSceneInitFinishRsp
);
var
proto
=
HomeSceneArrangementInfoOuterClass
.
HomeSceneArrangementInfo
.
newBuilder
();
this
.
setData
(
proto
);
}
}
src/main/java/emu/grasscutter/server/packet/send/PacketHomeSceneJumpRsp.java
0 → 100644
View file @
e16633e3
package
emu.grasscutter.server.packet.send
;
import
emu.grasscutter.net.packet.BasePacket
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.HomeSceneJumpRspOuterClass
;
public
class
PacketHomeSceneJumpRsp
extends
BasePacket
{
public
PacketHomeSceneJumpRsp
(
boolean
enterRoomScene
)
{
super
(
PacketOpcodes
.
HomeSceneJumpRsp
);
var
proto
=
HomeSceneJumpRspOuterClass
.
HomeSceneJumpRsp
.
newBuilder
();
proto
.
setIsEnterRoomScene
(
enterRoomScene
);
this
.
setData
(
proto
);
}
}
src/main/java/emu/grasscutter/server/packet/send/PacketHomeUnknown1Notify.java
0 → 100644
View file @
e16633e3
package
emu.grasscutter.server.packet.send
;
import
emu.grasscutter.net.packet.BasePacket
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.HomeUnknown1NotifyOuterClass
;
public
class
PacketHomeUnknown1Notify
extends
BasePacket
{
public
PacketHomeUnknown1Notify
(
boolean
isEnterEditMode
)
{
super
(
PacketOpcodes
.
HomeUnknown1Notify
);
var
proto
=
HomeUnknown1NotifyOuterClass
.
HomeUnknown1Notify
.
newBuilder
();
proto
.
setIsEnterEditMode
(
isEnterEditMode
);
this
.
setData
(
proto
);
}
}
src/main/java/emu/grasscutter/server/packet/send/PacketHomeUnknown2Rsp.java
0 → 100644
View file @
e16633e3
package
emu.grasscutter.server.packet.send
;
import
emu.grasscutter.net.packet.BasePacket
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
public
class
PacketHomeUnknown2Rsp
extends
BasePacket
{
public
PacketHomeUnknown2Rsp
()
{
super
(
PacketOpcodes
.
HomeUnknown2Rsp
);
}
}
src/main/java/emu/grasscutter/server/packet/send/PacketHomeUpdateArrangementInfoRsp.java
0 → 100644
View file @
e16633e3
package
emu.grasscutter.server.packet.send
;
import
emu.grasscutter.net.packet.BasePacket
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
public
class
PacketHomeUpdateArrangementInfoRsp
extends
BasePacket
{
public
PacketHomeUpdateArrangementInfoRsp
()
{
super
(
PacketOpcodes
.
HomeUpdateArrangementInfoRsp
);
}
}
src/main/java/emu/grasscutter/server/packet/send/PacketUnlockedFurnitureFormulaDataNotify.java
0 → 100644
View file @
e16633e3
package
emu.grasscutter.server.packet.send
;
import
emu.grasscutter.net.packet.BasePacket
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.UnlockedFurnitureFormulaDataNotifyOuterClass
;
public
class
PacketUnlockedFurnitureFormulaDataNotify
extends
BasePacket
{
public
PacketUnlockedFurnitureFormulaDataNotify
()
{
super
(
PacketOpcodes
.
UnlockedFurnitureFormulaDataNotify
);
var
proto
=
UnlockedFurnitureFormulaDataNotifyOuterClass
.
UnlockedFurnitureFormulaDataNotify
.
newBuilder
();
proto
.
addFurnitureIdList
(
361207
);
proto
.
addFurnitureIdList
(
362202
);
proto
.
addFurnitureIdList
(
362304
);
proto
.
addFurnitureIdList
(
363102
);
proto
.
addFurnitureIdList
(
363103
);
proto
.
addFurnitureIdList
(
363203
);
proto
.
addFurnitureIdList
(
370201
);
proto
.
addFurnitureIdList
(
370302
);
proto
.
setIsAll
(
true
);
this
.
setData
(
proto
);
}
}
Prev
1
2
Next
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