예제 #1
0
 // Token: 0x06006FAF RID: 28591 RVA: 0x0026C808 File Offset: 0x0026B808
 public bool CreateGraveStone()
 {
     Urnstone.KillSim killSim = this.Target.CurrentInteraction as Urnstone.KillSim;
     if (killSim != null)
     {
         killSim.CancelDeath = false;
     }
     this.mWasMemberOfActiveHousehold = (this.Target.Household == Household.ActiveHousehold);
     if (this.Target.DeathReactionBroadcast == null)
     {
         Urnstone.CreateDeathReactionBroadcaster(this.Target);
     }
     this.Actor.SynchronizationLevel  = Sim.SyncLevel.NotStarted;
     this.Target.SynchronizationLevel = Sim.SyncLevel.NotStarted;
     this.mGrave = Urnstone.CreateGrave(this.Target.SimDescription, true, false);
     if (this.mGrave == null)
     {
         return(false);
     }
     this.mDeadSimsHousehold = this.Target.Household;
     this.mGrave.AddToUseList(this.Actor);
     this.mSituation.LastGraveCreated = this.mGrave;
     this.mDeathProgress = GrimReaperSituation.ReapSoul.DeathProgress.GraveCreated;
     return(true);
 }
예제 #2
0
파일: Kill.cs 프로젝트: pepoluan/NRaas
        protected static bool DelayedKill(Sim actor, Sim target, SimDescription.DeathType deathType)
        {
            if (actor == target)
            {
                target.SimDescription.SetDeathStyle(deathType, true);

                Urnstone urnstone = Urnstone.CreateGrave(target.SimDescription, false, true);
                if (urnstone != null)
                {
                    if (!target.Inventory.TryToAdd(urnstone, false))
                    {
                        urnstone.Destroy();
                        return(false);
                    }

                    urnstone.GhostSetup(target, true);
                }
            }
            else
            {
                List <IRabbitHolePartnershipDeed> list = Inventories.QuickDuoFind <IRabbitHolePartnershipDeed, GameObject>(target.Inventory);
                if ((list != null) && (list.Count > 0x0))
                {
                    Sim   sim      = null;
                    float minValue = float.MinValue;
                    foreach (Sim sim2 in Households.AllHumans(target.Household))
                    {
                        if (sim2 != target)
                        {
                            float        liking       = -100f;
                            Relationship relationship = Relationship.Get(target, sim2, false);
                            if (relationship != null)
                            {
                                liking = relationship.LTR.Liking;
                            }
                            if (liking > minValue)
                            {
                                minValue = liking;
                                sim      = sim2;
                            }
                        }
                    }
                    foreach (IRabbitHolePartnershipDeed deed in list)
                    {
                        target.Inventory.RemoveByForce(deed);
                        if (sim != null)
                        {
                            sim.Inventory.TryToAdd(deed, false);
                        }
                        else
                        {
                            deed.Destroy();
                        }
                    }
                }

                InteractionInstance entry = Urnstone.KillSim.Singleton.CreateInstance(target, target, new InteractionPriority(InteractionPriorityLevel.MaxDeath, 0f), false, false);
                (entry as Urnstone.KillSim).simDeathType = deathType;
                target.InteractionQueue.Add(entry);
            }

            return(true);
        }
예제 #3
0
 // Token: 0x06009AEA RID: 39658 RVA: 0x0035007C File Offset: 0x0034E27C
 public override void Cleanup()
 {
     try
     {
         if (this.mDeathProgress != GrimReaperSituation.ReapSoul.DeathProgress.Complete)
         {
             if (this.mDeathProgress == GrimReaperSituation.ReapSoul.DeathProgress.None)
             {
                 this.mGrave         = Urnstone.CreateGrave(this.Target.SimDescription, true, false);
                 this.mDeathProgress = GrimReaperSituation.ReapSoul.DeathProgress.GraveCreated;
             }
             if (this.mDeathProgress == GrimReaperSituation.ReapSoul.DeathProgress.GraveCreated)
             {
                 if (!GlobalFunctions.PlaceAtGoodLocation(this.mGrave, new World.FindGoodLocationParams(this.Target.Position), false))
                 {
                     this.mGrave.SetPosition(this.Target.Position);
                 }
                 this.mGrave.OnHandToolMovement();
                 this.mDeathProgress = GrimReaperSituation.ReapSoul.DeathProgress.GravePlaced;
             }
             if (this.mDeathProgress == GrimReaperSituation.ReapSoul.DeathProgress.GravePlaced)
             {
                 this.mGrave.GhostSetup(this.Target, false);
             }
             if (this.mDeathFlower == null)
             {
                 this.mDeathFlower = this.Target.Inventory.Find <DeathFlower>();
             }
             if (this.mDeathProgress == GrimReaperSituation.ReapSoul.DeathProgress.UnluckyStarted || (this.Target.Household != null && this.Target.IsInActiveHousehold && this.Target.SimDescription.DeathStyle != (SimDescription.DeathType) 69u))
             {
                 this.EventCallbackResurrectSim();
                 this.Target.AddExitReason(ExitReason.HigherPriorityNext);
             }
             else if (this.mDeathProgress == GrimReaperSituation.ReapSoul.DeathProgress.DeathFlowerStarted || this.mDeathFlower != null)
             {
                 this.Target.Inventory.RemoveByForce(this.mDeathFlower);
                 this.mDeathFlower.Destroy();
                 this.EventCallbackResurrectSim();
                 this.Target.AddExitReason(ExitReason.HigherPriorityNext);
             }
             else if (this.mDeathProgress != GrimReaperSituation.ReapSoul.DeathProgress.UnluckyPostEvent)
             {
                 if (this.mDeathProgress == GrimReaperSituation.ReapSoul.DeathProgress.DeathFlowerPostEvent)
                 {
                     if (this.Target.Inventory.Contains(this.mDeathFlower))
                     {
                         this.Target.Inventory.RemoveByForce(this.mDeathFlower);
                     }
                     if (this.mDeathFlower != null)
                     {
                         this.mDeathFlower.Destroy();
                     }
                 }
                 else
                 {
                     this.mDeathProgress = GrimReaperSituation.ReapSoul.DeathProgress.NormalStarted;
                 }
             }
             if (this.mDeathProgress == GrimReaperSituation.ReapSoul.DeathProgress.NormalStarted)
             {
                 this.FinalizeDeath();
                 this.CleanupAndDestroyDeadSim(true);
             }
             this.GrimReaperPostSequenceCleanup();
             Urnstone.FogEffectTurnAllOff(this.Actor.LotCurrent);
             this.StopGhostExplosion();
         }
         SMCDeath.EnterState("x", "Enter");
         base.Cleanup();
     }
     catch (Exception exception)
     {
         Target.FadeIn();
         NiecException.PrintMessage(exception.Message + NiecException.NewLine + exception.StackTrace);
         base.Cleanup();
     }
 }
예제 #4
0
            public override void ConfigureInteraction()
            {
                Sims3.Gameplay.CAS.SimDescription.DeathType deathtyp = base.simDeathType;
                try
                {
                    bool isplayer = Actor.IsSelectable;

                    if (isplayer)
                    {
                        mMustRun            = false;
                        mHidden             = false;
                        CancellableByPlayer = true;
                    }

                    var killSim =
                        ExtKillSimNiec.Singleton.CreateInstance(Target, Actor, KillSimNiecX.DGSAndNonDGSPriority(), Autonomous, isplayer) as ExtKillSimNiec;

                    killSim.simDeathType       = base.simDeathType;
                    killSim.PlayDeathAnimation = base.PlayDeathAnimation;
                    killSim.mMustRun           = true;

                    base.mPriority = KillSimNiecX.DGSAndNonDGSPriority();

                    runI = killSim;
                    runI.ConfigureInteraction();
                }
                catch (ResetException) { throw; }
                catch { }
                if (!_IsOpenDGSInstalled && !Actor.IsInActiveHousehold)
                {
                    SimDescription ActorDesc = Actor.SimDescription;
                    Sim            Actior    = Actor;


                    if (ATask == ObjectGuid.InvalidObjectGuid)
                    {
                        InteractionPriority MaxDeathP = KillSimNiecX.DGSAndNonDGSPriority();

                        ATask = NiecTask.Perform(delegate
                        {
                            for (int i = 0; i < 190; i++)
                            {
                                Simulator.Sleep(10);
                            }
                            try
                            {
                                while (Actior != null && Actior.mSimDescription != null && !Actior.HasBeenDestroyed && Actior.InteractionQueue != null && Actior.InteractionQueue.HasInteractionOfType(typeof(NiecKillSim)))
                                {
                                    Simulator.Sleep(0);
                                    base.mPriority = MaxDeathP;
                                    base.mMustRun  = true;
                                }
                            }
                            catch (ResetException)
                            {
                                throw;
                            }
                            catch { }
                        });
                    }
                    if (AutoKillSimTask == ObjectGuid.InvalidObjectGuid)
                    {
                        AutoKillSimTask = NiecTask.Perform(delegate
                        {
                            /*
                             * ActorDesc.IsGhost = true;
                             * ActorDesc.mDeathStyle = base.simDeathType;
                             *
                             *
                             *
                             *
                             * if (NFinalizeDeath.GetKillNPCSimToGhost(Actor, deathtyp)) return;
                             * else SafeNRaas.NRUrnstones_CreateGrave(ActorDesc, deathtyp, false, false);*/


                            for (int i = 0; i < 190; i++)
                            {
                                Simulator.Sleep(10);
                            }

                            try
                            {
                                try
                                {
                                    while (Actior != null && Actior.mSimDescription != null && !Actior.HasBeenDestroyed && Actior.InteractionQueue != null && Actior.InteractionQueue.HasInteractionOfType(typeof(NiecKillSim)))
                                    {
                                        Simulator.Sleep(170);
                                    }
                                }
                                catch (ResetException)
                                {
                                    throw;
                                }
                                catch { }

                                Sim CreatedSim = ActorDesc.CreatedSim;

                                try
                                {
                                    if (NFinalizeDeath.IsHasInteractionNHSTargetSim(Actior))
                                    {
                                        return;
                                    }
                                    if (CreatedSim != null && CreatedSim.mSimDescription == ActorDesc)
                                    {
                                        if (NFinalizeDeath.IsHasInteractionNHSTargetSim(CreatedSim))
                                        {
                                            return;
                                        }
                                    }
                                }
                                catch (ResetException)
                                {
                                    throw;
                                }
                                catch
                                { }

                                try
                                {
                                    if (ActorDesc.AssignedRole != null)
                                    {
                                        ActorDesc.AssignedRole.RemoveSimFromRole();
                                    }
                                    ActorDesc.AssignedRole = null;
                                }
                                catch (ResetException)
                                {
                                    throw;
                                }
                                catch
                                { }

                                try
                                {
                                    ActorDesc.IsGhost     = true;
                                    ActorDesc.mDeathStyle = deathtyp;
                                    NiecHelperSituation.FinalizeSimDeathPro(
                                        ActorDesc, ActorDesc.Household, AssemblyCheckByNiec.IsInstalled(NiecMod.Instantiator.DGSModsAssembly)
                                        );
                                }
                                catch (ResetException)
                                {
                                    throw;
                                }
                                catch
                                { }

                                try
                                {
                                    if (Actior.Inventory != null)
                                    {
                                        //Actior.MoveInventoryItemsToSim(NFinalizeDeath.ActiveActor ?? PlumbBob.SelectedActor);
                                        NFinalizeDeath._MoveInventoryItemsToAFamilyMember
                                            (Target, NFinalizeDeath.HouseholdMembersToSim(Household.ActiveHousehold, true, false) ?? NFinalizeDeath.ActiveActor ?? PlumbBob.SelectedActor);
                                    }
                                }
                                catch (ResetException)
                                {
                                    throw;
                                }
                                catch
                                { }


                                Urnstone RIPObject;

                                RIPObject = HelperNra.TFindGhostsGrave(ActorDesc);

                                if (RIPObject == null)
                                {
                                    NFinalizeDeath.GetKillNPCSimToGhost(Actior, deathtyp, Vector3.OutOfWorld, out RIPObject);
                                }
                                if (RIPObject == null)
                                {
                                    RIPObject = Urnstone.CreateGrave(ActorDesc, false, true);
                                }

                                NiecHelperSituation.safePosRIPObject(Actior, Actior, RIPObject);

                                NFinalizeDeath.ForceDestroyObject(Actior);
                                NFinalizeDeath.ForceDestroyObject(CreatedSim);

                                if (ActorDesc.DeathStyle == SimDescription.DeathType.None)
                                {
                                    ActorDesc.mDeathStyle = SimDescription.DeathType.Drown;
                                }
                                ActorDesc.IsGhost = true;


                                RIPObject = HelperNra.TFindGhostsGrave(ActorDesc);

                                if (RIPObject == null)
                                {
                                    NFinalizeDeath.GetKillNPCSimToGhost(Actior, deathtyp, Vector3.OutOfWorld, out RIPObject);
                                }

                                NiecHelperSituation.safePosRIPObject(Actior, Actior, RIPObject);

                                RIPObject.AddToWorld();
                                RIPObject.FadeIn();

                                RIPObject.SetHiddenFlags(HiddenFlags.Nothing);
                                RIPObject.SetOpacity(1f, 0f);
                                RIPObject.AddToWorld();
                                RIPObject.FadeIn();

                                if (ActorDesc.DeathStyle == SimDescription.DeathType.None)
                                {
                                    ActorDesc.mDeathStyle = SimDescription.DeathType.Drown;
                                }
                                ActorDesc.IsGhost = true;
                            }
                            catch (ResetException)
                            {
                                throw;
                            }
                            catch { }
                        });
                    }
                }
            }