mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2025-01-26 15:02:54 +08:00
Fireworks support (#1393)
* Firework Implement * add legacy function * remove obfusucated names * remove obfusucated names * remove obfusucated names * remove obfusucated names Co-authored-by: Melledy <52122272+Melledy@users.noreply.github.com>
This commit is contained in:
parent
f1370d9bc8
commit
fcabf42d9a
10
proto/FireWorkData.proto
Normal file
10
proto/FireWorkData.proto
Normal file
@ -0,0 +1,10 @@
|
||||
syntax = "proto3";
|
||||
|
||||
option java_package = "emu.grasscutter.net.proto";
|
||||
|
||||
import "FireWorkInstance.proto";
|
||||
|
||||
message FireWorkData {
|
||||
uint32 id = 1;
|
||||
repeated FireWorkInstance fireWorkInstance = 2;
|
||||
}
|
10
proto/FireWorkInstance.proto
Normal file
10
proto/FireWorkInstance.proto
Normal file
@ -0,0 +1,10 @@
|
||||
syntax = "proto3";
|
||||
|
||||
option java_package = "emu.grasscutter.net.proto";
|
||||
|
||||
import "FireWorkType.proto";
|
||||
|
||||
message FireWorkInstance {
|
||||
FireWorkType type = 1;
|
||||
int32 value = 2;
|
||||
}
|
12
proto/FireWorkNotify.proto
Normal file
12
proto/FireWorkNotify.proto
Normal file
@ -0,0 +1,12 @@
|
||||
syntax = "proto3";
|
||||
|
||||
option java_package = "emu.grasscutter.net.proto";
|
||||
|
||||
import "FireWorkData.proto";
|
||||
|
||||
// CmdId: 6079
|
||||
// EnetChannelId: 0
|
||||
// EnetIsReliable: true
|
||||
message FireWorkNotify {
|
||||
repeated FireWorkData fireWorkData = 1;
|
||||
}
|
13
proto/FireWorkReq.proto
Normal file
13
proto/FireWorkReq.proto
Normal file
@ -0,0 +1,13 @@
|
||||
syntax = "proto3";
|
||||
|
||||
option java_package = "emu.grasscutter.net.proto";
|
||||
|
||||
import "FireWorkData.proto";
|
||||
|
||||
// CmdId: 6068
|
||||
// EnetChannelId: 0
|
||||
// EnetIsReliable: true
|
||||
// IsAllowClient: true
|
||||
message FireWorkReq {
|
||||
FireWorkData fireWorkData = 7;
|
||||
}
|
10
proto/FireWorkRsp.proto
Normal file
10
proto/FireWorkRsp.proto
Normal file
@ -0,0 +1,10 @@
|
||||
syntax = "proto3";
|
||||
|
||||
option java_package = "emu.grasscutter.net.proto";
|
||||
|
||||
// CmdId: 5918
|
||||
// EnetChannelId: 0
|
||||
// EnetIsReliable: true
|
||||
message FireWorkRsp {
|
||||
int32 retcode = 10;
|
||||
}
|
12
proto/FireWorkType.proto
Normal file
12
proto/FireWorkType.proto
Normal file
@ -0,0 +1,12 @@
|
||||
syntax = "proto3";
|
||||
|
||||
option java_package = "emu.grasscutter.net.proto";
|
||||
|
||||
enum FireWorkType {
|
||||
FireWorkType_ODJKANKMPPJ = 0;
|
||||
FireWorkType_EFGLHEIODFN = 1;
|
||||
FireWorkType_JPBBBCFGHAK = 2;
|
||||
FireWorkType_IDCMGHBHBFH = 3;
|
||||
FireWorkType_ODDBNNDFMBO = 4;
|
||||
FireWorkType_AGIDMOGJOBD = 5;
|
||||
}
|
11
proto/FireworkSetData.proto
Normal file
11
proto/FireworkSetData.proto
Normal file
@ -0,0 +1,11 @@
|
||||
syntax = "proto3";
|
||||
|
||||
option java_package = "emu.grasscutter.net.proto";
|
||||
|
||||
import "FireWorkInstance.proto";
|
||||
|
||||
message FireworkSetData {
|
||||
uint32 id = 1;
|
||||
repeated uint32 _unknown_field_ = 2;
|
||||
repeated FireWorkInstance fireWorkInstance = 3;
|
||||
}
|
13
proto/FireworkSetNotify.proto
Normal file
13
proto/FireworkSetNotify.proto
Normal file
@ -0,0 +1,13 @@
|
||||
syntax = "proto3";
|
||||
|
||||
option java_package = "emu.grasscutter.net.proto";
|
||||
|
||||
import "FireworkSetData.proto";
|
||||
|
||||
// CmdId: 5934
|
||||
// EnetChannelId: 0
|
||||
// EnetIsReliable: true
|
||||
message FireworkSetNotify {
|
||||
uint32 code = 1;
|
||||
repeated FireworkSetData data = 9;
|
||||
}
|
13
proto/FireworkSetReq.proto
Normal file
13
proto/FireworkSetReq.proto
Normal file
@ -0,0 +1,13 @@
|
||||
syntax = "proto3";
|
||||
|
||||
option java_package = "emu.grasscutter.net.proto";
|
||||
|
||||
import "FireworkSetData.proto";
|
||||
|
||||
// CmdId: 6099
|
||||
// EnetChannelId: 0
|
||||
// EnetIsReliable: true
|
||||
// IsAllowClient: true
|
||||
message FireworkSetReq {
|
||||
FireworkSetData data = 2;
|
||||
}
|
10
proto/FireworkSetRsp.proto
Normal file
10
proto/FireworkSetRsp.proto
Normal file
@ -0,0 +1,10 @@
|
||||
syntax = "proto3";
|
||||
|
||||
option java_package = "emu.grasscutter.net.proto";
|
||||
|
||||
// CmdId: 5969
|
||||
// EnetChannelId: 0
|
||||
// EnetIsReliable: true
|
||||
message NBFJOJPCCEK_Rsp {
|
||||
int32 retcode = 7;
|
||||
}
|
@ -471,6 +471,12 @@ public class PacketOpcodes {
|
||||
public static final int FinishedParentQuestUpdateNotify = 432;
|
||||
public static final int FinishMainCoopReq = 1978;
|
||||
public static final int FinishMainCoopRsp = 1953;
|
||||
public static final int FireworkReq = 6068;
|
||||
public static final int FireworkNotify = 6079;
|
||||
public static final int FireworkRsp = 5918;
|
||||
public static final int FireworkSetReq = 6099;
|
||||
public static final int FireworkSetNotify = 5934;
|
||||
public static final int FireworkSetRsp = 5969;
|
||||
public static final int FishAttractNotify = 5846;
|
||||
public static final int FishBaitGoneNotify = 5827;
|
||||
public static final int FishBattleBeginReq = 5802;
|
||||
@ -909,6 +915,11 @@ public class PacketOpcodes {
|
||||
public static final int MusicGameSettleRsp = 8288;
|
||||
public static final int MusicGameStartReq = 8927;
|
||||
public static final int MusicGameStartRsp = 8101;
|
||||
public static final int MusicCustomReq = 6318;
|
||||
public static final int MusicCustomRsp = 6309;
|
||||
public static final int MusicGameStoreSubmitReq = 6326;
|
||||
public static final int MusicGameStoreSubmitRsp = 6347;
|
||||
public static final int MusicGameStoreSubmitNotify = 6337;
|
||||
public static final int MusicGameStartToPlayOthersBeatmapReq = 6302;
|
||||
public static final int MusicGameStartToPlayOthersBeatmapRsp = 6313;
|
||||
public static final int NavMeshStatsNotify = 2387;
|
||||
|
@ -0,0 +1,21 @@
|
||||
package emu.grasscutter.server.packet.recv;
|
||||
|
||||
import emu.grasscutter.net.packet.Opcodes;
|
||||
import emu.grasscutter.net.packet.PacketHandler;
|
||||
import emu.grasscutter.net.packet.PacketOpcodes;
|
||||
import emu.grasscutter.net.proto.FireWorkReqOuterClass;
|
||||
import emu.grasscutter.server.game.GameSession;
|
||||
import emu.grasscutter.server.packet.send.PacketFireworkNotify;
|
||||
import emu.grasscutter.server.packet.send.PacketFireworkRsp;
|
||||
|
||||
@Opcodes(PacketOpcodes.FireworkReq)
|
||||
public class HandlerFireWorkReq extends PacketHandler {
|
||||
@Override
|
||||
public void handle(GameSession session, byte[] header, byte[] payload) throws Exception {
|
||||
|
||||
var req
|
||||
= FireWorkReqOuterClass.FireWorkReq.parseFrom(payload);
|
||||
session.send(new PacketFireworkNotify(req.getFireWorkData()));
|
||||
session.send(new PacketFireworkRsp());
|
||||
}
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package emu.grasscutter.server.packet.recv;
|
||||
|
||||
import emu.grasscutter.net.packet.Opcodes;
|
||||
import emu.grasscutter.net.packet.PacketHandler;
|
||||
import emu.grasscutter.net.packet.PacketOpcodes;
|
||||
import emu.grasscutter.net.proto.FireworkSetReqOuterClass;
|
||||
import emu.grasscutter.server.game.GameSession;
|
||||
import emu.grasscutter.server.packet.send.PacketFireworkSetNotify;
|
||||
import emu.grasscutter.server.packet.send.PacketFireworkSetRsp;
|
||||
|
||||
@Opcodes(PacketOpcodes.FireworkSetReq)
|
||||
public class HandlerFireworkSetReq extends PacketHandler {
|
||||
@Override
|
||||
public void handle(GameSession session, byte[] header, byte[] payload) throws Exception {
|
||||
|
||||
var req
|
||||
= FireworkSetReqOuterClass.FireworkSetReq.parseFrom(payload);
|
||||
|
||||
|
||||
session.send(new PacketFireworkSetNotify(req.getData()));
|
||||
session.send(new PacketFireworkSetRsp());
|
||||
}
|
||||
}
|
@ -1,17 +1,14 @@
|
||||
package emu.grasscutter.server.packet.recv;
|
||||
|
||||
import emu.grasscutter.Grasscutter;
|
||||
import emu.grasscutter.data.GameData;
|
||||
import emu.grasscutter.data.excels.GadgetData;
|
||||
import emu.grasscutter.game.entity.EntityVehicle;
|
||||
import emu.grasscutter.game.entity.GameEntity;
|
||||
import emu.grasscutter.game.props.LifeState;
|
||||
import emu.grasscutter.net.packet.Opcodes;
|
||||
import emu.grasscutter.net.packet.PacketHandler;
|
||||
import emu.grasscutter.net.packet.PacketOpcodes;
|
||||
import emu.grasscutter.net.proto.*;
|
||||
import emu.grasscutter.net.proto.WidgetDoBagReqOuterClass;
|
||||
import emu.grasscutter.server.game.GameSession;
|
||||
import emu.grasscutter.server.packet.send.PacketSceneEntityAppearNotify;
|
||||
import emu.grasscutter.server.packet.send.PacketWidgetCoolDownNotify;
|
||||
import emu.grasscutter.server.packet.send.PacketWidgetDoBagRsp;
|
||||
import emu.grasscutter.server.packet.send.PacketWidgetGadgetDataNotify;
|
||||
@ -41,12 +38,31 @@ public class HandlerWidgetDoBagReq extends PacketHandler {
|
||||
|
||||
session.getPlayer().getScene().addEntity(entity);
|
||||
|
||||
session.send(new PacketWidgetGadgetDataNotify(70500025, List.of(entity.getId()))); // ???
|
||||
session.send(new PacketWidgetGadgetDataNotify(70500025, entity.getId())); // ???
|
||||
session.send(new PacketWidgetCoolDownNotify(15, System.currentTimeMillis() + 5000L, true));
|
||||
session.send(new PacketWidgetCoolDownNotify(15, System.currentTimeMillis() + 5000L, true));
|
||||
// Send twice, and I don't know why, Ask mhy
|
||||
session.send(new PacketWidgetDoBagRsp());
|
||||
}
|
||||
case 220047 -> {
|
||||
GadgetData gadgetData = GameData.getGadgetDataMap().get(70800058);
|
||||
Position pos = new Position(req.getWidgetCreatorInfo().getLocationInfo().getPos());
|
||||
Position rot = new Position(req.getWidgetCreatorInfo().getLocationInfo().getRot());
|
||||
GameEntity entity = new EntityVehicle(
|
||||
session.getPlayer().getScene(),
|
||||
session.getPlayer(),
|
||||
gadgetData.getId(),
|
||||
0,
|
||||
pos,
|
||||
rot
|
||||
);
|
||||
|
||||
session.getPlayer().getScene().addEntity(entity);
|
||||
|
||||
session.send(new PacketWidgetGadgetDataNotify(70800058, entity.getId())); // ???
|
||||
// Send twice, and I don't know why, Ask mhy
|
||||
session.send(new PacketWidgetDoBagRsp());
|
||||
}
|
||||
default -> {
|
||||
session.send(new PacketWidgetDoBagRsp());
|
||||
}
|
||||
|
@ -0,0 +1,21 @@
|
||||
package emu.grasscutter.server.packet.send;
|
||||
|
||||
import emu.grasscutter.net.packet.BasePacket;
|
||||
import emu.grasscutter.net.packet.PacketOpcodes;
|
||||
import emu.grasscutter.net.proto.FireWorkNotifyOuterClass;
|
||||
import emu.grasscutter.net.proto.FireWorkDataOuterClass;
|
||||
|
||||
public class PacketFireworkNotify extends BasePacket {
|
||||
|
||||
public PacketFireworkNotify(FireWorkDataOuterClass.FireWorkData pinfo) {
|
||||
super(PacketOpcodes.FireworkNotify);
|
||||
|
||||
var proto
|
||||
= FireWorkNotifyOuterClass.FireWorkNotify.newBuilder();
|
||||
|
||||
proto.addFireWorkData(pinfo);
|
||||
|
||||
setData(proto.build());
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package emu.grasscutter.server.packet.send;
|
||||
|
||||
import emu.grasscutter.net.packet.BasePacket;
|
||||
import emu.grasscutter.net.packet.PacketOpcodes;
|
||||
|
||||
public class PacketFireworkRsp extends BasePacket {
|
||||
|
||||
public PacketFireworkRsp() {
|
||||
super(PacketOpcodes.FireworkRsp);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package emu.grasscutter.server.packet.send;
|
||||
|
||||
import emu.grasscutter.net.packet.BasePacket;
|
||||
import emu.grasscutter.net.packet.PacketOpcodes;
|
||||
import emu.grasscutter.net.proto.FireworkSetNotifyOuterClass;
|
||||
import emu.grasscutter.net.proto.FireworkSetDataOuterClass;
|
||||
|
||||
public class PacketFireworkSetNotify extends BasePacket {
|
||||
|
||||
public PacketFireworkSetNotify(FireworkSetDataOuterClass.FireworkSetData notify) {
|
||||
super(PacketOpcodes.FireworkSetNotify);
|
||||
|
||||
var proto
|
||||
= FireworkSetNotifyOuterClass.FireworkSetNotify.newBuilder();
|
||||
|
||||
proto.setCode(1).addData(notify);
|
||||
|
||||
setData(proto.build());
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
package emu.grasscutter.server.packet.send;
|
||||
|
||||
import emu.grasscutter.net.packet.BasePacket;
|
||||
import emu.grasscutter.net.packet.PacketOpcodes;
|
||||
|
||||
public class PacketFireworkSetRsp extends BasePacket {
|
||||
|
||||
public PacketFireworkSetRsp() {
|
||||
super(PacketOpcodes.FireworkSetRsp);
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -9,6 +9,7 @@ import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
public class PacketWidgetGadgetDataNotify extends BasePacket {
|
||||
|
||||
public PacketWidgetGadgetDataNotify(int gadgetId, List<Integer> gadgetEntityIdList) throws IOException {
|
||||
super(PacketOpcodes.WidgetGadgetDataNotify);
|
||||
|
||||
@ -23,4 +24,19 @@ public class PacketWidgetGadgetDataNotify extends BasePacket {
|
||||
|
||||
this.setData(proto);
|
||||
}
|
||||
|
||||
public PacketWidgetGadgetDataNotify(int gadgetId, int gadgetEntityIdList) throws IOException {
|
||||
super(PacketOpcodes.WidgetGadgetDataNotify);
|
||||
|
||||
WidgetGadgetDataNotifyOuterClass.WidgetGadgetDataNotify proto = WidgetGadgetDataNotifyOuterClass.WidgetGadgetDataNotify.newBuilder()
|
||||
.setWidgetGadgetData(
|
||||
WidgetGadgetDataOuterClass.WidgetGadgetData.newBuilder()
|
||||
.setGadgetId(gadgetId)
|
||||
.addGadgetEntityIdList(gadgetEntityIdList)
|
||||
.build()
|
||||
)
|
||||
.build();
|
||||
|
||||
this.setData(proto);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user