From 1db13a6fa9867fbf0a7e1ce133fa2f29ce7b69c8 Mon Sep 17 00:00:00 2001 From: Yazawazi <47273265+Yazawazi@users.noreply.github.com> Date: Tue, 19 Apr 2022 19:48:26 +0800 Subject: [PATCH 01/12] Constellation fix --- .../emu/grasscutter/game/managers/InventoryManager.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/java/emu/grasscutter/game/managers/InventoryManager.java b/src/main/java/emu/grasscutter/game/managers/InventoryManager.java index 3d56dfad2..d98f917e2 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,7 +804,11 @@ public class InventoryManager { // Get talent int currentTalentLevel = avatar.getCoreProudSkillLevel(); int nextTalentId = ((avatar.getAvatarId() % 10000000) * 10) + currentTalentLevel + 1; - AvatarTalentData talentData = GenshinData.getAvatarTalentDataMap().get(nextTalentId); + + if (avatar.getAvatarId() == 10000006) { + // Lisa is special in that her talentId starts with 4 instead of 6. + nextTalentId = 40 + currentTalentLevel + 1; + } if (talentData == null) { return; From 4b279b45e03979527ba009bfb21470d715658f15 Mon Sep 17 00:00:00 2001 From: xmplay <81370285+xmplay@users.noreply.github.com> Date: Tue, 19 Apr 2022 13:03:43 +0100 Subject: [PATCH 02/12] Update PacketPlayerEnterSceneNotify.java --- .../server/packet/send/PacketPlayerEnterSceneNotify.java | 1 + 1 file changed, 1 insertion(+) 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) From 5fcecfc73420390651847aaeaa30b2f54bbb613f Mon Sep 17 00:00:00 2001 From: Yazawazi <47273265+Yazawazi@users.noreply.github.com> Date: Tue, 19 Apr 2022 20:05:45 +0800 Subject: [PATCH 03/12] talentData sorry again, forgot to add --- .../java/emu/grasscutter/game/managers/InventoryManager.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/emu/grasscutter/game/managers/InventoryManager.java b/src/main/java/emu/grasscutter/game/managers/InventoryManager.java index d98f917e2..935652d77 100644 --- a/src/main/java/emu/grasscutter/game/managers/InventoryManager.java +++ b/src/main/java/emu/grasscutter/game/managers/InventoryManager.java @@ -810,6 +810,8 @@ public class InventoryManager { nextTalentId = 40 + currentTalentLevel + 1; } + AvatarTalentData talentData = GenshinData.getAvatarTalentDataMap().get(nextTalentId); + if (talentData == null) { return; } From 1df7665e3e12fa8972e34c021fbc375339240d52 Mon Sep 17 00:00:00 2001 From: xmplay <81370285+xmplay@users.noreply.github.com> Date: Tue, 19 Apr 2022 13:23:57 +0100 Subject: [PATCH 04/12] Updated Banners.json with the latest banners (19 Apr) --- data/Banners.json | 39 ++++++++++++--------------------------- 1 file changed, 12 insertions(+), 27 deletions(-) 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 +] From e1257739b780bce774b5e360f900f50b946bb4fd Mon Sep 17 00:00:00 2001 From: OtakuNekoP Date: Tue, 19 Apr 2022 14:48:03 +0200 Subject: [PATCH 05/12] skip beta server device id verify --- .../java/emu/grasscutter/server/dispatch/DispatchServer.java | 4 ++++ 1 file changed, 4 insertions(+) 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()); From 69cb03f4d4c4b03c03fc327bdb649ce4580608f4 Mon Sep 17 00:00:00 2001 From: KingRainbow44 Date: Tue, 19 Apr 2022 10:00:50 -0400 Subject: [PATCH 06/12] Command reformat --- .../grasscutter/commands/PlayerCommands.java | 68 ++++++++----------- 1 file changed, 28 insertions(+), 40 deletions(-) diff --git a/src/main/java/emu/grasscutter/commands/PlayerCommands.java b/src/main/java/emu/grasscutter/commands/PlayerCommands.java index a9607ddbc..90bb22f46 100644 --- a/src/main/java/emu/grasscutter/commands/PlayerCommands.java +++ b/src/main/java/emu/grasscutter/commands/PlayerCommands.java @@ -185,38 +185,29 @@ public final class PlayerCommands { } } - @Command(label = "givechar", aliases = { "givec" }, usage = "Usage: givechar [level]") + @Command(label = "givechar", aliases = {"givec"}, + usage = "Usage: givechar [avatarId] [level]") 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]"); + 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)); + 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. @@ -231,7 +222,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. @@ -243,22 +234,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); @@ -279,7 +270,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) { @@ -293,9 +284,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); @@ -461,7 +452,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 { @@ -498,21 +489,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; } } } From c728b9f5fe5196fe6daff6975d63717d83e550f6 Mon Sep 17 00:00:00 2001 From: KingRainbow44 Date: Tue, 19 Apr 2022 10:31:24 -0400 Subject: [PATCH 07/12] Attempt to fix `!givechar` --- src/main/java/emu/grasscutter/commands/PlayerCommands.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/emu/grasscutter/commands/PlayerCommands.java b/src/main/java/emu/grasscutter/commands/PlayerCommands.java index 90bb22f46..b6401740d 100644 --- a/src/main/java/emu/grasscutter/commands/PlayerCommands.java +++ b/src/main/java/emu/grasscutter/commands/PlayerCommands.java @@ -186,12 +186,12 @@ public final class PlayerCommands { } @Command(label = "givechar", aliases = {"givec"}, - usage = "Usage: givechar [avatarId] [level]") + usage = "Usage: givechar [level|avatarId] [level]") public static class GiveCharCommand implements CommandHandler { @Override public void execute(GenshinPlayer player, List args) { int target, avatarId, level = 1, ascension = 1; - if(args.size() < 2) { + if(args.size() < 1) { CommandHandler.sendMessage(player, "Usage: givechar [level]"); return; } @@ -204,7 +204,8 @@ public final class PlayerCommands { try { target = Integer.parseInt(args.get(0)); if(Grasscutter.getGameServer().getPlayerByUid(target) == null) { - target = player.getUid(); level = Integer.parseInt(args.get(1)); + target = player.getUid(); + level = Integer.parseInt(args.get(1)); avatarId = Integer.parseInt(args.get(0)); } else { avatarId = Integer.parseInt(args.get(1)); From ac6ae1178dcc17acaf5f8202edd6550cdd30231e Mon Sep 17 00:00:00 2001 From: ayy lmao Date: Tue, 19 Apr 2022 19:21:14 +0300 Subject: [PATCH 08/12] Fix folder seperators --- src/main/java/emu/grasscutter/data/ResourceLoader.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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)); From f739ddb29ea1de36bcd455421c53ff0faf526c52 Mon Sep 17 00:00:00 2001 From: Jaida Wu Date: Wed, 20 Apr 2022 00:40:44 +0800 Subject: [PATCH 09/12] Delete run.bat --- run.bat | 7 ------- 1 file changed, 7 deletions(-) delete mode 100644 run.bat 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 From c2a2f569efd279eed0de0c5b3f1797d189060fd1 Mon Sep 17 00:00:00 2001 From: Jaida Wu Date: Wed, 20 Apr 2022 00:43:01 +0800 Subject: [PATCH 10/12] Make overseauspider.yuanshen.com reachable * Since DispatchServer has handled the server correctly, so it should not be invalidated: https://github.com/Melledy/Grasscutter/blob/main/src/main/java/emu/grasscutter/server/dispatch/DispatchServer.java#L402 --- proxy.py | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) 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 +] From b7a7c8e41a2ea02fad0aada2e5b169febfcb1a1c Mon Sep 17 00:00:00 2001 From: Melledy <52122272+Melledy@users.noreply.github.com> Date: Tue, 19 Apr 2022 10:23:08 -0700 Subject: [PATCH 11/12] Remove protos From 14da6c474b18fa0592ab688205f3aff8ce23b71d Mon Sep 17 00:00:00 2001 From: Melledy <52122272+Melledy@users.noreply.github.com> Date: Tue, 19 Apr 2022 10:26:31 -0700 Subject: [PATCH 12/12] Protos --- .gitmodules | 3 +++ Grasscutter-Protos | 1 + 2 files changed, 4 insertions(+) create mode 100644 .gitmodules create mode 160000 Grasscutter-Protos 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