Skip to content
This repository has been archived by the owner on Apr 7, 2021. It is now read-only.

Commit

Permalink
re-release 0.3.3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
DefinitlyEvil committed Dec 26, 2017
1 parent ad72377 commit c985d29
Showing 1 changed file with 32 additions and 33 deletions.
65 changes: 32 additions & 33 deletions src/main/java/org/dragonet/proxy/network/PEPacketProcessor.java
Original file line number Diff line number Diff line change
Expand Up @@ -75,43 +75,42 @@ public void handlePacket(PEPacket packet) {

System.out.println(" <<PE " + org.dragonet.proxy.utilities.DebugTools.matchConstant((byte)(packet.pid() & 0xFF), ProtocolInfo.class));

// System.out.println("RECEIVED PACKET=" + packet.getClass().getSimpleName());
/*
* try{ FileOutputStream fos = new FileOutputStream("cap_" +
* System.currentTimeMillis() + "_" + packet.getClass().getSimpleName() +
* ".bin"); fos.write(packet.getBuffer()); fos.close(); }catch(Exception e){}
*/

if(packet.pid() == ProtocolInfo.MOVE_PLAYER_PACKET) {
if(client.getDataCache().containsKey(CacheKey.AUTHENTICATION_STATE) &&
client.getDataCache().get(CacheKey.AUTHENTICATION_STATE).equals("online_login_wait")) {
// client.getDataCache().put(CacheKey.AUTHENTICATION_STATE, "online_login");
ModalFormRequestPacket packetForm = new ModalFormRequestPacket();
CustomFormComponent form = new CustomFormComponent(client.getProxy().getLang().get(Lang.FORM_LOGIN_TITLE));
form.addComponent(new LabelComponent(client.getProxy().getLang().get(Lang.FORM_LOGIN_DESC)));
form.addComponent(new LabelComponent(client.getProxy().getLang().get(Lang.FORM_LOGIN_PROMPT)));
form.addComponent(new InputComponent(client.getProxy().getLang().get(Lang.FORM_LOGIN_USERNAME)).setPlaceholder("[email protected]"));
form.addComponent(new InputComponent(client.getProxy().getLang().get(Lang.FORM_LOGIN_PASSWORD)).setPlaceholder("123456"));
packetForm.formId = 1;
packetForm.formData = form.serializeToJson().toString();
client.sendPacket(packetForm);
return;
}
}

if(packet.pid() == ProtocolInfo.MODAL_FORM_RESPONSE_PACKET) {
if(client.getDataCache().containsKey(CacheKey.AUTHENTICATION_STATE) &&
client.getDataCache().get(CacheKey.AUTHENTICATION_STATE).equals("online_login_wait")) {
client.sendChat(client.getProxy().getLang().get(Lang.MESSAGE_LOGIN_PROGRESS));

client.getDataCache().remove(CacheKey.AUTHENTICATION_STATE);

ModalFormResponsePacket formResponse = (ModalFormResponsePacket) packet;
JSONArray array = new JSONArray(formResponse.formData);
client.authenticate(array.get(2).toString(), array.get(3).toString());
return;
}
}

switch (packet.pid()) {
case ProtocolInfo.LOGIN_PACKET:
client.onLogin((LoginPacket) packet);
break;
case ProtocolInfo.MOVE_PLAYER_PACKET:
if(client.getDataCache().containsKey(CacheKey.AUTHENTICATION_STATE) &&
client.getDataCache().get(CacheKey.AUTHENTICATION_STATE).equals("online_login_wait")) {
// client.getDataCache().put(CacheKey.AUTHENTICATION_STATE, "online_login");
ModalFormRequestPacket packetForm = new ModalFormRequestPacket();
CustomFormComponent form = new CustomFormComponent(client.getProxy().getLang().get(Lang.FORM_LOGIN_TITLE));
form.addComponent(new LabelComponent(client.getProxy().getLang().get(Lang.FORM_LOGIN_DESC)));
form.addComponent(new LabelComponent(client.getProxy().getLang().get(Lang.FORM_LOGIN_PROMPT)));
form.addComponent(new InputComponent(client.getProxy().getLang().get(Lang.FORM_LOGIN_USERNAME)).setPlaceholder("[email protected]"));
form.addComponent(new InputComponent(client.getProxy().getLang().get(Lang.FORM_LOGIN_PASSWORD)).setPlaceholder("123456"));
packetForm.formId = 1;
packetForm.formData = form.serializeToJson().toString();
client.sendPacket(packetForm);
break;
}
case ProtocolInfo.MODAL_FORM_RESPONSE_PACKET:
if(client.getDataCache().containsKey(CacheKey.AUTHENTICATION_STATE) &&
client.getDataCache().get(CacheKey.AUTHENTICATION_STATE).equals("online_login_wait")) {
client.sendChat(client.getProxy().getLang().get(Lang.MESSAGE_LOGIN_PROGRESS));

client.getDataCache().remove(CacheKey.AUTHENTICATION_STATE);

ModalFormResponsePacket formResponse = (ModalFormResponsePacket) packet;
JSONArray array = new JSONArray(formResponse.formData);
client.authenticate(array.get(2).toString(), array.get(3).toString());
break;
}
case ProtocolInfo.RESOURCE_PACK_CLIENT_RESPONSE_PACKET:
if (client.isLoggedIn()) {
return;
Expand Down

0 comments on commit c985d29

Please sign in to comment.