mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2025-01-26 22:32:57 +08:00
Add icons to item data
This commit is contained in:
parent
a27f7e0373
commit
2a5abc1dcb
@ -1,154 +1,155 @@
|
|||||||
package emu.grasscutter.data.excels;
|
package emu.grasscutter.data.excels;
|
||||||
|
|
||||||
import com.google.gson.annotations.SerializedName;
|
import com.google.gson.annotations.SerializedName;
|
||||||
import emu.grasscutter.data.GameResource;
|
import emu.grasscutter.data.GameResource;
|
||||||
import emu.grasscutter.data.ResourceType;
|
import emu.grasscutter.data.ResourceType;
|
||||||
import emu.grasscutter.data.common.ItemUseData;
|
import emu.grasscutter.data.common.ItemUseData;
|
||||||
import emu.grasscutter.game.inventory.EquipType;
|
import emu.grasscutter.game.inventory.EquipType;
|
||||||
import emu.grasscutter.game.inventory.ItemType;
|
import emu.grasscutter.game.inventory.ItemType;
|
||||||
import emu.grasscutter.game.inventory.MaterialType;
|
import emu.grasscutter.game.inventory.MaterialType;
|
||||||
import emu.grasscutter.game.props.FightProperty;
|
import emu.grasscutter.game.props.FightProperty;
|
||||||
import emu.grasscutter.game.props.ItemUseAction.ItemUseAction;
|
import emu.grasscutter.game.props.ItemUseAction.ItemUseAction;
|
||||||
import emu.grasscutter.game.props.ItemUseOp;
|
import emu.grasscutter.game.props.ItemUseOp;
|
||||||
import emu.grasscutter.game.props.ItemUseTarget;
|
import emu.grasscutter.game.props.ItemUseTarget;
|
||||||
import it.unimi.dsi.fastutil.ints.IntOpenHashSet;
|
import it.unimi.dsi.fastutil.ints.IntOpenHashSet;
|
||||||
import it.unimi.dsi.fastutil.ints.IntSet;
|
import it.unimi.dsi.fastutil.ints.IntSet;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
||||||
@ResourceType(
|
@ResourceType(
|
||||||
name = {
|
name = {
|
||||||
"MaterialExcelConfigData.json",
|
"MaterialExcelConfigData.json",
|
||||||
"WeaponExcelConfigData.json",
|
"WeaponExcelConfigData.json",
|
||||||
"ReliquaryExcelConfigData.json",
|
"ReliquaryExcelConfigData.json",
|
||||||
"HomeWorldFurnitureExcelConfigData.json"
|
"HomeWorldFurnitureExcelConfigData.json"
|
||||||
})
|
})
|
||||||
@Getter
|
@Getter
|
||||||
public class ItemData extends GameResource {
|
public class ItemData extends GameResource {
|
||||||
// Main
|
// Main
|
||||||
@Getter(onMethod_ = @Override)
|
@Getter(onMethod_ = @Override)
|
||||||
private int id;
|
private int id;
|
||||||
|
|
||||||
private final int stackLimit = 1;
|
private final int stackLimit = 1;
|
||||||
private int maxUseCount;
|
private int maxUseCount;
|
||||||
private int rankLevel;
|
private int rankLevel;
|
||||||
private String effectName;
|
private String effectName;
|
||||||
private int rank;
|
private int rank;
|
||||||
private int weight;
|
private int weight;
|
||||||
private int gadgetId;
|
private int gadgetId;
|
||||||
|
private String icon;
|
||||||
private int[] destroyReturnMaterial;
|
|
||||||
private int[] destroyReturnMaterialCount;
|
private int[] destroyReturnMaterial;
|
||||||
|
private int[] destroyReturnMaterialCount;
|
||||||
// Enums
|
|
||||||
private final ItemType itemType = ItemType.ITEM_NONE;
|
// Enums
|
||||||
private MaterialType materialType = MaterialType.MATERIAL_NONE;
|
private final ItemType itemType = ItemType.ITEM_NONE;
|
||||||
private EquipType equipType = EquipType.EQUIP_NONE;
|
private MaterialType materialType = MaterialType.MATERIAL_NONE;
|
||||||
private String effectType;
|
private EquipType equipType = EquipType.EQUIP_NONE;
|
||||||
private String destroyRule;
|
private String effectType;
|
||||||
|
private String destroyRule;
|
||||||
// Food
|
|
||||||
private String foodQuality;
|
// Food
|
||||||
private int[] satiationParams;
|
private String foodQuality;
|
||||||
|
private int[] satiationParams;
|
||||||
// Usable item
|
|
||||||
private final ItemUseTarget useTarget = ItemUseTarget.ITEM_USE_TARGET_NONE;
|
// Usable item
|
||||||
private List<ItemUseData> itemUse;
|
private final ItemUseTarget useTarget = ItemUseTarget.ITEM_USE_TARGET_NONE;
|
||||||
private List<ItemUseAction> itemUseActions;
|
private List<ItemUseData> itemUse;
|
||||||
private final boolean useOnGain = false;
|
private List<ItemUseAction> itemUseActions;
|
||||||
|
private final boolean useOnGain = false;
|
||||||
// Relic
|
|
||||||
private int mainPropDepotId;
|
// Relic
|
||||||
private int appendPropDepotId;
|
private int mainPropDepotId;
|
||||||
private int appendPropNum;
|
private int appendPropDepotId;
|
||||||
private int setId;
|
private int appendPropNum;
|
||||||
private int[] addPropLevels;
|
private int setId;
|
||||||
private int baseConvExp;
|
private int[] addPropLevels;
|
||||||
private int maxLevel;
|
private int baseConvExp;
|
||||||
|
private int maxLevel;
|
||||||
// Weapon
|
|
||||||
private int weaponPromoteId;
|
// Weapon
|
||||||
private int weaponBaseExp;
|
private int weaponPromoteId;
|
||||||
private int storyId;
|
private int weaponBaseExp;
|
||||||
private int avatarPromoteId;
|
private int storyId;
|
||||||
private int awakenMaterial;
|
private int avatarPromoteId;
|
||||||
private int[] awakenCosts;
|
private int awakenMaterial;
|
||||||
private int[] skillAffix;
|
private int[] awakenCosts;
|
||||||
private WeaponProperty[] weaponProp;
|
private int[] skillAffix;
|
||||||
|
private WeaponProperty[] weaponProp;
|
||||||
// Hash
|
|
||||||
private long nameTextMapHash;
|
// Hash
|
||||||
|
private long nameTextMapHash;
|
||||||
// Furniture
|
|
||||||
private int comfort;
|
// Furniture
|
||||||
private List<Integer> furnType;
|
private int comfort;
|
||||||
private List<Integer> furnitureGadgetID;
|
private List<Integer> furnType;
|
||||||
|
private List<Integer> furnitureGadgetID;
|
||||||
@SerializedName(
|
|
||||||
value = "roomSceneId",
|
@SerializedName(
|
||||||
alternate = {"BMEPAMCNABE", "DANFGGLKLNO", "JFDLJGDFIGL", "OHIANNAEEAK", "MFGACDIOHGF"})
|
value = "roomSceneId",
|
||||||
private int roomSceneId;
|
alternate = {"BMEPAMCNABE", "DANFGGLKLNO", "JFDLJGDFIGL", "OHIANNAEEAK", "MFGACDIOHGF"})
|
||||||
|
private int roomSceneId;
|
||||||
// Custom
|
|
||||||
private transient IntSet addPropLevelSet;
|
// Custom
|
||||||
|
private transient IntSet addPropLevelSet;
|
||||||
public WeaponProperty[] getWeaponProperties() {
|
|
||||||
return this.weaponProp;
|
public WeaponProperty[] getWeaponProperties() {
|
||||||
}
|
return this.weaponProp;
|
||||||
|
}
|
||||||
public boolean canAddRelicProp(int level) {
|
|
||||||
return this.addPropLevelSet != null && this.addPropLevelSet.contains(level);
|
public boolean canAddRelicProp(int level) {
|
||||||
}
|
return this.addPropLevelSet != null && this.addPropLevelSet.contains(level);
|
||||||
|
}
|
||||||
public boolean isEquip() {
|
|
||||||
return this.itemType == ItemType.ITEM_RELIQUARY || this.itemType == ItemType.ITEM_WEAPON;
|
public boolean isEquip() {
|
||||||
}
|
return this.itemType == ItemType.ITEM_RELIQUARY || this.itemType == ItemType.ITEM_WEAPON;
|
||||||
|
}
|
||||||
@Override
|
|
||||||
public void onLoad() {
|
@Override
|
||||||
if (this.itemType == ItemType.ITEM_RELIQUARY) {
|
public void onLoad() {
|
||||||
if (this.addPropLevels != null && this.addPropLevels.length > 0) {
|
if (this.itemType == ItemType.ITEM_RELIQUARY) {
|
||||||
this.addPropLevelSet = new IntOpenHashSet(this.addPropLevels);
|
if (this.addPropLevels != null && this.addPropLevels.length > 0) {
|
||||||
}
|
this.addPropLevelSet = new IntOpenHashSet(this.addPropLevels);
|
||||||
} else if (this.itemType == ItemType.ITEM_WEAPON) {
|
}
|
||||||
this.equipType = EquipType.EQUIP_WEAPON;
|
} else if (this.itemType == ItemType.ITEM_WEAPON) {
|
||||||
} else {
|
this.equipType = EquipType.EQUIP_WEAPON;
|
||||||
this.equipType = EquipType.EQUIP_NONE;
|
} else {
|
||||||
}
|
this.equipType = EquipType.EQUIP_NONE;
|
||||||
|
}
|
||||||
if (this.weaponProp != null) {
|
|
||||||
this.weaponProp =
|
if (this.weaponProp != null) {
|
||||||
Arrays.stream(this.weaponProp)
|
this.weaponProp =
|
||||||
.filter(prop -> prop.getPropType() != null)
|
Arrays.stream(this.weaponProp)
|
||||||
.toArray(WeaponProperty[]::new);
|
.filter(prop -> prop.getPropType() != null)
|
||||||
}
|
.toArray(WeaponProperty[]::new);
|
||||||
|
}
|
||||||
if (this.getFurnType() != null) {
|
|
||||||
this.furnType = this.furnType.stream().filter(x -> x > 0).toList();
|
if (this.getFurnType() != null) {
|
||||||
}
|
this.furnType = this.furnType.stream().filter(x -> x > 0).toList();
|
||||||
if (this.getFurnitureGadgetID() != null) {
|
}
|
||||||
this.furnitureGadgetID = this.furnitureGadgetID.stream().filter(x -> x > 0).toList();
|
if (this.getFurnitureGadgetID() != null) {
|
||||||
}
|
this.furnitureGadgetID = this.furnitureGadgetID.stream().filter(x -> x > 0).toList();
|
||||||
|
}
|
||||||
// Prevent material type from being null
|
|
||||||
this.materialType = this.materialType == null ? MaterialType.MATERIAL_NONE : this.materialType;
|
// Prevent material type from being null
|
||||||
|
this.materialType = this.materialType == null ? MaterialType.MATERIAL_NONE : this.materialType;
|
||||||
if (this.itemUse != null && !this.itemUse.isEmpty()) {
|
|
||||||
this.itemUseActions =
|
if (this.itemUse != null && !this.itemUse.isEmpty()) {
|
||||||
this.itemUse.stream()
|
this.itemUseActions =
|
||||||
.filter(x -> x.getUseOp() != ItemUseOp.ITEM_USE_NONE)
|
this.itemUse.stream()
|
||||||
.map(ItemUseAction::fromItemUseData)
|
.filter(x -> x.getUseOp() != ItemUseOp.ITEM_USE_NONE)
|
||||||
.filter(Objects::nonNull)
|
.map(ItemUseAction::fromItemUseData)
|
||||||
.toList();
|
.filter(Objects::nonNull)
|
||||||
}
|
.toList();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
@Getter
|
|
||||||
public static class WeaponProperty {
|
@Getter
|
||||||
private FightProperty propType;
|
public static class WeaponProperty {
|
||||||
private float initValue;
|
private FightProperty propType;
|
||||||
private String type;
|
private float initValue;
|
||||||
}
|
private String type;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
@ -20,6 +20,8 @@ import java.util.Map;
|
|||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
public interface Dumpers {
|
public interface Dumpers {
|
||||||
|
// See `src/handbook/data/README.md` for attributions.
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fetches the description of a command.
|
* Fetches the description of a command.
|
||||||
*
|
*
|
||||||
@ -141,7 +143,8 @@ public interface Dumpers {
|
|||||||
var dump = new HashMap<Integer, ItemData>();
|
var dump = new HashMap<Integer, ItemData>();
|
||||||
GameData.getItemDataMap().forEach((id, item) -> dump.put(id, new ItemData(
|
GameData.getItemDataMap().forEach((id, item) -> dump.put(id, new ItemData(
|
||||||
Language.getTextMapKey(item.getNameTextMapHash()).get(locale),
|
Language.getTextMapKey(item.getNameTextMapHash()).get(locale),
|
||||||
Quality.from(item.getRankLevel()), item.getItemType()
|
Quality.from(item.getRankLevel()), item.getItemType(),
|
||||||
|
item.getIcon().length() > 0 ? item.getIcon().substring(3) : ""
|
||||||
)));
|
)));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -185,12 +188,14 @@ public interface Dumpers {
|
|||||||
public String name;
|
public String name;
|
||||||
public Quality quality;
|
public Quality quality;
|
||||||
public ItemType type;
|
public ItemType type;
|
||||||
|
public String icon;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return this.name + ","
|
return this.name + ","
|
||||||
+ this.quality + ","
|
+ this.quality + ","
|
||||||
+ this.type;
|
+ this.type + ","
|
||||||
|
+ this.icon;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user