aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCalMWolfs <94038482+CalMWolfs@users.noreply.github.com>2023-07-01 08:31:28 +1000
committerGitHub <noreply@github.com>2023-07-01 00:31:28 +0200
commitebb9240c320c007143d338d37a3cb51bf77cac17 (patch)
tree4d709f7a88d23ccfb50ee59a21e1ac0af4e6191e /src
parent3567d74fe1b4da52c07e952596ae2bddee29a8e5 (diff)
downloadskyhanni-ebb9240c320c007143d338d37a3cb51bf77cac17.tar.gz
skyhanni-ebb9240c320c007143d338d37a3cb51bf77cac17.tar.bz2
skyhanni-ebb9240c320c007143d338d37a3cb51bf77cac17.zip
add things (#273)
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Diffstat (limited to 'src')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/Storage.java11
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/rift/KloonHacking.kt55
2 files changed, 51 insertions, 15 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/Storage.java b/src/main/java/at/hannibal2/skyhanni/config/Storage.java
index ccae2ce25..a1f9fbfb1 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/Storage.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/Storage.java
@@ -7,6 +7,7 @@ import at.hannibal2.skyhanni.features.garden.fortuneguide.FarmingItems;
import at.hannibal2.skyhanni.features.garden.visitor.VisitorReward;
import at.hannibal2.skyhanni.features.misc.FrozenTreasure;
import at.hannibal2.skyhanni.features.misc.GhostCounter.Option;
+import at.hannibal2.skyhanni.features.rift.KloonTerminal;
import at.hannibal2.skyhanni.utils.LorenzVec;
import com.google.gson.annotations.Expose;
import net.minecraft.item.ItemStack;
@@ -247,7 +248,15 @@ public class Storage {
public Map<FrozenTreasure, Integer> treasureCount = new HashMap<>();
}
- public long nextCityProjectParticipationTime = 0L;
+ @Expose
+ public RiftStorage rift = new RiftStorage();
+
+ public static class RiftStorage {
+
+ @Expose
+ public List<KloonTerminal> completedKloonTerminals = new ArrayList<>();
+
+ }
@Expose
public Map<String, SlayerProfitList> slayerProfitData = new HashMap<>();
diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/KloonHacking.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/KloonHacking.kt
index 0277751ec..3e6bc1dac 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/rift/KloonHacking.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/rift/KloonHacking.kt
@@ -1,10 +1,8 @@
package at.hannibal2.skyhanni.features.rift
import at.hannibal2.skyhanni.SkyHanniMod
-import at.hannibal2.skyhanni.events.GuiContainerEvent
-import at.hannibal2.skyhanni.events.InventoryCloseEvent
-import at.hannibal2.skyhanni.events.InventoryOpenEvent
-import at.hannibal2.skyhanni.events.LorenzTickEvent
+import at.hannibal2.skyhanni.data.ProfileStorageData
+import at.hannibal2.skyhanni.events.*
import at.hannibal2.skyhanni.test.GriffinUtils.drawWaypointFilled
import at.hannibal2.skyhanni.utils.InventoryUtils
import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName
@@ -12,6 +10,7 @@ import at.hannibal2.skyhanni.utils.ItemUtils.getLore
import at.hannibal2.skyhanni.utils.LocationUtils.distanceToPlayer
import at.hannibal2.skyhanni.utils.LorenzColor
import at.hannibal2.skyhanni.utils.RenderUtils.highlight
+import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher
import at.hannibal2.skyhanni.utils.StringUtils.removeColor
import io.github.moulberry.notenoughupdates.events.SlotClickEvent
import net.minecraftforge.client.event.RenderWorldLastEvent
@@ -23,7 +22,7 @@ class KloonHacking {
private var inTerminalInventory = false
private var inColourInventory = false
private val correctButtons = mutableListOf<String>()
- private var nearestColor: String? = null
+ private var nearestTerminal: KloonTerminal? = null
@SubscribeEvent
fun onTick(event: LorenzTickEvent) {
@@ -41,6 +40,7 @@ class KloonHacking {
fun onInventoryOpen(event: InventoryOpenEvent) {
inTerminalInventory = false
inColourInventory = false
+ nearestTerminal = null
if (!RiftAPI.inRift()) return
if (!SkyHanniMod.feature.rift.hacking.solver) return
if (event.inventoryName == "Hacking" || event.inventoryName == "Hacking (As seen on CSI)") {
@@ -61,7 +61,6 @@ class KloonHacking {
fun onInventoryClose(event: InventoryCloseEvent) {
inTerminalInventory = false
inColourInventory = false
- nearestColor = null
}
@SubscribeEvent
@@ -88,9 +87,9 @@ class KloonHacking {
}
if (inColourInventory) {
if (!SkyHanniMod.feature.rift.hacking.colour) return
- val targetColour = nearestColor ?: getNearestColour()
+ val targetColour = nearestTerminal ?: getNearestTerminal()
for (slot in InventoryUtils.getItemsInOpenChest()) {
- if (slot.stack.getLore().any { it.contains(targetColour) }) {
+ if (slot.stack.getLore().any { it.contains(targetColour?.name ?: "") }) {
slot highlight LorenzColor.GREEN
}
}
@@ -100,7 +99,6 @@ class KloonHacking {
@SubscribeEvent(priority = EventPriority.HIGH)
fun onSlotClick(event: SlotClickEvent) {
if (!inTerminalInventory || !RiftAPI.inRift()) return
- if (!inTerminalInventory) return
event.usePickblockInstead()
}
@@ -109,23 +107,52 @@ class KloonHacking {
if (!RiftAPI.inRift()) return
if (!SkyHanniMod.feature.rift.hacking.waypoints) return
if (!wearingHelmet) return
+ val hidden = ProfileStorageData.profileSpecific?.rift ?: return
for (terminal in KloonTerminal.values()) {
- event.drawWaypointFilled(terminal.location, LorenzColor.DARK_RED.toColor(), true, true)
+ if (terminal !in hidden.completedKloonTerminals) {
+ event.drawWaypointFilled(terminal.location, LorenzColor.DARK_RED.toColor(), true, true)
+ }
+ }
+ }
+
+ @SubscribeEvent
+ fun onChat(event: LorenzChatEvent) {
+ if (!RiftAPI.inRift()) return
+ if (!wearingHelmet) return
+
+ "You've set the color of this terminal to (?<colour>.*)!".toPattern().matchMatcher(event.message.removeColor()) {
+ val hidden = ProfileStorageData.profileSpecific?.rift ?: return
+ val colour = group("colour")
+ val completedTerminal = KloonTerminal.values().firstOrNull { it.name == colour } ?: return
+ if (completedTerminal != nearestTerminal) return
+ hidden.completedKloonTerminals.add(completedTerminal)
+ }
+ }
+
+ @SubscribeEvent
+ fun onTooltip(event: LorenzToolTipEvent) {
+ if (!RiftAPI.inRift()) return
+ if (!inTerminalInventory) return
+ if (!SkyHanniMod.feature.rift.hacking.solver) return
+
+ val neededTooltips = listOf(0, 2, 3, 4, 5, 6, 8, 9, 26, 27, 44, 45)
+ if (event.slot.slotIndex !in neededTooltips) {
+ event.toolTip.clear()
}
}
- private fun getNearestColour(): String {
- var closestTerminal = ""
+ private fun getNearestTerminal(): KloonTerminal? {
+ var closestTerminal: KloonTerminal? = null
var closestDistance = 8.0
for (terminal in KloonTerminal.values()) {
val distance = terminal.location.distanceToPlayer()
if (distance < closestDistance) {
- closestTerminal = terminal.name
+ closestTerminal = terminal
closestDistance = distance
}
}
- nearestColor = closestTerminal
+ nearestTerminal = closestTerminal
return closestTerminal
}
} \ No newline at end of file