示例#1
0
        public void AddPlayerRelationship(WowPlayer player, RelationshipLevel initialRelationship = RelationshipLevel.Neutral)
        {
            if (!IsPlayerKnown(player))
            {
                PlayerRelationships.TryAdd(player.Guid, new Relationship()
                {
                    Score             = (float)initialRelationship,
                    FirstSeen         = DateTime.Now,
                    FirstSeenMapId    = WowInterface.I.ObjectManager.MapId,
                    FirstSeenPosition = player.Position
                });
            }

            PlayerRelationships[player.Guid].Poll(player);
        }
示例#2
0
 public RelationshipEntry(string a1, string a2, RelationshipLevel rl)
 {
     Actor1 = a1;
     Actor2 = a2;
     RelationshipRequired = rl;
 }
示例#3
0
 public void InitDisplay(string actor1, string actor2, RelationshipLevel relationshipLevel)
 {
     Description.text = actor1 + " and " + actor2 + ": " + relationshipLevel.ToString();
 }
示例#4
0
        public bool Parse(XmlDbRow row, StoryProgressionObject manager, IUpdateManager updater, string prefix, bool errorIfNone, ref string error)
        {
            mDisallowRelated = row.GetBool(prefix + "DisallowRelated");

            if (row.Exists(prefix + "StandardFilter"))
            {
                mEnabled = true;

                if (!ParserFunctions.TryParseEnum <StandardFilter>(row.GetString(prefix + "StandardFilter"), out mStandardFilter, StandardFilter.None))
                {
                    error = prefix + "StandardFilter invalid";
                    return(false);
                }
            }

            string customTest = row.GetString(prefix + "CustomTest");

            mCustomTest = new Common.MethodStore(customTest, new Type[] { typeof(Parameters), typeof(SimDescription), typeof(SimDescription) });
            if ((mCustomTest == null) && (!string.IsNullOrEmpty(customTest)))
            {
                error = prefix + "CustomTest Invalid";
                return(false);
            }

            switch (mStandardFilter)
            {
            case StandardFilter.ExistingFriend:
            case StandardFilter.ExistingEnemy:
            case StandardFilter.Nemesis:
                if (!row.Exists(prefix + "StandardIgnoreBusy"))
                {
                    error = prefix + "StandardIgnoreBusy missing";
                    return(false);
                }

                mStandardIgnoreBusy = row.GetBool(prefix + "StandardIgnoreBusy");
                break;
            }

            switch (mStandardFilter)
            {
            case StandardFilter.ExistingFriend:
            case StandardFilter.ExistingEnemy:
                RelationshipLevel standardLevel;
                if (ParserFunctions.TryParseEnum <RelationshipLevel>(row.GetString(prefix + "StandardGate"), out standardLevel, RelationshipLevel.Neutral))
                {
                    mStandardGate = (int)standardLevel;
                }
                else
                {
                    RelationshipLevel defGate = RelationshipLevel.Neutral;
                    if (mStandardFilter == StandardFilter.ExistingFriend)
                    {
                        defGate = RelationshipLevel.Friend;
                    }
                    else
                    {
                        defGate = RelationshipLevel.Enemy;
                    }
                    mStandardGate = row.GetInt(prefix + "StandardGate", (int)defGate);
                }

                break;

            case StandardFilter.ExistingFlirt:
            case StandardFilter.ExistingOrAnyFlirt:
                if (!row.Exists(prefix + "StandardDisallowPartner"))
                {
                    error = prefix + "StandardDisallowPartner missing";
                    return(false);
                }

                break;
            }

            // The default for DisallowPartner can be altered by the calling system, don't overwrite it
            if (row.Exists(prefix + "StandardDisallowPartner"))
            {
                mStandardDisallowPartner = row.GetBool(prefix + "StandardDisallowPartner");
            }

            switch (mStandardFilter)
            {
            case StandardFilter.AnyFlirt:
            case StandardFilter.ExistingOrAnyFlirt:
                if (!row.Exists(prefix + "AllowAffair"))
                {
                    error = prefix + "AllowAffair missing";
                    return(false);
                }

                break;
            }

            if (row.Exists(prefix + "AllowOpposing"))
            {
                mAllowOpposing = row.GetBool(prefix + "AllowOpposing");
            }
            else
            {
                mAllowOpposing = true;
            }

            if (row.Exists("AllowAffair"))
            {
                error = prefix + "AllowAffair misdefined";
                return(false);
            }
            else if (row.Exists(prefix + "AllowAffair"))
            {
                mAllowAffair = row.GetBool(prefix + "AllowAffair");
            }
            else
            {
                mAllowAffair = false;
            }

            if (row.Exists(prefix + "ThirdPartyFilter"))
            {
                mEnabled = true;

                if (!ParserFunctions.TryParseEnum <ThirdPartyFilter>(row.GetString(prefix + "ThirdPartyFilter"), out mThirdPartyFilter, ThirdPartyFilter.None))
                {
                    error = prefix + "ThirdPartyFilter invalid";
                    return(false);
                }
            }

            mScoring = row.GetString(prefix + "Scoring");

            if (!string.IsNullOrEmpty(mScoring))
            {
                mEnabled = true;

                if (ScoringLookup.GetScoring(mScoring) == null)
                {
                    error = mScoring + " missing";
                    return(false);
                }

                if ((!row.Exists(prefix + "ScoringMinimum")) && (!row.Exists(prefix + "ScoringMaximum")))
                {
                    error = prefix + "ScoringMinimum missing";
                    return(false);
                }
            }

            mScoringMaximum = row.GetInt(prefix + "ScoringMaximum", int.MaxValue);
            mScoringMinimum = row.GetInt(prefix + "ScoringMinimum", int.MinValue);

            if (mScoringMinimum > mScoringMaximum)
            {
                int scoring = mScoringMinimum;
                mScoringMinimum = mScoringMaximum;
                mScoringMaximum = scoring;
            }

            if ((row.Exists(prefix + "RelationshipMinimum")) || (row.Exists(prefix + "RelationshipMaximum")))
            {
                mEnabled = true;
            }

            RelationshipLevel relationLevel;

            if (ParserFunctions.TryParseEnum <RelationshipLevel>(row.GetString(prefix + "RelationshipMaximum"), out relationLevel, RelationshipLevel.Neutral))
            {
                mRelationshipMaximum = (int)relationLevel;
            }
            else
            {
                mRelationshipMaximum = row.GetInt(prefix + "RelationshipMaximum", 101);
            }

            if (ParserFunctions.TryParseEnum <RelationshipLevel>(row.GetString(prefix + "RelationshipMinimum"), out relationLevel, RelationshipLevel.Neutral))
            {
                mRelationshipMinimum = (int)relationLevel;
            }
            else
            {
                mRelationshipMinimum = row.GetInt(prefix + "RelationshipMinimum", -101);
            }

            if (mRelationshipMinimum > mRelationshipMaximum)
            {
                int scoring = mRelationshipMinimum;
                mRelationshipMinimum = mRelationshipMaximum;
                mRelationshipMaximum = scoring;
            }

            mClan = row.GetString(prefix + "Clan");
            if (!string.IsNullOrEmpty(mClan))
            {
                mEnabled = true;
            }

            if (row.Exists(prefix + "ClanLeader"))
            {
                mEnabled = true;
            }

            mClanLeader = row.GetBool(prefix + "ClanLeader");

            if (row.Exists(prefix + "ClanMembers"))
            {
                mEnabled = true;
            }

            mClanMembers = row.GetBool(prefix + "ClanMembers");

            string ageGender = row.GetString(prefix + "AgeGender");

            if (!string.IsNullOrEmpty(ageGender))
            {
                mEnabled = true;

                if (!ParserFunctions.TryParseEnum <CASAgeGenderFlags>(ageGender, out mAgeGender, CASAgeGenderFlags.None))
                {
                    error = "Unknown AgeGender " + ageGender;
                    return(false);
                }
            }

            StringToSpeciesList converter = new StringToSpeciesList();

            mSpecies = converter.Convert(row.GetString(prefix + "Species"));
            if (mSpecies == null)
            {
                error = converter.mError;
                return(false);
            }

            if (mSpecies.Count == 0)
            {
                mSpecies.Add(CASAgeGenderFlags.Human);
            }

            for (int i = 0; i < 10; i++)
            {
                string key = prefix + "UserAgeGender" + i;
                if (!row.Exists(key))
                {
                    break;
                }

                mEnabled = true;

                string name = row.GetString(key);

                AgeGenderOption option = manager.GetOption <AgeGenderOption>(name);
                if (option == null)
                {
                    error = prefix + "UserAgeGender" + i + " " + name + " missing";
                    return(false);
                }

                mUserAgeGenders.Add(name);
            }

            for (int i = 0; i < 10; i++)
            {
                string key = prefix + "ValueTest" + i;
                if (!row.Exists(key))
                {
                    break;
                }

                mEnabled = true;

                string name = row.GetString(key);

                int min = row.GetInt(key + "Minimum", int.MinValue);
                int max = row.GetInt(key + "Maximum", int.MaxValue);

                bool match = true;
                if (row.Exists(key + "Match"))
                {
                    match = row.GetBool(key + "Match");
                }

                mValueTestLoads.Add(new ValueTestLoadStore(name, min, max, match));
            }

            if ((!mEnabled) && (errorIfNone))
            {
                error = prefix + " Filter missing";
                return(false);
            }

            updater.AddUpdater(this);
            return(true);
        }
示例#5
0
 public void AddRelationship(string actorkey, string actorkey2, RelationshipLevel relationshipThreshold, string cutscenekey)
 {
     RelationshipDict[new RelationshipEntry(actorkey, actorkey2, relationshipThreshold)] = cutscenekey;
 }