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; } } }