Compare commits

...

4 commits

Author SHA1 Message Date
894e03c9c6
feat!: updated rest of the code to use new API system
Some checks are pending
Build Gradle project / build-gradle-project (push) Waiting to run
Signed-off-by: moonleay <contact@moonleay.net>
2024-01-18 18:35:17 +01:00
abd17b3256
chore!: removed unused updater cronjobs
Signed-off-by: moonleay <contact@moonleay.net>
2024-01-18 18:34:53 +01:00
ec92cac2e7
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 <contact@moonleay.net>
2024-01-18 18:34:11 +01:00
0f2410c7c1
chore: added KotlinxSerialization to project, bumped kotlin version
Signed-off-by: moonleay <contact@moonleay.net>
2024-01-18 18:31:57 +01:00
59 changed files with 1343 additions and 1080 deletions

View file

@ -1,6 +1,6 @@
/* /*
* lilJudd * lilJudd
* Copyright (C) 2023 moonleay * Copyright (C) 2024 moonleay
* *
* This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -21,7 +21,8 @@ import org.jetbrains.gradle.ext.TaskTriggersConfig
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins { plugins {
kotlin("jvm") version "1.9.10" kotlin("jvm") version "1.9.22"
kotlin("plugin.serialization") version "1.9.22"
id("com.github.johnrengelman.shadow") version "8.1.1" id("com.github.johnrengelman.shadow") version "8.1.1"
id("org.jetbrains.gradle.plugin.idea-ext") version "1.1.7" id("org.jetbrains.gradle.plugin.idea-ext") version "1.1.7"
`maven-publish` `maven-publish`
@ -40,6 +41,7 @@ val ktorver = "2.3.7"
val exposedver = "0.45.0" val exposedver = "0.45.0"
val postgresver = "42.7.1" val postgresver = "42.7.1"
val krontabver = "2.2.4" val krontabver = "2.2.4"
val kotlinxserializationver = "1.6.0"
val mavenArtifact = "lilJudd" val mavenArtifact = "lilJudd"
project.base.archivesName.set(mavenArtifact) project.base.archivesName.set(mavenArtifact)
@ -93,6 +95,9 @@ dependencies {
//Coroutines //Coroutines
shadow("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutinesver") shadow("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutinesver")
//JSON Stuff
shadow("org.jetbrains.kotlinx:kotlinx-serialization-json:$kotlinxserializationver")
//Logging //Logging
shadow("org.slf4j:slf4j-api:2.0.3") shadow("org.slf4j:slf4j-api:2.0.3")
shadow("org.slf4j:slf4j-simple:2.0.3") shadow("org.slf4j:slf4j-simple:2.0.3")
@ -121,7 +126,8 @@ val templateProps = mapOf(
"ktorversion" to ktorver, "ktorversion" to ktorver,
"exposedversion" to exposedver, "exposedversion" to exposedver,
"postgresversion" to postgresver, "postgresversion" to postgresver,
"krontabversion" to krontabver "krontabversion" to krontabver,
"kotlinxserializationversion" to kotlinxserializationver
) )

View file

@ -32,9 +32,7 @@ import kotlinx.coroutines.Job
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import net.moonleay.lilJudd.buttons.component.EditButtonManager import net.moonleay.lilJudd.buttons.component.EditButtonManager
import net.moonleay.lilJudd.data.CredentialManager import net.moonleay.lilJudd.data.CredentialManager
import net.moonleay.lilJudd.data.api.splatoon3ink.Splatoon3ApiCache import net.moonleay.lilJudd.data.api.splatoon3ink.Splatoon3Api
import net.moonleay.lilJudd.data.api.splatoon3ink.type.ApiDataType
import net.moonleay.lilJudd.data.api.splatoon3ink.type.ApiRequestType
import net.moonleay.lilJudd.data.database.DB import net.moonleay.lilJudd.data.database.DB
import net.moonleay.lilJudd.extensions.* import net.moonleay.lilJudd.extensions.*
import net.moonleay.lilJudd.features.AvailabilityManager import net.moonleay.lilJudd.features.AvailabilityManager
@ -173,7 +171,7 @@ object Bot {
} }
// Update the Splatoon 3 api data and make sure it stays up-to-date // Update the Splatoon 3 api data and make sure it stays up-to-date
Splatoon3ApiCache.updateData(ApiDataType.SCHEDULES, ApiRequestType.AUTOMATIC_CACHE_CREATION_AT_STARTUP) Splatoon3Api.updateSchedule()
JobManager.addJob(Splatoon3ApiScheduleUpdateScheduler) JobManager.addJob(Splatoon3ApiScheduleUpdateScheduler)
/* /*
Other caches will be added when implemented Other caches will be added when implemented
@ -183,10 +181,6 @@ object Bot {
// Had to disable bc of an error. // Had to disable bc of an error.
// Will fix when I have time // Will fix when I have time
//JobManager.addJob(Splatoon3ApiFestivalAndCoopUpdateScheduler)
//JobManager.addJob(Splatoon3ApiSplatnetGearUpdateScheduler)
//Start the bot //Start the bot
bot.start() bot.start()
} }

View file

@ -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 <https://www.gnu.org/licenses/>.
*/
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/<guild_id>/
// DELETE https://liljudd.ink/api/config/<guild_id>/
// GET https://liljudd.ink/api/tp_messages/<guild_id>/
// PUT https://liljudd.ink/api/tp_messages/<guild_id>/
// POST https://liljudd.ink/api/match/<guild_id>/<channel_id>/
// PUT https://liljudd.ink/api/match/<guild_id>/<channel_id>/<match_message_id>/
// GET https://liljudd.ink/api/match/<guild_id>/
}

View file

@ -1,6 +1,6 @@
/* /*
* lilJudd * lilJudd
* Copyright (C) 2023 moonleay * Copyright (C) 2024 moonleay
* *
* This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -18,98 +18,21 @@
package net.moonleay.lilJudd.data.api.splatoon3ink package net.moonleay.lilJudd.data.api.splatoon3ink
import net.moonleay.lilJudd.data.api.splatoon3ink.entry.schedule.ModeData import kotlinx.serialization.json.Json
import net.moonleay.lilJudd.util.TimeUtil import net.moonleay.lilJudd.data.api.splatoon3ink.schedules.Schedules
import net.moonleay.lilJudd.util.NetUtil
import net.moonleay.liljudd.build.BuildConstants
object Splatoon3Api { object Splatoon3Api {
private fun getRegularMode(timestamp: Long): ModeData {
Splatoon3ApiCache.cachedRegularModeData.map { modeData -> var schedules: net.moonleay.lilJudd.data.api.splatoon3ink.schedules.Schedules? = null
val startTime = TimeUtil.deformatJSONTime(modeData.startTime, "UTC")
val endTime = TimeUtil.deformatJSONTime(modeData.endTime, "UTC") fun updateSchedule() {
if (timestamp in startTime..endTime) { val response = NetUtil.GETJsonData("https://splatoon3.ink/data/schedules.json", "lilJudd/${BuildConstants.version}")
return modeData if (response.startsWith("error")){
} println("Error: $response")
return
} }
throw Exception("No current mode found") schedules = Json.decodeFromString(response)
}
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")
} }
} }

View file

@ -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 <https://www.gnu.org/licenses/>.
*/
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<SplatfestData>()
internal var cachedMapData = mutableMapOf<Int, MapData>()
internal var cachedRegularModeData = mutableListOf<ModeData>()
internal var cachedCompetitiveSeriesModeData = mutableListOf<ModeData>()
internal var cachedCompetitiveOpenModeData = mutableListOf<ModeData>()
internal var cachedXModeData = mutableListOf<ModeData>()
internal var cachedChallengesData = mutableListOf<ChallengeModeData>()
internal var cachedShiftData = mutableListOf<ShiftData>()
internal var cachedBigRunShiftData = mutableListOf<ShiftData>()
internal var cachedCoopRewardsData =
mutableListOf<CoopGearData>()
internal var cachedSplatnetItemData = mutableListOf<SplatnetItemData>()
internal var cachedSplatnetLimitedItemData = mutableListOf<SplatnetItemData>()
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<GearAbilityData>()
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<GearAbilityData>()
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}")
}
}
}

View file

@ -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 <https://www.gnu.org/licenses/>.
*/
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")
}
}

View file

@ -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 <https://www.gnu.org/licenses/>.
*/
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,
)

View file

@ -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 <https://www.gnu.org/licenses/>.
*/
package net.moonleay.lilJudd.data.api.splatoon3ink.entry.splatfest
data class SplatfestTeamData(
val teamName: String,
val color: SplatfestColor,
val results: SplatfestTeamResults?,
)

View file

@ -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 <https://www.gnu.org/licenses/>.
*/
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,
)

View file

@ -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 <https://www.gnu.org/licenses/>.
*/
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<GearAbilityData>,
val image: Url,
val brand: BrandData,
)

View file

@ -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 <https://www.gnu.org/licenses/>.
*/
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<net.moonleay.lilJudd.data.api.splatoon3ink.schedules.VsStage>
)

View file

@ -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 <https://www.gnu.org/licenses/>.
*/
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<net.moonleay.lilJudd.data.api.splatoon3ink.schedules.BankaraMatchSetting>?,
@SerialName("endTime")
val endTime: String,
@SerialName("festMatchSettings")
val festMatchSettings: List<net.moonleay.lilJudd.data.api.splatoon3ink.schedules.FestMatchSettingX>?,
@SerialName("startTime")
val startTime: String
)

View file

@ -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 <https://www.gnu.org/licenses/>.
*/
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<net.moonleay.lilJudd.data.api.splatoon3ink.schedules.BankaraNode>
)

View file

@ -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 <https://www.gnu.org/licenses/>.
*/
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
)

View file

@ -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 <https://www.gnu.org/licenses/>.
*/
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<net.moonleay.lilJudd.data.api.splatoon3ink.schedules.BigRunScheduleNode>
)

View file

@ -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 <https://www.gnu.org/licenses/>.
*/
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
)

View file

@ -1,6 +1,6 @@
/* /*
* lilJudd * lilJudd
* Copyright (C) 2023 moonleay * Copyright (C) 2024 moonleay
* *
* This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -16,11 +16,20 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
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, val a: Int,
@SerialName("b")
val b: Double, val b: Double,
@SerialName("g")
val g: Double, val g: Double,
val r: Double, @SerialName("r")
val r: Double
) )

View file

@ -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 <https://www.gnu.org/licenses/>.
*/
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?
)

View file

@ -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 <https://www.gnu.org/licenses/>.
*/
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
)

View file

@ -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 <https://www.gnu.org/licenses/>.
*/
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<net.moonleay.lilJudd.data.api.splatoon3ink.schedules.Team>,
@SerialName("title")
val title: String,
@SerialName("tricolorStage")
val tricolorStage: net.moonleay.lilJudd.data.api.splatoon3ink.schedules.TricolorStage
)

View file

@ -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 <https://www.gnu.org/licenses/>.
*/
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
)

View file

@ -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 <https://www.gnu.org/licenses/>.
*/
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<net.moonleay.lilJudd.data.api.splatoon3ink.schedules.TimePeriod>
)

View file

@ -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 <https://www.gnu.org/licenses/>.
*/
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<net.moonleay.lilJudd.data.api.splatoon3ink.schedules.EventNode>
)

View file

@ -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 <https://www.gnu.org/licenses/>.
*/
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<net.moonleay.lilJudd.data.api.splatoon3ink.schedules.VsStage>
)

View file

@ -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 <https://www.gnu.org/licenses/>.
*/
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
)

View file

@ -1,6 +1,6 @@
/* /*
* lilJudd * lilJudd
* Copyright (C) 2023 moonleay * Copyright (C) 2024 moonleay
* *
* This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -16,19 +16,18 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package net.moonleay.lilJudd.data.api.splatoon3ink.entry.schedule package net.moonleay.lilJudd.data.api.splatoon3ink.schedules
import io.ktor.http.*
data class ShiftData( import kotlinx.serialization.SerialName
val startTime: String, import kotlinx.serialization.Serializable
@Serializable
data class FestNode(
@SerialName("endTime")
val endTime: String, val endTime: String,
val __splatoon3ink_king_salmonid_guess: String, @SerialName("festMatchSettings")
val __typename: String, val festMatchSettings: net.moonleay.lilJudd.data.api.splatoon3ink.schedules.FestMatchSettingX?,
val stageName: String, @SerialName("startTime")
val image: Url, val startTime: String
val weapon1: WeaponData,
val weapon2: WeaponData,
val weapon3: WeaponData,
val weapon4: WeaponData,
) )

View file

@ -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 <https://www.gnu.org/licenses/>.
*/
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<net.moonleay.lilJudd.data.api.splatoon3ink.schedules.FestNode>
)

View file

@ -1,6 +1,6 @@
/* /*
* lilJudd * lilJudd
* Copyright (C) 2023 moonleay * Copyright (C) 2024 moonleay
* *
* This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -16,11 +16,14 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package net.moonleay.lilJudd.data.api.splatoon3ink.entry.schedule package net.moonleay.lilJudd.data.api.splatoon3ink.schedules
import io.ktor.http.*
data class WeaponData( import kotlinx.serialization.SerialName
val name: String, import kotlinx.serialization.Serializable
val image: Url,
@Serializable
data class Image(
@SerialName("url")
val url: String
) )

View file

@ -1,6 +1,6 @@
/* /*
* lilJudd * lilJudd
* Copyright (C) 2023 moonleay * Copyright (C) 2024 moonleay
* *
* This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -16,19 +16,24 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
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, val leagueMatchEventId: String,
@SerialName("name")
val name: String, val name: String,
val description: String, @SerialName("regulation")
val regulation: String, val regulation: String,
val map1: MapData?, @SerialName("regulationUrl")
val map2: MapData?, val regulationUrl: String? // is null
val __typename: String,
val ruleSet: String,
val ruleSetName: String,
val timePeriod1: TimePeriodData,
val timePeriod2: TimePeriodData,
val timePeriod3: TimePeriodData,
) )

View file

@ -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 <https://www.gnu.org/licenses/>.
*/
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<net.moonleay.lilJudd.data.api.splatoon3ink.schedules.VsStage>
)

View file

@ -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 <https://www.gnu.org/licenses/>.
*/
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
)

View file

@ -1,6 +1,6 @@
/* /*
* lilJudd * lilJudd
* Copyright (C) 2023 moonleay * Copyright (C) 2024 moonleay
* *
* This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -16,13 +16,14 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package net.moonleay.lilJudd.data.api.splatoon3ink.entry.splatnet package net.moonleay.lilJudd.data.api.splatoon3ink.schedules
import io.ktor.http.*
data class BrandData( import kotlinx.serialization.SerialName
val name: String, import kotlinx.serialization.Serializable
val image: Url,
val usualGearPower: GearAbilityData?, @Serializable
val saleEndTime: String?, data class OriginalImage(
@SerialName("url")
val url: String
) )

View file

@ -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 <https://www.gnu.org/licenses/>.
*/
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<net.moonleay.lilJudd.data.api.splatoon3ink.schedules.VsStage>
)

View file

@ -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 <https://www.gnu.org/licenses/>.
*/
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
)

View file

@ -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 <https://www.gnu.org/licenses/>.
*/
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<net.moonleay.lilJudd.data.api.splatoon3ink.schedules.BigRunScheduleNode>
)

View file

@ -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 <https://www.gnu.org/licenses/>.
*/
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<net.moonleay.lilJudd.data.api.splatoon3ink.schedules.RegularNode>
)

View file

@ -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 <https://www.gnu.org/licenses/>.
*/
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
)

View file

@ -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 <https://www.gnu.org/licenses/>.
*/
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
)

View file

@ -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 <https://www.gnu.org/licenses/>.
*/
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<net.moonleay.lilJudd.data.api.splatoon3ink.schedules.Weapon>
)

View file

@ -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 <https://www.gnu.org/licenses/>.
*/
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?
)

View file

@ -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 <https://www.gnu.org/licenses/>.
*/
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<Int> // This is a placeholder.
)

View file

@ -1,6 +1,6 @@
/* /*
* lilJudd * lilJudd
* Copyright (C) 2023 moonleay * Copyright (C) 2024 moonleay
* *
* This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -16,12 +16,14 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package net.moonleay.lilJudd.data.api.splatoon3ink.entry.splatnet package net.moonleay.lilJudd.data.api.splatoon3ink.schedules
import io.ktor.http.*
data class GearAbilityData( import kotlinx.serialization.SerialName
val name: String, import kotlinx.serialization.Serializable
val description: String?,
val image: Url, @Serializable
data class ThumbnailImage(
@SerialName("url")
val url: String
) )

View file

@ -1,6 +1,6 @@
/* /*
* lilJudd * lilJudd
* Copyright (C) 2023 moonleay * Copyright (C) 2024 moonleay
* *
* This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -16,9 +16,16 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
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, val endTime: String,
@SerialName("startTime")
val startTime: String
) )

View file

@ -1,6 +1,6 @@
/* /*
* lilJudd * lilJudd
* Copyright (C) 2023 moonleay * Copyright (C) 2024 moonleay
* *
* This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -16,18 +16,18 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
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 id: String,
val state: String, @SerialName("image")
val startTime: String, val image: net.moonleay.lilJudd.data.api.splatoon3ink.schedules.Image,
val endTime: String, @SerialName("name")
val title: String, val name: String
val image: Url,
val team1: SplatfestTeamData,
val team2: SplatfestTeamData,
val team3: SplatfestTeamData,
) )

View file

@ -1,6 +1,6 @@
/* /*
* lilJudd * lilJudd
* Copyright (C) 2023 moonleay * Copyright (C) 2024 moonleay
* *
* This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -16,12 +16,14 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package net.moonleay.lilJudd.data.api.splatoon3ink.entry.schedule package net.moonleay.lilJudd.data.api.splatoon3ink.schedules
import io.ktor.http.*
data class MapData( import kotlinx.serialization.SerialName
val stageID: Int, import kotlinx.serialization.Serializable
val image: Url,
val name: String, @Serializable
data class UserIcon(
@SerialName("url")
val url: String
) )

View file

@ -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 <https://www.gnu.org/licenses/>.
*/
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
)

View file

@ -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 <https://www.gnu.org/licenses/>.
*/
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
)

View file

@ -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 <https://www.gnu.org/licenses/>.
*/
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<net.moonleay.lilJudd.data.api.splatoon3ink.schedules.MapNode>
)

View file

@ -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 <https://www.gnu.org/licenses/>.
*/
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
)

View file

@ -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 <https://www.gnu.org/licenses/>.
*/
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<net.moonleay.lilJudd.data.api.splatoon3ink.schedules.VsStage>
)

View file

@ -1,6 +1,6 @@
/* /*
* lilJudd * lilJudd
* Copyright (C) 2023 moonleay * Copyright (C) 2024 moonleay
* *
* This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -16,15 +16,20 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
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 endTime: String,
val matchType: String, @SerialName("festMatchSettings")
val map1: MapData?, val festMatchSettings: net.moonleay.lilJudd.data.api.splatoon3ink.schedules.FestMatchSettingXX?,
val map2: MapData?, @SerialName("startTime")
val ruleSetName: String, val startTime: String,
val ruleSet: String, @SerialName("xMatchSetting")
val mode: String, val xMatchSetting: net.moonleay.lilJudd.data.api.splatoon3ink.schedules.XMatchSetting
) )

View file

@ -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 <https://www.gnu.org/licenses/>.
*/
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<net.moonleay.lilJudd.data.api.splatoon3ink.schedules.XNode>
)

View file

@ -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 <https://www.gnu.org/licenses/>.
*/
package net.moonleay.lilJudd.data.api.splatoon3ink.type
enum class ApiDataType {
SCHEDULES,
SPLATNETGEAR,
COOP,
SPLATFESTS,
ALL
}

View file

@ -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 <https://www.gnu.org/licenses/>.
*/
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")
}

View file

@ -1,50 +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 <https://www.gnu.org/licenses/>.
*/
package net.moonleay.lilJudd.jobs
import dev.inmo.krontab.KronScheduler
import kotlinx.coroutines.Job
import net.moonleay.lilJudd.data.api.splatoon3ink.Splatoon3ApiCache
import net.moonleay.lilJudd.data.api.splatoon3ink.type.ApiDataType
import net.moonleay.lilJudd.data.api.splatoon3ink.type.ApiRequestType
import net.moonleay.lilJudd.jobs.component.CronjobType
import net.moonleay.lilJudd.jobs.component.ICronjob
import net.moonleay.lilJudd.util.Logger
object Splatoon3ApiFestivalAndCoopUpdateScheduler : ICronjob {
override val jobName: String
get() = "Splatoon3ApiFestivalAndCoopUpdateScheduler"
override val jobIncoming: String
get() = "0 0 0 /1 * * 0o *" // once a day
override val jobType: CronjobType
get() = CronjobType.INFINITE
override val continueJob: Boolean
get() = true
override lateinit var cronjobJob: Job
override lateinit var scheduler: KronScheduler
override suspend fun jobFunction() {
Logger.out("Running Splatoon3ApiFestivalUpdateScheduler.")
Splatoon3ApiCache.updateData(ApiDataType.SPLATFESTS, ApiRequestType.AUTOMATIC_CACHE_UPDATE)
Logger.out("Splatoon3ApiFestivalUpdateScheduler finished.")
Logger.out("Running Splatoon3ApiCoopUpdateScheduler.")
Splatoon3ApiCache.updateData(ApiDataType.COOP, ApiRequestType.AUTOMATIC_CACHE_UPDATE)
Logger.out("Splatoon3ApiCoopUpdateScheduler finished.")
}
}

View file

@ -20,9 +20,7 @@ package net.moonleay.lilJudd.jobs
import dev.inmo.krontab.KronScheduler import dev.inmo.krontab.KronScheduler
import kotlinx.coroutines.Job import kotlinx.coroutines.Job
import net.moonleay.lilJudd.data.api.splatoon3ink.Splatoon3ApiCache import net.moonleay.lilJudd.data.api.splatoon3ink.Splatoon3Api
import net.moonleay.lilJudd.data.api.splatoon3ink.type.ApiDataType
import net.moonleay.lilJudd.data.api.splatoon3ink.type.ApiRequestType
import net.moonleay.lilJudd.jobs.component.CronjobType import net.moonleay.lilJudd.jobs.component.CronjobType
import net.moonleay.lilJudd.jobs.component.ICronjob import net.moonleay.lilJudd.jobs.component.ICronjob
import net.moonleay.lilJudd.util.Logger import net.moonleay.lilJudd.util.Logger
@ -40,8 +38,8 @@ object Splatoon3ApiScheduleUpdateScheduler : ICronjob {
override lateinit var scheduler: KronScheduler override lateinit var scheduler: KronScheduler
override suspend fun jobFunction() { override suspend fun jobFunction() {
Logger.out("Running Splatoon3ApiScheduleUpdateScheduler.") Logger.out("Updating Schedules...")
Splatoon3ApiCache.updateData(ApiDataType.SCHEDULES, ApiRequestType.AUTOMATIC_CACHE_UPDATE) Splatoon3Api.updateSchedule()
Logger.out("Splatoon3ApiScheduleUpdateScheduler finished.") Logger.out("Updating finished.")
} }
} }

View file

@ -1,47 +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 <https://www.gnu.org/licenses/>.
*/
package net.moonleay.lilJudd.jobs
import dev.inmo.krontab.KronScheduler
import kotlinx.coroutines.Job
import net.moonleay.lilJudd.data.api.splatoon3ink.Splatoon3ApiCache
import net.moonleay.lilJudd.data.api.splatoon3ink.type.ApiDataType
import net.moonleay.lilJudd.data.api.splatoon3ink.type.ApiRequestType
import net.moonleay.lilJudd.jobs.component.CronjobType
import net.moonleay.lilJudd.jobs.component.ICronjob
import net.moonleay.lilJudd.util.Logger
object Splatoon3ApiSplatnetGearUpdateScheduler : ICronjob {
override val jobName: String
get() = "Splatoon3ApiSplatnetGearUpdateScheduler"
override val jobIncoming: String
get() = "0 0 /6 * * * 0o *" //Every 6 hours
override val jobType: CronjobType
get() = CronjobType.INFINITE
override val continueJob: Boolean
get() = true
override lateinit var cronjobJob: Job
override lateinit var scheduler: KronScheduler
override suspend fun jobFunction() {
Logger.out("Running Splatoon3ApiSplatnetGearUpdateScheduler.")
Splatoon3ApiCache.updateData(ApiDataType.SPLATNETGEAR, ApiRequestType.AUTOMATIC_CACHE_UPDATE)
Logger.out("Splatoon3ApiSplatnetGearUpdateScheduler finished.")
}
}

View file

@ -1,6 +1,6 @@
/* /*
* lilJudd * lilJudd
* Copyright (C) 2023 moonleay * Copyright (C) 2024 moonleay
* *
* This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -22,7 +22,7 @@ import dev.inmo.krontab.KronScheduler
import dev.kord.common.entity.PresenceStatus import dev.kord.common.entity.PresenceStatus
import kotlinx.coroutines.Job import kotlinx.coroutines.Job
import net.moonleay.lilJudd.Bot import net.moonleay.lilJudd.Bot
import net.moonleay.lilJudd.data.api.Splatoon3Api import net.moonleay.lilJudd.data.api.splatoon3ink.Splatoon3ApiDataGrabber
import net.moonleay.lilJudd.jobs.component.CronjobType import net.moonleay.lilJudd.jobs.component.CronjobType
import net.moonleay.lilJudd.jobs.component.ICronjob import net.moonleay.lilJudd.jobs.component.ICronjob
@ -56,11 +56,11 @@ object StatusUpdater : ICronjob {
private fun refreshStatusList(timestamp: Long) { private fun refreshStatusList(timestamp: Long) {
statusList = listOf( statusList = listOf(
Splatoon3Api.getRotationTime(timestamp), Splatoon3ApiDataGrabber.getRotationTime(timestamp),
Splatoon3Api.getRegularMapsFormatted(timestamp), Splatoon3ApiDataGrabber.getRegularMapsFormatted(timestamp),
Splatoon3Api.getOpenMapFormatted(timestamp), Splatoon3ApiDataGrabber.getOpenMapFormatted(timestamp),
Splatoon3Api.getSeriesMapsFormatted(timestamp), Splatoon3ApiDataGrabber.getSeriesMapsFormatted(timestamp),
Splatoon3Api.getXMapFormatted(timestamp) Splatoon3ApiDataGrabber.getXMapFormatted(timestamp)
) )
} }
} }

View file

@ -1,6 +1,6 @@
/* /*
* lilJudd * lilJudd
* Copyright (C) 2023 moonleay * Copyright (C) 2024 moonleay
* *
* This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -27,4 +27,5 @@ internal object BuildConstants {
const val exposedVersion = "${exposedversion}" const val exposedVersion = "${exposedversion}"
const val postgresVersion = "${postgresversion}" const val postgresVersion = "${postgresversion}"
const val krontabVersion = "${krontabversion}" const val krontabVersion = "${krontabversion}"
const val kotlinXSerializationVerson = "${kotlinxserializationversion}"
} }