57 Commits
Author SHA1 Message Date
Melledy 088c2df58a Bump server version to 1.3.0 2026-01-02 21:31:47 -08:00
Melledy f949f3b619 Fix exception when giving all materials 2026-01-02 03:32:50 -08:00
Melledy 9f8fd4464b Update data versions 2026-01-01 03:00:49 -08:00
Melledy 3aaa5bb334 Update data versions 2025-12-26 01:54:56 -08:00
Melledy 297255a316 Implement setting disc music as main theme 2025-12-25 18:06:35 -08:00
Melledy fba1dfccd6 Fix return to ascension 2025-12-25 17:29:43 -08:00
Melledy 957d3a9ac3 Remove activities that are not in the activity module 2025-12-24 21:16:12 -08:00
Melledy 9db0f6aabb Implement login reward activity 2025-12-24 21:12:31 -08:00
Melledy b086851b95 Implement Summit Show 2025-12-24 00:30:51 -08:00
Melledy 9df83c5205 Implement new weekly quests 2025-12-24 00:03:05 -08:00
Melledy c2ebff92c9 Clean up some stuff and update enums 2025-12-23 20:56:00 -08:00
Hiro 92c7dbcbc5 update to support the latest game version 2025-12-24 02:45:06 +02:00
Melledy a8e358d2d6 Update server to support latest version 2025-12-22 20:37:45 -08:00
Melledy 450b0cca30 Remove broken honor titles when logging in 2025-12-22 19:36:54 -08:00
Melledy c75da823e0 Implement sending friends energy 2025-12-22 18:46:21 -08:00
Melledy b4948212ce Update score boss control id properly 2025-12-22 17:54:36 -08:00
Melledy 53839b48ca Implement !autobuild command
The `!autobuild` (or `!ab`) command allows you to build a record without needing to add every id. Missing trekkers/discs/potentials/melodies will be auto selected by the server.

Usage:
`!autobuild [character/disc/potential/melody ids...] lv[target record level] s[target record score]`

Examples:
`!autobuild s99999` = Creates a record with a random main trekker with the max score.
`!autobuild 103 lv30` = Creates a record with this trekker at record rank 30.
`!autobuild 155 132 107 s25000` = Creates a record with these trekkers with a record score of about 25000.
`!autobuild 103 510301 510302 510303 510304 lv20` = Creates a record with this trekker and these potentials at record rank 20.

Notes:
- Target level overrides target score. So a command of `!autobuild lv30 s1000` would have a record rank of 30 and NOT a score of 1000.
- If there is no target level or score, the command will default to a target level of 40.
- You can only add trekkers/discs that you own.
2025-12-20 04:20:34 -08:00
Melledy b5fde4433d Forgot to update something in GameCharacter.java 2025-12-19 01:21:51 -08:00
Melledy 495e76a456 Added command to set a trekker's emblem stats
Usage:
`!e [character id] [slot id - this is between 1 and 3] [attr 1] [attr 2] [attr 3] [attr 4]`

Example:
`!e 141 1 1004 1004 1004 1004` = Sets the first emblem of the character to all +ignis damage.

Notes:
Attribute ids can be found in `CharGemAttrValue.json` in the resources/bin folder.
2025-12-19 01:18:37 -08:00
Melledy 496d012c36 Bump server version to 1.2.0 2025-12-17 21:45:08 -08:00
Melledy c5d6d707f8 Add support for loading the handbook in different languages 2025-12-17 21:34:22 -08:00
Melledy d9b502002c Improve achievement params handling 2025-12-16 00:11:18 -08:00
Melledy 85b08c7593 Fix issues with gacha history
You may need to reset gacha history info in the database
2025-12-15 08:48:55 -08:00
Melledy 4da479a88a Fix gacha 4 star probability rates 2025-12-15 08:39:29 -08:00
Melledy 21467faa7f Fix potential count when giving up a Monolith run 2025-12-15 07:41:08 -08:00
Melledy 72d9cd530d Implement proper melody drops in Monolith 2025-12-15 07:40:03 -08:00
Melledy 26019d639b Implement a couple more Monolith achievements 2025-12-15 07:28:36 -08:00
Melledy ee5d759a98 Add a config option to unlock all story CGs 2025-12-15 07:12:49 -08:00
HongchengQ f439b25f2a Fix null IP handling in ban IP processing
- Continue loop instead of returning for empty IPs
- Prevent single null IP from interrupting entire ban check
2025-12-13 16:12:59 -08:00
HongchengQ 4fb2712a89 Fix Android-CN -1 error 2025-12-13 16:12:26 -08:00
Melledy e5ffb1743a Fix wrong materials used for emblem generation 2025-12-13 16:11:51 -08:00
Melledy 4d14099f11 Fix Menace Arena not saving properly 2025-12-13 01:20:06 -08:00
Melledy 9599877005 Clear current player level ids when settling 2025-12-13 00:49:55 -08:00
Melledy 31e56ae17f Fix potential count when giving up a Monolith run 2025-12-13 00:33:27 -08:00
Melledy ab1f84e8db Fix Ocean of Souls research node 2025-12-13 00:26:19 -08:00
Melledy 588522df88 Fix lucky potential effect in selector 2025-12-13 00:17:18 -08:00
Melledy 660d5a3cf7 Fix emblems for on certain characters 2025-12-13 00:14:29 -08:00
Melledy 1aa2129bba Add platform string for game session 2025-12-13 00:14:07 -08:00
Melledy 968880c320 Show errors properly if emblem creation/reroll fails 2025-12-12 02:06:11 -08:00
Melledy 353d7d97b6 Add nightly link to readme 2025-12-12 01:45:34 -08:00
Melledy c51268bcb8 Rework how story is handled, fixes choices not saving 2025-12-12 01:31:31 -08:00
Melledy 11ea526a35 Fix null pointer error when logging into a new account 2025-12-11 23:25:49 -08:00
Melledy 5668ba9cea Update data versions 2025-12-11 23:24:45 -08:00
阁主 fef25496fa Implement !status command 2025-12-11 21:21:01 -08:00
Melledy 5d9ff6e1af Fix !build command potential count and not saving to the database 2025-12-10 20:38:05 -08:00
HongchengQ 3a6387c2bd Implement ban functionality
- Added ban module
- Added Ban and Unban commands, supporting banning and unbanning players through various command parameters.
- Added timestamp formatting method in Utils utility class for displaying ban expiration times
- Introduced PlayerErrorCode enum defining various error codes including ErrBan
- Added dual ban checking for both IP and user during player login
- Optimized login failure responses to provide specific error reasons and parameters
2025-12-10 16:33:41 -08:00
Melledy 6483e8a5a7 Implement weekly journey ticket limit 2025-12-09 23:49:48 -08:00
Melledy 5d797fb9d3 Fix weekly boss entry tickets resetting every day 2025-12-09 23:28:24 -08:00
Melledy 0ad87dd751 Improve random potential selector generator 2025-12-09 22:37:04 -08:00
Melledy 5b7adc8fa4 Separate custom data defs into their own category 2025-12-09 21:57:35 -08:00
Melledy 6f832bcdfe Fix potential count calculations when creating a record 2025-12-09 21:33:34 -08:00
Melledy bf5fe3912f Fix discs surging to max crescendo regardless of materials used 2025-12-09 21:28:53 -08:00
Melledy c5f339c8be Implement new event 2025-12-08 22:28:47 -08:00
Melledy 80a181680b Fix !giveall not saving characters/discs properties to the database 2025-12-08 20:12:19 -08:00
Melledy f582444679 Update data versions 2025-12-08 20:07:26 -08:00
Melledy 2af715477e Implement random npc event chance in Monoliths 2025-12-08 18:01:44 -08:00
Melledy 9d77005da6 Implement more Monolith research nodes 2025-12-08 14:47:59 -08:00
175 changed files with 18703 additions and 1039 deletions

No files matched your search

+5 -3
View File
@@ -4,6 +4,8 @@ A work in progress game server emulator for a certain anime game. Most features
For any extra support, questions, or discussions, check out our [Discord](https://discord.gg/cskCWBqdJk).
Latest nightly compiled server jar: [Nightly](https://nightly.link/Melledy/Nebula/workflows/gradle/main/Nebula-Nightly.zip)
### Notable features
- Basic profile features
- Character system
@@ -14,12 +16,12 @@ For any extra support, questions, or discussions, check out our [Discord](https:
- Daily quests
- Battle pass
- Gacha
- Friend system (sending energy not implemented)
- Friend system
- Shop (only in-game currency supported)
- Commissions
- Heartlink
- Achievements
- Monoliths (some research nodes not working/research quests not implemented)
- Monoliths (research quests not implemented)
- Bounty Trials
- Menance Arena
- Proving Grounds
@@ -44,7 +46,7 @@ You may need to change the data version when switching regions. The `customDataV
* [MongoDB 4.0+](https://www.mongodb.com/try/download/community)
### Compiling the server
1. Open your system terminal, and compile the server with `./gradlew jar`
1. Open your system terminal, and compile the server with `./gradlew jar` (If you downloaded the server jar from the Nightly link, you can skip this step)
2. Create a folder named `resources` in your server directory
3. Download the `bin`, `language` folders from a repository with [datamined game data](https://github.com/Hiro420/StellaSoraData) and place them into your resources folder.
4. Run the server with `java -jar Nebula.jar` from your system terminal. This server comes with a built-in internal MongoDB server for its database, so no Mongodb installation is required. However, it is highly recommended to install Mongodb anyway.
+1 -1
View File
@@ -29,7 +29,7 @@ java {
}
}
version = '1.1.3'
version = '1.3.0'
var shouldGenerateProto = System.getenv("GENERATE_PROTO") == "true"
System.out.println(shouldGenerateProto ? "Generating proto files" : "Skipping proto generation")
@@ -90,6 +90,16 @@ public final class ActivityDetail {
*/
private final Public.ActivityBuildConvert bdConvert = Public.ActivityBuildConvert.newInstance();
/**
* <code>optional .ActivityTrekkerVersus TrekkerVersus = 15;</code>
*/
private final Public.ActivityTrekkerVersus trekkerVersus = Public.ActivityTrekkerVersus.newInstance();
/**
* <code>optional .ActivityStoryChapter StoryChapter = 16;</code>
*/
private final Public.ActivityStoryChapter storyChapter = Public.ActivityStoryChapter.newInstance();
/**
* <code>optional bytes NextPackage = 2047;</code>
*/
@@ -883,12 +893,126 @@ public final class ActivityDetail {
return this;
}
/**
* <code>optional .ActivityTrekkerVersus TrekkerVersus = 15;</code>
* @return whether the trekkerVersus field is set
*/
public boolean hasTrekkerVersus() {
return (bitField0_ & 0x00004000) != 0;
}
/**
* <code>optional .ActivityTrekkerVersus TrekkerVersus = 15;</code>
* @return this
*/
public ActivityMsg clearTrekkerVersus() {
bitField0_ &= ~0x00004000;
trekkerVersus.clear();
return this;
}
/**
* <code>optional .ActivityTrekkerVersus TrekkerVersus = 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 #getMutableTrekkerVersus()} if you want to modify it.
*
* @return internal storage object for reading
*/
public Public.ActivityTrekkerVersus getTrekkerVersus() {
return trekkerVersus;
}
/**
* <code>optional .ActivityTrekkerVersus TrekkerVersus = 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 Public.ActivityTrekkerVersus getMutableTrekkerVersus() {
bitField0_ |= 0x00004000;
return trekkerVersus;
}
/**
* <code>optional .ActivityTrekkerVersus TrekkerVersus = 15;</code>
* @param value the trekkerVersus to set
* @return this
*/
public ActivityMsg setTrekkerVersus(final Public.ActivityTrekkerVersus value) {
bitField0_ |= 0x00004000;
trekkerVersus.copyFrom(value);
return this;
}
/**
* <code>optional .ActivityStoryChapter StoryChapter = 16;</code>
* @return whether the storyChapter field is set
*/
public boolean hasStoryChapter() {
return (bitField0_ & 0x00008000) != 0;
}
/**
* <code>optional .ActivityStoryChapter StoryChapter = 16;</code>
* @return this
*/
public ActivityMsg clearStoryChapter() {
bitField0_ &= ~0x00008000;
storyChapter.clear();
return this;
}
/**
* <code>optional .ActivityStoryChapter StoryChapter = 16;</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 #getMutableStoryChapter()} if you want to modify it.
*
* @return internal storage object for reading
*/
public Public.ActivityStoryChapter getStoryChapter() {
return storyChapter;
}
/**
* <code>optional .ActivityStoryChapter StoryChapter = 16;</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 Public.ActivityStoryChapter getMutableStoryChapter() {
bitField0_ |= 0x00008000;
return storyChapter;
}
/**
* <code>optional .ActivityStoryChapter StoryChapter = 16;</code>
* @param value the storyChapter to set
* @return this
*/
public ActivityMsg setStoryChapter(final Public.ActivityStoryChapter value) {
bitField0_ |= 0x00008000;
storyChapter.copyFrom(value);
return this;
}
/**
* <code>optional bytes NextPackage = 2047;</code>
* @return whether the nextPackage field is set
*/
public boolean hasNextPackage() {
return (bitField0_ & 0x00004000) != 0;
return (bitField0_ & 0x00010000) != 0;
}
/**
@@ -896,7 +1020,7 @@ public final class ActivityDetail {
* @return this
*/
public ActivityMsg clearNextPackage() {
bitField0_ &= ~0x00004000;
bitField0_ &= ~0x00010000;
nextPackage.clear();
return this;
}
@@ -925,7 +1049,7 @@ public final class ActivityDetail {
* @return internal storage object for modifications
*/
public RepeatedByte getMutableNextPackage() {
bitField0_ |= 0x00004000;
bitField0_ |= 0x00010000;
return nextPackage;
}
@@ -935,7 +1059,7 @@ public final class ActivityDetail {
* @return this
*/
public ActivityMsg addNextPackage(final byte value) {
bitField0_ |= 0x00004000;
bitField0_ |= 0x00010000;
nextPackage.add(value);
return this;
}
@@ -946,7 +1070,7 @@ public final class ActivityDetail {
* @return this
*/
public ActivityMsg addAllNextPackage(final byte... values) {
bitField0_ |= 0x00004000;
bitField0_ |= 0x00010000;
nextPackage.addAll(values);
return this;
}
@@ -957,7 +1081,7 @@ public final class ActivityDetail {
* @return this
*/
public ActivityMsg setNextPackage(final byte... values) {
bitField0_ |= 0x00004000;
bitField0_ |= 0x00010000;
nextPackage.copyFrom(values);
return this;
}
@@ -981,6 +1105,8 @@ public final class ActivityDetail {
task.copyFrom(other.task);
shop.copyFrom(other.shop);
bdConvert.copyFrom(other.bdConvert);
trekkerVersus.copyFrom(other.trekkerVersus);
storyChapter.copyFrom(other.storyChapter);
nextPackage.copyFrom(other.nextPackage);
}
return this;
@@ -1034,6 +1160,12 @@ public final class ActivityDetail {
if (other.hasBdConvert()) {
getMutableBdConvert().mergeFrom(other.bdConvert);
}
if (other.hasTrekkerVersus()) {
getMutableTrekkerVersus().mergeFrom(other.trekkerVersus);
}
if (other.hasStoryChapter()) {
getMutableStoryChapter().mergeFrom(other.storyChapter);
}
if (other.hasNextPackage()) {
getMutableNextPackage().copyFrom(other.nextPackage);
}
@@ -1061,6 +1193,8 @@ public final class ActivityDetail {
task.clear();
shop.clear();
bdConvert.clear();
trekkerVersus.clear();
storyChapter.clear();
nextPackage.clear();
return this;
}
@@ -1085,6 +1219,8 @@ public final class ActivityDetail {
task.clearQuick();
shop.clearQuick();
bdConvert.clearQuick();
trekkerVersus.clearQuick();
storyChapter.clearQuick();
nextPackage.clear();
return this;
}
@@ -1113,6 +1249,8 @@ public final class ActivityDetail {
&& (!hasTask() || task.equals(other.task))
&& (!hasShop() || shop.equals(other.shop))
&& (!hasBdConvert() || bdConvert.equals(other.bdConvert))
&& (!hasTrekkerVersus() || trekkerVersus.equals(other.trekkerVersus))
&& (!hasStoryChapter() || storyChapter.equals(other.storyChapter))
&& (!hasNextPackage() || nextPackage.equals(other.nextPackage));
}
@@ -1175,6 +1313,14 @@ public final class ActivityDetail {
output.writeMessageNoTag(bdConvert);
}
if ((bitField0_ & 0x00004000) != 0) {
output.writeRawByte((byte) 122);
output.writeMessageNoTag(trekkerVersus);
}
if ((bitField0_ & 0x00008000) != 0) {
output.writeRawLittleEndian16((short) 386);
output.writeMessageNoTag(storyChapter);
}
if ((bitField0_ & 0x00010000) != 0) {
output.writeRawLittleEndian16((short) 32762);
output.writeBytesNoTag(nextPackage);
}
@@ -1226,6 +1372,12 @@ public final class ActivityDetail {
size += 1 + ProtoSink.computeMessageSizeNoTag(bdConvert);
}
if ((bitField0_ & 0x00004000) != 0) {
size += 1 + ProtoSink.computeMessageSizeNoTag(trekkerVersus);
}
if ((bitField0_ & 0x00008000) != 0) {
size += 2 + ProtoSink.computeMessageSizeNoTag(storyChapter);
}
if ((bitField0_ & 0x00010000) != 0) {
size += 2 + ProtoSink.computeBytesSizeNoTag(nextPackage);
}
return size;
@@ -1360,6 +1512,24 @@ public final class ActivityDetail {
input.readMessage(bdConvert);
bitField0_ |= 0x00002000;
tag = input.readTag();
if (tag != 122) {
break;
}
}
case 122: {
// trekkerVersus
input.readMessage(trekkerVersus);
bitField0_ |= 0x00004000;
tag = input.readTag();
if (tag != 130) {
break;
}
}
case 130: {
// storyChapter
input.readMessage(storyChapter);
bitField0_ |= 0x00008000;
tag = input.readTag();
if (tag != 16378) {
break;
}
@@ -1367,7 +1537,7 @@ public final class ActivityDetail {
case 16378: {
// nextPackage
input.readBytes(nextPackage);
bitField0_ |= 0x00004000;
bitField0_ |= 0x00010000;
tag = input.readTag();
if (tag != 0) {
break;
@@ -1433,6 +1603,12 @@ public final class ActivityDetail {
output.writeMessage(FieldNames.bdConvert, bdConvert);
}
if ((bitField0_ & 0x00004000) != 0) {
output.writeMessage(FieldNames.trekkerVersus, trekkerVersus);
}
if ((bitField0_ & 0x00008000) != 0) {
output.writeMessage(FieldNames.storyChapter, storyChapter);
}
if ((bitField0_ & 0x00010000) != 0) {
output.writeBytes(FieldNames.nextPackage, nextPackage);
}
output.endObject();
@@ -1599,11 +1775,33 @@ public final class ActivityDetail {
}
break;
}
case -1534874366: {
if (input.isAtField(FieldNames.trekkerVersus)) {
if (!input.trySkipNullValue()) {
input.readMessage(trekkerVersus);
bitField0_ |= 0x00004000;
}
} else {
input.skipUnknownField();
}
break;
}
case -1858182728: {
if (input.isAtField(FieldNames.storyChapter)) {
if (!input.trySkipNullValue()) {
input.readMessage(storyChapter);
bitField0_ |= 0x00008000;
}
} else {
input.skipUnknownField();
}
break;
}
case -2082324045: {
if (input.isAtField(FieldNames.nextPackage)) {
if (!input.trySkipNullValue()) {
input.readBytes(nextPackage);
bitField0_ |= 0x00004000;
bitField0_ |= 0x00010000;
}
} else {
input.skipUnknownField();
@@ -1690,6 +1888,10 @@ public final class ActivityDetail {
static final FieldName bdConvert = FieldName.forField("BdConvert");
static final FieldName trekkerVersus = FieldName.forField("TrekkerVersus");
static final FieldName storyChapter = FieldName.forField("StoryChapter");
static final FieldName nextPackage = FieldName.forField("NextPackage");
}
}
@@ -0,0 +1,543 @@
// Code generated by protocol buffer compiler. Do not edit!
package emu.nebula.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.RepeatedByte;
public final class ActivityStoryApply {
/**
* Protobuf type {@code ActivityStoryApplyReq}
*/
public static final class ActivityStoryApplyReq extends ProtoMessage<ActivityStoryApplyReq> implements Cloneable {
private static final long serialVersionUID = 0L;
/**
* <code>optional uint64 BuildId = 3;</code>
*/
private long buildId;
/**
* <code>optional uint32 ActivityId = 1;</code>
*/
private int activityId;
/**
* <code>optional uint32 StoryId = 2;</code>
*/
private int storyId;
/**
* <code>optional bytes NextPackage = 2047;</code>
*/
private final RepeatedByte nextPackage = RepeatedByte.newEmptyInstance();
private ActivityStoryApplyReq() {
}
/**
* @return a new empty instance of {@code ActivityStoryApplyReq}
*/
public static ActivityStoryApplyReq newInstance() {
return new ActivityStoryApplyReq();
}
/**
* <code>optional uint64 BuildId = 3;</code>
* @return whether the buildId field is set
*/
public boolean hasBuildId() {
return (bitField0_ & 0x00000001) != 0;
}
/**
* <code>optional uint64 BuildId = 3;</code>
* @return this
*/
public ActivityStoryApplyReq clearBuildId() {
bitField0_ &= ~0x00000001;
buildId = 0L;
return this;
}
/**
* <code>optional uint64 BuildId = 3;</code>
* @return the buildId
*/
public long getBuildId() {
return buildId;
}
/**
* <code>optional uint64 BuildId = 3;</code>
* @param value the buildId to set
* @return this
*/
public ActivityStoryApplyReq setBuildId(final long value) {
bitField0_ |= 0x00000001;
buildId = value;
return this;
}
/**
* <code>optional uint32 ActivityId = 1;</code>
* @return whether the activityId field is set
*/
public boolean hasActivityId() {
return (bitField0_ & 0x00000002) != 0;
}
/**
* <code>optional uint32 ActivityId = 1;</code>
* @return this
*/
public ActivityStoryApplyReq clearActivityId() {
bitField0_ &= ~0x00000002;
activityId = 0;
return this;
}
/**
* <code>optional uint32 ActivityId = 1;</code>
* @return the activityId
*/
public int getActivityId() {
return activityId;
}
/**
* <code>optional uint32 ActivityId = 1;</code>
* @param value the activityId to set
* @return this
*/
public ActivityStoryApplyReq setActivityId(final int value) {
bitField0_ |= 0x00000002;
activityId = value;
return this;
}
/**
* <code>optional uint32 StoryId = 2;</code>
* @return whether the storyId field is set
*/
public boolean hasStoryId() {
return (bitField0_ & 0x00000004) != 0;
}
/**
* <code>optional uint32 StoryId = 2;</code>
* @return this
*/
public ActivityStoryApplyReq clearStoryId() {
bitField0_ &= ~0x00000004;
storyId = 0;
return this;
}
/**
* <code>optional uint32 StoryId = 2;</code>
* @return the storyId
*/
public int getStoryId() {
return storyId;
}
/**
* <code>optional uint32 StoryId = 2;</code>
* @param value the storyId to set
* @return this
*/
public ActivityStoryApplyReq setStoryId(final int value) {
bitField0_ |= 0x00000004;
storyId = value;
return this;
}
/**
* <code>optional bytes NextPackage = 2047;</code>
* @return whether the nextPackage field is set
*/
public boolean hasNextPackage() {
return (bitField0_ & 0x00000008) != 0;
}
/**
* <code>optional bytes NextPackage = 2047;</code>
* @return this
*/
public ActivityStoryApplyReq clearNextPackage() {
bitField0_ &= ~0x00000008;
nextPackage.clear();
return this;
}
/**
* <code>optional bytes NextPackage = 2047;</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 #getMutableNextPackage()} if you want to modify it.
*
* @return internal storage object for reading
*/
public RepeatedByte getNextPackage() {
return nextPackage;
}
/**
* <code>optional bytes NextPackage = 2047;</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 RepeatedByte getMutableNextPackage() {
bitField0_ |= 0x00000008;
return nextPackage;
}
/**
* <code>optional bytes NextPackage = 2047;</code>
* @param value the nextPackage to add
* @return this
*/
public ActivityStoryApplyReq addNextPackage(final byte value) {
bitField0_ |= 0x00000008;
nextPackage.add(value);
return this;
}
/**
* <code>optional bytes NextPackage = 2047;</code>
* @param values the nextPackage to add
* @return this
*/
public ActivityStoryApplyReq addAllNextPackage(final byte... values) {
bitField0_ |= 0x00000008;
nextPackage.addAll(values);
return this;
}
/**
* <code>optional bytes NextPackage = 2047;</code>
* @param values the nextPackage to set
* @return this
*/
public ActivityStoryApplyReq setNextPackage(final byte... values) {
bitField0_ |= 0x00000008;
nextPackage.copyFrom(values);
return this;
}
@Override
public ActivityStoryApplyReq copyFrom(final ActivityStoryApplyReq other) {
cachedSize = other.cachedSize;
if ((bitField0_ | other.bitField0_) != 0) {
bitField0_ = other.bitField0_;
buildId = other.buildId;
activityId = other.activityId;
storyId = other.storyId;
nextPackage.copyFrom(other.nextPackage);
}
return this;
}
@Override
public ActivityStoryApplyReq mergeFrom(final ActivityStoryApplyReq other) {
if (other.isEmpty()) {
return this;
}
cachedSize = -1;
if (other.hasBuildId()) {
setBuildId(other.buildId);
}
if (other.hasActivityId()) {
setActivityId(other.activityId);
}
if (other.hasStoryId()) {
setStoryId(other.storyId);
}
if (other.hasNextPackage()) {
getMutableNextPackage().copyFrom(other.nextPackage);
}
return this;
}
@Override
public ActivityStoryApplyReq clear() {
if (isEmpty()) {
return this;
}
cachedSize = -1;
bitField0_ = 0;
buildId = 0L;
activityId = 0;
storyId = 0;
nextPackage.clear();
return this;
}
@Override
public ActivityStoryApplyReq clearQuick() {
if (isEmpty()) {
return this;
}
cachedSize = -1;
bitField0_ = 0;
nextPackage.clear();
return this;
}
@Override
public boolean equals(Object o) {
if (o == this) {
return true;
}
if (!(o instanceof ActivityStoryApplyReq)) {
return false;
}
ActivityStoryApplyReq other = (ActivityStoryApplyReq) o;
return bitField0_ == other.bitField0_
&& (!hasBuildId() || buildId == other.buildId)
&& (!hasActivityId() || activityId == other.activityId)
&& (!hasStoryId() || storyId == other.storyId)
&& (!hasNextPackage() || nextPackage.equals(other.nextPackage));
}
@Override
public void writeTo(final ProtoSink output) throws IOException {
if ((bitField0_ & 0x00000001) != 0) {
output.writeRawByte((byte) 24);
output.writeUInt64NoTag(buildId);
}
if ((bitField0_ & 0x00000002) != 0) {
output.writeRawByte((byte) 8);
output.writeUInt32NoTag(activityId);
}
if ((bitField0_ & 0x00000004) != 0) {
output.writeRawByte((byte) 16);
output.writeUInt32NoTag(storyId);
}
if ((bitField0_ & 0x00000008) != 0) {
output.writeRawLittleEndian16((short) 32762);
output.writeBytesNoTag(nextPackage);
}
}
@Override
protected int computeSerializedSize() {
int size = 0;
if ((bitField0_ & 0x00000001) != 0) {
size += 1 + ProtoSink.computeUInt64SizeNoTag(buildId);
}
if ((bitField0_ & 0x00000002) != 0) {
size += 1 + ProtoSink.computeUInt32SizeNoTag(activityId);
}
if ((bitField0_ & 0x00000004) != 0) {
size += 1 + ProtoSink.computeUInt32SizeNoTag(storyId);
}
if ((bitField0_ & 0x00000008) != 0) {
size += 2 + ProtoSink.computeBytesSizeNoTag(nextPackage);
}
return size;
}
@Override
@SuppressWarnings("fallthrough")
public ActivityStoryApplyReq mergeFrom(final ProtoSource input) throws IOException {
// Enabled Fall-Through Optimization (QuickBuffers)
int tag = input.readTag();
while (true) {
switch (tag) {
case 24: {
// buildId
buildId = input.readUInt64();
bitField0_ |= 0x00000001;
tag = input.readTag();
if (tag != 8) {
break;
}
}
case 8: {
// activityId
activityId = input.readUInt32();
bitField0_ |= 0x00000002;
tag = input.readTag();
if (tag != 16) {
break;
}
}
case 16: {
// storyId
storyId = input.readUInt32();
bitField0_ |= 0x00000004;
tag = input.readTag();
if (tag != 16378) {
break;
}
}
case 16378: {
// nextPackage
input.readBytes(nextPackage);
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.writeUInt64(FieldNames.buildId, buildId);
}
if ((bitField0_ & 0x00000002) != 0) {
output.writeUInt32(FieldNames.activityId, activityId);
}
if ((bitField0_ & 0x00000004) != 0) {
output.writeUInt32(FieldNames.storyId, storyId);
}
if ((bitField0_ & 0x00000008) != 0) {
output.writeBytes(FieldNames.nextPackage, nextPackage);
}
output.endObject();
}
@Override
public ActivityStoryApplyReq mergeFrom(final JsonSource input) throws IOException {
if (!input.beginObject()) {
return this;
}
while (!input.isAtEnd()) {
switch (input.readFieldHash()) {
case 1895597065: {
if (input.isAtField(FieldNames.buildId)) {
if (!input.trySkipNullValue()) {
buildId = input.readUInt64();
bitField0_ |= 0x00000001;
}
} else {
input.skipUnknownField();
}
break;
}
case -252882774: {
if (input.isAtField(FieldNames.activityId)) {
if (!input.trySkipNullValue()) {
activityId = input.readUInt32();
bitField0_ |= 0x00000002;
}
} else {
input.skipUnknownField();
}
break;
}
case -219598640: {
if (input.isAtField(FieldNames.storyId)) {
if (!input.trySkipNullValue()) {
storyId = input.readUInt32();
bitField0_ |= 0x00000004;
}
} else {
input.skipUnknownField();
}
break;
}
case -2082324045: {
if (input.isAtField(FieldNames.nextPackage)) {
if (!input.trySkipNullValue()) {
input.readBytes(nextPackage);
bitField0_ |= 0x00000008;
}
} else {
input.skipUnknownField();
}
break;
}
default: {
input.skipUnknownField();
break;
}
}
}
input.endObject();
return this;
}
@Override
public ActivityStoryApplyReq clone() {
return new ActivityStoryApplyReq().copyFrom(this);
}
@Override
public boolean isEmpty() {
return ((bitField0_) == 0);
}
public static ActivityStoryApplyReq parseFrom(final byte[] data) throws
InvalidProtocolBufferException {
return ProtoMessage.mergeFrom(new ActivityStoryApplyReq(), data).checkInitialized();
}
public static ActivityStoryApplyReq parseFrom(final ProtoSource input) throws IOException {
return ProtoMessage.mergeFrom(new ActivityStoryApplyReq(), input).checkInitialized();
}
public static ActivityStoryApplyReq parseFrom(final JsonSource input) throws IOException {
return ProtoMessage.mergeFrom(new ActivityStoryApplyReq(), input).checkInitialized();
}
/**
* @return factory for creating ActivityStoryApplyReq messages
*/
public static MessageFactory<ActivityStoryApplyReq> getFactory() {
return ActivityStoryApplyReqFactory.INSTANCE;
}
private enum ActivityStoryApplyReqFactory implements MessageFactory<ActivityStoryApplyReq> {
INSTANCE;
@Override
public ActivityStoryApplyReq create() {
return ActivityStoryApplyReq.newInstance();
}
}
/**
* Contains name constants used for serializing JSON
*/
static class FieldNames {
static final FieldName buildId = FieldName.forField("BuildId");
static final FieldName activityId = FieldName.forField("ActivityId");
static final FieldName storyId = FieldName.forField("StoryId");
static final FieldName nextPackage = FieldName.forField("NextPackage");
}
}
}
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,666 @@
// Code generated by protocol buffer compiler. Do not edit!
package emu.nebula.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.RepeatedByte;
import us.hebi.quickbuf.RepeatedInt;
public final class ActivityTrekkerVersusApply {
/**
* Protobuf type {@code ActivityTrekkerVersusApplyReq}
*/
public static final class ActivityTrekkerVersusApplyReq extends ProtoMessage<ActivityTrekkerVersusApplyReq> implements Cloneable {
private static final long serialVersionUID = 0L;
/**
* <code>optional uint64 BuildId = 3;</code>
*/
private long buildId;
/**
* <code>optional uint32 ActivityId = 1;</code>
*/
private int activityId;
/**
* <code>optional uint32 LevelId = 2;</code>
*/
private int levelId;
/**
* <code>optional bytes NextPackage = 2047;</code>
*/
private final RepeatedByte nextPackage = RepeatedByte.newEmptyInstance();
/**
* <code>repeated uint32 AffixIds = 4;</code>
*/
private final RepeatedInt affixIds = RepeatedInt.newEmptyInstance();
private ActivityTrekkerVersusApplyReq() {
}
/**
* @return a new empty instance of {@code ActivityTrekkerVersusApplyReq}
*/
public static ActivityTrekkerVersusApplyReq newInstance() {
return new ActivityTrekkerVersusApplyReq();
}
/**
* <code>optional uint64 BuildId = 3;</code>
* @return whether the buildId field is set
*/
public boolean hasBuildId() {
return (bitField0_ & 0x00000001) != 0;
}
/**
* <code>optional uint64 BuildId = 3;</code>
* @return this
*/
public ActivityTrekkerVersusApplyReq clearBuildId() {
bitField0_ &= ~0x00000001;
buildId = 0L;
return this;
}
/**
* <code>optional uint64 BuildId = 3;</code>
* @return the buildId
*/
public long getBuildId() {
return buildId;
}
/**
* <code>optional uint64 BuildId = 3;</code>
* @param value the buildId to set
* @return this
*/
public ActivityTrekkerVersusApplyReq setBuildId(final long value) {
bitField0_ |= 0x00000001;
buildId = value;
return this;
}
/**
* <code>optional uint32 ActivityId = 1;</code>
* @return whether the activityId field is set
*/
public boolean hasActivityId() {
return (bitField0_ & 0x00000002) != 0;
}
/**
* <code>optional uint32 ActivityId = 1;</code>
* @return this
*/
public ActivityTrekkerVersusApplyReq clearActivityId() {
bitField0_ &= ~0x00000002;
activityId = 0;
return this;
}
/**
* <code>optional uint32 ActivityId = 1;</code>
* @return the activityId
*/
public int getActivityId() {
return activityId;
}
/**
* <code>optional uint32 ActivityId = 1;</code>
* @param value the activityId to set
* @return this
*/
public ActivityTrekkerVersusApplyReq setActivityId(final int value) {
bitField0_ |= 0x00000002;
activityId = value;
return this;
}
/**
* <code>optional uint32 LevelId = 2;</code>
* @return whether the levelId field is set
*/
public boolean hasLevelId() {
return (bitField0_ & 0x00000004) != 0;
}
/**
* <code>optional uint32 LevelId = 2;</code>
* @return this
*/
public ActivityTrekkerVersusApplyReq clearLevelId() {
bitField0_ &= ~0x00000004;
levelId = 0;
return this;
}
/**
* <code>optional uint32 LevelId = 2;</code>
* @return the levelId
*/
public int getLevelId() {
return levelId;
}
/**
* <code>optional uint32 LevelId = 2;</code>
* @param value the levelId to set
* @return this
*/
public ActivityTrekkerVersusApplyReq setLevelId(final int value) {
bitField0_ |= 0x00000004;
levelId = value;
return this;
}
/**
* <code>optional bytes NextPackage = 2047;</code>
* @return whether the nextPackage field is set
*/
public boolean hasNextPackage() {
return (bitField0_ & 0x00000008) != 0;
}
/**
* <code>optional bytes NextPackage = 2047;</code>
* @return this
*/
public ActivityTrekkerVersusApplyReq clearNextPackage() {
bitField0_ &= ~0x00000008;
nextPackage.clear();
return this;
}
/**
* <code>optional bytes NextPackage = 2047;</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 #getMutableNextPackage()} if you want to modify it.
*
* @return internal storage object for reading
*/
public RepeatedByte getNextPackage() {
return nextPackage;
}
/**
* <code>optional bytes NextPackage = 2047;</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 RepeatedByte getMutableNextPackage() {
bitField0_ |= 0x00000008;
return nextPackage;
}
/**
* <code>optional bytes NextPackage = 2047;</code>
* @param value the nextPackage to add
* @return this
*/
public ActivityTrekkerVersusApplyReq addNextPackage(final byte value) {
bitField0_ |= 0x00000008;
nextPackage.add(value);
return this;
}
/**
* <code>optional bytes NextPackage = 2047;</code>
* @param values the nextPackage to add
* @return this
*/
public ActivityTrekkerVersusApplyReq addAllNextPackage(final byte... values) {
bitField0_ |= 0x00000008;
nextPackage.addAll(values);
return this;
}
/**
* <code>optional bytes NextPackage = 2047;</code>
* @param values the nextPackage to set
* @return this
*/
public ActivityTrekkerVersusApplyReq setNextPackage(final byte... values) {
bitField0_ |= 0x00000008;
nextPackage.copyFrom(values);
return this;
}
/**
* <code>repeated uint32 AffixIds = 4;</code>
* @return whether the affixIds field is set
*/
public boolean hasAffixIds() {
return (bitField0_ & 0x00000010) != 0;
}
/**
* <code>repeated uint32 AffixIds = 4;</code>
* @return this
*/
public ActivityTrekkerVersusApplyReq clearAffixIds() {
bitField0_ &= ~0x00000010;
affixIds.clear();
return this;
}
/**
* <code>repeated uint32 AffixIds = 4;</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 #getMutableAffixIds()} if you want to modify it.
*
* @return internal storage object for reading
*/
public RepeatedInt getAffixIds() {
return affixIds;
}
/**
* <code>repeated uint32 AffixIds = 4;</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 getMutableAffixIds() {
bitField0_ |= 0x00000010;
return affixIds;
}
/**
* <code>repeated uint32 AffixIds = 4;</code>
* @param value the affixIds to add
* @return this
*/
public ActivityTrekkerVersusApplyReq addAffixIds(final int value) {
bitField0_ |= 0x00000010;
affixIds.add(value);
return this;
}
/**
* <code>repeated uint32 AffixIds = 4;</code>
* @param values the affixIds to add
* @return this
*/
public ActivityTrekkerVersusApplyReq addAllAffixIds(final int... values) {
bitField0_ |= 0x00000010;
affixIds.addAll(values);
return this;
}
@Override
public ActivityTrekkerVersusApplyReq copyFrom(final ActivityTrekkerVersusApplyReq other) {
cachedSize = other.cachedSize;
if ((bitField0_ | other.bitField0_) != 0) {
bitField0_ = other.bitField0_;
buildId = other.buildId;
activityId = other.activityId;
levelId = other.levelId;
nextPackage.copyFrom(other.nextPackage);
affixIds.copyFrom(other.affixIds);
}
return this;
}
@Override
public ActivityTrekkerVersusApplyReq mergeFrom(final ActivityTrekkerVersusApplyReq other) {
if (other.isEmpty()) {
return this;
}
cachedSize = -1;
if (other.hasBuildId()) {
setBuildId(other.buildId);
}
if (other.hasActivityId()) {
setActivityId(other.activityId);
}
if (other.hasLevelId()) {
setLevelId(other.levelId);
}
if (other.hasNextPackage()) {
getMutableNextPackage().copyFrom(other.nextPackage);
}
if (other.hasAffixIds()) {
getMutableAffixIds().addAll(other.affixIds);
}
return this;
}
@Override
public ActivityTrekkerVersusApplyReq clear() {
if (isEmpty()) {
return this;
}
cachedSize = -1;
bitField0_ = 0;
buildId = 0L;
activityId = 0;
levelId = 0;
nextPackage.clear();
affixIds.clear();
return this;
}
@Override
public ActivityTrekkerVersusApplyReq clearQuick() {
if (isEmpty()) {
return this;
}
cachedSize = -1;
bitField0_ = 0;
nextPackage.clear();
affixIds.clear();
return this;
}
@Override
public boolean equals(Object o) {
if (o == this) {
return true;
}
if (!(o instanceof ActivityTrekkerVersusApplyReq)) {
return false;
}
ActivityTrekkerVersusApplyReq other = (ActivityTrekkerVersusApplyReq) o;
return bitField0_ == other.bitField0_
&& (!hasBuildId() || buildId == other.buildId)
&& (!hasActivityId() || activityId == other.activityId)
&& (!hasLevelId() || levelId == other.levelId)
&& (!hasNextPackage() || nextPackage.equals(other.nextPackage))
&& (!hasAffixIds() || affixIds.equals(other.affixIds));
}
@Override
public void writeTo(final ProtoSink output) throws IOException {
if ((bitField0_ & 0x00000001) != 0) {
output.writeRawByte((byte) 24);
output.writeUInt64NoTag(buildId);
}
if ((bitField0_ & 0x00000002) != 0) {
output.writeRawByte((byte) 8);
output.writeUInt32NoTag(activityId);
}
if ((bitField0_ & 0x00000004) != 0) {
output.writeRawByte((byte) 16);
output.writeUInt32NoTag(levelId);
}
if ((bitField0_ & 0x00000008) != 0) {
output.writeRawLittleEndian16((short) 32762);
output.writeBytesNoTag(nextPackage);
}
if ((bitField0_ & 0x00000010) != 0) {
for (int i = 0; i < affixIds.length(); i++) {
output.writeRawByte((byte) 32);
output.writeUInt32NoTag(affixIds.array()[i]);
}
}
}
@Override
protected int computeSerializedSize() {
int size = 0;
if ((bitField0_ & 0x00000001) != 0) {
size += 1 + ProtoSink.computeUInt64SizeNoTag(buildId);
}
if ((bitField0_ & 0x00000002) != 0) {
size += 1 + ProtoSink.computeUInt32SizeNoTag(activityId);
}
if ((bitField0_ & 0x00000004) != 0) {
size += 1 + ProtoSink.computeUInt32SizeNoTag(levelId);
}
if ((bitField0_ & 0x00000008) != 0) {
size += 2 + ProtoSink.computeBytesSizeNoTag(nextPackage);
}
if ((bitField0_ & 0x00000010) != 0) {
size += (1 * affixIds.length()) + ProtoSink.computeRepeatedUInt32SizeNoTag(affixIds);
}
return size;
}
@Override
@SuppressWarnings("fallthrough")
public ActivityTrekkerVersusApplyReq mergeFrom(final ProtoSource input) throws IOException {
// Enabled Fall-Through Optimization (QuickBuffers)
int tag = input.readTag();
while (true) {
switch (tag) {
case 24: {
// buildId
buildId = input.readUInt64();
bitField0_ |= 0x00000001;
tag = input.readTag();
if (tag != 8) {
break;
}
}
case 8: {
// activityId
activityId = input.readUInt32();
bitField0_ |= 0x00000002;
tag = input.readTag();
if (tag != 16) {
break;
}
}
case 16: {
// levelId
levelId = input.readUInt32();
bitField0_ |= 0x00000004;
tag = input.readTag();
if (tag != 16378) {
break;
}
}
case 16378: {
// nextPackage
input.readBytes(nextPackage);
bitField0_ |= 0x00000008;
tag = input.readTag();
if (tag != 34) {
break;
}
}
case 34: {
// affixIds [packed=true]
input.readPackedUInt32(affixIds, tag);
bitField0_ |= 0x00000010;
tag = input.readTag();
if (tag != 0) {
break;
}
}
case 0: {
return this;
}
default: {
if (!input.skipField(tag)) {
return this;
}
tag = input.readTag();
break;
}
case 32: {
// affixIds [packed=false]
tag = input.readRepeatedUInt32(affixIds, tag);
bitField0_ |= 0x00000010;
break;
}
}
}
}
@Override
public void writeTo(final JsonSink output) throws IOException {
output.beginObject();
if ((bitField0_ & 0x00000001) != 0) {
output.writeUInt64(FieldNames.buildId, buildId);
}
if ((bitField0_ & 0x00000002) != 0) {
output.writeUInt32(FieldNames.activityId, activityId);
}
if ((bitField0_ & 0x00000004) != 0) {
output.writeUInt32(FieldNames.levelId, levelId);
}
if ((bitField0_ & 0x00000008) != 0) {
output.writeBytes(FieldNames.nextPackage, nextPackage);
}
if ((bitField0_ & 0x00000010) != 0) {
output.writeRepeatedUInt32(FieldNames.affixIds, affixIds);
}
output.endObject();
}
@Override
public ActivityTrekkerVersusApplyReq mergeFrom(final JsonSource input) throws IOException {
if (!input.beginObject()) {
return this;
}
while (!input.isAtEnd()) {
switch (input.readFieldHash()) {
case 1895597065: {
if (input.isAtField(FieldNames.buildId)) {
if (!input.trySkipNullValue()) {
buildId = input.readUInt64();
bitField0_ |= 0x00000001;
}
} else {
input.skipUnknownField();
}
break;
}
case -252882774: {
if (input.isAtField(FieldNames.activityId)) {
if (!input.trySkipNullValue()) {
activityId = input.readUInt32();
bitField0_ |= 0x00000002;
}
} else {
input.skipUnknownField();
}
break;
}
case 1734437791: {
if (input.isAtField(FieldNames.levelId)) {
if (!input.trySkipNullValue()) {
levelId = input.readUInt32();
bitField0_ |= 0x00000004;
}
} else {
input.skipUnknownField();
}
break;
}
case -2082324045: {
if (input.isAtField(FieldNames.nextPackage)) {
if (!input.trySkipNullValue()) {
input.readBytes(nextPackage);
bitField0_ |= 0x00000008;
}
} else {
input.skipUnknownField();
}
break;
}
case 670408424: {
if (input.isAtField(FieldNames.affixIds)) {
if (!input.trySkipNullValue()) {
input.readRepeatedUInt32(affixIds);
bitField0_ |= 0x00000010;
}
} else {
input.skipUnknownField();
}
break;
}
default: {
input.skipUnknownField();
break;
}
}
}
input.endObject();
return this;
}
@Override
public ActivityTrekkerVersusApplyReq clone() {
return new ActivityTrekkerVersusApplyReq().copyFrom(this);
}
@Override
public boolean isEmpty() {
return ((bitField0_) == 0);
}
public static ActivityTrekkerVersusApplyReq parseFrom(final byte[] data) throws
InvalidProtocolBufferException {
return ProtoMessage.mergeFrom(new ActivityTrekkerVersusApplyReq(), data).checkInitialized();
}
public static ActivityTrekkerVersusApplyReq parseFrom(final ProtoSource input) throws
IOException {
return ProtoMessage.mergeFrom(new ActivityTrekkerVersusApplyReq(), input).checkInitialized();
}
public static ActivityTrekkerVersusApplyReq parseFrom(final JsonSource input) throws
IOException {
return ProtoMessage.mergeFrom(new ActivityTrekkerVersusApplyReq(), input).checkInitialized();
}
/**
* @return factory for creating ActivityTrekkerVersusApplyReq messages
*/
public static MessageFactory<ActivityTrekkerVersusApplyReq> getFactory() {
return ActivityTrekkerVersusApplyReqFactory.INSTANCE;
}
private enum ActivityTrekkerVersusApplyReqFactory implements MessageFactory<ActivityTrekkerVersusApplyReq> {
INSTANCE;
@Override
public ActivityTrekkerVersusApplyReq create() {
return ActivityTrekkerVersusApplyReq.newInstance();
}
}
/**
* Contains name constants used for serializing JSON
*/
static class FieldNames {
static final FieldName buildId = FieldName.forField("BuildId");
static final FieldName activityId = FieldName.forField("ActivityId");
static final FieldName levelId = FieldName.forField("LevelId");
static final FieldName nextPackage = FieldName.forField("NextPackage");
static final FieldName affixIds = FieldName.forField("AffixIds");
}
}
}
@@ -0,0 +1,524 @@
// Code generated by protocol buffer compiler. Do not edit!
package emu.nebula.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.RepeatedByte;
import us.hebi.quickbuf.RepeatedMessage;
public final class ActivityTrekkerVersusRewardReceive {
/**
* Protobuf type {@code ActivityTrekkerVersusRewardReceiveResp}
*/
public static final class ActivityTrekkerVersusRewardReceiveResp extends ProtoMessage<ActivityTrekkerVersusRewardReceiveResp> implements Cloneable {
private static final long serialVersionUID = 0L;
/**
* <code>optional .ChangeInfo Change = 1;</code>
*/
private final Public.ChangeInfo change = Public.ChangeInfo.newInstance();
/**
* <code>optional bytes NextPackage = 2047;</code>
*/
private final RepeatedByte nextPackage = RepeatedByte.newEmptyInstance();
/**
* <code>repeated .ItemTpl AwardItems = 2;</code>
*/
private final RepeatedMessage<Public.ItemTpl> awardItems = RepeatedMessage.newEmptyInstance(Public.ItemTpl.getFactory());
private ActivityTrekkerVersusRewardReceiveResp() {
}
/**
* @return a new empty instance of {@code ActivityTrekkerVersusRewardReceiveResp}
*/
public static ActivityTrekkerVersusRewardReceiveResp newInstance() {
return new ActivityTrekkerVersusRewardReceiveResp();
}
/**
* <code>optional .ChangeInfo Change = 1;</code>
* @return whether the change field is set
*/
public boolean hasChange() {
return (bitField0_ & 0x00000001) != 0;
}
/**
* <code>optional .ChangeInfo Change = 1;</code>
* @return this
*/
public ActivityTrekkerVersusRewardReceiveResp clearChange() {
bitField0_ &= ~0x00000001;
change.clear();
return this;
}
/**
* <code>optional .ChangeInfo Change = 1;</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 #getMutableChange()} if you want to modify it.
*
* @return internal storage object for reading
*/
public Public.ChangeInfo getChange() {
return change;
}
/**
* <code>optional .ChangeInfo Change = 1;</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 Public.ChangeInfo getMutableChange() {
bitField0_ |= 0x00000001;
return change;
}
/**
* <code>optional .ChangeInfo Change = 1;</code>
* @param value the change to set
* @return this
*/
public ActivityTrekkerVersusRewardReceiveResp setChange(final Public.ChangeInfo value) {
bitField0_ |= 0x00000001;
change.copyFrom(value);
return this;
}
/**
* <code>optional bytes NextPackage = 2047;</code>
* @return whether the nextPackage field is set
*/
public boolean hasNextPackage() {
return (bitField0_ & 0x00000002) != 0;
}
/**
* <code>optional bytes NextPackage = 2047;</code>
* @return this
*/
public ActivityTrekkerVersusRewardReceiveResp clearNextPackage() {
bitField0_ &= ~0x00000002;
nextPackage.clear();
return this;
}
/**
* <code>optional bytes NextPackage = 2047;</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 #getMutableNextPackage()} if you want to modify it.
*
* @return internal storage object for reading
*/
public RepeatedByte getNextPackage() {
return nextPackage;
}
/**
* <code>optional bytes NextPackage = 2047;</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 RepeatedByte getMutableNextPackage() {
bitField0_ |= 0x00000002;
return nextPackage;
}
/**
* <code>optional bytes NextPackage = 2047;</code>
* @param value the nextPackage to add
* @return this
*/
public ActivityTrekkerVersusRewardReceiveResp addNextPackage(final byte value) {
bitField0_ |= 0x00000002;
nextPackage.add(value);
return this;
}
/**
* <code>optional bytes NextPackage = 2047;</code>
* @param values the nextPackage to add
* @return this
*/
public ActivityTrekkerVersusRewardReceiveResp addAllNextPackage(final byte... values) {
bitField0_ |= 0x00000002;
nextPackage.addAll(values);
return this;
}
/**
* <code>optional bytes NextPackage = 2047;</code>
* @param values the nextPackage to set
* @return this
*/
public ActivityTrekkerVersusRewardReceiveResp setNextPackage(final byte... values) {
bitField0_ |= 0x00000002;
nextPackage.copyFrom(values);
return this;
}
/**
* <code>repeated .ItemTpl AwardItems = 2;</code>
* @return whether the awardItems field is set
*/
public boolean hasAwardItems() {
return (bitField0_ & 0x00000004) != 0;
}
/**
* <code>repeated .ItemTpl AwardItems = 2;</code>
* @return this
*/
public ActivityTrekkerVersusRewardReceiveResp clearAwardItems() {
bitField0_ &= ~0x00000004;
awardItems.clear();
return this;
}
/**
* <code>repeated .ItemTpl AwardItems = 2;</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 #getMutableAwardItems()} if you want to modify it.
*
* @return internal storage object for reading
*/
public RepeatedMessage<Public.ItemTpl> getAwardItems() {
return awardItems;
}
/**
* <code>repeated .ItemTpl AwardItems = 2;</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 RepeatedMessage<Public.ItemTpl> getMutableAwardItems() {
bitField0_ |= 0x00000004;
return awardItems;
}
/**
* <code>repeated .ItemTpl AwardItems = 2;</code>
* @param value the awardItems to add
* @return this
*/
public ActivityTrekkerVersusRewardReceiveResp addAwardItems(final Public.ItemTpl value) {
bitField0_ |= 0x00000004;
awardItems.add(value);
return this;
}
/**
* <code>repeated .ItemTpl AwardItems = 2;</code>
* @param values the awardItems to add
* @return this
*/
public ActivityTrekkerVersusRewardReceiveResp addAllAwardItems(final Public.ItemTpl... values) {
bitField0_ |= 0x00000004;
awardItems.addAll(values);
return this;
}
@Override
public ActivityTrekkerVersusRewardReceiveResp copyFrom(
final ActivityTrekkerVersusRewardReceiveResp other) {
cachedSize = other.cachedSize;
if ((bitField0_ | other.bitField0_) != 0) {
bitField0_ = other.bitField0_;
change.copyFrom(other.change);
nextPackage.copyFrom(other.nextPackage);
awardItems.copyFrom(other.awardItems);
}
return this;
}
@Override
public ActivityTrekkerVersusRewardReceiveResp mergeFrom(
final ActivityTrekkerVersusRewardReceiveResp other) {
if (other.isEmpty()) {
return this;
}
cachedSize = -1;
if (other.hasChange()) {
getMutableChange().mergeFrom(other.change);
}
if (other.hasNextPackage()) {
getMutableNextPackage().copyFrom(other.nextPackage);
}
if (other.hasAwardItems()) {
getMutableAwardItems().addAll(other.awardItems);
}
return this;
}
@Override
public ActivityTrekkerVersusRewardReceiveResp clear() {
if (isEmpty()) {
return this;
}
cachedSize = -1;
bitField0_ = 0;
change.clear();
nextPackage.clear();
awardItems.clear();
return this;
}
@Override
public ActivityTrekkerVersusRewardReceiveResp clearQuick() {
if (isEmpty()) {
return this;
}
cachedSize = -1;
bitField0_ = 0;
change.clearQuick();
nextPackage.clear();
awardItems.clearQuick();
return this;
}
@Override
public boolean equals(Object o) {
if (o == this) {
return true;
}
if (!(o instanceof ActivityTrekkerVersusRewardReceiveResp)) {
return false;
}
ActivityTrekkerVersusRewardReceiveResp other = (ActivityTrekkerVersusRewardReceiveResp) o;
return bitField0_ == other.bitField0_
&& (!hasChange() || change.equals(other.change))
&& (!hasNextPackage() || nextPackage.equals(other.nextPackage))
&& (!hasAwardItems() || awardItems.equals(other.awardItems));
}
@Override
public void writeTo(final ProtoSink output) throws IOException {
if ((bitField0_ & 0x00000001) != 0) {
output.writeRawByte((byte) 10);
output.writeMessageNoTag(change);
}
if ((bitField0_ & 0x00000002) != 0) {
output.writeRawLittleEndian16((short) 32762);
output.writeBytesNoTag(nextPackage);
}
if ((bitField0_ & 0x00000004) != 0) {
for (int i = 0; i < awardItems.length(); i++) {
output.writeRawByte((byte) 18);
output.writeMessageNoTag(awardItems.get(i));
}
}
}
@Override
protected int computeSerializedSize() {
int size = 0;
if ((bitField0_ & 0x00000001) != 0) {
size += 1 + ProtoSink.computeMessageSizeNoTag(change);
}
if ((bitField0_ & 0x00000002) != 0) {
size += 2 + ProtoSink.computeBytesSizeNoTag(nextPackage);
}
if ((bitField0_ & 0x00000004) != 0) {
size += (1 * awardItems.length()) + ProtoSink.computeRepeatedMessageSizeNoTag(awardItems);
}
return size;
}
@Override
@SuppressWarnings("fallthrough")
public ActivityTrekkerVersusRewardReceiveResp mergeFrom(final ProtoSource input) throws
IOException {
// Enabled Fall-Through Optimization (QuickBuffers)
int tag = input.readTag();
while (true) {
switch (tag) {
case 10: {
// change
input.readMessage(change);
bitField0_ |= 0x00000001;
tag = input.readTag();
if (tag != 16378) {
break;
}
}
case 16378: {
// nextPackage
input.readBytes(nextPackage);
bitField0_ |= 0x00000002;
tag = input.readTag();
if (tag != 18) {
break;
}
}
case 18: {
// awardItems
tag = input.readRepeatedMessage(awardItems, tag);
bitField0_ |= 0x00000004;
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.writeMessage(FieldNames.change, change);
}
if ((bitField0_ & 0x00000002) != 0) {
output.writeBytes(FieldNames.nextPackage, nextPackage);
}
if ((bitField0_ & 0x00000004) != 0) {
output.writeRepeatedMessage(FieldNames.awardItems, awardItems);
}
output.endObject();
}
@Override
public ActivityTrekkerVersusRewardReceiveResp mergeFrom(final JsonSource input) throws
IOException {
if (!input.beginObject()) {
return this;
}
while (!input.isAtEnd()) {
switch (input.readFieldHash()) {
case 2017198032: {
if (input.isAtField(FieldNames.change)) {
if (!input.trySkipNullValue()) {
input.readMessage(change);
bitField0_ |= 0x00000001;
}
} else {
input.skipUnknownField();
}
break;
}
case -2082324045: {
if (input.isAtField(FieldNames.nextPackage)) {
if (!input.trySkipNullValue()) {
input.readBytes(nextPackage);
bitField0_ |= 0x00000002;
}
} else {
input.skipUnknownField();
}
break;
}
case -1943188605: {
if (input.isAtField(FieldNames.awardItems)) {
if (!input.trySkipNullValue()) {
input.readRepeatedMessage(awardItems);
bitField0_ |= 0x00000004;
}
} else {
input.skipUnknownField();
}
break;
}
default: {
input.skipUnknownField();
break;
}
}
}
input.endObject();
return this;
}
@Override
public ActivityTrekkerVersusRewardReceiveResp clone() {
return new ActivityTrekkerVersusRewardReceiveResp().copyFrom(this);
}
@Override
public boolean isEmpty() {
return ((bitField0_) == 0);
}
public static ActivityTrekkerVersusRewardReceiveResp parseFrom(final byte[] data) throws
InvalidProtocolBufferException {
return ProtoMessage.mergeFrom(new ActivityTrekkerVersusRewardReceiveResp(), data).checkInitialized();
}
public static ActivityTrekkerVersusRewardReceiveResp parseFrom(final ProtoSource input) throws
IOException {
return ProtoMessage.mergeFrom(new ActivityTrekkerVersusRewardReceiveResp(), input).checkInitialized();
}
public static ActivityTrekkerVersusRewardReceiveResp parseFrom(final JsonSource input) throws
IOException {
return ProtoMessage.mergeFrom(new ActivityTrekkerVersusRewardReceiveResp(), input).checkInitialized();
}
/**
* @return factory for creating ActivityTrekkerVersusRewardReceiveResp messages
*/
public static MessageFactory<ActivityTrekkerVersusRewardReceiveResp> getFactory() {
return ActivityTrekkerVersusRewardReceiveRespFactory.INSTANCE;
}
private enum ActivityTrekkerVersusRewardReceiveRespFactory implements MessageFactory<ActivityTrekkerVersusRewardReceiveResp> {
INSTANCE;
@Override
public ActivityTrekkerVersusRewardReceiveResp create() {
return ActivityTrekkerVersusRewardReceiveResp.newInstance();
}
}
/**
* Contains name constants used for serializing JSON
*/
static class FieldNames {
static final FieldName change = FieldName.forField("Change");
static final FieldName nextPackage = FieldName.forField("NextPackage");
static final FieldName awardItems = FieldName.forField("AwardItems");
}
}
}
File diff suppressed because it is too large. Load diff
@@ -35,6 +35,11 @@ public final class GachaSpin {
*/
private final RepeatedByte nextPackage = RepeatedByte.newEmptyInstance();
/**
* <code>repeated .ItemTpl Check = 15;</code>
*/
private final RepeatedMessage<Public.ItemTpl> check = RepeatedMessage.newEmptyInstance(Public.ItemTpl.getFactory());
private GachaSpinReq() {
}
@@ -198,6 +203,74 @@ public final class GachaSpin {
return this;
}
/**
* <code>repeated .ItemTpl Check = 15;</code>
* @return whether the check field is set
*/
public boolean hasCheck() {
return (bitField0_ & 0x00000008) != 0;
}
/**
* <code>repeated .ItemTpl Check = 15;</code>
* @return this
*/
public GachaSpinReq clearCheck() {
bitField0_ &= ~0x00000008;
check.clear();
return this;
}
/**
* <code>repeated .ItemTpl Check = 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 #getMutableCheck()} if you want to modify it.
*
* @return internal storage object for reading
*/
public RepeatedMessage<Public.ItemTpl> getCheck() {
return check;
}
/**
* <code>repeated .ItemTpl Check = 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 RepeatedMessage<Public.ItemTpl> getMutableCheck() {
bitField0_ |= 0x00000008;
return check;
}
/**
* <code>repeated .ItemTpl Check = 15;</code>
* @param value the check to add
* @return this
*/
public GachaSpinReq addCheck(final Public.ItemTpl value) {
bitField0_ |= 0x00000008;
check.add(value);
return this;
}
/**
* <code>repeated .ItemTpl Check = 15;</code>
* @param values the check to add
* @return this
*/
public GachaSpinReq addAllCheck(final Public.ItemTpl... values) {
bitField0_ |= 0x00000008;
check.addAll(values);
return this;
}
@Override
public GachaSpinReq copyFrom(final GachaSpinReq other) {
cachedSize = other.cachedSize;
@@ -206,6 +279,7 @@ public final class GachaSpin {
id = other.id;
mode = other.mode;
nextPackage.copyFrom(other.nextPackage);
check.copyFrom(other.check);
}
return this;
}
@@ -225,6 +299,9 @@ public final class GachaSpin {
if (other.hasNextPackage()) {
getMutableNextPackage().copyFrom(other.nextPackage);
}
if (other.hasCheck()) {
getMutableCheck().addAll(other.check);
}
return this;
}
@@ -238,6 +315,7 @@ public final class GachaSpin {
id = 0;
mode = 0;
nextPackage.clear();
check.clear();
return this;
}
@@ -249,6 +327,7 @@ public final class GachaSpin {
cachedSize = -1;
bitField0_ = 0;
nextPackage.clear();
check.clearQuick();
return this;
}
@@ -264,7 +343,8 @@ public final class GachaSpin {
return bitField0_ == other.bitField0_
&& (!hasId() || id == other.id)
&& (!hasMode() || mode == other.mode)
&& (!hasNextPackage() || nextPackage.equals(other.nextPackage));
&& (!hasNextPackage() || nextPackage.equals(other.nextPackage))
&& (!hasCheck() || check.equals(other.check));
}
@Override
@@ -281,6 +361,12 @@ public final class GachaSpin {
output.writeRawLittleEndian16((short) 32762);
output.writeBytesNoTag(nextPackage);
}
if ((bitField0_ & 0x00000008) != 0) {
for (int i = 0; i < check.length(); i++) {
output.writeRawByte((byte) 122);
output.writeMessageNoTag(check.get(i));
}
}
}
@Override
@@ -295,6 +381,9 @@ public final class GachaSpin {
if ((bitField0_ & 0x00000004) != 0) {
size += 2 + ProtoSink.computeBytesSizeNoTag(nextPackage);
}
if ((bitField0_ & 0x00000008) != 0) {
size += (1 * check.length()) + ProtoSink.computeRepeatedMessageSizeNoTag(check);
}
return size;
}
@@ -328,6 +417,14 @@ public final class GachaSpin {
input.readBytes(nextPackage);
bitField0_ |= 0x00000004;
tag = input.readTag();
if (tag != 122) {
break;
}
}
case 122: {
// check
tag = input.readRepeatedMessage(check, tag);
bitField0_ |= 0x00000008;
if (tag != 0) {
break;
}
@@ -358,6 +455,9 @@ public final class GachaSpin {
if ((bitField0_ & 0x00000004) != 0) {
output.writeBytes(FieldNames.nextPackage, nextPackage);
}
if ((bitField0_ & 0x00000008) != 0) {
output.writeRepeatedMessage(FieldNames.check, check);
}
output.endObject();
}
@@ -401,6 +501,17 @@ public final class GachaSpin {
}
break;
}
case 65074408: {
if (input.isAtField(FieldNames.check)) {
if (!input.trySkipNullValue()) {
input.readRepeatedMessage(check);
bitField0_ |= 0x00000008;
}
} else {
input.skipUnknownField();
}
break;
}
default: {
input.skipUnknownField();
break;
@@ -458,6 +569,8 @@ public final class GachaSpin {
static final FieldName mode = FieldName.forField("Mode");
static final FieldName nextPackage = FieldName.forField("NextPackage");
static final FieldName check = FieldName.forField("Check");
}
}
@@ -2022,4 +2135,518 @@ public final class GachaSpin {
static final FieldName rewards = FieldName.forField("Rewards");
}
}
/**
* Protobuf type {@code GachaSpinSyncResp}
*/
public static final class GachaSpinSyncResp extends ProtoMessage<GachaSpinSyncResp> implements Cloneable {
private static final long serialVersionUID = 0L;
/**
* <code>optional bytes NextPackage = 2047;</code>
*/
private final RepeatedByte nextPackage = RepeatedByte.newEmptyInstance();
/**
* <code>repeated .Res Res = 2;</code>
*/
private final RepeatedMessage<Public.Res> res = RepeatedMessage.newEmptyInstance(Public.Res.getFactory());
/**
* <code>repeated .Item Items = 3;</code>
*/
private final RepeatedMessage<Public.Item> items = RepeatedMessage.newEmptyInstance(Public.Item.getFactory());
private GachaSpinSyncResp() {
}
/**
* @return a new empty instance of {@code GachaSpinSyncResp}
*/
public static GachaSpinSyncResp newInstance() {
return new GachaSpinSyncResp();
}
/**
* <code>optional bytes NextPackage = 2047;</code>
* @return whether the nextPackage field is set
*/
public boolean hasNextPackage() {
return (bitField0_ & 0x00000001) != 0;
}
/**
* <code>optional bytes NextPackage = 2047;</code>
* @return this
*/
public GachaSpinSyncResp clearNextPackage() {
bitField0_ &= ~0x00000001;
nextPackage.clear();
return this;
}
/**
* <code>optional bytes NextPackage = 2047;</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 #getMutableNextPackage()} if you want to modify it.
*
* @return internal storage object for reading
*/
public RepeatedByte getNextPackage() {
return nextPackage;
}
/**
* <code>optional bytes NextPackage = 2047;</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 RepeatedByte getMutableNextPackage() {
bitField0_ |= 0x00000001;
return nextPackage;
}
/**
* <code>optional bytes NextPackage = 2047;</code>
* @param value the nextPackage to add
* @return this
*/
public GachaSpinSyncResp addNextPackage(final byte value) {
bitField0_ |= 0x00000001;
nextPackage.add(value);
return this;
}
/**
* <code>optional bytes NextPackage = 2047;</code>
* @param values the nextPackage to add
* @return this
*/
public GachaSpinSyncResp addAllNextPackage(final byte... values) {
bitField0_ |= 0x00000001;
nextPackage.addAll(values);
return this;
}
/**
* <code>optional bytes NextPackage = 2047;</code>
* @param values the nextPackage to set
* @return this
*/
public GachaSpinSyncResp setNextPackage(final byte... values) {
bitField0_ |= 0x00000001;
nextPackage.copyFrom(values);
return this;
}
/**
* <code>repeated .Res Res = 2;</code>
* @return whether the res field is set
*/
public boolean hasRes() {
return (bitField0_ & 0x00000002) != 0;
}
/**
* <code>repeated .Res Res = 2;</code>
* @return this
*/
public GachaSpinSyncResp clearRes() {
bitField0_ &= ~0x00000002;
res.clear();
return this;
}
/**
* <code>repeated .Res Res = 2;</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 #getMutableRes()} if you want to modify it.
*
* @return internal storage object for reading
*/
public RepeatedMessage<Public.Res> getRes() {
return res;
}
/**
* <code>repeated .Res Res = 2;</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 RepeatedMessage<Public.Res> getMutableRes() {
bitField0_ |= 0x00000002;
return res;
}
/**
* <code>repeated .Res Res = 2;</code>
* @param value the res to add
* @return this
*/
public GachaSpinSyncResp addRes(final Public.Res value) {
bitField0_ |= 0x00000002;
res.add(value);
return this;
}
/**
* <code>repeated .Res Res = 2;</code>
* @param values the res to add
* @return this
*/
public GachaSpinSyncResp addAllRes(final Public.Res... values) {
bitField0_ |= 0x00000002;
res.addAll(values);
return this;
}
/**
* <code>repeated .Item Items = 3;</code>
* @return whether the items field is set
*/
public boolean hasItems() {
return (bitField0_ & 0x00000004) != 0;
}
/**
* <code>repeated .Item Items = 3;</code>
* @return this
*/
public GachaSpinSyncResp clearItems() {
bitField0_ &= ~0x00000004;
items.clear();
return this;
}
/**
* <code>repeated .Item Items = 3;</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 #getMutableItems()} if you want to modify it.
*
* @return internal storage object for reading
*/
public RepeatedMessage<Public.Item> getItems() {
return items;
}
/**
* <code>repeated .Item Items = 3;</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 RepeatedMessage<Public.Item> getMutableItems() {
bitField0_ |= 0x00000004;
return items;
}
/**
* <code>repeated .Item Items = 3;</code>
* @param value the items to add
* @return this
*/
public GachaSpinSyncResp addItems(final Public.Item value) {
bitField0_ |= 0x00000004;
items.add(value);
return this;
}
/**
* <code>repeated .Item Items = 3;</code>
* @param values the items to add
* @return this
*/
public GachaSpinSyncResp addAllItems(final Public.Item... values) {
bitField0_ |= 0x00000004;
items.addAll(values);
return this;
}
@Override
public GachaSpinSyncResp copyFrom(final GachaSpinSyncResp other) {
cachedSize = other.cachedSize;
if ((bitField0_ | other.bitField0_) != 0) {
bitField0_ = other.bitField0_;
nextPackage.copyFrom(other.nextPackage);
res.copyFrom(other.res);
items.copyFrom(other.items);
}
return this;
}
@Override
public GachaSpinSyncResp mergeFrom(final GachaSpinSyncResp other) {
if (other.isEmpty()) {
return this;
}
cachedSize = -1;
if (other.hasNextPackage()) {
getMutableNextPackage().copyFrom(other.nextPackage);
}
if (other.hasRes()) {
getMutableRes().addAll(other.res);
}
if (other.hasItems()) {
getMutableItems().addAll(other.items);
}
return this;
}
@Override
public GachaSpinSyncResp clear() {
if (isEmpty()) {
return this;
}
cachedSize = -1;
bitField0_ = 0;
nextPackage.clear();
res.clear();
items.clear();
return this;
}
@Override
public GachaSpinSyncResp clearQuick() {
if (isEmpty()) {
return this;
}
cachedSize = -1;
bitField0_ = 0;
nextPackage.clear();
res.clearQuick();
items.clearQuick();
return this;
}
@Override
public boolean equals(Object o) {
if (o == this) {
return true;
}
if (!(o instanceof GachaSpinSyncResp)) {
return false;
}
GachaSpinSyncResp other = (GachaSpinSyncResp) o;
return bitField0_ == other.bitField0_
&& (!hasNextPackage() || nextPackage.equals(other.nextPackage))
&& (!hasRes() || res.equals(other.res))
&& (!hasItems() || items.equals(other.items));
}
@Override
public void writeTo(final ProtoSink output) throws IOException {
if ((bitField0_ & 0x00000001) != 0) {
output.writeRawLittleEndian16((short) 32762);
output.writeBytesNoTag(nextPackage);
}
if ((bitField0_ & 0x00000002) != 0) {
for (int i = 0; i < res.length(); i++) {
output.writeRawByte((byte) 18);
output.writeMessageNoTag(res.get(i));
}
}
if ((bitField0_ & 0x00000004) != 0) {
for (int i = 0; i < items.length(); i++) {
output.writeRawByte((byte) 26);
output.writeMessageNoTag(items.get(i));
}
}
}
@Override
protected int computeSerializedSize() {
int size = 0;
if ((bitField0_ & 0x00000001) != 0) {
size += 2 + ProtoSink.computeBytesSizeNoTag(nextPackage);
}
if ((bitField0_ & 0x00000002) != 0) {
size += (1 * res.length()) + ProtoSink.computeRepeatedMessageSizeNoTag(res);
}
if ((bitField0_ & 0x00000004) != 0) {
size += (1 * items.length()) + ProtoSink.computeRepeatedMessageSizeNoTag(items);
}
return size;
}
@Override
@SuppressWarnings("fallthrough")
public GachaSpinSyncResp mergeFrom(final ProtoSource input) throws IOException {
// Enabled Fall-Through Optimization (QuickBuffers)
int tag = input.readTag();
while (true) {
switch (tag) {
case 16378: {
// nextPackage
input.readBytes(nextPackage);
bitField0_ |= 0x00000001;
tag = input.readTag();
if (tag != 18) {
break;
}
}
case 18: {
// res
tag = input.readRepeatedMessage(res, tag);
bitField0_ |= 0x00000002;
if (tag != 26) {
break;
}
}
case 26: {
// items
tag = input.readRepeatedMessage(items, tag);
bitField0_ |= 0x00000004;
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.writeBytes(FieldNames.nextPackage, nextPackage);
}
if ((bitField0_ & 0x00000002) != 0) {
output.writeRepeatedMessage(FieldNames.res, res);
}
if ((bitField0_ & 0x00000004) != 0) {
output.writeRepeatedMessage(FieldNames.items, items);
}
output.endObject();
}
@Override
public GachaSpinSyncResp mergeFrom(final JsonSource input) throws IOException {
if (!input.beginObject()) {
return this;
}
while (!input.isAtEnd()) {
switch (input.readFieldHash()) {
case -2082324045: {
if (input.isAtField(FieldNames.nextPackage)) {
if (!input.trySkipNullValue()) {
input.readBytes(nextPackage);
bitField0_ |= 0x00000001;
}
} else {
input.skipUnknownField();
}
break;
}
case 82048: {
if (input.isAtField(FieldNames.res)) {
if (!input.trySkipNullValue()) {
input.readRepeatedMessage(res);
bitField0_ |= 0x00000002;
}
} else {
input.skipUnknownField();
}
break;
}
case 70973344: {
if (input.isAtField(FieldNames.items)) {
if (!input.trySkipNullValue()) {
input.readRepeatedMessage(items);
bitField0_ |= 0x00000004;
}
} else {
input.skipUnknownField();
}
break;
}
default: {
input.skipUnknownField();
break;
}
}
}
input.endObject();
return this;
}
@Override
public GachaSpinSyncResp clone() {
return new GachaSpinSyncResp().copyFrom(this);
}
@Override
public boolean isEmpty() {
return ((bitField0_) == 0);
}
public static GachaSpinSyncResp parseFrom(final byte[] data) throws
InvalidProtocolBufferException {
return ProtoMessage.mergeFrom(new GachaSpinSyncResp(), data).checkInitialized();
}
public static GachaSpinSyncResp parseFrom(final ProtoSource input) throws IOException {
return ProtoMessage.mergeFrom(new GachaSpinSyncResp(), input).checkInitialized();
}
public static GachaSpinSyncResp parseFrom(final JsonSource input) throws IOException {
return ProtoMessage.mergeFrom(new GachaSpinSyncResp(), input).checkInitialized();
}
/**
* @return factory for creating GachaSpinSyncResp messages
*/
public static MessageFactory<GachaSpinSyncResp> getFactory() {
return GachaSpinSyncRespFactory.INSTANCE;
}
private enum GachaSpinSyncRespFactory implements MessageFactory<GachaSpinSyncResp> {
INSTANCE;
@Override
public GachaSpinSyncResp create() {
return GachaSpinSyncResp.newInstance();
}
}
/**
* Contains name constants used for serializing JSON
*/
static class FieldNames {
static final FieldName nextPackage = FieldName.forField("NextPackage");
static final FieldName res = FieldName.forField("Res");
static final FieldName items = FieldName.forField("Items");
}
}
}
@@ -10948,4 +10948,607 @@ public final class NotifyGm {
static final FieldName levels = FieldName.forField("levels");
}
}
/**
* Protobuf type {@code AssistAddBuildNotify}
*/
public static final class AssistAddBuildNotify extends ProtoMessage<AssistAddBuildNotify> implements Cloneable {
private static final long serialVersionUID = 0L;
/**
* <code>optional .ChangeInfo Change = 1;</code>
*/
private final Public.ChangeInfo change = Public.ChangeInfo.newInstance();
/**
* <code>optional .StarTowerBuildInfo BuildInfo = 3;</code>
*/
private final PublicStarTower.StarTowerBuildInfo buildInfo = PublicStarTower.StarTowerBuildInfo.newInstance();
/**
* <code>optional bytes NextPackage = 2047;</code>
*/
private final RepeatedByte nextPackage = RepeatedByte.newEmptyInstance();
/**
* <code>repeated .ItemTpl BuildRewards = 2;</code>
*/
private final RepeatedMessage<Public.ItemTpl> buildRewards = RepeatedMessage.newEmptyInstance(Public.ItemTpl.getFactory());
private AssistAddBuildNotify() {
}
/**
* @return a new empty instance of {@code AssistAddBuildNotify}
*/
public static AssistAddBuildNotify newInstance() {
return new AssistAddBuildNotify();
}
/**
* <code>optional .ChangeInfo Change = 1;</code>
* @return whether the change field is set
*/
public boolean hasChange() {
return (bitField0_ & 0x00000001) != 0;
}
/**
* <code>optional .ChangeInfo Change = 1;</code>
* @return this
*/
public AssistAddBuildNotify clearChange() {
bitField0_ &= ~0x00000001;
change.clear();
return this;
}
/**
* <code>optional .ChangeInfo Change = 1;</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 #getMutableChange()} if you want to modify it.
*
* @return internal storage object for reading
*/
public Public.ChangeInfo getChange() {
return change;
}
/**
* <code>optional .ChangeInfo Change = 1;</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 Public.ChangeInfo getMutableChange() {
bitField0_ |= 0x00000001;
return change;
}
/**
* <code>optional .ChangeInfo Change = 1;</code>
* @param value the change to set
* @return this
*/
public AssistAddBuildNotify setChange(final Public.ChangeInfo value) {
bitField0_ |= 0x00000001;
change.copyFrom(value);
return this;
}
/**
* <code>optional .StarTowerBuildInfo BuildInfo = 3;</code>
* @return whether the buildInfo field is set
*/
public boolean hasBuildInfo() {
return (bitField0_ & 0x00000002) != 0;
}
/**
* <code>optional .StarTowerBuildInfo BuildInfo = 3;</code>
* @return this
*/
public AssistAddBuildNotify clearBuildInfo() {
bitField0_ &= ~0x00000002;
buildInfo.clear();
return this;
}
/**
* <code>optional .StarTowerBuildInfo BuildInfo = 3;</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 #getMutableBuildInfo()} if you want to modify it.
*
* @return internal storage object for reading
*/
public PublicStarTower.StarTowerBuildInfo getBuildInfo() {
return buildInfo;
}
/**
* <code>optional .StarTowerBuildInfo BuildInfo = 3;</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 PublicStarTower.StarTowerBuildInfo getMutableBuildInfo() {
bitField0_ |= 0x00000002;
return buildInfo;
}
/**
* <code>optional .StarTowerBuildInfo BuildInfo = 3;</code>
* @param value the buildInfo to set
* @return this
*/
public AssistAddBuildNotify setBuildInfo(final PublicStarTower.StarTowerBuildInfo value) {
bitField0_ |= 0x00000002;
buildInfo.copyFrom(value);
return this;
}
/**
* <code>optional bytes NextPackage = 2047;</code>
* @return whether the nextPackage field is set
*/
public boolean hasNextPackage() {
return (bitField0_ & 0x00000004) != 0;
}
/**
* <code>optional bytes NextPackage = 2047;</code>
* @return this
*/
public AssistAddBuildNotify clearNextPackage() {
bitField0_ &= ~0x00000004;
nextPackage.clear();
return this;
}
/**
* <code>optional bytes NextPackage = 2047;</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 #getMutableNextPackage()} if you want to modify it.
*
* @return internal storage object for reading
*/
public RepeatedByte getNextPackage() {
return nextPackage;
}
/**
* <code>optional bytes NextPackage = 2047;</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 RepeatedByte getMutableNextPackage() {
bitField0_ |= 0x00000004;
return nextPackage;
}
/**
* <code>optional bytes NextPackage = 2047;</code>
* @param value the nextPackage to add
* @return this
*/
public AssistAddBuildNotify addNextPackage(final byte value) {
bitField0_ |= 0x00000004;
nextPackage.add(value);
return this;
}
/**
* <code>optional bytes NextPackage = 2047;</code>
* @param values the nextPackage to add
* @return this
*/
public AssistAddBuildNotify addAllNextPackage(final byte... values) {
bitField0_ |= 0x00000004;
nextPackage.addAll(values);
return this;
}
/**
* <code>optional bytes NextPackage = 2047;</code>
* @param values the nextPackage to set
* @return this
*/
public AssistAddBuildNotify setNextPackage(final byte... values) {
bitField0_ |= 0x00000004;
nextPackage.copyFrom(values);
return this;
}
/**
* <code>repeated .ItemTpl BuildRewards = 2;</code>
* @return whether the buildRewards field is set
*/
public boolean hasBuildRewards() {
return (bitField0_ & 0x00000008) != 0;
}
/**
* <code>repeated .ItemTpl BuildRewards = 2;</code>
* @return this
*/
public AssistAddBuildNotify clearBuildRewards() {
bitField0_ &= ~0x00000008;
buildRewards.clear();
return this;
}
/**
* <code>repeated .ItemTpl BuildRewards = 2;</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 #getMutableBuildRewards()} if you want to modify it.
*
* @return internal storage object for reading
*/
public RepeatedMessage<Public.ItemTpl> getBuildRewards() {
return buildRewards;
}
/**
* <code>repeated .ItemTpl BuildRewards = 2;</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 RepeatedMessage<Public.ItemTpl> getMutableBuildRewards() {
bitField0_ |= 0x00000008;
return buildRewards;
}
/**
* <code>repeated .ItemTpl BuildRewards = 2;</code>
* @param value the buildRewards to add
* @return this
*/
public AssistAddBuildNotify addBuildRewards(final Public.ItemTpl value) {
bitField0_ |= 0x00000008;
buildRewards.add(value);
return this;
}
/**
* <code>repeated .ItemTpl BuildRewards = 2;</code>
* @param values the buildRewards to add
* @return this
*/
public AssistAddBuildNotify addAllBuildRewards(final Public.ItemTpl... values) {
bitField0_ |= 0x00000008;
buildRewards.addAll(values);
return this;
}
@Override
public AssistAddBuildNotify copyFrom(final AssistAddBuildNotify other) {
cachedSize = other.cachedSize;
if ((bitField0_ | other.bitField0_) != 0) {
bitField0_ = other.bitField0_;
change.copyFrom(other.change);
buildInfo.copyFrom(other.buildInfo);
nextPackage.copyFrom(other.nextPackage);
buildRewards.copyFrom(other.buildRewards);
}
return this;
}
@Override
public AssistAddBuildNotify mergeFrom(final AssistAddBuildNotify other) {
if (other.isEmpty()) {
return this;
}
cachedSize = -1;
if (other.hasChange()) {
getMutableChange().mergeFrom(other.change);
}
if (other.hasBuildInfo()) {
getMutableBuildInfo().mergeFrom(other.buildInfo);
}
if (other.hasNextPackage()) {
getMutableNextPackage().copyFrom(other.nextPackage);
}
if (other.hasBuildRewards()) {
getMutableBuildRewards().addAll(other.buildRewards);
}
return this;
}
@Override
public AssistAddBuildNotify clear() {
if (isEmpty()) {
return this;
}
cachedSize = -1;
bitField0_ = 0;
change.clear();
buildInfo.clear();
nextPackage.clear();
buildRewards.clear();
return this;
}
@Override
public AssistAddBuildNotify clearQuick() {
if (isEmpty()) {
return this;
}
cachedSize = -1;
bitField0_ = 0;
change.clearQuick();
buildInfo.clearQuick();
nextPackage.clear();
buildRewards.clearQuick();
return this;
}
@Override
public boolean equals(Object o) {
if (o == this) {
return true;
}
if (!(o instanceof AssistAddBuildNotify)) {
return false;
}
AssistAddBuildNotify other = (AssistAddBuildNotify) o;
return bitField0_ == other.bitField0_
&& (!hasChange() || change.equals(other.change))
&& (!hasBuildInfo() || buildInfo.equals(other.buildInfo))
&& (!hasNextPackage() || nextPackage.equals(other.nextPackage))
&& (!hasBuildRewards() || buildRewards.equals(other.buildRewards));
}
@Override
public void writeTo(final ProtoSink output) throws IOException {
if ((bitField0_ & 0x00000001) != 0) {
output.writeRawByte((byte) 10);
output.writeMessageNoTag(change);
}
if ((bitField0_ & 0x00000002) != 0) {
output.writeRawByte((byte) 26);
output.writeMessageNoTag(buildInfo);
}
if ((bitField0_ & 0x00000004) != 0) {
output.writeRawLittleEndian16((short) 32762);
output.writeBytesNoTag(nextPackage);
}
if ((bitField0_ & 0x00000008) != 0) {
for (int i = 0; i < buildRewards.length(); i++) {
output.writeRawByte((byte) 18);
output.writeMessageNoTag(buildRewards.get(i));
}
}
}
@Override
protected int computeSerializedSize() {
int size = 0;
if ((bitField0_ & 0x00000001) != 0) {
size += 1 + ProtoSink.computeMessageSizeNoTag(change);
}
if ((bitField0_ & 0x00000002) != 0) {
size += 1 + ProtoSink.computeMessageSizeNoTag(buildInfo);
}
if ((bitField0_ & 0x00000004) != 0) {
size += 2 + ProtoSink.computeBytesSizeNoTag(nextPackage);
}
if ((bitField0_ & 0x00000008) != 0) {
size += (1 * buildRewards.length()) + ProtoSink.computeRepeatedMessageSizeNoTag(buildRewards);
}
return size;
}
@Override
@SuppressWarnings("fallthrough")
public AssistAddBuildNotify mergeFrom(final ProtoSource input) throws IOException {
// Enabled Fall-Through Optimization (QuickBuffers)
int tag = input.readTag();
while (true) {
switch (tag) {
case 10: {
// change
input.readMessage(change);
bitField0_ |= 0x00000001;
tag = input.readTag();
if (tag != 26) {
break;
}
}
case 26: {
// buildInfo
input.readMessage(buildInfo);
bitField0_ |= 0x00000002;
tag = input.readTag();
if (tag != 16378) {
break;
}
}
case 16378: {
// nextPackage
input.readBytes(nextPackage);
bitField0_ |= 0x00000004;
tag = input.readTag();
if (tag != 18) {
break;
}
}
case 18: {
// buildRewards
tag = input.readRepeatedMessage(buildRewards, tag);
bitField0_ |= 0x00000008;
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.writeMessage(FieldNames.change, change);
}
if ((bitField0_ & 0x00000002) != 0) {
output.writeMessage(FieldNames.buildInfo, buildInfo);
}
if ((bitField0_ & 0x00000004) != 0) {
output.writeBytes(FieldNames.nextPackage, nextPackage);
}
if ((bitField0_ & 0x00000008) != 0) {
output.writeRepeatedMessage(FieldNames.buildRewards, buildRewards);
}
output.endObject();
}
@Override
public AssistAddBuildNotify mergeFrom(final JsonSource input) throws IOException {
if (!input.beginObject()) {
return this;
}
while (!input.isAtEnd()) {
switch (input.readFieldHash()) {
case 2017198032: {
if (input.isAtField(FieldNames.change)) {
if (!input.trySkipNullValue()) {
input.readMessage(change);
bitField0_ |= 0x00000001;
}
} else {
input.skipUnknownField();
}
break;
}
case 602658844: {
if (input.isAtField(FieldNames.buildInfo)) {
if (!input.trySkipNullValue()) {
input.readMessage(buildInfo);
bitField0_ |= 0x00000002;
}
} else {
input.skipUnknownField();
}
break;
}
case -2082324045: {
if (input.isAtField(FieldNames.nextPackage)) {
if (!input.trySkipNullValue()) {
input.readBytes(nextPackage);
bitField0_ |= 0x00000004;
}
} else {
input.skipUnknownField();
}
break;
}
case 1656054: {
if (input.isAtField(FieldNames.buildRewards)) {
if (!input.trySkipNullValue()) {
input.readRepeatedMessage(buildRewards);
bitField0_ |= 0x00000008;
}
} else {
input.skipUnknownField();
}
break;
}
default: {
input.skipUnknownField();
break;
}
}
}
input.endObject();
return this;
}
@Override
public AssistAddBuildNotify clone() {
return new AssistAddBuildNotify().copyFrom(this);
}
@Override
public boolean isEmpty() {
return ((bitField0_) == 0);
}
public static AssistAddBuildNotify parseFrom(final byte[] data) throws
InvalidProtocolBufferException {
return ProtoMessage.mergeFrom(new AssistAddBuildNotify(), data).checkInitialized();
}
public static AssistAddBuildNotify parseFrom(final ProtoSource input) throws IOException {
return ProtoMessage.mergeFrom(new AssistAddBuildNotify(), input).checkInitialized();
}
public static AssistAddBuildNotify parseFrom(final JsonSource input) throws IOException {
return ProtoMessage.mergeFrom(new AssistAddBuildNotify(), input).checkInitialized();
}
/**
* @return factory for creating AssistAddBuildNotify messages
*/
public static MessageFactory<AssistAddBuildNotify> getFactory() {
return AssistAddBuildNotifyFactory.INSTANCE;
}
private enum AssistAddBuildNotifyFactory implements MessageFactory<AssistAddBuildNotify> {
INSTANCE;
@Override
public AssistAddBuildNotify create() {
return AssistAddBuildNotify.newInstance();
}
}
/**
* Contains name constants used for serializing JSON
*/
static class FieldNames {
static final FieldName change = FieldName.forField("Change");
static final FieldName buildInfo = FieldName.forField("BuildInfo");
static final FieldName nextPackage = FieldName.forField("NextPackage");
static final FieldName buildRewards = FieldName.forField("BuildRewards");
}
}
}
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,619 @@
// Code generated by protocol buffer compiler. Do not edit!
package emu.nebula.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.RepeatedByte;
import us.hebi.quickbuf.RepeatedMessage;
public final class QuestAssistGroupRewardReceive {
/**
* Protobuf type {@code AssistGroupRewardResp}
*/
public static final class AssistGroupRewardResp extends ProtoMessage<AssistGroupRewardResp> implements Cloneable {
private static final long serialVersionUID = 0L;
/**
* <code>optional .ChangeInfo Change = 1;</code>
*/
private final Public.ChangeInfo change = Public.ChangeInfo.newInstance();
/**
* <code>optional .StarTowerBuildInfo BuildInfo = 3;</code>
*/
private final PublicStarTower.StarTowerBuildInfo buildInfo = PublicStarTower.StarTowerBuildInfo.newInstance();
/**
* <code>optional bytes NextPackage = 2047;</code>
*/
private final RepeatedByte nextPackage = RepeatedByte.newEmptyInstance();
/**
* <code>repeated .ItemTpl BuildRewards = 2;</code>
*/
private final RepeatedMessage<Public.ItemTpl> buildRewards = RepeatedMessage.newEmptyInstance(Public.ItemTpl.getFactory());
private AssistGroupRewardResp() {
}
/**
* @return a new empty instance of {@code AssistGroupRewardResp}
*/
public static AssistGroupRewardResp newInstance() {
return new AssistGroupRewardResp();
}
/**
* <code>optional .ChangeInfo Change = 1;</code>
* @return whether the change field is set
*/
public boolean hasChange() {
return (bitField0_ & 0x00000001) != 0;
}
/**
* <code>optional .ChangeInfo Change = 1;</code>
* @return this
*/
public AssistGroupRewardResp clearChange() {
bitField0_ &= ~0x00000001;
change.clear();
return this;
}
/**
* <code>optional .ChangeInfo Change = 1;</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 #getMutableChange()} if you want to modify it.
*
* @return internal storage object for reading
*/
public Public.ChangeInfo getChange() {
return change;
}
/**
* <code>optional .ChangeInfo Change = 1;</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 Public.ChangeInfo getMutableChange() {
bitField0_ |= 0x00000001;
return change;
}
/**
* <code>optional .ChangeInfo Change = 1;</code>
* @param value the change to set
* @return this
*/
public AssistGroupRewardResp setChange(final Public.ChangeInfo value) {
bitField0_ |= 0x00000001;
change.copyFrom(value);
return this;
}
/**
* <code>optional .StarTowerBuildInfo BuildInfo = 3;</code>
* @return whether the buildInfo field is set
*/
public boolean hasBuildInfo() {
return (bitField0_ & 0x00000002) != 0;
}
/**
* <code>optional .StarTowerBuildInfo BuildInfo = 3;</code>
* @return this
*/
public AssistGroupRewardResp clearBuildInfo() {
bitField0_ &= ~0x00000002;
buildInfo.clear();
return this;
}
/**
* <code>optional .StarTowerBuildInfo BuildInfo = 3;</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 #getMutableBuildInfo()} if you want to modify it.
*
* @return internal storage object for reading
*/
public PublicStarTower.StarTowerBuildInfo getBuildInfo() {
return buildInfo;
}
/**
* <code>optional .StarTowerBuildInfo BuildInfo = 3;</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 PublicStarTower.StarTowerBuildInfo getMutableBuildInfo() {
bitField0_ |= 0x00000002;
return buildInfo;
}
/**
* <code>optional .StarTowerBuildInfo BuildInfo = 3;</code>
* @param value the buildInfo to set
* @return this
*/
public AssistGroupRewardResp setBuildInfo(final PublicStarTower.StarTowerBuildInfo value) {
bitField0_ |= 0x00000002;
buildInfo.copyFrom(value);
return this;
}
/**
* <code>optional bytes NextPackage = 2047;</code>
* @return whether the nextPackage field is set
*/
public boolean hasNextPackage() {
return (bitField0_ & 0x00000004) != 0;
}
/**
* <code>optional bytes NextPackage = 2047;</code>
* @return this
*/
public AssistGroupRewardResp clearNextPackage() {
bitField0_ &= ~0x00000004;
nextPackage.clear();
return this;
}
/**
* <code>optional bytes NextPackage = 2047;</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 #getMutableNextPackage()} if you want to modify it.
*
* @return internal storage object for reading
*/
public RepeatedByte getNextPackage() {
return nextPackage;
}
/**
* <code>optional bytes NextPackage = 2047;</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 RepeatedByte getMutableNextPackage() {
bitField0_ |= 0x00000004;
return nextPackage;
}
/**
* <code>optional bytes NextPackage = 2047;</code>
* @param value the nextPackage to add
* @return this
*/
public AssistGroupRewardResp addNextPackage(final byte value) {
bitField0_ |= 0x00000004;
nextPackage.add(value);
return this;
}
/**
* <code>optional bytes NextPackage = 2047;</code>
* @param values the nextPackage to add
* @return this
*/
public AssistGroupRewardResp addAllNextPackage(final byte... values) {
bitField0_ |= 0x00000004;
nextPackage.addAll(values);
return this;
}
/**
* <code>optional bytes NextPackage = 2047;</code>
* @param values the nextPackage to set
* @return this
*/
public AssistGroupRewardResp setNextPackage(final byte... values) {
bitField0_ |= 0x00000004;
nextPackage.copyFrom(values);
return this;
}
/**
* <code>repeated .ItemTpl BuildRewards = 2;</code>
* @return whether the buildRewards field is set
*/
public boolean hasBuildRewards() {
return (bitField0_ & 0x00000008) != 0;
}
/**
* <code>repeated .ItemTpl BuildRewards = 2;</code>
* @return this
*/
public AssistGroupRewardResp clearBuildRewards() {
bitField0_ &= ~0x00000008;
buildRewards.clear();
return this;
}
/**
* <code>repeated .ItemTpl BuildRewards = 2;</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 #getMutableBuildRewards()} if you want to modify it.
*
* @return internal storage object for reading
*/
public RepeatedMessage<Public.ItemTpl> getBuildRewards() {
return buildRewards;
}
/**
* <code>repeated .ItemTpl BuildRewards = 2;</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 RepeatedMessage<Public.ItemTpl> getMutableBuildRewards() {
bitField0_ |= 0x00000008;
return buildRewards;
}
/**
* <code>repeated .ItemTpl BuildRewards = 2;</code>
* @param value the buildRewards to add
* @return this
*/
public AssistGroupRewardResp addBuildRewards(final Public.ItemTpl value) {
bitField0_ |= 0x00000008;
buildRewards.add(value);
return this;
}
/**
* <code>repeated .ItemTpl BuildRewards = 2;</code>
* @param values the buildRewards to add
* @return this
*/
public AssistGroupRewardResp addAllBuildRewards(final Public.ItemTpl... values) {
bitField0_ |= 0x00000008;
buildRewards.addAll(values);
return this;
}
@Override
public AssistGroupRewardResp copyFrom(final AssistGroupRewardResp other) {
cachedSize = other.cachedSize;
if ((bitField0_ | other.bitField0_) != 0) {
bitField0_ = other.bitField0_;
change.copyFrom(other.change);
buildInfo.copyFrom(other.buildInfo);
nextPackage.copyFrom(other.nextPackage);
buildRewards.copyFrom(other.buildRewards);
}
return this;
}
@Override
public AssistGroupRewardResp mergeFrom(final AssistGroupRewardResp other) {
if (other.isEmpty()) {
return this;
}
cachedSize = -1;
if (other.hasChange()) {
getMutableChange().mergeFrom(other.change);
}
if (other.hasBuildInfo()) {
getMutableBuildInfo().mergeFrom(other.buildInfo);
}
if (other.hasNextPackage()) {
getMutableNextPackage().copyFrom(other.nextPackage);
}
if (other.hasBuildRewards()) {
getMutableBuildRewards().addAll(other.buildRewards);
}
return this;
}
@Override
public AssistGroupRewardResp clear() {
if (isEmpty()) {
return this;
}
cachedSize = -1;
bitField0_ = 0;
change.clear();
buildInfo.clear();
nextPackage.clear();
buildRewards.clear();
return this;
}
@Override
public AssistGroupRewardResp clearQuick() {
if (isEmpty()) {
return this;
}
cachedSize = -1;
bitField0_ = 0;
change.clearQuick();
buildInfo.clearQuick();
nextPackage.clear();
buildRewards.clearQuick();
return this;
}
@Override
public boolean equals(Object o) {
if (o == this) {
return true;
}
if (!(o instanceof AssistGroupRewardResp)) {
return false;
}
AssistGroupRewardResp other = (AssistGroupRewardResp) o;
return bitField0_ == other.bitField0_
&& (!hasChange() || change.equals(other.change))
&& (!hasBuildInfo() || buildInfo.equals(other.buildInfo))
&& (!hasNextPackage() || nextPackage.equals(other.nextPackage))
&& (!hasBuildRewards() || buildRewards.equals(other.buildRewards));
}
@Override
public void writeTo(final ProtoSink output) throws IOException {
if ((bitField0_ & 0x00000001) != 0) {
output.writeRawByte((byte) 10);
output.writeMessageNoTag(change);
}
if ((bitField0_ & 0x00000002) != 0) {
output.writeRawByte((byte) 26);
output.writeMessageNoTag(buildInfo);
}
if ((bitField0_ & 0x00000004) != 0) {
output.writeRawLittleEndian16((short) 32762);
output.writeBytesNoTag(nextPackage);
}
if ((bitField0_ & 0x00000008) != 0) {
for (int i = 0; i < buildRewards.length(); i++) {
output.writeRawByte((byte) 18);
output.writeMessageNoTag(buildRewards.get(i));
}
}
}
@Override
protected int computeSerializedSize() {
int size = 0;
if ((bitField0_ & 0x00000001) != 0) {
size += 1 + ProtoSink.computeMessageSizeNoTag(change);
}
if ((bitField0_ & 0x00000002) != 0) {
size += 1 + ProtoSink.computeMessageSizeNoTag(buildInfo);
}
if ((bitField0_ & 0x00000004) != 0) {
size += 2 + ProtoSink.computeBytesSizeNoTag(nextPackage);
}
if ((bitField0_ & 0x00000008) != 0) {
size += (1 * buildRewards.length()) + ProtoSink.computeRepeatedMessageSizeNoTag(buildRewards);
}
return size;
}
@Override
@SuppressWarnings("fallthrough")
public AssistGroupRewardResp mergeFrom(final ProtoSource input) throws IOException {
// Enabled Fall-Through Optimization (QuickBuffers)
int tag = input.readTag();
while (true) {
switch (tag) {
case 10: {
// change
input.readMessage(change);
bitField0_ |= 0x00000001;
tag = input.readTag();
if (tag != 26) {
break;
}
}
case 26: {
// buildInfo
input.readMessage(buildInfo);
bitField0_ |= 0x00000002;
tag = input.readTag();
if (tag != 16378) {
break;
}
}
case 16378: {
// nextPackage
input.readBytes(nextPackage);
bitField0_ |= 0x00000004;
tag = input.readTag();
if (tag != 18) {
break;
}
}
case 18: {
// buildRewards
tag = input.readRepeatedMessage(buildRewards, tag);
bitField0_ |= 0x00000008;
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.writeMessage(FieldNames.change, change);
}
if ((bitField0_ & 0x00000002) != 0) {
output.writeMessage(FieldNames.buildInfo, buildInfo);
}
if ((bitField0_ & 0x00000004) != 0) {
output.writeBytes(FieldNames.nextPackage, nextPackage);
}
if ((bitField0_ & 0x00000008) != 0) {
output.writeRepeatedMessage(FieldNames.buildRewards, buildRewards);
}
output.endObject();
}
@Override
public AssistGroupRewardResp mergeFrom(final JsonSource input) throws IOException {
if (!input.beginObject()) {
return this;
}
while (!input.isAtEnd()) {
switch (input.readFieldHash()) {
case 2017198032: {
if (input.isAtField(FieldNames.change)) {
if (!input.trySkipNullValue()) {
input.readMessage(change);
bitField0_ |= 0x00000001;
}
} else {
input.skipUnknownField();
}
break;
}
case 602658844: {
if (input.isAtField(FieldNames.buildInfo)) {
if (!input.trySkipNullValue()) {
input.readMessage(buildInfo);
bitField0_ |= 0x00000002;
}
} else {
input.skipUnknownField();
}
break;
}
case -2082324045: {
if (input.isAtField(FieldNames.nextPackage)) {
if (!input.trySkipNullValue()) {
input.readBytes(nextPackage);
bitField0_ |= 0x00000004;
}
} else {
input.skipUnknownField();
}
break;
}
case 1656054: {
if (input.isAtField(FieldNames.buildRewards)) {
if (!input.trySkipNullValue()) {
input.readRepeatedMessage(buildRewards);
bitField0_ |= 0x00000008;
}
} else {
input.skipUnknownField();
}
break;
}
default: {
input.skipUnknownField();
break;
}
}
}
input.endObject();
return this;
}
@Override
public AssistGroupRewardResp clone() {
return new AssistGroupRewardResp().copyFrom(this);
}
@Override
public boolean isEmpty() {
return ((bitField0_) == 0);
}
public static AssistGroupRewardResp parseFrom(final byte[] data) throws
InvalidProtocolBufferException {
return ProtoMessage.mergeFrom(new AssistGroupRewardResp(), data).checkInitialized();
}
public static AssistGroupRewardResp parseFrom(final ProtoSource input) throws IOException {
return ProtoMessage.mergeFrom(new AssistGroupRewardResp(), input).checkInitialized();
}
public static AssistGroupRewardResp parseFrom(final JsonSource input) throws IOException {
return ProtoMessage.mergeFrom(new AssistGroupRewardResp(), input).checkInitialized();
}
/**
* @return factory for creating AssistGroupRewardResp messages
*/
public static MessageFactory<AssistGroupRewardResp> getFactory() {
return AssistGroupRewardRespFactory.INSTANCE;
}
private enum AssistGroupRewardRespFactory implements MessageFactory<AssistGroupRewardResp> {
INSTANCE;
@Override
public AssistGroupRewardResp create() {
return AssistGroupRewardResp.newInstance();
}
}
/**
* Contains name constants used for serializing JSON
*/
static class FieldNames {
static final FieldName change = FieldName.forField("Change");
static final FieldName buildInfo = FieldName.forField("BuildInfo");
static final FieldName nextPackage = FieldName.forField("NextPackage");
static final FieldName buildRewards = FieldName.forField("BuildRewards");
}
}
}
@@ -0,0 +1,463 @@
// Code generated by protocol buffer compiler. Do not edit!
package emu.nebula.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.RepeatedByte;
public final class QuestAssistRewardReceive {
/**
* Protobuf type {@code AssistQuestReceiveReq}
*/
public static final class AssistQuestReceiveReq extends ProtoMessage<AssistQuestReceiveReq> implements Cloneable {
private static final long serialVersionUID = 0L;
/**
* <code>optional uint32 Group = 1;</code>
*/
private int group;
/**
* <code>optional uint32 Quest = 2;</code>
*/
private int quest;
/**
* <code>optional bytes NextPackage = 2047;</code>
*/
private final RepeatedByte nextPackage = RepeatedByte.newEmptyInstance();
private AssistQuestReceiveReq() {
}
/**
* @return a new empty instance of {@code AssistQuestReceiveReq}
*/
public static AssistQuestReceiveReq newInstance() {
return new AssistQuestReceiveReq();
}
/**
* <code>optional uint32 Group = 1;</code>
* @return whether the group field is set
*/
public boolean hasGroup() {
return (bitField0_ & 0x00000001) != 0;
}
/**
* <code>optional uint32 Group = 1;</code>
* @return this
*/
public AssistQuestReceiveReq clearGroup() {
bitField0_ &= ~0x00000001;
group = 0;
return this;
}
/**
* <code>optional uint32 Group = 1;</code>
* @return the group
*/
public int getGroup() {
return group;
}
/**
* <code>optional uint32 Group = 1;</code>
* @param value the group to set
* @return this
*/
public AssistQuestReceiveReq setGroup(final int value) {
bitField0_ |= 0x00000001;
group = value;
return this;
}
/**
* <code>optional uint32 Quest = 2;</code>
* @return whether the quest field is set
*/
public boolean hasQuest() {
return (bitField0_ & 0x00000002) != 0;
}
/**
* <code>optional uint32 Quest = 2;</code>
* @return this
*/
public AssistQuestReceiveReq clearQuest() {
bitField0_ &= ~0x00000002;
quest = 0;
return this;
}
/**
* <code>optional uint32 Quest = 2;</code>
* @return the quest
*/
public int getQuest() {
return quest;
}
/**
* <code>optional uint32 Quest = 2;</code>
* @param value the quest to set
* @return this
*/
public AssistQuestReceiveReq setQuest(final int value) {
bitField0_ |= 0x00000002;
quest = value;
return this;
}
/**
* <code>optional bytes NextPackage = 2047;</code>
* @return whether the nextPackage field is set
*/
public boolean hasNextPackage() {
return (bitField0_ & 0x00000004) != 0;
}
/**
* <code>optional bytes NextPackage = 2047;</code>
* @return this
*/
public AssistQuestReceiveReq clearNextPackage() {
bitField0_ &= ~0x00000004;
nextPackage.clear();
return this;
}
/**
* <code>optional bytes NextPackage = 2047;</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 #getMutableNextPackage()} if you want to modify it.
*
* @return internal storage object for reading
*/
public RepeatedByte getNextPackage() {
return nextPackage;
}
/**
* <code>optional bytes NextPackage = 2047;</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 RepeatedByte getMutableNextPackage() {
bitField0_ |= 0x00000004;
return nextPackage;
}
/**
* <code>optional bytes NextPackage = 2047;</code>
* @param value the nextPackage to add
* @return this
*/
public AssistQuestReceiveReq addNextPackage(final byte value) {
bitField0_ |= 0x00000004;
nextPackage.add(value);
return this;
}
/**
* <code>optional bytes NextPackage = 2047;</code>
* @param values the nextPackage to add
* @return this
*/
public AssistQuestReceiveReq addAllNextPackage(final byte... values) {
bitField0_ |= 0x00000004;
nextPackage.addAll(values);
return this;
}
/**
* <code>optional bytes NextPackage = 2047;</code>
* @param values the nextPackage to set
* @return this
*/
public AssistQuestReceiveReq setNextPackage(final byte... values) {
bitField0_ |= 0x00000004;
nextPackage.copyFrom(values);
return this;
}
@Override
public AssistQuestReceiveReq copyFrom(final AssistQuestReceiveReq other) {
cachedSize = other.cachedSize;
if ((bitField0_ | other.bitField0_) != 0) {
bitField0_ = other.bitField0_;
group = other.group;
quest = other.quest;
nextPackage.copyFrom(other.nextPackage);
}
return this;
}
@Override
public AssistQuestReceiveReq mergeFrom(final AssistQuestReceiveReq other) {
if (other.isEmpty()) {
return this;
}
cachedSize = -1;
if (other.hasGroup()) {
setGroup(other.group);
}
if (other.hasQuest()) {
setQuest(other.quest);
}
if (other.hasNextPackage()) {
getMutableNextPackage().copyFrom(other.nextPackage);
}
return this;
}
@Override
public AssistQuestReceiveReq clear() {
if (isEmpty()) {
return this;
}
cachedSize = -1;
bitField0_ = 0;
group = 0;
quest = 0;
nextPackage.clear();
return this;
}
@Override
public AssistQuestReceiveReq clearQuick() {
if (isEmpty()) {
return this;
}
cachedSize = -1;
bitField0_ = 0;
nextPackage.clear();
return this;
}
@Override
public boolean equals(Object o) {
if (o == this) {
return true;
}
if (!(o instanceof AssistQuestReceiveReq)) {
return false;
}
AssistQuestReceiveReq other = (AssistQuestReceiveReq) o;
return bitField0_ == other.bitField0_
&& (!hasGroup() || group == other.group)
&& (!hasQuest() || quest == other.quest)
&& (!hasNextPackage() || nextPackage.equals(other.nextPackage));
}
@Override
public void writeTo(final ProtoSink output) throws IOException {
if ((bitField0_ & 0x00000001) != 0) {
output.writeRawByte((byte) 8);
output.writeUInt32NoTag(group);
}
if ((bitField0_ & 0x00000002) != 0) {
output.writeRawByte((byte) 16);
output.writeUInt32NoTag(quest);
}
if ((bitField0_ & 0x00000004) != 0) {
output.writeRawLittleEndian16((short) 32762);
output.writeBytesNoTag(nextPackage);
}
}
@Override
protected int computeSerializedSize() {
int size = 0;
if ((bitField0_ & 0x00000001) != 0) {
size += 1 + ProtoSink.computeUInt32SizeNoTag(group);
}
if ((bitField0_ & 0x00000002) != 0) {
size += 1 + ProtoSink.computeUInt32SizeNoTag(quest);
}
if ((bitField0_ & 0x00000004) != 0) {
size += 2 + ProtoSink.computeBytesSizeNoTag(nextPackage);
}
return size;
}
@Override
@SuppressWarnings("fallthrough")
public AssistQuestReceiveReq mergeFrom(final ProtoSource input) throws IOException {
// Enabled Fall-Through Optimization (QuickBuffers)
int tag = input.readTag();
while (true) {
switch (tag) {
case 8: {
// group
group = input.readUInt32();
bitField0_ |= 0x00000001;
tag = input.readTag();
if (tag != 16) {
break;
}
}
case 16: {
// quest
quest = input.readUInt32();
bitField0_ |= 0x00000002;
tag = input.readTag();
if (tag != 16378) {
break;
}
}
case 16378: {
// nextPackage
input.readBytes(nextPackage);
bitField0_ |= 0x00000004;
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.group, group);
}
if ((bitField0_ & 0x00000002) != 0) {
output.writeUInt32(FieldNames.quest, quest);
}
if ((bitField0_ & 0x00000004) != 0) {
output.writeBytes(FieldNames.nextPackage, nextPackage);
}
output.endObject();
}
@Override
public AssistQuestReceiveReq mergeFrom(final JsonSource input) throws IOException {
if (!input.beginObject()) {
return this;
}
while (!input.isAtEnd()) {
switch (input.readFieldHash()) {
case 69076575: {
if (input.isAtField(FieldNames.group)) {
if (!input.trySkipNullValue()) {
group = input.readUInt32();
bitField0_ |= 0x00000001;
}
} else {
input.skipUnknownField();
}
break;
}
case 78391490: {
if (input.isAtField(FieldNames.quest)) {
if (!input.trySkipNullValue()) {
quest = input.readUInt32();
bitField0_ |= 0x00000002;
}
} else {
input.skipUnknownField();
}
break;
}
case -2082324045: {
if (input.isAtField(FieldNames.nextPackage)) {
if (!input.trySkipNullValue()) {
input.readBytes(nextPackage);
bitField0_ |= 0x00000004;
}
} else {
input.skipUnknownField();
}
break;
}
default: {
input.skipUnknownField();
break;
}
}
}
input.endObject();
return this;
}
@Override
public AssistQuestReceiveReq clone() {
return new AssistQuestReceiveReq().copyFrom(this);
}
@Override
public boolean isEmpty() {
return ((bitField0_) == 0);
}
public static AssistQuestReceiveReq parseFrom(final byte[] data) throws
InvalidProtocolBufferException {
return ProtoMessage.mergeFrom(new AssistQuestReceiveReq(), data).checkInitialized();
}
public static AssistQuestReceiveReq parseFrom(final ProtoSource input) throws IOException {
return ProtoMessage.mergeFrom(new AssistQuestReceiveReq(), input).checkInitialized();
}
public static AssistQuestReceiveReq parseFrom(final JsonSource input) throws IOException {
return ProtoMessage.mergeFrom(new AssistQuestReceiveReq(), input).checkInitialized();
}
/**
* @return factory for creating AssistQuestReceiveReq messages
*/
public static MessageFactory<AssistQuestReceiveReq> getFactory() {
return AssistQuestReceiveReqFactory.INSTANCE;
}
private enum AssistQuestReceiveReqFactory implements MessageFactory<AssistQuestReceiveReq> {
INSTANCE;
@Override
public AssistQuestReceiveReq create() {
return AssistQuestReceiveReq.newInstance();
}
}
/**
* Contains name constants used for serializing JSON
*/
static class FieldNames {
static final FieldName group = FieldName.forField("Group");
static final FieldName quest = FieldName.forField("Quest");
static final FieldName nextPackage = FieldName.forField("NextPackage");
}
}
}
@@ -0,0 +1,530 @@
// Code generated by protocol buffer compiler. Do not edit!
package emu.nebula.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.RepeatedByte;
import us.hebi.quickbuf.RepeatedInt;
public final class QuestWeeklyActiveRewardRecevie {
/**
* Protobuf type {@code QuestWeeklyActiveRewardReceiveResp}
*/
public static final class QuestWeeklyActiveRewardReceiveResp extends ProtoMessage<QuestWeeklyActiveRewardReceiveResp> implements Cloneable {
private static final long serialVersionUID = 0L;
/**
* <code>optional .ChangeInfo Change = 2;</code>
*/
private final Public.ChangeInfo change = Public.ChangeInfo.newInstance();
/**
* <code>optional bytes NextPackage = 2047;</code>
*/
private final RepeatedByte nextPackage = RepeatedByte.newEmptyInstance();
/**
* <code>repeated uint32 ActiveIds = 1;</code>
*/
private final RepeatedInt activeIds = RepeatedInt.newEmptyInstance();
private QuestWeeklyActiveRewardReceiveResp() {
}
/**
* @return a new empty instance of {@code QuestWeeklyActiveRewardReceiveResp}
*/
public static QuestWeeklyActiveRewardReceiveResp newInstance() {
return new QuestWeeklyActiveRewardReceiveResp();
}
/**
* <code>optional .ChangeInfo Change = 2;</code>
* @return whether the change field is set
*/
public boolean hasChange() {
return (bitField0_ & 0x00000001) != 0;
}
/**
* <code>optional .ChangeInfo Change = 2;</code>
* @return this
*/
public QuestWeeklyActiveRewardReceiveResp clearChange() {
bitField0_ &= ~0x00000001;
change.clear();
return this;
}
/**
* <code>optional .ChangeInfo Change = 2;</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 #getMutableChange()} if you want to modify it.
*
* @return internal storage object for reading
*/
public Public.ChangeInfo getChange() {
return change;
}
/**
* <code>optional .ChangeInfo Change = 2;</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 Public.ChangeInfo getMutableChange() {
bitField0_ |= 0x00000001;
return change;
}
/**
* <code>optional .ChangeInfo Change = 2;</code>
* @param value the change to set
* @return this
*/
public QuestWeeklyActiveRewardReceiveResp setChange(final Public.ChangeInfo value) {
bitField0_ |= 0x00000001;
change.copyFrom(value);
return this;
}
/**
* <code>optional bytes NextPackage = 2047;</code>
* @return whether the nextPackage field is set
*/
public boolean hasNextPackage() {
return (bitField0_ & 0x00000002) != 0;
}
/**
* <code>optional bytes NextPackage = 2047;</code>
* @return this
*/
public QuestWeeklyActiveRewardReceiveResp clearNextPackage() {
bitField0_ &= ~0x00000002;
nextPackage.clear();
return this;
}
/**
* <code>optional bytes NextPackage = 2047;</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 #getMutableNextPackage()} if you want to modify it.
*
* @return internal storage object for reading
*/
public RepeatedByte getNextPackage() {
return nextPackage;
}
/**
* <code>optional bytes NextPackage = 2047;</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 RepeatedByte getMutableNextPackage() {
bitField0_ |= 0x00000002;
return nextPackage;
}
/**
* <code>optional bytes NextPackage = 2047;</code>
* @param value the nextPackage to add
* @return this
*/
public QuestWeeklyActiveRewardReceiveResp addNextPackage(final byte value) {
bitField0_ |= 0x00000002;
nextPackage.add(value);
return this;
}
/**
* <code>optional bytes NextPackage = 2047;</code>
* @param values the nextPackage to add
* @return this
*/
public QuestWeeklyActiveRewardReceiveResp addAllNextPackage(final byte... values) {
bitField0_ |= 0x00000002;
nextPackage.addAll(values);
return this;
}
/**
* <code>optional bytes NextPackage = 2047;</code>
* @param values the nextPackage to set
* @return this
*/
public QuestWeeklyActiveRewardReceiveResp setNextPackage(final byte... values) {
bitField0_ |= 0x00000002;
nextPackage.copyFrom(values);
return this;
}
/**
* <code>repeated uint32 ActiveIds = 1;</code>
* @return whether the activeIds field is set
*/
public boolean hasActiveIds() {
return (bitField0_ & 0x00000004) != 0;
}
/**
* <code>repeated uint32 ActiveIds = 1;</code>
* @return this
*/
public QuestWeeklyActiveRewardReceiveResp clearActiveIds() {
bitField0_ &= ~0x00000004;
activeIds.clear();
return this;
}
/**
* <code>repeated uint32 ActiveIds = 1;</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 #getMutableActiveIds()} if you want to modify it.
*
* @return internal storage object for reading
*/
public RepeatedInt getActiveIds() {
return activeIds;
}
/**
* <code>repeated uint32 ActiveIds = 1;</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 getMutableActiveIds() {
bitField0_ |= 0x00000004;
return activeIds;
}
/**
* <code>repeated uint32 ActiveIds = 1;</code>
* @param value the activeIds to add
* @return this
*/
public QuestWeeklyActiveRewardReceiveResp addActiveIds(final int value) {
bitField0_ |= 0x00000004;
activeIds.add(value);
return this;
}
/**
* <code>repeated uint32 ActiveIds = 1;</code>
* @param values the activeIds to add
* @return this
*/
public QuestWeeklyActiveRewardReceiveResp addAllActiveIds(final int... values) {
bitField0_ |= 0x00000004;
activeIds.addAll(values);
return this;
}
@Override
public QuestWeeklyActiveRewardReceiveResp copyFrom(
final QuestWeeklyActiveRewardReceiveResp other) {
cachedSize = other.cachedSize;
if ((bitField0_ | other.bitField0_) != 0) {
bitField0_ = other.bitField0_;
change.copyFrom(other.change);
nextPackage.copyFrom(other.nextPackage);
activeIds.copyFrom(other.activeIds);
}
return this;
}
@Override
public QuestWeeklyActiveRewardReceiveResp mergeFrom(
final QuestWeeklyActiveRewardReceiveResp other) {
if (other.isEmpty()) {
return this;
}
cachedSize = -1;
if (other.hasChange()) {
getMutableChange().mergeFrom(other.change);
}
if (other.hasNextPackage()) {
getMutableNextPackage().copyFrom(other.nextPackage);
}
if (other.hasActiveIds()) {
getMutableActiveIds().addAll(other.activeIds);
}
return this;
}
@Override
public QuestWeeklyActiveRewardReceiveResp clear() {
if (isEmpty()) {
return this;
}
cachedSize = -1;
bitField0_ = 0;
change.clear();
nextPackage.clear();
activeIds.clear();
return this;
}
@Override
public QuestWeeklyActiveRewardReceiveResp clearQuick() {
if (isEmpty()) {
return this;
}
cachedSize = -1;
bitField0_ = 0;
change.clearQuick();
nextPackage.clear();
activeIds.clear();
return this;
}
@Override
public boolean equals(Object o) {
if (o == this) {
return true;
}
if (!(o instanceof QuestWeeklyActiveRewardReceiveResp)) {
return false;
}
QuestWeeklyActiveRewardReceiveResp other = (QuestWeeklyActiveRewardReceiveResp) o;
return bitField0_ == other.bitField0_
&& (!hasChange() || change.equals(other.change))
&& (!hasNextPackage() || nextPackage.equals(other.nextPackage))
&& (!hasActiveIds() || activeIds.equals(other.activeIds));
}
@Override
public void writeTo(final ProtoSink output) throws IOException {
if ((bitField0_ & 0x00000001) != 0) {
output.writeRawByte((byte) 18);
output.writeMessageNoTag(change);
}
if ((bitField0_ & 0x00000002) != 0) {
output.writeRawLittleEndian16((short) 32762);
output.writeBytesNoTag(nextPackage);
}
if ((bitField0_ & 0x00000004) != 0) {
for (int i = 0; i < activeIds.length(); i++) {
output.writeRawByte((byte) 8);
output.writeUInt32NoTag(activeIds.array()[i]);
}
}
}
@Override
protected int computeSerializedSize() {
int size = 0;
if ((bitField0_ & 0x00000001) != 0) {
size += 1 + ProtoSink.computeMessageSizeNoTag(change);
}
if ((bitField0_ & 0x00000002) != 0) {
size += 2 + ProtoSink.computeBytesSizeNoTag(nextPackage);
}
if ((bitField0_ & 0x00000004) != 0) {
size += (1 * activeIds.length()) + ProtoSink.computeRepeatedUInt32SizeNoTag(activeIds);
}
return size;
}
@Override
@SuppressWarnings("fallthrough")
public QuestWeeklyActiveRewardReceiveResp mergeFrom(final ProtoSource input) throws
IOException {
// Enabled Fall-Through Optimization (QuickBuffers)
int tag = input.readTag();
while (true) {
switch (tag) {
case 18: {
// change
input.readMessage(change);
bitField0_ |= 0x00000001;
tag = input.readTag();
if (tag != 16378) {
break;
}
}
case 16378: {
// nextPackage
input.readBytes(nextPackage);
bitField0_ |= 0x00000002;
tag = input.readTag();
if (tag != 10) {
break;
}
}
case 10: {
// activeIds [packed=true]
input.readPackedUInt32(activeIds, tag);
bitField0_ |= 0x00000004;
tag = input.readTag();
if (tag != 0) {
break;
}
}
case 0: {
return this;
}
default: {
if (!input.skipField(tag)) {
return this;
}
tag = input.readTag();
break;
}
case 8: {
// activeIds [packed=false]
tag = input.readRepeatedUInt32(activeIds, tag);
bitField0_ |= 0x00000004;
break;
}
}
}
}
@Override
public void writeTo(final JsonSink output) throws IOException {
output.beginObject();
if ((bitField0_ & 0x00000001) != 0) {
output.writeMessage(FieldNames.change, change);
}
if ((bitField0_ & 0x00000002) != 0) {
output.writeBytes(FieldNames.nextPackage, nextPackage);
}
if ((bitField0_ & 0x00000004) != 0) {
output.writeRepeatedUInt32(FieldNames.activeIds, activeIds);
}
output.endObject();
}
@Override
public QuestWeeklyActiveRewardReceiveResp mergeFrom(final JsonSource input) throws IOException {
if (!input.beginObject()) {
return this;
}
while (!input.isAtEnd()) {
switch (input.readFieldHash()) {
case 2017198032: {
if (input.isAtField(FieldNames.change)) {
if (!input.trySkipNullValue()) {
input.readMessage(change);
bitField0_ |= 0x00000001;
}
} else {
input.skipUnknownField();
}
break;
}
case -2082324045: {
if (input.isAtField(FieldNames.nextPackage)) {
if (!input.trySkipNullValue()) {
input.readBytes(nextPackage);
bitField0_ |= 0x00000002;
}
} else {
input.skipUnknownField();
}
break;
}
case -2086528590: {
if (input.isAtField(FieldNames.activeIds)) {
if (!input.trySkipNullValue()) {
input.readRepeatedUInt32(activeIds);
bitField0_ |= 0x00000004;
}
} else {
input.skipUnknownField();
}
break;
}
default: {
input.skipUnknownField();
break;
}
}
}
input.endObject();
return this;
}
@Override
public QuestWeeklyActiveRewardReceiveResp clone() {
return new QuestWeeklyActiveRewardReceiveResp().copyFrom(this);
}
@Override
public boolean isEmpty() {
return ((bitField0_) == 0);
}
public static QuestWeeklyActiveRewardReceiveResp parseFrom(final byte[] data) throws
InvalidProtocolBufferException {
return ProtoMessage.mergeFrom(new QuestWeeklyActiveRewardReceiveResp(), data).checkInitialized();
}
public static QuestWeeklyActiveRewardReceiveResp parseFrom(final ProtoSource input) throws
IOException {
return ProtoMessage.mergeFrom(new QuestWeeklyActiveRewardReceiveResp(), input).checkInitialized();
}
public static QuestWeeklyActiveRewardReceiveResp parseFrom(final JsonSource input) throws
IOException {
return ProtoMessage.mergeFrom(new QuestWeeklyActiveRewardReceiveResp(), input).checkInitialized();
}
/**
* @return factory for creating QuestWeeklyActiveRewardReceiveResp messages
*/
public static MessageFactory<QuestWeeklyActiveRewardReceiveResp> getFactory() {
return QuestWeeklyActiveRewardReceiveRespFactory.INSTANCE;
}
private enum QuestWeeklyActiveRewardReceiveRespFactory implements MessageFactory<QuestWeeklyActiveRewardReceiveResp> {
INSTANCE;
@Override
public QuestWeeklyActiveRewardReceiveResp create() {
return QuestWeeklyActiveRewardReceiveResp.newInstance();
}
}
/**
* Contains name constants used for serializing JSON
*/
static class FieldNames {
static final FieldName change = FieldName.forField("Change");
static final FieldName nextPackage = FieldName.forField("NextPackage");
static final FieldName activeIds = FieldName.forField("ActiveIds");
}
}
}
@@ -0,0 +1,5 @@
// Code generated by protocol buffer compiler. Do not edit!
package emu.nebula.proto;
public final class QuestWeeklyRewardRecevie {
}
@@ -1262,6 +1262,11 @@ public final class ScoreBossRank {
*/
private int levelScore;
/**
* <code>optional uint32 LevelId = 4;</code>
*/
private int levelId;
/**
* <code>optional bytes NextPackage = 2047;</code>
*/
@@ -1356,12 +1361,49 @@ public final class ScoreBossRank {
return this;
}
/**
* <code>optional uint32 LevelId = 4;</code>
* @return whether the levelId field is set
*/
public boolean hasLevelId() {
return (bitField0_ & 0x00000004) != 0;
}
/**
* <code>optional uint32 LevelId = 4;</code>
* @return this
*/
public ScoreBossRankTeam clearLevelId() {
bitField0_ &= ~0x00000004;
levelId = 0;
return this;
}
/**
* <code>optional uint32 LevelId = 4;</code>
* @return the levelId
*/
public int getLevelId() {
return levelId;
}
/**
* <code>optional uint32 LevelId = 4;</code>
* @param value the levelId to set
* @return this
*/
public ScoreBossRankTeam setLevelId(final int value) {
bitField0_ |= 0x00000004;
levelId = value;
return this;
}
/**
* <code>optional bytes NextPackage = 2047;</code>
* @return whether the nextPackage field is set
*/
public boolean hasNextPackage() {
return (bitField0_ & 0x00000004) != 0;
return (bitField0_ & 0x00000008) != 0;
}
/**
@@ -1369,7 +1411,7 @@ public final class ScoreBossRank {
* @return this
*/
public ScoreBossRankTeam clearNextPackage() {
bitField0_ &= ~0x00000004;
bitField0_ &= ~0x00000008;
nextPackage.clear();
return this;
}
@@ -1398,7 +1440,7 @@ public final class ScoreBossRank {
* @return internal storage object for modifications
*/
public RepeatedByte getMutableNextPackage() {
bitField0_ |= 0x00000004;
bitField0_ |= 0x00000008;
return nextPackage;
}
@@ -1408,7 +1450,7 @@ public final class ScoreBossRank {
* @return this
*/
public ScoreBossRankTeam addNextPackage(final byte value) {
bitField0_ |= 0x00000004;
bitField0_ |= 0x00000008;
nextPackage.add(value);
return this;
}
@@ -1419,7 +1461,7 @@ public final class ScoreBossRank {
* @return this
*/
public ScoreBossRankTeam addAllNextPackage(final byte... values) {
bitField0_ |= 0x00000004;
bitField0_ |= 0x00000008;
nextPackage.addAll(values);
return this;
}
@@ -1430,7 +1472,7 @@ public final class ScoreBossRank {
* @return this
*/
public ScoreBossRankTeam setNextPackage(final byte... values) {
bitField0_ |= 0x00000004;
bitField0_ |= 0x00000008;
nextPackage.copyFrom(values);
return this;
}
@@ -1440,7 +1482,7 @@ public final class ScoreBossRank {
* @return whether the chars field is set
*/
public boolean hasChars() {
return (bitField0_ & 0x00000008) != 0;
return (bitField0_ & 0x00000010) != 0;
}
/**
@@ -1448,7 +1490,7 @@ public final class ScoreBossRank {
* @return this
*/
public ScoreBossRankTeam clearChars() {
bitField0_ &= ~0x00000008;
bitField0_ &= ~0x00000010;
chars.clear();
return this;
}
@@ -1477,7 +1519,7 @@ public final class ScoreBossRank {
* @return internal storage object for modifications
*/
public RepeatedMessage<ScoreBossRankChar> getMutableChars() {
bitField0_ |= 0x00000008;
bitField0_ |= 0x00000010;
return chars;
}
@@ -1487,7 +1529,7 @@ public final class ScoreBossRank {
* @return this
*/
public ScoreBossRankTeam addChars(final ScoreBossRankChar value) {
bitField0_ |= 0x00000008;
bitField0_ |= 0x00000010;
chars.add(value);
return this;
}
@@ -1498,7 +1540,7 @@ public final class ScoreBossRank {
* @return this
*/
public ScoreBossRankTeam addAllChars(final ScoreBossRankChar... values) {
bitField0_ |= 0x00000008;
bitField0_ |= 0x00000010;
chars.addAll(values);
return this;
}
@@ -1510,6 +1552,7 @@ public final class ScoreBossRank {
bitField0_ = other.bitField0_;
buildScore = other.buildScore;
levelScore = other.levelScore;
levelId = other.levelId;
nextPackage.copyFrom(other.nextPackage);
chars.copyFrom(other.chars);
}
@@ -1528,6 +1571,9 @@ public final class ScoreBossRank {
if (other.hasLevelScore()) {
setLevelScore(other.levelScore);
}
if (other.hasLevelId()) {
setLevelId(other.levelId);
}
if (other.hasNextPackage()) {
getMutableNextPackage().copyFrom(other.nextPackage);
}
@@ -1546,6 +1592,7 @@ public final class ScoreBossRank {
bitField0_ = 0;
buildScore = 0;
levelScore = 0;
levelId = 0;
nextPackage.clear();
chars.clear();
return this;
@@ -1575,6 +1622,7 @@ public final class ScoreBossRank {
return bitField0_ == other.bitField0_
&& (!hasBuildScore() || buildScore == other.buildScore)
&& (!hasLevelScore() || levelScore == other.levelScore)
&& (!hasLevelId() || levelId == other.levelId)
&& (!hasNextPackage() || nextPackage.equals(other.nextPackage))
&& (!hasChars() || chars.equals(other.chars));
}
@@ -1590,10 +1638,14 @@ public final class ScoreBossRank {
output.writeUInt32NoTag(levelScore);
}
if ((bitField0_ & 0x00000004) != 0) {
output.writeRawByte((byte) 32);
output.writeUInt32NoTag(levelId);
}
if ((bitField0_ & 0x00000008) != 0) {
output.writeRawLittleEndian16((short) 32762);
output.writeBytesNoTag(nextPackage);
}
if ((bitField0_ & 0x00000008) != 0) {
if ((bitField0_ & 0x00000010) != 0) {
for (int i = 0; i < chars.length(); i++) {
output.writeRawByte((byte) 18);
output.writeMessageNoTag(chars.get(i));
@@ -1611,9 +1663,12 @@ public final class ScoreBossRank {
size += 1 + ProtoSink.computeUInt32SizeNoTag(levelScore);
}
if ((bitField0_ & 0x00000004) != 0) {
size += 2 + ProtoSink.computeBytesSizeNoTag(nextPackage);
size += 1 + ProtoSink.computeUInt32SizeNoTag(levelId);
}
if ((bitField0_ & 0x00000008) != 0) {
size += 2 + ProtoSink.computeBytesSizeNoTag(nextPackage);
}
if ((bitField0_ & 0x00000010) != 0) {
size += (1 * chars.length()) + ProtoSink.computeRepeatedMessageSizeNoTag(chars);
}
return size;
@@ -1640,6 +1695,15 @@ public final class ScoreBossRank {
levelScore = input.readUInt32();
bitField0_ |= 0x00000002;
tag = input.readTag();
if (tag != 32) {
break;
}
}
case 32: {
// levelId
levelId = input.readUInt32();
bitField0_ |= 0x00000004;
tag = input.readTag();
if (tag != 16378) {
break;
}
@@ -1647,7 +1711,7 @@ public final class ScoreBossRank {
case 16378: {
// nextPackage
input.readBytes(nextPackage);
bitField0_ |= 0x00000004;
bitField0_ |= 0x00000008;
tag = input.readTag();
if (tag != 18) {
break;
@@ -1656,7 +1720,7 @@ public final class ScoreBossRank {
case 18: {
// chars
tag = input.readRepeatedMessage(chars, tag);
bitField0_ |= 0x00000008;
bitField0_ |= 0x00000010;
if (tag != 0) {
break;
}
@@ -1685,9 +1749,12 @@ public final class ScoreBossRank {
output.writeUInt32(FieldNames.levelScore, levelScore);
}
if ((bitField0_ & 0x00000004) != 0) {
output.writeBytes(FieldNames.nextPackage, nextPackage);
output.writeUInt32(FieldNames.levelId, levelId);
}
if ((bitField0_ & 0x00000008) != 0) {
output.writeBytes(FieldNames.nextPackage, nextPackage);
}
if ((bitField0_ & 0x00000010) != 0) {
output.writeRepeatedMessage(FieldNames.chars, chars);
}
output.endObject();
@@ -1722,11 +1789,22 @@ public final class ScoreBossRank {
}
break;
}
case 1734437791: {
if (input.isAtField(FieldNames.levelId)) {
if (!input.trySkipNullValue()) {
levelId = input.readUInt32();
bitField0_ |= 0x00000004;
}
} else {
input.skipUnknownField();
}
break;
}
case -2082324045: {
if (input.isAtField(FieldNames.nextPackage)) {
if (!input.trySkipNullValue()) {
input.readBytes(nextPackage);
bitField0_ |= 0x00000004;
bitField0_ |= 0x00000008;
}
} else {
input.skipUnknownField();
@@ -1737,7 +1815,7 @@ public final class ScoreBossRank {
if (input.isAtField(FieldNames.chars)) {
if (!input.trySkipNullValue()) {
input.readRepeatedMessage(chars);
bitField0_ |= 0x00000008;
bitField0_ |= 0x00000010;
}
} else {
input.skipUnknownField();
@@ -1801,6 +1879,8 @@ public final class ScoreBossRank {
static final FieldName levelScore = FieldName.forField("LevelScore");
static final FieldName levelId = FieldName.forField("LevelId");
static final FieldName nextPackage = FieldName.forField("NextPackage");
static final FieldName chars = FieldName.forField("Chars");
+3
View File
@@ -25,6 +25,7 @@ public class Config {
public int customDataVersion = 0;
public String region = "global";
public String language = "en_US";
public String resourceDir = "./resources";
public String webFilesDir = "./web";
@@ -109,6 +110,8 @@ public class Config {
public boolean skipIntro = false;
// Unlocks all instances (Monolith, Bounty Trials, etc) for players to enter without needing to do the previous levels.
public boolean unlockInstances = true;
// Unlocks all story CGs to use in the showcase
public boolean unlockAllStoryCGs = false;
// How long to wait (in seconds) after the last http request from a session before removing it from the server.
public int sessionTimeout = 300;
// The offset hour for when daily quests are refreshed in UTC. Example: "dailyResetHour = 4" means dailies will be refreshed at UTC+4 12:00 AM every day.
+12 -9
View File
@@ -6,25 +6,26 @@ import emu.nebula.game.inventory.ItemParam;
import emu.nebula.util.WeightedList;
public class GameConstants {
public static final String VERSION = "1.2.0";
public static final String VERSION = "1.4.0";
public static int DATA_VERSION = 0;
// Set data versions for each region
// TODO move this to a json file inside the jar to make it easier to auto-update
static {
RegionConfig.getRegion("global")
.setDataVersion(63);
.setDataVersion(75);
RegionConfig.getRegion("kr")
.setDataVersion(70);
.setDataVersion(82);
RegionConfig.getRegion("jp")
.setDataVersion(66);
.setDataVersion(79);
RegionConfig.getRegion("tw")
.setDataVersion(64);
.setDataVersion(76);
RegionConfig.getRegion("cn")
.setDataVersion(64);
.setDataVersion(77);
}
public static final ZoneId UTC_ZONE = ZoneId.of("UTC");
@@ -32,6 +33,7 @@ public class GameConstants {
public static final String PROTO_BASE_TYPE_URL = "type.googleapis.com/proto.";
public static final int INTRO_GUIDE_ID = 1;
public static final int DEFAULT_HONOR_ID = 111001;
public static final int GOLD_ITEM_ID = 1;
public static final int GEM_ITEM_ID = 2;
@@ -47,6 +49,10 @@ public class GameConstants {
public static final int CHARACTER_MAX_GEM_PRESETS = 3;
public static final int CHARACTER_MAX_GEM_SLOTS = 3;
public static final int CHARACTER_TAG_VANGUARD = 101;
public static final int CHARACTER_TAG_VERSATILE = 102;
public static final int CHARACTER_TAG_SUPPORT = 103;
public static final int MAX_FORMATIONS = 6;
public static final int MAX_SHOWCASE_IDS = 5;
@@ -56,9 +62,6 @@ public class GameConstants {
public static final int MAX_PENDING_FRIENDSHIPS = 30;
public static final int TOWER_COIN_ITEM_ID = 11;
public static final int[] TOWER_COMMON_SUB_NOTE_SKILLS = new int[] {
90011, 90012, 90013, 90014, 90015, 90016, 90017
};
public static final int[] TOWER_EVENTS_IDS = new int[] {
101, 102, 104, 105, 106, 107, 108, 114, 115, 116, 126, 127, 128
};
+1 -1
View File
@@ -227,7 +227,7 @@ public class Nebula {
/**
* Returns the current server time in seconds
*/
public static long getCurrentTime() {
public static long getCurrentServerTime() {
return System.currentTimeMillis() / 1000;
}
@@ -0,0 +1,440 @@
package emu.nebula.command.commands;
import java.util.ArrayList;
import java.util.Collections;
import emu.nebula.GameConstants;
import emu.nebula.command.Command;
import emu.nebula.command.CommandArgs;
import emu.nebula.command.CommandHandler;
import emu.nebula.command.commands.BuildCommand.StarTowerBuildData;
import emu.nebula.data.GameData;
import emu.nebula.game.character.GameCharacter;
import emu.nebula.game.character.GameDisc;
import emu.nebula.game.inventory.ItemParamMap;
import emu.nebula.net.NetMsgId;
import emu.nebula.util.Utils;
import it.unimi.dsi.fastutil.ints.IntArrayList;
@Command(
label = "autobuild",
aliases = {"ab"},
permission = "player.build",
requireTarget = true,
desc = "!autobuild [character/disc/potential/melody ids...] lv[target record level] s[target record score] = Generates a record for the player with the target score/record level"
)
public class AutoBuildCommand implements CommandHandler {
private static final int[] COMMON_SUB_NOTE_SKILLS = new int[] {
90011, 90012, 90013, 90014, 90015, 90016, 90017
};
@Override
public String execute(CommandArgs args) {
// Create record
var target = args.getTarget();
var builder = new StarTowerBuildData(target);
// Parse items
for (String arg : args.getList()) {
int id = Utils.parseSafeInt(arg);
int count = 1;
builder.parseItem(id, count);
}
if (args.getMap() != null) {
for (var entry : args.getMap().int2IntEntrySet()) {
int id = entry.getIntKey();
int count = entry.getIntValue();
builder.parseItem(id, count);
}
}
// Remove extra characters/discs
while (builder.getCharacters().size() > 3) {
builder.getCharacters().removeLast();
}
while (builder.getDiscs().size() > 6) {
builder.getDiscs().removeLast();
}
// Add random characters/discs
if (builder.getCharacters().size() < 3) {
int count = 3 - builder.getCharacters().size();
for (int i = 0; i < count; i++) {
this.pickRandomCharacter(builder);
}
if (builder.getCharacters().size() < 3) {
return "Error: Not enough trekkers in the record";
}
}
if (builder.getDiscs().size() < 6) {
int count = 6 - builder.getDiscs().size();
for (int i = 0; i < count; i++) {
this.pickRandomDisc(builder);
}
}
// Get target level/score
int targetLevel = 0;
int targetScore = 0;
if (args.getSkill() < 0) {
// Default target level is 40
targetLevel = 40;
} else {
targetScore = args.getSkill();
}
if (args.getLevel() > 0) {
// Target level overrides target score.
targetLevel = args.getLevel();
}
// Get target score from record level
if (targetLevel > 0) {
var data = GameData.getStarTowerBuildRankDataTable().get(targetLevel);
if (data != null) {
targetScore = data.getMinGrade();
}
}
// Pick random potentials and sub notes
this.generate(builder, targetScore);
// Create record
var build = builder.toBuild();
// Add to star tower manager
target.getStarTowerManager().addBuild(build);
// Send package to player
target.addNextPackage(NetMsgId.st_import_build_notify, build.toProto());
// Send result to player
String result = "Generated record for " + target.getName();
if (args.getSender() == null) {
result += " (This command may take time to update on the client)";
}
return result;
}
private void pickRandomCharacter(StarTowerBuildData builder) {
// Random list
var list = new ArrayList<GameCharacter>();
// Create list of possible characters to add
var characters = builder.getPlayer().getCharacters().getCharacterCollection()
.stream()
.filter(c -> !builder.getCharacters().contains(c))
.toList();
// Check if record is empty
if (builder.getCharacters().isEmpty()) {
// Get random vanguard trekker
for (var character : characters) {
if (character.getData().getDes().getTag().contains(GameConstants.CHARACTER_TAG_VANGUARD)) {
list.add(character);
}
}
// Add any trekker if we dont have any vanguard trekkers
if (list.isEmpty()) {
list.addAll(characters);
}
} else {
// Get element of main trekker
var main = builder.getCharacters().get(0);
var element = main.getElementType();
// Get trekkers of the same element
for (var character : characters) {
if (character.getData().getElementType() == element) {
list.add(character);
}
}
// Add any trekker if we dont have any trekkers of the same element
if (list.isEmpty()) {
list.addAll(characters);
}
// Shuffle list to make it random
Collections.shuffle(list);
// Add first support trekker we find
for (var character : list) {
if (character.getData().getDes().getTag().contains(GameConstants.CHARACTER_TAG_SUPPORT)) {
builder.getCharacters().add(character);
return;
}
}
// If we have no support trekkers, then we look for versatile trekkers
for (var character : list) {
if (character.getData().getDes().getTag().contains(GameConstants.CHARACTER_TAG_VERSATILE)) {
builder.getCharacters().add(character);
return;
}
}
}
// If we have no versatile or support trekkers, add a random trekker from the remaining list
if (list.size() > 0) {
builder.getCharacters().add(Utils.randomElement(list));
}
}
private void pickRandomDisc(StarTowerBuildData builder) {
// Get element of main trekker
var main = builder.getCharacters().get(0);
var element = main.getElementType();
// Random list
var list = new ArrayList<GameDisc>();
// Create list of possible discs to add
var discs = builder.getPlayer().getCharacters().getDiscCollection()
.stream()
.filter(d -> !builder.getDiscs().contains(d))
.toList();
// Get discs of the same element
for (var disc : discs) {
if (disc.getData().getElementType() == element) {
list.add(disc);
}
}
if (list.isEmpty()) {
list.addAll(discs);
}
// End early if list is still empty
if (list.isEmpty()) {
return;
}
// Shuffle list to make it random
Collections.shuffle(list);
// Find random disc
for (var disc : list) {
var item = GameData.getItemDataTable().get(disc.getDiscId());
if (item.getRarity() == 1) {
builder.getDiscs().add(disc);
return;
}
}
for (var disc : list) {
var item = GameData.getItemDataTable().get(disc.getDiscId());
if (item.getRarity() == 2) {
builder.getDiscs().add(disc);
return;
}
}
// Just add the first disc that we can find
builder.getDiscs().add(list.get(0));
}
private void generate(StarTowerBuildData builder, int targetScore) {
// Get possible sub notes
int subNoteScore = (int) (targetScore * .4D);
// Get possible drops
var drops = new IntArrayList();
for (var character : builder.getCharacters()) {
var element = character.getData().getElementType();
if (element.getSubNoteSkillItemId() == 0) {
continue;
}
if (!drops.contains(element.getSubNoteSkillItemId())) {
drops.add(element.getSubNoteSkillItemId());
}
}
for (var disc : builder.getDiscs()) {
var element = disc.getData().getElementType();
if (element.getSubNoteSkillItemId() == 0) {
continue;
}
if (!drops.contains(element.getSubNoteSkillItemId())) {
drops.add(element.getSubNoteSkillItemId());
}
}
for (int id : COMMON_SUB_NOTE_SKILLS) {
drops.add(id);
}
// Randomize sub note ids
Collections.shuffle(drops);
// Distribute sub notes randomly
int amount = (int) Math.ceil(subNoteScore / 15D);
int totalSubNotes = amount;
// Allocate budget for each sub note
var budget = new ItemParamMap();
double totalValue = 0;
for (int subNote : drops) {
int value = Utils.randomRange(1, 10);
budget.add(subNote, value);
totalValue += value;
}
// Add random sub notes
for (int subNote : drops) {
// Get budgeted value
int value = budget.get(subNote);
int count = (int) Math.ceil((value / totalValue) * totalSubNotes);
// Get current sub notes
int cur = builder.getBuild().getSubNoteSkills().get(subNote);
int max = Math.max(99 - cur, 0);
// Clamp
count = Math.min(Math.min(count, amount), max);
amount -= count;
// Add sub notes
builder.getBuild().getSubNoteSkills().add(subNote, count);
}
// Add leftover sub notes
if (amount > 0) {
// Randomize again
Collections.shuffle(drops);
// Add to first sub note that has less than 99
for (int subNote : drops) {
// End if we have no more sub notes to give
if (amount <= 0) {
break;
}
// Get current sub notes
int cur = builder.getBuild().getSubNoteSkills().get(subNote);
if (cur >= 99) {
continue;
}
// Add
int count = Math.min(99 - cur, amount);
amount -= count;
builder.getBuild().getSubNoteSkills().add(subNote, count);
}
}
// Calcluate score
builder.toBuild().calculateScore();
// Get target potential score
int potentialScore = Math.max(targetScore - builder.getBuild().getScore(), 0);
// Init weighted list of characters
var characters = new ArrayList<GameCharacter>();
characters.add(builder.getCharacters().get(0));
characters.add(builder.getCharacters().get(0)); // Main character gets an extra chance to get more potentials
characters.add(builder.getCharacters().get(1));
characters.add(builder.getCharacters().get(2));
Collections.shuffle(characters);
// Get current amount of special potentials
var specialCounter = new ItemParamMap();
for (var entry : builder.getBuild().getPotentials()) {
var potential = GameData.getPotentialDataTable().get(entry.getIntKey());
if (potential == null) continue;
if (potential.isSpecial()) {
specialCounter.add(potential.getCharId(), 1);
}
}
// Cache main trekker
var main = builder.getCharacters().get(0);
// Get random potentials
while (potentialScore > 0 && !characters.isEmpty()) {
// Get random character
var character = Utils.randomElement(characters);
// Get character potential data
var data = GameData.getCharPotentialDataTable().get(character.getCharId());
if (data == null) {
break;
}
// Check if we should give a special potential
int sp = specialCounter.get(character.getCharId());
boolean special = false;
if (sp < 2 && potentialScore >= 180) {
special = Utils.randomChance(.25);
}
if (special) {
specialCounter.add(character.getCharId(), 1);
}
// Get possible potential list
var list = data.getPotentialList(main == character, special);
// Remove potentials we already have maxed out
var potentials = new IntArrayList();
for (int id : list) {
// Get potential data
var potential = GameData.getPotentialDataTable().get(id);
if (potential == null) continue;
// Filter out max level ones
int curLevel = builder.getBuild().getPotentials().get(id);
int maxLevel = potential.getMaxLevel();
if (curLevel >= maxLevel) {
continue;
}
// Add
potentials.add(id);
}
// Remove character if we dont have any possible potentials for it
if (potentials.isEmpty()) {
characters.removeIf(c -> c == character);
continue;
}
// Get random potential
int id = Utils.randomElement(potentials);
var potential = GameData.getPotentialDataTable().get(id);
// Add
builder.getBuild().getPotentials().add(id, 1);
// Decrement score
potentialScore -= potential.getBuildScore(1);
}
}
}
@@ -0,0 +1,115 @@
package emu.nebula.command.commands;
import emu.nebula.Nebula;
import emu.nebula.command.Command;
import emu.nebula.command.CommandArgs;
import emu.nebula.command.CommandHandler;
import emu.nebula.game.player.Player;
import emu.nebula.util.Utils;
import java.util.Locale;
@Command(label = "ban",
permission = "admin.ban",
desc = """
!ban {all | ip | uid} [player uid | ip] (end timestamp) (reason) - Ban a player\
- all mode bans both the player object and their IP address by UID, so the next parameter should be UID instead of IP
- ip mode can only ban IP addresses, so the next parameter should be an IP
- uid mode can only ban UIDs, so the next parameter should be a UID
- If you don't fill in the end timestamp, it will be permanently banned by default\
""")
public class BanCommand implements CommandHandler {
@Override
public String execute(CommandArgs args) {
if (args.size() < 2) {
return "Invalid amount of args";
}
int bannedUid = 0;
long banEndTime = 0;
String bannedIp = null;
String reason = null;
String mode = args.get(0).toLowerCase(Locale.ROOT);
switch (args.size()) {
case 4:
reason = args.get(3);
case 3: {
try {
banEndTime = Long.parseLong(args.get(2));
} catch (NumberFormatException ignored) {
return "Unable to parse timestamp.";
}
}
case 2: {
if (mode.equals("ip")) {
bannedIp = args.get(1);
} else {
try {
bannedUid = Integer.parseInt(args.get(1));
} catch (NumberFormatException ignored) {
return "Unable to parse uid.";
}
}
}
case 1: {
if (!mode.equals("all") && !mode.equals("uid") && !mode.equals("ip"))
return "Unable to parse mode.";
}
default: break;
}
if (banEndTime != 0 && banEndTime < System.currentTimeMillis()) {
return "Failed, the end timestamp must be greater than the current time";
}
var banModule = Nebula.getGameContext().getBanModule();
Player player;
if (!mode.equals("ip")) {
player = Nebula.getGameContext().getPlayerModule().getPlayer(bannedUid);
if (player == null) {
return "Failed, player not found.";
}
}
switch (mode) {
case "all" -> {
banModule.banPlayer(
bannedUid,
banEndTime,
reason,
true,
args.getSender() != null ? String.valueOf(args.getSender().getUid()) : "Console");
return "Banned player all mode " + bannedUid + " until " + Utils.formatTimestamp(banEndTime) +
(reason != null ? " (" + reason + ")" : "");
}
case "ip" -> {
banModule.banIp(
bannedIp,
banEndTime,
reason,
args.getSender() != null ? String.valueOf(args.getSender().getUid()) : "Console");
return "Banned ip " + bannedIp + " until " + Utils.formatTimestamp(banEndTime) +
(reason != null ? " (" + reason + ")" : "");
}
case "uid" -> {
banModule.banPlayer(
bannedUid,
banEndTime,
reason,
false,
args.getSender() != null ? String.valueOf(args.getSender().getUid()) : "Console");
return "Banned player " + bannedUid + " until " + Utils.formatTimestamp(banEndTime) +
(reason != null ? " (" + reason + ")" : "");
}
default -> {
return "Ban sub command not found";
}
}
}
}
@@ -35,7 +35,7 @@ public class BuildCommand implements CommandHandler {
int id = Utils.parseSafeInt(arg);
int count = 1;
this.parseItem(builder, id, count);
builder.parseItem(id, count);
}
if (args.getMap() != null) {
@@ -43,7 +43,7 @@ public class BuildCommand implements CommandHandler {
int id = entry.getIntKey();
int count = entry.getIntValue();
this.parseItem(builder, id, count);
builder.parseItem(id, count);
}
}
@@ -60,16 +60,36 @@ public class BuildCommand implements CommandHandler {
var build = builder.toBuild();
// Add to star tower manager
target.getStarTowerManager().getBuilds().put(build.getUid(), build);
target.getStarTowerManager().addBuild(build);
// Send package to player
target.addNextPackage(NetMsgId.st_import_build_notify, build.toProto());
// Send result to player
return "Created record for " + target.getName() + " (This command make take time to update on the client)";
String result = "Created record for " + target.getName();
if (args.getSender() == null) {
result += " (This command may take time to update on the client)";
}
private void parseItem(StarTowerBuildData builder, int id, int count) {
return result;
}
@Getter
public static class StarTowerBuildData {
private Player player;
private StarTowerBuild build;
private List<GameCharacter> characters;
private List<GameDisc> discs;
public StarTowerBuildData(Player player) {
this.player = player;
this.build = new StarTowerBuild(player);
this.characters = new ArrayList<>();
this.discs = new ArrayList<>();
}
public void parseItem(int id, int count) {
// Get item data
var itemData = GameData.getItemDataTable().get(id);
if (itemData == null) {
@@ -82,30 +102,30 @@ public class BuildCommand implements CommandHandler {
// Parse by item id
switch (itemData.getItemSubType()) {
case Char -> {
var character = builder.getPlayer().getCharacters().getCharacterById(id);
var character = this.getPlayer().getCharacters().getCharacterById(id);
if (character == null || !character.getData().isAvailable()) {
break;
}
builder.addCharacter(character);
this.addCharacter(character);
}
case Disc -> {
var disc = builder.getPlayer().getCharacters().getDiscById(id);
var disc = this.getPlayer().getCharacters().getDiscById(id);
if (disc == null || !disc.getData().isAvailable()) {
break;
}
builder.addDisc(disc);
this.addDisc(disc);
}
case Potential, SpecificPotential -> {
var potentialData = GameData.getPotentialDataTable().get(id);
if (potentialData == null) break;
int level = Math.min(count, potentialData.getMaxLevel());
builder.getBuild().getPotentials().add(id, level);
this.getBuild().getPotentials().add(id, level);
}
case SubNoteSkill -> {
builder.getBuild().getSubNoteSkills().add(id, count);
this.getBuild().getSubNoteSkills().add(id, count);
}
default -> {
// Ignored
@@ -113,20 +133,6 @@ public class BuildCommand implements CommandHandler {
}
}
@Getter
private static class StarTowerBuildData {
private Player player;
private StarTowerBuild build;
private List<GameCharacter> characters;
private List<GameDisc> discs;
public StarTowerBuildData(Player player) {
this.player = player;
this.build = new StarTowerBuild(player);
this.characters = new ArrayList<>();
this.discs = new ArrayList<>();
}
public void addCharacter(GameCharacter character) {
if (this.characters.contains(character)) {
return;
@@ -83,6 +83,13 @@ public class CharacterCommand implements CommandHandler {
}
player.addNextPackage(NetMsgId.chars_final_notify, proto);
// Trigger achievements
if (args.getLevel() > 0 && args.getLevel() <= 90) {
player.getCharacters().triggerCharacterAchievements(modified, args.getLevel());
}
// Result
return "Updated " + modified.size() + " character(s)";
}
}
@@ -0,0 +1,104 @@
package emu.nebula.command.commands;
import emu.nebula.util.Utils;
import it.unimi.dsi.fastutil.ints.IntArrayList;
import emu.nebula.game.character.CharacterGem;
import emu.nebula.game.character.GameCharacter;
import emu.nebula.net.NetMsgId;
import emu.nebula.proto.PubilcGm.Chars;
import emu.nebula.command.Command;
import emu.nebula.command.CommandArgs;
import emu.nebula.command.CommandHandler;
import emu.nebula.data.GameData;
@Command(
label = "emblem",
aliases = {"e", "gem"},
permission = "player.emblem",
requireTarget = true,
desc = "!emblem [characterId] [emblem slot] [attribute value ids....]"
)
public class EmblemCommand implements CommandHandler {
@Override
public String execute(CommandArgs args) {
// Init
var player = args.getTarget();
// Sanity check
if (args.getList().size() < 6) {
return "Error: Not enough args";
}
// Parse args
var charId = Utils.parseSafeInt(args.getList().get(0));
var slotId = Utils.parseSafeInt(args.getList().get(1));
var attributes = new IntArrayList();
for (int i = 2; i < 6; i++) {
int attr = Utils.parseSafeInt(args.getList().get(i));
var data = GameData.getCharGemAttrValueDataTable().get(attr);
if (data == null) {
return "Error: Invalid attribute value id in position " + (i - 2);
}
attributes.add(attr);
}
// Get character
GameCharacter character = player.getCharacters().getCharacterById(charId);
if (character == null) {
return "Error: No trekker selected";
}
// Get gem slot
var slot = character.getGemSlot(slotId);
if (slot == null) {
return "Error: Invalid slot selected";
}
// Get gem
var preset = character.getCurrentGemPreset();
var gem = slot.getGem(preset.getGemIndex(slotId));
if (gem == null) {
if (slot.isFull()) {
// Equip the first gem we can find
preset.setGemIndex(slotId, 0);
gem = slot.getGem(preset.getGemIndex(slotId));
} else {
// Create a new gem and equip it
gem = new CharacterGem(attributes);
// Add gem to slot
slot.getGems().add(gem);
// Equip
preset.setGemIndex(slotId, slot.getGems().size() - 1);
}
// Make sure gem exists
if (gem == null) {
return "An unknown error has occured";
}
}
// Replace gem
gem.setAttributes(attributes);
// Save
character.save();
// Encode and send
var proto = Chars.newInstance()
.addList(character.toProto());
player.addNextPackage(NetMsgId.chars_final_notify, proto);
// Result
return "Updated emblem for character";
}
}
@@ -45,7 +45,7 @@ public class GiveAllCommand implements CommandHandler {
// Check sub type
for (ItemDef data : GameData.getItemDataTable()) {
if (!MATERIAL_ITEM_SUBTYPES.contains(data.getItemSubType())) {
if (data.getItemSubType() == null || !MATERIAL_ITEM_SUBTYPES.contains(data.getItemSubType())) {
continue;
}
@@ -84,7 +84,11 @@ public class GiveAllCommand implements CommandHandler {
var disc = target.getCharacters().addDisc(data.getId());
// Set properties
args.setProperties(disc);
boolean shouldSave = args.setProperties(disc);
if (shouldSave) {
disc.save();
}
// Add to change info
change.add(disc.toProto());
@@ -110,7 +114,11 @@ public class GiveAllCommand implements CommandHandler {
var character = target.getCharacters().addCharacter(data.getId());
// Set properties
args.setProperties(character);
boolean shouldSave = args.setProperties(character);
if (shouldSave) {
character.save();
}
// Add to change info
change.add(character.toProto());
@@ -0,0 +1,101 @@
package emu.nebula.command.commands;
import emu.nebula.GameConstants;
import emu.nebula.Nebula;
import emu.nebula.command.Command;
import emu.nebula.command.CommandArgs;
import emu.nebula.command.CommandHandler;
import java.io.File;
import java.lang.management.ManagementFactory;
@Command(label = "status", permission = "admin.status", desc = "!status = Displays server runtime status.")
public class StatusCommand implements CommandHandler {
@Override
public String execute(CommandArgs args) {
var sb = new StringBuilder();
if (args.getRaw().contains("@")) {
if (args.getTarget() == null || !args.getTarget().hasSession()) {
return "Error - Targeted player not found or offline";
}
}
var runtime = Runtime.getRuntime();
var uptimeMs = ManagementFactory.getRuntimeMXBean().getUptime();
double usedMem = (runtime.totalMemory() - runtime.freeMemory()) / 1048576.0;
double maxMem = runtime.maxMemory() / 1048576.0;
int players = 0;
if (Nebula.getGameContext() != null) {
players = Nebula.getGameContext().getPlayerModule().getCachedPlayers().size();
}
var http = Nebula.getHttpServer();
String addr = "-";
String scheme = "http";
int port = 0;
if (http != null) {
addr = http.getServerConfig().getPublicAddress();
port = http.getServerConfig().getPublicPort();
scheme = http.getServerConfig().isUseSSL() ? "https" : "http";
}
sb.append("Server Status\n");
sb.append("Git: ").append(Nebula.getGitHash()).append('\n');
sb.append("Game: ").append(GameConstants.getGameVersion()).append('\n');
sb.append("HTTP: ").append(scheme).append("://").append(addr).append(":").append(port).append('\n');
sb.append("Uptime: ").append(formatUptime(uptimeMs)).append('\n');
sb.append("CPU: ").append(getCpu()).append('\n');
sb.append("Load: ").append(getLoad()).append('\n');
sb.append("Disk: ").append(getDisk()).append('\n');
sb.append("Memory: ").append(String.format("%.1fMB (max %.1fMB)", usedMem, maxMem)).append('\n');
sb.append("Players: ").append(players);
return sb.toString();
}
private static String formatUptime(long ms) {
long s = ms / 1000;
long h = s / 3600;
long m = (s % 3600) / 60;
long sec = s % 60;
return String.format("%02dh:%02dm:%02ds", h, m, sec);
}
private static String getCpu() {
var os = ManagementFactory.getOperatingSystemMXBean();
double v = -1;
if (os instanceof com.sun.management.OperatingSystemMXBean) {
v = ((com.sun.management.OperatingSystemMXBean) os).getProcessCpuLoad();
}
return v >= 0 ? String.format("%.1f%%", v * 100.0) : "-";
}
private static String getLoad() {
var os = ManagementFactory.getOperatingSystemMXBean();
double v = -1;
if (os instanceof com.sun.management.OperatingSystemMXBean csm) {
v = csm.getCpuLoad();
}
if (v < 0) {
double avg = os.getSystemLoadAverage();
if (avg > 0) {
int cores = Runtime.getRuntime().availableProcessors();
v = Math.min(1.0, avg / cores);
}
}
return v >= 0 ? String.format("%.1f%%", v * 100.0) : "-";
}
private static String getDisk() {
var root = new File(".");
long total = root.getTotalSpace();
long usable = root.getUsableSpace();
if (total <= 0) return "-";
double usedPercent = (double) (total - usable) / (double) total * 100.0;
return String.format("%.1f%%", usedPercent);
}
}
@@ -0,0 +1,81 @@
package emu.nebula.command.commands;
import emu.nebula.Nebula;
import emu.nebula.command.Command;
import emu.nebula.command.CommandArgs;
import emu.nebula.command.CommandHandler;
import emu.nebula.game.ban.BanInfo;
import emu.nebula.game.player.Player;
import java.util.Locale;
@Command(label = "unban", permission = "admin.ban", desc = """
!unban {all | ip | uid} [player uid | ip]\
- all mode unbans both the player object and their IP address by UID, so the next parameter should be UID instead of IP
- ip mode can only unban IP addresses, so the next parameter should be an IP
- uid mode can only unban UIDs, so the next parameter should be a UID\
""")
public class UnbanCommand implements CommandHandler {
@Override
public String execute(CommandArgs args) {
if (args.size() < 2) {
return "Invalid amount of args";
}
int unbannedUid = 0;
String unbannedIp = null;
String mode = args.get(0).toLowerCase(Locale.ROOT);
if (!mode.equals("all") && !mode.equals("uid") && !mode.equals("ip"))
return "Unable to parse mode.";
if (mode.equals("ip")) {
unbannedIp = args.get(1);
} else {
try {
unbannedUid = Integer.parseInt(args.get(1));
} catch (NumberFormatException ignored) {
return "Unable to parse uid.";
}
}
var banModule = Nebula.getGameContext().getBanModule();
Player player = null;
if (!mode.equals("ip")) {
player = Nebula.getGameContext().getPlayerModule().getPlayer(unbannedUid);
if (player == null) {
return "Failed, player not found.";
}
}
switch (mode) {
case "all" -> {
BanInfo banInfo = banModule.getPlayerBanInfo(player.getUid());
banModule.unbanPlayer(player.getUid());
if (banInfo != null) {
unbannedIp = banInfo.getIpAddress();
if (unbannedIp != null)
banModule.unbanIp(unbannedIp);
}
return "Unban a player all mode " + unbannedUid;
} case "uid" -> {
banModule.unbanPlayer(player.getUid());
return "Unban a player " + unbannedUid;
} case "ip" -> {
banModule.unbanIp(unbannedIp);
return "Unban a ip " + unbannedIp;
}
default -> {
// Fallback
return "Unban sub command not found";
}
}
}
}
+24 -2
View File
@@ -11,7 +11,7 @@ import java.util.stream.Collectors;
import it.unimi.dsi.fastutil.ints.*;
import it.unimi.dsi.fastutil.objects.Object2ObjectMap;
import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
import emu.nebula.data.custom.CharGemAttrGroupDef;
import emu.nebula.data.resources.*;
import lombok.Getter;
@@ -93,10 +93,15 @@ public class GameData {
// ===== Story =====
@Getter private static DataTable<StoryDef> StoryDataTable = new DataTable<>();
@Getter private static DataTable<StorySetSectionDef> StorySetSectionDataTable = new DataTable<>();
@Getter private static DataTable<StoryEvidenceDef> StoryEvidenceDataTable = new DataTable<>();
// ===== Daily Quests =====
@Getter private static DataTable<MainScreenCGDef> MainScreenCGDataTable = new DataTable<>();
// ===== Daily/Weekly Quests =====
@Getter private static DataTable<DailyQuestDef> DailyQuestDataTable = new DataTable<>();
@Getter private static DataTable<DailyQuestActiveDef> DailyQuestActiveDataTable = new DataTable<>();
@Getter private static DataTable<WeeklyQuestDef> WeeklyQuestDataTable = new DataTable<>();
@Getter private static DataTable<WeeklyQuestActiveDef> WeeklyQuestActiveDataTable = new DataTable<>();
// ===== Achievements =====
@Getter private static DataTable<AchievementDef> AchievementDataTable = new DataTable<>();
@@ -119,6 +124,7 @@ public class GameData {
@Getter private static DataTable<StarTowerFloorExpDef> StarTowerFloorExpDataTable = new DataTable<>();
@Getter private static DataTable<StarTowerTeamExpDef> StarTowerTeamExpDataTable = new DataTable<>();
@Getter private static DataTable<StarTowerEventDef> StarTowerEventDataTable = new DataTable<>();
@Getter private static DataTable<StarTowerBuildRankDef> StarTowerBuildRankDataTable = new DataTable<>();
@Getter private static DataTable<SubNoteSkillPromoteGroupDef> SubNoteSkillPromoteGroupDataTable = new DataTable<>();
@Getter private static DataTable<PotentialDef> PotentialDataTable = new DataTable<>();
@@ -131,6 +137,7 @@ public class GameData {
// ===== Infinity Tower =====
@Getter private static DataTable<InfinityTowerLevelDef> InfinityTowerLevelDataTable = new DataTable<>();
@Getter private static DataTable<InfinityTowerDifficultyDef> InfinityTowerDifficultyDataTable = new DataTable<>();
// ===== Vampire Survivor =====
@Getter private static DataTable<VampireSurvivorDef> VampireSurvivorDataTable = new DataTable<>();
@@ -149,10 +156,25 @@ public class GameData {
// ===== Activity =====
@Getter private static DataTable<ActivityDef> ActivityDataTable = new DataTable<>();
// Activity: Login Reward
@Getter private static DataTable<LoginRewardGroupControlDef> LoginRewardGroupControlDataTable = new DataTable<>();
// Activity: Tower Defense
@Getter private static DataTable<TowerDefenseLevelDef> TowerDefenseLevelDataTable = new DataTable<>();
// Activity: Trials
@Getter private static DataTable<TrialControlDef> TrialControlDataTable = new DataTable<>();
@Getter private static DataTable<TrialGroupDef> TrialGroupDataTable = new DataTable<>();
// Activity: Levels
@Getter private static DataTable<ActivityLevelsLevelDef> ActivityLevelsLevelDataTable = new DataTable<>();
// Activity: Task
@Getter private static DataTable<ActivityTaskDef> ActivityTaskDataTable = new DataTable<>();
@Getter private static DataTable<ActivityTaskGroupDef> ActivityTaskGroupDataTable = new DataTable<>();
// Activity: Shop
@Getter private static DataTable<ActivityShopDef> ActivityShopDataTable = new DataTable<>();
@Getter private static DataTable<ActivityShopControlDef> ActivityShopControlDataTable = new DataTable<>();
@Getter private static DataTable<ActivityGoodsDef> ActivityGoodsDataTable = new DataTable<>();
}
@@ -0,0 +1,33 @@
package emu.nebula.data.custom;
import emu.nebula.data.BaseDef;
import emu.nebula.data.GameData;
import emu.nebula.data.ResourceType;
import emu.nebula.data.ResourceType.LoadPriority;
import lombok.Getter;
@Getter
@ResourceType(name = "AchievementParam.json", useInternal = true, loadPriority = LoadPriority.LOW)
public class AchievementParamDef extends BaseDef {
private int Id;
private int Param1;
private int ParamCond1;
private int Param2;
private int ParamCond2;
@Override
public int getId() {
return Id;
}
@Override
public void onLoad() {
var achievement = GameData.getAchievementDataTable().get(this.Id);
if (achievement == null) {
return;
}
achievement.setParams(this);
}
}
@@ -1,4 +1,4 @@
package emu.nebula.data.resources;
package emu.nebula.data.custom;
import java.util.List;
import java.util.Map;
@@ -6,6 +6,7 @@ import java.util.Map;
import emu.nebula.data.BaseDef;
import emu.nebula.data.GameData;
import emu.nebula.data.ResourceType;
import emu.nebula.data.resources.CharGemAttrValueDef;
import emu.nebula.util.WeightedList;
import it.unimi.dsi.fastutil.ints.IntArrayList;
import it.unimi.dsi.fastutil.ints.IntList;
@@ -97,7 +98,7 @@ public class CharGemAttrGroupDef extends BaseDef {
this.values = new WeightedList<>();
}
protected void addValue(CharGemAttrValueDef value) {
public void addValue(CharGemAttrValueDef value) {
this.values.add(value.getRarity(), value);
}
@@ -2,7 +2,9 @@ package emu.nebula.data.resources;
import emu.nebula.data.BaseDef;
import emu.nebula.data.ResourceType;
import emu.nebula.data.custom.AchievementParamDef;
import emu.nebula.game.achievement.AchievementHelper;
import emu.nebula.game.achievement.AchievementParamCond;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import lombok.Getter;
@@ -20,43 +22,50 @@ public class AchievementDef extends BaseDef {
private int Qty1;
// Custom params
private transient int param1; // -1 == any, 0 = no param, 1+ = param required
private transient int param2; // -1 == any, 0 = no param, 1+ = param required
private transient int param1;
private transient AchievementParamCond paramCond1;
private transient int param2;
private transient AchievementParamCond paramCond2;
@Override
public int getId() {
return Id;
}
@Deprecated
public void setParams(int param1, int param2) {
this.param1 = param1;
this.param2 = param2;
}
/**
* Checks if this achievement requires params to match
*/
public boolean hasParam1(int param) {
if (this.param1 < 0) {
return false;
} else if (this.param1 == 0) {
return param != 0;
} else {
return true;
}
public void setParams(AchievementParamDef params) {
this.param1 = params.getParam1();
this.param2 = params.getParam2();
this.paramCond1 = AchievementParamCond.getByValue(params.getParamCond1());
this.paramCond2 = AchievementParamCond.getByValue(params.getParamCond2());
}
/**
* Checks if this achievement requires params to match
*/
public boolean hasParam2(int param) {
if (this.param2 < 0) {
return false;
} else if (this.param2 == 0) {
return param != 0;
} else {
return true;
public boolean matchParam1(int value) {
if (this.paramCond1 == null) {
this.paramCond1 = AchievementParamCond.EQUALS;
}
return this.paramCond1.test(this.param1, value);
}
/**
* Checks if this achievement requires params to match
*/
public boolean matchParam2(int value) {
if (this.paramCond2 == null) {
this.paramCond2 = AchievementParamCond.EQUALS;
}
return this.paramCond2.test(this.param2, value);
}
@Override
@@ -0,0 +1,38 @@
package emu.nebula.data.resources;
import emu.nebula.data.BaseDef;
import emu.nebula.data.GameData;
import emu.nebula.data.ResourceType;
import emu.nebula.data.ResourceType.LoadPriority;
import emu.nebula.game.inventory.ItemParamMap;
import lombok.Getter;
@Getter
@ResourceType(name = "ActivityGoods.json", loadPriority = LoadPriority.LOW)
public class ActivityGoodsDef extends BaseDef {
private int Id;
private int ShopId;
private int ItemId;
private int ItemQuantity;
private int MaximumLimit;
private int Price;
private transient ItemParamMap items;
@Override
public int getId() {
return Id;
}
@Override
public void onLoad() {
var shop = GameData.getActivityShopDataTable().get(this.getShopId());
if (shop != null) {
shop.getGoods().put(this.getId(), this);
}
this.items = new ItemParamMap();
this.items.add(this.ItemId, this.ItemQuantity);
}
}
@@ -0,0 +1,65 @@
package emu.nebula.data.resources;
import emu.nebula.data.BaseDef;
import emu.nebula.data.ResourceType;
import emu.nebula.game.instance.InstanceData;
import emu.nebula.game.inventory.ItemRewardList;
import emu.nebula.game.inventory.ItemRewardParam;
import emu.nebula.util.JsonUtils;
import lombok.Getter;
@Getter
@ResourceType(name = "ActivityLevelsLevel.json")
public class ActivityLevelsLevelDef extends BaseDef implements InstanceData {
private int Id;
private int ActivityId;
private int EnergyConsume;
private String CompleteRewardPreview;
private transient ItemRewardList firstRewards;
private transient ItemRewardList rewards;
@Override
public int getId() {
return Id;
}
@Override
public int getNeedWorldClass() {
return 0;
}
@Override
public void onLoad() {
// Init reward lists
this.firstRewards = new ItemRewardList();
this.rewards = new ItemRewardList();
// Parse rewards
var awards = JsonUtils.decodeList(this.CompleteRewardPreview, int[].class);
if (awards == null) {
return;
}
for (int[] award : awards) {
int itemId = award[0];
int min = award[1];
int max = award.length >= 4 ? award[2] : min;
boolean isFirst = award[award.length - 1] == 1;
if (min == -1) {
min = 0;
max = 1;
}
var reward = new ItemRewardParam(itemId, min, max);
if (isFirst) {
this.firstRewards.add(reward);
} else {
this.rewards.add(reward);
}
}
}
}
@@ -0,0 +1,18 @@
package emu.nebula.data.resources;
import emu.nebula.data.BaseDef;
import emu.nebula.data.ResourceType;
import lombok.Getter;
@Getter
@ResourceType(name = "ActivityShopControl.json")
public class ActivityShopControlDef extends BaseDef {
private int Id;
private int[] ShopIds;
@Override
public int getId() {
return Id;
}
}
@@ -0,0 +1,28 @@
package emu.nebula.data.resources;
import emu.nebula.data.BaseDef;
import emu.nebula.data.ResourceType;
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
import lombok.Getter;
@Getter
@ResourceType(name = "ActivityShop.json")
public class ActivityShopDef extends BaseDef {
private int Id;
private int CurrencyItemId;
private int ExchangeItemId;
private double Rate;
private Int2ObjectMap<ActivityGoodsDef> goods;
@Override
public int getId() {
return Id;
}
@Override
public void onLoad() {
this.goods = new Int2ObjectOpenHashMap<>();
}
}
@@ -0,0 +1,40 @@
package emu.nebula.data.resources;
import emu.nebula.data.BaseDef;
import emu.nebula.data.ResourceType;
import emu.nebula.game.inventory.ItemParamMap;
import lombok.Getter;
@Getter
@ResourceType(name = "ActivityTask.json")
public class ActivityTaskDef extends BaseDef {
private int Id;
private int ActivityTaskGroupId;
private int CompleteCond;
private int AimNumShow;
private int Tid1;
private int Qty1;
private int Tid2;
private int Qty2;
private transient ItemParamMap rewards;
@Override
public int getId() {
return Id;
}
@Override
public void onLoad() {
this.rewards = new ItemParamMap();
if (this.Tid1 > 0) {
this.rewards.add(this.Tid1, this.Qty1);
}
if (this.Tid2 > 0) {
this.rewards.add(this.Tid2, this.Qty2);
}
}
}
@@ -0,0 +1,57 @@
package emu.nebula.data.resources;
import emu.nebula.data.BaseDef;
import emu.nebula.data.ResourceType;
import emu.nebula.game.inventory.ItemParamMap;
import lombok.Getter;
@Getter
@ResourceType(name = "ActivityTaskGroup.json")
public class ActivityTaskGroupDef extends BaseDef {
private int Id;
private int ActivityId;
private int Reward1;
private int RewardQty1;
private int Reward2;
private int RewardQty2;
private int Reward3;
private int RewardQty3;
private int Reward4;
private int RewardQty4;
private int Reward5;
private int RewardQty5;
private int Reward6;
private int RewardQty6;
private transient ItemParamMap rewards;
@Override
public int getId() {
return Id;
}
@Override
public void onLoad() {
this.rewards = new ItemParamMap();
if (this.Reward1 > 0) {
this.rewards.add(this.Reward1, this.RewardQty1);
}
if (this.Reward2 > 0) {
this.rewards.add(this.Reward2, this.RewardQty2);
}
if (this.Reward3 > 0) {
this.rewards.add(this.Reward3, this.RewardQty3);
}
if (this.Reward4 > 0) {
this.rewards.add(this.Reward4, this.RewardQty4);
}
if (this.Reward5 > 0) {
this.rewards.add(this.Reward5, this.RewardQty5);
}
if (this.Reward6 > 0) {
this.rewards.add(this.Reward6, this.RewardQty6);
}
}
}
@@ -23,6 +23,11 @@ public class BattlePassQuestDef extends BaseDef implements QuestData {
return Id;
}
@Override
public long getQuestKey() {
return Id;
}
public boolean isDaily() {
return this.Type == 1;
}
@@ -1,7 +1,6 @@
package emu.nebula.data.resources;
import emu.nebula.data.BaseDef;
import emu.nebula.data.GameData;
import emu.nebula.data.ResourceType;
import lombok.Getter;
@@ -17,8 +16,4 @@ public class CharGemDef extends BaseDef {
public int getId() {
return Id;
}
public CharGemSlotControlDef getControlData() {
return GameData.getCharGemSlotControlDataTable().get(this.Type);
}
}
@@ -3,9 +3,10 @@ package emu.nebula.data.resources;
import emu.nebula.data.BaseDef;
import emu.nebula.data.GameData;
import emu.nebula.data.ResourceType;
import emu.nebula.util.CustomIntArray;
import emu.nebula.data.custom.CharGemAttrGroupDef;
import emu.nebula.util.Utils;
import emu.nebula.util.WeightedList;
import emu.nebula.util.ints.CustomIntArray;
import it.unimi.dsi.fastutil.ints.IntList;
import lombok.Getter;
@@ -2,6 +2,8 @@ package emu.nebula.data.resources;
import emu.nebula.data.BaseDef;
import emu.nebula.data.ResourceType;
import it.unimi.dsi.fastutil.ints.IntArrayList;
import it.unimi.dsi.fastutil.ints.IntList;
import lombok.Getter;
@Getter
@@ -19,4 +21,31 @@ public class CharPotentialDef extends BaseDef {
public int getId() {
return Id;
}
public IntList getPotentialList(boolean main, boolean special) {
// Create list
var list = new IntArrayList();
//
if (main) {
if (special) {
list.addElements(0, this.getMasterSpecificPotentialIds());
} else {
list.addElements(0, this.getMasterNormalPotentialIds());
}
} else {
if (special) {
list.addElements(0, this.getAssistSpecificPotentialIds());
} else {
list.addElements(0, this.getAssistNormalPotentialIds());
}
}
if (!special) {
list.addElements(0, this.getCommonPotentialIds());
}
// Complete
return list;
}
}
@@ -11,7 +11,7 @@ import lombok.Getter;
@ResourceType(name = "CharacterDes.json", loadPriority = LoadPriority.LOW)
public class CharacterDesDef extends BaseDef {
private int Id;
private int[] Tag;
private IntOpenHashSet Tag;
private IntOpenHashSet PreferTags;
private IntOpenHashSet HateTags;
@@ -58,7 +58,8 @@ public class GachaDef extends BaseDef {
10000 - storage.getATypeUpProb(),
new GachaPackage(GachaPackageType.A, this.ATypePkg)
);
} if (this.ATypeUpPkg > 0) {
}
if (this.ATypeUpPkg > 0) {
packageA.add(
storage.getATypeUpProb(),
new GachaPackage(GachaPackageType.A_UP, this.ATypeUpPkg)
@@ -70,15 +71,17 @@ public class GachaDef extends BaseDef {
if (this.BTypePkg > 0) {
packageB.add(
10000 - storage.getBTypeUpProb(),
storage.getBTypeProb(),
new GachaPackage(GachaPackageType.B, this.BTypePkg)
);
} else if (this.BGuaranteePkg > 0) {
}
if (this.BGuaranteePkg > 0) {
packageB.add(
10000 - storage.getBTypeUpProb(),
storage.getBTypeGuaranteeProb(),
new GachaPackage(GachaPackageType.B, this.BGuaranteePkg)
);
} if (this.BTypeUpPkg > 0) {
}
if (this.BTypeUpPkg > 0) {
packageB.add(
storage.getBTypeUpProb(),
new GachaPackage(GachaPackageType.B_UP, this.BTypeUpPkg)
@@ -16,6 +16,7 @@ public class GachaStorageDef extends BaseDef {
private int CostQty;
private int ATypeUpProb;
private int BTypeProb;
private int BTypeUpProb;
private int BTypeGuaranteeProb;
@@ -1,6 +1,7 @@
package emu.nebula.data.resources;
import emu.nebula.data.BaseDef;
import emu.nebula.data.GameData;
import emu.nebula.data.ResourceType;
import lombok.Getter;
@@ -9,9 +10,27 @@ import lombok.Getter;
public class HonorDef extends BaseDef {
private int Id;
private int Type;
private int[] Params;
@Override
public int getId() {
return Id;
}
public boolean isValid() {
if (this.Type == 2) {
if (this.Params.length < 1) {
return false;
}
int charId = this.Params[0];
var charData = GameData.getCharacterDataTable().get(charId);
if (charData == null || !charData.isAvailable()) {
return false;
}
}
return true;
}
}
@@ -0,0 +1,19 @@
package emu.nebula.data.resources;
import emu.nebula.data.BaseDef;
import emu.nebula.data.ResourceType;
import lombok.Getter;
@Getter
@ResourceType(name = "InfinityTowerDifficulty.json")
public class InfinityTowerDifficultyDef extends BaseDef {
private int Id;
private int TowerId;
@Override
public int getId() {
return Id;
}
}
@@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.List;
import emu.nebula.data.BaseDef;
import emu.nebula.data.GameData;
import emu.nebula.data.ResourceType;
import emu.nebula.game.inventory.ItemParamMap;
import emu.nebula.game.inventory.ItemRewardParam;
@@ -25,10 +26,15 @@ public class InfinityTowerLevelDef extends BaseDef {
return Id;
}
public int getEnergyConsume() {
public int getTowerId() {
var diff = GameData.getInfinityTowerDifficultyDataTable().get(this.DifficultyId);
if (diff == null) {
return 0;
}
return diff.getTowerId();
}
public ItemParamMap generateRewards() {
var map = new ItemParamMap();
@@ -0,0 +1,36 @@
package emu.nebula.data.resources;
import emu.nebula.data.BaseDef;
import emu.nebula.data.ResourceType;
import emu.nebula.game.inventory.ItemParamMap;
import lombok.Getter;
@Getter
@ResourceType(name = "LoginRewardGroup.json")
public class LoginRewardGroupControlDef extends BaseDef {
private int Id;
private int RewardId1;
private int Qty1;
private int RewardId2;
private int Qty2;
private transient ItemParamMap rewards;
@Override
public int getId() {
return Id;
}
@Override
public void onLoad() {
this.rewards = new ItemParamMap();
if (this.RewardId1 > 0) {
this.rewards.add(this.RewardId1, this.Qty1);
}
if (this.RewardId2 > 0) {
this.rewards.add(this.RewardId2, this.Qty2);
}
}
}
@@ -0,0 +1,19 @@
package emu.nebula.data.resources;
import emu.nebula.data.BaseDef;
import emu.nebula.data.ResourceType;
import emu.nebula.data.ResourceType.LoadPriority;
import lombok.Getter;
@Getter
@ResourceType(name = "MainScreenCG.json", loadPriority = LoadPriority.LOW)
public class MainScreenCGDef extends BaseDef {
private int Id;
private boolean IsShown;
@Override
public int getId() {
return Id;
}
}
@@ -22,10 +22,14 @@ public class PotentialDef extends BaseDef {
return Id;
}
public boolean isSpecial() {
return this.BranchType != 3;
}
public int getMaxLevel() {
// Check if regular potential
if (this.BranchType == 3) {
return this.BuildScore.length;
return 6;
}
// Special potential should always have a max level of 1
@@ -35,7 +39,7 @@ public class PotentialDef extends BaseDef {
public int getMaxLevel(StarTowerGame game) {
// Check if regular potential
if (this.BranchType == 3) {
return this.MaxLevel + game.getModifiers().getBonusMaxPotentialLevel();
return this.MaxLevel + game.getModifiers().getExtraMaxPotentialLevel();
}
// Special potential should always have a max level of 1
@@ -2,6 +2,7 @@ package emu.nebula.data.resources;
import emu.nebula.data.BaseDef;
import emu.nebula.data.ResourceType;
import emu.nebula.util.Utils;
import it.unimi.dsi.fastutil.ints.IntOpenHashSet;
import lombok.Getter;
@@ -9,10 +10,21 @@ import lombok.Getter;
@ResourceType(name = "ScoreBossControl.json")
public class ScoreBossControlDef extends BaseDef {
private int Id;
private String StartTime;
private String EndTime;
private IntOpenHashSet LevelGroup;
private transient long startDate;
private transient long endDate;
@Override
public int getId() {
return Id;
}
@Override
public void onLoad() {
this.startDate = Utils.dateToMilliseconds(this.StartTime) / 1000;
this.endDate = Utils.dateToMilliseconds(this.EndTime) / 1000;
}
}
@@ -0,0 +1,18 @@
package emu.nebula.data.resources;
import emu.nebula.data.BaseDef;
import emu.nebula.data.ResourceType;
import lombok.Getter;
@Getter
@ResourceType(name = "StarTowerBuildRank.json")
public class StarTowerBuildRankDef extends BaseDef {
private int Id;
private int MinGrade;
private int Rarity;
@Override
public int getId() {
return Id;
}
}
@@ -4,6 +4,7 @@ import java.util.Arrays;
import emu.nebula.data.BaseDef;
import emu.nebula.data.ResourceType;
import lombok.Getter;
@Getter
@@ -12,6 +13,7 @@ public class StarTowerDef extends BaseDef {
private int Id;
private int GroupId;
private int Difficulty;
private int SubNoteSkillDropGroupId;
private int[] FloorNum;
private transient int maxFloors;
@@ -1,7 +1,10 @@
package emu.nebula.data.resources;
import com.google.gson.annotations.SerializedName;
import emu.nebula.data.BaseDef;
import emu.nebula.data.ResourceType;
import emu.nebula.game.tower.room.RoomType;
import lombok.Getter;
@Getter
@@ -10,11 +13,19 @@ public class StarTowerStageDef extends BaseDef {
private int Id;
private int Stage;
private int Floor;
private int RoomType;
private int InteriorCurrencyQuantity;
@SerializedName("RoomType")
private int RoomTypeValue;
private transient RoomType roomType;
@Override
public int getId() {
return Id;
}
@Override
public void onLoad() {
this.roomType = RoomType.getByValue(this.RoomTypeValue);
}
}
@@ -0,0 +1,17 @@
package emu.nebula.data.resources;
import emu.nebula.data.BaseDef;
import emu.nebula.data.ResourceType;
import lombok.Getter;
@Getter
@ResourceType(name = "StoryEvidence.json")
public class StoryEvidenceDef extends BaseDef {
private int Id;
@Override
public int getId() {
return Id;
}
}
@@ -0,0 +1,45 @@
package emu.nebula.data.resources;
import emu.nebula.data.BaseDef;
import emu.nebula.data.ResourceType;
import emu.nebula.util.Utils;
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
import it.unimi.dsi.fastutil.ints.IntArrayList;
import it.unimi.dsi.fastutil.ints.IntList;
import lombok.Getter;
@Getter
@ResourceType(name = "SubNoteSkillDropGroup.json")
public class SubNoteSkillDropGroupDef extends BaseDef {
private int Id;
private int GroupId;
private int SubNoteSkillId;
private static Int2ObjectMap<IntList> GROUPS = new Int2ObjectOpenHashMap<>();
@Override
public int getId() {
return Id;
}
@Override
public void onLoad() {
var packageList = GROUPS.computeIfAbsent(this.GroupId, i -> new IntArrayList());
packageList.add(this.SubNoteSkillId);
}
public static int getRandomDrop(int groupId) {
var dropList = GROUPS.get(groupId);
if (dropList == null) {
return 0;
}
return Utils.randomElement(dropList);
}
public static IntList getGroup(int groupId) {
return GROUPS.get(groupId);
}
}
@@ -0,0 +1,37 @@
package emu.nebula.data.resources;
import emu.nebula.data.BaseDef;
import emu.nebula.data.ResourceType;
import emu.nebula.game.inventory.ItemParamMap;
import lombok.Getter;
@Getter
@ResourceType(name = "WeeklyQuestActive.json")
public class WeeklyQuestActiveDef extends BaseDef {
private int Id;
private int Active;
private int ItemTid1;
private int Number1;
private int ItemTid2;
private int Number2;
private transient ItemParamMap rewards;
@Override
public int getId() {
return Id;
}
@Override
public void onLoad() {
this.rewards = new ItemParamMap();
if (this.ItemTid1 > 0 && this.Number1 > 0) {
this.rewards.add(this.ItemTid1, this.Number1);
}
if (this.ItemTid2 > 0 && this.Number2 > 0) {
this.rewards.add(this.ItemTid2, this.Number2);
}
}
}
@@ -0,0 +1,49 @@
package emu.nebula.data.resources;
import java.util.Arrays;
import emu.nebula.data.BaseDef;
import emu.nebula.data.ResourceType;
import emu.nebula.game.quest.QuestData;
import emu.nebula.game.quest.QuestType;
import lombok.Getter;
@Getter
@ResourceType(name = "WeeklyQuest.json")
public class WeeklyQuestDef extends BaseDef implements QuestData {
private int Id;
private boolean Apear;
private int Active;
private int ItemTid;
private int ItemQty;
private int CompleteCond;
private int CompleteCondClient;
private String CompleteCondParams;
private transient int[] condParams;
@Override
public int getId() {
return Id;
}
@Override
public int getQuestType() {
return QuestType.Weekly;
}
public int[] getCompleteCondParams() {
return this.condParams;
}
@Override
public void onLoad() {
this.condParams = Arrays.stream(this.CompleteCondParams.split("[\\[,\\]]"))
.filter(s -> !s.isEmpty())
.mapToInt(Integer::parseInt)
.toArray();
this.CompleteCondParams = null;
}
}
@@ -7,7 +7,7 @@ import org.bson.codecs.Codec;
import org.bson.codecs.DecoderContext;
import org.bson.codecs.EncoderContext;
import emu.nebula.util.String2IntMap;
import emu.nebula.util.ints.String2IntMap;
/**
* Custom mongodb codec for encoding/decoding fastutil int2int maps.
@@ -9,6 +9,7 @@ import java.util.concurrent.TimeUnit;
import emu.nebula.GameConstants;
import emu.nebula.Nebula;
import emu.nebula.game.activity.ActivityModule;
import emu.nebula.game.ban.BanModule;
import emu.nebula.game.gacha.GachaModule;
import emu.nebula.game.player.PlayerModule;
import emu.nebula.game.scoreboss.ScoreBossModule;
@@ -30,6 +31,7 @@ public class GameContext implements Runnable {
private final TutorialModule tutorialModule;
private final ActivityModule activityModule;
private final ScoreBossModule scoreBossModule;
private final BanModule banModule;
// Game loop
private final ScheduledExecutorService scheduler;
@@ -48,6 +50,7 @@ public class GameContext implements Runnable {
this.tutorialModule = new TutorialModule(this);
this.activityModule = new ActivityModule(this);
this.scoreBossModule = new ScoreBossModule(this);
this.banModule = new BanModule(this);
// Run game loop
this.scheduler = Executors.newScheduledThreadPool(1);
@@ -116,6 +119,9 @@ public class GameContext implements Runnable {
this.epochWeeks = Utils.getWeeks(this.epochDays);
this.epochMonths = Utils.getMonths(this.epochDays);
// Update score boss season
this.getScoreBossModule().updateSeason();
// Reset dailies for players
this.resetDailies();
}
@@ -56,7 +56,6 @@ public enum AchievementCondition {
LoginTotal (51),
QuestTravelerDuelChallengeTotal (52),
QuestTourGuideSpecific (53),
QuestTravelerDuelSpecific (54),
QuestWithSpecificType (55),
RegionBossClearSpecificFullStarWithBossIdAndDifficulty (56),
RegionBossClearSpecificLevelWithDifficultyAndTotal (57),
@@ -67,12 +66,8 @@ public enum AchievementCondition {
StageClearSpecificStars (62),
StoryClear (63),
TravelerDuelChallengeSpecificBoosLevelWithDifficultyAndTotal (64),
TravelerDuelClearBossTotal (65),
TravelerDuelClearSpecificBossIdAndDifficulty (66),
TravelerDuelChallengeClearSpecificBossLevelAndAffix (67),
TravelerDuelClearSpecificBossLevelWithDifficultyAndTotal (68),
TravelerDuelClearSpecificBossTotal (69),
TravelerDuelChallengeRankUploadTotal (70),
WorldClassSpecific (71),
RegionBossClearSpecificTypeWithTotal (72),
CharactersWithSpecificDatingCount (73),
@@ -82,7 +77,6 @@ public enum AchievementCondition {
VampireSurvivorPassedSpecificLevel (77),
CharacterParticipateTowerNumber (78),
CharacterAllSkillReachSpecificLevel (79),
TravelerDuelPlayTotal (80),
VampireClearTotal (81),
VampireWithSpecificClearTotal (82),
AgentFinishTotal (83),
@@ -101,6 +95,13 @@ public enum AchievementCondition {
DailyShopReceiveShopTotal (105),
AgentApplyTotal (106),
DiscSpecific (114),
StorySetClearSpecific (116),
CharacterWithSpecificSkillAndLevel (118),
DiscWithSpecificQuantityLevelAndAttr (119),
TutorialLevelClearSpecific (120),
TutorialLevelSpecificClearTotal (121),
DiscWithSpecificQuantityPhaseAndAttr (122),
WeekBossClearTotal (123),
ClientReport (200),
TowerBattleTimes (501),
TowerBossChallengeSpecificHighRewardWithTotal (502),
@@ -137,7 +138,8 @@ public enum AchievementCondition {
TowerSpecificSecondarySkillActivateTotal (536),
TowerSpecificGetExtraNoteLvTotal (537),
TowerSweepTimes (539),
TowerSweepTotal (540);
TowerSweepTotal (540),
TowerBattleWithPartner (541);
@Getter
private final int value;
@@ -2,14 +2,13 @@ package emu.nebula.game.achievement;
import java.util.List;
import emu.nebula.GameConstants;
import emu.nebula.data.GameData;
import emu.nebula.data.resources.AchievementDef;
import emu.nebula.game.tower.room.RoomType;
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
import it.unimi.dsi.fastutil.ints.IntOpenHashSet;
import it.unimi.dsi.fastutil.ints.IntSet;
import lombok.Getter;
// Because achievements in the data files do not have params, we will hardcode them here
@@ -47,120 +46,5 @@ public class AchievementHelper {
incrementalAchievementSet.add(AchievementCondition.TowerItemsGet.getValue());
incrementalAchievementSet.add(AchievementCondition.TowerEnterRoom.getValue());
// Fix params
fixParams();
}
private static void fixParams() {
// Clear "Misstep On One"
addParam(56, 401, 0); // Custom trigger
// Clear "Currents and Shadows"
addParam(57, 102, 0);
addParam(58, 103, 0);
addParam(59, 104, 0);
addParam(60, 105, 0);
addParam(61, 106, 0);
addParam(62, 107, 0);
addParam(63, 108, 0);
// Clear "Dust and Flames"
addParam(64, 202, 0);
addParam(65, 203, 0);
addParam(66, 204, 0);
addParam(67, 205, 0);
addParam(68, 206, 0);
addParam(69, 207, 0);
addParam(70, 208, 0);
// Clear "Storm and Thunder"
addParam(71, 302, 0);
addParam(72, 303, 0);
addParam(73, 304, 0);
addParam(74, 305, 0);
addParam(75, 306, 0);
addParam(76, 307, 0);
addParam(77, 308, 0);
// First Ascension
addParam(498, 0, 1);
// Monolith Conqueror
addParam(78, 2, 0);
addParam(79, 4, 0);
addParam(80, 6, 0);
addParam(81, 7, 0);
// Money
addParam(25, GameConstants.GOLD_ITEM_ID, 0);
addParam(26, GameConstants.GOLD_ITEM_ID, 0);
addParam(27, GameConstants.GOLD_ITEM_ID, 0);
addParam(28, GameConstants.GOLD_ITEM_ID, 0);
addParam(29, GameConstants.GOLD_ITEM_ID, 0);
// Ininfite tower
for (int diff = 10, id = 270; diff <= 60; diff += 10) {
addParam(id++, 11000 + diff, 0); // Infinite Arena
addParam(id++, 51000 + diff, 0); // Shake the Floor
addParam(id++, 41000 + diff, 0); // Elegance and Flow
addParam(id++, 71000 + diff, 0); // Upbeat Party
addParam(id++, 31000 + diff, 0); // Thrilling Beat
addParam(id++, 21000 + diff, 0); // Flames and Beats
addParam(id++, 61000 + diff, 0); // Sinister Ritual
}
// Character count
addParams(393, 398, 1, 0);
// Disc count
addParams(382, 387, 1, 0);
// Star Tower team clear
addParams(95, 98, 1, 0); // Aqua team clear
addParams(99, 102, 2, 0); // Fire team clear
addParams(103, 106, 3, 0); // Earth team clear
addParams(107, 110, 4, 0); // Wind team clear
addParams(111, 114, 5, 0); // Light team clear
addParams(115, 118, 6, 0); // Dark team clear
// Star tower items
addParams(139, 144, GameConstants.TOWER_COIN_ITEM_ID, 0);
addParams(145, 149, 90011, 0);
addParams(150, 154, 90012, 0);
addParams(155, 159, 90013, 0);
addParams(160, 164, 90014, 0);
addParams(165, 169, 90015, 0);
addParams(170, 174, 90016, 0);
addParams(175, 179, 90017, 0);
addParams(180, 184, 90018, 0);
addParams(185, 189, 90019, 0);
addParams(190, 194, 90020, 0);
addParams(195, 199, 90021, 0);
addParams(200, 204, 90022, 0);
addParams(205, 209, 90023, 0);
// Star tower rooms
addParams(210, 216, RoomType.BattleRoom.getValue() + 1, 0);
addParams(217, 223, RoomType.EliteBattleRoom.getValue() + 1, 0);
addParams(224, 230, RoomType.BossRoom.getValue() + 1, 0);
addParams(231, 237, RoomType.FinalBossRoom.getValue() + 1, 0);
addParams(238, 244, RoomType.ShopRoom.getValue() + 1, 0);
addParams(245, 251, RoomType.EventRoom.getValue() + 1, 0);
}
private static void addParam(int achievementId, int param1, int param2) {
var data = GameData.getAchievementDataTable().get(achievementId);
if (data == null) return;
data.setParams(param1, param2);
}
private static void addParams(int start, int end, int param1, int param2) {
for (int id = start; id <= end; id++) {
addParam(id, param1, param2);
}
}
}
@@ -0,0 +1,46 @@
package emu.nebula.game.achievement;
import emu.nebula.util.ints.IntBiPredicate;
import lombok.Getter;
@Getter
public enum AchievementParamCond {
EQUALS (0, (param, value) -> value == param),
ANY (1, (param, value) -> true),
NOT_EQUALS (2, (param, value) -> value != param),
GREATER_THAN (3, (param, value) -> value > param),
GREATER_THAN_OR_EQ (4, (param, value) -> value >= param),
LESS_THAN (5, (param, value) -> value < param),
LESS_THAN_OR_EQ (6, (param, value) -> value <= param);
private final int value;
private final IntBiPredicate operation;
// Static cache
private static AchievementParamCond[] CACHE;
static {
CACHE = new AchievementParamCond[AchievementParamCond.values().length];
for (AchievementParamCond type : AchievementParamCond.values()) {
CACHE[type.getValue()] = type;
}
}
private AchievementParamCond(int value, IntBiPredicate operation) {
this.value = value;
this.operation = operation;
}
public boolean test(int param, int value) {
return this.getOperation().test(param, value);
}
public static AchievementParamCond getByValue(int value) {
try {
return CACHE[value];
} catch (Exception e) {
return AchievementParamCond.EQUALS;
}
}
}
@@ -75,11 +75,7 @@ public class GameAchievement {
var data = this.getData();
if (data == null) return false;
if (data.hasParam1(param1) && data.getParam1() != param1) {
return false;
}
if (data.hasParam2(param2) && data.getParam2() != param2) {
if (!data.matchParam1(param1) || !data.matchParam2(param2)) {
return false;
}
@@ -96,7 +92,7 @@ public class GameAchievement {
// Check if completed
if (this.getCurProgress() >= this.getMaxProgress()) {
this.curProgress = this.getMaxProgress();
this.completed = Nebula.getCurrentTime();
this.completed = Nebula.getCurrentServerTime();
return true;
}
@@ -68,6 +68,14 @@ public class ActivityManager extends PlayerManager implements GameDatabaseObject
if (data == null) {
it.remove();
this.queueSave = true;
continue;
}
// Remove activities that are not in the activity module
if (!Nebula.getGameContext().getActivityModule().getActivities().contains(activity.getId())) {
it.remove();
this.queueSave = true;
continue;
}
// Set data
@@ -109,15 +117,29 @@ public class ActivityManager extends PlayerManager implements GameDatabaseObject
return null;
}
// TODO improve activity creation
GameActivity activity = switch (data.getType()) {
case Trial -> new TrialActivity(this, data);
case LoginReward -> new LoginRewardActivity(this, data);
case TowerDefense -> new TowerDefenseActivity(this, data);
case Trial -> new TrialActivity(this, data);
case Levels -> new LevelsActivity(this, data);
case Task -> new TaskActivity(this, data);
case Shop -> new ShopActivity(this, data);
case TrekkerVersus -> new TrekkerVersusActivity(this, data);
default -> null;
};
return activity;
}
// Events
public synchronized void onLogin() {
for (var activity : this.getActivities().values()) {
activity.onLogin();
}
}
// Database
@Override
@@ -15,15 +15,31 @@ public class ActivityModule extends GameContextModule {
this.activities = new IntArrayList();
// Hardcode these activities for now
this.activities.add(700102);
this.activities.add(700103);
this.activities.add(700104);
this.activities.add(700107);
// TODO make an activity json file to read activity ids from
this.activities.add(102001); // Tower defense activity
// Trial activities
this.activities.add(700105);
this.activities.add(700106);
//this.activities.add(101002);
//this.activities.add(101003);
// Tower defense activity
this.activities.add(102001);
// Beyond the dream
//this.activities.add(1010201);
//this.activities.add(1010203);
//this.activities.add(1010204);
// Christmas 2025
this.activities.add(2010101);
this.activities.add(2010103);
this.activities.add(2010104);
// Christmas 2025 login events
this.activities.add(301011);
this.activities.add(301012);
// Trekker versus
this.activities.add(600001);
}
}
@@ -0,0 +1,93 @@
package emu.nebula.game.activity;
import dev.morphia.annotations.Entity;
import emu.nebula.data.resources.ActivityTaskDef;
import emu.nebula.proto.Public.Quest;
import emu.nebula.proto.Public.QuestProgress;
import lombok.Getter;
import lombok.Setter;
@Getter
@Entity(useDiscriminator = false)
public class ActivityTaskQuest {
private int id;
private int cond;
private int curProgress;
private int maxProgress;
@Setter
private boolean claimed;
@Deprecated
public ActivityTaskQuest() {
}
public ActivityTaskQuest(ActivityTaskDef data) {
this.id = data.getId();
this.cond = data.getCompleteCond();
this.maxProgress = data.getAimNumShow();
}
public void resetProgress() {
this.curProgress = 0;
this.claimed = false;
}
public boolean isComplete() {
return this.curProgress >= this.maxProgress;
}
private int getStatus() {
if (this.isClaimed()) {
return 2;
} else if (this.isComplete()) {
return 1;
}
return 0;
}
public boolean trigger(int condition, int progress, int param1, int param2) {
// Sanity check
if (this.isComplete()) {
return false;
}
// Skip if not the correct condition
if (this.cond != condition) {
return false;
}
// Check quest param TODO
// Get new progress
int newProgress = Math.min(this.curProgress + progress, this.maxProgress);
// Set
if (this.curProgress != newProgress) {
this.curProgress = newProgress;
return true;
}
return false;
}
// Proto
public Quest toProto() {
var progress = QuestProgress.newInstance()
.setCur(this.getCurProgress())
.setMax(this.getMaxProgress());
var proto = Quest.newInstance()
.setId(this.getId())
.setStatus(this.getStatus())
.addProgress(progress);
return proto;
}
}
@@ -18,7 +18,11 @@ public enum ActivityType {
Avg (10),
Task (11),
Shop (12),
Advertise (13);
Advertise (13),
BDConvert (14),
Breakout (15),
TrekkerVersus (16),
Story (17);
@Getter
private final int value;
@@ -41,6 +41,12 @@ public abstract class GameActivity {
);
}
// Events
public void onLogin() {
}
// Proto
public Activity toProto() {
@@ -0,0 +1,209 @@
package emu.nebula.game.activity.type;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import dev.morphia.annotations.Entity;
import emu.nebula.GameConstants;
import emu.nebula.data.GameData;
import emu.nebula.data.resources.ActivityDef;
import emu.nebula.data.resources.ActivityLevelsLevelDef;
import emu.nebula.game.activity.ActivityManager;
import emu.nebula.game.activity.GameActivity;
import emu.nebula.game.instance.InstanceSettleData;
import emu.nebula.game.inventory.ItemParamMap;
import emu.nebula.game.player.PlayerChangeInfo;
import emu.nebula.game.quest.QuestCondition;
import emu.nebula.proto.ActivityDetail.ActivityMsg;
import emu.nebula.proto.Public.ActivityLevel;
import lombok.Getter;
import lombok.Setter;
@Getter
@Entity
public class LevelsActivity extends GameActivity {
private Map<Integer, ActivityLevelInfo> levels;
// Apply level data
private transient ActivityLevelsLevelDef level;
private transient long buildId;
@Deprecated // Morphia only
public LevelsActivity() {
}
public LevelsActivity(ActivityManager manager, ActivityDef data) {
super(manager, data);
this.levels = new HashMap<>();
}
public boolean apply(int levelId, long buildId) {
// Verify level
var level = GameData.getActivityLevelsLevelDataTable().get(levelId);
if (level == null || level.getActivityId() != this.getId()) {
return false;
}
// Verify build
var build = this.getPlayer().getStarTowerManager().getBuildById(buildId);
if (build == null) {
return false;
}
// Set
this.level = level;
this.buildId = buildId;
// Success
return true;
}
public PlayerChangeInfo settle(int star) {
// Check energy
if (!this.getLevel().hasEnergy(this.getPlayer(), 1)) {
return null;
}
// Calculate settle data
var settleData = new InstanceSettleData();
settleData.setWin(star > 0);
settleData.setFirst(settleData.isWin() && !this.getLevels().containsKey(this.getLevel().getId()));
// Init player change info
var change = new PlayerChangeInfo();
// Handle win
if (settleData.isWin()) {
// Calculate energy and exp
settleData.setExp(this.getLevel().getEnergyConsume());
getPlayer().consumeEnergy(settleData.getExp(), change);
// Calculate rewards
settleData.generateRewards(this.getLevel());
// Add to inventory
getPlayer().getInventory().addItem(GameConstants.EXP_ITEM_ID, settleData.getExp(), change);
getPlayer().getInventory().addItems(settleData.getRewards(), change);
getPlayer().getInventory().addItems(settleData.getFirstRewards(), change);
// Log
var level = getLevels().computeIfAbsent(this.getLevel().getId(), i -> new ActivityLevelInfo());
level.setStar(star);
level.setBuildId(this.getBuildId());
// Save to database
this.save();
// Quest triggers
this.getPlayer().trigger(QuestCondition.BattleTotal, 1);
}
// Set extra data
change.setExtraData(settleData);
// Success
return change;
}
public PlayerChangeInfo sweep(ActivityLevelsLevelDef data, int count) {
// Sanity check count
if (count <= 0) {
return null;
}
// Check if we have 3 starred this instance
var level = this.getLevels().get(data.getId());
if (level == null || level.getStar() != 3) {
return null;
}
// Check energy cost
int energyCost = data.getEnergyConsume() * count;
if (this.getPlayer().getEnergy() < energyCost) {
return null;
}
// Init variables
var change = new PlayerChangeInfo();
var list = new ArrayList<ItemParamMap>();
// Consume exp
getPlayer().consumeEnergy(energyCost, change);
getPlayer().getInventory().addItem(GameConstants.EXP_ITEM_ID, energyCost, change);
// Calculate total rewards
var totalRewards = new ItemParamMap();
for (int i = 0; i < count; i++) {
// Generate rewards for each settle count
var rewards = data.getRewards().generate();
// Add to reward list
list.add(rewards);
// Add to total rewards
totalRewards.add(rewards);
}
// Add total rewards to inventory
getPlayer().getInventory().addItems(totalRewards, change);
// Set reward list in change info so we can serialize it in the response proto later
change.setExtraData(list);
// Quest triggers
this.getPlayer().trigger(QuestCondition.BattleTotal, count);
// Success
return change.setSuccess(true);
}
// Proto
@Override
public void encodeActivityMsg(ActivityMsg msg) {
var proto = msg.getMutableLevels();
for (var entry : this.getLevels().entrySet()) {
int id = entry.getKey();
var level = entry.getValue();
var info = level.toProto()
.setId(id);
proto.addLevels(info);
}
}
@Setter
@Getter
@Entity(useDiscriminator = false)
public static class ActivityLevelInfo {
private int star;
private long buildId;
public ActivityLevelInfo() {
}
// Proto
public ActivityLevel toProto() {
var proto = ActivityLevel.newInstance()
.setStar(this.getStar())
.setBuildId(this.getBuildId());
return proto;
}
}
}
@@ -0,0 +1,101 @@
package emu.nebula.game.activity.type;
import dev.morphia.annotations.Entity;
import emu.nebula.data.GameData;
import emu.nebula.data.resources.ActivityDef;
import emu.nebula.game.activity.ActivityManager;
import emu.nebula.game.activity.GameActivity;
import emu.nebula.game.inventory.ItemParamMap;
import emu.nebula.game.player.PlayerChangeInfo;
import emu.nebula.proto.ActivityDetail.ActivityMsg;
import lombok.Getter;
@Getter
@Entity
public class LoginRewardActivity extends GameActivity {
private int actual; // Received rewards
private int receive; // Rewards level that we can claim
private boolean complete;
private long lastEpochDay;
@Deprecated // Morphia only
public LoginRewardActivity() {
}
public LoginRewardActivity(ActivityManager manager, ActivityDef data) {
super(manager, data);
}
public PlayerChangeInfo claim() {
// Create change info
var change = new PlayerChangeInfo();
// Sanity check
if (this.getActual() >= this.getReceive()) {
return change;
}
// Get rewards
var rewards = new ItemParamMap();
for (int i = this.getActual() + 1; i <= this.getReceive(); i++) {
int rewardId = (this.getId() * 100) + i;
var data = GameData.getLoginRewardGroupControlDataTable().get(rewardId);
if (data == null) {
continue;
}
rewards.add(data.getRewards());
}
// Give rewards to player
this.getPlayer().getInventory().addItems(rewards, change);
// Update claimed and save to database
this.actual = this.receive;
this.save();
// Complete
return change;
}
@Override
public void onLogin() {
// Check if epoch day has changed
if (this.getPlayer().getLastEpochDay() <= this.lastEpochDay || this.isComplete()) {
return;
}
// Get next reward
int nextReceive = this.receive + 1;
int rewardId = (this.getId() * 100) + nextReceive;
var data = GameData.getLoginRewardGroupControlDataTable().get(rewardId);
if (data != null) {
this.receive = nextReceive;
} else {
this.complete = true; // Set "complete" flag so we dont need to save to database/do a recheck every login
}
// Unlock next reward
this.lastEpochDay = this.getPlayer().getLastEpochDay();
// Save
this.save();
}
// Proto
@Override
public void encodeActivityMsg(ActivityMsg msg) {
msg.getMutableLogin()
.setActivityId(this.getId())
.setActual(this.getActual())
.setReceive(this.getReceive());
}
}
@@ -0,0 +1,152 @@
package emu.nebula.game.activity.type;
import java.util.HashMap;
import java.util.Map;
import dev.morphia.annotations.Entity;
import emu.nebula.data.GameData;
import emu.nebula.data.resources.ActivityDef;
import emu.nebula.data.resources.ActivityShopControlDef;
import emu.nebula.data.resources.ActivityShopDef;
import emu.nebula.game.activity.ActivityManager;
import emu.nebula.game.activity.GameActivity;
import emu.nebula.game.inventory.ItemParamMap;
import emu.nebula.game.player.PlayerChangeInfo;
import emu.nebula.proto.ActivityDetail.ActivityMsg;
import emu.nebula.proto.Public.BoughtGoods;
import emu.nebula.proto.Public.ResidentShop;
import lombok.Getter;
@Getter
@Entity
public class ShopActivity extends GameActivity {
private Map<Integer, ActivityShopInfo> shops;
@Deprecated // Morphia only
public ShopActivity() {
}
public ShopActivity(ActivityManager manager, ActivityDef data) {
super(manager, data);
this.shops = new HashMap<>();
// Load shops
var control = GameData.getActivityShopControlDataTable().get(data.getId());
if (control != null) {
this.initShops(control);
}
}
private void initShops(ActivityShopControlDef control) {
for (int id : control.getShopIds()) {
var data = GameData.getActivityShopDataTable().get(id);
if (data == null) {
continue;
}
// Create resident shop
var shop = new ActivityShopInfo(data);
// Add
this.getShops().put(data.getId(), shop);
}
}
public PlayerChangeInfo buy(int shopId, int goodsId, int count) {
// Get shop
var shop = this.getShops().get(shopId);
if (shop == null) return null;
// Get shop data
var data = GameData.getActivityShopDataTable().get(shopId);
if (data == null) return null;
// Get goods
var goods = data.getGoods().get(goodsId);
if (goods == null) return null;
// Check limit
if (goods.getMaximumLimit() > 0) {
var limit = goods.getMaximumLimit() - shop.getBoughtCount(goodsId);
if (count > limit) {
return null;
}
}
// Purchase
var change = getPlayer().getInventory().buyItem(data.getCurrencyItemId(), goods.getPrice(), goods.getItems(), count);
// Purchase failed
if (change == null) {
return null;
}
// Set log
shop.getBoughtGoods().add(goodsId, count);
// Save
this.save();
// Set extra data
change.setExtraData(shop);
// Success
return change;
}
// Proto
@Override
public void encodeActivityMsg(ActivityMsg msg) {
var proto = msg.getMutableShop();
for (var entry : this.getShops().entrySet()) {
var id = entry.getKey();
var shop = entry.getValue();
var info = shop.toProto()
.setId(id);
proto.addShops(info);
}
}
@Getter
@Entity(useDiscriminator = false)
public static class ActivityShopInfo {
private ItemParamMap boughtGoods;
@Deprecated // Morphia only
public ActivityShopInfo() {
}
public ActivityShopInfo(ActivityShopDef data) {
this.boughtGoods = new ItemParamMap();
}
public int getBoughtCount(int goodsId) {
return this.getBoughtGoods().get(goodsId);
}
// Proto
public ResidentShop toProto() {
var proto = ResidentShop.newInstance();
for (var item : this.getBoughtGoods().int2IntEntrySet()) {
var info = BoughtGoods.newInstance()
.setId(item.getIntKey())
.setNumber(item.getIntValue());
proto.addInfos(info);
}
return proto;
}
}
}
@@ -0,0 +1,72 @@
package emu.nebula.game.activity.type;
import java.util.HashMap;
import java.util.Map;
import dev.morphia.annotations.Entity;
import emu.nebula.data.GameData;
import emu.nebula.data.resources.ActivityDef;
import emu.nebula.game.activity.ActivityManager;
import emu.nebula.game.activity.ActivityTaskQuest;
import emu.nebula.game.activity.GameActivity;
import emu.nebula.proto.ActivityDetail.ActivityMsg;
import it.unimi.dsi.fastutil.ints.IntOpenHashSet;
import it.unimi.dsi.fastutil.ints.IntSet;
import lombok.Getter;
@Getter
@Entity
public class TaskActivity extends GameActivity {
private Map<Integer, ActivityTaskQuest> quests;
private IntSet completedGroups;
@Deprecated // Morphia only
public TaskActivity() {
}
public TaskActivity(ActivityManager manager, ActivityDef data) {
super(manager, data);
this.quests = new HashMap<>();
this.completedGroups = new IntOpenHashSet();
var groupSet = new IntOpenHashSet();
for (var group : GameData.getActivityTaskGroupDataTable()) {
if (group.getActivityId() != this.getId()) {
continue;
}
groupSet.add(group.getId());
}
for (var task : GameData.getActivityTaskDataTable()) {
if (!groupSet.contains(task.getActivityTaskGroupId())) {
continue;
}
var quest = new ActivityTaskQuest(task);
this.getQuests().put(quest.getId(), quest);
}
}
// Proto
@Override
public void encodeActivityMsg(ActivityMsg msg) {
var proto = msg.getMutableTask();
for (int id : this.getCompletedGroups()) {
proto.addGroupIds(id);
}
var tasks = proto.getMutableActivityTasks();
for (var quest : this.getQuests().values()) {
tasks.addList(quest.toProto());
}
}
}
@@ -0,0 +1,95 @@
package emu.nebula.game.activity.type;
import dev.morphia.annotations.Entity;
import emu.nebula.data.resources.ActivityDef;
import emu.nebula.game.activity.ActivityManager;
import emu.nebula.game.activity.GameActivity;
import emu.nebula.game.tower.StarTowerBuild;
import emu.nebula.proto.ActivityDetail.ActivityMsg;
import emu.nebula.proto.Public.TrekkerVersusShow;
import lombok.Getter;
import us.hebi.quickbuf.RepeatedInt;
@Getter
@Entity
public class TrekkerVersusActivity extends GameActivity {
private int[] charIds;
private int[] affixIds;
private int buildScore;
private int time;
// Apply
private transient StarTowerBuild build;
private transient int[] affixList;
@Deprecated // Morphia only
public TrekkerVersusActivity() {
}
public TrekkerVersusActivity(ActivityManager manager, ActivityDef data) {
super(manager, data);
}
public boolean apply(long buildId, RepeatedInt affixes) {
// Get build
var build = this.getPlayer().getStarTowerManager().getBuildById(buildId);
if (build == null) {
return false;
}
// Set
this.build = build;
this.affixList = affixes.toArray();
// Success
return true;
}
public void settle(boolean passed, int time) {
// Sanity check
if (this.build == null || this.affixList == null) {
return;
}
// Check if victory
if (passed) {
// Save characters/affixes
this.charIds = this.build.getCharIds().clone();
this.affixIds = this.affixList;
this.time = time;
this.buildScore = this.build.getScore();
// Save to database
this.save();
}
// Clear
this.build = null;
this.affixList = null;
}
// Proto
@Override
public void encodeActivityMsg(ActivityMsg msg) {
msg.getMutableTrekkerVersus()
.setShow(this.getShowProto());
}
public TrekkerVersusShow getShowProto() {
var show = TrekkerVersusShow.newInstance();
if (this.getCharIds() != null) {
show.addAllCharIds(this.getCharIds());
show.setBuildScore(this.getBuildScore());
}
if (this.getAffixIds() != null) {
show.addAllAffixIds(this.getAffixIds());
}
return show;
}
}
@@ -23,7 +23,7 @@ public class Agent {
public Agent(AgentDef data, int duration, int[] charIds) {
this.id = data.getId();
this.start = Nebula.getCurrentTime();
this.start = Nebula.getCurrentServerTime();
this.duration = duration;
this.charIds = charIds;
@@ -0,0 +1,63 @@
package emu.nebula.game.ban;
import dev.morphia.annotations.Entity;
import dev.morphia.annotations.Id;
import emu.nebula.database.GameDatabaseObject;
import emu.nebula.game.player.PlayerErrorCode;
import emu.nebula.proto.Public.Error;
import emu.nebula.util.Utils;
import lombok.Getter;
@Getter
@Entity(value = "bans", useDiscriminator = false)
public class BanInfo implements GameDatabaseObject {
@Id
private String id;
private int playerUid;
private long startTime;
private long endTime;
private String reason;
private String bannedBy;
private String ipAddress;
@Deprecated // Morphia only
public BanInfo() {
}
public BanInfo(int playerUid, long endTime, String reason, String bannedBy, String ipAddress) {
this.playerUid = playerUid;
this.startTime = System.currentTimeMillis();
this.endTime = endTime;
this.reason = reason;
this.bannedBy = bannedBy;
this.ipAddress = ipAddress;
// Generate ID based on either player UID or IP address
this.id = (ipAddress != null && !ipAddress.isEmpty() && playerUid == 0) ? "ip_" + ipAddress :
"player_" + playerUid;
}
public boolean isExpired() {
return endTime != 0 && endTime < System.currentTimeMillis();
}
public String getExpirationDateString() {
if (endTime == 0) {
return "Never";
}
return Utils.formatTimestamp(this.endTime);
}
@Override
public void save() {
GameDatabaseObject.super.save();
}
public Error toProto() {
return Error.newInstance()
.setCode(PlayerErrorCode.ErrBan.getValue())
.addArguments(
getExpirationDateString() + "\n" +
(this.reason != null ? "\n (" + this.reason + ")" : "\n" + this.id));
}
}
@@ -0,0 +1,246 @@
package emu.nebula.game.ban;
import emu.nebula.Nebula;
import emu.nebula.game.player.Player;
import emu.nebula.game.GameContext;
import emu.nebula.game.GameContextModule;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
public class BanModule extends GameContextModule {
private final Map<String, BanInfo> cachedIpBans = new ConcurrentHashMap<>();
private final Map<Integer, BanInfo> cachedPlayerBans = new ConcurrentHashMap<>();
public BanModule(GameContext context) {
super(context);
}
/**
* Ban a player by UID
* @param uid Player UID
* @param endTime Ban expiration time (0 = permanent)
* @param isBanIp Ban Ip
* @param reason Ban reason
* @param bannedBy Who banned the player
*/
public void banPlayer(int uid, long endTime, String reason, boolean isBanIp, String bannedBy) {
Player player = getGameContext().getPlayerModule().getPlayer(uid);
// It is only used as a supplement to find the banned IP when unblocking a player
String playerBindIp = null;
if (isBanIp) {
if (player != null && player.getSession() != null) {
String ipAddress = player.getSession().getIpAddress();
if (ipAddress != null && !ipAddress.isEmpty()) {
playerBindIp = ipAddress;
banIp(ipAddress, endTime, reason, bannedBy);
}
}
}
BanInfo banInfo = new BanInfo(uid, endTime, reason, bannedBy, playerBindIp);
cachedPlayerBans.put(uid, banInfo);
banInfo.save();
// Kick player
if (player != null && player.isLoaded()) {
player.setSession(null);
}
}
/**
* Ban an IP address
* <p>
* Please be cautious about disabling IPs
* in some regions where IPs are scarce, many people may share a public IP
* and restarting the optical cat device will reassign a new IP
*
* @param ipAddress IP address to ban
* @param endTime Ban expiration time (0 = permanent)
* @param reason Ban reason
* @param bannedBy Who banned the IP
*/
public void banIp(String ipAddress, long endTime, String reason, String bannedBy) {
BanInfo banInfo = new BanInfo(0, endTime, reason, bannedBy, ipAddress);
cachedIpBans.put(ipAddress, banInfo);
banInfo.save();
List<Player> playerList = Nebula.getGameContext().getPlayerModule().getCachedPlayers()
.values().stream().toList();
String playerIpAddress;
for (Player player : playerList) {
if (player.getSession() == null) {
continue;
}
playerIpAddress = player.getSession().getIpAddress();
if (playerIpAddress == null) {
continue;
}
// Kick player
if (playerIpAddress.equals(ipAddress)) {
player.setSession(null);
}
}
}
/**
* Unban a player
* @param uid Player UID
*/
public void unbanPlayer(int uid) {
BanInfo banInfo = cachedPlayerBans.remove(uid);
if (banInfo == null) {
banInfo = getPlayerBanInfo(uid);
}
if (banInfo == null) {
return;
}
deleteBan(banInfo);
}
/**
* Unban an IP address
* @param ipAddress IP address to unban
*/
public void unbanIp(String ipAddress) {
BanInfo banInfo = cachedIpBans.remove(ipAddress);
if (banInfo == null) {
banInfo = getIpBanInfo(ipAddress);
}
if (banInfo == null) {
return;
}
deleteBan(banInfo);
}
/**
* Check if a player is banned
* @param uid Player UID
* @return True if banned, false otherwise
*/
public boolean isPlayerBanned(int uid) {
BanInfo banInfo = cachedPlayerBans.get(uid);
if (banInfo == null) {
banInfo = loadPlayerBanFromDatabase(uid);
if (banInfo == null) {
return false;
}
cachedPlayerBans.put(uid, banInfo);
}
// Check if ban has expired
if (banInfo.isExpired()) {
unbanPlayer(uid);
return false;
}
return true;
}
/**
* Check if an IP address is banned
* @param ipAddress IP address
* @return True if banned, false otherwise
*/
public boolean isIpBanned(String ipAddress) {
BanInfo banInfo = cachedIpBans.get(ipAddress);
if (banInfo == null) {
banInfo = loadIpBanFromDatabase(ipAddress);
if (banInfo == null) {
return false;
}
cachedIpBans.put(ipAddress, banInfo);
}
// Check if ban has expired
if (banInfo.isExpired()) {
unbanIp(ipAddress);
return false;
}
return true;
}
/**
* Get ban info for a player
* @param uid Player UID
* @return BanInfo or null if not banned
*/
public BanInfo getPlayerBanInfo(int uid) {
BanInfo banInfo = cachedPlayerBans.get(uid);
if (banInfo == null) {
banInfo = loadPlayerBanFromDatabase(uid);
if (banInfo != null) {
cachedPlayerBans.put(uid, banInfo);
}
}
return banInfo;
}
/**
* Get ban info for an IP
* @param ipAddress IP address
* @return BanInfo or null if not banned
*/
public BanInfo getIpBanInfo(String ipAddress) {
BanInfo banInfo = cachedIpBans.get(ipAddress);
if (banInfo == null) {
banInfo = loadIpBanFromDatabase(ipAddress);
if (banInfo != null) {
cachedIpBans.put(ipAddress, banInfo);
}
}
return banInfo;
}
/**
* Delete ban from database
*/
private void deleteBan(BanInfo banInfo) {
try {
Nebula.getGameDatabase().delete(banInfo);
} catch (Exception e) {
Nebula.getLogger().error("Failed to delete ban info from database", e);
}
}
/**
* Load player ban from database
*/
private BanInfo loadPlayerBanFromDatabase(int uid) {
if (uid == 0)
return null;
try {
return Nebula.getGameDatabase().getObjectByField(BanInfo.class, "playerUid", uid);
} catch (Exception e) {
Nebula.getLogger().error("Failed to load player ban from database", e);
}
return null;
}
/**
* Load IP ban from database
*/
private BanInfo loadIpBanFromDatabase(String ipAddress) {
if (ipAddress == null || ipAddress.isEmpty())
return null;
try {
return Nebula.getGameDatabase().getObjectByField(BanInfo.class, "ipAddress", ipAddress);
} catch (Exception e) {
Nebula.getLogger().error("Failed to load IP ban from database", e);
}
return null;
}
}
@@ -109,7 +109,7 @@ public class CharacterContact {
chat.report(process, options, end);
// Set trigger time
this.triggerTime = Nebula.getCurrentTime();
this.triggerTime = Nebula.getCurrentServerTime();
// Add next chat
this.addNextChat();
@@ -26,6 +26,10 @@ public class CharacterGem {
this.locked = locked;
}
public void setAttributes(IntList attributes) {
this.attributes = attributes.toIntArray();
}
public void setNewAttributes(IntList attributes) {
this.alterAttributes = attributes.toIntArray();
}
@@ -27,7 +27,9 @@ public class CharacterGemPreset {
return this.getGems().length;
}
public int getGemIndex(int slotIndex) {
public int getGemIndex(int slotId) {
int slotIndex = slotId - 1;
if (slotIndex < 0 || slotIndex >= this.getLength()) {
return -1;
}
@@ -36,6 +36,10 @@ public class CharacterGemSlot {
return getGems().size() >= GameConstants.CHARACTER_MAX_GEMS_PER_SLOT;
}
public boolean isEmpty() {
return getGems().size() <= 0;
}
// Proto
public CharGemSlot toProto() {
@@ -12,8 +12,10 @@ import emu.nebula.net.NetMsgId;
import emu.nebula.proto.Public.HandbookInfo;
import emu.nebula.util.Bitset;
import emu.nebula.game.achievement.AchievementCondition;
import emu.nebula.game.inventory.ItemParamMap;
import emu.nebula.game.player.Player;
import emu.nebula.game.player.PlayerChangeInfo;
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
import lombok.Getter;
@@ -117,6 +119,67 @@ public class CharacterStorage extends PlayerManager {
return handbook;
}
public void triggerCharacterAchievements(GameCharacter character) {
// Create elements we want to trigger the achievement for
var elements = new ItemParamMap();
elements.put(character.getData().getElementType().getValue(), 0);
// Calculate the amount of characters with the elements
this.triggerCharacterAchievements(elements, character.getLevel());
}
public void triggerCharacterAchievements(Collection<GameCharacter> characters, int level) {
var elements = new ItemParamMap();
for (var character : characters) {
elements.put(character.getElementType().getValue(), 0);
}
// Calculate the amount of characters with the elements
this.triggerCharacterAchievements(elements, level);
}
private void triggerCharacterAchievements(ItemParamMap elements, int level) {
// Get current amount of characters with same level or higher
int anyCount = 0;
for (var character : this.getCharacterCollection()) {
if (character.getLevel() >= level) {
anyCount++;
} else {
continue;
}
int element = character.getElementType().getValue();
if (elements.containsKey(element)) {
elements.add(element, 1);
}
}
// Trigger achievements
var achievements = this.getPlayer().getAchievementManager();
achievements.trigger(
AchievementCondition.CharactersWithSpecificLevelAndQuantity,
anyCount,
level,
0
);
for (var entry : elements) {
int element = entry.getIntKey();
int amount = entry.getIntValue();
achievements.trigger(
AchievementCondition.CharactersWithSpecificNumberLevelAndAttributes,
amount,
level,
element
);
}
}
// Discs
public GameDisc getDiscById(int id) {
@@ -275,7 +338,8 @@ public class CharacterStorage extends PlayerManager {
this.updateCharHandbook = false;
this.getPlayer().addNextPackage(
NetMsgId.handbook_change_notify,
this.getPlayer().getCharacters().getCharacterHandbook());
this.getCharacterHandbook()
);
}
// Check if we need to trigger disc achievements
@@ -298,7 +362,8 @@ public class CharacterStorage extends PlayerManager {
this.updateDiscHandbook = false;
this.getPlayer().addNextPackage(
NetMsgId.handbook_change_notify,
this.getPlayer().getCharacters().getDiscHandbook());
this.getDiscHandbook()
);
}
}
@@ -33,8 +33,9 @@ import emu.nebula.proto.Public.CharGemSlot;
import emu.nebula.proto.Public.UI32;
import emu.nebula.proto.PublicStarTower.StarTowerChar;
import emu.nebula.proto.PublicStarTower.StarTowerCharGem;
import emu.nebula.server.error.ServerException;
import emu.nebula.util.Bitset;
import emu.nebula.util.CustomIntArray;
import emu.nebula.util.ints.CustomIntArray;
import it.unimi.dsi.fastutil.ints.IntArrayList;
import it.unimi.dsi.fastutil.ints.IntOpenHashSet;
import it.unimi.dsi.fastutil.ints.IntSet;
@@ -91,7 +92,7 @@ public class GameCharacter implements GameDatabaseObject {
this.talents = new Bitset();
this.gemPresets = new ArrayList<>();
this.gemSlots = new CharacterGemSlot[GameConstants.CHARACTER_MAX_GEM_SLOTS];
this.createTime = Nebula.getCurrentTime();
this.createTime = Nebula.getCurrentServerTime();
this.contact = new CharacterContact(this);
}
@@ -118,6 +119,10 @@ public class GameCharacter implements GameDatabaseObject {
}
}
public ElementType getElementType() {
return this.getData().getElementType();
}
public boolean isMaster() {
return this.getData().getGrade() == 1;
}
@@ -192,6 +197,8 @@ public class GameCharacter implements GameDatabaseObject {
if (this.level > oldLevel) {
// Trigger quest
this.getPlayer().trigger(QuestCondition.CharacterUpTotal, this.level - oldLevel);
// Trigger any achievements
this.getPlayer().getCharacters().triggerCharacterAchievements(this);
}
// Save to database
@@ -566,7 +573,7 @@ public class GameCharacter implements GameDatabaseObject {
public CharacterGem getGemFromPreset(CharacterGemPreset preset, int slotId) {
// Get gem index
int gemIndex = preset.getGemIndex(slotId - 1);
int gemIndex = preset.getGemIndex(slotId);
if (gemIndex <= 0) {
return null;
@@ -660,30 +667,34 @@ public class GameCharacter implements GameDatabaseObject {
return true;
}
public synchronized PlayerChangeInfo generateGem(int slotId) {
public synchronized PlayerChangeInfo generateGem(int slotId) throws ServerException {
// Get gem slot
var slot = this.getGemSlot(slotId);
if (slot == null) {
return null;
throw new ServerException(110105, "Emblem slot doesn't exist");
}
// Skip if slot is full
if (slot.isFull()) {
return null;
throw new ServerException(110105, "Emblem slots are full");
}
// Get gem data
var gemData = this.getData().getCharGemData(slotId);
var gemControl = gemData.getControlData();
var gemControl = GameData.getCharGemSlotControlDataTable().get(slotId);
if (gemControl == null) {
throw new ServerException(110105, "Emblem slot data doesn't exist");
}
// Check character level
if (this.getLevel() < gemControl.getUnlockLevel()) {
return null;
throw new ServerException(110105, "Trekker needs to be at least level " + gemControl.getUnlockLevel());
}
// Make sure the player has the materials to craft the emblem
if (!getPlayer().getInventory().hasItem(gemData.getGenerateCostTid(), gemControl.getGeneratenCostQty())) {
return null;
throw new ServerException(119903);
}
// Generate attributes and create gem
@@ -707,23 +718,29 @@ public class GameCharacter implements GameDatabaseObject {
}
@SuppressWarnings("deprecation")
public synchronized PlayerChangeInfo refreshGem(int slotId, int gemIndex, RepeatedInt lockedAttributes) {
public synchronized PlayerChangeInfo refreshGem(int slotId, int gemIndex, RepeatedInt lockedAttributes) throws ServerException {
// Get gem from slot
var gem = this.getGemFromSlot(slotId, gemIndex);
if (gem == null) return null;
if (gem == null) {
throw new ServerException(111609);
}
// Get gem data
var gemData = this.getData().getCharGemData(slotId);
var gemControl = gemData.getControlData();
var gemControl = GameData.getCharGemSlotControlDataTable().get(slotId);
if (gemControl == null) {
throw new ServerException(110105, "Emblem slot data doesn't exist");
}
// Check character level
if (this.getLevel() < gemControl.getUnlockLevel()) {
return null;
throw new ServerException(110105, "Trekker needs to be at least level " + gemControl.getUnlockLevel());
}
// Get locked attributes
if (lockedAttributes.length() > gemControl.getLockableNum()) {
return null;
throw new ServerException(110105, "You can only lock up to " + gemControl.getLockableNum() + " attributes");
}
// Calculate the materials we need
@@ -58,7 +58,7 @@ public class GameDisc implements GameDatabaseObject {
this.data = data;
this.discId = data.getId();
this.level = 1;
this.createTime = Nebula.getCurrentTime();
this.createTime = Nebula.getCurrentServerTime();
}
public void setPlayer(Player player) {
@@ -245,9 +245,11 @@ public class GameDisc implements GameDatabaseObject {
// Remove items
var change = this.getPlayer().getInventory().removeItems(materials, null);
// Add star
// Cache old star value
int old = this.star;
this.star = Math.max(this.star + count, 5);
// Add star
this.star = Math.min(this.star + count, 5);
// Save to database if star count changed
if (this.star != old) {
@@ -1,6 +1,7 @@
package emu.nebula.game.friends;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import emu.nebula.GameConstants;
@@ -11,9 +12,12 @@ import emu.nebula.game.player.PlayerManager;
import emu.nebula.net.NetMsgId;
import emu.nebula.proto.FriendListGet.FriendListGetResp;
import emu.nebula.proto.Public.FriendDetail;
import emu.nebula.proto.Public.FriendEnergyState;
import emu.nebula.proto.Public.FriendState;
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
import it.unimi.dsi.fastutil.longs.LongArrayList;
import it.unimi.dsi.fastutil.longs.LongList;
import lombok.Getter;
import us.hebi.quickbuf.RepeatedLong;
@@ -90,6 +94,12 @@ public class FriendList extends PlayerManager {
return this.getPendingFriends().size() + this.getFriends().size();
}
public synchronized boolean hasEnergy() {
return this.getFriends().values()
.stream()
.anyMatch(f -> f.getEnergy() > 0);
}
public synchronized Player handleFriendRequest(int targetUid, boolean action) {
// Make sure we have enough room
if (this.getFriends().size() >= GameConstants.MAX_FRIENDSHIPS) {
@@ -263,6 +273,127 @@ public class FriendList extends PlayerManager {
this.cacheCooldown = 0;
}
// Energy
public synchronized LongList sendEnergy(RepeatedLong uids) {
// Get friendships
Collection<Friendship> list = null;
if (uids.length() == 0) {
list = this.getFriends().values();
} else {
list = new ArrayList<>();
for (long uid : uids) {
var friend = this.getFriendById((int) uid);
if (friend == null) {
continue;
}
list.add(friend);
}
}
// Send energy
var results = new LongArrayList();
for (var friend : list) {
// Sanity
if (!friend.canSendEnergy()) {
continue;
}
// Update last send timestamp
friend.updateLastSendEnergy();
friend.save();
// Add to results
results.add(friend.getFriendUid());
// Send energy to friend
Player target = getGameContext().getPlayerModule().getCachedPlayerByUid(friend.getFriendUid());
if (target != null) {
// Get friend's friendship
var theirFriendship = target.getFriendList().getFriendById(this.getPlayer().getUid());
// Send energy
theirFriendship.sendEnergy();
theirFriendship.save();
if (target.isLoaded()) {
// Send message to notify friend that we sent them energy
target.addNextPackage(
NetMsgId.friend_energy_state_notify,
FriendEnergyState.newInstance()
.setState(true)
);
}
}
}
// Clear friend list cache
if (results.size() > 0) {
this.cacheCooldown = 0;
}
// Complete
return results;
}
public synchronized FriendRecvEnergyResult recvEnergy(RepeatedLong uids) {
// Get friendships
Collection<Friendship> list = null;
if (uids.length() == 0) {
list = this.getFriends().values();
} else {
list = new ArrayList<>();
for (long uid : uids) {
var friend = this.getFriendById((int) uid);
if (friend == null) {
continue;
}
list.add(friend);
}
}
// Send energy
var result = new FriendRecvEnergyResult();
for (var friend : list) {
// Skip if we dont have energy
if (friend.getEnergy() <= 0) {
continue;
}
// Add uid
result.getUids().add(friend.getFriendUid());
// Claim energy
result.addEnergy(friend.recvEnergy());
// Save to database
friend.save();
}
// Add energy
if (result.getEnergy() > 0) {
// Add energy to player
this.getPlayer().addEnergy(result.getEnergy(), result.getChange());
// Clear friend list cache
this.cacheCooldown = 0;
}
// Complete
return result;
}
// Database
public synchronized void loadFromDatabase() {
@@ -305,6 +436,7 @@ public class FriendList extends PlayerManager {
var info = FriendDetail.newInstance()
.setBase(base)
.setStar(friend.isStar())
.setSendEnergy(!friend.canSendEnergy())
.setGetEnergy(friend.getEnergy());
// Add
@@ -0,0 +1,22 @@
package emu.nebula.game.friends;
import emu.nebula.game.player.PlayerChangeInfo;
import it.unimi.dsi.fastutil.longs.LongArrayList;
import it.unimi.dsi.fastutil.longs.LongList;
import lombok.Getter;
@Getter
public class FriendRecvEnergyResult {
private PlayerChangeInfo change;
private LongList uids;
private int energy;
public FriendRecvEnergyResult() {
this.change = new PlayerChangeInfo();
this.uids = new LongArrayList();
}
public void addEnergy(int amount) {
this.energy += amount;
}
}
@@ -21,7 +21,9 @@ public class Friendship implements GameDatabaseObject {
@Setter private boolean isFriend;
@Setter private boolean star;
@Setter private int energy;
private int energy;
private long lastSend;
@Setter private transient Player player;
@@ -36,6 +38,24 @@ public class Friendship implements GameDatabaseObject {
this.key = Friendship.generateUniqueKey(player.getUid(), friend.getUid());
}
public boolean canSendEnergy() {
return this.lastSend != this.getPlayer().getLastEpochDay();
}
public void updateLastSendEnergy() {
this.lastSend = this.getPlayer().getLastEpochDay();
}
public void sendEnergy() {
this.energy = 1;
}
public int recvEnergy() {
int amount = this.energy;
this.energy = 0;
return amount;
}
// Database functions
public void delete() {
@@ -10,6 +10,7 @@ import lombok.Getter;
@Entity(value = "banner_info", useDiscriminator = false)
public class GachaHistoryLog {
private int type;
private int gid;
private long time;
private IntList ids;
@@ -18,9 +19,10 @@ public class GachaHistoryLog {
}
public GachaHistoryLog(int type, IntList results) {
public GachaHistoryLog(int type, int gachaId, IntList results) {
this.type = type;
this.time = Nebula.getCurrentTime();
this.gid = gachaId;
this.time = Nebula.getCurrentServerTime();
this.ids = results;
}
@@ -28,7 +30,7 @@ public class GachaHistoryLog {
public GachaHistory toProto() {
var proto = GachaHistory.newInstance()
.setGid(this.getType())
.setGid(this.getGid())
.setTime(this.getTime());
for (int id : this.getIds()) {
@@ -76,6 +76,9 @@ public class GachaModule extends GameContextModule {
var transformItemsDst = new ItemParamMap();
var bonusItems = new ItemParamMap();
// Character count (for achievements)
int characters = 0;
// Add for player
for (var entry : acquireItems.getItems().int2ObjectEntrySet()) {
// Get ids and aquire params
@@ -102,6 +105,9 @@ public class GachaModule extends GameContextModule {
transformItemsDst.add(characterData.getFragmentsId(), characterData.getTransformQty() * count);
transformItemsDst.add(24, 40 * count); // Expert permits
}
// Add to count
characters += acquire.getCount();
} else if (acquire.getType() == ItemType.Disc) {
// Get add amount
int begin = acquire.getBegin();
@@ -162,11 +168,12 @@ public class GachaModule extends GameContextModule {
player.getGachaManager().saveBanner(info);
// Add history
var log = new GachaHistoryLog(data.getGachaType(), results);
var log = new GachaHistoryLog(data.getStorageId(), data.getId(), results);
player.getGachaManager().addGachaHistory(log);
// Trigger achievements
player.trigger(AchievementCondition.GachaTotal, amount);
player.trigger(AchievementCondition.GachaCharacterTotal, characters);
// Complete
return new GachaResult(info, change, results);
@@ -6,20 +6,23 @@ import emu.nebula.game.achievement.AchievementCondition;
import emu.nebula.game.player.Player;
import emu.nebula.game.player.PlayerChangeInfo;
import emu.nebula.game.player.PlayerManager;
import emu.nebula.game.player.PlayerProgress;
import lombok.Getter;
@Getter
public class InfinityTowerManager extends PlayerManager {
private InfinityTowerLevelDef levelData;
private int levelId;
private long buildId;
public InfinityTowerManager(Player player) {
super(player);
}
private PlayerProgress getProgress() {
return this.getPlayer().getProgress();
}
public int getBountyLevel() {
return 0;
}
@@ -60,7 +63,8 @@ public class InfinityTowerManager extends PlayerManager {
}
// Check logs if the player has completed the level already
if (this.getPlayer().getProgress().getInfinityArenaLog().containsKey(this.getLevelId())) {
int highestLevel = this.getProgress().getInfinityTowerLog().get(this.getLevelData().getTowerId());
if (highestLevel >= this.getLevelId()) {
return change;
}
@@ -74,11 +78,15 @@ public class InfinityTowerManager extends PlayerManager {
change.setExtraData(rewards);
// Log in player progress
this.getPlayer().getProgress().addInfinityArenaLog(this.getLevelId());
this.getPlayer().getProgress().addInfinityTowerLog(this.getLevelData());
// Trigger achievement
this.getPlayer().trigger(AchievementCondition.InfinityTowerClearSpecificFloor, 10, this.getLevelId(), 0);
// Clear instance
this.levelId = 0;
this.buildId = 0;
// Success
return change.setSuccess(true);
}
@@ -70,6 +70,10 @@ public class InstanceManager extends PlayerManager {
// Set extra data
change.setExtraData(settleData);
// Clear instance
this.curInstanceId = 0;
this.rewardType = 0;
// Success
return change.setSuccess(true);
}
@@ -17,6 +17,10 @@ public class InstanceSettleData {
}
public void generateRewards(InstanceData data) {
this.generateRewards(data, 0);
}
public void generateRewards(InstanceData data, int rewardType) {
if (this.isFirst) {
this.firstRewards = data.getFirstRewards(rewardType).generate();
@@ -20,7 +20,7 @@ import emu.nebula.proto.Public.Item;
import emu.nebula.proto.Public.Res;
import emu.nebula.proto.Public.Title;
import emu.nebula.proto.Public.UI32;
import emu.nebula.util.String2IntMap;
import emu.nebula.util.ints.String2IntMap;
import emu.nebula.game.achievement.AchievementCondition;
import emu.nebula.game.player.Player;
import emu.nebula.game.player.PlayerChangeInfo;
@@ -259,6 +259,10 @@ public class Inventory extends PlayerManager implements GameDatabaseObject {
return true;
}
public boolean hasHonor(int id) {
return id == GameConstants.DEFAULT_HONOR_ID || this.getHonorList().contains(id);
}
// Resources
public synchronized int getResourceCount(int id) {
@@ -34,7 +34,9 @@ public enum ItemSubType {
Honor (43),
CharacterYO (44),
PlayHead (45),
CharacterSkin (46);
CharacterSkin (46),
SouvenirEnergyItem (47),
Build (48);
@Getter
private final int value;
@@ -37,7 +37,7 @@ public class GameMail {
this.author = author;
this.subject = subject;
this.desc = desc;
this.time = Nebula.getCurrentTime();
this.time = Nebula.getCurrentServerTime();
this.expiry = this.time + TimeUnit.DAYS.toSeconds(30);
}
@@ -45,7 +45,6 @@ import emu.nebula.proto.Public.Friend;
import emu.nebula.proto.Public.HonorInfo;
import emu.nebula.proto.Public.NewbieInfo;
import emu.nebula.proto.Public.QuestType;
import emu.nebula.proto.Public.Story;
import emu.nebula.proto.Public.WorldClass;
import emu.nebula.proto.Public.WorldClassRewardState;
import emu.nebula.util.Utils;
@@ -76,6 +75,7 @@ public class Player implements GameDatabaseObject {
private int skinId;
private int titlePrefix;
private int titleSuffix;
private long music;
private int[] honor;
private int[] showChars;
private int[] boards;
@@ -147,7 +147,7 @@ public class Player implements GameDatabaseObject {
// Set basic info
this.accountUid = account.getUid();
this.createTime = Nebula.getCurrentTime();
this.createTime = Nebula.getCurrentServerTime();
this.name = name;
this.signature = "";
@@ -345,6 +345,22 @@ public class Player implements GameDatabaseObject {
return true;
}
public boolean setMusic(long id) {
// Make sure we own the disc
if (id != 0 && !this.getCharacters().hasDisc((int) id)) {
return false;
}
// Set main menu music
this.music = id;
// Update in database
Nebula.getGameDatabase().update(this, this.getUid(), "music", this.getMusic());
// Success
return true;
}
public boolean setSkin(int skinId) {
// Skip if we are setting the same skin
if (this.skinId == skinId) {
@@ -406,8 +422,20 @@ public class Player implements GameDatabaseObject {
// Verify that we have the honor titles
for (int id : honorIds) {
if (id != 0 && !getInventory().getHonorList().contains(id)) {
System.out.println(id);
// Empty honor title
if (id == 0) {
continue;
}
// Make sure we own the honor title
if (!getInventory().hasHonor(id)) {
return false;
}
// Make sure honor exists and won't crash the client
var honor = GameData.getHonorDataTable().get(id);
if (honor == null || !honor.isValid()) {
return false;
}
}
@@ -533,7 +561,7 @@ public class Player implements GameDatabaseObject {
public int getEnergy() {
// Cache time
long time = Nebula.getCurrentTime();
long time = Nebula.getCurrentServerTime();
// Calculate time diff
double diff = time - this.energyLastUpdate;
@@ -634,12 +662,6 @@ public class Player implements GameDatabaseObject {
// Trigger quest/achievement login
this.trigger(QuestCondition.LoginTotal, 1);
// Add weekly boss entry item
int entries = this.getInventory().getResourceCount(GameConstants.WEEKLY_ENTRY_ITEM_ID);
if (entries < 3) {
this.getInventory().addItem(GameConstants.WEEKLY_ENTRY_ITEM_ID, 3 - entries);
}
// Give sign-in rewards
this.getSignInRewards(hasMonthChanged);
@@ -682,11 +704,24 @@ public class Player implements GameDatabaseObject {
public void resetDailies(boolean resetWeekly, boolean resetMonthly) {
// Reset daily quests
this.getQuestManager().resetDailyQuests();
this.getQuestManager().resetDailyQuests(resetWeekly);
this.getBattlePassManager().getBattlePass().resetDailyQuests(resetWeekly);
// Reset monthly shop purchases
// Check to reset weeklies
if (resetWeekly) {
// Add weekly boss entry item
int entries = this.getInventory().getResourceCount(GameConstants.WEEKLY_ENTRY_ITEM_ID);
if (entries < 3) {
this.getInventory().addItem(GameConstants.WEEKLY_ENTRY_ITEM_ID, 3 - entries);
}
// Reset weekly tower tickets
this.getProgress().clearWeeklyTowerTicketLog();
}
// Check if we need to reset monthly
if (resetMonthly) {
// Reset monthly shop purchases
this.getInventory().resetShopPurchases();
}
}
@@ -722,6 +757,7 @@ public class Player implements GameDatabaseObject {
if (manager != null) {
manager.setPlayer(this);
manager.onLoad();
} else {
try {
manager = cls.getDeclaredConstructor(Player.class).newInstance(this);
@@ -782,6 +818,12 @@ public class Player implements GameDatabaseObject {
// See if we need to reset dailies
this.checkResetDailies();
// Fix any broken honor ids
this.checkBrokenHonor();
// Update activities
this.getActivityManager().onLogin();
// Update last login time
this.lastLogin = System.currentTimeMillis();
Nebula.getGameDatabase().update(this, this.getUid(), "lastLogin", this.getLastLogin());
@@ -809,13 +851,44 @@ public class Player implements GameDatabaseObject {
}
}
/**
* Checks the player's honor ids to make sure they don't crash the client
*/
private void checkBrokenHonor() {
boolean changed = false;
for (int i = 0; i < this.honor.length; i++) {
int honorId = this.honor[i];
if (honorId == 0) {
continue;
}
// Get honor data
var honor = GameData.getHonorDataTable().get(honorId);
// Check if honor is valid
if (honor == null || !honor.isValid()) {
this.honor[i] = 0;
changed = true;
}
}
// Update in database
if (changed) {
Nebula.getGameDatabase().update(this, this.getUid(), "honor", this.getHonor());
}
}
// Proto
public PlayerInfo toProto() {
PlayerInfo proto = PlayerInfo.newInstance()
.setServerTs(Nebula.getCurrentTime())
.setServerTs(Nebula.getCurrentServerTime())
.setSigninIndex(this.getSignInIndex())
.setTowerTicket(this.getProgress().getTowerTickets())
.setDailyShopRewardStatus(this.getQuestManager().hasDailyReward())
.setMusicInfo(this.getMusic())
.setAchievements(new byte[64]);
var acc = proto.getMutableAcc()
@@ -900,7 +973,8 @@ public class Player implements GameDatabaseObject {
state.getMutableAchievement()
.setNew(this.getAchievementManager().hasNewAchievements());
state.getMutableFriendEnergy();
state.getMutableFriendEnergy()
.setState(this.getFriendList().hasEnergy());
state.getMutableMallPackage();
state.getMutableTravelerDuelQuest()
.setType(QuestType.TravelerDuel);
@@ -923,14 +997,7 @@ public class Player implements GameDatabaseObject {
acc.addNewbies(NewbieInfo.newInstance().setGroupId(GameConstants.INTRO_GUIDE_ID).setStepId(-1));
// Story
var story = proto.getMutableStory();
for (int storyId : this.getStoryManager().getCompletedStories()) {
var storyProto = Story.newInstance()
.setIdx(storyId);
story.addStories(storyProto);
}
this.getStoryManager().encodePlayerInfo(proto);
// Add titles
for (int titleId : this.getInventory().getTitles()) {
@@ -946,7 +1013,7 @@ public class Player implements GameDatabaseObject {
}
// Quests
this.getQuestManager().encodeProto(proto);
this.getQuestManager().encodePlayerInfo(proto);
// Add dictionary tabs
for (var dictionaryData : GameData.getDictionaryTabDataTable()) {
@@ -965,11 +1032,12 @@ public class Player implements GameDatabaseObject {
}
// Add progress
this.getProgress().encodeProto(proto);
this.getProgress().encodePlayerInfo(proto);
// Handbook
proto.addHandbook(this.getCharacters().getCharacterHandbook());
proto.addHandbook(this.getCharacters().getDiscHandbook());
proto.addHandbook(this.getStoryManager().getCgHandbook());
// Phone
var phone = proto.getMutablePhone();
@@ -1022,7 +1090,7 @@ public class Player implements GameDatabaseObject {
}
public Energy getEnergyProto() {
long nextDuration = Math.max(GameConstants.ENERGY_REGEN_TIME - (Nebula.getCurrentTime() - getEnergyLastUpdate()), 1);
long nextDuration = Math.max(GameConstants.ENERGY_REGEN_TIME - (Nebula.getCurrentServerTime() - getEnergyLastUpdate()), 1);
var proto = Energy.newInstance()
.setUpdateTime(this.getEnergyLastUpdate())
@@ -0,0 +1,192 @@
package emu.nebula.game.player;
import lombok.Getter;
// resources\bin\ErrorCode.json
// resources\language\en_US\ErrorCode.json
@Getter
public enum PlayerErrorCode {
ErrInvalidToken(100101),
ErrInvalidTimestamp(100102),
ErrInvalidMsgId(100103),
ErrInvalidMsgBody(100104),
ErrAgentBusy(100105),
ErrServiceUnavailable(100106),
ErrRequestTimeout(100107),
ErrLoginFailed(100108),
ErrInvalidVersion(100109),
ErrLogin(100110),
ErrMask(110101),
ErrServerBusy(110102),
ErrData(110103),
ErrArgs(110104),
ErrInternal(110105),
ErrTokenExpire(110106),
ErrRelogin(110107),
ErrInvalidReq(110108),
ErrApiDisabled(110109),
ErrResUpdated(110110),
ErrOperateTooFast(110111),
ErrNickLenViolation(110201),
ErrNickIllegal(110202),
ErrNickForbidden(110203),
ErrBan(110205),
ErrSignatureForbidden(110206),
ErrSignatureLenViolation(110207),
ErrSignatureIllegal(110208),
ErrTitleNotFound(110209),
ErrSurveyNotFound(110210),
ErrSurveyNotOpenYet(110211),
ErrSurveyHasCompleted(110212),
ErrMailMiss(110401),
ErrMailRevoked(110402),
ErrMailUpdate(110403),
ErrMailPinned(110404),
ErrQuestNotComplete(110501),
ErrQuestClosed(110502),
ErrProductNotReady(110601),
ErrProductRestockLimit(110602),
ErrGoodsNotFound(110603),
ErrGoodsLockPurchase(110604),
ErrGoodsDelisted(110605),
ErrShopNotFound(110606),
ErrShopAlreadyClosed(110607),
ErrRecvReward(110701),
ErrMainlineCondPremission(110702),
ErrEnergyHoldLimit(110801),
ErrEnergyBuyLimit(110802),
ErrEnergyLack(110803),
ErrEnergyRestore(110804),
ErrGachaSpinLimit(110901),
ErrItemUseRefused(111001),
ErrRglInProgress(111101),
ErrRglCond(111102),
ErrRglBuildNotFound(111103),
ErrRglBuildLock(111104),
ErrFormationIdNeed(111105),
ErrFormationFullNeed(111106),
ErrBuildNameMinLenLimit(111107),
ErrBuildNameMaxLenLimit(111108),
ErrBuildNameViolation(111109),
ErrOutfitStrengthenMax(111201),
ErrOutfitNoData(111202),
ErrOutfitBeEquipped(111203),
ErrOutfitBeLocked(111204),
ErrOutfitPhaseMax(111205),
ErrOutfitStarMax(111206),
ErrOutfitLevelNotReached(111207),
ErrGiftPackageInvalid(111301),
ErrGiftPackageExpired(111302),
ErrGiftPackError(111303),
ErrRedeemCodeReachedLimit(111304),
ErrUserExchangeCountReachedLimit(111305),
ErrGiftPackageAlreadyExists(111306),
ErrGiftPackageInfoInvalid(111307),
ErrRedeemCodeItemListEmpty(111308),
ErrRedeemCodeCodeItemInvalid(111309),
ErrGiftPackageStartTimeError(111310),
ErrGiftPackageEndTimeError(111311),
ErrGiftPackageRedeemCodeQuantityExceedsLimit(111312),
ErrFixedRedeemCodeAlreadyExists(111313),
ErrFixedRedeemCodeCannotBeEmpty(111314),
ErrRedeemCodeQuantityCannotBeZero(111315),
ErrFixedRedeemCodeUserUsageQuantityRequired(111316),
ErrRedeemCodeInvalid(111317),
ErrRedeemCodeFailed(111318),
ErrRedeemCodeAlreadyUsed(111319),
ErrRedeemFailed(111320),
ErrInviteNotFound(111401),
ErrUserInviteCountLimit(111402),
ErrUserFriendCountLimit(111403),
ErrAlreadyExistFriend(111404),
ErrFriendEnergyReceiveMax(110681),
ErrMallPackageNotListed(111501),
ErrMallPackageDelisted(111502),
ErrMallPackageStockLimit(111503),
ErrMallPackageOrderLimit(111504),
ErrOrderCantRemove(111505),
ErrHeartStoneMax(111601),
ErrWeaponMaxAdvance(111602),
ErrWeaponCondNoMet(111603),
ErrCharMaxLevel(111604),
ErrCharCondMaxAdvance(111605),
ErrCharMaxAdvance(111606),
ErrCharSkillMaxLevel(111607),
ErrCharSkillCondNotMet(111608),
ErrPresentsNoData(111609),
ErrPresentsUpgradeMax(111610),
ErrPresentsBeEquipped(111611),
ErrPresentsBeLocked(111612),
ErrNotAllowedRecruit(111613),
ErrAffinityMaxLevel(111614),
ErrAffinityGiftSendCountLimit(111615),
ErrDatingCountLimit(111616),
ErrDatingSendCountLimit(111617),
ErrCharWorldClassCondNotMet(111618),
ErrDatingCharLimit(111619),
ErrCharArchiveRewardReceived(111620),
ErrReceiveEnergyFriendNotData(111621),
ErrBattlePassVersionMismatch(111701),
ErrTravelerDuelSeasonEnd(111801),
ErrProductionFormulaUnactivated(111901),
ErrTalentAlreayActiveated(112001),
ErrTalentGroupNotYetOpen(112002),
ErrTalentKeyNodesInsufficientQuantity(112003),
ErrTalentOrdinaryNodesInsufficientQuantity(112004),
ErrTalentListEmpty(112005),
ErrTalentResetFrequently(112006),
ErrTalentActivationLimit(112007),
ErrTalentNotYetActivated(112008),
ErrEquipmentNoData(112101),
ErrEquipmentUpgradeMax(112102),
ErrEquipmentBeEquipped(112103),
ErrEquipmentBeLocked(112104),
ErrDiscNoData(112201),
ErrDiscLevelNotReached(112202),
ErrDiscStrengthenMax(112203),
ErrDiscPhaseMax(112204),
ErrDiscStarMax(112205),
ErrStarTowerRankSeasonNoData(112301),
ErrStarTowerRankSeasonNotYetOpen(112302),
ErrStarTowerRankSeasonEnd(112303),
ErrAgentNoData(112401),
ErrAgentInProcess(112402),
ErrAgentCond(112403),
ErrAgentCharOccupied(112404),
ErrAgentBuildOccupied(112405),
ErrAgentBuildScoreLow(112406),
ErrAgentCountLimit(112407),
ErrAgentDailyLimit(112408),
ErrAgentWeeklyLimit(112409),
ErrAgentNotCompleted(112410),
ErrVampireSurvivorBuildNum(112501),
ErrVampireSurvivorBuildCharRepetition(112502),
ErrTowerGrowthGroupActivated(112601),
ErrJointDrillNotExist(112701),
ErrJointDrillInProgress(112702),
ErrJointDrillNotYetOpen(112703),
ErrJointDrillAlreadyClosed(112704),
ErrScoreBossNotOpen(112801),
ErrNickNameResetLimit(112901),
ErrCapOverflow(119901),
ErrConfig(119902),
ErrCondCheck(119903),
ErrNotYetOpen(119904),
ErrAlreadyClosed(119905),
ErrCondNotMet(119906),
ErrInsufficientWorldClass(119907),
ErrNoRewardsToReceive(119908),
ErrAlreayExists(119909),
ErrExchangeNotSupported(119910),
ErrRequestTooFrequent(119911),
ErrAlreaydReceive(119912),
ErrLimit(119913),
ErrDataUpdated(119914);
final int value;
PlayerErrorCode(int value) {
this.value = value;
}
}
@@ -24,4 +24,11 @@ public abstract class PlayerManager {
public int getPlayerUid() {
return this.getPlayer().getUid();
}
/**
* Called when the manager is loaded from the database
*/
public void onLoad() {
}
}
Loaded 100 of 175 files, more files were not shown because too many files have changed in this diff. Show more