mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2025-01-10 04:52:52 +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
8267d796db
commit
efd30593a1
@ -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