mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2025-05-12 06:56:02 +08:00
Simple implementation of a part of the gadget support, very rough, hard code variables, I am very sorry for that. It can now handle part of the gadget rig. More features and better support await PRs from others. if no one else does, I'll give it a try.
48 lines
1.7 KiB
Java
48 lines
1.7 KiB
Java
package emu.grasscutter.server.packet.send;
|
|
|
|
import emu.grasscutter.net.packet.BasePacket;
|
|
import emu.grasscutter.net.packet.PacketOpcodes;
|
|
import emu.grasscutter.net.proto.WidgetSlotChangeNotifyOuterClass;
|
|
import emu.grasscutter.net.proto.WidgetSlotDataOuterClass;
|
|
import emu.grasscutter.net.proto.WidgetSlotOpOuterClass;
|
|
|
|
public class PacketWidgetSlotChangeNotify extends BasePacket {
|
|
|
|
public PacketWidgetSlotChangeNotify(WidgetSlotChangeNotifyOuterClass.WidgetSlotChangeNotify proto) {
|
|
super(PacketOpcodes.WidgetSlotChangeNotify);
|
|
|
|
this.setData(proto);
|
|
}
|
|
|
|
public PacketWidgetSlotChangeNotify(WidgetSlotOpOuterClass.WidgetSlotOp op) {
|
|
super(PacketOpcodes.WidgetSlotChangeNotify);
|
|
|
|
WidgetSlotChangeNotifyOuterClass.WidgetSlotChangeNotify proto = WidgetSlotChangeNotifyOuterClass.WidgetSlotChangeNotify.newBuilder()
|
|
.setOp(op)
|
|
.setSlot(
|
|
WidgetSlotDataOuterClass.WidgetSlotData.newBuilder()
|
|
.setIsActive(true)
|
|
.build()
|
|
)
|
|
.build();
|
|
|
|
this.setData(proto);
|
|
}
|
|
|
|
public PacketWidgetSlotChangeNotify(int materialId) {
|
|
super(PacketOpcodes.WidgetSlotChangeNotify);
|
|
|
|
WidgetSlotChangeNotifyOuterClass.WidgetSlotChangeNotify proto = WidgetSlotChangeNotifyOuterClass.WidgetSlotChangeNotify.newBuilder()
|
|
.setSlot(
|
|
WidgetSlotDataOuterClass.WidgetSlotData.newBuilder()
|
|
.setIsActive(true)
|
|
.setMaterialId(materialId)
|
|
.build()
|
|
)
|
|
.build();
|
|
|
|
this.setData(proto);
|
|
}
|
|
|
|
}
|