using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("ScoreMultipliers")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ScoreMultipliers")]
[assembly: AssemblyTitle("ScoreMultipliers")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
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 A_1)
{
Version = A_1;
}
}
}
namespace ScoreMultipliers
{
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "ScoreMultipliers";
public const string PLUGIN_NAME = "ScoreMultipliers";
public const string PLUGIN_VERSION = "1.0.0";
}
[BepInPlugin("ScoreMultipliers", "ScoreMultipliers", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
internal static ManualLogSource Logger;
public static float valuableMultiplier;
public static float enemyMultiplier;
public static float itemMultiplier;
private void Awake()
{
valuableMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("General", "ValuableMultiplier", 1.3f, "The value by which the value of things is multiplied").Value;
enemyMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("General", "EnemyMultiplier", 2.5f, "The amount by which the value of the orbs dropped from monsters is multiplied").Value;
itemMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("General", "ItemMultiplier", 0.65f, "The value by which the cost of items in the store is multiplied").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 if (((Object)((Component)__instance).gameObject).name.Contains(((Object)AssetManager.instance.surplusValuableSmall).name) || ((Object)((Component)__instance).gameObject).name.Contains(((Object)AssetManager.instance.surplusValuableMedium).name) || ((Object)((Component)__instance).gameObject).name.Contains(((Object)AssetManager.instance.surplusValuableBig).name))
{
__instance.dollarValueCurrent = dollarValueCurrent;
}
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_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: 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);
}
}
static Plugin()
{
valuableMultiplier = 1.3f;
enemyMultiplier = 2.5f;
itemMultiplier = 0.65f;
}
}
}
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}