예제 #1
0
        /// <summary>
        /// This function returns the key for a given dialogue.
        /// </summary>
        /// <param name="character">NPC for the dialogue</param>
        /// <returns>The key for the dialogue</returns>
        private string GetDialogueForConditions(NPC character)
        {
            //json format ex: abigail[10]summer_4_4_spouse
            // name[heartlevel]season_healthstatus_staminastatus_timeofday_spousestatus
            CharacterDetails newDetails = new CharacterDetails
            {
                Name          = character.Name,
                Age           = character.Age,
                Manners       = character.Manners,
                SocialAnxiety = character.SocialAnxiety,
                Optimism      = character.Optimism,
                HeartLevel    = GetHeartLevel(character), //Game1.player.getFriendshipHeartLevelForNPC(character.Name),
                HealthStatus  = GetLevelOnScale(Game1.player.health, Game1.player.maxHealth),
                StaminaStatus = Game1.player.exhausted.Value ? "Very Low" : GetLevelOnScale(Game1.player.Stamina, Game1.player.MaxStamina),
                TimeOfDay     = GetTimeOfDay(Game1.timeOfDay),
                SeasonDay     = string.Concat(Game1.currentSeason, Game1.dayOfMonth),
                SeasonDayFB   = Game1.currentSeason
            };

            //Monitor.Log(newDetails.ToString(), LogLevel.Info);

            foreach (string key in GetKeys(newDetails))
            {
                if (ModDialogues.ContainsKey(key))
                {
                    return(key);
                }
            }

            //fallback to default if EVERYTHING's missing.
            return("");
        }
예제 #2
0
        private IEnumerable <string> GetKeys(CharacterDetails detailSet)
        {
            //specific to inspecific tied to specific NPCs
            yield return($"{detailSet.Name}[{detailSet.HeartLevel}]_{detailSet.SeasonDay}_{detailSet.HealthStatus}_{detailSet.StaminaStatus}_{detailSet.TimeOfDay}");

            yield return($"{detailSet.Name}[{detailSet.HeartLevel}]_{detailSet.SeasonDay}_{detailSet.HealthStatus}_{detailSet.StaminaStatus}");

            yield return($"{detailSet.Name}[{detailSet.HeartLevel}]_{detailSet.SeasonDayFB}_{detailSet.HealthStatus}_{detailSet.StaminaStatus}");

            yield return($"{detailSet.Name}[{detailSet.HeartLevel}]_{detailSet.SeasonDay}_{detailSet.StaminaStatus}");

            yield return($"{detailSet.Name}[{detailSet.HeartLevel}]_{detailSet.SeasonDayFB}_{detailSet.StaminaStatus}");

            yield return($"{detailSet.Name}[{detailSet.HeartLevel}]_{detailSet.SeasonDay}_{detailSet.HealthStatus}");

            yield return($"{detailSet.Name}[{detailSet.HeartLevel}]_{detailSet.SeasonDayFB}_{detailSet.HealthStatus}");

            yield return($"{detailSet.Name}[{detailSet.HeartLevel}]_{detailSet.HealthStatus}_{detailSet.StaminaStatus}");

            yield return($"{detailSet.Name}[{detailSet.HeartLevel}]_{detailSet.StaminaStatus}");

            yield return($"{detailSet.Name}[{detailSet.HeartLevel}]_{detailSet.HealthStatus}");


            yield return($"{detailSet.Name}_{detailSet.SeasonDay}_{detailSet.HealthStatus}_{detailSet.StaminaStatus}");

            yield return($"{detailSet.Name}_{detailSet.SeasonDayFB}_{detailSet.HealthStatus}_{detailSet.StaminaStatus}");

            yield return($"{detailSet.Name}_{detailSet.SeasonDay}_{detailSet.StaminaStatus}");

            yield return($"{detailSet.Name}_{detailSet.SeasonDayFB}_{detailSet.StaminaStatus}");

            yield return($"{detailSet.Name}_{detailSet.SeasonDay}_{detailSet.HealthStatus}");

            yield return($"{detailSet.Name}_{detailSet.SeasonDayFB}_{detailSet.HealthStatus}");

            //fallback to disposition text
            //age, manners?,social anxiety, optimism
            //format is:
            //age_manners_social_timeofday_optimism
            yield return($"{detailSet.Age}_{detailSet.Manners}_{detailSet.SocialAnxiety}_{detailSet.SeasonDay}_{detailSet.TimeOfDay}_{detailSet.Optimism}_{detailSet.HealthStatus}_{detailSet.StaminaStatus}");

            yield return($"{detailSet.Age}_{detailSet.Manners}_{detailSet.SocialAnxiety}_{detailSet.SeasonDayFB}_{detailSet.TimeOfDay}_{detailSet.Optimism}_{detailSet.HealthStatus}_{detailSet.StaminaStatus}");

            yield return($"{detailSet.Age}_{detailSet.Manners}_{detailSet.SocialAnxiety}_{detailSet.SeasonDay}_{detailSet.TimeOfDay}_{detailSet.Optimism}_{detailSet.StaminaStatus}");

            yield return($"{detailSet.Age}_{detailSet.Manners}_{detailSet.SocialAnxiety}_{detailSet.SeasonDayFB}_{detailSet.TimeOfDay}_{detailSet.Optimism}_{detailSet.StaminaStatus}");

            yield return($"{detailSet.Age}_{detailSet.Manners}_{detailSet.SocialAnxiety}_{detailSet.SeasonDay}_{detailSet.TimeOfDay}_{detailSet.Optimism}_{detailSet.HealthStatus}");

            yield return($"{detailSet.Age}_{detailSet.Manners}_{detailSet.SocialAnxiety}_{detailSet.SeasonDayFB}_{detailSet.TimeOfDay}_{detailSet.Optimism}_{detailSet.HealthStatus}");

            //-Optimism
            yield return($"{detailSet.Age}_{detailSet.Manners}_{detailSet.SocialAnxiety}_{detailSet.SeasonDay}_{detailSet.TimeOfDay}_{detailSet.HealthStatus}_{detailSet.StaminaStatus}");

            yield return($"{detailSet.Age}_{detailSet.Manners}_{detailSet.SocialAnxiety}_{detailSet.SeasonDayFB}_{detailSet.TimeOfDay}_{detailSet.HealthStatus}_{detailSet.StaminaStatus}");

            yield return($"{detailSet.Age}_{detailSet.Manners}_{detailSet.SocialAnxiety}_{detailSet.SeasonDay}_{detailSet.TimeOfDay}_{detailSet.StaminaStatus}");

            yield return($"{detailSet.Age}_{detailSet.Manners}_{detailSet.SocialAnxiety}_{detailSet.SeasonDayFB}_{detailSet.TimeOfDay}_{detailSet.StaminaStatus}");

            yield return($"{detailSet.Age}_{detailSet.Manners}_{detailSet.SocialAnxiety}_{detailSet.SeasonDay}_{detailSet.TimeOfDay}_{detailSet.HealthStatus}");

            yield return($"{detailSet.Age}_{detailSet.Manners}_{detailSet.SocialAnxiety}_{detailSet.SeasonDayFB}_{detailSet.TimeOfDay}_{detailSet.HealthStatus}");

            //-Time Of Day
            yield return($"{detailSet.Age}_{detailSet.Manners}_{detailSet.SocialAnxiety}_{detailSet.SeasonDay}_{detailSet.HealthStatus}_{detailSet.StaminaStatus}");

            yield return($"{detailSet.Age}_{detailSet.Manners}_{detailSet.SocialAnxiety}_{detailSet.SeasonDayFB}_{detailSet.HealthStatus}_{detailSet.StaminaStatus}");

            yield return($"{detailSet.Age}_{detailSet.Manners}_{detailSet.SocialAnxiety}_{detailSet.SeasonDay}_{detailSet.StaminaStatus}");

            yield return($"{detailSet.Age}_{detailSet.Manners}_{detailSet.SocialAnxiety}_{detailSet.SeasonDayFB}_{detailSet.StaminaStatus}");

            yield return($"{detailSet.Age}_{detailSet.Manners}_{detailSet.SocialAnxiety}_{detailSet.SeasonDay}_{detailSet.HealthStatus}");

            yield return($"{detailSet.Age}_{detailSet.Manners}_{detailSet.SocialAnxiety}_{detailSet.SeasonDayFB}_{detailSet.HealthStatus}");

            // -Social -Seasonday! :D
            yield return($"{detailSet.Age}_{detailSet.Manners}_{detailSet.HealthStatus}_{detailSet.StaminaStatus}");

            yield return($"{detailSet.Age}_{detailSet.Manners}_{detailSet.StaminaStatus}");

            yield return($"{detailSet.Age}_{detailSet.Manners}_{detailSet.HealthStatus}");

            //+SeasonDay. -Manners :v
            yield return($"{detailSet.Age}_{detailSet.SeasonDay}_{detailSet.HealthStatus}_{detailSet.StaminaStatus}");

            yield return($"{detailSet.Age}_{detailSet.SeasonDayFB}_{detailSet.HealthStatus}_{detailSet.StaminaStatus}");

            yield return($"{detailSet.Age}_{detailSet.SeasonDay}_{detailSet.StaminaStatus}");

            yield return($"{detailSet.Age}_{detailSet.SeasonDayFB}_{detailSet.StaminaStatus}");

            yield return($"{detailSet.Age}_{detailSet.SeasonDay}_{detailSet.HealthStatus}");

            yield return($"{detailSet.Age}_{detailSet.SeasonDayFB}_{detailSet.HealthStatus}");

            //just timeOfDay + Manners
            yield return($"{detailSet.Manners}_{detailSet.TimeOfDay}_{detailSet.HealthStatus}_{detailSet.StaminaStatus}");

            yield return($"{detailSet.Manners}_{detailSet.TimeOfDay}_{detailSet.StaminaStatus}");

            yield return($"{detailSet.Manners}_{detailSet.TimeOfDay}_{detailSet.HealthStatus}");

            //just timeOfDay + Age
            yield return($"{detailSet.Age}_{detailSet.TimeOfDay}_{detailSet.HealthStatus}_{detailSet.StaminaStatus}");

            yield return($"{detailSet.Age}_{detailSet.TimeOfDay}_{detailSet.StaminaStatus}");

            yield return($"{detailSet.Age}_{detailSet.TimeOfDay}_{detailSet.HealthStatus}");

            //just age
            yield return($"{detailSet.Age}_{detailSet.HealthStatus}_{detailSet.StaminaStatus}");

            yield return($"{detailSet.Age}_{detailSet.StaminaStatus}");

            yield return($"{detailSet.Age}_{detailSet.HealthStatus}");

            //just manners
            yield return($"{detailSet.Manners}_{detailSet.HealthStatus}_{detailSet.StaminaStatus}");

            yield return($"{detailSet.Manners}_{detailSet.StaminaStatus}");

            yield return($"{detailSet.Manners}_{detailSet.HealthStatus}");
        }