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
a21fc116
Commit
a21fc116
authored
May 05, 2022
by
Akka
Browse files
Support of Enter Room Scene
parent
e693612e
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/main/java/emu/grasscutter/data/common/PointData.java
View file @
a21fc116
...
...
@@ -13,7 +13,8 @@ public class PointData {
private
Position
tranPos
;
private
int
[]
dungeonIds
;
private
int
[]
dungeonRandomList
;
private
int
tranSceneId
;
public
int
getId
()
{
return
id
;
}
...
...
@@ -38,6 +39,14 @@ public class PointData {
return
dungeonRandomList
;
}
public
int
getTranSceneId
()
{
return
tranSceneId
;
}
public
void
setTranSceneId
(
int
tranSceneId
)
{
this
.
tranSceneId
=
tranSceneId
;
}
public
void
updateDailyDungeon
()
{
if
(
getDungeonRandomList
()
==
null
)
{
return
;
...
...
src/main/java/emu/grasscutter/server/packet/recv/HandlerPersonalSceneJumpReq.java
0 → 100644
View file @
a21fc116
package
emu.grasscutter.server.packet.recv
;
import
emu.grasscutter.data.GameData
;
import
emu.grasscutter.data.custom.ScenePointEntry
;
import
emu.grasscutter.net.packet.Opcodes
;
import
emu.grasscutter.net.packet.PacketHandler
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.PersonalSceneJumpReqOuterClass.PersonalSceneJumpReq
;
import
emu.grasscutter.server.game.GameSession
;
import
emu.grasscutter.server.packet.send.PacketPersonalSceneJumpRsp
;
import
emu.grasscutter.utils.Position
;
@Opcodes
(
PacketOpcodes
.
PersonalSceneJumpReq
)
public
class
HandlerPersonalSceneJumpReq
extends
PacketHandler
{
@Override
public
void
handle
(
GameSession
session
,
byte
[]
header
,
byte
[]
payload
)
throws
Exception
{
PersonalSceneJumpReq
req
=
PersonalSceneJumpReq
.
parseFrom
(
payload
);
// get the scene point
String
code
=
session
.
getPlayer
().
getSceneId
()
+
"_"
+
req
.
getPointId
();
ScenePointEntry
scenePointEntry
=
GameData
.
getScenePointEntries
().
get
(
code
);
if
(
scenePointEntry
!=
null
)
{
float
x
=
scenePointEntry
.
getPointData
().
getTranPos
().
getX
();
float
y
=
scenePointEntry
.
getPointData
().
getTranPos
().
getY
();
float
z
=
scenePointEntry
.
getPointData
().
getTranPos
().
getZ
();
Position
pos
=
new
Position
(
x
,
y
,
z
);
int
sceneId
=
scenePointEntry
.
getPointData
().
getTranSceneId
();
session
.
getPlayer
().
getWorld
().
transferPlayerToScene
(
session
.
getPlayer
(),
sceneId
,
pos
);
session
.
send
(
new
PacketPersonalSceneJumpRsp
(
sceneId
,
pos
));
}
}
}
src/main/java/emu/grasscutter/server/packet/send/PacketPersonalSceneJumpRsp.java
0 → 100644
View file @
a21fc116
package
emu.grasscutter.server.packet.send
;
import
emu.grasscutter.net.packet.BasePacket
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.PersonalSceneJumpRspOuterClass.PersonalSceneJumpRsp
;
import
emu.grasscutter.utils.Position
;
public
class
PacketPersonalSceneJumpRsp
extends
BasePacket
{
public
PacketPersonalSceneJumpRsp
(
int
sceneId
,
Position
pos
)
{
super
(
PacketOpcodes
.
PersonalSceneJumpRsp
);
PersonalSceneJumpRsp
proto
=
PersonalSceneJumpRsp
.
newBuilder
()
.
setDestSceneId
(
sceneId
)
.
setDestPos
(
pos
.
toProto
())
.
build
();
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