Exemplo n.º 1
0
        public override bool Run()
        {
            try
            {
                GoToVenue.Item choice = GoToVenue.GetChoices(Actor, Common.Localize("GoToVenueWith:MenuName", Actor.IsFemale));
                if (choice == null)
                {
                    return(false);
                }

                InteractionInstance interaction = null;
                if (choice.Value.IsCommunityLot)
                {
                    interaction = VisitCommunityLotWith.VisitWithSingleton.CreateInstance(choice.Value, Actor, GetPriority(), Autonomous, CancellableByPlayer);
                }
                else
                {
                    interaction = VisitLotWith.VisitWithSingleton.CreateInstance(choice.Value, Actor, GetPriority(), Autonomous, CancellableByPlayer);
                }

                if (Actor == Target)
                {
                    interaction.SelectedObjects = SelectedObjects;
                }
                else
                {
                    interaction.SelectedObjects = new List <object>();
                    interaction.SelectedObjects.Add(Target);
                }

                Actor.InteractionQueue.PushAsContinuation(interaction, true);
                return(true);
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, e);
                return(false);
            }
        }
Exemplo n.º 2
0
            public override void PopulatePieMenuPicker(ref InteractionInstanceParameters parameters, out List <ObjectPicker.TabInfo> listObjs, out List <ObjectPicker.HeaderInfo> headers, out int NumSelectableRows)
            {
                try
                {
                    IActor actor = parameters.Actor;
                    if (!mbWalkHome)
                    {
                        NumSelectableRows = 0x1;
                        headers           = new List <ObjectPicker.HeaderInfo>();
                        headers.Add(new ObjectPicker.HeaderInfo("Gameplay/Actors/Sim/GoForWalkWithDog:ObjectPickerColumnHeaderLot", "Gameplay/Actors/Sim/GoForWalkWithDog:ObjectPickerColumnHeaderDescriptionLot", 0xfa));
                        listObjs = new List <ObjectPicker.TabInfo>();
                        listObjs.Add(new ObjectPicker.TabInfo(string.Empty, string.Empty, new List <ObjectPicker.RowInfo>()));

                        foreach (GoToVenue.Item choice in GoToVenue.GetChoices(actor as Sim))
                        {
                            Lot lot = choice.Value;

                            GameObject item = lot;
                            List <ObjectPicker.ColumnInfo> columnInfo = new List <ObjectPicker.ColumnInfo>();
                            string name = lot.Name;
                            if (lot == actor.LotHome)
                            {
                                name = Common.LocalizeEAString(actor.IsFemale, "Gameplay/Actors/Sim/GoForWalkWithDog:WalkHome");
                            }
                            else if (name == string.Empty)
                            {
                                name = lot.Address;
                                if (name == string.Empty)
                                {
                                    name = (Responder.Instance.EditTownModel as EditTownModel).CommercialSubTypeLocalizedName(lot.CommercialLotSubType);
                                    if (name == null)
                                    {
                                        name = string.Empty;
                                    }
                                }
                            }

                            columnInfo.Add(new ObjectPicker.ThumbAndTextColumn(item.GetThumbnailKey(), name));
                            listObjs[0x0].RowInfo.Add(new ObjectPicker.RowInfo(item, columnInfo));
                        }

                        if (listObjs.Count == 0x0)
                        {
                            NumSelectableRows = 0x0;
                            listObjs          = null;
                            headers           = null;
                        }
                    }
                    else
                    {
                        NumSelectableRows = 0x0;
                        listObjs          = null;
                        headers           = null;
                    }
                }
                catch (Exception e)
                {
                    NumSelectableRows = 0x0;
                    listObjs          = null;
                    headers           = null;

                    Common.Exception(parameters.Actor, parameters.Target, e);
                }
            }
Exemplo n.º 3
0
        public override bool Run()
        {
            try
            {
                GoToVenue.Item choice = GoToVenue.GetChoices(Actor, Terrain.GoJogging.LocalizeString(Actor.IsFemale, "InteractionName", new object[0x0]));
                if (choice == null)
                {
                    return(false);
                }

                Actor.SwitchToOutfitWithSpin(Sim.ClothesChangeReason.GoingToWorkOut);

                Sim.WalkStyle simWalkStyle = Actor.SimWalkStyle;
                mAthleticSkill = Actor.SkillManager.GetSkill <Athletic>(SkillNames.Athletic);
                if (mAthleticSkill.SkillLevel >= Terrain.JogHere.AthleticSkillLevelToFastJog)
                {
                    RequestWalkStyle(Sim.WalkStyle.FastJog);
                }
                else
                {
                    RequestWalkStyle(Sim.WalkStyle.Jog);
                }

                Destination = Actor.Position;
                mLastTime   = SimClock.ElapsedTime(TimeUnit.Minutes);
                AlarmHandle handle  = Actor.AddAlarmRepeating(1f, TimeUnit.Minutes, JogLoop, 1f, TimeUnit.Minutes, "Jog Here: Check for Fatigued Buff", AlarmType.DeleteOnReset);
                AlarmHandle handle2 = Actor.AddAlarm(Terrain.JogHere.AthleticTuning.MinsToAddPumped, TimeUnit.Minutes, AddPumped, "AthleticGameObject: Pumped", AlarmType.DeleteOnReset);

                float num = 1f - (Terrain.JogHere.AthleticTuning.DelayFatiguePercentagePerAthleticSkillLevel * mAthleticSkill.SkillLevel);
                if (num <= 0f)
                {
                    num = 0f;
                }

                float multiplier = 1f;
                if (Actor.TraitManager.HasElement(TraitNames.Athletic))
                {
                    multiplier = Terrain.JogHere.AthleticTuning.AthleticTraitDestressMultiplier;
                }

                StandardEntry();
                BeginCommodityUpdate(CommodityKind.Fun, multiplier);
                if (mAthleticSkill.IsFitnessNut())
                {
                    num = 0f;
                }

                float athleticTraitSimFatigueMultiplier = 1f;
                if (Actor.TraitManager.HasElement(TraitNames.Athletic))
                {
                    athleticTraitSimFatigueMultiplier = TraitTuning.AthleticTraitSimFatigueMultiplier;
                }

                Lot currentLot = Actor.LotCurrent;

                bool succeeded = false;
                try
                {
                    BeginCommodityUpdate(CommodityKind.Fatigue, num * athleticTraitSimFatigueMultiplier);
                    BeginCommodityUpdates();

                    if (CurrentTone is Athletic.NoSweatTone)
                    {
                        DisableMotiveDelta(CommodityKind.Hygiene);
                    }

                    StartFitness(Actor);

                    Route r = Actor.CreateRoute();
                    r.SetOption(Route.RouteOption.EnablePlanningAsCar, false);
                    r.SetOption(Route.RouteOption.EnableSubwayPlanning, false);
                    r.SetOption(Route.RouteOption.DoNotEmitDegenerateRoutesForRadialRangeGoals, true);
                    r.SetOption(Route.RouteOption.DoLineOfSightCheckUserOverride, true);
                    r.SetOption(Route.RouteOption.CheckForFootprintsNearGoals, true);

                    choice.Value.PlanToLot(r);
                    succeeded = Actor.DoRoute(r);

                    r = Actor.CreateRoute();
                    r.SetOption(Route.RouteOption.EnablePlanningAsCar, false);
                    r.SetOption(Route.RouteOption.EnableSubwayPlanning, false);
                    r.SetOption(Route.RouteOption.DoNotEmitDegenerateRoutesForRadialRangeGoals, true);
                    r.SetOption(Route.RouteOption.DoLineOfSightCheckUserOverride, true);
                    r.SetOption(Route.RouteOption.CheckForFootprintsNearGoals, true);

                    currentLot.PlanToLot(r);
                    succeeded = succeeded && Actor.DoRoute(r);
                }
                finally
                {
                    StopFitness(Actor);

                    EndCommodityUpdates(succeeded);
                    StandardExit();
                }

                Actor.RemoveAlarm(handle);
                Actor.RemoveAlarm(handle2);

                Actor.BuffManager.UnpauseBuff(BuffNames.Pumped);
                return(succeeded);
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, e);
                return(false);
            }
        }