mirror of
https://github.com/Melledy/Nebula.git
synced 2026-11-04 21:36:51 +01:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
088c2df58a | ||
|
|
f949f3b619 | ||
|
|
9f8fd4464b | ||
|
|
3aaa5bb334 | ||
|
|
297255a316 | ||
|
|
fba1dfccd6 | ||
|
|
957d3a9ac3 | ||
|
|
9db0f6aabb | ||
|
|
b086851b95 | ||
|
|
9df83c5205 | ||
|
|
c2ebff92c9 | ||
|
|
92c7dbcbc5 | ||
|
|
a8e358d2d6 | ||
|
|
450b0cca30 | ||
|
|
c75da823e0 | ||
|
|
b4948212ce | ||
|
|
53839b48ca | ||
|
|
b5fde4433d | ||
|
|
495e76a456 | ||
|
|
496d012c36 | ||
|
|
c5d6d707f8 | ||
|
|
d9b502002c | ||
|
|
85b08c7593 | ||
|
|
4da479a88a | ||
|
|
21467faa7f | ||
|
|
72d9cd530d | ||
|
|
26019d639b | ||
|
|
ee5d759a98 | ||
|
|
f439b25f2a | ||
|
|
4fb2712a89 | ||
|
|
e5ffb1743a | ||
|
|
4d14099f11 | ||
|
|
9599877005 | ||
|
|
31e56ae17f | ||
|
|
ab1f84e8db | ||
|
|
588522df88 | ||
|
|
660d5a3cf7 | ||
|
|
1aa2129bba | ||
|
|
968880c320 | ||
|
|
353d7d97b6 | ||
|
|
c51268bcb8 | ||
|
|
11ea526a35 | ||
|
|
5668ba9cea | ||
|
|
fef25496fa | ||
|
|
5d9ff6e1af | ||
|
|
3a6387c2bd | ||
|
|
6483e8a5a7 | ||
|
|
5d797fb9d3 | ||
|
|
0ad87dd751 | ||
|
|
5b7adc8fa4 | ||
|
|
6f832bcdfe | ||
|
|
bf5fe3912f | ||
|
|
c5f339c8be | ||
|
|
80a181680b | ||
|
|
f582444679 | ||
|
|
2af715477e | ||
|
|
9d77005da6 | ||
|
|
78d88a87cd | ||
|
|
e5ce16d6ea | ||
|
|
b92319b4c5 | ||
|
|
1b0b6873b9 | ||
|
|
f542ea7cb4 | ||
|
|
fa08bcebae | ||
|
|
209ce83fc9 | ||
|
|
8e7ef038ea | ||
|
|
90f4be862f | ||
|
|
05e74f4d12 | ||
|
|
005f138599 | ||
|
|
be5a6709fd | ||
|
|
c6ac09f112 | ||
|
|
7f0bdb1824 | ||
|
|
f8bd7d5db2 | ||
|
|
a7eddd2ed0 | ||
|
|
467b7443f3 | ||
|
|
2a7817df95 | ||
|
|
dfb93cae4b | ||
|
|
5707c1c919 | ||
|
|
51f6db9803 | ||
|
|
3df873e385 | ||
|
|
f44262f427 | ||
|
|
cf63bc0b7e | ||
|
|
b7bf1fcdeb | ||
|
|
198d3aac4f | ||
|
|
810427a028 | ||
|
|
70c7c849df | ||
|
|
0b7f1ae3a2 | ||
|
|
5182e94db7 | ||
|
|
426e5bce63 | ||
|
|
b9c4a174f8 | ||
|
|
6974631601 | ||
|
|
880f0d1d7d | ||
|
|
86c607c0b3 | ||
|
|
3710f0a697 | ||
|
|
c19aa5d0a1 | ||
|
|
be84e0f406 | ||
|
|
e5cb842fdd | ||
|
|
15618414a6 | ||
|
|
71de6184b9 | ||
|
|
e887d5eb4c | ||
|
|
211e012c42 | ||
|
|
9c87d74ad7 | ||
|
|
357d12779b | ||
|
|
c8a7db75aa | ||
|
|
ef8846445c | ||
|
|
7ef7490c37 | ||
|
|
2c1e1ae2fb | ||
|
|
e3d34bfa48 | ||
|
|
65250b07bf | ||
|
|
b38f4f0957 | ||
|
|
e4dc85a50f | ||
|
|
893b23b50d | ||
|
|
33b1cf55d4 | ||
|
|
aecea6ab03 | ||
|
|
e8e7df7d50 | ||
|
|
9188d3b53a | ||
|
|
30f565d0d6 | ||
|
|
faa4ea0780 | ||
|
|
354f390c3b | ||
|
|
3171bce3cc | ||
|
|
56b4d3b66d | ||
|
|
585734c2f3 | ||
|
|
6f7a92725a | ||
|
|
a04f3354f7 | ||
|
|
f53bdaba32 |
No files matched your search
@@ -1,9 +1,11 @@
|
||||
# Nebula
|
||||
|
||||
A work in progress game server emulator for a certain anime game.
|
||||
A work in progress game server emulator for a certain anime game. Most features are implemented.
|
||||
|
||||
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,20 +16,26 @@ For any extra support, questions, or discussions, check out our [Discord](https:
|
||||
- Daily quests
|
||||
- Battle pass
|
||||
- Gacha
|
||||
- Friend system (sending energy not implemented)
|
||||
- Shop (using only in-game currency)
|
||||
- Friend system
|
||||
- Shop (only in-game currency supported)
|
||||
- Commissions
|
||||
- Heartlink
|
||||
- Monoliths (completeable but many other features missing)
|
||||
- Achievements
|
||||
- Monoliths (research quests not implemented)
|
||||
- Bounty Trials
|
||||
- Menance Arena
|
||||
- Proving grounds
|
||||
- Proving Grounds
|
||||
- Catacylsm Survivor (talents not fully working)
|
||||
- Boss Blitz
|
||||
- Events (Only tower defense and trials)
|
||||
|
||||
### Not implemented
|
||||
- Achievements
|
||||
- Events
|
||||
### Supported regions
|
||||
|
||||
Nebula supports the global PC client by default. If you want to switch regions, you need to change the `region` field in the Nebula config.
|
||||
|
||||
Current supported regions (PC): `GLOBAL`, `KR`, `JP`, `TW`, `CN`
|
||||
|
||||
You may need to change the data version when switching regions. The `customDataVersion` field should match the the data version of your client, which is usually the last number of your client's version string (top left of your login screen). Example: 1.0.0.42 = data version 42.
|
||||
|
||||
# Running the server and client
|
||||
|
||||
@@ -38,7 +46,7 @@ For any extra support, questions, or discussions, check out our [Discord](https:
|
||||
* [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.
|
||||
@@ -49,17 +57,25 @@ For any extra support, questions, or discussions, check out our [Discord](https:
|
||||
3. Copy and paste the following code into the Fiddlerscript tab of Fiddler Classic. Remember to save the fiddler script after you copy and paste it:
|
||||
|
||||
```
|
||||
import System;
|
||||
import System.Windows.Forms;
|
||||
import Fiddler;
|
||||
import System.Text.RegularExpressions;
|
||||
|
||||
class Handlers
|
||||
{
|
||||
static var list = [
|
||||
".yostarplat.com",
|
||||
".stellasora.global",
|
||||
".stellasora.kr",
|
||||
".stellasora.jp",
|
||||
".stargazer-games.com",
|
||||
".yostar.cn"
|
||||
];
|
||||
|
||||
static function OnBeforeRequest(oS: Session) {
|
||||
if (oS.host.EndsWith(".yostarplat.com") || oS.host.EndsWith(".stellasora.global")) {
|
||||
oS.oRequest.headers.UriScheme = "http";
|
||||
oS.host = "localhost"; // This can also be replaced with another IP address.
|
||||
for (var i = 0; i < list.length; i++) {
|
||||
if (oS.host.EndsWith(list[i])) {
|
||||
oS.oRequest.headers.UriScheme = "http";
|
||||
oS.host = "localhost"; // This can also be replaced with another IP address
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -68,25 +84,20 @@ class Handlers
|
||||
4. If `autoCreateAccount` is set to true in the config, then you can skip this step. Otherwise, type `/account create [account email]` in the server console to create an account.
|
||||
5. Login with your account email, the code field is ignored by the server and can be set to anything.
|
||||
|
||||
If you are not on the global client, `.stellasora.global` in the fiddlerscript may need to be changed to match the endpoint your client connects to.
|
||||
|
||||
### Supported regions
|
||||
|
||||
Nebula supports the global client by default. If you want to switch regions, you need to change the `customDataVersion` and `region` fields in the Nebula config. The `customDataVersion` field should match the the data version of your client, which is usually the last number of your client's version string (top left of your login screen). Example: 1.0.0.42 = data version 42.
|
||||
|
||||
Current supported regions: `global`, `kr`
|
||||
|
||||
### Server commands
|
||||
Server commands need to be run in the server console OR in the signature edit menu of your profile.
|
||||
|
||||
```
|
||||
!account {create | delete} [email] (reserved player uid) = Creates or deletes an account.
|
||||
!battlepass [free | premium] lv(level) = Modifies the targeted player's battle pass
|
||||
!char [all | {characterId}] lv(level) a(ascension) s(skill level) t(talent level) f(affinity level) = Changes the properties of the targeted characters.
|
||||
!clean [all | {id} ...] [items|resources] = Removes items/resources from the targeted player.
|
||||
!disc [all | {discId}] lv(level) a(ascension) c(crescendo level) = Changes the properties of the targeted discs.
|
||||
!give [item id] x[amount] = Gives the targeted player an item through the mail.
|
||||
!giveall [characters | discs | materials] = Gives the targeted player items.
|
||||
!help = Displays a list of available commands. (Very spammy in-game)
|
||||
!level (level) = Sets the player level
|
||||
!mail = Sends the targeted player a system mail.
|
||||
!mail "subject" "body" [itemId xQty | itemId:qty ...] = Sends the targeted player a system mail.
|
||||
!reload = Reloads the server config.
|
||||
!remote = Creates a player token for remote api usage
|
||||
```
|
||||
+1
-1
@@ -29,7 +29,7 @@ java {
|
||||
}
|
||||
}
|
||||
|
||||
version = '1.1.1'
|
||||
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");
|
||||
|
||||
@@ -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";
|
||||
@@ -101,14 +102,23 @@ public class Config {
|
||||
|
||||
@Getter
|
||||
public static class ServerOptions {
|
||||
// Default permissions for accounts. By default, all commands are allowed. Reccomended to change if making a public server.
|
||||
public Set<String> defaultPermissions = Set.of("*");
|
||||
// Automatically creates an account when a player logs in for the first time on a new email.
|
||||
public boolean autoCreateAccount = true;
|
||||
// Skips the intro cinematics/stage when starting a new account.
|
||||
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;
|
||||
public int sessionTimeout = 600; // How long to wait (in seconds) after the last http request from a session
|
||||
// before removing it from the server
|
||||
// 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.
|
||||
public int dailyResetHour = 0;
|
||||
public int leaderboardRefreshTime = 60; // Leaderboard refresh time in seconds
|
||||
// Leaderboard for Boss Blitz refresh time in seconds.
|
||||
public int leaderboardRefreshTime = 60;
|
||||
// The welcome mail to send when a player is created. Set to null to disable.
|
||||
public WelcomeMail welcomeMail = new WelcomeMail();
|
||||
}
|
||||
|
||||
@@ -121,6 +131,7 @@ public class Config {
|
||||
public static class LogOptions {
|
||||
public boolean commands = true;
|
||||
public boolean packets = false;
|
||||
public boolean httpDebug = false;
|
||||
}
|
||||
|
||||
@Getter
|
||||
@@ -141,10 +152,10 @@ public class Config {
|
||||
this.sender = "Server";
|
||||
this.content = "Welcome to Nebula! Please take these items as a starter gift.";
|
||||
this.attachments = List.of(
|
||||
new ItemParam(86009, 1),
|
||||
new ItemParam(86002, 1),
|
||||
new ItemParam(1, 1_000_000),
|
||||
new ItemParam(2, 30_000));
|
||||
new ItemParam(86009, 1),
|
||||
new ItemParam(86002, 1),
|
||||
new ItemParam(1, 1_000_000),
|
||||
new ItemParam(2, 30_000));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,21 +6,41 @@ import emu.nebula.game.inventory.ItemParam;
|
||||
import emu.nebula.util.WeightedList;
|
||||
|
||||
public class GameConstants {
|
||||
private static final int DATA_VERSION = 54;
|
||||
private 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(75);
|
||||
|
||||
RegionConfig.getRegion("kr")
|
||||
.setDataVersion(82);
|
||||
|
||||
RegionConfig.getRegion("jp")
|
||||
.setDataVersion(79);
|
||||
|
||||
RegionConfig.getRegion("tw")
|
||||
.setDataVersion(76);
|
||||
|
||||
RegionConfig.getRegion("cn")
|
||||
.setDataVersion(77);
|
||||
}
|
||||
|
||||
public static final ZoneId UTC_ZONE = ZoneId.of("UTC");
|
||||
|
||||
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;
|
||||
public static final int PREM_GEM_ITEM_ID = 3;
|
||||
public static final int ENERGY_BUY_ITEM_ID = GEM_ITEM_ID;
|
||||
public static final int STAR_TOWER_GOLD_ITEM_ID = 11;
|
||||
public static final int EXP_ITEM_ID = 21;
|
||||
public static final int WEEKLY_ENTRY_ITEM_ID = 28;
|
||||
|
||||
public static final int MAX_ENERGY = 240;
|
||||
public static final int ENERGY_REGEN_TIME = 360; // Seconds
|
||||
@@ -29,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;
|
||||
|
||||
@@ -37,6 +61,11 @@ public class GameConstants {
|
||||
public static final int MAX_FRIENDSHIPS = 50;
|
||||
public static final int MAX_PENDING_FRIENDSHIPS = 30;
|
||||
|
||||
public static final int TOWER_COIN_ITEM_ID = 11;
|
||||
public static final int[] TOWER_EVENTS_IDS = new int[] {
|
||||
101, 102, 104, 105, 106, 107, 108, 114, 115, 116, 126, 127, 128
|
||||
};
|
||||
|
||||
public static int[][] VAMPIRE_SURVIVOR_BONUS_POWER = new int[][] {
|
||||
new int[] {100, 120},
|
||||
new int[] {200, 150},
|
||||
@@ -57,7 +86,14 @@ public class GameConstants {
|
||||
// Helper functions
|
||||
|
||||
public static String getGameVersion() {
|
||||
return VERSION + "." + getDataVersion() + " (" + Nebula.getConfig().getRegion().toUpperCase() + ")";
|
||||
// Load data version
|
||||
var region = RegionConfig.getRegion(Nebula.getConfig().getRegion());
|
||||
|
||||
// Set data version from region
|
||||
GameConstants.DATA_VERSION = region.getDataVersion();
|
||||
|
||||
// Init game version string
|
||||
return VERSION + "." + getDataVersion() + " (" + region.getName().toUpperCase() + ")";
|
||||
}
|
||||
|
||||
public static int getDataVersion() {
|
||||
|
||||
@@ -43,9 +43,8 @@ public class Nebula {
|
||||
@Getter private static PluginManager pluginManager;
|
||||
|
||||
public static void main(String[] args) {
|
||||
// Load config + keys first
|
||||
// Load config first
|
||||
Nebula.loadConfig();
|
||||
AeadHelper.loadKeys();
|
||||
|
||||
// Start Server
|
||||
Nebula.getLogger().info("Starting Nebula " + getJarVersion());
|
||||
@@ -54,6 +53,9 @@ public class Nebula {
|
||||
|
||||
boolean generateHandbook = true;
|
||||
|
||||
// Load keys
|
||||
AeadHelper.loadKeys();
|
||||
|
||||
// Load plugin manager
|
||||
Nebula.pluginManager = new PluginManager();
|
||||
|
||||
@@ -225,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,42 @@
|
||||
package emu.nebula;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.Object2ObjectMap;
|
||||
import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter @Setter
|
||||
public class RegionConfig {
|
||||
private String name;
|
||||
private int dataVersion;
|
||||
private String serverMetaKey;
|
||||
private String serverGarbleKey;
|
||||
|
||||
private static Object2ObjectMap<String, RegionConfig> REGIONS = new Object2ObjectOpenHashMap<>();
|
||||
|
||||
public RegionConfig(String name) {
|
||||
this.name = name;
|
||||
this.serverMetaKey = "";
|
||||
this.serverGarbleKey = "";
|
||||
}
|
||||
|
||||
public RegionConfig setDataVersion(int i) {
|
||||
this.dataVersion = i;
|
||||
return this;
|
||||
}
|
||||
|
||||
public RegionConfig setServerMetaKey(String key) {
|
||||
this.serverMetaKey = key;
|
||||
return this;
|
||||
}
|
||||
|
||||
public RegionConfig setServerGarbleKey(String key) {
|
||||
this.serverGarbleKey = key;
|
||||
return this;
|
||||
}
|
||||
|
||||
public static RegionConfig getRegion(String name) {
|
||||
String regionName = name.toLowerCase();
|
||||
return REGIONS.computeIfAbsent(regionName, r -> new RegionConfig(regionName));
|
||||
}
|
||||
}
|
||||
@@ -7,8 +7,8 @@ import emu.nebula.game.character.GameCharacter;
|
||||
import emu.nebula.game.character.GameDisc;
|
||||
import emu.nebula.game.player.Player;
|
||||
import emu.nebula.util.Utils;
|
||||
import it.unimi.dsi.fastutil.ints.Int2IntLinkedOpenHashMap;
|
||||
import it.unimi.dsi.fastutil.ints.Int2IntMap;
|
||||
import it.unimi.dsi.fastutil.ints.Int2IntOpenHashMap;
|
||||
import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet;
|
||||
import it.unimi.dsi.fastutil.objects.ObjectSet;
|
||||
import lombok.Getter;
|
||||
@@ -53,6 +53,9 @@ public class CommandArgs {
|
||||
} else if (arg.startsWith("lv")) { // Level
|
||||
this.level = Utils.parseSafeInt(arg.substring(2));
|
||||
it.remove();
|
||||
} else if (arg.startsWith("lvl")) { // Level
|
||||
this.level = Utils.parseSafeInt(arg.substring(3));
|
||||
it.remove();
|
||||
} else if (arg.startsWith("a")) { // Advance
|
||||
this.advance = Utils.parseSafeInt(arg.substring(1));
|
||||
it.remove();
|
||||
@@ -76,7 +79,7 @@ public class CommandArgs {
|
||||
int key = Integer.parseInt(split[0]);
|
||||
int value = Integer.parseInt(split[1]);
|
||||
|
||||
if (this.map == null) this.map = new Int2IntOpenHashMap();
|
||||
if (this.map == null) this.map = new Int2IntLinkedOpenHashMap();
|
||||
this.map.put(key, value);
|
||||
|
||||
it.remove();
|
||||
|
||||
@@ -6,7 +6,7 @@ import emu.nebula.command.CommandHandler;
|
||||
import emu.nebula.game.account.AccountHelper;
|
||||
import emu.nebula.util.Utils;
|
||||
|
||||
@Command(label = "account", permission = "admin.account", desc = "/account {create | delete} [email] (reserved player uid). Creates or deletes an account.")
|
||||
@Command(label = "account", permission = "admin.account", desc = "!account {create | delete} [email] (reserved player uid). Creates or deletes an account.")
|
||||
public class AccountCommand implements CommandHandler {
|
||||
|
||||
@Override
|
||||
|
||||
@@ -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";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package emu.nebula.command.commands;
|
||||
|
||||
import emu.nebula.command.Command;
|
||||
import emu.nebula.command.CommandArgs;
|
||||
import emu.nebula.command.CommandHandler;
|
||||
import emu.nebula.net.NetMsgId;
|
||||
|
||||
@Command(label = "battlepass", aliases = {"bp"}, permission = "player.battlepass", desc = "!battlepass [free | premium] lv(level) = Modifies the targeted player's battle pass")
|
||||
public class BattlePassCommand implements CommandHandler {
|
||||
|
||||
@Override
|
||||
public String execute(CommandArgs args) {
|
||||
// Get target
|
||||
var target = args.getTarget();
|
||||
var battlepass = target.getBattlePassManager().getBattlePass();
|
||||
boolean changed = false;
|
||||
|
||||
// Check if we are changing premium status
|
||||
int mode = -1;
|
||||
|
||||
for (var arg : args.getList()) {
|
||||
if (arg.equalsIgnoreCase("free")) {
|
||||
mode = 0;
|
||||
} else if (arg.equalsIgnoreCase("premium")) {
|
||||
mode = 2;
|
||||
}
|
||||
}
|
||||
|
||||
if (mode >= 0 && battlepass.getMode() != mode) {
|
||||
battlepass.setMode(mode);
|
||||
changed = true;
|
||||
}
|
||||
|
||||
// Set level
|
||||
int level = Math.min(args.getLevel(), 50);
|
||||
|
||||
if (level >= 0 && battlepass.getLevel() != level) {
|
||||
battlepass.setLevel(level);
|
||||
changed = true;
|
||||
}
|
||||
|
||||
// Check if we have made any changes
|
||||
if (changed) {
|
||||
// Save battle pass to the database
|
||||
battlepass.save();
|
||||
|
||||
// Send package to notify the client that the battle pass needs updating
|
||||
target.addNextPackage(
|
||||
NetMsgId.battle_pass_info_succeed_ack,
|
||||
battlepass.toProto()
|
||||
);
|
||||
|
||||
// Success message
|
||||
return "Changed the battle pass successfully.";
|
||||
}
|
||||
|
||||
// Result message
|
||||
return "No changes were made to the battle pass.";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,185 @@
|
||||
package emu.nebula.command.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import emu.nebula.command.Command;
|
||||
import emu.nebula.command.CommandArgs;
|
||||
import emu.nebula.command.CommandHandler;
|
||||
import emu.nebula.data.GameData;
|
||||
import emu.nebula.game.character.GameCharacter;
|
||||
import emu.nebula.game.character.GameDisc;
|
||||
import emu.nebula.game.player.Player;
|
||||
import emu.nebula.game.tower.StarTowerBuild;
|
||||
import emu.nebula.net.NetMsgId;
|
||||
import emu.nebula.util.Utils;
|
||||
import lombok.Getter;
|
||||
|
||||
@Command(
|
||||
label = "build",
|
||||
aliases = {"b", "record", "r"},
|
||||
permission = "player.build",
|
||||
requireTarget = true,
|
||||
desc = "!build [char ids...] [disc ids...] [potential ids...] [melody ids...]"
|
||||
)
|
||||
public class BuildCommand implements CommandHandler {
|
||||
|
||||
@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);
|
||||
}
|
||||
}
|
||||
|
||||
// Check if build is valid
|
||||
if (builder.getCharacters().size() != 3) {
|
||||
return "Record must have 3 different characters";
|
||||
}
|
||||
|
||||
if (builder.getDiscs().size() < 3 || builder.getDiscs().size() > 6) {
|
||||
return "Record must have 3-6 different discs";
|
||||
}
|
||||
|
||||
// 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 = "Created record for " + target.getName();
|
||||
|
||||
if (args.getSender() == null) {
|
||||
result += " (This command may take time to update on the client)";
|
||||
}
|
||||
|
||||
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) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Clamp
|
||||
count = Math.max(count, 1);
|
||||
|
||||
// Parse by item id
|
||||
switch (itemData.getItemSubType()) {
|
||||
case Char -> {
|
||||
var character = this.getPlayer().getCharacters().getCharacterById(id);
|
||||
if (character == null || !character.getData().isAvailable()) {
|
||||
break;
|
||||
}
|
||||
|
||||
this.addCharacter(character);
|
||||
}
|
||||
case Disc -> {
|
||||
var disc = this.getPlayer().getCharacters().getDiscById(id);
|
||||
if (disc == null || !disc.getData().isAvailable()) {
|
||||
break;
|
||||
}
|
||||
|
||||
this.addDisc(disc);
|
||||
}
|
||||
case Potential, SpecificPotential -> {
|
||||
var potentialData = GameData.getPotentialDataTable().get(id);
|
||||
if (potentialData == null) break;
|
||||
|
||||
int level = Math.min(count, potentialData.getMaxLevel());
|
||||
this.getBuild().getPotentials().add(id, level);
|
||||
}
|
||||
case SubNoteSkill -> {
|
||||
this.getBuild().getSubNoteSkills().add(id, count);
|
||||
}
|
||||
default -> {
|
||||
// Ignored
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void addCharacter(GameCharacter character) {
|
||||
if (this.characters.contains(character)) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.characters.add(character);
|
||||
}
|
||||
|
||||
public void addDisc(GameDisc disc) {
|
||||
if (this.discs.contains(disc)) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.discs.add(disc);
|
||||
}
|
||||
|
||||
public StarTowerBuild toBuild() {
|
||||
// Set characters and discs
|
||||
build.setChars(this.getCharacters());
|
||||
build.setDiscs(this.getDiscs());
|
||||
|
||||
// Clear character potential cache
|
||||
build.getCharPots().clear();
|
||||
|
||||
for (int charId : build.getCharIds()) {
|
||||
build.getCharPots().put(charId, 0);
|
||||
}
|
||||
|
||||
// Add potentials to character potential cache
|
||||
var it = build.getPotentials().iterator();
|
||||
while (it.hasNext()) {
|
||||
var potential = it.next();
|
||||
|
||||
var data = GameData.getPotentialDataTable().get(potential.getIntKey());
|
||||
if (data == null || !build.getCharPots().containsKey(data.getCharId())) {
|
||||
it.remove();
|
||||
continue;
|
||||
}
|
||||
|
||||
build.getCharPots().add(data.getCharId(), 1);
|
||||
}
|
||||
|
||||
// Calculate score
|
||||
build.calculateScore();
|
||||
|
||||
// Return build
|
||||
return build;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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)";
|
||||
}
|
||||
}
|
||||
@@ -20,7 +20,7 @@ import java.util.HashSet;
|
||||
aliases = {"cl", "clear"},
|
||||
permission = "player.inventory",
|
||||
requireTarget = true,
|
||||
desc = "!clean [all | {id} ...] [items|resources]. Removes items/resources from the targeted player."
|
||||
desc = "!clean [all | {id} ...] [items|resources] = Removes items/resources from the targeted player."
|
||||
)
|
||||
public class CleanCommand implements CommandHandler {
|
||||
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -12,7 +12,7 @@ import emu.nebula.command.CommandHandler;
|
||||
aliases = {"g", "item"},
|
||||
permission = "player.give",
|
||||
requireTarget = true,
|
||||
desc = "/give [item id] x(amount). Gives the targeted player an item."
|
||||
desc = "!give [item id] x(amount). Gives the targeted player an item."
|
||||
)
|
||||
public class GiveCommand implements CommandHandler {
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import emu.nebula.command.Command;
|
||||
import emu.nebula.command.CommandArgs;
|
||||
import emu.nebula.command.CommandHandler;
|
||||
|
||||
@Command(label = "help", permission = "player.help", desc = "/help. Displays a list of available commands.")
|
||||
@Command(label = "help", permission = "player.help", desc = "!help = Displays a list of available commands. (Very spammy in-game)")
|
||||
public class HelpCommand implements CommandHandler {
|
||||
|
||||
@Override
|
||||
|
||||
+2
-2
@@ -8,8 +8,8 @@ import emu.nebula.net.NetMsgId;
|
||||
import emu.nebula.proto.NotifyGm.GmWorldClass;
|
||||
import emu.nebula.util.Utils;
|
||||
|
||||
@Command(label = "setlevel", aliases = {"level", "l"}, permission = "player.level", requireTarget = true, desc = "/level [level]. Set player level")
|
||||
public class SetLevelCommand implements CommandHandler {
|
||||
@Command(label = "setlevel", aliases = {"level", "l"}, permission = "player.level", requireTarget = true, desc = "!level [level] = Set's the targeted player's level")
|
||||
public class LevelCommand implements CommandHandler {
|
||||
|
||||
@Override
|
||||
public String execute(CommandArgs args) {
|
||||
@@ -14,7 +14,7 @@ import emu.nebula.util.Utils;
|
||||
aliases = {"m"},
|
||||
permission = "player.mail",
|
||||
requireTarget = true,
|
||||
desc = "/mail \"subject\" \"body\" [itemId xQty | itemId:qty ...]. Sends the targeted player a system mail."
|
||||
desc = "!mail \"subject\" \"body\" [itemId xQty | itemId:qty ...] = Sends the targeted player a system mail."
|
||||
)
|
||||
public class MailCommand implements CommandHandler {
|
||||
private static final String USAGE_TEXT = "Usage: /mail \"subject\" \"body\" [itemId xQty | itemId:qty ...]";
|
||||
|
||||
@@ -5,7 +5,7 @@ import emu.nebula.command.Command;
|
||||
import emu.nebula.command.CommandArgs;
|
||||
import emu.nebula.command.CommandHandler;
|
||||
|
||||
@Command(label = "reload", permission = "admin.reload", desc = "/reload. Reloads the server config.")
|
||||
@Command(label = "reload", permission = "admin.reload", desc = "!reload = Reloads the server config.")
|
||||
public class ReloadCommand implements CommandHandler {
|
||||
|
||||
@Override
|
||||
|
||||
@@ -7,7 +7,7 @@ import emu.nebula.command.CommandHandler;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
@Command(label = "remote", permission = "player.remote", requireTarget = true, desc = "/remote. Send remote to web remote")
|
||||
@Command(label = "remote", permission = "player.remote", requireTarget = true, desc = "!remote = Creates a player token for remote api usage")
|
||||
public class RemoteKeyCommand implements CommandHandler {
|
||||
private final String characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
|
||||
|
||||
|
||||
@@ -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";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11,14 +11,14 @@ 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;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public class GameData {
|
||||
// Characters
|
||||
// ===== Characters =====
|
||||
@Getter private static DataTable<CharacterDef> CharacterDataTable = new DataTable<>();
|
||||
@Getter private static DataTable<CharacterAdvanceDef> CharacterAdvanceDataTable = new DataTable<>();
|
||||
@Getter private static DataTable<CharacterSkillUpgradeDef> CharacterSkillUpgradeDataTable = new DataTable<>();
|
||||
@@ -28,38 +28,43 @@ public class GameData {
|
||||
@Getter private static DataTable<TalentGroupDef> TalentGroupDataTable = new DataTable<>();
|
||||
@Getter private static DataTable<TalentDef> TalentDataTable = new DataTable<>();
|
||||
|
||||
// Character emblems
|
||||
// Characters: Emblems
|
||||
@Getter private static DataTable<CharGemDef> CharGemDataTable = new DataTable<>();
|
||||
@Getter private static DataTable<CharGemSlotControlDef> CharGemSlotControlDataTable = new DataTable<>();
|
||||
@Getter private static DataTable<CharGemAttrGroupDef> CharGemAttrGroupDataTable = new DataTable<>();
|
||||
@Getter private static DataTable<CharGemAttrValueDef> CharGemAttrValueDataTable = new DataTable<>();
|
||||
|
||||
// Character affinity
|
||||
// Characters: Affinity
|
||||
@Getter private static DataTable<AffinityLevelDef> AffinityLevelDataTable = new DataTable<>();
|
||||
@Getter private static DataTable<AffinityGiftDef> AffinityGiftDataTable = new DataTable<>();
|
||||
@Getter private static DataTable<PlotDef> PlotDataTable = new DataTable<>();
|
||||
|
||||
// Characters: Phone
|
||||
@Getter private static DataTable<ChatDef> ChatDataTable = new DataTable<>();
|
||||
|
||||
// Characters: Dating
|
||||
@Getter private static DataTable<DatingLandmarkDef> DatingLandmarkDataTable = new DataTable<>();
|
||||
@Getter private static DataTable<DatingLandmarkEventDef> DatingLandmarkEventDataTable = new DataTable<>();
|
||||
@Getter private static DataTable<DatingCharacterEventDef> DatingCharacterEventDataTable = new DataTable<>();
|
||||
|
||||
// Discs
|
||||
// ===== Discs =====
|
||||
@Getter private static DataTable<DiscDef> DiscDataTable = new DataTable<>();
|
||||
@Getter private static DataTable<DiscStrengthenDef> DiscStrengthenDataTable = new DataTable<>();
|
||||
@Getter private static DataTable<DiscItemExpDef> DiscItemExpDataTable = new DataTable<>();
|
||||
@Getter private static DataTable<DiscPromoteDef> DiscPromoteDataTable = new DataTable<>();
|
||||
@Getter private static DataTable<DiscPromoteLimitDef> DiscPromoteLimitDataTable = new DataTable<>();
|
||||
|
||||
// Items
|
||||
// Discs: Melody items
|
||||
@Getter private static DataTable<SecondarySkillDef> SecondarySkillDataTable = new DataTable<>();
|
||||
|
||||
// ===== Items =====
|
||||
@Getter private static DataTable<ItemDef> ItemDataTable = new DataTable<>();
|
||||
@Getter private static DataTable<ProductionDef> ProductionDataTable = new DataTable<>();
|
||||
@Getter private static DataTable<PlayerHeadDef> PlayerHeadDataTable = new DataTable<>();
|
||||
@Getter private static DataTable<TitleDef> titleDataTable = new DataTable<>();
|
||||
@Getter private static DataTable<HonorDef> honorDataTable = new DataTable<>();
|
||||
|
||||
// Shops
|
||||
// ===== Shops =====
|
||||
@Getter private static DataTable<MallMonthlyCardDef> MallMonthlyCardDataTable = new DataTable<>();
|
||||
@Getter private static DataTable<MallPackageDef> MallPackageDataTable = new DataTable<>();
|
||||
@Getter private static DataTable<MallShopDef> MallShopDataTable = new DataTable<>();
|
||||
@@ -68,20 +73,43 @@ public class GameData {
|
||||
@Getter private static DataTable<ResidentShopDef> ResidentShopDataTable = new DataTable<>();
|
||||
@Getter private static DataTable<ResidentGoodsDef> ResidentGoodsDataTable = new DataTable<>();
|
||||
|
||||
// Battle Pass
|
||||
// ===== Battle Pass =====
|
||||
@Getter private static DataTable<BattlePassDef> BattlePassDataTable = new DataTable<>();
|
||||
@Getter private static DataTable<BattlePassLevelDef> BattlePassLevelDataTable = new DataTable<>();
|
||||
@Getter private static DataTable<BattlePassQuestDef> BattlePassQuestDataTable = new DataTable<>();
|
||||
@Getter private static DataTable<BattlePassRewardDef> BattlePassRewardDataTable = new DataTable<>();
|
||||
|
||||
// Commissions
|
||||
// ===== Commissions =====
|
||||
@Getter private static DataTable<AgentDef> AgentDataTable = new DataTable<>();
|
||||
|
||||
// Dictionary
|
||||
// ===== Dictionary =====
|
||||
@Getter private static DataTable<DictionaryTabDef> DictionaryTabDataTable = new DataTable<>();
|
||||
@Getter private static DataTable<DictionaryEntryDef> DictionaryEntryDataTable = new DataTable<>();
|
||||
|
||||
// Instances
|
||||
// ===== Gacha =====
|
||||
@Getter private static DataTable<GachaDef> GachaDataTable = new DataTable<>();
|
||||
@Getter private static DataTable<GachaStorageDef> GachaStorageDataTable = new DataTable<>();
|
||||
|
||||
// ===== 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<>();
|
||||
|
||||
@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<>();
|
||||
|
||||
// ===== Tutorials =====
|
||||
@Getter private static DataTable<TutorialLevelDef> TutorialLevelDataTable = new DataTable<>();
|
||||
|
||||
// ===== Instances =====
|
||||
@Getter private static DataTable<DailyInstanceDef> DailyInstanceDataTable = new DataTable<>();
|
||||
@Getter private static DataTable<DailyInstanceRewardGroupDef> DailyInstanceRewardGroupDataTable = new DataTable<>();
|
||||
@Getter private static DataTable<RegionBossLevelDef> RegionBossLevelDataTable = new DataTable<>();
|
||||
@@ -89,46 +117,64 @@ public class GameData {
|
||||
@Getter private static DataTable<CharGemInstanceDef> CharGemInstanceDataTable = new DataTable<>();
|
||||
@Getter private static DataTable<WeekBossLevelDef> WeekBossLevelDataTable = new DataTable<>();
|
||||
|
||||
@Getter private static DataTable<GachaDef> GachaDataTable = new DataTable<>();
|
||||
@Getter private static DataTable<GachaStorageDef> GachaStorageDataTable = new DataTable<>();
|
||||
|
||||
@Getter private static DataTable<WorldClassDef> WorldClassDataTable = new DataTable<>();
|
||||
@Getter private static DataTable<GuideGroupDef> GuideGroupDataTable = new DataTable<>();
|
||||
@Getter private static DataTable<HandbookDef> HandbookDataTable = new DataTable<>();
|
||||
@Getter private static DataTable<StoryDef> StoryDataTable = new DataTable<>();
|
||||
@Getter private static DataTable<StorySetSectionDef> StorySetSectionDataTable = new DataTable<>();
|
||||
|
||||
// Daily quests
|
||||
@Getter private static DataTable<DailyQuestDef> DailyQuestDataTable = new DataTable<>();
|
||||
@Getter private static DataTable<DailyQuestActiveDef> DailyQuestActiveDataTable = new DataTable<>();
|
||||
|
||||
// Achievements
|
||||
@Getter private static DataTable<AchievementDef> AchievementDataTable = new DataTable<>();
|
||||
|
||||
// Tutorial
|
||||
@Getter private static DataTable<TutorialLevelDef> TutorialLevelDataTable = new DataTable<>();
|
||||
|
||||
// Star tower
|
||||
// ===== Star Tower =====
|
||||
@Getter private static DataTable<StarTowerDef> StarTowerDataTable = new DataTable<>();
|
||||
@Getter private static DataTable<StarTowerStageDef> StarTowerStageDataTable = new DataTable<>();
|
||||
@Getter private static DataTable<StarTowerGrowthNodeDef> StarTowerGrowthNodeDataTable = new DataTable<>();
|
||||
@Getter private static DataTable<StarTowerFloorExpDef> StarTowerFloorExpDataTable = new DataTable<>();
|
||||
@Getter private static DataTable<StarTowerTeamExpDef> StarTowerTeamExpDataTable = new DataTable<>();
|
||||
@Getter private static DataTable<PotentialDef> PotentialDataTable = 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<>();
|
||||
@Getter private static DataTable<CharPotentialDef> CharPotentialDataTable = new DataTable<>();
|
||||
|
||||
@Getter private static DataTable<StarTowerBookFateCardBundleDef> StarTowerBookFateCardBundleDataTable = new DataTable<>();
|
||||
@Getter private static DataTable<StarTowerBookFateCardQuestDef> StarTowerBookFateCardQuestDataTable = new DataTable<>();
|
||||
@Getter private static DataTable<StarTowerBookFateCardDef> StarTowerBookFateCardDataTable = new DataTable<>();
|
||||
@Getter private static DataTable<FateCardDef> FateCardDataTable = new DataTable<>();
|
||||
|
||||
// Infinity Tower
|
||||
|
||||
// ===== Infinity Tower =====
|
||||
@Getter private static DataTable<InfinityTowerLevelDef> InfinityTowerLevelDataTable = new DataTable<>();
|
||||
@Getter private static DataTable<InfinityTowerDifficultyDef> InfinityTowerDifficultyDataTable = new DataTable<>();
|
||||
|
||||
// Vampire survivor
|
||||
// ===== Vampire Survivor =====
|
||||
@Getter private static DataTable<VampireSurvivorDef> VampireSurvivorDataTable = new DataTable<>();
|
||||
@Getter private static DataTable<VampireTalentDef> VampireTalentDataTable = new DataTable<>();
|
||||
|
||||
// Score boss
|
||||
// ===== Score Boss =====
|
||||
@Getter private static DataTable<ScoreBossControlDef> ScoreBossControlDataTable = new DataTable<>();
|
||||
@Getter private static DataTable<ScoreBossRewardDef> ScoreBossRewardDataTable = new DataTable<>();
|
||||
|
||||
// ===== Misc =====
|
||||
@Getter private static DataTable<WorldClassDef> WorldClassDataTable = new DataTable<>();
|
||||
@Getter private static DataTable<GuideGroupDef> GuideGroupDataTable = new DataTable<>();
|
||||
@Getter private static DataTable<HandbookDef> HandbookDataTable = new DataTable<>();
|
||||
@Getter private static DataTable<SignInDef> SignInDataTable = new DataTable<>();
|
||||
|
||||
// ===== 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<>();
|
||||
}
|
||||
@@ -10,6 +10,7 @@ import org.reflections.Reflections;
|
||||
import emu.nebula.util.JsonUtils;
|
||||
import emu.nebula.util.Utils;
|
||||
import emu.nebula.Nebula;
|
||||
import emu.nebula.game.achievement.AchievementHelper;
|
||||
|
||||
public class ResourceLoader {
|
||||
private static boolean loaded = false;
|
||||
@@ -22,6 +23,9 @@ public class ResourceLoader {
|
||||
// Load
|
||||
loadResources();
|
||||
|
||||
// Add hardcoded achievements params
|
||||
AchievementHelper.init();
|
||||
|
||||
// Done
|
||||
loaded = true;
|
||||
Nebula.getLogger().info("Resource loading complete");
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
+3
-2
@@ -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,10 @@ 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;
|
||||
|
||||
@Getter
|
||||
@@ -18,9 +21,57 @@ public class AchievementDef extends BaseDef {
|
||||
private int Tid1;
|
||||
private int Qty1;
|
||||
|
||||
// Custom params
|
||||
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;
|
||||
}
|
||||
|
||||
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 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
|
||||
public void onLoad() {
|
||||
// Add to cached achievement list
|
||||
var list = AchievementHelper.getCache().computeIfAbsent(this.CompleteCond, i -> new ObjectArrayList<>());
|
||||
list.add(this);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package emu.nebula.data.resources;
|
||||
|
||||
import emu.nebula.data.BaseDef;
|
||||
import emu.nebula.data.ResourceType;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
@ResourceType(name = "Activity.json")
|
||||
public class ActivityDef extends BaseDef {
|
||||
private int Id;
|
||||
private int ActivityType;
|
||||
|
||||
private transient emu.nebula.game.activity.ActivityType type;
|
||||
|
||||
@Override
|
||||
public int getId() {
|
||||
return Id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoad() {
|
||||
this.type = emu.nebula.game.activity.ActivityType.getByValue(this.ActivityType);
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
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
|
||||
@ResourceType(name = "CharPotential.json")
|
||||
public class CharPotentialDef extends BaseDef {
|
||||
private int Id;
|
||||
|
||||
private int[] MasterSpecificPotentialIds;
|
||||
private int[] AssistSpecificPotentialIds;
|
||||
private int[] CommonPotentialIds;
|
||||
private int[] MasterNormalPotentialIds;
|
||||
private int[] AssistNormalPotentialIds;
|
||||
|
||||
@Override
|
||||
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;
|
||||
|
||||
|
||||
@@ -18,6 +18,9 @@ public class DiscDef extends BaseDef {
|
||||
private int TransformItemId;
|
||||
private int[] MaxStarTransformItem;
|
||||
private int[] ReadReward;
|
||||
|
||||
private int SecondarySkillGroupId1;
|
||||
private int SecondarySkillGroupId2;
|
||||
private int SubNoteSkillGroupId;
|
||||
|
||||
private transient ElementType elementType;
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
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 = "DropPkg.json")
|
||||
public class DropPkgDef extends BaseDef {
|
||||
private int PkgId;
|
||||
private int ItemId;
|
||||
|
||||
private static Int2ObjectMap<IntList> PACKAGES = new Int2ObjectOpenHashMap<>();
|
||||
|
||||
@Override
|
||||
public int getId() {
|
||||
return PkgId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoad() {
|
||||
var packageList = PACKAGES.computeIfAbsent(this.PkgId, i -> new IntArrayList());
|
||||
packageList.add(this.ItemId);
|
||||
}
|
||||
|
||||
public static int getRandomDrop(int packageId) {
|
||||
var packageList = PACKAGES.get(packageId);
|
||||
|
||||
if (packageList == null) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return Utils.randomElement(packageList);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
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 lombok.Getter;
|
||||
|
||||
/**
|
||||
* We don't need a DataTable for this, since we are only using this class to verify event options for the client
|
||||
*/
|
||||
@Getter
|
||||
@ResourceType(name = "EventOptions.json", loadPriority = LoadPriority.LOW)
|
||||
public class EventOptionsDef extends BaseDef {
|
||||
private int Id;
|
||||
|
||||
@Override
|
||||
public int getId() {
|
||||
return Id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoad() {
|
||||
// Get event
|
||||
var event = GameData.getStarTowerEventDataTable().get(this.Id / 100);
|
||||
if (event == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Add to avaliable options
|
||||
event.getOptionIds().add(this.getId());
|
||||
}
|
||||
}
|
||||
@@ -55,13 +55,14 @@ public class GachaDef extends BaseDef {
|
||||
|
||||
if (this.ATypePkg > 0) {
|
||||
packageA.add(
|
||||
10000 - storage.getATypeUpProb(),
|
||||
new GachaPackage(GachaPackageType.A, this.ATypePkg)
|
||||
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)
|
||||
storage.getATypeUpProb(),
|
||||
new GachaPackage(GachaPackageType.A_UP, this.ATypeUpPkg)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -70,18 +71,20 @@ public class GachaDef extends BaseDef {
|
||||
|
||||
if (this.BTypePkg > 0) {
|
||||
packageB.add(
|
||||
10000 - storage.getBTypeUpProb(),
|
||||
new GachaPackage(GachaPackageType.B, this.BTypePkg)
|
||||
storage.getBTypeProb(),
|
||||
new GachaPackage(GachaPackageType.B, this.BTypePkg)
|
||||
);
|
||||
} else if (this.BGuaranteePkg > 0) {
|
||||
}
|
||||
if (this.BGuaranteePkg > 0) {
|
||||
packageB.add(
|
||||
10000 - storage.getBTypeUpProb(),
|
||||
new GachaPackage(GachaPackageType.B, this.BGuaranteePkg)
|
||||
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)
|
||||
storage.getBTypeUpProb(),
|
||||
new GachaPackage(GachaPackageType.B_UP, this.BTypeUpPkg)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -90,8 +93,8 @@ public class GachaDef extends BaseDef {
|
||||
|
||||
if (this.CTypePkg > 0) {
|
||||
packageC.add(
|
||||
10000,
|
||||
new GachaPackage(GachaPackageType.C, this.CTypePkg)
|
||||
10000,
|
||||
new GachaPackage(GachaPackageType.C, this.CTypePkg)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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,8 +26,13 @@ public class InfinityTowerLevelDef extends BaseDef {
|
||||
return Id;
|
||||
}
|
||||
|
||||
public int getEnergyConsume() {
|
||||
return 0;
|
||||
public int getTowerId() {
|
||||
var diff = GameData.getInfinityTowerDifficultyDataTable().get(this.DifficultyId);
|
||||
if (diff == null) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return diff.getTowerId();
|
||||
}
|
||||
|
||||
public ItemParamMap generateRewards() {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package emu.nebula.data.resources;
|
||||
|
||||
import emu.nebula.data.BaseDef;
|
||||
import emu.nebula.data.ResourceType;
|
||||
import emu.nebula.game.tower.StarTowerGame;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
@@ -10,11 +11,48 @@ public class PotentialDef extends BaseDef {
|
||||
private int Id;
|
||||
private int CharId;
|
||||
private int Build;
|
||||
private int BranchType;
|
||||
private int MaxLevel;
|
||||
private int[] BuildScore;
|
||||
|
||||
private String BriefDesc;
|
||||
|
||||
@Override
|
||||
public int getId() {
|
||||
return Id;
|
||||
}
|
||||
|
||||
public boolean isSpecial() {
|
||||
return this.BranchType != 3;
|
||||
}
|
||||
|
||||
public int getMaxLevel() {
|
||||
// Check if regular potential
|
||||
if (this.BranchType == 3) {
|
||||
return 6;
|
||||
}
|
||||
|
||||
// Special potential should always have a max level of 1
|
||||
return this.MaxLevel;
|
||||
}
|
||||
|
||||
public int getMaxLevel(StarTowerGame game) {
|
||||
// Check if regular potential
|
||||
if (this.BranchType == 3) {
|
||||
return this.MaxLevel + game.getModifiers().getExtraMaxPotentialLevel();
|
||||
}
|
||||
|
||||
// Special potential should always have a max level of 1
|
||||
return this.MaxLevel;
|
||||
}
|
||||
|
||||
public int getBuildScore(int level) {
|
||||
int index = level - 1;
|
||||
|
||||
if (index >= this.BuildScore.length) {
|
||||
index = this.BuildScore.length - 1;
|
||||
}
|
||||
|
||||
return this.BuildScore[index];
|
||||
}
|
||||
}
|
||||
@@ -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,19 @@
|
||||
package emu.nebula.data.resources;
|
||||
|
||||
import emu.nebula.data.BaseDef;
|
||||
import emu.nebula.data.ResourceType;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
@ResourceType(name = "ScoreBossReward.json")
|
||||
public class ScoreBossRewardDef extends BaseDef {
|
||||
private int StarNeed;
|
||||
private int RewardItemId1;
|
||||
private int RewardNum1;
|
||||
|
||||
@Override
|
||||
public int getId() {
|
||||
return StarNeed;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
package emu.nebula.data.resources;
|
||||
|
||||
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 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;
|
||||
|
||||
@Getter
|
||||
@ResourceType(name = "SecondarySkill.json")
|
||||
public class SecondarySkillDef extends BaseDef {
|
||||
private int Id;
|
||||
private int GroupId;
|
||||
private int Score;
|
||||
private String NeedSubNoteSkills;
|
||||
|
||||
private transient ItemParamMap reqSubNotes;
|
||||
|
||||
@Getter
|
||||
private static transient Int2ObjectMap<List<SecondarySkillDef>> groups = new Int2ObjectOpenHashMap<>();
|
||||
|
||||
@Override
|
||||
public int getId() {
|
||||
return Id;
|
||||
}
|
||||
|
||||
public boolean match(ItemParamMap subNotes) {
|
||||
for (var item : this.reqSubNotes) {
|
||||
int reqId = item.getIntKey();
|
||||
int reqCount = item.getIntValue();
|
||||
|
||||
int curCount = subNotes.get(reqId);
|
||||
if (curCount < reqCount) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoad() {
|
||||
// Setup required subnotes
|
||||
this.reqSubNotes = ItemParamMap.fromJsonString(this.NeedSubNoteSkills);
|
||||
|
||||
// Add to group cache
|
||||
var group = groups.computeIfAbsent(this.GroupId, id -> new ArrayList<>());
|
||||
group.add(this);
|
||||
|
||||
// Clear to save memory
|
||||
this.NeedSubNoteSkills = null;
|
||||
}
|
||||
|
||||
// Static sub note skill group group
|
||||
|
||||
public static List<SecondarySkillDef> getGroup(int id) {
|
||||
return groups.get(id);
|
||||
}
|
||||
|
||||
public static IntSet calculateSecondarySkills(int[] discIds, ItemParamMap subNotes) {
|
||||
var secondarySkills = new IntOpenHashSet();
|
||||
|
||||
// Get first 3 discs
|
||||
for (int i = 0; i < 3; i++) {
|
||||
// Disc id
|
||||
int discId = discIds[i];
|
||||
|
||||
// Get disc data
|
||||
var data = GameData.getDiscDataTable().get(discId);
|
||||
if (data == null) continue;
|
||||
|
||||
// Add secondary skills
|
||||
int s1= getSecondarySkill(subNotes, data.getSecondarySkillGroupId1());
|
||||
if (s1 > 0) {
|
||||
secondarySkills.add(s1);
|
||||
}
|
||||
|
||||
int s2 = getSecondarySkill(subNotes, data.getSecondarySkillGroupId2());
|
||||
if (s2 > 0) {
|
||||
secondarySkills.add(s2);
|
||||
}
|
||||
}
|
||||
|
||||
return secondarySkills;
|
||||
}
|
||||
|
||||
private static int getSecondarySkill(ItemParamMap subNotes, int groupId) {
|
||||
// Check group id
|
||||
if (groupId <= 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Get group
|
||||
var group = SecondarySkillDef.getGroup(groupId);
|
||||
if (group == null) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Reverse iterator to try and match highest secondary skill first
|
||||
for (int i = group.size() - 1; i >= 0; i--) {
|
||||
var data = group.get(i);
|
||||
|
||||
if (data.match(subNotes)) {
|
||||
return data.getId();
|
||||
}
|
||||
}
|
||||
|
||||
// Failure
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package emu.nebula.data.resources;
|
||||
|
||||
import emu.nebula.data.BaseDef;
|
||||
import emu.nebula.data.ResourceType;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
@ResourceType(name = "SignIn.json")
|
||||
public class SignInDef extends BaseDef {
|
||||
private int Group;
|
||||
private int Day;
|
||||
private int ItemId;
|
||||
private int ItemQty;
|
||||
|
||||
@Override
|
||||
public int getId() {
|
||||
return (this.Group << 16) + this.Day;
|
||||
}
|
||||
}
|
||||
@@ -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,12 +4,16 @@ import java.util.Arrays;
|
||||
|
||||
import emu.nebula.data.BaseDef;
|
||||
import emu.nebula.data.ResourceType;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
@ResourceType(name = "StarTower.json")
|
||||
public class StarTowerDef extends BaseDef {
|
||||
private int Id;
|
||||
private int GroupId;
|
||||
private int Difficulty;
|
||||
private int SubNoteSkillDropGroupId;
|
||||
private int[] FloorNum;
|
||||
|
||||
private transient int maxFloors;
|
||||
@@ -19,8 +23,8 @@ public class StarTowerDef extends BaseDef {
|
||||
return Id;
|
||||
}
|
||||
|
||||
public int getMaxFloor(int stage) {
|
||||
int index = stage - 1;
|
||||
public int getMaxFloor(int stageNum) {
|
||||
int index = stageNum - 1;
|
||||
|
||||
if (index < 0 || index >= this.FloorNum.length) {
|
||||
return 0;
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
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
|
||||
@ResourceType(name = "StarTowerEvent.json")
|
||||
public class StarTowerEventDef extends BaseDef {
|
||||
private int Id;
|
||||
private int[] RelatedNPCs;
|
||||
|
||||
private transient IntList optionIds;
|
||||
|
||||
@Override
|
||||
public int getId() {
|
||||
return Id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a deep copy of our option ids
|
||||
*/
|
||||
public IntList getClonedOptionIds() {
|
||||
var list = new IntArrayList();
|
||||
list.addAll(this.getOptionIds());
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoad() {
|
||||
this.optionIds = new IntArrayList();
|
||||
}
|
||||
}
|
||||
@@ -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,33 @@
|
||||
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 = "TowerDefenseLevel.json")
|
||||
public class TowerDefenseLevelDef extends BaseDef {
|
||||
private int Id;
|
||||
private int Condition2;
|
||||
private int Condition3;
|
||||
private int Item1;
|
||||
private int Qty1;
|
||||
private int Item2;
|
||||
private int Qty2;
|
||||
|
||||
private transient ItemParamMap rewards;
|
||||
|
||||
@Override
|
||||
public int getId() {
|
||||
return Id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoad() {
|
||||
// Parse rewards
|
||||
this.rewards = new ItemParamMap();
|
||||
this.rewards.add(this.Item1, this.Qty1);
|
||||
this.rewards.add(this.Item2, this.Qty2);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package emu.nebula.data.resources;
|
||||
|
||||
import emu.nebula.data.BaseDef;
|
||||
import emu.nebula.data.ResourceType;
|
||||
import it.unimi.dsi.fastutil.ints.IntOpenHashSet;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
@ResourceType(name = "TrialControl.json")
|
||||
public class TrialControlDef extends BaseDef {
|
||||
private int Id;
|
||||
private IntOpenHashSet GroupIds;
|
||||
|
||||
@Override
|
||||
public int getId() {
|
||||
return Id;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
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 = "TrialGroup.json")
|
||||
public class TrialGroupDef extends BaseDef {
|
||||
private int Id;
|
||||
|
||||
private int RewardId1;
|
||||
private int Qty1;
|
||||
private int RewardId2;
|
||||
private int Qty2;
|
||||
private int RewardId3;
|
||||
private int Qty3;
|
||||
|
||||
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);
|
||||
}
|
||||
if (this.RewardId3 > 0) {
|
||||
this.rewards.add(this.RewardId3, this.Qty3);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,9 @@
|
||||
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.instance.InstanceData;
|
||||
import emu.nebula.game.inventory.ItemRewardList;
|
||||
import emu.nebula.game.inventory.ItemRewardParam;
|
||||
@@ -10,9 +12,10 @@ import emu.nebula.util.JsonUtils;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
@ResourceType(name = "WeekBossLevel.json")
|
||||
@ResourceType(name = "WeekBossLevel.json", loadPriority = LoadPriority.LOW)
|
||||
public class WeekBossLevelDef extends BaseDef implements InstanceData {
|
||||
private int Id;
|
||||
private int Difficulty;
|
||||
private int PreLevelId;
|
||||
private int NeedWorldClass;
|
||||
private String BaseAwardPreview;
|
||||
@@ -44,14 +47,33 @@ public class WeekBossLevelDef extends BaseDef implements InstanceData {
|
||||
for (int[] award : awards) {
|
||||
int itemId = award[0];
|
||||
int min = award[1];
|
||||
int max = award.length >= 4 ? award[2] : min;
|
||||
int max = award[1];
|
||||
boolean isFirst = award[award.length - 1] == 1;
|
||||
|
||||
// Set reward count based on difficulty
|
||||
if (min == -1) {
|
||||
min = 0;
|
||||
max = 1;
|
||||
min = this.Difficulty;
|
||||
max = this.Difficulty;
|
||||
|
||||
var item = GameData.getItemDataTable().get(itemId);
|
||||
if (item != null) {
|
||||
switch (item.getRarity()) {
|
||||
case 2:
|
||||
max = this.Difficulty * 3;
|
||||
break;
|
||||
case 3:
|
||||
min = this.Difficulty * 2;
|
||||
max = this.Difficulty * 6;
|
||||
break;
|
||||
case 4:
|
||||
min = this.Difficulty * 3;
|
||||
max = this.Difficulty * 9;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Create reward param
|
||||
var reward = new ItemRewardParam(itemId, min, max);
|
||||
|
||||
if (isFirst) {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -26,7 +26,6 @@ import de.bwaldvogel.mongo.backend.h2.H2Backend;
|
||||
import de.bwaldvogel.mongo.backend.memory.MemoryBackend;
|
||||
import dev.morphia.*;
|
||||
import dev.morphia.annotations.Entity;
|
||||
import dev.morphia.mapping.Mapper;
|
||||
import dev.morphia.mapping.MapperOptions;
|
||||
import dev.morphia.query.FindOptions;
|
||||
import dev.morphia.query.Sort;
|
||||
@@ -84,7 +83,7 @@ public final class DatabaseManager {
|
||||
.stream()
|
||||
.filter(cls -> {
|
||||
Entity e = cls.getAnnotation(Entity.class);
|
||||
return e != null && !e.value().equals(Mapper.IGNORED_FIELDNAME);
|
||||
return e != null;
|
||||
})
|
||||
.toList();
|
||||
|
||||
@@ -164,12 +163,16 @@ public final class DatabaseManager {
|
||||
return getDatastore().find(cls).stream();
|
||||
}
|
||||
|
||||
public <T> List<T> getSortedObjects(Class<T> cls, String filter, int limit) {
|
||||
public <T> List<T> getSortedObjects(Class<T> cls, String filter, int value, String sortBy, int limit) {
|
||||
var options = new FindOptions()
|
||||
.sort(Sort.descending(filter))
|
||||
.sort(Sort.descending(sortBy))
|
||||
.limit(limit);
|
||||
|
||||
return getDatastore().find(cls).iterator(options).toList();
|
||||
return getDatastore()
|
||||
.find(cls)
|
||||
.filter(Filters.eq(filter, value))
|
||||
.iterator(options)
|
||||
.toList();
|
||||
}
|
||||
|
||||
public <T> void save(T obj) {
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -8,6 +8,8 @@ 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;
|
||||
@@ -27,7 +29,9 @@ public class GameContext implements Runnable {
|
||||
private final PlayerModule playerModule;
|
||||
private final GachaModule gachaModule;
|
||||
private final TutorialModule tutorialModule;
|
||||
private final ActivityModule activityModule;
|
||||
private final ScoreBossModule scoreBossModule;
|
||||
private final BanModule banModule;
|
||||
|
||||
// Game loop
|
||||
private final ScheduledExecutorService scheduler;
|
||||
@@ -35,6 +39,7 @@ public class GameContext implements Runnable {
|
||||
// Daily
|
||||
private long epochDays;
|
||||
private int epochWeeks;
|
||||
private int epochMonths;
|
||||
|
||||
public GameContext() {
|
||||
this.sessions = new Object2ObjectOpenHashMap<>();
|
||||
@@ -43,7 +48,9 @@ public class GameContext implements Runnable {
|
||||
this.playerModule = new PlayerModule(this);
|
||||
this.gachaModule = new GachaModule(this);
|
||||
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);
|
||||
@@ -102,12 +109,20 @@ public class GameContext implements Runnable {
|
||||
var instant = Instant.now().plusSeconds(offset);
|
||||
var date = LocalDate.ofInstant(instant, GameConstants.UTC_ZONE);
|
||||
|
||||
// Update epoch days
|
||||
long lastEpochDays = this.epochDays;
|
||||
this.epochDays = date.toEpochDay();
|
||||
this.epochWeeks = Utils.getWeeks(this.epochDays);
|
||||
|
||||
// Check if the day was changed
|
||||
if (this.epochDays > lastEpochDays) {
|
||||
// Update epoch weeks/months
|
||||
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();
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,161 @@
|
||||
package emu.nebula.game.achievement;
|
||||
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
|
||||
import lombok.Getter;
|
||||
|
||||
public enum AchievementCondition {
|
||||
AchievementSpecific (1),
|
||||
AchievementTotal (2),
|
||||
BattleTotal (3),
|
||||
CharacterAcquire (5),
|
||||
CharacterAcquireQuantityRarityAndAdvancement (6),
|
||||
CharacterAdvanceTotal (7),
|
||||
CharacterSkillUpTotal (8),
|
||||
CharacterSkillWithSpecificUpTotal (9),
|
||||
CharacterSpecific (10),
|
||||
CharacterUpLevel (11),
|
||||
CharacterUpTotal (12),
|
||||
CharacterWithSpecificAdvance (13),
|
||||
CharacterWithSpecificAffinity (14),
|
||||
CharacterWithSpecificUpLevel (15),
|
||||
CharactersWithSpecificLevelAndQuantity (16),
|
||||
CharactersWithSpecificNumberLevelAndAttributes (17),
|
||||
CharactersWithSpecificPlot (18),
|
||||
CharactersWithSpecificQuantityAdvancementCountAndAttribute (19),
|
||||
CharactersWithSpecificQuantityAndRarity (20),
|
||||
CharactersWithSpecificQuantityRarityAndAdvancement (21),
|
||||
CharactersWithSpecificQuantityRarityAndLevel (22),
|
||||
ChatTotal (23),
|
||||
DailyInstanceClearSpecificDifficultyAndTotal (24),
|
||||
DailyInstanceClearSpecificTypeAndTotal (25),
|
||||
DailyInstanceClearTotal (26),
|
||||
DateSpecific (27),
|
||||
DiscAcquire (28),
|
||||
DiscAcquireSpecificQuantityAndRarity (29),
|
||||
DiscAcquireQuantityLevelAndRarity (30),
|
||||
DiscAcquireQuantityPhaseAndRarity (31),
|
||||
DiscAcquireQuantityStarAndRarity (32),
|
||||
DiscLimitBreakTotal (33),
|
||||
DiscPromoteTotal (34),
|
||||
DiscStrengthenTotal (35),
|
||||
DiscWithSpecificQuantityLevelAndRarity (36),
|
||||
DiscWithSpecificQuantityPhaseAndRarity (37),
|
||||
DiscWithSpecificQuantityStarAndRarity (38),
|
||||
GachaCharacterNotSSRTotal (40),
|
||||
GachaCharacterTenModeSSRTotal (41),
|
||||
GachaCharacterTotal (42),
|
||||
GachaTenModeAcquireQuantityAndRarityItems (43),
|
||||
GachaTotal (44),
|
||||
GiftGiveTotal (45),
|
||||
InfinityTowerClearSpecificFloor (46),
|
||||
InfinityTowerClearTotal (47),
|
||||
ItemsAdd (48),
|
||||
ItemsDeplete (49),
|
||||
ItemsProductTotal (50),
|
||||
LoginTotal (51),
|
||||
QuestTravelerDuelChallengeTotal (52),
|
||||
QuestTourGuideSpecific (53),
|
||||
QuestWithSpecificType (55),
|
||||
RegionBossClearSpecificFullStarWithBossIdAndDifficulty (56),
|
||||
RegionBossClearSpecificLevelWithDifficultyAndTotal (57),
|
||||
RegionBossClearSpecificTotal (58),
|
||||
RegionBossClearTotal (59),
|
||||
SkillsWithSpecificQuantityAndLevel (60),
|
||||
SkinAcquire (61),
|
||||
StageClearSpecificStars (62),
|
||||
StoryClear (63),
|
||||
TravelerDuelChallengeSpecificBoosLevelWithDifficultyAndTotal (64),
|
||||
TravelerDuelChallengeClearSpecificBossLevelAndAffix (67),
|
||||
TravelerDuelClearSpecificBossTotal (69),
|
||||
WorldClassSpecific (71),
|
||||
RegionBossClearSpecificTypeWithTotal (72),
|
||||
CharactersWithSpecificDatingCount (73),
|
||||
CharactersDatingTotal (74),
|
||||
VampireSurvivorScoreTotal (75),
|
||||
VampireSurvivorSpecificLevelWithSpecificScore (76),
|
||||
VampireSurvivorPassedSpecificLevel (77),
|
||||
CharacterParticipateTowerNumber (78),
|
||||
CharacterAllSkillReachSpecificLevel (79),
|
||||
VampireClearTotal (81),
|
||||
VampireWithSpecificClearTotal (82),
|
||||
AgentFinishTotal (83),
|
||||
AgentWithSpecificFinishTotal (84),
|
||||
ActivityMiningEnterLayer (86),
|
||||
ActivityMiningDestroyGrid (87),
|
||||
BossRushTotalStars (88),
|
||||
InfinityTowerClearSpecificDifficultyAndTotal (89),
|
||||
SkillInstanceClearTotal (90),
|
||||
VampireSurvivorSpecificPassedLevel (91),
|
||||
WeekBoosClearSpecificDifficultyAndTotal (92),
|
||||
NpcAffinityWithSpecificLevel (93),
|
||||
CharacterPassedWithSpecificTowerAndCount (94),
|
||||
JointDrillScoreTotal (95),
|
||||
CharGemInstanceClearTotal (104),
|
||||
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),
|
||||
TowerBuildSpecificCharacter (503),
|
||||
TowerBuildSpecificScoreWithTotal (504),
|
||||
TowerClearSpecificCharacterTypeWithTotal (505),
|
||||
TowerClearSpecificGroupIdAndDifficulty (506),
|
||||
TowerClearSpecificLevelWithDifficultyAndTotal (507),
|
||||
TowerClearTotal (508),
|
||||
TowerEnterRoom (509),
|
||||
TowerEventTimes (511),
|
||||
TowerFateTimes (512),
|
||||
TowerItemsGet (513),
|
||||
TowerSpecificDifficultyShopBuyTimes (514),
|
||||
TowerGrowthSpecificNote (515),
|
||||
TowerClearSpecificLevelWithDifficultyAndTotalHistory (516),
|
||||
TowerBookWithSpecificEvent (517),
|
||||
TowerBookWithSpecificFateCard (518),
|
||||
TowerBookWithSpecificPotential (520),
|
||||
TowerBuildSpecificDifficultyAndScoreWithTotal (521),
|
||||
TowerSpecificDifficultyStrengthenMachineTotal (522),
|
||||
TowerSpecificDifficultyKillBossTotal (524),
|
||||
TowerBookSpecificCharWithPotentialTotal (525),
|
||||
TowerBuildSpecificCharSpecificScoreWithTotal (526),
|
||||
TowerGrowthWithSpecificNote (527),
|
||||
TowerSpecificFateCardReRollTotal (528),
|
||||
TowerSpecificPotentialReRollTotal (529),
|
||||
TowerSpecificShopReRollTotal (530),
|
||||
TowerSpecificNoteActivateTotal (531),
|
||||
TowerSpecificNoteLevelTotal (532),
|
||||
TowerSpecificPotentialBonusTotal (533),
|
||||
TowerSpecificPotentialLuckyTotal (534),
|
||||
TowerSpecificShopBuyDiscountTotal (535),
|
||||
TowerSpecificSecondarySkillActivateTotal (536),
|
||||
TowerSpecificGetExtraNoteLvTotal (537),
|
||||
TowerSweepTimes (539),
|
||||
TowerSweepTotal (540),
|
||||
TowerBattleWithPartner (541);
|
||||
|
||||
@Getter
|
||||
private final int value;
|
||||
private final static Int2ObjectMap<AchievementCondition> map = new Int2ObjectOpenHashMap<>();
|
||||
|
||||
static {
|
||||
for (AchievementCondition type : AchievementCondition.values()) {
|
||||
map.put(type.getValue(), type);
|
||||
}
|
||||
}
|
||||
|
||||
private AchievementCondition(int value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public static AchievementCondition getByValue(int value) {
|
||||
return map.get(value);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package emu.nebula.game.achievement;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import emu.nebula.data.resources.AchievementDef;
|
||||
|
||||
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
|
||||
public class AchievementHelper {
|
||||
// Cache
|
||||
private static IntSet incrementalAchievementSet = new IntOpenHashSet();
|
||||
|
||||
@Getter
|
||||
private static Int2ObjectMap<List<AchievementDef>> cache = new Int2ObjectOpenHashMap<>();
|
||||
|
||||
public static List<AchievementDef> getAchievementsByCondition(int condition) {
|
||||
return cache.get(condition);
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
public static boolean isIncrementalAchievement(int condition) {
|
||||
return incrementalAchievementSet.contains(condition);
|
||||
}
|
||||
|
||||
// Fix params
|
||||
|
||||
public static void init() {
|
||||
// Cache total achievements
|
||||
for (var condition : AchievementCondition.values()) {
|
||||
if (condition.name().endsWith("Total") || condition.name().endsWith("Times")) {
|
||||
incrementalAchievementSet.add(condition.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
incrementalAchievementSet.remove(AchievementCondition.AchievementTotal.getValue());
|
||||
|
||||
incrementalAchievementSet.add(AchievementCondition.ItemsAdd.getValue());
|
||||
incrementalAchievementSet.add(AchievementCondition.ItemsDeplete.getValue());
|
||||
|
||||
incrementalAchievementSet.add(AchievementCondition.TowerItemsGet.getValue());
|
||||
incrementalAchievementSet.add(AchievementCondition.TowerEnterRoom.getValue());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,282 @@
|
||||
package emu.nebula.game.achievement;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import dev.morphia.annotations.Entity;
|
||||
import dev.morphia.annotations.Id;
|
||||
|
||||
import emu.nebula.Nebula;
|
||||
import emu.nebula.data.GameData;
|
||||
import emu.nebula.data.resources.AchievementDef;
|
||||
import emu.nebula.database.GameDatabaseObject;
|
||||
import emu.nebula.game.inventory.ItemParamMap;
|
||||
import emu.nebula.game.player.Player;
|
||||
import emu.nebula.game.player.PlayerChangeInfo;
|
||||
import emu.nebula.game.player.PlayerManager;
|
||||
import emu.nebula.net.NetMsgId;
|
||||
import emu.nebula.proto.Public.Achievements;
|
||||
import emu.nebula.proto.Public.Events;
|
||||
|
||||
import lombok.Getter;
|
||||
import us.hebi.quickbuf.RepeatedInt;
|
||||
|
||||
@Getter
|
||||
@Entity(value = "achievements", useDiscriminator = false)
|
||||
public class AchievementManager extends PlayerManager implements GameDatabaseObject {
|
||||
@Id
|
||||
private int uid;
|
||||
|
||||
// Achievement data
|
||||
private Map<Integer, GameAchievement> achievements;
|
||||
|
||||
// Flags
|
||||
private transient boolean queueSave;
|
||||
private transient boolean hasCompleted;
|
||||
|
||||
@Deprecated // Morphia only
|
||||
public AchievementManager() {
|
||||
|
||||
}
|
||||
|
||||
public AchievementManager(Player player) {
|
||||
super(player);
|
||||
this.uid = player.getUid();
|
||||
this.achievements = new HashMap<>();
|
||||
|
||||
this.save();
|
||||
}
|
||||
|
||||
public synchronized int getCompletedAchievementsCount() {
|
||||
return (int) this.getAchievements().values().stream()
|
||||
.filter(GameAchievement::isComplete)
|
||||
.count();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if there are any unclaimed achievements
|
||||
*/
|
||||
public synchronized boolean hasNewAchievements() {
|
||||
for (var achievement : this.getAchievements().values()) {
|
||||
if (achievement.isClaimable()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public synchronized GameAchievement getAchievement(AchievementDef data) {
|
||||
// Try and get achievement normally
|
||||
var achievement = this.getAchievements().get(data.getId());
|
||||
|
||||
// Create achievement if it doesnt exist
|
||||
if (achievement == null) {
|
||||
achievement = new GameAchievement(data);
|
||||
|
||||
this.getAchievements().put(achievement.getId(), achievement);
|
||||
}
|
||||
|
||||
return achievement;
|
||||
}
|
||||
|
||||
public synchronized void handleClientEvents(Events events) {
|
||||
// Parse events
|
||||
for (var event : events.getList()) {
|
||||
// Check id
|
||||
if (event.getId() != AchievementCondition.ClientReport.getValue()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Sanity check
|
||||
if (event.getData().length() < 2) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Get achievement id and progress
|
||||
int id = event.getData().get(1);
|
||||
int progress = event.getData().get(0);
|
||||
|
||||
if (progress <= 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Get achievement data
|
||||
var data = GameData.getAchievementDataTable().get(id);
|
||||
if (data == null) continue;
|
||||
|
||||
// Make sure achivement can be completed by the client
|
||||
if (data.getCompleteCond() != AchievementCondition.ClientReport.getValue()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Get achievement
|
||||
var achievement = this.getAchievement(data);
|
||||
|
||||
// Update achievement
|
||||
boolean changed = achievement.trigger(true, progress, 0, 0);
|
||||
|
||||
// Sync with client if achievement was changed
|
||||
if (changed) {
|
||||
this.syncAchievement(achievement);
|
||||
}
|
||||
}
|
||||
|
||||
// Update total achievements
|
||||
if (this.hasCompleted) {
|
||||
this.hasCompleted = false;
|
||||
this.getPlayer().trigger(AchievementCondition.AchievementTotal, this.getCompletedAchievementsCount());
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void trigger(AchievementCondition condition, int progress) {
|
||||
this.trigger(condition.getValue(), progress, 0, 0);
|
||||
}
|
||||
|
||||
public synchronized void trigger(AchievementCondition condition, int progress, int param1, int param2) {
|
||||
this.trigger(condition.getValue(), progress, param1, param2);
|
||||
}
|
||||
|
||||
public synchronized void trigger(int condition, int progress, int param1, int param2) {
|
||||
// Sanity check
|
||||
if (progress <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Blacklist
|
||||
if (condition == AchievementCondition.ClientReport.getValue()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Get achievements to trigger
|
||||
var triggerList = AchievementHelper.getAchievementsByCondition(condition);
|
||||
|
||||
if (triggerList == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Check what type of achievement condition this is
|
||||
boolean isTotal = AchievementHelper.isIncrementalAchievement(condition);
|
||||
|
||||
// Parse achievements
|
||||
for (var data : triggerList) {
|
||||
// Get achievement
|
||||
var achievement = this.getAchievement(data);
|
||||
|
||||
// Update achievement
|
||||
boolean changed = achievement.trigger(isTotal, progress, param1, param2);
|
||||
|
||||
// Sync with client if achievement was changed
|
||||
if (changed) {
|
||||
this.syncAchievement(achievement);
|
||||
}
|
||||
}
|
||||
|
||||
// Update total achievements
|
||||
if (this.hasCompleted) {
|
||||
this.hasCompleted = false;
|
||||
this.getPlayer().trigger(AchievementCondition.AchievementTotal, this.getCompletedAchievementsCount());
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void triggerOne(int id, int progress, int param1, int param2) {
|
||||
// Get achievement data
|
||||
var data = GameData.getAchievementDataTable().get(id);
|
||||
if (data == null) return;
|
||||
|
||||
// Get achievement
|
||||
var achievement = this.getAchievement(data);
|
||||
|
||||
// Check what type of achievement condition this is
|
||||
boolean isTotal = AchievementHelper.isIncrementalAchievement(data.getCompleteCond());
|
||||
|
||||
// Update achievement
|
||||
boolean changed = achievement.trigger(isTotal, progress, param1, param2);
|
||||
|
||||
// Sync with client if achievement was changed
|
||||
if (changed) {
|
||||
this.syncAchievement(achievement);
|
||||
}
|
||||
|
||||
// Update total achievements
|
||||
if (this.hasCompleted) {
|
||||
this.hasCompleted = false;
|
||||
this.getPlayer().trigger(AchievementCondition.AchievementTotal, this.getCompletedAchievementsCount());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update this achievement on the player client
|
||||
*/
|
||||
private void syncAchievement(GameAchievement achievement) {
|
||||
if (!getPlayer().hasSession()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Set save flag
|
||||
this.queueSave = true;
|
||||
|
||||
// Check if achievement was completed
|
||||
if (achievement.isComplete()) {
|
||||
this.hasCompleted = true;
|
||||
}
|
||||
|
||||
// Send update to player
|
||||
getPlayer().addNextPackage(
|
||||
NetMsgId.achievement_change_notify,
|
||||
achievement.toProto()
|
||||
);
|
||||
}
|
||||
|
||||
public synchronized PlayerChangeInfo recvRewards(RepeatedInt ids) {
|
||||
// Sanity check
|
||||
if (ids.length() <= 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Init variables
|
||||
var rewards = new ItemParamMap();
|
||||
|
||||
// Claim achievements
|
||||
for (int id : ids) {
|
||||
// Get achievement
|
||||
var achievement = this.getAchievements().get(id);
|
||||
if (achievement == null) continue;
|
||||
|
||||
// Check if we can claim this achievement
|
||||
if (achievement.isClaimable()) {
|
||||
// Claim
|
||||
achievement.setClaimed(true);
|
||||
|
||||
// Add rewards
|
||||
rewards.add(achievement.getData().getTid1(), achievement.getData().getQty1());
|
||||
|
||||
// Save
|
||||
this.queueSave = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Success
|
||||
return this.getPlayer().getInventory().addItems(rewards);
|
||||
}
|
||||
|
||||
// Proto
|
||||
|
||||
public synchronized Achievements toProto() {
|
||||
var proto = Achievements.newInstance();
|
||||
|
||||
for (var achievement : this.getAchievements().values()) {
|
||||
proto.addList(achievement.toProto());
|
||||
}
|
||||
|
||||
return proto;
|
||||
}
|
||||
|
||||
// Database
|
||||
|
||||
@Override
|
||||
public void save() {
|
||||
Nebula.getGameDatabase().save(this);
|
||||
this.queueSave = false;
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
package emu.nebula.game.achievement;
|
||||
|
||||
import dev.morphia.annotations.Entity;
|
||||
import emu.nebula.Nebula;
|
||||
import emu.nebula.data.GameData;
|
||||
import emu.nebula.data.resources.AchievementDef;
|
||||
import emu.nebula.proto.Public.Achievement;
|
||||
import emu.nebula.proto.Public.QuestProgress;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
@Entity(useDiscriminator = false)
|
||||
public class GameAchievement {
|
||||
private int id;
|
||||
private int curProgress;
|
||||
private long completed;
|
||||
private boolean claimed;
|
||||
|
||||
private transient AchievementDef data;
|
||||
|
||||
@Deprecated // Morphia only
|
||||
public GameAchievement() {
|
||||
|
||||
}
|
||||
|
||||
public GameAchievement(AchievementDef data) {
|
||||
this.id = data.getId();
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public AchievementDef getData() {
|
||||
if (this.data == null) {
|
||||
this.data = GameData.getAchievementDataTable().get(this.getId());
|
||||
}
|
||||
|
||||
return this.data;
|
||||
}
|
||||
|
||||
public int getMaxProgress() {
|
||||
return this.getData().getAimNumShow();
|
||||
}
|
||||
|
||||
public boolean isComplete() {
|
||||
return this.completed > 0;
|
||||
}
|
||||
|
||||
public boolean isClaimable() {
|
||||
return !this.isClaimed() && this.isComplete();
|
||||
}
|
||||
|
||||
public void setClaimed(boolean claimed) {
|
||||
this.claimed = claimed;
|
||||
}
|
||||
|
||||
public int getStatus() {
|
||||
if (this.isClaimed()) {
|
||||
return 2;
|
||||
} else if (this.isComplete()) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if achievement was updated
|
||||
*/
|
||||
public boolean trigger(boolean isTotal, int progress, int param1, int param2) {
|
||||
// Sanity check
|
||||
if (this.isComplete()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check param conditions
|
||||
var data = this.getData();
|
||||
if (data == null) return false;
|
||||
|
||||
if (!data.matchParam1(param1) || !data.matchParam2(param2)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Set previous progress
|
||||
int prevProgress = this.curProgress;
|
||||
|
||||
// Update progress
|
||||
if (isTotal) {
|
||||
this.curProgress += progress;
|
||||
} else {
|
||||
this.curProgress = progress;
|
||||
}
|
||||
|
||||
// Check if completed
|
||||
if (this.getCurProgress() >= this.getMaxProgress()) {
|
||||
this.curProgress = this.getMaxProgress();
|
||||
this.completed = Nebula.getCurrentServerTime();
|
||||
return true;
|
||||
}
|
||||
|
||||
// Check if progress was changed
|
||||
return prevProgress != this.curProgress;
|
||||
}
|
||||
|
||||
// Proto
|
||||
|
||||
public Achievement toProto() {
|
||||
var progress = QuestProgress.newInstance()
|
||||
.setCur(this.getCurProgress())
|
||||
.setMax(this.getMaxProgress());
|
||||
|
||||
var proto = Achievement.newInstance()
|
||||
.setId(this.getId())
|
||||
.setCompleted(this.getCompleted())
|
||||
.setStatus(this.getStatus())
|
||||
.addProgress(progress);
|
||||
|
||||
return proto;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,150 @@
|
||||
package emu.nebula.game.activity;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import dev.morphia.annotations.Entity;
|
||||
import dev.morphia.annotations.Id;
|
||||
|
||||
import emu.nebula.Nebula;
|
||||
import emu.nebula.data.GameData;
|
||||
import emu.nebula.database.GameDatabaseObject;
|
||||
import emu.nebula.game.activity.type.*;
|
||||
import emu.nebula.game.player.Player;
|
||||
import emu.nebula.game.player.PlayerManager;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Entity(value = "activity", useDiscriminator = false)
|
||||
public class ActivityManager extends PlayerManager implements GameDatabaseObject {
|
||||
@Id
|
||||
private int uid;
|
||||
|
||||
// Achievement data
|
||||
private Map<Integer, GameActivity> activities;
|
||||
|
||||
@Setter
|
||||
private transient boolean queueSave;
|
||||
|
||||
@Deprecated // Morphia only
|
||||
public ActivityManager() {
|
||||
|
||||
}
|
||||
|
||||
public ActivityManager(Player player) {
|
||||
super(player);
|
||||
this.uid = player.getUid();
|
||||
this.activities = new HashMap<>();
|
||||
}
|
||||
|
||||
public <T extends GameActivity> T getActivity(Class<T> activityClass, int id) {
|
||||
// Get activity first
|
||||
var activity = this.getActivities().get(id);
|
||||
if (activity == null) return null;
|
||||
|
||||
// Check activity type
|
||||
if (activityClass.isInstance(activity)) {
|
||||
return activityClass.cast(activity);
|
||||
}
|
||||
|
||||
// Failure
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* This needs to be called after being loaded from the database
|
||||
*/
|
||||
public synchronized void init() {
|
||||
// Check if any activities
|
||||
var it = this.getActivities().entrySet().iterator();
|
||||
while (it.hasNext()) {
|
||||
var entry = it.next();
|
||||
var activity = entry.getValue();
|
||||
|
||||
// Validate the activity to make sure it exists
|
||||
var data = GameData.getActivityDataTable().get(activity.getId());
|
||||
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
|
||||
activity.setData(data);
|
||||
activity.setManager(this);
|
||||
}
|
||||
|
||||
// Load activities
|
||||
for (var id : Nebula.getGameContext().getActivityModule().getActivities()) {
|
||||
// Check if we already have this activity
|
||||
if (this.getActivities().containsKey(id)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Create activity
|
||||
var activity = this.createActivity(id);
|
||||
|
||||
if (activity == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Add activity
|
||||
this.getActivities().put(id, activity);
|
||||
|
||||
// Set save flag
|
||||
this.queueSave = true;
|
||||
}
|
||||
|
||||
// Save if any activities were changed
|
||||
if (this.queueSave) {
|
||||
this.save();
|
||||
}
|
||||
}
|
||||
|
||||
private GameActivity createActivity(int id) {
|
||||
// Get activity data first
|
||||
var data = GameData.getActivityDataTable().get(id);
|
||||
if (data == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// TODO improve activity creation
|
||||
GameActivity activity = switch (data.getType()) {
|
||||
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
|
||||
public void save() {
|
||||
Nebula.getGameDatabase().save(this);
|
||||
this.queueSave = false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package emu.nebula.game.activity;
|
||||
|
||||
import emu.nebula.game.GameContext;
|
||||
import emu.nebula.game.GameContextModule;
|
||||
import it.unimi.dsi.fastutil.ints.IntArrayList;
|
||||
import it.unimi.dsi.fastutil.ints.IntList;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
public class ActivityModule extends GameContextModule {
|
||||
private IntList activities;
|
||||
|
||||
public ActivityModule(GameContext context) {
|
||||
super(context);
|
||||
this.activities = new IntArrayList();
|
||||
|
||||
// Hardcode these activities for now
|
||||
// TODO make an activity json file to read activity ids from
|
||||
|
||||
// Trial activities
|
||||
this.activities.add(700105);
|
||||
this.activities.add(700106);
|
||||
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package emu.nebula.game.activity;
|
||||
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
|
||||
import lombok.Getter;
|
||||
|
||||
public enum ActivityType {
|
||||
None (0),
|
||||
PeriodicQuest (1),
|
||||
LoginReward (2),
|
||||
Mining (3),
|
||||
Cookie (4),
|
||||
TowerDefense (5),
|
||||
Trial (6),
|
||||
JointDrill (7),
|
||||
CG (8),
|
||||
Levels (9),
|
||||
Avg (10),
|
||||
Task (11),
|
||||
Shop (12),
|
||||
Advertise (13),
|
||||
BDConvert (14),
|
||||
Breakout (15),
|
||||
TrekkerVersus (16),
|
||||
Story (17);
|
||||
|
||||
@Getter
|
||||
private final int value;
|
||||
private final static Int2ObjectMap<ActivityType> map = new Int2ObjectOpenHashMap<>();
|
||||
|
||||
static {
|
||||
for (ActivityType type : ActivityType.values()) {
|
||||
map.put(type.getValue(), type);
|
||||
}
|
||||
}
|
||||
|
||||
private ActivityType(int value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public static ActivityType getByValue(int value) {
|
||||
return map.get(value);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
package emu.nebula.game.activity;
|
||||
|
||||
import dev.morphia.annotations.Entity;
|
||||
import emu.nebula.Nebula;
|
||||
import emu.nebula.data.resources.ActivityDef;
|
||||
import emu.nebula.game.player.Player;
|
||||
import emu.nebula.proto.ActivityDetail.ActivityMsg;
|
||||
import emu.nebula.proto.Public.Activity;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Entity(useDiscriminator = true)
|
||||
public abstract class GameActivity {
|
||||
private int id;
|
||||
|
||||
@Setter private transient ActivityManager manager;
|
||||
@Setter private transient ActivityDef data;
|
||||
|
||||
@Deprecated // Morhpia only
|
||||
public GameActivity() {
|
||||
|
||||
}
|
||||
|
||||
public GameActivity(ActivityManager manager, ActivityDef data) {
|
||||
this.id = data.getId();
|
||||
this.manager = manager;
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public Player getPlayer() {
|
||||
return this.getManager().getPlayer();
|
||||
}
|
||||
|
||||
public void save() {
|
||||
Nebula.getGameDatabase().update(
|
||||
this.getManager(),
|
||||
this.getManager().getPlayerUid(),
|
||||
"activities." + this.getId(),
|
||||
this
|
||||
);
|
||||
}
|
||||
|
||||
// Events
|
||||
|
||||
public void onLogin() {
|
||||
|
||||
}
|
||||
|
||||
// Proto
|
||||
|
||||
public Activity toProto() {
|
||||
var proto = Activity.newInstance()
|
||||
.setId(this.getId())
|
||||
.setStartTime(1)
|
||||
.setEndTime(Integer.MAX_VALUE);
|
||||
|
||||
return proto;
|
||||
}
|
||||
|
||||
public ActivityMsg toMsgProto() {
|
||||
var proto = ActivityMsg.newInstance()
|
||||
.setId(this.getId());
|
||||
|
||||
this.encodeActivityMsg(proto);
|
||||
|
||||
return proto;
|
||||
}
|
||||
|
||||
public abstract void encodeActivityMsg(ActivityMsg msg);
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loaded 100 of 251 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user