mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2026-05-18 12:00:25 +08:00
Block loader (sort and merge gadgets into different blocks) (#1517)
Original commits: * block loader * fix * fix * fix foolish bug * add scales * rename * set to 600 * nitpick Co-authored-by: AnimeGitB <AnimeGitB@bigblueball.in>
This commit is contained in:
committed by
GitHub
Unverified
parent
7f898417b0
commit
6c49fab137
@@ -5,29 +5,27 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.danilopianini.util.FlexibleQuadTree;
|
||||
import org.danilopianini.util.SpatialIndex;
|
||||
|
||||
import emu.grasscutter.Grasscutter;
|
||||
import emu.grasscutter.data.ResourceLoader.AvatarConfig;
|
||||
import emu.grasscutter.data.ResourceLoader.AvatarConfigAbility;
|
||||
import emu.grasscutter.data.excels.ReliquaryAffixData;
|
||||
import emu.grasscutter.data.excels.ReliquaryMainPropData;
|
||||
import emu.grasscutter.game.world.SpawnDataEntry;
|
||||
import emu.grasscutter.game.world.SpawnDataEntry.SpawnGroupEntry;
|
||||
import emu.grasscutter.utils.WeightedList;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
|
||||
|
||||
public class GameDepot {
|
||||
public static final int[] BLOCK_SIZE = new int[]{50,500};//Scales
|
||||
|
||||
private static Int2ObjectMap<WeightedList<ReliquaryMainPropData>> relicRandomMainPropDepot = new Int2ObjectOpenHashMap<>();
|
||||
private static Int2ObjectMap<List<ReliquaryMainPropData>> relicMainPropDepot = new Int2ObjectOpenHashMap<>();
|
||||
private static Int2ObjectMap<List<ReliquaryAffixData>> relicAffixDepot = new Int2ObjectOpenHashMap<>();
|
||||
|
||||
|
||||
private static Map<String, AvatarConfig> playerAbilities = new HashMap<>();
|
||||
private static Int2ObjectMap<SpatialIndex<SpawnGroupEntry>> spawnLists = new Int2ObjectOpenHashMap<>();
|
||||
|
||||
public static void load() {
|
||||
private static HashMap<SpawnDataEntry.GridBlockId, ArrayList<SpawnDataEntry>> spawnLists = new HashMap<>();
|
||||
|
||||
public static void load() {
|
||||
for (ReliquaryMainPropData data : GameData.getReliquaryMainPropDataMap().values()) {
|
||||
if (data.getWeight() <= 0 || data.getPropDepotId() <= 0) {
|
||||
continue;
|
||||
@@ -49,7 +47,7 @@ public class GameDepot {
|
||||
Grasscutter.getLogger().error("Relic properties are missing weights! Please check your ReliquaryMainPropExcelConfigData or ReliquaryAffixExcelConfigData files in your ExcelBinOutput folder.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static ReliquaryMainPropData getRandomRelicMainProp(int depot) {
|
||||
WeightedList<ReliquaryMainPropData> depotList = relicRandomMainPropDepot.get(depot);
|
||||
if (depotList == null) {
|
||||
@@ -57,7 +55,7 @@ public class GameDepot {
|
||||
}
|
||||
return depotList.next();
|
||||
}
|
||||
|
||||
|
||||
public static List<ReliquaryMainPropData> getRelicMainPropList(int depot) {
|
||||
return relicMainPropDepot.get(depot);
|
||||
}
|
||||
@@ -65,20 +63,20 @@ public class GameDepot {
|
||||
public static List<ReliquaryAffixData> getRelicAffixList(int depot) {
|
||||
return relicAffixDepot.get(depot);
|
||||
}
|
||||
|
||||
public static Int2ObjectMap<SpatialIndex<SpawnGroupEntry>> getSpawnLists() {
|
||||
return spawnLists;
|
||||
}
|
||||
|
||||
public static SpatialIndex<SpawnGroupEntry> getSpawnListById(int sceneId) {
|
||||
return getSpawnLists().computeIfAbsent(sceneId, id -> new FlexibleQuadTree<>());
|
||||
}
|
||||
|
||||
public static Map<String, AvatarConfig> getPlayerAbilities() {
|
||||
return playerAbilities;
|
||||
}
|
||||
public static HashMap<SpawnDataEntry.GridBlockId, ArrayList<SpawnDataEntry>> getSpawnLists() {
|
||||
return spawnLists;
|
||||
}
|
||||
|
||||
public static void addSpawnListById(HashMap<SpawnDataEntry.GridBlockId, ArrayList<SpawnDataEntry>> data) {
|
||||
spawnLists.putAll(data);
|
||||
}
|
||||
|
||||
public static void setPlayerAbilities(Map<String, AvatarConfig> playerAbilities) {
|
||||
GameDepot.playerAbilities = playerAbilities;
|
||||
}
|
||||
|
||||
public static Map<String, AvatarConfig> getPlayerAbilities() {
|
||||
return playerAbilities;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user