Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
ziqian zhang
Grasscutter
Commits
9869e436
Commit
9869e436
authored
May 08, 2022
by
ImmuState
Committed by
Melledy
May 08, 2022
Browse files
-Make the _tier suffix optional.
parent
935bb4b5
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/emu/grasscutter/command/commands/GiveArtifactCommand.java
View file @
9869e436
...
@@ -70,15 +70,27 @@ public final class GiveArtifactCommand implements CommandHandler {
...
@@ -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
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment