mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2025-12-17 01:15:52 +01:00
fixed gadget hp properties and invincibility handling (#1773)
* fixed gadget hp properties and invincibility handling * Allow killing of hp locked entities, if the damage is higher then the hp Co-authored-by: hartie95 <mail@hartie95.de>
This commit is contained in:
committed by
GitHub
parent
21ff749dca
commit
08fdcf6ed4
@@ -29,6 +29,7 @@ public class GameData {
|
||||
private static final Int2ObjectMap<QuestEncryptionKey> questsKeys = new Int2ObjectOpenHashMap<>();
|
||||
private static final Int2ObjectMap<HomeworldDefaultSaveData> homeworldDefaultSaveData = new Int2ObjectOpenHashMap<>();
|
||||
private static final Int2ObjectMap<SceneNpcBornData> npcBornData = new Int2ObjectOpenHashMap<>();
|
||||
@Getter private static final Map<String, ConfigGadget> gadgetConfigData = new HashMap<>();
|
||||
|
||||
// ExcelConfigs
|
||||
private static final Int2ObjectMap<PlayerLevelData> playerLevelDataMap = new Int2ObjectOpenHashMap<>();
|
||||
|
||||
@@ -68,6 +68,7 @@ public class ResourceLoader {
|
||||
// Process into depots
|
||||
GameDepot.load();
|
||||
// Load spawn data and quests
|
||||
loadGadgetConfigData();
|
||||
loadSpawnData();
|
||||
loadQuests();
|
||||
loadScriptSceneData();
|
||||
@@ -493,6 +494,31 @@ public class ResourceLoader {
|
||||
Grasscutter.getLogger().debug("Loaded " + GameData.getSceneNpcBornData().size() + " SceneNpcBornDatas.");
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
private static void loadGadgetConfigData() {
|
||||
Files.list(Path.of(RESOURCE("BinOutput/Gadget/"))).forEach(filePath -> {
|
||||
var file = filePath.toFile();
|
||||
if (file.isDirectory() || !file.getName().endsWith("json")) {
|
||||
return;
|
||||
}
|
||||
|
||||
Map<String, ConfigGadget> config;
|
||||
|
||||
try {
|
||||
config = JsonUtils.loadToMap(filePath.toString(), String.class, ConfigGadget.class);
|
||||
} catch (Exception e) {
|
||||
Grasscutter.getLogger().error("failed to load ConfigGadget entries for "+filePath, e);
|
||||
return;
|
||||
}
|
||||
|
||||
for (Entry<String, ConfigGadget> e : config.entrySet()) {
|
||||
GameData.getGadgetConfigData().put(e.getKey(), e.getValue());
|
||||
}
|
||||
});
|
||||
|
||||
Grasscutter.getLogger().debug("Loaded {} ConfigGadget entries.", GameData.getGadgetConfigData().size());
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
private static void loadBlossomResources() {
|
||||
GameDepot.setBlossomConfig(DataLoader.loadClass("BlossomConfig.json", BlossomConfig.class));
|
||||
|
||||
15
src/main/java/emu/grasscutter/data/binout/ConfigGadget.java
Normal file
15
src/main/java/emu/grasscutter/data/binout/ConfigGadget.java
Normal file
@@ -0,0 +1,15 @@
|
||||
package emu.grasscutter.data.binout;
|
||||
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.FieldDefaults;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
@Data
|
||||
@FieldDefaults(level = AccessLevel.PRIVATE)
|
||||
public class ConfigGadget {
|
||||
// There are more values that can be added that might be useful in the json
|
||||
@Nullable
|
||||
ConfigGadgetCombat combat;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package emu.grasscutter.data.binout;
|
||||
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.FieldDefaults;
|
||||
|
||||
@Data
|
||||
@FieldDefaults(level = AccessLevel.PRIVATE)
|
||||
public class ConfigGadgetCombat {
|
||||
// There are more values that can be added that might be useful in the json
|
||||
ConfigGadgetCombatProperty property;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package emu.grasscutter.data.binout;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.FieldDefaults;
|
||||
|
||||
@Data
|
||||
@FieldDefaults(level = AccessLevel.PRIVATE)
|
||||
public class ConfigGadgetCombatProperty {
|
||||
float HP;
|
||||
boolean isLockHP;
|
||||
boolean isInvincible;
|
||||
boolean isGhostToAllied;
|
||||
float attack;
|
||||
float defence;
|
||||
float weight;
|
||||
boolean useCreatorProperty;
|
||||
}
|
||||
Reference in New Issue
Block a user