using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using Jotunn.Configs;
using Jotunn.Entities;
using Jotunn.Managers;
using Jotunn.Utils;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("Valweed")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Valweed")]
[assembly: AssemblyCopyright("Copyright © 2021")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("e3243d22-4307-4008-ba36-9f326008cde5")]
[assembly: AssemblyFileVersion("0.3.2")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.3.2.0")]
public class Bong : MonoBehaviour, Hoverable, Interactable
{
private ZNetView m_nview;
private Piece m_piece;
[Header("Bong")]
public string m_name = "$piece_bong";
public float m_startFuel = 3f;
public float m_maxFuel = 10f;
public float m_secPerFuel = 3f;
public float m_checkTerrainOffset = 0.2f;
public float m_coverCheckOffset = 0.5f;
private const float m_minimumOpenSpace = 0.5f;
public GameObject m_enabledObject;
public GameObject m_enabledObjectLow;
public GameObject m_enabledObjectHigh;
public GameObject m_playerBaseObject;
public ItemDrop m_fuelItem;
public SmokeSpawner m_smokeSpawner;
public EffectList m_fuelAddedEffects = new EffectList();
public EffectList m_smokedEffects = new EffectList();
[Header("Fireworks")]
public ItemDrop m_fireworkItem;
public int m_fireworkItems = 2;
public GameObject m_fireworks;
public float ttl;
public bool cosmeticOnly;
private bool m_blocked;
private bool m_wet;
private static int m_solidRayMask;
public void Awake()
{
//IL_00db: Unknown result type (might be due to invalid IL or missing references)
//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
m_nview = ((Component)this).gameObject.GetComponent<ZNetView>();
m_piece = ((Component)this).gameObject.GetComponent<Piece>();
if (m_nview.GetZDO() == null)
{
return;
}
if (m_solidRayMask == 0)
{
m_solidRayMask = LayerMask.GetMask(new string[5] { "Default", "static_solid", "Default_small", "piece", "terrain" });
}
if (m_nview.IsOwner() && (double)m_nview.GetZDO().GetFloat("fuel", -1f) == -1.0)
{
m_nview.GetZDO().Set("fuel", m_startFuel);
if ((double)m_startFuel > 0.0)
{
m_fuelAddedEffects.Create(((Component)this).transform.position, ((Component)this).transform.rotation, (Transform)null, 1f, -1);
}
}
m_nview.Register("AddFuel", (Action<long>)RPC_AddFuel);
((MonoBehaviour)this).InvokeRepeating("CheckEnv", 4f, 4f);
}
private void Start()
{
}
private double GetTimeSinceLastUpdate()
{
DateTime time = ZNet.instance.GetTime();
DateTime dateTime = new DateTime(m_nview.GetZDO().GetLong("lastTime", time.Ticks));
TimeSpan timeSpan = time - dateTime;
m_nview.GetZDO().Set("lastTime", time.Ticks);
double num = timeSpan.TotalSeconds;
if (num < 0.0)
{
num = 0.0;
}
return num;
}
private void UpdateFireplace()
{
if (m_nview.IsValid())
{
m_nview.IsOwner();
UpdateState();
}
}
private void CheckEnv()
{
CheckUnderTerrain();
if ((Object)(object)m_enabledObjectLow != (Object)null && (Object)(object)m_enabledObjectHigh != (Object)null)
{
CheckWet();
}
}
private void CheckUnderTerrain()
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
m_blocked = false;
float num = default(float);
RaycastHit val = default(RaycastHit);
if (Heightmap.GetHeight(((Component)this).transform.position, ref num) && (double)num > (double)((Component)this).transform.position.y + (double)m_checkTerrainOffset)
{
m_blocked = true;
}
else if (Physics.Raycast(((Component)this).transform.position + Vector3.up * m_coverCheckOffset, Vector3.up, ref val, 0.5f, m_solidRayMask))
{
m_blocked = true;
}
else if (Object.op_Implicit((Object)(object)m_smokeSpawner) && m_smokeSpawner.IsBlocked())
{
m_blocked = true;
}
}
private void CheckWet()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
float num = default(float);
bool flag = default(bool);
Cover.GetCoverForPoint(((Component)this).transform.position + Vector3.up * m_coverCheckOffset, ref num, ref flag, 0.5f);
m_wet = false;
if ((double)EnvMan.instance.GetWindIntensity() >= 0.800000011920929 && (double)num < 0.699999988079071)
{
m_wet = true;
}
if (!(!EnvMan.IsWet() || flag))
{
m_wet = true;
}
}
private void UpdateState()
{
}
public string GetHoverText()
{
return Localization.instance.Localize(m_name + " ( $piece_fire_fuel " + Mathf.Ceil(m_nview.GetZDO().GetFloat("fuel", 0f)) + "/" + (int)m_maxFuel + " )\n[<color=yellow><b>$KEY_Use</b></color>] $piece_use " + m_fuelItem.m_itemData.m_shared.m_name + "\n[<color=yellow><b>1-8</b></color>] $piece_useitem");
}
public string GetHoverName()
{
return m_name;
}
public bool Interact(Humanoid user, bool hold, bool alt)
{
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_0355: Unknown result type (might be due to invalid IL or missing references)
//IL_035c: Unknown result type (might be due to invalid IL or missing references)
//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
if (hold)
{
return false;
}
if (!m_nview.HasOwner())
{
m_nview.ClaimOwnership();
}
Inventory inventory = user.GetInventory();
if (inventory == null)
{
return true;
}
Vector3 position = ((Component)this).transform.position;
position.y += 1.65f;
if (inventory.HaveItem(m_fuelItem.m_itemData.m_shared.m_name, true))
{
if ((double)Mathf.CeilToInt(m_nview.GetZDO().GetFloat("fuel", 0f)) >= (double)m_maxFuel)
{
((Character)user).Message((MessageType)2, Localization.instance.Localize("$bong_effectstart", new string[1] { m_fuelItem.m_itemData.m_shared.m_name }), 0, (Sprite)null);
((Character)user).m_seman.AddStatusEffect(StringExtensionMethods.GetStableHashCode("BongStatusEffect"), true, 0, 0f);
m_fuelAddedEffects.Create(position, ((Component)this).transform.rotation, (Transform)null, 1f, -1);
float num = m_nview.GetZDO().GetFloat("fuel", 0f) - 1f;
if ((double)num <= 0.0)
{
num = 0f;
}
m_nview.GetZDO().Set("fuel", num);
((Component)((Component)this).transform.Find("_enabled")).gameObject.SetActive(false);
if (!cosmeticOnly)
{
Player val = (Player)(object)((user is Player) ? user : null);
List<StatusEffect> statusEffects = ((Character)val).GetSEMan().m_statusEffects;
bool flag = false;
for (int i = 0; i < statusEffects.Count; i++)
{
if (((object)statusEffects[i]).GetType() == typeof(SE_Rested))
{
statusEffects[i].m_ttl = statusEffects[i].m_ttl - statusEffects[i].m_time + ttl;
statusEffects[i].m_time = 0f;
flag = true;
break;
}
}
if (!flag)
{
((Character)val).m_seman.AddStatusEffect(StringExtensionMethods.GetStableHashCode("Rested"), true, 0, 0f);
}
}
return true;
}
((Character)user).Message((MessageType)2, Localization.instance.Localize("$bong_addbud", new string[1] { m_fuelItem.m_itemData.m_shared.m_name }), 0, (Sprite)null);
inventory.RemoveItem(m_fuelItem.m_itemData.m_shared.m_name, 1, -1, true);
((Component)((Component)this).transform.Find("_enabled")).gameObject.SetActive(true);
m_nview.InvokeRPC("AddFuel", Array.Empty<object>());
return true;
}
if ((double)Mathf.CeilToInt(m_nview.GetZDO().GetFloat("fuel", 0f)) >= (double)m_maxFuel)
{
((Character)user).Message((MessageType)2, Localization.instance.Localize("$bong_effectstart", new string[1] { m_fuelItem.m_itemData.m_shared.m_name }), 0, (Sprite)null);
((Character)user).m_seman.AddStatusEffect(StringExtensionMethods.GetStableHashCode("BongStatusEffect"), true, 0, 0f);
((Character)user).m_seman.AddStatusEffect(StringExtensionMethods.GetStableHashCode("Shield"), true, 0, 0f);
m_fuelAddedEffects.Create(position, ((Component)this).transform.rotation, (Transform)null, 1f, -1);
float num2 = m_nview.GetZDO().GetFloat("fuel", 0f) - 1f;
if ((double)num2 <= 0.0)
{
num2 = 0f;
}
m_nview.GetZDO().Set("fuel", num2);
((Component)((Component)this).transform.Find("_enabled")).gameObject.SetActive(false);
if (!cosmeticOnly)
{
Player val2 = (Player)(object)((user is Player) ? user : null);
List<StatusEffect> statusEffects2 = ((Character)val2).GetSEMan().m_statusEffects;
bool flag2 = false;
for (int j = 0; j < statusEffects2.Count; j++)
{
if (((object)statusEffects2[j]).GetType() == typeof(SE_Rested))
{
statusEffects2[j].m_ttl = statusEffects2[j].m_ttl - statusEffects2[j].m_time + ttl;
statusEffects2[j].m_time = 0f;
flag2 = true;
break;
}
}
if (!flag2)
{
((Character)val2).m_seman.AddStatusEffect(StringExtensionMethods.GetStableHashCode("Rested"), true, 0, 0f);
}
}
return true;
}
((Character)user).Message((MessageType)2, "$msg_outof " + m_fuelItem.m_itemData.m_shared.m_name, 0, (Sprite)null);
return false;
}
public bool UseItem(Humanoid user, ItemData item)
{
if (!(item.m_shared.m_name == m_fuelItem.m_itemData.m_shared.m_name))
{
return false;
}
Mathf.CeilToInt(m_nview.GetZDO().GetFloat("fuel", 0f));
_ = m_maxFuel;
Inventory inventory = user.GetInventory();
((Character)user).Message((MessageType)2, Localization.instance.Localize("$msg_fireadding", new string[1] { item.m_shared.m_name }), 0, (Sprite)null);
inventory.RemoveItem(item, 1);
m_nview.InvokeRPC("AddFuel", Array.Empty<object>());
return true;
}
private void RPC_AddFuel(long sender)
{
if (m_nview.IsOwner())
{
float @float = m_nview.GetZDO().GetFloat("fuel", 0f);
if (!((double)Mathf.CeilToInt(@float) >= (double)m_maxFuel))
{
float num = Mathf.Clamp(Mathf.Clamp(@float, 0f, m_maxFuel) + 1f, 0f, m_maxFuel);
m_nview.GetZDO().Set("fuel", num);
UpdateState();
}
}
}
public bool CanBeRemoved()
{
return true;
}
private void OnDrawGizmosSelected()
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
Gizmos.color = Color.white;
Gizmos.DrawWireSphere(((Component)this).transform.position + Vector3.up * m_coverCheckOffset, 0.5f);
Gizmos.color = Color.yellow;
Gizmos.DrawWireCube(((Component)this).transform.position + Vector3.up * m_checkTerrainOffset, new Vector3(1f, 0.01f, 1f));
}
}
public class SE_Bong : SE_Stats
{
[HarmonyPatch(typeof(Player), "UpdateFood")]
public static class Player_UpdateFood_Transpiler
{
private static FieldInfo field_Player_m_foodUpdateTimer = AccessTools.Field(typeof(Player), "m_foodUpdateTimer");
private static MethodInfo method_ComputeModifiedDt = AccessTools.Method(typeof(Player_UpdateFood_Transpiler), "ComputeModifiedDT", (Type[])null, (Type[])null);
[HarmonyTranspiler]
public static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
{
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_006b: Expected O, but got Unknown
List<CodeInstruction> list = instructions.ToList();
for (int i = 0; i < list.Count - 2; i++)
{
if (CodeInstructionExtensions.LoadsField(list[i], field_Player_m_foodUpdateTimer, false) && list[i + 1].opcode == OpCodes.Ldarg_1 && list[i + 2].opcode == OpCodes.Add)
{
list.Insert(i + 2, new CodeInstruction(OpCodes.Call, (object)method_ComputeModifiedDt));
}
}
return list.AsEnumerable();
}
private static float ComputeModifiedDT(float dt)
{
return dt / applyModifierValue(1f, 50f);
static float applyModifierValue(float targetValue, float value)
{
if ((double)value <= -100.0)
{
value = -100f;
}
if (!((double)value < 0.0))
{
return targetValue + targetValue / 100f * value;
}
return targetValue - (float)((double)targetValue / 100.0 * ((double)value * -1.0));
}
}
}
[HarmonyPatch(typeof(GameCamera), "UpdateCamera")]
public static class GameCamera_UpdateCamera_Start
{
[HarmonyPrefix]
public static void Prefix(GameCamera __instance)
{
//IL_0014: 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)
RenderSettings.ambientLight = new Color(0.2f, 0.7f, 0.3f, 0.2f);
RenderSettings.ambientSkyColor = new Color(0.2f, 0.7f, 0.3f, 0.2f);
RenderSettings.ambientIntensity = 0.005f;
}
}
[HarmonyPatch(typeof(GameCamera), "UpdateCamera")]
public static class GameCamera_UpdateCamera_Stop
{
[HarmonyPrefix]
public static void Prefix(GameCamera __instance)
{
//IL_0000: 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)
RenderSettings.ambientLight = defaultAmbientLightColor;
RenderSettings.ambientSkyColor = defaultAmbientSkyColor;
RenderSettings.ambientIntensity = defaultAmbientIntensity;
}
}
private Harmony harmony = new Harmony("com.drod917.Valweed.SEBong");
public int healthRegenVal;
public int staminaRegenVal;
public int eitrRegenVal;
private float healthRegenMult;
private float staminaRegenMult;
private float eitrRegenMult;
public float ttl;
public bool cosmeticOnly;
private static Color defaultFogColor;
private static Color defaultAmbientSkyColor;
private static Color defaultAmbientLightColor;
private static float defaultFogDensity;
private static float defaultAmbientIntensity;
public override void Setup(Character character)
{
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
//IL_01f7: Unknown result type (might be due to invalid IL or missing references)
//IL_0228: Unknown result type (might be due to invalid IL or missing references)
//IL_023d: Unknown result type (might be due to invalid IL or missing references)
((StatusEffect)this).m_character = character;
if (!string.IsNullOrEmpty(((StatusEffect)this).m_startMessage))
{
((StatusEffect)this).m_character.Message(((StatusEffect)this).m_startMessageType, ((StatusEffect)this).m_startMessage, 0, (Sprite)null);
}
if ((double)base.m_healthOverTime > 0.0 && (double)base.m_healthOverTimeInterval > 0.0)
{
if ((double)base.m_healthOverTimeDuration <= 0.0)
{
base.m_healthOverTimeDuration = ((StatusEffect)this).m_ttl;
}
base.m_healthOverTimeTicks = base.m_healthOverTimeDuration / base.m_healthOverTimeInterval;
base.m_healthOverTimeTickHP = base.m_healthOverTime / base.m_healthOverTimeTicks;
}
if ((double)base.m_staminaOverTime > 0.0 && (double)base.m_staminaOverTimeDuration <= 0.0)
{
base.m_staminaOverTimeDuration = ((StatusEffect)this).m_ttl;
}
healthRegenMult = (float)(1.0 + (double)healthRegenVal / 100.0);
staminaRegenMult = (float)(1.0 + (double)staminaRegenVal / 100.0);
eitrRegenMult = (float)(1.0 + (double)eitrRegenVal / 100.0);
base.m_healthRegenMultiplier = (cosmeticOnly ? 1f : healthRegenMult);
base.m_staminaRegenMultiplier = (cosmeticOnly ? 1f : staminaRegenMult);
base.m_eitrOverTime = (cosmeticOnly ? 10f : 10f);
base.m_eitrRegenMultiplier = (cosmeticOnly ? 10f : 10f);
base.m_eitrOverTimeDuration = (cosmeticOnly ? 10f : 10f);
((StatusEffect)this).m_ttl = (cosmeticOnly ? 20f : ttl);
defaultAmbientLightColor = RenderSettings.ambientLight;
defaultAmbientSkyColor = RenderSettings.ambientSkyColor;
defaultAmbientIntensity = RenderSettings.ambientIntensity;
defaultFogDensity = RenderSettings.fogDensity;
defaultFogColor = RenderSettings.fogColor;
harmony.PatchAll(typeof(Player_UpdateFood_Transpiler));
((StatusEffect)this).m_startEffectInstances = ((StatusEffect)this).m_startEffects.Create(((Component)((StatusEffect)this).m_character.m_head).transform.position, ((Component)((StatusEffect)this).m_character.m_head).transform.rotation, ((Component)((StatusEffect)this).m_character.m_head).transform, ((StatusEffect)this).m_character.GetRadius() * 2f, -1);
}
public bool IsSitting()
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
AnimatorStateInfo currentAnimatorStateInfo = ((StatusEffect)this).m_character.m_animator.GetCurrentAnimatorStateInfo(0);
return ((AnimatorStateInfo)(ref currentAnimatorStateInfo)).tagHash == Character.s_animatorTagSitting;
}
public override void ResetTime()
{
//IL_001d: 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)
((StatusEffect)this).ResetTime();
((StatusEffect)this).m_startEffectInstances = ((StatusEffect)this).m_startEffects.Create(((Component)((StatusEffect)this).m_character.m_head).transform.position, ((Component)((StatusEffect)this).m_character.m_head).transform.rotation, ((Component)((StatusEffect)this).m_character.m_head).transform, ((StatusEffect)this).m_character.GetRadius() * 2f, -1);
}
public override void Stop()
{
((StatusEffect)this).Stop();
harmony.UnpatchSelf();
}
}
public class SE_Hybrid : SE_Stats
{
public int healthRegenVal;
public int staminaRegenVal;
private float healthRegenMult;
private float staminaRegenMult;
public float ttl;
public bool cosmeticOnly;
public EffectList my_effects = new EffectList();
public override void Setup(Character character)
{
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0171: Unknown result type (might be due to invalid IL or missing references)
//IL_0186: Unknown result type (might be due to invalid IL or missing references)
((StatusEffect)this).m_character = character;
if (!string.IsNullOrEmpty(((StatusEffect)this).m_startMessage))
{
((StatusEffect)this).m_character.Message(((StatusEffect)this).m_startMessageType, ((StatusEffect)this).m_startMessage, 0, (Sprite)null);
}
if ((double)base.m_healthOverTime > 0.0 && (double)base.m_healthOverTimeInterval > 0.0)
{
if ((double)base.m_healthOverTimeDuration <= 0.0)
{
base.m_healthOverTimeDuration = ((StatusEffect)this).m_ttl;
}
base.m_healthOverTimeTicks = base.m_healthOverTimeDuration / base.m_healthOverTimeInterval;
base.m_healthOverTimeTickHP = base.m_healthOverTime / base.m_healthOverTimeTicks;
}
if ((double)base.m_staminaOverTime > 0.0 && (double)base.m_staminaOverTimeDuration <= 0.0)
{
base.m_staminaOverTimeDuration = ((StatusEffect)this).m_ttl;
}
healthRegenMult = (float)(1.0 + (double)healthRegenVal / 100.0);
staminaRegenMult = (float)(1.0 + (double)staminaRegenVal / 100.0);
base.m_healthRegenMultiplier = (cosmeticOnly ? 1f : healthRegenMult);
base.m_staminaRegenMultiplier = (cosmeticOnly ? 1f : staminaRegenMult);
((StatusEffect)this).m_ttl = (cosmeticOnly ? 10f : ttl);
((StatusEffect)this).m_startEffectInstances = ((StatusEffect)this).m_startEffects.Create(((Component)((StatusEffect)this).m_character.m_head).transform.position, ((Component)((StatusEffect)this).m_character.m_head).transform.rotation, ((Component)((StatusEffect)this).m_character.m_head).transform, ((StatusEffect)this).m_character.GetRadius() * 2f, -1);
}
public override void ResetTime()
{
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
((StatusEffect)this).ResetTime();
((StatusEffect)this).m_startEffects.Create(((Component)((StatusEffect)this).m_character.m_head).transform.position, ((Component)((StatusEffect)this).m_character.m_head).transform.rotation, ((Component)((StatusEffect)this).m_character.m_head).transform, ((StatusEffect)this).m_character.GetRadius() * 2f, -1);
}
public bool IsSitting()
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
AnimatorStateInfo currentAnimatorStateInfo = ((StatusEffect)this).m_character.m_animator.GetCurrentAnimatorStateInfo(0);
return ((AnimatorStateInfo)(ref currentAnimatorStateInfo)).tagHash == Character.s_animatorTagSitting;
}
public override void Stop()
{
((StatusEffect)this).Stop();
}
}
public class SE_Indica : SE_Stats
{
public int healthRegenVal;
public int staminaRegenVal;
private float healthRegenMult;
private float staminaRegenMult;
public float ttl;
public bool cosmeticOnly;
public override void Setup(Character character)
{
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0225: Unknown result type (might be due to invalid IL or missing references)
//IL_023a: Unknown result type (might be due to invalid IL or missing references)
((StatusEffect)this).m_character = character;
if (!string.IsNullOrEmpty(((StatusEffect)this).m_startMessage))
{
((StatusEffect)this).m_character.Message(((StatusEffect)this).m_startMessageType, ((StatusEffect)this).m_startMessage, 0, (Sprite)null);
}
if ((double)base.m_healthOverTime > 0.0 && (double)base.m_healthOverTimeInterval > 0.0)
{
if ((double)base.m_healthOverTimeDuration <= 0.0)
{
base.m_healthOverTimeDuration = ((StatusEffect)this).m_ttl;
}
base.m_healthOverTimeTicks = base.m_healthOverTimeDuration / base.m_healthOverTimeInterval;
base.m_healthOverTimeTickHP = base.m_healthOverTime / base.m_healthOverTimeTicks;
}
if ((double)base.m_staminaOverTime > 0.0 && (double)base.m_staminaOverTimeDuration <= 0.0)
{
base.m_staminaOverTimeDuration = ((StatusEffect)this).m_ttl;
}
healthRegenMult = (float)(1.0 + (double)healthRegenVal / 100.0);
staminaRegenMult = (float)(1.0 + (double)staminaRegenVal / 100.0);
base.m_healthRegenMultiplier = (cosmeticOnly ? 1f : healthRegenMult);
base.m_staminaRegenMultiplier = (cosmeticOnly ? 1f : staminaRegenMult);
((StatusEffect)this).m_ttl = (cosmeticOnly ? 10f : ttl);
if (!cosmeticOnly)
{
Character character2 = ((StatusEffect)this).m_character;
Player val = (Player)(object)((character2 is Player) ? character2 : null);
List<StatusEffect> statusEffects = ((Character)val).GetSEMan().m_statusEffects;
bool flag = false;
for (int i = 0; i < statusEffects.Count; i++)
{
if (((object)statusEffects[i]).GetType() == typeof(SE_Rested))
{
statusEffects[i].m_ttl = statusEffects[i].m_ttl - statusEffects[i].m_time + ttl;
statusEffects[i].m_time = 0f;
flag = true;
break;
}
}
if (!flag)
{
((Character)val).m_seman.AddStatusEffect(StringExtensionMethods.GetStableHashCode("Rested"), true, 0, 0f);
}
}
((StatusEffect)this).m_startEffectInstances = ((StatusEffect)this).m_startEffects.Create(((Component)((StatusEffect)this).m_character.m_head).transform.position, ((Component)((StatusEffect)this).m_character.m_head).transform.rotation, ((Component)((StatusEffect)this).m_character.m_head).transform, ((StatusEffect)this).m_character.GetRadius() * 2f, -1);
}
public override void ResetTime()
{
//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
//IL_010b: Unknown result type (might be due to invalid IL or missing references)
((StatusEffect)this).ResetTime();
float radius = ((StatusEffect)this).m_character.GetRadius();
if (!cosmeticOnly)
{
Character character = ((StatusEffect)this).m_character;
Player val = (Player)(object)((character is Player) ? character : null);
List<StatusEffect> statusEffects = ((Character)val).GetSEMan().m_statusEffects;
bool flag = false;
for (int i = 0; i < statusEffects.Count; i++)
{
if (((object)statusEffects[i]).GetType() == typeof(SE_Rested))
{
statusEffects[i].m_ttl = (float)((double)statusEffects[i].m_ttl - (double)statusEffects[i].m_time + (double)ttl / 2.0);
statusEffects[i].m_time = 0f;
flag = true;
break;
}
}
if (!flag)
{
((Character)val).m_seman.AddStatusEffect(StringExtensionMethods.GetStableHashCode("Rested"), true, 0, 0f);
}
}
((StatusEffect)this).m_startEffects.Create(((Component)((StatusEffect)this).m_character.m_head).transform.position, ((Component)((StatusEffect)this).m_character.m_head).transform.rotation, ((Component)((StatusEffect)this).m_character.m_head).transform, radius * 2f, -1);
}
public bool IsSitting()
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
AnimatorStateInfo currentAnimatorStateInfo = ((StatusEffect)this).m_character.m_animator.GetCurrentAnimatorStateInfo(0);
return ((AnimatorStateInfo)(ref currentAnimatorStateInfo)).tagHash == Character.s_animatorTagSitting;
}
public override void Stop()
{
((StatusEffect)this).Stop();
}
}
public class SE_Sativa : SE_Stats
{
[HarmonyPatch(typeof(Player), "UpdateFood")]
public static class Player_UpdateFood_Transpiler
{
private static FieldInfo field_Player_m_foodUpdateTimer = AccessTools.Field(typeof(Player), "m_foodUpdateTimer");
private static MethodInfo method_ComputeModifiedDt = AccessTools.Method(typeof(Player_UpdateFood_Transpiler), "ComputeModifiedDT", (Type[])null, (Type[])null);
[HarmonyTranspiler]
public static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
{
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_006b: Expected O, but got Unknown
List<CodeInstruction> list = instructions.ToList();
for (int i = 0; i < list.Count - 2; i++)
{
if (CodeInstructionExtensions.LoadsField(list[i], field_Player_m_foodUpdateTimer, false) && list[i + 1].opcode == OpCodes.Ldarg_1 && list[i + 2].opcode == OpCodes.Add)
{
list.Insert(i + 2, new CodeInstruction(OpCodes.Call, (object)method_ComputeModifiedDt));
}
}
return list.AsEnumerable();
}
private static float ComputeModifiedDT(float dt)
{
return dt / applyModifierValue(1f, 50f);
static float applyModifierValue(float targetValue, float value)
{
if ((double)value <= -100.0)
{
value = -100f;
}
if (!((double)value < 0.0))
{
return targetValue + targetValue / 100f * value;
}
return targetValue - (float)((double)targetValue / 100.0 * ((double)value * -1.0));
}
}
}
private Harmony harmony = new Harmony("com.drod917.Valweed.SESativa");
public int healthRegenVal;
public int staminaRegenVal;
public int hungerSlowRate;
private float healthRegenMult;
private float staminaRegenMult;
public float ttl;
public bool cosmeticOnly;
public EffectList my_effects = new EffectList();
public override void Setup(Character character)
{
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_018e: Unknown result type (might be due to invalid IL or missing references)
//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
((StatusEffect)this).m_character = character;
if (!string.IsNullOrEmpty(((StatusEffect)this).m_startMessage))
{
((StatusEffect)this).m_character.Message(((StatusEffect)this).m_startMessageType, ((StatusEffect)this).m_startMessage, 0, (Sprite)null);
}
if ((double)base.m_healthOverTime > 0.0 && (double)base.m_healthOverTimeInterval > 0.0)
{
if ((double)base.m_healthOverTimeDuration <= 0.0)
{
base.m_healthOverTimeDuration = ((StatusEffect)this).m_ttl;
}
base.m_healthOverTimeTicks = base.m_healthOverTimeDuration / base.m_healthOverTimeInterval;
base.m_healthOverTimeTickHP = base.m_healthOverTime / base.m_healthOverTimeTicks;
}
if ((double)base.m_staminaOverTime > 0.0 && (double)base.m_staminaOverTimeDuration <= 0.0)
{
base.m_staminaOverTimeDuration = ((StatusEffect)this).m_ttl;
}
healthRegenMult = (float)(1.0 + (double)healthRegenVal / 100.0);
staminaRegenMult = (float)(1.0 + (double)staminaRegenVal / 100.0);
base.m_healthRegenMultiplier = (cosmeticOnly ? 1f : healthRegenMult);
base.m_staminaRegenMultiplier = (cosmeticOnly ? 1f : staminaRegenMult);
((StatusEffect)this).m_ttl = (cosmeticOnly ? 10f : ttl);
if (!cosmeticOnly)
{
harmony.PatchAll(typeof(Player_UpdateFood_Transpiler));
}
((StatusEffect)this).m_startEffectInstances = ((StatusEffect)this).m_startEffects.Create(((Component)((StatusEffect)this).m_character.m_head).transform.position, ((Component)((StatusEffect)this).m_character.m_head).transform.rotation, ((Component)((StatusEffect)this).m_character.m_head).transform, ((StatusEffect)this).m_character.GetRadius() * 2f, -1);
}
public override void ResetTime()
{
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
((StatusEffect)this).ResetTime();
((StatusEffect)this).m_startEffects.Create(((Component)((StatusEffect)this).m_character.m_head).transform.position, ((Component)((StatusEffect)this).m_character.m_head).transform.rotation, ((Component)((StatusEffect)this).m_character.m_head).transform, ((StatusEffect)this).m_character.GetRadius() * 2f, -1);
}
public bool IsSitting()
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
AnimatorStateInfo currentAnimatorStateInfo = ((StatusEffect)this).m_character.m_animator.GetCurrentAnimatorStateInfo(0);
return ((AnimatorStateInfo)(ref currentAnimatorStateInfo)).tagHash == Character.s_animatorTagSitting;
}
public override void Stop()
{
((StatusEffect)this).Stop();
harmony.UnpatchSelf();
}
}
namespace Valweed;
[BepInPlugin("com.drod917.Valweed", "Valweed", "0.3.4")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
internal class Valweed : BaseUnityPlugin
{
[HarmonyPatch(typeof(Plant), "HaveRoof")]
public static class PlantHaveRoof
{
public static bool Prefix(Plant __instance, ref bool __result)
{
if (!(__instance.m_name == "$piece_sapling_weed") && !(__instance.m_name == "$piece_sapling_weed_seeds"))
{
return true;
}
__result = false;
return false;
}
}
[HarmonyPatch(typeof(Player), "CanConsumeItem")]
public static class PlayerCanConsumeItem
{
public static bool Prefix(ItemData item, bool checkWorldLevel = false)
{
if (Object.op_Implicit((Object)(object)item.m_shared.m_consumeStatusEffect))
{
Player localPlayer = Player.m_localPlayer;
StatusEffect consumeStatusEffect = item.m_shared.m_consumeStatusEffect;
if ((item.m_shared.m_consumeStatusEffect.m_name.EndsWith("joint_effectname") && ((Character)localPlayer).m_seman.HaveStatusEffect(item.m_shared.m_consumeStatusEffect.m_nameHash)) || ((Character)localPlayer).m_seman.HaveStatusEffectCategory(consumeStatusEffect.m_category))
{
return false;
}
}
return true;
}
}
public const string PluginGUID = "com.drod917.Valweed";
public const string PluginName = "Valweed";
public const string PluginVersion = "0.3.4";
private Harmony harmony = new Harmony("com.drod917.Valweed");
private AssetBundle jointResourceBundle;
private AssetBundle plantResourceBundle;
private AssetBundle bongResourceBundle;
private AssetBundle spriteBundle;
private GameObject hybridJointPrefab;
private GameObject indicaJointPrefab;
private GameObject sativaJointPrefab;
private GameObject weedSaplingPrefab;
private GameObject weedSeedSaplingPrefab;
private GameObject pickableWeedPrefab;
private GameObject pickableSeedWeedPrefab;
private GameObject weedNugsPrefab;
private GameObject weedNugPrefab;
private GameObject weedSeedsPrefab;
private GameObject weedPaperPrefab;
private GameObject bongPrefab;
private GameObject bongNoisePrefab;
private GameObject bongSmokePrefab;
private GameObject bongMouthSmokePrefab;
private GameObject bongInhaleNoisePrefab;
private GameObject mouthSmokePrefab;
private GameObject jointNoisePrefab;
private CustomStatusEffect hybridJointEffect;
private CustomStatusEffect indicaJointEffect;
private CustomStatusEffect sativaJointEffect;
private CustomStatusEffect bongStatusEffect;
private int jointHealthRegenVal;
private int jointStamRegenVal;
private float jointEffectTime;
private bool cosmeticOnly;
private int seedGrowTime;
private int seedYield;
private int seedYieldBonus;
private float seedYieldBonusChance;
private int budGrowTime;
private int budYield;
private int budYieldBonus;
private float budYieldBonusChance;
private void Awake()
{
initConfig();
LoadAssets();
AddStatusEffects();
CreateItems();
CreatePieces();
harmony.PatchAll(typeof(PlantHaveRoof));
harmony.PatchAll(typeof(PlayerCanConsumeItem));
((BaseUnityPlugin)this).Config.SaveOnConfigSet = true;
((BaseUnityPlugin)this).Config.SettingChanged += delegate(object sender, SettingChangedEventArgs args)
{
SettingChanged(((BaseUnityPlugin)this).Config, args);
};
}
private void initConfig()
{
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Expected O, but got Unknown
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: Expected O, but got Unknown
//IL_0077: 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_0084: Expected O, but got Unknown
//IL_0084: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: Expected O, but got Unknown
//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
//IL_00d4: Expected O, but got Unknown
//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
//IL_00de: Expected O, but got Unknown
//IL_0109: Unknown result type (might be due to invalid IL or missing references)
//IL_010e: Unknown result type (might be due to invalid IL or missing references)
//IL_0116: Expected O, but got Unknown
//IL_0116: Unknown result type (might be due to invalid IL or missing references)
//IL_0120: Expected O, but got Unknown
//IL_0159: Unknown result type (might be due to invalid IL or missing references)
//IL_015e: Unknown result type (might be due to invalid IL or missing references)
//IL_0166: Expected O, but got Unknown
//IL_0166: Unknown result type (might be due to invalid IL or missing references)
//IL_0170: Expected O, but got Unknown
//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
//IL_01ae: Expected O, but got Unknown
//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
//IL_01b8: Expected O, but got Unknown
//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
//IL_01f6: Expected O, but got Unknown
//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
//IL_0200: Expected O, but got Unknown
//IL_0232: Unknown result type (might be due to invalid IL or missing references)
//IL_0237: Unknown result type (might be due to invalid IL or missing references)
//IL_023f: Expected O, but got Unknown
//IL_023f: Unknown result type (might be due to invalid IL or missing references)
//IL_0249: Expected O, but got Unknown
//IL_0289: Unknown result type (might be due to invalid IL or missing references)
//IL_028e: Unknown result type (might be due to invalid IL or missing references)
//IL_0296: Expected O, but got Unknown
//IL_0296: Unknown result type (might be due to invalid IL or missing references)
//IL_02a0: Expected O, but got Unknown
//IL_02d1: Unknown result type (might be due to invalid IL or missing references)
//IL_02d6: Unknown result type (might be due to invalid IL or missing references)
//IL_02de: Expected O, but got Unknown
//IL_02de: Unknown result type (might be due to invalid IL or missing references)
//IL_02e8: Expected O, but got Unknown
//IL_0319: Unknown result type (might be due to invalid IL or missing references)
//IL_031e: Unknown result type (might be due to invalid IL or missing references)
//IL_0326: Expected O, but got Unknown
//IL_0326: Unknown result type (might be due to invalid IL or missing references)
//IL_0330: Expected O, but got Unknown
//IL_0362: Unknown result type (might be due to invalid IL or missing references)
//IL_0367: Unknown result type (might be due to invalid IL or missing references)
//IL_036f: Expected O, but got Unknown
//IL_036f: Unknown result type (might be due to invalid IL or missing references)
//IL_0379: Expected O, but got Unknown
jointHealthRegenVal = ((BaseUnityPlugin)this).Config.Bind<int>("Buff Settings", "Joint Health Regen Rate", 50, new ConfigDescription("Percent rate to increase health regen (Default 50 (+50%))", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 1000), new object[1] { (object)new ConfigurationManagerAttributes
{
IsAdminOnly = true
} })).Value;
jointStamRegenVal = ((BaseUnityPlugin)this).Config.Bind<int>("Buff Settings", "Joint Stamina Regen Rate", 100, new ConfigDescription("Percent rate to increase stamina regen (Default 100 (+100%))", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 1000), new object[1] { (object)new ConfigurationManagerAttributes
{
IsAdminOnly = true
} })).Value;
jointEffectTime = ((BaseUnityPlugin)this).Config.Bind<int>("Buff Settings", "Joint Buff Duration", 600, new ConfigDescription("Effective time for smoking to last (Default 600s (10m))", (AcceptableValueBase)(object)new AcceptableValueRange<int>(20, 3600), new object[1] { (object)new ConfigurationManagerAttributes
{
IsAdminOnly = true
} })).Value;
cosmeticOnly = ((BaseUnityPlugin)this).Config.Bind<bool>("Buff Settings", "Cosmetic Effects Only", false, new ConfigDescription("Disables health and stamina regen modifiers. (Default Off)", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
{
IsAdminOnly = true
} })).Value;
seedGrowTime = ((BaseUnityPlugin)this).Config.Bind<int>("Yield Settings", "Seed Grow Time", 4000, new ConfigDescription("Adjusts how long until seeds can be harvested. (Default 4000)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(10, 16000), new object[1] { (object)new ConfigurationManagerAttributes
{
IsAdminOnly = true
} })).Value;
seedYield = ((BaseUnityPlugin)this).Config.Bind<int>("Yield Settings", "Seed Yield", 2, new ConfigDescription("Adjusts how many seeds are harvested. (Default 2)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 99), new object[1] { (object)new ConfigurationManagerAttributes
{
IsAdminOnly = true
} })).Value;
seedYieldBonus = ((BaseUnityPlugin)this).Config.Bind<int>("Yield Settings", "Seed Yield Bonus", 1, new ConfigDescription("Adjusts how many bonus seeds are harvested. (Default 1)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 99), new object[1] { (object)new ConfigurationManagerAttributes
{
IsAdminOnly = true
} })).Value;
seedYieldBonusChance = (float)((BaseUnityPlugin)this).Config.Bind<int>("Yield Settings", "Seed Yield Bonus Chance", 75, new ConfigDescription("Adjusts the chance to harvest bonus seeds. (Default 75%)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 100), new object[1] { (object)new ConfigurationManagerAttributes
{
IsAdminOnly = true
} })).Value / 100f;
budGrowTime = ((BaseUnityPlugin)this).Config.Bind<int>("Yield Settings", "Bud Grow Time", 4000, new ConfigDescription("Adjusts how long until buds can be harvested. (Default 4000)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(10, 16000), new object[1] { (object)new ConfigurationManagerAttributes
{
IsAdminOnly = true
} })).Value;
budYield = ((BaseUnityPlugin)this).Config.Bind<int>("Yield Settings", "Bud Yield", 1, new ConfigDescription("Adjusts how many buds are harvested. (Default 1)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 99), new object[1] { (object)new ConfigurationManagerAttributes
{
IsAdminOnly = true
} })).Value;
budYieldBonus = ((BaseUnityPlugin)this).Config.Bind<int>("Yield Settings", "Bud Yield Bonus", 2, new ConfigDescription("Adjusts how many bonus buds are harvested. (Default 2)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 99), new object[1] { (object)new ConfigurationManagerAttributes
{
IsAdminOnly = true
} })).Value;
budYieldBonusChance = (float)((BaseUnityPlugin)this).Config.Bind<int>("Yield Settings", "Bud Yield Bonus Chance", 75, new ConfigDescription("Adjusts the chance to harvest bonus buds. (Default 75%)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 100), new object[1] { (object)new ConfigurationManagerAttributes
{
IsAdminOnly = true
} })).Value / 100f;
}
private void SettingChanged(ConfigFile sender, SettingChangedEventArgs args)
{
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
initConfig();
PrefabManager.Instance.GetPrefab("Bong").GetComponent<Bong>().cosmeticOnly = cosmeticOnly;
Plant component = PrefabManager.Instance.GetPrefab("sapling_weed").GetComponent<Plant>();
component.m_growTime = budGrowTime;
component.m_growTimeMax = budGrowTime;
component.m_biome = (Biome)25;
Pickable component2 = PrefabManager.Instance.GetPrefab("Pickable_WeedPlant").GetComponent<Pickable>();
component2.m_amount = budYield;
component2.m_extraDrops.m_dropMin = budYieldBonus;
component2.m_extraDrops.m_dropMax = budYieldBonus;
component2.m_extraDrops.m_dropChance = budYieldBonusChance;
Plant component3 = PrefabManager.Instance.GetPrefab("sapling_seedweed").GetComponent<Plant>();
component3.m_growTime = seedGrowTime;
component3.m_growTimeMax = seedGrowTime;
component3.m_biome = (Biome)25;
Pickable component4 = PrefabManager.Instance.GetPrefab("Pickable_SeedWeedPlant").GetComponent<Pickable>();
component4.m_amount = seedYield;
component4.m_extraDrops.m_dropMin = seedYieldBonus;
component4.m_extraDrops.m_dropMax = seedYieldBonus;
component4.m_extraDrops.m_dropChance = seedYieldBonusChance;
SE_Sativa sE_Sativa = Object.FindObjectOfType<SE_Sativa>();
sE_Sativa.cosmeticOnly = cosmeticOnly;
sE_Sativa.healthRegenVal = jointHealthRegenVal;
sE_Sativa.staminaRegenVal = jointStamRegenVal;
sE_Sativa.ttl = jointEffectTime;
((StatusEffect)sE_Sativa).m_tooltip = "$sativa_joint_tooltip" + (cosmeticOnly ? "" : "\n\nHunger Rate -50%");
SE_Indica sE_Indica = Object.FindObjectOfType<SE_Indica>();
sE_Indica.cosmeticOnly = cosmeticOnly;
sE_Indica.healthRegenVal = jointHealthRegenVal;
sE_Indica.staminaRegenVal = jointStamRegenVal;
sE_Indica.ttl = jointEffectTime;
((StatusEffect)sE_Indica).m_tooltip = "$indica_joint_tooltip";
SE_Hybrid sE_Hybrid = Object.FindObjectOfType<SE_Hybrid>();
sE_Hybrid.cosmeticOnly = cosmeticOnly;
sE_Hybrid.healthRegenVal = jointHealthRegenVal;
sE_Hybrid.staminaRegenVal = jointStamRegenVal;
sE_Hybrid.ttl = jointEffectTime;
((StatusEffect)sE_Hybrid).m_tooltip = "$hybrid_joint_tooltip";
SE_Bong sE_Bong = Object.FindObjectOfType<SE_Bong>();
sE_Bong.cosmeticOnly = cosmeticOnly;
sE_Bong.healthRegenVal = jointHealthRegenVal;
sE_Bong.staminaRegenVal = jointStamRegenVal;
sE_Bong.ttl = jointEffectTime * 3f;
((StatusEffect)sE_Bong).m_tooltip = "$bong_tooltip" + (cosmeticOnly ? "" : "\nHunger Rate -50%");
}
private void Update()
{
}
private void LoadAssets()
{
//IL_0206: Unknown result type (might be due to invalid IL or missing references)
//IL_02ad: Unknown result type (might be due to invalid IL or missing references)
jointResourceBundle = AssetUtils.LoadAssetBundleFromResources("joint", Assembly.GetExecutingAssembly());
hybridJointPrefab = jointResourceBundle.LoadAsset<GameObject>("JointHybrid");
indicaJointPrefab = jointResourceBundle.LoadAsset<GameObject>("JointIndica");
sativaJointPrefab = jointResourceBundle.LoadAsset<GameObject>("JointSativa");
weedPaperPrefab = jointResourceBundle.LoadAsset<GameObject>("JointPaper");
jointNoisePrefab = jointResourceBundle.LoadAsset<GameObject>("sfx_hit_joint");
plantResourceBundle = AssetUtils.LoadAssetBundleFromResources("plant", Assembly.GetExecutingAssembly());
weedSaplingPrefab = plantResourceBundle.LoadAsset<GameObject>("sapling_weed");
weedSeedSaplingPrefab = plantResourceBundle.LoadAsset<GameObject>("sapling_seedweed");
pickableWeedPrefab = plantResourceBundle.LoadAsset<GameObject>("Pickable_WeedPlant");
pickableSeedWeedPrefab = plantResourceBundle.LoadAsset<GameObject>("Pickable_SeedWeedPlant");
weedNugsPrefab = plantResourceBundle.LoadAsset<GameObject>("WeedBuds");
weedSeedsPrefab = plantResourceBundle.LoadAsset<GameObject>("WeedSeeds");
bongResourceBundle = AssetUtils.LoadAssetBundleFromResources("bong", Assembly.GetExecutingAssembly());
bongPrefab = bongResourceBundle.LoadAsset<GameObject>("Bong");
weedNugPrefab = bongResourceBundle.LoadAsset<GameObject>("bud");
bongNoisePrefab = bongResourceBundle.LoadAsset<GameObject>("sfx_hit_bong");
bongInhaleNoisePrefab = bongResourceBundle.LoadAsset<GameObject>("sfx_hit_bong_inhale");
bongSmokePrefab = bongResourceBundle.LoadAsset<GameObject>("vfx_bong_smoke");
mouthSmokePrefab = bongResourceBundle.LoadAsset<GameObject>("vfx_mouth_smoke");
bongMouthSmokePrefab = bongResourceBundle.LoadAsset<GameObject>("vfx_mouth_smoke_bong");
weedSaplingPrefab.GetComponent<Plant>().m_growTime = budGrowTime;
weedSaplingPrefab.GetComponent<Plant>().m_growTimeMax = budGrowTime;
weedSaplingPrefab.GetComponent<Plant>().m_biome = (Biome)25;
pickableWeedPrefab.GetComponent<Pickable>().m_amount = budYield;
pickableWeedPrefab.GetComponent<Pickable>().m_extraDrops.m_dropMin = budYieldBonus;
pickableWeedPrefab.GetComponent<Pickable>().m_extraDrops.m_dropMax = budYieldBonus;
pickableWeedPrefab.GetComponent<Pickable>().m_extraDrops.m_dropChance = budYieldBonusChance;
weedSeedSaplingPrefab.GetComponent<Plant>().m_growTime = seedGrowTime;
weedSeedSaplingPrefab.GetComponent<Plant>().m_growTimeMax = seedGrowTime;
weedSeedSaplingPrefab.GetComponent<Plant>().m_biome = (Biome)25;
pickableSeedWeedPrefab.GetComponent<Pickable>().m_amount = seedYield;
pickableSeedWeedPrefab.GetComponent<Pickable>().m_extraDrops.m_dropMin = seedYieldBonus;
pickableSeedWeedPrefab.GetComponent<Pickable>().m_extraDrops.m_dropMax = seedYieldBonus;
pickableSeedWeedPrefab.GetComponent<Pickable>().m_extraDrops.m_dropChance = seedYieldBonusChance;
PrefabManager.Instance.AddPrefab(pickableWeedPrefab);
PrefabManager.Instance.AddPrefab(pickableSeedWeedPrefab);
PrefabManager.Instance.AddPrefab(weedNugPrefab);
PrefabManager.Instance.AddPrefab(bongSmokePrefab);
PrefabManager.Instance.AddPrefab(bongNoisePrefab);
PrefabManager.Instance.AddPrefab(mouthSmokePrefab);
PrefabManager.Instance.AddPrefab(jointNoisePrefab);
PrefabManager.Instance.AddPrefab(bongMouthSmokePrefab);
}
private void AddStatusEffects()
{
//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_003e: 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_004d: Expected O, but got Unknown
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Expected O, but got Unknown
//IL_0076: Unknown result type (might be due to invalid IL or missing references)
//IL_007b: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_0097: Expected O, but got Unknown
//IL_0097: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
//IL_00af: Unknown result type (might be due to invalid IL or missing references)
//IL_00b8: Expected O, but got Unknown
//IL_013b: Unknown result type (might be due to invalid IL or missing references)
//IL_014f: Unknown result type (might be due to invalid IL or missing references)
//IL_0181: Unknown result type (might be due to invalid IL or missing references)
//IL_018b: Expected O, but got Unknown
//IL_01fa: Unknown result type (might be due to invalid IL or missing references)
//IL_020e: Unknown result type (might be due to invalid IL or missing references)
//IL_0240: Unknown result type (might be due to invalid IL or missing references)
//IL_024a: Expected O, but got Unknown
//IL_02b9: Unknown result type (might be due to invalid IL or missing references)
//IL_02cd: Unknown result type (might be due to invalid IL or missing references)
//IL_0318: Unknown result type (might be due to invalid IL or missing references)
//IL_0322: Expected O, but got Unknown
//IL_0397: Unknown result type (might be due to invalid IL or missing references)
//IL_03ab: Unknown result type (might be due to invalid IL or missing references)
//IL_03f7: Unknown result type (might be due to invalid IL or missing references)
//IL_0401: Expected O, but got Unknown
spriteBundle = AssetUtils.LoadAssetBundleFromResources("high_eyes", Assembly.GetExecutingAssembly());
Sprite val = spriteBundle.LoadAsset<Sprite>("Assets/Joint/high_eyes.png");
EffectData[] array = (EffectData[])(object)new EffectData[2];
EffectData val2 = new EffectData
{
m_prefab = mouthSmokePrefab,
m_attach = true,
m_enabled = true
};
EffectData val3 = new EffectData
{
m_prefab = jointNoisePrefab,
m_enabled = true
};
array[0] = val2;
array[1] = val3;
EffectData[] array2 = (EffectData[])(object)new EffectData[2];
EffectData val4 = new EffectData
{
m_prefab = bongMouthSmokePrefab,
m_attach = true,
m_enabled = true
};
EffectData val5 = new EffectData
{
m_prefab = bongInhaleNoisePrefab,
m_attach = true,
m_enabled = true
};
array2[0] = val4;
array2[1] = val5;
if ((Object)(object)val == (Object)null)
{
((BaseUnityPlugin)this).Logger.LogInfo((object)"statusIcon NULL");
}
SE_Hybrid sE_Hybrid = ScriptableObject.CreateInstance<SE_Hybrid>();
sE_Hybrid.healthRegenVal = jointHealthRegenVal;
sE_Hybrid.staminaRegenVal = jointStamRegenVal;
sE_Hybrid.ttl = jointEffectTime;
sE_Hybrid.cosmeticOnly = cosmeticOnly;
((Object)sE_Hybrid).name = "HybridJointStatusEffect";
((StatusEffect)sE_Hybrid).m_name = "$hybrid_joint_effectname";
((StatusEffect)sE_Hybrid).m_icon = val;
((StatusEffect)sE_Hybrid).m_startMessageType = (MessageType)2;
((StatusEffect)sE_Hybrid).m_startMessage = "$joint_effectstart";
((StatusEffect)sE_Hybrid).m_stopMessageType = (MessageType)2;
((StatusEffect)sE_Hybrid).m_stopMessage = "$joint_effectstop";
string tooltip = "$hybrid_joint_tooltip";
((StatusEffect)sE_Hybrid).m_tooltip = tooltip;
((StatusEffect)sE_Hybrid).m_startEffects.m_effectPrefabs = array;
hybridJointEffect = new CustomStatusEffect((StatusEffect)(object)sE_Hybrid, false);
ItemManager.Instance.AddStatusEffect(hybridJointEffect);
SE_Indica sE_Indica = ScriptableObject.CreateInstance<SE_Indica>();
sE_Indica.healthRegenVal = jointHealthRegenVal;
sE_Indica.staminaRegenVal = jointStamRegenVal;
sE_Indica.ttl = jointEffectTime;
sE_Indica.cosmeticOnly = cosmeticOnly;
((Object)sE_Indica).name = "IndicaJointStatusEffect";
((StatusEffect)sE_Indica).m_name = "$indica_joint_effectname";
((StatusEffect)sE_Indica).m_icon = val;
((StatusEffect)sE_Indica).m_startMessageType = (MessageType)2;
((StatusEffect)sE_Indica).m_startMessage = "$joint_effectstart";
((StatusEffect)sE_Indica).m_stopMessageType = (MessageType)2;
((StatusEffect)sE_Indica).m_stopMessage = "$joint_effectstop";
string tooltip2 = "$indica_joint_tooltip";
((StatusEffect)sE_Indica).m_tooltip = tooltip2;
((StatusEffect)sE_Indica).m_startEffects.m_effectPrefabs = array;
indicaJointEffect = new CustomStatusEffect((StatusEffect)(object)sE_Indica, false);
ItemManager.Instance.AddStatusEffect(indicaJointEffect);
SE_Sativa sE_Sativa = ScriptableObject.CreateInstance<SE_Sativa>();
sE_Sativa.healthRegenVal = jointHealthRegenVal;
sE_Sativa.staminaRegenVal = jointStamRegenVal;
sE_Sativa.ttl = jointEffectTime;
sE_Sativa.cosmeticOnly = cosmeticOnly;
((Object)sE_Sativa).name = "SativaJointStatusEffect";
((StatusEffect)sE_Sativa).m_name = "$sativa_joint_effectname";
((StatusEffect)sE_Sativa).m_icon = val;
((StatusEffect)sE_Sativa).m_startMessageType = (MessageType)2;
((StatusEffect)sE_Sativa).m_startMessage = "$joint_effectstart";
((StatusEffect)sE_Sativa).m_stopMessageType = (MessageType)2;
((StatusEffect)sE_Sativa).m_stopMessage = "$joint_effectstop";
string tooltip3 = "$sativa_joint_tooltip" + (cosmeticOnly ? "" : "\n\nHunger Rate -50%");
((StatusEffect)sE_Sativa).m_tooltip = tooltip3;
((StatusEffect)sE_Sativa).m_startEffects.m_effectPrefabs = array;
sativaJointEffect = new CustomStatusEffect((StatusEffect)(object)sE_Sativa, false);
ItemManager.Instance.AddStatusEffect(sativaJointEffect);
SE_Bong sE_Bong = ScriptableObject.CreateInstance<SE_Bong>();
sE_Bong.healthRegenVal = jointHealthRegenVal;
sE_Bong.staminaRegenVal = jointStamRegenVal;
sE_Bong.ttl = jointEffectTime * 3f;
sE_Bong.cosmeticOnly = cosmeticOnly;
((Object)sE_Bong).name = "BongStatusEffect";
((StatusEffect)sE_Bong).m_name = "$bong_effectname";
((StatusEffect)sE_Bong).m_icon = val;
((StatusEffect)sE_Bong).m_startMessageType = (MessageType)2;
((StatusEffect)sE_Bong).m_startMessage = "$bong_effectstart";
((StatusEffect)sE_Bong).m_stopMessageType = (MessageType)2;
((StatusEffect)sE_Bong).m_stopMessage = "$joint_effectstop";
string tooltip4 = "$bong_tooltip" + (cosmeticOnly ? "" : "\nHunger Rate -50%");
((StatusEffect)sE_Bong).m_tooltip = tooltip4;
((StatusEffect)sE_Bong).m_startEffects.m_effectPrefabs = array2;
bongStatusEffect = new CustomStatusEffect((StatusEffect)(object)sE_Bong, false);
ItemManager.Instance.AddStatusEffect(bongStatusEffect);
}
private void CreateItems()
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Expected O, but got Unknown
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Expected O, but got Unknown
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: Expected O, but got Unknown
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: 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_0069: Expected O, but got Unknown
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_0093: Unknown result type (might be due to invalid IL or missing references)
//IL_00b8: Expected O, but got Unknown
//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
//IL_00c7: Expected O, but got Unknown
//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
//IL_00de: Unknown result type (might be due to invalid IL or missing references)
//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
//IL_00f1: Expected O, but got Unknown
//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
//IL_0103: Unknown result type (might be due to invalid IL or missing references)
//IL_010b: Expected O, but got Unknown
//IL_010d: Unknown result type (might be due to invalid IL or missing references)
//IL_0112: Unknown result type (might be due to invalid IL or missing references)
//IL_011d: Unknown result type (might be due to invalid IL or missing references)
//IL_0125: Expected O, but got Unknown
//IL_0137: Unknown result type (might be due to invalid IL or missing references)
//IL_013c: Unknown result type (might be due to invalid IL or missing references)
//IL_014d: Unknown result type (might be due to invalid IL or missing references)
//IL_0152: Unknown result type (might be due to invalid IL or missing references)
//IL_0177: Expected O, but got Unknown
//IL_0180: Unknown result type (might be due to invalid IL or missing references)
//IL_0187: Expected O, but got Unknown
//IL_0199: Unknown result type (might be due to invalid IL or missing references)
//IL_019e: Unknown result type (might be due to invalid IL or missing references)
//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
//IL_01b1: Expected O, but got Unknown
//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
//IL_01cb: Expected O, but got Unknown
//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
//IL_01e5: Expected O, but got Unknown
//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
//IL_020e: Unknown result type (might be due to invalid IL or missing references)
//IL_0213: Unknown result type (might be due to invalid IL or missing references)
//IL_0238: Expected O, but got Unknown
//IL_0241: Unknown result type (might be due to invalid IL or missing references)
//IL_0248: Expected O, but got Unknown
//IL_025a: Unknown result type (might be due to invalid IL or missing references)
//IL_025f: Unknown result type (might be due to invalid IL or missing references)
//IL_026a: Unknown result type (might be due to invalid IL or missing references)
//IL_0272: Expected O, but got Unknown
//IL_0285: Unknown result type (might be due to invalid IL or missing references)
//IL_028f: Expected O, but got Unknown
//IL_029c: Unknown result type (might be due to invalid IL or missing references)
//IL_02a6: Expected O, but got Unknown
//IL_02af: Unknown result type (might be due to invalid IL or missing references)
//IL_02b6: Expected O, but got Unknown
//IL_02c8: Unknown result type (might be due to invalid IL or missing references)
//IL_02cd: Unknown result type (might be due to invalid IL or missing references)
//IL_02d8: Unknown result type (might be due to invalid IL or missing references)
//IL_02e0: Expected O, but got Unknown
//IL_02f3: Unknown result type (might be due to invalid IL or missing references)
//IL_02fd: Expected O, but got Unknown
GameObject val = hybridJointPrefab;
ItemConfig val2 = new ItemConfig();
val2.Amount = 1;
val2.Requirements = (RequirementConfig[])(object)new RequirementConfig[3]
{
new RequirementConfig
{
Item = "JointPaper",
Amount = 1
},
new RequirementConfig
{
Item = "WeedBuds",
Amount = 1
},
new RequirementConfig
{
Item = "Raspberry",
Amount = 1
}
};
ItemConfig val3 = val2;
ItemManager instance = ItemManager.Instance;
CustomItem val4 = new CustomItem(val, false, val3);
val4.ItemDrop.m_itemData.m_shared.m_itemType = (ItemType)2;
val4.ItemDrop.m_itemData.m_shared.m_consumeStatusEffect = hybridJointEffect.StatusEffect;
instance.AddItem(val4);
GameObject val5 = indicaJointPrefab;
ItemConfig val6 = new ItemConfig();
val6.Amount = 1;
val6.Requirements = (RequirementConfig[])(object)new RequirementConfig[3]
{
new RequirementConfig
{
Item = "JointPaper",
Amount = 1
},
new RequirementConfig
{
Item = "WeedBuds",
Amount = 1
},
new RequirementConfig
{
Item = "Blueberries",
Amount = 1
}
};
ItemConfig val7 = val6;
ItemManager instance2 = ItemManager.Instance;
CustomItem val8 = new CustomItem(val5, false, val7);
val8.ItemDrop.m_itemData.m_shared.m_itemType = (ItemType)2;
val8.ItemDrop.m_itemData.m_shared.m_consumeStatusEffect = indicaJointEffect.StatusEffect;
instance2.AddItem(val8);
GameObject val9 = sativaJointPrefab;
ItemConfig val10 = new ItemConfig();
val10.Amount = 1;
val10.Requirements = (RequirementConfig[])(object)new RequirementConfig[3]
{
new RequirementConfig
{
Item = "JointPaper",
Amount = 1
},
new RequirementConfig
{
Item = "WeedBuds",
Amount = 1
},
new RequirementConfig
{
Item = "Honey",
Amount = 1
}
};
ItemConfig val11 = val10;
ItemManager instance3 = ItemManager.Instance;
CustomItem val12 = new CustomItem(val9, false, val11);
val12.ItemDrop.m_itemData.m_shared.m_itemType = (ItemType)2;
val12.ItemDrop.m_itemData.m_shared.m_consumeStatusEffect = sativaJointEffect.StatusEffect;
instance3.AddItem(val12);
GameObject val13 = weedPaperPrefab;
ItemConfig val14 = new ItemConfig();
val14.Amount = 1;
val14.Requirements = (RequirementConfig[])(object)new RequirementConfig[1]
{
new RequirementConfig
{
Item = "Dandelion",
Amount = 2
}
};
ItemConfig val15 = val14;
ItemManager.Instance.AddItem(new CustomItem(val13, false, val15));
ItemManager.Instance.AddItem(new CustomItem(weedNugsPrefab, false));
GameObject val16 = weedSeedsPrefab;
ItemConfig val17 = new ItemConfig();
val17.Amount = 1;
val17.Requirements = (RequirementConfig[])(object)new RequirementConfig[1]
{
new RequirementConfig
{
Item = "AncientSeed",
Amount = 3
}
};
ItemConfig val18 = val17;
ItemManager.Instance.AddItem(new CustomItem(val16, false, val18));
}
private void CreatePieces()
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Expected O, but got Unknown
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Expected O, but got Unknown
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Expected O, but got Unknown
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Expected O, but got Unknown
//IL_0077: 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_0087: Unknown result type (might be due to invalid IL or missing references)
//IL_008f: Expected O, but got Unknown
//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
//IL_00ab: Expected O, but got Unknown
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_00bb: Expected O, but got Unknown
//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
//IL_00e9: Expected O, but got Unknown
//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
//IL_0104: Expected O, but got Unknown
//IL_0106: Unknown result type (might be due to invalid IL or missing references)
//IL_010b: Unknown result type (might be due to invalid IL or missing references)
//IL_0116: Unknown result type (might be due to invalid IL or missing references)
//IL_011e: Expected O, but got Unknown
//IL_0120: Unknown result type (might be due to invalid IL or missing references)
//IL_0125: Unknown result type (might be due to invalid IL or missing references)
//IL_0130: Unknown result type (might be due to invalid IL or missing references)
//IL_0138: Expected O, but got Unknown
//IL_0146: Unknown result type (might be due to invalid IL or missing references)
//IL_014d: Expected O, but got Unknown
//IL_028f: Unknown result type (might be due to invalid IL or missing references)
//IL_02a1: Unknown result type (might be due to invalid IL or missing references)
//IL_02a6: Unknown result type (might be due to invalid IL or missing references)
//IL_02b2: Unknown result type (might be due to invalid IL or missing references)
//IL_02bb: Expected O, but got Unknown
//IL_02bb: Unknown result type (might be due to invalid IL or missing references)
//IL_02c0: Unknown result type (might be due to invalid IL or missing references)
//IL_02cc: Unknown result type (might be due to invalid IL or missing references)
//IL_02d3: Unknown result type (might be due to invalid IL or missing references)
//IL_02da: Unknown result type (might be due to invalid IL or missing references)
//IL_02e3: Expected O, but got Unknown
//IL_0331: Unknown result type (might be due to invalid IL or missing references)
GameObject val = weedSaplingPrefab;
PieceConfig val2 = new PieceConfig();
val2.PieceTable = "Cultivator";
val2.Requirements = (RequirementConfig[])(object)new RequirementConfig[1]
{
new RequirementConfig
{
Item = "WeedSeeds",
Amount = 1
}
};
PieceConfig val3 = val2;
PieceManager.Instance.AddPiece(new CustomPiece(val, true, val3));
GameObject val4 = weedSeedSaplingPrefab;
PieceConfig val5 = new PieceConfig();
val5.PieceTable = "Cultivator";
val5.Requirements = (RequirementConfig[])(object)new RequirementConfig[1]
{
new RequirementConfig
{
Item = "WeedBuds",
Amount = 1
}
};
PieceConfig val6 = val5;
PieceManager.Instance.AddPiece(new CustomPiece(val4, true, val6));
GameObject val7 = bongPrefab;
PieceConfig val8 = new PieceConfig();
val8.PieceTable = "Hammer";
val8.Requirements = (RequirementConfig[])(object)new RequirementConfig[4]
{
new RequirementConfig
{
Item = "BronzeNails",
Amount = 5
},
new RequirementConfig
{
Item = "Resin",
Amount = 10
},
new RequirementConfig
{
Item = "TrophySkeleton",
Amount = 1
},
new RequirementConfig
{
Item = "GreydwarfEye",
Amount = 5
}
};
PieceConfig val9 = val8;
CustomPiece val10 = new CustomPiece(val7, true, val9);
((Component)val10.Piece).GetComponent<Piece>().m_resources[0].m_recover = true;
((Component)val10.Piece).GetComponent<Piece>().m_resources[1].m_recover = true;
((Component)val10.Piece).GetComponent<Piece>().m_resources[2].m_recover = true;
((Component)val10.Piece).GetComponent<Piece>().m_resources[3].m_recover = true;
val10.PiecePrefab.AddComponent<Bong>();
val10.PiecePrefab.GetComponent<Bong>().m_name = "$piece_bong";
val10.PiecePrefab.GetComponent<Bong>().m_startFuel = 0f;
val10.PiecePrefab.GetComponent<Bong>().m_maxFuel = 1f;
val10.PiecePrefab.GetComponent<Bong>().m_secPerFuel = 1E+09f;
val10.PiecePrefab.GetComponent<Bong>().m_checkTerrainOffset = 0f;
val10.PiecePrefab.GetComponent<Bong>().m_coverCheckOffset = 0f;
val10.PiecePrefab.GetComponent<Bong>().m_fuelItem = weedNugsPrefab.GetComponent<ItemDrop>();
val10.PiecePrefab.GetComponent<Bong>().cosmeticOnly = cosmeticOnly;
bongSmokePrefab.transform.localScale = new Vector3(0.1f, 0.1f, 0.1f);
EffectData[] array = (EffectData[])(object)new EffectData[2];
EffectData val11 = new EffectData
{
m_prefab = bongNoisePrefab,
m_enabled = true
};
EffectData val12 = new EffectData
{
m_prefab = bongSmokePrefab,
m_enabled = true,
m_inheritParentScale = true,
m_attach = true
};
array[0] = val11;
array[1] = val12;
val10.PiecePrefab.GetComponent<Bong>().m_fuelAddedEffects.m_effectPrefabs = array;
((Component)val10.Piece).GetComponent<Bong>().ttl = jointEffectTime / 2f;
val10.PiecePrefab.GetComponent<Piece>().m_onlyInBiome = (Biome)0;
PieceManager.Instance.AddPiece(val10);
}
}