aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/thatgravyboat
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/thatgravyboat')
-rw-r--r--src/main/java/com/thatgravyboat/skyblockhud/api/LeaderboardGetter.java2
-rw-r--r--src/main/java/com/thatgravyboat/skyblockhud/api/events/ProfileSwitchedEvent.java4
-rw-r--r--src/main/java/com/thatgravyboat/skyblockhud/config/SBHConfigEditor.java2
-rw-r--r--src/main/java/com/thatgravyboat/skyblockhud/handlers/SlayerHandler.java34
-rw-r--r--src/main/java/com/thatgravyboat/skyblockhud/overlay/RPGHud.java4
5 files changed, 28 insertions, 18 deletions
diff --git a/src/main/java/com/thatgravyboat/skyblockhud/api/LeaderboardGetter.java b/src/main/java/com/thatgravyboat/skyblockhud/api/LeaderboardGetter.java
index 58cede8..fbf68c9 100644
--- a/src/main/java/com/thatgravyboat/skyblockhud/api/LeaderboardGetter.java
+++ b/src/main/java/com/thatgravyboat/skyblockhud/api/LeaderboardGetter.java
@@ -25,8 +25,6 @@ public class LeaderboardGetter {
private static int ticks = 0;
- //This is really bad and should use the packet instead.
-
@SubscribeEvent
public void onClientUpdate(TickEvent.ClientTickEvent event){
if (event.phase.equals(TickEvent.Phase.START)) return;
diff --git a/src/main/java/com/thatgravyboat/skyblockhud/api/events/ProfileSwitchedEvent.java b/src/main/java/com/thatgravyboat/skyblockhud/api/events/ProfileSwitchedEvent.java
index 015388a..9402858 100644
--- a/src/main/java/com/thatgravyboat/skyblockhud/api/events/ProfileSwitchedEvent.java
+++ b/src/main/java/com/thatgravyboat/skyblockhud/api/events/ProfileSwitchedEvent.java
@@ -2,6 +2,4 @@ package com.thatgravyboat.skyblockhud.api.events;
import net.minecraftforge.fml.common.eventhandler.Event;
-public class ProfileSwitchedEvent extends Event {
-
-}
+public class ProfileSwitchedEvent extends Event {}
diff --git a/src/main/java/com/thatgravyboat/skyblockhud/config/SBHConfigEditor.java b/src/main/java/com/thatgravyboat/skyblockhud/config/SBHConfigEditor.java
index 4994a5d..7f4bd23 100644
--- a/src/main/java/com/thatgravyboat/skyblockhud/config/SBHConfigEditor.java
+++ b/src/main/java/com/thatgravyboat/skyblockhud/config/SBHConfigEditor.java
@@ -36,7 +36,7 @@ public class SBHConfigEditor extends GuiElement {
};
private static final String[] socialsLink = new String[] {
"https://discord.gg/moulberry",
- "https://twitter.com/thatgravtboat/"
+ "https://twitter.com/thatgravytboat/"
};
private final long openedMillis;
diff --git a/src/main/java/com/thatgravyboat/skyblockhud/handlers/SlayerHandler.java b/src/main/java/com/thatgravyboat/skyblockhud/handlers/SlayerHandler.java
index 36833cc..b34a156 100644
--- a/src/main/java/com/thatgravyboat/skyblockhud/handlers/SlayerHandler.java
+++ b/src/main/java/com/thatgravyboat/skyblockhud/handlers/SlayerHandler.java
@@ -7,8 +7,13 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import java.util.Arrays;
import java.util.Locale;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
public class SlayerHandler {
+ //Optional Characters are required because Hypixel dumb and cuts off text
+ private static final Pattern COMBAT_XP_REGEX = Pattern.compile("\\(([\\d,]+)/([\\dkm]+)\\) comb?a?t? x?p?");
+ private static final Pattern KILLS_REGEX = Pattern.compile("(\\d+)/(\\d+) kills?");
public enum slayerTypes {
@@ -77,25 +82,32 @@ public class SlayerHandler {
@SubscribeEvent
public void onSidebarLineUpdate(SidebarLineUpdateEvent event){
+ if (!isDoingSlayer && event.formattedLine.equals("Slayer Quest")) isDoingSlayer = true;
+
if (isDoingSlayer){
String line = event.formattedLine.toLowerCase();
- if (line.contains("/") && (line.contains("kills") || (line.contains("xp")))){
+ Matcher killMatcher = KILLS_REGEX.matcher(line);
+ Matcher xpMatcher = COMBAT_XP_REGEX.matcher(line);
+
+ if (killMatcher.find()){
+ SlayerHandler.bossSlain = false;
+ SlayerHandler.isKillingBoss = false;
+ try {
+ progress = Integer.parseInt(killMatcher.group(1));
+ } catch (Exception ignored){}
+ try {
+ maxKills = Integer.parseInt(killMatcher.group(2));
+ } catch (Exception ignored){}
+ }else if (xpMatcher.find()){
SlayerHandler.bossSlain = false;
SlayerHandler.isKillingBoss = false;
- String[] killsText = line.replace(" ", "").replace("kills", "").split("/");
- if (line.contains("xp"))
- killsText = line.replace(" ", "")
- .replace("(", "")
- .replace(")", "")
- .replace("combatxp", "")
- .split("/");
try {
- progress = Integer.parseInt(killsText[0]);
+ progress = Integer.parseInt(xpMatcher.group(1));
} catch (Exception ignored){}
try {
- maxKills = Integer.parseInt(killsText[1]);
+ maxKills = Integer.parseInt(xpMatcher.group(2).replace("k", "")) * (xpMatcher.group(2).contains("k") ? 1000 : xpMatcher.group(2).contains("m") ? 1000000 : 1);
} catch (Exception ignored){}
- }else if(line.contains("slay the boss")) {
+ } else if(line.contains("slay the boss")) {
SlayerHandler.bossSlain = false;
SlayerHandler.isKillingBoss = true;
SlayerHandler.maxKills = 0;
diff --git a/src/main/java/com/thatgravyboat/skyblockhud/overlay/RPGHud.java b/src/main/java/com/thatgravyboat/skyblockhud/overlay/RPGHud.java
index 06cf94a..9356be6 100644
--- a/src/main/java/com/thatgravyboat/skyblockhud/overlay/RPGHud.java
+++ b/src/main/java/com/thatgravyboat/skyblockhud/overlay/RPGHud.java
@@ -69,8 +69,10 @@ public class RPGHud extends Gui {
boolean rightAligned = position.rightAligned(event.resolution, 120);
drawTexturedModalRect(x,y,rightAligned ? 131 : 5,6,120,47);
+
float manaWidth = Math.min(57 * ((float)mana/(float)maxMana), 57);
drawTexturedModalRect(rightAligned ? x + 16 : 47 + x,17 + y,rightAligned ? 199 : 0,64,(int)manaWidth,4);
+
float healthWidth = Math.min(70 * ((float)health/(float)maxHealth), 70);
drawTexturedModalRect(rightAligned ? x + 3 : 47+ x,22+ y,rightAligned ? 186 : 0,68,(int)healthWidth,5);
@@ -93,7 +95,7 @@ public class RPGHud extends Gui {
drawCenteredString(mc.fontRendererObj, ""+mc.thePlayer.experienceLevel, (rightAligned ? 130 : 0) + (int)(15+ x/0.75f), (int)(45+ y/0.75f), 8453920);
GlStateManager.scale(1/0.75f, 1/0.75f, 1);
GlStateManager.scale(0.75f, 0.75f, 1);
- font.drawString( ChatFormatting.RED + " \u2764 " + health +"/"+maxHealth,(rightAligned ? -40 : 0) + (int)(64+ x/0.75f), (int)(8+ y/0.75f), 0xffffff, false);
+ font.drawString( ChatFormatting.RED + " \u2764 " + health +"/"+maxHealth,(rightAligned ? -40 : 0) + (int)(64+ x/0.75f), (int)(8+ y/0.75f), 0xffffff, true);
GlStateManager.scale(1/0.75f, 1/0.75f, 1);
GlStateManager.color(255,255,255);
GlStateManager.disableBlend();