Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Melledy committed Sep 25, 2023
0 parents commit 48b267c
Show file tree
Hide file tree
Showing 214 changed files with 11,265 additions and 0 deletions.
75 changes: 75 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# Compiled class file
*.class

#idea
*.idea
# Log file
*.log

# BlueJ files
*.ctxt

# Mobile Tools for Java (J2ME)
.mtj.tmp/

# Package Files #
*.war
*.nar
*.ear
*.zip
*.gz
*.rar

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*

# Ignore Gradle project-specific cache directory
.gradle

# Ignore Gradle build output directory
build/
out/

# Ignore Gradle properties
gradle.properties

# Eclipse
.project
.classpath
.settings
.metadata
.properties
bin/
tmp/
*.tmp
*.bak
*.swp
*~.nib
.loadpath
.recommenders

# VSCode
.vscode

# lombok
/.apt_generated/

# macOS
.DS_Store
.directory

# Lunar Rail generated/resource/log folders
src/generated
/resources
/logs

# Lunar Rail compiled
/*.jar
/*.sh

# Lunar Rail extra
Star Rail Handbook.txt
config.json
*.mv
*.exe
Test.java
31 changes: 31 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Lunar Rail
A WIP server emulator for version 1.3.0 of a certain turn based anime game.

# Running the server and client

### Prerequisites
* Java 17 JDK

### Recommended
* Mongodb (4.0+)

### Starting up the server
1. Compile the server with `./gradlew jar`
2. Create a folder named `resources` in your server directory, you will need to downlaod `TextMap` and `ExcelBin` folders which you can get from a repo like [https://github.com/Dimbreath/StarRailData](https://github.com/Dimbreath/StarRailData) into your resources folder.
3. Run the server with `java -jar LunarRail.jar`. Lunar Rail comes with a built in internal mongo server for its database, so no Mongodb installation is required. However, it is highly recomended to install Mongodb anyways.

### Connecting with the client
1. Login with the client to an official server at least once to download game data.
2. If you are using the provided keystore, you will need to install and have [Fiddler](https://www.telerik.com/fiddler) running. Make sure fiddler is set to decrypt https traffic.
3. Set your hosts file to redirect at least `hkrpg-sdk-os-static.hoyoverse.com` and `globaldp-prod-os01.starrails.com` to your http (dispatch) server ip.

### Server console commands

`/account create [username] {playerid}` - Creates an account with the specified username and the in-game uid for that account. The playerid parameter is optional and will be auto generated if not set.

### In-Game commands
There is a dummy user named "Server" in every player's friends list that you can message to use commands. Commands also work in other chat rooms, such as private/team chats.

`!spawn [monster id] [stage id]`

`!give [item id] [amount]`
148 changes: 148 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
/*
* This file was generated by the Gradle 'init' task.
*
* This generated file contains a sample Java project to get you started.
* For more details take a look at the Java Quickstart chapter in the Gradle
* User Manual available at https://docs.gradle.org/5.6.3/userguide/tutorial_java_projects.html
*/

plugins {
// Apply the application plugin to add support for building a CLI application
id 'application'

// Apply the java plugin to add support for Java
id 'java'

// Protoc plugin
id 'com.google.protobuf' version '0.8.19'

id 'eclipse'
}

compileJava.options.encoding = "UTF-8"
compileTestJava.options.encoding = "UTF-8"

sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17

repositories {
mavenCentral()
jcenter()
}

protobuf {
protoc {
artifact = 'com.google.protobuf:protoc:3.24.3'
}
plugins {
quickbuf {
artifact = 'us.hebi.quickbuf:protoc-gen-quickbuf:1.3.1'
}
}
generateProtoTasks {
all().each { task ->
task.builtins {
remove java
}
task.plugins {
quickbuf {
option 'store_unknown_fields=true'

outputSubDir = ''
}
}
}
}
generatedFilesBaseDir = "$projectDir/src/generated/"
}

dependencies {
implementation fileTree(dir: 'lib', include: ['*.jar'])

implementation group: 'org.slf4j', name: 'slf4j-api', version: '2.0.9'
implementation group: 'ch.qos.logback', name: 'logback-core', version: '1.4.11'
implementation group: 'ch.qos.logback', name: 'logback-classic', version: '1.4.11'

implementation group: 'it.unimi.dsi', name: 'fastutil-core', version: '8.5.12'
implementation group: 'org.reflections', name: 'reflections', version: '0.10.2'

implementation group: 'com.google.code.gson', name: 'gson', version: '2.10.1'
implementation group: 'us.hebi.quickbuf', name: 'quickbuf-runtime', version: '1.3.1'

implementation group: 'io.javalin', name: 'javalin', version: '5.6.2'

implementation group: 'io.netty', name: 'netty-common', version: '4.1.97.Final'
implementation group: 'io.netty', name: 'netty-handler', version: '4.1.97.Final'
implementation group: 'io.netty', name: 'netty-transport-native-epoll', version: '4.1.97.Final'
implementation group: 'io.netty', name: 'netty-transport-native-kqueue', version: '4.1.97.Final'

implementation group: 'dev.morphia.morphia', name: 'morphia-core', version: '2.3.8'
implementation group: 'de.bwaldvogel', name: 'mongo-java-server', version: '1.44.0'
implementation group: 'de.bwaldvogel', name: 'mongo-java-server-h2-backend', version: '1.44.0'

protobuf files('proto/')

compileOnly 'org.projectlombok:lombok:1.18.30'
annotationProcessor 'org.projectlombok:lombok:1.18.30'
}

configurations.all {
exclude group: 'org.slf4j', module: 'slf4j'
}

clean {
delete protobuf.generatedFilesBaseDir
}

application {
// Define the main class for the application
mainClassName = 'emu.lunarcore.LunarRail'
}

jar {
exclude '*.proto'

manifest {
attributes 'Main-Class': 'emu.lunarcore.LunarRail'
}

jar {
archiveBaseName = 'LunarRail'
archiveVersion = ''
}

from {
configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }
}

duplicatesStrategy = DuplicatesStrategy.INCLUDE

from('src/main/java') {
include '*.xml'
}

getDestinationDirectory().set(file("."))
}

sourceSets {
main {
proto {
srcDir 'src/generated'
}
java {
srcDir 'src/main/java'
}
}
}

eclipse {
classpath {
file.whenMerged { cp ->
cp.entries.add( new org.gradle.plugins.ide.eclipse.model.SourceFolder('src/generated/main/', null) )
}
}
}

processResources {
dependsOn "generateProto"
}
27 changes: 27 additions & 0 deletions data/Banners.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
[
{
"id": 1001,
"gachaType": "Normal",
"beginTime": 0,
"endTime": 0,
"rateUpItems5": [],
"rateUpItems4": []
},
{
"id": 2009,
"gachaType": "AvatarUp",
"beginTime": 0,
"endTime": 1924992000,
"rateUpItems5": [1213],
"rateUpItems4": [1207, 1001, 1009]
},
{
"id": 3009,
"gachaType": "WeaponUp",
"beginTime": 0,
"endTime": 1924992000,
"eventChance": 75,
"rateUpItems5": [1208],
"rateUpItems4": [1106, 1109, 1110]
}
]
Binary file added gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
5 changes: 5 additions & 0 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit 48b267c

Please sign in to comment.