feature(widget): simple implementation of widget

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.
This commit is contained in:
Yazawazi
2022-05-12 16:06:59 +08:00
committed by Melledy
parent e2817c696a
commit 401b80060e
54 changed files with 946 additions and 1 deletions

View File

@@ -0,0 +1,8 @@
syntax = "proto3";
option java_package = "emu.grasscutter.net.proto";
message AbilityMixinWidgetMpSupport {
uint32 target_entity_id = 1;
}

View File

@@ -0,0 +1,29 @@
syntax = "proto3";
option java_package = "emu.grasscutter.net.proto";
import "LunchBoxData.proto";
import "AnchorPointData.proto";
import "OneoffGatherPointDetectorData.proto";
import "ClientCollectorData.proto";
import "WidgetCoolDownData.proto";
import "WidgetSlotData.proto";
message AllWidgetDataNotify {
enum CmdId {
option allow_alias = true;
NONE = 0;
ENET_CHANNEL_ID = 0;
ENET_IS_RELIABLE = 1;
CMD_ID = 4260;
}
repeated AnchorPointData anchor_point_list = 2;
uint32 next_anchor_point_usable_time = 3;
LunchBoxData lunch_box_data = 5;
repeated OneoffGatherPointDetectorData oneoff_gather_point_detector_data_list = 6;
repeated ClientCollectorData client_collector_data_list = 7;
repeated WidgetCoolDownData cool_down_group_data_list = 8;
repeated WidgetCoolDownData normal_cool_down_data_list = 9;
repeated WidgetSlotData slot_list = 11;
}

View File

@@ -0,0 +1,12 @@
syntax = "proto3";
option java_package = "emu.grasscutter.net.proto";
import "Vector.proto";
message AnchorPointData {
uint32 anchor_point_id = 1;
Vector pos = 2;
Vector rot = 3;
uint32 end_time = 4;
}

View File

@@ -0,0 +1,18 @@
syntax = "proto3";
option java_package = "emu.grasscutter.net.proto";
import "AnchorPointData.proto";
message AnchorPointDataNotify {
enum CmdId {
option allow_alias = true;
NONE = 0;
ENET_CHANNEL_ID = 0;
ENET_IS_RELIABLE = 1;
CMD_ID = 4253;
}
repeated AnchorPointData anchor_point_list = 1;
uint32 next_usable_time = 2;
}

View File

@@ -0,0 +1,24 @@
syntax = "proto3";
option java_package = "emu.grasscutter.net.proto";
message AnchorPointOpReq {
enum CmdId {
option allow_alias = true;
ENET_CHANNEL_ID = 0;
NONE = 0;
ENET_IS_RELIABLE = 1;
IS_ALLOW_CLIENT = 1;
CMD_ID = 4255;
}
enum AnchorPointOpType {
ANCHOR_POINT_OP_NONE = 0;
ANCHOR_POINT_OP_TELEPORT = 1;
ANCHOR_POINT_OP_REMOVE = 2;
}
uint32 anchor_point_op_type = 1;
uint32 anchor_point_id = 2;
}

View File

@@ -0,0 +1,18 @@
syntax = "proto3";
option java_package = "emu.grasscutter.net.proto";
message AnchorPointOpRsp {
enum CmdId {
option allow_alias = true;
NONE = 0;
ENET_CHANNEL_ID = 0;
ENET_IS_RELIABLE = 1;
CMD_ID = 4274;
}
int32 retcode = 1;
uint32 anchor_point_op_type = 2;
uint32 anchor_point_id = 3;
}

View File

@@ -0,0 +1,10 @@
syntax = "proto3";
option java_package = "emu.grasscutter.net.proto";
message ClientCollectorData {
uint32 material_id = 1;
uint32 max_points = 2;
uint32 curr_points = 3;
}

View File

@@ -0,0 +1,17 @@
syntax = "proto3";
option java_package = "emu.grasscutter.net.proto";
import "ClientCollectorData.proto";
message ClientCollectorDataNotify {
enum CmdId {
option allow_alias = true;
NONE = 0;
ENET_CHANNEL_ID = 0;
ENET_IS_RELIABLE = 1;
CMD_ID = 4280;
}
repeated ClientCollectorData client_collector_data_list = 1;
}

View File

@@ -0,0 +1,16 @@
syntax = "proto3";
option java_package = "emu.grasscutter.net.proto";
message GetWidgetSlotReq {
enum CmdId {
option allow_alias = true;
ENET_CHANNEL_ID = 0;
NONE = 0;
ENET_IS_RELIABLE = 1;
IS_ALLOW_CLIENT = 1;
CMD_ID = 4285;
}
}

View File

@@ -0,0 +1,18 @@
syntax = "proto3";
option java_package = "emu.grasscutter.net.proto";
import "WidgetSlotData.proto";
message GetWidgetSlotRsp {
enum CmdId {
option allow_alias = true;
NONE = 0;
ENET_CHANNEL_ID = 0;
ENET_IS_RELIABLE = 1;
CMD_ID = 4291;
}
int32 retcode = 1;
repeated WidgetSlotData slot_list = 2;
}

8
proto/LunchBoxData.proto Normal file
View File

@@ -0,0 +1,8 @@
syntax = "proto3";
option java_package = "emu.grasscutter.net.proto";
message LunchBoxData {
map<uint32, uint32> slot_material_map = 1;
}

View File

@@ -0,0 +1,9 @@
syntax = "proto3";
option java_package = "emu.grasscutter.net.proto";
enum LunchBoxSlotType {
LUNCH_BOX_SLOT_NONE = 0;
LUNCH_BOX_SLOT_REVIVE = 1;
LUNCH_BOX_SLOT_HEAL = 2;
}

View File

@@ -0,0 +1,15 @@
syntax = "proto3";
option java_package = "emu.grasscutter.net.proto";
import "Vector.proto";
message OneoffGatherPointDetectorData {
uint32 material_id = 1;
bool is_all_collected = 2;
bool is_hint_valid = 3;
Vector hint_center_pos = 4;
uint32 hint_radius = 5;
uint32 group_id = 6;
uint32 config_id = 7;
}

View File

@@ -0,0 +1,17 @@
syntax = "proto3";
option java_package = "emu.grasscutter.net.proto";
import "OneoffGatherPointDetectorData.proto";
message OneoffGatherPointDetectorDataNotify {
enum CmdId {
option allow_alias = true;
NONE = 0;
ENET_CHANNEL_ID = 0;
ENET_IS_RELIABLE = 1;
CMD_ID = 4288;
}
repeated OneoffGatherPointDetectorData oneoff_gather_point_detector_data_list = 1;
}

View File

@@ -0,0 +1,26 @@
syntax = "proto3";
option java_package = "emu.grasscutter.net.proto";
import "WidgetCreateLocationInfo.proto";
import "WidgetCameraInfo.proto";
import "WidgetCreatorInfo.proto";
import "WidgetThunderBirdFeatherInfo.proto";
message QuickUseWidgetReq {
enum CmdId {
option allow_alias = true;
ENET_CHANNEL_ID = 0;
NONE = 0;
ENET_IS_RELIABLE = 1;
IS_ALLOW_CLIENT = 1;
CMD_ID = 4300;
}
oneof Param {
WidgetCreateLocationInfo location_info = 20;
WidgetCameraInfo camera_info = 21;
WidgetCreatorInfo creator_info = 22;
WidgetThunderBirdFeatherInfo thunder_bird_feather_info = 23;
}
}

View File

@@ -0,0 +1,21 @@
syntax = "proto3";
option java_package = "emu.grasscutter.net.proto";
import "OneoffGatherPointDetectorData.proto";
import "ClientCollectorData.proto";
message QuickUseWidgetRsp {
enum CmdId {
option allow_alias = true;
NONE = 0;
ENET_CHANNEL_ID = 0;
ENET_IS_RELIABLE = 1;
CMD_ID = 4258;
}
int32 retcode = 1;
uint32 material_id = 2;
OneoffGatherPointDetectorData detector_data = 3;
ClientCollectorData client_collector_data = 4;
}

View File

@@ -0,0 +1,18 @@
syntax = "proto3";
option java_package = "emu.grasscutter.net.proto";
import "LunchBoxData.proto";
message SetUpLunchBoxWidgetReq {
enum CmdId {
option allow_alias = true;
ENET_CHANNEL_ID = 0;
NONE = 0;
ENET_IS_RELIABLE = 1;
IS_ALLOW_CLIENT = 1;
CMD_ID = 4265;
}
LunchBoxData lunch_box_data = 1;
}

View File

@@ -0,0 +1,18 @@
syntax = "proto3";
option java_package = "emu.grasscutter.net.proto";
import "LunchBoxData.proto";
message SetUpLunchBoxWidgetRsp {
enum CmdId {
option allow_alias = true;
NONE = 0;
ENET_CHANNEL_ID = 0;
ENET_IS_RELIABLE = 1;
CMD_ID = 4297;
}
int32 retcode = 1;
LunchBoxData lunch_box_data = 2;
}

View File

@@ -0,0 +1,21 @@
syntax = "proto3";
option java_package = "emu.grasscutter.net.proto";
import "WidgetSlotOp.proto";
import "WidgetSlotTag.proto";
message SetWidgetSlotReq {
enum CmdId {
option allow_alias = true;
ENET_CHANNEL_ID = 0;
NONE = 0;
ENET_IS_RELIABLE = 1;
IS_ALLOW_CLIENT = 1;
CMD_ID = 4269;
}
WidgetSlotOp op = 2;
repeated WidgetSlotTag tag_list = 3;
uint32 material_id = 4;
}

View File

@@ -0,0 +1,21 @@
syntax = "proto3";
option java_package = "emu.grasscutter.net.proto";
import "WidgetSlotOp.proto";
import "WidgetSlotTag.proto";
message SetWidgetSlotRsp {
enum CmdId {
option allow_alias = true;
NONE = 0;
ENET_CHANNEL_ID = 0;
ENET_IS_RELIABLE = 1;
CMD_ID = 4279;
}
int32 retcode = 1;
WidgetSlotOp op = 2;
repeated WidgetSlotTag tag_list = 3;
uint32 material_id = 4;
}

View File

@@ -0,0 +1,20 @@
syntax = "proto3";
option java_package = "emu.grasscutter.net.proto";
import "Vector.proto";
message UseWidgetCreateGadgetReq {
enum CmdId {
option allow_alias = true;
ENET_CHANNEL_ID = 0;
NONE = 0;
ENET_IS_RELIABLE = 1;
IS_ALLOW_CLIENT = 1;
CMD_ID = 4276;
}
uint32 material_id = 1;
Vector pos = 2;
Vector rot = 3;
}

View File

@@ -0,0 +1,17 @@
syntax = "proto3";
option java_package = "emu.grasscutter.net.proto";
message UseWidgetCreateGadgetRsp {
enum CmdId {
option allow_alias = true;
NONE = 0;
ENET_CHANNEL_ID = 0;
ENET_IS_RELIABLE = 1;
CMD_ID = 4270;
}
int32 retcode = 1;
uint32 material_id = 2;
}

View File

@@ -0,0 +1,17 @@
syntax = "proto3";
option java_package = "emu.grasscutter.net.proto";
message UseWidgetRetractGadgetReq {
enum CmdId {
option allow_alias = true;
ENET_CHANNEL_ID = 0;
NONE = 0;
ENET_IS_RELIABLE = 1;
IS_ALLOW_CLIENT = 1;
CMD_ID = 4273;
}
uint32 entity_id = 1;
}

View File

@@ -0,0 +1,18 @@
syntax = "proto3";
option java_package = "emu.grasscutter.net.proto";
message UseWidgetRetractGadgetRsp {
enum CmdId {
option allow_alias = true;
ENET_CHANNEL_ID = 0;
NONE = 0;
ENET_IS_RELIABLE = 1;
IS_ALLOW_CLIENT = 1;
CMD_ID = 4266;
}
int32 retcode = 1;
uint32 entity_id = 2;
}

View File

@@ -0,0 +1,17 @@
syntax = "proto3";
option java_package = "emu.grasscutter.net.proto";
import "WidgetSlotData.proto";
message WidgetActiveChangeNotify {
enum CmdId {
option allow_alias = true;
NONE = 0;
ENET_CHANNEL_ID = 0;
ENET_IS_RELIABLE = 1;
CMD_ID = 4264;
}
repeated WidgetSlotData widget_data_list = 1;
}

View File

@@ -0,0 +1,8 @@
syntax = "proto3";
option java_package = "emu.grasscutter.net.proto";
message WidgetCameraInfo {
uint32 target_entity_id = 1;
}

View File

@@ -0,0 +1,10 @@
syntax = "proto3";
option java_package = "emu.grasscutter.net.proto";
message WidgetCoolDownData {
uint32 id = 1;
uint64 cool_down_time = 2;
bool is_success = 3;
}

View File

@@ -0,0 +1,18 @@
syntax = "proto3";
option java_package = "emu.grasscutter.net.proto";
import "WidgetCoolDownData.proto";
message WidgetCoolDownNotify {
enum CmdId {
option allow_alias = true;
NONE = 0;
ENET_CHANNEL_ID = 0;
ENET_IS_RELIABLE = 1;
CMD_ID = 4298;
}
repeated WidgetCoolDownData group_cool_down_data_list = 1;
repeated WidgetCoolDownData normal_cool_down_data_list = 2;
}

View File

@@ -0,0 +1,10 @@
syntax = "proto3";
option java_package = "emu.grasscutter.net.proto";
import "Vector.proto";
message WidgetCreateLocationInfo {
Vector pos = 1;
Vector rot = 2;
}

View File

@@ -0,0 +1,12 @@
syntax = "proto3";
option java_package = "emu.grasscutter.net.proto";
import "WidgetCreatorOpType.proto";
import "WidgetCreateLocationInfo.proto";
message WidgetCreatorInfo {
WidgetCreatorOpType op_type = 1;
uint32 entity_id = 2;
WidgetCreateLocationInfo location_info = 3;
}

View File

@@ -0,0 +1,9 @@
syntax = "proto3";
option java_package = "emu.grasscutter.net.proto";
enum WidgetCreatorOpType {
WIDGET_CREATOR_TYPE_NONE = 0;
WIDGET_CREATOR_TYPE_RETRACT = 1;
WIDGET_CREATOR_TYPE_RETRACT_AND_CREATE = 2;
}

View File

@@ -0,0 +1,23 @@
syntax = "proto3";
option java_package = "emu.grasscutter.net.proto";
import "WidgetCreateLocationInfo.proto";
import "WidgetCreatorInfo.proto";
message WidgetDoBagReq {
enum CmdId {
option allow_alias = true;
ENET_CHANNEL_ID = 0;
NONE = 0;
ENET_IS_RELIABLE = 1;
IS_ALLOW_CLIENT = 1;
CMD_ID = 4290;
}
oneof OpInfo {
WidgetCreateLocationInfo location_info = 20;
WidgetCreatorInfo widget_creator_info = 21;
}
uint32 material_id = 1;
}

View File

@@ -0,0 +1,17 @@
syntax = "proto3";
option java_package = "emu.grasscutter.net.proto";
message WidgetDoBagRsp {
enum CmdId {
option allow_alias = true;
NONE = 0;
ENET_CHANNEL_ID = 0;
ENET_IS_RELIABLE = 1;
CMD_ID = 4271;
}
int32 retcode = 1;
uint32 material_id = 2;
}

View File

@@ -0,0 +1,17 @@
syntax = "proto3";
option java_package = "emu.grasscutter.net.proto";
import "WidgetGadgetData.proto";
message WidgetGadgetAllDataNotify {
enum CmdId {
option allow_alias = true;
NONE = 0;
ENET_CHANNEL_ID = 0;
ENET_IS_RELIABLE = 1;
CMD_ID = 4262;
}
repeated WidgetGadgetData widget_gadget_data = 1;
}

View File

@@ -0,0 +1,9 @@
syntax = "proto3";
option java_package = "emu.grasscutter.net.proto";
message WidgetGadgetData {
uint32 gadget_id = 1;
repeated uint32 gadget_entity_id_list = 3;
}

View File

@@ -0,0 +1,17 @@
syntax = "proto3";
option java_package = "emu.grasscutter.net.proto";
import "WidgetGadgetData.proto";
message WidgetGadgetDataNotify {
enum CmdId {
option allow_alias = true;
NONE = 0;
ENET_CHANNEL_ID = 0;
ENET_IS_RELIABLE = 1;
CMD_ID = 4256;
}
WidgetGadgetData widget_gadget_data = 1;
}

View File

@@ -0,0 +1,16 @@
syntax = "proto3";
option java_package = "emu.grasscutter.net.proto";
message WidgetGadgetDestroyNotify {
enum CmdId {
option allow_alias = true;
NONE = 0;
ENET_CHANNEL_ID = 0;
ENET_IS_RELIABLE = 1;
CMD_ID = 4268;
}
uint32 entity_id = 1;
}

View File

@@ -0,0 +1,19 @@
syntax = "proto3";
option java_package = "emu.grasscutter.net.proto";
message WidgetReportReq {
enum CmdId {
option allow_alias = true;
ENET_CHANNEL_ID = 0;
NONE = 0;
ENET_IS_RELIABLE = 1;
IS_ALLOW_CLIENT = 1;
CMD_ID = 4294;
}
uint32 material_id = 1;
bool is_clear_hint = 2;
bool is_client_collect = 3;
}

View File

@@ -0,0 +1,17 @@
syntax = "proto3";
option java_package = "emu.grasscutter.net.proto";
message WidgetReportRsp {
enum CmdId {
option allow_alias = true;
NONE = 0;
ENET_CHANNEL_ID = 0;
ENET_IS_RELIABLE = 1;
CMD_ID = 4259;
}
int32 retcode = 1;
uint32 material_id = 2;
}

View File

@@ -0,0 +1,19 @@
syntax = "proto3";
option java_package = "emu.grasscutter.net.proto";
import "WidgetSlotOp.proto";
import "WidgetSlotData.proto";
message WidgetSlotChangeNotify {
enum CmdId {
option allow_alias = true;
NONE = 0;
ENET_CHANNEL_ID = 0;
ENET_IS_RELIABLE = 1;
CMD_ID = 4289;
}
WidgetSlotOp op = 1;
WidgetSlotData slot = 2;
}

View File

@@ -0,0 +1,12 @@
syntax = "proto3";
option java_package = "emu.grasscutter.net.proto";
import "WidgetSlotTag.proto";
message WidgetSlotData {
WidgetSlotTag tag = 1;
uint32 material_id = 2;
uint32 cd_over_time = 3;
bool is_active = 4;
}

8
proto/WidgetSlotOp.proto Normal file
View File

@@ -0,0 +1,8 @@
syntax = "proto3";
option java_package = "emu.grasscutter.net.proto";
enum WidgetSlotOp {
ATTACH = 0;
DETACH = 1;
}

View File

@@ -0,0 +1,8 @@
syntax = "proto3";
option java_package = "emu.grasscutter.net.proto";
enum WidgetSlotTag {
WIDGET_SLOT_QUICK_USE = 0;
WIDGET_SLOT_ATTACH_AVATAR = 1;
}

View File

@@ -0,0 +1,7 @@
syntax = "proto3";
option java_package = "emu.grasscutter.net.proto";
message WidgetSlotTagComparer {
}

View File

@@ -0,0 +1,8 @@
syntax = "proto3";
option java_package = "emu.grasscutter.net.proto";
message WidgetThunderBirdFeatherInfo {
repeated uint32 entity_id_list = 1;
}

View File

@@ -0,0 +1,17 @@
syntax = "proto3";
option java_package = "emu.grasscutter.net.proto";
message WidgetUseAttachAbilityGroupChangeNotify {
enum CmdId {
option allow_alias = true;
NONE = 0;
ENET_CHANNEL_ID = 0;
ENET_IS_RELIABLE = 1;
CMD_ID = 4292;
}
uint32 material_id = 1;
bool is_attach = 2;
}

View File

@@ -82,6 +82,8 @@ public class Player {
private Set<Integer> flyCloakList; private Set<Integer> flyCloakList;
private Set<Integer> costumeList; private Set<Integer> costumeList;
private Integer widgetId;
@Transient private long nextGuid = 0; @Transient private long nextGuid = 0;
@Transient private int peerId; @Transient private int peerId;
@Transient private World world; @Transient private World world;
@@ -297,6 +299,14 @@ public class Player {
this.updateProfile(); this.updateProfile();
} }
public Integer getWidgetId() {
return widgetId;
}
public void setWidgetId(Integer widgetId) {
this.widgetId = widgetId;
}
public Position getPos() { public Position getPos() {
return pos; return pos;
} }
@@ -1141,6 +1151,9 @@ public class Player {
session.send(new PacketPlayerStoreNotify(this)); session.send(new PacketPlayerStoreNotify(this));
session.send(new PacketAvatarDataNotify(this)); session.send(new PacketAvatarDataNotify(this));
session.send(new PacketAllWidgetDataNotify(this));
session.send(new PacketWidgetGadgetAllDataNotify());
getTodayMoonCard(); // The timer works at 0:0, some users log in after that, use this method to check if they have received a reward today or not. If not, send the reward. getTodayMoonCard(); // The timer works at 0:0, some users log in after that, use this method to check if they have received a reward today or not. If not, send the reward.
session.send(new PacketPlayerEnterSceneNotify(this)); // Enter game world session.send(new PacketPlayerEnterSceneNotify(this)); // Enter game world

View File

@@ -1,16 +1,20 @@
package emu.grasscutter.server.packet.recv; package emu.grasscutter.server.packet.recv;
import emu.grasscutter.game.player.Player;
import emu.grasscutter.net.packet.Opcodes; import emu.grasscutter.net.packet.Opcodes;
import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.packet.PacketHandler; import emu.grasscutter.net.packet.PacketHandler;
import emu.grasscutter.server.game.GameSession; import emu.grasscutter.server.game.GameSession;
import emu.grasscutter.server.packet.send.PacketGetShopRsp;
import emu.grasscutter.server.packet.send.PacketGetWidgetSlotRsp;
@Opcodes(PacketOpcodes.GetWidgetSlotReq) @Opcodes(PacketOpcodes.GetWidgetSlotReq)
public class HandlerGetWidgetSlotReq extends PacketHandler { public class HandlerGetWidgetSlotReq extends PacketHandler {
@Override @Override
public void handle(GameSession session, byte[] header, byte[] payload) throws Exception { public void handle(GameSession session, byte[] header, byte[] payload) throws Exception {
// Unhandled Player player = session.getPlayer();
session.send(new PacketGetWidgetSlotRsp(player));
} }
} }

View File

@@ -0,0 +1,33 @@
package emu.grasscutter.server.packet.recv;
import emu.grasscutter.game.player.Player;
import emu.grasscutter.net.packet.Opcodes;
import emu.grasscutter.net.packet.PacketHandler;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.SetWidgetSlotReqOuterClass;
import emu.grasscutter.net.proto.WidgetSlotOpOuterClass;
import emu.grasscutter.server.game.GameSession;
import emu.grasscutter.server.packet.send.PacketSetWidgetSlotRsp;
import emu.grasscutter.server.packet.send.PacketWidgetSlotChangeNotify;
@Opcodes(PacketOpcodes.SetWidgetSlotReq)
public class HandlerSetWidgetSlotReq extends PacketHandler {
@Override
public void handle(GameSession session, byte[] header, byte[] payload) throws Exception {
SetWidgetSlotReqOuterClass.SetWidgetSlotReq req = SetWidgetSlotReqOuterClass.SetWidgetSlotReq.parseFrom(payload);
Player player = session.getPlayer();
player.setWidgetId(req.getMaterialId());
// WidgetSlotChangeNotify op & slot key
session.send(new PacketWidgetSlotChangeNotify(WidgetSlotOpOuterClass.WidgetSlotOp.DETACH));
// WidgetSlotChangeNotify slot
session.send(new PacketWidgetSlotChangeNotify(req.getMaterialId()));
// SetWidgetSlotRsp
session.send(new PacketSetWidgetSlotRsp(req.getMaterialId()));
}
}

View File

@@ -0,0 +1,59 @@
package emu.grasscutter.server.packet.send;
import emu.grasscutter.game.player.Player;
import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.AllWidgetDataNotifyOuterClass.AllWidgetDataNotify;
import emu.grasscutter.net.proto.LunchBoxDataOuterClass;
import emu.grasscutter.net.proto.WidgetSlotDataOuterClass;
import emu.grasscutter.net.proto.WidgetSlotTagOuterClass;
import java.util.List;
import java.util.Map;
public class PacketAllWidgetDataNotify extends BasePacket {
public PacketAllWidgetDataNotify(Player player) {
super(PacketOpcodes.AllWidgetDataNotify);
// TODO: Implement this
AllWidgetDataNotify.Builder proto = AllWidgetDataNotify.newBuilder()
// If you want to implement this, feel free to do so. :)
.setLunchBoxData(
LunchBoxDataOuterClass.LunchBoxData.newBuilder().build()
)
// Maybe it's a little difficult, or it makes you upset :(
.addAllOneoffGatherPointDetectorDataList(List.of())
// So, goodbye, and hopefully sometime in the future o(* ̄▽ ̄*)ブ
.addAllCoolDownGroupDataList(List.of())
// I'll see your PR with a title that says (・∀・(・∀・(・∀・*)
.addAllAnchorPointList(List.of())
// "Complete implementation of widget functionality" b ̄▽ ̄d 
.addAllClientCollectorDataList(List.of())
// Good luck, my boy.
.addAllNormalCoolDownDataList(List.of());
if (player.getWidgetId() == null) {
proto.addAllSlotList(List.of());
} else {
proto.addSlotList(
WidgetSlotDataOuterClass.WidgetSlotData.newBuilder()
.setIsActive(true)
.setMaterialId(player.getWidgetId())
.build()
);
proto.addSlotList(
WidgetSlotDataOuterClass.WidgetSlotData.newBuilder()
.setTag(WidgetSlotTagOuterClass.WidgetSlotTag.WIDGET_SLOT_ATTACH_AVATAR)
.build()
);
}
AllWidgetDataNotify protoData = proto.build();
this.setData(protoData);
}
}

View File

@@ -0,0 +1,41 @@
package emu.grasscutter.server.packet.send;
import emu.grasscutter.game.player.Player;
import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.GetWidgetSlotRspOuterClass;
import emu.grasscutter.net.proto.WidgetSlotDataOuterClass;
import emu.grasscutter.net.proto.WidgetSlotTagOuterClass;
import java.util.List;
public class PacketGetWidgetSlotRsp extends BasePacket {
public PacketGetWidgetSlotRsp(Player player) {
super(PacketOpcodes.GetWidgetSlotRsp);
GetWidgetSlotRspOuterClass.GetWidgetSlotRsp.Builder proto =
GetWidgetSlotRspOuterClass.GetWidgetSlotRsp.newBuilder();
if (player.getWidgetId() == null) {
proto.addAllSlotList(List.of());
} else {
proto.addSlotList(
WidgetSlotDataOuterClass.WidgetSlotData.newBuilder()
.setIsActive(true)
.setMaterialId(player.getWidgetId())
.build()
);
proto.addSlotList(
WidgetSlotDataOuterClass.WidgetSlotData.newBuilder()
.setTag(WidgetSlotTagOuterClass.WidgetSlotTag.WIDGET_SLOT_ATTACH_AVATAR)
.build()
);
}
GetWidgetSlotRspOuterClass.GetWidgetSlotRsp protoData = proto.build();
this.setData(protoData);
}
}

View File

@@ -0,0 +1,18 @@
package emu.grasscutter.server.packet.send;
import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.SetWidgetSlotRspOuterClass;
public class PacketSetWidgetSlotRsp extends BasePacket {
public PacketSetWidgetSlotRsp(int materialId) {
super(PacketOpcodes.SetWidgetSlotRsp);
SetWidgetSlotRspOuterClass.SetWidgetSlotRsp proto = SetWidgetSlotRspOuterClass.SetWidgetSlotRsp.newBuilder()
.setMaterialId(materialId)
.build();
this.setData(proto);
}
}

View File

@@ -0,0 +1,16 @@
package emu.grasscutter.server.packet.send;
import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.WidgetGadgetAllDataNotifyOuterClass.WidgetGadgetAllDataNotify;
public class PacketWidgetGadgetAllDataNotify extends BasePacket {
public PacketWidgetGadgetAllDataNotify() {
super(PacketOpcodes.AllWidgetDataNotify);
WidgetGadgetAllDataNotify proto = WidgetGadgetAllDataNotify.newBuilder().build();
this.setData(proto);
}
}

View File

@@ -0,0 +1,47 @@
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);
}
}