Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Hotm Features + Hotm API/Data #1059

Merged
merged 65 commits into from
May 30, 2024
Merged
Show file tree
Hide file tree
Changes from 44 commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
40af948
input some data
Thunderblade73 Dec 29, 2023
b4991e4
working
Thunderblade73 Feb 24, 2024
ed8846a
added full storage support, copy tree, powder and tokens
Thunderblade73 Feb 25, 2024
2ed9de7
test
Thunderblade73 Feb 25, 2024
03b008d
improved the rewardFun
Thunderblade73 Feb 25, 2024
94f7801
rename of file
Thunderblade73 Feb 25, 2024
11a7b19
Merge branch 'beta' into hotm-API
Thunderblade73 Feb 25, 2024
f63774c
made feature separate
Thunderblade73 Feb 25, 2024
8950236
fix
Thunderblade73 Feb 25, 2024
bcbdab0
fix
Thunderblade73 Feb 25, 2024
243a4c2
Revert "test"
Thunderblade73 Feb 25, 2024
ed0f783
max level hide
Thunderblade73 Feb 25, 2024
f5136a8
fixed missing new line
Thunderblade73 Feb 25, 2024
c4e431b
updated format
Thunderblade73 Feb 25, 2024
d954a74
.
Thunderblade73 Feb 25, 2024
35158f2
Merge branch 'beta' into hotm-API
Thunderblade73 Mar 16, 2024
8d45844
Merge branch 'beta' into hotm-API
Thunderblade73 Mar 17, 2024
8b70d6c
Merge branch 'beta' into hotm-API
Thunderblade73 Mar 28, 2024
6c46d32
Merge branch 'beta' into hotm-API
Thunderblade73 Apr 3, 2024
b003bc9
Merge branch 'beta' into hotm-API
Thunderblade73 Apr 7, 2024
2089acd
Mining V3
Thunderblade73 Apr 13, 2024
ab77fa2
Merge branch 'beta' into hotm-API
Thunderblade73 Apr 13, 2024
9f8bf3f
Merge branch 'beta' into hotm-API
Thunderblade73 Apr 13, 2024
f4f8467
fix
Thunderblade73 Apr 13, 2024
e13e575
fixed typos
Thunderblade73 Apr 14, 2024
f5d4833
formatting fixes
Thunderblade73 Apr 17, 2024
afe1240
some blue egg stuff
Thunderblade73 Apr 17, 2024
74ccfb5
empa way
Thunderblade73 Apr 17, 2024
a83b8db
solve level issue
Thunderblade73 Apr 17, 2024
199e0b3
fix MINING_FORTUNE cost function
Thunderblade73 Apr 17, 2024
8bbd416
formatting
Thunderblade73 Apr 18, 2024
5cf2401
init
j10a1n15 Apr 19, 2024
7979ede
Merge branch 'hotm-API' into hotm-API-gain
j10a1n15 Apr 19, 2024
e88954f
switched to debug
j10a1n15 Apr 19, 2024
b7130b9
changed chat debug message design
j10a1n15 Apr 19, 2024
c13be36
Added Powder gain :+1: (#1)
Thunderblade73 Apr 20, 2024
694505d
Merge branch 'hannibal002:beta' into hotm-API
Thunderblade73 Apr 20, 2024
355b917
added tree to debug
Thunderblade73 Apr 20, 2024
65c7fec
fixed some edgecases for the activeLevel
Thunderblade73 Apr 20, 2024
f1b5a33
changed to active instead
Thunderblade73 Apr 20, 2024
0566ad8
changed to order of debug
Thunderblade73 Apr 20, 2024
1d57e34
better debug
Thunderblade73 Apr 20, 2024
13a9856
Merge branch 'beta' into hotm-API
Thunderblade73 Apr 23, 2024
c22aab5
blue omelette not egg
Thunderblade73 Apr 26, 2024
64de269
init mayhem
martimavocado Apr 27, 2024
82f08b8
remove debug
martimavocado Apr 27, 2024
d0d7f58
add a bit more debug, maybe fix mayhem
martimavocado Apr 27, 2024
17dec3c
this might make more sense
martimavocado Apr 27, 2024
f4fa255
add skymall and mineshaft mayhem (#3)
Thunderblade73 May 6, 2024
2e55f63
correct parse and correct import
Thunderblade73 May 6, 2024
09308cb
Merge branch 'beta' into hotm-API
Thunderblade73 May 6, 2024
9cfb399
repo Pattern!
Thunderblade73 May 6, 2024
c68266c
Update src/main/java/at/hannibal2/skyhanni/data/HotmData.kt
Thunderblade73 May 6, 2024
e800034
more repo Patterns!
Thunderblade73 May 6, 2024
d1960e4
Merge branch 'refs/heads/beta' into hotm-API
Thunderblade73 May 24, 2024
e068468
Merge branch 'beta' into hotm-API
Thunderblade73 May 26, 2024
352999e
Rename .java to .kt
Thunderblade73 May 29, 2024
6ef11c2
hotmTree from java to Kotlin
Thunderblade73 May 29, 2024
4cf5a40
cleanup
Thunderblade73 May 29, 2024
f5c11f1
cleanup
Thunderblade73 May 30, 2024
ad02dc2
fix pattern.
Thunderblade73 May 30, 2024
ffd3d4a
Merge branch 'refs/heads/beta' into fork/hotm-API
hannibal002 May 30, 2024
aa15041
better colour
Thunderblade73 May 30, 2024
a02a22b
Merge remote-tracking branch 'Thunderblade73/hotm-API' into fork/hotm…
hannibal002 May 30, 2024
e6e6e30
code cleanup
hannibal002 May 30, 2024
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
4 changes: 4 additions & 0 deletions src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import at.hannibal2.skyhanni.data.GardenCropUpgrades
import at.hannibal2.skyhanni.data.GuiEditManager
import at.hannibal2.skyhanni.data.GuildAPI
import at.hannibal2.skyhanni.data.HighlightOnHoverSlot
import at.hannibal2.skyhanni.data.HotmData
import at.hannibal2.skyhanni.data.HypixelData
import at.hannibal2.skyhanni.data.ItemAddManager
import at.hannibal2.skyhanni.data.ItemClickData
Expand Down Expand Up @@ -279,6 +280,7 @@ import at.hannibal2.skyhanni.features.mining.ColdOverlay
import at.hannibal2.skyhanni.features.mining.DeepCavernsGuide
import at.hannibal2.skyhanni.features.mining.GoldenGoblinHighlight
import at.hannibal2.skyhanni.features.mining.HighlightMiningCommissionMobs
import at.hannibal2.skyhanni.features.mining.HotmFeatures
import at.hannibal2.skyhanni.features.mining.KingTalismanHelper
import at.hannibal2.skyhanni.features.mining.MiningNotifications
import at.hannibal2.skyhanni.features.mining.crystalhollows.CrystalHollowsNamesInCore
Expand Down Expand Up @@ -529,6 +531,7 @@ class SkyHanniMod {
loadModule(ChatUtils)
loadModule(FixedRateTimerManager())
loadModule(ChromaManager)
loadModule(HotmData)
loadModule(ContributorManager)

// APIs
Expand Down Expand Up @@ -650,6 +653,7 @@ class SkyHanniMod {
loadModule(StatsTuning())
loadModule(NonGodPotEffectDisplay())
loadModule(SoopyGuessBurrow())
loadModule(HotmFeatures())
loadModule(DianaProfitTracker)
loadModule(MythologicalCreatureTracker)
loadModule(ShiftClickNPCSell)
Expand Down
86 changes: 86 additions & 0 deletions src/main/java/at/hannibal2/skyhanni/api/HotmAPI.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
package at.hannibal2.skyhanni.api

import at.hannibal2.skyhanni.data.HotmData
import at.hannibal2.skyhanni.data.ProfileStorageData
import at.hannibal2.skyhanni.utils.InventoryUtils
import at.hannibal2.skyhanni.utils.ItemCategory
import at.hannibal2.skyhanni.utils.ItemUtils.getItemCategoryOrNull
import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName
import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getDrillUpgrades
import at.hannibal2.skyhanni.utils.StringUtils.firstLetterUppercase
import at.hannibal2.skyhanni.utils.TimeLimitedCache
import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern
import net.minecraft.item.ItemStack
import kotlin.time.Duration.Companion.seconds

object HotmAPI {

fun copyCurrentTree() = HotmData.storage?.deepCopy()

val activeMiningAbility get() = HotmData.abilities.firstOrNull { it.enabled }

private val blueGoblinEgg = "goblin_omelette_blue_cheese".asInternalName()
Thunderblade73 marked this conversation as resolved.
Show resolved Hide resolved

private val blueEggCache = TimeLimitedCache<ItemStack, Boolean>(10.0.seconds)
val isBlueEggActive
get() = InventoryUtils.getItemInHand()?.let {
blueEggCache.getOrPut(it) {
it.getItemCategoryOrNull() == ItemCategory.DRILL && it.getDrillUpgrades()
?.contains(blueGoblinEgg) == true
}
} == true

enum class Powder() {
MITHRIL,
GEMSTONE,
GLACITE,

;

val lowName = name.lowercase().firstLetterUppercase()

val heartPattern by RepoPattern.pattern(
"inventory.${name.lowercase()}.heart",
"§7$lowName Powder: §a§.(?<powder>[\\d,]+)"
)
val resetPattern by RepoPattern.pattern(
"inventory.${name.lowercase()}.reset",
"\\s+§8- §.(?<powder>[\\d,]+) $lowName Powder"
)

fun pattern(isHeart: Boolean) = if (isHeart) heartPattern else resetPattern

fun getStorage() = ProfileStorageData.profileSpecific?.mining?.powder?.get(this)

fun getCurrent() = getStorage()?.available ?: 0L

fun setCurrent(value: Long) {
Thunderblade73 marked this conversation as resolved.
Show resolved Hide resolved
getStorage()?.available = value
}

fun addCurrent(value: Long) {
setCurrent(getCurrent() + value)
}

fun getTotal() = getStorage()?.total ?: 0L

fun setTotal(value: Long) {
getStorage()?.total = value
}

fun addTotal(value: Long) {
setTotal(getTotal() + value)
}

/** Use when new powder gets collected*/
fun gain(value: Long) {
addTotal(value)
addCurrent(value)
}

fun reset() {
setCurrent(0)
setTotal(0)
}
}
}
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package at.hannibal2.skyhanni.config.features.mining;

import at.hannibal2.skyhanni.config.FeatureToggle;
import com.google.gson.annotations.Expose;
import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorBoolean;
import io.github.notenoughupdates.moulconfig.annotations.ConfigOption;

public class HotmConfig {

@Expose
@ConfigOption(name = "Enabled Highlight", desc = "Highlights enabled perks in the hotm tree green and disabled red. Not unlocked perks are highlighted gray.")
@ConfigEditorBoolean
@FeatureToggle
public boolean highlightEnabledPerks = true;

@Expose
@ConfigOption(name = "Level Stack", desc = "Shows the level of a perk as item stacks.")
@ConfigEditorBoolean
@FeatureToggle
public boolean levelStackSize = true;

@Expose
@ConfigOption(name = "Token Stack", desc = "Shows unused tokens on the heart.")
@ConfigEditorBoolean
@FeatureToggle
public boolean tokenStackSize = true;
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ public class MiningConfig {
@Category(name = "Mining Event Tracker", desc = "Settings for the Mining Event Tracker")
public MiningEventConfig miningEvent = new MiningEventConfig();

@Expose
@Category(name = "HotM", desc = "Settings for Heart of the Mountain")
public HotmConfig hotmConfig = new HotmConfig();

@Expose
@ConfigOption(name = "Powder Tracker", desc = "")
@Accordion
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package at.hannibal2.skyhanni.config.storage;

import at.hannibal2.skyhanni.api.HotmAPI;
import at.hannibal2.skyhanni.api.SkillAPI;
import at.hannibal2.skyhanni.data.MaxwellAPI;
import at.hannibal2.skyhanni.data.jsonobjects.local.HotmTree;
import at.hannibal2.skyhanni.data.model.ComposterUpgrade;
import at.hannibal2.skyhanni.features.combat.endernodetracker.EnderNodeTracker;
import at.hannibal2.skyhanni.features.combat.ghostcounter.GhostData;
Expand Down Expand Up @@ -402,6 +404,27 @@ public static class MiningConfig {

@Expose
public ExcavatorProfitTracker.Data fossilExcavatorProfitTracker = new ExcavatorProfitTracker.Data();

@Expose
public HotmTree hotmTree = new HotmTree();

@Expose
public Map<HotmAPI.Powder, PowderStorage> powder = new HashMap<>();

public static class PowderStorage {

@Expose
public Long available;

@Expose
public Long total;
}

@Expose
public int tokens;

@Expose
public int availableTokens;
}

@Expose
Expand Down
Loading
Loading