Пример #1
0
        private static bool Prefix(IceFishingHole __instance, bool ___m_FishingInProgress, ref float ___m_ElapsedFishingTimeMinutes)
        {
            float fishingInterval = 5f;

            if (!___m_FishingInProgress)
            {
                return(false);;
            }
            if (GameManager.GetPlayerManagerComponent().IsInspectModeActive())
            {
                return(false);;
            }
            if (InterfaceManager.m_Panel_GenericProgressBar.IsPaused())
            {
                InterfaceManager.m_Panel_GenericProgressBar.Resume();
                GameAudioManager.PlaySound(EVENTS.RESUME_SEARCHCONTAINER, GameManager.GetPlayerObject());
            }
            if (___m_ElapsedFishingTimeMinutes > fishingInterval)
            {
                float myrand = UnityEngine.Random.Range(0.0f, 1.0f);

                float popfactor = FishingHoles.getFishingFactor(RegionManager.GetCurrentRegion(), Utils.GetGuidFromGameObject((__instance.gameObject)));

                float fishing_skill = GameManager.GetSkillIceFishing().ReduceFishingTimeScale();

                float myprob = ((1f / fishing_skill) * popfactor) * (fishingInterval / 60f);
                Debug.Log("Rolling for fish, FISH catch chance (per hour avg):" + popfactor + " Skill modifier:" + (1f / fishing_skill) + " final prob:" + myprob + " rand:" + myrand);
                if (myrand < myprob)
                {
                    if (Utils.RollChance(GameManager.GetSkillIceFishing().GetLineBreakOnChancePercent()))
                    {
                        AccessTools.Method(typeof(IceFishingHole), "LineBreak").Invoke(__instance, null);  //CHECKTHIS
                    }
                    else
                    {
                        AccessTools.Method(typeof(IceFishingHole), "CatchFish").Invoke(__instance, null);
                        FishingHoles.CatchInProgress(RegionManager.GetCurrentRegion(), Utils.GetGuidFromGameObject((__instance.gameObject)));
                    }
                }
                ___m_ElapsedFishingTimeMinutes = 0;
            }
            return(false);
        }