aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/me/Danker/features/loot/ZombieTracker.java
blob: 922e1f4987ef3988ac064e75d59a6b642ee06aa1 (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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
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 ZombieTracker {

    public static int revs;
    public static int revFlesh;
    public static int revViscera;
    public static int foulFlesh;
    public static int foulFleshDrops;
    public static int pestilences;
    public static int undeadCatas;
    public static int books;
    public static int booksT7;
    public static int beheadeds;
    public static int revCatas;
    public static int snakes;
    public static int scythes;
    public static int shards;
    public static int wardenHearts;
    public static double time;
    public static int bosses;

    public static int revsSession = 0;
    public static int revFleshSession = 0;
    public static int revVisceraSession = 0;
    public static int foulFleshSession = 0;
    public static int foulFleshDropsSession = 0;
    public static int pestilencesSession = 0;
    public static int undeadCatasSession = 0;
    public static int booksSession = 0;
    public static int booksT7Session = 0;
    public static int beheadedsSession = 0;
    public static int revCatasSession = 0;
    public static int snakesSession = 0;
    public static int scythesSession = 0;
    public static int shardsSession = 0;
    public static int wardenHeartsSession = 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("   Zombie Slayer LVL ")) { // Zombie
            revs++;
            revsSession++;
            if (bosses != -1) {
                bosses++;
            }
            if (bossesSession != 1) {
                bossesSession++;
            }
            ConfigHandler.writeIntConfig("zombie", "revs", revs);
            ConfigHandler.writeIntConfig("zombie", "bossRNG", bosses);
        } else if (message.contains("RARE DROP! (") && message.contains("Revenant Viscera)")) {
            int amount = LootTracker.getAmountfromMessage(message);
            revViscera += amount;
            revVisceraSession += amount;
            ConfigHandler.writeIntConfig("zombie", "revViscera", revViscera);
        } else if (message.contains("RARE DROP! (") && message.contains("Foul Flesh)")) {
            int amount = LootTracker.getAmountfromMessage(message);
            foulFlesh += amount;
            foulFleshSession += amount;
            foulFleshDrops++;
            foulFleshDropsSession++;
            ConfigHandler.writeIntConfig("zombie", "foulFlesh", foulFlesh);
            ConfigHandler.writeIntConfig("zombie", "foulFleshDrops", foulFleshDrops);
        } else if (message.contains("VERY RARE DROP!  (Revenant Catalyst)")) {
            revCatas++;
            revCatasSession++;
            ConfigHandler.writeIntConfig("zombie", "revCatalyst", revCatas);
        } else if (message.contains("VERY RARE DROP!  (") && message.contains(" Pestilence Rune I)")) {
            pestilences++;
            pestilencesSession++;
            ConfigHandler.writeIntConfig("zombie", "pestilence", pestilences);
        } else if (message.contains("VERY RARE DROP!  (Smite VI)")) {
            books++;
            booksSession++;
            ConfigHandler.writeIntConfig("zombie", "book", books);
        } else if (message.contains("VERY RARE DROP!  (Smite VII)")) {
            booksT7++;
            booksT7Session++;
            ConfigHandler.writeIntConfig("zombie", "bookT7", booksT7);
        } else if (message.contains("VERY RARE DROP!  (Undead Catalyst)")) {
            undeadCatas++;
            undeadCatasSession++;
            ConfigHandler.writeIntConfig("zombie", "undeadCatalyst", undeadCatas);
        } else if (message.contains("CRAZY RARE DROP!  (Beheaded Horror)")) {
            rng = true;
            beheadeds++;
            beheadedsSession++;
            ConfigHandler.writeIntConfig("zombie", "beheaded", beheadeds);
            if (ToggleCommand.rngesusAlerts) Utils.createTitle(EnumChatFormatting.DARK_PURPLE + "BEHEADED HORROR!", 3);
        } else if (message.contains("CRAZY RARE DROP!  (") && message.contains(" Snake Rune I)")) {
            rng = true;
            snakes++;
            snakesSession++;
            ConfigHandler.writeIntConfig("zombie", "snake", snakes);
            if (ToggleCommand.rngesusAlerts) Utils.createTitle(EnumChatFormatting.DARK_GREEN + "SNAKE RUNE!", 3);
        } else if (message.contains("CRAZY RARE DROP!  (Scythe Blade)")) {
            rng = true;
            scythes++;
            scythesSession++;
            ConfigHandler.writeIntConfig("zombie", "scythe", scythes);
            if (ToggleCommand.rngesusAlerts) Utils.createTitle(EnumChatFormatting.GOLD + "SCYTHE BLADE!", 5);
        } else if (message.contains("CRAZY RARE DROP!  (Shard of the Shredded)")) {
            rng = true;
            shards++;
            shardsSession++;
            ConfigHandler.writeIntConfig("zombie", "shard", shards);
            if (ToggleCommand.rngesusAlerts) Utils.createTitle(EnumChatFormatting.RED + "SHARD OF THE SHREDDED!", 5);
        } else if (message.contains("INSANE DROP!  (Warden Heart)") || message.contains("CRAZY RARE DROP!  (Warden Heart)")) {
            rng = true;
            wardenHearts++;
            wardenHeartsSession++;
            ConfigHandler.writeIntConfig("zombie", "heart", wardenHearts);
            if (ToggleCommand.rngesusAlerts) Utils.createTitle(EnumChatFormatting.RED + "WARDEN HEART!", 5);
        }

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

}