2.0.4
Some checks failed
build-ci / build (push) Has been cancelled

This commit is contained in:
NK 2023-05-23 23:34:24 +01:00
parent 10ed356da9
commit 943e94746f
24 changed files with 395 additions and 219 deletions

10
.github/CHANGELOG.md vendored
View file

@ -54,3 +54,13 @@
- Fixed pricing issue
- Item not found error should be fixed
- Added gui to tell you to update the mod
- v2.0.4
- Remove unecessary code
- Added auto claimer for auction house, can be toggled by "B"
- Changed Sniper shortcut key to "M"
- Changed Config shortcut key to "N"
- Changed pricing to use short format instead of real number so it looks more real
- Used onTick instead of thread in cofl macro
- Added custom listing time, 1, 6, 12, 24, 48 hours
- Adding mod id hide
- Added image to minecraft mod list and oneconfig

10
.github/README.md vendored
View file

@ -48,13 +48,17 @@ For how to use, see **[here](https://github.com/night0721/lilase#how-to-use)**
```json
{
"SendMessageToWebhook": true,
"Webhook": "",
"ReconnectDelay": 20,
"BedSpamDelay": 100,
"OnlySniper": false,
"BedSpam": true,
"SniperMode": 2,
"GUI": true,
"GUI_COLOR": -1,
"SniperMode": true
"Debug": true,
"Webhook": "https://discord.com/api/webhooks/23452345234534/qwe78ruifahsdfauserq8734qewuiasfdhasdoifasdfADSFASDF",
"GUI_COLOR": -16764590,
"RelistTimeout": 1500,
"AuctionLength": 2
}
```

17
.github/faq.json vendored Normal file
View file

@ -0,0 +1,17 @@
{
"content": null,
"embeds": [
{
"title": "Lilase FAQ",
"description": "What is Lilase:\nLilase is a QOL Auction House Mod that is made to auto buy and sell items on the auction house for profit\n\nWhat is Cofl why is it better to buy it:\nCofl is a QOL Auction House mod that tracks and find snipes for the user based on a provided config\n\nWhere can i get Cofl:\nTheir site -> https://sky.coflnet.com/flipper?refId=oedm8r\n\nWhere can I get Cofl Premium:\nhttps://sky.coflnet.com/premium?refId=oedm8r\n\nWhere is showcase of cofl macro:\nhttps://youtu.be/HqYhtSoDGBc\n\nHow to create webhooks:\nhttps://www.youtube.com/watch?v=fKksxz2Gdnc\n\nDoes Lilase have “skip” on the cofl macro:\nYes\n\nWhat is Bed spam and Delay:\nBed spam & Delay is for auctions that just started that have the bed item in the gui to buy\n\nThe sniper isn't buying items/Listing them:\nIf the sniper isn't buying items make sure its actually on (Press end key/rebind in settings on mc), If the sniper isn't listing items make sure sniper only is off if that is off get your log and send it to night (Other sniper mods such as Void can cause issues in sniping make sure if your using lilase that its the only one in the mods folder)\n\nWhere can i get a Cofl config:\nGodflipper: https://discord.gg/godflipper\n\nIs there a paid version of Lilase:\nNo\n\nAre donations accepted:\nYes donations are accepted, dm Night to donate\n\nCan i suggest features to add:\nFeatures can be suggested but make sure they aren't stuff that is already in there\n\nI'm not getting webhook messages:\nMake sure you setup the webhook correctly in the config if so send your log file to night and he can look into it\n\nWill Lilase be able to macro other things in game:\nAt the moment no but that doesn't mean we wont test on other macros such as one for bazzar\n\nWhat is required to run this:\nCofl and forge 1.8.9 + Latest lilase mod file from https://github.com/night0721/Lilase/releases/tag/latest\n\nIs Lilase open source:\nYes lilase is open source the source is located on https://github.com/night0721/Lilase/releases/tag/latest\n\nHow to flip?:\nDownload the latest version of Lilase from https://github.com/night0721/Lilase/releases\nDownload latest version of cofl from https://github.com/Coflnet/SkyblockMod/releases/tag/1.5.2\nPut it into %APPDATA%/.minecraft/mods\nStart forge 1.8.9\nChange any config you like by pressing N (Or any key you changed in settings)\nsave the file and press M key to start COFL sniper(or change it in settings)\nFor example configuration, see https://github.com/night0721/Lilase#example-config \n\nTo get started with sending messages, you need a webhook URL, you can get one via the \"Integrations\" tab in your server's settings. If you're having issues creating a webhook, [the bot](https://discohook.app/bot) can help you create one for you.\n\nKeep in mind that Discohook can't do automation yet, it only sends messages when you tell it to. If you are looking for an automatic feed or custom commands this isn't the right tool for you.",
"url": "https://github.com/night0721/Lilase",
"color": 131642,
"footer": {
"text": "Credits: Alex and Raziel",
"icon_url": "https://avatars.githubusercontent.com/u/77528305?v=4"
},
"timestamp": "2023-05-22T23:00:00.000Z"
}
],
"attachments": []
}

View file

@ -1,6 +1,6 @@
mod_name = Lilase
mod_id = lilase
mod_version = 2.0.3
mod_version = 2.0.4
essential.defaults.loom=0

View file

@ -6,9 +6,10 @@ import cc.polyfrost.oneconfig.libs.eventbus.Subscribe;
import me.night0721.lilase.config.AHConfig;
import me.night0721.lilase.config.ConfigHandler;
import me.night0721.lilase.events.SniperFlipperEvents;
import me.night0721.lilase.features.claimer.Claimer;
import me.night0721.lilase.features.cofl.Cofl;
import me.night0721.lilase.features.sniper.PageFlipper;
import me.night0721.lilase.features.sniper.Sniper;
//import me.night0721.lilase.features.pageflipper.PageFlipper;
import me.night0721.lilase.features.cofl.QueueItem;
import me.night0721.lilase.gui.ImageRenderer;
import me.night0721.lilase.utils.Clock;
import me.night0721.lilase.utils.KeyBindingManager;
@ -31,10 +32,10 @@ import static me.night0721.lilase.config.AHConfig.RECONNECT_DELAY;
public class Lilase {
public static final String MOD_NAME = "Lilase";
public static final String MODID = "Lilase";
public static final String VERSION = "2.0.3";
public static final String VERSION = "2.0.4";
public static final Minecraft mc = Minecraft.getMinecraft();
public static Sniper sniper;
public static PageFlipper pageFlipper;
// public static PageFlipper pageFlipper;
public static Claimer claimer;
public static Cofl cofl;
public static AHConfig config;
public static ConfigHandler configHandler;
@ -47,10 +48,10 @@ public class Lilase {
KeyBindingManager keyBindingManager = new KeyBindingManager();
addToEventBus(this, keyBindingManager, new SniperFlipperEvents(), new ImageRenderer());
EventManager.INSTANCE.register(this);
sniper = new Sniper();
pageFlipper = new PageFlipper();
// pageFlipper = new PageFlipper();
keyBindingManager.registerKeyBindings();
(cofl = new Cofl()).onOpen();
claimer = new Claimer();
}
private void addToEventBus(Object... objects) {
@ -67,7 +68,13 @@ public class Lilase {
if (mc.thePlayer == null || event.phase != TickEvent.Phase.START) return;
tickAmount++;
if (tickAmount % 20 == 0) Utils.checkFooter();
if (pageFlipper != null) pageFlipper.switchStates();
// if (pageFlipper != null) pageFlipper.switchStates();
if (claimer != null) claimer.onTick();
if (cofl.getOpen() && !cofl.queue.isEmpty() && !cofl.queue.isRunning()) {
cofl.queue.setRunning(true);
QueueItem item = cofl.queue.get();
item.openAuction();
}
if (mc.currentScreen instanceof GuiDisconnected && clock.passed()) {
clock.schedule(RECONNECT_DELAY * 1000L);
FMLClientHandler.instance().connectToServer(new GuiMultiplayer(new GuiMainMenu()), new ServerData(" ", "mc.hypixel.net", false));

View file

@ -10,7 +10,7 @@ import me.night0721.lilase.Lilase;
public class AHConfig extends Config {
public AHConfig() {
super(new Mod("Lilase", ModType.UTIL_QOL), "lilase.json");
super(new Mod("Lilase", ModType.SKYBLOCK, "/assets/lilase.png", 100, 100), "lilase.json");
initialize();
addListener("SEND_MESSAGE", () -> Lilase.configHandler.setBoolean("SendMessageToWebhook", SEND_MESSAGE));
addListener("WEBHOOK", () -> Lilase.configHandler.setString("Webhook", WEBHOOK));
@ -20,22 +20,23 @@ public class AHConfig extends Config {
addListener("ONLY_SNIPER", () -> Lilase.configHandler.setBoolean("OnlySniper", ONLY_SNIPER));
addListener("GUI", () -> Lilase.configHandler.setBoolean("GUI", GUI));
addListener("GUI_COLOR", () -> Lilase.configHandler.setInt("GUI_COLOR", GUI_COLOR.getRGB()));
addListener("RELIST_TIMEOUT", () -> Lilase.configHandler.setInt("RELIST_TIMEOUT", Math.round(RELIST_TIMEOUT)));
addListener("RELIST_TIMEOUT", () -> Lilase.configHandler.setInt("RelistTimeout", Math.round(RELIST_TIMEOUT)));
addListener("DEBUG", () -> Lilase.configHandler.setBoolean("Debug", DEBUG));
addListener("AUCTION_LENGTH", () -> Lilase.configHandler.setInt("AuctionLength", Math.round(AUCTION_LENGTH)));
addDependency("WEBHOOK", "SEND_MESSAGE");
addDependency("MINIMUM_PROFIT_PERCENTAGE", "CHECK_PERCENTAGE");
addDependency("MAXIMUM_PROFIT_PERCENTAGE", "CHECK_MAXIMUM_PROFIT");
addDependency("GUI_COLOR", "GUI");
}
@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")
public static boolean BED_SPAM = true;
@Slider(name = "Bed Spam Delay (ms)", min = 50, max = 500, step = 50, category = "Auction House", subcategory = "Sniper", description = "Delay between each bed spam")
@Slider(name = "Bed Spam Delay (ms)", min = 50, max = 500, step = 50, category = "Auction House", subcategory = "Sniper", description = "Delay between each bed spam (milliseconds)")
public static int BED_SPAM_DELAY = 100;
@Number(name = "Relist timeout", min = 1500, max = 60000, step = 500, category = "Auction House", subcategory = "Sniper", description = "Delay between buying and relisting an item")
@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;
@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;
@Switch(name = "Debug", category = "Auction House", subcategory = "Sniper", description = "Debug mode")
public static boolean DEBUG = false;
@ -49,7 +50,7 @@ public class AHConfig extends Config {
@Switch(name = "Send message to webhook", category = "Auction House", subcategory = "Webhook", description = "Send a message to the webhook when an item is bought")
public static boolean SEND_MESSAGE = true;
@Number(name = "Reconnect Delay", min = 5, max = 20, category = "Failsafe", description = "Delay between each reconnect attempt to the server")
@Number(name = "Reconnect Delay(s)", min = 5, max = 20, category = "Failsafe", description = "Delay between each reconnect attempt to the server (seconds)")
public static int RECONNECT_DELAY = 20;
@Checkbox(name = "GUI", category = "GUI", description = "Enable the GUI")

View file

@ -28,8 +28,9 @@ public class ConfigHandler {
if (hasNoKey("OnlySniper")) setBoolean("OnlySniper", false);
if (hasNoKey("GUI")) setBoolean("GUI", true);
if (hasNoKey("GUI_COLOR")) setInt("GUI_COLOR", 0x003153);
if (hasNoKey("DEBUG")) setBoolean("DEBUG", false);
if (hasNoKey("RELIST_TIMEOUT")) setInt("RELIST_TIMEOUT", 1500);
if (hasNoKey("Debug")) setBoolean("Debug", false);
if (hasNoKey("RelistTimeout")) setInt("RelistTimeout", 1500);
if (hasNoKey("AuctionLength")) setInt("AuctionLength", 2);
}
public JsonObject readConfigFile() {

View file

@ -5,7 +5,6 @@ import me.night0721.lilase.config.AHConfig;
import me.night0721.lilase.features.cofl.QueueItem;
import me.night0721.lilase.features.flipper.Flipper;
import me.night0721.lilase.features.flipper.FlipperState;
import me.night0721.lilase.features.sniper.PageFlipperState;
import me.night0721.lilase.gui.TextRenderer;
import me.night0721.lilase.player.EffectState;
import me.night0721.lilase.utils.*;
@ -35,7 +34,7 @@ import java.util.regex.Pattern;
import static me.night0721.lilase.config.AHConfig.*;
import static me.night0721.lilase.features.flipper.Flipper.*;
import static me.night0721.lilase.features.flipper.FlipperState.START;
import static me.night0721.lilase.features.flipper.FlipperState.TIME;
import static me.night0721.lilase.utils.PlayerUtils.sendPacketWithoutEvent;
public class SniperFlipperEvents {
@ -51,6 +50,7 @@ public class SniperFlipperEvents {
// §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];
@ -69,21 +69,24 @@ public class SniperFlipperEvents {
Utils.debugLog("Failed to send webhook");
}
}
Lilase.sniper.incrementAuctionsFlipped();
}
} else if (message.equals("You didn't participate in this auction!")) {
}
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);
} else if (message.equals("You don't have enough coins to afford this bid!")) {
}
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);
} else 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!")) {
}
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;
} else if (message.contains("You were spawned in Limbo")) {
}
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;
@ -171,11 +174,11 @@ public class SniperFlipperEvents {
Flipper.state = FlipperState.NONE;
Lilase.cofl.toggleAuction();
}).start();
} else if (Lilase.pageFlipper.state != PageFlipperState.NONE) {
new Thread(() -> {
Utils.debugLog("[PageFlipper] Interrupting PageFlipper sniping");
Lilase.pageFlipper.toggleAuction();
}).start();
// } else if (Lilase.pageFlipper.state != PageFlipperState.NONE) {
// new Thread(() -> {
// Utils.debugLog("[PageFlipper] Interrupting PageFlipper sniping");
// Lilase.pageFlipper.toggleAuction();
// }).start();
} else if (Lilase.cofl.getOpen()) {
Lilase.cofl.toggleAuction();
}
@ -192,7 +195,7 @@ public class SniperFlipperEvents {
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.sniper.getAuctionsSniped() + "\n" + "Auctions Posted: " + Lilase.sniper.getAuctionsPosted() + "\n" + "Auctions Flipped: " + Lilase.sniper.getAuctionsFlipped() + "\n";
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) {
@ -204,10 +207,25 @@ public class SniperFlipperEvents {
}
private int latestWindowId = -1;
private final Thread spam = new Thread(() -> {
int tries = 0;
try {
while (tries < 50) {
if (clock.passed()) {
clickWindow(latestWindowId, 31);
clickWindow(latestWindowId + 1, 11);
tries++;
clock.schedule(AHConfig.BED_SPAM_DELAY);
}
}
} catch (Exception ignored) {
}
});
@SubscribeEvent
public void onPacketReceive(PacketReceivedEvent event) {
if (AHConfig.BED_SPAM && (Lilase.pageFlipper.getOpen() || Lilase.cofl.getOpen())) {
if (AHConfig.BED_SPAM && Lilase.cofl.getOpen()) {
// if (AHConfig.BED_SPAM && (Lilase.pageFlipper.getOpen() || Lilase.cofl.getOpen())) {
if (event.packet instanceof S2DPacketOpenWindow && ((S2DPacketOpenWindow) event.packet).getGuiId().equals("minecraft:chest")) {
S2DPacketOpenWindow packetOpenWindow = (S2DPacketOpenWindow) event.packet;
if (packetOpenWindow.getWindowTitle().getUnformattedText().equals("BIN Auction View"))
@ -219,18 +237,24 @@ public class SniperFlipperEvents {
if (packetSetSlot.func_149173_d() == 31 && stack != null && packetSetSlot.func_149175_c() == latestWindowId) {
ItemStack itemStack = packetSetSlot.func_149174_e();
Utils.debugLog("Slot 31: " + itemStack.getItem().getRegistryName());
if (itemStack.getItem() == Items.bed && clock.passed()) {
clickWindow(latestWindowId, 31);
clickWindow(latestWindowId + 1, 11);
clock.schedule(AHConfig.BED_SPAM_DELAY);
if (itemStack.getItem() == Items.bed) {
boolean threadStatus = spam.isAlive();
spam.interrupt();
if (!threadStatus) {
spam.start();
}
} else if (itemStack.getItem() == Items.gold_nugget || Item.getItemFromBlock(Blocks.gold_block) == itemStack.getItem()) {
if (spam.isAlive()) {
spam.interrupt();
}
clickWindow(latestWindowId, 31);
clickWindow(latestWindowId + 1, 11);
} else {
Utils.debugLog("Auction was bought by someone else, closing window");
Lilase.mc.thePlayer.closeScreen();
}
} else if (stack != null && packetSetSlot.func_149175_c() == 0) {
} else if (stack != null && packetSetSlot.func_149175_c() == 0 && Lilase.cofl.getOpen()) {
// } else if (stack != null && packetSetSlot.func_149175_c() == 0 && (Lilase.pageFlipper.getOpen() || Lilase.cofl.getOpen())) {
try {
String uuid = stack.getTagCompound().getCompoundTag("ExtraAttributes").getString("uuid");
String uid = uuid.split("-")[4];
@ -260,24 +284,24 @@ public class SniperFlipperEvents {
}
}
}
if (event.packet instanceof S33PacketUpdateSign && (Flipper.state.equals(START) || Lilase.cofl.getQueue().isRunning())) {
if (Utils.cookie == EffectState.ON || (Utils.cookie == EffectState.OFF && Utils.checkInHub()))
new Thread(() -> {
try {
S33PacketUpdateSign packetUpdateSign = (S33PacketUpdateSign) event.packet;
IChatComponent[] lines = packetUpdateSign.getLines();
Utils.debugLog("Target Price: " + selling_queue.get(0).target);
Thread.sleep(300);
lines[0] = IChatComponent.Serializer.jsonToComponent("{\"text\":\"" + selling_queue.get(0).target + "\"}");
sendPacketWithoutEvent(new C12PacketUpdateSign(packetUpdateSign.getPos(), lines));
} catch (RuntimeException | InterruptedException e) {
e.printStackTrace();
}
}).start();
if (event.packet instanceof S33PacketUpdateSign && (Flipper.state == TIME || Lilase.cofl.getQueue().isRunning())) {
if (Utils.cookie == EffectState.ON || (Utils.cookie == EffectState.OFF && Utils.checkInHub())) {
try {
S33PacketUpdateSign packetUpdateSign = (S33PacketUpdateSign) event.packet;
System.out.println("Block Pos: " + packetUpdateSign.getPos());
IChatComponent[] lines = packetUpdateSign.getLines();
Utils.debugLog("Target Price: " + selling_queue.get(0).target, "Shortened Target Price: " + Utils.convertToShort(selling_queue.get(0).target));
Thread.sleep(300);
lines[0] = IChatComponent.Serializer.jsonToComponent("{\"text\":\"" + Utils.convertToShort(selling_queue.get(0).target) + "\"}");
sendPacketWithoutEvent(new C12PacketUpdateSign(packetUpdateSign.getPos(), lines));
} catch (RuntimeException | InterruptedException e) {
e.printStackTrace();
}
}
}
}
public void clickWindow(int window, int slot) {
public static void clickWindow(int window, int slot) {
Lilase.mc.playerController.windowClick(window, slot, 0, 0, Lilase.mc.thePlayer);
}
}

View file

@ -0,0 +1,168 @@
package me.night0721.lilase.features.claimer;
import me.night0721.lilase.Lilase;
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.util.ArrayList;
import java.util.List;
import java.util.Objects;
import static me.night0721.lilase.config.AHConfig.SEND_MESSAGE;
import static me.night0721.lilase.events.SniperFlipperEvents.clickWindow;
import static me.night0721.lilase.features.flipper.Flipper.*;
import static me.night0721.lilase.utils.KeyBindingManager.stopMovement;
public class Claimer extends Sniper {
public ClaimerState state = ClaimerState.NONE;
public List<Integer> toClaim = new ArrayList<>();
@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 = ClaimerState.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 = ClaimerState.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);
}
} else if (Utils.cookie == EffectState.ON) {
if (Lilase.mc.currentScreen != null) Lilase.mc.thePlayer.closeScreen();
else Utils.sendServerMessage("/ah");
} else if (InventoryUtils.inventoryNameContains("Auction House") && cooldown.passed()) {
InventoryUtils.clickOpenContainerSlot(15);
state = ClaimerState.START;
cooldown.schedule(500);
}
case START:
if (InventoryUtils.inventoryNameContains("Manage Auctions") && cooldown.passed()) {
long claiming = 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: Sold")).count();
System.out.println(claiming + " items to claim");
if (claiming == 0) {
Utils.debugLog("No items to claim");
Utils.debugLog("Claimed all sold items");
toClaim.clear();
if (isOpen()) toggle();
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) {
System.out.println("Item NBT: " + ScoreboardUtils.cleanSB(list.toString()));
if (ScoreboardUtils.cleanSB(list.toString()).contains("Status: Sold")) {
toClaim.add(i);
try {
Thread.sleep(300);
clickWindow(Lilase.mc.thePlayer.openContainer.windowId, i);
Thread.sleep(300);
clickWindow(Lilase.mc.thePlayer.openContainer.windowId + 1, 31);
cooldown.schedule(500);
break;
} catch (InterruptedException ignore) {
}
}
}
}
Utils.debugLog("Claimed " + toClaim.size() + " sold items");
state = ClaimerState.OPENING;
} 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 Claimer");
Lilase.mc.thePlayer.closeScreen();
state = ClaimerState.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 (Utils.cookie == EffectState.ON || Utils.checkInHub()) {
Utils.sendMessage("Started Auto Claimer");
setOpen(true);
if (Utils.cookie != EffectState.ON) {
Utils.sendServerMessage("/hub");
state = ClaimerState.WALKING_TO_FIRST_POINT;
} else {
Utils.sendServerMessage("/ah");
state = ClaimerState.OPENING;
}
UngrabUtils.ungrabMouse();
} else {
Utils.sendMessage("Detected not in hub, please go to hub to start");
}
}
}
}

View file

@ -0,0 +1,5 @@
package me.night0721.lilase.features.claimer;
public enum ClaimerState {
NONE, WALKING_TO_FIRST_POINT, WALKING_INTO_AUCTION_HOUSE, OPENING, START
}

View file

@ -2,6 +2,7 @@ package me.night0721.lilase.features.cofl;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import lombok.Getter;
import me.night0721.lilase.Lilase;
import me.night0721.lilase.features.flipper.Flipper;
import me.night0721.lilase.features.flipper.FlipperState;
@ -18,23 +19,19 @@ import static me.night0721.lilase.config.AHConfig.SEND_MESSAGE;
public class Cofl {
public final Queue queue = new Queue();
private boolean open = false;
public final Thread thread = new Thread(() -> {
while (true) {
try {
Thread.sleep(1);
} catch (InterruptedException ignore) {
}
if (getOpen()) {
if (!this.queue.isEmpty()) {
if (!this.queue.isRunning()) {
this.queue.setRunning(true);
QueueItem item = this.queue.get();
item.openAuction();
}
}
}
}
});
public @Getter int auctionsSniped = 0;
public @Getter int auctionsPosted = 0;
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() {
System.setOut(new PrintStream(System.out) {
@ -78,7 +75,8 @@ public class Cofl {
if (getOpen()) {
Utils.sendMessage("Stopped COFL Sniper");
Lilase.mc.thePlayer.closeScreen();
stopThread();
queue.clear();
queue.setRunning(false);
setOpen(false);
UngrabUtils.regrabMouse();
} else {
@ -95,11 +93,8 @@ public class Cofl {
if (Utils.cookie == EffectState.ON || Utils.checkInHub()) {
Utils.sendMessage("Started COFL Sniper");
setOpen(true);
boolean threadStatus = thread.isAlive();
stopThread();
if (!threadStatus) {
thread.start();
}
queue.clear();
queue.setRunning(false);
UngrabUtils.ungrabMouse();
} else {
Utils.sendMessage("Detected not in hub, please go to hub to start");
@ -107,13 +102,6 @@ public class Cofl {
}
}
private void stopThread() {
if (thread.isAlive()) {
queue.clear();
queue.setRunning(false);
thread.interrupt();
}
}
public boolean getOpen() {
return open;

View file

@ -15,8 +15,7 @@ import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.util.Locale;
import static me.night0721.lilase.config.AHConfig.RELIST_TIMEOUT;
import static me.night0721.lilase.config.AHConfig.SEND_MESSAGE;
import static me.night0721.lilase.config.AHConfig.*;
import static me.night0721.lilase.events.SniperFlipperEvents.selling_queue;
// TODO: Fix repeating code (I will do it soon)
@ -33,7 +32,6 @@ public class Flipper {
public static final DecimalFormat df = new DecimalFormat("#.##");
public static final String icon = "https://camo.githubusercontent.com/57a8295f890970d2173b895c7a0f6c60527fb3bec4489b233b221ab45cb9fa42/68747470733a2f2f63646e2e646973636f72646170702e636f6d2f6174746163686d656e74732f3834323031343930393236343935333335342f313038323337333237353033383030333231302f6c696c6173652e706e67";
public Flipper(String name, int price, int target, String uuid) {
this.name = name;
this.price = price;
@ -46,7 +44,7 @@ public class Flipper {
public void sellItem() {
Utils.checkFooter();
Lilase.sniper.incrementAuctionsSniped();
Lilase.cofl.incrementAuctionsSniped();
Utils.sendMessage("Flipper is running, stopping, will resume when flipper is done");
if (Lilase.cofl.getOpen()) Lilase.cofl.toggleAuction();
UngrabUtils.ungrabMouse();
@ -135,13 +133,14 @@ public class Flipper {
buyWait.schedule(1000);
} else if (!InventoryUtils.isStoneButton() && InventoryUtils.isToAuctionItem(this.uuid) && buyWait.passed()) {
InventoryUtils.clickOpenContainerSlot(31);
state = FlipperState.START;
buyWait.schedule(1000);
state = FlipperState.TIME;
buyWait.schedule(3000);
} else if (!InventoryUtils.isStoneButton() && !InventoryUtils.isToAuctionItem(this.uuid) && buyWait.passed()) {
InventoryUtils.clickOpenContainerSlot(13);
buyWait.schedule(1000);
} // TODO: Ternary Expression
} else if (InventoryUtils.inventoryNameContains("Manage Auctions") && buyWait.passed()) {
}
if (InventoryUtils.inventoryNameContains("Manage Auctions") && buyWait.passed()) {
ItemStack slot24 = InventoryUtils.getStackInOpenContainerSlot(24);
ItemStack slot33 = InventoryUtils.getStackInOpenContainerSlot(33);
@ -189,6 +188,16 @@ public class Flipper {
return;
}
}
case TIME:
if (!InventoryUtils.isStoneButton() && InventoryUtils.isToAuctionItem(this.uuid) && InventoryUtils.inventoryNameStartsWith("Create BIN Auction") && buyWait.passed()) {
InventoryUtils.clickOpenContainerSlot(33);
buyWait.schedule(1000);
}
if (InventoryUtils.inventoryNameContains("Auction Duration") && buyWait.passed()) {
InventoryUtils.clickOpenContainerSlot(AUCTION_LENGTH == 0 ? 10 : AUCTION_LENGTH == 1 ? 11 : AUCTION_LENGTH == 2 ? 12 : AUCTION_LENGTH == 3 ? 13 : AUCTION_LENGTH == 4 ? 14 : 12);
state = FlipperState.START;
buyWait.schedule(1000);
}
case START:
if (!InventoryUtils.isStoneButton() && InventoryUtils.isToAuctionItem(this.uuid) && InventoryUtils.inventoryNameStartsWith("Create BIN Auction") && buyWait.passed()) {
InventoryUtils.clickOpenContainerSlot(29);
@ -198,7 +207,7 @@ public class Flipper {
buyWait.schedule(1000);
} else if (InventoryUtils.inventoryNameContains("BIN Auction View") && buyWait.passed()) {
InventoryUtils.clickOpenContainerSlot(49);
Lilase.sniper.incrementAuctionsPosted();
Lilase.cofl.incrementAuctionsPosted();
buyWait.schedule(500);
Lilase.mc.thePlayer.closeScreen();
buyWait.schedule(500);

View file

@ -1,5 +1,5 @@
package me.night0721.lilase.features.flipper;
public enum FlipperState {
WALKING_TO_FIRST_POINT, WALKING_INTO_AUCTION_HOUSE, BUYING, START, NONE
WALKING_TO_FIRST_POINT, WALKING_INTO_AUCTION_HOUSE, BUYING, TIME, START, NONE
}

View file

@ -1,4 +1,4 @@
package me.night0721.lilase.features.sniper;
package me.night0721.lilase.features.pageflipper;
import me.night0721.lilase.Lilase;
import me.night0721.lilase.player.EffectState;

View file

@ -1,4 +1,4 @@
package me.night0721.lilase.features.sniper;
package me.night0721.lilase.features.pageflipper;
public enum PageFlipperState {
NONE, WALKING_TO_FIRST_POINT, WALKING_INTO_AUCTION_HOUSE, OPENING, START

View file

@ -1,34 +1,17 @@
package me.night0721.lilase.features.sniper;
public class Sniper {
private int auctionsSniped = 0;
private int auctionsPosted = 0;
private int auctionsFlipped = 0;
import lombok.*;
import me.night0721.lilase.utils.Clock;
public abstract class Sniper {
public final Clock cooldown = new Clock();
public @Getter @Setter boolean open = false;
public void toggle() {
public int getAuctionsSniped() {
return auctionsSniped;
}
public void incrementAuctionsSniped() {
this.auctionsSniped += 1;
}
public void onTick() {
public int getAuctionsPosted() {
return auctionsPosted;
}
public void incrementAuctionsPosted() {
this.auctionsPosted += 1;
}
public int getAuctionsFlipped() {
return auctionsFlipped;
}
public void incrementAuctionsFlipped() {
this.auctionsFlipped += 1;
}
}

View file

@ -0,0 +1,29 @@
package me.night0721.lilase.mixins;
import me.night0721.lilase.Lilase;
import net.minecraftforge.fml.common.ModContainer;
import net.minecraftforge.fml.common.network.handshake.FMLHandshakeMessage;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import java.util.List;
import java.util.Map;
/*
Credits: RoseGold
*/
@Mixin(value = FMLHandshakeMessage.ModList.class, remap = false)
public class MixinModList {
@Shadow
private Map<String, String> modTags;
@Inject(method = "<init>(Ljava/util/List;)V", at = @At("RETURN"))
private void removeModID(List<ModContainer> modList, CallbackInfo ci) {
if (!Lilase.mc.isIntegratedServerRunning()) {
modTags.remove(Lilase.MODID);
}
}
}

View file

@ -2,22 +2,19 @@ package me.night0721.lilase.utils;
import me.night0721.lilase.Lilase;
import net.minecraft.client.gui.inventory.GuiChest;
import net.minecraft.client.gui.inventory.GuiInventory;
import net.minecraft.inventory.ContainerChest;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.util.StringUtils;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class InventoryUtils { public static boolean isToAuctionItem(String uuid) {
public class InventoryUtils {
public static boolean isToAuctionItem(String uuid) {
ItemStack stack = Lilase.mc.thePlayer.openContainer.getSlot(13).getStack();
if (stack != null && stack.hasTagCompound()) {
return stack.getTagCompound().getCompoundTag("ExtraAttributes").getString("uuid").equals(uuid);
@ -57,14 +54,6 @@ public class InventoryUtils { public static boolean isToAuctionItem(String uuid)
return getInventoryName() != null && getInventoryName().contains(startsWithString);
}
public static void openInventory() {
Lilase.mc.displayGuiScreen(new GuiInventory(Lilase.mc.thePlayer));
}
public static ItemStack getStackInSlot(final int slot) {
return Lilase.mc.thePlayer.inventory.getStackInSlot(slot);
}
public static ItemStack getStackInOpenContainerSlot(final int slot) {
if (Lilase.mc.thePlayer.openContainer.inventorySlots.get(slot).getHasStack())
return Lilase.mc.thePlayer.openContainer.inventorySlots.get(slot).getStack();
@ -75,7 +64,8 @@ public class InventoryUtils { public static boolean isToAuctionItem(String uuid)
for (final Slot slot : Lilase.mc.thePlayer.inventoryContainer.inventorySlots) {
if (slot.getHasStack()) {
final ItemStack is = slot.getStack();
if (is.getTagCompound().getCompoundTag("ExtraAttributes").getString("uuid").equals(id)) return slot.getSlotIndex();
if (is.getTagCompound().getCompoundTag("ExtraAttributes").getString("uuid").equals(id))
return slot.getSlotIndex();
}
}
return -1;
@ -89,77 +79,6 @@ public class InventoryUtils { public static boolean isToAuctionItem(String uuid)
clickOpenContainerSlot(slot, 0, 0);
}
public static int getAvailableHotbarSlot(final String name) {
for (int i = 0; i < 8; ++i) {
final ItemStack is = Lilase.mc.thePlayer.inventory.getStackInSlot(i);
if (is == null || is.getDisplayName().contains(name)) {
return i;
}
}
return -1;
}
public static List<Integer> getAllSlots(final String name) {
final List<Integer> ret = new ArrayList<>();
for (int i = 9; i < 44; ++i) {
final ItemStack is = Lilase.mc.thePlayer.inventoryContainer.inventorySlots.get(i).getStack();
if (is != null && is.getDisplayName().contains(name)) {
ret.add(i);
}
}
return ret;
}
public static int getAmountInHotbar(final String item) {
for (int i = 0; i < 8; ++i) {
final ItemStack is = Lilase.mc.thePlayer.inventory.getStackInSlot(i);
if (is != null && StringUtils.stripControlCodes(is.getDisplayName()).equals(item)) {
return is.stackSize;
}
}
return 0;
}
public static int getItemInHotbar(final String itemName) {
for (int i = 0; i < 8; ++i) {
final ItemStack is = Lilase.mc.thePlayer.inventory.getStackInSlot(i);
if (is != null && StringUtils.stripControlCodes(is.getDisplayName()).contains(itemName)) {
return i;
}
}
return -1;
}
public static List<ItemStack> getInventoryStacks() {
final List<ItemStack> ret = new ArrayList<>();
for (int i = 9; i < 44; ++i) {
final Slot slot = Lilase.mc.thePlayer.inventoryContainer.getSlot(i);
if (slot != null) {
final ItemStack stack = slot.getStack();
if (stack != null) {
ret.add(stack);
}
}
}
return ret;
}
public static List<Slot> getInventorySlots() {
final List<Slot> ret = new ArrayList<>();
for (int i = 9; i < 44; ++i) {
final Slot slot = Lilase.mc.thePlayer.inventoryContainer.getSlot(i);
if (slot != null) {
final ItemStack stack = slot.getStack();
if (stack != null) {
ret.add(slot);
}
}
}
return ret;
}
public static NBTTagList getLore(ItemStack item) {
if (item == null) {
throw new NullPointerException("The item cannot be null!");

View file

@ -8,11 +8,12 @@ import net.minecraftforge.fml.common.gameevent.InputEvent;
import org.lwjgl.input.Keyboard;
public class KeyBindingManager {
private final KeyBinding[] keyBindings = new KeyBinding[2];
private final KeyBinding[] keyBindings = new KeyBinding[3];
public void registerKeyBindings() {
keyBindings[0] = new KeyBinding("Sniper Toggle", Keyboard.KEY_END, Lilase.MOD_NAME);
keyBindings[1] = new KeyBinding("Config", Keyboard.KEY_MULTIPLY, 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[2] = new KeyBinding("Auto Claimer", Keyboard.KEY_B, Lilase.MOD_NAME);
for (KeyBinding keyBinding : keyBindings) ClientRegistry.registerKeyBinding(keyBinding);
}
@ -25,6 +26,9 @@ public class KeyBindingManager {
if (keyBindings[1].isPressed()) {
Lilase.config.openGui();
}
if (keyBindings[2].isPressed()) {
Lilase.claimer.toggle();
}
}
public static void rightClick() {
@ -33,13 +37,6 @@ public class KeyBindingManager {
}
}
public static void leftClick() {
if (!ReflectionUtils.invoke(Lilase.mc, "func_147116_af")) {
ReflectionUtils.invoke(Lilase.mc, "clickMouse");
}
}
public static void updateKeys(boolean forward, boolean back, boolean right, boolean left, boolean attack) {
updateKeys(forward, back, right, left, attack, false, false);
}

View file

@ -108,5 +108,18 @@ public class Utils {
public static void sendServerMessage(String message) {
mc.thePlayer.sendChatMessage(message);
}
public static String convertToShort(int number) {
if (number >= 1_000_000_000) return formatNumber((double) number / 1_000_000_000, "b", 4);
else if (number >= 100_000_000) return formatNumber((double) number / 1_000_000, "m", 4);
else if (number >= 1_000_000) return formatNumber((double) number / 1_000_000, "m", 3);
else if (number >= 1_000) return formatNumber((double) number / 1_000, "k", 3);
else return Integer.toString(number);
}
public static String formatNumber(double number, String suffix, int significantFigures) {
String format = "%." + significantFigures + "g";
return String.format(format, number) + suffix;
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 174 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 173 KiB

View file

@ -9,7 +9,7 @@
"updateUrl": "https://github.com/night0721/Lilase/releases",
"authorList": ["night0721"],
"credits": "JellyLab/FarmHelper",
"logoFile": "lilase.png",
"logoFile": "assets/lilase.png",
"screenshots": [],
"dependencies": []
}

View file

@ -5,6 +5,7 @@
"compatibilityLevel": "JAVA_8",
"minVersion": "0.7.11",
"mixins": [
"MixinModList",
"MixinNetworkManager"
],
"client": [