Class DeckCreateRequest
java.lang.Object
net.demilich.metastone.game.decks.DeckCreateRequest
- All Implemented Interfaces:
Serializable,Cloneable
Represents a request to create a game with the specified deck list.
A deck list can be specified in a community format using fromDeckList(String) and converted to a deck usable
by the engine using toGameDeck(). Alternatively, the hero class and card IDs can be specified using fromCardIds(String, String...).
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe maximum number of characters that can be specified in a name. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionclone()static DeckCreateRequeststatic DeckCreateRequestfromCardIds(String heroClass, String... cardIds) static DeckCreateRequestfromCardIds(String heroClass, List<String> cardIds) static DeckCreateRequestfromDeckList(String deckList) Creates a deck list from a specified community format.getName()booleanisDraft()booleanbooleanisValid()voidsetCardIds(List<String> cardIds) voidsetDraft(boolean draft) voidvoidsetHeroCardId(String heroCardId) voidsetHeroClass(String heroClass) voidsetInventoryIds(List<String> inventoryIds) voidsetStandardDeck(boolean standardDeck) toString()withCardIds(List<String> cardIds) withDraft(boolean draft) withFormat(String format) withHeroCardId(String heroCardId) withHeroClass(String heroClass) withInventoryIds(List<String> inventoryIds) withUserId(String userId)
-
Field Details
-
NAME_MAX_LENGTH
public static final int NAME_MAX_LENGTHThe maximum number of characters that can be specified in a name.- See Also:
-
-
Constructor Details
-
DeckCreateRequest
public DeckCreateRequest()
-
-
Method Details
-
fromDeckList
Creates a deck list from a specified community format.In this format, a deck is in one of two formats:
- A community decklist format, which is a plain text list of cards.
- A varint format, which is a Base 64-encoded list of numbers that correspond to specific cards (deprecated).
A community decklist format looks like:
Name: Name of the deck Class: The color corresponding to the champion. Format: The game format this deck belongs to, indicating which cards it can use 1x Card Name 2x Card Name 3x Card Name
The specification for these lines:- Name: The name of the deck that will appear in the client. This does not have to be a unique name. The
name will begin after the first space in the line, if there is one. Whitespace is removed from the end and
beginning of the name. The name is read until the end of the line. Names must be
NAME_MAX_LENGTHcharacters long or fewer. - Class: The color corresponding to the champion. Each champion has a color specified in the
CardDesc.heroClassfield of aSpellsource.CardTypeMessage.CardType.CLASS. You can find the appropriate, all-capitals color by searching forCLASScards in theCardCatalogue. - Format: A format consisting of a set of
CardSet(strings) in theDeckFormat.formats()map. - A list of cards. These are each in the form
number, followed immediately by anxcharacter, followed by whitespace, followed by the case-sensitive card name in theCardDesc.namefield. Whenever two cards share a name, the one that is collectible is preferred; otherwise, the chosen card is arbitrary and will not produce a warning.
- Parameters:
deckList- A community format deck list- Returns:
- A request on which
toGameDeck()can be called to get an actual deck, or which can be passed to certain network services to create decks for users. - Throws:
DeckListParsingException- that contains a list of more detailed exceptions as to why the deck failed to parse or any other errors related to it. This ensures you will see all the errors related to deck list parsing, not just one error.
-
fromCardIds
-
fromCardIds
-
getUserId
-
getName
-
setName
-
getHeroClass
-
setHeroClass
-
getInventoryIds
-
setInventoryIds
-
withUserId
-
withName
-
withHeroClass
-
withInventoryIds
-
getCardIds
-
setCardIds
-
withCardIds
-
isDraft
public boolean isDraft() -
setDraft
public void setDraft(boolean draft) -
withDraft
-
clone
-
toGameDeck
-
getHeroCardId
-
setHeroCardId
-
withHeroCardId
-
isValid
public boolean isValid() -
toString
-
getFormat
-
setFormat
-
withFormat
-
empty
-
isStandardDeck
public boolean isStandardDeck() -
setStandardDeck
-