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 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("BalrondBerserkComponents")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("BalrondBerserkComponents")]
[assembly: AssemblyCopyright("Copyright © 2022")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("cde312a0-cf19-4264-8616-e1c74774beed")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace BalrondBerserkComponents;
internal class BuildPieceList
{
public static string[] buildPieces = new string[2] { "darkwood_column1_bal", "darkwood_half_circle_arch_bal" };
}
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(status.m_nameHash) == (Object)null)
{
ObjectDB.instance.m_StatusEffects.Add(status);
}
else
{
Debug.Log((object)(Launch.projectName + ": " + ((Object)status).name + " - Status already in the game"));
}
}
else
{
Debug.LogError((object)(Launch.projectName + ": " + ((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.m_recipes.Find((Recipe x) => ((Object)x).name == ((Object)recipe).name) == (Object)null)
{
if ((Object)(object)recipe.m_item != (Object)null)
{
ObjectDB.instance.m_recipes.Add(recipe);
}
}
else
{
Debug.Log((object)(Launch.projectName + ": " + ((Object)recipe).name + " - Recipe with this name already in the Game"));
}
}
else
{
Debug.LogError((object)(Launch.projectName + ": " + ((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.LogWarning((object)(Launch.projectName + ": " + ((Object)newPrefab).name + " - ItemDrop already exist"));
}
}
else
{
Debug.LogError((object)(Launch.projectName + ": " + ((Object)newPrefab).name + " - ItemDrop not found on prefab"));
}
}
}
public class FxReplacment
{
private List<GameObject> allPrefabs;
private string projectName = "[BalrondBiomes]";
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 ModResourceLoader
{
public AssetBundle assetBundle;
public List<GameObject> buildPrefabs = new List<GameObject>();
public List<GameObject> plantPrefabs = new List<GameObject>();
public List<GameObject> itemPrefabs = new List<GameObject>();
public List<GameObject> monsterPrefabs = new List<GameObject>();
public List<GameObject> vegetationPrefabs = new List<GameObject>();
public List<GameObject> clutterPrefabs = new List<GameObject>();
public List<GameObject> locationPrefabs = new List<GameObject>();
public List<GameObject> roomPrefabs = new List<GameObject>();
public List<GameObject> vfxPrefabs = new List<GameObject>();
public FxReplacment fxReplacment = null;
public List<Recipe> recipes = new List<Recipe>();
public List<StatusEffect> statusEffects = new List<StatusEffect>();
public StatusEffect newBarleyStatus = null;
public ShaderReplacment shaderReplacment = new ShaderReplacment();
public Sprite newLogo = null;
public void loadAssets()
{
assetBundle = GetAssetBundleFromResources("balrondberserkcomponents");
string basePath = "Assets/Custom/Comission/BalrondBerserkComponents/";
loadPieces(basePath);
loadItems(basePath);
loadOther(basePath);
}
public void AddPrefabsToZnetScene(ZNetScene zNetScene)
{
zNetScene.m_prefabs.AddRange(vegetationPrefabs);
foreach (GameObject gm in itemPrefabs)
{
GameObject val = zNetScene.m_prefabs.Find((GameObject x) => ((Object)x).name == ((Object)gm).name);
if ((Object)(object)val == (Object)null)
{
zNetScene.m_prefabs.Add(gm);
}
else
{
Debug.LogWarning((object)("Object exists: " + ((Object)gm).name));
}
}
foreach (GameObject gm2 in buildPrefabs)
{
GameObject val2 = zNetScene.m_prefabs.Find((GameObject x) => ((Object)x).name == ((Object)gm2).name);
if ((Object)(object)val2 == (Object)null)
{
zNetScene.m_prefabs.Add(gm2);
}
else
{
Debug.LogWarning((object)("Object exists: " + ((Object)gm2).name));
}
}
foreach (GameObject gm3 in vfxPrefabs)
{
GameObject val3 = zNetScene.m_prefabs.Find((GameObject x) => ((Object)x).name == ((Object)gm3).name);
if ((Object)(object)val3 == (Object)null)
{
zNetScene.m_prefabs.Add(gm3);
}
else
{
Debug.LogWarning((object)("Object exists: " + ((Object)gm3).name));
}
}
zNetScene.m_prefabs.RemoveAll((GameObject x) => (Object)(object)x == (Object)null);
addPlantstoCultivator(zNetScene);
}
private void setupBuildPiecesList(ZNetScene zNetScene)
{
string[] array = new string[1] { "HammerBerserk_bal" };
GameObject val = zNetScene.m_prefabs.Find((GameObject x) => ((Object)x).name == "Hammer");
PieceTable component = zNetScene.m_prefabs.Find((GameObject x) => ((Object)x).name == "BerserkHammerTable_bal").GetComponent<PieceTable>();
string[] array2 = array;
foreach (string name in array2)
{
addBuildpiecesToOtherHammer(name, component, zNetScene);
}
string[] source = new string[0];
List<GameObject> pieces = component.m_pieces;
foreach (GameObject buildPrefab in buildPrefabs)
{
if (source.Contains(((Object)buildPrefab).name))
{
setupRavenGuide(buildPrefab, zNetScene.m_prefabs);
AddToBuildList(buildPrefab, pieces);
}
}
}
private void addBuildpiecesToOtherHammer(string name, PieceTable pieceTable, ZNetScene zNetScene)
{
GameObject val = zNetScene.m_prefabs.Find((GameObject x) => ((Object)x).name == name);
if (!((Object)(object)val == (Object)null))
{
val.GetComponent<ItemDrop>().m_itemData.m_shared.m_buildPieces = pieceTable;
}
}
public void setupRavenGuide(GameObject gameObject, List<GameObject> gameObjects)
{
GameObject val = null;
Transform val2 = gameObject.transform.Find("GuidePoint");
if ((Object)(object)val2 == (Object)null)
{
return;
}
GameObject val3 = gameObjects.Find((GameObject x) => ((Object)x).name == "piece_workbench");
if ((Object)(object)val3 != (Object)null)
{
GameObject gameObject2 = ((Component)val3.transform.Find("GuidePoint")).gameObject;
if ((Object)(object)gameObject2 != (Object)null)
{
GuidePoint component = gameObject2.GetComponent<GuidePoint>();
if ((Object)(object)component != (Object)null)
{
val = component.m_ravenPrefab;
}
}
}
if ((Object)(object)val == (Object)null)
{
Debug.LogWarning((object)"Ravens not found");
}
else
{
((Component)val2).GetComponent<GuidePoint>().m_ravenPrefab = val;
}
}
public void setupBuildPiecesListDB()
{
GameObject val = ObjectDB.instance.m_items.Find((GameObject x) => ((Object)x).name == "Hammer");
List<GameObject> pieces = val.GetComponent<ItemDrop>().m_itemData.m_shared.m_buildPieces.m_pieces;
foreach (GameObject buildPrefab in buildPrefabs)
{
AddToBuildList(buildPrefab, pieces);
}
}
private void AddToBuildList(GameObject prefab, List<GameObject> buildPieces)
{
if ((Object)(object)buildPieces.Find((GameObject x) => ((Object)x).name == ((Object)prefab).name) == (Object)null)
{
buildPieces.Add(prefab);
}
}
private void addPlantstoCultivator(ZNetScene zNetScene)
{
GameObject val = zNetScene.m_prefabs.Find((GameObject x) => ((Object)x).name == "Cultivator");
PieceTable buildPieces = val.GetComponent<ItemDrop>().m_itemData.m_shared.m_buildPieces;
List<GameObject> pieces = buildPieces.m_pieces;
foreach (GameObject plantPrefab in plantPrefabs)
{
pieces.Add(plantPrefab);
}
}
public void FixAllFx(FxReplacment fxReplacment)
{
this.fxReplacment = fxReplacment;
fixBuildPiecesFX();
fixVegetationFX();
fixItemFX();
fixMonsterFX();
fixOtherFX();
}
private void loadStatusFromPotion()
{
string[] source = new string[0];
foreach (GameObject itemPrefab in itemPrefabs)
{
if (source.Contains(((Object)itemPrefab).name))
{
ItemDrop component = itemPrefab.GetComponent<ItemDrop>();
SharedData shared = component.m_itemData.m_shared;
checkForStatus(shared.m_consumeStatusEffect);
checkForStatus(shared.m_setStatusEffect);
checkForStatus(shared.m_equipStatusEffect);
checkForStatus(shared.m_attackStatusEffect);
}
}
Debug.Log((object)("Loaded Potion status: " + statusEffects.Count));
}
private void checkForStatus(StatusEffect status)
{
if ((Object)(object)status != (Object)null)
{
statusEffects.Add(status);
}
}
private void fixVegetationFX()
{
foreach (GameObject vegetationPrefab in vegetationPrefabs)
{
fxReplacment.ReplaceOnVegetation(vegetationPrefab);
}
}
private void fixBuildPiecesFX()
{
foreach (GameObject buildPrefab in buildPrefabs)
{
fxReplacment.ReplaceFxOnPiece(buildPrefab);
}
}
private void fixItemFX()
{
foreach (GameObject itemPrefab in itemPrefabs)
{
fxReplacment.ReplaceOnItem(itemPrefab);
}
}
private void fixMonsterFX()
{
foreach (GameObject monsterPrefab in monsterPrefabs)
{
fxReplacment.ReplaceOnMonster(monsterPrefab);
}
}
private void fixOtherFX()
{
foreach (GameObject vfxPrefab in vfxPrefabs)
{
fxReplacment.ReplaceOnObject(vfxPrefab);
}
}
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);
}
private void loadPlants(string basePath)
{
string text = basePath + "Plants/";
string[] array = new string[2] { "Swamp_Sapling_aicho", "Willow_Sapling_aicho" };
string[] array2 = array;
foreach (string text2 in array2)
{
GameObject val = assetBundle.LoadAsset<GameObject>(text + text2 + ".prefab");
if ((Object)(object)val == (Object)null)
{
Debug.LogWarning((object)("Could not find plant with name: " + text2));
continue;
}
ShaderReplacment.Replace(val);
plantPrefabs.Add(val);
}
}
private void loadPieces(string basePath)
{
string text = basePath + "Pieces/";
string[] buildPieces = BuildPieceList.buildPieces;
string[] array = buildPieces;
foreach (string text2 in array)
{
GameObject val = assetBundle.LoadAsset<GameObject>(text + text2 + ".prefab");
if ((Object)(object)val == (Object)null)
{
Debug.LogWarning((object)("Could not find piece with name: " + text2));
continue;
}
ShaderReplacment.Replace(val);
buildPrefabs.Add(val);
}
}
private void loadItems(string basePath)
{
string text = basePath + "Items/";
string[] array = new string[1] { "HammerBerserk_bal" };
string[] array2 = array;
foreach (string text2 in array2)
{
GameObject val = assetBundle.LoadAsset<GameObject>(text + text2 + ".prefab");
if ((Object)(object)val == (Object)null)
{
Debug.LogWarning((object)("Could not find item with name: " + text2));
continue;
}
ShaderReplacment.Replace(val);
itemPrefabs.Add(val);
}
}
private void loadVegetation(string basePath)
{
string text = basePath + "Vegetation/";
string[] array = new string[0];
string[] array2 = array;
foreach (string text2 in array2)
{
GameObject val = assetBundle.LoadAsset<GameObject>(text + text2 + ".prefab");
if ((Object)(object)val == (Object)null)
{
Debug.LogWarning((object)("Could not find vegegation with name: " + text2));
continue;
}
ShaderReplacment.Replace(val);
vegetationPrefabs.Add(val);
}
}
private void loadOther(string basePath)
{
string text = basePath + "Other/";
string[] array = new string[1] { "BerserkHammerTable_bal" };
string[] array2 = array;
foreach (string text2 in array2)
{
GameObject val = assetBundle.LoadAsset<GameObject>(text + text2 + ".prefab");
if ((Object)(object)val == (Object)null)
{
Debug.LogWarning((object)("Could not find object with name: " + text2));
continue;
}
ShaderReplacment.Replace(val);
vfxPrefabs.Add(val);
}
}
}
public class ShaderReplacment
{
public static List<GameObject> prefabsToReplaceShader = new List<GameObject>();
public static List<Material> materialsInPrefabs = 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>();
private static readonly HashSet<Shader> CachedShaders = new HashSet<Shader>();
public static bool debug = true;
public static Shader findShader(string name)
{
Shader[] array = Resources.FindObjectsOfTypeAll<Shader>();
if (array.Length == 0)
{
Debug.LogWarning((object)"SHADER LIST IS EMPTY!");
return null;
}
if (debug)
{
}
return shaders.Find((Shader x) => ((Object)x).name == name);
}
public static Shader GetShaderByName(string name)
{
return shaders.Find((Shader x) => ((Object)x).name == name.Trim());
}
public static void debugShaderList(List<Shader> shadersRes)
{
foreach (Shader shadersRe in shadersRes)
{
Debug.LogWarning((object)("SHADER NAME IS: " + ((Object)shadersRe).name));
}
debug = false;
}
public static void Replace(GameObject gameObject)
{
prefabsToReplaceShader.Add(gameObject);
GetMaterialsInPrefab(gameObject);
}
public static void GetMaterialsInPrefab(GameObject gameObject)
{
Renderer[] componentsInChildren = gameObject.GetComponentsInChildren<Renderer>(true);
Renderer[] array = componentsInChildren;
foreach (Renderer val in array)
{
Material[] sharedMaterials = val.sharedMaterials;
if (sharedMaterials == null || sharedMaterials.Length == 0)
{
continue;
}
Material[] array2 = sharedMaterials;
foreach (Material val2 in array2)
{
if ((Object)(object)val2 != (Object)null)
{
materialsInPrefabs.Add(val2);
}
}
}
}
public static void getMeShaders()
{
AssetBundle[] array = Resources.FindObjectsOfTypeAll<AssetBundle>();
AssetBundle[] array2 = array;
foreach (AssetBundle val in array2)
{
IEnumerable<Shader> enumerable3;
try
{
IEnumerable<Shader> enumerable2;
if (!val.isStreamedSceneAssetBundle || !Object.op_Implicit((Object)(object)val))
{
IEnumerable<Shader> enumerable = val.LoadAllAssets<Shader>();
enumerable2 = enumerable;
}
else
{
enumerable2 = from shader in ((IEnumerable<string>)val.GetAllAssetNames()).Select((Func<string, Shader>)val.LoadAsset<Shader>)
where (Object)(object)shader != (Object)null
select shader;
}
enumerable3 = enumerable2;
}
catch (Exception)
{
continue;
}
if (enumerable3 == null)
{
continue;
}
foreach (Shader item in enumerable3)
{
CachedShaders.Add(item);
}
}
}
public static void runMaterialFix()
{
getMeShaders();
shaders.AddRange(CachedShaders);
foreach (Material materialsInPrefab in materialsInPrefabs)
{
Shader shader = materialsInPrefab.shader;
if (!((Object)(object)shader == (Object)null))
{
string name = ((Object)shader).name;
if (!(name == "Standard") && name.Contains("Balrond"))
{
setProperValue(materialsInPrefab, name);
}
}
}
}
private static void setProperValue(Material material, string shaderName)
{
string name = shaderName.Replace("Balrond", "Custom");
name = checkNaming(name);
Shader shaderByName = GetShaderByName(name);
if ((Object)(object)shaderByName == (Object)null)
{
Debug.LogWarning((object)("Shader not found " + name));
}
else
{
material.shader = shaderByName;
}
}
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 TableMapper
{
public static CraftingStation cauldron;
public static CraftingStation workbench;
public static CraftingStation heavyWorkbench;
public static CraftingStation forge;
public static CraftingStation ironworks;
public static CraftingStation blackforge;
public static CraftingStation stoneCutter;
public static CraftingStation artisian;
public static CraftingStation magetable;
public static CraftingStation runeforge;
public static CraftingStation tannery;
public static CraftingStation fletcher;
public static CraftingStation grill;
public static CraftingStation alchemylab;
public static CraftingStation shamantable;
public static CraftingStation foodtable;
public static List<GameObject> pieces = new List<GameObject>();
public static void setupTables(List<GameObject> list)
{
pieces = list;
prepareTables();
}
private static CraftingStation FindStation(List<GameObject> list, string name, CraftingStation alt = null)
{
GameObject val = list.Find((GameObject x) => ((Object)x).name == name);
if ((Object)(object)val != (Object)null)
{
return val.GetComponent<CraftingStation>();
}
Debug.LogWarning((object)("TableMapper - Station not found: " + name + " using: " + ((Object)alt).name));
if ((Object)(object)alt != (Object)null)
{
return alt;
}
return null;
}
private static void prepareTables()
{
cauldron = FindStation(pieces, "piece_cauldron");
workbench = FindStation(pieces, "piece_workbench");
heavyWorkbench = FindStation(pieces, "piece_heavy_workbench_bal", workbench);
forge = FindStation(pieces, "forge");
ironworks = FindStation(pieces, "piece_metalworks_bal", forge);
blackforge = FindStation(pieces, "blackforge");
stoneCutter = FindStation(pieces, "piece_stonecutter");
artisian = FindStation(pieces, "piece_artisanstation");
runeforge = FindStation(pieces, "piece_runeforge_bal", blackforge);
magetable = FindStation(pieces, "piece_magetable");
fletcher = FindStation(pieces, "piece_fletcher_bal", workbench);
}
}
[BepInPlugin("balrond.astafaraios.BalrondBerserkComponents", "BalrondBerserkComponents", "1.0.0")]
public class Launch : BaseUnityPlugin
{
[HarmonyPatch(typeof(Player), "UseStamina")]
private class Player_UseStamina
{
private static bool Prefix()
{
if (Player.m_debugMode && ((Terminal)Console.instance).IsCheatsEnabled())
{
return false;
}
return true;
}
}
[HarmonyPatch(typeof(AudioMan), "Awake")]
private static class AudioMan_Awake_Patch
{
private static void Postfix(AudioMan __instance)
{
foreach (GameObject itemPrefab in modResourceLoader.itemPrefabs)
{
AudioSource[] componentsInChildren = itemPrefab.GetComponentsInChildren<AudioSource>(true);
foreach (AudioSource val in componentsInChildren)
{
val.outputAudioMixerGroup = __instance.m_masterMixer.outputAudioMixerGroup;
}
}
foreach (GameObject buildPrefab in modResourceLoader.buildPrefabs)
{
AudioSource[] componentsInChildren2 = buildPrefab.GetComponentsInChildren<AudioSource>(true);
foreach (AudioSource val2 in componentsInChildren2)
{
val2.outputAudioMixerGroup = __instance.m_masterMixer.outputAudioMixerGroup;
}
}
foreach (GameObject monsterPrefab in modResourceLoader.monsterPrefabs)
{
AudioSource[] componentsInChildren3 = monsterPrefab.GetComponentsInChildren<AudioSource>(true);
foreach (AudioSource val3 in componentsInChildren3)
{
val3.outputAudioMixerGroup = __instance.m_masterMixer.outputAudioMixerGroup;
}
}
foreach (GameObject vfxPrefab in modResourceLoader.vfxPrefabs)
{
AudioSource[] componentsInChildren4 = vfxPrefab.GetComponentsInChildren<AudioSource>(true);
foreach (AudioSource val4 in componentsInChildren4)
{
val4.outputAudioMixerGroup = __instance.m_masterMixer.outputAudioMixerGroup;
}
}
foreach (GameObject vegetationPrefab in modResourceLoader.vegetationPrefabs)
{
AudioSource[] componentsInChildren5 = vegetationPrefab.GetComponentsInChildren<AudioSource>(true);
foreach (AudioSource val5 in componentsInChildren5)
{
val5.outputAudioMixerGroup = __instance.m_masterMixer.outputAudioMixerGroup;
}
}
}
}
[HarmonyPatch(typeof(ObjectDB), "CopyOtherDB")]
public static class Object_CopyOtherDB_Path
{
public static void Postfix()
{
if (IsObjectDBValid())
{
databaseAddMethods.AddItems(modResourceLoader.itemPrefabs);
databaseAddMethods.AddStatuseffects(modResourceLoader.statusEffects);
databaseAddMethods.AddRecipes(modResourceLoader.recipes);
}
}
}
[HarmonyPatch(typeof(ObjectDB), "Awake")]
public static class ObjectDB_Awake_Path
{
public static void Postfix()
{
if (IsObjectDBValid())
{
modResourceLoader.setupBuildPiecesListDB();
databaseAddMethods.AddItems(modResourceLoader.itemPrefabs);
databaseAddMethods.AddStatuseffects(modResourceLoader.statusEffects);
recipeFactory.createRecipes(ObjectDB.instance.m_items, modResourceLoader.itemPrefabs);
modResourceLoader.recipes.AddRange(recipeFactory.recipes);
databaseAddMethods.AddRecipes(modResourceLoader.recipes);
ObjectDB.instance.m_recipes.Sort(SortByScore);
}
}
private static int SortByScore(Recipe p1, Recipe p2)
{
if ((Object)(object)p1.m_item == (Object)null)
{
return 0;
}
if ((Object)(object)p2.m_item == (Object)null)
{
return 1;
}
return ((Object)p1.m_item).name.CompareTo(((Object)p2.m_item).name);
}
}
[HarmonyPatch(typeof(ZNetScene), "Awake")]
public static class ZNetScene_Awake_Path
{
public static bool hasSpawned;
public static void Prefix(ZNetScene __instance)
{
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)__instance == (Object)null)
{
Debug.LogWarning((object)(projectName + ": No ZnetScene found"));
return;
}
fxReplacment.setInstance(__instance.m_prefabs);
modResourceLoader.FixAllFx(fxReplacment);
modResourceLoader.AddPrefabsToZnetScene(__instance);
if (!Launch.hasSpawned)
{
buildPieceBuilder.SetupBuildPieces(__instance.m_prefabs);
if (!new ZNet().IsDedicated())
{
ShaderReplacment.runMaterialFix();
hasSpawned = true;
}
}
}
}
private readonly Harmony harmony = new Harmony("balrond.astafaraios.BalrondBerserkComponents");
public const string PluginGUID = "balrond.astafaraios.BalrondBerserkComponents";
public const string PluginName = "BalrondBerserkComponents";
public const string PluginVersion = "1.0.0";
public static ModResourceLoader modResourceLoader = new ModResourceLoader();
public static FxReplacment fxReplacment = new FxReplacment();
public static DatabaseAddMethods databaseAddMethods = new DatabaseAddMethods();
public static BuildPieceBuilder buildPieceBuilder = new BuildPieceBuilder();
public static RecipeFactory recipeFactory = new RecipeFactory();
public static GameObject gui;
public static GameObject gui2;
public static string projectName = "BalrondBerserkComponents";
public static GameObject RootObject;
public static GameObject PrefabContainer;
public static bool hasSpawned = false;
private void Awake()
{
createPrefabContainer();
modResourceLoader.loadAssets();
harmony.PatchAll();
}
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;
fixMaterials(val, source);
val.SetActive(true);
return val;
}
public static void addConsumeFood(MonsterAI monsterAI, ZNetScene __instance, string name)
{
monsterAI.m_consumeItems.Add(__instance.m_prefabs.Find((GameObject x) => ((Object)x).name == "BugMeat").GetComponent<ItemDrop>());
}
public static GameObject fixMaterials(GameObject clone, GameObject source)
{
MeshRenderer[] componentsInChildren = source.GetComponentsInChildren<MeshRenderer>();
foreach (MeshRenderer val in componentsInChildren)
{
MeshRenderer[] componentsInChildren2 = clone.GetComponentsInChildren<MeshRenderer>();
foreach (MeshRenderer val2 in componentsInChildren2)
{
if (((Object)val).name == ((Object)val2).name)
{
((Renderer)val2).materials = ((Renderer)val).sharedMaterials;
((Renderer)val2).sharedMaterials = ((Renderer)val).sharedMaterials;
break;
}
}
}
return clone;
}
private void OnDestroy()
{
harmony.UnpatchSelf();
}
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 class RecipeFactory
{
private List<GameObject> pieces;
private List<GameObject> items;
private List<GameObject> newItems;
public List<Recipe> recipes = new List<Recipe>();
private string[] toRecipe = new string[1] { "HammerBerserk_bal" };
public List<Recipe> createRecipes(List<GameObject> items, List<GameObject> newItems)
{
this.items = items;
this.newItems = newItems;
pieces = items.Find((GameObject x) => ((Object)x).name == "Hammer").GetComponent<ItemDrop>().m_itemData.m_shared.m_buildPieces.m_pieces;
TableMapper.setupTables(pieces);
CraftingStation forge = TableMapper.forge;
int minStationLevel = 3;
foreach (GameObject newItem in newItems)
{
if (toRecipe.Contains(((Object)newItem).name))
{
Recipe val = ScriptableObject.CreateInstance<Recipe>();
val.m_craftingStation = forge;
val.m_repairStation = forge;
val.m_minStationLevel = minStationLevel;
val = createResources(newItem, val);
recipes.Add(val);
}
}
return recipes;
}
private Recipe createResources(GameObject item, Recipe newRecipe)
{
((Object)newRecipe).name = "Recipe_" + ((Object)item).name;
newRecipe.m_item = item.GetComponent<ItemDrop>();
newRecipe.m_amount = 1;
newRecipe.m_enabled = true;
List<Requirement> list = new List<Requirement>();
string name = ((Object)item).name;
string text = name;
if (text == "HammerBerserk_bal")
{
newRecipe.m_craftingStation = TableMapper.heavyWorkbench;
newRecipe.m_minStationLevel = 1;
newRecipe.m_amount = 1;
list.Add(createReq("Iron", 4, 2));
list.Add(createReq("Stone", 4, 2));
}
newRecipe.m_repairStation = newRecipe.m_craftingStation;
if (list.Count == 0)
{
}
newRecipe.m_resources = list.ToArray();
return newRecipe;
}
private Requirement createReq(string name, int amount, int amountPerLevel)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Expected O, but got Unknown
Requirement val = new Requirement();
val.m_recover = true;
ItemDrop component = FindItem(name).GetComponent<ItemDrop>();
val.m_resItem = component;
val.m_amount = amount;
val.m_amountPerLevel = amountPerLevel;
return val;
}
private GameObject FindItem(string name)
{
GameObject val = items.Find((GameObject x) => ((Object)x).name == name);
if ((Object)(object)val == (Object)null)
{
val = newItems.Find((GameObject x) => ((Object)x).name == name);
if ((Object)(object)val != (Object)null)
{
return val;
}
Debug.LogWarning((object)("Item Not Found - " + name + ", Replaced With Wood"));
return items.Find((GameObject x) => ((Object)x).name == "Wood");
}
if ((Object)(object)val != (Object)null)
{
return val;
}
Debug.LogWarning((object)("Item Not Found At All - " + name + ", Replaced With Wood"));
return items.Find((GameObject x) => ((Object)x).name == "Wood");
}
private CraftingStation FindStation(List<GameObject> list, string name)
{
GameObject val = list.Find((GameObject x) => ((Object)x).name == name);
if ((Object)(object)val != (Object)null)
{
return val.GetComponent<CraftingStation>();
}
return null;
}
}
public class BuildPieceBuilder
{
private List<GameObject> list;
private string[] piecesNames = BuildPieceList.buildPieces;
public void SetupBuildPieces(List<GameObject> list)
{
TableMapper.setupTables(list);
this.list = list;
string[] array = piecesNames;
foreach (string name in array)
{
GameObject val = list.Find((GameObject x) => ((Object)x).name == name);
if ((Object)(object)val == (Object)null)
{
Debug.LogWarning((object)("Cant find buildpiece with name: " + name));
}
else
{
EditBuildPiece(val);
}
}
}
private void EditBuildPiece(GameObject gameObject)
{
//IL_008d: Unknown result type (might be due to invalid IL or missing references)
//IL_00df: Unknown result type (might be due to invalid IL or missing references)
Piece component = gameObject.gameObject.GetComponent<Piece>();
SetStation(component, TableMapper.stoneCutter);
string name = ((Object)component).name;
string text = name;
if (!(text == "darkwood_column1_bal"))
{
if (text == "darkwood_half_circle_arch_bal")
{
component.m_resources = (Requirement[])(object)new Requirement[0];
((Behaviour)component).enabled = true;
SetStation(component, TableMapper.forge);
AddResources(component, "FineWood", 5);
AddResources(component, "Tar", 5);
component.m_category = (PieceCategory)2;
}
}
else
{
component.m_resources = (Requirement[])(object)new Requirement[0];
((Behaviour)component).enabled = true;
SetStation(component, TableMapper.forge);
AddResources(component, "FineWood", 5);
AddResources(component, "Tar", 5);
component.m_category = (PieceCategory)2;
}
}
private void SetCampfire(Piece piece, string itemName, int startFuel, int maxFuel, float secPerFuel)
{
Fireplace component = ((Component)piece).GetComponent<Fireplace>();
if ((Object)(object)component == (Object)null)
{
Debug.LogWarning((object)("there is not fireplace component on:" + ((Object)((Component)piece).gameObject).name));
}
}
private void SetStation(Piece piece, CraftingStation station)
{
piece.m_craftingStation = station;
}
private void EditResource(Piece piece, string itemName, int amount, bool remove = false)
{
if (remove)
{
List<Requirement> list = new List<Requirement>();
Requirement[] resources = piece.m_resources;
foreach (Requirement val in resources)
{
if (((Object)((Component)val.m_resItem).gameObject).name != itemName)
{
list.Add(val);
}
}
piece.m_resources = list.ToArray();
return;
}
Requirement[] resources2 = piece.m_resources;
foreach (Requirement val2 in resources2)
{
if (((Object)((Component)val2.m_resItem).gameObject).name == itemName)
{
val2.m_amount = amount;
}
}
}
private void AddResources(Piece piece, string itemName, int amount, string altItem = "", int altAmount = 0)
{
List<Requirement> list = new List<Requirement>();
list.AddRange(piece.m_resources);
Requirement item = createReq(itemName, amount, altItem, altAmount);
list.Add(item);
piece.m_resources = list.ToArray();
}
private Requirement createReq(string name, int amount, string altItem = "", int altAmount = 0)
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Expected O, but got Unknown
Requirement val = new Requirement();
val.m_recover = true;
GameObject val2 = list.Find((GameObject x) => ((Object)x).name == name);
if ((Object)(object)val2 != (Object)null)
{
ItemDrop component = val2.GetComponent<ItemDrop>();
val.m_amount = amount;
val.m_amountPerLevel = 0;
val.m_resItem = component;
}
else
{
val2 = FindItem(list, altItem);
ItemDrop component2 = val2.GetComponent<ItemDrop>();
val.m_amount = altAmount;
val.m_amountPerLevel = 0;
val.m_resItem = component2;
}
return val;
}
private bool itemExists(string name)
{
GameObject val = list.Find((GameObject x) => ((Object)x).name == name);
if ((Object)(object)val != (Object)null)
{
return true;
}
return false;
}
private GameObject FindItem(List<GameObject> list, string name, bool isStation = false)
{
GameObject val = list.Find((GameObject x) => ((Object)x).name == name);
if ((Object)(object)val != (Object)null)
{
return val;
}
if ((Object)(object)val == (Object)null && isStation)
{
return null;
}
Debug.LogWarning((object)(Launch.projectName + ": Item Not Found - " + name + ", Replaced With Wood"));
return list.Find((GameObject x) => ((Object)x).name == "Wood");
}
private CraftingStation FindStation(List<GameObject> list, string name)
{
GameObject val = FindItem(list, name, isStation: true);
if ((Object)(object)val != (Object)null)
{
return val.GetComponent<CraftingStation>();
}
return null;
}
private void setFireplaceFuelItem(Piece piece, string name, int startFuel = -1, int maxFuel = -1, float secPerFuel = -1f)
{
Fireplace component = ((Component)piece).GetComponent<Fireplace>();
component.m_fuelItem = FindItem(list, name).GetComponent<ItemDrop>();
component.m_startFuel = ((startFuel != -1) ? ((float)startFuel) : component.m_startFuel);
component.m_maxFuel = ((maxFuel != -1) ? ((float)maxFuel) : component.m_maxFuel);
component.m_secPerFuel = ((secPerFuel != -1f) ? secPerFuel : component.m_secPerFuel);
}
}
public class Resource
{
public int amount = 1;
public int amountPerLevel = 0;
public bool recovery = true;
public ItemDrop itemDrop;
public Requirement pieceConfig;
public string item = "Wood";
public Resource()
{
}
public Resource(string item, int amount, int amountPerLevel = 0, bool recovery = true)
{
this.item = item;
this.amount = amount;
this.amountPerLevel = amountPerLevel;
this.recovery = recovery;
}
public void setItemDrop(GameObject prefab)
{
if ((Object)(object)prefab.GetComponent<ItemDrop>() != (Object)null)
{
itemDrop = prefab.GetComponent<ItemDrop>();
}
else
{
Debug.LogWarning((object)("DVERGER FURNITURE: NO ITEM DROP FOUND on prefab name: " + ((Object)prefab).name));
}
}
public Requirement getPieceConfig()
{
//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_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: 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_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Expected O, but got Unknown
//IL_003e: Expected O, but got Unknown
Requirement val = new Requirement
{
m_resItem = itemDrop,
m_amount = amount,
m_amountPerLevel = amountPerLevel,
m_recover = recovery
};
Requirement result = val;
pieceConfig = val;
return result;
}
}