diff --git a/sqlupdates/2_3_0-RC-1_TO_2_3_0-RC-2.sql b/sqlupdates/2_3_0-RC-1_TO_2_3_0-RC-2.sql index 66bbf938..c1280901 100644 --- a/sqlupdates/2_3_0-RC-1_TO_2_3_0-RC-2.sql +++ b/sqlupdates/2_3_0-RC-1_TO_2_3_0-RC-2.sql @@ -18,3 +18,6 @@ CREATE TABLE `guild_forum_views` ( `timestamp` int(11) NOT NULL, PRIMARY KEY (`id`) ); + +ALTER TABLE `support_tickets` +ADD COLUMN `photo_item_id` int(11) NOT NULL DEFAULT -1 AFTER `comment_id`; diff --git a/src/main/java/com/eu/habbo/habbohotel/modtool/ModToolIssue.java b/src/main/java/com/eu/habbo/habbohotel/modtool/ModToolIssue.java index 3d2437e0..14a0b737 100644 --- a/src/main/java/com/eu/habbo/habbohotel/modtool/ModToolIssue.java +++ b/src/main/java/com/eu/habbo/habbohotel/modtool/ModToolIssue.java @@ -45,6 +45,15 @@ public class ModToolIssue implements ISerialize { this.modName = set.getString("mod_username"); this.type = ModToolTicketType.values()[set.getInt("type") - 1]; this.category = set.getInt("category"); + this.groupId = set.getInt("group_id"); + this.threadId = set.getInt("thread_id"); + this.commentId = set.getInt("comment_id"); + + int photoItemId = set.getInt("photo_item_id"); + + if (photoItemId != -1) { + this.photoItem = Emulator.getGameEnvironment().getItemManager().loadHabboItem(photoItemId);; + } if (this.modId <= 0) { this.modName = ""; diff --git a/src/main/java/com/eu/habbo/messages/incoming/modtool/ReportPhotoEvent.java b/src/main/java/com/eu/habbo/messages/incoming/modtool/ReportPhotoEvent.java index 04b75b4f..c929941a 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/modtool/ReportPhotoEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/modtool/ReportPhotoEvent.java @@ -41,18 +41,12 @@ public class ReportPhotoEvent extends MessageHandler { if (item == null || !(item instanceof InteractionExternalImage)) return; - InteractionExternalImage photoItem = (InteractionExternalImage) item; + HabboInfo photoOwner = Emulator.getGameEnvironment().getHabboManager().getHabboInfo(item.getUserId()); - String photoCreatorId = new JsonParser().parse(photoItem.getExtradata()).getAsJsonObject().get("u").getAsString(); + if (photoOwner == null) return; - if (photoCreatorId == null) return; - - HabboInfo photoCreator = Emulator.getGameEnvironment().getHabboManager().getHabboInfo(Integer.valueOf(photoCreatorId)); - - if (photoCreator == null) return; - - ModToolIssue issue = new ModToolIssue(this.client.getHabbo().getHabboInfo().getId(), this.client.getHabbo().getHabboInfo().getUsername(), photoCreator.getId(), photoCreator.getUsername(), roomId, "", ModToolTicketType.PHOTO); - issue.photoItem = photoItem; + ModToolIssue issue = new ModToolIssue(this.client.getHabbo().getHabboInfo().getId(), this.client.getHabbo().getHabboInfo().getUsername(), photoOwner.getId(), photoOwner.getUsername(), roomId, "", ModToolTicketType.PHOTO); + issue.photoItem = item; new InsertModToolIssue(issue).run(); diff --git a/src/main/java/com/eu/habbo/threading/runnables/InsertModToolIssue.java b/src/main/java/com/eu/habbo/threading/runnables/InsertModToolIssue.java index af335844..b1af7db2 100644 --- a/src/main/java/com/eu/habbo/threading/runnables/InsertModToolIssue.java +++ b/src/main/java/com/eu/habbo/threading/runnables/InsertModToolIssue.java @@ -14,7 +14,7 @@ public class InsertModToolIssue implements Runnable { @Override public void run() { - try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("INSERT INTO support_tickets (state, timestamp, score, sender_id, reported_id, room_id, mod_id, issue, category, group_id, thread_id, comment_id) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", Statement.RETURN_GENERATED_KEYS)) { + try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("INSERT INTO support_tickets (state, timestamp, score, sender_id, reported_id, room_id, mod_id, issue, category, group_id, thread_id, comment_id, photo_item_id) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", Statement.RETURN_GENERATED_KEYS)) { statement.setInt(1, this.issue.state.getState()); statement.setInt(2, this.issue.timestamp); statement.setInt(3, this.issue.priority); @@ -27,6 +27,7 @@ public class InsertModToolIssue implements Runnable { statement.setInt(10, this.issue.groupId); statement.setInt(11, this.issue.threadId); statement.setInt(12, this.issue.commentId); + statement.setInt(13, this.issue.photoItem != null ? this.issue.photoItem.getId() : -1); statement.execute(); try (ResultSet key = statement.getGeneratedKeys()) {