using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Planetside;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace PlanetsideShaderFix
{
public class C
{
public static readonly bool DEBUG_BUILD = false;
public const string MOD_NAME = "Planetside Shader Fix";
public const string MOD_INT_NAME = "PlanetsideShaderFix";
public const string MOD_VERSION = "1.0.1";
public const string MOD_GUID = "pretzel.etg.psogshaderfix";
public const string MOD_PREFIX = "pssf";
public static readonly Color MOD_COLOR = Color.white;
}
public static class LinuxShaderFix
{
private class PortalFixer : MonoBehaviour
{
[HarmonyPatch(typeof(TrespassPortalController), "Start")]
private class FixTrespassPortalPatch
{
private static void Postfix(TrespassPortalController __instance)
{
((Component)__instance).gameObject.AddComponent<PortalFixer>();
}
}
[HarmonyPatch(typeof(TrespassReturnPortalController), "Start")]
private class FixTrespassReturnPortalPatch
{
private static void Postfix(TrespassPortalController __instance)
{
((Component)__instance).gameObject.AddComponent<PortalFixer>();
}
}
private void Start()
{
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
Material material = ((Renderer)((Component)this).gameObject.GetComponent<MeshRenderer>()).material;
material.shader = ShaderCache.Acquire("Brave/LitTk2dCustomFalloffTiltedCutoutEmissive");
material.DisableKeyword("BRIGHTNESS_CLAMP_ON");
material.EnableKeyword("BRIGHTNESS_CLAMP_OFF");
material.SetFloat("_EmissivePower", 3000f);
material.SetFloat("_EmissiveColorPower", 1.55f);
material.SetColor("_EmissiveColor", Color.blue);
}
private void Update()
{
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
((Renderer)((Component)this).gameObject.GetComponent<MeshRenderer>()).material.SetFloat("_EmissivePower", 3000f + 3000f * Mathf.Abs(Mathf.Sin(5f * BraveTime.ScaledTimeSinceStartup)));
((Component)this).gameObject.transform.localRotation = Quaternion.Euler(0f, 0f, 360f * (BraveTime.ScaledTimeSinceStartup % 10f));
}
}
[HarmonyPatch(typeof(tk2dSpriteCollectionData), "Init")]
private class SpriteCollectionInitPatch
{
private const string _FALLBACK_SHADER = "tk2d/BlendVertexColor";
private const string _BETTER_FALLBACK_SHADER = "Brave/PlayerShader";
private static HashSet<Material> _ProcessedMaterialCache = new HashSet<Material>();
private static Dictionary<string, Func<string>> _MaterialShaderReplacements = new Dictionary<string, Func<string>>
{
{
"psoggun material",
() => "Brave/PlayerShader"
},
{
"guonpsog material",
() => "Brave/PlayerShader"
},
{
"oddments material",
() => "Brave/LitTk2dCustomFalloffTiltedCutoutEmissive"
},
{
"item_collection material",
() => "Brave/PlayerShader"
},
{
"active_item material",
() => "Brave/PlayerShader"
},
{
"projectile material",
() => "Brave/PlayerShader"
},
{
"debuff material",
() => "Brave/LitTk2dCustomFalloffTiltedCutoutEmissive"
},
{
"pickup material",
() => "Brave/PlayerShader"
},
{
"ophanaim material",
() => "Brave/LitTk2dCustomFalloffTiltedCutoutEmissive"
},
{
"modderbullet material",
() => "Brave/PlayerShader"
},
{
"glockulus material",
() => "Brave/PlayerShader"
}
};
private static void Postfix(tk2dSpriteCollectionData __instance)
{
if ((Object)(object)__instance.material != (Object)null && !_ProcessedMaterialCache.Contains(__instance.material))
{
if (_MaterialShaderReplacements.TryGetValue(((Object)__instance.material).name, out var value))
{
string text = value();
__instance.material.shader = ShaderCache.Acquire(text);
}
else if (((Object)__instance.material.shader).name == "tk2d/BlendVertexColor")
{
__instance.material.shader = ShaderCache.Acquire("Brave/PlayerShader");
}
_ProcessedMaterialCache.Add(__instance.material);
}
}
}
}
[BepInPlugin("pretzel.etg.psogshaderfix", "Planetside Shader Fix", "1.0.1")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Initialisation : BaseUnityPlugin
{
public void Awake()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
ETGModConsole.Log((object)("<color=#" + ColorUtility.ToHtmlStringRGB(Color.yellow).ToLower() + ">NOTICE: Planetside Shader Fix is deprecated now that Planetside has built-in shader support for Linux and MacOS.</color>"), false);
ETGModConsole.Log((object)("<color=#" + ColorUtility.ToHtmlStringRGB(Color.yellow).ToLower() + "> This mod now does nothing and can be safely uninstalled. Have a nice day. :D</color>"), false);
}
}
}