From ec92cac2e7a866019f18688357240330b5c9bf77 Mon Sep 17 00:00:00 2001 From: moonleay Date: Thu, 18 Jan 2024 18:34:11 +0100 Subject: [PATCH] feat!: completely rewrote API code to use KotlinXSerialization instead of pasing it manually (WTF was I thinking when I did that??) Signed-off-by: moonleay --- .../lilJudd/data/api/liljudd/LilJuddApi.kt | 36 -- .../data/api/splatoon3ink/Splatoon3Api.kt | 105 +--- .../api/splatoon3ink/Splatoon3ApiCache.kt | 577 ------------------ .../splatoon3ink/Splatoon3ApiDataGrabber.kt | 129 ++++ .../splatoon3ink/entry/coop/CoopGearData.kt | 28 - .../entry/splatfest/SplatfestTeamData.kt | 25 - .../entry/splatfest/SplatfestTeamResults.kt | 33 - .../entry/splatnet/SplatnetItemData.kt | 32 - .../schedules/BankaraMatchSetting.kt | 37 ++ .../api/splatoon3ink/schedules/BankaraNode.kt | 35 ++ .../schedules/BankaraSchedules.kt | 29 + .../schedules/BigRunScheduleNode.kt | 35 ++ .../splatoon3ink/schedules/BigRunSchedules.kt | 29 + .../data/api/splatoon3ink/schedules/Boss.kt | 31 + .../SplatfestColor.kt => schedules/Color.kt} | 17 +- .../schedules/CoopGroupingSchedule.kt | 35 ++ .../api/splatoon3ink/schedules/CoopStage.kt | 35 ++ .../api/splatoon3ink/schedules/CurrentFest.kt | 43 ++ .../splatoon3ink/schedules/CurrentPlayer.kt | 29 + .../api/splatoon3ink/schedules/EventNode.kt | 31 + .../splatoon3ink/schedules/EventSchedules.kt | 29 + .../schedules/FestMatchSettingX.kt | 35 ++ .../schedules/FestMatchSettingXX.kt | 28 + .../ShiftData.kt => schedules/FestNode.kt} | 25 +- .../splatoon3ink/schedules/FestSchedules.kt | 29 + .../WeaponData.kt => schedules/Image.kt} | 15 +- .../LeagueMatchEvent.kt} | 29 +- .../schedules/LeagueMatchSetting.kt | 37 ++ .../api/splatoon3ink/schedules/MapNode.kt | 37 ++ .../OriginalImage.kt} | 17 +- .../schedules/RegularMatchSetting.kt | 35 ++ .../api/splatoon3ink/schedules/RegularNode.kt | 35 ++ .../schedules/RegularSchedules.kt | 29 + .../schedules/RegularSchedulesX.kt | 29 + .../api/splatoon3ink/schedules/Schedules.kt | 29 + .../splatoon3ink/schedules/SchedulesData.kt | 45 ++ .../api/splatoon3ink/schedules/Setting.kt | 37 ++ .../data/api/splatoon3ink/schedules/Team.kt | 33 + .../schedules/TeamContestSchedules.kt | 30 + .../ThumbnailImage.kt} | 16 +- .../TimePeriod.kt} | 15 +- .../TricolorStage.kt} | 24 +- .../MapData.kt => schedules/UserIcon.kt} | 16 +- .../data/api/splatoon3ink/schedules/VsRule.kt | 33 + .../api/splatoon3ink/schedules/VsStage.kt | 35 ++ .../api/splatoon3ink/schedules/VsStages.kt | 29 + .../data/api/splatoon3ink/schedules/Weapon.kt | 33 + .../splatoon3ink/schedules/XMatchSetting.kt | 35 ++ .../ModeData.kt => schedules/XNode.kt} | 25 +- .../api/splatoon3ink/schedules/XSchedules.kt | 29 + .../data/api/splatoon3ink/type/ApiDataType.kt | 27 - .../api/splatoon3ink/type/ApiRequestType.kt | 26 - 52 files changed, 1319 insertions(+), 958 deletions(-) delete mode 100644 src/main/kotlin/net/moonleay/lilJudd/data/api/liljudd/LilJuddApi.kt delete mode 100644 src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/Splatoon3ApiCache.kt create mode 100644 src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/Splatoon3ApiDataGrabber.kt delete mode 100644 src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/entry/coop/CoopGearData.kt delete mode 100644 src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/entry/splatfest/SplatfestTeamData.kt delete mode 100644 src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/entry/splatfest/SplatfestTeamResults.kt delete mode 100644 src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/entry/splatnet/SplatnetItemData.kt create mode 100644 src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/BankaraMatchSetting.kt create mode 100644 src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/BankaraNode.kt create mode 100644 src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/BankaraSchedules.kt create mode 100644 src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/BigRunScheduleNode.kt create mode 100644 src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/BigRunSchedules.kt create mode 100644 src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/Boss.kt rename src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/{entry/splatfest/SplatfestColor.kt => schedules/Color.kt} (70%) create mode 100644 src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/CoopGroupingSchedule.kt create mode 100644 src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/CoopStage.kt create mode 100644 src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/CurrentFest.kt create mode 100644 src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/CurrentPlayer.kt create mode 100644 src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/EventNode.kt create mode 100644 src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/EventSchedules.kt create mode 100644 src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/FestMatchSettingX.kt create mode 100644 src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/FestMatchSettingXX.kt rename src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/{entry/schedule/ShiftData.kt => schedules/FestNode.kt} (61%) create mode 100644 src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/FestSchedules.kt rename src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/{entry/schedule/WeaponData.kt => schedules/Image.kt} (72%) rename src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/{entry/schedule/ChallengeModeData.kt => schedules/LeagueMatchEvent.kt} (61%) create mode 100644 src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/LeagueMatchSetting.kt create mode 100644 src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/MapNode.kt rename src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/{entry/splatnet/BrandData.kt => schedules/OriginalImage.kt} (72%) create mode 100644 src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/RegularMatchSetting.kt create mode 100644 src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/RegularNode.kt create mode 100644 src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/RegularSchedules.kt create mode 100644 src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/RegularSchedulesX.kt create mode 100644 src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/Schedules.kt create mode 100644 src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/SchedulesData.kt create mode 100644 src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/Setting.kt create mode 100644 src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/Team.kt create mode 100644 src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/TeamContestSchedules.kt rename src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/{entry/splatnet/GearAbilityData.kt => schedules/ThumbnailImage.kt} (72%) rename src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/{entry/schedule/TimePeriodData.kt => schedules/TimePeriod.kt} (70%) rename src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/{entry/splatfest/SplatfestData.kt => schedules/TricolorStage.kt} (64%) rename src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/{entry/schedule/MapData.kt => schedules/UserIcon.kt} (72%) create mode 100644 src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/VsRule.kt create mode 100644 src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/VsStage.kt create mode 100644 src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/VsStages.kt create mode 100644 src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/Weapon.kt create mode 100644 src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/XMatchSetting.kt rename src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/{entry/schedule/ModeData.kt => schedules/XNode.kt} (57%) create mode 100644 src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/XSchedules.kt delete mode 100644 src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/type/ApiDataType.kt delete mode 100644 src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/type/ApiRequestType.kt diff --git a/src/main/kotlin/net/moonleay/lilJudd/data/api/liljudd/LilJuddApi.kt b/src/main/kotlin/net/moonleay/lilJudd/data/api/liljudd/LilJuddApi.kt deleted file mode 100644 index d6379fa..0000000 --- a/src/main/kotlin/net/moonleay/lilJudd/data/api/liljudd/LilJuddApi.kt +++ /dev/null @@ -1,36 +0,0 @@ -/* - * lilJudd - * Copyright (C) 2024 moonleay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package net.moonleay.lilJudd.data.api.liljudd - -import net.moonleay.lilJudd.data.CredentialManager - -object LilJuddApi { - val CONFIG_BASE = "${CredentialManager.apiDomain}/config/" - val MATCH_BASE = "${CredentialManager.apiDomain}/match/" - val TIMEPLANNINGMESSAGES_BASE = "${CredentialManager.apiDomain}/tp_messages/" - - // GET https://liljudd.ink/api/config// - // DELETE https://liljudd.ink/api/config// - // GET https://liljudd.ink/api/tp_messages// - // PUT https://liljudd.ink/api/tp_messages// - // POST https://liljudd.ink/api/match/// - // PUT https://liljudd.ink/api/match//// - // GET https://liljudd.ink/api/match// - -} diff --git a/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/Splatoon3Api.kt b/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/Splatoon3Api.kt index 8f097c3..bce9a62 100644 --- a/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/Splatoon3Api.kt +++ b/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/Splatoon3Api.kt @@ -1,6 +1,6 @@ /* * lilJudd - * Copyright (C) 2023 moonleay + * Copyright (C) 2024 moonleay * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -18,98 +18,21 @@ package net.moonleay.lilJudd.data.api.splatoon3ink -import net.moonleay.lilJudd.data.api.splatoon3ink.entry.schedule.ModeData -import net.moonleay.lilJudd.util.TimeUtil +import kotlinx.serialization.json.Json +import net.moonleay.lilJudd.data.api.splatoon3ink.schedules.Schedules +import net.moonleay.lilJudd.util.NetUtil +import net.moonleay.liljudd.build.BuildConstants object Splatoon3Api { - private fun getRegularMode(timestamp: Long): ModeData { - Splatoon3ApiCache.cachedRegularModeData.map { modeData -> - val startTime = TimeUtil.deformatJSONTime(modeData.startTime, "UTC") - val endTime = TimeUtil.deformatJSONTime(modeData.endTime, "UTC") - if (timestamp in startTime..endTime) { - return modeData - } + + var schedules: net.moonleay.lilJudd.data.api.splatoon3ink.schedules.Schedules? = null + + fun updateSchedule() { + val response = NetUtil.GETJsonData("https://splatoon3.ink/data/schedules.json", "lilJudd/${BuildConstants.version}") + if (response.startsWith("error")){ + println("Error: $response") + return } - throw Exception("No current mode found") - } - - private fun getOpenMode(timestamp: Long): ModeData { - Splatoon3ApiCache.cachedCompetitiveOpenModeData.map { modeData -> - val startTime = TimeUtil.deformatJSONTime(modeData.startTime, "UTC") - val endTime = TimeUtil.deformatJSONTime(modeData.endTime, "UTC") - if (timestamp in startTime..endTime) { - return modeData - } - } - throw Exception("No current mode found") - } - - private fun getXMode(timestamp: Long): ModeData { - Splatoon3ApiCache.cachedXModeData.map { modeData -> - val startTime = TimeUtil.deformatJSONTime(modeData.startTime, "UTC") - val endTime = TimeUtil.deformatJSONTime(modeData.endTime, "UTC") - if (timestamp in startTime..endTime) { - return modeData - } - } - throw Exception("No current mode found") - } - - private fun getSeriesMode(timestamp: Long): ModeData { - Splatoon3ApiCache.cachedCompetitiveSeriesModeData.map { modeData -> - val startTime = TimeUtil.deformatJSONTime(modeData.startTime, "UTC") - val endTime = TimeUtil.deformatJSONTime(modeData.endTime, "UTC") - if (timestamp in startTime..endTime) { - return modeData - } - } - throw Exception("No current mode found") - } - - fun getRotationTime(timestamp: Long): String { - val modeData = getRegularMode(timestamp) - val endTime = TimeUtil.deformatJSONTime(modeData.endTime, "UTC") - val diffStamp = TimeUtil.getTimeDifferenceFormatted(System.currentTimeMillis(), endTime) - return "$diffStamp left in rotation" - } - - fun getRegularMapsFormatted(timestamp: Long): String { - val modeData = getRegularMode(timestamp) - val map1 = modeData.map1!!.name.split(" ")[0] - val map2 = modeData.map2!!.name.split(" ")[0] - return "R: $map1, $map2" - } - - fun getOpenMapFormatted(timestamp: Long): String { - val modeData = getOpenMode(timestamp) - val map1 = modeData.map1!!.name.split(" ")[0] - val map2 = modeData.map2!!.name.split(" ")[0] - return "O: ${modeData.ruleSetName}: $map1, $map2" - .replace("Rainmaker", "RMK") - .replace("Tower Control", "TC") - .replace("Splat Zones", "SZ") - .replace("Clam Blitz", "CB") - } - - fun getSeriesMapsFormatted(timestamp: Long): String { - val modeData = getSeriesMode(timestamp) - val map1 = modeData.map1!!.name.split(" ")[0] - val map2 = modeData.map2!!.name.split(" ")[0] - return "S: ${modeData.ruleSetName}: $map1, $map2" - .replace("Rainmaker", "RMK") - .replace("Tower Control", "TC") - .replace("Splat Zones", "SZ") - .replace("Clam Blitz", "CB") - } - - fun getXMapFormatted(timestamp: Long): String { - val modeData = getXMode(timestamp) - val map1 = modeData.map1!!.name.split(" ")[0] - val map2 = modeData.map2!!.name.split(" ")[0] - return "X: ${modeData.ruleSetName}: $map1, $map2" - .replace("Rainmaker", "RMK") - .replace("Tower Control", "TC") - .replace("Splat Zones", "SZ") - .replace("Clam Blitz", "CB") + schedules = Json.decodeFromString(response) } } diff --git a/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/Splatoon3ApiCache.kt b/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/Splatoon3ApiCache.kt deleted file mode 100644 index 30a9129..0000000 --- a/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/Splatoon3ApiCache.kt +++ /dev/null @@ -1,577 +0,0 @@ -/* - * lilJudd - * Copyright (C) 2023 moonleay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package net.moonleay.lilJudd.data.api.splatoon3ink - -import io.ktor.http.* -import kotlinx.serialization.json.* -import net.moonleay.lilJudd.data.api.splatoon3ink.entry.coop.CoopGearData -import net.moonleay.lilJudd.data.api.splatoon3ink.entry.schedule.* -import net.moonleay.lilJudd.data.api.splatoon3ink.entry.splatfest.SplatfestColor -import net.moonleay.lilJudd.data.api.splatoon3ink.entry.splatfest.SplatfestData -import net.moonleay.lilJudd.data.api.splatoon3ink.entry.splatfest.SplatfestTeamData -import net.moonleay.lilJudd.data.api.splatoon3ink.entry.splatfest.SplatfestTeamResults -import net.moonleay.lilJudd.data.api.splatoon3ink.entry.splatnet.BrandData -import net.moonleay.lilJudd.data.api.splatoon3ink.entry.splatnet.GearAbilityData -import net.moonleay.lilJudd.data.api.splatoon3ink.entry.splatnet.SplatnetItemData -import net.moonleay.lilJudd.data.api.splatoon3ink.type.ApiDataType -import net.moonleay.lilJudd.data.api.splatoon3ink.type.ApiRequestType -import net.moonleay.lilJudd.util.Logger -import net.moonleay.lilJudd.util.NetUtil -import net.moonleay.liljudd.build.BuildConstants - -object Splatoon3ApiCache { - private val user_agent = - "lilJudd/${BuildConstants.version} (${System.getProperty("os.name")}/${System.getProperty("os.version")}) [contact@moonleay.net]" - private val base_url = "https://splatoon3.ink/data/" // Thank god there is an API - - internal var cachedSplatfestData = mutableListOf() - internal var cachedMapData = mutableMapOf() - internal var cachedRegularModeData = mutableListOf() - internal var cachedCompetitiveSeriesModeData = mutableListOf() - internal var cachedCompetitiveOpenModeData = mutableListOf() - internal var cachedXModeData = mutableListOf() - internal var cachedChallengesData = mutableListOf() - internal var cachedShiftData = mutableListOf() - internal var cachedBigRunShiftData = mutableListOf() - internal var cachedCoopRewardsData = - mutableListOf() - internal var cachedSplatnetItemData = mutableListOf() - internal var cachedSplatnetLimitedItemData = mutableListOf() - internal lateinit var splatnetShopBrandData: BrandData - internal lateinit var splatnetShopNextBrandData: BrandData - fun updateData(dataType: ApiDataType, requestType: ApiRequestType) { - Logger.out("Updating data for $dataType with USER-AGENT: ${user_agent}") - Logger.out("Reason for update: $requestType") - when (dataType) { - ApiDataType.SCHEDULES -> { - updateScheduleCache(user_agent) - } - - ApiDataType.SPLATNETGEAR -> { - updateSplatnetGearCache(user_agent) - } - - ApiDataType.COOP -> { - updateCOOPCache(user_agent) - } - - ApiDataType.SPLATFESTS -> { - updateSplatfestCache(user_agent) - } - - ApiDataType.ALL -> { - updateScheduleCache(user_agent) - updateSplatnetGearCache(user_agent) - updateSplatfestCache(user_agent) - updateCOOPCache(user_agent) - } - } - Logger.out("Finished updating data for $dataType") - } - - private fun updateSplatnetGearCache(uag: String) { - val apiResponse = NetUtil.GETJsonData("${base_url}gear.json", uag) - if (apiResponse.startsWith("Error")) { - Logger.out("Error getting splatnet data: $apiResponse") - return - } - val json = Json.parseToJsonElement(apiResponse) - val pickupBrandData = json.jsonObject["data"]!!.jsonObject["gesotown"]!!.jsonObject["pickupBrand"]!!.jsonObject - - val brand = pickupBrandData["brand"]!!.jsonObject - splatnetShopBrandData = - BrandData( - brand["name"]!!.jsonPrimitive.content, - Url(pickupBrandData["image"]!!.jsonObject["url"]!!.jsonPrimitive.content), - GearAbilityData( - brand["usualGearPower"]!!.jsonObject["name"]!!.jsonPrimitive.content, - brand["usualGearPower"]!!.jsonObject["desc"]!!.jsonPrimitive.content, - Url(brand["usualGearPower"]!!.jsonObject["image"]!!.jsonObject["url"]!!.jsonPrimitive.content) - ), - pickupBrandData["saleEndTime"]!!.jsonPrimitive.content - ) - val nextBrand = pickupBrandData["nextBrand"]!!.jsonObject - splatnetShopNextBrandData = - BrandData( - nextBrand["name"]!!.jsonPrimitive.content, - Url(pickupBrandData["image"]!!.jsonObject["url"]!!.jsonPrimitive.content), - null, - null - ) - cachedSplatnetItemData = mutableListOf() - val items = pickupBrandData["brandGears"]!!.jsonArray - items.forEach { - val obj = it as JsonObject - val gear = it["gear"]!!.jsonObject - val primaryGearPower = gear["primaryGearPower"]!!.jsonObject - val additionalGearPowers = gear["additionalGearPowers"]!!.jsonArray - val additionalGearPowersList = mutableListOf() - additionalGearPowers.forEach { - val ob = it as JsonObject - additionalGearPowersList.add( - GearAbilityData( - ob["name"]!!.jsonPrimitive.content, - null, - Url(ob["image"]!!.jsonObject["url"]!!.jsonPrimitive.content) - ) - ) - } - cachedSplatnetItemData.add( - SplatnetItemData( - obj["saleEndTime"]!!.jsonPrimitive.content, - obj["price"]!!.jsonPrimitive.int, - gear["__typename"]!!.jsonPrimitive.content, - gear["name"]!!.jsonPrimitive.content, - GearAbilityData( - primaryGearPower["name"]!!.jsonPrimitive.content, - null, - Url(primaryGearPower["image"]!!.jsonObject["url"]!!.jsonPrimitive.content) - ), - additionalGearPowersList, - Url(gear["image"]!!.jsonObject["url"]!!.jsonPrimitive.content), - splatnetShopBrandData - ) - ) - } - Logger.out("Updated gear data") - - val limitedItemData = json.jsonObject["data"]!!.jsonObject["gesotown"]!!.jsonObject["limitedGears"]!!.jsonArray - cachedSplatnetLimitedItemData = mutableListOf() - limitedItemData.forEach { - val obj = it as JsonObject - val gear = obj["gear"]!!.jsonObject - val additionalGearPowers = gear["additionalGearPowers"]!!.jsonArray - val additionalGearPowersList = mutableListOf() - additionalGearPowers.forEach { - val ob = it as JsonObject - additionalGearPowersList.add( - GearAbilityData( - ob["name"]!!.jsonPrimitive.content, - null, - Url(ob["image"]!!.jsonObject["url"]!!.jsonPrimitive.content) - ) - ) - } - cachedSplatnetLimitedItemData.add( - SplatnetItemData( - obj["saleEndTime"]!!.jsonPrimitive.content, - obj["price"]!!.jsonPrimitive.int, - gear["__typename"]!!.jsonPrimitive.content, - gear["name"]!!.jsonPrimitive.content, - GearAbilityData( - gear["primaryGearPower"]!!.jsonObject["name"]!!.jsonPrimitive.content, - null, - Url(gear["primaryGearPower"]!!.jsonObject["image"]!!.jsonObject["url"]!!.jsonPrimitive.content) - ), - additionalGearPowersList, - Url(gear["image"]!!.jsonObject["url"]!!.jsonPrimitive.content), - splatnetShopBrandData - ) - ) - } - } - - private fun updateCOOPCache(uag: String) { - val apiResponse = NetUtil.GETJsonData("${base_url}coop.json", uag) - if (apiResponse.startsWith("Error")) { - Logger.out("Error getting coop data: $apiResponse") - return - } - try { - val json = Json.parseToJsonElement(apiResponse) - val data = json.jsonObject["data"]!!.jsonObject["coopResult"]!!.jsonObject["monthlyGear"]!!.jsonObject - cachedCoopRewardsData = mutableListOf() - cachedCoopRewardsData.add( - CoopGearData( - data["name"]!!.jsonPrimitive.content, - Url(data["image"]!!.jsonObject["url"]!!.jsonPrimitive.content), - data["__typename"]!!.jsonPrimitive.content - ) - ) - Logger.out("Updated COOP data") - } catch (e: Exception) { - Logger.out("Error getting coop data: ${e.cause}") - } - } - - private fun updateScheduleCache(uag: String) { - val apiResponse = NetUtil.GETJsonData("${base_url}schedules.json", uag) - if (apiResponse.startsWith("Error")) { - Logger.out("Error getting schedule data: $apiResponse") - return - } - val json = Json.decodeFromString(apiResponse) as JsonObject - val data = json["data"]!!.jsonObject - - try { - val mapList = data["vsStages"]!!.jsonObject["nodes"]!!.jsonArray - cachedMapData = mutableMapOf() - mapList.forEach { - val obj = it as JsonObject - val imageURL = Url(obj.jsonObject["originalImage"]!!.jsonObject["url"]!!.jsonPrimitive.content) - val id = obj.jsonObject["vsStageId"]!!.jsonPrimitive.int - cachedMapData[id] = - MapData( - id, - imageURL, - it.jsonObject["name"]!!.jsonPrimitive.content - ) - } - Logger.out("Updated maplist data") - } catch (e: Exception) { - Logger.out("Error getting maplist data: ${e.cause}") - } - - try { - val regularMatches = data["regularSchedules"]!!.jsonObject["nodes"]!!.jsonArray - cachedRegularModeData = mutableListOf() - regularMatches.forEach { - val obj = it as JsonObject - val setting = obj["regularMatchSetting"]!!.jsonObject - cachedRegularModeData.add( - ModeData( - obj["startTime"]!!.jsonPrimitive.content, - obj["endTime"]!!.jsonPrimitive.content, - setting["__typename"]!!.jsonPrimitive.content, - cachedMapData[setting["vsStages"]!!.jsonArray[0].jsonObject["vsStageId"]!!.jsonPrimitive.int], - cachedMapData[setting["vsStages"]!!.jsonArray[1].jsonObject["vsStageId"]!!.jsonPrimitive.int], - setting["vsRule"]!!.jsonObject["name"]!!.jsonPrimitive.content, - setting["vsRule"]!!.jsonObject["rule"]!!.jsonPrimitive.content, - "TURF_WAR" - ) - ) - } - Logger.out("Updated Regular match data") - } catch (e: Exception) { - Logger.out("Error getting regular match data: ${e.cause}") - } - - try { - val compMatches = data["bankaraSchedules"]!!.jsonObject["nodes"]!!.jsonArray - cachedCompetitiveSeriesModeData = mutableListOf() - cachedCompetitiveOpenModeData = mutableListOf() - compMatches.forEach { - val obj = it as JsonObject - val setting = obj["bankaraMatchSettings"]!!.jsonArray - setting.forEach { - val ob = it as JsonObject - val mode = ob["bankaraMode"]!!.jsonPrimitive.content - if (mode == "CHALLENGE") { - cachedCompetitiveSeriesModeData.add( - ModeData( - obj["startTime"]!!.jsonPrimitive.content, - obj["endTime"]!!.jsonPrimitive.content, - ob["__typename"]!!.jsonPrimitive.content, - cachedMapData[ob["vsStages"]!!.jsonArray[0].jsonObject["vsStageId"]!!.jsonPrimitive.int], - cachedMapData[ob["vsStages"]!!.jsonArray[1].jsonObject["vsStageId"]!!.jsonPrimitive.int], - ob["vsRule"]!!.jsonObject["name"]!!.jsonPrimitive.content, - ob["vsRule"]!!.jsonObject["rule"]!!.jsonPrimitive.content, - mode - ) - ) - } else if (mode == "OPEN") { - cachedCompetitiveOpenModeData.add( - ModeData( - obj["startTime"]!!.jsonPrimitive.content, - obj["endTime"]!!.jsonPrimitive.content, - ob["__typename"]!!.jsonPrimitive.content, - cachedMapData[ob["vsStages"]!!.jsonArray[0].jsonObject["vsStageId"]!!.jsonPrimitive.int], - cachedMapData[ob["vsStages"]!!.jsonArray[1].jsonObject["vsStageId"]!!.jsonPrimitive.int], - ob["vsRule"]!!.jsonObject["name"]!!.jsonPrimitive.content, - ob["vsRule"]!!.jsonObject["rule"]!!.jsonPrimitive.content, - mode - ) - ) - } - } - } - Logger.out("Updated Competitive match data") - - } catch (e: Exception) { - Logger.out("Error getting competitive match data: ${e.cause}") - } - try { - val xMatches = data["xSchedules"]!!.jsonObject["nodes"]!!.jsonArray - cachedXModeData = mutableListOf() - xMatches.forEach { - val obj = it as JsonObject - val setting = obj["xMatchSetting"]!!.jsonObject - cachedXModeData.add( - ModeData( - obj["startTime"]!!.jsonPrimitive.content, - obj["endTime"]!!.jsonPrimitive.content, - setting["__typename"]!!.jsonPrimitive.content, - cachedMapData[setting["vsStages"]!!.jsonArray[0].jsonObject["vsStageId"]!!.jsonPrimitive.int], - cachedMapData[setting["vsStages"]!!.jsonArray[1].jsonObject["vsStageId"]!!.jsonPrimitive.int], - setting["vsRule"]!!.jsonObject["name"]!!.jsonPrimitive.content, - setting["vsRule"]!!.jsonObject["rule"]!!.jsonPrimitive.content, - "X" - ) - ) - } - Logger.out("Updated X match data") - } catch (e: Exception) { - Logger.out("Error getting X match data: ${e.cause}") - } - - try { - val challengeData = data["eventSchedules"]!!.jsonObject["nodes"]!!.jsonArray - cachedChallengesData = mutableListOf() - challengeData.forEach { - val obj = it as JsonObject - val tpd = obj["timePeriods"]!!.jsonArray - val setting = obj["leagueMatchSetting"]!!.jsonObject - val event = setting["leagueMatchEvent"]!!.jsonObject - cachedChallengesData.add( - ChallengeModeData( - event["leagueMatchEventId"]!!.jsonPrimitive.content, - event["name"]!!.jsonPrimitive.content, - event["desc"]!!.jsonPrimitive.content, - event["regulation"]!!.jsonPrimitive.content, - cachedMapData[setting["vsStages"]!!.jsonArray[0].jsonObject["vsStageId"]!!.jsonPrimitive.int], - cachedMapData[setting["vsStages"]!!.jsonArray[1].jsonObject["vsStageId"]!!.jsonPrimitive.int], - setting["__typename"]!!.jsonPrimitive.content, - setting["vsRule"]!!.jsonObject["rule"]!!.jsonPrimitive.content, - setting["vsRule"]!!.jsonObject["name"]!!.jsonPrimitive.content, - TimePeriodData( - tpd[0].jsonObject["startTime"]!!.jsonPrimitive.content, - tpd[0].jsonObject["endTime"]!!.jsonPrimitive.content - ), - TimePeriodData( - tpd[1].jsonObject["startTime"]!!.jsonPrimitive.content, - tpd[1].jsonObject["endTime"]!!.jsonPrimitive.content - ), - TimePeriodData( - tpd[2].jsonObject["startTime"]!!.jsonPrimitive.content, - tpd[2].jsonObject["endTime"]!!.jsonPrimitive.content - ) - ) - ) - } - Logger.out("Updated Challenge data") - } catch (e: Exception) { - Logger.out("Error getting Challenge data: ${e.cause}") - } - - try { - val shiftData = - data["coopGroupingSchedule"]!!.jsonObject["regularSchedules"]!!.jsonObject["nodes"]!!.jsonArray - cachedShiftData = mutableListOf() - shiftData.forEach { - val obj = it as JsonObject - val setting = obj["setting"]!!.jsonObject - val stage = setting["coopStage"]!!.jsonObject - val weapons = setting["weapons"]!!.jsonArray - cachedShiftData.add( - ShiftData( - obj["startTime"]!!.jsonPrimitive.content, - obj["endTime"]!!.jsonPrimitive.content, - obj["__splatoon3ink_king_salmonid_guess"]!!.jsonPrimitive.content, - setting["__typename"]!!.jsonPrimitive.content, - stage["name"]!!.jsonPrimitive.content, - Url(stage["image"]!!.jsonObject["url"]!!.jsonPrimitive.content), - WeaponData( - weapons[0].jsonObject["name"]!!.jsonPrimitive.content, - Url(weapons[0].jsonObject["image"]!!.jsonObject["url"]!!.jsonPrimitive.content) - ), - WeaponData( - weapons[1].jsonObject["name"]!!.jsonPrimitive.content, - Url(weapons[1].jsonObject["image"]!!.jsonObject["url"]!!.jsonPrimitive.content) - ), - WeaponData( - weapons[2].jsonObject["name"]!!.jsonPrimitive.content, - Url(weapons[2].jsonObject["image"]!!.jsonObject["url"]!!.jsonPrimitive.content) - ), - WeaponData( - weapons[3].jsonObject["name"]!!.jsonPrimitive.content, - Url(weapons[3].jsonObject["image"]!!.jsonObject["url"]!!.jsonPrimitive.content) - ) - ) - ) - } - Logger.out("Updated shift data") - } catch (e: Exception) { - Logger.out("Error getting coopGrouping data: ${e.cause}") - } - - try { - val bigRunData = - data["coopGroupingSchedule"]!!.jsonObject["bigRunSchedules"]!!.jsonObject["nodes"]!!.jsonArray - cachedBigRunShiftData = mutableListOf() - bigRunData.forEach { - val obj = it as JsonObject - val setting = obj["setting"]!!.jsonObject - val stage = setting["coopStage"]!!.jsonObject - val weapons = setting["weapons"]!!.jsonArray - cachedBigRunShiftData.add( - ShiftData( - obj["startTime"]!!.jsonPrimitive.content, - obj["endTime"]!!.jsonPrimitive.content, - obj["__splatoon3ink_king_salmonid_guess"]!!.jsonPrimitive.content, - setting["__typename"]!!.jsonPrimitive.content, - stage["name"]!!.jsonPrimitive.content, - Url(stage["image"]!!.jsonObject["url"]!!.jsonPrimitive.content), - WeaponData( - weapons[0].jsonObject["name"]!!.jsonPrimitive.content, - Url(weapons[0].jsonObject["image"]!!.jsonObject["url"]!!.jsonPrimitive.content) - ), - WeaponData( - weapons[1].jsonObject["name"]!!.jsonPrimitive.content, - Url(weapons[1].jsonObject["image"]!!.jsonObject["url"]!!.jsonPrimitive.content) - ), - WeaponData( - weapons[2].jsonObject["name"]!!.jsonPrimitive.content, - Url(weapons[2].jsonObject["image"]!!.jsonObject["url"]!!.jsonPrimitive.content) - ), - WeaponData( - weapons[3].jsonObject["name"]!!.jsonPrimitive.content, - Url(weapons[3].jsonObject["image"]!!.jsonObject["url"]!!.jsonPrimitive.content) - ) - ) - ) - } - Logger.out("Updated big run data") - } catch (e: Exception) { - Logger.out("Error getting big run data: ${e.cause}") - } - - Logger.out("Updated all Schedules") - } - - private fun updateSplatfestCache(uag: String) { - val apiResponse = NetUtil.GETJsonData("${base_url}festivals.json", uag) - if (apiResponse.startsWith("Error")) { - Logger.out("Error getting splatfest data: $apiResponse") - return - } - try { - val json = Json.decodeFromString(apiResponse) as JsonObject - val festivals = - json["US"]!!.jsonObject["data"]!!.jsonObject["festRecords"]!!.jsonObject["nodes"]!!.jsonArray - cachedSplatfestData = mutableListOf() - festivals.forEach { - val fest = it as JsonObject - val teams = fest.jsonObject["teams"]!!.jsonArray - val team1 = teams[0].jsonObject - val team1Color = team1["color"]!!.jsonObject - var team1Result: JsonObject? = null - if (team1["result"] !is JsonNull) { - team1Result = team1["result"]!!.jsonObject - } - val team2 = teams[1].jsonObject - val team2Color = team2["color"]!!.jsonObject - var team2Result: JsonObject? = null - if (team2["result"] !is JsonNull) { - team2Result = team2["result"]!!.jsonObject - } - val team3 = teams[2].jsonObject - val team3Color = team3["color"]!!.jsonObject - var team3Result: JsonObject? = null - if (team3["result"] !is JsonNull) { - team3Result = team3["result"]!!.jsonObject - } - cachedSplatfestData.add( - SplatfestData( - fest.jsonObject["id"]!!.jsonPrimitive.content, - fest.jsonObject["state"]!!.jsonPrimitive.content, - fest.jsonObject["startTime"]!!.jsonPrimitive.content, - fest.jsonObject["endTime"]!!.jsonPrimitive.content, - fest.jsonObject["title"]!!.jsonPrimitive.content, - Url(fest.jsonObject["image"]!!.jsonObject["url"]!!.jsonPrimitive.content), - SplatfestTeamData( - team1["teamName"]!!.jsonPrimitive.content, - SplatfestColor( - team1Color["a"]!!.jsonPrimitive.int, - team1Color["b"]!!.jsonPrimitive.double, - team1Color["g"]!!.jsonPrimitive.double, - team1Color["r"]!!.jsonPrimitive.double - ), - if (team1Result.isNullOrEmpty() || team1Result["tricolorContributionRatio"]!!.jsonPrimitive.doubleOrNull == null) - null - else SplatfestTeamResults( - team1Result["isWinner"]!!.jsonPrimitive.boolean, - team1Result["horagaiRatio"]!!.jsonPrimitive.double, - team1Result["isHoragaiRatioTop"]!!.jsonPrimitive.boolean, - team1Result["voteRatio"]!!.jsonPrimitive.double, - team1Result["isVoteRatioTop"]!!.jsonPrimitive.boolean, - team1Result["regularContributionRatio"]!!.jsonPrimitive.double, - team1Result["isRegularContributionRatioTop"]!!.jsonPrimitive.boolean, - team1Result["challengeContributionRatio"]!!.jsonPrimitive.double, - team1Result["isChallengeContributionRatioTop"]!!.jsonPrimitive.boolean, - team1Result["tricolorContributionRatio"]!!.jsonPrimitive.double, - team1Result["isTricolorContributionRatioTop"]!!.jsonPrimitive.boolean, - ) - ), - SplatfestTeamData( - team2["teamName"]!!.jsonPrimitive.content, - SplatfestColor( - team2Color["a"]!!.jsonPrimitive.int, - team2Color["b"]!!.jsonPrimitive.double, - team2Color["g"]!!.jsonPrimitive.double, - team2Color["r"]!!.jsonPrimitive.double - ), - if (team2Result.isNullOrEmpty() || team2Result["tricolorContributionRatio"]!!.jsonPrimitive.doubleOrNull == null) - null - else SplatfestTeamResults( - team2Result["isWinner"]!!.jsonPrimitive.boolean, - team2Result["horagaiRatio"]!!.jsonPrimitive.double, - team2Result["isHoragaiRatioTop"]!!.jsonPrimitive.boolean, - team2Result["voteRatio"]!!.jsonPrimitive.double, - team2Result["isVoteRatioTop"]!!.jsonPrimitive.boolean, - team2Result["regularContributionRatio"]!!.jsonPrimitive.double, - team2Result["isRegularContributionRatioTop"]!!.jsonPrimitive.boolean, - team2Result["challengeContributionRatio"]!!.jsonPrimitive.double, - team2Result["isChallengeContributionRatioTop"]!!.jsonPrimitive.boolean, - team2Result["tricolorContributionRatio"]!!.jsonPrimitive.double, - team2Result["isTricolorContributionRatioTop"]!!.jsonPrimitive.boolean, - ) - ), - SplatfestTeamData( - team3["teamName"]!!.jsonPrimitive.content, - SplatfestColor( - team3Color["a"]!!.jsonPrimitive.int, - team3Color["b"]!!.jsonPrimitive.double, - team3Color["g"]!!.jsonPrimitive.double, - team3Color["r"]!!.jsonPrimitive.double - ), - if (team3Result.isNullOrEmpty() || team3Result["tricolorContributionRatio"]!!.jsonPrimitive.doubleOrNull == null) - null - else SplatfestTeamResults( - team3Result["isWinner"]!!.jsonPrimitive.boolean, - team3Result["horagaiRatio"]!!.jsonPrimitive.double, - team3Result["isHoragaiRatioTop"]!!.jsonPrimitive.boolean, - team3Result["voteRatio"]!!.jsonPrimitive.double, - team3Result["isVoteRatioTop"]!!.jsonPrimitive.boolean, - team3Result["regularContributionRatio"]!!.jsonPrimitive.double, - team3Result["isRegularContributionRatioTop"]!!.jsonPrimitive.boolean, - team3Result["challengeContributionRatio"]!!.jsonPrimitive.double, - team3Result["isChallengeContributionRatioTop"]!!.jsonPrimitive.boolean, - team3Result["tricolorContributionRatio"]!!.jsonPrimitive.double, - team3Result["isTricolorContributionRatioTop"]!!.jsonPrimitive.boolean, - ) - ), - ) - ) - } - Logger.out("Updated Splatfest data") - } catch (e: Exception) { - Logger.out("Error getting splatfest data: ${e.cause}") - } - } -} diff --git a/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/Splatoon3ApiDataGrabber.kt b/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/Splatoon3ApiDataGrabber.kt new file mode 100644 index 0000000..6a9eedf --- /dev/null +++ b/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/Splatoon3ApiDataGrabber.kt @@ -0,0 +1,129 @@ +/* + * lilJudd + * Copyright (C) 2023 moonleay + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package net.moonleay.lilJudd.data.api.splatoon3ink + +import net.moonleay.lilJudd.data.api.splatoon3ink.schedules.BankaraNode +import net.moonleay.lilJudd.data.api.splatoon3ink.schedules.RegularNode +import net.moonleay.lilJudd.data.api.splatoon3ink.schedules.XNode +import net.moonleay.lilJudd.util.TimeUtil + +object Splatoon3ApiDataGrabber { + private fun getRegularMode(timestamp: Long): net.moonleay.lilJudd.data.api.splatoon3ink.schedules.RegularNode { + Splatoon3Api.schedules!!.data.regularSchedules.nodes.map { modeData -> + val startTime = TimeUtil.deformatJSONTime(modeData.startTime, "UTC") + val endTime = TimeUtil.deformatJSONTime(modeData.endTime, "UTC") + if (timestamp in startTime..endTime) { + return modeData + } + } + throw Exception("No current mode found") + } + + private fun getOpenMode(timestamp: Long): net.moonleay.lilJudd.data.api.splatoon3ink.schedules.BankaraNode { + Splatoon3Api.schedules!!.data.bankaraSchedules.nodes.map { modeData -> + val startTime = TimeUtil.deformatJSONTime(modeData.startTime, "UTC") + val endTime = TimeUtil.deformatJSONTime(modeData.endTime, "UTC") + if (timestamp in startTime..endTime) { + modeData.bankaraMatchSettings!!.map { matchSetting -> + if (matchSetting.bankaraMode == "OPEN") + return modeData + } + } + } + throw Exception("No current mode found") + } + + private fun getXMode(timestamp: Long): net.moonleay.lilJudd.data.api.splatoon3ink.schedules.XNode { + Splatoon3Api.schedules!!.data.xSchedules.nodes.map { modeData -> + val startTime = TimeUtil.deformatJSONTime(modeData.startTime, "UTC") + val endTime = TimeUtil.deformatJSONTime(modeData.endTime, "UTC") + if (timestamp in startTime..endTime) { + return modeData + } + } + throw Exception("No current mode found") + } + + private fun getSeriesMode(timestamp: Long): net.moonleay.lilJudd.data.api.splatoon3ink.schedules.BankaraNode { + Splatoon3Api.schedules!!.data.bankaraSchedules.nodes.map { modeData -> + val startTime = TimeUtil.deformatJSONTime(modeData.startTime, "UTC") + val endTime = TimeUtil.deformatJSONTime(modeData.endTime, "UTC") + if (timestamp in startTime..endTime) { + modeData.bankaraMatchSettings!!.map { matchSetting -> + if (matchSetting.bankaraMode == "CHALLENGE") + return modeData + } + } + } + throw Exception("No current mode found") + } + + fun getRotationTime(timestamp: Long): String { + val modeData = getRegularMode(timestamp) + val endTime = TimeUtil.deformatJSONTime(modeData.endTime, "UTC") + val diffStamp = TimeUtil.getTimeDifferenceFormatted(System.currentTimeMillis(), endTime) + return "$diffStamp left in rotation" + } + + fun getRegularMapsFormatted(timestamp: Long): String { + val modeData = getRegularMode(timestamp) + val map1 = modeData.regularMatchSetting.vsStages[0].name.split(" ")[0] + val map2 = modeData.regularMatchSetting.vsStages[1].name.split(" ")[0] + return "R: $map1, $map2" + } + + fun getOpenMapFormatted(timestamp: Long): String { + val modeData = getOpenMode(timestamp) + // FIXME: This may cause issues if there is a Splatfest going on + // TODO: Check if this works during splatfest + // The Open Mode should always be the second mode in the list + // FIXME: Add check if 2nd itm in list is open mode + val map1 = modeData.bankaraMatchSettings!![1].vsStages[0].name.split(" ")[0] + val map2 = modeData.bankaraMatchSettings[1].vsStages[1].name.split(" ")[0] + return "O: ${modeData.bankaraMatchSettings[1].vsRule.name}: $map1, $map2" + .replace("Rainmaker", "RMK") + .replace("Tower Control", "TC") + .replace("Splat Zones", "SZ") + .replace("Clam Blitz", "CB") + } + + fun getSeriesMapsFormatted(timestamp: Long): String { + val modeData = getSeriesMode(timestamp) + // FIXME: This may cause issues if there is a Splatfest going on + // TODO: Check all the same things as in getOpenMapFormatted + val map1 = modeData.bankaraMatchSettings!![0].vsStages[0].name.split(" ")[0] + val map2 = modeData.bankaraMatchSettings[0].vsStages[1].name.split(" ")[0] + return "S: ${modeData.bankaraMatchSettings[0].vsRule.name}: $map1, $map2" + .replace("Rainmaker", "RMK") + .replace("Tower Control", "TC") + .replace("Splat Zones", "SZ") + .replace("Clam Blitz", "CB") + } + + fun getXMapFormatted(timestamp: Long): String { + val modeData = getXMode(timestamp) + val map1 = modeData.xMatchSetting.vsStages[0].name.split(" ")[0] + val map2 = modeData.xMatchSetting.vsStages[1].name.split(" ")[0] + return "X: ${modeData.xMatchSetting.vsRule.name}: $map1, $map2" + .replace("Rainmaker", "RMK") + .replace("Tower Control", "TC") + .replace("Splat Zones", "SZ") + .replace("Clam Blitz", "CB") + } +} diff --git a/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/entry/coop/CoopGearData.kt b/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/entry/coop/CoopGearData.kt deleted file mode 100644 index 817a80a..0000000 --- a/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/entry/coop/CoopGearData.kt +++ /dev/null @@ -1,28 +0,0 @@ -/* - * lilJudd - * Copyright (C) 2023 moonleay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package net.moonleay.lilJudd.data.api.splatoon3ink.entry.coop - -import io.ktor.http.* - -data class CoopGearData( - val name: String, - val image: Url, - val __typename: String, - - ) diff --git a/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/entry/splatfest/SplatfestTeamData.kt b/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/entry/splatfest/SplatfestTeamData.kt deleted file mode 100644 index b29ee85..0000000 --- a/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/entry/splatfest/SplatfestTeamData.kt +++ /dev/null @@ -1,25 +0,0 @@ -/* - * lilJudd - * Copyright (C) 2023 moonleay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package net.moonleay.lilJudd.data.api.splatoon3ink.entry.splatfest - -data class SplatfestTeamData( - val teamName: String, - val color: SplatfestColor, - val results: SplatfestTeamResults?, -) diff --git a/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/entry/splatfest/SplatfestTeamResults.kt b/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/entry/splatfest/SplatfestTeamResults.kt deleted file mode 100644 index ff7b531..0000000 --- a/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/entry/splatfest/SplatfestTeamResults.kt +++ /dev/null @@ -1,33 +0,0 @@ -/* - * lilJudd - * Copyright (C) 2023 moonleay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package net.moonleay.lilJudd.data.api.splatoon3ink.entry.splatfest - -data class SplatfestTeamResults( - val isWinner: Boolean, - val horagaiRatio: Double, - val horagaiRatioTop: Boolean, - val voteRatio: Double, - val voteRatioTop: Boolean, - val regularRatio: Double, - val regularRatioTop: Boolean, - val challengeRatio: Double, - val challengeRatioTop: Boolean, - val tricolorRatio: Double, - val tricolorRatioTop: Boolean, -) diff --git a/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/entry/splatnet/SplatnetItemData.kt b/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/entry/splatnet/SplatnetItemData.kt deleted file mode 100644 index 72268dd..0000000 --- a/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/entry/splatnet/SplatnetItemData.kt +++ /dev/null @@ -1,32 +0,0 @@ -/* - * lilJudd - * Copyright (C) 2023 moonleay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package net.moonleay.lilJudd.data.api.splatoon3ink.entry.splatnet - -import io.ktor.http.* - -data class SplatnetItemData( - val saleEndTime: String, - val price: Int, - val typeName: String, - val name: String, - val primaryGearPower: GearAbilityData, - val additionalGearPowers: List, - val image: Url, - val brand: BrandData, -) diff --git a/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/BankaraMatchSetting.kt b/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/BankaraMatchSetting.kt new file mode 100644 index 0000000..a73a448 --- /dev/null +++ b/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/BankaraMatchSetting.kt @@ -0,0 +1,37 @@ +/* + * lilJudd + * Copyright (C) 2024 moonleay + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package net.moonleay.lilJudd.data.api.splatoon3ink.schedules + + +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable + +@Serializable +data class BankaraMatchSetting( + @SerialName("bankaraMode") + val bankaraMode: String, + @SerialName("__isVsSetting") + val isVsSetting: String, + @SerialName("__typename") + val typename: String, + @SerialName("vsRule") + val vsRule: net.moonleay.lilJudd.data.api.splatoon3ink.schedules.VsRule, + @SerialName("vsStages") + val vsStages: List +) diff --git a/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/BankaraNode.kt b/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/BankaraNode.kt new file mode 100644 index 0000000..e40379c --- /dev/null +++ b/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/BankaraNode.kt @@ -0,0 +1,35 @@ +/* + * lilJudd + * Copyright (C) 2024 moonleay + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package net.moonleay.lilJudd.data.api.splatoon3ink.schedules + + +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable + +@Serializable +data class BankaraNode( + @SerialName("bankaraMatchSettings") + val bankaraMatchSettings: List?, + @SerialName("endTime") + val endTime: String, + @SerialName("festMatchSettings") + val festMatchSettings: List?, + @SerialName("startTime") + val startTime: String +) diff --git a/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/BankaraSchedules.kt b/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/BankaraSchedules.kt new file mode 100644 index 0000000..0363b5f --- /dev/null +++ b/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/BankaraSchedules.kt @@ -0,0 +1,29 @@ +/* + * lilJudd + * Copyright (C) 2024 moonleay + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package net.moonleay.lilJudd.data.api.splatoon3ink.schedules + + +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable + +@Serializable +data class BankaraSchedules( + @SerialName("nodes") + val nodes: List +) diff --git a/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/BigRunScheduleNode.kt b/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/BigRunScheduleNode.kt new file mode 100644 index 0000000..e51551e --- /dev/null +++ b/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/BigRunScheduleNode.kt @@ -0,0 +1,35 @@ +/* + * lilJudd + * Copyright (C) 2024 moonleay + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package net.moonleay.lilJudd.data.api.splatoon3ink.schedules + + +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable + +@Serializable +data class BigRunScheduleNode( + @SerialName("endTime") + val endTime: String, + @SerialName("setting") + val setting: net.moonleay.lilJudd.data.api.splatoon3ink.schedules.Setting, + @SerialName("__splatoon3ink_king_salmonid_guess") + val splatoon3inkKingSalmonidGuess: String, + @SerialName("startTime") + val startTime: String +) diff --git a/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/BigRunSchedules.kt b/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/BigRunSchedules.kt new file mode 100644 index 0000000..de77938 --- /dev/null +++ b/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/BigRunSchedules.kt @@ -0,0 +1,29 @@ +/* + * lilJudd + * Copyright (C) 2024 moonleay + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package net.moonleay.lilJudd.data.api.splatoon3ink.schedules + + +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable + +@Serializable +data class BigRunSchedules( + @SerialName("nodes") + val nodes: List +) diff --git a/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/Boss.kt b/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/Boss.kt new file mode 100644 index 0000000..1501727 --- /dev/null +++ b/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/Boss.kt @@ -0,0 +1,31 @@ +/* + * lilJudd + * Copyright (C) 2024 moonleay + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package net.moonleay.lilJudd.data.api.splatoon3ink.schedules + + +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable + +@Serializable +data class Boss( + @SerialName("id") + val id: String, + @SerialName("name") + val name: String +) diff --git a/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/entry/splatfest/SplatfestColor.kt b/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/Color.kt similarity index 70% rename from src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/entry/splatfest/SplatfestColor.kt rename to src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/Color.kt index 9f61bd7..7ed55be 100644 --- a/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/entry/splatfest/SplatfestColor.kt +++ b/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/Color.kt @@ -1,6 +1,6 @@ /* * lilJudd - * Copyright (C) 2023 moonleay + * Copyright (C) 2024 moonleay * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,11 +16,20 @@ * along with this program. If not, see . */ -package net.moonleay.lilJudd.data.api.splatoon3ink.entry.splatfest +package net.moonleay.lilJudd.data.api.splatoon3ink.schedules -data class SplatfestColor( + +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable + +@Serializable +data class Color( + @SerialName("a") val a: Int, + @SerialName("b") val b: Double, + @SerialName("g") val g: Double, - val r: Double, + @SerialName("r") + val r: Double ) diff --git a/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/CoopGroupingSchedule.kt b/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/CoopGroupingSchedule.kt new file mode 100644 index 0000000..baefdf1 --- /dev/null +++ b/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/CoopGroupingSchedule.kt @@ -0,0 +1,35 @@ +/* + * lilJudd + * Copyright (C) 2024 moonleay + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package net.moonleay.lilJudd.data.api.splatoon3ink.schedules + + +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable + +@Serializable +data class CoopGroupingSchedule( + @SerialName("bannerImage") + val bannerImage: String?, // is null + @SerialName("bigRunSchedules") + val bigRunSchedules: net.moonleay.lilJudd.data.api.splatoon3ink.schedules.BigRunSchedules, + @SerialName("regularSchedules") + val regularSchedules: net.moonleay.lilJudd.data.api.splatoon3ink.schedules.RegularSchedules, + @SerialName("teamContestSchedules") + val teamContestSchedules: net.moonleay.lilJudd.data.api.splatoon3ink.schedules.TeamContestSchedules? +) diff --git a/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/CoopStage.kt b/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/CoopStage.kt new file mode 100644 index 0000000..ddfb9da --- /dev/null +++ b/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/CoopStage.kt @@ -0,0 +1,35 @@ +/* + * lilJudd + * Copyright (C) 2024 moonleay + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package net.moonleay.lilJudd.data.api.splatoon3ink.schedules + + +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable + +@Serializable +data class CoopStage( + @SerialName("id") + val id: String, + @SerialName("image") + val image: net.moonleay.lilJudd.data.api.splatoon3ink.schedules.Image, + @SerialName("name") + val name: String, + @SerialName("thumbnailImage") + val thumbnailImage: net.moonleay.lilJudd.data.api.splatoon3ink.schedules.ThumbnailImage +) diff --git a/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/CurrentFest.kt b/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/CurrentFest.kt new file mode 100644 index 0000000..63d995e --- /dev/null +++ b/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/CurrentFest.kt @@ -0,0 +1,43 @@ +/* + * lilJudd + * Copyright (C) 2024 moonleay + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package net.moonleay.lilJudd.data.api.splatoon3ink.schedules + + +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable + +@Serializable +data class CurrentFest( + @SerialName("endTime") + val endTime: String, + @SerialName("id") + val id: String, + @SerialName("midtermTime") + val midtermTime: String, + @SerialName("startTime") + val startTime: String, + @SerialName("state") + val state: String, + @SerialName("teams") + val teams: List, + @SerialName("title") + val title: String, + @SerialName("tricolorStage") + val tricolorStage: net.moonleay.lilJudd.data.api.splatoon3ink.schedules.TricolorStage +) diff --git a/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/CurrentPlayer.kt b/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/CurrentPlayer.kt new file mode 100644 index 0000000..3bab50b --- /dev/null +++ b/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/CurrentPlayer.kt @@ -0,0 +1,29 @@ +/* + * lilJudd + * Copyright (C) 2024 moonleay + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package net.moonleay.lilJudd.data.api.splatoon3ink.schedules + + +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable + +@Serializable +data class CurrentPlayer( + @SerialName("userIcon") + val userIcon: net.moonleay.lilJudd.data.api.splatoon3ink.schedules.UserIcon +) diff --git a/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/EventNode.kt b/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/EventNode.kt new file mode 100644 index 0000000..7b7f011 --- /dev/null +++ b/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/EventNode.kt @@ -0,0 +1,31 @@ +/* + * lilJudd + * Copyright (C) 2024 moonleay + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package net.moonleay.lilJudd.data.api.splatoon3ink.schedules + + +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable + +@Serializable +data class EventNode( + @SerialName("leagueMatchSetting") + val leagueMatchSetting: net.moonleay.lilJudd.data.api.splatoon3ink.schedules.LeagueMatchSetting, + @SerialName("timePeriods") + val timePeriods: List +) diff --git a/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/EventSchedules.kt b/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/EventSchedules.kt new file mode 100644 index 0000000..f5f3fe3 --- /dev/null +++ b/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/EventSchedules.kt @@ -0,0 +1,29 @@ +/* + * lilJudd + * Copyright (C) 2024 moonleay + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package net.moonleay.lilJudd.data.api.splatoon3ink.schedules + + +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable + +@Serializable +data class EventSchedules( + @SerialName("nodes") + val nodes: List +) diff --git a/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/FestMatchSettingX.kt b/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/FestMatchSettingX.kt new file mode 100644 index 0000000..c759a30 --- /dev/null +++ b/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/FestMatchSettingX.kt @@ -0,0 +1,35 @@ +/* + * lilJudd + * Copyright (C) 2024 moonleay + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package net.moonleay.lilJudd.data.api.splatoon3ink.schedules + + +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable + +@Serializable +data class FestMatchSettingX( + @SerialName("__isVsSetting") + val isVsSetting: String, + @SerialName("__typename") + val typename: String, + @SerialName("vsRule") + val vsRule: net.moonleay.lilJudd.data.api.splatoon3ink.schedules.VsRule, + @SerialName("vsStages") + val vsStages: List +) diff --git a/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/FestMatchSettingXX.kt b/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/FestMatchSettingXX.kt new file mode 100644 index 0000000..a1f5d3d --- /dev/null +++ b/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/FestMatchSettingXX.kt @@ -0,0 +1,28 @@ +/* + * lilJudd + * Copyright (C) 2024 moonleay + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package net.moonleay.lilJudd.data.api.splatoon3ink.schedules + +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable + +@Serializable +data class FestMatchSettingXX( + @SerialName("__typename") + val typename: String +) diff --git a/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/entry/schedule/ShiftData.kt b/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/FestNode.kt similarity index 61% rename from src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/entry/schedule/ShiftData.kt rename to src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/FestNode.kt index f6f29f1..e8a438d 100644 --- a/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/entry/schedule/ShiftData.kt +++ b/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/FestNode.kt @@ -1,6 +1,6 @@ /* * lilJudd - * Copyright (C) 2023 moonleay + * Copyright (C) 2024 moonleay * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,19 +16,18 @@ * along with this program. If not, see . */ -package net.moonleay.lilJudd.data.api.splatoon3ink.entry.schedule +package net.moonleay.lilJudd.data.api.splatoon3ink.schedules -import io.ktor.http.* -data class ShiftData( - val startTime: String, +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable + +@Serializable +data class FestNode( + @SerialName("endTime") val endTime: String, - val __splatoon3ink_king_salmonid_guess: String, - val __typename: String, - val stageName: String, - val image: Url, - val weapon1: WeaponData, - val weapon2: WeaponData, - val weapon3: WeaponData, - val weapon4: WeaponData, + @SerialName("festMatchSettings") + val festMatchSettings: net.moonleay.lilJudd.data.api.splatoon3ink.schedules.FestMatchSettingX?, + @SerialName("startTime") + val startTime: String ) diff --git a/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/FestSchedules.kt b/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/FestSchedules.kt new file mode 100644 index 0000000..8eed590 --- /dev/null +++ b/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/FestSchedules.kt @@ -0,0 +1,29 @@ +/* + * lilJudd + * Copyright (C) 2024 moonleay + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package net.moonleay.lilJudd.data.api.splatoon3ink.schedules + + +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable + +@Serializable +data class FestSchedules( + @SerialName("nodes") + val nodes: List +) diff --git a/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/entry/schedule/WeaponData.kt b/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/Image.kt similarity index 72% rename from src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/entry/schedule/WeaponData.kt rename to src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/Image.kt index 025ef87..f635fa6 100644 --- a/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/entry/schedule/WeaponData.kt +++ b/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/Image.kt @@ -1,6 +1,6 @@ /* * lilJudd - * Copyright (C) 2023 moonleay + * Copyright (C) 2024 moonleay * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,11 +16,14 @@ * along with this program. If not, see . */ -package net.moonleay.lilJudd.data.api.splatoon3ink.entry.schedule +package net.moonleay.lilJudd.data.api.splatoon3ink.schedules -import io.ktor.http.* -data class WeaponData( - val name: String, - val image: Url, +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable + +@Serializable +data class Image( + @SerialName("url") + val url: String ) diff --git a/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/entry/schedule/ChallengeModeData.kt b/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/LeagueMatchEvent.kt similarity index 61% rename from src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/entry/schedule/ChallengeModeData.kt rename to src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/LeagueMatchEvent.kt index 87efd9d..64fe6b9 100644 --- a/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/entry/schedule/ChallengeModeData.kt +++ b/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/LeagueMatchEvent.kt @@ -1,6 +1,6 @@ /* * lilJudd - * Copyright (C) 2023 moonleay + * Copyright (C) 2024 moonleay * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,19 +16,24 @@ * along with this program. If not, see . */ -package net.moonleay.lilJudd.data.api.splatoon3ink.entry.schedule +package net.moonleay.lilJudd.data.api.splatoon3ink.schedules -data class ChallengeModeData( + +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable + +@Serializable +data class LeagueMatchEvent( + @SerialName("desc") + val desc: String, + @SerialName("id") + val id: String, + @SerialName("leagueMatchEventId") val leagueMatchEventId: String, + @SerialName("name") val name: String, - val description: String, + @SerialName("regulation") val regulation: String, - val map1: MapData?, - val map2: MapData?, - val __typename: String, - val ruleSet: String, - val ruleSetName: String, - val timePeriod1: TimePeriodData, - val timePeriod2: TimePeriodData, - val timePeriod3: TimePeriodData, + @SerialName("regulationUrl") + val regulationUrl: String? // is null ) diff --git a/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/LeagueMatchSetting.kt b/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/LeagueMatchSetting.kt new file mode 100644 index 0000000..c8e4ba1 --- /dev/null +++ b/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/LeagueMatchSetting.kt @@ -0,0 +1,37 @@ +/* + * lilJudd + * Copyright (C) 2024 moonleay + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package net.moonleay.lilJudd.data.api.splatoon3ink.schedules + + +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable + +@Serializable +data class LeagueMatchSetting( + @SerialName("__isVsSetting") + val isVsSetting: String, + @SerialName("leagueMatchEvent") + val leagueMatchEvent: net.moonleay.lilJudd.data.api.splatoon3ink.schedules.LeagueMatchEvent, + @SerialName("__typename") + val typename: String, + @SerialName("vsRule") + val vsRule: net.moonleay.lilJudd.data.api.splatoon3ink.schedules.VsRule, + @SerialName("vsStages") + val vsStages: List +) diff --git a/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/MapNode.kt b/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/MapNode.kt new file mode 100644 index 0000000..107545f --- /dev/null +++ b/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/MapNode.kt @@ -0,0 +1,37 @@ +/* + * lilJudd + * Copyright (C) 2024 moonleay + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package net.moonleay.lilJudd.data.api.splatoon3ink.schedules + + +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable + +@Serializable +data class MapNode( + @SerialName("id") + val id: String, + @SerialName("name") + val name: String, + @SerialName("originalImage") + val originalImage: net.moonleay.lilJudd.data.api.splatoon3ink.schedules.OriginalImage, + @SerialName("stats") + val stats: String?, // is null + @SerialName("vsStageId") + val vsStageId: Int +) diff --git a/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/entry/splatnet/BrandData.kt b/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/OriginalImage.kt similarity index 72% rename from src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/entry/splatnet/BrandData.kt rename to src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/OriginalImage.kt index 2c80240..e294963 100644 --- a/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/entry/splatnet/BrandData.kt +++ b/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/OriginalImage.kt @@ -1,6 +1,6 @@ /* * lilJudd - * Copyright (C) 2023 moonleay + * Copyright (C) 2024 moonleay * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,13 +16,14 @@ * along with this program. If not, see . */ -package net.moonleay.lilJudd.data.api.splatoon3ink.entry.splatnet +package net.moonleay.lilJudd.data.api.splatoon3ink.schedules -import io.ktor.http.* -data class BrandData( - val name: String, - val image: Url, - val usualGearPower: GearAbilityData?, - val saleEndTime: String?, +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable + +@Serializable +data class OriginalImage( + @SerialName("url") + val url: String ) diff --git a/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/RegularMatchSetting.kt b/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/RegularMatchSetting.kt new file mode 100644 index 0000000..ffb1d51 --- /dev/null +++ b/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/RegularMatchSetting.kt @@ -0,0 +1,35 @@ +/* + * lilJudd + * Copyright (C) 2024 moonleay + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package net.moonleay.lilJudd.data.api.splatoon3ink.schedules + + +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable + +@Serializable +data class RegularMatchSetting( + @SerialName("__isVsSetting") + val isVsSetting: String, + @SerialName("__typename") + val typename: String, + @SerialName("vsRule") + val vsRule: net.moonleay.lilJudd.data.api.splatoon3ink.schedules.VsRule, + @SerialName("vsStages") + val vsStages: List +) diff --git a/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/RegularNode.kt b/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/RegularNode.kt new file mode 100644 index 0000000..48d08fa --- /dev/null +++ b/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/RegularNode.kt @@ -0,0 +1,35 @@ +/* + * lilJudd + * Copyright (C) 2024 moonleay + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package net.moonleay.lilJudd.data.api.splatoon3ink.schedules + + +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable + +@Serializable +data class RegularNode( + @SerialName("endTime") + val endTime: String, + @SerialName("festMatchSettings") + val festMatchSettings: net.moonleay.lilJudd.data.api.splatoon3ink.schedules.FestMatchSettingXX?, + @SerialName("regularMatchSetting") + val regularMatchSetting: net.moonleay.lilJudd.data.api.splatoon3ink.schedules.RegularMatchSetting, + @SerialName("startTime") + val startTime: String +) diff --git a/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/RegularSchedules.kt b/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/RegularSchedules.kt new file mode 100644 index 0000000..6dc058f --- /dev/null +++ b/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/RegularSchedules.kt @@ -0,0 +1,29 @@ +/* + * lilJudd + * Copyright (C) 2024 moonleay + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package net.moonleay.lilJudd.data.api.splatoon3ink.schedules + + +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable + +@Serializable +data class RegularSchedules( + @SerialName("nodes") + val nodes: List +) diff --git a/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/RegularSchedulesX.kt b/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/RegularSchedulesX.kt new file mode 100644 index 0000000..6995bf3 --- /dev/null +++ b/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/RegularSchedulesX.kt @@ -0,0 +1,29 @@ +/* + * lilJudd + * Copyright (C) 2024 moonleay + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package net.moonleay.lilJudd.data.api.splatoon3ink.schedules + + +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable + +@Serializable +data class RegularSchedulesX( + @SerialName("nodes") + val nodes: List +) diff --git a/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/Schedules.kt b/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/Schedules.kt new file mode 100644 index 0000000..2d058c6 --- /dev/null +++ b/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/Schedules.kt @@ -0,0 +1,29 @@ +/* + * lilJudd + * Copyright (C) 2024 moonleay + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package net.moonleay.lilJudd.data.api.splatoon3ink.schedules + + +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable + +@Serializable +data class Schedules( + @SerialName("data") + val data: net.moonleay.lilJudd.data.api.splatoon3ink.schedules.SchedulesData +) diff --git a/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/SchedulesData.kt b/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/SchedulesData.kt new file mode 100644 index 0000000..9dd136b --- /dev/null +++ b/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/SchedulesData.kt @@ -0,0 +1,45 @@ +/* + * lilJudd + * Copyright (C) 2024 moonleay + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package net.moonleay.lilJudd.data.api.splatoon3ink.schedules + + +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable + +@Serializable +data class SchedulesData( + @SerialName("bankaraSchedules") + val bankaraSchedules: net.moonleay.lilJudd.data.api.splatoon3ink.schedules.BankaraSchedules, + @SerialName("coopGroupingSchedule") + val coopGroupingSchedule: net.moonleay.lilJudd.data.api.splatoon3ink.schedules.CoopGroupingSchedule, + @SerialName("currentFest") + val currentFest: net.moonleay.lilJudd.data.api.splatoon3ink.schedules.CurrentFest?, + @SerialName("currentPlayer") + val currentPlayer: net.moonleay.lilJudd.data.api.splatoon3ink.schedules.CurrentPlayer, + @SerialName("eventSchedules") + val eventSchedules: net.moonleay.lilJudd.data.api.splatoon3ink.schedules.EventSchedules, + @SerialName("festSchedules") + val festSchedules: net.moonleay.lilJudd.data.api.splatoon3ink.schedules.FestSchedules, + @SerialName("regularSchedules") + val regularSchedules: net.moonleay.lilJudd.data.api.splatoon3ink.schedules.RegularSchedulesX, + @SerialName("vsStages") + val vsStages: net.moonleay.lilJudd.data.api.splatoon3ink.schedules.VsStages, + @SerialName("xSchedules") + val xSchedules: net.moonleay.lilJudd.data.api.splatoon3ink.schedules.XSchedules +) diff --git a/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/Setting.kt b/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/Setting.kt new file mode 100644 index 0000000..ef98cfa --- /dev/null +++ b/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/Setting.kt @@ -0,0 +1,37 @@ +/* + * lilJudd + * Copyright (C) 2024 moonleay + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package net.moonleay.lilJudd.data.api.splatoon3ink.schedules + + +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable + +@Serializable +data class Setting( + @SerialName("boss") + val boss: net.moonleay.lilJudd.data.api.splatoon3ink.schedules.Boss, + @SerialName("coopStage") + val coopStage: net.moonleay.lilJudd.data.api.splatoon3ink.schedules.CoopStage, + @SerialName("__isCoopSetting") + val isCoopSetting: String, + @SerialName("__typename") + val typename: String, + @SerialName("weapons") + val weapons: List +) diff --git a/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/Team.kt b/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/Team.kt new file mode 100644 index 0000000..f015188 --- /dev/null +++ b/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/Team.kt @@ -0,0 +1,33 @@ +/* + * lilJudd + * Copyright (C) 2024 moonleay + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package net.moonleay.lilJudd.data.api.splatoon3ink.schedules + + +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable + +@Serializable +data class Team( + @SerialName("color") + val color: net.moonleay.lilJudd.data.api.splatoon3ink.schedules.Color, + @SerialName("id") + val id: String, +// @SerialName("myVoteState") +// val myVoteState: Any? +) diff --git a/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/TeamContestSchedules.kt b/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/TeamContestSchedules.kt new file mode 100644 index 0000000..e328191 --- /dev/null +++ b/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/TeamContestSchedules.kt @@ -0,0 +1,30 @@ +/* + * lilJudd + * Copyright (C) 2024 moonleay + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package net.moonleay.lilJudd.data.api.splatoon3ink.schedules + + +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable + +@Serializable +// TODO: Please check what goes here. +data class TeamContestSchedules( + @SerialName("nodes") + val nodes: List // This is a placeholder. +) diff --git a/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/entry/splatnet/GearAbilityData.kt b/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/ThumbnailImage.kt similarity index 72% rename from src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/entry/splatnet/GearAbilityData.kt rename to src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/ThumbnailImage.kt index 81f2ee7..cb357a9 100644 --- a/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/entry/splatnet/GearAbilityData.kt +++ b/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/ThumbnailImage.kt @@ -1,6 +1,6 @@ /* * lilJudd - * Copyright (C) 2023 moonleay + * Copyright (C) 2024 moonleay * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,12 +16,14 @@ * along with this program. If not, see . */ -package net.moonleay.lilJudd.data.api.splatoon3ink.entry.splatnet +package net.moonleay.lilJudd.data.api.splatoon3ink.schedules -import io.ktor.http.* -data class GearAbilityData( - val name: String, - val description: String?, - val image: Url, +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable + +@Serializable +data class ThumbnailImage( + @SerialName("url") + val url: String ) diff --git a/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/entry/schedule/TimePeriodData.kt b/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/TimePeriod.kt similarity index 70% rename from src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/entry/schedule/TimePeriodData.kt rename to src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/TimePeriod.kt index dc66844..99037bf 100644 --- a/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/entry/schedule/TimePeriodData.kt +++ b/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/TimePeriod.kt @@ -1,6 +1,6 @@ /* * lilJudd - * Copyright (C) 2023 moonleay + * Copyright (C) 2024 moonleay * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,9 +16,16 @@ * along with this program. If not, see . */ -package net.moonleay.lilJudd.data.api.splatoon3ink.entry.schedule +package net.moonleay.lilJudd.data.api.splatoon3ink.schedules -data class TimePeriodData( - val startTime: String, + +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable + +@Serializable +data class TimePeriod( + @SerialName("endTime") val endTime: String, + @SerialName("startTime") + val startTime: String ) diff --git a/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/entry/splatfest/SplatfestData.kt b/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/TricolorStage.kt similarity index 64% rename from src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/entry/splatfest/SplatfestData.kt rename to src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/TricolorStage.kt index fb11b19..958d1a5 100644 --- a/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/entry/splatfest/SplatfestData.kt +++ b/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/TricolorStage.kt @@ -1,6 +1,6 @@ /* * lilJudd - * Copyright (C) 2023 moonleay + * Copyright (C) 2024 moonleay * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,18 +16,18 @@ * along with this program. If not, see . */ -package net.moonleay.lilJudd.data.api.splatoon3ink.entry.splatfest +package net.moonleay.lilJudd.data.api.splatoon3ink.schedules -import io.ktor.http.* -data class SplatfestData( +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable + +@Serializable +data class TricolorStage( + @SerialName("id") val id: String, - val state: String, - val startTime: String, - val endTime: String, - val title: String, - val image: Url, - val team1: SplatfestTeamData, - val team2: SplatfestTeamData, - val team3: SplatfestTeamData, + @SerialName("image") + val image: net.moonleay.lilJudd.data.api.splatoon3ink.schedules.Image, + @SerialName("name") + val name: String ) diff --git a/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/entry/schedule/MapData.kt b/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/UserIcon.kt similarity index 72% rename from src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/entry/schedule/MapData.kt rename to src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/UserIcon.kt index b64755d..74ee2eb 100644 --- a/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/entry/schedule/MapData.kt +++ b/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/UserIcon.kt @@ -1,6 +1,6 @@ /* * lilJudd - * Copyright (C) 2023 moonleay + * Copyright (C) 2024 moonleay * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,12 +16,14 @@ * along with this program. If not, see . */ -package net.moonleay.lilJudd.data.api.splatoon3ink.entry.schedule +package net.moonleay.lilJudd.data.api.splatoon3ink.schedules -import io.ktor.http.* -data class MapData( - val stageID: Int, - val image: Url, - val name: String, +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable + +@Serializable +data class UserIcon( + @SerialName("url") + val url: String ) diff --git a/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/VsRule.kt b/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/VsRule.kt new file mode 100644 index 0000000..5e47251 --- /dev/null +++ b/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/VsRule.kt @@ -0,0 +1,33 @@ +/* + * lilJudd + * Copyright (C) 2024 moonleay + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package net.moonleay.lilJudd.data.api.splatoon3ink.schedules + + +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable + +@Serializable +data class VsRule( + @SerialName("id") + val id: String, + @SerialName("name") + val name: String, + @SerialName("rule") + val rule: String +) diff --git a/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/VsStage.kt b/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/VsStage.kt new file mode 100644 index 0000000..9d9ecb3 --- /dev/null +++ b/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/VsStage.kt @@ -0,0 +1,35 @@ +/* + * lilJudd + * Copyright (C) 2024 moonleay + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package net.moonleay.lilJudd.data.api.splatoon3ink.schedules + + +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable + +@Serializable +data class VsStage( + @SerialName("id") + val id: String, + @SerialName("image") + val image: net.moonleay.lilJudd.data.api.splatoon3ink.schedules.Image, + @SerialName("name") + val name: String, + @SerialName("vsStageId") + val vsStageId: Int +) diff --git a/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/VsStages.kt b/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/VsStages.kt new file mode 100644 index 0000000..21d32f1 --- /dev/null +++ b/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/VsStages.kt @@ -0,0 +1,29 @@ +/* + * lilJudd + * Copyright (C) 2024 moonleay + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package net.moonleay.lilJudd.data.api.splatoon3ink.schedules + + +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable + +@Serializable +data class VsStages( + @SerialName("nodes") + val nodes: List +) diff --git a/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/Weapon.kt b/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/Weapon.kt new file mode 100644 index 0000000..9b47a82 --- /dev/null +++ b/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/Weapon.kt @@ -0,0 +1,33 @@ +/* + * lilJudd + * Copyright (C) 2024 moonleay + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package net.moonleay.lilJudd.data.api.splatoon3ink.schedules + + +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable + +@Serializable +data class Weapon( + @SerialName("image") + val image: net.moonleay.lilJudd.data.api.splatoon3ink.schedules.Image, + @SerialName("name") + val name: String, + @SerialName("__splatoon3ink_id") + val splatoon3inkId: String +) diff --git a/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/XMatchSetting.kt b/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/XMatchSetting.kt new file mode 100644 index 0000000..7467db1 --- /dev/null +++ b/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/XMatchSetting.kt @@ -0,0 +1,35 @@ +/* + * lilJudd + * Copyright (C) 2024 moonleay + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package net.moonleay.lilJudd.data.api.splatoon3ink.schedules + + +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable + +@Serializable +data class XMatchSetting( + @SerialName("__isVsSetting") + val isVsSetting: String, + @SerialName("__typename") + val typename: String, + @SerialName("vsRule") + val vsRule: net.moonleay.lilJudd.data.api.splatoon3ink.schedules.VsRule, + @SerialName("vsStages") + val vsStages: List +) diff --git a/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/entry/schedule/ModeData.kt b/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/XNode.kt similarity index 57% rename from src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/entry/schedule/ModeData.kt rename to src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/XNode.kt index c3ad3dc..1a55bc5 100644 --- a/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/entry/schedule/ModeData.kt +++ b/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/XNode.kt @@ -1,6 +1,6 @@ /* * lilJudd - * Copyright (C) 2023 moonleay + * Copyright (C) 2024 moonleay * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,15 +16,20 @@ * along with this program. If not, see . */ -package net.moonleay.lilJudd.data.api.splatoon3ink.entry.schedule +package net.moonleay.lilJudd.data.api.splatoon3ink.schedules -data class ModeData( - val startTime: String, + +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable + +@Serializable +data class XNode( + @SerialName("endTime") val endTime: String, - val matchType: String, - val map1: MapData?, - val map2: MapData?, - val ruleSetName: String, - val ruleSet: String, - val mode: String, + @SerialName("festMatchSettings") + val festMatchSettings: net.moonleay.lilJudd.data.api.splatoon3ink.schedules.FestMatchSettingXX?, + @SerialName("startTime") + val startTime: String, + @SerialName("xMatchSetting") + val xMatchSetting: net.moonleay.lilJudd.data.api.splatoon3ink.schedules.XMatchSetting ) diff --git a/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/XSchedules.kt b/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/XSchedules.kt new file mode 100644 index 0000000..a3939c3 --- /dev/null +++ b/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/schedules/XSchedules.kt @@ -0,0 +1,29 @@ +/* + * lilJudd + * Copyright (C) 2024 moonleay + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package net.moonleay.lilJudd.data.api.splatoon3ink.schedules + + +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable + +@Serializable +data class XSchedules( + @SerialName("nodes") + val nodes: List +) diff --git a/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/type/ApiDataType.kt b/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/type/ApiDataType.kt deleted file mode 100644 index 7cb7361..0000000 --- a/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/type/ApiDataType.kt +++ /dev/null @@ -1,27 +0,0 @@ -/* - * lilJudd - * Copyright (C) 2023 moonleay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package net.moonleay.lilJudd.data.api.splatoon3ink.type - -enum class ApiDataType { - SCHEDULES, - SPLATNETGEAR, - COOP, - SPLATFESTS, - ALL -} diff --git a/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/type/ApiRequestType.kt b/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/type/ApiRequestType.kt deleted file mode 100644 index 03a9add..0000000 --- a/src/main/kotlin/net/moonleay/lilJudd/data/api/splatoon3ink/type/ApiRequestType.kt +++ /dev/null @@ -1,26 +0,0 @@ -/* - * lilJudd - * Copyright (C) 2023 moonleay - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package net.moonleay.lilJudd.data.api.splatoon3ink.type - -enum class ApiRequestType(val nameToDisplay: String) { - AUTOMATIC_CACHE_UPDATE("automatic request to update the cache"), - AUTOMATIC_CACHE_CREATION_AT_STARTUP("automatic request to create cache at startup"), - MANUAL("manual request"), - DEBUG("debug request") -}