Commit 7fdf7498 authored by omg-xtao's avatar omg-xtao Committed by GitHub
Browse files

Merge branch 'development' into tp

parents eaed1aa0 4c487e22
package emu.grasscutter.server.packet.send; package emu.grasscutter.server.packet.send;
import emu.grasscutter.game.entity.EntityGadget; import emu.grasscutter.game.entity.EntityBaseGadget;
import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.GadgetInteractRspOuterClass.GadgetInteractRsp; import emu.grasscutter.net.proto.GadgetInteractRspOuterClass.GadgetInteractRsp;
...@@ -8,7 +8,7 @@ import emu.grasscutter.net.proto.InteractTypeOuterClass.InteractType; ...@@ -8,7 +8,7 @@ import emu.grasscutter.net.proto.InteractTypeOuterClass.InteractType;
import emu.grasscutter.net.proto.RetcodeOuterClass; import emu.grasscutter.net.proto.RetcodeOuterClass;
public class PacketGadgetInteractRsp extends BasePacket { public class PacketGadgetInteractRsp extends BasePacket {
public PacketGadgetInteractRsp(EntityGadget gadget, InteractType interact) { public PacketGadgetInteractRsp(EntityBaseGadget gadget, InteractType interact) {
super(PacketOpcodes.GadgetInteractRsp); super(PacketOpcodes.GadgetInteractRsp);
GadgetInteractRsp proto = GadgetInteractRsp.newBuilder() GadgetInteractRsp proto = GadgetInteractRsp.newBuilder()
......
package emu.grasscutter.server.packet.send;
import emu.grasscutter.game.entity.EntityGadget;
import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.GadgetStateNotifyOuterClass.GadgetStateNotify;
public class PacketGadgetStateNotify extends BasePacket {
public PacketGadgetStateNotify(EntityGadget gadget, int newState) {
super(PacketOpcodes.GadgetStateNotify);
GadgetStateNotify proto = GadgetStateNotify.newBuilder()
.setGadgetEntityId(gadget.getId())
.setGadgetState(newState)
.setIsEnableInteract(true)
.build();
this.setData(proto);
}
}
...@@ -7,7 +7,5 @@ public class PacketPathfindingEnterSceneRsp extends BasePacket { ...@@ -7,7 +7,5 @@ public class PacketPathfindingEnterSceneRsp extends BasePacket {
public PacketPathfindingEnterSceneRsp(int clientSequence) { public PacketPathfindingEnterSceneRsp(int clientSequence) {
super(PacketOpcodes.PathfindingEnterSceneRsp); super(PacketOpcodes.PathfindingEnterSceneRsp);
this.buildHeader(clientSequence);
} }
} }
package emu.grasscutter.server.packet.send;
import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.PlayerEnterDungeonRspOuterClass.PlayerEnterDungeonRsp;
public class PacketPlayerEnterDungeonRsp extends BasePacket {
public PacketPlayerEnterDungeonRsp(int pointId, int dungeonId) {
super(PacketOpcodes.PlayerEnterDungeonRsp);
PlayerEnterDungeonRsp proto = PlayerEnterDungeonRsp.newBuilder()
.setPointId(pointId)
.setDungeonId(dungeonId)
.build();
this.setData(proto);
}
}
package emu.grasscutter.server.packet.send;
import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.SelectWorktopOptionRspOuterClass.SelectWorktopOptionRsp;
public class PacketSelectWorktopOptionRsp extends BasePacket {
public PacketSelectWorktopOptionRsp(int entityId, int optionId) {
super(PacketOpcodes.SelectWorktopOptionRsp);
SelectWorktopOptionRsp proto = SelectWorktopOptionRsp.newBuilder()
.setGadgetEntityId(entityId)
.setOptionId(optionId)
.build();
this.setData(proto);
}
}
package emu.grasscutter.server.packet.send;
import emu.grasscutter.game.entity.EntityGadget;
import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.WorktopOptionNotifyOuterClass.WorktopOptionNotify;
public class PacketWorktopOptionNotify extends BasePacket {
public PacketWorktopOptionNotify(EntityGadget gadget) {
super(PacketOpcodes.WorktopOptionNotify);
WorktopOptionNotify.Builder proto = WorktopOptionNotify.newBuilder()
.setGadgetEntityId(gadget.getId());
if (gadget.getWorktopOptions() != null) {
proto.addAllOptionList(gadget.getWorktopOptions());
}
this.setData(proto);
}
}
...@@ -67,6 +67,7 @@ public final class Utils { ...@@ -67,6 +67,7 @@ public final class Utils {
private static final char[] HEX_ARRAY = "0123456789abcdef".toCharArray(); private static final char[] HEX_ARRAY = "0123456789abcdef".toCharArray();
public static String bytesToHex(byte[] bytes) { public static String bytesToHex(byte[] bytes) {
if (bytes == null) return "";
char[] hexChars = new char[bytes.length * 2]; char[] hexChars = new char[bytes.length * 2];
for (int j = 0; j < bytes.length; j++) { for (int j = 0; j < bytes.length; j++) {
int v = bytes[j] & 0xFF; int v = bytes[j] & 0xFF;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment