예제 #1
0
            public override bool Test(Sim a, EquestrianCenter target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback)
            {
                if (target.IsActorUsingMe(a))
                {
                    return(false);
                }

                Posture posture = a.Posture as RidingPosture;

                if (posture == null)
                {
                    posture = a.Posture as LeadingHorsePosture;
                    if (posture == null)
                    {
                        greyedOutTooltipCallback = InteractionInstance.CreateTooltipCallback(EquestrianCenter.SellHorse.LocalizeString(a.IsFemale, "SimNeedsToBeRidingAHorse", new object[] { a }));
                        return(false);
                    }
                }

                Sim container = posture.Container as Sim;

                if (!container.IsSelectable)
                {
                    return(false);
                }

                SimDescription simDescription = container.SimDescription;

                if (simDescription.Child)
                {
                    greyedOutTooltipCallback = InteractionInstance.CreateTooltipCallback(Localization.LocalizeString(a.IsFemale, "Gameplay/Objects/RabbitHoles/EquestrianCenter/OfferStallionAsStud:NeedAdultHorse", new object[] { a }));
                    return(false);
                }

                /*
                 * if (simDescription.IsUnicorn)
                 * {
                 *  greyedOutTooltipCallback = InteractionInstance.CreateTooltipCallback(EquestrianCenter.SellHorse.LocalizeString(a.IsFemale, "UnicornCannotBeSold", new object[0x0]));
                 *  return false;
                 * }
                 */

                SocialWorkerPetPutUp instance = SocialWorkerPetPutUp.Instance;
                Lot lotHome = container.LotHome;

                if ((((instance != null) && (lotHome != null)) && (instance.IsServiceRequested(lotHome) || instance.IsAnySimAssignedToLot(lotHome))) && (instance.PetToPutUp == simDescription))
                {
                    return(false);
                }
                return(true);
            }
예제 #2
0
파일: WorldData.cs 프로젝트: yakoder/NRaas
        public static void SetVacationWorld(bool ignoreHousehold, bool updateSims)
        {
            Common.StringBuilder msg = new Common.StringBuilder("SetVacationWorld" + Common.NewLine);

            try
            {
                ResetWorldType();

                WorldType originalType = GameUtils.GetCurrentWorldType();

                string worldFile = World.GetWorldFileName();

                msg += worldFile + Common.NewLine;

                WorldName currentWorld = WorldName.Undefined;

                msg += "A";

                foreach (KeyValuePair <WorldName, WorldNameData> data in sData)
                {
                    // Do not alter the future world
                    if (data.Key == WorldName.FutureWorld)
                    {
                        continue;
                    }

                    if (data.Value.mWorldFile == worldFile)
                    {
                        currentWorld = data.Key;
                    }
                    else
                    {
                        if (originalType != WorldType.Future)
                        {
                            // Make all other worlds vacation worlds to allow the Core to age the sims while playing home-town
                            GameUtils.WorldNameToType[data.Key] = WorldType.Vacation;
                        }
                        else
                        {
                            // Alter all worlds to *not* allow aging
                            GameUtils.WorldNameToType[data.Key] = WorldType.Base;
                        }
                    }
                }

                if (originalType != WorldType.Future)
                {
                    // handle custom and pre sunlit tides snafu's
                    if (GameUtils.WorldNameToType.ContainsKey(WorldName.UserCreated))
                    {
                        GameUtils.WorldNameToType[WorldName.UserCreated] = WorldType.Vacation;
                    }
                    else
                    {
                        GameUtils.WorldNameToType.Add(WorldName.UserCreated, WorldType.Vacation);
                    }
                }

                msg += "B";

                msg += Common.NewLine + "CurrentWorld: " + currentWorld + Common.NewLine;

                bool adjustBaseBooks = false;

                // Change the books so the base world books can be seen in Traveler worlds or while "Treat As Vacation" is false
                switch (currentWorld)
                {
                case WorldName.China:
                case WorldName.Egypt:
                case WorldName.France:
                    if (!Traveler.Settings.mTreatAsVacation)
                    {
                        adjustBaseBooks = true;
                    }
                    break;

                default:
                    adjustBaseBooks = true;
                    break;
                }

                if ((GameStates.HasTravelData) && (Traveler.Settings.mTreatAsVacation) && ((ignoreHousehold) || (GameStates.TravelHousehold == Household.ActiveHousehold)))
                {
                    switch (currentWorld)
                    {
                    case WorldName.University:
                        GameUtils.WorldNameToType[currentWorld] = WorldType.University;
                        break;

                    case WorldName.FutureWorld:
                        GameUtils.WorldNameToType[currentWorld] = WorldType.Future;
                        break;

                    default:
                        GameUtils.WorldNameToType[currentWorld] = WorldType.Vacation;
                        break;
                    }

                    GameUtils.CheatOverrideCurrentWorld = currentWorld;
                }
                else
                {
                    switch (GameUtils.GetCurrentWorldType())
                    {
                    case WorldType.Vacation:
                    case WorldType.University:
                    case WorldType.Future:
                        GameUtils.WorldNameToType[currentWorld] = WorldType.Base;

                        GameUtils.CheatOverrideCurrentWorld = currentWorld;
                        break;
                    }
                }

                msg += Common.NewLine + "CurrentWorldType: " + GameUtils.GetCurrentWorldType() + Common.NewLine;

                if (sAdjustedStoreItems == null)
                {
                    sAdjustedStoreItems = new List <BookBaseStoreItem>();

                    foreach (List <StoreItem> list in Bookstore.mItemDictionary.Values)
                    {
                        foreach (StoreItem item in list)
                        {
                            BookBaseStoreItem baseItem = item as BookBaseStoreItem;
                            if (baseItem == null)
                            {
                                continue;
                            }

                            if (baseItem.mAllowedWorldTypes == null)
                            {
                                continue;
                            }

                            if (!baseItem.mAllowedWorldTypes.Contains(WorldType.Base))
                            {
                                continue;
                            }

                            if (baseItem.mAllowedWorldTypes.Contains(WorldType.Vacation))
                            {
                                continue;
                            }

                            sAdjustedStoreItems.Add(baseItem);
                        }
                    }
                }

                foreach (BookBaseStoreItem item in sAdjustedStoreItems)
                {
                    if (adjustBaseBooks)
                    {
                        if (!item.mAllowedWorldTypes.Contains(WorldType.Vacation))
                        {
                            item.mAllowedWorldTypes.Add(WorldType.Vacation);
                        }
                    }
                    else
                    {
                        item.mAllowedWorldTypes.Remove(WorldType.Vacation);
                    }
                }

                msg += "C";

                if (PetPoolManager.sPetConfigManager != null)
                {
                    foreach (PetPoolConfig config in PetPoolManager.sPetConfigManager.Values)
                    {
                        if (config == null)
                        {
                            continue;
                        }

                        if (config.mAllowedWorldTypes == null)
                        {
                            config.mAllowedWorldTypes = new List <string>();
                        }

                        config.mAllowedWorldTypes.Remove(WorldType.Vacation.ToString());
                        config.mAllowedWorldTypes.Remove(WorldType.University.ToString());
                        config.mAllowedWorldTypes.Remove(WorldType.Future.ToString());

                        if (!config.mAllowedWorldTypes.Contains(WorldType.Downtown.ToString()))
                        {
                            if (originalType != WorldType.Downtown)
                            {
                                config.mAllowedWorldTypes.Add(WorldType.Vacation.ToString());
                                config.mAllowedWorldTypes.Add(WorldType.University.ToString());
                                config.mAllowedWorldTypes.Add(WorldType.Future.ToString());
                            }
                        }
                        else
                        {
                            config.mAllowedWorldTypes.Add(WorldType.Vacation.ToString());
                            config.mAllowedWorldTypes.Add(WorldType.University.ToString());
                            config.mAllowedWorldTypes.Add(WorldType.Future.ToString());
                        }

                        config.mDisallowedWorldNames = null;
                    }
                }

                msg += "D";

                Navigation navigation = Navigation.Instance;

                if ((navigation != null) && (navigation.mInfoStateButtons.Length >= 2) && (navigation.mInfoStateButtons[1] != null))
                {
                    /*if (GameUtils.IsOnVacation())
                     * {
                     *  navigation.mInfoStateButtons[1].TooltipText = Common.LocalizeEAString("Ui/Caption/Hud/Navigation:OnVacationNoWork");
                     *  navigation.mInfoStateButtons[1].Enabled = false;
                     * }
                     * else*/
                    {
                        navigation.mInfoStateButtons[1].TooltipText = null;
                        navigation.mInfoStateButtons[1].Enabled     = true;
                    }
                }

                msg += "E";

                if (updateSims)
                {
                    currentWorld = GameUtils.GetCurrentWorld();

                    foreach (SimDescription sim in Household.EverySimDescription())
                    {
                        if (sim.Household == null)
                        {
                            continue;
                        }

                        if (sim.Household.IsTravelHousehold)
                        {
                            continue;
                        }

                        if (sim.Household.IsTouristHousehold)
                        {
                            continue;
                        }

                        sim.mHomeWorld = currentWorld;
                    }
                }

                msg += "F";

                // Startup the service manually

                if (SocialWorkerPetPutUp.Instance == null)
                {
                    SocialWorkerPetPutUp.Create();
                }

                if (SocialWorkerPetAdoption.Instance == null)
                {
                    SocialWorkerPetAdoption.Create();
                }

                if (SocialWorkerAdoption.Instance == null)
                {
                    SocialWorkerAdoption.Create();
                }

                if (Babysitter.Instance == null)
                {
                    Babysitter.Create();
                }

                if (Repoman.Instance == null)
                {
                    Repoman.Create();
                }

                if (NewspaperDelivery.Instance == null)
                {
                    NewspaperDelivery.Create();
                }
            }
            catch (Exception e)
            {
                Common.Exception(msg, e);
            }
            finally
            {
                //Common.StackLog(msg);
            }
        }