Skip to content

Commit

Permalink
requestserverlogin, playfail, playok packets
Browse files Browse the repository at this point in the history
  • Loading branch information
shnok committed Jun 29, 2024
1 parent 14e5f91 commit bf5dbbf
Show file tree
Hide file tree
Showing 19 changed files with 299 additions and 59 deletions.
134 changes: 96 additions & 38 deletions l2-unity/Assets/Scenes/Menu.unity
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,41 @@ NavMeshSettings:
debug:
m_Flags: 0
m_NavMeshData: {fileID: 0}
--- !u!21 &324848853
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Height Fog Global
m_Shader: {fileID: 4800000, guid: 3a7ef1b66bafb7a448a880ef76d2e6e6, type: 3}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords: []
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: 3000
stringTagMap: {}
disabledShaderPasses: []
m_LockedProperties:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs: []
m_Ints: []
m_Floats:
- _AdvancedCat: 1
- _Banner: 1
- _DirectionalCat: 1
- _FogCat: 1
- _HeightFogGlobal: 1
- _IsHeightFogShader: 1
- _NoiseCat: 1
- _SkyboxCat: 1
m_Colors: []
m_BuildTextureStacks: []
--- !u!1 &413261805
GameObject:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -257,41 +292,6 @@ PrefabInstance:
insertIndex: -1
addedObject: {fileID: 431167563}
m_SourcePrefab: {fileID: 100100000, guid: 2bc6245aea0342f4f8c76719bfe12012, type: 3}
--- !u!21 &710239446
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Height Fog Global
m_Shader: {fileID: 4800000, guid: 3a7ef1b66bafb7a448a880ef76d2e6e6, type: 3}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords: []
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: 3000
stringTagMap: {}
disabledShaderPasses: []
m_LockedProperties:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs: []
m_Ints: []
m_Floats:
- _AdvancedCat: 1
- _Banner: 1
- _DirectionalCat: 1
- _FogCat: 1
- _HeightFogGlobal: 1
- _IsHeightFogShader: 1
- _NoiseCat: 1
- _SkyboxCat: 1
m_Colors: []
m_BuildTextureStacks: []
--- !u!1 &803395386
GameObject:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -662,7 +662,7 @@ PrefabInstance:
- target: {fileID: 14083907825353274, guid: 8742fc349ac4f354d9cfb98ebb79a0e3, type: 3}
propertyPath: m_Materials.Array.data[0]
value:
objectReference: {fileID: 710239446}
objectReference: {fileID: 1251702466}
- target: {fileID: 2134954596300280144, guid: 8742fc349ac4f354d9cfb98ebb79a0e3, type: 3}
propertyPath: m_Name
value: Height Fog Global
Expand Down Expand Up @@ -788,6 +788,41 @@ PrefabInstance:
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 8742fc349ac4f354d9cfb98ebb79a0e3, type: 3}
--- !u!21 &1251702466
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Height Fog Global
m_Shader: {fileID: 4800000, guid: 3a7ef1b66bafb7a448a880ef76d2e6e6, type: 3}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords: []
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: 3000
stringTagMap: {}
disabledShaderPasses: []
m_LockedProperties:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs: []
m_Ints: []
m_Floats:
- _AdvancedCat: 1
- _Banner: 1
- _DirectionalCat: 1
- _FogCat: 1
- _HeightFogGlobal: 1
- _IsHeightFogShader: 1
- _NoiseCat: 1
- _SkyboxCat: 1
m_Colors: []
m_BuildTextureStacks: []
--- !u!21 &1446991640
Material:
serializedVersion: 8
Expand Down Expand Up @@ -914,16 +949,19 @@ PrefabInstance:
value: Networking
objectReference: {fileID: 0}
m_RemovedComponents:
- {fileID: 2437028863278307910, guid: babd2d27777f4774581e9efa23af7856, type: 3}
- {fileID: 0}
- {fileID: 1960525163452634930, guid: babd2d27777f4774581e9efa23af7856, type: 3}
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents:
- targetCorrespondingSourceObject: {fileID: 3645245019413108373, guid: babd2d27777f4774581e9efa23af7856, type: 3}
insertIndex: -1
addedObject: {fileID: 1733393677}
- targetCorrespondingSourceObject: {fileID: 3645245019413108373, guid: babd2d27777f4774581e9efa23af7856, type: 3}
insertIndex: -1
addedObject: {fileID: 1733393680}
m_SourcePrefab: {fileID: 100100000, guid: babd2d27777f4774581e9efa23af7856, type: 3}
--- !u!21 &1633438336
--- !u!21 &1598138473
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -1016,6 +1054,26 @@ MonoBehaviour:
_logSentPackets: 1
_account:
_password:
--- !u!114 &1733393680
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1733393672}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5c67c730ecfa65644b4b09bd1cbb3f7c, type: 3}
m_Name:
m_EditorClassIdentifier:
_serverIp: 127.0.0.1
_serverPort: 11000
_connectionTimeoutMs: 10000
_logReceivedPackets: 1
_logSentPackets: 1
_account:
_password:
_currentPlayer: {fileID: 0}
--- !u!114 &1769945945372889719
MonoBehaviour:
m_ObjectHideFlags: 0
Expand Down
6 changes: 6 additions & 0 deletions l2-unity/Assets/Scripts/Game/Manager/GameManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,12 @@ public void OnDisconnect() {
}
}

public void OnGameserverSelected() {
Debug.Log("Gameserver selected, connecting...");

//GameClient.Instance.Connect();
}

public void OnStartingGame() {
Debug.Log("On Starting game");
L2LoginUI.Instance.StartLoading();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,6 @@ public class AsynchronousClient {
public int SessionKey1 { get { return _sessionKey1; } set { _sessionKey1 = value; } }
public int SessionKey2 { get { return _sessionKey2; } set { _sessionKey2 = value; } }

public string Account { get { return _client.Account; } }
public string Password { get { return _client.Password; } }

public int Ping { get; set; }

public AsynchronousClient(string ip, int port, DefaultClient client, ClientPacketHandler clientPacketHandler, ServerPacketHandler serverPacketHandler) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public override void Parse() {
Identity.SetPosX(ReadF());
Identity.SetPosY(ReadF());
Identity.SetPosZ(ReadF());
Identity.Owned = Identity.Name == GameClient.Instance.Account;
Identity.Owned = Identity.Name == GameClient.Instance.CurrentPlayer;
// Status
Status.Level = ReadI();
Status.Hp = ReadI();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public override void Parse() {
Identity.SetPosX(ReadF());
Identity.SetPosY(ReadF());
Identity.SetPosZ(ReadF());
Identity.Owned = Identity.Name == GameClient.Instance.Account;
Identity.Owned = Identity.Name == GameClient.Instance.CurrentPlayer;
// Status
Status.Level = ReadI();
Status.Hp = ReadI();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class RequestServerLoginPacket : ClientPacket {
public RequestServerLoginPacket(int serverId, int sessionKey1, int sessionKey2) : base((byte)LoginClientPacketType.RequestServerLogin) {

WriteI(sessionKey1);
WriteI(sessionKey2);
WriteI(serverId);

BuildPacket();
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
public enum LoginClientPacketType : byte {
Ping = 0x00,
AuthRequest = 0x01,
RequestServerList = 0x02
RequestServerList = 0x02,
RequestServerLogin = 0x03
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ public enum LoginServerPacketType : byte
LoginOk = 2,
LoginFail = 3,
ServerList = 4,
AccountKicked = 5
AccountKicked = 5,
PlayFail = 6,
PlayOk = 7
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayFailPacket : ServerPacket {
public enum PlayFailReason : byte {
REASON_NO_MESSAGE = 0x00,
REASON_SYSTEM_ERROR_LOGIN_LATER = 0x01,
REASON_USER_OR_PASS_WRONG = 0x02,
REASON_ACCESS_FAILED_TRY_AGAIN_LATER = 0x04,
REASON_ACCOUNT_INFO_INCORRECT_CONTACT_SUPPORT = 0x05,
REASON_ACCOUNT_IN_USE = 0x07,
REASON_UNDER_18_YEARS_KR = 0x0C,
REASON_SERVER_OVERLOADED = 0x0F,
REASON_SERVER_MAINTENANCE = 0x10,
REASON_TEMP_PASS_EXPIRED = 0x11,
REASON_GAME_TIME_EXPIRED = 0x12,
REASON_NO_TIME_LEFT = 0x13,
REASON_SYSTEM_ERROR = 0x14,
REASON_ACCESS_FAILED = 0x15,
REASON_RESTRICTED_IP = 0x16,
REASON_WEEK_USAGE_FINISHED = 0x1E,
REASON_SECURITY_CARD_NUMBER_INVALID = 0x1F,
REASON_AGE_NOT_VERIFIED_CANT_LOG_BETWEEN_10PM_6AM = 0x20,
REASON_SERVER_CANNOT_BE_ACCESSED_BY_YOUR_COUPON = 0x21,
REASON_DUAL_BOX = 0x23,
REASON_INACTIVE = 0x24,
REASON_USER_AGREEMENT_REJECTED_ON_WEBSITE = 0x25,
REASON_GUARDIAN_CONSENT_REQUIRED = 0x26,
REASON_USER_AGREEMENT_DECLINED_OR_WITHDRAWAL_REQUEST = 0x27,
REASON_ACCOUNT_SUSPENDED_CALL = 0x28,
REASON_CHANGE_PASSWORD_AND_QUIZ_ON_WEBSITE = 0x29,
REASON_ALREADY_LOGGED_INTO_10_ACCOUNTS = 0x2A,
REASON_MASTER_ACCOUNT_RESTRICTED = 0x2B,
REASON_CERTIFICATION_FAILED = 0x2E,
REASON_TELEPHONE_CERTIFICATION_UNAVAILABLE = 0x2F,
REASON_TELEPHONE_SIGNALS_DELAYED = 0x30,
REASON_CERTIFICATION_FAILED_LINE_BUSY = 0x31,
REASON_CERTIFICATION_SERVICE_NUMBER_EXPIRED_OR_INCORRECT = 0x32,
REASON_CERTIFICATION_SERVICE_CURRENTLY_BEING_CHECKED = 0x33,
REASON_CERTIFICATION_SERVICE_CANT_BE_USED_HEAVY_VOLUME = 0x34,
REASON_CERTIFICATION_SERVICE_EXPIRED_GAMEPLAY_BLOCKED = 0x35,
REASON_CERTIFICATION_FAILED_3_TIMES_GAMEPLAY_BLOCKED_30_MIN = 0x36,
REASON_CERTIFICATION_DAILY_USE_EXCEEDED = 0x37,
REASON_CERTIFICATION_UNDERWAY_TRY_AGAIN_LATER = 0x38
}


private PlayFailReason _playFailReason;
public PlayFailReason FailedReason { get { return _playFailReason; } }


public PlayFailPacket(byte[] d) : base(d) {
Parse();
}

public override void Parse() {
_playFailReason = (PlayFailReason)ReadB();
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,8 @@ public void SendPing() {
}

public void SendAuth() {
string account = _client.Account;
string password = _client.Password;

account = account.ToLower();
string account = LoginClient.Instance.Account;
string password = LoginClient.Instance.Password;

byte[] accountBytes = Encoding.UTF8.GetBytes(account);

Expand Down Expand Up @@ -61,6 +59,12 @@ public void SendRequestServerList() {
SendPacket(packet);
}

public void SendRequestServerLogin(int serverId) {
RequestServerLoginPacket packet = new RequestServerLoginPacket(serverId, _client.SessionKey1, _client.SessionKey2);

SendPacket(packet);
}

public override void SendPacket(ClientPacket packet) {
if (LoginClient.Instance.LogSentPackets) {
LoginClientPacketType packetType = (LoginClientPacketType)packet.GetPacketType();
Expand Down
Loading

0 comments on commit bf5dbbf

Please sign in to comment.