Ejemplo n.º 1
0
        private static bool Prefix(IceFishingHole __instance, GameObject go, ref float ___m_ElapsedFishingTimeMinutes)
        {
            GearItem component = go.GetComponent <GearItem>();

            if (!component)
            {
                return(false);
            }
            component.gameObject.SetActive(true);
            component.m_CurrentHP = UnityEngine.Random.Range(0.9f * component.m_MaxHP, component.m_MaxHP);

            float myrol1  = FishingHoles.FishingHolesPoisson();
            float myrol2  = FishingHoles.FishingHolesPoisson(); //do it twice to widen the tail of the distribution
            float FISHmod = (myrol1 * myrol2 + 0.25f) / 1.25f;  //ensure mod is Non-zero

            float skillmod = GameManager.GetSkillIceFishing().GetFishWeightScale();

            Debug.Log("Fish mod:" + FISHmod + "skill mod:" + skillmod + " changing " + component.name + " weight from:" + component.m_WeightKG + " to:" + component.m_WeightKG * FISHmod * skillmod);

            component.m_WeightKG = component.m_WeightKG * FISHmod * skillmod;
            float length = Mathf.Pow(component.m_WeightKG, 0.3333f);

            float lengthfactor = 1f;

            if (component.name == "GEAR_RawLakeWhiteFish")
            {
                lengthfactor = 0.8f;
            }
            if (component.name == "GEAR_RawSmallMouthBass")
            {
                lengthfactor = 0.9f;
            }
            if (component.name == "GEAR_RawRainbowTrout")
            {
                lengthfactor = 0.8f;
            }
            if (component.name == "GEAR_RawCohoSalmon")
            {
                lengthfactor = 0.74f;
            }

            component.gameObject.transform.localScale *= length * lengthfactor;

            component.m_FoodItem.m_CaloriesTotal     *= FISHmod * skillmod;
            component.m_FoodItem.m_CaloriesRemaining *= FISHmod * skillmod;


            GameManager.GetPlayerManagerComponent().EnterInspectGearModeFromFishingHole(component, __instance);

            InterfaceManager.m_Panel_GenericProgressBar.Pause();
            GameAudioManager.PlaySound(EVENTS.PAUSE_SEARCHCONTAINER, GameManager.GetPlayerObject());
            StatsManager.IncrementValue(StatID.FishCaught, component.GetItemWeightKG());
            GameManager.GetAchievementManagerComponent().CaughtFish(component);

            component.MarkAsHarvested();
            return(false);
        }
Ejemplo n.º 2
0
        static void clearFishingHole(IceFishingHole iceFishingHole)
        {
            iceFishingHole.ClearHole();

            if (!GameUtils.Inventory.GetBestFishingTackle())
            {
                GameUtils.addItem("gear_hookandline");
            }
        }
Ejemplo n.º 3
0
        static void Postfix(IceFishingHole __instance, bool inProgress)
        {
            $"IceFishingHole.SetFishingInProgress: {inProgress}".logDbg();
            var pm = GameUtils.PlayerManager.gameObject;

            if (inProgress)
            {
                pm.ensureComponent <AutoCook>().init(__instance);
            }
            else
            {
                pm.destroyComponent <AutoCook>(false);
            }
        }
Ejemplo n.º 4
0
        public void init(IceFishingHole iceFishingHole)
        {
            "AutoCook.init".logDbg();
            if (iceFishingHole)
            {
                this.iceFishingHole = iceFishingHole;
                fire           = iceFishingHole.transform.parent.GetComponentInChildren <Fire>();
                gearPlacePoint = iceFishingHole.transform.parent.GetComponentInChildren <GearPlacePoint>();
            }

            if (!iceFishingHole || !fire || !gearPlacePoint)
            {
                $"AutoCook.init: something went wrong (iceFishingHole: '{iceFishingHole}, fire: '{fire}', gearPlacePoint: '{gearPlacePoint}'')".logError();
                Destroy(this);
            }
        }
Ejemplo n.º 5
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);
        }