Merge origin/master

This commit is contained in:
LevelX2 2017-12-30 20:17:45 +01:00
commit c6d27bb3c9
3 changed files with 144 additions and 99 deletions

View file

@ -465,6 +465,12 @@ public class MageBook extends JComponent {
LinkedList<Integer> haveNumbers = new LinkedList<>(); LinkedList<Integer> haveNumbers = new LinkedList<>();
for (ExpansionSet.SetCardInfo card: cards){ for (ExpansionSet.SetCardInfo card: cards){
int cardNumber = card.getCardNumberAsInt(); int cardNumber = card.getCardNumberAsInt();
// skip xmage special numbers for cards (TODO: replace full art cards numbers from 180+20 to 180b, 180c and vice versa like scryfall)
if(cardNumber > 500){
continue;
}
startNumber = min(startNumber, cardNumber); startNumber = min(startNumber, cardNumber);
endNumber = Math.max(endNumber, cardNumber); endNumber = Math.max(endNumber, cardNumber);
haveNumbers.add(cardNumber); haveNumbers.add(cardNumber);

View file

@ -32,52 +32,39 @@
<Group type="102" attributes="0"> <Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0"> <Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0"> <Component id="lblMountain" alignment="0" min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="1" attributes="0"> <Component id="lblForest" alignment="1" min="-2" max="-2" attributes="0"/>
<Group type="102" alignment="1" attributes="0"> <Component id="lblLandSet" alignment="1" min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0"> <Component id="lblIsland" alignment="1" min="-2" max="-2" attributes="0"/>
<Component id="lblIsland" alignment="0" min="-2" max="-2" attributes="0"/> <Component id="lblPains" alignment="1" min="-2" max="-2" attributes="0"/>
<Component id="lblMountain" alignment="0" min="-2" max="-2" attributes="0"/> <Component id="lblSwamp" alignment="1" min="-2" max="-2" attributes="0"/>
<Component id="lblForest" alignment="0" min="-2" max="-2" attributes="0"/> </Group>
<Component id="lblLandSet" min="-2" max="-2" attributes="0"/> <EmptySpace type="separate" max="-2" attributes="0"/>
</Group> <Group type="103" groupAlignment="0" attributes="0">
<EmptySpace max="32767" attributes="0"/> <Group type="102" alignment="0" attributes="0">
<Group type="103" groupAlignment="0" attributes="0"> <Component id="btnAutoAdd" pref="122" max="32767" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0"> <EmptySpace max="-2" attributes="0"/>
<Component id="spnMountain" pref="85" max="32767" attributes="0"/> <Component id="btnAdd" min="-2" max="-2" attributes="0"/>
<Component id="spnIsland" max="32767" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Component id="spnForest" max="32767" attributes="0"/> <Component id="btnCancel" min="-2" max="-2" attributes="0"/>
</Group>
<Component id="cbLandSet" min="-2" pref="207" max="-2" attributes="0"/>
</Group>
</Group>
<Group type="102" alignment="1" attributes="0">
<Group type="103" groupAlignment="1" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="lblSwamp" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="14" max="-2" attributes="0"/>
<Component id="spnSwamp" max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="lblPains" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="21" max="-2" attributes="0"/>
<Component id="spnPlains" max="32767" attributes="0"/>
</Group>
</Group>
<EmptySpace min="-2" pref="122" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace min="-2" max="-2" attributes="0"/>
</Group> </Group>
<Group type="102" alignment="0" attributes="0"> <Group type="102" alignment="0" attributes="0">
<Component id="btnCancel" min="-2" max="-2" attributes="0"/> <Group type="103" groupAlignment="1" attributes="0">
<EmptySpace type="unrelated" max="-2" attributes="0"/> <Group type="103" alignment="0" groupAlignment="1" max="-2" attributes="0">
<Component id="btnAutoAdd" min="-2" max="-2" attributes="0"/> <Component id="spnMountain" alignment="0" pref="85" max="32767" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/> <Component id="spnIsland" alignment="0" pref="85" max="32767" attributes="0"/>
<Component id="btnAdd" min="-2" max="-2" attributes="0"/> <Component id="spnForest" alignment="0" max="32767" attributes="0"/>
</Group>
<Group type="103" alignment="0" groupAlignment="1" max="-2" attributes="0">
<Component id="spnSwamp" alignment="0" pref="85" max="32767" attributes="0"/>
<Component id="spnPlains" alignment="0" max="32767" attributes="0"/>
</Group>
</Group>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/> <EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group> </Group>
<Component id="panelSet" max="32767" attributes="0"/>
</Group> </Group>
<EmptySpace max="-2" attributes="0"/>
</Group> </Group>
</Group> </Group>
</DimensionLayout> </DimensionLayout>
@ -85,9 +72,9 @@
<Group type="103" groupAlignment="0" attributes="0"> <Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0"> <Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0"> <Group type="103" groupAlignment="0" attributes="0">
<Component id="cbLandSet" alignment="3" min="-2" max="-2" attributes="0"/> <Component id="lblLandSet" min="-2" max="-2" attributes="0"/>
<Component id="lblLandSet" alignment="3" min="-2" max="-2" attributes="0"/> <Component id="panelSet" min="-2" max="-2" attributes="0"/>
</Group> </Group>
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0"> <Group type="103" groupAlignment="3" attributes="0">
@ -128,19 +115,7 @@
<SubComponents> <SubComponents>
<Component class="javax.swing.JLabel" name="lblLandSet"> <Component class="javax.swing.JLabel" name="lblLandSet">
<Properties> <Properties>
<Property name="text" type="java.lang.String" value="Set"/> <Property name="text" type="java.lang.String" value="Set:"/>
</Properties>
</Component>
<Component class="javax.swing.JComboBox" name="cbLandSet">
<Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="4">
<StringItem index="0" value="Item 1"/>
<StringItem index="1" value="Item 2"/>
<StringItem index="2" value="Item 3"/>
<StringItem index="3" value="Item 4"/>
</StringArray>
</Property>
</Properties> </Properties>
</Component> </Component>
<Component class="javax.swing.JLabel" name="lblForest"> <Component class="javax.swing.JLabel" name="lblForest">
@ -227,5 +202,41 @@
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnAutoAddActionPerformed"/> <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnAutoAddActionPerformed"/>
</Events> </Events>
</Component> </Component>
<Container class="javax.swing.JPanel" name="panelSet">
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBoxLayout"/>
<SubComponents>
<Component class="javax.swing.JComboBox" name="cbLandSet">
<Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="4">
<StringItem index="0" value="Item 1"/>
<StringItem index="1" value="Item 2"/>
<StringItem index="2" value="Item 3"/>
<StringItem index="3" value="Item 4"/>
</StringArray>
</Property>
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[20, 20]"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JButton" name="btnSetFastSearch">
<Properties>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/buttons/search_24.png"/>
</Property>
<Property name="toolTipText" type="java.lang.String" value="Search for set"/>
<Property name="alignmentX" type="float" value="1.0"/>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[23, 23]"/>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnSetFastSearchActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Container>
</SubComponents> </SubComponents>
</Form> </Form>

View file

@ -44,6 +44,7 @@ import mage.cards.repository.ExpansionInfo;
import mage.cards.repository.ExpansionRepository; import mage.cards.repository.ExpansionRepository;
import mage.client.MageFrame; import mage.client.MageFrame;
import mage.client.constants.Constants.DeckEditorMode; import mage.client.constants.Constants.DeckEditorMode;
import mage.client.util.gui.FastSearchUtil;
import mage.constants.Rarity; import mage.constants.Rarity;
import mage.util.RandomUtil; import mage.util.RandomUtil;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
@ -157,7 +158,6 @@ public class AddLandDialog extends MageDialog {
jButton2 = new javax.swing.JButton(); jButton2 = new javax.swing.JButton();
lblLandSet = new javax.swing.JLabel(); lblLandSet = new javax.swing.JLabel();
cbLandSet = new javax.swing.JComboBox();
lblForest = new javax.swing.JLabel(); lblForest = new javax.swing.JLabel();
spnForest = new javax.swing.JSpinner(); spnForest = new javax.swing.JSpinner();
lblIsland = new javax.swing.JLabel(); lblIsland = new javax.swing.JLabel();
@ -171,14 +171,15 @@ public class AddLandDialog extends MageDialog {
btnAdd = new javax.swing.JButton(); btnAdd = new javax.swing.JButton();
btnCancel = new javax.swing.JButton(); btnCancel = new javax.swing.JButton();
btnAutoAdd = new javax.swing.JButton(); btnAutoAdd = new javax.swing.JButton();
panelSet = new javax.swing.JPanel();
cbLandSet = new javax.swing.JComboBox();
btnSetFastSearch = new javax.swing.JButton();
jButton2.setText("jButton2"); jButton2.setText("jButton2");
setTitle("Add Land"); setTitle("Add Land");
lblLandSet.setText("Set"); lblLandSet.setText("Set:");
cbLandSet.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
lblForest.setText("Forest"); lblForest.setText("Forest");
@ -201,13 +202,42 @@ public class AddLandDialog extends MageDialog {
spnSwamp.setModel(new javax.swing.SpinnerNumberModel(0, 0, null, 1)); spnSwamp.setModel(new javax.swing.SpinnerNumberModel(0, 0, null, 1));
btnAdd.setText("Add"); btnAdd.setText("Add");
btnAdd.addActionListener(evt -> btnAddActionPerformed(evt)); btnAdd.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnAddActionPerformed(evt);
}
});
btnCancel.setText("Cancel"); btnCancel.setText("Cancel");
btnCancel.addActionListener(evt -> btnCancelActionPerformed(evt)); btnCancel.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnCancelActionPerformed(evt);
}
});
btnAutoAdd.setText("Suggest"); btnAutoAdd.setText("Suggest");
btnAutoAdd.addActionListener(evt -> btnAutoAddActionPerformed(evt)); btnAutoAdd.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnAutoAddActionPerformed(evt);
}
});
panelSet.setLayout(new javax.swing.BoxLayout(panelSet, javax.swing.BoxLayout.LINE_AXIS));
cbLandSet.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
cbLandSet.setMinimumSize(new java.awt.Dimension(20, 20));
panelSet.add(cbLandSet);
btnSetFastSearch.setIcon(new javax.swing.ImageIcon(getClass().getResource("/buttons/search_24.png"))); // NOI18N
btnSetFastSearch.setToolTipText("Search for set");
btnSetFastSearch.setAlignmentX(1.0F);
btnSetFastSearch.setPreferredSize(new java.awt.Dimension(23, 23));
btnSetFastSearch.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnSetFastSearchActionPerformed(evt);
}
});
panelSet.add(btnSetFastSearch);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout); getContentPane().setLayout(layout);
@ -216,48 +246,40 @@ public class AddLandDialog extends MageDialog {
.addGroup(layout.createSequentialGroup() .addGroup(layout.createSequentialGroup()
.addContainerGap() .addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addComponent(lblMountain)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(lblForest, javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(layout.createSequentialGroup() .addComponent(lblLandSet, javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(lblIsland, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(lblIsland) .addComponent(lblPains, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(lblMountain) .addComponent(lblSwamp, javax.swing.GroupLayout.Alignment.TRAILING))
.addComponent(lblForest) .addGap(18, 18, 18)
.addComponent(lblLandSet)) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(spnMountain, javax.swing.GroupLayout.DEFAULT_SIZE, 85, Short.MAX_VALUE)
.addComponent(spnIsland)
.addComponent(spnForest))
.addComponent(cbLandSet, javax.swing.GroupLayout.PREFERRED_SIZE, 207, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
.addComponent(lblSwamp)
.addGap(14, 14, 14)
.addComponent(spnSwamp))
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
.addComponent(lblPains)
.addGap(21, 21, 21)
.addComponent(spnPlains)))
.addGap(122, 122, 122)))
.addContainerGap())
.addGroup(layout.createSequentialGroup() .addGroup(layout.createSequentialGroup()
.addComponent(btnCancel) .addComponent(btnAutoAdd, javax.swing.GroupLayout.DEFAULT_SIZE, 122, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(btnAutoAdd)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(btnAdd) .addComponent(btnAdd)
.addGap(0, 0, Short.MAX_VALUE)))) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(btnCancel))
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(spnMountain, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 85, Short.MAX_VALUE)
.addComponent(spnIsland, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 85, Short.MAX_VALUE)
.addComponent(spnForest, javax.swing.GroupLayout.Alignment.LEADING))
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(spnSwamp, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 85, Short.MAX_VALUE)
.addComponent(spnPlains, javax.swing.GroupLayout.Alignment.LEADING)))
.addGap(0, 0, Short.MAX_VALUE))
.addComponent(panelSet, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap())
); );
layout.setVerticalGroup( layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup() .addGroup(layout.createSequentialGroup()
.addContainerGap() .addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(cbLandSet, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(lblLandSet)
.addComponent(lblLandSet)) .addComponent(panelSet, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(lblForest) .addComponent(lblForest)
@ -312,6 +334,10 @@ public class AddLandDialog extends MageDialog {
autoAddLands(); autoAddLands();
}//GEN-LAST:event_btnAutoAddActionPerformed }//GEN-LAST:event_btnAutoAddActionPerformed
private void btnSetFastSearchActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSetFastSearchActionPerformed
FastSearchUtil.showFastSearchForStringComboBox(cbLandSet, FastSearchUtil.DEFAULT_EXPANSION_SEARCH_MESSAGE);
}//GEN-LAST:event_btnSetFastSearchActionPerformed
private void autoAddLands() { private void autoAddLands() {
int red = 0; int red = 0;
int green = 0; int green = 0;
@ -356,6 +382,7 @@ public class AddLandDialog extends MageDialog {
private javax.swing.JButton btnAdd; private javax.swing.JButton btnAdd;
private javax.swing.JButton btnAutoAdd; private javax.swing.JButton btnAutoAdd;
private javax.swing.JButton btnCancel; private javax.swing.JButton btnCancel;
private javax.swing.JButton btnSetFastSearch;
private javax.swing.JComboBox cbLandSet; private javax.swing.JComboBox cbLandSet;
private javax.swing.JButton jButton2; private javax.swing.JButton jButton2;
private javax.swing.JLabel lblForest; private javax.swing.JLabel lblForest;
@ -364,6 +391,7 @@ public class AddLandDialog extends MageDialog {
private javax.swing.JLabel lblMountain; private javax.swing.JLabel lblMountain;
private javax.swing.JLabel lblPains; private javax.swing.JLabel lblPains;
private javax.swing.JLabel lblSwamp; private javax.swing.JLabel lblSwamp;
private javax.swing.JPanel panelSet;
private javax.swing.JSpinner spnForest; private javax.swing.JSpinner spnForest;
private javax.swing.JSpinner spnIsland; private javax.swing.JSpinner spnIsland;
private javax.swing.JSpinner spnMountain; private javax.swing.JSpinner spnMountain;