Decompiled source of JohnPork v1.0.0

plugins/JohnPork/JohnPorkMod.dll

Decompiled 13 hours ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
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 AncientScepter;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using EntityStates;
using EntityStates.AI.Walker;
using EntityStates.Merc.Weapon;
using HG;
using HG.BlendableTypes;
using HG.Reflection;
using JohnPorkMod.Modules;
using JohnPorkMod.Modules.Achievements;
using JohnPorkMod.Modules.Characters;
using JohnPorkMod.Survivors.JohnPork;
using JohnPorkMod.Survivors.JohnPork.SkillStates;
using KinematicCharacterController;
using On.RoR2;
using R2API;
using R2API.Utils;
using RoR2;
using RoR2.Achievements;
using RoR2.Audio;
using RoR2.CameraModes;
using RoR2.CharacterAI;
using RoR2.ContentManagement;
using RoR2.Orbs;
using RoR2.Projectile;
using RoR2.Skills;
using RoR2.UI.MainMenu;
using UnityEngine;
using UnityEngine.Networking;
using UnityEngine.Rendering;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: OptIn]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("JohnPorkMod")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+302e02ddd314eaf8b61cbd83acb759d5499a4fe0")]
[assembly: AssemblyProduct("JohnPorkMod")]
[assembly: AssemblyTitle("JohnPorkMod")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace JohnPorkMod
{
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("com.hanu.JohnPork", "JohnPork", "1.0.0")]
	public class JohnPorkPlugin : BaseUnityPlugin
	{
		public const string MODUID = "com.hanu.JohnPork";

		public const string MODNAME = "JohnPork";

		public const string MODVERSION = "1.0.0";

		public const string DEVELOPER_PREFIX = "HANU";

		public static JohnPorkPlugin instance;

		public static string PluginDir => Path.GetDirectoryName(((BaseUnityPlugin)instance).Info.Location);

		private void Awake()
		{
			instance = this;
			Log.Init(((BaseUnityPlugin)this).Logger);
			Language.Init();
			new JohnPorkSurvivor().Initialize();
			new ContentPacks().Initialize();
		}
	}
	internal static class Log
	{
		internal static ManualLogSource _logSource;

		internal static void Init(ManualLogSource logSource)
		{
			_logSource = logSource;
		}

		internal static void Debug(object data)
		{
			_logSource.LogDebug(data);
		}

		internal static void Error(object data)
		{
			_logSource.LogError(data);
		}

		internal static void ErrorAssetBundle(string assetName, string bundleName)
		{
			Error("failed to load asset, " + assetName + ", because it does not exist in asset bundle, " + bundleName);
		}

		internal static void Fatal(object data)
		{
			_logSource.LogFatal(data);
		}

		internal static void Info(object data)
		{
			_logSource.LogInfo(data);
		}

		internal static void Message(object data)
		{
			_logSource.LogMessage(data);
		}

		internal static void Warning(object data)
		{
			_logSource.LogWarning(data);
		}
	}
}
namespace JohnPorkMod.Survivors.JohnPork
{
	public class AnimLayerFader : MonoBehaviour
	{
		private static readonly int emptyHash = Animator.StringToHash("BufferEmpty");

		private static readonly string[] layerNames = new string[2] { "Gesture, Override", "FullBody, Override" };

		private Animator animator;

		private int[] layers;

		private void Awake()
		{
			animator = ((Component)this).GetComponent<Animator>();
			if (!Object.op_Implicit((Object)(object)animator))
			{
				((Behaviour)this).enabled = false;
				return;
			}
			layers = new int[layerNames.Length];
			for (int i = 0; i < layerNames.Length; i++)
			{
				layers[i] = animator.GetLayerIndex(layerNames[i]);
			}
		}

		private void Update()
		{
			if (!((Behaviour)animator).isActiveAndEnabled)
			{
				return;
			}
			int[] array = layers;
			foreach (int num in array)
			{
				if (num >= 0)
				{
					animator.SetLayerWeight(num, Weight(num));
				}
			}
		}

		private float Weight(int layer)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: 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_005c: 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)
			AnimatorStateInfo val = animator.GetCurrentAnimatorStateInfo(layer);
			bool flag = ((AnimatorStateInfo)(ref val)).shortNameHash == emptyHash;
			if (!animator.IsInTransition(layer))
			{
				if (!flag)
				{
					return 1f;
				}
				return 0f;
			}
			val = animator.GetNextAnimatorStateInfo(layer);
			bool flag2 = ((AnimatorStateInfo)(ref val)).shortNameHash == emptyHash;
			AnimatorTransitionInfo animatorTransitionInfo = animator.GetAnimatorTransitionInfo(layer);
			float num = Mathf.Clamp01(((AnimatorTransitionInfo)(ref animatorTransitionInfo)).normalizedTime);
			if (flag && !flag2)
			{
				return num;
			}
			if (!flag && flag2)
			{
				return 1f - num;
			}
			if (!flag)
			{
				return 1f;
			}
			return 0f;
		}
	}
	public class CallPopup : MonoBehaviour
	{
		private const float Lifetime = 1.6f;

		private const float WorldHeight = 1.5f;

		private static Sprite sprite;

		private CharacterBody body;

		private SpriteRenderer sr;

		private float age;

		private float answeredAt = -1f;

		private Transform head;

		public static CallPopup Spawn(CharacterBody body)
		{
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Expected O, but got Unknown
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)body))
			{
				return null;
			}
			if (!Object.op_Implicit((Object)(object)sprite))
			{
				sprite = JohnPorkAssets.LoadSprite("Icons/texCallPopup.png", 376f);
				if (!Object.op_Implicit((Object)(object)sprite))
				{
					return null;
				}
			}
			GameObject val = new GameObject("JohnPorkCallPopup");
			CallPopup callPopup = val.AddComponent<CallPopup>();
			callPopup.body = body;
			callPopup.sr = val.AddComponent<SpriteRenderer>();
			callPopup.sr.sprite = sprite;
			((Renderer)callPopup.sr).sortingOrder = 200;
			callPopup.Place();
			val.transform.localScale = Vector3.zero;
			return callPopup;
		}

		public void Answer()
		{
			answeredAt = age;
		}

		private void Place()
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)body))
			{
				((Component)this).transform.position = HeadTop() + Vector3.up * 0.85f;
				Camera main = Camera.main;
				if (Object.op_Implicit((Object)(object)main))
				{
					((Component)this).transform.rotation = Quaternion.LookRotation(((Component)this).transform.position - ((Component)main).transform.position, ((Component)main).transform.up);
				}
			}
		}

		private Vector3 HeadTop()
		{
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: 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_0080: 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_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)head) && Object.op_Implicit((Object)(object)body.modelLocator) && Object.op_Implicit((Object)(object)body.modelLocator.modelTransform))
			{
				ChildLocator component = ((Component)body.modelLocator.modelTransform).GetComponent<ChildLocator>();
				head = (Object.op_Implicit((Object)(object)component) ? component.FindChild("Head") : null);
			}
			if (Object.op_Implicit((Object)(object)head))
			{
				return head.position + Vector3.up * 0.5f * body.modelLocator.modelTransform.lossyScale.y;
			}
			return body.corePosition + Vector3.up * 1.4f;
		}

		private void LateUpdate()
		{
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: 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_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_018f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0194: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
			age += Time.deltaTime;
			if (!Object.op_Implicit((Object)(object)body) || age >= 1.6f)
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
				return;
			}
			Place();
			float num = ((age < 0.18f) ? Mathf.SmoothStep(0f, 1.15f, age / 0.18f) : ((!(age < 0.3f)) ? 1f : Mathf.Lerp(1.15f, 1f, (age - 0.18f) / 0.12f)));
			if (answeredAt >= 0f)
			{
				float num2 = age - answeredAt;
				if (num2 < 0.25f)
				{
					num *= 1f + 0.18f * Mathf.Sin(num2 / 0.25f * MathF.PI);
				}
			}
			float num3 = 1.6f - age;
			if (num3 < 0.2f)
			{
				num *= Mathf.SmoothStep(0f, 1f, num3 / 0.2f);
			}
			((Component)this).transform.localScale = Vector3.one * num;
			float num4 = 0f;
			if (answeredAt < 0f && age % 0.5f < 0.32f)
			{
				num4 = Mathf.Sin(age * 70f) * 7f;
			}
			Transform transform = ((Component)this).transform;
			transform.rotation *= Quaternion.Euler(0f, 0f, num4);
			Color color = Color.white;
			if (answeredAt >= 0f)
			{
				float num5 = Mathf.Clamp01((age - answeredAt) / 0.35f);
				color = Color.Lerp(new Color(0.55f, 1f, 0.6f), Color.white, num5);
			}
			sr.color = color;
		}
	}
	public class DevBridge : MonoBehaviour
	{
		public static ConfigEntry<bool> enabled;

		public static ConfigEntry<string> folder;

		private readonly Queue<string> queue = new Queue<string>();

		private bool busy;

		private float poll;

		private static readonly string[] animStates = new string[12]
		{
			"BufferEmpty", "Idle", "Run", "Sprint", "Jump", "AscendDescend", "Slap1", "Slap2", "Slap3", "Throw",
			"Answer", "Charge"
		};

		private string Dir => folder.Value;

		private string CmdPath => Path.Combine(Dir, "cmd.txt");

		private string OutPath => Path.Combine(Dir, "out.txt");

		private static NetworkUser LocalUser => NetworkUser.readOnlyLocalPlayersList.FirstOrDefault();

		private static CharacterBody PlayerBody
		{
			get
			{
				NetworkUser localUser = LocalUser;
				if (localUser == null)
				{
					return null;
				}
				CharacterMaster master = localUser.master;
				if (master == null)
				{
					return null;
				}
				return master.GetBody();
			}
		}

		public static void Init()
		{
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Expected O, but got Unknown
			enabled = ((BaseUnityPlugin)JohnPorkPlugin.instance).Config.Bind<bool>("9. Dev", "Ponte de testes", false, "Só para desenvolvimento");
			folder = ((BaseUnityPlugin)JohnPorkPlugin.instance).Config.Bind<string>("9. Dev", "Pasta da ponte", "C:\\mods\\johnpork\\.bridge", "Pasta de comandos");
			if (enabled.Value)
			{
				Directory.CreateDirectory(folder.Value);
				Directory.CreateDirectory(Path.Combine(folder.Value, "shots"));
				GameObject val = new GameObject("JohnPorkDevBridge");
				Object.DontDestroyOnLoad((Object)val);
				val.AddComponent<DevBridge>();
				Application.runInBackground = true;
				Log.Warning("Ponte de testes ATIVA em " + folder.Value);
			}
		}

		private void Write(string line)
		{
			File.AppendAllText(OutPath, $"[{Time.realtimeSinceStartup:0.0}] {line}\n", Encoding.UTF8);
		}

		private void Update()
		{
			poll -= Time.unscaledDeltaTime;
			if (poll <= 0f)
			{
				poll = 0.25f;
				if (File.Exists(CmdPath))
				{
					string[] array = File.ReadAllLines(CmdPath);
					File.Delete(CmdPath);
					string[] array2 = array;
					foreach (string text in array2)
					{
						if (!string.IsNullOrWhiteSpace(text))
						{
							queue.Enqueue(text.Trim());
						}
					}
				}
			}
			if (!busy && queue.Count > 0)
			{
				((MonoBehaviour)this).StartCoroutine(Run(queue.Dequeue()));
			}
		}

		private IEnumerator Run(string line)
		{
			busy = true;
			string text = line.Split(' ')[0].ToLowerInvariant();
			string text2 = ((line.Length > text.Length) ? line.Substring(text.Length).Trim() : "");
			Write("> " + line);
			IEnumerator enumerator = null;
			try
			{
				switch (text)
				{
				case "console":
					Console.instance.SubmitCmd(LocalUser, text2, false);
					break;
				case "select":
					Select();
					break;
				case "shot":
				{
					string text3 = Path.Combine(Dir, "shots", text2 + ".png");
					ScreenCapture.CaptureScreenshot(text3);
					Write("shot " + text3);
					break;
				}
				case "skill":
				{
					string[] array3 = text2.Split(' ');
					enumerator = UseSkill(array3[0], (array3.Length > 1) ? float.Parse(array3[1], CultureInfo.InvariantCulture) : 0.1f);
					break;
				}
				case "hurt":
					Hurt(float.Parse(text2, CultureInfo.InvariantCulture));
					break;
				case "hop":
					Hop(float.Parse(text2, CultureInfo.InvariantCulture));
					break;
				case "exitpod":
					ExitPod();
					break;
				case "look":
					Look();
					break;
				case "size":
					Size();
					break;
				case "aim":
				{
					string[] array4 = text2.Split(' ');
					Aim(float.Parse(array4[0], CultureInfo.InvariantCulture), float.Parse(array4[1], CultureInfo.InvariantCulture));
					break;
				}
				case "matdump":
				{
					string[] array2 = text2.Split(' ');
					foreach (string bodyName in array2)
					{
						MatDump(bodyName);
					}
					break;
				}
				case "skin":
				{
					CharacterBody playerBody = PlayerBody;
					ModelSkinController val5 = (Object.op_Implicit((Object)(object)playerBody) ? ((Component)playerBody.modelLocator.modelTransform).GetComponent<ModelSkinController>() : null);
					if (Object.op_Implicit((Object)(object)val5))
					{
						val5.ApplySkin(int.Parse(text2));
						Write($"skin {text2} de {val5.skins.Length}: {val5.skins[int.Parse(text2)].nameToken}");
					}
					else
					{
						Write("sem ModelSkinController");
					}
					break;
				}
				case "token":
					Write("token " + text2 + " = " + Language.GetString(text2));
					break;
				case "ach":
				{
					AchievementDef achievementDef = AchievementManager.GetAchievementDef(text2);
					UnlockableDef val3 = ((achievementDef != null) ? UnlockableCatalog.GetUnlockableDef(achievementDef.unlockableRewardIdentifier) : null);
					LocalUser firstLocalUser = LocalUserManager.GetFirstLocalUser();
					UserProfile val4 = ((firstLocalUser != null) ? firstLocalUser.userProfile : null);
					Write($"ach {text2}: def {achievementDef != null} unlockable {((val3 != null) ? val3.cachedName : null)} tem {val4 != null && (Object)(object)val3 != (Object)null && val4.HasUnlockable(val3)} conquista feita {val4 != null && val4.HasAchievement(text2)}");
					break;
				}
				case "badshaders":
				{
					Renderer[] array = Object.FindObjectsOfType<Renderer>();
					foreach (Renderer val in array)
					{
						if (!val.enabled)
						{
							continue;
						}
						Material[] sharedMaterials = val.sharedMaterials;
						for (int j = 0; j < sharedMaterials.Length; j++)
						{
							Material val2 = sharedMaterials[j];
							if (val is ParticleSystemRenderer && j == 1)
							{
								ParticleSystem component = ((Component)val).GetComponent<ParticleSystem>();
								int num;
								if (component == null)
								{
									num = 0;
								}
								else
								{
									TrailModule trails = component.trails;
									num = (((TrailModule)(ref trails)).enabled ? 1 : 0);
								}
								if (num == 0)
								{
									continue;
								}
							}
							if (!Object.op_Implicit((Object)(object)val2) || !Object.op_Implicit((Object)(object)val2.shader) || !val2.shader.isSupported || ((Object)val2.shader).name.Contains("Error"))
							{
								Write(string.Format("shader ruim: {0}/{1} ({2}) slot {3} mat {4} shader {5}", ((Object)((Component)val).transform.root).name, ((Object)val).name, ((object)val).GetType().Name, j, Object.op_Implicit((Object)(object)val2) ? ((Object)val2).name : "NULL", (Object.op_Implicit((Object)(object)val2) && Object.op_Implicit((Object)(object)val2.shader)) ? ((Object)val2.shader).name : "null"));
							}
						}
					}
					Write("badshaders fim");
					break;
				}
				case "anim":
					Anim();
					break;
				case "state":
					State();
					break;
				case "waitready":
					enumerator = WaitReady();
					break;
				case "sleep":
					enumerator = Sleep(float.Parse(text2, CultureInfo.InvariantCulture));
					break;
				default:
					Write("comando desconhecido");
					break;
				}
			}
			catch (Exception ex)
			{
				Write("ERRO " + ex.GetType().Name + ": " + ex.Message);
			}
			if (enumerator != null)
			{
				yield return enumerator;
			}
			busy = false;
		}

		private IEnumerator WaitReady()
		{
			float end = Time.realtimeSinceStartup + 180f;
			while (Time.realtimeSinceStartup < end)
			{
				Scene activeScene = SceneManager.GetActiveScene();
				if (((Scene)(ref activeScene)).name == "title" && LocalUserManager.readOnlyLocalUsersList.Count > 0 && Object.op_Implicit((Object)(object)MainMenuController.instance))
				{
					yield return (object)new WaitForSecondsRealtime(3f);
					Write("pronto: título e perfil carregados");
					yield break;
				}
				yield return (object)new WaitForSecondsRealtime(0.5f);
			}
			Write("waitready: tempo esgotado");
		}

		private IEnumerator Sleep(float s)
		{
			yield return (object)new WaitForSecondsRealtime(s);
		}

		private void Select()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			SurvivorDef val = SurvivorCatalog.FindSurvivorDefFromBody(JohnPorkSurvivor.bodyPrefab);
			LocalUser.CallCmdSetBodyPreference(SurvivorCatalog.GetBodyIndexFromSurvivorIndex(val.survivorIndex));
			Write("select ok: " + val.cachedName);
		}

		private IEnumerator UseSkill(string slot, float seconds)
		{
			float end = Time.time + seconds;
			do
			{
				CharacterBody playerBody = PlayerBody;
				if (Object.op_Implicit((Object)(object)playerBody))
				{
					GenericSkill val = null;
					switch (slot)
					{
					case "primary":
						val = playerBody.skillLocator.primary;
						break;
					case "secondary":
						val = playerBody.skillLocator.secondary;
						break;
					case "utility":
						val = playerBody.skillLocator.utility;
						break;
					case "special":
						val = playerBody.skillLocator.special;
						break;
					}
					if (Object.op_Implicit((Object)(object)val))
					{
						val.ExecuteIfReady();
					}
				}
				yield return (object)new WaitForFixedUpdate();
			}
			while (Time.time < end);
		}

		private CharacterBody NearestEnemy(CharacterBody player)
		{
			return CharacterBody.readOnlyInstancesList.Where((CharacterBody b) => Object.op_Implicit((Object)(object)b) && Object.op_Implicit((Object)(object)b.healthComponent) && b.healthComponent.alive && b.teamComponent.teamIndex != player.teamComponent.teamIndex).OrderBy(delegate(CharacterBody b)
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_000c: 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_0016: Unknown result type (might be due to invalid IL or missing references)
				Vector3 val = b.corePosition - player.corePosition;
				return ((Vector3)(ref val)).sqrMagnitude;
			}).FirstOrDefault();
		}

		private void Hurt(float amount)
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: 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_0043: 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_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Expected O, but got Unknown
			CharacterBody playerBody = PlayerBody;
			if (!Object.op_Implicit((Object)(object)playerBody))
			{
				Write("sem corpo");
				return;
			}
			playerBody.healthComponent.TakeDamage(new DamageInfo
			{
				damage = amount,
				position = playerBody.corePosition,
				procCoefficient = 0f,
				damageType = DamageTypeCombo.op_Implicit((DamageType)3)
			});
			Write($"hurt {amount}: hp {playerBody.healthComponent.health:0}");
		}

		private void Hop(float v)
		{
			//IL_0040: 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)
			CharacterBody playerBody = PlayerBody;
			if (!Object.op_Implicit((Object)(object)playerBody))
			{
				Write("sem corpo");
				return;
			}
			((BaseCharacterController)playerBody.characterMotor).Motor.ForceUnground(0.1f);
			playerBody.characterMotor.velocity = new Vector3(0f, v, 0f);
		}

		private void ExitPod()
		{
			CharacterBody playerBody = PlayerBody;
			if (!Object.op_Implicit((Object)(object)playerBody))
			{
				Write("sem corpo");
				return;
			}
			VehicleSeat currentVehicle = playerBody.currentVehicle;
			if (!Object.op_Implicit((Object)(object)currentVehicle))
			{
				Write("não está em veículo");
				return;
			}
			currentVehicle.EjectPassenger(((Component)playerBody).gameObject);
			Write("saiu da cápsula");
		}

		private void Look()
		{
			//IL_0037: 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_0047: 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_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: 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)
			CharacterBody playerBody = PlayerBody;
			if (!Object.op_Implicit((Object)(object)playerBody))
			{
				Write("sem corpo");
				return;
			}
			CharacterBody val = NearestEnemy(playerBody);
			if (!Object.op_Implicit((Object)(object)val))
			{
				Write("sem inimigos");
				return;
			}
			Vector3 val2 = val.corePosition - playerBody.inputBank.aimOrigin;
			CameraRigController val3 = ((IEnumerable<CameraRigController>)CameraRigController.readOnlyInstancesList).FirstOrDefault((Func<CameraRigController, bool>)((CameraRigController c) => c.localUserViewer != null));
			object obj;
			if (!Object.op_Implicit((Object)(object)val3))
			{
				obj = null;
			}
			else
			{
				CameraModeBase cameraMode = val3.cameraMode;
				object obj2 = ((cameraMode != null) ? cameraMode.DebugGetInstanceData(val3) : null);
				obj = ((obj2 is InstanceData) ? obj2 : null);
			}
			InstanceData val4 = (InstanceData)obj;
			if (val4 != null)
			{
				val4.SetPitchYawFromLookVector(((Vector3)(ref val2)).normalized);
			}
			playerBody.characterDirection.forward = new Vector3(val2.x, 0f, val2.z);
			Write($"look {val.GetDisplayName()} a {((Vector3)(ref val2)).magnitude:0.0}m");
		}

		private void MatDump(string bodyName)
		{
			//IL_0287: Unknown result type (might be due to invalid IL or missing references)
			//IL_028c: Unknown result type (might be due to invalid IL or missing references)
			//IL_028e: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a9: Expected I4, but got Unknown
			//IL_02df: Unknown result type (might be due to invalid IL or missing references)
			//IL_0410: Unknown result type (might be due to invalid IL or missing references)
			//IL_0417: Expected O, but got Unknown
			//IL_0433: Unknown result type (might be due to invalid IL or missing references)
			CharacterBody val = ((IEnumerable<CharacterBody>)CharacterBody.readOnlyInstancesList).FirstOrDefault((Func<CharacterBody, bool>)((CharacterBody b) => Object.op_Implicit((Object)(object)b) && ((Object)b).name.StartsWith(bodyName)));
			GameObject val2 = (Object.op_Implicit((Object)(object)val) ? ((Component)val).gameObject : BodyCatalog.FindBodyPrefab(bodyName));
			object obj;
			if (!Object.op_Implicit((Object)(object)val2))
			{
				obj = null;
			}
			else
			{
				ModelLocator component = val2.GetComponent<ModelLocator>();
				obj = ((component != null) ? component.modelTransform : null);
			}
			Transform val3 = (Transform)obj;
			CharacterModel val4 = (Object.op_Implicit((Object)(object)val3) ? ((Component)val3).GetComponent<CharacterModel>() : null);
			if (!Object.op_Implicit((Object)(object)val4))
			{
				Write("matdump: sem CharacterModel em " + bodyName);
				return;
			}
			Write($"matdump {bodyName}: {val4.baseRendererInfos.Length} renderers");
			string text = Path.Combine(Dir, "ref");
			Directory.CreateDirectory(text);
			int num = 0;
			(Renderer, Material)[] array = ((val4.baseRendererInfos.Length != 0) ? val4.baseRendererInfos.Select((RendererInfo r) => (rend: r.renderer, mat: r.defaultMaterial)).ToArray() : (from r in ((Component)val3).GetComponentsInChildren<Renderer>(true)
				where r is SkinnedMeshRenderer || r is MeshRenderer
				select ((Renderer rend, Material mat))(rend: r, mat: null)).ToArray());
			for (int num2 = 0; num2 < array.Length; num2++)
			{
				(Renderer, Material) tuple = array[num2];
				Material val5 = (Object.op_Implicit((Object)(object)tuple.Item2) ? tuple.Item2 : (Object.op_Implicit((Object)(object)tuple.Item1) ? tuple.Item1.sharedMaterial : null));
				if (!Object.op_Implicit((Object)(object)val5))
				{
					string arg = bodyName;
					object arg2 = num;
					var (val6, _) = tuple;
					Write($"matdump {arg}[{arg2}] {((val6 != null) ? ((Object)val6).name : null)}: sem material");
					num++;
					continue;
				}
				StringBuilder stringBuilder = new StringBuilder();
				object[] obj2 = new object[6] { bodyName, num, null, null, null, null };
				var (val7, _) = tuple;
				obj2[2] = ((val7 != null) ? ((Object)val7).name : null);
				obj2[3] = ((Object)val5).name;
				obj2[4] = ((Object)val5.shader).name;
				obj2[5] = string.Join(",", val5.shaderKeywords);
				stringBuilder.Append(string.Format("matdump {0}[{1}] {2} mat {3} shader {4} keywords [{5}]", obj2));
				for (int num3 = 0; num3 < val5.shader.GetPropertyCount(); num3++)
				{
					string propertyName = val5.shader.GetPropertyName(num3);
					ShaderPropertyType propertyType = val5.shader.GetPropertyType(num3);
					switch ((int)propertyType)
					{
					case 2:
					case 3:
						stringBuilder.Append($" {propertyName}={val5.GetFloat(propertyName):0.###}");
						break;
					case 0:
						stringBuilder.Append($" {propertyName}={val5.GetColor(propertyName)}");
						break;
					case 4:
					{
						Texture texture = val5.GetTexture(propertyName);
						if (Object.op_Implicit((Object)(object)texture))
						{
							stringBuilder.Append($" {propertyName}={((Object)texture).name}({texture.width}x{texture.height})");
						}
						break;
					}
					}
				}
				Write(stringBuilder.ToString());
				string[] array2 = new string[2] { "_MainTex", "_NormalTex" };
				foreach (string text2 in array2)
				{
					Write("  tex " + text2);
					Texture val8 = (val5.HasProperty(text2) ? val5.GetTexture(text2) : null);
					if (Object.op_Implicit((Object)(object)val8))
					{
						RenderTexture temporary = RenderTexture.GetTemporary(val8.width, val8.height, 0, (RenderTextureFormat)0, (RenderTextureReadWrite)2);
						Graphics.Blit(val8, temporary);
						RenderTexture active = RenderTexture.active;
						RenderTexture.active = temporary;
						Texture2D val9 = new Texture2D(val8.width, val8.height, (TextureFormat)4, false);
						val9.ReadPixels(new Rect(0f, 0f, (float)val8.width, (float)val8.height), 0, 0);
						val9.Apply();
						RenderTexture.active = active;
						RenderTexture.ReleaseTemporary(temporary);
						File.WriteAllBytes(Path.Combine(text, $"{bodyName}_{num}{text2}.png"), ImageConversion.EncodeToPNG(val9));
						Object.Destroy((Object)(object)val9);
					}
				}
				num++;
			}
		}

		private void Aim(float yawDelta, float pitchUp)
		{
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: 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_007d: 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_0087: 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_008d: 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_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_00d4: Unknown result type (might be due to invalid IL or missing references)
			CameraRigController val = ((IEnumerable<CameraRigController>)CameraRigController.readOnlyInstancesList).FirstOrDefault((Func<CameraRigController, bool>)((CameraRigController c) => c.localUserViewer != null));
			object obj;
			if (!Object.op_Implicit((Object)(object)val))
			{
				obj = null;
			}
			else
			{
				CameraModeBase cameraMode = val.cameraMode;
				object obj2 = ((cameraMode != null) ? cameraMode.DebugGetInstanceData(val) : null);
				obj = ((obj2 is InstanceData) ? obj2 : null);
			}
			InstanceData val2 = (InstanceData)obj;
			if (val2 == null)
			{
				Write("sem câmera");
				return;
			}
			Vector3 val3 = Vector3.ProjectOnPlane(((Component)val).transform.forward, Vector3.up);
			Vector3 normalized = ((Vector3)(ref val3)).normalized;
			normalized = Quaternion.AngleAxis(yawDelta, Vector3.up) * normalized;
			float num = pitchUp * (MathF.PI / 180f);
			val2.SetPitchYawFromLookVector(normalized * Mathf.Cos(num) + Vector3.up * Mathf.Sin(num));
			CharacterBody playerBody = PlayerBody;
			if (Object.op_Implicit((Object)(object)playerBody))
			{
				playerBody.characterDirection.forward = normalized;
			}
			Write($"aim giro {yawDelta} inclinação {pitchUp}");
		}

		private void Size()
		{
			//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_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: 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_00fb: Unknown result type (might be due to invalid IL or missing references)
			foreach (CharacterBody item in CharacterBody.readOnlyInstancesList.Where((CharacterBody b) => Object.op_Implicit((Object)(object)b) && Object.op_Implicit((Object)(object)b.modelLocator) && Object.op_Implicit((Object)(object)b.modelLocator.modelTransform)))
			{
				Renderer[] array = (from r in ((Component)item.modelLocator.modelTransform).GetComponentsInChildren<Renderer>(true)
					where r is SkinnedMeshRenderer || r is MeshRenderer
					select r).ToArray();
				if (array.Length != 0)
				{
					Bounds bounds = array[0].bounds;
					Renderer[] array2 = array;
					foreach (Renderer val in array2)
					{
						((Bounds)(ref bounds)).Encapsulate(val.bounds);
					}
					Write($"size {((Object)item).name}: altura {((Bounds)(ref bounds)).size.y:0.00} largura {((Bounds)(ref bounds)).size.x:0.00} escala modelo {item.modelLocator.modelTransform.lossyScale}");
				}
			}
		}

		private void Anim()
		{
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			CharacterBody playerBody = PlayerBody;
			Animator val = ((Object.op_Implicit((Object)(object)playerBody) && Object.op_Implicit((Object)(object)playerBody.modelLocator)) ? ((Component)playerBody.modelLocator.modelTransform).GetComponent<Animator>() : null);
			if (!Object.op_Implicit((Object)(object)val))
			{
				Write("sem animator");
				return;
			}
			for (int i = 0; i < val.layerCount; i++)
			{
				AnimatorStateInfo currentAnimatorStateInfo = val.GetCurrentAnimatorStateInfo(i);
				object obj;
				if (!val.IsInTransition(i))
				{
					obj = "";
				}
				else
				{
					AnimatorStateInfo nextAnimatorStateInfo = val.GetNextAnimatorStateInfo(i);
					obj = " -> " + Name(((AnimatorStateInfo)(ref nextAnimatorStateInfo)).shortNameHash);
				}
				string text = (string)obj;
				Write($"anim [{i}] {val.GetLayerName(i)} peso {val.GetLayerWeight(i):0.00} estado {Name(((AnimatorStateInfo)(ref currentAnimatorStateInfo)).shortNameHash)} t {((AnimatorStateInfo)(ref currentAnimatorStateInfo)).normalizedTime:0.00}{text}");
			}
			static string Name(int h)
			{
				return animStates.FirstOrDefault((string n) => Animator.StringToHash(n) == h) ?? h.ToString();
			}
		}

		private void State()
		{
			//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0213: Unknown result type (might be due to invalid IL or missing references)
			//IL_021e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0223: Unknown result type (might be due to invalid IL or missing references)
			//IL_0228: Unknown result type (might be due to invalid IL or missing references)
			CharacterBody player = PlayerBody;
			if (!Object.op_Implicit((Object)(object)player))
			{
				Write("sem corpo");
				return;
			}
			SkillLocator skillLocator = player.skillLocator;
			Write($"player {player.GetDisplayName()} hp {player.healthComponent.health:0}/{player.healthComponent.fullHealth:0} armor {player.armor:0} dmg {player.damage:0.0} speed {player.moveSpeed:0.0} lvl {player.level} " + $"cd p {skillLocator.primary.cooldownRemaining:0.0} s {skillLocator.secondary.cooldownRemaining:0.0}({skillLocator.secondary.stock}) u {skillLocator.utility.skillDef?.skillName} {skillLocator.utility.cooldownRemaining:0.0}({skillLocator.utility.stock}) r {skillLocator.special.skillDef?.skillName} {skillLocator.special.cooldownRemaining:0.0} " + $"chargeArmor {player.HasBuff(JohnPorkSurvivor.chargeArmorBuff)} pos {player.footPosition} grounded {player.characterMotor.isGrounded}");
			foreach (CharacterBody item in CharacterBody.readOnlyInstancesList.Where((CharacterBody b) => Object.op_Implicit((Object)(object)b) && (Object)(object)b != (Object)(object)player && Object.op_Implicit((Object)(object)b.healthComponent) && b.healthComponent.alive))
			{
				Vector3 val = item.corePosition - player.corePosition;
				float magnitude = ((Vector3)(ref val)).magnitude;
				object[] obj = new object[6]
				{
					item.GetDisplayName(),
					item.healthComponent.health,
					item.healthComponent.fullHealth,
					item.GetBuffCount(Ringing.buff),
					magnitude,
					null
				};
				SetStateOnHurt component = ((Component)item).GetComponent<SetStateOnHurt>();
				object obj2;
				if (component == null)
				{
					obj2 = null;
				}
				else
				{
					EntityStateMachine targetStateMachine = component.targetStateMachine;
					obj2 = ((targetStateMachine != null) ? ((object)targetStateMachine.state)?.GetType().Name : null);
				}
				obj[5] = obj2;
				Write(string.Format("  {0} hp {1:0}/{2:0} tocando {3} dist {4:0.0} stun {5}", obj));
			}
		}
	}
	public static class JohnPorkAssets
	{
		private static readonly Dictionary<string, Sprite> spriteCache = new Dictionary<string, Sprite>();

		public static GameObject phoneProjectile;

		public static GameObject callEffect;

		public static GameObject stickyPhoneProjectile;

		public static GameObject forwardDepartEffect;

		public static GameObject forwardArriveEffect;

		public static NetworkSoundEventDef slapSound;

		public static NetworkSoundEventDef slapHeavySound;

		public static NetworkSoundEventDef chargeHitSound;

		public static Sprite LoadSprite(string relativePath, float pixelsPerUnit = 256f, bool optional = false)
		{
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Expected O, but got Unknown
			//IL_007d: 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)
			if (spriteCache.TryGetValue(relativePath, out var value))
			{
				return value;
			}
			string text = Path.Combine(JohnPorkPlugin.PluginDir, "Assets", relativePath);
			if (!File.Exists(text))
			{
				if (!optional)
				{
					Log.Error("PNG não encontrado: " + text);
				}
				return null;
			}
			Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false);
			ImageConversion.LoadImage(val, File.ReadAllBytes(text));
			((Texture)val).filterMode = (FilterMode)1;
			((Texture)val).wrapMode = (TextureWrapMode)1;
			Sprite val2 = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f), pixelsPerUnit);
			((Object)val2).name = Path.GetFileNameWithoutExtension(relativePath);
			spriteCache[relativePath] = val2;
			return val2;
		}

		public static Texture LoadTexture(string relativePath)
		{
			Sprite obj = LoadSprite(relativePath);
			if (obj == null)
			{
				return null;
			}
			return (Texture)(object)obj.texture;
		}

		public static void Init()
		{
			LoadSounds();
			CreatePhoneProjectile();
			CreateStickyPhoneProjectile();
			callEffect = LegacyResourcesAPI.Load<GameObject>("Prefabs/Effects/ImpactEffects/MercExposeConsumeEffect");
			forwardDepartEffect = (Object.op_Implicit((Object)(object)JohnPorkVfx.callHit) ? JohnPorkVfx.callHit : callEffect);
			forwardArriveEffect = (Object.op_Implicit((Object)(object)JohnPorkVfx.phoneBlast) ? JohnPorkVfx.phoneBlast : LegacyResourcesAPI.Load<GameObject>("Prefabs/Effects/OmniEffect/OmniExplosionVFXQuick"));
		}

		private static void LoadSounds()
		{
			string text = Path.Combine(JohnPorkPlugin.PluginDir, "SoundBanks", "JohnPorkBank.bnk");
			if (!File.Exists(text))
			{
				Log.Warning("banco de som não encontrado: " + text);
				return;
			}
			Log.Info("banco de som carregado, id " + SoundBanks.Add(text));
			slapSound = Content.CreateAndAddNetworkSoundEventDef("Play_JohnPork_Slap");
			slapHeavySound = Content.CreateAndAddNetworkSoundEventDef("Play_JohnPork_SlapHeavy");
			chargeHitSound = Content.CreateAndAddNetworkSoundEventDef("Play_JohnPork_ChargeHit");
		}

		private static void CreatePhoneProjectile()
		{
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0178: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: Unknown result type (might be due to invalid IL or missing references)
			//IL_0183: Unknown result type (might be due to invalid IL or missing references)
			phoneProjectile = PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load<GameObject>("Prefabs/Projectiles/CommandoGrenadeProjectile"), "JohnPorkPhoneProjectile", true);
			ProjectileImpactExplosion component = phoneProjectile.GetComponent<ProjectileImpactExplosion>();
			((ProjectileExplosion)component).blastRadius = JohnPorkConfig.phoneRadius.Value;
			((ProjectileExplosion)component).blastDamageCoefficient = 1f;
			((ProjectileExplosion)component).blastProcCoefficient = JohnPorkConfig.phoneProc.Value;
			((ProjectileExplosion)component).falloffModel = (FalloffModel)0;
			component.impactOnWorld = true;
			component.destroyOnEnemy = true;
			component.detonateOnEnemy = true;
			component.destroyOnWorld = true;
			component.timerAfterImpact = false;
			component.lifetime = 4f;
			component.explodeOnLifeTimeExpiration = true;
			Rigidbody component2 = phoneProjectile.GetComponent<Rigidbody>();
			component2.useGravity = false;
			component2.freezeRotation = true;
			AntiGravityForce[] components = phoneProjectile.GetComponents<AntiGravityForce>();
			for (int i = 0; i < components.Length; i++)
			{
				Object.DestroyImmediate((Object)(object)components[i]);
			}
			ApplyTorqueOnStart[] components2 = phoneProjectile.GetComponents<ApplyTorqueOnStart>();
			for (int i = 0; i < components2.Length; i++)
			{
				Object.DestroyImmediate((Object)(object)components2[i]);
			}
			ProjectileSimple component3 = phoneProjectile.GetComponent<ProjectileSimple>();
			component3.desiredForwardSpeed = JohnPorkConfig.phoneSpeed.Value;
			component3.updateAfterFiring = true;
			if (!Object.op_Implicit((Object)(object)phoneProjectile.GetComponent<ProjectileTargetComponent>()))
			{
				phoneProjectile.AddComponent<ProjectileTargetComponent>();
			}
			ProjectileSteerTowardTarget obj = phoneProjectile.GetComponent<ProjectileSteerTowardTarget>() ?? phoneProjectile.AddComponent<ProjectileSteerTowardTarget>();
			obj.rotationSpeed = JohnPorkConfig.phoneTurnRate.Value;
			obj.yAxisOnly = false;
			ProjectileDamage component4 = phoneProjectile.GetComponent<ProjectileDamage>();
			DamageTypeCombo damageType = default(DamageTypeCombo);
			((DamageTypeCombo)(ref damageType))..ctor(DamageTypeCombo.op_Implicit((DamageType)32), (DamageTypeExtended)0, (DamageSource)2);
			DamageAPI.AddModdedDamageType(ref damageType, Ringing.applyTwo);
			component4.damageType = damageType;
			((ProjectileExplosion)component).explosionSoundString = "Play_JohnPork_PhoneExplode";
			if (Object.op_Implicit((Object)(object)JohnPorkVfx.phoneBlast))
			{
				((ProjectileExplosion)component).explosionEffect = JohnPorkVfx.phoneBlast;
				component.impactEffect = null;
			}
			GameObject val = (Object.op_Implicit((Object)(object)JohnPorkSurvivor.bundle) ? JohnPorkSurvivor.bundle.LoadAsset<GameObject>("PhoneGhost") : null);
			if (Object.op_Implicit((Object)(object)val))
			{
				GameObject val2 = PrefabAPI.InstantiateClone(val, "JohnPorkPhoneGhost", false);
				if (!Object.op_Implicit((Object)(object)val2.GetComponent<ProjectileGhostController>()))
				{
					val2.AddComponent<ProjectileGhostController>();
				}
				val2.AddComponent<PhoneSpin>();
				Asset.ConvertAllRenderersToHopooShader(val2);
				phoneProjectile.GetComponent<ProjectileController>().ghostPrefab = val2;
			}
			Content.AddProjectilePrefab(phoneProjectile);
		}

		private static void CreateStickyPhoneProjectile()
		{
			//IL_0193: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d3: Expected O, but got Unknown
			stickyPhoneProjectile = PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load<GameObject>("Prefabs/Projectiles/CommandoGrenadeProjectile"), "JohnPorkStickyPhoneProjectile", true);
			ProjectileImpactExplosion[] components = stickyPhoneProjectile.GetComponents<ProjectileImpactExplosion>();
			for (int i = 0; i < components.Length; i++)
			{
				Object.DestroyImmediate((Object)(object)components[i]);
			}
			ProjectileExplosion[] components2 = stickyPhoneProjectile.GetComponents<ProjectileExplosion>();
			for (int i = 0; i < components2.Length; i++)
			{
				Object.DestroyImmediate((Object)(object)components2[i]);
			}
			if (!Object.op_Implicit((Object)(object)stickyPhoneProjectile.GetComponent<ProjectileNetworkTransform>()))
			{
				stickyPhoneProjectile.AddComponent<ProjectileNetworkTransform>();
			}
			ProjectileStickOnImpact obj = stickyPhoneProjectile.GetComponent<ProjectileStickOnImpact>() ?? stickyPhoneProjectile.AddComponent<ProjectileStickOnImpact>();
			obj.ignoreCharacters = false;
			obj.ignoreWorld = false;
			obj.alignNormals = true;
			obj.stickSoundString = "Play_JohnPork_Vibrate";
			obj.stickParticleSystem = (ParticleSystem[])(object)new ParticleSystem[0];
			ProjectileSimple component = stickyPhoneProjectile.GetComponent<ProjectileSimple>();
			if (Object.op_Implicit((Object)(object)component))
			{
				component.lifetime = JohnPorkConfig.forwardPhoneDuration.Value;
				component.desiredForwardSpeed = JohnPorkConfig.forwardThrowSpeed.Value;
			}
			Rigidbody component2 = stickyPhoneProjectile.GetComponent<Rigidbody>();
			AntiGravityForce obj2 = stickyPhoneProjectile.GetComponent<AntiGravityForce>() ?? stickyPhoneProjectile.AddComponent<AntiGravityForce>();
			obj2.rb = component2;
			obj2.antiGravityCoefficient = 0f - JohnPorkConfig.forwardExtraWeight.Value;
			stickyPhoneProjectile.AddComponent<PhoneAnchor>();
			GameObject val = (Object.op_Implicit((Object)(object)JohnPorkSurvivor.bundle) ? JohnPorkSurvivor.bundle.LoadAsset<GameObject>("PhoneGhost") : null);
			if (Object.op_Implicit((Object)(object)val))
			{
				GameObject val2 = PrefabAPI.InstantiateClone(val, "JohnPorkStickyPhoneGhost", false);
				if (!Object.op_Implicit((Object)(object)val2.GetComponent<ProjectileGhostController>()))
				{
					val2.AddComponent<ProjectileGhostController>();
				}
				Transform transform = new GameObject("Pivot").transform;
				transform.SetParent(val2.transform, false);
				List<Transform> list = new List<Transform>();
				foreach (Transform item in val2.transform)
				{
					Transform val3 = item;
					if ((Object)(object)val3 != (Object)(object)transform)
					{
						list.Add(val3);
					}
				}
				foreach (Transform item2 in list)
				{
					item2.SetParent(transform, true);
				}
				val2.AddComponent<StickyPhoneVisual>().pivot = transform;
				Asset.ConvertAllRenderersToHopooShader(val2);
				stickyPhoneProjectile.GetComponent<ProjectileController>().ghostPrefab = val2;
			}
			Log.Info("celular grudento: " + string.Join(", ", from c in stickyPhoneProjectile.GetComponents<Component>()
				select ((object)c).GetType().Name));
			Content.AddProjectilePrefab(stickyPhoneProjectile);
		}
	}
	public class PhoneSpin : MonoBehaviour
	{
		private void Update()
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			((Component)this).transform.Rotate(new Vector3(420f, 160f, 0f) * Time.deltaTime, (Space)1);
		}
	}
	public static class JohnPorkConfig
	{
		public static ConfigEntry<float> maxHealth;

		public static ConfigEntry<float> healthGrowth;

		public static ConfigEntry<float> regen;

		public static ConfigEntry<float> regenGrowth;

		public static ConfigEntry<float> armor;

		public static ConfigEntry<float> damage;

		public static ConfigEntry<float> damageGrowth;

		public static ConfigEntry<float> moveSpeed;

		public static ConfigEntry<int> ringingMaxStacks;

		public static ConfigEntry<float> ringingDuration;

		public static ConfigEntry<float> slashDamage;

		public static ConfigEntry<float> slashFinisherDamage;

		public static ConfigEntry<float> slashDuration;

		public static ConfigEntry<float> slashFinisherForce;

		public static ConfigEntry<float> slashProc;

		public static ConfigEntry<float> phoneDamage;

		public static ConfigEntry<float> phoneRadius;

		public static ConfigEntry<float> phoneCooldown;

		public static ConfigEntry<float> phoneProc;

		public static ConfigEntry<int> phoneStacks;

		public static ConfigEntry<int> phoneCharges;

		public static ConfigEntry<float> phoneSpeed;

		public static ConfigEntry<float> phoneTrackRange;

		public static ConfigEntry<float> phoneTrackAngle;

		public static ConfigEntry<float> phoneTurnRate;

		public static ConfigEntry<float> chargeDamage;

		public static ConfigEntry<float> chargeDistance;

		public static ConfigEntry<float> chargeDuration;

		public static ConfigEntry<float> chargeArmor;

		public static ConfigEntry<float> chargeCooldown;

		public static ConfigEntry<float> chargeForce;

		public static ConfigEntry<float> chargeProc;

		public static ConfigEntry<float> forwardDamage;

		public static ConfigEntry<float> forwardRadius;

		public static ConfigEntry<float> forwardCooldown;

		public static ConfigEntry<float> forwardPhoneDuration;

		public static ConfigEntry<float> forwardThrowSpeed;

		public static ConfigEntry<float> forwardExtraWeight;

		public static ConfigEntry<float> forwardProc;

		public static ConfigEntry<float> answerBaseDamage;

		public static ConfigEntry<float> answerPerStackDamage;

		public static ConfigEntry<float> answerRadius;

		public static ConfigEntry<float> answerCooldown;

		public static ConfigEntry<float> answerHealPerStack;

		public static ConfigEntry<float> answerHealMax;

		public static ConfigEntry<float> answerProc;

		public static ConfigEntry<bool> answerRequiresLineOfSight;

		public static ConfigEntry<bool> answerGlobal;

		public static ConfigEntry<float> scepterRadiusMult;

		public static ConfigEntry<float> scepterSpreadRadius;

		public static ConfigEntry<int> scepterSpreadStacks;

		public static ConfigEntry<float> modelScale;

		public static void Init()
		{
			maxHealth = Config.BindAndOptions("1. Status", "Vida base", 140f);
			healthGrowth = Config.BindAndOptions("1. Status", "Vida por nível", 42f);
			regen = Config.BindAndOptions("1. Status", "Regen base (/s)", 1.5f);
			regenGrowth = Config.BindAndOptions("1. Status", "Regen por nível", 0.3f);
			armor = Config.BindAndOptions("1. Status", "Armadura", 20f);
			damage = Config.BindAndOptions("1. Status", "Dano base", 12f);
			damageGrowth = Config.BindAndOptions("1. Status", "Dano por nível", 2.4f);
			moveSpeed = Config.BindAndOptions("1. Status", "Velocidade", 7f);
			ringingMaxStacks = Config.BindAndOptions("2. Passiva - Chamada Perdida", "Acúmulos máximos de Tocando", 5);
			ringingDuration = Config.BindAndOptions("2. Passiva - Chamada Perdida", "Duração (s), renova a cada acerto", 6f);
			slashDamage = Config.BindAndOptions("3. Primária - Tapa de Casco", "Dano golpes 1 e 2", 2.2f, "Multiplicador de dano: 2.2 = 220%");
			slashFinisherDamage = Config.BindAndOptions("3. Primária - Tapa de Casco", "Dano golpe 3", 3.2f);
			slashDuration = Config.BindAndOptions("3. Primária - Tapa de Casco", "Duração de cada golpe (s)", 0.8f, "Ritmo próximo ao do Loader; menor = mais DPS");
			slashFinisherForce = Config.BindAndOptions("3. Primária - Tapa de Casco", "Knockback do golpe 3", 1200f);
			slashProc = Config.BindAndOptions("3. Primária - Tapa de Casco", "Proc coefficient", 1f);
			phoneDamage = Config.BindAndOptions("4. Secundária - Ligação Recebida", "Dano", 5f, "Multiplicador de dano: 5 = 500%");
			phoneRadius = Config.BindAndOptions("4. Secundária - Ligação Recebida", "Raio da explosão (m)", 6f);
			phoneCooldown = Config.BindAndOptions("4. Secundária - Ligação Recebida", "Recarga (s)", 5f);
			phoneCharges = Config.BindAndOptions("4. Secundária - Ligação Recebida", "Cargas", 2);
			phoneStacks = Config.BindAndOptions("4. Secundária - Ligação Recebida", "Acúmulos de Tocando aplicados", 2);
			phoneProc = Config.BindAndOptions("4. Secundária - Ligação Recebida", "Proc coefficient", 1f);
			phoneSpeed = Config.BindAndOptions("4. Secundária - Ligação Recebida", "Velocidade do celular", 60f);
			phoneTrackRange = Config.BindAndOptions("4. Secundária - Ligação Recebida", "Alcance da mira travada (m)", 45f, "Distância máxima para travar num inimigo (como a mira da Huntress)");
			phoneTrackAngle = Config.BindAndOptions("4. Secundária - Ligação Recebida", "Ângulo da mira travada (graus)", 25f, "Quão longe do centro da mira o alvo pode estar");
			phoneTurnRate = Config.BindAndOptions("4. Secundária - Ligação Recebida", "Força da curva (graus/s)", 360f, "Quanto o celular consegue virar por segundo atrás do alvo");
			chargeDamage = Config.BindAndOptions("5. Utilitária - Investida Suína", "Dano", 3.5f, "Multiplicador de dano: 3.5 = 350%");
			chargeDistance = Config.BindAndOptions("5. Utilitária - Investida Suína", "Distância com velocidade base (m)", 15f, "Escala com a velocidade de movimento, como os dashes vanilla");
			chargeDuration = Config.BindAndOptions("5. Utilitária - Investida Suína", "Duração (s)", 0.3f);
			chargeArmor = Config.BindAndOptions("5. Utilitária - Investida Suína", "Armadura extra durante a investida", 100f);
			chargeCooldown = Config.BindAndOptions("5. Utilitária - Investida Suína", "Recarga (s)", 6f);
			chargeForce = Config.BindAndOptions("5. Utilitária - Investida Suína", "Força do empurrão", 2500f);
			chargeProc = Config.BindAndOptions("5. Utilitária - Investida Suína", "Proc coefficient", 1f);
			forwardDamage = Config.BindAndOptions("5. Utilitária - Transferência de Chamada", "Dano na chegada", 3.5f, "Multiplicador de dano: 3.5 = 350%");
			forwardRadius = Config.BindAndOptions("5. Utilitária - Transferência de Chamada", "Raio do dano na chegada (m)", 8f);
			forwardCooldown = Config.BindAndOptions("5. Utilitária - Transferência de Chamada", "Recarga (s)", 7f, "Começa a contar depois do teleporte (ou quando o celular some)");
			forwardPhoneDuration = Config.BindAndOptions("5. Utilitária - Transferência de Chamada", "Tempo do celular (s)", 6f, "Quanto tempo o celular espera para você se teleportar");
			forwardThrowSpeed = Config.BindAndOptions("5. Utilitária - Transferência de Chamada", "Velocidade do arremesso", 40f, "Com o peso padrão, alcança ~40 m no plano e sobe ~20 m");
			forwardExtraWeight = Config.BindAndOptions("5. Utilitária - Transferência de Chamada", "Peso extra do celular", 0.33f, "Gravidade extra: 0 = como a granada do Commando, 1 = o dobro (cai mais rápido, vai menos longe)");
			forwardProc = Config.BindAndOptions("5. Utilitária - Transferência de Chamada", "Proc coefficient", 1f);
			answerBaseDamage = Config.BindAndOptions("6. Especial - Atende, John Pork", "Dano base por alvo", 3f, "Multiplicador: 3 = 300%");
			answerPerStackDamage = Config.BindAndOptions("6. Especial - Atende, John Pork", "Dano extra por acúmulo", 1.5f, "Multiplicador: 1.5 = 150%");
			answerGlobal = Config.BindAndOptions("6. Especial - Atende, John Pork", "Alcance global", defaultValue: true, "Atende todos os inimigos com Tocando no mapa; desligado usa o raio abaixo");
			answerRadius = Config.BindAndOptions("6. Especial - Atende, John Pork", "Raio (m)", 25f, "Só vale com o alcance global desligado");
			answerCooldown = Config.BindAndOptions("6. Especial - Atende, John Pork", "Recarga (s)", 12f);
			answerHealPerStack = Config.BindAndOptions("6. Especial - Atende, John Pork", "Cura por acúmulo (fração da vida máx.)", 0.015f);
			answerHealMax = Config.BindAndOptions("6. Especial - Atende, John Pork", "Cura máxima por uso (fração)", 0.15f);
			answerRequiresLineOfSight = Config.BindAndOptions("6. Especial - Atende, John Pork", "Exige linha de visão", defaultValue: false);
			answerProc = Config.BindAndOptions("6. Especial - Atende, John Pork", "Proc coefficient", 1f);
			scepterRadiusMult = Config.BindAndOptions("7. Ancient Scepter", "Multiplicador de raio", 2f, "Só vale com o alcance global desligado");
			scepterSpreadStacks = Config.BindAndOptions("7. Ancient Scepter", "Acúmulos espalhados por abate", 3);
			scepterSpreadRadius = Config.BindAndOptions("7. Ancient Scepter", "Raio do espalhamento (m)", 15f, "Uma geração só: acúmulos espalhados não são consumidos no mesmo uso");
			modelScale = Config.BindAndOptions("8. Visual", "Escala do modelo", 1.3f, "Só o tamanho visual (e das hurtboxes); a colisão com o cenário segue a do Commando. Precisa reiniciar o jogo");
		}
	}
	[RegisterAchievement("HanuJohnPorkMastery", "Skins.HanuJohnPork.Alt", null, 10u, null)]
	public class JohnPorkMasteryAchievement : BaseMasteryAchievement
	{
		public const string IDENTIFIER = "HanuJohnPorkMastery";

		public const string UNLOCKABLE_IDENTIFIER = "Skins.HanuJohnPork.Alt";

		public override string RequiredCharacterBody => "JohnPorkBody";

		public override float RequiredDifficultyCoefficient => 3f;
	}
	public static class JohnPorkScepter
	{
		public const string GUID = "com.DestroyedClone.AncientScepter";

		public static void TryInit()
		{
			if (Chainloader.PluginInfos.ContainsKey("com.DestroyedClone.AncientScepter"))
			{
				Register();
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		private static void Register()
		{
			AncientScepterItem instance = ItemBase<AncientScepterItem>.instance;
			if (instance == null)
			{
				Log.Warning("Ancient Scepter presente, mas o item ainda não existe; especial melhorado não registrado");
			}
			else
			{
				Log.Info("Ancient Scepter: especial melhorado registrado = " + instance.RegisterScepterSkill(JohnPorkSurvivor.scepterSkillDef, "JohnPorkBody", (SkillSlot)3, 0));
			}
		}
	}
	public class JohnPorkSurvivor
	{
		public const string TOKEN_PREFIX = "HANU_JOHNPORK_";

		public const string BODY_NAME = "JohnPorkBody";

		public const string MASTER_NAME = "JohnPorkMonsterMaster";

		public const string HITBOX_SLASH = "JohnPorkSlash";

		public const string HITBOX_SLASH_LARGE = "JohnPorkSlashLarge";

		public const string HITBOX_CHARGE = "JohnPorkCharge";

		public static GameObject bodyPrefab;

		public static GameObject displayPrefab;

		public static BuffDef chargeArmorBuff;

		public static SkillDef specialSkillDef;

		public static SkillDef scepterSkillDef;

		private static readonly Color bodyColor = new Color(0.95f, 0.62f, 0.66f);

		public const string BUNDLE_NAME = "johnporkbundle";

		public static bool customModel;

		public static AssetBundle bundle;

		public static UnlockableDef altUnlockable;

		private static Transform Model => bodyPrefab.GetComponent<ModelLocator>().modelTransform;

		public void Initialize()
		{
			//IL_0034: 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_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Expected O, but got Unknown
			JohnPorkConfig.Init();
			LoadBundle();
			Ringing.Init();
			JohnPorkVfx.Init();
			JohnPorkAssets.Init();
			chargeArmorBuff = Content.CreateAndAddBuff("bdJohnPorkChargeArmor", LegacyResourcesAPI.Load<BuffDef>("BuffDefs/ArmorBoost")?.iconSprite, bodyColor, canStack: false, isDebuff: false);
			CreateBody();
			CreateHitboxes();
			CreateStateMachines();
			CreateSkills();
			CreateSkin();
			CreateDisplay();
			Prefabs.CloneDopplegangerMaster(bodyPrefab, "JohnPorkMonsterMaster", "Merc");
			Content.CreateSurvivor(bodyPrefab, displayPrefab, bodyColor, "HANU_JOHNPORK_", null, 100f);
			RegisterStates();
			JohnPorkTokens.Init();
			RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(OnGetStatCoefficients);
			JohnPorkScepter.TryInit();
			DevBridge.Init();
		}

		private static void LoadBundle()
		{
			bundle = (File.Exists(Path.Combine(JohnPorkPlugin.PluginDir, "AssetBundles", "johnporkbundle")) ? Asset.LoadAssetBundle("johnporkbundle") : null);
		}

		private void CreateBody()
		{
			//IL_009a: 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)
			GameObject val = (Object.op_Implicit((Object)(object)bundle) ? bundle.LoadAsset<GameObject>("mdlJohnPork") : null);
			customModel = (Object)(object)val != (Object)null;
			if (customModel)
			{
				CreateBodyFromModel(val);
			}
			else
			{
				Log.Warning("AssetBundle do John Pork não encontrado; usando o corpo do Merc como reserva");
				bodyPrefab = PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load<GameObject>("Prefabs/CharacterBodies/MercBody"), "JohnPorkBody", true);
				Content.AddCharacterBodyPrefab(bodyPrefab);
			}
			CharacterBody component = bodyPrefab.GetComponent<CharacterBody>();
			component.baseNameToken = "HANU_JOHNPORK_NAME";
			component.subtitleNameToken = "HANU_JOHNPORK_SUBTITLE";
			component.portraitIcon = JohnPorkAssets.LoadTexture("Icons/texPortrait.png");
			component.bodyColor = bodyColor;
			component.baseMaxHealth = JohnPorkConfig.maxHealth.Value;
			component.levelMaxHealth = JohnPorkConfig.healthGrowth.Value;
			component.baseRegen = JohnPorkConfig.regen.Value;
			component.levelRegen = JohnPorkConfig.regenGrowth.Value;
			component.baseArmor = JohnPorkConfig.armor.Value;
			component.levelArmor = 0f;
			component.baseDamage = JohnPorkConfig.damage.Value;
			component.levelDamage = JohnPorkConfig.damageGrowth.Value;
			component.baseMoveSpeed = JohnPorkConfig.moveSpeed.Value;
			component.baseJumpCount = 1;
			component.autoCalculateLevelStats = false;
			SfxLocator component2 = bodyPrefab.GetComponent<SfxLocator>();
			if (Object.op_Implicit((Object)(object)component2))
			{
				component2.deathSound = "Play_JohnPork_Death";
			}
			Log.Info("JohnPorkBody componentes: " + string.Join(", ", from c in bodyPrefab.GetComponents<Component>()
				select ((object)c).GetType().Name));
		}

		private static Transform FindBone(GameObject root, string suffix)
		{
			return ((IEnumerable<Transform>)root.GetComponentsInChildren<Transform>(true)).FirstOrDefault((Func<Transform, bool>)((Transform t) => ((Object)t).name.EndsWith(suffix)));
		}

		private void CreateBodyFromModel(GameObject model)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: 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_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_012e: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: 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_0151: 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_0179: 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_0195: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0200: Unknown result type (might be due to invalid IL or missing references)
			//IL_0205: Unknown result type (might be due to invalid IL or missing references)
			//IL_021c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0221: 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_023d: Unknown result type (might be due to invalid IL or missing references)
			//IL_024a: Unknown result type (might be due to invalid IL or missing references)
			//IL_024f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0267: Unknown result type (might be due to invalid IL or missing references)
			//IL_026c: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ee: 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)
			float value = JohnPorkConfig.modelScale.Value;
			model.transform.localScale = Vector3.one * value;
			if (!Object.op_Implicit((Object)(object)model.GetComponent<AnimLayerFader>()))
			{
				model.AddComponent<AnimLayerFader>();
			}
			Transform val = FindBone(model, "PhoneProp");
			if (Object.op_Implicit((Object)(object)val))
			{
				Asset.ConvertAllRenderersToHopooShader(((Component)val).gameObject);
				Renderer[] componentsInChildren = ((Component)val).GetComponentsInChildren<Renderer>(true);
				foreach (Renderer val2 in componentsInChildren)
				{
					if (((Object)val2).name.Contains("Screen") || ((Object)val2).name.Contains("Glow"))
					{
						Material sharedMaterial = val2.sharedMaterial;
						sharedMaterial.SetTexture("_EmTex", (Texture)(object)Texture2D.whiteTexture);
						sharedMaterial.SetColor("_EmColor", new Color(0.3f, 1f, 0.45f));
						sharedMaterial.SetFloat("_EmPower", 1.5f);
					}
				}
			}
			displayPrefab = PrefabAPI.InstantiateClone(model, "JohnPorkDisplay", false);
			ChildLocator obj = model.GetComponent<ChildLocator>() ?? model.AddComponent<ChildLocator>();
			Transform transform = new GameObject("SwingCenter").transform;
			transform.SetParent(model.transform, false);
			Vector3 lossyScale = model.transform.lossyScale;
			transform.localPosition = new Vector3(0f, 1.15f * value / lossyScale.y, 0.8f * value / lossyScale.z);
			obj.transformPairs = (NameTransformPair[])(object)new NameTransformPair[10]
			{
				Pair("Model", FindBone(model, "JohnPorkMesh")),
				Pair("MainHurtbox", FindBone(model, "MainHurtbox")),
				Pair("HeadHurtbox", FindBone(model, "HeadHurtbox")),
				Pair("Head", FindBone(model, ":Head")),
				Pair("Chest", FindBone(model, ":Spine2")),
				Pair("Pelvis", FindBone(model, ":Hips")),
				Pair("HandL", FindBone(model, ":LeftHand")),
				Pair("HandR", FindBone(model, ":RightHand")),
				Pair("SwingCenter", transform),
				Pair("PhoneProp", FindBone(model, "PhoneProp"))
			};
			RagdollController val3 = model.AddComponent<RagdollController>();
			val3.bones = (from r in model.GetComponentsInChildren<Rigidbody>(true)
				select ((Component)r).transform).ToArray();
			val3.componentsToDisableOnRagdoll = (MonoBehaviour[])(object)new MonoBehaviour[0];
			BodyInfo bodyInfo = new BodyInfo
			{
				bodyName = "JohnPorkBody",
				bodyNameToken = "HANU_JOHNPORK_NAME",
				subtitleNameToken = "HANU_JOHNPORK_SUBTITLE",
				bodyColor = bodyColor,
				characterPortrait = JohnPorkAssets.LoadTexture("Icons/texPortrait.png"),
				crosshair = Asset.LoadCrosshair("Standard"),
				podPrefab = LegacyResourcesAPI.Load<GameObject>("Prefabs/NetworkedObjects/SurvivorPod"),
				bodyNameToClone = "Commando",
				cameraParamsDepth = -11f
			};
			bodyPrefab = Prefabs.CreateBodyPrefab(model, bodyInfo);
			CharacterModel bodyModel = Prefabs.SetupCharacterModel(bodyPrefab, new CustomRendererInfo[1]
			{
				new CustomRendererInfo
				{
					childName = "Model"
				}
			});
			SetupDisplay(bodyModel);
			Log.Info($"modelo próprio carregado: ossos do ragdoll {val3.bones.Length}, hurtboxes {bodyPrefab.GetComponentsInChildren<HurtBox>(true).Length}");
		}

		private static NameTransformPair Pair(string name, Transform t)
		{
			//IL_001a: 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)
			if (!Object.op_Implicit((Object)(object)t))
			{
				Log.Error("ChildLocator: transform não encontrado para " + name);
			}
			return new NameTransformPair
			{
				name = name,
				transform = t
			};
		}

		private void SetupDisplay(CharacterModel bodyModel)
		{
			CharacterJoint[] componentsInChildren = displayPrefab.GetComponentsInChildren<CharacterJoint>(true);
			for (int i = 0; i < componentsInChildren.Length; i++)
			{
				Object.DestroyImmediate((Object)(object)componentsInChildren[i]);
			}
			Rigidbody[] componentsInChildren2 = displayPrefab.GetComponentsInChildren<Rigidbody>(true);
			for (int i = 0; i < componentsInChildren2.Length; i++)
			{
				Object.DestroyImmediate((Object)(object)componentsInChildren2[i]);
			}
			Collider[] componentsInChildren3 = displayPrefab.GetComponentsInChildren<Collider>(true);
			for (int i = 0; i < componentsInChildren3.Length; i++)
			{
				Object.DestroyImmediate((Object)(object)componentsInChildren3[i]);
			}
			CharacterModel obj = displayPrefab.AddComponent<CharacterModel>();
			obj.baseRendererInfos = ((IEnumerable<RendererInfo>)bodyModel.baseRendererInfos).Select((Func<RendererInfo, RendererInfo>)delegate(RendererInfo info)
			{
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				//IL_0008: Unknown result type (might be due to invalid IL or missing references)
				//IL_003d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0060: Unknown result type (might be due to invalid IL or missing references)
				//IL_0065: Unknown result type (might be due to invalid IL or missing references)
				SkinnedMeshRenderer val = displayPrefab.GetComponentsInChildren<SkinnedMeshRenderer>(true).First((SkinnedMeshRenderer r) => ((Object)r).name == ((Object)info.renderer).name);
				((Renderer)val).sharedMaterial = info.defaultMaterial;
				return new RendererInfo
				{
					renderer = (Renderer)(object)val,
					defaultMaterial = info.defaultMaterial,
					defaultShadowCastingMode = (ShadowCastingMode)1
				};
			}).ToArray();
			obj.autoPopulateLightInfos = true;
		}

		private void CreateHitboxes()
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: 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_0061: 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_0093: Unknown result type (might be due to invalid IL or missing references)
			Transform model = Model;
			AddHitbox(model, "JohnPorkSlash", new Vector3(0f, 1.1f, 1.5f), new Vector3(3.4f, 3f, 3.4f));
			AddHitbox(model, "JohnPorkSlashLarge", new Vector3(0f, 1.1f, 2f), new Vector3(4.6f, 3.6f, 4.4f));
			AddHitbox(model, "JohnPorkCharge", new Vector3(0f, 1.1f, 0.9f), new Vector3(4f, 3f, 4f));
		}

		private static void AddHitbox(Transform model, string groupName, Vector3 worldOffset, Vector3 worldSize)
		{
			//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_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: 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_002a: 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_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_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: 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_006b: 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)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: 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_0091: 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)
			Vector3 lossyScale = model.lossyScale;
			GameObject val = new GameObject(groupName + "Box");
			val.transform.SetParent(model, false);
			val.transform.localPosition = new Vector3(worldOffset.x / lossyScale.x, worldOffset.y / lossyScale.y, worldOffset.z / lossyScale.z);
			val.transform.localRotation = Quaternion.identity;
			val.transform.localScale = new Vector3(worldSize.x / lossyScale.x, worldSize.y / lossyScale.y, worldSize.z / lossyScale.z);
			HitBox val2 = val.AddComponent<HitBox>();
			HitBoxGroup obj = ((Component)model).gameObject.AddComponent<HitBoxGroup>();
			obj.groupName = groupName;
			obj.hitBoxes = (HitBox[])(object)new HitBox[1] { val2 };
		}

		private void CreateStateMachines()
		{
			Prefabs.ClearEntityStateMachines(bodyPrefab);
			Prefabs.AddMainEntityStateMachine(bodyPrefab, "Body", typeof(GenericCharacterMain), typeof(SpawnTeleporterState));
			Prefabs.AddEntityStateMachine(bodyPrefab, "Weapon");
			Prefabs.AddEntityStateMachine(bodyPrefab, "Weapon2");
		}

		private void CreateSkills()
		{
			//IL_0016: 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_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01db: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bc: 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_0359: Unknown result type (might be due to invalid IL or missing references)
			//IL_035e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0370: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0404: Unknown result type (might be due to invalid IL or missing references)
			//IL_0416: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0557: Unknown result type (might be due to invalid IL or missing references)
			//IL_055c: Unknown result type (might be due to invalid IL or missing references)
			//IL_056e: Unknown result type (might be due to invalid IL or missing references)
			Skills.ClearGenericSkills(bodyPrefab);
			bodyPrefab.GetComponent<SkillLocator>().passiveSkill = new PassiveSkill
			{
				enabled = true,
				skillNameToken = "HANU_JOHNPORK_PASSIVE_NAME",
				skillDescriptionToken = "HANU_JOHNPORK_PASSIVE_DESCRIPTION",
				keywordToken = "HANU_JOHNPORK_KEYWORD_RINGING",
				icon = JohnPorkAssets.LoadSprite("Icons/texPassive.png")
			};
			string[] keywordTokens = new string[1] { "HANU_JOHNPORK_KEYWORD_RINGING" };
			Skills.CreateGenericSkillWithSkillFamily(bodyPrefab, (SkillSlot)0);
			SteppedSkillDef val = Skills.CreateSkillDef<SteppedSkillDef>(new SkillDefInfo("JohnPorkHoofSlap", "HANU_JOHNPORK_PRIMARY_SLAP_NAME", "HANU_JOHNPORK_PRIMARY_SLAP_DESCRIPTION", JohnPorkAssets.LoadSprite("Icons/texPrimary.png"), new SerializableEntityStateType(typeof(HoofSlap))));
			val.stepCount = 3;
			val.stepGraceDuration = 0.6f;
			((SkillDef)val).keywordTokens = keywordTokens;
			Skills.AddPrimarySkills(bodyPrefab, (SkillDef)val);
			HuntressTracker val2 = bodyPrefab.GetComponent<HuntressTracker>() ?? bodyPrefab.AddComponent<HuntressTracker>();
			val2.maxTrackingDistance = JohnPorkConfig.phoneTrackRange.Value;
			val2.maxTrackingAngle = JohnPorkConfig.phoneTrackAngle.Value;
			val2.trackerUpdateFrequency = 10f;
			if (Object.op_Implicit((Object)(object)JohnPorkVfx.trackIndicator))
			{
				val2.trackingPrefab = JohnPorkVfx.trackIndicator;
			}
			Skills.CreateGenericSkillWithSkillFamily(bodyPrefab, (SkillSlot)1);
			Skills.AddSecondarySkills(bodyPrefab, Skills.CreateSkillDef(new SkillDefInfo
			{
				skillName = "JohnPorkThrowPhone",
				skillNameToken = "HANU_JOHNPORK_SECONDARY_PHONE_NAME",
				skillDescriptionToken = "HANU_JOHNPORK_SECONDARY_PHONE_DESCRIPTION",
				keywordTokens = new string[3] { "KEYWORD_STUNNING", "KEYWORD_AGILE", "HANU_JOHNPORK_KEYWORD_RINGING" },
				skillIcon = JohnPorkAssets.LoadSprite("Icons/texSecondary.png"),
				activationState = new SerializableEntityStateType(typeof(ThrowPhone)),
				activationStateMachineName = "Weapon2",
				interruptPriority = (InterruptPriority)1,
				baseRechargeInterval = JohnPorkConfig.phoneCooldown.Value,
				baseMaxStock = JohnPorkConfig.phoneCharges.Value,
				isCombatSkill = true,
				cancelSprintingOnActivation = false,
				canceledFromSprinting = false
			}));
			Skills.CreateGenericSkillWithSkillFamily(bodyPrefab, (SkillSlot)2);
			bodyPrefab.AddComponent<PhoneLink>();
			Sprite val3 = JohnPorkAssets.LoadSprite("Icons/texUtilityForward.png", 256f, optional: true) ?? JohnPorkAssets.LoadSprite("Icons/texSecondary.png");
			SkillDef val4 = Skills.CreateSkillDef(new SkillDefInfo
			{
				skillName = "JohnPorkCallForward",
				skillNameToken = "HANU_JOHNPORK_UTILITY_FORWARD_NAME",
				skillDescriptionToken = "HANU_JOHNPORK_UTILITY_FORWARD_DESCRIPTION",
				keywordTokens = keywordTokens,
				skillIcon = val3,
				activationState = new SerializableEntityStateType(typeof(ThrowForwardPhone)),
				activationStateMachineName = "Weapon",
				interruptPriority = (InterruptPriority)2,
				baseRechargeInterval = JohnPorkConfig.forwardCooldown.Value,
				fullRestockOnAssign = false,
				isCombatSkill = false,
				cancelSprintingOnActivation = false,
				mustKeyPress = true
			});
			PhoneLink.teleportSkillDef = Skills.CreateSkillDef(new SkillDefInfo
			{
				skillName = "JohnPorkCallForwardTeleport",
				skillNameToken = "HANU_JOHNPORK_UTILITY_FORWARD_TELEPORT_NAME",
				skillDescriptionToken = "HANU_JOHNPORK_UTILITY_FORWARD_TELEPORT_DESCRIPTION",
				keywordTokens = keywordTokens,
				skillIcon = (JohnPorkAssets.LoadSprite("Icons/texUtilityForwardTeleport.png", 256f, optional: true) ?? val3),
				activationState = new SerializableEntityStateType(typeof(ForwardCallTeleport)),
				activationStateMachineName = "Body",
				interruptPriority = (InterruptPriority)2,
				baseRechargeInterval = 0f,
				isCombatSkill = true,
				cancelSprintingOnActivation = false,
				mustKeyPress = true
			});
			Skills.AddUtilitySkills(bodyPrefab, val4, Skills.CreateSkillDef(new SkillDefInfo
			{
				skillName = "JohnPorkHogRush",
				skillNameToken = "HANU_JOHNPORK_UTILITY_CHARGE_NAME",
				skillDescriptionToken = "HANU_JOHNPORK_UTILITY_CHARGE_DESCRIPTION",
				keywordTokens = keywordTokens,
				skillIcon = JohnPorkAssets.LoadSprite("Icons/texUtility.png"),
				activationState = new SerializableEntityStateType(typeof(PorkCharge)),
				activationStateMachineName = "Body",
				interruptPriority = (InterruptPriority)2,
				baseRechargeInterval = JohnPorkConfig.chargeCooldown.Value,
				isCombatSkill = false,
				cancelSprintingOnActivation = false,
				forceSprintDuringState = true,
				mustKeyPress = false
			}));
			Skills.CreateGenericSkillWithSkillFamily(bodyPrefab, (SkillSlot)3);
			specialSkillDef = Skills.CreateSkillDef(new SkillDefInfo
			{
				skillName = "JohnPorkAnswer",
				skillNameToken = "HANU_JOHNPORK_SPECIAL_ANSWER_NAME",
				skillDescriptionToken = "HANU_JOHNPORK_SPECIAL_ANSWER_DESCRIPTION",
				keywordTokens = keywordTokens,
				skillIcon = JohnPorkAssets.LoadSprite("Icons/texSpecial.png"),
				activationState = new SerializableEntityStateType(typeof(AnswerCall)),
				activationStateMachineName = "Weapon",
				interruptPriority = (InterruptPriority)2,
				baseRechargeInterval = JohnPorkConfig.answerCooldown.Value,
				isCombatSkill = true,
				mustKeyPress = true
			});
			Skills.AddSpecialSkills(bodyPrefab, specialSkillDef);
			scepterSkillDef = Skills.CreateSkillDef(new SkillDefInfo
			{
				skillName = "JohnPorkAnswerScepter",
				skillNameToken = "HANU_JOHNPORK_SPECIAL_ANSWER_SCEPTER_NAME",
				skillDescriptionToken = "HANU_JOHNPORK_SPECIAL_ANSWER_SCEPTER_DESCRIPTION",
				keywordTokens = keywordTokens,
				skillIcon = JohnPorkAssets.LoadSprite("Icons/texSpecialScepter.png"),
				activationState = new SerializableEntityStateType(typeof(AnswerCallScepter)),
				activationStateMachineName = "Weapon",
				interruptPriority = (InterruptPriority)2,
				baseRechargeInterval = JohnPorkConfig.answerCooldown.Value,
				isCombatSkill = true,
				mustKeyPress = true
			});
		}

		private void CreateSkin()
		{
			Transform model = Model;
			CharacterModel component = ((Component)model).GetComponent<CharacterModel>();
			ModelSkinController val = ((Component)model).GetComponent<ModelSkinController>();
			if (!Object.op_Implicit((Object)(object)val))
			{
				val = ((Component)model).gameObject.AddComponent<ModelSkinController>();
			}
			SkinDef item = Skins.CreateSkinDef("HANU_JOHNPORK_DEFAULT_SKIN_NAME", JohnPorkAssets.LoadSprite("Icons/texSkinDefault.png"), component.baseRendererInfos, ((Component)model).gameObject);
			List<SkinDef> list = new List<SkinDef> { item };
			Material val2 = ((customModel && Object.op_Implicit((Object)(object)bundle)) ? bundle.LoadAsset<Material>("matJohnPorkAlt") : null);
			if (Object.op_Implicit((Object)(object)val2))
			{
				val2 = val2.ConvertDefaultShaderToHopoo();
				Sprite val3 = JohnPorkAssets.LoadSprite("Icons/texSkinAlt.png");
				altUnlockable = Content.CreateAndAddUnlockbleDef("Skins.HanuJohnPork.Alt", Tokens.GetAchievementNameToken("HanuJohnPorkMastery"), val3);
				RendererInfo[] array = (RendererInfo[])component.baseRendererInfos.Clone();
				for (int i = 0; i < array.Length; i++)
				{
					array[i].defaultMaterial = val2;
				}
				list.Add(Skins.CreateSkinDef("HANU_JOHNPORK_ALT_SKIN_NAME", val3, array, ((Component)model).gameObject, altUnlockable));
			}
			else if (customModel)
			{
				Log.Warning("matJohnPorkAlt não está no AssetBundle; skin alternativa desativada");
			}
			val.skins = list.ToArray();
			if (customModel && Object.op_Implicit((Object)(object)displayPrefab))
			{
				(displayPrefab.GetComponent<ModelSkinController>() ?? displayPrefab.AddComponent<ModelSkinController>()).skins = val.skins;
			}
		}

		private void CreateDisplay()
		{
			if (!customModel)
			{
				displayPrefab = PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load<GameObject>("Prefabs/CharacterDisplays/MercDisplay"), "JohnPorkDisplay", false);
			}
		}

		private void RegisterStates()
		{
			Content.AddEntityState(typeof(HoofSlap));
			Content.AddEntityState(typeof(ThrowPhone));
			Content.AddEntityState(typeof(PorkCharge));
			Content.AddEntityState(typeof(ThrowForwardPhone));
			Content.AddEntityState(typeof(ForwardCallTeleport));
			Content.AddEntityState(typeof(AnswerCall));
			Content.AddEntityState(typeof(AnswerCallScepter));
		}

		private static void OnGetStatCoefficients(CharacterBody sender, StatHookEventArgs args)
		{
			if (sender.HasBuff(chargeArmorBuff))
			{
				args.armorAdd += JohnPorkConfig.chargeArmor.Value;
			}
		}
	}
	public static class JohnPorkTokens
	{
		public const string P = "HANU_JOHNPORK_";

		public static void Init()
		{
			AddAll();
		}

		private static string Pct(float v)
		{
			return (v * 100f).ToString("0") + "%";
		}

		private static void Add(string token, string en, string pt)
		{
			LanguageAPI.Add(token, en);
			LanguageAPI.Add(token, pt, "pt-BR");
		}

		private static void AddAll()
		{
			int value = JohnPorkConfig.ringingMaxStacks.Value;
			float value2 = JohnPorkConfig.ringingDuration.Value;
			Add("HANU_JOHNPORK_NAME", "John Pork", "John Pork");
			Add("HANU_JOHNPORK_SUBTITLE", "Is Calling...", "Está Ligando...");
			Add("HANU_JOHNPORK_DESCRIPTION", "John Pork is a close-range bruiser who marks enemies with calls and then answers them all at once.<color=#CCD3E0>\n\n< ! > Every hit from his skills makes the target <style=cIsUtility>Ring</style>. Build stacks before answering.\n\n< ! > Hoof Slap is slow but heavy; the third hit knocks enemies back.\n\n< ! > Incoming Call homes in on the targeted enemy, even flying ones; it stuns groups and applies 2 stacks at once.\n\n< ! > Call Forwarding goes wherever your phone sticks: throw it at a wall or right at an enemy, then come out swinging.\n\n< ! > Pick Up, John Pork heals you for every stack consumed.</color>\n", "John Pork é um brigão de curta distância que marca inimigos com ligações e depois atende todas de uma vez.<color=#CCD3E0>\n\n< ! > Todo acerto das skills deixa o alvo <style=cIsUtility>Tocando</style>. Acumule antes de atender.\n\n< ! > O Tapa de Casco é lento, mas pesado; o terceiro golpe empurra os inimigos.\n\n< ! > A Ligação Recebida persegue o inimigo na mira, até os voadores; atordoa grupos e aplica 2 acúmulos de uma vez.\n\n< ! > A Transferência de Chamada vai aonde o celular grudar: jogue numa parede ou direto num inimigo e saia batendo.\n\n< ! > Atende, John Pork cura você por cada acúmulo consumido.</color>\n");
			Add("HANU_JOHNPORK_OUTRO_FLAVOR", "..and so he left, the call finally answered.", "..e assim ele partiu, a ligação finalmente atendida.");
			Add("HANU_JOHNPORK_OUTRO_FAILURE", "..and so he vanished, straight to voicemail.", "..e assim ele sumiu, direto para a caixa postal.");
			Add("HANU_JOHNPORK_LORE", "<style=cMono>UES SAFE TRAVELS - COMMS LOG\nIncoming calls: 47 | Answered: 1 | Missed: 46</style>\n\n[Call 01] Caller ID: JOHN PORK. Missed.\n[Call 02] Caller ID: JOHN PORK. Declined.\n[Calls 03-46] Caller ID: JOHN PORK. Missed. Missed. Missed.\n[Call 47] Caller ID: JOHN PORK. Answered automatically: handset found ringing inside a crate labeled \"DO NOT ANSWER\".\n\n<style=cMono>TRANSCRIPT</style>\n\"Hello?\"\n\"...\"\n\"Hello? Who is this?\"\n\"It's John. John Pork. I've been trying to reach you about your ship's extended warranty.\"\n\"We are crash-landing on an alien planet.\"\n\"Then I'll be brief. Pick up.\"\n\n<style=cMono>[Connection lost. The recipient's phone was recovered on Petrichor V three days later. It was still ringing.]</style>", "<style=cMono>UES SAFE TRAVELS - REGISTRO DE COMUNICAÇÕES\nChamadas recebidas: 47 | Atendidas: 1 | Perdidas: 46</style>\n\n[Chamada 01] Identificador: JOHN PORK. Perdida.\n[Chamada 02] Identificador: JOHN PORK. Recusada.\n[Chamadas 03-46] Identificador: JOHN PORK. Perdida. Perdida. Perdida.\n[Chamada 47] Identificador: JOHN PORK. Atendida automaticamente: aparelho encontrado tocando dentro de um caixote com a etiqueta \"NÃO ATENDA\".\n\n<style=cMono>TRANSCRIÇÃO</style>\n\"Alô?\"\n\"...\"\n\"Alô? Quem fala?\"\n\"É o John. John Pork. Estou tentando falar com você sobre a garantia estendida da sua nave.\"\n\"Nós estamos caindo num planeta alienígena.\"\n\"Então vou ser breve. Atende.\"\n\n<style=cMono>[Conexão perdida. O celular do destinatário foi recuperado em Petrichor V três dias depois. Ainda estava tocando.]</style>");
			Add("HANU_JOHNPORK_DEFAULT_SKIN_NAME", "Default", "Padrão");
			Add("HANU_JOHNPORK_ALT_SKIN_NAME", "Hunter", "Caçador");
			Add(Tokens.GetAchievementNameToken("HanuJohnPorkMastery"), "John Pork: Mastery", "John Pork: Maestria");
			Add(Tokens.GetAchievementDescriptionToken("HanuJohnPorkMastery"), "As John Pork, beat the game or obliterate on Monsoon.", "Como John Pork, vença o jogo ou seja obliterado no Monção.");
			Add("HANU_JOHNPORK_KEYWORD_RINGING", $"<style=cKeywordName>Ringing</style><style=cSub>Stacks up to {value} times. All stacks expire after {value2:0}s without a hit; every hit refreshes them.</style>", $"<style=cKeywordName>Tocando</style><style=cSub>Acumula até {value} vezes. Todos os acúmulos expiram após {value2:0}s sem acerto; cada acerto renova.</style>");
			Add("HANU_JOHNPORK_PASSIVE_NAME", "Missed Call", "Chamada Perdida");
			Add("HANU_JOHNPORK_PASSIVE_DESCRIPTION", $"Hits from John Pork's skills make enemies <style=cIsUtility>Ring</style>, up to <style=cIsUtility>{value}</style> stacks.", $"Acertos das skills do John Pork deixam o inimigo <style=cIsUtility>Tocando</style>, até <style=cIsUtility>{value}</style> acúmulos.");
			Add("HANU_JOHNPORK_PRIMARY_SLAP_NAME", "Hoof Slap", "Tapa de Casco");
			Add("HANU_JOHNPORK_PRIMARY_SLAP_DESCRIPTION", "Slap for <style=cIsDamage>" + Pct(JohnPorkConfig.slashDamage.Value) + " damage</style> twice, then <style=cIsDamage>" + Pct(JohnPorkConfig.slashFinisherDamage.Value) + "</style> with knockback. Each hit applies <style=cIsUtility>Ringing</style>.", "Dá dois tapas de <style=cIsDamage>" + Pct(JohnPorkConfig.slashDamage.Value) + " de dano</style> e um terceiro de <style=cIsDamage>" + Pct(JohnPorkConfig.slashFinisherDamage.Value) + "</style> que empurra. Cada acerto aplica <style=cIsUtility>Tocando</style>.");
			Add("HANU_JOHNPORK_SECONDARY_PHONE_NAME", "Incoming Call", "Ligação Recebida");
			Add("HANU_JOHNPORK_SECONDARY_PHONE_DESCRIPTION", $"<style=cIsDamage>Stunning</style>. <style=cIsUtility>Agile</style>. Throw a <style=cIsUtility>homing</style> phone at the targeted enemy, exploding for <style=cIsDamage>{Pct(JohnPorkConfig.phoneDamage.Value)} damage</style> in a {JohnPorkConfig.phoneRadius.Value:0}m radius. Applies <style=cIsUtility>{JohnPorkConfig.phoneStacks.Value} Ringing</style>. Holds {JohnPorkConfig.phoneCharges.Value} charges.", $"<style=cIsDamage>Atordoante</style>. <style=cIsUtility>Ágil</style>. Arremessa o celular <style=cIsUtility>teleguiado</style> no inimigo na mira, que explode causando <style=cIsDamage>{Pct(JohnPorkConfig.phoneDamage.Value)} de dano</style> num raio de {JohnPorkConfig.phoneRadius.Value:0}m. Aplica <style=cIsUtility>{JohnPorkConfig.phoneStacks.Value} Tocando</style>. Tem {JohnPorkConfig.phoneCharges.Value} cargas.");
			Add("HANU_JOHNPORK_UTILITY_FORWARD_NAME", "Call Forwarding", "Transferência de Chamada");
			Add("HANU_JOHNPORK_UTILITY_FORWARD_DESCRIPTION", $"Throw a phone that <style=cIsUtility>sticks</style> to whatever it hits. <style=cIsUtility>Reactivate</style> within {JohnPorkConfig.forwardPhoneDuration.Value:0}s to come out of it, dealing <style=cIsDamage>{Pct(JohnPorkConfig.forwardDamage.Value)} damage</style> in a {JohnPorkConfig.forwardRadius.Value:0}m radius and applying <style=cIsUtility>Ringing</style>.", $"Arremessa um celular que <style=cIsUtility>gruda</style> onde bater. <style=cIsUtility>Reative</style> em até {JohnPorkConfig.forwardPhoneDuration.Value:0}s para sair de dentro dele, causando <style=cIsDamage>{Pct(JohnPorkConfig.forwardDamage.Value)} de dano</style> num raio de {JohnPorkConfig.forwardRadius.Value:0}m e aplicando <style=cIsUtility>Tocando</style>.");
			Add("HANU_JOHNPORK_UTILITY_FORWARD_TELEPORT_NAME", "Pick Up There", "Atender Lá");
			Add("HANU_JOHNPORK_UTILITY_FORWARD_TELEPORT_DESCRIPTION", "Come out of the phone, dealing <style=cIsDamage>" + Pct(JohnPorkConfig.forwardDamage.Value) + " damage</style> around you.", "Sai de dentro do celular, causando <style=cIsDamage>" + Pct(JohnPorkConfig.forwardDamage.Value) + " de dano</style> em volta.");
			Add("HANU_JOHNPORK_UTILITY_CHARGE_NAME", "Hog Rush", "Investida Suína");
			Add("HANU_JOHNPORK_UTILITY_CHARGE_DESCRIPTION", $"Rush forward, dealing <style=cIsDamage>{Pct(JohnPorkConfig.chargeDamage.Value)} damage</style> and pushing enemies away. Gain <style=cIsUtility>+{JohnPorkConfig.chargeArmor.Value:0} armor</style> while rushing. Usable in the air.", $"Avança, causando <style=cIsDamage>{Pct(JohnPorkConfig.chargeDamage.Value)} de dano</style> e empurrando os inimigos. Recebe <style=cIsUtility>+{JohnPorkConfig.chargeArmor.Value:0} de armadura</style> durante a investida. Pode ser usada no ar.");
			string text = (JohnPorkConfig.answerHealPerStack.Value * 100f).ToString("0.#") + "%";
			string text2 = Pct(JohnPorkConfig.answerHealMax.Value);
			bool value3 = JohnPorkConfig.answerGlobal.Value;
			string text3 = (JohnPorkConfig.answerRequiresLineOfSight.Value ? " in sight" : "");
			string text4 = (JohnPorkConfig.answerRequiresLineOfSight.Value ? " à vista" : "");
			string text5 = (value3 ? ("anywhere on the map" + text3) : $"within {JohnPorkConfig.answerRadius.Value:0}m{text3}");
			string text6 = (value3 ? ("do mapa inteiro" + text4) : $"{text4} num raio de {JohnPorkConfig.answerRadius.Value:0}m");
			string text7 = (value3 ? ("anywhere on the map" + text3) : $"within {JohnPorkConfig.answerRadius.Value * JohnPorkConfig.scepterRadiusMult.Value:0}m{text3}");
			string text8 = (value3 ? ("do mapa inteiro" + text4) : $"{text4} num raio de {JohnPorkConfig.answerRadius.Value * JohnPorkConfig.scepterRadiusMult.Value:0}m");
			Add("HANU_JOHNPORK_SPECIAL_ANSWER_NAME", "Pick Up, John Pork", "Atende, John Pork");
			Add("HANU_JOHNPORK_SPECIAL_ANSWER_DESCRIPTION", "Answer every <style=cIsUtility>Ringing</style> enemy " + text5 + ", dealing <style=cIsDamage>" + Pct(JohnPorkConfig.answerBaseDamage.Value) + "</style> + <style=cIsDamage>" + Pct(JohnPorkConfig.answerPerStackDamage.Value) + " per stack</style>, consuming them. <style=cIsHealing>Heal " + text + "</style> of max health per stack (max " + text2 + ").", "Atende todos os inimigos <style=cIsUtility>Tocando</style> " + text6 + ", causando <style=cIsDamage>" + Pct(JohnPorkConfig.answerBaseDamage.Value) + "</style> + <style=cIsDamage>" + Pct(JohnPorkConfig.answerPerStackDamage.Value) + " por acúmulo</style> e consumindo os acúmulos. <style=cIsHealing>Cura " + text + "</style> da vida máxima por acúmulo (máx. " + text2 + ").");
			Add("HANU_JOHNPORK_SPECIAL_ANSWER_SCEPTER_NAME", "Conference Call", "Chamada em Conferência");
			Add("HANU_JOHNPORK_SPECIAL_ANSWER_SCEPTER_DESCRIPTION", "Answer every <style=cIsUtility>Ringing</style> enemy " + text7 + ", dealing <style=cIsDamage>" + Pct(JohnPorkConfig.answerBaseDamage.Value) + "</style> + <style=cIsDamage>" + Pct(JohnPorkConfig.answerPerStackDamage.Value) + " per stack</style>. <style=cIsHealing>Heal " + text + "</style> per stack (max " + text2 + ")." + string.Format("\n<color=#d299ff>SCEPTER: {0}Enemies killed forward the call, applying {1} Ringing to nearby enemies.</color>", value3 ? "" : "Double radius. ", JohnPorkConfig.scepterSpreadStacks.Value), "Atende todos os inimigos <style=cIsUtility>Tocando</style> " + text8 + ", causando <style=cIsDamage>" + Pct(JohnPorkConfig.answerBaseDamage.Value) + "</style> + <style=cIsDamage>" + Pct(JohnPorkConfig.answerPerStackDamage.Value) + " por acúmulo</style>. <style=cIsHealing>Cura " + text + "</style> por acúmulo (máx. " + text2 + ")." + string.Format("\n<color=#d299ff>CETRO: {0}Inimigos mortos repassam a ligação, aplicando {1} Tocando nos inimigos próximos.</color>", value3 ? "" : "Raio dobrado. ", JohnPorkConfig.scepterSpreadStacks.Value));
		}
	}
	public static class JohnPorkVfx
	{
		public static readonly Color green = new Color(0.35f, 1f, 0.45f);

		public static GameObject callOrb;

		public static GameObject callHit;

		public static GameObject callWave;

		public static GameObject phoneBlast;

		public static GameObject slamWave;

		public static GameObject slapHit;

		public static GameObject trackIndicator;

		private static Texture2D ramp;

		public static void Init()
		{
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			ramp = FindVanillaRamp("Prefabs/Effects/OrbEffects/HealthOrbEffect") ?? FindVanillaRamp("Prefabs/Effects/OrbEffects/TreePoisonDartOrbEffect") ?? MakeRamp();
			Log.Info("rampa dos efeitos: " + ((Object)ramp).name);
			callHit = Clone("Prefabs/Effects/ImpactEffects/MercExposeConsumeEffect", "JohnPorkCallHit");
			callWave = Clone("Prefabs/Effects/ImpactEffects/BootShockwave", "JohnPorkCallWave");
			phoneBlast = Clone("Prefabs/Effects/ImpactEffects/ImpactStunGrenade", "JohnPorkPhoneBlast");
			slamWave = Clone("Prefabs/Effects/ImpactEffects/BootShockwave", "JohnPorkSlamWave");
			slapHit = Clone("Prefabs/Effects/ImpactEffects/Hitspark1", "JohnPorkSlapHit");
			GameObject val = LegacyResourcesAPI.Load<GameObject>("Prefabs/HuntressTrackingIndicator");
			if (Object.op_Implicit((Object)(object)val))
			{
				trackIndicator = PrefabAPI.InstantiateClone(val, "JohnPorkTrackingIndicator", false);
				Recolor(trackIndicator);
				SpriteRenderer[] componentsInChildren = trackIndicator.GetComponentsInChildren<SpriteRenderer>(true);
				for (int i = 0; i < componentsInChildren.Length; i++)
				{
					componentsInChildren[i].color = green;
				}
			}
			callOrb = Clone("Prefabs/Effects/OrbEffects/LightningOrbEffect", "JohnPorkCallOrb");
			if (Object.op_Implicit((Object)(object)callOrb))
			{
				OrbEffect component = callOrb.GetComponent<OrbEffect>();
				if (Object.op_Implicit((Object)(object)component))
				{
					component.endEffect = null;
				}
			}
			GameObject[] array = (GameObject[])(object)new GameObject[6] { callHit, callWave, phoneBlast, slamWave, slapHit, callOrb };
			foreach (GameObject val2 in array)
			{
				EffectComponent val3 = (Object.op_Implicit((Object)(object)val2) ? val2.GetComponent<EffectComponent>() : null);
				if (Object.op_Implicit((Object)(object)val3))
				{
					val3.soundName = "";
				}
			}
		}

		private static GameObject Clone(string path, string name)
		{
			//IL_0059: 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)
			GameObject val = LegacyResourcesAPI.Load<GameObject>(path);
			if (!Object.op_Implicit((Object)(object)val))
			{
				Log.Warning("efeito não encontrado: " + path);
				return null;
			}
			GameObject val2 = PrefabAPI.InstantiateClone(val, name, false);
			Recolor(val2);
			if (!Object.op_Implicit((Object)(object)val2.GetComponent<EffectComponent>()))
			{
				val2.AddComponent<EffectComponent>();
			}
			if (!Object.op_Implicit((Object)(object)val2.GetComponent<VFXAttributes>()))
			{
				VFXAttributes obj = val2.AddComponent<VFXAttributes>();
				obj.vfxPriority = (VFXPriority)2;
				obj.vfxIntensity = (VFXIntensity)1;
			}
			Content.CreateAndAddEffectDef(val2);
			return val2;
		}

		private static void Recolor(GameObject fx)
		{
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Unknown result typ