1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
package at.hannibal2.skyhanni.features.combat.ghostcounter
import java.util.regex.Pattern
import kotlin.math.roundToInt
object GhostData {
private var session = mutableMapOf(
Option.KILLS to 0.0,
Option.SORROWCOUNT to 0.0,
Option.VOLTACOUNT to 0.0,
Option.PLASMACOUNT to 0.0,
Option.GHOSTLYBOOTS to 0.0,
Option.BAGOFCASH to 0.0,
Option.TOTALDROPS to 0.0,
Option.SCAVENGERCOINS to 0.0,
Option.MAXKILLCOMBO to 0.0,
Option.SKILLXPGAINED to 0.0
)
// TODO repo
val bestiaryData = mutableMapOf<Int, Int>().apply {
for (i in 1..25) {
this[i] = when (i) {
1, 2, 3, 4, 5 -> 4
6 -> 20
7 -> 40
8, 9 -> 60
10 -> 100
11 -> 300
12 -> 600
13 -> 800
14, 15, 16, 17 -> 1_000
18 -> 1_200
19, 20 -> 1_400
21 -> 10_000
22, 23, 24, 25 -> 20_000
else -> 0
}
}
}
enum class Option(val pattern: Pattern? = null) {
KILLS,
SORROWCOUNT("§6§lRARE DROP! §r§9Sorrow §r§b\\([+](?<mf>.*)% §r§b✯ Magic Find§r§b\\)".toPattern()),
VOLTACOUNT("§6§lRARE DROP! §r§9Volta §r§b\\([+](?<mf>.*)% §r§b✯ Magic Find§r§b\\)".toPattern()),
PLASMACOUNT("§6§lRARE DROP! §r§9Plasma §r§b\\([+](?<mf>.*)% §r§b✯ Magic Find§r§b\\)".toPattern()),
GHOSTLYBOOTS("§6§lRARE DROP! §r§9Ghostly Boots §r§b\\([+](?<mf>.*)% §r§b✯ Magic Find§r§b\\)".toPattern()),
BAGOFCASH("§eThe ghost's death materialized §r§61,000,000 coins §r§efrom the mists!".toPattern()),
KILLCOMBOCOINS("[+]\\d+ Kill Combo [+](?<coin>.*) coins per kill".toPattern()),
TOTALDROPS,
GHOSTSINCESORROW,
SCAVENGERCOINS,
MAXKILLCOMBO,
KILLCOMBO("[+]\\d+ Kill Combo [+](?<coin>.*) coins per kill".toPattern()),
SKILLXPGAINED;
fun add(i: Double, s: Boolean = false) {
if (s)
session[this] = session[this]?.plus(i) ?: i
else
GhostCounter.storage?.data?.set(this, GhostCounter.storage?.data?.get(this)?.plus(i) ?: i)
}
fun set(i: Double, s: Boolean = false) {
if (s)
session[this] = i
else
GhostCounter.storage?.data?.set(this, i)
}
fun getInt(s: Boolean = false): Int {
return if (s)
session[this]?.roundToInt() ?: 0
else
GhostCounter.storage?.data?.get(this)?.roundToInt() ?: 0
}
fun get(s: Boolean = false): Double {
return if (s)
session[this] ?: 0.0
else
GhostCounter.storage?.data?.get(this) ?: 0.0
}
}
}
|