예제 #1
0
        public void PushRoleStartingInteraction(Actors.Sim sim)
        {
            try
            {
                //Message.Sender.Show("PushRoleStartingInteraction to " + (sim != null ? sim.FullName : "null"));
                if (sim != null && GetTargetLot().IsCommunityLot)
                {
                    IBarProfessional bar = findNearestBar(sim);
                    if (bar != null && bar.InUse)
                    {
                        Bartending.DrinkDescription bestDrink = Bartending.GetBestDrinkFor(sim, base.LotCurrent.GetMetaAutonomyType);
                        String bestDrinkName = null;
                        if (bestDrink != null)
                        {
                            bestDrinkName = bestDrink.GetLocalizedName();
                        }

                        if (bestDrinkName != null)
                        {
                            PushSimToDrink(sim, bar, bestDrinkName);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Message.Sender.ShowError(this, "Cannot order drink from bar ", false, ex);
            }
        }
예제 #2
0
        public static int GetCostForDrink(Bartending.Drink drink)
        {
            float num = 5f;

            //ActivateBusiness.debugger.Debug("OnDringOrder", "drink is " + drink.ToString());
            if (drink.IsDataDrink)
            {
                //ActivateBusiness.debugger.Debug("OnDringOrder", "Drinks is datadrink");
                Bartending.DrinkData drinkData = Bartending.GetDrinkData(drink.DataKey);
                if (drinkData != null)
                {
                    //ActivateBusiness.debugger.Debug("OnDringOrder", "datafound");
                    num = (float)drinkData.Price;
                }
            }
            else
            {
                //ActivateBusiness.debugger.Debug("OnDringOrder", "Drinks is mooddrink");
                Bartending.MoodData moodData = Bartending.GetMoodData(drink.Mood);
                if (moodData != null)
                {
                    //ActivateBusiness.debugger.Debug("OnDringOrder", "datafound");
                    num = (float)moodData.Price;
                }
            }


            return((int)num);
        }
예제 #3
0
            public override bool Test(Sim a, BarProfessional target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback)
            {
                if (isAutonomous)
                {
                    return(false);
                }
                return(true);

                if (a.SimDescription.AssignedRole is Bartending.Bartender && a.SimDescription.AssignedRole.RoleGivingObject != target)
                {
                    return(false);
                }
                if (a.IsSelectable)
                {
                    if (isAutonomous)
                    {
                        return(false);
                    }
                    if (target.LotCurrent.IsCommunityLot && !target.LotCurrent.IsOpenVenue())
                    {
                        return(false);
                    }
                }
                if (!Bartending.CanWorkAsBartendender(a, target.LotCurrent))
                {
                    greyedOutTooltipCallback = InteractionInstance.CreateTooltipCallback(BarProfessional.LocalizeString("BarTendHomeBarTakeOverGreyedOut", new object[0]));
                    return(false);
                }
                return((a.IsSelectable && (target.mBartender == null || !target.mBartender.IsSelectable)) || target.mBartender == null);
            }
예제 #4
0
        public static bool TestBarBrawl(Sim actor, Sim target, ActiveTopic topic, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback)
        {
            try
            {
                if (!CommonTest(actor, target))
                {
                    return(false);
                }

                if ((actor.SimDescription.TeenOrBelow != target.SimDescription.TeenOrBelow) || target.Genealogy.IsParentOrStepParent(actor.Genealogy))
                {
                    return(false);
                }

                if (!Bartending.IsVenueNightlifeVenue(target.LotCurrent.GetMetaAutonomyType))
                {
                    return(false);
                }

                if (isAutonomous)
                {
                    return(Bartending.IsVenueDiveBar(target.LotCurrent.GetMetaAutonomyType));
                }
                return(true);
            }
            catch (Exception e)
            {
                Common.Exception("TestBarBrawl", e);
                return(false);
            }
        }
        public void GetRoleTimes(out float startTime, out float endTime)
        {
            startTime = mStartTime;
            endTime   = mEndTime;

            if (startTime == 0)
            {
                if (base.LotCurrent != null)
                {
                    if (Bartending.TryGetHoursOfOperation(base.LotCurrent, ref startTime, ref endTime))
                    {
                        mStartTime = startTime;
                        mEndTime   = endTime;
                        if (Message.Sender.IsDebugging())
                        {
                            Message.Sender.Debug(this, "Role times set automatically - startTime="
                                                 + startTime + " endTime=" + endTime);
                        }
                    }
                    else
                    {
                        startTime  = 18F;
                        mStartTime = startTime;
                        endTime    = 24F;
                        mEndTime   = endTime;
                        if (Message.Sender.IsDebugging())
                        {
                            Message.Sender.Debug(this, "Role times set fixed - startTime="
                                                 + startTime + " endTime=" + endTime);
                        }
                    }
                }
            }
        }
예제 #6
0
        public override bool RunBehavior()
        {
            GameObject gameObject = this.mDestination.Object.GetContainedObject(this.mDestination.PlacementSlot) as GameObject;
            TrueBlood  tb         = gameObject as TrueBlood;

            if (tb != null)
            {
                int num;
                if (this.RunPaymentBehavior(out num))
                {
                    Sim        instanceActor = this.LinkedInteractionInstance.InstanceActor;
                    Bartending bartending    = (Bartending)instanceActor.SkillManager.AddElement(SkillNames.Bartending);
                    if (bartending != null)
                    {
                        Sim simInChargeOfBar = this.GetSimInChargeOfBar();
                        bartending.OnServedSim(this.Actor, simInChargeOfBar, num, Quality.Nice, this.Target.LotCurrent, DrinkDescription);
                        instanceActor.ModifyFunds(num);
                    }


                    if (CarrySystem.PickUpWithoutRouting(this.Actor, tb, true))
                    {
                        tb.PushEatHeldFoodInteraction(this.Actor);
                    }
                    else
                    {
                        gameObject.FadeOut(false, true);
                    }

                    return(true);
                }
                gameObject.FadeOut(true, true);
            }
            return(false);
        }
예제 #7
0
        public override bool RunOrderBehavior()
        {
            Bartending.ShowDrinkSpeechBalloon(this.Actor, this.Target.LotCurrent.GetMetaAutonomyType, DrinkDescription);
            ServeTrueBlood makeDrink = (ServeTrueBlood)this.LinkedInteractionInstance;

            return(true);
        }
예제 #8
0
        private int GetTipAmount(Sim actor, Sim creator, Lot.MetaAutonomyType venueType, Bartending.DrinkDescription requestedDrink)
        {
            float num = 0f;

            if (venueType != Lot.MetaAutonomyType.Residential && !actor.IsSelectable)
            {
                Bartending.BarData barData;
                if (Bartending.TryGetBarData(venueType, out barData))
                {
                    float num2 = (float)Bartending.GetCostForDrink(requestedDrink, venueType);
                    float num3 = num2 * barData.PriceCapMultiplier;

                    if (num > num3)
                    {
                        creator.ShowTNSIfSelectable(Bartending.LocalizeString(creator.IsFemale, "BartenderExpensiveIngredients", new object[0]), StyledNotification.NotificationStyle.kSimTalking, actor.ObjectId, creator.ObjectId);
                    }
                    num += num2 * Bartending.GetTipMultiplierForMood(Bartending.DrinkMood.Regular);

                    float num5 = 0f;

                    if (actor.HasTrait(TraitNames.Frugal))
                    {
                        num5 *= Bartending.kTipMultiplierTraitFrugal;
                    }
                    num += num2 * num5;
                    num  = Math.Min(num, num3);
                }
                Bartending skill = creator.SkillManager.GetSkill <Bartending>(SkillNames.Bartending);
                if (skill != null && skill.LifetimeOpportunityServedDrinksCompleted)
                {
                    num *= Bartending.kLifetimeOpportunityServedTipMultiplier;
                }
            }
            return((int)num);
        }
예제 #9
0
        public override void StartRole()
        {
            if (!this.mIsActive && this.mSim.IsValidDescription)
            {
                debugger.Debug(this, "description is valid");
                this.ValidateAndSetupOutfit();
                if (this.mSim.CreatedSim == null)
                {
                    Lot lot = LotManager.SelectRandomLotForNPCMoveIn(null);
                    this.mSim.Instantiate(lot);
                }
                this.SwitchIntoOutfit();

                Sim theSim = this.mSim.CreatedSim;
                if (theSim != null)
                {
                    Bartending skill = theSim.SkillManager.GetSkill <Bartending>(Sims3.Gameplay.Skills.SkillNames.Bartending);
                    if (skill == null)
                    {
                        theSim.SkillManager.AddAutomaticSkill(SkillNames.Bartending);
                    }

                    theSim.RemoveInteractionByType(GoToALot.Singleton);
                    theSim.AddInteraction(GoToALot.Singleton);

                    foreach (CommodityKind current in this.Data.Motives)
                    {
                        this.mSim.CreatedSim.Motives.CreateMotive(current);
                    }
                    foreach (CommodityKind current2 in this.Data.MotivesToFreeze)
                    {
                        this.mSim.CreatedSim.Motives.SetMax(current2);
                        this.mSim.CreatedSim.Motives.SetDecay(current2, false);
                    }
                    this.mIsActive = true;
                    debugger.Debug(this, "Role is active");
                    if (mRoleGivingObject != null)
                    {
                        if (this.mSim.CreatedSim.LotCurrent == null || this.mSim.CreatedSim.LotCurrent != mRoleGivingObject.LotCurrent)
                        {
                            forceSimToLot(theSim);
                        }
                    }
                    if (this.IsStoryProgressionProtected)
                    {
                        this.ProtectSimFromStoryProgression();
                    }
                    if (this.RoleGivingObject != null)
                    {
                        RoleGivingObject.PushRoleStartingInteraction(this.mSim.CreatedSim);
                        debugger.Debug(this, "Role action pushed" + this.mSim.CreatedSim.InteractionQueue.ToString());
                    }
                }
            }
        }
예제 #10
0
파일: WorldData.cs 프로젝트: yakoder/NRaas
        public void OnWorldLoadFinished()
        {
            if (sInitial)
            {
                MergeToCrossWorldData();
                sInitial = false;
            }

            SetVacationWorld(false, true);

            mOldHouse = Household.ActiveHousehold;

            new Common.DelayedEventListener(EventTypeId.kEventSimSelected, OnSelected);

            InWorldStateEx.LinkToTravelHousehold();

            if (!sDefaultBarTuned)
            {
                Bartending.BarData defaultData;
                if (Bartending.TryGetBarData(Lot.MetaAutonomyType.None, out defaultData))
                {
                    List <Bartending.BarData> choices = new List <Bartending.BarData>();

                    foreach (Bartending.BarData data in Bartending.sData.Values)
                    {
                        if (!data.IsPizzaAvailable)
                        {
                            continue;
                        }

                        if (data.mFoods.Count == 0)
                        {
                            continue;
                        }

                        choices.Add(data);
                    }

                    if (choices.Count > 0)
                    {
                        Bartending.BarData choice = RandomUtil.GetRandomObjectFromList(choices);

                        defaultData.mFoodQualityMinimum = choice.mFoodQualityMinimum;
                        defaultData.mFoodQualityMaximum = choice.mFoodQualityMaximum;
                        defaultData.mIsPizzaAvailable   = true;
                        defaultData.mPriceMultiplier    = choice.mPriceMultiplier;
                        defaultData.mPriceCapMultiplier = choice.mPriceCapMultiplier;
                        defaultData.mFoods = choice.mFoods;
                    }
                }
            }
        }
예제 #11
0
            public override bool Test(Sim actor, BarProfessional target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback)
            {
                SimDescription theActor = actor.SimDescription;

                if (theActor != null)
                {
                    if (theActor.IsVampire == false)
                    {
                        return(false);
                    }
                }

                if (!target.IsBartenderAvailable())
                {
                    return(false);
                }
                if (actor == target.mBartender)
                {
                    return(false);
                }
                if (target.LotCurrent.IsResidentialLot)
                {
                    return(false);
                }
                if (isAutonomous)
                {
                    if (BarProfessional.IsRunningBarInteraction(actor))
                    {
                        return(false);
                    }
                    if (target.mBartender != null && !Bartending.CanWorkAsBartendender(target.mBartender, target.LotCurrent, true))
                    {
                        return(false);
                    }
                    if (Bartending.HasTabOpen(actor, target.LotCurrent))
                    {
                        return(false);
                    }
                }
                if (DrinkDescription != null)
                {
                    int num = BarProfessional.GetCost(DrinkDescription, target.LotCurrent.GetMetaAutonomyType, actor, target) * 1;
                    if (num > actor.FamilyFunds)
                    {
                        greyedOutTooltipCallback = InteractionInstance.CreateTooltipCallback(BarProfessional.LocalizeString("NotEnoughMoney", new object[0]));
                        return(false);
                    }
                }
                return(true);
            }
예제 #12
0
        public override bool Run()
        {
            try
            {
                base.StandardEntry(false);
                base.BeginCommodityUpdates();
                base.AcquireStateMachine("BarProfessional", AnimationPriority.kAPCarryRightPlus);
                base.SetActorAndEnter("x", this.Actor, "Enter");
                Bartending.SetGlassActor(this.mCurrentStateMachine, this.Target);
                Posture posture = this.Actor.Posture;
                if (posture is SimCarryingObjectPosture)
                {
                    posture = posture.PreviousPosture;
                }
                BarProfessional.SetSeatedParameter(this.Actor, this.mCurrentStateMachine);
                //string reactionNameForDrink = Bartending.GetReactionNameForDrink(this.Actor, this.Target.ContainedDrink);
                //base.AnimateSim(reactionNameForDrink);
                this.Target.TakeSip(this.Actor);
                //if (Bartending.IsReactionNaseous(reactionNameForDrink))
                //{
                //    this.Actor.BuffManager.AddElement(BuffNames.Nauseous, Origin.FromJuice);
                //    base.SetParameter("isCarryingGlass", false);
                //    CarrySystem.ExitAndKeepHolding(this.Actor);
                //    base.DestroyObject(this.Target);
                //    Glass.PopPosture(this.Actor);
                //}
                //else
                //{
                StyledNotification.Show(new StyledNotification.Format("drinking: " + base.Target.mTotalSips + " glass empty " + this.Target.IsEmpty(), StyledNotification.NotificationStyle.kGameMessagePositive));
                base.SetParameter("isCarryingGlass", true);
                if (this.Target.IsEmpty())//|| Bartending.IsReactionNegative(reactionNameForDrink))
                {
                    StyledNotification.Show(new StyledNotification.Format("glass empty, exit ", StyledNotification.NotificationStyle.kGameMessagePositive));

                    this.Target.OnDrinkFinished(this.Actor);
                    Glass.PutAwayAndPop(this.Actor);
                }
                //}
                base.AnimateSim("Exit");
                base.EndCommodityUpdates(true);
                base.StandardExit(false, false);
            }
            catch (System.Exception ex)
            {
                StyledNotification.Show(new StyledNotification.Format(ex.Message, StyledNotification.NotificationStyle.kGameMessageNegative));
            }
            return(true);
        }
예제 #13
0
        protected override bool PrivateAllow(SimDescription me)
        {
            if (!base.PrivateAllow(me))
            {
                return(false);
            }

            if (me.SkillManager == null)
            {
                return(false);
            }

            Bartending tending = me.SkillManager.GetSkill <Bartending>(SkillNames.Bartending);

            return(tending != null);
        }
예제 #14
0
            public Item(Lot lot)
                : base(lot, VenueName(lot.CommercialLotSubType) + ": " + lot.Name, 0, lot.GetThumbnailKey())
            {
                float startTime, endTime;

                Bartending.GetRoleTimes(out startTime, out endTime, lot.GetMetaAutonomyType);

                if (startTime == endTime)
                {
                    mOpen = true;
                }
                else
                {
                    mOpen = SimClock.IsTimeBetweenTimes(SimClock.HoursPassedOfDay, startTime, endTime);
                }
            }
예제 #15
0
        protected static void PopulateLotList(List<IceCreamTruckManager.LotData> data)
        {
            foreach (Lot lot in LotManager.AllLots)
            {
                if (!IsValidLot(lot, null)) continue;

                IceCreamTruckManager.LotData item = new IceCreamTruckManager.LotData(lot);

                item.mDistanceReduction = 0f;

                float openHour = 0f;
                float closingHour = 0f;
                if (lot.LotType == LotType.Commercial)
                {
                    if ((Bartending.TryGetHoursOfOperation(lot, ref openHour, ref closingHour)) && (SimClock.IsTimeBetweenTimes(SimClock.HoursPassedOfDay, openHour, closingHour)))
                    {
                        if (lot.CountObjects<ISchoolRabbitHole>() > 0x0)
                        {
                            item.mDistanceReduction += IceCreamTruckManager.kSchoolLotDistanceReduction;
                        }
                    }
                }

                if (lot.Household != null)
                {
                    item.mDistanceReduction += lot.Household.GetNumberOfKids() * IceCreamTruckManager.kKidsLotDistanceReduction;
                    if (lot.Household.IsActive)
                    {
                        item.mDistanceReduction += IceCreamTruckManager.kSelectableSimLotDistanceReduction;
                    }
                }

                switch (lot.CommercialLotSubType)
                {
                    case CommercialLotSubType.kSmallPark:
                    case CommercialLotSubType.kBigPark:
                    case CommercialLotSubType.kEP5_DogPark:
                    case CommercialLotSubType.kEP5_CatJungle:
                    case CommercialLotSubType.kEP11_RecreationPark:
                        item.mDistanceReduction += IceCreamTruckManager.kParkLotDistanceReduction;
                        break;
                }

                data.Add(item);
            }
        }
예제 #16
0
        public bool RunPaymentBehavior(out int tipAmount)
        {
            tipAmount = 0;
            Sim instanceActor = this.LinkedInteractionInstance.InstanceActor;
            int num           = BarProfessional.GetCost(DrinkDescription, this.Target.LotCurrent.GetMetaAutonomyType, this.Actor, this.Target, true) * 1;

            if (num == 0)
            {
                return(true);
            }
            float celebrityDiscount = this.Actor.CelebrityManager.GetCelebrityDiscount(true);

            tipAmount = GetTipAmount(this.Actor, instanceActor, this.Target.LotCurrent.GetMetaAutonomyType, DrinkDescription);
            if (Bartending.HasTabOpen(this.Actor, this.Target.LotCurrent))
            {
                Bartending.AddToTab(this.Target.LotCurrent, num);
                if (this.Actor.IsSelectable)
                {
                    this.Actor.ModifyFunds(-tipAmount);
                }
            }
            else
            {
                if (this.Actor.IsSelectable)
                {
                    if (num > this.Actor.FamilyFunds)
                    {
                        this.Actor.ShowTNSIfSelectable(BarProfessional.LocalizeString(this.Actor.IsFemale, "CantPayForDrink", new object[0]), StyledNotification.NotificationStyle.kSimTalking, instanceActor.ObjectId, this.Actor.ObjectId);
                        return(false);
                    }
                    int cost = num + tipAmount;
                    if (!CelebrityManager.TryModifyFundsWithCelebrityDiscount(this.Actor, this.Target, cost, celebrityDiscount, true))
                    {
                        return(false);
                    }
                }
            }
            return(true);
        }
예제 #17
0
        protected override bool Run(SimDescription me, bool singleSelection)
        {
            Bartending tending = me.SkillManager.GetSkill <Bartending>(SkillNames.Bartending);

            if (tending == null)
            {
                return(false);
            }

            if (!ApplyAll)
            {
                List <Item> allOptions = new List <Item>();

                allOptions.Add(null);

                foreach (KeyValuePair <string, Bartending.DrinkData> data in Bartending.sDrinks)
                {
                    if (!data.Value.IsLearnable)
                    {
                        continue;
                    }

                    int count = 0;
                    if (!tending.mNumberOfDataDrinksMade.TryGetValue(data.Key, out count))
                    {
                        count = 0;
                    }

                    allOptions.Add(new Item(data.Value, data.Key, count));
                }

                CommonSelection <Item> .Results selection = new CommonSelection <Item>(Name, me.FullName, allOptions).SelectMultiple();
                if ((selection == null) || (selection.Count == 0))
                {
                    return(false);
                }

                CommonSelection <Item> .HandleAllOrNothing(selection);

                mChoices = selection;
            }

            foreach (Item item in mChoices)
            {
                if (item == null)
                {
                    continue;
                }

                if (tending.mNumberOfDataDrinksMade.ContainsKey(item.Value))
                {
                    if (!item.IsSet)
                    {
                        continue;
                    }

                    tending.mNumberOfDataDrinksMade.Remove(item.Value);
                }
                else
                {
                    if (item.IsSet)
                    {
                        continue;
                    }

                    tending.mNumberOfDataDrinksMade.Add(item.Value, 1);

                    tending.mDataDrinkLearnChances.Remove(item.Value);
                }
            }

            return(true);
        }
예제 #18
0
파일: WorldData.cs 프로젝트: yakoder/NRaas
        public void OnPreLoad()
        {
            sDefaultBarTuned = false;

            foreach (BookComicData bookData in BookData.BookComicDataList.Values)
            {
                bookData.AllowedWorldTypes.Add(WorldType.Vacation);
            }

            foreach (Opportunity opp in OpportunityManager.sLocationBasedOpportunityList.Values)
            {
                if (opp.SharedData.mTargetWorldRequired == WorldName.SunsetValley)
                {
                    opp.SharedData.mTargetWorldRequired = WorldName.Undefined;
                }
            }

            if (ServiceNPCSpecifications.sServiceSpecifications != null)
            {
                foreach (ServiceType type in Enum.GetValues(typeof(ServiceType)))
                {
                    ServiceNPCSpecifications.ServiceSpecifications spec;
                    if (ServiceNPCSpecifications.sServiceSpecifications.TryGetValue(type.ToString(), out spec))
                    {
                        spec.InvalidWorlds.Clear();
                    }
                }
            }

            foreach (List <MotiveTuning> tempTuning in MotiveTuning.sTuning.Values)
            {
                foreach (MotiveTuning tuning in tempTuning)
                {
                    tuning.WorldRestrictionType = WorldRestrictionType.None;
                }
            }

            Bartending.BarData defaultData;
            if (Bartending.TryGetBarData(Lot.MetaAutonomyType.None, out defaultData))
            {
                sDefaultBarTuned = (defaultData.mFoods.Count > 0);
            }

            // Unlock all subTypes for all worlds
            foreach (Lot.CommercialSubTypeData commData in Lot.sCommnunityTypeData)
            {
                commData.WorldAllowed     = null;
                commData.WorldTypeAllowed = null;
            }

            // Unlock all subTypes for all worlds
            foreach (Lot.ResidentialSubTypeData residentData in Lot.sResidentialTypeData)
            {
                residentData.WorldAllowed     = null;
                residentData.WorldTypeAllowed = null;
            }

            foreach (ActionData action in ActionData.sData.Values)
            {
                if (action.mAllowedWorldTypes != null)
                {
                    List <WorldType> types = new List <WorldType>(action.mAllowedWorldTypes);

                    if (types.Count > 0)
                    {
                        if ((!types.Contains(WorldType.Vacation)))
                        {
                            types.Add(WorldType.Vacation);
                        }

                        if ((!types.Contains(WorldType.Future)))
                        {
                            types.Add(WorldType.Future);
                        }

                        action.mAllowedWorldTypes = types.ToArray();
                    }
                }
            }

            STCData.SetNumSocialsDuringConversation(int.MaxValue);

            foreach (InsectData insect in InsectData.sData.Values)
            {
                if (insect.RequiredWorld != WorldName.Undefined)
                {
                    insect.mRequiredWorld = WorldName.Undefined;

                    BooterLogger.AddTrace("  Unlocked: " + insect.Name);
                }
            }

            foreach (RockGemMetalData rock in RockGemMetalBase.sData.Values)
            {
                if (rock.RequiredWorld != WorldName.Undefined)
                {
                    rock.mRequiredWorld = WorldName.Undefined;

                    BooterLogger.AddTrace("  Unlocked: " + rock.Name);
                }
            }

            List <KeyValuePair <WorldName, WorldNameData> > data = new List <KeyValuePair <WorldName, WorldNameData> >();

            if (GameUtils.IsInstalled(ProductVersion.EP1))
            {
                data.Add(new KeyValuePair <WorldName, WorldNameData>(WorldName.China, new WorldNameData("China.world", "China_0x0859db4c", TravelUtil.DestinationInfoImage[0], TravelUtil.DestinationInfoName[0], TravelUtil.DestinationInfoDescription[0], UIManager.LoadUIImage(ResourceKey.CreatePNGKey(TravelUtil.DestinationInfoConfirmImage[0], 0x0)), TravelUtil.DestinationInfoComfirmDescription[0])));
                data.Add(new KeyValuePair <WorldName, WorldNameData>(WorldName.Egypt, new WorldNameData("Egypt.world", "Egypt_0x0859db48", TravelUtil.DestinationInfoImage[1], TravelUtil.DestinationInfoName[1], TravelUtil.DestinationInfoDescription[1], UIManager.LoadUIImage(ResourceKey.CreatePNGKey(TravelUtil.DestinationInfoConfirmImage[1], 0x0)), TravelUtil.DestinationInfoComfirmDescription[1])));
                data.Add(new KeyValuePair <WorldName, WorldNameData>(WorldName.France, new WorldNameData("France.world", "France_0x0859db50", TravelUtil.DestinationInfoImage[2], TravelUtil.DestinationInfoName[2], TravelUtil.DestinationInfoDescription[2], UIManager.LoadUIImage(ResourceKey.CreatePNGKey(TravelUtil.DestinationInfoConfirmImage[2], 0x0)), TravelUtil.DestinationInfoComfirmDescription[2])));
            }

            List <WorldFileMetadata> worlds = new List <WorldFileMetadata>();

            WorldFileSearch search = new WorldFileSearch(0x0);

            foreach (string str in search)
            {
                WorldFileMetadata info = new WorldFileMetadata();

                info.mWorldFile = str;
                if (GetWorldFileDetails(ref info))
                {
                    worlds.Add(info);
                }
            }

            worlds.Sort(OnSort);

            foreach (WorldFileMetadata info in worlds)
            {
                string name = info.mWorldFile.Replace(".world", "");

                WorldName worldName = WorldName.Undefined;

                try
                {
                    worldName = unchecked ((WorldName)ResourceUtils.HashString32(name.Replace(" ", "")));
                }
                catch
                {
                    continue;
                }

                string saveFile = name;
                switch (name.ToLower())
                {
                case "islaparadiso":
                    if (!GameUtils.IsInstalled(ProductVersion.EP10))
                    {
                        continue;
                    }

                    worldName = WorldName.IslaParadiso;

                    saveFile += "_0x0c50c382";
                    break;

                case "sims university":
                    if (!GameUtils.IsInstalled(ProductVersion.EP9))
                    {
                        continue;
                    }

                    worldName = WorldName.University;

                    saveFile += "_0x0e41c954";
                    break;

                case "bridgeport":
                    if (!GameUtils.IsInstalled(ProductVersion.EP3))
                    {
                        continue;
                    }

                    worldName = WorldName.NewDowntownWorld;

                    saveFile += "_0x09ffe3d7";
                    break;

                case "twinbrook":
                    if (!GameUtils.IsInstalled(ProductVersion.EP2))
                    {
                        continue;
                    }

                    worldName = WorldName.TwinBrook;

                    saveFile += "_0x09b610fa";
                    break;

                case "appaloosaplains":
                    if (!GameUtils.IsInstalled(ProductVersion.EP5))
                    {
                        continue;
                    }

                    worldName = WorldName.AppaloosaPlains;

                    saveFile += "_0x0c50c56d";
                    break;

                case "riverview":
                    worldName = WorldName.RiverView;

                    saveFile += "_0x0859db43";
                    break;

                case "sunset valley":
                    worldName = WorldName.SunsetValley;

                    saveFile += "_0x0859db3c";
                    break;

                case "moonlight falls":
                    worldName = WorldName.MoonlightFalls;

                    saveFile += "_0x09b61110";
                    break;

                case "starlight shores":
                    if (!GameUtils.IsInstalled(ProductVersion.EP6))
                    {
                        continue;
                    }

                    worldName = WorldName.StarlightShores;

                    saveFile += "_0x09b610ff";
                    break;

                case "hidden springs":
                case "barnacle bay":
                case "lunar lakes":
                case "lucky palms":
                    saveFile += "_0x08866eb8";
                    break;

                case "roaring heights":
                    worldName = WorldName.DOT11;

                    saveFile += "_0x0de07e86";
                    break;

                case "midnight hollow":
                    worldName = WorldName.DOT10;

                    saveFile += "_0x0de07e7d";
                    break;

                case "dragon valley":
                    worldName = WorldName.DOT09;

                    saveFile += "_0x0de07c9c";
                    break;

                case "aurora skies":
                    worldName = WorldName.DOT08;

                    saveFile += "_0x0de07c8b";
                    break;

                case "monte vista":
                    worldName = WorldName.DOT07;

                    saveFile += "_0x0de07c83";
                    break;

                case "sunlit tides":
                    worldName = WorldName.DOT06;

                    saveFile += "_0x0de07c78";
                    break;

                case "oasis landing":
                    worldName = WorldName.FutureWorld;

                    saveFile += "_0x0f36012a";
                    break;

                case "egypt":
                case "china":
                case "france":
                    continue;

                default:
                    saveFile = FileNameBooter.GetFileName(saveFile);
                    break;
                }

                string infoIcon = "glb_i_suburb";
                switch (info.mWorldType)
                {
                case WorldType.Downtown:
                    infoIcon = "glb_i_downtown";
                    break;

                case WorldType.Vacation:
                    infoIcon = "glb_i_vacation";
                    break;

                default:
                    break;
                }

                if (!VisaManager.sDictionary.ContainsKey((ulong)worldName))
                {
                    Visa defaultVisa = new Visa();
                    defaultVisa.mWorldName          = worldName;
                    defaultVisa.mNonPersistableData = new NonPersistableVisaData();
                    defaultVisa.NonPersistableData.LevelUpStrings = new string[3] {
                        "", "", ""
                    };
                    defaultVisa.NonPersistableData.PointsForNextLevel = new int[3] {
                        0, 0, 0
                    };

                    Visa chinaVisa = VisaManager.GetStaticVisaData(WorldName.China);
                    if (chinaVisa != null)
                    {
                        defaultVisa.NonPersistableData.LevelUpStrings     = new List <string>(chinaVisa.NonPersistableData.LevelUpStrings).ToArray();
                        defaultVisa.NonPersistableData.PointsForNextLevel = new List <int>(chinaVisa.NonPersistableData.PointsForNextLevel).ToArray();
                    }

                    VisaManager.sDictionary.Add((ulong)worldName, defaultVisa);

                    data.Add(new KeyValuePair <WorldName, WorldNameData>(worldName, new WorldNameData(info.mWorldFile, saveFile, infoIcon, info.mCaption, info.mDescription, info.mWorldThumb, Common.Localize("Itinerary:Name", false, new object[] { info.mCaption }))));
                }
            }

            TravelUtil.kVacationWorldNames = new WorldName[data.Count];

            TravelUtil.DestinationInfoImage              = new string[data.Count];
            TravelUtil.DestinationInfoName               = new string[data.Count];
            TravelUtil.DestinationInfoDescription        = new string[data.Count];
            TravelUtil.DestinationInfoConfirmImage       = new string[data.Count];
            TravelUtil.DestinationInfoComfirmDescription = new string[data.Count];

            TravelUtil.DestinationInfoIndex = new int[data.Count];

            int index = 0;

            foreach (KeyValuePair <WorldName, WorldNameData> value in data)
            {
                TravelUtil.kVacationWorldNames[index] = value.Key;

                TravelUtil.DestinationInfoIndex[index] = index;

                TravelUtil.DestinationInfoImage[index]              = value.Value.mDestinationInfoImage;
                TravelUtil.DestinationInfoName[index]               = value.Value.mDestinationInfoName;
                TravelUtil.DestinationInfoDescription[index]        = value.Value.mDestinationInfoDescription;
                TravelUtil.DestinationInfoConfirmImage[index]       = "";
                TravelUtil.DestinationInfoComfirmDescription[index] = value.Value.mDestinationInfoConfirmDescription;

                sConfirmImages.Add(value.Value.mDestinationInfoConfirmImage);

                BooterLogger.AddTrace(value.Value.ToString());
                BooterLogger.AddTrace("  WorldName: " + (ulong)value.Key);

                index++;

                sData.Add(value.Key, value.Value);
            }

            //BooterLogger.AddError("WorldData");

            sOrigWorldNameToType = GameUtils.WorldNameToType;

            foreach (InteractionTuning tuning in InteractionTuning.sAllTunings.Values)
            {
                switch (tuning.Availability.WorldRestrictionType)
                {
                case WorldRestrictionType.Allow:
                    if (!tuning.Availability.WorldRestrictionWorldTypes.Contains(WorldType.Vacation))
                    {
                        tuning.Availability.WorldRestrictionWorldTypes.Add(WorldType.Vacation);

                        BooterLogger.AddTrace("Tuning Altered: Allowed (A) " + tuning.FullInteractionName + " : " + tuning.FullObjectName);
                    }
                    else if (!tuning.Availability.WorldRestrictionWorldTypes.Contains(WorldType.Downtown))
                    {
                        tuning.Availability.WorldRestrictionWorldTypes.Add(WorldType.Downtown);

                        BooterLogger.AddTrace("Tuning Altered: Allowed (C) " + tuning.FullInteractionName + " : " + tuning.FullObjectName);
                    }

                    break;

                case WorldRestrictionType.Disallow:
                    if ((tuning.Availability.WorldRestrictionWorldTypes.Contains(WorldType.Vacation)) ||
                        (tuning.Availability.WorldRestrictionWorldTypes.Contains(WorldType.Downtown)) ||
                        (tuning.Availability.WorldRestrictionWorldTypes.Contains(WorldType.University)) ||
                        (tuning.Availability.WorldRestrictionWorldTypes.Contains(WorldType.Future)))
                    {
                        tuning.Availability.WorldRestrictionWorldTypes.Remove(WorldType.Vacation);
                        tuning.Availability.WorldRestrictionWorldTypes.Remove(WorldType.Downtown);
                        tuning.Availability.WorldRestrictionWorldTypes.Remove(WorldType.University);
                        tuning.Availability.WorldRestrictionWorldTypes.Remove(WorldType.Future);

                        BooterLogger.AddTrace("Tuning Altered: Allowed (B) " + tuning.FullInteractionName + " : " + tuning.FullObjectName);
                    }

                    break;
                }
            }
        }
예제 #19
0
 public override string GetInteractionName(Sim actor, BarProfessional target, InteractionObjectPair iop)
 {
     return("Tru Blood (§" + Bartending.GetCostForDrink(DrinkDescription, target.LotCurrent.GetMetaAutonomyType) + ")");
 }
예제 #20
0
            public void Restore(SimDescription sim)
            {
                try
                {
                    sim.mGenderPreferenceMale   = mMalePreference;
                    sim.mGenderPreferenceFemale = mFemalePreference;

                    if (sim.Pregnancy != null)
                    {
                        sim.Pregnancy.mGender = mPregnantGender;
                    }

                    if (sim.CreatedSim != null)
                    {
                        if (mPreviousOutfitCategory != OutfitCategories.None)
                        {
                            SimOutfit outfit = sim.GetOutfit(mPreviousOutfitCategory, mPreviousOutfitIndex);
                            if (outfit != null)
                            {
                                sim.CreatedSim.mPreviousOutfitKey = outfit.Key;
                            }
                        }

                        if (sim.CreatedSim.DreamsAndPromisesManager != null)
                        {
                            ActiveDreamNode node = sim.CreatedSim.DreamsAndPromisesManager.LifetimeWishNode;
                            if (node != null)
                            {
                                node.InternalCount = mLifetimeWishTally;
                            }
                        }
                    }

                    foreach (TraitNames trait in mTraits)
                    {
                        if (sim.TraitManager.HasElement(trait))
                        {
                            continue;
                        }

                        sim.TraitManager.AddElement(trait);
                    }

                    SocialNetworkingSkill networkSkill = sim.SkillManager.GetSkill <SocialNetworkingSkill>(SkillNames.SocialNetworking);
                    if (networkSkill != null)
                    {
                        networkSkill.mNumberOfFollowers = mNumberOfFollowers;
                        networkSkill.mBlogsCreated      = mBlogsCreated;
                    }

                    RockBand bandSkill = sim.SkillManager.GetSkill <RockBand>(SkillNames.RockBand);
                    if (bandSkill != null)
                    {
                        bandSkill.mBandInfo = mBandInfo;
                    }

                    Collecting collecting = sim.SkillManager.GetSkill <Collecting>(SkillNames.Collecting);
                    if (collecting != null)
                    {
                        collecting.mGlowBugData        = mGlowBugData;
                        collecting.mMushroomsCollected = mMushroomsCollected;
                    }

                    NectarSkill nectar = sim.SkillManager.GetSkill <NectarSkill>(SkillNames.Nectar);
                    if (nectar != null)
                    {
                        nectar.mHashesMade = mNectarHashesMade;
                    }

                    Photography photography = sim.SkillManager.GetSkill <Photography>(SkillNames.Photography);
                    if (photography != null)
                    {
                        // Forces a recalculation of the completion count
                        // photography.mCollectionsCompleted = uint.MaxValue;
                        photography.mCollectionsCompleted = mCollectionsCompleted;

                        if (mSubjectRecords != null)
                        {
                            photography.mSubjectRecords = mSubjectRecords;
                        }

                        if (mStyleRecords != null)
                        {
                            photography.mStyleRecords = mStyleRecords;
                        }

                        if (mSizeRecords != null)
                        {
                            photography.mSizeRecords = mSizeRecords;
                        }
                    }

                    RidingSkill riding = sim.SkillManager.GetSkill <RidingSkill>(SkillNames.Riding);
                    if (riding != null)
                    {
                        if (mCrossCountryCompetitionsWon != null)
                        {
                            riding.mCrossCountryCompetitionsWon = mCrossCountryCompetitionsWon.ToArray();
                        }

                        if (mJumpCompetitionsWon != null)
                        {
                            riding.mJumpCompetitionsWon = mJumpCompetitionsWon.ToArray();
                        }
                    }

                    Bartending mixology = sim.SkillManager.GetSkill <Bartending>(SkillNames.Bartending);
                    if (mixology != null)
                    {
                        if (mCustomDrinks != null)
                        {
                            mixology.mUniqueDrinks = mCustomDrinks;
                        }
                    }

                    if (mOccult != null)
                    {
                        foreach (OccultBaseClass occult in mOccult)
                        {
                            if (OccultTypeHelper.Add(sim, occult.ClassOccultType, false, false))
                            {
                                OccultTransfer transfer = OccultTransfer.Get(occult.ClassOccultType);
                                if (transfer != null)
                                {
                                    transfer.Perform(sim, occult);
                                }
                            }
                        }
                    }

                    mOccult = null;

                    if (mOutfitCache != null)
                    {
                        foreach (SavedOutfit.Cache.Key outfit in mOutfitCache.Outfits)
                        {
                            using (CASParts.OutfitBuilder builder = new CASParts.OutfitBuilder(sim, outfit.mKey, false))
                            {
                                builder.Builder.SkinTone      = mSkinToneKey;
                                builder.Builder.SkinToneIndex = mSkinToneIndex;

                                outfit.Apply(builder, true, null, null);
                            }
                        }

                        foreach (SavedOutfit.Cache.Key outfit in mOutfitCache.AltOutfits)
                        {
                            using (CASParts.OutfitBuilder builder = new CASParts.OutfitBuilder(sim, outfit.mKey, true))
                            {
                                builder.Builder.SkinTone      = mSkinToneKey;
                                builder.Builder.SkinToneIndex = mSkinToneIndex;

                                outfit.Apply(builder, true, null, null);
                            }
                        }

                        int count         = 0;
                        int originalCount = mOutfitCache.GetOutfitCount(OutfitCategories.Everyday, false);

                        while ((originalCount > 0) && (originalCount < sim.GetOutfitCount(OutfitCategories.Everyday)) && (count < originalCount))
                        {
                            CASParts.RemoveOutfit(sim, new CASParts.Key(OutfitCategories.Everyday, sim.GetOutfitCount(OutfitCategories.Everyday) - 1), false);
                            count++;
                        }
                    }
                }
                catch (Exception e)
                {
                    Common.Exception(sim, e);
                }
            }
예제 #21
0
            public CrossWorldData(SimDescription sim)
            {
                mName = sim.FullName;

                mOutfitCache = new SavedOutfit.Cache(sim);

                SimOutfit outfit = sim.GetOutfit(OutfitCategories.Everyday, 0);

                if (outfit != null)
                {
                    mSkinToneKey   = outfit.SkinToneKey;
                    mSkinToneIndex = outfit.SkinToneIndex;
                }
                else
                {
                    mSkinToneKey   = sim.SkinToneKey;
                    mSkinToneIndex = sim.SkinToneIndex;
                }

                mMalePreference   = sim.mGenderPreferenceMale;
                mFemalePreference = sim.mGenderPreferenceFemale;

                if (sim.CreatedSim != null)
                {
                    if (sim.CreatedSim.mPreviousOutfitKey != null)
                    {
                        try
                        {
                            mPreviousOutfitCategory = sim.GetOutfitCategoryFromResKey(sim.CreatedSim.mPreviousOutfitKey, out mPreviousOutfitIndex);
                        }
                        catch
                        { }
                    }

                    if (sim.CreatedSim.DreamsAndPromisesManager != null)
                    {
                        ActiveDreamNode node = sim.CreatedSim.DreamsAndPromisesManager.LifetimeWishNode;
                        if (node != null)
                        {
                            mLifetimeWishTally = node.InternalCount;
                        }
                    }
                }

                if (sim.Pregnancy != null)
                {
                    mPregnantGender = sim.Pregnancy.mGender;
                }

                foreach (Trait trait in sim.TraitManager.List)
                {
                    if (trait.IsReward)
                    {
                        continue;
                    }

                    mTraits.Add(trait.Guid);
                }

                SocialNetworkingSkill networkSkill = sim.SkillManager.GetSkill <SocialNetworkingSkill>(SkillNames.SocialNetworking);

                if (networkSkill != null)
                {
                    // This value is set to mNumberOfBlogFollowers for some reason
                    mNumberOfFollowers = networkSkill.mNumberOfFollowers;

                    // Not transitioned at all
                    mBlogsCreated = networkSkill.mBlogsCreated;
                }

                RockBand bandSkill = sim.SkillManager.GetSkill <RockBand>(SkillNames.RockBand);

                if (bandSkill != null)
                {
                    mBandInfo = bandSkill.mBandInfo;
                }

                Collecting collecting = sim.SkillManager.GetSkill <Collecting>(SkillNames.Collecting);

                if (collecting != null)
                {
                    // Error in CollectingPropertyStreamWriter:Export() requires that mGlowBugData by transfered manually
                    //   Exported as two Int64, but Imported as a Int64 and Int32
                    mGlowBugData = collecting.mGlowBugData;

                    mMushroomsCollected = collecting.mMushroomsCollected;
                }

                NectarSkill nectar = sim.SkillManager.GetSkill <NectarSkill>(SkillNames.Nectar);

                if (nectar != null)
                {
                    mNectarHashesMade = nectar.mHashesMade;
                }

                Photography photography = sim.SkillManager.GetSkill <Photography>(SkillNames.Photography);

                if (photography != null)
                {
                    mCollectionsCompleted = photography.mCollectionsCompleted;
                    mSubjectRecords       = photography.mSubjectRecords;
                    mStyleRecords         = photography.mStyleRecords;
                    mSizeRecords          = photography.mSizeRecords;
                }

                RidingSkill riding = sim.SkillManager.GetSkill <RidingSkill>(SkillNames.Riding);

                if (riding != null)
                {
                    // Error in the Import (Copy/Paste fail by the looks of it), where the CrossCountry Wins are imported instead
                    mCrossCountryCompetitionsWon = new List <uint>(riding.mCrossCountryCompetitionsWon);
                    mJumpCompetitionsWon         = new List <uint>(riding.mJumpCompetitionsWon);
                }

                // EA hosed the color, glass and drink picks
                Bartending mixology = sim.SkillManager.GetSkill <Bartending>(SkillNames.Bartending);

                if (mixology != null)
                {
                    mCustomDrinks = mixology.mUniqueDrinks;
                }

                if ((sim.OccultManager != null) && (sim.OccultManager.mOccultList != null))
                {
                    mOccult = new List <OccultBaseClass>(sim.OccultManager.mOccultList);
                }
            }
예제 #22
0
        protected static bool IsValidLot(Lot lot, FoodTruckBase truck)
        {
            if (lot == null)
            {
                return(false);
            }

            FoodTruckBase existing = TruckController.GetTruck(lot);

            if (existing != null)
            {
                if (existing != truck)
                {
                    return(false);
                }
            }

            if (lot.StreetParking == null)
            {
                return(false);
            }

            if (lot.IsWorldLot)
            {
                return(false);
            }

            if (Traffic.Settings.mRequireFoodParkingSpace)
            {
                List <FoodTruckBase> trucks = new List <FoodTruckBase>(lot.GetObjects <FoodTruckBase>());
                trucks.Remove(truck);

                if ((lot.CountObjects <WideParkingSpace>() == 0x0) || (trucks.Count > 0x0))
                {
                    return(false);
                }
            }

            if (lot.IsCommunityLot)
            {
                float openHour    = 0f;
                float closingHour = 0f;
                if ((Bartending.TryGetHoursOfOperation(lot, ref openHour, ref closingHour)) && (!SimClock.IsTimeBetweenTimes(SimClock.HoursPassedOfDay, openHour, closingHour)))
                {
                    return(false);
                }
            }
            else
            {
                if (lot.Household == null)
                {
                    return(false);
                }

                if (!Traffic.Settings.mAllowFoodTruckResidential)
                {
                    return(false);
                }

                if (lot.Household.IsActive)
                {
                    if (!Traffic.Settings.mAllowFoodTruckActiveLot)
                    {
                        return(false);
                    }
                }
            }

            return(true);
        }
예제 #23
0
        protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            bool isActiveLot = false;

            if (Sim.ActiveActor != null)
            {
                isActiveLot = Lot.CanSimTreatAsHome(Sim.ActiveActor);

                if ((!isActiveLot) && (Household.ActiveHousehold.RealEstateManager != null))
                {
                    PropertyData data = Household.ActiveHousehold.RealEstateManager.FindProperty(Lot);
                    if ((data != null) && (data.PropertyType == RealEstatePropertyType.Resort))
                    {
                        isActiveLot = true;
                    }
                }
            }

            if (GetValue <CleanOption, bool>())
            {
                if ((!isActiveLot) && (!Lot.IsActive) && (!Occupation.DoesLotHaveAnyActiveJobs(Lot)))
                {
                    bool cleaner = false;
                    if ((Lot.Household != null) && (!Lot.IsBaseCampLotType))
                    {
                        bool child = false;

                        foreach (SimDescription sim in HouseholdsEx.All(Lot.Household))
                        {
                            if (AddScoring("Neat", sim) > 0)
                            {
                                cleaner = true;
                            }

                            if (sim.ToddlerOrBelow)
                            {
                                child = true;
                            }
                        }

                        if ((!child) && (Babysitter.Instance != null))
                        {
                            Babysitter.Instance.MakeServiceRequest(Lot, false, ObjectGuid.InvalidObjectGuid);
                        }
                    }
                    else
                    {
                        cleaner = true;

                        // Disable all services applied to this lot
                        Service[] serviceArray = new Service[] { Babysitter.Instance, Maid.Instance, PizzaDelivery.Instance, Repairman.Instance, SocialWorkerAdoption.Instance, Police.Instance };
                        foreach (Service service in serviceArray)
                        {
                            if (service == null)
                            {
                                continue;
                            }

                            service.MakeServiceRequest(Lot, false, ObjectGuid.InvalidObjectGuid);
                        }
                    }

                    foreach (GameObject obj in Lot.GetObjects <GameObject>())
                    {
                        if (obj.LotCurrent == null)
                        {
                            IncStat("Bogus Location " + obj.CatalogName + " (" + Lot.Name + ", " + Lot.Address + ")", Common.DebugLevel.High);
                            continue;
                        }

                        if (obj is IVelvetRopes)
                        {
                            if (!Bartending.IsBarVenue(Lot))
                            {
                                (obj as IVelvetRopes).NightlyCleanUp();
                            }
                        }

                        try
                        {
                            if (!Lot.DoesObjectNeedCleaning(obj))
                            {
                                continue;
                            }
                        }
                        catch (Exception e)
                        {
                            Common.Exception(obj, e);
                            continue;
                        }

                        if (cleaner)
                        {
                            if (obj.IsCleanable)
                            {
                                obj.Cleanable.ForceClean();
                            }

                            IThrowAwayable awayable = obj as IThrowAwayable;
                            if (awayable != null)
                            {
                                awayable.ThrowAwayImmediately();
                            }

                            Book book = obj as Book;
                            if ((book != null) && (!(book.Data is BookToddlerData)))
                            {
                                if (!book.InInventory)
                                {
                                    if (!Lots.PutAwayBook(this, book, Lot))
                                    {
                                        if (!Lot.IsResidentialLot)
                                        {
                                            book.FadeOut(false, true);
                                        }
                                    }
                                }
                            }
                        }

                        if ((obj is IDestroyOnMagicalCleanup) && ((!Lot.IsResidentialLot) || (!sExpandedInstalled)))
                        {
                            obj.FadeOut(false, true);
                        }
                    }

                    if (!Lot.IsResidentialLot)
                    {
                        Lot.FireManager.RestoreObjects();
                    }

                    LotLocation[] puddles = World.GetPuddles(Lot.LotCurrent.LotId, LotLocation.Invalid);
                    if (puddles.Length > 0)
                    {
                        foreach (LotLocation location in puddles)
                        {
                            PuddleManager.RemovePuddle(Lot.LotCurrent.LotId, location);
                        }
                    }

                    LotLocation[] burntTiles = World.GetBurntTiles(Lot.LotCurrent.LotId, LotLocation.Invalid);
                    if (burntTiles.Length > 0)
                    {
                        foreach (LotLocation location2 in burntTiles)
                        {
                            World.SetBurnt(Lot.LotId, location2, false);
                        }
                    }

                    foreach (ICatPrey prey in Sims3.Gameplay.Queries.GetObjects <ICatPrey>(Lot))
                    {
                        if (prey.IsUnconscious)
                        {
                            prey.Destroy();
                        }
                    }

                    if (!Lot.IsResidentialLot)
                    {
                        Lot.RepairAllObjects();
                    }
                }
            }

            if (GetValue <SeasonOption, bool>())
            {
                if ((!isActiveLot) || (Lot.IsBaseCampLotType) || (Lot.HasVirtualResidentialSlots))
                {
                    SeasonalLotMarker[] objects = Lot.GetObjects <SeasonalLotMarker>();
                    if ((objects.Length > 0x0) && objects[0x0].IsKickNeeded())
                    {
                        TimeUnit units = TimeUnit.Minutes;

                        if (Lot.IsCommunityLot)
                        {
                            foreach (Sim sim in Lot.GetAllActors())
                            {
                                Sim.MakeSimGoHome(sim, true, new InteractionPriority(InteractionPriorityLevel.High));

                                units = TimeUnit.Hours;
                            }
                        }
                        Lot.mGoHomeForSeasonChangeTimer = Lot.AlarmManager.AddAlarm(1f, units, Lot.ChangeSeason, "timer just to make it yieldable", AlarmType.DeleteOnReset, Lot);
                        Lot.AlarmManager.AlarmWillYield(Lot.mGoHomeForSeasonChangeTimer);
                    }
                }
                else
                {
                    Lot.MagicallyChangeSeason();
                }
            }

            return(true);
        }
예제 #24
0
파일: Busker.cs 프로젝트: yakoder/NRaas
        public static void OnPlayedInstrument(Event e)
        {
            Sim actor = e.Actor as Sim;

            if (actor == null)
            {
                return;
            }

            SkillNames instrumentSkill = SkillNames.None;

            switch (e.Id)
            {
            case EventTypeId.kPlayedDrums:
                instrumentSkill = SkillNames.Drums;
                break;

            case EventTypeId.kPlayedGuitar:
                instrumentSkill = SkillNames.Guitar;
                break;

            case EventTypeId.kPlayedBassGuitar:
                instrumentSkill = SkillNames.BassGuitar;
                break;

            case EventTypeId.kPlayedPiano:
                instrumentSkill = SkillNames.Piano;
                break;

            case EventTypeId.kPlayedLaserHarp:
                instrumentSkill = SkillNames.LaserHarp;
                break;
            }

            float opening = 0, closing = 0;

            if (!Bartending.TryGetHoursOfOperation(actor.LotCurrent, ref opening, ref closing))
            {
                return;
            }

            if (!SimClock.IsTimeBetweenTimes(opening, closing))
            {
                return;
            }

            IncrementalEvent iEvent = e as IncrementalEvent;

            float cash = GetPay(actor, instrumentSkill) * iEvent.mIncrement;

            if (cash == 0)
            {
                return;
            }

            foreach (SkillNames skill in MetricMusicSkill.Skills)
            {
                if (SkillBasedCareerBooter.GetSkillBasedCareer(actor, skill) == null)
                {
                    continue;
                }

                SkillBasedCareerBooter.UpdateExperience(actor, skill, (int)cash);
            }
        }