All Downloads are FREE. Search and download functionalities are using the official Maven repository.

emu.grasscutter.data.excels.weapon.WeaponPromoteData Maven / Gradle / Ivy

There is a newer version: 1.7.3
Show newest version
package emu.grasscutter.data.excels.weapon;

import emu.grasscutter.data.*;
import emu.grasscutter.data.common.*;
import java.util.ArrayList;

@ResourceType(name = "WeaponPromoteExcelConfigData.json")
public class WeaponPromoteData extends GameResource {

    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 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 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()]);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy