Skip to content
This repository has been archived by the owner on Dec 28, 2024. It is now read-only.

KuudraStartEvent #18

Merged
merged 2 commits into from
Sep 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
mod_name = Rat-ons
mod_id = ratons
mod_version = 0.0.1
skyhanni_version = 0.27.Beta.4
skyhanni_version = 0.27.Beta.8

loom.platform=forge
org.gradle.jvmargs=-Xmx4g
5 changes: 5 additions & 0 deletions src/main/kotlin/com/ratons/Ratons.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import com.ratons.commands.Commands
import com.ratons.config.features.Features
import com.ratons.features.instances.AutoRefill
import com.ratons.features.misc.UpdateManager
import com.ratons.utils.KuudraAPI
import net.minecraft.client.Minecraft
import net.minecraftforge.common.MinecraftForge
import net.minecraftforge.fml.common.Mod
Expand All @@ -17,6 +18,7 @@ import java.io.File

@Mod(
modid = Ratons.MOD_ID,
name = Ratons.MOD_NAME,
clientSideOnly = true,
useMetadata = true,
version = Ratons.VERSION,
Expand All @@ -33,6 +35,9 @@ class Ratons {
AutoRefill,
UpdateManager,

// utils
KuudraAPI,

).loadModules()

Commands.init()
Expand Down
5 changes: 5 additions & 0 deletions src/main/kotlin/com/ratons/events/KuudraStartEvent.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package com.ratons.events

import at.hannibal2.skyhanni.api.event.SkyHanniEvent

class KuudraStartEvent(val kuudraTier: Int?) : SkyHanniEvent()
14 changes: 5 additions & 9 deletions src/main/kotlin/com/ratons/features/instances/AutoRefill.kt
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
package com.ratons.features.instances

import at.hannibal2.skyhanni.api.GetFromSackAPI
import at.hannibal2.skyhanni.api.event.HandleEvent
import at.hannibal2.skyhanni.data.SackAPI.getAmountInSacks
import at.hannibal2.skyhanni.events.DungeonStartEvent
import at.hannibal2.skyhanni.events.KuudraEnterEvent
import at.hannibal2.skyhanni.features.dungeon.DungeonAPI
import at.hannibal2.skyhanni.features.dungeon.DungeonFloor
import at.hannibal2.skyhanni.utils.DelayedRun
import at.hannibal2.skyhanni.utils.InventoryUtils.getAmountInInventory
import com.ratons.Ratons
import com.ratons.events.KuudraStartEvent
import com.ratons.utils.ChatUtils
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import kotlin.time.Duration.Companion.seconds

@Suppress("SkyHanniModuleInspection")
object AutoRefill {
Expand All @@ -23,12 +22,9 @@ object AutoRefill {
newInstance()
}

@SubscribeEvent
fun onKuudraStart(event: KuudraEnterEvent) {
// TODO: use chat pattern instead
DelayedRun.runDelayed(10.seconds) {
newInstance()
}
@HandleEvent
fun onKuudraStart(event: KuudraStartEvent) {
newInstance()
}

private fun newInstance() {
Expand Down
22 changes: 22 additions & 0 deletions src/main/kotlin/com/ratons/utils/KuudraAPI.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.ratons.utils

import at.hannibal2.skyhanni.events.LorenzChatEvent
import at.hannibal2.skyhanni.features.nether.kuudra.KuudraAPI
import at.hannibal2.skyhanni.utils.RegexUtils.matches
import com.ratons.events.KuudraStartEvent
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent

@Suppress("SkyHanniModuleInspection")
object KuudraAPI {

private val startPattern = "§e\\[NPC] §cElle§f: §rOkay adventurers, I will go and fish up Kuudra!".toPattern()

@SubscribeEvent
fun onChat(event: LorenzChatEvent) {
if (!KuudraAPI.inKuudra()) return
if (startPattern.matches(event.message)) {
KuudraStartEvent(KuudraAPI.kuudraTier).post()
}
}

}
Loading