Skip to content

Commit

Permalink
feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
RayDeeUx committed May 26, 2024
1 parent 4d51a56 commit 17d578a
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/main/java/at/hannibal2/skyhanni/features/misc/WhereWillIBe.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package at.hannibal2.skyhanni.features.misc

import at.hannibal2.skyhanni.data.IslandType
import at.hannibal2.skyhanni.data.WinterAPI
import at.hannibal2.skyhanni.events.MessageSendToServerEvent
import at.hannibal2.skyhanni.utils.ChatUtils
import at.hannibal2.skyhanni.utils.LorenzUtils
Expand All @@ -13,29 +14,30 @@ import kotlin.math.pow
import kotlin.random.Random

object WhereWillIBe {
private val nonIslands = listOf(IslandType.NONE, IslandType.UNKNOWN, IslandType.MINESHAFT) // IslandType.MINESHAFT == pain
private val nonIslands = listOf(IslandType.NONE, IslandType.UNKNOWN, IslandType.MINESHAFT)
private val privateOrGuest = listOf(IslandType.PRIVATE_ISLAND_GUEST, IslandType.PRIVATE_ISLAND, IslandType.GARDEN_GUEST)
private val onceOnlyIslands = listOf(IslandType.DARK_AUCTION, IslandType.KUUDRA_ARENA, IslandType.CATACOMBS, IslandType.THE_RIFT) // add/remove islands as you see fit, but DARK_AUCTION should stay in here
private val islandsAsList = IslandType.entries.toList().filter { it !in nonIslands }.toMutableList()
private val onceOnlyIslands =
listOf(IslandType.DARK_AUCTION, IslandType.KUUDRA_ARENA, IslandType.CATACOMBS, IslandType.THE_RIFT)
@SubscribeEvent
fun onMessageSendToServer(event: MessageSendToServerEvent) {
if (!LorenzUtils.onHypixel) return
if (event.message.lowercase() != "/wherewillibe") return
event.setCanceled(true)
event.cancel()
val islandsAsList = IslandType.entries.toList().filter { it !in nonIslands }.toMutableList()
if (SkyBlockTime.now().month != 12) islandsAsList.remove(IslandType.WINTER)
var lastUsedMillis = SimpleTimeMark.now().toMillis()
var lastIsland = IslandType.NONE // to prevent an island from proccing consecutively
var chosenIsland = IslandType.NONE // to prevent an island from proccing consecutively
var lastIsland = IslandType.NONE
var chosenIsland = IslandType.NONE
ChatUtils.chat("§aYour future servers:", false)
for (i in 2..Random.nextInt(2,11)) {
repeat(Random.nextInt(2, 11)) {
val chosenIslands = if (Random.nextBoolean()) islandsAsList.filter { it !in privateOrGuest } else islandsAsList
val randomMillis = Random.nextLong(lastUsedMillis, lastUsedMillis + Random.nextLong(10000, 2.0.pow(26).toLong()))
lastUsedMillis = randomMillis // make sure all timestamps are advancing forward
while (chosenIsland == lastIsland) chosenIsland = chosenIslands.shuffled().first()
lastIsland = chosenIsland
if (chosenIsland in onceOnlyIslands) islandsAsList.remove(chosenIsland) // prevent islands from appearing more than once
val serverType = if (chosenIsland == IslandType.HUB) listOf("mini", "mega").random() else "mini"
val randInt = if (serverType == "mini") Random.nextInt(10, 99) else Random.nextInt(10, 100) * Random.nextInt(1, 4)
val randInt = if (serverType == "mini") Random.nextInt(10, 100) else Random.nextInt(10, 401)
val randLetter = if (Random.nextBoolean()) "${('A'..'Z').random()}" else "${('A'..'Z').random()}${('A'..'Z').random()}"
val randomServerID = "$serverType${randInt}$randLetter"
val randomIsland = "SkyBlock (${chosenIsland.displayName})"
Expand Down

0 comments on commit 17d578a

Please sign in to comment.