mirror of
https://github.com/Melledy/LunarCore.git
synced 2025-12-13 13:54:37 +01:00
Add a basic /giveall command
This commit is contained in:
@@ -10,6 +10,8 @@ import emu.lunarcore.data.excel.ItemExcel;
|
|||||||
import emu.lunarcore.data.excel.NpcMonsterExcel;
|
import emu.lunarcore.data.excel.NpcMonsterExcel;
|
||||||
import emu.lunarcore.data.excel.StageExcel;
|
import emu.lunarcore.data.excel.StageExcel;
|
||||||
import emu.lunarcore.game.inventory.GameItem;
|
import emu.lunarcore.game.inventory.GameItem;
|
||||||
|
import emu.lunarcore.game.inventory.ItemMainType;
|
||||||
|
import emu.lunarcore.game.inventory.ItemSubType;
|
||||||
import emu.lunarcore.game.player.Player;
|
import emu.lunarcore.game.player.Player;
|
||||||
import emu.lunarcore.game.scene.entity.EntityMonster;
|
import emu.lunarcore.game.scene.entity.EntityMonster;
|
||||||
import emu.lunarcore.util.Position;
|
import emu.lunarcore.util.Position;
|
||||||
@@ -152,6 +154,36 @@ public class PlayerCommands {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Command(aliases = {"ga"}, desc = "/giveall {materials|avatars}")
|
||||||
|
public static class GiveAll extends PlayerCommand {
|
||||||
|
@Override
|
||||||
|
public void execute(Player player, String raw) {
|
||||||
|
switch (raw) {
|
||||||
|
case "materials":
|
||||||
|
// Character/Relic/Lightcone upgrade materials
|
||||||
|
for (ItemExcel excel : GameData.getItemExcelMap().values()) {
|
||||||
|
int purpose = excel.getPurposeType();
|
||||||
|
if (purpose >= 1 && purpose <= 7) {
|
||||||
|
player.getInventory().addItem(excel, 1000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Credits
|
||||||
|
player.getInventory().addItem(2, 10_000_000);
|
||||||
|
break;
|
||||||
|
case "avatars":
|
||||||
|
// All avatars and their eidolons
|
||||||
|
for (ItemExcel excel : GameData.getItemExcelMap().values()) {
|
||||||
|
if (excel.getItemMainType() == ItemMainType.AvatarCard) {
|
||||||
|
player.getInventory().addItem(excel, 1);
|
||||||
|
} else if (excel.getItemSubType() == ItemSubType.Eidolon) {
|
||||||
|
player.getInventory().addItem(excel, 6);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Temporarily disabled as spawned monsters need
|
/* Temporarily disabled as spawned monsters need
|
||||||
@Command(desc = "/spawn [monster id] [count] - Creates {count} amount of {item id}")
|
@Command(desc = "/spawn [monster id] [count] - Creates {count} amount of {item id}")
|
||||||
public static class Spawn extends PlayerCommand {
|
public static class Spawn extends PlayerCommand {
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ public class ItemExcel extends GameResource {
|
|||||||
private ItemSubType ItemSubType;
|
private ItemSubType ItemSubType;
|
||||||
private ItemRarity Rarity;
|
private ItemRarity Rarity;
|
||||||
private int PileLimit;
|
private int PileLimit;
|
||||||
|
private int PurposeType;
|
||||||
|
|
||||||
private List<ItemParam> ReturnItemIDList;
|
private List<ItemParam> ReturnItemIDList;
|
||||||
|
|
||||||
|
|||||||
@@ -84,14 +84,17 @@ public class Inventory extends BasePlayerManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean addItem(int itemId, int count) {
|
public boolean addItem(int itemId, int count) {
|
||||||
ItemExcel excel = GameData.getItemExcelMap().get(itemId);
|
ItemExcel itemExcel = GameData.getItemExcelMap().get(itemId);
|
||||||
|
|
||||||
if (excel == null) {
|
if (itemExcel == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
GameItem item = new GameItem(excel, count);
|
return addItem(itemExcel, count);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean addItem(ItemExcel itemExcel, int count) {
|
||||||
|
GameItem item = new GameItem(itemExcel, count);
|
||||||
return addItem(item);
|
return addItem(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user