Merge branch 'main' into main

This commit is contained in:
Magix 2022-04-19 14:07:39 -04:00 committed by GitHub
commit 71cdd2c8e9
10 changed files with 63 additions and 85 deletions

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "Grasscutter-Protos"]
path = Grasscutter-Protos
url = https://github.com/Melledy/Grasscutter-Protos

1
Grasscutter-Protos Submodule

@ -0,0 +1 @@
Subproject commit 0537e9cc4c7856a7c6f88bbbaa908a80c4ee677e

View File

@ -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_A079_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_A080_TITLE",
"costItem": 223, "costItem": 223,
"beginTime": 0, "beginTime": 0,
"endTime": 1924992000, "endTime": 1924992000,
@ -58,7 +43,7 @@
"eventChance": 75, "eventChance": 75,
"softPity": 80, "softPity": 80,
"hardPity": 80, "hardPity": 80,
"rateUpItems1": [11510, 15503], "rateUpItems1": [11509, 12504],
"rateUpItems2": [11402, 12403, 13401, 14402, 15405] "rateUpItems2": [11401, 12402, 13407, 14401, 15401]
} }
] ]

View File

@ -20,7 +20,7 @@
# #
## ##
from mitmproxy import ctx, http from mitmproxy import http
class MlgmXyysd_Genshin_Impact_Proxy: class MlgmXyysd_Genshin_Impact_Proxy:
@ -53,14 +53,11 @@ 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"
] ]
if flow.request.url.startswith("http://overseauspider.yuanshen.com:8888/log"): if flow.request.host in LIST_DOMAINS:
ctx.log.info("Block overseauspider.yuanshen.com")
flow.response = http.HTTPResponse.make(404)
elif flow.request.host in LIST_DOMAINS:
ctx.log.info("Redirect " + flow.request.host)
flow.request.host = REMOTE_HOST flow.request.host = REMOTE_HOST
addons = [ addons = [

View File

@ -1,7 +0,0 @@
@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

View File

@ -189,35 +189,26 @@ public final class PlayerCommands {
description = "Gives the player a specified character", permission = "player.givechar") description = "Gives the player a specified character", permission = "player.givechar")
public static class GiveCharCommand implements CommandHandler { public static class GiveCharCommand implements CommandHandler {
@Override public void execute(GenshinPlayer player, List<String> args) { @Override public void execute(GenshinPlayer player, List<String> args) {
int target, avatarID, level = 1, ascension = 1; int target, avatarId, level = 1, ascension = 1;
if(args.size() < 2) { if(args.size() < 1) {
CommandHandler.sendMessage(null, "Usage: givechar <player> <avatarId> [level]"); CommandHandler.sendMessage(player, "Usage: givechar <player> <avatarId> [level]");
return; return;
} }
switch(args.size()) { switch(args.size()) {
default: default:
CommandHandler.sendMessage(null, "Usage: givechar <player> <avatarId> [level]"); CommandHandler.sendMessage(player, "Usage: givechar <player> <avatarId> [level]");
return; return;
case 1:
try {
avatarID = Integer.parseInt(args.get(0));
target = player.getAccount().getPlayerId();
} catch (NumberFormatException ignored) {
// TODO: Parse from avatar name using GM Handbook.
CommandHandler.sendMessage(player, "Invalid avatar id.");
return;
}
break;
case 2: case 2:
try { try {
target = Integer.parseInt(args.get(0)); target = Integer.parseInt(args.get(0));
if(Grasscutter.getGameServer().getPlayerByUid(target) == null) { if(Grasscutter.getGameServer().getPlayerByUid(target) == null) {
target = player.getUid(); level = Integer.parseInt(args.get(1)); target = player.getUid();
avatarID = Integer.parseInt(args.get(0)); level = Integer.parseInt(args.get(1));
avatarId = Integer.parseInt(args.get(0));
} else { } else {
avatarID = Integer.parseInt(args.get(1)); avatarId = Integer.parseInt(args.get(1));
} }
} catch (NumberFormatException ignored) { } catch (NumberFormatException ignored) {
// TODO: Parse from avatar name using GM Handbook. // TODO: Parse from avatar name using GM Handbook.
@ -232,7 +223,7 @@ public final class PlayerCommands {
CommandHandler.sendMessage(player, "Invalid player ID."); return; CommandHandler.sendMessage(player, "Invalid player ID."); return;
} }
avatarID = Integer.parseInt(args.get(1)); avatarId = Integer.parseInt(args.get(1));
level = Integer.parseInt(args.get(2)); level = Integer.parseInt(args.get(2));
} catch (NumberFormatException ignored) { } catch (NumberFormatException ignored) {
// TODO: Parse from avatar name using GM Handbook. // TODO: Parse from avatar name using GM Handbook.
@ -244,22 +235,22 @@ public final class PlayerCommands {
GenshinPlayer targetPlayer = Grasscutter.getGameServer().getPlayerByUid(target); GenshinPlayer targetPlayer = Grasscutter.getGameServer().getPlayerByUid(target);
if(targetPlayer == null) { if(targetPlayer == null) {
CommandHandler.sendMessage(null, "Player not found."); return; CommandHandler.sendMessage(player, "Player not found."); return;
} }
AvatarData avatarData = GenshinData.getAvatarDataMap().get(avatarID); AvatarData avatarData = GenshinData.getAvatarDataMap().get(avatarId);
if(avatarData == null) { if(avatarData == null) {
CommandHandler.sendMessage(null, "Invalid avatar id."); return; CommandHandler.sendMessage(player, "Invalid avatar id."); return;
} }
// Calculate ascension level. // Calculate ascension level.
if (level <= 40) { if (level <= 40) {
ascension = (int)Math.ceil(level / 20); ascension = (int) Math.ceil(level / 20f);
} else if (level > 20) { } else {
ascension = (int)Math.ceil(level / 10) - 3; ascension = (int) Math.ceil(level / 10f) - 3;
} }
GenshinAvatar avatar = new GenshinAvatar(avatarID); GenshinAvatar avatar = new GenshinAvatar(avatarId);
avatar.setLevel(level); avatar.setLevel(level);
avatar.setPromoteLevel(ascension); avatar.setPromoteLevel(ascension);
@ -280,7 +271,7 @@ public final class PlayerCommands {
int target = Integer.parseInt(args.get(0)); int target = Integer.parseInt(args.get(0));
int avatarID = Integer.parseInt(args.get(1)); int avatarID = Integer.parseInt(args.get(1));
int level = 1; if(args.size() > 2) level = Integer.parseInt(args.get(2)); int level = 1; if(args.size() > 2) level = Integer.parseInt(args.get(2));
int ascension = 1; int ascension;
GenshinPlayer targetPlayer = Grasscutter.getGameServer().getPlayerByUid(target); GenshinPlayer targetPlayer = Grasscutter.getGameServer().getPlayerByUid(target);
if(targetPlayer == null) { if(targetPlayer == null) {
@ -294,9 +285,9 @@ public final class PlayerCommands {
// Calculate ascension level. // Calculate ascension level.
if (level <= 40) { if (level <= 40) {
ascension = (int)Math.ceil(level / 20); ascension = (int) Math.ceil(level / 20f);
} else if (level > 20) { } else {
ascension = (int)Math.ceil(level / 10) - 3; ascension = (int) Math.ceil(level / 10f) - 3;
} }
GenshinAvatar avatar = new GenshinAvatar(avatarID); GenshinAvatar avatar = new GenshinAvatar(avatarID);
@ -465,7 +456,7 @@ public final class PlayerCommands {
@Override @Override
public void execute(GenshinPlayer player, List<String> args) { public void execute(GenshinPlayer player, List<String> args) {
if(args.size() < 1) { if(args.size() < 1) {
CommandHandler.sendMessage(null, "Usage: setworldlevel <level>"); return; CommandHandler.sendMessage(player, "Usage: setworldlevel <level>"); return;
} }
try { try {
@ -503,21 +494,18 @@ public final class PlayerCommands {
@Override @Override
public void execute(GenshinPlayer player, List<String> args) { public void execute(GenshinPlayer player, List<String> args) {
if(args.size() < 1) { if(args.size() < 1) {
CommandHandler.sendMessage(null, "Usage: changescene <scene id>"); return; CommandHandler.sendMessage(player, "Usage: changescene <scene id>"); return;
} }
int sceneId = 0;
try { try {
sceneId = Integer.parseInt(args.get(0)); int sceneId = Integer.parseInt(args.get(0));
boolean result = player.getWorld().transferPlayerToScene(player, sceneId, player.getPos());
if (!result) {
CommandHandler.sendMessage(null, "Scene does not exist or you are already in it");
}
} catch (Exception e) { } catch (Exception e) {
return; CommandHandler.sendMessage(player, "Usage: changescene <scene id>"); return;
}
boolean result = player.getWorld().transferPlayerToScene(player, sceneId, player.getPos());
if (!result) {
CommandHandler.sendMessage(null, "Scene does not exist or you are already in it");
} }
} }
} }

View File

@ -197,7 +197,7 @@ public class ResourceLoader {
} else { } else {
Map<String, OpenConfigEntry> map = new TreeMap<>(); Map<String, OpenConfigEntry> map = new TreeMap<>();
java.lang.reflect.Type type = new TypeToken<Map<String, OpenConfigData[]>>() {}.getType(); java.lang.reflect.Type type = new TypeToken<Map<String, OpenConfigData[]>>() {}.getType();
String[] folderNames = {"BinOutput\\Talent\\EquipTalents\\", "BinOutput\\Talent\\AvatarTalents\\"}; String[] folderNames = {"BinOutput/Talent/EquipTalents/", "BinOutput/Talent/AvatarTalents/"};
for (String name : folderNames) { for (String name : folderNames) {
File folder = new File(Utils.toFilePath(Grasscutter.getConfig().RESOURCE_FOLDER + name)); File folder = new File(Utils.toFilePath(Grasscutter.getConfig().RESOURCE_FOLDER + name));

View File

@ -471,7 +471,7 @@ public class InventoryManager {
} }
// Consume weapon // Consume weapon
player.getInventory().removeItem(feed); player.getInventory().removeItem(feed, 1);
// Get // Get
weapon.setRefinement(targetRefineLevel); weapon.setRefinement(targetRefineLevel);
@ -804,6 +804,12 @@ public class InventoryManager {
// Get talent // Get talent
int currentTalentLevel = avatar.getCoreProudSkillLevel(); int currentTalentLevel = avatar.getCoreProudSkillLevel();
int nextTalentId = ((avatar.getAvatarId() % 10000000) * 10) + currentTalentLevel + 1; int nextTalentId = ((avatar.getAvatarId() % 10000000) * 10) + currentTalentLevel + 1;
if (avatar.getAvatarId() == 10000006) {
// Lisa is special in that her talentId starts with 4 instead of 6.
nextTalentId = 40 + currentTalentLevel + 1;
}
AvatarTalentData talentData = GenshinData.getAvatarTalentDataMap().get(nextTalentId); AvatarTalentData talentData = GenshinData.getAvatarTalentDataMap().get(nextTalentId);
if (talentData == null) { if (talentData == null) {

View File

@ -389,6 +389,10 @@ public final class DispatchServer {
"/sdk/upload", "/sdk/upload",
new DispatchHttpJsonHandler("{\"code\":0}") new DispatchHttpJsonHandler("{\"code\":0}")
); );
server.createContext( // /perf/config/verify?device_id=xxx&platform=x&name=xxx
"/perf/config/verify",
new DispatchHttpJsonHandler("{\"code\":0}")
);
// Start server // Start server
server.start(); server.start();
Grasscutter.getLogger().info("Dispatch server started on port " + getAddress().getPort()); Grasscutter.getLogger().info("Dispatch server started on port " + getAddress().getPort());

View File

@ -59,6 +59,7 @@ public class PacketPlayerEnterSceneNotify extends GenshinPacket {
.setEnterReason(reason.getValue()) .setEnterReason(reason.getValue())
.addSceneTagIdList(102) .addSceneTagIdList(102)
.addSceneTagIdList(107) .addSceneTagIdList(107)
.addSceneTagIdList(109)
.addSceneTagIdList(113) .addSceneTagIdList(113)
.addSceneTagIdList(117) .addSceneTagIdList(117)
.setUnk1(1) .setUnk1(1)