using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using EntityStates;
using EntityStates.Gup;
using HG.Reflection;
using Microsoft.CodeAnalysis;
using On.EntityStates;
using On.RoR2;
using R2API;
using RoR2;
using RoR2.Navigation;
using UnityEngine;
using UnityEngine.AddressableAssets;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: OptIn]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("ArtifactOfGup")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ArtifactOfGup")]
[assembly: AssemblyTitle("ArtifactOfGup")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.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 Gupocalypse
{
[BepInPlugin("com.Nuxlar.ArtifactOfGup", "ArtifactOfGup", "1.0.1")]
public class ArtifactOfGup : BaseUnityPlugin
{
private List<GameObject> originalMasters = new List<GameObject>
{
Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Beetle/BeetleMaster.prefab").WaitForCompletion(),
Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Beetle/BeetleGuardMaster.prefab").WaitForCompletion(),
Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Beetle/BeetleQueenMaster.prefab").WaitForCompletion(),
Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Bell/BellMaster.prefab").WaitForCompletion(),
Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Bison/BisonMaster.prefab").WaitForCompletion(),
Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Brother/BrotherMaster.prefab").WaitForCompletion(),
Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/ClayBoss/ClayBossMaster.prefab").WaitForCompletion(),
Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/ClayBruiser/ClayBruiserMaster.prefab").WaitForCompletion(),
Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/ElectricWorm/ElectricWormMaster.prefab").WaitForCompletion(),
Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Golem/GolemMaster.prefab").WaitForCompletion(),
Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/HermitCrab/HermitCrabMaster.prefab").WaitForCompletion(),
Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Imp/ImpMaster.prefab").WaitForCompletion(),
Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/ImpBoss/ImpBossMaster.prefab").WaitForCompletion(),
Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Jellyfish/JellyfishMaster.prefab").WaitForCompletion(),
Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Lemurian/LemurianMaster.prefab").WaitForCompletion(),
Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/LemurianBruiser/LemurianBruiserMaster.prefab").WaitForCompletion(),
Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/MagmaWorm/MagmaWormMaster.prefab").WaitForCompletion(),
Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/MiniMushroom/MiniMushroomMaster.prefab").WaitForCompletion(),
Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Nullifier/NullifierMaster.prefab").WaitForCompletion(),
Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Parent/ParentMaster.prefab").WaitForCompletion(),
Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/RoboBallBoss/RoboBallBossMaster.prefab").WaitForCompletion(),
Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/RoboBallBoss/RoboBallMiniMaster.prefab").WaitForCompletion(),
Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/RoboBallBoss/SuperRoboBallBossMaster.prefab").WaitForCompletion(),
Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Scav/ScavMaster.prefab").WaitForCompletion(),
Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Shopkeeper/ShopkeeperMaster.prefab").WaitForCompletion(),
Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Titan/TitanMaster.prefab").WaitForCompletion(),
Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Titan/TitanGoldMaster.prefab").WaitForCompletion(),
Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Vagrant/VagrantMaster.prefab").WaitForCompletion(),
Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Vulture/VultureMaster.prefab").WaitForCompletion(),
Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Wisp/WispMaster.prefab").WaitForCompletion(),
Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Grandparent/GrandparentMaster.prefab").WaitForCompletion(),
Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Gravekeeper/GravekeeperMaster.prefab").WaitForCompletion(),
Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/GreaterWisp/GreaterWispMaster.prefab").WaitForCompletion(),
Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC1/AcidLarva/AcidLarvaMaster.prefab").WaitForCompletion(),
Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC1/ClayGrenadier/ClayGrenadierMaster.prefab").WaitForCompletion(),
Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC1/FlyingVermin/FlyingVerminMaster.prefab").WaitForCompletion(),
Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC1/Vermin/VerminMaster.prefab").WaitForCompletion(),
Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC1/MajorAndMinorConstruct/MajorConstructMaster.prefab").WaitForCompletion(),
Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC1/MajorAndMinorConstruct/MegaConstructMaster.prefab").WaitForCompletion(),
Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC1/MajorAndMinorConstruct/MinorConstructMaster.prefab").WaitForCompletion(),
Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/LunarExploder/LunarExploderMaster.prefab").WaitForCompletion(),
Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/LunarGolem/LunarGolemMaster.prefab").WaitForCompletion(),
Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/LunarWisp/LunarWispMaster.prefab").WaitForCompletion(),
Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC1/VoidBarnacle/VoidBarnacleMaster.prefab").WaitForCompletion(),
Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC1/VoidJailer/VoidJailerMaster.prefab").WaitForCompletion(),
Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC1/VoidMegaCrab/VoidMegaCrabMaster.prefab").WaitForCompletion()
};
private List<CharacterSpawnCard> geepSpawnCards = new List<CharacterSpawnCard>();
private List<CharacterSpawnCard> gipSpawnCards = new List<CharacterSpawnCard>();
private static ArtifactDef artifactDef = ScriptableObject.CreateInstance<ArtifactDef>();
private AssetBundleCreateRequest gupArtifactAssets;
private Sprite gupArtifactIconOn;
private Sprite gupArtifactIconOff;
public static ConfigEntry<int> mobCap;
private static ConfigFile AoGConfig { get; set; }
public void Awake()
{
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Expected O, but got Unknown
//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
//IL_00c6: Expected O, but got Unknown
//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
//IL_00d7: Expected O, but got Unknown
AoGConfig = new ConfigFile(Paths.ConfigPath + "\\com.Nuxlar.ArtifactOfGup.cfg", true);
mobCap = AoGConfig.Bind<int>("General", "Change Mob Cap", 40, "How many monsters can be alive at once. Vanilla: 40");
gupArtifactAssets = AssetBundle.LoadFromFileAsync(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "artifactofgup.bundle"));
ref Sprite reference = ref gupArtifactIconOff;
Object asset = gupArtifactAssets.assetBundle.LoadAssetAsync<Sprite>("assets/gupartifactoff.png").asset;
reference = (Sprite)(object)((asset is Sprite) ? asset : null);
ref Sprite reference2 = ref gupArtifactIconOn;
Object asset2 = gupArtifactAssets.assetBundle.LoadAssetAsync<Sprite>("assets/gupartifacton.png").asset;
reference2 = (Sprite)(object)((asset2 is Sprite) ? asset2 : null);
SetupEnemies();
SetupArtifact();
CharacterMaster.OnBodyStart += new hook_OnBodyStart(ShrinkModel);
GenericCharacterDeath.OnEnter += new hook_OnEnter(Split);
RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, new Action(ChangeMobCap));
}
private void ChangeMobCap()
{
TeamCatalog.GetTeamDef((TeamIndex)2).softCharacterLimit = mobCap.Value;
}
private void SetupArtifact()
{
artifactDef.cachedName = "GupArtifact";
artifactDef.nameToken = "Artifact of Gup";
artifactDef.descriptionToken = "Enemies split on death.";
artifactDef.smallIconSelectedSprite = gupArtifactIconOn;
artifactDef.smallIconDeselectedSprite = gupArtifactIconOff;
ContentAddition.AddArtifactDef(artifactDef);
}
private void SetupEnemies()
{
//IL_0221: Unknown result type (might be due to invalid IL or missing references)
//IL_0231: Unknown result type (might be due to invalid IL or missing references)
//IL_0239: Unknown result type (might be due to invalid IL or missing references)
//IL_0241: Unknown result type (might be due to invalid IL or missing references)
//IL_0280: Unknown result type (might be due to invalid IL or missing references)
//IL_0290: Unknown result type (might be due to invalid IL or missing references)
//IL_0298: Unknown result type (might be due to invalid IL or missing references)
//IL_02a0: Unknown result type (might be due to invalid IL or missing references)
foreach (GameObject originalMaster in originalMasters)
{
string name = ((Object)originalMaster).name;
GameObject val = PrefabAPI.InstantiateClone(originalMaster, name + "GeepNux");
GameObject val2 = PrefabAPI.InstantiateClone(originalMaster, name + "GipNux");
GameObject bodyPrefab = originalMaster.GetComponent<CharacterMaster>().bodyPrefab;
string name2 = ((Object)bodyPrefab).name;
((Object)bodyPrefab).name = ((Object)bodyPrefab).name + "GupNux";
if (Object.op_Implicit((Object)(object)bodyPrefab))
{
GameObject val3 = PrefabAPI.InstantiateClone(bodyPrefab, name2 + "GeepNux");
CharacterBody component = val3.GetComponent<CharacterBody>();
if (name2.Contains("Brother"))
{
component.baseMaxHealth /= 4f;
component.levelMaxHealth /= 4f;
}
else
{
component.baseMaxHealth /= 2f;
component.levelMaxHealth /= 2f;
}
component.baseDamage /= 2f;
component.levelDamage /= 2f;
GameObject val4 = PrefabAPI.InstantiateClone(bodyPrefab, name2 + "GipNux");
CharacterBody component2 = val4.GetComponent<CharacterBody>();
if (name2.Contains("Brother"))
{
component2.baseMaxHealth /= 10f;
component2.levelMaxHealth /= 10f;
}
else
{
component2.baseMaxHealth /= 4f;
component2.levelMaxHealth /= 4f;
}
component2.baseDamage /= 4f;
component2.levelDamage /= 4f;
val.GetComponent<CharacterMaster>().bodyPrefab = val3;
val2.GetComponent<CharacterMaster>().bodyPrefab = val4;
ContentAddition.AddBody(val3);
ContentAddition.AddMaster(val);
ContentAddition.AddBody(val4);
ContentAddition.AddMaster(val2);
CharacterSpawnCard val5 = ScriptableObject.CreateInstance<CharacterSpawnCard>();
((Object)val5).name = name2 + "GeepNux";
((SpawnCard)val5).prefab = val;
((SpawnCard)val5).sendOverNetwork = true;
((SpawnCard)val5).hullSize = (HullClassification)0;
((SpawnCard)val5).directorCreditCost = 0;
((SpawnCard)val5).nodeGraphType = (GraphType)0;
((SpawnCard)val5).requiredFlags = (NodeFlags)0;
((SpawnCard)val5).forbiddenFlags = (NodeFlags)4;
geepSpawnCards.Add(val5);
CharacterSpawnCard val6 = ScriptableObject.CreateInstance<CharacterSpawnCard>();
((Object)val6).name = name2 + "GipNux";
((SpawnCard)val6).prefab = val2;
((SpawnCard)val6).sendOverNetwork = true;
((SpawnCard)val6).hullSize = (HullClassification)0;
((SpawnCard)val6).directorCreditCost = 0;
((SpawnCard)val6).nodeGraphType = (GraphType)0;
((SpawnCard)val6).requiredFlags = (NodeFlags)0;
((SpawnCard)val6).forbiddenFlags = (NodeFlags)4;
gipSpawnCards.Add(val6);
}
}
}
private void Split(orig_OnEnter orig, GenericCharacterDeath self)
{
//IL_007f: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Unknown result type (might be due to invalid IL or missing references)
//IL_00a6: Expected O, but got Unknown
//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
//IL_0101: Unknown result type (might be due to invalid IL or missing references)
//IL_0123: Expected O, but got Unknown
orig.Invoke(self);
if (!Object.op_Implicit((Object)(object)RunArtifactManager.instance) || !RunArtifactManager.instance.IsArtifactEnabled(artifactDef))
{
return;
}
if (((Object)((Component)((EntityState)self).characterBody).gameObject).name.Contains("GupNux") && !(self is GupDeath))
{
string name2 = ((Object)((Component)((EntityState)self).characterBody).gameObject).name.Replace("GupNux(Clone)", "");
((EntityState)self).outer.SetState((EntityState)new GupDeath
{
characterSpawnCard = geepSpawnCards.Find((CharacterSpawnCard csc) => ((Object)csc).name.Contains(name2))
});
}
else if (((Object)((Component)((EntityState)self).characterBody).gameObject).name.Contains("GeepNux") && !(self is GeepDeath))
{
string name = ((Object)((Component)((EntityState)self).characterBody).gameObject).name.Replace("GeepNux(Clone)", "");
((EntityState)self).outer.SetState((EntityState)new GeepDeath
{
characterSpawnCard = gipSpawnCards.Find((CharacterSpawnCard csc) => ((Object)csc).name.Contains(name))
});
}
}
private void ShrinkModel(orig_OnBodyStart orig, CharacterMaster self, CharacterBody body)
{
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
orig.Invoke(self, body);
if (!Object.op_Implicit((Object)(object)RunArtifactManager.instance) || !RunArtifactManager.instance.IsArtifactEnabled(artifactDef))
{
return;
}
if (((Object)((Component)body).gameObject).name.Contains("GeepNux"))
{
ModelLocator component = ((Component)body).GetComponent<ModelLocator>();
if (Object.op_Implicit((Object)(object)component))
{
Transform modelTransform = component.modelTransform;
if (Object.op_Implicit((Object)(object)modelTransform))
{
modelTransform.localScale *= 0.75f;
Transform transform = ((Component)body).gameObject.transform;
transform.localScale *= 0.75f;
}
}
}
if (!((Object)((Component)body).gameObject).name.Contains("GipNux"))
{
return;
}
ModelLocator component2 = ((Component)body).GetComponent<ModelLocator>();
if (Object.op_Implicit((Object)(object)component2))
{
Transform modelTransform2 = component2.modelTransform;
if (Object.op_Implicit((Object)(object)modelTransform2))
{
modelTransform2.localScale /= 2f;
Transform transform2 = ((Component)body).gameObject.transform;
transform2.localScale /= 2f;
}
}
}
}
}