mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2025-02-08 00:22:53 +08:00
-Make the _tier suffix optional.
This commit is contained in:
parent
2a12ed5694
commit
8c7a46e8ef
@ -70,15 +70,27 @@ public final class GiveArtifactCommand implements CommandHandler {
|
|||||||
|
|
||||||
// If the argument was not an integer, we try to determine
|
// If the argument was not an integer, we try to determine
|
||||||
// the append prop ID from the given text + artifact information.
|
// the append prop ID from the given text + artifact information.
|
||||||
// A substat string has the format `substat_tier`.
|
// A substat string has the format `substat_tier`, with the
|
||||||
|
// `_tier` part being optional.
|
||||||
String[] substatArgs = substatText.split("_");
|
String[] substatArgs = substatText.split("_");
|
||||||
if (substatArgs.length != 2) {
|
String substatType;
|
||||||
|
int substatTier;
|
||||||
|
|
||||||
|
if (substatArgs.length == 1) {
|
||||||
|
substatType = substatArgs[0];
|
||||||
|
substatTier =
|
||||||
|
itemData.getRankLevel() == 1 ? 2
|
||||||
|
: itemData.getRankLevel() == 2 ? 3
|
||||||
|
: 4;
|
||||||
|
}
|
||||||
|
else if (substatArgs.length == 2) {
|
||||||
|
substatType = substatArgs[0];
|
||||||
|
substatTier = Integer.parseInt(substatArgs[1]);
|
||||||
|
}
|
||||||
|
else {
|
||||||
throw new IllegalArgumentException();
|
throw new IllegalArgumentException();
|
||||||
}
|
}
|
||||||
|
|
||||||
String substatType = substatArgs[0];
|
|
||||||
int substatTier = Integer.parseInt(substatArgs[1]);
|
|
||||||
|
|
||||||
// Check if the specified tier is legal for the artifact rarity.
|
// Check if the specified tier is legal for the artifact rarity.
|
||||||
if (substatTier < 1 || substatTier > 4) {
|
if (substatTier < 1 || substatTier > 4) {
|
||||||
throw new IllegalArgumentException();
|
throw new IllegalArgumentException();
|
||||||
|
Loading…
Reference in New Issue
Block a user