Decompiled source of PersistentDesperadoDescriptionFix v1.1.1

plugins/PersistentDesperadoDescriptionFix.dll

Decompiled a day ago
using System;
using System.Diagnostics;
using System.Globalization;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Logging;
using Microsoft.CodeAnalysis;
using R2API;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("PersistentDesperadoDescriptionFix")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("PersistentDesperadoDescriptionFix")]
[assembly: AssemblyTitle("PersistentDesperadoDescriptionFix")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace ExamplePlugin
{
	internal static class Log
	{
		private static ManualLogSource _logSource;

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

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

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

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

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

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

		internal static void Warning(object data)
		{
			_logSource.LogWarning(data);
		}
	}
}
namespace PersistentDesperadoDescriptionFix
{
	[BepInPlugin("com.SeuNome.PersistentDesperadoDescriptionFix", "Persistent Desperado Description Fix", "1.1.1")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class ExamplePlugin : BaseUnityPlugin
	{
		private const string TargetPluginGUID = "com.OldFaithless.PersistentDesperado";

		private const string DescriptionToken = "BANDIT2_SPECIAL_ALT_DESCRIPTION";

		private void Awake()
		{
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Persistent Desperado Description Fix carregado.");
			try
			{
				UpdateDescription();
			}
			catch (Exception ex)
			{
				((BaseUnityPlugin)this).Logger.LogError((object)("Falha ao atualizar a descrição: " + ex));
			}
		}

		private void UpdateDescription()
		{
			if (!Chainloader.PluginInfos.TryGetValue("com.OldFaithless.PersistentDesperado", out var value))
			{
				((BaseUnityPlugin)this).Logger.LogWarning((object)"Persistent Desperado não foi encontrado.");
				return;
			}
			Type type = ((object)value.Instance).GetType();
			PropertyInfo property = type.GetProperty("StackValue", BindingFlags.Static | BindingFlags.Public);
			if (property == null)
			{
				((BaseUnityPlugin)this).Logger.LogError((object)"Não foi possível encontrar StackValue.");
				return;
			}
			object value2 = property.GetValue(null);
			if (value2 == null)
			{
				((BaseUnityPlugin)this).Logger.LogError((object)"StackValue retornou null.");
				return;
			}
			PropertyInfo property2 = value2.GetType().GetProperty("Value");
			if (property2 == null)
			{
				((BaseUnityPlugin)this).Logger.LogError((object)"Não foi possível encontrar o valor da configuração.");
				return;
			}
			double num = Convert.ToDouble(property2.GetValue(value2), CultureInfo.InvariantCulture);
			string text = (num * 100.0).ToString("0.##", CultureInfo.InvariantCulture);
			string text2 = "<style=cIsDamage>Assassino</style>. Dispare um tiro de revólver que causa <style=cIsDamage>600% de dano</style>. Abates concedem <style=cIsDamage>fichas que acumulam</style>, fazendo com que Bandoleiro cause <style=cIsDamage>" + text + "%</style> mais dano</style>.";
			string text3 = "<style=cIsDamage>Slayer</style>. Fire a revolver shot for <style=cIsDamage>600% damage</style>. Kills grant <style=cIsDamage>stacking tokens</style> for <style=cIsDamage>" + text + "%</style> more Desperado damage</style>.";
			LanguageAPI.Add("BANDIT2_SPECIAL_ALT_DESCRIPTION", text3, "en");
			LanguageAPI.Add("BANDIT2_SPECIAL_ALT_DESCRIPTION", text2, "pt-BR");
			LanguageAPI.Add("BANDIT2_SPECIAL_ALT_DESCRIPTION", text2, "pt");
			((BaseUnityPlugin)this).Logger.LogInfo((object)("Descrição atualizada: bônus de " + text + "% por ficha."));
		}
	}
}