mirror of
https://git.krews.org/morningstar/Arcturus-Community.git
synced 2024-11-23 15:20:52 +01:00
Add reporting photos
This commit is contained in:
parent
f2d1329883
commit
06d8300886
@ -7,7 +7,8 @@ public enum ModToolChatRecordDataContext {
|
||||
ROOM_ID("roomId", 1),
|
||||
GROUP_ID("groupId", 1),
|
||||
THREAD_ID("threadId", 1),
|
||||
MESSAGE_ID("messageId", 1);
|
||||
MESSAGE_ID("messageId", 1),
|
||||
PHOTO_ID("extraDataId", 2);
|
||||
|
||||
public final String key;
|
||||
public final int type;
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.eu.habbo.habbohotel.modtool;
|
||||
|
||||
import com.eu.habbo.Emulator;
|
||||
import com.eu.habbo.habbohotel.users.HabboItem;
|
||||
import com.eu.habbo.messages.ISerialize;
|
||||
import com.eu.habbo.messages.ServerMessage;
|
||||
import com.eu.habbo.threading.runnables.UpdateModToolIssue;
|
||||
@ -28,6 +29,7 @@ public class ModToolIssue implements ISerialize {
|
||||
public int groupId = -1;
|
||||
public int threadId = -1;
|
||||
public int commentId = -1;
|
||||
public HabboItem photoItem = null;
|
||||
|
||||
public ModToolIssue(ResultSet set) throws SQLException {
|
||||
this.id = set.getInt("id");
|
||||
|
@ -468,6 +468,7 @@ public class PacketManager {
|
||||
this.registerHandler(Incoming.ReportFriendPrivateChatEvent, ReportFriendPrivateChatEvent.class);
|
||||
this.registerHandler(Incoming.ReportThreadEvent, ReportThreadEvent.class);
|
||||
this.registerHandler(Incoming.ReportCommentEvent, ReportCommentEvent.class);
|
||||
this.registerHandler(Incoming.ReportPhotoEvent, ReportPhotoEvent.class);
|
||||
}
|
||||
|
||||
void registerTrading() throws Exception {
|
||||
|
@ -292,6 +292,7 @@ public class Incoming {
|
||||
public static final int UpdateUIFlagsEvent = 2313;
|
||||
public static final int ReportThreadEvent = 534;
|
||||
public static final int ReportCommentEvent = 1412;
|
||||
public static final int ReportPhotoEvent = 2492;
|
||||
|
||||
public static final int RequestCraftingRecipesEvent = 1173;
|
||||
public static final int RequestCraftingRecipesAvailableEvent = 3086;
|
||||
|
@ -43,6 +43,12 @@ public class ModToolRequestIssueChatlogEvent extends MessageHandler {
|
||||
chatlog = thread.getComments().stream().map(c -> new ModToolChatLog(c.getCreatedAt(), c.getHabbo().getHabboInfo().getId(), c.getHabbo().getHabboInfo().getUsername(), c.getMessage(), c.getCommentId() == issue.commentId)).collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
} else if (issue.type == ModToolTicketType.PHOTO) {
|
||||
if (issue.photoItem != null) {
|
||||
chatlogType = ModToolIssueChatlogType.PHOTO;
|
||||
|
||||
chatlog = Emulator.getGameEnvironment().getModToolManager().getRoomChatlog(issue.roomId);
|
||||
}
|
||||
} else {
|
||||
chatlogType = ModToolIssueChatlogType.CHAT;
|
||||
|
||||
|
@ -0,0 +1,63 @@
|
||||
package com.eu.habbo.messages.incoming.modtool;
|
||||
|
||||
import com.eu.habbo.Emulator;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionExternalImage;
|
||||
import com.eu.habbo.habbohotel.modtool.CfhTopic;
|
||||
import com.eu.habbo.habbohotel.modtool.ModToolIssue;
|
||||
import com.eu.habbo.habbohotel.modtool.ModToolTicketType;
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.habbohotel.users.HabboInfo;
|
||||
import com.eu.habbo.habbohotel.users.HabboItem;
|
||||
import com.eu.habbo.messages.incoming.MessageHandler;
|
||||
import com.eu.habbo.messages.outgoing.modtool.ModToolReportReceivedAlertComposer;
|
||||
import com.eu.habbo.threading.runnables.InsertModToolIssue;
|
||||
import com.google.gson.JsonParser;
|
||||
|
||||
public class ReportPhotoEvent extends MessageHandler {
|
||||
@Override
|
||||
public void handle() throws Exception {
|
||||
boolean hasExtradataId = this.packet.readShort() != 0;
|
||||
|
||||
this.packet.getBuffer().resetReaderIndex();
|
||||
|
||||
if (hasExtradataId) {
|
||||
String extradataId = this.packet.readString();
|
||||
}
|
||||
|
||||
int roomId = this.packet.readInt();
|
||||
int reportedUserId = this.packet.readInt();
|
||||
int topicId = this.packet.readInt();
|
||||
int itemId = this.packet.readInt();
|
||||
|
||||
CfhTopic topic = Emulator.getGameEnvironment().getModToolManager().getCfhTopic(topicId);
|
||||
|
||||
if (topic == null) return;
|
||||
|
||||
Room room = Emulator.getGameEnvironment().getRoomManager().getRoom(roomId);
|
||||
|
||||
if (room == null) return;
|
||||
|
||||
HabboItem item = room.getHabboItem(itemId);
|
||||
|
||||
if (item == null || !(item instanceof InteractionExternalImage)) return;
|
||||
|
||||
InteractionExternalImage photoItem = (InteractionExternalImage) item;
|
||||
|
||||
String photoCreatorId = new JsonParser().parse(photoItem.getExtradata()).getAsJsonObject().get("u").getAsString();
|
||||
|
||||
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;
|
||||
|
||||
new InsertModToolIssue(issue).run();
|
||||
|
||||
this.client.sendResponse(new ModToolReportReceivedAlertComposer(ModToolReportReceivedAlertComposer.REPORT_RECEIVED, ""));
|
||||
Emulator.getGameEnvironment().getModToolManager().addTicket(issue);
|
||||
Emulator.getGameEnvironment().getModToolManager().updateTicketToMods(issue);
|
||||
}
|
||||
}
|
@ -8,7 +8,6 @@ import com.eu.habbo.messages.outgoing.MessageComposer;
|
||||
import com.eu.habbo.messages.outgoing.Outgoing;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
@ -65,6 +64,14 @@ public class ModToolIssueChatlogComposer extends MessageComposer {
|
||||
ModToolChatRecordDataContext.GROUP_ID.append(this.response);
|
||||
this.response.appendInt(this.issue.commentId);
|
||||
}
|
||||
} else if (this.issue.type == ModToolTicketType.PHOTO) {
|
||||
this.response.appendShort(2);
|
||||
|
||||
ModToolChatRecordDataContext.ROOM_NAME.append(this.response);
|
||||
this.response.appendString(this.roomName);
|
||||
|
||||
ModToolChatRecordDataContext.PHOTO_ID.append(this.response);
|
||||
this.response.appendString(this.issue.photoItem.getId() + "");
|
||||
} else {
|
||||
this.response.appendShort(3); //Context Count
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user