commit f919d1db7cd12f458b350c90f8b1d3c4348f5679 Author: Guillem George Date: Thu Feb 12 12:37:08 2026 +0100 given files diff --git a/database/pom.xml b/database/pom.xml new file mode 100644 index 0000000..6e7cf1b --- /dev/null +++ b/database/pom.xml @@ -0,0 +1,235 @@ + + + 4.0.0 + + fr.epita.assistants + database + 1.0 + + + 21 + 21 + 21 + + 3.13.0 + true + + 2.22.2 + 3.4.1 + 3.1.2 + + UTF-8 + UTF-8 + + io.quarkus.platform + quarkus-bom + 3.16.1 + + + true + + ${project.build.directory}/surefire-reports + + + + + + ${quarkus.platform.group-id} + ${quarkus.platform.artifact-id} + ${quarkus.platform.version} + pom + import + + + + + + + io.quarkus + quarkus-resteasy + + + io.quarkus + quarkus-resteasy-jackson + + + io.quarkus + quarkus-arc + + + io.quarkus + quarkus-quartz + + + io.quarkus + quarkus-smallrye-openapi + + + org.projectlombok + lombok + 1.18.30 + + + org.apache.maven.plugins + maven-surefire-plugin + ${versions.maven-surefire-plugin} + + + com.tngtech.archunit + archunit-junit5 + 1.3.0 + + + io.github.classgraph + classgraph + 4.8.179 + + + io.quarkus + quarkus-junit5 + test + + + io.rest-assured + rest-assured + test + + + io.smallrye.reactive + smallrye-reactive-messaging-in-memory + test + + + org.awaitility + awaitility + test + + + org.assertj + assertj-core + 3.26.0 + test + + + io.quarkus + quarkus-jdbc-postgresql + + + io.quarkus + quarkus-hibernate-orm-panache + + + org.apache.maven.plugins + maven-jar-plugin + ${versions.maven-jar-plugin} + + + io.quarkus + quarkus-flyway + + + + + + + org.apache.maven.plugins + maven-assembly-plugin + + + + fully.qualified.MainClass + + + + jar-with-dependencies + + + + + io.quarkus + quarkus-maven-plugin + ${quarkus.platform.version} + true + + + + build + generate-code + generate-code-tests + + + + + + maven-compiler-plugin + ${compiler-plugin.version} + + ${maven.compiler.parameters} + + + + maven-surefire-plugin + ${versions.maven-surefire-plugin} + + + org.jboss.logmanager.LogManager + ${maven.home} + + + + + + + + fetch-bom + + true + + + + io.quarkus.platform + quarkus-bom-quarkus-platform-properties + 3.17.5 + properties + + + + + native + + + + native + + + + + + maven-failsafe-plugin + ${versions.maven-surefire-plugin} + + + + integration-test + verify + + + + ${project.build.directory}/${project.build.finalName}-runner + org.jboss.logmanager.LogManager + ${maven.home} + + + + + + + + + native + + + + + diff --git a/database/src/main/resources/application.properties b/database/src/main/resources/application.properties new file mode 100644 index 0000000..8d1ceb2 --- /dev/null +++ b/database/src/main/resources/application.properties @@ -0,0 +1,24 @@ +# DEV +%dev.quarkus.http.port=8082 +%dev.quarkus.hibernate-orm.database.default-schema=${epita.group.id} +%dev.quarkus.datasource.jdbc.url=jdbc:postgresql://${DB_HOST:localhost}:${DB_PORT:5432}/${DB_NAME:courses} +%dev.quarkus.flyway.create-schemas=true +%dev.quarkus.flyway.schemas=${epita.group.id} + +%dev.quarkus.swagger-ui.enable=true +quarkus.swagger-ui.always-include=true +quarkus.swagger-ui.theme=material + +# DB +quarkus.datasource.username=${DB_USERNAME:postgres} +quarkus.datasource.password=${DB_PASSWORD:postgres} +quarkus.datasource.jdbc.url=jdbc:postgresql://${DB_HOST:localhost}:${DB_PORT:5432}/${DB_NAME:courses} +quarkus.datasource.jdbc.transaction-isolation-level=read-uncommitted + +epita.group.id=courses +epita.random=0 + +quarkus.hibernate-orm.database.generation=${DATABASE_DB_GENERATION:update} + +quarkus.devservices.enabled=false +quarkus.http.cors=true diff --git a/endpoints/pom.xml b/endpoints/pom.xml new file mode 100644 index 0000000..fc67629 --- /dev/null +++ b/endpoints/pom.xml @@ -0,0 +1,186 @@ + + + 4.0.0 + + fr.epita.assistants + endpoints + 1.0 + + + 21 + 21 + 21 + + 3.13.0 + true + + 3.0.0-M5 + 3.4.1 + 3.1.2 + + UTF-8 + UTF-8 + + io.quarkus.platform + quarkus-bom + 3.17.5 + + true + + ${project.build.directory}/surefire-reports + + + + + + ${quarkus.platform.group-id} + ${quarkus.platform.artifact-id} + ${quarkus.platform.version} + pom + import + + + + + + + io.quarkus + quarkus-rest + + + org.projectlombok + lombok + 1.18.30 + provided + + + org.eclipse.microprofile.openapi + microprofile-openapi-api + 4.0.2 + + + io.quarkus + quarkus-rest-jackson + + + io.quarkus + quarkus-smallrye-openapi + + + io.quarkus + quarkus-junit5 + test + + + io.rest-assured + rest-assured + test + + + org.assertj + assertj-core + 3.26.0 + test + + + org.apache.maven.surefire + surefire-junit-platform + ${versions.maven-surefire-plugin} + + + org.apache.maven.surefire + surefire-api + 3.5.2 + + + org.apache.maven.plugins + maven-jar-plugin + ${versions.maven-jar-plugin} + + + org.apache.maven.plugins + maven-install-plugin + ${versions.maven-install-plugin} + + + org.apache.maven.plugins + maven-dependency-plugin + 3.7.0 + + + + + + + ${quarkus.platform.group-id} + quarkus-maven-plugin + ${quarkus.platform.version} + true + + + + build + generate-code + generate-code-tests + native-image-agent + + + + + + maven-compiler-plugin + ${compiler-plugin.version} + + true + + + + maven-surefire-plugin + ${versions.maven-surefire-plugin} + + + org.jboss.logmanager.LogManager + ${maven.home} + + + + + maven-failsafe-plugin + ${versions.maven-surefire-plugin} + + + + integration-test + verify + + + + + + ${project.build.directory}/${project.build.finalName}-runner + + org.jboss.logmanager.LogManager + ${maven.home} + + + + + + + + + native + + + native + + + + false + true + + + + + diff --git a/endpoints/src/main/java/fr/epita/assistants/presentation/rest/HelloWorldEndpoint.java b/endpoints/src/main/java/fr/epita/assistants/presentation/rest/HelloWorldEndpoint.java new file mode 100644 index 0000000..4f8a59d --- /dev/null +++ b/endpoints/src/main/java/fr/epita/assistants/presentation/rest/HelloWorldEndpoint.java @@ -0,0 +1,15 @@ +package fr.epita.assistants.presentation.rest; + +import jakarta.ws.rs.*; +import jakarta.ws.rs.core.MediaType; + +@Path("/") +@Consumes(MediaType.TEXT_PLAIN) +@Produces(MediaType.TEXT_PLAIN) +public class HelloWorldEndpoint { + @Path("/") + @GET + public String helloWorld() { + return "Hello World!"; + } +} diff --git a/endpoints/src/main/resources/application.properties b/endpoints/src/main/resources/application.properties new file mode 100644 index 0000000..b3b3d13 --- /dev/null +++ b/endpoints/src/main/resources/application.properties @@ -0,0 +1,7 @@ +%dev.quarkus.http.port=8082 +%dev.quarkus.swagger-ui.enable=true + +quarkus.log.category."org.apache.kafka".level=WARN +quarkus.devservices.enabled=false + +quarkus.http.cors=true diff --git a/endpoints/src/main/resources/openapi.yaml b/endpoints/src/main/resources/openapi.yaml new file mode 100644 index 0000000..7e8ac48 --- /dev/null +++ b/endpoints/src/main/resources/openapi.yaml @@ -0,0 +1,80 @@ +--- +openapi: 3.1.0 +tags: +- name: Greeting +- name: String Operations +servers: + - url: http://localhost:8082/ +components: + schemas: + HelloResponse: + type: object + properties: + content: + type: string + example: "hello test" + ReverseRequest: + type: object + properties: + content: + type: string + example: "hello\ntest" + ReverseResponse: + type: object + properties: + original: + type: string + example: "hello\ntest" + reversed: + type: string + example: "tset\nolleh" +paths: + /hello/{name}: + get: + summary: Greet by name + description: "Returns a greeting message in the format `hello {name}` using\ + \ the provided name." + tags: + - Greeting + parameters: + - name: name + in: path + required: true + schema: + type: string + responses: + "200": + description: Greeting message returned successfully. + content: + application/json: + schema: + $ref: "#/components/schemas/HelloResponse" + "400": + description: "Bad request: The name parameter is null or empty." + /reverse: + post: + summary: Reverse a string + description: "Accepts a JSON request containing a string, reverses the string,\ + \ and returns both the original and reversed versions." + tags: + - String Operations + requestBody: + description: JSON object containing the string to be reversed. + content: + application/json: + schema: + $ref: "#/components/schemas/ReverseRequest" + required: true + responses: + "200": + description: Reversed string returned successfully. + content: + application/json: + schema: + $ref: "#/components/schemas/ReverseResponse" + "400": + description: "Bad request: Request body is null or the string content is\ + \ null or empty." +info: + title: endpoints API + version: "1.0" diff --git a/yakamon/.env b/yakamon/.env new file mode 100644 index 0000000..e69de29 diff --git a/yakamon/.gitignore b/yakamon/.gitignore new file mode 100644 index 0000000..8d8f826 --- /dev/null +++ b/yakamon/.gitignore @@ -0,0 +1,21 @@ +*.class + +.idea/ +target/ + +*.log + +*.jar +*.war +*.nar +*.ear +*.zip +*.tar.gz +*.rar + +hs_err_pid* +replay_pid* + +viewer/ + +# Put here other files you want to ignore \ No newline at end of file diff --git a/yakamon/pom.xml b/yakamon/pom.xml new file mode 100644 index 0000000..d344ded --- /dev/null +++ b/yakamon/pom.xml @@ -0,0 +1,374 @@ + + + 4.0.0 + + fr.epita.assistants + yakamon + 1.0.0 + + + 21 + 21 + 21 + + 3.13.0 + true + + 3.0.0-M5 + + 3.4.1 + 3.1.2 + + UTF-8 + UTF-8 + + + io.quarkus.platform + + quarkus-bom + 3.17.5 + + true + + ${project.build.directory}../../target/surefire-reports + + + + + + + ${quarkus.platform.group-id} + ${quarkus.platform.artifact-id} + ${quarkus.platform.version} + pom + import + + + + + + + io.quarkus + quarkus-junit5 + + + io.quarkus + quarkus-rest-jackson + + + io.quarkus + quarkus-rest-jackson-deployment + + + io.quarkus + quarkus-arc + + + org.projectlombok + lombok + 1.18.36 + provided + + + io.smallrye.reactive + smallrye-reactive-messaging-in-memory + test + + + org.awaitility + awaitility + test + + + org.assertj + assertj-core + 3.26.0 + test + + + io.rest-assured + rest-assured + test + + + + org.apache.httpcomponents + httpmime + + + io.quarkus + quarkus-rest-kotlin + + + org.junit.jupiter + junit-jupiter-api + test + + + org.junit.jupiter + junit-jupiter-engine + test + + + io.quarkus.platform + quarkus-bom + ${quarkus.platform.version} + pom + + + + io.quarkus + quarkus-junit5-properties + + + org.junit.jupiter + junit-jupiter + + + org.opentest4j + opentest4j + 1.3.0 + + + org.apiguardian + apiguardian-api + 1.1.2 + + + org.junit.jupiter + junit-jupiter-params + + + org.apache.maven.surefire + surefire-junit-platform + ${versions.maven-surefire-plugin} + + + org.apache.maven.surefire + common-java5 + 3.5.2 + + + org.apache.maven.surefire + surefire-shared-utils + 3.5.2 + + + org.junit.platform + junit-platform-engine + test + + + org.junit.platform + junit-platform-launcher + test + + + org.apache.maven.surefire + surefire-api + 3.5.2 + + + io.quarkus.platform + quarkus-maven-plugin + 3.17.5 + + + org.apache.maven.plugins + maven-jar-plugin + ${versions.maven-jar-plugin} + + + org.apache.maven.plugins + maven-install-plugin + ${versions.maven-install-plugin} + + + io.quarkus + quarkus-rest-kotlin-deployment + + + org.junit.platform + junit-platform-commons + + + org.apache.maven + maven-repository-metadata + + + org.apache.maven + maven-plugin-registry + 2.0.6 + + + classworlds + classworlds + 1.1-alpha-2 + + + io.quarkus + quarkus-maven-plugin + 3.17.5 + + + io.quarkus + quarkus-smallrye-openapi + + + com.tngtech.archunit + archunit-junit5 + 1.3.0 + + + io.github.classgraph + classgraph + 4.8.179 + + + org.apache.maven.plugins + maven-resources-plugin + 3.3.1 + + + org.apache.maven.plugins + maven-assembly-plugin + 3.7.1 + + + org.apache.maven.plugins + maven-dependency-plugin + 3.7.0 + + + io.quarkus + quarkus-hibernate-orm-panache + + + io.quarkus + quarkus-jdbc-postgresql + + + io.quarkus + quarkus-smallrye-metrics + test + + + + + + + org.apache.maven.plugins + maven-assembly-plugin + + + + fully.qualified.MainClass + + + + jar-with-dependencies + + + + + io.quarkus + quarkus-maven-plugin + ${quarkus.platform.version} + true + + + + build + generate-code + generate-code-tests + + + + + + maven-compiler-plugin + ${compiler-plugin.version} + + ${maven.compiler.parameters} + + + org.projectlombok + lombok + 1.18.36 + + + + + + maven-surefire-plugin + ${versions.maven-surefire-plugin} + + + + org.jboss.logmanager.LogManager + + ${maven.home} + + + + + + + + fetch-bom + + true + + + + io.quarkus.platform + quarkus-bom-quarkus-platform-properties + + 3.17.5 + properties + + + + + native + + + native + + + + + + maven-failsafe-plugin + ${versions.maven-surefire-plugin} + + + + integration-test + verify + + + + + ${project.build.directory}/${project.build.finalName}-runner + + + org.jboss.logmanager.LogManager + + ${maven.home} + + + + + + + + + native + + + + + \ No newline at end of file diff --git a/yakamon/src/main/java/fr/epita/assistants/yakamon/presentation/rest/HelloWorldResource.java b/yakamon/src/main/java/fr/epita/assistants/yakamon/presentation/rest/HelloWorldResource.java new file mode 100644 index 0000000..fb62d4b --- /dev/null +++ b/yakamon/src/main/java/fr/epita/assistants/yakamon/presentation/rest/HelloWorldResource.java @@ -0,0 +1,22 @@ +package fr.epita.assistants.yakamon.presentation.rest; + +import jakarta.ws.rs.*; +import jakarta.ws.rs.core.MediaType; + +@Path("/hello") +@Produces(MediaType.TEXT_PLAIN) +@Consumes(MediaType.TEXT_PLAIN) +public class HelloWorldResource { + + @GET + @Path("/") + public String helloWorld() { + return "Hello, world!"; + } + + @GET + @Path("/{name}") + public String helloWorld(@PathParam("name") String name) { + return "Hello " + name + "!"; + } +} diff --git a/yakamon/src/main/java/fr/epita/assistants/yakamon/utils/Direction.java b/yakamon/src/main/java/fr/epita/assistants/yakamon/utils/Direction.java new file mode 100644 index 0000000..1f62c59 --- /dev/null +++ b/yakamon/src/main/java/fr/epita/assistants/yakamon/utils/Direction.java @@ -0,0 +1,15 @@ +package fr.epita.assistants.yakamon.utils; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +@AllArgsConstructor +@Getter +public enum Direction { + UP(new Point(0, -1)), + RIGHT(new Point(1, 0)), + DOWN(new Point(0, 1)), + LEFT(new Point(-1, 0)); + + private final Point point; +} diff --git a/yakamon/src/main/java/fr/epita/assistants/yakamon/utils/ElementType.java b/yakamon/src/main/java/fr/epita/assistants/yakamon/utils/ElementType.java new file mode 100644 index 0000000..d2ef59a --- /dev/null +++ b/yakamon/src/main/java/fr/epita/assistants/yakamon/utils/ElementType.java @@ -0,0 +1,23 @@ +package fr.epita.assistants.yakamon.utils; + +public enum ElementType { + BUG, + DARK, + ELECTRIC, + FAIRY, + FIGHTING, + FIRE, + FLYING, + GHOST, + GRASS, + GROUND, + ICE, + NORMAL, + POISON, + PSYCHIC, + ROCK, + STEEL, + WATER, + DRAGON, + STELLAR +} diff --git a/yakamon/src/main/java/fr/epita/assistants/yakamon/utils/ErrorCode.java b/yakamon/src/main/java/fr/epita/assistants/yakamon/utils/ErrorCode.java new file mode 100644 index 0000000..5d89ce8 --- /dev/null +++ b/yakamon/src/main/java/fr/epita/assistants/yakamon/utils/ErrorCode.java @@ -0,0 +1,30 @@ +package fr.epita.assistants.yakamon.utils; + +import jakarta.ws.rs.WebApplicationException; +import jakarta.ws.rs.core.Response; +import lombok.Getter; +import lombok.RequiredArgsConstructor; + +import static jakarta.ws.rs.core.Response.Status; + +@Getter +@RequiredArgsConstructor +public enum ErrorCode { + EXAMPLE_ERROR(Status.INTERNAL_SERVER_ERROR, "This is an error example"); + + private final Response.Status errorCode; + + private final String errorMessage; + + public WebApplicationException getException() { + return new WebApplicationException(Response.status(errorCode).entity(new ErrorInfo(errorMessage)).build()); + } + + public void throwException() { + throw getException(); + } + + public void throwException(String prefix) { + throw new WebApplicationException(Response.status(errorCode).entity(new ErrorInfo(prefix + ": " + errorMessage)).build()); + } +} diff --git a/yakamon/src/main/java/fr/epita/assistants/yakamon/utils/ErrorInfo.java b/yakamon/src/main/java/fr/epita/assistants/yakamon/utils/ErrorInfo.java new file mode 100644 index 0000000..86422da --- /dev/null +++ b/yakamon/src/main/java/fr/epita/assistants/yakamon/utils/ErrorInfo.java @@ -0,0 +1,10 @@ +package fr.epita.assistants.yakamon.utils; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +@Getter +@AllArgsConstructor +public class ErrorInfo { + private String message; +} diff --git a/yakamon/src/main/java/fr/epita/assistants/yakamon/utils/Item.java b/yakamon/src/main/java/fr/epita/assistants/yakamon/utils/Item.java new file mode 100644 index 0000000..d16032f --- /dev/null +++ b/yakamon/src/main/java/fr/epita/assistants/yakamon/utils/Item.java @@ -0,0 +1,12 @@ +package fr.epita.assistants.yakamon.utils; + +import fr.epita.assistants.yakamon.utils.tile.ItemType; +import lombok.AllArgsConstructor; +import lombok.Data; + +@Data +@AllArgsConstructor +public class Item { + ItemType itemType; + Integer quantity; +} diff --git a/yakamon/src/main/java/fr/epita/assistants/yakamon/utils/Point.java b/yakamon/src/main/java/fr/epita/assistants/yakamon/utils/Point.java new file mode 100644 index 0000000..34e7f58 --- /dev/null +++ b/yakamon/src/main/java/fr/epita/assistants/yakamon/utils/Point.java @@ -0,0 +1,11 @@ +package fr.epita.assistants.yakamon.utils; + +import lombok.AllArgsConstructor; +import lombok.Data; + +@AllArgsConstructor +@Data +public class Point { + private int posX; + private int posY; +} diff --git a/yakamon/src/main/java/fr/epita/assistants/yakamon/utils/tile/Collectible.java b/yakamon/src/main/java/fr/epita/assistants/yakamon/utils/tile/Collectible.java new file mode 100644 index 0000000..7010107 --- /dev/null +++ b/yakamon/src/main/java/fr/epita/assistants/yakamon/utils/tile/Collectible.java @@ -0,0 +1,28 @@ +package fr.epita.assistants.yakamon.utils.tile; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; + +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.PROPERTY, + property = "type", + visible = true +) +@JsonSubTypes({ + @JsonSubTypes.Type(value = ItemType.class, name = "ITEM"), + @JsonSubTypes.Type(value = YakamonType.class, name = "YAKAMON") +}) +public interface Collectible { + + @JsonProperty("type") + CollectibleType getCollectibleType(); + + @JsonProperty("value") + String getValue(); + + @JsonIgnore + CollectibleInfo getCollectibleInfo(); +} diff --git a/yakamon/src/main/java/fr/epita/assistants/yakamon/utils/tile/CollectibleInfo.java b/yakamon/src/main/java/fr/epita/assistants/yakamon/utils/tile/CollectibleInfo.java new file mode 100644 index 0000000..d1fb8fa --- /dev/null +++ b/yakamon/src/main/java/fr/epita/assistants/yakamon/utils/tile/CollectibleInfo.java @@ -0,0 +1,11 @@ +package fr.epita.assistants.yakamon.utils.tile; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +@Getter +@AllArgsConstructor +public abstract class CollectibleInfo { + + private Character value; +} diff --git a/yakamon/src/main/java/fr/epita/assistants/yakamon/utils/tile/CollectibleType.java b/yakamon/src/main/java/fr/epita/assistants/yakamon/utils/tile/CollectibleType.java new file mode 100644 index 0000000..6a3c71d --- /dev/null +++ b/yakamon/src/main/java/fr/epita/assistants/yakamon/utils/tile/CollectibleType.java @@ -0,0 +1,6 @@ +package fr.epita.assistants.yakamon.utils.tile; + +public enum CollectibleType { + ITEM, + YAKAMON; +} diff --git a/yakamon/src/main/java/fr/epita/assistants/yakamon/utils/tile/CollectibleUtils.java b/yakamon/src/main/java/fr/epita/assistants/yakamon/utils/tile/CollectibleUtils.java new file mode 100644 index 0000000..68dd53f --- /dev/null +++ b/yakamon/src/main/java/fr/epita/assistants/yakamon/utils/tile/CollectibleUtils.java @@ -0,0 +1,25 @@ +package fr.epita.assistants.yakamon.utils.tile; + +import java.util.HashMap; +import java.util.Map; + +public final class CollectibleUtils { + private CollectibleUtils() { + + } + + private static final Map lookup = new HashMap<>(); + + static { + for (ItemType r : ItemType.values()) { + lookup.put(r.getCollectibleInfo().getValue(), r); + } + for (YakamonType y : YakamonType.values()) { + lookup.put(y.getCollectibleInfo().getValue(), y); + } + } + + public static Collectible getCollectible(Character c) { + return lookup.get(c); + } +} \ No newline at end of file diff --git a/yakamon/src/main/java/fr/epita/assistants/yakamon/utils/tile/ItemInfo.java b/yakamon/src/main/java/fr/epita/assistants/yakamon/utils/tile/ItemInfo.java new file mode 100644 index 0000000..2d34bad --- /dev/null +++ b/yakamon/src/main/java/fr/epita/assistants/yakamon/utils/tile/ItemInfo.java @@ -0,0 +1,10 @@ +package fr.epita.assistants.yakamon.utils.tile; + +import lombok.Getter; + +@Getter +public class ItemInfo extends CollectibleInfo { + public ItemInfo(Character value) { + super(value); + } +} \ No newline at end of file diff --git a/yakamon/src/main/java/fr/epita/assistants/yakamon/utils/tile/ItemType.java b/yakamon/src/main/java/fr/epita/assistants/yakamon/utils/tile/ItemType.java new file mode 100644 index 0000000..40e0db8 --- /dev/null +++ b/yakamon/src/main/java/fr/epita/assistants/yakamon/utils/tile/ItemType.java @@ -0,0 +1,37 @@ +package fr.epita.assistants.yakamon.utils.tile; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.databind.JsonNode; +import lombok.AllArgsConstructor; + +@JsonFormat(shape = JsonFormat.Shape.OBJECT) +@AllArgsConstructor +public enum ItemType implements Collectible { + YAKABALL(new ItemInfo('Y')), + SCROOGE(new ItemInfo('S')), + NONE(new ItemInfo('N')); + + private final CollectibleInfo collectibleInfo; + + @Override + public CollectibleInfo getCollectibleInfo() { + return collectibleInfo; + } + + @Override + public CollectibleType getCollectibleType() { + return CollectibleType.ITEM; + } + + public String getValue() { + return name(); + } + + @JsonCreator + public static ItemType jsonCreator(JsonNode node) { + String value = node.get("value").asText(); + return ItemType.valueOf(value); + } +} + diff --git a/yakamon/src/main/java/fr/epita/assistants/yakamon/utils/tile/TerrainType.java b/yakamon/src/main/java/fr/epita/assistants/yakamon/utils/tile/TerrainType.java new file mode 100644 index 0000000..877e86f --- /dev/null +++ b/yakamon/src/main/java/fr/epita/assistants/yakamon/utils/tile/TerrainType.java @@ -0,0 +1,46 @@ +package fr.epita.assistants.yakamon.utils.tile; + +import fr.epita.assistants.yakamon.utils.ElementType; +import lombok.AllArgsConstructor; +import lombok.Getter; + +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Set; + +@AllArgsConstructor +@Getter +public enum TerrainType { + GRASS('G', true, Collections.EMPTY_SET), + MOUNTAIN('M', false, Set.of(ElementType.ROCK, ElementType.FLYING)), + ROCK('R', true, Collections.EMPTY_SET), + SAND('S', true, Collections.EMPTY_SET), + WATER('W', false, Set.of(ElementType.WATER, ElementType.FLYING)), + LAVA('L', false, Set.of(ElementType.FIRE, ElementType.FLYING)); + + private final Character value; + private final Boolean walkable; + private final Set compatibleType; + + private static final Map lookup; + + static { + lookup = new HashMap<>(); + for (TerrainType terrainType : TerrainType.values()) { + lookup.put(terrainType.value, terrainType); + } + } + + public static TerrainType getTerrain(Character c) { + return lookup.get(c); + } + + public boolean isWalkable() { + return walkable; + } + + public boolean isWalkable(ElementType element) { + return walkable || compatibleType.contains(element); + } +} diff --git a/yakamon/src/main/java/fr/epita/assistants/yakamon/utils/tile/TileType.java b/yakamon/src/main/java/fr/epita/assistants/yakamon/utils/tile/TileType.java new file mode 100644 index 0000000..e608c2c --- /dev/null +++ b/yakamon/src/main/java/fr/epita/assistants/yakamon/utils/tile/TileType.java @@ -0,0 +1,22 @@ +package fr.epita.assistants.yakamon.utils.tile; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.AllArgsConstructor; +import lombok.Data; + +@Data +@AllArgsConstructor +public class TileType { + + private TerrainType terrainType; + + private Collectible collectible; + + @JsonCreator + public TileType( + @JsonProperty("collectible") Collectible type + ) { + this.collectible = type; + } +} diff --git a/yakamon/src/main/java/fr/epita/assistants/yakamon/utils/tile/YakamonInfo.java b/yakamon/src/main/java/fr/epita/assistants/yakamon/utils/tile/YakamonInfo.java new file mode 100644 index 0000000..1e1a815 --- /dev/null +++ b/yakamon/src/main/java/fr/epita/assistants/yakamon/utils/tile/YakamonInfo.java @@ -0,0 +1,18 @@ +package fr.epita.assistants.yakamon.utils.tile; + +import lombok.Getter; + +@Getter +public class YakamonInfo extends CollectibleInfo { + + public YakamonInfo(Character value) { + super(value); + } + + private Integer yakadexId; + + public YakamonInfo withYakadexId(Integer id) { + this.yakadexId = id; + return this; + } +} diff --git a/yakamon/src/main/java/fr/epita/assistants/yakamon/utils/tile/YakamonType.java b/yakamon/src/main/java/fr/epita/assistants/yakamon/utils/tile/YakamonType.java new file mode 100644 index 0000000..c552903 --- /dev/null +++ b/yakamon/src/main/java/fr/epita/assistants/yakamon/utils/tile/YakamonType.java @@ -0,0 +1,48 @@ +package fr.epita.assistants.yakamon.utils.tile; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.databind.JsonNode; +import lombok.AllArgsConstructor; + +@JsonFormat(shape = JsonFormat.Shape.OBJECT) +@AllArgsConstructor +public enum YakamonType implements Collectible { + GROUVAN(new YakamonInfo('g').withYakadexId(13)), + GURVALIN(new YakamonInfo('v').withYakadexId(12)), + YAKOSHII(new YakamonInfo('i').withYakadexId(11)), + KOYAKO(new YakamonInfo('k').withYakadexId(10)), + NICOTALI(new YakamonInfo('n').withYakadexId(9)), + LUCARYON(new YakamonInfo('u').withYakadexId(8)), + LUCARYA(new YakamonInfo('l').withYakadexId(7)), + BASTIEDON(new YakamonInfo('b').withYakadexId(6)), + RAYQUAÏSSA(new YakamonInfo('r').withYakadexId(5)), + LOUICUNE(new YakamonInfo('o').withYakadexId(4)), + ACUMON(new YakamonInfo('a').withYakadexId(3)), + YACUMON(new YakamonInfo('c').withYakadexId(2)), + YAKIMON(new YakamonInfo('y').withYakadexId(1)); + + private final CollectibleInfo collectibleInfo; + + @Override + public CollectibleType getCollectibleType() { + return CollectibleType.YAKAMON; + } + + @Override + public String getValue() { + return name(); + } + + @JsonIgnore + @Override + public CollectibleInfo getCollectibleInfo() { + return collectibleInfo; + } + @JsonCreator + public static YakamonType jsonCreator(JsonNode node) { + String value = node.get("value").asText(); + return YakamonType.valueOf(value); + } +} diff --git a/yakamon/src/main/resources/application.properties b/yakamon/src/main/resources/application.properties new file mode 100644 index 0000000..0f78eac --- /dev/null +++ b/yakamon/src/main/resources/application.properties @@ -0,0 +1,13 @@ +%dev.quarkus.http.port=8081 +quarkus.datasource.db-kind=postgresql +quarkus.datasource.username=postgres +quarkus.datasource.jdbc.url=jdbc:postgresql://localhost:5432/yakamon?currentSchema=public +quarkus.transaction-manager.default-transaction-timeout=3000s +quarkus.hibernate-orm.log.queries-slower-than-ms=200 +quarkus.http.cors=true +quarkus.http.cors.origins=* +quarkus.hibernate-orm.database.generation=drop-and-create +quarkus.hibernate-orm.sql-load-script=db/init_db.sql + +quarkus.devservices.enabled=true +%test.quarkus.devservices.enabled=false \ No newline at end of file diff --git a/yakamon/src/main/resources/db/init_db.sql b/yakamon/src/main/resources/db/init_db.sql new file mode 100644 index 0000000..b93c56b --- /dev/null +++ b/yakamon/src/main/resources/db/init_db.sql @@ -0,0 +1,17 @@ +DELETE FROM yakadex_entry; + +INSERT INTO yakadex_entry (id, name, first_type, second_type, description, evolution_id, evolve_threshold, caught) +VALUES + (3, 'Acumon', 'STELLAR', null, 'Silent and distant, it drifts among the stars. Its light feels warm, yet no one knows what thoughts hide behind its glow.', null, null,false), + (2, 'Yacumon', 'FIRE', 'DARK', 'Hardened by its falls, it learned to smile even in the dark. Its flames burn quieter, but its will is sharper than ever.', 3, 8, false), + (1, 'Yakimon', 'FIRE', 'FAIRY', 'It runs anywhere without ever worrying, it may fall but always come backup, nothing seems to alter its joyful spirit.', 2, 2, false), + (4, 'Louicune', 'WATER', null, 'This mythical creature is the embodiment of the compassion of a pure spring of water, it is said it come on occasion to save desperate people drowning.', null, null, false), + (5, 'Rayquaïssa', 'DRAGON', 'FLYING', 'He is said to have lived for hundreds of millions of years. Legends remain of how it put to rest the clash between Kyogre and Grouvan.', null, null, false), + (6, 'Bastiedon', 'ROCK', 'STEEL', 'Steel-faced, unmovable Yakamon that looks defensive but is actually just stubborn, overthinking everything behind an indestructible wall of “I’ve got this.”', null, null, false), + (8, 'Lucaryon', 'FAIRY','POISON','She has mastered her aura to an even higher level, making her faster, stronger, and deadlier in battle.', null, null, false), + (7, 'Lucarya', 'FAIRY', null, 'She can sense and control aura, letting her anticipate her opponents’ moves.', 8, 78, false), + (9, 'Nicotali', 'DARK', null, 'Active only at night, Nicotali silently watches its surroundings.', null, null, false), + (11, 'Yakoshii', 'GRASS', 'PSYCHIC', 'A silent thread in nature''s loom, it turns the shadows into bloom.', null, null, false), + (10, 'Koyako', 'GRASS', null, 'Born from the forest''s gentle hum, it dreams beneath the morning sun.', 11, 6, false), + (13, 'Grouvan', 'GROUND', 'PSYCHIC', 'Quite friendly after all, he is eager to save people from despair.', null, null, false), + (12, 'Gurvalin', 'GROUND', null, 'Lost in this adventure, he is trying to find his way. He is not afraid of potential enemies.', 13, 15, false); \ No newline at end of file diff --git a/yakamon/src/main/resources/maps/debug.epimap b/yakamon/src/main/resources/maps/debug.epimap new file mode 100644 index 0000000..cbfe431 --- /dev/null +++ b/yakamon/src/main/resources/maps/debug.epimap @@ -0,0 +1,11 @@ +7GN7SN5WN +7GS7SS5RS +7GY7SY5RY +2GN1Gb1Gv1Gn1Gl1Go1Gr1Gy1Gk1Gb1Gv1Gn1Gl1Go1Gr1Gy1Gk1GN +9MN9GN1GN +9MN9WN1WN +9MN9WN2WN +9RN9WN1MN +9WN1WN2MN7WN +9WN9WN1WN +2WN1Wb1Wv1Wn1Wl1Wo1Wr1Wy1Wk1Wb1Wv1Wn1Wl1Wo1Wr1Wy1Wk1WN \ No newline at end of file diff --git a/yakamon/src/main/resources/maps/walkable.epimap b/yakamon/src/main/resources/maps/walkable.epimap new file mode 100644 index 0000000..0a24970 --- /dev/null +++ b/yakamon/src/main/resources/maps/walkable.epimap @@ -0,0 +1,11 @@ +9GN6RN6SN +9GN6RN6SN +9GN6RN6SN +9GN6RN6SN +9GN6RN6SN +9GN6RN6SN +9GN6RN6SN +9GN6RN6SN +9GN6RN6SN +9GN6RN6SN +9GN6RN6SN \ No newline at end of file diff --git a/yakamon/src/main/resources/maps/yakalos.epimap b/yakamon/src/main/resources/maps/yakalos.epimap new file mode 100644 index 0000000..a389d08 --- /dev/null +++ b/yakamon/src/main/resources/maps/yakalos.epimap @@ -0,0 +1,42 @@ +4GN2MN4GN3RN7GN1SN5MN1SN7GN1SN5WN1SN1GN +1Gy3GN2MN1GN1Go4GN1RN1RS5RN1GN1SN5MN1SN1GN4SN2GN7SN1GN +1GN1GS2GN2MN1GS3GN2MN1GY1RN4SN3RN8SN2WN1SN3GN1GS1SN2MN1SN2GN +4GN2MN4GN2MN1GN1RN1SN2WN3SN1RN2GN1RN3GN1SN3WN1SN1GN1Gk2GN1SN2MN1SN2GN +4GN2MN4GN2MN1GN1RN2SN3WN1SN2RN1GN2RN2GN5SN4GN1SN2MN1SN2GN +1RN8GN1GS4RN6SN3RN1Rl4RN8GN1SN2MN1SN2GN +1RN1GN7MN1GN4RN5MN1SN8RN1RY3SN3RN1GN1SN2MN1SN2GN +1RN1GN7MN1GN1RN2GN1SS5MN1SN1RN1SS7SN7RN1SN2MN1SN2GN +3RN2GN1Gv4GN1RN2GN1SN5MN9SN1Sk5SN2RN4SN2GN +2SN9RN2GN9SN1SS3SN3WN6SN5RN2GN +1WN1SN1RN5GN1RN7GN5SN9WN2SN6SN2RN2GN +1WN1SN2RN1GN2MN1GN1RN1GN2MN3GN4SN9WN1MN3WN3SN2MN1SN2RN1GS1GN +1WN1SN2RN1GN2MN1GN1RN1GN2MN1GY1GN1GS1SN9WN1MN2WN1MN5WN1SN2MN1SN2RN2GN +1WN1SN2RN1GN2MN1GN1RN1GN2MN3GN1SN8WN1MN2WN1MN6WN1SN2MN1SN1RN3GN +1WN1SN1RN1RS1GN2MN1GN1RN1GN2MN3GN1SN6WN3MN4WN5WN1SS2MN1SN1RN1GN1Gk1GN +1WN1SN2RN1GN2MN1GN1RN6GN1SN9WN1Wo1WN3MN4WN4SN1RN3GN +1WN1SN2RN1GN2MN1Gk1RN3GN2MN1GS2SN9WN1MN3WN1MN3WN2SN3RN3GN +1WN1SN2RN1GN2MN1GN1RN3GN2MN1GN2SN5WN2MN1WN1MN2WN1Mr1WN1MN3WN2SN3RN3GN +1WN1SN2RN1GN2MN1GY1RN1GN4MN1GN1SN1SS7WN1MN5WN1MN3WN2SN2RN1RS3GN +1WN1SN1RS1RN1GN2MN1Gv1RN1GN4MN1GN3SN6WN1MN2WN1WN2MN4WN2SN1RN1GN2MN2GN +1WN1SN2RN1GN2MN1GN1RS6GN3SN6WN4MN6WN2SN1RY1GN2MN2GN +1WN1SN1RN1Rl1GN2MN1GN1RN4SN3GN3SN9WN6WN2SN1RN1GS2MN2GN +1WN1SN2RN4GN1RY1SN2MN1SN3GN1Gv2SN9WN5WN3SN1RN1GN2MN2GN +1WN1SN7RN1SN2MN1SN4GN1SN2WN4SN2WN4SN1Sl4SN1SS1RN1GN2MN2GN +1WN1SN3RN1Rn3RN1SN2MN1SN4GN1SN2WN1SN1Sv2SN2WN3SN3GN3SN3RN4GN +1WN1SN7RN1SN2MN1SN1GS3GN1SN2WN3SN2WN1SN6GN1SN1WN4SN1RN1GN1Gv1GN +1WN1SN1RN5SN1RN1SN2MN1SN3GN2SN2WN2SN2WN2SN6GN1SN4WN1SN1RN1GS2GN +1WN3SN3WN1SN1RN6SN1SY1SN2WN2SN1SS2WN1SN7GN6SN1RN3GN +1WN2SN4WN6SN2WN2SN3WN2SN2WN1SN9GN4GN1RN3GN +1WN2SN3WN8SN1WN6SN3WN1SN1GY2GN1RN1GS9RN1RN2GN +1WN2SN2WN4SN4MN8SN2WN1SN2GN4RN3MN2RN1Gb6GN +1WN6SN1SS1SN4MN3SN1WN4SN2WN1SN1GN1Rl4RN3MN9RN +1WN6SN1Sl1SN4MN3SN3WN2SN2WN1SN1GN4RN4LN4LN2RN2MN1RN +1WN8SN4MN3SN4WN1SN2WN1SN1GN1RN2MN9LN1Ly1LN2MN1RN +1WN1SN1WN9SN1SS4SN3WN1SN3WN1SN1RN2MN4LN1Ly4LN2LN2MN1RN +1WN1SN2WN7SN1SY1SN2RN6SN3WN1SN1RS2MN9LN2LN2MN1RN +1WN2SN2WN4SN3WN2SN3RN1Rb2RN1SN2WN2SN1RN2MN9LN2LN2MN1RN +1WN1SN4WN1SN1GS2SN3WN2SN5RN1SY2WN1SN1GN1RN2MN9LN1Ly1LN2MN1RN +1WN1SN4WN1SN2GN2SN3WN7SN1WN1SN2GN1Rn2MN5LN6LN2MN1RN +1WN1SN4WN1SN3GN3SN1WN1SN5MN1SN1WN1SN1GN2MN7LN6LN2MN1RN +1WN2SN2WN1SN6GN3SN5MN1SN1WN1SN1GN2MN2LN9MN2LN2MN1RN +1WN5SN8GN7SN1WN2SN2MN2LN9MN2LN2MN1RN diff --git a/yakamon/src/main/resources/openapi.yaml b/yakamon/src/main/resources/openapi.yaml new file mode 100644 index 0000000..43400c2 --- /dev/null +++ b/yakamon/src/main/resources/openapi.yaml @@ -0,0 +1,537 @@ +--- +openapi: 3.1.0 +tags: + - name: Game + - name: Inventory + - name: Player + - name: Team + - name: Yakadex +components: + schemas: + CollectResponse: + type: object + properties: + tileType: + $ref: "#/components/schemas/TileType" + Collectible: + type: object + properties: + type: + $ref: "#/components/schemas/CollectibleType" + value: + type: string + CollectibleType: + type: string + enum: + - ITEM + - YAKAMON + Direction: + type: string + enum: + - UP + - RIGHT + - DOWN + - LEFT + ElementType: + type: string + enum: + - BUG + - DARK + - ELECTRIC + - FAIRY + - FIGHTING + - FIRE + - FLYING + - GHOST + - GRASS + - GROUND + - ICE + - NORMAL + - POISON + - PSYCHIC + - ROCK + - STEEL + - WATER + - DRAGON + - STELLAR + FeedRequest: + type: object + properties: + quantity: + type: integer + format: int32 + InventoryResponse: + type: object + properties: + items: + type: array + items: + $ref: "#/components/schemas/Item" + Item: + type: object + properties: + itemType: + $ref: "#/components/schemas/ItemType" + quantity: + type: integer + format: int32 + ItemType: + type: object + properties: + type: + type: string + enum: + - ITEM + value: + type: string + enum: + - YAKABALL + - SCROOGE + - NONE + LocalDateTime: + type: string + format: date-time + examples: + - 2022-03-10T12:15:50 + MoveRequest: + type: object + properties: + direction: + $ref: "#/components/schemas/Direction" + MoveResponse: + type: object + properties: + posX: + type: integer + format: int32 + posY: + type: integer + format: int32 + PlayerResponse: + type: object + properties: + uuid: + $ref: "#/components/schemas/UUID" + name: + type: string + posX: + type: integer + format: int32 + posY: + type: integer + format: int32 + lastMove: + $ref: "#/components/schemas/LocalDateTime" + lastCollect: + $ref: "#/components/schemas/LocalDateTime" + lastCatch: + $ref: "#/components/schemas/LocalDateTime" + lastFeed: + $ref: "#/components/schemas/LocalDateTime" + RenameRequest: + type: object + properties: + newNickname: + type: string + StartRequest: + type: object + properties: + mapPath: + type: string + playerName: + type: string + StartResponse: + type: object + properties: + tiles: + type: array + items: + type: array + items: + $ref: "#/components/schemas/TileType" + TerrainType: + type: string + enum: + - GRASS + - MOUNTAIN + - ROCK + - SAND + - WATER + - LAVA + TileType: + type: object + properties: + terrainType: + $ref: "#/components/schemas/TerrainType" + collectible: + $ref: "#/components/schemas/Collectible" + UUID: + type: string + format: uuid + pattern: "[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}" + YakadexEntryResponse: + type: object + properties: + id: + type: integer + format: int32 + name: + type: string + firstType: + $ref: "#/components/schemas/ElementType" + secondType: + $ref: "#/components/schemas/ElementType" + evolveThreshold: + type: integer + format: int32 + evolutionId: + type: integer + format: int32 + caught: + type: boolean + description: + type: string + YakadexResponse: + type: object + properties: + entries: + type: array + items: + $ref: "#/components/schemas/YakadexEntryResponse" + YakamonResponse: + type: object + properties: + uuid: + $ref: "#/components/schemas/UUID" + nickname: + type: string + yakadexId: + type: integer + format: int32 + energyPoints: + type: integer + format: int32 + YakamonTeamResponse: + type: object + properties: + yakamons: + type: array + items: + $ref: "#/components/schemas/YakamonResponse" +paths: + /catch: + post: + summary: Catch Yakamon + description: Attempt to catch a Yakamon at the player's current position. + tags: + - Player + responses: + "200": + description: Yakamon successfully caught. + content: + application/json: + schema: + $ref: "#/components/schemas/YakamonResponse" + "400": + description: "No Yakamon at the current position, not enough Yakaballs,\ + \ team is full or the game is not running." + "429": + description: Player has recently caught a yakamon and must wait. + servers: + - url: http://localhost:8081 + /collect: + post: + summary: Collect resources + description: |- + Collect the available resource on the player's current tile and sends back + the updated tile. The player **must** not have collected too recently. + You **must** send back the updated tile. + tags: + - Player + responses: + "200": + description: Resource successfully collected into the inventory. + content: + application/json: + schema: + $ref: "#/components/schemas/CollectResponse" + "400": + description: Invalid tile or the game is not running. + "429": + description: Player has recently collected and must wait before collecting + again. + servers: + - url: http://localhost:8081 + /inventory: + get: + summary: Retrieve all information about the player's inventory + description: Fetch all available items in the player's inventory. + tags: + - Inventory + responses: + "200": + description: Inventory successfully retrieved. + content: + application/json: + schema: + $ref: "#/components/schemas/InventoryResponse" + "400": + description: The game is not running. + servers: + - url: http://localhost:8081 + /move: + post: + summary: Move player + description: "Move the player in the specified direction (left, right, up, or\ + \ down). The requested direction **must** be valid and the player **must**\ + \ not have moved too recently." + tags: + - Player + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/MoveRequest" + required: true + responses: + "200": + description: Player successfully moved. + content: + application/json: + schema: + $ref: "#/components/schemas/MoveResponse" + "400": + description: Invalid direction or the game is not running. + "429": + description: Player has recently moved and must wait before moving again. + servers: + - url: http://localhost:8081 + /player: + get: + summary: Retrieve player information + description: Fetch information about the current player. + tags: + - Player + responses: + "200": + description: Player information successfully retrieved. + content: + application/json: + schema: + $ref: "#/components/schemas/PlayerResponse" + "400": + description: The game is not running. + servers: + - url: http://localhost:8081 + /start: + post: + summary: Start the game + description: Clear all the database tables. Initialize and start the game. + tags: + - Game + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/StartRequest" + required: true + responses: + "200": + description: The game started successfully. + content: + application/json: + schema: + $ref: "#/components/schemas/StartResponse" + "400": + description: Invalid `path` or invalid `name` provided. + servers: + - url: http://localhost:8081 + /team: + get: + summary: Retrieve the yakamons in the player's team + description: Fetch all yakamons currently in the player's team. + tags: + - Team + responses: + "200": + description: Player's team successfully retrieved. + content: + application/json: + schema: + $ref: "#/components/schemas/YakamonTeamResponse" + "400": + description: The game is not running. + servers: + - url: http://localhost:8081 + /team/{uuid}/evolve: + post: + summary: Evolve a yakamon from the player's team + description: Evolve a yakamon from the player's team. The yakamon **must** have + enough energy points to evolve to the next form. + tags: + - Team + parameters: + - name: uuid + in: path + required: true + schema: + $ref: "#/components/schemas/UUID" + responses: + "200": + description: Yakamon successfully evolved. + content: + application/json: + schema: + $ref: "#/components/schemas/YakamonResponse" + "400": + description: The game is not running or the yakamon needs more energy points + to evolve. + "404": + description: The yakamon was not found in the team or reached its maximum + evolution tier. + servers: + - url: http://localhost:8081 + /team/{uuid}/feed: + post: + summary: Feed a yakamon in the player's team + description: Feed a yakamon in the player's team. The player **must** have enough + ``Scrooge`` in his inventory. + tags: + - Team + parameters: + - name: uuid + in: path + required: true + schema: + $ref: "#/components/schemas/UUID" + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/FeedRequest" + required: true + responses: + "200": + description: Yakamon successfully fed. + content: + application/json: + schema: + $ref: "#/components/schemas/YakamonResponse" + "400": + description: "Not enough Scrooge, invalid amount (.i.e <= 0) or the game\ + \ is not running." + "404": + description: The yakamon was not found in the team. + "429": + description: Player has recently fed a yakamon and must wait before feed + one again. + servers: + - url: http://localhost:8081 + /team/{uuid}/release: + delete: + summary: Release a yakamon into the wild + description: Remove a yakamon from the player's team. + tags: + - Team + parameters: + - name: uuid + in: path + required: true + schema: + $ref: "#/components/schemas/UUID" + responses: + "204": + description: Yakamon successfully released. + "400": + description: The game is not running. + "403": + description: The player cannot release the last yakamon that can walk on + the player's current tile. + "404": + description: The yakamon was not found in the team. + servers: + - url: http://localhost:8081 + /team/{uuid}/rename: + patch: + summary: Rename a yakamon in the player's team + description: Change the nickname of a yakamon in the player's team. The nickname + **must** not be blank nor null and its length **must** be less or equal to + 20 characters. + tags: + - Team + parameters: + - name: uuid + in: path + required: true + schema: + $ref: "#/components/schemas/UUID" + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/RenameRequest" + required: true + responses: + "200": + description: The updated yakamon. + content: + application/json: + schema: + $ref: "#/components/schemas/YakamonResponse" + "400": + description: The game is not running or the new nickname is invalid. + "404": + description: The yakamon was not found. + servers: + - url: http://localhost:8081 + /yakadex: + get: + summary: Retrieve all information about yakamon + description: Fetch information about every yakamon available in the game. + tags: + - Yakadex + parameters: + - name: only_missing + in: query + schema: + type: boolean + responses: + "200": + description: Yakadex successfully retrieved. + content: + application/json: + schema: + $ref: "#/components/schemas/YakadexResponse" + "400": + description: The game is not running. + servers: + - url: http://localhost:8081 + /yakadex/{id}: + get: + summary: Retrieve all information about a yakamon + description: Fetch all information about the yakamon with the specified ID. + tags: + - Yakadex + parameters: + - name: id + in: path + required: true + schema: + type: integer + format: int32 + responses: + "200": + description: Yakamon successfully retrieved. + content: + application/json: + schema: + $ref: "#/components/schemas/YakadexEntryResponse" + "400": + description: The game is not running. + "404": + description: This yakamon does not exist. + servers: + - url: http://localhost:8081 +info: + title: yakamon API + version: 1.0.0