using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using HarmonyLib;
using RoR2;
using RoR2.SurvivorMannequins;
using RoR2.UI;
using UnityEngine;
using UnityEngine.SceneManagement;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("ThundergunRevised")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ThundergunRevised")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("5711e2a0-d5a7-4ddf-b8d4-00f355fe9397")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: NeutralResourcesLanguage("en-FI")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace MulteLobbyAnimFix;
[BepInPlugin("plonk.multefixbecauseitfuckingpissesmeoff", "Mul-Tweaks", "1.0.0")]
public class MainCode : BaseUnityPlugin
{
[HarmonyPatch]
public static class Patches
{
[HarmonyPrefix]
[HarmonyPatch(typeof(CharacterModel), "Awake")]
public static void Patch(CharacterModel __instance)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
Scene activeScene = SceneManager.GetActiveScene();
MulteRigFixer multeRigFixer = default(MulteRigFixer);
if (((Scene)(ref activeScene)).name == "lobby" && ((Object)((Component)__instance).transform).name == "mdlToolbot" && !((Component)__instance).TryGetComponent<MulteRigFixer>(ref multeRigFixer))
{
((Component)__instance).gameObject.AddComponent<MulteRigFixer>();
}
}
}
public class MulteRigFixer : MonoBehaviour
{
public Animator anim;
public Dictionary<string, Transform> parts = new Dictionary<string, Transform>();
private SurvivorMannequinSlotController cont;
public List<Transform> buttons = new List<Transform>();
private List<bool> selected = new List<bool> { true, false, false, false, false, false, false, false };
private float t;
private int weapon;
public void Awake()
{
anim = ((Component)this).GetComponent<Animator>();
cont = ((Component)this).GetComponentInParent<SurvivorMannequinSlotController>();
}
public void OnDisable()
{
((Behaviour)anim).enabled = true;
}
public void OnEnable()
{
t = Time.time;
parts = new Dictionary<string, Transform>
{
{
"extral",
((Component)this).transform.Find("ToolbotArmature/ROOT/base/hip/thigh.l/extraCalf.l")
},
{
"extrar",
((Component)this).transform.Find("ToolbotArmature/ROOT/base/hip/thigh.r/extraCalf.r")
},
{
"thighl",
((Component)this).transform.Find("ToolbotArmature/ROOT/base/hip/thigh.l")
},
{
"thighr",
((Component)this).transform.Find("ToolbotArmature/ROOT/base/hip/thigh.r")
},
{
"root",
((Component)this).transform.Find("ToolbotArmature/ROOT")
},
{
"toolbase",
((Component)this).transform.Find("ToolbotArmature/ROOT/base/stomach/chest/upper_arm.l/lower_arm.l/toolbase")
}
};
}
public void Update()
{
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_0081: Unknown result type (might be due to invalid IL or missing references)
//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
//IL_0107: Unknown result type (might be due to invalid IL or missing references)
//IL_0111: Unknown result type (might be due to invalid IL or missing references)
//IL_013b: Unknown result type (might be due to invalid IL or missing references)
//IL_014f: Unknown result type (might be due to invalid IL or missing references)
//IL_0159: Unknown result type (might be due to invalid IL or missing references)
//IL_0183: Unknown result type (might be due to invalid IL or missing references)
//IL_0197: Unknown result type (might be due to invalid IL or missing references)
//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
if (((Behaviour)anim).enabled)
{
float num = t;
AnimatorStateInfo currentAnimatorStateInfo = anim.GetCurrentAnimatorStateInfo(0);
if (num + ((AnimatorStateInfo)(ref currentAnimatorStateInfo)).length < Time.time)
{
((Behaviour)anim).enabled = false;
}
}
else
{
parts["extral"].localRotation = Quaternion.Lerp(parts["extral"].localRotation, Quaternion.Euler(0f, 90f, 0f), 0.1f);
parts["extrar"].localRotation = Quaternion.Lerp(parts["extrar"].localRotation, Quaternion.Euler(0f, 90f, 0f), 0.1f);
parts["thighl"].localRotation = Quaternion.Lerp(parts["thighl"].localRotation, Quaternion.Euler(11.4223f, 179.5351f, 313.506f), 0.1f);
parts["thighr"].localRotation = Quaternion.Lerp(parts["thighr"].localRotation, Quaternion.Euler(11.7955f, 0.4387f, 46.4209f), 0.1f);
parts["root"].localPosition = Vector3.Lerp(parts["root"].localPosition, new Vector3(0f, -0.1255f, -0.4491f), 0.1f);
if (buttons.Count != 8)
{
GameObject val = GameObject.Find("CharacterSelectUIMain(Clone)/SafeArea/LeftHandPanel (Layer: Main)/SurvivorInfoPanel, Active (Layer: Secondary)/ContentPanel (Overview, Skills, Loadout)/LoadoutPanel/");
if ((Object)(object)val == (Object)null)
{
return;
}
List<Transform> list = new List<Transform>
{
val.transform.GetChild(1),
val.transform.GetChild(2)
};
if (list == null || list.Count == 0)
{
return;
}
List<Transform> list2 = new List<Transform>();
foreach (Transform item in list)
{
for (int i = 0; i < item.Find("ButtonContainer").childCount - 1; i++)
{
list2.Add(item.Find("ButtonContainer").GetChild(i));
}
}
if (list2 == null || list2.Count == 0)
{
return;
}
buttons = list2;
}
}
if (!((Object)(object)cont != (Object)null) || !(((Object)((Component)cont).transform).name == "CharacterPad") || buttons == null || buttons.Count <= 0)
{
return;
}
for (int j = 0; j < buttons.Count; j++)
{
if ((Object)(object)buttons[j].Find("ButtonSelectionHighlight, Checkbox") != (Object)null && !selected[j])
{
selected[j] = true;
SelectedChanged(j);
}
if ((Object)(object)buttons[j].Find("ButtonSelectionHighlight, Checkbox") == (Object)null && selected[j])
{
selected[j] = false;
}
}
}
public void SelectedChanged(int newSelected)
{
if (newSelected > 3)
{
newSelected -= 4;
}
if (weapon != newSelected)
{
weapon = newSelected;
WeaponChanged();
}
}
public void WeaponChanged()
{
//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
//IL_009e: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
for (int i = 0; i < parts["toolbase"].childCount; i++)
{
int num = 0;
switch (((Object)parts["toolbase"].GetChild(i)).name)
{
case "nailgun.base":
num = 0;
break;
case "speargun.base":
num = 1;
break;
case "grenade.base":
num = 2;
break;
case "saw.base":
num = 3;
break;
}
if (num == weapon)
{
parts["toolbase"].GetChild(i).localScale = Vector3.Lerp(parts["toolbase"].GetChild(i).localScale, Vector3.one, 1f);
}
else
{
parts["toolbase"].GetChild(i).localScale = Vector3.Lerp(parts["toolbase"].GetChild(i).localScale, Vector3.zero, 1f);
}
}
}
}
public static GenericSkill skill1;
public static GenericSkill skill2;
public void Awake()
{
SceneManager.sceneLoaded += OnSceneChange;
}
public void Start()
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
new Harmony("plonk.multefixbecauseitfuckingpissesmeoff").PatchAll();
}
public void OnSceneChange(Scene scene, LoadSceneMode mode)
{
}
public void Update()
{
GameObject obj = GameObject.Find("HUDSimple(Clone)/MainContainer/MainUIArea/SpringCanvas/BottomRightCluster/Scaler");
Transform val = ((obj != null) ? obj.transform : null);
if (!((Object)(object)val != (Object)null))
{
return;
}
SkillIcon val2 = null;
SkillIcon val3 = null;
if ((Object)(object)val.Find("Skill1Root") != (Object)null)
{
((Component)val.Find("Skill1Root")).TryGetComponent<SkillIcon>(ref val2);
}
if ((Object)(object)val.Find("Skill2Root") != (Object)null)
{
((Component)val.Find("Skill2Root")).TryGetComponent<SkillIcon>(ref val3);
}
if ((Object)(object)val2 == (Object)null || (Object)(object)val3 == (Object)null || (Object)(object)val2.targetSkill == (Object)null || (Object)(object)val3.targetSkill == (Object)null)
{
return;
}
skill1 = val2.targetSkill;
skill2 = val3.targetSkill;
if (!(val2.targetSkill.skillDef.skillName == "FireGrenadeLauncher"))
{
return;
}
if (val3.targetSkill.skillDef.skillName == val2.targetSkill.skillDef.skillName)
{
if (val2.targetSkill.maxStock != val3.targetSkill.maxStock)
{
val2.targetSkill.maxStock = val3.targetSkill.maxStock;
val2.targetSkill.stock = val3.targetSkill.stock;
Debug.Log((object)"Equalizing stock");
}
}
else if (val2.targetSkill.maxStock != 4)
{
val2.targetSkill.maxStock = 4;
val2.targetSkill.stock = Mathf.Min(val2.targetSkill.stock, val2.targetSkill.maxStock);
Debug.Log((object)"Reverting stock");
}
}
}