Skip to content

Latest commit

 

History

History
98 lines (74 loc) · 2.64 KB

README.md

File metadata and controls

98 lines (74 loc) · 2.64 KB

This is the Elder Scrolls: Legends SDK Java implementation.

It is a wrapper around the Elder Scrolls: Legends API of https://elderscrollslegends.io.

Including in your project

Gradle/maven dependency

Latest version is 1.1.6

ApproachInstruction
Gradle
implementation "net.markjfisher:elderscrolls-legends-sdk-java:{version}"
Gradle (Kotlin DSL)
implementation("net.markjfisher:elderscrolls-legends-sdk-java:{version}")
Maven
<dependency>
    <groupId>net.markjfisher</groupId>
    <artifactId>elderscrolls-legends-sdk-java</artifactId>
    <version>{version}</version>
</dependency>

Example usage

The following illustrates using all(), where() and find().

public class Legends {
	public static void main(String args[]) {
		System.out.println(Keyword.all());

		System.out.println(Card.find("3921e71a0b3a5f30032d54d402cefb37b60aa46e"));

		Map<String, String> cardQuery = Map.of(
			"attributes", "strength",
			"keywords", "guard");

		Card.where(cardQuery)
			.forEach(System.out::println);

		Set.all()
			.stream()
			.filter(set -> set.getTotalCards() > 100)
			.forEach(System.out::println);

		Deck deck = Deck.importCode("SPADhlfvoFAEqEcfkvdhANdqdQeYlDmGnMlLpTitldmCpZsp");
		printDetails(deck);

		Collection c = Collection.importCode("SP!#hlfv!#qEcf!#bkiP");
		printDetails(c);

		CardCache.load(); // Load all cards into cache - useful if you have long running process doing export code lookups
		// Goblin skulk by export code, or sdk Id.
		Card c1 = CardCache.findByCode("hl"); // Use export code to find a card
		Card c2 = CardCache.findById("2413799c807377f860cd9fe2e6c472bdbb1360a7"); // Use sdk Id to find a card
	}

	private static void printDetails(CardGrouping c) {
		IntStream.rangeClosed(1, 3)
				.peek( i -> System.out.println("============== " + i + " Of ================"))
				.mapToObj(c::of)
				.forEach(cards -> cards.forEach(card ->
						System.out.println(String.format("%s\n       Set: %s\n    Rarity: %s\n", card.getName(), card.getSet().getName(), card.getRarity()))
				));
	}

}

SDK

See SDK Usage

Locally Building

Ensure you have Java 8+ installed (e.g. via SdkMan)

./gradlew

Underlying implementation details

This library uses Unirest for low level client connection.

This sdk was developed in Kotlin.