From 4e65fd6a7d0390ef9ab13e24a0f5501c3073cb49 Mon Sep 17 00:00:00 2001 From: Melledy <121644117+Melledy@users.noreply.github.com> Date: Sun, 29 Oct 2023 13:13:53 -0700 Subject: [PATCH] Add additional stuff for handling rogue npc dialogues --- .../proto/NpcRogueInfoOuterClass.java | 142 +++---- ...lectRogueDialogueEventCsReqOuterClass.java | 342 ++++++++++++++++ ...lectRogueDialogueEventScRspOuterClass.java | 367 ++++++++++++++++++ .../lunarcore/game/rogue/RogueInstance.java | 8 + .../game/scene/entity/EntityNpc.java | 3 +- .../HandlerSelectRogueDialogueEventCsReq.java | 24 ++ .../PacketSelectRogueDialogueEventScRsp.java | 17 + 7 files changed, 821 insertions(+), 82 deletions(-) create mode 100644 src/generated/main/emu/lunarcore/proto/SelectRogueDialogueEventCsReqOuterClass.java create mode 100644 src/generated/main/emu/lunarcore/proto/SelectRogueDialogueEventScRspOuterClass.java create mode 100644 src/main/java/emu/lunarcore/server/packet/recv/HandlerSelectRogueDialogueEventCsReq.java create mode 100644 src/main/java/emu/lunarcore/server/packet/send/PacketSelectRogueDialogueEventScRsp.java diff --git a/src/generated/main/emu/lunarcore/proto/NpcRogueInfoOuterClass.java b/src/generated/main/emu/lunarcore/proto/NpcRogueInfoOuterClass.java index 0803477..60633a1 100644 --- a/src/generated/main/emu/lunarcore/proto/NpcRogueInfoOuterClass.java +++ b/src/generated/main/emu/lunarcore/proto/NpcRogueInfoOuterClass.java @@ -20,9 +20,9 @@ public final class NpcRogueInfoOuterClass { private static final long serialVersionUID = 0L; /** - * optional uint32 dialogue_group_id = 1; + * optional uint32 PNDKDICODHP = 1; */ - private int dialogueGroupId; + private int pNDKDICODHP; /** * optional uint32 KCPOHLMKMFH = 3; @@ -35,13 +35,9 @@ public final class NpcRogueInfoOuterClass { private int rogueNpcId; /** - *
-     * repeated IICJAGOKIMP ALFIOHKDPLJ = 2;
-     * 
- * - * optional uint32 ODGHKLBCEOF = 13; + * optional uint32 dialogue_group_id = 13; */ - private int oDGHKLBCEOF; + private int dialogueGroupId; /** * optional bool IAJLMEKFNMO = 8; @@ -69,39 +65,39 @@ public final class NpcRogueInfoOuterClass { } /** - * optional uint32 dialogue_group_id = 1; - * @return whether the dialogueGroupId field is set + * optional uint32 PNDKDICODHP = 1; + * @return whether the pNDKDICODHP field is set */ - public boolean hasDialogueGroupId() { + public boolean hasPNDKDICODHP() { return (bitField0_ & 0x00000001) != 0; } /** - * optional uint32 dialogue_group_id = 1; + * optional uint32 PNDKDICODHP = 1; * @return this */ - public NpcRogueInfo clearDialogueGroupId() { + public NpcRogueInfo clearPNDKDICODHP() { bitField0_ &= ~0x00000001; - dialogueGroupId = 0; + pNDKDICODHP = 0; return this; } /** - * optional uint32 dialogue_group_id = 1; - * @return the dialogueGroupId + * optional uint32 PNDKDICODHP = 1; + * @return the pNDKDICODHP */ - public int getDialogueGroupId() { - return dialogueGroupId; + public int getPNDKDICODHP() { + return pNDKDICODHP; } /** - * optional uint32 dialogue_group_id = 1; - * @param value the dialogueGroupId to set + * optional uint32 PNDKDICODHP = 1; + * @param value the pNDKDICODHP to set * @return this */ - public NpcRogueInfo setDialogueGroupId(final int value) { + public NpcRogueInfo setPNDKDICODHP(final int value) { bitField0_ |= 0x00000001; - dialogueGroupId = value; + pNDKDICODHP = value; return this; } @@ -180,55 +176,39 @@ public final class NpcRogueInfoOuterClass { } /** - *
-     * repeated IICJAGOKIMP ALFIOHKDPLJ = 2;
-     * 
- * - * optional uint32 ODGHKLBCEOF = 13; - * @return whether the oDGHKLBCEOF field is set + * optional uint32 dialogue_group_id = 13; + * @return whether the dialogueGroupId field is set */ - public boolean hasODGHKLBCEOF() { + public boolean hasDialogueGroupId() { return (bitField0_ & 0x00000008) != 0; } /** - *
-     * repeated IICJAGOKIMP ALFIOHKDPLJ = 2;
-     * 
- * - * optional uint32 ODGHKLBCEOF = 13; + * optional uint32 dialogue_group_id = 13; * @return this */ - public NpcRogueInfo clearODGHKLBCEOF() { + public NpcRogueInfo clearDialogueGroupId() { bitField0_ &= ~0x00000008; - oDGHKLBCEOF = 0; + dialogueGroupId = 0; return this; } /** - *
-     * repeated IICJAGOKIMP ALFIOHKDPLJ = 2;
-     * 
- * - * optional uint32 ODGHKLBCEOF = 13; - * @return the oDGHKLBCEOF + * optional uint32 dialogue_group_id = 13; + * @return the dialogueGroupId */ - public int getODGHKLBCEOF() { - return oDGHKLBCEOF; + public int getDialogueGroupId() { + return dialogueGroupId; } /** - *
-     * repeated IICJAGOKIMP ALFIOHKDPLJ = 2;
-     * 
- * - * optional uint32 ODGHKLBCEOF = 13; - * @param value the oDGHKLBCEOF to set + * optional uint32 dialogue_group_id = 13; + * @param value the dialogueGroupId to set * @return this */ - public NpcRogueInfo setODGHKLBCEOF(final int value) { + public NpcRogueInfo setDialogueGroupId(final int value) { bitField0_ |= 0x00000008; - oDGHKLBCEOF = value; + dialogueGroupId = value; return this; } @@ -379,10 +359,10 @@ public final class NpcRogueInfoOuterClass { cachedSize = other.cachedSize; if ((bitField0_ | other.bitField0_) != 0) { bitField0_ = other.bitField0_; - dialogueGroupId = other.dialogueGroupId; + pNDKDICODHP = other.pNDKDICODHP; kCPOHLMKMFH = other.kCPOHLMKMFH; rogueNpcId = other.rogueNpcId; - oDGHKLBCEOF = other.oDGHKLBCEOF; + dialogueGroupId = other.dialogueGroupId; iAJLMEKFNMO = other.iAJLMEKFNMO; nHEENJEGNLL = other.nHEENJEGNLL; jGJHOEBINDP.copyFrom(other.jGJHOEBINDP); @@ -396,8 +376,8 @@ public final class NpcRogueInfoOuterClass { return this; } cachedSize = -1; - if (other.hasDialogueGroupId()) { - setDialogueGroupId(other.dialogueGroupId); + if (other.hasPNDKDICODHP()) { + setPNDKDICODHP(other.pNDKDICODHP); } if (other.hasKCPOHLMKMFH()) { setKCPOHLMKMFH(other.kCPOHLMKMFH); @@ -405,8 +385,8 @@ public final class NpcRogueInfoOuterClass { if (other.hasRogueNpcId()) { setRogueNpcId(other.rogueNpcId); } - if (other.hasODGHKLBCEOF()) { - setODGHKLBCEOF(other.oDGHKLBCEOF); + if (other.hasDialogueGroupId()) { + setDialogueGroupId(other.dialogueGroupId); } if (other.hasIAJLMEKFNMO()) { setIAJLMEKFNMO(other.iAJLMEKFNMO); @@ -427,10 +407,10 @@ public final class NpcRogueInfoOuterClass { } cachedSize = -1; bitField0_ = 0; - dialogueGroupId = 0; + pNDKDICODHP = 0; kCPOHLMKMFH = 0; rogueNpcId = 0; - oDGHKLBCEOF = 0; + dialogueGroupId = 0; iAJLMEKFNMO = false; nHEENJEGNLL = false; jGJHOEBINDP.clear(); @@ -458,10 +438,10 @@ public final class NpcRogueInfoOuterClass { } NpcRogueInfo other = (NpcRogueInfo) o; return bitField0_ == other.bitField0_ - && (!hasDialogueGroupId() || dialogueGroupId == other.dialogueGroupId) + && (!hasPNDKDICODHP() || pNDKDICODHP == other.pNDKDICODHP) && (!hasKCPOHLMKMFH() || kCPOHLMKMFH == other.kCPOHLMKMFH) && (!hasRogueNpcId() || rogueNpcId == other.rogueNpcId) - && (!hasODGHKLBCEOF() || oDGHKLBCEOF == other.oDGHKLBCEOF) + && (!hasDialogueGroupId() || dialogueGroupId == other.dialogueGroupId) && (!hasIAJLMEKFNMO() || iAJLMEKFNMO == other.iAJLMEKFNMO) && (!hasNHEENJEGNLL() || nHEENJEGNLL == other.nHEENJEGNLL) && (!hasJGJHOEBINDP() || jGJHOEBINDP.equals(other.jGJHOEBINDP)); @@ -471,7 +451,7 @@ public final class NpcRogueInfoOuterClass { public void writeTo(final ProtoSink output) throws IOException { if ((bitField0_ & 0x00000001) != 0) { output.writeRawByte((byte) 8); - output.writeUInt32NoTag(dialogueGroupId); + output.writeUInt32NoTag(pNDKDICODHP); } if ((bitField0_ & 0x00000002) != 0) { output.writeRawByte((byte) 24); @@ -483,7 +463,7 @@ public final class NpcRogueInfoOuterClass { } if ((bitField0_ & 0x00000008) != 0) { output.writeRawByte((byte) 104); - output.writeUInt32NoTag(oDGHKLBCEOF); + output.writeUInt32NoTag(dialogueGroupId); } if ((bitField0_ & 0x00000010) != 0) { output.writeRawByte((byte) 64); @@ -505,7 +485,7 @@ public final class NpcRogueInfoOuterClass { protected int computeSerializedSize() { int size = 0; if ((bitField0_ & 0x00000001) != 0) { - size += 1 + ProtoSink.computeUInt32SizeNoTag(dialogueGroupId); + size += 1 + ProtoSink.computeUInt32SizeNoTag(pNDKDICODHP); } if ((bitField0_ & 0x00000002) != 0) { size += 1 + ProtoSink.computeUInt32SizeNoTag(kCPOHLMKMFH); @@ -514,7 +494,7 @@ public final class NpcRogueInfoOuterClass { size += 1 + ProtoSink.computeUInt32SizeNoTag(rogueNpcId); } if ((bitField0_ & 0x00000008) != 0) { - size += 1 + ProtoSink.computeUInt32SizeNoTag(oDGHKLBCEOF); + size += 1 + ProtoSink.computeUInt32SizeNoTag(dialogueGroupId); } if ((bitField0_ & 0x00000010) != 0) { size += 2; @@ -536,8 +516,8 @@ public final class NpcRogueInfoOuterClass { while (true) { switch (tag) { case 8: { - // dialogueGroupId - dialogueGroupId = input.readUInt32(); + // pNDKDICODHP + pNDKDICODHP = input.readUInt32(); bitField0_ |= 0x00000001; tag = input.readTag(); if (tag != 24) { @@ -563,8 +543,8 @@ public final class NpcRogueInfoOuterClass { } } case 104: { - // oDGHKLBCEOF - oDGHKLBCEOF = input.readUInt32(); + // dialogueGroupId + dialogueGroupId = input.readUInt32(); bitField0_ |= 0x00000008; tag = input.readTag(); if (tag != 64) { @@ -615,7 +595,7 @@ public final class NpcRogueInfoOuterClass { public void writeTo(final JsonSink output) throws IOException { output.beginObject(); if ((bitField0_ & 0x00000001) != 0) { - output.writeUInt32(FieldNames.dialogueGroupId, dialogueGroupId); + output.writeUInt32(FieldNames.pNDKDICODHP, pNDKDICODHP); } if ((bitField0_ & 0x00000002) != 0) { output.writeUInt32(FieldNames.kCPOHLMKMFH, kCPOHLMKMFH); @@ -624,7 +604,7 @@ public final class NpcRogueInfoOuterClass { output.writeUInt32(FieldNames.rogueNpcId, rogueNpcId); } if ((bitField0_ & 0x00000008) != 0) { - output.writeUInt32(FieldNames.oDGHKLBCEOF, oDGHKLBCEOF); + output.writeUInt32(FieldNames.dialogueGroupId, dialogueGroupId); } if ((bitField0_ & 0x00000010) != 0) { output.writeBool(FieldNames.iAJLMEKFNMO, iAJLMEKFNMO); @@ -645,11 +625,10 @@ public final class NpcRogueInfoOuterClass { } while (!input.isAtEnd()) { switch (input.readFieldHash()) { - case 1758320386: - case 1899979106: { - if (input.isAtField(FieldNames.dialogueGroupId)) { + case 1418498134: { + if (input.isAtField(FieldNames.pNDKDICODHP)) { if (!input.trySkipNullValue()) { - dialogueGroupId = input.readUInt32(); + pNDKDICODHP = input.readUInt32(); bitField0_ |= 0x00000001; } } else { @@ -680,10 +659,11 @@ public final class NpcRogueInfoOuterClass { } break; } - case 826923524: { - if (input.isAtField(FieldNames.oDGHKLBCEOF)) { + case 1758320386: + case 1899979106: { + if (input.isAtField(FieldNames.dialogueGroupId)) { if (!input.trySkipNullValue()) { - oDGHKLBCEOF = input.readUInt32(); + dialogueGroupId = input.readUInt32(); bitField0_ |= 0x00000008; } } else { @@ -1101,13 +1081,13 @@ public final class NpcRogueInfoOuterClass { * Contains name constants used for serializing JSON */ static class FieldNames { - static final FieldName dialogueGroupId = FieldName.forField("dialogueGroupId", "dialogue_group_id"); + static final FieldName pNDKDICODHP = FieldName.forField("PNDKDICODHP"); static final FieldName kCPOHLMKMFH = FieldName.forField("KCPOHLMKMFH"); static final FieldName rogueNpcId = FieldName.forField("rogueNpcId", "rogue_npc_id"); - static final FieldName oDGHKLBCEOF = FieldName.forField("ODGHKLBCEOF"); + static final FieldName dialogueGroupId = FieldName.forField("dialogueGroupId", "dialogue_group_id"); static final FieldName iAJLMEKFNMO = FieldName.forField("IAJLMEKFNMO"); diff --git a/src/generated/main/emu/lunarcore/proto/SelectRogueDialogueEventCsReqOuterClass.java b/src/generated/main/emu/lunarcore/proto/SelectRogueDialogueEventCsReqOuterClass.java new file mode 100644 index 0000000..14a5d6c --- /dev/null +++ b/src/generated/main/emu/lunarcore/proto/SelectRogueDialogueEventCsReqOuterClass.java @@ -0,0 +1,342 @@ +// Code generated by protocol buffer compiler. Do not edit! +package emu.lunarcore.proto; + +import java.io.IOException; +import us.hebi.quickbuf.FieldName; +import us.hebi.quickbuf.InvalidProtocolBufferException; +import us.hebi.quickbuf.JsonSink; +import us.hebi.quickbuf.JsonSource; +import us.hebi.quickbuf.MessageFactory; +import us.hebi.quickbuf.ProtoMessage; +import us.hebi.quickbuf.ProtoSink; +import us.hebi.quickbuf.ProtoSource; + +public final class SelectRogueDialogueEventCsReqOuterClass { + /** + * Protobuf type {@code SelectRogueDialogueEventCsReq} + */ + public static final class SelectRogueDialogueEventCsReq extends ProtoMessage implements Cloneable { + private static final long serialVersionUID = 0L; + + /** + * optional uint32 COMHCIAONKJ = 4; + */ + private int cOMHCIAONKJ; + + /** + * optional uint32 dialogue_event_id = 15; + */ + private int dialogueEventId; + + private SelectRogueDialogueEventCsReq() { + } + + /** + * @return a new empty instance of {@code SelectRogueDialogueEventCsReq} + */ + public static SelectRogueDialogueEventCsReq newInstance() { + return new SelectRogueDialogueEventCsReq(); + } + + /** + * optional uint32 COMHCIAONKJ = 4; + * @return whether the cOMHCIAONKJ field is set + */ + public boolean hasCOMHCIAONKJ() { + return (bitField0_ & 0x00000001) != 0; + } + + /** + * optional uint32 COMHCIAONKJ = 4; + * @return this + */ + public SelectRogueDialogueEventCsReq clearCOMHCIAONKJ() { + bitField0_ &= ~0x00000001; + cOMHCIAONKJ = 0; + return this; + } + + /** + * optional uint32 COMHCIAONKJ = 4; + * @return the cOMHCIAONKJ + */ + public int getCOMHCIAONKJ() { + return cOMHCIAONKJ; + } + + /** + * optional uint32 COMHCIAONKJ = 4; + * @param value the cOMHCIAONKJ to set + * @return this + */ + public SelectRogueDialogueEventCsReq setCOMHCIAONKJ(final int value) { + bitField0_ |= 0x00000001; + cOMHCIAONKJ = value; + return this; + } + + /** + * optional uint32 dialogue_event_id = 15; + * @return whether the dialogueEventId field is set + */ + public boolean hasDialogueEventId() { + return (bitField0_ & 0x00000002) != 0; + } + + /** + * optional uint32 dialogue_event_id = 15; + * @return this + */ + public SelectRogueDialogueEventCsReq clearDialogueEventId() { + bitField0_ &= ~0x00000002; + dialogueEventId = 0; + return this; + } + + /** + * optional uint32 dialogue_event_id = 15; + * @return the dialogueEventId + */ + public int getDialogueEventId() { + return dialogueEventId; + } + + /** + * optional uint32 dialogue_event_id = 15; + * @param value the dialogueEventId to set + * @return this + */ + public SelectRogueDialogueEventCsReq setDialogueEventId(final int value) { + bitField0_ |= 0x00000002; + dialogueEventId = value; + return this; + } + + @Override + public SelectRogueDialogueEventCsReq copyFrom(final SelectRogueDialogueEventCsReq other) { + cachedSize = other.cachedSize; + if ((bitField0_ | other.bitField0_) != 0) { + bitField0_ = other.bitField0_; + cOMHCIAONKJ = other.cOMHCIAONKJ; + dialogueEventId = other.dialogueEventId; + } + return this; + } + + @Override + public SelectRogueDialogueEventCsReq mergeFrom(final SelectRogueDialogueEventCsReq other) { + if (other.isEmpty()) { + return this; + } + cachedSize = -1; + if (other.hasCOMHCIAONKJ()) { + setCOMHCIAONKJ(other.cOMHCIAONKJ); + } + if (other.hasDialogueEventId()) { + setDialogueEventId(other.dialogueEventId); + } + return this; + } + + @Override + public SelectRogueDialogueEventCsReq clear() { + if (isEmpty()) { + return this; + } + cachedSize = -1; + bitField0_ = 0; + cOMHCIAONKJ = 0; + dialogueEventId = 0; + return this; + } + + @Override + public SelectRogueDialogueEventCsReq 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 SelectRogueDialogueEventCsReq)) { + return false; + } + SelectRogueDialogueEventCsReq other = (SelectRogueDialogueEventCsReq) o; + return bitField0_ == other.bitField0_ + && (!hasCOMHCIAONKJ() || cOMHCIAONKJ == other.cOMHCIAONKJ) + && (!hasDialogueEventId() || dialogueEventId == other.dialogueEventId); + } + + @Override + public void writeTo(final ProtoSink output) throws IOException { + if ((bitField0_ & 0x00000001) != 0) { + output.writeRawByte((byte) 32); + output.writeUInt32NoTag(cOMHCIAONKJ); + } + if ((bitField0_ & 0x00000002) != 0) { + output.writeRawByte((byte) 120); + output.writeUInt32NoTag(dialogueEventId); + } + } + + @Override + protected int computeSerializedSize() { + int size = 0; + if ((bitField0_ & 0x00000001) != 0) { + size += 1 + ProtoSink.computeUInt32SizeNoTag(cOMHCIAONKJ); + } + if ((bitField0_ & 0x00000002) != 0) { + size += 1 + ProtoSink.computeUInt32SizeNoTag(dialogueEventId); + } + return size; + } + + @Override + @SuppressWarnings("fallthrough") + public SelectRogueDialogueEventCsReq mergeFrom(final ProtoSource input) throws IOException { + // Enabled Fall-Through Optimization (QuickBuffers) + int tag = input.readTag(); + while (true) { + switch (tag) { + case 32: { + // cOMHCIAONKJ + cOMHCIAONKJ = input.readUInt32(); + bitField0_ |= 0x00000001; + tag = input.readTag(); + if (tag != 120) { + break; + } + } + case 120: { + // dialogueEventId + dialogueEventId = 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.cOMHCIAONKJ, cOMHCIAONKJ); + } + if ((bitField0_ & 0x00000002) != 0) { + output.writeUInt32(FieldNames.dialogueEventId, dialogueEventId); + } + output.endObject(); + } + + @Override + public SelectRogueDialogueEventCsReq mergeFrom(final JsonSource input) throws IOException { + if (!input.beginObject()) { + return this; + } + while (!input.isAtEnd()) { + switch (input.readFieldHash()) { + case -2097477198: { + if (input.isAtField(FieldNames.cOMHCIAONKJ)) { + if (!input.trySkipNullValue()) { + cOMHCIAONKJ = input.readUInt32(); + bitField0_ |= 0x00000001; + } + } else { + input.skipUnknownField(); + } + break; + } + case 88389725: + case 1671736167: { + if (input.isAtField(FieldNames.dialogueEventId)) { + if (!input.trySkipNullValue()) { + dialogueEventId = input.readUInt32(); + bitField0_ |= 0x00000002; + } + } else { + input.skipUnknownField(); + } + break; + } + default: { + input.skipUnknownField(); + break; + } + } + } + input.endObject(); + return this; + } + + @Override + public SelectRogueDialogueEventCsReq clone() { + return new SelectRogueDialogueEventCsReq().copyFrom(this); + } + + @Override + public boolean isEmpty() { + return ((bitField0_) == 0); + } + + public static SelectRogueDialogueEventCsReq parseFrom(final byte[] data) throws + InvalidProtocolBufferException { + return ProtoMessage.mergeFrom(new SelectRogueDialogueEventCsReq(), data).checkInitialized(); + } + + public static SelectRogueDialogueEventCsReq parseFrom(final ProtoSource input) throws + IOException { + return ProtoMessage.mergeFrom(new SelectRogueDialogueEventCsReq(), input).checkInitialized(); + } + + public static SelectRogueDialogueEventCsReq parseFrom(final JsonSource input) throws + IOException { + return ProtoMessage.mergeFrom(new SelectRogueDialogueEventCsReq(), input).checkInitialized(); + } + + /** + * @return factory for creating SelectRogueDialogueEventCsReq messages + */ + public static MessageFactory getFactory() { + return SelectRogueDialogueEventCsReqFactory.INSTANCE; + } + + private enum SelectRogueDialogueEventCsReqFactory implements MessageFactory { + INSTANCE; + + @Override + public SelectRogueDialogueEventCsReq create() { + return SelectRogueDialogueEventCsReq.newInstance(); + } + } + + /** + * Contains name constants used for serializing JSON + */ + static class FieldNames { + static final FieldName cOMHCIAONKJ = FieldName.forField("COMHCIAONKJ"); + + static final FieldName dialogueEventId = FieldName.forField("dialogueEventId", "dialogue_event_id"); + } + } +} diff --git a/src/generated/main/emu/lunarcore/proto/SelectRogueDialogueEventScRspOuterClass.java b/src/generated/main/emu/lunarcore/proto/SelectRogueDialogueEventScRspOuterClass.java new file mode 100644 index 0000000..68dfa43 --- /dev/null +++ b/src/generated/main/emu/lunarcore/proto/SelectRogueDialogueEventScRspOuterClass.java @@ -0,0 +1,367 @@ +// Code generated by protocol buffer compiler. Do not edit! +package emu.lunarcore.proto; + +import java.io.IOException; +import us.hebi.quickbuf.FieldName; +import us.hebi.quickbuf.InvalidProtocolBufferException; +import us.hebi.quickbuf.JsonSink; +import us.hebi.quickbuf.JsonSource; +import us.hebi.quickbuf.MessageFactory; +import us.hebi.quickbuf.ProtoMessage; +import us.hebi.quickbuf.ProtoSink; +import us.hebi.quickbuf.ProtoSource; + +public final class SelectRogueDialogueEventScRspOuterClass { + /** + * Protobuf type {@code SelectRogueDialogueEventScRsp} + */ + public static final class SelectRogueDialogueEventScRsp extends ProtoMessage implements Cloneable { + private static final long serialVersionUID = 0L; + + /** + * optional uint32 retcode = 8; + */ + private int retcode; + + /** + *
+     * RogueDialogueEvent selected_dialogue_event = 14;
+     * ODKKECCOLLB JJNBIFDOLFH = 15;
+     * 
+ * + * optional uint32 dialogue_event_id = 10; + */ + private int dialogueEventId; + + private SelectRogueDialogueEventScRsp() { + } + + /** + * @return a new empty instance of {@code SelectRogueDialogueEventScRsp} + */ + public static SelectRogueDialogueEventScRsp newInstance() { + return new SelectRogueDialogueEventScRsp(); + } + + /** + * optional uint32 retcode = 8; + * @return whether the retcode field is set + */ + public boolean hasRetcode() { + return (bitField0_ & 0x00000001) != 0; + } + + /** + * optional uint32 retcode = 8; + * @return this + */ + public SelectRogueDialogueEventScRsp clearRetcode() { + bitField0_ &= ~0x00000001; + retcode = 0; + return this; + } + + /** + * optional uint32 retcode = 8; + * @return the retcode + */ + public int getRetcode() { + return retcode; + } + + /** + * optional uint32 retcode = 8; + * @param value the retcode to set + * @return this + */ + public SelectRogueDialogueEventScRsp setRetcode(final int value) { + bitField0_ |= 0x00000001; + retcode = value; + return this; + } + + /** + *
+     * RogueDialogueEvent selected_dialogue_event = 14;
+     * ODKKECCOLLB JJNBIFDOLFH = 15;
+     * 
+ * + * optional uint32 dialogue_event_id = 10; + * @return whether the dialogueEventId field is set + */ + public boolean hasDialogueEventId() { + return (bitField0_ & 0x00000002) != 0; + } + + /** + *
+     * RogueDialogueEvent selected_dialogue_event = 14;
+     * ODKKECCOLLB JJNBIFDOLFH = 15;
+     * 
+ * + * optional uint32 dialogue_event_id = 10; + * @return this + */ + public SelectRogueDialogueEventScRsp clearDialogueEventId() { + bitField0_ &= ~0x00000002; + dialogueEventId = 0; + return this; + } + + /** + *
+     * RogueDialogueEvent selected_dialogue_event = 14;
+     * ODKKECCOLLB JJNBIFDOLFH = 15;
+     * 
+ * + * optional uint32 dialogue_event_id = 10; + * @return the dialogueEventId + */ + public int getDialogueEventId() { + return dialogueEventId; + } + + /** + *
+     * RogueDialogueEvent selected_dialogue_event = 14;
+     * ODKKECCOLLB JJNBIFDOLFH = 15;
+     * 
+ * + * optional uint32 dialogue_event_id = 10; + * @param value the dialogueEventId to set + * @return this + */ + public SelectRogueDialogueEventScRsp setDialogueEventId(final int value) { + bitField0_ |= 0x00000002; + dialogueEventId = value; + return this; + } + + @Override + public SelectRogueDialogueEventScRsp copyFrom(final SelectRogueDialogueEventScRsp other) { + cachedSize = other.cachedSize; + if ((bitField0_ | other.bitField0_) != 0) { + bitField0_ = other.bitField0_; + retcode = other.retcode; + dialogueEventId = other.dialogueEventId; + } + return this; + } + + @Override + public SelectRogueDialogueEventScRsp mergeFrom(final SelectRogueDialogueEventScRsp other) { + if (other.isEmpty()) { + return this; + } + cachedSize = -1; + if (other.hasRetcode()) { + setRetcode(other.retcode); + } + if (other.hasDialogueEventId()) { + setDialogueEventId(other.dialogueEventId); + } + return this; + } + + @Override + public SelectRogueDialogueEventScRsp clear() { + if (isEmpty()) { + return this; + } + cachedSize = -1; + bitField0_ = 0; + retcode = 0; + dialogueEventId = 0; + return this; + } + + @Override + public SelectRogueDialogueEventScRsp 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 SelectRogueDialogueEventScRsp)) { + return false; + } + SelectRogueDialogueEventScRsp other = (SelectRogueDialogueEventScRsp) o; + return bitField0_ == other.bitField0_ + && (!hasRetcode() || retcode == other.retcode) + && (!hasDialogueEventId() || dialogueEventId == other.dialogueEventId); + } + + @Override + public void writeTo(final ProtoSink output) throws IOException { + if ((bitField0_ & 0x00000001) != 0) { + output.writeRawByte((byte) 64); + output.writeUInt32NoTag(retcode); + } + if ((bitField0_ & 0x00000002) != 0) { + output.writeRawByte((byte) 80); + output.writeUInt32NoTag(dialogueEventId); + } + } + + @Override + protected int computeSerializedSize() { + int size = 0; + if ((bitField0_ & 0x00000001) != 0) { + size += 1 + ProtoSink.computeUInt32SizeNoTag(retcode); + } + if ((bitField0_ & 0x00000002) != 0) { + size += 1 + ProtoSink.computeUInt32SizeNoTag(dialogueEventId); + } + return size; + } + + @Override + @SuppressWarnings("fallthrough") + public SelectRogueDialogueEventScRsp mergeFrom(final ProtoSource input) throws IOException { + // Enabled Fall-Through Optimization (QuickBuffers) + int tag = input.readTag(); + while (true) { + switch (tag) { + case 64: { + // retcode + retcode = input.readUInt32(); + bitField0_ |= 0x00000001; + tag = input.readTag(); + if (tag != 80) { + break; + } + } + case 80: { + // dialogueEventId + dialogueEventId = 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.retcode, retcode); + } + if ((bitField0_ & 0x00000002) != 0) { + output.writeUInt32(FieldNames.dialogueEventId, dialogueEventId); + } + output.endObject(); + } + + @Override + public SelectRogueDialogueEventScRsp mergeFrom(final JsonSource input) throws IOException { + if (!input.beginObject()) { + return this; + } + while (!input.isAtEnd()) { + switch (input.readFieldHash()) { + case 1097936398: { + if (input.isAtField(FieldNames.retcode)) { + if (!input.trySkipNullValue()) { + retcode = input.readUInt32(); + bitField0_ |= 0x00000001; + } + } else { + input.skipUnknownField(); + } + break; + } + case 88389725: + case 1671736167: { + if (input.isAtField(FieldNames.dialogueEventId)) { + if (!input.trySkipNullValue()) { + dialogueEventId = input.readUInt32(); + bitField0_ |= 0x00000002; + } + } else { + input.skipUnknownField(); + } + break; + } + default: { + input.skipUnknownField(); + break; + } + } + } + input.endObject(); + return this; + } + + @Override + public SelectRogueDialogueEventScRsp clone() { + return new SelectRogueDialogueEventScRsp().copyFrom(this); + } + + @Override + public boolean isEmpty() { + return ((bitField0_) == 0); + } + + public static SelectRogueDialogueEventScRsp parseFrom(final byte[] data) throws + InvalidProtocolBufferException { + return ProtoMessage.mergeFrom(new SelectRogueDialogueEventScRsp(), data).checkInitialized(); + } + + public static SelectRogueDialogueEventScRsp parseFrom(final ProtoSource input) throws + IOException { + return ProtoMessage.mergeFrom(new SelectRogueDialogueEventScRsp(), input).checkInitialized(); + } + + public static SelectRogueDialogueEventScRsp parseFrom(final JsonSource input) throws + IOException { + return ProtoMessage.mergeFrom(new SelectRogueDialogueEventScRsp(), input).checkInitialized(); + } + + /** + * @return factory for creating SelectRogueDialogueEventScRsp messages + */ + public static MessageFactory getFactory() { + return SelectRogueDialogueEventScRspFactory.INSTANCE; + } + + private enum SelectRogueDialogueEventScRspFactory implements MessageFactory { + INSTANCE; + + @Override + public SelectRogueDialogueEventScRsp create() { + return SelectRogueDialogueEventScRsp.newInstance(); + } + } + + /** + * Contains name constants used for serializing JSON + */ + static class FieldNames { + static final FieldName retcode = FieldName.forField("retcode"); + + static final FieldName dialogueEventId = FieldName.forField("dialogueEventId", "dialogue_event_id"); + } + } +} diff --git a/src/main/java/emu/lunarcore/game/rogue/RogueInstance.java b/src/main/java/emu/lunarcore/game/rogue/RogueInstance.java index da18204..19d0396 100644 --- a/src/main/java/emu/lunarcore/game/rogue/RogueInstance.java +++ b/src/main/java/emu/lunarcore/game/rogue/RogueInstance.java @@ -213,6 +213,14 @@ public class RogueInstance { return nextRoom; } + // Dialogue stuff + + public void selectDialogue(int dialogueEventId) { + + } + + // Battle + public synchronized void onBattleStart(Battle battle) { for (var buff : this.getBuffs().values()) { battle.addBuff(buff.toMazeBuff()); diff --git a/src/main/java/emu/lunarcore/game/scene/entity/EntityNpc.java b/src/main/java/emu/lunarcore/game/scene/entity/EntityNpc.java index 6919919..172d4e7 100644 --- a/src/main/java/emu/lunarcore/game/scene/entity/EntityNpc.java +++ b/src/main/java/emu/lunarcore/game/scene/entity/EntityNpc.java @@ -38,7 +38,8 @@ public class EntityNpc implements GameEntity { // Rogue data if (this.rogueNpcId > 0) { var rogue = NpcRogueInfo.newInstance() - .setRogueNpcId(this.rogueNpcId); + .setRogueNpcId(this.rogueNpcId) + .setDialogueGroupId(1); npc.getMutableExtraInfo().setRogueInfo(rogue); } diff --git a/src/main/java/emu/lunarcore/server/packet/recv/HandlerSelectRogueDialogueEventCsReq.java b/src/main/java/emu/lunarcore/server/packet/recv/HandlerSelectRogueDialogueEventCsReq.java new file mode 100644 index 0000000..f69a20d --- /dev/null +++ b/src/main/java/emu/lunarcore/server/packet/recv/HandlerSelectRogueDialogueEventCsReq.java @@ -0,0 +1,24 @@ +package emu.lunarcore.server.packet.recv; + +import emu.lunarcore.proto.SelectRogueDialogueEventCsReqOuterClass.SelectRogueDialogueEventCsReq; +import emu.lunarcore.server.game.GameSession; +import emu.lunarcore.server.packet.CmdId; +import emu.lunarcore.server.packet.Opcodes; +import emu.lunarcore.server.packet.PacketHandler; +import emu.lunarcore.server.packet.send.PacketSelectRogueDialogueEventScRsp; + +@Opcodes(CmdId.SelectRogueDialogueEventCsReq) +public class HandlerSelectRogueDialogueEventCsReq extends PacketHandler { + + @Override + public void handle(GameSession session, byte[] header, byte[] data) throws Exception { + var req = SelectRogueDialogueEventCsReq.parseFrom(data); + + if (session.getPlayer().getRogueInstance() != null) { + session.getPlayer().getRogueInstance().selectDialogue(req.getDialogueEventId()); + } + + session.send(new PacketSelectRogueDialogueEventScRsp(req.getDialogueEventId())); + } + +} diff --git a/src/main/java/emu/lunarcore/server/packet/send/PacketSelectRogueDialogueEventScRsp.java b/src/main/java/emu/lunarcore/server/packet/send/PacketSelectRogueDialogueEventScRsp.java new file mode 100644 index 0000000..6f297cc --- /dev/null +++ b/src/main/java/emu/lunarcore/server/packet/send/PacketSelectRogueDialogueEventScRsp.java @@ -0,0 +1,17 @@ +package emu.lunarcore.server.packet.send; + +import emu.lunarcore.proto.SelectRogueDialogueEventScRspOuterClass.SelectRogueDialogueEventScRsp; +import emu.lunarcore.server.packet.BasePacket; +import emu.lunarcore.server.packet.CmdId; + +public class PacketSelectRogueDialogueEventScRsp extends BasePacket { + + public PacketSelectRogueDialogueEventScRsp(int dialogueEventId) { + super(CmdId.SelectRogueDialogueEventScRsp); + + var data = SelectRogueDialogueEventScRsp.newInstance() + .setDialogueEventId(dialogueEventId); + + this.setData(data); + } +}