Added auto delay for crystalaura and close #784

This commit is contained in:
Bella 2020-05-10 14:35:52 -04:00
parent c8a2febc11
commit 848ada0fb2
No known key found for this signature in database
GPG Key ID: DBD4A6030080C8B3
3 changed files with 16 additions and 7 deletions

View File

@ -51,7 +51,7 @@ public class InfoOverlay extends Module {
private Setting<Boolean> godApples = register(Settings.booleanBuilder("God Apples").withValue(false).withVisibility(v -> page.getValue().equals(Page.TWO)).build());
/* Page Three */
private Setting<Boolean> speed = register(Settings.booleanBuilder("Speed").withValue(true).withVisibility(v -> page.getValue().equals(Page.THREE)).build());
private Setting<Integer> speedPrecision = register(Settings.integerBuilder("S Decimals").withValue(2).withMinimum(0).withMaximum(10).withVisibility(v -> speed.getValue() && page.getValue().equals(Page.THREE)).build());
private Setting<Integer> decimalPlaces = register(Settings.integerBuilder("Decimal Places").withValue(2).withMinimum(0).withMaximum(10).withVisibility(v -> speed.getValue() && page.getValue().equals(Page.THREE)).build());
private Setting<SpeedUnit> speedUnit = register(Settings.enumBuilder(SpeedUnit.class).withName("Speed Unit").withValue(SpeedUnit.KMH).withVisibility(v -> page.getValue().equals(Page.THREE) && speed.getValue()).build());
private Setting<Boolean> time = register(Settings.booleanBuilder("Time").withValue(true).withVisibility(v -> page.getValue().equals(Page.THREE)).build());
public Setting<TimeUtil.TimeType> timeTypeSetting = register(Settings.enumBuilder(TimeUtil.TimeType.class).withName("Time Format").withValue(TimeUtil.TimeType.HHMMSS).withVisibility(v -> page.getValue().equals(Page.THREE) && time.getValue()).build());
@ -77,11 +77,11 @@ public class InfoOverlay extends Module {
} if (time.getValue()) {
infoContents.add(getStringColour(setToText(firstColour.getValue())) + TimeUtil.getFinalTime(setToText(secondColour.getValue()), setToText(firstColour.getValue()), timeUnitSetting.getValue(), timeTypeSetting.getValue(), doLocale.getValue()));
} if (tps.getValue()) {
infoContents.add(getStringColour(setToText(firstColour.getValue())) + InfoCalculator.tps() + getStringColour(setToText(secondColour.getValue())) + " tps");
infoContents.add(getStringColour(setToText(firstColour.getValue())) + InfoCalculator.tps(decimalPlaces.getValue()) + getStringColour(setToText(secondColour.getValue())) + " tps");
} if (fps.getValue()) {
infoContents.add(getStringColour(setToText(firstColour.getValue())) + Minecraft.debugFPS + getStringColour(setToText(secondColour.getValue())) + " fps");
} if (speed.getValue()) {
infoContents.add(getStringColour(setToText(firstColour.getValue())) + speed(useUnitKmH(), mc, speedPrecision.getValue()) + getStringColour(setToText(secondColour.getValue())) + " " + unitType(speedUnit.getValue()));
infoContents.add(getStringColour(setToText(firstColour.getValue())) + speed(useUnitKmH(), mc, decimalPlaces.getValue()) + getStringColour(setToText(secondColour.getValue())) + " " + unitType(speedUnit.getValue()));
} if (timerSpeed.getValue()) {
infoContents.add(getStringColour(setToText(firstColour.getValue())) + TimerSpeed.returnGui() + getStringColour(setToText(secondColour.getValue())) + "t");
} if (ping.getValue()) {

View File

@ -66,7 +66,8 @@ public class CrystalAura extends Module {
private Setting<Boolean> explode = register(Settings.booleanBuilder("Explode").withValue(false).withVisibility(v -> p.getValue().equals(Page.ONE)).build());
private Setting<Boolean> checkAbsorption = register(Settings.booleanBuilder("Check Absorption").withValue(true).withVisibility(v -> p.getValue().equals(Page.ONE)).build());
public Setting<Double> range = register(Settings.doubleBuilder("Range").withMinimum(1.0).withValue(4.0).withMaximum(10.0).withVisibility(v -> p.getValue().equals(Page.ONE)).build());
private Setting<Double> delay = register(Settings.doubleBuilder("Hit Delay").withMinimum(0.0).withValue(5.0).withMaximum(10.0).withVisibility(v -> p.getValue().equals(Page.ONE)).build());
private Setting<Boolean> autoDelay = register(Settings.booleanBuilder("Auto Delay").withValue(false).withVisibility(v -> p.getValue().equals(Page.ONE)).build());
private Setting<Double> delay = register(Settings.doubleBuilder("Hit Delay").withMinimum(0.0).withValue(5.0).withMaximum(10.0).withVisibility(v -> !autoDelay.getValue() && p.getValue().equals(Page.ONE)).build());
private Setting<Integer> hitAttempts = register(Settings.integerBuilder("Hit Attempts").withValue(-1).withMinimum(-1).withMaximum(20).withVisibility(v -> p.getValue().equals(Page.ONE)).build());
private Setting<Double> minDmg = register(Settings.doubleBuilder("Minimum Damage").withMinimum(0.0).withValue(0.0).withMaximum(32.0).withVisibility(v -> p.getValue().equals(Page.ONE)).build());
private Setting<Boolean> sneakEnable = register(Settings.booleanBuilder("Sneak Surround").withValue(true).withVisibility(v -> p.getValue().equals(Page.ONE)).build());
@ -165,7 +166,7 @@ public class CrystalAura extends Module {
if (explode.getValue() && crystal != null && mc.player.getDistance(crystal) <= range.getValue() && passSwordCheck()) {
// Added delay to stop ncp from flagging "hitting too fast"
if (((System.nanoTime() / 1000000f) - systemTime) >= 25*delay.getValue()) {
if (((System.nanoTime() / 1000000f) - systemTime) >= 25 * getDelay()) {
if (antiWeakness.getValue() && mc.player.isPotionActive(MobEffects.WEAKNESS)) {
if (!isAttacking) {
// save initial player hand
@ -596,4 +597,12 @@ public class CrystalAura extends Module {
sendChatMessage(getChatName() + message);
}
}
private double getDelay() {
if (!autoDelay.getValue()) {
return delay.getValue();
}
int ping = InfoCalculator.ping(mc);
return 2 * ping * (InfoCalculator.tps(2) / 20) + (ping / 10.0);
}
}

View File

@ -75,8 +75,8 @@ public class InfoCalculator {
// }
// Ticks Per Second {
public static String tps() {
return "" + Math.round(LagCompensator.INSTANCE.getTickRate());
public static double tps(int places) {
return MathsUtils.round(LagCompensator.INSTANCE.getTickRate(), places);
}
// }