diff --git a/l2-unity/Assets/Scenes/Menu.unity b/l2-unity/Assets/Scenes/Menu.unity index 0950c6b33..a96eb9744 100644 --- a/l2-unity/Assets/Scenes/Menu.unity +++ b/l2-unity/Assets/Scenes/Menu.unity @@ -123,6 +123,110 @@ NavMeshSettings: debug: m_Flags: 0 m_NavMeshData: {fileID: 0} +--- !u!21 &55887178 +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 &173523387 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Override + m_Shader: {fileID: 4800000, guid: a3a3bc8785681554d9558e2ea68f100e, type: 3} + m_Parent: {fileID: 0} + m_ModifiedSerializedProperties: 0 + m_ValidKeywords: [] + m_InvalidKeywords: [] + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_LockedProperties: + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: [] + m_Ints: [] + m_Floats: + - _AdvancedCat: 1 + - _Banner: 1 + - _DirectionalCat: 1 + - _DirectionalFalloff: 2 + - _DirectionalIntensity: 1 + - _FarDistanceHeight: 0 + - _FarDistanceOffset: 0 + - _FogAxisMode: 1 + - _FogCameraMode: 0 + - _FogCat: 1 + - _FogColorDuo: 1 + - _FogDistanceEnd: 100 + - _FogDistanceFalloff: 2 + - _FogDistanceStart: 0 + - _FogHeightEnd: 100 + - _FogHeightFalloff: 2 + - _FogHeightStart: 0 + - _FogIntensity: 1 + - _FogLayersMode: 0 + - _IsHeightFogPreset: 1 + - _IsHeightFogShader: 1 + - _JitterIntensity: 1 + - _NoiseCat: 1 + - _NoiseDistanceEnd: 50 + - _NoiseIntensity: 1 + - _NoiseMax: 1 + - _NoiseMin: 0 + - _NoiseModeBlend: 1 + - _NoiseScale: 30 + - _SkyboxCat: 1 + - _SkyboxFogBottom: 0 + - _SkyboxFogFalloff: 1 + - _SkyboxFogFill: 1 + - _SkyboxFogHeight: 1 + - _SkyboxFogIntensity: 1 + - _SkyboxFogOffset: 0 + m_Colors: + - _DirectionalColor: {r: 1, g: 0.7793103, b: 0.5, a: 1} + - _DirectionalDir: {r: 0, g: 0, b: 0, a: 0} + - _FogAxisOption: {r: 0, g: 0, b: 0, a: 0} + - _FogColorEnd: {r: 0.8862745, g: 1.443137, b: 2, a: 1} + - _FogColorStart: {r: 0.4411765, g: 0.722515, b: 1, a: 1} + - _NoiseSpeed: {r: 0.5, g: 0, b: 0.5, a: 0} + m_BuildTextureStacks: [] --- !u!1 &413261805 GameObject: m_ObjectHideFlags: 0 @@ -412,41 +516,6 @@ MonoBehaviour: _entityMask: serializedVersion: 2 m_Bits: 64 ---- !u!21 &993232509 -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!1001 &1001879169 PrefabInstance: m_ObjectHideFlags: 0 @@ -600,75 +669,6 @@ PrefabInstance: m_AddedGameObjects: [] m_AddedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 824ee6870a432f9439e35ee4e771a1f5, type: 3} ---- !u!21 &1007033265 -Material: - serializedVersion: 8 - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_Name: Override - m_Shader: {fileID: 4800000, guid: a3a3bc8785681554d9558e2ea68f100e, type: 3} - m_Parent: {fileID: 0} - m_ModifiedSerializedProperties: 0 - m_ValidKeywords: [] - m_InvalidKeywords: [] - m_LightmapFlags: 4 - m_EnableInstancingVariants: 0 - m_DoubleSidedGI: 0 - m_CustomRenderQueue: -1 - stringTagMap: {} - disabledShaderPasses: [] - m_LockedProperties: - m_SavedProperties: - serializedVersion: 3 - m_TexEnvs: [] - m_Ints: [] - m_Floats: - - _AdvancedCat: 1 - - _Banner: 1 - - _DirectionalCat: 1 - - _DirectionalFalloff: 2 - - _DirectionalIntensity: 1 - - _FarDistanceHeight: 0 - - _FarDistanceOffset: 0 - - _FogAxisMode: 1 - - _FogCameraMode: 0 - - _FogCat: 1 - - _FogColorDuo: 1 - - _FogDistanceEnd: 100 - - _FogDistanceFalloff: 2 - - _FogDistanceStart: 0 - - _FogHeightEnd: 100 - - _FogHeightFalloff: 2 - - _FogHeightStart: 0 - - _FogIntensity: 1 - - _FogLayersMode: 0 - - _IsHeightFogPreset: 1 - - _IsHeightFogShader: 1 - - _JitterIntensity: 1 - - _NoiseCat: 1 - - _NoiseDistanceEnd: 50 - - _NoiseIntensity: 1 - - _NoiseMax: 1 - - _NoiseMin: 0 - - _NoiseModeBlend: 1 - - _NoiseScale: 30 - - _SkyboxCat: 1 - - _SkyboxFogBottom: 0 - - _SkyboxFogFalloff: 1 - - _SkyboxFogFill: 1 - - _SkyboxFogHeight: 1 - - _SkyboxFogIntensity: 1 - - _SkyboxFogOffset: 0 - m_Colors: - - _DirectionalColor: {r: 1, g: 0.7793103, b: 0.5, a: 1} - - _DirectionalDir: {r: 0, g: 0, b: 0, a: 0} - - _FogAxisOption: {r: 0, g: 0, b: 0, a: 0} - - _FogColorEnd: {r: 0.8862745, g: 1.443137, b: 2, a: 1} - - _FogColorStart: {r: 0.4411765, g: 0.722515, b: 1, a: 1} - - _NoiseSpeed: {r: 0.5, g: 0, b: 0.5, a: 0} - m_BuildTextureStacks: [] --- !u!108 &1061591418 stripped Light: m_CorrespondingSourceObject: {fileID: 4181994143891002370, guid: 824ee6870a432f9439e35ee4e771a1f5, type: 3} @@ -746,7 +746,7 @@ PrefabInstance: - target: {fileID: 14083907825353274, guid: 8742fc349ac4f354d9cfb98ebb79a0e3, type: 3} propertyPath: m_Materials.Array.data[0] value: - objectReference: {fileID: 2125498943} + objectReference: {fileID: 1336475700} - target: {fileID: 2134954596300280144, guid: 8742fc349ac4f354d9cfb98ebb79a0e3, type: 3} propertyPath: m_Name value: Height Fog Global @@ -872,6 +872,41 @@ PrefabInstance: m_AddedGameObjects: [] m_AddedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 8742fc349ac4f354d9cfb98ebb79a0e3, type: 3} +--- !u!21 &1336475700 +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 @@ -1105,41 +1140,6 @@ Transform: m_Children: [] m_Father: {fileID: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!21 &2125498943 -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!1001 &521792339377878846 PrefabInstance: m_ObjectHideFlags: 0 @@ -1158,7 +1158,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 2808076256991555282, guid: babd2d27777f4774581e9efa23af7856, type: 3} propertyPath: _logReceivedPackets - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 2902492874257817939, guid: babd2d27777f4774581e9efa23af7856, type: 3} propertyPath: m_LocalPosition.x diff --git a/l2-unity/Assets/Scripts/Networking/ClientLibrary/AsynchronousClient.cs b/l2-unity/Assets/Scripts/Networking/ClientLibrary/AsynchronousClient.cs index 9ed1d7846..02663a842 100644 --- a/l2-unity/Assets/Scripts/Networking/ClientLibrary/AsynchronousClient.cs +++ b/l2-unity/Assets/Scripts/Networking/ClientLibrary/AsynchronousClient.cs @@ -141,8 +141,9 @@ public void StartReceiving() { receivedBytes = receivedBytes + newBytes; } - - Task.Run(() => _serverPacketHandler.HandlePacketAsync(data, _initPacket)); + if(_serverPacketHandler.HandlePacketCrypto(data, _initPacket)) { + Task.Run(() => _serverPacketHandler.HandlePacketAsync(data)); + } } } } diff --git a/l2-unity/Assets/Scripts/Networking/ClientLibrary/PacketHandler/ServerPacketHandler.cs b/l2-unity/Assets/Scripts/Networking/ClientLibrary/PacketHandler/ServerPacketHandler.cs index 4ac9f7183..572ba9c79 100644 --- a/l2-unity/Assets/Scripts/Networking/ClientLibrary/PacketHandler/ServerPacketHandler.cs +++ b/l2-unity/Assets/Scripts/Networking/ClientLibrary/PacketHandler/ServerPacketHandler.cs @@ -18,22 +18,26 @@ public void SetClient(AsynchronousClient client, ClientPacketHandler clientPacke _clientPacketHandler = clientPacketHandler; } - public async Task HandlePacketAsync(byte[] data, bool init) { - await Task.Run(() => { - if (_client.CryptEnabled) { - data = DecryptPacket(data); - - if (init) { - if (!DecodeXOR(data)) { - Debug.LogError("Packet XOR could not be decoded."); - return; - } - } else if(!NewCrypt.verifyChecksum(data)) { - Debug.LogError("Packet checksum is wrong. Ignoring packet..."); - return; + public bool HandlePacketCrypto(byte[] data, bool init) { + if (_client.CryptEnabled) { + data = DecryptPacket(data); + + if (init) { + if (!DecodeXOR(data)) { + Debug.LogError("Packet XOR could not be decoded."); + return false; } + } else if(!NewCrypt.verifyChecksum(data)) { + Debug.LogError("Packet checksum is wrong. Ignoring packet..."); + return false; } + } + return true; + } + + public async Task HandlePacketAsync(byte[] data) { + await Task.Run(() => { HandlePacket(data); }); }