aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/me/Danker/features/loot/SpiderTracker.java
blob: 34ee695d1f1078a41c6697bf3dffdd2cfb5e9f00 (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
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
package me.Danker.features.loot;

import me.Danker.commands.ToggleCommand;
import me.Danker.handlers.ConfigHandler;
import me.Danker.utils.Utils;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.StringUtils;
import net.minecraftforge.client.event.ClientChatReceivedEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;

public class SpiderTracker {

    public static int spiderTarantulas;
    public static int spiderWebs;
    public static int spiderTAP;
    public static int spiderTAPDrops;
    public static int spiderBites;
    public static int spiderCatalysts;
    public static int spiderBooks;
    public static int spiderSwatters;
    public static int spiderTalismans;
    public static int spiderMosquitos;
    public static double spiderTime;
    public static int spiderBosses;

    public static int spiderTarantulasSession = 0;
    public static int spiderWebsSession = 0;
    public static int spiderTAPSession = 0;
    public static int spiderTAPDropsSession = 0;
    public static int spiderBitesSession = 0;
    public static int spiderCatalystsSession = 0;
    public static int spiderBooksSession = 0;
    public static int spiderSwattersSession = 0;
    public static int spiderTalismansSession = 0;
    public static int spiderMosquitosSession = 0;
    public static double spiderTimeSession = -1;
    public static int spiderBossesSession = -1;

    @SubscribeEvent
    public void onChat(ClientChatReceivedEvent event) {
        String message = StringUtils.stripControlCodes(event.message.getUnformattedText());

        if (!Utils.inSkyblock) return;
        if (event.type == 2) return;
        if (message.contains(":")) return;

        boolean rng = false;

        if (message.contains("   Spider Slayer LVL ")) { // Spider
            spiderTarantulas++;
            spiderTarantulasSession++;
            if (spiderBosses != -1) {
                spiderBosses++;
            }
            if (spiderBossesSession != -1) {
                spiderBossesSession++;
            }
            ConfigHandler.writeIntConfig("spider", "tarantulas", spiderTarantulas);
            ConfigHandler.writeIntConfig("spider", "bossRNG", spiderBosses);
        } else if (message.contains("RARE DROP! (") && message.contains("Toxic Arrow Poison)")) {
            int amount = LootTracker.getAmountfromMessage(message);
            spiderTAP += amount;
            spiderTAPSession += amount;
            spiderTAPDrops++;
            spiderTAPDropsSession++;
            ConfigHandler.writeIntConfig("spider", "tap", spiderTAP);
            ConfigHandler.writeIntConfig("spider", "tapDrops", spiderTAPDrops);
        } else if (message.contains("VERY RARE DROP!  (") && message.contains(" Bite Rune I)")) {
            spiderBites++;
            spiderBitesSession++;
            ConfigHandler.writeIntConfig("spider", "bite", spiderBites);
        } else if (message.contains("VERY RARE DROP!  (Bane of Arthropods VI)")) {
            spiderBooks++;
            spiderBooksSession++;
            ConfigHandler.writeIntConfig("spider", "book", spiderBooks);
        } else if (message.contains("VERY RARE DROP!  (Spider Catalyst)")) {
            spiderCatalysts++;
            spiderCatalystsSession++;
            ConfigHandler.writeIntConfig("spider", "catalyst", spiderCatalysts);
        } else if (message.contains("CRAZY RARE DROP!  (Fly Swatter)")) {
            rng = true;
            spiderSwatters++;
            spiderSwattersSession++;
            ConfigHandler.writeIntConfig("spider", "swatter", spiderSwatters);
            if (ToggleCommand.rngesusAlerts) Utils.createTitle(EnumChatFormatting.LIGHT_PURPLE + "FLY SWATTER!", 3);
        } else if (message.contains("CRAZY RARE DROP!  (Tarantula Talisman")) {
            rng = true;
            spiderTalismans++;
            spiderTalismansSession++;
            ConfigHandler.writeIntConfig("spider", "talisman", spiderTalismans);
            if (ToggleCommand.rngesusAlerts) Utils.createTitle(EnumChatFormatting.DARK_PURPLE + "TARANTULA TALISMAN!", 3);
        } else if (message.contains("CRAZY RARE DROP!  (Digested Mosquito)")) {
            rng = true;
            spiderMosquitos++;
            spiderMosquitosSession++;
            ConfigHandler.writeIntConfig("spider", "mosquito", spiderMosquitos);
            if (ToggleCommand.rngesusAlerts) Utils.createTitle(EnumChatFormatting.GOLD + "DIGESTED MOSQUITO!", 5);
        }

        if (rng) {
            spiderTime = System.currentTimeMillis() / 1000;
            spiderBosses = 0;
            spiderTimeSession = System.currentTimeMillis() / 1000;
            spiderBossesSession = 0;
            ConfigHandler.writeDoubleConfig("spider", "timeRNG", spiderTime);
            ConfigHandler.writeIntConfig("spider", "bossRNG", 0);
        }
    }

}