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
a93d7c57
Commit
a93d7c57
authored
May 02, 2022
by
Melledy
Browse files
Fix extra skill charges being removed if you teleport
Close #404
parent
7395a268
Changes
3
Show whitespace changes
Inline
Side-by-side
src/main/java/emu/grasscutter/game/player/TeamManager.java
View file @
a93d7c57
...
@@ -27,6 +27,7 @@ import emu.grasscutter.net.proto.MotionStateOuterClass.MotionState;
...
@@ -27,6 +27,7 @@ import emu.grasscutter.net.proto.MotionStateOuterClass.MotionState;
import
emu.grasscutter.server.packet.send.PacketAvatarDieAnimationEndRsp
;
import
emu.grasscutter.server.packet.send.PacketAvatarDieAnimationEndRsp
;
import
emu.grasscutter.server.packet.send.PacketAvatarFightPropUpdateNotify
;
import
emu.grasscutter.server.packet.send.PacketAvatarFightPropUpdateNotify
;
import
emu.grasscutter.server.packet.send.PacketAvatarLifeStateChangeNotify
;
import
emu.grasscutter.server.packet.send.PacketAvatarLifeStateChangeNotify
;
import
emu.grasscutter.server.packet.send.PacketAvatarSkillInfoNotify
;
import
emu.grasscutter.server.packet.send.PacketAvatarTeamUpdateNotify
;
import
emu.grasscutter.server.packet.send.PacketAvatarTeamUpdateNotify
;
import
emu.grasscutter.server.packet.send.PacketChangeAvatarRsp
;
import
emu.grasscutter.server.packet.send.PacketChangeAvatarRsp
;
import
emu.grasscutter.server.packet.send.PacketChangeMpTeamAvatarRsp
;
import
emu.grasscutter.server.packet.send.PacketChangeMpTeamAvatarRsp
;
...
@@ -263,6 +264,13 @@ public class TeamManager {
...
@@ -263,6 +264,13 @@ public class TeamManager {
// Packets
// Packets
getPlayer
().
getWorld
().
broadcastPacket
(
new
PacketSceneTeamUpdateNotify
(
getPlayer
()));
getPlayer
().
getWorld
().
broadcastPacket
(
new
PacketSceneTeamUpdateNotify
(
getPlayer
()));
// Skill charges packet - Yes, this is official server behavior as of 2.6.0
for
(
EntityAvatar
entity
:
getActiveTeam
())
{
if
(
entity
.
getAvatar
().
getSkillExtraChargeMap
().
size
()
>
0
)
{
getPlayer
().
sendPacket
(
new
PacketAvatarSkillInfoNotify
(
entity
.
getAvatar
()));
}
}
// Run callback
// Run callback
if
(
responsePacket
!=
null
)
{
if
(
responsePacket
!=
null
)
{
getPlayer
().
sendPacket
(
responsePacket
);
getPlayer
().
sendPacket
(
responsePacket
);
...
...
src/main/java/emu/grasscutter/game/world/Scene.java
View file @
a93d7c57
...
@@ -25,6 +25,7 @@ import emu.grasscutter.scripts.data.SceneBlock;
...
@@ -25,6 +25,7 @@ import emu.grasscutter.scripts.data.SceneBlock;
import
emu.grasscutter.scripts.data.SceneGadget
;
import
emu.grasscutter.scripts.data.SceneGadget
;
import
emu.grasscutter.scripts.data.SceneGroup
;
import
emu.grasscutter.scripts.data.SceneGroup
;
import
emu.grasscutter.scripts.data.ScriptArgs
;
import
emu.grasscutter.scripts.data.ScriptArgs
;
import
emu.grasscutter.server.packet.send.PacketAvatarSkillInfoNotify
;
import
emu.grasscutter.server.packet.send.PacketDungeonChallengeFinishNotify
;
import
emu.grasscutter.server.packet.send.PacketDungeonChallengeFinishNotify
;
import
emu.grasscutter.server.packet.send.PacketEntityFightPropUpdateNotify
;
import
emu.grasscutter.server.packet.send.PacketEntityFightPropUpdateNotify
;
import
emu.grasscutter.server.packet.send.PacketLifeStateChangeNotify
;
import
emu.grasscutter.server.packet.send.PacketLifeStateChangeNotify
;
...
@@ -271,6 +272,13 @@ public class Scene {
...
@@ -271,6 +272,13 @@ public class Scene {
}
}
this
.
addEntity
(
player
.
getTeamManager
().
getCurrentAvatarEntity
());
this
.
addEntity
(
player
.
getTeamManager
().
getCurrentAvatarEntity
());
// Notify the client of any extra skill charges
for
(
EntityAvatar
entity
:
player
.
getTeamManager
().
getActiveTeam
())
{
if
(
entity
.
getAvatar
().
getSkillExtraChargeMap
().
size
()
>
0
)
{
player
.
sendPacket
(
new
PacketAvatarSkillInfoNotify
(
entity
.
getAvatar
()));
}
}
}
}
private
void
addEntityDirectly
(
GameEntity
entity
)
{
private
void
addEntityDirectly
(
GameEntity
entity
)
{
...
...
src/main/java/emu/grasscutter/server/packet/send/PacketAvatarSkillInfoNotify.java
0 → 100644
View file @
a93d7c57
package
emu.grasscutter.server.packet.send
;
import
java.util.Map.Entry
;
import
emu.grasscutter.game.avatar.Avatar
;
import
emu.grasscutter.net.packet.BasePacket
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.AvatarSkillInfoNotifyOuterClass.AvatarSkillInfoNotify
;
import
emu.grasscutter.net.proto.AvatarSkillInfoOuterClass.AvatarSkillInfo
;
public
class
PacketAvatarSkillInfoNotify
extends
BasePacket
{
public
PacketAvatarSkillInfoNotify
(
Avatar
avatar
)
{
super
(
PacketOpcodes
.
AvatarSkillInfoNotify
);
AvatarSkillInfoNotify
.
Builder
proto
=
AvatarSkillInfoNotify
.
newBuilder
()
.
setGuid
(
avatar
.
getGuid
());
for
(
Entry
<
Integer
,
Integer
>
entry
:
avatar
.
getSkillExtraChargeMap
().
entrySet
())
{
proto
.
putSkillMap
(
entry
.
getKey
(),
AvatarSkillInfo
.
newBuilder
().
setMaxChargeCount
(
entry
.
getValue
()).
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