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
c6bd1fa5
Commit
c6bd1fa5
authored
Apr 25, 2022
by
BaiSugar
Browse files
remove test avatar
parent
1c15dd3c
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/emu/grasscutter/command/commands/GiveAllCommand.java
View file @
c6bd1fa5
...
...
@@ -9,25 +9,24 @@ import emu.grasscutter.data.def.ItemData;
import
emu.grasscutter.game.GenshinPlayer
;
import
emu.grasscutter.game.avatar.GenshinAvatar
;
import
emu.grasscutter.game.inventory.GenshinItem
;
import
emu.grasscutter.game.inventory.ItemType
;
import
java.util.*
;
@Command
(
label
=
"giveall"
,
usage
=
"giveall [player] <amount>"
,
description
=
"Gives all items"
,
aliases
=
{
"givea"
},
permission
=
"player.giveall"
,
threading
=
true
)
public
class
GiveAllCommand
implements
CommandHandler
{
@Override
public
void
execute
(
GenshinPlayer
sender
,
List
<
String
>
args
)
{
int
target
,
amount
=
99999
;
if
(
sender
==
null
){
CommandHandler
.
sendMessage
(
null
,
"Run this command in-game"
);
return
;
}
switch
(
args
.
size
())
{
default
:
// *no args*
try
{
target
=
sender
.
getUid
();
}
catch
(
NullPointerException
ignored
){
CommandHandler
.
sendMessage
(
sender
,
"Player not found."
);
return
;
}
target
=
sender
.
getUid
();
break
;
case
1
:
// [player]
try
{
...
...
@@ -44,7 +43,7 @@ public class GiveAllCommand implements CommandHandler {
case
2
:
// [player] [amount]
try
{
target
=
Integer
.
parseInt
(
args
.
get
(
0
));
if
(
Grasscutter
.
getGameServer
().
getPlayerByUid
(
target
)
==
null
&&
sender
!=
null
)
{
if
(
Grasscutter
.
getGameServer
().
getPlayerByUid
(
target
)
==
null
)
{
target
=
sender
.
getUid
();
amount
=
Integer
.
parseInt
(
args
.
get
(
0
));
}
else
{
...
...
@@ -56,8 +55,8 @@ public class GiveAllCommand implements CommandHandler {
}
break
;
}
GenshinPlayer
targetPlayer
=
Grasscutter
.
getGameServer
().
getPlayerByUid
(
target
);
GenshinPlayer
targetPlayer
=
Grasscutter
.
getGameServer
().
getPlayerByUid
(
target
);
if
(
targetPlayer
==
null
)
{
CommandHandler
.
sendMessage
(
sender
,
"Player not found."
);
return
;
...
...
@@ -68,14 +67,19 @@ public class GiveAllCommand implements CommandHandler {
}
public
void
GetAllItem
(
GenshinPlayer
player
,
int
amount
){
CommandHandler
.
sendMessage
(
player
,
"Getting all item
s…
"
);
CommandHandler
.
sendMessage
(
player
,
"Getting all item
....
"
);
Collection
<
GenshinItem
>
genshinItemList
=
new
LinkedList
<>();
for
(
ItemData
itemdata:
GenshinData
.
getItemDataMap
().
values
())
{
if
(
itemdata
.
getId
()
>
1000
&&
itemdata
.
getId
()
<=
1099
)
continue
;
//is avatar
if
(
itemdata
.
isEquip
())
{
for
(
int
i
=
0
;
i
<
20
;
i
++)
{
genshinItemList
.
add
(
new
GenshinItem
(
itemdata
));
GenshinItem
genshinItem
=
new
GenshinItem
(
itemdata
);
if
(
itemdata
.
getItemType
()
==
ItemType
.
ITEM_WEAPON
){
genshinItem
.
setLevel
(
90
);
genshinItem
.
setPromoteLevel
(
6
);
}
genshinItemList
.
add
(
genshinItem
);
}
}
else
{
GenshinItem
genshinItem
=
new
GenshinItem
(
itemdata
);
...
...
@@ -86,6 +90,7 @@ public class GiveAllCommand implements CommandHandler {
player
.
getInventory
().
addItems
(
genshinItemList
);
for
(
AvatarData
avatarData:
GenshinData
.
getAvatarDataMap
().
values
())
{
if
(
avatarData
.
getId
()
==
10000001
||
avatarData
.
getId
()
>=
10000099
)
continue
;
// Calculate ascension level.
int
ascension
=
(
int
)
Math
.
ceil
(
90
/
10
f
)
-
3
;
GenshinAvatar
avatar
=
new
GenshinAvatar
(
avatarData
);
...
...
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