Example #1
0
        public override bool Run()
        {
            try
            {
                bool success = false;
                Actor.SynchronizationLevel  = Sim.SyncLevel.NotStarted;
                Target.SynchronizationLevel = Sim.SyncLevel.NotStarted;

                if (BeginSocialInteraction(new SocialInteractionB.Definition(null, Localization.LocalizeString(Actor.IsFemale, "Gameplay/Excel/Socializing/Action:BeAskedToMoveIn", new object[0x0]), false), false, true))
                {
                    BeginCommodityUpdates();
                    mCurrentStateMachine = StateMachineClient.Acquire(Simulator.CurrentTask, "social_AskFor");
                    mCurrentStateMachine.SetActor("x", Actor);
                    mCurrentStateMachine.SetActor("y", Target);
                    mCurrentStateMachine.EnterState("x", "Enter");
                    mCurrentStateMachine.EnterState("y", "Enter");
                    if (AcceptCancelDialog.Show(Localization.LocalizeString("Gameplay/Moving:MoveInPrompt", new object[] { Target, Actor })))
                    {
                        mCurrentStateMachine.RequestState(false, "y", "Friendly");
                        mCurrentStateMachine.RequestState(true, "x", "Friendly");
                        if (!MovingSituation.MovingInProgress)
                        {
                            // Custom
                            using (GameplayMovingModelEx.ProtectFunds protect = new GameplayMovingModelEx.ProtectFunds(Target.Household))
                            {
                                MovingDialogEx.Show(new GameplayMovingModelEx(Target, Actor.Household));
                            }
                        }
                    }
                    else
                    {
                        mCurrentStateMachine.RequestState(false, "y", "Neutral");
                        mCurrentStateMachine.RequestState(true, "x", "Neutral");
                        Actor.SocialComponent.OnMoveInRequestRejected();
                    }

                    if (Actor.Household != Target.Household)
                    {
                        Actor.SocialComponent.OnMoveInRequestRejected();
                    }

                    success = true;
                    EndCommodityUpdates(true);
                }

                Actor.ClearSynchronizationData();
                return(success);
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, e);
                return(false);
            }
        }
Example #2
0
 public static void OnAskToMoveInAccepted(Sim actor, Sim target, string interaction, ActiveTopic topic, InteractionInstance i)
 {
     try
     {
         if (!MovingSituation.MovingInProgress)
         {
             using (GameplayMovingModelEx.ProtectFunds protect = new GameplayMovingModelEx.ProtectFunds(target.Household))
             {
                 MovingDialogEx.Show(new GameplayMovingModelEx(target, actor.Household));
             }
         }
     }
     catch (ResetException)
     {
         throw;
     }
     catch (Exception e)
     {
         Common.Exception(actor, target, e);
     }
 }