Commit e6402c31 authored by memetrollsXD's avatar memetrollsXD
Browse files

Merge branch 'stable' into development

parents d5d90564 1dfe8733
name: "Build"
on:
push:
branches:
- "stable"
jobs:
Build-Server-Jar:
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: '8'
- name: Run Gradle
run: .\gradlew.bat && .\gradlew jar
- name: Upload build
uses: actions/upload-artifact@v3
with:
name: Grasscutter
path: grasscutter.jar
[submodule "Grasscutter-Protos"]
path = Grasscutter-Protos
url = https://github.com/Melledy/Grasscutter-Protos
Subproject commit 0537e9cc4c7856a7c6f88bbbaa908a80c4ee677e
# Grasscutter # Grasscutter
A WIP server emulator for Genshin Impact 2.3-2.6 A WIP server reimplementation for *some anime game* 2.3-2.6
**Documentation**: [Grasscutter Wiki](https://github.com/Melledy/Grasscutter/wiki/)
**Note**: For support please join the [Discord server](https://discord.gg/T5vZU6UyeG). **Note**: For support please join the [Discord server](https://discord.gg/T5vZU6UyeG).
# Current features # Current features
* Logging in * Logging in
* Spawning monsters via console
* Combat * Combat
* Spawning monsters via console
* Inventory features (recieving items/characters, upgrading items/characters, etc) * Inventory features (recieving items/characters, upgrading items/characters, etc)
* Co-op does work, but movement is kind of buggy and some player ults do not spawn properly
* Friends list
* Gacha system * Gacha system
* Friends list
* Co-op *partially* work
# Quick setup guide # Quick setup guide
* For more information, we now have [Grasscutter Wiki](https://github.com/Melledy/Grasscutter/wiki/) page ! ### Note
* If you update from an older version, delete `config.json` for regeneration
### Prerequisites ### Prerequisites
* JDK-8u202 ([mirror link](https://mirrors.huaweicloud.com/java/jdk/8u202-b08/) since Oracle required an account to download old builds) * JDK-8u202 ([mirror link](https://mirrors.huaweicloud.com/java/jdk/8u202-b08/) since Oracle required an account to download old builds)
* Mongodb (recommended 4.0+) * Mongodb (recommended 4.0+)
...@@ -22,13 +23,13 @@ A WIP server emulator for Genshin Impact 2.3-2.6 ...@@ -22,13 +23,13 @@ A WIP server emulator for Genshin Impact 2.3-2.6
### Starting up Grasscutter server (Assuming you are on Windows) ### Starting up Grasscutter server (Assuming you are on Windows)
1. Setup compile environment `gradlew.bat` 1. Setup compile environment `gradlew.bat`
2. Compile Grasscutter with `gradlew jar` 2. Compile Grasscutter with `gradlew jar`
3. Create a folder named `resources` in your Grasscutter directory, bring your `BinOutput` and `ExcelBinOutput` folders into it *(Check the wiki for more details where to get those.)* 3. Create a folder named `resources` in your Grasscutter directory, bring your `BinOutput` and `ExcelBinOutput` folders into it *(Check the wiki for more details how to get those.)*
4. Run Grasscutter with `java -jar grasscutter.jar`. Make sure mongodb is running as well. 4. Run Grasscutter with `java -jar grasscutter.jar`. Make sure mongodb service is running as well.
### Connecting with the client ### Connecting with the client
½. Create an account using command below ½. Create an account using *server console command* below
1. Run a proxy daemon: (choose either one) 1. Run a proxy daemon: (choose either one)
- mitmdump: `mitmdump -s proxy.py --ssl-insecure` - mitmdump: `mitmdump -s proxy.py -k`
- 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). - 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) - [Hosts file](https://github.com/Melledy/Grasscutter/wiki/Running#traffic-route-map)
2. Trust CA certificate: 2. Trust CA certificate:
...@@ -39,35 +40,40 @@ A WIP server emulator for Genshin Impact 2.3-2.6 ...@@ -39,35 +40,40 @@ A WIP server emulator for Genshin Impact 2.3-2.6
* or you can use `run.cmd` to start Server & Proxy daemon with one click * or you can use `run.cmd` to start Server & Proxy daemon with one click
# Grasscutter commands # Grasscutter commands
### Server console 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.
`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. `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 `spawn [monster id] [level] [amount]`
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.
`give [item id] [amount]`
`givechar [avatar id] [level]`
`drop [item id] [amount]`
`!spawn [monster id] [level] [amount]` `killall`
`!give [item id] [amount]` `setworldlevel [level]` - Relog to see effects properly
`!givechar [avatar id] [level]` `godmode` - Prevents you from taking damage
`!drop [item id] [amount]` `resetconst` - Resets the constellation level on your current active character, will need to relog after using the command to see any changes.
`!killall` `setstats [stats] [amount]` - Changes the current character's specified stat.
`!setworldlevel [level]` - Relog to see effects properly `clearartifacts` - Deletes all unequipped and unlocked level 0 artifacts, **including yellow rarity ones** from your inventory
`!godmode` - Prevents you from taking damage `pos` - Gets your current coordinate.
`!resetconst` - Resets the constellation level on your current active character, will need to relog after using the command to see any changes. `weather [weather id] [climate id]` - Changes the current weather.
`!sethp [hp]` *More commands will be updated in the [wiki](https://github.com/Melledy/Grasscutter/wiki/).*
`!clearartifacts` - Deletes all unequipped and unlocked level 0 artifacts, **including yellow rarity ones** from your inventory ### Bonus
When you want to teleport to somewhere, use the ingame marking function on Map, click Confirm. You will see your character falling from a very high destination, exact location that you marked.
# Quick Troubleshooting # Quick Troubleshooting
* If compiling wasnt successful, please check your JDK installation (must be JDK 8 and validated JDK's bin PATH variable) * If compiling wasn't successful, please check your JDK installation (must be JDK 8 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 * 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.) > Client * Startup sequence: Mongodb > Grasscutter > Proxy daemon (mitmdump, fiddler, etc.) > Client
* If `4206` error constantly prompt up, try to use [jdk-8u202-b08](https://mirrors.huaweicloud.com/java/jdk/8u202-b08/) instead of other versions of JDK
...@@ -23,19 +23,21 @@ repositories { ...@@ -23,19 +23,21 @@ repositories {
} }
dependencies { dependencies {
compile fileTree(dir: 'lib', include: '*.jar') implementation fileTree(dir: 'lib', include: ['*.jar'])
compile group: 'org.slf4j', name: 'slf4j-api', version: '1.7.32' implementation group: 'org.slf4j', name: 'slf4j-api', version: '1.7.32'
compile group: 'ch.qos.logback', name: 'logback-core', version: '1.2.6' implementation group: 'ch.qos.logback', name: 'logback-core', version: '1.2.6'
compile group: 'ch.qos.logback', name: 'logback-classic', version: '1.2.6' implementation group: 'ch.qos.logback', name: 'logback-classic', version: '1.2.6'
compile group: 'io.netty', name: 'netty-all', version: '4.1.69.Final' implementation group: 'io.netty', name: 'netty-all', version: '4.1.69.Final'
compile group: 'com.google.code.gson', name: 'gson', version: '2.8.8' implementation group: 'com.google.code.gson', name: 'gson', version: '2.8.8'
compile group: 'com.google.protobuf', name: 'protobuf-java', version: '3.18.1' implementation group: 'com.google.protobuf', name: 'protobuf-java', version: '3.18.1'
compile group: 'org.reflections', name: 'reflections', version: '0.9.12' implementation group: 'org.reflections', name: 'reflections', version: '0.9.12'
compile group: 'dev.morphia.morphia', name: 'core', version: '1.6.1' implementation group: 'dev.morphia.morphia', name: 'core', version: '1.6.1'
implementation group: 'org.greenrobot', name: 'eventbus-java', version: '3.3.1'
} }
application { application {
...@@ -51,9 +53,11 @@ jar { ...@@ -51,9 +53,11 @@ jar {
jar.baseName = 'grasscutter' jar.baseName = 'grasscutter'
from { from {
configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }
} }
duplicatesStrategy = DuplicatesStrategy.INCLUDE
from('src/main/java') { from('src/main/java') {
include '*.xml' include '*.xml'
} }
......
...@@ -17,39 +17,24 @@ ...@@ -17,39 +17,24 @@
"gachaType": 301, "gachaType": 301,
"scheduleId": 903, "scheduleId": 903,
"bannerType": "EVENT", "bannerType": "EVENT",
"prefabPath": "GachaShowPanel_A076", "prefabPath": "GachaShowPanel_A079",
"previewPrefabPath": "UI_Tab_GachaShowPanel_A076", "previewPrefabPath": "UI_Tab_GachaShowPanel_A079",
"titlePath": "UI_GACHA_SHOW_PANEL_A076_TITLE", "titlePath": "UI_GACHA_SHOW_PANEL_A048_TITLE",
"costItem": 223, "costItem": 223,
"beginTime": 0, "beginTime": 0,
"endTime": 1924992000, "endTime": 1924992000,
"sortId": 9998, "sortId": 9998,
"maxItemType": 1, "maxItemType": 1,
"rateUpItems1": [1066], "rateUpItems1": [1002],
"rateUpItems2": [1023, 1043, 1064] "rateUpItems2": [1053, 1020, 1045]
},
{
"gachaType": 400,
"scheduleId": 913,
"bannerType": "EVENT",
"prefabPath": "GachaShowPanel_A077",
"previewPrefabPath": "UI_Tab_GachaShowPanel_A077",
"titlePath": "UI_Tab_GachaShowPanel_A077",
"costItem": 223,
"beginTime": 0,
"endTime": 1924992000,
"sortId": 9998,
"maxItemType": 1,
"rateUpItems1": [1022],
"rateUpItems2": [1023, 1043, 1064]
}, },
{ {
"gachaType": 302, "gachaType": 302,
"scheduleId": 923, "scheduleId": 913,
"bannerType": "WEAPON", "bannerType": "WEAPON",
"prefabPath": "GachaShowPanel_A078", "prefabPath": "GachaShowPanel_A080",
"previewPrefabPath": "UI_Tab_GachaShowPanel_A078", "previewPrefabPath": "UI_Tab_GachaShowPanel_A080",
"titlePath": "UI_GACHA_SHOW_PANEL_A078_TITLE", "titlePath": "UI_GACHA_SHOW_PANEL_A021_TITLE",
"costItem": 223, "costItem": 223,
"beginTime": 0, "beginTime": 0,
"endTime": 1924992000, "endTime": 1924992000,
...@@ -58,7 +43,7 @@ ...@@ -58,7 +43,7 @@
"eventChance": 75, "eventChance": 75,
"softPity": 80, "softPity": 80,
"hardPity": 80, "hardPity": 80,
"rateUpItems1": [11510, 15503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1Qs5PtDbMuMCIPSYscVx1x66qcJw19SiQyNLxCY9ErLGDY4mChY/X5NX7Pc2ricYE7EzCSZMYQmtUVZoqn1RPGz1P9Gj65Edm70zFOfRWfR+sTboONM7W3oNk1mkI2M5GwQrQpkAiyb5zwdxpsOwtQ0s0Sin4IOonpW9KcRv8yB8rMOMu6+C6m4h2MwRPj6QrVPWd8PV22qB4iAwfV3UYpjo91Mw/V5xT1DRSrb65vYtu8E4lR3HMv37at4aV6v8RluqeAIHHDJBANaUN3eLCSHewfEb+osQ5BV7XQT5Dwdy/LLFo+hdCBp0Retgtiwsq3+EgRs9i/d9tmghRqEdD/6re752aRiyTsf7CkWY6O7cCGfvmOLE0XhNQra+tLnlJCR1y4m1LOTB3ulQnZrA2E7Mmk7
\ No newline at end of file \ No newline at end of file
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.3-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
...@@ -16,19 +16,17 @@ ...@@ -16,19 +16,17 @@
# - mitmdump from mitmproxy # - mitmdump from mitmproxy
# #
# @author MlgmXyysd # @author MlgmXyysd
# @version 1.0 # @version 1.1
# #
## ##
from mitmproxy import ctx, http from mitmproxy import http
from proxy_config import USE_SSL
from proxy_config import REMOTE_HOST
from proxy_config import REMOTE_PORT
class MlgmXyysd_Genshin_Impact_Proxy: class MlgmXyysd_Genshin_Impact_Proxy:
def request(self, flow: http.HTTPFlow) -> None:
# This can also be replaced with another IP address.
REMOTE_HOST = "localhost"
LIST_DOMAINS = [ LIST_DOMAINS = [
"api-os-takumi.mihoyo.com", "api-os-takumi.mihoyo.com",
"hk4e-api-os-static.mihoyo.com", "hk4e-api-os-static.mihoyo.com",
...@@ -53,15 +51,23 @@ class MlgmXyysd_Genshin_Impact_Proxy: ...@@ -53,15 +51,23 @@ class MlgmXyysd_Genshin_Impact_Proxy:
"hk4e-sdk-os-static.hoyoverse.com", "hk4e-sdk-os-static.hoyoverse.com",
"sdk-os-static.hoyoverse.com", "sdk-os-static.hoyoverse.com",
"api-account-os.hoyoverse.com", "api-account-os.hoyoverse.com",
"hk4e-sdk-os.hoyoverse.com" "hk4e-sdk-os.hoyoverse.com",
"overseauspider.yuanshen.com",
"gameapi-account.mihoyo.com",
"minor-api.mihoyo.com",
"public-data-api.mihoyo.com",
"uspider.yuanshen.com",
"sdk-static.mihoyo.com"
] ]
if flow.request.url.startswith("http://overseauspider.yuanshen.com:8888/log"): def request(self, flow: http.HTTPFlow) -> None:
ctx.log.info("Block overseauspider.yuanshen.com") if flow.request.host in self.LIST_DOMAINS:
flow.response = http.HTTPResponse.make(404) if USE_SSL:
elif flow.request.host in LIST_DOMAINS: flow.request.scheme = "https"
ctx.log.info("Redirect " + flow.request.host) else:
flow.request.scheme = "http"
flow.request.host = REMOTE_HOST flow.request.host = REMOTE_HOST
flow.request.port = REMOTE_PORT
addons = [ addons = [
MlgmXyysd_Genshin_Impact_Proxy() MlgmXyysd_Genshin_Impact_Proxy()
......
# This can also be replaced with another IP address.
USE_SSL = True
REMOTE_HOST = "127.0.0.1"
REMOTE_PORT = 443
\ No newline at end of file
@echo off
::This will not work if your java is in a different location, plugin as necessary
::this just saves you from changing your PATH
"C:\Program Files\Java\jdk1.8.0_202\bin\java.exe" -jar ./grasscutter.jar
\ No newline at end of file
package emu.grasscutter.commands;
import java.lang.reflect.Modifier;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import emu.grasscutter.data.GenshinData;
import emu.grasscutter.data.def.ItemData;
import emu.grasscutter.data.def.MonsterData;
import emu.grasscutter.game.GenshinPlayer;
import emu.grasscutter.game.avatar.GenshinAvatar;
import emu.grasscutter.game.entity.EntityAvatar;
import emu.grasscutter.game.entity.EntityItem;
import emu.grasscutter.game.entity.EntityMonster;
import emu.grasscutter.game.entity.GenshinEntity;
import emu.grasscutter.game.inventory.GenshinItem;
import emu.grasscutter.game.inventory.ItemType;
import emu.grasscutter.game.props.ActionReason;
import emu.grasscutter.game.props.FightProperty;
import emu.grasscutter.server.packet.send.PacketEntityFightPropUpdateNotify;
import emu.grasscutter.server.packet.send.PacketItemAddHintNotify;
import emu.grasscutter.utils.Position;
public class PlayerCommands {
private static HashMap<String, PlayerCommand> list = new HashMap<>();
static {
try {
// Look for classes
for (Class<?> cls : PlayerCommands.class.getDeclaredClasses()) {
// Get non abstract classes
if (!Modifier.isAbstract(cls.getModifiers())) {
Command commandAnnotation = cls.getAnnotation(Command.class);
PlayerCommand command = (PlayerCommand) cls.newInstance();
if (commandAnnotation != null) {
command.setLevel(commandAnnotation.gmLevel());
for (String alias : commandAnnotation.aliases()) {
if (alias.length() == 0) {
continue;
}
String commandName = "!" + alias;
list.put(commandName, command);
commandName = "/" + alias;
list.put(commandName, command);
}
}
String commandName = "!" + cls.getSimpleName().toLowerCase();
list.put(commandName, command);
commandName = "/" + cls.getSimpleName().toLowerCase();
list.put(commandName, command);
}
}
} catch (Exception e) {
}
}
public static void handle(GenshinPlayer player, String msg) {
String[] split = msg.split(" ");
// End if invalid
if (split.length == 0) {
return;
}
//
String first = split[0].toLowerCase();
PlayerCommand c = PlayerCommands.list.get(first);
if (c != null) {
// Level check
if (player.getGmLevel() < c.getLevel()) {
return;
}
// Execute
int len = Math.min(first.length() + 1, msg.length());
c.execute(player, msg.substring(len));
}
}
public static abstract class PlayerCommand {
// GM level required to use this command
private int level;
protected int getLevel() { return this.level; }
protected void setLevel(int minLevel) { this.level = minLevel; }
// Main
public abstract void execute(GenshinPlayer player, String raw);
}
// ================ Commands ================
@Command(aliases = {"g", "item", "additem"}, helpText = "/give [item id] [count] - Gives {count} amount of {item id}")
public static class Give extends PlayerCommand {
@Override
public void execute(GenshinPlayer player, String raw) {
String[] split = raw.split(" ");
int itemId = 0, count = 1;
try {
itemId = Integer.parseInt(split[0]);
} catch (Exception e) {
itemId = 0;
}
try {
count = Math.max(Math.min(Integer.parseInt(split[1]), Integer.MAX_VALUE), 1);
} catch (Exception e) {
count = 1;
}
// Give
ItemData itemData = GenshinData.getItemDataMap().get(itemId);
GenshinItem item;
if (itemData == null) {
player.dropMessage("Error: Item data not found");
return;
}
if (itemData.isEquip()) {
List<GenshinItem> items = new LinkedList<>();
for (int i = 0; i < count; i++) {
item = new GenshinItem(itemData);
items.add(item);
}
player.getInventory().addItems(items);
player.sendPacket(new PacketItemAddHintNotify(items, ActionReason.SubfieldDrop));
} else {
item = new GenshinItem(itemData, count);
player.getInventory().addItem(item);
player.sendPacket(new PacketItemAddHintNotify(item, ActionReason.SubfieldDrop));
}
}
}
@Command(aliases = {"d"}, helpText = "/drop [item id] [count] - Drops {count} amount of {item id}")
public static class Drop extends PlayerCommand {
@Override
public void execute(GenshinPlayer player, String raw) {
String[] split = raw.split(" ");
int itemId = 0, count = 1;
try {
itemId = Integer.parseInt(split[0]);
} catch (Exception e) {
itemId = 0;
}
try {
count = Math.max(Math.min(Integer.parseInt(split[1]), Integer.MAX_VALUE), 1);
} catch (Exception e) {
count = 1;
}
// Give
ItemData itemData = GenshinData.getItemDataMap().get(itemId);
if (itemData == null) {
player.dropMessage("Error: Item data not found");
return;
}
if (itemData.isEquip()) {
float range = (5f + (.1f * count));
for (int i = 0; i < count; i++) {
Position pos = player.getPos().clone().addX((float) (Math.random() * range) - (range / 2)).addY(3f).addZ((float) (Math.random() * range) - (range / 2));
EntityItem entity = new EntityItem(player.getWorld(), player, itemData, pos, 1);
player.getWorld().addEntity(entity);
}
} else {
EntityItem entity = new EntityItem(player.getWorld(), player, itemData, player.getPos().clone().addY(3f), count);
player.getWorld().addEntity(entity);
}
}
}
@Command(helpText = "/spawn [monster id] [count] - Creates {count} amount of {item id}")
public static class Spawn extends PlayerCommand {
@Override
public void execute(GenshinPlayer player, String raw) {
String[] split = raw.split(" ");
int monsterId = 0, count = 1, level = 1;
try {
monsterId = Integer.parseInt(split[0]);
} catch (Exception e) {
monsterId = 0;
}
try {
level = Math.max(Math.min(Integer.parseInt(split[1]), 200), 1);
} catch (Exception e) {
level = 1;
}
try {
count = Math.max(Math.min(Integer.parseInt(split[2]), 1000), 1);
} catch (Exception e) {
count = 1;
}
// Give
MonsterData monsterData = GenshinData.getMonsterDataMap().get(monsterId);
if (monsterData == null) {
player.dropMessage("Error: Monster data not found");
return;
}
float range = (5f + (.1f * count));
for (int i = 0; i < count; i++) {
Position pos = player.getPos().clone().addX((float) (Math.random() * range) - (range / 2)).addY(3f).addZ((float) (Math.random() * range) - (range / 2));
EntityMonster entity = new EntityMonster(player.getWorld(), monsterData, pos, level);
player.getWorld().addEntity(entity);
}
}
}
@Command(helpText = "/killall")
public static class KillAll extends PlayerCommand {
@Override
public void execute(GenshinPlayer player, String raw) {
List<GenshinEntity> toRemove = new LinkedList<>();
for (GenshinEntity entity : player.getWorld().getEntities().values()) {
if (entity instanceof EntityMonster) {
toRemove.add(entity);
}
}
toRemove.forEach(e -> player.getWorld().killEntity(e, 0));
}
}
@Command(helpText = "/resetconst - Resets all constellations for the currently active character")
public static class ResetConst extends PlayerCommand {
@Override
public void execute(GenshinPlayer player, String raw) {
EntityAvatar entity = player.getTeamManager().getCurrentAvatarEntity();
if (entity == null) {
return;
}
GenshinAvatar avatar = entity.getAvatar();
avatar.getTalentIdList().clear();
avatar.setCoreProudSkillLevel(0);
avatar.recalcStats();
avatar.save();
player.dropMessage("Constellations for " + entity.getAvatar().getAvatarData().getName() + " have been reset. Please relogin to see changes.");
}
}
@Command(helpText = "/godmode - Prevents you from taking damage")
public static class Godmode extends PlayerCommand {
@Override
public void execute(GenshinPlayer player, String raw) {
player.setGodmode(!player.hasGodmode());
player.dropMessage("Godmode is now " + (player.hasGodmode() ? "ON" : "OFF"));
}
}
@Command(helpText = "/sethp [hp]")
public static class Sethp extends PlayerCommand {
@Override
public void execute(GenshinPlayer player, String raw) {
String[] split = raw.split(" ");
int hp = 0;
try {
hp = Math.max(Integer.parseInt(split[0]), 1);
} catch (Exception e) {
hp = 1;
}
EntityAvatar entity = player.getTeamManager().getCurrentAvatarEntity();
if (entity == null) {
return;
}
entity.setFightProperty(FightProperty.FIGHT_PROP_CUR_HP, hp);
entity.getWorld().broadcastPacket(new PacketEntityFightPropUpdateNotify(entity, FightProperty.FIGHT_PROP_CUR_HP));
}
}
@Command(aliases = {"clearart"}, helpText = "/clearartifacts")
public static class ClearArtifacts extends PlayerCommand {
@Override
public void execute(GenshinPlayer player, String raw) {
List<GenshinItem> toRemove = new LinkedList<>();
for (GenshinItem item : player.getInventory().getItems().values()) {
if (item.getItemType() == ItemType.ITEM_RELIQUARY && item.getLevel() == 1 && item.getExp() == 0 && !item.isLocked() && !item.isEquipped()) {
toRemove.add(item);
}
}
player.getInventory().removeItems(toRemove);
}
}
}
package emu.grasscutter.commands;
import java.lang.reflect.Modifier;
import java.util.Arrays;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.stream.Collectors;
import emu.grasscutter.Grasscutter;
import emu.grasscutter.data.GenshinData;
import emu.grasscutter.data.def.ItemData;
import emu.grasscutter.database.DatabaseHelper;
import emu.grasscutter.game.GenshinPlayer;
import emu.grasscutter.game.inventory.GenshinItem;
import emu.grasscutter.utils.Crypto;
import emu.grasscutter.utils.Utils;
public class ServerCommands {
private static HashMap<String, ServerCommand> list = new HashMap<>();
static {
try {
// Look for classes
for (Class<?> cls : ServerCommands.class.getDeclaredClasses()) {
// Get non abstract classes
if (!Modifier.isAbstract(cls.getModifiers())) {
String commandName = cls.getSimpleName().toLowerCase();
list.put(commandName, (ServerCommand) cls.newInstance());
}
}
} catch (Exception e) {
}
}
public static void handle(String msg) {
String[] split = msg.split(" ");
// End if invalid
if (split.length == 0) {
return;
}
//
String first = split[0].toLowerCase();
ServerCommand c = ServerCommands.list.get(first);
if (c != null) {
// Execute
int len = Math.min(first.length() + 1, msg.length());
c.execute(msg.substring(len));
}
}
public static abstract class ServerCommand {
public abstract void execute(String raw);
}
// ================ Commands ================
public static class Reload extends ServerCommand {
@Override
public void execute(String raw) {
Grasscutter.getLogger().info("Reloading config.");
Grasscutter.loadConfig();
Grasscutter.getDispatchServer().loadQueries();
Grasscutter.getLogger().info("Reload complete.");
}
}
public static class sendMsg extends ServerCommand {
@Override
public void execute(String raw) {
List<String> split = Arrays.asList(raw.split(" "));
if (split.size() < 2) {
Grasscutter.getLogger().error("Invalid amount of args");
return;
}
String playerID = split.get(0);
String message = split.stream().skip(1).collect(Collectors.joining(" "));
emu.grasscutter.game.Account account = DatabaseHelper.getAccountByPlayerId(Integer.parseInt(playerID));
if (account != null) {
GenshinPlayer player = Grasscutter.getGameServer().getPlayerById(Integer.parseInt(playerID));
if(player != null) {
player.dropMessage(message);
Grasscutter.getLogger().info(String.format("Successfully sent message to %s: %s", playerID, message));
} else {
Grasscutter.getLogger().error("Player not online");
}
} else {
Grasscutter.getLogger().error(String.format("Player %s does not exist", playerID));
}
}
}
public static class Account extends ServerCommand {
@Override
public void execute(String raw) {
String[] split = raw.split(" ");
if (split.length < 2) {
Grasscutter.getLogger().error("Invalid amount of args");
return;
}
String command = split[0].toLowerCase();
String username = split[1];
switch (command) {
case "create":
if (split.length < 2) {
Grasscutter.getLogger().error("Invalid amount of args");
return;
}
int reservedId = 0;
try {
reservedId = Integer.parseInt(split[2]);
} catch (Exception e) {
reservedId = 0;
}
emu.grasscutter.game.Account account = DatabaseHelper.createAccountWithId(username, reservedId);
if (account != null) {
Grasscutter.getLogger().info("Account created" + (reservedId > 0 ? " with an id of " + reservedId : ""));
} else {
Grasscutter.getLogger().error("Account already exists");
}
break;
case "delete":
boolean success = DatabaseHelper.deleteAccount(username);
if (success) {
Grasscutter.getLogger().info("Account deleted");
}
break;
/*
case "setpw":
case "setpass":
case "setpassword":
if (split.length < 3) {
Grasscutter.getLogger().error("Invalid amount of args");
return;
}
account = DatabaseHelper.getAccountByName(username);
if (account == null) {
Grasscutter.getLogger().error("No account found!");
return;
}
token = split[2];
token = PasswordHelper.hashPassword(token);
account.setPassword(token);
DatabaseHelper.saveAccount(account);
Grasscutter.getLogger().info("Password set");
break;
*/
}
}
}
}
package emu.grasscutter; package emu.grasscutter;
public final class Config { import java.util.ArrayList;
public String DispatchServerIp = "127.0.0.1";
public String DispatchServerPublicIp = "";
public int DispatchServerPort = 443;
public String DispatchServerKeystorePath = "./keystore.p12";
public String DispatchServerKeystorePassword = "";
public Boolean UseSSL = true;
public String GameServerName = "Test"; public final class Config {
public String GameServerIp = "127.0.0.1";
public String GameServerPublicIp = "";
public int GameServerPort = 22102;
public int UploadLogPort = 80;
public String DatabaseUrl = "mongodb://localhost:27017"; public String DatabaseUrl = "mongodb://localhost:27017";
public String DatabaseCollection = "grasscutter"; public String DatabaseCollection = "grasscutter";
...@@ -23,26 +12,52 @@ public final class Config { ...@@ -23,26 +12,52 @@ public final class Config {
public String PACKETS_FOLDER = "./packets/"; public String PACKETS_FOLDER = "./packets/";
public String DUMPS_FOLDER = "./dumps/"; public String DUMPS_FOLDER = "./dumps/";
public String KEY_FOLDER = "./keys/"; public String KEY_FOLDER = "./keys/";
public boolean LOG_PACKETS = false;
public GameRates Game = new GameRates(); public String RunMode = "HYBRID"; // HYBRID, DISPATCH_ONLY, GAME_ONLY
public ServerOptions ServerOptions = new ServerOptions(); public GameServerOptions GameServer = new GameServerOptions();
public DispatchServerOptions DispatchServer = new DispatchServerOptions();
public GameRates getGameRates() { public GameServerOptions getGameServerOptions() {
return Game; return GameServer;
} }
public ServerOptions getServerOptions() { public DispatchServerOptions getDispatchOptions() { return DispatchServer; }
return ServerOptions;
public static class DispatchServerOptions {
public String Ip = "0.0.0.0";
public String PublicIp = "127.0.0.1";
public int Port = 443;
public String KeystorePath = "./keystore.p12";
public String KeystorePassword = "";
public Boolean UseSSL = true;
public boolean AutomaticallyCreateAccounts = false;
public RegionInfo[] GameServers = {};
public RegionInfo[] getGameServers() {
return GameServers;
} }
public static class GameRates { public static class RegionInfo {
public float ADVENTURE_EXP_RATE = 1.0f; public String Name = "os_usa";
public float MORA_RATE = 1.0f; public String Title = "Test";
public float DOMAIN_DROP_RATE = 1.0f; public String Ip = "127.0.0.1";
public int Port = 22102;
} }
}
public static class GameServerOptions {
public String Name = "Test";
public String Ip = "0.0.0.0";
public String PublicIp = "127.0.0.1";
public int Port = 22102;
public String DispatchServerDatabaseUrl = "mongodb://localhost:27017";
public String DispatchServerDatabaseCollection = "grasscutter";
public boolean LOG_PACKETS = false;
public static class ServerOptions {
public int InventoryLimitWeapon = 2000; public int InventoryLimitWeapon = 2000;
public int InventoryLimitRelic = 2000; public int InventoryLimitRelic = 2000;
public int InventoryLimitMaterial = 2000; public int InventoryLimitMaterial = 2000;
...@@ -51,7 +66,18 @@ public final class Config { ...@@ -51,7 +66,18 @@ public final class Config {
public int MaxAvatarsInTeam = 4; public int MaxAvatarsInTeam = 4;
public int MaxAvatarsInTeamMultiplayer = 4; public int MaxAvatarsInTeamMultiplayer = 4;
public int MaxEntityLimit = 1000; // Max entity limit per world. // TODO: Enforce later. public int MaxEntityLimit = 1000; // Max entity limit per world. // TODO: Enforce later.
public boolean WatchGacha = false;
public int[] WelcomeEmotes = {2007, 1002, 4010}; public int[] WelcomeEmotes = {2007, 1002, 4010};
public String WelcomeMotd = "Welcome to Grasscutter emu"; public String WelcomeMotd = "Welcome to Grasscutter emu";
public GameRates Game = new GameRates();
public GameRates getGameRates() { return Game; }
public static class GameRates {
public float ADVENTURE_EXP_RATE = 1.0f;
public float MORA_RATE = 1.0f;
public float DOMAIN_DROP_RATE = 1.0f;
}
} }
} }
...@@ -7,7 +7,7 @@ import java.io.FileWriter; ...@@ -7,7 +7,7 @@ import java.io.FileWriter;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.net.InetSocketAddress; import java.net.InetSocketAddress;
import emu.grasscutter.commands.CommandMap; import emu.grasscutter.command.CommandMap;
import emu.grasscutter.utils.Utils; import emu.grasscutter.utils.Utils;
import org.reflections.Reflections; import org.reflections.Reflections;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
...@@ -73,11 +73,26 @@ public final class Grasscutter { ...@@ -73,11 +73,26 @@ public final class Grasscutter {
DatabaseManager.initialize(); DatabaseManager.initialize();
// Start servers. // Start servers.
if(getConfig().RunMode.equalsIgnoreCase("HYBRID")) {
dispatchServer = new DispatchServer(); dispatchServer = new DispatchServer();
dispatchServer.start(); dispatchServer.start();
gameServer = new GameServer(new InetSocketAddress(getConfig().GameServerIp, getConfig().GameServerPort)); gameServer = new GameServer(new InetSocketAddress(getConfig().getGameServerOptions().Ip, getConfig().getGameServerOptions().Port));
gameServer.start(); gameServer.start();
} else if(getConfig().RunMode.equalsIgnoreCase("DISPATCH_ONLY")) {
dispatchServer = new DispatchServer();
dispatchServer.start();
} else if(getConfig().RunMode.equalsIgnoreCase("GAME_ONLY")) {
gameServer = new GameServer(new InetSocketAddress(getConfig().getGameServerOptions().Ip, getConfig().getGameServerOptions().Port));
gameServer.start();
} else {
getLogger().error("Invalid server run mode. " + getConfig().RunMode);
getLogger().error("Server run mode must be 'HYBRID', 'DISPATCH_ONLY', or 'GAME_ONLY'. Unable to start Grasscutter...");
getLogger().error("Shutting down...");
System.exit(1);
}
// Open console. // Open console.
startConsole(); startConsole();
...@@ -86,8 +101,10 @@ public final class Grasscutter { ...@@ -86,8 +101,10 @@ public final class Grasscutter {
public static void loadConfig() { public static void loadConfig() {
try (FileReader file = new FileReader(configFile)) { try (FileReader file = new FileReader(configFile)) {
config = gson.fromJson(file, Config.class); config = gson.fromJson(file, Config.class);
saveConfig();
} catch (Exception e) { } catch (Exception e) {
Grasscutter.config = new Config(); saveConfig(); Grasscutter.config = new Config();
saveConfig();
} }
} }
...@@ -104,9 +121,14 @@ public final class Grasscutter { ...@@ -104,9 +121,14 @@ public final class Grasscutter {
try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) { try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
while ((input = br.readLine()) != null) { while ((input = br.readLine()) != null) {
try { try {
if(getConfig().RunMode.equalsIgnoreCase("DISPATCH_ONLY")) {
getLogger().error("Commands are not supported in dispatch only mode");
return;
}
CommandMap.getInstance().invoke(null, input); CommandMap.getInstance().invoke(null, input);
} catch (Exception e) { } catch (Exception e) {
Grasscutter.getLogger().error("Command error: " + e.getMessage()); Grasscutter.getLogger().error("Command error: ");
e.printStackTrace();
} }
} }
} catch (Exception e) { } catch (Exception e) {
......
package emu.grasscutter.command;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@Retention(RetentionPolicy.RUNTIME)
public @interface Command {
String label() default "";
String usage() default "No usage specified";
String description() default "No description specified";
String[] aliases() default {};
String permission() default "";
}
package emu.grasscutter.commands; package emu.grasscutter.command;
import emu.grasscutter.Grasscutter; import emu.grasscutter.Grasscutter;
import emu.grasscutter.game.GenshinPlayer; import emu.grasscutter.game.GenshinPlayer;
...@@ -6,23 +6,25 @@ import emu.grasscutter.game.GenshinPlayer; ...@@ -6,23 +6,25 @@ import emu.grasscutter.game.GenshinPlayer;
import java.util.List; import java.util.List;
public interface CommandHandler { public interface CommandHandler {
/* Invoked on player execution. */
default void execute(GenshinPlayer player, List<String> args) { }
/* Invoked on server execution. */
default void execute(List<String> args) { }
/*
* Utilities.
*/
/** /**
* Send a message to the target. * Send a message to the target.
*
* @param player The player to send the message to, or null for the server console. * @param player The player to send the message to, or null for the server console.
* @param message The message to send. * @param message The message to send.
*/ */
static void sendMessage(GenshinPlayer player, String message) { static void sendMessage(GenshinPlayer player, String message) {
if(player == null) { if (player == null) {
Grasscutter.getLogger().info(message); Grasscutter.getLogger().info(message);
} else player.dropMessage(message); } else {
player.dropMessage(message);
}
}
/**
* Called when a player/console invokes a command.
* @param sender The player/console that invoked the command.
* @param args The arguments to the command.
*/
default void execute(GenshinPlayer sender, List<String> args) {
} }
} }
package emu.grasscutter.commands; package emu.grasscutter.command;
import emu.grasscutter.Grasscutter; import emu.grasscutter.Grasscutter;
import emu.grasscutter.game.Account; import emu.grasscutter.game.Account;
...@@ -7,17 +7,25 @@ import org.reflections.Reflections; ...@@ -7,17 +7,25 @@ import org.reflections.Reflections;
import java.util.*; import java.util.*;
@SuppressWarnings("UnusedReturnValue") @SuppressWarnings({"UnusedReturnValue", "unused"})
public final class CommandMap { public final class CommandMap {
private final Map<String, CommandHandler> commands = new HashMap<>();
private final Map<String, Command> annotations = new HashMap<>();
public CommandMap() {
this(false);
}
public CommandMap(boolean scan) {
if (scan) this.scan();
}
public static CommandMap getInstance() { public static CommandMap getInstance() {
return Grasscutter.getGameServer().getCommandMap(); return Grasscutter.getGameServer().getCommandMap();
} }
private final Map<String, CommandHandler> commands = new HashMap<>();
private final Map<String, Command> annotations = new HashMap<>();
/** /**
* Register a command handler. * Register a command handler.
*
* @param label The command label. * @param label The command label.
* @param command The command handler. * @param command The command handler.
* @return Instance chaining. * @return Instance chaining.
...@@ -31,30 +39,32 @@ public final class CommandMap { ...@@ -31,30 +39,32 @@ public final class CommandMap {
this.commands.put(label, command); this.commands.put(label, command);
// Register aliases. // Register aliases.
if(annotation.aliases().length > 0) { if (annotation.aliases().length > 0) {
for (String alias : annotation.aliases()) { for (String alias : annotation.aliases()) {
this.commands.put(alias, command); this.commands.put(alias, command);
this.annotations.put(alias, annotation); this.annotations.put(alias, annotation);
} }
} return this; }
return this;
} }
/** /**
* Removes a registered command handler. * Removes a registered command handler.
*
* @param label The command label. * @param label The command label.
* @return Instance chaining. * @return Instance chaining.
*/ */
public CommandMap unregisterCommand(String label) { public CommandMap unregisterCommand(String label) {
Grasscutter.getLogger().debug("Unregistered command: " + label); Grasscutter.getLogger().debug("Unregistered command: " + label);
CommandHandler handler = this.commands.get(label); CommandHandler handler = this.commands.get(label);
if(handler == null) return this; if (handler == null) return this;
Command annotation = handler.getClass().getAnnotation(Command.class); Command annotation = handler.getClass().getAnnotation(Command.class);
this.annotations.remove(label); this.annotations.remove(label);
this.commands.remove(label); this.commands.remove(label);
// Unregister aliases. // Unregister aliases.
if(annotation.aliases().length > 0) { if (annotation.aliases().length > 0) {
for (String alias : annotation.aliases()) { for (String alias : annotation.aliases()) {
this.commands.remove(alias); this.commands.remove(alias);
this.annotations.remove(alias); this.annotations.remove(alias);
...@@ -66,14 +76,20 @@ public final class CommandMap { ...@@ -66,14 +76,20 @@ public final class CommandMap {
/** /**
* Returns a list of all registered commands. * Returns a list of all registered commands.
*
* @return All command handlers as a list. * @return All command handlers as a list.
*/ */
public List<CommandHandler> getHandlers() { public List<CommandHandler> getHandlersAsList() {
return new LinkedList<>(this.commands.values()); return new LinkedList<>(this.commands.values());
} }
public HashMap<String, CommandHandler> getHandlers() {
return new LinkedHashMap<>(this.commands);
}
/** /**
* Returns a handler by label/alias. * Returns a handler by label/alias.
*
* @param label The command label. * @param label The command label.
* @return The command handler. * @return The command handler.
*/ */
...@@ -83,17 +99,18 @@ public final class CommandMap { ...@@ -83,17 +99,18 @@ public final class CommandMap {
/** /**
* Invoke a command handler with the given arguments. * Invoke a command handler with the given arguments.
*
* @param player The player invoking the command or null for the server console. * @param player The player invoking the command or null for the server console.
* @param rawMessage The messaged used to invoke the command. * @param rawMessage The messaged used to invoke the command.
*/ */
public void invoke(GenshinPlayer player, String rawMessage) { public void invoke(GenshinPlayer player, String rawMessage) {
rawMessage = rawMessage.trim(); rawMessage = rawMessage.trim();
if(rawMessage.length() == 0) { if(rawMessage.length() == 0) {
CommandHandler.sendMessage(player, "No command specified."); CommandHandler.sendMessage(player, "No command specified."); return;
} }
// Remove prefix if present. // Remove prefix if present.
if(!Character.isLetter(rawMessage.charAt(0))) if (!Character.isLetter(rawMessage.charAt(0)))
rawMessage = rawMessage.substring(1); rawMessage = rawMessage.substring(1);
// Parse message. // Parse message.
...@@ -103,39 +120,23 @@ public final class CommandMap { ...@@ -103,39 +120,23 @@ public final class CommandMap {
// Get command handler. // Get command handler.
CommandHandler handler = this.commands.get(label); CommandHandler handler = this.commands.get(label);
if(handler == null) { if (handler == null) {
CommandHandler.sendMessage(player, "Unknown command: " + label); return; CommandHandler.sendMessage(player, "Unknown command: " + label);
return;
} }
// Check for permission. // Check for permission.
if(player != null) { if (player != null) {
String permissionNode = this.annotations.get(label).permission(); String permissionNode = this.annotations.get(label).permission();
Account account = player.getAccount(); Account account = player.getAccount();
List<String> permissions = account.getPermissions(); if(!permissionNode.isEmpty() && !account.hasPermission(permissionNode)) {
if(!permissions.contains("*") && !permissions.contains(permissionNode)) { CommandHandler.sendMessage(player, "You do not have permission to run this command.");
CommandHandler.sendMessage(player, "You do not have permission to run this command."); return; return;
} }
} }
// Execution power check.
Command.Execution executionPower = this.annotations.get(label).execution();
if(player == null && executionPower == Command.Execution.PLAYER) {
CommandHandler.sendMessage(null, "Run this command in-game."); return;
} else if (player != null && executionPower == Command.Execution.CONSOLE) {
CommandHandler.sendMessage(player, "This command can only be run from the console."); return;
}
// Invoke execute method for handler. // Invoke execute method for handler.
if(player == null) handler.execute(args); handler.execute(player, args);
else handler.execute(player, args);
}
public CommandMap() {
this(false);
}
public CommandMap(boolean scan) {
if(scan) this.scan();
} }
/** /**
......
package emu.grasscutter.command.commands;
import emu.grasscutter.command.Command;
import emu.grasscutter.command.CommandHandler;
import emu.grasscutter.database.DatabaseHelper;
import emu.grasscutter.game.GenshinPlayer;
import java.util.List;
@Command(label = "account", usage = "account <create|delete> <username> [uid]",
description = "Modify user accounts")
public final class AccountCommand implements CommandHandler {
@Override
public void execute(GenshinPlayer sender, List<String> args) {
if (sender != null) {
CommandHandler.sendMessage(sender, "This command can only be run from the console.");
return;
}
if (args.size() < 2) {
CommandHandler.sendMessage(null, "Usage: account <create|delete> <username> [uid]");
return;
}
String action = args.get(0);
String username = args.get(1);
switch (action) {
default:
CommandHandler.sendMessage(null, "Usage: account <create|delete> <username> [uid]");
return;
case "create":
int uid = 0;
if (args.size() > 2) {
try {
uid = Integer.parseInt(args.get(2));
} catch (NumberFormatException ignored) {
CommandHandler.sendMessage(null, "Invalid UID.");
return;
}
}
emu.grasscutter.game.Account account = DatabaseHelper.createAccountWithId(username, uid);
if (account == null) {
CommandHandler.sendMessage(null, "Account already exists.");
return;
} else {
CommandHandler.sendMessage(null, "Account created with UID " + account.getPlayerUid() + ".");
account.addPermission("*"); // Grant the player superuser permissions.
account.save(); // Save account to database.
}
return;
case "delete":
if (DatabaseHelper.deleteAccount(username)) {
CommandHandler.sendMessage(null, "Account deleted.");
} else {
CommandHandler.sendMessage(null, "Account not found.");
}
}
}
}
package emu.grasscutter.command.commands;
import emu.grasscutter.Grasscutter;
import emu.grasscutter.command.Command;
import emu.grasscutter.command.CommandHandler;
import emu.grasscutter.game.GenshinPlayer;
import java.util.List;
@Command(label = "broadcast", usage = "broadcast <message>",
description = "Sends a message to all the players", aliases = {"b"}, permission = "server.broadcast")
public final class BroadcastCommand implements CommandHandler {
@Override
public void execute(GenshinPlayer sender, List<String> args) {
if (args.size() < 1) {
CommandHandler.sendMessage(sender, "Usage: broadcast <message>");
return;
}
String message = String.join(" ", args.subList(0, args.size()));
for (GenshinPlayer p : Grasscutter.getGameServer().getPlayers().values()) {
CommandHandler.sendMessage(p, message);
}
CommandHandler.sendMessage(sender, "Message sent.");
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment