GUI, deck: improved bracket level calculations (added all infinite combos list and spellbook downloader, part of #13341)

This commit is contained in:
Oleg Agafonov 2025-06-06 18:55:49 +04:00
parent 1fb4cecd6b
commit d465c9fb82
9 changed files with 2148 additions and 9 deletions

View file

@ -27,9 +27,11 @@ import java.util.stream.Stream;
* Features:
* - [x] find possible bracket level of the deck
* - [x] find affected cards by checking group
* - [ ] TODO: data download and generate
* - [x] can auto-generate infinite combos list, see verify test downloadAndPrepareCommanderBracketsData
* - [ ] TODO: tests
* - [ ] TODO: table - players brackets level disclose settings
* - [ ] TODO: deck - improve gui to show more levels
* - [ ] TODO: generate - convert card name to xmage format and assert on bad names (ascii only)
*
* @author JayDi85
*/

View file

@ -291,16 +291,25 @@ public class XmageURLConnection {
}
}
public static String downloadText(String resourceUrl) {
return downloadText(resourceUrl, null);
}
/**
* Fast download of text data
*
* @param additionalHeaders set extra headers like application/json
*
* @return downloaded text on OK 200 response or empty on any other errors
*/
public static String downloadText(String resourceUrl) {
public static String downloadText(String resourceUrl, Map<String, String> additionalHeaders) {
XmageURLConnection con = new XmageURLConnection(resourceUrl);
con.startConnection();
if (con.isConnected()) {
try {
if (additionalHeaders != null) {
con.setRequestHeaders(additionalHeaders);
}
con.connect();
if (con.getResponseCode() == 200) {
return con.getGoodResponseAsString();

View file

@ -853,7 +853,7 @@ public class DownloadPicturesService extends DefaultBoundedRangeModel implements
connection.startConnection();
if (connection.isConnected()) {
// custom headers (ues
// custom headers
connection.setRequestHeaders(selectedSource.getHttpRequestHeaders(currentUrl));
try {