Skip to content

Commit

Permalink
Merge branch 'beta' of https://github.com/hannibal002/SkyHanni into i…
Browse files Browse the repository at this point in the history
…tem-stack-size-playertryhard
  • Loading branch information
RayDeeUx committed Jan 31, 2024
2 parents 601d0ec + d947829 commit 3b6537c
Show file tree
Hide file tree
Showing 39 changed files with 367 additions and 267 deletions.
1 change: 1 addition & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ loom {
if (SystemUtils.IS_OS_MAC_OSX) {
vmArgs.remove("-XstartOnFirstThread")
}
vmArgs.add("-Xmx4G")
}
"server" {
isIdeConfigGenerated = false
Expand Down
8 changes: 6 additions & 2 deletions src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ import at.hannibal2.skyhanni.features.dungeon.DungeonMilestonesDisplay
import at.hannibal2.skyhanni.features.dungeon.DungeonRankTabListColor
import at.hannibal2.skyhanni.features.dungeon.DungeonTeammateOutlines
import at.hannibal2.skyhanni.features.dungeon.HighlightDungeonDeathmite
import at.hannibal2.skyhanni.features.dungeon.TerracottaPhase
import at.hannibal2.skyhanni.features.event.UniqueGiftingOpportunitiesFeatures
import at.hannibal2.skyhanni.features.event.diana.BurrowWarpHelper
import at.hannibal2.skyhanni.features.event.diana.DianaProfitTracker
Expand Down Expand Up @@ -198,6 +199,7 @@ import at.hannibal2.skyhanni.features.garden.visitor.GardenVisitorDropStatistics
import at.hannibal2.skyhanni.features.garden.visitor.GardenVisitorFeatures
import at.hannibal2.skyhanni.features.garden.visitor.GardenVisitorTimer
import at.hannibal2.skyhanni.features.garden.visitor.HighlightVisitorsOutsideOfGarden
import at.hannibal2.skyhanni.features.garden.visitor.NPCVisitorFix
import at.hannibal2.skyhanni.features.garden.visitor.VisitorListener
import at.hannibal2.skyhanni.features.inventory.AuctionsHighlighter
import at.hannibal2.skyhanni.features.inventory.ChestValue
Expand Down Expand Up @@ -281,7 +283,6 @@ import at.hannibal2.skyhanni.features.misc.trevor.TrevorTracker
import at.hannibal2.skyhanni.features.misc.update.UpdateManager
import at.hannibal2.skyhanni.features.misc.visualwords.ModifyVisualWords
import at.hannibal2.skyhanni.features.nether.PabloHelper
import at.hannibal2.skyhanni.features.nether.QuestItemHelper
import at.hannibal2.skyhanni.features.nether.SulphurSkitterBox
import at.hannibal2.skyhanni.features.nether.VolcanoExplosivityDisplay
import at.hannibal2.skyhanni.features.nether.ashfang.AshfangBlazes
Expand Down Expand Up @@ -352,6 +353,7 @@ import at.hannibal2.skyhanni.utils.EntityOutlineRenderer
import at.hannibal2.skyhanni.utils.KeyboardManager
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.MinecraftConsoleFilter.Companion.initLogging
import at.hannibal2.skyhanni.utils.NEUItems
import at.hannibal2.skyhanni.utils.NEUVersionCheck.checkIfNeuIsLoaded
import at.hannibal2.skyhanni.utils.TabListData
import at.hannibal2.skyhanni.utils.UtilsPatterns
Expand Down Expand Up @@ -457,6 +459,7 @@ class SkyHanniMod {
loadModule(FishingAPI)
loadModule(FishingDetection)
loadModule(LorenzUtils)
loadModule(NEUItems)

// features
loadModule(BazaarOrderHelper())
Expand Down Expand Up @@ -568,6 +571,7 @@ class SkyHanniMod {
loadModule(MiscFeatures())
loadModule(SkyMartCopperPrice())
loadModule(GardenVisitorFeatures())
loadModule(NPCVisitorFix)
loadModule(GardenInventoryNumbers())
loadModule(GardenVisitorTimer())
loadModule(MinionXp())
Expand Down Expand Up @@ -696,7 +700,7 @@ class SkyHanniMod {
loadModule(GlowingDroppedItems())
loadModule(DungeonTeammateOutlines())
loadModule(DungeonRankTabListColor())
loadModule(QuestItemHelper())
loadModule(TerracottaPhase())
loadModule(VolcanoExplosivityDisplay())
loadModule(PlayerChatSymbols())
loadModule(FixNEUHeavyPearls())
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/at/hannibal2/skyhanni/config/Storage.java
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,9 @@ public static class FarmingWeightConfig {
@Expose
public int lastFarmingWeightLeaderboard = -1;
}

@Expose
public Map<String, LorenzVec> npcVisitorLocations = new HashMap<>();
}

@Expose
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,7 @@ object Commands {
registerCommand("pk", "Kick a specific party member") { PartyCommands.kick(it) }
registerCommand("pt", "Transfer the party to another party member") { PartyCommands.transfer(it) }
registerCommand("pp", "Promote a specific party member") { PartyCommands.promote(it) }
registerCommand("pd", "Disbands the party") { PartyCommands.disband() }
}

private fun commandHelp(args: Array<String>) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

public class MobsConfig {
@Expose
@ConfigOption(name = "Area Boss", desc = "Highlight Golden Ghoul, Old Wolf, Voidling Extremist and Millenia-Aged Blaze.")
@ConfigOption(name = "Area Boss Highlighter", desc = "Highlight Golden Ghoul, Old Wolf, Voidling Extremist and Millenia-Aged Blaze.")
@ConfigEditorBoolean
@FeatureToggle
public boolean areaBossHighlight = true;
Expand Down Expand Up @@ -53,7 +53,7 @@ public class MobsConfig {

@Expose
@ConfigOption(
name = "Area Boss",
name = "Area Boss Timer",
desc = "Show a timer when Golden Ghoul, Old Wolf, Voidling Extremist or Millenia-Aged Blaze respawns. " +
"§cSometimes it takes 20-30 seconds to calibrate correctly."
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class CommandsConfig {
public FandomWikiCommandConfig fandomWiki = new FandomWikiCommandConfig();

@ConfigOption(name = "Party Commands", desc = "Shortens party commands and allows tab-completing for them. " +
"\n§eCommands: /pt /pp /pko /pk §7SkyBlock command §e/pt §7to check the play time still works.")
"\n§eCommands: /pt /pp /pko /pk /pd §7SkyBlock command §e/pt §7to check the play time still works.")
@Expose
@ConfigEditorBoolean
@FeatureToggle
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,7 @@ public class CrimsonIsleConfig {
public SulphurSkitterBoxConfig sulphurSkitterBoxConfig = new SulphurSkitterBoxConfig();

@Expose
@ConfigOption(name = "Quest Item Helper", desc = "When you open the fetch item quest in the town board, " +
"it shows a clickable chat message that will grab the items needed from the sacks.")
@ConfigEditorBoolean
@FeatureToggle
public boolean questItemHelper = false;

@Expose
@ConfigOption(name = "Pablo NPC Helper", desc = "Similar to Quest Item Helper, shows a clickable message that grabs the flower needed from sacks.")
@ConfigOption(name = "Pablo NPC Helper", desc = "Shows a clickable message that grabs the flower needed from your sacks.")
@ConfigEditorBoolean
@FeatureToggle
public boolean pabloHelper = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,12 @@ public class DungeonConfig {
@Accordion
public LividFinderConfig lividFinder = new LividFinderConfig();


@Expose
@ConfigOption(name = "Terracotta Phase", desc = "")
@Accordion
public TerracottaPhaseConfig terracottaPhase = new TerracottaPhaseConfig();

@Expose
@ConfigOption(name = "Moving Skeleton Skulls", desc = "Highlight Skeleton Skulls when combining into an " +
"orange Skeletor (not useful when combined with feature Hide Skeleton Skull).")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package at.hannibal2.skyhanni.config.features.dungeon;

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

public class TerracottaPhaseConfig {

@Expose
@ConfigOption(name = "Hide Particles", desc = "Hide particles that spawn from terracottas during sadan fight.")
@ConfigEditorBoolean
@FeatureToggle
public boolean hideParticles = false;

@Expose
@ConfigOption(name = "Hide Damage Splash", desc = "Hide damage splashes during the terracotta phase.")
@ConfigEditorBoolean
public boolean hideDamageSplash = false;
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,21 @@ public class EstimatedItemValueConfig {
@FeatureToggle
public boolean armor = true;

@Expose
@ConfigOption(name = "Ignore Helmet Skins", desc = "Ignore helmet Skins from the total value.")
@ConfigEditorBoolean
public boolean ignoreHelmetSkins = false;

@Expose
@ConfigOption(name = "Ignore Armor Dyes", desc = "Ignore Armor Dyes from the total value.")
@ConfigEditorBoolean
public boolean ignoreArmorDyes = false;

@Expose
@ConfigOption(name = "Ignore Runes", desc = "Ignore Runes from the total value.")
@ConfigEditorBoolean
public boolean ignoreRunes = false;

@Expose
public Position itemPriceDataPos = new Position(140, 90, false, true);
}
30 changes: 16 additions & 14 deletions src/main/java/at/hannibal2/skyhanni/data/MayorElection.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,16 @@ import at.hannibal2.skyhanni.events.LorenzTickEvent
import at.hannibal2.skyhanni.utils.APIUtil
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.LorenzUtils.put
import at.hannibal2.skyhanni.utils.SimpleTimeMark
import io.github.moulberry.notenoughupdates.util.SkyBlockTime
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import kotlin.time.Duration.Companion.minutes

class MayorElection {
private var lastUpdate = 0L
private var lastUpdate = SimpleTimeMark.farPast()
private var dispatcher = Dispatchers.IO

companion object {
Expand All @@ -37,20 +39,20 @@ class MayorElection {
}

private fun check() {
if (System.currentTimeMillis() > lastUpdate + 60_000 * 5) {
lastUpdate = System.currentTimeMillis()
SkyHanniMod.coroutineScope.launch {
val url = "https://api.hypixel.net/v2/resources/skyblock/election"
val jsonObject = withContext(dispatcher) { APIUtil.getJSONResponse(url) }
rawMayorData = ConfigManager.gson.fromJson(jsonObject, MayorJson::class.java)
val data = rawMayorData ?: return@launch
val map = mutableMapOf<Int, MayorJson.Candidate>()
map put data.mayor.election.getPairs()
data.current?.let {
map put data.current.getPairs()
}
candidates = map
if (lastUpdate.passedSince() < 20.minutes) return
lastUpdate = SimpleTimeMark.now()

SkyHanniMod.coroutineScope.launch {
val url = "https://api.hypixel.net/v2/resources/skyblock/election"
val jsonObject = withContext(dispatcher) { APIUtil.getJSONResponse(url) }
rawMayorData = ConfigManager.gson.fromJson(jsonObject, MayorJson::class.java)
val data = rawMayorData ?: return@launch
val map = mutableMapOf<Int, MayorJson.Candidate>()
map put data.mayor.election.getPairs()
data.current?.let {
map put data.current.getPairs()
}
candidates = map
}

checkCurrentMayor()
Expand Down
22 changes: 15 additions & 7 deletions src/main/java/at/hannibal2/skyhanni/data/SackAPI.kt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import at.hannibal2.skyhanni.utils.NumberUtil.formatNumber
import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher
import at.hannibal2.skyhanni.utils.StringUtils.matches
import at.hannibal2.skyhanni.utils.StringUtils.removeColor
import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern
import com.google.gson.annotations.Expose
import net.minecraft.item.ItemStack
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
Expand All @@ -35,12 +36,19 @@ object SackAPI {

var inSackInventory = false

// TODO USE SH-REPO
private val sackPattern = "^(.* Sack|Enchanted .* Sack)$".toPattern()
private val numPattern =
"(?:(?:§[0-9a-f](?<level>I{1,3})§7:)?|(?:§7Stored:)?) (?<color>§[0-9a-f])(?<stored>[0-9.,kKmMbB]+)§7/(?<total>\\d+(?:[0-9.,]+)?[kKmMbB]?)".toPattern()
private val gemstonePattern =
" §[0-9a-f](?<gemrarity>[A-z]*): §[0-9a-f](?<stored>\\d+(?:\\.\\d+)?(?:(?:,\\d+)?)+[kKmM]?)(?: §[0-9a-f]\\(\\d+(?:\\.\\d+)?(?:(?:,\\d+)?)+[kKmM]?\\))?".toPattern()
private val patternGroup = RepoPattern.group("data.sacks")
private val sackPattern by patternGroup.pattern(
"sack",
"^(.* Sack|Enchanted .* Sack)\$"
)
private val numPattern by patternGroup.pattern(
"number",
"(?:(?:§[0-9a-f](?<level>I{1,3})§7:)?|(?:§7Stored:)?) (?<color>§[0-9a-f])(?<stored>[0-9.,kKmMbB]+)§7/(?<total>\\d+(?:[0-9.,]+)?[kKmMbB]?)"
)
private val gemstonePattern by patternGroup.pattern(
"gemstone",
" §[0-9a-f](?<gemrarity>[A-z]*): §[0-9a-f](?<stored>\\d+(?:\\.\\d+)?(?:(?:,\\d+)?)+[kKmM]?)(?: §[0-9a-f]\\(\\d+(?:\\.\\d+)?(?:(?:,\\d+)?)+[kKmM]?\\))?"
)

private var isRuneSack = false
private var isGemstoneSack = false
Expand Down Expand Up @@ -286,7 +294,7 @@ object SackAPI {
return sackData[item] ?: return SackItem(0, 0, SackStatus.MISSING)
}

sackData = sackData.editCopy { this[item] = SackItem(0, 0, SackStatus.OUTDATED) }
sackData = sackData.editCopy { this[item] = SackItem(0, 0, SackStatus.MISSING) }
return sackData[item] ?: return SackItem(0, 0, SackStatus.MISSING)
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package at.hannibal2.skyhanni.data.jsonobjects.repo;

import at.hannibal2.skyhanni.utils.NEUInternalName;
import com.google.gson.annotations.Expose;

import java.util.List;
Expand All @@ -26,7 +27,7 @@ public class CrimsonIsleReputationJson {

public static class ReputationQuest {
@Expose
public String item;
public NEUInternalName item;

@Expose
public List<Double> location;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ class ChatFilter {
)
private val fireSalePatterns = listOf(
"§c♨ §eFire Sales for .* §eare starting soon!".toPattern(),
"§c\\s*♨ .* (?:Skin|Rune) §e(?:for a limited time )?\\(.* §eleft\\)(?:§c|!)".toPattern(),
"§c\\s*♨ .* (?:Skin|Rune|Dye) §e(?:for a limited time )?\\(.* §eleft\\)(?:§c|!)".toPattern(),
"§c♨ §eVisit the Community Shop in the next §c.* §eto grab yours! §a§l\\[WARP]".toPattern(),
"§c♨ §eA Fire Sale for .* §eis starting soon!".toPattern(),
"§c♨ §r§eFire Sale for .* §r§eended!".toPattern(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ class DamageIndicatorManager {

fun removeDamageIndicator(type: BossType) {
data = data.editCopy {
values.removeIf {it.bossType == type}
values.removeIf { it.bossType == type }
}
}
}
Expand Down Expand Up @@ -642,6 +642,7 @@ class DamageIndicatorManager {
}

//Hit phase
var hitPhaseText: String? = null
val armorStandHits = entity.getNameTagWith(3, " Hit")
if (armorStandHits != null) {
val maxHits = when (entityData.bossType) {
Expand All @@ -655,23 +656,25 @@ class DamageIndicatorManager {
group("hits").toInt()
} ?: error("No hits number found in ender slayer name '${armorStandHits.name}'")

return NumberUtil.percentageColor(hits.toLong(), maxHits.toLong()).getChatColor() + "$hits Hits"
hitPhaseText = NumberUtil.percentageColor(hits.toLong(), maxHits.toLong()).getChatColor() + "$hits Hits"
}

//Laser phase
if (config.enderSlayer.laserPhaseTimer && entity.ridingEntity != null) {
//TODO more tests, more exact values, better logic? idk make this working perfectly pls
val totalTimeAlive = 7.4.seconds
val totalTimeAlive = 8.2.seconds

val ticksAlive = entity.ridingEntity.ticksExisted.ticks
val remainingTime = totalTimeAlive - ticksAlive
val formatDelay = formatDelay(remainingTime)
if (config.enderSlayer.showHealthDuringLaser) {
if (config.enderSlayer.showHealthDuringLaser || hitPhaseText != null) {
entityData.nameSuffix = " §f$formatDelay"
} else {
return formatDelay
}
}
hitPhaseText?.let {
return it
}

return result
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ object PartyCommands {
LorenzUtils.sendCommandToServer("party kickoffline")
}

fun disband() {
if (!config.shortCommands) return
if (PartyAPI.partyMembers.isEmpty()) return
LorenzUtils.sendCommandToServer("party disband")
}

fun warp() {
if (!config.shortCommands) return
if (PartyAPI.partyMembers.isEmpty()) return
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,6 @@ class DungeonHighlightClickedBlocks {
else -> return
}

// Water room
if (DungeonAPI.getRoomID() == "-60,-60") {
return
}

if (type == ClickedBlockType.WITHER_ESSENCE) {
val text = BlockUtils.getTextureFromSkull(position.toBlockPos())
if (text != "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQ" +
Expand All @@ -70,8 +65,8 @@ class DungeonHighlightClickedBlocks {
}
}

// TODO hide in water room
// if (nearWaterRoom() && type == ClickedBlockType.LEVER) return
val inWaterRoom = DungeonAPI.getRoomID() == "-60,-60"
if (inWaterRoom && type == ClickedBlockType.LEVER) return

val color = getNextColor()
val displayText = color.getChatColor() + "Clicked " + type.display
Expand Down
Loading

0 comments on commit 3b6537c

Please sign in to comment.