aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/me/Danker/features/loot/WolfTracker.java
blob: 906f5079e2dc6f5a8de6d1b00f051b5b30c512c8 (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
111
112
113
114
115
116
117
118
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 WolfTracker {

    public static int svens;
    public static int teeth;
    public static int wheels;
    public static int wheelsDrops;
    public static int spirits;
    public static int books;
    public static int furballs;
    public static int eggs;
    public static int coutures;
    public static int baits;
    public static int fluxes;
    public static double time;
    public static int bosses;

    public static int svensSession = 0;
    public static int teethSession = 0;
    public static int wheelsSession = 0;
    public static int wheelsDropsSession = 0;
    public static int spiritsSession = 0;
    public static int booksSession = 0;
    public static int furballsSession = 0;
    public static int eggsSession = 0;
    public static int couturesSession = 0;
    public static int baitsSession = 0;
    public static int fluxesSession = 0;
    public static double timeSession = -1;
    public static int bossesSession = -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("   Wolf Slayer LVL ")) {
            svens++;
            svensSession++;
            if (bosses != -1) {
                bosses++;
            }
            if (bossesSession != -1) {
                bossesSession++;
            }
            ConfigHandler.writeIntConfig("wolf", "svens", svens);
            ConfigHandler.writeIntConfig("wolf", "bossRNG", bosses);
        } else if (message.contains("RARE DROP! (") && message.contains("Hamster Wheel)")) {
            int amount = LootTracker.getAmountfromMessage(message);
            wheels += amount;
            wheelsSession += amount;
            wheelsDrops++;
            wheelsDropsSession++;
            ConfigHandler.writeIntConfig("wolf", "wheel", wheels);
            ConfigHandler.writeIntConfig("wolf", "wheelDrops", wheelsDrops);
        } else if (message.contains("VERY RARE DROP!  (") && message.contains(" Spirit Rune I)")) { // Removing the unicode here *should* fix rune drops not counting
            spirits++;
            spiritsSession++;
            ConfigHandler.writeIntConfig("wolf", "spirit", spirits);
        } else if (message.contains("VERY RARE DROP!  (Critical VI)")) {
            books++;
            booksSession++;
            ConfigHandler.writeIntConfig("wolf", "book", books);
        } else if (message.contains("VERY RARE DROP!  (Furball)")) {
            furballs++;
            furballsSession++;
            ConfigHandler.writeIntConfig("wolf", "furball", furballs);
        } else if (message.contains("CRAZY RARE DROP!  (Red Claw Egg)")) {
            rng = true;
            eggs++;
            eggsSession++;
            ConfigHandler.writeIntConfig("wolf", "egg", eggs);
            if (ToggleCommand.rngesusAlerts) Utils.createTitle(EnumChatFormatting.DARK_RED + "RED CLAW EGG!", 3);
        } else if (message.contains("CRAZY RARE DROP!  (") && message.contains(" Couture Rune I)")) {
            rng = true;
            coutures++;
            couturesSession++;
            ConfigHandler.writeIntConfig("wolf", "couture", coutures);
            if (ToggleCommand.rngesusAlerts) Utils.createTitle(EnumChatFormatting.GOLD + "COUTURE RUNE!", 3);
        } else if (message.contains("CRAZY RARE DROP!  (Grizzly Bait)") || message.contains("CRAZY RARE DROP! (Rename Me)")) { // How did Skyblock devs even manage to make this item Rename Me
            rng = true;
            baits++;
            baitsSession++;
            ConfigHandler.writeIntConfig("wolf", "bait", baits);
            if (ToggleCommand.rngesusAlerts) Utils.createTitle(EnumChatFormatting.AQUA + "GRIZZLY BAIT!", 3);
        } else if (message.contains("CRAZY RARE DROP!  (Overflux Capacitor)")) {
            rng = true;
            fluxes++;
            fluxesSession++;
            ConfigHandler.writeIntConfig("wolf", "flux", fluxes);
            if (ToggleCommand.rngesusAlerts) Utils.createTitle(EnumChatFormatting.DARK_PURPLE + "OVERFLUX CAPACITOR!", 5);
        }

        if (rng) {
            time = System.currentTimeMillis() / 1000;
            bosses = 0;
            timeSession = System.currentTimeMillis() / 1000;
            bossesSession = 0;
            ConfigHandler.writeDoubleConfig("wolf", "timeRNG", time);
            ConfigHandler.writeIntConfig("wolf", "bossRNG", 0);
        }
    }

}