Пример #1
0
        public static bool GetVariousDialogueString(NPC n, string key, out string text)
        {
            Farmer f = Game1.player;
            VariousKeyGenerator keygen = new VariousKeyGenerator()
            {
                Date                 = SDate.Now(),
                IsNight              = Game1.isDarkOut(),
                IsMarried            = Helper.IsSpouseMarriedToFarmer(n, f),
                FriendshipHeartLevel = f.getFriendshipHeartLevelForNPC(n.Name),
                Weather              = Helper.GetCurrentWeatherName(),
            };

            // Generate possible dialogue keys
            keygen.GenerateVariousKeys(key);

            // Try to find a relevant dialogue
            foreach (string k in keygen.PossibleKeys)
            {
                if (GetDialogueString(n, k, out text))
                {
                    return(true);
                }
            }

            text = key;
            return(false);
        }
Пример #2
0
        public static bool GetVariableRawDialogue(NPC n, string key, out KeyValuePair <string, string> rawDialogue)
        {
            Farmer f = Game1.player;
            VariousKeyGenerator keygen = new VariousKeyGenerator()
            {
                Date                 = SDate.Now(),
                IsNight              = Game1.isDarkOut(),
                IsMarried            = Helper.IsSpouseMarriedToFarmer(n, f),
                FriendshipHeartLevel = f.getFriendshipHeartLevelForNPC(n.Name),
                Weather              = Helper.GetCurrentWeatherName(),
            };

            // Generate possible dialogue keys
            keygen.GenerateVariousKeys(key);

            // Try to find a relevant dialogue
            foreach (string k in keygen.PossibleKeys)
            {
                if (GetRawDialogue(n, k, out rawDialogue))
                {
                    return(true);
                }
            }

            rawDialogue = new KeyValuePair <string, string>(key, $"{n.Name}.{key}");

            return(false);
        }