Ejemplo n.º 1
0
 public void PerformPrank(Business business)
 {
     if (!CheckIfAttemptingPrankOnConsecutiveDay(business))
     {
         bool         flag         = false;
         Sim          createdSim   = business.SimConspiringPrank.CreatedSim;
         Sim          sim2         = business.SimAffectedByPrank.CreatedSim;
         bool         flag2        = business.SimAffectedByPrank == createdSim.Occupation.Boss;
         Relationship relationship = Relationship.Get(createdSim, sim2, true);
         LTRData      data         = LTRData.Get(relationship.LTR.CurrentLTR);
         if (!relationship.STC.InNegativeContext || (data.RelationshipClass >= LTRData.RelationshipClassification.Medium))
         {
             base.Display(LocalizeString(createdSim.SimDescription, "FunnyPrankWorked", new object[] { createdSim.SimDescription, business.SimAffectedByPrank }), createdSim.ObjectId, business);
             flag = true;
             float change = flag2 ? Business.kLTRIncreaseWhenPrankSucceedsOnBoss : Business.kLTRIncreaseWhenPrankSucceeds;
             relationship.LTR.UpdateLiking(change);
             relationship.UpdateSTCFromOutsideConversation(sim2, createdSim, CommodityTypes.Funny, (float)Business.kSTCValueOnPranks);
         }
         else if (relationship.STC.InNegativeContext || (data.RelationshipClass == LTRData.RelationshipClassification.Low))
         {
             base.Display(LocalizeString(createdSim.SimDescription, "BadPrankFailed", new object[] { createdSim.SimDescription, business.SimAffectedByPrank }), createdSim.ObjectId, business);
             CommodityTypes[] randomList = new CommodityTypes[] { CommodityTypes.Boring, CommodityTypes.Creepy, CommodityTypes.Insulting, CommodityTypes.Awkward, CommodityTypes.Steamed };
             float            num2       = flag2 ? Business.kLTRDecreaseWhenPrankFailsOnBoss : Business.kLTRDecreaseWhenPrankFails;
             relationship.LTR.UpdateLiking(num2);
             relationship.UpdateSTCFromOutsideConversation(sim2, createdSim, RandomUtil.GetRandomObjectFromList(randomList), (float)Business.kSTCValueOnPranks);
         }
         if (flag2)
         {
             float perfChange = flag ? Business.kCareerPerformanceChange : (-1f * Business.kCareerPerformanceChange);
             business.AddPerformance(perfChange);
         }
         business.WasLastPrankSuccessful = flag;
         business.IsPrankSet             = false;
     }
 }
Ejemplo n.º 2
0
 public Commodity(int id, string name, double price, DateTime timeOfExpiration, CommodityTypes type)
 {
     ID               = id;
     Name             = name;
     Price            = price;
     TimeOfExpiration = timeOfExpiration;
     Type             = type;
 }
Ejemplo n.º 3
0
        protected static void CloneSTCData(ShortTermContextTypes newSTC, CommodityTypes newCom, ShortTermContextTypes oldSTC)
        {
            STCData oldData = STCData.Get(oldSTC);

            STCData.Add(new STCData(newSTC, oldData.mText, oldData.mPassiveText, newCom, oldData.RangeMin, oldData.RangeMax, oldData.IdleJazzState, oldData.LTRDecayFromBelow, oldData.LTRDecayFromAbove, oldData.VisitLengthChange, oldData.CharismaIncrease, oldData.X1, oldData.Y1, oldData.X2, oldData.Y2, oldData.X3, oldData.Y3, oldData.MoodThresholdForAcceptRequest));

            ActionAvailabilityData.sStcInteractions.Add(newSTC, ActionAvailabilityData.sStcInteractions[oldSTC]);
        }
Ejemplo n.º 4
0
        protected static void CloneSTCData(ShortTermContextTypes newSTC, CommodityTypes newCom, ShortTermContextTypes oldSTC)
        {
            STCData oldData = STCData.Get(oldSTC);

            STCData.Add(new STCData(newSTC, oldData.mText, oldData.mPassiveText, newCom, oldData.RangeMin, oldData.RangeMax, oldData.IdleJazzState, oldData.LTRDecayFromBelow, oldData.LTRDecayFromAbove, oldData.VisitLengthChange, oldData.CharismaIncrease, oldData.X1, oldData.Y1, oldData.X2, oldData.Y2, oldData.X3, oldData.Y3, oldData.MoodThresholdForAcceptRequest));

            ActionAvailabilityData.sStcInteractions.Add(newSTC, ActionAvailabilityData.sStcInteractions[oldSTC]);
        }
Ejemplo n.º 5
0
        public void RemoveCommodity(Type type, int amount)
        {
            if (CommodityTypes.ContainsKey(type))
            {
                CommodityTypes[type] -= amount;

                if (CommodityTypes[type] <= 0)
                {
                    CommodityTypes.Remove(type);
                }
            }
        }
Ejemplo n.º 6
0
        private async IAsyncEnumerable <Commodity> LoadAndWriteJsonFiles(string itemsFolder)
        {
            var folderPath = Path.Combine(DataRoot, itemsFolder);
            var index      = new List <Item>();

            foreach (var entityFilename in Directory.EnumerateFiles(folderPath, "*.xml", SearchOption.AllDirectories))
            {
                if (AvoidFile(entityFilename))
                {
                    continue;
                }

                EntityClassDefinition entity = null;

                // Entity
                _logger.LogInformation(entityFilename);
                entity = await _entityParser.Parse(entityFilename, OnXmlLoadout);

                if (entity == null)
                {
                    continue;
                }

                var jsonFilename = Path.Combine(OutputFolder, $"{entity.ClassName.ToLower()}.json");
                _ = _jsonFileReaderWriter.WriteFile(jsonFilename, () => new { Raw = new { Entity = entity } });

                var etd = GetLocalizedDataFromEntity(entity);

                var type        = CommodityTypes[etd.Type];
                var subType     = CommodityTypes.GetValueOrDefault(etd.SubType);
                var description = string.IsNullOrWhiteSpace(etd.Description) ? subType?.Description : etd.Description;

                yield return(new Commodity
                {
                    Id = new Guid(entity.Id),
                    JsonFilename =
                        Path.GetRelativePath(Path.GetDirectoryName(OutputFolder), jsonFilename),
                    ClassName = entity.ClassName,
                    Type = type,
                    TypeId = type.Id,
                    SubType = subType,
                    SubTypeId = subType?.Id,
                    Name = etd.Name,
                    Description = description
                });
            }
        }
Ejemplo n.º 7
0
        // From Conversation
        public static List <SocialInteractionCandidate> GetSocialsForSTC(CommodityTypes commodity, Sim actor, Sim target, Relationship r, Conversation c, bool isAutonomous, ref string msg)
        {
            using (Common.TestSpan span = new Common.TestSpan(TimeSpanLogger.Bin, "GetSocialsForSTC: " + commodity, Common.DebugLevel.Stats))
            {
                ShortTermContextTypes             str2;
                List <SocialInteractionCandidate> list3;
                LongTermRelationshipTypes         group = LongTermRelationshipTypes.Stranger;
                if (r != null)
                {
                    group = r.LTR.CurrentLTR;
                }
                bool flag = (r != null) && ((r.STC == null) || (commodity == r.STC.CurrentCommodity));
                if (!SocialComponent.SocialCommodityIsAvailable(commodity, target, actor, r))
                {
                    return(null);
                }
                if (flag)
                {
                    bool flag2;
                    str2 = Conversation.GetCurrentSTC(actor, target, r, c, out flag2);
                }
                else
                {
                    str2 = STCData.FirstSTC(commodity);
                }
                List <SocialInteractionCandidate> collection = ActionAvailabilityData.Get(actor, target, str2, group, true, null, isAutonomous);
                if ((isAutonomous && (r != null)) && (r.STC.CurrentCommodity == commodity))
                {
                    ShortTermContextTypes str4;
                    collection = new List <SocialInteractionCandidate>(collection);
                    ShortTermContextTypes str3 = STCData.PreviousSTC(str2);
                    do
                    {
                        collection.AddRange(ActionAvailabilityData.Get(actor, target, str3, group, true, null, isAutonomous));
                        str4 = str3;
                        str3 = STCData.PreviousSTC(str3);
                    }while (!(str4 == str3));
                }
                if (isAutonomous)
                {
                    goto Label_0167;
                }
                ShortTermContextTypes category = STCData.FirstSTC(commodity);
Label_00D5:
                msg += Common.NewLine + "GetSocialsForSTC " + category;

                foreach (SocialInteractionCandidate candidate in Get(actor, target, category, group, true, null, isAutonomous, ref msg))
                {
                    ActionData action = ActionData.Get(candidate.Name);
                    if (Conversation.SimHasTraitEncouragingOrRequiringSocial(actor, action))
                    {
                        if (category != STCData.FirstSTC(commodity))
                        {
                            candidate.OnlyAppearsInTraitMenu = true;
                        }

                        collection.Add(candidate);
                    }
                }
                ShortTermContextTypes str6 = STCData.NextSTC(category);
                if (str6 != category)
                {
                    category = str6;
                    goto Label_00D5;
                }
Label_0167:
                msg += Common.NewLine + "Collection " + collection.Count;

                list3 = new List <SocialInteractionCandidate>();
                foreach (SocialInteractionCandidate candidate2 in collection)
                {
                    ActionData data2 = ActionData.Get(candidate2.Name);
                    if (flag || !data2.DoesSocialOnlyAppearWhenSTCIsCurrent)
                    {
                        msg += Common.NewLine + " " + candidate2.Name;

                        list3.Add(candidate2);
                    }
                }
                return(list3);
            }
        }
Ejemplo n.º 8
0
        public static void AddSocials(string name, SocialComponent ths, CommodityTypes commodity, Sim actor, Sim target, List<SocialInteractionCandidate> socials, bool isAutonomous, int maxNumSocials, List<InteractionObjectPair> results, string[] inlineParentMenu, TraitNames trait)
        {
            sMsg += Common.NewLine + "AddSocials " + name + " " + commodity + " " + socials.Count;

            int num = 0x0;
            InteractionPriority priority = new InteractionPriority(isAutonomous ? InteractionPriorityLevel.Autonomous : InteractionPriorityLevel.UserDirected);
            GreyedOutTooltipCallback greyedOutTooltipCallback = null;
            foreach (SocialInteractionCandidate candidate in socials)
            {
                string[] strArray = inlineParentMenu;
                bool flag = true;
                if (num >= maxNumSocials)
                {
                    break;
                }

                sMsg += Common.NewLine + " Testing " + candidate.Name;

                ActiveTopic topic = candidate.Topic;
                if (topic != null)
                {
                    ActiveTopicData data = topic.Data;
                    if (data.HasPieMenuOverride())
                    {
                        flag = false;
                        strArray = new string[] { data.GetText(actor, new object[0x0]) };
                    }
                }
                ActionData data2 = ActionData.Get(candidate.Name);
                if (data2.AppearsOnTopLevel)
                {
                    strArray = new string[0x0];
                }
                if (!ths.DoesSocialAppear(candidate.Name, results, strArray))
                {
                    InteractionObjectPair iop = null;
                    if (((data2.IntendedCommodityString == CommodityTypes.Friendly) && ((actor.Posture is ISeatedSocialPosture) || (target.Posture is ISeatedSocialPosture))) && data2.AllowCarryChild)
                    {
                        InteractionDefinition interaction = new SeatedSocialInteractionA.SeatedDefinition(candidate.Name, strArray, candidate.Topic, false, trait, false);
                        iop = new InteractionObjectPair(interaction, target);
                        InteractionInstanceParameters parameters = new InteractionInstanceParameters(iop, actor, priority, isAutonomous, true);
                        if (!IUtil.IsPass(interaction.Test(ref parameters, ref greyedOutTooltipCallback)))
                        {
                            iop = null;
                        }
                        if (((candidate.Name == "Chat") && !actor.CanBeInSameGroupTalkAsMe(target)) && (actor.Posture is ISeatedSocialPosture))
                        {
                            string[] strArray2 = new string[0x0];
                            if (!ths.DoesSocialAppear(candidate.Name, results, strArray2))
                            {
                                interaction = new SeatedSocialInteractionA.SeatedDefinition(candidate.Name, strArray2, candidate.Topic, false, trait, true);
                                InteractionObjectPair pair2 = new InteractionObjectPair(interaction, target);
                                parameters = new InteractionInstanceParameters(pair2, actor, priority, isAutonomous, true);
                                if (IUtil.IsPass(interaction.Test(ref parameters, ref greyedOutTooltipCallback)))
                                {
                                    results.Add(pair2);
                                }
                            }
                        }
                    }
                    if (iop == null)
                    {
                        iop = new InteractionObjectPair(new SocialInteractionA.Definition(candidate.Name, strArray, candidate.Topic, false, trait), target);
                    }
                    InteractionInstanceParameters parameters2 = new InteractionInstanceParameters(iop, actor, priority, isAutonomous, true);

                    InteractionTestResult result = iop.InteractionDefinition.Test(ref parameters2, ref greyedOutTooltipCallback);

                    sMsg += Common.NewLine + "  " + candidate.Name + " = " + result;

                    if ((IUtil.IsPass(result) || (greyedOutTooltipCallback != null)) || Sims3.Gameplay.UI.PieMenu.PieMenuShowFailureReason)
                    {
                        results.Add(iop);
                        if (flag)
                        {
                            num++;
                        }
                    }
                }
            }
        }
Ejemplo n.º 9
0
        public static List<SocialInteractionCandidate> GetSocialsForSTC(CommodityTypes commodity, Sim actor, Sim target, Relationship r, Conversation c, bool isAutonomous)
        {
            ShortTermContextTypes types2;
            List<SocialInteractionCandidate> list3;
            LongTermRelationshipTypes stranger = LongTermRelationshipTypes.Stranger;
            if (r != null)
            {
                stranger = r.LTR.CurrentLTR;
            }
            bool flag = (r != null) && ((r.STC == null) || (commodity == r.STC.CurrentCommodity));
            if (!SocialComponent.SocialCommodityIsAvailable(commodity, target, actor, r))
            {
                sMsg += Common.NewLine + "Denied";
                return null;
            }
            if (flag)
            {
                bool flag2;
                types2 = Conversation.GetCurrentSTC(actor, target, r, c, out flag2);

                sMsg += Common.NewLine + "CurrentSTC " + types2 + " " + r.STC.CurrentCommodity;
            }
            else
            {
                types2 = STCData.FirstSTC(commodity);

                sMsg += Common.NewLine + "FirstSTC " + types2 + " " + r.STC.CurrentCommodity;
            }

            List<SocialInteractionCandidate> collection = Get("1", actor, target, types2, stranger, true, null, isAutonomous);

            if ((isAutonomous && (r != null)) && (r.STC.CurrentCommodity == commodity))
            {
                ShortTermContextTypes types4;
                collection = new List<SocialInteractionCandidate>(collection);
                ShortTermContextTypes types3 = STCData.PreviousSTC(types2);
                do
                {
                    collection.AddRange(Get("2", actor, target, types3, stranger, true, null, isAutonomous));

                    types4 = types3;
                    types3 = STCData.PreviousSTC(types3);
                }
                while (types4 != types3);
            }
            if (isAutonomous)
            {
                goto Label_014C;
            }
            ShortTermContextTypes stc = STCData.FirstSTC(commodity);
        Label_00C4:
            List<SocialInteractionCandidate> traitList = Get("3", actor, target, stc, stranger, true, null, isAutonomous);

            foreach (SocialInteractionCandidate candidate in traitList)
            {
                ActionData action = ActionData.Get(candidate.Name);
                if (Conversation.SimHasTraitEncouragingOrRequiringSocial(actor, action))
                {
                    if (stc != STCData.FirstSTC(commodity))
                    {
                        candidate.OnlyAppearsInTraitMenu = true;
                    }
                    collection.Add(candidate);
                }
            }
            ShortTermContextTypes types6 = STCData.NextSTC(stc);
            if (types6 != stc)
            {
                stc = types6;
                goto Label_00C4;
            }
        Label_014C:
            sMsg += Common.NewLine + "Final = " + collection.Count;

            list3 = new List<SocialInteractionCandidate>();
            foreach (SocialInteractionCandidate candidate2 in collection)
            {
                sMsg += Common.NewLine + "Test " + candidate2.Name;

                ActionData data2 = ActionData.Get(candidate2.Name);
                if (flag || !data2.DoesSocialOnlyAppearWhenSTCIsCurrent)
                {
                    sMsg += Common.NewLine + " Added " + candidate2.Name;

                    list3.Add(candidate2);
                }
            }
            return list3;
        }
Ejemplo n.º 10
0
        private void OpenModuleDetail(int moduleDetailID)
        {
            if (moduleDetailID > 0)
            {
                Form openingView = null;//Form to open

                for (int i = 0; i < this.MdiChildren.Length; i++)
                {//Find and active the current form
                    IToolstripChild mdiChildCallToolStrip = this.MdiChildren[i] as IToolstripChild;
                    if (mdiChildCallToolStrip != null)
                    {
                        if (moduleDetailID == (int)mdiChildCallToolStrip.NMVNTaskID)
                        {
                            openingView = (Form)this.MdiChildren[i];
                            break;
                        }
                    }
                }

                if (openingView != null)
                {
                    openingView.Activate();
                    IToolstripChild mdiChildCallToolStrip = openingView as IToolstripChild;
                    if (mdiChildCallToolStrip != null)
                    {
                        mdiChildCallToolStrip.DoAfterActivate();
                    }
                }
                else
                { //OPEN NEW VIEW
                    switch (moduleDetailID)
                    {
                    case (int)GlobalEnums.NmvnTaskID.Customers:
                        openingView = new Customers();
                        break;

                    case (int)GlobalEnums.NmvnTaskID.CustomerTypes:
                        openingView = new CustomerTypes();
                        break;

                    case (int)GlobalEnums.NmvnTaskID.CustomerCategories:
                        openingView = new CustomerCategories();
                        break;

                    case (int)GlobalEnums.NmvnTaskID.Commodities:
                        openingView = new Commodities();
                        break;

                    case (int)GlobalEnums.NmvnTaskID.CommoditySettings:
                        openingView = new CommoditySettings();
                        break;

                    case (int)GlobalEnums.NmvnTaskID.CommodityTypes:
                        openingView = new CommodityTypes();
                        break;

                    case (int)GlobalEnums.NmvnTaskID.CommodityCategories:
                        openingView = new CommodityCategories();
                        break;

                    case (int)GlobalEnums.NmvnTaskID.BinLocations:
                        openingView = new BinLocations();
                        break;

                    case (int)GlobalEnums.NmvnTaskID.Teams:
                        openingView = new Teams();
                        break;

                    case (int)GlobalEnums.NmvnTaskID.Territories:
                        openingView = new Territories();
                        break;

                    case (int)GlobalEnums.NmvnTaskID.Warehouses:
                        openingView = new Warehouses();
                        break;

                    case (int)GlobalEnums.NmvnTaskID.Employees:
                        openingView = new Employees();
                        break;

                    case (int)GlobalEnums.NmvnTaskID.Pickups:
                        openingView = new Pickups();
                        break;

                    case (int)GlobalEnums.NmvnTaskID.GoodsReceipts:
                        openingView = new GoodsReceipts();
                        break;

                    case (int)GlobalEnums.NmvnTaskID.Forecasts:
                        openingView = new Forecasts();
                        break;

                    case (int)GlobalEnums.NmvnTaskID.SalesOrders:
                        openingView = new SalesOrders();
                        break;

                    case (int)GlobalEnums.NmvnTaskID.DeliveryAdvices:
                        openingView = new DeliveryAdvices();
                        break;

                    case (int)GlobalEnums.NmvnTaskID.TransferOrders:
                        openingView = new TransferOrders();
                        break;

                    case (int)GlobalEnums.NmvnTaskID.GoodsIssues:
                        openingView = new GoodsIssues();
                        break;

                    case (int)GlobalEnums.NmvnTaskID.WarehouseAdjustments:
                        openingView = new WarehouseAdjustments();
                        break;

                    case (int)GlobalEnums.NmvnTaskID.AvailableItems:
                        openingView = new GoodsReceiptDetailAvailables();
                        break;

                    case (int)GlobalEnums.NmvnTaskID.PendingOrders:
                        openingView = new PendingOrders();
                        break;

                    case (int)GlobalEnums.NmvnTaskID.Reports:
                        openingView = new Reports();
                        break;

                    default:
                        openingView = new BlankView();
                        break;
                    }

                    if (openingView != null)
                    {
                        this.OpenView(openingView);
                    }
                }

                if (!this.naviBarModuleMaster.Collapsed)
                {
                    buttonNaviBarHeader_Click(this.buttonNaviBarHeader, new EventArgs());
                }
            }
        }
Ejemplo n.º 11
0
        public static void AddSocials(string name, SocialComponent ths, CommodityTypes commodity, Sim actor, Sim target, List <SocialInteractionCandidate> socials, bool isAutonomous, int maxNumSocials, List <InteractionObjectPair> results, string[] inlineParentMenu, TraitNames trait)
        {
            sMsg += Common.NewLine + "AddSocials " + name + " " + commodity + " " + socials.Count;

            int num = 0x0;
            InteractionPriority      priority = new InteractionPriority(isAutonomous ? InteractionPriorityLevel.Autonomous : InteractionPriorityLevel.UserDirected);
            GreyedOutTooltipCallback greyedOutTooltipCallback = null;

            foreach (SocialInteractionCandidate candidate in socials)
            {
                string[] strArray = inlineParentMenu;
                bool     flag     = true;
                if (num >= maxNumSocials)
                {
                    break;
                }

                sMsg += Common.NewLine + " Testing " + candidate.Name;

                ActiveTopic topic = candidate.Topic;
                if (topic != null)
                {
                    ActiveTopicData data = topic.Data;
                    if (data.HasPieMenuOverride())
                    {
                        flag     = false;
                        strArray = new string[] { data.GetText(actor, new object[0x0]) };
                    }
                }
                ActionData data2 = ActionData.Get(candidate.Name);
                if (data2.AppearsOnTopLevel)
                {
                    strArray = new string[0x0];
                }
                if (!ths.DoesSocialAppear(candidate.Name, results, strArray))
                {
                    InteractionObjectPair iop = null;
                    if (((data2.IntendedCommodityString == CommodityTypes.Friendly) && ((actor.Posture is ISeatedSocialPosture) || (target.Posture is ISeatedSocialPosture))) && data2.AllowCarryChild)
                    {
                        InteractionDefinition interaction = new SeatedSocialInteractionA.SeatedDefinition(candidate.Name, strArray, candidate.Topic, false, trait, false);
                        iop = new InteractionObjectPair(interaction, target);
                        InteractionInstanceParameters parameters = new InteractionInstanceParameters(iop, actor, priority, isAutonomous, true);
                        if (!IUtil.IsPass(interaction.Test(ref parameters, ref greyedOutTooltipCallback)))
                        {
                            iop = null;
                        }
                        if (((candidate.Name == "Chat") && !actor.CanBeInSameGroupTalkAsMe(target)) && (actor.Posture is ISeatedSocialPosture))
                        {
                            string[] strArray2 = new string[0x0];
                            if (!ths.DoesSocialAppear(candidate.Name, results, strArray2))
                            {
                                interaction = new SeatedSocialInteractionA.SeatedDefinition(candidate.Name, strArray2, candidate.Topic, false, trait, true);
                                InteractionObjectPair pair2 = new InteractionObjectPair(interaction, target);
                                parameters = new InteractionInstanceParameters(pair2, actor, priority, isAutonomous, true);
                                if (IUtil.IsPass(interaction.Test(ref parameters, ref greyedOutTooltipCallback)))
                                {
                                    results.Add(pair2);
                                }
                            }
                        }
                    }
                    if (iop == null)
                    {
                        iop = new InteractionObjectPair(new SocialInteractionA.Definition(candidate.Name, strArray, candidate.Topic, false, trait), target);
                    }
                    InteractionInstanceParameters parameters2 = new InteractionInstanceParameters(iop, actor, priority, isAutonomous, true);

                    InteractionTestResult result = iop.InteractionDefinition.Test(ref parameters2, ref greyedOutTooltipCallback);

                    sMsg += Common.NewLine + "  " + candidate.Name + " = " + result;

                    if ((IUtil.IsPass(result) || (greyedOutTooltipCallback != null)) || Sims3.Gameplay.UI.PieMenu.PieMenuShowFailureReason)
                    {
                        results.Add(iop);
                        if (flag)
                        {
                            num++;
                        }
                    }
                }
            }
        }
Ejemplo n.º 12
0
        public static List <SocialInteractionCandidate> GetSocialsForSTC(CommodityTypes commodity, Sim actor, Sim target, Relationship r, Conversation c, bool isAutonomous)
        {
            ShortTermContextTypes             types2;
            List <SocialInteractionCandidate> list3;
            LongTermRelationshipTypes         stranger = LongTermRelationshipTypes.Stranger;

            if (r != null)
            {
                stranger = r.LTR.CurrentLTR;
            }
            bool flag = (r != null) && ((r.STC == null) || (commodity == r.STC.CurrentCommodity));

            if (!SocialComponent.SocialCommodityIsAvailable(commodity, target, actor, r))
            {
                sMsg += Common.NewLine + "Denied";
                return(null);
            }
            if (flag)
            {
                bool flag2;
                types2 = Conversation.GetCurrentSTC(actor, target, r, c, out flag2);

                sMsg += Common.NewLine + "CurrentSTC " + types2 + " " + r.STC.CurrentCommodity;
            }
            else
            {
                types2 = STCData.FirstSTC(commodity);

                sMsg += Common.NewLine + "FirstSTC " + types2 + " " + r.STC.CurrentCommodity;
            }

            List <SocialInteractionCandidate> collection = Get("1", actor, target, types2, stranger, true, null, isAutonomous);

            if ((isAutonomous && (r != null)) && (r.STC.CurrentCommodity == commodity))
            {
                ShortTermContextTypes types4;
                collection = new List <SocialInteractionCandidate>(collection);
                ShortTermContextTypes types3 = STCData.PreviousSTC(types2);
                do
                {
                    collection.AddRange(Get("2", actor, target, types3, stranger, true, null, isAutonomous));

                    types4 = types3;
                    types3 = STCData.PreviousSTC(types3);
                }while (types4 != types3);
            }
            if (isAutonomous)
            {
                goto Label_014C;
            }
            ShortTermContextTypes stc = STCData.FirstSTC(commodity);

Label_00C4:
            List <SocialInteractionCandidate> traitList = Get("3", actor, target, stc, stranger, true, null, isAutonomous);

            foreach (SocialInteractionCandidate candidate in traitList)
            {
                ActionData action = ActionData.Get(candidate.Name);
                if (Conversation.SimHasTraitEncouragingOrRequiringSocial(actor, action))
                {
                    if (stc != STCData.FirstSTC(commodity))
                    {
                        candidate.OnlyAppearsInTraitMenu = true;
                    }
                    collection.Add(candidate);
                }
            }
            ShortTermContextTypes types6 = STCData.NextSTC(stc);

            if (types6 != stc)
            {
                stc = types6;
                goto Label_00C4;
            }
Label_014C:
            sMsg += Common.NewLine + "Final = " + collection.Count;

            list3 = new List <SocialInteractionCandidate>();
            foreach (SocialInteractionCandidate candidate2 in collection)
            {
                sMsg += Common.NewLine + "Test " + candidate2.Name;

                ActionData data2 = ActionData.Get(candidate2.Name);
                if (flag || !data2.DoesSocialOnlyAppearWhenSTCIsCurrent)
                {
                    sMsg += Common.NewLine + " Added " + candidate2.Name;

                    list3.Add(candidate2);
                }
            }
            return(list3);
        }
Ejemplo n.º 13
0
 public void PerformPrank(Business business)
 {
     if (!CheckIfAttemptingPrankOnConsecutiveDay(business))
     {
         bool flag = false;
         Sim createdSim = business.SimConspiringPrank.CreatedSim;
         Sim sim2 = business.SimAffectedByPrank.CreatedSim;
         bool flag2 = business.SimAffectedByPrank == createdSim.Occupation.Boss;
         Relationship relationship = Relationship.Get(createdSim, sim2, true);
         LTRData data = LTRData.Get(relationship.LTR.CurrentLTR);
         if (!relationship.STC.InNegativeContext || (data.RelationshipClass >= LTRData.RelationshipClassification.Medium))
         {
             base.Display(LocalizeString(createdSim.SimDescription, "FunnyPrankWorked", new object[] { createdSim.SimDescription, business.SimAffectedByPrank }), createdSim.ObjectId, business);
             flag = true;
             float change = flag2 ? Business.kLTRIncreaseWhenPrankSucceedsOnBoss : Business.kLTRIncreaseWhenPrankSucceeds;
             relationship.LTR.UpdateLiking(change);
             relationship.UpdateSTCFromOutsideConversation(sim2, createdSim, CommodityTypes.Funny, (float) Business.kSTCValueOnPranks);
         }
         else if (relationship.STC.InNegativeContext || (data.RelationshipClass == LTRData.RelationshipClassification.Low))
         {
             base.Display(LocalizeString(createdSim.SimDescription, "BadPrankFailed", new object[] { createdSim.SimDescription, business.SimAffectedByPrank }), createdSim.ObjectId, business);
             CommodityTypes[] randomList = new CommodityTypes[] { CommodityTypes.Boring, CommodityTypes.Creepy, CommodityTypes.Insulting, CommodityTypes.Awkward, CommodityTypes.Steamed };
             float num2 = flag2 ? Business.kLTRDecreaseWhenPrankFailsOnBoss : Business.kLTRDecreaseWhenPrankFails;
             relationship.LTR.UpdateLiking(num2);
             relationship.UpdateSTCFromOutsideConversation(sim2, createdSim, RandomUtil.GetRandomObjectFromList(randomList), (float) Business.kSTCValueOnPranks);
         }
         if (flag2)
         {
             float perfChange = flag ? Business.kCareerPerformanceChange : (-1f * Business.kCareerPerformanceChange);
             business.AddPerformance(perfChange);
         }
         business.WasLastPrankSuccessful = flag;
         business.IsPrankSet = false;
     }
 }
Ejemplo n.º 14
0
        // From Conversation
        public static List<SocialInteractionCandidate> GetSocialsForSTC(CommodityTypes commodity, Sim actor, Sim target, Relationship r, Conversation c, bool isAutonomous, ref string msg)
        {
            using (Common.TestSpan span = new Common.TestSpan(TimeSpanLogger.Bin, "GetSocialsForSTC: " + commodity, Common.DebugLevel.Stats))
            {
                ShortTermContextTypes str2;
                List<SocialInteractionCandidate> list3;
                LongTermRelationshipTypes group = LongTermRelationshipTypes.Stranger;
                if (r != null)
                {
                    group = r.LTR.CurrentLTR;
                }
                bool flag = (r != null) && ((r.STC == null) || (commodity == r.STC.CurrentCommodity));
                if (!SocialComponent.SocialCommodityIsAvailable(commodity, target, actor, r))
                {
                    return null;
                }
                if (flag)
                {
                    bool flag2;
                    str2 = Conversation.GetCurrentSTC(actor, target, r, c, out flag2);
                }
                else
                {
                    str2 = STCData.FirstSTC(commodity);
                }
                List<SocialInteractionCandidate> collection = ActionAvailabilityData.Get(actor, target, str2, group, true, null, isAutonomous);
                if ((isAutonomous && (r != null)) && (r.STC.CurrentCommodity == commodity))
                {
                    ShortTermContextTypes str4;
                    collection = new List<SocialInteractionCandidate>(collection);
                    ShortTermContextTypes str3 = STCData.PreviousSTC(str2);
                    do
                    {
                        collection.AddRange(ActionAvailabilityData.Get(actor, target, str3, group, true, null, isAutonomous));
                        str4 = str3;
                        str3 = STCData.PreviousSTC(str3);
                    }
                    while (!(str4 == str3));
                }
                if (isAutonomous)
                {
                    goto Label_0167;
                }
                ShortTermContextTypes category = STCData.FirstSTC(commodity);
            Label_00D5:
                msg += Common.NewLine + "GetSocialsForSTC " + category;

                foreach (SocialInteractionCandidate candidate in Get(actor, target, category, group, true, null, isAutonomous, ref msg))
                {
                    ActionData action = ActionData.Get(candidate.Name);
                    if (Conversation.SimHasTraitEncouragingOrRequiringSocial(actor, action))
                    {
                        if (category != STCData.FirstSTC(commodity))
                        {
                            candidate.OnlyAppearsInTraitMenu = true;
                        }

                        collection.Add(candidate);
                    }
                }
                ShortTermContextTypes str6 = STCData.NextSTC(category);
                if (str6 != category)
                {
                    category = str6;
                    goto Label_00D5;
                }
            Label_0167:
                msg += Common.NewLine + "Collection " + collection.Count;

                list3 = new List<SocialInteractionCandidate>();
                foreach (SocialInteractionCandidate candidate2 in collection)
                {
                    ActionData data2 = ActionData.Get(candidate2.Name);
                    if (flag || !data2.DoesSocialOnlyAppearWhenSTCIsCurrent)
                    {
                        msg += Common.NewLine + " " + candidate2.Name;

                        list3.Add(candidate2);
                    }
                }
                return list3;
            }
        }