blob: b9f70c485602cc14ff0662be4d0fe5f0f1d3ca6c (
plain)
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
|
package moe.nea.ledger.modules
import moe.nea.ledger.ItemChange
import moe.nea.ledger.ItemId
import moe.nea.ledger.LedgerEntry
import moe.nea.ledger.LedgerLogger
import moe.nea.ledger.TransactionType
import moe.nea.ledger.events.ChatReceived
import moe.nea.ledger.events.WorldSwitchEvent
import moe.nea.ledger.useMatcher
import moe.nea.ledger.utils.di.Inject
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
class DragonEyePlacementDetection {
val eyePlaced = "☬ You placed a Summoning Eye!( Brace yourselves!)? \\(./.\\)".toPattern()
//☬ You placed a Summoning Eye! Brace yourselves! (8/8)
var eyeCount = 0
@SubscribeEvent
fun onWorldSwap(event: WorldSwitchEvent) {
eyeCount = 0
}
@SubscribeEvent
fun onRetrieveEye(event: ChatReceived) {
if (event.message == "You recovered a Summoning Eye!") {
eyeCount--
}
eyePlaced.useMatcher(event.message) {
eyeCount++
}
if (event.message == "Your Sleeping Eyes have been awoken by the magic of the Dragon. They are now Remnants of the Eye!") {
logger.logEntry(LedgerEntry(
TransactionType.WYRM_EVOKED,
event.timestamp,
listOf(
ItemChange.lose(ItemId.SUMMONING_EYE, eyeCount)
)
))
eyeCount = 0
}
}
@Inject
lateinit var logger: LedgerLogger
}
|