protected override bool Allow(SimDescription sim) { if (sim.CreatedSim == null) { IncStat("Hibernating"); return(false); } else if (sim.LotHome == null) { IncStat("Homeless"); return(false); } else if (sim.CreatedSim.LotCurrent == sim.LotHome) { IncStat("At Home"); return(false); } else if (!Situations.Allow(this, sim)) { IncStat("Push Denied"); return(false); } else { foreach (Sim member in HouseholdsEx.AllHumans(sim.Household)) { if (member.LotCurrent == sim.CreatedSim.LotCurrent) { IncStat("Supervised"); return(false); } } } return(base.Allow(sim)); }
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); }