public override bool Run() { try { LotLocation location = LotLocation.Invalid; Lot lot = LotManager.GetLot(World.GetLotLocation(Destination, ref location)); if (lot != null) { if (Teleport.Perform(Actor, lot, true)) { return(true); } } return(base.Run()); } catch (ResetException) { throw; } catch (Exception e) { Common.Exception(Actor, Target, e); return(false); } }
public override void OnWorldLoadFinished() { Overwatch.Log(GetTitlePrefix()); TimeTraveler service = TimeTraveler.Instance; List <ulong> remove = new List <ulong>(); if (service != null) { foreach (KeyValuePair <ulong, Service.ServiceRequest> pair in service.mLotsRequested) { if (!service.mTimeTravelerServiceRequests.ContainsKey(pair.Key)) { remove.Add(pair.Key); } } foreach (ulong num in remove) { Lot lot = LotManager.GetLot(num); if (lot != null) { service.ClearServiceForLot(lot); } else { service.mLotsRequested.Remove(num); } Overwatch.Log("Removed invalid Time Traveler service request"); } } }
public static void OnMapTagAdded(IMapTag tag) { if (Sim.ActiveActor == null || Sim.ActiveActor.MapTagManager == null || !CameraController.IsMapViewModeEnabled()) { return; } if (tag.TagType == MapTagType.Venue) { MapTagsModel model = MapTagsModel.Singleton; MapTagManager manager = Sim.ActiveActor.MapTagManager; MapTag mTag = tag as MapTag; if (model != null && manager != null && mTag != null) { Lot lot = LotManager.GetLot(mTag.LotId); if (lot != null && ShouldReplace(lot)) { CustomTagNRaas customTag = new CustomTagNRaas(lot, mTag.Owner); manager.RemoveTag(tag.ObjectGuid); Tagger.sReplaced.Add(lot.LotId); manager.AddTag(customTag); } } } }
public override void OnWorldLoadFinished() { Overwatch.Log(GetTitlePrefix()); SocialWorkerChildAbuse service = SocialWorkerChildAbuse.Instance; List <ulong> remove = new List <ulong>(); if (service != null) { foreach (KeyValuePair <ulong, Service.ServiceRequest> pair in service.mLotsRequested) { Lot lot = LotManager.GetLot(pair.Key); if (lot == null || (lot != Household.ActiveHouseholdLot)) { remove.Add(pair.Key); } } foreach (ulong num in remove) { Lot lot = LotManager.GetLot(num); if (lot != null) { service.ClearServiceForLot(lot); } else { service.mLotsRequested.Remove(num); } Overwatch.Log("Removed invalid Social Worker service request"); } } }
public static bool PreInRabbitholeLoop(GoToSchoolInRabbitHole ths, bool allowedToWork) { try { LotManager.SetAutoGameSpeed(); //CancellableByPlayer = false; ths.BeginCommodityUpdates(); if (!allowedToWork) { ths.EndCommodityUpdates(false); return(false); } ths.Actor.School.StartWorking(); return(true); } catch (ResetException) { throw; } catch (Exception e) { Common.Exception(ths.Actor, ths.Target, e); return(false); } }
public bool Apply(SimDescription me) { if (me.CreatedSim == Sim.ActiveActor) { LotManager.SelectNextSim(); } Household house = me.Household; if (house != null) { house.Remove(me, !SimTypes.IsSpecial(house)); } try { Household.MermaidHousehold.Add(me); } catch (Exception e) { Common.Exception(me, e); if ((house != null) && (me.Household == null)) { house.Add(me); } } return(false); }
protected override OptionResult Run(Lot myLot, Household house) { try { string text = StringInputDialog.Show(Name, "Enter the ID for the lot:", ""); if (string.IsNullOrEmpty(text)) { return(OptionResult.Failure); } ulong lotID = ulong.Parse(text); Lot lot = LotManager.GetLot(lotID); if (lot == null) { SimpleMessageDialog.Show(Name, "No lot found"); } else { Focus.Perform(lot); SimpleMessageDialog.Show(Name, lot.Name + " " + lot.Address); } } catch (Exception e) { Common.Exception(myLot, e); } return(OptionResult.SuccessClose); }
public override bool Run() // Run { if (Target.IsInActiveHousehold && Target.Service is GrimReaper) { if (!AcceptCancelDialog.Show("Warning: Remove Sim Family Death Good System or Grim Reaper?")) { return(false); } { if (this.Target.IsActiveSim) // Fix Not Household { //UserToolUtils.OnClose(); LotManager.SelectNextSim(); } Target.SimDescription.Household.Remove(this.Target.SimDescription); Household.NpcHousehold.Add(this.Target.SimDescription); } return(true); } if (!AcceptCancelDialog.Show("Force Request Grim Reaper?")) { return(false); } GrimReaper.Instance.MakeServiceRequest(Target.LotCurrent, true, ObjectGuid.InvalidObjectGuid); return(true); }
private void ConfirmPurchaseTaskEx(object lotInfoParam) { try { UIBinInfo info = lotInfoParam as UIBinInfo; if ((info != null) && (info.LotId != ulong.MaxValue)) { int worth = 0; if (!Mover.Settings.mFreeRealEstate) { Lot lot = LotManager.GetLot(info.LotId); if (lot != null) { worth = info.LotWorth; } else { worth = Mover.GetLotCost(lot); } } if (EditTownConfirmPurchaseLot.Show(info.LotId, worth, mInfo.HouseholdFunds) != EditTownConfirmPurchaseLot.Result.Cancel) { PlaceHouseholdEx(mInfo, info.LotId); } } mPlacing = false; } catch (Exception e) { Common.Exception("ConfirmPurchaseTaskEx", e); } }
public static Sim DGSMakeRandomSimNoCheck(Vector3 point, CASAgeGenderFlags age, CASAgeGenderFlags gender, WorldName worldname) { LotLocation lotLocation = default(LotLocation); ulong lotLocation2 = World.GetLotLocation(point, ref lotLocation); Lot lot = LotManager.GetLot(lotLocation2); SimDescription simDescription2 = DGSMakeSSimDescription(age, gender, worldname, uint.MaxValue); Genetics.AssignRandomTraits(simDescription2); if (lot != null) { if (lot.Household == null) { Household household = Household.Create(); lot.MoveIn(household); } lot.Household.Add(simDescription2); } else { Household household2 = Household.Create(); household2.SetName(/* "E3Lesa is Good" */ "Good Household"); household2.Add(simDescription2); } WorldName currentWorld = worldname; simDescription2.FirstName = SimUtils.GetRandomGivenName(simDescription2.IsMale, currentWorld); simDescription2.LastName = SimUtils.GetRandomFamilyName(currentWorld); return(simDescription2.Instantiate(point)); }
public static Lot GetLot(GameObject target, GameObjectHit hit) { Lot lot = target as Lot; if (lot != null) { if (lot.IsBaseCampLotType) { return(null); } return(lot); } if (target is Sims3.Gameplay.Objects.Electronics.Computer) { return(null); } if (target is RabbitHole) { return(null); } if (target != null) { if (target.LotCurrent != null) { return(target.LotCurrent); } } return(LotManager.GetLotAtPoint(hit.mPoint)); }
public override void OnWorldLoadFinished() { Overwatch.Log(GetTitlePrefix()); try { bool fix = false; foreach (Lot lot in LotManager.AllLots) { if (lot.ResortManager != null) { if (lot.ResortManager.mOwnerLot == null || LotManager.GetLot(lot.ResortManager.mOwnerLot.LotId) == null) { fix = true; lot.ResortManager.mOwnerLot = lot; } } } if (fix) { Overwatch.Log("Fixed resort managers"); } } catch (Exception e) { Common.Exception(GetTitlePrefix(), e); } }
public bool Apply(SimDescription me) { if (me.CreatedSim == Sim.ActiveActor) { LotManager.SelectNextSim(); } Household house = me.Household; if (house != null) { house.Remove(me, !house.IsServiceNpcHousehold); } try { if (PetPoolManager.AddPet(Value, me)) { return(true); } } catch (Exception e) { Common.Exception(me, e); if ((house != null) && (me.Household == null)) { house.Add(me); } } return(false); }
public int Assets(Household house) { int assets = 0; if (house == null) { return(0); } else { assets = house.FamilyFunds + Lots.GetLotCost(house.LotHome); } if (house.RealEstateManager != null) { foreach (PropertyData data in house.RealEstateManager.AllProperties) { Lot lot = LotManager.GetLot(data.LotId); if (lot == null) { assets += data.TotalValue; } else if (lot.ResidentialLotSubType == ResidentialLotSubType.kEP1_PlayerOwnable) { assets += data.TotalValue; } else { assets += ManagerLot.GetUnfurnishedLotCost(lot, 0); } } } return(assets); }
private bool CustomProcessClick(ScenePickArgs eventArgs) { switch (eventArgs.mObjectType) { case ScenePickObjectType.Terrain: case ScenePickObjectType.Floor: case ScenePickObjectType.RoadStreet: case ScenePickObjectType.RoadSidewalk: case ScenePickObjectType.WaterPond: case ScenePickObjectType.WaterSea: case ScenePickObjectType.WaterPool: case ScenePickObjectType.WaterFountain: if ((Bin.PlacementHousehold == null) && (Bin.PlacementLot == null)) { return(GameObjectEx.OnPick(Terrain.Singleton, eventArgs.mMouseEvent, eventArgs.AsGameObjectHit())); } break; case ScenePickObjectType.Object: case ScenePickObjectType.Sim: case ScenePickObjectType.Wall: ObjectGuid guid = ObjectGuid.InvalidObjectGuid; if ((eventArgs.mObjectType == ScenePickObjectType.Object) || (eventArgs.mObjectType == ScenePickObjectType.Sim)) { guid = new ObjectGuid(eventArgs.mObjectId); } else if (eventArgs.mObjectType == ScenePickObjectType.Wall) { guid = LotManager.GetLotObjectGuid(eventArgs.mObjectId); } IScriptProxy proxy = Simulator.GetProxy(guid); if (proxy != null) { IObjectUI target = proxy.Target as IObjectUI; if (target != null) { Lot lot = target as Lot; if (lot != null) { return(OnPickLot(lot, eventArgs.mMouseEvent, eventArgs.AsGameObjectHit())); } else { GameObject obj = target as GameObject; if (obj != null) { return(GameObjectEx.OnPick(obj, eventArgs.mMouseEvent, eventArgs.AsGameObjectHit())); } } } } break; } return(false); }
public override bool InRabbitHole() { try { LotManager.SetAutoGameSpeed(); bool succeeded = false; BeginCommodityUpdates(); // Custom if (IsAllowedToWork(mCareer) || mCareer.ShouldBeAtWork()) { DateAndTime previousDateAndTime = SimClock.CurrentTime(); float num2 = SimClock.HoursUntil(mCareer.CurLevel.FinishTime()) + mCareer.OvertimeHours; while (!Actor.WaitForExitReason(1f, ~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached)) && !mCareer.IsSpecialWorkTime) { if (mCareer.IsRegularWorkTime()) { break; } } if (Actor.HasExitReason(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached))) { EndCommodityUpdates(false); return(false); } mCareer.StartWorking(); succeeded = DoLoop(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached), new InteractionInstance.InsideLoopFunction(LoopDelegate), null); mCareer.FinishWorking(); if (!succeeded) { EventTracker.SendEvent(EventTypeId.kWorkCanceled, Actor); } float num3 = SimClock.ElapsedTime(TimeUnit.Hours, previousDateAndTime); if ((num3 > num2) || (Math.Abs((float)(num3 - num2)) <= kStayLateThreshold)) { EventTracker.SendEvent(EventTypeId.kCareerOpportunity_StayedLate, Actor); } } EndCommodityUpdates(succeeded); ActiveTopic.AddToSim(Actor, "After Work"); return(succeeded); } catch (ResetException) { throw; } catch (Exception e) { Common.Exception(Actor, Target, e); return(false); } }
public override void StartRole() { if (!this.mIsActive && this.mSim.IsValidDescription) { debugger.Debug(this, "description is valid"); this.ValidateAndSetupOutfit(); if (this.mSim.CreatedSim == null) { Lot lot = LotManager.SelectRandomLotForNPCMoveIn(null); this.mSim.Instantiate(lot); } this.SwitchIntoOutfit(); Sim theSim = this.mSim.CreatedSim; if (theSim != null) { Bartending skill = theSim.SkillManager.GetSkill <Bartending>(Sims3.Gameplay.Skills.SkillNames.Bartending); if (skill == null) { theSim.SkillManager.AddAutomaticSkill(SkillNames.Bartending); } theSim.RemoveInteractionByType(GoToALot.Singleton); theSim.AddInteraction(GoToALot.Singleton); foreach (CommodityKind current in this.Data.Motives) { this.mSim.CreatedSim.Motives.CreateMotive(current); } foreach (CommodityKind current2 in this.Data.MotivesToFreeze) { this.mSim.CreatedSim.Motives.SetMax(current2); this.mSim.CreatedSim.Motives.SetDecay(current2, false); } this.mIsActive = true; debugger.Debug(this, "Role is active"); if (mRoleGivingObject != null) { if (this.mSim.CreatedSim.LotCurrent == null || this.mSim.CreatedSim.LotCurrent != mRoleGivingObject.LotCurrent) { forceSimToLot(theSim); } } if (this.IsStoryProgressionProtected) { this.ProtectSimFromStoryProgression(); } if (this.RoleGivingObject != null) { RoleGivingObject.PushRoleStartingInteraction(this.mSim.CreatedSim); debugger.Debug(this, "Role action pushed" + this.mSim.CreatedSim.InteractionQueue.ToString()); } } } }
public static Lot GetLot(FoodTruckBase truck) { ulong lotId; if (!sTruckLots.TryGetValue(truck, out lotId)) { return(null); } return(LotManager.GetLot(lotId)); }
public void InstantiateSim() { if (this.mSim.CreatedSim == null) { Lot lot = LotManager.SelectRandomLotForNPCMoveIn(null); this.mSim.CreatedSim = this.mSim.Instantiate(lot); if (Message.Sender.IsDebugging()) { Message.Sender.Debug(this, "Sim instantiated: " + mSim.FullName); } } }
/*protected static ListenerAction OnNewObject(Event e) * { * GameObject o = e.TargetObject as GameObject; * * AddInteractions(o); * * return ListenerAction.Keep; * }*/ public static void OnExitBuildBuyMode() { Lot lot = LotManager.GetLot(BuildBuyLotId); if (lot != null) { foreach (Type type in ApplianceTypes) { AddInteractionsToObjects(type, lot); } } }
public static bool Perform(SimDescription me, OpportunityNames guid) { Opportunity opportunity = null; GenericManager <OpportunityNames, Opportunity, Opportunity> .sDictionary.TryGetValue((ulong)guid, out opportunity); Repeatability origRepeatability = Repeatability.Undefined; if (opportunity != null) { origRepeatability = opportunity.RepeatLevel; opportunity.mSharedData.mRepeatLevel = Repeatability.Always; } try { me.Household.mCompletedHouseholdOpportunities.Remove((ulong)guid); if (opportunity.IsLocationBased) { List <Lot> alreadyChosenLots = new List <Lot>(); foreach (ulong lotId in OpportunityManager.sLocationBasedOpportunities.Values) { Lot lot = LotManager.GetLot(lotId); if (lot == null) { continue; } alreadyChosenLots.Add(lot); } Lot lotTarget = OpportunityManager.GetLotTarget(opportunity, alreadyChosenLots); if (lotTarget != null) { lotTarget.AddLocationBasedOpportunity(opportunity.EventDay, opportunity.EventStartTime, opportunity.EventEndTime, opportunity.Guid); alreadyChosenLots.Add(lotTarget); } } return(me.CreatedSim.OpportunityManager.AddOpportunityNow(guid, true, false)); } finally { if (opportunity != null) { opportunity.mSharedData.mRepeatLevel = origRepeatability; } } }
private static void ScheduleTodaysOrientation() { Common.DebugNotify("ScheduleTodaysOrientation A"); if (GameUtils.IsUniversityWorld()) { if (GameStates.CurrentDayOfTrip != 0x1) { return; } } else { if (!AcademicHelper.HasFirstDayActiveStudents()) { return; } } Common.DebugNotify("ScheduleTodaysOrientation B"); Lot lot = null; foreach (EventLotMarker marker in Sims3.Gameplay.Queries.GetObjects <EventLotMarker>()) { if (marker.LotCurrent == null) { continue; } if (!marker.LotCurrent.IsCommunityLot) { continue; } lot = marker.LotCurrent; break; } if (lot == null) { lot = LotManager.GetLot(OrientationSituation.kOrientationLotId); } Common.DebugNotify("ScheduleTodaysOrientation " + lot.LotId); if (lot != null) { OrientationSituation.Create(lot); } }
public static Sim DGSMakeRandomSim(Vector3 point, CASAgeGenderFlags age, CASAgeGenderFlags gender, WorldName worldname) { LotLocation lotLocation = default(LotLocation); ulong lotLocation2 = World.GetLotLocation(point, ref lotLocation); Lot lot = LotManager.GetLot(lotLocation2); if ((age & (CASAgeGenderFlags.Baby | CASAgeGenderFlags.Toddler | CASAgeGenderFlags.Child)) != CASAgeGenderFlags.None) { bool flag = false; if (lot != null && lot.Household != null) { foreach (SimDescription simDescription in lot.Household.SimDescriptions) { if (simDescription.TeenOrAbove) { flag = true; break; } } } if (!flag) { return(null); } } SimDescription simDescription2 = DGSMakeSSimDescription(age, gender, worldname, uint.MaxValue); Genetics.AssignRandomTraits(simDescription2); if (lot != null) { if (lot.Household == null) { Household household = Household.Create(); household.Name = simDescription2.mLastName ?? ""; lot.MoveIn(household); } lot.Household.Add(simDescription2); } else { Household household2 = Household.Create(); household2.SetName(/* "E3Lesa is Good" */ "Good Household"); household2.Add(simDescription2); } WorldName currentWorld = worldname; simDescription2.FirstName = SimUtils.GetRandomGivenName(simDescription2.IsMale, currentWorld); simDescription2.LastName = SimUtils.GetRandomFamilyName(currentWorld); return(simDescription2.Instantiate(point)); }
public static void AddContainedRabbitHolesToLot(ComboRabbitHole comboRH) { 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(); comboRH.MetaAds.AddRange(rH.MetaAds); rH.MetaAds.Clear(); } }
public static bool PayForLot(EditTownModel ths, UIBinInfo info, ulong lotId) { Lot lot = LotManager.GetLot(lotId); if (lot != null) { ExportBinContents contents = ths.FindExportBinContents(info.ContentId); if (contents != null) { bool flag = contents.IsLoaded(); if (!flag) { ExportBinContentsEx.Import(contents, true); } Household household = contents.Household; if (household != null) { return(BinCommonEx.PayForLot(household, lot, true, Mover.GetLotCost)); } if (!flag) { ExportBinContentsEx.Flush(contents); } } else if (info.LotId != ulong.MaxValue) { LotContents contents2 = Bin.Singleton.FindLot(info.LotId); if ((contents2 != null) && (contents2.Household != null)) { Household household2 = contents2.Household.Household; if (household2 != null) { return(BinCommonEx.PayForLot(household2, lot, true, Mover.GetLotCost)); } } } else if (info.HouseholdId != ulong.MaxValue) { Household household3 = Household.Find(info.HouseholdId); if (household3 != null) { return(BinCommonEx.PayForLot(household3, lot, true, Mover.GetLotCost)); } } } return(false); }
protected override int GetCost(PropertyData data) { int result = 0; if (data.PropertyType == RealEstatePropertyType.VacationHome) { Lot lot = LotManager.GetLot(data.LotId); if (lot != null) { result = ManagerLot.GetUnfurnishedLotCost(lot, int.MaxValue); } } return((int)(result * (GetValue <SurchargeRateOption, int>() / 100f))); }
public Lot GetLot(GameObject target, GameObjectHit hit) { Lot lot = target as Lot; if (lot != null) { return(lot); } if (target != null && target.LotCurrent != null) { return(target.LotCurrent); } return(hit != null?LotManager.GetLotAtPoint(hit.mPoint) : null); }
public static Lot GetPostionTargetLot(Vector3 pos) { if (LotManager.sLots == null) { return(LotManager.GetWorldLot()); } LotLocation LotLocation = default(LotLocation); ulong Location = World.GetLotLocation(pos, ref LotLocation); Lot TargetLot = LotManager.GetLot(Location); if (TargetLot == null) { return(LotManager.GetWorldLot()); } return(TargetLot); }
public static Lot GetCameraTargetLot() { if (LotManager.sLots == null) { return(LotManager.sActiveLot ?? LotManager.sWorldLot); } LotLocation LotLocation = default(LotLocation); ulong Location = World.GetLotLocation(NFinalizeDeath.Fast_SnapToFloor(ScriptCore.CameraController.Camera_GetTarget()), ref LotLocation); Lot TargetLot = LotManager.GetLot(Location); if (TargetLot == null) { return(LotManager.sActiveLot ?? LotManager.sWorldLot); } return(TargetLot); }
// doesn't seem to be firing... public static void OnLotTypeChanged(object sender, EventArgs args) { // until I can work on custom MA types, this should push some Sims to the lots (and urge them to buy stuff if the items exist) World.OnLotTypeChangedEventArgs args2 = args as World.OnLotTypeChangedEventArgs; if (args2 != null) { Lot lot = LotManager.GetLot(args2.LotId); if (lot != null) { if (MapTagHelper.ShouldReplace(lot)) { SetMetaAutonomyType(lot, Lot.MetaAutonomyType.MarketSmall); } } } }