more stats in gui, flipped, posted, sniped

This commit is contained in:
NK 2023-02-26 19:10:47 +00:00
parent 9679d0caa0
commit a27815802b
6 changed files with 39 additions and 8 deletions

View file

@ -21,7 +21,7 @@ apply plugin: "net.minecraftforge.gradle.forge"
apply plugin: "com.github.johnrengelman.shadow" apply plugin: "com.github.johnrengelman.shadow"
apply plugin: "org.spongepowered.mixin" apply plugin: "org.spongepowered.mixin"
version = "1.0.22" version = "1.0.23"
group = "me.night0721.lilase" group = "me.night0721.lilase"
archivesBaseName = "Lilase" archivesBaseName = "Lilase"
sourceCompatibility = 1.8 sourceCompatibility = 1.8

View file

@ -30,14 +30,13 @@ import static me.night0721.lilase.features.ah.AHConfig.RECONNECT_DELAY;
public class Lilase { public class Lilase {
public static final String MOD_NAME = "Lilase"; public static final String MOD_NAME = "Lilase";
public static final String MODID = "Lilase"; public static final String MODID = "Lilase";
public static final String VERSION = "1.0.22"; public static final String VERSION = "1.0.23";
public static final Minecraft mc = Minecraft.getMinecraft(); public static final Minecraft mc = Minecraft.getMinecraft();
public static AuctionHouse auctionHouse; public static AuctionHouse auctionHouse;
public static AHConfig config; public static AHConfig config;
private int tickAmount; private int tickAmount;
private final Clock clock = new Clock(); private final Clock clock = new Clock();
@Mod.EventHandler @Mod.EventHandler
public void init(FMLInitializationEvent event) { public void init(FMLInitializationEvent event) {
KeyBindingManager keyBindingManager = new KeyBindingManager(); KeyBindingManager keyBindingManager = new KeyBindingManager();

View file

@ -24,8 +24,12 @@ import net.minecraftforge.fml.common.gameevent.InputEvent;
import org.lwjgl.input.Keyboard; import org.lwjgl.input.Keyboard;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList;
import java.util.Calendar; import java.util.Calendar;
import java.util.List;
import java.util.TimeZone; import java.util.TimeZone;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import static me.night0721.lilase.features.ah.AHConfig.GUI_COLOR; import static me.night0721.lilase.features.ah.AHConfig.GUI_COLOR;
import static me.night0721.lilase.features.ah.AuctionHouse.flipper; import static me.night0721.lilase.features.ah.AuctionHouse.flipper;
@ -36,10 +40,13 @@ import static me.night0721.lilase.utils.PlayerUtils.sendPacketWithoutEvent;
public class SniperFlipperEvents { public class SniperFlipperEvents {
private int windowId = 1; private int windowId = 1;
private boolean buying = false; private boolean buying = false;
private boolean bought = false;
private final Pattern boughtPattern = Pattern.compile("^(.*?) bought (.*?) for ([\\d,]+) coins CLICK$");
public static List<String> postedNames = new ArrayList<>();
@SubscribeEvent @SubscribeEvent
public void onChat(ClientChatReceivedEvent event) throws InterruptedException, IOException { public void onChat(ClientChatReceivedEvent event) throws InterruptedException, IOException {
String message = event.message.getUnformattedText(); String message = event.message.getUnformattedText();
Matcher matcher = boughtPattern.matcher(message);
if (!message.contains(":")) { if (!message.contains(":")) {
if (message.equals("You didn't participate in this auction!")) { if (message.equals("You didn't participate in this auction!")) {
Utils.debugLog("[Sniper] Failed to buy item, not fast enough. Closing the menu"); Utils.debugLog("[Sniper] Failed to buy item, not fast enough. Closing the menu");
@ -52,7 +59,7 @@ public class SniperFlipperEvents {
Utils.debugLog("[Sniper] Saved new API key to config"); Utils.debugLog("[Sniper] Saved new API key to config");
String apiKey = message.replace("Your new API key is ", ""); String apiKey = message.replace("Your new API key is ", "");
ConfigUtils.writeStringConfig("main", "APIKey", apiKey); ConfigUtils.writeStringConfig("main", "APIKey", apiKey);
} else if (message.equals("Claiming BIN auction...") && buying) { } else if (message.equals("Claiming BIN auction...") && bought) {
Utils.debugLog("[Sniper] Bought an item, starting to sell"); Utils.debugLog("[Sniper] Bought an item, starting to sell");
Lilase.auctionHouse.webhook.execute(); Lilase.auctionHouse.webhook.execute();
flipper.sellItem(); flipper.sellItem();
@ -75,6 +82,8 @@ public class SniperFlipperEvents {
Utils.sendServerMessage("/hub"); Utils.sendServerMessage("/hub");
Thread bzchillingthread = new Thread(bazaarChilling); Thread bzchillingthread = new Thread(bazaarChilling);
bzchillingthread.start(); bzchillingthread.start();
} else if (matcher.matches() && postedNames.contains(matcher.group(2))) {
Lilase.auctionHouse.incrementAuctionsFlipped();
} }
} }
} }
@ -164,7 +173,9 @@ public class SniperFlipperEvents {
"Z: " + Math.round(Lilase.mc.thePlayer.posZ) + "\n" + "Z: " + Math.round(Lilase.mc.thePlayer.posZ) + "\n" +
time + "\n" + time + "\n" +
"FPS: " + Minecraft.getDebugFPS() + "\n" + "FPS: " + Minecraft.getDebugFPS() + "\n" +
"Auctions Sniped: " + Lilase.auctionHouse.getAuctionsSniped(); "Auctions Sniped: " + Lilase.auctionHouse.getAuctionsSniped() + "\n" +
"Auctions Posted: " + Lilase.auctionHouse.getAuctionsPosted() + "\n" +
"Auctions Flipped: " + Lilase.auctionHouse.getAuctionsFlipped() + "\n";
TextRenderer.drawString(lines, 0, 0, 1.5, GUI_COLOR.getRGB()); TextRenderer.drawString(lines, 0, 0, 1.5, GUI_COLOR.getRGB());
} }
} }
@ -188,6 +199,7 @@ public class SniperFlipperEvents {
if (buying && "Confirm Purchase".equals(windowName)) { if (buying && "Confirm Purchase".equals(windowName)) {
Lilase.mc.playerController.windowClick(windowId + 1, 11, 0, 0, Lilase.mc.thePlayer); Lilase.mc.playerController.windowClick(windowId + 1, 11, 0, 0, Lilase.mc.thePlayer);
buying = false; buying = false;
bought = true;
} }
} }
} }

View file

@ -28,6 +28,8 @@ public class AuctionHouse {
private String message_toSend; 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 auctionsFlipped = 0;
public DiscordWebhook webhook = new DiscordWebhook(ConfigUtils.getString("main", "Webhook")); public DiscordWebhook webhook = new DiscordWebhook(ConfigUtils.getString("main", "Webhook"));
private final List<Item> items = new ArrayList<>(); private final List<Item> items = new ArrayList<>();
private final List<String> posted = new ArrayList<>(); private final List<String> posted = new ArrayList<>();
@ -230,6 +232,21 @@ public class AuctionHouse {
public void incrementAuctionsSniped() { public void incrementAuctionsSniped() {
this.auctionsSniped += 1; this.auctionsSniped += 1;
} }
public int getAuctionsPosted() {
return auctionsPosted;
}
public void incrementAuctionsPosted() {
this.auctionsPosted += 1;
}
public int getAuctionsFlipped() {
return auctionsFlipped;
}
public void incrementAuctionsFlipped() {
this.auctionsFlipped += 1;
}
} }

View file

@ -1,6 +1,7 @@
package me.night0721.lilase.features.flip; package me.night0721.lilase.features.flip;
import me.night0721.lilase.Lilase; import me.night0721.lilase.Lilase;
import me.night0721.lilase.events.SniperFlipperEvents;
import me.night0721.lilase.utils.*; import me.night0721.lilase.utils.*;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityArmorStand; import net.minecraft.entity.item.EntityArmorStand;
@ -41,6 +42,7 @@ public class Flipper {
} }
public void sellItem() { public void sellItem() {
Lilase.auctionHouse.incrementAuctionsSniped();
Utils.sendMessage("Flipper is running, stopping, will resume when flipper is done"); Utils.sendMessage("Flipper is running, stopping, will resume when flipper is done");
if (Lilase.auctionHouse.getOpen()) Lilase.auctionHouse.toggleAuction(); if (Lilase.auctionHouse.getOpen()) Lilase.auctionHouse.toggleAuction();
UngrabUtils.ungrabMouse(); UngrabUtils.ungrabMouse();
@ -125,7 +127,8 @@ public class Flipper {
buyWait.schedule(1000); buyWait.schedule(1000);
} else if (InventoryUtils.inventoryNameContains("BIN Auction View") && buyWait.passed()) { } else if (InventoryUtils.inventoryNameContains("BIN Auction View") && buyWait.passed()) {
InventoryUtils.clickOpenContainerSlot(49); InventoryUtils.clickOpenContainerSlot(49);
Lilase.auctionHouse.incrementAuctionsSniped(); Lilase.auctionHouse.incrementAuctionsPosted();
SniperFlipperEvents.postedNames.add(itemname);
buyWait.schedule(500); buyWait.schedule(500);
Lilase.mc.thePlayer.closeScreen(); Lilase.mc.thePlayer.closeScreen();
buyWait.schedule(500); buyWait.schedule(500);