using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using OpenShot.Events;
using OpenShot.UI;
using Shooterlatro.Core;
using Shooterlatro.Game;
using Shooterlatro.Gameplay;
using Shooterlatro.Score;
using Shooterlatro.Shop;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("SkillshotMod")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Skill-based challenge rules for Lucky Shot: harder aim, weaker shop, no-miss, combo-only, and more. Config-driven.")]
[assembly: AssemblyFileVersion("1.2.2.0")]
[assembly: AssemblyInformationalVersion("1.2.2+4135dd1490a61fe647f2a0e54287f36471f5cf7f")]
[assembly: AssemblyProduct("SkillshotMod")]
[assembly: AssemblyTitle("SkillshotMod")]
[assembly: AssemblyVersion("1.2.2.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[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 SkillshotMod
{
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("com.liamgaming.skillshot", "Skillshot", "1.2.2")]
public class SkillshotPlugin : BaseUnityPlugin
{
public const string PluginGuid = "com.liamgaming.skillshot";
public const string PluginName = "Skillshot";
public const string PluginVersion = "1.2.2";
private Harmony _harmony;
private HashSet<string> _bannedHoloCache;
private string _bannedHoloCacheSource;
public static SkillshotPlugin Instance { get; private set; }
public static ManualLogSource Log { get; private set; }
public static ConfigEntry<bool> Enabled { get; private set; }
public static ConfigEntry<bool> VerboseLogging { get; private set; }
public static ConfigEntry<bool> WeakerShopItems { get; private set; }
public static ConfigEntry<float> ShopCostMultiplier { get; private set; }
public static ConfigEntry<bool> CommonBias { get; private set; }
public static ConfigEntry<float> CommonBiasStrength { get; private set; }
public static ConfigEntry<bool> BanRareHolos { get; private set; }
public static ConfigEntry<bool> BanLegendaryHolos { get; private set; }
public static ConfigEntry<bool> BanMythicalHolos { get; private set; }
public static ConfigEntry<string> BannedHoloIds { get; private set; }
public static ConfigEntry<bool> NoMiss { get; private set; }
public static ConfigEntry<bool> NoMissForgiveness { get; private set; }
public static ConfigEntry<bool> ComboOnly { get; private set; }
public static ConfigEntry<bool> SmallerTargets { get; private set; }
public static ConfigEntry<float> TargetScale { get; private set; }
public static ConfigEntry<int> ExtraMaxTargets { get; private set; }
public static ConfigEntry<bool> ShorterRounds { get; private set; }
public static ConfigEntry<float> RoundTimeMultiplier { get; private set; }
public static ConfigEntry<bool> SlowerComboGrowth { get; private set; }
public static ConfigEntry<float> StreakGrowthFactor { get; private set; }
public static ConfigEntry<bool> HarderScoreTargets { get; private set; }
public static ConfigEntry<float> ScoreTargetMultiplier { get; private set; }
public static bool Active
{
get
{
if (Enabled != null)
{
return Enabled.Value;
}
return false;
}
}
private void Awake()
{
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Expected O, but got Unknown
Instance = this;
Log = ((BaseUnityPlugin)this).Logger;
BindConfig();
RegisterOpenShotMenu();
_harmony = new Harmony("com.liamgaming.skillshot");
_harmony.PatchAll(typeof(SkillshotPlugin).Assembly);
GameEvents.OnTargetSpawned += HandleTargetSpawned;
GameEvents.OnTargetSpawnerStarted += HandleTargetSpawnerStarted;
Log.LogInfo((object)"Skillshot v1.2.2 loaded (OpenShot 2.0.0).");
}
private void OnDestroy()
{
GameEvents.OnTargetSpawned -= HandleTargetSpawned;
GameEvents.OnTargetSpawnerStarted -= HandleTargetSpawnerStarted;
Harmony harmony = _harmony;
if (harmony != null)
{
harmony.UnpatchSelf();
}
}
private void BindConfig()
{
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_0098: Expected O, but got Unknown
//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
//IL_00f5: Expected O, but got Unknown
//IL_022c: Unknown result type (might be due to invalid IL or missing references)
//IL_0236: Expected O, but got Unknown
//IL_025e: Unknown result type (might be due to invalid IL or missing references)
//IL_0268: Expected O, but got Unknown
//IL_02bb: Unknown result type (might be due to invalid IL or missing references)
//IL_02c5: Expected O, but got Unknown
//IL_0318: Unknown result type (might be due to invalid IL or missing references)
//IL_0322: Expected O, but got Unknown
//IL_0375: Unknown result type (might be due to invalid IL or missing references)
//IL_037f: Expected O, but got Unknown
Enabled = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enabled", true, "Master switch for all Skillshot rules.");
VerboseLogging = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "VerboseLogging", false, "Log when challenge rules fire.");
WeakerShopItems = ((BaseUnityPlugin)this).Config.Bind<bool>("Shop", "WeakerShopItems", true, "Multiply shop prices.");
ShopCostMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Shop", "ShopCostMultiplier", 1.75f, new ConfigDescription("Price multiplier when WeakerShopItems is on.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 5f), Array.Empty<object>()));
CommonBias = ((BaseUnityPlugin)this).Config.Bind<bool>("Shop", "CommonBias", true, "Down-weight Rare+ shop rolls.");
CommonBiasStrength = ((BaseUnityPlugin)this).Config.Bind<float>("Shop", "CommonBiasStrength", 1f, new ConfigDescription("How hard CommonBias hits Rare+ weights (1 = default).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.25f, 2f), Array.Empty<object>()));
BanRareHolos = ((BaseUnityPlugin)this).Config.Bind<bool>("Shop", "BanRareHolos", false, "Remove Rare holos from the shop pool.");
BanLegendaryHolos = ((BaseUnityPlugin)this).Config.Bind<bool>("Shop", "BanLegendaryHolos", false, "Remove Legendary holos from the shop pool.");
BanMythicalHolos = ((BaseUnityPlugin)this).Config.Bind<bool>("Shop", "BanMythicalHolos", true, "Remove Mythical holos from the shop pool.");
BannedHoloIds = ((BaseUnityPlugin)this).Config.Bind<string>("Shop", "BannedHoloIds", "H-001,H-085,H-107,H-134,H-185", "Comma-separated holo catalog IDs to ban.");
NoMiss = ((BaseUnityPlugin)this).Config.Bind<bool>("Miss", "NoMiss", false, "Any unforgiven miss fails the round.");
NoMissForgiveness = ((BaseUnityPlugin)this).Config.Bind<bool>("Miss", "NoMissForgiveness", false, "Ignore miss forgiveness.");
ComboOnly = ((BaseUnityPlugin)this).Config.Bind<bool>("Miss", "ComboOnly", false, "On miss, wipe combo/streak to 1.");
SmallerTargets = ((BaseUnityPlugin)this).Config.Bind<bool>("Aim", "SmallerTargets", false, "Scale spawned targets.");
TargetScale = ((BaseUnityPlugin)this).Config.Bind<float>("Aim", "TargetScale", 0.7f, new ConfigDescription("Target scale when SmallerTargets is on.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.3f, 1f), Array.Empty<object>()));
ExtraMaxTargets = ((BaseUnityPlugin)this).Config.Bind<int>("Aim", "ExtraMaxTargets", 0, new ConfigDescription("Extra max active targets.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 12), Array.Empty<object>()));
ShorterRounds = ((BaseUnityPlugin)this).Config.Bind<bool>("Aim", "ShorterRounds", false, "Multiply round duration.");
RoundTimeMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Aim", "RoundTimeMultiplier", 0.85f, new ConfigDescription("Round timer factor.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.4f, 1f), Array.Empty<object>()));
SlowerComboGrowth = ((BaseUnityPlugin)this).Config.Bind<bool>("Score", "SlowerComboGrowth", false, "Slower streak growth.");
StreakGrowthFactor = ((BaseUnityPlugin)this).Config.Bind<float>("Score", "StreakGrowthFactor", 0.5f, new ConfigDescription("Streak growth factor.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 1f), Array.Empty<object>()));
HarderScoreTargets = ((BaseUnityPlugin)this).Config.Bind<bool>("Score", "HarderScoreTargets", false, "Multiply score targets.");
ScoreTargetMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Score", "ScoreTargetMultiplier", 1.25f, new ConfigDescription("Score requirement factor.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 3f), Array.Empty<object>()));
}
private static void RegisterOpenShotMenu()
{
ModMenu.Tab("Skillshot").Toggle(Enabled).Bool("Verbose Log", VerboseLogging)
.Info("— Shop —")
.Bool("Weaker Shop", WeakerShopItems)
.Slider("Cost Mult", ShopCostMultiplier, 0.05f, "F2")
.Bool("Common Bias", CommonBias)
.Slider("Bias Strength", CommonBiasStrength, 0.05f, "F2")
.Bool("Ban Rare", BanRareHolos)
.Bool("Ban Legendary", BanLegendaryHolos)
.Bool("Ban Mythical", BanMythicalHolos)
.Info("— Miss / Combo —")
.Bool("No Miss", NoMiss)
.Bool("No Forgiveness", NoMissForgiveness)
.Bool("Combo Only", ComboOnly)
.Info("— Aim —")
.Bool("Smaller Targets", SmallerTargets)
.Slider("Target Scale", TargetScale, 0.05f, "F2")
.Int("Extra Targets", ExtraMaxTargets, 1)
.Bool("Shorter Rounds", ShorterRounds)
.Slider("Round Time", RoundTimeMultiplier, 0.05f, "F2")
.Info("— Score —")
.Bool("Slow Combo", SlowerComboGrowth)
.Slider("Streak Factor", StreakGrowthFactor, 0.05f, "F2")
.Bool("Harder Scores", HarderScoreTargets)
.Slider("Score Mult", ScoreTargetMultiplier, 0.05f, "F2")
.Info("— Presets —")
.Button("Soft Preset", (Action)ApplySoftPreset)
.Button("Hard Preset", (Action)ApplyHardPreset);
}
private static void ApplySoftPreset()
{
WeakerShopItems.Value = true;
ShopCostMultiplier.Value = 1.25f;
CommonBias.Value = true;
CommonBiasStrength.Value = 0.75f;
BanRareHolos.Value = false;
BanLegendaryHolos.Value = false;
BanMythicalHolos.Value = true;
NoMiss.Value = false;
ComboOnly.Value = false;
SmallerTargets.Value = false;
ExtraMaxTargets.Value = 0;
ShorterRounds.Value = false;
SlowerComboGrowth.Value = false;
HarderScoreTargets.Value = false;
LogRule("Applied Soft Preset");
}
private static void ApplyHardPreset()
{
WeakerShopItems.Value = true;
ShopCostMultiplier.Value = 2.25f;
CommonBias.Value = true;
CommonBiasStrength.Value = 1.5f;
BanRareHolos.Value = true;
BanLegendaryHolos.Value = true;
BanMythicalHolos.Value = true;
NoMiss.Value = true;
NoMissForgiveness.Value = true;
ComboOnly.Value = true;
SmallerTargets.Value = true;
TargetScale.Value = 0.55f;
ExtraMaxTargets.Value = 3;
ShorterRounds.Value = true;
RoundTimeMultiplier.Value = 0.7f;
SlowerComboGrowth.Value = true;
StreakGrowthFactor.Value = 0.35f;
HarderScoreTargets.Value = true;
ScoreTargetMultiplier.Value = 1.5f;
LogRule("Applied Hard Preset");
}
public static void LogRule(string message)
{
if (VerboseLogging != null && VerboseLogging.Value)
{
ManualLogSource log = Log;
if (log != null)
{
log.LogInfo((object)("[Skillshot] " + message));
}
}
}
public static HashSet<string> GetBannedHoloIds()
{
SkillshotPlugin instance = Instance;
if ((Object)(object)instance == (Object)null)
{
return new HashSet<string>(StringComparer.OrdinalIgnoreCase);
}
string text = BannedHoloIds?.Value ?? string.Empty;
if (instance._bannedHoloCache != null && instance._bannedHoloCacheSource == text)
{
return instance._bannedHoloCache;
}
HashSet<string> hashSet = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
string[] array = text.Split(new char[3] { ',', ';', ' ' }, StringSplitOptions.RemoveEmptyEntries);
for (int i = 0; i < array.Length; i++)
{
string text2 = array[i].Trim();
if (text2.Length > 0)
{
hashSet.Add(text2);
}
}
instance._bannedHoloCache = hashSet;
instance._bannedHoloCacheSource = text;
return hashSet;
}
private static void HandleTargetSpawned(Target target)
{
//IL_002d: 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_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: 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_006e: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
if (Active && SmallerTargets.Value && !((Object)(object)target == (Object)null))
{
Vector3 val = Traverse.Create((object)target).Field("_originalScale").GetValue<Vector3>();
if (val == Vector3.zero)
{
val = ((Component)target).transform.localScale;
}
float num = Mathf.Clamp(TargetScale.Value, 0.3f, 1f);
((Component)target).transform.localScale = val * num;
LogRule($"Scaled target x{num:F2}");
}
}
private static void HandleTargetSpawnerStarted(object spawnerObj)
{
if (Active && spawnerObj != null)
{
Traverse val = Traverse.Create(spawnerObj);
if (ExtraMaxTargets.Value > 0)
{
int value = val.Field("baseMaxActiveTargets").GetValue<int>();
val.Field("baseMaxActiveTargets").SetValue((object)Mathf.Max(1, value + ExtraMaxTargets.Value));
}
if (ShorterRounds.Value)
{
float value2 = val.Field("roundDurationSeconds").GetValue<float>();
float num = Mathf.Clamp(RoundTimeMultiplier.Value, 0.4f, 1f);
val.Field("roundDurationSeconds").SetValue((object)Mathf.Max(5f, value2 * num));
}
}
}
}
}
namespace SkillshotMod.Patches
{
internal static class MissChallengePatches
{
[HarmonyPatch(typeof(GameManager), "HandleShotMissed")]
private static class GameManager_HandleShotMissed_Patch
{
private static void Prefix(ShotMissedContext ctx)
{
if (SkillshotPlugin.Active && ctx != null && SkillshotPlugin.NoMissForgiveness.Value)
{
ctx.WasForgiven = false;
ctx.PreventStreakBreak = false;
}
}
private static void Postfix(GameManager __instance, ShotMissedContext ctx)
{
if (SkillshotPlugin.Active && !((Object)(object)__instance == (Object)null) && ctx != null && (!ctx.WasForgiven || SkillshotPlugin.NoMissForgiveness.Value) && SkillshotPlugin.NoMiss.Value && __instance.IsRoundActive)
{
__instance.OnMissEndsRound();
ManualLogSource log = SkillshotPlugin.Log;
if (log != null)
{
log.LogInfo((object)"[Skillshot] NoMiss: round ended on miss.");
}
}
}
}
[HarmonyPatch(typeof(ScoreManager), "OnShotMiss")]
private static class ScoreManager_OnShotMiss_Patch
{
private static void Postfix(ScoreManager __instance)
{
if (SkillshotPlugin.Active && SkillshotPlugin.ComboOnly.Value && !((Object)(object)__instance == (Object)null))
{
__instance.ResetComboState();
}
}
}
[HarmonyPatch(typeof(ScoreManager), "OnShotMissResetMultiplier")]
private static class ScoreManager_OnShotMissResetMultiplier_Patch
{
private static void Postfix(ScoreManager __instance)
{
if (SkillshotPlugin.Active && SkillshotPlugin.ComboOnly.Value && !((Object)(object)__instance == (Object)null))
{
__instance.ResetComboState();
}
}
}
}
internal static class ScoreChallengePatches
{
[HarmonyPatch(typeof(ScoreManager), "ResetForNewRun", new Type[] { typeof(int) })]
private static class ResetForNewRun_Int_Patch
{
private static void Postfix(ScoreManager __instance)
{
if (SkillshotPlugin.Active)
{
ApplyGrowthNerf(__instance);
}
}
}
[HarmonyPatch(typeof(ScoreManager), "ResetForNewRun", new Type[] { })]
private static class ResetForNewRun_Void_Patch
{
private static void Postfix(ScoreManager __instance)
{
if (SkillshotPlugin.Active)
{
ApplyGrowthNerf(__instance);
}
}
}
[HarmonyPatch(typeof(ScoreManager), "ResetRoundScore")]
private static class ResetRoundScore_Patch
{
private static void Postfix(ScoreManager __instance)
{
if (SkillshotPlugin.Active)
{
ApplyGrowthNerf(__instance);
}
}
}
[HarmonyPatch(typeof(ScoreManager), "ComputeTargetScoreScientific")]
private static class ComputeTargetScoreScientific_Patch
{
private static void Postfix(ref BigScore __result)
{
//IL_003b: 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)
if (SkillshotPlugin.Active && SkillshotPlugin.HarderScoreTargets.Value)
{
float num = Mathf.Max(1f, SkillshotPlugin.ScoreTargetMultiplier.Value);
if (!Mathf.Approximately(num, 1f))
{
__result = ((BigScore)(ref __result)).Multiply((double)num);
}
}
}
}
[HarmonyPatch(typeof(ScoreManager), "GetBaseTargetScoreForRoundIndex")]
private static class GetBaseTargetScoreForRoundIndex_Patch
{
private static void Postfix(ref double __result)
{
if (SkillshotPlugin.Active && SkillshotPlugin.HarderScoreTargets.Value)
{
float num = Mathf.Max(1f, SkillshotPlugin.ScoreTargetMultiplier.Value);
__result *= num;
}
}
}
private static void ApplyGrowthNerf(ScoreManager sm)
{
if ((Object)(object)sm == (Object)null || !SkillshotPlugin.SlowerComboGrowth.Value)
{
return;
}
float num = Mathf.Clamp(SkillshotPlugin.StreakGrowthFactor.Value, 0.1f, 1f);
if (!Mathf.Approximately(num, 1f))
{
Traverse val = Traverse.Create((object)sm);
float value = val.Field("_initialMultiplierGrowthPerHit").GetValue<float>();
if (value > 0f)
{
val.Field("baseStreakGrowthPerHit").SetValue((object)(value * num));
}
else
{
float value2 = val.Field("baseStreakGrowthPerHit").GetValue<float>();
val.Field("baseStreakGrowthPerHit").SetValue((object)(value2 * num));
}
float value3 = val.Field("_initialComboMultGrowthMultiplier").GetValue<float>();
if (value3 > 0f)
{
val.Field("streakGrowthMultiplier").SetValue((object)Mathf.Max(0.01f, value3 * num));
return;
}
float value4 = val.Field("streakGrowthMultiplier").GetValue<float>();
val.Field("streakGrowthMultiplier").SetValue((object)Mathf.Max(0.01f, value4 * num));
}
}
}
internal static class ShopChallengePatches
{
[HarmonyPatch]
private static class IsCatalogItemEligible_Patch
{
private static MethodBase TargetMethod()
{
return AccessTools.Method(typeof(ShopManager), "IsCatalogItemEligibleForCurrentDifficulty", (Type[])null, (Type[])null);
}
private static void Postfix(ShopItem item, ref bool __result)
{
if (SkillshotPlugin.Active && __result && item != null && IsHoloBanned(item))
{
__result = false;
}
}
}
[HarmonyPatch]
private static class GetCatalogItemSelectionWeight_Patch
{
private static MethodBase TargetMethod()
{
return AccessTools.Method(typeof(ShopManager), "GetCatalogItemSelectionWeight", (Type[])null, (Type[])null);
}
private static void Postfix(ShopItem item, ref float __result)
{
//IL_004c: 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_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Expected I4, but got Unknown
if (!SkillshotPlugin.Active || item == null || __result <= 0f)
{
return;
}
if (IsHoloBanned(item))
{
__result = 0f;
}
else if (SkillshotPlugin.CommonBias.Value)
{
float num = Mathf.Clamp(SkillshotPlugin.CommonBiasStrength.Value, 0.25f, 2f);
ItemRarity rarity = item.rarity;
switch (rarity - 2)
{
case 0:
__result *= Mathf.Pow(0.55f, num);
break;
case 1:
__result *= Mathf.Pow(0.3f, num);
break;
case 2:
__result *= Mathf.Pow(0.15f, num);
break;
}
}
}
}
[HarmonyPatch]
private static class ApplyPriceRampToItem_Patch
{
private static MethodBase TargetMethod()
{
return AccessTools.Method(typeof(ShopManager), "ApplyPriceRampToItem", (Type[])null, (Type[])null);
}
private static void Postfix(ShopItem item)
{
if (SkillshotPlugin.Active)
{
InflatePrice(item);
}
}
}
[HarmonyPatch]
private static class CloneShopItem_Patch
{
private static MethodBase TargetMethod()
{
return AccessTools.Method(typeof(ShopManager), "CloneShopItem", (Type[])null, (Type[])null);
}
private static void Postfix(ref ShopItem __result)
{
if (SkillshotPlugin.Active && __result != null)
{
if (IsHoloBanned(__result))
{
__result.cost = 99999f;
}
else
{
InflatePrice(__result);
}
}
}
}
[HarmonyPatch(typeof(ShopManager), "GetHoloBuyPrice")]
private static class GetHoloBuyPrice_Patch
{
private static void Postfix(ref int __result)
{
if (SkillshotPlugin.Active && SkillshotPlugin.WeakerShopItems.Value)
{
float num = Mathf.Max(1f, SkillshotPlugin.ShopCostMultiplier.Value);
__result = Mathf.Max(1, Mathf.RoundToInt((float)__result * num));
}
}
}
private static bool TryGetHoloCatalogId(ShopItem item, out string catalogId)
{
catalogId = null;
if (item == null || (Object)(object)item.sourceAsset == (Object)null)
{
return false;
}
ScriptableObject sourceAsset = item.sourceAsset;
HoloItemData val = (HoloItemData)(object)((sourceAsset is HoloItemData) ? sourceAsset : null);
if (val != null && !string.IsNullOrEmpty(val.catalogId))
{
catalogId = val.catalogId;
return true;
}
return false;
}
private static bool IsHoloBanned(ShopItem item)
{
//IL_0004: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
if (item == null || (int)item.type != 0)
{
return false;
}
if (BanByRarity(item.rarity))
{
return true;
}
if (TryGetHoloCatalogId(item, out var catalogId) && SkillshotPlugin.GetBannedHoloIds().Contains(catalogId))
{
return true;
}
return false;
}
private static bool BanByRarity(ItemRarity rarity)
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: Invalid comparison between Unknown and I4
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Invalid comparison between Unknown and I4
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Invalid comparison between Unknown and I4
if (SkillshotPlugin.BanMythicalHolos.Value && (int)rarity == 4)
{
return true;
}
if (SkillshotPlugin.BanLegendaryHolos.Value && (int)rarity == 3)
{
return true;
}
if (SkillshotPlugin.BanRareHolos.Value && (int)rarity == 2)
{
return true;
}
return false;
}
private static void InflatePrice(ShopItem item)
{
if (item == null || !SkillshotPlugin.WeakerShopItems.Value)
{
return;
}
float num = Mathf.Max(1f, SkillshotPlugin.ShopCostMultiplier.Value);
if (!Mathf.Approximately(num, 1f))
{
item.cost = Mathf.Max(1f, item.cost * num);
if (item.chargedAmount > 0)
{
item.chargedAmount = Mathf.Max(1, Mathf.RoundToInt((float)item.chargedAmount * num));
}
}
}
}
}