Exemple #1
0
    // Token: 0x06000EC9 RID: 3785 RVA: 0x000699DC File Offset: 0x00067BDC
    public bool Interact(Humanoid character, bool hold)
    {
        if (hold)
        {
            return(false);
        }
        Player player = character as Player;

        RuneStone.RandomRuneText randomText = this.GetRandomText();
        if (randomText != null)
        {
            if (randomText.m_label.Length > 0)
            {
                player.AddKnownText(randomText.m_label, randomText.m_text);
            }
            TextViewer.instance.ShowText(TextViewer.Style.Rune, randomText.m_topic, randomText.m_text, true);
        }
        else
        {
            if (this.m_label.Length > 0)
            {
                player.AddKnownText(this.m_label, this.m_text);
            }
            TextViewer.instance.ShowText(TextViewer.Style.Rune, this.m_topic, this.m_text, true);
        }
        return(false);
    }
Exemple #2
0
    // Token: 0x06000ECB RID: 3787 RVA: 0x00069A74 File Offset: 0x00067C74
    private RuneStone.RandomRuneText GetRandomText()
    {
        if (this.m_randomTexts.Count == 0)
        {
            return(null);
        }
        Vector3 position = base.transform.position;
        int     seed     = (int)position.x * (int)position.z;

        UnityEngine.Random.State state = UnityEngine.Random.state;
        UnityEngine.Random.InitState(seed);
        RuneStone.RandomRuneText result = this.m_randomTexts[UnityEngine.Random.Range(0, this.m_randomTexts.Count)];
        UnityEngine.Random.state = state;
        return(result);
    }
Exemple #3
0
            public static bool Interact(ref RuneStone __instance)
            {
                if (!(
                        Input.GetKey(readMoreModifierKey.Value) &&
                        m_SkaldRunestoneTexts.ContainsKey(__instance.name)
                        ))
                {
                    return(true);
                }

                RuneStone.RandomRuneText randomText = m_SkaldRunestoneTexts[__instance.name][rng.Next(m_SkaldRunestoneTexts[__instance.name].Count)];

                TextViewer.instance.ShowText(TextViewer.Style.Rune, m_localization.TryTranslate("skald_runestone_topic"), randomText.m_text, autoHide: true);

                return(false);
            }
Exemple #4
0
        public static void Postfix(RuneStone __instance, Humanoid character)
        {
            Debug.Log("Runestone interaction");
            Player player = character as Player;

            if (__instance == null || player == null || RuneDB.Instance.AllRunes == null)
            {
                return;
            }
            MethodInfo methodInfo = typeof(RuneStone).GetMethod("GetRandomText", BindingFlags.NonPublic | BindingFlags.Instance);

            RuneStone.RandomRuneText runeText = (RuneStone.RandomRuneText)methodInfo.Invoke(__instance, null);
            if (runeText != null && runeTokenRegex.IsMatch(runeText.m_text))
            {
                var matchInfo = runeTokenRegex.Match(runeText.m_text);
                runeText.m_label = $"Rune Lore: {char.ToUpper(matchInfo.Groups[1].Value[0])}{matchInfo.Groups[1].Value.Substring(1)} {Int32.Parse(matchInfo.Groups[2].Value)}";
                player.AddKnownText(runeText.m_label, runeText.m_text);
                typeof(Player).GetMethod("UpdateKnownRecipesList", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(player, null);
            }
        }