11package com.github.subat0m1c.hatecheaters.modules
22
33import com.github.subat0m1c.hatecheaters.HateCheaters.Companion.launch
4+ import com.github.subat0m1c.hatecheaters.utils.DungeonStats.displayDungeonData
45import com.github.subat0m1c.hatecheaters.pvgui.v2.utils.Utils.formatted
5- import com.github.subat0m1c.hatecheaters.utils.ChatUtils.capitalizeWords
6- import com.github.subat0m1c.hatecheaters.utils.ChatUtils.chatConstructor
7- import com.github.subat0m1c.hatecheaters.utils.ChatUtils.colorStat
8- import com.github.subat0m1c.hatecheaters.utils.ChatUtils.colorize
96import com.github.subat0m1c.hatecheaters.utils.ChatUtils.modMessage
107import com.github.subat0m1c.hatecheaters.utils.ChatUtils.secondsToMinutes
8+ import com.github.subat0m1c.hatecheaters.utils.ItemUtils.witherImpactRegex
119import com.github.subat0m1c.hatecheaters.utils.LogHandler.Logger
12- import com.github.subat0m1c.hatecheaters.utils.apiutils.DataUtils.colorName
13- import com.github.subat0m1c.hatecheaters.utils.apiutils.DataUtils.maxMagicalPower
14- import com.github.subat0m1c.hatecheaters.utils.apiutils.HypixelData
15- import com.github.subat0m1c.hatecheaters.utils.apiutils.LevelUtils.cataLevel
16- import com.github.subat0m1c.hatecheaters.utils.apiutils.LevelUtils.classAverage
17- import com.github.subat0m1c.hatecheaters.utils.apiutils.LevelUtils.classLevel
1810import com.github.subat0m1c.hatecheaters.utils.apiutils.ParseUtils.getSkyblockProfile
1911import me.odinmain.features.Category
2012import me.odinmain.features.Module
@@ -24,11 +16,10 @@ import me.odinmain.utils.*
2416import me.odinmain.utils.skyblock.*
2517import me.odinmain.utils.skyblock.PlayerUtils.alert
2618import kotlin.collections.HashSet
27- import kotlin.math.ceil
2819
2920object BetterPartyFinder : Module(
3021 name = " Better Party Finder" ,
31- description = " Provides stats when a player joins your party. Includes autokick functionality. /hcitems to configure important items list.sk " ,
22+ description = " Provides stats when a player joins your party. Includes autokick functionality. /hcitems to configure important items list." ,
3223 category = Category .DUNGEON
3324) {
3425 private val fullPartyNotification by BooleanSetting (" Full Party Notification" , default = true , description = " Notifies you when your party is full." )
@@ -90,7 +81,7 @@ object BetterPartyFinder : Module(
9081 val profiles = getSkyblockProfile(name).getOrElse { return @launch modMessage(it.message) }
9182 profiles.profileData.profiles
9283 .find { it.selected }?.members?.get(profiles.uuid)
93- ?.let { displayDungeonData(it, profiles.name) }
84+ ?.let { displayDungeonData(it, profiles.name, petMap.keys, floor ) }
9485 ? : return @launch modMessage("""
9586 ${getChatBreak()}
9687 Could not find info for player $name
@@ -103,7 +94,6 @@ object BetterPartyFinder : Module(
10394
10495 onMessage(pfRegex, { enabled && autokicktoggle}) {
10596 val name = it.groupValues[1 ].takeUnless { it == mc.session.username } ? : return @onMessage
106-
10797 Logger .info(" $name is being searched" )
10898
10999 if (kickedList.contains(name) && kickCache) {
@@ -171,124 +161,12 @@ object BetterPartyFinder : Module(
171161 return @launch modMessage(" Kicking $name for: \n ${kickedReasons.joinToString(" \n " )} " )
172162 }
173163
174- displayDungeonData(currentProfile, profiles.name)
164+ displayDungeonData(currentProfile, profiles.name, petMap.keys, floor )
175165 }
176166 }
177167
178168 onMessage(kickRegex, { kickCache && enabled }) { message ->
179169 message.groupValues[1 ].takeUnless { name -> kickedList.contains(name) }?.let { name -> kickedList.add(name) }
180170 }
181171 }
182-
183- private val witherImpactRegex = Regex (" (?:⦾ )?Ability: Wither Impact {2}RIGHT CLICK" )
184-
185- fun displayDungeonData (currentProfile : HypixelData .MemberData , name : String ) {
186- val catacombs = currentProfile.dungeons
187-
188- val profileKills = currentProfile.playerStats.kills
189-
190- val fpbs = (1 .. 7 ).map { it to catacombs.dungeonTypes.catacombs.fastestTimeSPlus[it.toString()] }
191- val mmpbs = (1 .. 7 ).map { it to catacombs.dungeonTypes.mastermode.fastestTimeSPlus[it.toString()] }
192-
193- val allItems = currentProfile.allItems
194-
195- val armor = currentProfile.inventory.invArmor.itemStacks.filterNotNull().reversed()
196-
197- val pets = buildMap {
198- currentProfile.pets.pets.forEachIndexed { i, pet ->
199- if (pet.type in petMap.keys) put(pet.colorName, pet.heldItem?.formatted)
200- }
201- }
202-
203- val items = importantItems.toSet().map { Pair (it, it.replace(" " , " _" ).uppercase() in allItems.map { it.skyblockID } ) }
204-
205- val mmComps = (catacombs.dungeonTypes.mastermode.tierComps.toMutableMap().apply { this .remove(" total" ) }).values.sum()
206- val floorComps = (catacombs.dungeonTypes.catacombs.tierComps.toMutableMap().apply { this .remove(" total" ) }).values.sum()
207-
208- val hype = allItems.find { it?.lore?.any { it.noControlCodes.matches(witherImpactRegex) } == true }
209-
210- val tunings = currentProfile.accessoryBagStorage.tuning.currentTunings.map { " ${it.key.replace(" _" , " " ).capitalizeWords().colorStat} §7: ${it.value.colorize(ceil(currentProfile.magicalPower / 10.0 ))} " }
211-
212- chatConstructor {
213- displayText(getChatBreak())
214-
215- clickText(
216- " \n §3| §2Player: §b$name " ,
217- " /pv $name " ,
218- listOf (" §e§lCLICK §r§ato open profile viewer for §b$name " )
219- )
220-
221- displayText(" \n §3| §4Cata Level: §f${catacombs.dungeonTypes.cataLevel.round(2 ).colorize(50 )} §8: " )
222-
223- hoverText(
224- " §dClass Avg: §6${catacombs.classAverage.round(2 ).colorize(50 )} \n " ,
225- catacombs.classes.entries.map { " §e${it.key.capitalizeFirst()} §7| ${it.value.classLevel.round(2 ).colorize(50 )} " }
226- )
227-
228- displayText("""
229- §3| §bSecrets: §f${catacombs.secrets.colorize(100000 )} §8: §bAverage: §f${(catacombs.secrets.toDouble()/ (mmComps + floorComps)).round(2 ).colorize(15.0 )}
230- §3| §cBlood mobs: §f${(profileKills[" watcher_summon_undead" ] ? : 0 ) + (profileKills[" master_watcher_summon_undead" ] ? : 0 )}
231- """ .trimIndent()
232- )
233-
234- displayText()
235-
236- if (currentProfile.inventoryApi) {
237- hoverText(
238- " \n §3| §5Magical Power: §f${currentProfile.magicalPower.colorize(maxMagicalPower)} " ,
239- listOf (" Tunings: " ) + tunings
240- )
241-
242- displayText()
243-
244- hype?.let {
245- hoverText(" \n §3| §5Wither Impact: §l§2Found!" , (listOf (it.displayName) + it.lore))
246- } ? : displayText(" \n §3| §5Wither Impact: §o§4Missing!" )
247- } else {
248- hoverText(
249- " \n §3| §5Assumed Magical Power: ${currentProfile.assumedMagicalPower.colorize(maxMagicalPower)} " ,
250- listOf (" Assumed using the following tunings:" ) + tunings
251- )
252-
253- displayText()
254-
255- displayText(" \n §3| §o§4Inventory API Disabled!" )
256- }
257-
258- displayText()
259-
260- armor.forEach {
261- hoverText(
262- " \n §3| ${it.displayName} " ,
263- (listOf (it.displayName) + it.lore)
264- )
265- }
266-
267- if (armor.isNotEmpty()) displayText()
268-
269- if (pets.isNotEmpty()) { // this isnt string built to allow different hover texts
270- displayText(" \n §3| " )
271- pets.entries.forEachIndexed { i, (pet, item) ->
272- hoverText(" ${pet}${if (i != pets.entries.size - 1 ) " , " else " \n " } " , listOf (" §7Held Item: ${item ? : " §o§4None!" } " ))
273- }
274- }
275-
276- hoverText(
277- " \n §3| §7Personal Bests §e§lHOVER §7(F${floor} : ${fpbs.getSafe(floor- 1 )?.second?.let { secondsToMinutes(it * 0.001 ) } ? : " §o§4None!" } )" ,
278- fpbs.map { " §aFloor ${it.first} §7| §2${it.second?.let { secondsToMinutes(it * 0.001 ) } ? : " §o§4None!" } " }
279- )
280-
281- hoverText(
282- " \n §3| §4§lMM §8Personal Bests §e§lHOVER §7(M${floor} : ${mmpbs.getSafe(floor- 1 )?.second?.let { secondsToMinutes(it * 0.001 ) } ? : " §o§4None!" } )" ,
283- mmpbs.map { " §cFloor ${it.first} §7| §2${it.second?.let { secondsToMinutes(it * 0.001 ) } ? : " §o§4None!" } " }
284- )
285-
286- if (importantItems.isNotEmpty() && allItems.isNotEmpty()) hoverText(
287- " \n\n §3| §5Important Items §e§lHOVER" ,
288- items.map { " §b${it.first.capitalizeWords()} §7-> ${if (it.second) " §a✔" else " §4§l✖" } " }
289- )
290-
291- displayText(getChatBreak())
292- }.print ()
293- }
294172}
0 commit comments