remove test avatar

This commit is contained in:
BaiSugar 2022-04-25 15:17:55 +08:00
parent 05c6b29831
commit 1567e480e1

View File

@ -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;
switch (args.size()) {
default: // *no args*
try {
target = sender.getUid();
}catch (NullPointerException ignored){
CommandHandler.sendMessage(sender, "Player not found.");
if(sender == null){
CommandHandler.sendMessage(null, "Run this command in-game");
return;
}
switch (args.size()) {
default: // *no args*
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 items…");
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 / 10f) - 3;
GenshinAvatar avatar = new GenshinAvatar(avatarData);