public bool Allow(Common.IStatGenerator stats, Lot lot, ICollection <SimDescription> sims, FindLotFlags flags, bool allowRentable) { LotOptions lotData = Options.GetLotOptions(lot); if (UnchartedIslandMarker.IsUnchartedIsland(lot)) { stats.IncStat("Find Lot: Uncharted"); return(false); } else if (!lotData.GetValue <AllowLotUseOption, bool>()) { stats.IncStat("Find Lot: Lot Allow Denied"); return(false); } else if (!PassesHomeInspection(stats, lot, sims, flags)) { stats.IncStat("Find Lot: Home Inspection"); return(false); } if (!allowRentable) { if (Money.GetDeedOwner(lot) != null) { return(false); } } return(lotData.AllowCastes(stats, sims)); }
public static bool IsRentable(StoryProgressionObject manager, Lot lot) { if (lot.ResidentialLotSubType == ResidentialLotSubType.kEP10_PrivateLot) { return(false); } if (!manager.GetValue <RentableOption, bool>(lot)) { return(false); } if (lot.Household != null) { SimDescription sim = SimTypes.HeadOfFamily(lot.Household); if (sim != null) { if (!manager.GetValue <RentableOption, bool>(sim)) { return(false); } } } if (UnchartedIslandMarker.IsUnchartedIsland(lot)) { return(false); } return(true); }
private static List <Lot> GetValidLots(bool forAbduction = false) { List <Lot> list = new List <Lot>(); foreach (Lot lot in LotManager.AllLots) { if (!lot.IsWorldLot && lot.LotType != LotType.Tutorial && !lot.IsCommunityLotOfType(CommercialLotSubType.kMisc_NoVisitors) && !lot.IsCommunityLotOfType(CommercialLotSubType.kEP10_Diving) && !UnchartedIslandMarker.IsUnchartedIsland(lot)) { if (lot.IsPlayerHomeLot) { continue; } if (lot.IsResidentialLot && lot.Household == null) { continue; } if (AlienUtils.IsHouseboatAndNotDocked(lot)) { continue; } if (forAbduction && lot.GetAllActorsCount() <= 0) { continue; } list.Add(lot); } } if (list.Count == 0) { return(null); } else { return(list); } }
public static bool Show(IMovingModel model) { if (IntroTutorial.IsRunning && !IntroTutorial.AreYouExitingTutorial()) { return(false); } if (ScreenGrabController.InProgress || VideoGrabHelper.InUse) { return(false); } UserToolUtils.OnClose(); Sims3.Gameplay.UI.Responder.Instance.HudModel.CloseSecondaryInventory(); PopupMenu.CloseOptions(); Tutorialette.TriggerLesson(Lessons.Moving, null); List <IMapTagPickerInfo> mapTagPickerInfos = null; string titleText = Localization.LocalizeString("Ui/Caption/MovingDialog:ChooseLocation", new object[0]); string confirmText = Localization.LocalizeString("Ui/Caption/MovingDialog:ChooseConfirm", new object[0]); MoveDialogBase.Result running = MoveDialogBase.Result.Running; ulong maxValue = ulong.MaxValue; HouseboatSize houseboatSize = HouseboatSize.None; if (!MoveDialog.Show(model)) { return(false); } SceneMgrWindow sceneWindow = UIManager.GetSceneWindow(); if (sceneWindow != null) { sceneWindow.StopForwardingAllEvents(); } do { switch (running) { case MoveDialogBase.Result.LotSelect: case MoveDialogBase.Result.HouseSelect: case MoveDialogBase.Result.LotAndHouseSelect: case MoveDialogBase.Result.PortSelect: running = MoveDialog.RunWithPickedLot(maxValue, houseboatSize); break; default: running = MoveDialog.Run(); break; } switch (running) { case MoveDialogBase.Result.LotSelect: case MoveDialogBase.Result.HouseSelect: case MoveDialogBase.Result.LotAndHouseSelect: case MoveDialogBase.Result.PortSelect: if (mapTagPickerInfos == null) { mapTagPickerInfos = new List <IMapTagPickerInfo>(); } else { mapTagPickerInfos.Clear(); } bool isSource = model.SourceIsSelectedHousehold(); int householdBuyingPowerFunds = model.GetHouseholdBuyingPowerFunds(isSource); bool flag3 = true; if (running == MoveDialogBase.Result.PortSelect) { flag3 = ChangeHouseboatDialog.Show(false, ref houseboatSize, true); } if (flag3) { foreach (Lot lot in LotManager.AllLots) { if ((!lot.IsWorldLot && lot.IsResidentialLot) && (lot.IsApartmentLot || (lot.Household == null))) { if (running == MoveDialogBase.Result.PortSelect) { if ((lot.CommercialLotSubType == CommercialLotSubType.kEP10_Port) && lot.IsUnoccupiedPortLot()) { HouseboatInfo info = HouseboatUtils.GetInfo(houseboatSize); MovingToPortMapTagPickerLotInfo item = new MovingToPortMapTagPickerLotInfo(lot, MapTagType.PortLot, info.Price); mapTagPickerInfos.Add(item); } } else if (((!lot.IsWorldLot && lot.IsResidentialLot) && (lot.ResidentialLotSubType != ResidentialLotSubType.kEP10_PrivateLot)) && ((lot.IsApartmentLot || (lot.Household == null)) && !UnchartedIslandMarker.DoesLotHaveUnchartedIslandMarker(lot))) { if (lot.IsApartmentLot) { if ((running == MoveDialogBase.Result.HouseSelect) && ((lot.Household == null) || !model.HouseholdIsSource(lot.Household.HouseholdId))) { MapTagPickerLotInfo item = new MapTagPickerLotInfo(lot, MapTagType.Apartment); mapTagPickerInfos.Add(item); } } else if (World.LotIsEmpty(lot.LotId) && lot.IsLotEmptyFromObjects()) { if (running != MoveDialogBase.Result.HouseSelect) { MapTagPickerLotInfo info; // Custom if (Mover.GetLotCost(lot) <= householdBuyingPowerFunds) { info = new MapTagPickerLotInfo(lot, MapTagType.AvailableEmptyLot); } else { info = new MapTagPickerLotInfo(lot, MapTagType.UnavailableEmptyLot); } mapTagPickerInfos.Add(info); } } else if (running != MoveDialogBase.Result.LotSelect) { MapTagPickerLotInfo info2; // Custom if (Mover.GetLotCost(lot) <= householdBuyingPowerFunds) { info2 = new MapTagPickerLotInfo(lot, MapTagType.AvailableEmptyHouse); } else { info2 = new MapTagPickerLotInfo(lot, MapTagType.UnavailableEmptyHouse); } mapTagPickerInfos.Add(info2); } } } } } IMapTagPickerInfo info3 = null; if (flag3) { bool flag4; info3 = MapTagPickerDialog.Show(mapTagPickerInfos, titleText, confirmText, null, false, 0f, false, out flag4); } if (info3 != null) { maxValue = info3.LotId; } break; } }while ((running != MoveDialogBase.Result.Accepted) && (running != MoveDialogBase.Result.Cancelled)); if (sceneWindow != null) { sceneWindow.StartForwardingEventsToGame(); } MoveDialog.Shutdown(); return(running == MoveDialogBase.Result.Accepted); }
public bool AllowSim(Common.IStatGenerator stats, Sim sim, Lot lot) { if (sim == null) { return(false); } if (!lot.IsOpenVenue()) { stats.IncStat("Not Open Venue"); return(false); } else if (UnchartedIslandMarker.IsUnchartedIsland(lot)) { stats.IncStat("Uncharted"); return(false); } LotOptions lotOptions = GetLotOptions(lot); if (!lotOptions.GetValue <AllowLotPushOption, bool>()) { stats.IncStat("Lot Push Denied"); return(false); } if (!lotOptions.AllowCastes(stats, sim.SimDescription)) { return(false); } switch (lot.CommercialLotSubType) { case CommercialLotSubType.kEP2_JunkyardNoVisitors: case CommercialLotSubType.kMisc_NoVisitors: stats.IncStat("No Visitors"); return(false); case CommercialLotSubType.kArtGallery: case CommercialLotSubType.kTheatre: if (sim.TraitManager.HasElement(TraitNames.CantStandArt)) { stats.IncStat("CantStandArt"); return(false); } break; case CommercialLotSubType.kBeach: case CommercialLotSubType.kEP3_DanceClubPool: case CommercialLotSubType.kPool: case CommercialLotSubType.kFishingSpot: if (sim.TraitManager.HasElement(TraitNames.CantStandArt)) { stats.IncStat("CantStandArt"); return(false); } break; case CommercialLotSubType.kGym: if (sim.TraitManager.HasElement(TraitNames.CouchPotato)) { stats.IncStat("CouchPotato"); return(false); } break; case CommercialLotSubType.kGraveyard: if (sim.TraitManager.HasElement(TraitNames.Coward)) { stats.IncStat("Coward"); return(false); } break; } CarryingChildPosture posture = sim.CarryingChildPosture; if (posture != null) { if (!AllowSim(stats, posture.Child, lot)) { stats.IncStat("Child Fail"); return(false); } } return(true); }
public static bool CreateActiveHouseholdAndActiveActor() { if (GameStates.IsGameShuttingDown || PlumbBob.Singleton == null) { return(false); } if (/*PlumbBob.SelectedActor != null &&*/ PlumbBob.Singleton.mSelectedActor != null) { return(true); } List <Lot> lieast = new List <Lot>(); Lot lot = null; //foreach (object obj in LotManager.AllLotsWithoutCommonExceptions) foreach (object obj in LotManager.AllLots) { //Lot lot2 = (Lot)obj; //if (lot2.IsResidentialLot && lot2.Household == null) Lot lot2 = (Lot)obj; if (!lot2.IsWorldLot && !lot2.IsCommunityLotOfType(CommercialLotSubType.kEP10_Diving) && !UnchartedIslandMarker.IsUnchartedIsland(lot2) && lot2.IsResidentialLot && lot2.Household == null && !World.LotIsEmpty(lot2.LotId) && !lot2.IsLotEmptyFromObjects()) { lieast.Add(lot2); } if (lieast.Count == 0) { if (!lot2.IsWorldLot && !lot2.IsCommunityLotOfType(CommercialLotSubType.kEP10_Diving) && !UnchartedIslandMarker.IsUnchartedIsland(lot2) && lot2.IsResidentialLot && lot2.Household == null) { lieast.Add(lot2); } } } if (lieast.Count > 0) { string simlastnamehousehold = "No Name"; lot = RandomUtil.GetRandomObjectFromList <Lot>(lieast); List <Sim> siml = new List <Sim>(); Sim sim = null; Sim sim2 = null; Sim sim3 = null; Sim sim4 = null; if (AssemblyCheckByNiec.IsInstalled("DGSCore")) { try { CommandSystem.ExecuteCommandString("dgspx false"); } catch { } sim4 = DGSMakeSim.DGSMakeRandomSimNoCheck(lot.Position, CASAgeGenderFlags.Child, CASAgeGenderFlags.Female, GameUtils.GetCurrentWorld()); sim = DGSMakeSim.DGSMakeRandomSimNoCheck(lot.Position, CASAgeGenderFlags.YoungAdult, CASAgeGenderFlags.Male, WorldName.RiverView); sim2 = DGSMakeSim.DGSMakeRandomSimNoCheck(lot.Position, CASAgeGenderFlags.YoungAdult, CASAgeGenderFlags.Female, WorldName.IslaParadiso); sim3 = DGSMakeSim.DGSMakeRandomSimNoCheck(lot.Position, CASAgeGenderFlags.Child, CASAgeGenderFlags.Male, GameUtils.GetCurrentWorld()); } else { sim = DGSMakeSim.DGSMakeRandomSimNoCheck(lot.Position, CASAgeGenderFlags.YoungAdult, CASAgeGenderFlags.Male, GameUtils.GetCurrentWorld()); sim2 = DGSMakeSim.DGSMakeRandomSimNoCheck(lot.Position, CASAgeGenderFlags.YoungAdult, CASAgeGenderFlags.Female, GameUtils.GetCurrentWorld()); sim3 = DGSMakeSim.DGSMakeRandomSimNoCheck(lot.Position, CASAgeGenderFlags.Child, CASAgeGenderFlags.Male, GameUtils.GetCurrentWorld()); sim4 = DGSMakeSim.DGSMakeRandomSimNoCheck(lot.Position, CASAgeGenderFlags.Child, CASAgeGenderFlags.Female, GameUtils.GetCurrentWorld()); } if (sim != null) { simlastnamehousehold = sim.SimDescription.LastName; siml.Add(sim); } if (sim2 != null) { simlastnamehousehold = sim2.SimDescription.LastName; siml.Add(sim2); } if (sim3 != null) { siml.Add(sim3); } if (sim4 != null) { siml.Add(sim4); } try { Relationship relation = Relationship.Get(sim.SimDescription, sim2.SimDescription, true); if (relation != null) { NFinalizeDeath.ForceChangeState(relation, LongTermRelationshipTypes.Spouse); } /* * try * { * sim.Genealogy.RemoveDirectRelation(sim2.Genealogy); * sim2.Genealogy.RemoveDirectRelation(sim.Genealogy); * } * catch * { } * * * sim2.Genealogy.AddSibling(sim.Genealogy); */ } catch { } try { Relationship childfrined = Relationship.Get(sim3.SimDescription, sim4.SimDescription, true); if (childfrined != null) { NFinalizeDeath.ForceChangeState(childfrined, LongTermRelationshipTypes.GoodFriend); } Relationship relation2 = Relationship.Get(sim.SimDescription, sim3.SimDescription, true); if (relation2 != null) { NFinalizeDeath.ForceChangeState(relation2, LongTermRelationshipTypes.GoodFriend); } Relationship relation3 = Relationship.Get(sim.SimDescription, sim4.SimDescription, true); if (relation3 != null) { NFinalizeDeath.ForceChangeState(relation3, LongTermRelationshipTypes.GoodFriend); } Relationship relation4 = Relationship.Get(sim2.SimDescription, sim3.SimDescription, true); if (relation4 != null) { NFinalizeDeath.ForceChangeState(relation4, LongTermRelationshipTypes.GoodFriend); } Relationship relation5 = Relationship.Get(sim2.SimDescription, sim4.SimDescription, true); if (relation5 != null) { NFinalizeDeath.ForceChangeState(relation5, LongTermRelationshipTypes.GoodFriend); } Relationship relation6 = Relationship.Get(sim3.SimDescription, sim.SimDescription, true); if (relation6 != null) { NFinalizeDeath.ForceChangeState(relation6, LongTermRelationshipTypes.GoodFriend); } Relationship relation7 = Relationship.Get(sim3.SimDescription, sim2.SimDescription, true); if (relation7 != null) { NFinalizeDeath.ForceChangeState(relation7, LongTermRelationshipTypes.GoodFriend); } Relationship relation8 = Relationship.Get(sim4.SimDescription, sim.SimDescription, true); if (relation8 != null) { NFinalizeDeath.ForceChangeState(relation8, LongTermRelationshipTypes.GoodFriend); } Relationship relation9 = Relationship.Get(sim4.SimDescription, sim2.SimDescription, true); if (relation9 != null) { NFinalizeDeath.ForceChangeState(relation9, LongTermRelationshipTypes.GoodFriend); } } catch { } try { if (sim.SimDescription != null && sim.SimDescription.Genealogy != null) { sim.SimDescription.Genealogy.AddChild(sim3.SimDescription.Genealogy); } if (sim2.SimDescription != null && sim2.SimDescription.Genealogy != null) { sim2.SimDescription.Genealogy.AddChild(sim3.SimDescription.Genealogy); } } catch { } try { if (sim.SimDescription != null && sim.SimDescription.Genealogy != null) { sim.SimDescription.Genealogy.AddChild(sim4.SimDescription.Genealogy); } if (sim2.SimDescription != null && sim2.SimDescription.Genealogy != null) { sim2.SimDescription.Genealogy.AddChild(sim4.SimDescription.Genealogy); } } catch { } if (siml.Count > 0) { bool checknullsim = false; try { if (sim4 != null) { PlumbBob.ForceSelectActor(sim4); } else { checknullsim = true; } sim2.SimDescription.Household.SetName(sim2.SimDescription.LastName); } catch { } try { foreach (Sim sitem in siml) { if (sitem == null) { continue; } try { if (checknullsim) { PlumbBob.ForceSelectActor(sitem); checknullsim = false; } sitem.SimDescription.LastName = simlastnamehousehold; sitem.SimDescription.Household.SetName(sim.SimDescription.LastName); try { if (sitem.SimDescription.Child || sitem.SimDescription.Teen) { sitem.SimDescription.AssignSchool(); } GlobalFunctions.PlaceAtGoodLocation(sitem, new World.FindGoodLocationParams(lot.Position), false); } catch { } try { if (sitem.IsSelectable) { sitem.OnBecameSelectable(); } } catch { } } catch (Exception ex2) { NiecMod.Nra.NiecException.WriteLog("SetName Household" + " SetName: " + NiecMod.Nra.NiecException.NewLine + NiecMod.Nra.NiecException.LogException(ex2), true, true); } try { if (sitem.SimDescription.TraitManager.HasElement(TraitNames.Evil)) { sitem.SimDescription.TraitManager.RemoveElement(TraitNames.Evil); sitem.SimDescription.TraitManager.AddElement(TraitNames.Good); } sitem.AddInitialObjects(sitem.IsSelectable); } catch { } } } catch { } } } else if (lieast.Count == 0) { return(false); } return(true); }