mirror of
https://github.com/magefree/mage.git
synced 2025-12-28 22:42:03 -08:00
Cleanup sets.
This is an extensive renaming of sets to their correct names. "Duel Decks" and "Not Standard Legal" have been merged into a "Supplemental" set type. MTGO-only sets have been put into their own set type, just like magiccards.info. Supplemental sets now have a "block" which is the block that they have under magiccards.info, for easier organization. The deck builder on the client now relies on an autogenerated list instead of a hardcoded one.
This commit is contained in:
parent
880fab9014
commit
2f476b7c53
52 changed files with 306 additions and 667 deletions
|
|
@ -35,6 +35,7 @@ import java.util.HashMap;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
|
||||
import mage.cards.decks.DeckCardInfo;
|
||||
import mage.cards.decks.DeckCardLists;
|
||||
import mage.cards.repository.CardCriteria;
|
||||
|
|
@ -42,12 +43,8 @@ import mage.cards.repository.CardInfo;
|
|||
import mage.cards.repository.CardRepository;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.ColoredManaSymbol;
|
||||
import static mage.constants.ColoredManaSymbol.B;
|
||||
import static mage.constants.ColoredManaSymbol.G;
|
||||
import static mage.constants.ColoredManaSymbol.R;
|
||||
import static mage.constants.ColoredManaSymbol.U;
|
||||
import static mage.constants.ColoredManaSymbol.W;
|
||||
import mage.util.ClassScanner;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -97,13 +97,12 @@ public enum ExpansionRepository {
|
|||
return sets;
|
||||
}
|
||||
|
||||
public ExpansionInfo[] getSetsFromBlock(String blockName) {
|
||||
ExpansionInfo[] sets = new ExpansionInfo[0];
|
||||
public List<ExpansionInfo> getSetsFromBlock(String blockName) {
|
||||
List<ExpansionInfo> sets = new LinkedList<>();
|
||||
try {
|
||||
QueryBuilder<ExpansionInfo, Object> qb = expansionDao.queryBuilder();
|
||||
qb.where().eq("blockName", new SelectArg(blockName));
|
||||
List<ExpansionInfo> expansions = expansionDao.query(qb.prepare());
|
||||
sets = expansions.toArray(new ExpansionInfo[0]);
|
||||
return expansionDao.query(qb.prepare());
|
||||
} catch (SQLException ex) {
|
||||
}
|
||||
return sets;
|
||||
|
|
@ -122,15 +121,46 @@ public enum ExpansionRepository {
|
|||
}
|
||||
return set;
|
||||
}
|
||||
|
||||
public ExpansionInfo getSetByName(String setName) {
|
||||
ExpansionInfo set = null;
|
||||
try {
|
||||
QueryBuilder<ExpansionInfo, Object> qb = expansionDao.queryBuilder();
|
||||
qb.where().eq("name", new SelectArg(setName));
|
||||
List<ExpansionInfo> expansions = expansionDao.query(qb.prepare());
|
||||
if (expansions.size() > 0) {
|
||||
set = expansions.get(0);
|
||||
}
|
||||
} catch (SQLException ex) {
|
||||
}
|
||||
return set;
|
||||
}
|
||||
|
||||
public List<ExpansionInfo> getAll() {
|
||||
try {
|
||||
return expansionDao.queryForAll();
|
||||
QueryBuilder<ExpansionInfo, Object> qb = expansionDao.queryBuilder();
|
||||
qb.orderBy("releaseDate", true);
|
||||
return expansionDao.query(qb.prepare());
|
||||
} catch (SQLException ex) {
|
||||
}
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
|
||||
public List<String> getAllSetNames() {
|
||||
try {
|
||||
QueryBuilder<ExpansionInfo, Object> qb = expansionDao.queryBuilder();
|
||||
qb.orderBy("releaseDate", true);
|
||||
List<ExpansionInfo> expansions = expansionDao.query(qb.prepare());
|
||||
List<String> setNames = new LinkedList<>();
|
||||
for (ExpansionInfo expansionInfo : expansions) {
|
||||
setNames.add(expansionInfo.getName());
|
||||
}
|
||||
return setNames;
|
||||
} catch (SQLException ex) {
|
||||
}
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
public long getContentVersionFromDB() {
|
||||
try {
|
||||
ConnectionSource connectionSource = new JdbcConnectionSource(JDBC_URL);
|
||||
|
|
|
|||
|
|
@ -5,11 +5,10 @@ package mage.constants;
|
|||
* @author North
|
||||
*/
|
||||
public enum SetType {
|
||||
CORE("Core"),
|
||||
DUEL_DECK("Duel Deck"),
|
||||
EXPANSION("Expansion"),
|
||||
NON_STANDARD_LEGAL_SETS("Non-standard-legal sets"),
|
||||
REPRINT("Reprint"),
|
||||
CORE("Core"),
|
||||
MAGIC_ONLINE("Magic Online"),
|
||||
SUPPLEMENTAL("Supplemental"),
|
||||
PROMOTIONAL("Promotional"),
|
||||
JOKESET("Joke Set");
|
||||
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ public class TournamentUtil {
|
|||
if (setCodesland.isEmpty()) {
|
||||
for (String setCode :setCodesDeck) {
|
||||
ExpansionInfo expansionInfo = ExpansionRepository.instance.getSetByCode(setCode);
|
||||
ExpansionInfo [] blockSets = ExpansionRepository.instance.getSetsFromBlock(expansionInfo.getBlockName());
|
||||
List<ExpansionInfo> blockSets = ExpansionRepository.instance.getSetsFromBlock(expansionInfo.getBlockName());
|
||||
for (ExpansionInfo blockSet: blockSets) {
|
||||
if (blockSet.hasBasicLands()) {
|
||||
setCodesland.add(blockSet.getCode());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue