diff --git a/forge-gui-desktop/src/main/java/forge/screens/home/quest/CSubmenuQuestData.java b/forge-gui-desktop/src/main/java/forge/screens/home/quest/CSubmenuQuestData.java index 24a7a9b7d15..a7cfb424db2 100644 --- a/forge-gui-desktop/src/main/java/forge/screens/home/quest/CSubmenuQuestData.java +++ b/forge-gui-desktop/src/main/java/forge/screens/home/quest/CSubmenuQuestData.java @@ -90,6 +90,24 @@ public enum CSubmenuQuestData implements ICDoc { } }); + view.getBtnSelectFormat().setCommand(new UiCommand() { + @Override + public void run() { + final DialogChooseFormats dialog = new DialogChooseFormats(); + dialog.setOkCallback(new Runnable() { + @Override + public void run() { + customFormatCodes.clear(); + Set sets = new HashSet(); + for(GameFormat format:dialog.getSelectedFormats()){ + sets.addAll(format.getAllowedSetCodes()); + } + customFormatCodes.addAll(sets); + } + }); + } + }); + view.getBtnPrizeCustomFormat().setCommand(new UiCommand() { @Override public void run() { @@ -104,6 +122,24 @@ public enum CSubmenuQuestData implements ICDoc { } }); + view.getBtnPrizeSelectFormat().setCommand(new UiCommand() { + @Override + public void run() { + final DialogChooseFormats dialog = new DialogChooseFormats(); + dialog.setOkCallback(new Runnable() { + @Override + public void run() { + customPrizeFormatCodes.clear(); + Set sets = new HashSet(); + for(GameFormat format:dialog.getSelectedFormats()){ + sets.addAll(format.getAllowedSetCodes()); + } + customPrizeFormatCodes.addAll(sets); + } + }); + } + }); + view.getBtnPreferredColors().setCommand(new UiCommand() { @Override public void run() { @@ -197,10 +233,11 @@ public enum CSubmenuQuestData implements ICDoc { if (worldFormat == null) { switch(view.getStartingPoolType()) { - case Rotating: + case Sanctioned: fmtStartPool = view.getRotatingFormat(); break; + case Casual: case CustomFormat: if (customFormatCodes.isEmpty()) { if (!FOptionPane.showConfirmDialog("You have defined a custom format that doesn't contain any sets.\nThis will start a game without restriction.\n\nContinue?")) { @@ -257,6 +294,7 @@ public enum CSubmenuQuestData implements ICDoc { case Complete: fmtPrizes = null; break; + case Casual: case CustomFormat: if (customPrizeFormatCodes.isEmpty()) { if (!FOptionPane.showConfirmDialog("You have defined custom format as containing no sets.\nThis will choose all editions without restriction as prizes.\n\nContinue?")) { @@ -265,7 +303,7 @@ public enum CSubmenuQuestData implements ICDoc { } fmtPrizes = customPrizeFormatCodes.isEmpty() ? null : new GameFormat("Custom Prizes", customPrizeFormatCodes, null); // chosen sets and no banned cards break; - case Rotating: + case Sanctioned: fmtPrizes = view.getPrizedRotatingFormat(); break; default: diff --git a/forge-gui-desktop/src/main/java/forge/screens/home/quest/VSubmenuQuestData.java b/forge-gui-desktop/src/main/java/forge/screens/home/quest/VSubmenuQuestData.java index cba9e02430c..9eee9e58ca3 100644 --- a/forge-gui-desktop/src/main/java/forge/screens/home/quest/VSubmenuQuestData.java +++ b/forge-gui-desktop/src/main/java/forge/screens/home/quest/VSubmenuQuestData.java @@ -82,6 +82,8 @@ public enum VSubmenuQuestData implements IVSubmenu { private final FComboBoxWrapper cbxCustomDeck = new FComboBoxWrapper<>(); private final FLabel btnDefineCustomFormat = new FLabel.Builder().opaque(true).hoverable(true).text("Define custom format").build(); + private final FLabel btnSelectFormat = new FLabel.Builder().opaque(true).hoverable(true).text("Select format").build(); + private final FCheckBox boxCompleteSet = new FCheckBox("Start with all cards in selected sets"); private final FCheckBox boxAllowDuplicates = new FCheckBox("Allow duplicate cards"); @@ -91,6 +93,8 @@ public enum VSubmenuQuestData implements IVSubmenu { private final FLabel btnPrizeDefineCustomFormat = new FLabel.Builder().opaque(true).hoverable(true).text("Define custom format").build(); + private final FLabel btnPrizeSelectFormat = new FLabel.Builder().opaque(true).hoverable(true).text("Select format").build(); + private final FLabel lblPrizedCards = new FLabel.Builder().text("Prized cards:").build(); private final FComboBoxWrapper cbxPrizedCards = new FComboBoxWrapper<>(); @@ -116,10 +120,11 @@ public enum VSubmenuQuestData implements IVSubmenu { lblPreconDeck.setVisible(newVal == StartingPoolType.Precon); cbxPreconDeck.setVisible(newVal == StartingPoolType.Precon); - lblFormat.setVisible(newVal == StartingPoolType.Rotating); - cbxFormat.setVisible(newVal == StartingPoolType.Rotating); + lblFormat.setVisible(newVal == StartingPoolType.Sanctioned); + cbxFormat.setVisible(newVal == StartingPoolType.Sanctioned); btnDefineCustomFormat.setVisible(newVal == StartingPoolType.CustomFormat); + btnSelectFormat.setVisible(newVal == StartingPoolType.Casual); final boolean usesDeckList = newVal == StartingPoolType.SealedDeck || newVal == StartingPoolType.DraftDeck || newVal == StartingPoolType.Cube; @@ -152,9 +157,10 @@ public enum VSubmenuQuestData implements IVSubmenu { lblPrizeUnrestricted.setVisible(newVal == StartingPoolType.Complete); cboAllowUnlocks.setVisible(newVal != StartingPoolType.Complete); - lblPrizeFormat.setVisible(newVal == StartingPoolType.Rotating); - cbxPrizeFormat.setVisible(newVal == StartingPoolType.Rotating); + lblPrizeFormat.setVisible(newVal == StartingPoolType.Sanctioned); + cbxPrizeFormat.setVisible(newVal == StartingPoolType.Sanctioned); btnPrizeDefineCustomFormat.setVisible(newVal == StartingPoolType.CustomFormat); + btnPrizeSelectFormat.setVisible(newVal == StartingPoolType.Casual); lblPrizeSameAsStarting.setVisible(newVal == null); } }; @@ -200,7 +206,8 @@ public enum VSubmenuQuestData implements IVSubmenu { boxAllowDuplicates.setToolTipText("When your starting pool is generated, duplicates of cards may be included."); cbxStartingPool.addItem(StartingPoolType.Complete); - cbxStartingPool.addItem(StartingPoolType.Rotating); + cbxStartingPool.addItem(StartingPoolType.Sanctioned); + cbxStartingPool.addItem(StartingPoolType.Casual); cbxStartingPool.addItem(StartingPoolType.CustomFormat); cbxStartingPool.addItem(StartingPoolType.Precon); cbxStartingPool.addItem(StartingPoolType.DraftDeck); @@ -214,7 +221,8 @@ public enum VSubmenuQuestData implements IVSubmenu { cbxPrizedCards.addItem("Same as starting pool"); cbxPrizedCards.addItem(StartingPoolType.Complete); - cbxPrizedCards.addItem(StartingPoolType.Rotating); + cbxPrizedCards.addItem(StartingPoolType.Sanctioned); + cbxPrizedCards.addItem(StartingPoolType.Casual); cbxPrizedCards.addItem(StartingPoolType.CustomFormat); cbxPrizedCards.addActionListener(alPrizesPool); @@ -311,6 +319,7 @@ public enum VSubmenuQuestData implements IVSubmenu { cbxFormat.addTo(pnlRestrictions, constraints + cboWidthStart + " cell 1 1"); pnlRestrictions.add(btnDefineCustomFormat, btnStartingCustomFormatWidth + constraints + hidemode + " cell 1 1"); + pnlRestrictions.add(btnSelectFormat, btnStartingCustomFormatWidth + constraints + hidemode + " cell 1 1"); pnlRestrictions.add(boxAllowDuplicates, "h 15px!, cell 1 2"); pnlRestrictions.add(boxCompleteSet, "h 15px!, cell 1 3"); @@ -325,6 +334,7 @@ public enum VSubmenuQuestData implements IVSubmenu { pnlRestrictions.add(lblPrizeFormat, constraints + hidemode + "cell 0 6"); cbxPrizeFormat.addTo(pnlRestrictions, constraints + cboWidthStart + "cell 1 6"); // , skip 1 pnlRestrictions.add(btnPrizeDefineCustomFormat, btnStartingCustomFormatWidth + constraints + hidemode + "cell 1 6"); + pnlRestrictions.add(btnPrizeSelectFormat, btnStartingCustomFormatWidth + constraints + hidemode + "cell 1 6"); pnlRestrictions.add(lblPrizeSameAsStarting, constraints + hidemode + "cell 1 6"); pnlRestrictions.add(lblPrizeUnrestricted, constraints + hidemode + "cell 1 6"); @@ -498,9 +508,23 @@ public enum VSubmenuQuestData implements IVSubmenu { return cbxPrizeFormat.getSelectedItem(); } + public GameFormat getCasualFormat() { + return cbxFormat.getSelectedItem(); + } + + public GameFormat getPrizedCasualFormat() { + return cbxPrizeFormat.getSelectedItem(); + } + public FLabel getBtnCustomFormat() { return btnDefineCustomFormat; } + public FLabel getBtnSelectFormat() { + return btnSelectFormat; + } + public FLabel getBtnPrizeSelectFormat() { + return btnPrizeSelectFormat; + } public FLabel getBtnPrizeCustomFormat() { return btnPrizeDefineCustomFormat; } diff --git a/forge-gui-mobile/src/forge/screens/quest/NewQuestScreen.java b/forge-gui-mobile/src/forge/screens/quest/NewQuestScreen.java index 7ae26f11386..3bbe3f72648 100644 --- a/forge-gui-mobile/src/forge/screens/quest/NewQuestScreen.java +++ b/forge-gui-mobile/src/forge/screens/quest/NewQuestScreen.java @@ -183,7 +183,7 @@ public class NewQuestScreen extends FScreen { super(null, NewGameMenu.getMenu()); cbxStartingPool.addItem(StartingPoolType.Complete); - cbxStartingPool.addItem(StartingPoolType.Rotating); + cbxStartingPool.addItem(StartingPoolType.Sanctioned); cbxStartingPool.addItem(StartingPoolType.CustomFormat); cbxStartingPool.addItem(StartingPoolType.Precon); cbxStartingPool.addItem(StartingPoolType.DraftDeck); @@ -199,7 +199,7 @@ public class NewQuestScreen extends FScreen { cbxPrizedCards.addItem("Same as starting pool"); cbxPrizedCards.addItem(StartingPoolType.Complete); - cbxPrizedCards.addItem(StartingPoolType.Rotating); + cbxPrizedCards.addItem(StartingPoolType.Sanctioned); cbxPrizedCards.addItem(StartingPoolType.CustomFormat); cbxPrizedCards.setChangedHandler(new FEventHandler() { @Override @@ -331,8 +331,8 @@ public class NewQuestScreen extends FScreen { lblPreconDeck.setVisible(newVal == StartingPoolType.Precon); cbxPreconDeck.setVisible(newVal == StartingPoolType.Precon); - lblFormat.setVisible(newVal == StartingPoolType.Rotating); - cbxFormat.setVisible(newVal == StartingPoolType.Rotating); + lblFormat.setVisible(newVal == StartingPoolType.Sanctioned); + cbxFormat.setVisible(newVal == StartingPoolType.Sanctioned); btnDefineCustomFormat.setVisible(newVal == StartingPoolType.CustomFormat); @@ -370,8 +370,8 @@ public class NewQuestScreen extends FScreen { lblPrizeUnrestricted.setVisible(newVal == StartingPoolType.Complete); cbAllowUnlocks.setVisible(newVal != StartingPoolType.Complete); - lblPrizeFormat.setVisible(newVal == StartingPoolType.Rotating); - cbxPrizeFormat.setVisible(newVal == StartingPoolType.Rotating); + lblPrizeFormat.setVisible(newVal == StartingPoolType.Sanctioned); + cbxPrizeFormat.setVisible(newVal == StartingPoolType.Sanctioned); btnPrizeDefineCustomFormat.setVisible(newVal == StartingPoolType.CustomFormat); lblPrizeSameAsStarting.setVisible(newVal == null); @@ -505,7 +505,7 @@ public class NewQuestScreen extends FScreen { if (worldFormat == null) { switch(getStartingPoolType()) { - case Rotating: + case Sanctioned: fmtStartPool = getRotatingFormat(); break; @@ -578,7 +578,7 @@ public class NewQuestScreen extends FScreen { } fmtPrizes = customPrizeFormatCodes.isEmpty() ? null : new GameFormat("Custom Prizes", customPrizeFormatCodes, null); // chosen sets and no banned cards break; - case Rotating: + case Sanctioned: fmtPrizes = getPrizedRotatingFormat(); break; default: diff --git a/forge-gui/src/main/java/forge/quest/StartingPoolType.java b/forge-gui/src/main/java/forge/quest/StartingPoolType.java index e64b3324308..513a49f1da0 100644 --- a/forge-gui/src/main/java/forge/quest/StartingPoolType.java +++ b/forge-gui/src/main/java/forge/quest/StartingPoolType.java @@ -2,7 +2,8 @@ package forge.quest; public enum StartingPoolType { Complete("Unrestricted"), - Rotating("Defined format"), + Sanctioned("Sanctioned format"), + Casual("Casual/Historic format"), CustomFormat("Custom format"), Precon("Event or starter deck"), SealedDeck("My sealed deck"),