Example #1
0
        public override bool Run()
        {
            try
            {
                if (Target.Parent != null)
                {
                    Target.UnParent();
                }

                Household household = Target.LotCurrent.Household;

                Target.FadeOut(true);
                Target.RemoveFromUseList(base.Actor);
                Target.RemoveFromWorld();

                if (Actor.Inventory.CanAdd(Target))
                {
                    Actor.Inventory.TryToAdd(Target, false);
                }
                else
                {
                    Actor.Household.SharedFamilyInventory.Inventory.TryToAdd(Target, false);

                    Common.Notify(Common.Localize("Swipe:FamilyInventory", Actor.IsFemale, new object[] { Actor, Target }));
                }

                if ((household != null) && (household.Sims.Count > 0x0))
                {
                    TraitFunctions.ItemStolenCallback(household, Origin.FromTheft);
                    Target.SetStealActors(Actor, RandomUtil.GetRandomObjectFromList <Sim>(household.Sims));
                }
                else
                {
                    Target.SetStealActors(Actor, null);
                }

                foreach (Situation situation in Actor.Autonomy.SituationComponent.Situations)
                {
                    VisitSituation situation2 = situation as VisitSituation;
                    if (situation2 != null)
                    {
                        situation2.GuestStartingInappropriateAction(base.Actor, TraitTuning.KleptomaniacStealingInnapropriateness);
                    }
                }

                return(true);
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, e);
                return(false);
            }
        }
        protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            List <PropertyData> properties = new List <PropertyData>();

            int max = Maximum;
            int min = Minimum;

            foreach (PropertyData property in Sim.Household.RealEstateManager.AllProperties)
            {
                int cost = GetCost(property);
                if (cost <= 0)
                {
                    continue;
                }

                if (cost < min)
                {
                    continue;
                }

                if (cost > max)
                {
                    continue;
                }

                properties.Add(property);
            }

            if (properties.Count == 0)
            {
                return(false);
            }

            mFail = IsFail(Sim, Target);

            if (!mFail)
            {
                PropertyData choice = RandomUtil.GetRandomObjectFromList(properties);

                mObjectName  = choice.LocalizedName;
                mObjectValue = GetCost(choice);

                if (ActualTransfer)
                {
                    ManagerMoney.TransferProperty(Sim.Household, Target.Household, choice);
                }
                else
                {
                    Money.AdjustFunds(Target, "PropertyTransfer", -mObjectValue);

                    Money.AdjustFunds(Sim, "PropertyTransfer", mObjectValue);
                }

                if (Delta < 0)
                {
                    TraitFunctions.ItemStolenCallback(Target.Household, Origin.FromTheft);

                    foreach (Sim sim in HouseholdsEx.AllSims(Target.Household))
                    {
                        EventTracker.SendEvent(EventTypeId.kWasRobbed, sim);
                    }
                }
            }

            if (Delta < 0)
            {
                if (OnInvestigateScenario != null)
                {
                    OnInvestigateScenario(this, frame);
                }
            }

            return(true);
        }
Example #3
0
        protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            List <GameObject> objects = new List <GameObject>();

            int min = Minimum;
            int max = Maximum;

            AddStat("Minimum", min);
            AddStat("Maximum", max);

            foreach (Lot lot in ManagerLot.GetOwnedLots(Target))
            {
                foreach (GameObject obj in lot.GetObjects <GameObject>())
                {
                    if (!obj.IsStealable())
                    {
                        continue;
                    }

                    if (string.IsNullOrEmpty(obj.CatalogName))
                    {
                        continue;
                    }

                    if (obj.Value <= 0)
                    {
                        continue;
                    }

                    if (obj.Value < min)
                    {
                        continue;
                    }

                    if (obj.Value > max)
                    {
                        continue;
                    }

                    objects.Add(obj);
                }
            }

            if (objects.Count == 0)
            {
                return(false);
            }

            mFail = IsFail(Sim, Target);

            GameObject choice = RandomUtil.GetRandomObjectFromList(objects);

            mObjectName  = choice.CatalogName;
            mObjectValue = choice.Value;

            if (!mFail)
            {
                EventTracker.SendEvent(EventTypeId.kStoleObject, Sim.CreatedSim, choice);

                AddStat("Object Value", mObjectValue);

                if ((KeepObject) && (Sim.CreatedSim != null))
                {
                    if (!Inventories.TryToMove(choice, Sim.CreatedSim))
                    {
                        return(false);
                    }

                    choice.SetStealActors(Sim.CreatedSim, Target.CreatedSim);
                }
                else
                {
                    Money.AdjustFunds(Target, "Burgled", -mObjectValue);

                    Money.AdjustFunds(Sim, "Burgled", mObjectValue);
                }

                TraitFunctions.ItemStolenCallback(Target.Household, Origin.FromBurglar);

                foreach (Sim sim in HouseholdsEx.AllSims(Target.Household))
                {
                    EventTracker.SendEvent(EventTypeId.kWasRobbed, sim);
                }
            }

            if (OnInvestigateScenario != null)
            {
                OnInvestigateScenario(this, frame);
            }

            return(true);
        }