Update packet files for packet ID changes

This commit is contained in:
KingRainbow44 2023-08-19 15:59:07 -04:00
parent 55083d4672
commit fd44933ec7
No known key found for this signature in database
GPG Key ID: FC2CB64B00D257BE
13 changed files with 36 additions and 152 deletions

View File

@ -1,19 +1,17 @@
package emu.grasscutter.server.game;
import static emu.grasscutter.config.Configuration.GAME_INFO;
import emu.grasscutter.Grasscutter;
import emu.grasscutter.Grasscutter.ServerDebugMode;
import emu.grasscutter.net.packet.Opcodes;
import emu.grasscutter.net.packet.PacketHandler;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.packet.*;
import emu.grasscutter.server.event.game.ReceivePacketEvent;
import emu.grasscutter.server.game.GameSession.SessionState;
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
import java.util.Set;
import it.unimi.dsi.fastutil.ints.*;
import org.reflections.Reflections;
import java.util.Set;
import static emu.grasscutter.config.Configuration.GAME_INFO;
@SuppressWarnings("unchecked")
public class GameServerPacketHandler {
private final Int2ObjectMap<PacketHandler> handlers;

View File

@ -1,8 +1,5 @@
package emu.grasscutter.server.game;
import static emu.grasscutter.config.Configuration.*;
import static emu.grasscutter.utils.lang.Language.translate;
import emu.grasscutter.Grasscutter;
import emu.grasscutter.Grasscutter.ServerDebugMode;
import emu.grasscutter.game.Account;
@ -11,10 +8,14 @@ import emu.grasscutter.net.packet.*;
import emu.grasscutter.server.event.game.SendPacketEvent;
import emu.grasscutter.utils.*;
import io.netty.buffer.*;
import lombok.*;
import java.io.File;
import java.net.InetSocketAddress;
import java.nio.file.Path;
import lombok.*;
import static emu.grasscutter.config.Configuration.*;
import static emu.grasscutter.utils.lang.Language.translate;
public class GameSession implements GameSessionManager.KcpChannel {
private final GameServer server;

View File

@ -1,19 +0,0 @@
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.LaunchFireworksReqOuterClass.LaunchFireworksReq;
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 = LaunchFireworksReq.parseFrom(payload);
session.send(new PacketFireworkNotify(req.getSchemeData()));
session.send(new PacketFireworkRsp());
}
}

View File

@ -1,17 +0,0 @@
package emu.grasscutter.server.packet.recv;
import emu.grasscutter.net.packet.*;
import emu.grasscutter.net.proto.ReformFireworksReqOuterClass.ReformFireworksReq;
import emu.grasscutter.server.game.GameSession;
import emu.grasscutter.server.packet.send.*;
@Opcodes(PacketOpcodes.FireworkSetReq)
public class HandlerFireworkSetReq extends PacketHandler {
@Override
public void handle(GameSession session, byte[] header, byte[] payload) throws Exception {
var req = ReformFireworksReq.parseFrom(payload);
session.send(new PacketFireworkSetNotify(req.getFireworksReformData()));
session.send(new PacketFireworkSetRsp());
}
}

View File

@ -1,25 +1,22 @@
package emu.grasscutter.server.packet.recv;
import static emu.grasscutter.config.Configuration.ACCOUNT;
import emu.grasscutter.Grasscutter;
import emu.grasscutter.database.DatabaseHelper;
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.packet.*;
import emu.grasscutter.net.proto.GetPlayerTokenReqOuterClass.GetPlayerTokenReq;
import emu.grasscutter.server.event.game.PlayerCreationEvent;
import emu.grasscutter.server.game.GameSession;
import emu.grasscutter.server.game.GameSession.SessionState;
import emu.grasscutter.server.packet.send.PacketGetPlayerTokenRsp;
import emu.grasscutter.utils.Crypto;
import emu.grasscutter.utils.DispatchUtils;
import emu.grasscutter.utils.Utils;
import emu.grasscutter.utils.*;
import emu.grasscutter.utils.helpers.ByteHelper;
import javax.crypto.Cipher;
import java.nio.ByteBuffer;
import java.security.Signature;
import javax.crypto.Cipher;
import static emu.grasscutter.config.Configuration.ACCOUNT;
@Opcodes(PacketOpcodes.GetPlayerTokenReq)
public class HandlerGetPlayerTokenReq extends PacketHandler {

View File

@ -1,12 +1,9 @@
// removed due to proto not existing
/*
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.LaunchFireworksReqOuterClass;
import emu.grasscutter.net.proto.LaunchFireworksReqOuterClass.LaunchFireworksReq;
import emu.grasscutter.server.game.GameSession;
import emu.grasscutter.server.packet.send.PacketFireworksLaunchDataNotify;
import emu.grasscutter.server.packet.send.PacketLaunchFireworksRsp;
@ -15,13 +12,8 @@ import emu.grasscutter.server.packet.send.PacketLaunchFireworksRsp;
public class HandlerLaunchFireworksReq extends PacketHandler {
@Override
public void handle(GameSession session, byte[] header, byte[] payload) throws Exception {
var req
= LaunchFireworksReqOuterClass.LaunchFireworksReq.parseFrom(payload);
var req = LaunchFireworksReq.parseFrom(payload);
session.send(new PacketFireworksLaunchDataNotify(req.getSchemeData()));
session.send(new PacketLaunchFireworksRsp());
}
}
*/

View File

@ -1,24 +1,17 @@
// removed due to proto not existing
/*
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.ReformFireworksReqOuterClass;
import emu.grasscutter.net.packet.*;
import emu.grasscutter.net.proto.ReformFireworksReqOuterClass.ReformFireworksReq;
import emu.grasscutter.server.game.GameSession;
import emu.grasscutter.server.packet.send.PacketFireworksReformDataNotify;
import emu.grasscutter.server.packet.send.PacketReformFireworksRsp;
import emu.grasscutter.server.packet.send.*;
@Opcodes(PacketOpcodes.ReformFireworksReq)
public class HandlerReformFireworksReq extends PacketHandler {
public final class HandlerReformFireworksReq extends PacketHandler {
@Override
public void handle(GameSession session, byte[] header, byte[] payload) throws Exception {
var req = ReformFireworksReq.parseFrom(payload);
var req
= ReformFireworksReqOuterClass.ReformFireworksReq.parseFrom(payload);
session.send(new PacketFireworksReformDataNotify(req.getFireworksReformData()));
session.send(new PacketReformFireworksRsp());
session.send(new PacketFireworkSetRsp());
}
}
*/

View File

@ -1,13 +0,0 @@
package emu.grasscutter.server.packet.send;
import emu.grasscutter.net.packet.*;
import emu.grasscutter.net.proto.FireworksLaunchDataNotifyOuterClass.FireworksLaunchDataNotify;
import emu.grasscutter.net.proto.FireworksLaunchSchemeDataOuterClass.FireworksLaunchSchemeData;
public class PacketFireworkNotify extends BasePacket {
public PacketFireworkNotify(FireworksLaunchSchemeData data) {
super(PacketOpcodes.FireworkNotify);
this.setData(FireworksLaunchDataNotify.newBuilder().addSchemeDataList(data));
}
}

View File

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

View File

@ -1,14 +0,0 @@
package emu.grasscutter.server.packet.send;
import emu.grasscutter.net.packet.*;
import emu.grasscutter.net.proto.FireworksReformDataNotifyOuterClass.FireworksReformDataNotify;
import emu.grasscutter.net.proto.FireworksReformDataOuterClass.FireworksReformData;
public class PacketFireworkSetNotify extends BasePacket {
public PacketFireworkSetNotify(FireworksReformData data) {
super(PacketOpcodes.FireworkSetNotify);
this.setData(FireworksReformDataNotify.newBuilder().addFireworksReformDataList(data));
}
}

View File

@ -6,7 +6,7 @@ import emu.grasscutter.net.proto.RetcodeOuterClass.Retcode;
public class PacketFireworkSetRsp extends BasePacket {
public PacketFireworkSetRsp() {
super(PacketOpcodes.FireworkSetRsp);
super(PacketOpcodes.ReformFireworksRsp);
this.setData(ReformFireworksRsp.newBuilder().setRetcode(Retcode.RET_SUCC.getNumber()));
}

View File

@ -1,25 +1,13 @@
// removed due to proto not existing
/*
package emu.grasscutter.server.packet.send;
import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.FireworksLaunchDataNotifyOuterClass;
import emu.grasscutter.net.proto.FireworksLaunchSchemeDataOuterClass;
import emu.grasscutter.net.packet.*;
import emu.grasscutter.net.proto.FireworksLaunchDataNotifyOuterClass.FireworksLaunchDataNotify;
import emu.grasscutter.net.proto.FireworksLaunchSchemeDataOuterClass.FireworksLaunchSchemeData;
public class PacketFireworksLaunchDataNotify extends BasePacket {
public PacketFireworksLaunchDataNotify(FireworksLaunchSchemeDataOuterClass.FireworksLaunchSchemeData notify) {
public PacketFireworksLaunchDataNotify(FireworksLaunchSchemeData data) {
super(PacketOpcodes.FireworksLaunchDataNotify);
var proto
= FireworksLaunchDataNotifyOuterClass.FireworksLaunchDataNotify.newBuilder();
proto.setLastUseSchemeId(1).addSchemeDataList(notify);
setData(proto.build());
this.setData(FireworksLaunchDataNotify.newBuilder().addSchemeDataList(data));
}
}
*/

View File

@ -1,25 +1,14 @@
// removed due to proto not existing
/*
package emu.grasscutter.server.packet.send;
import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.FireworksReformDataNotifyOuterClass;
import emu.grasscutter.net.proto.FireworksReformDataOuterClass;
import emu.grasscutter.net.packet.*;
import emu.grasscutter.net.proto.FireworksReformDataNotifyOuterClass.FireworksReformDataNotify;
import emu.grasscutter.net.proto.FireworksReformDataOuterClass.FireworksReformData;
public class PacketFireworksReformDataNotify extends BasePacket {
public PacketFireworksReformDataNotify(FireworksReformDataOuterClass.FireworksReformData fireworksReformData) {
public PacketFireworksReformDataNotify(FireworksReformData data) {
super(PacketOpcodes.FireworksReformDataNotify);
var proto
= FireworksReformDataNotifyOuterClass.FireworksReformDataNotify.newBuilder();
proto.addFireworksReformDataList(fireworksReformData);
setData(proto.build());
this.setData(FireworksReformDataNotify.newBuilder().addFireworksReformDataList(data));
}
}
*/