internal static void Postfix(PlayerManager __instance, float progress) { //WaterSupply waterSupply = AccessTools.Field(__instance.GetType(), "m_WaterSourceToDrinkFrom").GetValue(__instance) as WaterSupply; WaterSupply waterSupply = __instance.m_WaterSourceToDrinkFrom; if (waterSupply == null) { return; } GearItem gearItem = waterSupply.GetComponent <GearItem>(); if (gearItem.m_LiquidItem != null) { gearItem.m_LiquidItem.m_LiquidLiters = waterSupply.m_VolumeInLiters; Object.Destroy(waterSupply); gearItem.m_WaterSupply = null; } if (gearItem.m_CookingPotItem != null) { if (!WaterUtils.IsCooledDown(gearItem.m_CookingPotItem)) { //GameManager.GetPlayerManagerComponent().ApplyFreezingBuff(20 * progress, 0.5f, 1 * progress); GameManager.GetPlayerManagerComponent().ApplyFreezingBuff(20 * progress, 0.5f, 1 * progress, 24f); PlayerDamageEvent.SpawnAfflictionEvent("GAMEPLAY_WarmingUp", "GAMEPLAY_BuffHeader", "ico_injury_warmingUp", InterfaceManager.m_Panel_ActionsRadial.m_FirstAidBuffColor); } WaterUtils.SetWaterAmount(gearItem.m_CookingPotItem, waterSupply.m_VolumeInLiters); Object.Destroy(waterSupply); } if (waterSupply is WaterSourceSupply) { WaterSourceSupply waterSourceSupply = waterSupply as WaterSourceSupply; waterSourceSupply.UpdateWaterSource(); } Water.AdjustWaterSupplyToWater(); }
internal static void Postfix(Panel_PickWater __instance) { if (InputManager.GetEquipPressed(GameManager.Instance())) { Traverse traverse = Traverse.Create(__instance); GameObject gameObject = new GameObject(); GearItem gearItem = gameObject.AddComponent <GearItem>(); gearItem.m_LocalizedDisplayName = new LocalizedString { m_LocalizationID = "" }; WaterSourceSupply waterSourceSupply = gameObject.AddComponent <WaterSourceSupply>(); waterSourceSupply.SetWaterSource(traverse.Field("m_WaterSource").GetValue <WaterSource>()); gearItem.Awake(); traverse.Method("ExitInterface").GetValue(); GameManager.GetPlayerManagerComponent().UseInventoryItem(gearItem); } }