mirror of
https://github.com/Melledy/Grasscutter.git
synced 2024-11-27 07:34:27 +00:00
parent
5af7b8d2e8
commit
90787c659b
10
proto/AvatarSkillInfoNotify.proto
Normal file
10
proto/AvatarSkillInfoNotify.proto
Normal file
@ -0,0 +1,10 @@
|
||||
syntax = "proto3";
|
||||
|
||||
option java_package = "emu.grasscutter.net.proto";
|
||||
|
||||
import "AvatarSkillInfo.proto";
|
||||
|
||||
message AvatarSkillInfoNotify {
|
||||
uint64 guid = 1;
|
||||
map<uint32, AvatarSkillInfo> skill_map = 2;
|
||||
}
|
@ -27,6 +27,7 @@ import emu.grasscutter.net.proto.MotionStateOuterClass.MotionState;
|
||||
import emu.grasscutter.server.packet.send.PacketAvatarDieAnimationEndRsp;
|
||||
import emu.grasscutter.server.packet.send.PacketAvatarFightPropUpdateNotify;
|
||||
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.PacketChangeAvatarRsp;
|
||||
import emu.grasscutter.server.packet.send.PacketChangeMpTeamAvatarRsp;
|
||||
@ -263,6 +264,13 @@ public class TeamManager {
|
||||
// Packets
|
||||
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
|
||||
if (responsePacket != null) {
|
||||
getPlayer().sendPacket(responsePacket);
|
||||
|
@ -25,6 +25,7 @@ import emu.grasscutter.scripts.data.SceneBlock;
|
||||
import emu.grasscutter.scripts.data.SceneGadget;
|
||||
import emu.grasscutter.scripts.data.SceneGroup;
|
||||
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.PacketEntityFightPropUpdateNotify;
|
||||
import emu.grasscutter.server.packet.send.PacketLifeStateChangeNotify;
|
||||
@ -271,6 +272,13 @@ public class Scene {
|
||||
}
|
||||
|
||||
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) {
|
||||
|
@ -0,0 +1,25 @@
|
||||
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);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user