changing motion to random head rotation as it moving looks more fake

This commit is contained in:
NK 2023-02-26 19:47:16 +00:00
parent ba67b27c83
commit 1aeb8ae82b
2 changed files with 12 additions and 14 deletions

View file

@ -2,7 +2,10 @@ package me.night0721.lilase.features.ah;
import me.night0721.lilase.Lilase; import me.night0721.lilase.Lilase;
import me.night0721.lilase.features.flip.Flipper; import me.night0721.lilase.features.flip.Flipper;
import me.night0721.lilase.utils.*; import me.night0721.lilase.utils.ConfigUtils;
import me.night0721.lilase.utils.DiscordWebhook;
import me.night0721.lilase.utils.UngrabUtils;
import me.night0721.lilase.utils.Utils;
import org.json.JSONArray; import org.json.JSONArray;
import org.json.JSONException; import org.json.JSONException;
import org.json.JSONObject; import org.json.JSONObject;
@ -23,9 +26,9 @@ import java.util.concurrent.TimeUnit;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import static me.night0721.lilase.features.flip.Flipper.rotation;
public class AuctionHouse { public class AuctionHouse {
private String uuid;
private String message_toSend;
private Boolean open = false; private Boolean open = false;
private int auctionsSniped = 0; private int auctionsSniped = 0;
private int auctionsPosted = 0; private int auctionsPosted = 0;
@ -86,8 +89,8 @@ public class AuctionHouse {
open = false; open = false;
return; return;
} }
Utils.debugLog("[Sniper] Randomizing motion as we don't want to be AFK"); Utils.debugLog("[Sniper] Doing some motion as we don't want to be AFK");
KeyBindingManager.leftClick(); rotation.easeTo(Lilase.mc.thePlayer.rotationYaw + 1, Lilase.mc.thePlayer.rotationPitch, 500);
URL url = new URL("https://api.hypixel.net/skyblock/auctions"); URL url = new URL("https://api.hypixel.net/skyblock/auctions");
HttpsURLConnection connection = (HttpsURLConnection) url.openConnection(); HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
connection.setRequestProperty("Content-Type", "application/json"); connection.setRequestProperty("Content-Type", "application/json");
@ -151,18 +154,16 @@ public class AuctionHouse {
String updated = matcher.replaceAll(""); String updated = matcher.replaceAll("");
webhook.addEmbed(new DiscordWebhook.EmbedObject().setTitle("Bought an item on low price").setUrl("https://sky.coflnet.com/auction/" + auction.getString("uuid")).setAuthor("night0721", "https://github.com/night0721", "https://avatars.githubusercontent.com/u/77528305?v=4").setDescription(updated.replace("\n", "\\n")).addField("Item", auction.getString("item_name"), true).addField("Price", format.format(auction.getInt("starting_bid")) + " coins", true).addField("Seller", profile.getJSONObject("player").getString("displayname"), true).addField("Started for", toDuration(System.currentTimeMillis() - auction.getLong("start")), true).addField("Ends in", getTimeSinceDate(auction.getLong("end") - System.currentTimeMillis()), true).setColor(Color.decode("#003153"))); webhook.addEmbed(new DiscordWebhook.EmbedObject().setTitle("Bought an item on low price").setUrl("https://sky.coflnet.com/auction/" + auction.getString("uuid")).setAuthor("night0721", "https://github.com/night0721", "https://avatars.githubusercontent.com/u/77528305?v=4").setDescription(updated.replace("\n", "\\n")).addField("Item", auction.getString("item_name"), true).addField("Price", format.format(auction.getInt("starting_bid")) + " coins", true).addField("Seller", profile.getJSONObject("player").getString("displayname"), true).addField("Started for", toDuration(System.currentTimeMillis() - auction.getLong("start")), true).addField("Ends in", getTimeSinceDate(auction.getLong("end") - System.currentTimeMillis()), true).setColor(Color.decode("#003153")));
webhook.setContent(auction.getString("item_name") + " is sale at " + format.format(auction.getInt("starting_bid")) + "! `" + "/viewauction " + auction.getString("uuid") + "`"); webhook.setContent(auction.getString("item_name") + " is sale at " + format.format(auction.getInt("starting_bid")) + "! `" + "/viewauction " + auction.getString("uuid") + "`");
uuid = auction.getString("uuid");
message_toSend = "Auction House: " + auction.getString("item_name") + " is sale for " + format.format(auction.getInt("starting_bid")) + "!";
if (ConfigUtils.getBoolean("main", "checkMultiplierBeforeBuy")) { if (ConfigUtils.getBoolean("main", "checkMultiplierBeforeBuy")) {
float multi = flipper.checkMultiplier(); float multi = flipper.checkMultiplier();
Utils.debugLog("[Sniper] Found an item, checking profit multiplier"); Utils.debugLog("[Sniper] Found an item, checking profit multiplier");
if (multi > ConfigUtils.getInt("main", "Multiplier")) { if (multi > ConfigUtils.getInt("main", "Multiplier")) {
Utils.debugLog("[Sniper] Higher than required multiplier, buying now"); Utils.debugLog("[Sniper] Higher than required multiplier, buying now");
sendAuction(); Utils.sendServerMessage("/viewauction " + auction.getString("uuid"));
} }
} else { } else {
Utils.debugLog("[Sniper] Found an item, trying to buy"); Utils.debugLog("[Sniper] Found an item, trying to buy");
sendAuction(); Utils.sendServerMessage("/viewauction " + auction.getString("uuid"));
} }
return; return;
} }
@ -170,10 +171,6 @@ public class AuctionHouse {
} }
} }
private void sendAuction() {
Utils.sendServerMessage("/viewauction " + uuid);
Utils.sendMessage(message_toSend);
}
private final List<Long> times = Arrays.asList(TimeUnit.DAYS.toMillis(365), TimeUnit.DAYS.toMillis(30), TimeUnit.DAYS.toMillis(1), TimeUnit.HOURS.toMillis(1), TimeUnit.MINUTES.toMillis(1), TimeUnit.SECONDS.toMillis(1)); private final List<Long> times = Arrays.asList(TimeUnit.DAYS.toMillis(365), TimeUnit.DAYS.toMillis(30), TimeUnit.DAYS.toMillis(1), TimeUnit.HOURS.toMillis(1), TimeUnit.MINUTES.toMillis(1), TimeUnit.SECONDS.toMillis(1));
private final List<String> timesString = Arrays.asList("year", "month", "day", "hour", "minute", "second"); private final List<String> timesString = Arrays.asList("year", "month", "day", "hour", "minute", "second");
@ -233,6 +230,7 @@ public class AuctionHouse {
public void incrementAuctionsSniped() { public void incrementAuctionsSniped() {
this.auctionsSniped += 1; this.auctionsSniped += 1;
} }
public int getAuctionsPosted() { public int getAuctionsPosted() {
return auctionsPosted; return auctionsPosted;
} }

View file

@ -99,7 +99,7 @@ public class Flipper {
} else if (InventoryUtils.inventoryNameContains("Create BIN Auction")) { } else if (InventoryUtils.inventoryNameContains("Create BIN Auction")) {
if (InventoryUtils.isStoneButton() && buyWait.passed()) { if (InventoryUtils.isStoneButton() && buyWait.passed()) {
if (InventoryUtils.getSlotForItem(itemname) == -1) { if (InventoryUtils.getSlotForItem(itemname) == -1) {
Utils.sendMessage("Cannot find item in inventory, stopping flipper"); Utils.debugLog("[Flipper] Cannot find item in inventory, stopping flipper");
state = FlipperState.NONE; state = FlipperState.NONE;
Lilase.auctionHouse.setOpen(true); Lilase.auctionHouse.setOpen(true);
return; return;