Browse Source

Class cleanup.

master
MagicBot 1 year ago
parent
commit
6e3dd55804
  1. 20
      src/engine/net/client/handlers/PetitionReceivedMsgHandler.java
  2. 196
      src/engine/net/client/msg/PetitionReceivedMsg.java
  3. 6
      src/engine/objects/Petition.java

20
src/engine/net/client/handlers/PetitionReceivedMsgHandler.java

@ -1,11 +1,15 @@
package engine.net.client.handlers; package engine.net.client.handlers;
import engine.Enum;
import engine.exception.MsgSendException; import engine.exception.MsgSendException;
import engine.gameManager.DbManager; import engine.gameManager.DbManager;
import engine.net.Dispatch;
import engine.net.DispatchMessage;
import engine.net.client.ClientConnection; import engine.net.client.ClientConnection;
import engine.net.client.msg.ClientNetMsg; import engine.net.client.msg.ClientNetMsg;
import engine.net.client.msg.PetitionReceivedMsg; import engine.net.client.msg.PetitionReceivedMsg;
import engine.objects.Petition; import engine.objects.Petition;
import engine.objects.PlayerCharacter;
public class PetitionReceivedMsgHandler extends AbstractClientMsgHandler { public class PetitionReceivedMsgHandler extends AbstractClientMsgHandler {
@ -15,11 +19,19 @@ public class PetitionReceivedMsgHandler extends AbstractClientMsgHandler {
@Override @Override
protected boolean _handleNetMsg(ClientNetMsg msg, ClientConnection origin) throws MsgSendException { protected boolean _handleNetMsg(ClientNetMsg msg, ClientConnection origin) throws MsgSendException {
if (msg == null) if (msg == null)
return false; return true;
PetitionReceivedMsg petitionReceivedMsg = (PetitionReceivedMsg) msg;
if (origin == null) if (origin == null)
return false; return true;
PlayerCharacter playerCharacter = origin.getPlayerCharacter();
if (playerCharacter == null)
return true;
Petition petition = new Petition(msg, origin); Petition petition = new Petition(msg, origin);
@ -27,7 +39,11 @@ public class PetitionReceivedMsgHandler extends AbstractClientMsgHandler {
return false; return false;
try { try {
petitionReceivedMsg.petition = 2;
DbManager.PetitionQueries.WRITE_PETITION_TO_TABLE(petition); DbManager.PetitionQueries.WRITE_PETITION_TO_TABLE(petition);
Dispatch dispatch = Dispatch.borrow(playerCharacter, msg);
DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.SECONDARY);
} catch (Exception e) { } catch (Exception e) {
return false; return false;
} }

196
src/engine/net/client/msg/PetitionReceivedMsg.java

@ -19,50 +19,23 @@ import engine.net.client.Protocol;
public class PetitionReceivedMsg extends ClientNetMsg { public class PetitionReceivedMsg extends ClientNetMsg {
// TODO pull these statics out into SBEmuStatics.java // TODO pull these statics out into SBEmuStatics.java
private static final int PETITION_NEW = 1; public static final int PETITION_NEW = 1;
private static final int PETITION_CANCEL = 2; public static final int PETITION_CANCEL = 2;
private static final int TYPE_GENERAL_HELP = 1; public int petition;
private static final int TYPE_FEEDBACK = 2; public int unknown01;
private static final int TYPE_STUCK = 3; public int unknown02;
private static final int TYPE_HARASSMENT = 4; public byte unknownByte01;
private static final int TYPE_EXPLOIT = 5; public int unknown03;
private static final int TYPE_BUG = 6; public int unknown04;
private static final int TYPE_GAME_STOPPER = 7; public int unknown05;
private static final int TYPE_TECH_SUPPORT = 8; public int unknown06;
public int type;
private static final int SUBTYPE_EXPLOIT_DUPE = 1; public int subType;
private static final int SUBTYPE_EXPLOIT_LEVELING = 2; public String compType;
private static final int SUBTYPE_EXPLOIT_SKILL_GAIN = 3; public String language;
private static final int SUBTYPE_EXPLOIT_KILLING = 4; public int unknown07;
private static final int SUBTYPE_EXPLOIT_POLICY = 5; public String message;
private static final int SUBTYPE_EXPLOIT_OTHER = 6;
private static final int SUBTYPE_TECH_VIDEO = 7;
private static final int SUBTYPE_TECH_SOUND = 8;
private static final int SUBTYPE_TECH_NETWORK = 9;
private static final int SUBTYPE_TECH_OTHER = 10;
private int petition;
private int unknown01;
private int unknown02;
private byte unknownByte01;
private int unknown03;
private int unknown04;
private int unknown05;
private int unknown06;
private int type;
private int subType;
private String compType;
private String language;
private int unknown07;
private String message;
/**
* This is the general purpose constructor.
*/
public PetitionReceivedMsg() {
super(Protocol.CUSTOMERPETITION);
}
/** /**
* This constructor is used by NetMsgFactory. It attempts to deserialize the * This constructor is used by NetMsgFactory. It attempts to deserialize the
@ -132,139 +105,4 @@ public class PetitionReceivedMsg extends ClientNetMsg {
} }
} }
/**
* @return the petition
*/
public int getPetition() {
return petition;
}
/**
* @param petition the petition to set
*/
public void setPetition(int petition) {
this.petition = petition;
}
/**
* @return the type
*/
public int getType() {
return type;
}
/**
* @param type the type to set
*/
public void setType(int type) {
this.type = type;
}
/**
* @return the subType
*/
public int getSubType() {
return subType;
}
/**
* @param subType the subType to set
*/
public void setSubType(int subType) {
this.subType = subType;
}
/**
* @return the message
*/
public String getMessage() {
return message;
}
/**
* @param message the message to set
*/
public void setMessage(String message) {
this.message = message;
}
public int getUnknown01() {
return this.unknown01;
}
public void setUnknown01(int value) {
this.unknown01 = value;
}
public int getUnknown02() {
return this.unknown02;
}
public void setUnknown02(int value) {
this.unknown02 = value;
}
public int getUnknown03() {
return this.unknown03;
}
public void setUnknown03(int value) {
this.unknown03 = value;
}
public int getUnknown04() {
return this.unknown04;
}
public void setUnknown04(int value) {
this.unknown04 = value;
}
public int getUnknown05() {
return this.unknown05;
}
public void setUnknown05(int value) {
this.unknown05 = value;
}
public int getUnknown06() {
return this.unknown06;
}
public void setUnknown06(int value) {
this.unknown06 = value;
}
public int getUnknown07() {
return this.unknown07;
}
public void setUnknown07(int value) {
this.unknown07 = value;
}
public byte getUnknownByte01() {
return this.unknownByte01;
}
public void setUnknownByte01(byte value) {
this.unknownByte01 = value;
}
public String getCompType() {
return this.compType;
}
public void setCompType(String value) {
this.compType = value;
}
public String getLanguage() {
return this.language;
}
public void setLanguage(String value) {
this.language = value;
}
} }

6
src/engine/objects/Petition.java

@ -21,12 +21,12 @@ public class Petition {
public String message; public String message;
public Petition(ClientNetMsg msg, ClientConnection origin) { public Petition(ClientNetMsg msg, ClientConnection origin) {
this.primaryType = ((PetitionReceivedMsg) msg).getType(); this.primaryType = ((PetitionReceivedMsg) msg).type;
this.subType = ((PetitionReceivedMsg) msg).getSubType(); this.subType = ((PetitionReceivedMsg) msg).subType;
this.reportAccount = origin.getAccount(); this.reportAccount = origin.getAccount();
this.reportPlayer = origin.getPlayerCharacter(); this.reportPlayer = origin.getPlayerCharacter();
this.playerLocation = origin.getPlayerCharacter().getLoc(); this.playerLocation = origin.getPlayerCharacter().getLoc();
this.message = ((PetitionReceivedMsg) msg).getMessage(); this.message = ((PetitionReceivedMsg) msg).message;
} }
} }

Loading…
Cancel
Save