This repository was archived by the owner on Nov 27, 2024. It is now read-only.
File tree 3 files changed +5
-6
lines changed
src/main/kotlin/dev/nyon/skylper/skyblock/data/api
3 files changed +5
-6
lines changed Original file line number Diff line number Diff line change @@ -39,11 +39,10 @@ object CrystalHollowsPowderGrindingApi {
39
39
if (startTime == null ) startTime = now
40
40
val amount = regex.singleGroup(rawText)?.doubleOrNull()?.toInt() ? : return @associateWith 0
41
41
amount
42
- }
42
+ }.toMutableMap().filter { it.value != 0 }
43
43
44
44
EventHandler .invokeEvent(TreasureChestRewardsEvent (rewards))
45
45
46
-
47
46
rewards.forEach { (reward, amount) ->
48
47
if (! chestRewardToPowderType.containsKey(reward)) return @forEach
49
48
val type = chestRewardToPowderType[reward] ? : return @forEach
Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ object PetApi {
36
36
}
37
37
38
38
private fun petFound (name : String , level : Int? ) {
39
- val storedPet = pets.find { it.type == name } ? : return
39
+ val storedPet = pets.find { it.type == name.uppercase() } ? : return
40
40
pets.forEach { it.active = false }
41
41
level?.let { storedPet.level = it }
42
42
storedPet.active = true
@@ -56,8 +56,8 @@ object PetApi {
56
56
if (! petTitleRegex.matches(rawScreenTitle)) return @listenInfoEvent
57
57
val itemName = itemStack.nameAsString
58
58
val level = petNameRegex.singleGroup(itemName)?.toIntOrNull() ? : return @listenInfoEvent
59
- val petInfo = itemStack.compoundTag?.getCompound (" petInfo" ) ? : return @listenInfoEvent
60
- val pet = json.decodeFromString<Pet >(petInfo.toString())
59
+ val petInfo = itemStack.compoundTag?.getString (" petInfo" ) ? : return @listenInfoEvent
60
+ val pet = kotlin.runCatching { json.decodeFromString<Pet >(petInfo) }.getOrNull() ? : return @listenInfoEvent
61
61
if (pet.active) currentPet = pet
62
62
pet.level = level
63
63
pets.add(pet)
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ object PowderApi {
15
15
val currentGemstonePowder get() = HeartOfTheMountainApi .data.currentGemstonePowder
16
16
val currentGlacitePowder get() = HeartOfTheMountainApi .data.currentGlacitePowder
17
17
18
- // This function does not consider glacite powder yet. Atm only used for Powder Grinding calculation.
18
+ // Only used for Powder Grinding calculation.
19
19
fun getPowderMultiplier (type : PowderType ): Double {
20
20
var multiplier = if (CrystalHollowsPowderGrindingApi .doublePowderActive) 2.0 else 1.0
21
21
multiplier + = HeartOfTheMountainApi .data.powderBuffLevel.toFloat() / 100.0
You can’t perform that action at this time.
0 commit comments