public static OpenXmlFormat Resolve(Relationships relationships)
        {
            try
            {
                var parts = relationships.FindParts(_transitionalOpenXml.OfficeDocumentRelationshipsOfficeDocument);
                if (parts.Count() > 0)
                    return OpenXmlFormat.Transitional;

                parts = relationships.FindParts(_strictOpenXml.OfficeDocumentRelationshipsOfficeDocument);
                if (parts.Count() > 0)
                    return OpenXmlFormat.Strict;
            }
            catch (Exception e)
            {
                Logger.LogError(e);
            }
            Logger.LogError("Failed to determine the Open XML format");
            return OpenXmlFormat.Unknown;
        }
Exemple #2
0
        protected static void RepairMissingPartner(SimDescription trueSim)
        {
            if ((trueSim.Partner != null) && (trueSim.Partner.Partner != trueSim))
            {
                trueSim.Partner.mPartner = trueSim;

                Overwatch.Log("Missing Partner Relinked");
                Overwatch.Log("  " + Relationships.GetFullName(trueSim) + " - " + Relationships.GetFullName(trueSim.Partner));
            }

            MiniSimDescription miniSim = MiniSimDescription.Find(trueSim.SimDescriptionId);

            if (miniSim != null)
            {
                if (trueSim.Partner == null)
                {
                    miniSim.PartnerSimDescriptionId = 0;
                }
                else
                {
                    miniSim.PartnerSimDescriptionId = trueSim.Partner.SimDescriptionId;
                }
            }
        }
Exemple #3
0
        /// <summary>
        /// Save the Xlsx Package to a new Stream (that the caller owns and has to dispose)
        /// </summary>
        /// <returns></returns>
        internal void SaveToStream(Stream outputStream, bool compress)
        {
            using (var pkg = new ZipPackage(outputStream, compress))
            {
                WriteInfoXmlFile(pkg);

                foreach (var file in XmlFiles)
                {
                    pkg.WriteXmlFile(file);

                    var relations = Relationships.Where(r => r.Target == file);
                    foreach (var rel in relations)
                    {
                        pkg.AddRelationship(rel);
                    }
                }

                if (WorkbookRelationships.Count > 0)
                {
                    pkg.WriteXmlFile(WorkbookRelsXml());
                }
            }
            outputStream.Seek(0, SeekOrigin.Begin);
        }
Exemple #4
0
        static void Main(string[] args)
        {
            var parent = new Person()
            {
                Name = "Cristian"
            };
            var child1 = new Person()
            {
                Name = "Alex"
            };
            var child2 = new Person()
            {
                Name = "Oana"
            };


            var relationships = new Relationships();

            relationships.AddParentAndChild(parent, child1);
            relationships.AddParentAndChild(parent, child2);


            var rc = new Research(relationships);
        }
Exemple #5
0
        public static List <Sim> GetChoices(Sim actor, Sim target)
        {
            List <Sim> results = new List <Sim>();

            if (actor == null || target == null || actor.LotHome == null || target.LotHome == null)
            {
                return(results);
            }

            foreach (SimDescription sim2 in actor.Household.SimDescriptions)
            {
                if (sim2.CreatedSim == null)
                {
                    continue;
                }

                if (sim2.TeenOrAbove)
                {
                    continue;
                }

                if (sim2.CreatedSim.IsAtWork)
                {
                    continue;
                }

                if (!Relationships.IsCloselyRelated(actor.SimDescription, sim2, false))
                {
                    continue;
                }

                results.Add(sim2.CreatedSim);
            }

            return(results);
        }
Exemple #6
0
        protected int GetTotalFamily(Household house)
        {
            int total = 0;

            foreach (Household other in Household.GetHouseholdsLivingInWorld())
            {
                if (other == house)
                {
                    continue;
                }

                foreach (SimDescription otherSim in HouseholdsEx.All(other))
                {
                    bool found = false;
                    foreach (SimDescription sim in HouseholdsEx.All(house))
                    {
                        if (Relationships.IsCloselyRelated(sim, otherSim, false))
                        {
                            total++;
                            found = true;
                            //break;
                        }
                    }
                    if (found)
                    {
                        if (other == Household.ActiveHousehold)
                        {
                            return(int.MaxValue);
                        }
                        break;
                    }
                }
            }

            return(total);
        }
        protected override Condition CreateCondition()
        {
            var sysmenubar  = ControlType.MenuBar & StringProperties.AutomationID.Is("SystemMenuBar");
            var sysmenuitem = ControlType.MenuItem & Relationships.Parent(sysmenubar);

            // the Bounding rectangle property might be empty due to
            // a non-existent property, or an invalid data format.
            // If the Bounding rectangle property is not empty, it means all the above criteria were met successfully
            // So we only want to test for null when the BoundingRectangle property is empty.
            //
            // 2 exceptions related with Menubar "System" and Menu item "System".
            // These two are excluded since Windows 10 sets the bounding rectangles of these as null by default.
            // WPF Scrollbar page buttons may sometimes
            // legitimately be null or all zeros when the thumb control is at the maximum or minimum value.
            //
            // We also exclude cases handled by rules split from this rule
            return(IsNotOffScreen
                   & ~ListXAML               // Covered by BoundingRectangleNotNullListViewXAML
                   & ~HyperlinkInTextXAML    // Covered by BoundingRectangleNotNullTextBlockXAML
                   & ~WPFScrollBarPageButtons
                   & ~NonFocusableSliderButtons
                   & ~sysmenubar
                   & ~sysmenuitem);
        }
Exemple #8
0
        protected override Condition CreateCondition()
        {
            var sysmenubar  = ControlType.MenuBar & StringProperties.AutomationID.Is("SystemMenuBar");
            var sysmenuitem = ControlType.MenuItem & Relationships.Parent(sysmenubar);

            // This exception is meant to apply to the non-Chromium version of Edge
            var edgeGroups = ControlType.Group & StringProperties.Framework.Is(Framework.Edge);

            // the Bounding rectangle property might be empty due to
            // a non-existent property, or an invalid data format.
            // If the Bounding rectangle property is not empty, it means all the above criteria were met successfully
            // So we only want to test for null when the BoundingRectangle property is empty.
            //
            // 2 exceptions related with Menubar "System" and Menu item "System".
            // These two are excluded since Windows 10 sets the bounding rectangles of these as null by default.
            // WPF Scrollbar page buttons may sometimes
            // legitimately be null or all zeros when the thumb control is at the maximum or minimum value.
            return(IsNotOffScreen
                   & ~WPFScrollBarPageButtons
                   & ~NonFocusableSliderButtons
                   & ~edgeGroups
                   & ~sysmenubar
                   & ~sysmenuitem);
        }
Exemple #9
0
            protected static void OnRun(Scenario scenario, ScenarioFrame frame)
            {
                BirthScenario s = scenario as BirthScenario;

                if (s == null)
                {
                    return;
                }

                SimDescription mom = null;
                SimDescription dad = null;

                Relationships.GetParents(s.Babies[0], out mom, out dad);

                if ((mom != null) && (mom.Household == s.Babies[0].Household))
                {
                    scenario.Add(frame, new MaternityLeaveScenario(mom, s.Babies.Count), ScenarioResult.Start);
                }

                if ((scenario.GetValue <PaternityLeaveOption, bool>()) && (dad != null) && (dad.Household == s.Babies[0].Household))
                {
                    scenario.Add(frame, new MaternityLeaveScenario(dad, s.Babies.Count), ScenarioResult.Start);
                }
            }
Exemple #10
0
            public CreationProtection(SimDescription sim, Sim createdSim, bool performLoadFixup, bool performSelectable, bool performUnselectable)
            {
                try
                {
                    mSim = sim;

                    Corrections.RemoveFreeStuffAlarm(sim);

                    // Stops an issue in "GrantFutureObjects" regarding the use of sIsChangingWorlds=true
                    mWasFutureSim = sim.TraitManager.HasElement(TraitNames.FutureSim);
                    sim.TraitManager.RemoveElement(TraitNames.FutureSim);

                    if (SimTypes.IsSelectable(mSim))
                    {
                        Corrections.CleanupBrokenSkills(mSim, null);
                    }

                    if (OpportunityTrackerModel.gSingleton != null)
                    {
                        mOpportunitiesChanged = OpportunityTrackerModel.gSingleton.OpportunitiesChanged;
                        OpportunityTrackerModel.gSingleton.OpportunitiesChanged = null;
                    }

                    if (mSim.TraitChipManager != null)
                    {
                        mChips = mSim.TraitChipManager.GetAllTraitChips();
                        mSim.TraitChipManager.mTraitChipSlots = new TraitChip[7];
                        mSim.TraitChipManager.mValues.Clear();
                    }

                    if (createdSim != null)
                    {
                        if (createdSim.BuffManager != null)
                        {
                            mBuffs = new List <BuffInstance>();

                            foreach (BuffInstance buff in createdSim.BuffManager.List)
                            {
                                mBuffs.Add(buff);
                            }
                        }

                        if (createdSim.Motives != null)
                        {
                            Motive motive = createdSim.Motives.GetMotive(CommodityKind.AcademicPerformance);
                            if (motive != null)
                            {
                                mAcademicPerformance = motive.Value;
                            }

                            motive = createdSim.Motives.GetMotive(CommodityKind.UniversityStudy);
                            if (motive != null)
                            {
                                mUniversityStudy = motive.Value;
                            }
                        }

                        if (createdSim.Inventory != null)
                        {
                            mInventory = createdSim.Inventory.DestroyInventoryAndStoreInList();
                        }

                        mDreamStore = new DreamCatcher.DreamStore(createdSim, false, false);

                        mReservedVehicle           = createdSim.GetReservedVehicle();
                        createdSim.ReservedVehicle = null;
                    }

                    SafeStore.Flag flags = SafeStore.Flag.None;

                    if (performSelectable)
                    {
                        flags |= SafeStore.Flag.Selectable;
                    }

                    if (performLoadFixup)
                    {
                        flags |= SafeStore.Flag.LoadFixup;
                    }

                    if (performUnselectable)
                    {
                        flags |= SafeStore.Flag.Unselectable;
                    }

                    mSafeStore = new SafeStore(mSim, flags);

                    // Stops the startup errors when the imaginary friend is broken
                    mDoll = GetDollForSim(sim);
                    if (mDoll != null)
                    {
                        mDoll.mOwner = null;
                    }

                    mGenealogy = sim.mGenealogy;

                    mRelations = Relationships.StoreRelations(sim, null);

                    // Stops all event processing during the creation process
                    EventTracker.sCurrentlyUpdatingDreamsAndPromisesManagers = true;

                    // Stops the interface from updating during OnCreation
                    if (sim.Household != null)
                    {
                        mChangedCallback  = sim.Household.HouseholdSimsChanged;
                        mChangedHousehold = sim.Household;

                        sim.Household.HouseholdSimsChanged = null;
                    }

                    sChangingWorldsSuppression.Push();

                    // Stops SetGeneologyRelationshipBits()
                    sim.mGenealogy = new Genealogy(sim);
                }
                catch (Exception e)
                {
                    Common.Exception(sim, e);
                }
            }
Exemple #11
0
 public Follow()
 {
     relationships = new Relationships(Api.Config, Api.Auth);
 }
Exemple #12
0
        public override EvaluationCode Evaluate(IA11yElement e)
        {
            var rule = Relationships.All(Patterns.Invoke, Patterns.Toggle);

            return(rule.Matches(e) ? EvaluationCode.Error : EvaluationCode.Pass);
        }
Exemple #13
0
        protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            bool wasMarried = Sim.IsMarried;

            if (!Romances.BumpToLowerState(this, Sim, Target, false))
            {
                IncStat("Bump Fail");
                return(false);
            }

            if (wasMarried)
            {
                if (GetValue <RenameDivorceeOption, bool>())
                {
                    RenameDivorcee(Sim);
                    RenameDivorcee(Target);
                }
            }

            if (Sim.Household == Target.Household)
            {
                SimDescription go   = Sim;
                SimDescription stay = Target;

                SimDescription head = SimTypes.HeadOfFamily(Sim.Household);
                if (head != null)
                {
                    if (Relationships.IsCloselyRelated(Target, head, false))
                    {
                        stay = Target;
                        go   = Sim;
                    }
                    else if (Relationships.IsCloselyRelated(Sim, head, false))
                    {
                        stay = Sim;
                        go   = Target;
                    }
                    else if (RandomUtil.CoinFlip())
                    {
                        stay = Sim;
                        go   = Target;
                    }
                }

                HouseholdBreakdown.ChildrenMove goScore   = HouseholdBreakdown.ChildrenMove.Scoring;
                HouseholdBreakdown.ChildrenMove stayScore = HouseholdBreakdown.ChildrenMove.Scoring;
                if (mAffair)
                {
                    // Sim is cheater, so keep children with other parent
                    if (go == Sim)
                    {
                        if (mRelatedStay)
                        {
                            goScore   = HouseholdBreakdown.ChildrenMove.RelatedStay;
                            stayScore = HouseholdBreakdown.ChildrenMove.RelatedGo;
                        }
                        else
                        {
                            goScore   = HouseholdBreakdown.ChildrenMove.Stay;
                            stayScore = HouseholdBreakdown.ChildrenMove.Go;
                        }
                    }
                    else
                    {
                        if (mRelatedStay)
                        {
                            goScore   = HouseholdBreakdown.ChildrenMove.RelatedGo;
                            stayScore = HouseholdBreakdown.ChildrenMove.RelatedStay;
                        }
                        else
                        {
                            goScore   = HouseholdBreakdown.ChildrenMove.Go;
                            stayScore = HouseholdBreakdown.ChildrenMove.Stay;
                        }
                    }
                }

                Add(frame, new BreakupMoveOutScenario(go, stay, goScore), ScenarioResult.Failure);
                Add(frame, new BreakupMoveOutScenario(stay, go, stayScore), ScenarioResult.Failure);
            }

            return(true);
        }
Exemple #14
0
 public bool RelationshipExists(string id)
 {
     return(Relationships.ContainsKey(id));
 }
Exemple #15
0
        protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            SimDescription dad = ManagerSim.Find(Sim.Pregnancy.DadDescriptionId);

            if ((GetValue <SameSexSameGenderOption, bool>()) && (dad != null) && (dad.Gender == Sim.Gender))
            {
                IncStat("Same Sex");

                Sim.Pregnancy.mGender = Sim.Gender;
                return(true);
            }

            FirstBornGender firstBorn = GetValue <FirstBornGenderOption, FirstBornGender>();

            if (firstBorn == FirstBornGender.Male)
            {
                IncStat("First Born Male");

                Sim.Pregnancy.mGender = CASAgeGenderFlags.Male;
                return(true);
            }
            else if (firstBorn == FirstBornGender.Female)
            {
                IncStat("First Born Female");

                Sim.Pregnancy.mGender = CASAgeGenderFlags.Female;
                return(true);
            }
            else
            {
                if ((GetValue <OneOfEachGenderOption, bool>()) && (Sim.Genealogy != null))
                {
                    bool male = false, female = false;

                    foreach (SimDescription child in Relationships.GetChildren(Sim))
                    {
                        if (SimTypes.IsDead(child))
                        {
                            continue;
                        }

                        if (child.IsMale)
                        {
                            male = true;
                        }
                        else if (child.IsFemale)
                        {
                            female = true;
                        }
                    }

                    if (male)
                    {
                        if (!female)
                        {
                            Sim.Pregnancy.mGender = CASAgeGenderFlags.Female;
                            return(true);
                        }
                    }
                    else if (female)
                    {
                        Sim.Pregnancy.mGender = CASAgeGenderFlags.Male;
                        return(true);
                    }
                }

                if (firstBorn == FirstBornGender.Balanced)
                {
                    Sim.Pregnancy.mGender = CalculateGenderBalancer(Pregnancies, Sim.IsPet);
                    return(true);
                }
            }

            return(false);
        }
Exemple #16
0
 public ContactPerson GetContactPerson()
 {
     return(Relationships.GetRelatedObject <ContactPerson>("ContactPerson"));
 }
        protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            base.PrivateUpdate(frame);

            bool changed = false;

            foreach (Trait trait in new List <Trait>(Sim.TraitManager.List))
            {
                bool remove = false;

                if ((Sim.IsEP11Bot) && (!trait.IsHidden) && (!ActionData.IsBotSpecificTrait(trait.Guid)))
                {
                    remove = true;
                }

                if (HasValue <DisallowTraitOption, TraitNames>(Sim, trait.Guid))
                {
                    remove = true;
                }

                if (remove)
                {
                    Sim.TraitManager.RemoveElement(trait.Guid);

                    IncStat("Disallowed Trait Removed");

                    changed = true;
                }
            }

            if (changed)
            {
                GetData(Sim).InvalidateCache();
            }

            if (Sim.IsEP11Bot)
            {
                IncStat("Plumbot");
                return(true);
            }

            int required = Sim.TraitManager.NumTraitsForAge() - Sim.TraitManager.CountVisibleTraits();

            AddStat("Required", required);

            if (required <= 0)
            {
                if (GetValue <RemoveTraitsOption, bool>())
                {
                    List <Trait> traits = new List <Trait>(Sim.TraitManager.List.Count);

                    for (int i = traits.Count - 1; i >= 0; i--)
                    {
                        if (Sim.TraitManager.CountVisibleTraits() <= Sim.TraitManager.NumTraitsForAge())
                        {
                            break;
                        }

                        if ((traits[i].IsHidden) || (traits[i].IsReward))
                        {
                            continue;
                        }

                        Sim.TraitManager.RemoveElement(traits[i].Guid);
                        changed = true;

                        IncStat("Removed Excess");
                    }

                    if (changed)
                    {
                        GetData(Sim).InvalidateCache();
                    }
                    return(true);
                }
                else
                {
                    IncStat("Remove Disabled");
                    return(false);
                }
            }

            AddStat("Add", required);

            SimDescription mom = null, dad = null;

            Relationships.GetParents(Sim, out mom, out dad);

            if (mom != null)
            {
                if ((!SimTypes.IsDead(mom)) &&
                    (mom.TraitManager != null) &&
                    (!mom.TraitManager.TraitsMaxed()))
                {
                    IncStat("Hold For Parent");
                    return(false);
                }
            }

            if (dad != null)
            {
                if ((!SimTypes.IsDead(dad)) &&
                    (dad.TraitManager != null) &&
                    (!dad.TraitManager.TraitsMaxed()))
                {
                    IncStat("Hold For Parent");
                    return(false);
                }
            }

            try
            {
                Sims3.Gameplay.CAS.Genetics.AssignTraits(Sim, dad, mom, false, 0, new System.Random());
                IncStat("Success");

                GetData(Sim).InvalidateCache();
                return(true);
            }
            catch (Exception e)
            {
                Common.DebugException(Sim, e);
            }

            return(false);
        }
Exemple #18
0
 public void AddRelationship(ClientRelationship personName)
 {
     personName.ClientId = Id;
     Relationships.Add(personName);
 }
Exemple #19
0
            public void Dispose(bool postLoad, bool isReset)
            {
                try
                {
                    if (mWasFutureSim)
                    {
                        mSim.TraitManager.AddHiddenElement(TraitNames.FutureSim);
                    }

                    if (mSim.CreatedSim != null)
                    {
                        BuffManager buffManager = mSim.CreatedSim.BuffManager;
                        if ((buffManager != null) && (mBuffs != null))
                        {
                            foreach (BuffInstance buff in mBuffs)
                            {
                                buffManager.AddBuff(buff.Guid, buff.mEffectValue, buff.mTimeoutCount, buff.mTimeoutPaused, buff.mAxisEffected, buff.mBuffOrigin, false);
                            }
                        }

                        if ((mInventory != null) && (mSim.CreatedSim.Inventory != null))
                        {
                            Inventories.RestoreInventoryFromList(mSim.CreatedSim.Inventory, mInventory, true);
                        }

                        if (mDreamStore != null)
                        {
                            mDreamStore.Restore(mSim.CreatedSim);
                        }

                        if (mSafeStore != null)
                        {
                            mSafeStore.Dispose();
                        }

                        if (mSim.DeathStyle != SimDescription.DeathType.None)
                        {
                            Urnstone stone = Urnstones.FindGhostsGrave(mSim);
                            if (stone != null)
                            {
                                stone.GhostSetup(mSim.CreatedSim, true);
                            }
                        }

                        mSim.CreatedSim.ReservedVehicle = mReservedVehicle;
                    }
                }
                catch (Exception e)
                {
                    Common.Exception(mSim, null, "Inventory", e);
                }

                // Must be after the opportunities are restored
                if ((mOpportunitiesChanged != null) && (OpportunityTrackerModel.gSingleton != null))
                {
                    OpportunityTrackerModel.gSingleton.OpportunitiesChanged = mOpportunitiesChanged;
                }

                try
                {
                    if (!postLoad)
                    {
                        if ((mSim.CreatedSim != null) &&
                            (mSim.CreatedSim.OpportunityManager != null) &&
                            (mSim.CreatedSim.OpportunityManager.Count > 0))
                        {
                            OpportunityTrackerModel.FireOpportunitiesChanged();
                        }
                    }
                }
                catch (Exception e)
                {
                    Common.Exception(mSim, null, "FireOpportunitiesChanged", e);
                }

                EventTracker.sCurrentlyUpdatingDreamsAndPromisesManagers = false;

                mSim.mGenealogy = mGenealogy;

                if (mDoll != null)
                {
                    mDoll.mOwner = mSim;

                    if (SimTypes.IsSelectable(mSim))
                    {
                        try
                        {
                            mDoll.OnOwnerBecameSelectable();
                        }
                        catch (Exception e)
                        {
                            Common.Exception(mSim, e);

                            SimDescription sim = mDoll.GetLiveFormSimDescription();
                            if (sim != null)
                            {
                                new FixInvisibleTask(sim).AddToSimulator();
                            }
                        }
                    }
                }

                if ((mSim.CreatedSim != null) && (mSim.CreatedSim.Motives != null))
                {
                    if (mAcademicPerformance != -101)
                    {
                        mSim.CreatedSim.Motives.CreateMotive(CommodityKind.AcademicPerformance);
                        Motive motive = mSim.CreatedSim.Motives.GetMotive(CommodityKind.AcademicPerformance);
                        if (motive != null)
                        {
                            motive.Value = mAcademicPerformance;
                        }
                    }

                    if (mUniversityStudy != -101)
                    {
                        mSim.CreatedSim.Motives.CreateMotive(CommodityKind.UniversityStudy);
                        Motive motive = mSim.CreatedSim.Motives.GetMotive(CommodityKind.UniversityStudy);
                        if (motive != null)
                        {
                            motive.Value = mUniversityStudy;
                        }
                    }
                }

                Relationships.RestoreRelations(mSim, mRelations);

                if ((mSim.TraitChipManager != null) && (mChips != null))
                {
                    for (int i = 0; i < mChips.Length; i++)
                    {
                        if (mChips[i] == null)
                        {
                            continue;
                        }

                        Common.StringBuilder name = new Common.StringBuilder();
                        try
                        {
                            name.Append(mChips[i].GetLocalizedName());

                            mSim.TraitChipManager.AddTraitChip(mChips[i], i);
                        }
                        catch (Exception e)
                        {
                            Common.Exception(mSim, null, name, e);
                        }
                    }
                }

                sChangingWorldsSuppression.Pop();

                if ((mChangedHousehold != null) && (mChangedCallback != null))
                {
                    mChangedHousehold.HouseholdSimsChanged = mChangedCallback;
                }
            }
 public void AddRelationship(string schemaname, XrmFakedRelationship relationship)
 {
     Relationships.Add(schemaname, relationship);
 }
        private static void SetupRelationshipOriginal_Postfix(Agent otherAgent, Relationships __instance, ref Agent ___agent)
        {
            // Relationships defines how ___agent feels about otherAgent
            // Don't delete this comment, it gets confusing-er-than-shit

            if (GameController.gameController.levelType == nameof(InterfaceNameDB.rowIds.HomeBase))
            {
                __instance.SetRelInitial(otherAgent, nameof(relStatus.Aligned));
                otherAgent.relationships.SetRelInitial(___agent, nameof(relStatus.Aligned));

                return;
            }

            string currentRelationship = __instance.GetRel(otherAgent);

            if (currentRelationship == null)
            {
                logger.LogWarning("SetupRelationshipOriginal - currentRelationship was null!");

                return;
            }

            relStatus?newRelationship;

            if (___agent.IsAgent(AgentNameDB.rowIds.ResistanceLeader) && otherAgent.isPlayer > 0)
            {
                newRelationship = relStatus.Aligned;
            }
            else
            {
                // Order matters here, the first non-Null relStatus will be used.
                newRelationship =
                    MobDebt.SetupInitialRelationship(___agent, otherAgent, currentRelationship)
                    ?? Domineering.SetupInitialRelationship(___agent, otherAgent, currentRelationship)
                    ?? Domineering2.SetupInitialRelationship(___agent, otherAgent, currentRelationship)
                    ?? Polarizing.SetupInitialRelationship(___agent, otherAgent, currentRelationship)
                    ?? Polarizing2.SetupInitialRelationship(___agent, otherAgent, currentRelationship)
                    ?? BootLicker.SetupInitialRelationship(___agent, otherAgent, currentRelationship)
                    ?? Priors.SetupInitialRelationship(___agent, otherAgent, currentRelationship)
                    ?? GenerallyUnpleasant.SetupInitialRelationship(___agent, otherAgent, currentRelationship)
                    ?? ObjectivelyUnpleasant.SetupInitialRelationship(___agent, otherAgent, currentRelationship);
            }

            if (newRelationship != null)
            {
                string relationshipString = newRelationship.Value.ToString();
                __instance.SetRelInitial(otherAgent, relationshipString);
                otherAgent.relationships.SetRelInitial(___agent, relationshipString);

                if (newRelationship.Value == relStatus.Annoyed)
                {
                    otherAgent.relationships.SetStrikes(___agent, 2);
                    __instance.SetStrikes(otherAgent, 2);
                }
                else if (newRelationship.Value == relStatus.Hostile)
                {
                    otherAgent.relationships.SetStrikes(___agent, 5);
                    __instance.SetStrikes(otherAgent, 5);
                }
            }
        }
 public XRoot(Relationships root) {
     this.doc = new XDocument(root.Untyped);
     this.rootObject = root;
 }
Exemple #23
0
        private SimDescription FindPartner(SimDescription parent, List <SimDescription> dyingSims)
        {
            SimDescription description = null;
            float          liking      = -100f;

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

            foreach (Relationship relationship in Relationship.GetRelationships(parent))
            {
                SimDescription otherSimDescription = relationship.GetOtherSimDescription(parent);
                if (otherSimDescription.Household == null)
                {
                    continue;
                }

                if (otherSimDescription.Household.IsPreviousTravelerHousehold)
                {
                    continue;
                }

                if (otherSimDescription.Household.IsTravelHousehold)
                {
                    continue;
                }

                if (((parent.Gender != otherSimDescription.Gender) && (otherSimDescription.Partner == null)) && !otherSimDescription.IsMummy)
                {
                    if (relationship.AreRomantic())
                    {
                        list.Add(otherSimDescription);
                    }
                    else if ((!Relationships.IsCloselyRelated(parent, otherSimDescription, false) && parent.CheckAutonomousGenderPreference(otherSimDescription)) && (otherSimDescription.CheckAutonomousGenderPreference(parent) && (relationship.LTR.Liking > liking)))
                    {
                        liking      = relationship.LTR.Liking;
                        description = otherSimDescription;
                    }
                }
            }

            if (list.Count > 0x0)
            {
                return(list[RandomUtil.GetInt(list.Count - 0x1)]);
            }

            foreach (SimDescription description3 in dyingSims)
            {
                if ((((parent.Gender != description3.Gender) && (description3.Partner == null)) && (!description3.IsMummy && !Relationships.IsCloselyRelated(parent, description3, false))) && (parent.CheckAutonomousGenderPreference(description3) && description3.CheckAutonomousGenderPreference(parent)))
                {
                    list.Add(description3);
                }
            }

            if (list.Count > 0x0)
            {
                return(list[RandomUtil.GetInt(list.Count - 0x1)]);
            }

            return(description);
        }
        public void SetUp()
        {
            IPersonStore PersonStore = new PersonStore();

            george                = PersonStore.AddPerson("George", Gender.Male);
            mary                  = PersonStore.AddPerson("Mary", Gender.Female);
            bob                   = PersonStore.AddPerson("Bob", Gender.Male);
            sally                 = PersonStore.AddPerson("Sally", Gender.Female);
            dave                  = PersonStore.AddPerson("Dave", Gender.Male);
            davesMaternalUncle    = PersonStore.AddPerson("Hulk", Gender.Male);
            davesPaternalAunt     = PersonStore.AddPerson("Aunt", Gender.Female);
            davesMaternalGrandDad = PersonStore.AddPerson("Thor", Gender.Male);
            davesMaternalGrandMom = PersonStore.AddPerson("Wonder", Gender.Female);
            davesPaternalGrandDad = PersonStore.AddPerson("Thor1", Gender.Male);
            davesPaternalGrandMom = PersonStore.AddPerson("Wonder1", Gender.Female);

            amy          = PersonStore.AddPerson("Amy", Gender.Female);
            bamy         = PersonStore.AddPerson("Bamy", Gender.Female);
            miller       = PersonStore.AddPerson("Miller", Gender.Male);
            amysBrother  = PersonStore.AddPerson("BigB", Gender.Male);
            amysBrother1 = PersonStore.AddPerson("ABig", Gender.Male);
            amysMom      = PersonStore.AddPerson("Miley", Gender.Female);
            amysDad      = PersonStore.AddPerson("Brad", Gender.Male);

            FamilyGraph familyGraph = new FamilyGraph(PersonStore);

            //Daves Family
            familyGraph.AddRelationship("Thor", "Mary", "Parent");
            familyGraph.AddRelationship("Wonder", "Mary", "Parent");
            familyGraph.AddRelationship("Thor", "Hulk", "Parent");
            familyGraph.AddRelationship("Wonder", "Hulk", "Parent");

            familyGraph.AddRelationship("Thor1", "George", "Parent");
            familyGraph.AddRelationship("Wonder1", "George", "Parent");
            familyGraph.AddRelationship("Thor1", "Aunt", "Parent");
            familyGraph.AddRelationship("Wonder1", "Aunt", "Parent");

            familyGraph.AddRelationship("George", "Bob", "Parent");
            familyGraph.AddRelationship("Mary", "Bob", "Parent");
            familyGraph.AddRelationship("George", "Dave", "Parent");
            familyGraph.AddRelationship("Mary", "Dave", "Parent");
            familyGraph.AddRelationship("George", "Sally", "Parent");
            familyGraph.AddRelationship("Mary", "Sally", "Parent");


            //Spouse
            familyGraph.AddRelationship("Dave", "Amy", "Spouse");

            //Amy's Family
            familyGraph.AddRelationship("Brad", "Miller", "Parent");
            familyGraph.AddRelationship("Miley", "Miller", "Parent");
            familyGraph.AddRelationship("Brad", "ABig", "Parent");
            familyGraph.AddRelationship("Miley", "ABig", "Parent");
            familyGraph.AddRelationship("Brad", "BigB", "Parent");
            familyGraph.AddRelationship("Miley", "BigB", "Parent");
            familyGraph.AddRelationship("Brad", "Amy", "Parent");
            familyGraph.AddRelationship("Miley", "Amy", "Parent");
            familyGraph.AddRelationship("Brad", "Bamy", "Parent");
            familyGraph.AddRelationship("Miley", "Bamy", "Parent");

            relationships = new Relationships(familyGraph);
        }
Exemple #25
0
 internal void ResetClient()
 {
     Relationships.Clear();
 }
 protected override ICollection <SimDescription> GetTargets(SimDescription sim)
 {
     return(Relationships.GetParents(sim));
 }
 public void RemoveRelationship(string schemaname)
 {
     Relationships.Remove(schemaname);
 }
        public override bool PassesTest(IA11yElement e)
        {
            var rule = Relationships.All(Patterns.Invoke, Patterns.ExpandCollapse);

            return(!rule.Matches(e));
        }
Exemple #29
0
 public IBusinessObjectCollection GetCarsDriven()
 {
     return(Relationships.GetRelatedCollection("Driver"));
 }
Exemple #30
0
 public ContactPersonTestBO GetContactPerson()
 {
     return(Relationships.GetRelatedObject <ContactPersonTestBO>("ContactPersonTestBO"));
 }
Exemple #31
0
 public void AddRelationship(IRelationship relationship)
 {
     Relationships.Add(relationship);
 }
Exemple #32
0
 public IModelRelationship GetRelationship(IRoslynModelNode sourceNode, IRoslynModelNode targetNode, ModelRelationshipStereotype stereotype)
 => Relationships.FirstOrDefault(i => i.Source == sourceNode && i.Target == targetNode && i.Stereotype == stereotype);