using System;
using System.CodeDom.Compiler;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Security;
using System.Security.Permissions;
using Alexandria.ItemAPI;
using Alexandria.SoundAPI;
using Alexandria.VisualAPI;
using BepInEx;
using Gungeon;
using Microsoft.CodeAnalysis;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("Mod")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Mod")]
[assembly: AssemblyCopyright("Copyright © 2020")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("d6d7a494-722e-4763-959b-c2d6b6a42b01")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[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 PIWeapon
{
public static class AddToExistingSynergies
{
public static void AddItemToSynergy(this PickupObject obj, CustomSynergyType type, bool priority = false)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
AddItemToSynergy(type, obj.PickupObjectId, priority);
}
public static void AddItemToSynergy(CustomSynergyType type, int id, bool priority)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
AdvancedSynergyEntry[] synergies = GameManager.Instance.SynergyManager.synergies;
foreach (AdvancedSynergyEntry val in synergies)
{
if (!val.bonusSynergies.Contains(type) || !((Object)(object)PickupObjectDatabase.GetById(id) != (Object)null))
{
continue;
}
PickupObject byId = PickupObjectDatabase.GetById(id);
if (byId is Gun)
{
List<int> list = ((!priority) ? val.OptionalGunIDs : val.MandatoryGunIDs);
if (list != null)
{
list.Add(id);
continue;
}
list = new List<int> { id };
}
else if (val.OptionalItemIDs != null)
{
val.OptionalItemIDs.Add(id);
}
else
{
val.OptionalItemIDs = new List<int> { id };
}
}
}
}
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("sp2t.etg.piweapon", "PIWeapon", "1.0.2")]
public class Plugin : BaseUnityPlugin
{
public const string GUID = "sp2t.etg.piweapon";
public const string NAME = "PIWeapon";
public const string VERSION = "1.0.2";
public const string TEXT_COLOR = "#00FFFF";
public void Start()
{
ETGModMainBehaviour.WaitForGameManagerStart((Action<GameManager>)GMStart);
}
public void GMStart(GameManager g)
{
PI.Add();
Log("PIWeapon v1.0.2 started successfully.", "#00FFFF");
}
public static void Log(string text, string color = "#FFFFFF")
{
ETGModConsole.Log((object)("<color=" + color + ">" + text + "</color>"), false);
}
}
internal class PI : AdvancedGunBehavior
{
private bool HasReloaded;
private List<string> projectilePath = new List<string>();
public override void Start()
{
//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
((AdvancedGunBehavior)this).Start();
if (base.gun.shootAnimation != null)
{
Plugin.Log("Shooting animation found. path : " + base.gun.shootAnimation);
Plugin.Log("Reload animation found. path : " + base.gun.reloadAnimation);
Plugin.Log($"damage {base.gun.DefaultModule.projectiles[0].baseData.damage}");
foreach (AdvancedSynergyEntry item in GameManager.Instance.SynergyManager.synergies.Where((AdvancedSynergyEntry x) => x.MandatoryGunIDs.Contains(175) || x.OptionalGunIDs.Contains(175)))
{
foreach (CustomSynergyType bonusSynergy in item.bonusSynergies)
{
CustomSynergyType current2 = bonusSynergy;
Plugin.Log(((object)(CustomSynergyType)(ref current2)).ToString());
}
}
}
else
{
Plugin.Log("shooting animation not found");
}
if ((Object)(object)((BraveBehaviour)base.gun).sprite == (Object)null)
{
Plugin.Log("IDLE not found");
}
if ((Object)(object)base.gun.shellCasing == (Object)null)
{
Plugin.Log("Casing not found");
}
projectilePath.Add("pi_projectile_001");
projectilePath.Add("pi_projectile_002");
projectilePath.Add("pi_projectile_003");
projectilePath.Add("pi_projectile_004");
}
public static Gun Add()
{
//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
//IL_00de: Unknown result type (might be due to invalid IL or missing references)
//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
//IL_0201: Unknown result type (might be due to invalid IL or missing references)
//IL_0215: Unknown result type (might be due to invalid IL or missing references)
//IL_021a: Unknown result type (might be due to invalid IL or missing references)
//IL_022c: Unknown result type (might be due to invalid IL or missing references)
//IL_026d: Unknown result type (might be due to invalid IL or missing references)
//IL_0293: Unknown result type (might be due to invalid IL or missing references)
//IL_03c7: Unknown result type (might be due to invalid IL or missing references)
Gun val = Databases.Items.NewGun("PIstol", "pi");
Game.Items.Rename("outdated_gun_mods:pistol", "pi_mod:PIstol");
((Component)val).gameObject.AddComponent<PI>();
string text = "PIWeapon/Resources/CustomGunAmmoTypes/pi_ammo";
string text2 = "PIWeapon/Resources/CustomGunAmmoTypes/pi_ammo_depleted";
string text3 = "PIWeapon/Resources/PILEG.png";
string text4 = "PIWeapon/Resources/PICasing.png";
GunExt.SetupSprite(val, (tk2dSpriteCollectionData)null, "pi_idle_001", 8);
GunExt.SetAnimationFPS(val, val.shootAnimation, 30);
GunExt.SetAnimationFPS(val, val.reloadAnimation, 10);
GunExt.SetShortDescription((PickupObject)(object)val, "360 no angles.");
GunExt.SetLongDescription((PickupObject)(object)val, "Even though the letter PI does not look like a weapon, a succesful Gungoneer who help the inhabitants of the Breach thought it would be a good idea for a weapon.");
GunExt.AddProjectileModuleFrom(val, "magnum", false, true);
val.DefaultModule.ammoType = (AmmoType)14;
val.DefaultModule.customAmmoType = "pi_idle_001";
val.DefaultModule.ammoCost = 1;
val.DefaultModule.shootStyle = (ShootStyle)1;
val.DefaultModule.sequenceStyle = (ProjectileSequenceStyle)0;
val.reloadTime = (float)Math.PI / 2f;
val.DefaultModule.angleVariance = (float)Math.PI;
val.DefaultModule.cooldownTime = 1f / (2f * (float)Math.PI);
val.DefaultModule.numberOfShotsInClip = 45;
string text5 = "pi_mod_PIstol";
SoundManager.AddCustomSwitchData("WPN_Guns", val.gunSwitchGroup, "Play_WPN_Gun_Shot_01", (SwitchedEvent[])(object)new SwitchedEvent[1] { SwitchedEvent.op_Implicit("Play_WPN_zorgun_shot_01") });
SoundManager.AddCustomSwitchData("WPN_Guns", val.gunSwitchGroup, "Play_WPN_Gun_Reload_01", (SwitchedEvent[])(object)new SwitchedEvent[1] { SwitchedEvent.op_Implicit("Play_WPN_makarov_reload_01") });
val.muzzleFlashEffects = VFXBuilder.CreateVFXPool("PI Muzzleflash", new List<string> { "PIWeapon/Resources/MiscVFX/GunVFX/referentiel_muzzleflash_001", "PIWeapon/Resources/MiscVFX/GunVFX/referentiel_muzzleflash_002", "PIWeapon/Resources/MiscVFX/GunVFX/referentiel_muzzleflash_003", "PIWeapon/Resources/MiscVFX/GunVFX/referentiel_muzzleflash_004", "PIWeapon/Resources/MiscVFX/GunVFX/referentiel_muzzleflash_005", "PIWeapon/Resources/MiscVFX/GunVFX/referentiel_muzzleflash_006" }, 30, new IntVector2(20, 17), (Anchor)3, false, 0f, false, (VFXAlignment)0, -1f, (Color?)null, (Assembly)null);
Transform transform = ((Component)val.barrelOffset).transform;
transform.localPosition += new Vector3(0.1f, 0.15f, 0f);
val.muzzleFlashEffects.SpawnAtPosition(val.m_originalBarrelOffsetPosition, 0f, (Transform)null, (Vector2?)null, (Vector2?)null, (float?)null, false, (SpawnMethod)null, (tk2dBaseSprite)null, false);
val.SetBaseMaxAmmo(360);
((PickupObject)val).quality = (ItemQuality)3;
((BraveBehaviour)val).encounterTrackable.EncounterGuid = "THE PI";
((BraveBehaviour)val).sprite.IsPerpendicular = true;
val.gunClass = (GunClass)50;
Projectile val2 = Object.Instantiate<Projectile>(val.DefaultModule.projectiles[0]);
((Component)val2).gameObject.SetActive(false);
FakePrefab.MarkAsFakePrefab(((Component)val2).gameObject);
Object.DontDestroyOnLoad((Object)(object)val2);
val.DefaultModule.projectiles[0] = val2;
((BraveBehaviour)val2).transform.parent = val.barrelOffset;
GunTools.SetProjectileSpriteRight(val2, "pi_projectile_001", 8, 8, true, (Anchor)0, (int?)null, (int?)null, true, false, (int?)null, (int?)null, (Projectile)null);
val2.baseData.damage = (float)Math.PI * 4f;
val2.baseData.speed = 45f;
val2.baseData.range = 45f;
Databases.Items.Add(((Component)val).GetComponent<PickupObject>(), false, "ANY");
val.shellsToLaunchOnFire = 1;
val.clipsToLaunchOnReload = 1;
val.clipObject = ItemBuilder.AddSpriteToObject("PILEG", text3, val.clipObject, (Assembly)null);
val.shellCasing = ItemBuilder.AddSpriteToObject("PICasing", text4, val.shellCasing, (Assembly)null);
val.DefaultModule.ammoType = (AmmoType)14;
val.DefaultModule.customAmmoType = CustomClipAmmoTypeToolbox.AddCustomAmmoType("PI", text, text2);
return val;
}
protected override void Update()
{
((AdvancedGunBehavior)this).Update();
if (Object.op_Implicit((Object)(object)base.gun.CurrentOwner))
{
if (base.gun.PreventNormalFireAudio)
{
base.gun.PreventNormalFireAudio = true;
}
if (!base.gun.IsReloading && !HasReloaded)
{
HasReloaded = true;
}
}
}
public override void OnPostFired(PlayerController player, Gun gun)
{
((AdvancedGunBehavior)this).OnPostFired(player, gun);
GunTools.SetProjectileSpriteRight(gun.DefaultModule.projectiles[0], projectilePath[Random.Range(0, projectilePath.Count)], 6, 6, true, (Anchor)0, (int?)null, (int?)null, true, false, (int?)null, (int?)null, (Projectile)null);
}
protected override void OnPickup(GameActor owner)
{
((AdvancedGunBehavior)this).OnPickup(owner);
}
protected override void OnPostDrop(GameActor owner)
{
((AdvancedGunBehavior)this).OnPostDrop(owner);
}
}
}
namespace PIWeapon.Properties
{
[GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[DebuggerNonUserCode]
[CompilerGenerated]
internal class Resources
{
private static ResourceManager resourceMan;
private static CultureInfo resourceCulture;
[EditorBrowsable(EditorBrowsableState.Advanced)]
internal static ResourceManager ResourceManager
{
get
{
if (resourceMan == null)
{
ResourceManager resourceManager = new ResourceManager("PIWeapon.Properties.Resources", typeof(Resources).Assembly);
resourceMan = resourceManager;
}
return resourceMan;
}
}
[EditorBrowsable(EditorBrowsableState.Advanced)]
internal static CultureInfo Culture
{
get
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
internal Resources()
{
}
}
}