diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 000000000..fbab9b375 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "Grasscutter-Protos"] + path = Grasscutter-Protos + url = https://github.com/Melledy/Grasscutter-Protos diff --git a/Grasscutter-Protos b/Grasscutter-Protos new file mode 160000 index 000000000..0537e9cc4 --- /dev/null +++ b/Grasscutter-Protos @@ -0,0 +1 @@ +Subproject commit 0537e9cc4c7856a7c6f88bbbaa908a80c4ee677e diff --git a/data/Banners.json b/data/Banners.json index 163319f5e..959a8b436 100644 --- a/data/Banners.json +++ b/data/Banners.json @@ -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] } -] \ No newline at end of file +] diff --git a/proxy.py b/proxy.py index 1961c90dc..b352af3ac 100644 --- a/proxy.py +++ b/proxy.py @@ -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() -] \ No newline at end of file +] diff --git a/run.bat b/run.bat deleted file mode 100644 index 36530cf77..000000000 --- a/run.bat +++ /dev/null @@ -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 \ No newline at end of file diff --git a/src/main/java/emu/grasscutter/commands/PlayerCommands.java b/src/main/java/emu/grasscutter/commands/PlayerCommands.java index 795c91f77..779e91ef9 100644 --- a/src/main/java/emu/grasscutter/commands/PlayerCommands.java +++ b/src/main/java/emu/grasscutter/commands/PlayerCommands.java @@ -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 args) { - int target, avatarID, level = 1, ascension = 1; + int target, avatarId, level = 1, ascension = 1; - if(args.size() < 2) { - CommandHandler.sendMessage(null, "Usage: givechar [level]"); + if(args.size() < 1) { + CommandHandler.sendMessage(player, "Usage: givechar [level]"); return; } switch(args.size()) { default: - CommandHandler.sendMessage(null, "Usage: givechar [level]"); + CommandHandler.sendMessage(player, "Usage: givechar [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 args) { if(args.size() < 1) { - CommandHandler.sendMessage(null, "Usage: setworldlevel "); return; + CommandHandler.sendMessage(player, "Usage: setworldlevel "); return; } try { @@ -503,21 +494,18 @@ public final class PlayerCommands { @Override public void execute(GenshinPlayer player, List args) { if(args.size() < 1) { - CommandHandler.sendMessage(null, "Usage: changescene "); return; + CommandHandler.sendMessage(player, "Usage: changescene "); 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 "); return; } } } diff --git a/src/main/java/emu/grasscutter/data/ResourceLoader.java b/src/main/java/emu/grasscutter/data/ResourceLoader.java index f5b9f4f72..f50067c65 100644 --- a/src/main/java/emu/grasscutter/data/ResourceLoader.java +++ b/src/main/java/emu/grasscutter/data/ResourceLoader.java @@ -197,7 +197,7 @@ public class ResourceLoader { } else { Map map = new TreeMap<>(); java.lang.reflect.Type type = new TypeToken>() {}.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)); diff --git a/src/main/java/emu/grasscutter/game/managers/InventoryManager.java b/src/main/java/emu/grasscutter/game/managers/InventoryManager.java index 3d56dfad2..935652d77 100644 --- a/src/main/java/emu/grasscutter/game/managers/InventoryManager.java +++ b/src/main/java/emu/grasscutter/game/managers/InventoryManager.java @@ -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) { diff --git a/src/main/java/emu/grasscutter/server/dispatch/DispatchServer.java b/src/main/java/emu/grasscutter/server/dispatch/DispatchServer.java index da90caa42..0ac4c4fc8 100644 --- a/src/main/java/emu/grasscutter/server/dispatch/DispatchServer.java +++ b/src/main/java/emu/grasscutter/server/dispatch/DispatchServer.java @@ -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()); diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketPlayerEnterSceneNotify.java b/src/main/java/emu/grasscutter/server/packet/send/PacketPlayerEnterSceneNotify.java index 69ca9cb5f..e2db99153 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketPlayerEnterSceneNotify.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketPlayerEnterSceneNotify.java @@ -59,6 +59,7 @@ public class PacketPlayerEnterSceneNotify extends GenshinPacket { .setEnterReason(reason.getValue()) .addSceneTagIdList(102) .addSceneTagIdList(107) + .addSceneTagIdList(109) .addSceneTagIdList(113) .addSceneTagIdList(117) .setUnk1(1)