From f0a4acf486486c44ab57bdb9f7337245782f37dd Mon Sep 17 00:00:00 2001 From: KrewsOrg Date: Mon, 29 Apr 2019 01:43:05 +0100 Subject: [PATCH] Fixed Marketplace Query --- src/main/java/com/eu/habbo/Emulator.java | 26 +++++++++-------- .../catalog/marketplace/MarketPlace.java | 29 ++++--------------- 2 files changed, 19 insertions(+), 36 deletions(-) diff --git a/src/main/java/com/eu/habbo/Emulator.java b/src/main/java/com/eu/habbo/Emulator.java index e3b16c39..8d874727 100644 --- a/src/main/java/com/eu/habbo/Emulator.java +++ b/src/main/java/com/eu/habbo/Emulator.java @@ -126,11 +126,12 @@ public final class Emulator Emulator.rconServer.initializePipeline(); Emulator.rconServer.connect(); Emulator.badgeImager = new BadgeImager(); - if (Emulator.getConfig().getBoolean("camera.enabled")) + // Removed Wesleys Camera Server lol. + /* if (Emulator.getConfig().getBoolean("camera.enabled")) { Emulator.getThreading().run(new CameraClientAutoReconnect()); } - + */ Emulator.getLogging().logStart("Habbo Hotel Emulator has succesfully loaded."); Emulator.getLogging().logStart("You're running: " + Emulator.version); Emulator.getLogging().logStart("System launched in: " + (System.nanoTime() - startTime) / 1e6 + "ms. Using: " + (Runtime.getRuntime().availableProcessors() * 2) + " threads!"); @@ -162,8 +163,8 @@ public final class Emulator @Override public void run() { - Emulator.getLogging().logStart("Thanks for using Arcturus. Contact: Skype: wesley.jabbo Discord: TheGeneral#0063"); - Emulator.getLogging().logStart("-The General"); + Emulator.getLogging().logStart("This is not an official arcturus build. This is a community forked version released under the GPL License. You are breaking no laws by using this software... Except for copyright infringement from sulake i suppose... oopsie."); + Emulator.getLogging().logStart("- Krews.org Team"); System.out.println("Waiting for command: "); } }, 3500); @@ -458,12 +459,13 @@ public final class Emulator } private static final String logo = - " _ ______ _ _ _ \n" + - " /\\ | | | ____| | | | | | |\n" + - " / \\ _ __ ___| |_ _ _ _ __ _ _ ___ | |__ _ __ ___ _ _| | __ _| |_ ___ _ __| |\n" + - " / /\\ \\ | '__/ __| __| | | | '__| | | / __| | __| | '_ ` _ \\| | | | |/ _` | __/ _ \\| '__| |\n" + - " / ____ \\| | | (__| |_| |_| | | | |_| \\__ \\ | |____| | | | | | |_| | | (_| | || (_) | | |_|\n" + - " /_/ \\_\\_| \\___|\\__|\\__,_|_| \\__,_|___/ |______|_| |_| |_|\\__,_|_|\\__,_|\\__\\___/|_| (_)\n" + - " \n" + - " "; + + " \n" + + " __ ___ _ ARCTURUS __ \n" + + " / |/ /___ _________ (_)___ ____ ______/ /_____ ______ \n" + + " / /|_/ / __ \\/ ___/ __ \\/ / __ \\/ __ `/ ___/ __/ __ `/ ___/ \n" + + " / / / / /_/ / / / / / / / / / / /_/ (__ ) /_/ /_/ / / \n" + + "/_/ /_/\\____/_/ /_/ /_/_/_/ /_/\\__, /____/\\__/\\__,_/_/ \n" + + " /____/ Love You Wesley x \n" + + " \n" ; } \ No newline at end of file diff --git a/src/main/java/com/eu/habbo/habbohotel/catalog/marketplace/MarketPlace.java b/src/main/java/com/eu/habbo/habbohotel/catalog/marketplace/MarketPlace.java index 598c191b..711386ff 100644 --- a/src/main/java/com/eu/habbo/habbohotel/catalog/marketplace/MarketPlace.java +++ b/src/main/java/com/eu/habbo/habbohotel/catalog/marketplace/MarketPlace.java @@ -131,30 +131,10 @@ public class MarketPlace } - public static List getOffers(int minPrice, int maxPrice, String search, int sort) - { - List offers = new ArrayList<>(10); - - //String query = "SELECT items_base.type AS type, items.item_id AS base_item_id, items.limited_data AS ltd_data, marketplace_items.*, COUNT(*) as number, AVG(price) as avg, MIN(price) as minPrice FROM marketplace_items INNER JOIN items ON marketplace_items.item_id = items.id INNER JOIN items_base ON items.item_id = items_base.id WHERE state = ? AND timestamp >= ?"; - - - String query = "SELECT " + - "B.* FROM marketplace_items a " + - "INNER JOIN (" + - "SELECT " + - "items.item_id AS base_item_id, " + - "items.limited_data AS ltd_data, " + - "marketplace_items.*, " + - "AVG(price) as avg, " + - "MIN(marketplace_items.price) as minPrice, " + - "MAX(marketplace_items.price) as maxPrice, " + - "COUNT(*) as number, " + - //"SUM(DATE(from_unixtime(timestamp)) >= (NOW() - INTERVAL 1 DAY)) as offer_count_today, " + - "(SELECT COUNT(*) FROM marketplace_items c INNER JOIN items as items_b ON c.item_id = items_b.id WHERE state = 2 AND items_b.item_id = base_item_id AND DATE(from_unixtime(sold_timestamp)) = CURDATE()) as sold_count_today " + - "FROM marketplace_items " + - "INNER JOIN items ON marketplace_items.item_id = items.id " + - "WHERE state = 1 AND timestamp > ?"; - if(minPrice > 0) + public static List getOffers(int minPrice, int maxPrice, String search, int sort) { + List offers = new ArrayList(10); + String query = "SELECT B.* FROM marketplace_items a INNER JOIN (SELECT b.item_id AS base_item_id, b.limited_data AS ltd_data, marketplace_items.*, AVG(price) as avg, MIN(marketplace_items.price) as minPrice, MAX(marketplace_items.price) as maxPrice, COUNT(*) as number, (SELECT COUNT(*) FROM marketplace_items c INNER JOIN items as items_b ON c.item_id = items_b.id WHERE state = 2 AND items_b.item_id = base_item_id AND DATE(from_unixtime(sold_timestamp)) = CURDATE()) as sold_count_today FROM marketplace_items INNER JOIN items b ON marketplace_items.item_id = b.id WHERE price = (SELECT MIN(e.price) FROM marketplace_items e, items d WHERE e.item_id = d.id AND d.item_id = b.item_id AND e.state = 1 AND e.timestamp > ? GROUP BY d.item_id, d.limited_data) AND state = 1 AND timestamp > ?"; + if (minPrice > 0) { query += " AND CEIL(price + (price / 100)) >= " + minPrice; } @@ -201,6 +181,7 @@ public class MarketPlace try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement(query)) { statement.setInt(1, Emulator.getIntUnixTimestamp() - 172800); + statement.setInt(2, Emulator.getIntUnixTimestamp() - 172800); if(search.length() > 0) statement.setString(3, "%"+search+"%");