using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using UnityEngine;
using UnityEngine.SceneManagement;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("Ayloonah.Erenshor-Chat-History-Mod")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Ayloonah.Erenshor-Chat-History-Mod")]
[assembly: AssemblyCopyright("Copyright © 2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("3ee92da7-d4ab-4ed2-9f97-abd800dc67c7")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace erenshor_chat_history_mod;
public class ChatHistory : MonoBehaviour
{
private List<string> chatInputList = new List<string>();
private int currentIndex = -1;
private string sceneName;
private TypeText chatBox;
private void Awake()
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
Scene activeScene = SceneManager.GetActiveScene();
sceneName = ((Scene)(ref activeScene)).name;
UpdateChatBoxForScene(sceneName);
}
private void OnEnable()
{
SceneManager.activeSceneChanged += OnSceneChanged;
}
private void OnDisable()
{
SceneManager.activeSceneChanged -= OnSceneChanged;
}
private void OnSceneChanged(Scene oldScene, Scene newScene)
{
sceneName = ((Scene)(ref newScene)).name;
UpdateChatBoxForScene(sceneName);
}
private void UpdateChatBoxForScene(string scene)
{
if (scene == "Menu" || scene == "LoadScene")
{
chatBox = null;
}
else
{
chatBox = Object.FindObjectOfType<TypeText>();
}
}
public void Update()
{
if ((Object)(object)chatBox == (Object)null)
{
return;
}
bool keyDown = Input.GetKeyDown((KeyCode)273);
bool keyDown2 = Input.GetKeyDown((KeyCode)274);
bool keyDown3 = Input.GetKeyDown((KeyCode)13);
if (keyDown3)
{
string text = chatBox.typed.text.Trim();
if (!string.IsNullOrWhiteSpace(text))
{
if (chatInputList.Count == 20)
{
chatInputList.RemoveAt(0);
}
chatInputList.Add(text);
}
}
if (keyDown && chatInputList.Count > 0)
{
if (currentIndex == -1)
{
currentIndex = chatInputList.Count - 1;
}
else if (currentIndex > 0)
{
currentIndex--;
}
chatBox.typed.text = chatInputList[currentIndex];
}
if (keyDown2 && chatInputList.Count > 0)
{
if (currentIndex == -1)
{
chatBox.typed.text = "";
}
else if (currentIndex < chatInputList.Count - 1)
{
currentIndex++;
chatBox.typed.text = chatInputList[currentIndex];
}
else if (currentIndex == chatInputList.Count - 1)
{
currentIndex = -1;
chatBox.typed.text = "";
}
}
if (keyDown3)
{
currentIndex = -1;
}
}
}
[BepInPlugin("com.ayloonah.erenshor_chat_history_mod", "Chat History Mod", "1.0.0")]
public class Mod : BaseUnityPlugin
{
public void Awake()
{
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Expected O, but got Unknown
((BaseUnityPlugin)this).Logger.LogMessage((object)"Chat History Mod loaded!");
GameObject val = new GameObject("ChatHistory");
val.AddComponent<ChatHistory>();
Object.DontDestroyOnLoad((Object)(object)val);
}
public void OnDestroy()
{
((BaseUnityPlugin)this).Logger.LogMessage((object)"Chat History Mod unloaded!");
}
}