diff --git a/src/generated/main/emu/lunarcore/proto/TextJoinQueryScRspOuterClass.java b/src/generated/main/emu/lunarcore/proto/TextJoinQueryScRspOuterClass.java
index 9f836d1..9dd489e 100644
--- a/src/generated/main/emu/lunarcore/proto/TextJoinQueryScRspOuterClass.java
+++ b/src/generated/main/emu/lunarcore/proto/TextJoinQueryScRspOuterClass.java
@@ -10,6 +10,7 @@ import us.hebi.quickbuf.MessageFactory;
import us.hebi.quickbuf.ProtoMessage;
import us.hebi.quickbuf.ProtoSink;
import us.hebi.quickbuf.ProtoSource;
+import us.hebi.quickbuf.RepeatedMessage;
public final class TextJoinQueryScRspOuterClass {
/**
@@ -23,6 +24,11 @@ public final class TextJoinQueryScRspOuterClass {
*/
private int retcode;
+ /**
+ * repeated .TextJoinQueryScRsp.TextJoinInfo text_join_list = 4;
+ */
+ private final RepeatedMessage textJoinList = RepeatedMessage.newEmptyInstance(TextJoinInfo.getFactory());
+
private TextJoinQueryScRsp() {
}
@@ -70,12 +76,81 @@ public final class TextJoinQueryScRspOuterClass {
return this;
}
+ /**
+ * repeated .TextJoinQueryScRsp.TextJoinInfo text_join_list = 4;
+ * @return whether the textJoinList field is set
+ */
+ public boolean hasTextJoinList() {
+ return (bitField0_ & 0x00000002) != 0;
+ }
+
+ /**
+ * repeated .TextJoinQueryScRsp.TextJoinInfo text_join_list = 4;
+ * @return this
+ */
+ public TextJoinQueryScRsp clearTextJoinList() {
+ bitField0_ &= ~0x00000002;
+ textJoinList.clear();
+ return this;
+ }
+
+ /**
+ * repeated .TextJoinQueryScRsp.TextJoinInfo text_join_list = 4;
+ *
+ * This method returns the internal storage object without modifying any has state.
+ * The returned object should not be modified and be treated as read-only.
+ *
+ * Use {@link #getMutableTextJoinList()} if you want to modify it.
+ *
+ * @return internal storage object for reading
+ */
+ public RepeatedMessage getTextJoinList() {
+ return textJoinList;
+ }
+
+ /**
+ * repeated .TextJoinQueryScRsp.TextJoinInfo text_join_list = 4;
+ *
+ * This method returns the internal storage object and sets the corresponding
+ * has state. The returned object will become part of this message and its
+ * contents may be modified as long as the has state is not cleared.
+ *
+ * @return internal storage object for modifications
+ */
+ public RepeatedMessage getMutableTextJoinList() {
+ bitField0_ |= 0x00000002;
+ return textJoinList;
+ }
+
+ /**
+ * repeated .TextJoinQueryScRsp.TextJoinInfo text_join_list = 4;
+ * @param value the textJoinList to add
+ * @return this
+ */
+ public TextJoinQueryScRsp addTextJoinList(final TextJoinInfo value) {
+ bitField0_ |= 0x00000002;
+ textJoinList.add(value);
+ return this;
+ }
+
+ /**
+ * repeated .TextJoinQueryScRsp.TextJoinInfo text_join_list = 4;
+ * @param values the textJoinList to add
+ * @return this
+ */
+ public TextJoinQueryScRsp addAllTextJoinList(final TextJoinInfo... values) {
+ bitField0_ |= 0x00000002;
+ textJoinList.addAll(values);
+ return this;
+ }
+
@Override
public TextJoinQueryScRsp copyFrom(final TextJoinQueryScRsp other) {
cachedSize = other.cachedSize;
if ((bitField0_ | other.bitField0_) != 0) {
bitField0_ = other.bitField0_;
retcode = other.retcode;
+ textJoinList.copyFrom(other.textJoinList);
}
return this;
}
@@ -89,6 +164,9 @@ public final class TextJoinQueryScRspOuterClass {
if (other.hasRetcode()) {
setRetcode(other.retcode);
}
+ if (other.hasTextJoinList()) {
+ getMutableTextJoinList().addAll(other.textJoinList);
+ }
return this;
}
@@ -100,6 +178,7 @@ public final class TextJoinQueryScRspOuterClass {
cachedSize = -1;
bitField0_ = 0;
retcode = 0;
+ textJoinList.clear();
return this;
}
@@ -110,6 +189,7 @@ public final class TextJoinQueryScRspOuterClass {
}
cachedSize = -1;
bitField0_ = 0;
+ textJoinList.clearQuick();
return this;
}
@@ -123,7 +203,8 @@ public final class TextJoinQueryScRspOuterClass {
}
TextJoinQueryScRsp other = (TextJoinQueryScRsp) o;
return bitField0_ == other.bitField0_
- && (!hasRetcode() || retcode == other.retcode);
+ && (!hasRetcode() || retcode == other.retcode)
+ && (!hasTextJoinList() || textJoinList.equals(other.textJoinList));
}
@Override
@@ -132,6 +213,12 @@ public final class TextJoinQueryScRspOuterClass {
output.writeRawByte((byte) 104);
output.writeUInt32NoTag(retcode);
}
+ if ((bitField0_ & 0x00000002) != 0) {
+ for (int i = 0; i < textJoinList.length(); i++) {
+ output.writeRawByte((byte) 34);
+ output.writeMessageNoTag(textJoinList.get(i));
+ }
+ }
}
@Override
@@ -140,6 +227,9 @@ public final class TextJoinQueryScRspOuterClass {
if ((bitField0_ & 0x00000001) != 0) {
size += 1 + ProtoSink.computeUInt32SizeNoTag(retcode);
}
+ if ((bitField0_ & 0x00000002) != 0) {
+ size += (1 * textJoinList.length()) + ProtoSink.computeRepeatedMessageSizeNoTag(textJoinList);
+ }
return size;
}
@@ -155,6 +245,14 @@ public final class TextJoinQueryScRspOuterClass {
retcode = input.readUInt32();
bitField0_ |= 0x00000001;
tag = input.readTag();
+ if (tag != 34) {
+ break;
+ }
+ }
+ case 34: {
+ // textJoinList
+ tag = input.readRepeatedMessage(textJoinList, tag);
+ bitField0_ |= 0x00000002;
if (tag != 0) {
break;
}
@@ -179,6 +277,9 @@ public final class TextJoinQueryScRspOuterClass {
if ((bitField0_ & 0x00000001) != 0) {
output.writeUInt32(FieldNames.retcode, retcode);
}
+ if ((bitField0_ & 0x00000002) != 0) {
+ output.writeRepeatedMessage(FieldNames.textJoinList, textJoinList);
+ }
output.endObject();
}
@@ -200,6 +301,18 @@ public final class TextJoinQueryScRspOuterClass {
}
break;
}
+ case -1670215371:
+ case 249668097: {
+ if (input.isAtField(FieldNames.textJoinList)) {
+ if (!input.trySkipNullValue()) {
+ input.readRepeatedMessage(textJoinList);
+ bitField0_ |= 0x00000002;
+ }
+ } else {
+ input.skipUnknownField();
+ }
+ break;
+ }
default: {
input.skipUnknownField();
break;
@@ -240,6 +353,333 @@ public final class TextJoinQueryScRspOuterClass {
return TextJoinQueryScRspFactory.INSTANCE;
}
+ /**
+ * Protobuf type {@code TextJoinInfo}
+ */
+ public static final class TextJoinInfo extends ProtoMessage implements Cloneable {
+ private static final long serialVersionUID = 0L;
+
+ /**
+ * optional uint32 text_item_id = 2;
+ */
+ private int textItemId;
+
+ /**
+ * optional uint32 text_item_config_id = 3;
+ */
+ private int textItemConfigId;
+
+ private TextJoinInfo() {
+ }
+
+ /**
+ * @return a new empty instance of {@code TextJoinInfo}
+ */
+ public static TextJoinInfo newInstance() {
+ return new TextJoinInfo();
+ }
+
+ /**
+ * optional uint32 text_item_id = 2;
+ * @return whether the textItemId field is set
+ */
+ public boolean hasTextItemId() {
+ return (bitField0_ & 0x00000001) != 0;
+ }
+
+ /**
+ * optional uint32 text_item_id = 2;
+ * @return this
+ */
+ public TextJoinInfo clearTextItemId() {
+ bitField0_ &= ~0x00000001;
+ textItemId = 0;
+ return this;
+ }
+
+ /**
+ * optional uint32 text_item_id = 2;
+ * @return the textItemId
+ */
+ public int getTextItemId() {
+ return textItemId;
+ }
+
+ /**
+ * optional uint32 text_item_id = 2;
+ * @param value the textItemId to set
+ * @return this
+ */
+ public TextJoinInfo setTextItemId(final int value) {
+ bitField0_ |= 0x00000001;
+ textItemId = value;
+ return this;
+ }
+
+ /**
+ * optional uint32 text_item_config_id = 3;
+ * @return whether the textItemConfigId field is set
+ */
+ public boolean hasTextItemConfigId() {
+ return (bitField0_ & 0x00000002) != 0;
+ }
+
+ /**
+ * optional uint32 text_item_config_id = 3;
+ * @return this
+ */
+ public TextJoinInfo clearTextItemConfigId() {
+ bitField0_ &= ~0x00000002;
+ textItemConfigId = 0;
+ return this;
+ }
+
+ /**
+ * optional uint32 text_item_config_id = 3;
+ * @return the textItemConfigId
+ */
+ public int getTextItemConfigId() {
+ return textItemConfigId;
+ }
+
+ /**
+ * optional uint32 text_item_config_id = 3;
+ * @param value the textItemConfigId to set
+ * @return this
+ */
+ public TextJoinInfo setTextItemConfigId(final int value) {
+ bitField0_ |= 0x00000002;
+ textItemConfigId = value;
+ return this;
+ }
+
+ @Override
+ public TextJoinInfo copyFrom(final TextJoinInfo other) {
+ cachedSize = other.cachedSize;
+ if ((bitField0_ | other.bitField0_) != 0) {
+ bitField0_ = other.bitField0_;
+ textItemId = other.textItemId;
+ textItemConfigId = other.textItemConfigId;
+ }
+ return this;
+ }
+
+ @Override
+ public TextJoinInfo mergeFrom(final TextJoinInfo other) {
+ if (other.isEmpty()) {
+ return this;
+ }
+ cachedSize = -1;
+ if (other.hasTextItemId()) {
+ setTextItemId(other.textItemId);
+ }
+ if (other.hasTextItemConfigId()) {
+ setTextItemConfigId(other.textItemConfigId);
+ }
+ return this;
+ }
+
+ @Override
+ public TextJoinInfo clear() {
+ if (isEmpty()) {
+ return this;
+ }
+ cachedSize = -1;
+ bitField0_ = 0;
+ textItemId = 0;
+ textItemConfigId = 0;
+ return this;
+ }
+
+ @Override
+ public TextJoinInfo clearQuick() {
+ if (isEmpty()) {
+ return this;
+ }
+ cachedSize = -1;
+ bitField0_ = 0;
+ return this;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (o == this) {
+ return true;
+ }
+ if (!(o instanceof TextJoinInfo)) {
+ return false;
+ }
+ TextJoinInfo other = (TextJoinInfo) o;
+ return bitField0_ == other.bitField0_
+ && (!hasTextItemId() || textItemId == other.textItemId)
+ && (!hasTextItemConfigId() || textItemConfigId == other.textItemConfigId);
+ }
+
+ @Override
+ public void writeTo(final ProtoSink output) throws IOException {
+ if ((bitField0_ & 0x00000001) != 0) {
+ output.writeRawByte((byte) 16);
+ output.writeUInt32NoTag(textItemId);
+ }
+ if ((bitField0_ & 0x00000002) != 0) {
+ output.writeRawByte((byte) 24);
+ output.writeUInt32NoTag(textItemConfigId);
+ }
+ }
+
+ @Override
+ protected int computeSerializedSize() {
+ int size = 0;
+ if ((bitField0_ & 0x00000001) != 0) {
+ size += 1 + ProtoSink.computeUInt32SizeNoTag(textItemId);
+ }
+ if ((bitField0_ & 0x00000002) != 0) {
+ size += 1 + ProtoSink.computeUInt32SizeNoTag(textItemConfigId);
+ }
+ return size;
+ }
+
+ @Override
+ @SuppressWarnings("fallthrough")
+ public TextJoinInfo mergeFrom(final ProtoSource input) throws IOException {
+ // Enabled Fall-Through Optimization (QuickBuffers)
+ int tag = input.readTag();
+ while (true) {
+ switch (tag) {
+ case 16: {
+ // textItemId
+ textItemId = input.readUInt32();
+ bitField0_ |= 0x00000001;
+ tag = input.readTag();
+ if (tag != 24) {
+ break;
+ }
+ }
+ case 24: {
+ // textItemConfigId
+ textItemConfigId = input.readUInt32();
+ bitField0_ |= 0x00000002;
+ tag = input.readTag();
+ if (tag != 0) {
+ break;
+ }
+ }
+ case 0: {
+ return this;
+ }
+ default: {
+ if (!input.skipField(tag)) {
+ return this;
+ }
+ tag = input.readTag();
+ break;
+ }
+ }
+ }
+ }
+
+ @Override
+ public void writeTo(final JsonSink output) throws IOException {
+ output.beginObject();
+ if ((bitField0_ & 0x00000001) != 0) {
+ output.writeUInt32(FieldNames.textItemId, textItemId);
+ }
+ if ((bitField0_ & 0x00000002) != 0) {
+ output.writeUInt32(FieldNames.textItemConfigId, textItemConfigId);
+ }
+ output.endObject();
+ }
+
+ @Override
+ public TextJoinInfo mergeFrom(final JsonSource input) throws IOException {
+ if (!input.beginObject()) {
+ return this;
+ }
+ while (!input.isAtEnd()) {
+ switch (input.readFieldHash()) {
+ case 1565189915:
+ case -153409355: {
+ if (input.isAtField(FieldNames.textItemId)) {
+ if (!input.trySkipNullValue()) {
+ textItemId = input.readUInt32();
+ bitField0_ |= 0x00000001;
+ }
+ } else {
+ input.skipUnknownField();
+ }
+ break;
+ }
+ case -1448403459:
+ case -1174236578: {
+ if (input.isAtField(FieldNames.textItemConfigId)) {
+ if (!input.trySkipNullValue()) {
+ textItemConfigId = input.readUInt32();
+ bitField0_ |= 0x00000002;
+ }
+ } else {
+ input.skipUnknownField();
+ }
+ break;
+ }
+ default: {
+ input.skipUnknownField();
+ break;
+ }
+ }
+ }
+ input.endObject();
+ return this;
+ }
+
+ @Override
+ public TextJoinInfo clone() {
+ return new TextJoinInfo().copyFrom(this);
+ }
+
+ @Override
+ public boolean isEmpty() {
+ return ((bitField0_) == 0);
+ }
+
+ public static TextJoinInfo parseFrom(final byte[] data) throws
+ InvalidProtocolBufferException {
+ return ProtoMessage.mergeFrom(new TextJoinInfo(), data).checkInitialized();
+ }
+
+ public static TextJoinInfo parseFrom(final ProtoSource input) throws IOException {
+ return ProtoMessage.mergeFrom(new TextJoinInfo(), input).checkInitialized();
+ }
+
+ public static TextJoinInfo parseFrom(final JsonSource input) throws IOException {
+ return ProtoMessage.mergeFrom(new TextJoinInfo(), input).checkInitialized();
+ }
+
+ /**
+ * @return factory for creating TextJoinInfo messages
+ */
+ public static MessageFactory getFactory() {
+ return TextJoinInfoFactory.INSTANCE;
+ }
+
+ private enum TextJoinInfoFactory implements MessageFactory {
+ INSTANCE;
+
+ @Override
+ public TextJoinInfo create() {
+ return TextJoinInfo.newInstance();
+ }
+ }
+
+ /**
+ * Contains name constants used for serializing JSON
+ */
+ static class FieldNames {
+ static final FieldName textItemId = FieldName.forField("textItemId", "text_item_id");
+
+ static final FieldName textItemConfigId = FieldName.forField("textItemConfigId", "text_item_config_id");
+ }
+ }
+
private enum TextJoinQueryScRspFactory implements MessageFactory {
INSTANCE;
@@ -254,6 +694,8 @@ public final class TextJoinQueryScRspOuterClass {
*/
static class FieldNames {
static final FieldName retcode = FieldName.forField("retcode");
+
+ static final FieldName textJoinList = FieldName.forField("textJoinList", "text_join_list");
}
}
}
diff --git a/src/main/java/emu/lunarcore/data/GameData.java b/src/main/java/emu/lunarcore/data/GameData.java
index 63b48a9..63bd0b4 100644
--- a/src/main/java/emu/lunarcore/data/GameData.java
+++ b/src/main/java/emu/lunarcore/data/GameData.java
@@ -4,6 +4,7 @@ import java.lang.reflect.Field;
import java.util.List;
import java.util.ArrayList;
+import it.unimi.dsi.fastutil.ints.IntArrayList;
import emu.lunarcore.data.config.FloorInfo;
import emu.lunarcore.data.excel.*;
import emu.lunarcore.game.battle.MazeBuff;
@@ -143,6 +144,19 @@ public class GameData {
return allIds;
}
+ public static int TextJoinItemFromId(int id) {
+ for (Int2ObjectMap.Entry entry : textJoinExcelMap.int2ObjectEntrySet()) {
+ TextJoinExcel textJoinExcel = entry.getValue();
+ if (textJoinExcel.getId() == id) {
+ IntArrayList textJoinItemList = textJoinExcel.getTextJoinItemList();
+ if (textJoinItemList.size() > 0) {
+ return textJoinItemList.getInt(textJoinItemList.size() - 1);
+ }
+ }
+ }
+ return id * 10; // or return a default value if needed
+ }
+
public static List getAllQuestIds() {
List allIds = new ArrayList<>();
diff --git a/src/main/java/emu/lunarcore/server/packet/recv/HandlerTextJoinQueryCsReq.java b/src/main/java/emu/lunarcore/server/packet/recv/HandlerTextJoinQueryCsReq.java
index 649406b..ac78ec1 100644
--- a/src/main/java/emu/lunarcore/server/packet/recv/HandlerTextJoinQueryCsReq.java
+++ b/src/main/java/emu/lunarcore/server/packet/recv/HandlerTextJoinQueryCsReq.java
@@ -5,13 +5,15 @@ import emu.lunarcore.server.packet.CmdId;
import emu.lunarcore.server.packet.Opcodes;
import emu.lunarcore.server.packet.PacketHandler;
import emu.lunarcore.server.packet.send.PacketTextJoinQueryScRsp;
+import emu.lunarcore.proto.TextJoinQueryCsReqOuterClass.TextJoinQueryCsReq;
@Opcodes(CmdId.TextJoinQueryCsReq)
public class HandlerTextJoinQueryCsReq extends PacketHandler {
@Override
public void handle(GameSession session, byte[] data) throws Exception {
- session.send(new PacketTextJoinQueryScRsp(session.getPlayer()));
+ var req = TextJoinQueryCsReq.parseFrom(data);
+ session.send(new PacketTextJoinQueryScRsp(session.getPlayer(), req.getTextJoinIdList().toArray()));
}
}
diff --git a/src/main/java/emu/lunarcore/server/packet/send/PacketTextJoinQueryScRsp.java b/src/main/java/emu/lunarcore/server/packet/send/PacketTextJoinQueryScRsp.java
index c4215e6..c768038 100644
--- a/src/main/java/emu/lunarcore/server/packet/send/PacketTextJoinQueryScRsp.java
+++ b/src/main/java/emu/lunarcore/server/packet/send/PacketTextJoinQueryScRsp.java
@@ -1,17 +1,26 @@
package emu.lunarcore.server.packet.send;
-import emu.lunarcore.game.mail.Mail;
+import emu.lunarcore.data.GameData;
import emu.lunarcore.game.player.Player;
import emu.lunarcore.proto.TextJoinQueryScRspOuterClass.TextJoinQueryScRsp;
+import emu.lunarcore.proto.TextJoinQueryScRspOuterClass.TextJoinQueryScRsp.TextJoinInfo;
import emu.lunarcore.server.packet.BasePacket;
import emu.lunarcore.server.packet.CmdId;
public class PacketTextJoinQueryScRsp extends BasePacket {
- public PacketTextJoinQueryScRsp(Player player) {
+ public PacketTextJoinQueryScRsp(Player player, int[] textJoinIdList) {
super(CmdId.TextJoinQueryScRsp);
+
var data = TextJoinQueryScRsp.newInstance();
+
+ for (int joinId : textJoinIdList) {
+ TextJoinInfo joinInfo = TextJoinInfo.newInstance()
+ .setTextItemId(joinId)
+ .setTextItemConfigId(GameData.TextJoinItemFromId(joinId));
+ data.addTextJoinList(joinInfo);
+ }
this.setData(data);
}