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