* Adventure cards - improved game logs (card hint works with adventure spell now, added original card info to cast's log);

This commit is contained in:
Oleg Agafonov 2020-01-02 14:48:28 +04:00
parent 713110eb03
commit 862fe69b53
9 changed files with 141 additions and 62 deletions

View file

@ -3,6 +3,7 @@ package org.mage.plugins.card.dl.sources;
import mage.client.MageFrame;
import mage.remote.Connection;
import mage.remote.Connection.ProxyType;
import mage.util.CardUtil;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
@ -13,7 +14,10 @@ import org.mage.plugins.card.images.CardDownloadData;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.*;
import java.net.HttpURLConnection;
import java.net.InetSocketAddress;
import java.net.Proxy;
import java.net.URL;
import java.util.*;
import java.util.prefs.Preferences;
@ -298,7 +302,7 @@ public enum MythicspoilerComSource implements CardImageSource {
Preferences prefs = MageFrame.getPreferences();
Connection.ProxyType proxyType = Connection.ProxyType.valueByText(prefs.get("proxyType", "None"));
for (String setName : setNames.split("\\^")) {
String URLSetName = URLEncoder.encode(setName, "UTF-8");
String URLSetName = CardUtil.urlEncode(setName);
String baseUrl = "http://mythicspoiler.com/" + URLSetName + '/';
Map<String, String> pageLinks = getSetLinksFromPage(cardSet, aliasesStart, prefs, proxyType, baseUrl, baseUrl);

View file

@ -7,17 +7,16 @@ import com.google.gson.JsonParser;
import mage.cards.ExpansionSet;
import mage.cards.Sets;
import mage.client.util.CardLanguage;
import mage.util.CardUtil;
import org.apache.log4j.Logger;
import org.mage.plugins.card.dl.DownloadServiceInfo;
import org.mage.plugins.card.images.CardDownloadData;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.net.Proxy;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLEncoder;
import java.util.*;
/**
@ -96,12 +95,7 @@ public enum ScryfallImageSource implements CardImageSource {
}
}
try {
scryfallCollectorId = URLEncoder.encode(scryfallCollectorId, "utf-8");
} catch (UnsupportedEncodingException e) {
// URL failed to encode, this will cause download to miss in certain environments
}
scryfallCollectorId = CardUtil.urlEncode(scryfallCollectorId);
baseUrl = "https://api.scryfall.com/cards/" + formatSetName(card.getSet(), isToken) + "/"
+ scryfallCollectorId + "/" + localizedCode + "?format=image";
alternativeUrl = "https://api.scryfall.com/cards/" + formatSetName(card.getSet(), isToken) + "/"
@ -227,7 +221,7 @@ public enum ScryfallImageSource implements CardImageSource {
}
private String searchCard(Proxy proxy, String set, String name) throws Exception {
final URL searchUrl = new URL("https://api.scryfall.com/cards/search?q=s:" + URLEncoder.encode(set + " " + name, "UTF-8"));
final URL searchUrl = new URL("https://api.scryfall.com/cards/search?q=s:" + CardUtil.urlEncode(set + " " + name));
URLConnection request = proxy == null ? searchUrl.openConnection() : searchUrl.openConnection(proxy);
request.connect();

View file

@ -522,7 +522,6 @@ public enum WizardCardsImageSource implements CardImageSource {
}
for (String setName : setNames.split("\\^")) {
// String URLSetName = URLEncoder.encode(setName, "UTF-8");
String URLSetName = setName.replaceAll(" ", "%20");
int page = 0;
int firstMultiverseIdLastPage = 0;