mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2025-12-22 20:04:56 +01:00
Refactor avatar skilldepot and constellation/talent changing
Ensures Traveler retains talent levels and constellations on inactive elements when switching elements. Relevant for any other skillDepot-changing activities like Windtrace too, though keeping those in the db might not be as useful. Refactor avatar talent upgrade and access Refactor skillExtraCharges
This commit is contained in:
@@ -1,25 +1,20 @@
|
||||
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;
|
||||
import it.unimi.dsi.fastutil.ints.Int2IntMap;
|
||||
|
||||
public class PacketAvatarSkillInfoNotify extends BasePacket {
|
||||
|
||||
public PacketAvatarSkillInfoNotify(Avatar avatar) {
|
||||
super(PacketOpcodes.AvatarSkillInfoNotify);
|
||||
public PacketAvatarSkillInfoNotify(long avatarGuid, Int2IntMap skillExtraChargeMap) {
|
||||
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);
|
||||
}
|
||||
var proto = AvatarSkillInfoNotify.newBuilder().setGuid(avatarGuid);
|
||||
|
||||
skillExtraChargeMap.forEach((skillId, count) ->
|
||||
proto.putSkillMap(skillId, AvatarSkillInfo.newBuilder().setMaxChargeCount(count).build()));
|
||||
|
||||
this.setData(proto);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user