2022-04-17 12:43:07 +00:00
|
|
|
package emu.grasscutter.server.packet.send;
|
|
|
|
|
2022-04-27 04:21:57 +00:00
|
|
|
import emu.grasscutter.game.avatar.Avatar;
|
2022-04-17 12:43:07 +00:00
|
|
|
import emu.grasscutter.game.inventory.EquipType;
|
2022-04-27 04:21:57 +00:00
|
|
|
import emu.grasscutter.game.inventory.GameItem;
|
|
|
|
import emu.grasscutter.net.packet.BasePacket;
|
2022-04-17 12:43:07 +00:00
|
|
|
import emu.grasscutter.net.packet.PacketOpcodes;
|
|
|
|
import emu.grasscutter.net.proto.AvatarEquipChangeNotifyOuterClass.AvatarEquipChangeNotify;
|
|
|
|
|
2022-04-27 04:21:57 +00:00
|
|
|
public class PacketAvatarEquipChangeNotify extends BasePacket {
|
2022-04-17 12:43:07 +00:00
|
|
|
|
2022-04-27 04:21:57 +00:00
|
|
|
public PacketAvatarEquipChangeNotify(Avatar avatar, GameItem item) {
|
2022-04-17 12:43:07 +00:00
|
|
|
super(PacketOpcodes.AvatarEquipChangeNotify);
|
|
|
|
|
|
|
|
AvatarEquipChangeNotify.Builder proto = AvatarEquipChangeNotify.newBuilder()
|
|
|
|
.setAvatarGuid(avatar.getGuid())
|
|
|
|
.setEquipType(item.getEquipSlot())
|
|
|
|
.setItemId(item.getItemId())
|
|
|
|
.setEquipGuid(item.getGuid());
|
|
|
|
|
|
|
|
if (item.getItemData().getEquipType() == EquipType.EQUIP_WEAPON) {
|
|
|
|
proto.setWeapon(item.createSceneWeaponInfo());
|
|
|
|
} else {
|
|
|
|
proto.setReliquary(item.createSceneReliquaryInfo());
|
|
|
|
}
|
|
|
|
|
|
|
|
this.setData(proto);
|
|
|
|
}
|
|
|
|
|
2022-04-27 04:21:57 +00:00
|
|
|
public PacketAvatarEquipChangeNotify(Avatar avatar, EquipType slot) {
|
2022-04-17 12:43:07 +00:00
|
|
|
super(PacketOpcodes.AvatarEquipChangeNotify);
|
|
|
|
|
|
|
|
AvatarEquipChangeNotify.Builder proto = AvatarEquipChangeNotify.newBuilder()
|
|
|
|
.setAvatarGuid(avatar.getGuid())
|
|
|
|
.setEquipType(slot.getValue());
|
|
|
|
|
|
|
|
this.setData(proto);
|
|
|
|
}
|
|
|
|
}
|