mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2025-12-18 09:54:59 +01:00
Initial commit
This commit is contained in:
212
src/main/java/emu/grasscutter/data/GenshinData.java
Normal file
212
src/main/java/emu/grasscutter/data/GenshinData.java
Normal file
@@ -0,0 +1,212 @@
|
||||
package emu.grasscutter.data;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import emu.grasscutter.Grasscutter;
|
||||
import emu.grasscutter.utils.Utils;
|
||||
import emu.grasscutter.data.custom.AbilityEmbryoEntry;
|
||||
import emu.grasscutter.data.custom.OpenConfigEntry;
|
||||
import emu.grasscutter.data.def.*;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectLinkedOpenHashMap;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
|
||||
|
||||
public class GenshinData {
|
||||
// BinOutputs
|
||||
private static final Int2ObjectMap<String> abilityHashes = new Int2ObjectOpenHashMap<>();
|
||||
private static final Map<String, AbilityEmbryoEntry> abilityEmbryos = new HashMap<>();
|
||||
private static final Map<String, OpenConfigEntry> openConfigEntries = new HashMap<>();
|
||||
|
||||
// ExcelConfigs
|
||||
private static final Int2ObjectMap<PlayerLevelData> playerLevelDataMap = new Int2ObjectOpenHashMap<>();
|
||||
|
||||
private static final Int2ObjectMap<AvatarData> avatarDataMap = new Int2ObjectOpenHashMap<>();
|
||||
private static final Int2ObjectMap<AvatarLevelData> avatarLevelDataMap = new Int2ObjectOpenHashMap<>();
|
||||
private static final Int2ObjectMap<AvatarSkillDepotData> avatarSkillDepotDataMap = new Int2ObjectOpenHashMap<>();
|
||||
private static final Int2ObjectMap<AvatarSkillData> avatarSkillDataMap = new Int2ObjectOpenHashMap<>();
|
||||
private static final Int2ObjectMap<AvatarCurveData> avatarCurveDataMap = new Int2ObjectLinkedOpenHashMap<>();
|
||||
private static final Int2ObjectMap<AvatarPromoteData> avatarPromoteDataMap = new Int2ObjectOpenHashMap<>();
|
||||
private static final Int2ObjectMap<AvatarTalentData> avatarTalentDataMap = new Int2ObjectOpenHashMap<>();
|
||||
private static final Int2ObjectMap<ProudSkillData> proudSkillDataMap = new Int2ObjectOpenHashMap<>();
|
||||
|
||||
private static final Int2ObjectMap<ItemData> itemDataMap = new Int2ObjectOpenHashMap<>();
|
||||
private static final Int2ObjectMap<ReliquaryLevelData> reliquaryLevelDataMap = new Int2ObjectOpenHashMap<>();
|
||||
private static final Int2ObjectMap<ReliquaryAffixData> reliquaryAffixDataMap = new Int2ObjectOpenHashMap<>();
|
||||
private static final Int2ObjectMap<ReliquaryMainPropData> reliquaryMainPropDataMap = new Int2ObjectOpenHashMap<>();
|
||||
private static final Int2ObjectMap<ReliquarySetData> reliquarySetDataMap = new Int2ObjectOpenHashMap<>();
|
||||
private static final Int2ObjectMap<WeaponLevelData> weaponLevelDataMap = new Int2ObjectOpenHashMap<>();
|
||||
private static final Int2ObjectMap<WeaponPromoteData> weaponPromoteDataMap = new Int2ObjectOpenHashMap<>();
|
||||
private static final Int2ObjectMap<WeaponCurveData> weaponCurveDataMap = new Int2ObjectOpenHashMap<>();
|
||||
private static final Int2ObjectMap<EquipAffixData> equipAffixDataMap = new Int2ObjectOpenHashMap<>();
|
||||
|
||||
private static final Int2ObjectMap<MonsterData> monsterDataMap = new Int2ObjectOpenHashMap<>();
|
||||
private static final Int2ObjectMap<NpcData> npcDataMap = new Int2ObjectOpenHashMap<>();
|
||||
private static final Int2ObjectMap<GadgetData> gadgetDataMap = new Int2ObjectOpenHashMap<>();
|
||||
private static final Int2ObjectMap<MonsterCurveData> monsterCurveDataMap = new Int2ObjectOpenHashMap<>();
|
||||
private static final Int2ObjectMap<MonsterDescribeData> monsterDescribeDataMap = new Int2ObjectOpenHashMap<>();
|
||||
|
||||
private static final Int2ObjectMap<AvatarFlycloakData> avatarFlycloakDataMap = new Int2ObjectLinkedOpenHashMap<>();
|
||||
private static final Int2ObjectMap<AvatarCostumeData> avatarCostumeDataMap = new Int2ObjectLinkedOpenHashMap<>();
|
||||
private static final Int2ObjectMap<AvatarCostumeData> avatarCostumeDataItemIdMap = new Int2ObjectLinkedOpenHashMap<>();
|
||||
|
||||
public static Int2ObjectMap<?> getMapByResourceDef(Class<?> resourceDefinition) {
|
||||
Int2ObjectMap<?> map = null;
|
||||
|
||||
try {
|
||||
Field field = GenshinData.class.getDeclaredField(Utils.lowerCaseFirstChar(resourceDefinition.getSimpleName()) + "Map");
|
||||
field.setAccessible(true);
|
||||
|
||||
map = (Int2ObjectMap<?>) field.get(null);
|
||||
|
||||
field.setAccessible(false);
|
||||
} catch (Exception e) {
|
||||
Grasscutter.getLogger().error("Error fetching resource map for " + resourceDefinition.getSimpleName(), e);
|
||||
}
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
public static Int2ObjectMap<String> getAbilityHashes() {
|
||||
return abilityHashes;
|
||||
}
|
||||
|
||||
public static Map<String, AbilityEmbryoEntry> getAbilityEmbryoInfo() {
|
||||
return abilityEmbryos;
|
||||
}
|
||||
|
||||
public static Map<String, OpenConfigEntry> getOpenConfigEntries() {
|
||||
return openConfigEntries;
|
||||
}
|
||||
|
||||
public static Int2ObjectMap<AvatarData> getAvatarDataMap() {
|
||||
return avatarDataMap;
|
||||
}
|
||||
|
||||
public static Int2ObjectMap<ItemData> getItemDataMap() {
|
||||
return itemDataMap;
|
||||
}
|
||||
|
||||
public static Int2ObjectMap<AvatarSkillDepotData> getAvatarSkillDepotDataMap() {
|
||||
return avatarSkillDepotDataMap;
|
||||
}
|
||||
|
||||
public static Int2ObjectMap<AvatarSkillData> getAvatarSkillDataMap() {
|
||||
return avatarSkillDataMap;
|
||||
}
|
||||
|
||||
public static Int2ObjectMap<PlayerLevelData> getPlayerLevelDataMap() {
|
||||
return playerLevelDataMap;
|
||||
}
|
||||
|
||||
public static Int2ObjectMap<AvatarLevelData> getAvatarLevelDataMap() {
|
||||
return avatarLevelDataMap;
|
||||
}
|
||||
|
||||
public static Int2ObjectMap<WeaponLevelData> getWeaponLevelDataMap() {
|
||||
return weaponLevelDataMap;
|
||||
}
|
||||
|
||||
public static Int2ObjectMap<ReliquaryAffixData> getReliquaryAffixDataMap() {
|
||||
return reliquaryAffixDataMap;
|
||||
}
|
||||
|
||||
public static Int2ObjectMap<ReliquaryMainPropData> getReliquaryMainPropDataMap() {
|
||||
return reliquaryMainPropDataMap;
|
||||
}
|
||||
|
||||
public static Int2ObjectMap<WeaponPromoteData> getWeaponPromoteDataMap() {
|
||||
return weaponPromoteDataMap;
|
||||
}
|
||||
|
||||
public static Int2ObjectMap<WeaponCurveData> getWeaponCurveDataMap() {
|
||||
return weaponCurveDataMap;
|
||||
}
|
||||
|
||||
public static Int2ObjectMap<AvatarCurveData> getAvatarCurveDataMap() {
|
||||
return avatarCurveDataMap;
|
||||
}
|
||||
|
||||
public static int getRelicExpRequired(int rankLevel, int level) {
|
||||
ReliquaryLevelData levelData = reliquaryLevelDataMap.get((rankLevel << 8) + level);
|
||||
return levelData != null ? levelData.getExp() : 0;
|
||||
}
|
||||
|
||||
public static ReliquaryLevelData getRelicLevelData(int rankLevel, int level) {
|
||||
return reliquaryLevelDataMap.get((rankLevel << 8) + level);
|
||||
}
|
||||
|
||||
public static WeaponPromoteData getWeaponPromoteData(int promoteId, int promoteLevel) {
|
||||
return weaponPromoteDataMap.get((promoteId << 8) + promoteLevel);
|
||||
}
|
||||
|
||||
public static int getWeaponExpRequired(int rankLevel, int level) {
|
||||
WeaponLevelData levelData = weaponLevelDataMap.get(level);
|
||||
if (levelData == null) {
|
||||
return 0;
|
||||
}
|
||||
try {
|
||||
return levelData.getRequiredExps()[rankLevel - 1];
|
||||
} catch (Exception e) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public static AvatarPromoteData getAvatarPromoteData(int promoteId, int promoteLevel) {
|
||||
return avatarPromoteDataMap.get((promoteId << 8) + promoteLevel);
|
||||
}
|
||||
|
||||
public static int getAvatarLevelExpRequired(int level) {
|
||||
AvatarLevelData levelData = avatarLevelDataMap.get(level);
|
||||
return levelData != null ? levelData.getExp() : 0;
|
||||
}
|
||||
|
||||
public static Int2ObjectMap<ProudSkillData> getProudSkillDataMap() {
|
||||
return proudSkillDataMap;
|
||||
}
|
||||
|
||||
public static Int2ObjectMap<MonsterData> getMonsterDataMap() {
|
||||
return monsterDataMap;
|
||||
}
|
||||
|
||||
public static Int2ObjectMap<NpcData> getNpcDataMap() {
|
||||
return npcDataMap;
|
||||
}
|
||||
|
||||
public static Int2ObjectMap<GadgetData> getGadgetDataMap() {
|
||||
return gadgetDataMap;
|
||||
}
|
||||
|
||||
public static Int2ObjectMap<ReliquarySetData> getReliquarySetDataMap() {
|
||||
return reliquarySetDataMap;
|
||||
}
|
||||
|
||||
public static Int2ObjectMap<EquipAffixData> getEquipAffixDataMap() {
|
||||
return equipAffixDataMap;
|
||||
}
|
||||
|
||||
public static Int2ObjectMap<MonsterCurveData> getMonsterCurveDataMap() {
|
||||
return monsterCurveDataMap;
|
||||
}
|
||||
|
||||
public static Int2ObjectMap<MonsterDescribeData> getMonsterDescribeDataMap() {
|
||||
return monsterDescribeDataMap;
|
||||
}
|
||||
|
||||
public static Int2ObjectMap<AvatarTalentData> getAvatarTalentDataMap() {
|
||||
return avatarTalentDataMap;
|
||||
}
|
||||
|
||||
public static Int2ObjectMap<AvatarFlycloakData> getAvatarFlycloakDataMap() {
|
||||
return avatarFlycloakDataMap;
|
||||
}
|
||||
|
||||
public static Int2ObjectMap<AvatarCostumeData> getAvatarCostumeDataMap() {
|
||||
return avatarCostumeDataMap;
|
||||
}
|
||||
|
||||
public static Int2ObjectMap<AvatarCostumeData> getAvatarCostumeDataItemIdMap() {
|
||||
return avatarCostumeDataItemIdMap;
|
||||
}
|
||||
}
|
||||
49
src/main/java/emu/grasscutter/data/GenshinDepot.java
Normal file
49
src/main/java/emu/grasscutter/data/GenshinDepot.java
Normal file
@@ -0,0 +1,49 @@
|
||||
package emu.grasscutter.data;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import emu.grasscutter.Grasscutter;
|
||||
import emu.grasscutter.data.def.ReliquaryAffixData;
|
||||
import emu.grasscutter.data.def.ReliquaryMainPropData;
|
||||
import emu.grasscutter.utils.WeightedList;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
|
||||
|
||||
public class GenshinDepot {
|
||||
private static Int2ObjectMap<WeightedList<ReliquaryMainPropData>> relicMainPropDepot = new Int2ObjectOpenHashMap<>();
|
||||
private static Int2ObjectMap<List<ReliquaryAffixData>> relicAffixDepot = new Int2ObjectOpenHashMap<>();
|
||||
|
||||
public static void load() {
|
||||
for (ReliquaryMainPropData data : GenshinData.getReliquaryMainPropDataMap().values()) {
|
||||
if (data.getWeight() <= 0 || data.getPropDepotId() <= 0) {
|
||||
continue;
|
||||
}
|
||||
WeightedList<ReliquaryMainPropData> list = relicMainPropDepot.computeIfAbsent(data.getPropDepotId(), k -> new WeightedList<>());
|
||||
list.add(data.getWeight(), data);
|
||||
}
|
||||
for (ReliquaryAffixData data : GenshinData.getReliquaryAffixDataMap().values()) {
|
||||
if (data.getWeight() <= 0 || data.getDepotId() <= 0) {
|
||||
continue;
|
||||
}
|
||||
List<ReliquaryAffixData> list = relicAffixDepot.computeIfAbsent(data.getDepotId(), k -> new ArrayList<>());
|
||||
list.add(data);
|
||||
}
|
||||
// Let the server owner know if theyre missing weights
|
||||
if (relicMainPropDepot.size() == 0 || relicAffixDepot.size() == 0) {
|
||||
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 = relicMainPropDepot.get(depot);
|
||||
if (depotList == null) {
|
||||
return null;
|
||||
}
|
||||
return depotList.next();
|
||||
}
|
||||
|
||||
public static List<ReliquaryAffixData> getRandomRelicAffixList(int depot) {
|
||||
return relicAffixDepot.get(depot);
|
||||
}
|
||||
}
|
||||
12
src/main/java/emu/grasscutter/data/GenshinResource.java
Normal file
12
src/main/java/emu/grasscutter/data/GenshinResource.java
Normal file
@@ -0,0 +1,12 @@
|
||||
package emu.grasscutter.data;
|
||||
|
||||
public abstract class GenshinResource {
|
||||
|
||||
public int getId() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void onLoad() {
|
||||
|
||||
}
|
||||
}
|
||||
281
src/main/java/emu/grasscutter/data/ResourceLoader.java
Normal file
281
src/main/java/emu/grasscutter/data/ResourceLoader.java
Normal file
@@ -0,0 +1,281 @@
|
||||
package emu.grasscutter.data;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileReader;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.TreeMap;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import org.reflections.Reflections;
|
||||
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
|
||||
import emu.grasscutter.Grasscutter;
|
||||
import emu.grasscutter.data.custom.AbilityEmbryoEntry;
|
||||
import emu.grasscutter.data.custom.OpenConfigEntry;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
||||
|
||||
public class ResourceLoader {
|
||||
|
||||
public static List<Class<?>> getResourceDefClasses() {
|
||||
Reflections reflections = new Reflections(ResourceLoader.class.getPackage().getName());
|
||||
Set<?> classes = reflections.getSubTypesOf(GenshinResource.class);
|
||||
|
||||
List<Class<?>> classList = new ArrayList<>(classes.size());
|
||||
classes.forEach(o -> {
|
||||
Class<?> c = (Class<?>) o;
|
||||
if (c.getAnnotation(ResourceType.class) != null) {
|
||||
classList.add(c);
|
||||
}
|
||||
});
|
||||
|
||||
classList.sort((a, b) -> {
|
||||
return b.getAnnotation(ResourceType.class).loadPriority().value() - a.getAnnotation(ResourceType.class).loadPriority().value();
|
||||
});
|
||||
|
||||
return classList;
|
||||
}
|
||||
|
||||
public static void loadAll() {
|
||||
// Create resource folder if it doesnt exist
|
||||
File resFolder = new File(Grasscutter.getConfig().RESOURCE_FOLDER);
|
||||
if (!resFolder.exists()) {
|
||||
resFolder.mkdir();
|
||||
}
|
||||
// Load ability lists
|
||||
loadAbilityEmbryos();
|
||||
loadOpenConfig();
|
||||
// Load resources
|
||||
loadResources();
|
||||
// Process into depots
|
||||
GenshinDepot.load();
|
||||
// Custom - TODO move this somewhere else
|
||||
try {
|
||||
GenshinData.getAvatarSkillDepotDataMap().get(504).setAbilities(
|
||||
new AbilityEmbryoEntry(
|
||||
"",
|
||||
new String[] {
|
||||
"Avatar_PlayerBoy_ExtraAttack_Wind",
|
||||
"Avatar_Player_UziExplode_Mix",
|
||||
"Avatar_Player_UziExplode",
|
||||
"Avatar_Player_UziExplode_Strike_01",
|
||||
"Avatar_Player_UziExplode_Strike_02",
|
||||
"Avatar_Player_WindBreathe",
|
||||
"Avatar_Player_WindBreathe_CameraController"
|
||||
}
|
||||
));
|
||||
GenshinData.getAvatarSkillDepotDataMap().get(704).setAbilities(
|
||||
new AbilityEmbryoEntry(
|
||||
"",
|
||||
new String[] {
|
||||
"Avatar_PlayerGirl_ExtraAttack_Wind",
|
||||
"Avatar_Player_UziExplode_Mix",
|
||||
"Avatar_Player_UziExplode",
|
||||
"Avatar_Player_UziExplode_Strike_01",
|
||||
"Avatar_Player_UziExplode_Strike_02",
|
||||
"Avatar_Player_WindBreathe",
|
||||
"Avatar_Player_WindBreathe_CameraController"
|
||||
}
|
||||
));
|
||||
} catch (Exception e) {
|
||||
Grasscutter.getLogger().error("Error loading abilities", e);
|
||||
}
|
||||
}
|
||||
|
||||
public static void loadResources() {
|
||||
for (Class<?> resourceDefinition : getResourceDefClasses()) {
|
||||
ResourceType type = resourceDefinition.getAnnotation(ResourceType.class);
|
||||
|
||||
if (type == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
Int2ObjectMap map = GenshinData.getMapByResourceDef(resourceDefinition);
|
||||
|
||||
if (map == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
try {
|
||||
loadFromResource(resourceDefinition, type, map);
|
||||
} catch (Exception e) {
|
||||
Grasscutter.getLogger().error("Error loading resource file: " + type.name(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
protected static void loadFromResource(Class<?> c, ResourceType type, Int2ObjectMap map) throws Exception {
|
||||
for (String name : type.name()) {
|
||||
loadFromResource(c, name, map);
|
||||
}
|
||||
Grasscutter.getLogger().info("Loaded " + map.size() + " " + c.getSimpleName() + "s.");
|
||||
}
|
||||
|
||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||
protected static void loadFromResource(Class<?> c, String fileName, Int2ObjectMap map) throws Exception {
|
||||
try (FileReader fileReader = new FileReader(Grasscutter.getConfig().RESOURCE_FOLDER + "ExcelBinOutput/" + fileName)) {
|
||||
List list = Grasscutter.getGsonFactory().fromJson(fileReader, TypeToken.getParameterized(Collection.class, c).getType());
|
||||
|
||||
for (Object o : list) {
|
||||
GenshinResource res = (GenshinResource) o;
|
||||
res.onLoad();
|
||||
map.put(res.getId(), res);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void loadAbilityEmbryos() {
|
||||
// Read from cached file if exists
|
||||
File embryoCache = new File(Grasscutter.getConfig().DATA_FOLDER + "AbilityEmbryos.json");
|
||||
List<AbilityEmbryoEntry> embryoList = null;
|
||||
|
||||
if (embryoCache.exists()) {
|
||||
// Load from cache
|
||||
try (FileReader fileReader = new FileReader(embryoCache)) {
|
||||
embryoList = Grasscutter.getGsonFactory().fromJson(fileReader, TypeToken.getParameterized(Collection.class, AbilityEmbryoEntry.class).getType());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
// Load from BinOutput
|
||||
Pattern pattern = Pattern.compile("(?<=ConfigAvatar_)(.*?)(?=.json)");
|
||||
|
||||
embryoList = new LinkedList<>();
|
||||
File folder = new File(Grasscutter.getConfig().RESOURCE_FOLDER + "BinOutput\\Avatar\\");
|
||||
for (File file : folder.listFiles()) {
|
||||
AvatarConfig config = null;
|
||||
String avatarName = null;
|
||||
|
||||
Matcher matcher = pattern.matcher(file.getName());
|
||||
if (matcher.find()) {
|
||||
avatarName = matcher.group(0);
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
|
||||
try (FileReader fileReader = new FileReader(file)) {
|
||||
config = Grasscutter.getGsonFactory().fromJson(fileReader, AvatarConfig.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
continue;
|
||||
}
|
||||
|
||||
if (config.abilities == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
int s = config.abilities.size();
|
||||
AbilityEmbryoEntry al = new AbilityEmbryoEntry(avatarName, config.abilities.stream().map(Object::toString).toArray(size -> new String[s]));
|
||||
embryoList.add(al);
|
||||
}
|
||||
}
|
||||
|
||||
if (embryoList == null || embryoList.isEmpty()) {
|
||||
Grasscutter.getLogger().error("No embryos loaded!");
|
||||
return;
|
||||
}
|
||||
|
||||
for (AbilityEmbryoEntry entry : embryoList) {
|
||||
GenshinData.getAbilityEmbryoInfo().put(entry.getName(), entry);
|
||||
}
|
||||
}
|
||||
|
||||
private static void loadOpenConfig() {
|
||||
// Read from cached file if exists
|
||||
File openConfigCache = new File(Grasscutter.getConfig().DATA_FOLDER + "OpenConfig.json");
|
||||
List<OpenConfigEntry> list = null;
|
||||
|
||||
if (openConfigCache.exists()) {
|
||||
try (FileReader fileReader = new FileReader(openConfigCache)) {
|
||||
list = Grasscutter.getGsonFactory().fromJson(fileReader, TypeToken.getParameterized(Collection.class, OpenConfigEntry.class).getType());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
Map<String, OpenConfigEntry> map = new TreeMap<>();
|
||||
java.lang.reflect.Type type = new TypeToken<Map<String, OpenConfigData[]>>() {}.getType();
|
||||
String[] folderNames = {"BinOutput\\Talent\\EquipTalents\\", "BinOutput\\Talent\\AvatarTalents\\"};
|
||||
|
||||
for (String name : folderNames) {
|
||||
File folder = new File(Grasscutter.getConfig().RESOURCE_FOLDER + name);
|
||||
|
||||
for (File file : folder.listFiles()) {
|
||||
if (!file.getName().endsWith(".json")) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Map<String, OpenConfigData[]> config = null;
|
||||
|
||||
try (FileReader fileReader = new FileReader(file)) {
|
||||
config = Grasscutter.getGsonFactory().fromJson(fileReader, type);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
continue;
|
||||
}
|
||||
|
||||
for (Entry<String, OpenConfigData[]> e : config.entrySet()) {
|
||||
List<String> abilityList = new ArrayList<>();
|
||||
int extraTalentIndex = 0;
|
||||
|
||||
for (OpenConfigData entry : e.getValue()) {
|
||||
if (entry.$type.contains("AddAbility")) {
|
||||
abilityList.add(entry.abilityName);
|
||||
} else if (entry.talentIndex > 0) {
|
||||
extraTalentIndex = entry.talentIndex;
|
||||
}
|
||||
}
|
||||
|
||||
OpenConfigEntry entry = new OpenConfigEntry(e.getKey(), abilityList, extraTalentIndex);
|
||||
map.put(entry.getName(), entry);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
list = new ArrayList<>(map.values());
|
||||
}
|
||||
|
||||
if (list == null || list.isEmpty()) {
|
||||
Grasscutter.getLogger().error("No openconfig entries loaded!");
|
||||
return;
|
||||
}
|
||||
|
||||
for (OpenConfigEntry entry : list) {
|
||||
GenshinData.getOpenConfigEntries().put(entry.getName(), entry);
|
||||
}
|
||||
}
|
||||
|
||||
// BinOutput configs
|
||||
|
||||
private static class AvatarConfig {
|
||||
public ArrayList<AvatarConfigAbility> abilities;
|
||||
|
||||
private static class AvatarConfigAbility {
|
||||
public String abilityName;
|
||||
public String toString() {
|
||||
return abilityName;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static class OpenConfig {
|
||||
public OpenConfigData[] data;
|
||||
}
|
||||
|
||||
private static class OpenConfigData {
|
||||
public String $type;
|
||||
public String abilityName;
|
||||
public int talentIndex;
|
||||
}
|
||||
}
|
||||
32
src/main/java/emu/grasscutter/data/ResourceType.java
Normal file
32
src/main/java/emu/grasscutter/data/ResourceType.java
Normal file
@@ -0,0 +1,32 @@
|
||||
package emu.grasscutter.data;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface ResourceType {
|
||||
|
||||
/** Names of the file that this Resource loads from */
|
||||
String[] name();
|
||||
|
||||
/** Load priority - dictates which order to load this resource, with "highest" being loaded first */
|
||||
LoadPriority loadPriority() default LoadPriority.NORMAL;
|
||||
|
||||
public enum LoadPriority {
|
||||
HIGHEST (4),
|
||||
HIGH (3),
|
||||
NORMAL (2),
|
||||
LOW (1),
|
||||
LOWEST (0);
|
||||
|
||||
private final int value;
|
||||
|
||||
LoadPriority(int value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public int value() {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
}
|
||||
17
src/main/java/emu/grasscutter/data/common/CurveInfo.java
Normal file
17
src/main/java/emu/grasscutter/data/common/CurveInfo.java
Normal file
@@ -0,0 +1,17 @@
|
||||
package emu.grasscutter.data.common;
|
||||
|
||||
public class CurveInfo {
|
||||
private String Type;
|
||||
private String Arith;
|
||||
private float Value;
|
||||
|
||||
public String getType() {
|
||||
return Type;
|
||||
}
|
||||
public String getArith() {
|
||||
return Arith;
|
||||
}
|
||||
public float getValue() {
|
||||
return Value;
|
||||
}
|
||||
}
|
||||
25
src/main/java/emu/grasscutter/data/common/FightPropData.java
Normal file
25
src/main/java/emu/grasscutter/data/common/FightPropData.java
Normal file
@@ -0,0 +1,25 @@
|
||||
package emu.grasscutter.data.common;
|
||||
|
||||
import emu.grasscutter.game.props.FightProperty;
|
||||
|
||||
public class FightPropData {
|
||||
private String PropType;
|
||||
private FightProperty prop;
|
||||
private float Value;
|
||||
|
||||
public String getPropType() {
|
||||
return PropType;
|
||||
}
|
||||
|
||||
public float getValue() {
|
||||
return Value;
|
||||
}
|
||||
|
||||
public FightProperty getProp() {
|
||||
return prop;
|
||||
}
|
||||
|
||||
public void onLoad() {
|
||||
this.prop = FightProperty.getPropByName(PropType);
|
||||
}
|
||||
}
|
||||
14
src/main/java/emu/grasscutter/data/common/ItemParamData.java
Normal file
14
src/main/java/emu/grasscutter/data/common/ItemParamData.java
Normal file
@@ -0,0 +1,14 @@
|
||||
package emu.grasscutter.data.common;
|
||||
|
||||
public class ItemParamData {
|
||||
private int Id;
|
||||
private int Count;
|
||||
|
||||
public int getId() {
|
||||
return Id;
|
||||
}
|
||||
|
||||
public int getCount() {
|
||||
return Count;
|
||||
}
|
||||
}
|
||||
13
src/main/java/emu/grasscutter/data/common/PropGrowCurve.java
Normal file
13
src/main/java/emu/grasscutter/data/common/PropGrowCurve.java
Normal file
@@ -0,0 +1,13 @@
|
||||
package emu.grasscutter.data.common;
|
||||
|
||||
public class PropGrowCurve {
|
||||
private String Type;
|
||||
private String GrowCurve;
|
||||
|
||||
public String getType(){
|
||||
return this.Type;
|
||||
}
|
||||
public String getGrowCurve(){
|
||||
return this.GrowCurve;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package emu.grasscutter.data.custom;
|
||||
|
||||
public class AbilityEmbryoEntry {
|
||||
private String name;
|
||||
private String[] abilities;
|
||||
|
||||
public AbilityEmbryoEntry() {
|
||||
|
||||
}
|
||||
|
||||
public AbilityEmbryoEntry(String avatarName, String[] array) {
|
||||
this.name = avatarName;
|
||||
this.abilities = array;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String[] getAbilities() {
|
||||
return abilities;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package emu.grasscutter.data.custom;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class OpenConfigEntry {
|
||||
private String name;
|
||||
private String[] addAbilities;
|
||||
private int extraTalentIndex;
|
||||
|
||||
public OpenConfigEntry(String name, List<String> abilityList, int extraTalentIndex) {
|
||||
this.name = name;
|
||||
this.extraTalentIndex = extraTalentIndex;
|
||||
if (abilityList.size() > 0) {
|
||||
this.addAbilities = abilityList.toArray(new String[0]);
|
||||
}
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String[] getAddAbilities() {
|
||||
return addAbilities;
|
||||
}
|
||||
|
||||
public int getExtraTalentIndex() {
|
||||
return extraTalentIndex;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package emu.grasscutter.data.def;
|
||||
|
||||
import emu.grasscutter.data.GenshinData;
|
||||
import emu.grasscutter.data.GenshinResource;
|
||||
import emu.grasscutter.data.ResourceType;
|
||||
|
||||
@ResourceType(name = "AvatarCostumeExcelConfigData.json")
|
||||
public class AvatarCostumeData extends GenshinResource {
|
||||
private int CostumeId;
|
||||
private int ItemId;
|
||||
private int AvatarId;
|
||||
|
||||
@Override
|
||||
public int getId() {
|
||||
return this.CostumeId;
|
||||
}
|
||||
|
||||
public int getItemId() {
|
||||
return this.ItemId;
|
||||
}
|
||||
|
||||
public int getAvatarId() {
|
||||
return AvatarId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoad() {
|
||||
GenshinData.getAvatarCostumeDataItemIdMap().put(this.getItemId(), this);
|
||||
}
|
||||
}
|
||||
36
src/main/java/emu/grasscutter/data/def/AvatarCurveData.java
Normal file
36
src/main/java/emu/grasscutter/data/def/AvatarCurveData.java
Normal file
@@ -0,0 +1,36 @@
|
||||
package emu.grasscutter.data.def;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import emu.grasscutter.data.GenshinResource;
|
||||
import emu.grasscutter.data.ResourceType;
|
||||
import emu.grasscutter.data.common.CurveInfo;
|
||||
|
||||
@ResourceType(name = "AvatarCurveExcelConfigData.json")
|
||||
public class AvatarCurveData extends GenshinResource {
|
||||
private int Level;
|
||||
private CurveInfo[] CurveInfos;
|
||||
|
||||
private Map<String, Float> curveInfos;
|
||||
|
||||
@Override
|
||||
public int getId() {
|
||||
return this.Level;
|
||||
}
|
||||
|
||||
public int getLevel() {
|
||||
return Level;
|
||||
}
|
||||
|
||||
public Map<String, Float> getCurveInfos() {
|
||||
return curveInfos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoad() {
|
||||
this.curveInfos = new HashMap<>();
|
||||
Stream.of(this.CurveInfos).forEach(info -> this.curveInfos.put(info.getType(), info.getValue()));
|
||||
}
|
||||
}
|
||||
246
src/main/java/emu/grasscutter/data/def/AvatarData.java
Normal file
246
src/main/java/emu/grasscutter/data/def/AvatarData.java
Normal file
@@ -0,0 +1,246 @@
|
||||
package emu.grasscutter.data.def;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import emu.grasscutter.data.GenshinData;
|
||||
import emu.grasscutter.data.GenshinResource;
|
||||
import emu.grasscutter.data.ResourceType;
|
||||
import emu.grasscutter.data.ResourceType.LoadPriority;
|
||||
import emu.grasscutter.data.common.PropGrowCurve;
|
||||
import emu.grasscutter.data.custom.AbilityEmbryoEntry;
|
||||
import emu.grasscutter.game.props.FightProperty;
|
||||
import emu.grasscutter.utils.Utils;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
||||
import it.unimi.dsi.fastutil.ints.IntArrayList;
|
||||
import it.unimi.dsi.fastutil.ints.IntList;
|
||||
|
||||
@ResourceType(name = "AvatarExcelConfigData.json", loadPriority = LoadPriority.LOW)
|
||||
public class AvatarData extends GenshinResource {
|
||||
|
||||
private String name;
|
||||
private String IconName;
|
||||
private String BodyType;
|
||||
private String QualityType;
|
||||
private int ChargeEfficiency;
|
||||
private int InitialWeapon;
|
||||
private String WeaponType;
|
||||
private String ImageName;
|
||||
private int AvatarPromoteId;
|
||||
private String CutsceneShow;
|
||||
private int SkillDepotId;
|
||||
private int StaminaRecoverSpeed;
|
||||
private List<String> CandSkillDepotIds;
|
||||
private long DescTextMapHash;
|
||||
private String AvatarIdentityType;
|
||||
private List<Integer> AvatarPromoteRewardLevelList;
|
||||
private List<Integer> AvatarPromoteRewardIdList;
|
||||
private int FeatureTagGroupID;
|
||||
|
||||
private long NameTextMapHash;
|
||||
private long GachaImageNameHashSuffix;
|
||||
private long InfoDescTextMapHash;
|
||||
|
||||
private float HpBase;
|
||||
private float AttackBase;
|
||||
private float DefenseBase;
|
||||
private float Critical;
|
||||
private float CriticalHurt;
|
||||
|
||||
private List<PropGrowCurve> PropGrowCurves;
|
||||
private int Id;
|
||||
|
||||
private Int2ObjectMap<String> growthCurveMap;
|
||||
private float[] hpGrowthCurve;
|
||||
private float[] attackGrowthCurve;
|
||||
private float[] defenseGrowthCurve;
|
||||
private AvatarSkillDepotData skillDepot;
|
||||
private IntList abilities;
|
||||
|
||||
@Override
|
||||
public int getId(){
|
||||
return this.Id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getBodyType(){
|
||||
return this.BodyType;
|
||||
}
|
||||
|
||||
public String getQualityType(){
|
||||
return this.QualityType;
|
||||
}
|
||||
|
||||
public int getChargeEfficiency(){
|
||||
return this.ChargeEfficiency;
|
||||
}
|
||||
|
||||
public int getInitialWeapon(){
|
||||
return this.InitialWeapon;
|
||||
}
|
||||
|
||||
public String getWeaponType(){
|
||||
return this.WeaponType;
|
||||
}
|
||||
|
||||
public String getImageName(){
|
||||
return this.ImageName;
|
||||
}
|
||||
|
||||
public int getAvatarPromoteId(){
|
||||
return this.AvatarPromoteId;
|
||||
}
|
||||
|
||||
public long getGachaImageNameHashSuffix(){
|
||||
return this.GachaImageNameHashSuffix;
|
||||
}
|
||||
|
||||
public String getCutsceneShow(){
|
||||
return this.CutsceneShow;
|
||||
}
|
||||
|
||||
public int getSkillDepotId(){
|
||||
return this.SkillDepotId;
|
||||
}
|
||||
|
||||
public int getStaminaRecoverSpeed(){
|
||||
return this.StaminaRecoverSpeed;
|
||||
}
|
||||
|
||||
public List<String> getCandSkillDepotIds(){
|
||||
return this.CandSkillDepotIds;
|
||||
}
|
||||
|
||||
public long getDescTextMapHash(){
|
||||
return this.DescTextMapHash;
|
||||
}
|
||||
|
||||
public String getAvatarIdentityType(){
|
||||
return this.AvatarIdentityType;
|
||||
}
|
||||
|
||||
public List<Integer> getAvatarPromoteRewardLevelList(){
|
||||
return this.AvatarPromoteRewardLevelList;
|
||||
}
|
||||
|
||||
public List<Integer> getAvatarPromoteRewardIdList(){
|
||||
return this.AvatarPromoteRewardIdList;
|
||||
}
|
||||
|
||||
public int getFeatureTagGroupID(){
|
||||
return this.FeatureTagGroupID;
|
||||
}
|
||||
|
||||
public long getInfoDescTextMapHash(){
|
||||
return this.InfoDescTextMapHash;
|
||||
}
|
||||
|
||||
public float getBaseHp(int level){
|
||||
try {
|
||||
return this.HpBase * this.hpGrowthCurve[level - 1];
|
||||
} catch (Exception e) {
|
||||
return this.HpBase;
|
||||
}
|
||||
}
|
||||
|
||||
public float getBaseAttack(int level){
|
||||
try {
|
||||
return this.AttackBase * this.attackGrowthCurve[level - 1];
|
||||
} catch (Exception e) {
|
||||
return this.AttackBase;
|
||||
}
|
||||
}
|
||||
|
||||
public float getBaseDefense(int level){
|
||||
try {
|
||||
return this.DefenseBase * this.defenseGrowthCurve[level - 1];
|
||||
} catch (Exception e) {
|
||||
return this.DefenseBase;
|
||||
}
|
||||
}
|
||||
|
||||
public float getBaseCritical(){
|
||||
return this.Critical;
|
||||
}
|
||||
|
||||
public float getBaseCriticalHurt(){
|
||||
return this.CriticalHurt;
|
||||
}
|
||||
|
||||
public float getGrowthCurveById(int level, FightProperty prop) {
|
||||
String growCurve = this.growthCurveMap.get(prop.getId());
|
||||
if (growCurve == null) {
|
||||
return 1f;
|
||||
}
|
||||
AvatarCurveData curveData = GenshinData.getAvatarCurveDataMap().get(level);
|
||||
if (curveData == null) {
|
||||
return 1f;
|
||||
}
|
||||
return curveData.getCurveInfos().getOrDefault(growCurve, 1f);
|
||||
}
|
||||
|
||||
public long getNameTextMapHash(){
|
||||
return this.NameTextMapHash;
|
||||
}
|
||||
|
||||
public AvatarSkillDepotData getSkillDepot() {
|
||||
return skillDepot;
|
||||
}
|
||||
|
||||
public IntList getAbilities() {
|
||||
return abilities;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoad() {
|
||||
this.skillDepot = GenshinData.getAvatarSkillDepotDataMap().get(this.SkillDepotId);
|
||||
|
||||
int size = GenshinData.getAvatarCurveDataMap().size();
|
||||
this.hpGrowthCurve = new float[size];
|
||||
this.attackGrowthCurve = new float[size];
|
||||
this.defenseGrowthCurve = new float[size];
|
||||
for (AvatarCurveData curveData : GenshinData.getAvatarCurveDataMap().values()) {
|
||||
int level = curveData.getLevel() - 1;
|
||||
for (PropGrowCurve growCurve : this.PropGrowCurves) {
|
||||
FightProperty prop = FightProperty.getPropByName(growCurve.getType());
|
||||
switch (prop) {
|
||||
case FIGHT_PROP_BASE_HP:
|
||||
this.hpGrowthCurve[level] = curveData.getCurveInfos().get(growCurve.getGrowCurve());
|
||||
break;
|
||||
case FIGHT_PROP_BASE_ATTACK:
|
||||
this.attackGrowthCurve[level] = curveData.getCurveInfos().get(growCurve.getGrowCurve());
|
||||
break;
|
||||
case FIGHT_PROP_BASE_DEFENSE:
|
||||
this.defenseGrowthCurve[level] = curveData.getCurveInfos().get(growCurve.getGrowCurve());
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
for (PropGrowCurve growCurve : this.PropGrowCurves) {
|
||||
FightProperty prop = FightProperty.getPropByName(growCurve.getType());
|
||||
this.growthCurveMap.put(prop.getId(), growCurve.getGrowCurve());
|
||||
}
|
||||
*/
|
||||
|
||||
// Cache abilities
|
||||
String[] split = this.IconName.split("_");
|
||||
if (split.length > 0) {
|
||||
this.name = split[split.length - 1];
|
||||
|
||||
AbilityEmbryoEntry info = GenshinData.getAbilityEmbryoInfo().get(this.name);
|
||||
if (info != null) {
|
||||
this.abilities = new IntArrayList(info.getAbilities().length);
|
||||
for (String ability : info.getAbilities()) {
|
||||
this.abilities.add(Utils.abilityHash(ability));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
package emu.grasscutter.data.def;
|
||||
|
||||
import emu.grasscutter.data.GenshinResource;
|
||||
import emu.grasscutter.data.ResourceType;
|
||||
|
||||
@ResourceType(name = "AvatarFlycloakExcelConfigData.json")
|
||||
public class AvatarFlycloakData extends GenshinResource {
|
||||
private int FlycloakId;
|
||||
private long NameTextMapHash;
|
||||
|
||||
@Override
|
||||
public int getId() {
|
||||
return this.FlycloakId;
|
||||
}
|
||||
|
||||
public long getNameTextMapHash() {
|
||||
return NameTextMapHash;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoad() {
|
||||
|
||||
}
|
||||
}
|
||||
23
src/main/java/emu/grasscutter/data/def/AvatarLevelData.java
Normal file
23
src/main/java/emu/grasscutter/data/def/AvatarLevelData.java
Normal file
@@ -0,0 +1,23 @@
|
||||
package emu.grasscutter.data.def;
|
||||
|
||||
import emu.grasscutter.data.GenshinResource;
|
||||
import emu.grasscutter.data.ResourceType;
|
||||
|
||||
@ResourceType(name = "AvatarLevelExcelConfigData.json")
|
||||
public class AvatarLevelData extends GenshinResource {
|
||||
private int Level;
|
||||
private int Exp;
|
||||
|
||||
@Override
|
||||
public int getId() {
|
||||
return this.Level;
|
||||
}
|
||||
|
||||
public int getLevel() {
|
||||
return Level;
|
||||
}
|
||||
|
||||
public int getExp() {
|
||||
return Exp;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
package emu.grasscutter.data.def;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import emu.grasscutter.data.GenshinResource;
|
||||
import emu.grasscutter.data.ResourceType;
|
||||
import emu.grasscutter.data.common.FightPropData;
|
||||
import emu.grasscutter.data.common.ItemParamData;
|
||||
|
||||
@ResourceType(name = "AvatarPromoteExcelConfigData.json")
|
||||
public class AvatarPromoteData extends GenshinResource {
|
||||
|
||||
private int AvatarPromoteId;
|
||||
private int PromoteLevel;
|
||||
private int ScoinCost;
|
||||
private ItemParamData[] CostItems;
|
||||
private int UnlockMaxLevel;
|
||||
private FightPropData[] AddProps;
|
||||
private int RequiredPlayerLevel;
|
||||
|
||||
@Override
|
||||
public int getId() {
|
||||
return (AvatarPromoteId << 8) + PromoteLevel;
|
||||
}
|
||||
|
||||
public int getAvatarPromoteId() {
|
||||
return AvatarPromoteId;
|
||||
}
|
||||
|
||||
public int getPromoteLevel() {
|
||||
return PromoteLevel;
|
||||
}
|
||||
|
||||
public ItemParamData[] getCostItems() {
|
||||
return CostItems;
|
||||
}
|
||||
|
||||
public int getCoinCost() {
|
||||
return ScoinCost;
|
||||
}
|
||||
|
||||
public FightPropData[] getAddProps() {
|
||||
return AddProps;
|
||||
}
|
||||
|
||||
public int getUnlockMaxLevel() {
|
||||
return UnlockMaxLevel;
|
||||
}
|
||||
|
||||
public int getRequiredPlayerLevel() {
|
||||
return RequiredPlayerLevel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoad() {
|
||||
// Trim item params
|
||||
ArrayList<ItemParamData> trim = new ArrayList<>(getAddProps().length);
|
||||
for (ItemParamData itemParam : getCostItems()) {
|
||||
if (itemParam.getId() == 0) {
|
||||
continue;
|
||||
}
|
||||
trim.add(itemParam);
|
||||
}
|
||||
this.CostItems = trim.toArray(new ItemParamData[trim.size()]);
|
||||
// Trim fight prop data (just in case)
|
||||
ArrayList<FightPropData> parsed = new ArrayList<>(getAddProps().length);
|
||||
for (FightPropData prop : getAddProps()) {
|
||||
if (prop.getPropType() != null && prop.getValue() != 0f) {
|
||||
prop.onLoad();
|
||||
parsed.add(prop);
|
||||
}
|
||||
}
|
||||
this.AddProps = parsed.toArray(new FightPropData[parsed.size()]);
|
||||
}
|
||||
}
|
||||
84
src/main/java/emu/grasscutter/data/def/AvatarSkillData.java
Normal file
84
src/main/java/emu/grasscutter/data/def/AvatarSkillData.java
Normal file
@@ -0,0 +1,84 @@
|
||||
package emu.grasscutter.data.def;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import emu.grasscutter.data.GenshinResource;
|
||||
import emu.grasscutter.data.ResourceType;
|
||||
import emu.grasscutter.data.ResourceType.LoadPriority;
|
||||
|
||||
@ResourceType(name = "AvatarSkillExcelConfigData.json", loadPriority = LoadPriority.HIGHEST)
|
||||
public class AvatarSkillData extends GenshinResource {
|
||||
private int Id;
|
||||
private float CdTime;
|
||||
private int CostElemVal;
|
||||
private int MaxChargeNum;
|
||||
private int TriggerID;
|
||||
private boolean IsAttackCameraLock;
|
||||
private int ProudSkillGroupId;
|
||||
private String CostElemType;
|
||||
private List<Float> LockWeightParams;
|
||||
|
||||
private long NameTextMapHash;
|
||||
|
||||
private String AbilityName;
|
||||
private String LockShape;
|
||||
private String GlobalValueKey;
|
||||
|
||||
@Override
|
||||
public int getId(){
|
||||
return this.Id;
|
||||
}
|
||||
|
||||
public float getCdTime() {
|
||||
return CdTime;
|
||||
}
|
||||
|
||||
public int getCostElemVal() {
|
||||
return CostElemVal;
|
||||
}
|
||||
|
||||
public int getMaxChargeNum() {
|
||||
return MaxChargeNum;
|
||||
}
|
||||
|
||||
public int getTriggerID() {
|
||||
return TriggerID;
|
||||
}
|
||||
|
||||
public boolean isIsAttackCameraLock() {
|
||||
return IsAttackCameraLock;
|
||||
}
|
||||
|
||||
public int getProudSkillGroupId() {
|
||||
return ProudSkillGroupId;
|
||||
}
|
||||
|
||||
public String getCostElemType() {
|
||||
return CostElemType;
|
||||
}
|
||||
|
||||
public List<Float> getLockWeightParams() {
|
||||
return LockWeightParams;
|
||||
}
|
||||
|
||||
public long getNameTextMapHash() {
|
||||
return NameTextMapHash;
|
||||
}
|
||||
|
||||
public String getAbilityName() {
|
||||
return AbilityName;
|
||||
}
|
||||
|
||||
public String getLockShape() {
|
||||
return LockShape;
|
||||
}
|
||||
|
||||
public String getGlobalValueKey() {
|
||||
return GlobalValueKey;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoad() {
|
||||
|
||||
}
|
||||
}
|
||||
123
src/main/java/emu/grasscutter/data/def/AvatarSkillDepotData.java
Normal file
123
src/main/java/emu/grasscutter/data/def/AvatarSkillDepotData.java
Normal file
@@ -0,0 +1,123 @@
|
||||
package emu.grasscutter.data.def;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import emu.grasscutter.data.GenshinData;
|
||||
import emu.grasscutter.data.GenshinResource;
|
||||
import emu.grasscutter.data.ResourceType;
|
||||
import emu.grasscutter.data.ResourceType.LoadPriority;
|
||||
import emu.grasscutter.data.custom.AbilityEmbryoEntry;
|
||||
import emu.grasscutter.game.props.ElementType;
|
||||
import emu.grasscutter.utils.Utils;
|
||||
import it.unimi.dsi.fastutil.ints.IntArrayList;
|
||||
import it.unimi.dsi.fastutil.ints.IntList;
|
||||
|
||||
@ResourceType(name = "AvatarSkillDepotExcelConfigData.json", loadPriority = LoadPriority.HIGH)
|
||||
public class AvatarSkillDepotData extends GenshinResource {
|
||||
|
||||
private int Id;
|
||||
private int EnergySkill;
|
||||
private int AttackModeSkill;
|
||||
|
||||
private List<Integer> Skills;
|
||||
private List<Integer> SubSkills;
|
||||
private List<String> ExtraAbilities;
|
||||
private List<Integer> Talents;
|
||||
private List<InherentProudSkillOpens> InherentProudSkillOpens;
|
||||
|
||||
private String TalentStarName;
|
||||
private String SkillDepotAbilityGroup;
|
||||
|
||||
private AvatarSkillData energySkillData;
|
||||
private ElementType elementType;
|
||||
private IntList abilities;
|
||||
|
||||
@Override
|
||||
public int getId(){
|
||||
return this.Id;
|
||||
}
|
||||
|
||||
public int getEnergySkill(){
|
||||
return this.EnergySkill;
|
||||
}
|
||||
|
||||
public List<Integer> getSkills(){
|
||||
return this.Skills;
|
||||
}
|
||||
|
||||
public List<Integer> getSubSkills(){
|
||||
return this.SubSkills;
|
||||
}
|
||||
|
||||
public int getAttackModeSkill(){
|
||||
return this.AttackModeSkill;
|
||||
}
|
||||
|
||||
public List<String> getExtraAbilities(){
|
||||
return this.ExtraAbilities;
|
||||
}
|
||||
|
||||
public List<Integer> getTalents(){
|
||||
return this.Talents;
|
||||
}
|
||||
|
||||
public String getTalentStarName(){
|
||||
return this.TalentStarName;
|
||||
}
|
||||
|
||||
public List<InherentProudSkillOpens> getInherentProudSkillOpens(){
|
||||
return this.InherentProudSkillOpens;
|
||||
}
|
||||
|
||||
public String getSkillDepotAbilityGroup(){
|
||||
return this.SkillDepotAbilityGroup;
|
||||
}
|
||||
|
||||
public AvatarSkillData getEnergySkillData() {
|
||||
return this.energySkillData;
|
||||
}
|
||||
|
||||
public ElementType getElementType() {
|
||||
return elementType;
|
||||
}
|
||||
|
||||
public IntList getAbilities() {
|
||||
return abilities;
|
||||
}
|
||||
|
||||
public void setAbilities(AbilityEmbryoEntry info) {
|
||||
this.abilities = new IntArrayList(info.getAbilities().length);
|
||||
for (String ability : info.getAbilities()) {
|
||||
this.abilities.add(Utils.abilityHash(ability));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoad() {
|
||||
this.energySkillData = GenshinData.getAvatarSkillDataMap().get(this.EnergySkill);
|
||||
if (getEnergySkillData() != null) {
|
||||
this.elementType = ElementType.getTypeByName(getEnergySkillData().getCostElemType());
|
||||
} else {
|
||||
this.elementType = ElementType.None;
|
||||
}
|
||||
}
|
||||
|
||||
public static class InherentProudSkillOpens {
|
||||
private int ProudSkillGroupId;
|
||||
|
||||
private int NeedAvatarPromoteLevel;
|
||||
|
||||
public void setProudSkillGroupId(int ProudSkillGroupId){
|
||||
this.ProudSkillGroupId = ProudSkillGroupId;
|
||||
}
|
||||
public int getProudSkillGroupId(){
|
||||
return this.ProudSkillGroupId;
|
||||
}
|
||||
public void setNeedAvatarPromoteLevel(int NeedAvatarPromoteLevel){
|
||||
this.NeedAvatarPromoteLevel = NeedAvatarPromoteLevel;
|
||||
}
|
||||
public int getNeedAvatarPromoteLevel(){
|
||||
return this.NeedAvatarPromoteLevel;
|
||||
}
|
||||
}
|
||||
}
|
||||
69
src/main/java/emu/grasscutter/data/def/AvatarTalentData.java
Normal file
69
src/main/java/emu/grasscutter/data/def/AvatarTalentData.java
Normal file
@@ -0,0 +1,69 @@
|
||||
package emu.grasscutter.data.def;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import emu.grasscutter.data.GenshinResource;
|
||||
import emu.grasscutter.data.ResourceType;
|
||||
import emu.grasscutter.data.ResourceType.LoadPriority;
|
||||
import emu.grasscutter.data.common.FightPropData;
|
||||
|
||||
@ResourceType(name = "AvatarTalentExcelConfigData.json", loadPriority = LoadPriority.HIGHEST)
|
||||
public class AvatarTalentData extends GenshinResource {
|
||||
private int TalentId;
|
||||
private int PrevTalent;
|
||||
private long NameTextMapHash;
|
||||
private String Icon;
|
||||
private int MainCostItemId;
|
||||
private int MainCostItemCount;
|
||||
private String OpenConfig;
|
||||
private FightPropData[] AddProps;
|
||||
private float[] ParamList;
|
||||
|
||||
@Override
|
||||
public int getId(){
|
||||
return this.TalentId;
|
||||
}
|
||||
|
||||
public int PrevTalent() {
|
||||
return PrevTalent;
|
||||
}
|
||||
|
||||
public long getNameTextMapHash() {
|
||||
return NameTextMapHash;
|
||||
}
|
||||
|
||||
public String getIcon() {
|
||||
return Icon;
|
||||
}
|
||||
|
||||
public int getMainCostItemId() {
|
||||
return MainCostItemId;
|
||||
}
|
||||
|
||||
public int getMainCostItemCount() {
|
||||
return MainCostItemCount;
|
||||
}
|
||||
|
||||
public String getOpenConfig() {
|
||||
return OpenConfig;
|
||||
}
|
||||
|
||||
public FightPropData[] getAddProps() {
|
||||
return AddProps;
|
||||
}
|
||||
|
||||
public float[] getParamList() {
|
||||
return ParamList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoad() {
|
||||
ArrayList<FightPropData> parsed = new ArrayList<FightPropData>(getAddProps().length);
|
||||
for (FightPropData prop : getAddProps()) {
|
||||
if (prop.getPropType() != null || prop.getValue() == 0f) {
|
||||
prop.onLoad();
|
||||
parsed.add(prop);
|
||||
}
|
||||
}
|
||||
this.AddProps = parsed.toArray(new FightPropData[parsed.size()]);
|
||||
}
|
||||
}
|
||||
59
src/main/java/emu/grasscutter/data/def/EquipAffixData.java
Normal file
59
src/main/java/emu/grasscutter/data/def/EquipAffixData.java
Normal file
@@ -0,0 +1,59 @@
|
||||
package emu.grasscutter.data.def;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import emu.grasscutter.data.GenshinResource;
|
||||
import emu.grasscutter.data.ResourceType;
|
||||
import emu.grasscutter.data.common.FightPropData;
|
||||
|
||||
@ResourceType(name = "EquipAffixExcelConfigData.json")
|
||||
public class EquipAffixData extends GenshinResource {
|
||||
|
||||
private int AffixId;
|
||||
private int Id;
|
||||
private int Level;
|
||||
private long NameTextMapHash;
|
||||
private String OpenConfig;
|
||||
private FightPropData[] AddProps;
|
||||
private float[] ParamList;
|
||||
|
||||
@Override
|
||||
public int getId() {
|
||||
return AffixId;
|
||||
}
|
||||
|
||||
public int getMainId() {
|
||||
return Id;
|
||||
}
|
||||
|
||||
public int getLevel() {
|
||||
return Level;
|
||||
}
|
||||
|
||||
public long getNameTextMapHash() {
|
||||
return NameTextMapHash;
|
||||
}
|
||||
|
||||
public String getOpenConfig() {
|
||||
return OpenConfig;
|
||||
}
|
||||
|
||||
public FightPropData[] getAddProps() {
|
||||
return AddProps;
|
||||
}
|
||||
|
||||
public float[] getParamList() {
|
||||
return ParamList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoad() {
|
||||
ArrayList<FightPropData> parsed = new ArrayList<FightPropData>(getAddProps().length);
|
||||
for (FightPropData prop : getAddProps()) {
|
||||
if (prop.getPropType() != null || prop.getValue() == 0f) {
|
||||
prop.onLoad();
|
||||
parsed.add(prop);
|
||||
}
|
||||
}
|
||||
this.AddProps = parsed.toArray(new FightPropData[parsed.size()]);
|
||||
}
|
||||
}
|
||||
60
src/main/java/emu/grasscutter/data/def/GadgetData.java
Normal file
60
src/main/java/emu/grasscutter/data/def/GadgetData.java
Normal file
@@ -0,0 +1,60 @@
|
||||
package emu.grasscutter.data.def;
|
||||
|
||||
import emu.grasscutter.data.GenshinResource;
|
||||
import emu.grasscutter.data.ResourceType;
|
||||
|
||||
@ResourceType(name = "GadgetExcelConfigData.json")
|
||||
public class GadgetData extends GenshinResource {
|
||||
private int Id;
|
||||
|
||||
private String Type;
|
||||
private String JsonName;
|
||||
private boolean IsInteractive;
|
||||
private String[] Tags;
|
||||
private String ItemJsonName;
|
||||
private String InteeIconName;
|
||||
private long NameTextMapHash;
|
||||
private int CampID;
|
||||
|
||||
@Override
|
||||
public int getId() {
|
||||
return this.Id;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return Type;
|
||||
}
|
||||
|
||||
public String getJsonName() {
|
||||
return JsonName;
|
||||
}
|
||||
|
||||
public boolean isInteractive() {
|
||||
return IsInteractive;
|
||||
}
|
||||
|
||||
public String[] getTags() {
|
||||
return Tags;
|
||||
}
|
||||
|
||||
public String getItemJsonName() {
|
||||
return ItemJsonName;
|
||||
}
|
||||
|
||||
public String getInteeIconName() {
|
||||
return InteeIconName;
|
||||
}
|
||||
|
||||
public long getNameTextMapHash() {
|
||||
return NameTextMapHash;
|
||||
}
|
||||
|
||||
public int getCampID() {
|
||||
return CampID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoad() {
|
||||
|
||||
}
|
||||
}
|
||||
253
src/main/java/emu/grasscutter/data/def/ItemData.java
Normal file
253
src/main/java/emu/grasscutter/data/def/ItemData.java
Normal file
@@ -0,0 +1,253 @@
|
||||
package emu.grasscutter.data.def;
|
||||
|
||||
import emu.grasscutter.data.GenshinResource;
|
||||
import emu.grasscutter.data.ResourceType;
|
||||
import emu.grasscutter.game.props.FightProperty;
|
||||
import it.unimi.dsi.fastutil.ints.IntOpenHashSet;
|
||||
import it.unimi.dsi.fastutil.ints.IntSet;
|
||||
|
||||
@ResourceType(name = {"MaterialExcelConfigData.json", "WeaponExcelConfigData.json", "ReliquaryExcelConfigData.json"})
|
||||
public class ItemData extends GenshinResource {
|
||||
|
||||
private int Id;
|
||||
private int StackLimit = 1;
|
||||
private int MaxUseCount;
|
||||
private int RankLevel;
|
||||
private String EffectName;
|
||||
private int[] SatiationParams;
|
||||
private int Rank;
|
||||
private int Weight;
|
||||
private int GadgetId;
|
||||
|
||||
private int[] DestroyReturnMaterial;
|
||||
private int[] DestroyReturnMaterialCount;
|
||||
|
||||
// Food
|
||||
private String FoodQuality;
|
||||
private String UseTarget;
|
||||
private String[] UseParam;
|
||||
|
||||
// String enums
|
||||
private String ItemType;
|
||||
private String MaterialType;
|
||||
private String EquipType;
|
||||
private String EffectType;
|
||||
private String DestroyRule;
|
||||
|
||||
// Relic
|
||||
private int MainPropDepotId;
|
||||
private int AppendPropDepotId;
|
||||
private int AppendPropNum;
|
||||
private int SetId;
|
||||
private int[] AddPropLevels;
|
||||
private int BaseConvExp;
|
||||
private int MaxLevel;
|
||||
|
||||
// Weapon
|
||||
private int WeaponPromoteId;
|
||||
private int WeaponBaseExp;
|
||||
private int StoryId;
|
||||
private int AvatarPromoteId;
|
||||
private int[] AwakenCosts;
|
||||
private int[] SkillAffix;
|
||||
private WeaponProperty[] WeaponProp;
|
||||
|
||||
// Hash
|
||||
private String Icon;
|
||||
private long NameTextMapHash;
|
||||
|
||||
// Post load
|
||||
private transient emu.grasscutter.game.inventory.MaterialType materialType;
|
||||
private transient emu.grasscutter.game.inventory.ItemType itemType;
|
||||
private transient emu.grasscutter.game.inventory.EquipType equipType;
|
||||
|
||||
private IntSet addPropLevelSet;
|
||||
|
||||
@Override
|
||||
public int getId(){
|
||||
return this.Id;
|
||||
}
|
||||
|
||||
public String getMaterialTypeString(){
|
||||
return this.MaterialType;
|
||||
}
|
||||
|
||||
public int getStackLimit(){
|
||||
return this.StackLimit;
|
||||
}
|
||||
|
||||
public int getMaxUseCount(){
|
||||
return this.MaxUseCount;
|
||||
}
|
||||
|
||||
public String getUseTarget(){
|
||||
return this.UseTarget;
|
||||
}
|
||||
|
||||
public String[] getUseParam(){
|
||||
return this.UseParam;
|
||||
}
|
||||
|
||||
public int getRankLevel(){
|
||||
return this.RankLevel;
|
||||
}
|
||||
|
||||
public String getFoodQuality(){
|
||||
return this.FoodQuality;
|
||||
}
|
||||
|
||||
public String getEffectName(){
|
||||
return this.EffectName;
|
||||
}
|
||||
|
||||
public int[] getSatiationParams(){
|
||||
return this.SatiationParams;
|
||||
}
|
||||
|
||||
public int[] getDestroyReturnMaterial(){
|
||||
return this.DestroyReturnMaterial;
|
||||
}
|
||||
|
||||
public int[] getDestroyReturnMaterialCount(){
|
||||
return this.DestroyReturnMaterialCount;
|
||||
}
|
||||
|
||||
public long getNameTextMapHash(){
|
||||
return this.NameTextMapHash;
|
||||
}
|
||||
|
||||
public String getIcon(){
|
||||
return this.Icon;
|
||||
}
|
||||
|
||||
public String getItemTypeString(){
|
||||
return this.ItemType;
|
||||
}
|
||||
|
||||
public int getRank(){
|
||||
return this.Rank;
|
||||
}
|
||||
|
||||
public int getGadgetId() {
|
||||
return GadgetId;
|
||||
}
|
||||
|
||||
public int getBaseConvExp() {
|
||||
return BaseConvExp;
|
||||
}
|
||||
|
||||
public int getMainPropDepotId() {
|
||||
return MainPropDepotId;
|
||||
}
|
||||
|
||||
public int getAppendPropDepotId() {
|
||||
return AppendPropDepotId;
|
||||
}
|
||||
|
||||
public int getAppendPropNum() {
|
||||
return AppendPropNum;
|
||||
}
|
||||
|
||||
public int getSetId() {
|
||||
return SetId;
|
||||
}
|
||||
|
||||
public int getWeaponPromoteId() {
|
||||
return WeaponPromoteId;
|
||||
}
|
||||
|
||||
public int getWeaponBaseExp() {
|
||||
return WeaponBaseExp;
|
||||
}
|
||||
|
||||
public int[] getAwakenCosts() {
|
||||
return AwakenCosts;
|
||||
}
|
||||
|
||||
public IntSet getAddPropLevelSet() {
|
||||
return addPropLevelSet;
|
||||
}
|
||||
|
||||
public int[] getSkillAffix() {
|
||||
return SkillAffix;
|
||||
}
|
||||
|
||||
public WeaponProperty[] getWeaponProperties() {
|
||||
return WeaponProp;
|
||||
}
|
||||
|
||||
public int getMaxLevel() {
|
||||
return MaxLevel;
|
||||
}
|
||||
|
||||
public emu.grasscutter.game.inventory.ItemType getItemType() {
|
||||
return this.itemType;
|
||||
}
|
||||
|
||||
public emu.grasscutter.game.inventory.MaterialType getMaterialType() {
|
||||
return this.materialType;
|
||||
}
|
||||
|
||||
public emu.grasscutter.game.inventory.EquipType getEquipType() {
|
||||
return this.equipType;
|
||||
}
|
||||
|
||||
public boolean canAddRelicProp(int level) {
|
||||
return this.addPropLevelSet != null & this.addPropLevelSet.contains(level);
|
||||
}
|
||||
|
||||
public boolean isEquip() {
|
||||
return this.itemType == emu.grasscutter.game.inventory.ItemType.ITEM_RELIQUARY || this.itemType == emu.grasscutter.game.inventory.ItemType.ITEM_WEAPON;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoad() {
|
||||
this.itemType = emu.grasscutter.game.inventory.ItemType.getTypeByName(getItemTypeString());
|
||||
this.materialType = emu.grasscutter.game.inventory.MaterialType.getTypeByName(getMaterialTypeString());
|
||||
|
||||
if (this.itemType == emu.grasscutter.game.inventory.ItemType.ITEM_RELIQUARY) {
|
||||
this.equipType = emu.grasscutter.game.inventory.EquipType.getTypeByName(this.EquipType);
|
||||
if (this.AddPropLevels != null && this.AddPropLevels.length > 0) {
|
||||
this.addPropLevelSet = new IntOpenHashSet(this.AddPropLevels);
|
||||
}
|
||||
} else if (this.itemType == emu.grasscutter.game.inventory.ItemType.ITEM_WEAPON) {
|
||||
this.equipType = emu.grasscutter.game.inventory.EquipType.EQUIP_WEAPON;
|
||||
} else {
|
||||
this.equipType = emu.grasscutter.game.inventory.EquipType.EQUIP_NONE;
|
||||
}
|
||||
|
||||
if (this.getWeaponProperties() != null) {
|
||||
for (WeaponProperty weaponProperty : this.getWeaponProperties()) {
|
||||
weaponProperty.onLoad();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class WeaponProperty {
|
||||
private FightProperty fightProp;
|
||||
private String PropType;
|
||||
private float InitValue;
|
||||
private String Type;
|
||||
|
||||
public String getPropType(){
|
||||
return this.PropType;
|
||||
}
|
||||
|
||||
public float getInitValue(){
|
||||
return this.InitValue;
|
||||
}
|
||||
|
||||
public String getType(){
|
||||
return this.Type;
|
||||
}
|
||||
|
||||
public FightProperty getFightProp() {
|
||||
return fightProp;
|
||||
}
|
||||
|
||||
public void onLoad() {
|
||||
this.fightProp = FightProperty.getPropByName(PropType);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
32
src/main/java/emu/grasscutter/data/def/MonsterCurveData.java
Normal file
32
src/main/java/emu/grasscutter/data/def/MonsterCurveData.java
Normal file
@@ -0,0 +1,32 @@
|
||||
package emu.grasscutter.data.def;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import emu.grasscutter.data.GenshinResource;
|
||||
import emu.grasscutter.data.ResourceType;
|
||||
import emu.grasscutter.data.common.CurveInfo;
|
||||
|
||||
@ResourceType(name = "MonsterCurveExcelConfigData.json")
|
||||
public class MonsterCurveData extends GenshinResource {
|
||||
private int Level;
|
||||
private CurveInfo[] CurveInfos;
|
||||
|
||||
private Map<String, Float> curveInfos;
|
||||
|
||||
@Override
|
||||
public int getId() {
|
||||
return Level;
|
||||
}
|
||||
|
||||
public float getMultByProp(String fightProp) {
|
||||
return curveInfos.getOrDefault(fightProp, 1f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoad() {
|
||||
this.curveInfos = new HashMap<>();
|
||||
Stream.of(this.CurveInfos).forEach(info -> this.curveInfos.put(info.getType(), info.getValue()));
|
||||
}
|
||||
}
|
||||
198
src/main/java/emu/grasscutter/data/def/MonsterData.java
Normal file
198
src/main/java/emu/grasscutter/data/def/MonsterData.java
Normal file
@@ -0,0 +1,198 @@
|
||||
package emu.grasscutter.data.def;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import emu.grasscutter.data.GenshinData;
|
||||
import emu.grasscutter.data.GenshinResource;
|
||||
import emu.grasscutter.data.ResourceType;
|
||||
import emu.grasscutter.data.ResourceType.LoadPriority;
|
||||
import emu.grasscutter.data.common.PropGrowCurve;
|
||||
|
||||
@ResourceType(name = "MonsterExcelConfigData.json", loadPriority = LoadPriority.LOW)
|
||||
public class MonsterData extends GenshinResource {
|
||||
private int Id;
|
||||
|
||||
private String MonsterName;
|
||||
private String Type;
|
||||
private String ServerScript;
|
||||
private List<Integer> Affix;
|
||||
private String Ai;
|
||||
private int[] Equips;
|
||||
private List<HpDrops> HpDrops;
|
||||
private int KillDropId;
|
||||
private String ExcludeWeathers;
|
||||
private int FeatureTagGroupID;
|
||||
private int MpPropID;
|
||||
private String Skin;
|
||||
private int DescribeId;
|
||||
private int CombatBGMLevel;
|
||||
private int EntityBudgetLevel;
|
||||
private float HpBase;
|
||||
private float AttackBase;
|
||||
private float DefenseBase;
|
||||
private float FireSubHurt;
|
||||
private float ElecSubHurt;
|
||||
private float GrassSubHurt;
|
||||
private float WaterSubHurt;
|
||||
private float WindSubHurt;
|
||||
private float RockSubHurt;
|
||||
private float IceSubHurt;
|
||||
private float PhysicalSubHurt;
|
||||
private List<PropGrowCurve> PropGrowCurves;
|
||||
private long NameTextMapHash;
|
||||
private int CampID;
|
||||
|
||||
private int weaponId;
|
||||
private MonsterDescribeData describeData;
|
||||
|
||||
@Override
|
||||
public int getId() {
|
||||
return this.Id;
|
||||
}
|
||||
|
||||
public String getMonsterName() {
|
||||
return MonsterName;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return Type;
|
||||
}
|
||||
|
||||
public String getServerScript() {
|
||||
return ServerScript;
|
||||
}
|
||||
|
||||
public List<Integer> getAffix() {
|
||||
return Affix;
|
||||
}
|
||||
|
||||
public String getAi() {
|
||||
return Ai;
|
||||
}
|
||||
|
||||
public int[] getEquips() {
|
||||
return Equips;
|
||||
}
|
||||
|
||||
public List<HpDrops> getHpDrops() {
|
||||
return HpDrops;
|
||||
}
|
||||
|
||||
public int getKillDropId() {
|
||||
return KillDropId;
|
||||
}
|
||||
|
||||
public String getExcludeWeathers() {
|
||||
return ExcludeWeathers;
|
||||
}
|
||||
|
||||
public int getFeatureTagGroupID() {
|
||||
return FeatureTagGroupID;
|
||||
}
|
||||
|
||||
public int getMpPropID() {
|
||||
return MpPropID;
|
||||
}
|
||||
|
||||
public String getSkin() {
|
||||
return Skin;
|
||||
}
|
||||
|
||||
public int getDescribeId() {
|
||||
return DescribeId;
|
||||
}
|
||||
|
||||
public int getCombatBGMLevel() {
|
||||
return CombatBGMLevel;
|
||||
}
|
||||
|
||||
public int getEntityBudgetLevel() {
|
||||
return EntityBudgetLevel;
|
||||
}
|
||||
|
||||
public float getBaseHp() {
|
||||
return HpBase;
|
||||
}
|
||||
|
||||
public float getBaseAttack() {
|
||||
return AttackBase;
|
||||
}
|
||||
|
||||
public float getBaseDefense() {
|
||||
return DefenseBase;
|
||||
}
|
||||
|
||||
public float getElecSubHurt() {
|
||||
return ElecSubHurt;
|
||||
}
|
||||
|
||||
public float getGrassSubHurt() {
|
||||
return GrassSubHurt;
|
||||
}
|
||||
|
||||
public float getWaterSubHurt() {
|
||||
return WaterSubHurt;
|
||||
}
|
||||
|
||||
public float getWindSubHurt() {
|
||||
return WindSubHurt;
|
||||
}
|
||||
|
||||
public float getIceSubHurt() {
|
||||
return IceSubHurt;
|
||||
}
|
||||
|
||||
public float getPhysicalSubHurt() {
|
||||
return PhysicalSubHurt;
|
||||
}
|
||||
|
||||
public List<PropGrowCurve> getPropGrowCurves() {
|
||||
return PropGrowCurves;
|
||||
}
|
||||
|
||||
public long getNameTextMapHash() {
|
||||
return NameTextMapHash;
|
||||
}
|
||||
|
||||
public int getCampID() {
|
||||
return CampID;
|
||||
}
|
||||
|
||||
public MonsterDescribeData getDescribeData() {
|
||||
return describeData;
|
||||
}
|
||||
|
||||
public int getWeaponId() {
|
||||
return weaponId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoad() {
|
||||
this.describeData = GenshinData.getMonsterDescribeDataMap().get(this.getDescribeId());
|
||||
|
||||
for (int id : this.Equips) {
|
||||
if (id == 0) {
|
||||
continue;
|
||||
}
|
||||
GadgetData gadget = GenshinData.getGadgetDataMap().get(id);
|
||||
if (gadget == null) {
|
||||
continue;
|
||||
}
|
||||
if (gadget.getItemJsonName().equals("Default_MonsterWeapon")) {
|
||||
this.weaponId = id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class HpDrops {
|
||||
private int DropId;
|
||||
private int HpPercent;
|
||||
|
||||
public int getDropId(){
|
||||
return this.DropId;
|
||||
}
|
||||
public int getHpPercent(){
|
||||
return this.HpPercent;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package emu.grasscutter.data.def;
|
||||
|
||||
import emu.grasscutter.data.GenshinResource;
|
||||
import emu.grasscutter.data.ResourceType;
|
||||
import emu.grasscutter.data.ResourceType.LoadPriority;
|
||||
|
||||
@ResourceType(name = "MonsterDescribeExcelConfigData.json", loadPriority = LoadPriority.HIGH)
|
||||
public class MonsterDescribeData extends GenshinResource {
|
||||
private int Id;
|
||||
private long NameTextMapHash;
|
||||
private int TitleID;
|
||||
private int SpecialNameLabID;
|
||||
private String Icon;
|
||||
|
||||
@Override
|
||||
public int getId() {
|
||||
return Id;
|
||||
}
|
||||
|
||||
public long getNameTextMapHash() {
|
||||
return NameTextMapHash;
|
||||
}
|
||||
|
||||
public int getTitleID() {
|
||||
return TitleID;
|
||||
}
|
||||
|
||||
public int getSpecialNameLabID() {
|
||||
return SpecialNameLabID;
|
||||
}
|
||||
|
||||
public String getIcon() {
|
||||
return Icon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoad() {
|
||||
|
||||
}
|
||||
}
|
||||
72
src/main/java/emu/grasscutter/data/def/NpcData.java
Normal file
72
src/main/java/emu/grasscutter/data/def/NpcData.java
Normal file
@@ -0,0 +1,72 @@
|
||||
package emu.grasscutter.data.def;
|
||||
|
||||
import emu.grasscutter.data.GenshinResource;
|
||||
import emu.grasscutter.data.ResourceType;
|
||||
|
||||
@ResourceType(name = "NpcExcelConfigData.json")
|
||||
public class NpcData extends GenshinResource {
|
||||
private int Id;
|
||||
|
||||
private String JsonName;
|
||||
private String Alias;
|
||||
private String ScriptDataPath;
|
||||
private String LuaDataPath;
|
||||
|
||||
private boolean IsInteractive;
|
||||
private boolean HasMove;
|
||||
private String DyePart;
|
||||
private String BillboardIcon;
|
||||
|
||||
private long NameTextMapHash;
|
||||
private int CampID;
|
||||
|
||||
@Override
|
||||
public int getId() {
|
||||
return this.Id;
|
||||
}
|
||||
|
||||
public String getJsonName() {
|
||||
return JsonName;
|
||||
}
|
||||
|
||||
public String getAlias() {
|
||||
return Alias;
|
||||
}
|
||||
|
||||
public String getScriptDataPath() {
|
||||
return ScriptDataPath;
|
||||
}
|
||||
|
||||
public String getLuaDataPath() {
|
||||
return LuaDataPath;
|
||||
}
|
||||
|
||||
public boolean isIsInteractive() {
|
||||
return IsInteractive;
|
||||
}
|
||||
|
||||
public boolean isHasMove() {
|
||||
return HasMove;
|
||||
}
|
||||
|
||||
public String getDyePart() {
|
||||
return DyePart;
|
||||
}
|
||||
|
||||
public String getBillboardIcon() {
|
||||
return BillboardIcon;
|
||||
}
|
||||
|
||||
public long getNameTextMapHash() {
|
||||
return NameTextMapHash;
|
||||
}
|
||||
|
||||
public int getCampID() {
|
||||
return CampID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoad() {
|
||||
|
||||
}
|
||||
}
|
||||
33
src/main/java/emu/grasscutter/data/def/PlayerLevelData.java
Normal file
33
src/main/java/emu/grasscutter/data/def/PlayerLevelData.java
Normal file
@@ -0,0 +1,33 @@
|
||||
package emu.grasscutter.data.def;
|
||||
|
||||
import emu.grasscutter.data.GenshinResource;
|
||||
import emu.grasscutter.data.ResourceType;
|
||||
|
||||
@ResourceType(name = "PlayerLevelExcelConfigData.json")
|
||||
public class PlayerLevelData extends GenshinResource {
|
||||
private int Level;
|
||||
private int Exp;
|
||||
private int RewardId;
|
||||
private int UnlockWorldLevel;
|
||||
|
||||
@Override
|
||||
public int getId() {
|
||||
return this.Level;
|
||||
}
|
||||
|
||||
public int getLevel() {
|
||||
return Level;
|
||||
}
|
||||
|
||||
public int getExp() {
|
||||
return Exp;
|
||||
}
|
||||
|
||||
public int getRewardId() {
|
||||
return RewardId;
|
||||
}
|
||||
|
||||
public int getUnlockWorldLevel() {
|
||||
return UnlockWorldLevel;
|
||||
}
|
||||
}
|
||||
101
src/main/java/emu/grasscutter/data/def/ProudSkillData.java
Normal file
101
src/main/java/emu/grasscutter/data/def/ProudSkillData.java
Normal file
@@ -0,0 +1,101 @@
|
||||
package emu.grasscutter.data.def;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import emu.grasscutter.data.GenshinResource;
|
||||
import emu.grasscutter.data.ResourceType;
|
||||
import emu.grasscutter.data.common.FightPropData;
|
||||
import emu.grasscutter.data.common.ItemParamData;
|
||||
|
||||
@ResourceType(name = "ProudSkillExcelConfigData.json")
|
||||
public class ProudSkillData extends GenshinResource {
|
||||
|
||||
private int ProudSkillId;
|
||||
private int ProudSkillGroupId;
|
||||
private int Level;
|
||||
private int CoinCost;
|
||||
private int BreakLevel;
|
||||
private int ProudSkillType;
|
||||
private String OpenConfig;
|
||||
private List<ItemParamData> CostItems;
|
||||
private List<String> FilterConds;
|
||||
private List<String> LifeEffectParams;
|
||||
private FightPropData[] AddProps;
|
||||
private float[] ParamList;
|
||||
private long[] ParamDescList;
|
||||
private long NameTextMapHash;
|
||||
|
||||
@Override
|
||||
public int getId() {
|
||||
return ProudSkillId;
|
||||
}
|
||||
|
||||
public int getProudSkillGroupId() {
|
||||
return ProudSkillGroupId;
|
||||
}
|
||||
|
||||
public int getLevel() {
|
||||
return Level;
|
||||
}
|
||||
|
||||
public int getCoinCost() {
|
||||
return CoinCost;
|
||||
}
|
||||
|
||||
public int getBreakLevel() {
|
||||
return BreakLevel;
|
||||
}
|
||||
|
||||
public int getProudSkillType() {
|
||||
return ProudSkillType;
|
||||
}
|
||||
|
||||
public String getOpenConfig() {
|
||||
return OpenConfig;
|
||||
}
|
||||
|
||||
public List<ItemParamData> getCostItems() {
|
||||
return CostItems;
|
||||
}
|
||||
|
||||
public List<String> getFilterConds() {
|
||||
return FilterConds;
|
||||
}
|
||||
|
||||
public List<String> getLifeEffectParams() {
|
||||
return LifeEffectParams;
|
||||
}
|
||||
|
||||
public FightPropData[] getAddProps() {
|
||||
return AddProps;
|
||||
}
|
||||
|
||||
public float[] getParamList() {
|
||||
return ParamList;
|
||||
}
|
||||
|
||||
public long[] getParamDescList() {
|
||||
return ParamDescList;
|
||||
}
|
||||
|
||||
public long getNameTextMapHash() {
|
||||
return NameTextMapHash;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoad() {
|
||||
if (this.getOpenConfig() != null & this.getOpenConfig().length() > 0) {
|
||||
this.OpenConfig = "Avatar_" + this.getOpenConfig();
|
||||
}
|
||||
// Fight props
|
||||
ArrayList<FightPropData> parsed = new ArrayList<FightPropData>(getAddProps().length);
|
||||
for (FightPropData prop : getAddProps()) {
|
||||
if (prop.getPropType() != null && prop.getValue() != 0f) {
|
||||
prop.onLoad();
|
||||
parsed.add(prop);
|
||||
}
|
||||
}
|
||||
this.AddProps = parsed.toArray(new FightPropData[parsed.size()]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package emu.grasscutter.data.def;
|
||||
|
||||
import emu.grasscutter.data.GenshinResource;
|
||||
import emu.grasscutter.data.ResourceType;
|
||||
import emu.grasscutter.game.props.FightProperty;
|
||||
|
||||
@ResourceType(name = "ReliquaryAffixExcelConfigData.json")
|
||||
public class ReliquaryAffixData extends GenshinResource {
|
||||
private int Id;
|
||||
|
||||
private int DepotId;
|
||||
private int GroupId;
|
||||
private String PropType;
|
||||
private float PropValue;
|
||||
private int Weight;
|
||||
private int UpgradeWeight;
|
||||
|
||||
private FightProperty fightProp;
|
||||
|
||||
@Override
|
||||
public int getId() {
|
||||
return Id;
|
||||
}
|
||||
public int getDepotId() {
|
||||
return DepotId;
|
||||
}
|
||||
public int getGroupId() {
|
||||
return GroupId;
|
||||
}
|
||||
public float getPropValue() {
|
||||
return PropValue;
|
||||
}
|
||||
public int getWeight() {
|
||||
return Weight;
|
||||
}
|
||||
public int getUpgradeWeight() {
|
||||
return UpgradeWeight;
|
||||
}
|
||||
|
||||
public FightProperty getFightProp() {
|
||||
return fightProp;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoad() {
|
||||
this.fightProp = FightProperty.getPropByName(this.PropType);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
package emu.grasscutter.data.def;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import emu.grasscutter.data.GenshinResource;
|
||||
import emu.grasscutter.data.ResourceType;
|
||||
import emu.grasscutter.game.props.FightProperty;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
|
||||
|
||||
@ResourceType(name = "ReliquaryLevelExcelConfigData.json")
|
||||
public class ReliquaryLevelData extends GenshinResource {
|
||||
private int id;
|
||||
private Int2ObjectMap<Float> propMap;
|
||||
|
||||
private int Rank;
|
||||
private int Level;
|
||||
private int Exp;
|
||||
private List<RelicLevelProperty> AddProps;
|
||||
|
||||
@Override
|
||||
public int getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public int getRank() {
|
||||
return Rank;
|
||||
}
|
||||
|
||||
public int getLevel() {
|
||||
return Level;
|
||||
}
|
||||
|
||||
public int getExp() {
|
||||
return Exp;
|
||||
}
|
||||
|
||||
public float getPropValue(FightProperty prop) {
|
||||
return getPropValue(prop.getId());
|
||||
}
|
||||
|
||||
public float getPropValue(int id) {
|
||||
return propMap.get(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoad() {
|
||||
this.id = (Rank << 8) + this.getLevel();
|
||||
this.propMap = new Int2ObjectOpenHashMap<>();
|
||||
for (RelicLevelProperty p : AddProps) {
|
||||
this.propMap.put(FightProperty.getPropByName(p.getPropType()).getId(), (Float) p.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
public class RelicLevelProperty {
|
||||
private String PropType;
|
||||
private float Value;
|
||||
|
||||
public String getPropType() {
|
||||
return PropType;
|
||||
}
|
||||
|
||||
public float getValue() {
|
||||
return Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package emu.grasscutter.data.def;
|
||||
|
||||
import emu.grasscutter.data.GenshinResource;
|
||||
import emu.grasscutter.data.ResourceType;
|
||||
import emu.grasscutter.game.props.FightProperty;
|
||||
|
||||
@ResourceType(name = "ReliquaryMainPropExcelConfigData.json")
|
||||
public class ReliquaryMainPropData extends GenshinResource {
|
||||
private int Id;
|
||||
|
||||
private int PropDepotId;
|
||||
private String PropType;
|
||||
private String AffixName;
|
||||
private int Weight;
|
||||
|
||||
private FightProperty fightProp;
|
||||
|
||||
@Override
|
||||
public int getId() {
|
||||
return Id;
|
||||
}
|
||||
public int getPropDepotId() {
|
||||
return PropDepotId;
|
||||
}
|
||||
public int getWeight() {
|
||||
return Weight;
|
||||
}
|
||||
|
||||
public FightProperty getFightProp() {
|
||||
return fightProp;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoad() {
|
||||
this.fightProp = FightProperty.getPropByName(this.PropType);
|
||||
}
|
||||
}
|
||||
39
src/main/java/emu/grasscutter/data/def/ReliquarySetData.java
Normal file
39
src/main/java/emu/grasscutter/data/def/ReliquarySetData.java
Normal file
@@ -0,0 +1,39 @@
|
||||
package emu.grasscutter.data.def;
|
||||
|
||||
import emu.grasscutter.data.GenshinResource;
|
||||
import emu.grasscutter.data.ResourceType;
|
||||
|
||||
@ResourceType(name = "ReliquarySetExcelConfigData.json")
|
||||
public class ReliquarySetData extends GenshinResource {
|
||||
private int SetId;
|
||||
private int[] SetNeedNum;
|
||||
private int EquipAffixId;
|
||||
private int DisableFilter;
|
||||
private int[] ContainsList;
|
||||
|
||||
@Override
|
||||
public int getId() {
|
||||
return SetId;
|
||||
}
|
||||
|
||||
public int[] getSetNeedNum() {
|
||||
return SetNeedNum;
|
||||
}
|
||||
|
||||
public int getEquipAffixId() {
|
||||
return EquipAffixId;
|
||||
}
|
||||
|
||||
public int getDisableFilter() {
|
||||
return DisableFilter;
|
||||
}
|
||||
|
||||
public int[] getContainsList() {
|
||||
return ContainsList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoad() {
|
||||
|
||||
}
|
||||
}
|
||||
32
src/main/java/emu/grasscutter/data/def/WeaponCurveData.java
Normal file
32
src/main/java/emu/grasscutter/data/def/WeaponCurveData.java
Normal file
@@ -0,0 +1,32 @@
|
||||
package emu.grasscutter.data.def;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import emu.grasscutter.data.GenshinResource;
|
||||
import emu.grasscutter.data.ResourceType;
|
||||
import emu.grasscutter.data.common.CurveInfo;
|
||||
|
||||
@ResourceType(name = "WeaponCurveExcelConfigData.json")
|
||||
public class WeaponCurveData extends GenshinResource {
|
||||
private int Level;
|
||||
private CurveInfo[] CurveInfos;
|
||||
|
||||
private Map<String, Float> curveInfos;
|
||||
|
||||
@Override
|
||||
public int getId() {
|
||||
return Level;
|
||||
}
|
||||
|
||||
public float getMultByProp(String fightProp) {
|
||||
return curveInfos.getOrDefault(fightProp, 1f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoad() {
|
||||
this.curveInfos = new HashMap<>();
|
||||
Stream.of(this.CurveInfos).forEach(info -> this.curveInfos.put(info.getType(), info.getValue()));
|
||||
}
|
||||
}
|
||||
23
src/main/java/emu/grasscutter/data/def/WeaponLevelData.java
Normal file
23
src/main/java/emu/grasscutter/data/def/WeaponLevelData.java
Normal file
@@ -0,0 +1,23 @@
|
||||
package emu.grasscutter.data.def;
|
||||
|
||||
import emu.grasscutter.data.GenshinResource;
|
||||
import emu.grasscutter.data.ResourceType;
|
||||
|
||||
@ResourceType(name = "WeaponLevelExcelConfigData.json")
|
||||
public class WeaponLevelData extends GenshinResource {
|
||||
private int Level;
|
||||
private int[] RequiredExps;
|
||||
|
||||
@Override
|
||||
public int getId() {
|
||||
return this.Level;
|
||||
}
|
||||
|
||||
public int getLevel() {
|
||||
return Level;
|
||||
}
|
||||
|
||||
public int[] getRequiredExps() {
|
||||
return RequiredExps;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
package emu.grasscutter.data.def;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import emu.grasscutter.data.GenshinResource;
|
||||
import emu.grasscutter.data.ResourceType;
|
||||
import emu.grasscutter.data.common.FightPropData;
|
||||
import emu.grasscutter.data.common.ItemParamData;
|
||||
|
||||
@ResourceType(name = "WeaponPromoteExcelConfigData.json")
|
||||
public class WeaponPromoteData extends GenshinResource {
|
||||
|
||||
private int WeaponPromoteId;
|
||||
private int PromoteLevel;
|
||||
private ItemParamData[] CostItems;
|
||||
private int CoinCost;
|
||||
private FightPropData[] AddProps;
|
||||
private int UnlockMaxLevel;
|
||||
private int RequiredPlayerLevel;
|
||||
|
||||
@Override
|
||||
public int getId() {
|
||||
return (WeaponPromoteId << 8) + PromoteLevel;
|
||||
}
|
||||
|
||||
public int getWeaponPromoteId() {
|
||||
return WeaponPromoteId;
|
||||
}
|
||||
|
||||
public int getPromoteLevel() {
|
||||
return PromoteLevel;
|
||||
}
|
||||
|
||||
public ItemParamData[] getCostItems() {
|
||||
return CostItems;
|
||||
}
|
||||
|
||||
public int getCoinCost() {
|
||||
return CoinCost;
|
||||
}
|
||||
|
||||
public FightPropData[] getAddProps() {
|
||||
return AddProps;
|
||||
}
|
||||
|
||||
public int getUnlockMaxLevel() {
|
||||
return UnlockMaxLevel;
|
||||
}
|
||||
|
||||
public int getRequiredPlayerLevel() {
|
||||
return RequiredPlayerLevel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoad() {
|
||||
// Trim item params
|
||||
ArrayList<ItemParamData> trim = new ArrayList<>(getAddProps().length);
|
||||
for (ItemParamData itemParam : getCostItems()) {
|
||||
if (itemParam.getId() == 0) {
|
||||
continue;
|
||||
}
|
||||
trim.add(itemParam);
|
||||
}
|
||||
this.CostItems = trim.toArray(new ItemParamData[trim.size()]);
|
||||
// Trim fight prop data
|
||||
ArrayList<FightPropData> parsed = new ArrayList<>(getAddProps().length);
|
||||
for (FightPropData prop : getAddProps()) {
|
||||
if (prop.getPropType() != null && prop.getValue() != 0f) {
|
||||
prop.onLoad();
|
||||
parsed.add(prop);
|
||||
}
|
||||
}
|
||||
this.AddProps = parsed.toArray(new FightPropData[parsed.size()]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user