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
d05b3207
Commit
d05b3207
authored
Aug 04, 2022
by
Magix
Committed by
GitHub
Aug 04, 2022
Browse files
Add more events
Merge pull request #1516 from Grasscutters/more-events
parents
9a104f6f
a3e0f7f5
Changes
23
Show whitespace changes
Inline
Side-by-side
src/main/java/emu/grasscutter/server/packet/recv/HandlerSceneTransToPointReq.java
View file @
d05b3207
...
@@ -5,8 +5,8 @@ import emu.grasscutter.data.binout.ScenePointEntry;
...
@@ -5,8 +5,8 @@ import emu.grasscutter.data.binout.ScenePointEntry;
import
emu.grasscutter.net.packet.Opcodes
;
import
emu.grasscutter.net.packet.Opcodes
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.SceneTransToPointReqOuterClass.SceneTransToPointReq
;
import
emu.grasscutter.net.proto.SceneTransToPointReqOuterClass.SceneTransToPointReq
;
import
emu.grasscutter.net.proto.SceneTransToPointRspOuterClass.SceneTransToPointRsp
;
import
emu.grasscutter.net.packet.PacketHandler
;
import
emu.grasscutter.net.packet.PacketHandler
;
import
emu.grasscutter.server.event.player.PlayerTeleportEvent.TeleportType
;
import
emu.grasscutter.server.game.GameSession
;
import
emu.grasscutter.server.game.GameSession
;
import
emu.grasscutter.server.packet.send.PacketSceneTransToPointRsp
;
import
emu.grasscutter.server.packet.send.PacketSceneTransToPointRsp
;
import
emu.grasscutter.utils.Position
;
import
emu.grasscutter.utils.Position
;
...
@@ -26,8 +26,9 @@ public class HandlerSceneTransToPointReq extends PacketHandler {
...
@@ -26,8 +26,9 @@ public class HandlerSceneTransToPointReq extends PacketHandler {
float
y
=
scenePointEntry
.
getPointData
().
getTranPos
().
getY
();
float
y
=
scenePointEntry
.
getPointData
().
getTranPos
().
getY
();
float
z
=
scenePointEntry
.
getPointData
().
getTranPos
().
getZ
();
float
z
=
scenePointEntry
.
getPointData
().
getTranPos
().
getZ
();
session
.
getPlayer
().
getWorld
().
transferPlayerToScene
(
session
.
getPlayer
(),
req
.
getSceneId
(),
new
Position
(
x
,
y
,
z
))
;
if
(
session
.
getPlayer
().
getWorld
().
transferPlayerToScene
(
session
.
getPlayer
(),
req
.
getSceneId
(),
TeleportType
.
WAYPOINT
,
new
Position
(
x
,
y
,
z
))
)
{
session
.
send
(
new
PacketSceneTransToPointRsp
(
session
.
getPlayer
(),
req
.
getPointId
(),
req
.
getSceneId
()));
session
.
send
(
new
PacketSceneTransToPointRsp
(
session
.
getPlayer
(),
req
.
getPointId
(),
req
.
getSceneId
()));
}
}
else
{
}
else
{
session
.
send
(
new
PacketSceneTransToPointRsp
());
session
.
send
(
new
PacketSceneTransToPointRsp
());
}
}
...
...
src/main/java/emu/grasscutter/server/packet/recv/HandlerTryEnterHomeReq.java
View file @
d05b3207
package
emu.grasscutter.server.packet.recv
;
package
emu.grasscutter.server.packet.recv
;
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
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.TryEnterHomeReqOuterClass
;
import
emu.grasscutter.net.proto.TryEnterHomeReqOuterClass
;
import
emu.grasscutter.s
cripts.data.SceneConfig
;
import
emu.grasscutter.s
erver.event.player.PlayerTeleportEvent.TeleportType
;
import
emu.grasscutter.server.game.GameSession
;
import
emu.grasscutter.server.game.GameSession
;
import
emu.grasscutter.server.packet.send.PacketTryEnterHomeRsp
;
import
emu.grasscutter.server.packet.send.PacketTryEnterHomeRsp
;
import
emu.grasscutter.utils.Position
;
import
emu.grasscutter.utils.Position
;
...
@@ -38,13 +35,10 @@ public class HandlerTryEnterHomeReq extends PacketHandler {
...
@@ -38,13 +35,10 @@ public class HandlerTryEnterHomeReq extends PacketHandler {
Scene
scene
=
session
.
getPlayer
().
getWorld
().
getSceneById
(
realmId
);
Scene
scene
=
session
.
getPlayer
().
getWorld
().
getSceneById
(
realmId
);
Position
pos
=
scene
.
getScriptManager
().
getConfig
().
born_pos
;
Position
pos
=
scene
.
getScriptManager
().
getConfig
().
born_pos
;
session
.
getPlayer
().
getWorld
().
transferPlayerToScene
(
boolean
result
=
session
.
getPlayer
().
getWorld
().
transferPlayerToScene
(
session
.
getPlayer
(),
session
.
getPlayer
(),
realmId
,
realmId
,
TeleportType
.
WAYPOINT
,
pos
pos
);
);
if
(
result
)
session
.
send
(
new
PacketTryEnterHomeRsp
(
req
.
getTargetUid
()));
session
.
send
(
new
PacketTryEnterHomeRsp
(
req
.
getTargetUid
()));
}
}
}
}
src/main/java/emu/grasscutter/utils/Location.java
0 → 100644
View file @
d05b3207
package
emu.grasscutter.utils
;
import
dev.morphia.annotations.Entity
;
import
dev.morphia.annotations.Transient
;
import
emu.grasscutter.game.world.Scene
;
import
lombok.Getter
;
import
lombok.Setter
;
@Entity
public
class
Location
extends
Position
{
@Transient
@Getter
@Setter
private
Scene
scene
;
public
Location
(
Scene
scene
,
Position
position
)
{
this
.
set
(
position
);
this
.
scene
=
scene
;
}
public
Location
(
Scene
scene
,
float
x
,
float
y
)
{
this
.
set
(
x
,
y
);
this
.
scene
=
scene
;
}
public
Location
(
Scene
scene
,
float
x
,
float
y
,
float
z
)
{
this
.
set
(
x
,
y
,
z
);
this
.
scene
=
scene
;
}
@Override
public
Location
clone
()
{
return
new
Location
(
this
.
scene
,
super
.
clone
());
}
@Override
public
String
toString
()
{
return
String
.
format
(
"%s:%s,%s,%s"
,
this
.
scene
.
getId
(),
this
.
getX
(),
this
.
getY
(),
this
.
getZ
());
}
}
\ No newline at end of file
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