commit a0072ccd5a5b6bb4e86d61f84dd4c40ab1d7f988 Author: KrewsOrg Date: Tue Jun 11 17:28:20 2019 +0100 Initial Commit diff --git a/.idea/.name b/.idea/.name new file mode 100644 index 0000000..b5bf2f8 --- /dev/null +++ b/.idea/.name @@ -0,0 +1 @@ +arcturusplugin \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..c13476c --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml new file mode 100644 index 0000000..15a15b2 --- /dev/null +++ b/.idea/encodings.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__com_eu_habbo_Habbo_1_16_0.xml b/.idea/libraries/Maven__com_eu_habbo_Habbo_1_16_0.xml new file mode 100644 index 0000000..c9ede76 --- /dev/null +++ b/.idea/libraries/Maven__com_eu_habbo_Habbo_1_16_0.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__com_google_code_gson_gson_2_8_4.xml b/.idea/libraries/Maven__com_google_code_gson_gson_2_8_4.xml new file mode 100644 index 0000000..73b6ba3 --- /dev/null +++ b/.idea/libraries/Maven__com_google_code_gson_gson_2_8_4.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__com_zaxxer_HikariCP_3_1_0.xml b/.idea/libraries/Maven__com_zaxxer_HikariCP_3_1_0.xml new file mode 100644 index 0000000..3f79c94 --- /dev/null +++ b/.idea/libraries/Maven__com_zaxxer_HikariCP_3_1_0.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__io_netty_netty_all_4_1_24_Final.xml b/.idea/libraries/Maven__io_netty_netty_all_4_1_24_Final.xml new file mode 100644 index 0000000..8df40fc --- /dev/null +++ b/.idea/libraries/Maven__io_netty_netty_all_4_1_24_Final.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__io_netty_netty_buffer_4_1_24_Final.xml b/.idea/libraries/Maven__io_netty_netty_buffer_4_1_24_Final.xml new file mode 100644 index 0000000..d9d2a6b --- /dev/null +++ b/.idea/libraries/Maven__io_netty_netty_buffer_4_1_24_Final.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__io_netty_netty_codec_4_1_24_Final.xml b/.idea/libraries/Maven__io_netty_netty_codec_4_1_24_Final.xml new file mode 100644 index 0000000..475d3cc --- /dev/null +++ b/.idea/libraries/Maven__io_netty_netty_codec_4_1_24_Final.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__io_netty_netty_codec_http2_4_1_24_Final.xml b/.idea/libraries/Maven__io_netty_netty_codec_http2_4_1_24_Final.xml new file mode 100644 index 0000000..1bb5d68 --- /dev/null +++ b/.idea/libraries/Maven__io_netty_netty_codec_http2_4_1_24_Final.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__io_netty_netty_codec_http_4_1_24_Final.xml b/.idea/libraries/Maven__io_netty_netty_codec_http_4_1_24_Final.xml new file mode 100644 index 0000000..cd96ec0 --- /dev/null +++ b/.idea/libraries/Maven__io_netty_netty_codec_http_4_1_24_Final.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__io_netty_netty_common_4_1_24_Final.xml b/.idea/libraries/Maven__io_netty_netty_common_4_1_24_Final.xml new file mode 100644 index 0000000..be5b5a3 --- /dev/null +++ b/.idea/libraries/Maven__io_netty_netty_common_4_1_24_Final.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__io_netty_netty_handler_4_1_24_Final.xml b/.idea/libraries/Maven__io_netty_netty_handler_4_1_24_Final.xml new file mode 100644 index 0000000..f73cc10 --- /dev/null +++ b/.idea/libraries/Maven__io_netty_netty_handler_4_1_24_Final.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__io_netty_netty_resolver_4_1_24_Final.xml b/.idea/libraries/Maven__io_netty_netty_resolver_4_1_24_Final.xml new file mode 100644 index 0000000..221f14b --- /dev/null +++ b/.idea/libraries/Maven__io_netty_netty_resolver_4_1_24_Final.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__io_netty_netty_transport_4_1_24_Final.xml b/.idea/libraries/Maven__io_netty_netty_transport_4_1_24_Final.xml new file mode 100644 index 0000000..30a3db4 --- /dev/null +++ b/.idea/libraries/Maven__io_netty_netty_transport_4_1_24_Final.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__joda_time_joda_time_2_9_9.xml b/.idea/libraries/Maven__joda_time_joda_time_2_9_9.xml new file mode 100644 index 0000000..a468f58 --- /dev/null +++ b/.idea/libraries/Maven__joda_time_joda_time_2_9_9.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__mysql_mysql_connector_java_5_1_46.xml b/.idea/libraries/Maven__mysql_mysql_connector_java_5_1_46.xml new file mode 100644 index 0000000..774fddb --- /dev/null +++ b/.idea/libraries/Maven__mysql_mysql_connector_java_5_1_46.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__net_sf_trove4j_trove4j_3_0_3.xml b/.idea/libraries/Maven__net_sf_trove4j_trove4j_3_0_3.xml new file mode 100644 index 0000000..72d4d7e --- /dev/null +++ b/.idea/libraries/Maven__net_sf_trove4j_trove4j_3_0_3.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_apache_commons_commons_lang3_3_7.xml b/.idea/libraries/Maven__org_apache_commons_commons_lang3_3_7.xml new file mode 100644 index 0000000..28edf49 --- /dev/null +++ b/.idea/libraries/Maven__org_apache_commons_commons_lang3_3_7.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_apache_commons_commons_math3_3_6_1.xml b/.idea/libraries/Maven__org_apache_commons_commons_math3_3_6_1.xml new file mode 100644 index 0000000..ebfe0a8 --- /dev/null +++ b/.idea/libraries/Maven__org_apache_commons_commons_math3_3_6_1.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_jsoup_jsoup_1_11_3.xml b/.idea/libraries/Maven__org_jsoup_jsoup_1_11_3.xml new file mode 100644 index 0000000..e0f1c32 --- /dev/null +++ b/.idea/libraries/Maven__org_jsoup_jsoup_1_11_3.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_slf4j_slf4j_api_1_7_25.xml b/.idea/libraries/Maven__org_slf4j_slf4j_api_1_7_25.xml new file mode 100644 index 0000000..20e8163 --- /dev/null +++ b/.idea/libraries/Maven__org_slf4j_slf4j_api_1_7_25.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_slf4j_slf4j_simple_1_7_25.xml b/.idea/libraries/Maven__org_slf4j_slf4j_simple_1_7_25.xml new file mode 100644 index 0000000..8bc862b --- /dev/null +++ b/.idea/libraries/Maven__org_slf4j_slf4j_simple_1_7_25.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..c131721 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,40 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..4eb973c --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml new file mode 100644 index 0000000..e96534f --- /dev/null +++ b/.idea/uiDesigner.xml @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml new file mode 100644 index 0000000..eea95c5 --- /dev/null +++ b/.idea/workspace.xml @@ -0,0 +1,429 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + messageHandler. + + + this. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1558732594090 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1.8 + + + + + + + + \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..7cc7a2b --- /dev/null +++ b/README.md @@ -0,0 +1,9 @@ +Apollyon. +The PNGCamera Replacement. + +RELEASES: LINK +HABBO.SWF DOWNLOAD: LINK + +** Experts Only ** +PATCHED SOURCE HABBO.SWF DOWNLOAD: LINK +HABKIT DOWNLOAD: LINK \ No newline at end of file diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..f307f3d --- /dev/null +++ b/pom.xml @@ -0,0 +1,30 @@ + + + 4.0.0 + + com.eu.habbo + Apollyon + 1 + + + + org.apache.maven.plugins + maven-compiler-plugin + + 7 + 7 + + + + + + + + com.eu.habbo + Habbo + 1.16.0 + + + \ No newline at end of file diff --git a/src/main/java/org/krews/apollyon/Main.java b/src/main/java/org/krews/apollyon/Main.java new file mode 100644 index 0000000..bd9473a --- /dev/null +++ b/src/main/java/org/krews/apollyon/Main.java @@ -0,0 +1,89 @@ +package org.krews.apollyon; +import com.eu.habbo.Emulator; +import com.eu.habbo.habbohotel.users.Habbo; +import com.eu.habbo.messages.PacketManager; +import com.eu.habbo.messages.incoming.Incoming; +import com.eu.habbo.messages.incoming.MessageHandler; +import com.eu.habbo.plugin.EventHandler; +import com.eu.habbo.plugin.EventListener; +import com.eu.habbo.plugin.HabboPlugin; +import com.eu.habbo.plugin.events.emulator.EmulatorLoadedEvent; +import gnu.trove.map.hash.THashMap; +import org.krews.apollyon.incoming.CameraPublishToWebEvent; +import org.krews.apollyon.incoming.CameraPurchaseEvent; +import org.krews.apollyon.incoming.CameraRoomPictureEvent; +import org.krews.apollyon.incoming.CameraRoomThumbnailEvent; +import java.lang.reflect.Field; + +/** + * Apollyon + * The Official Camera Plugin for Morningstar. Credits to John, Beny, Ovflowd, and Alejandro + * @author Krews.org + */ + +public class Main extends HabboPlugin implements EventListener { + + @Override + public void onEnable() throws Exception { + Emulator.getPluginManager().registerEvents(this, this); + + if(Emulator.isReady && !Emulator.isShuttingDown) { + this.onEmulatorLoadedEvent(null); + } + } + + @Override + public boolean hasPermission(Habbo habbo, String string) { + return false; + } + + @Override + public void onDisable() throws Exception { + // put the original packets back + PacketManager packetManager = Emulator.getGameServer().getPacketManager(); + Field f = PacketManager.class.getDeclaredField("incoming"); + f.setAccessible(true); + THashMap> incoming = (THashMap>)f.get(packetManager); + incoming.remove(Incoming.CameraRoomThumbnailEvent); + incoming.remove(Incoming.CameraPublishToWebEvent); + incoming.remove(Incoming.CameraPurchaseEvent); + incoming.remove(Incoming.CameraRoomThumbnailEvent); + Emulator.getGameServer().getPacketManager().registerHandler(Incoming.CameraRoomPictureEvent, CameraRoomPictureEvent.class); + Emulator.getGameServer().getPacketManager().registerHandler(Incoming.CameraPublishToWebEvent, CameraPublishToWebEvent.class); + Emulator.getGameServer().getPacketManager().registerHandler(Incoming.CameraPurchaseEvent, CameraPurchaseEvent.class); + Emulator.getGameServer().getPacketManager().registerHandler(Incoming.CameraRoomThumbnailEvent, CameraRoomThumbnailEvent.class); +} + + + @EventHandler + public void onEmulatorLoadedEvent(EmulatorLoadedEvent e) throws NoSuchFieldException, IllegalArgumentException, IllegalAccessException, Exception { + + // Adds missing sqls if they are not found. + Emulator.getConfig().register("camera.url", "http://yourdomain.com/swfdirectory/camera/"); + Emulator.getConfig().register("imager.location.output.camera", "C:\\yourdirectory\\swfdirectory\\camera\\"); + Emulator.getConfig().register("imager.location.output.thumbnail", "C:\\yourdirectory\\swfdirectory\\camera\\thumbnails\\thumbnail_"); + + PacketManager packetManager = Emulator.getGameServer().getPacketManager(); + Field f = PacketManager.class.getDeclaredField("incoming"); + f.setAccessible(true); + THashMap> incoming = (THashMap>)f.get(packetManager); + + // Removes the current arcturus handlers for these packets + incoming.remove(Incoming.CameraRoomPictureEvent); + incoming.remove(Incoming.CameraPublishToWebEvent); + incoming.remove(Incoming.CameraPurchaseEvent); + incoming.remove(Incoming.CameraRoomThumbnailEvent); + + // Adds the PNGCamera Packet Handlers + Emulator.getGameServer().getPacketManager().registerHandler(Incoming.CameraRoomPictureEvent, CameraRoomPictureEvent.class); + Emulator.getGameServer().getPacketManager().registerHandler(Incoming.CameraPublishToWebEvent, CameraPublishToWebEvent.class); + Emulator.getGameServer().getPacketManager().registerHandler(Incoming.CameraPurchaseEvent, CameraPurchaseEvent.class); + Emulator.getGameServer().getPacketManager().registerHandler(Incoming.CameraRoomThumbnailEvent, CameraRoomThumbnailEvent.class); + + // Send the message to the Emulator that PNGCamera has started. + Emulator.getLogging().logStart("[Apollyon] Apollyon Preview 1 has hijacked the Arcturus Camera packets, and is ready to use!!"); + Emulator.getLogging().logStart("[Apollyon] Please ensure this plugin was downloaded from Krews.org and is the latest version."); + + } + +} diff --git a/src/main/java/org/krews/apollyon/incoming/CameraPublishToWebEvent.java b/src/main/java/org/krews/apollyon/incoming/CameraPublishToWebEvent.java new file mode 100644 index 0000000..8412e2a --- /dev/null +++ b/src/main/java/org/krews/apollyon/incoming/CameraPublishToWebEvent.java @@ -0,0 +1,62 @@ +package org.krews.apollyon.incoming; + +import com.eu.habbo.Emulator; +import com.eu.habbo.messages.incoming.MessageHandler; +import com.eu.habbo.messages.outgoing.camera.CameraPublishWaitMessageComposer; +import com.eu.habbo.messages.outgoing.catalog.NotEnoughPointsTypeComposer; +import com.eu.habbo.plugin.events.users.UserPublishPictureEvent; + +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class CameraPublishToWebEvent extends MessageHandler +{ + + + @Override + public void handle() { + if (this.client.getHabbo().getHabboInfo().getCurrencyAmount(0) < Emulator.getConfig().getInt("camera.price.points.publish")) { + this.client.sendResponse(new NotEnoughPointsTypeComposer(false, true, 0)); + return; + } + if (this.client.getHabbo().getHabboInfo().getPhotoTimestamp() != 0) { + if (!this.client.getHabbo().getHabboInfo().getPhotoJSON().isEmpty()) { + if (this.client.getHabbo().getHabboInfo().getPhotoJSON().contains(this.client.getHabbo().getHabboInfo().getPhotoTimestamp() + "")) { + int timestamp = Emulator.getIntUnixTimestamp(); + + boolean published = false; + int timeDiff = timestamp - this.client.getHabbo().getHabboInfo().getWebPublishTimestamp(); + int wait = 0; + if (timeDiff < Emulator.getConfig().getInt("camera.publish.delay")) { + wait = timeDiff - Emulator.getConfig().getInt("camera.publish.delay"); + } + else { + UserPublishPictureEvent publishPictureEvent = new UserPublishPictureEvent(this.client.getHabbo(), this.client.getHabbo().getHabboInfo().getPhotoURL(), timestamp, this.client.getHabbo().getHabboInfo().getPhotoRoomId()); + if (!Emulator.getPluginManager().fireEvent(publishPictureEvent).isCancelled()) { + try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("INSERT INTO camera_web (user_id, room_id, timestamp, url) VALUES (?, ?, ?, ?)")) { + statement.setInt(1, this.client.getHabbo().getHabboInfo().getId()); + statement.setInt(2, publishPictureEvent.roomId); + statement.setInt(3, publishPictureEvent.timestamp); + statement.setString(4, publishPictureEvent.URL); + statement.execute(); + this.client.getHabbo().getHabboInfo().setWebPublishTimestamp(timestamp); + this.client.getHabbo().givePixels(-Emulator.getConfig().getInt("camera.price.points.publish")); + published = true; + } + catch (SQLException e) + { + Emulator.getLogging().logSQLException(e); + } + } + else { + return; + } + } + + this.client.sendResponse(new CameraPublishWaitMessageComposer(published, wait, published ? this.client.getHabbo().getHabboInfo().getPhotoURL() : "")); + } + } + } + } +} \ No newline at end of file diff --git a/src/main/java/org/krews/apollyon/incoming/CameraPurchaseEvent.java b/src/main/java/org/krews/apollyon/incoming/CameraPurchaseEvent.java new file mode 100644 index 0000000..3a7e21e --- /dev/null +++ b/src/main/java/org/krews/apollyon/incoming/CameraPurchaseEvent.java @@ -0,0 +1,50 @@ +package org.krews.apollyon.incoming; + +import com.eu.habbo.Emulator; +import com.eu.habbo.habbohotel.achievements.AchievementManager; +import com.eu.habbo.habbohotel.catalog.CatalogManager; +import com.eu.habbo.habbohotel.users.HabboItem; +import com.eu.habbo.messages.incoming.MessageHandler; +import com.eu.habbo.messages.outgoing.camera.CameraPurchaseSuccesfullComposer; +import com.eu.habbo.messages.outgoing.catalog.AlertPurchaseFailedComposer; +import com.eu.habbo.messages.outgoing.catalog.NotEnoughPointsTypeComposer; +import com.eu.habbo.messages.outgoing.generic.alerts.HotelWillCloseInMinutesComposer; +import com.eu.habbo.messages.outgoing.inventory.AddHabboItemComposer; +import com.eu.habbo.messages.outgoing.inventory.InventoryRefreshComposer; +import com.eu.habbo.threading.runnables.ShutdownEmulator; + +public class CameraPurchaseEvent extends MessageHandler +{ + @Override + public void handle() { + if (Emulator.getIntUnixTimestamp() - this.client.getHabbo().getHabboStats().lastPurchaseTimestamp >= CatalogManager.PURCHASE_COOLDOWN) { + this.client.getHabbo().getHabboStats().lastPurchaseTimestamp = Emulator.getIntUnixTimestamp(); + if (ShutdownEmulator.timestamp > 0) { + this.client.sendResponse(new HotelWillCloseInMinutesComposer((ShutdownEmulator.timestamp - Emulator.getIntUnixTimestamp()) / 60)); + } else if (this.client.getHabbo().getHabboInfo().getCredits() < Emulator.getConfig().getInt("camera.price.credits") || this.client.getHabbo().getHabboInfo().getCurrencyAmount(0) < Emulator.getConfig().getInt("camera.price.points")) { + this.client.sendResponse(new NotEnoughPointsTypeComposer(this.client.getHabbo().getHabboInfo().getCredits() < Emulator.getConfig().getInt("camera.price.credits"), this.client.getHabbo().getHabboInfo().getCurrencyAmount(0) < Emulator.getConfig().getInt("camera.price.points"), 0)); + } else if (this.client.getHabbo().getHabboInfo().getPhotoTimestamp() != 0) { + HabboItem photoItem = Emulator.getGameEnvironment().getItemManager().createItem(this.client.getHabbo().getHabboInfo().getId(), Emulator.getGameEnvironment().getItemManager().getItem(Emulator.getConfig().getInt("camera.item_id")), 0, 0, this.client.getHabbo().getHabboInfo().getPhotoJSON()); + + if (photoItem != null) { + photoItem.setExtradata(photoItem.getExtradata().replace("%id%", photoItem.getId() + "")); + photoItem.needsUpdate(true); + this.client.getHabbo().getInventory().getItemsComponent().addItem(photoItem); + + this.client.sendResponse(new CameraPurchaseSuccesfullComposer()); + this.client.sendResponse(new AddHabboItemComposer(photoItem)); + this.client.sendResponse(new InventoryRefreshComposer()); + + this.client.getHabbo().giveCredits(-Emulator.getConfig().getInt("camera.price.credits")); + this.client.getHabbo().givePixels(-Emulator.getConfig().getInt("camera.price.points")); + + AchievementManager.progressAchievement(this.client.getHabbo(), Emulator.getGameEnvironment().getAchievementManager().getAchievement("CameraPhotoCount")); + } + } + } + else + { + this.client.sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.SERVER_ERROR).compose()); + } + } +} \ No newline at end of file diff --git a/src/main/java/org/krews/apollyon/incoming/CameraRoomPictureEvent.java b/src/main/java/org/krews/apollyon/incoming/CameraRoomPictureEvent.java new file mode 100644 index 0000000..76c8b7c --- /dev/null +++ b/src/main/java/org/krews/apollyon/incoming/CameraRoomPictureEvent.java @@ -0,0 +1,72 @@ +package org.krews.apollyon.incoming; + +import com.eu.habbo.Emulator; +import com.eu.habbo.habbohotel.catalog.CatalogManager; +import com.eu.habbo.habbohotel.rooms.Room; +import com.eu.habbo.messages.incoming.MessageHandler; +import com.eu.habbo.messages.outgoing.camera.CameraURLComposer; +import com.eu.habbo.messages.outgoing.generic.alerts.GenericAlertComposer; +import io.netty.buffer.ByteBuf; +import io.netty.buffer.ByteBufInputStream; +import javax.imageio.ImageIO; +import java.awt.image.BufferedImage; +import java.io.File; +import java.io.IOException; + +public class CameraRoomPictureEvent extends MessageHandler +{ + @Override + public void handle() { + if (Emulator.getIntUnixTimestamp() - this.client.getHabbo().getHabboStats().lastPurchaseTimestamp >= CatalogManager.PURCHASE_COOLDOWN) { + this.client.getHabbo().getHabboStats().lastPurchaseTimestamp = Emulator.getIntUnixTimestamp(); + if (!this.client.getHabbo().hasPermission("acc_camera")) { + this.client.sendResponse(new GenericAlertComposer(Emulator.getTexts().getValue("camera.permission"))); + return; + } + + Room room = this.client.getHabbo().getHabboInfo().getCurrentRoom(); + + if (room == null) + return; + + final int count = this.packet.readInt(); + + ByteBuf image = this.packet.getBuffer().readBytes(count); + + if (image == null) + return; + this.packet.readString(); + this.packet.readString(); + this.packet.readInt(); + this.packet.readInt(); + int timestamp = Emulator.getIntUnixTimestamp(); + + String URL = this.client.getHabbo().getHabboInfo().getId() + "_" + timestamp + ".png"; + String URL_small = this.client.getHabbo().getHabboInfo().getId() + "_" + timestamp + "_small.png"; + String base = Emulator.getConfig().getValue("camera.url"); + String json = Emulator.getConfig().getValue("camera.extradata").replace("%timestamp%", timestamp + "").replace("%room_id%", room.getId() + "").replace("%url%", base + URL); + this.client.getHabbo().getHabboInfo().setPhotoURL(base + URL); + this.client.getHabbo().getHabboInfo().setPhotoTimestamp(timestamp); + this.client.getHabbo().getHabboInfo().setPhotoRoomId(room.getId()); + this.client.getHabbo().getHabboInfo().setPhotoJSON(json); + BufferedImage theImage = null; + try { + theImage = ImageIO.read(new ByteBufInputStream(image)); + } catch (IOException e) { + e.printStackTrace(); + } + + try { + ImageIO.write(theImage, "png", new File(Emulator.getConfig().getValue("imager.location.output.camera") + URL)); + } catch (IOException e) { + e.printStackTrace(); + } + try { + ImageIO.write(theImage, "png", new File(Emulator.getConfig().getValue("imager.location.output.camera") + URL_small)); + } catch (IOException e) { + e.printStackTrace(); + } + this.client.sendResponse(new CameraURLComposer(URL)); + } + } +} \ No newline at end of file diff --git a/src/main/java/org/krews/apollyon/incoming/CameraRoomThumbnailEvent.java b/src/main/java/org/krews/apollyon/incoming/CameraRoomThumbnailEvent.java new file mode 100644 index 0000000..5694a92 --- /dev/null +++ b/src/main/java/org/krews/apollyon/incoming/CameraRoomThumbnailEvent.java @@ -0,0 +1,63 @@ +package org.krews.apollyon.incoming; + +import com.eu.habbo.Emulator; +import com.eu.habbo.habbohotel.rooms.Room; +import com.eu.habbo.messages.incoming.MessageHandler; +import com.eu.habbo.messages.outgoing.camera.CameraRoomThumbnailSavedComposer; +import com.eu.habbo.messages.outgoing.generic.alerts.GenericAlertComposer; +import io.netty.buffer.ByteBuf; +import io.netty.buffer.ByteBufInputStream; +import javax.imageio.ImageIO; +import java.awt.image.BufferedImage; +import java.io.File; +import java.io.IOException; + +public class CameraRoomThumbnailEvent extends MessageHandler +{ + + @Override + public void handle() { + if (! this.client.getHabbo().hasPermission("acc_camera")) { + this.client.sendResponse(new GenericAlertComposer(Emulator.getTexts().getValue("camera.permission"))); + return; + } + + if (!this.client.getHabbo().getHabboInfo().getCurrentRoom().isOwner(this.client.getHabbo())) + return; + + Room room = this.client.getHabbo().getHabboInfo().getCurrentRoom(); + + if (room == null) + return; + + if (!room.isOwner(this.client.getHabbo()) && !this.client.getHabbo().hasPermission("acc_modtool_ticket_q")) + return; + + final int count = this.packet.readInt(); + + ByteBuf image = this.packet.getBuffer().readBytes(count); + + if(image == null) + return; + + this.packet.readString(); + this.packet.readString(); + this.packet.readInt(); + this.packet.readInt(); + + BufferedImage theImage = null; + try { + theImage = ImageIO.read(new ByteBufInputStream(image)); + } catch (IOException e) { + e.printStackTrace(); + } + + try { + ImageIO.write(theImage, "png", new File(Emulator.getConfig().getValue("imager.location.output.thumbnail") + room.getId() + ".png")); + } catch (IOException e) { + e.printStackTrace(); + } + + this.client.sendResponse(new CameraRoomThumbnailSavedComposer()); + } +} \ No newline at end of file diff --git a/src/main/resources/Apollyon.iml b/src/main/resources/Apollyon.iml new file mode 100644 index 0000000..9ea6452 --- /dev/null +++ b/src/main/resources/Apollyon.iml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/plugin.json b/src/main/resources/plugin.json new file mode 100644 index 0000000..d0e89ae --- /dev/null +++ b/src/main/resources/plugin.json @@ -0,0 +1,5 @@ +{ + "main" : "org.krews.apollyon.Main", + "name" : "Apollyon", + "author" : "www.krews.org" +} \ No newline at end of file diff --git a/src/main/resources/target/Apollyon-1.jar b/src/main/resources/target/Apollyon-1.jar new file mode 100644 index 0000000..608ad21 Binary files /dev/null and b/src/main/resources/target/Apollyon-1.jar differ diff --git a/src/main/resources/target/maven-archiver/pom.properties b/src/main/resources/target/maven-archiver/pom.properties new file mode 100644 index 0000000..cb5916d --- /dev/null +++ b/src/main/resources/target/maven-archiver/pom.properties @@ -0,0 +1,5 @@ +#Generated by Maven +#Tue Jun 11 17:17:24 BST 2019 +version=1 +groupId=com.eu.habbo +artifactId=Apollyon diff --git a/target/Apollyon-1.jar b/target/Apollyon-1.jar new file mode 100644 index 0000000..a97cac2 Binary files /dev/null and b/target/Apollyon-1.jar differ diff --git a/target/classes/Apollyon.iml b/target/classes/Apollyon.iml new file mode 100644 index 0000000..9ea6452 --- /dev/null +++ b/target/classes/Apollyon.iml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/target/classes/org/krews/apollyon/Main.class b/target/classes/org/krews/apollyon/Main.class new file mode 100644 index 0000000..9228483 Binary files /dev/null and b/target/classes/org/krews/apollyon/Main.class differ diff --git a/target/classes/org/krews/apollyon/incoming/CameraPublishToWebEvent.class b/target/classes/org/krews/apollyon/incoming/CameraPublishToWebEvent.class new file mode 100644 index 0000000..09ac57c Binary files /dev/null and b/target/classes/org/krews/apollyon/incoming/CameraPublishToWebEvent.class differ diff --git a/target/classes/org/krews/apollyon/incoming/CameraPurchaseEvent.class b/target/classes/org/krews/apollyon/incoming/CameraPurchaseEvent.class new file mode 100644 index 0000000..47afef8 Binary files /dev/null and b/target/classes/org/krews/apollyon/incoming/CameraPurchaseEvent.class differ diff --git a/target/classes/org/krews/apollyon/incoming/CameraRoomPictureEvent.class b/target/classes/org/krews/apollyon/incoming/CameraRoomPictureEvent.class new file mode 100644 index 0000000..1f3eeb6 Binary files /dev/null and b/target/classes/org/krews/apollyon/incoming/CameraRoomPictureEvent.class differ diff --git a/target/classes/org/krews/apollyon/incoming/CameraRoomThumbnailEvent.class b/target/classes/org/krews/apollyon/incoming/CameraRoomThumbnailEvent.class new file mode 100644 index 0000000..50e2e34 Binary files /dev/null and b/target/classes/org/krews/apollyon/incoming/CameraRoomThumbnailEvent.class differ diff --git a/target/classes/plugin.json b/target/classes/plugin.json new file mode 100644 index 0000000..d0e89ae --- /dev/null +++ b/target/classes/plugin.json @@ -0,0 +1,5 @@ +{ + "main" : "org.krews.apollyon.Main", + "name" : "Apollyon", + "author" : "www.krews.org" +} \ No newline at end of file diff --git a/target/classes/target/Apollyon-1.jar b/target/classes/target/Apollyon-1.jar new file mode 100644 index 0000000..608ad21 Binary files /dev/null and b/target/classes/target/Apollyon-1.jar differ diff --git a/target/classes/target/maven-archiver/pom.properties b/target/classes/target/maven-archiver/pom.properties new file mode 100644 index 0000000..cb5916d --- /dev/null +++ b/target/classes/target/maven-archiver/pom.properties @@ -0,0 +1,5 @@ +#Generated by Maven +#Tue Jun 11 17:17:24 BST 2019 +version=1 +groupId=com.eu.habbo +artifactId=Apollyon diff --git a/target/maven-archiver/pom.properties b/target/maven-archiver/pom.properties new file mode 100644 index 0000000..c1fbcb5 --- /dev/null +++ b/target/maven-archiver/pom.properties @@ -0,0 +1,5 @@ +#Generated by Maven +#Tue Jun 11 17:20:13 BST 2019 +version=1 +groupId=com.eu.habbo +artifactId=Apollyon diff --git a/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst b/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst new file mode 100644 index 0000000..e83837b --- /dev/null +++ b/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst @@ -0,0 +1,5 @@ +org\krews\apollyon\Main.class +org\krews\apollyon\incoming\CameraPurchaseEvent.class +org\krews\apollyon\incoming\CameraPublishToWebEvent.class +org\krews\apollyon\incoming\CameraRoomThumbnailEvent.class +org\krews\apollyon\incoming\CameraRoomPictureEvent.class diff --git a/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst b/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst new file mode 100644 index 0000000..2f20a10 --- /dev/null +++ b/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst @@ -0,0 +1,5 @@ +C:\Users\John\Desktop\PNGCameraMorningStar\src\main\java\org\krews\pngcamera\incoming\CameraPurchaseEvent.java +C:\Users\John\Desktop\PNGCameraMorningStar\src\main\java\org\krews\pngcamera\Main.java +C:\Users\John\Desktop\PNGCameraMorningStar\src\main\java\org\krews\pngcamera\incoming\CameraPublishToWebEvent.java +C:\Users\John\Desktop\PNGCameraMorningStar\src\main\java\org\krews\pngcamera\incoming\CameraRoomThumbnailEvent.java +C:\Users\John\Desktop\PNGCameraMorningStar\src\main\java\org\krews\pngcamera\incoming\CameraRoomPictureEvent.java