示例#1
0
        public static bool CanShareBed(Sim newSim, Sim simUsingBed, CommodityKind use, bool isTent)
        {
            try
            {
                if ((simUsingBed != null) && (simUsingBed != newSim))
                {
                    Relationship relationship = newSim.GetRelationship(simUsingBed, false);
                    if (relationship == null) return false;

                    if ((relationship.LTR == null) || (relationship.LTR.SimWasBetrayed(newSim)) || (relationship.LTR.SimWasBetrayed(simUsingBed)))
                    {
                        return false;
                    }

                    if (simUsingBed.InteractionQueue != null)
                    {
                        WooHoo runningInteraction = simUsingBed.InteractionQueue.RunningInteraction as WooHoo;
                        if ((runningInteraction != null) && (newSim != runningInteraction.Target))
                        {
                            return false;
                        }
                    }
                }

                return true;
            }
            catch (Exception e)
            {
                Common.Exception(newSim, e);
                return false;
            }
        }
示例#2
0
        public static string GetMotiveLocalizedName(CommodityKind kind)
        {
            switch (kind)
            {
                case CommodityKind.Hunger:
                case CommodityKind.Energy:
                case CommodityKind.Hygiene:
                case CommodityKind.Fun:
                case CommodityKind.Social:
                case CommodityKind.Bladder:
                case CommodityKind.AlienBrainPower:
                    return Common.LocalizeEAString("Ui/Caption/HUD/MotivesPanel:Motive" + kind);
                case CommodityKind.DogDestruction:
                    return Common.LocalizeEAString("Ui/Caption/HUD/MotivesPanel:MotiveDestructionDog");
                case CommodityKind.CatScratch:
                    return Common.LocalizeEAString("Ui/Caption/HUD/MotivesPanel:MotiveScratchCat");
                case CommodityKind.HorseThirst:
                    return Common.Localize("Species:Horse") + " " + Common.LocalizeEAString("Ui/Caption/HUD/MotivesPanel:MotiveThirstHorse");
                case CommodityKind.HorseExercise:
                    return Common.LocalizeEAString("Ui/Caption/HUD/MotivesPanel:MotiveExerciseHorse");
                case CommodityKind.VampireThirst:
                    return OccultManager.GetSingularOccultName(OccultTypesAll.Vampire) + " " + Common.LocalizeEAString("Ui/Caption/HUD/MotivesPanel:MotiveHungerVampire");
            }

            string result;
            if (Common.Localize("Commodity:" + kind.ToString(), false, new object[0], out result))
            {
                return result;
            }
            else
            {
                return kind.ToString();
            }
        }
示例#3
0
 protected void ForceSetMax (Motives ths, CommodityKind commodity)
 {
     Motive motive = ths.GetMotive(commodity);
     if ((motive != null) && (motive.Value != motive.Tuning.Max))
     {
         motive.UpdateMotiveBuffs(ths.mSim, commodity, (int) motive.Tuning.Max);
         motive.mValue = motive.Tuning.Max;
     }
 }
示例#4
0
文件: Mood.cs 项目: Robobeurre/NRaas
            public MotiveValue(CommodityKind name, Motive value)
            {
                if (!Common.Localize("CommodityKind:" + name, false, new object[0], out mName))
                {
                    mName = name.ToString();
                }

                if (value != null)
                {
                    mValue = (int)value.Value;
                    mExists = true;
                }
            }
示例#5
0
        public static bool CanShareBed(BedMultiPart bed, Sim newSim, CommodityKind use, out Sim incompatibleSim)
        {
            incompatibleSim = null;

            try
            {
                foreach (BedData data in bed.PartComp.PartDataList.Values)
                {
                    if (!BedController.CanShareBed(newSim, data.ContainedSim, use, bed.IsTent))
                    {
                        incompatibleSim = data.ContainedSim;
                        return false;
                    }
                }
                return true;
            }
            catch (Exception e)
            {
                Common.Exception(bed, e);
                return false;
            }
       }
示例#6
0
 public MotiveKey(SimDescription sim, CommodityKind kind)
     : this(sim.Age | sim.Species, FirstOccult(sim), kind)
 { }
示例#7
0
 public static void setMaxMotive(Sim actor, CommodityKind type)
 {
     actor.Motives.SetMax(type);
 }
示例#8
0
 public MotiveKey(CommodityKind kind)
     : this(CASAgeGenderFlags.None, OccultTypes.None, kind)
 { }
示例#9
0
 public bool GetAdvertised(CommodityKind kind, out float result)
 {
     return mAdvertisedOutputs.TryGetValue(kind, out result);
 }
示例#10
0
 public void SetAdvertised(CommodityKind kind, float value)
 {
     mAdvertisedOutputs[kind] = value;
 }
示例#11
0
 public override bool CanShareBed(Sim newSim, CommodityKind use, out Sim incompatibleSim)
 {
     return BedController.CanShareBed(this, newSim, use, out incompatibleSim);
 }
示例#12
0
 public override float Satisfaction(CommodityKind condition, IGameObject target)
 {
     return(0);
 }
示例#13
0
 public override float GetPostureMotiveDecayUpdate(float currentValue, CommodityKind commodity, float hoursPassed)
 {
     r_internal(_Actor);
     return(base.GetPostureMotiveDecayUpdate(currentValue, commodity, hoursPassed));
 }
        //搜索所有一般商品
        public List<Commodity> SearchNoPaymentCommodity(String quryString, CommodityKind kind)
        {
            //string SKind = kind.ToString();

            if (quryString == null)
            {
                quryString = "%";
            }
            else
            {}
            List<Commodity> commodityList = new List<Commodity>();
            ISingleResult<searchNoPaymentCommodityResult> result = dc.searchNoPaymentCommodity(quryString, (int)kind);
            foreach (searchNoPaymentCommodityResult singleCommodity in result)
            {
                Commodity commodity = new Commodity();
                commodity.description = singleCommodity.discription;
                commodity.EndTime = singleCommodity.endtime.Value;
                commodity.ID = singleCommodity.id;
                commodity.ImageUrl = singleCommodity.picturepath;
                commodity.kind = (CommodityKind)(singleCommodity.kind.Value);

                commodity.Name = singleCommodity.name;
                commodity.popularity = (int)singleCommodity.popularity;
                commodity.Price = singleCommodity.price.Value;
                commodity.StartTime = singleCommodity.starttime.Value ;
                ///////
                //得到taglist
                List<Tag> TagList = new List<Tag>();
                try
                {
                    ISingleResult<getTagByCommodityResult> TagResult = dc.getTagByCommodity(singleCommodity.id);

                    foreach (getTagByCommodityResult Newtag in TagResult)
                    {
                        Tag tag = new Tag();
                        tag.name = Newtag.id;
                        tag.popularity = Newtag.popularity.Value;
                        TagList.Add(tag);
                    }
                    commodity.tagList = TagList;
                }
                catch (Exception e)
                {
                    commodity = null;
                }

                ////////
                commodity.UserName = singleCommodity.userfrom;
                commodityList.Add(commodity);
            }
            return commodityList;
        }
示例#15
0
 /// ----------------------------------------- ///
 public override float Satisfaction(CommodityKind condition, IGameObject target)
 {
     r_internal(_Actor);
     return(0);
 }
示例#16
0
 public override bool CanShareBed(Sim newSim, CommodityKind use, out Sim incompatibleSim)
 {
     return(BedController.CanShareBed(this, newSim, use, out incompatibleSim));
 }
        static void OnPreload()
        {
            try
            {
                ObjectLoader.GetAllXMLSettingsForSewables();
                XmlDbData data = XmlDbData.ReadData(new ResourceKey(ResourceUtils.HashString64("tutorialSewingTable"), 0x0333406C, 0x0), false);
                ParseLessons(data);
            }
            catch (Exception ex2)
            {
                //print("There was a problem, couldn't get the sewables settings (if the error is talking about an already existed key, then this does mean that you have the patterns! It just says that the sewing table has already parsed all the patterns already. So feel free to continue playing!)  \n \n" + ex2.Message.ToString());
                return;
            }
            try
            {
                bool bStore = true;
                if (HasBeenLoaded)
                {
                    return;                // you only want to run it once per gameplay session
                }
                HasBeenLoaded = true;

                // fill this in with the resourcekey of your SKIL xml
                XmlDbData data = XmlDbData.ReadData(new ResourceKey(ResourceUtils.HashString64("SewingSkill"), 0xA8D58BE5, 0x0), false);
                if (data == null)
                {
                    return;
                }
                if (data == null || data.Tables == null)
                {
                    return;
                }
                XmlDbTable xmlDbTable = null;
                data.Tables.TryGetValue("SkillList", out xmlDbTable);
                if (xmlDbTable == null)
                {
                    return;
                }
                foreach (XmlDbRow current in xmlDbTable.Rows)
                {
                    bool       flag    = false;
                    string     @string = current.GetString("Hex");
                    SkillNames guid    = (SkillNames)SkillManager.GetGuid(ref @string, bStore);
                    if (guid == SkillNames.None)
                    {
                        flag = true;
                    }
                    ProductVersion productVersion = ProductVersion.BaseGame;
                    double         skillVersion   = 0.0;
                    if (!flag)
                    {
                        Skill  skill   = null;
                        string string2 = current.GetString("CustomClassName");
                        bool   flag2   = string2.Length > 0;
                        if (flag2)
                        {
                            Type type = null;
                            if (bStore)
                            {
                                string[] array = string2.Split(new char[] {
                                    ','
                                });
                                if (array.Length < 2)
                                {
                                    flag = true;
                                }
                                else
                                {
                                    type = Type.GetType(array[0] + ",Sims3StoreObjects");
                                }
                            }
                            if (type == null)
                            {
                                type = Type.GetType(string2);
                            }
                            if (type == null)
                            {
                                flag = true;
                            }
                            else
                            {
                                object[] array2 = new object[] {
                                    guid
                                };
                                ConstructorInfo constructor = type.GetConstructor(Type.GetTypeArray(array2));
                                if (constructor == null)
                                {
                                    flag = true;
                                }
                                else
                                {
                                    skill = (constructor.Invoke(array2) as Skill);
                                    if (skill == null)
                                    {
                                        flag = true;
                                    }
                                }
                            }
                        }
                        else
                        {
                            skill = new Skill(guid);
                        }
                        if (!flag)
                        {
                            Skill.NonPersistableSkillData nonPersistableSkillData = new Skill.NonPersistableSkillData();
                            skill.NonPersistableData = nonPersistableSkillData;
                            uint num = ResourceUtils.ProductVersionToGroupId(productVersion);
                            nonPersistableSkillData.SkillProductVersion = productVersion;
                            nonPersistableSkillData.Name = "Gameplay/Excel/Skills/SkillList:" + current.GetString("SkillName");
                            string string3 = current.GetString("SkillDescription");
                            nonPersistableSkillData.Description   = (string.IsNullOrEmpty(string3) ? "" : ("Gameplay/Excel/Skills/SkillList:" + string3));
                            nonPersistableSkillData.MaxSkillLevel = current.GetInt("MaxSkillLevel", 0);
                            skill.Guid = guid;
                            nonPersistableSkillData.ThoughtBalloonTopicString = current.GetString("ThoughtBalloonTopic");
                            string string4 = current.GetString("IconKey");
                            nonPersistableSkillData.IconKey        = ResourceKey.CreatePNGKey(string4, num);
                            nonPersistableSkillData.SkillUIIconKey = ResourceKey.CreatePNGKey(current.GetString("SkillUIIcon"), num);
                            string        string5   = current.GetString("Commodity");
                            CommodityKind commodity = (CommodityKind)SkillManager.GetCommodity(string5, bStore);

                            nonPersistableSkillData.Commodity = commodity;
                            if (commodity != CommodityKind.None)
                            {
                                SkillManager.SkillCommodityMap[commodity] = guid;
                            }
                            if (bStore)
                            {
                                skillVersion = Convert.ToDouble(current.GetString("Version"));
                            }
                            nonPersistableSkillData.SkillVersion = skillVersion;
                            if (current.GetBool("Physical"))
                            {
                                skill.AddCategoryToSkill(SkillCategory.Physical);
                            }
                            if (current.GetBool("Mental"))
                            {
                                skill.AddCategoryToSkill(SkillCategory.Mental);
                            }
                            if (current.GetBool("Musical"))
                            {
                                skill.AddCategoryToSkill(SkillCategory.Musical);
                            }
                            if (current.GetBool("Creative"))
                            {
                                skill.AddCategoryToSkill(SkillCategory.Creative);
                            }
                            if (current.GetBool("Artistic"))
                            {
                                skill.AddCategoryToSkill(SkillCategory.Artistic);
                            }
                            if (current.GetBool("Hidden"))
                            {
                                skill.AddCategoryToSkill(SkillCategory.Hidden);
                            }
                            if (current.GetBool("Certificate"))
                            {
                                skill.AddCategoryToSkill(SkillCategory.Certificate);
                            }
                            if (current.Exists("HiddenWithSkillProgress") && current.GetBool("HiddenWithSkillProgress") && skill.HasCategory(SkillCategory.Hidden))
                            {
                                skill.AddCategoryToSkill(SkillCategory.HiddenWithSkillProgress);
                            }
                            if (current.GetBool("CanDecay"))
                            {
                                skill.AddCategoryToSkill(SkillCategory.CanDecay);
                            }
                            int[] array3 = new int[skill.MaxSkillLevel];
                            int   num2   = 0;
                            for (int i = 1; i <= skill.MaxSkillLevel; i++)
                            {
                                string column = "Level_" + i.ToString();
                                num2         += current.GetInt(column, 0);
                                array3[i - 1] = num2;
                            }
                            nonPersistableSkillData.PointsForNextLevel      = array3;
                            nonPersistableSkillData.AlwaysDisplayLevelUpTns = current.GetBool("AlwaysDisplayTNS");
                            string[] array4 = new string[skill.MaxSkillLevel + 1];
                            for (int j = 2; j <= skill.MaxSkillLevel; j++)
                            {
                                string column2 = "Level_" + j.ToString() + "_Text";
                                array4[j - 1] = current.GetString(column2);
                                if (array4[j - 1] != string.Empty)
                                {
                                    array4[j - 1] = "Gameplay/Excel/Skills/SkillList:" + array4[j - 1];
                                }
                            }
                            array4[skill.MaxSkillLevel] = current.GetString("Level_10_Text_Alternate");
                            if (array4[skill.MaxSkillLevel] != string.Empty)
                            {
                                array4[skill.MaxSkillLevel] = "Gameplay/Excel/Skills/SkillList:" + array4[skill.MaxSkillLevel];
                            }
                            nonPersistableSkillData.LevelUpStrings = array4;
                            if (flag2)
                            {
                                XmlDbTable xmlDbTable2 = null;
                                string     string6     = current.GetString("CustomDataSheet");
                                data.Tables.TryGetValue(string6, out xmlDbTable2);
                                if (xmlDbTable2 == null && string6.Length > 0)
                                {
                                    flag  = true;
                                    skill = null;
                                }
                                else
                                {
                                    if (!skill.ParseSkillData(xmlDbTable2))
                                    {
                                        flag  = true;
                                        skill = null;
                                    }
                                }
                            }
                            nonPersistableSkillData.AvailableAgeSpecies      = ParserFunctions.ParseAllowableAgeSpecies(current, "AvailableAgeSpecies");
                            nonPersistableSkillData.DreamsAndPromisesIcon    = current.GetString("DreamsAndPromisesIcon");
                            nonPersistableSkillData.DreamsAndPromisesIconKey = ResourceKey.CreatePNGKey(nonPersistableSkillData.DreamsAndPromisesIcon, num);
                            nonPersistableSkillData.LogicSkillBoost          = current.GetBool("LogicSkillBoost");
                            if (!flag)
                            {
                                if (GenericManager <SkillNames, Skill, Skill> .sDictionary.ContainsKey((ulong)guid))
                                {
                                    if (GenericManager <SkillNames, Skill, Skill> .sDictionary[(ulong)guid].SkillVersion < skill.SkillVersion)
                                    {
                                        GenericManager <SkillNames, Skill, Skill> .sDictionary[(ulong)guid] = skill;
                                    }
                                }
                                else
                                {
                                    GenericManager <SkillNames, Skill, Skill> .sDictionary.Add((ulong)guid, skill);

                                    SkillManager.sSkillEnumValues.AddNewEnumValue(@string, guid);
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                print("In Preload - caught issue" + ex.ToString());
                return;
            }
        }
示例#18
0
        public static bool ProcessAllInteraction(Sim actorIsCurrentTask)
        {
            if (actorIsCurrentTask == null ||
                actorIsCurrentTask.ObjectId.mValue != ScriptCore.Simulator.Simulator_GetCurrentTaskImpl() ||
                !Simulator.CheckYieldingContext(false))
            {
                return(false);
            }

            bool okI = false;
            var  sim = actorIsCurrentTask;

            NFinalizeDeath.CheckYieldingContext();

            if (Simulator.GetProxy(sim.ObjectId) == null)
            {
                NFinalizeDeath.ThrowResetException(null);
            }

            var simIQ = sim.InteractionQueue;


            try
            {
                if (sim.SimDescription == null)
                {
                    sim.mSimDescription = Create.NiecNullSimDescription(true, false, true);
                }

                if (simIQ == null)
                {
                    sim.mInteractionQueue = simIQ = new Sims3.Gameplay.ActorSystems.InteractionQueue(sim);
                }
                else
                {
                    if (simIQ.mInteractionList == null)
                    {
                        simIQ.mInteractionList = new List <InteractionInstance>();
                    }
                    else
                    {
                        while (simIQ.mInteractionList != null && niec_std.list_remove(simIQ.mInteractionList, null))
                        {
                            Simulator.Sleep(0);
                        }
                    }
                }
            }
            catch (NMAntiSpyException)
            { NFinalizeDeath.SafeForceTerminateRuntime(); }
            catch (StackOverflowException)
            { sim.mPosture = null; throw; }
            catch (ResetException)
            { throw; }
            catch
            {
                NFinalizeDeath.CheckYieldingContext();

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

            try
            {
                simIQ.mCurrentTransitionInteraction = null;
                if (!NiecHelperSituation.__acorewIsnstalled__ && simIQ.mRunningInteractions.Count != 0)
                {
                    simIQ.OnReset();
                }

                ShouldBabyOrToddler(simIQ);

                var simIQList = simIQ.mInteractionList;
                if (simIQList == null || simIQList.Count == 0)
                {
                    return(false);
                }

                var simIQListArray = simIQList.ToArray();
                for (int i = 0; i < simIQListArray.Length; i++)
                {
                    InteractionInstance inCurrentInteraction = simIQListArray[i];
                    if (inCurrentInteraction == null || inCurrentInteraction.InteractionDefinition == null)
                    {
                        while (simIQList != null && niec_std.list_remove(simIQList, null))
                        {
                            Simulator.Sleep(0);
                            simIQList = simIQ.mInteractionList;
                        }

                        if (simIQList == null)
                        {
                            break;
                        }

                        continue;
                    }

                    if (simIQList.IndexOf(inCurrentInteraction) != 0)
                    {
                        break;
                    }

                    if (simIQList == null)
                    {
                        break;
                    }

                    if (sim.mPosture != null)
                    {
                        int  num  = 4;
                        bool flag = false;
                        int  num2 = 10;

                        sim.PlayRouteFailFrequency = Sim.RouteFailFrequency.PlayRouteFailNextTimeOnly;

                        List <InteractionObjectPair> list = new List <InteractionObjectPair>();

                        while (num > 0 && num2 > 0)
                        {
                            if (!inCurrentInteraction.Autonomous)
                            {
                                inCurrentInteraction.Target.ClearBlockTime();
                                if (sim.mPosture.Container != null)
                                {
                                    sim.mPosture.Container.ClearBlockTime();
                                }
                            }

                            sim.ClearExitReasons();

                            if (!inCurrentInteraction.Target.PreTransition(inCurrentInteraction))
                            {
                                inCurrentInteraction.PostureTransitionFailed(false);

                                sim.PlayRouteFailFrequency = Sim.RouteFailFrequency.AlwaysPlayRouteFail;
                                return(OnFailedInCurrentInteraction(simIQ, simIQList, sim, inCurrentInteraction));
                            }

                            InteractionInstance interactionInstance2 = null;
                            if (inCurrentInteraction.Target is IGlass && sim.SimDescription.IsBonehilda)
                            {
                                inCurrentInteraction.PosturePreconditions = null;
                            }

                            interactionInstance2 = ((inCurrentInteraction.PosturePreconditions != null || sim.Posture is IHaveCustomTransitionForNullPosturePreconditions) ? sim.Posture.GetTransition(inCurrentInteraction) : sim.Posture.GetStandingTransition());
                            if (interactionInstance2 == null)
                            {
                                num = 0;
                            }

                            else
                            {
                                if (num == 4 && (!inCurrentInteraction.Test() || (!inCurrentInteraction.IsTargetValid())))
                                {
                                    sim.PlayRouteFailFrequency = Sim.RouteFailFrequency.AlwaysPlayRouteFail;
                                    return(OnFailedInCurrentInteraction(simIQ, simIQList, sim, inCurrentInteraction));
                                }

                                if (list.Contains(interactionInstance2.InteractionObjectPair))
                                {
                                    CleanUpOrOnFailureInteraction(sim, interactionInstance2, false, false);
                                    num--;
                                    continue;
                                }

                                list.Add(interactionInstance2.InteractionObjectPair);

                                sim.ClearExitReasons();
                                simIQ.mCurrentTransitionInteraction = interactionInstance2;
                                flag = false;

                                try
                                {
                                    if (inCurrentInteraction.Target != null && sim.LookAtManager != null && inCurrentInteraction.Target.Parent != sim)
                                    {
                                        sim.LookAtManager.SetInteractionLookAt(inCurrentInteraction.Target as GameObject, Sim.LookAtInterestingnessOfTargetWhenRunningTransition, LookAtJointFilter.HeadBones);
                                    }
                                    flag = NFinalizeDeath._RunInteractionWithoutCleanUp(interactionInstance2);
                                }
                                finally
                                {
                                    sim.ClearSynchronizationData();
                                    CleanUpOrOnFailureInteraction(sim, interactionInstance2, false, flag);
                                    simIQ.mCurrentTransitionInteraction = null;
                                }

                                if (inCurrentInteraction.Target == null || inCurrentInteraction.Target.HasBeenDestroyed)
                                {
                                    simIQ.mIsHeadInteractionLocked = false;
                                    sim.PlayRouteFailFrequency     = Sim.RouteFailFrequency.AlwaysPlayRouteFail;
                                    return(false);
                                }
                                if (flag && simIQ.GetHeadInteraction() != inCurrentInteraction)
                                {
                                    simIQ.mIsHeadInteractionLocked = false;
                                    sim.PlayRouteFailFrequency     = Sim.RouteFailFrequency.AlwaysPlayRouteFail;
                                    return(false);
                                }

                                if (flag && sim.HasExitReason(ExitReason.SuspensionRequested))
                                {
                                    RemoveQueue(false, simIQ, simIQList, sim, inCurrentInteraction);
                                    sim.PlayRouteFailFrequency = Sim.RouteFailFrequency.AlwaysPlayRouteFail;
                                    return(false);
                                }

                                if (sim.HasExitReason(ExitReason.CancelExternal))
                                {
                                    if (!(sim.Posture is IDoNotGoToStandingOnTransitionFailed))
                                    {
                                        InteractionInstance standingTransition = sim.Posture.GetStandingTransition();
                                        if (standingTransition != null)
                                        {
                                            NFinalizeDeath.AddItemToList(simIQ.mInteractionList, standingTransition);
                                        }
                                    }
                                    inCurrentInteraction.PostureTransitionFailed(flag);

                                    sim.PlayRouteFailFrequency = Sim.RouteFailFrequency.AlwaysPlayRouteFail;
                                    return(OnFailedInCurrentInteraction(simIQ, simIQList, sim, inCurrentInteraction));
                                }

                                if (!flag)
                                {
                                    if (ShouldTimeUpdate(interactionInstance2))
                                    {
                                        interactionInstance2.Target.UpdateBlockTime();
                                    }
                                    num = 4;
                                }
                            }
                            num--;
                            num2--;
                        }

                        sim.PlayRouteFailFrequency = Sim.RouteFailFrequency.AlwaysPlayRouteFail;

                        if (sim.Posture != null && !sim.Posture.Satisfies(inCurrentInteraction.PosturePreconditions, inCurrentInteraction.Target, sim.Posture.GetRequiredCheck()))
                        {
                            return(OnFailedInCurrentInteraction(simIQ, simIQList, sim, inCurrentInteraction));
                        }
                    }


                    bool t = SCOSR.IsScriptCore2020() && NiecHelperSituation.isdgmods && NiecHelperSituation.__acorewIsnstalled__ && (inCurrentInteraction is Sim.GoToVirtualHome || inCurrentInteraction is Sim.GoToVirtualHome.GoToVirtualHomeInternal);

                    if (t || !inCurrentInteraction.Test() || (!inCurrentInteraction.IsTargetValid()))
                    {
                        niec_std.list_remove(simIQList, inCurrentInteraction);

                        if (inCurrentInteraction.Target != null)
                        {
                            if (!t)
                            {
                                try
                                {
                                    inCurrentInteraction.CallCallbackOnFailure(sim);
                                }
                                catch (NMAntiSpyException)
                                { NFinalizeDeath.SafeForceTerminateRuntime(); throw; }
                                catch (StackOverflowException)
                                { sim.mPosture = null; throw; }
                                catch (ResetException)
                                { throw; }
                                catch (Exception)
                                {
                                    NFinalizeDeath.CheckYieldingContext();
                                }

                                try
                                {
                                    inCurrentInteraction.Cleanup();
                                }
                                catch (NMAntiSpyException)
                                { NFinalizeDeath.SafeForceTerminateRuntime(); throw; }
                                catch (StackOverflowException)
                                { sim.mPosture = null; throw; }
                                catch (ResetException)
                                { throw; }
                                catch (Exception)
                                {
                                    NFinalizeDeath.CheckYieldingContext();
                                }
                            }
                            else
                            {
                                inCurrentInteraction.mbOnStartCalled = true;
                                inCurrentInteraction.mbOnStopCalled  = true;
                            }
                        }

                        if (sim.IsSelectable)
                        {
                            simIQ.FireQueueChanged();
                        }

                        continue;
                    }

                    if (inCurrentInteraction.InteractionObjectPair == null)
                    {
                        continue;
                    }

                    simIQ.mIsHeadInteractionLocked = true;

                    var runningInList = simIQ.mRunningInteractions;
                    if (runningInList != null)
                    {
                        runningInList.Push(inCurrentInteraction);
                    }

                    try
                    {
                        inCurrentInteraction.CallCallbackOnStart(sim);
                    }
                    catch (NMAntiSpyException)
                    { NFinalizeDeath.SafeForceTerminateRuntime(); throw; }
                    catch (StackOverflowException)
                    { sim.mPosture = null; throw; }
                    catch (ResetException)
                    { throw; }
                    catch
                    {
                        NFinalizeDeath.CheckYieldingContext();
                    }

                    simIQ.mIsHeadInteractionActive = true;

                    try
                    {
                        if (inCurrentInteraction != null && inCurrentInteraction.Autonomous && sim.mAutonomy != null && sim.mAutonomy.IsRunningLocalAutonomy && !sim.IsActiveSim && (sim.IsSelectable || RandomUtil.GetFloat(100f) < Sim.AutonomyThoughtBalloonPercentageChance) && inCurrentInteraction.InteractionObjectPair.Tradeoff != null)
                        {
                            CommodityKind physicalOrTraitMotive = sim.Motives.GetPhysicalOrTraitMotive(inCurrentInteraction.InteractionObjectPair.Tradeoff);
                            sim.ShowBalloonForMotive(ThoughtBalloonTypes.kThoughtBalloon, ThoughtBalloonPriority.Low, ThoughtBalloonDuration.Short, ThoughtBalloonCooldown.None, ThoughtBalloonAxis.kNeutral, physicalOrTraitMotive, inCurrentInteraction.Target);
                        }
                    }
                    catch (NMAntiSpyException)
                    { NFinalizeDeath.SafeForceTerminateRuntime(); throw; }
                    catch (StackOverflowException)
                    { sim.mPosture = null; throw; }
                    catch (ResetException)
                    { throw; }
                    catch
                    {
                        NFinalizeDeath.CheckYieldingContext();
                    }

                    sim.ClearExitReasons();

                    try
                    {
                        okI = NFinalizeDeath._RunInteractionWithoutCleanUp(inCurrentInteraction);
                        if (okI)
                        {
                            inCurrentInteraction.CallCallbackOnCompletion(sim);
                        }
                        else
                        {
                            inCurrentInteraction.CallCallbackOnFailure(sim);
                        }
                    }
                    catch (NMAntiSpyException)
                    { NFinalizeDeath.SafeForceTerminateRuntime(); throw; }
                    catch (StackOverflowException)
                    {
                        NFinalizeDeath.ThrowResetException(null);
                        throw;
                    }
                    catch (ResetException)
                    { throw; }
                    catch
                    {
                        NFinalizeDeath.CheckYieldingContext();
                    }


                    sim.ClearSynchronizationData();
                    NFinalizeDeath.CheckYieldingContext();

                    if (sim.HasExitReason(ExitReason.CancelledByPosture) && !sim.Posture.HasBeenCanceled)
                    {
                        sim.Posture.CancelPosture(sim);
                    }

                    if (!inCurrentInteraction.WasInUse && sim.OnlyHasExitReason(ExitReason.ObjectInUse))
                    {
                        inCurrentInteraction.WasInUse = true;
                    }

                    if (!okI && inCurrentInteraction.Target != null && ShouldTimeUpdate(inCurrentInteraction))
                    {
                        inCurrentInteraction.Target.UpdateBlockTime();
                    }

                    if (okI && inCurrentInteraction.Target != null && sim.IsSelectable)
                    {
                        EventTracker.SendEvent(new InteractionSuccessEvent(EventTypeId.kInteractionSuccess, sim, inCurrentInteraction.Target, inCurrentInteraction.InteractionObjectPair));
                    }

                    RemoveQueue(okI, simIQ, simIQList, sim, inCurrentInteraction);

                    if (inCurrentInteraction.ShouldReenque)
                    {
                        simIQ.ConsiderReenqueing(inCurrentInteraction);
                    }

                    if (Simulator.CheckYieldingContext(false))
                    {
                        simIQ.PutDownCarriedObjects(inCurrentInteraction);
                    }

                    NFinalizeDeath.CheckYieldingContext();

                    niec_std.list_remove(simIQList, inCurrentInteraction);
                    inCurrentInteraction.Cleanup();

                    NFinalizeDeath.CheckYieldingContext();

                    while (simIQList != null && niec_std.list_remove(simIQList, null))
                    {
                        NFinalizeDeath.CheckYieldingContext();
                        Simulator.Sleep(0);
                        simIQList = simIQ.mInteractionList;
                    }

                    if (simIQList == null)
                    {
                        break;
                    }

                    if (sim.IsSelectable)
                    {
                        simIQ.FireQueueChanged();
                    }

                    if (okI)
                    {
                        break;
                    }
                }
            }
            catch (NMAntiSpyException)
            { NFinalizeDeath.SafeForceTerminateRuntime(); throw; }
            catch (StackOverflowException)
            { sim.mPosture = null; throw; }

            if (simIQ.mInteractionList != null && simIQ.mInteractionList.Count == 0)
            {
                sim.QueueIdleLogic();
            }

            return(okI);
        }
示例#19
0
 public override bool CanShareBed(Sim s, BedData entryPart, CommodityKind use, out Sim incompatibleSim)
 {
     return(BedController.CanShareBed(this, s, use, out incompatibleSim));
 }
示例#20
0
 public MotiveKey(CASAgeGenderFlags ageSpecies, OccultTypes occult, CommodityKind kind)
 {
     mAgeSpecies = ageSpecies;
     mOccult = occult;
     mKind = kind;
 }
        //搜索推荐商品   参数为查询字符串和种类。
        public List<Commodity> SearchPaymentCommodity(String quryString, CommodityKind kind)
        {
            //string SKind = null;
            //if (kind == null)
            //{
            //    //如果用户没有传递中了的参数则默认的传递ALL
            //    SKind = "ALL";
            //}
            //else
            //{
            //    SKind = kind.ToString();
            //}

            if (quryString == null)
            {
                quryString = "%";
            }
            else
            {}

            List<Commodity> commodityList = new List<Commodity>();
            ISingleResult<searchPaymentCommodityResult> result = dc.searchPaymentCommodity(quryString, (int)kind);
            foreach (searchPaymentCommodityResult singleCommodity in result)
            {
                Commodity commodity = new Commodity();
                commodity.description = singleCommodity.discription;
                commodity.EndTime = singleCommodity.endtime.Value;
                commodity.ID = singleCommodity.id;
                commodity.ImageUrl = singleCommodity.picturepath;
                //commodity.kind = (CommodityKind)Enum.Parse(typeof(CommodityKind),singleCommodity.kind.ToString(),true);
                commodity.kind = (CommodityKind)(singleCommodity.kind.Value);
                commodity.Name = singleCommodity.name;
                commodity.popularity = singleCommodity.popularity.Value;
                commodity.Price = (double)singleCommodity.price;
                commodity.StartTime = System.DateTime.Now;
                //得到商品的tag列表
                ///////
                //得到taglist
                try
                {
                    ISingleResult<getTagByCommodityResult> TagResult = dc.getTagByCommodity(singleCommodity.id);
                    List<Tag> TagList = new List<Tag>();
                    foreach (getTagByCommodityResult Newtag in TagResult)
                    {
                        Tag tag = new Tag();
                        tag.name = Newtag.id;
                        tag.popularity = Newtag.popularity.Value;
                        TagList.Add(tag);
                    }
                    commodity.tagList = TagList;
                }
                catch (Exception e)
                {
                    commodity = null;
                }

                ////////
                commodity.UserName = singleCommodity.userfrom;
                commodityList.Add(commodity);
            }
            return commodityList;
        }
示例#22
0
        public static string FetchMotiveLocalization(CASAgeGenderFlags flag, CommodityKind motive)
        {
            string str = "";
            switch (motive)
            {
                case CommodityKind.Hygiene:
                    if (flag == CASAgeGenderFlags.Cat) str = "Scratch";
                    if (flag == CASAgeGenderFlags.Dog) str = "Destruction";
                    if (flag == CASAgeGenderFlags.Horse) str = "Exercise";
                break;
                case CommodityKind.Fun:
                    if (flag == CASAgeGenderFlags.Horse) str = "Thirst";
                break;
                case CommodityKind.Temperature:
                    return Common.Localize("TagData:Temperature");                
                default:
                break;
            }

            return Common.LocalizeEAString("Ui/Caption/HUD/MotivesPanel:Motive" + str + (flag == CASAgeGenderFlags.Human ? motive.ToString() : flag.ToString()));
        }
示例#23
0
 public Definition(CommodityKind motive, IMagicalDefinition settings, MagicControl control)
     : base(motive, control.GetMinSkillLevel(settings))
 {
     mSettings = settings.SpellSettings;
 }
示例#24
0
 public override bool CanShareBed(Sim s, BedData entryPart, CommodityKind use, out Sim incompatibleSim)
 {
     return BedController.CanShareBed(this, s, use, out incompatibleSim);
 }
示例#25
0
        public override bool Satisfies(PreconditionOptions options, IGameObject target, CommodityKind requiredCheck)
        {
            var pp = PreviousPosture;

            if (pp != null && pp == this)
            {
                PreviousPosture = null;
            }
            return(false);
        }