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
9fab2682
Commit
9fab2682
authored
Apr 23, 2022
by
Melledy
Committed by
GitHub
Apr 23, 2022
Browse files
Merge pull request #153 from TheLostTree/main
Handle drowning
parents
20e9e775
31f617e7
Changes
3
Hide whitespace changes
Inline
Side-by-side
Grasscutter-Protos
@
dd17415b
Compare
0537e9cc
...
dd17415b
Subproject commit
0537e9cc4c7856a7c6f88bbbaa908a80c4ee677
e
Subproject commit
dd17415b71dfcff049e72dbe8a76173611f4b0a
e
src/main/java/emu/grasscutter/server/packet/recv/HandlerSceneEntityDrownReq.java
0 → 100644
View file @
9fab2682
package
emu.grasscutter.server.packet.recv
;
import
emu.grasscutter.game.entity.GenshinEntity
;
import
emu.grasscutter.game.props.LifeState
;
import
emu.grasscutter.net.packet.Opcodes
;
import
emu.grasscutter.net.packet.PacketHandler
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.SceneEntityDrownReqOuterClass.SceneEntityDrownReq
;
import
emu.grasscutter.net.proto.VisionTypeOuterClass
;
import
emu.grasscutter.server.game.GameSession
;
import
emu.grasscutter.server.packet.send.PacketLifeStateChangeNotify
;
import
emu.grasscutter.server.packet.send.PacketSceneEntityDrownRsp
;
@Opcodes
(
PacketOpcodes
.
SceneEntityDrownReq
)
public
class
HandlerSceneEntityDrownReq
extends
PacketHandler
{
@Override
public
void
handle
(
GameSession
session
,
byte
[]
header
,
byte
[]
payload
)
throws
Exception
{
SceneEntityDrownReq
req
=
SceneEntityDrownReq
.
parseFrom
(
payload
);
GenshinEntity
entity
=
session
.
getPlayer
().
getScene
().
getEntityById
(
req
.
getEntityId
());
PacketLifeStateChangeNotify
lifeStateChangeNotify
=
new
PacketLifeStateChangeNotify
(
entity
,
entity
,
LifeState
.
LIFE_DEAD
);
PacketSceneEntityDrownRsp
drownRsp
=
new
PacketSceneEntityDrownRsp
(
req
.
getEntityId
());
//kill entity + broadcast it
session
.
getPlayer
().
getScene
().
broadcastPacket
(
lifeStateChangeNotify
);
session
.
getPlayer
().
getScene
().
broadcastPacket
(
drownRsp
);
//TODO: make a list somewhere of all entities to remove per tick rather than one by one
session
.
getPlayer
().
getScene
().
removeEntity
(
entity
,
VisionTypeOuterClass
.
VisionType
.
VisionDie
);
}
}
src/main/java/emu/grasscutter/server/packet/send/PacketSceneEntityDrownRsp.java
0 → 100644
View file @
9fab2682
package
emu.grasscutter.server.packet.send
;
import
emu.grasscutter.game.entity.GenshinEntity
;
import
emu.grasscutter.net.packet.GenshinPacket
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.SceneEntityDrownRspOuterClass.SceneEntityDrownRsp
;
import
emu.grasscutter.net.proto.VisionTypeOuterClass.VisionType
;
public
class
PacketSceneEntityDrownRsp
extends
GenshinPacket
{
public
PacketSceneEntityDrownRsp
(
int
entityId
)
{
super
(
PacketOpcodes
.
SceneEntityDrownRsp
);
SceneEntityDrownRsp
proto
=
new
SceneEntityDrownRsp
().
toBuilder
().
setEntityId
(
entityId
).
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