using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.IO;
using System.Linq;
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 On.RoR2;
using On.RoR2.Projectile;
using R2API;
using RoR2;
using RoR2.ExpansionManagement;
using RoR2.Projectile;
using UnityEngine;
using UnityEngine.Networking;
using VoidItemAPI;
[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 = "")]
[assembly: AssemblyCompany("ExtraFireworks")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ExtraFireworks")]
[assembly: AssemblyTitle("ExtraFireworks")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace ExtraFireworks;
public class ConfigurableHyperbolicScaling : ConfigurableScaling
{
public ConfigurableHyperbolicScaling(ConfigFile config, string prefix, string configSection, float defaultStart, float defaultScale)
: base(config, prefix, configSection, defaultStart, defaultScale)
{
}
public override string GetBaseDescription()
{
return "Max-cap ceiling value";
}
public override string GetScalingDescription()
{
return "Hyperbolic scaling constant";
}
public override float RawValue(int stacks)
{
return base.Base * (1f - 1f / (1f + base.Scaling * (float)stacks));
}
}
public class ConfigurableLinearScaling : ConfigurableScaling
{
public ConfigurableLinearScaling(ConfigFile config, string prefix, string configSection, float defaultStart, float defaultScale)
: base(config, prefix, configSection, defaultStart, defaultScale)
{
}
public override string GetBaseDescription()
{
return "Base scaling value";
}
public override string GetScalingDescription()
{
return "Additional stacks scaling value";
}
public override float RawValue(int stacks)
{
return base.Base + base.Scaling * (float)(stacks - 1);
}
}
public abstract class ConfigurableScaling
{
private ConfigEntry<float> starting;
private ConfigEntry<float> scale;
public float Base => starting.Value;
public float Scaling => scale.Value;
public abstract string GetBaseDescription();
public abstract string GetScalingDescription();
public abstract float RawValue(int stacks);
public ConfigurableScaling(ConfigFile config, string prefix, string configSection, float defaultStart, float defaultScale)
{
if (prefix == null)
{
prefix = "";
}
starting = config.Bind<float>(configSection, "BaseValue", defaultStart, GetBaseDescription());
scale = config.Bind<float>(configSection, "ScaleAdditionalStacks", defaultScale, GetScalingDescription());
}
public float GetValue(int stacks)
{
if (stacks <= 0)
{
return 0f;
}
return RawValue(stacks);
}
public int GetValueInt(int stacks)
{
return Mathf.RoundToInt(GetValue(stacks));
}
}
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("PhysicsFox.ExtraFireworks", "ExtraFireworks", "1.5.3")]
public class ExtraFireworks : BaseUnityPlugin
{
[Serializable]
[CompilerGenerated]
private sealed class <>c
{
public static readonly <>c <>9 = new <>c();
public static hook_RebuildModel <>9__7_0;
internal void <Awake>b__7_0(orig_RebuildModel orig, PickupDisplay self, GameObject modelObjectOverride)
{
//IL_000b: 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_00a7: Unknown result type (might be due to invalid IL or missing references)
//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
//IL_00df: Unknown result type (might be due to invalid IL or missing references)
//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
orig.Invoke(self, modelObjectOverride);
_ = self.pickupIndex;
if (((PickupIndex)(ref self.pickupIndex)).pickupDef == null || (Object.op_Implicit((Object)(object)self.modelObject) && ((Object)self.modelObject).name == "PickupMystery(Clone)") || (Object.op_Implicit((Object)(object)self.highlight) && ((Object)self.highlight).name == "CommandCube(Clone)"))
{
return;
}
foreach (FireworkItem item in items)
{
if (item.IsEnabled() && ((PickupIndex)(ref self.pickupIndex)).pickupDef.itemTier == item.Item.tier && ((PickupIndex)(ref self.pickupIndex)).pickupDef.itemIndex == item.Item.itemIndex)
{
Transform transform = self.modelObject.transform;
transform.localScale *= item.GetModelScale();
break;
}
}
}
}
public const string PluginGUID = "PhysicsFox.ExtraFireworks";
public const string PluginAuthor = "PhysicsFox";
public const string PluginName = "ExtraFireworks";
public const string PluginVersion = "1.5.3";
public static GameObject fireworkLauncherPrefab;
public static GameObject fireworkPrefab;
private static List<FireworkItem> items;
public void Awake()
{
//IL_016e: Unknown result type (might be due to invalid IL or missing references)
//IL_0173: Unknown result type (might be due to invalid IL or missing references)
//IL_0179: Expected O, but got Unknown
Log.Init(((BaseUnityPlugin)this).Logger);
fireworkLauncherPrefab = LegacyResourcesAPI.Load<GameObject>("Prefabs/FireworkLauncher");
fireworkPrefab = fireworkLauncherPrefab.GetComponent<FireworkLauncher>().projectilePrefab;
items = new List<FireworkItem>
{
new ItemFireworkAbility(this, ((BaseUnityPlugin)this).Config),
new ItemFireworkDaisy(this, ((BaseUnityPlugin)this).Config),
new ItemFireworkDrones(this, ((BaseUnityPlugin)this).Config),
new ItemFireworkMushroom(this, ((BaseUnityPlugin)this).Config),
new ItemFireworkOnHit(this, ((BaseUnityPlugin)this).Config),
new ItemFireworkOnKill(this, ((BaseUnityPlugin)this).Config),
new ItemFireworkFinale(this, ((BaseUnityPlugin)this).Config)
};
ItemFireworkVoid itemFireworkVoid = new ItemFireworkVoid(this, ((BaseUnityPlugin)this).Config);
ItemFireworkVoidConsumed item = (itemFireworkVoid.ConsumedItem = new ItemFireworkVoidConsumed(this, ((BaseUnityPlugin)this).Config, itemFireworkVoid));
items.Add(itemFireworkVoid);
items.Add(item);
using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("ExtraFireworks.extrafireworks"))
{
AssetBundle bundle = AssetBundle.LoadFromStream(stream);
foreach (FireworkItem item2 in items)
{
item2.Init(bundle);
}
}
object obj = <>c.<>9__7_0;
if (obj == null)
{
hook_RebuildModel val = delegate(orig_RebuildModel orig, PickupDisplay self, GameObject modelObjectOverride)
{
//IL_000b: 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_00a7: Unknown result type (might be due to invalid IL or missing references)
//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
//IL_00df: Unknown result type (might be due to invalid IL or missing references)
//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
orig.Invoke(self, modelObjectOverride);
_ = self.pickupIndex;
if (((PickupIndex)(ref self.pickupIndex)).pickupDef == null || (Object.op_Implicit((Object)(object)self.modelObject) && ((Object)self.modelObject).name == "PickupMystery(Clone)") || (Object.op_Implicit((Object)(object)self.highlight) && ((Object)self.highlight).name == "CommandCube(Clone)"))
{
return;
}
foreach (FireworkItem item3 in items)
{
if (item3.IsEnabled() && ((PickupIndex)(ref self.pickupIndex)).pickupDef.itemTier == item3.Item.tier && ((PickupIndex)(ref self.pickupIndex)).pickupDef.itemIndex == item3.Item.itemIndex)
{
Transform transform = self.modelObject.transform;
transform.localScale *= item3.GetModelScale();
break;
}
}
};
<>c.<>9__7_0 = val;
obj = (object)val;
}
PickupDisplay.RebuildModel += (hook_RebuildModel)obj;
Log.LogInfo("Awake done.");
}
public void OnEnable()
{
foreach (FireworkItem item in items)
{
if (item.IsEnabled())
{
item.OnEnable();
}
}
}
public void OnDisable()
{
foreach (FireworkItem item in items)
{
if (item.IsEnabled())
{
item.OnDisable();
}
}
}
private void FixedUpdate()
{
foreach (FireworkItem item in items)
{
if (item.IsEnabled())
{
item.FixedUpdate();
}
}
}
public static FireworkLauncher FireFireworks(CharacterBody owner, int count)
{
FireworkLauncher val = SpawnFireworks(owner.coreTransform, owner, count);
((Component)val).gameObject.transform.parent = owner.coreTransform;
return val;
}
public static FireworkLauncher SpawnFireworks(Transform target, CharacterBody owner, int count, bool attach = true)
{
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: 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_0079: Unknown result type (might be due to invalid IL or missing references)
//IL_00a5: 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_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_009e: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
ModelLocator component = ((Component)target).GetComponent<ModelLocator>();
Transform val = null;
if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component.modelTransform))
{
ChildLocator component2 = ((Component)component.modelTransform).GetComponent<ChildLocator>();
if (Object.op_Implicit((Object)(object)component2))
{
val = component2.FindChild("FireworkOrigin");
}
}
Vector3 val2 = (Object.op_Implicit((Object)(object)val) ? val.position : (target.position + Vector3.up * 2f));
CharacterBody component3 = ((Component)target).GetComponent<CharacterBody>();
if (Object.op_Implicit((Object)(object)component3))
{
val2 += Vector3.up * component3.radius;
}
FireworkLauncher val3 = CreateLauncher(owner, val2, count);
if (attach)
{
((Component)val3).gameObject.transform.parent = target;
}
return val3;
}
public unsafe static FireworkLauncher CreateLauncher(CharacterBody owner, Vector3 position, int count)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_004d->IL004d: Incompatible stack types: O vs I4
//IL_0047->IL004d: Incompatible stack types: I4 vs O
//IL_0047->IL004d: Incompatible stack types: O vs I4
FireworkLauncher component = Object.Instantiate<GameObject>(fireworkLauncherPrefab, position, Quaternion.identity).GetComponent<FireworkLauncher>();
component.owner = ((owner != null) ? ((Component)owner).gameObject : null);
if (Object.op_Implicit((Object)(object)owner))
{
TeamComponent teamComponent = owner.teamComponent;
object obj = component;
int num;
if (Object.op_Implicit((Object)(object)teamComponent))
{
obj = teamComponent.teamIndex;
num = (int)obj;
}
else
{
num = -1;
obj = num;
num = (int)obj;
}
Unsafe.Write(&((FireworkLauncher)num).team, (TeamIndex)obj);
component.crit = Util.CheckRoll(owner.crit, owner.master);
}
component.remaining = count;
return component;
}
}
public abstract class FireworkItem
{
protected ExtraFireworks plugin;
protected ConfigFile config;
protected ConfigEntry<bool> itemEnabled;
public ItemDef Item { get; protected set; }
public abstract string GetName();
public abstract string GetPickupModelName();
public abstract string GetPickupIconName();
public abstract ItemTier GetTier();
public abstract ItemTag[] GetTags();
public abstract string GetItemName();
public abstract string GetItemPickup();
public abstract string GetItemDescription();
public abstract string GetItemLore();
public virtual void AddHooks()
{
}
public virtual void OnEnable()
{
}
public virtual void OnDisable()
{
}
public virtual void FixedUpdate()
{
}
public virtual ItemDisplayRuleDict GetDisplayRules()
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Expected O, but got Unknown
return new ItemDisplayRuleDict((ItemDisplayRule[])null);
}
public string GetPickupModel()
{
return "Assets/ImportModels/" + GetPickupModelName();
}
public virtual float GetModelScale()
{
return 1f;
}
public string GetPickupIcon()
{
return "Assets/Import/" + GetPickupIconName();
}
public virtual string GetConfigSection()
{
return GetName();
}
public bool IsEnabled()
{
return itemEnabled == null || itemEnabled.Value;
}
protected FireworkItem(ExtraFireworks plugin, ConfigFile config)
{
this.plugin = plugin;
this.config = config;
}
public virtual void Init(AssetBundle bundle)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Invalid comparison between Unknown and I4
//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
//IL_00bf: Invalid comparison between Unknown and I4
//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
//IL_0101: Unknown result type (might be due to invalid IL or missing references)
//IL_0107: Unknown result type (might be due to invalid IL or missing references)
//IL_010d: Invalid comparison between Unknown and I4
//IL_0153: Unknown result type (might be due to invalid IL or missing references)
//IL_0159: Invalid comparison between Unknown and I4
//IL_0119: Unknown result type (might be due to invalid IL or missing references)
//IL_0213: Unknown result type (might be due to invalid IL or missing references)
//IL_0219: Invalid comparison between Unknown and I4
//IL_0247: Unknown result type (might be due to invalid IL or missing references)
//IL_0251: Expected O, but got Unknown
if ((int)GetTier() != 5)
{
itemEnabled = config.Bind<bool>(GetConfigSection(), "Enabled", true, "Item enabled?");
}
Item = ScriptableObject.CreateInstance<ItemDef>();
string text = GetName().ToUpper();
((Object)Item).name = "ITEM_" + text + "_NAME";
Item.nameToken = "ITEM_" + text + "_NAME";
Item.pickupToken = "ITEM_" + text + "_PICKUP";
Item.descriptionToken = "ITEM_" + text + "_DESC";
if ((int)GetTier() != 5)
{
Item.loreToken = "ITEM_" + text + "_LORE";
}
Item.tier = GetTier();
Item.deprecatedTier = GetTier();
if ((int)GetTier() == 6)
{
Item.requiredExpansion = ((IEnumerable<ExpansionDef>)(object)ExpansionCatalog.expansionDefs).FirstOrDefault((Func<ExpansionDef, bool>)((ExpansionDef def) => def.nameToken == "DLC1_NAME"));
}
Item.canRemove = (int)GetTier() != 5;
Item.hidden = false;
Item.tags = GetTags();
if ((Object)(object)bundle != (Object)null)
{
Item.pickupModelPrefab = bundle.LoadAsset<GameObject>(GetPickupModel());
Item.pickupIconSprite = bundle.LoadAsset<Sprite>(GetPickupIcon());
}
if (IsEnabled())
{
LanguageAPI.Add(Item.nameToken, GetItemName());
LanguageAPI.Add(Item.pickupToken, GetItemPickup());
LanguageAPI.Add(Item.descriptionToken, GetItemDescription());
if ((int)GetTier() != 5)
{
LanguageAPI.Add(Item.loreToken, GetItemLore());
}
ItemAPI.Add(new CustomItem(Item, GetDisplayRules()));
AddHooks();
}
}
}
public class ItemFireworkAbility : FireworkItem
{
private ConfigurableLinearScaling scaler;
private ConfigEntry<bool> noSkillRestriction;
public ItemFireworkAbility(ExtraFireworks plugin, ConfigFile config)
: base(plugin, config)
{
scaler = new ConfigurableLinearScaling(config, "", GetConfigSection(), 1f, 1f);
noSkillRestriction = config.Bind<bool>(GetConfigSection(), "PrimaryAbilityFireworks", false, "Whether abilities without a cooldown should spawn fireworks... be wary of brokenness, especially on Commando and Railgunner");
}
public override string GetName()
{
return "FireworkAbility";
}
public override string GetPickupModelName()
{
return "Firework-Stuffed Head.prefab";
}
public override float GetModelScale()
{
return 1.1f;
}
public override string GetPickupIconName()
{
return "FireworkStuffedHead.png";
}
public override ItemTier GetTier()
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
return (ItemTier)1;
}
public override ItemTag[] GetTags()
{
ItemTag[] array = new ItemTag[3];
RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/);
return (ItemTag[])(object)array;
}
public override string GetItemName()
{
return "Firework-Stuffed Head";
}
public override string GetItemPickup()
{
return "Using abilities now spawns fireworks";
}
public override string GetItemDescription()
{
return $"Using a <style=cIsUtility>non-primary skill</style> fires <style=cIsDamage>{scaler.Base}</style> " + $"<style=cStack>(+{scaler.Scaling} per stack)</style> <style=cIsDamage>firework</style> for " + "<style=cIsDamage>300%</style> base damage.";
}
public override string GetItemLore()
{
return "Holy shit it's a head with fireworks sticking out of it";
}
public override void AddHooks()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Expected O, but got Unknown
CharacterBody.OnSkillActivated += (hook_OnSkillActivated)delegate(orig_OnSkillActivated orig, CharacterBody self, GenericSkill skill)
{
if (Object.op_Implicit((Object)(object)self.inventory) && !((Object)(object)skill == (Object)null))
{
int itemCount = self.inventory.GetItemCount(base.Item);
if (itemCount > 0 && (noSkillRestriction.Value || (skill.baseRechargeInterval >= 1f - Mathf.Epsilon && Object.op_Implicit((Object)(object)skill.skillDef) && skill.skillDef.stockToConsume > 0)))
{
ExtraFireworks.FireFireworks(self, scaler.GetValueInt(itemCount));
}
}
orig.Invoke(self, skill);
};
}
}
public class ItemFireworkDaisy : FireworkItem
{
private ConfigEntry<int> fireworksPerWave;
private Dictionary<HoldoutZoneController, float> lastCharge;
public ItemFireworkDaisy(ExtraFireworks plugin, ConfigFile config)
: base(plugin, config)
{
fireworksPerWave = config.Bind<int>(GetConfigSection(), "FireworksPerWave", 40, "Number of fireworks per firework daisy wave");
lastCharge = new Dictionary<HoldoutZoneController, float>();
}
public override string GetName()
{
return "FireworkDaisy";
}
public override string GetPickupModelName()
{
return "Firework Daisy.prefab";
}
public override float GetModelScale()
{
return 1.5f;
}
public override string GetPickupIconName()
{
return "FireworkDaisy.png";
}
public override ItemTier GetTier()
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
return (ItemTier)1;
}
public override ItemTag[] GetTags()
{
ItemTag[] array = new ItemTag[4];
RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/);
return (ItemTag[])(object)array;
}
public override string GetItemName()
{
return "Firework Daisy";
}
public override string GetItemPickup()
{
return "Periodically releases waves of fireworks during the teleporter event";
}
public override string GetItemDescription()
{
return "<style=cIsDamage>Releases a barrage of fireworks</style> during the <style=cIsUtility>Teleporter event</style>, dealing " + $"<style=cIsDamage>{fireworksPerWave.Value}x300%</style> base damage. " + "Occurs <style=cIsDamage>2</style> <style=cStack>(+1 per stack)</style> <style=cIsDamage>times</style>.";
}
public override string GetItemLore()
{
return "A lepton daisy with a firework jammed in it.";
}
public override void AddHooks()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Expected O, but got Unknown
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Expected O, but got Unknown
HoldoutZoneController.OnDisable += (hook_OnDisable)delegate(orig_OnDisable orig, HoldoutZoneController self)
{
lastCharge.Remove(self);
orig.Invoke(self);
};
HoldoutZoneController.Update += (hook_Update)delegate(orig_Update orig, HoldoutZoneController self)
{
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
//IL_00f1: Invalid comparison between Unknown and I4
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
lastCharge[self] = self.charge;
orig.Invoke(self);
if (NetworkServer.active)
{
float num = lastCharge[self];
TeamIndex val = (TeamIndex)0;
while ((int)val < 5)
{
int itemCountForTeam = Util.GetItemCountForTeam(val, base.Item.itemIndex, false, true);
if (itemCountForTeam > 0)
{
float nextFireworkCharge = GetNextFireworkCharge(num, itemCountForTeam);
ReadOnlyCollection<TeamComponent> teamMembers = TeamComponent.GetTeamMembers(val);
CharacterBody val2 = null;
while ((Object)(object)val2 == (Object)null)
{
TeamComponent val3 = teamMembers[Random.Range(0, teamMembers.Count)];
val2 = val3.body;
}
if (self.charge >= nextFireworkCharge && num < nextFireworkCharge)
{
ExtraFireworks.SpawnFireworks(self.healingNovaRoot ?? ((Component)self).transform, val2, fireworksPerWave.Value);
}
}
val = (TeamIndex)(sbyte)(val + 1);
}
}
};
}
private static float GetNextFireworkCharge(float charge, int stacks)
{
float num = 1f / (float)(1 + stacks);
float num2 = charge / num;
return Mathf.Ceil(num2) * num;
}
}
public class ItemFireworkDrones : FireworkItem
{
private ConfigEntry<float> fireworkInterval;
private ConfigurableLinearScaling scaler;
private Dictionary<CharacterBody, float> timers;
public ItemFireworkDrones(ExtraFireworks plugin, ConfigFile config)
: base(plugin, config)
{
fireworkInterval = config.Bind<float>(GetConfigSection(), "FireworksInterval", 4f, "Number of seconds between bursts of fireworks");
scaler = new ConfigurableLinearScaling(config, "", GetConfigSection(), 4f, 2f);
timers = new Dictionary<CharacterBody, float>();
}
public override string GetName()
{
return "FireworkDrones";
}
public override string GetPickupModelName()
{
return "Spare Fireworks.prefab";
}
public override float GetModelScale()
{
return 1f;
}
public override string GetPickupIconName()
{
return "SpareFireworks.png";
}
public override ItemTier GetTier()
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
return (ItemTier)2;
}
public override ItemTag[] GetTags()
{
ItemTag[] array = new ItemTag[3];
RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/);
return (ItemTag[])(object)array;
}
public override string GetItemName()
{
return "Spare Fireworks";
}
public override string GetItemPickup()
{
return "All drones now shoot fireworks";
}
public override string GetItemDescription()
{
return "<style=cIsUtility>Non-player allies</style> gain an <style=cIsDamage>automatic firework launcher</style> that propels " + $"<style=cIsDamage>{scaler.Base}</style> <style=cStack>(+{scaler.Scaling} per stack)</style> " + $"<style=cIsDamage>fireworks every {fireworkInterval.Value} seconds</style> " + "for <style=cIsDamage>300%</style> base damage each.";
}
public override string GetItemLore()
{
return "Ayo what we do with all these fireworks?! *END TRANSMISSION*";
}
public override void FixedUpdate()
{
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
//IL_01e3: Invalid comparison between Unknown and I4
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: 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_01dc: Unknown result type (might be due to invalid IL or missing references)
//IL_01de: Unknown result type (might be due to invalid IL or missing references)
//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
if (!NetworkServer.active)
{
return;
}
TeamIndex val = (TeamIndex)0;
while ((int)val < 5)
{
int itemCountForTeam = Util.GetItemCountForTeam(val, base.Item.itemIndex, true, true);
if (itemCountForTeam > 0)
{
ReadOnlyCollection<TeamComponent> teamMembers = TeamComponent.GetTeamMembers(val);
foreach (TeamComponent item in teamMembers)
{
CharacterBody body = item.body;
if (!Object.op_Implicit((Object)(object)body) || !Object.op_Implicit((Object)(object)body.master))
{
continue;
}
MinionGroup val2 = MinionGroup.FindGroup(((NetworkBehaviour)body.master).netId);
if (val2 == null)
{
continue;
}
MinionOwnership[] members = val2.members;
foreach (MinionOwnership val3 in members)
{
if (!Object.op_Implicit((Object)(object)val3))
{
continue;
}
CharacterMaster component = ((Component)val3).GetComponent<CharacterMaster>();
if (!Object.op_Implicit((Object)(object)component) || !Object.op_Implicit((Object)(object)component.inventory))
{
continue;
}
CharacterBody body2 = component.GetBody();
if (Object.op_Implicit((Object)(object)body2))
{
if (!timers.ContainsKey(body2))
{
timers[body2] = RandomStartDelta();
}
float num = timers[body2];
num -= Time.fixedDeltaTime;
if (num <= 0f)
{
ExtraFireworks.SpawnFireworks(body2.coreTransform, body, 2 + 2 * itemCountForTeam);
num = fireworkInterval.Value;
}
timers[body2] = num;
}
}
}
}
val = (TeamIndex)(sbyte)(val + 1);
}
}
private float RandomStartDelta()
{
return Random.value * fireworkInterval.Value;
}
}
public class ItemFireworkFinale : FireworkItem
{
private ConfigEntry<float> fireworkDamage;
private ConfigEntry<float> fireworkExplosionSize;
private ConfigEntry<int> fireworkEnemyKillcount;
private BuffDef buff;
private GameObject projectilePrefab;
private GameObject grandFinaleModel;
private Dictionary<CharacterBody, int> killCountdowns;
public ItemFireworkFinale(ExtraFireworks plugin, ConfigFile config)
: base(plugin, config)
{
fireworkDamage = config.Bind<float>(GetConfigSection(), "DamageCoefficient", 50f, "Damage of Grand Finale firework as coefficient of base damage");
fireworkExplosionSize = config.Bind<float>(GetConfigSection(), "ExplosionRadius", 10f, "Explosion radius of Grand Finale firework");
fireworkEnemyKillcount = config.Bind<int>(GetConfigSection(), "KillThreshold", 10, "Number of enemies required to proc the Grand Finale firework");
killCountdowns = new Dictionary<CharacterBody, int>();
}
public override string GetName()
{
return "FireworkGrandFinale";
}
public override string GetPickupModelName()
{
return "GrandFinale.prefab";
}
public override float GetModelScale()
{
return 3f;
}
public override string GetPickupIconName()
{
return "GrandFinale.png";
}
public override ItemTier GetTier()
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
return (ItemTier)2;
}
public override ItemTag[] GetTags()
{
ItemTag[] array = new ItemTag[4];
RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/);
return (ItemTag[])(object)array;
}
public override string GetItemName()
{
return "Grand Finale";
}
public override string GetItemPickup()
{
return $"Launch a grand finale firework after killing {fireworkEnemyKillcount.Value} enemies.";
}
public override string GetItemDescription()
{
return $"<style=cIsDamage>Killing {fireworkEnemyKillcount.Value}</style> " + "<style=cStack>(-50% per stack)</style> <style=cIsDamage>enemies</style> fires out a <style=cIsDamage>massive firework</style> that deals <style=cIsDamage>5000%</style> base damage.";
}
public override string GetItemLore()
{
return "Ayo what we do this one big ass firework?! *END TRANSMISSION*";
}
public override void Init(AssetBundle bundle)
{
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
//IL_0118: Unknown result type (might be due to invalid IL or missing references)
//IL_0184: Unknown result type (might be due to invalid IL or missing references)
//IL_018e: Unknown result type (might be due to invalid IL or missing references)
base.Init(bundle);
grandFinaleModel = bundle.LoadAsset<GameObject>("Assets/ImportModels/GrandFinaleProjectile.prefab");
buff = ScriptableObject.CreateInstance<BuffDef>();
((Object)buff).name = "GrandFinaleCountdown";
buff.canStack = true;
buff.isCooldown = false;
buff.isDebuff = false;
buff.buffColor = Color.red;
buff.iconSprite = bundle.LoadAsset<Sprite>("Assets/Import/GrandFinaleBuff.png");
ContentAddition.AddBuffDef(buff);
projectilePrefab = PrefabAPI.InstantiateClone(ExtraFireworks.fireworkPrefab, "GrandFinaleProjectile");
projectilePrefab.layer = LayerMask.NameToLayer("Projectile");
ProjectileImpactExplosion component = projectilePrefab.GetComponent<ProjectileImpactExplosion>();
component.lifetime = 99f;
component.explodeOnLifeTimeExpiration = true;
((ProjectileExplosion)component).blastDamageCoefficient = 1f;
((ProjectileExplosion)component).blastProcCoefficient = 1f;
float blastRadius = ((ProjectileExplosion)component).blastRadius;
((ProjectileExplosion)component).blastRadius = fireworkExplosionSize.Value;
((ProjectileExplosion)component).dotDamageMultiplier = 1f;
((ProjectileExplosion)component).canRejectForce = true;
((ProjectileExplosion)component).falloffModel = (FalloffModel)0;
MissileController component2 = projectilePrefab.GetComponent<MissileController>();
component2.maxVelocity = 7.5f;
component2.maxSeekDistance = 150f;
component2.acceleration = 2f;
component2.rollVelocity = 3f;
component2.giveupTimer = 99f;
component2.deathTimer = 99f;
component2.turbulence = 0.5f;
BoxCollider component3 = projectilePrefab.GetComponent<BoxCollider>();
component3.size *= 5f;
}
private void RefreshBuffCount(CharacterBody body)
{
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
int itemCount = body.inventory.GetItemCount(base.Item);
if (itemCount <= 0)
{
body.SetBuffCount(buff.buffIndex, 0);
}
else if (killCountdowns.ContainsKey(body))
{
body.SetBuffCount(buff.buffIndex, killCountdowns[body]);
}
}
public void FixCounts()
{
ReadOnlyCollection<PlayerCharacterMasterController> instances = PlayerCharacterMasterController.instances;
if (instances == null)
{
return;
}
foreach (PlayerCharacterMasterController item in instances)
{
CharacterBody body = item.master.GetBody();
if (!((Object)(object)body == (Object)null))
{
RefreshBuffCount(body);
}
}
}
public override void FixedUpdate()
{
FixCounts();
}
protected void ResetKillcount(CharacterBody body, int itemCount)
{
killCountdowns[body] = Mathf.CeilToInt((float)fireworkEnemyKillcount.Value * 1f / Mathf.Pow(2f, (float)(itemCount - 1)));
}
private void RefreshModel(ProjectileGhostController self)
{
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
//IL_0143: Unknown result type (might be due to invalid IL or missing references)
//IL_0169: Unknown result type (might be due to invalid IL or missing references)
if (Object.op_Implicit((Object)(object)self.authorityTransform) && ((Object)((Component)self.authorityTransform).gameObject).name.StartsWith("GrandFinaleProjectile"))
{
self.transform.GetChild(1).localPosition = new Vector3(0f, 0f, -1.75f);
self.transform.GetChild(2).localPosition = new Vector3(0f, 0f, -1.75f);
Transform child = self.transform.GetChild(0);
if (child.childCount == 0)
{
GameObject val = PrefabAPI.InstantiateClone(grandFinaleModel, "GrandFinaleModel");
val.transform.parent = ((Component)child).transform;
val.transform.localPosition = Vector3.zero;
}
else
{
((Renderer)((Component)child.GetChild(0)).GetComponentInChildren<MeshRenderer>()).enabled = true;
}
((Renderer)((Component)child).GetComponent<MeshRenderer>()).enabled = false;
}
if (Object.op_Implicit((Object)(object)self.authorityTransform) && ((Object)((Component)self.authorityTransform).gameObject).name.StartsWith("FireworkProjectile"))
{
self.transform.GetChild(1).localPosition = new Vector3(0f, 0f, -0.729f);
self.transform.GetChild(2).localPosition = new Vector3(0f, 0f, -0.764f);
Transform child2 = self.transform.GetChild(0);
if (child2.childCount > 0)
{
((Renderer)((Component)child2.GetChild(0)).GetComponentInChildren<MeshRenderer>()).enabled = false;
((Renderer)((Component)child2).GetComponent<MeshRenderer>()).enabled = true;
}
}
}
public override void AddHooks()
{
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Expected O, but got Unknown
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Expected O, but got Unknown
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Expected O, but got Unknown
GlobalEventManager.onCharacterDeathGlobal += delegate(DamageReport report)
{
//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
//IL_00be: Unknown result type (might be due to invalid IL or missing references)
//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
if (Object.op_Implicit((Object)(object)report.attacker) && Object.op_Implicit((Object)(object)report.attackerBody))
{
CharacterBody attackerBody = report.attackerBody;
if (Object.op_Implicit((Object)(object)attackerBody.inventory))
{
int itemCount3 = attackerBody.inventory.GetItemCount(base.Item);
if (itemCount3 > 0)
{
if (!killCountdowns.ContainsKey(attackerBody))
{
ResetKillcount(attackerBody, itemCount3);
}
int num = killCountdowns[attackerBody] - 1;
if (num > 0)
{
killCountdowns[attackerBody] = num;
}
else
{
ProjectileManager.instance.FireProjectile(projectilePrefab, attackerBody.corePosition + Vector3.up * attackerBody.radius, Quaternion.LookRotation(Vector3.up), ((Component)attackerBody).gameObject, fireworkDamage.Value * attackerBody.baseDamage, 50f, attackerBody.RollCrit(), (DamageColorIndex)0, (GameObject)null, -1f);
ResetKillcount(attackerBody, itemCount3);
}
}
}
}
};
ProjectileGhostController.FixedUpdate += (hook_FixedUpdate)delegate(orig_FixedUpdate orig, ProjectileGhostController self)
{
orig.Invoke(self);
RefreshModel(self);
};
CharacterMaster.OnServerStageBegin += (hook_OnServerStageBegin)delegate(orig_OnServerStageBegin orig, CharacterMaster self, Stage stage)
{
orig.Invoke(self, stage);
if (Object.op_Implicit((Object)(object)self.playerCharacterMasterController))
{
CharacterBody body = self.playerCharacterMasterController.body;
if (Object.op_Implicit((Object)(object)body) && Object.op_Implicit((Object)(object)self.inventory))
{
int itemCount2 = self.inventory.GetItemCount(base.Item);
if (killCountdowns.ContainsKey(body))
{
if (killCountdowns.ContainsKey(body) && itemCount2 <= 0)
{
killCountdowns.Remove(body);
}
else
{
ResetKillcount(body, itemCount2);
}
}
}
}
};
CharacterBody.OnInventoryChanged += (hook_OnInventoryChanged)delegate(orig_OnInventoryChanged orig, CharacterBody self)
{
orig.Invoke(self);
if (Object.op_Implicit((Object)(object)self.inventory))
{
int itemCount = self.inventory.GetItemCount(base.Item);
if (itemCount <= 0 && killCountdowns.ContainsKey(self))
{
killCountdowns.Remove(self);
}
else if (itemCount > 0 && !killCountdowns.ContainsKey(self))
{
ResetKillcount(self, itemCount);
}
}
};
}
}
public class ItemFireworkMushroom : FireworkItem
{
private ConfigurableHyperbolicScaling scaler;
private Dictionary<CharacterBody, GameObject> mushroomFireworkGameObject;
private Dictionary<CharacterBody, float> fungusTimers;
private GameObject mushroomFireworkPrefab;
public ItemFireworkMushroom(ExtraFireworks plugin, ConfigFile config)
: base(plugin, config)
{
scaler = new ConfigurableHyperbolicScaling(config, "", GetConfigSection(), 1f, 0.1f);
mushroomFireworkGameObject = new Dictionary<CharacterBody, GameObject>();
fungusTimers = new Dictionary<CharacterBody, float>();
mushroomFireworkPrefab = LegacyResourcesAPI.Load<GameObject>("Prefabs/NetworkedObjects/MushroomWard");
}
public override string GetName()
{
return "FireworkMushroom";
}
public override string GetPickupModelName()
{
return "Fungus.prefab";
}
public override float GetModelScale()
{
return 0.75f;
}
public override string GetPickupIconName()
{
return "Fungus.png";
}
public override ItemTier GetTier()
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
return (ItemTier)0;
}
public override ItemTag[] GetTags()
{
ItemTag[] array = new ItemTag[3];
RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/);
return (ItemTag[])(object)array;
}
public override string GetItemName()
{
return "Fungus";
}
public override string GetItemPickup()
{
return "Become a firework launcher when you stand still.";
}
public override string GetItemDescription()
{
return "After <style=cIsUtility>standing still</style> for <style=cIsUtility>1 second</style>, shoot fireworks " + $"at <style=cIsDamage>{scaler.GetValue(1) * 100f:0}%</style> " + $"<style=cStack>(+{(scaler.GetValue(2) - scaler.GetValue(1)) * 100f:0} per stack)</style> speed " + "<style=cStack>(hyperbolic up to 100%)</style> that deal <style=cIsDamage>300%</style> base damage.";
}
public override string GetItemLore()
{
return "A fun arts and crafts project.";
}
public override void AddHooks()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Expected O, but got Unknown
CharacterBody.OnSkillActivated += (hook_OnSkillActivated)delegate(orig_OnSkillActivated orig, CharacterBody self, GenericSkill skill)
{
if (Object.op_Implicit((Object)(object)self.inventory) && !((Object)(object)skill == (Object)null))
{
int itemCount = self.inventory.GetItemCount(base.Item);
if (itemCount > 0 && (Object)(object)skill != (Object)(object)self.skillLocator?.primary)
{
ExtraFireworks.FireFireworks(self, scaler.GetValueInt(itemCount));
}
}
orig.Invoke(self, skill);
};
}
public override void FixedUpdate()
{
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
if (!NetworkServer.active)
{
return;
}
ReadOnlyCollection<TeamComponent> teamMembers = TeamComponent.GetTeamMembers((TeamIndex)1);
foreach (TeamComponent item in teamMembers)
{
if (!Object.op_Implicit((Object)(object)item.body))
{
continue;
}
CharacterBody body = item.body;
if (!Object.op_Implicit((Object)(object)body.inventory))
{
continue;
}
int itemCount = body.inventory.GetItemCount(base.Item);
bool flag = itemCount > 0 && body.GetNotMoving();
if (mushroomFireworkGameObject.ContainsKey(body) != flag)
{
if (flag)
{
GameObject val = Object.Instantiate<GameObject>(mushroomFireworkPrefab, body.footPosition, Quaternion.identity);
HealingWard component = val.GetComponent<HealingWard>();
NetworkServer.Spawn(val);
if (Object.op_Implicit((Object)(object)component))
{
component.healFraction = 0f;
component.healPoints = 0f;
component.Networkradius = (body.radius + 3f) / 3f;
}
Transform transform = val.transform;
GameObject gameObject = ((Component)body).gameObject;
transform.parent = ((gameObject != null) ? gameObject.transform : null);
mushroomFireworkGameObject[body] = val;
}
else
{
GameObject val2 = mushroomFireworkGameObject[body];
Object.Destroy((Object)(object)val2);
mushroomFireworkGameObject.Remove(body);
}
}
if (fungusTimers.ContainsKey(body))
{
fungusTimers[body] -= Time.fixedDeltaTime;
}
if (flag && (!fungusTimers.ContainsKey(body) || fungusTimers[body] <= 0f))
{
FireworkLauncher val3 = ExtraFireworks.FireFireworks(body, 1);
val3.launchInterval /= 1f - 1f / (1f + 0.05f * (float)itemCount);
fungusTimers[body] = val3.launchInterval;
}
}
}
}
public class ItemFireworkOnHit : FireworkItem
{
private ConfigurableLinearScaling scaler;
private ConfigEntry<int> numFireworks;
private static readonly float MAX_FIREWORK_HEIGHT = 50f;
public ItemFireworkOnHit(ExtraFireworks plugin, ConfigFile config)
: base(plugin, config)
{
numFireworks = config.Bind<int>(GetConfigSection(), "FireworksPerHit", 1, "Number of fireworks per hit");
scaler = new ConfigurableLinearScaling(config, "", GetConfigSection(), 10f, 10f);
}
public override string GetName()
{
return "FireworkOnHit";
}
public override string GetPickupModelName()
{
return "Firework Dagger.prefab";
}
public override float GetModelScale()
{
return 0.15f;
}
public override string GetPickupIconName()
{
return "FireworkDagger.png";
}
public override ItemTier GetTier()
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
return (ItemTier)0;
}
public override ItemTag[] GetTags()
{
ItemTag[] array = new ItemTag[3];
RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/);
return (ItemTag[])(object)array;
}
public override string GetItemName()
{
return "Firework Dagger";
}
public override string GetItemPickup()
{
return "Chance to fire fireworks on hit";
}
public override string GetItemDescription()
{
string text = $"Gain a <style=cIsDamage>{scaler.Base:0}%</style> chance " + $"<style=cStack>(+{scaler.Scaling:0}% per stack)</style> <style=cIsDamage>on hit</style> to ";
if (numFireworks.Value == 1)
{
return text + "<style=cIsDamage>fire a firework</style> for <style=cIsDamage>300%</style> base damage.";
}
return text + $"<style=cIsDamage>fire {numFireworks.Value} fireworks</style> for <style=cIsDamage>300%</style> " + "base damage each.";
}
public override string GetItemLore()
{
return "You got stabbed by a firework and is kill.";
}
public override void AddHooks()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Expected O, but got Unknown
GlobalEventManager.OnHitEnemy += (hook_OnHitEnemy)delegate(orig_OnHitEnemy orig, GlobalEventManager self, DamageInfo damageInfo, GameObject victim)
{
//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
//IL_010d: Unknown result type (might be due to invalid IL or missing references)
//IL_0112: Unknown result type (might be due to invalid IL or missing references)
//IL_011d: Unknown result type (might be due to invalid IL or missing references)
//IL_011f: Unknown result type (might be due to invalid IL or missing references)
//IL_0149: Unknown result type (might be due to invalid IL or missing references)
//IL_014b: Unknown result type (might be due to invalid IL or missing references)
//IL_014d: Unknown result type (might be due to invalid IL or missing references)
//IL_0156: Unknown result type (might be due to invalid IL or missing references)
//IL_0158: Unknown result type (might be due to invalid IL or missing references)
//IL_0141: Unknown result type (might be due to invalid IL or missing references)
//IL_0146: Unknown result type (might be due to invalid IL or missing references)
//IL_017a: Unknown result type (might be due to invalid IL or missing references)
//IL_017f: Unknown result type (might be due to invalid IL or missing references)
//IL_025e: Unknown result type (might be due to invalid IL or missing references)
//IL_0260: Unknown result type (might be due to invalid IL or missing references)
//IL_026a: Unknown result type (might be due to invalid IL or missing references)
//IL_026f: Unknown result type (might be due to invalid IL or missing references)
//IL_020d: Unknown result type (might be due to invalid IL or missing references)
//IL_0214: Unknown result type (might be due to invalid IL or missing references)
//IL_0219: Unknown result type (might be due to invalid IL or missing references)
//IL_021e: Unknown result type (might be due to invalid IL or missing references)
//IL_0223: Unknown result type (might be due to invalid IL or missing references)
//IL_0228: Unknown result type (might be due to invalid IL or missing references)
//IL_022a: Unknown result type (might be due to invalid IL or missing references)
//IL_023c: Unknown result type (might be due to invalid IL or missing references)
//IL_023e: Unknown result type (might be due to invalid IL or missing references)
//IL_0240: Unknown result type (might be due to invalid IL or missing references)
if (damageInfo.procCoefficient != 0f && !damageInfo.rejected && NetworkServer.active && !((ProcChainMask)(ref damageInfo.procChainMask)).HasProc((ProcType)20) && (!Object.op_Implicit((Object)(object)damageInfo.inflictor) || !Object.op_Implicit((Object)(object)damageInfo.inflictor.GetComponent<MissileController>())) && Object.op_Implicit((Object)(object)damageInfo.attacker))
{
CharacterBody component = damageInfo.attacker.GetComponent<CharacterBody>();
if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component.inventory))
{
int itemCount = component.inventory.GetItemCount(base.Item.itemIndex);
if (itemCount > 0 && Util.CheckRoll(scaler.GetValue(itemCount) * damageInfo.procCoefficient, component.master))
{
CharacterBody component2 = victim.GetComponent<CharacterBody>();
Vector3 val = damageInfo.position;
if (Object.op_Implicit((Object)(object)component2) && Vector3.Distance(val, Vector3.zero) < Mathf.Epsilon)
{
val = component2.mainHurtBox.randomVolumePoint;
}
Vector3 val2 = val;
float y = val.y;
RaycastHit[] array = Physics.RaycastAll(val, Vector3.up, MAX_FIREWORK_HEIGHT);
RaycastHit[] array2 = array;
for (int i = 0; i < array2.Length; i++)
{
RaycastHit val3 = array2[i];
CharacterModel componentInParent = ((Component)((RaycastHit)(ref val3)).transform).GetComponentInParent<CharacterModel>();
if (Object.op_Implicit((Object)(object)componentInParent))
{
CharacterBody body = componentInParent.body;
if (Object.op_Implicit((Object)(object)body) && !((Object)(object)body != (Object)(object)component2))
{
HurtBox componentInChildren = ((Component)((RaycastHit)(ref val3)).transform).GetComponentInChildren<HurtBox>();
if (Object.op_Implicit((Object)(object)componentInChildren))
{
Collider collider = componentInChildren.collider;
if (Object.op_Implicit((Object)(object)collider))
{
Vector3 val4 = collider.ClosestPoint(val + MAX_FIREWORK_HEIGHT * Vector3.up);
if (val4.y > y)
{
val2 = val4;
y = val4.y;
}
}
}
}
}
}
ExtraFireworks.CreateLauncher(component, val2 + Vector3.up * 2f, numFireworks.Value);
((ProcChainMask)(ref damageInfo.procChainMask)).AddProc((ProcType)20);
}
}
}
orig.Invoke(self, damageInfo, victim);
};
}
}
public class ItemFireworkOnKill : FireworkItem
{
private ConfigurableLinearScaling scaler;
public ItemFireworkOnKill(ExtraFireworks plugin, ConfigFile config)
: base(plugin, config)
{
scaler = new ConfigurableLinearScaling(config, "", GetConfigSection(), 2f, 1f);
}
public override string GetName()
{
return "FireworkOnKill";
}
public override string GetPickupModelName()
{
return "Will-o-the-Firework.prefab";
}
public override float GetModelScale()
{
return 1.1f;
}
public override string GetPickupIconName()
{
return "BottledFireworks.png";
}
public override ItemTier GetTier()
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
return (ItemTier)1;
}
public override ItemTag[] GetTags()
{
ItemTag[] array = new ItemTag[4];
RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/);
return (ItemTag[])(object)array;
}
public override string GetItemName()
{
return "Will-o'-the-Firework";
}
public override string GetItemPickup()
{
return "Spawn fireworks on kill";
}
public override string GetItemDescription()
{
return "On <style=cIsDamage>killing an enemy</style>, release a " + $"<style=cIsDamage>barrage of {scaler.Base}</style> " + $"<style=cStack>(+{scaler.Scaling} per stack)</style> <style=cIsDamage>fireworks</style> for " + "<style=cIsDamage>300%</style> base damage each.";
}
public override string GetItemLore()
{
return "Revolutionary design.";
}
public override void AddHooks()
{
GlobalEventManager.onCharacterDeathGlobal += delegate(DamageReport report)
{
if (Object.op_Implicit((Object)(object)report.attacker) && Object.op_Implicit((Object)(object)report.attackerBody))
{
CharacterBody attackerBody = report.attackerBody;
if (Object.op_Implicit((Object)(object)attackerBody.inventory))
{
int itemCount = attackerBody.inventory.GetItemCount(base.Item);
if (itemCount > 0 && Object.op_Implicit((Object)(object)report.victim))
{
CharacterBody body = report.victim.body;
if (Object.op_Implicit((Object)(object)body))
{
Transform target = (Object.op_Implicit((Object)(object)body.coreTransform) ? body.coreTransform : body.transform);
ExtraFireworks.SpawnFireworks(target, attackerBody, scaler.GetValueInt(itemCount), attach: false);
}
}
}
}
};
}
}
public class ItemFireworkVoid : FireworkItem
{
public ConfigEntry<int> fireworksPerStack;
public ConfigEntry<float> hpThreshold;
public ItemFireworkVoidConsumed ConsumedItem;
private bool voidInitialized = false;
public ItemFireworkVoid(ExtraFireworks plugin, ConfigFile config)
: base(plugin, config)
{
fireworksPerStack = config.Bind<int>(GetConfigSection(), "FireworksPerUse", 20, "Number of fireworks per consumption");
hpThreshold = config.Bind<float>(GetConfigSection(), "HpThreshold", 0.25f, "HP threshold before Power Works is consumed");
}
public override string GetName()
{
return "PowerWorks";
}
public override string GetPickupModelName()
{
return "Power Works.prefab";
}
public override float GetModelScale()
{
return 0.4f;
}
public override string GetPickupIconName()
{
return "PowerWorks.png";
}
public override ItemTier GetTier()
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
return (ItemTier)6;
}
public override ItemTag[] GetTags()
{
ItemTag[] array = new ItemTag[3];
RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/);
return (ItemTag[])(object)array;
}
public override string GetItemName()
{
return "Power 'Works";
}
public override string GetItemPickup()
{
return "Release a barrage of fireworks at low health. Refreshes every stage. Corrupts all Power Elixirs.";
}
public override string GetItemDescription()
{
return $"Taking damage to below <style=cIsHealth>{hpThreshold.Value * 100f:0}% health</style> " + "<style=cIsUtility>consumes</style> this item, releasing a <style=cIsDamage>barrage of fireworks</style> dealing " + $"<style=cIsDamage>{fireworksPerStack.Value}x300%</style> " + $"<style=cStack>(+{fireworksPerStack.Value} per stack)</style> base damage. " + "<style=cIsUtility>(Refreshes next stage)</style>. <style=cIsVoid>Corrupts all Power Elixirs</style>.";
}
public override string GetItemLore()
{
return "MMMM YUM.";
}
public override void AddHooks()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Expected O, but got Unknown
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Expected O, but got Unknown
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Expected O, but got Unknown
HealthComponent.TakeDamage += (hook_TakeDamage)delegate(orig_TakeDamage orig, HealthComponent self, DamageInfo info)
{
//IL_0076: Unknown result type (might be due to invalid IL or missing references)
//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
//IL_00da: Unknown result type (might be due to invalid IL or missing references)
//IL_0100: Unknown result type (might be due to invalid IL or missing references)
//IL_0112: Unknown result type (might be due to invalid IL or missing references)
orig.Invoke(self, info);
CharacterBody body = self.body;
if (Object.op_Implicit((Object)(object)body) && Object.op_Implicit((Object)(object)body.inventory) && Object.op_Implicit((Object)(object)body.master) && NetworkServer.active && self.health / self.fullHealth <= hpThreshold.Value)
{
int itemCount2 = body.inventory.GetItemCount(base.Item.itemIndex);
if (itemCount2 > 0)
{
body.inventory.RemoveItem(base.Item, itemCount2);
body.inventory.GiveItem(ConsumedItem.Item, itemCount2);
CharacterMasterNotificationQueue.SendTransformNotification(body.master, base.Item.itemIndex, ConsumedItem.Item.itemIndex, (TransformationType)0);
ExtraFireworks.FireFireworks(body, fireworksPerStack.Value * itemCount2);
body.SetBuffCount(Buffs.BearVoidCooldown.buffIndex, 0);
body.SetBuffCount(Buffs.BearVoidReady.buffIndex, 1);
}
}
};
ItemCatalog.SetItemDefs += (hook_SetItemDefs)delegate(orig_SetItemDefs orig, ItemDef[] newItemDefs)
{
orig.Invoke(newItemDefs);
if (!voidInitialized)
{
VoidTransformation.CreateTransformation(base.Item, Items.HealingPotion);
voidInitialized = true;
}
};
CharacterMaster.OnServerStageBegin += (hook_OnServerStageBegin)delegate(orig_OnServerStageBegin orig, CharacterMaster self, Stage stage)
{
//IL_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_0080: Unknown result type (might be due to invalid IL or missing references)
orig.Invoke(self, stage);
int itemCount = self.inventory.GetItemCount(ConsumedItem.Item);
if (Object.op_Implicit((Object)(object)self.inventory) && itemCount > 0)
{
self.inventory.RemoveItem(ConsumedItem.Item, itemCount);
self.inventory.GiveItem(base.Item, itemCount);
CharacterMasterNotificationQueue.SendTransformNotification(self, ConsumedItem.Item.itemIndex, base.Item.itemIndex, (TransformationType)0);
}
};
}
}
public class ItemFireworkVoidConsumed : FireworkItem
{
private ItemFireworkVoid parent;
private bool voidInitialized = false;
public ItemFireworkVoidConsumed(ExtraFireworks plugin, ConfigFile config, ItemFireworkVoid parent)
: base(plugin, config)
{
this.parent = parent;
}
public override string GetName()
{
return "PowerWorksConsumed";
}
public override string GetPickupModelName()
{
return "Power Works.prefab";
}
public override float GetModelScale()
{
return 0.4f;
}
public override string GetPickupIconName()
{
return "PowerWorksConsumed.png";
}
public override ItemTier GetTier()
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
return (ItemTier)5;
}
public override ItemTag[] GetTags()
{
ItemTag[] array = new ItemTag[6];
RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/);
return (ItemTag[])(object)array;
}
public override string GetItemName()
{
return "Power 'Works (Consumed)";
}
public override string GetItemPickup()
{
return parent.GetItemPickup();
}
public override string GetItemDescription()
{
return parent.GetItemDescription();
}
public override string GetItemLore()
{
return parent.GetItemLore();
}
public override void AddHooks()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Expected O, but got Unknown
ItemCatalog.SetItemDefs += (hook_SetItemDefs)delegate(orig_SetItemDefs orig, ItemDef[] newItemDefs)
{
orig.Invoke(newItemDefs);
if (!voidInitialized)
{
VoidTransformation.CreateTransformation(base.Item, Items.HealingPotionConsumed);
voidInitialized = true;
}
};
}
}
internal static class Log
{
internal static ManualLogSource _logSource;
internal static void Init(ManualLogSource logSource)
{
_logSource = logSource;
}
internal static void LogDebug(object data)
{
_logSource.LogDebug(data);
}
internal static void LogError(object data)
{
_logSource.LogError(data);
}
internal static void LogFatal(object data)
{
_logSource.LogFatal(data);
}
internal static void LogInfo(object data)
{
_logSource.LogInfo(data);
}
internal static void LogMessage(object data)
{
_logSource.LogMessage(data);
}
internal static void LogWarning(object data)
{
_logSource.LogWarning(data);
}
}