예제 #1
0
        private static void HerdBehaviorCallback()
        {
            try
            {
                using (BaseWorldReversion reversion = new BaseWorldReversion())
                {
                    PetPool pool;
                    if (!PetPoolManager.TryGetPetPool(PetPoolType.WildHorse, out pool))
                    {
                        return;
                    }

                    WildHorsePool ths = pool as WildHorsePool;

                    ths.HerdBehaviorCallback();
                }
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception("HerdBehaviorCallback", e);
            }
        }
예제 #2
0
파일: BuyHorseEx.cs 프로젝트: yakoder/NRaas
            public override bool Test(Sim a, EquestrianCenter target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback)
            {
                PetPool pool;

                if (!PetPoolManager.TryGetPetPool(PetPoolType.BuySellHorse, out pool, false))
                {
                    greyedOutTooltipCallback = InteractionInstance.CreateTooltipCallback(EquestrianCenter.BuyHorse.LocalizeString(a.IsFemale, "PoolEmpty", new object[0x0]));
                    return(false);
                }

                /*
                 * if (!a.Household.CanAddSpeciesToHousehold(CASAgeGenderFlags.Horse, 0x1, true))
                 * {
                 *  greyedOutTooltipCallback = InteractionInstance.CreateTooltipCallback(EquestrianCenter.BuyHorse.LocalizeString(a.IsFemale, "TooManyPetsInHousehold", new object[0x0]));
                 *  return false;
                 * }
                 */

                Lot lotHome = a.LotHome;

                if ((lotHome != null) && lotHome.HasVirtualResidentialSlots)
                {
                    greyedOutTooltipCallback = InteractionInstance.CreateTooltipCallback(PetAdoption.LocalizeString(a.IsFemale, "CannotAdoptHorse", new object[0]));
                    return(false);
                }

                return(true);
            }
예제 #3
0
        public static void StartAlarm()
        {
            PetPool pool;

            if ((!Sims3.SimIFace.Environment.HasEditInGameModeSwitch) && PetPoolManager.TryGetPetPool(PetPoolType.WildHorse, out pool))
            {
                WildHorsePool pool2 = pool as WildHorsePool;
                if (pool2 != null)
                {
                    pool2.mWildHorseInstantiationInProgress = false;

                    AlarmManager.Global.RemoveAlarm(WildHorsePool.mHerdBehaviorAlarm);
                    WildHorsePool.mHerdBehaviorAlarm = AlarmManager.Global.AddAlarmRepeating(WildHorsePool.kHerdBehaviorFrequency, TimeUnit.Minutes, HerdBehaviorCallback, WildHorsePool.kHerdBehaviorFrequency, TimeUnit.Minutes, "WildHorseHerdBehavior", AlarmType.NeverPersisted, Household.PetHousehold);

                    AlarmManager.Global.AlarmWillYield(WildHorsePool.mHerdBehaviorAlarm);

                    WildHorsePool.sTimestampSinceLastLotChange = SimClock.CurrentTime();
                }
            }
        }
예제 #4
0
        public static void AlterPetPool()
        {
            if (!GameUtils.IsInstalled(ProductVersion.EP5))
            {
                return;
            }

            Common.StringBuilder msg = new Common.StringBuilder();

            foreach (KeyValuePair <PetPoolType, PetPoolConfig> element in PetPoolManager.sPetConfigManager)
            {
                msg += Common.NewLine + element.Key;

                int poolSize = Settings.GetMaximumPoolSize(element.Key);
                if (poolSize == -1)
                {
                    continue;
                }

                msg += Common.NewLine + " Maximum: " + poolSize;

                element.Value.mEP5Range[1]        = poolSize;
                element.Value.mEP5Range[2]        = poolSize;
                element.Value.mOtherWorldRange[1] = poolSize;
                element.Value.mOtherWorldRange[2] = poolSize;

                List <SimDescription> destroyed = PetPoolManager.GetPetsByType(element.Key);

                int remove = PetPoolManager.GetPoolSize(element.Key) - poolSize;

                msg += Common.NewLine + " Remove: " + remove;

                if (remove > 0)
                {
                    PetPoolManager.RefreshPool(element.Key, remove);

                    List <SimDescription> remaining = PetPoolManager.GetPetsByType(element.Key);
                    if (remaining != null)
                    {
                        foreach (SimDescription remain in remaining)
                        {
                            destroyed.Remove(remain);
                        }
                    }

                    int destroyedCount = 0;
                    foreach (SimDescription destroy in destroyed)
                    {
                        if (ServiceCleanup.AttemptServiceDisposal(destroy, false, "Too Many " + element.Key))
                        {
                            destroyedCount++;
                        }
                        else
                        {
                            Household.PetHousehold.Add(destroy);
                        }
                    }

                    msg += Common.NewLine + " Destroyed: " + destroyedCount;
                }

                PetPool pool;
                if (PetPoolManager.TryGetPetPool(element.Key, out pool))
                {
                    if (pool.mSimDescriptionIds == null)
                    {
                        // Setting this off null will ensure that MaximumThresholdReached() returns TRUE for a size of "0"
                        pool.mSimDescriptionIds = new List <ulong>();

                        msg += Common.NewLine + " Repooled";
                    }
                }
            }

            Common.DebugNotify(msg);
        }