Make monsters scale off world level

This commit is contained in:
Melledy 2022-04-25 04:04:01 -07:00
parent 0b49f487c4
commit 7efac01890
3 changed files with 40 additions and 2 deletions

View File

@ -60,6 +60,7 @@ public class GenshinData {
private static final Int2ObjectMap<FetterData> fetterDataMap = new Int2ObjectOpenHashMap<>(); private static final Int2ObjectMap<FetterData> fetterDataMap = new Int2ObjectOpenHashMap<>();
private static final Int2ObjectMap<FetterCharacterCardData> fetterCharacterCardDataMap = new Int2ObjectOpenHashMap<>(); private static final Int2ObjectMap<FetterCharacterCardData> fetterCharacterCardDataMap = new Int2ObjectOpenHashMap<>();
private static final Int2ObjectMap<RewardData> rewardDataMap = new Int2ObjectOpenHashMap<>(); private static final Int2ObjectMap<RewardData> rewardDataMap = new Int2ObjectOpenHashMap<>();
private static final Int2ObjectMap<WorldLevelData> worldLevelDataMap = new Int2ObjectOpenHashMap<>();
// Cache // Cache
private static Map<Integer, List<Integer>> fetters = new HashMap<>(); private static Map<Integer, List<Integer>> fetters = new HashMap<>();
@ -260,4 +261,8 @@ public class GenshinData {
return fetters; return fetters;
} }
public static Int2ObjectMap<WorldLevelData> getWorldLevelDataMap() {
return worldLevelDataMap;
}
} }

View File

@ -0,0 +1,24 @@
package emu.grasscutter.data.def;
import emu.grasscutter.data.GenshinResource;
import emu.grasscutter.data.ResourceType;
@ResourceType(name = "WorldLevelExcelConfigData.json")
public class WorldLevelData extends GenshinResource {
private int Level;
private int MonsterLevel;
@Override
public int getId() {
return this.Level;
}
public int getMonsterLevel() {
return MonsterLevel;
}
@Override
public void onLoad() {
}
}

View File

@ -17,6 +17,7 @@ import emu.grasscutter.data.GenshinDepot;
import emu.grasscutter.data.GenshinResource; import emu.grasscutter.data.GenshinResource;
import emu.grasscutter.data.def.MonsterData; import emu.grasscutter.data.def.MonsterData;
import emu.grasscutter.data.def.SceneData; import emu.grasscutter.data.def.SceneData;
import emu.grasscutter.data.def.WorldLevelData;
import emu.grasscutter.game.entity.EntityAvatar; import emu.grasscutter.game.entity.EntityAvatar;
import emu.grasscutter.game.entity.EntityClientGadget; import emu.grasscutter.game.entity.EntityClientGadget;
import emu.grasscutter.game.entity.EntityGadget; import emu.grasscutter.game.entity.EntityGadget;
@ -337,6 +338,14 @@ public class GenshinScene {
} }
} }
// World level
WorldLevelData worldLevelData = GenshinData.getWorldLevelDataMap().get(player.getWorldLevel());
int worldLevelOverride = 0;
if (worldLevelData != null) {
worldLevelOverride = worldLevelData.getMonsterLevel();
}
// Todo // Todo
List<GenshinEntity> toAdd = new LinkedList<>(); List<GenshinEntity> toAdd = new LinkedList<>();
List<GenshinEntity> toRemove = new LinkedList<>(); List<GenshinEntity> toRemove = new LinkedList<>();
@ -350,7 +359,7 @@ public class GenshinScene {
continue; continue;
} }
EntityMonster entity = new EntityMonster(this, data, entry.getPos(), entry.getLevel()); EntityMonster entity = new EntityMonster(this, data, entry.getPos(), worldLevelOverride > 0 ? worldLevelOverride : entry.getLevel());
entity.getRotation().set(entry.getRot()); entity.getRotation().set(entry.getRot());
entity.setGroupId(entry.getGroup().getGroupId()); entity.setGroupId(entry.getGroup().getGroupId());
entity.setPoseId(entry.getPoseId()); entity.setPoseId(entry.getPoseId());