From a6f603f4f8ef9ecc84aab457d86b8839cdd2eda1 Mon Sep 17 00:00:00 2001 From: nicol Date: Fri, 13 Dec 2024 10:00:49 +0100 Subject: [PATCH] add digital to mass modification panel --- .../game/actions/library/DrawActions.java | 8 ++++ .../java/org/magic/gui/StockPanelGUI.java | 40 ++++++++++++++----- .../components/deck/DeckSnifferDialog.java | 4 +- src/main/resources/data/sets_codeAliases.json | 1 + 4 files changed, 40 insertions(+), 13 deletions(-) diff --git a/src/main/java/org/magic/game/actions/library/DrawActions.java b/src/main/java/org/magic/game/actions/library/DrawActions.java index 7b356c4cc..d7bd0e68f 100644 --- a/src/main/java/org/magic/game/actions/library/DrawActions.java +++ b/src/main/java/org/magic/game/actions/library/DrawActions.java @@ -27,6 +27,14 @@ public DrawActions() { @Override public void actionPerformed(ActionEvent e) { try { + + + if(GamePanelGUI.getInstance().getPlayer()==null) + { + MTG.notifyError("Game is not started"); + return; + } + GamePanelGUI.getInstance().getPlayer().drawCard(1); GamePanelGUI.getInstance().getLblHandCount().setText(String.valueOf(GamePanelGUI.getInstance().getPlayer().getHand().size())); GamePanelGUI.getInstance().getLblLibraryCount().setText(String.valueOf(GamePanelGUI.getInstance().getPlayer().getLibrary().size())); diff --git a/src/main/java/org/magic/gui/StockPanelGUI.java b/src/main/java/org/magic/gui/StockPanelGUI.java index 3fe6c0b64..babbcc353 100644 --- a/src/main/java/org/magic/gui/StockPanelGUI.java +++ b/src/main/java/org/magic/gui/StockPanelGUI.java @@ -121,6 +121,7 @@ public class StockPanelGUI extends MTGUIComponent { private String[] selections = new String[] { "", MTGControler.getInstance().getLangService().get("NEW"),MTGControler.getInstance().getLangService().get("UPDATED"),MTGControler.getInstance().getLangService().get("ALL") }; private File fileImport; private JButton btnDuplicate; + private JComboBox cboDigital; @Override public ImageIcon getIcon() { @@ -500,7 +501,8 @@ else if (String.valueOf(cboSelections.getSelectedItem()).equals(selections[3])) s.setCondition((EnumCondition) cboQuality.getSelectedItem()); if (cboCollection.getSelectedItem() != null) s.setMagicCollection((MTGCollection) cboCollection.getSelectedItem()); - + if(cboDigital.getSelectedItem()!=null) + s.setDigital((Boolean) cboDigital.getSelectedItem()); } model.fireTableDataChanged(); } @@ -752,12 +754,28 @@ private void initGUI() { gbccboAltered.gridx = 1; gbccboAltered.gridy = 6; rightPanel.add(cboAltered, gbccboAltered); - + + var gbclblDigital = new GridBagConstraints(); + gbclblDigital.anchor = GridBagConstraints.EAST; + gbclblDigital.insets = new Insets(0, 0, 5, 5); + gbclblDigital.gridx = 0; + gbclblDigital.gridy = 7; + rightPanel.add(new JLangLabel("DIGITAL",true), gbclblDigital); + + cboDigital = UITools.createCombobox(values); + var gbccboDigital = new GridBagConstraints(); + gbccboDigital.insets = new Insets(0, 0, 5, 0); + gbccboDigital.fill = GridBagConstraints.HORIZONTAL; + gbccboDigital.gridx = 1; + gbccboDigital.gridy = 7; + rightPanel.add(cboDigital, gbccboDigital); + + var gbclblQuality = new GridBagConstraints(); gbclblQuality.anchor = GridBagConstraints.EAST; gbclblQuality.insets = new Insets(0, 0, 5, 5); gbclblQuality.gridx = 0; - gbclblQuality.gridy = 7; + gbclblQuality.gridy = 8; rightPanel.add(new JLangLabel("QUALITY",true), gbclblQuality); cboQuality = UITools.createCombobox(Lists.asList(null,EnumCondition.values())); @@ -765,14 +783,14 @@ private void initGUI() { gbccboQuality.insets = new Insets(0, 0, 5, 0); gbccboQuality.fill = GridBagConstraints.HORIZONTAL; gbccboQuality.gridx = 1; - gbccboQuality.gridy = 7; + gbccboQuality.gridy = 8; rightPanel.add(cboQuality, gbccboQuality); var gbclblCollection = new GridBagConstraints(); gbclblCollection.anchor = GridBagConstraints.EAST; gbclblCollection.insets = new Insets(0, 0, 5, 5); gbclblCollection.gridx = 0; - gbclblCollection.gridy = 8; + gbclblCollection.gridy = 9; rightPanel.add(new JLangLabel("COLLECTION",true), gbclblCollection); cboCollection = UITools.createComboboxCollection(); @@ -780,13 +798,13 @@ private void initGUI() { gbccboCollection.insets = new Insets(0, 0, 5, 0); gbccboCollection.fill = GridBagConstraints.HORIZONTAL; gbccboCollection.gridx = 1; - gbccboCollection.gridy = 8; + gbccboCollection.gridy = 9; rightPanel.add(cboCollection, gbccboCollection); var gbclblComment = new GridBagConstraints(); gbclblComment.insets = new Insets(0, 0, 5, 5); gbclblComment.gridx = 0; - gbclblComment.gridy = 9; + gbclblComment.gridy = 10; rightPanel.add(new JLangLabel("COMMENT",true), gbclblComment); textPane = new JTextPane(); @@ -796,7 +814,7 @@ private void initGUI() { gbctextPane.gridheight = 3; gbctextPane.fill = GridBagConstraints.BOTH; gbctextPane.gridx = 0; - gbctextPane.gridy = 10; + gbctextPane.gridy = 11; rightPanel.add(textPane, gbctextPane); @@ -805,19 +823,19 @@ private void initGUI() { var gbcbtnApplyModification = new GridBagConstraints(); gbcbtnApplyModification.gridwidth = 2; gbcbtnApplyModification.gridx = 0; - gbcbtnApplyModification.gridy = 13; + gbcbtnApplyModification.gridy = 14; rightPanel.add(btnApplyModification, gbcbtnApplyModification); var gbcSep = new GridBagConstraints(); gbcSep.gridwidth = 2; gbcSep.gridx = 0; - gbcSep.gridy = 14; + gbcSep.gridy = 15; rightPanel.add(new JSeparator(), gbcSep); var gbcSepFoil = new GridBagConstraints(); gbcSepFoil.gridwidth = 2; gbcSepFoil.gridx = 0; - gbcSepFoil.gridy = 15; + gbcSepFoil.gridy = 16; rightPanel.add(chkboxForceFoil, gbcSepFoil); diff --git a/src/main/java/org/magic/gui/components/deck/DeckSnifferDialog.java b/src/main/java/org/magic/gui/components/deck/DeckSnifferDialog.java index 9a113cdc0..a9f25424b 100644 --- a/src/main/java/org/magic/gui/components/deck/DeckSnifferDialog.java +++ b/src/main/java/org/magic/gui/components/deck/DeckSnifferDialog.java @@ -59,7 +59,7 @@ private MTGDeckSniffer getSelectedSniffer() public DeckSnifferDialog() { importedDeck = new MTGDeck(); - setSize(new Dimension(600, 500)); + setSize(new Dimension(577, 445)); setTitle(capitalize("DECKS_IMPORTER")); setLocationRelativeTo(null); setIconImage(MTGConstants.ICON_DECK.getImage()); @@ -75,7 +75,7 @@ public DeckSnifferDialog() { - btnConnect = new JButton(capitalize("OPEN")); + btnConnect = new JButton(MTGConstants.ICON_SEARCH); cboFormats = UITools.createCombobox(getSelectedSniffer().listFilter()); var labCardFilter = new JLabel("With this card : "); var btnCardImport = UITools.createBindableJButton("", MTGConstants.ICON_TAB_IMPORT, KeyEvent.VK_I, "WithCard"); diff --git a/src/main/resources/data/sets_codeAliases.json b/src/main/resources/data/sets_codeAliases.json index 0eb62be28..b49697f65 100644 --- a/src/main/resources/data/sets_codeAliases.json +++ b/src/main/resources/data/sets_codeAliases.json @@ -358,6 +358,7 @@ "4BB" ], "PMEI": [ + "PJSC", "PSPL", "P30M", "PH22",