protected override OptionResult Run(GameHitParameters <Lot> parameters) { Sim actorSim = parameters.mActor as Sim; SimSelection selection = new SimSelection(Name, actorSim.SimDescription, mType); if (selection.IsEmpty) { Common.Notify(Common.Localize(GetTitlePrefix() + ":NoChoices")); return(OptionResult.Failure); } SimDescription sim = selection.SelectSingle(); if (sim == null) { return(OptionResult.Failure); } SimDescription existing; if (sim.CreatedByService.mPreferredServiceNpc.TryGetValue(parameters.mTarget.Household.HouseholdId, out existing)) { if (existing.CreatedSim != null) { ServiceSituation.Fire(existing.CreatedSim, parameters.mTarget.Household.Sims[0]); // Human } } sim.CreatedByService.mPreferredServiceNpc[parameters.mTarget.Household.HouseholdId] = sim; Common.Notify(Common.Localize(GetTitlePrefix() + ":Success", sim.IsFemale, new object[] { sim, parameters.mTarget.Household.Name })); return(OptionResult.SuccessRetain); }
public override bool Run() { try { List <SimDescription> sims = new List <SimDescription>(); foreach (Sim sim in Actor.LotCurrent.GetObjects <Sim>()) { if (sim == Actor) { continue; } if (sim.RoomId != Actor.RoomId) { continue; } sims.Add(sim.SimDescription); } SimSelection selection = new SimSelection(Common.Localize("ScanRoom:MenuName"), Actor.SimDescription, sims, SimSelection.Type.ScanRoom, -1000); SimDescription choice = selection.SelectSingle(); if (selection.IsEmpty) { Common.Notify(Common.Localize("ScanRoom:Failure")); return(false); } if (choice != null) { if (Actor.IsHuman) { Actor.InteractionQueue.PushAsContinuation(new SocialInteractionA.Definition("Flirt", null, null, false), choice.CreatedSim, true); } else { Actor.InteractionQueue.PushAsContinuation(new SocialInteractionA.Definition("Pet Socialize", null, null, false), choice.CreatedSim, true); } } return(true); } catch (ResetException) { throw; } catch (Exception e) { Common.Exception(Actor, Target, e); return(false); } }
protected SimDescription PrivateRun(IActor actor, Role.RoleType type, GameObjectHit hit) { Sim actorSim = actor as Sim; sFailureConditions = null; SimSelection sims = SimSelection.Create(Register.GetRoleName(type), Name, actorSim.SimDescription, type); if (sims.IsEmpty) { if (!string.IsNullOrEmpty(sFailureConditions)) { Common.DebugNotify(sFailureConditions); Common.DebugWriteLog(sFailureConditions); } SimpleMessageDialog.Show(Name, Register.Localize("Select:Error")); return(null); } SimDescription sim = sims.SelectSingle(); if (sim != null) { if (sim.CreatedByService != null) { sim.CreatedByService.EndService(sim); } if (sim.AssignedRole != null) { sim.AssignedRole.RemoveSimFromRole(); } if (CriteriaItem.HasRealJob(sim)) { if (AcceptCancelDialog.Show(Common.Localize(GetTitlePrefix() + ":EmployedPrompt", sim.IsFemale, new object[] { sim }))) { sim.Occupation.RetireNoConfirmation(); } } } return(sim); }
protected SimDescription GetSelection() { if (Sim.ActiveActor == null) { return(null); } SimSelection sims = SimSelection.Create(this); if (sims.IsEmpty) { SimpleMessageDialog.Show(Name, StoryProgression.Localize("SimID:Error")); return(null); } return(sims.SelectSingle()); }
protected override OptionResult Run(GameHitParameters <GameObject> parameters) { Sim actorSim = parameters.mActor as Sim; if (parameters.mTarget != null) { SimSelection sims = SimSelection.Create("", Name, actorSim.SimDescription, parameters.mTarget); if (sims.IsEmpty) { return(OptionResult.Failure); } sims.SelectSingle(); } return(OptionResult.SuccessClose); }
public override bool InRabbitHole() { try { if (!AcceptCancelDialog.Show(Common.Localize("Matchmaker:Prompt", Actor.IsFemale, new object[] { Woohooer.Settings.mMatchmakerCost }))) { return(false); } List <SimDescription> actors = new List <SimDescription>(); actors.Add(Actor.SimDescription); actors.AddRange(Households.Pets(Actor.Household)); SimDescription actor = Actor.SimDescription; if (actors.Count > 0) { actor = new ActorSelection(Common.Localize("Matchmaker:Choices"), actor, actors).SelectSingle(); if (actor == null) { return(false); } } SimSelection selection = new SimSelection(Common.Localize("Matchmaker:MenuName"), actor, SimListing.GetResidents(false).Values, SimSelection.Type.Matchmaker, 0); if (selection.IsEmpty) { Common.Notify(Common.Localize("Matchmaker:NoChoices", Actor.IsFemale)); return(false); } SimDescription choice = selection.SelectSingle(); if (choice == null) { Common.Notify(Common.Localize("Matchmaker:NoSelect", Actor.IsFemale)); return(false); } if (!CelebrityManager.TryModifyFundsWithCelebrityDiscount(Actor, Target, Woohooer.Settings.mMatchmakerCost, true)) { Common.Notify(Common.Localize("Matchmaker:CannotPay", Actor.IsFemale)); return(false); } Relationship relation = Relationship.Get(actor, choice, true); if (relation != null) { relation.MakeAcquaintances(); } if (actor.IsHuman) { Common.Notify(choice.CreatedSim, Common.Localize("Matchmaker:Success", Actor.IsFemale, choice.IsFemale, new object[] { choice })); } else { SimDescription owner = null; if (!choice.Household.IsSpecialHousehold) { owner = SimTypes.HeadOfFamily(choice.Household); } if (owner == null) { owner = choice; } relation = Relationship.Get(Actor.SimDescription, owner, true); if (relation != null) { relation.MakeAcquaintances(); } Common.Notify(choice.CreatedSim, Common.Localize("Matchmaker:SuccessPet", Actor.IsFemale, choice.IsFemale, new object[] { choice })); } return(true); } catch (ResetException) { throw; } catch (Exception e) { Common.Exception(Actor, Target, e); return(false); } }