mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-12 08:48:39 +00:00
Added Quest Preference for toggling quest+world rules on/off in duels
This commit is contained in:
@@ -84,6 +84,10 @@ public enum CSubmenuQuestPrefs implements ICDoc {
|
|||||||
final Localizer localizer = Localizer.getInstance();
|
final Localizer localizer = Localizer.getInstance();
|
||||||
final String s = localizer.getMessage("lblSavefailed") +":" + s0;
|
final String s = localizer.getMessage("lblSavefailed") +":" + s0;
|
||||||
switch(i0.getErrType()) {
|
switch(i0.getErrType()) {
|
||||||
|
case GAME_SETTINGS:
|
||||||
|
view.getLblErrGameSettings().setVisible(true);
|
||||||
|
view.getLblErrGameSettings().setText(s);
|
||||||
|
break;
|
||||||
case BOOSTER:
|
case BOOSTER:
|
||||||
view.getLblErrBooster().setVisible(true);
|
view.getLblErrBooster().setVisible(true);
|
||||||
view.getLblErrBooster().setText(s);
|
view.getLblErrBooster().setText(s);
|
||||||
@@ -115,6 +119,7 @@ public enum CSubmenuQuestPrefs implements ICDoc {
|
|||||||
public static void resetErrors() {
|
public static void resetErrors() {
|
||||||
final VSubmenuQuestPrefs view = VSubmenuQuestPrefs.SINGLETON_INSTANCE;
|
final VSubmenuQuestPrefs view = VSubmenuQuestPrefs.SINGLETON_INSTANCE;
|
||||||
|
|
||||||
|
view.getLblErrGameSettings().setVisible(false);
|
||||||
view.getLblErrBooster().setVisible(false);
|
view.getLblErrBooster().setVisible(false);
|
||||||
view.getLblErrDifficulty().setVisible(false);
|
view.getLblErrDifficulty().setVisible(false);
|
||||||
view.getLblErrRewards().setVisible(false);
|
view.getLblErrRewards().setVisible(false);
|
||||||
|
|||||||
@@ -48,11 +48,13 @@ public enum VSubmenuQuestPrefs implements IVSubmenu<CSubmenuQuestPrefs> {
|
|||||||
.opaque(true).fontSize(16).build();
|
.opaque(true).fontSize(16).build();
|
||||||
private final JPanel pnlContent = new JPanel();
|
private final JPanel pnlContent = new JPanel();
|
||||||
private final FScrollPane scrContent = new FScrollPane(pnlContent, false);
|
private final FScrollPane scrContent = new FScrollPane(pnlContent, false);
|
||||||
|
private final JPanel pnlGameSettings = new JPanel();
|
||||||
private final JPanel pnlRewards = new JPanel();
|
private final JPanel pnlRewards = new JPanel();
|
||||||
private final JPanel pnlDifficulty = new JPanel();
|
private final JPanel pnlDifficulty = new JPanel();
|
||||||
private final JPanel pnlBooster = new JPanel();
|
private final JPanel pnlBooster = new JPanel();
|
||||||
private final JPanel pnlShop = new JPanel();
|
private final JPanel pnlShop = new JPanel();
|
||||||
private final JPanel pnlDraftTournaments = new JPanel();
|
private final JPanel pnlDraftTournaments = new JPanel();
|
||||||
|
private final FLabel lblErrGameSettings = new FLabel.Builder().text(localizer.getMessage("lblQuestGameSettingsError")).fontStyle(Font.BOLD).build();
|
||||||
private final FLabel lblErrRewards = new FLabel.Builder().text(localizer.getMessage("lblRewardsError")).fontStyle(Font.BOLD).build();
|
private final FLabel lblErrRewards = new FLabel.Builder().text(localizer.getMessage("lblRewardsError")).fontStyle(Font.BOLD).build();
|
||||||
private final FLabel lblErrDifficulty = new FLabel.Builder().text(localizer.getMessage("lblDifficultyError")).fontStyle(Font.BOLD).build();
|
private final FLabel lblErrDifficulty = new FLabel.Builder().text(localizer.getMessage("lblDifficultyError")).fontStyle(Font.BOLD).build();
|
||||||
private final FLabel lblErrBooster = new FLabel.Builder().text(localizer.getMessage("lblBoosterError")).fontStyle(Font.BOLD).build();
|
private final FLabel lblErrBooster = new FLabel.Builder().text(localizer.getMessage("lblBoosterError")).fontStyle(Font.BOLD).build();
|
||||||
@@ -62,6 +64,7 @@ public enum VSubmenuQuestPrefs implements IVSubmenu<CSubmenuQuestPrefs> {
|
|||||||
private PrefInput focusTarget;
|
private PrefInput focusTarget;
|
||||||
/** */
|
/** */
|
||||||
public enum QuestPreferencesErrType { /** */
|
public enum QuestPreferencesErrType { /** */
|
||||||
|
GAME_SETTINGS, /** */
|
||||||
REWARDS, /** */
|
REWARDS, /** */
|
||||||
DIFFICULTY, /** */
|
DIFFICULTY, /** */
|
||||||
BOOSTER, /** */
|
BOOSTER, /** */
|
||||||
@@ -75,11 +78,22 @@ public enum VSubmenuQuestPrefs implements IVSubmenu<CSubmenuQuestPrefs> {
|
|||||||
lblTitle.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
|
lblTitle.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
|
||||||
pnlContent.setOpaque(false);
|
pnlContent.setOpaque(false);
|
||||||
pnlContent.setLayout(new MigLayout("insets 0, gap 0, wrap"));
|
pnlContent.setLayout(new MigLayout("insets 0, gap 0, wrap"));
|
||||||
|
lblErrGameSettings.setForeground(Color.red);
|
||||||
lblErrRewards.setForeground(Color.red);
|
lblErrRewards.setForeground(Color.red);
|
||||||
lblErrDifficulty.setForeground(Color.red);
|
lblErrDifficulty.setForeground(Color.red);
|
||||||
lblErrBooster.setForeground(Color.red);
|
lblErrBooster.setForeground(Color.red);
|
||||||
lblErrShop.setForeground(Color.red);
|
lblErrShop.setForeground(Color.red);
|
||||||
lblErrDraftTournaments.setForeground(Color.red);
|
lblErrDraftTournaments.setForeground(Color.red);
|
||||||
|
// Game settings panel
|
||||||
|
final FPanel pnlTitleGameSettings = new FPanel();
|
||||||
|
pnlTitleGameSettings.setLayout(new MigLayout("insets 0, align center"));
|
||||||
|
pnlTitleGameSettings.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
|
||||||
|
pnlTitleGameSettings.add(new FLabel.Builder().text(localizer.getMessage("lblQuestGameSettings"))
|
||||||
|
.icon(FSkin.getIcon(FSkinProp.ICO_QUEST_GEAR))
|
||||||
|
.fontSize(16).build(), "h 95%!, gap 0 0 2.5% 0");
|
||||||
|
pnlContent.add(pnlTitleGameSettings, "w 96%!, h 36px!, gap 2% 0 10px 20px");
|
||||||
|
pnlContent.add(pnlGameSettings, "w 96%!, gap 2% 0 10px 20px");
|
||||||
|
populateGameSettings();
|
||||||
// Rewards panel
|
// Rewards panel
|
||||||
final FPanel pnlTitleRewards = new FPanel();
|
final FPanel pnlTitleRewards = new FPanel();
|
||||||
pnlTitleRewards.setLayout(new MigLayout("insets 0, align center"));
|
pnlTitleRewards.setLayout(new MigLayout("insets 0, align center"));
|
||||||
@@ -166,6 +180,10 @@ public enum VSubmenuQuestPrefs implements IVSubmenu<CSubmenuQuestPrefs> {
|
|||||||
return EDocID.HOME_QUESTPREFS;
|
return EDocID.HOME_QUESTPREFS;
|
||||||
}
|
}
|
||||||
/** @return {@link javax.swing.JLabel} */
|
/** @return {@link javax.swing.JLabel} */
|
||||||
|
public JLabel getLblErrGameSettings() {
|
||||||
|
return lblErrGameSettings;
|
||||||
|
}
|
||||||
|
/** @return {@link javax.swing.JLabel} */
|
||||||
public JLabel getLblErrRewards() {
|
public JLabel getLblErrRewards() {
|
||||||
return lblErrRewards;
|
return lblErrRewards;
|
||||||
}
|
}
|
||||||
@@ -190,6 +208,19 @@ public enum VSubmenuQuestPrefs implements IVSubmenu<CSubmenuQuestPrefs> {
|
|||||||
}
|
}
|
||||||
private final static String fieldConstraints = "w 60px!, h 26px!";
|
private final static String fieldConstraints = "w 60px!, h 26px!";
|
||||||
private final static String labelConstraints = "w 200px!, h 26px!, gap 0 10px 0 0";
|
private final static String labelConstraints = "w 200px!, h 26px!, gap 0 10px 0 0";
|
||||||
|
|
||||||
|
private void populateGameSettings() {
|
||||||
|
pnlGameSettings.setOpaque(false);
|
||||||
|
pnlGameSettings.setLayout(new MigLayout("insets 0px, gap 0, wrap 2, hidemode 3"));
|
||||||
|
pnlGameSettings.removeAll();
|
||||||
|
pnlGameSettings.add(lblErrGameSettings, "w 100%!, h 30px!, span 2 1");
|
||||||
|
FLabel worldRulesConformance = new FLabel.Builder().text(localizer.getMessage("lblWorldRulesConformance")).fontAlign(SwingConstants.RIGHT).build();
|
||||||
|
worldRulesConformance.setToolTipText(localizer.getMessage("ttWorldRulesConformance"));
|
||||||
|
pnlGameSettings.add(worldRulesConformance, labelConstraints);
|
||||||
|
focusTarget = new PrefInput(QPref.WORLD_RULES_CONFORMANCE, QuestPreferencesErrType.GAME_SETTINGS);
|
||||||
|
pnlGameSettings.add(focusTarget, fieldConstraints);
|
||||||
|
}
|
||||||
|
|
||||||
private void populateRewards() {
|
private void populateRewards() {
|
||||||
pnlRewards.setOpaque(false);
|
pnlRewards.setOpaque(false);
|
||||||
pnlRewards.setLayout(new MigLayout("insets 0px, gap 0, wrap 2, hidemode 3"));
|
pnlRewards.setLayout(new MigLayout("insets 0px, gap 0, wrap 2, hidemode 3"));
|
||||||
|
|||||||
@@ -720,11 +720,15 @@ lblInvalidDeck=Invalid Deck
|
|||||||
lblInvalidDeckDesc=Your deck %n\nPlease edit or choose a different deck.
|
lblInvalidDeckDesc=Your deck %n\nPlease edit or choose a different deck.
|
||||||
#VSubmenuQuestPrefs.java
|
#VSubmenuQuestPrefs.java
|
||||||
lblQuestPreferences=Quest Preferences
|
lblQuestPreferences=Quest Preferences
|
||||||
|
lblQuestGameSettingsError=Game Settings Error
|
||||||
lblRewardsError=Rewards Error
|
lblRewardsError=Rewards Error
|
||||||
lblDifficultyError=Difficulty Error
|
lblDifficultyError=Difficulty Error
|
||||||
lblBoosterError=Booster Error
|
lblBoosterError=Booster Error
|
||||||
lblShopError=Shop Error
|
lblShopError=Shop Error
|
||||||
lblDraftTournamentsError=Draft Tournaments Error
|
lblDraftTournamentsError=Draft Tournaments Error
|
||||||
|
lblQuestGameSettings=Game Settings
|
||||||
|
lblWorldRulesConformance=World Rules Conformance
|
||||||
|
ttWorldRulesConformance=Enforce player deck legality in each world (allowed sets, restricted cards etc).
|
||||||
lblRewards=Rewards
|
lblRewards=Rewards
|
||||||
lblBoosterPackRatios=Booster Pack Ratios
|
lblBoosterPackRatios=Booster Pack Ratios
|
||||||
lblDifficultyAdjustments=Difficulty Adjustments
|
lblDifficultyAdjustments=Difficulty Adjustments
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ import forge.gamemodes.quest.bazaar.QuestPetController;
|
|||||||
import forge.gamemodes.quest.data.DeckConstructionRules;
|
import forge.gamemodes.quest.data.DeckConstructionRules;
|
||||||
import forge.gamemodes.quest.data.QuestAchievements;
|
import forge.gamemodes.quest.data.QuestAchievements;
|
||||||
import forge.gamemodes.quest.data.QuestAssets;
|
import forge.gamemodes.quest.data.QuestAssets;
|
||||||
|
import forge.gamemodes.quest.data.QuestPreferences;
|
||||||
import forge.gui.FThreads;
|
import forge.gui.FThreads;
|
||||||
import forge.gui.GuiBase;
|
import forge.gui.GuiBase;
|
||||||
import forge.gui.interfaces.IButton;
|
import forge.gui.interfaces.IButton;
|
||||||
@@ -681,8 +682,6 @@ public class QuestUtil {
|
|||||||
|
|
||||||
//Check quest mode's generic deck construction rules: minimum cards in deck, sideboard etc
|
//Check quest mode's generic deck construction rules: minimum cards in deck, sideboard etc
|
||||||
String errorMessage = GameType.Quest.getDeckFormat().getDeckConformanceProblem(deck);
|
String errorMessage = GameType.Quest.getDeckFormat().getDeckConformanceProblem(deck);
|
||||||
|
|
||||||
//Check the quest mode's generic deck construction rules: minimum cards in deck, sideboard etc
|
|
||||||
if(errorMessage != null) return errorMessage; //return immediately if the deck does not conform to quest requirements
|
if(errorMessage != null) return errorMessage; //return immediately if the deck does not conform to quest requirements
|
||||||
|
|
||||||
//Check for all applicable deck construction rules per this quests's saved DeckConstructionRules enum
|
//Check for all applicable deck construction rules per this quests's saved DeckConstructionRules enum
|
||||||
@@ -694,8 +693,10 @@ public class QuestUtil {
|
|||||||
if(errorMessage != null) return errorMessage;
|
if(errorMessage != null) return errorMessage;
|
||||||
|
|
||||||
//Check for this quest- and World's deck construction rules: allowed sets, banned/restricted cards etc
|
//Check for this quest- and World's deck construction rules: allowed sets, banned/restricted cards etc
|
||||||
if(FModel.getQuest().getFormat() != null)
|
if (FModel.getQuestPreferences().getPrefInt(QuestPreferences.QPref.WORLD_RULES_CONFORMANCE) == 1) {
|
||||||
errorMessage = FModel.getQuest().getFormat().getDeckConformanceProblem(deck);
|
if(FModel.getQuest().getFormat() != null)
|
||||||
|
errorMessage = FModel.getQuest().getFormat().getDeckConformanceProblem(deck);
|
||||||
|
}
|
||||||
|
|
||||||
return errorMessage;
|
return errorMessage;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,6 +32,8 @@ public class QuestPreferences extends PreferencesStore<QuestPreferences.QPref> i
|
|||||||
*/
|
*/
|
||||||
public enum QPref {
|
public enum QPref {
|
||||||
|
|
||||||
|
// if enabled, player must follow world rules in duels (allowed sets only, banned/restricted cards etc.)
|
||||||
|
WORLD_RULES_CONFORMANCE("0"),
|
||||||
// How many of each rarity comes in a won booster pack
|
// How many of each rarity comes in a won booster pack
|
||||||
BOOSTER_COMMONS("11"),
|
BOOSTER_COMMONS("11"),
|
||||||
BOOSTER_UNCOMMONS("3"),
|
BOOSTER_UNCOMMONS("3"),
|
||||||
@@ -293,6 +295,7 @@ public class QuestPreferences extends PreferencesStore<QuestPreferences.QPref> i
|
|||||||
return "Bias value too large (maximum 100).";
|
return "Bias value too large (maximum 100).";
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case WORLD_RULES_CONFORMANCE:
|
||||||
case DRAFT_ROTATION:
|
case DRAFT_ROTATION:
|
||||||
case SPECIAL_BOOSTERS:
|
case SPECIAL_BOOSTERS:
|
||||||
case FOIL_FILTER_DEFAULT:
|
case FOIL_FILTER_DEFAULT:
|
||||||
|
|||||||
Reference in New Issue
Block a user