using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("Omniscye")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("EmpressMonsterArchive")]
[assembly: AssemblyTitle("EmpressMonsterArchive")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
}
namespace RepoMonsterDiary
{
[BepInPlugin("com.empress.monsterdiary", "Monster Diary", "2.1.0")]
public class MonsterDiaryMod : BaseUnityPlugin
{
public class MonsterEntry
{
public string Name;
public string TierName;
public string HP;
public string Damage;
public string Behavior;
public Color TierColor;
public Sprite Visual;
}
[HarmonyPatch]
private static class Patch_CameraAim_Update
{
private static MethodBase TargetMethod()
{
Type type = FindTypeBySimpleName("CameraAim");
if (type == null)
{
return null;
}
return type.GetMethod("Update", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
}
private static bool Prefix()
{
return !UIActive;
}
}
private ConfigEntry<KeyCode> _toggleKey;
private GameObject diaryCanvasRoot;
private static bool isVisible;
private Font systemFont;
private Sprite backgroundSprite;
private Sprite defaultMonsterSprite;
private List<MonsterEntry> monsters = new List<MonsterEntry>();
private Text titleText;
private Text statsText;
private Text descriptionText;
private Image monsterImageDisplay;
private Transform contentContainer;
private GameObject buttonTemplate;
private Color colorPanelBg = new Color(0.12f, 0.12f, 0.14f, 0.98f);
private Color colorHeaderBg = new Color(0.18f, 0.18f, 0.22f, 1f);
private Color colorAccent = new Color(1f, 0.65f, 0.2f);
private Color colorTextNorm = new Color(0.9f, 0.9f, 0.9f);
private Color colorTier1 = new Color(0.4f, 0.8f, 0.4f);
private Color colorTier2 = new Color(1f, 0.8f, 0.3f);
private Color colorTier3 = new Color(1f, 0.4f, 0.4f);
internal Harmony Harmony { get; set; }
internal static bool UIActive => isVisible;
private void Awake()
{
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Expected O, but got Unknown
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: Unknown result type (might be due to invalid IL or missing references)
//IL_0098: Unknown result type (might be due to invalid IL or missing references)
//IL_009e: Expected O, but got Unknown
//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
//IL_0154: Unknown result type (might be due to invalid IL or missing references)
//IL_015e: Expected O, but got Unknown
((Component)this).gameObject.transform.parent = null;
((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
_toggleKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("General", "ToggleKey", (KeyCode)118, "Key to open the Monster Diary.");
Texture2D val = new Texture2D(1, 1);
val.SetPixel(0, 0, Color.white);
val.Apply();
backgroundSprite = Sprite.Create(val, new Rect(0f, 0f, 1f, 1f), Vector2.zero);
Texture2D val2 = new Texture2D(1, 1);
val2.SetPixel(0, 0, Color.clear);
val2.Apply();
defaultMonsterSprite = Sprite.Create(val2, new Rect(0f, 0f, 1f, 1f), Vector2.zero);
systemFont = ((IEnumerable<Font>)Resources.FindObjectsOfTypeAll<Font>()).FirstOrDefault((Func<Font, bool>)((Font f) => ((Object)f).name == "Arial"));
if ((Object)(object)systemFont == (Object)null)
{
systemFont = Resources.GetBuiltinResource<Font>("Arial.ttf");
}
if ((Object)(object)systemFont == (Object)null)
{
systemFont = Font.CreateDynamicFontFromOSFont("Arial", 14);
}
Harmony = new Harmony("com.empress.monsterdiary");
Harmony.PatchAll();
LoadMonsterData();
}
private void OnDestroy()
{
Harmony harmony = Harmony;
if (harmony != null)
{
harmony.UnpatchSelf();
}
if (Object.op_Implicit((Object)(object)diaryCanvasRoot))
{
Object.Destroy((Object)(object)diaryCanvasRoot);
}
}
private void Update()
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
if (Input.GetKeyDown(_toggleKey.Value))
{
ToggleDiary();
}
}
private void LoadMonsterData()
{
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_009a: Unknown result type (might be due to invalid IL or missing references)
//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
//IL_010c: Unknown result type (might be due to invalid IL or missing references)
//IL_0132: Unknown result type (might be due to invalid IL or missing references)
//IL_0158: Unknown result type (might be due to invalid IL or missing references)
//IL_017e: Unknown result type (might be due to invalid IL or missing references)
//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
//IL_0216: Unknown result type (might be due to invalid IL or missing references)
//IL_023c: Unknown result type (might be due to invalid IL or missing references)
//IL_0262: Unknown result type (might be due to invalid IL or missing references)
//IL_0288: Unknown result type (might be due to invalid IL or missing references)
//IL_02ae: Unknown result type (might be due to invalid IL or missing references)
//IL_02d4: Unknown result type (might be due to invalid IL or missing references)
//IL_02fa: Unknown result type (might be due to invalid IL or missing references)
//IL_0320: Unknown result type (might be due to invalid IL or missing references)
//IL_0346: Unknown result type (might be due to invalid IL or missing references)
//IL_036c: Unknown result type (might be due to invalid IL or missing references)
//IL_0392: Unknown result type (might be due to invalid IL or missing references)
//IL_03b8: Unknown result type (might be due to invalid IL or missing references)
//IL_03de: Unknown result type (might be due to invalid IL or missing references)
//IL_0404: Unknown result type (might be due to invalid IL or missing references)
//IL_042a: Unknown result type (might be due to invalid IL or missing references)
//IL_0450: Unknown result type (might be due to invalid IL or missing references)
monsters.Clear();
AddMonster("Gnome", "DANGER 1", "20", "10", "Packs will target you as a group. When not targeting you, they'll try to destroy valuables. Grab and throw them against surfaces with force to break them.", colorTier1);
AddMonster("Spewer", "DANGER 1", "65", "10", "Excels at vomiting acid and latching onto faces. While latched, your voice gets deeper and you vomit randomly. Dodge jumps and vomit; throw them to deal damage.", colorTier1);
AddMonster("Bella", "DANGER 1", "200", "5", "A ghost biking around on a tricycle. Leave them alone and they'll leave you alone. If you hear a bell, you are way too close.", colorTier1);
AddMonster("Tick", "DANGER 1", "10", "10", "Latches onto faces to gradually drain health (up to 100 HP). Do not grab anything near it.", colorTier1);
AddMonster("Apex Predator", "DANGER 1", "150", "10", "Adorable creatures that follow you. Ignore them completely; contact will make them go aggro and deal rapid damage.", colorTier1);
AddMonster("Peeper", "DANGER 1", "30", "2 (cont.)", "Locks you into a continuous attack upon spotting you. Block line of sight with objects to break away. Check ceilings before entering rooms.", colorTier1);
AddMonster("Shadow Child", "DANGER 1", "150", "30", "Frightening entity that pulls players who make eye contact. Avert your eyes to avoid damage.", colorTier1);
AddMonster("Birthday Boy", "DANGER 1", "150", "10", "Indicated by balloons nearby. Do NOT pop the balloons, or the enemy will appear and charge.", colorTier1);
AddMonster("Elsa", "DANGER 1", "600", "15", "A pup that asks for pets. If ignored too long, they transform into a muscular version to attack. Take time to pet them until they roam again.", colorTier1);
AddMonster("Mentalist", "DANGER 2", "150", "50", "Creates gravity fields that stun. Once red, you are slammed to the ground. Have teammates pull you out of the field. Tricky to kill without weapons.", colorTier2);
AddMonster("Bowtie", "DANGER 2", "200", "5", "Blows air to force you into collisions with hard surfaces. High strength or weapons recommended for combat.", colorTier2);
AddMonster("Headgrab", "DANGER 2", "150", "5-15", "Attacks with claws and feet. Can wear the heads of fallen teammates to increase speed. Remove the head to stun them.", colorTier2);
AddMonster("Oogly", "DANGER 2", "200", "4", "A flying enemy that grabs players to cause mid-air damage. Hide underneath objects or run.", colorTier2);
AddMonster("Heart Hugger", "DANGER 2", "300", "30", "Pulls players in using a pink cloud of spores. Trapped players take fatal damage hits. Avoid spores or have teammates pull you out.", colorTier2);
AddMonster("Gambit", "DANGER 2", "150", "Random", "Grabs players for a wheel spin: Green (Health), Red (Hurt), White (Full Restore), Black (1 HP), Yellow (Money). Use weapons to stop the spin.", colorTier2);
AddMonster("Banger", "DANGER 2", "50", "Varies", "Skulls that explode 15 seconds after detection. Usually in groups of three. Run or throw them far away.", colorTier2);
AddMonster("Chef", "DANGER 2", "150", "10", "A frog with knives. Charges before leaping. Use the environment to escape or bait them into pits and traps.", colorTier2);
AddMonster("Rugrat", "DANGER 2", "150", "10-225", "Grabs the nearest valuable and throws it at you. Run out of range or grab valuables before they can.", colorTier2);
AddMonster("Animal", "DANGER 2", "150", "2", "Charges directly at you and moves erratically. Requires two people to hold and throw against surfaces as they break free easily.", colorTier2);
AddMonster("Upscream", "DANGER 2", "50", "10", "Screams at your face with enough force to send you flying. Hide in tall places or run.", colorTier2);
AddMonster("Hidden", "DANGER 2", "100", "None", "Invisible monster. Watch for footsteps or breath on walls. Grabs and takes you around the map. Crouch under items to stay undetected.", colorTier2);
AddMonster("Headman", "DANGER 3", "250", "50", "Floating head that roams halls. Bites upon spotting players. Break line of sight to escape.", colorTier3);
AddMonster("Clown", "DANGER 3", "250", "60-100", "Attacks with a laser beam from its forehead or kicks with massive force. Run before the laser fires.", colorTier3);
AddMonster("Cleanup Crew", "DANGER 3", "350", "60-100", "Detaches its head to use as an explosive. You can grab and throw the head, or escape the slow monster.", colorTier3);
AddMonster("Trudge", "DANGER 3", "500", "35-100", "Heavily armored and slow. Uses an arm-mounted weapon and a tentacle skull to attack. Easy to outrun if there is distance.", colorTier3);
AddMonster("Robe", "DANGER 3", "250", "50-100", "Expert at sneaking. Eye contact empowers them and makes them faster. Run away immediately.", colorTier3);
AddMonster("Huntsman", "DANGER 3", "250", "100", "Blind but has perfect hearing. Crouch and move silently. Do not sprint near them.", colorTier3);
AddMonster("Reaper", "DANGER 3", "250", "10", "Deaf but relies on sight. Swings arms fast for high damage. Use obstacles to 'tunnel' and lose them.", colorTier3);
AddMonster("Loom", "DANGER 3", "500", "100", "Indicated by floating hands on the screen. Starts a slow, persistent chase. If caught, they clap their hands with you in the center.", colorTier3);
}
private void AddMonster(string name, string tier, string hp, string dmg, string behavior, Color c)
{
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
Sprite visual = LoadSpriteForMonster(name);
monsters.Add(new MonsterEntry
{
Name = name,
TierName = tier,
HP = hp,
Damage = dmg,
Behavior = behavior,
TierColor = c,
Visual = visual
});
}
private Sprite LoadSpriteForMonster(string monsterName)
{
//IL_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Expected O, but got Unknown
//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
string monsterName2 = monsterName;
try
{
string location = ((BaseUnityPlugin)this).Info.Location;
string directoryName = Path.GetDirectoryName(location);
if (!Directory.Exists(directoryName))
{
return null;
}
string[] files = Directory.GetFiles(directoryName, "*.png");
string text = files.FirstOrDefault(delegate(string f)
{
string fileName = Path.GetFileName(f);
string text2 = fileName.Replace("_", " ");
return text2.IndexOf(monsterName2, StringComparison.OrdinalIgnoreCase) >= 0;
});
if (!string.IsNullOrEmpty(text))
{
byte[] array = File.ReadAllBytes(text);
Texture2D val = new Texture2D(2, 2);
if (ImageConversion.LoadImage(val, array))
{
return Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f));
}
}
}
catch
{
}
return null;
}
private void ToggleDiary()
{
if ((Object)(object)diaryCanvasRoot == (Object)null)
{
BuildUI();
}
isVisible = !isVisible;
diaryCanvasRoot.SetActive(isVisible);
if (isVisible)
{
Cursor.visible = true;
Cursor.lockState = (CursorLockMode)0;
}
else
{
Cursor.visible = false;
Cursor.lockState = (CursorLockMode)1;
}
}
private void BuildUI()
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Expected O, but got Unknown
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
//IL_00be: Unknown result type (might be due to invalid IL or missing references)
//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
//IL_010c: Unknown result type (might be due to invalid IL or missing references)
//IL_013f: Unknown result type (might be due to invalid IL or missing references)
//IL_0156: Unknown result type (might be due to invalid IL or missing references)
//IL_016d: Unknown result type (might be due to invalid IL or missing references)
//IL_0198: Unknown result type (might be due to invalid IL or missing references)
//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
//IL_01f5: Unknown result type (might be due to invalid IL or missing references)
//IL_020c: Unknown result type (might be due to invalid IL or missing references)
//IL_0236: Unknown result type (might be due to invalid IL or missing references)
//IL_026e: Unknown result type (might be due to invalid IL or missing references)
//IL_027b: Unknown result type (might be due to invalid IL or missing references)
//IL_0288: Unknown result type (might be due to invalid IL or missing references)
//IL_02da: Unknown result type (might be due to invalid IL or missing references)
//IL_02e7: Unknown result type (might be due to invalid IL or missing references)
//IL_02fe: Unknown result type (might be due to invalid IL or missing references)
//IL_0315: Unknown result type (might be due to invalid IL or missing references)
//IL_036e: Unknown result type (might be due to invalid IL or missing references)
//IL_0385: Unknown result type (might be due to invalid IL or missing references)
//IL_039c: Unknown result type (might be due to invalid IL or missing references)
//IL_03f4: Unknown result type (might be due to invalid IL or missing references)
//IL_03fe: Expected O, but got Unknown
//IL_044d: Unknown result type (might be due to invalid IL or missing references)
//IL_0464: Unknown result type (might be due to invalid IL or missing references)
//IL_048e: Unknown result type (might be due to invalid IL or missing references)
//IL_04c4: Unknown result type (might be due to invalid IL or missing references)
//IL_04d3: Unknown result type (might be due to invalid IL or missing references)
//IL_04eb: Unknown result type (might be due to invalid IL or missing references)
//IL_051f: Unknown result type (might be due to invalid IL or missing references)
//IL_0536: Unknown result type (might be due to invalid IL or missing references)
//IL_0560: Unknown result type (might be due to invalid IL or missing references)
//IL_058c: Unknown result type (might be due to invalid IL or missing references)
//IL_059b: Unknown result type (might be due to invalid IL or missing references)
//IL_05d7: Unknown result type (might be due to invalid IL or missing references)
//IL_05e6: Unknown result type (might be due to invalid IL or missing references)
//IL_063b: Unknown result type (might be due to invalid IL or missing references)
//IL_0652: Unknown result type (might be due to invalid IL or missing references)
//IL_068f: Unknown result type (might be due to invalid IL or missing references)
//IL_06b1: Unknown result type (might be due to invalid IL or missing references)
//IL_06b6: Unknown result type (might be due to invalid IL or missing references)
//IL_06d9: Unknown result type (might be due to invalid IL or missing references)
//IL_06e8: Unknown result type (might be due to invalid IL or missing references)
//IL_06f5: Unknown result type (might be due to invalid IL or missing references)
diaryCanvasRoot = new GameObject("MonsterDiaryCanvas_ROOT");
Object.DontDestroyOnLoad((Object)(object)diaryCanvasRoot);
Canvas val = diaryCanvasRoot.AddComponent<Canvas>();
val.renderMode = (RenderMode)0;
val.sortingOrder = 30000;
CanvasScaler val2 = diaryCanvasRoot.AddComponent<CanvasScaler>();
val2.uiScaleMode = (ScaleMode)1;
val2.referenceResolution = new Vector2(1920f, 1080f);
diaryCanvasRoot.AddComponent<GraphicRaycaster>();
GameObject val3 = CreateUIElement("MainPanel", diaryCanvasRoot.transform);
RectTransform component = val3.GetComponent<RectTransform>();
component.sizeDelta = new Vector2(1200f, 800f);
component.anchoredPosition = Vector2.zero;
Image val4 = val3.AddComponent<Image>();
((Graphic)val4).color = colorPanelBg;
val4.sprite = backgroundSprite;
Outline val5 = val3.AddComponent<Outline>();
((Shadow)val5).effectColor = new Color(0.3f, 0.3f, 0.3f, 0.5f);
((Shadow)val5).effectDistance = new Vector2(2f, -2f);
GameObject val6 = CreateUIElement("Header", val3.transform);
RectTransform component2 = val6.GetComponent<RectTransform>();
component2.anchoredPosition = new Vector2(0f, 360f);
component2.sizeDelta = new Vector2(1200f, 80f);
Image val7 = val6.AddComponent<Image>();
((Graphic)val7).color = colorHeaderBg;
val7.sprite = backgroundSprite;
Text val8 = CreateText(val6.transform, "TitleText", "R.E.P.O. ARCHIVE", Vector2.zero, new Vector2(1100f, 80f), 42, bold: true);
((Graphic)val8).color = colorAccent;
val8.alignment = (TextAnchor)4;
GameObject val9 = CreateUIElement("ListContainer", val3.transform);
RectTransform component3 = val9.GetComponent<RectTransform>();
component3.anchoredPosition = new Vector2(-400f, -30f);
component3.sizeDelta = new Vector2(350f, 650f);
Image val10 = val9.AddComponent<Image>();
((Graphic)val10).color = new Color(0f, 0f, 0f, 0.3f);
val10.sprite = backgroundSprite;
GameObject val11 = CreateUIElement("ScrollArea", val9.transform);
RectTransform component4 = val11.GetComponent<RectTransform>();
component4.anchorMin = Vector2.zero;
component4.anchorMax = Vector2.one;
component4.sizeDelta = Vector2.zero;
ScrollRect val12 = val11.AddComponent<ScrollRect>();
val12.vertical = true;
val12.horizontal = false;
val12.scrollSensitivity = 30f;
GameObject val13 = CreateUIElement("Viewport", val11.transform);
RectTransform component5 = val13.GetComponent<RectTransform>();
component5.anchorMin = Vector2.zero;
component5.anchorMax = Vector2.one;
component5.offsetMin = new Vector2(10f, 10f);
component5.offsetMax = new Vector2(-10f, -10f);
Image val14 = val13.AddComponent<Image>();
val14.sprite = backgroundSprite;
val13.AddComponent<Mask>().showMaskGraphic = false;
GameObject val15 = CreateUIElement("Content", val13.transform);
RectTransform component6 = val15.GetComponent<RectTransform>();
component6.anchorMin = new Vector2(0f, 1f);
component6.anchorMax = new Vector2(1f, 1f);
component6.pivot = new Vector2(0.5f, 1f);
contentContainer = val15.transform;
VerticalLayoutGroup val16 = val15.AddComponent<VerticalLayoutGroup>();
((HorizontalOrVerticalLayoutGroup)val16).childControlHeight = true;
((HorizontalOrVerticalLayoutGroup)val16).childControlWidth = true;
((HorizontalOrVerticalLayoutGroup)val16).childForceExpandHeight = false;
((HorizontalOrVerticalLayoutGroup)val16).childForceExpandWidth = true;
((HorizontalOrVerticalLayoutGroup)val16).spacing = 5f;
((LayoutGroup)val16).padding = new RectOffset(5, 5, 5, 5);
ContentSizeFitter val17 = val15.AddComponent<ContentSizeFitter>();
val17.verticalFit = (FitMode)2;
val12.content = component6;
val12.viewport = component5;
GameObject val18 = CreateUIElement("DetailsBg", val3.transform);
RectTransform component7 = val18.GetComponent<RectTransform>();
component7.anchoredPosition = new Vector2(200f, -30f);
component7.sizeDelta = new Vector2(750f, 650f);
Image val19 = val18.AddComponent<Image>();
((Graphic)val19).color = new Color(0f, 0f, 0f, 0.2f);
val19.sprite = backgroundSprite;
titleText = CreateText(val18.transform, "MonsterName", "SELECT ENTITY", new Vector2(0f, 280f), new Vector2(700f, 60f), 36, bold: true);
((Graphic)titleText).color = Color.gray;
GameObject val20 = CreateUIElement("StatsBlock", val18.transform);
RectTransform component8 = val20.GetComponent<RectTransform>();
component8.anchoredPosition = new Vector2(0f, 200f);
component8.sizeDelta = new Vector2(700f, 80f);
Image val21 = val20.AddComponent<Image>();
((Graphic)val21).color = new Color(1f, 1f, 1f, 0.05f);
val21.sprite = backgroundSprite;
statsText = CreateText(val20.transform, "StatsText", "", Vector2.zero, new Vector2(660f, 70f), 22, bold: false);
statsText.alignment = (TextAnchor)4;
descriptionText = CreateText(val18.transform, "DescText", "Data corrupted... waiting for input.", new Vector2(0f, 20f), new Vector2(680f, 280f), 22, bold: false);
descriptionText.alignment = (TextAnchor)0;
descriptionText.horizontalOverflow = (HorizontalWrapMode)0;
GameObject val22 = CreateUIElement("MonsterImage", val18.transform);
RectTransform component9 = val22.GetComponent<RectTransform>();
component9.anchoredPosition = new Vector2(0f, -200f);
component9.sizeDelta = new Vector2(220f, 220f);
monsterImageDisplay = val22.AddComponent<Image>();
monsterImageDisplay.sprite = defaultMonsterSprite;
monsterImageDisplay.preserveAspect = true;
((Graphic)monsterImageDisplay).color = Color.white;
Transform transform = val3.transform;
KeyCode value = _toggleKey.Value;
((Graphic)CreateText(transform, "Footer", "Press [" + ((object)(KeyCode)(ref value)).ToString() + "] to Close", new Vector2(0f, -380f), new Vector2(400f, 40f), 16, bold: false)).color = Color.gray;
CreateButtonTemplate();
PopulateList();
diaryCanvasRoot.SetActive(false);
}
private void CreateButtonTemplate()
{
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0079: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
//IL_0095: Unknown result type (might be due to invalid IL or missing references)
//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
//IL_0111: Unknown result type (might be due to invalid IL or missing references)
//IL_012e: Unknown result type (might be due to invalid IL or missing references)
//IL_0133: Unknown result type (might be due to invalid IL or missing references)
//IL_014d: Unknown result type (might be due to invalid IL or missing references)
//IL_015a: Unknown result type (might be due to invalid IL or missing references)
//IL_0167: Unknown result type (might be due to invalid IL or missing references)
//IL_0174: Unknown result type (might be due to invalid IL or missing references)
//IL_018a: Unknown result type (might be due to invalid IL or missing references)
buttonTemplate = CreateUIElement("BtnTemplate", null);
LayoutElement val = buttonTemplate.AddComponent<LayoutElement>();
val.minHeight = 50f;
Image val2 = buttonTemplate.AddComponent<Image>();
((Graphic)val2).color = new Color(0.25f, 0.25f, 0.28f, 1f);
val2.sprite = backgroundSprite;
Button val3 = buttonTemplate.AddComponent<Button>();
((Selectable)val3).targetGraphic = (Graphic)(object)val2;
ColorBlock colors = ((Selectable)val3).colors;
((ColorBlock)(ref colors)).normalColor = new Color(0.25f, 0.25f, 0.28f, 1f);
((ColorBlock)(ref colors)).highlightedColor = new Color(0.35f, 0.35f, 0.38f, 1f);
((ColorBlock)(ref colors)).pressedColor = new Color(0.5f, 0.5f, 0.55f, 1f);
((ColorBlock)(ref colors)).selectedColor = new Color(0.35f, 0.35f, 0.38f, 1f);
((ColorBlock)(ref colors)).colorMultiplier = 1f;
((Selectable)val3).colors = colors;
Text val4 = CreateText(buttonTemplate.transform, "Label", "Name", Vector2.zero, Vector2.zero, 20, bold: true);
RectTransform component = ((Component)val4).GetComponent<RectTransform>();
component.anchorMin = Vector2.zero;
component.anchorMax = Vector2.one;
component.offsetMin = Vector2.zero;
component.offsetMax = Vector2.zero;
val4.alignment = (TextAnchor)4;
((Graphic)val4).color = Color.white;
val4.verticalOverflow = (VerticalWrapMode)1;
buttonTemplate.SetActive(false);
}
private void PopulateList()
{
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Expected O, but got Unknown
//IL_0097: Unknown result type (might be due to invalid IL or missing references)
//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
//IL_0104: Expected O, but got Unknown
foreach (Transform item in contentContainer)
{
Transform val = item;
Object.Destroy((Object)(object)((Component)val).gameObject);
}
foreach (MonsterEntry monster in monsters)
{
GameObject val2 = Object.Instantiate<GameObject>(buttonTemplate, contentContainer);
val2.SetActive(true);
val2.transform.localScale = Vector3.one;
Text componentInChildren = val2.GetComponentInChildren<Text>();
componentInChildren.text = monster.Name;
((Graphic)componentInChildren).color = Color.Lerp(monster.TierColor, Color.white, 0.4f);
Button component = val2.GetComponent<Button>();
((UnityEvent)component.onClick).AddListener((UnityAction)delegate
{
ShowMonster(monster);
});
}
}
private void ShowMonster(MonsterEntry monster)
{
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_0110: Unknown result type (might be due to invalid IL or missing references)
//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
titleText.text = monster.Name.ToUpper();
((Graphic)titleText).color = monster.TierColor;
statsText.text = "<color=#cccccc>HP:</color> <color=#ffffff>" + monster.HP + "</color> | <color=#cccccc>DAMAGE:</color> <color=#ffffff>" + monster.Damage + "</color>";
string text = "<size=18><color=#" + ColorUtility.ToHtmlStringRGB(monster.TierColor) + ">" + monster.TierName + "</color></size>\n\n";
text += monster.Behavior;
descriptionText.text = text;
if ((Object)(object)monster.Visual != (Object)null)
{
monsterImageDisplay.sprite = monster.Visual;
((Graphic)monsterImageDisplay).color = Color.white;
}
else
{
monsterImageDisplay.sprite = defaultMonsterSprite;
((Graphic)monsterImageDisplay).color = Color.clear;
}
}
private GameObject CreateUIElement(string name, Transform parent)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Expected O, but got Unknown
GameObject val = new GameObject(name);
if ((Object)(object)parent != (Object)null)
{
val.transform.SetParent(parent, false);
}
val.AddComponent<RectTransform>();
return val;
}
private Text CreateText(Transform parent, string name, string content, Vector2 pos, Vector2 size, int fontSize, bool bold)
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
GameObject val = CreateUIElement(name, parent);
RectTransform component = val.GetComponent<RectTransform>();
component.anchoredPosition = pos;
if (size != Vector2.zero)
{
component.sizeDelta = size;
}
Text val2 = val.AddComponent<Text>();
val2.text = content;
val2.font = systemFont;
val2.fontSize = fontSize;
val2.fontStyle = (FontStyle)(bold ? 1 : 0);
((Graphic)val2).color = colorTextNorm;
val2.alignment = (TextAnchor)4;
((Graphic)val2).raycastTarget = false;
val2.supportRichText = true;
return val2;
}
private static Type FindTypeBySimpleName(string simpleName)
{
string simpleName2 = simpleName;
Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
foreach (Assembly assembly in assemblies)
{
Type type = null;
try
{
type = assembly.GetTypes().FirstOrDefault((Type x) => x.Name == simpleName2 || (x.FullName?.EndsWith("." + simpleName2) ?? false));
}
catch
{
}
if (type != null)
{
return type;
}
}
return null;
}
}
}