diff --git a/src/main/java/emu/lunarcore/data/config/MonsterInfo.java b/src/main/java/emu/lunarcore/data/config/MonsterInfo.java index c2b6ea0cf..d44ebea3b 100644 --- a/src/main/java/emu/lunarcore/data/config/MonsterInfo.java +++ b/src/main/java/emu/lunarcore/data/config/MonsterInfo.java @@ -10,4 +10,5 @@ public class MonsterInfo extends ObjectInfo { private int NPCMonsterID; private int EventID; private int FarmElementID; + private boolean IsClientOnly; } diff --git a/src/main/java/emu/lunarcore/data/config/NpcInfo.java b/src/main/java/emu/lunarcore/data/config/NpcInfo.java index ba5799b68..959f3a2b2 100644 --- a/src/main/java/emu/lunarcore/data/config/NpcInfo.java +++ b/src/main/java/emu/lunarcore/data/config/NpcInfo.java @@ -8,4 +8,5 @@ @Getter public class NpcInfo extends ObjectInfo { private int NPCID; + private boolean IsClientOnly; } diff --git a/src/main/java/emu/lunarcore/data/config/PropInfo.java b/src/main/java/emu/lunarcore/data/config/PropInfo.java index 23870d979..4539098ff 100644 --- a/src/main/java/emu/lunarcore/data/config/PropInfo.java +++ b/src/main/java/emu/lunarcore/data/config/PropInfo.java @@ -24,6 +24,7 @@ public class PropInfo extends ObjectInfo { private int EventID; private int CocoonID; private int FarmElementID; + private boolean IsClientOnly; private PropValueSource ValueSource; @Setter private String InitLevelGraph; diff --git a/src/main/java/emu/lunarcore/game/challenge/ChallengeEntityLoader.java b/src/main/java/emu/lunarcore/game/challenge/ChallengeEntityLoader.java index 0644141d6..6d366768f 100644 --- a/src/main/java/emu/lunarcore/game/challenge/ChallengeEntityLoader.java +++ b/src/main/java/emu/lunarcore/game/challenge/ChallengeEntityLoader.java @@ -4,14 +4,13 @@ import emu.lunarcore.data.config.GroupInfo; import emu.lunarcore.data.config.MonsterInfo; import emu.lunarcore.data.config.NpcInfo; -import emu.lunarcore.data.config.PropInfo; +import emu.lunarcore.data.config.GroupInfo.GroupLoadSide; import emu.lunarcore.data.excel.NpcMonsterExcel; import emu.lunarcore.data.excel.ChallengeExcel.ChallengeMonsterInfo; import emu.lunarcore.game.scene.Scene; import emu.lunarcore.game.scene.SceneEntityLoader; import emu.lunarcore.game.scene.entity.EntityMonster; import emu.lunarcore.game.scene.entity.EntityNpc; -import emu.lunarcore.game.scene.entity.EntityProp; import it.unimi.dsi.fastutil.ints.Int2ObjectMap; public class ChallengeEntityLoader extends SceneEntityLoader { @@ -24,6 +23,19 @@ public void onSceneLoad(Scene scene) { // Setup first stage scene.loadGroup(instance.getExcel().getMazeGroupID1()); + + // Load all groups with props + for (var group : scene.getFloorInfo().getGroups().values()) { + // Skip non-server groups + if (group.getLoadSide() != GroupLoadSide.Server) { + continue; + } + + // Dont load the groups that have monsters in them + if (group.getPropList().size() > 0 && group.getMonsterList().size() == 0) { + scene.loadGroup(group); + } + } } @Override @@ -58,11 +70,6 @@ public EntityMonster loadMonster(Scene scene, GroupInfo group, MonsterInfo monst return monster; } - @Override - public EntityProp loadProp(Scene scene, GroupInfo group, PropInfo propInfo) { - return null; - } - @Override public EntityNpc loadNpc(Scene scene, GroupInfo group, NpcInfo npcInfo) { return null; diff --git a/src/main/java/emu/lunarcore/game/scene/SceneEntityLoader.java b/src/main/java/emu/lunarcore/game/scene/SceneEntityLoader.java index c90b7c609..511a7dc3b 100644 --- a/src/main/java/emu/lunarcore/game/scene/SceneEntityLoader.java +++ b/src/main/java/emu/lunarcore/game/scene/SceneEntityLoader.java @@ -30,8 +30,10 @@ public void onSceneLoad(Scene scene) { } public EntityMonster loadMonster(Scene scene, GroupInfo group, MonsterInfo monsterInfo) { - // Don't spawn entity if they have the IsDelete flag in group info - if (monsterInfo.isIsDelete()) return null; + // Don't spawn entity if they have certain flags in their info + if (monsterInfo.isIsDelete() || monsterInfo.isIsClientOnly()) { + return null; + } // Get excels from game data NpcMonsterExcel npcMonsterExcel = GameData.getNpcMonsterExcelMap().get(monsterInfo.getNPCMonsterID()); @@ -46,8 +48,10 @@ public EntityMonster loadMonster(Scene scene, GroupInfo group, MonsterInfo monst } public EntityProp loadProp(Scene scene, GroupInfo group, PropInfo propInfo) { - // Don't spawn entity if they have the IsDelete flag in group info - if (propInfo.isIsDelete()) return null; + // Don't spawn entity if they have certain flags in their info + if (propInfo.isIsDelete() || propInfo.isIsClientOnly()) { + return null; + } // Get prop excel to make sure prop exists PropExcel propExcel = GameData.getPropExcelMap().get(propInfo.getPropID()); @@ -84,20 +88,25 @@ public EntityProp loadProp(Scene scene, GroupInfo group, PropInfo propInfo) { } public EntityNpc loadNpc(Scene scene, GroupInfo group, NpcInfo npcInfo) { - // Don't spawn entity if they have the IsDelete flag in group info - if (npcInfo.isIsDelete() || !GameData.getNpcExcelMap().containsKey(npcInfo.getNPCID())) { + // Don't spawn entity if they have certain flags in their info + if (npcInfo.isIsDelete() || npcInfo.isIsClientOnly()) { + return null; + } + + // Sanity check npc id + if (!GameData.getNpcExcelMap().containsKey(npcInfo.getNPCID())) { return null; } // Dont spawn duplicate NPCs - boolean haseDuplicateNpcId = false; + boolean hasDuplicateNpcId = false; for (GameEntity entity : scene.getEntities().values()) { if (entity instanceof EntityNpc eNpc && eNpc.getNpcId() == npcInfo.getNPCID()) { - haseDuplicateNpcId = true; + hasDuplicateNpcId = true; break; } } - if (haseDuplicateNpcId) return null; + if (hasDuplicateNpcId) return null; // Create npc from group and npc info return new EntityNpc(scene, group, npcInfo);