Expand /giveall command to also be able to give all lightcones and relics

This commit is contained in:
Melledy
2023-11-25 03:02:07 -08:00
parent f22e0f3ef3
commit fa1b1b28bb

View File

@@ -9,11 +9,12 @@ import emu.lunarcore.command.CommandHandler;
import emu.lunarcore.data.GameData;
import emu.lunarcore.data.excel.ItemExcel;
import emu.lunarcore.game.enums.ItemMainType;
import emu.lunarcore.game.enums.ItemRarity;
import emu.lunarcore.game.enums.ItemSubType;
import emu.lunarcore.game.inventory.GameItem;
import emu.lunarcore.game.player.Player;
@Command(label = "giveall", aliases = {"ga"}, permission = "player.give", desc = "/giveall {materials | avatars}. Gives the targeted player items.")
@Command(label = "giveall", aliases = {"ga"}, permission = "player.give", desc = "/giveall {materials | avatars | lightcones | relics}. Gives the targeted player items.")
public class GiveAllCommand implements CommandHandler {
@Override
@@ -27,9 +28,9 @@ public class GiveAllCommand implements CommandHandler {
String type = args.get(0).toLowerCase();
switch (type) {
case "materials", "mats" -> {
//
case "m", "materials", "mats" -> {
List<GameItem> items = new ArrayList<>();
// Character/Relic/Lightcone upgrade materials
for (ItemExcel excel : GameData.getItemExcelMap().values()) {
int purpose = excel.getPurposeType();
@@ -37,14 +38,45 @@ public class GiveAllCommand implements CommandHandler {
items.add(new GameItem(excel, 1000));
}
}
// Credits
items.add(new GameItem(2, 50_000_000));
// Add
// Add to target's inventory
args.getTarget().getInventory().addItems(items, true);
// Send message
this.sendMessage(sender, "Giving " + args.getTarget().getName() + " " + items.size() + " items");
}
case "avatars" -> {
case "lc", "lightcones" -> {
// Get lightcones
List<GameItem> items = GameData.getItemExcelMap().values()
.stream()
.filter(ItemExcel::isEquipment)
.map(excel -> new GameItem(excel, 1))
.toList();
// Add to target's inventory
args.getTarget().getInventory().addItems(items, true);
// Send message
this.sendMessage(sender, "Giving " + args.getTarget().getName() + " " + items.size() + " light cones");
}
case "r", "relics" -> {
// Get relics
List<GameItem> items = GameData.getItemExcelMap().values()
.stream()
.filter(excel -> excel.isRelic() && excel.getRarity() == ItemRarity.SuperRare)
.map(excel -> new GameItem(excel, 1))
.toList();
// Add to target's inventory
args.getTarget().getInventory().addItems(items, true);
// Send message
this.sendMessage(sender, "Giving " + args.getTarget().getName() + " " + items.size() + " relics");
}
case "a", "characters", "avatars" -> {
// All avatars and their eidolons
for (ItemExcel excel : GameData.getItemExcelMap().values()) {
if (excel.getItemMainType() == ItemMainType.AvatarCard) {
@@ -53,6 +85,7 @@ public class GiveAllCommand implements CommandHandler {
args.getTarget().getInventory().addItem(excel, 6);
}
}
// Send message
this.sendMessage(sender, "Giving " + args.getTarget().getName() + " all avatars");
}