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.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using HarmonyLib;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("ProjectAshlands")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ProjectAshlands")]
[assembly: AssemblyCopyright("Copyright © 2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("f405ea1c-ac25-47a3-9aa2-a8f56c14bfd6")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace BalrondFurRandomizer;
public class FxReplacment
{
private List<GameObject> allPrefabs;
private string projectName = "[BalrondFurRandomizer]";
public void setInstance(List<GameObject> gameObjects)
{
allPrefabs = gameObjects;
}
public void ReplaceOnObject(GameObject gameObject)
{
if ((Object)(object)gameObject == (Object)null)
{
return;
}
SpawnArea component = gameObject.GetComponent<SpawnArea>();
if ((Object)(object)component != (Object)null)
{
EffectList spawnEffects = component.m_spawnEffects;
if (spawnEffects != null)
{
findEffectsAndChange(spawnEffects.m_effectPrefabs);
}
}
Destructible component2 = gameObject.GetComponent<Destructible>();
if ((Object)(object)component2 != (Object)null)
{
EffectList hitEffect = component2.m_hitEffect;
if (hitEffect != null)
{
findEffectsAndChange(hitEffect.m_effectPrefabs);
}
EffectList destroyedEffect = component2.m_destroyedEffect;
if (destroyedEffect != null)
{
findEffectsAndChange(destroyedEffect.m_effectPrefabs);
}
}
Projectile component3 = gameObject.GetComponent<Projectile>();
if ((Object)(object)component3 != (Object)null)
{
EffectList hitEffects = component3.m_hitEffects;
if (hitEffects != null)
{
findEffectsAndChange(hitEffects.m_effectPrefabs);
}
EffectList hitWaterEffects = component3.m_hitWaterEffects;
if (hitWaterEffects != null)
{
findEffectsAndChange(hitWaterEffects.m_effectPrefabs);
}
EffectList spawnOnHitEffects = component3.m_spawnOnHitEffects;
if (spawnOnHitEffects != null)
{
findEffectsAndChange(spawnOnHitEffects.m_effectPrefabs);
}
}
}
public void ReplaceOnVegetation(GameObject gameObject)
{
Pickable component = gameObject.GetComponent<Pickable>();
if ((Object)(object)component != (Object)null)
{
fixPlant(component);
}
Destructible component2 = gameObject.GetComponent<Destructible>();
if ((Object)(object)component2 != (Object)null)
{
fixPDestructable(component2);
}
MineRock5 component3 = gameObject.GetComponent<MineRock5>();
if ((Object)(object)component3 != (Object)null)
{
fixMineRock5(component3);
}
MineRock component4 = gameObject.GetComponent<MineRock>();
if ((Object)(object)component4 != (Object)null)
{
fixMineRock(component4);
}
}
private void fixPlant(Pickable pickable)
{
EffectList pickEffector = pickable.m_pickEffector;
if (pickEffector != null)
{
findEffectsAndChange(pickEffector.m_effectPrefabs);
}
}
private void fixPDestructable(Destructible minerock5)
{
EffectList hitEffect = minerock5.m_hitEffect;
if (hitEffect != null)
{
findEffectsAndChange(hitEffect.m_effectPrefabs);
}
EffectList destroyedEffect = minerock5.m_destroyedEffect;
if (destroyedEffect != null)
{
findEffectsAndChange(destroyedEffect.m_effectPrefabs);
}
}
private void fixMineRock5(MineRock5 minerock5)
{
EffectList hitEffect = minerock5.m_hitEffect;
if (hitEffect != null)
{
findEffectsAndChange(hitEffect.m_effectPrefabs);
}
EffectList destroyedEffect = minerock5.m_destroyedEffect;
if (destroyedEffect != null)
{
findEffectsAndChange(destroyedEffect.m_effectPrefabs);
}
}
private void fixMineRock(MineRock minerock5)
{
EffectList hitEffect = minerock5.m_hitEffect;
if (hitEffect != null)
{
findEffectsAndChange(hitEffect.m_effectPrefabs);
}
EffectList destroyedEffect = minerock5.m_destroyedEffect;
if (destroyedEffect != null)
{
findEffectsAndChange(destroyedEffect.m_effectPrefabs);
}
}
public void ReplaceOnMonster(GameObject gameObject)
{
if ((Object)(object)gameObject == (Object)null)
{
Debug.LogWarning((object)(projectName + ":: GameObject not found"));
return;
}
Humanoid component = gameObject.GetComponent<Humanoid>();
if ((Object)(object)component == (Object)null)
{
Debug.LogWarning((object)(projectName + ":: GameObject not found"));
return;
}
EffectList dropEffects = component.m_dropEffects;
if (dropEffects != null)
{
findEffectsAndChange(dropEffects.m_effectPrefabs);
}
EffectList backstabHitEffects = ((Character)component).m_backstabHitEffects;
if (backstabHitEffects != null)
{
findEffectsAndChange(backstabHitEffects.m_effectPrefabs);
}
EffectList consumeItemEffects = component.m_consumeItemEffects;
if (consumeItemEffects != null)
{
findEffectsAndChange(consumeItemEffects.m_effectPrefabs);
}
EffectList critHitEffects = ((Character)component).m_critHitEffects;
if (critHitEffects != null)
{
findEffectsAndChange(critHitEffects.m_effectPrefabs);
}
EffectList deathEffects = ((Character)component).m_deathEffects;
if (deathEffects != null)
{
findEffectsAndChange(deathEffects.m_effectPrefabs);
}
EffectList hitEffects = ((Character)component).m_hitEffects;
if (hitEffects != null)
{
findEffectsAndChange(hitEffects.m_effectPrefabs);
}
EffectList jumpEffects = ((Character)component).m_jumpEffects;
if (jumpEffects != null)
{
findEffectsAndChange(jumpEffects.m_effectPrefabs);
}
EffectList perfectBlockEffect = component.m_perfectBlockEffect;
if (perfectBlockEffect != null)
{
findEffectsAndChange(perfectBlockEffect.m_effectPrefabs);
}
EffectList pickupEffects = component.m_pickupEffects;
if (pickupEffects != null)
{
findEffectsAndChange(pickupEffects.m_effectPrefabs);
}
EffectList slideEffects = ((Character)component).m_slideEffects;
if (slideEffects != null)
{
findEffectsAndChange(slideEffects.m_effectPrefabs);
}
EffectList tarEffects = ((Character)component).m_tarEffects;
if (tarEffects != null)
{
findEffectsAndChange(tarEffects.m_effectPrefabs);
}
EffectList waterEffects = ((Character)component).m_waterEffects;
if (waterEffects != null)
{
findEffectsAndChange(waterEffects.m_effectPrefabs);
}
FootStep component2 = gameObject.GetComponent<FootStep>();
if (!((Object)(object)component2 != (Object)null))
{
return;
}
List<StepEffect> effects = component2.m_effects;
foreach (StepEffect item in effects)
{
GameObject[] effectPrefabs = item.m_effectPrefabs;
List<GameObject> list = new List<GameObject>();
list.AddRange(effectPrefabs);
for (int i = 0; i < list.Count; i++)
{
if ((Object)(object)list[i] != (Object)null)
{
string name = ((Object)list[i]).name;
GameObject val = allPrefabs.Find((GameObject x) => ((Object)x).name == name);
if (!((Object)(object)val == (Object)null))
{
list[i] = val;
}
}
}
}
}
public void ReplaceOnItem(GameObject gameObject)
{
if ((Object)(object)gameObject == (Object)null)
{
return;
}
ItemDrop component = gameObject.GetComponent<ItemDrop>();
if (!((Object)(object)component == (Object)null))
{
EffectList hitEffect = component.m_itemData.m_shared.m_hitEffect;
if (hitEffect != null)
{
findEffectsAndChange(hitEffect.m_effectPrefabs);
}
EffectList hitTerrainEffect = component.m_itemData.m_shared.m_hitTerrainEffect;
if (hitTerrainEffect != null)
{
findEffectsAndChange(hitTerrainEffect.m_effectPrefabs);
}
EffectList holdStartEffect = component.m_itemData.m_shared.m_holdStartEffect;
if (holdStartEffect != null)
{
findEffectsAndChange(holdStartEffect.m_effectPrefabs);
}
EffectList trailStartEffect = component.m_itemData.m_shared.m_trailStartEffect;
if (trailStartEffect != null)
{
findEffectsAndChange(trailStartEffect.m_effectPrefabs);
}
EffectList blockEffect = component.m_itemData.m_shared.m_blockEffect;
if (blockEffect != null)
{
findEffectsAndChange(blockEffect.m_effectPrefabs);
}
}
}
public void ReplaceFxOnPiece(GameObject gameObject)
{
if ((Object)(object)gameObject == (Object)null)
{
return;
}
Piece component = gameObject.GetComponent<Piece>();
if ((Object)(object)component != (Object)null)
{
EffectList placeEffect = component.m_placeEffect;
if (placeEffect != null)
{
findEffectsAndChange(placeEffect.m_effectPrefabs);
}
}
WearNTear component2 = gameObject.GetComponent<WearNTear>();
if ((Object)(object)component2 != (Object)null)
{
EffectList hitEffect = component2.m_hitEffect;
if (hitEffect != null)
{
findEffectsAndChange(hitEffect.m_effectPrefabs);
}
}
}
private void findEffectsAndChange(EffectData[] effects)
{
if (effects == null || effects.Length == 0)
{
return;
}
foreach (EffectData val in effects)
{
if ((Object)(object)val.m_prefab != (Object)null)
{
string name = ((Object)val.m_prefab).name;
GameObject val2 = allPrefabs.Find((GameObject x) => ((Object)x).name == name);
if (!((Object)(object)val2 == (Object)null))
{
val.m_prefab = val2;
}
}
}
}
}
public class ShaderReplacment
{
public static List<GameObject> GOToSwap = new List<GameObject>();
public static List<Material> GOToSwapMaterial = new List<Material>();
public string[] shaderlist = new string[49]
{
"Custom/AlphaParticle", "Custom/Blob", "Custom/Bonemass", "Custom/Clouds", "Custom/Creature", "Custom/Decal", "Custom/Distortion", "Custom/Flow", "Custom/FlowOpaque", "Custom/Grass",
"Custom/GuiScroll", "Custom/Heightmap", "Custom/icon", "Custom/InteriorSide", "Custom/LitGui", "Custom/LitParticles", "Custom/mapshader", "Custom/ParticleDecal", "Custom/Piece", "Custom/Player",
"Custom/Rug", "Custom/ShadowBlob", "Custom/SkyboxProcedural", "Custom/SkyObject", "Custom/StaticRock", "Custom/Tar", "Custom/Trilinearmap", "Custom/UI/BGBlur", "Custom/Vegetation", "Custom/Water",
"Custom/WaterBottom", "Custom/WaterMask", "Custom/Yggdrasil", "Custom/Yggdrasil/root", "Hidden/BlitCopyHDRTonemap", "Hidden/Dof/DepthOfFieldHdr", "Hidden/Dof/DX11Dof", "Hidden/Internal-Loading", "Hidden/Internal-UIRDefaultWorld", "Hidden/SimpleClear",
"Hidden/SunShaftsComposite", "Lux Lit Particles/ Bumped", "Lux Lit Particles/ Tess Bumped", "Particles/Standard Surface2", "Particles/Standard Unlit2", "Standard TwoSided", "ToonDeferredShading2017", "Unlit/DepthWrite", "Unlit/Lighting"
};
public static List<Shader> shaders = new List<Shader>();
public static void Replace(GameObject gameObject)
{
GOToSwap.Add(gameObject);
}
public static void ReplaceMaterial(Material material)
{
GOToSwapMaterial.Add(material);
}
public static void findShadersByName()
{
Shader[] collection = Resources.FindObjectsOfTypeAll<Shader>();
shaders.AddRange(collection);
}
public static void ReplaceShadersInObject(Renderer[] renderers)
{
foreach (Renderer val in renderers)
{
Material[] sharedMaterials = val.sharedMaterials;
if (sharedMaterials != null && sharedMaterials.Length != 0)
{
fixMaterial(sharedMaterials);
}
}
}
public static void fixMaterial(Material[] shared)
{
foreach (Material val in shared)
{
if ((Object)(object)val == (Object)null)
{
continue;
}
Shader shader = val.shader;
if (!((Object)(object)shader == (Object)null))
{
string name = ((Object)shader).name;
if (!(name == "Standard") && name.Contains("Balrond"))
{
setProperValue(val, name);
}
}
}
}
public static void setProperValue(Material material, string shaderName)
{
string properName = shaderName.Replace("Balrond", "Custom");
properName = checkNaming(properName);
Shader val = shaders.Find((Shader x) => ((Object)x).name == properName);
if ((Object)(object)val == (Object)null)
{
Debug.LogWarning((object)("Shader not found " + properName));
}
else
{
material.shader = val;
}
}
private static string checkNaming(string name)
{
string result = name;
if (name.Contains("Bumped"))
{
result = name.Replace("Custom", "Lux Lit Particles");
}
if (name.Contains("Tess Bumped"))
{
result = name.Replace("Custom", "Lux Lit Particles");
}
if (name.Contains("Standard Surface"))
{
result = name.Replace("Custom", "Particles");
result = result.Replace("Standard Surface2", "Standard Surface");
}
if (name.Contains("Standard Unlit"))
{
result = name.Replace("Custom", "Particles");
result = result.Replace("Standard Unlit", "Standard Unlit2");
result = result.Replace("Standard Unlit22", "Standard Unlit2");
}
return result;
}
}
public class BaseLevelEffectSetupValue
{
public float scale = 1.1f;
public float saturation = 0.5f;
public float hue = -0.1f;
public float value = -0.1f;
public LevelSetup setup = null;
public GameObject enabledObject = null;
public GameObject enabledObjectLevel2 = null;
public GameObject enabledObjectLevel3 = null;
public bool setEmmisive = false;
public Color emissive = Color.white;
public float sumValue = 0.05f;
public void getSetup(LevelEffects levelEffects)
{
//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)levelEffects == (Object)null)
{
Debug.LogWarning((object)"I should not be here i am null");
return;
}
int num = 0;
if (levelEffects.m_levelSetups != null && levelEffects.m_levelSetups.Count > 0)
{
num = levelEffects.m_levelSetups.Count;
setup = levelEffects.m_levelSetups.Last();
}
if (num != 0 && setup != null)
{
scale = setup.m_scale;
saturation = setup.m_saturation;
hue = setup.m_hue;
value = setup.m_value;
enabledObject = setup.m_enableObject;
emissive = setup.m_emissiveColor;
setEmmisive = setup.m_setEmissiveColor;
enabledObjectLevel2 = enabledObject;
enabledObjectLevel3 = enabledObject;
}
else
{
setValues(num, levelEffects);
}
if ((Object)(object)levelEffects.m_character != (Object)null)
{
if (((Object)((Component)levelEffects.m_character).gameObject).name == "Deer")
{
EditDeer(levelEffects);
}
if (((Object)((Component)levelEffects.m_character).gameObject).name == "Boar")
{
EditBoar(levelEffects);
}
}
}
private void EditDeer(LevelEffects levelEffects)
{
GameObject enableObject = levelEffects.m_levelSetups[0].m_enableObject;
GameObject enableObject2 = levelEffects.m_levelSetups[1].m_enableObject;
enabledObjectLevel2 = enableObject;
enabledObjectLevel3 = enableObject2;
Transform parent = enableObject.transform.parent;
GameObject enableObject3 = (enabledObject = ((Component)parent.Find("Antler1")).gameObject);
levelEffects.m_levelSetups[0].m_enableObject = enableObject3;
levelEffects.m_levelSetups[1].m_enableObject = enableObject3;
}
private void EditBoar(LevelEffects gameObject)
{
}
private void setValues(int levels, LevelEffects levelEffects)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
float y = ((Component)levelEffects).transform.localScale.y;
if (levels == 0)
{
scale = y;
saturation = 0f;
hue = 0f;
value = 0f;
}
if (levels == 1)
{
scale = y + 0.05f;
saturation = 0.5f;
hue = -0.05f;
value = -0.05f;
}
if (levels == 2)
{
scale = y + 0.1f;
saturation = 0.5f;
hue = -0.1f;
value = -0.1f;
}
}
}
public class ItemSetBuilder
{
public List<ItemSet> itemSets = new List<ItemSet>();
private List<GameObject> items = new List<GameObject>();
public List<GameObject> prefabs = new List<GameObject>();
public ModResourceLoader modResourceLoader = null;
public static List<MaterialPack> materialPacks = new List<MaterialPack>();
public void setup(List<GameObject> prefabs)
{
this.prefabs = prefabs;
}
public void createMaterialPacks(ModResourceLoader modResourceLoader)
{
this.modResourceLoader = modResourceLoader;
buildPack(this.modResourceLoader.loxFace_Default, this.modResourceLoader.loxtBody_Default, this.modResourceLoader.loxFur_Default, "Lox", "Default");
buildPack(this.modResourceLoader.loxFace_Albino, this.modResourceLoader.loxtBody_Albino, this.modResourceLoader.loxFur_Albino, "Lox", "Albino");
buildPack(this.modResourceLoader.loxFace_Black, this.modResourceLoader.loxtBody_Black, this.modResourceLoader.loxFur_Black, "Lox", "Black");
buildPack(this.modResourceLoader.loxFace_Blond, this.modResourceLoader.loxtBody_Blond, this.modResourceLoader.loxFur_Blond, "Lox", "Blond");
buildPack(this.modResourceLoader.loxFace_DarkBrown, this.modResourceLoader.loxtBody_DarkBrown, this.modResourceLoader.loxFur_DarkBrown, "Lox", "Brown");
buildPack(this.modResourceLoader.loxFace_Ginger, this.modResourceLoader.loxtBody_Ginger, this.modResourceLoader.loxFur_Ginger, "Lox", "Ginger");
buildPack(this.modResourceLoader.wolfBody_Default, this.modResourceLoader.wolfBody_Default, this.modResourceLoader.wolfBody_Default, "Wolf", "Default");
buildPack(this.modResourceLoader.wolfBody_Albino, this.modResourceLoader.wolfBody_Albino, this.modResourceLoader.wolfBody_Albino, "Wolf", "Albino");
buildPack(this.modResourceLoader.wolfBody_Black, this.modResourceLoader.wolfBody_Black, this.modResourceLoader.wolfBody_Black, "Wolf", "Black");
buildPack(this.modResourceLoader.wolfBody_DarkBrown, this.modResourceLoader.wolfBody_DarkBrown, this.modResourceLoader.wolfBody_DarkBrown, "Wolf", "Brown");
buildPack(this.modResourceLoader.wolfBody_Grey, this.modResourceLoader.wolfBody_Grey, this.modResourceLoader.wolfBody_Grey, "Wolf", "Grey");
buildPack(this.modResourceLoader.neckBody_Default, this.modResourceLoader.neckBody_Default, this.modResourceLoader.neckBody_Default, "Neck", "Default");
buildPack(this.modResourceLoader.neckBody_Albino, this.modResourceLoader.neckBody_Albino, this.modResourceLoader.neckBody_Albino, "Neck", "Albino");
buildPack(this.modResourceLoader.neckBody_DarkBlue, this.modResourceLoader.neckBody_DarkBlue, this.modResourceLoader.neckBody_DarkBlue, "Neck", "Dark");
buildPack(this.modResourceLoader.neckBody_DarkGreen, this.modResourceLoader.neckBody_DarkGreen, this.modResourceLoader.neckBody_DarkGreen, "Neck", "Green");
buildPack(this.modResourceLoader.neckBody_Blue, this.modResourceLoader.neckBody_Blue, this.modResourceLoader.neckBody_Blue, "Neck", "Blue");
buildPack(this.modResourceLoader.hareBody_Default, this.modResourceLoader.hareBody_Default, this.modResourceLoader.hareBody_Default, "Hare", "Default");
buildPack(this.modResourceLoader.hareBody_Albino, this.modResourceLoader.hareBody_Albino, this.modResourceLoader.hareBody_Albino, "Hare", "Albino");
buildPack(this.modResourceLoader.hareBody_Black, this.modResourceLoader.hareBody_Black, this.modResourceLoader.hareBody_Black, "Hare", "Black");
buildPack(this.modResourceLoader.hareBody_DarkBlue, this.modResourceLoader.hareBody_DarkBlue, this.modResourceLoader.hareBody_DarkBlue, "Hare", "Blue");
buildPack(this.modResourceLoader.hareBody_Ginger, this.modResourceLoader.hareBody_Ginger, this.modResourceLoader.hareBody_Ginger, "Hare", "Ginger");
buildPack(this.modResourceLoader.drakeBody_Default, this.modResourceLoader.drakeBody_Default, this.modResourceLoader.drakeBody_Default, "Hatchling", "Default");
buildPack(this.modResourceLoader.drakeBody_Red, this.modResourceLoader.drakeBody_Red, this.modResourceLoader.drakeBody_Red, "Hatchling", "Albino");
buildPack(this.modResourceLoader.drakeBody_DarkBlue, this.modResourceLoader.drakeBody_DarkBlue, this.modResourceLoader.drakeBody_DarkBlue, "Hatchling", "Blue");
buildPack(this.modResourceLoader.drakeBody_IceBlue, this.modResourceLoader.drakeBody_IceBlue, this.modResourceLoader.drakeBody_IceBlue, "Hatchling", "Ice");
buildPack(this.modResourceLoader.drakeBody_Purple, this.modResourceLoader.drakeBody_Purple, this.modResourceLoader.drakeBody_Purple, "Hatchling", "Purple");
buildPack(this.modResourceLoader.serpentBody_Default, this.modResourceLoader.serpentBody_Default, this.modResourceLoader.serpentBody_Default, "Serpent", "Default");
buildPack(this.modResourceLoader.serpentBody_Albino, this.modResourceLoader.serpentBody_Albino, this.modResourceLoader.serpentBody_Albino, "Serpent", "Albino");
buildPack(this.modResourceLoader.serpentBody_Black, this.modResourceLoader.serpentBody_Black, this.modResourceLoader.serpentBody_Black, "Serpent", "Black");
buildPack(this.modResourceLoader.serpentBody_Blue, this.modResourceLoader.serpentBody_Blue, this.modResourceLoader.serpentBody_Blue, "Serpent", "Blue");
buildPack(this.modResourceLoader.serpentBody_Green, this.modResourceLoader.serpentBody_Green, this.modResourceLoader.serpentBody_Green, "Serpent", "Green");
buildPack(this.modResourceLoader.serpentBody_Red, this.modResourceLoader.serpentBody_Red, this.modResourceLoader.serpentBody_Red, "Serpent", "Green");
}
private void buildPack(Material face, Material body, Material body2, string name, string skin)
{
materialPacks.Add(new MaterialPack(face, body, body2, name, skin));
}
private GameObject FindItem(string name)
{
return items.Find((GameObject x) => ((Object)x).name == name);
}
public void setupFurRandomizerForMonster(GameObject monster)
{
FurRandomizer furRandomizer = monster.AddComponent<FurRandomizer>();
}
}
[Serializable]
public class FurRandomizer : MonoBehaviour
{
private ZNetView m_zview;
private MonsterAI m_monsterAI;
private Humanoid m_humanoid;
public List<MaterialPack> m_materials;
private string skinName;
public static ModResourceLoader modResourceLoader = Launch.modResourceLoader;
private List<MaterialPack> materialPacks = ItemSetBuilder.materialPacks;
private MaterialPack m_materialPack;
public SkinnedMeshRenderer face;
public SkinnedMeshRenderer body;
public SkinnedMeshRenderer fur;
private void Awake()
{
if (!validatePrefab())
{
Debug.LogWarning((object)("I should not be randomized: " + ((Object)((Component)this).gameObject).name));
return;
}
if ((Object)(object)modResourceLoader.drakeBody_DarkBlue == (Object)null)
{
Debug.LogWarning((object)"Nothing loaded");
}
m_zview = ((Component)this).GetComponent<ZNetView>();
m_monsterAI = ((Component)this).GetComponent<MonsterAI>();
m_humanoid = ((Component)this).GetComponent<Humanoid>();
if (setupFurRandomizerForMonster())
{
if (m_materials.Count == 0)
{
Debug.LogWarning((object)"Material list is empty");
}
bool @bool = m_zview.m_zdo.GetBool("furRandomizerSetActive", false);
PickRandomSet(@bool);
}
}
private bool validatePrefab()
{
string[] source = new string[6] { "Wolf", "Lox", "Serpent", "Neck", "Hatchling", "Hare" };
string name = ((Object)((Component)this).gameObject).name;
name = editZnetName(name);
return source.Contains(name);
}
private string editZnetName(string name)
{
name = name.Replace("(Clone)", "");
int num = name.IndexOf("(");
if (num >= 0)
{
name = name.Substring(0, num);
}
return name.Trim();
}
private void PickRandomSet(bool chosen = false)
{
int num = -1;
if (chosen)
{
num = m_zview.m_zdo.GetInt("furRandomizerSet", 0);
}
if (num == -1)
{
num = Random.Range(0, m_materials.Count - 1);
m_zview.m_zdo.Set("furRandomizerSet", num);
}
if (m_materials.Count - 1 < num)
{
num = Random.Range(0, m_materials.Count - 1);
m_zview.m_zdo.Set("furRandomizerSet", num);
}
if (m_materials.Count != 0)
{
MaterialPack materialPack = m_materials[num];
skinName = materialPack.skin;
m_materialPack = materialPack;
m_zview.m_zdo.Set("furRandomizerSetActive", true);
setSkin(materialPack);
}
}
private void setSkin(MaterialPack m_materialPack)
{
//IL_0098: Unknown result type (might be due to invalid IL or missing references)
//IL_009e: Expected O, but got Unknown
//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
//IL_00c5: Expected O, but got Unknown
//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
//IL_00ec: Expected O, but got Unknown
//IL_010f: Unknown result type (might be due to invalid IL or missing references)
//IL_0115: Expected O, but got Unknown
//IL_0139: Unknown result type (might be due to invalid IL or missing references)
//IL_013f: Expected O, but got Unknown
//IL_0163: Unknown result type (might be due to invalid IL or missing references)
//IL_0169: Expected O, but got Unknown
//IL_0188: Unknown result type (might be due to invalid IL or missing references)
//IL_0192: Expected O, but got Unknown
//IL_019f: Unknown result type (might be due to invalid IL or missing references)
//IL_01a9: Expected O, but got Unknown
//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
//IL_01c8: Expected O, but got Unknown
string name = ((Object)((Component)this).gameObject).name;
switch (editZnetName(name))
{
case "Lox":
{
Material[] materials2 = ((Renderer)face).materials;
materials2[0] = new Material(m_materialPack.body);
((Renderer)face).materials = materials2;
Material[] materials3 = ((Renderer)body).materials;
materials3[0] = new Material(m_materialPack.body);
((Renderer)body).materials = materials3;
Material[] materials4 = ((Renderer)fur).materials;
materials4[0] = new Material(m_materialPack.body2);
((Renderer)fur).materials = materials4;
Material[] sharedMaterials = ((Renderer)face).sharedMaterials;
sharedMaterials[1] = new Material(m_materialPack.face);
((Renderer)face).sharedMaterials = sharedMaterials;
Material[] sharedMaterials2 = ((Renderer)body).sharedMaterials;
sharedMaterials2[0] = new Material(m_materialPack.body);
((Renderer)body).sharedMaterials = sharedMaterials2;
Material[] sharedMaterials3 = ((Renderer)fur).sharedMaterials;
sharedMaterials3[0] = new Material(m_materialPack.body2);
((Renderer)fur).sharedMaterials = sharedMaterials3;
break;
}
case "Hare":
case "Serpent":
case "Neck":
case "Wolf":
((Renderer)body).sharedMaterial = new Material(m_materialPack.face);
((Renderer)body).material = new Material(m_materialPack.face);
break;
case "Hatchling":
{
Material[] materials = ((Renderer)face).materials;
materials[0] = new Material(m_materialPack.body);
((Renderer)face).materials = materials;
((Renderer)body).materials = materials;
((Renderer)fur).materials = materials;
((Renderer)face).sharedMaterials = materials;
((Renderer)body).sharedMaterials = materials;
((Renderer)fur).sharedMaterials = materials;
break;
}
}
}
private void createMaterialPacks()
{
buildPack(modResourceLoader.loxFace_Default, modResourceLoader.loxtBody_Default, modResourceLoader.loxFur_Default, "Lox", "Default");
buildPack(modResourceLoader.loxFace_Albino, modResourceLoader.loxtBody_Albino, modResourceLoader.loxFur_Albino, "Lox", "Albino");
buildPack(modResourceLoader.loxFace_Black, modResourceLoader.loxtBody_Black, modResourceLoader.loxFur_Black, "Lox", "Black");
buildPack(modResourceLoader.loxFace_Blond, modResourceLoader.loxtBody_Blond, modResourceLoader.loxFur_Blond, "Lox", "Blond");
buildPack(modResourceLoader.loxFace_DarkBrown, modResourceLoader.loxtBody_DarkBrown, modResourceLoader.loxFur_DarkBrown, "Lox", "Brown");
buildPack(modResourceLoader.loxFace_Ginger, modResourceLoader.loxtBody_Ginger, modResourceLoader.loxFur_Ginger, "Lox", "Ginger");
buildPack(modResourceLoader.wolfBody_Default, modResourceLoader.wolfBody_Default, modResourceLoader.wolfBody_Default, "Wolf", "Default");
buildPack(modResourceLoader.wolfBody_Albino, modResourceLoader.wolfBody_Albino, modResourceLoader.wolfBody_Albino, "Wolf", "Albino");
buildPack(modResourceLoader.wolfBody_Black, modResourceLoader.wolfBody_Black, modResourceLoader.wolfBody_Black, "Wolf", "Black");
buildPack(modResourceLoader.wolfBody_DarkBrown, modResourceLoader.wolfBody_DarkBrown, modResourceLoader.wolfBody_DarkBrown, "Wolf", "Brown");
buildPack(modResourceLoader.wolfBody_Grey, modResourceLoader.wolfBody_Grey, modResourceLoader.wolfBody_Grey, "Wolf", "Grey");
buildPack(modResourceLoader.neckBody_Default, modResourceLoader.neckBody_Default, modResourceLoader.neckBody_Default, "Neck", "Default");
buildPack(modResourceLoader.neckBody_Albino, modResourceLoader.neckBody_Albino, modResourceLoader.neckBody_Albino, "Neck", "Albino");
buildPack(modResourceLoader.neckBody_DarkBlue, modResourceLoader.neckBody_DarkBlue, modResourceLoader.neckBody_DarkBlue, "Neck", "Dark");
buildPack(modResourceLoader.neckBody_DarkGreen, modResourceLoader.neckBody_DarkGreen, modResourceLoader.neckBody_DarkGreen, "Neck", "Green");
buildPack(modResourceLoader.neckBody_Blue, modResourceLoader.neckBody_Blue, modResourceLoader.neckBody_Blue, "Neck", "Blue");
buildPack(modResourceLoader.hareBody_Default, modResourceLoader.hareBody_Default, modResourceLoader.hareBody_Default, "Hare", "Default");
buildPack(modResourceLoader.hareBody_Albino, modResourceLoader.hareBody_Albino, modResourceLoader.hareBody_Albino, "Hare", "Albino");
buildPack(modResourceLoader.hareBody_Black, modResourceLoader.hareBody_Black, modResourceLoader.hareBody_Black, "Hare", "Black");
buildPack(modResourceLoader.hareBody_DarkBlue, modResourceLoader.hareBody_DarkBlue, modResourceLoader.hareBody_DarkBlue, "Hare", "Blue");
buildPack(modResourceLoader.hareBody_Ginger, modResourceLoader.hareBody_Ginger, modResourceLoader.hareBody_Ginger, "Hare", "Ginger");
buildPack(modResourceLoader.drakeBody_Default, modResourceLoader.drakeBody_Default, modResourceLoader.drakeBody_Default, "Hatchling", "Default");
buildPack(modResourceLoader.drakeBody_Red, modResourceLoader.drakeBody_Red, modResourceLoader.drakeBody_Red, "Hatchling", "Albino");
buildPack(modResourceLoader.drakeBody_DarkBlue, modResourceLoader.drakeBody_DarkBlue, modResourceLoader.drakeBody_DarkBlue, "Hatchling", "Blue");
buildPack(modResourceLoader.drakeBody_IceBlue, modResourceLoader.drakeBody_IceBlue, modResourceLoader.drakeBody_IceBlue, "Hatchling", "Ice");
buildPack(modResourceLoader.drakeBody_Purple, modResourceLoader.drakeBody_Purple, modResourceLoader.drakeBody_Purple, "Hatchling", "Purple");
buildPack(modResourceLoader.serpentBody_Default, modResourceLoader.serpentBody_Default, modResourceLoader.serpentBody_Default, "Serpent", "Default");
buildPack(modResourceLoader.serpentBody_Albino, modResourceLoader.serpentBody_Albino, modResourceLoader.serpentBody_Albino, "Serpent", "Albino");
buildPack(modResourceLoader.serpentBody_Black, modResourceLoader.serpentBody_Black, modResourceLoader.serpentBody_Black, "Serpent", "Black");
buildPack(modResourceLoader.serpentBody_Blue, modResourceLoader.serpentBody_Blue, modResourceLoader.serpentBody_Blue, "Serpent", "Blue");
buildPack(modResourceLoader.serpentBody_Green, modResourceLoader.serpentBody_Green, modResourceLoader.serpentBody_Green, "Serpent", "Green");
buildPack(modResourceLoader.serpentBody_Red, modResourceLoader.serpentBody_Red, modResourceLoader.serpentBody_Red, "Serpent", "Red");
}
private void buildPack(Material face, Material body, Material body2, string name, string skin)
{
materialPacks.Add(new MaterialPack(face, body, body2, name, skin));
}
private bool setupFurRandomizerForMonster()
{
string name = ((Object)((Component)this).gameObject).name;
name = editZnetName(name);
List<MaterialPack> materials = materialPacks.FindAll((MaterialPack x) => x.animal == name);
m_materials = materials;
switch (name)
{
case "Lox":
{
Transform[] componentsInChildren2 = ((Component)this).gameObject.GetComponentsInChildren<Transform>(true);
Transform[] array2 = componentsInChildren2;
foreach (Transform val2 in array2)
{
if (((Object)((Component)val2).gameObject).name == "Body" && Object.op_Implicit((Object)(object)((Component)val2).gameObject.GetComponent<SkinnedMeshRenderer>()))
{
face = ((Component)val2).GetComponent<SkinnedMeshRenderer>();
body = ((Component)val2).GetComponent<SkinnedMeshRenderer>();
}
if (((Object)((Component)val2).gameObject).name == "Furr1" && Object.op_Implicit((Object)(object)((Component)val2).gameObject.GetComponent<SkinnedMeshRenderer>()))
{
fur = ((Component)val2).GetComponent<SkinnedMeshRenderer>();
}
}
break;
}
case "Hatchling":
{
Transform[] componentsInChildren3 = ((Component)this).gameObject.GetComponentsInChildren<Transform>(true);
Transform[] array3 = componentsInChildren3;
foreach (Transform val3 in array3)
{
if (((Object)((Component)val3).gameObject).name == "Hatchling" && Object.op_Implicit((Object)(object)((Component)val3).gameObject.GetComponent<SkinnedMeshRenderer>()))
{
body = ((Component)val3).GetComponent<SkinnedMeshRenderer>();
face = ((Component)this).gameObject.GetComponentInChildren<SkinnedMeshRenderer>();
}
if (((Object)((Component)val3).gameObject).name == "Hatchling.001" && Object.op_Implicit((Object)(object)((Component)val3).gameObject.GetComponent<SkinnedMeshRenderer>()))
{
fur = ((Component)val3).GetComponent<SkinnedMeshRenderer>();
}
}
break;
}
case "Neck":
{
Transform[] componentsInChildren = ((Component)this).gameObject.GetComponentsInChildren<Transform>(true);
Transform[] array = componentsInChildren;
foreach (Transform val in array)
{
if (((Object)((Component)val).gameObject).name == "Body" && Object.op_Implicit((Object)(object)((Component)val).GetComponent<SkinnedMeshRenderer>()))
{
face = ((Component)val).GetComponent<SkinnedMeshRenderer>();
body = ((Component)val).GetComponent<SkinnedMeshRenderer>();
fur = ((Component)val).GetComponent<SkinnedMeshRenderer>();
}
}
break;
}
case "Serpent":
case "Wolf":
case "Hare":
face = ((Component)this).gameObject.GetComponentInChildren<SkinnedMeshRenderer>(true);
body = ((Component)this).gameObject.GetComponentInChildren<SkinnedMeshRenderer>(true);
fur = ((Component)this).gameObject.GetComponentInChildren<SkinnedMeshRenderer>(true);
break;
}
if ((Object)(object)face == (Object)null || (Object)(object)body == (Object)null || (Object)(object)fur == (Object)null)
{
Debug.LogWarning((object)"Couldnt find renderers!");
return false;
}
return true;
}
}
public class LevelEffectGenerator
{
private BaseLevelEffectSetupValue baseLevelEffectSetupValue = new BaseLevelEffectSetupValue();
public void CreateVisuals(LevelEffects levelEffects)
{
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
baseLevelEffectSetupValue.getSetup(levelEffects);
int num = 0;
if (levelEffects.m_levelSetups != null)
{
num = levelEffects.m_levelSetups.Count;
}
int num2 = 6 - num;
for (int i = 0; i < num2; i++)
{
LevelSetup item = createSetup(baseLevelEffectSetupValue.scale, baseLevelEffectSetupValue.saturation, baseLevelEffectSetupValue.hue, baseLevelEffectSetupValue.value, baseLevelEffectSetupValue.setEmmisive, baseLevelEffectSetupValue.emissive, baseLevelEffectSetupValue.sumValue * (float)(i + 1), num2, i + 1);
levelEffects.m_levelSetups.Add(item);
}
}
public LevelEffects CreateLevelEffectAt(Transform visual, SkinnedMeshRenderer meshRenderer)
{
if ((Object)(object)meshRenderer == (Object)null)
{
Debug.LogWarning((object)("NO renderer to create Visual Effects:" + ((Object)visual.parent).name));
return null;
}
if ((Object)(object)meshRenderer != (Object)null)
{
LevelEffects val = ((Component)visual).gameObject.AddComponent<LevelEffects>();
val.m_mainRender = (Renderer)(object)meshRenderer;
val.m_character = (Character)(object)((Component)visual.parent).gameObject.GetComponent<Humanoid>();
return val;
}
return null;
}
public LevelEffects CreateLevelEffectComponent(Transform visual)
{
SkinnedMeshRenderer[] componentsInChildren = ((Component)visual).GetComponentsInChildren<SkinnedMeshRenderer>();
if (componentsInChildren.Length > 1)
{
Debug.LogWarning((object)("To many renderers to create Visual Effects:" + ((Object)visual.parent).name));
return null;
}
if (componentsInChildren.Length == 1)
{
LevelEffects val = ((Component)visual).gameObject.AddComponent<LevelEffects>();
val.m_mainRender = (Renderer)(object)componentsInChildren[0];
val.m_character = (Character)(object)((Component)visual.parent).gameObject.GetComponent<Humanoid>();
return val;
}
return null;
}
private LevelSetup createSetup(float scale, float saturation, float hue, float value, bool isEmmisive, Color emission, float changeValue, int maxAmount, int lvl)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Expected O, but got Unknown
//IL_0049: 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_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
//IL_0073: Unknown result type (might be due to invalid IL or missing references)
LevelSetup val = new LevelSetup();
val.m_scale = scale + changeValue;
val.m_saturation = saturation + changeValue;
val.m_hue = hue + changeValue;
val.m_value = value + changeValue;
val.m_enableObject = pickEnabledObject(maxAmount, lvl);
val.m_setEmissiveColor = isEmmisive;
val.m_emissiveColor = new Color(emission.r + changeValue, emission.g + changeValue, emission.b + changeValue, emission.a);
return val;
}
private GameObject pickEnabledObject(int maxAmount, int lvl)
{
if (maxAmount == 6)
{
if (lvl > 4)
{
return baseLevelEffectSetupValue.enabledObjectLevel3;
}
if (lvl > 2)
{
return baseLevelEffectSetupValue.enabledObjectLevel2;
}
}
if (maxAmount == 3)
{
if (lvl > 3)
{
return baseLevelEffectSetupValue.enabledObjectLevel3;
}
if (lvl > 2)
{
return baseLevelEffectSetupValue.enabledObjectLevel2;
}
}
if (maxAmount < 3)
{
switch (lvl)
{
case 2:
return baseLevelEffectSetupValue.enabledObjectLevel3;
case 1:
return baseLevelEffectSetupValue.enabledObjectLevel2;
}
}
return baseLevelEffectSetupValue.enabledObject;
}
}
[Serializable]
public class MaterialPack
{
public Material face;
public Material body;
public Material body2;
public string animal;
public string skin;
public MaterialPack(Material body, Material body2, Material face, string monsterName, string skinName)
{
animal = monsterName;
this.face = face;
this.body = body;
this.body2 = body2;
skin = skinName;
}
}
public class BuildPieceTargeting
{
private static string[] names = new string[0];
public void changePieceTargeting(List<GameObject> gameObjects)
{
List<GameObject> list = gameObjects.FindAll((GameObject x) => (Object)(object)x.GetComponent<WearNTear>() != (Object)null);
foreach (GameObject item in list)
{
Piece component = item.GetComponent<Piece>();
if ((Object)(object)component != (Object)null && names.Contains(((Object)item).name))
{
((StaticTarget)component).m_primaryTarget = true;
}
if ((Object)(object)component != (Object)null && shouldBePrimaryTarget(item))
{
((StaticTarget)component).m_primaryTarget = true;
}
setResistances(item);
}
}
private bool shouldBePrimaryTarget(GameObject gameObject)
{
if ((Object)(object)gameObject.GetComponent<Door>() != (Object)null)
{
return true;
}
if ((Object)(object)gameObject.GetComponent<CraftingStation>() != (Object)null)
{
return true;
}
if ((Object)(object)gameObject.GetComponent<StationExtension>() != (Object)null)
{
return true;
}
if ((Object)(object)gameObject.GetComponent<Container>() != (Object)null)
{
return false;
}
return false;
}
private void setResistances(GameObject gameObject)
{
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
WearNTear component = gameObject.GetComponent<WearNTear>();
if ((Object)(object)component != (Object)null)
{
component.m_damages.m_chop = setChopDamageResistance(component);
component.m_damages.m_pickaxe = setPickaxeDamageResistance(component);
component.m_damages.m_fire = setFireDamageResistance(component);
}
}
private DamageModifier setChopDamageResistance(WearNTear wearNTear)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Expected I4, but got Unknown
//IL_0023: 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_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
MaterialType materialType = wearNTear.m_materialType;
MaterialType val = materialType;
return (DamageModifier)((int)val switch
{
0 => 6,
3 => 2,
2 => 5,
1 => 1,
_ => 0,
});
}
private DamageModifier setPickaxeDamageResistance(WearNTear wearNTear)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Expected I4, but got Unknown
//IL_0023: 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_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
MaterialType materialType = wearNTear.m_materialType;
MaterialType val = materialType;
return (DamageModifier)((int)val switch
{
0 => 0,
3 => 1,
2 => 2,
1 => 6,
_ => 0,
});
}
private DamageModifier setFireDamageResistance(WearNTear wearNTear)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Expected I4, but got Unknown
//IL_0023: 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_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
MaterialType materialType = wearNTear.m_materialType;
MaterialType val = materialType;
return (DamageModifier)((int)val switch
{
0 => 6,
3 => 2,
2 => 0,
1 => 5,
_ => 0,
});
}
}
public class DatabaseAddMethods
{
public void AddItems(List<GameObject> items)
{
foreach (GameObject item in items)
{
AddItem(item);
}
}
public void AddRecipes(List<Recipe> recipes)
{
foreach (Recipe recipe in recipes)
{
AddRecipe(recipe);
}
}
public void AddStatuseffects(List<StatusEffect> statusEffects)
{
foreach (StatusEffect statusEffect in statusEffects)
{
AddStatus(statusEffect);
}
}
private bool IsObjectDBValid()
{
return (Object)(object)ObjectDB.instance != (Object)null && ObjectDB.instance.m_items.Count != 0 && ObjectDB.instance.m_recipes.Count != 0 && (Object)(object)ObjectDB.instance.GetItemPrefab("Amber") != (Object)null;
}
private void AddStatus(StatusEffect status)
{
if (!IsObjectDBValid())
{
return;
}
if ((Object)(object)status != (Object)null)
{
if ((Object)(object)ObjectDB.instance.GetStatusEffect(((object)status).GetHashCode()) == (Object)null)
{
ObjectDB.instance.m_StatusEffects.Add(status);
}
}
else
{
Debug.LogError((object)("BalrondFurRandomizer: " + ((Object)status).name + " - Status not found"));
}
}
private void AddRecipe(Recipe recipe)
{
if (!IsObjectDBValid())
{
return;
}
if ((Object)(object)recipe != (Object)null)
{
if ((Object)(object)ObjectDB.instance.GetRecipe(recipe.m_item.m_itemData) == (Object)null)
{
ObjectDB.instance.m_recipes.Add(recipe);
}
}
else
{
Debug.LogError((object)("BalrondFurRandomizer: " + ((Object)recipe).name + " - Recipe not found"));
}
}
private void AddItem(GameObject newPrefab)
{
if (!IsObjectDBValid())
{
return;
}
ItemDrop component = newPrefab.GetComponent<ItemDrop>();
if ((Object)(object)component != (Object)null)
{
if ((Object)(object)ObjectDB.instance.GetItemPrefab(((Object)newPrefab).name) == (Object)null)
{
ObjectDB.instance.m_items.Add(newPrefab);
Dictionary<int, GameObject> dictionary = (Dictionary<int, GameObject>)typeof(ObjectDB).GetField("m_itemByHash", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(ObjectDB.instance);
dictionary[((Object)newPrefab).name.GetHashCode()] = newPrefab;
}
}
else
{
Debug.LogError((object)("BalrondFurRandomizer: " + ((Object)newPrefab).name + " - ItemDrop not found on prefab"));
}
}
}
[BepInPlugin("balrond.astafaraios.BalrondFurRandomizer", "BalrondFurRandomizer", "1.0.4")]
public class Launch : BaseUnityPlugin
{
[HarmonyPatch(typeof(Game), "Awake")]
public static class Game_Awake_Path
{
public static void Prefix()
{
ZNetScene_Awake_Path.hasSpawned = false;
}
}
[HarmonyPriority(700)]
[HarmonyPatch(typeof(FejdStartup), "Awake")]
private static class Replace_ShaderPatch
{
public static void Postfix()
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
if (!new ZNet().IsDedicated())
{
ShaderReplacment.findShadersByName();
ShaderReplacment.fixMaterial(ShaderReplacment.GOToSwapMaterial.ToArray());
}
}
}
[HarmonyPatch(typeof(ObjectDB), "CopyOtherDB")]
public static class Object_CopyOtherDB_Path
{
public static void Postfix()
{
if (IsObjectDBValid())
{
}
}
}
[HarmonyPatch(typeof(ObjectDB), "Awake")]
public static class ObjectDB_Awake_Path
{
public static void Postfix()
{
if (IsObjectDBValid())
{
}
}
}
[HarmonyPatch(typeof(Character), "OnDeath")]
public static class Character_OnDeath_Path
{
public static bool hasSpawned;
public static void Prefix(Character __instance)
{
if ((Object)(object)__instance != (Object)null)
{
EffectData[] effectPrefabs = __instance.m_deathEffects.m_effectPrefabs;
foreach (EffectData val in effectPrefabs)
{
Ragdoll component = val.m_prefab.GetComponent<Ragdoll>();
if ((Object)(object)component != (Object)null)
{
LevelEffects componentInChildren = ((Component)__instance).GetComponentInChildren<LevelEffects>();
if ((Object)(object)componentInChildren != (Object)null && (Object)(object)componentInChildren.m_mainRender != (Object)null && componentInChildren.m_mainRender.sharedMaterials.Length != 0 && (Object)(object)component.m_mainModel != (Object)null)
{
component.m_mainModel.sharedMaterials = componentInChildren.m_mainRender.sharedMaterials;
}
}
}
}
else
{
Debug.LogWarning((object)"Instance dont yet exists");
}
}
}
[HarmonyPatch(typeof(LevelEffects), "SetupLevelVisualization")]
public static class LevelEffects_Awake_Path
{
public static bool hasSpawned;
public static bool Prefix(LevelEffects __instance, int level)
{
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: Expected O, but got Unknown
//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
if (level <= 1 || __instance.m_levelSetups.Count < level - 1)
{
return false;
}
LevelSetup val = __instance.m_levelSetups[level - 2];
((Component)__instance).transform.localScale = new Vector3(val.m_scale, val.m_scale, val.m_scale);
if (Object.op_Implicit((Object)(object)__instance.m_mainRender))
{
Material[] sharedMaterials = __instance.m_mainRender.sharedMaterials;
sharedMaterials[0] = new Material(sharedMaterials[0]);
sharedMaterials[0].SetFloat("_Hue", val.m_hue);
sharedMaterials[0].SetFloat("_Saturation", val.m_saturation);
sharedMaterials[0].SetFloat("_Value", val.m_value);
if (val.m_setEmissiveColor)
{
sharedMaterials[0].SetColor("_EmissionColor", val.m_emissiveColor);
}
__instance.m_mainRender.sharedMaterials = sharedMaterials;
string key = Utils.GetPrefabName(((Component)__instance.m_character).gameObject) + level;
LevelEffects.m_materials[key] = sharedMaterials[0];
}
if (Object.op_Implicit((Object)(object)__instance.m_baseEnableObject))
{
__instance.m_baseEnableObject.SetActive(false);
}
if (!Object.op_Implicit((Object)(object)val.m_enableObject))
{
return false;
}
val.m_enableObject.SetActive(true);
return false;
}
}
[HarmonyPatch(typeof(ZNetScene), "Awake")]
public static class ZNetScene_Awake_Path
{
public static bool hasSpawned;
public static void Prefix(ZNetScene __instance)
{
if ((Object)(object)__instance == (Object)null)
{
Debug.LogWarning((object)"BalrondFurRandomizer: No ZnetScene found");
}
else if (!hasSpawned)
{
itemSetBuilder.createMaterialPacks(modResourceLoader);
GameObject monster = __instance.m_prefabs.Find((GameObject x) => ((Object)x).name == "Wolf");
GameObject monster2 = __instance.m_prefabs.Find((GameObject x) => ((Object)x).name == "Neck");
GameObject monster3 = __instance.m_prefabs.Find((GameObject x) => ((Object)x).name == "Hare");
GameObject monster4 = __instance.m_prefabs.Find((GameObject x) => ((Object)x).name == "Serpent");
GameObject monster5 = __instance.m_prefabs.Find((GameObject x) => ((Object)x).name == "Hatchling");
GameObject monster6 = __instance.m_prefabs.Find((GameObject x) => ((Object)x).name == "Lox");
itemSetBuilder.setupFurRandomizerForMonster(monster);
itemSetBuilder.setupFurRandomizerForMonster(monster2);
itemSetBuilder.setupFurRandomizerForMonster(monster3);
itemSetBuilder.setupFurRandomizerForMonster(monster4);
itemSetBuilder.setupFurRandomizerForMonster(monster5);
itemSetBuilder.setupFurRandomizerForMonster(monster6);
hasSpawned = true;
}
}
}
private readonly Harmony harmony = new Harmony("balrond.astafaraios.BalrondFurRandomizer");
public const string PluginGUID = "balrond.astafaraios.BalrondFurRandomizer";
public const string PluginName = "BalrondFurRandomizer";
public const string PluginVersion = "1.0.4";
public static ModResourceLoader modResourceLoader = new ModResourceLoader();
public static ItemEdits itemEdits = new ItemEdits();
public static DatabaseAddMethods databaseAddMethods = new DatabaseAddMethods();
public static MonsterManager monsterSpiritResistanceManager = new MonsterManager();
public static BuildPieceTargeting pieceTargeting = new BuildPieceTargeting();
public static ItemSetBuilder itemSetBuilder = new ItemSetBuilder();
public static GameObject gui;
public static GameObject gui2;
public static GameObject RootObject;
public static GameObject PrefabContainer;
private void Awake()
{
createPrefabContainer();
modResourceLoader.loadAssets();
harmony.PatchAll();
}
private void OnDestroy()
{
harmony.UnpatchSelf();
}
public void createPrefabContainer()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Expected O, but got Unknown
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Expected O, but got Unknown
RootObject = new GameObject("_ValheimReforgedRoot");
Object.DontDestroyOnLoad((Object)(object)RootObject);
PrefabContainer = new GameObject("Prefabs");
PrefabContainer.transform.parent = RootObject.transform;
PrefabContainer.SetActive(false);
}
public static GameObject cloneMe(GameObject source, string name)
{
GameObject val = Object.Instantiate<GameObject>(source, PrefabContainer.transform);
((Object)val).name = name;
return val;
}
private static bool IsObjectDBValid()
{
return (Object)(object)ObjectDB.instance != (Object)null && ObjectDB.instance.m_items.Count != 0 && ObjectDB.instance.m_recipes.Count != 0 && (Object)(object)ObjectDB.instance.GetItemPrefab("Amber") != (Object)null;
}
public static void addStatusToAttackField(GameObject gameObject, StatusEffect statusEffect)
{
ItemDrop component = gameObject.GetComponent<ItemDrop>();
component.m_itemData.m_shared.m_attackStatusEffect = statusEffect;
}
}
public class ModResourceLoader
{
public AssetBundle assetBundle;
public Material loxFace_Default;
public Material loxtBody_Default;
public Material loxFur_Default;
public Material loxFace_Albino;
public Material loxtBody_Albino;
public Material loxFur_Albino;
public Material loxFace_Black;
public Material loxtBody_Black;
public Material loxFur_Black;
public Material loxFace_Blond;
public Material loxtBody_Blond;
public Material loxFur_Blond;
public Material loxFace_DarkBrown;
public Material loxtBody_DarkBrown;
public Material loxFur_DarkBrown;
public Material loxFace_Ginger;
public Material loxtBody_Ginger;
public Material loxFur_Ginger;
public Material wolfBody_Default;
public Material wolfBody_Albino;
public Material wolfBody_Black;
public Material wolfBody_DarkBrown;
public Material wolfBody_Grey;
public Material neckBody_Default;
public Material neckBody_Albino;
public Material neckBody_Blue;
public Material neckBody_DarkBlue;
public Material neckBody_DarkGreen;
public Material hareBody_Default;
public Material hareBody_Albino;
public Material hareBody_Black;
public Material hareBody_DarkBlue;
public Material hareBody_Ginger;
public Material drakeBody_Default;
public Material drakeBody_DarkBlue;
public Material drakeBody_IceBlue;
public Material drakeBody_Purple;
public Material drakeBody_Red;
public Material serpentBody_Default;
public Material serpentBody_Albino;
public Material serpentBody_Black;
public Material serpentBody_Blue;
public Material serpentBody_Green;
public Material serpentBody_Red;
public void loadAssets()
{
assetBundle = GetAssetBundleFromResources("furrandomizer");
string text = "Assets/BalrondFurRandomizer/";
Material temp = assetBundle.LoadAsset<Material>(text + "Lox/Default/lox_face.mat");
CreateLoxMaterial(temp, text);
CreateWolfMaterial(temp, text);
CreateNeckMaterial(temp, text);
CreateHareMaterial(temp, text);
CreateDrakeMaterial(temp, text);
CreateSerpentMaterials(temp, text);
}
private void CreateLoxMaterial(Material temp, string mainPath)
{
loxFace_Default = temp;
temp = assetBundle.LoadAsset<Material>(mainPath + "Lox/Default/lox_body1.mat");
ShaderReplacment.ReplaceMaterial(temp);
loxtBody_Default = temp;
temp = assetBundle.LoadAsset<Material>(mainPath + "Lox/Default/lox_fur1.mat");
ShaderReplacment.ReplaceMaterial(temp);
loxFur_Default = temp;
temp = assetBundle.LoadAsset<Material>(mainPath + "Lox/Albino/lox_face.mat");
ShaderReplacment.ReplaceMaterial(temp);
loxFace_Albino = temp;
temp = assetBundle.LoadAsset<Material>(mainPath + "Lox/Albino/lox_body1.mat");
ShaderReplacment.ReplaceMaterial(temp);
loxtBody_Albino = temp;
temp = assetBundle.LoadAsset<Material>(mainPath + "Lox/Albino/lox_fur1.mat");
ShaderReplacment.ReplaceMaterial(temp);
loxFur_Albino = temp;
temp = assetBundle.LoadAsset<Material>(mainPath + "Lox/Black/lox_face.mat");
loxFace_Black = temp;
temp = assetBundle.LoadAsset<Material>(mainPath + "Lox/Black/lox_body1.mat");
loxtBody_Black = temp;
temp = assetBundle.LoadAsset<Material>(mainPath + "Lox/Black/lox_fur1.mat");
loxFur_Black = temp;
temp = assetBundle.LoadAsset<Material>(mainPath + "Lox/Blonde/lox_face.mat");
loxFace_Blond = temp;
temp = assetBundle.LoadAsset<Material>(mainPath + "Lox/Blonde/lox_body1.mat");
loxtBody_Blond = temp;
temp = assetBundle.LoadAsset<Material>(mainPath + "Lox/Blonde/lox_fur1.mat");
loxFur_Blond = temp;
temp = assetBundle.LoadAsset<Material>(mainPath + "Lox/DarkBrown/lox_face.mat");
loxFace_DarkBrown = temp;
temp = assetBundle.LoadAsset<Material>(mainPath + "Lox/DarkBrown/lox_body1.mat");
loxtBody_DarkBrown = temp;
temp = assetBundle.LoadAsset<Material>(mainPath + "Lox/DarkBrown/lox_fur1.mat");
loxFur_DarkBrown = temp;
temp = assetBundle.LoadAsset<Material>(mainPath + "Lox/Ginger/lox_face.mat");
loxFace_Ginger = temp;
temp = assetBundle.LoadAsset<Material>(mainPath + "Lox/Ginger/lox_body1.mat");
loxtBody_Ginger = temp;
temp = assetBundle.LoadAsset<Material>(mainPath + "Lox/Ginger/lox_fur1.mat");
loxFur_Ginger = temp;
}
private void CreateWolfMaterial(Material temp, string mainPath)
{
temp = assetBundle.LoadAsset<Material>(mainPath + "Wolf/Default/wolfMat.mat");
ShaderReplacment.ReplaceMaterial(temp);
wolfBody_Default = temp;
temp = assetBundle.LoadAsset<Material>(mainPath + "Wolf/Albino/wolfMat.mat");
ShaderReplacment.ReplaceMaterial(temp);
wolfBody_Albino = temp;
temp = assetBundle.LoadAsset<Material>(mainPath + "Wolf/Black/wolfMat.mat");
ShaderReplacment.ReplaceMaterial(temp);
wolfBody_Black = temp;
temp = assetBundle.LoadAsset<Material>(mainPath + "Wolf/DarkBrown/wolfMat.mat");
ShaderReplacment.ReplaceMaterial(temp);
wolfBody_DarkBrown = temp;
temp = assetBundle.LoadAsset<Material>(mainPath + "Wolf/Grey/wolfMat.mat");
ShaderReplacment.ReplaceMaterial(temp);
wolfBody_Grey = temp;
}
private void CreateNeckMaterial(Material temp, string mainPath)
{
temp = assetBundle.LoadAsset<Material>(mainPath + "Neck/Default/neck1.mat");
ShaderReplacment.ReplaceMaterial(temp);
neckBody_Default = temp;
temp = assetBundle.LoadAsset<Material>(mainPath + "Neck/Albino/neck1.mat");
ShaderReplacment.ReplaceMaterial(temp);
neckBody_Albino = temp;
temp = assetBundle.LoadAsset<Material>(mainPath + "Neck/Blue/neck1.mat");
ShaderReplacment.ReplaceMaterial(temp);
neckBody_Blue = temp;
temp = assetBundle.LoadAsset<Material>(mainPath + "Neck/DarkBlue/neck1.mat");
ShaderReplacment.ReplaceMaterial(temp);
neckBody_DarkBlue = temp;
temp = assetBundle.LoadAsset<Material>(mainPath + "Neck/DarkGreen/neck1.mat");
ShaderReplacment.ReplaceMaterial(temp);
neckBody_DarkGreen = temp;
}
private void CreateHareMaterial(Material temp, string mainPath)
{
temp = assetBundle.LoadAsset<Material>(mainPath + "Hare/Default/Hare_mat1.mat");
ShaderReplacment.ReplaceMaterial(temp);
hareBody_Default = temp;
temp = assetBundle.LoadAsset<Material>(mainPath + "Hare/Albino/Hare_mat1.mat");
ShaderReplacment.ReplaceMaterial(temp);
hareBody_Albino = temp;
temp = assetBundle.LoadAsset<Material>(mainPath + "Hare/Black/Hare_mat1.mat");
ShaderReplacment.ReplaceMaterial(temp);
hareBody_Black = temp;
temp = assetBundle.LoadAsset<Material>(mainPath + "Hare/DarkBlue/Hare_mat1.mat");
ShaderReplacment.ReplaceMaterial(temp);
hareBody_DarkBlue = temp;
temp = assetBundle.LoadAsset<Material>(mainPath + "Hare/Ginger/Hare_mat1.mat");
ShaderReplacment.ReplaceMaterial(temp);
hareBody_Ginger = temp;
}
private void CreateDrakeMaterial(Material temp, string mainPath)
{
temp = assetBundle.LoadAsset<Material>(mainPath + "Drake/Default/Hatchling_mountain_mat1.mat");
ShaderReplacment.ReplaceMaterial(temp);
drakeBody_Default = temp;
temp = assetBundle.LoadAsset<Material>(mainPath + "Drake/DarkBlue/Hatchling_mountain_mat1.mat");
ShaderReplacment.ReplaceMaterial(temp);
drakeBody_DarkBlue = temp;
temp = assetBundle.LoadAsset<Material>(mainPath + "Drake/IceBlue/Hatchling_mountain_mat1.mat");
ShaderReplacment.ReplaceMaterial(temp);
drakeBody_IceBlue = temp;
temp = assetBundle.LoadAsset<Material>(mainPath + "Drake/Purple/Hatchling_mountain_mat1.mat");
ShaderReplacment.ReplaceMaterial(temp);
drakeBody_Purple = temp;
temp = assetBundle.LoadAsset<Material>(mainPath + "Drake/Red/Hatchling_mountain_mat1.mat");
ShaderReplacment.ReplaceMaterial(temp);
drakeBody_Red = temp;
}
private void CreateSerpentMaterials(Material temp, string mainPath)
{
temp = assetBundle.LoadAsset<Material>(mainPath + "Serpent/Default/SeaSerpent_mat1.mat");
ShaderReplacment.ReplaceMaterial(temp);
serpentBody_Default = temp;
temp = assetBundle.LoadAsset<Material>(mainPath + "Serpent/Albino/SeaSerpent_mat1.mat");
ShaderReplacment.ReplaceMaterial(temp);
serpentBody_Albino = temp;
temp = assetBundle.LoadAsset<Material>(mainPath + "Serpent/Black/SeaSerpent_mat1.mat");
ShaderReplacment.ReplaceMaterial(temp);
serpentBody_Black = temp;
temp = assetBundle.LoadAsset<Material>(mainPath + "Serpent/Blue/SeaSerpent_mat1.mat");
ShaderReplacment.ReplaceMaterial(temp);
serpentBody_Blue = temp;
temp = assetBundle.LoadAsset<Material>(mainPath + "Serpent/Green/SeaSerpent_mat1.mat");
ShaderReplacment.ReplaceMaterial(temp);
serpentBody_Green = temp;
temp = assetBundle.LoadAsset<Material>(mainPath + "Serpent/Red/SeaSerpent_mat1.mat");
ShaderReplacment.ReplaceMaterial(temp);
serpentBody_Red = temp;
}
private AssetBundle GetAssetBundleFromResources(string filename)
{
Assembly executingAssembly = Assembly.GetExecutingAssembly();
string name = executingAssembly.GetManifestResourceNames().Single((string str) => str.EndsWith(filename));
using Stream stream = executingAssembly.GetManifestResourceStream(name);
return AssetBundle.LoadFromStream(stream);
}
}
public class MonsterManager
{
private GameObject levelEffects = null;
private GameObject stealEffect = null;
private LevelEffectGenerator levelEffectGenerator = new LevelEffectGenerator();
private List<GameObject> monsters;
private string[] names = new string[0];
private string[] thiefName = new string[14]
{
"Greyling", "Greydwarf", "Greydwarf_Elite", "Draugr", "Draugr_Elite", "Draugr_Ranged", "Skeleton", "Skeleton_NoArcher", "Skeleton_Poison", "Forsaken",
"GoblinBrute", "GoblinArcher", "Goblin", "GoblinShaman"
};
public void SetVfx(GameObject levelEffects, GameObject stealEffect)
{
this.levelEffects = levelEffects;
this.stealEffect = stealEffect;
}
public void setupMonsterList(List<GameObject> list)
{
if (list == null)
{
Debug.LogWarning((object)"I DID NOT FOUND PREFAB LIST!");
return;
}
monsters = list.FindAll((GameObject x) => (Object)(object)x.GetComponent<MonsterAI>() != (Object)null);
}
public void changeMonsterResistance()
{
if (monsters == null)
{
Debug.LogWarning((object)"I DID NOT FOUND ANY MONSTERS!");
return;
}
foreach (GameObject monster in monsters)
{
Humanoid component = monster.GetComponent<Humanoid>();
SetupLevelVisual(monster);
if ((Object)(object)component != (Object)null)
{
changeResistanceForException(component);
}
}
}
private void SetupLevelVisual(GameObject gameObject)
{
Transform visual = gameObject.transform.Find("Visual");
LevelEffects val = gameObject.GetComponentInChildren<LevelEffects>();
bool flag = true;
string[] source = new string[15]
{
"Lox", "Wraith", "TentaRoot", "TheHive", "Hatchling", "GoblinKing", "Eikthyr", "Bonemass", "Frog", "Haugbui",
"Greydwarf_Mystic", "Varsvin", "Varsvin_Brute", "Varsvin_Hunter", "SeekerQueen"
};
if (((Object)gameObject).name == "TheHive" || ((Object)gameObject).name == "Haugbui" || ((Object)gameObject).name == "Greydwarf_Mystic")
{
return;
}
if (source.Contains(((Object)gameObject).name))
{
Transform val2 = null;
switch (((Object)gameObject).name)
{
case "Lox":
val2 = gameObject.transform.Find("Visual/offset/Body");
break;
case "Wraith":
val2 = gameObject.transform.Find("Visual/wraith/wraith");
break;
case "TentaRoot":
val2 = gameObject.transform.Find("Visual/Tentaroots/Cube.001");
break;
case "Hatchling":
val2 = gameObject.transform.Find("Visual/Hatchling_mountain/Hatchling");
break;
case "GoblinKing":
val2 = gameObject.transform.Find("Visual/Yagluth");
break;
case "Eikthyr":
val2 = gameObject.transform.Find("Visual/Deer");
break;
case "Bonemass":
val2 = gameObject.transform.Find("Visual/model/bonemass");
break;
case "Varsvin":
case "Varsvin_Brute":
case "Varsvin_Hunter":
val2 = gameObject.transform.Find("Visual/Body");
break;
case "Frog":
val2 = gameObject.transform.Find("Visual/Frog2_mesh");
break;
case "Haugbui":
val2 = gameObject.transform.Find("Visual/Frog2_mesh");
break;
case "Greydwarf_Mystic":
val2 = gameObject.transform.Find("Visual/Frog2_mesh");
break;
case "SeekerQueen":
val2 = gameObject.transform.Find("Visual/Cube");
break;
}
if ((Object)(object)val2 == (Object)null)
{
return;
}
val = levelEffectGenerator.CreateLevelEffectAt(visual, ((Component)val2).GetComponent<SkinnedMeshRenderer>());
}
else if (flag && (Object)(object)val == (Object)null)
{
val = levelEffectGenerator.CreateLevelEffectComponent(visual);
}
if ((Object)(object)val != (Object)null)
{
levelEffectGenerator.CreateVisuals(val);
}
}
private void changeSpiritResistance(Humanoid humanoid)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Expected I4, but got Unknown
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_006f: 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_0053: 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)
Faction faction = ((Character)humanoid).m_faction;
Faction val = faction;
switch (val - 1)
{
case 0:
((Character)humanoid).m_damageModifiers.m_spirit = (DamageModifier)0;
break;
case 1:
((Character)humanoid).m_damageModifiers.m_spirit = (DamageModifier)1;
break;
case 5:
((Character)humanoid).m_damageModifiers.m_spirit = (DamageModifier)5;
break;
case 2:
((Character)humanoid).m_damageModifiers.m_spirit = (DamageModifier)6;
break;
case 3:
((Character)humanoid).m_damageModifiers.m_spirit = (DamageModifier)2;
break;
case 6:
((Character)humanoid).m_damageModifiers.m_spirit = (DamageModifier)0;
break;
case 4:
((Character)humanoid).m_damageModifiers.m_spirit = (DamageModifier)5;
break;
}
}
private void changeResistanceForException(Humanoid humanoid)
{
changeSpiritResistance(humanoid);
}
}
public class ItemEdits
{
private string[] itemEditNames = new string[14]
{
"draugr_sword", "draugr_bow", "draugr_axe", "skeleton_bow", "skeleton_mace", "skeleton_sword2", "skeleton_bow2", "skeleton_sword2", "imp_fireball_attack", "Ghost_attack",
"gd_king_shoot", "Greydwarf_shaman_attack", "GoblinKing_Beam", "GoblinShaman_attack_fireball"
};
private GameObject FindItem(List<GameObject> list, string name)
{
GameObject val = list.Find((GameObject x) => ((Object)x).name == name);
if ((Object)(object)val != (Object)null)
{
return val;
}
Debug.LogWarning((object)("BalrondFurRandomizer: Item Not Found: " + name));
return null;
}
public void editItems(List<GameObject> list)
{
string[] array = itemEditNames;
foreach (string text in array)
{
GameObject val = FindItem(list, text);
if ((Object)(object)val == (Object)null)
{
Debug.LogWarning((object)("Could not find: " + text));
}
else
{
CheckStats(val);
}
}
}
private void CheckStats(GameObject gameObject)
{
switch (((Object)gameObject).name)
{
case "draugr_sword":
editSpiritDamageStat(gameObject, 25);
break;
case "draugr_bow":
editSpiritDamageStat(gameObject, 15);
break;
case "draugr_axe":
editSpiritDamageStat(gameObject, 15);
break;
case "skeleton_bow":
case "skeleton_sword":
case "Ghost_attack":
editSpiritDamageStat(gameObject, 10);
break;
case "skeleton_bow2":
case "skeleton_mace":
case "skeleton_sword2":
case "gd_king_shoot":
case "Greydwarf_shaman_attack":
case "GoblinKing_Beam":
case "GoblinShaman_attack_fireball":
editSpiritDamageStat(gameObject, 20);
break;
case "imp_fireball_attack":
editSpiritDamageStat(gameObject, 10);
break;
}
}
private void editSpiritDamageStat(GameObject gameObject, int spiritDamage)
{
ItemDrop component = gameObject.GetComponent<ItemDrop>();
component.m_itemData.m_shared.m_damages.m_spirit = spiritDamage;
if (((Object)gameObject).name == "skeleton_mace" || ((Object)gameObject).name == "imp_fireball_attack")
{
component.m_itemData.m_shared.m_damages.m_blunt += spiritDamage;
}
}
private void editFoodStat(GameObject gameObject, int hp = -99, int stam = -99, int eitr = -99, int time = -99, int regen = -99)
{
ItemDrop component = gameObject.GetComponent<ItemDrop>();
component.m_itemData.m_shared.m_food = ((hp == -99) ? component.m_itemData.m_shared.m_food : ((float)hp));
component.m_itemData.m_shared.m_foodStamina = ((stam == -99) ? component.m_itemData.m_shared.m_foodStamina : ((float)stam));
component.m_itemData.m_shared.m_foodEitr = ((eitr == -99) ? component.m_itemData.m_shared.m_foodEitr : ((float)eitr));
component.m_itemData.m_shared.m_foodRegen = ((regen == -99) ? component.m_itemData.m_shared.m_foodRegen : ((float)regen));
component.m_itemData.m_shared.m_foodBurnTime = ((time == -99) ? component.m_itemData.m_shared.m_foodBurnTime : ((float)time));
}
}
public class StatusEffectBuilder
{
public List<StatusEffect> statusEffects = new List<StatusEffect>();
public void setShieldStatus(SE_LevelShield statusEffect, Sprite icon)
{
((StatusEffect)statusEffect).m_icon = icon;
((StatusEffect)statusEffect).m_ttl = 40f;
((Object)statusEffect).name = "SE_LevelShield";
((StatusEffect)statusEffect).m_name = "Shield_MonsterRandomizer";
((StatusEffect)statusEffect).m_tooltip = "You been shielded";
((StatusEffect)statusEffect).m_activationAnimation = "";
statusEffects.Add((StatusEffect)(object)statusEffect);
}
public void setBleedingStatus(SE_bleed statusEffect, Sprite icon)
{
((StatusEffect)statusEffect).m_icon = icon;
((StatusEffect)statusEffect).m_ttl = 60f;
((StatusEffect)statusEffect).m_tooltip = "You been slashed open. Any more cuts will hurt more";
((StatusEffect)statusEffect).m_activationAnimation = "encumbered";
statusEffects.Add((StatusEffect)(object)statusEffect);
}
public void setPiercedStatus(SE_pierced statusEffect, Sprite icon)
{
((StatusEffect)statusEffect).m_icon = icon;
((StatusEffect)statusEffect).m_ttl = 60f;
((StatusEffect)statusEffect).m_tooltip = "You been pierced. Another stab like that will be more fatal";
((StatusEffect)statusEffect).m_activationAnimation = "encumbered";
statusEffects.Add((StatusEffect)(object)statusEffect);
}
public void setCrushedStatus(SE_crushed statusEffect, Sprite icon)
{
((StatusEffect)statusEffect).m_icon = icon;
((StatusEffect)statusEffect).m_ttl = 60f;
((StatusEffect)statusEffect).m_tooltip = "Your bone was crushed. Another blunt hit will be fatal";
((StatusEffect)statusEffect).m_activationAnimation = "encumbered";
statusEffects.Add((StatusEffect)(object)statusEffect);
}
public void setBadgaesStatus(StatusEffect statusEffect, Sprite icon)
{
SE_Bandages sE_Bandages = (SE_Bandages)(object)statusEffect;
((StatusEffect)sE_Bandages).m_icon = icon;
((StatusEffect)sE_Bandages).m_name = "First Aid";
((StatusEffect)sE_Bandages).m_category = "bandages";
((Object)sE_Bandages).name = "Bandages";
((StatusEffect)sE_Bandages).m_ttl = 120f;
((StatusEffect)sE_Bandages).m_tooltip = "Applied first aid. This will help mend the pain";
((SE_Stats)sE_Bandages).m_healthOverTimeInterval = 5f;
((SE_Stats)sE_Bandages).m_healthOverTimeDuration = ((StatusEffect)sE_Bandages).m_ttl;
((SE_Stats)sE_Bandages).m_healthOverTimeTickHP = 3f;
((StatusEffect)sE_Bandages).m_activationAnimation = "equipping";
statusEffects.Add((StatusEffect)(object)sE_Bandages);
}
public StatusEffect cloneShield(StatusEffect shield, int absorb, string name)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Expected O, but got Unknown
SE_Shield val = (SE_Shield)shield.Clone();
val.m_absorbDamage = absorb;
((StatusEffect)val).m_name = name;
((Object)val).name = name;
return (StatusEffect)(object)val;
}
public static void setupVisualsForStatus(StatusEffect statusEffect, List<GameObject> list)
{
if ((Object)(object)statusEffect == (Object)null)
{
Debug.LogWarning((object)"Status Effect is null!");
return;
}
switch (statusEffect.m_name)
{
case "Bleeding":
{
SE_bleed sE_bleed = (SE_bleed)(object)statusEffect;
break;
}
case "Crushed":
{
SE_crushed sE_crushed = (SE_crushed)(object)statusEffect;
break;
}
case "Pierced":
{
SE_pierced sE_pierced = (SE_pierced)(object)statusEffect;
break;
}
case "Shield_MonsterRandomizer":
{
List<EffectData> list2 = new List<EffectData>();
SE_LevelShield sE_LevelShield = (SE_LevelShield)(object)statusEffect;
list2.Add(createEffectData(list, "fx_GoblinShieldBreak", attach: true, "", scale: true));
list2.RemoveAll((EffectData x) => (Object)(object)x.m_prefab == (Object)null);
sE_LevelShield.m_breakEffects.m_effectPrefabs = list2.ToArray();
List<EffectData> list3 = new List<EffectData>();
list3.Add(createEffectData(list, "fx_GoblinShieldHit", attach: true, "", scale: true));
list3.RemoveAll((EffectData x) => (Object)(object)x.m_prefab == (Object)null);
sE_LevelShield.m_hitEffects.m_effectPrefabs = list3.ToArray();
List<EffectData> list4 = new List<EffectData>();
list4.Add(createEffectData(list, "vfx_GoblinShield", attach: true, "", scale: true));
list4.RemoveAll((EffectData x) => (Object)(object)x.m_prefab == (Object)null);
((StatusEffect)sE_LevelShield).m_startEffects.m_effectPrefabs = list4.ToArray();
break;
}
}
}
private static EffectData createEffectData(List<GameObject> list, string name, bool attach = false, string attachName = "", bool scale = false)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Expected O, but got Unknown
EffectData val = new EffectData();
val.m_variant = -1;
val.m_prefab = FindEffect(list, name);
val.m_enabled = true;
val.m_attach = attach;
val.m_scale = scale;
val.m_childTransform = attachName;
return val;
}
private static GameObject FindEffect(List<GameObject> list, string name)
{
GameObject val = list.Find((GameObject x) => ((Object)x).name == name);
if ((Object)(object)val != (Object)null)
{
return val;
}
return null;
}
}
public class SE_Bandages : SE_Stats
{
[Header("SE_Bandages")]
public float m_waterDamage;
public float m_damageInterval = 0.5f;
private float m_timer;
public override void Setup(Character character)
{
((SE_Stats)this).Setup(character);
}
public override void UpdateStatusEffect(float dt)
{
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
//IL_00aa: 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_00c3: Unknown result type (might be due to invalid IL or missing references)
//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
//IL_00d2: Expected O, but got Unknown
((SE_Stats)this).UpdateStatusEffect(dt);
if ((double)base.m_tickInterval > 0.0)
{
base.m_tickTimer += dt;
if ((double)base.m_tickTimer >= (double)base.m_tickInterval)
{
base.m_tickTimer = 0f;
if ((double)((StatusEffect)this).m_character.GetHealthPercentage() >= (double)base.m_healthPerTickMinHealthPercentage)
{
if ((double)base.m_healthPerTick > 0.0)
{
((StatusEffect)this).m_character.Heal(base.m_healthPerTick, true);
}
else
{
((StatusEffect)this).m_character.Damage(new HitData
{
m_damage =
{
m_damage = 0f - base.m_healthPerTick
},
m_point = ((StatusEffect)this).m_character.GetTopPoint()
});
}
}
}
}
if ((double)base.m_healthOverTimeTicks > 0.0)
{
base.m_healthOverTimeTimer += dt;
if ((double)base.m_healthOverTimeTimer > (double)base.m_healthOverTimeInterval)
{
base.m_healthOverTimeTimer = 0f;
base.m_healthOverTimeTicks -= 1f;
((StatusEffect)this).m_character.Heal(base.m_healthOverTimeTickHP, true);
}
}
if (((StatusEffect)this).m_character.GetSEMan().HaveStatusEffect("Pierced") || ((StatusEffect)this).m_character.GetSEMan().HaveStatusEffect("Bleeding") || ((StatusEffect)this).m_character.GetSEMan().HaveStatusEffect("Crushed"))
{
((StatusEffect)this).m_time = ((StatusEffect)this).m_time + dt * 10f;
}
((StatusEffect)this).m_time = ((StatusEffect)this).m_time + dt * 50f;
}
}
public class SE_LevelShield : StatusEffect
{
[Header("SE_LevelShield")]
public float m_baseAbsorbDamage = 10f;
private int level = 1;
private int bonusShield = 10;
public float m_absorbDamage = 20f;
public SkillType m_levelUpSkillOnBreak;
public float m_levelUpSkillFactor = 1f;
public int m_ttlPerItemLevel;
public float m_absorbDamagePerSkillLevel;
public EffectList m_breakEffects = new EffectList();
public EffectList m_hitEffects = new EffectList();
private float m_totalAbsorbDamage;
private float m_damage;
public override void Setup(Character character)
{
((Object)this).name = "SE_LevelShield";
base.m_name = "Shield_MonsterRandomizer";
((StatusEffect)this).Setup(character);
level = base.m_character.m_level;
CharacterType();
}
private void CharacterType()
{
switch (((Object)((Component)base.m_character).gameObject).name)
{
case "Skeleton_NoArcher":
case "Skeleton":
bonusShield = 15;
break;
case "Skeleton_Poison":
bonusShield = 20;
break;
case "Draugr":
case "Draugr_Ranged":
bonusShield = 25;
break;
case "Draugr_Elite":
bonusShield = 30;
break;
case "Goblin":
case "GoblinArcher":
case "GoblinShaman":
bonusShield = 35;
break;
case "Surtling":
bonusShield = 20;
break;
}
m_absorbDamage = (float)level * ((float)bonusShield + m_baseAbsorbDamage);
}
public override bool IsDone()
{
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
//IL_006f: Invalid comparison between Unknown and I4
//IL_009d: 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)
if ((double)m_damage <= (double)m_totalAbsorbDamage)
{
return ((StatusEffect)this).IsDone();
}
m_breakEffects.Create(base.m_character.GetCenterPoint(), ((Component)base.m_character).transform.rotation, ((Component)base.m_character).transform, base.m_character.GetRadius() * 2f, -1);
if ((int)m_levelUpSkillOnBreak > 0)
{
Skills skills = base.m_character.GetSkills();
if ((Object)(object)skills != (Object)null && Object.op_Implicit((Object)(object)skills))
{
skills.RaiseSkill(m_levelUpSkillOnBreak, m_levelUpSkillFactor);
Terminal.Log((object)$"{base.m_name} is leveling up {m_levelUpSkillOnBreak} at factor {m_levelUpSkillFactor}");
}
}
return true;
}
public override void OnDamaged(HitData hit, Character attacker)
{
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
m_damage += hit.GetTotalDamage();
hit.ApplyModifier(0f);
m_hitEffects.Create(hit.m_point, Quaternion.LookRotation(-hit.m_dir), ((Component)base.m_character).transform, 1f, -1);
}
public override void SetLevel(int itemLevel, float skillLevel)
{
if (m_ttlPerItemLevel > 0)
{
base.m_ttl = m_ttlPerItemLevel * itemLevel;
}
m_totalAbsorbDamage = m_absorbDamage + m_absorbDamagePerSkillLevel * skillLevel;
Terminal.Log((object)$"Shield setting itemlevel: {itemLevel} = ttl: {base.m_ttl}, skilllevel: {skillLevel} = absorb: {m_totalAbsorbDamage}");
((StatusEffect)this).SetLevel(itemLevel, skillLevel);
}
public override string GetTooltipString()
{
return ((StatusEffect)this).GetTooltipString() + "\n$se_shield_ttl <color=orange>" + base.m_ttl.ToString("0") + "</color>\n$se_shield_damage <color=orange>" + m_totalAbsorbDamage.ToString("0") + "</color>";
}
}
public class SE_bleed : StatusEffect
{
[Header("SE_bleed")]
private float m_timer;
public List<DamageModPair> m_mods = new List<DamageModPair>();
public void Awake()
{
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
base.m_name = "Bleeding";
((Object)this).name = "Bleeding";
DamageModPair item = default(DamageModPair);
item.m_type = (DamageType)2;
item.m_modifier = (DamageModifier)2;
m_mods.Add(item);
}
public override void Setup(Character character)
{
((StatusEffect)this).Setup(character);
}
public override void UpdateStatusEffect(float dt)
{
((StatusEffect)this).UpdateStatusEffect(dt);
if (base.m_character.GetSEMan().HaveStatusEffect("Bandages"))
{
base.m_time += dt * 5f;
}
base.m_ttl -= dt;
if (!((double)base.m_ttl > 0.0))
{
}
}
public override void ModifyDamageMods(ref DamageModifiers modifiers)
{
((DamageModifiers)(ref modifiers)).Apply(m_mods);
}
}
public class SE_BlockStamUse : StatusEffect
{
public float m_bonus = 0f;
public float m_baseConsumption = 0f;
public void Awake()
{
base.m_name = "BlockStaminaUse";
((Object)this).name = "BlockStaminaUse";
base.m_tooltip = "Block Stamina Use decreased by " + m_bonus + "x";
}
public void setBlockStaminaUse(float bonus)
{
m_bonus = bonus;
base.m_tooltip = "Block Stamina Use decreased by " + bonus + "x";
}
public float getBlockStaminaUse()
{
return m_bonus;
}
}
public class SE_BonusHealth : StatusEffect
{
public float m_bonus = 0f;
public void Awake()
{
base.m_name = "BonusHealth";
((Object)this).name = "BonusHealth";
base.m_tooltip = "Health is increased by " + (m_bonus + 1f) + " points.";
}
public void SetHealthBonus(float bonus)
{
m_bonus = bonus;
base.m_tooltip = "Health is increased by " + (m_bonus + 1f) + " points.";
}
public float getHealthBonus()
{
return m_bonus;
}
}
public class SE_BonusHealthRegen : StatusEffect
{
public float m_bonus = 0f;
public void Awake()
{
base.m_name = "HpRegen";
((Object)this).name = "HpRegen";
base.m_tooltip = "Health Regen is increased by " + (m_bonus + 1f) + "x.";
}
public void setHealPercent(float bonus)
{
m_bonus = bonus;
base.m_tooltip = "Health Regen is increased by " + (m_bonus + 1f) + "x.";
}
public float getHealPercent()
{
return m_bonus;
}
}
public class SE_BonusStamina : StatusEffect
{
public float m_bonus = 0f;
public void Awake()
{
base.m_name = "BonusStamina";
((Object)this).name = "BonusStamina";
base.m_tooltip = "Stamina is increased by " + (m_bonus + 1f) + " points.";
}
public void SetStaminaBonus(float bonus)
{
m_bonus = bonus;
base.m_tooltip = "Stamina is increased by " + (m_bonus + 1f) + " points.";
}
public float GetStaminaBonus()
{
return m_bonus;
}
}
public class SE_BonusStaminaRegen : StatusEffect
{
public float m_bonus = 0f;
public void Awake()
{
base.m_name = "StaminaRegen";
((Object)this).name = "StaminaRegen";
base.m_tooltip = "Stamina Regen is increased by " + m_bonus + "%.";
}
public void SetRegenPercent(float bonus)
{
m_bonus = bonus;
base.m_tooltip = "Stamina Regen is increased by " + m_bonus + "%.";
}
public float GetRegenPercent()
{
return m_bonus;
}
}
public class SE_crushed : StatusEffect
{
[Header("SE_crushed")]
public List<DamageModPair> m_mods = new List<DamageModPair>();
private float m_timer;
public float m_speedModifier;
public void Awake()
{
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
base.m_name = "Crushed";
((Object)this).name = "Crushed";
DamageModPair item = default(DamageModPair);
item.m_type = (DamageType)1;
item.m_modifier = (DamageModifier)2;
m_mods.Add(item);
}
public override void Setup(Character character)
{
((StatusEffect)this).Setup(character);
}
public override void UpdateStatusEffect(float dt)
{
((StatusEffect)this).UpdateStatusEffect(dt);
if (base.m_character.GetSEMan().HaveStatusEffect("Bandages"))
{
base.m_time += dt * 5f;
}
base.m_ttl -= dt;
if (!((double)base.m_ttl > 0.0))
{
}
}
public override void ModifyDamageMods(ref DamageModifiers modifiers)
{
((DamageModifiers)(ref modifiers)).Apply(m_mods);
}
public override void ModifySpeed(float baseSpeed, ref float speed)
{
if (base.m_character.IsSwimming())
{
speed += (float)((double)baseSpeed * (double)m_speedModifier * 0.5);
}
else
{
speed += baseSpeed * m_speedModifier;
}
if (!((double)speed >= 0.0))
{
speed = 0f;
}
}
}
public class SE_pierced : StatusEffect
{
[Header("SE_pierced")]
private float m_timer;
public List<DamageModPair> m_mods = new List<DamageModPair>();
public void Awake()
{
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
base.m_name = "Pierced";
((Object)this).name = "Pierced";
DamageModPair item = default(DamageModPair);
item.m_type = (DamageType)4;
item.m_modifier = (DamageModifier)2;
m_mods.Add(item);
}
public override void Setup(Character character)
{
((StatusEffect)this).Setup(character);
}
public override void UpdateStatusEffect(float dt)
{
((StatusEffect)this).UpdateStatusEffect(dt);
if (base.m_character.GetSEMan().HaveStatusEffect("Bandages"))
{
base.m_time += dt * 5f;
}
base.m_ttl -= dt;
if (!((double)base.m_ttl > 0.0))
{
}
}
public override void ModifyDamageMods(ref DamageModifiers modifiers)
{
((DamageModifiers)(ref modifiers)).Apply(m_mods);
}
}