Fix locking and discarding items

This commit is contained in:
Melledy
2024-07-31 20:56:07 -07:00
parent b2718432cb
commit 47ec7c54b7
7 changed files with 292 additions and 277 deletions

View File

@@ -10,6 +10,7 @@ import us.hebi.quickbuf.MessageFactory;
import us.hebi.quickbuf.ProtoMessage; import us.hebi.quickbuf.ProtoMessage;
import us.hebi.quickbuf.ProtoSink; import us.hebi.quickbuf.ProtoSink;
import us.hebi.quickbuf.ProtoSource; import us.hebi.quickbuf.ProtoSource;
import us.hebi.quickbuf.RepeatedInt;
public final class DiscardRelicCsReqOuterClass { public final class DiscardRelicCsReqOuterClass {
/** /**
@@ -19,15 +20,15 @@ public final class DiscardRelicCsReqOuterClass {
private static final long serialVersionUID = 0L; private static final long serialVersionUID = 0L;
/** /**
* <code>optional uint32 relic_unique_id = 3;</code> * <code>optional bool is_discard = 9;</code>
*/
private int relicUniqueId;
/**
* <code>optional bool is_discard = 5;</code>
*/ */
private boolean isDiscard; private boolean isDiscard;
/**
* <code>repeated uint32 relic_id_list = 15;</code>
*/
private final RepeatedInt relicIdList = RepeatedInt.newEmptyInstance();
private DiscardRelicCsReq() { private DiscardRelicCsReq() {
} }
@@ -39,62 +40,25 @@ public final class DiscardRelicCsReqOuterClass {
} }
/** /**
* <code>optional uint32 relic_unique_id = 3;</code> * <code>optional bool is_discard = 9;</code>
* @return whether the relicUniqueId field is set * @return whether the isDiscard field is set
*/ */
public boolean hasRelicUniqueId() { public boolean hasIsDiscard() {
return (bitField0_ & 0x00000001) != 0; return (bitField0_ & 0x00000001) != 0;
} }
/** /**
* <code>optional uint32 relic_unique_id = 3;</code> * <code>optional bool is_discard = 9;</code>
* @return this
*/
public DiscardRelicCsReq clearRelicUniqueId() {
bitField0_ &= ~0x00000001;
relicUniqueId = 0;
return this;
}
/**
* <code>optional uint32 relic_unique_id = 3;</code>
* @return the relicUniqueId
*/
public int getRelicUniqueId() {
return relicUniqueId;
}
/**
* <code>optional uint32 relic_unique_id = 3;</code>
* @param value the relicUniqueId to set
* @return this
*/
public DiscardRelicCsReq setRelicUniqueId(final int value) {
bitField0_ |= 0x00000001;
relicUniqueId = value;
return this;
}
/**
* <code>optional bool is_discard = 5;</code>
* @return whether the isDiscard field is set
*/
public boolean hasIsDiscard() {
return (bitField0_ & 0x00000002) != 0;
}
/**
* <code>optional bool is_discard = 5;</code>
* @return this * @return this
*/ */
public DiscardRelicCsReq clearIsDiscard() { public DiscardRelicCsReq clearIsDiscard() {
bitField0_ &= ~0x00000002; bitField0_ &= ~0x00000001;
isDiscard = false; isDiscard = false;
return this; return this;
} }
/** /**
* <code>optional bool is_discard = 5;</code> * <code>optional bool is_discard = 9;</code>
* @return the isDiscard * @return the isDiscard
*/ */
public boolean getIsDiscard() { public boolean getIsDiscard() {
@@ -102,23 +66,91 @@ public final class DiscardRelicCsReqOuterClass {
} }
/** /**
* <code>optional bool is_discard = 5;</code> * <code>optional bool is_discard = 9;</code>
* @param value the isDiscard to set * @param value the isDiscard to set
* @return this * @return this
*/ */
public DiscardRelicCsReq setIsDiscard(final boolean value) { public DiscardRelicCsReq setIsDiscard(final boolean value) {
bitField0_ |= 0x00000002; bitField0_ |= 0x00000001;
isDiscard = value; isDiscard = value;
return this; return this;
} }
/**
* <code>repeated uint32 relic_id_list = 15;</code>
* @return whether the relicIdList field is set
*/
public boolean hasRelicIdList() {
return (bitField0_ & 0x00000002) != 0;
}
/**
* <code>repeated uint32 relic_id_list = 15;</code>
* @return this
*/
public DiscardRelicCsReq clearRelicIdList() {
bitField0_ &= ~0x00000002;
relicIdList.clear();
return this;
}
/**
* <code>repeated uint32 relic_id_list = 15;</code>
*
* 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 #getMutableRelicIdList()} if you want to modify it.
*
* @return internal storage object for reading
*/
public RepeatedInt getRelicIdList() {
return relicIdList;
}
/**
* <code>repeated uint32 relic_id_list = 15;</code>
*
* 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 RepeatedInt getMutableRelicIdList() {
bitField0_ |= 0x00000002;
return relicIdList;
}
/**
* <code>repeated uint32 relic_id_list = 15;</code>
* @param value the relicIdList to add
* @return this
*/
public DiscardRelicCsReq addRelicIdList(final int value) {
bitField0_ |= 0x00000002;
relicIdList.add(value);
return this;
}
/**
* <code>repeated uint32 relic_id_list = 15;</code>
* @param values the relicIdList to add
* @return this
*/
public DiscardRelicCsReq addAllRelicIdList(final int... values) {
bitField0_ |= 0x00000002;
relicIdList.addAll(values);
return this;
}
@Override @Override
public DiscardRelicCsReq copyFrom(final DiscardRelicCsReq other) { public DiscardRelicCsReq copyFrom(final DiscardRelicCsReq other) {
cachedSize = other.cachedSize; cachedSize = other.cachedSize;
if ((bitField0_ | other.bitField0_) != 0) { if ((bitField0_ | other.bitField0_) != 0) {
bitField0_ = other.bitField0_; bitField0_ = other.bitField0_;
relicUniqueId = other.relicUniqueId;
isDiscard = other.isDiscard; isDiscard = other.isDiscard;
relicIdList.copyFrom(other.relicIdList);
} }
return this; return this;
} }
@@ -129,12 +161,12 @@ public final class DiscardRelicCsReqOuterClass {
return this; return this;
} }
cachedSize = -1; cachedSize = -1;
if (other.hasRelicUniqueId()) {
setRelicUniqueId(other.relicUniqueId);
}
if (other.hasIsDiscard()) { if (other.hasIsDiscard()) {
setIsDiscard(other.isDiscard); setIsDiscard(other.isDiscard);
} }
if (other.hasRelicIdList()) {
getMutableRelicIdList().addAll(other.relicIdList);
}
return this; return this;
} }
@@ -145,8 +177,8 @@ public final class DiscardRelicCsReqOuterClass {
} }
cachedSize = -1; cachedSize = -1;
bitField0_ = 0; bitField0_ = 0;
relicUniqueId = 0;
isDiscard = false; isDiscard = false;
relicIdList.clear();
return this; return this;
} }
@@ -157,6 +189,7 @@ public final class DiscardRelicCsReqOuterClass {
} }
cachedSize = -1; cachedSize = -1;
bitField0_ = 0; bitField0_ = 0;
relicIdList.clear();
return this; return this;
} }
@@ -170,19 +203,21 @@ public final class DiscardRelicCsReqOuterClass {
} }
DiscardRelicCsReq other = (DiscardRelicCsReq) o; DiscardRelicCsReq other = (DiscardRelicCsReq) o;
return bitField0_ == other.bitField0_ return bitField0_ == other.bitField0_
&& (!hasRelicUniqueId() || relicUniqueId == other.relicUniqueId) && (!hasIsDiscard() || isDiscard == other.isDiscard)
&& (!hasIsDiscard() || isDiscard == other.isDiscard); && (!hasRelicIdList() || relicIdList.equals(other.relicIdList));
} }
@Override @Override
public void writeTo(final ProtoSink output) throws IOException { public void writeTo(final ProtoSink output) throws IOException {
if ((bitField0_ & 0x00000001) != 0) { if ((bitField0_ & 0x00000001) != 0) {
output.writeRawByte((byte) 24); output.writeRawByte((byte) 72);
output.writeUInt32NoTag(relicUniqueId); output.writeBoolNoTag(isDiscard);
} }
if ((bitField0_ & 0x00000002) != 0) { if ((bitField0_ & 0x00000002) != 0) {
output.writeRawByte((byte) 40); for (int i = 0; i < relicIdList.length(); i++) {
output.writeBoolNoTag(isDiscard); output.writeRawByte((byte) 120);
output.writeUInt32NoTag(relicIdList.array()[i]);
}
} }
} }
@@ -190,10 +225,10 @@ public final class DiscardRelicCsReqOuterClass {
protected int computeSerializedSize() { protected int computeSerializedSize() {
int size = 0; int size = 0;
if ((bitField0_ & 0x00000001) != 0) { if ((bitField0_ & 0x00000001) != 0) {
size += 1 + ProtoSink.computeUInt32SizeNoTag(relicUniqueId); size += 2;
} }
if ((bitField0_ & 0x00000002) != 0) { if ((bitField0_ & 0x00000002) != 0) {
size += 2; size += (1 * relicIdList.length()) + ProtoSink.computeRepeatedUInt32SizeNoTag(relicIdList);
} }
return size; return size;
} }
@@ -205,18 +240,18 @@ public final class DiscardRelicCsReqOuterClass {
int tag = input.readTag(); int tag = input.readTag();
while (true) { while (true) {
switch (tag) { switch (tag) {
case 24: { case 72: {
// relicUniqueId // isDiscard
relicUniqueId = input.readUInt32(); isDiscard = input.readBool();
bitField0_ |= 0x00000001; bitField0_ |= 0x00000001;
tag = input.readTag(); tag = input.readTag();
if (tag != 40) { if (tag != 122) {
break; break;
} }
} }
case 40: { case 122: {
// isDiscard // relicIdList [packed=true]
isDiscard = input.readBool(); input.readPackedUInt32(relicIdList, tag);
bitField0_ |= 0x00000002; bitField0_ |= 0x00000002;
tag = input.readTag(); tag = input.readTag();
if (tag != 0) { if (tag != 0) {
@@ -233,6 +268,12 @@ public final class DiscardRelicCsReqOuterClass {
tag = input.readTag(); tag = input.readTag();
break; break;
} }
case 120: {
// relicIdList [packed=false]
tag = input.readRepeatedUInt32(relicIdList, tag);
bitField0_ |= 0x00000002;
break;
}
} }
} }
} }
@@ -241,10 +282,10 @@ public final class DiscardRelicCsReqOuterClass {
public void writeTo(final JsonSink output) throws IOException { public void writeTo(final JsonSink output) throws IOException {
output.beginObject(); output.beginObject();
if ((bitField0_ & 0x00000001) != 0) { if ((bitField0_ & 0x00000001) != 0) {
output.writeUInt32(FieldNames.relicUniqueId, relicUniqueId); output.writeBool(FieldNames.isDiscard, isDiscard);
} }
if ((bitField0_ & 0x00000002) != 0) { if ((bitField0_ & 0x00000002) != 0) {
output.writeBool(FieldNames.isDiscard, isDiscard); output.writeRepeatedUInt32(FieldNames.relicIdList, relicIdList);
} }
output.endObject(); output.endObject();
} }
@@ -256,11 +297,11 @@ public final class DiscardRelicCsReqOuterClass {
} }
while (!input.isAtEnd()) { while (!input.isAtEnd()) {
switch (input.readFieldHash()) { switch (input.readFieldHash()) {
case -1966200481: case 1091588116:
case 49648253: { case -1123290487: {
if (input.isAtField(FieldNames.relicUniqueId)) { if (input.isAtField(FieldNames.isDiscard)) {
if (!input.trySkipNullValue()) { if (!input.trySkipNullValue()) {
relicUniqueId = input.readUInt32(); isDiscard = input.readBool();
bitField0_ |= 0x00000001; bitField0_ |= 0x00000001;
} }
} else { } else {
@@ -268,11 +309,11 @@ public final class DiscardRelicCsReqOuterClass {
} }
break; break;
} }
case 1091588116: case -833914452:
case -1123290487: { case -2020549514: {
if (input.isAtField(FieldNames.isDiscard)) { if (input.isAtField(FieldNames.relicIdList)) {
if (!input.trySkipNullValue()) { if (!input.trySkipNullValue()) {
isDiscard = input.readBool(); input.readRepeatedUInt32(relicIdList);
bitField0_ |= 0x00000002; bitField0_ |= 0x00000002;
} }
} else { } else {
@@ -333,9 +374,9 @@ public final class DiscardRelicCsReqOuterClass {
* Contains name constants used for serializing JSON * Contains name constants used for serializing JSON
*/ */
static class FieldNames { static class FieldNames {
static final FieldName relicUniqueId = FieldName.forField("relicUniqueId", "relic_unique_id");
static final FieldName isDiscard = FieldName.forField("isDiscard", "is_discard"); static final FieldName isDiscard = FieldName.forField("isDiscard", "is_discard");
static final FieldName relicIdList = FieldName.forField("relicIdList", "relic_id_list");
} }
} }
} }

View File

@@ -10,6 +10,7 @@ import us.hebi.quickbuf.MessageFactory;
import us.hebi.quickbuf.ProtoMessage; import us.hebi.quickbuf.ProtoMessage;
import us.hebi.quickbuf.ProtoSink; import us.hebi.quickbuf.ProtoSink;
import us.hebi.quickbuf.ProtoSource; import us.hebi.quickbuf.ProtoSource;
import us.hebi.quickbuf.RepeatedInt;
public final class LockRelicCsReqOuterClass { public final class LockRelicCsReqOuterClass {
/** /**
@@ -18,16 +19,16 @@ public final class LockRelicCsReqOuterClass {
public static final class LockRelicCsReq extends ProtoMessage<LockRelicCsReq> implements Cloneable { public static final class LockRelicCsReq extends ProtoMessage<LockRelicCsReq> implements Cloneable {
private static final long serialVersionUID = 0L; private static final long serialVersionUID = 0L;
/**
* <code>optional uint32 relic_unique_id = 6;</code>
*/
private int relicUniqueId;
/** /**
* <code>optional bool is_protected = 4;</code> * <code>optional bool is_protected = 4;</code>
*/ */
private boolean isProtected; private boolean isProtected;
/**
* <code>repeated uint32 relic_id_list = 12;</code>
*/
private final RepeatedInt relicIdList = RepeatedInt.newEmptyInstance();
private LockRelicCsReq() { private LockRelicCsReq() {
} }
@@ -38,49 +39,12 @@ public final class LockRelicCsReqOuterClass {
return new LockRelicCsReq(); return new LockRelicCsReq();
} }
/**
* <code>optional uint32 relic_unique_id = 6;</code>
* @return whether the relicUniqueId field is set
*/
public boolean hasRelicUniqueId() {
return (bitField0_ & 0x00000001) != 0;
}
/**
* <code>optional uint32 relic_unique_id = 6;</code>
* @return this
*/
public LockRelicCsReq clearRelicUniqueId() {
bitField0_ &= ~0x00000001;
relicUniqueId = 0;
return this;
}
/**
* <code>optional uint32 relic_unique_id = 6;</code>
* @return the relicUniqueId
*/
public int getRelicUniqueId() {
return relicUniqueId;
}
/**
* <code>optional uint32 relic_unique_id = 6;</code>
* @param value the relicUniqueId to set
* @return this
*/
public LockRelicCsReq setRelicUniqueId(final int value) {
bitField0_ |= 0x00000001;
relicUniqueId = value;
return this;
}
/** /**
* <code>optional bool is_protected = 4;</code> * <code>optional bool is_protected = 4;</code>
* @return whether the isProtected field is set * @return whether the isProtected field is set
*/ */
public boolean hasIsProtected() { public boolean hasIsProtected() {
return (bitField0_ & 0x00000002) != 0; return (bitField0_ & 0x00000001) != 0;
} }
/** /**
@@ -88,7 +52,7 @@ public final class LockRelicCsReqOuterClass {
* @return this * @return this
*/ */
public LockRelicCsReq clearIsProtected() { public LockRelicCsReq clearIsProtected() {
bitField0_ &= ~0x00000002; bitField0_ &= ~0x00000001;
isProtected = false; isProtected = false;
return this; return this;
} }
@@ -107,18 +71,86 @@ public final class LockRelicCsReqOuterClass {
* @return this * @return this
*/ */
public LockRelicCsReq setIsProtected(final boolean value) { public LockRelicCsReq setIsProtected(final boolean value) {
bitField0_ |= 0x00000002; bitField0_ |= 0x00000001;
isProtected = value; isProtected = value;
return this; return this;
} }
/**
* <code>repeated uint32 relic_id_list = 12;</code>
* @return whether the relicIdList field is set
*/
public boolean hasRelicIdList() {
return (bitField0_ & 0x00000002) != 0;
}
/**
* <code>repeated uint32 relic_id_list = 12;</code>
* @return this
*/
public LockRelicCsReq clearRelicIdList() {
bitField0_ &= ~0x00000002;
relicIdList.clear();
return this;
}
/**
* <code>repeated uint32 relic_id_list = 12;</code>
*
* 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 #getMutableRelicIdList()} if you want to modify it.
*
* @return internal storage object for reading
*/
public RepeatedInt getRelicIdList() {
return relicIdList;
}
/**
* <code>repeated uint32 relic_id_list = 12;</code>
*
* 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 RepeatedInt getMutableRelicIdList() {
bitField0_ |= 0x00000002;
return relicIdList;
}
/**
* <code>repeated uint32 relic_id_list = 12;</code>
* @param value the relicIdList to add
* @return this
*/
public LockRelicCsReq addRelicIdList(final int value) {
bitField0_ |= 0x00000002;
relicIdList.add(value);
return this;
}
/**
* <code>repeated uint32 relic_id_list = 12;</code>
* @param values the relicIdList to add
* @return this
*/
public LockRelicCsReq addAllRelicIdList(final int... values) {
bitField0_ |= 0x00000002;
relicIdList.addAll(values);
return this;
}
@Override @Override
public LockRelicCsReq copyFrom(final LockRelicCsReq other) { public LockRelicCsReq copyFrom(final LockRelicCsReq other) {
cachedSize = other.cachedSize; cachedSize = other.cachedSize;
if ((bitField0_ | other.bitField0_) != 0) { if ((bitField0_ | other.bitField0_) != 0) {
bitField0_ = other.bitField0_; bitField0_ = other.bitField0_;
relicUniqueId = other.relicUniqueId;
isProtected = other.isProtected; isProtected = other.isProtected;
relicIdList.copyFrom(other.relicIdList);
} }
return this; return this;
} }
@@ -129,12 +161,12 @@ public final class LockRelicCsReqOuterClass {
return this; return this;
} }
cachedSize = -1; cachedSize = -1;
if (other.hasRelicUniqueId()) {
setRelicUniqueId(other.relicUniqueId);
}
if (other.hasIsProtected()) { if (other.hasIsProtected()) {
setIsProtected(other.isProtected); setIsProtected(other.isProtected);
} }
if (other.hasRelicIdList()) {
getMutableRelicIdList().addAll(other.relicIdList);
}
return this; return this;
} }
@@ -145,8 +177,8 @@ public final class LockRelicCsReqOuterClass {
} }
cachedSize = -1; cachedSize = -1;
bitField0_ = 0; bitField0_ = 0;
relicUniqueId = 0;
isProtected = false; isProtected = false;
relicIdList.clear();
return this; return this;
} }
@@ -157,6 +189,7 @@ public final class LockRelicCsReqOuterClass {
} }
cachedSize = -1; cachedSize = -1;
bitField0_ = 0; bitField0_ = 0;
relicIdList.clear();
return this; return this;
} }
@@ -170,30 +203,32 @@ public final class LockRelicCsReqOuterClass {
} }
LockRelicCsReq other = (LockRelicCsReq) o; LockRelicCsReq other = (LockRelicCsReq) o;
return bitField0_ == other.bitField0_ return bitField0_ == other.bitField0_
&& (!hasRelicUniqueId() || relicUniqueId == other.relicUniqueId) && (!hasIsProtected() || isProtected == other.isProtected)
&& (!hasIsProtected() || isProtected == other.isProtected); && (!hasRelicIdList() || relicIdList.equals(other.relicIdList));
} }
@Override @Override
public void writeTo(final ProtoSink output) throws IOException { public void writeTo(final ProtoSink output) throws IOException {
if ((bitField0_ & 0x00000001) != 0) { if ((bitField0_ & 0x00000001) != 0) {
output.writeRawByte((byte) 48);
output.writeUInt32NoTag(relicUniqueId);
}
if ((bitField0_ & 0x00000002) != 0) {
output.writeRawByte((byte) 32); output.writeRawByte((byte) 32);
output.writeBoolNoTag(isProtected); output.writeBoolNoTag(isProtected);
} }
if ((bitField0_ & 0x00000002) != 0) {
for (int i = 0; i < relicIdList.length(); i++) {
output.writeRawByte((byte) 96);
output.writeUInt32NoTag(relicIdList.array()[i]);
}
}
} }
@Override @Override
protected int computeSerializedSize() { protected int computeSerializedSize() {
int size = 0; int size = 0;
if ((bitField0_ & 0x00000001) != 0) { if ((bitField0_ & 0x00000001) != 0) {
size += 1 + ProtoSink.computeUInt32SizeNoTag(relicUniqueId); size += 2;
} }
if ((bitField0_ & 0x00000002) != 0) { if ((bitField0_ & 0x00000002) != 0) {
size += 2; size += (1 * relicIdList.length()) + ProtoSink.computeRepeatedUInt32SizeNoTag(relicIdList);
} }
return size; return size;
} }
@@ -205,18 +240,18 @@ public final class LockRelicCsReqOuterClass {
int tag = input.readTag(); int tag = input.readTag();
while (true) { while (true) {
switch (tag) { switch (tag) {
case 48: {
// relicUniqueId
relicUniqueId = input.readUInt32();
bitField0_ |= 0x00000001;
tag = input.readTag();
if (tag != 32) {
break;
}
}
case 32: { case 32: {
// isProtected // isProtected
isProtected = input.readBool(); isProtected = input.readBool();
bitField0_ |= 0x00000001;
tag = input.readTag();
if (tag != 98) {
break;
}
}
case 98: {
// relicIdList [packed=true]
input.readPackedUInt32(relicIdList, tag);
bitField0_ |= 0x00000002; bitField0_ |= 0x00000002;
tag = input.readTag(); tag = input.readTag();
if (tag != 0) { if (tag != 0) {
@@ -233,6 +268,12 @@ public final class LockRelicCsReqOuterClass {
tag = input.readTag(); tag = input.readTag();
break; break;
} }
case 96: {
// relicIdList [packed=false]
tag = input.readRepeatedUInt32(relicIdList, tag);
bitField0_ |= 0x00000002;
break;
}
} }
} }
} }
@@ -241,10 +282,10 @@ public final class LockRelicCsReqOuterClass {
public void writeTo(final JsonSink output) throws IOException { public void writeTo(final JsonSink output) throws IOException {
output.beginObject(); output.beginObject();
if ((bitField0_ & 0x00000001) != 0) { if ((bitField0_ & 0x00000001) != 0) {
output.writeUInt32(FieldNames.relicUniqueId, relicUniqueId); output.writeBool(FieldNames.isProtected, isProtected);
} }
if ((bitField0_ & 0x00000002) != 0) { if ((bitField0_ & 0x00000002) != 0) {
output.writeBool(FieldNames.isProtected, isProtected); output.writeRepeatedUInt32(FieldNames.relicIdList, relicIdList);
} }
output.endObject(); output.endObject();
} }
@@ -256,11 +297,11 @@ public final class LockRelicCsReqOuterClass {
} }
while (!input.isAtEnd()) { while (!input.isAtEnd()) {
switch (input.readFieldHash()) { switch (input.readFieldHash()) {
case -1966200481: case 569879972:
case 49648253: { case -1919645991: {
if (input.isAtField(FieldNames.relicUniqueId)) { if (input.isAtField(FieldNames.isProtected)) {
if (!input.trySkipNullValue()) { if (!input.trySkipNullValue()) {
relicUniqueId = input.readUInt32(); isProtected = input.readBool();
bitField0_ |= 0x00000001; bitField0_ |= 0x00000001;
} }
} else { } else {
@@ -268,11 +309,11 @@ public final class LockRelicCsReqOuterClass {
} }
break; break;
} }
case 569879972: case -833914452:
case -1919645991: { case -2020549514: {
if (input.isAtField(FieldNames.isProtected)) { if (input.isAtField(FieldNames.relicIdList)) {
if (!input.trySkipNullValue()) { if (!input.trySkipNullValue()) {
isProtected = input.readBool(); input.readRepeatedUInt32(relicIdList);
bitField0_ |= 0x00000002; bitField0_ |= 0x00000002;
} }
} else { } else {
@@ -333,9 +374,9 @@ public final class LockRelicCsReqOuterClass {
* Contains name constants used for serializing JSON * Contains name constants used for serializing JSON
*/ */
static class FieldNames { static class FieldNames {
static final FieldName relicUniqueId = FieldName.forField("relicUniqueId", "relic_unique_id");
static final FieldName isProtected = FieldName.forField("isProtected", "is_protected"); static final FieldName isProtected = FieldName.forField("isProtected", "is_protected");
static final FieldName relicIdList = FieldName.forField("relicIdList", "relic_id_list");
} }
} }
} }

View File

@@ -19,15 +19,10 @@ public final class LockRelicScRspOuterClass {
private static final long serialVersionUID = 0L; private static final long serialVersionUID = 0L;
/** /**
* <code>optional uint32 retcode = 13;</code> * <code>optional uint32 retcode = 7;</code>
*/ */
private int retcode; private int retcode;
/**
* <code>optional uint32 relic_unique_id = 15;</code>
*/
private int relicUniqueId;
private LockRelicScRsp() { private LockRelicScRsp() {
} }
@@ -39,7 +34,7 @@ public final class LockRelicScRspOuterClass {
} }
/** /**
* <code>optional uint32 retcode = 13;</code> * <code>optional uint32 retcode = 7;</code>
* @return whether the retcode field is set * @return whether the retcode field is set
*/ */
public boolean hasRetcode() { public boolean hasRetcode() {
@@ -47,7 +42,7 @@ public final class LockRelicScRspOuterClass {
} }
/** /**
* <code>optional uint32 retcode = 13;</code> * <code>optional uint32 retcode = 7;</code>
* @return this * @return this
*/ */
public LockRelicScRsp clearRetcode() { public LockRelicScRsp clearRetcode() {
@@ -57,7 +52,7 @@ public final class LockRelicScRspOuterClass {
} }
/** /**
* <code>optional uint32 retcode = 13;</code> * <code>optional uint32 retcode = 7;</code>
* @return the retcode * @return the retcode
*/ */
public int getRetcode() { public int getRetcode() {
@@ -65,7 +60,7 @@ public final class LockRelicScRspOuterClass {
} }
/** /**
* <code>optional uint32 retcode = 13;</code> * <code>optional uint32 retcode = 7;</code>
* @param value the retcode to set * @param value the retcode to set
* @return this * @return this
*/ */
@@ -75,50 +70,12 @@ public final class LockRelicScRspOuterClass {
return this; return this;
} }
/**
* <code>optional uint32 relic_unique_id = 15;</code>
* @return whether the relicUniqueId field is set
*/
public boolean hasRelicUniqueId() {
return (bitField0_ & 0x00000002) != 0;
}
/**
* <code>optional uint32 relic_unique_id = 15;</code>
* @return this
*/
public LockRelicScRsp clearRelicUniqueId() {
bitField0_ &= ~0x00000002;
relicUniqueId = 0;
return this;
}
/**
* <code>optional uint32 relic_unique_id = 15;</code>
* @return the relicUniqueId
*/
public int getRelicUniqueId() {
return relicUniqueId;
}
/**
* <code>optional uint32 relic_unique_id = 15;</code>
* @param value the relicUniqueId to set
* @return this
*/
public LockRelicScRsp setRelicUniqueId(final int value) {
bitField0_ |= 0x00000002;
relicUniqueId = value;
return this;
}
@Override @Override
public LockRelicScRsp copyFrom(final LockRelicScRsp other) { public LockRelicScRsp copyFrom(final LockRelicScRsp other) {
cachedSize = other.cachedSize; cachedSize = other.cachedSize;
if ((bitField0_ | other.bitField0_) != 0) { if ((bitField0_ | other.bitField0_) != 0) {
bitField0_ = other.bitField0_; bitField0_ = other.bitField0_;
retcode = other.retcode; retcode = other.retcode;
relicUniqueId = other.relicUniqueId;
} }
return this; return this;
} }
@@ -132,9 +89,6 @@ public final class LockRelicScRspOuterClass {
if (other.hasRetcode()) { if (other.hasRetcode()) {
setRetcode(other.retcode); setRetcode(other.retcode);
} }
if (other.hasRelicUniqueId()) {
setRelicUniqueId(other.relicUniqueId);
}
return this; return this;
} }
@@ -146,7 +100,6 @@ public final class LockRelicScRspOuterClass {
cachedSize = -1; cachedSize = -1;
bitField0_ = 0; bitField0_ = 0;
retcode = 0; retcode = 0;
relicUniqueId = 0;
return this; return this;
} }
@@ -170,20 +123,15 @@ public final class LockRelicScRspOuterClass {
} }
LockRelicScRsp other = (LockRelicScRsp) o; LockRelicScRsp other = (LockRelicScRsp) o;
return bitField0_ == other.bitField0_ return bitField0_ == other.bitField0_
&& (!hasRetcode() || retcode == other.retcode) && (!hasRetcode() || retcode == other.retcode);
&& (!hasRelicUniqueId() || relicUniqueId == other.relicUniqueId);
} }
@Override @Override
public void writeTo(final ProtoSink output) throws IOException { public void writeTo(final ProtoSink output) throws IOException {
if ((bitField0_ & 0x00000001) != 0) { if ((bitField0_ & 0x00000001) != 0) {
output.writeRawByte((byte) 104); output.writeRawByte((byte) 56);
output.writeUInt32NoTag(retcode); output.writeUInt32NoTag(retcode);
} }
if ((bitField0_ & 0x00000002) != 0) {
output.writeRawByte((byte) 120);
output.writeUInt32NoTag(relicUniqueId);
}
} }
@Override @Override
@@ -192,9 +140,6 @@ public final class LockRelicScRspOuterClass {
if ((bitField0_ & 0x00000001) != 0) { if ((bitField0_ & 0x00000001) != 0) {
size += 1 + ProtoSink.computeUInt32SizeNoTag(retcode); size += 1 + ProtoSink.computeUInt32SizeNoTag(retcode);
} }
if ((bitField0_ & 0x00000002) != 0) {
size += 1 + ProtoSink.computeUInt32SizeNoTag(relicUniqueId);
}
return size; return size;
} }
@@ -205,20 +150,11 @@ public final class LockRelicScRspOuterClass {
int tag = input.readTag(); int tag = input.readTag();
while (true) { while (true) {
switch (tag) { switch (tag) {
case 104: { case 56: {
// retcode // retcode
retcode = input.readUInt32(); retcode = input.readUInt32();
bitField0_ |= 0x00000001; bitField0_ |= 0x00000001;
tag = input.readTag(); tag = input.readTag();
if (tag != 120) {
break;
}
}
case 120: {
// relicUniqueId
relicUniqueId = input.readUInt32();
bitField0_ |= 0x00000002;
tag = input.readTag();
if (tag != 0) { if (tag != 0) {
break; break;
} }
@@ -243,9 +179,6 @@ public final class LockRelicScRspOuterClass {
if ((bitField0_ & 0x00000001) != 0) { if ((bitField0_ & 0x00000001) != 0) {
output.writeUInt32(FieldNames.retcode, retcode); output.writeUInt32(FieldNames.retcode, retcode);
} }
if ((bitField0_ & 0x00000002) != 0) {
output.writeUInt32(FieldNames.relicUniqueId, relicUniqueId);
}
output.endObject(); output.endObject();
} }
@@ -267,18 +200,6 @@ public final class LockRelicScRspOuterClass {
} }
break; break;
} }
case -1966200481:
case 49648253: {
if (input.isAtField(FieldNames.relicUniqueId)) {
if (!input.trySkipNullValue()) {
relicUniqueId = input.readUInt32();
bitField0_ |= 0x00000002;
}
} else {
input.skipUnknownField();
}
break;
}
default: { default: {
input.skipUnknownField(); input.skipUnknownField();
break; break;
@@ -333,8 +254,6 @@ public final class LockRelicScRspOuterClass {
*/ */
static class FieldNames { static class FieldNames {
static final FieldName retcode = FieldName.forField("retcode"); static final FieldName retcode = FieldName.forField("retcode");
static final FieldName relicUniqueId = FieldName.forField("relicUniqueId", "relic_unique_id");
} }
} }
} }

View File

@@ -16,6 +16,7 @@ import emu.lunarcore.game.player.Player;
import emu.lunarcore.server.game.BaseGameService; import emu.lunarcore.server.game.BaseGameService;
import emu.lunarcore.server.game.GameServer; import emu.lunarcore.server.game.GameServer;
import emu.lunarcore.server.packet.send.*; import emu.lunarcore.server.packet.send.*;
import us.hebi.quickbuf.RepeatedInt;
public class InventoryService extends BaseGameService { public class InventoryService extends BaseGameService {
@@ -524,30 +525,46 @@ public class InventoryService extends BaseGameService {
// === Etc === // === Etc ===
public void lockItem(Player player, int equipId, boolean locked) { public void lockItems(Player player, RepeatedInt list, boolean locked) {
GameItem item = player.getInventory().getItemByUid(equipId); // List of items to update on the client
if (item == null || !item.getExcel().isEquippable()) { List<GameItem> items = new ArrayList<>();
return;
// Lock items
for (int equipId : list) {
GameItem item = player.getInventory().getItemByUid(equipId);
if (item == null || !item.getExcel().isEquippable()) {
continue;
}
item.setLocked(locked);
item.save();
}
// Send packet
if (items.size() > 0) {
player.sendPacket(new PacketPlayerSyncScNotify(items));
} }
item.setLocked(locked);
item.save();
// Send packet
player.sendPacket(new PacketPlayerSyncScNotify(item));
} }
public void discardRelic(Player player, int equipId, boolean discarded) { public void discardRelics(Player player, RepeatedInt list, boolean discarded) {
GameItem relic = player.getInventory().getItemByUid(equipId); // List of items to update on the client
if (relic == null || !relic.getExcel().isRelic()) { List<GameItem> items = new ArrayList<>();
return;
// Lock items
for (int equipId : list) {
GameItem item = player.getInventory().getItemByUid(equipId);
if (item == null || !item.getExcel().isEquippable()) {
continue;
}
item.setDiscarded(discarded);
item.save();
}
// Send packet
if (items.size() > 0) {
player.sendPacket(new PacketPlayerSyncScNotify(items));
} }
relic.setDiscarded(discarded);
relic.save();
// Send packet
player.sendPacket(new PacketPlayerSyncScNotify(relic));
} }
public List<GameItem> sellItems(Player player, boolean toMaterials, List<ItemParam> items) { public List<GameItem> sellItems(Player player, boolean toMaterials, List<ItemParam> items) {

View File

@@ -13,7 +13,7 @@ public class HandlerDiscardRelicCsReq extends PacketHandler {
public void handle(GameSession session, byte[] data) throws Exception { public void handle(GameSession session, byte[] data) throws Exception {
var req = DiscardRelicCsReq.parseFrom(data); var req = DiscardRelicCsReq.parseFrom(data);
session.getServer().getInventoryService().discardRelic(session.getPlayer(), req.getRelicUniqueId(), req.getIsDiscard()); session.getServer().getInventoryService().discardRelics(session.getPlayer(), req.getRelicIdList(), req.getIsDiscard());
session.send(CmdId.DiscardRelicScRsp); session.send(CmdId.DiscardRelicScRsp);
} }

View File

@@ -13,10 +13,7 @@ public class HandlerLockEquipmentCsReq extends PacketHandler {
public void handle(GameSession session, byte[] data) throws Exception { public void handle(GameSession session, byte[] data) throws Exception {
var req = LockEquipmentCsReq.parseFrom(data); var req = LockEquipmentCsReq.parseFrom(data);
for (int id : req.getEquipmentIdList()) { session.getServer().getInventoryService().lockItems(session.getPlayer(), req.getEquipmentIdList(), req.getIsProtected());
session.getServer().getInventoryService().lockItem(session.getPlayer(), id, req.getIsProtected());
}
session.send(CmdId.LockEquipmentScRsp); session.send(CmdId.LockEquipmentScRsp);
} }

View File

@@ -13,7 +13,7 @@ public class HandlerLockRelicCsReq extends PacketHandler {
public void handle(GameSession session, byte[] data) throws Exception { public void handle(GameSession session, byte[] data) throws Exception {
var req = LockRelicCsReq.parseFrom(data); var req = LockRelicCsReq.parseFrom(data);
session.getServer().getInventoryService().lockItem(session.getPlayer(), req.getRelicUniqueId(), req.getIsProtected()); session.getServer().getInventoryService().lockItems(session.getPlayer(), req.getRelicIdList(), req.getIsProtected());
session.send(CmdId.LockRelicScRsp); session.send(CmdId.LockRelicScRsp);
} }