Merge branch 'master' into Network_Upgrade

Conflicts:
	Mage.Client/src/main/java/mage/client/draft/DraftPanel.java
This commit is contained in:
betasteward 2015-08-19 14:49:46 -04:00
commit b9c8a2598d
338 changed files with 15225 additions and 1521 deletions

View file

@ -1,37 +1,36 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
/*
* ShowCardsDialog.java
*
* Created on 3-Feb-2010, 8:59:11 PM
*/
package mage.client.dialog;
import java.awt.Component;
@ -41,7 +40,6 @@ import java.awt.event.MouseListener;
import java.io.Serializable;
import java.util.Map;
import java.util.UUID;
import javax.swing.ImageIcon;
import javax.swing.JLayeredPane;
import javax.swing.SwingUtilities;
import mage.cards.CardDimensions;
@ -54,29 +52,25 @@ import mage.client.util.gui.GuiDisplayUtil;
import mage.view.CardsView;
import mage.view.SimpleCardsView;
import org.mage.card.arcane.CardPanel;
import org.mage.plugins.card.utils.impl.ImageManagerImpl;
/**
* @author BetaSteward_at_googlemail.com
*/
public class ShowCardsDialog extends MageDialog implements MouseListener {
// remember if this dialog was already auto positioned, so don't do it after the first time
private boolean positioned;
/**
* Creates new form ShowCardsDialog
*/
public ShowCardsDialog() {
this.positioned = false;
this.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
initComponents();
this.setModal(false);
}
public void cleanUp() {
@ -96,18 +90,18 @@ public class ShowCardsDialog extends MageDialog implements MouseListener {
public void loadCards(String name, CardsView showCards, BigCard bigCard, CardDimensions dimension, UUID gameId, boolean modal) {
loadCards(name, showCards, bigCard, dimension, gameId, modal, null);
}
public void loadCards(String name, CardsView showCards, BigCard bigCard, CardDimensions dimension, UUID gameId, boolean modal, Map<String, Serializable> options) {
this.title = name;
this.setTitelBarToolTip(name);
cardArea.loadCards(showCards, bigCard, dimension, gameId, this);
if (options != null) {
if (options.containsKey("chosen")) {
java.util.List<UUID> chosenCards = (java.util.List<UUID>)options.get("chosen");
java.util.List<UUID> chosenCards = (java.util.List<UUID>) options.get("chosen");
cardArea.selectCards(chosenCards);
}
if (options.containsKey("choosable")) {
java.util.List<UUID> choosableCards = (java.util.List<UUID>)options.get("choosable");
java.util.List<UUID> choosableCards = (java.util.List<UUID>) options.get("choosable");
cardArea.markCards(choosableCards);
}
}
@ -115,7 +109,7 @@ public class ShowCardsDialog extends MageDialog implements MouseListener {
if (getParent() != MageFrame.getDesktop() /*|| this.isClosed*/) {
MageFrame.getDesktop().add(this, JLayeredPane.DEFAULT_LAYER);
}
pack();
pack();
this.revalidate();
this.repaint();
@ -156,7 +150,9 @@ public class ShowCardsDialog extends MageDialog implements MouseListener {
@Override
public void mouseClicked(MouseEvent e) {
this.hideDialog();
if (e.getSource() instanceof CardPanel) {
this.hideDialog();
}
}
@Override

View file

@ -31,7 +31,6 @@
*
* Created on Jan 7, 2011, 2:15:48 PM
*/
package mage.client.draft;
import java.awt.Component;
@ -123,14 +122,16 @@ public class DraftPanel extends javax.swing.JPanel {
private static final CardsView emptyView = new CardsView();
/** Creates new form DraftPanel */
/**
* Creates new form DraftPanel
*/
public DraftPanel() {
initComponents();
draftBooster.setOpaque(false);
draftPicks.setSortSetting(SortSettingDraft.getInstance());
draftPicks.setOpaque(false);
popupMenuPickedArea = new JPopupMenu();
addPopupMenuPickArea();
this.add(popupMenuPickedArea);
@ -142,18 +143,17 @@ public class DraftPanel extends javax.swing.JPanel {
draftLeftPane.setOpaque(false);
countdown = new Timer(1000,
new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (--timeout > 0) {
setTimeout(timeout);
}
else {
setTimeout(0);
countdown.stop();
new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (--timeout > 0) {
setTimeout(timeout);
} else {
setTimeout(0);
countdown.stop();
}
}
}
}
);
}
@ -192,13 +192,13 @@ public class DraftPanel extends javax.swing.JPanel {
}
}
public void updateDraft(DraftView draftView) {
if (draftView.getSets().size() != 3){
public void updateDraft(DraftView draftView) {
if (draftView.getSets().size() != 3) {
// Random draft
this.txtPack1.setText("Random Boosters");
this.txtPack2.setText("Random Boosters");
this.txtPack3.setText("Random Boosters");
}else{
} else {
this.txtPack1.setText(draftView.getSets().get(0));
this.txtPack2.setText(draftView.getSets().get(1));
this.txtPack3.setText(draftView.getSets().get(2));
@ -215,13 +215,13 @@ public class DraftPanel extends javax.swing.JPanel {
int left = draftView.getPlayers().size() - right;
int height = left * 18;
lblTableImage.setSize(new Dimension(lblTableImage.getWidth(), height));
Image tableImage = ImageHelper.getImageFromResources(draftView.getBoosterNum() == 2 ? "/draft/table_left.png":"/draft/table_right.png");
Image tableImage = ImageHelper.getImageFromResources(draftView.getBoosterNum() == 2 ? "/draft/table_left.png" : "/draft/table_right.png");
BufferedImage resizedTable = ImageHelper.getResizedImage(BufferedImageBuilder.bufferImage(tableImage, BufferedImage.TYPE_INT_ARGB), lblTableImage.getWidth());
lblTableImage.setIcon(new ImageIcon(resizedTable));
int count = 0;
int numberPlayers = draftView.getPlayers().size();
for(String playerName: draftView.getPlayers()) {
for (String playerName : draftView.getPlayers()) {
count++;
setPlayerNameToLabel(playerName, count, numberPlayers);
}
@ -232,13 +232,13 @@ public class DraftPanel extends javax.swing.JPanel {
int right = players / 2;
int left = players - right;
if (index <= left) {
// left side down (1 - 8)
// left side down (1 - 8)
tablePosition = index;
} else {
// right side up (16 - 9)
tablePosition = 9 + right - (index - left);
}
switch(tablePosition) {
switch (tablePosition) {
case 1:
lblPlayer01.setText(name);
break;
@ -296,21 +296,21 @@ public class DraftPanel extends javax.swing.JPanel {
loadCardsToPickedCardsArea(draftPickView.getPicks());
this.draftPicks.clearCardEventListeners();
this.draftPicks.addCardEventListener(new Listener<Event> () {
@Override
public void event(Event event) {
if (event.getEventName().equals("show-popup-menu")) {
if (event.getSource() != null) {
// Popup Menu Card
cardIdPopupMenu = ((SimpleCardView)event.getSource()).getId();
popupMenuCardPanel.show(event.getComponent(), event.getxPos(), event.getyPos());
} else {
// Popup Menu area
popupMenuPickedArea.show(event.getComponent(), event.getxPos(), event.getyPos());
}
this.draftPicks.addCardEventListener(new Listener<Event>() {
@Override
public void event(Event event) {
if (event.getEventName().equals("show-popup-menu")) {
if (event.getSource() != null) {
// Popup Menu Card
cardIdPopupMenu = ((SimpleCardView) event.getSource()).getId();
popupMenuCardPanel.show(event.getComponent(), event.getxPos(), event.getyPos());
} else {
// Popup Menu area
popupMenuPickedArea.show(event.getComponent(), event.getxPos(), event.getyPos());
}
}
}
}
);
// lower area that shows the booster
@ -320,8 +320,8 @@ public class DraftPanel extends javax.swing.JPanel {
new Listener<Event> () {
@Override
public void event(Event event) {
SimpleCardView source = (SimpleCardView) event.getSource();
if (event.getEventName().equals("pick-a-card")) {
SimpleCardView source = (SimpleCardView) event.getSource();
DraftPickView view = client.pickCard(draftId, source.getId(), cardsHidden);
if (view != null) {
loadCardsToPickedCardsArea(view.getPicks());
@ -331,7 +331,6 @@ public class DraftPanel extends javax.swing.JPanel {
}
}
if (event.getEventName().equals("mark-a-card")) {
SimpleCardView source = (SimpleCardView) event.getSource();
client.markCard(draftId, source.getId());
}
}
@ -352,7 +351,7 @@ public class DraftPanel extends javax.swing.JPanel {
private void loadCardsToPickedCardsArea(SimpleCardsView pickedCards) {
this.pickedCards = pickedCards;
for (Map.Entry<UUID,SimpleCardView> entry: pickedCards.entrySet()) {
for (Map.Entry<UUID, SimpleCardView> entry : pickedCards.entrySet()) {
if (!cardsHidden.contains(entry.getKey())) {
pickedCardsShown.put(entry.getKey(), entry.getValue());
}
@ -360,22 +359,22 @@ public class DraftPanel extends javax.swing.JPanel {
draftPicks.loadCards(CardsViewUtil.convertSimple(pickedCardsShown), bigCard, null);
}
private void setTimeout(int s){
int minute = s/60;
int second = s - (minute*60);
private void setTimeout(int s) {
int minute = s / 60;
int second = s - (minute * 60);
String text;
if(minute < 10){
if (minute < 10) {
text = "0" + Integer.toString(minute) + ":";
}else{
} else {
text = Integer.toString(minute) + ":";
}
if(second < 10){
if (second < 10) {
text = text + "0" + Integer.toString(second);
}else{
} else {
text = text + Integer.toString(second);
}
this.txtTimeRemaining.setText(text);
if (s==6 && !draftBooster.isEmptyGrid()) {
if (s == 6 && !draftBooster.isEmptyGrid()) {
AudioManager.playOnCountdown1();
}
}
@ -386,7 +385,7 @@ public class DraftPanel extends javax.swing.JPanel {
c = c.getParent();
}
if (c != null) {
((DraftPane)c).removeDraft();
((DraftPane) c).removeDraft();
}
}
@ -420,7 +419,6 @@ public class DraftPanel extends javax.swing.JPanel {
});
// popupMenuPickedArea.addSeparator();
}
private void addPopupMenuCardPanel() {
@ -439,7 +437,6 @@ public class DraftPanel extends javax.swing.JPanel {
});
// popupMenuCardPanel.addSeparator();
}
private void hideThisCard(UUID card) {
@ -472,7 +469,7 @@ public class DraftPanel extends javax.swing.JPanel {
}
if (currentBooster != null) {
String lastPick = getCardName(getLastPick(pickView.getPicks().values()));
if (lastPick != null) {
if (lastPick != null && currentBooster.length > 1) {
logPick(lastPick);
}
currentBooster = null;
@ -490,7 +487,7 @@ public class DraftPanel extends javax.swing.JPanel {
private void setCurrentBoosterForLog(SimpleCardsView booster) {
LinkedList<String> cards = new LinkedList<>();
for (SimpleCardView simple: booster.values()) {
for (SimpleCardView simple : booster.values()) {
String cardName = getCardName(simple);
if (cardName != null) {
cards.add(cardName);
@ -515,7 +512,7 @@ public class DraftPanel extends javax.swing.JPanel {
private Path pathToDraftLog() {
File saveDir = new File("gamelogs");
if(!saveDir.exists()) {
if (!saveDir.exists()) {
saveDir.mkdirs();
}
return new File(saveDir, logFilename).toPath();
@ -545,11 +542,10 @@ public class DraftPanel extends javax.swing.JPanel {
return cardInfo != null ? cardInfo.getName() : null;
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents

View file

@ -36,7 +36,7 @@ public class GathererSets implements Iterable<DownloadJob> {
private static final String[] withMythics = {"M10", "M11", "M12", "M13", "M14", "M15", "ORI",
"DDF", "DDG", "DDH", "DDI", "DDJ", "DDK", "DDL", "DDM", "DDN",
"DD3", "DD3B", "DDO",
"DD3", "DD3B", "DDO", "DDP",
"FVD", "FVE", "FVL", "FVR",
"V12", "V13", "V14", "V15",
"ALA", "CON", "ARB",

View file

@ -103,6 +103,7 @@ public class MagicCardsImageSource implements CardImageSource {
put("DDM", "duel-decks-jace-vs-vraska");
put("DDN", "duel-decks-speed-vs-cunning");
put("DDO", "duel-decks-elspeth-vs-kiora");
put("DDP", "duel-decks-zendikar-vs-eldrazi");
}
private static final long serialVersionUID = 1L;
};

View file

@ -123,6 +123,7 @@ public class WizardCardsImageSource implements CardImageSource {
setsAliases.put("DDM", "Duel Decks: Jace vs. Vraska");
setsAliases.put("DDN", "Duel Decks: Speed vs. Cunning");
setsAliases.put("DDO", "Duel Decks: Elspeth vs. Kiora");
setsAliases.put("DDP", "Duel Decks: Zendikar vs. Eldrazi");
setsAliases.put("DGM", "Dragon's Maze");
setsAliases.put("DIS", "Dissension");
setsAliases.put("DKA", "Dark Ascension");

View file

@ -1,3 +1,9 @@
#Generate|TOK:DDP|Eldrazi Spawn 1|
#Generate|TOK:DDP|Eldrazi Spawn 2|
#Generate|TOK:DDP|Eldrazi Spawn 3|
#Generate|TOK:DDP|Hellion|
#Generate|TOK:DDP|Plant|
#Generate|TOK:MM2|Eldrazi Spawn 1|
#Generate|TOK:MM2|Eldrazi Spawn 2|
#Generate|TOK:MM2|Eldrazi Spawn 3|

View file

@ -64,6 +64,6 @@ ddd=gvl
unh=uh
dde=pvc
# Remove setname as soon as the images can be downloaded
ignore.urls=TOK,MM2,V15,BFZ
ignore.urls=TOK,MM2,V15,BFZ,DDP
# sets ordered by release time (newest goes first)
token.lookup.order=BFZ,FVD,FVE,FVL,FVR,V12,V13,V14,V15,TPR,MPRP,DD3,DDO,ORI,MM2,PTC,DTK,FRF,KTK,M15,VMA,CNS,JOU,BNG,THS,DDL,M14,MMA,DGM,GTC,RTR,M13,AVR,DDI,DKA,ISD,M12,NPH,MBS,SOM,M11,ROE,DDE,WWK,ZEN,M10,GVL,ARB,DVD,CFX,JVC,ALA,EVE,SHM,EVG,MOR,LRW,10E,CLS,CHK,GRC
token.lookup.order=DDP,BFZ,FVD,FVE,FVL,FVR,V12,V13,V14,V15,TPR,MPRP,DD3,DDO,ORI,MM2,PTC,DTK,FRF,KTK,M15,VMA,CNS,JOU,BNG,THS,DDL,M14,MMA,DGM,GTC,RTR,M13,AVR,DDI,DKA,ISD,M12,NPH,MBS,SOM,M11,ROE,DDE,WWK,ZEN,M10,GVL,ARB,DVD,CFX,JVC,ALA,EVE,SHM,EVG,MOR,LRW,10E,CLS,CHK,GRC