using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using UnityEngine;
[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("ScoreMultipliers")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ScoreMultipliers")]
[assembly: AssemblyTitle("ScoreMultipliers")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace ScoreMultipliers
{
[BepInPlugin("ScoreMultipliers", "ScoreMultipliers", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
internal static ManualLogSource Logger;
public static float valuableMultiplier = 1.3f;
public static float enemyMultiplier = 2.5f;
public static float itemMultiplier = 0.65f;
private void Awake()
{
ConfigEntry<float> val = ((BaseUnityPlugin)this).Config.Bind<float>("General", "ValuableMultiplier", 1.3f, "The value by which the value of things is multiplied");
valuableMultiplier = val.Value;
ConfigEntry<float> val2 = ((BaseUnityPlugin)this).Config.Bind<float>("General", "EnemyMultiplier", 2.5f, "The amount by which the value of the orbs dropped from monsters is multiplied");
enemyMultiplier = val2.Value;
ConfigEntry<float> val3 = ((BaseUnityPlugin)this).Config.Bind<float>("General", "ItemMultiplier", 0.65f, "The value by which the cost of items in the store is multiplied");
itemMultiplier = val3.Value;
Logger = ((BaseUnityPlugin)this).Logger;
Logger.LogInfo((object)"Plugin ScoreMultipliers is loaded!");
try
{
Harmony.CreateAndPatchAll(typeof(Plugin), "ScoreMultipliers");
}
catch (Exception ex)
{
Logger.LogError((object)ex);
}
}
[HarmonyPostfix]
[HarmonyPatch(typeof(ValuableObject), "DollarValueSetLogic")]
public static void MultiplyValuableObject_POST(ref ValuableObject __instance)
{
float dollarValueCurrent = __instance.dollarValueCurrent;
if (((Object)((Component)__instance).gameObject).name.Contains(((Object)AssetManager.instance.enemyValuableSmall).name) || ((Object)((Component)__instance).gameObject).name.Contains(((Object)AssetManager.instance.enemyValuableMedium).name) || ((Object)((Component)__instance).gameObject).name.Contains(((Object)AssetManager.instance.enemyValuableBig).name))
{
__instance.dollarValueCurrent = dollarValueCurrent * enemyMultiplier;
}
else
{
__instance.dollarValueCurrent = dollarValueCurrent * valuableMultiplier;
}
Logger.LogInfo((object)$"for object {((Object)((Component)__instance).gameObject).name}\r\nchange value from {dollarValueCurrent} to {__instance.dollarValueCurrent}");
}
[HarmonyPostfix]
[HarmonyPatch(typeof(ItemAttributes), "GetValue")]
public static void MultiplyItemCost_POST(ref ItemAttributes __instance)
{
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_0063: Expected O, but got Unknown
try
{
Type typeFromHandle = typeof(ItemAttributes);
FieldInfo field = typeFromHandle.GetField("value", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
int num = (int)field.GetValue(__instance);
int num2 = (int)Math.Ceiling((float)num * itemMultiplier);
field.SetValue(__instance, num2);
PhotonView val = (PhotonView)typeFromHandle.GetField("photonView", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic).GetValue(__instance);
if (GameManager.Multiplayer())
{
val.RPC("GetValueRPC", (RpcTarget)1, new object[1] { num2 });
}
Logger.LogInfo((object)$"for item {((Object)((Component)__instance).gameObject).name}\r\nchange value from {num} to {num2}");
}
catch (Exception ex)
{
Logger.LogError((object)ex);
}
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "ScoreMultipliers";
public const string PLUGIN_NAME = "ScoreMultipliers";
public const string PLUGIN_VERSION = "1.0.0";
}
}