fix auction slots full not working for coop users + devauth for log in

This commit is contained in:
NK 2023-05-27 18:07:17 +01:00
parent 2b20982132
commit 8ba3cf4ccc
4 changed files with 39 additions and 25 deletions

View file

@ -67,8 +67,9 @@ dependencies {
compileOnly("org.projectlombok:lombok:1.18.26") compileOnly("org.projectlombok:lombok:1.18.26")
annotationProcessor("org.projectlombok:lombok:1.18.26") annotationProcessor("org.projectlombok:lombok:1.18.26")
shade("net.dv8tion:JDA:5.0.0-beta.9") { shade("net.dv8tion:JDA:5.0.0-beta.9") {
exclude (module = "opus-java") exclude(module = "opus-java")
} }
implementation("me.djtheredstoner:DevAuth-forge-legacy:1.1.0")
} }
} }

View file

@ -4,6 +4,8 @@ pluginManagement {
mavenCentral() mavenCentral()
maven("https://repo.polyfrost.cc/releases") maven("https://repo.polyfrost.cc/releases")
maven("https://maven.architectury.dev/") maven("https://maven.architectury.dev/")
maven("https://pkgs.dev.azure.com/djtheredstoner/DevAuth/_packaging/public/maven/v1")
} }
plugins { plugins {
val egtVersion = "0.1.18" val egtVersion = "0.1.18"

View file

@ -32,7 +32,7 @@ public class SniperFlipperEvents {
public void onTick(TickEvent.ClientTickEvent event) { public void onTick(TickEvent.ClientTickEvent event) {
if (Lilase.mc.thePlayer == null || event.phase != TickEvent.Phase.START) return; if (Lilase.mc.thePlayer == null || event.phase != TickEvent.Phase.START) return;
try { try {
if (selling_queue.get(0) != null) selling_queue.forEach(Flipper::switchStates); if (selling_queue.get(0) != null) selling_queue.forEach(Flipper::onTick);
} catch (Exception ignored) { } catch (Exception ignored) {
} }
} }

View file

@ -75,7 +75,7 @@ public class Flipper {
} }
} }
public void switchStates() { public void onTick() {
switch (state) { switch (state) {
case WALKING_TO_FIRST_POINT: case WALKING_TO_FIRST_POINT:
if (Lilase.mc.currentScreen != null) { if (Lilase.mc.currentScreen != null) {
@ -155,33 +155,28 @@ public class Flipper {
if (InventoryUtils.inventoryNameContains("Manage Auctions") && buyWait.passed()) { if (InventoryUtils.inventoryNameContains("Manage Auctions") && buyWait.passed()) {
ItemStack slot24 = InventoryUtils.getStackInOpenContainerSlot(24); ItemStack slot24 = InventoryUtils.getStackInOpenContainerSlot(24);
ItemStack slot33 = InventoryUtils.getStackInOpenContainerSlot(33); ItemStack slot33 = InventoryUtils.getStackInOpenContainerSlot(33);
ItemStack slot42 = InventoryUtils.getStackInOpenContainerSlot(42);
if (slot24 != null && slot24.getItem() == Items.golden_horse_armor) { if (slot24 != null && slot24.getItem() == Items.golden_horse_armor) {
InventoryUtils.clickOpenContainerSlot(24); InventoryUtils.clickOpenContainerSlot(24);
buyWait.schedule(1000); buyWait.schedule(1000);
} else if (slot33 != null) { } else if (slot33 != null) {
if (slot33.getSubCompound("display", false).getString("Name").startsWith("§c")) { if (slot33.getSubCompound("display", false).getString("Name").startsWith("§c")) {
ah_full = true; sendSlotsFull();
Utils.debugLog("Auction slots full, stopping sniper for a while");
selling_queue.remove(0);
if (SEND_MESSAGE) {
try {
webhook.addEmbed(embed("Auction slots are full!", "Could not create more auctions as slots are full already, sending you here so you could create it manually", "#ff0000"));
webhook.execute();
Utils.debugLog("Notified Webhook");
} catch (Exception e) {
e.printStackTrace();
Utils.debugLog("Failed to send webhook");
}
}
Lilase.mc.thePlayer.closeScreen();
state = FlipperState.NONE;
// Lilase.cofl.toggleAuction(); // Lilase.cofl.toggleAuction();
return; return;
} else if (slot33.getItem() == Items.golden_horse_armor) { } else if (slot33.getItem() == Items.golden_horse_armor) {
InventoryUtils.clickOpenContainerSlot(33); InventoryUtils.clickOpenContainerSlot(33);
buyWait.schedule(1000); buyWait.schedule(1000);
} }
} else if (slot42 != null) {
if (slot42.getSubCompound("display", false).getString("Name").startsWith("§c")) {
sendSlotsFull();
// Lilase.cofl.toggleAuction();
return;
} else if (slot42.getItem() == Items.golden_horse_armor) {
InventoryUtils.clickOpenContainerSlot(33);
buyWait.schedule(1000);
}
} else { } else {
Utils.debugLog("Can't find create auction button, stopping flipper"); Utils.debugLog("Can't find create auction button, stopping flipper");
selling_queue.remove(0); selling_queue.remove(0);
@ -203,16 +198,14 @@ public class Flipper {
} }
case PRICE: case PRICE:
if (Lilase.mc.currentScreen instanceof GuiEditSign && buyWait.passed()) { if (Lilase.mc.currentScreen instanceof GuiEditSign && buyWait.passed()) {
GuiEditSign guiEditSign = (GuiEditSign) Lilase.mc.currentScreen;
TileEntitySign tileSign; TileEntitySign tileSign;
try { try {
tileSign = (TileEntitySign) ReflectionUtils.field(guiEditSign, "tileSign"); tileSign = (TileEntitySign) ReflectionUtils.field(Lilase.mc.currentScreen, "tileSign");
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); tileSign = (TileEntitySign) ReflectionUtils.field(Lilase.mc.currentScreen, "field_146848_f");
tileSign = (TileEntitySign) ReflectionUtils.field(guiEditSign, "field_146848_f");
} }
Utils.debugLog("Sign(normal): " + ReflectionUtils.field(guiEditSign, "tileSign")); Utils.debugLog("Sign(normal): " + ReflectionUtils.field(Lilase.mc.currentScreen, "tileSign"));
Utils.debugLog("Sign(obfuscated): " + ReflectionUtils.field(guiEditSign, "field_146848_f")); Utils.debugLog("Sign(obfuscated): " + ReflectionUtils.field(Lilase.mc.currentScreen, "field_146848_f"));
if (tileSign == null) { if (tileSign == null) {
Utils.debugLog("TileEntitySign is null, stopping flipper"); Utils.debugLog("TileEntitySign is null, stopping flipper");
selling_queue.remove(0); selling_queue.remove(0);
@ -324,6 +317,24 @@ public class Flipper {
} }
} }
public void sendSlotsFull() {
ah_full = true;
Utils.debugLog("Auction slots full, stopping sniper for a while");
selling_queue.remove(0);
if (SEND_MESSAGE) {
try {
webhook.addEmbed(embed("Auction slots are full!", "Could not create more auctions as slots are full already, sending you here so you could create it manually", "#ff0000"));
webhook.execute();
Utils.debugLog("Notified Webhook");
} catch (Exception e) {
e.printStackTrace();
Utils.debugLog("Failed to send webhook");
}
}
Lilase.mc.thePlayer.closeScreen();
state = FlipperState.NONE;
}
public static float distanceToFirstPoint() { public static float distanceToFirstPoint() {
return (float) Math.sqrt(Math.pow(Lilase.mc.thePlayer.posX - (-2.5), 2) + Math.pow(Lilase.mc.thePlayer.posZ - (-91.5), 2)); return (float) Math.sqrt(Math.pow(Lilase.mc.thePlayer.posX - (-2.5), 2) + Math.pow(Lilase.mc.thePlayer.posZ - (-91.5), 2));
} }