added icons to giveall

This commit is contained in:
Hiro
2023-11-28 07:07:14 +02:00
parent 3025c8a436
commit b7699b23d0
4 changed files with 48 additions and 0 deletions

View File

@@ -5,6 +5,7 @@ import java.util.List;
import emu.lunarcore.command.Command;
import emu.lunarcore.command.CommandArgs;
import java.util.stream.Collectors;
import emu.lunarcore.command.CommandHandler;
import emu.lunarcore.data.GameData;
import emu.lunarcore.data.excel.ItemExcel;
@@ -69,6 +70,20 @@ public class GiveAllCommand implements CommandHandler {
// Send message
this.sendMessage(sender, "Giving " + target.getName() + " " + items.size() + " light cones");
}
case "ic", "icons" -> {
// Get UnlockedHeads
for (int iconhead : GameData.getAllIconHeads()) {
// Skip if target already has the head icon
if (target.getUnlockedHeadIcons().contains(iconhead)) {
continue;
}
target.addHeadIcon(iconhead);
}
// Send message
this.sendMessage(sender, "Added all icons to " + target.getName());
}
case "r", "relics" -> {
// Get relics
List<GameItem> items = GameData.getItemExcelMap().values()

View File

@@ -31,6 +31,7 @@ public class GameData {
@Getter private static Int2ObjectMap<HeroExcel> heroExcelMap = new Int2ObjectOpenHashMap<>();
@Getter private static Int2ObjectMap<ShopExcel> shopExcelMap = new Int2ObjectOpenHashMap<>();
@Getter private static Int2ObjectMap<RewardExcel> rewardExcelMap = new Int2ObjectOpenHashMap<>();
@Getter private static Int2ObjectMap<PlayerIconExcel> playerIconExcelMap = new Int2ObjectOpenHashMap<>();
@Getter private static Int2ObjectMap<ItemComposeExcel> itemComposeExcelMap = new Int2ObjectOpenHashMap<>();
@Getter private static Int2ObjectMap<ActivityPanelExcel> activityPanelExcelMap = new Int2ObjectOpenHashMap<>();
@@ -107,6 +108,17 @@ public class GameData {
return allIds;
}
public static List<Integer> getAllIconHeads() {
List<Integer> allIds = new ArrayList<>();
for (Int2ObjectMap.Entry<PlayerIconExcel> entry : playerIconExcelMap.int2ObjectEntrySet()) {
PlayerIconExcel playerIconExcel = entry.getValue();
allIds.add(playerIconExcel.getId());
}
return allIds;
}
public static AvatarPromotionExcel getAvatarPromotionExcel(int id, int promotion) {
return avatarPromotionExcelMap.get((id << 8) + promotion);
}

View File

@@ -44,6 +44,10 @@ public class ItemExcel extends GameResource {
return ItemMainType == emu.lunarcore.game.enums.ItemMainType.Equipment && this.getEquipmentExcel() != null;
}
public boolean isHeadIcon() {
return ItemSubType == emu.lunarcore.game.enums.ItemSubType.HeadIcon;
}
public boolean isRelic() {
return ItemMainType == emu.lunarcore.game.enums.ItemMainType.Relic && this.getRelicExcel() != null;
}

View File

@@ -0,0 +1,17 @@
package emu.lunarcore.data.excel;
import emu.lunarcore.data.GameResource;
import emu.lunarcore.data.ResourceType;
import emu.lunarcore.data.ResourceType.LoadPriority;
import lombok.Getter;
@Getter
@ResourceType(name = {"PlayerIcon.json"}, loadPriority = LoadPriority.NORMAL)
public class PlayerIconExcel extends GameResource {
private int ID;
@Override
public int getId() {
return ID;
}
}