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

Fix: skill overflow event not posted #3146

Merged
merged 1 commit into from
Jan 4, 2025
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
5 changes: 5 additions & 0 deletions src/main/java/at/hannibal2/skyhanni/api/SkillAPI.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent
import at.hannibal2.skyhanni.events.NeuRepositoryReloadEvent
import at.hannibal2.skyhanni.events.SecondPassedEvent
import at.hannibal2.skyhanni.events.SkillExpGainEvent
import at.hannibal2.skyhanni.events.SkillOverflowLevelUpEvent
import at.hannibal2.skyhanni.features.skillprogress.SkillProgress
import at.hannibal2.skyhanni.features.skillprogress.SkillType
import at.hannibal2.skyhanni.features.skillprogress.SkillUtil.SPACE_SPLITTER
Expand Down Expand Up @@ -367,6 +368,10 @@ object SkillAPI {
val (currentLevel, currentOverflow, currentMaxOverflow, totalOverflow) =
calculateSkillLevel(levelXp, defaultSkillCap[skillType.lowercaseName] ?: 60)

if (skillInfo.overflowLevel > 60 && currentLevel == skillInfo.overflowLevel + 1) {
SkillOverflowLevelUpEvent(skillType, skillInfo.overflowLevel, currentLevel).post()
}

skillInfo.apply {
this.overflowCurrentXp = currentOverflow
this.overflowCurrentXpMax = currentMaxOverflow
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ object SkillProgress {

@SubscribeEvent
fun onRenderOverlay(event: GuiRenderEvent.GuiOverlayRenderEvent) {
if (!isEnabled()) return
if (!isDisplayEnabled()) return
if (display.isEmpty()) return

if (showDisplay) {
Expand All @@ -81,7 +81,7 @@ object SkillProgress {

@SubscribeEvent
fun onGuiRender(event: GuiRenderEvent) {
if (!isEnabled()) return
if (!isDisplayEnabled()) return
if (display.isEmpty()) return

if (allSkillConfig.enabled.get()) {
Expand Down Expand Up @@ -145,7 +145,7 @@ object SkillProgress {

@SubscribeEvent
fun onSecondPassed(event: SecondPassedEvent) {
if (!isEnabled()) return
if (!isDisplayEnabled()) return
if (lastUpdate.passedSince() > 3.seconds) showDisplay = config.alwaysShow.get()

allDisplay = formatAllDisplay(drawAllDisplay())
Expand All @@ -159,7 +159,7 @@ object SkillProgress {

@HandleEvent
fun onLevelUp(event: SkillOverflowLevelUpEvent) {
if (!isEnabled()) return
if (!LorenzUtils.inSkyBlock) return
if (!config.overflowConfig.enableInChat) return
val skillName = event.skill.displayName
val oldLevel = event.oldLevel
Expand Down Expand Up @@ -220,7 +220,7 @@ object SkillProgress {

@HandleEvent(priority = HandleEvent.LOW)
fun onActionBar(event: ActionBarUpdateEvent) {
if (!config.hideInActionBar || !isEnabled()) return
if (!config.hideInActionBar || !isDisplayEnabled()) return
var msg = event.actionBar
for (line in hideInActionBar) {
msg = msg.replace(Regex("\\s*" + Regex.escape(line)), "")
Expand Down Expand Up @@ -532,5 +532,5 @@ object SkillProgress {
xpInfo.isActive = true
}

private fun isEnabled() = LorenzUtils.inSkyBlock && config.enabled.get()
private fun isDisplayEnabled() = LorenzUtils.inSkyBlock && config.enabled.get()
}
Loading