using System;
using System.Collections.Generic;
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 BetterArmory.Artifact;
using BetterArmory.Components;
using BetterArmory.Equipment;
using BetterArmory.Items;
using BetterArmory.Items.Tier3;
using BetterArmory.Utils;
using BetterArmory.Utils.Components;
using On.RoR2;
using R2API;
using R2API.Utils;
using RoR2;
using UnityEngine;
using UnityEngine.Rendering;
[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 = ".NET Standard 2.1")]
[assembly: AssemblyCompany("BetterArmory")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+4e6dbad2345be0b09d29a1ef899769a47b774b1a")]
[assembly: AssemblyProduct("BetterArmory")]
[assembly: AssemblyTitle("BetterArmory")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace BetterArmory
{
[BepInPlugin("com.Tios.BetterArmory", "Better Armory", "0.5.0")]
[BepInDependency("com.bepis.r2api", "5.0.10")]
[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
public class Main : BaseUnityPlugin
{
public const string ModGuid = "com.Tios.BetterArmory";
public const string ModName = "Better Armory";
public const string ModVer = "0.5.0";
public static AssetBundle MainAssets;
public List<ArtifactBase> Artifacts = new List<ArtifactBase>();
public List<ItemBase> Items = new List<ItemBase>();
public List<EquipmentBase> Equipments = new List<EquipmentBase>();
private void Awake()
{
using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("BetterArmory.betterarmoryassets"))
{
MainAssets = AssetBundle.LoadFromStream(stream);
}
IEnumerable<Type> enumerable = from type in Assembly.GetExecutingAssembly().GetTypes()
where !type.IsAbstract && type.IsSubclassOf(typeof(ArtifactBase))
select type;
((BaseUnityPlugin)this).Logger.LogInfo((object)"ARTIFACT creation phase :");
foreach (Type item in enumerable)
{
ArtifactBase artifactBase = (ArtifactBase)Activator.CreateInstance(item);
if (ValidateArtifact(artifactBase, Artifacts))
{
artifactBase.Init(((BaseUnityPlugin)this).Config);
((BaseUnityPlugin)this).Logger.LogInfo((object)(artifactBase.ArtifactLangTokenName + " was created !"));
}
}
IEnumerable<Type> enumerable2 = from type in Assembly.GetExecutingAssembly().GetTypes()
where !type.IsAbstract && type.IsSubclassOf(typeof(ItemBase))
select type;
((BaseUnityPlugin)this).Logger.LogInfo((object)"ITEM creation phase :");
foreach (Type item2 in enumerable2)
{
ItemBase itemBase = (ItemBase)Activator.CreateInstance(item2);
if (ValidateItem(itemBase, Items))
{
itemBase.Init(((BaseUnityPlugin)this).Config);
((BaseUnityPlugin)this).Logger.LogInfo((object)(itemBase.ItemLangTokenName + " was created !"));
}
}
IEnumerable<Type> enumerable3 = from type in Assembly.GetExecutingAssembly().GetTypes()
where !type.IsAbstract && type.IsSubclassOf(typeof(EquipmentBase))
select type;
((BaseUnityPlugin)this).Logger.LogInfo((object)"EQUIPMENT creation phase :");
foreach (Type item3 in enumerable3)
{
EquipmentBase equipmentBase = (EquipmentBase)Activator.CreateInstance(item3);
if (ValidateEquipment(equipmentBase, Equipments))
{
equipmentBase.Init(((BaseUnityPlugin)this).Config);
((BaseUnityPlugin)this).Logger.LogInfo((object)(equipmentBase.EquipmentLangTokenName + " was created !"));
}
}
}
public bool ValidateArtifact(ArtifactBase artifact, List<ArtifactBase> artifactList)
{
bool value = ((BaseUnityPlugin)this).Config.Bind<bool>("Artifact: " + artifact.ArtifactLangTokenName, "Enable Artifact?", true, "Should this artifact appear for selection?").Value;
if (value)
{
artifactList.Add(artifact);
}
return value;
}
public bool ValidateItem(ItemBase item, List<ItemBase> itemList)
{
bool value = ((BaseUnityPlugin)this).Config.Bind<bool>("Item: " + item.ItemLangTokenName, "Enable Item?", true, "Should this item appear in runs?").Value;
bool value2 = ((BaseUnityPlugin)this).Config.Bind<bool>("Item: " + item.ItemLangTokenName, "Blacklist Item from AI Use?", false, "Should the AI not be able to obtain this item?").Value;
if (value)
{
itemList.Add(item);
if (value2)
{
item.AIBlacklisted = true;
}
}
return value;
}
public bool ValidateEquipment(EquipmentBase equipment, List<EquipmentBase> equipmentList)
{
if (((BaseUnityPlugin)this).Config.Bind<bool>("Equipment: " + equipment.EquipmentLangTokenName, "Enable Equipment?", true, "Should this equipment appear in runs?").Value)
{
equipmentList.Add(equipment);
return true;
}
return false;
}
}
}
namespace BetterArmory.Utils
{
internal class ItemHelpers
{
public static RendererInfo[] ItemDisplaySetup(GameObject obj, bool debugmode = false)
{
//IL_0085: Unknown result type (might be due to invalid IL or missing references)
//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
//IL_00de: Unknown result type (might be due to invalid IL or missing references)
List<Renderer> list = new List<Renderer>();
MeshRenderer[] componentsInChildren = obj.GetComponentsInChildren<MeshRenderer>();
if (componentsInChildren.Length != 0)
{
list.AddRange((IEnumerable<Renderer>)(object)componentsInChildren);
}
SkinnedMeshRenderer[] componentsInChildren2 = obj.GetComponentsInChildren<SkinnedMeshRenderer>();
if (componentsInChildren2.Length != 0)
{
list.AddRange((IEnumerable<Renderer>)(object)componentsInChildren2);
}
RendererInfo[] array = (RendererInfo[])(object)new RendererInfo[list.Count];
for (int i = 0; i < list.Count; i++)
{
if (debugmode)
{
MaterialControllerComponents.HGControllerFinder hGControllerFinder = ((Component)list[i]).gameObject.AddComponent<MaterialControllerComponents.HGControllerFinder>();
hGControllerFinder.Renderer = list[i];
}
array[i] = new RendererInfo
{
defaultMaterial = ((list[i] is SkinnedMeshRenderer) ? list[i].sharedMaterial : list[i].material),
renderer = list[i],
defaultShadowCastingMode = (ShadowCastingMode)1,
ignoreOverlays = false
};
}
return array;
}
public static void RefreshTimedBuffs(CharacterBody body, BuffDef buffDef, float duration)
{
if (Object.op_Implicit((Object)(object)body) && body.GetBuffCount(buffDef) > 0)
{
}
}
public static void RefreshTimedBuffs(CharacterBody body, BuffDef buffDef, float taperStart, float taperDuration)
{
if (Object.op_Implicit((Object)(object)body) && body.GetBuffCount(buffDef) > 0)
{
}
}
}
internal static class Buffs
{
internal static BuffDef AddNewBuff(string buffName, Sprite buffIcon, Color buffColor, bool canStack = false, bool isDebuff = false, bool isHidden = false, EliteDef elideDef = null)
{
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
BuffDef val = ScriptableObject.CreateInstance<BuffDef>();
((Object)val).name = "BUFF_" + buffName;
val.buffColor = buffColor;
val.canStack = canStack;
val.isDebuff = isDebuff;
val.eliteDef = elideDef;
val.iconSprite = buffIcon;
val.isHidden = isHidden;
ContentAddition.AddBuffDef(val);
return val;
}
}
internal static class ConfigCreator
{
internal static ConfigEntry<int> IntEntry(ConfigFile config, string itemName, string key, int value, string desc)
{
return config.Bind<int>(itemName, key, value, desc);
}
internal static ConfigEntry<float> FloatEntry(ConfigFile config, string itemName, string key, float value, string desc)
{
return config.Bind<float>(itemName, key, value, desc);
}
internal static ConfigEntry<string> StringEntry(ConfigFile config, string itemName, string key, string value, string desc)
{
return config.Bind<string>(itemName, key, value, desc);
}
internal static ConfigEntry<bool> BoolEntry(ConfigFile config, string itemName, string key, bool value, string desc)
{
return config.Bind<bool>(itemName, key, value, desc);
}
}
public static class LotOfExtensions
{
public static T NextEnum<T>(this Random rand) where T : Enum
{
return (T)Enum.GetValues(typeof(T)).GetValue(rand.Next(Enum.GetValues(typeof(T)).Length));
}
public static T RandomEnum<T>(this T en) where T : struct, Enum
{
if (!typeof(T).IsEnum)
{
throw new Exception("random enum variable is not an enum");
}
Random random = new Random();
Array values = Enum.GetValues(typeof(T));
return (T)values.GetValue(random.Next(values.Length));
}
}
internal class MathForIt
{
public static float RoundFloat(float value, int digits)
{
float num = Mathf.Pow(10f, (float)digits);
return Mathf.Round(value * num) / num;
}
}
}
namespace BetterArmory.Utils.Components
{
public class MaterialControllerComponents
{
public class HGControllerFinder : MonoBehaviour
{
public Renderer Renderer;
public Material Material;
public void Start()
{
if (Object.op_Implicit((Object)(object)Renderer))
{
Renderer renderer = Renderer;
MeshRenderer val = (MeshRenderer)(object)((renderer is MeshRenderer) ? renderer : null);
if (val != null)
{
Material = ((Renderer)val).material;
}
Renderer renderer2 = Renderer;
SkinnedMeshRenderer val2 = (SkinnedMeshRenderer)(object)((renderer2 is SkinnedMeshRenderer) ? renderer2 : null);
if (val2 != null)
{
Material = ((Renderer)val2).sharedMaterials[0];
}
if (Object.op_Implicit((Object)(object)Material))
{
switch (((Object)Material.shader).name)
{
case "Hopoo Games/Deferred/Standard":
{
HGStandardController hGStandardController = ((Component)this).gameObject.AddComponent<HGStandardController>();
hGStandardController.Material = Material;
hGStandardController.Renderer = Renderer;
break;
}
case "Hopoo Games/FX/Cloud Remap":
{
HGCloudRemapController hGCloudRemapController = ((Component)this).gameObject.AddComponent<HGCloudRemapController>();
hGCloudRemapController.Material = Material;
hGCloudRemapController.Renderer = Renderer;
break;
}
case "Hopoo Games/FX/Cloud Intersection Remap":
{
HGIntersectionController hGIntersectionController = ((Component)this).gameObject.AddComponent<HGIntersectionController>();
hGIntersectionController.Material = Material;
hGIntersectionController.Renderer = Renderer;
break;
}
}
}
}
Object.Destroy((Object)(object)this);
}
}
public class HGStandardController : MonoBehaviour
{
public enum _RampInfoEnum
{
TwoTone = 0,
SmoothedTwoTone = 1,
Unlitish = 3,
Subsurface = 4,
Grass = 5
}
public enum _DecalLayerEnum
{
Default,
Environment,
Character,
Misc
}
public enum _CullEnum
{
Off,
Front,
Back
}
public enum _PrintDirectionEnum
{
BottomUp = 0,
TopDown = 1,
BackToFront = 3
}
public Material Material;
public Renderer Renderer;
public string MaterialName;
public bool _EnableCutout;
public Color _Color;
public Texture _MainTex;
public Vector2 _MainTexScale;
public Vector2 _MainTexOffset;
[Range(0f, 5f)]
public float _NormalStrength;
public Texture _NormalTex;
public Vector2 _NormalTexScale;
public Vector2 _NormalTexOffset;
public Color _EmColor;
public Texture _EmTex;
[Range(0f, 10f)]
public float _EmPower;
[Range(0f, 1f)]
public float _Smoothness;
public bool _IgnoreDiffuseAlphaForSpeculars;
public _RampInfoEnum _RampChoice;
public _DecalLayerEnum _DecalLayer;
[Range(0f, 1f)]
public float _SpecularStrength;
[Range(0.1f, 20f)]
public float _SpecularExponent;
public _CullEnum _Cull_Mode;
public bool _EnableDither;
[Range(0f, 1f)]
public float _FadeBias;
public bool _EnableFresnelEmission;
public Texture _FresnelRamp;
[Range(0.1f, 20f)]
public float _FresnelPower;
public Texture _FresnelMask;
[Range(0f, 20f)]
public float _FresnelBoost;
public bool _EnablePrinting;
[Range(-25f, 25f)]
public float _SliceHeight;
[Range(0f, 10f)]
public float _PrintBandHeight;
[Range(0f, 1f)]
public float _PrintAlphaDepth;
public Texture _PrintAlphaTexture;
public Vector2 _PrintAlphaTextureScale;
public Vector2 _PrintAlphaTextureOffset;
[Range(0f, 10f)]
public float _PrintColorBoost;
[Range(0f, 4f)]
public float _PrintAlphaBias;
[Range(0f, 1f)]
public float _PrintEmissionToAlbedoLerp;
public _PrintDirectionEnum _PrintDirection;
public Texture _PrintRamp;
[Range(-10f, 10f)]
public float _EliteBrightnessMin;
[Range(-10f, 10f)]
public float _EliteBrightnessMax;
public bool _EnableSplatmap;
public bool _UseVertexColorsInstead;
[Range(0f, 1f)]
public float _BlendDepth;
public Texture _SplatmapTex;
public Vector2 _SplatmapTexScale;
public Vector2 _SplatmapTexOffset;
[Range(0f, 20f)]
public float _SplatmapTileScale;
public Texture _GreenChannelTex;
public Texture _GreenChannelNormalTex;
[Range(0f, 1f)]
public float _GreenChannelSmoothness;
[Range(-2f, 5f)]
public float _GreenChannelBias;
public Texture _BlueChannelTex;
public Texture _BlueChannelNormalTex;
[Range(0f, 1f)]
public float _BlueChannelSmoothness;
[Range(-2f, 5f)]
public float _BlueChannelBias;
public bool _EnableFlowmap;
public Texture _FlowTexture;
public Texture _FlowHeightmap;
public Vector2 _FlowHeightmapScale;
public Vector2 _FlowHeightmapOffset;
public Texture _FlowHeightRamp;
public Vector2 _FlowHeightRampScale;
public Vector2 _FlowHeightRampOffset;
[Range(-1f, 1f)]
public float _FlowHeightBias;
[Range(0.1f, 20f)]
public float _FlowHeightPower;
[Range(0.1f, 20f)]
public float _FlowEmissionStrength;
[Range(0f, 15f)]
public float _FlowSpeed;
[Range(0f, 5f)]
public float _MaskFlowStrength;
[Range(0f, 5f)]
public float _NormalFlowStrength;
[Range(0f, 10f)]
public float _FlowTextureScaleFactor;
public bool _EnableLimbRemoval;
public void Start()
{
GrabMaterialValues();
}
public void GrabMaterialValues()
{
//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_0062: 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_0078: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
//IL_02cd: Unknown result type (might be due to invalid IL or missing references)
//IL_02d2: Unknown result type (might be due to invalid IL or missing references)
//IL_02e3: Unknown result type (might be due to invalid IL or missing references)
//IL_02e8: Unknown result type (might be due to invalid IL or missing references)
//IL_03ec: Unknown result type (might be due to invalid IL or missing references)
//IL_03f1: Unknown result type (might be due to invalid IL or missing references)
//IL_0402: Unknown result type (might be due to invalid IL or missing references)
//IL_0407: Unknown result type (might be due to invalid IL or missing references)
//IL_0520: Unknown result type (might be due to invalid IL or missing references)
//IL_0525: Unknown result type (might be due to invalid IL or missing references)
//IL_0536: Unknown result type (might be due to invalid IL or missing references)
//IL_053b: Unknown result type (might be due to invalid IL or missing references)
//IL_0562: Unknown result type (might be due to invalid IL or missing references)
//IL_0567: Unknown result type (might be due to invalid IL or missing references)
//IL_0578: Unknown result type (might be due to invalid IL or missing references)
//IL_057d: Unknown result type (might be due to invalid IL or missing references)
if (Object.op_Implicit((Object)(object)Material))
{
_EnableCutout = Material.IsKeywordEnabled("CUTOUT");
_Color = Material.GetColor("_Color");
_MainTex = Material.GetTexture("_MainTex");
_MainTexScale = Material.GetTextureScale("_MainTex");
_MainTexOffset = Material.GetTextureOffset("_MainTex");
_NormalStrength = Material.GetFloat("_NormalStrength");
_NormalTex = Material.GetTexture("_NormalTex");
_NormalTexScale = Material.GetTextureScale("_NormalTex");
_NormalTexOffset = Material.GetTextureOffset("_NormalTex");
_EmColor = Material.GetColor("_EmColor");
_EmTex = Material.GetTexture("_EmTex");
_EmPower = Material.GetFloat("_EmPower");
_Smoothness = Material.GetFloat("_Smoothness");
_IgnoreDiffuseAlphaForSpeculars = Material.IsKeywordEnabled("FORCE_SPEC");
_RampChoice = (_RampInfoEnum)Material.GetFloat("_RampInfo");
_DecalLayer = (_DecalLayerEnum)Material.GetFloat("_DecalLayer");
_SpecularStrength = Material.GetFloat("_SpecularStrength");
_SpecularExponent = Material.GetFloat("_SpecularExponent");
_Cull_Mode = (_CullEnum)Material.GetFloat("_Cull");
_EnableDither = Material.IsKeywordEnabled("DITHER");
_FadeBias = Material.GetFloat("_FadeBias");
_EnableFresnelEmission = Material.IsKeywordEnabled("FRESNEL_EMISSION");
_FresnelRamp = Material.GetTexture("_FresnelRamp");
_FresnelPower = Material.GetFloat("_FresnelPower");
_FresnelMask = Material.GetTexture("_FresnelMask");
_FresnelBoost = Material.GetFloat("_FresnelBoost");
_EnablePrinting = Material.IsKeywordEnabled("PRINT_CUTOFF");
_SliceHeight = Material.GetFloat("_SliceHeight");
_PrintBandHeight = Material.GetFloat("_SliceBandHeight");
_PrintAlphaDepth = Material.GetFloat("_SliceAlphaDepth");
_PrintAlphaTexture = Material.GetTexture("_SliceAlphaTex");
_PrintAlphaTextureScale = Material.GetTextureScale("_SliceAlphaTex");
_PrintAlphaTextureOffset = Material.GetTextureOffset("_SliceAlphaTex");
_PrintColorBoost = Material.GetFloat("_PrintBoost");
_PrintAlphaBias = Material.GetFloat("_PrintBias");
_PrintEmissionToAlbedoLerp = Material.GetFloat("_PrintEmissionToAlbedoLerp");
_PrintDirection = (_PrintDirectionEnum)Material.GetFloat("_PrintDirection");
_PrintRamp = Material.GetTexture("_PrintRamp");
_EliteBrightnessMin = Material.GetFloat("_EliteBrightnessMin");
_EliteBrightnessMax = Material.GetFloat("_EliteBrightnessMax");
_EnableSplatmap = Material.IsKeywordEnabled("SPLATMAP");
_UseVertexColorsInstead = Material.IsKeywordEnabled("USE_VERTEX_COLORS");
_BlendDepth = Material.GetFloat("_Depth");
_SplatmapTex = Material.GetTexture("_SplatmapTex");
_SplatmapTexScale = Material.GetTextureScale("_SplatmapTex");
_SplatmapTexOffset = Material.GetTextureOffset("_SplatmapTex");
_SplatmapTileScale = Material.GetFloat("_SplatmapTileScale");
_GreenChannelTex = Material.GetTexture("_GreenChannelTex");
_GreenChannelNormalTex = Material.GetTexture("_GreenChannelNormalTex");
_GreenChannelSmoothness = Material.GetFloat("_GreenChannelSmoothness");
_GreenChannelBias = Material.GetFloat("_GreenChannelBias");
_BlueChannelTex = Material.GetTexture("_BlueChannelTex");
_BlueChannelNormalTex = Material.GetTexture("_BlueChannelNormalTex");
_BlueChannelSmoothness = Material.GetFloat("_BlueChannelSmoothness");
_BlueChannelBias = Material.GetFloat("_BlueChannelBias");
_EnableFlowmap = Material.IsKeywordEnabled("FLOWMAP");
_FlowTexture = Material.GetTexture("_FlowTex");
_FlowHeightmap = Material.GetTexture("_FlowHeightmap");
_FlowHeightmapScale = Material.GetTextureScale("_FlowHeightmap");
_FlowHeightmapOffset = Material.GetTextureOffset("_FlowHeightmap");
_FlowHeightRamp = Material.GetTexture("_FlowHeightRamp");
_FlowHeightRampScale = Material.GetTextureScale("_FlowHeightRamp");
_FlowHeightRampOffset = Material.GetTextureOffset("_FlowHeightRamp");
_FlowHeightBias = Material.GetFloat("_FlowHeightBias");
_FlowHeightPower = Material.GetFloat("_FlowHeightPower");
_FlowEmissionStrength = Material.GetFloat("_FlowEmissionStrength");
_FlowSpeed = Material.GetFloat("_FlowSpeed");
_MaskFlowStrength = Material.GetFloat("_FlowMaskStrength");
_NormalFlowStrength = Material.GetFloat("_FlowNormalStrength");
_FlowTextureScaleFactor = Material.GetFloat("_FlowTextureScaleFactor");
_EnableLimbRemoval = Material.IsKeywordEnabled("LIMBREMOVAL");
MaterialName = ((Object)Material).name;
}
}
public void Update()
{
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
//IL_013d: Unknown result type (might be due to invalid IL or missing references)
//IL_0154: Unknown result type (might be due to invalid IL or missing references)
//IL_0182: Unknown result type (might be due to invalid IL or missing references)
//IL_0427: Unknown result type (might be due to invalid IL or missing references)
//IL_043e: Unknown result type (might be due to invalid IL or missing references)
//IL_05ae: Unknown result type (might be due to invalid IL or missing references)
//IL_05c5: Unknown result type (might be due to invalid IL or missing references)
//IL_07e6: Unknown result type (might be due to invalid IL or missing references)
//IL_07fd: Unknown result type (might be due to invalid IL or missing references)
//IL_0854: Unknown result type (might be due to invalid IL or missing references)
//IL_086b: Unknown result type (might be due to invalid IL or missing references)
if (Object.op_Implicit((Object)(object)Material))
{
if (((Object)Material).name != MaterialName && Object.op_Implicit((Object)(object)Renderer))
{
GrabMaterialValues();
PutMaterialIntoMeshRenderer(Renderer, Material);
}
SetShaderKeywordBasedOnBool(_EnableCutout, Material, "CUTOUT");
Material.SetColor("_Color", _Color);
if (Object.op_Implicit((Object)(object)_MainTex))
{
Material.SetTexture("_MainTex", _MainTex);
Material.SetTextureScale("_MainTex", _MainTexScale);
Material.SetTextureOffset("_MainTex", _MainTexOffset);
}
else
{
Material.SetTexture("_MainTex", (Texture)null);
}
Material.SetFloat("_NormalStrength", _NormalStrength);
if (Object.op_Implicit((Object)(object)_NormalTex))
{
Material.SetTexture("_NormalTex", _NormalTex);
Material.SetTextureScale("_NormalTex", _NormalTexScale);
Material.SetTextureOffset("_NormalTex", _NormalTexOffset);
}
else
{
Material.SetTexture("_NormalTex", (Texture)null);
}
Material.SetColor("_EmColor", _EmColor);
if (Object.op_Implicit((Object)(object)_EmTex))
{
Material.SetTexture("_EmTex", _EmTex);
}
else
{
Material.SetTexture("_EmTex", (Texture)null);
}
Material.SetFloat("_EmPower", _EmPower);
Material.SetFloat("_Smoothness", _Smoothness);
SetShaderKeywordBasedOnBool(_IgnoreDiffuseAlphaForSpeculars, Material, "FORCE_SPEC");
Material.SetFloat("_RampInfo", Convert.ToSingle(_RampChoice));
Material.SetFloat("_DecalLayer", Convert.ToSingle(_DecalLayer));
Material.SetFloat("_SpecularStrength", _SpecularStrength);
Material.SetFloat("_SpecularExponent", _SpecularExponent);
Material.SetFloat("_Cull", Convert.ToSingle(_Cull_Mode));
SetShaderKeywordBasedOnBool(_EnableDither, Material, "DITHER");
Material.SetFloat("_FadeBias", _FadeBias);
SetShaderKeywordBasedOnBool(_EnableFresnelEmission, Material, "FRESNEL_EMISSION");
if (Object.op_Implicit((Object)(object)_FresnelRamp))
{
Material.SetTexture("_FresnelRamp", _FresnelRamp);
}
else
{
Material.SetTexture("_FresnelRamp", (Texture)null);
}
Material.SetFloat("_FresnelPower", _FresnelPower);
if (Object.op_Implicit((Object)(object)_FresnelMask))
{
Material.SetTexture("_FresnelMask", _FresnelMask);
}
else
{
Material.SetTexture("_FresnelMask", (Texture)null);
}
Material.SetFloat("_FresnelBoost", _FresnelBoost);
SetShaderKeywordBasedOnBool(_EnablePrinting, Material, "PRINT_CUTOFF");
Material.SetFloat("_SliceHeight", _SliceHeight);
Material.SetFloat("_SliceBandHeight", _PrintBandHeight);
Material.SetFloat("_SliceAlphaDepth", _PrintAlphaDepth);
if (Object.op_Implicit((Object)(object)_PrintAlphaTexture))
{
Material.SetTexture("_SliceAlphaTex", _PrintAlphaTexture);
Material.SetTextureScale("_SliceAlphaTex", _PrintAlphaTextureScale);
Material.SetTextureOffset("_SliceAlphaTex", _PrintAlphaTextureOffset);
}
else
{
Material.SetTexture("_SliceAlphaTex", (Texture)null);
}
Material.SetFloat("_PrintBoost", _PrintColorBoost);
Material.SetFloat("_PrintBias", _PrintAlphaBias);
Material.SetFloat("_PrintEmissionToAlbedoLerp", _PrintEmissionToAlbedoLerp);
Material.SetFloat("_PrintDirection", Convert.ToSingle(_PrintDirection));
if (Object.op_Implicit((Object)(object)_PrintRamp))
{
Material.SetTexture("_PrintRamp", _PrintRamp);
}
else
{
Material.SetTexture("_PrintRamp", (Texture)null);
}
Material.SetFloat("_EliteBrightnessMin", _EliteBrightnessMin);
Material.SetFloat("_EliteBrightnessMax", _EliteBrightnessMax);
SetShaderKeywordBasedOnBool(_EnableSplatmap, Material, "SPLATMAP");
SetShaderKeywordBasedOnBool(_UseVertexColorsInstead, Material, "USE_VERTEX_COLORS");
Material.SetFloat("_Depth", _BlendDepth);
if (Object.op_Implicit((Object)(object)_SplatmapTex))
{
Material.SetTexture("_SplatmapTex", _SplatmapTex);
Material.SetTextureScale("_SplatmapTex", _SplatmapTexScale);
Material.SetTextureOffset("_SplatmapTex", _SplatmapTexOffset);
}
else
{
Material.SetTexture("_SplatmapTex", (Texture)null);
}
Material.SetFloat("_SplatmapTileScale", _SplatmapTileScale);
if (Object.op_Implicit((Object)(object)_GreenChannelTex))
{
Material.SetTexture("_GreenChannelTex", _GreenChannelTex);
}
else
{
Material.SetTexture("_GreenChannelTex", (Texture)null);
}
if (Object.op_Implicit((Object)(object)_GreenChannelNormalTex))
{
Material.SetTexture("_GreenChannelNormalTex", _GreenChannelNormalTex);
}
else
{
Material.SetTexture("_GreenChannelNormalTex", (Texture)null);
}
Material.SetFloat("_GreenChannelSmoothness", _GreenChannelSmoothness);
Material.SetFloat("_GreenChannelBias", _GreenChannelBias);
if (Object.op_Implicit((Object)(object)_BlueChannelTex))
{
Material.SetTexture("_BlueChannelTex", _BlueChannelTex);
}
else
{
Material.SetTexture("_BlueChannelTex", (Texture)null);
}
if (Object.op_Implicit((Object)(object)_BlueChannelNormalTex))
{
Material.SetTexture("_BlueChannelNormalTex", _BlueChannelNormalTex);
}
else
{
Material.SetTexture("_BlueChannelNormalTex", (Texture)null);
}
Material.SetFloat("_BlueChannelSmoothness", _BlueChannelSmoothness);
Material.SetFloat("_BlueChannelBias", _BlueChannelBias);
SetShaderKeywordBasedOnBool(_EnableFlowmap, Material, "FLOWMAP");
if (Object.op_Implicit((Object)(object)_FlowTexture))
{
Material.SetTexture("_FlowTex", _FlowTexture);
}
else
{
Material.SetTexture("_FlowTex", (Texture)null);
}
if (Object.op_Implicit((Object)(object)_FlowHeightmap))
{
Material.SetTexture("_FlowHeightmap", _FlowHeightmap);
Material.SetTextureScale("_FlowHeightmap", _FlowHeightmapScale);
Material.SetTextureOffset("_FlowHeightmap", _FlowHeightmapOffset);
}
else
{
Material.SetTexture("_FlowHeightmap", (Texture)null);
}
if (Object.op_Implicit((Object)(object)_FlowHeightRamp))
{
Material.SetTexture("_FlowHeightRamp", _FlowHeightRamp);
Material.SetTextureScale("_FlowHeightRamp", _FlowHeightRampScale);
Material.SetTextureOffset("_FlowHeightRamp", _FlowHeightRampOffset);
}
else
{
Material.SetTexture("_FlowHeightRamp", (Texture)null);
}
Material.SetFloat("_FlowHeightBias", _FlowHeightBias);
Material.SetFloat("_FlowHeightPower", _FlowHeightPower);
Material.SetFloat("_FlowEmissionStrength", _FlowEmissionStrength);
Material.SetFloat("_FlowSpeed", _FlowSpeed);
Material.SetFloat("_FlowMaskStrength", _MaskFlowStrength);
Material.SetFloat("_FlowNormalStrength", _NormalFlowStrength);
Material.SetFloat("_FlowTextureScaleFactor", _FlowTextureScaleFactor);
SetShaderKeywordBasedOnBool(_EnableLimbRemoval, Material, "LIMBREMOVAL");
}
}
}
public class HGCloudRemapController : MonoBehaviour
{
public enum _CullEnum
{
Off,
Front,
Back
}
public enum _ZTestEnum
{
Disabled,
Never,
Less,
Equal,
LessEqual,
Greater,
NotEqual,
GreaterEqual,
Always
}
public Material Material;
public Renderer Renderer;
public string MaterialName;
public Color _Tint;
public bool _DisableRemapping;
public Texture _MainTex;
public Vector2 _MainTexScale;
public Vector2 _MainTexOffset;
public Texture _RemapTex;
public Vector2 _RemapTexScale;
public Vector2 _RemapTexOffset;
[Range(0f, 2f)]
public float _SoftFactor;
[Range(1f, 20f)]
public float _BrightnessBoost;
[Range(0f, 20f)]
public float _AlphaBoost;
[Range(0f, 1f)]
public float _AlphaBias;
public bool _UseUV1;
public bool _FadeWhenNearCamera;
[Range(0f, 1f)]
public float _FadeCloseDistance;
public _CullEnum _Cull_Mode;
public _ZTestEnum _ZTest_Mode;
[Range(-10f, 10f)]
public float _DepthOffset;
public bool _CloudRemapping;
public bool _DistortionClouds;
[Range(-2f, 2f)]
public float _DistortionStrength;
public Texture _Cloud1Tex;
public Vector2 _Cloud1TexScale;
public Vector2 _Cloud1TexOffset;
public Texture _Cloud2Tex;
public Vector2 _Cloud2TexScale;
public Vector2 _Cloud2TexOffset;
public Vector4 _CutoffScroll;
public bool _VertexColors;
public bool _LuminanceForVertexAlpha;
public bool _LuminanceForTextureAlpha;
public bool _VertexOffset;
public bool _FresnelFade;
public bool _SkyboxOnly;
[Range(-20f, 20f)]
public float _FresnelPower;
[Range(0f, 3f)]
public float _VertexOffsetAmount;
public void Start()
{
GrabMaterialValues();
}
public void GrabMaterialValues()
{
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: 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_0078: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
//IL_0206: Unknown result type (might be due to invalid IL or missing references)
//IL_020b: Unknown result type (might be due to invalid IL or missing references)
//IL_021c: Unknown result type (might be due to invalid IL or missing references)
//IL_0221: Unknown result type (might be due to invalid IL or missing references)
//IL_0248: Unknown result type (might be due to invalid IL or missing references)
//IL_024d: 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_0263: Unknown result type (might be due to invalid IL or missing references)
//IL_0274: Unknown result type (might be due to invalid IL or missing references)
//IL_0279: Unknown result type (might be due to invalid IL or missing references)
if (Object.op_Implicit((Object)(object)Material))
{
_Tint = Material.GetColor("_TintColor");
_DisableRemapping = Material.IsKeywordEnabled("DISABLEREMAP");
_MainTex = Material.GetTexture("_MainTex");
_MainTexScale = Material.GetTextureScale("_MainTex");
_MainTexOffset = Material.GetTextureOffset("_MainTex");
_RemapTex = Material.GetTexture("_RemapTex");
_RemapTexScale = Material.GetTextureScale("_RemapTex");
_RemapTexOffset = Material.GetTextureOffset("_RemapTex");
_SoftFactor = Material.GetFloat("_InvFade");
_BrightnessBoost = Material.GetFloat("_Boost");
_AlphaBoost = Material.GetFloat("_AlphaBoost");
_AlphaBias = Material.GetFloat("_AlphaBias");
_UseUV1 = Material.IsKeywordEnabled("USE_UV1");
_FadeWhenNearCamera = Material.IsKeywordEnabled("FADECLOSE");
_FadeCloseDistance = Material.GetFloat("_FadeCloseDistance");
_Cull_Mode = (_CullEnum)Material.GetFloat("_Cull");
_ZTest_Mode = (_ZTestEnum)Material.GetFloat("_ZTest");
_DepthOffset = Material.GetFloat("_DepthOffset");
_CloudRemapping = Material.IsKeywordEnabled("USE_CLOUDS");
_DistortionClouds = Material.IsKeywordEnabled("CLOUDOFFSET");
_DistortionStrength = Material.GetFloat("_DistortionStrength");
_Cloud1Tex = Material.GetTexture("_Cloud1Tex");
_Cloud1TexScale = Material.GetTextureScale("_Cloud1Tex");
_Cloud1TexOffset = Material.GetTextureOffset("_Cloud1Tex");
_Cloud2Tex = Material.GetTexture("_Cloud2Tex");
_Cloud2TexScale = Material.GetTextureScale("_Cloud2Tex");
_Cloud2TexOffset = Material.GetTextureOffset("_Cloud2Tex");
_CutoffScroll = Material.GetVector("_CutoffScroll");
_VertexColors = Material.IsKeywordEnabled("VERTEXCOLOR");
_LuminanceForVertexAlpha = Material.IsKeywordEnabled("VERTEXALPHA");
_LuminanceForTextureAlpha = Material.IsKeywordEnabled("CALCTEXTUREALPHA");
_VertexOffset = Material.IsKeywordEnabled("VERTEXOFFSET");
_FresnelFade = Material.IsKeywordEnabled("FRESNEL");
_SkyboxOnly = Material.IsKeywordEnabled("SKYBOX_ONLY");
_FresnelPower = Material.GetFloat("_FresnelPower");
_VertexOffsetAmount = Material.GetFloat("_OffsetAmount");
MaterialName = ((Object)Material).name;
}
}
public void Update()
{
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
//IL_0126: Unknown result type (might be due to invalid IL or missing references)
//IL_013d: Unknown result type (might be due to invalid IL or missing references)
//IL_02d3: Unknown result type (might be due to invalid IL or missing references)
//IL_02ea: Unknown result type (might be due to invalid IL or missing references)
//IL_0341: Unknown result type (might be due to invalid IL or missing references)
//IL_0358: Unknown result type (might be due to invalid IL or missing references)
//IL_0386: Unknown result type (might be due to invalid IL or missing references)
if (Object.op_Implicit((Object)(object)Material))
{
if (((Object)Material).name != MaterialName && Object.op_Implicit((Object)(object)Renderer))
{
GrabMaterialValues();
PutMaterialIntoMeshRenderer(Renderer, Material);
}
Material.SetColor("_TintColor", _Tint);
SetShaderKeywordBasedOnBool(_DisableRemapping, Material, "DISABLEREMAP");
if (Object.op_Implicit((Object)(object)_MainTex))
{
Material.SetTexture("_MainTex", _MainTex);
Material.SetTextureScale("_MainTex", _MainTexScale);
Material.SetTextureOffset("_MainTex", _MainTexOffset);
}
else
{
Material.SetTexture("_MainTex", (Texture)null);
}
if (Object.op_Implicit((Object)(object)_RemapTex))
{
Material.SetTexture("_RemapTex", _RemapTex);
Material.SetTextureScale("_RemapTex", _RemapTexScale);
Material.SetTextureOffset("_RemapTex", _RemapTexOffset);
}
else
{
Material.SetTexture("_RemapTex", (Texture)null);
}
Material.SetFloat("_InvFade", _SoftFactor);
Material.SetFloat("_Boost", _BrightnessBoost);
Material.SetFloat("_AlphaBoost", _AlphaBoost);
Material.SetFloat("_AlphaBias", _AlphaBias);
SetShaderKeywordBasedOnBool(_UseUV1, Material, "USE_UV1");
SetShaderKeywordBasedOnBool(_FadeWhenNearCamera, Material, "FADECLOSE");
Material.SetFloat("_FadeCloseDistance", _FadeCloseDistance);
Material.SetFloat("_Cull", Convert.ToSingle(_Cull_Mode));
Material.SetFloat("_ZTest", Convert.ToSingle(_ZTest_Mode));
Material.SetFloat("_DepthOffset", _DepthOffset);
SetShaderKeywordBasedOnBool(_CloudRemapping, Material, "USE_CLOUDS");
SetShaderKeywordBasedOnBool(_DistortionClouds, Material, "CLOUDOFFSET");
Material.SetFloat("_DistortionStrength", _DistortionStrength);
if (Object.op_Implicit((Object)(object)_Cloud1Tex))
{
Material.SetTexture("_Cloud1Tex", _Cloud1Tex);
Material.SetTextureScale("_Cloud1Tex", _Cloud1TexScale);
Material.SetTextureOffset("_Cloud1Tex", _Cloud1TexOffset);
}
else
{
Material.SetTexture("_Cloud1Tex", (Texture)null);
}
if (Object.op_Implicit((Object)(object)_Cloud2Tex))
{
Material.SetTexture("_Cloud2Tex", _Cloud2Tex);
Material.SetTextureScale("_Cloud2Tex", _Cloud2TexScale);
Material.SetTextureOffset("_Cloud2Tex", _Cloud2TexOffset);
}
else
{
Material.SetTexture("_Cloud2Tex", (Texture)null);
}
Material.SetVector("_CutoffScroll", _CutoffScroll);
SetShaderKeywordBasedOnBool(_VertexColors, Material, "VERTEXCOLOR");
SetShaderKeywordBasedOnBool(_LuminanceForVertexAlpha, Material, "VERTEXALPHA");
SetShaderKeywordBasedOnBool(_LuminanceForTextureAlpha, Material, "CALCTEXTUREALPHA");
SetShaderKeywordBasedOnBool(_VertexOffset, Material, "VERTEXOFFSET");
SetShaderKeywordBasedOnBool(_FresnelFade, Material, "FRESNEL");
SetShaderKeywordBasedOnBool(_SkyboxOnly, Material, "SKYBOX_ONLY");
Material.SetFloat("_FresnelPower", _FresnelPower);
Material.SetFloat("_OffsetAmount", _VertexOffsetAmount);
}
}
}
public class HGIntersectionController : MonoBehaviour
{
public enum _SrcBlendFloatEnum
{
Zero,
One,
DstColor,
SrcColor,
OneMinusDstColor,
SrcAlpha,
OneMinusSrcColor,
DstAlpha,
OneMinusDstAlpha,
SrcAlphaSaturate,
OneMinusSrcAlpha
}
public enum _DstBlendFloatEnum
{
Zero,
One,
DstColor,
SrcColor,
OneMinusDstColor,
SrcAlpha,
OneMinusSrcColor,
DstAlpha,
OneMinusDstAlpha,
SrcAlphaSaturate,
OneMinusSrcAlpha
}
public enum _CullEnum
{
Off,
Front,
Back
}
public Material Material;
public Renderer Renderer;
public string MaterialName;
public _SrcBlendFloatEnum _Source_Blend_Mode;
public _DstBlendFloatEnum _Destination_Blend_Mode;
public Color _Tint;
public Texture _MainTex;
public Vector2 _MainTexScale;
public Vector2 _MainTexOffset;
public Texture _Cloud1Tex;
public Vector2 _Cloud1TexScale;
public Vector2 _Cloud1TexOffset;
public Texture _Cloud2Tex;
public Vector2 _Cloud2TexScale;
public Vector2 _Cloud2TexOffset;
public Texture _RemapTex;
public Vector2 _RemapTexScale;
public Vector2 _RemapTexOffset;
public Vector4 _CutoffScroll;
[Range(0f, 30f)]
public float _SoftFactor;
[Range(0.1f, 20f)]
public float _SoftPower;
[Range(0f, 5f)]
public float _BrightnessBoost;
[Range(0.1f, 20f)]
public float _RimPower;
[Range(0f, 5f)]
public float _RimStrength;
[Range(0f, 20f)]
public float _AlphaBoost;
[Range(0f, 20f)]
public float _IntersectionStrength;
public _CullEnum _Cull_Mode;
public bool _FadeFromVertexColorsOn;
public bool _EnableTriplanarProjectionsForClouds;
public void Start()
{
GrabMaterialValues();
}
public void GrabMaterialValues()
{
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_007f: 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_0095: Unknown result type (might be due to invalid IL or missing references)
//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
//IL_0103: Unknown result type (might be due to invalid IL or missing references)
//IL_0114: Unknown result type (might be due to invalid IL or missing references)
//IL_0119: Unknown result type (might be due to invalid IL or missing references)
//IL_0140: Unknown result type (might be due to invalid IL or missing references)
//IL_0145: 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_015b: Unknown result type (might be due to invalid IL or missing references)
//IL_016c: Unknown result type (might be due to invalid IL or missing references)
//IL_0171: Unknown result type (might be due to invalid IL or missing references)
if (Object.op_Implicit((Object)(object)Material))
{
_Source_Blend_Mode = (_SrcBlendFloatEnum)Material.GetFloat("_SrcBlendFloat");
_Destination_Blend_Mode = (_DstBlendFloatEnum)Material.GetFloat("_DstBlendFloat");
_Tint = Material.GetColor("_TintColor");
_MainTex = Material.GetTexture("_MainTex");
_MainTexScale = Material.GetTextureScale("_MainTex");
_MainTexOffset = Material.GetTextureOffset("_MainTex");
_Cloud1Tex = Material.GetTexture("_Cloud1Tex");
_Cloud1TexScale = Material.GetTextureScale("_Cloud1Tex");
_Cloud1TexOffset = Material.GetTextureOffset("_Cloud1Tex");
_Cloud2Tex = Material.GetTexture("_Cloud2Tex");
_Cloud2TexScale = Material.GetTextureScale("_Cloud2Tex");
_Cloud2TexOffset = Material.GetTextureOffset("_Cloud2Tex");
_RemapTex = Material.GetTexture("_RemapTex");
_RemapTexScale = Material.GetTextureScale("_RemapTex");
_RemapTexOffset = Material.GetTextureOffset("_RemapTex");
_CutoffScroll = Material.GetVector("_CutoffScroll");
_SoftFactor = Material.GetFloat("_InvFade");
_SoftPower = Material.GetFloat("_SoftPower");
_BrightnessBoost = Material.GetFloat("_Boost");
_RimPower = Material.GetFloat("_RimPower");
_RimStrength = Material.GetFloat("_RimStrength");
_AlphaBoost = Material.GetFloat("_AlphaBoost");
_IntersectionStrength = Material.GetFloat("_IntersectionStrength");
_Cull_Mode = (_CullEnum)Material.GetFloat("_Cull");
_FadeFromVertexColorsOn = Material.IsKeywordEnabled("FADE_FROM_VERTEX_COLORS");
_EnableTriplanarProjectionsForClouds = Material.IsKeywordEnabled("TRIPLANAR");
MaterialName = ((Object)Material).name;
}
}
public void Update()
{
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
//IL_00e5: 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_0151: Unknown result type (might be due to invalid IL or missing references)
//IL_0168: Unknown result type (might be due to invalid IL or missing references)
//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
//IL_022d: Unknown result type (might be due to invalid IL or missing references)
//IL_0244: Unknown result type (might be due to invalid IL or missing references)
//IL_0272: Unknown result type (might be due to invalid IL or missing references)
if (Object.op_Implicit((Object)(object)Material))
{
if (((Object)Material).name != MaterialName && Object.op_Implicit((Object)(object)Renderer))
{
GrabMaterialValues();
PutMaterialIntoMeshRenderer(Renderer, Material);
}
Material.SetFloat("_SrcBlendFloat", Convert.ToSingle(_Source_Blend_Mode));
Material.SetFloat("_DstBlendFloat", Convert.ToSingle(_Destination_Blend_Mode));
Material.SetColor("_TintColor", _Tint);
if (Object.op_Implicit((Object)(object)_MainTex))
{
Material.SetTexture("_MainTex", _MainTex);
Material.SetTextureScale("_MainTex", _MainTexScale);
Material.SetTextureOffset("_MainTex", _MainTexOffset);
}
else
{
Material.SetTexture("_MainTex", (Texture)null);
}
if (Object.op_Implicit((Object)(object)_Cloud1Tex))
{
Material.SetTexture("_Cloud1Tex", _Cloud1Tex);
Material.SetTextureScale("_Cloud1Tex", _Cloud1TexScale);
Material.SetTextureOffset("_Cloud1Tex", _Cloud1TexOffset);
}
else
{
Material.SetTexture("_Cloud1Tex", (Texture)null);
}
if (Object.op_Implicit((Object)(object)_Cloud2Tex))
{
Material.SetTexture("_Cloud2Tex", _Cloud2Tex);
Material.SetTextureScale("_Cloud2Tex", _Cloud2TexScale);
Material.SetTextureOffset("_Cloud2Tex", _Cloud2TexOffset);
}
else
{
Material.SetTexture("_Cloud2Tex", (Texture)null);
}
if (Object.op_Implicit((Object)(object)_RemapTex))
{
Material.SetTexture("_RemapTex", _RemapTex);
Material.SetTextureScale("_RemapTex", _RemapTexScale);
Material.SetTextureOffset("_RemapTex", _RemapTexOffset);
}
else
{
Material.SetTexture("_RemapTex", (Texture)null);
}
Material.SetVector("_CutoffScroll", _CutoffScroll);
Material.SetFloat("_InvFade", _SoftFactor);
Material.SetFloat("_SoftPower", _SoftPower);
Material.SetFloat("_Boost", _BrightnessBoost);
Material.SetFloat("_RimPower", _RimPower);
Material.SetFloat("_RimStrength", _RimStrength);
Material.SetFloat("_AlphaBoost", _AlphaBoost);
Material.SetFloat("_IntersectionStrength", _IntersectionStrength);
Material.SetFloat("_Cull", Convert.ToSingle(_Cull_Mode));
SetShaderKeywordBasedOnBool(_FadeFromVertexColorsOn, Material, "FADE_FROM_VERTEX_COLORS");
SetShaderKeywordBasedOnBool(_EnableTriplanarProjectionsForClouds, Material, "TRIPLANAR");
}
}
}
public static void SetShaderKeywordBasedOnBool(bool enabled, Material material, string keyword)
{
if (!Object.op_Implicit((Object)(object)material))
{
return;
}
if (enabled)
{
if (!material.IsKeywordEnabled(keyword))
{
material.EnableKeyword(keyword);
}
}
else if (material.IsKeywordEnabled(keyword))
{
material.DisableKeyword(keyword);
}
}
public static void PutMaterialIntoMeshRenderer(Renderer meshRenderer, Material material)
{
if (Object.op_Implicit((Object)(object)material) && Object.op_Implicit((Object)(object)meshRenderer))
{
SkinnedMeshRenderer val = (SkinnedMeshRenderer)(object)((meshRenderer is SkinnedMeshRenderer) ? meshRenderer : null);
if (val != null)
{
((Renderer)val).sharedMaterials = (Material[])(object)new Material[1] { material };
}
MeshRenderer val2 = (MeshRenderer)(object)((meshRenderer is MeshRenderer) ? meshRenderer : null);
if (val2 != null)
{
((Renderer)val2).material = material;
}
}
}
}
}
namespace BetterArmory.Items
{
public abstract class ItemBase
{
public ItemDef ItemDef;
public abstract string ItemName { get; }
public abstract string ItemLangTokenName { get; }
public abstract string ItemPickupDesc { get; }
public abstract string ItemFullDescription { get; }
public abstract string ItemLore { get; }
public abstract ItemTier Tier { get; }
public virtual ItemTag[] ItemTags { get; set; } = (ItemTag[])(object)new ItemTag[0];
public abstract GameObject ItemModel { get; }
public abstract Sprite ItemIcon { get; }
public virtual bool CanRemove { get; } = true;
public virtual bool AIBlacklisted { get; set; } = false;
public abstract void Init(ConfigFile config);
public virtual void CreateConfig(ConfigFile config)
{
}
protected virtual void CreateLang()
{
LanguageAPI.Add("ITEM_" + ItemLangTokenName + "_NAME", ItemName);
LanguageAPI.Add("ITEM_" + ItemLangTokenName + "_PICKUP", ItemPickupDesc);
LanguageAPI.Add("ITEM_" + ItemLangTokenName + "_DESCRIPTION", ItemFullDescription);
LanguageAPI.Add("ITEM_" + ItemLangTokenName + "_LORE", ItemLore);
}
public abstract ItemDisplayRuleDict CreateItemDisplayRules();
public virtual void CreateBuffs()
{
}
protected void CreateItem()
{
//IL_0119: Unknown result type (might be due to invalid IL or missing references)
//IL_012b: Unknown result type (might be due to invalid IL or missing references)
//IL_0130: Unknown result type (might be due to invalid IL or missing references)
//IL_0162: Unknown result type (might be due to invalid IL or missing references)
//IL_0168: Expected O, but got Unknown
if (AIBlacklisted)
{
ItemTags = new List<ItemTag>(ItemTags) { (ItemTag)4 }.ToArray();
}
ItemDef = ScriptableObject.CreateInstance<ItemDef>();
((Object)ItemDef).name = "ITEM_" + ItemLangTokenName;
ItemDef.nameToken = "ITEM_" + ItemLangTokenName + "_NAME";
ItemDef.pickupToken = "ITEM_" + ItemLangTokenName + "_PICKUP";
ItemDef.descriptionToken = "ITEM_" + ItemLangTokenName + "_DESCRIPTION";
ItemDef.loreToken = "ITEM_" + ItemLangTokenName + "_LORE";
ItemDef.pickupModelPrefab = ItemModel;
ItemDef.pickupIconSprite = ItemIcon;
ItemDef.hidden = false;
ItemDef.canRemove = CanRemove;
ItemDef.tier = Tier;
ItemDef.deprecatedTier = Tier;
if (ItemTags.Length != 0)
{
ItemDef.tags = ItemTags;
}
CustomItem val = new CustomItem(ItemDef, CreateItemDisplayRules());
ItemAPI.Add(val);
}
public virtual void Hooks()
{
}
public int GetCount(CharacterBody body)
{
if (!Object.op_Implicit((Object)(object)body) || !Object.op_Implicit((Object)(object)body.inventory))
{
return 0;
}
return body.inventory.GetItemCount(ItemDef);
}
public int GetCount(CharacterMaster master)
{
if (!Object.op_Implicit((Object)(object)master) || !Object.op_Implicit((Object)(object)master.inventory))
{
return 0;
}
return master.inventory.GetItemCount(ItemDef);
}
public int GetCountSpecific(CharacterBody body, ItemDef itemDef)
{
if (!Object.op_Implicit((Object)(object)body) || !Object.op_Implicit((Object)(object)body.inventory))
{
return 0;
}
return body.inventory.GetItemCount(itemDef);
}
}
}
namespace BetterArmory.Items.Tier3
{
public class BloodRage : ItemBase
{
protected ConfigEntry<float> BaseDamageGranted;
protected ConfigEntry<float> PercentToStack;
public static BuffDef DamageBuff;
public override string ItemName => "Blood Rage";
public override string ItemLangTokenName => "BLOOD_RAGE";
public override string ItemPickupDesc => "Make your bleeding your strength. The damage inflicted on you will make your punches be the end.";
public override string ItemFullDescription => $"For each <style=cIsHealth> 25%</style> <style=cStack>(- 10% per stack)</style> health lost, you will gain <style=cIsDamage>{BaseDamageGranted.Value} base damage</style>.";
public override string ItemLore => " LORE ";
public override ItemTier Tier => (ItemTier)2;
public override Sprite ItemIcon => Main.MainAssets.LoadAsset<Sprite>("Magatama.png");
public override GameObject ItemModel => Main.MainAssets.LoadAsset<GameObject>("Magatama.prefab");
public override void Init(ConfigFile config)
{
CreateConfig(config);
CreateLang();
CreateBuff();
CreateItem();
Hooks();
}
public override void CreateConfig(ConfigFile config)
{
BaseDamageGranted = config.Bind<float>("Item: " + ItemLangTokenName, "Base damage granted by Blood Rage", 10f, "How much damage should the first gave you");
PercentToStack = config.Bind<float>("Item: " + ItemLangTokenName, "Percent of health lost for stack", 0.2f, "How much percent of health do you need to lose to gain a stack");
}
public override ItemDisplayRuleDict CreateItemDisplayRules()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Expected O, but got Unknown
return new ItemDisplayRuleDict(Array.Empty<ItemDisplayRule>());
}
private void CreateBuff()
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
DamageBuff = Buffs.AddNewBuff("Blood_Rage", Main.MainAssets.LoadAsset<Sprite>("BloodRage.png"), Color.red, canStack: true);
}
public override void Hooks()
{
//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
CharacterBody.FixedUpdate += new hook_FixedUpdate(UpdateNbBuff);
RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(AddDamageReward);
}
private void UpdateNbBuff(orig_FixedUpdate orig, CharacterBody self)
{
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
orig.Invoke(self);
HealthComponent healthComponent = self.healthComponent;
if (Object.op_Implicit((Object)(object)self) && GetCount(self) > 0)
{
int num = StackOfPercentLost(healthComponent.health, healthComponent.fullHealth, GetCount(self));
self.SetBuffCount(DamageBuff.buffIndex, num);
}
}
private void AddDamageReward(CharacterBody sender, StatHookEventArgs args)
{
if (sender.HasBuff(DamageBuff))
{
args.baseDamageAdd += BaseDamageGranted.Value * (float)sender.GetBuffCount(DamageBuff);
}
}
private int StackOfPercentLost(float actual, float full, int itemcount)
{
float num = Mathf.Round(actual / full * 100f);
float num2 = 100f - num;
float num3 = 0.3f / (1f + PercentToStack.Value * (float)itemcount) * 100f;
return Mathf.FloorToInt(num2 / num3);
}
}
public class Bulwark : ItemBase
{
protected ConfigEntry<float> baseReduction;
protected ConfigEntry<float> stackReduction;
public override string ItemName => "Large Bulwark";
public override string ItemLangTokenName => "LARGE_BULWARK";
public override string ItemPickupDesc => "Reduce incoming damage";
public override string ItemFullDescription => $"Reduce damage by <style=cIsHealing>{baseReduction.Value * 100f}%</style> <style=cStack>(+{stackReduction.Value * 100f}% per stack) for incoming damage.</style>";
public override string ItemLore => "";
public override ItemTier Tier => (ItemTier)2;
public override GameObject ItemModel => Main.MainAssets.LoadAsset<GameObject>("BulwarkDisplay.prefab");
public override Sprite ItemIcon => Main.MainAssets.LoadAsset<Sprite>("Bulwark.png");
public override void Init(ConfigFile config)
{
CreateConfig(config);
CreateLang();
CreateItem();
Hooks();
}
public override void CreateConfig(ConfigFile config)
{
baseReduction = config.Bind<float>("Item: " + ItemLangTokenName, "Base reduction for Bulwark", 0.11f, "How much reduction should the item give at first");
stackReduction = config.Bind<float>("Item: " + ItemLangTokenName, "Stack reduction for Bulwark", 0.2f, "How much reduction should the item gain by stack");
}
public override ItemDisplayRuleDict CreateItemDisplayRules()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Expected O, but got Unknown
return new ItemDisplayRuleDict(Array.Empty<ItemDisplayRule>());
}
public override void Hooks()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Expected O, but got Unknown
HealthComponent.TakeDamage += new hook_TakeDamage(ReduceDamage);
}
private void ReduceDamage(orig_TakeDamage orig, HealthComponent self, DamageInfo damageInfo)
{
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Invalid comparison between Unknown and I4
CharacterBody body = self.body;
if (Object.op_Implicit((Object)(object)body))
{
int count = GetCount(body);
if (count > 0 && (int)DamageTypeCombo.op_Implicit(damageInfo.damageType) != 2)
{
float num = Reduction(count);
float damage = damageInfo.damage;
damageInfo.damage = Mathf.Max(1f, damageInfo.damage / (1f + num));
}
}
orig.Invoke(self, damageInfo);
}
private float Reduction(int count)
{
return MathForIt.RoundFloat(1f - 1f / (1f + baseReduction.Value + stackReduction.Value * (float)(count - 1)), 2);
}
}
public class QueronContract : ItemBase
{
protected ConfigEntry<float> BaseHealthBonus;
protected ConfigEntry<float> BaseShieldBonus;
protected ConfigEntry<float> BaseArmorBonus;
protected ConfigEntry<float> BaseRegenBonus;
protected ConfigEntry<float> BaseMoveSpeedBonus;
protected ConfigEntry<float> BaseSprintSpeedBonus;
protected ConfigEntry<float> BaseDamageBonus;
protected ConfigEntry<float> BaseAttackSpeedBonus;
protected ConfigEntry<float> BaseCritChanceBonus;
protected ConfigEntry<float> BaseCritDamageBonus;
protected ConfigEntry<float> BaseCooldownBonus;
public override string ItemName => "Contract : Queron";
public override string ItemLangTokenName => "QUERON_CONTRACT";
public override string ItemPickupDesc => "The thirst for blood will make you stronger. Kill and you may be rewarded.";
public override string ItemFullDescription => "Killing give a chance <style=cIsUtility>( 4% <style=cStack>(+ 2% per stack)</style> )</style> to get a permanent bonus to a stat";
public override string ItemLore => "LORE";
public override ItemTier Tier => (ItemTier)2;
public override GameObject ItemModel => Main.MainAssets.LoadAsset<GameObject>("QueronBookDisplay.prefab");
public override Sprite ItemIcon => Main.MainAssets.LoadAsset<Sprite>("QueronBookIcon.png");
public override ItemDisplayRuleDict CreateItemDisplayRules()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Expected O, but got Unknown
return new ItemDisplayRuleDict(Array.Empty<ItemDisplayRule>());
}
public override void Init(ConfigFile config)
{
CreateConfig(config);
CreateLang();
CreateItem();
Hooks();
}
public override void CreateConfig(ConfigFile config)
{
BaseHealthBonus = ConfigCreator.FloatEntry(config, "Item: " + ItemLangTokenName, "Base health bonus", 10f, "How much health should the player gain from the item on each kill count bonus ?");
BaseShieldBonus = ConfigCreator.FloatEntry(config, "Item: " + ItemLangTokenName, "Base shield bonus", 5f, "How much health should the player gain from the item on each kill count bonus ?");
BaseArmorBonus = ConfigCreator.FloatEntry(config, "Item: " + ItemLangTokenName, "Base armor bonus", 2f, "How much health should the player gain from the item on each kill count bonus ?");
BaseRegenBonus = ConfigCreator.FloatEntry(config, "Item: " + ItemLangTokenName, "Base regen bonus", 2f, "How much health should the player gain from the item on each kill count bonus ?");
BaseMoveSpeedBonus = ConfigCreator.FloatEntry(config, "Item: " + ItemLangTokenName, "Base move speed bonus", 0.4f, "How much health should the player gain from the item on each kill count bonus ?");
BaseSprintSpeedBonus = ConfigCreator.FloatEntry(config, "Item: " + ItemLangTokenName, "Base sprint speed bonus", 0.2f, "How much health should the player gain from the item on each kill count bonus ?");
BaseDamageBonus = ConfigCreator.FloatEntry(config, "Item: " + ItemLangTokenName, "Base damage bonus", 7.5f, "How much health should the player gain from the item on each kill count bonus ?");
BaseAttackSpeedBonus = ConfigCreator.FloatEntry(config, "Item: " + ItemLangTokenName, "Base attack speed bonus", 0.3f, "How much health should the player gain from the item on each kill count bonus ?");
BaseCritChanceBonus = ConfigCreator.FloatEntry(config, "Item: " + ItemLangTokenName, "Base crit chance bonus", 3f, "How much health should the player gain from the item on each kill count bonus ?");
BaseCritDamageBonus = ConfigCreator.FloatEntry(config, "Item: " + ItemLangTokenName, "Base crit damage bonus", 0.1f, "How much health should the player gain from the item on each kill count bonus ?");
BaseCooldownBonus = ConfigCreator.FloatEntry(config, "Item: " + ItemLangTokenName, "Base cooldown bonus", 0.02f, "How much health should the player gain from the item on each kill count bonus ?");
}
public override void Hooks()
{
//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
RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(UpdatePermBonus);
CharacterBody.FixedUpdate += new hook_FixedUpdate(QueronStatValidator);
GlobalEventManager.OnCharacterDeath += new hook_OnCharacterDeath(QueronRollBonus);
}
private void UpdatePermBonus(CharacterBody sender, StatHookEventArgs args)
{
QueronStatFollower component = ((Component)sender).GetComponent<QueronStatFollower>();
if (Object.op_Implicit((Object)(object)component) && GetCount(sender) > 0)
{
component.ApplyBonusStat(args, BaseHealthBonus.Value, BaseShieldBonus.Value, BaseArmorBonus.Value, BaseRegenBonus.Value, BaseMoveSpeedBonus.Value, BaseSprintSpeedBonus.Value, BaseDamageBonus.Value, BaseAttackSpeedBonus.Value, BaseCritChanceBonus.Value, BaseCritDamageBonus.Value, BaseCooldownBonus.Value);
}
}
private void QueronStatValidator(orig_FixedUpdate orig, CharacterBody self)
{
orig.Invoke(self);
if (Object.op_Implicit((Object)(object)self) && Object.op_Implicit((Object)(object)self.healthComponent))
{
QueronStatFollower component = ((Component)self).GetComponent<QueronStatFollower>();
if (!Object.op_Implicit((Object)(object)component))
{
component = ((Component)self).gameObject.AddComponent<QueronStatFollower>();
component.Initialize();
}
}
}
private void QueronRollBonus(orig_OnCharacterDeath orig, GlobalEventManager self, DamageReport damageReport)
{
orig.Invoke(self, damageReport);
CharacterBody component = damageReport.attacker.GetComponent<CharacterBody>();
if (!((Object)(object)component != (Object)null))
{
return;
}
int count = GetCount(component);
if (count <= 0)
{
return;
}
int num = Random.Range(1, 100);
if (num <= 4 + 2 * (count - 1))
{
StatSelector ss = RandomSelectStat();
QueronStatFollower queronStatFollower = ((Component)component).GetComponent<QueronStatFollower>();
if (!Object.op_Implicit((Object)(object)queronStatFollower))
{
queronStatFollower = ((Component)component).gameObject.AddComponent<QueronStatFollower>();
queronStatFollower.Initialize();
}
queronStatFollower.Increment(ss);
component.statsDirty = true;
}
}
public StatSelector RandomSelectStat()
{
return new Random().NextEnum<StatSelector>();
}
}
public enum StatSelector
{
HEALTH,
SHIELD,
ARMOR,
REGEN,
MOVESPEED,
SPRINTSPEED,
DAMAGE,
ATTACKSPEED,
CRITCHANCE,
CRITDAMAGE,
COOLDOWN
}
}
namespace BetterArmory.Items.Tier2
{
public class GiantGloves : ItemBase
{
protected ConfigEntry<float> GrantedHealth;
public override string ItemName => "Giants Gloves";
public override string ItemLangTokenName => "GIANTS_GLOVES";
public override string ItemPickupDesc => "Giants always are stronger than you!";
public override string ItemFullDescription => $"Increase your health by <style=cIsHealth>{GrantedHealth.Value}%</style> <style=cStack>(+{GrantedHealth.Value}% per stack)</style>. Boost your damage by <style=cIsHealth>3% of your <style=cIsHealth>max health.";
public override string ItemLore => "";
public override ItemTier Tier => (ItemTier)1;
public override Sprite ItemIcon => Main.MainAssets.LoadAsset<Sprite>("GiantGlovesIcon.png");
public override GameObject ItemModel => Main.MainAssets.LoadAsset<GameObject>("GiantGlovesDisplay.prefab");
public override void Init(ConfigFile config)
{
CreateConfig(config);
CreateLang();
CreateItem();
Hooks();
}
public override void CreateConfig(ConfigFile config)
{
GrantedHealth = config.Bind<float>("Item: " + ItemLangTokenName, "Percent of health granted by stack", 0.05f, "How much percent of health is granted");
}
public override ItemDisplayRuleDict CreateItemDisplayRules()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Expected O, but got Unknown
return new ItemDisplayRuleDict(Array.Empty<ItemDisplayRule>());
}
public override void Hooks()
{
//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
RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(BonusHealthGloves);
RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(BonusDamageGloves);
}
private void BonusHealthGloves(CharacterBody sender, StatHookEventArgs args)
{
if (Object.op_Implicit((Object)(object)sender) && GetCount(sender) > 0)
{
args.healthMultAdd += GrantedHealth.Value * (float)GetCount(sender);
}
}
private void BonusDamageGloves(CharacterBody sender, StatHookEventArgs args)
{
if (Object.op_Implicit((Object)(object)sender) && GetCount(sender) > 0)
{
float fullHealth = sender.healthComponent.fullHealth;
args.baseDamageAdd += fullHealth * 0.03f;
}
}
}
public class GoldenArrow : ItemBase
{
protected ConfigEntry<float> CritCoeff;
public override string ItemName => "Golden Arrow";
public override string ItemLangTokenName => "GOLDEN_ARROW";
public override string ItemPickupDesc => "Better arrows! So better damage!";
public override string ItemFullDescription => $"Let the gold imbue your weapon and become the edge of your bullet. Boost your critical damage by <style=cIsDamage>{CritCoeff.Value * 100f}%</style> <style=cStack>(+ {CritCoeff.Value * 100f}% per Stack)</style>";
public override string ItemLore => "";
public override ItemTier Tier => (ItemTier)1;
public override GameObject ItemModel => Main.MainAssets.LoadAsset<GameObject>("GoldenArrowDisplay.prefab");
public override Sprite ItemIcon => Main.MainAssets.LoadAsset<Sprite>("GoldenArrowIcon.png");
public override void Init(ConfigFile config)
{
CreateConfig(config);
CreateLang();
CreateItem();
Hooks();
}
public override void CreateConfig(ConfigFile config)
{
CritCoeff = config.Bind<float>("Item: " + ItemLangTokenName, "Critical coefficient per stack", 0.2f, "How much crit coefficient should item apply");
}
public override ItemDisplayRuleDict CreateItemDisplayRules()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Expected O, but got Unknown
return new ItemDisplayRuleDict(Array.Empty<ItemDisplayRule>());
}
public override void Hooks()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Expected O, but got Unknown
RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(MultiCrit);
}
private void MultiCrit(CharacterBody sender, StatHookEventArgs args)
{
if (Object.op_Implicit((Object)(object)sender) && GetCount(sender) > 0)
{
int count = GetCount(sender);
args.critDamageMultAdd += CritCoeff.Value * (float)count;
}
}
}
public class MidasContract : ItemBase
{
protected ConfigEntry<float> GoldMultBase;
protected ConfigEntry<float> GoldMultStack;
protected ConfigEntry<float> BuffTime;
protected ConfigEntry<int> KillThreshold;
public static BuffDef GoldBuff;
public override string ItemName => "Contract : Midas";
public override string ItemLangTokenName => "MIDAS_CONTRACT";
public override string ItemPickupDesc => "pickup";
public override string ItemFullDescription => $"Killing spree increase gold gain multiplied by <style=cIsUtility>{GoldMultBase.Value * 100f}%</style> <style=cStack>(+{GoldMultStack.Value * 100f}% per stack)</style> for killing time";
public override string ItemLore => "LORE";
public override ItemTier Tier => (ItemTier)1;
public override GameObject ItemModel => Main.MainAssets.LoadAsset<GameObject>("MidasContractDisplay.prefab");
public override Sprite ItemIcon => Main.MainAssets.LoadAsset<Sprite>("MidasContractIcon.png");
public override void Init(ConfigFile config)
{
CreateConfig(config);
CreateLang();
CreateBuffs();
CreateItem();
Hooks();
}
public override void CreateConfig(ConfigFile config)
{
GoldMultBase = config.Bind<float>("Item: " + ItemLangTokenName, "Base gold multiplier for Midas Contract", 0.4f, "How much gold multiplier should the first give you ?");
GoldMultStack = config.Bind<float>("Item: " + ItemLangTokenName, "Stack gold multiplier for Midas Contract", 0.3f, "How much gold multiplier should each stack give you ?");
BuffTime = config.Bind<float>("Item: " + ItemLangTokenName, "Lifetime for Gold Buff", 15f, "How much time should the buff live on ?");
KillThreshold = config.Bind<int>("Item: " + ItemLangTokenName, "Threshold to give Gold Buff", 5, "How much kill should player do to get Gold Buff ?");
}
public override void CreateBuffs()
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
GoldBuff = Buffs.AddNewBuff("GOLDMULT", Main.MainAssets.LoadAsset<Sprite>("BloodRage.png"), Color.yellow);
}
public override ItemDisplayRuleDict CreateItemDisplayRules()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Expected O, but got Unknown
return new ItemDisplayRuleDict(Array.Empty<ItemDisplayRule>());
}
public override void Hooks()
{
//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
GlobalEventManager.OnCharacterDeath += new hook_OnCharacterDeath(GiveBuffOnThreshold);
CharacterMaster.GiveMoney += new hook_GiveMoney(CharacterMaster_GiveMoney);
}
private void GiveBuffOnThreshold(orig_OnCharacterDeath orig, GlobalEventManager self, DamageReport damageReport)
{
orig.Invoke(self, damageReport);
CharacterBody attackerBody = damageReport.attackerBody;
if ((Object)(object)attackerBody != (Object)null && attackerBody.isPlayerControlled && GetCount(attackerBody) > 0 && attackerBody.multiKillCount >= KillThreshold.Value && !attackerBody.HasBuff(GoldBuff))
{
attackerBody.AddTimedBuff(GoldBuff, BuffTime.Value);
}
}
private void CharacterMaster_GiveMoney(orig_GiveMoney orig, CharacterMaster self, uint amount)
{
if (Object.op_Implicit((Object)(object)self) && Object.op_Implicit((Object)(object)((Component)self).gameObject))
{
CharacterBody body = self.GetBody();
if (Object.op_Implicit((Object)(object)body) && GetCount(body) > 0 && body.HasBuff(GoldBuff))
{
amount = (uint)((float)amount * (1f + GoldMultBase.Value + GoldMultStack.Value * (float)(GetCount(body) - 1)));
}
}
orig.Invoke(self, amount);
}
}
}
namespace BetterArmory.Items.Tier1
{
public class LittlePlate : ItemBase
{
protected ConfigEntry<float> ArmorBase;
protected ConfigEntry<float> ArmorPerStack;
public override string ItemName => "Little Plate";
public override string ItemLangTokenName => "LITTLE_PLATE";
public override string ItemPickupDesc => "Gain armor to reinforce yourself.";
public override string ItemFullDescription => $"Increase armor by <style=cIsHealing>{ArmorBase.Value}</style> <style=cStack>(+{ArmorPerStack.Value} per stack)</style>";
public override string ItemLore => "";
public override ItemTier Tier => (ItemTier)0;
public override Sprite ItemIcon => Main.MainAssets.LoadAsset<Sprite>("LittlePlate.png");
public override GameObject ItemModel => Main.MainAssets.LoadAsset<GameObject>("LittlePlateDisplay.prefab");
public override void Init(ConfigFile config)
{
CreateConfig(config);
CreateLang();
CreateItem();
Hooks();
}
public override void CreateConfig(ConfigFile config)
{
ArmorBase = config.Bind<float>("Item: " + ItemLangTokenName, "Base armor for Little Plate", 10f, "How much armor should the first gave you");
ArmorPerStack = config.Bind<float>("Item: " + ItemLangTokenName, "Armor per Little Plate stack", 15f, "How much armor should each stack of LitllePlate give");
}
public override ItemDisplayRuleDict CreateItemDisplayRules()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Expected O, but got Unknown
return new ItemDisplayRuleDict(Array.Empty<ItemDisplayRule>());
}
public override void Hooks()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Expected O, but got Unknown
RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(AddArmor);
}
private void AddArmor(CharacterBody sender, StatHookEventArgs args)
{
int count = GetCount(sender);
if (count > 0)
{
args.armorAdd += ArmorBase.Value + ArmorPerStack.Value * (float)(count - 1);
}
}
}
public class SplinteredArrow : ItemBase
{
public static BuffDef MarkDebuff;
protected ConfigEntry<float> ChanceToMark;
protected ConfigEntry<float> TimeDebuff;
protected ConfigEntry<float> BaseDamageBonusMark;
protected ConfigEntry<float> StackDamageBonusMark;
public override string ItemName => "Splintered Arrow";
public override string ItemLangTokenName => "SPLINTERED_ARROW";
public override string ItemPickupDesc => "Broken projectile to curse your enemies and destroy their innards.";
public override string ItemFullDescription => $"<style=cIsUtility>{ChanceToMark.Value * 100f}% to curse</style> enemies on hit, dealing <style=cIsDamage>{BaseDamageBonusMark.Value * 100f}%</style> <style=cStack>(+ {StackDamageBonusMark.Value * 100f}% per stack)</style> more damage.";
public override string ItemLore => "Lore";
public override ItemTier Tier => (ItemTier)0;
public override GameObject ItemModel => Main.MainAssets.LoadAsset<GameObject>("BrokenArrowDisplay.prefab");
public override Sprite ItemIcon => Main.MainAssets.LoadAsset<Sprite>("BrokenArrow_icon.png");
public override ItemDisplayRuleDict CreateItemDisplayRules()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Expected O, but got Unknown
return new ItemDisplayRuleDict(Array.Empty<ItemDisplayRule>());
}
public override void Init(ConfigFile config)
{
CreateConfig(config);
CreateLang();
CreateBuffs();
CreateItem();
Hooks();
}
public override void CreateConfig(ConfigFile config)
{
ChanceToMark = config.Bind<float>("Item: " + ItemLangTokenName, "Chance to mark an enemy with the debuff", 0.25f, "How much chance each hit has to set debuff on enemy hit ?");
TimeDebuff = config.Bind<float>("Item: " + ItemLangTokenName, "Lifetime debuff on enemy", 4f, "How much lifetime debuff on enemy marked ?");
BaseDamageBonusMark = config.Bind<float>("Item: " + ItemLangTokenName, "Base damage bonus on debuff enemy", 0.25f, "How much bonus damage debuff give at base ?");
StackDamageBonusMark = config.Bind<float>("Item: " + ItemLangTokenName, "Stakc damage bonus on debuff enemy", 0.1f, "How much bonus damage debuff give by stack ?");
}
public override void CreateBuffs()
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
MarkDebuff = Buffs.AddNewBuff("Splintered_Mark", Main.MainAssets.LoadAsset<Sprite>("SplinteredArrow.png"), Color.magenta, canStack: false, isDebuff: true);
}
public override void Hooks()
{
//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
GlobalEventManager.OnHitEnemy += new hook_OnHitEnemy(MarkDebuffEnemy);
HealthComponent.TakeDamage += new hook_TakeDamage(DamageUpOnDebuff);
}
private void DamageUpOnDebuff(orig_TakeDamage orig, HealthComponent self, DamageInfo damageInfo)
{
if (Object.op_Implicit((Object)(object)self.body) && self.body.HasBuff(MarkDebuff))
{
damageInfo.damage *= 1f + BaseDamageBonusMark.Value + StackDamageBonusMark.Value * (float)(GetCount(damageInfo.attacker.GetComponent<CharacterBody>()) - 1);
}
orig.Invoke(self, damageInfo);
}
private void MarkDebuffEnemy(orig_OnHitEnemy orig, GlobalEventManager self, DamageInfo damageInfo, GameObject victim)
{
if (orig != null && (Object)(object)victim != (Object)null)
{
CharacterBody component = damageInfo.inflictor.GetComponent<CharacterBody>();
if (GetCount(component) > 0)
{
float num = Random.Range(0f, 1f);
if (num <= ChanceToMark.Value)
{
CharacterBody component2 = victim.GetComponent<CharacterBody>();
component2.AddTimedBuff(MarkDebuff, TimeDebuff.Value);
}
}
}
orig.Invoke(self, damageInfo, victim);
}
}
}
namespace BetterArmory.Items.Lunar
{
public class MitrixJuice : ItemBase
{
protected ConfigEntry<float> ChangeStatBase;
protected ConfigEntry<float> ChangeStatStack;
public override string ItemName => "Mitrix Juice";
public override string ItemLangTokenName => "MITRIX_JUICE";
public override string ItemPickupDesc => "A tonic to accelerate your attack! But at the risk of sacrificing your power ...";
public override string ItemFullDescription => "Increases attack speed by 60% ( + 60% per stack ) but reduces attack damage by 60% ( + 60% per stack )";
public override string ItemLore => "Mitrix Juice";
public override ItemTier Tier => (ItemTier)3;
public override GameObject ItemModel => Main.MainAssets.LoadAsset<GameObject>("MitrixJuiceDisplay.prefab");
public override Sprite ItemIcon => Main.MainAssets.LoadAsset<Sprite>("MitrixJuice.png");
public override void Init(ConfigFile config)
{
CreateConfig(config);
CreateLang();
CreateItem();
Hooks();
}
public override void CreateConfig(ConfigFile config)
{
ChangeStatBase = config.Bind<float>("Item: " + ItemLangTokenName, "Base modification of attack speed and damage", 0.6f, "How much attack speed and damage change should the player have at base ?");
ChangeStatStack = config.Bind<float>("Item: " + ItemLangTokenName, "Modification of attack speed and damage per stack", 0.2f, "How much attack speed and damage change should the player have per stack ?");
}
public override ItemDisplayRuleDict CreateItemDisplayRules()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Expected O, but got Unknown
return new ItemDisplayRuleDict(Array.Empty<ItemDisplayRule>());
}
public override void Hooks()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Expected O, but got Unknown
RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(ChangeStatPerJuice);
}
private void ChangeStatPerJuice(CharacterBody sender, StatHookEventArgs args)
{
if (Object.op_Implicit((Object)(object)sender) && GetCount(sender) > 0)
{
args.damageMultAdd -= ChangeStatBase.Value + ChangeStatStack.Value * (float)GetCount(sender);
args.attackSpeedMultAdd += ChangeStatBase.Value + ChangeStatStack.Value * (float)GetCount(sender);
}
}
}
}
namespace BetterArmory.Equipment
{
public class Converter : EquipmentBase
{
public ConfigEntry<float> ConverterRate;
public ConfigEntry<float> ConverterCooldown;
public override string EquipmentName => "Converter";
public override string EquipmentLangTokenName => "CONVERTER";
public override string EquipmentPickupDesc => "Shield is BETTER than life !";
public override string EquipmentFullDescription => $"Exchange {ConverterRate.Value}% of max HP to blue shield.";
public override string EquipmentLore => "";
public override GameObject EquipmentModel => Main.MainAssets.LoadAsset<GameObject>("ConverterDisplay.prefab");
public override Sprite EquipmentIcon => Main.MainAssets.LoadAsset<Sprite>("ConverterIcon.png");
public override float Cooldown => ConverterCooldown.Value;
public float exchange { get; private set; }
public BuffDef ConvertBuff { get; private set; }
public override void Init(ConfigFile config)
{
SetupBuff();
CreateConfig(config);
CreateLang();
CreateEquipment();
Hooks();
}
protected void SetupBuff()
{
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
ConvertBuff = ScriptableObject.CreateInstance<BuffDef>();
((Object)ConvertBuff).name = "BUFF_LIFESWITCHSHIELD";
ConvertBuff.canStack = true;
ConvertBuff.isCooldown = false;
ConvertBuff.isDebuff = false;
ConvertBuff.isHidden = false;
ConvertBuff.buffColor = Color.white;
ConvertBuff.iconSprite = Main.MainAssets.LoadAsset<Sprite>("MyOrb.png");
ContentAddition.AddBuffDef(ConvertBuff);
}
protected override void CreateConfig(ConfigFile config)
{
ConverterCooldown = config.Bind<float>("Equipment : " + EquipmentLangTokenName, "cooldown", 10f, "how much cooldown");
ConverterRate = config.Bind<float>("Equipment : " + EquipmentLangTokenName, "rate", 0.2f, "how much rate");
}
public override ItemDisplayRuleDict CreateItemDisplayRules()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Expected O, but got Unknown
return new ItemDisplayRuleDict(Array.Empty<ItemDisplayRule>());
}
protected override bool ActivateEquipment(EquipmentSlot slot)
{
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: Unknown result type (might be due to invalid IL or missing references)
CharacterBody characterBody = slot.characterBody;
if (!Object.op_Implicit((Object)(object)characterBody) || !Object.op_Implicit((Object)(object)characterBody.teamComponent))
{
return false;
}
ChatMessage.SendColored("Converting...", Color.green);
HealthComponent healthComponent = characterBody.healthComponent;
if (healthComponent.fullHealth > 100f)
{
characterBody.AddBuff(ConvertBuff);
return true;
}
ChatMessage.SendColored("Not enough health !", Color.red);
return false;
}
private void ModifyHealthAndShield(CharacterBody sender, StatHookEventArgs args)
{
if (sender.isPlayerControlled && sender.HasBuff(ConvertBuff))
{
exchange = sender.baseMaxHealth * ConverterRate.Value;
sender.baseMaxShield += exchange;
sender.baseMaxHealth -= exchange;
sender.RemoveBuff(ConvertBuff);
}
}
public override void Hooks()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Expected O, but got Unknown
RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(ModifyHealthAndShield);
}
}
public abstract class EquipmentBase
{
public EquipmentDef EquipmentDef;
public abstract string EquipmentName { get; }
public abstract string EquipmentLangTokenName { get; }
public abstract string EquipmentPickupDesc { get; }
public abstract string EquipmentFullDescription { get; }
public abstract string EquipmentLore { get; }
public abstract GameObject EquipmentModel { get; }
public abstract Sprite EquipmentIcon { get; }
public virtual bool AppearsInSinglePlayer { get; } = true;
public virtual bool AppearsInMultiPlayer { get; } = true;
public virtual bool CanDrop { get; } = true;
public virtual float Cooldown { get; } = 60f;
public virtual bool EnigmaCompatible { get; } = true;
public virtual bool IsBoss { get; } = false;
public virtual bool IsLunar { get; } = false;
public abstract ItemDisplayRuleDict CreateItemDisplayRules();
public abstract void Init(ConfigFile config);
protected virtual void CreateConfig(ConfigFile config)
{
}
protected virtual void CreateLang()
{
LanguageAPI.Add("EQUIPMENT_" + EquipmentLangTokenName + "_NAME", EquipmentName);
LanguageAPI.Add("EQUIPMENT_" + EquipmentLangTokenName + "_PICKUP", EquipmentPickupDesc);
LanguageAPI.Add("EQUIPMENT_" + EquipmentLangTokenName + "_DESCRIPTION", EquipmentFullDescription);
LanguageAPI.Add("EQUIPMENT_" + EquipmentLangTokenName + "_LORE", EquipmentLore);
}
protected void CreateEquipment()
{
//IL_014d: Unknown result type (might be due to invalid IL or missing references)
//IL_0157: Expected O, but got Unknown
//IL_015f: Unknown result type (might be due to invalid IL or missing references)
//IL_0169: Expected O, but got Unknown
EquipmentDef = ScriptableObject.CreateInstance<EquipmentDef>();
((Object)EquipmentDef).name = "EQUIPMENT_" + EquipmentLangTokenName;
EquipmentDef.nameToken = "EQUIPMENT_" + EquipmentLangTokenName + "_NAME";
EquipmentDef.pickupToken = "EQUIPMENT_" + EquipmentLangTokenName + "_PICKUP";
EquipmentDef.descriptionToken = "EQUIPMENT_" + EquipmentLangTokenName + "_DESCRIPTION";
EquipmentDef.loreToken = "EQUIPMENT_" + EquipmentLangTokenName + "_LORE";
EquipmentDef.pickupModelPrefab = EquipmentModel;
EquipmentDef.pickupIconSprite = EquipmentIcon;
EquipmentDef.appearsInSinglePlayer = AppearsInSinglePlayer;
EquipmentDef.appearsInMultiPlayer = AppearsInMultiPlayer;
EquipmentDef.canDrop = CanDrop;
EquipmentDef.cooldown = Cooldown;
EquipmentDef.enigmaCompatible = EnigmaCompatible;
EquipmentDef.isBoss = IsBoss;
EquipmentDef.isLunar = IsLunar;
ItemAPI.Add(new CustomEquipment(EquipmentDef, CreateItemDisplayRules()));
EquipmentSlot.PerformEquipmentAction += new hook_PerformEquipmentAction(PerformEquipmentAction);
}
private bool PerformEquipmentAction(orig_PerformEquipmentAction orig, EquipmentSlot self, EquipmentDef equipmentDef)
{
if ((Object)(object)equipmentDef == (Object)(object)EquipmentDef)
{
return ActivateEquipment(self);
}
return orig.Invoke(self, equipmentDef);
}
protected abstract bool ActivateEquipment(EquipmentSlot slot);
public virtual void Hooks()
{
}
}
}
namespace BetterArmory.Components
{
public class QueronStatFollower : MonoBehaviour
{
public StatSelector[] listStat = Enum.GetValues(typeof(StatSelector)).Cast<StatSelector>().ToArray();
public Dictionary<StatSelector, int> stats = new Dictionary<StatSelector, int>();
public void Initialize()
{
StatSelector[] array = listStat;
foreach (StatSelector key in array)
{
stats.Add(key, 0);
}
}
internal void Increment(StatSelector ss)
{
if (stats.ContainsKey(ss))
{
stats[ss]++;
}
else
{
ChatMessage.Send("Cette stat n'existe pas : " + ss);
}
}
internal void ApplyBonusStat(StatHookEventArgs args, float b1, float b2, float b3, float b4, float b5, float b6, float b7, float b8, float b9, float b10, float b11)
{
foreach (KeyValuePair<StatSelector, int> stat in stats)
{
switch (stat.Key)
{
case StatSelector.HEALTH:
args.baseHealthAdd += b1 * (float)stat.Value;
break;
case StatSelector.SHIELD:
args.baseShieldAdd += b2 * (float)stat.Value;
break;
case StatSelector.ARMOR:
args.armorAdd += b3 * (float)stat.Value;
break;
case StatSelector.REGEN:
args.baseRegenAdd += b4 * (float)stat.Value;
break;
case StatSelector.MOVESPEED:
args.baseMoveSpeedAdd += b5 * (float)stat.Value;
break;
case StatSelector.SPRINTSPEED:
args.sprintSpeedAdd += b6 * (float)stat.Value;
break;
case StatSelector.DAMAGE:
args.baseDamageAdd += b7 * (float)stat.Value;
break;
case StatSelector.ATTACKSPEED:
args.baseAttackSpeedAdd += b8 * (float)stat.Value;
break;
case StatSelector.CRITCHANCE:
args.critAdd += b9 * (float)stat.Value;
break;
case StatSelector.CRITDAMAGE:
args.critDamageMultAdd += b10 * (float)stat.Value;
break;
case StatSelector.COOLDOWN:
args.cooldownMultAdd -= b11 * (float)stat.Value;
break;
}
}
}
}
}
namespace BetterArmory.Artifact
{
public abstract class ArtifactBase
{
public ArtifactDef ArtifactDef;
public abstract string ArtifactName { get; }
public abstract string ArtifactLangTokenName { get; }
public abstract string ArtifactDescription { get; }
public abstract Sprite ArtifactEnabledIcon { get; }
public abstract Sprite ArtifactDisabledIcon { get; }
public bool ArtifactEnabled => RunArtifactManager.instance.IsArtifactEnabled(ArtifactDef);
public abstract void Init(ConfigFile config);
protected void CreateLang()
{
LanguageAPI.Add("ARTIFACT_" + ArtifactLangTokenName + "_NAME", ArtifactName);
LanguageAPI.Add("ARTIFACT_" + ArtifactLangTokenName + "_DESCRIPTION", ArtifactDescription);
}
protected void CreateArtifact()
{
ArtifactDef = ScriptableObject.CreateInstance<ArtifactDef>();
ArtifactDef.cachedName = "ARTIFACT_" + ArtifactLangTokenName;
ArtifactDef.nameToken = "ARTIFACT_" + ArtifactLangTokenName + "_NAME";
ArtifactDef.descriptionToken = "ARTIFACT_" + ArtifactLangTokenName + "_DESCRIPTION";
ArtifactDef.smallIconSelectedSprite = ArtifactEnabledIcon;
ArtifactDef.smallIconDeselectedSprite = ArtifactDisabledIcon;
ContentAddition.AddArtifactDef(ArtifactDef);
}
public abstract void Hooks();
}
}