initial commit

This commit is contained in:
hartie95 2023-05-19 16:30:47 +02:00
commit cd205b98c1
137 changed files with 3148 additions and 0 deletions

12
.gitignore vendored Normal file
View File

@ -0,0 +1,12 @@
## intellij
.idea
##gradle
.gradle
## protos
/protos
## build stuff
build

75
build.gradle.kts Normal file
View File

@ -0,0 +1,75 @@
import org.gradle.kotlin.dsl.sourceSets
plugins {
kotlin("multiplatform") version "1.8.20"
id("com.google.devtools.ksp") version "1.8.20-1.0.11"
}
group = "org.anime_game_servers"
version = "1.0-SNAPSHOT"
repositories {
mavenCentral()
}
kotlin {
jvm {
jvmToolchain(11)
withJava()
testRuns["test"].executionTask.configure {
useJUnitPlatform()
}
}
js(IR) {
browser {
commonWebpackConfig {
cssSupport {
enabled.set(true)
}
}
}
}
val hostOs = System.getProperty("os.name")
val isMingwX64 = hostOs.startsWith("Windows")
val nativeTarget = when {
hostOs == "Mac OS X" -> macosX64("native")
hostOs == "Linux" -> linuxX64("native")
isMingwX64 -> mingwX64("native")
else -> throw GradleException("Host OS is not supported in Kotlin/Native.")
}
sourceSets {
val commonMain by getting {
dependencies {
implementation("pro.streem.pbandk:pbandk-runtime:0.14.2")
implementation(project(":annotations"))
}
kotlin.srcDir("build/generated/ksp/metadata/commonMain/kotlin/")
sourceSets.configureEach {
}
}
val commonTest by getting {
dependencies {
implementation(kotlin("test"))
}
}
val jvmMain by getting {
}
val jvmTest by getting
val jsMain by getting
val jsTest by getting
val nativeMain by getting
val nativeTest by getting
}
}
dependencies {
add("kspCommonMainMetadata", project(":processor"))
}
tasks {
withType<org.jetbrains.kotlin.gradle.dsl.KotlinCompile<*>> {
if (name != "kspCommonMainKotlinMetadata")
dependsOn("kspCommonMainKotlinMetadata")
}
}

View File

@ -0,0 +1,49 @@
plugins {
kotlin("multiplatform")
}
repositories {
mavenCentral()
}
kotlin {
jvm {
jvmToolchain(11)
withJava()
testRuns["test"].executionTask.configure {
useJUnitPlatform()
}
}
js(IR) {
browser {
commonWebpackConfig {
cssSupport {
enabled.set(true)
}
}
}
}
val hostOs = System.getProperty("os.name")
val isMingwX64 = hostOs.startsWith("Windows")
val nativeTarget = when {
hostOs == "Mac OS X" -> macosX64("native")
hostOs == "Linux" -> linuxX64("native")
isMingwX64 -> mingwX64("native")
else -> throw GradleException("Host OS is not supported in Kotlin/Native.")
}
sourceSets {
val commonMain by getting
val commonTest by getting {
dependencies {
implementation(kotlin("test"))
}
}
val jvmMain by getting
val jvmTest by getting
val jsMain by getting
val jsTest by getting
val nativeMain by getting
val nativeTest by getting
}
}

View File

@ -0,0 +1,8 @@
package org.anime_game_servers.annotations
enum class CommandType {
REQUEST,
RESPONSE,
NOTIFY,
CLIENT
}

View File

@ -0,0 +1,6 @@
package org.anime_game_servers.annotations
import kotlin.reflect.KClass
@Target(AnnotationTarget.PROPERTY)
annotation class OneOf(vararg val types: KClass<*>)

View File

@ -0,0 +1,4 @@
package org.anime_game_servers.annotations
interface OneOfType {
}

View File

@ -0,0 +1,7 @@
package org.anime_game_servers.annotations
@Target(AnnotationTarget.CLASS)
@Retention(AnnotationRetention.SOURCE)
annotation class ProtoCommand(val type: CommandType){
}

View File

@ -0,0 +1,5 @@
package org.anime_game_servers.annotations
@Target(AnnotationTarget.CLASS)
@Retention(AnnotationRetention.SOURCE)
annotation class ProtoEnum

View File

@ -0,0 +1,5 @@
package org.anime_game_servers.annotations
@Target(AnnotationTarget.CLASS)
@Retention(AnnotationRetention.SOURCE)
annotation class ProtoModel()

View File

@ -0,0 +1,12 @@
plugins {
kotlin("jvm")
kotlin("kapt")
}
repositories {
mavenCentral()
}
dependencies {
implementation(project(":annotations"))
implementation("com.google.devtools.ksp:symbol-processing-api:1.8.20-1.0.11")
}

View File

@ -0,0 +1,466 @@
import com.google.devtools.ksp.KspExperimental
import com.google.devtools.ksp.getDeclaredProperties
import com.google.devtools.ksp.getKotlinClassByName
import com.google.devtools.ksp.processing.KSPLogger
import com.google.devtools.ksp.processing.Resolver
import com.google.devtools.ksp.symbol.*
import java.io.OutputStream
import java.util.*
@OptIn(KspExperimental::class)
abstract class BaseGenerator(
val logger: KSPLogger,
val resolver: Resolver,
val classInfoCache: MutableMap<KSType, ClassInfo>,
) {
val enumType = resolver.getKotlinClassByName("kotlin.Enum")
val mapClass = resolver.getKotlinClassByName("kotlin.collections.Map.Entry")
fun createClassForProto(file: OutputStream, classInfo:ClassInfo) {
file += "package ${classInfo.packageName}\n"
addImports(file, classInfo)
addConstructor(file, classInfo)
addBody(file, classInfo)
addEncodeMethods(file, classInfo)
addCompanionObject(file, classInfo)
file.close()
}
open fun addImports(file:OutputStream, classInfo: ClassInfo){
file += "import messages.VERSION\n"+
"import annotations.AddedIn\n"+
"import annotations.RemovedIn\n"+
"import kotlin.jvm.JvmStatic\n"+
"import kotlin.jvm.JvmOverloads\n"
}
open fun addConstructor(file:OutputStream, classInfo:ClassInfo){
//add the kdoc if it exists //TODO
classInfo.definition.docString?.let {
file += "/**${it.replace("\n","\n * ")}*/\n"
}
}
open fun addBody(file:OutputStream, classInfo:ClassInfo){
}
open fun addEncodeMethods(file:OutputStream, classInfo: ClassInfo){
}
open fun addParsingMethods(file:OutputStream, classInfo:ClassInfo){
}
open fun addCompanionObject(file: OutputStream, classInfo:ClassInfo){
file.id(4) +="companion object {\n"
addParsingMethods(file, classInfo)
file += "}\n"
}
public data class OneOfData(
val type: KSType,
val variableName: String,
val wrapperName: String = variableName.capitalizeFirstLetter()
)
public data class ClassInfo(
val name: String,
val packageName: String,
val definition: KSClassDeclaration,
val dependencies: Set<KSFile>,
val protoSet: MutableSet<ProtoData>,
val originalPackage: String = definition.packageName.asString(),
val modelMembers: Map<String, KSType> = getMembers(definition),
val oneOfs: Map<KSType, OneOfData> = modelMembers.filterValues { it.declaration.simpleName.asString() == "OneOf" }
.entries.associate { it.value to OneOfData(it.value, it.key) }
)
protected fun getFullNameForTarget(targetType:KSType, fallback:String, sourceType:KSType?):String{
return classInfoCache[sourceType]?.let {
it.packageName + "." + it.name
} ?: fallback
}
protected fun addConstructorMembers(
indentation: Int,
sourceMembers: Map<String, KSType>,
targetMembers: Map<String, KSType>,
file: OutputStream,
sourcePrefix: String? = null,
dataMethod: DataMethodInfo
) {
targetMembers.forEach {
if (!sourceMembers.containsKey(it.key)) {
return@forEach
}
val sourceVarName = sourcePrefix?.let {pf -> "$pf.${it.key}" } ?: it.key
file.id(indentation)+= when (Type.byType(it.value, this)) {
Type.SIMPLE -> "${it.key} = $sourceVarName,\n"
Type.COLLECTION -> {
"${getFullNameForTarget(it.value, it.key, sourceMembers[it.key])} = ${
convertToCollection(
it.value,
sourceMembers[it.key]!!,
sourceVarName,
dataMethod,
resolver
)
},\n"
}
Type.MAP_ENTRY -> "${it.key} = ${
convertToMap(
it.value,
sourceMembers[it.key]!!,
sourceVarName,
dataMethod,
resolver
)
},\n"
Type.MAP -> "${it.key} = ${
convertToMap(
it.value,
sourceMembers[it.key]!!,
sourceVarName,
dataMethod,
resolver
)
},\n"
Type.ENUM -> {
"${it.key} = ${dataMethod.getDataCall(sourceVarName, it.value.getFullClassName(), true)},\n"
}
Type.DATA -> {
"${it.key} = ${dataMethod.getDataCall(sourceVarName, it.value.getFullClassName())},\n"
}
}
}
}
private fun convertToCollection(
outType: KSType,
inType: KSType,
varName: String,
dataMethod: DataMethodInfo,
resolver: Resolver
): String {
val outParameter = outType.arguments.first().type?.resolve()
?: throw IllegalStateException("unknown list param type for var $varName")
val inParameter = inType.arguments.firstOrNull()?.type?.resolve()
if(inType == outType && inParameter!=null && inParameter == outParameter){
logger.warn("same list type $varName")
return varName
}
val outParameterName = outParameter.declaration.simpleName.asString()
logger.warn("list equals ${inType == outType} ${outParameter==inParameter}\n\t$outParameterName\t${inParameter?.declaration?.simpleName?.asString()}")
logger.warn("field type: $varName $outParameterName ${Type.byType(outParameter, this)} ${Type.byType(inType, this)} o$outParameter i$inParameter\n")
return when (Type.byType(outParameter, this)) {
Type.SIMPLE -> "emptyList()"// TODO convert
Type.COLLECTION -> ""
Type.MAP -> ""
Type.MAP_ENTRY -> {
val outTypes = getMapEntryTypePair(outParameter,resolver)
if(Type.byType(inType, this) == Type.MAP){
val inTypes = getMapEntryTypePair(inType, resolver)
mapToCollection(inTypes, outTypes, varName, dataMethod, outParameter, resolver)
} else {
""
}
}
Type.ENUM -> "" //TODO
Type.DATA -> {
val dataTarget = dataMethod.getDataCall("it", outParameter.getFullClassName(), true)
"$varName.map { $dataTarget }"
}
}
}
data class DataMethodInfo(val methodName:String,
val isMemberCall:Boolean,
val overwritePackagePath:String? = null){
fun getDataCall(variable: String, methodClassPath: String, isNullSave:Boolean = false):String{
return if (isMemberCall)
"$variable.$methodName()"
else {
val classPath =
//overwritePackagePath?.let {
overwritePackagePath?.split("/")?.let {
"${methodClassPath.replaceFirst(it.first(), it[1])}"
} ?: methodClassPath
//"$it.${methodClassPath.split('.').last()}"
//} ?: methodClassPath
if(isNullSave){
"$classPath.$methodName($variable)"
} else {
"$variable?.let{ member -> $classPath.$methodName(member)} ?: $classPath()"
}
}
}
}
fun KSType.getFullClassName() : String{
return declaration.getFullClassName()
}
fun KSDeclaration.getFullClassName() : String{
parentDeclaration?.let {
return it.getFullClassName()+"."+simpleName.asString()
}
return packageName.asString()+"."+simpleName.asString()
}
fun collectionToCollection(inArgs: Pair<KSType, KSType>, outArg:Pair<KSType, KSType>, varName: String, dataMethod: DataMethodInfo, outType:KSType, resolver: Resolver) : String {
val outTypeName = outType.getFullClassName()
val toEntries = Type.byType(outType, this) == Type.MAP_ENTRY
return "$varName.map {${mapConversion(inArgs, outArg, dataMethod, outTypeName, toEntries)}}"
}
fun mapToCollection(inArgs: Pair<KSType, KSType>, outArg:Pair<KSType, KSType>, varName: String, dataMethod: DataMethodInfo, outType:KSType, resolver: Resolver) : String {
val outTypeName = outType.getFullClassName()
val toEntries = Type.byType(outType, this) == Type.MAP_ENTRY
return "$varName.map {${mapConversion(inArgs, outArg, dataMethod, outTypeName, toEntries, true)}}"
}
fun collectionToMap(inArgs: Pair<KSType, KSType>, outArg:Pair<KSType, KSType>, varName: String, dataMethod: DataMethodInfo, outType:KSType, resolver: Resolver) : String {
val outTypeName = outType.getFullClassName()
val toEntries = Type.byType(outType, this) == Type.MAP_ENTRY
return "$varName.associateByTo(mutableMapOf(), ${mapConversion(inArgs, outArg, dataMethod, outTypeName, toEntries)})"
}
fun mapToMap(inArgs: Pair<KSType, KSType>, outArg:Pair<KSType, KSType>, varName: String, dataMethod: DataMethodInfo, outType:KSType, resolver: Resolver) : String {
val outTypeName = outType.getFullClassName()
val toEntries = Type.byType(outType, this) == Type.MAP_ENTRY
return "$varName.associateByTo(mutableMapOf(), ${mapConversion(inArgs, outArg, dataMethod, outTypeName, toEntries)})"
}
fun mapConversion(inArgs: Pair<KSType, KSType>, outArg:Pair<KSType, KSType>,
dataMethodInfo: DataMethodInfo, outTypeName:String, toEntries:Boolean, isNullSave:Boolean=false) : String{
return if(inArgs.first == outArg.first && inArgs.second == outArg.second){
if(toEntries){
"$outTypeName(it.key, it.value)"
} else {
"{ it.key }, { it.value }"
}
}else if(inArgs.first == outArg.second && inArgs.second == outArg.first){
if(toEntries){
"$outTypeName(it.value, it.key)"
} else {
"{ it.value }, { it.key }"
}
} else if(inArgs.first == outArg.first){
val convertedCall = dataMethodInfo.getDataCall("it.value", outArg.second.getFullClassName(), isNullSave)
if(toEntries){
"$outTypeName(it.key, $convertedCall)"
} else {
"{ it.key }, { $convertedCall }"
}
} else if(inArgs.first == outArg.second){
val convertedCall = dataMethodInfo.getDataCall("it.key", outArg.first.getFullClassName(), isNullSave)
if(toEntries){
"$outTypeName(it.value, $convertedCall)"
} else {
"{ it.value }, { $convertedCall }"
}
} else if(inArgs.second == outArg.first){
val convertedCall = dataMethodInfo.getDataCall("it.value", outArg.second.getFullClassName(), isNullSave)
if(toEntries){
"$outTypeName($convertedCall, it.key)"
} else {
"{ $convertedCall }, { it.key }"
}
} else if(inArgs.second == outArg.second){
val convertedCall = dataMethodInfo.getDataCall("it.key", outArg.first.getFullClassName(), isNullSave)
if(toEntries){
"$outTypeName($convertedCall, it.value)"
} else {
"{ $convertedCall }, { it.value }"
}
} else {
val inNames=Pair(inArgs.first.declaration.simpleName.asString(), inArgs.second.declaration.simpleName.asString())
val outNames=Pair(outArg.first.declaration.simpleName.asString(), outArg.second.declaration.simpleName.asString())
throw IllegalStateException("map type $outTypeName unknown converstion for map: ${inNames.first} ${inNames.second} -> ${outNames.first} ${outNames.second}")
}
}
fun getMapEntryTypePair(type:KSType, resolver: Resolver): Pair<KSType, KSType>{
var firstType = type.arguments.firstOrNull()?.type?.resolve()
var secondType = type.arguments.getOrNull(1)?.type?.resolve()
if(firstType==null || secondType == null){
val test = resolver.getKotlinClassByName(type.declaration.qualifiedName!!)
logger.warn("test ${test?.simpleName?.asString()}")
test?.getDeclaredProperties()?.forEach {
if(it.simpleName.asString() == "key"){
firstType = it.type.resolve()
} else if(it.simpleName.asString() == "value"){
secondType = it.type.resolve()
}
}
if(firstType==null || secondType == null){
throw IllegalStateException("map type ${type.declaration.simpleName.asString()} unkown in types for map")
}
}
return Pair(firstType!!, secondType!!)
}
private fun convertToMap(
outType: KSType,
inType: KSType,
varName: String,
dataMethod: DataMethodInfo,
resolver: Resolver
): String {
val outKeyType = outType.arguments.first().type?.resolve()
val outValueType = outType.arguments[1].type?.resolve()
val inKeyType = inType.arguments.firstOrNull()?.type?.resolve()
val inValueType = inType.arguments.getOrNull(1)?.type?.resolve()
if(inType == outType && outKeyType == inKeyType && outValueType == inValueType){
logger.warn("same map type $varName")
return varName
}
return outKeyType?.let {
logger.warn("field type: ${it.declaration.simpleName.asString()} ${Type.byType(it, this)} ${Type.byType(inType, this)}")
when (Type.byType(it, this)) {
Type.SIMPLE -> {
val type = Type.byType(inType, this)
if(type == Type.COLLECTION){
val inPair = getMapEntryTypePair(inKeyType!!, resolver)
val outPair = getMapEntryTypePair(outType, resolver)
return collectionToMap(inPair, outPair, varName, dataMethod, outType, resolver)
}
"emptyMap()"
} // TODO convert
Type.COLLECTION -> ""
Type.MAP -> ""
Type.MAP_ENTRY -> ""
Type.ENUM -> ""
Type.DATA -> {
val dataTarget = dataMethod.getDataCall("it", it.getFullClassName())
"$varName.map { $dataTarget }"
}
}
} ?: "emptyList()"
}
protected fun getTypeString(variable: Map.Entry<String,KSType>): String {
val type = variable.value
return when (val typeString = type.declaration.simpleName.asString()) {
"List" -> {
val typeArg = type.arguments.first().type?.resolve()
val typeArgString = typeArg?.let {
//val typePackage = it.declaration?.packageName?.asString()?.let { "$it." } ?: ""
val classInfoCache = classInfoCache[it]
val typePackage = classInfoCache?.packageName?.let { "$it." } ?: ""
"$typePackage${it.declaration.simpleName.asString()}"
} ?: "Any"
"List<$typeArgString>"
}
"Map" -> {
val keyTypeArg = type.arguments.first().type?.resolve()
val keyTypeArgString = keyTypeArg?.let {
//val typePackage = it.declaration?.packageName?.asString()?.let { "$it." } ?: ""
val typePackage = ""
"$typePackage${it.declaration.simpleName.asString()}"
} ?: "Any"
val valueTypeArg = type.arguments.getOrNull(1)?.type?.resolve()
val valueTypeArgString = valueTypeArg?.let {
//val typePackage = it.declaration?.packageName?.asString()?.let { "$it." } ?: ""
val typePackage = ""
"$typePackage${it.declaration.simpleName.asString()}"
} ?: "Any"
"Map<$keyTypeArgString, $valueTypeArgString>"
}
"OneOfType"-> {
variable.key.capitalizeFirstLetter()
}
else -> typeString
}
}
protected fun OutputStream.id(indentation: Int): OutputStream {
this += " ".repeat(indentation)
return this
}
fun KSType.getDefaultValueForType():String{
val typeString = this.declaration.simpleName.asString()
return when (typeString) {
"Int" -> "0"
"UInt" -> "0"
"Long" -> "0L"
"String" -> "\"\""
"Boolean" -> "false"
"List" -> "emptyList()"
"Map" -> "emptyMap()"
else -> {
if(enumType?.asStarProjectedType()?.isAssignableFrom(this) == true){
"$typeString.$UNRECOGNISED_ENUM_NAME"
}else {
"$typeString()"
}
}
}
}
operator fun OutputStream.plusAssign(str: String) {
this.write(str.toByteArray())
}
data class ProtoData(
val classDeclaration: KSClassDeclaration,
val packageName: String = classDeclaration.packageName.asString(),
val className: String = classDeclaration.simpleName.asString(),
val absoluteClassName: String = "$packageName.$className",
val versionPackage: String = packageName.split('.').last(),
val parseFunctionName: String = "parseBy$versionPackage",
val encodeFunctionName: String = "encodeTo$versionPackage",
val members: Map<String, KSType> = getMembers(classDeclaration)
)
enum class Type {
SIMPLE,
COLLECTION,
MAP,
MAP_ENTRY,
ENUM,
DATA;
companion object {
fun byType(type: KSType, generator: BaseGenerator): Type {
val string = type.declaration.simpleName.asString()
return when (string) {
"Byte" -> SIMPLE
"Short" -> SIMPLE
"Int" -> SIMPLE
"UInt" -> SIMPLE
"Long" -> SIMPLE
"Float" -> SIMPLE
"Double" -> SIMPLE
"Char" -> SIMPLE
"String" -> SIMPLE
"Boolean" -> SIMPLE
"List" -> COLLECTION
"Set" -> COLLECTION
"Map" -> MAP
else -> {
if(generator.enumType?.asStarProjectedType()?.isAssignableFrom(type) == true){
ENUM
} else if(generator.mapClass?.asStarProjectedType()?.isAssignableFrom(type) == true){
MAP_ENTRY
} else {
DATA
}
}
}
}
}
}
companion object {
fun getMembers(definition: KSClassDeclaration) = mutableMapOf<String, KSType>().apply {
definition.declarations.filter { it is KSPropertyDeclaration }
.associateByTo(this, { it.simpleName.asString() }, { (it as KSPropertyDeclaration).type.resolve() })
}
fun String.capitalizeFirstLetter() :String{
return replaceFirstChar { if (it.isLowerCase()) it.titlecase(Locale.getDefault()) else it.toString() }
}
}
}

View File

@ -0,0 +1,7 @@
import com.google.devtools.ksp.processing.KSPLogger
import com.google.devtools.ksp.processing.Resolver
import com.google.devtools.ksp.symbol.KSType
class CommandGenerator(logger: KSPLogger, resolver: Resolver, classInfoCache: MutableMap<KSType, ClassInfo>) :
DataGenerator(logger, resolver, classInfoCache) {
}

View File

@ -0,0 +1,110 @@
import com.google.devtools.ksp.processing.KSPLogger
import com.google.devtools.ksp.processing.Resolver
import com.google.devtools.ksp.symbol.KSType
import java.io.OutputStream
import kotlin.reflect.KClass
open class DataGenerator(
logger: KSPLogger,
resolver: Resolver,
classInfoCache: MutableMap<KSType, ClassInfo>
) : BaseGenerator(logger, resolver, classInfoCache) {
override fun addImports(file: OutputStream, classInfo: ClassInfo) {
super.addImports(file, classInfo)
file += "import interfaces.ProtoModel\n" +
"import interfaces.ProtoModelDecoder\n" +
"import pbandk.decodeFromByteArray\n"+
"import pbandk.encodeToByteArray\n"+
"import org.anime_game_servers.annotations.OneOf\n"
}
override fun addConstructor(file: OutputStream, classInfo:ClassInfo){
super.addConstructor(file, classInfo)
file += "data class ${classInfo.name} @JvmOverloads constructor (\n"
classInfo.modelMembers.forEach {
file.id(4) +="var ${it.key}: ${getTypeString(it)} = ${it.value.getDefaultValueForType()},\n"
}
file += ") : ProtoModel{\n"
}
override fun addBody(file: OutputStream, classInfo: ClassInfo) {
classInfo.oneOfs.values.forEach {
val oneOfClasses = mutableSetOf<KClass<*>>()
it.type.annotations.forEach { ksAnnotation ->
if(ksAnnotation.shortName.asString() == "OneOf"){
ksAnnotation.arguments.forEach { ksArgument ->
val type = ksArgument.value as KClass<*>
oneOfClasses.add(type)
}
}
}
}
}
override fun addEncodeMethods(file: OutputStream, classInfo: ClassInfo) {
file.id(4) +="override fun encodeToByteArray(version:VERSION) : ByteArray? {\n"
file.id(8) +="return when (version.namespace) {\n"
classInfo.protoSet.forEach { proto ->
file.id(12) +="\"${proto.versionPackage}\" -> " + "${proto.encodeFunctionName}().encodeToByteArray()\n"
}
file.id(12) +="else -> null\n"
file.id(8) +="}\n"
file.id(4) +="}\n"
classInfo.protoSet.forEach { proto ->
val functionName = proto.encodeFunctionName
val protoClass = proto.absoluteClassName
val protoMembers = proto.members
file.id(4) +="internal fun $functionName() : $protoClass {\n"
file.id(8) +="return $protoClass(\n"
addConstructorMembers(
12,
classInfo.modelMembers,
protoMembers,
file,
dataMethod = DataMethodInfo(functionName, true)
)
file.id(8) +=")\n"
file.id(4) +="}\n"
}
}
override fun addParsingMethods(file: OutputStream, classInfo: ClassInfo) {
file.id(8) +="@JvmStatic\n"
file.id(8) +="fun parseBy(data: ByteArray, version:VERSION): ${classInfo.name} {\n"
file.id(12) +="return when(version.namespace) {\n"
classInfo.protoSet.forEach { proto ->
file.id(16) +="\"${proto.versionPackage}\" -> {\n"
file.id(20) +="return ${proto.parseFunctionName}(data)\n"
file.id(16) +="}\n"
}
file.id(16) +="else -> ${classInfo.name}()\n"
file.id(12) +="}\n"
file.id(8) +="}\n"
classInfo.protoSet.forEach { proto ->
val functionName = proto.parseFunctionName
val protoClass = proto.absoluteClassName
val protoMembers = proto.members
file.id(8) += "internal fun $functionName(data:ByteArray) : ${classInfo.name} {\n"
file.id(12) +="return $functionName($protoClass.decodeFromByteArray(data))\n"
file.id(8) +="}\n"
file.id(8) +="internal fun $functionName(proto:$protoClass) : ${classInfo.name} {\n"
file.id(12) +="return ${classInfo.name}(\n"
addConstructorMembers(
16,
protoMembers,
classInfo.modelMembers,
file,
"proto",
DataMethodInfo(functionName, false, "data/messages" )
)
file.id(12) += ")\n"
file.id(8) +="}\n"
file.id(8) +="\n"
}
file.id(4) +="}\n"
}
}

View File

@ -0,0 +1,80 @@
import com.google.devtools.ksp.getDeclaredProperties
import com.google.devtools.ksp.processing.KSPLogger
import com.google.devtools.ksp.processing.Resolver
import com.google.devtools.ksp.symbol.KSClassDeclaration
import com.google.devtools.ksp.symbol.KSPropertyDeclaration
import com.google.devtools.ksp.symbol.KSType
import java.io.OutputStream
const val UNRECOGNISED_ENUM_NAME = "UNRECOGNISED"
class EnumGenerator(
logger: KSPLogger,
resolver: Resolver,
classInfoCache: MutableMap<KSType, ClassInfo>
) : BaseGenerator(logger, resolver, classInfoCache) {
override fun addConstructor(file: OutputStream, classInfo:ClassInfo){
super.addConstructor(file, classInfo)
file += "enum class ${classInfo.name}(\n"
classInfo.modelMembers.forEach {
file.id(4) +="var ${it.key}: ${getTypeString(it)} = ${it.value.getDefaultValueForType()},\n"
}
file += "){\n"
}
override fun addBody(file: OutputStream, classInfo: ClassInfo) {
classInfo.definition.declarations.filter { it is KSClassDeclaration }.forEach {
file.id(4) +="${it.simpleName.asString()},\n"
}
file.id(4) +="$UNRECOGNISED_ENUM_NAME;\n"
}
override fun addEncodeMethods(file: OutputStream, classInfo: ClassInfo) {
file.id(4) +="fun encodeToByteArray(version:VERSION) : Int? {\n"
file.id(8) +="return when (version.namespace) {\n"
classInfo.protoSet.forEach { proto ->
file.id(12) +="\"${proto.versionPackage}\" -> " + "${proto.encodeFunctionName}().value\n"
}
file.id(12) +="else -> null\n"
file.id(8) +="}\n"
file.id(4) +="}\n"
classInfo.protoSet.forEach { proto ->
val functionName = proto.encodeFunctionName
val protoClass = proto.absoluteClassName
file.id(4) +="internal fun $functionName() : $protoClass {\n"
file.id(8) +="return $protoClass.fromName(name)\n"
file.id(4) +="}\n"
}
}
override fun addParsingMethods(file: OutputStream, classInfo: ClassInfo) {
file.id(8) +="fun parseBy(value: Int, version:VERSION): ${classInfo.name} {\n"
file.id(12) +="return when(version.namespace) {\n"
classInfo.protoSet.forEach { proto ->
file.id(16) +="\"${proto.versionPackage}\" -> {\n"
file.id(20) +="return ${proto.parseFunctionName}(value)\n"
file.id(16) +="}\n"
}
file.id(16) +="else -> $UNRECOGNISED_ENUM_NAME\n"
file.id(12) +="}\n"
file.id(8) +="}\n"
classInfo.protoSet.forEach { proto ->
val functionName = proto.parseFunctionName
val protoClass = proto.absoluteClassName
val protoMembers = proto.members
file.id(8) += "internal fun $functionName(value:Int) : ${classInfo.name} {\n"
file.id(12) +="return $functionName($protoClass.fromValue(value))\n"
file.id(8) +="}\n"
file.id(8) +="internal fun $functionName(proto:$protoClass) : ${classInfo.name} {\n"
file.id(12) +="return proto.name?.let {\n"
file.id(16) +="${classInfo.name}.valueOf(it)\n"
file.id(12) += "} ?: $UNRECOGNISED_ENUM_NAME\n"
file.id(8) +="}\n"
file.id(8) +="\n"
}
file.id(4) +="}\n"
}
}

View File

@ -0,0 +1,173 @@
import com.google.devtools.ksp.*
import com.google.devtools.ksp.processing.*
import com.google.devtools.ksp.symbol.*
import java.io.OutputStream
const val BASE_ANNOTATION_PATH = "org.anime_game_servers.annotations"
const val PROTO_MODEL_ANNOTATION = "$BASE_ANNOTATION_PATH.ProtoModel"
const val PROTO_ENUM_ANNOTATION = "$BASE_ANNOTATION_PATH.ProtoEnum"
const val PROTO_COMMAND_ANNOTATION = "$BASE_ANNOTATION_PATH.ProtoCommand"
const val COMPILED_PROTO_ANNOTATION = "pbandk.Export"
const val VERSION_ENUM_CLASS = "VERSION"
/**
* TODOs
* - Add OneOf handling
*/
@OptIn(KspExperimental::class)
class FunctionProcessor(
private val codeGenerator: CodeGenerator,
private val logger: KSPLogger,
private val options: Map<String, String>
) : SymbolProcessor {
fun Resolver.getClassSymbolsByAnnotation(annotationName: String): Sequence<KSClassDeclaration>{
return getSymbolsWithAnnotation(annotationName)
.filterIsInstance<KSClassDeclaration>()
}
fun getClassInfo(symbols: Sequence<KSClassDeclaration>,
fullClassInfoCache: MutableMap<KSType, BaseGenerator.ClassInfo>,
compileProtoMap: Map<String, MutableSet<BaseGenerator.ProtoData>>
)
:Map<KSType, BaseGenerator.ClassInfo>{
val typeMap = mutableMapOf<KSType, BaseGenerator.ClassInfo>()
symbols.forEach {
val name = it.simpleName.asString()
val versionProtoSet = compileProtoMap[name] ?: run {
logger.warn("No proto found for $name")
return@forEach
}
val targetPackage = it.packageName.asString().replaceFirst("data.","messages.")
val dependencies = mutableSetOf<KSFile>().apply{
add(it.containingFile!!)
versionProtoSet.mapTo(this) { it.classDeclaration.containingFile!! }
}
val info = BaseGenerator.ClassInfo(name, targetPackage, it, dependencies, versionProtoSet)
typeMap[it.asStarProjectedType()] = info
fullClassInfoCache[it.asStarProjectedType()] = info
}
return typeMap
}
fun generateFiles(generator: BaseGenerator, classInfoMap: Map<KSType, BaseGenerator.ClassInfo>){
classInfoMap.values.forEach { classInfo ->
val file: OutputStream = codeGenerator.createNewFile(
// Make sure to associate the generated file with sources to keep/maintain it across incremental builds.
// Learn more about incremental processing in KSP from the official docs:
// https://kotlinlang.org/docs/ksp-incremental.html
dependencies = Dependencies(false, *classInfo.dependencies.toTypedArray()),
packageName = classInfo.packageName,
fileName = classInfo.name
)
generator.createClassForProto(file, classInfo)
file.close()
}
}
override fun process(resolver: Resolver): List<KSAnnotated> {
val wrapperEnumSymbols = resolver.getClassSymbolsByAnnotation(PROTO_ENUM_ANNOTATION)
val wrapperModelSymbols = resolver.getClassSymbolsByAnnotation(PROTO_MODEL_ANNOTATION)
val wrapperCommandSymbols = resolver.getClassSymbolsByAnnotation(PROTO_COMMAND_ANNOTATION)
val compiledProtos = resolver.getClassSymbolsByAnnotation(COMPILED_PROTO_ANNOTATION)
val versionClass = resolver.getKotlinClassByName(VERSION_ENUM_CLASS)
val compiledProtosMap = mutableMapOf<String, MutableSet<BaseGenerator.ProtoData>>()
compiledProtos.forEach {
compiledProtosMap.compute(it.simpleName.asString()) { _, v ->
if (v == null) {
mutableSetOf(BaseGenerator.ProtoData(it))
} else {
v+=BaseGenerator.ProtoData(it)
v
}
}
}
// targetClassInfo based from our interfaces
val classInfoCache= mutableMapOf<KSType, BaseGenerator.ClassInfo>()
val protoEnums= getClassInfo(wrapperEnumSymbols, classInfoCache, compiledProtosMap)
val protoModels= getClassInfo(wrapperModelSymbols, classInfoCache, compiledProtosMap)
val protoCommands= getClassInfo(wrapperCommandSymbols, classInfoCache, compiledProtosMap)
val enumGenerator = EnumGenerator(logger, resolver, classInfoCache)
val dataGenerator = DataGenerator(logger, resolver, classInfoCache)
val commandGenerator = DataGenerator(logger, resolver, classInfoCache) //TODO: Change to command generator
generateFiles(enumGenerator, protoEnums)
generateFiles(dataGenerator, protoModels)
generateFiles(commandGenerator, protoCommands)
/*val symbols = resolver.getSymbolsWithAnnotation("org.anime_game_servers.annotations.ProtoModel")
.filterIsInstance<KSClassDeclaration>()
val protos = resolver.getSymbolsWithAnnotation("pbandk.Export")
.filterIsInstance<KSClassDeclaration>()
symbols.forEach { symbol ->
logger.warn("Found symbol: ${symbol.simpleName.asString()}")
symbol.declarations.forEach {
logger.warn("Found declarations: $it ")
(it as? KSPropertyDeclaration)?.getter?.returnType?.resolve()?.declaration?.let { decl ->
logger.warn("Found return type: ${decl.simpleName.asString()}")
}
it.typeParameters.forEach { type ->
logger.warn("Found type: ${type.name.asString()}")
}
}
}
versionClass?.declarations?.forEach {
logger.warn("Found versions: $it with namespace $it")
}
if (!symbols.iterator().hasNext()) return emptyList()
val protosMap = mutableMapOf<String, MutableSet<BaseGenerator.ProtoData>>()
protos.forEach {
protosMap.compute(it.simpleName.asString()) { _, v ->
if (v == null) {
mutableSetOf(BaseGenerator.ProtoData(it))
} else {
v+=BaseGenerator.ProtoData(it)
v
}
}
}
symbols.forEach {
val versionProtos = protosMap[it.simpleName.asString()]
if (versionProtos != null) {
logger.warn("Found ${versionProtos.size} protos for ${it.simpleName.asString()} ")
versionProtos.forEach { proto ->
logger.warn("versions: ${proto.versionPackage}")
}
createClassForProto(resolver, it, versionProtos)
}
}*/
//TODO
val unableToProcess = wrapperModelSymbols.filterNot { it.validate() }.toList()
return unableToProcess
}
/*private fun createClassForProto(resolver: Resolver, classInfo: BaseGenerator.ClassInfo, generator: BaseGenerator) {
val file: OutputStream = codeGenerator.createNewFile(
// Make sure to associate the generated file with sources to keep/maintain it across incremental builds.
// Learn more about incremental processing in KSP from the official docs:
// https://kotlinlang.org/docs/ksp-incremental.html
dependencies = Dependencies(false, *classInfo.dependencies.toTypedArray()),
packageName = classInfo.packageName,
fileName = classInfo.name
)
generator.createClassForProto(file, classInfo)
file.close()
}*/
}

View File

@ -0,0 +1,8 @@
import com.google.devtools.ksp.processing.SymbolProcessorEnvironment
import com.google.devtools.ksp.processing.SymbolProcessorProvider
class FunctionProcessorProvider(): SymbolProcessorProvider {
override fun create(environment: SymbolProcessorEnvironment): FunctionProcessor {
return FunctionProcessor(environment.codeGenerator, environment.logger, environment.options)
}
}

3
gradle.properties Normal file
View File

@ -0,0 +1,3 @@
kotlin.code.style=official
kotlin.js.compiler=ir
kotlin.daemon.jvmargs=-Xmx4G

BIN
gradle/wrapper/gradle-wrapper.jar vendored Normal file

Binary file not shown.

View File

@ -0,0 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

234
gradlew vendored Executable file
View File

@ -0,0 +1,234 @@
#!/bin/sh
#
# Copyright © 2015-2021 the original authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
##############################################################################
#
# Gradle start up script for POSIX generated by Gradle.
#
# Important for running:
#
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
# noncompliant, but you have some other compliant shell such as ksh or
# bash, then to run this script, type that shell name before the whole
# command line, like:
#
# ksh Gradle
#
# Busybox and similar reduced shells will NOT work, because this script
# requires all of these POSIX shell features:
# * functions;
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
# * compound commands having a testable exit status, especially «case»;
# * various built-in commands including «command», «set», and «ulimit».
#
# Important for patching:
#
# (2) This script targets any POSIX shell, so it avoids extensions provided
# by Bash, Ksh, etc; in particular arrays are avoided.
#
# The "traditional" practice of packing multiple parameters into a
# space-separated string is a well documented source of bugs and security
# problems, so this is (mostly) avoided, by progressively accumulating
# options in "$@", and eventually passing that to Java.
#
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
# see the in-line comments for details.
#
# There are tweaks for specific operating systems such as AIX, CygWin,
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
#
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
app_path=$0
# Need this for daisy-chained symlinks.
while
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
[ -h "$app_path" ]
do
ls=$( ls -ld "$app_path" )
link=${ls#*' -> '}
case $link in #(
/*) app_path=$link ;; #(
*) app_path=$APP_HOME$link ;;
esac
done
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
APP_NAME="Gradle"
APP_BASE_NAME=${0##*/}
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
warn () {
echo "$*"
} >&2
die () {
echo
echo "$*"
echo
exit 1
} >&2
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "$( uname )" in #(
CYGWIN* ) cygwin=true ;; #(
Darwin* ) darwin=true ;; #(
MSYS* | MINGW* ) msys=true ;; #(
NONSTOP* ) nonstop=true ;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD=$JAVA_HOME/jre/sh/java
else
JAVACMD=$JAVA_HOME/bin/java
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
fi
# Collect all arguments for the java command, stacking in reverse order:
# * args from the command line
# * the main class name
# * -classpath
# * -D...appname settings
# * --module-path (only if needed)
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
# For Cygwin or MSYS, switch paths to Windows format before running java
if "$cygwin" || "$msys" ; then
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
JAVACMD=$( cygpath --unix "$JAVACMD" )
# Now convert the arguments - kludge to limit ourselves to /bin/sh
for arg do
if
case $arg in #(
-*) false ;; # don't mess with options #(
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
[ -e "$t" ] ;; #(
*) false ;;
esac
then
arg=$( cygpath --path --ignore --mixed "$arg" )
fi
# Roll the args list around exactly as many times as the number of
# args, so each arg winds up back in the position where it started, but
# possibly modified.
#
# NB: a `for` loop captures its iteration list before it begins, so
# changing the positional parameters here affects neither the number of
# iterations, nor the values presented in `arg`.
shift # remove old arg
set -- "$@" "$arg" # push replacement arg
done
fi
# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
org.gradle.wrapper.GradleWrapperMain \
"$@"
# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
#
# In Bash we could simply go:
#
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
# set -- "${ARGS[@]}" "$@"
#
# but POSIX shell has neither arrays nor command substitution, so instead we
# post-process each arg (as a line of input to sed) to backslash-escape any
# character that might be a shell metacharacter, then use eval to reverse
# that process (while maintaining the separation between arguments), and wrap
# the whole thing up as a single "set" statement.
#
# This will of course break if any of these variables contains a newline or
# an unmatched quote.
#
eval "set -- $(
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
xargs -n1 |
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
tr '\n' ' '
)" '"$@"'
exec "$JAVACMD" "$@"

89
gradlew.bat vendored Normal file
View File

@ -0,0 +1,89 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto execute
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

19
settings.gradle.kts Normal file
View File

@ -0,0 +1,19 @@
pluginManagement {
plugins {
id("com.google.devtools.ksp") version "1.8.20-1.0.11"
kotlin("jvm") version "1.8.20"
}
repositories {
gradlePluginPortal()
google()
}
}
rootProject.name = "multi-proto"
include(":annotations")
include(":processor")
project(":processor").projectDir = File("codeGenerator/processor")
project(":annotations").projectDir = File("codeGenerator/annotations")

View File

@ -0,0 +1,5 @@
package annotations
import messages.VERSION
annotation class AddedIn(val version: VERSION)

View File

@ -0,0 +1,5 @@
package annotations
import messages.VERSION
annotation class RemovedIn(val version: VERSION)

View File

@ -0,0 +1,4 @@
package data
internal const val IntDefault = 0
internal const val BoolDefault = false

View File

@ -0,0 +1,15 @@
package data.activity
import annotations.AddedIn
import messages.VERSION
import org.anime_game_servers.annotations.CommandType
import org.anime_game_servers.annotations.ProtoCommand
@AddedIn(VERSION.V1_0_0)
@ProtoCommand(CommandType.NOTIFY)
internal interface ActivityCondStateChangeNotify {
var scheduleId: Int
var activityId: Int
var meetCondList: List<Int>
var expireCondList: List<Int>
}

View File

@ -0,0 +1,8 @@
package data.activity
import org.anime_game_servers.annotations.ProtoModel
@ProtoModel
internal interface ActivityDetailInfo{
}

View File

@ -0,0 +1,68 @@
package data.activity
import annotations.AddedIn
import data.activity.aster.AsterActivityDetailInfo
import data.activity.crucible.CrucibleActivityDetailInfo
import data.activity.delivery.DeliveryActivityDetailInfo
import data.activity.flight.FlightActivityDetailInfo
import data.activity.music_game.MusicGameActivityDetailInfo
import data.activity.salesman.SalesmanActivityDetailInfo
import data.activity.sea_lamp.SeaLampActivityDetailInfo
import data.activity.summer_time.SummerTimeDetailInfo
import data.activity.summer_time_v2.SummerTimeV2DetailInfo
import data.activity.trial.TrialAvatarActivityDetailInfo
import data.activity.user_generated_content.UgcActivityDetailInfo
import messages.VERSION
import org.anime_game_servers.annotations.OneOf
import org.anime_game_servers.annotations.OneOfType
import org.anime_game_servers.annotations.ProtoModel
@AddedIn(VERSION.V0_9_0)
@ProtoModel
internal interface ActivityInfo {
var activityId: Int
var scheduleId: Int
var beginTime: Int
var endTime: Int
var activityType: Int
var isPlayOpenAnim: Boolean
var isFinished: Boolean
var isStarting: Boolean
var watcherInfoList: List<ActivityWatcherInfo>
@AddedIn(VERSION.V1_0_0)
var meetCondList: List<Int>
@AddedIn(VERSION.V1_0_0)
var expireCondList: List<Int>
var takenRewardList: List<Int>
var isHidden: Boolean
var activityCoinMap: Map<Int, Int>
var isBannerCleared: Boolean
var curScore: Int
var firstDayStartTime: Int
var scoreLimit: Int
var wishGiftNumMap: Map<Int, Int>
var selectedAvatarRewardId: Int
var isCommonContentClosed: Boolean
var activityPushTipsDataList: List<ActivityPushTipsData>
@AddedIn(VERSION.V3_0_0)
var isQuickOpen: Boolean
@OneOf(
types = [
SeaLampActivityDetailInfo::class,
CrucibleActivityDetailInfo::class,
SalesmanActivityDetailInfo::class,
TrialAvatarActivityDetailInfo::class,
DeliveryActivityDetailInfo::class,
AsterActivityDetailInfo::class,
FlightActivityDetailInfo::class,
SummerTimeV2DetailInfo::class,
SummerTimeDetailInfo::class,
MusicGameActivityDetailInfo::class,
UgcActivityDetailInfo::class
]
)
var detail: OneOfType
}

View File

@ -0,0 +1,12 @@
package data.activity
import annotations.AddedIn
import messages.VERSION
import org.anime_game_servers.annotations.CommandType
import org.anime_game_servers.annotations.ProtoCommand
@AddedIn(VERSION.V0_9_0)
@ProtoCommand(CommandType.NOTIFY)
internal interface ActivityInfoNotify {
var activityInfo: ActivityInfo
}

View File

@ -0,0 +1,13 @@
package data.activity
import annotations.AddedIn
import messages.VERSION
import org.anime_game_servers.annotations.CommandType
import org.anime_game_servers.annotations.ProtoCommand
// todo maybe send by the client?
@AddedIn(VERSION.V0_9_0)
@ProtoCommand(CommandType.NOTIFY)
interface ActivityPlayOpenAnimNotify {
var activityId: Int
}

View File

@ -0,0 +1,9 @@
package data.activity
import org.anime_game_servers.annotations.ProtoModel
@ProtoModel
interface ActivityPushTipsData {
var state: ActivityPushTipsState
var activityPushTipsId: Int
}

View File

@ -0,0 +1,10 @@
package data.activity
import org.anime_game_servers.annotations.ProtoEnum
@ProtoEnum
enum class ActivityPushTipsState {
ACTIVITY_PUSH_TIPS_STATE_NONE,
ACTIVITY_PUSH_TIPS_STATE_START,
ACTIVITY_PUSH_TIPS_STATE_READ
}

View File

@ -0,0 +1,19 @@
package data.activity
import annotations.RemovedIn
import annotations.AddedIn
import messages.VERSION
import org.anime_game_servers.annotations.ProtoModel
@AddedIn(VERSION.VCB2)
@ProtoModel
interface ActivityScheduleInfo {
var activityId: Int
var isOpen: Boolean
var scheduleId: Int
var beginTime: Int
var endTime: Int
@AddedIn(VERSION.V0_9_0)
@RemovedIn(VERSION.V1_0_0)
var hasReward: Boolean
}

View File

@ -0,0 +1,13 @@
package data.activity
import annotations.AddedIn
import messages.VERSION
import org.anime_game_servers.annotations.CommandType
import org.anime_game_servers.annotations.ProtoCommand
@AddedIn(VERSION.V0_9_0)
@ProtoCommand(CommandType.NOTIFY)
internal interface ActivityScheduleInfoNotify {
var activityScheduleList: List<ActivityScheduleInfo>
var remainFlySeaLampNum: Int
}

View File

@ -0,0 +1,13 @@
package data.activity
import annotations.AddedIn
import messages.VERSION
import org.anime_game_servers.annotations.CommandType
import org.anime_game_servers.annotations.ProtoCommand
@AddedIn(VERSION.V0_9_0)
@ProtoCommand(CommandType.REQUEST)
interface ActivityTakeWatcherRewardReq {
var activityId: Int
var watcherId: Int
}

View File

@ -0,0 +1,14 @@
package data.activity
import annotations.AddedIn
import messages.VERSION
import org.anime_game_servers.annotations.CommandType
import org.anime_game_servers.annotations.ProtoCommand
@AddedIn(VERSION.V0_9_0)
@ProtoCommand(CommandType.RESPONSE)
interface ActivityTakeWatcherRewardRsp {
var activityId: Int
var watcherId: Int
var retcode: Int
}

View File

@ -0,0 +1,13 @@
package data.activity
import annotations.AddedIn
import messages.VERSION
import org.anime_game_servers.annotations.CommandType
import org.anime_game_servers.annotations.ProtoCommand
@AddedIn(VERSION.V0_9_0)
@ProtoCommand(CommandType.NOTIFY)
interface ActivityUpdateWatcherNotify {
var activityId: Int
var watcherInfo: ActivityWatcherInfo
}

View File

@ -0,0 +1,14 @@
package data.activity
import annotations.AddedIn
import messages.VERSION
import org.anime_game_servers.annotations.ProtoModel
@AddedIn(VERSION.V0_9_0)
@ProtoModel
interface ActivityWatcherInfo {
var curProgress: Int
var isTakenReward: Boolean
var totalProgress: Int
var watcherId: Int
}

View File

@ -0,0 +1,12 @@
package data.activity
import annotations.AddedIn
import messages.VERSION
import org.anime_game_servers.annotations.CommandType
import org.anime_game_servers.annotations.ProtoCommand
@AddedIn(VERSION.V0_9_0)
@ProtoCommand(CommandType.RESPONSE)
interface GetActivityInfoRsp {
var retcode: Int
}

View File

@ -0,0 +1,11 @@
package data.activity
import annotations.AddedIn
import messages.VERSION
import org.anime_game_servers.annotations.CommandType
import org.anime_game_servers.annotations.ProtoCommand
@AddedIn(VERSION.VCB2)
@ProtoCommand(CommandType.REQUEST)
interface GetActivityScheduleReq {
}

View File

@ -0,0 +1,14 @@
package data.activity
import annotations.AddedIn
import messages.VERSION
import org.anime_game_servers.annotations.CommandType
import org.anime_game_servers.annotations.ProtoCommand
@AddedIn(VERSION.VCB2)
@ProtoCommand(CommandType.RESPONSE)
interface GetActivityScheduleRsp {
var activityScheduleList: List<ActivityScheduleInfo>
var remainingFlySeaLampNum: Int
var retcode: Int
}

View File

@ -0,0 +1,12 @@
package data.activity
import annotations.AddedIn
import messages.VERSION
import org.anime_game_servers.annotations.CommandType
import org.anime_game_servers.annotations.ProtoCommand
@AddedIn(VERSION.V0_9_0)
@ProtoCommand(CommandType.NOTIFY)
internal interface LoadActivityTerrainNotify {
var activityId: Int
}

View File

@ -0,0 +1,20 @@
package data.activity.announce
import annotations.AddedIn
import messages.VERSION
import org.anime_game_servers.annotations.ProtoModel
@AddedIn(VERSION.V0_9_0)
@ProtoModel
interface AnnounceData {
var configId: Int
var beginTime: Int
var endTime: Int
var centerSystemText: String
var countDownText: String
var dungeonConfirmText: String
var centerSystemFrequency: Int
var countDownFrequency: Int
@AddedIn(VERSION.V1_1_0)
var isCenterSystemLast5EveryMinutes: Boolean
}

View File

@ -0,0 +1,12 @@
package data.activity.announce
import annotations.AddedIn
import messages.VERSION
import org.anime_game_servers.annotations.CommandType
import org.anime_game_servers.annotations.ProtoCommand
@AddedIn(VERSION.V0_9_0)
@ProtoCommand(CommandType.NOTIFY)
internal interface ServerAnnounceNotify {
var announceDataList: List<AnnounceData>
}

View File

@ -0,0 +1,12 @@
package data.activity.announce
import annotations.AddedIn
import messages.VERSION
import org.anime_game_servers.annotations.CommandType
import org.anime_game_servers.annotations.ProtoCommand
@AddedIn(VERSION.V0_9_0)
@ProtoCommand(CommandType.NOTIFY)
internal interface ServerAnnounceRevokeNotify {
var configIdList: List<Int>
}

View File

@ -0,0 +1,20 @@
package data.activity.aster
import annotations.AddedIn
import data.generall.Vector
import messages.VERSION
import org.anime_game_servers.annotations.ProtoModel
@AddedIn(VERSION.V1_1_0)
@ProtoModel
interface AsterActivityDetailInfo {
var asterLittle: AsterLittleDetailInfo
var asterMid: AsterMidDetailInfo
var asterLarge: AsterLargeDetailInfo
var asterProgress: AsterProgressDetailInfo
var asterCredit: Int
var asterToken: Int
var isSpecialRewardTaken: Boolean
var isContentClosed: Boolean
var contentCloseTime: Int
}

View File

@ -0,0 +1,13 @@
package data.activity.aster
import annotations.AddedIn
import data.generall.Vector
import messages.VERSION
import org.anime_game_servers.annotations.ProtoModel
@AddedIn(VERSION.V1_1_0)
@ProtoModel
interface AsterLargeDetailInfo {
var isOpen: Boolean
var beginTime: Int
}

View File

@ -0,0 +1,12 @@
package data.activity.aster
import annotations.AddedIn
import messages.VERSION
import org.anime_game_servers.annotations.CommandType
import org.anime_game_servers.annotations.ProtoCommand
@AddedIn(VERSION.V1_1_0)
@ProtoCommand(CommandType.NOTIFY)
internal interface AsterLargeInfoNotify {
var info: AsterLargeDetailInfo
}

View File

@ -0,0 +1,16 @@
package data.activity.aster
import annotations.AddedIn
import data.generall.Vector
import messages.VERSION
import org.anime_game_servers.annotations.ProtoModel
@AddedIn(VERSION.V1_1_0)
@ProtoModel
interface AsterLittleDetailInfo {
var isOpen: Boolean
var stageId: Int
var stageState: AsterLittleStageState
var beginTime: Int
var stageBeginTime: Int
}

View File

@ -0,0 +1,12 @@
package data.activity.aster
import annotations.AddedIn
import messages.VERSION
import org.anime_game_servers.annotations.CommandType
import org.anime_game_servers.annotations.ProtoCommand
@AddedIn(VERSION.V1_1_0)
@ProtoCommand(CommandType.NOTIFY)
internal interface AsterLittleInfoNotify {
var info: AsterLittleDetailInfo
}

View File

@ -0,0 +1,8 @@
package data.activity.aster
enum class AsterLittleStageState {
ASTER_LITTLE_STAGE_NONE,
ASTER_LITTLE_STAGE_UNSTARTED,
ASTER_LITTLE_STAGE_STARTED,
ASTER_LITTLE_STAGE_FINISHED,
}

View File

@ -0,0 +1,13 @@
package data.activity.aster
import annotations.AddedIn
import data.generall.Vector
import messages.VERSION
import org.anime_game_servers.annotations.ProtoModel
@AddedIn(VERSION.V1_1_0)
@ProtoModel
interface AsterMidCampInfo {
var campId: Int
var pos: Vector
}

View File

@ -0,0 +1,12 @@
package data.activity.aster
import annotations.AddedIn
import messages.VERSION
import org.anime_game_servers.annotations.CommandType
import org.anime_game_servers.annotations.ProtoCommand
@AddedIn(VERSION.V1_1_0)
@ProtoCommand(CommandType.NOTIFY)
internal interface AsterMidCampInfoNotify {
var info: AsterMidCampInfo
}

View File

@ -0,0 +1,15 @@
package data.activity.aster
import annotations.AddedIn
import data.generall.Vector
import messages.VERSION
import org.anime_game_servers.annotations.ProtoModel
@AddedIn(VERSION.V1_1_0)
@ProtoModel
interface AsterMidDetailInfo {
var isOpen: Boolean
var campList: List<AsterMidCampInfo>
var collectCount: Int
var beginTime: Int
}

View File

@ -0,0 +1,12 @@
package data.activity.aster
import annotations.AddedIn
import messages.VERSION
import org.anime_game_servers.annotations.CommandType
import org.anime_game_servers.annotations.ProtoCommand
@AddedIn(VERSION.V1_1_0)
@ProtoCommand(CommandType.NOTIFY)
internal interface AsterMidInfoNotify {
var info: AsterMidDetailInfo
}

View File

@ -0,0 +1,13 @@
package data.activity.aster
import annotations.AddedIn
import messages.VERSION
import org.anime_game_servers.annotations.CommandType
import org.anime_game_servers.annotations.ProtoCommand
@AddedIn(VERSION.V1_1_0)
@ProtoCommand(CommandType.NOTIFY)
internal interface AsterMiscInfoNotify {
var asterCredit: Int
var asterToken: Int
}

View File

@ -0,0 +1,13 @@
package data.activity.aster
import annotations.AddedIn
import data.generall.Vector
import messages.VERSION
import org.anime_game_servers.annotations.ProtoModel
@AddedIn(VERSION.V1_1_0)
@ProtoModel
interface AsterProgressDetailInfo {
var count: Int
var lastAutoAddTime: Int
}

View File

@ -0,0 +1,12 @@
package data.activity.aster
import annotations.AddedIn
import messages.VERSION
import org.anime_game_servers.annotations.CommandType
import org.anime_game_servers.annotations.ProtoCommand
@AddedIn(VERSION.V1_1_0)
@ProtoCommand(CommandType.NOTIFY)
internal interface AsterProgressInfoNotify {
var info: AsterProgressDetailInfo
}

View File

@ -0,0 +1,14 @@
package data.activity.aster
import annotations.AddedIn
import messages.VERSION
import org.anime_game_servers.annotations.CommandType
import org.anime_game_servers.annotations.ProtoCommand
@AddedIn(VERSION.V1_1_0)
@ProtoCommand(CommandType.REQUEST)
interface SelectAsterMidDifficultyReq {
var scheduleId: Int
var gadgetEntityId: Int
var difficultyId: Int
}

View File

@ -0,0 +1,15 @@
package data.activity.aster
import annotations.AddedIn
import messages.VERSION
import org.anime_game_servers.annotations.CommandType
import org.anime_game_servers.annotations.ProtoCommand
@AddedIn(VERSION.V1_1_0)
@ProtoCommand(CommandType.RESPONSE)
interface SelectAsterMidDifficultyRsp {
var scheduleId: Int
var gadgetEntityId: Int
var difficultyId: Int
var retcode: Int
}

View File

@ -0,0 +1,12 @@
package data.activity.aster
import annotations.AddedIn
import messages.VERSION
import org.anime_game_servers.annotations.CommandType
import org.anime_game_servers.annotations.ProtoCommand
@AddedIn(VERSION.V1_1_0)
@ProtoCommand(CommandType.REQUEST)
interface TakeAsterSpecialRewardReq {
var scheduleId: Int
}

View File

@ -0,0 +1,13 @@
package data.activity.aster
import annotations.AddedIn
import messages.VERSION
import org.anime_game_servers.annotations.CommandType
import org.anime_game_servers.annotations.ProtoCommand
@AddedIn(VERSION.V1_1_0)
@ProtoCommand(CommandType.RESPONSE)
interface TakeAsterSpecialRewardRsp {
var scheduleId: Int
var retcode: Int
}

View File

@ -0,0 +1,16 @@
package data.activity.crucible
import annotations.AddedIn
import data.generall.Vector
import messages.VERSION
import org.anime_game_servers.annotations.ProtoModel
@AddedIn(VERSION.V0_9_0)
@ProtoModel
interface CrucibleActivityDetailInfo {
var costTime : Int
var uidInfoList: List<CrucibleBattleUidInfo>
var pos: Vector
@AddedIn(VERSION.V1_0_0)
var battleWorldLevel: Int
}

View File

@ -0,0 +1,14 @@
package data.activity.crucible
import annotations.AddedIn
import messages.VERSION
import org.anime_game_servers.annotations.ProtoModel
@AddedIn(VERSION.V0_9_0)
@ProtoModel
interface CrucibleBattleUidInfo {
var uid: Int
var nickname: String
var icon: Int
var onlineId : String
}

View File

@ -0,0 +1,14 @@
package data.activity.delivery
import annotations.AddedIn
import data.generall.Vector
import messages.VERSION
import org.anime_game_servers.annotations.ProtoModel
@AddedIn(VERSION.V1_1_0)
@ProtoModel
interface DeliveryActivityDetailInfo {
var dayIndex: Int
var finishedDeliveryQuestIndex: List<Int>
var isTakenReward: Boolean
}

View File

@ -0,0 +1,14 @@
package data.activity.delivery
import annotations.AddedIn
import messages.VERSION
import org.anime_game_servers.annotations.CommandType
import org.anime_game_servers.annotations.ProtoCommand
@AddedIn(VERSION.V1_1_0)
@ProtoCommand(CommandType.NOTIFY)
internal interface FinishDeliveryNotify {
var scheduleId: Int
var dayIndex: Int
var finishedQuestIndex: Int
}

View File

@ -0,0 +1,12 @@
package data.activity.delivery
import annotations.AddedIn
import messages.VERSION
import org.anime_game_servers.annotations.CommandType
import org.anime_game_servers.annotations.ProtoCommand
@AddedIn(VERSION.V1_1_0)
@ProtoCommand(CommandType.REQUEST)
interface TakeDeliveryDailyRewardReq {
var scheduleId: Int
}

View File

@ -0,0 +1,13 @@
package data.activity.delivery
import annotations.AddedIn
import messages.VERSION
import org.anime_game_servers.annotations.CommandType
import org.anime_game_servers.annotations.ProtoCommand
@AddedIn(VERSION.V1_1_0)
@ProtoCommand(CommandType.RESPONSE)
interface TakeDeliveryDailyRewardRsp {
var scheduleId: Int
var retcode: Int
}

View File

@ -0,0 +1,13 @@
package data.activity.flight
import annotations.AddedIn
import messages.VERSION
import org.anime_game_servers.annotations.ProtoModel
@AddedIn(VERSION.V1_1_0)
@ProtoModel
interface FlightActivityDetailInfo {
var dailyRecordList: List<FlightDailyRecord>
var previewRewardId: Int
var minOpenPlayerTime: Int
}

View File

@ -0,0 +1,13 @@
package data.activity.flight
import annotations.AddedIn
import messages.VERSION
import org.anime_game_servers.annotations.CommandType
import org.anime_game_servers.annotations.ProtoCommand
@AddedIn(VERSION.V1_1_0)
@ProtoCommand(CommandType.REQUEST)
interface FlightActivityRestartReq {
var scheduleId: Int
var groupId: Int
}

View File

@ -0,0 +1,14 @@
package data.activity.flight
import annotations.AddedIn
import messages.VERSION
import org.anime_game_servers.annotations.CommandType
import org.anime_game_servers.annotations.ProtoCommand
@AddedIn(VERSION.V1_1_0)
@ProtoCommand(CommandType.RESPONSE)
interface FlightActivityRestartRsp {
var scheduleId: Int
var groupId: Int
var retcode: Int
}

View File

@ -0,0 +1,19 @@
package data.activity.flight
import annotations.AddedIn
import messages.VERSION
import org.anime_game_servers.annotations.CommandType
import org.anime_game_servers.annotations.ProtoCommand
@AddedIn(VERSION.V1_1_0)
@ProtoCommand(CommandType.NOTIFY)
internal interface FlightActivitySettleNotify {
var isSuccess: Boolean
var leftTime: Int
var collectNum: Int
var totalNum: Int
var score: Int
var isNewRecord: Boolean
var medalLevel: Int
var groupId: Int
}

View File

@ -0,0 +1,16 @@
package data.activity.flight
import annotations.AddedIn
import data.generall.Vector
import messages.VERSION
import org.anime_game_servers.annotations.ProtoModel
@AddedIn(VERSION.V1_1_0)
@ProtoModel
interface FlightDailyRecord {
var isTouched: Boolean
var bestScore: Int
var startTime: Int
var watcherIdList: List<Int>
var groupId: Int
}

View File

@ -0,0 +1,17 @@
package data.activity.music_game
import data.activity.user_generated_content.music_game.UgcMusicBriefInfo
import org.anime_game_servers.annotations.ProtoModel
/**
* Information about a music game activity. This includes the current user records and user generated content.
* @property musicGameRecordMap The current user records.
* @property ugcRecordList
* @property ugcSearchList
*/
@ProtoModel
interface MusicGameActivityDetailInfo {
var musicGameRecordMap: Map<Int, MusicGameRecord>
var ugcRecordList: List<UgcMusicBriefInfo>
var ugcSearchList: List<UgcMusicBriefInfo>
}

View File

@ -0,0 +1,10 @@
package data.activity.music_game
import org.anime_game_servers.annotations.ProtoModel
@ProtoModel
interface MusicGameRecord {
var isUnlock: Boolean
var maxScore: Int
var maxCombo: Int
}

View File

@ -0,0 +1,15 @@
package data.activity.salesman
import annotations.AddedIn
import messages.VERSION
import org.anime_game_servers.annotations.ProtoModel
@AddedIn(VERSION.V1_0_0)
@ProtoModel
interface SalesmanActivityDetailInfo {
var status: SalesmanStatusType
var dayIndex: Int
var lastDeliverTime: Int
var deliverCount: Int
var selectedRewardIdMap: Map<Int, Int>
}

View File

@ -0,0 +1,12 @@
package data.activity.salesman
import annotations.AddedIn
import messages.VERSION
import org.anime_game_servers.annotations.CommandType
import org.anime_game_servers.annotations.ProtoCommand
@AddedIn(VERSION.V1_0_0)
@ProtoCommand(CommandType.REQUEST)
interface SalesmanDeliverItemReq {
var scheduleId: Int
}

View File

@ -0,0 +1,13 @@
package data.activity.salesman
import annotations.AddedIn
import messages.VERSION
import org.anime_game_servers.annotations.CommandType
import org.anime_game_servers.annotations.ProtoCommand
@AddedIn(VERSION.V1_0_0)
@ProtoCommand(CommandType.RESPONSE)
interface SalesmanDeliverItemRsp {
var scheduleId: Int
var retcode: Int
}

View File

@ -0,0 +1,14 @@
package data.activity.salesman
import annotations.AddedIn
import messages.VERSION
import org.anime_game_servers.annotations.ProtoEnum
@AddedIn(VERSION.V1_0_0)
@ProtoEnum
enum class SalesmanStatusType {
SALESMAN_STATUS_NONE,
SALESMAN_STATUS_UNSTARTED,
SALESMAN_STATUS_STARTED,
SALESMAN_STATUS_DELIVERED,
}

View File

@ -0,0 +1,13 @@
package data.activity.salesman
import annotations.AddedIn
import messages.VERSION
import org.anime_game_servers.annotations.CommandType
import org.anime_game_servers.annotations.ProtoCommand
@AddedIn(VERSION.V1_0_0)
@ProtoCommand(CommandType.REQUEST)
interface SalesmanTakeRewardReq {
var scheduleId: Int
var position: Int
}

View File

@ -0,0 +1,15 @@
package data.activity.salesman
import annotations.AddedIn
import messages.VERSION
import org.anime_game_servers.annotations.CommandType
import org.anime_game_servers.annotations.ProtoCommand
@AddedIn(VERSION.V1_0_0)
@ProtoCommand(CommandType.RESPONSE)
interface SalesmanTakeRewardRsp {
var scheduleId: Int
var rewardId: Int
var position: Int
var retcode: Int
}

View File

@ -0,0 +1,17 @@
package data.activity.sea_lamp
import annotations.AddedIn
import messages.VERSION
import org.anime_game_servers.annotations.ProtoModel
@AddedIn(VERSION.V0_9_0)
@ProtoModel
interface SeaLampActivityDetailInfo {
var phaseId : Int
var progress: Int
var days: Int
var contribution: Int
var factor: Int
var takenContributionRewardList: List<Int>
var takenPhaseRewardList: List<Int>
}

View File

@ -0,0 +1,14 @@
package data.activity.sea_lamp
import annotations.AddedIn
import messages.VERSION
import org.anime_game_servers.annotations.ProtoModel
@AddedIn(VERSION.VCB2)
@ProtoModel
interface SeaLampActivityInfo {
var activityId: Int
var scheduleId: Int
var phase: Int
var progress : Int
}

View File

@ -0,0 +1,13 @@
package data.activity.sea_lamp
import annotations.AddedIn
import messages.VERSION
import org.anime_game_servers.annotations.CommandType
import org.anime_game_servers.annotations.ProtoCommand
@AddedIn(VERSION.VCB2)
@ProtoCommand(CommandType.NOTIFY)
interface SeaLampActivityInfoNotify {
var activityInfo: SeaLampActivityInfo
var activityPlayerInfo: SeaLampActivityPlayerInfo
}

View File

@ -0,0 +1,11 @@
package data.activity.sea_lamp
import annotations.AddedIn
import messages.VERSION
import org.anime_game_servers.annotations.ProtoModel
@AddedIn(VERSION.VCB2)
@ProtoModel
interface SeaLampActivityPlayerInfo {
var contribution: Int
}

View File

@ -0,0 +1,15 @@
package data.activity.sea_lamp
import annotations.AddedIn
import data.generall.ItemParam
import messages.VERSION
import org.anime_game_servers.annotations.CommandType
import org.anime_game_servers.annotations.ProtoCommand
@AddedIn(VERSION.VCB2)
@ProtoCommand(CommandType.REQUEST)
interface SeaLampContributeItemReq {
var itemList: ItemParam
@AddedIn(VERSION.V1_0_0)
var activityId: Int
}

View File

@ -0,0 +1,17 @@
package data.activity.sea_lamp
import annotations.AddedIn
import messages.VERSION
import org.anime_game_servers.annotations.CommandType
import org.anime_game_servers.annotations.ProtoCommand
@AddedIn(VERSION.VCB2)
@ProtoCommand(CommandType.RESPONSE)
interface SeaLampContributeItemRsp {
var totalContribution: Int
var retcode: Int
@AddedIn(VERSION.V0_9_0)
var addContribution: Int
@AddedIn(VERSION.V0_9_0)
var addProgress: Int
}

View File

@ -0,0 +1,17 @@
package data.activity.sea_lamp
import annotations.AddedIn
import messages.VERSION
import org.anime_game_servers.annotations.CommandType
import org.anime_game_servers.annotations.ProtoCommand
@AddedIn(VERSION.VCB2)
@ProtoCommand(CommandType.REQUEST)
interface SeaLampFlyLampReq {
var itemId: Int
var wishText: String
@AddedIn(VERSION.V0_9_0)
var itemNum: Int
@AddedIn(VERSION.V1_0_0)
var activityId: Int
}

View File

@ -0,0 +1,21 @@
package data.activity.sea_lamp
import annotations.AddedIn
import messages.VERSION
import org.anime_game_servers.annotations.CommandType
import org.anime_game_servers.annotations.ProtoCommand
@AddedIn(VERSION.VCB2)
@ProtoCommand(CommandType.RESPONSE)
interface SeaLampFlyLampRsp {
var totalContribution: Int
var retcode: Int
@AddedIn(VERSION.V0_9_0)
var remainFlyNum: Int
@AddedIn(VERSION.V0_9_0)
var addContribution: Int
@AddedIn(VERSION.V0_9_0)
var addProgress: Int
@AddedIn(VERSION.V0_9_0)
var itemNum: Int
}

View File

@ -0,0 +1,11 @@
package data.activity.sea_lamp
import annotations.AddedIn
import messages.VERSION
import org.anime_game_servers.annotations.CommandType
import org.anime_game_servers.annotations.ProtoCommand
@AddedIn(VERSION.VCB2)
@ProtoCommand(CommandType.REQUEST)
interface SeaLampGetActivityInfoReq {
}

View File

@ -0,0 +1,14 @@
package data.activity.sea_lamp
import annotations.AddedIn
import messages.VERSION
import org.anime_game_servers.annotations.CommandType
import org.anime_game_servers.annotations.ProtoCommand
@AddedIn(VERSION.VCB2)
@ProtoCommand(CommandType.RESPONSE)
interface SeaLampGetActivityInfoRsp {
var activityInfo: SeaLampActivityInfo
var activityPlayerInfo: SeaLampActivityPlayerInfo
var retcode: Int
}

View File

@ -0,0 +1,14 @@
package data.activity.sea_lamp
import annotations.AddedIn
import messages.VERSION
import org.anime_game_servers.annotations.CommandType
import org.anime_game_servers.annotations.ProtoCommand
@AddedIn(VERSION.VCB2)
@ProtoCommand(CommandType.REQUEST)
interface SeaLampTakeContributionRewardReq {
var configId: Int
@AddedIn(VERSION.V1_0_0)
var activityId: Int
}

View File

@ -0,0 +1,12 @@
package data.activity.sea_lamp
import annotations.AddedIn
import messages.VERSION
import org.anime_game_servers.annotations.CommandType
import org.anime_game_servers.annotations.ProtoCommand
@AddedIn(VERSION.VCB2)
@ProtoCommand(CommandType.RESPONSE)
interface SeaLampTakeContributionRewardRsp {
var retcode: Int
}

View File

@ -0,0 +1,14 @@
package data.activity.sea_lamp
import annotations.AddedIn
import messages.VERSION
import org.anime_game_servers.annotations.CommandType
import org.anime_game_servers.annotations.ProtoCommand
@AddedIn(VERSION.VCB2)
@ProtoCommand(CommandType.REQUEST)
interface SeaLampTakePhaseRewardReq {
var phaseId: Int
@AddedIn(VERSION.V1_0_0)
var activityId: Int
}

View File

@ -0,0 +1,14 @@
package data.activity.sea_lamp
import annotations.AddedIn
import messages.VERSION
import org.anime_game_servers.annotations.CommandType
import org.anime_game_servers.annotations.ProtoCommand
@AddedIn(VERSION.VCB2)
@ProtoCommand(CommandType.REQUEST)
interface SeaLampTakePhaseRewardRsp {
var retcode: Int
@AddedIn(VERSION.V0_9_0)
var phaseId: Int
}

View File

@ -0,0 +1,14 @@
package data.activity.summer_time
import annotations.AddedIn
import messages.VERSION
import org.anime_game_servers.annotations.ProtoModel
@ProtoModel
@AddedIn(VERSION.V1_6_0)
interface SummerTimeDetailInfo {
var stageMap: Map<Int, SummerTimeStageInfo>
var contentCloseTime: Int
var isContentClosed: Boolean
var sprintBoatInfo: SummerTimeSprintBoatInfo
}

View File

@ -0,0 +1,11 @@
package data.activity.summer_time
import annotations.AddedIn
import messages.VERSION
import org.anime_game_servers.annotations.ProtoModel
@ProtoModel
@AddedIn(VERSION.V1_6_0)
interface SummerTimeSprintBoatInfo {
var recordList: List<SummerTimeSprintBoatRecord>
}

View File

@ -0,0 +1,15 @@
package data.activity.summer_time
import annotations.AddedIn
import messages.VERSION
import org.anime_game_servers.annotations.ProtoModel
@ProtoModel
@AddedIn(VERSION.V1_6_0)
interface SummerTimeSprintBoatRecord {
var bestScore: Int
var startTime: Int
var isTouched: Boolean
var watcherIdList: List<Int>
var groupId: Int
}

View File

@ -0,0 +1,13 @@
package data.activity.summer_time
import annotations.AddedIn
import messages.VERSION
import org.anime_game_servers.annotations.ProtoModel
@ProtoModel
@AddedIn(VERSION.V1_6_0)
interface SummerTimeStageInfo {
var isOpen: Boolean
var openTime: Int
var stageId: Int
}

Some files were not shown because too many files have changed in this diff Show More