mirror of
https://github.com/Melledy/LunarCore.git
synced 2025-12-12 13:24:36 +01:00
Fix locking and discarding items
This commit is contained in:
@@ -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.RepeatedInt;
|
||||
|
||||
public final class DiscardRelicCsReqOuterClass {
|
||||
/**
|
||||
@@ -19,15 +20,15 @@ public final class DiscardRelicCsReqOuterClass {
|
||||
private static final long serialVersionUID = 0L;
|
||||
|
||||
/**
|
||||
* <code>optional uint32 relic_unique_id = 3;</code>
|
||||
*/
|
||||
private int relicUniqueId;
|
||||
|
||||
/**
|
||||
* <code>optional bool is_discard = 5;</code>
|
||||
* <code>optional bool is_discard = 9;</code>
|
||||
*/
|
||||
private boolean isDiscard;
|
||||
|
||||
/**
|
||||
* <code>repeated uint32 relic_id_list = 15;</code>
|
||||
*/
|
||||
private final RepeatedInt relicIdList = RepeatedInt.newEmptyInstance();
|
||||
|
||||
private DiscardRelicCsReq() {
|
||||
}
|
||||
|
||||
@@ -39,62 +40,25 @@ public final class DiscardRelicCsReqOuterClass {
|
||||
}
|
||||
|
||||
/**
|
||||
* <code>optional uint32 relic_unique_id = 3;</code>
|
||||
* @return whether the relicUniqueId field is set
|
||||
* <code>optional bool is_discard = 9;</code>
|
||||
* @return whether the isDiscard field is set
|
||||
*/
|
||||
public boolean hasRelicUniqueId() {
|
||||
public boolean hasIsDiscard() {
|
||||
return (bitField0_ & 0x00000001) != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* <code>optional uint32 relic_unique_id = 3;</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>
|
||||
* <code>optional bool is_discard = 9;</code>
|
||||
* @return this
|
||||
*/
|
||||
public DiscardRelicCsReq clearIsDiscard() {
|
||||
bitField0_ &= ~0x00000002;
|
||||
bitField0_ &= ~0x00000001;
|
||||
isDiscard = false;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* <code>optional bool is_discard = 5;</code>
|
||||
* <code>optional bool is_discard = 9;</code>
|
||||
* @return the isDiscard
|
||||
*/
|
||||
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
|
||||
* @return this
|
||||
*/
|
||||
public DiscardRelicCsReq setIsDiscard(final boolean value) {
|
||||
bitField0_ |= 0x00000002;
|
||||
bitField0_ |= 0x00000001;
|
||||
isDiscard = value;
|
||||
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
|
||||
public DiscardRelicCsReq copyFrom(final DiscardRelicCsReq other) {
|
||||
cachedSize = other.cachedSize;
|
||||
if ((bitField0_ | other.bitField0_) != 0) {
|
||||
bitField0_ = other.bitField0_;
|
||||
relicUniqueId = other.relicUniqueId;
|
||||
isDiscard = other.isDiscard;
|
||||
relicIdList.copyFrom(other.relicIdList);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
@@ -129,12 +161,12 @@ public final class DiscardRelicCsReqOuterClass {
|
||||
return this;
|
||||
}
|
||||
cachedSize = -1;
|
||||
if (other.hasRelicUniqueId()) {
|
||||
setRelicUniqueId(other.relicUniqueId);
|
||||
}
|
||||
if (other.hasIsDiscard()) {
|
||||
setIsDiscard(other.isDiscard);
|
||||
}
|
||||
if (other.hasRelicIdList()) {
|
||||
getMutableRelicIdList().addAll(other.relicIdList);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -145,8 +177,8 @@ public final class DiscardRelicCsReqOuterClass {
|
||||
}
|
||||
cachedSize = -1;
|
||||
bitField0_ = 0;
|
||||
relicUniqueId = 0;
|
||||
isDiscard = false;
|
||||
relicIdList.clear();
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -157,6 +189,7 @@ public final class DiscardRelicCsReqOuterClass {
|
||||
}
|
||||
cachedSize = -1;
|
||||
bitField0_ = 0;
|
||||
relicIdList.clear();
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -170,19 +203,21 @@ public final class DiscardRelicCsReqOuterClass {
|
||||
}
|
||||
DiscardRelicCsReq other = (DiscardRelicCsReq) o;
|
||||
return bitField0_ == other.bitField0_
|
||||
&& (!hasRelicUniqueId() || relicUniqueId == other.relicUniqueId)
|
||||
&& (!hasIsDiscard() || isDiscard == other.isDiscard);
|
||||
&& (!hasIsDiscard() || isDiscard == other.isDiscard)
|
||||
&& (!hasRelicIdList() || relicIdList.equals(other.relicIdList));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeTo(final ProtoSink output) throws IOException {
|
||||
if ((bitField0_ & 0x00000001) != 0) {
|
||||
output.writeRawByte((byte) 24);
|
||||
output.writeUInt32NoTag(relicUniqueId);
|
||||
output.writeRawByte((byte) 72);
|
||||
output.writeBoolNoTag(isDiscard);
|
||||
}
|
||||
if ((bitField0_ & 0x00000002) != 0) {
|
||||
output.writeRawByte((byte) 40);
|
||||
output.writeBoolNoTag(isDiscard);
|
||||
for (int i = 0; i < relicIdList.length(); i++) {
|
||||
output.writeRawByte((byte) 120);
|
||||
output.writeUInt32NoTag(relicIdList.array()[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -190,10 +225,10 @@ public final class DiscardRelicCsReqOuterClass {
|
||||
protected int computeSerializedSize() {
|
||||
int size = 0;
|
||||
if ((bitField0_ & 0x00000001) != 0) {
|
||||
size += 1 + ProtoSink.computeUInt32SizeNoTag(relicUniqueId);
|
||||
size += 2;
|
||||
}
|
||||
if ((bitField0_ & 0x00000002) != 0) {
|
||||
size += 2;
|
||||
size += (1 * relicIdList.length()) + ProtoSink.computeRepeatedUInt32SizeNoTag(relicIdList);
|
||||
}
|
||||
return size;
|
||||
}
|
||||
@@ -205,18 +240,18 @@ public final class DiscardRelicCsReqOuterClass {
|
||||
int tag = input.readTag();
|
||||
while (true) {
|
||||
switch (tag) {
|
||||
case 24: {
|
||||
// relicUniqueId
|
||||
relicUniqueId = input.readUInt32();
|
||||
case 72: {
|
||||
// isDiscard
|
||||
isDiscard = input.readBool();
|
||||
bitField0_ |= 0x00000001;
|
||||
tag = input.readTag();
|
||||
if (tag != 40) {
|
||||
if (tag != 122) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
case 40: {
|
||||
// isDiscard
|
||||
isDiscard = input.readBool();
|
||||
case 122: {
|
||||
// relicIdList [packed=true]
|
||||
input.readPackedUInt32(relicIdList, tag);
|
||||
bitField0_ |= 0x00000002;
|
||||
tag = input.readTag();
|
||||
if (tag != 0) {
|
||||
@@ -233,6 +268,12 @@ public final class DiscardRelicCsReqOuterClass {
|
||||
tag = input.readTag();
|
||||
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 {
|
||||
output.beginObject();
|
||||
if ((bitField0_ & 0x00000001) != 0) {
|
||||
output.writeUInt32(FieldNames.relicUniqueId, relicUniqueId);
|
||||
output.writeBool(FieldNames.isDiscard, isDiscard);
|
||||
}
|
||||
if ((bitField0_ & 0x00000002) != 0) {
|
||||
output.writeBool(FieldNames.isDiscard, isDiscard);
|
||||
output.writeRepeatedUInt32(FieldNames.relicIdList, relicIdList);
|
||||
}
|
||||
output.endObject();
|
||||
}
|
||||
@@ -256,11 +297,11 @@ public final class DiscardRelicCsReqOuterClass {
|
||||
}
|
||||
while (!input.isAtEnd()) {
|
||||
switch (input.readFieldHash()) {
|
||||
case -1966200481:
|
||||
case 49648253: {
|
||||
if (input.isAtField(FieldNames.relicUniqueId)) {
|
||||
case 1091588116:
|
||||
case -1123290487: {
|
||||
if (input.isAtField(FieldNames.isDiscard)) {
|
||||
if (!input.trySkipNullValue()) {
|
||||
relicUniqueId = input.readUInt32();
|
||||
isDiscard = input.readBool();
|
||||
bitField0_ |= 0x00000001;
|
||||
}
|
||||
} else {
|
||||
@@ -268,11 +309,11 @@ public final class DiscardRelicCsReqOuterClass {
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 1091588116:
|
||||
case -1123290487: {
|
||||
if (input.isAtField(FieldNames.isDiscard)) {
|
||||
case -833914452:
|
||||
case -2020549514: {
|
||||
if (input.isAtField(FieldNames.relicIdList)) {
|
||||
if (!input.trySkipNullValue()) {
|
||||
isDiscard = input.readBool();
|
||||
input.readRepeatedUInt32(relicIdList);
|
||||
bitField0_ |= 0x00000002;
|
||||
}
|
||||
} else {
|
||||
@@ -333,9 +374,9 @@ public final class DiscardRelicCsReqOuterClass {
|
||||
* Contains name constants used for serializing JSON
|
||||
*/
|
||||
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 relicIdList = FieldName.forField("relicIdList", "relic_id_list");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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.RepeatedInt;
|
||||
|
||||
public final class LockRelicCsReqOuterClass {
|
||||
/**
|
||||
@@ -18,16 +19,16 @@ public final class LockRelicCsReqOuterClass {
|
||||
public static final class LockRelicCsReq extends ProtoMessage<LockRelicCsReq> implements Cloneable {
|
||||
private static final long serialVersionUID = 0L;
|
||||
|
||||
/**
|
||||
* <code>optional uint32 relic_unique_id = 6;</code>
|
||||
*/
|
||||
private int relicUniqueId;
|
||||
|
||||
/**
|
||||
* <code>optional bool is_protected = 4;</code>
|
||||
*/
|
||||
private boolean isProtected;
|
||||
|
||||
/**
|
||||
* <code>repeated uint32 relic_id_list = 12;</code>
|
||||
*/
|
||||
private final RepeatedInt relicIdList = RepeatedInt.newEmptyInstance();
|
||||
|
||||
private LockRelicCsReq() {
|
||||
}
|
||||
|
||||
@@ -38,49 +39,12 @@ public final class LockRelicCsReqOuterClass {
|
||||
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>
|
||||
* @return whether the isProtected field is set
|
||||
*/
|
||||
public boolean hasIsProtected() {
|
||||
return (bitField0_ & 0x00000002) != 0;
|
||||
return (bitField0_ & 0x00000001) != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -88,7 +52,7 @@ public final class LockRelicCsReqOuterClass {
|
||||
* @return this
|
||||
*/
|
||||
public LockRelicCsReq clearIsProtected() {
|
||||
bitField0_ &= ~0x00000002;
|
||||
bitField0_ &= ~0x00000001;
|
||||
isProtected = false;
|
||||
return this;
|
||||
}
|
||||
@@ -107,18 +71,86 @@ public final class LockRelicCsReqOuterClass {
|
||||
* @return this
|
||||
*/
|
||||
public LockRelicCsReq setIsProtected(final boolean value) {
|
||||
bitField0_ |= 0x00000002;
|
||||
bitField0_ |= 0x00000001;
|
||||
isProtected = value;
|
||||
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
|
||||
public LockRelicCsReq copyFrom(final LockRelicCsReq other) {
|
||||
cachedSize = other.cachedSize;
|
||||
if ((bitField0_ | other.bitField0_) != 0) {
|
||||
bitField0_ = other.bitField0_;
|
||||
relicUniqueId = other.relicUniqueId;
|
||||
isProtected = other.isProtected;
|
||||
relicIdList.copyFrom(other.relicIdList);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
@@ -129,12 +161,12 @@ public final class LockRelicCsReqOuterClass {
|
||||
return this;
|
||||
}
|
||||
cachedSize = -1;
|
||||
if (other.hasRelicUniqueId()) {
|
||||
setRelicUniqueId(other.relicUniqueId);
|
||||
}
|
||||
if (other.hasIsProtected()) {
|
||||
setIsProtected(other.isProtected);
|
||||
}
|
||||
if (other.hasRelicIdList()) {
|
||||
getMutableRelicIdList().addAll(other.relicIdList);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -145,8 +177,8 @@ public final class LockRelicCsReqOuterClass {
|
||||
}
|
||||
cachedSize = -1;
|
||||
bitField0_ = 0;
|
||||
relicUniqueId = 0;
|
||||
isProtected = false;
|
||||
relicIdList.clear();
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -157,6 +189,7 @@ public final class LockRelicCsReqOuterClass {
|
||||
}
|
||||
cachedSize = -1;
|
||||
bitField0_ = 0;
|
||||
relicIdList.clear();
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -170,30 +203,32 @@ public final class LockRelicCsReqOuterClass {
|
||||
}
|
||||
LockRelicCsReq other = (LockRelicCsReq) o;
|
||||
return bitField0_ == other.bitField0_
|
||||
&& (!hasRelicUniqueId() || relicUniqueId == other.relicUniqueId)
|
||||
&& (!hasIsProtected() || isProtected == other.isProtected);
|
||||
&& (!hasIsProtected() || isProtected == other.isProtected)
|
||||
&& (!hasRelicIdList() || relicIdList.equals(other.relicIdList));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeTo(final ProtoSink output) throws IOException {
|
||||
if ((bitField0_ & 0x00000001) != 0) {
|
||||
output.writeRawByte((byte) 48);
|
||||
output.writeUInt32NoTag(relicUniqueId);
|
||||
}
|
||||
if ((bitField0_ & 0x00000002) != 0) {
|
||||
output.writeRawByte((byte) 32);
|
||||
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
|
||||
protected int computeSerializedSize() {
|
||||
int size = 0;
|
||||
if ((bitField0_ & 0x00000001) != 0) {
|
||||
size += 1 + ProtoSink.computeUInt32SizeNoTag(relicUniqueId);
|
||||
size += 2;
|
||||
}
|
||||
if ((bitField0_ & 0x00000002) != 0) {
|
||||
size += 2;
|
||||
size += (1 * relicIdList.length()) + ProtoSink.computeRepeatedUInt32SizeNoTag(relicIdList);
|
||||
}
|
||||
return size;
|
||||
}
|
||||
@@ -205,18 +240,18 @@ public final class LockRelicCsReqOuterClass {
|
||||
int tag = input.readTag();
|
||||
while (true) {
|
||||
switch (tag) {
|
||||
case 48: {
|
||||
// relicUniqueId
|
||||
relicUniqueId = input.readUInt32();
|
||||
bitField0_ |= 0x00000001;
|
||||
tag = input.readTag();
|
||||
if (tag != 32) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
case 32: {
|
||||
// isProtected
|
||||
isProtected = input.readBool();
|
||||
bitField0_ |= 0x00000001;
|
||||
tag = input.readTag();
|
||||
if (tag != 98) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
case 98: {
|
||||
// relicIdList [packed=true]
|
||||
input.readPackedUInt32(relicIdList, tag);
|
||||
bitField0_ |= 0x00000002;
|
||||
tag = input.readTag();
|
||||
if (tag != 0) {
|
||||
@@ -233,6 +268,12 @@ public final class LockRelicCsReqOuterClass {
|
||||
tag = input.readTag();
|
||||
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 {
|
||||
output.beginObject();
|
||||
if ((bitField0_ & 0x00000001) != 0) {
|
||||
output.writeUInt32(FieldNames.relicUniqueId, relicUniqueId);
|
||||
output.writeBool(FieldNames.isProtected, isProtected);
|
||||
}
|
||||
if ((bitField0_ & 0x00000002) != 0) {
|
||||
output.writeBool(FieldNames.isProtected, isProtected);
|
||||
output.writeRepeatedUInt32(FieldNames.relicIdList, relicIdList);
|
||||
}
|
||||
output.endObject();
|
||||
}
|
||||
@@ -256,11 +297,11 @@ public final class LockRelicCsReqOuterClass {
|
||||
}
|
||||
while (!input.isAtEnd()) {
|
||||
switch (input.readFieldHash()) {
|
||||
case -1966200481:
|
||||
case 49648253: {
|
||||
if (input.isAtField(FieldNames.relicUniqueId)) {
|
||||
case 569879972:
|
||||
case -1919645991: {
|
||||
if (input.isAtField(FieldNames.isProtected)) {
|
||||
if (!input.trySkipNullValue()) {
|
||||
relicUniqueId = input.readUInt32();
|
||||
isProtected = input.readBool();
|
||||
bitField0_ |= 0x00000001;
|
||||
}
|
||||
} else {
|
||||
@@ -268,11 +309,11 @@ public final class LockRelicCsReqOuterClass {
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 569879972:
|
||||
case -1919645991: {
|
||||
if (input.isAtField(FieldNames.isProtected)) {
|
||||
case -833914452:
|
||||
case -2020549514: {
|
||||
if (input.isAtField(FieldNames.relicIdList)) {
|
||||
if (!input.trySkipNullValue()) {
|
||||
isProtected = input.readBool();
|
||||
input.readRepeatedUInt32(relicIdList);
|
||||
bitField0_ |= 0x00000002;
|
||||
}
|
||||
} else {
|
||||
@@ -333,9 +374,9 @@ public final class LockRelicCsReqOuterClass {
|
||||
* Contains name constants used for serializing JSON
|
||||
*/
|
||||
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 relicIdList = FieldName.forField("relicIdList", "relic_id_list");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,15 +19,10 @@ public final class LockRelicScRspOuterClass {
|
||||
private static final long serialVersionUID = 0L;
|
||||
|
||||
/**
|
||||
* <code>optional uint32 retcode = 13;</code>
|
||||
* <code>optional uint32 retcode = 7;</code>
|
||||
*/
|
||||
private int retcode;
|
||||
|
||||
/**
|
||||
* <code>optional uint32 relic_unique_id = 15;</code>
|
||||
*/
|
||||
private int relicUniqueId;
|
||||
|
||||
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
|
||||
*/
|
||||
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
|
||||
*/
|
||||
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
|
||||
*/
|
||||
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
|
||||
* @return this
|
||||
*/
|
||||
@@ -75,50 +70,12 @@ public final class LockRelicScRspOuterClass {
|
||||
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
|
||||
public LockRelicScRsp copyFrom(final LockRelicScRsp other) {
|
||||
cachedSize = other.cachedSize;
|
||||
if ((bitField0_ | other.bitField0_) != 0) {
|
||||
bitField0_ = other.bitField0_;
|
||||
retcode = other.retcode;
|
||||
relicUniqueId = other.relicUniqueId;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
@@ -132,9 +89,6 @@ public final class LockRelicScRspOuterClass {
|
||||
if (other.hasRetcode()) {
|
||||
setRetcode(other.retcode);
|
||||
}
|
||||
if (other.hasRelicUniqueId()) {
|
||||
setRelicUniqueId(other.relicUniqueId);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -146,7 +100,6 @@ public final class LockRelicScRspOuterClass {
|
||||
cachedSize = -1;
|
||||
bitField0_ = 0;
|
||||
retcode = 0;
|
||||
relicUniqueId = 0;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -170,20 +123,15 @@ public final class LockRelicScRspOuterClass {
|
||||
}
|
||||
LockRelicScRsp other = (LockRelicScRsp) o;
|
||||
return bitField0_ == other.bitField0_
|
||||
&& (!hasRetcode() || retcode == other.retcode)
|
||||
&& (!hasRelicUniqueId() || relicUniqueId == other.relicUniqueId);
|
||||
&& (!hasRetcode() || retcode == other.retcode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeTo(final ProtoSink output) throws IOException {
|
||||
if ((bitField0_ & 0x00000001) != 0) {
|
||||
output.writeRawByte((byte) 104);
|
||||
output.writeRawByte((byte) 56);
|
||||
output.writeUInt32NoTag(retcode);
|
||||
}
|
||||
if ((bitField0_ & 0x00000002) != 0) {
|
||||
output.writeRawByte((byte) 120);
|
||||
output.writeUInt32NoTag(relicUniqueId);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -192,9 +140,6 @@ public final class LockRelicScRspOuterClass {
|
||||
if ((bitField0_ & 0x00000001) != 0) {
|
||||
size += 1 + ProtoSink.computeUInt32SizeNoTag(retcode);
|
||||
}
|
||||
if ((bitField0_ & 0x00000002) != 0) {
|
||||
size += 1 + ProtoSink.computeUInt32SizeNoTag(relicUniqueId);
|
||||
}
|
||||
return size;
|
||||
}
|
||||
|
||||
@@ -205,20 +150,11 @@ public final class LockRelicScRspOuterClass {
|
||||
int tag = input.readTag();
|
||||
while (true) {
|
||||
switch (tag) {
|
||||
case 104: {
|
||||
case 56: {
|
||||
// retcode
|
||||
retcode = input.readUInt32();
|
||||
bitField0_ |= 0x00000001;
|
||||
tag = input.readTag();
|
||||
if (tag != 120) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
case 120: {
|
||||
// relicUniqueId
|
||||
relicUniqueId = input.readUInt32();
|
||||
bitField0_ |= 0x00000002;
|
||||
tag = input.readTag();
|
||||
if (tag != 0) {
|
||||
break;
|
||||
}
|
||||
@@ -243,9 +179,6 @@ public final class LockRelicScRspOuterClass {
|
||||
if ((bitField0_ & 0x00000001) != 0) {
|
||||
output.writeUInt32(FieldNames.retcode, retcode);
|
||||
}
|
||||
if ((bitField0_ & 0x00000002) != 0) {
|
||||
output.writeUInt32(FieldNames.relicUniqueId, relicUniqueId);
|
||||
}
|
||||
output.endObject();
|
||||
}
|
||||
|
||||
@@ -267,18 +200,6 @@ public final class LockRelicScRspOuterClass {
|
||||
}
|
||||
break;
|
||||
}
|
||||
case -1966200481:
|
||||
case 49648253: {
|
||||
if (input.isAtField(FieldNames.relicUniqueId)) {
|
||||
if (!input.trySkipNullValue()) {
|
||||
relicUniqueId = input.readUInt32();
|
||||
bitField0_ |= 0x00000002;
|
||||
}
|
||||
} else {
|
||||
input.skipUnknownField();
|
||||
}
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
input.skipUnknownField();
|
||||
break;
|
||||
@@ -333,8 +254,6 @@ public final class LockRelicScRspOuterClass {
|
||||
*/
|
||||
static class FieldNames {
|
||||
static final FieldName retcode = FieldName.forField("retcode");
|
||||
|
||||
static final FieldName relicUniqueId = FieldName.forField("relicUniqueId", "relic_unique_id");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ import emu.lunarcore.game.player.Player;
|
||||
import emu.lunarcore.server.game.BaseGameService;
|
||||
import emu.lunarcore.server.game.GameServer;
|
||||
import emu.lunarcore.server.packet.send.*;
|
||||
import us.hebi.quickbuf.RepeatedInt;
|
||||
|
||||
public class InventoryService extends BaseGameService {
|
||||
|
||||
@@ -524,30 +525,46 @@ public class InventoryService extends BaseGameService {
|
||||
|
||||
// === Etc ===
|
||||
|
||||
public void lockItem(Player player, int equipId, boolean locked) {
|
||||
GameItem item = player.getInventory().getItemByUid(equipId);
|
||||
if (item == null || !item.getExcel().isEquippable()) {
|
||||
return;
|
||||
public void lockItems(Player player, RepeatedInt list, boolean locked) {
|
||||
// List of items to update on the client
|
||||
List<GameItem> items = new ArrayList<>();
|
||||
|
||||
// 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) {
|
||||
GameItem relic = player.getInventory().getItemByUid(equipId);
|
||||
if (relic == null || !relic.getExcel().isRelic()) {
|
||||
return;
|
||||
public void discardRelics(Player player, RepeatedInt list, boolean discarded) {
|
||||
// List of items to update on the client
|
||||
List<GameItem> items = new ArrayList<>();
|
||||
|
||||
// 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) {
|
||||
|
||||
@@ -13,7 +13,7 @@ public class HandlerDiscardRelicCsReq extends PacketHandler {
|
||||
public void handle(GameSession session, byte[] data) throws Exception {
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
@@ -13,10 +13,7 @@ public class HandlerLockEquipmentCsReq extends PacketHandler {
|
||||
public void handle(GameSession session, byte[] data) throws Exception {
|
||||
var req = LockEquipmentCsReq.parseFrom(data);
|
||||
|
||||
for (int id : req.getEquipmentIdList()) {
|
||||
session.getServer().getInventoryService().lockItem(session.getPlayer(), id, req.getIsProtected());
|
||||
}
|
||||
|
||||
session.getServer().getInventoryService().lockItems(session.getPlayer(), req.getEquipmentIdList(), req.getIsProtected());
|
||||
session.send(CmdId.LockEquipmentScRsp);
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ public class HandlerLockRelicCsReq extends PacketHandler {
|
||||
public void handle(GameSession session, byte[] data) throws Exception {
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user