Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of Das Sombras v0.2.0
plugins/ShadowSet.dll
Decompiled a week agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using Jotunn.Configs; using Jotunn.Entities; using Jotunn.Managers; using Jotunn.Utils; using Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyMetadata("AI_Assisted_Creation", "This assembly was created with the assistance of Generative AI (code generation).")] [assembly: AssemblyMetadata("AI_Model_Vendor", "Anthropic (Claude)")] [assembly: AssemblyVersion("0.0.0.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 ShadowSet { [BepInPlugin("pandherya.shadowset", "Das Sombras (Pandherya)", "0.2.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [NetworkCompatibility(/*Could not decode attribute arguments.*/)] [SynchronizationMode(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { private struct Piece { public string Id; public string Base; public string Name; public string Desc; } public const string GUID = "pandherya.shadowset"; public const string SetName = "pandherya_das_sombras"; internal static ConfigEntry<float> DamageBonus; internal static ConfigEntry<float> SkillLevel; internal static ConfigEntry<string> RedColor; internal static ManualLogSource Log; private static volatile bool _reload; private float _reloadAt; internal static SE_Sombras Se; private static readonly Piece[] Pieces = new Piece[3] { new Piece { Id = "HelmetShadowPandherya", Base = "HelmetAshlandsMediumHood", Name = "Elmo das Sombras", Desc = "Floki jura que foi costurado na sombra de uma cabra que viu Loki pelado. Esconde a sua cara, o que já é um favor enorme aos deuses. Os furinhos vermelhos são para respirar. Ou para os demônios espiarem. Floki não lembra." }, new Piece { Id = "ArmorShadowChestPandherya", Base = "ArmorAshlandsMediumChest", Name = "Peitoral das Sombras", Desc = "Preto como a alma de um cobrador de impostos, com manchas vermelhas que são tinta. Provavelmente. Floki diz que é \"estilo\". Floki também já tentou se casar com uma árvore, então avalie você." }, new Piece { Id = "ArmorShadowLegsPandherya", Base = "ArmorAshlandsMediumlegs", Name = "Calças das Sombras", Desc = "Correm mais rápido que você, pulam mais alto que você e, segundo Floki, pensam melhor que você. Ideais para fugir de trolls com dignidade. Bom, com alguma dignidade. Pouca. Mas com estilo." } }; internal static ConfigurationManagerAttributes Admin() { //IL_0000: 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) //IL_000d: Expected O, but got Unknown return new ConfigurationManagerAttributes { IsAdminOnly = true }; } private void Awake() { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Expected O, but got Unknown //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Expected O, but got Unknown //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; DamageBonus = ((BaseUnityPlugin)this).Config.Bind<float>("Set", "BonusDanoAdagas", 300f, new ConfigDescription("Dano extra com adagas, em % (300 = 4x o dano).", (AcceptableValueBase)null, new object[1] { Admin() })); SkillLevel = ((BaseUnityPlugin)this).Config.Bind<float>("Set", "NivelHabilidades", 100f, new ConfigDescription("Nível mínimo de Adagas, Pulo e Corrida com o set completo.", (AcceptableValueBase)null, new object[1] { Admin() })); RedColor = ((BaseUnityPlugin)this).Config.Bind<string>("Visual", "CorDetalhes", "B3141A", new ConfigDescription("Cor dos detalhes em hexadecimal (RRGGBB). Só muda ao reiniciar o jogo.", (AcceptableValueBase)null, new object[1] { Admin() })); DamageBonus.SettingChanged += delegate { ApplyStats(); }; SkillLevel.SettingChanged += delegate { ApplyStats(); }; try { FileSystemWatcher fileSystemWatcher = new FileSystemWatcher(Paths.ConfigPath, "pandherya.shadowset.cfg"); fileSystemWatcher.NotifyFilter = NotifyFilters.FileName | NotifyFilters.Size | NotifyFilters.LastWrite; fileSystemWatcher.Changed += delegate { _reload = true; }; fileSystemWatcher.Created += delegate { _reload = true; }; fileSystemWatcher.Renamed += delegate { _reload = true; }; fileSystemWatcher.EnableRaisingEvents = true; } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("Sem recarga automática do cfg: " + ex.Message)); } PrefabManager.OnVanillaPrefabsAvailable += AddContent; } private void Update() { if (_reload) { _reload = false; _reloadAt = Time.time + 0.3f; } if (_reloadAt > 0f && Time.time >= _reloadAt) { _reloadAt = 0f; try { ((BaseUnityPlugin)this).Config.Reload(); ApplyStats(); Log.LogInfo((object)"Config recarregada."); } catch (Exception ex) { Log.LogWarning((object)("Falha ao recarregar cfg: " + ex.Message)); } } } internal static void ApplyStats() { if (!((Object)(object)Se == (Object)null)) { ((SE_Stats)Se).m_damageModifier = 1f + DamageBonus.Value / 100f; ((StatusEffect)Se).m_tooltip = "Adagas, Pulo e Corrida no nível " + SkillLevel.Value.ToString("0") + ". Adagas causam +" + DamageBonus.Value.ToString("0") + "% de dano.\nOs deuses chamam isso de trapaça. Floki chama de terça-feira."; } } private void AddContent() { //IL_00c8: 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_00e9: Expected O, but got Unknown //IL_00ea: 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_011f: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Expected O, but got Unknown //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Expected O, but got Unknown //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Expected O, but got Unknown //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Expected O, but got Unknown //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Expected O, but got Unknown PrefabManager.OnVanillaPrefabsAvailable -= AddContent; try { Color red = default(Color); if (!ColorUtility.TryParseHtmlString("#" + RedColor.Value.TrimStart('#'), ref red)) { ((Color)(ref red))..ctor(0.7f, 0.08f, 0.1f); } SE_Sombras sE_Sombras = ScriptableObject.CreateInstance<SE_Sombras>(); ((Object)sE_Sombras).name = "SE_DasSombras"; ((StatusEffect)sE_Sombras).m_name = "Das Sombras"; ((StatusEffect)sE_Sombras).m_tooltip = "Adagas, Pulo e Corrida no nível " + SkillLevel.Value.ToString("0") + ". Adagas causam +" + DamageBonus.Value.ToString("0") + "% de dano.\nOs deuses chamam isso de trapaça. Floki chama de terça-feira."; ((SE_Stats)sE_Sombras).m_modifyAttackSkill = (SkillType)2; Se = sE_Sombras; ApplyStats(); ItemManager.Instance.AddStatusEffect(new CustomStatusEffect((StatusEffect)(object)sE_Sombras, false)); Recolor recolor = new Recolor(red); Sprite val = null; Piece[] pieces = Pieces; for (int i = 0; i < pieces.Length; i++) { Piece piece = pieces[i]; ItemConfig val2 = new ItemConfig { Name = piece.Name, Description = piece.Desc, CraftingStation = "blackforge", MinStationLevel = 1 }; val2.AddRequirement(new RequirementConfig(piece.Base, 1, 0, false)); val2.AddRequirement(new RequirementConfig("SurtlingCore", 2, 1, true)); val2.AddRequirement(new RequirementConfig("Coal", 10, 5, true)); CustomItem val3 = new CustomItem(piece.Id, piece.Base, val2); SharedData shared = val3.ItemDrop.m_itemData.m_shared; shared.m_setName = "pandherya_das_sombras"; shared.m_setSize = 3; shared.m_setStatusEffect = (StatusEffect)(object)sE_Sombras; if ((Object)(object)shared.m_armorMaterial != (Object)null) { shared.m_armorMaterial = recolor.Material(shared.m_armorMaterial); } Renderer[] componentsInChildren = val3.ItemPrefab.GetComponentsInChildren<Renderer>(true); foreach (Renderer val4 in componentsInChildren) { if (val4 is ParticleSystemRenderer) { continue; } Material[] sharedMaterials = val4.sharedMaterials; for (int k = 0; k < sharedMaterials.Length; k++) { if ((Object)(object)sharedMaterials[k] != (Object)null) { sharedMaterials[k] = recolor.Material(sharedMaterials[k]); } } val4.sharedMaterials = sharedMaterials; } if (shared.m_icons != null) { for (int l = 0; l < shared.m_icons.Length; l++) { shared.m_icons[l] = recolor.Sprite(shared.m_icons[l]); } } if ((Object)(object)val == (Object)null && shared.m_icons != null && shared.m_icons.Length != 0) { val = shared.m_icons[0]; } ItemManager.Instance.AddItem(val3); } ((StatusEffect)sE_Sombras).m_icon = val; Log.LogInfo((object)"Set Das Sombras registrado."); } catch (Exception ex) { Log.LogError((object)("Falha ao criar o set Das Sombras: " + ex)); } } } public class SE_Sombras : SE_Stats { public override void ModifySkillLevel(SkillType skill, ref float level) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Invalid comparison between Unknown and I4 //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Invalid comparison between Unknown and I4 //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Invalid comparison between Unknown and I4 ((SE_Stats)this).ModifySkillLevel(skill, ref level); if ((int)skill == 2 || (int)skill == 100 || (int)skill == 102) { level = Mathf.Max(level, Plugin.SkillLevel.Value); } } } internal class Recolor { private readonly Color _red; private readonly Dictionary<Texture, Texture2D> _tex = new Dictionary<Texture, Texture2D>(); private readonly Dictionary<Material, Material> _mat = new Dictionary<Material, Material>(); public Recolor(Color red) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) _red = red; } public Material Material(Material src) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown //IL_00c8: Unknown result type (might be due to invalid IL or missing references) if (_mat.TryGetValue(src, out var value)) { return value; } Material val = new Material(src); string[] texturePropertyNames = val.GetTexturePropertyNames(); foreach (string text in texturePropertyNames) { string text2 = text.ToLowerInvariant(); if (text2.Contains("tex") && !text2.Contains("bump") && !text2.Contains("normal") && !text2.Contains("metal") && !text2.Contains("emission") && !text2.Contains("mask")) { Texture texture = val.GetTexture(text); if ((Object)(object)texture != (Object)null) { val.SetTexture(text, Texture(texture)); } } } if (val.HasProperty("_Color")) { val.color = Color.white; } _mat[src] = val; return val; } public Sprite Sprite(Sprite s) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)s == (Object)null) { return null; } Texture2D val = Readable((Texture)(object)s.texture); Rect textureRect = s.textureRect; Texture2D val2 = new Texture2D((int)((Rect)(ref textureRect)).width, (int)((Rect)(ref textureRect)).height, (TextureFormat)4, false); val2.SetPixels(val.GetPixels((int)((Rect)(ref textureRect)).x, (int)((Rect)(ref textureRect)).y, (int)((Rect)(ref textureRect)).width, (int)((Rect)(ref textureRect)).height)); Paint(val2); Object.Destroy((Object)(object)val); return Sprite.Create(val2, new Rect(0f, 0f, (float)((Texture)val2).width, (float)((Texture)val2).height), new Vector2(0.5f, 0.5f), s.pixelsPerUnit); } private Texture Texture(Texture src) { if (_tex.TryGetValue(src, out var value)) { return (Texture)(object)value; } Texture2D val = Readable(src); Paint(val); ((Object)val).name = ((Object)src).name + "_sombras"; _tex[src] = val; return (Texture)(object)val; } private static Texture2D Readable(Texture src) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: 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_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Expected O, but got Unknown RenderTexture temporary = RenderTexture.GetTemporary(src.width, src.height, 0, (RenderTextureFormat)0, (RenderTextureReadWrite)2); RenderTexture active = RenderTexture.active; Graphics.Blit(src, temporary); RenderTexture.active = temporary; Texture2D val = new Texture2D(src.width, src.height, (TextureFormat)4, true); val.ReadPixels(new Rect(0f, 0f, (float)src.width, (float)src.height), 0, 0); val.Apply(); RenderTexture.active = active; RenderTexture.ReleaseTemporary(temporary); return val; } private void Paint(Texture2D t) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002f: 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_0079: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) Color[] pixels = t.GetPixels(); for (int i = 0; i < pixels.Length; i++) { Color val = pixels[i]; float num = val.r * 0.3f + val.g * 0.59f + val.b * 0.11f; Color val2 = new Color(num * 0.16f, num * 0.15f, num * 0.17f); float num2 = Mathf.SmoothStep(0f, 1f, Mathf.InverseLerp(0.45f, 0.75f, num)); Color val3 = _red * (0.55f + num * 0.8f); Color val4 = Color.Lerp(val2, val3, num2); val4.a = val.a; pixels[i] = val4; } t.SetPixels(pixels); t.Apply(true); } } }