This repository has been archived by the owner on Apr 7, 2021. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 134
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ad72377
commit c985d29
Showing
1 changed file
with
32 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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; | ||
|