From 5ffc07cf5983f0b909e8ae2909c68a365e8c8421 Mon Sep 17 00:00:00 2001 From: GanyusLeftHorn <1244229+GanyusLeftHorn@users.noreply.github.com> Date: Wed, 28 Sep 2022 04:53:19 +0200 Subject: [PATCH] 3.1 Support (#1808) * Update 3.0 protos * Update classes to match protos * Fix RegionHandler versions * 3.0 Opcodes * Fixed Gadget Spawning Original Commit Message: fixed gadget spawning ty MJDerp Gitea Author: yh0Nathan Co-authored-by: yh0Nathan * Make PointData compatible with alternative PointData Original Commit Message: Make PointData compatible with windied scene points. Gitea Author: GanyusLeftHorn Co-authored-by: GanyusLeftHorn <1244229+GanyusLeftHorn@users.noreply.github.com> * Add scene tag for Vanarana. Original Commit Message: Add scene tag for Vanarana. Gitea Author: GanyusLeftHorn Co-authored-by: GanyusLeftHorn <1244229+GanyusLeftHorn@users.noreply.github.com> * Add Sumeru expeditions. Original Commit Message: Add Sumeru expeditions. Gitea Author: GanyusLeftHorn Co-authored-by: GanyusLeftHorn <1244229+GanyusLeftHorn@users.noreply.github.com> * Update game version to 3.0.0 * versionFix must be >= 50 not == 50 in RegionHandler * Add new 3.0 Reliquary and SkillParticleGeneration data Original Commit Message: Repair 3.0 added Reliquary 3-in-1 on the crafting table. Add skill particle generation info for Tighnari,Collei and Dori Gitea Author: Roly * Actually fix RegionHandler * Remove asset names from json and comments * Add scene areas for Sumeru desert to /prop um * Added New MaterialType * Change version to 3.1.0 * funny welcome message back * Fix pyramid skill issue. * Fix pyramid and event scene tags without ugly bruteforce. * Remove backrooms chat welcome message. * Incorporate suggestions. * RoomSceneId and empty list checking. Co-authored-by: Benj Co-authored-by: yh0Nathan Co-authored-by: Kokoboy Co-authored-by: nitro <31241699+nitrog0d@users.noreply.github.com> Co-authored-by: Vexeone --- .../java/emu/grasscutter/GameConstants.java | 2 +- .../command/commands/SetPropCommand.java | 2 +- .../emu/grasscutter/data/excels/ItemData.java | 3 +- .../game/inventory/MaterialType.java | 4 +- .../game/world/WorldDataSystem.java | 4 ++ .../send/PacketPlayerEnterSceneNotify.java | 11 ++-- .../PacketPlayerWorldSceneInfoListNotify.java | 52 +++++++++++-------- 7 files changed, 43 insertions(+), 35 deletions(-) diff --git a/src/main/java/emu/grasscutter/GameConstants.java b/src/main/java/emu/grasscutter/GameConstants.java index 97bbb42fe..4a536e95e 100644 --- a/src/main/java/emu/grasscutter/GameConstants.java +++ b/src/main/java/emu/grasscutter/GameConstants.java @@ -6,7 +6,7 @@ import emu.grasscutter.utils.Position; import emu.grasscutter.utils.Utils; public final class GameConstants { - public static String VERSION = "3.0.0"; + public static String VERSION = "3.1.0"; public static final int DEFAULT_TEAMS = 4; public static final int MAX_TEAMS = 10; diff --git a/src/main/java/emu/grasscutter/command/commands/SetPropCommand.java b/src/main/java/emu/grasscutter/command/commands/SetPropCommand.java index c3e54a4c2..73fc3ed0b 100644 --- a/src/main/java/emu/grasscutter/command/commands/SetPropCommand.java +++ b/src/main/java/emu/grasscutter/command/commands/SetPropCommand.java @@ -231,7 +231,7 @@ public final class SetPropCommand implements CommandHandler { } // List of map areas. Unfortunately, there is no readily available source for them in excels or bins. - final static private List sceneAreas = List.of(1,2,3,4,5,6,7,8,9,10,11,12,13,14,17,18,19,20,21,22,23,24,25,29,100,101,102,103,200,210,300,400,401,402,403); + final static private List sceneAreas = List.of(1,2,3,4,5,6,7,8,9,10,11,12,13,14,17,18,19,20,21,22,23,24,25,26,27,28,29,100,101,102,103,200,210,300,400,401,402,403); private boolean unlockMap(Player targetPlayer) { // Unlock. GameData.getScenePointsPerScene().forEach((sceneId, scenePoints) -> { diff --git a/src/main/java/emu/grasscutter/data/excels/ItemData.java b/src/main/java/emu/grasscutter/data/excels/ItemData.java index 457dc7bc0..f4784fb43 100644 --- a/src/main/java/emu/grasscutter/data/excels/ItemData.java +++ b/src/main/java/emu/grasscutter/data/excels/ItemData.java @@ -75,7 +75,8 @@ public class ItemData extends GameResource { private int comfort; private List furnType; private List furnitureGadgetID; - @SerializedName(value="OHIANNAEEAK", alternate={"DANFGGLKLNO", "JFDLJGDFIGL"}) + + @SerializedName(value="roomSceneId", alternate={"DANFGGLKLNO", "JFDLJGDFIGL", "OHIANNAEEAK"}) private int roomSceneId; // Custom diff --git a/src/main/java/emu/grasscutter/game/inventory/MaterialType.java b/src/main/java/emu/grasscutter/game/inventory/MaterialType.java index a9e7e55c8..463ed5356 100644 --- a/src/main/java/emu/grasscutter/game/inventory/MaterialType.java +++ b/src/main/java/emu/grasscutter/game/inventory/MaterialType.java @@ -46,7 +46,9 @@ public enum MaterialType { MATERIAL_SPICE_FOOD (37), MATERIAL_ACTIVITY_ROBOT (38), MATERIAL_ACTIVITY_GEAR (39), - MATERIAL_ACTIVITY_JIGSAW (40); + MATERIAL_ACTIVITY_JIGSAW (40), + MATERIAL_ARANARA (41), + MATERIAL_DESHRET_MANUAL (46); private final int value; private static final Int2ObjectMap map = new Int2ObjectOpenHashMap<>(); diff --git a/src/main/java/emu/grasscutter/game/world/WorldDataSystem.java b/src/main/java/emu/grasscutter/game/world/WorldDataSystem.java index 5c0b404bd..32e7fb954 100644 --- a/src/main/java/emu/grasscutter/game/world/WorldDataSystem.java +++ b/src/main/java/emu/grasscutter/game/world/WorldDataSystem.java @@ -85,6 +85,10 @@ public class WorldDataSystem extends BaseGameSystem { return level; } private InvestigationMonsterOuterClass.InvestigationMonster getInvestigationMonster(Player player, InvestigationMonsterData imd) { + if(imd.getGroupIdList().isEmpty() || imd.getMonsterIdList().isEmpty()){ + return null; + } + var groupId = imd.getGroupIdList().get(0); var monsterId = imd.getMonsterIdList().get(0); var sceneId = imd.getCityData().getSceneId(); 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 461b0bdce..4ed24c7cb 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketPlayerEnterSceneNotify.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketPlayerEnterSceneNotify.java @@ -19,7 +19,7 @@ public class PacketPlayerEnterSceneNotify extends BasePacket { player.setSceneLoadState(SceneLoadState.LOADING); player.setEnterSceneToken(Utils.randomRange(1000, 99999)); - PlayerEnterSceneNotify proto = PlayerEnterSceneNotify.newBuilder() + PlayerEnterSceneNotify.Builder proto = PlayerEnterSceneNotify.newBuilder() .setSceneId(player.getSceneId()) .setPos(player.getPosition().toProto()) .setSceneBeginTime(System.currentTimeMillis()) @@ -30,8 +30,7 @@ public class PacketPlayerEnterSceneNotify extends BasePacket { .setEnterReason(EnterReason.Login.getValue()) .setIsFirstLoginEnterScene(player.isFirstLoginEnterScene()) .setWorldType(1) - .setSceneTransaction("3-" + player.getUid() + "-" + (int) (System.currentTimeMillis() / 1000) + "-" + 18402) - .build(); + .setSceneTransaction("3-" + player.getUid() + "-" + (int) (System.currentTimeMillis() / 1000) + "-" + 18402); this.setData(proto); } @@ -61,10 +60,6 @@ public class PacketPlayerEnterSceneNotify extends BasePacket { .setWorldType(1) .setSceneTransaction(newScene + "-" + target.getUid() + "-" + (int) (System.currentTimeMillis() / 1000) + "-" + 18402); - for (int i = 0; i < 3000; i++) { - proto.addSceneTagIdList(i); - } - - this.setData(proto.build()); + this.setData(proto); } } diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketPlayerWorldSceneInfoListNotify.java b/src/main/java/emu/grasscutter/server/packet/send/PacketPlayerWorldSceneInfoListNotify.java index 436bd69ed..8b2fc2e31 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketPlayerWorldSceneInfoListNotify.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketPlayerWorldSceneInfoListNotify.java @@ -1,15 +1,12 @@ package emu.grasscutter.server.packet.send; -import emu.grasscutter.net.packet.BasePacket; -import emu.grasscutter.net.packet.PacketOpcodes; -import emu.grasscutter.net.proto.PlayerWorldSceneInfoListNotifyOuterClass.PlayerWorldSceneInfoListNotify; -import emu.grasscutter.net.proto.PlayerWorldSceneInfoOuterClass; -import emu.grasscutter.net.proto.SceneUnlockInfoOuterClass.SceneUnlockInfo; - import java.util.stream.Collectors; import java.util.stream.IntStream; -import static emu.grasscutter.net.proto.PlayerWorldSceneInfoOuterClass.*; +import emu.grasscutter.net.packet.BasePacket; +import emu.grasscutter.net.packet.PacketOpcodes; +import emu.grasscutter.net.proto.PlayerWorldSceneInfoListNotifyOuterClass.PlayerWorldSceneInfoListNotify; +import emu.grasscutter.net.proto.PlayerWorldSceneInfoOuterClass.PlayerWorldSceneInfo; public class PacketPlayerWorldSceneInfoListNotify extends BasePacket { @@ -27,14 +24,26 @@ public class PacketPlayerWorldSceneInfoListNotify extends BasePacket { PlayerWorldSceneInfo.newBuilder() .setSceneId(3) .setIsLocked(false) - .addSceneTagIdList(102) + .addSceneTagIdList(102) // Jade chamber .addSceneTagIdList(113) .addSceneTagIdList(117) - .addSceneTagIdList(1093) - //.addSceneTagIdList(1094) - //.addSceneTagIdList(1095) - //.addSceneTagIdList(1096) - //.addAllSceneTagIdList(IntStream.range(1000, 2000).boxed().collect(Collectors.toList())) + + // Vanarana (Sumeru tree) + .addSceneTagIdList(1093) // Vana_real + // .addSceneTagIdList(1094) // Vana_dream + // .addSceneTagIdList(1095) // Vana_first + // .addSceneTagIdList(1096) // Vana_festival + + // 3.1 event + .addSceneTagIdList(152) + .addSceneTagIdList(153) + + // Pyramid + .addSceneTagIdList(1164) // Arena (XMSM_CWLTop) + .addSceneTagIdList(1166) // Pyramid (CWL_Trans_02) + + // Brute force + //.addAllSceneTagIdList(IntStream.range(1150, 1250).boxed().toList()) .build() ) .addInfoList( @@ -63,18 +72,15 @@ public class PacketPlayerWorldSceneInfoListNotify extends BasePacket { .setSceneId(7) .setIsLocked(false) .build() + ) + .addInfoList( + PlayerWorldSceneInfo.newBuilder() + .setSceneId(9) + .setIsLocked(false) + .addAllSceneTagIdList(IntStream.range(0, 3000).boxed().toList()) + .build() ); - var gaa = PlayerWorldSceneInfo.newBuilder() - .setSceneId(9) - .setIsLocked(false); - - for (int i = 0; i < 3000; i++) { - gaa.addSceneTagIdList(i); - } - - proto.addInfoList(gaa); - this.setData(proto); } }