protected bool TestMoveInLot() { bool nonRoomie = false; bool hasAdult = false; foreach (SimDescription sim in mMovers) { if (!Households.Allow(this, sim, GetValue <ManagerHousehold.MinTimeBetweenMovesOption, int>())) { IncStat("User Denied"); return(false); } else if ((TestDead) && (SimTypes.IsDead(sim))) { IncStat("Dead"); return(false); } else if (!sim.Marryable) { IncStat("Not Marryable"); return(false); } else if (SimTypes.InServicePool(sim, ServiceType.GrimReaper)) { IncStat("Reaper Denied"); return(false); } if (!Household.RoommateManager.IsNPCRoommate(sim)) { nonRoomie = true; } if (Households.AllowGuardian(sim)) { hasAdult = true; } Lots.PackupVehicles(sim.CreatedSim, true); } if (!nonRoomie) { IncStat("All Roomies"); return(false); } if (!hasAdult) { IncStat("No adult"); return(false); } return(true); }
protected void AdjustFundsMoveInLot(SimDescription sim, Dictionary <Household, bool> oldHouses) { if (!SimTypes.IsSpecial(sim)) { if (!oldHouses.ContainsKey(sim.Household)) { oldHouses.Add(sim.Household, true); AddStat("Old Home Funds", sim.FamilyFunds); } if (HouseholdsEx.NumHumans(sim.Household) > 0) { int funds = sim.Household.FamilyFunds / HouseholdsEx.NumHumans(sim.Household); AddStat("Transfer", funds); Money.AdjustFunds(House, "MoveIn", funds); Money.AdjustFunds(sim, "MoveOut", -funds); AddStat("Transfer Remainder", sim.FamilyFunds); if (HouseholdsEx.NumHumans(sim.Household) == 1) { Lots.PackupVehicles(sim.CreatedSim, false); int debt = GetValue <DebtOption, int>(sim.Household); AddValue <DebtOption, int>(House, debt); SetValue <DebtOption, int>(sim.Household, 0); AddStat("Debt Conversion", debt); funds = Households.Assets(sim); Money.AdjustFunds(House, "SellLot", funds); AddStat("Total Conversion", funds); } } } }
protected List <SimDescription> GetMovers(Household house, bool packup) { List <SimDescription> newMembers = new List <SimDescription>(); foreach (SimDescription sim in mMovers) { if (sim.Household == house) { continue; } newMembers.Add(sim); if (packup) { Lots.PackupVehicles(sim.CreatedSim, true); } } return(newMembers); }
protected override bool PrivateUpdate(ScenarioFrame frame) { Household house = Sim.Household; Sim sim = Sim.CreatedSim; Dictionary <SimDescription, float> inheritors = Deaths.GetInheritors(Sim, GetValue <InheritCashScenario.InheritorsOption, ManagerDeath.Inheritors>(), false); List <Sim> choices = new List <Sim>(); foreach (SimDescription other in inheritors.Keys) { if (other.CreatedSim == null) { continue; } if (!other.ChildOrAbove) { continue; } choices.Add(other.CreatedSim); } if (choices.Count == 0) { foreach (Sim other in HouseholdsEx.AllHumans(house)) { if (other == sim) { continue; } choices.Add(other); } if (choices.Count == 0) { IncStat("No Choices"); return(false); } } bool found = false; if (HouseholdsEx.NumHumans(house) == 1) { if (house.RealEstateManager.AllProperties.Count > 0) { Dictionary <Household, Sim> houses = new Dictionary <Household, Sim>(); foreach (Sim choice in choices) { if (choice.Household == null) { continue; } houses[choice.Household] = choice; } if (houses.Count > 0) { List <KeyValuePair <Household, Sim> > houseChoices = new List <KeyValuePair <Household, Sim> >(houses); foreach (PropertyData data in house.RealEstateManager.AllProperties) { KeyValuePair <Household, Sim> choice = RandomUtil.GetRandomObjectFromList(houseChoices); ManagerMoney.TransferProperty(house, choice.Key, data); mInheritors[choice.Value.SimDescription] = true; IncStat("Property Transferred"); found = true; } } } } if (!SimTypes.IsSelectable(Sim)) { Lots.PackupVehicles(sim, (HouseholdsEx.NumHumans(house) > 1)); foreach (GameObject obj in Inventories.QuickFind <GameObject>(sim.Inventory)) { Sim choice = RandomUtil.GetRandomObjectFromList(choices); if ((obj is INotTransferableOnDeath) || (obj is IHiddenInInventory) || (obj is DeathFlower) || (obj is Diploma)) { IncStat("NonTrans " + obj.GetLocalizedName()); continue; } found = true; if (Inventories.TryToMove(obj, choice)) { IncStat("Transferred " + obj.GetLocalizedName()); mInheritors[choice.SimDescription] = true; } else { IncStat("Unremovable " + obj.GetLocalizedName()); } } } Writing oldSkill = Sim.SkillManager.GetSkill <Writing>(SkillNames.Writing); if (oldSkill != null) { Writing.RoyaltyAlarm alarm = oldSkill.mRoyaltyAlarm; if (alarm != null) { List <Sim> royaltyChoices = new List <Sim>(choices); while (royaltyChoices.Count > 0) { Sim choice = RandomUtil.GetRandomObjectFromList(royaltyChoices); royaltyChoices.Remove(choice); Writing newSkill = choice.SkillManager.GetSkill <Writing>(SkillNames.Writing); if ((newSkill != null) && (newSkill.mRoyaltyAlarm != null)) { continue; } newSkill = choice.SkillManager.AddElement(SkillNames.Writing) as Writing; if (newSkill != null) { alarm.RemoveRoyaltyAlarm(); alarm.mAlarmHandle = AlarmManager.Global.AddAlarmDay(Writing.kRoyaltyPayHour, DaysOfTheWeek.Sunday, new AlarmTimerCallback(alarm.AlarmCallBack), "Royalty Alarm", AlarmType.AlwaysPersisted, newSkill.SkillOwner); alarm.mSkill = newSkill; newSkill.mRoyaltyAlarm = alarm; IncStat("Transferred Royalties"); mInheritors[choice.SimDescription] = true; found = true; } break; } } } if (!found) { return(false); } return(mInheritors.Count > 0); }