2018-07-06 13:30:00 +00:00
|
|
|
package com.eu.habbo.habbohotel.modtool;
|
|
|
|
|
|
|
|
import com.eu.habbo.Emulator;
|
2019-07-21 20:16:27 +03:00
|
|
|
import com.eu.habbo.habbohotel.users.HabboItem;
|
2018-07-06 13:30:00 +00:00
|
|
|
import com.eu.habbo.messages.ISerialize;
|
|
|
|
import com.eu.habbo.messages.ServerMessage;
|
|
|
|
import com.eu.habbo.threading.runnables.UpdateModToolIssue;
|
|
|
|
|
|
|
|
import java.sql.ResultSet;
|
|
|
|
import java.sql.SQLException;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
2019-05-26 21:14:53 +03:00
|
|
|
public class ModToolIssue implements ISerialize {
|
2018-07-06 13:30:00 +00:00
|
|
|
public int id;
|
|
|
|
public volatile ModToolTicketState state;
|
2019-03-18 01:22:00 +00:00
|
|
|
public volatile ModToolTicketType type;
|
2018-07-06 13:30:00 +00:00
|
|
|
public int category;
|
|
|
|
public int timestamp;
|
|
|
|
public volatile int priority;
|
|
|
|
public int reportedId;
|
2019-03-18 01:22:00 +00:00
|
|
|
public String reportedUsername;
|
2018-07-06 13:30:00 +00:00
|
|
|
public int roomId;
|
|
|
|
public int senderId;
|
2019-03-18 01:22:00 +00:00
|
|
|
public String senderUsername;
|
2018-07-06 13:30:00 +00:00
|
|
|
public volatile int modId = -1;
|
|
|
|
public volatile String modName = "";
|
2019-03-18 01:22:00 +00:00
|
|
|
public String message;
|
2018-07-06 13:30:00 +00:00
|
|
|
public ArrayList<ModToolChatLog> chatLogs = null;
|
2019-05-30 21:05:25 +03:00
|
|
|
public int groupId = -1;
|
|
|
|
public int threadId = -1;
|
|
|
|
public int commentId = -1;
|
2019-07-21 20:16:27 +03:00
|
|
|
public HabboItem photoItem = null;
|
2018-07-06 13:30:00 +00:00
|
|
|
|
2019-05-26 21:14:53 +03:00
|
|
|
public ModToolIssue(ResultSet set) throws SQLException {
|
2018-07-06 13:30:00 +00:00
|
|
|
this.id = set.getInt("id");
|
|
|
|
this.state = ModToolTicketState.getState(set.getInt("state"));
|
|
|
|
this.timestamp = set.getInt("timestamp");
|
|
|
|
this.priority = set.getInt("score");
|
|
|
|
this.senderId = set.getInt("sender_id");
|
|
|
|
this.senderUsername = set.getString("sender_username");
|
|
|
|
this.reportedId = set.getInt("reported_id");
|
|
|
|
this.reportedUsername = set.getString("reported_username");
|
|
|
|
this.message = set.getString("issue");
|
|
|
|
this.modId = set.getInt("mod_id");
|
|
|
|
this.modName = set.getString("mod_username");
|
|
|
|
this.type = ModToolTicketType.values()[set.getInt("type") - 1];
|
|
|
|
this.category = set.getInt("category");
|
|
|
|
|
2019-05-26 21:14:53 +03:00
|
|
|
if (this.modId <= 0) {
|
2018-07-06 13:30:00 +00:00
|
|
|
this.modName = "";
|
|
|
|
this.state = ModToolTicketState.OPEN;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-05-26 21:14:53 +03:00
|
|
|
public ModToolIssue(int senderId, String senderUserName, int reportedId, String reportedUsername, int reportedRoomId, String message, ModToolTicketType type) {
|
2018-07-06 13:30:00 +00:00
|
|
|
this.state = ModToolTicketState.OPEN;
|
|
|
|
this.timestamp = Emulator.getIntUnixTimestamp();
|
|
|
|
this.priority = 0;
|
|
|
|
this.senderId = senderId;
|
|
|
|
this.senderUsername = senderUserName;
|
|
|
|
this.reportedUsername = reportedUsername;
|
|
|
|
this.reportedId = reportedId;
|
|
|
|
this.roomId = reportedRoomId;
|
|
|
|
this.message = message;
|
|
|
|
this.type = type;
|
|
|
|
this.category = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2019-05-26 21:14:53 +03:00
|
|
|
public void serialize(ServerMessage message) {
|
2018-07-06 13:30:00 +00:00
|
|
|
message.appendInt(this.id); //ID
|
|
|
|
message.appendInt(this.state.getState()); //STATE
|
|
|
|
message.appendInt(this.type.getType()); //TYPE
|
|
|
|
message.appendInt(this.category); //CATEGORY ID
|
|
|
|
message.appendInt(((Emulator.getIntUnixTimestamp() - this.timestamp))); //TIME IN MS AGO
|
|
|
|
message.appendInt(this.priority); //PRIORITY
|
2018-09-28 19:25:00 +00:00
|
|
|
message.appendInt(1);
|
2018-07-06 13:30:00 +00:00
|
|
|
message.appendInt(this.senderId); //Reporter user ID
|
|
|
|
message.appendString(this.senderUsername); //Reporter user name.
|
|
|
|
message.appendInt(this.reportedId); //Reported user ID.
|
|
|
|
message.appendString(this.reportedUsername); //Reported user name.
|
|
|
|
message.appendInt(this.modId); //MOD User ID?
|
|
|
|
message.appendString(this.modName); //MOD User name?
|
|
|
|
message.appendString(this.message);
|
|
|
|
message.appendInt(0);
|
|
|
|
|
2019-05-26 21:14:53 +03:00
|
|
|
if (this.chatLogs != null) {
|
2018-07-06 13:30:00 +00:00
|
|
|
message.appendInt(this.chatLogs.size());
|
2019-05-26 21:14:53 +03:00
|
|
|
for (ModToolChatLog chatLog : this.chatLogs) {
|
2018-07-06 13:30:00 +00:00
|
|
|
message.appendString(chatLog.message);
|
|
|
|
message.appendInt(0);
|
|
|
|
message.appendInt(chatLog.message.length());
|
|
|
|
}
|
2019-05-26 21:14:53 +03:00
|
|
|
} else {
|
2018-07-06 13:30:00 +00:00
|
|
|
message.appendInt(0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-05-26 21:14:53 +03:00
|
|
|
public void updateInDatabase() {
|
2018-07-06 13:30:00 +00:00
|
|
|
Emulator.getThreading().run(new UpdateModToolIssue(this));
|
|
|
|
}
|
|
|
|
}
|