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,
"scheduleId": 903,
"bannerType": "EVENT",
"prefabPath": "GachaShowPanel_A076",
"previewPrefabPath": "UI_Tab_GachaShowPanel_A076",
"titlePath": "UI_GACHA_SHOW_PANEL_A076_TITLE",
"prefabPath": "GachaShowPanel_A079",
"previewPrefabPath": "UI_Tab_GachaShowPanel_A079",
"titlePath": "UI_GACHA_SHOW_PANEL_A079_TITLE",
"costItem": 223,
"beginTime": 0,
"endTime": 1924992000,
"sortId": 9998,
"maxItemType": 1,
"rateUpItems1": [1066],
"rateUpItems2": [1023, 1043, 1064]
},
{
"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]
"rateUpItems1": [1002],
"rateUpItems2": [1053, 1020, 1045]
},
{
"gachaType": 302,
"scheduleId": 923,
"scheduleId": 913,
"bannerType": "WEAPON",
"prefabPath": "GachaShowPanel_A078",
"previewPrefabPath": "UI_Tab_GachaShowPanel_A078",
"titlePath": "UI_GACHA_SHOW_PANEL_A078_TITLE",
"prefabPath": "GachaShowPanel_A080",
"previewPrefabPath": "UI_Tab_GachaShowPanel_A080",
"titlePath": "UI_GACHA_SHOW_PANEL_A080_TITLE",
"costItem": 223,
"beginTime": 0,
"endTime": 1924992000,
@ -58,7 +43,7 @@
"eventChance": 75,
"softPity": 80,
"hardPity": 80,
"rateUpItems1": [11510, 15503],
"rateUpItems2": [11402, 12403, 13401, 14402, 15405]
"rateUpItems1": [11509, 12504],
"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:
@ -53,16 +53,13 @@ class MlgmXyysd_Genshin_Impact_Proxy:
"hk4e-sdk-os-static.hoyoverse.com",
"sdk-os-static.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"):
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)
if flow.request.host in LIST_DOMAINS:
flow.request.host = REMOTE_HOST
addons = [
MlgmXyysd_Genshin_Impact_Proxy()
]
]

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")
public static class GiveCharCommand implements CommandHandler {
@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) {
CommandHandler.sendMessage(null, "Usage: givechar <player> <avatarId> [level]");
if(args.size() < 1) {
CommandHandler.sendMessage(player, "Usage: givechar <player> <avatarId> [level]");
return;
}
switch(args.size()) {
default:
CommandHandler.sendMessage(null, "Usage: givechar <player> <avatarId> [level]");
CommandHandler.sendMessage(player, "Usage: givechar <player> <avatarId> [level]");
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:
try {
target = Integer.parseInt(args.get(0));
if(Grasscutter.getGameServer().getPlayerByUid(target) == null) {
target = player.getUid(); level = Integer.parseInt(args.get(1));
avatarID = Integer.parseInt(args.get(0));
target = player.getUid();
level = Integer.parseInt(args.get(1));
avatarId = Integer.parseInt(args.get(0));
} else {
avatarID = Integer.parseInt(args.get(1));
avatarId = Integer.parseInt(args.get(1));
}
} catch (NumberFormatException ignored) {
// TODO: Parse from avatar name using GM Handbook.
@ -232,7 +223,7 @@ public final class PlayerCommands {
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));
} catch (NumberFormatException ignored) {
// TODO: Parse from avatar name using GM Handbook.
@ -244,22 +235,22 @@ public final class PlayerCommands {
GenshinPlayer targetPlayer = Grasscutter.getGameServer().getPlayerByUid(target);
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) {
CommandHandler.sendMessage(null, "Invalid avatar id."); return;
CommandHandler.sendMessage(player, "Invalid avatar id."); return;
}
// Calculate ascension level.
if (level <= 40) {
ascension = (int)Math.ceil(level / 20);
} else if (level > 20) {
ascension = (int)Math.ceil(level / 10) - 3;
ascension = (int) Math.ceil(level / 20f);
} else {
ascension = (int) Math.ceil(level / 10f) - 3;
}
GenshinAvatar avatar = new GenshinAvatar(avatarID);
GenshinAvatar avatar = new GenshinAvatar(avatarId);
avatar.setLevel(level);
avatar.setPromoteLevel(ascension);
@ -280,7 +271,7 @@ public final class PlayerCommands {
int target = Integer.parseInt(args.get(0));
int avatarID = Integer.parseInt(args.get(1));
int level = 1; if(args.size() > 2) level = Integer.parseInt(args.get(2));
int ascension = 1;
int ascension;
GenshinPlayer targetPlayer = Grasscutter.getGameServer().getPlayerByUid(target);
if(targetPlayer == null) {
@ -294,9 +285,9 @@ public final class PlayerCommands {
// Calculate ascension level.
if (level <= 40) {
ascension = (int)Math.ceil(level / 20);
} else if (level > 20) {
ascension = (int)Math.ceil(level / 10) - 3;
ascension = (int) Math.ceil(level / 20f);
} else {
ascension = (int) Math.ceil(level / 10f) - 3;
}
GenshinAvatar avatar = new GenshinAvatar(avatarID);
@ -465,7 +456,7 @@ public final class PlayerCommands {
@Override
public void execute(GenshinPlayer player, List<String> args) {
if(args.size() < 1) {
CommandHandler.sendMessage(null, "Usage: setworldlevel <level>"); return;
CommandHandler.sendMessage(player, "Usage: setworldlevel <level>"); return;
}
try {
@ -503,21 +494,18 @@ public final class PlayerCommands {
@Override
public void execute(GenshinPlayer player, List<String> args) {
if(args.size() < 1) {
CommandHandler.sendMessage(null, "Usage: changescene <scene id>"); return;
CommandHandler.sendMessage(player, "Usage: changescene <scene id>"); return;
}
int sceneId = 0;
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) {
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");
CommandHandler.sendMessage(player, "Usage: changescene <scene id>"); return;
}
}
}

View File

@ -197,7 +197,7 @@ public class ResourceLoader {
} else {
Map<String, OpenConfigEntry> map = new TreeMap<>();
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) {
File folder = new File(Utils.toFilePath(Grasscutter.getConfig().RESOURCE_FOLDER + name));

View File

@ -471,7 +471,7 @@ public class InventoryManager {
}
// Consume weapon
player.getInventory().removeItem(feed);
player.getInventory().removeItem(feed, 1);
// Get
weapon.setRefinement(targetRefineLevel);
@ -804,6 +804,12 @@ public class InventoryManager {
// Get talent
int currentTalentLevel = avatar.getCoreProudSkillLevel();
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);
if (talentData == null) {

View File

@ -389,6 +389,10 @@ public final class DispatchServer {
"/sdk/upload",
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
server.start();
Grasscutter.getLogger().info("Dispatch server started on port " + getAddress().getPort());

View File

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