diff --git a/src/main/java/emu/grasscutter/data/GenshinData.java b/src/main/java/emu/grasscutter/data/GenshinData.java index bb2709108..7dc5a5f7c 100644 --- a/src/main/java/emu/grasscutter/data/GenshinData.java +++ b/src/main/java/emu/grasscutter/data/GenshinData.java @@ -8,6 +8,7 @@ import emu.grasscutter.Grasscutter; import emu.grasscutter.utils.Utils; import emu.grasscutter.data.custom.AbilityEmbryoEntry; import emu.grasscutter.data.custom.OpenConfigEntry; +import emu.grasscutter.data.custom.ScenePointEntry; import emu.grasscutter.data.def.*; import it.unimi.dsi.fastutil.ints.Int2ObjectLinkedOpenHashMap; import it.unimi.dsi.fastutil.ints.Int2ObjectMap; @@ -18,6 +19,7 @@ public class GenshinData { private static final Int2ObjectMap abilityHashes = new Int2ObjectOpenHashMap<>(); private static final Map abilityEmbryos = new HashMap<>(); private static final Map openConfigEntries = new HashMap<>(); + private static final Map scenePointEntries = new HashMap<>(); // ExcelConfigs private static final Int2ObjectMap playerLevelDataMap = new Int2ObjectOpenHashMap<>(); @@ -82,6 +84,10 @@ public class GenshinData { return openConfigEntries; } + public static Map getScenePointEntries() { + return scenePointEntries; + } + public static Int2ObjectMap getAvatarDataMap() { return avatarDataMap; } diff --git a/src/main/java/emu/grasscutter/data/ResourceLoader.java b/src/main/java/emu/grasscutter/data/ResourceLoader.java index f50067c65..e597257ce 100644 --- a/src/main/java/emu/grasscutter/data/ResourceLoader.java +++ b/src/main/java/emu/grasscutter/data/ResourceLoader.java @@ -10,11 +10,15 @@ import java.util.regex.Pattern; import emu.grasscutter.utils.Utils; import org.reflections.Reflections; +import com.google.gson.JsonElement; import com.google.gson.reflect.TypeToken; import emu.grasscutter.Grasscutter; +import emu.grasscutter.data.common.PointData; +import emu.grasscutter.data.common.ScenePointConfig; import emu.grasscutter.data.custom.AbilityEmbryoEntry; import emu.grasscutter.data.custom.OpenConfigEntry; +import emu.grasscutter.data.custom.ScenePointEntry; import it.unimi.dsi.fastutil.ints.Int2ObjectMap; public class ResourceLoader { @@ -42,6 +46,7 @@ public class ResourceLoader { loadOpenConfig(); // Load resources loadResources(); + loadScenePoints(); // Process into depots GenshinDepot.load(); // Custom - TODO move this somewhere else @@ -121,6 +126,45 @@ public class ResourceLoader { } } + private static void loadScenePoints() { + Pattern pattern = Pattern.compile("(?<=scene)(.*?)(?=_point.json)"); + File folder = new File(Grasscutter.getConfig().RESOURCE_FOLDER + "BinOutPut/Scene/Point"); + List scenePointList = new ArrayList<>(); + for (File file : folder.listFiles()) { + ScenePointConfig config = null; + Integer sceneId = null; + + Matcher matcher = pattern.matcher(file.getName()); + if (matcher.find()) { + sceneId = Integer.parseInt(matcher.group(1)); + } else { + continue; + } + + try (FileReader fileReader = new FileReader(file)) { + config = Grasscutter.getGsonFactory().fromJson(fileReader, ScenePointConfig.class); + } catch (Exception e) { + e.printStackTrace(); + continue; + } + + if (config.points == null) { + continue; + } + + for (Map.Entry entry : config.points.entrySet()) { + PointData pointData = Grasscutter.getGsonFactory().fromJson(entry.getValue(), PointData.class); + + ScenePointEntry sl = new ScenePointEntry(sceneId + "_" + entry.getKey(), pointData); + scenePointList.add(sl); + } + + for (ScenePointEntry entry : scenePointList) { + GenshinData.getScenePointEntries().put(entry.getName(), entry); + } + } + } + private static void loadAbilityEmbryos() { // Read from cached file if exists File embryoCache = new File(Grasscutter.getConfig().DATA_FOLDER + "AbilityEmbryos.json"); diff --git a/src/main/java/emu/grasscutter/data/common/PointData.java b/src/main/java/emu/grasscutter/data/common/PointData.java new file mode 100644 index 000000000..7c31d2f06 --- /dev/null +++ b/src/main/java/emu/grasscutter/data/common/PointData.java @@ -0,0 +1,43 @@ +package emu.grasscutter.data.common; + +public class PointData { + private pos tranPos; + + public pos getTranPos() { + return tranPos; + } + + public void setTranPos(pos tranPos) { + this.tranPos = tranPos; + } + + public class pos { + private float x; + private float y; + private float z; + + public float getX() { + return x; + } + + public void setX(float x) { + this.x = x; + } + + public float getY() { + return y; + } + + public void setY(float y) { + this.y = y; + } + + public float getZ() { + return z; + } + + public void setZ(float z) { + this.z = z; + } + } +} diff --git a/src/main/java/emu/grasscutter/data/common/ScenePointConfig.java b/src/main/java/emu/grasscutter/data/common/ScenePointConfig.java new file mode 100644 index 000000000..340f7476f --- /dev/null +++ b/src/main/java/emu/grasscutter/data/common/ScenePointConfig.java @@ -0,0 +1,15 @@ +package emu.grasscutter.data.common; + +import com.google.gson.JsonObject; + +public class ScenePointConfig { + public JsonObject points; + + public JsonObject getPoints() { + return points; + } + + public void setPoints(JsonObject Points) { + points = Points; + } +} diff --git a/src/main/java/emu/grasscutter/data/custom/ScenePointEntry.java b/src/main/java/emu/grasscutter/data/custom/ScenePointEntry.java new file mode 100644 index 000000000..3e904f5c8 --- /dev/null +++ b/src/main/java/emu/grasscutter/data/custom/ScenePointEntry.java @@ -0,0 +1,21 @@ +package emu.grasscutter.data.custom; + +import emu.grasscutter.data.common.PointData; + +public class ScenePointEntry { + private String name; + private PointData pointData; + + public ScenePointEntry(String name, PointData pointData) { + this.name = name; + this.pointData = pointData; + } + + public String getName() { + return name; + } + + public PointData getPointData() { + return pointData; + } +} diff --git a/src/main/java/emu/grasscutter/game/World.java b/src/main/java/emu/grasscutter/game/World.java index 02c0df63a..4375d8e4f 100644 --- a/src/main/java/emu/grasscutter/game/World.java +++ b/src/main/java/emu/grasscutter/game/World.java @@ -206,6 +206,25 @@ public class World implements Iterable { public void deregisterScene(GenshinScene scene) { this.getScenes().remove(scene.getId()); } + + public boolean forceTransferPlayerToScene(GenshinPlayer player, int sceneId, Position pos) { + // Forces the client to reload the scene map to prevent the player from falling off the map. + if (GenshinData.getSceneDataMap().get(sceneId) == null) { + return false; + } + + if (player.getScene() != null) { + player.getScene().removePlayer(player); + } + + GenshinScene scene = this.getSceneById(sceneId); + scene.addPlayer(player); + player.getPos().set(pos); + + // Teleport packet + player.sendPacket(new PacketPlayerEnterSceneNotify(player, EnterType.EnterSelf, EnterReason.TransPoint, sceneId, pos)); + return true; + } public boolean transferPlayerToScene(GenshinPlayer player, int sceneId, Position pos) { if (player.getScene().getId() == sceneId || GenshinData.getSceneDataMap().get(sceneId) == null) { diff --git a/src/main/java/emu/grasscutter/net/proto/SceneTransToPointReqOuterClass.java b/src/main/java/emu/grasscutter/net/proto/SceneTransToPointReqOuterClass.java new file mode 100644 index 000000000..e807e3b55 --- /dev/null +++ b/src/main/java/emu/grasscutter/net/proto/SceneTransToPointReqOuterClass.java @@ -0,0 +1,750 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: SceneTransToPointReq.proto + +package emu.grasscutter.net.proto; + +public final class SceneTransToPointReqOuterClass { + private SceneTransToPointReqOuterClass() {} + public static void registerAllExtensions( + com.google.protobuf.ExtensionRegistryLite registry) { + } + + public static void registerAllExtensions( + com.google.protobuf.ExtensionRegistry registry) { + registerAllExtensions( + (com.google.protobuf.ExtensionRegistryLite) registry); + } + public interface SceneTransToPointReqOrBuilder extends + // @@protoc_insertion_point(interface_extends:SceneTransToPointReq) + com.google.protobuf.MessageOrBuilder { + + /** + * uint32 sceneId = 1; + * @return The sceneId. + */ + int getSceneId(); + + /** + * uint32 pointId = 2; + * @return The pointId. + */ + int getPointId(); + } + /** + * Protobuf type {@code SceneTransToPointReq} + */ + public static final class SceneTransToPointReq extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:SceneTransToPointReq) + SceneTransToPointReqOrBuilder { + private static final long serialVersionUID = 0L; + // Use SceneTransToPointReq.newBuilder() to construct. + private SceneTransToPointReq(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private SceneTransToPointReq() { + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + UnusedPrivateParameter unused) { + return new SceneTransToPointReq(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private SceneTransToPointReq( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: { + + sceneId_ = input.readUInt32(); + break; + } + case 16: { + + pointId_ = input.readUInt32(); + break; + } + default: { + if (!parseUnknownField( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return emu.grasscutter.net.proto.SceneTransToPointReqOuterClass.internal_static_SceneTransToPointReq_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return emu.grasscutter.net.proto.SceneTransToPointReqOuterClass.internal_static_SceneTransToPointReq_fieldAccessorTable + .ensureFieldAccessorsInitialized( + emu.grasscutter.net.proto.SceneTransToPointReqOuterClass.SceneTransToPointReq.class, emu.grasscutter.net.proto.SceneTransToPointReqOuterClass.SceneTransToPointReq.Builder.class); + } + + /** + * Protobuf enum {@code SceneTransToPointReq.CmdId} + */ + public enum CmdId + implements com.google.protobuf.ProtocolMessageEnum { + /** + * NONE = 0; + */ + NONE(0, 0), + /** + * ENET_IS_RELIABLE = 1; + */ + ENET_IS_RELIABLE(2, 1), + /** + * CMD_ID = 219; + */ + CMD_ID(4, 219), + UNRECOGNIZED(-1, -1), + ; + + /** + * ENET_CHANNEL_ID = 0; + */ + public static final CmdId ENET_CHANNEL_ID = NONE; + /** + * IS_ALLOW_CLIENT = 1; + */ + public static final CmdId IS_ALLOW_CLIENT = ENET_IS_RELIABLE; + /** + * NONE = 0; + */ + public static final int NONE_VALUE = 0; + /** + * ENET_CHANNEL_ID = 0; + */ + public static final int ENET_CHANNEL_ID_VALUE = 0; + /** + * ENET_IS_RELIABLE = 1; + */ + public static final int ENET_IS_RELIABLE_VALUE = 1; + /** + * IS_ALLOW_CLIENT = 1; + */ + public static final int IS_ALLOW_CLIENT_VALUE = 1; + /** + * CMD_ID = 219; + */ + public static final int CMD_ID_VALUE = 219; + + + public final int getNumber() { + if (index == -1) { + throw new java.lang.IllegalArgumentException( + "Can't get the number of an unknown enum value."); + } + return value; + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static CmdId valueOf(int value) { + return forNumber(value); + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + */ + public static CmdId forNumber(int value) { + switch (value) { + case 0: return NONE; + case 1: return ENET_IS_RELIABLE; + case 219: return CMD_ID; + default: return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap + internalGetValueMap() { + return internalValueMap; + } + private static final com.google.protobuf.Internal.EnumLiteMap< + CmdId> internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public CmdId findValueByNumber(int number) { + return CmdId.forNumber(number); + } + }; + + public final com.google.protobuf.Descriptors.EnumValueDescriptor + getValueDescriptor() { + if (index == -1) { + throw new java.lang.IllegalStateException( + "Can't get the descriptor of an unrecognized enum value."); + } + return getDescriptor().getValues().get(index); + } + public final com.google.protobuf.Descriptors.EnumDescriptor + getDescriptorForType() { + return getDescriptor(); + } + public static final com.google.protobuf.Descriptors.EnumDescriptor + getDescriptor() { + return emu.grasscutter.net.proto.SceneTransToPointReqOuterClass.SceneTransToPointReq.getDescriptor().getEnumTypes().get(0); + } + + private static final CmdId[] VALUES = getStaticValuesArray(); + private static CmdId[] getStaticValuesArray() { + return new CmdId[] { + NONE, ENET_CHANNEL_ID, ENET_IS_RELIABLE, IS_ALLOW_CLIENT, CMD_ID, + }; + } + public static CmdId valueOf( + com.google.protobuf.Descriptors.EnumValueDescriptor desc) { + if (desc.getType() != getDescriptor()) { + throw new java.lang.IllegalArgumentException( + "EnumValueDescriptor is not for this type."); + } + if (desc.getIndex() == -1) { + return UNRECOGNIZED; + } + return VALUES[desc.getIndex()]; + } + + private final int index; + private final int value; + + private CmdId(int index, int value) { + this.index = index; + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:SceneTransToPointReq.CmdId) + } + + public static final int SCENEID_FIELD_NUMBER = 1; + private int sceneId_; + /** + * uint32 sceneId = 1; + * @return The sceneId. + */ + @java.lang.Override + public int getSceneId() { + return sceneId_; + } + + public static final int POINTID_FIELD_NUMBER = 2; + private int pointId_; + /** + * uint32 pointId = 2; + * @return The pointId. + */ + @java.lang.Override + public int getPointId() { + return pointId_; + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (sceneId_ != 0) { + output.writeUInt32(1, sceneId_); + } + if (pointId_ != 0) { + output.writeUInt32(2, pointId_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (sceneId_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeUInt32Size(1, sceneId_); + } + if (pointId_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeUInt32Size(2, pointId_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof emu.grasscutter.net.proto.SceneTransToPointReqOuterClass.SceneTransToPointReq)) { + return super.equals(obj); + } + emu.grasscutter.net.proto.SceneTransToPointReqOuterClass.SceneTransToPointReq other = (emu.grasscutter.net.proto.SceneTransToPointReqOuterClass.SceneTransToPointReq) obj; + + if (getSceneId() + != other.getSceneId()) return false; + if (getPointId() + != other.getPointId()) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + SCENEID_FIELD_NUMBER; + hash = (53 * hash) + getSceneId(); + hash = (37 * hash) + POINTID_FIELD_NUMBER; + hash = (53 * hash) + getPointId(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static emu.grasscutter.net.proto.SceneTransToPointReqOuterClass.SceneTransToPointReq parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static emu.grasscutter.net.proto.SceneTransToPointReqOuterClass.SceneTransToPointReq parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static emu.grasscutter.net.proto.SceneTransToPointReqOuterClass.SceneTransToPointReq parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static emu.grasscutter.net.proto.SceneTransToPointReqOuterClass.SceneTransToPointReq parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static emu.grasscutter.net.proto.SceneTransToPointReqOuterClass.SceneTransToPointReq parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static emu.grasscutter.net.proto.SceneTransToPointReqOuterClass.SceneTransToPointReq parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static emu.grasscutter.net.proto.SceneTransToPointReqOuterClass.SceneTransToPointReq parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static emu.grasscutter.net.proto.SceneTransToPointReqOuterClass.SceneTransToPointReq parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + public static emu.grasscutter.net.proto.SceneTransToPointReqOuterClass.SceneTransToPointReq parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static emu.grasscutter.net.proto.SceneTransToPointReqOuterClass.SceneTransToPointReq parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static emu.grasscutter.net.proto.SceneTransToPointReqOuterClass.SceneTransToPointReq parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static emu.grasscutter.net.proto.SceneTransToPointReqOuterClass.SceneTransToPointReq parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(emu.grasscutter.net.proto.SceneTransToPointReqOuterClass.SceneTransToPointReq prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code SceneTransToPointReq} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:SceneTransToPointReq) + emu.grasscutter.net.proto.SceneTransToPointReqOuterClass.SceneTransToPointReqOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return emu.grasscutter.net.proto.SceneTransToPointReqOuterClass.internal_static_SceneTransToPointReq_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return emu.grasscutter.net.proto.SceneTransToPointReqOuterClass.internal_static_SceneTransToPointReq_fieldAccessorTable + .ensureFieldAccessorsInitialized( + emu.grasscutter.net.proto.SceneTransToPointReqOuterClass.SceneTransToPointReq.class, emu.grasscutter.net.proto.SceneTransToPointReqOuterClass.SceneTransToPointReq.Builder.class); + } + + // Construct using emu.grasscutter.net.proto.SceneTransToPointReqOuterClass.SceneTransToPointReq.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { + } + } + @java.lang.Override + public Builder clear() { + super.clear(); + sceneId_ = 0; + + pointId_ = 0; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return emu.grasscutter.net.proto.SceneTransToPointReqOuterClass.internal_static_SceneTransToPointReq_descriptor; + } + + @java.lang.Override + public emu.grasscutter.net.proto.SceneTransToPointReqOuterClass.SceneTransToPointReq getDefaultInstanceForType() { + return emu.grasscutter.net.proto.SceneTransToPointReqOuterClass.SceneTransToPointReq.getDefaultInstance(); + } + + @java.lang.Override + public emu.grasscutter.net.proto.SceneTransToPointReqOuterClass.SceneTransToPointReq build() { + emu.grasscutter.net.proto.SceneTransToPointReqOuterClass.SceneTransToPointReq result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public emu.grasscutter.net.proto.SceneTransToPointReqOuterClass.SceneTransToPointReq buildPartial() { + emu.grasscutter.net.proto.SceneTransToPointReqOuterClass.SceneTransToPointReq result = new emu.grasscutter.net.proto.SceneTransToPointReqOuterClass.SceneTransToPointReq(this); + result.sceneId_ = sceneId_; + result.pointId_ = pointId_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.setField(field, value); + } + @java.lang.Override + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + @java.lang.Override + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.addRepeatedField(field, value); + } + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof emu.grasscutter.net.proto.SceneTransToPointReqOuterClass.SceneTransToPointReq) { + return mergeFrom((emu.grasscutter.net.proto.SceneTransToPointReqOuterClass.SceneTransToPointReq)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(emu.grasscutter.net.proto.SceneTransToPointReqOuterClass.SceneTransToPointReq other) { + if (other == emu.grasscutter.net.proto.SceneTransToPointReqOuterClass.SceneTransToPointReq.getDefaultInstance()) return this; + if (other.getSceneId() != 0) { + setSceneId(other.getSceneId()); + } + if (other.getPointId() != 0) { + setPointId(other.getPointId()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + emu.grasscutter.net.proto.SceneTransToPointReqOuterClass.SceneTransToPointReq parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (emu.grasscutter.net.proto.SceneTransToPointReqOuterClass.SceneTransToPointReq) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int sceneId_ ; + /** + * uint32 sceneId = 1; + * @return The sceneId. + */ + @java.lang.Override + public int getSceneId() { + return sceneId_; + } + /** + * uint32 sceneId = 1; + * @param value The sceneId to set. + * @return This builder for chaining. + */ + public Builder setSceneId(int value) { + + sceneId_ = value; + onChanged(); + return this; + } + /** + * uint32 sceneId = 1; + * @return This builder for chaining. + */ + public Builder clearSceneId() { + + sceneId_ = 0; + onChanged(); + return this; + } + + private int pointId_ ; + /** + * uint32 pointId = 2; + * @return The pointId. + */ + @java.lang.Override + public int getPointId() { + return pointId_; + } + /** + * uint32 pointId = 2; + * @param value The pointId to set. + * @return This builder for chaining. + */ + public Builder setPointId(int value) { + + pointId_ = value; + onChanged(); + return this; + } + /** + * uint32 pointId = 2; + * @return This builder for chaining. + */ + public Builder clearPointId() { + + pointId_ = 0; + onChanged(); + return this; + } + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:SceneTransToPointReq) + } + + // @@protoc_insertion_point(class_scope:SceneTransToPointReq) + private static final emu.grasscutter.net.proto.SceneTransToPointReqOuterClass.SceneTransToPointReq DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new emu.grasscutter.net.proto.SceneTransToPointReqOuterClass.SceneTransToPointReq(); + } + + public static emu.grasscutter.net.proto.SceneTransToPointReqOuterClass.SceneTransToPointReq getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public SceneTransToPointReq parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new SceneTransToPointReq(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public emu.grasscutter.net.proto.SceneTransToPointReqOuterClass.SceneTransToPointReq getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + + } + + private static final com.google.protobuf.Descriptors.Descriptor + internal_static_SceneTransToPointReq_descriptor; + private static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_SceneTransToPointReq_fieldAccessorTable; + + public static com.google.protobuf.Descriptors.FileDescriptor + getDescriptor() { + return descriptor; + } + private static com.google.protobuf.Descriptors.FileDescriptor + descriptor; + static { + java.lang.String[] descriptorData = { + "\n\032SceneTransToPointReq.proto\"\234\001\n\024SceneTr" + + "ansToPointReq\022\017\n\007sceneId\030\001 \001(\r\022\017\n\007pointI" + + "d\030\002 \001(\r\"b\n\005CmdId\022\010\n\004NONE\020\000\022\023\n\017ENET_CHANN" + + "EL_ID\020\000\022\024\n\020ENET_IS_RELIABLE\020\001\022\023\n\017IS_ALLO" + + "W_CLIENT\020\001\022\013\n\006CMD_ID\020\333\001\032\002\020\001B\033\n\031emu.grass" + + "cutter.net.protob\006proto3" + }; + descriptor = com.google.protobuf.Descriptors.FileDescriptor + .internalBuildGeneratedFileFrom(descriptorData, + new com.google.protobuf.Descriptors.FileDescriptor[] { + }); + internal_static_SceneTransToPointReq_descriptor = + getDescriptor().getMessageTypes().get(0); + internal_static_SceneTransToPointReq_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_SceneTransToPointReq_descriptor, + new java.lang.String[] { "SceneId", "PointId", }); + } + + // @@protoc_insertion_point(outer_class_scope) +} diff --git a/src/main/java/emu/grasscutter/net/proto/SceneTransToPointRspOuterClass.java b/src/main/java/emu/grasscutter/net/proto/SceneTransToPointRspOuterClass.java new file mode 100644 index 000000000..e807e3b55 --- /dev/null +++ b/src/main/java/emu/grasscutter/net/proto/SceneTransToPointRspOuterClass.java @@ -0,0 +1,750 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: SceneTransToPointReq.proto + +package emu.grasscutter.net.proto; + +public final class SceneTransToPointReqOuterClass { + private SceneTransToPointReqOuterClass() {} + public static void registerAllExtensions( + com.google.protobuf.ExtensionRegistryLite registry) { + } + + public static void registerAllExtensions( + com.google.protobuf.ExtensionRegistry registry) { + registerAllExtensions( + (com.google.protobuf.ExtensionRegistryLite) registry); + } + public interface SceneTransToPointReqOrBuilder extends + // @@protoc_insertion_point(interface_extends:SceneTransToPointReq) + com.google.protobuf.MessageOrBuilder { + + /** + * uint32 sceneId = 1; + * @return The sceneId. + */ + int getSceneId(); + + /** + * uint32 pointId = 2; + * @return The pointId. + */ + int getPointId(); + } + /** + * Protobuf type {@code SceneTransToPointReq} + */ + public static final class SceneTransToPointReq extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:SceneTransToPointReq) + SceneTransToPointReqOrBuilder { + private static final long serialVersionUID = 0L; + // Use SceneTransToPointReq.newBuilder() to construct. + private SceneTransToPointReq(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private SceneTransToPointReq() { + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + UnusedPrivateParameter unused) { + return new SceneTransToPointReq(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private SceneTransToPointReq( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: { + + sceneId_ = input.readUInt32(); + break; + } + case 16: { + + pointId_ = input.readUInt32(); + break; + } + default: { + if (!parseUnknownField( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return emu.grasscutter.net.proto.SceneTransToPointReqOuterClass.internal_static_SceneTransToPointReq_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return emu.grasscutter.net.proto.SceneTransToPointReqOuterClass.internal_static_SceneTransToPointReq_fieldAccessorTable + .ensureFieldAccessorsInitialized( + emu.grasscutter.net.proto.SceneTransToPointReqOuterClass.SceneTransToPointReq.class, emu.grasscutter.net.proto.SceneTransToPointReqOuterClass.SceneTransToPointReq.Builder.class); + } + + /** + * Protobuf enum {@code SceneTransToPointReq.CmdId} + */ + public enum CmdId + implements com.google.protobuf.ProtocolMessageEnum { + /** + * NONE = 0; + */ + NONE(0, 0), + /** + * ENET_IS_RELIABLE = 1; + */ + ENET_IS_RELIABLE(2, 1), + /** + * CMD_ID = 219; + */ + CMD_ID(4, 219), + UNRECOGNIZED(-1, -1), + ; + + /** + * ENET_CHANNEL_ID = 0; + */ + public static final CmdId ENET_CHANNEL_ID = NONE; + /** + * IS_ALLOW_CLIENT = 1; + */ + public static final CmdId IS_ALLOW_CLIENT = ENET_IS_RELIABLE; + /** + * NONE = 0; + */ + public static final int NONE_VALUE = 0; + /** + * ENET_CHANNEL_ID = 0; + */ + public static final int ENET_CHANNEL_ID_VALUE = 0; + /** + * ENET_IS_RELIABLE = 1; + */ + public static final int ENET_IS_RELIABLE_VALUE = 1; + /** + * IS_ALLOW_CLIENT = 1; + */ + public static final int IS_ALLOW_CLIENT_VALUE = 1; + /** + * CMD_ID = 219; + */ + public static final int CMD_ID_VALUE = 219; + + + public final int getNumber() { + if (index == -1) { + throw new java.lang.IllegalArgumentException( + "Can't get the number of an unknown enum value."); + } + return value; + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static CmdId valueOf(int value) { + return forNumber(value); + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + */ + public static CmdId forNumber(int value) { + switch (value) { + case 0: return NONE; + case 1: return ENET_IS_RELIABLE; + case 219: return CMD_ID; + default: return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap + internalGetValueMap() { + return internalValueMap; + } + private static final com.google.protobuf.Internal.EnumLiteMap< + CmdId> internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public CmdId findValueByNumber(int number) { + return CmdId.forNumber(number); + } + }; + + public final com.google.protobuf.Descriptors.EnumValueDescriptor + getValueDescriptor() { + if (index == -1) { + throw new java.lang.IllegalStateException( + "Can't get the descriptor of an unrecognized enum value."); + } + return getDescriptor().getValues().get(index); + } + public final com.google.protobuf.Descriptors.EnumDescriptor + getDescriptorForType() { + return getDescriptor(); + } + public static final com.google.protobuf.Descriptors.EnumDescriptor + getDescriptor() { + return emu.grasscutter.net.proto.SceneTransToPointReqOuterClass.SceneTransToPointReq.getDescriptor().getEnumTypes().get(0); + } + + private static final CmdId[] VALUES = getStaticValuesArray(); + private static CmdId[] getStaticValuesArray() { + return new CmdId[] { + NONE, ENET_CHANNEL_ID, ENET_IS_RELIABLE, IS_ALLOW_CLIENT, CMD_ID, + }; + } + public static CmdId valueOf( + com.google.protobuf.Descriptors.EnumValueDescriptor desc) { + if (desc.getType() != getDescriptor()) { + throw new java.lang.IllegalArgumentException( + "EnumValueDescriptor is not for this type."); + } + if (desc.getIndex() == -1) { + return UNRECOGNIZED; + } + return VALUES[desc.getIndex()]; + } + + private final int index; + private final int value; + + private CmdId(int index, int value) { + this.index = index; + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:SceneTransToPointReq.CmdId) + } + + public static final int SCENEID_FIELD_NUMBER = 1; + private int sceneId_; + /** + * uint32 sceneId = 1; + * @return The sceneId. + */ + @java.lang.Override + public int getSceneId() { + return sceneId_; + } + + public static final int POINTID_FIELD_NUMBER = 2; + private int pointId_; + /** + * uint32 pointId = 2; + * @return The pointId. + */ + @java.lang.Override + public int getPointId() { + return pointId_; + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (sceneId_ != 0) { + output.writeUInt32(1, sceneId_); + } + if (pointId_ != 0) { + output.writeUInt32(2, pointId_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (sceneId_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeUInt32Size(1, sceneId_); + } + if (pointId_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeUInt32Size(2, pointId_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof emu.grasscutter.net.proto.SceneTransToPointReqOuterClass.SceneTransToPointReq)) { + return super.equals(obj); + } + emu.grasscutter.net.proto.SceneTransToPointReqOuterClass.SceneTransToPointReq other = (emu.grasscutter.net.proto.SceneTransToPointReqOuterClass.SceneTransToPointReq) obj; + + if (getSceneId() + != other.getSceneId()) return false; + if (getPointId() + != other.getPointId()) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + SCENEID_FIELD_NUMBER; + hash = (53 * hash) + getSceneId(); + hash = (37 * hash) + POINTID_FIELD_NUMBER; + hash = (53 * hash) + getPointId(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static emu.grasscutter.net.proto.SceneTransToPointReqOuterClass.SceneTransToPointReq parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static emu.grasscutter.net.proto.SceneTransToPointReqOuterClass.SceneTransToPointReq parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static emu.grasscutter.net.proto.SceneTransToPointReqOuterClass.SceneTransToPointReq parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static emu.grasscutter.net.proto.SceneTransToPointReqOuterClass.SceneTransToPointReq parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static emu.grasscutter.net.proto.SceneTransToPointReqOuterClass.SceneTransToPointReq parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static emu.grasscutter.net.proto.SceneTransToPointReqOuterClass.SceneTransToPointReq parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static emu.grasscutter.net.proto.SceneTransToPointReqOuterClass.SceneTransToPointReq parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static emu.grasscutter.net.proto.SceneTransToPointReqOuterClass.SceneTransToPointReq parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + public static emu.grasscutter.net.proto.SceneTransToPointReqOuterClass.SceneTransToPointReq parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static emu.grasscutter.net.proto.SceneTransToPointReqOuterClass.SceneTransToPointReq parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static emu.grasscutter.net.proto.SceneTransToPointReqOuterClass.SceneTransToPointReq parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static emu.grasscutter.net.proto.SceneTransToPointReqOuterClass.SceneTransToPointReq parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(emu.grasscutter.net.proto.SceneTransToPointReqOuterClass.SceneTransToPointReq prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code SceneTransToPointReq} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:SceneTransToPointReq) + emu.grasscutter.net.proto.SceneTransToPointReqOuterClass.SceneTransToPointReqOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return emu.grasscutter.net.proto.SceneTransToPointReqOuterClass.internal_static_SceneTransToPointReq_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return emu.grasscutter.net.proto.SceneTransToPointReqOuterClass.internal_static_SceneTransToPointReq_fieldAccessorTable + .ensureFieldAccessorsInitialized( + emu.grasscutter.net.proto.SceneTransToPointReqOuterClass.SceneTransToPointReq.class, emu.grasscutter.net.proto.SceneTransToPointReqOuterClass.SceneTransToPointReq.Builder.class); + } + + // Construct using emu.grasscutter.net.proto.SceneTransToPointReqOuterClass.SceneTransToPointReq.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { + } + } + @java.lang.Override + public Builder clear() { + super.clear(); + sceneId_ = 0; + + pointId_ = 0; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return emu.grasscutter.net.proto.SceneTransToPointReqOuterClass.internal_static_SceneTransToPointReq_descriptor; + } + + @java.lang.Override + public emu.grasscutter.net.proto.SceneTransToPointReqOuterClass.SceneTransToPointReq getDefaultInstanceForType() { + return emu.grasscutter.net.proto.SceneTransToPointReqOuterClass.SceneTransToPointReq.getDefaultInstance(); + } + + @java.lang.Override + public emu.grasscutter.net.proto.SceneTransToPointReqOuterClass.SceneTransToPointReq build() { + emu.grasscutter.net.proto.SceneTransToPointReqOuterClass.SceneTransToPointReq result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public emu.grasscutter.net.proto.SceneTransToPointReqOuterClass.SceneTransToPointReq buildPartial() { + emu.grasscutter.net.proto.SceneTransToPointReqOuterClass.SceneTransToPointReq result = new emu.grasscutter.net.proto.SceneTransToPointReqOuterClass.SceneTransToPointReq(this); + result.sceneId_ = sceneId_; + result.pointId_ = pointId_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.setField(field, value); + } + @java.lang.Override + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + @java.lang.Override + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.addRepeatedField(field, value); + } + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof emu.grasscutter.net.proto.SceneTransToPointReqOuterClass.SceneTransToPointReq) { + return mergeFrom((emu.grasscutter.net.proto.SceneTransToPointReqOuterClass.SceneTransToPointReq)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(emu.grasscutter.net.proto.SceneTransToPointReqOuterClass.SceneTransToPointReq other) { + if (other == emu.grasscutter.net.proto.SceneTransToPointReqOuterClass.SceneTransToPointReq.getDefaultInstance()) return this; + if (other.getSceneId() != 0) { + setSceneId(other.getSceneId()); + } + if (other.getPointId() != 0) { + setPointId(other.getPointId()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + emu.grasscutter.net.proto.SceneTransToPointReqOuterClass.SceneTransToPointReq parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (emu.grasscutter.net.proto.SceneTransToPointReqOuterClass.SceneTransToPointReq) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int sceneId_ ; + /** + * uint32 sceneId = 1; + * @return The sceneId. + */ + @java.lang.Override + public int getSceneId() { + return sceneId_; + } + /** + * uint32 sceneId = 1; + * @param value The sceneId to set. + * @return This builder for chaining. + */ + public Builder setSceneId(int value) { + + sceneId_ = value; + onChanged(); + return this; + } + /** + * uint32 sceneId = 1; + * @return This builder for chaining. + */ + public Builder clearSceneId() { + + sceneId_ = 0; + onChanged(); + return this; + } + + private int pointId_ ; + /** + * uint32 pointId = 2; + * @return The pointId. + */ + @java.lang.Override + public int getPointId() { + return pointId_; + } + /** + * uint32 pointId = 2; + * @param value The pointId to set. + * @return This builder for chaining. + */ + public Builder setPointId(int value) { + + pointId_ = value; + onChanged(); + return this; + } + /** + * uint32 pointId = 2; + * @return This builder for chaining. + */ + public Builder clearPointId() { + + pointId_ = 0; + onChanged(); + return this; + } + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:SceneTransToPointReq) + } + + // @@protoc_insertion_point(class_scope:SceneTransToPointReq) + private static final emu.grasscutter.net.proto.SceneTransToPointReqOuterClass.SceneTransToPointReq DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new emu.grasscutter.net.proto.SceneTransToPointReqOuterClass.SceneTransToPointReq(); + } + + public static emu.grasscutter.net.proto.SceneTransToPointReqOuterClass.SceneTransToPointReq getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public SceneTransToPointReq parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new SceneTransToPointReq(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public emu.grasscutter.net.proto.SceneTransToPointReqOuterClass.SceneTransToPointReq getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + + } + + private static final com.google.protobuf.Descriptors.Descriptor + internal_static_SceneTransToPointReq_descriptor; + private static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_SceneTransToPointReq_fieldAccessorTable; + + public static com.google.protobuf.Descriptors.FileDescriptor + getDescriptor() { + return descriptor; + } + private static com.google.protobuf.Descriptors.FileDescriptor + descriptor; + static { + java.lang.String[] descriptorData = { + "\n\032SceneTransToPointReq.proto\"\234\001\n\024SceneTr" + + "ansToPointReq\022\017\n\007sceneId\030\001 \001(\r\022\017\n\007pointI" + + "d\030\002 \001(\r\"b\n\005CmdId\022\010\n\004NONE\020\000\022\023\n\017ENET_CHANN" + + "EL_ID\020\000\022\024\n\020ENET_IS_RELIABLE\020\001\022\023\n\017IS_ALLO" + + "W_CLIENT\020\001\022\013\n\006CMD_ID\020\333\001\032\002\020\001B\033\n\031emu.grass" + + "cutter.net.protob\006proto3" + }; + descriptor = com.google.protobuf.Descriptors.FileDescriptor + .internalBuildGeneratedFileFrom(descriptorData, + new com.google.protobuf.Descriptors.FileDescriptor[] { + }); + internal_static_SceneTransToPointReq_descriptor = + getDescriptor().getMessageTypes().get(0); + internal_static_SceneTransToPointReq_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_SceneTransToPointReq_descriptor, + new java.lang.String[] { "SceneId", "PointId", }); + } + + // @@protoc_insertion_point(outer_class_scope) +} diff --git a/src/main/java/emu/grasscutter/server/packet/recv/HandlerSceneTransToPointReq.java b/src/main/java/emu/grasscutter/server/packet/recv/HandlerSceneTransToPointReq.java new file mode 100644 index 000000000..6e38fb282 --- /dev/null +++ b/src/main/java/emu/grasscutter/server/packet/recv/HandlerSceneTransToPointReq.java @@ -0,0 +1,18 @@ +package emu.grasscutter.server.packet.recv; + +import emu.grasscutter.net.packet.Opcodes; +import emu.grasscutter.net.packet.PacketOpcodes; +import emu.grasscutter.net.proto.SceneTransToPointReqOuterClass.SceneTransToPointReq; +import emu.grasscutter.net.packet.PacketHandler; +import emu.grasscutter.server.game.GameSession; +import emu.grasscutter.server.packet.send.PacketSceneTransToPointRsp; + +@Opcodes(PacketOpcodes.SceneTransToPointReq) +public class HandlerSceneTransToPointReq extends PacketHandler { + + @Override + public void handle(GameSession session, byte[] header, byte[] payload) throws Exception { + SceneTransToPointReq req = SceneTransToPointReq.parseFrom(payload); + } + +} diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketSceneTransToPointRsp.java b/src/main/java/emu/grasscutter/server/packet/send/PacketSceneTransToPointRsp.java new file mode 100644 index 000000000..965c6aa6b --- /dev/null +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketSceneTransToPointRsp.java @@ -0,0 +1,35 @@ +package emu.grasscutter.server.packet.send; + +import emu.grasscutter.data.GenshinData; +import emu.grasscutter.data.custom.ScenePointEntry; +import emu.grasscutter.game.GenshinPlayer; +import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.net.packet.PacketOpcodes; +import emu.grasscutter.net.proto.SceneTransToPointRspOuterClass.SceneTransToPointRsp; +import emu.grasscutter.utils.Position; + +public class PacketSceneTransToPointRsp extends GenshinPacket { + + public PacketSceneTransToPointRsp(GenshinPlayer player, int pointId, int sceneId) { + super(PacketOpcodes.SceneTransToPointRsp); + + String code = sceneId + "_" + pointId; + ScenePointEntry scenePointEntry = GenshinData.getScenePointEntries().get(code); + + float x = scenePointEntry.getPointData().getTranPos().getX(); + float y = scenePointEntry.getPointData().getTranPos().getY(); + float z = scenePointEntry.getPointData().getTranPos().getZ(); + + player.getPos().set(new Position(x, y, z)); + + player.getWorld().forceTransferPlayerToScene(player, sceneId, player.getPos()); + + SceneTransToPointRsp proto = SceneTransToPointRsp.newBuilder() + .setRetcode(0) + .setPointId(pointId) + .setSceneId(sceneId) + .build(); + + this.setData(proto); + } +}