mirror of
https://git.krews.org/morningstar/Arcturus-Community.git
synced 2024-11-22 15:00:52 +01:00
Fix photo reporting
This commit is contained in:
parent
4f351b04ee
commit
e1595b7044
@ -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`;
|
||||
|
@ -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 = "";
|
||||
|
@ -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();
|
||||
|
||||
|
@ -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()) {
|
||||
|
Loading…
Reference in New Issue
Block a user