From 293df4bdaea9eb51721fcaa1f81baada0b195b2c Mon Sep 17 00:00:00 2001 From: Melledy <121644117+Melledy@users.noreply.github.com> Date: Fri, 27 Oct 2023 22:36:39 -0700 Subject: [PATCH] Implement giving rogue talent points --- .../proto/RogueCurrencyInfoOuterClass.java | 500 ++++++++++++++++++ .../lunarcore/proto/RogueInfoOuterClass.java | 211 ++++++-- .../lunarcore/game/inventory/Inventory.java | 8 + .../emu/lunarcore/game/player/Player.java | 5 + .../lunarcore/game/rogue/RogueManager.java | 6 +- 5 files changed, 675 insertions(+), 55 deletions(-) create mode 100644 src/generated/main/emu/lunarcore/proto/RogueCurrencyInfoOuterClass.java diff --git a/src/generated/main/emu/lunarcore/proto/RogueCurrencyInfoOuterClass.java b/src/generated/main/emu/lunarcore/proto/RogueCurrencyInfoOuterClass.java new file mode 100644 index 0000000..885ff7b --- /dev/null +++ b/src/generated/main/emu/lunarcore/proto/RogueCurrencyInfoOuterClass.java @@ -0,0 +1,500 @@ +// 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 RogueCurrencyInfoOuterClass { + /** + * Protobuf type {@code RogueCurrencyInfo} + */ + public static final class RogueCurrencyInfo extends ProtoMessage implements Cloneable { + private static final long serialVersionUID = 0L; + + /** + * optional uint32 ALLDDMKKICK = 1; + */ + private int aLLDDMKKICK; + + /** + * optional uint32 DOMMGENHGKE = 4; + */ + private int dOMMGENHGKE; + + /** + * optional uint32 KMAGFHIIALA = 10; + */ + private int kMAGFHIIALA; + + /** + * optional uint32 rogue_talent_points = 14; + */ + private int rogueTalentPoints; + + private RogueCurrencyInfo() { + } + + /** + * @return a new empty instance of {@code RogueCurrencyInfo} + */ + public static RogueCurrencyInfo newInstance() { + return new RogueCurrencyInfo(); + } + + /** + * optional uint32 ALLDDMKKICK = 1; + * @return whether the aLLDDMKKICK field is set + */ + public boolean hasALLDDMKKICK() { + return (bitField0_ & 0x00000001) != 0; + } + + /** + * optional uint32 ALLDDMKKICK = 1; + * @return this + */ + public RogueCurrencyInfo clearALLDDMKKICK() { + bitField0_ &= ~0x00000001; + aLLDDMKKICK = 0; + return this; + } + + /** + * optional uint32 ALLDDMKKICK = 1; + * @return the aLLDDMKKICK + */ + public int getALLDDMKKICK() { + return aLLDDMKKICK; + } + + /** + * optional uint32 ALLDDMKKICK = 1; + * @param value the aLLDDMKKICK to set + * @return this + */ + public RogueCurrencyInfo setALLDDMKKICK(final int value) { + bitField0_ |= 0x00000001; + aLLDDMKKICK = value; + return this; + } + + /** + * optional uint32 DOMMGENHGKE = 4; + * @return whether the dOMMGENHGKE field is set + */ + public boolean hasDOMMGENHGKE() { + return (bitField0_ & 0x00000002) != 0; + } + + /** + * optional uint32 DOMMGENHGKE = 4; + * @return this + */ + public RogueCurrencyInfo clearDOMMGENHGKE() { + bitField0_ &= ~0x00000002; + dOMMGENHGKE = 0; + return this; + } + + /** + * optional uint32 DOMMGENHGKE = 4; + * @return the dOMMGENHGKE + */ + public int getDOMMGENHGKE() { + return dOMMGENHGKE; + } + + /** + * optional uint32 DOMMGENHGKE = 4; + * @param value the dOMMGENHGKE to set + * @return this + */ + public RogueCurrencyInfo setDOMMGENHGKE(final int value) { + bitField0_ |= 0x00000002; + dOMMGENHGKE = value; + return this; + } + + /** + * optional uint32 KMAGFHIIALA = 10; + * @return whether the kMAGFHIIALA field is set + */ + public boolean hasKMAGFHIIALA() { + return (bitField0_ & 0x00000004) != 0; + } + + /** + * optional uint32 KMAGFHIIALA = 10; + * @return this + */ + public RogueCurrencyInfo clearKMAGFHIIALA() { + bitField0_ &= ~0x00000004; + kMAGFHIIALA = 0; + return this; + } + + /** + * optional uint32 KMAGFHIIALA = 10; + * @return the kMAGFHIIALA + */ + public int getKMAGFHIIALA() { + return kMAGFHIIALA; + } + + /** + * optional uint32 KMAGFHIIALA = 10; + * @param value the kMAGFHIIALA to set + * @return this + */ + public RogueCurrencyInfo setKMAGFHIIALA(final int value) { + bitField0_ |= 0x00000004; + kMAGFHIIALA = value; + return this; + } + + /** + * optional uint32 rogue_talent_points = 14; + * @return whether the rogueTalentPoints field is set + */ + public boolean hasRogueTalentPoints() { + return (bitField0_ & 0x00000008) != 0; + } + + /** + * optional uint32 rogue_talent_points = 14; + * @return this + */ + public RogueCurrencyInfo clearRogueTalentPoints() { + bitField0_ &= ~0x00000008; + rogueTalentPoints = 0; + return this; + } + + /** + * optional uint32 rogue_talent_points = 14; + * @return the rogueTalentPoints + */ + public int getRogueTalentPoints() { + return rogueTalentPoints; + } + + /** + * optional uint32 rogue_talent_points = 14; + * @param value the rogueTalentPoints to set + * @return this + */ + public RogueCurrencyInfo setRogueTalentPoints(final int value) { + bitField0_ |= 0x00000008; + rogueTalentPoints = value; + return this; + } + + @Override + public RogueCurrencyInfo copyFrom(final RogueCurrencyInfo other) { + cachedSize = other.cachedSize; + if ((bitField0_ | other.bitField0_) != 0) { + bitField0_ = other.bitField0_; + aLLDDMKKICK = other.aLLDDMKKICK; + dOMMGENHGKE = other.dOMMGENHGKE; + kMAGFHIIALA = other.kMAGFHIIALA; + rogueTalentPoints = other.rogueTalentPoints; + } + return this; + } + + @Override + public RogueCurrencyInfo mergeFrom(final RogueCurrencyInfo other) { + if (other.isEmpty()) { + return this; + } + cachedSize = -1; + if (other.hasALLDDMKKICK()) { + setALLDDMKKICK(other.aLLDDMKKICK); + } + if (other.hasDOMMGENHGKE()) { + setDOMMGENHGKE(other.dOMMGENHGKE); + } + if (other.hasKMAGFHIIALA()) { + setKMAGFHIIALA(other.kMAGFHIIALA); + } + if (other.hasRogueTalentPoints()) { + setRogueTalentPoints(other.rogueTalentPoints); + } + return this; + } + + @Override + public RogueCurrencyInfo clear() { + if (isEmpty()) { + return this; + } + cachedSize = -1; + bitField0_ = 0; + aLLDDMKKICK = 0; + dOMMGENHGKE = 0; + kMAGFHIIALA = 0; + rogueTalentPoints = 0; + return this; + } + + @Override + public RogueCurrencyInfo 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 RogueCurrencyInfo)) { + return false; + } + RogueCurrencyInfo other = (RogueCurrencyInfo) o; + return bitField0_ == other.bitField0_ + && (!hasALLDDMKKICK() || aLLDDMKKICK == other.aLLDDMKKICK) + && (!hasDOMMGENHGKE() || dOMMGENHGKE == other.dOMMGENHGKE) + && (!hasKMAGFHIIALA() || kMAGFHIIALA == other.kMAGFHIIALA) + && (!hasRogueTalentPoints() || rogueTalentPoints == other.rogueTalentPoints); + } + + @Override + public void writeTo(final ProtoSink output) throws IOException { + if ((bitField0_ & 0x00000001) != 0) { + output.writeRawByte((byte) 8); + output.writeUInt32NoTag(aLLDDMKKICK); + } + if ((bitField0_ & 0x00000002) != 0) { + output.writeRawByte((byte) 32); + output.writeUInt32NoTag(dOMMGENHGKE); + } + if ((bitField0_ & 0x00000004) != 0) { + output.writeRawByte((byte) 80); + output.writeUInt32NoTag(kMAGFHIIALA); + } + if ((bitField0_ & 0x00000008) != 0) { + output.writeRawByte((byte) 112); + output.writeUInt32NoTag(rogueTalentPoints); + } + } + + @Override + protected int computeSerializedSize() { + int size = 0; + if ((bitField0_ & 0x00000001) != 0) { + size += 1 + ProtoSink.computeUInt32SizeNoTag(aLLDDMKKICK); + } + if ((bitField0_ & 0x00000002) != 0) { + size += 1 + ProtoSink.computeUInt32SizeNoTag(dOMMGENHGKE); + } + if ((bitField0_ & 0x00000004) != 0) { + size += 1 + ProtoSink.computeUInt32SizeNoTag(kMAGFHIIALA); + } + if ((bitField0_ & 0x00000008) != 0) { + size += 1 + ProtoSink.computeUInt32SizeNoTag(rogueTalentPoints); + } + return size; + } + + @Override + @SuppressWarnings("fallthrough") + public RogueCurrencyInfo mergeFrom(final ProtoSource input) throws IOException { + // Enabled Fall-Through Optimization (QuickBuffers) + int tag = input.readTag(); + while (true) { + switch (tag) { + case 8: { + // aLLDDMKKICK + aLLDDMKKICK = input.readUInt32(); + bitField0_ |= 0x00000001; + tag = input.readTag(); + if (tag != 32) { + break; + } + } + case 32: { + // dOMMGENHGKE + dOMMGENHGKE = input.readUInt32(); + bitField0_ |= 0x00000002; + tag = input.readTag(); + if (tag != 80) { + break; + } + } + case 80: { + // kMAGFHIIALA + kMAGFHIIALA = input.readUInt32(); + bitField0_ |= 0x00000004; + tag = input.readTag(); + if (tag != 112) { + break; + } + } + case 112: { + // rogueTalentPoints + rogueTalentPoints = input.readUInt32(); + bitField0_ |= 0x00000008; + 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.aLLDDMKKICK, aLLDDMKKICK); + } + if ((bitField0_ & 0x00000002) != 0) { + output.writeUInt32(FieldNames.dOMMGENHGKE, dOMMGENHGKE); + } + if ((bitField0_ & 0x00000004) != 0) { + output.writeUInt32(FieldNames.kMAGFHIIALA, kMAGFHIIALA); + } + if ((bitField0_ & 0x00000008) != 0) { + output.writeUInt32(FieldNames.rogueTalentPoints, rogueTalentPoints); + } + output.endObject(); + } + + @Override + public RogueCurrencyInfo mergeFrom(final JsonSource input) throws IOException { + if (!input.beginObject()) { + return this; + } + while (!input.isAtEnd()) { + switch (input.readFieldHash()) { + case -2066689563: { + if (input.isAtField(FieldNames.aLLDDMKKICK)) { + if (!input.trySkipNullValue()) { + aLLDDMKKICK = input.readUInt32(); + bitField0_ |= 0x00000001; + } + } else { + input.skipUnknownField(); + } + break; + } + case -323022850: { + if (input.isAtField(FieldNames.dOMMGENHGKE)) { + if (!input.trySkipNullValue()) { + dOMMGENHGKE = input.readUInt32(); + bitField0_ |= 0x00000002; + } + } else { + input.skipUnknownField(); + } + break; + } + case -2082273588: { + if (input.isAtField(FieldNames.kMAGFHIIALA)) { + if (!input.trySkipNullValue()) { + kMAGFHIIALA = input.readUInt32(); + bitField0_ |= 0x00000004; + } + } else { + input.skipUnknownField(); + } + break; + } + case -569543703: + case -9301519: { + if (input.isAtField(FieldNames.rogueTalentPoints)) { + if (!input.trySkipNullValue()) { + rogueTalentPoints = input.readUInt32(); + bitField0_ |= 0x00000008; + } + } else { + input.skipUnknownField(); + } + break; + } + default: { + input.skipUnknownField(); + break; + } + } + } + input.endObject(); + return this; + } + + @Override + public RogueCurrencyInfo clone() { + return new RogueCurrencyInfo().copyFrom(this); + } + + @Override + public boolean isEmpty() { + return ((bitField0_) == 0); + } + + public static RogueCurrencyInfo parseFrom(final byte[] data) throws + InvalidProtocolBufferException { + return ProtoMessage.mergeFrom(new RogueCurrencyInfo(), data).checkInitialized(); + } + + public static RogueCurrencyInfo parseFrom(final ProtoSource input) throws IOException { + return ProtoMessage.mergeFrom(new RogueCurrencyInfo(), input).checkInitialized(); + } + + public static RogueCurrencyInfo parseFrom(final JsonSource input) throws IOException { + return ProtoMessage.mergeFrom(new RogueCurrencyInfo(), input).checkInitialized(); + } + + /** + * @return factory for creating RogueCurrencyInfo messages + */ + public static MessageFactory getFactory() { + return RogueCurrencyInfoFactory.INSTANCE; + } + + private enum RogueCurrencyInfoFactory implements MessageFactory { + INSTANCE; + + @Override + public RogueCurrencyInfo create() { + return RogueCurrencyInfo.newInstance(); + } + } + + /** + * Contains name constants used for serializing JSON + */ + static class FieldNames { + static final FieldName aLLDDMKKICK = FieldName.forField("ALLDDMKKICK"); + + static final FieldName dOMMGENHGKE = FieldName.forField("DOMMGENHGKE"); + + static final FieldName kMAGFHIIALA = FieldName.forField("KMAGFHIIALA"); + + static final FieldName rogueTalentPoints = FieldName.forField("rogueTalentPoints", "rogue_talent_points"); + } + } +} diff --git a/src/generated/main/emu/lunarcore/proto/RogueInfoOuterClass.java b/src/generated/main/emu/lunarcore/proto/RogueInfoOuterClass.java index 76fca53..2f47029 100644 --- a/src/generated/main/emu/lunarcore/proto/RogueInfoOuterClass.java +++ b/src/generated/main/emu/lunarcore/proto/RogueInfoOuterClass.java @@ -55,6 +55,11 @@ public final class RogueInfoOuterClass { */ private int status; + /** + * optional .RogueCurrencyInfo rogue_currency_info = 5; + */ + private final RogueCurrencyInfoOuterClass.RogueCurrencyInfo rogueCurrencyInfo = RogueCurrencyInfoOuterClass.RogueCurrencyInfo.newInstance(); + /** * optional .RogueCurrentInfo rogue_progress = 83; */ @@ -379,12 +384,70 @@ public final class RogueInfoOuterClass { return this; } + /** + * optional .RogueCurrencyInfo rogue_currency_info = 5; + * @return whether the rogueCurrencyInfo field is set + */ + public boolean hasRogueCurrencyInfo() { + return (bitField0_ & 0x00000080) != 0; + } + + /** + * optional .RogueCurrencyInfo rogue_currency_info = 5; + * @return this + */ + public RogueInfo clearRogueCurrencyInfo() { + bitField0_ &= ~0x00000080; + rogueCurrencyInfo.clear(); + return this; + } + + /** + * optional .RogueCurrencyInfo rogue_currency_info = 5; + * + * 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 #getMutableRogueCurrencyInfo()} if you want to modify it. + * + * @return internal storage object for reading + */ + public RogueCurrencyInfoOuterClass.RogueCurrencyInfo getRogueCurrencyInfo() { + return rogueCurrencyInfo; + } + + /** + * optional .RogueCurrencyInfo rogue_currency_info = 5; + * + * 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 RogueCurrencyInfoOuterClass.RogueCurrencyInfo getMutableRogueCurrencyInfo() { + bitField0_ |= 0x00000080; + return rogueCurrencyInfo; + } + + /** + * optional .RogueCurrencyInfo rogue_currency_info = 5; + * @param value the rogueCurrencyInfo to set + * @return this + */ + public RogueInfo setRogueCurrencyInfo( + final RogueCurrencyInfoOuterClass.RogueCurrencyInfo value) { + bitField0_ |= 0x00000080; + rogueCurrencyInfo.copyFrom(value); + return this; + } + /** * optional .RogueCurrentInfo rogue_progress = 83; * @return whether the rogueProgress field is set */ public boolean hasRogueProgress() { - return (bitField0_ & 0x00000080) != 0; + return (bitField0_ & 0x00000100) != 0; } /** @@ -392,7 +455,7 @@ public final class RogueInfoOuterClass { * @return this */ public RogueInfo clearRogueProgress() { - bitField0_ &= ~0x00000080; + bitField0_ &= ~0x00000100; rogueProgress.clear(); return this; } @@ -421,7 +484,7 @@ public final class RogueInfoOuterClass { * @return internal storage object for modifications */ public RogueCurrentInfoOuterClass.RogueCurrentInfo getMutableRogueProgress() { - bitField0_ |= 0x00000080; + bitField0_ |= 0x00000100; return rogueProgress; } @@ -431,7 +494,7 @@ public final class RogueInfoOuterClass { * @return this */ public RogueInfo setRogueProgress(final RogueCurrentInfoOuterClass.RogueCurrentInfo value) { - bitField0_ |= 0x00000080; + bitField0_ |= 0x00000100; rogueProgress.copyFrom(value); return this; } @@ -441,7 +504,7 @@ public final class RogueInfoOuterClass { * @return whether the rogueData field is set */ public boolean hasRogueData() { - return (bitField0_ & 0x00000100) != 0; + return (bitField0_ & 0x00000200) != 0; } /** @@ -449,7 +512,7 @@ public final class RogueInfoOuterClass { * @return this */ public RogueInfo clearRogueData() { - bitField0_ &= ~0x00000100; + bitField0_ &= ~0x00000200; rogueData.clear(); return this; } @@ -478,7 +541,7 @@ public final class RogueInfoOuterClass { * @return internal storage object for modifications */ public RogueInfoDataOuterClass.RogueInfoData getMutableRogueData() { - bitField0_ |= 0x00000100; + bitField0_ |= 0x00000200; return rogueData; } @@ -488,7 +551,7 @@ public final class RogueInfoOuterClass { * @return this */ public RogueInfo setRogueData(final RogueInfoDataOuterClass.RogueInfoData value) { - bitField0_ |= 0x00000100; + bitField0_ |= 0x00000200; rogueData.copyFrom(value); return this; } @@ -498,7 +561,7 @@ public final class RogueInfoOuterClass { * @return whether the roomMap field is set */ public boolean hasRoomMap() { - return (bitField0_ & 0x00000200) != 0; + return (bitField0_ & 0x00000400) != 0; } /** @@ -506,7 +569,7 @@ public final class RogueInfoOuterClass { * @return this */ public RogueInfo clearRoomMap() { - bitField0_ &= ~0x00000200; + bitField0_ &= ~0x00000400; roomMap.clear(); return this; } @@ -535,7 +598,7 @@ public final class RogueInfoOuterClass { * @return internal storage object for modifications */ public RogueMapInfoOuterClass.RogueMapInfo getMutableRoomMap() { - bitField0_ |= 0x00000200; + bitField0_ |= 0x00000400; return roomMap; } @@ -545,7 +608,7 @@ public final class RogueInfoOuterClass { * @return this */ public RogueInfo setRoomMap(final RogueMapInfoOuterClass.RogueMapInfo value) { - bitField0_ |= 0x00000200; + bitField0_ |= 0x00000400; roomMap.copyFrom(value); return this; } @@ -555,7 +618,7 @@ public final class RogueInfoOuterClass { * @return whether the rogueScoreInfo field is set */ public boolean hasRogueScoreInfo() { - return (bitField0_ & 0x00000400) != 0; + return (bitField0_ & 0x00000800) != 0; } /** @@ -563,7 +626,7 @@ public final class RogueInfoOuterClass { * @return this */ public RogueInfo clearRogueScoreInfo() { - bitField0_ &= ~0x00000400; + bitField0_ &= ~0x00000800; rogueScoreInfo.clear(); return this; } @@ -592,7 +655,7 @@ public final class RogueInfoOuterClass { * @return internal storage object for modifications */ public RogueScoreRewardInfoOuterClass.RogueScoreRewardInfo getMutableRogueScoreInfo() { - bitField0_ |= 0x00000400; + bitField0_ |= 0x00000800; return rogueScoreInfo; } @@ -603,7 +666,7 @@ public final class RogueInfoOuterClass { */ public RogueInfo setRogueScoreInfo( final RogueScoreRewardInfoOuterClass.RogueScoreRewardInfo value) { - bitField0_ |= 0x00000400; + bitField0_ |= 0x00000800; rogueScoreInfo.copyFrom(value); return this; } @@ -613,7 +676,7 @@ public final class RogueInfoOuterClass { * @return whether the baseAvatarIdList field is set */ public boolean hasBaseAvatarIdList() { - return (bitField0_ & 0x00000800) != 0; + return (bitField0_ & 0x00001000) != 0; } /** @@ -621,7 +684,7 @@ public final class RogueInfoOuterClass { * @return this */ public RogueInfo clearBaseAvatarIdList() { - bitField0_ &= ~0x00000800; + bitField0_ &= ~0x00001000; baseAvatarIdList.clear(); return this; } @@ -650,7 +713,7 @@ public final class RogueInfoOuterClass { * @return internal storage object for modifications */ public RepeatedInt getMutableBaseAvatarIdList() { - bitField0_ |= 0x00000800; + bitField0_ |= 0x00001000; return baseAvatarIdList; } @@ -660,7 +723,7 @@ public final class RogueInfoOuterClass { * @return this */ public RogueInfo addBaseAvatarIdList(final int value) { - bitField0_ |= 0x00000800; + bitField0_ |= 0x00001000; baseAvatarIdList.add(value); return this; } @@ -671,7 +734,7 @@ public final class RogueInfoOuterClass { * @return this */ public RogueInfo addAllBaseAvatarIdList(final int... values) { - bitField0_ |= 0x00000800; + bitField0_ |= 0x00001000; baseAvatarIdList.addAll(values); return this; } @@ -681,7 +744,7 @@ public final class RogueInfoOuterClass { * @return whether the rogueAreaList field is set */ public boolean hasRogueAreaList() { - return (bitField0_ & 0x00001000) != 0; + return (bitField0_ & 0x00002000) != 0; } /** @@ -689,7 +752,7 @@ public final class RogueInfoOuterClass { * @return this */ public RogueInfo clearRogueAreaList() { - bitField0_ &= ~0x00001000; + bitField0_ &= ~0x00002000; rogueAreaList.clear(); return this; } @@ -718,7 +781,7 @@ public final class RogueInfoOuterClass { * @return internal storage object for modifications */ public RepeatedMessage getMutableRogueAreaList() { - bitField0_ |= 0x00001000; + bitField0_ |= 0x00002000; return rogueAreaList; } @@ -728,7 +791,7 @@ public final class RogueInfoOuterClass { * @return this */ public RogueInfo addRogueAreaList(final RogueAreaOuterClass.RogueArea value) { - bitField0_ |= 0x00001000; + bitField0_ |= 0x00002000; rogueAreaList.add(value); return this; } @@ -739,7 +802,7 @@ public final class RogueInfoOuterClass { * @return this */ public RogueInfo addAllRogueAreaList(final RogueAreaOuterClass.RogueArea... values) { - bitField0_ |= 0x00001000; + bitField0_ |= 0x00002000; rogueAreaList.addAll(values); return this; } @@ -756,6 +819,7 @@ public final class RogueInfoOuterClass { talentPoints = other.talentPoints; hDBPIDMBJOH = other.hDBPIDMBJOH; status = other.status; + rogueCurrencyInfo.copyFrom(other.rogueCurrencyInfo); rogueProgress.copyFrom(other.rogueProgress); rogueData.copyFrom(other.rogueData); roomMap.copyFrom(other.roomMap); @@ -793,6 +857,9 @@ public final class RogueInfoOuterClass { if (other.hasStatus()) { setStatusValue(other.status); } + if (other.hasRogueCurrencyInfo()) { + getMutableRogueCurrencyInfo().mergeFrom(other.rogueCurrencyInfo); + } if (other.hasRogueProgress()) { getMutableRogueProgress().mergeFrom(other.rogueProgress); } @@ -828,6 +895,7 @@ public final class RogueInfoOuterClass { talentPoints = 0; hDBPIDMBJOH = 0; status = 0; + rogueCurrencyInfo.clear(); rogueProgress.clear(); rogueData.clear(); roomMap.clear(); @@ -844,6 +912,7 @@ public final class RogueInfoOuterClass { } cachedSize = -1; bitField0_ = 0; + rogueCurrencyInfo.clearQuick(); rogueProgress.clearQuick(); rogueData.clearQuick(); roomMap.clearQuick(); @@ -870,6 +939,7 @@ public final class RogueInfoOuterClass { && (!hasTalentPoints() || talentPoints == other.talentPoints) && (!hasHDBPIDMBJOH() || hDBPIDMBJOH == other.hDBPIDMBJOH) && (!hasStatus() || status == other.status) + && (!hasRogueCurrencyInfo() || rogueCurrencyInfo.equals(other.rogueCurrencyInfo)) && (!hasRogueProgress() || rogueProgress.equals(other.rogueProgress)) && (!hasRogueData() || rogueData.equals(other.rogueData)) && (!hasRoomMap() || roomMap.equals(other.roomMap)) @@ -909,28 +979,32 @@ public final class RogueInfoOuterClass { output.writeEnumNoTag(status); } if ((bitField0_ & 0x00000080) != 0) { + output.writeRawByte((byte) 42); + output.writeMessageNoTag(rogueCurrencyInfo); + } + if ((bitField0_ & 0x00000100) != 0) { output.writeRawLittleEndian16((short) 1434); output.writeMessageNoTag(rogueProgress); } - if ((bitField0_ & 0x00000100) != 0) { + if ((bitField0_ & 0x00000200) != 0) { output.writeRawLittleEndian16((short) 4226); output.writeMessageNoTag(rogueData); } - if ((bitField0_ & 0x00000200) != 0) { + if ((bitField0_ & 0x00000400) != 0) { output.writeRawLittleEndian16((short) 13810); output.writeMessageNoTag(roomMap); } - if ((bitField0_ & 0x00000400) != 0) { + if ((bitField0_ & 0x00000800) != 0) { output.writeRawLittleEndian16((short) 20898); output.writeMessageNoTag(rogueScoreInfo); } - if ((bitField0_ & 0x00000800) != 0) { + if ((bitField0_ & 0x00001000) != 0) { for (int i = 0; i < baseAvatarIdList.length(); i++) { output.writeRawByte((byte) 96); output.writeUInt32NoTag(baseAvatarIdList.array()[i]); } } - if ((bitField0_ & 0x00001000) != 0) { + if ((bitField0_ & 0x00002000) != 0) { for (int i = 0; i < rogueAreaList.length(); i++) { output.writeRawLittleEndian16((short) 3834); output.writeMessageNoTag(rogueAreaList.get(i)); @@ -963,21 +1037,24 @@ public final class RogueInfoOuterClass { size += 1 + ProtoSink.computeEnumSizeNoTag(status); } if ((bitField0_ & 0x00000080) != 0) { - size += 2 + ProtoSink.computeMessageSizeNoTag(rogueProgress); + size += 1 + ProtoSink.computeMessageSizeNoTag(rogueCurrencyInfo); } if ((bitField0_ & 0x00000100) != 0) { - size += 2 + ProtoSink.computeMessageSizeNoTag(rogueData); + size += 2 + ProtoSink.computeMessageSizeNoTag(rogueProgress); } if ((bitField0_ & 0x00000200) != 0) { - size += 2 + ProtoSink.computeMessageSizeNoTag(roomMap); + size += 2 + ProtoSink.computeMessageSizeNoTag(rogueData); } if ((bitField0_ & 0x00000400) != 0) { - size += 2 + ProtoSink.computeMessageSizeNoTag(rogueScoreInfo); + size += 2 + ProtoSink.computeMessageSizeNoTag(roomMap); } if ((bitField0_ & 0x00000800) != 0) { - size += (1 * baseAvatarIdList.length()) + ProtoSink.computeRepeatedUInt32SizeNoTag(baseAvatarIdList); + size += 2 + ProtoSink.computeMessageSizeNoTag(rogueScoreInfo); } if ((bitField0_ & 0x00001000) != 0) { + size += (1 * baseAvatarIdList.length()) + ProtoSink.computeRepeatedUInt32SizeNoTag(baseAvatarIdList); + } + if ((bitField0_ & 0x00002000) != 0) { size += (2 * rogueAreaList.length()) + ProtoSink.computeRepeatedMessageSizeNoTag(rogueAreaList); } return size; @@ -1052,6 +1129,15 @@ public final class RogueInfoOuterClass { bitField0_ |= 0x00000040; } tag = input.readTag(); + if (tag != 42) { + break; + } + } + case 42: { + // rogueCurrencyInfo + input.readMessage(rogueCurrencyInfo); + bitField0_ |= 0x00000080; + tag = input.readTag(); if (tag != 666) { break; } @@ -1059,7 +1145,7 @@ public final class RogueInfoOuterClass { case 666: { // rogueProgress input.readMessage(rogueProgress); - bitField0_ |= 0x00000080; + bitField0_ |= 0x00000100; tag = input.readTag(); if (tag != 2050) { break; @@ -1068,7 +1154,7 @@ public final class RogueInfoOuterClass { case 2050: { // rogueData input.readMessage(rogueData); - bitField0_ |= 0x00000100; + bitField0_ |= 0x00000200; tag = input.readTag(); if (tag != 6898) { break; @@ -1077,7 +1163,7 @@ public final class RogueInfoOuterClass { case 6898: { // roomMap input.readMessage(roomMap); - bitField0_ |= 0x00000200; + bitField0_ |= 0x00000400; tag = input.readTag(); if (tag != 10402) { break; @@ -1086,7 +1172,7 @@ public final class RogueInfoOuterClass { case 10402: { // rogueScoreInfo input.readMessage(rogueScoreInfo); - bitField0_ |= 0x00000400; + bitField0_ |= 0x00000800; tag = input.readTag(); if (tag != 98) { break; @@ -1095,7 +1181,7 @@ public final class RogueInfoOuterClass { case 98: { // baseAvatarIdList [packed=true] input.readPackedUInt32(baseAvatarIdList, tag); - bitField0_ |= 0x00000800; + bitField0_ |= 0x00001000; tag = input.readTag(); if (tag != 1914) { break; @@ -1104,7 +1190,7 @@ public final class RogueInfoOuterClass { case 1914: { // rogueAreaList tag = input.readRepeatedMessage(rogueAreaList, tag); - bitField0_ |= 0x00001000; + bitField0_ |= 0x00002000; if (tag != 0) { break; } @@ -1122,7 +1208,7 @@ public final class RogueInfoOuterClass { case 96: { // baseAvatarIdList [packed=false] tag = input.readRepeatedUInt32(baseAvatarIdList, tag); - bitField0_ |= 0x00000800; + bitField0_ |= 0x00001000; break; } } @@ -1154,21 +1240,24 @@ public final class RogueInfoOuterClass { output.writeEnum(FieldNames.status, status, RogueStatusOuterClass.RogueStatus.converter()); } if ((bitField0_ & 0x00000080) != 0) { - output.writeMessage(FieldNames.rogueProgress, rogueProgress); + output.writeMessage(FieldNames.rogueCurrencyInfo, rogueCurrencyInfo); } if ((bitField0_ & 0x00000100) != 0) { - output.writeMessage(FieldNames.rogueData, rogueData); + output.writeMessage(FieldNames.rogueProgress, rogueProgress); } if ((bitField0_ & 0x00000200) != 0) { - output.writeMessage(FieldNames.roomMap, roomMap); + output.writeMessage(FieldNames.rogueData, rogueData); } if ((bitField0_ & 0x00000400) != 0) { - output.writeMessage(FieldNames.rogueScoreInfo, rogueScoreInfo); + output.writeMessage(FieldNames.roomMap, roomMap); } if ((bitField0_ & 0x00000800) != 0) { - output.writeRepeatedUInt32(FieldNames.baseAvatarIdList, baseAvatarIdList); + output.writeMessage(FieldNames.rogueScoreInfo, rogueScoreInfo); } if ((bitField0_ & 0x00001000) != 0) { + output.writeRepeatedUInt32(FieldNames.baseAvatarIdList, baseAvatarIdList); + } + if ((bitField0_ & 0x00002000) != 0) { output.writeRepeatedMessage(FieldNames.rogueAreaList, rogueAreaList); } output.endObject(); @@ -1267,12 +1356,24 @@ public final class RogueInfoOuterClass { } break; } + case 2062299993: + case -468018569: { + if (input.isAtField(FieldNames.rogueCurrencyInfo)) { + if (!input.trySkipNullValue()) { + input.readMessage(rogueCurrencyInfo); + bitField0_ |= 0x00000080; + } + } else { + input.skipUnknownField(); + } + break; + } case 1629694503: case 1330014962: { if (input.isAtField(FieldNames.rogueProgress)) { if (!input.trySkipNullValue()) { input.readMessage(rogueProgress); - bitField0_ |= 0x00000080; + bitField0_ |= 0x00000100; } } else { input.skipUnknownField(); @@ -1284,7 +1385,7 @@ public final class RogueInfoOuterClass { if (input.isAtField(FieldNames.rogueData)) { if (!input.trySkipNullValue()) { input.readMessage(rogueData); - bitField0_ |= 0x00000100; + bitField0_ |= 0x00000200; } } else { input.skipUnknownField(); @@ -1296,7 +1397,7 @@ public final class RogueInfoOuterClass { if (input.isAtField(FieldNames.roomMap)) { if (!input.trySkipNullValue()) { input.readMessage(roomMap); - bitField0_ |= 0x00000200; + bitField0_ |= 0x00000400; } } else { input.skipUnknownField(); @@ -1308,7 +1409,7 @@ public final class RogueInfoOuterClass { if (input.isAtField(FieldNames.rogueScoreInfo)) { if (!input.trySkipNullValue()) { input.readMessage(rogueScoreInfo); - bitField0_ |= 0x00000400; + bitField0_ |= 0x00000800; } } else { input.skipUnknownField(); @@ -1320,7 +1421,7 @@ public final class RogueInfoOuterClass { if (input.isAtField(FieldNames.baseAvatarIdList)) { if (!input.trySkipNullValue()) { input.readRepeatedUInt32(baseAvatarIdList); - bitField0_ |= 0x00000800; + bitField0_ |= 0x00001000; } } else { input.skipUnknownField(); @@ -1332,7 +1433,7 @@ public final class RogueInfoOuterClass { if (input.isAtField(FieldNames.rogueAreaList)) { if (!input.trySkipNullValue()) { input.readRepeatedMessage(rogueAreaList); - bitField0_ |= 0x00001000; + bitField0_ |= 0x00002000; } } else { input.skipUnknownField(); @@ -1405,6 +1506,8 @@ public final class RogueInfoOuterClass { static final FieldName status = FieldName.forField("status"); + static final FieldName rogueCurrencyInfo = FieldName.forField("rogueCurrencyInfo", "rogue_currency_info"); + static final FieldName rogueProgress = FieldName.forField("rogueProgress", "rogue_progress"); static final FieldName rogueData = FieldName.forField("rogueData", "rogue_data"); diff --git a/src/main/java/emu/lunarcore/game/inventory/Inventory.java b/src/main/java/emu/lunarcore/game/inventory/Inventory.java index ff3d10f..8fb581b 100644 --- a/src/main/java/emu/lunarcore/game/inventory/Inventory.java +++ b/src/main/java/emu/lunarcore/game/inventory/Inventory.java @@ -243,6 +243,9 @@ public class Inventory extends BasePlayerManager { case 22: // Trailblaze EXP getPlayer().addExp(count); break; + case GameConstants.ROGUE_TALENT_POINT_ITEM_ID: // Rogue talent points + getPlayer().addTalentPoints(count); + break; } } @@ -264,6 +267,9 @@ public class Inventory extends BasePlayerManager { if (param.getId() == GameConstants.MATERIAL_COIN_ID) { // Remove credits getPlayer().addSCoin(-param.getCount() * multiplier); + } else if (param.getId() == GameConstants.ROGUE_TALENT_POINT_ITEM_ID) { + // Remove credits + getPlayer().addTalentPoints(-param.getCount() * multiplier); } else { // Remove param items GameItem item = this.getItemByParam(param); @@ -382,6 +388,8 @@ public class Inventory extends BasePlayerManager { if (!verifyScoin(param.getCount() * multiplier)) { return false; } + } else if (param.getId() == GameConstants.ROGUE_TALENT_POINT_ITEM_ID) { + return this.getPlayer().getTalentPoints() >= param.getCount() * multiplier; } else { // Check param items GameItem item = this.getItemByParam(param); diff --git a/src/main/java/emu/lunarcore/game/player/Player.java b/src/main/java/emu/lunarcore/game/player/Player.java index ef02681..5dec1f0 100644 --- a/src/main/java/emu/lunarcore/game/player/Player.java +++ b/src/main/java/emu/lunarcore/game/player/Player.java @@ -69,6 +69,7 @@ public class Player { private int scoin; // Credits private int hcoin; // Jade private int mcoin; // Crystals + private int talentPoints; private transient Battle battle; private transient Scene scene; @@ -299,6 +300,10 @@ public class Player { this.mcoin += amount; this.sendPacket(new PacketPlayerSyncScNotify(this)); } + + public void addTalentPoints(int amount) { + this.talentPoints += amount; + } public void addStamina(int amount) { this.stamina = Math.min(this.stamina + amount, GameConstants.MAX_STAMINA); diff --git a/src/main/java/emu/lunarcore/game/rogue/RogueManager.java b/src/main/java/emu/lunarcore/game/rogue/RogueManager.java index 4eec8be..eede78b 100644 --- a/src/main/java/emu/lunarcore/game/rogue/RogueManager.java +++ b/src/main/java/emu/lunarcore/game/rogue/RogueManager.java @@ -117,14 +117,18 @@ public class RogueManager extends BasePlayerManager { var data = RogueInfoData.newInstance() .setRogueScoreInfo(score) .setRogueSeasonInfo(season); - + var proto = RogueInfo.newInstance() .setRogueScoreInfo(score) .setRogueData(data) + .setTalentPoints(getPlayer().getTalentPoints()) .setSeasonId(seasonId) .setBeginTime(beginTime) .setEndTime(endTime); + proto.getMutableRogueCurrencyInfo() + .setRogueTalentPoints(getPlayer().getTalentPoints()); + // Rogue data RogueInstance curRogue = this.getPlayer().getRogueInstance(); if (curRogue != null) {