Merge branch 'Card-Forge:master' into fixes20250816

This commit is contained in:
Jetz72
2025-08-16 10:15:33 -05:00
committed by GitHub
4 changed files with 12 additions and 22 deletions

View File

@@ -552,26 +552,16 @@ public final class CardEdition implements Comparable<CardEdition> {
public List<PrintSheet> getPrintSheetsBySection() { public List<PrintSheet> getPrintSheetsBySection() {
final CardDb cardDb = StaticData.instance().getCommonCards(); final CardDb cardDb = StaticData.instance().getCommonCards();
Map<String, Integer> cardToIndex = new HashMap<>();
List<PrintSheet> sheets = Lists.newArrayList(); List<PrintSheet> sheets = Lists.newArrayList();
for (String sectionName : cardMap.keySet()) { for (Map.Entry<String, java.util.Collection<EditionEntry>> section : cardMap.asMap().entrySet()) {
if (sectionName.equals(EditionSectionWithCollectorNumbers.CONJURED.getName())) { if (section.getKey().equals(EditionSectionWithCollectorNumbers.CONJURED.getName())) {
continue; continue;
} }
PrintSheet sheet = new PrintSheet(String.format("%s %s", this.getCode(), sectionName)); PrintSheet sheet = new PrintSheet(String.format("%s %s", this.getCode(), section.getKey()));
List<EditionEntry> cards = cardMap.get(sectionName); for (EditionEntry card : section.getValue()) {
for (EditionEntry card : cards) { sheet.add(cardDb.getCard(card.name, this.getCode(), card.collectorNumber));
int index = 1;
if (cardToIndex.containsKey(card.name)) {
index = cardToIndex.get(card.name) + 1;
}
cardToIndex.put(card.name, index);
PaperCard pCard = cardDb.getCard(card.name, this.getCode(), index);
sheet.add(pCard);
} }
sheets.add(sheet); sheets.add(sheet);

View File

@@ -437,6 +437,7 @@ public class AdventureDeckEditor extends FDeckEditor {
cardManager.setBtnAdvancedSearchOptions(true); cardManager.setBtnAdvancedSearchOptions(true);
cardManager.setCatalogDisplay(true); cardManager.setCatalogDisplay(true);
cardManager.setPool(getCardPool(), false); //Need to update this early for the caption. cardManager.setPool(getCardPool(), false); //Need to update this early for the caption.
this.updateCaption();
} }
@Override @Override
@@ -470,7 +471,7 @@ public class AdventureDeckEditor extends FDeckEditor {
)); ));
} }
if(parentScreen instanceof AdventureDeckEditor adventureEditor && adventureEditor.getCatalogPage() != null) { if(parentScreen instanceof AdventureDeckEditor adventureEditor && adventureEditor.getCatalogPage() != null) {
CollectionCatalogPage catalogPage = (CollectionCatalogPage) adventureEditor.getCatalogPage(); CatalogPage catalogPage = adventureEditor.getCatalogPage();
int autoSellCount = cardManager.getItemCount(card); int autoSellCount = cardManager.getItemCount(card);
int amountInCollection = player.getCards().count(card); int amountInCollection = player.getCards().count(card);
int safeToSellCount = amountInCollection - player.getCopiesUsedInDecks(card); int safeToSellCount = amountInCollection - player.getCopiesUsedInDecks(card);

View File

@@ -1793,7 +1793,7 @@ public class FDeckEditor extends TabPageScreen<FDeckEditor> {
DeckSection destination = DeckSection.matchingSection(card); DeckSection destination = DeckSection.matchingSection(card);
final DeckSectionPage destinationPage = parentScreen.getPageForSection(destination); final DeckSectionPage destinationPage = parentScreen.getPageForSection(destination);
if (!needsCommander() && !canOnlyBePartnerCommander(card)) { if (!needsCommander() && !canOnlyBePartnerCommander(card) && destinationPage != null) {
addMoveCardMenuItem(menu, card, this, destinationPage); addMoveCardMenuItem(menu, card, this, destinationPage);
if (canSideboard(card) && destination != DeckSection.Sideboard) { if (canSideboard(card) && destination != DeckSection.Sideboard) {
addMoveCardMenuItem(menu, card, this, parentScreen.getSideboardPage()); addMoveCardMenuItem(menu, card, this, parentScreen.getSideboardPage());

View File

@@ -41,6 +41,9 @@ public class NewDraftScreen extends LaunchScreen {
@Override @Override
protected void startMatch() { protected void startMatch() {
// initialize custom cubes first to fill the menus, will be instant if preloaded
LoadingOverlay.show(Forge.getLocalizer().getMessage("lblLoadingNewDraft"), true, BoosterDraft::initializeCustomDrafts);
//must run in game thread to prevent blocking UI thread //must run in game thread to prevent blocking UI thread
ThreadUtil.invokeInGameThread(() -> { ThreadUtil.invokeInGameThread(() -> {
final LimitedPoolType poolType = SGuiChoose.oneOrNone(Forge.getLocalizer().getMessage("lblChooseDraftFormat"), LimitedPoolType.values(true)); final LimitedPoolType poolType = SGuiChoose.oneOrNone(Forge.getLocalizer().getMessage("lblChooseDraftFormat"), LimitedPoolType.values(true));
@@ -49,11 +52,7 @@ public class NewDraftScreen extends LaunchScreen {
final BoosterDraft draft = BoosterDraft.createDraft(poolType); final BoosterDraft draft = BoosterDraft.createDraft(poolType);
if (draft == null) { return; } if (draft == null) { return; }
FThreads.invokeInEdtLater(() -> FThreads.invokeInEdtLater(() -> Forge.openScreen(new DraftingProcessScreen(draft, FDeckEditor.EditorConfigDraft)));
LoadingOverlay.show(Forge.getLocalizer().getMessage("lblLoadingNewDraft"), true,
() -> Forge.openScreen(new DraftingProcessScreen(draft, FDeckEditor.EditorConfigDraft))
)
);
}); });
} }
} }