Decompiled source of HuLuoBoNewYearScrap v1.0.0

huluoboscrapNewYear.dll

Decompiled 3 days ago
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using LethalLib.Modules;
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(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("0.0.0.0")]
public class SoundPlayTime : MonoBehaviour
{
	public bool playOnAwake = false;

	public bool loopCheck = false;

	private float timer;

	public float waitTime = 1f;

	private float loopTime = 0f;

	public float loopWaitTime = 0f;

	private bool flag = false;

	public AudioClip sound01;

	private AudioSource audioSource;

	private void Start()
	{
		loopTime = loopWaitTime;
		audioSource = ((Component)this).GetComponent<AudioSource>();
		audioSource.playOnAwake = playOnAwake;
		if (audioSource.playOnAwake)
		{
			audioSource.clip = sound01;
			audioSource.Play();
			if (!loopCheck)
			{
				Object.Destroy((Object)(object)this);
			}
		}
		else
		{
			loopTime = 0f;
		}
	}

	private void Update()
	{
		loopTime -= Time.deltaTime;
		timer += Time.deltaTime;
		if (timer >= waitTime && !flag && loopTime <= 0f)
		{
			audioSource.clip = sound01;
			audioSource.Play();
			flag = false;
			loopTime = loopWaitTime;
			if (!loopCheck)
			{
				Object.Destroy((Object)(object)this);
			}
		}
	}
}
namespace huluoboScrapNewYear;

[BepInPlugin("hlb.huluoboScrapNewYear", "huluoboScrapNewYear", "1.0.0")]
public class huluoboClass : BaseUnityPlugin
{
	private const string GUID = "hlb.huluoboScrapNewYear";

	private const string Name = "huluoboScrapNewYear";

	private const string Version = "1.0.0";

	public static huluoboClass instance;

	private Harmony harmony;

	private static AssetBundle bundle;

	private int LISTI = 0;

	private int LISTI1 = 0;

	private void Awake()
	{
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0017: Expected O, but got Unknown
		instance = this;
		harmony = new Harmony("hlb.huluoboScrapNewYear");
		harmony.PatchAll();
		string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
		bundle = AssetBundle.LoadFromFile(Path.Combine(directoryName, "hlbnewyearscrap"));
		LoadScrapAsset("新年红包", 10);
		LoadUnlockAsset("对联1上", 30);
		LoadUnlockAsset("对联1右", 30);
		LoadUnlockAsset("对联1左", 30);
		LoadUnlockAsset("对联2上", 30);
		LoadUnlockAsset("对联2右", 30);
		LoadUnlockAsset("对联2左", 30);
		LoadUnlockAsset("对联3左", 30);
		LoadUnlockAsset("对联3右", 30);
		LoadUnlockAsset("纸灯笼1", 30);
		LoadUnlockAsset("纸灯笼2", 30);
		LoadUnlockAsset("纸灯笼3", 30);
		LoadUnlockAsset("纸灯笼4", 30);
		LoadUnlockAsset("中国结1", 30);
		LoadUnlockAsset("中国结2", 30);
		LoadUnlockAsset("中国结3", 30);
		LoadUnlockAsset("中国结4", 30);
		LoadUnlockAsset("福结", 30);
		LoadUnlockAsset("鱼挂件", 30);
		LoadUnlockAsset("鞭炮1", 30);
		LoadUnlockAsset("鞭炮2", 30);
		LoadUnlockAsset("灯笼串1", 30);
		LoadUnlockAsset("灯笼串2", 30);
		LoadUnlockAsset("小灯笼1", 30);
		LoadUnlockAsset("小灯笼2", 30);
		LoadUnlockAsset("小灯笼3", 30);
		LoadUnlockAsset("小灯笼4", 30);
		LoadUnlockAsset("小灯笼5", 30);
		LoadUnlockAsset("小灯笼6", 30);
		LoadUnlockAsset2("烟花27", 200);
		LoadUnlockAsset2("烟花26", 200);
		LoadUnlockAsset2("烟花25", 200);
		LoadUnlockAsset2("烟花24", 200);
		LoadUnlockAsset2("烟花23", 200);
		LoadUnlockAsset2("烟花22", 200);
		LoadUnlockAsset2("烟花21", 200);
		LoadUnlockAsset2("烟花20", 200);
		LoadUnlockAsset2("烟花19", 200);
		LoadUnlockAsset2("烟花18", 200);
		LoadUnlockAsset2("烟花17", 200);
		LoadUnlockAsset2("烟花16", 200);
		LoadUnlockAsset2("烟花15", 200);
		LoadUnlockAsset2("烟花14", 200);
		LoadUnlockAsset2("烟花13", 200);
		LoadUnlockAsset2("烟花12", 200);
		LoadUnlockAsset2("烟花11", 200);
		LoadUnlockAsset2("烟花10", 200);
		LoadUnlockAsset2("烟花09", 200);
		LoadUnlockAsset2("烟花08", 200);
		LoadUnlockAsset2("烟花07", 200);
		LoadUnlockAsset2("烟花06", 200);
		LoadUnlockAsset2("烟花05", 200);
		LoadUnlockAsset2("烟花04", 200);
		LoadUnlockAsset2("烟花03", 200);
		LoadUnlockAsset2("烟花02", 200);
		LoadUnlockAsset2("烟花01", 200);
		LoadUnlockAsset2("烟花00", 200);
	}

	private void LoadScrapAsset(string assetName, int spawnRate)
	{
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		//IL_003a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0044: Expected O, but got Unknown
		//IL_0044: Expected O, but got Unknown
		ConfigEntry<int> val = ((BaseUnityPlugin)this).Config.Bind<int>(new ConfigDefinition("物品", assetName + " 生成概率"), spawnRate, new ConfigDescription("设置 " + assetName + " 生成概率.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>()));
		Item val2 = bundle.LoadAsset<Item>("Assets/3春节物品/Item/" + assetName + ".asset");
		Utilities.FixMixerGroups(val2.spawnPrefab);
		NetworkPrefabs.RegisterNetworkPrefab(val2.spawnPrefab);
		Items.RegisterScrap(val2, val.Value, (LevelTypes)(-1));
	}

	private void LoadUnlockAsset(string assetName, int price)
	{
		//IL_0017: 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_0047: Expected O, but got Unknown
		//IL_0047: Expected O, but got Unknown
		ConfigEntry<int> val = ((BaseUnityPlugin)this).Config.Bind<int>(new ConfigDefinition("装饰", assetName + " 价格"), price, new ConfigDescription("设置 " + assetName + " 价格.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 9999), Array.Empty<object>()));
		UnlockablesList val2 = bundle.LoadAsset<UnlockablesList>("Assets/3春节物品/Unlock/Unlock.asset");
		TerminalNode val3 = bundle.LoadAsset<TerminalNode>("Assets/3春节物品/Unlock/新年/" + assetName + ".asset");
		UnlockableItem val4 = val2.unlockables[LISTI];
		Unlockables.RegisterUnlockable(val4, (StoreType)1, (TerminalNode)null, (TerminalNode)null, val3, val.Value);
		NetworkPrefabs.RegisterNetworkPrefab(val4.prefabObject);
		Utilities.FixMixerGroups(val4.prefabObject);
		LISTI++;
	}

	private void LoadUnlockAsset2(string assetName, int price)
	{
		//IL_0017: 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_0047: Expected O, but got Unknown
		//IL_0047: Expected O, but got Unknown
		ConfigEntry<int> val = ((BaseUnityPlugin)this).Config.Bind<int>(new ConfigDefinition("烟花", assetName + " 价格"), price, new ConfigDescription("设置 " + assetName + " 价格.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 9999), Array.Empty<object>()));
		UnlockablesList val2 = bundle.LoadAsset<UnlockablesList>("Assets/3春节物品/Unlock/Unlock2.asset");
		TerminalNode val3 = bundle.LoadAsset<TerminalNode>("Assets/3春节物品/Unlock/烟花/" + assetName + ".asset");
		UnlockableItem val4 = val2.unlockables[LISTI1];
		Unlockables.RegisterUnlockable(val4, (StoreType)1, (TerminalNode)null, (TerminalNode)null, val3, val.Value);
		NetworkPrefabs.RegisterNetworkPrefab(val4.prefabObject);
		Utilities.FixMixerGroups(val4.prefabObject);
		LISTI1++;
	}
}