mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2026-05-18 06:39:51 +08:00
Refactor excel datas (Mainly item data)
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
package emu.grasscutter.game.props;
|
||||
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
|
||||
|
||||
public enum ItemUseTarget {
|
||||
ITEM_USE_TARGET_NONE (0),
|
||||
ITEM_USE_TARGET_CUR_AVATAR (1),
|
||||
ITEM_USE_TARGET_CUR_TEAM (2),
|
||||
ITEM_USE_TARGET_SPECIFY_AVATAR (3),
|
||||
ITEM_USE_TARGET_SPECIFY_ALIVE_AVATAR (4),
|
||||
ITEM_USE_TARGET_SPECIFY_DEAD_AVATAR (5);
|
||||
|
||||
private final int value;
|
||||
private static final Int2ObjectMap<ItemUseTarget> map = new Int2ObjectOpenHashMap<>();
|
||||
|
||||
static {
|
||||
Stream.of(values()).forEach(e -> {
|
||||
map.put(e.getValue(), e);
|
||||
});
|
||||
}
|
||||
|
||||
private ItemUseTarget(int value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public int getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public static ItemUseTarget getTypeByValue(int value) {
|
||||
return map.getOrDefault(value, ITEM_USE_TARGET_NONE);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user