Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of ManakaSurvivor v1.3.0
plugins\ManakaSurvivor\ManakaSurvivor.dll
Decompiled 2 weeks ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.IO.Compression; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using EntityStates; using HG.BlendableTypes; using ManakaSurvivor.Data; using ManakaSurvivor.Fx; using ManakaSurvivor.Model; using ManakaSurvivor.Projectiles; using ManakaSurvivor.States; using Microsoft.CodeAnalysis; using Newtonsoft.Json; using R2API; using RoR2; using RoR2.Projectile; using RoR2.Skills; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.Networking; using UnityEngine.Rendering; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: IgnoresAccessChecksTo("RoR2")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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 ManakaSurvivor { internal static class ManakaBody { public static GameObject bodyPrefab; public static GameObject displayPrefab; public static SurvivorDef survivorDef; public static readonly Color BodyColor = new Color(0.93f, 0.79f, 0.62f); public static void Create() { //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) ManakaLanguage.Register(); bodyPrefab = CloneBody(); ContentAddition.AddBody(bodyPrefab); ManakaSkills.Create(bodyPrefab); displayPrefab = BuildDisplay(); AddSkins(); ModelSkinController componentInChildren = bodyPrefab.GetComponentInChildren<ModelSkinController>(); ModelSkinController componentInChildren2 = displayPrefab.GetComponentInChildren<ModelSkinController>(); if (Object.op_Implicit((Object)(object)componentInChildren) && Object.op_Implicit((Object)(object)componentInChildren2)) { componentInChildren2.skins = componentInChildren.skins; } survivorDef = ScriptableObject.CreateInstance<SurvivorDef>(); survivorDef.cachedName = "Manaka"; survivorDef.displayNameToken = "MANAKA_NAME"; survivorDef.descriptionToken = "MANAKA_DESCRIPTION"; survivorDef.outroFlavorToken = "MANAKA_OUTRO_FLAVOR"; survivorDef.mainEndingEscapeFailureFlavorToken = "MANAKA_OUTRO_FAILURE"; survivorDef.primaryColor = BodyColor; survivorDef.bodyPrefab = bodyPrefab; survivorDef.displayPrefab = displayPrefab; survivorDef.desiredSortPosition = 101f; ContentAddition.AddSurvivorDef(survivorDef); RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, new Action(ManakaLanguage.Verify)); } private static GameObject CloneBody() { //IL_005c: 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_009f: 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) //IL_00a4: 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_026a: Unknown result type (might be due to invalid IL or missing references) //IL_027c: Unknown result type (might be due to invalid IL or missing references) //IL_029d: Unknown result type (might be due to invalid IL or missing references) //IL_02b3: 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_02ce: Unknown result type (might be due to invalid IL or missing references) //IL_02ef: Unknown result type (might be due to invalid IL or missing references) //IL_0300: Unknown result type (might be due to invalid IL or missing references) //IL_030f: Unknown result type (might be due to invalid IL or missing references) //IL_0330: Unknown result type (might be due to invalid IL or missing references) //IL_0341: Unknown result type (might be due to invalid IL or missing references) //IL_0359: Unknown result type (might be due to invalid IL or missing references) //IL_0360: Expected O, but got Unknown //IL_0516: Unknown result type (might be due to invalid IL or missing references) //IL_051b: Unknown result type (might be due to invalid IL or missing references) //IL_052c: Unknown result type (might be due to invalid IL or missing references) //IL_04ab: Unknown result type (might be due to invalid IL or missing references) //IL_049d: Unknown result type (might be due to invalid IL or missing references) //IL_04b0: Unknown result type (might be due to invalid IL or missing references) //IL_04c1: Unknown result type (might be due to invalid IL or missing references) //IL_04c6: Unknown result type (might be due to invalid IL or missing references) //IL_04e1: Unknown result type (might be due to invalid IL or missing references) //IL_04e6: Unknown result type (might be due to invalid IL or missing references) //IL_04eb: Unknown result type (might be due to invalid IL or missing references) GameObject val = LegacyResourcesAPI.Load<GameObject>("Prefabs/CharacterBodies/CommandoBody"); if (!Object.op_Implicit((Object)(object)val)) { throw new Exception("CommandoBody not found; cannot clone"); } if (!Object.op_Implicit((Object)(object)val.transform.Find("AimOrigin"))) { new Vector3(0f, 1.4f, 0f); } else { _ = val.transform.Find("AimOrigin").localPosition; } Vector3 val2 = (Vector3)(Object.op_Implicit((Object)(object)val.transform.Find("ModelBase")) ? val.transform.Find("ModelBase").localPosition : new Vector3(0f, -0.9f, 0f)); ManakaItemDisplays.CaptureFromCommando(val); GameObject val3 = PrefabAPI.InstantiateClone(val, "ManakaBody", true); SfxLocator component = val3.GetComponent<SfxLocator>(); if (Object.op_Implicit((Object)(object)component)) { component.deathSound = ""; component.barkSound = ""; } for (int num = val3.transform.childCount - 1; num >= 0; num--) { Object.DestroyImmediate((Object)(object)((Component)val3.transform.GetChild(num)).gameObject); } CharacterBody component2 = val3.GetComponent<CharacterBody>(); component2.baseNameToken = "MANAKA_NAME"; component2.subtitleNameToken = "MANAKA_SUBTITLE"; component2.bodyColor = BodyColor; Sprite icon = ManakaAssets.GetIcon("icons/manaka_circle.png"); if (Object.op_Implicit((Object)(object)icon)) { component2.portraitIcon = (Texture)(object)icon.texture; } component2.baseMaxHealth = 118f; component2.levelMaxHealth = 35f; component2.baseRegen = 2.4f; component2.levelRegen = 0.48f; component2.baseArmor = 20f; component2.levelArmor = 0f; component2.baseMaxShield = 0f; component2.levelMaxShield = 0f; component2.baseDamage = 14f; component2.levelDamage = 2.8f; component2.baseAttackSpeed = 1f; component2.levelAttackSpeed = 0f; component2.baseCrit = 1f; component2.levelCrit = 0f; component2.baseMoveSpeed = 7.2f; component2.levelMoveSpeed = 0f; component2.baseJumpPower = 17f; component2.levelJumpPower = 0f; component2.baseJumpCount = 2; component2.baseAcceleration = 80f; component2.sprintingSpeedMultiplier = 1.45f; component2.autoCalculateLevelStats = false; component2.rootMotionInMainState = false; component2.hullClassification = (HullClassification)0; component2.isChampion = false; Transform transform = new GameObject("ModelBase").transform; transform.SetParent(val3.transform, false); transform.localPosition = new Vector3(0f, val2.y + ManakaPlugin.GroundOffset.Value, 0f); transform.localRotation = Quaternion.identity; Transform transform2 = new GameObject("CameraPivot").transform; transform2.SetParent(val3.transform, false); transform2.localPosition = new Vector3(0f, val2.y + 1.35f, 0f); Transform transform3 = new GameObject("AimOrigin").transform; transform3.SetParent(val3.transform, false); transform3.localPosition = new Vector3(0f, val2.y + 1.3f, 0.1f); component2.aimOriginTransform = transform3; GameObject val4 = new GameObject("mdlManaka"); val4.transform.SetParent(transform, false); ChildLocator val5 = val4.AddComponent<ChildLocator>(); val5.transformPairs = (NameTransformPair[])(object)new NameTransformPair[0]; CharacterModel obj = val4.AddComponent<CharacterModel>(); obj.body = component2; obj.itemDisplayRuleSet = ManakaItemDisplays.RuleSet; obj.autoPopulateLightInfos = true; obj.invisibilityCount = 0; obj.temporaryOverlays = new List<TemporaryOverlayInstance>(); obj.baseRendererInfos = (RendererInfo[])(object)new RendererInfo[0]; val4.AddComponent<ModelSkinController>().skins = (SkinDef[])(object)new SkinDef[0]; val4.AddComponent<ManakaPoseDriver>(); val4.AddComponent<ManakaModelController>(); SetupHurtbox(val3, val4, val5); ModelLocator component3 = val3.GetComponent<ModelLocator>(); component3.modelTransform = val4.transform; component3.modelBaseTransform = transform; component3.dontDetatchFromParent = false; component3.normalizeToFloor = false; CharacterDirection component4 = val3.GetComponent<CharacterDirection>(); if (Object.op_Implicit((Object)(object)component4)) { component4.targetTransform = transform; component4.overrideAnimatorForwardTransform = null; component4.rootMotionAccumulator = null; component4.modelAnimator = null; component4.driveFromRootRotation = false; component4.turnSpeed = 720f; } CameraTargetParams component5 = val3.GetComponent<CameraTargetParams>(); if (Object.op_Implicit((Object)(object)component5)) { component5.cameraPivotTransform = transform2; CharacterCameraParams val6 = ScriptableObject.CreateInstance<CharacterCameraParams>(); ((Object)val6).name = "ccpManaka"; val6.data = (Object.op_Implicit((Object)(object)component5.cameraParams) ? component5.cameraParams.data : CharacterCameraParamsData.basic); val6.data.pivotVerticalOffset = BlendableFloat.op_Implicit(0.1f); val6.data.idealLocalCameraPos = BlendableVector3.op_Implicit(new Vector3(0f, 0.35f, -5.6f)); component5.cameraParams = val6; } CharacterDeathBehavior component6 = val3.GetComponent<CharacterDeathBehavior>(); if (Object.op_Implicit((Object)(object)component6)) { component6.deathState = new SerializableEntityStateType(typeof(ManakaDeath)); bool flag = default(bool); ContentAddition.AddEntityState(typeof(ManakaDeath), ref flag); } val3.AddComponent<ManakaPassive>(); return val3; } private static void SetupHurtbox(GameObject body, GameObject model, ChildLocator locator) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //IL_0032: 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_00d2: 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) GameObject val = new GameObject("MainHurtbox"); val.transform.SetParent(model.transform, false); val.transform.localPosition = new Vector3(0f, 0.8f, 0f); val.layer = LayerIndex.entityPrecise.intVal; CapsuleCollider obj = val.AddComponent<CapsuleCollider>(); obj.radius = 0.33f; obj.height = 1.55f; obj.direction = 1; HurtBoxGroup val2 = model.AddComponent<HurtBoxGroup>(); HurtBox val3 = val.AddComponent<HurtBox>(); val3.healthComponent = body.GetComponent<HealthComponent>(); val3.isBullseye = true; val3.isSniperTarget = true; val3.damageModifier = (DamageModifier)0; val3.hurtBoxGroup = val2; val3.indexInGroup = 0; val2.hurtBoxes = (HurtBox[])(object)new HurtBox[1] { val3 }; val2.mainHurtBox = val3; val2.bullseyeCount = 1; locator.transformPairs = locator.transformPairs.Append(new NameTransformPair { name = "MainHurtbox", transform = val.transform }).ToArray(); } private static GameObject BuildDisplay() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0045: 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_005d: 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_0075: Expected O, but got Unknown //IL_007b: Expected O, but got Unknown GameObject val = new GameObject("ManakaDisplay"); val.AddComponent<ChildLocator>().transformPairs = (NameTransformPair[])(object)new NameTransformPair[0]; CharacterModel obj = val.AddComponent<CharacterModel>(); obj.autoPopulateLightInfos = true; obj.invisibilityCount = 0; obj.temporaryOverlays = new List<TemporaryOverlayInstance>(); obj.baseRendererInfos = (RendererInfo[])(object)new RendererInfo[0]; val.AddComponent<ModelSkinController>().skins = (SkinDef[])(object)new SkinDef[0]; val.AddComponent<ManakaPoseDriver>(); val.AddComponent<ManakaModelController>().isDisplay = true; GameObject result = PrefabAPI.InstantiateClone(val, "ManakaDisplay", false); Object.Destroy((Object)val); return result; } private static string SkinToken(ManakaOutfit e) { string text = "MANAKA_SKIN_" + e.key.ToUpperInvariant(); LanguageAPI.Add(text, e.name); return text; } private static void AddSkins() { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) GameObject gameObject = ((Component)bodyPrefab.GetComponent<ModelLocator>().modelTransform).gameObject; foreach (ManakaOutfit outfit in ManakaAssets.Outfits) { SkinDef val = Skins.CreateNewSkinDef(new SkinDefParamsInfo { Name = "skinManaka_" + outfit.key, NameToken = SkinToken(outfit), Icon = (ManakaAssets.GetIcon("icons/skin_" + outfit.key.ToLowerInvariant() + ".png") ?? ManakaAssets.GetIcon("icons/manaka_circle.png")), RootObject = gameObject, BaseSkins = (SkinDef[])(object)new SkinDef[0], RendererInfos = (RendererInfo[])(object)new RendererInfo[0], GameObjectActivations = (GameObjectActivation[])(object)new GameObjectActivation[0], MeshReplacements = (MeshReplacement[])(object)new MeshReplacement[0], ProjectileGhostReplacements = (ProjectileGhostReplacement[])(object)new ProjectileGhostReplacement[0], MinionSkinReplacements = (MinionSkinReplacement[])(object)new MinionSkinReplacement[0] }); Skins.AddSkinToCharacter(bodyPrefab, val); } } } internal static class ManakaContent { [CompilerGenerated] private static class <>O { public static StatHookEventHandler <0>__OnRecalc; } public static BuffDef ExhibitionBuff; public static BuffDef SlickBuff; public static BuffDef AfterglowBuff; public static void Init() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Expected O, but got Unknown ExhibitionBuff = MakeBuff("ManakaExhibition", new Color(1f, 0.55f, 0.72f), stack: true, "icons/manaka_passive.png"); SlickBuff = MakeBuff("ManakaSlick", new Color(1f, 0.92f, 0.45f), stack: false, "icons/manaka_wet.png"); AfterglowBuff = MakeBuff("ManakaAfterglow", new Color(1f, 0.35f, 0.55f), stack: false, "icons/manaka_afterglow.png"); object obj = <>O.<0>__OnRecalc; if (obj == null) { StatHookEventHandler val = OnRecalc; <>O.<0>__OnRecalc = val; obj = (object)val; } RecalculateStatsAPI.GetStatCoefficients += (StatHookEventHandler)obj; } private static BuffDef MakeBuff(string name, Color color, bool stack, string icon) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) BuffDef obj = ScriptableObject.CreateInstance<BuffDef>(); ((Object)obj).name = name; obj.buffColor = color; obj.canStack = stack; obj.isDebuff = false; obj.iconSprite = ManakaAssets.GetIcon(icon); ContentAddition.AddBuffDef(obj); return obj; } private static void OnRecalc(CharacterBody body, StatHookEventArgs args) { if (Object.op_Implicit((Object)(object)body)) { if (body.HasBuff(ExhibitionBuff)) { int buffCount = body.GetBuffCount(ExhibitionBuff); args.damageMultAdd += (float)buffCount * 0.022f; args.moveSpeedMultAdd += (float)buffCount * 0.006f; } if (body.HasBuff(SlickBuff)) { args.moveSpeedMultAdd += 0.25f; } if (body.HasBuff(AfterglowBuff)) { args.attackSpeedMultAdd += 0.35f; } } } } public sealed class ManakaPassive : MonoBehaviour { private CharacterBody body; private float timer; private const float Radius = 14f; private const int MaxStacks = 10; private static readonly Collider[] buffer = (Collider[])(object)new Collider[48]; private static readonly HashSet<CharacterBody> watchers = new HashSet<CharacterBody>(); private void Awake() { body = ((Component)this).GetComponent<CharacterBody>(); } private int CountWatchers() { //IL_0010: 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_0027: 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) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) watchers.Clear(); Vector3 position = ((Component)this).transform.position; Collider[] array = buffer; LayerIndex entityPrecise = LayerIndex.entityPrecise; int num = Physics.OverlapSphereNonAlloc(position, 14f, array, LayerMask.op_Implicit(((LayerIndex)(ref entityPrecise)).mask), (QueryTriggerInteraction)2); for (int i = 0; i < num; i++) { HurtBox component = ((Component)buffer[i]).GetComponent<HurtBox>(); if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component.healthComponent)) { CharacterBody val = component.healthComponent.body; if (Object.op_Implicit((Object)(object)val) && !((Object)(object)val == (Object)(object)body) && Object.op_Implicit((Object)(object)body.teamComponent) && Object.op_Implicit((Object)(object)val.teamComponent) && val.teamComponent.teamIndex != body.teamComponent.teamIndex) { watchers.Add(val); } } } return watchers.Count; } private void FixedUpdate() { if (!Object.op_Implicit((Object)(object)body) || !Object.op_Implicit((Object)(object)body.healthComponent) || !body.healthComponent.alive || !NetworkServer.active) { return; } timer += Time.fixedDeltaTime; if (timer < 0.5f) { return; } timer = 0f; int num = Mathf.Clamp(CountWatchers(), 0, 10); int buffCount = body.GetBuffCount(ManakaContent.ExhibitionBuff); if (num > buffCount) { for (int i = buffCount; i < num; i++) { body.AddBuff(ManakaContent.ExhibitionBuff); } } else if (num < buffCount) { body.RemoveBuff(ManakaContent.ExhibitionBuff); } } } internal static class ManakaLanguage { private static readonly string[] Skills = new string[16] { "MANAKA_NAME|Manaka", "MANAKA_SUBTITLE|The Exhibitionist", "MANAKA_DESCRIPTION|A woman who found one thing she is good at and built a career on it. She opens her coat at the worst possible moment and everything looking at her regrets it.<br><br>Her crowd is her armour: the more enemies watching, the harder she hits.", "MANAKA_OUTRO_FLAVOR|She closes the coat. Somewhere, a camera flashes.", "MANAKA_OUTRO_FAILURE|Nobody was watching.", "MANAKA_KEYWORD_EXPOSURE|Exposure", "MANAKA_PASSIVE_NAME|Exhibition", "MANAKA_PASSIVE_DESC|Gain <style=cIsDamage>Exposure</style> for every enemy within 14 m (max 10). Each stack grants <style=cIsDamage>+2.2% damage</style> and a little movement speed.", "MANAKA_PRIMARY_NAME|Coat Flash", "MANAKA_PRIMARY_DESC|Throw the coat open and flash the spot you are aiming at, up to <style=cIsUtility>16 m</style> away. A camera-flash burst deals <style=cIsDamage>320% damage</style>, and a second burst at her feet deals <style=cIsDamage>200% damage</style> to anyone standing too close.", "MANAKA_SECONDARY_NAME|Bare It All", "MANAKA_SECONDARY_DESC|Open the coat wide and dare anyone to look. <style=cIsDamage>Stuns</style> every enemy within <style=cIsUtility>12 m</style> for <style=cIsDamage>200% damage</style> and hides her for <style=cIsUtility>2.4 s</style>.", "MANAKA_UTILITY_NAME|Golden Rain", "MANAKA_UTILITY_DESC|Let it go. A stream of nine droplets arcs ahead, each hitting for <style=cIsDamage>70% damage</style> and <style=cIsUtility>slowing</style> what it touches. Her own footing improves: <style=cIsUtility>+25% movement speed</style> for 4 s.", "MANAKA_SPECIAL_NAME|Toy Overload", "MANAKA_SPECIAL_DESC|Turn it all the way up. After a short build-up she climaxes in a <style=cIsDamage>14 m</style> shockwave for <style=cIsDamage>1100% damage</style> and a ring of twelve droplets for <style=cIsDamage>160% damage</style> each, six of them homing on the nearest enemy, knocking everything back and leaving her with <style=cIsUtility>+35% attack speed</style> for 7 s." }; public static void Register() { string[] skills = Skills; foreach (string text in skills) { int num = text.IndexOf('|'); LanguageAPI.Add(text.Substring(0, num), text.Substring(num + 1)); } } public static void Verify(string[] referenced) { List<string> list = new List<string>(); foreach (string text in referenced) { if (Language.GetString(text) == text) { list.Add(text); } } if (list.Count > 0) { ManakaPlugin.Log.LogWarning((object)("missing language tokens: " + string.Join(", ", list))); } } public static void Verify() { Verify(new string[16] { "MANAKA_NAME", "MANAKA_DESCRIPTION", "MANAKA_SUBTITLE", "MANAKA_OUTRO_FLAVOR", "MANAKA_OUTRO_FAILURE", "MANAKA_PASSIVE_NAME", "MANAKA_PASSIVE_DESC", "MANAKA_KEYWORD_EXPOSURE", "MANAKA_PRIMARY_NAME", "MANAKA_PRIMARY_DESC", "MANAKA_SECONDARY_NAME", "MANAKA_SECONDARY_DESC", "MANAKA_UTILITY_NAME", "MANAKA_UTILITY_DESC", "MANAKA_SPECIAL_NAME", "MANAKA_SPECIAL_DESC" }); } } [BepInPlugin("com.woo.manakasurvivor", "Manaka Survivor", "1.3.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public sealed class ManakaPlugin : BaseUnityPlugin { public const string Guid = "com.woo.manakasurvivor"; public const string Name = "Manaka Survivor"; public const string Version = "1.3.0"; public static ManualLogSource Log; public static string PluginDir; public static ConfigEntry<float> UnitScale; public static ConfigEntry<float> BustSize; public static ConfigEntry<float> GroundOffset; public static ConfigEntry<string> SkinTint; private void Awake() { //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; PluginDir = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location); UnitScale = ((BaseUnityPlugin)this).Config.Bind<float>("Model", "Scale", 1f, "Overall character scale (1 = source game size)."); SkinTint = ((BaseUnityPlugin)this).Config.Bind<string>("Appearance", "SkinTint", "1.0,0.90,0.82", "RGB multiplier for her skin so it does not wash out under the stage lighting."); GroundOffset = ((BaseUnityPlugin)this).Config.Bind<float>("Model", "GroundOffset", 0f, "Vertical offset of the model inside the body, in metres (raise her if she sinks)."); BustSize = ((BaseUnityPlugin)this).Config.Bind<float>("Appearance", "BustSize", 80f, new ConfigDescription("Her bust morph, 0-85. Body and coat shapes move together; above 85 the body pokes out under the coat (measured), so the range stops there.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 85f), Array.Empty<object>())); try { ManakaAssets.Init(PluginDir, ((BaseUnityPlugin)this).Logger); ManakaContent.Init(); ManakaProjectiles.Create(); ManakaFx.Create(); ManakaBody.Create(); Log.LogInfo((object)("Manaka registered. build=1.3.0 skeleton=" + ((ManakaAssets.Manifest != null) ? ManakaAssets.Manifest.skeleton.Length.ToString() : "?"))); } catch (Exception ex) { Log.LogError((object)("Manaka failed to initialise: " + ex)); throw; } } } internal static class ManakaSkills { public static SkillDef Primary; public static SkillDef Secondary; public static SkillDef Utility; public static SkillDef Special; public static void Create(GameObject body) { //IL_0009: 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_004d: Unknown result type (might be due to invalid IL or missing references) SkillLocator component = body.GetComponent<SkillLocator>(); component.passiveSkill = new PassiveSkill { enabled = true, skillNameToken = "MANAKA_PASSIVE_NAME", skillDescriptionToken = "MANAKA_PASSIVE_DESC", keywordToken = "MANAKA_KEYWORD_EXPOSURE", icon = ManakaAssets.GetIcon("icons/manaka_passive.png") }; Primary = Def<CoatFlash>("ManakaCoatFlash", "MANAKA_PRIMARY", "Weapon", 0.6f, "icons/manaka_primary.png", (InterruptPriority)0, attackSpeedRestock: true); Secondary = Def<Bareta>("ManakaBareta", "MANAKA_SECONDARY", "Weapon", 6f, "icons/manaka_secondary.png", (InterruptPriority)1, attackSpeedRestock: false); Utility = Def<GoldenRain>("ManakaGoldenRain", "MANAKA_UTILITY", "Body", 7f, "icons/manaka_utility.png", (InterruptPriority)1, attackSpeedRestock: false); Special = Def<ToyOverload>("ManakaToyOverload", "MANAKA_SPECIAL", "Weapon", 22f, "icons/manaka_special.png", (InterruptPriority)2, attackSpeedRestock: false); Assign(component.primary, Primary, "Primary"); Assign(component.secondary, Secondary, "Secondary"); Assign(component.utility, Utility, "Utility"); Assign(component.special, Special, "Special"); } private static SkillDef Def<TState>(string name, string token, string machine, float cooldown, string icon, InterruptPriority priority, bool attackSpeedRestock = false) where TState : EntityState { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_005f: 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_00d3: Unknown result type (might be due to invalid IL or missing references) SkillDef obj = ScriptableObject.CreateInstance<SkillDef>(); obj.skillName = name; ((Object)obj).name = name; obj.skillNameToken = token + "_NAME"; obj.skillDescriptionToken = token + "_DESC"; obj.icon = ManakaAssets.GetIcon(icon); obj.activationState = new SerializableEntityStateType(typeof(TState)); obj.activationStateMachineName = machine; obj.interruptPriority = priority; obj.baseRechargeInterval = cooldown; obj.baseMaxStock = 1; obj.rechargeStock = 1; obj.requiredStock = 1; obj.stockToConsume = 1; obj.beginSkillCooldownOnSkillEnd = false; obj.cancelSprintingOnActivation = false; obj.canceledFromSprinting = false; obj.isCombatSkill = true; obj.mustKeyPress = false; obj.attackSpeedBuffsRestockSpeed = attackSpeedRestock; obj.keywordTokens = new string[0]; ContentAddition.AddSkillDef(obj); bool flag = default(bool); ContentAddition.AddEntityState(typeof(TState), ref flag); return obj; } private static void Assign(GenericSkill slot, SkillDef def, string name) { //IL_0027: 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_0049: Expected O, but got Unknown //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) SkillFamily val = ScriptableObject.CreateInstance<SkillFamily>(); ((Object)val).name = "ManakaBody" + name + "Family"; Variant[] array = new Variant[1]; Variant val2 = new Variant { skillDef = def }; ((Variant)(ref val2)).viewableNode = new Node(def.skillNameToken, false, (Node)null); array[0] = val2; val.variants = (Variant[])(object)array; val.defaultVariantIndex = 0u; slot._skillFamily = val; ContentAddition.AddSkillFamily(val); } } } namespace ManakaSurvivor.States { public abstract class ManakaSkillState : BaseSkillState { protected ManakaModelController gmc; protected float duration; public override void OnEnter() { ((BaseState)this).OnEnter(); gmc = ManakaModelController.Of(((EntityState)this).GetModelTransform()); } protected void Anim(string clip, float seconds, float blend = 0.06f, bool loop = false) { if (Object.op_Implicit((Object)(object)gmc) && Object.op_Implicit((Object)(object)gmc.driver)) { gmc.driver.PlayAction(clip, seconds, blend, loop); } if (Object.op_Implicit((Object)(object)gmc) && clip != null && (clip.StartsWith("Coat") || clip.StartsWith("Bareta") || clip.StartsWith("DropCoat"))) { gmc.OpenCoatFor((seconds <= 0f) ? 1.2f : seconds); } } protected void StopAnim() { if (Object.op_Implicit((Object)(object)gmc) && Object.op_Implicit((Object)(object)gmc.driver)) { gmc.driver.CancelAction(); } } protected Vector3 FlatAim() { //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_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0037: 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) Ray aimRay = ((BaseState)this).GetAimRay(); Vector3 direction = ((Ray)(ref aimRay)).direction; direction.y = 0f; if (!(((Vector3)(ref direction)).sqrMagnitude < 0.01f)) { return ((Vector3)(ref direction)).normalized; } return ((EntityState)this).transform.forward; } protected void Blast(Vector3 pos, float radius, float coefficient, DamageTypeCombo type, float force, float upForce, float proc = 1f) { //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) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001d: 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_002a: 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_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004d: 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_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006b: 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_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_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: 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_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) new BlastAttack { attacker = ((EntityState)this).gameObject, inflictor = ((EntityState)this).gameObject, teamIndex = ((BaseState)this).GetTeam(), position = pos, radius = radius, baseDamage = ((BaseState)this).damageStat * coefficient, baseForce = force, bonusForce = Vector3.up * upForce, crit = ((BaseState)this).RollCrit(), damageType = type, falloffModel = (FalloffModel)0, procCoefficient = proc, damageColorIndex = (DamageColorIndex)0, attackerFiltering = (AttackerFiltering)2 }.Fire(); } public override InterruptPriority GetMinimumInterruptPriority() { return (InterruptPriority)1; } } public class CoatFlash : ManakaSkillState { private bool hit; public override void OnEnter() { //IL_0054: 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_0082: Unknown result type (might be due to invalid IL or missing references) base.OnEnter(); duration = Mathf.Max(0.28f, 0.52f / ((BaseState)this).attackSpeedStat); Anim("CoatOpen", duration, 0.05f); if (Object.op_Implicit((Object)(object)gmc)) { gmc.SetNipples(on: true); } ((BaseState)this).StartAimMode(((BaseState)this).GetAimRay(), 1.2f, false); if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor)) { CharacterMotor characterMotor = ((EntityState)this).characterMotor; characterMotor.moveDirection *= 0.55f; } } public override void FixedUpdate() { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0045: 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_00d6: 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_00ec: 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) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006b: 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_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_00a1: 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_00b6: 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_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) ((EntityState)this).FixedUpdate(); if (!hit && ((EntityState)this).fixedAge >= duration * 0.35f) { hit = true; Ray aimRay = ((BaseState)this).GetAimRay(); float num = 16f; Vector3 val = ((Ray)(ref aimRay)).origin + ((Ray)(ref aimRay)).direction * num; if (((EntityState)this).isAuthority) { Blast(val, 4.5f, 3.2f, new DamageTypeCombo(DamageTypeCombo.op_Implicit((DamageType)0), (DamageTypeExtended)0, (DamageSource)1), 260f, 60f); Blast(((EntityState)this).transform.position + Vector3.up * 0.9f, 4f, 2f, new DamageTypeCombo(DamageTypeCombo.op_Implicit((DamageType)0), (DamageTypeExtended)0, (DamageSource)1), 200f, 80f); } ManakaFx.Flash(val, 2.6f); ManakaFx.Flash(((EntityState)this).transform.position + Vector3.up * 1.1f, 1.6f); if (Object.op_Implicit((Object)(object)gmc) && Object.op_Implicit((Object)(object)gmc.driver)) { gmc.driver.Impulse(-FlatAim(), 0.35f); } } if (((EntityState)this).isAuthority && ((EntityState)this).fixedAge >= duration) { ((EntityState)this).outer.SetNextStateToMain(); } } public override void OnExit() { StopAnim(); ((EntityState)this).OnExit(); } public override InterruptPriority GetMinimumInterruptPriority() { return (InterruptPriority)0; } } public class Bareta : ManakaSkillState { private bool done; public override void OnEnter() { //IL_003b: Unknown result type (might be due to invalid IL or missing references) base.OnEnter(); duration = 0.75f; Anim("Bareta", duration); if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor)) { ((EntityState)this).characterMotor.moveDirection = Vector3.zero; } } public override void FixedUpdate() { //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: 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_0089: 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) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_003e: 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_0056: Unknown result type (might be due to invalid IL or missing references) ((EntityState)this).FixedUpdate(); if (!done && ((EntityState)this).fixedAge >= duration * 0.45f) { done = true; if (((EntityState)this).isAuthority) { Blast(((EntityState)this).transform.position, 12f, 2f, new DamageTypeCombo(DamageTypeCombo.op_Implicit((DamageType)32), (DamageTypeExtended)0, (DamageSource)2), 900f, 260f); } ManakaFx.Flash(((EntityState)this).transform.position + Vector3.up * 1.1f, 3.4f); ManakaFx.Hearts(((EntityState)this).transform.position + Vector3.up * 1.2f, 1f, 6); if (NetworkServer.active && Object.op_Implicit((Object)(object)((EntityState)this).characterBody)) { ((EntityState)this).characterBody.AddTimedBuff(Buffs.Cloak, 2.4f); ((EntityState)this).characterBody.AddTimedBuff(Buffs.CloakSpeed, 2.4f); } } if (((EntityState)this).isAuthority && ((EntityState)this).fixedAge >= duration) { ((EntityState)this).outer.SetNextStateToMain(); } } public override void OnExit() { StopAnim(); ((EntityState)this).OnExit(); } public override InterruptPriority GetMinimumInterruptPriority() { return (InterruptPriority)3; } } public class GoldenRain : ManakaSkillState { private float nextTick; private int ticks; private const int MaxTicks = 9; private const float Range = 12f; private const float StreamRadius = 1.7f; public override void OnEnter() { //IL_0030: 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) base.OnEnter(); duration = 1.15f; Anim("EroAction_StandPee", duration * 0.72f); ((BaseState)this).StartAimMode(((BaseState)this).GetAimRay(), 1.5f, true); if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor)) { ((EntityState)this).characterMotor.moveDirection = Vector3.zero; } } public override void FixedUpdate() { //IL_0019: 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_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0099: 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_00a1: 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_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: 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_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: 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_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0123: 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_012a: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Expected O, but got Unknown ((EntityState)this).FixedUpdate(); if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor)) { ((EntityState)this).characterMotor.moveDirection = Vector3.zero; } nextTick -= Time.fixedDeltaTime; if (((EntityState)this).isAuthority && nextTick <= 0f && ticks < 9) { nextTick = 0.09f; ticks++; float num = (float)ticks / 9f; Vector3 val = FlatAim() + Vector3.up * 0.28f; Vector3 normalized = ((Vector3)(ref val)).normalized; Vector3 origin = ((EntityState)this).transform.position + Vector3.up * 0.85f + FlatAim() * 0.5f; ManakaProjectiles.FireSquirt(((EntityState)this).gameObject, origin, Quaternion.AngleAxis(Mathf.Lerp(-9f, 9f, num), Vector3.up) * normalized, ((BaseState)this).damageStat * 0.7f, 26f); EffectManager.SpawnEffect(ManakaProjectiles.StreamVfx, new EffectData { origin = origin, scale = 0.7f }, true); } if (((EntityState)this).isAuthority && ((EntityState)this).fixedAge >= duration) { if (Object.op_Implicit((Object)(object)((EntityState)this).characterBody)) { ((EntityState)this).characterBody.AddTimedBuff(ManakaContent.SlickBuff, 4f); } ((EntityState)this).outer.SetNextStateToMain(); } } public override void OnExit() { StopAnim(); ((EntityState)this).OnExit(); } public override InterruptPriority GetMinimumInterruptPriority() { return (InterruptPriority)3; } } public class ToyOverload : ManakaSkillState { private bool burst; private const float Channel = 1.35f; public override void OnEnter() { //IL_003a: Unknown result type (might be due to invalid IL or missing references) base.OnEnter(); duration = 2.25f; Anim("OnaniNormal", 1.35f, 0.08f, loop: true); if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor)) { ((EntityState)this).characterMotor.moveDirection = Vector3.zero; } } public override void FixedUpdate() { //IL_0019: 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_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: 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) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0185: 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_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) ((EntityState)this).FixedUpdate(); if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor)) { ((EntityState)this).characterMotor.moveDirection = Vector3.zero; } if (!burst && ((EntityState)this).fixedAge >= 1.35f) { burst = true; Anim("IkuStand", 0.9f, 0.05f); if (Object.op_Implicit((Object)(object)gmc) && Object.op_Implicit((Object)(object)gmc.driver)) { gmc.driver.Impulse(Vector3.up, 0.9f); } if (((EntityState)this).isAuthority) { Blast(((EntityState)this).transform.position, 14f, 11f, new DamageTypeCombo(DamageTypeCombo.op_Implicit((DamageType)32), (DamageTypeExtended)0, (DamageSource)8), 3200f, 800f); Vector3 val = ((EntityState)this).transform.position + Vector3.up * 1.1f; CharacterBody val2 = FindNearestEnemy(45f); for (int i = 0; i < 12; i++) { float num = (float)i * 30f * (MathF.PI / 180f); Vector3 val3 = new Vector3(Mathf.Sin(num), 0.3f, Mathf.Cos(num)); Vector3 normalized = ((Vector3)(ref val3)).normalized; if (i % 2 == 1 && Object.op_Implicit((Object)(object)val2)) { Vector3 val4 = val2.corePosition - val; if (((Vector3)(ref val4)).sqrMagnitude > 0.01f) { normalized = ((Vector3)(ref val4)).normalized; } } ManakaProjectiles.FireSquirt(((EntityState)this).gameObject, val + normalized * 0.6f, normalized, ((BaseState)this).damageStat * 1.6f, 26f); } ManakaFx.Flash(val, 4.5f); ManakaFx.Hearts(val, 1.6f, 10); if (Object.op_Implicit((Object)(object)((EntityState)this).characterBody)) { ((EntityState)this).characterBody.AddTimedBuff(ManakaContent.AfterglowBuff, 7f); } } } if (((EntityState)this).isAuthority && ((EntityState)this).fixedAge >= duration) { ((EntityState)this).outer.SetNextStateToMain(); } } private CharacterBody FindNearestEnemy(float range) { //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_009f: 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_007b: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) CharacterBody result = null; float num = range * range; List<CharacterBody> instancesList = CharacterBody.instancesList; for (int i = 0; i < instancesList.Count; i++) { CharacterBody val = instancesList[i]; if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)val.healthComponent) && val.healthComponent.alive && (!Object.op_Implicit((Object)(object)((EntityState)this).characterBody) || !Object.op_Implicit((Object)(object)val.teamComponent) || !Object.op_Implicit((Object)(object)((EntityState)this).characterBody.teamComponent) || val.teamComponent.teamIndex != ((EntityState)this).characterBody.teamComponent.teamIndex)) { Vector3 val2 = val.corePosition - ((EntityState)this).transform.position; float sqrMagnitude = ((Vector3)(ref val2)).sqrMagnitude; if (sqrMagnitude < num) { num = sqrMagnitude; result = val; } } } return result; } public override void OnExit() { StopAnim(); ((EntityState)this).OnExit(); } public override InterruptPriority GetMinimumInterruptPriority() { return (InterruptPriority)7; } } public class ManakaDeath : GenericCharacterDeath { public override void PlayDeathAnimation(float crossfadeDuration = 0.1f) { ManakaModelController manakaModelController = ManakaModelController.Of(((EntityState)this).GetModelTransform()); if (Object.op_Implicit((Object)(object)manakaModelController) && Object.op_Implicit((Object)(object)manakaModelController.driver)) { manakaModelController.driver.PlayAction("Sad", -1f, 0.1f, loop: false, 9999f); } } } } namespace ManakaSurvivor.Projectiles { internal static class ManakaProjectiles { public static GameObject Squirt; public static GameObject FlashVfx; public static GameObject ClimaxVfx; public static GameObject StreamVfx; private static Material ghostMaterial; public static void Create() { //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) FlashVfx = LegacyResourcesAPI.Load<GameObject>("Prefabs/Effects/OmniEffect/OmniExplosionVFXQuick"); ClimaxVfx = LegacyResourcesAPI.Load<GameObject>("Prefabs/Effects/ImpactEffects/ExplosionVFX"); StreamVfx = LegacyResourcesAPI.Load<GameObject>("Prefabs/Effects/ImpactEffects/CharacterLandImpact"); GameObject val = PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load<GameObject>("Prefabs/Projectiles/CommandoGrenadeProjectile"), "ManakaSquirtProjectile", true); for (int num = val.transform.childCount - 1; num >= 0; num--) { Object.DestroyImmediate((Object)(object)((Component)val.transform.GetChild(num)).gameObject); } ApplyTorqueOnStart component = val.GetComponent<ApplyTorqueOnStart>(); if (Object.op_Implicit((Object)(object)component)) { Object.DestroyImmediate((Object)(object)component); } ProjectileSimple component2 = val.GetComponent<ProjectileSimple>(); if (Object.op_Implicit((Object)(object)component2)) { component2.lifetime = 3f; component2.desiredForwardSpeed = 16f; } ProjectileImpactExplosion component3 = val.GetComponent<ProjectileImpactExplosion>(); if (Object.op_Implicit((Object)(object)component3)) { ((ProjectileExplosion)component3).blastRadius = 3.4f; ((ProjectileExplosion)component3).blastDamageCoefficient = 1f; ((ProjectileExplosion)component3).blastProcCoefficient = 0.8f; ((ProjectileExplosion)component3).falloffModel = (FalloffModel)0; component3.impactEffect = FlashVfx; component3.lifetime = 3f; component3.destroyOnEnemy = true; component3.destroyOnWorld = true; ((ProjectileExplosion)component3).bonusBlastForce = new Vector3(0f, 220f, 0f); } ProjectileDamage component4 = val.GetComponent<ProjectileDamage>(); if (Object.op_Implicit((Object)(object)component4)) { component4.damageType = new DamageTypeCombo(DamageTypeCombo.op_Implicit((DamageType)8), (DamageTypeExtended)0, (DamageSource)8); } ProjectileController component5 = val.GetComponent<ProjectileController>(); if (Object.op_Implicit((Object)(object)component5)) { component5.allowPrediction = false; component5.ghostPrefabAddress = new AssetReferenceT<GameObject>(""); component5.ghostPrefab = MakeDropletGhost(); } Rigidbody component6 = val.GetComponent<Rigidbody>(); if (Object.op_Implicit((Object)(object)component6)) { component6.useGravity = true; component6.mass = 0.4f; } ContentAddition.AddProjectile(val); Squirt = val; } private static GameObject MakeDropletGhost() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0021: 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_00c5: Expected O, but got Unknown //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Expected O, but got Unknown //IL_006b: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("ManakaSquirtGhost"); val.AddComponent<MeshFilter>().sharedMesh = BuildSphere(0.22f, 8, 8); MeshRenderer obj = val.AddComponent<MeshRenderer>(); if (!Object.op_Implicit((Object)(object)ghostMaterial)) { ghostMaterial = new Material(LegacyResourcesAPI.Load<Shader>("Shaders/Deferred/HGStandard")) { name = "matManakaSquirt" }; ghostMaterial.SetColor("_Color", new Color(1f, 0.93f, 0.62f)); ghostMaterial.SetFloat("_EmPower", 0.6f); ghostMaterial.SetFloat("_Smoothness", 0.7f); ghostMaterial.EnableKeyword("DITHER"); } ((Renderer)obj).sharedMaterial = ghostMaterial; ((Renderer)obj).shadowCastingMode = (ShadowCastingMode)0; val.AddComponent<ProjectileGhostController>(); return val; } private static Mesh BuildSphere(float r, int rings, int segs) { //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_008a: 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_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0130: 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_0142: 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_0151: 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_0160: Expected O, but got Unknown List<Vector3> list = new List<Vector3>(); List<Vector3> list2 = new List<Vector3>(); List<Vector2> list3 = new List<Vector2>(); List<int> list4 = new List<int>(); Vector3 val = default(Vector3); for (int i = 0; i <= rings; i++) { float num = (float)i / (float)rings; float num2 = num * MathF.PI; for (int j = 0; j <= segs; j++) { float num3 = (float)j / (float)segs; float num4 = num3 * MathF.PI * 2f; ((Vector3)(ref val))..ctor(Mathf.Sin(num2) * Mathf.Cos(num4), Mathf.Cos(num2), Mathf.Sin(num2) * Mathf.Sin(num4)); list.Add(val * r); list2.Add(val); list3.Add(new Vector2(num3, 1f - num)); } } int num5 = segs + 1; for (int k = 0; k < rings; k++) { for (int l = 0; l < segs; l++) { int num6 = k * num5 + l; int num7 = num6 + num5; list4.Add(num6); list4.Add(num7); list4.Add(num6 + 1); list4.Add(num6 + 1); list4.Add(num7); list4.Add(num7 + 1); } } Mesh val2 = new Mesh { name = "ManakaDroplet" }; val2.SetVertices(list); val2.SetNormals(list2); val2.SetUVs(0, list3); val2.SetTriangles(list4, 0); val2.RecalculateBounds(); return val2; } public static void FireSquirt(GameObject owner, Vector3 origin, Vector3 dir, float damage, float speed) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)Squirt)) { ProjectileManager.instance.FireProjectile(Squirt, origin, Util.QuaternionSafeLookRotation(dir), owner, damage, 120f, Object.op_Implicit((Object)(object)owner.GetComponent<CharacterBody>()) && owner.GetComponent<CharacterBody>().RollCrit(), (DamageColorIndex)0, (GameObject)null, speed, (DamageTypeCombo?)null); } } } } namespace ManakaSurvivor.Model { public static class ManakaItemDisplays { private struct BoneFrame { public Quaternion Rotation; public float Scale; } private static readonly Dictionary<string, BoneFrame> commandoFrames = new Dictionary<string, BoneFrame>(); private static float commandoHeight; private const float BuildFactor = 0.95f; private static readonly Dictionary<string, string[]> BoneMap = new Dictionary<string, string[]>(StringComparer.OrdinalIgnoreCase) { { "Base", new string[1] { "Hips" } }, { "Root", new string[1] { "Hips" } }, { "Pelvis", new string[1] { "Hips" } }, { "Stomach", new string[1] { "Spine" } }, { "Chest", new string[1] { "Chest" } }, { "Neck", new string[1] { "Neck" } }, { "Head", new string[1] { "Head" } }, { "ShoulderL", new string[1] { "LeftShoulder" } }, { "ShoulderR", new string[1] { "RightShoulder" } }, { "UpperArmL", new string[1] { "LeftUpperArm" } }, { "UpperArmR", new string[1] { "RightUpperArm" } }, { "LowerArmL", new string[1] { "LeftLowerArm" } }, { "LowerArmR", new string[1] { "RightLowerArm" } }, { "HandL", new string[1] { "LeftHand" } }, { "HandR", new string[1] { "RightHand" } }, { "GunL", new string[1] { "LeftHand" } }, { "GunR", new string[1] { "RightHand" } }, { "MuzzleLeft", new string[1] { "LeftHand" } }, { "MuzzleRight", new string[1] { "RightHand" } }, { "ThighL", new string[1] { "LeftUpperLeg" } }, { "ThighR", new string[1] { "RightUpperLeg" } }, { "CalfL", new string[1] { "LeftLowerLeg" } }, { "CalfR", new string[1] { "RightLowerLeg" } }, { "FootL", new string[1] { "LeftFoot" } }, { "FootR", new string[1] { "RightFoot" } }, { "ToeL", new string[1] { "LeftFoot" } }, { "ToeR", new string[1] { "RightFoot" } } }; public static ItemDisplayRuleSet RuleSet { get; private set; } public static void CaptureFromCommando(GameObject commandoBody) { //IL_007b: 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_0085: 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_00ae: 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_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: 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_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: 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_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_0100: 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) object obj; if (!Object.op_Implicit((Object)(object)commandoBody)) { obj = null; } else { ModelLocator component = commandoBody.GetComponent<ModelLocator>(); obj = ((component != null) ? component.modelTransform : null); } Transform val = (Transform)obj; CharacterModel val2 = (Object.op_Implicit((Object)(object)val) ? ((Component)val).GetComponent<CharacterModel>() : null); ChildLocator val3 = (Object.op_Implicit((Object)(object)val) ? ((Component)val).GetComponent<ChildLocator>() : null); if (!Object.op_Implicit((Object)(object)val2) || !Object.op_Implicit((Object)(object)val3) || !Object.op_Implicit((Object)(object)val2.itemDisplayRuleSet)) { ManakaPlugin.Log.LogWarning((object)"Commando item display rules not found"); return; } RuleSet = val2.itemDisplayRuleSet; Quaternion val4 = Quaternion.Inverse(val.rotation); float num = Mathf.Max(1E-06f, val.lossyScale.x); NameTransformPair[] transformPairs = val3.transformPairs; foreach (NameTransformPair val5 in transformPairs) { if (Object.op_Implicit((Object)(object)val5.transform) && !string.IsNullOrEmpty(val5.name)) { commandoFrames[val5.name] = new BoneFrame { Rotation = val4 * val5.transform.rotation, Scale = val5.transform.lossyScale.x / num }; } } Transform val6 = val3.FindChild("Head"); commandoHeight = (Object.op_Implicit((Object)(object)val6) ? (val.InverseTransformPoint(val6.position).y * num) : 1.6f); } public static List<NameTransformPair> Attach(Transform modelRoot, ManakaRig rig) { //IL_004b: 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_0062: 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_013d: 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_015a: 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_0186: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) List<NameTransformPair> list = new List<NameTransformPair>(); if (!Object.op_Implicit((Object)(object)RuleSet) || rig == null || commandoFrames.Count == 0 || commandoHeight < 0.01f) { return list; } Transform val = rig.Joint("Head"); if (!Object.op_Implicit((Object)(object)val)) { return list; } float num = Mathf.Max(1E-06f, modelRoot.lossyScale.x); float num2 = modelRoot.InverseTransformPoint(val.position).y * num / commandoHeight * 0.95f; Transform val2 = rig.Joint("Chest") ?? rig.Joint("Hips"); foreach (KeyValuePair<string, BoneFrame> commandoFrame in commandoFrames) { Transform val3 = null; if (BoneMap.TryGetValue(commandoFrame.Key, out var value)) { string[] array = value; foreach (string name in array) { val3 = rig.Joint(name); if (Object.op_Implicit((Object)(object)val3)) { break; } } } if (!Object.op_Implicit((Object)(object)val3)) { val3 = val2; } if (Object.op_Implicit((Object)(object)val3)) { Transform transform = new GameObject("IDRS_" + commandoFrame.Key).transform; transform.SetParent(val3, false); transform.rotation = modelRoot.rotation * commandoFrame.Value.Rotation; transform.localScale = Vector3.one * (commandoFrame.Value.Scale * num2 * num / Mathf.Max(1E-06f, val3.lossyScale.x)); list.Add(new NameTransformPair { name = commandoFrame.Key, transform = transform }); } } return list; } public static void Refresh(CharacterModel model, CharacterBody body) { //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_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: 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_0046: Invalid comparison between Unknown and I4 //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Invalid comparison between Unknown and I4 //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Invalid comparison between Unknown and I4 //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Invalid comparison between Unknown and I4 //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) Inventory val = (Object.op_Implicit((Object)(object)body) ? body.inventory : null); if (Object.op_Implicit((Object)(object)model) && Object.op_Implicit((Object)(object)model.itemDisplayRuleSet) && Object.op_Implicit((Object)(object)val)) { EquipmentIndex currentEquipmentDisplayIndex = model.currentEquipmentDisplayIndex; KeyItemIndex currentKeyItemDisplayIndex = model.currentKeyItemDisplayIndex; model.DisableAllItemDisplays(); if ((int)currentEquipmentDisplayIndex != -1) { model.SetEquipmentDisplay((EquipmentIndex)(-1)); } if ((int)currentKeyItemDisplayIndex != -1) { model.SetKeyItemDisplay((KeyItemIndex)(-1)); } model.UpdateItemDisplay(val); if ((int)currentEquipmentDisplayIndex != -1) { model.SetEquipmentDisplay(currentEquipmentDisplayIndex); } if ((int)currentKeyItemDisplayIndex != -1) { model.SetKeyItemDisplay(currentKeyItemDisplayIndex); } } } } [DisallowMultipleComponent] public sealed class ManakaModelController : MonoBehaviour { public bool isDisplay; public ManakaRig rig; public ManakaPoseDriver driver; public int skinListIndex = -1; private CharacterModel characterModel; private ModelSkinController skinController; private ChildLocator childLocator; private CharacterBody body; private bool built; private readonly List<NameTransformPair> itemAnchors = new List<NameTransformPair>(); private float flashOpen; private Coroutine flashRoutine; private void Awake() { characterModel = ((Component)this).GetComponent<CharacterModel>(); skinController = ((Component)this).GetComponent<ModelSkinController>(); childLocator = ((Component)this).GetComponent<ChildLocator>(); driver = ((Component)this).GetComponent<ManakaPoseDriver>() ?? ((Component)this).gameObject.AddComponent<ManakaPoseDriver>(); if (Object.op_Implicit((Object)(object)skinController)) { skinController.onSkinApplied += OnSkinApplied; } } private void OnDestroy() { if (Object.op_Implicit((Object)(object)skinController)) { skinController.onSkinApplied -= OnSkinApplied; } } private void Start() { if (Object.op_Implicit((Object)(object)characterModel)) { body = characterModel.body; } BuildForSkin((Object.op_Implicit((Object)(object)skinController) && skinController.currentSkinIndex >= 0) ? skinController.currentSkinIndex : 0); } private void OnSkinApplied(int index) { if (built && (index == skinListIndex || index < 0)) { ApplyRendererInfos(); } else { BuildForSkin(index); } } public void BuildForSkin(int listIndex) { if (ManakaAssets.Outfits.Count == 0) { return; } if (listIndex < 0 || listIndex >= ManakaAssets.Outfits.Count) { listIndex = 0; } if (built && listIndex == skinListIndex) { return; } ManakaOutfit outfit = ManakaAssets.Outfit(listIndex); skinListIndex = listIndex; if (rig == null) { rig = ManakaRig.Build(((Component)this).transform, ManakaPlugin.UnitScale.Value, "Rig_Manaka"); itemAnchors.Clear(); if (!isDisplay) { itemAnchors.AddRange(ManakaItemDisplays.Attach(((Component)this).transform, rig)); } } rig.ApplyOutfit(outfit); rig.SetFlash(flashOpen); built = true; if (Object.op_Implicit((Object)(object)characterModel)) { body = characterModel.body; } driver.Bind(rig, ManakaAssets.Clips); ApplyRendererInfos(); UpdateChildLocator(); if (!isDisplay) { ManakaItemDisplays.Refresh(characterModel, body); } characterModel.forceUpdate = true; } private void LateUpdate() { if (built && rig != null) { rig.RestoreMaterials(); rig.RestoreShapes(); } } private void ApplyRendererInfos() { if (Object.op_Implicit((Object)(object)characterModel) && rig != null) { characterModel.baseRendererInfos = rig.RendererInfos(); rig.RestoreMaterials(); characterModel.forceUpdate = true; } } private void UpdateChildLocator() { //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_019a: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_025b: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)childLocator) || rig == null) { return; } List<NameTransformPair> pairs = new List<NameTransformPair>(); Add("Head", rig.Joint("Head")); Add("Chest", rig.Joint("Chest")); Add("Pelvis", rig.Joint("Hips")); Add("Root", (rig.joints.Length != 0) ? rig.joints[0] : null); Add("HandL", rig.Joint("Hand_L")); Add("HandR", rig.Joint("Hand_R")); Add("MuzzleHandR", rig.Joint("Hand_R")); Add("MuzzleHandL", rig.Joint("Hand_L")); Add("FootL", rig.Joint("Foot_L")); Add("FootR", rig.Joint("Foot_R")); foreach (NameTransformPair a in itemAnchors) { pairs.RemoveAll((NameTransformPair p) => p.name == a.name); if (Object.op_Implicit((Object)(object)a.transform)) { pairs.Add(a); } } NameTransformPair[] transformPairs = childLocator.transformPairs; if (transformPairs != null) { NameTransformPair[] array = transformPairs; for (int num = 0; num < array.Length; num++) { NameTransformPair e = array[num]; if (Object.op_Implicit((Object)(object)e.transform) && Object.op_Implicit((Object)(object)rig.root) && !e.transform.IsChildOf(rig.root.transform) && !pairs.Exists((NameTransformPair p) => p.name == e.name)) { pairs.Add(e); } } } childLocator.transformPairs = pairs.ToArray(); void Add(string n, Transform t) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)t)) { pairs.Add(new NameTransformPair { name = n, transform = t }); } } } public void OpenCoatFor(float seconds) { if (((Behaviour)this).isActiveAndEnabled) { if (flashRoutine != null) { ((MonoBehaviour)this).StopCoroutine(flashRoutine); } flashRoutine = ((MonoBehaviour)this).StartCoroutine(FlashFor(seconds)); } } private IEnumerator FlashFor(float seconds) { SetFlash(1f); float num = Mathf.Max(0.15f, seconds - 0.3f); yield return (object)new WaitForSeconds(num); for (float t = 0f; t < 1f; t += Time.deltaTime / 0.3f) { SetFlash(1f - t); yield return null; } SetFlash(0f); flashRoutine = null; } public void SetFlash(float t) { flashOpen = Mathf.Clamp01(t); if (rig != null) { rig.SetFlash(flashOpen); } } public void SetNipples(bool on) { if (rig != null) { rig.SetNipples(on); } } public static ManakaModelController Of(CharacterBody b) { if (!Object.op_Implicit((Object)(object)b) || !Object.op_Implicit((Object)(object)b.modelLocator) || !Object.op_Implicit((Object)(object)b.modelLocator.modelTransform)) { return null; } return ((Component)b.modelLocator.modelTransform).GetComponent<ManakaModelController>(); } public static ManakaModelController Of(Transform modelTransform) { if (!Object.op_Implicit((Object)(object)modelTransform)) { return null; } return ((Component)modelTransform).GetComponent<ManakaModelController>(); } } public sealed class ManakaPoseDriver : MonoBehaviour { private sealed class SecondaryBone { public Transform t; public Quaternion rest; public Vector3 axisScale; public Vector3 offset; public Vector3 velocity; public float stiffness; public float damping; } private sealed class Jiggle { public Transform t; public Vector3 restLocal; public Vector3 p; public Vector3 v; public bool init; public float k; public float c; public float gain; public float max; public Vector3 axis; public float lastOffset; } private ManakaRig rig; private ManakaClipSet clips; private Transform root; private Avatar avatar; private HumanPoseHandler handler; private HumanPose pose; private int muscleCount; private static Dictionary<string, int> muscleNames; private ManakaClip action; private float actionTime; private float actionSpeed = 1f; private float actionBlend; private bool actionLoop; private bool actionActive; private float actionHold; private ManakaClip loco; private float locoTime; private string locoKey = ""; private float blendT = 1f; private float blendDur = 0.15f; private float[] fromMuscles; private float[] toMuscles; private Vector3 fromPos; private Vector3 toPos; private Quaternion fromRot; private Quaternion toRot; private CharacterBody body; private CharacterMotor motor; public float runSpeedBaseline = 6.5f; private readonly List<SecondaryBone> secondary = new List<SecondaryBone>(); private Vector3 lastVelocity; private Vector3 lastAccel; private float lastYaw; private float yawRate; private Vector3 swing; private Vector3 swingVel; private readonly List<Jiggle> jiggle = new List<Jiggle>(); private Vector3 defaultBodyPos = new Vector3(0f, 1f, 0f); private static readonly string[] RootNames = new string[7] { "RootT.x", "RootT.y", "RootT.z", "RootQ.x", "RootQ.y", "RootQ.z", "RootQ.w" }; private readonly Dictionary<ManakaClip, int[]> rootIndex = new Dictionary<ManakaClip, int[]>(); private float[] boneBuffer; public bool IsActionPlaying => actionActive; public string CurrentClipName { get { if (!actionActive || action == null) { if (loco == null) { return ""; } return loco.name; } return action.name; } } public bool AvatarReady { get { if ((Object)(object)avatar != (Object)null && avatar.isValid) { return avatar.isHuman; } return false; } } public string DebugMuscles() { //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0123: 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_012c: Unknown result type (might be due to invalid IL or missing references) ManakaClip manakaClip = (actionActive ? action : loco); if (manakaClip == null) { return "no clip"; } int num = 0; int num2 = 0; int num3 = 0; string text = null; for (int i = 0; i < manakaClip.channels.Length; i++) { if (manakaClip.channels[i].StartsWith("bs:")) { num3++; continue; } if (manakaClip.muscleIndex[i] < 0) { manakaClip.muscleIndex[i] = ResolveMuscle(manakaClip.channels[i]); } if (manakaClip.muscleIndex[i] >= 0) { num++; continue; } num2++; if (text == null) { text = manakaClip.channels[i]; } } Transform val = ((rig != null) ? rig.Joint("UpperArm_L") : null); string text2 = $"clip={manakaClip.name} channels={manakaClip.channels.Length} muscles={num} unmatched={num2} shapeChannels={num3} "; string arg = text; object arg2; if (!Object.op_Implicit((Object)(object)val)) { arg2 = "none"; } else { Quaternion localRotation = val.localRotation; arg2 = ((object)((Quaternion)(ref localRotation)).eulerAngles/*cast due to .constrained prefix*/).ToString(); } return text2 + $"firstUnmatched='{arg}' | armRot={arg2} | parts={rig.renderers.Count}"; } public void Bind(ManakaRig newRig, ManakaClipSet newClips) { rig = newRig; clips = newClips; root = rig.root.transform; body = ((Component)this).GetComponentInParent<CharacterModel>()?.body; motor = (Object.op_Implicit((Object)(object)body) ? ((Component)body).GetComponent<CharacterMotor>() : null); BuildAvatar(); BuildSecondary(); } private void BuildAvatar() { //IL_0078: 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_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_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) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0120: 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_014a: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_0192: 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_0175: Unknown result type (might be due to invalid IL or missing references) //IL_0264: Unknown result type (might be due to invalid IL or missing references) //IL_02c8: Unknown result type (might be due to invalid IL or missing references) //IL_02ca: Unknown result type (might be due to invalid IL or missing references) //IL_02d7: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_022a: Unknown result type (might be due to invalid IL or missing references) //IL_0238: Unknown result type (might be due to invalid IL or missing references) //IL_023a: Unknown result type (might be due to invalid IL or missing references) //IL_023f: Unknown result type (might be due to invalid IL or missing references) //IL_033d: Unknown result type (might be due to invalid IL or missing references) //IL_0347: Expected O, but got Unknown //IL_0349: Unknown result type (might be due to invalid IL or missing references) //IL_03bc: Unknown result type (might be due to invalid IL or missing references) //IL_03be: Unknown result type (might be due to invalid IL or missing references) //IL_03ad: Unknown result type (might be due to invalid IL or missing references) //IL_03b2: Unknown result type (might be due to invalid IL or missing references) muscleCount = HumanTrait.MuscleCount; if (muscleNames == null) { muscleNames = new Dictionary<string, int>(StringComparer.OrdinalIgnoreCase); for (int i = 0; i < muscleCount; i++) { muscleNames[HumanTrait.MuscleName[i]] = i; muscleNames[Normalise(HumanTrait.MuscleName[i])] = i; } } ManakaManifest manifest = rig.manifest; List<SkeletonBone> list = new List<SkeletonBone>(); list.Add(new SkeletonBone { name = ((Object)root).name, position = Vector3.zero, rotation = Quaternion.identity, scale = Vector3.one }); for (int j = 0; j < rig.joints.Length; j++) { ManakaJoint manakaJoint = manifest.skeleton[j]; list.Add(new SkeletonBone { name = ((Object)rig.joints[j]).name, position = Vec3((manakaJoint.tpos != null && manakaJoint.tpos.Length >= 3) ? manakaJoint.tpos : manakaJoint.pos), rotation = (Quaternion)((manakaJoint.trot != null && manakaJoint.trot.Length >= 4) ? new Quaternion(manakaJoint.trot[0], manakaJoint.trot[1], manakaJoint.trot[2], manakaJoint.trot[3]) : Quat(manakaJoint.rot)), scale = Vec3(manakaJoint.scl, Vector3.one) }); } List<HumanBone> list2 = new List<HumanBone>(); foreach (KeyValuePair<string, int> item2 in manifest.human) { int value = item2.Value; if (value >= 0 && value < rig.joints.Length) { HumanBone item = default(HumanBone); ((HumanBone)(ref item)).boneName = ((Object)rig.joints[value]).name; ((HumanBone)(ref item)).humanName = item2.Key; HumanLimit limit = default(HumanLimit); ((HumanLimit)(ref limit)).useDefaultValues = true; item.limit = limit; list2.Add(item); } } HumanDescription val = new HumanDescription { human = list2.ToArray(), skeleton = list.ToArray() }; ((HumanDescription)(ref val)).upperArmTwist = 0.5f; ((HumanDescription)(ref val)).lowerArmTwist = 0.5f; ((HumanDescription)(ref val)).upperLegTwist = 0.5f; ((HumanDescription)(ref val)).lowerLegTwist = 0.5f; ((HumanDescription)(ref val)).feetSpacing = 0f; ((HumanDescription)(ref val)).hasTranslationDoF = false; HumanDescription val2 = val; avatar = AvatarBuilder.BuildHumanAvatar(((Component)root).gameObject, val2); if (!((Object)(object)avatar != (Object)null) || !avatar.isValid || !avatar.isHuman) { Debug.LogWarning((object)$"[Manaka] avatar invalid bones={list2.Count}/{list.Count}"); return; } handler = new HumanPoseHandler(avatar, root); HumanPose val3 = default(HumanPose); handler.GetHumanPose(ref val3); ManakaClip manakaClip = clips?.Find("Female_Idle_Base"); if (manakaClip != null && RootChannels(manakaClip)[1] >= 0) { defaultBodyPos = new Vector3(0f, Ch(manakaClip, RootChannels(manakaClip)[1], 0f, 1f), 0f); } Debug.Log((object)$"[Manaka] avatar ok, rest bodyPosition={val3.bodyPosition} idle RootT.y={defaultBodyPos.y:F3} manifestHumanScale={rig.manifest.humanScale:F3}"); } private static Vector3 Vec3(float[] a, Vector3 fallback = default(Vector3)) { //IL_0009: 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) if (a == null || a.Length < 3) { return fallback; } return new Vector3(a[0], a[1], a[2]); } private static Quaternion Quat(float[] a) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) if (a == null || a.Length < 4) { return Quaternion.identity; } return new Quaternion(a[0], a[1], a[2], a[3]); } private void BuildSecondary() { //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) secondary.Clear(); BuildJiggle(); Transform[] joints = rig.joints; foreach (Transform val in joints) { if (!((Object)(object)val == (Object)null)) { string name = ((Object)val).name; if (name.IndexOf("hair", StringComparison.OrdinalIgnoreCase) >= 0 && name.IndexOf("root", StringComparison.OrdinalIgnoreCase) < 0) { AddBone(name, new Vector3(1f, 0.7f, 1f), 26f, 0.4f); } } } joints = rig.joints; foreach (Transform val2 in joints) { if (!((Object)(object)val2 == (Object)null)) { string name2 = ((Object)val2).name; if (name2.IndexOf("skirt", StringComparison.OrdinalIgnoreCase) >= 0) { AddBone(name2, new Vector3(1f, 0.5f, 1f), 20f, 0.35f); } } } } private void AddBone(string name, Vector3 scale, float stiffness, float damping) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: 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_0037: Unknown result type (might be due to invalid IL or missing references) Transform val = rig.Joint(name); if (!((Object)(object)val == (Object)null)) { secondary.Add(new SecondaryBone { t = val, rest = val.localRotation, axisScale = scale, stiffness = stiffness, damping = damping }); } } public void Impulse(Vector3 worldDir, float strength) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0009: 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_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: 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_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0041: 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) swingVel += ((Vector3)(ref worldDir)).normalized * strength; foreach (Jiggle item in jiggle) { item.v += ((Vector3)(ref worldDir)).normalized * strength * 0.2f; } } private void AddJiggle(string name, float k, float c, float gain, float max, Vector3 axis) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: 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_0056: Unknown result type (might be due to invalid IL or missing references) Transform val = rig.Joint(name); if (!((Object)(object)val == (Object)null)) { jiggle.Add(new Jiggle { t = val, restLocal = val.localPosition, k = k, c = c, gain = gain, max = max, axis = axis }); } } private void BuildJiggle() { //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) jiggle.Clear(); Vector3 axis = default(Vector3); ((Vector3)(ref axis))..ctor(0.8f, 1.4f, 1f); string[] array = new string[2] { "L", "R" }; foreach (string text in array) { AddJiggle("Breast_" + text, 300f, 5.5f, 2.3f, 0.06f, axis); AddJiggle("Breast_" + text + ".001", 220f, 4.5f, 1.2f, 0.035f, axis); AddJiggle("Butt_" + text, 260f, 8f, 1f, 0.03f, new Vector3(0.6f, 1.2f, 0.8f)); } } public string DebugJiggle() { StringBuilder stringBuilder = new StringBuilder(); foreach (Jiggle item in jiggle) { if (Object.op_Implicit((Object)(object)item.t)) { stringBuilder.Append($"{((Object)item.t).name}={item.lastOffset * 1000f:F1}mm "); } } return stringBuilder.ToString(); } private void UpdateJiggle(float dt) { //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008b: 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_0096: 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_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_00ba: 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_00c2: 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_00d3: 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_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: 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_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010b: 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_0116: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0147: 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_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0180: 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_0190: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) if (this.jiggle.Count == 0) { return; } dt = Mathf.Min(dt, 0.05f); int num = Mathf.Clamp(Mathf.CeilToInt(dt / 0.008f), 1, 6); float num2 = dt / (float)num; for (int i = 0; i < this.jiggle.Count; i++) { Jiggle jiggle = this.jiggle[i]; if (!((Object)(object)jiggle.t == (Object)null) && !((Object)(object)jiggle.t.parent == (Object)null)) { jiggle.t.localPosition = jiggle.restLocal; Vector3 position = jiggle.t.position; if (!jiggle.init) { jiggle.p = position; jiggle.v = Vector3.zero; jiggle.init = true; } _ = Vector3.zero; for (int j = 0; j < num; j++) { Vector3 val = (position - jiggle.p) * jiggle.k - jiggle.v * jiggle.c; jiggle.v += val * num2; jiggle.p += jiggle.v * num2; } Vector3 val2 = jiggle.p - position; Vector3 val3 = root.InverseTransformDirection(val2); val3 = Vector3.Scale(val3, jiggle.axis) * jiggle.gain; val2 = root.TransformDirection(val3); val2 = Vector3.ClampMagnitude(val2, jiggle.max * root.lossyScale.x); jiggle.lastOffset = ((Vector3)(ref val2)).magnitude; jiggle.t.position = position + val2; } } } public float PlayAction(string name, float duration = -1f, float blend = 0.1f, bool loop = false, float holdLast = 0f) { //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) ManakaClip manakaClip = clips?.Find(name); if (manakaClip == null) { return 0f; } action = manakaClip; actionTime = 0f; actionActive = true; actionLoop = loop; actionHold = holdLast; actionSpeed = ((duration > 0f && manakaClip.duration > 0.01f) ? (manakaClip.duration / duration) : 1f); actionBlend = blend; blendT = 0f; blendDur = Mathf.Max(0.01f, blend); if (handler != null) { handler.GetHumanPose(ref pose); fromMuscles = (float[])pose.muscles.Clone(); fromPos = pose.bodyPosition; fromRot = pose.bodyRotation; } return manakaClip.duration / actionSpeed; } public void CancelAction() { actionActive = false; locoKey = ""; } private void Update() { if (rig == null || clips == null || handler == null) { return; } float deltaTime = Time.deltaTime; UpdateLocomotion(deltaTime); if (actionActive) { actionTime += deltaTime * actionSpeed; if (actionLoop) { if (action.duration > 0.001f) { actionTime %= action.duration; } } else if (actionTime >= action.duration) { if (actionHold > 0f) { actionHold -= deltaTime; actionTime = action.duration; } else { actionActive = false; locoKey = ""; } } } if (blendT < 1f) { blendT = Mathf.Min(1f, blendT + deltaTime / blendDur); } } private void LateUpdate() { //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing re