using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using EntityStates;
using EntityStates.AI;
using EntityStates.AI.Walker;
using JetBrains.Annotations;
using KinematicCharacterController;
using R2API;
using RoR2;
using RoR2.Audio;
using RoR2.CharacterAI;
using RoR2.ContentManagement;
using RoR2.Navigation;
using RoR2.Networking;
using RoR2.Projectile;
using RoR2_Roomba.Components;
using RoR2_Roomba.Items;
using RoR2_Roomba.States;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Networking;
using UnityEngine.Rendering;
using UnityEngine.ResourceManagement.AsyncOperations;
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("RoR2_Roomba")]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: AssemblyProduct("RoR2_Roomba")]
[assembly: AssemblyTitle("RoR2_Roomba")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace RoR2_Roomba
{
public class ContentProvider : IContentPackProvider
{
public static class Items
{
public static ItemDef Maxwell;
public static ItemDef Poster;
public static ItemDef PileOfDirt;
}
private readonly ContentPack _contentPack = new ContentPack();
public const string AssetBundleName = "roomba";
public const string AssetBundleFolder = "AssetBundles";
public const string SoundbanksFolder = "Soundbanks";
public const string SoundbankFileName = "RoombaSoundBank.bnk";
public static Dictionary<string, string> ShaderLookup = new Dictionary<string, string>
{
{ "stubbedror2/base/shaders/hgstandard", "RoR2/Base/Shaders/HGStandard.shader" },
{ "stubbedror2/base/shaders/hgsnowtopped", "RoR2/Base/Shaders/HGSnowTopped.shader" },
{ "stubbedror2/base/shaders/hgtriplanarterrainblend", "RoR2/Base/Shaders/HGTriplanarTerrainBlend.shader" },
{ "stubbedror2/base/shaders/hgintersectioncloudremap", "RoR2/Base/Shaders/HGIntersectionCloudRemap.shader" },
{ "stubbedror2/base/shaders/hgcloudremap", "RoR2/Base/Shaders/HGCloudRemap.shader" },
{ "stubbedror2/base/shaders/hgdistortion", "RoR2/Base/Shaders/HGDistortion.shader" },
{ "stubbedcalm water/calmwater - dx11 - doublesided", "Calm Water/CalmWater - DX11 - DoubleSided.shader" },
{ "stubbedcalm water/calmwater - dx11", "Calm Water/CalmWater - DX11.shader" },
{ "stubbednature/speedtree", "RoR2/Base/Shaders/SpeedTreeCustom.shader" },
{ "stubbeddecalicious/decaliciousdeferreddecal", "Decalicious/DecaliciousDeferredDecal.shader" }
};
public static List<Material> SwappedMaterials = new List<Material>();
public string identifier => "com.Viliger.Roomba.ContentProvider";
public IEnumerator FinalizeAsync(FinalizeAsyncArgs args)
{
args.ReportProgress(1f);
yield break;
}
public IEnumerator GenerateContentPackAsync(GetContentPackAsyncArgs args)
{
ContentPack.Copy(_contentPack, args.output);
args.ReportProgress(1f);
yield break;
}
public IEnumerator LoadStaticContentAsync(LoadStaticContentAsyncArgs args)
{
_contentPack.identifier = identifier;
LoadSoundBanks(Path.Combine(Path.GetDirectoryName(typeof(ContentProvider).Assembly.Location), "Soundbanks"));
string path = Path.Combine(Path.GetDirectoryName(typeof(ContentProvider).Assembly.Location), "AssetBundles");
AssetBundle assetbundle = null;
yield return LoadAssetBundle(Path.Combine(path, "roomba"), args.progressReceiver, delegate(AssetBundle resultAssetBundle)
{
assetbundle = resultAssetBundle;
});
Sprite maxwellIcon = null;
Sprite posterIcon = null;
Sprite trashIcon = null;
yield return LoadAllAssetsAsync<Sprite>(assetbundle, args.progressReceiver, (Action<Sprite[]>)delegate(Sprite[] assets)
{
maxwellIcon = assets.First((Sprite icon) => ((Object)icon).name == "MaxwellIcon");
posterIcon = assets.First((Sprite icon) => ((Object)icon).name == "PosterIcon");
trashIcon = assets.First((Sprite icon) => ((Object)icon).name == "PileOfDirtIcon");
});
yield return LoadAllAssetsAsync<Material>(assetbundle, args.progressReceiver, (Action<Material[]>)delegate(Material[] assets)
{
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
if (assets != null)
{
Material[] array = assets;
foreach (Material val2 in array)
{
if (((Object)val2.shader).name.StartsWith("Stubbed"))
{
Shader val3 = Addressables.LoadAssetAsync<Shader>((object)ShaderLookup[((Object)val2.shader).name.ToLower()]).WaitForCompletion();
((Object)val2.shader).name.ToLower();
if (Object.op_Implicit((Object)(object)val3))
{
val2.shader = val3;
SwappedMaterials.Add(val2);
}
else
{
Log.Warning("Couldn't find replacement shader for " + ((Object)val2.shader).name.ToLower());
}
}
}
}
});
AsyncOperationHandle<Material> glassMaterial = Addressables.LoadAssetAsync<Material>((object)"RoR2/Base/Common/VFX/matShatteredGlass.mat");
while (!glassMaterial.IsDone)
{
yield return null;
}
AsyncOperationHandle<GameObject> bombEffect = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Bandit2/Bandit2SmokeBomb.prefab");
while (!bombEffect.IsDone)
{
yield return null;
}
AsyncOperationHandle<GameObject> grenadeExplosion = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Commando/OmniExplosionVFXCommandoGrenade.prefab");
while (!grenadeExplosion.IsDone)
{
yield return null;
}
yield return LoadAllAssetsAsync<GameObject>(assetbundle, args.progressReceiver, (Action<GameObject[]>)delegate(GameObject[] assets)
{
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_017e: Unknown result type (might be due to invalid IL or missing references)
//IL_0184: Expected O, but got Unknown
if (RoombaConfigs.CustomItems.Value)
{
Maxwell.MaxwellProcType = ProcTypeAPI.ReserveProcType();
GameObject val = PrefabAPI.InstantiateClone(grenadeExplosion.Result, "MaxwellExplosionEffect", false);
val.GetComponent<EffectComponent>().soundName = "Roomba_HL_Explosion_Play";
Items.Maxwell = Maxwell.CreateItemDef(assets.First((GameObject pickup) => ((Object)pickup).name == "PickupMaxwell"), maxwellIcon);
Maxwell.EvilMaxwellPrefab = Maxwell.CreateEvilMaxwellPrefab(assets.First((GameObject prefab) => ((Object)prefab).name == "EvilMaxwellPrefab"), val);
Items.Poster = Poster.CreateItemDef(assets.First((GameObject pickup) => ((Object)pickup).name == "PickupPoster"), posterIcon);
Items.PileOfDirt = PileOfDirt.CreateItemDef(assets.First((GameObject pickup) => ((Object)pickup).name == "PickupPileOfDirt"), glassMaterial.Result, trashIcon);
GameObject pileOfDirtPrefab = assets.First((GameObject prefab) => ((Object)prefab).name == "PileOfDirtSpawn");
pileOfDirtPrefab = PileOfDirt.CreatePileOfDirtSpawnPrefab(pileOfDirtPrefab, glassMaterial.Result);
PileOfDirt.scPileOfDirt = PileOfDirt.CreatePileOfDirtSpawnCard(pileOfDirtPrefab);
_contentPack.effectDefs.Add((EffectDef[])(object)new EffectDef[1]
{
new EffectDef(val)
});
_contentPack.itemDefs.Add((ItemDef[])(object)new ItemDef[3]
{
Items.Maxwell,
Items.Poster,
Items.PileOfDirt
});
_contentPack.networkedObjectPrefabs.Add((GameObject[])(object)new GameObject[2]
{
Maxwell.EvilMaxwellPrefab,
pileOfDirtPrefab
});
}
RoombaFactory roombaFactory = new RoombaFactory();
GameObject roombaPrefab = assets.First((GameObject bp) => ((Object)bp).name == "RoombaNothingBody");
roombaPrefab = roombaFactory.CreateRoombaBody(roombaPrefab, bombEffect.Result);
GameObject roombaMaster = assets.First((GameObject mp) => ((Object)mp).name == "RoombaNothingMaster");
roombaMaster = roombaFactory.CreateRoombaMaster(roombaMaster, roombaPrefab);
RoombaFactory.cscRoomba = roombaFactory.CreateCharacterSpawnCard(roombaMaster);
GameObject roombaPrefab2 = assets.First((GameObject bp) => ((Object)bp).name == "RoombaMaxwellBody");
roombaPrefab2 = roombaFactory.CreateRoombaBody(roombaPrefab2, bombEffect.Result);
GameObject roombaMaster2 = assets.First((GameObject mp) => ((Object)mp).name == "RoombaMaxwellMaster");
roombaMaster2 = roombaFactory.CreateRoombaMaster(roombaMaster2, roombaPrefab2);
RoombaFactory.cscRoombaMaxwell = roombaFactory.CreateCharacterSpawnCard(roombaMaster2);
GameObject roombaPrefab3 = assets.First((GameObject bp) => ((Object)bp).name == "RoombaTVBody");
roombaPrefab3 = roombaFactory.CreateRoombaBody(roombaPrefab3, bombEffect.Result);
GameObject roombaMaster3 = assets.First((GameObject mp) => ((Object)mp).name == "RoombaTVMaster");
roombaMaster3 = roombaFactory.CreateRoombaMaster(roombaMaster3, roombaPrefab3);
RoombaFactory.cscRoombaTV = roombaFactory.CreateCharacterSpawnCard(roombaMaster3);
_contentPack.entityStateTypes.Add(new Type[5]
{
typeof(InvincibleRoombaState),
typeof(LookBusyFar),
typeof(PileOfDirtDeath),
typeof(RoombaSpawnState),
typeof(WanderFar)
});
_contentPack.bodyPrefabs.Add((GameObject[])(object)new GameObject[3] { roombaPrefab, roombaPrefab2, roombaPrefab3 });
_contentPack.masterPrefabs.Add((GameObject[])(object)new GameObject[3] { roombaMaster, roombaMaster2, roombaMaster3 });
});
_contentPack.networkSoundEventDefs.Add((NetworkSoundEventDef[])(object)new NetworkSoundEventDef[3]
{
CreateNetworkSoundDef("Roomba_BadToTheBone_Play"),
CreateNetworkSoundDef("Roomba_HL_Explosion_Play"),
CreateNetworkSoundDef("Roomba_Breaking_Play")
});
}
public static NetworkSoundEventDef CreateNetworkSoundDef(string eventName)
{
NetworkSoundEventDef obj = ScriptableObject.CreateInstance<NetworkSoundEventDef>();
obj.eventName = eventName;
return obj;
}
private IEnumerator LoadAssetBundle(string assetBundleFullPath, IProgress<float> progress, Action<AssetBundle> onAssetBundleLoaded)
{
AssetBundleCreateRequest assetBundleCreateRequest = AssetBundle.LoadFromFileAsync(assetBundleFullPath);
while (!((AsyncOperation)assetBundleCreateRequest).isDone)
{
progress.Report(((AsyncOperation)assetBundleCreateRequest).progress);
yield return null;
}
onAssetBundleLoaded(assetBundleCreateRequest.assetBundle);
}
private static IEnumerator LoadAllAssetsAsync<T>(AssetBundle assetBundle, IProgress<float> progress, Action<T[]> onAssetsLoaded) where T : Object
{
AssetBundleRequest sceneDefsRequest = assetBundle.LoadAllAssetsAsync<T>();
while (!((AsyncOperation)sceneDefsRequest).isDone)
{
progress.Report(((AsyncOperation)sceneDefsRequest).progress);
yield return null;
}
onAssetsLoaded(sceneDefsRequest.allAssets.Cast<T>().ToArray());
}
internal static void LoadSoundBanks(string soundbanksFolderPath)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: Invalid comparison between Unknown and I4
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Invalid comparison between Unknown and I4
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
AKRESULT val = AkSoundEngine.AddBasePath(soundbanksFolderPath);
if ((int)val == 1)
{
Log.Info("Added bank base path : " + soundbanksFolderPath);
}
else
{
Log.Error("Error adding base path : " + soundbanksFolderPath + " " + $"Error code : {val}");
}
uint num = default(uint);
val = AkSoundEngine.LoadBank("RoombaSoundBank.bnk", ref num);
if ((int)val == 1)
{
Log.Info("Added bank : RoombaSoundBank.bnk");
}
else
{
Log.Error("Error loading bank : RoombaSoundBank.bnk " + $"Error code : {val}");
}
}
}
public class DropItemOnDeath : MonoBehaviour, IOnKilledServerReceiver
{
public ItemDef itemToDrop;
public bool dropRandomChest1Item;
public float dropAngle;
private static PickupDropTable dropTable = Addressables.LoadAssetAsync<PickupDropTable>((object)"RoR2/Base/Chest1/dtChest1.asset").WaitForCompletion();
private void OnEnable()
{
((Component)this).gameObject.layer = LayerIndex.defaultLayer.intVal;
}
private void FixedUpdate()
{
if (((Component)this).gameObject.layer != LayerIndex.defaultLayer.intVal)
{
((Component)this).gameObject.layer = LayerIndex.defaultLayer.intVal;
}
}
public void OnKilledServer(DamageReport damageReport)
{
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Expected O, but got Unknown
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: Unknown result type (might be due to invalid IL or missing references)
//IL_006f: Unknown result type (might be due to invalid IL or missing references)
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_008d: Unknown result type (might be due to invalid IL or missing references)
//IL_0092: Unknown result type (might be due to invalid IL or missing references)
//IL_0097: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_009d: Unknown result type (might be due to invalid IL or missing references)
//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
if (NetworkServer.active)
{
PickupIndex val = PickupIndex.none;
if (dropRandomChest1Item)
{
val = dropTable.GenerateDrop(new Xoroshiro128Plus(Run.instance.treasureRng.nextUlong));
}
else if (Object.op_Implicit((Object)(object)itemToDrop))
{
val = PickupCatalog.FindPickupIndex(itemToDrop.itemIndex);
}
if (val != PickupIndex.none)
{
Vector3 val2 = Quaternion.AngleAxis(dropAngle, Vector3.up) * (Vector3.up * 40f + Vector3.forward * 5f);
PickupDropletController.CreatePickupDroplet(val, ((Component)this).transform.position + Vector3.up * 3f, val2);
}
}
}
}
public class Language
{
public const string LanguageFolder = "Language";
public static void Language_onCurrentLanguageChanged()
{
Language currentLanguage = Language.currentLanguage;
string text = Path.Combine(Path.GetDirectoryName(typeof(RoombaPlugin).Assembly.Location), "Language", Language.currentLanguageName);
if (!Directory.Exists(text))
{
return;
}
List<KeyValuePair<string, string>> list = new List<KeyValuePair<string, string>>();
Language.LoadAllTokensFromFolder(text, list);
foreach (KeyValuePair<string, string> item in list)
{
string key = item.Key;
if (!(key == "ROOMBA_ITEM_POSTER_DESCRIPTION"))
{
if (key == "ROOMBA_ITEM_MAXWELL_DESCRIPTION")
{
string text2 = string.Format(item.Value, (RoombaConfigs.MaxwellExplosionChance.Value / 100f).ToString("###%"), (RoombaConfigs.MaxwellExplosionDamage.Value / 100f).ToString("###%"), (RoombaConfigs.MaxwellExplosionDamagePerStack.Value / 100f).ToString("###%"), RoombaConfigs.MaxwellExplosionRadius.Value);
currentLanguage.SetStringByToken("ROOMBA_ITEM_MAXWELL_DESCRIPTION", text2);
}
}
else
{
string text3 = string.Format(item.Value, (RoombaConfigs.PosterDamageAdd.Value / 100f).ToString("###%"), (RoombaConfigs.PosterDamageAddPerStack.Value / 100f).ToString("###%"), (RoombaConfigs.PosterShieldHealthPercent.Value / 100f).ToString("###%"), (RoombaConfigs.PosterShieldHealthPercentPerStack.Value / 100f).ToString("###%"));
currentLanguage.SetStringByToken("ROOMBA_ITEM_POSTER_DESCRIPTION", text3);
}
}
}
}
internal static class Log
{
private static ManualLogSource _logSource;
internal static void Init(ManualLogSource logSource)
{
_logSource = logSource;
}
internal static void Debug(object data)
{
_logSource.LogDebug(data);
}
internal static void Error(object data)
{
_logSource.LogError(data);
}
internal static void Fatal(object data)
{
_logSource.LogFatal(data);
}
internal static void Info(object data)
{
_logSource.LogInfo(data);
}
internal static void Message(object data)
{
_logSource.LogMessage(data);
}
internal static void Warning(object data)
{
_logSource.LogWarning(data);
}
}
public static class RoombaConfigs
{
public static ConfigEntry<float> RoombaSpawnChance;
public static ConfigEntry<bool> MakeVoidExplosionBypassArmor;
public static ConfigEntry<float> RoombaNothingWeight;
public static ConfigEntry<float> RoombaMaxwellWeight;
public static ConfigEntry<float> RoombaTVWeight;
public static ConfigEntry<bool> CustomItems;
public static ConfigEntry<bool> RoombaCanDropItems;
public static ConfigEntry<float> TargetRefreshTimer;
public static ConfigEntry<float> MaxwellExplosionChance;
public static ConfigEntry<float> MaxwellExplosionDamage;
public static ConfigEntry<float> MaxwellExplosionDamagePerStack;
public static ConfigEntry<float> MaxwellExplosionRadius;
public static ConfigEntry<float> PosterDamageAdd;
public static ConfigEntry<float> PosterDamageAddPerStack;
public static ConfigEntry<float> PosterShieldHealthPercent;
public static ConfigEntry<float> PosterShieldHealthPercentPerStack;
public static void PopulateConfigs(ConfigFile Config)
{
RoombaSpawnChance = Config.Bind<float>("Roomba", "Chance To Spawn", 30f, "Chance of Roomba to spawn on stage start.");
MakeVoidExplosionBypassArmor = Config.Bind<bool>("Void Death", "Make Void Explosion Bypass Armor", true, "Add BypassArmor flag to all void explosions that result in instant death. Used so you can kill Roomba with it.");
RoombaNothingWeight = Config.Bind<float>("Roomba", "Roomba with Nothing Weight", 8f, "Weight chance of Roomba with nothing on it. Set to 0 to disable.");
RoombaMaxwellWeight = Config.Bind<float>("Roomba", "Roomba with Maxwell Weight", 4f, "Weight chance of Roomba with Maxwell on it. Set to 0 to disable.");
RoombaTVWeight = Config.Bind<float>("Roomba", "Roomba with TV Weight", 4f, "Weight chance of Roomba with TV on it. Set to 0 to disable.");
CustomItems = Config.Bind<bool>("Items", "Enable Custom Items", true, "Enable custom items.");
RoombaCanDropItems = Config.Bind<bool>("Items", "Roomba Drops Normal Chest Items", true, "Roomba will drop items. It will drop item equal to normal chest, if you want to disable custom drops, uncheck Enable Custom Items.");
TargetRefreshTimer = Config.Bind<float>("Roomba", "Target Refresh Timer", 30f, "How frequently Roomba refreshes its target to go to.");
MaxwellExplosionChance = Config.Bind<float>("Maxwell", "Maxwell Proc Chance", 5f, "Chance to spawn Evil Maxwell.");
MaxwellExplosionDamage = Config.Bind<float>("Maxwell", "Maxwell Explosion Damage", 600f, "Damage of Evil Maxwell explosion, in percent of total damage.");
MaxwellExplosionDamagePerStack = Config.Bind<float>("Maxwell", "Maxwell Explosion Damage Per Stack", 600f, "Damage of Evil Maxwell explosion per stack, in percent of total damage.");
MaxwellExplosionRadius = Config.Bind<float>("Maxwell", "Maxwell Explosion Radius", 11f, "Explosion radius of Evil Maxwell. By default value is the same as explosion of Commando's grenade.");
PosterDamageAdd = Config.Bind<float>("Poster", "Poster Damage Increase", 5f, "Damage increase of Poster, in percent.");
PosterDamageAddPerStack = Config.Bind<float>("Poster", "Poster Damage Increase Per Stack", 5f, "Damage increase of Poster, in percent per stack.");
PosterShieldHealthPercent = Config.Bind<float>("Poster", "Poster Shield Value", 15f, "How much of max health as shield Poster gives.");
PosterShieldHealthPercentPerStack = Config.Bind<float>("Poster", "Poster Shield Value Per Stack", 15f, "How much of max health as shield Poster gives per stack.");
}
}
public class RoombaFactory
{
public static CharacterSpawnCard cscRoomba { get; internal set; }
public static CharacterSpawnCard cscRoombaMaxwell { get; internal set; }
public static CharacterSpawnCard cscRoombaTV { get; internal set; }
public GameObject CreateRoombaBody(GameObject roombaPrefab, GameObject bombEffect)
{
//IL_0146: Unknown result type (might be due to invalid IL or missing references)
//IL_01de: Unknown result type (might be due to invalid IL or missing references)
//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
//IL_01fb: Unknown result type (might be due to invalid IL or missing references)
//IL_0200: Unknown result type (might be due to invalid IL or missing references)
//IL_0210: Unknown result type (might be due to invalid IL or missing references)
//IL_0215: Unknown result type (might be due to invalid IL or missing references)
//IL_027a: Unknown result type (might be due to invalid IL or missing references)
//IL_027f: 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_0295: Unknown result type (might be due to invalid IL or missing references)
//IL_02ba: Unknown result type (might be due to invalid IL or missing references)
//IL_02bf: Unknown result type (might be due to invalid IL or missing references)
//IL_02d0: Unknown result type (might be due to invalid IL or missing references)
//IL_02d5: Unknown result type (might be due to invalid IL or missing references)
//IL_0349: Unknown result type (might be due to invalid IL or missing references)
//IL_034e: Unknown result type (might be due to invalid IL or missing references)
//IL_0435: Unknown result type (might be due to invalid IL or missing references)
//IL_043a: Unknown result type (might be due to invalid IL or missing references)
//IL_048e: Unknown result type (might be due to invalid IL or missing references)
//IL_0493: Unknown result type (might be due to invalid IL or missing references)
//IL_04a1: Unknown result type (might be due to invalid IL or missing references)
//IL_04f4: Unknown result type (might be due to invalid IL or missing references)
//IL_0513: Unknown result type (might be due to invalid IL or missing references)
//IL_0518: Unknown result type (might be due to invalid IL or missing references)
//IL_05f0: Unknown result type (might be due to invalid IL or missing references)
//IL_0612: Unknown result type (might be due to invalid IL or missing references)
//IL_0627: Unknown result type (might be due to invalid IL or missing references)
//IL_0629: Unknown result type (might be due to invalid IL or missing references)
//IL_065f: Unknown result type (might be due to invalid IL or missing references)
//IL_0664: Unknown result type (might be due to invalid IL or missing references)
//IL_068f: Unknown result type (might be due to invalid IL or missing references)
//IL_06aa: Unknown result type (might be due to invalid IL or missing references)
//IL_06ac: Unknown result type (might be due to invalid IL or missing references)
Transform val = roombaPrefab.transform.Find("ModelBase");
Transform aimOriginTransform = roombaPrefab.transform.Find("ModelBase/AimOrigin");
Transform val2 = roombaPrefab.transform.Find("ModelBase/mdlRoomba");
Transform val3 = roombaPrefab.transform.Find("ModelBase/mdlRoomba/MainHurtBox");
Transform focusPointTransform = roombaPrefab.transform.Find("ModelBase/mdlRoomba/LogBookTarget");
Transform cameraPositionTransform = roombaPrefab.transform.Find("ModelBase/mdlRoomba/LogBookTarget/LogBookCamera");
Transform val4 = roombaPrefab.transform.Find("ModelBase/mdlRoomba/maxwell");
Transform val5 = roombaPrefab.transform.Find("ModelBase/mdlRoomba/TVPrefab");
Transform transform = roombaPrefab.transform.Find("ModelBase/mdlRoomba/SmokeBomb");
Renderer component = (Renderer)(object)((Component)roombaPrefab.transform.Find("ModelBase/mdlRoomba/roomba")).gameObject.GetComponent<MeshRenderer>();
roombaPrefab.AddComponent<NetworkIdentity>().localPlayerAuthority = true;
CharacterDirection val6 = roombaPrefab.AddComponent<CharacterDirection>();
val6.targetTransform = val;
val6.turnSpeed = 720f;
CharacterMotor val7 = roombaPrefab.AddComponent<CharacterMotor>();
val7.characterDirection = val6;
val7.muteWalkMotion = true;
val7.mass = 100f;
val7.airControl = 0.05f;
val7.generateParametersOnAwake = true;
roombaPrefab.AddComponent<InputBankTest>();
CharacterBody val8 = null;
if (!roombaPrefab.TryGetComponent<CharacterBody>(ref val8))
{
val8 = roombaPrefab.AddComponent<CharacterBody>();
}
val8.baseNameToken = "ROOMBA_ROOMBA_BODY_NAME";
val8.bodyFlags = (BodyFlags)0;
val8.mainRootSpeed = 33f;
val8.baseMaxHealth = 200f;
val8.baseMoveSpeed = 5f;
val8.baseAcceleration = 180f;
val8.baseJumpPower = 16f;
val8.baseDamage = 0f;
val8.baseAttackSpeed = 1f;
val8.baseVisionDistance = 1f;
val8.baseJumpCount = 1;
val8.sprintingSpeedMultiplier = 2f;
val8.autoCalculateLevelStats = false;
val8.levelMaxHealth = 60f;
val8.aimOriginTransform = aimOriginTransform;
val8.hullClassification = (HullClassification)0;
val8.bodyColor = Color.white;
val8.preferredInitialStateType = new SerializableEntityStateType(typeof(GenericCharacterMain));
roombaPrefab.AddComponent<CameraTargetParams>().cameraParams = Addressables.LoadAssetAsync<CharacterCameraParams>((object)"RoR2/Base/Common/ccpStandard.asset").WaitForCompletion();
ModelLocator obj = roombaPrefab.AddComponent<ModelLocator>();
obj.modelTransform = val2;
obj.modelBaseTransform = val;
obj.autoUpdateModelTransform = true;
obj.normalizeToFloor = true;
obj.normalSmoothdampTime = 0.1f;
obj.normalMaxAngleDelta = 60f;
EntityStateMachine val9 = roombaPrefab.AddComponent<EntityStateMachine>();
val9.customName = "Body";
val9.initialStateType = new SerializableEntityStateType(typeof(RoombaSpawnState));
val9.mainStateType = new SerializableEntityStateType(typeof(GenericCharacterMain));
EntityStateMachine val10 = roombaPrefab.AddComponent<EntityStateMachine>();
val10.customName = "Weapon";
val10.initialStateType = new SerializableEntityStateType(typeof(InvincibleRoombaState));
val10.mainStateType = new SerializableEntityStateType(typeof(InvincibleRoombaState));
roombaPrefab.AddComponent<SkillLocator>();
TeamComponent val11 = null;
if (!roombaPrefab.TryGetComponent<TeamComponent>(ref val11))
{
val11 = roombaPrefab.AddComponent<TeamComponent>();
}
val11.teamIndex = (TeamIndex)0;
HealthComponent val12 = roombaPrefab.AddComponent<HealthComponent>();
val12.globalDeathEventChanceCoefficient = 1f;
val12.dontShowHealthbar = true;
roombaPrefab.AddComponent<Interactor>().maxInteractionDistance = 3f;
roombaPrefab.AddComponent<InteractionDriver>();
CharacterDeathBehavior obj2 = roombaPrefab.AddComponent<CharacterDeathBehavior>();
obj2.deathStateMachine = val9;
obj2.deathState = new SerializableEntityStateType(typeof(GenericCharacterDeath));
CharacterNetworkTransform obj3 = roombaPrefab.AddComponent<CharacterNetworkTransform>();
obj3.positionTransmitInterval = 0.1f;
obj3.interpolationFactor = 2f;
roombaPrefab.AddComponent<NetworkStateMachine>().stateMachines = (EntityStateMachine[])(object)new EntityStateMachine[2] { val9, val10 };
SfxLocator val13 = roombaPrefab.AddComponent<SfxLocator>();
if (Object.op_Implicit((Object)(object)val4))
{
val13.aliveLoopStart = "Roomba_Maxwell_Play";
val13.aliveLoopStop = "Roomba_Maxwell_Stop";
}
else if (Object.op_Implicit((Object)(object)val5))
{
val13.aliveLoopStart = "Roomba_TV_Play";
val13.aliveLoopStop = "Roomba_TV_Stop";
}
else
{
val13.aliveLoopStart = "Roomba_Roomba_Play";
val13.aliveLoopStop = "Roomba_Roomba_Stop";
}
CapsuleCollider component2 = roombaPrefab.GetComponent<CapsuleCollider>();
KinematicCharacterMotor obj4 = roombaPrefab.AddComponent<KinematicCharacterMotor>();
obj4.CharacterController = (ICharacterController)(object)val7;
obj4.Capsule = component2;
obj4._attachedRigidbody = roombaPrefab.GetComponent<Rigidbody>();
obj4.CapsuleRadius = component2.radius;
obj4.CapsuleHeight = component2.height;
if (component2.center != Vector3.zero)
{
Log.Error("CapsuleCollider for " + ((object)roombaPrefab)?.ToString() + " has non-zero center. This WILL result in pathing issues for AI.");
}
obj4.CapsuleYOffset = 0f;
obj4.GroundDetectionExtraDistance = 0f;
obj4.MaxStableSlopeAngle = 55f;
obj4.StableGroundLayers = ((LayerIndex)(ref LayerIndex.world)).mask;
obj4.DiscreteCollisionEvents = false;
obj4.StepHandling = (StepHandlingMethod)1;
obj4.MaxStepHeight = 0.2f;
obj4.AllowSteppingWithoutStableGrounding = false;
obj4.MinRequiredStepDepth = 0.1f;
obj4.LedgeAndDenivelationHandling = true;
obj4.MaxStableDistanceFromLedge = 0.5f;
obj4.MaxVelocityForLedgeSnap = 0f;
obj4.MaxStableDenivelationAngle = 55f;
obj4.InteractiveRigidbodyHandling = true;
obj4.RigidbodyInteractionType = (RigidbodyInteractionType)0;
obj4.SimulatedCharacterMass = 1f;
obj4.PreserveAttachedRigidbodyMomentum = true;
obj4.HasPlanarConstraint = false;
obj4.PlanarConstraintAxis = Vector3.forward;
obj4.CheckMovementInitialOverlaps = true;
obj4.KillVelocityWhenExceedMaxMovementIterations = true;
obj4.KillRemainingMovementWhenExceedMaxMovementIterations = true;
obj4.timeUntilUpdate = 0f;
obj4.playerCharacter = false;
if (RoombaConfigs.RoombaCanDropItems.Value)
{
DropItemOnDeath dropItemOnDeath = roombaPrefab.AddComponent<DropItemOnDeath>();
dropItemOnDeath.dropRandomChest1Item = true;
dropItemOnDeath.dropAngle = 0f;
}
RoombaInteractableManager roombaInteractableManager = roombaPrefab.AddComponent<RoombaInteractableManager>();
roombaInteractableManager.body = val8;
roombaInteractableManager.smokeBombPrefab = bombEffect;
roombaPrefab.AddComponent<EntityLocator>().entity = roombaPrefab;
GameObject gameObject = ((Component)val2).gameObject;
HurtBox val14 = ((Component)val3).gameObject.AddComponent<HurtBox>();
val14.healthComponent = val12;
HurtBoxGroup val15 = gameObject.AddComponent<HurtBoxGroup>();
val15.hurtBoxes = (HurtBox[])(object)new HurtBox[1] { val14 };
val15.mainHurtBox = val14;
gameObject.AddComponent<DestroyOnUnseen>();
CharacterModel obj5 = gameObject.AddComponent<CharacterModel>();
obj5.body = val8;
obj5.autoPopulateLightInfos = true;
obj5.baseRendererInfos = (RendererInfo[])(object)new RendererInfo[1]
{
new RendererInfo
{
renderer = component,
defaultMaterial = component.materials[0],
defaultShadowCastingMode = (ShadowCastingMode)1,
ignoreOverlays = false,
hideOnDeath = false
}
};
ModelPanelParameters obj6 = gameObject.AddComponent<ModelPanelParameters>();
obj6.focusPointTransform = focusPointTransform;
obj6.cameraPositionTransform = cameraPositionTransform;
obj6.modelRotation = new Quaternion(0f, 0f, 0f, 1f);
obj6.minDistance = 1.5f;
obj6.maxDistance = 2.5f;
gameObject.AddComponent<ChildLocator>().transformPairs = (NameTransformPair[])(object)new NameTransformPair[1]
{
new NameTransformPair
{
name = "SmokeBomb",
transform = transform
}
};
if (Object.op_Implicit((Object)(object)val4) && RoombaConfigs.CustomItems.Value)
{
DropItemOnDeath dropItemOnDeath2 = roombaPrefab.AddComponent<DropItemOnDeath>();
dropItemOnDeath2.itemToDrop = ContentProvider.Items.Maxwell;
dropItemOnDeath2.dropAngle = 270f;
}
if (Object.op_Implicit((Object)(object)val5) && RoombaConfigs.CustomItems.Value)
{
DropItemOnDeath dropItemOnDeath3 = roombaPrefab.AddComponent<DropItemOnDeath>();
dropItemOnDeath3.itemToDrop = ContentProvider.Items.Poster;
dropItemOnDeath3.dropAngle = 180f;
}
PrefabAPI.RegisterNetworkPrefab(roombaPrefab);
return roombaPrefab;
}
public GameObject CreateRoombaMaster(GameObject roombaMaster, GameObject roombaBody)
{
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_0098: Unknown result type (might be due to invalid IL or missing references)
//IL_00af: Unknown result type (might be due to invalid IL or missing references)
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
roombaMaster.AddComponent<NetworkIdentity>().localPlayerAuthority = true;
CharacterMaster obj = roombaMaster.AddComponent<CharacterMaster>();
obj.bodyPrefab = roombaBody;
obj.spawnOnStart = false;
obj.teamIndex = (TeamIndex)0;
obj.destroyOnBodyDeath = true;
obj.preventGameOver = true;
roombaMaster.AddComponent<Inventory>();
EntityStateMachine val = roombaMaster.AddComponent<EntityStateMachine>();
val.customName = "AI";
val.initialStateType = new SerializableEntityStateType(typeof(WanderFar));
val.mainStateType = new SerializableEntityStateType(typeof(WanderFar));
BaseAI obj2 = roombaMaster.AddComponent<BaseAI>();
obj2.fullVision = false;
obj2.neverRetaliateFriendlies = true;
obj2.enemyAttentionDuration = 0f;
obj2.desiredSpawnNodeGraphType = (GraphType)0;
obj2.stateMachine = val;
obj2.scanState = new SerializableEntityStateType(typeof(WanderFar));
obj2.isHealer = false;
obj2.enemyAttention = 0f;
obj2.aimVectorDampTime = 0.05f;
obj2.aimVectorMaxSpeed = 180f;
PrefabAPI.RegisterNetworkPrefab(roombaMaster);
return roombaMaster;
}
public CharacterSpawnCard CreateCharacterSpawnCard(GameObject roombaMaster)
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
CharacterSpawnCard obj = ScriptableObject.CreateInstance<CharacterSpawnCard>();
((SpawnCard)obj).prefab = roombaMaster;
((SpawnCard)obj).sendOverNetwork = true;
((SpawnCard)obj).hullSize = (HullClassification)0;
((SpawnCard)obj).nodeGraphType = (GraphType)0;
((SpawnCard)obj).requiredFlags = (NodeFlags)0;
((SpawnCard)obj).forbiddenFlags = (NodeFlags)4;
((SpawnCard)obj).directorCreditCost = 1;
((SpawnCard)obj).occupyPosition = true;
((SpawnCard)obj).eliteRules = (EliteRules)0;
obj.noElites = true;
obj.forbiddenAsBoss = true;
return obj;
}
}
public class RoombaInteractableManager : NetworkBehaviour, IInteractable
{
[SyncVar]
public bool available;
public CharacterBody body;
public GameObject smokeBombPrefab;
private CharacterBody interactor;
public bool Networkavailable
{
get
{
return available;
}
[param: In]
set
{
((NetworkBehaviour)this).SetSyncVar<bool>(value, ref available, 1u);
}
}
public void Awake()
{
Networkavailable = true;
}
public string GetContextString([NotNull] Interactor activator)
{
return Language.GetString("ROOMBA_INTERACTABLE_ROOMBA_CONTEXT");
}
public Interactability GetInteractability([NotNull] Interactor activator)
{
if (available)
{
CharacterBody val = default(CharacterBody);
if (Object.op_Implicit((Object)(object)activator) && ((Component)activator).TryGetComponent<CharacterBody>(ref val))
{
if (Object.op_Implicit((Object)(object)val.inventory))
{
if (val.inventory.GetItemCount(ContentProvider.Items.PileOfDirt) <= 0)
{
return (Interactability)0;
}
return (Interactability)2;
}
return (Interactability)0;
}
return (Interactability)0;
}
return (Interactability)0;
}
public void OnInteractionBegin([NotNull] Interactor activator)
{
//IL_0088: Unknown result type (might be due to invalid IL or missing references)
if (!NetworkServer.active || !Object.op_Implicit((Object)(object)body) || !Object.op_Implicit((Object)(object)body.healthComponent) || !available)
{
return;
}
Networkavailable = false;
body.AddBuff(Buffs.Slow80);
interactor = ((activator != null) ? ((Component)activator).GetComponent<CharacterBody>() : null);
CharacterBody obj = interactor;
if (obj != null)
{
Inventory inventory = obj.inventory;
if (inventory != null)
{
inventory.RemoveItem(ContentProvider.Items.PileOfDirt, 1);
}
}
EntitySoundManager.EmitSoundServer((AkEventIdArg)"Roomba_Breaking_Play", ((Component)body).gameObject);
((MonoBehaviour)this).Invoke("SpawnSmokeEffect", 4f);
((MonoBehaviour)this).Invoke("DestroyRoomba", 5f);
}
private void SpawnSmokeEffect()
{
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: Expected O, but got Unknown
EffectManager.SimpleMuzzleFlash(smokeBombPrefab, ((Component)body).gameObject, "SmokeBomb", true);
EntitySoundManager.EmitSoundServer((AkEventIdArg)"Roomba_HL_Explosion_Play", ((Component)body).gameObject);
if (Object.op_Implicit((Object)(object)interactor))
{
Chat.SendBroadcastChat((ChatMessageBase)new SubjectFormatChatMessage
{
subjectAsCharacterBody = interactor,
baseToken = "ROOMBA_INTERACTABLE_CHAT_MESSAGE_BROKEN"
});
}
}
private void DestroyRoomba()
{
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
body.healthComponent.Suicide((GameObject)null, (GameObject)null, default(DamageTypeCombo));
}
public bool ShouldIgnoreSpherecastForInteractibility([NotNull] Interactor activator)
{
return false;
}
public bool ShouldShowOnScanner()
{
return true;
}
public bool ShouldProximityHighlight()
{
return true;
}
private void UNetVersion()
{
}
public override bool OnSerialize(NetworkWriter writer, bool forceAll)
{
if (forceAll)
{
writer.Write(available);
return true;
}
bool flag = false;
if ((((NetworkBehaviour)this).syncVarDirtyBits & (true ? 1u : 0u)) != 0)
{
if (!flag)
{
writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits);
flag = true;
}
writer.Write(available);
}
if (!flag)
{
writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits);
}
return flag;
}
public override void OnDeserialize(NetworkReader reader, bool initialState)
{
if (initialState)
{
available = reader.ReadBoolean();
return;
}
int num = (int)reader.ReadPackedUInt32();
if (((uint)num & (true ? 1u : 0u)) != 0)
{
available = reader.ReadBoolean();
}
}
}
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("com.Viliger.Roomba", "Roomba", "1.0.10")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class RoombaPlugin : BaseUnityPlugin
{
public const string Author = "Viliger";
public const string ModName = "Roomba";
public const string Version = "1.0.10";
public const string GUID = "com.Viliger.Roomba";
private void Awake()
{
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: 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_0093: Unknown result type (might be due to invalid IL or missing references)
//IL_0098: Unknown result type (might be due to invalid IL or missing references)
//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
//IL_00af: Unknown result type (might be due to invalid IL or missing references)
Log.Init(((BaseUnityPlugin)this).Logger);
RoombaConfigs.PopulateConfigs(((BaseUnityPlugin)this).Config);
TeamDef teamDef = TeamCatalog.GetTeamDef((TeamIndex)0);
if (teamDef != null && !Object.op_Implicit((Object)(object)teamDef.levelUpEffect))
{
teamDef.levelUpEffect = LegacyResourcesAPI.Load<GameObject>("Prefabs/Effects/LevelUpEffectEnemy");
}
if (RoombaConfigs.MakeVoidExplosionBypassArmor.Value)
{
AddBypassArmorToProjectileDamage(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Nullifier/NullifierDeathBombProjectile.prefab").WaitForCompletion());
AddBypassArmorToProjectileDamage(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC1/VoidJailer/VoidJailerDeathBombProjectile.prefab").WaitForCompletion());
AddBypassArmorToProjectileDamage(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC1/VoidJailer/VoidJailerDeathBombProjectileStill.prefab").WaitForCompletion());
AddBypassArmorToProjectileDamage(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC1/VoidMegaCrab/VoidMegaCrabDeathBombletsProjectile.prefab").WaitForCompletion());
AddBypassArmorToProjectileDamage(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC1/VoidMegaCrab/VoidMegaCrabDeathBombProjectile.prefab").WaitForCompletion());
}
Hooks();
}
private void Hooks()
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Expected O, but got Unknown
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Expected O, but got Unknown
ContentManager.collectContentPackProviders += new CollectContentPackProvidersDelegate(ContentManager_collectContentPackProviders);
SceneDirector.onPostPopulateSceneServer += SceneDirector_onPostPopulateSceneServer;
Language.collectLanguageRootFolders += CollectLanguageRootFolders;
Language.onCurrentLanguageChanged += Language.Language_onCurrentLanguageChanged;
if (RoombaConfigs.CustomItems.Value)
{
GlobalEventManager.onServerDamageDealt += Maxwell.GlobalEventManager_onServerDamageDealt;
RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(Poster.RecalculateStatsAPI_GetStatCoefficients);
}
}
private static void AddBypassArmorToProjectileDamage(GameObject deathBomb)
{
//IL_0014: 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)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
ProjectileDamage val = default(ProjectileDamage);
if (Object.op_Implicit((Object)(object)deathBomb) && deathBomb.TryGetComponent<ProjectileDamage>(ref val))
{
ProjectileDamage obj = val;
obj.damageType |= DamageTypeCombo.op_Implicit((DamageType)2);
}
}
private void SceneDirector_onPostPopulateSceneServer(SceneDirector sceneDirector)
{
if (SceneInfo.instance.countsAsStage)
{
TrySpawnRoomba(sceneDirector);
if (RoombaConfigs.CustomItems.Value)
{
TrySpawnPileOfDirt(sceneDirector);
}
}
}
private static void TrySpawnPileOfDirt(SceneDirector sceneDirector)
{
//IL_0026: 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)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Expected O, but got Unknown
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Expected O, but got Unknown
if (sceneDirector.rng.RangeFloat(0f, 100f) < RoombaConfigs.RoombaSpawnChance.Value)
{
DirectorSpawnRequest val = new DirectorSpawnRequest(PileOfDirt.scPileOfDirt, new DirectorPlacementRule
{
placementMode = (PlacementMode)4
}, sceneDirector.rng);
val.teamIndexOverride = (TeamIndex)0;
val.ignoreTeamMemberLimit = true;
DirectorCore.instance.TrySpawnObject(val);
}
}
private static void TrySpawnRoomba(SceneDirector sceneDirector)
{
//IL_0079: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
//IL_0080: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Expected O, but got Unknown
//IL_008b: Unknown result type (might be due to invalid IL or missing references)
//IL_0091: Expected O, but got Unknown
if (sceneDirector.rng.RangeFloat(0f, 100f) < RoombaConfigs.RoombaSpawnChance.Value)
{
WeightedSelection<CharacterSpawnCard> obj = new WeightedSelection<CharacterSpawnCard>(8);
obj.AddChoice(RoombaFactory.cscRoomba, RoombaConfigs.RoombaNothingWeight.Value);
obj.AddChoice(RoombaFactory.cscRoombaMaxwell, RoombaConfigs.RoombaMaxwellWeight.Value);
obj.AddChoice(RoombaFactory.cscRoombaTV, RoombaConfigs.RoombaTVWeight.Value);
DirectorSpawnRequest val = new DirectorSpawnRequest((SpawnCard)(object)obj.Evaluate(sceneDirector.rng.nextNormalizedFloat), new DirectorPlacementRule
{
placementMode = (PlacementMode)4
}, sceneDirector.rng);
val.teamIndexOverride = (TeamIndex)0;
val.ignoreTeamMemberLimit = true;
val.onSpawnedServer = (Action<SpawnResult>)Delegate.Combine(val.onSpawnedServer, new Action<SpawnResult>(OnRoombaSpawn));
DirectorCore.instance.TrySpawnObject(val);
}
}
private static void OnRoombaSpawn(SpawnResult result)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
if (result.success)
{
CharacterMaster component = result.spawnedInstance.GetComponent<CharacterMaster>();
if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component.inventory))
{
component.inventory.GiveItem(Items.TeleportWhenOob, 1);
}
}
}
private void ContentManager_collectContentPackProviders(AddContentPackProviderDelegate addContentPackProvider)
{
addContentPackProvider.Invoke((IContentPackProvider)(object)new ContentProvider());
}
public void CollectLanguageRootFolders(List<string> folders)
{
folders.Add(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "Language"));
}
}
}
namespace RoR2_Roomba.States
{
public class InvincibleRoombaState : Idle
{
public override void OnEnter()
{
((EntityState)this).OnEnter();
if (NetworkServer.active)
{
((EntityState)this).characterBody.AddBuff(Buffs.HiddenInvincibility);
}
}
}
public class LookBusyFar : LookBusy
{
public override void FixedUpdate()
{
((EntityState)this).fixedAge = ((EntityState)this).fixedAge + Time.fixedDeltaTime;
if (!Object.op_Implicit((Object)(object)((BaseAIState)this).ai) || !Object.op_Implicit((Object)(object)((BaseAIState)this).body))
{
return;
}
if (((BaseAIState)this).ai.hasAimConfirmation)
{
base.lookTimer -= Time.fixedDeltaTime;
if (base.lookTimer <= 0f)
{
((LookBusy)this).PickNewTargetLookDirection();
}
}
if (((EntityState)this).fixedAge >= base.duration)
{
((EntityState)this).outer.SetNextState((EntityState)(object)new WanderFar());
}
}
}
public class PileOfDirtDeath : BaseState
{
public override void OnEnter()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: 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)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
((BaseState)this).OnEnter();
Vector3 val = Vector3.up * 20f + Vector3.forward * 5f;
PickupDropletController.CreatePickupDroplet(PickupCatalog.FindPickupIndex(ContentProvider.Items.PileOfDirt.itemIndex), ((EntityState)this).transform.position + Vector3.up * 3f, val);
EntityState.Destroy((Object)(object)((EntityState)this).gameObject);
}
}
public class RoombaSpawnState : GenericCharacterSpawnState
{
public override void OnEnter()
{
((GenericCharacterSpawnState)this).OnEnter();
}
}
public class WanderFar : Wander
{
private float refreshTimer;
public static float refreshTime => RoombaConfigs.TargetRefreshTimer.Value;
public override void OnEnter()
{
//IL_0080: Unknown result type (might be due to invalid IL or missing references)
//IL_00a6: 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_00ad: Unknown result type (might be due to invalid IL or missing references)
((BaseAIState)this).characterMaster = ((EntityState)this).GetComponent<CharacterMaster>();
((BaseAIState)this).ai = ((EntityState)this).GetComponent<BaseAI>();
if (Object.op_Implicit((Object)(object)((BaseAIState)this).ai))
{
((BaseAIState)this).body = ((BaseAIState)this).ai.body;
((BaseAIState)this).bodyTransform = ((BaseAIState)this).ai.bodyTransform;
((BaseAIState)this).bodyInputBank = ((BaseAIState)this).ai.bodyInputBank;
((BaseAIState)this).bodyCharacterMotor = ((BaseAIState)this).ai.bodyCharacterMotor;
((BaseAIState)this).bodySkillLocator = ((BaseAIState)this).ai.bodySkillLocator;
}
((BaseAIState)this).bodyInputs = default(BodyInputs);
if (Object.op_Implicit((Object)(object)((BaseAIState)this).ai) && Object.op_Implicit((Object)(object)((BaseAIState)this).body))
{
Agent broadNavigationAgent = ((BaseAIState)this).ai.broadNavigationAgent;
SetNewRandomTarget(broadNavigationAgent);
base.aiUpdateTimer = 0.16f;
}
}
private void SetNewRandomTarget(Agent broadNavigationAgent)
{
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
base.targetPosition = PickRandomReachablePosition();
if (base.targetPosition.HasValue)
{
((Agent)(ref broadNavigationAgent)).goalPosition = base.targetPosition.Value;
((Agent)(ref broadNavigationAgent)).InvalidatePath();
}
((Wander)this).PickNewTargetLookPosition();
}
public override void FixedUpdate()
{
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_009b: Unknown result type (might be due to invalid IL or missing references)
//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
//IL_0108: Unknown result type (might be due to invalid IL or missing references)
//IL_010d: Unknown result type (might be due to invalid IL or missing references)
//IL_0119: Unknown result type (might be due to invalid IL or missing references)
//IL_0124: Unknown result type (might be due to invalid IL or missing references)
//IL_0129: Unknown result type (might be due to invalid IL or missing references)
//IL_012e: Unknown result type (might be due to invalid IL or missing references)
//IL_0132: Unknown result type (might be due to invalid IL or missing references)
//IL_0137: Unknown result type (might be due to invalid IL or missing references)
//IL_0176: Unknown result type (might be due to invalid IL or missing references)
//IL_0181: Unknown result type (might be due to invalid IL or missing references)
//IL_0186: Unknown result type (might be due to invalid IL or missing references)
//IL_018b: Unknown result type (might be due to invalid IL or missing references)
//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
((EntityState)this).fixedAge = ((EntityState)this).fixedAge + Time.fixedDeltaTime;
base.aiUpdateTimer -= Time.fixedDeltaTime;
refreshTimer -= Time.fixedDeltaTime;
if (!Object.op_Implicit((Object)(object)((BaseAIState)this).ai) || !Object.op_Implicit((Object)(object)((BaseAIState)this).body))
{
return;
}
((BaseAIState)this).ai.SetGoalPosition(base.targetPosition);
Agent broadNavigationAgent = ((BaseAIState)this).ai.broadNavigationAgent;
if (base.aiUpdateTimer <= 0f)
{
base.aiUpdateTimer = BaseAIState.cvAIUpdateInterval.value;
LocalNavigator localNavigator = ((BaseAIState)this).ai.localNavigator;
AgentOutput output = ((Agent)(ref broadNavigationAgent)).output;
localNavigator.targetPosition = (Vector3)(((??)((AgentOutput)(ref output)).nextPosition) ?? ((BaseAIState)this).ai.localNavigator.targetPosition);
((BaseAIState)this).ai.localNavigator.Update(BaseAIState.cvAIUpdateInterval.value);
Vector3 val;
if (Object.op_Implicit((Object)(object)((BaseAIState)this).bodyInputBank))
{
((BaseAIState)this).bodyInputs.moveVector = ((BaseAIState)this).ai.localNavigator.moveVector;
ref BodyInputs bodyInputs = ref ((BaseAIState)this).bodyInputs;
val = base.targetLookPosition - ((BaseAIState)this).bodyInputBank.aimOrigin;
bodyInputs.desiredAimDirection = ((Vector3)(ref val)).normalized;
}
base.lookTimer -= Time.fixedDeltaTime;
if (base.lookTimer <= 0f)
{
((Wander)this).PickNewTargetLookPosition();
}
bool flag = false;
if (base.targetPosition.HasValue)
{
val = ((BaseAIState)this).body.footPosition - base.targetPosition.Value;
float sqrMagnitude = ((Vector3)(ref val)).sqrMagnitude;
float num = ((BaseAIState)this).body.radius * ((BaseAIState)this).body.radius * 4f;
flag = sqrMagnitude > num;
}
if (refreshTimer <= 0f || !flag)
{
refreshTimer = refreshTime;
SetNewRandomTarget(broadNavigationAgent);
}
}
}
private Vector3? PickRandomReachablePosition()
{
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
//IL_0088: Unknown result type (might be due to invalid IL or missing references)
if (!Object.op_Implicit((Object)(object)((BaseAIState)this).ai) || !Object.op_Implicit((Object)(object)((BaseAIState)this).body))
{
return null;
}
NodeGraph nodeGraph = SceneInfo.instance.GetNodeGraph((GraphType)(((BaseAIState)this).body.isFlying ? 1 : 0));
List<NodeIndex> list = nodeGraph.FindNodesInRange(((BaseAIState)this).bodyTransform.position, 0f, float.PositiveInfinity, (HullMask)(1 << (int)((BaseAIState)this).body.hullClassification));
NodeIndex val = list[Random.Range(0, list.Count)];
Vector3 value = default(Vector3);
if (nodeGraph.GetNodePosition(val, ref value))
{
return value;
}
return null;
}
}
}
namespace RoR2_Roomba.Items
{
public class Maxwell
{
public static GameObject EvilMaxwellPrefab;
public static ModdedProcType MaxwellProcType;
public static ItemDef CreateItemDef(GameObject maxwellPickupItem, Sprite icon)
{
//IL_006a: Unknown result type (might be due to invalid IL or missing references)
Transform val = maxwellPickupItem.transform.Find("FocusPoint");
Transform val2 = maxwellPickupItem.transform.Find("CameraPosition");
if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)val2))
{
ModelPanelParameters obj = maxwellPickupItem.AddComponent<ModelPanelParameters>();
obj.focusPointTransform = val;
obj.cameraPositionTransform = val2;
obj.minDistance = 1.5f;
obj.maxDistance = 3f;
}
ItemDef val3 = ScriptableObject.CreateInstance<ItemDef>();
val3.tier = (ItemTier)2;
val3.deprecatedTier = (ItemTier)2;
((Object)val3).name = "Maxwell";
val3.nameToken = "ROOMBA_ITEM_MAXWELL_NAME";
val3.pickupToken = "ROOMBA_ITEM_MAXWELL_PICKUP";
val3.descriptionToken = "ROOMBA_ITEM_MAXWELL_DESCRIPTION";
val3.loreToken = "ROOMBA_ITEM_MAXWELL_LORE";
val3.pickupModelPrefab = maxwellPickupItem;
val3.canRemove = true;
val3.pickupIconSprite = icon;
val3.tags = (ItemTag[])(object)new ItemTag[1] { (ItemTag)9 };
return val3;
}
public static GameObject CreateEvilMaxwellPrefab(GameObject evilMaxwellPrefab, GameObject grenadeExplosion)
{
evilMaxwellPrefab.AddComponent<NetworkIdentity>();
evilMaxwellPrefab.AddComponent<TeamFilter>();
ModdedDelayBlast moddedDelayBlast = evilMaxwellPrefab.AddComponent<ModdedDelayBlast>();
moddedDelayBlast.explosionEffect = grenadeExplosion;
moddedDelayBlast.timerStagger = 0f;
PrefabAPI.RegisterNetworkPrefab(evilMaxwellPrefab);
return evilMaxwellPrefab;
}
public static void GlobalEventManager_onServerDamageDealt(DamageReport obj)
{
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0092: Unknown result type (might be due to invalid IL or missing references)
//IL_0097: Unknown result type (might be due to invalid IL or missing references)
//IL_00d5: 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_00fa: Unknown result type (might be due to invalid IL or missing references)
//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
//IL_0118: Unknown result type (might be due to invalid IL or missing references)
//IL_0122: Unknown result type (might be due to invalid IL or missing references)
//IL_0127: Unknown result type (might be due to invalid IL or missing references)
//IL_0179: Unknown result type (might be due to invalid IL or missing references)
//IL_0181: Unknown result type (might be due to invalid IL or missing references)
//IL_0189: Unknown result type (might be due to invalid IL or missing references)
//IL_018e: Unknown result type (might be due to invalid IL or missing references)
//IL_019a: Unknown result type (might be due to invalid IL or missing references)
//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
//IL_01be: Unknown result type (might be due to invalid IL or missing references)
DamageInfo damageInfo = obj.damageInfo;
HealthComponent victim = obj.victim;
CharacterBody val = default(CharacterBody);
if (!Object.op_Implicit((Object)(object)damageInfo.attacker) || !damageInfo.attacker.TryGetComponent<CharacterBody>(ref val) || !Object.op_Implicit((Object)(object)val.master) || ProcTypeAPI.HasModdedProc(damageInfo.procChainMask, MaxwellProcType))
{
return;
}
int itemCount = val.master.inventory.GetItemCount(ContentProvider.Items.Maxwell);
if (itemCount > 0 && Util.CheckRoll(RoombaConfigs.MaxwellExplosionChance.Value * damageInfo.procCoefficient, val.master))
{
Vector3 corePosition = ((Component)victim).GetComponent<CharacterBody>().corePosition;
float num = RoombaConfigs.MaxwellExplosionDamage.Value / 100f + RoombaConfigs.MaxwellExplosionDamagePerStack.Value / 100f * (float)(itemCount - 1);
float baseDamage = Util.OnKillProcDamage(val.damage, num);
GameObject val2 = Object.Instantiate<GameObject>(EvilMaxwellPrefab, corePosition, Quaternion.identity);
ModdedDelayBlast component = val2.GetComponent<ModdedDelayBlast>();
if (Object.op_Implicit((Object)(object)component))
{
component.position = corePosition;
component.baseDamage = baseDamage;
component.baseForce = 2000f;
component.bonusForce = Vector3.up * 1000f;
component.radius = RoombaConfigs.MaxwellExplosionRadius.Value;
component.attacker = damageInfo.attacker;
component.inflictor = null;
component.crit = Util.CheckRoll(val.crit, val.master);
component.maxTimer = 3f;
component.damageColorIndex = (DamageColorIndex)3;
component.falloffModel = (FalloffModel)0;
component.procChainMask = damageInfo.procChainMask;
ProcTypeAPI.AddModdedProc(ref component.procChainMask, MaxwellProcType);
}
TeamFilter component2 = val2.GetComponent<TeamFilter>();
if (Object.op_Implicit((Object)(object)component2))
{
component2.teamIndex = ((Component)val).GetComponent<TeamComponent>().teamIndex;
}
NetworkServer.Spawn(val2);
EntitySoundManager.EmitSoundServer((AkEventIdArg)"Roomba_BadToTheBone_Play", val2);
}
}
}
public class PileOfDirt
{
public static SpawnCard scPileOfDirt;
public static GameObject CreatePileOfDirtSpawnPrefab(GameObject pileOfDirtPrefab, Material glassMaterial)
{
//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
//IL_0149: Unknown result type (might be due to invalid IL or missing references)
//IL_014e: Unknown result type (might be due to invalid IL or missing references)
//IL_015f: Unknown result type (might be due to invalid IL or missing references)
//IL_0164: 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_019c: Unknown result type (might be due to invalid IL or missing references)
Transform val = pileOfDirtPrefab.transform.Find("Model");
Transform val2 = pileOfDirtPrefab.transform.Find("Model/Hurtbox");
((Renderer)((Component)pileOfDirtPrefab.transform.Find("Model/mdlPileOfDirt/Glass1")).gameObject.GetComponent<MeshRenderer>()).material = glassMaterial;
((Renderer)((Component)pileOfDirtPrefab.transform.Find("Model/mdlPileOfDirt/Glass2")).gameObject.GetComponent<MeshRenderer>()).material = glassMaterial;
((Renderer)((Component)pileOfDirtPrefab.transform.Find("Model/mdlPileOfDirt/Glass3")).gameObject.GetComponent<MeshRenderer>()).material = glassMaterial;
pileOfDirtPrefab.AddComponent<NetworkIdentity>();
pileOfDirtPrefab.AddComponent<SkillLocator>();
TeamComponent val3 = null;
if (!pileOfDirtPrefab.TryGetComponent<TeamComponent>(ref val3))
{
val3 = pileOfDirtPrefab.AddComponent<TeamComponent>();
}
val3.teamIndex = (TeamIndex)0;
CharacterBody val4 = null;
if (!pileOfDirtPrefab.TryGetComponent<CharacterBody>(ref val4))
{
val4 = pileOfDirtPrefab.AddComponent<CharacterBody>();
}
val4.baseNameToken = "ROOMBA_BODY_PILE_OF_DIRT";
val4.bodyFlags = (BodyFlags)2052;
val4.baseMaxHealth = 30f;
val4.autoCalculateLevelStats = false;
val4.hullClassification = (HullClassification)0;
HealthComponent val5 = pileOfDirtPrefab.AddComponent<HealthComponent>();
val5.globalDeathEventChanceCoefficient = 1f;
val5.dontShowHealthbar = true;
ModelLocator obj = pileOfDirtPrefab.AddComponent<ModelLocator>();
obj.modelTransform = val;
obj.dontDetatchFromParent = true;
obj.noCorpse = true;
obj.normalizeToFloor = true;
EntityStateMachine val6 = pileOfDirtPrefab.AddComponent<EntityStateMachine>();
val6.customName = "Body";
val6.initialStateType = new SerializableEntityStateType(typeof(Idle));
val6.mainStateType = new SerializableEntityStateType(typeof(Idle));
pileOfDirtPrefab.AddComponent<NetworkStateMachine>().stateMachines = (EntityStateMachine[])(object)new EntityStateMachine[1] { val6 };
CharacterDeathBehavior obj2 = pileOfDirtPrefab.AddComponent<CharacterDeathBehavior>();
obj2.deathStateMachine = val6;
obj2.deathState = new SerializableEntityStateType(typeof(PileOfDirtDeath));
HurtBox val7 = ((Component)val2).gameObject.AddComponent<HurtBox>();
val7.healthComponent = val5;
HurtBoxGroup obj3 = ((Component)val).gameObject.AddComponent<HurtBoxGroup>();
obj3.mainHurtBox = val7;
obj3.hurtBoxes = (HurtBox[])(object)new HurtBox[1] { val7 };
PrefabAPI.RegisterNetworkPrefab(pileOfDirtPrefab);
return pileOfDirtPrefab;
}
public static SpawnCard CreatePileOfDirtSpawnCard(GameObject pileOfDirtPrefab)
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
SpawnCard obj = ScriptableObject.CreateInstance<SpawnCard>();
obj.prefab = pileOfDirtPrefab;
obj.sendOverNetwork = true;
obj.hullSize = (HullClassification)0;
obj.nodeGraphType = (GraphType)0;
obj.requiredFlags = (NodeFlags)0;
obj.forbiddenFlags = (NodeFlags)8;
obj.directorCreditCost = 1;
obj.occupyPosition = false;
return obj;
}
public static ItemDef CreateItemDef(GameObject pilePickup, Material glassMaterial, Sprite icon)
{
//IL_006f: Unknown result type (might be due to invalid IL or missing references)
((Renderer)((Component)pilePickup.transform.Find("mdlPileOfDirt/Glass1")).gameObject.GetComponent<MeshRenderer>()).material = glassMaterial;
((Renderer)((Component)pilePickup.transform.Find("mdlPileOfDirt/Glass2")).gameObject.GetComponent<MeshRenderer>()).material = glassMaterial;
((Renderer)((Component)pilePickup.transform.Find("mdlPileOfDirt/Glass3")).gameObject.GetComponent<MeshRenderer>()).material = glassMaterial;
ItemDef val = ScriptableObject.CreateInstance<ItemDef>();
val.tier = (ItemTier)4;
val.deprecatedTier = (ItemTier)4;
((Object)val).name = "PileOfDirt";
val.nameToken = "ROOMBA_ITEM_PILE_OF_DIRT_NAME";
val.pickupToken = "ROOMBA_ITEM_PILE_OF_DIRT_PICKUP";
val.descriptionToken = "ROOMBA_ITEM_PILE_OF_DIRT_DESCRIPTION";
val.loreToken = "ROOMBA_ITEM_PILE_OF_DIRT_LORE";
val.pickupModelPrefab = pilePickup;
val.canRemove = true;
ItemTag[] array = new ItemTag[6];
RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/);
val.tags = (ItemTag[])(object)array;
val.pickupIconSprite = icon;
return val;
}
}
public class Poster
{
public static ItemDef CreateItemDef(GameObject posterPickup, Sprite icon)
{
//IL_006a: Unknown result type (might be due to invalid IL or missing references)
Transform val = posterPickup.transform.Find("FocusPoint");
Transform val2 = posterPickup.transform.Find("CameraPosition");
if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)val2))
{
ModelPanelParameters obj = posterPickup.AddComponent<ModelPanelParameters>();
obj.focusPointTransform = val;
obj.cameraPositionTransform = val2;
obj.minDistance = 1.5f;
obj.maxDistance = 3f;
}
ItemDef val3 = ScriptableObject.CreateInstance<ItemDef>();
val3.tier = (ItemTier)1;
val3.deprecatedTier = (ItemTier)1;
((Object)val3).name = "Poster";
val3.nameToken = "ROOMBA_ITEM_POSTER_NAME";
val3.pickupToken = "ROOMBA_ITEM_POSTER_PICKUP";
val3.descriptionToken = "ROOMBA_ITEM_POSTER_DESCRIPTION";
val3.loreToken = "ROOMBA_ITEM_POSTER_LORE";
val3.pickupModelPrefab = posterPickup;
val3.canRemove = true;
val3.pickupIconSprite = icon;
val3.tags = (ItemTag[])(object)new ItemTag[1] { (ItemTag)9 };
return val3;
}
public static void RecalculateStatsAPI_GetStatCoefficients(CharacterBody sender, StatHookEventArgs args)
{
if (Object.op_Implicit((Object)(object)sender) && Object.op_Implicit((Object)(object)sender.inventory))
{
int itemCount = sender.inventory.GetItemCount(ContentProvider.Items.Poster);
if (itemCount > 0)
{
args.damageMultAdd += RoombaConfigs.PosterDamageAdd.Value / 100f + RoombaConfigs.PosterDamageAddPerStack.Value / 100f * (float)(itemCount - 1);
args.baseShieldAdd += sender.maxHealth * (RoombaConfigs.PosterShieldHealthPercent.Value / 100f) + sender.maxHealth * (RoombaConfigs.PosterShieldHealthPercentPerStack.Value / 100f) * (float)(itemCount - 1);
}
}
}
}
}
namespace RoR2_Roomba.Components
{
public class ModdedDelayBlast : MonoBehaviour
{
public ProcChainMask procChainMask;
[HideInInspector]
public Vector3 position;
[HideInInspector]
public GameObject attacker;
[HideInInspector]
public GameObject inflictor;
[HideInInspector]
public float baseDamage;
[HideInInspector]
public bool crit;
[HideInInspector]
public float baseForce;
[HideInInspector]
public float radius;
[HideInInspector]
public Vector3 bonusForce;
[HideInInspector]
public float maxTimer;
[HideInInspector]
public DamageColorIndex damageColorIndex;
[HideInInspector]
public FalloffModel falloffModel;
[HideInInspector]
public DamageTypeCombo damageType = DamageTypeCombo.op_Implicit((DamageType)0);
[HideInInspector]
public float procCoefficient = 1f;
public GameObject explosionEffect;
public GameObject delayEffect;
public float timerStagger;
private float timer;
private bool hasSpawnedDelayEffect;
private TeamFilter teamFilter;
private void Awake()
{
teamFilter = ((Component)this).GetComponent<TeamFilter>();
if (!NetworkServer.active)
{
((Behaviour)this).enabled = false;
}
}
private void FixedUpdate()
{
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
//IL_0073: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
//IL_008a: Expected O, but got Unknown
if (NetworkServer.active)
{
timer += Time.fixedDeltaTime;
if (Object.op_Implicit((Object)(object)delayEffect) && !hasSpawnedDelayEffect && timer > timerStagger)
{
hasSpawnedDelayEffect = true;
EffectManager.SpawnEffect(delayEffect, new EffectData
{
origin = ((Component)this).transform.position,
rotation = Util.QuaternionSafeLookRotation(((Component)this).transform.forward),
scale = radius
}, true);
}
if (timer >= maxTimer + timerStagger)
{
Detonate();
}
}
}
public void Detonate()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Expected O, but got Unknown
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_006f: Unknown result type (might be due to invalid IL or missing references)
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_0079: Unknown result type (might be due to invalid IL or missing references)
//IL_0085: Unknown result type (might be due to invalid IL or missing references)
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
//IL_009d: Unknown result type (might be due to invalid IL or missing references)
//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
//IL_00c8: 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_00d2: Unknown result type (might be due to invalid IL or missing references)
//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
//IL_00de: 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_00ec: Unknown result type (might be due to invalid IL or missing references)
//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
EffectManager.SpawnEffect(explosionEffect, new EffectData
{
origin = ((Component)this).transform.position,
rotation = Util.QuaternionSafeLookRotation(((Component)this).transform.forward),
scale = radius
}, true);
new BlastAttack
{
position = position,
baseDamage = baseDamage,
baseForce = baseForce,
bonusForce = bonusForce,
radius = radius,
attacker = attacker,
inflictor = inflictor,
teamIndex = teamFilter.teamIndex,
crit = crit,
damageColorIndex = damageColorIndex,
damageType = damageType,
falloffModel = falloffModel,
procCoefficient = procCoefficient,
procChainMask = procChainMask
}.Fire();
Object.Destroy((Object)(object)((Component)this).gameObject);
}
}
}