Fix swapping characters around in SU

This commit is contained in:
Melledy
2023-10-27 12:38:29 -07:00
parent e5ea2c9820
commit 07b67b3220
3 changed files with 433 additions and 16 deletions

View File

@@ -0,0 +1,301 @@
// 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;
import us.hebi.quickbuf.RepeatedInt;
public final class RogueAvatarInfoOuterClass {
/**
* Protobuf type {@code RogueAvatarInfo}
*/
public static final class RogueAvatarInfo extends ProtoMessage<RogueAvatarInfo> implements Cloneable {
private static final long serialVersionUID = 0L;
/**
* <code>repeated uint32 base_avatar_id_list = 8;</code>
*/
private final RepeatedInt baseAvatarIdList = RepeatedInt.newEmptyInstance();
private RogueAvatarInfo() {
}
/**
* @return a new empty instance of {@code RogueAvatarInfo}
*/
public static RogueAvatarInfo newInstance() {
return new RogueAvatarInfo();
}
/**
* <code>repeated uint32 base_avatar_id_list = 8;</code>
* @return whether the baseAvatarIdList field is set
*/
public boolean hasBaseAvatarIdList() {
return (bitField0_ & 0x00000001) != 0;
}
/**
* <code>repeated uint32 base_avatar_id_list = 8;</code>
* @return this
*/
public RogueAvatarInfo clearBaseAvatarIdList() {
bitField0_ &= ~0x00000001;
baseAvatarIdList.clear();
return this;
}
/**
* <code>repeated uint32 base_avatar_id_list = 8;</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 #getMutableBaseAvatarIdList()} if you want to modify it.
*
* @return internal storage object for reading
*/
public RepeatedInt getBaseAvatarIdList() {
return baseAvatarIdList;
}
/**
* <code>repeated uint32 base_avatar_id_list = 8;</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 getMutableBaseAvatarIdList() {
bitField0_ |= 0x00000001;
return baseAvatarIdList;
}
/**
* <code>repeated uint32 base_avatar_id_list = 8;</code>
* @param value the baseAvatarIdList to add
* @return this
*/
public RogueAvatarInfo addBaseAvatarIdList(final int value) {
bitField0_ |= 0x00000001;
baseAvatarIdList.add(value);
return this;
}
/**
* <code>repeated uint32 base_avatar_id_list = 8;</code>
* @param values the baseAvatarIdList to add
* @return this
*/
public RogueAvatarInfo addAllBaseAvatarIdList(final int... values) {
bitField0_ |= 0x00000001;
baseAvatarIdList.addAll(values);
return this;
}
@Override
public RogueAvatarInfo copyFrom(final RogueAvatarInfo other) {
cachedSize = other.cachedSize;
if ((bitField0_ | other.bitField0_) != 0) {
bitField0_ = other.bitField0_;
baseAvatarIdList.copyFrom(other.baseAvatarIdList);
}
return this;
}
@Override
public RogueAvatarInfo mergeFrom(final RogueAvatarInfo other) {
if (other.isEmpty()) {
return this;
}
cachedSize = -1;
if (other.hasBaseAvatarIdList()) {
getMutableBaseAvatarIdList().addAll(other.baseAvatarIdList);
}
return this;
}
@Override
public RogueAvatarInfo clear() {
if (isEmpty()) {
return this;
}
cachedSize = -1;
bitField0_ = 0;
baseAvatarIdList.clear();
return this;
}
@Override
public RogueAvatarInfo clearQuick() {
if (isEmpty()) {
return this;
}
cachedSize = -1;
bitField0_ = 0;
baseAvatarIdList.clear();
return this;
}
@Override
public boolean equals(Object o) {
if (o == this) {
return true;
}
if (!(o instanceof RogueAvatarInfo)) {
return false;
}
RogueAvatarInfo other = (RogueAvatarInfo) o;
return bitField0_ == other.bitField0_
&& (!hasBaseAvatarIdList() || baseAvatarIdList.equals(other.baseAvatarIdList));
}
@Override
public void writeTo(final ProtoSink output) throws IOException {
if ((bitField0_ & 0x00000001) != 0) {
for (int i = 0; i < baseAvatarIdList.length(); i++) {
output.writeRawByte((byte) 64);
output.writeUInt32NoTag(baseAvatarIdList.array()[i]);
}
}
}
@Override
protected int computeSerializedSize() {
int size = 0;
if ((bitField0_ & 0x00000001) != 0) {
size += (1 * baseAvatarIdList.length()) + ProtoSink.computeRepeatedUInt32SizeNoTag(baseAvatarIdList);
}
return size;
}
@Override
@SuppressWarnings("fallthrough")
public RogueAvatarInfo mergeFrom(final ProtoSource input) throws IOException {
// Enabled Fall-Through Optimization (QuickBuffers)
int tag = input.readTag();
while (true) {
switch (tag) {
case 66: {
// baseAvatarIdList [packed=true]
input.readPackedUInt32(baseAvatarIdList, tag);
bitField0_ |= 0x00000001;
tag = input.readTag();
if (tag != 0) {
break;
}
}
case 0: {
return this;
}
default: {
if (!input.skipField(tag)) {
return this;
}
tag = input.readTag();
break;
}
case 64: {
// baseAvatarIdList [packed=false]
tag = input.readRepeatedUInt32(baseAvatarIdList, tag);
bitField0_ |= 0x00000001;
break;
}
}
}
}
@Override
public void writeTo(final JsonSink output) throws IOException {
output.beginObject();
if ((bitField0_ & 0x00000001) != 0) {
output.writeRepeatedUInt32(FieldNames.baseAvatarIdList, baseAvatarIdList);
}
output.endObject();
}
@Override
public RogueAvatarInfo mergeFrom(final JsonSource input) throws IOException {
if (!input.beginObject()) {
return this;
}
while (!input.isAtEnd()) {
switch (input.readFieldHash()) {
case -1212654461:
case 914628490: {
if (input.isAtField(FieldNames.baseAvatarIdList)) {
if (!input.trySkipNullValue()) {
input.readRepeatedUInt32(baseAvatarIdList);
bitField0_ |= 0x00000001;
}
} else {
input.skipUnknownField();
}
break;
}
default: {
input.skipUnknownField();
break;
}
}
}
input.endObject();
return this;
}
@Override
public RogueAvatarInfo clone() {
return new RogueAvatarInfo().copyFrom(this);
}
@Override
public boolean isEmpty() {
return ((bitField0_) == 0);
}
public static RogueAvatarInfo parseFrom(final byte[] data) throws
InvalidProtocolBufferException {
return ProtoMessage.mergeFrom(new RogueAvatarInfo(), data).checkInitialized();
}
public static RogueAvatarInfo parseFrom(final ProtoSource input) throws IOException {
return ProtoMessage.mergeFrom(new RogueAvatarInfo(), input).checkInitialized();
}
public static RogueAvatarInfo parseFrom(final JsonSource input) throws IOException {
return ProtoMessage.mergeFrom(new RogueAvatarInfo(), input).checkInitialized();
}
/**
* @return factory for creating RogueAvatarInfo messages
*/
public static MessageFactory<RogueAvatarInfo> getFactory() {
return RogueAvatarInfoFactory.INSTANCE;
}
private enum RogueAvatarInfoFactory implements MessageFactory<RogueAvatarInfo> {
INSTANCE;
@Override
public RogueAvatarInfo create() {
return RogueAvatarInfo.newInstance();
}
}
/**
* Contains name constants used for serializing JSON
*/
static class FieldNames {
static final FieldName baseAvatarIdList = FieldName.forField("baseAvatarIdList", "base_avatar_id_list");
}
}
}

View File

@@ -28,6 +28,11 @@ public final class RogueCurrentInfoOuterClass {
*/
private final RogueMiracleInfoOuterClass.RogueMiracleInfo rogueMiracleInfo = RogueMiracleInfoOuterClass.RogueMiracleInfo.newInstance();
/**
* <code>optional .RogueAvatarInfo rogue_avatar_info = 9;</code>
*/
private final RogueAvatarInfoOuterClass.RogueAvatarInfo rogueAvatarInfo = RogueAvatarInfoOuterClass.RogueAvatarInfo.newInstance();
/**
* <code>optional .RogueMapInfo room_map = 10;</code>
*/
@@ -168,12 +173,70 @@ public final class RogueCurrentInfoOuterClass {
return this;
}
/**
* <code>optional .RogueAvatarInfo rogue_avatar_info = 9;</code>
* @return whether the rogueAvatarInfo field is set
*/
public boolean hasRogueAvatarInfo() {
return (bitField0_ & 0x00000004) != 0;
}
/**
* <code>optional .RogueAvatarInfo rogue_avatar_info = 9;</code>
* @return this
*/
public RogueCurrentInfo clearRogueAvatarInfo() {
bitField0_ &= ~0x00000004;
rogueAvatarInfo.clear();
return this;
}
/**
* <code>optional .RogueAvatarInfo rogue_avatar_info = 9;</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 #getMutableRogueAvatarInfo()} if you want to modify it.
*
* @return internal storage object for reading
*/
public RogueAvatarInfoOuterClass.RogueAvatarInfo getRogueAvatarInfo() {
return rogueAvatarInfo;
}
/**
* <code>optional .RogueAvatarInfo rogue_avatar_info = 9;</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 RogueAvatarInfoOuterClass.RogueAvatarInfo getMutableRogueAvatarInfo() {
bitField0_ |= 0x00000004;
return rogueAvatarInfo;
}
/**
* <code>optional .RogueAvatarInfo rogue_avatar_info = 9;</code>
* @param value the rogueAvatarInfo to set
* @return this
*/
public RogueCurrentInfo setRogueAvatarInfo(
final RogueAvatarInfoOuterClass.RogueAvatarInfo value) {
bitField0_ |= 0x00000004;
rogueAvatarInfo.copyFrom(value);
return this;
}
/**
* <code>optional .RogueMapInfo room_map = 10;</code>
* @return whether the roomMap field is set
*/
public boolean hasRoomMap() {
return (bitField0_ & 0x00000004) != 0;
return (bitField0_ & 0x00000008) != 0;
}
/**
@@ -181,7 +244,7 @@ public final class RogueCurrentInfoOuterClass {
* @return this
*/
public RogueCurrentInfo clearRoomMap() {
bitField0_ &= ~0x00000004;
bitField0_ &= ~0x00000008;
roomMap.clear();
return this;
}
@@ -210,7 +273,7 @@ public final class RogueCurrentInfoOuterClass {
* @return internal storage object for modifications
*/
public RogueMapInfoOuterClass.RogueMapInfo getMutableRoomMap() {
bitField0_ |= 0x00000004;
bitField0_ |= 0x00000008;
return roomMap;
}
@@ -220,7 +283,7 @@ public final class RogueCurrentInfoOuterClass {
* @return this
*/
public RogueCurrentInfo setRoomMap(final RogueMapInfoOuterClass.RogueMapInfo value) {
bitField0_ |= 0x00000004;
bitField0_ |= 0x00000008;
roomMap.copyFrom(value);
return this;
}
@@ -230,7 +293,7 @@ public final class RogueCurrentInfoOuterClass {
* @return whether the rogueBuffInfo field is set
*/
public boolean hasRogueBuffInfo() {
return (bitField0_ & 0x00000008) != 0;
return (bitField0_ & 0x00000010) != 0;
}
/**
@@ -238,7 +301,7 @@ public final class RogueCurrentInfoOuterClass {
* @return this
*/
public RogueCurrentInfo clearRogueBuffInfo() {
bitField0_ &= ~0x00000008;
bitField0_ &= ~0x00000010;
rogueBuffInfo.clear();
return this;
}
@@ -267,7 +330,7 @@ public final class RogueCurrentInfoOuterClass {
* @return internal storage object for modifications
*/
public RogueBuffInfoOuterClass.RogueBuffInfo getMutableRogueBuffInfo() {
bitField0_ |= 0x00000008;
bitField0_ |= 0x00000010;
return rogueBuffInfo;
}
@@ -277,7 +340,7 @@ public final class RogueCurrentInfoOuterClass {
* @return this
*/
public RogueCurrentInfo setRogueBuffInfo(final RogueBuffInfoOuterClass.RogueBuffInfo value) {
bitField0_ |= 0x00000008;
bitField0_ |= 0x00000010;
rogueBuffInfo.copyFrom(value);
return this;
}
@@ -289,6 +352,7 @@ public final class RogueCurrentInfoOuterClass {
bitField0_ = other.bitField0_;
status = other.status;
rogueMiracleInfo.copyFrom(other.rogueMiracleInfo);
rogueAvatarInfo.copyFrom(other.rogueAvatarInfo);
roomMap.copyFrom(other.roomMap);
rogueBuffInfo.copyFrom(other.rogueBuffInfo);
}
@@ -307,6 +371,9 @@ public final class RogueCurrentInfoOuterClass {
if (other.hasRogueMiracleInfo()) {
getMutableRogueMiracleInfo().mergeFrom(other.rogueMiracleInfo);
}
if (other.hasRogueAvatarInfo()) {
getMutableRogueAvatarInfo().mergeFrom(other.rogueAvatarInfo);
}
if (other.hasRoomMap()) {
getMutableRoomMap().mergeFrom(other.roomMap);
}
@@ -325,6 +392,7 @@ public final class RogueCurrentInfoOuterClass {
bitField0_ = 0;
status = 0;
rogueMiracleInfo.clear();
rogueAvatarInfo.clear();
roomMap.clear();
rogueBuffInfo.clear();
return this;
@@ -338,6 +406,7 @@ public final class RogueCurrentInfoOuterClass {
cachedSize = -1;
bitField0_ = 0;
rogueMiracleInfo.clearQuick();
rogueAvatarInfo.clearQuick();
roomMap.clearQuick();
rogueBuffInfo.clearQuick();
return this;
@@ -355,6 +424,7 @@ public final class RogueCurrentInfoOuterClass {
return bitField0_ == other.bitField0_
&& (!hasStatus() || status == other.status)
&& (!hasRogueMiracleInfo() || rogueMiracleInfo.equals(other.rogueMiracleInfo))
&& (!hasRogueAvatarInfo() || rogueAvatarInfo.equals(other.rogueAvatarInfo))
&& (!hasRoomMap() || roomMap.equals(other.roomMap))
&& (!hasRogueBuffInfo() || rogueBuffInfo.equals(other.rogueBuffInfo));
}
@@ -370,10 +440,14 @@ public final class RogueCurrentInfoOuterClass {
output.writeMessageNoTag(rogueMiracleInfo);
}
if ((bitField0_ & 0x00000004) != 0) {
output.writeRawByte((byte) 74);
output.writeMessageNoTag(rogueAvatarInfo);
}
if ((bitField0_ & 0x00000008) != 0) {
output.writeRawByte((byte) 82);
output.writeMessageNoTag(roomMap);
}
if ((bitField0_ & 0x00000008) != 0) {
if ((bitField0_ & 0x00000010) != 0) {
output.writeRawByte((byte) 114);
output.writeMessageNoTag(rogueBuffInfo);
}
@@ -389,9 +463,12 @@ public final class RogueCurrentInfoOuterClass {
size += 1 + ProtoSink.computeMessageSizeNoTag(rogueMiracleInfo);
}
if ((bitField0_ & 0x00000004) != 0) {
size += 1 + ProtoSink.computeMessageSizeNoTag(roomMap);
size += 1 + ProtoSink.computeMessageSizeNoTag(rogueAvatarInfo);
}
if ((bitField0_ & 0x00000008) != 0) {
size += 1 + ProtoSink.computeMessageSizeNoTag(roomMap);
}
if ((bitField0_ & 0x00000010) != 0) {
size += 1 + ProtoSink.computeMessageSizeNoTag(rogueBuffInfo);
}
return size;
@@ -421,6 +498,15 @@ public final class RogueCurrentInfoOuterClass {
input.readMessage(rogueMiracleInfo);
bitField0_ |= 0x00000002;
tag = input.readTag();
if (tag != 74) {
break;
}
}
case 74: {
// rogueAvatarInfo
input.readMessage(rogueAvatarInfo);
bitField0_ |= 0x00000004;
tag = input.readTag();
if (tag != 82) {
break;
}
@@ -428,7 +514,7 @@ public final class RogueCurrentInfoOuterClass {
case 82: {
// roomMap
input.readMessage(roomMap);
bitField0_ |= 0x00000004;
bitField0_ |= 0x00000008;
tag = input.readTag();
if (tag != 114) {
break;
@@ -437,7 +523,7 @@ public final class RogueCurrentInfoOuterClass {
case 114: {
// rogueBuffInfo
input.readMessage(rogueBuffInfo);
bitField0_ |= 0x00000008;
bitField0_ |= 0x00000010;
tag = input.readTag();
if (tag != 0) {
break;
@@ -467,9 +553,12 @@ public final class RogueCurrentInfoOuterClass {
output.writeMessage(FieldNames.rogueMiracleInfo, rogueMiracleInfo);
}
if ((bitField0_ & 0x00000004) != 0) {
output.writeMessage(FieldNames.roomMap, roomMap);
output.writeMessage(FieldNames.rogueAvatarInfo, rogueAvatarInfo);
}
if ((bitField0_ & 0x00000008) != 0) {
output.writeMessage(FieldNames.roomMap, roomMap);
}
if ((bitField0_ & 0x00000010) != 0) {
output.writeMessage(FieldNames.rogueBuffInfo, rogueBuffInfo);
}
output.endObject();
@@ -510,12 +599,24 @@ public final class RogueCurrentInfoOuterClass {
}
break;
}
case -1966631135:
case 667955439: {
if (input.isAtField(FieldNames.rogueAvatarInfo)) {
if (!input.trySkipNullValue()) {
input.readMessage(rogueAvatarInfo);
bitField0_ |= 0x00000004;
}
} else {
input.skipUnknownField();
}
break;
}
case 1379875457:
case -172986376: {
if (input.isAtField(FieldNames.roomMap)) {
if (!input.trySkipNullValue()) {
input.readMessage(roomMap);
bitField0_ |= 0x00000004;
bitField0_ |= 0x00000008;
}
} else {
input.skipUnknownField();
@@ -527,7 +628,7 @@ public final class RogueCurrentInfoOuterClass {
if (input.isAtField(FieldNames.rogueBuffInfo)) {
if (!input.trySkipNullValue()) {
input.readMessage(rogueBuffInfo);
bitField0_ |= 0x00000008;
bitField0_ |= 0x00000010;
}
} else {
input.skipUnknownField();
@@ -591,6 +692,8 @@ public final class RogueCurrentInfoOuterClass {
static final FieldName rogueMiracleInfo = FieldName.forField("rogueMiracleInfo", "rogue_miracle_info");
static final FieldName rogueAvatarInfo = FieldName.forField("rogueAvatarInfo", "rogue_avatar_info");
static final FieldName roomMap = FieldName.forField("roomMap", "room_map");
static final FieldName rogueBuffInfo = FieldName.forField("rogueBuffInfo", "rogue_buff_info");

View File

@@ -9,6 +9,7 @@ import emu.lunarcore.game.battle.Battle;
import emu.lunarcore.game.player.Player;
import emu.lunarcore.proto.BattleEndStatusOuterClass.BattleEndStatus;
import emu.lunarcore.proto.BattleStatisticsOuterClass.BattleStatistics;
import emu.lunarcore.proto.RogueAvatarInfoOuterClass.RogueAvatarInfo;
import emu.lunarcore.proto.RogueBuffInfoOuterClass.RogueBuffInfo;
import emu.lunarcore.proto.RogueBuffSourceOuterClass.RogueBuffSource;
import emu.lunarcore.proto.RogueCurrentInfoOuterClass.RogueCurrentInfo;
@@ -235,8 +236,20 @@ public class RogueInstance {
public RogueCurrentInfo toProto() {
var proto = RogueCurrentInfo.newInstance()
.setStatus(this.getStatus())
.setRogueAvatarInfo(this.toAvatarInfoProto())
.setRoomMap(this.toMapInfoProto())
.setRogueBuffInfo(this.toBuffInfoProto());
.setRogueBuffInfo(this.toBuffInfoProto())
.setRogueMiracleInfo(this.toMiracleInfoProto());
return proto;
}
public RogueAvatarInfo toAvatarInfoProto() {
var proto = RogueAvatarInfo.newInstance();
for (int id : this.getBaseAvatarIds()) {
proto.addBaseAvatarIdList(id);
}
return proto;
}