protected static bool Perform(Common.IStatGenerator stats, SimDescription sim, int amount, ref bool push) { if (sim.CreatedSim == null) { stats.IncStat("Hibernating"); return false; } else if (!Inventories.VerifyInventory(sim)) { stats.IncStat("No Inventory"); return false; } School school = sim.CareerManager.School; if (school != null) { if (school.OwnersHomework == null) { school.OwnersHomework = GlobalFunctions.CreateObjectOutOfWorld("Homework") as Homework; school.OwnersHomework.OwningSimDescription = sim; Inventories.TryToMove(school.OwnersHomework, sim.CreatedSim); stats.IncStat("Homework Created"); } if ((!sim.CreatedSim.Inventory.Contains(school.OwnersHomework)) && (school.OwnersHomework.LotCurrent != sim.CreatedSim.LotCurrent) && (school.OwnersHomework.UseCount == 0)) { Inventories.TryToMove(school.OwnersHomework, sim.CreatedSim); stats.IncStat("Homework Moved"); } } if (amount > 100) { amount = 100; } bool success = false; foreach (Homework obj in Inventories.InventoryFindAll<Homework>(sim)) { if (obj.PercentComplete < 0) continue; if ((amount < 0) || (obj.PercentComplete < amount)) { obj.PercentComplete = amount; stats.AddStat("Homework Value", amount); if (amount > 90) { push = true; } success = true; } } return success; }