Return watermark in CardSet data

This commit is contained in:
Gianlu 2020-05-28 19:20:44 +02:00
parent 6800a655fd
commit 5810e85039
4 changed files with 16 additions and 3 deletions

View File

@ -664,6 +664,8 @@ public class Constants {
CARD_SET_DESCRIPTION("csd"),
CARD_SET_NAME("csn"),
@DuplicationAllowed
WATERMARK(WhiteCardData.WATERMARK),
@DuplicationAllowed
@GoDataType("int")
ID(WhiteCardData.ID),
@GoDataType("int")

View File

@ -151,7 +151,7 @@ public class CustomCardsService {
}
int deckId = deckIdCounter.decrementAndGet();
final CustomDeck deck = new CustomDeck(deckId, StringEscapeUtils.escapeXml11(name), StringEscapeUtils.escapeXml11(description));
final CustomDeck deck = new CustomDeck(deckId, StringEscapeUtils.escapeXml11(name), StringEscapeUtils.escapeXml11(watermark), StringEscapeUtils.escapeXml11(description));
// load up the cards
final JSONArray blacks = (JSONArray) obj.get("calls");

View File

@ -23,22 +23,26 @@
package net.socialgamer.cah.customsets;
import net.socialgamer.cah.Constants;
import net.socialgamer.cah.data.CardSet;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
public class CustomDeck extends CardSet {
private final int id;
private final String name;
private final String watermark;
private final String description;
private final Set<CustomBlackCard> blackCards = new HashSet<>();
private final Set<CustomWhiteCard> whiteCards = new HashSet<>();
public CustomDeck(final int id, final String name, final String description) {
public CustomDeck(final int id, final String name, final String watermark, final String description) {
this.id = id;
this.name = name;
this.watermark = watermark;
this.description = description;
if (id >= 0) throw new IllegalArgumentException("Custom deck ID must be negative.");
@ -83,4 +87,11 @@ public class CustomDeck extends CardSet {
public Set<CustomWhiteCard> getWhiteCards() {
return whiteCards;
}
@Override
protected Map<Constants.CardSetData, Object> getCommonClientMetadata() {
Map<Constants.CardSetData, Object> data = super.getCommonClientMetadata();
data.put(Constants.CardSetData.WATERMARK, watermark);
return data;
}
}

View File

@ -37,7 +37,7 @@ public abstract class CardSet {
return cardSetData;
}
protected final Map<CardSetData, Object> getCommonClientMetadata() {
protected Map<CardSetData, Object> getCommonClientMetadata() {
final Map<CardSetData, Object> cardSetData = new HashMap<CardSetData, Object>();
cardSetData.put(CardSetData.ID, getId());
cardSetData.put(CardSetData.CARD_SET_NAME, getName());