From 2915b14c1fb4a71db702a0059dbeaca6a3319009 Mon Sep 17 00:00:00 2001 From: Melledy <52122272+Melledy@users.noreply.github.com> Date: Fri, 17 Jun 2022 23:36:16 -0700 Subject: [PATCH] 2.7 Merge --- .../data/binout/SceneNpcBornData.java | 2 +- .../data/binout/SceneNpcBornEntry.java | 15 +++++++++- .../grasscutter/data/excels/GatherData.java | 30 +++++++++---------- .../data/excels/InvestigationMonsterData.java | 18 +++++------ .../dungeons/challenge/DungeonChallenge.java | 2 +- .../grasscutter/game/entity/EntityNPC.java | 2 +- .../game/entity/gadget/GadgetChest.java | 11 ++++--- .../game/entity/gadget/GadgetGatherPoint.java | 2 +- .../entity/gadget/GadgetRewardStatue.java | 2 +- .../game/world/WorldDataManager.java | 2 +- .../scripts/SceneScriptManager.java | 10 +++---- 11 files changed, 54 insertions(+), 42 deletions(-) diff --git a/src/main/java/emu/grasscutter/data/binout/SceneNpcBornData.java b/src/main/java/emu/grasscutter/data/binout/SceneNpcBornData.java index 968ef9a05..97d3a8229 100644 --- a/src/main/java/emu/grasscutter/data/binout/SceneNpcBornData.java +++ b/src/main/java/emu/grasscutter/data/binout/SceneNpcBornData.java @@ -1,4 +1,4 @@ -package emu.grasscutter.data.custom; +package emu.grasscutter.data.binout; import com.github.davidmoten.rtreemulti.RTree; import com.github.davidmoten.rtreemulti.geometry.Geometry; diff --git a/src/main/java/emu/grasscutter/data/binout/SceneNpcBornEntry.java b/src/main/java/emu/grasscutter/data/binout/SceneNpcBornEntry.java index 1810c94bf..fe7d670cf 100644 --- a/src/main/java/emu/grasscutter/data/binout/SceneNpcBornEntry.java +++ b/src/main/java/emu/grasscutter/data/binout/SceneNpcBornEntry.java @@ -1,4 +1,4 @@ -package emu.grasscutter.data.custom; +package emu.grasscutter.data.binout; import emu.grasscutter.utils.Position; import lombok.AccessLevel; @@ -7,13 +7,26 @@ import lombok.experimental.FieldDefaults; import java.util.List; +import com.google.gson.annotations.SerializedName; + @Data @FieldDefaults(level = AccessLevel.PRIVATE) public class SceneNpcBornEntry { + @SerializedName(value="id", alternate={"_id", "ID"}) int id; + + @SerializedName(value="configId", alternate={"_configId"}) int configId; + + @SerializedName(value="pos", alternate={"_pos"}) Position pos; + + @SerializedName(value="rot", alternate={"_rot"}) Position rot; + + @SerializedName(value="groupId", alternate={"_groupId"}) int groupId; + + @SerializedName(value="suiteIdList", alternate={"_suiteIdList"}) List suiteIdList; } diff --git a/src/main/java/emu/grasscutter/data/excels/GatherData.java b/src/main/java/emu/grasscutter/data/excels/GatherData.java index c80442378..3aea7561b 100644 --- a/src/main/java/emu/grasscutter/data/excels/GatherData.java +++ b/src/main/java/emu/grasscutter/data/excels/GatherData.java @@ -1,45 +1,45 @@ -package emu.grasscutter.data.def; +package emu.grasscutter.data.excels; import emu.grasscutter.data.GameResource; import emu.grasscutter.data.ResourceType; @ResourceType(name = "GatherExcelConfigData.json") public class GatherData extends GameResource { - private int PointType; - private int Id; - private int GadgetId; - private int ItemId; - private int Cd; // Probably hours - private boolean IsForbidGuest; - private boolean InitDisableInteract; + private int pointType; + private int id; + private int gadgetId; + private int itemId; + private int cd; // Probably hours + private boolean isForbidGuest; + private boolean initDisableInteract; @Override public int getId() { - return this.PointType; + return this.pointType; } public int getGatherId() { - return Id; + return id; } public int getGadgetId() { - return GadgetId; + return gadgetId; } public int getItemId() { - return ItemId; + return itemId; } public int getCd() { - return Cd; + return cd; } public boolean isForbidGuest() { - return IsForbidGuest; + return isForbidGuest; } public boolean initDisableInteract() { - return InitDisableInteract; + return initDisableInteract; } @Override diff --git a/src/main/java/emu/grasscutter/data/excels/InvestigationMonsterData.java b/src/main/java/emu/grasscutter/data/excels/InvestigationMonsterData.java index bdfa720fb..7567659a6 100644 --- a/src/main/java/emu/grasscutter/data/excels/InvestigationMonsterData.java +++ b/src/main/java/emu/grasscutter/data/excels/InvestigationMonsterData.java @@ -1,4 +1,4 @@ -package emu.grasscutter.data.def; +package emu.grasscutter.data.excels; import emu.grasscutter.data.GameResource; import emu.grasscutter.data.ResourceType; @@ -9,17 +9,17 @@ import java.util.List; @ResourceType(name = "InvestigationMonsterConfigData.json") @Data public class InvestigationMonsterData extends GameResource { - private int Id; - private int CityId; - private List MonsterIdList; - private List GroupIdList; - private int RewardPreviewId; - private String MapMarkCreateType; - private String MonsterCategory; + private int id; + private int cityId; + private List monsterIdList; + private List groupIdList; + private int rewardPreviewId; + private String mapMarkCreateType; + private String monsterCategory; @Override public int getId() { - return this.Id; + return this.id; } @Override diff --git a/src/main/java/emu/grasscutter/game/dungeons/challenge/DungeonChallenge.java b/src/main/java/emu/grasscutter/game/dungeons/challenge/DungeonChallenge.java index f2a485f1d..60f3ba9e7 100644 --- a/src/main/java/emu/grasscutter/game/dungeons/challenge/DungeonChallenge.java +++ b/src/main/java/emu/grasscutter/game/dungeons/challenge/DungeonChallenge.java @@ -1,7 +1,7 @@ package emu.grasscutter.game.dungeons.challenge; import emu.grasscutter.data.common.ItemParamData; -import emu.grasscutter.data.def.DungeonData; +import emu.grasscutter.data.excels.DungeonData; import emu.grasscutter.game.dungeons.challenge.trigger.ChallengeTrigger; import emu.grasscutter.game.inventory.GameItem; import emu.grasscutter.game.player.Player; diff --git a/src/main/java/emu/grasscutter/game/entity/EntityNPC.java b/src/main/java/emu/grasscutter/game/entity/EntityNPC.java index 213951ed3..6d1fead52 100644 --- a/src/main/java/emu/grasscutter/game/entity/EntityNPC.java +++ b/src/main/java/emu/grasscutter/game/entity/EntityNPC.java @@ -60,7 +60,7 @@ public class EntityNPC extends GameEntity{ SceneEntityInfoOuterClass.SceneEntityInfo.Builder entityInfo = SceneEntityInfoOuterClass.SceneEntityInfo.newBuilder() .setEntityId(getId()) - .setEntityType(ProtEntityTypeOuterClass.ProtEntityType.PROT_ENTITY_NPC) + .setEntityType(ProtEntityTypeOuterClass.ProtEntityType.PROT_ENTITY_TYPE_NPC) .setMotionInfo(MotionInfoOuterClass.MotionInfo.newBuilder() .setPos(getPosition().toProto()) .setRot(getRotation().toProto()) diff --git a/src/main/java/emu/grasscutter/game/entity/gadget/GadgetChest.java b/src/main/java/emu/grasscutter/game/entity/gadget/GadgetChest.java index 6e2cdf72b..132e37590 100644 --- a/src/main/java/emu/grasscutter/game/entity/gadget/GadgetChest.java +++ b/src/main/java/emu/grasscutter/game/entity/gadget/GadgetChest.java @@ -5,21 +5,20 @@ import emu.grasscutter.game.entity.EntityGadget; import emu.grasscutter.game.player.Player; import emu.grasscutter.net.proto.BossChestInfoOuterClass.BossChestInfo; import emu.grasscutter.net.proto.InterOpTypeOuterClass; +import emu.grasscutter.net.proto.InterOpTypeOuterClass.InterOpType; import emu.grasscutter.net.proto.InteractTypeOuterClass; import emu.grasscutter.net.proto.InteractTypeOuterClass.InteractType; import emu.grasscutter.net.proto.SceneGadgetInfoOuterClass.SceneGadgetInfo; import emu.grasscutter.scripts.constants.ScriptGadgetState; import emu.grasscutter.server.packet.send.PacketGadgetInteractRsp; -import static emu.grasscutter.net.proto.InterOpTypeOuterClass.InterOpType.INTER_OP_START; - public class GadgetChest extends GadgetContent { public GadgetChest(EntityGadget gadget) { super(gadget); } - public boolean onInteract(Player player, InterOpTypeOuterClass.InterOpType opType) { + public boolean onInteract(Player player, InterOpType opType) { var chestInteractHandlerMap = getGadget().getScene().getWorld().getServer().getWorldDataManager().getChestInteractHandlerMap(); var handler = chestInteractHandlerMap.get(getGadget().getGadgetData().getJsonName()); if(handler == null){ @@ -27,8 +26,8 @@ public class GadgetChest extends GadgetContent { return false; } - if(opType == INTER_OP_START && handler.isTwoStep()){ - player.sendPacket(new PacketGadgetInteractRsp(getGadget(), InteractType.INTERACT_OPEN_CHEST, INTER_OP_START)); + if(opType == InterOpType.INTER_OP_TYPE_START && handler.isTwoStep()){ + player.sendPacket(new PacketGadgetInteractRsp(getGadget(), InteractType.INTERACT_TYPE_OPEN_CHEST, InterOpType.INTER_OP_TYPE_START)); return false; }else{ var success = handler.onInteract(this, player); @@ -37,7 +36,7 @@ public class GadgetChest extends GadgetContent { } getGadget().updateState(ScriptGadgetState.ChestOpened); - player.sendPacket(new PacketGadgetInteractRsp(this.getGadget(), InteractTypeOuterClass.InteractType.INTERACT_OPEN_CHEST)); + player.sendPacket(new PacketGadgetInteractRsp(this.getGadget(), InteractTypeOuterClass.InteractType.INTERACT_TYPE_OPEN_CHEST)); // let the chest disappear getGadget().die(); return true; diff --git a/src/main/java/emu/grasscutter/game/entity/gadget/GadgetGatherPoint.java b/src/main/java/emu/grasscutter/game/entity/gadget/GadgetGatherPoint.java index 9a6074c0e..64d1c1022 100644 --- a/src/main/java/emu/grasscutter/game/entity/gadget/GadgetGatherPoint.java +++ b/src/main/java/emu/grasscutter/game/entity/gadget/GadgetGatherPoint.java @@ -1,7 +1,7 @@ package emu.grasscutter.game.entity.gadget; import emu.grasscutter.data.GameData; -import emu.grasscutter.data.def.GatherData; +import emu.grasscutter.data.excels.GatherData; import emu.grasscutter.game.entity.EntityGadget; import emu.grasscutter.game.inventory.GameItem; import emu.grasscutter.game.player.Player; diff --git a/src/main/java/emu/grasscutter/game/entity/gadget/GadgetRewardStatue.java b/src/main/java/emu/grasscutter/game/entity/gadget/GadgetRewardStatue.java index 69a25b0a5..cfe9bf321 100644 --- a/src/main/java/emu/grasscutter/game/entity/gadget/GadgetRewardStatue.java +++ b/src/main/java/emu/grasscutter/game/entity/gadget/GadgetRewardStatue.java @@ -19,7 +19,7 @@ public class GadgetRewardStatue extends GadgetContent { dungeonChallenge.getStatueDrops(player); } - player.sendPacket(new PacketGadgetInteractRsp(getGadget(), InteractType.INTERACT_OPEN_STATUE)); + player.sendPacket(new PacketGadgetInteractRsp(getGadget(), InteractType.INTERACT_TYPE_OPEN_STATUE)); return false; } diff --git a/src/main/java/emu/grasscutter/game/world/WorldDataManager.java b/src/main/java/emu/grasscutter/game/world/WorldDataManager.java index 9f33f4a84..11e01f0ac 100644 --- a/src/main/java/emu/grasscutter/game/world/WorldDataManager.java +++ b/src/main/java/emu/grasscutter/game/world/WorldDataManager.java @@ -4,7 +4,7 @@ import com.google.gson.reflect.TypeToken; import emu.grasscutter.Grasscutter; import emu.grasscutter.data.DataLoader; import emu.grasscutter.data.GameData; -import emu.grasscutter.data.def.RewardPreviewData; +import emu.grasscutter.data.excels.RewardPreviewData; import emu.grasscutter.game.entity.gadget.chest.BossChestInteractHandler; import emu.grasscutter.game.entity.gadget.chest.ChestInteractHandler; import emu.grasscutter.game.entity.gadget.chest.NormalChestInteractHandler; diff --git a/src/main/java/emu/grasscutter/scripts/SceneScriptManager.java b/src/main/java/emu/grasscutter/scripts/SceneScriptManager.java index 27fd3836f..4df5a84fd 100644 --- a/src/main/java/emu/grasscutter/scripts/SceneScriptManager.java +++ b/src/main/java/emu/grasscutter/scripts/SceneScriptManager.java @@ -4,8 +4,8 @@ import com.github.davidmoten.rtreemulti.RTree; import com.github.davidmoten.rtreemulti.geometry.Geometry; import emu.grasscutter.Grasscutter; import emu.grasscutter.data.GameData; -import emu.grasscutter.data.def.MonsterData; -import emu.grasscutter.data.def.WorldLevelData; +import emu.grasscutter.data.excels.MonsterData; +import emu.grasscutter.data.excels.WorldLevelData; import emu.grasscutter.game.entity.EntityGadget; import emu.grasscutter.game.entity.EntityMonster; import emu.grasscutter.game.entity.EntityNPC; @@ -414,7 +414,7 @@ public class SceneScriptManager { } public void meetEntities(List gameEntity){ - getScene().addEntities(gameEntity, VisionTypeOuterClass.VisionType.VISION_MEET); + getScene().addEntities(gameEntity, VisionTypeOuterClass.VisionType.VISION_TYPE_MEET); } public void addEntities(List gameEntity){ @@ -434,7 +434,7 @@ public class SceneScriptManager { .filter(e -> configSet.contains(e.getConfigId())) .toList(); - getScene().removeEntities(toRemove, VisionTypeOuterClass.VisionType.VISION_MISS); + getScene().removeEntities(toRemove, VisionTypeOuterClass.VisionType.VISION_TYPE_MISS); } public void removeGadgetsInGroup(SceneGroup group, SceneSuite suite) { var configSet = suite.sceneGadgets.stream() @@ -446,6 +446,6 @@ public class SceneScriptManager { .filter(e -> configSet.contains(e.getConfigId())) .toList(); - getScene().removeEntities(toRemove, VisionTypeOuterClass.VisionType.VISION_MISS); + getScene().removeEntities(toRemove, VisionTypeOuterClass.VisionType.VISION_TYPE_MISS); } }