feat: added Splatoon3.ink API
Signed-off-by: moonleay <contact@moonleay.net>
This commit is contained in:
parent
cd37bd1242
commit
93223fa0ab
18 changed files with 1112 additions and 0 deletions
117
src/main/kotlin/net/moonleay/lilJudd/data/api/Splatoon3Api.kt
Normal file
117
src/main/kotlin/net/moonleay/lilJudd/data/api/Splatoon3Api.kt
Normal file
|
@ -0,0 +1,117 @@
|
|||
/*
|
||||
* 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
|
||||
|
||||
import net.moonleay.lilJudd.data.api.entry.schedule.ModeData
|
||||
import net.moonleay.lilJudd.util.TimeUtil
|
||||
|
||||
object Splatoon3Api {
|
||||
private fun getRegularMode(timestamp: Long): ModeData {
|
||||
Splatoon3ApiCache.cachedRegularModeData.map { modeData ->
|
||||
val startTime = TimeUtil.deformatJSONTime(modeData.startTime, "UTC")
|
||||
val endTime = TimeUtil.deformatJSONTime(modeData.endTime, "UTC")
|
||||
if (timestamp in startTime..endTime) {
|
||||
return modeData
|
||||
}
|
||||
}
|
||||
throw Exception("No current mode found")
|
||||
}
|
||||
|
||||
private fun getOpenMode(timestamp: Long): ModeData {
|
||||
Splatoon3ApiCache.cachedCompetitiveOpenModeData.map { modeData ->
|
||||
val startTime = TimeUtil.deformatJSONTime(modeData.startTime, "UTC")
|
||||
val endTime = TimeUtil.deformatJSONTime(modeData.endTime, "UTC")
|
||||
if (timestamp in startTime..endTime) {
|
||||
return modeData
|
||||
}
|
||||
}
|
||||
throw Exception("No current mode found")
|
||||
}
|
||||
|
||||
private fun getXMode(timestamp: Long): ModeData {
|
||||
Splatoon3ApiCache.cachedXModeData.map { modeData ->
|
||||
val startTime = TimeUtil.deformatJSONTime(modeData.startTime, "UTC")
|
||||
val endTime = TimeUtil.deformatJSONTime(modeData.endTime, "UTC")
|
||||
if (timestamp in startTime..endTime) {
|
||||
return modeData
|
||||
}
|
||||
}
|
||||
throw Exception("No current mode found")
|
||||
}
|
||||
|
||||
private fun getSeriesMode(timestamp: Long): ModeData {
|
||||
Splatoon3ApiCache.cachedCompetitiveSeriesModeData.map { modeData ->
|
||||
val startTime = TimeUtil.deformatJSONTime(modeData.startTime, "UTC")
|
||||
val endTime = TimeUtil.deformatJSONTime(modeData.endTime, "UTC")
|
||||
if (timestamp in startTime..endTime) {
|
||||
return modeData
|
||||
}
|
||||
}
|
||||
throw Exception("No current mode found")
|
||||
}
|
||||
|
||||
fun 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 getOpenModeFormatted(timestamp: Long): String {
|
||||
val modeData = getOpenMode(timestamp)
|
||||
val endTime = TimeUtil.deformatJSONTime(modeData.endTime, "UTC")
|
||||
val diffStamp = TimeUtil.getTimeDifferenceFormatted(System.currentTimeMillis(), endTime)
|
||||
return "O: ${modeData.ruleSetName} $diffStamp left"
|
||||
}
|
||||
|
||||
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: $map1 & $map2"
|
||||
}
|
||||
|
||||
fun getSeriesModeFormatted(timestamp: Long): String {
|
||||
val modeData = getSeriesMode(timestamp)
|
||||
val endTime = TimeUtil.deformatJSONTime(modeData.endTime, "UTC")
|
||||
val diffStamp = TimeUtil.getTimeDifferenceFormatted(System.currentTimeMillis(), endTime)
|
||||
return "S: ${modeData.ruleSetName} $diffStamp left"
|
||||
}
|
||||
|
||||
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: $map1 & $map2"
|
||||
}
|
||||
|
||||
fun getXModeFormatted(timestamp: Long): String {
|
||||
val modeData = getXMode(timestamp)
|
||||
val endTime = TimeUtil.deformatJSONTime(modeData.endTime, "UTC")
|
||||
val diffStamp = TimeUtil.getTimeDifferenceFormatted(System.currentTimeMillis(), endTime)
|
||||
return "X: ${modeData.ruleSetName} $diffStamp left"
|
||||
}
|
||||
|
||||
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: $map1 & $map2"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,535 @@
|
|||
/*
|
||||
* 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
|
||||
|
||||
import io.ktor.http.*
|
||||
import kotlinx.serialization.json.*
|
||||
import net.moonleay.botendo.build.BuildConstants
|
||||
import net.moonleay.lilJudd.data.api.entry.coop.CoopGearData
|
||||
import net.moonleay.lilJudd.data.api.entry.schedule.*
|
||||
import net.moonleay.lilJudd.data.api.entry.splatfest.SplatfestColor
|
||||
import net.moonleay.lilJudd.data.api.entry.splatfest.SplatfestData
|
||||
import net.moonleay.lilJudd.data.api.entry.splatfest.SplatfestTeamData
|
||||
import net.moonleay.lilJudd.data.api.entry.splatfest.SplatfestTeamResults
|
||||
import net.moonleay.lilJudd.data.api.entry.splatnet.BrandData
|
||||
import net.moonleay.lilJudd.data.api.entry.splatnet.GearAbilityData
|
||||
import net.moonleay.lilJudd.data.api.entry.splatnet.SplatnetItemData
|
||||
import net.moonleay.lilJudd.data.api.type.ApiDataType
|
||||
import net.moonleay.lilJudd.data.api.type.ApiRequestType
|
||||
import net.moonleay.lilJudd.util.Logger
|
||||
import net.moonleay.lilJudd.util.NetUtil
|
||||
|
||||
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
|
||||
}
|
||||
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")
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
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")
|
||||
|
||||
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")
|
||||
|
||||
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")
|
||||
|
||||
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")
|
||||
|
||||
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")
|
||||
|
||||
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)
|
||||
)
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
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")
|
||||
|
||||
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
|
||||
}
|
||||
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")
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
* 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.entry.coop
|
||||
|
||||
import io.ktor.http.*
|
||||
|
||||
data class CoopGearData(
|
||||
val name: String,
|
||||
val image: Url,
|
||||
val __typename: String,
|
||||
|
||||
)
|
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
* 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.entry.schedule
|
||||
|
||||
data class ChallengeModeData(
|
||||
val leagueMatchEventId: String,
|
||||
val name: String,
|
||||
val description: String,
|
||||
val regulation: String,
|
||||
val map1: MapData?,
|
||||
val map2: MapData?,
|
||||
val __typename: String,
|
||||
val ruleSet: String,
|
||||
val ruleSetName: String,
|
||||
val timePeriod1: TimePeriodData,
|
||||
val timePeriod2: TimePeriodData,
|
||||
val timePeriod3: TimePeriodData,
|
||||
)
|
|
@ -0,0 +1,27 @@
|
|||
/*
|
||||
* 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.entry.schedule
|
||||
|
||||
import io.ktor.http.*
|
||||
|
||||
data class MapData(
|
||||
val stageID: Int,
|
||||
val image: Url,
|
||||
val name: String,
|
||||
)
|
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
* 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.entry.schedule
|
||||
|
||||
data class ModeData(
|
||||
val startTime: String,
|
||||
val endTime: String,
|
||||
val matchType: String,
|
||||
val map1: MapData?,
|
||||
val map2: MapData?,
|
||||
val ruleSetName: String,
|
||||
val ruleSet: String,
|
||||
val mode: String,
|
||||
)
|
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
* 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.entry.schedule
|
||||
|
||||
import io.ktor.http.*
|
||||
|
||||
data class ShiftData(
|
||||
val startTime: String,
|
||||
val endTime: String,
|
||||
val __splatoon3ink_king_salmonid_guess: String,
|
||||
val __typename: String,
|
||||
val stageName: String,
|
||||
val image: Url,
|
||||
val weapon1: WeaponData,
|
||||
val weapon2: WeaponData,
|
||||
val weapon3: WeaponData,
|
||||
val weapon4: WeaponData,
|
||||
)
|
|
@ -0,0 +1,24 @@
|
|||
/*
|
||||
* 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.entry.schedule
|
||||
|
||||
data class TimePeriodData(
|
||||
val startTime: String,
|
||||
val endTime: String,
|
||||
)
|
|
@ -0,0 +1,26 @@
|
|||
/*
|
||||
* 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.entry.schedule
|
||||
|
||||
import io.ktor.http.*
|
||||
|
||||
data class WeaponData(
|
||||
val name: String,
|
||||
val image: Url,
|
||||
)
|
|
@ -0,0 +1,26 @@
|
|||
/*
|
||||
* 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.entry.splatfest
|
||||
|
||||
data class SplatfestColor(
|
||||
val a: Int,
|
||||
val b: Double,
|
||||
val g: Double,
|
||||
val r: Double,
|
||||
)
|
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* 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.entry.splatfest
|
||||
|
||||
import io.ktor.http.*
|
||||
|
||||
data class SplatfestData(
|
||||
val id: String,
|
||||
val state: String,
|
||||
val startTime: String,
|
||||
val endTime: String,
|
||||
val title: String,
|
||||
val image: Url,
|
||||
val team1: SplatfestTeamData,
|
||||
val team2: SplatfestTeamData,
|
||||
val team3: SplatfestTeamData,
|
||||
)
|
|
@ -0,0 +1,25 @@
|
|||
/*
|
||||
* 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.entry.splatfest
|
||||
|
||||
data class SplatfestTeamData(
|
||||
val teamName: String,
|
||||
val color: SplatfestColor,
|
||||
val results: SplatfestTeamResults?,
|
||||
)
|
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* 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.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,
|
||||
)
|
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
* 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.entry.splatnet
|
||||
|
||||
import io.ktor.http.*
|
||||
|
||||
data class BrandData(
|
||||
val name: String,
|
||||
val image: Url,
|
||||
val usualGearPower: GearAbilityData?,
|
||||
val saleEndTime: String?,
|
||||
)
|
|
@ -0,0 +1,27 @@
|
|||
/*
|
||||
* 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.entry.splatnet
|
||||
|
||||
import io.ktor.http.*
|
||||
|
||||
data class GearAbilityData(
|
||||
val name: String,
|
||||
val description: String?,
|
||||
val image: Url,
|
||||
)
|
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
* 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.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,
|
||||
)
|
|
@ -0,0 +1,27 @@
|
|||
/*
|
||||
* 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.type
|
||||
|
||||
enum class ApiDataType {
|
||||
SCHEDULES,
|
||||
SPLATNETGEAR,
|
||||
COOP,
|
||||
SPLATFESTS,
|
||||
ALL
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
/*
|
||||
* 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.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")
|
||||
}
|
Loading…
Reference in a new issue