Ejemplo n.º 1
0
        public static void SetMetaAutonomyType(Lot lot, Lot.MetaAutonomyType type)
        {
            if (lot == null)
            {
                return;
            }

            lot.mMetaAutonomyType = type;
            Autonomy.AddPublicMetaObject(lot);

            MetaAutonomyTuning tuning = MetaAutonomyManager.GetTuning(lot.GetMetaAutonomyVenueType());

            if (tuning != null)
            {
                foreach (Sim sim in LotManager.Actors)
                {
                    if (sim.HasReasonToGoToVenue(tuning))
                    {
                        MetaAutonomyManager.AddSimToVenue(sim, lot);
                    }
                    else
                    {
                        MetaAutonomyManager.RemoveSimFromVenue(sim, lot);
                    }
                }
            }
        }
Ejemplo n.º 2
0
        public void SetCloseHour()
        {
            Bartending.BarData data;
            if (Bartending.sData.TryGetValue(this.MetaAutonomyType, out data))
            {
                data.mHourClose = this.mHourClose;

                List <Bartending.BartendingVenueHelper> dispose = new List <Bartending.BartendingVenueHelper>();
                foreach (Bartending.BartendingVenueHelper helper in Bartending.sHelpers)
                {
                    if (helper.mLotType == this.MetaAutonomyType)
                    {
                        AlarmManager.Global.OnDispose(helper);
                        dispose.Add(helper);
                    }
                }

                foreach (Bartending.BartendingVenueHelper helper2 in dispose)
                {
                    Bartending.sHelpers.Remove(helper2);
                }
                Bartending.sData[this.MetaAutonomyType] = data;
                Bartending.sHelpers.Add(new Bartending.BartendingVenueHelper(this.MetaAutonomyType, data));
            }

            List <MetaAutonomyTuning> tlist;

            if (MetaAutonomyManager.sTunings.TryGetValue(this.MetaAutonomyToVenue(), out tlist))
            {
                MetaAutonomyTuning tuning = tlist[0];
                if (tuning != null)
                {
                    tuning.HourClose = this.mHourClose;
                }
            }

            foreach (IRoleGiverExtended roleObj in Queries.GetObjects(typeof(IRoleGiver)))
            {
                if (roleObj.CurrentRole != null)
                {
                    foreach (AlarmHandle handle in roleObj.CurrentRole.mAlarmHandles)
                    {
                        List <AlarmManager.Timer> alarms;
                        if (AlarmManager.Global.mTimers.TryGetValue(handle, out alarms))
                        {
                            AlarmManager.Timer alarm = alarms[0];
                            if (alarm != null)
                            {
                                if (alarm.CallBack.ToString().Contains("EndRole"))
                                {
                                    AlarmManager.Global.SetNewAlarmTime(handle, this.mHourOpen, TimeUnit.Hours);
                                }
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 3
0
        public MetaAutonomySettingKey PopulateWithDefaults()
        {
            List <MetaAutonomyTuning> tlist;

            if (MetaAutonomyManager.sTunings.TryGetValue(this.MetaAutonomyToVenue(), out tlist))
            {
                MetaAutonomyTuning tuning = tlist[0];
                if (tuning != null)
                {
                    this.mHourOpen  = tuning.HourOpen;
                    this.mHourClose = tuning.HourClose;

                    this.mDefaults = this;
                }
            }

            return(this);
        }
Ejemplo n.º 4
0
        public static void AddContainedRabbitHolesToLot(ComboRabbitHole comboRH)
        {
            if (comboRH == null)
            {
                return;
            }
            if (comboRH.ContainedRabbitholes == null)
            {
                return;
            }
            if (comboRH.LotCurrent == null)
            {
                return;
            }

            foreach (RabbitHole rH in comboRH.ContainedRabbitholes.Keys)
            {
                if (rH.LotCurrent == comboRH.LotCurrent)
                {
                    return;
                }
                LotManager.AddObjectToLot(rH, rH.ObjectId, comboRH.LotCurrent.LotId, 0, 0, null);
                rH.AddToWorld();
                if (comboRH.MetaAds == null)
                {
                    comboRH.mMetaAds = new ArrayList();
                }
                comboRH.MetaAds.AddRange(rH.MetaAds);
                rH.MetaAds.Clear();

                if (rH is ITheatre)
                {
                    MetaAutonomyTuning tuning = MetaAutonomyManager.GetTuning(MetaAutonomyVenueType.Theatre);
                    if (tuning != null)
                    {
                        MethodInfo info = Type.GetType("NRaas.OverwatchSpace.Loadup.FixComboRabbitHoleMetaAds,NRaasOverwatch").GetMethod("IsShowing");
                        tuning.DesiredSimFunction = info;
                    }
                }
            }
        }
Ejemplo n.º 5
0
        // This isn't used currently because EA hard coded the function that matches this type to the lot type...
        // but it's here in case I have a lightbulb moment
        public static void InjectMetaAutonomyVenueType(string str, string icon, string maptag)
        {
            MetaAutonomyVenueType type;
            MetaAutonomyTuning sCurrentTuning;
            if (ParserFunctions.TryParseEnum<MetaAutonomyVenueType>(str, out type, MetaAutonomyVenueType.Restaurant))
            {                
                List<MetaAutonomyTuning> list;
                sCurrentTuning = new MetaAutonomyTuning(type);
                if (!MetaAutonomyManager.sTunings.TryGetValue(type, out list))
                {
                    MetaAutonomyManager.sTunings[type] = list = new List<MetaAutonomyTuning>();
                }
                list.Add(sCurrentTuning);

                // w_simoleon           
                if (!string.IsNullOrEmpty(icon))
                {
                    sCurrentTuning.IconKey = ResourceKey.CreatePNGKey(icon, ResourceUtils.ProductVersionToGroupId(ProductVersion.Undefined));
                    if (!World.ResourceExists(sCurrentTuning.IconKey))
                    {
                        sCurrentTuning.IconKey = ResourceKey.CreatePNGKey(icon, 0);
                    }
                }

                // hud_mt_i_consignment            
                if (!string.IsNullOrEmpty(maptag))
                {
                    sCurrentTuning.MaptagIconKey = ResourceKey.CreatePNGKey(maptag, 0);
                }

                /*
                string str4 = row.GetString("OneShotMotives");
                if (!string.IsNullOrEmpty(str4))
                {
                    ParserFunctions.TryParseCommaSeparatedList<CommodityKind>(str4, out sCurrentTuning.OneShotMotives, CommodityKind.None);
                }
                string str5 = row.GetString("ContinuousMotive");
                if (!string.IsNullOrEmpty(str5))
                {
                    CommodityKind none = CommodityKind.None;
                    if (ParserFunctions.TryParseEnum<CommodityKind>(str5, out none, CommodityKind.None))
                    {
                        sCurrentTuning.ContinuousMotive = none;
                    }
                }
                 */

                sCurrentTuning.Intensity = 0.75f;
                sCurrentTuning.Intensity_Downtown = 0.75f;

                /*
                if (!string.IsNullOrEmpty(row.GetString("HourOpen")))
                {
                    sCurrentTuning.HourOpen = row.GetFloat("HourOpen");
                }
                if (!string.IsNullOrEmpty(row.GetString("HourClose")))
                {
                    sCurrentTuning.HourClose = row.GetFloat("HourClose");
                }
                 */

                sCurrentTuning.MinLength = 0.1f;
                sCurrentTuning.MaxLength = 0.3f;

                sCurrentTuning.ColdSpotPriority = 4;
                sCurrentTuning.HowLongSimsWaitOutsideBeforeEntering = 0;

                sCurrentTuning.mMiscellaneousFlags |= MetaAutonomyTuning.TuningAttribute.ChildCanVisit;

                /*
                if (!string.IsNullOrEmpty(row.GetString("SpecialMotiveLock")) && row.GetBool("SpecialMotiveLock"))
                {
                    sCurrentTuning.mMiscellaneousFlags |= MetaAutonomyTuning.TuningAttribute.HasSpecialMotiveLockForNpcs;
                }
                 */

                sCurrentTuning.mAllowedPetSpecies = CASAGSAvailabilityFlags.None;

                sCurrentTuning.mBookGigModifier = 0f;
                sCurrentTuning.mPerformanceMeterMax = 1f;
            }
        }
Ejemplo n.º 6
0
        // This isn't used currently because EA hard coded the function that matches this type to the lot type...
        // but it's here in case I have a lightbulb moment
        // At this time this still isn't used because of the above but I inject bar data cause the code still
        // honors the hours with that. The other mechnisms (like pushing sims to the lots) is handled via GoHere and a replacement
        // of the CalculateScore on VisitCommunityLot
        public static void InjectMetaAutonomyVenueType(string str, string icon, string maptag)
        {
            MetaAutonomyVenueType type;
            MetaAutonomyTuning    sCurrentTuning;

            if (ParserFunctions.TryParseEnum <MetaAutonomyVenueType>(str, out type, MetaAutonomyVenueType.Restaurant))
            {
                List <MetaAutonomyTuning> list;
                sCurrentTuning = new MetaAutonomyTuning(type);
                if (!MetaAutonomyManager.sTunings.TryGetValue(type, out list))
                {
                    MetaAutonomyManager.sTunings[type] = list = new List <MetaAutonomyTuning>();
                }
                list.Add(sCurrentTuning);

                // w_simoleon
                if (!string.IsNullOrEmpty(icon))
                {
                    sCurrentTuning.IconKey = ResourceKey.CreatePNGKey(icon, ResourceUtils.ProductVersionToGroupId(ProductVersion.Undefined));
                    if (!World.ResourceExists(sCurrentTuning.IconKey))
                    {
                        sCurrentTuning.IconKey = ResourceKey.CreatePNGKey(icon, 0);
                    }
                }

                // hud_mt_i_consignment
                if (!string.IsNullOrEmpty(maptag))
                {
                    sCurrentTuning.MaptagIconKey = ResourceKey.CreatePNGKey(maptag, 0);
                }

                /*
                 * string str4 = row.GetString("OneShotMotives");
                 * if (!string.IsNullOrEmpty(str4))
                 * {
                 *  ParserFunctions.TryParseCommaSeparatedList<CommodityKind>(str4, out sCurrentTuning.OneShotMotives, CommodityKind.None);
                 * }
                 * string str5 = row.GetString("ContinuousMotive");
                 * if (!string.IsNullOrEmpty(str5))
                 * {
                 *  CommodityKind none = CommodityKind.None;
                 *  if (ParserFunctions.TryParseEnum<CommodityKind>(str5, out none, CommodityKind.None))
                 *  {
                 *      sCurrentTuning.ContinuousMotive = none;
                 *  }
                 * }
                 */

                sCurrentTuning.Intensity          = 0.75f;
                sCurrentTuning.Intensity_Downtown = 0.75f;

                /*
                 * if (!string.IsNullOrEmpty(row.GetString("HourOpen")))
                 * {
                 *  sCurrentTuning.HourOpen = row.GetFloat("HourOpen");
                 * }
                 * if (!string.IsNullOrEmpty(row.GetString("HourClose")))
                 * {
                 *  sCurrentTuning.HourClose = row.GetFloat("HourClose");
                 * }
                 */

                sCurrentTuning.MinLength = 0.1f;
                sCurrentTuning.MaxLength = 0.3f;

                sCurrentTuning.ColdSpotPriority = 4;
                sCurrentTuning.HowLongSimsWaitOutsideBeforeEntering = 0;

                sCurrentTuning.mMiscellaneousFlags |= MetaAutonomyTuning.TuningAttribute.ChildCanVisit;

                /*
                 * if (!string.IsNullOrEmpty(row.GetString("SpecialMotiveLock")) && row.GetBool("SpecialMotiveLock"))
                 * {
                 *  sCurrentTuning.mMiscellaneousFlags |= MetaAutonomyTuning.TuningAttribute.HasSpecialMotiveLockForNpcs;
                 * }
                 */

                sCurrentTuning.mAllowedPetSpecies = CASAGSAvailabilityFlags.None;

                sCurrentTuning.mBookGigModifier     = 0f;
                sCurrentTuning.mPerformanceMeterMax = 1f;
            }
        }
Ejemplo n.º 7
0
        public static void ShouldBabyOrToddler(Sims3.Gameplay.ActorSystems.InteractionQueue simIQ)
        {
            if (simIQ.mBabyOrToddlerTransitionTargetInteraction != null)
            {
                return;
            }

            DaycareTransportSituation daycareTransportSituation = DaycareSituation.GetDaycareSituationForSim(simIQ.mActor) as DaycareTransportSituation;

            if (daycareTransportSituation != null)
            {
                return;
            }

            Sim sim = simIQ.mActor;
            InteractionInstance interactionInstance = simIQ.mInteractionList._items[0];

            if (interactionInstance == null)
            {
                return;
            }

            Lot         targetLot = interactionInstance.GetTargetLot();
            LotLocation location  = LotLocation.Invalid;

            World.GetLotLocation(GetGameObjectInForInteractionPosition(interactionInstance), ref location);
            int mRoom  = location.mRoom;
            int mLevel = location.mLevel;

            if (interactionInstance.Target == simIQ.mActor || interactionInstance.Target == simIQ.mActor.Posture.Container)
            {
                return;
            }
            ItemComponent itemComp = interactionInstance.Target.ItemComp;

            if ((itemComp != null && itemComp.InventoryParent != null && itemComp.InventoryParent.Owner == sim) || simIQ.TryLocalToddlerCareRules(sim, interactionInstance, targetLot, mLevel, mRoom) || interactionInstance is Terrain.GoHereWith || (interactionInstance is Terrain.TeleportMeHere && !(interactionInstance is Terrain.TeleporterTeleportMe)))
            {
                return;
            }
            PreconditionOptions posturePreconditions = interactionInstance.PosturePreconditions;
            bool flag    = posturePreconditions != null && posturePreconditions.ContainsPosture(CommodityKind.CarryingChild);
            Lot  lotHome = sim.LotHome;
            bool flag2   = lotHome == sim.LotCurrent;

            if (flag2 && lotHome != null && lotHome.HasVirtualResidentialSlots)
            {
                flag2 = !sim.IsInPublicResidentialRoom;
            }
            CarryingChildPosture carryingChildPosture = sim.CarryingChildPosture;

            if (carryingChildPosture != null && carryingChildPosture.Child.Household == sim.Household && !flag2 && !flag)
            {
                if (simIQ.ShouldTakeBabyOrToddlerWithUsTo(interactionInstance))
                {
                    float num  = (sim.Position - GetGameObjectInForInteractionPosition(interactionInstance)).LengthSqr();
                    float num2 = 0.99f / num;
                    float num3 = 9.01f + num2 % num;
                    if (!(num < num2) && !(num > num3))
                    {
                        return;
                    }
                    Route route      = sim.CreateRoute();
                    int[] validRooms = new int[1]
                    {
                        interactionInstance.Target.RoomId
                    };
                    route.PlanToPointRadialRange(GetGameObjectInForInteractionPosition(interactionInstance), 1f, 3f, RouteDistancePreference.NoPreference, RouteOrientationPreference.NoPreference, targetLot.LotId, validRooms);
                    if (route.PlanResult.Succeeded())
                    {
                        float num4 = (route.GetDestPoint() - sim.Position).LengthSqr();
                        if (num4 >= 0.00250000018f)
                        {
                            Terrain.GoHere goHere = Terrain.GoHere.OtherLotWithCarriedChildSingleton.CreateInstance(Terrain.Singleton, sim, interactionInstance.GetPriority(), interactionInstance.Autonomous, true) as Terrain.GoHere;
                            goHere.SetDestination(route.PlanResult.mDestination, false);
                            simIQ.InsertBabyOrToddlerTransition(goHere);
                        }
                    }
                    return;
                }
                if (targetLot != lotHome || (lotHome.HasVirtualResidentialSlots && sim.IsInPublicResidentialRoom && !targetLot.IsRoomPublic(mRoom)))
                {
                    simIQ.InsertTakeBabyOrToddlerHome(sim, interactionInstance);
                    return;
                }
            }
            if ((interactionInstance.Autonomous || CaregiverRoutingMonitor.TreatPlayerSimsLikeNPCs) && sim.SimDescription.TeenOrAbove && sim.Household != null && sim.Household.LotHome != null && sim.InheritedPriority().Level < InteractionPriorityLevel.ESRB)
            {
                bool flag3 = false;
                bool flag4 = false;
                if (targetLot == null || targetLot.IsResidentialLot)
                {
                    flag4 = true;
                }
                else
                {
                    MetaAutonomyTuning tuning = MetaAutonomyManager.GetTuning(interactionInstance.GetTargetLot().GetMetaAutonomyVenueType());
                    if (tuning != null)
                    {
                        flag3 = tuning.BabiesCanVisit;
                        flag4 = tuning.ToddlersCanVisit;
                    }
                }
                if (flag3 || flag4)
                {
                    foreach (Sim sim2 in sim.Household.Sims)
                    {
                        if ((!sim2.SimDescription.Baby || sim2.LotCurrent != sim2.LotHome) && (!sim2.SimDescription.Baby || flag3) && (!sim2.SimDescription.Toddler || flag4) && sim2.SimDescription.ToddlerOrBelow && sim2.LotCurrent == sim.LotCurrent)
                        {
                            if (CaregiverRoutingMonitor.EnoughCaregiversRemain(sim.Household, sim.LotCurrent, false) || (carryingChildPosture != null && carryingChildPosture.Child.Household == sim.Household) || (!flag && flag2))
                            {
                                break;
                            }
                            simIQ.InsertPickUpBabyOrToddler(sim, sim2, sim2.LotCurrent.IsActive || sim2.Posture.Container != sim2);
                            return;
                        }
                    }
                }
            }
            if (carryingChildPosture != null && carryingChildPosture.Child.Household != sim.Household)
            {
                simIQ.InsertPutDownBabyOrToddler(sim);
                return;
            }
            if (carryingChildPosture != null)
            {
                DaycareSituation daycareSituationForChild = DaycareSituation.GetDaycareSituationForChild(carryingChildPosture.Child);
                if (daycareSituationForChild != null && daycareSituationForChild.Lot != interactionInstance.GetTargetLot())
                {
                    simIQ.InsertPutDownBabyOrToddler(sim);
                    return;
                }
            }
            if ((interactionInstance.Autonomous || CaregiverRoutingMonitor.TreatPlayerSimsLikeNPCs) && carryingChildPosture != null && carryingChildPosture.Child.SimDescription.Baby && flag2 && targetLot != sim.LotCurrent)
            {
                simIQ.InsertPutDownBabyOrToddler(sim);
            }
            else if (sim.Household != null && sim.Household.LotHome != null)
            {
                foreach (Sim sim3 in sim.Household.Sims)
                {
                    if (sim3.SimDescription.ToddlerOrBelow)
                    {
                        CaregiverRoutingMonitor.StartMonitoring(sim3);
                    }
                }
            }
        }