v3.0.0 remote control + auto relister
This commit is contained in:
parent
9fcba4a15a
commit
a755024900
23 changed files with 827 additions and 234 deletions
7
.github/CHANGELOG.md
vendored
7
.github/CHANGELOG.md
vendored
|
@ -64,3 +64,10 @@
|
||||||
- Added custom listing time, 1, 6, 12, 24, 48 hours
|
- Added custom listing time, 1, 6, 12, 24, 48 hours
|
||||||
- Adding mod id hider
|
- Adding mod id hider
|
||||||
- Added image to minecraft mod list and oneconfig
|
- Added image to minecraft mod list and oneconfig
|
||||||
|
- v2.0.4
|
||||||
|
- Added toggle to enable custom scoreboard
|
||||||
|
- Added toggle to use shorten number when listing
|
||||||
|
- Relocated some events
|
||||||
|
- Added auto relister which run every hour by default to relist expired items
|
||||||
|
- Added detection for captcha and send webhook when captcha is detected
|
||||||
|
- A discord bot to show the items it bought and sold and to start any modules
|
|
@ -56,6 +56,7 @@ val shade: Configuration by configurations.creating {
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
maven("https://repo.polyfrost.cc/releases")
|
maven("https://repo.polyfrost.cc/releases")
|
||||||
|
mavenCentral()
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
@ -65,6 +66,9 @@ dependencies {
|
||||||
shade("cc.polyfrost:oneconfig-wrapper-launchwrapper:1.0.0-beta+")
|
shade("cc.polyfrost:oneconfig-wrapper-launchwrapper:1.0.0-beta+")
|
||||||
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")
|
||||||
|
implementation("net.dv8tion:JDA:5.0.0-beta.9") {
|
||||||
|
exclude (module = "opus-java")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
mod_name = Lilase
|
mod_name = Lilase
|
||||||
mod_id = lilase
|
mod_id = lilase
|
||||||
mod_version = 2.0.4
|
mod_version = 3.0.0
|
||||||
|
|
||||||
essential.defaults.loom=0
|
essential.defaults.loom=0
|
||||||
|
|
||||||
|
|
|
@ -5,12 +5,17 @@ import cc.polyfrost.oneconfig.events.event.InitializationEvent;
|
||||||
import cc.polyfrost.oneconfig.libs.eventbus.Subscribe;
|
import cc.polyfrost.oneconfig.libs.eventbus.Subscribe;
|
||||||
import me.night0721.lilase.config.AHConfig;
|
import me.night0721.lilase.config.AHConfig;
|
||||||
import me.night0721.lilase.config.ConfigHandler;
|
import me.night0721.lilase.config.ConfigHandler;
|
||||||
|
import me.night0721.lilase.events.ChatReceivedEvent;
|
||||||
import me.night0721.lilase.events.SniperFlipperEvents;
|
import me.night0721.lilase.events.SniperFlipperEvents;
|
||||||
import me.night0721.lilase.features.claimer.Claimer;
|
import me.night0721.lilase.features.claimer.Claimer;
|
||||||
import me.night0721.lilase.features.cofl.Cofl;
|
import me.night0721.lilase.features.cofl.Cofl;
|
||||||
//import me.night0721.lilase.features.pageflipper.PageFlipper;
|
//import me.night0721.lilase.features.pageflipper.PageFlipper;
|
||||||
import me.night0721.lilase.features.cofl.QueueItem;
|
import me.night0721.lilase.features.cofl.QueueItem;
|
||||||
import me.night0721.lilase.gui.ImageRenderer;
|
import me.night0721.lilase.features.flipper.Flipper;
|
||||||
|
import me.night0721.lilase.features.flipper.FlipperState;
|
||||||
|
import me.night0721.lilase.features.relister.Relister;
|
||||||
|
import me.night0721.lilase.gui.GUIRenderer;
|
||||||
|
import me.night0721.lilase.remotecontrol.RemoteControl;
|
||||||
import me.night0721.lilase.utils.Clock;
|
import me.night0721.lilase.utils.Clock;
|
||||||
import me.night0721.lilase.utils.KeyBindingManager;
|
import me.night0721.lilase.utils.KeyBindingManager;
|
||||||
import me.night0721.lilase.utils.Utils;
|
import me.night0721.lilase.utils.Utils;
|
||||||
|
@ -26,32 +31,40 @@ import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
||||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||||
import net.minecraftforge.fml.common.gameevent.TickEvent;
|
import net.minecraftforge.fml.common.gameevent.TickEvent;
|
||||||
|
|
||||||
import static me.night0721.lilase.config.AHConfig.RECONNECT_DELAY;
|
import static me.night0721.lilase.config.AHConfig.*;
|
||||||
|
import static me.night0721.lilase.features.flipper.Flipper.icon;
|
||||||
|
import static me.night0721.lilase.features.flipper.Flipper.webhook;
|
||||||
|
|
||||||
@Mod(modid = Lilase.MODID, name = Lilase.MOD_NAME, version = Lilase.VERSION, acceptedMinecraftVersions = "[1.8.9]")
|
@Mod(modid = Lilase.MODID, name = Lilase.MOD_NAME, version = Lilase.VERSION, acceptedMinecraftVersions = "[1.8.9]")
|
||||||
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 = "2.0.4";
|
public static final String VERSION = "3.0.0";
|
||||||
public static final Minecraft mc = Minecraft.getMinecraft();
|
public static final Minecraft mc = Minecraft.getMinecraft();
|
||||||
// public static PageFlipper pageFlipper;
|
// public static PageFlipper pageFlipper;
|
||||||
public static Claimer claimer;
|
public static Claimer claimer;
|
||||||
|
public static Relister relister;
|
||||||
public static Cofl cofl;
|
public static Cofl cofl;
|
||||||
public static AHConfig config;
|
public static AHConfig config;
|
||||||
public static ConfigHandler configHandler;
|
public static ConfigHandler configHandler;
|
||||||
private int tickAmount;
|
private int tickAmount;
|
||||||
private final Clock clock = new Clock();
|
private final Clock clock = new Clock();
|
||||||
|
public static RemoteControl remoteControl;
|
||||||
|
|
||||||
@Mod.EventHandler
|
@Mod.EventHandler
|
||||||
public void init(FMLInitializationEvent event) {
|
public void init(FMLInitializationEvent event) {
|
||||||
(configHandler = new ConfigHandler()).init();
|
(configHandler = new ConfigHandler()).init();
|
||||||
KeyBindingManager keyBindingManager = new KeyBindingManager();
|
KeyBindingManager keyBindingManager = new KeyBindingManager();
|
||||||
addToEventBus(this, keyBindingManager, new SniperFlipperEvents(), new ImageRenderer());
|
addToEventBus(this, keyBindingManager, new SniperFlipperEvents(), new ChatReceivedEvent(), new GUIRenderer());
|
||||||
EventManager.INSTANCE.register(this);
|
EventManager.INSTANCE.register(this);
|
||||||
// pageFlipper = new PageFlipper();
|
// pageFlipper = new PageFlipper();
|
||||||
keyBindingManager.registerKeyBindings();
|
keyBindingManager.registerKeyBindings();
|
||||||
(cofl = new Cofl()).onOpen();
|
(cofl = new Cofl()).onOpen();
|
||||||
claimer = new Claimer();
|
claimer = new Claimer();
|
||||||
|
relister = new Relister();
|
||||||
|
webhook.setUsername("Lilase");
|
||||||
|
webhook.setAvatarUrl(icon);
|
||||||
|
remoteControl = new RemoteControl();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addToEventBus(Object... objects) {
|
private void addToEventBus(Object... objects) {
|
||||||
|
@ -69,8 +82,13 @@ public class Lilase {
|
||||||
tickAmount++;
|
tickAmount++;
|
||||||
if (tickAmount % 20 == 0) Utils.checkFooter();
|
if (tickAmount % 20 == 0) Utils.checkFooter();
|
||||||
// if (pageFlipper != null) pageFlipper.switchStates();
|
// if (pageFlipper != null) pageFlipper.switchStates();
|
||||||
|
if (tickAmount % (RELIST_CHECK_TIMEOUT * 72_000) == 0) {
|
||||||
|
relister.shouldBeRelisting = true;
|
||||||
|
if (Flipper.state == FlipperState.NONE) relister.toggle();
|
||||||
|
}
|
||||||
if (claimer != null) claimer.onTick();
|
if (claimer != null) claimer.onTick();
|
||||||
if (cofl.getOpen() && !cofl.queue.isEmpty() && !cofl.queue.isRunning()) {
|
if (relister != null) relister.onTick();
|
||||||
|
if (cofl.isOpen() && !cofl.queue.isEmpty() && !cofl.queue.isRunning()) {
|
||||||
cofl.queue.setRunning(true);
|
cofl.queue.setRunning(true);
|
||||||
QueueItem item = cofl.queue.get();
|
QueueItem item = cofl.queue.get();
|
||||||
item.openAuction();
|
item.openAuction();
|
||||||
|
|
|
@ -10,21 +10,32 @@ import me.night0721.lilase.Lilase;
|
||||||
|
|
||||||
public class AHConfig extends Config {
|
public class AHConfig extends Config {
|
||||||
public AHConfig() {
|
public AHConfig() {
|
||||||
super(new Mod("Lilase", ModType.SKYBLOCK, "/assets/lilase.png", 100, 100), "lilase.json");
|
super(new Mod("Lilase", ModType.SKYBLOCK, "/assets/lilase.png", 84, 84), "lilase.json");
|
||||||
initialize();
|
initialize();
|
||||||
addListener("SEND_MESSAGE", () -> Lilase.configHandler.setBoolean("SendMessageToWebhook", SEND_MESSAGE));
|
addListener("SEND_MESSAGE", () -> Lilase.configHandler.setBoolean("SendMessageToWebhook", SEND_MESSAGE));
|
||||||
addListener("WEBHOOK", () -> Lilase.configHandler.setString("Webhook", WEBHOOK));
|
addListener("WEBHOOK", () -> Lilase.configHandler.setString("Webhook", WEBHOOK));
|
||||||
addListener("RECONNECT_DELAY", () -> Lilase.configHandler.setInt("ReconnectDelay", Math.round(RECONNECT_DELAY)));
|
addListener("RECONNECT_DELAY", () -> Lilase.configHandler.setInt("ReconnectDelay", RECONNECT_DELAY));
|
||||||
addListener("BED_SPAM", () -> Lilase.configHandler.setBoolean("BedSpam", BED_SPAM));
|
addListener("BED_SPAM", () -> Lilase.configHandler.setBoolean("BedSpam", BED_SPAM));
|
||||||
addListener("BED_SPAM_DELAY", () -> Lilase.configHandler.setInt("BedSpamDelay", Math.round(BED_SPAM_DELAY)));
|
addListener("BED_SPAM_DELAY", () -> Lilase.configHandler.setInt("BedSpamDelay", BED_SPAM_DELAY));
|
||||||
addListener("ONLY_SNIPER", () -> Lilase.configHandler.setBoolean("OnlySniper", ONLY_SNIPER));
|
addListener("ONLY_SNIPER", () -> Lilase.configHandler.setBoolean("OnlySniper", ONLY_SNIPER));
|
||||||
addListener("GUI", () -> Lilase.configHandler.setBoolean("GUI", GUI));
|
addListener("GUI", () -> Lilase.configHandler.setBoolean("GUI", GUI));
|
||||||
addListener("GUI_COLOR", () -> Lilase.configHandler.setInt("GUI_COLOR", GUI_COLOR.getRGB()));
|
addListener("GUI_COLOR", () -> Lilase.configHandler.setInt("GUI_COLOR", GUI_COLOR.getRGB()));
|
||||||
addListener("RELIST_TIMEOUT", () -> Lilase.configHandler.setInt("RelistTimeout", Math.round(RELIST_TIMEOUT)));
|
addListener("RELIST_TIMEOUT", () -> Lilase.configHandler.setInt("RelistTimeout", RELIST_TIMEOUT));
|
||||||
addListener("DEBUG", () -> Lilase.configHandler.setBoolean("Debug", DEBUG));
|
addListener("DEBUG", () -> Lilase.configHandler.setBoolean("Debug", DEBUG));
|
||||||
addListener("AUCTION_LENGTH", () -> Lilase.configHandler.setInt("AuctionLength", Math.round(AUCTION_LENGTH)));
|
addListener("AUCTION_LENGTH", () -> Lilase.configHandler.setInt("AuctionLength", AUCTION_LENGTH));
|
||||||
|
addListener("AUTO_RELIST", () -> Lilase.configHandler.setBoolean("AutoRelist", AUTO_RELIST));
|
||||||
|
addListener("AUTO_CLAIM", () -> Lilase.configHandler.setBoolean("AutoClaim", AUTO_CLAIM));
|
||||||
|
addListener("RELIST_CHECK_TIMEOUT", () -> Lilase.configHandler.setFloat("RelistCheckTimeout", RELIST_CHECK_TIMEOUT));
|
||||||
|
addListener("CUSTOM_SCOREBOARD", () -> Lilase.configHandler.setBoolean("CustomScoreboard", CUSTOM_SCOREBOARD));
|
||||||
|
addListener("SHORTEN_NUMBERS", () -> Lilase.configHandler.setBoolean("ShortenNumbers", SHORTEN_NUMBERS));
|
||||||
|
addListener("REMOTE_CONTROL", () -> Lilase.configHandler.setBoolean("RemoteControl", REMOTE_CONTROL));
|
||||||
|
addListener("BOT_TOKEN", () -> Lilase.configHandler.setString("BotToken", BOT_TOKEN));
|
||||||
|
addListener("LOG_CHANNEL", () -> Lilase.configHandler.setString("LogChannel", LOG_CHANNEL));
|
||||||
addDependency("WEBHOOK", "SEND_MESSAGE");
|
addDependency("WEBHOOK", "SEND_MESSAGE");
|
||||||
addDependency("GUI_COLOR", "GUI");
|
addDependency("GUI_COLOR", "GUI");
|
||||||
|
addDependency("RELIST_CHECK_TIMEOUT", "AUTO_RELIST");
|
||||||
|
addDependency("BOT_TOKEN", "REMOTE_CONTROL");
|
||||||
|
addDependency("LOG_CHANNEL", "REMOTE_CONTROL");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Switch(name = "Bed Spam & Skip Confirm", category = "Auction House", subcategory = "Sniper", description = "Spam the bed to buy the item just after the grace period ends and skips the confirmation of buying the item")
|
@Switch(name = "Bed Spam & Skip Confirm", category = "Auction House", subcategory = "Sniper", description = "Spam the bed to buy the item just after the grace period ends and skips the confirmation of buying the item")
|
||||||
|
@ -35,9 +46,22 @@ public class AHConfig extends Config {
|
||||||
|
|
||||||
@Number(name = "Relist timeout (ms)", min = 1500, max = 60000, step = 500, category = "Auction House", subcategory = "Flipper", description = "Delay between buying and relisting an item (milliseconds)")
|
@Number(name = "Relist timeout (ms)", min = 1500, max = 60000, step = 500, category = "Auction House", subcategory = "Flipper", description = "Delay between buying and relisting an item (milliseconds)")
|
||||||
public static int RELIST_TIMEOUT = 1500;
|
public static int RELIST_TIMEOUT = 1500;
|
||||||
|
|
||||||
|
@Number(name = "Relist check timeout (hours)", min = 0.5f, max = 2f, category = "Auction House", subcategory = "Flipper", description = "Delay between checking if an item is expired and relisting it (hours)")
|
||||||
|
public static float RELIST_CHECK_TIMEOUT = 1f;
|
||||||
|
|
||||||
@Dropdown(name = "Auction Listing Length", options = {"1 Hour", "6 Hours", "12 Hours", "24 Hours", "2 Days"}, category = "Auction House", subcategory = "Flipper", description = "Length of the auction listing")
|
@Dropdown(name = "Auction Listing Length", options = {"1 Hour", "6 Hours", "12 Hours", "24 Hours", "2 Days"}, category = "Auction House", subcategory = "Flipper", description = "Length of the auction listing")
|
||||||
public static int AUCTION_LENGTH = 2;
|
public static int AUCTION_LENGTH = 2;
|
||||||
|
|
||||||
|
@Checkbox(name = "Shorten Numbers when listing", category = "Auction House", subcategory = "Flipper", description = "Shorten numbers when listing items")
|
||||||
|
public static boolean SHORTEN_NUMBERS = false;
|
||||||
|
|
||||||
|
@Checkbox(name = "Auto Relist", category = "Auction House", subcategory = "Flipper", description = "Automatically relist items after auctions are expired")
|
||||||
|
public static boolean AUTO_RELIST = true;
|
||||||
|
|
||||||
|
@Checkbox(name = "Auto Claim", category = "Auction House", subcategory = "Flipper", description = "Automatically claim items when it is bought")
|
||||||
|
public static boolean AUTO_CLAIM = true;
|
||||||
|
|
||||||
@Switch(name = "Debug", category = "Auction House", subcategory = "Sniper", description = "Debug mode")
|
@Switch(name = "Debug", category = "Auction House", subcategory = "Sniper", description = "Debug mode")
|
||||||
public static boolean DEBUG = false;
|
public static boolean DEBUG = false;
|
||||||
|
|
||||||
|
@ -64,4 +88,16 @@ public class AHConfig extends Config {
|
||||||
|
|
||||||
@Color(name = "GUI Color", category = "GUI")
|
@Color(name = "GUI Color", category = "GUI")
|
||||||
public static OneColor GUI_COLOR = new OneColor(0, 49, 83);
|
public static OneColor GUI_COLOR = new OneColor(0, 49, 83);
|
||||||
|
|
||||||
|
@Switch(name = "Custom Scoreboard", category = "GUI", description = "Enable the custom scoreboard")
|
||||||
|
public static boolean CUSTOM_SCOREBOARD = true;
|
||||||
|
|
||||||
|
@Switch(name = "Remote Control", category = "Remote Control", description = "Enable remote control")
|
||||||
|
public static boolean REMOTE_CONTROL = false;
|
||||||
|
|
||||||
|
@Text(name = "Bot Token", placeholder = "Token", category = "Remote Control", description = "Discord bot token")
|
||||||
|
public static String BOT_TOKEN = "";
|
||||||
|
|
||||||
|
@Text(name = "Log Channel", placeholder = "Channel ID", category = "Remote Control", description = "Discord channel ID to log messages to")
|
||||||
|
public static String LOG_CHANNEL = "";
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,6 @@ public class ConfigHandler {
|
||||||
if (hasNoKey("SendMessageToWebhook")) setBoolean("SendMessageToWebhook", true);
|
if (hasNoKey("SendMessageToWebhook")) setBoolean("SendMessageToWebhook", true);
|
||||||
if (hasNoKey("Webhook")) setString("Webhook", "");
|
if (hasNoKey("Webhook")) setString("Webhook", "");
|
||||||
if (hasNoKey("ReconnectDelay")) setInt("ReconnectDelay", 20);
|
if (hasNoKey("ReconnectDelay")) setInt("ReconnectDelay", 20);
|
||||||
if (hasNoKey("AuctionHouseDelay")) setInt("AuctionHouseDelay", 8);
|
|
||||||
if (hasNoKey("SniperMode")) setBoolean("SniperMode", true);
|
if (hasNoKey("SniperMode")) setBoolean("SniperMode", true);
|
||||||
if (hasNoKey("BedSpam")) setBoolean("BedSpam", true);
|
if (hasNoKey("BedSpam")) setBoolean("BedSpam", true);
|
||||||
if (hasNoKey("BedSpamDelay")) setInt("BedSpamDelay", 100);
|
if (hasNoKey("BedSpamDelay")) setInt("BedSpamDelay", 100);
|
||||||
|
@ -31,6 +30,13 @@ public class ConfigHandler {
|
||||||
if (hasNoKey("Debug")) setBoolean("Debug", false);
|
if (hasNoKey("Debug")) setBoolean("Debug", false);
|
||||||
if (hasNoKey("RelistTimeout")) setInt("RelistTimeout", 1500);
|
if (hasNoKey("RelistTimeout")) setInt("RelistTimeout", 1500);
|
||||||
if (hasNoKey("AuctionLength")) setInt("AuctionLength", 2);
|
if (hasNoKey("AuctionLength")) setInt("AuctionLength", 2);
|
||||||
|
if (hasNoKey("AutoRelist")) setBoolean("AutoRelist", true);
|
||||||
|
if (hasNoKey("AutoClaim")) setBoolean("AutoClaim", true);
|
||||||
|
if (hasNoKey("CustomScoreboard")) setBoolean("CustomScoreboard", true);
|
||||||
|
if (hasNoKey("ShortenNumbers")) setBoolean("ShortenNumbers", true);
|
||||||
|
if (hasNoKey("RemoteControl")) setBoolean("RemoteControl", false);
|
||||||
|
if (hasNoKey("BotToken")) setString("BotToken", "");
|
||||||
|
if (hasNoKey("LogChannel")) setString("LogChannel", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
public JsonObject readConfigFile() {
|
public JsonObject readConfigFile() {
|
||||||
|
@ -38,7 +44,10 @@ public class ConfigHandler {
|
||||||
File configFile = new File(System.getProperty("user.dir") + path);
|
File configFile = new File(System.getProperty("user.dir") + path);
|
||||||
if (configFile.exists()) return new JsonParser().parse(new FileReader(configFile)).getAsJsonObject();
|
if (configFile.exists()) return new JsonParser().parse(new FileReader(configFile)).getAsJsonObject();
|
||||||
else {
|
else {
|
||||||
configFile.createNewFile();
|
boolean success = configFile.createNewFile();
|
||||||
|
if (!success) {
|
||||||
|
System.out.println("Failed to create config file");
|
||||||
|
}
|
||||||
BufferedWriter writer = new BufferedWriter(new FileWriter(configFile));
|
BufferedWriter writer = new BufferedWriter(new FileWriter(configFile));
|
||||||
writer.write("{}");
|
writer.write("{}");
|
||||||
writer.close();
|
writer.close();
|
||||||
|
@ -61,6 +70,11 @@ public class ConfigHandler {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean getBoolean(String key) {
|
||||||
|
config = readConfigFile();
|
||||||
|
if (config.get(key) != null) return config.get(key).getAsBoolean();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public void setBoolean(String key, boolean value) {
|
public void setBoolean(String key, boolean value) {
|
||||||
config = readConfigFile();
|
config = readConfigFile();
|
||||||
|
@ -76,6 +90,13 @@ public class ConfigHandler {
|
||||||
writeJsonToFile(config);
|
writeJsonToFile(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setFloat(String key, float value) {
|
||||||
|
config = readConfigFile();
|
||||||
|
if (config.get(key) != null) config.remove(key);
|
||||||
|
config.addProperty(key, value);
|
||||||
|
writeJsonToFile(config);
|
||||||
|
}
|
||||||
|
|
||||||
public void setString(String key, String value) {
|
public void setString(String key, String value) {
|
||||||
config = readConfigFile();
|
config = readConfigFile();
|
||||||
if (config.get(key) != null) config.remove(key);
|
if (config.get(key) != null) config.remove(key);
|
||||||
|
|
171
src/main/java/me/night0721/lilase/events/ChatReceivedEvent.java
Normal file
171
src/main/java/me/night0721/lilase/events/ChatReceivedEvent.java
Normal file
|
@ -0,0 +1,171 @@
|
||||||
|
package me.night0721.lilase.events;
|
||||||
|
|
||||||
|
import me.night0721.lilase.Lilase;
|
||||||
|
import me.night0721.lilase.features.flipper.Flipper;
|
||||||
|
import me.night0721.lilase.features.flipper.FlipperState;
|
||||||
|
import me.night0721.lilase.remotecontrol.BotUtils;
|
||||||
|
import me.night0721.lilase.utils.*;
|
||||||
|
import net.dv8tion.jda.api.EmbedBuilder;
|
||||||
|
import net.dv8tion.jda.api.entities.channel.concrete.TextChannel;
|
||||||
|
import net.dv8tion.jda.api.utils.FileUpload;
|
||||||
|
import net.minecraft.init.Blocks;
|
||||||
|
import net.minecraftforge.client.event.ClientChatReceivedEvent;
|
||||||
|
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||||
|
|
||||||
|
import java.awt.*;
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.Random;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
import static me.night0721.lilase.config.AHConfig.*;
|
||||||
|
import static me.night0721.lilase.features.flipper.Flipper.*;
|
||||||
|
|
||||||
|
public class ChatReceivedEvent {
|
||||||
|
private final Pattern AUCTION_SOLD_PATTERN = Pattern.compile("^(.*?) bought (.*?) for ([\\d,]+) coins CLICK$");
|
||||||
|
|
||||||
|
@SubscribeEvent
|
||||||
|
public void onChat(ClientChatReceivedEvent event) {
|
||||||
|
String message = event.message.getUnformattedText();
|
||||||
|
if (!message.contains(":")) {
|
||||||
|
if (message.startsWith("§6[Auction]")) {
|
||||||
|
// §6[Auction] §aphiinix_ §ebought §fImplosion Belt §efor §6900,000 coins §lCLICK
|
||||||
|
Matcher matcher = AUCTION_SOLD_PATTERN.matcher(ScoreboardUtils.cleanSB(message));
|
||||||
|
if (matcher.matches()) {
|
||||||
|
|
||||||
|
String purchaser;
|
||||||
|
try {
|
||||||
|
purchaser = matcher.group(1).split("\\[Auction] ")[1];
|
||||||
|
} catch (Exception ignored) {
|
||||||
|
purchaser = message.split("\\[Auction] ")[1].split(" bought")[0];
|
||||||
|
}
|
||||||
|
HashMap<String, String> sold_item = new HashMap<>();
|
||||||
|
sold_item.put("item", matcher.group(2));
|
||||||
|
sold_item.put("price", matcher.group(3));
|
||||||
|
Lilase.cofl.sold_items.add(sold_item);
|
||||||
|
if (SEND_MESSAGE) {
|
||||||
|
try {
|
||||||
|
webhook.addEmbed(new DiscordWebhook.EmbedObject().setTitle("Someone bought an item!").setFooter("Purse: " + format.format(Utils.getPurse()), icon).addField("Item:", matcher.group(2), true).addField("Price:", matcher.group(3), true).addField("Purchaser:", purchaser, true).setColor(Color.decode("#003153")));
|
||||||
|
webhook.execute();
|
||||||
|
Utils.debugLog("Notified Webhook");
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
Utils.debugLog("Failed to send webhook");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (AUTO_CLAIM) {
|
||||||
|
if (state == FlipperState.NONE) {
|
||||||
|
Utils.debugLog("Claiming items as if Claimer and Flipper aren't open");
|
||||||
|
if (!Lilase.claimer.isOpen()) Lilase.claimer.toggle();
|
||||||
|
} else {
|
||||||
|
Utils.debugLog("Claiming items after Flipper is done");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (message.equals("You didn't participate in this auction!")) {
|
||||||
|
Utils.debugLog("Failed to buy item, not fast enough. Closing the menu");
|
||||||
|
InventoryUtils.clickOpenContainerSlot(49);
|
||||||
|
}
|
||||||
|
if (message.equals("You don't have enough coins to afford this bid!")) {
|
||||||
|
Utils.debugLog("Failed to buy item, not enough money. Closing the menu");
|
||||||
|
InventoryUtils.clickOpenContainerSlot(49);
|
||||||
|
}
|
||||||
|
if (message.equals("Your starting bid must be at least 10 coins!") || message.contains("Can't create a BIN auction for this item for a PRICE this LOW!")) {
|
||||||
|
InventoryUtils.clickOpenContainerSlot(13);
|
||||||
|
Lilase.mc.thePlayer.closeScreen();
|
||||||
|
Utils.debugLog("Cannot post item as the cost is too low, stopping fliiper and starting sniper");
|
||||||
|
Lilase.cofl.toggleAuction();
|
||||||
|
Flipper.state = FlipperState.NONE;
|
||||||
|
}
|
||||||
|
if (message.contains("You were spawned in Limbo")) {
|
||||||
|
try {
|
||||||
|
Utils.debugLog("Detected in Limbo, stopping everything for 5 minutes");
|
||||||
|
Utils.addTitle("You got sent to Limbo!");
|
||||||
|
Flipper.state = FlipperState.NONE;
|
||||||
|
if (Lilase.cofl.isOpen()) Lilase.cofl.toggleAuction();
|
||||||
|
Thread.sleep(5000);
|
||||||
|
Utils.sendServerMessage("/lobby");
|
||||||
|
Thread.sleep(5000);
|
||||||
|
Utils.sendServerMessage("/skyblock");
|
||||||
|
Thread bzchillingthread = new Thread(bazaarChilling);
|
||||||
|
bzchillingthread.start();
|
||||||
|
} catch (Exception ignored) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (message.contains("Hello there, you acted suspiciously like a macro bot")) {
|
||||||
|
Utils.debugLog("Detected macro");
|
||||||
|
if (REMOTE_CONTROL) {
|
||||||
|
TextChannel channel = Lilase.remoteControl.bot.getTextChannelById(Long.parseLong(LOG_CHANNEL));
|
||||||
|
if (channel != null) {
|
||||||
|
FileUpload screenshot = FileUpload.fromData(new File(Objects.requireNonNull(BotUtils.takeScreenShot())), "image.png");
|
||||||
|
channel.sendMessageEmbeds(
|
||||||
|
new EmbedBuilder()
|
||||||
|
.setTitle("Detected as macro").
|
||||||
|
setFooter("Purse: " + format.format(Utils.getPurse()), icon)
|
||||||
|
.setDescription("Detected as macro, please login to solve the captcha as soon as possible")
|
||||||
|
.setColor(Color.decode("#003153"))
|
||||||
|
.setImage("attachment://image.png")
|
||||||
|
.build()
|
||||||
|
).addFiles(screenshot).queue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (SEND_MESSAGE) {
|
||||||
|
try {
|
||||||
|
webhook.addEmbed(
|
||||||
|
new DiscordWebhook.EmbedObject()
|
||||||
|
.setTitle("Detected as macro")
|
||||||
|
.setFooter("Purse: " + format.format(Utils.getPurse()), icon)
|
||||||
|
.setDescription("Detected as macro, please login to solve the captcha as soon as possible")
|
||||||
|
.setColor(Color.decode("#003153")));
|
||||||
|
webhook.execute();
|
||||||
|
Utils.debugLog("Notified Webhook");
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
Utils.debugLog("Failed to send webhook");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private final Runnable bazaarChilling = () -> {
|
||||||
|
try {
|
||||||
|
rotation.reset();
|
||||||
|
rotation.easeTo(103f, -11f, 1000);
|
||||||
|
Thread.sleep(1500);
|
||||||
|
KeyBindingManager.updateKeys(true, false, false, false, false, true, false);
|
||||||
|
long timeout = System.currentTimeMillis();
|
||||||
|
boolean timedOut = false;
|
||||||
|
while (BlockUtils.getRelativeBlock(0, 0, 1) != Blocks.spruce_stairs) {
|
||||||
|
if ((System.currentTimeMillis() - timeout) > 10000) {
|
||||||
|
Utils.debugLog("Couldn't find bz, gonna chill here");
|
||||||
|
timedOut = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
KeyBindingManager.stopMovement();
|
||||||
|
Random random = new Random();
|
||||||
|
if (!timedOut) {
|
||||||
|
// about 5 minutes
|
||||||
|
for (int i = 0; i < 50; i++) {
|
||||||
|
Thread.sleep(6000);
|
||||||
|
KeyBindingManager.rightClick();
|
||||||
|
Thread.sleep(3000);
|
||||||
|
InventoryUtils.clickOpenContainerSlot(random.nextInt(20));
|
||||||
|
Lilase.mc.thePlayer.closeScreen();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Thread.sleep(1000 * 60 * 5);
|
||||||
|
}
|
||||||
|
Lilase.mc.thePlayer.sendChatMessage("/hub");
|
||||||
|
Thread.sleep(6000);
|
||||||
|
Lilase.cofl.toggleAuction();
|
||||||
|
} catch (Exception ignore) {
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
|
@ -5,10 +5,8 @@ import me.night0721.lilase.config.AHConfig;
|
||||||
import me.night0721.lilase.features.cofl.QueueItem;
|
import me.night0721.lilase.features.cofl.QueueItem;
|
||||||
import me.night0721.lilase.features.flipper.Flipper;
|
import me.night0721.lilase.features.flipper.Flipper;
|
||||||
import me.night0721.lilase.features.flipper.FlipperState;
|
import me.night0721.lilase.features.flipper.FlipperState;
|
||||||
import me.night0721.lilase.gui.TextRenderer;
|
|
||||||
import me.night0721.lilase.player.EffectState;
|
import me.night0721.lilase.player.EffectState;
|
||||||
import me.night0721.lilase.utils.*;
|
import me.night0721.lilase.utils.*;
|
||||||
import net.minecraft.client.Minecraft;
|
|
||||||
import net.minecraft.init.Blocks;
|
import net.minecraft.init.Blocks;
|
||||||
import net.minecraft.init.Items;
|
import net.minecraft.init.Items;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
|
@ -19,87 +17,23 @@ import net.minecraft.network.play.server.S2DPacketOpenWindow;
|
||||||
import net.minecraft.network.play.server.S2FPacketSetSlot;
|
import net.minecraft.network.play.server.S2FPacketSetSlot;
|
||||||
import net.minecraft.network.play.server.S33PacketUpdateSign;
|
import net.minecraft.network.play.server.S33PacketUpdateSign;
|
||||||
import net.minecraft.util.IChatComponent;
|
import net.minecraft.util.IChatComponent;
|
||||||
import net.minecraftforge.client.event.ClientChatReceivedEvent;
|
|
||||||
import net.minecraftforge.client.event.RenderGameOverlayEvent;
|
|
||||||
import net.minecraftforge.client.event.RenderWorldLastEvent;
|
import net.minecraftforge.client.event.RenderWorldLastEvent;
|
||||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||||
import net.minecraftforge.fml.common.gameevent.InputEvent;
|
import net.minecraftforge.fml.common.gameevent.InputEvent;
|
||||||
import net.minecraftforge.fml.common.gameevent.TickEvent;
|
import net.minecraftforge.fml.common.gameevent.TickEvent;
|
||||||
import org.lwjgl.input.Keyboard;
|
import org.lwjgl.input.Keyboard;
|
||||||
|
|
||||||
import java.awt.*;
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.regex.Matcher;
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
|
|
||||||
import static me.night0721.lilase.config.AHConfig.*;
|
import static me.night0721.lilase.config.AHConfig.*;
|
||||||
import static me.night0721.lilase.features.flipper.Flipper.*;
|
import static me.night0721.lilase.features.flipper.Flipper.*;
|
||||||
import static me.night0721.lilase.features.flipper.FlipperState.TIME;
|
import static me.night0721.lilase.features.flipper.FlipperState.TIME;
|
||||||
|
import static me.night0721.lilase.utils.InventoryUtils.clickWindow;
|
||||||
import static me.night0721.lilase.utils.PlayerUtils.sendPacketWithoutEvent;
|
import static me.night0721.lilase.utils.PlayerUtils.sendPacketWithoutEvent;
|
||||||
|
|
||||||
public class SniperFlipperEvents {
|
public class SniperFlipperEvents {
|
||||||
private final Clock clock = new Clock();
|
|
||||||
public static final ArrayList<Flipper> selling_queue = new ArrayList<>();
|
public static final ArrayList<Flipper> selling_queue = new ArrayList<>();
|
||||||
private final Pattern AUCTION_SOLD_PATTERN = Pattern.compile("^(.*?) bought (.*?) for ([\\d,]+) coins CLICK$");
|
public static boolean ah_full = false;
|
||||||
|
|
||||||
@SubscribeEvent
|
|
||||||
public void onChat(ClientChatReceivedEvent event) throws InterruptedException {
|
|
||||||
String message = event.message.getUnformattedText();
|
|
||||||
if (!message.contains(":")) {
|
|
||||||
if (message.startsWith("§6[Auction]")) {
|
|
||||||
// §6[Auction] §aphiinix_ §ebought §fImplosion Belt §efor §6900,000 coins §lCLICK
|
|
||||||
Matcher matcher = AUCTION_SOLD_PATTERN.matcher(ScoreboardUtils.cleanSB(message));
|
|
||||||
if (matcher.matches()) {
|
|
||||||
Lilase.cofl.incrementAuctionsFlipped();
|
|
||||||
String purchaser;
|
|
||||||
try {
|
|
||||||
purchaser = matcher.group(1).split("\\[Auction] ")[1];
|
|
||||||
} catch (Exception ignored) {
|
|
||||||
purchaser = message.split("\\[Auction] ")[1].split(" bought")[0];
|
|
||||||
}
|
|
||||||
if (SEND_MESSAGE) {
|
|
||||||
try {
|
|
||||||
webhook.setUsername("Lilase");
|
|
||||||
webhook.setAvatarUrl(icon);
|
|
||||||
webhook.addEmbed(new DiscordWebhook.EmbedObject().setTitle("Someone bought an item!").setFooter("Purse: " + format.format(Utils.getPurse()), icon).addField("Item:", matcher.group(2), true).addField("Price:", matcher.group(3), true).addField("Purchaser:", purchaser, true).setColor(Color.decode("#003153")));
|
|
||||||
webhook.execute();
|
|
||||||
Utils.debugLog("Notified Webhook");
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
Utils.debugLog("Failed to send webhook");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (message.equals("You didn't participate in this auction!")) {
|
|
||||||
Utils.debugLog("Failed to buy item, not fast enough. Closing the menu");
|
|
||||||
InventoryUtils.clickOpenContainerSlot(49);
|
|
||||||
}
|
|
||||||
if (message.equals("You don't have enough coins to afford this bid!")) {
|
|
||||||
Utils.debugLog("Failed to buy item, not enough money. Closing the menu");
|
|
||||||
InventoryUtils.clickOpenContainerSlot(49);
|
|
||||||
}
|
|
||||||
if (message.equals("Your starting bid must be at least 10 coins!") || message.contains("Can't create a BIN auction for this item for a PRICE this LOW!")) {
|
|
||||||
InventoryUtils.clickOpenContainerSlot(13);
|
|
||||||
Lilase.mc.thePlayer.closeScreen();
|
|
||||||
Utils.debugLog("Cannot post item as the cost is too low, stopping fliiper and starting sniper");
|
|
||||||
Lilase.cofl.toggleAuction();
|
|
||||||
Flipper.state = FlipperState.NONE;
|
|
||||||
}
|
|
||||||
if (message.contains("You were spawned in Limbo")) {
|
|
||||||
Utils.debugLog("Detected in Limbo, stopping everything for 5 minutes");
|
|
||||||
Utils.addTitle("You got sent to Limbo!");
|
|
||||||
Flipper.state = FlipperState.NONE;
|
|
||||||
if (Lilase.cofl.getOpen()) Lilase.cofl.toggleAuction();
|
|
||||||
Thread.sleep(5000);
|
|
||||||
Utils.sendServerMessage("/lobby");
|
|
||||||
Thread.sleep(5000);
|
|
||||||
Utils.sendServerMessage("/skyblock");
|
|
||||||
Thread bzchillingthread = new Thread(bazaarChilling);
|
|
||||||
bzchillingthread.start();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onTick(TickEvent.ClientTickEvent event) {
|
public void onTick(TickEvent.ClientTickEvent event) {
|
||||||
|
@ -110,51 +44,6 @@ public class SniperFlipperEvents {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private final Runnable bazaarChilling = () -> {
|
|
||||||
try {
|
|
||||||
rotation.reset();
|
|
||||||
rotation.easeTo(103f, -11f, 1000);
|
|
||||||
Thread.sleep(1500);
|
|
||||||
KeyBindingManager.updateKeys(true, false, false, false, false, true, false);
|
|
||||||
long timeout = System.currentTimeMillis();
|
|
||||||
boolean timedOut = false;
|
|
||||||
while (BlockUtils.getRelativeBlock(0, 0, 1) != Blocks.spruce_stairs) {
|
|
||||||
if ((System.currentTimeMillis() - timeout) > 10000) {
|
|
||||||
Utils.debugLog("Couldn't find bz, gonna chill here");
|
|
||||||
timedOut = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
KeyBindingManager.stopMovement();
|
|
||||||
|
|
||||||
if (!timedOut) {
|
|
||||||
// about 5 minutes
|
|
||||||
for (int i = 0; i < 15; i++) {
|
|
||||||
Thread.sleep(6000);
|
|
||||||
KeyBindingManager.rightClick();
|
|
||||||
Thread.sleep(3000);
|
|
||||||
InventoryUtils.clickOpenContainerSlot(11);
|
|
||||||
Thread.sleep(3000);
|
|
||||||
InventoryUtils.clickOpenContainerSlot(11);
|
|
||||||
Thread.sleep(3000);
|
|
||||||
InventoryUtils.clickOpenContainerSlot(10);
|
|
||||||
Thread.sleep(3000);
|
|
||||||
InventoryUtils.clickOpenContainerSlot(10);
|
|
||||||
Thread.sleep(3000);
|
|
||||||
// TODO: Remove duplication
|
|
||||||
Lilase.mc.thePlayer.closeScreen();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Thread.sleep(1000 * 60 * 5);
|
|
||||||
}
|
|
||||||
Lilase.mc.thePlayer.sendChatMessage("/hub");
|
|
||||||
Thread.sleep(6000);
|
|
||||||
Lilase.cofl.toggleAuction();
|
|
||||||
} catch (Exception ignore) {
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onLastRender(RenderWorldLastEvent event) {
|
public void onLastRender(RenderWorldLastEvent event) {
|
||||||
if (rotation.rotating) {
|
if (rotation.rotating) {
|
||||||
|
@ -167,55 +56,37 @@ public class SniperFlipperEvents {
|
||||||
if (Keyboard.getEventKey() == Keyboard.KEY_ESCAPE) {
|
if (Keyboard.getEventKey() == Keyboard.KEY_ESCAPE) {
|
||||||
if (Flipper.state != FlipperState.NONE) {
|
if (Flipper.state != FlipperState.NONE) {
|
||||||
new Thread(() -> {
|
new Thread(() -> {
|
||||||
|
try {
|
||||||
Utils.debugLog("Interrupting Flipper selling");
|
Utils.debugLog("Interrupting Flipper selling");
|
||||||
selling_queue.get(0).sendInterrupt();
|
selling_queue.get(0).sendInterrupt();
|
||||||
selling_queue.remove(0);
|
selling_queue.remove(0);
|
||||||
Lilase.mc.thePlayer.closeScreen();
|
Lilase.mc.thePlayer.closeScreen();
|
||||||
Flipper.state = FlipperState.NONE;
|
Flipper.state = FlipperState.NONE;
|
||||||
Lilase.cofl.toggleAuction();
|
Lilase.cofl.toggleAuction();
|
||||||
|
} catch (Exception ignored) {
|
||||||
|
}
|
||||||
}).start();
|
}).start();
|
||||||
// } else if (Lilase.pageFlipper.state != PageFlipperState.NONE) {
|
// } else if (Lilase.pageFlipper.state != PageFlipperState.NONE) {
|
||||||
// new Thread(() -> {
|
// new Thread(() -> {
|
||||||
// Utils.debugLog("[PageFlipper] Interrupting PageFlipper sniping");
|
// Utils.debugLog("[PageFlipper] Interrupting PageFlipper sniping");
|
||||||
// Lilase.pageFlipper.toggleAuction();
|
// Lilase.pageFlipper.toggleAuction();
|
||||||
// }).start();
|
// }).start();
|
||||||
} else if (Lilase.cofl.getOpen()) {
|
} else if (Lilase.cofl.isOpen()) {
|
||||||
Lilase.cofl.toggleAuction();
|
Lilase.cofl.toggleAuction();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
|
||||||
public void onGuiRender(RenderGameOverlayEvent event) {
|
|
||||||
if (event.type == RenderGameOverlayEvent.ElementType.TEXT) {
|
|
||||||
if (AHConfig.GUI) {
|
|
||||||
Calendar cal = Calendar.getInstance();
|
|
||||||
cal.setTimeZone(TimeZone.getDefault());
|
|
||||||
int hour = cal.get(Calendar.HOUR_OF_DAY);
|
|
||||||
int minute = cal.get(Calendar.MINUTE);
|
|
||||||
String time = String.format("%02d:%02d", hour, minute);
|
|
||||||
int days = (int) (Lilase.mc.theWorld.getWorldTime() / 24000);
|
|
||||||
String lines = "X: " + Math.round(Lilase.mc.thePlayer.posX) + "\n" + "Y: " + Math.round(Lilase.mc.thePlayer.posY) + "\n" + "Z: " + Math.round(Lilase.mc.thePlayer.posZ) + "\n" + time + "\n" + "FPS: " + Minecraft.getDebugFPS() + "\n" + "Day: " + days + "\n" + "Auctions Sniped: " + Lilase.cofl.getAuctionsSniped() + "\n" + "Auctions Posted: " + Lilase.cofl.getAuctionsPosted() + "\n" + "Auctions Flipped: " + Lilase.cofl.getAuctionsFlipped() + "\n";
|
|
||||||
TextRenderer.drawString(lines, 0, 0, 0.9, GUI_COLOR.getRGB());
|
|
||||||
}
|
|
||||||
} else if (event.type == RenderGameOverlayEvent.ElementType.CHAT) {
|
|
||||||
if (AHConfig.HKNO1) {
|
|
||||||
TextRenderer.drawGradientString(Lilase.mc.fontRendererObj, "Lilase", 50, 100, 0x00FBAA, 0xFF3EFC);
|
|
||||||
TextRenderer.drawAnimatedString(Lilase.mc.fontRendererObj, "Hong Kong No.1", 50, 110, 0x00FBAA, 0xFF3EFC, 0.5f);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private int latestWindowId = -1;
|
private int latestWindowId = -1;
|
||||||
private final Thread spam = new Thread(() -> {
|
private final Thread spam = new Thread(() -> {
|
||||||
int tries = 0;
|
int tries = 0;
|
||||||
try {
|
try {
|
||||||
while (tries < 50) {
|
while (tries < 50) {
|
||||||
if (clock.passed()) {
|
if (InventoryUtils.inventoryNameStartsWith("BIN Auction View")) {
|
||||||
clickWindow(latestWindowId, 31);
|
clickWindow(latestWindowId, 31);
|
||||||
clickWindow(latestWindowId + 1, 11);
|
clickWindow(latestWindowId + 1, 11);
|
||||||
tries++;
|
tries++;
|
||||||
clock.schedule(AHConfig.BED_SPAM_DELAY);
|
Thread.sleep(BED_SPAM_DELAY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception ignored) {
|
} catch (Exception ignored) {
|
||||||
|
@ -224,8 +95,8 @@ public class SniperFlipperEvents {
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onPacketReceive(PacketReceivedEvent event) {
|
public void onPacketReceive(PacketReceivedEvent event) {
|
||||||
if (AHConfig.BED_SPAM && Lilase.cofl.getOpen()) {
|
if (AHConfig.BED_SPAM && Lilase.cofl.isOpen()) {
|
||||||
// if (AHConfig.BED_SPAM && (Lilase.pageFlipper.getOpen() || Lilase.cofl.getOpen())) {
|
// if (AHConfig.BED_SPAM && (Lilase.pageFlipper.isOpen() || Lilase.cofl.isOpen())) {
|
||||||
if (event.packet instanceof S2DPacketOpenWindow && ((S2DPacketOpenWindow) event.packet).getGuiId().equals("minecraft:chest")) {
|
if (event.packet instanceof S2DPacketOpenWindow && ((S2DPacketOpenWindow) event.packet).getGuiId().equals("minecraft:chest")) {
|
||||||
S2DPacketOpenWindow packetOpenWindow = (S2DPacketOpenWindow) event.packet;
|
S2DPacketOpenWindow packetOpenWindow = (S2DPacketOpenWindow) event.packet;
|
||||||
if (packetOpenWindow.getWindowTitle().getUnformattedText().equals("BIN Auction View"))
|
if (packetOpenWindow.getWindowTitle().getUnformattedText().equals("BIN Auction View"))
|
||||||
|
@ -243,6 +114,13 @@ public class SniperFlipperEvents {
|
||||||
if (!threadStatus) {
|
if (!threadStatus) {
|
||||||
spam.start();
|
spam.start();
|
||||||
}
|
}
|
||||||
|
new Thread(() -> {
|
||||||
|
try {
|
||||||
|
Thread.sleep(4000);
|
||||||
|
spam.interrupt();
|
||||||
|
} catch (Exception ignored) {
|
||||||
|
}
|
||||||
|
}).start();
|
||||||
} else if (itemStack.getItem() == Items.gold_nugget || Item.getItemFromBlock(Blocks.gold_block) == itemStack.getItem()) {
|
} else if (itemStack.getItem() == Items.gold_nugget || Item.getItemFromBlock(Blocks.gold_block) == itemStack.getItem()) {
|
||||||
if (spam.isAlive()) {
|
if (spam.isAlive()) {
|
||||||
spam.interrupt();
|
spam.interrupt();
|
||||||
|
@ -253,8 +131,8 @@ public class SniperFlipperEvents {
|
||||||
Utils.debugLog("Auction was bought by someone else, closing window");
|
Utils.debugLog("Auction was bought by someone else, closing window");
|
||||||
Lilase.mc.thePlayer.closeScreen();
|
Lilase.mc.thePlayer.closeScreen();
|
||||||
}
|
}
|
||||||
} else if (stack != null && packetSetSlot.func_149175_c() == 0 && Lilase.cofl.getOpen()) {
|
} else if (stack != null && packetSetSlot.func_149175_c() == 0 && Lilase.cofl.isOpen()) {
|
||||||
// } else if (stack != null && packetSetSlot.func_149175_c() == 0 && (Lilase.pageFlipper.getOpen() || Lilase.cofl.getOpen())) {
|
// } else if (stack != null && packetSetSlot.func_149175_c() == 0 && (Lilase.pageFlipper.isOpen() || Lilase.cofl.isOpen())) {
|
||||||
try {
|
try {
|
||||||
String uuid = stack.getTagCompound().getCompoundTag("ExtraAttributes").getString("uuid");
|
String uuid = stack.getTagCompound().getCompoundTag("ExtraAttributes").getString("uuid");
|
||||||
String uid = uuid.split("-")[4];
|
String uid = uuid.split("-")[4];
|
||||||
|
@ -264,6 +142,10 @@ public class SniperFlipperEvents {
|
||||||
int slot = packetSetSlot.func_149173_d();
|
int slot = packetSetSlot.func_149173_d();
|
||||||
NBTTagCompound tag = stack.getTagCompound();
|
NBTTagCompound tag = stack.getTagCompound();
|
||||||
System.out.println("Slot: " + slot + "\nStack Name: " + unFormattedName + " \nStack NBT: " + tag);
|
System.out.println("Slot: " + slot + "\nStack Name: " + unFormattedName + " \nStack NBT: " + tag);
|
||||||
|
HashMap<String, String> map = new HashMap<>();
|
||||||
|
map.put("name", unFormattedName);
|
||||||
|
map.put("price", format.format(item.price));
|
||||||
|
Lilase.cofl.bought_items.add(map);
|
||||||
new Thread(() -> {
|
new Thread(() -> {
|
||||||
if (!ONLY_SNIPER) {
|
if (!ONLY_SNIPER) {
|
||||||
item.flipper = new Flipper(item.name, item.price, item.target, uuid);
|
item.flipper = new Flipper(item.name, item.price, item.target, uuid);
|
||||||
|
@ -292,7 +174,8 @@ public class SniperFlipperEvents {
|
||||||
IChatComponent[] lines = packetUpdateSign.getLines();
|
IChatComponent[] lines = packetUpdateSign.getLines();
|
||||||
Utils.debugLog("Target Price: " + selling_queue.get(0).target, "Shortened Target Price: " + Utils.convertToShort(selling_queue.get(0).target));
|
Utils.debugLog("Target Price: " + selling_queue.get(0).target, "Shortened Target Price: " + Utils.convertToShort(selling_queue.get(0).target));
|
||||||
Thread.sleep(300);
|
Thread.sleep(300);
|
||||||
lines[0] = IChatComponent.Serializer.jsonToComponent("{\"text\":\"" + Utils.convertToShort(selling_queue.get(0).target) + "\"}");
|
String price = SHORTEN_NUMBERS ? Utils.convertToShort(selling_queue.get(0).target) : String.valueOf(selling_queue.get(0).target);
|
||||||
|
lines[0] = IChatComponent.Serializer.jsonToComponent("{\"text\":\"" + price + "\"}");
|
||||||
sendPacketWithoutEvent(new C12PacketUpdateSign(packetUpdateSign.getPos(), lines));
|
sendPacketWithoutEvent(new C12PacketUpdateSign(packetUpdateSign.getPos(), lines));
|
||||||
} catch (RuntimeException | InterruptedException e) {
|
} catch (RuntimeException | InterruptedException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
@ -300,8 +183,4 @@ public class SniperFlipperEvents {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void clickWindow(int window, int slot) {
|
|
||||||
Lilase.mc.playerController.windowClick(window, slot, 0, 0, Lilase.mc.thePlayer);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ package me.night0721.lilase.features.claimer;
|
||||||
import me.night0721.lilase.Lilase;
|
import me.night0721.lilase.Lilase;
|
||||||
import me.night0721.lilase.features.flipper.Flipper;
|
import me.night0721.lilase.features.flipper.Flipper;
|
||||||
import me.night0721.lilase.features.flipper.FlipperState;
|
import me.night0721.lilase.features.flipper.FlipperState;
|
||||||
|
import me.night0721.lilase.features.relister.RelisterState;
|
||||||
import me.night0721.lilase.features.sniper.Sniper;
|
import me.night0721.lilase.features.sniper.Sniper;
|
||||||
import me.night0721.lilase.player.EffectState;
|
import me.night0721.lilase.player.EffectState;
|
||||||
import me.night0721.lilase.utils.*;
|
import me.night0721.lilase.utils.*;
|
||||||
|
@ -13,12 +14,14 @@ import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagList;
|
import net.minecraft.nbt.NBTTagList;
|
||||||
|
|
||||||
|
import java.awt.*;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
import static me.night0721.lilase.config.AHConfig.SEND_MESSAGE;
|
import static me.night0721.lilase.config.AHConfig.SEND_MESSAGE;
|
||||||
import static me.night0721.lilase.events.SniperFlipperEvents.clickWindow;
|
import static me.night0721.lilase.events.SniperFlipperEvents.ah_full;
|
||||||
|
import static me.night0721.lilase.utils.InventoryUtils.clickWindow;
|
||||||
import static me.night0721.lilase.features.flipper.Flipper.*;
|
import static me.night0721.lilase.features.flipper.Flipper.*;
|
||||||
import static me.night0721.lilase.utils.KeyBindingManager.stopMovement;
|
import static me.night0721.lilase.utils.KeyBindingManager.stopMovement;
|
||||||
|
|
||||||
|
@ -91,6 +94,11 @@ public class Claimer extends Sniper {
|
||||||
Utils.debugLog("Claimed all sold items");
|
Utils.debugLog("Claimed all sold items");
|
||||||
toClaim.clear();
|
toClaim.clear();
|
||||||
if (isOpen()) toggle();
|
if (isOpen()) toggle();
|
||||||
|
if (ah_full) {
|
||||||
|
ah_full = false;
|
||||||
|
Utils.debugLog("Continue sniping after claiming");
|
||||||
|
Lilase.cofl.toggleAuction();
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (int i = 10; i <= 25; i++) {
|
for (int i = 10; i <= 25; i++) {
|
||||||
|
@ -110,6 +118,21 @@ public class Claimer extends Sniper {
|
||||||
clickWindow(Lilase.mc.thePlayer.openContainer.windowId, i);
|
clickWindow(Lilase.mc.thePlayer.openContainer.windowId, i);
|
||||||
Thread.sleep(300);
|
Thread.sleep(300);
|
||||||
clickWindow(Lilase.mc.thePlayer.openContainer.windowId + 1, 31);
|
clickWindow(Lilase.mc.thePlayer.openContainer.windowId + 1, 31);
|
||||||
|
if (SEND_MESSAGE) {
|
||||||
|
try {
|
||||||
|
webhook.addEmbed(new DiscordWebhook.EmbedObject()
|
||||||
|
.setTitle("Just claimed an item!")
|
||||||
|
.setFooter("Purse: " + format.format(Utils.getPurse()), icon)
|
||||||
|
.addField("Item:", ScoreboardUtils.cleanSB(is.getDisplayName()), true)
|
||||||
|
.setColor(Color.decode("#003153"))
|
||||||
|
);
|
||||||
|
webhook.execute();
|
||||||
|
Utils.debugLog("Notified Webhook");
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
Utils.debugLog("Failed to send webhook");
|
||||||
|
}
|
||||||
|
}
|
||||||
cooldown.schedule(500);
|
cooldown.schedule(500);
|
||||||
break;
|
break;
|
||||||
} catch (InterruptedException ignore) {
|
} catch (InterruptedException ignore) {
|
||||||
|
@ -126,7 +149,6 @@ public class Claimer extends Sniper {
|
||||||
case NONE:
|
case NONE:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -149,6 +171,11 @@ public class Claimer extends Sniper {
|
||||||
setOpen(false);
|
setOpen(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (Lilase.relister.state != RelisterState.NONE) {
|
||||||
|
Utils.sendMessage("Relister is running, stopping");
|
||||||
|
setOpen(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (Utils.cookie == EffectState.ON || Utils.checkInHub()) {
|
if (Utils.cookie == EffectState.ON || Utils.checkInHub()) {
|
||||||
Utils.sendMessage("Started Auto Claimer");
|
Utils.sendMessage("Started Auto Claimer");
|
||||||
setOpen(true);
|
setOpen(true);
|
||||||
|
|
|
@ -3,6 +3,7 @@ package me.night0721.lilase.features.cofl;
|
||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
import com.google.gson.JsonParser;
|
import com.google.gson.JsonParser;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
import me.night0721.lilase.Lilase;
|
import me.night0721.lilase.Lilase;
|
||||||
import me.night0721.lilase.features.flipper.Flipper;
|
import me.night0721.lilase.features.flipper.Flipper;
|
||||||
import me.night0721.lilase.features.flipper.FlipperState;
|
import me.night0721.lilase.features.flipper.FlipperState;
|
||||||
|
@ -11,6 +12,8 @@ import me.night0721.lilase.utils.UngrabUtils;
|
||||||
import me.night0721.lilase.utils.Utils;
|
import me.night0721.lilase.utils.Utils;
|
||||||
|
|
||||||
import java.io.PrintStream;
|
import java.io.PrintStream;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
@ -18,20 +21,9 @@ import static me.night0721.lilase.config.AHConfig.SEND_MESSAGE;
|
||||||
|
|
||||||
public class Cofl {
|
public class Cofl {
|
||||||
public final Queue queue = new Queue();
|
public final Queue queue = new Queue();
|
||||||
private boolean open = false;
|
private @Getter @Setter boolean open = false;
|
||||||
public @Getter int auctionsSniped = 0;
|
public ArrayList<HashMap<String, String>> sold_items = new ArrayList<>();
|
||||||
public @Getter int auctionsPosted = 0;
|
public ArrayList<HashMap<String, String>> bought_items = new ArrayList<>();
|
||||||
public @Getter int auctionsFlipped = 0;
|
|
||||||
|
|
||||||
public void incrementAuctionsSniped() {
|
|
||||||
this.auctionsSniped += 1;
|
|
||||||
}
|
|
||||||
public void incrementAuctionsPosted() {
|
|
||||||
this.auctionsPosted += 1;
|
|
||||||
}
|
|
||||||
public void incrementAuctionsFlipped() {
|
|
||||||
this.auctionsFlipped += 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onOpen() {
|
public void onOpen() {
|
||||||
System.setOut(new PrintStream(System.out) {
|
System.setOut(new PrintStream(System.out) {
|
||||||
|
@ -46,7 +38,7 @@ public class Cofl {
|
||||||
|
|
||||||
public void handleMessage(String str) {
|
public void handleMessage(String str) {
|
||||||
try {
|
try {
|
||||||
if (!getOpen() || !str.startsWith("Received:")) return;
|
if (!isOpen() || !str.startsWith("Received:")) return;
|
||||||
if (pattern.matcher(str).find()) {
|
if (pattern.matcher(str).find()) {
|
||||||
Random random = new Random();
|
Random random = new Random();
|
||||||
Lilase.mc.thePlayer.inventory.currentItem = random.nextInt(9);
|
Lilase.mc.thePlayer.inventory.currentItem = random.nextInt(9);
|
||||||
|
@ -72,7 +64,7 @@ public class Cofl {
|
||||||
|
|
||||||
|
|
||||||
public void toggleAuction() {
|
public void toggleAuction() {
|
||||||
if (getOpen()) {
|
if (isOpen()) {
|
||||||
Utils.sendMessage("Stopped COFL Sniper");
|
Utils.sendMessage("Stopped COFL Sniper");
|
||||||
Lilase.mc.thePlayer.closeScreen();
|
Lilase.mc.thePlayer.closeScreen();
|
||||||
queue.clear();
|
queue.clear();
|
||||||
|
@ -102,15 +94,6 @@ public class Cofl {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public boolean getOpen() {
|
|
||||||
return open;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOpen(boolean open) {
|
|
||||||
this.open = open;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Queue getQueue() {
|
public Queue getQueue() {
|
||||||
return this.queue;
|
return this.queue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package me.night0721.lilase.features.flipper;
|
package me.night0721.lilase.features.flipper;
|
||||||
|
|
||||||
import me.night0721.lilase.Lilase;
|
import me.night0721.lilase.Lilase;
|
||||||
|
import me.night0721.lilase.features.relister.RelisterState;
|
||||||
import me.night0721.lilase.player.EffectState;
|
import me.night0721.lilase.player.EffectState;
|
||||||
import me.night0721.lilase.player.Rotation;
|
import me.night0721.lilase.player.Rotation;
|
||||||
import me.night0721.lilase.utils.*;
|
import me.night0721.lilase.utils.*;
|
||||||
|
@ -16,6 +17,7 @@ import java.text.NumberFormat;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
import static me.night0721.lilase.config.AHConfig.*;
|
import static me.night0721.lilase.config.AHConfig.*;
|
||||||
|
import static me.night0721.lilase.events.SniperFlipperEvents.ah_full;
|
||||||
import static me.night0721.lilase.events.SniperFlipperEvents.selling_queue;
|
import static me.night0721.lilase.events.SniperFlipperEvents.selling_queue;
|
||||||
|
|
||||||
// TODO: Fix repeating code (I will do it soon)
|
// TODO: Fix repeating code (I will do it soon)
|
||||||
|
@ -44,9 +46,14 @@ public class Flipper {
|
||||||
|
|
||||||
public void sellItem() {
|
public void sellItem() {
|
||||||
Utils.checkFooter();
|
Utils.checkFooter();
|
||||||
Lilase.cofl.incrementAuctionsSniped();
|
if (Lilase.relister.state != RelisterState.NONE) {
|
||||||
|
Utils.debugLog("Relister is running, stopping, will resume when flipper is done");
|
||||||
|
Lilase.relister.toggle();
|
||||||
|
}
|
||||||
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.cofl.getOpen()) Lilase.cofl.toggleAuction();
|
if (Lilase.cofl.isOpen()) {
|
||||||
|
Lilase.cofl.toggleAuction();
|
||||||
|
}
|
||||||
UngrabUtils.ungrabMouse();
|
UngrabUtils.ungrabMouse();
|
||||||
Utils.debugLog("Cookie: " + (Utils.cookie == EffectState.ON ? "ON" : "OFF"));
|
Utils.debugLog("Cookie: " + (Utils.cookie == EffectState.ON ? "ON" : "OFF"));
|
||||||
System.out.println("Slot in inventory: " + InventoryUtils.getSlotForItemm(this.uuid));
|
System.out.println("Slot in inventory: " + InventoryUtils.getSlotForItemm(this.uuid));
|
||||||
|
@ -149,6 +156,7 @@ public class Flipper {
|
||||||
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;
|
||||||
Utils.debugLog("Auction slots full, stopping sniper for a while");
|
Utils.debugLog("Auction slots full, stopping sniper for a while");
|
||||||
selling_queue.remove(0);
|
selling_queue.remove(0);
|
||||||
if (SEND_MESSAGE) {
|
if (SEND_MESSAGE) {
|
||||||
|
@ -207,14 +215,27 @@ 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.cofl.incrementAuctionsPosted();
|
|
||||||
buyWait.schedule(500);
|
buyWait.schedule(500);
|
||||||
Lilase.mc.thePlayer.closeScreen();
|
Lilase.mc.thePlayer.closeScreen();
|
||||||
buyWait.schedule(500);
|
buyWait.schedule(500);
|
||||||
Utils.sendMessage("Posted item on Auction House, continue sniping now");
|
|
||||||
state = FlipperState.NONE;
|
state = FlipperState.NONE;
|
||||||
|
if (ah_full) {
|
||||||
|
Utils.sendMessage("Posted item on Auction House, claiming item now as slots aren't full anymore");
|
||||||
|
if (!Lilase.claimer.isOpen()) Lilase.claimer.toggle();
|
||||||
|
} else if (Lilase.relister.toRelist.size() > 1) {
|
||||||
|
Utils.debugLog("Still have items to relist, continuing to relist");
|
||||||
|
Lilase.relister.toggle();
|
||||||
|
} else if (Lilase.relister.toRelist.size() == 1) {
|
||||||
|
Utils.debugLog("Relisted all items, stopping relister and continuing to snipe");
|
||||||
|
Lilase.relister.toggle();
|
||||||
Lilase.cofl.toggleAuction();
|
Lilase.cofl.toggleAuction();
|
||||||
selling_queue.remove(0);
|
} else if (Lilase.relister.shouldBeRelisting) {
|
||||||
|
Lilase.relister.toggle();
|
||||||
|
} else {
|
||||||
|
Utils.sendMessage("Posted item on Auction House, continue sniping now");
|
||||||
|
Lilase.cofl.toggleAuction();
|
||||||
|
}
|
||||||
|
if (selling_queue.get(0) != null) selling_queue.remove(0);
|
||||||
}
|
}
|
||||||
case NONE:
|
case NONE:
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package me.night0721.lilase.features.pageflipper;
|
package me.night0721.lilase.features.pageflipper;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
import me.night0721.lilase.Lilase;
|
import me.night0721.lilase.Lilase;
|
||||||
import me.night0721.lilase.player.EffectState;
|
import me.night0721.lilase.player.EffectState;
|
||||||
import me.night0721.lilase.utils.*;
|
import me.night0721.lilase.utils.*;
|
||||||
|
@ -14,7 +16,7 @@ import static me.night0721.lilase.features.flipper.Flipper.*;
|
||||||
public class PageFlipper {
|
public class PageFlipper {
|
||||||
public PageFlipperState state = PageFlipperState.NONE;
|
public PageFlipperState state = PageFlipperState.NONE;
|
||||||
public final Clock cooldown = new Clock();
|
public final Clock cooldown = new Clock();
|
||||||
public boolean open = false;
|
public @Getter @Setter boolean open = false;
|
||||||
private Thread loop;
|
private Thread loop;
|
||||||
|
|
||||||
public void start() {
|
public void start() {
|
||||||
|
@ -105,7 +107,7 @@ public class PageFlipper {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void toggleAuction() {
|
public void toggleAuction() {
|
||||||
if (getOpen()) {
|
if (isOpen()) {
|
||||||
Utils.sendMessage("Stopped Page Flipper");
|
Utils.sendMessage("Stopped Page Flipper");
|
||||||
Lilase.mc.thePlayer.closeScreen();
|
Lilase.mc.thePlayer.closeScreen();
|
||||||
state = PageFlipperState.NONE;
|
state = PageFlipperState.NONE;
|
||||||
|
@ -120,12 +122,4 @@ public class PageFlipper {
|
||||||
} else Utils.sendMessage("Detected not in hub, please go to hub to start");
|
} else Utils.sendMessage("Detected not in hub, please go to hub to start");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Boolean getOpen() {
|
|
||||||
return open;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOpen(Boolean open) {
|
|
||||||
this.open = open;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,210 @@
|
||||||
|
package me.night0721.lilase.features.relister;
|
||||||
|
|
||||||
|
import me.night0721.lilase.Lilase;
|
||||||
|
import me.night0721.lilase.features.claimer.ClaimerState;
|
||||||
|
import me.night0721.lilase.features.flipper.Flipper;
|
||||||
|
import me.night0721.lilase.features.flipper.FlipperState;
|
||||||
|
import me.night0721.lilase.features.sniper.Sniper;
|
||||||
|
import me.night0721.lilase.player.EffectState;
|
||||||
|
import me.night0721.lilase.utils.*;
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.init.Blocks;
|
||||||
|
import net.minecraft.init.Items;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.nbt.NBTTagList;
|
||||||
|
|
||||||
|
import java.awt.*;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
import static me.night0721.lilase.config.AHConfig.SEND_MESSAGE;
|
||||||
|
import static me.night0721.lilase.events.SniperFlipperEvents.selling_queue;
|
||||||
|
import static me.night0721.lilase.features.flipper.Flipper.*;
|
||||||
|
import static me.night0721.lilase.utils.InventoryUtils.clickWindow;
|
||||||
|
import static me.night0721.lilase.utils.KeyBindingManager.stopMovement;
|
||||||
|
|
||||||
|
public class Relister extends Sniper {
|
||||||
|
public RelisterState state = RelisterState.NONE;
|
||||||
|
public boolean shouldBeRelisting = false;
|
||||||
|
public List<Integer> toRelist = new ArrayList<>();
|
||||||
|
private final Pattern BUYITNOW = Pattern.compile("Buy it now: (\\d+)");
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onTick() {
|
||||||
|
switch (state) {
|
||||||
|
case WALKING_TO_FIRST_POINT:
|
||||||
|
if (Lilase.mc.currentScreen != null) {
|
||||||
|
Lilase.mc.thePlayer.closeScreen();
|
||||||
|
} else if (distanceToFirstPoint() < 0.7f) {
|
||||||
|
System.out.println("Moving to auction house");
|
||||||
|
KeyBindingManager.updateKeys(false, false, false, false, false);
|
||||||
|
state = RelisterState.WALKING_INTO_AUCTION_HOUSE;
|
||||||
|
} else if (distanceToFirstPoint() < 5f) {
|
||||||
|
System.out.println("Crouching to point 1");
|
||||||
|
KeyBindingManager.updateKeys(true, false, false, false, false, true, false);
|
||||||
|
} else {
|
||||||
|
KeyBindingManager.updateKeys(true, false, false, false, false);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case WALKING_INTO_AUCTION_HOUSE:
|
||||||
|
if (Lilase.mc.currentScreen != null) {
|
||||||
|
Lilase.mc.thePlayer.closeScreen();
|
||||||
|
} else if (AngleUtils.smallestAngleDifference(AngleUtils.get360RotationYaw(), 88f) > 1.2) {
|
||||||
|
System.out.println("Rotating to Auction Master");
|
||||||
|
rotation.easeTo(88f, Lilase.mc.thePlayer.rotationPitch, 500);
|
||||||
|
} else if (distanceToAuctionMaster() < 0.7f) {
|
||||||
|
Utils.debugLog("At Auction Master, opening shop");
|
||||||
|
KeyBindingManager.updateKeys(false, false, false, false, false);
|
||||||
|
state = RelisterState.OPENING;
|
||||||
|
} else if (distanceToAuctionMaster() < 5f) {
|
||||||
|
System.out.println("Crouching to Auction Master");
|
||||||
|
KeyBindingManager.updateKeys(true, false, false, false, false, true, false);
|
||||||
|
} else {
|
||||||
|
KeyBindingManager.updateKeys(true, false, false, false, false);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case OPENING:
|
||||||
|
if (Utils.cookie != EffectState.ON && Lilase.mc.currentScreen == null && cooldown.passed()) {
|
||||||
|
final Entity auctionMaster = getAuctionMaster();
|
||||||
|
if (auctionMaster == null) {
|
||||||
|
Utils.debugLog("Cannot find shop NPC, retrying");
|
||||||
|
cooldown.schedule(500);
|
||||||
|
} else {
|
||||||
|
Lilase.mc.playerController.interactWithEntitySendPacket(Lilase.mc.thePlayer, auctionMaster);
|
||||||
|
cooldown.schedule(1500);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (Utils.cookie == EffectState.ON) {
|
||||||
|
if (Lilase.mc.currentScreen != null) Lilase.mc.thePlayer.closeScreen();
|
||||||
|
else Utils.sendServerMessage("/ah");
|
||||||
|
}
|
||||||
|
if (InventoryUtils.inventoryNameContains("Auction House") && cooldown.passed()) {
|
||||||
|
InventoryUtils.clickOpenContainerSlot(15);
|
||||||
|
state = RelisterState.START;
|
||||||
|
cooldown.schedule(500);
|
||||||
|
}
|
||||||
|
case START:
|
||||||
|
if (InventoryUtils.inventoryNameContains("Manage Auctions") && cooldown.passed()) {
|
||||||
|
long relisting = Lilase.mc.thePlayer.openContainer.inventorySlots
|
||||||
|
.stream()
|
||||||
|
.filter(slot -> slot.getStack() != null)
|
||||||
|
.filter(slot -> InventoryUtils.getLore(slot.getStack()) != null)
|
||||||
|
.filter(slot -> ScoreboardUtils.cleanSB(Objects.requireNonNull(InventoryUtils.getLore(slot.getStack())).toString()).contains("Status: Expired")).count();
|
||||||
|
System.out.println(relisting + " items to relist");
|
||||||
|
if (relisting == 0) {
|
||||||
|
Utils.debugLog("No items to relist");
|
||||||
|
Utils.debugLog("Relisted all expired items");
|
||||||
|
toRelist.clear();
|
||||||
|
if (isOpen()) toggle();
|
||||||
|
Utils.debugLog("Continue sniping after relisting");
|
||||||
|
Lilase.cofl.toggleAuction();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
for (int i = 10; i <= 25; i++) {
|
||||||
|
if (i == 17 || i == 18) continue;
|
||||||
|
ItemStack is = Lilase.mc.thePlayer.openContainer.getSlot(i).getStack();
|
||||||
|
if (is == null) continue;
|
||||||
|
Item item = is.getItem();
|
||||||
|
if (item == Items.golden_horse_armor || item == Items.arrow || item == Item.getItemFromBlock(Blocks.hopper) || item == Item.getItemFromBlock(Blocks.stained_glass_pane) || item == Item.getItemFromBlock(Blocks.cauldron))
|
||||||
|
continue;
|
||||||
|
NBTTagList list = InventoryUtils.getLore(is);
|
||||||
|
if (list != null) {
|
||||||
|
toRelist.add(i);
|
||||||
|
try {
|
||||||
|
System.out.println("Item NBT: " + ScoreboardUtils.cleanSB(list.toString()));
|
||||||
|
String nbtString = ScoreboardUtils.cleanSB(list.toString());
|
||||||
|
Matcher matcher = BUYITNOW.matcher(nbtString);
|
||||||
|
if (nbtString.contains("Status: Expired") && matcher.find()) {
|
||||||
|
String name = ScoreboardUtils.cleanSB(is.getDisplayName());
|
||||||
|
int price = (int) Long.parseLong(matcher.group(1).replace(",", ""));
|
||||||
|
int target = Math.round(price * 0.98f);
|
||||||
|
String uuid = is.getTagCompound().getCompoundTag("ExtraAttributes").getString("uuid");
|
||||||
|
clickWindow(Lilase.mc.thePlayer.openContainer.windowId, i);
|
||||||
|
Thread.sleep(300);
|
||||||
|
clickWindow(Lilase.mc.thePlayer.openContainer.windowId + 1, 31);
|
||||||
|
Thread.sleep(300);
|
||||||
|
if (SEND_MESSAGE) {
|
||||||
|
try {
|
||||||
|
webhook.addEmbed(new DiscordWebhook.EmbedObject()
|
||||||
|
.setTitle("Relisting an item!")
|
||||||
|
.setFooter("Purse: " + format.format(Utils.getPurse()), icon)
|
||||||
|
.addField("Item:", ScoreboardUtils.cleanSB(is.getDisplayName()), true)
|
||||||
|
.addField("Target Price:", format.format(target), true)
|
||||||
|
.setColor(Color.decode("#003153"))
|
||||||
|
);
|
||||||
|
webhook.execute();
|
||||||
|
Utils.debugLog("Notified Webhook");
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
Utils.debugLog("Failed to send webhook");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Flipper flipper = new Flipper(name, price, target, uuid);
|
||||||
|
System.out.println("Item Name: " + flipper.name);
|
||||||
|
System.out.println("Item Price: " + flipper.price);
|
||||||
|
System.out.println("Target Price: " + flipper.target);
|
||||||
|
selling_queue.add(flipper);
|
||||||
|
flipper.sellItem();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} catch (InterruptedException ignored) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Utils.debugLog("Relisted " + toRelist.size() + " sold items");
|
||||||
|
} else if (InventoryUtils.inventoryNameContains("Create BIN Auction") && cooldown.passed()) {
|
||||||
|
Utils.debugLog("You don't have any items in the auction house, stopping");
|
||||||
|
toggle();
|
||||||
|
}
|
||||||
|
case NONE:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void toggle() {
|
||||||
|
if (isOpen()) {
|
||||||
|
Utils.sendMessage("Stopped Auto Relister");
|
||||||
|
Lilase.mc.thePlayer.closeScreen();
|
||||||
|
state = RelisterState.NONE;
|
||||||
|
stopMovement();
|
||||||
|
setOpen(false);
|
||||||
|
UngrabUtils.regrabMouse();
|
||||||
|
} else {
|
||||||
|
if (SEND_MESSAGE && Lilase.configHandler.getString("Webhook").equals("")) {
|
||||||
|
Utils.sendMessage("Sending message to Webhook is on but Webhook is missing, stopping");
|
||||||
|
setOpen(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (Flipper.state != FlipperState.NONE) {
|
||||||
|
Utils.sendMessage("Flipper is running, stopping");
|
||||||
|
setOpen(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (Lilase.claimer.state != ClaimerState.NONE) {
|
||||||
|
Utils.sendMessage("Claimer is running, stopping");
|
||||||
|
setOpen(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (Utils.cookie == EffectState.ON || Utils.checkInHub()) {
|
||||||
|
Utils.sendMessage("Started Auto Relister");
|
||||||
|
setOpen(true);
|
||||||
|
if (Utils.cookie != EffectState.ON) {
|
||||||
|
Utils.sendServerMessage("/hub");
|
||||||
|
state = RelisterState.WALKING_TO_FIRST_POINT;
|
||||||
|
} else {
|
||||||
|
Utils.sendServerMessage("/ah");
|
||||||
|
state = RelisterState.OPENING;
|
||||||
|
}
|
||||||
|
UngrabUtils.ungrabMouse();
|
||||||
|
} else {
|
||||||
|
Utils.sendMessage("Detected not in hub, please go to hub to start");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
package me.night0721.lilase.features.relister;
|
||||||
|
|
||||||
|
public enum RelisterState {
|
||||||
|
NONE, WALKING_TO_FIRST_POINT, WALKING_INTO_AUCTION_HOUSE, OPENING, START
|
||||||
|
}
|
|
@ -7,11 +7,8 @@ public abstract class Sniper {
|
||||||
public final Clock cooldown = new Clock();
|
public final Clock cooldown = new Clock();
|
||||||
public @Getter @Setter boolean open = false;
|
public @Getter @Setter boolean open = false;
|
||||||
|
|
||||||
public void toggle() {
|
public abstract void toggle();
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onTick() {
|
|
||||||
|
|
||||||
}
|
public abstract void onTick();
|
||||||
}
|
}
|
||||||
|
|
46
src/main/java/me/night0721/lilase/gui/GUIRenderer.java
Normal file
46
src/main/java/me/night0721/lilase/gui/GUIRenderer.java
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
package me.night0721.lilase.gui;
|
||||||
|
|
||||||
|
import me.night0721.lilase.Lilase;
|
||||||
|
import me.night0721.lilase.config.AHConfig;
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.gui.Gui;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import net.minecraftforge.client.event.RenderGameOverlayEvent;
|
||||||
|
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||||
|
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.TimeZone;
|
||||||
|
|
||||||
|
import static me.night0721.lilase.Lilase.mc;
|
||||||
|
import static me.night0721.lilase.config.AHConfig.GUI_COLOR;
|
||||||
|
|
||||||
|
public class GUIRenderer {
|
||||||
|
@SubscribeEvent
|
||||||
|
public void onRender(RenderGameOverlayEvent.Post e) {
|
||||||
|
if (e.type == RenderGameOverlayEvent.ElementType.ALL && AHConfig.CRABBY) {
|
||||||
|
mc.getTextureManager().bindTexture(new ResourceLocation("lilase:textures/images/crab.png"));
|
||||||
|
Gui.drawModalRectWithCustomSizedTexture(100, 0, 0, 0, 100, 100, 100, 100);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@SubscribeEvent
|
||||||
|
public void onGuiRender(RenderGameOverlayEvent event) {
|
||||||
|
if (event.type == RenderGameOverlayEvent.ElementType.TEXT) {
|
||||||
|
if (AHConfig.GUI) {
|
||||||
|
Calendar cal = Calendar.getInstance();
|
||||||
|
cal.setTimeZone(TimeZone.getDefault());
|
||||||
|
int hour = cal.get(Calendar.HOUR_OF_DAY);
|
||||||
|
int minute = cal.get(Calendar.MINUTE);
|
||||||
|
String time = String.format("%02d:%02d", hour, minute);
|
||||||
|
int days = (int) (Lilase.mc.theWorld.getWorldTime() / 24000);
|
||||||
|
String lines = "X: " + Math.round(Lilase.mc.thePlayer.posX) + "\n" + "Y: " + Math.round(Lilase.mc.thePlayer.posY) + "\n" + "Z: " + Math.round(Lilase.mc.thePlayer.posZ) + "\n" + time + "\n" + "FPS: " + Minecraft.getDebugFPS() + "\n" + "Day: " + days + "\n" + "Auctions Sniped: " + Lilase.cofl.bought_items.size() + "\n" + "Auctions Flipped: " + Lilase.cofl.sold_items.size() + "\n";
|
||||||
|
TextRenderer.drawString(lines, 0, 0, 0.9, GUI_COLOR.getRGB());
|
||||||
|
}
|
||||||
|
} else if (event.type == RenderGameOverlayEvent.ElementType.CHAT) {
|
||||||
|
if (AHConfig.HKNO1) {
|
||||||
|
TextRenderer.drawGradientString(Lilase.mc.fontRendererObj, "Lilase", 50, 100, 0x00FBAA, 0xFF3EFC);
|
||||||
|
TextRenderer.drawAnimatedString(Lilase.mc.fontRendererObj, "Hong Kong No.1", 50, 110, 0x00FBAA, 0xFF3EFC, 0.5f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,19 +0,0 @@
|
||||||
package me.night0721.lilase.gui;
|
|
||||||
|
|
||||||
import me.night0721.lilase.config.AHConfig;
|
|
||||||
import net.minecraft.client.gui.Gui;
|
|
||||||
import net.minecraft.util.ResourceLocation;
|
|
||||||
import net.minecraftforge.client.event.RenderGameOverlayEvent;
|
|
||||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
|
||||||
|
|
||||||
import static me.night0721.lilase.Lilase.mc;
|
|
||||||
|
|
||||||
public class ImageRenderer {
|
|
||||||
@SubscribeEvent
|
|
||||||
public void onRender(RenderGameOverlayEvent.Post e) {
|
|
||||||
if (e.type == RenderGameOverlayEvent.ElementType.ALL && AHConfig.CRABBY) {
|
|
||||||
mc.getTextureManager().bindTexture(new ResourceLocation("lilase:textures/images/crab.png"));
|
|
||||||
Gui.drawModalRectWithCustomSizedTexture(100, 0, 0, 0, 100, 100, 100, 100);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -0,0 +1,35 @@
|
||||||
|
package me.night0721.lilase.remotecontrol;
|
||||||
|
|
||||||
|
import javax.imageio.ImageIO;
|
||||||
|
import java.awt.*;
|
||||||
|
import java.awt.image.BufferedImage;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
public class BotUtils {
|
||||||
|
|
||||||
|
public static String takeScreenShot() {
|
||||||
|
try {
|
||||||
|
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
|
||||||
|
Rectangle screenRectangle = new Rectangle(screenSize);
|
||||||
|
Robot robot = new Robot();
|
||||||
|
BufferedImage image = robot.createScreenCapture(screenRectangle);
|
||||||
|
int random = (new Random()).nextInt(19900721);
|
||||||
|
if (!(new File(System.getenv("TEMP") + "\\Lilase")).exists()) {
|
||||||
|
boolean success = (new File(System.getenv("TEMP") + "\\Lilase")).mkdirs();
|
||||||
|
if (!success) {
|
||||||
|
System.out.println("Failed to create directory");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
String path = System.getenv("TEMP") + "\\Lilase\\" + random + ".png";
|
||||||
|
File file = new File(path);
|
||||||
|
ImageIO.write(image, "png", file);
|
||||||
|
return path;
|
||||||
|
} catch (AWTException | IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
System.out.println("Failed to take screenshot");
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,50 @@
|
||||||
|
package me.night0721.lilase.remotecontrol;
|
||||||
|
|
||||||
|
import me.night0721.lilase.Lilase;
|
||||||
|
import me.night0721.lilase.remotecontrol.events.CommandListener;
|
||||||
|
import me.night0721.lilase.remotecontrol.events.ReadyListener;
|
||||||
|
import net.dv8tion.jda.api.JDA;
|
||||||
|
import net.dv8tion.jda.api.JDABuilder;
|
||||||
|
import net.dv8tion.jda.api.OnlineStatus;
|
||||||
|
import net.dv8tion.jda.api.entities.Activity;
|
||||||
|
import net.dv8tion.jda.api.interactions.commands.OptionType;
|
||||||
|
import net.dv8tion.jda.api.interactions.commands.build.Commands;
|
||||||
|
import net.dv8tion.jda.api.interactions.commands.build.OptionData;
|
||||||
|
|
||||||
|
public class RemoteControl {
|
||||||
|
public JDA bot;
|
||||||
|
|
||||||
|
public RemoteControl() {
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void init() {
|
||||||
|
boolean remoteControl = Lilase.configHandler.getBoolean("RemoteControl");
|
||||||
|
String token = Lilase.configHandler.getString("BotToken");
|
||||||
|
if (!remoteControl) {
|
||||||
|
System.out.println("[Lilase Remote Control] Remote control disabled, skipping");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (token == null || token.equals("")) {
|
||||||
|
System.out.println("[Lilase Remote Control] Bot token not set, disabling remote control");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
System.out.println("[Lilase Remote Control] Enabling remote control bot");
|
||||||
|
JDABuilder jda = JDABuilder.createDefault(token);
|
||||||
|
jda.addEventListeners(new ReadyListener(), new CommandListener());
|
||||||
|
jda.setActivity(Activity.watching("your COFL macro"));
|
||||||
|
jda.setStatus(OnlineStatus.ONLINE);
|
||||||
|
bot = jda.build();
|
||||||
|
|
||||||
|
bot.updateCommands().addCommands(
|
||||||
|
Commands.slash("statistics", "Statistics of current session").setGuildOnly(true),
|
||||||
|
Commands.slash("screenshot", "Take a screenshot of the client"),
|
||||||
|
Commands.slash("enable", "Enable a feature of the mod")
|
||||||
|
.setGuildOnly(true)
|
||||||
|
.addOptions(new OptionData(OptionType.STRING, "type", "The type of feature to turn on")
|
||||||
|
.addChoice("Auto Claimer", "claimer")
|
||||||
|
.addChoice("COFL Macro", "macro")
|
||||||
|
.addChoice("Auto Relister", "relister"))
|
||||||
|
).queue();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,84 @@
|
||||||
|
package me.night0721.lilase.remotecontrol.events;
|
||||||
|
|
||||||
|
import me.night0721.lilase.Lilase;
|
||||||
|
import me.night0721.lilase.remotecontrol.BotUtils;
|
||||||
|
import net.dv8tion.jda.api.EmbedBuilder;
|
||||||
|
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent;
|
||||||
|
import net.dv8tion.jda.api.hooks.ListenerAdapter;
|
||||||
|
import net.dv8tion.jda.api.utils.FileUpload;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
public class CommandListener extends ListenerAdapter {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSlashCommandInteraction(SlashCommandInteractionEvent event) {
|
||||||
|
if (event.getName().equals("statistics")) {
|
||||||
|
event.deferReply().queue();
|
||||||
|
ArrayList<HashMap<String, String>> sold_items = Lilase.cofl.sold_items;
|
||||||
|
ArrayList<HashMap<String, String>> bought_items = Lilase.cofl.bought_items;
|
||||||
|
EmbedBuilder embed = new EmbedBuilder();
|
||||||
|
embed.setAuthor("Lilase", "https://camo.githubusercontent.com/57a8295f890970d2173b895c7a0f6c60527fb3bec4489b233b221ab45cb9fa42/68747470733a2f2f63646e2e646973636f72646170702e636f6d2f6174746163686d656e74732f3834323031343930393236343935333335342f313038323337333237353033383030333231302f6c696c6173652e706e67");
|
||||||
|
embed.setTitle("Current Session Statistics");
|
||||||
|
embed.addField("Auctions sold", String.valueOf(sold_items.size()), true);
|
||||||
|
embed.addField("Auctions bought", String.valueOf(bought_items.size()), true);
|
||||||
|
embed.setTimestamp(event.getTimeCreated());
|
||||||
|
embed.setImage("attachment://image.png");
|
||||||
|
embed.setFooter("Made by night0721", "https://avatars.githubusercontent.com/u/77528305?v=4");
|
||||||
|
FileUpload screenshot = FileUpload.fromData(new File(Objects.requireNonNull(BotUtils.takeScreenShot())), "image.png");
|
||||||
|
event.getHook().editOriginalAttachments(screenshot).queue();
|
||||||
|
event.getHook().editOriginalEmbeds(embed.build()).queue();
|
||||||
|
|
||||||
|
if (sold_items.size() > 0) {
|
||||||
|
EmbedBuilder sold = new EmbedBuilder();
|
||||||
|
sold.setAuthor("Lilase", "https://camo.githubusercontent.com/57a8295f890970d2173b895c7a0f6c60527fb3bec4489b233b221ab45cb9fa42/68747470733a2f2f63646e2e646973636f72646170702e636f6d2f6174746163686d656e74732f3834323031343930393236343935333335342f313038323337333237353033383030333231302f6c696c6173652e706e67");
|
||||||
|
sold.setTitle("Sold Items");
|
||||||
|
sold.setFooter("Made by night0721", "https://avatars.githubusercontent.com/u/77528305?v=4");
|
||||||
|
sold.setTimestamp(event.getTimeCreated());
|
||||||
|
for (HashMap<String, String> sold_item : sold_items) {
|
||||||
|
sold.addField(sold_item.get("item"), "Price: " + sold_item.get("price"), true);
|
||||||
|
}
|
||||||
|
event.getHook().getInteraction().getMessageChannel().sendMessageEmbeds(sold.build()).queue();
|
||||||
|
}
|
||||||
|
if (bought_items.size() > 0) {
|
||||||
|
EmbedBuilder bought = new EmbedBuilder();
|
||||||
|
bought.setAuthor("Lilase", "https://camo.githubusercontent.com/57a8295f890970d2173b895c7a0f6c60527fb3bec4489b233b221ab45cb9fa42/68747470733a2f2f63646e2e646973636f72646170702e636f6d2f6174746163686d656e74732f3834323031343930393236343935333335342f313038323337333237353033383030333231302f6c696c6173652e706e67");
|
||||||
|
bought.setTitle("Bought Items");
|
||||||
|
bought.setFooter("Made by night0721", "https://avatars.githubusercontent.com/u/77528305?v=4");
|
||||||
|
bought.setTimestamp(event.getTimeCreated());
|
||||||
|
for (HashMap<String, String> bought_item : bought_items) {
|
||||||
|
bought.addField(bought_item.get("name"), "Price: " + bought_item.get("price"), true);
|
||||||
|
}
|
||||||
|
event.getHook().getInteraction().getMessageChannel().sendMessageEmbeds(bought.build()).queue();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
if (event.getName().equals("screenshot")) {
|
||||||
|
event.deferReply().queue();
|
||||||
|
FileUpload screenshot = FileUpload.fromData(new File(Objects.requireNonNull(BotUtils.takeScreenShot())), "image.png");
|
||||||
|
event.getHook().editOriginalAttachments(screenshot).queue();
|
||||||
|
}
|
||||||
|
if (event.getName().equals("enable")) {
|
||||||
|
String type = Objects.requireNonNull(event.getOption("type")).getAsString();
|
||||||
|
if (type.equals("claimer")) {
|
||||||
|
if (!Lilase.relister.isOpen()) {
|
||||||
|
Lilase.claimer.toggle();
|
||||||
|
event.getHook().editOriginal("Claimer enabled").queue();
|
||||||
|
} else {
|
||||||
|
event.getHook().editOriginal("Relister is currently running, please stop it first").queue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (type.equals("macro")) {
|
||||||
|
if (!Lilase.cofl.isOpen()) {
|
||||||
|
Lilase.cofl.toggleAuction();
|
||||||
|
event.getHook().editOriginal("Macro enabled").queue();
|
||||||
|
} else {
|
||||||
|
event.getHook().editOriginal("Macro is currently running, please stop it first").queue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
package me.night0721.lilase.remotecontrol.events;
|
||||||
|
|
||||||
|
import net.dv8tion.jda.api.events.GenericEvent;
|
||||||
|
import net.dv8tion.jda.api.events.session.ReadyEvent;
|
||||||
|
import net.dv8tion.jda.api.hooks.EventListener;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
public class ReadyListener implements EventListener {
|
||||||
|
@Override
|
||||||
|
public void onEvent(@NotNull GenericEvent event) {
|
||||||
|
if (event instanceof ReadyEvent){
|
||||||
|
ReadyEvent readyEvent = (ReadyEvent) event;
|
||||||
|
System.out.println("[Lilase Remote Control] " + readyEvent.getJDA().getSelfUser().getName() + " is ready!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -79,6 +79,10 @@ public class InventoryUtils {
|
||||||
clickOpenContainerSlot(slot, 0, 0);
|
clickOpenContainerSlot(slot, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void clickWindow(int window, int slot) {
|
||||||
|
Lilase.mc.playerController.windowClick(window, slot, 0, 0, Lilase.mc.thePlayer);
|
||||||
|
}
|
||||||
|
|
||||||
public static NBTTagList getLore(ItemStack item) {
|
public static NBTTagList getLore(ItemStack item) {
|
||||||
if (item == null) {
|
if (item == null) {
|
||||||
throw new NullPointerException("The item cannot be null!");
|
throw new NullPointerException("The item cannot be null!");
|
||||||
|
|
|
@ -8,12 +8,13 @@ import net.minecraftforge.fml.common.gameevent.InputEvent;
|
||||||
import org.lwjgl.input.Keyboard;
|
import org.lwjgl.input.Keyboard;
|
||||||
|
|
||||||
public class KeyBindingManager {
|
public class KeyBindingManager {
|
||||||
private final KeyBinding[] keyBindings = new KeyBinding[3];
|
private final KeyBinding[] keyBindings = new KeyBinding[4];
|
||||||
|
|
||||||
public void registerKeyBindings() {
|
public void registerKeyBindings() {
|
||||||
keyBindings[0] = new KeyBinding("Sniper Toggle", Keyboard.KEY_M, Lilase.MOD_NAME);
|
keyBindings[0] = new KeyBinding("Sniper Toggle", Keyboard.KEY_M, Lilase.MOD_NAME);
|
||||||
keyBindings[1] = new KeyBinding("Config", Keyboard.KEY_N, Lilase.MOD_NAME);
|
keyBindings[1] = new KeyBinding("Config", Keyboard.KEY_N, Lilase.MOD_NAME);
|
||||||
keyBindings[2] = new KeyBinding("Auto Claimer", Keyboard.KEY_B, Lilase.MOD_NAME);
|
keyBindings[2] = new KeyBinding("Auto Claimer", Keyboard.KEY_B, Lilase.MOD_NAME);
|
||||||
|
keyBindings[3] = new KeyBinding("Auto Relist", Keyboard.KEY_V, Lilase.MOD_NAME);
|
||||||
for (KeyBinding keyBinding : keyBindings) ClientRegistry.registerKeyBinding(keyBinding);
|
for (KeyBinding keyBinding : keyBindings) ClientRegistry.registerKeyBinding(keyBinding);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,6 +30,9 @@ public class KeyBindingManager {
|
||||||
if (keyBindings[2].isPressed()) {
|
if (keyBindings[2].isPressed()) {
|
||||||
Lilase.claimer.toggle();
|
Lilase.claimer.toggle();
|
||||||
}
|
}
|
||||||
|
if (keyBindings[3].isPressed()) {
|
||||||
|
Lilase.relister.toggle();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void rightClick() {
|
public static void rightClick() {
|
||||||
|
|
Loading…
Reference in a new issue