Skip to content

Commit

Permalink
Merge pull request Grasscutters#1704 from Grasscutters/development
Browse files Browse the repository at this point in the history
Merge `development` into `stable`
  • Loading branch information
KingRainbow44 committed Sep 3, 2022
2 parents 1792c58 + 5529674 commit 2b2c612
Show file tree
Hide file tree
Showing 1,527 changed files with 1,092,394 additions and 24,378 deletions.
14 changes: 14 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
max_line_length = 120
tab_width = 4
trim_trailing_whitespace = true

[{*.json,*.xml}]
indent_size = 2
6 changes: 6 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
*.java text=auto
*.json text=auto
*.md text=auto
*.properties text=auto
*.py text=auto
*.sh text=auto
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Setup Java
uses: actions/setup-java@v3
with:
Expand Down
31 changes: 31 additions & 0 deletions .github/workflows/language_lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: "Language Lint"
on:
workflow_dispatch: ~
push:
paths:
- ".github/workflows/**"
- "src/main/**.java"
- "**.json"
- "manage_languages.py"
branches:
- "stable"
- "development"
pull_request:
paths:
- ".github/workflows/**"
- "src/main/**.java"
- "**.json"
- "manage_languages.py"
types:
- opened
- synchronize
- reopened
jobs:
Lint-Language-Keys:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.10' # Version range or exact version of a Python version to use, using SemVer's version range syntax
- run: python3 manage_languages.py -l
63 changes: 63 additions & 0 deletions .github/workflows/lint_commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: "Lint whitespace and languages"
on:
workflow_dispatch: ~
push:
paths:
- ".github/workflows/**"
- "src/main/**.java"
- "**.json"
- "build.gradle"
- "format_whitespace.py"
- "manage_languages.py"
branches:
- "development"
jobs:
Make-Lint-Commits:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Run Whitespace Linter
run: python format_whitespace.py
- run: git config --global user.name "github-actions"
- run: git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
- run: git stash
- run: git checkout LintRatchet
# - run: git merge development
- run: git reset --hard development
- run: git stash pop || true

- name: Commit any whitespace changes
run: git add -u && git commit -m 'Fix whitespace [skip actions]' || true

- name: Update Languages
run: python manage_languages.py -u

- name: Commit any language changes
run: git add -u && git commit -m 'Update languages [skip actions]' || true

- name: Bump version to a release
# a.b.c-dev -> a.b.c
# If any breaking changes, a.b.c-dev -> a.(b+1).0
run: |
export BREAKING=`git log $(git describe --tags --abbrev=0)..HEAD --pretty=format:"%s" --grep="BREAKING"`
if [[ $BREAKING ]]; then export NEXT_VERSION=`sed -nr "s/^version = '(.*\.)([0-9]+)\.[0-9]+(-dev)?'"'/echo "\1$((\2+1)).0"/ep' build.gradle`; else export NEXT_VERSION=`sed -nr "s/^version = '(.*)-dev'/\1/p" build.gradle`; fi
export CHANGELOG=`git log $(git describe --tags --abbrev=0)..HEAD --pretty=format:"%s"`
perl -pi -e "s/version = '.*'/version = '$NEXT_VERSION'/g" build.gradle
git add build.gradle && git commit -m "Version $NEXT_VERSION" -m "$CHANGELOG"
- name: Bump version to next dev
# a.b.c -> a.b.(c+1)-dev
run: |
export NEXT_VERSION=`sed -nr "s/^version = '(.*)([0-9]+)'"'/echo "\1$((\2+1))-dev"/ep' build.gradle`
perl -pi -e "s/version = '.*'/version = '$NEXT_VERSION'/g" build.gradle
git add build.gradle && git commit -m "Version $NEXT_VERSION [skip actions]"
- name: Force-push changes to LintRatchet
run: git push --set-upstream --force origin LintRatchet
6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -52,19 +52,20 @@ tmp/
.vscode

# Grasscutter
/cache
/resources
/logs
/plugins
/data
/keys
/language
/languages
/src/generated
/proto

/*.jar
/*.sh

GM Handbook.txt
GM Handbook*.txt
config.json
mitmdump.exe
mongod.exe
Expand All @@ -78,4 +79,5 @@ BuildConfig.java

# macOS
.DS_Store
.directory
data/hk4e/announcement/
9 changes: 9 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,12 @@ Please note we have a code of conduct, please follow it in all your interactions
1. Ensure any install or build dependencies are removed before the end of the layer when doing a build.
2. Update the README.md and wiki with details of changes to the interface, this includes new environment variables, exposed ports, useful file locations and container parameters.
3. Write with detail on your pull request description what you have committed, to make it easier for the collaborators to make a changelog.

## Code Content

Your code should follow the standards set below:

- Your code can be run purely using a Java 17 JVM.
- Dependencies that use a separate language (ex. Kotlin) that can run on a JVM are acceptable.
- Dependencies that require the use of native code (ex. JNI) are prohibited.
- Directly adding foreign code (other languages, ex. Kotlin) into the main codebase is prohibited.
215 changes: 107 additions & 108 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,108 +1,107 @@
![Grasscutter](https://socialify.git.ci/Grasscutters/Grasscutter/image?description=1&forks=1&issues=1&language=1&logo=https%3A%2F%2Fs2.loli.net%2F2022%2F04%2F25%2FxOiJn7lCdcT5Mw1.png&name=1&owner=1&pulls=1&stargazers=1&theme=Light)
<div align="center"><img alt="Documention" src="https://img.shields.io/badge/Wiki-Grasscutter-blue?style=for-the-badge&link=https://github.com/Grasscutters/Grasscutter/wiki&link=https://github.com/Grasscutters/Grasscutter/wiki"> <img alt="GitHub release (latest by date)" src="https://img.shields.io/github/v/release/Grasscutters/Grasscutter?logo=java&style=for-the-badge"> <img alt="GitHub" src="https://img.shields.io/github/license/Grasscutters/Grasscutter?style=for-the-badge"> <img alt="GitHub last commit" src="https://img.shields.io/github/last-commit/Grasscutters/Grasscutter?style=for-the-badge"> <img alt="GitHub Workflow Status" src="https://img.shields.io/github/workflow/status/Grasscutters/Grasscutter/Build?logo=github&style=for-the-badge"></div>

<div align="center"><a href="https://discord.gg/T5vZU6UyeG"><img alt="Discord - Grasscutter" src="https://img.shields.io/discord/965284035985305680?label=Discord&logo=discord&style=for-the-badge"></a></div>

EN | [中文](README_zh-CN.md)

**Attention:** We always welcome contributors to the project. Before adding your contribution, please carefully read our [Code of Conduct](https://github.com/Grasscutters/Grasscutter/blob/stable/CONTRIBUTING.md).

## Current features

* Logging in
* Combat
* Friends list
* Teleportation
* Gacha system
* Co-op *partially* works
* Spawning monsters via console
* Inventory features (recieving items/characters, upgrading items/characters, etc)

## Quick setup guide

**Note:** For support please join our [Discord](https://discord.gg/T5vZU6UyeG).

### Requirements

* Java SE - 17 ([link](https://www.oracle.com/java/technologies/javase/jdk17-archive-downloads.html))

**Note:** If you just want to **run it**, then **jre** only is fine.

* MongoDB (recommended 4.0+)

* Proxy daemon: mitmproxy (mitmdump, recommended), Fiddler Classic, etc.

### Running

**Note:** If you updated from an older version, delete `config.json` to regenerate it.

1. Get `grasscutter.jar`
- Download from [actions](https://nightly.link/Grasscutters/Grasscutter/workflows/build/stable/Grasscutter.zip)
- [Build by yourself](#Building)
2. Create a `resources` folder in the directory where grasscutter.jar is located and move your `BinOutput` and `ExcelBinOutput` folders there *(Check the [wiki](https://github.com/Grasscutters/Grasscutter/wiki) for more details how to get those.)*
3. Run Grasscutter with `java -jar grasscutter.jar`. **Make sure mongodb service is running as well.**

### Connecting with the client

½. Create an account using [server console command](#Commands).

1. Redirect traffic: (choose one)
- mitmdump: `mitmdump -s proxy.py -k`

Trust CA certificate:

**Note:**The CA certificate is usually stored in `% USERPROFILE%\ .mitmproxy`, or you can download it from `http://mitm.it`

​ Double click for [install](https://docs.microsoft.com/en-us/skype-sdk/sdn/articles/installing-the-trusted-root-certificate#installing-a-trusted-root-certificate) or ...

- Via command line

```shell
certutil -addstore root %USERPROFILE%\.mitmproxy\mitmproxy-ca-cert.cer
```

- Fiddler Classic: Run Fiddler Classic, turn on `Decrypt https traffic` in setting and change the default port there (Tools -> Options -> Connections) to anything other than `8888`, and load [this script](https://github.lunatic.moe/fiddlerscript).

- [Hosts file](https://github.com/Melledy/Grasscutter/wiki/Running#traffic-route-map)

2. Set network proxy to `127.0.0.1:8080` or the proxy port you specified.

**you can also use `start.cmd` to start servers and proxy daemons automatically, but you have to set up JAVA_HOME enviroment**

### Building

Grasscutter uses Gradle to handle dependencies & building.

**Requirements:**

- Java SE Development Kits - 17
- Git

##### Windows

```shell
git clone https://github.com/Grasscutters/Grasscutter.git
cd Grasscutter
.\gradlew.bat # Setting up environments
.\gradlew jar # Compile
```

##### Linux

```bash
git clone https://github.com/Grasscutters/Grasscutter.git
cd Grasscutter
chmod +x gradlew
./gradlew jar # Compile
```

You can find the output jar in the root of the project folder.

### Commands have moved to the [wiki](https://github.com/Grasscutters/Grasscutter/wiki/Commands)!

# Quick Troubleshooting

* If compiling wasn't successful, please check your JDK installation (JDK 17 and validated JDK's bin PATH variable)
* My client doesn't connect, doesn't login, 4206, etc... - Mostly your proxy daemon setup is *the issue*, if using
Fiddler make sure it running on another port except 8888
* Startup sequence: MongoDB > Grasscutter > Proxy daemon (mitmdump, fiddler, etc.) > Game
![Grasscutter](https://socialify.git.ci/Grasscutters/Grasscutter/image?description=1&forks=1&issues=1&language=1&logo=https%3A%2F%2Fs2.loli.net%2F2022%2F04%2F25%2FxOiJn7lCdcT5Mw1.png&name=1&owner=1&pulls=1&stargazers=1&theme=Light)
<div align="center"><img alt="Documentation" src="https://img.shields.io/badge/Wiki-Grasscutter-blue?style=for-the-badge&link=https://github.com/Grasscutters/Grasscutter/wiki&link=https://github.com/Grasscutters/Grasscutter/wiki"> <img alt="GitHub release (latest by date)" src="https://img.shields.io/github/v/release/Grasscutters/Grasscutter?logo=java&style=for-the-badge"> <img alt="GitHub" src="https://img.shields.io/github/license/Grasscutters/Grasscutter?style=for-the-badge"> <img alt="GitHub last commit" src="https://img.shields.io/github/last-commit/Grasscutters/Grasscutter?style=for-the-badge"> <img alt="GitHub Workflow Status" src="https://img.shields.io/github/workflow/status/Grasscutters/Grasscutter/Build?logo=github&style=for-the-badge"></div>

<div align="center"><a href="https://discord.gg/T5vZU6UyeG"><img alt="Discord - Grasscutter" src="https://img.shields.io/discord/965284035985305680?label=Discord&logo=discord&style=for-the-badge"></a></div>

[EN](README.md) | [简中](README_zh-CN.md) | [繁中](README_zh-TW.md) | [FR](README_fr-FR.md) | [ES](README_es-ES.md) | [HE](README_HE.md) | [RU](README_ru-RU.md) | [PL](README_pl-PL.md) | [ID](README_id-ID.md) | [KR](README_ko-KR.md) | [FIL/PH](README_fil-PH.md) | [NL](README_NL.md) | [JP](README_ja-JP.md)

**Attention:** We always welcome contributors to the project. Before adding your contribution, please carefully read our [Code of Conduct](https://github.com/Grasscutters/Grasscutter/blob/stable/CONTRIBUTING.md).

## Current features

* Logging in
* Combat
* Friends list
* Teleportation
* Gacha system
* Co-op *partially* works
* Spawning monsters via console
* Inventory features (receiving items/characters, upgrading items/characters, etc)

## Quick setup guide

**Note:** For support please join our [Discord](https://discord.gg/T5vZU6UyeG).

### Requirements

* [Java SE - 17](https://www.oracle.com/java/technologies/javase/jdk17-archive-downloads.html)

**Note:** If you just want to **run it**, then **jre** only is fine.

* [MongoDB](https://www.mongodb.com/try/download/community) (recommended 4.0+)

* Proxy Daemon: [mitmproxy](https://mitmproxy.org/) (mitmdump, recommended), [Fiddler Classic](https://telerik-fiddler.s3.amazonaws.com/fiddler/FiddlerSetup.exe), etc.

### Running

**Note:** If you updated from an older version, delete `config.json` to regenerate it.

1. Get `grasscutter.jar`
- Download from [actions](https://github.com/Grasscutters/Grasscutter/actions/workflows/build.yml) or [build the server by yourself](#building).
2. Create a `resources` folder in the directory where grasscutter.jar is located and move your `BinOutput, ExcelBinOutput, Readables, Scripts, Subtitle, TextMap` folders there *(Check the [wiki](https://github.com/Grasscutters/Grasscutter/wiki) for more details how to get those.)*
3. Run Grasscutter with `java -jar grasscutter.jar`. **Make sure mongodb service is running as well.**

### Connecting with the client

½. Create an account using [server console command](https://github.com/Grasscutters/Grasscutter/wiki/Commands#targeting).

1. Redirect traffic: (choose one)
- mitmdump: `mitmdump -s proxy.py -k`

Trust CA certificate:

**Note:** The CA certificate is usually stored in `%USERPROFILE%\.mitmproxy`, or you can download it from `http://mitm.it`

​ Double click for [install](https://docs.microsoft.com/en-us/skype-sdk/sdn/articles/installing-the-trusted-root-certificate#installing-a-trusted-root-certificate) or ...

- Via command line (needs administration privileges)

```shell
certutil -addstore root %USERPROFILE%\.mitmproxy\mitmproxy-ca-cert.cer
```

- Fiddler Classic: Run Fiddler Classic, turn on `Decrypt HTTPS traffic` in (Tools -> Options -> HTTPS) and change the default port in (Tools -> Options -> Connections) to anything other than `8888`, and load [this script](https://github.com/Grasscutters/Grasscutter/wiki/Resources#fiddler-classic-jscript) (copy and paste the script in the `FiddlerScript` tab).

- [Hosts file](https://github.com/Grasscutters/Grasscutter/wiki/Resources#hosts-file)

2. Set network proxy to `127.0.0.1:8080` or the proxy port you specified.

**You can also use `start.cmd` to start servers and proxy daemons automatically, but you have to set up JAVA_HOME enviroment and configure the `start_config.cmd` file.**

### Building

Grasscutter uses Gradle to handle dependencies & building.

**Requirements:**

- [Java SE Development Kits - 17](https://www.oracle.com/java/technologies/javase/jdk17-archive-downloads.html)
- [Git](https://git-scm.com/downloads)

##### Windows

```shell
git clone https://github.com/Grasscutters/Grasscutter.git
cd Grasscutter
.\gradlew.bat # Setting up environments
.\gradlew jar # Compile
```

##### Linux

```bash
git clone https://github.com/Grasscutters/Grasscutter.git
cd Grasscutter
chmod +x gradlew
./gradlew jar # Compile
```

You can find the output jar in the root of the project folder.

### Commands have moved to the [wiki](https://github.com/Grasscutters/Grasscutter/wiki/Commands)!

# Quick Troubleshooting

* If compiling wasn't successful, please check your JDK installation (JDK 17 and validated JDK's bin PATH variable)
* My client doesn't connect, doesn't login, 4206, etc... - Mostly your proxy daemon setup is *the issue*, if using
Fiddler make sure it running on another port except 8888
* Startup sequence: MongoDB > Grasscutter > Proxy daemon (mitmdump, fiddler, etc.) > Game
Loading

0 comments on commit 2b2c612

Please sign in to comment.