using System;
using System.Collections.Generic;
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.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Pigeon;
using Pigeon.Movement;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.Pool;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("Blueprints")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+aeabf8c60272ce78733d5a1fb73d9fa92538ca48")]
[assembly: AssemblyProduct("My first plugin")]
[assembly: AssemblyTitle("Blueprints")]
[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 UpgradeTest
{
public class CopyUpgrade : PlayerUpgrade
{
public override string DescriptionKey => "copyupgrade";
public override EffectType EffectType => (EffectType)0;
public override Type UpgradeType => (Type)3;
public override HexMap Pattern => base.pattern;
public override UpgradePropertyList Properties
{
get
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
UpgradePropertyList result = default(UpgradePropertyList);
result.properties = (UpgradeProperty[])(object)new UpgradeProperty[0];
return result;
}
}
public static UpgradeInstance GetUpgradeTouchingThis(IUpgradable prefab, UpgradeInstance upgrade)
{
//IL_000d: 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)
UpgradeProperty.GetGearPrefab(ref prefab);
UpgradeInstance val = null;
HashSet<(int, int)> hashSet = default(HashSet<(int, int)>);
PooledObject<HashSet<(int, int)>> surroundingCells = PlayerData.GetSurroundingCells(prefab, upgrade, ref hashSet);
try
{
foreach (var item3 in hashSet)
{
int item = item3.Item1;
int item2 = item3.Item2;
UpgradeInstance equippedUpgrade = PlayerData.GetEquippedUpgrade(prefab, item, item2);
if (equippedUpgrade != null)
{
if (val != null && val != equippedUpgrade)
{
return null;
}
val = equippedUpgrade;
}
}
return val;
}
finally
{
((IDisposable)surroundingCells).Dispose();
}
}
public static void AddDynamicProperty(ref string properties, string label, string value, bool isGood)
{
StringBuilder val = default(StringBuilder);
((StringBuilder)(ref val))..ctor(Global.charBuffer);
if (properties != null)
{
((StringBuilder)(ref val)).Add('\n');
}
((StringBuilder)(ref val)).Add(isGood ? "<color=#3EFF77>" : "<color=#FF000E>");
((StringBuilder)(ref val)).Add(label);
((StringBuilder)(ref val)).Add(": <b>");
((StringBuilder)(ref val)).Add(value);
((StringBuilder)(ref val)).Add("</b>");
properties += ((object)(StringBuilder)(ref val)).ToString();
}
public override void ModifyDisplayedProperties(ref string properties, UpgradeInstance instance)
{
if (instance != null)
{
PlayerData.GetGearFromID(PlayerData.FindGearInfo((Upgrade)(object)this).ID);
UpgradeInstance upgradeTouchingThis = GetUpgradeTouchingThis((IUpgradable)(object)Player.LocalPlayer.Character, instance);
AddDynamicProperty(ref properties, "Copying", (upgradeTouchingThis == null) ? "Nothing!" : upgradeTouchingThis.Upgrade.Name, upgradeTouchingThis != null);
}
}
public override void Apply(Player player, UpgradeInstance instance)
{
UpgradeInstance upgradeTouchingThis = GetUpgradeTouchingThis((IUpgradable)(object)player.Character, instance);
if (upgradeTouchingThis != null)
{
Debug.Log((object)("applying upgrade " + (object)upgradeTouchingThis.Upgrade));
}
if (upgradeTouchingThis == null)
{
return;
}
if (upgradeTouchingThis.Upgrade is PlayerUpgrade)
{
Debug.Log((object)("applying upgrade " + upgradeTouchingThis.Upgrade.Name));
Upgrade upgrade = upgradeTouchingThis.Upgrade;
((PlayerUpgrade)((upgrade is PlayerUpgrade) ? upgrade : null)).Apply(player, upgradeTouchingThis);
}
else if (upgradeTouchingThis.Upgrade is GearUpgrade)
{
IGear[] gear = player.Gear;
foreach (IGear val in gear)
{
Debug.Log((object)val);
Debug.Log((object)("applying upgrade " + upgradeTouchingThis.Upgrade.Name));
Upgrade upgrade2 = upgradeTouchingThis.Upgrade;
((GearUpgrade)((upgrade2 is GearUpgrade) ? upgrade2 : null)).Apply(val, upgradeTouchingThis);
}
}
}
public override void Remove(Player player, Player prefab, UpgradeInstance instance)
{
}
}
public class CopyGearUpgrade : GearUpgrade
{
public HexMap pattern = new HexMap(1, 1);
public override string DescriptionKey => "copyupgrade";
public override EffectType EffectType => (EffectType)0;
public override Type UpgradeType => (Type)3;
public override HexMap Pattern => pattern;
public override UpgradePropertyList Properties
{
get
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
UpgradePropertyList result = default(UpgradePropertyList);
result.properties = (UpgradeProperty[])(object)new UpgradeProperty[0];
return result;
}
}
public static UpgradeInstance GetUpgradeTouchingThis(IUpgradable prefab, UpgradeInstance upgrade)
{
//IL_000d: 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)
UpgradeProperty.GetGearPrefab(ref prefab);
UpgradeInstance val = null;
HashSet<(int, int)> hashSet = default(HashSet<(int, int)>);
PooledObject<HashSet<(int, int)>> surroundingCells = PlayerData.GetSurroundingCells(prefab, upgrade, ref hashSet);
try
{
foreach (var item3 in hashSet)
{
int item = item3.Item1;
int item2 = item3.Item2;
UpgradeInstance equippedUpgrade = PlayerData.GetEquippedUpgrade(prefab, item, item2);
if (equippedUpgrade != null)
{
if (val != null && val != equippedUpgrade)
{
return null;
}
val = equippedUpgrade;
}
}
return val;
}
finally
{
((IDisposable)surroundingCells).Dispose();
}
}
public static void AddDynamicProperty(ref string properties, string label, string value, bool isGood)
{
StringBuilder val = default(StringBuilder);
((StringBuilder)(ref val))..ctor(Global.charBuffer);
if (properties != null)
{
((StringBuilder)(ref val)).Add('\n');
}
((StringBuilder)(ref val)).Add(isGood ? "<color=#3EFF77>" : "<color=#FF000E>");
((StringBuilder)(ref val)).Add(label);
((StringBuilder)(ref val)).Add(": <b>");
((StringBuilder)(ref val)).Add(value);
((StringBuilder)(ref val)).Add("</b>");
properties += ((object)(StringBuilder)(ref val)).ToString();
}
public override void ModifyDisplayedProperties(ref string properties, UpgradeInstance instance)
{
if (instance != null)
{
UpgradeInstance upgradeTouchingThis = GetUpgradeTouchingThis(PlayerData.GetGearFromID(PlayerData.FindGearInfo((Upgrade)(object)this).ID), instance);
AddDynamicProperty(ref properties, "Copying", (upgradeTouchingThis == null) ? "Nothing!" : upgradeTouchingThis.Upgrade.Name, upgradeTouchingThis != null);
}
}
public override void Apply(IGear gear, UpgradeInstance instance)
{
UpgradeInstance upgradeTouchingThis = GetUpgradeTouchingThis((IUpgradable)(object)gear, instance);
if (upgradeTouchingThis != null)
{
Debug.Log((object)("applying upgrade " + (object)upgradeTouchingThis.Upgrade));
}
if (upgradeTouchingThis != null)
{
if (upgradeTouchingThis.Upgrade is GearUpgrade)
{
Debug.Log((object)("applying upgrade " + upgradeTouchingThis.Upgrade.Name));
Upgrade upgrade = upgradeTouchingThis.Upgrade;
((GearUpgrade)((upgrade is GearUpgrade) ? upgrade : null)).Apply(gear, upgradeTouchingThis);
}
else
{
Debug.LogError((object)("Upgrade " + ((object)upgradeTouchingThis.Upgrade)?.ToString() + " not supported!"));
}
}
}
public override void Remove(IGear gear, IGear prefab, UpgradeInstance instance)
{
}
}
public class GenericGunUpgradeBuilder
{
private static int id = 721077;
private IUpgradable gear;
private string name;
private Rarity rarity;
private Sprite icon;
private HexMap hexMap;
private List<UpgradeProperty> properties = new List<UpgradeProperty>();
public void AddProperty(UpgradeProperty property)
{
properties.Add(property);
}
public void SetGear(IUpgradable gear)
{
this.gear = gear;
}
public void SetGear(Rarity gear)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
rarity = gear;
}
public void SetName(string name)
{
this.name = name;
}
public void NewHexMap(int width, int height)
{
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Expected O, but got Unknown
hexMap = new HexMap(width, height);
}
public void SetPos(int x, int y, bool enabled, Direction direction)
{
//IL_0036: 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)
hexMap.nodes[y].nodes[x].enabled = enabled;
hexMap.nodes[y].nodes[x].connections = direction;
}
public Upgrade Build()
{
//IL_0057: 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_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
//IL_00b4: Expected O, but got Unknown
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: 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_004a: Expected O, but got Unknown
if ((Object)(object)icon == (Object)null)
{
icon = Sprite.Create(new Rect(0f, 0f, 50f, 50f), new Vector2(25f, 25f), 100f, new Texture2D(50, 50));
}
GenericGunUpgrade val = ScriptableObject.CreateInstance<GenericGunUpgrade>();
((Upgrade)val).Rarity = rarity;
((Upgrade)val)._name = name;
((Upgrade)val).id = id;
((Upgrade)val).icon = Sprite.Create(new Rect(0f, 0f, 50f, 50f), new Vector2(25f, 25f), 100f, new Texture2D(50, 50));
val.pattern = hexMap;
val.properties.properties = properties.ToArray();
id++;
gear.Info.upgrades = Plugin.AddToArray(gear.Info.upgrades, (Upgrade)(object)val);
return (Upgrade)(object)val;
}
public static void AddUpgrades()
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Expected O, but got Unknown
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: 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_0032: Expected O, but got Unknown
//IL_0042: 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_0056: 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_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Expected O, but got Unknown
//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_0093: 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)
//IL_009e: Expected O, but got Unknown
//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_00bf: Unknown result type (might be due to invalid IL or missing references)
UpgradeProperty_Damage val = new UpgradeProperty_Damage();
val.damage.data = new Range<float>(1.04f, 1.06f);
val.damage.method = (OverrideType)2;
UpgradeProperty_Spread val2 = new UpgradeProperty_Spread();
val2.spreadSize.data = new Range<Vector2>(new Vector2(0.85f, 0.85f), new Vector2(0.9f, 0.9f));
val2.spreadSize.method = (OverrideType)2;
UpgradeProperty_MagazineSize val3 = new UpgradeProperty_MagazineSize();
val3.magazineSize.data = new Range<float>(1f, 3f);
val3.magazineSize.method = (OverrideType)1;
UpgradeProperty_FireInterval val4 = new UpgradeProperty_FireInterval();
val4.fireInterval.data = new Range<float>(0.93f, 0.95f);
val4.fireInterval.method = (OverrideType)2;
GenericGunUpgradeBuilder genericGunUpgradeBuilder = new GenericGunUpgradeBuilder();
genericGunUpgradeBuilder.SetName("Damage Dot");
genericGunUpgradeBuilder.SetGear((IUpgradable)(object)Plugin.bounceShotgun);
genericGunUpgradeBuilder.AddProperty((UpgradeProperty)(object)val);
genericGunUpgradeBuilder.NewHexMap(1, 1);
genericGunUpgradeBuilder.SetPos(0, 0, enabled: true, (Direction)0);
Plugin.upgrades.Add(genericGunUpgradeBuilder.Build());
genericGunUpgradeBuilder = new GenericGunUpgradeBuilder();
genericGunUpgradeBuilder.SetName("Spread Dot");
genericGunUpgradeBuilder.SetGear((IUpgradable)(object)Plugin.bounceShotgun);
genericGunUpgradeBuilder.AddProperty((UpgradeProperty)(object)val2);
genericGunUpgradeBuilder.NewHexMap(1, 1);
genericGunUpgradeBuilder.SetPos(0, 0, enabled: true, (Direction)0);
Plugin.upgrades.Add(genericGunUpgradeBuilder.Build());
genericGunUpgradeBuilder = new GenericGunUpgradeBuilder();
genericGunUpgradeBuilder.SetName("Mag Dot");
genericGunUpgradeBuilder.SetGear((IUpgradable)(object)Plugin.bounceShotgun);
genericGunUpgradeBuilder.AddProperty((UpgradeProperty)(object)val3);
genericGunUpgradeBuilder.NewHexMap(1, 1);
genericGunUpgradeBuilder.SetPos(0, 0, enabled: true, (Direction)0);
Plugin.upgrades.Add(genericGunUpgradeBuilder.Build());
genericGunUpgradeBuilder = new GenericGunUpgradeBuilder();
genericGunUpgradeBuilder.SetName("Fire Rate Dot");
genericGunUpgradeBuilder.SetGear((IUpgradable)(object)Plugin.bounceShotgun);
genericGunUpgradeBuilder.AddProperty((UpgradeProperty)(object)val4);
genericGunUpgradeBuilder.NewHexMap(1, 1);
genericGunUpgradeBuilder.SetPos(0, 0, enabled: true, (Direction)0);
Plugin.upgrades.Add(genericGunUpgradeBuilder.Build());
}
}
[HarmonyPatch(typeof(Global), "Initialize")]
public class GlobalPatch
{
private static void Postfix()
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Expected O, but got Unknown
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Expected O, but got Unknown
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Expected O, but got Unknown
//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_0132: Unknown result type (might be due to invalid IL or missing references)
//IL_013c: Expected O, but got Unknown
//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
//IL_00f7: Expected O, but got Unknown
TextBlockGroup val = new TextBlockGroup(32776);
val.blocks = (TextBlock[])(object)new TextBlock[1]
{
new TextBlock("When this upgrade touches <color=#FF000E>EXACTLY</color> one other upgrade, it <color=#FFE4B4>copies it</color>, acting as a 2nd instance of that upgrade.", "copyupgrade0")
};
TextBlocks.strings.Add("copyupgrade", val);
Debug.Log((object)"Plugin 'go fuck yourself' is READY TO GOO!");
Texture2D val2 = new Texture2D(100, 100);
for (int i = 0; i < 100; i++)
{
for (int j = 0; j < 100; j++)
{
val2.SetPixel(i, j, new Color(1f, 1f, 1f, 1f));
}
}
Sprite icon = Sprite.Create(val2, new Rect(0f, 0f, (float)((Texture)val2).width, (float)((Texture)val2).height), new Vector2(0.5f, 0.5f), 100f);
IUpgradable[] allGear = Global.Instance.AllGear;
foreach (IUpgradable val3 in allGear)
{
if (val3 is BounceShotgun)
{
Plugin.bounceShotgun = (BounceShotgun)val3;
}
}
CopyUpgrade copyUpgrade = ScriptableObject.CreateInstance<CopyUpgrade>();
((Upgrade)copyUpgrade).Rarity = (Rarity)3;
((Upgrade)copyUpgrade)._name = "Blueprint";
((Upgrade)copyUpgrade).id = 32775;
((Upgrade)copyUpgrade).icon = icon;
((PlayerUpgrade)copyUpgrade).pattern = new HexMap(1, 1);
((PlayerUpgrade)copyUpgrade).pattern.nodes[0].nodes[0].enabled = true;
Plugin.upgrades.Add((Upgrade)(object)copyUpgrade);
Global.Instance.Info.upgrades = Plugin.AddToArray(Global.Instance.Info.upgrades, (Upgrade)(object)copyUpgrade);
int num = 524433;
allGear = Global.Instance.AllGear;
foreach (IUpgradable val4 in allGear)
{
if (val4 is GrenadeGear || (val4 is Gun && !(val4 is IActivatedAbility)))
{
CopyGearUpgrade copyGearUpgrade = ScriptableObject.CreateInstance<CopyGearUpgrade>();
((Upgrade)copyGearUpgrade).Rarity = (Rarity)3;
((Upgrade)copyGearUpgrade)._name = "Blueprint";
((Upgrade)copyGearUpgrade).id = num;
((Upgrade)copyGearUpgrade).icon = icon;
copyGearUpgrade.pattern.nodes[0].nodes[0].enabled = true;
Plugin.upgrades.Add((Upgrade)(object)copyGearUpgrade);
val4.Info.upgrades = Plugin.AddToArray(val4.Info.upgrades, (Upgrade)(object)copyGearUpgrade);
num++;
}
}
}
}
[HarmonyPatch(typeof(Roachard), "Interact")]
public class RoachardPatch
{
private static void Prefix()
{
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Expected O, but got Unknown
PlayerResource val = default(PlayerResource);
if (PlayerResource.TryGetResource("oyster", ref val) && PlayerData.Instance.GetResource(val) > 0)
{
Upgrade val2;
IUpgradable gearFromID;
do
{
val2 = Plugin.upgrades[Random.Range(0, Plugin.upgrades.Count)];
gearFromID = PlayerData.GetGearFromID(PlayerData.FindGearInfo(val2).ID);
}
while (!PlayerData.IsGearUnlocked(gearFromID));
UpgradeInstance val3 = new UpgradeInstance(val2, gearFromID);
PlayerData.CollectInstance(val3, (UnlockFlags)0);
val3.Unlock(false);
}
}
}
[BepInPlugin("Blueprints", "My first plugin", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
public static List<Upgrade> upgrades = new List<Upgrade>();
public static BounceShotgun bounceShotgun;
internal static ManualLogSource Logger;
public static T[] AddToArray<T>(T[] array, T item)
{
int num = array.Length + 1;
T[] array2 = new T[num];
Array.Copy(array, array2, array.Length);
array2[num - 1] = item;
return array2;
}
private void Awake()
{
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
Logger = ((BaseUnityPlugin)this).Logger;
Logger.LogInfo((object)"Plugin Blueprints is loaded!");
new Harmony("me.eladnlg.fuck").PatchAll();
}
private void Action_performed(CallbackContext obj)
{
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Expected O, but got Unknown
foreach (Upgrade upgrade in upgrades)
{
IUpgradable gearFromID = PlayerData.GetGearFromID(PlayerData.FindGearInfo(upgrade).ID);
UpgradeInstance val = new UpgradeInstance(upgrade, gearFromID);
PlayerData.CollectInstance(val, (UnlockFlags)0);
val.Unlock(false);
}
}
private void Action2_performed(CallbackContext obj)
{
PlayerResource val = default(PlayerResource);
if (PlayerResource.TryGetResource("oyster", ref val))
{
PlayerData.Instance.AddResource(val, 1);
}
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "Blueprints";
public const string PLUGIN_NAME = "My first plugin";
public const string PLUGIN_VERSION = "1.0.0";
}
}