using System;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using TMPro;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;

// Token: 0x020000BE RID: 190
public class LevelUp : MonoBehaviour
{
	// Token: 0x06001200 RID: 4608 RVA: 0x0015FCD0 File Offset: 0x0015DED0
	public void StartMenu()
	{
		this.character = Links.x.characterSheet.character;
		this.selectedRace = this.character.stats.race;
		string text = this.character.stats.levelUps;
		new string[0];
		char c = ',';
		string[] array = text.Split(c, StringSplitOptions.None);
		int num = 0;
		foreach (string text2 in array)
		{
			int num2 = -1;
			if (text2 != "")
			{
				int.TryParse(text2, NumberStyles.Any, CultureInfo.InvariantCulture, out num2);
			}
			this.levelUps.Add(num2);
			num++;
			if (num == 4)
			{
				num = 0;
			}
		}
		foreach (Button button in this.backgroundButtons)
		{
			button.enabled = Links.x.mk;
		}
		base.gameObject.SetActive(true);
		Records.x.AddMenu(base.gameObject);
		this.Open(0f);
		if (Links.x.joy)
		{
			Links.x.gameplay.SetInteractableSelected(EventSystem.current, this.skillTrs[0].gameObject);
		}
	}

	// Token: 0x06001201 RID: 4609 RVA: 0x0015FE24 File Offset: 0x0015E024
	public void Open(float startTime)
	{
		this.confirmStats.SetActive(false);
		this.confirmSkills.SetActive(false);
		this.levelUpSkills = true;
		if (this.levelUps[0] < 0)
		{
			this.levelUpSkills = false;
		}
		this.multiplier1 = this.levelUps[1];
		this.multiplier2 = this.levelUps[2];
		this.multiplier3 = this.levelUps[3];
		this.level = this.levelUps[0];
		this.skillChosen1 = "";
		this.skillChosen2 = "";
		this.skillChosen3 = "";
		this.statChosen1 = "";
		if (this.multiplier1 == 100)
		{
			this.fromTesting = true;
		}
		this.open = true;
		if (this.levelUpSkills)
		{
			this.currentSkills = this.character.stats.skills;
			this.originalSkills.Clear();
			foreach (float num in this.currentSkills)
			{
				this.originalSkills.Add(num);
			}
			this.skillObjects.SetActive(true);
			this.statsObjects.SetActive(false);
			this.skillTokenCounter1.enabled = true;
			this.skillTokenUse1.enabled = false;
			this.skillTokenCounter2.enabled = true;
			this.skillTokenUse2.enabled = false;
			this.skillTokenCounter3.enabled = true;
			this.skillTokenUse3.enabled = false;
			this.Message();
			this.skillsNotReadyButton.SetActive(true);
		}
		else
		{
			this.animator.Play("LevelUpStatOpen");
			this.savedStr = this.character.stats.GetStatOnly("Strength");
			this.savedAgl = this.character.stats.GetStatOnly("Agility");
			this.savedAur = this.character.stats.GetStatOnly("Aura");
			this.savedDex = this.character.stats.GetStatOnly("Dexterity");
			this.savedSen = this.character.stats.GetStatOnly("Sensory");
			this.savedPag = this.character.stats.GetStatOnly("Pagan");
			this.statTokenCounter1.enabled = true;
			this.statTokenUse1.enabled = false;
			this.skillObjects.SetActive(false);
			this.statsObjects.SetActive(true);
		}
		this.SetSkillPointsRemaining();
		Links.x.characterSheet.levelingUp = true;
		if (this.levelUpSkills)
		{
			this.animator.Play("LevelUpSkillOpen", 0, startTime);
			Links.x.characterSheet.canLevelUpSkill = true;
			Links.x.characterSheet.canLevelUpStat = false;
			if (Links.x.joy)
			{
				Links.x.gameplay.SetInteractableSelected(EventSystem.current, this.skillTrs[0].gameObject);
				return;
			}
		}
		else
		{
			this.animator.Play("LevelUpStatOpen", 0, startTime);
			Links.x.characterSheet.canLevelUpSkill = false;
			Links.x.characterSheet.canLevelUpStat = true;
			if (Links.x.joy)
			{
				Links.x.gameplay.SetInteractableSelected(EventSystem.current, Links.x.characterSheet.statButton.gameObject);
			}
		}
	}

	// Token: 0x06001202 RID: 4610 RVA: 0x001601B0 File Offset: 0x0015E3B0
	private bool Taken(int x)
	{
		return this.multiplier1 == x || this.multiplier2 == x || this.multiplier3 == x;
	}

	// Token: 0x06001203 RID: 4611 RVA: 0x001601D4 File Offset: 0x0015E3D4
	private void Message()
	{
		this.str.Clear();
		this.str.Append("<size=80%>Skills used most during this level have a bonus if selected. If less than three skills were used, starting skills gain bonuses.\n\nSkills under 60 with bonuses gain levels faster.\n\n</size>");
		if (this.multiplier1 == -1)
		{
			this.multiplier1 = this.character.stats.topStartingSkill1;
			this.multiplier2 = this.character.stats.topStartingSkill2;
			this.multiplier3 = this.character.stats.topStartingSkill3;
		}
		else
		{
			if (this.multiplier2 == -1)
			{
				bool flag = false;
				if (!this.Taken(this.character.stats.topStartingSkill1))
				{
					this.multiplier2 = this.character.stats.topStartingSkill1;
					flag = true;
				}
				if (!flag && !this.Taken(this.character.stats.topStartingSkill2))
				{
					this.multiplier2 = this.character.stats.topStartingSkill2;
					flag = true;
				}
				if (!flag && !this.Taken(this.character.stats.topStartingSkill3))
				{
					this.multiplier2 = this.character.stats.topStartingSkill3;
				}
			}
			if (this.multiplier3 == -1)
			{
				bool flag2 = false;
				if (!this.Taken(this.character.stats.topStartingSkill1))
				{
					this.multiplier3 = this.character.stats.topStartingSkill1;
					flag2 = true;
				}
				if (!flag2 && !this.Taken(this.character.stats.topStartingSkill2))
				{
					this.multiplier3 = this.character.stats.topStartingSkill2;
					flag2 = true;
				}
				if (!flag2 && !this.Taken(this.character.stats.topStartingSkill3))
				{
					this.multiplier3 = this.character.stats.topStartingSkill3;
				}
			}
		}
		if (this.multiplier1 != -1)
		{
			this.str.Append("<color=#8E5C09>");
			if (this.fromTesting && this.multiplier1 == 100)
			{
				this.str.Append("First Picked");
			}
			else
			{
				this.str.Append(Links.x.manual.DisplayNameFromIndex(this.multiplier1, this.character));
			}
			this.str.Append(" +3");
			this.str.Append("</color>\n");
		}
		if (this.multiplier2 != -1)
		{
			this.str.Append("<color=#6F4D13>");
			if (this.fromTesting && this.multiplier2 == 100)
			{
				this.str.Append("Second Picked");
			}
			else
			{
				this.str.Append(Links.x.manual.DisplayNameFromIndex(this.multiplier2, this.character));
			}
			this.str.Append(" +2</color>\n");
		}
		if (this.multiplier3 != -1)
		{
			this.str.Append("<color=#503508>");
			if (this.fromTesting && this.multiplier3 == 100)
			{
				this.str.Append("Third Picked");
			}
			else
			{
				this.str.Append(Links.x.manual.DisplayNameFromIndex(this.multiplier3, this.character));
			}
			this.str.Append(" +1</color>");
		}
		if (this.multiplier1 == -1 && this.multiplier2 == -1 && this.multiplier3 == -1)
		{
			this.str.Append("<size=80%>(No skills were utilized successfully during this level)\n\n");
		}
		this.skillMessage.text = this.str.ToString();
		this.skillTitle.text = "Level " + this.level.ToString();
		if (this.fromTesting)
		{
			Links.x.characterSheet.GetStats();
			Links.x.characterSheet.GetOutput();
		}
	}

	// Token: 0x06001204 RID: 4612 RVA: 0x00160590 File Offset: 0x0015E790
	private void StartTokenDrag()
	{
		if (Links.x.characterSheet.currentHover)
		{
			string name = Links.x.characterSheet.currentHover.name;
			if (name == "Stat Token 1")
			{
				this.dragToken = this.statTokenUse1RT;
				this.statTokenUse1.raycastTarget = false;
			}
			if (name == "Skill Token 1")
			{
				this.dragToken = this.skillTokenUse1RT;
				this.skillTokenUse1.raycastTarget = false;
			}
			if (name == "Skill Token 2")
			{
				this.dragToken = this.skillTokenUse2RT;
				this.skillTokenUse2.raycastTarget = false;
			}
			if (name == "Skill Token 3")
			{
				this.dragToken = this.skillTokenUse3RT;
				this.skillTokenUse3.raycastTarget = false;
			}
			if (this.dragToken)
			{
				this.dragIndicator.SetActive(true);
				if (this.dragToken == this.statTokenUse1RT)
				{
					this.dragIndicator.transform.position = this.statTokenBack1RT.gameObject.transform.position;
				}
				if (this.dragToken == this.skillTokenUse1RT)
				{
					this.dragIndicator.transform.position = this.skillTokenBack1RT.gameObject.transform.position;
				}
				if (this.dragToken == this.skillTokenUse2RT)
				{
					this.dragIndicator.transform.position = this.skillTokenBack2RT.gameObject.transform.position;
				}
				if (this.dragToken == this.skillTokenUse3RT)
				{
					this.dragIndicator.transform.position = this.skillTokenBack3RT.gameObject.transform.position;
				}
				this.draggingToken = true;
			}
		}
	}

	// Token: 0x06001205 RID: 4613 RVA: 0x00160760 File Offset: 0x0015E960
	private void ReturnTokenDrag()
	{
		if (this.draggingToken)
		{
			this.dragIndicator.SetActive(false);
			if (this.dragToken == this.statTokenUse1)
			{
				this.statTokenUse1RT.position = this.statTokenBack1RT.position;
				this.statTokenUse1.raycastTarget = true;
			}
			if (this.dragToken == this.skillTokenUse1)
			{
				this.skillTokenBack1RT.position = this.skillTokenBack1RT.position;
				this.skillTokenUse1.raycastTarget = true;
			}
			if (this.dragToken == this.skillTokenUse2)
			{
				this.skillTokenBack2RT.position = this.skillTokenBack2RT.position;
				this.skillTokenUse2.raycastTarget = true;
			}
			if (this.dragToken == this.skillTokenUse3)
			{
				this.skillTokenBack3RT.position = this.skillTokenBack3RT.position;
				this.skillTokenUse3.raycastTarget = true;
			}
			this.dragToken = null;
			this.draggingToken = false;
		}
	}

	// Token: 0x06001206 RID: 4614 RVA: 0x00160868 File Offset: 0x0015EA68
	private void Update()
	{
		if (Links.x.characterSheet.currentHover && Links.x.characterSheet.currentHover.name.Contains("Token") && (Links.x.characterSheet.currentHover.name.Contains("Stat") || Links.x.characterSheet.currentHover.name.Contains("Skill")) && ((Input.GetMouseButtonDown(0) && Links.x.mk) || (Links.x.joy && Links.x.gameplay.actionStart)))
		{
			this.ReturnTokenDrag();
			this.StartTokenDrag();
			this.startedDrag = true;
		}
		if (this.draggingToken && !this.startedDrag && ((Input.GetMouseButtonDown(0) && Links.x.mk) || (Links.x.joy && Links.x.gameplay.cancelStart)))
		{
			this.ReturnTokenDrag();
		}
	}

	// Token: 0x06001207 RID: 4615 RVA: 0x0016097C File Offset: 0x0015EB7C
	public void ToggleSkillImages(bool state)
	{
		foreach (Image image in this.skillTokenImages)
		{
			image.enabled = state;
		}
		Color color = this.skillTokenUse1.color;
		if (state)
		{
			color.a = 1f;
		}
		else
		{
			color.a = 0f;
		}
		this.skillTokenUse1.color = color;
		this.skillTokenUse2.color = color;
		this.skillTokenUse3.color = color;
	}

	// Token: 0x06001208 RID: 4616 RVA: 0x00160A1C File Offset: 0x0015EC1C
	public void Save()
	{
		if (this.TokensInvalid())
		{
			if (this.alertCoroutineTokenInvalid == null)
			{
				this.alertCoroutineTokenInvalid = this.AlertOffTokensInvalid();
				this.alertTokensInvalid.SetActive(true);
				base.StartCoroutine(this.alertCoroutineTokenInvalid);
				return;
			}
		}
		else
		{
			this.NextOrClose();
		}
	}

	// Token: 0x06001209 RID: 4617 RVA: 0x00160A5A File Offset: 0x0015EC5A
	private IEnumerator AlertOffTokensInvalid()
	{
		yield return new WaitForSeconds(2f);
		this.alertTokensInvalid.SetActive(false);
		this.alertCoroutineTokenInvalid = null;
		yield break;
	}

	// Token: 0x0600120A RID: 4618 RVA: 0x00160A6C File Offset: 0x0015EC6C
	public float GetOriginalStat(string n)
	{
		float num = 0f;
		if (n == "Strength")
		{
			num = this.savedStr;
		}
		if (n == "Agility")
		{
			num = this.savedAgl;
		}
		if (n == "Dexterity")
		{
			num = this.savedDex;
		}
		if (n == "Aura")
		{
			num = this.savedAur;
		}
		if (n == "Pagan")
		{
			num = this.savedPag;
		}
		if (n == "Sensory")
		{
			num = this.savedSen;
		}
		return num;
	}

	// Token: 0x0600120B RID: 4619 RVA: 0x00160AF8 File Offset: 0x0015ECF8
	public float GetCurrentStat(string n)
	{
		float num = 0f;
		if (n == "Strength")
		{
			num = this.savedStr;
		}
		if (n == "Agility")
		{
			num = this.savedAgl;
		}
		if (n == "Dexterity")
		{
			num = this.savedDex;
		}
		if (n == "Aura")
		{
			num = this.savedAur;
		}
		if (n == "Pagan")
		{
			num = this.savedPag;
		}
		if (n == "Sensory")
		{
			num = this.savedSen;
		}
		return num + 1f;
	}

	// Token: 0x0600120C RID: 4620 RVA: 0x00160B8A File Offset: 0x0015ED8A
	public float GetOriginalSkill(int index)
	{
		if (index > -1 && index < this.originalSkills.Count)
		{
			return this.originalSkills[index];
		}
		return 0f;
	}

	// Token: 0x0600120D RID: 4621 RVA: 0x00160BB0 File Offset: 0x0015EDB0
	public float GetCurrentSkill(int index)
	{
		if (index > -1 && index < this.originalSkills.Count)
		{
			float num = this.originalSkills[index];
			int num2 = this.IncreaseAmt(index, this.multiplier1, this.multiplier2, this.multiplier3, (int)num);
			return this.originalSkills[index] + (float)num2;
		}
		return 0f;
	}

	// Token: 0x0600120E RID: 4622 RVA: 0x00160C10 File Offset: 0x0015EE10
	public void ClickedStat(GameObject go)
	{
		if (this.levelUpSkills)
		{
			return;
		}
		if (this.open)
		{
			string name = go.name;
			bool flag = false;
			if (this.statChosen1 == name)
			{
				flag = true;
			}
			float num = 0f;
			if (this.statChosen1 != "")
			{
				if (this.statChosen1 == "Strength")
				{
					num = this.savedStr;
				}
				if (this.statChosen1 == "Agility")
				{
					num = this.savedAgl;
				}
				if (this.statChosen1 == "Dexterity")
				{
					num = this.savedDex;
				}
				if (this.statChosen1 == "Aura")
				{
					num = this.savedAur;
				}
				if (this.statChosen1 == "Pagan")
				{
					num = this.savedPag;
				}
				if (this.statChosen1 == "Sensory")
				{
					num = this.savedSen;
				}
				this.character.stats.SetStat(this.statChosen1, num);
				Links.x.characterSheet.GetStatNums();
				Links.x.characterSheet.GetOutput();
				this.statTokenUse1.enabled = false;
				this.statTokenCounter1.enabled = true;
				this.statChosen1 = "";
			}
			if (name == "Strength")
			{
				num = this.savedStr;
			}
			if (name == "Agility")
			{
				num = this.savedAgl;
			}
			if (name == "Dexterity")
			{
				num = this.savedDex;
			}
			if (name == "Aura")
			{
				num = this.savedAur;
			}
			if (name == "Pagan")
			{
				num = this.savedPag;
			}
			if (name == "Sensory")
			{
				num = this.savedSen;
			}
			if (flag)
			{
				this.statTokenUse1.enabled = false;
				this.statTokenCounter1.enabled = true;
				this.statChosen1 = "";
				this.character.stats.SetStat(name, num);
				Links.x.characterSheet.GetStatNums();
				Links.x.characterSheet.GetOutput();
				this.HoverSet(false, name);
			}
			else if (this.statChosen1 == "")
			{
				this.statTokenUse1.enabled = true;
				this.statTokenCounter1.enabled = false;
				this.statTokenUse1RT.anchoredPosition = this.skillTrs[this.GetTransformIndex(name, true)].anchoredPosition;
				this.statChosen1 = name;
				this.character.stats.SetStat(name, num + 1f);
				Links.x.characterSheet.GetStatNums();
				Links.x.characterSheet.GetOutput();
			}
			Links.x.characterSheet.GetDescriptionController(go, false);
			this.SetSkillPointsRemaining();
			this.dragIndicator.SetActive(false);
			this.draggingToken = false;
			this.dragToken = null;
		}
	}

	// Token: 0x0600120F RID: 4623 RVA: 0x00160EEC File Offset: 0x0015F0EC
	public void ClickedSkill(GameObject go)
	{
		if (!this.levelUpSkills)
		{
			return;
		}
		if (this.open)
		{
			string name = go.name;
			int num = 0;
			bool flag = false;
			if (this.skillChosen1 == name)
			{
				flag = true;
				num = 1;
			}
			if (this.skillChosen2 == name)
			{
				flag = true;
				num = 2;
			}
			if (this.skillChosen3 == name)
			{
				flag = true;
				num = 3;
			}
			int skillIndex = this.GetSkillIndex(name);
			if (flag)
			{
				if (skillIndex > -1)
				{
					if (num == 1)
					{
						this.skillTokenUse1.enabled = false;
						this.skillTokenCounter1.enabled = true;
						this.skillChosen1 = "";
					}
					if (num == 2)
					{
						this.skillTokenUse2.enabled = false;
						this.skillTokenCounter2.enabled = true;
						this.skillChosen2 = "";
					}
					if (num == 3)
					{
						this.skillTokenUse3.enabled = false;
						this.skillTokenCounter3.enabled = true;
						this.skillChosen3 = "";
					}
					this.character.stats.SetSkill(skillIndex, this.originalSkills[skillIndex]);
				}
				Links.x.characterSheet.GetSkillNums();
				Links.x.characterSheet.GetOutput();
			}
			else
			{
				bool flag2 = false;
				num = 0;
				if (!this.draggingToken || !this.dragToken)
				{
					if (this.skillChosen1 == "")
					{
						this.skillChosen1 = name;
						flag2 = true;
						num = 1;
					}
					if (this.skillChosen2 == "" && !flag2)
					{
						this.skillChosen2 = name;
						flag2 = true;
						num = 2;
					}
					if (this.skillChosen3 == "" && !flag2)
					{
						this.skillChosen3 = name;
						flag2 = true;
						num = 3;
					}
				}
				else
				{
					if (this.dragToken == this.skillTokenUse1RT)
					{
						this.skillChosen1 = name;
						flag2 = true;
						num = 1;
					}
					if (this.dragToken == this.skillTokenUse2RT && !flag2)
					{
						this.skillChosen2 = name;
						flag2 = true;
						num = 2;
					}
					if (this.dragToken == this.skillTokenUse3RT && !flag2)
					{
						this.skillChosen3 = name;
						flag2 = true;
						num = 3;
					}
				}
				if (!flag2)
				{
					return;
				}
				if (this.fromTesting)
				{
					bool flag3 = false;
					if (this.multiplier1 == 100)
					{
						this.multiplier1 = skillIndex;
						this.Message();
						flag3 = true;
					}
					if (!flag3 && this.multiplier2 == 100)
					{
						this.multiplier2 = skillIndex;
						this.Message();
						flag3 = true;
					}
					if (!flag3 && this.multiplier3 == 100)
					{
						this.multiplier3 = skillIndex;
						this.Message();
					}
				}
				if (num == 1)
				{
					this.skillTokenUse1.enabled = true;
					this.skillTokenCounter1.enabled = false;
					this.skillTokenUse1RT.anchoredPosition = this.skillTrs[this.GetTransformIndex(name, false)].anchoredPosition;
				}
				if (num == 2)
				{
					this.skillTokenUse2.enabled = true;
					this.skillTokenCounter2.enabled = false;
					this.skillTokenUse2RT.anchoredPosition = this.skillTrs[this.GetTransformIndex(name, false)].anchoredPosition;
				}
				if (num == 3)
				{
					this.skillTokenUse3.enabled = true;
					this.skillTokenCounter3.enabled = false;
					this.skillTokenUse3RT.anchoredPosition = this.skillTrs[this.GetTransformIndex(name, false)].anchoredPosition;
				}
				float num2 = this.originalSkills[skillIndex];
				int num3 = this.IncreaseAmt(skillIndex, this.multiplier1, this.multiplier2, this.multiplier3, (int)num2);
				this.character.stats.SetSkill(skillIndex, this.originalSkills[skillIndex] + (float)num3);
				Links.x.characterSheet.GetSkillNums();
				Links.x.characterSheet.GetOutput();
			}
			if (skillIndex > -1)
			{
				Links.x.characterSheet.GetDescriptionController(go, false);
			}
			this.SetSkillPointsRemaining();
			if (this.alertCoroutineTokenInvalid != null && !this.TokensInvalid())
			{
				this.alertTokensInvalid.SetActive(false);
				base.StopCoroutine(this.alertCoroutineTokenInvalid);
				this.alertCoroutineTokenInvalid = null;
			}
			this.dragIndicator.SetActive(false);
			this.draggingToken = false;
			this.dragToken = null;
		}
	}

	// Token: 0x06001210 RID: 4624 RVA: 0x001612F0 File Offset: 0x0015F4F0
	public void HoverSet(bool add, string n)
	{
		if (this.levelUpSkills)
		{
			int skillIndex = this.GetSkillIndex(n);
			if (skillIndex > -1)
			{
				float num = this.originalSkills[skillIndex];
				bool flag = false;
				if (this.skillChosen1 == n)
				{
					flag = true;
				}
				if (this.skillChosen2 == n)
				{
					flag = true;
				}
				if (this.skillChosen3 == n)
				{
					flag = true;
				}
				if (!flag)
				{
					if (add)
					{
						int num2 = this.IncreaseAmt(skillIndex, this.multiplier1, this.multiplier2, this.multiplier3, (int)num);
						this.character.stats.SetSkill(skillIndex, this.originalSkills[skillIndex] + (float)num2);
						return;
					}
					this.character.stats.SetSkill(skillIndex, this.originalSkills[skillIndex]);
					return;
				}
			}
		}
		else
		{
			bool flag2 = false;
			if (this.statChosen1 == n)
			{
				flag2 = true;
			}
			if (!flag2)
			{
				float num3 = 0f;
				if (n == "Strength")
				{
					num3 = this.savedStr;
				}
				if (n == "Agility")
				{
					num3 = this.savedAgl;
				}
				if (n == "Dexterity")
				{
					num3 = this.savedDex;
				}
				if (n == "Aura")
				{
					num3 = this.savedAur;
				}
				if (n == "Pagan")
				{
					num3 = this.savedPag;
				}
				if (n == "Sensory")
				{
					num3 = this.savedSen;
				}
				if (add)
				{
					this.character.stats.SetStat(n, num3 + 1f);
					return;
				}
				this.character.stats.SetStat(n, num3);
			}
		}
	}

	// Token: 0x06001211 RID: 4625 RVA: 0x0016148C File Offset: 0x0015F68C
	public bool HasTokens()
	{
		int num = 3;
		if (this.skillTokenUse1.enabled)
		{
			num--;
		}
		if (this.skillTokenUse2.enabled)
		{
			num--;
		}
		if (this.skillTokenUse3.enabled)
		{
			num--;
		}
		if (!this.levelUpSkills)
		{
			num = 1;
			if (this.statTokenUse1.enabled)
			{
				num--;
			}
		}
		return num > 0;
	}

	// Token: 0x06001212 RID: 4626 RVA: 0x001614F0 File Offset: 0x0015F6F0
	public bool IsToken(GameObject go)
	{
		return go.name == this.skillChosen1 || go.name == this.skillChosen2 || go.name == this.skillChosen3 || go.name == this.statChosen1;
	}

	// Token: 0x06001213 RID: 4627 RVA: 0x00161554 File Offset: 0x0015F754
	public int IncreaseAmt(int index, int m1, int m2, int m3, int skillLevel)
	{
		float num = 1f;
		if (index == m1)
		{
			num = 4f;
		}
		if (index == m2)
		{
			num = 3f;
		}
		if (index == m3)
		{
			num = 2f;
		}
		float num2 = 1f;
		if ((float)skillLevel <= 19f && num > 1f)
		{
			num2 = 4f;
		}
		if ((float)skillLevel > 20f && (float)skillLevel <= 39f && num > 1f)
		{
			num2 = 3f;
		}
		if ((float)skillLevel > 40f && (float)skillLevel <= 59f && num > 1f)
		{
			num2 = 2f;
		}
		if ((float)skillLevel > 60f)
		{
			num2 = 1f;
		}
		return (int)Mathf.Ceil(num2 * num);
	}

	// Token: 0x06001214 RID: 4628 RVA: 0x00161601 File Offset: 0x0015F801
	public int ReturnLeveledUpAmount(int i, int skillLevel)
	{
		return this.IncreaseAmt(i, this.multiplier1, this.multiplier2, this.multiplier3, skillLevel);
	}

	// Token: 0x06001215 RID: 4629 RVA: 0x00161620 File Offset: 0x0015F820
	private void SetSkillPointsRemaining()
	{
		this.str.Clear();
		int num = 3;
		if (this.skillTokenUse1.enabled)
		{
			num--;
		}
		if (this.skillTokenUse2.enabled)
		{
			num--;
		}
		if (this.skillTokenUse3.enabled)
		{
			num--;
		}
		if (!this.levelUpSkills)
		{
			num = 1;
			if (this.statTokenUse1.enabled)
			{
				num--;
			}
		}
		this.str.Append(num);
		this.str.Append(" point");
		if (num != 1)
		{
			this.str.Append("s");
		}
		this.str.Append(" remaining");
		this.skillPointsRemaining.text = this.str.ToString();
		if (num > 0)
		{
			this.confirmStats.SetActive(false);
			this.confirmSkills.SetActive(false);
			if (this.levelUpSkills)
			{
				this.skillsNotReadyButton.SetActive(true);
				return;
			}
			this.statsNotReadyButton.SetActive(true);
			return;
		}
		else
		{
			this.confirmStats.SetActive(true);
			this.confirmSkills.SetActive(true);
			if (this.levelUpSkills)
			{
				this.skillsNotReadyButton.SetActive(false);
				return;
			}
			this.statsNotReadyButton.SetActive(false);
			return;
		}
	}

	// Token: 0x06001216 RID: 4630 RVA: 0x0016175C File Offset: 0x0015F95C
	public void CloseAnimationDone()
	{
		Links.x.characterSheet.levelingUp = false;
		Links.x.characterSheet.CheckLevelUp();
		base.gameObject.SetActive(false);
		Records.x.RemoveMenu(base.gameObject);
		this.open = false;
		Links.x.characterSheet.EndLevelUp(false);
		Links.x.characterSheet.GetStats();
	}

	// Token: 0x06001217 RID: 4631 RVA: 0x001617CC File Offset: 0x0015F9CC
	public void CloseSkillsDone()
	{
		if (this.levelUps.Count >= 4)
		{
			this.Open(0.5f);
		}
		else
		{
			Links.x.characterSheet.PlayFaceAnimation(FaceAnimations.AnimationNames.Smile);
			this.CloseAnimationDone();
		}
		this.skillTokenUse1.enabled = false;
		this.skillTokenUse2.enabled = false;
		this.skillTokenUse3.enabled = false;
		this.statTokenUse1.enabled = false;
	}

	// Token: 0x06001218 RID: 4632 RVA: 0x0016183C File Offset: 0x0015FA3C
	public void CloseStatsDone()
	{
		if (this.levelUps.Count >= 4)
		{
			this.Open(0.5f);
		}
		else
		{
			Links.x.characterSheet.PlayFaceAnimation(FaceAnimations.AnimationNames.Smile);
			this.CloseAnimationDone();
		}
		this.skillTokenUse1.enabled = false;
		this.skillTokenUse2.enabled = false;
		this.skillTokenUse3.enabled = false;
		this.statTokenUse1.enabled = false;
	}

	// Token: 0x06001219 RID: 4633 RVA: 0x001618AC File Offset: 0x0015FAAC
	private void Cancel()
	{
		this.confirmStats.SetActive(false);
		this.confirmSkills.SetActive(false);
		if (this.alertCoroutineTokenInvalid != null)
		{
			base.StopCoroutine(this.alertCoroutineTokenInvalid);
			this.alertCoroutineTokenInvalid = null;
		}
		Links.x.characterSheet.canLevelUpSkill = false;
		Links.x.characterSheet.canLevelUpStat = false;
		this.skillTokenCounter1.enabled = true;
		this.skillTokenUse1.enabled = false;
		this.skillTokenCounter2.enabled = true;
		this.skillTokenUse2.enabled = false;
		this.skillTokenCounter3.enabled = true;
		this.skillTokenUse3.enabled = false;
		this.statTokenCounter1.enabled = true;
		this.statTokenUse1.enabled = false;
		if (this.levelUpSkills)
		{
			for (int i = 0; i < this.originalSkills.Count; i++)
			{
				this.currentSkills[i] = this.originalSkills[i];
			}
		}
		else
		{
			this.character.stats.SetStat("Strength", this.savedStr);
			this.character.stats.SetStat("Agility", this.savedAgl);
			this.character.stats.SetStat("Aura", this.savedAur);
			this.character.stats.SetStat("Sensory", this.savedSen);
			this.character.stats.SetStat("Pagan", this.savedPag);
			this.character.stats.SetStat("Dexterity", this.savedDex);
		}
		this.levelUps.Clear();
		if (this.levelUpSkills)
		{
			this.animator.Play("LevelUpSkillClose");
		}
		else
		{
			this.animator.Play("LevelUpStatClose");
		}
		Links.x.characterSheet.GetStats();
		this.skillsNotReadyButton.SetActive(true);
		this.statsNotReadyButton.SetActive(true);
	}

	// Token: 0x0600121A RID: 4634 RVA: 0x00161AA8 File Offset: 0x0015FCA8
	private void NextOrClose()
	{
		Links.x.characterSheet.canLevelUpSkill = false;
		Links.x.characterSheet.canLevelUpStat = false;
		this.levelUps.RemoveAt(0);
		this.levelUps.RemoveAt(0);
		this.levelUps.RemoveAt(0);
		this.levelUps.RemoveAt(0);
		this.str.Clear();
		for (int i = 0; i < this.levelUps.Count; i++)
		{
			this.str.Append(this.levelUps[i]);
			if (i != this.levelUps.Count - 1)
			{
				this.str.Append(",");
			}
		}
		string text = this.str.ToString();
		this.character.stats.levelUps = text;
		if (this.levelUpSkills)
		{
			this.animator.Play("LevelUpSkillClose");
		}
		else
		{
			this.animator.Play("LevelUpStatClose");
		}
		this.open = false;
		if (this.alertCoroutineTokenInvalid != null)
		{
			this.alertTokensInvalid.SetActive(false);
			base.StopCoroutine(this.alertCoroutineTokenInvalid);
			this.alertCoroutineTokenInvalid = null;
		}
	}

	// Token: 0x0600121B RID: 4635 RVA: 0x00161BDB File Offset: 0x0015FDDB
	public void CancelAction()
	{
		if (this.draggingToken)
		{
			this.ReturnTokenDrag();
			return;
		}
		this.CloseMenu();
	}

	// Token: 0x0600121C RID: 4636 RVA: 0x00161BF2 File Offset: 0x0015FDF2
	public void CloseMenu()
	{
		if (this.open)
		{
			this.Cancel();
			this.open = false;
			Links.x.characterSheet.CheckLevelUp();
		}
	}

	// Token: 0x0600121D RID: 4637 RVA: 0x00161C18 File Offset: 0x0015FE18
	private bool TokensInvalid()
	{
		int num = -1;
		bool flag = false;
		string text = "";
		if (this.skillChosen1 != "" && this.SubTokenForArmorRequirements(this.skillChosen1))
		{
			num = this.GetTransformIndex(this.skillChosen1, false);
			text = this.skillChosen1;
			if (num == -1)
			{
				Debug.LogError("Index is -1 for " + this.skillChosen1);
			}
			flag = true;
		}
		if (this.skillChosen2 != "" && this.SubTokenForArmorRequirements(this.skillChosen2))
		{
			num = this.GetTransformIndex(this.skillChosen2, false);
			text = this.skillChosen2;
			if (num == -1)
			{
				Debug.LogError("Index is -1 for " + this.skillChosen2);
			}
			flag = true;
		}
		if (this.skillChosen3 != "" && this.SubTokenForArmorRequirements(this.skillChosen3))
		{
			num = this.GetTransformIndex(this.skillChosen3, false);
			text = this.skillChosen3;
			if (num == -1)
			{
				Debug.LogError("Index is -1 for " + this.skillChosen3);
			}
			flag = true;
		}
		if (flag)
		{
			string text2 = Links.x.manual.DisplayName(text);
			this.alertMessageFocusInvalid.text = "<font=Bold><size=1.3em>Cannot use this!</size></font>\n" + text2;
			this.alertTokensInvalid.gameObject.GetComponent<RectTransform>().anchoredPosition3D = this.skillTrs[num].anchoredPosition3D + new Vector3(1.5f, 0.03f, 0f);
			return true;
		}
		if (this.alertCoroutineTokenInvalid != null)
		{
			this.alertTokensInvalid.SetActive(false);
			base.StopCoroutine(this.alertCoroutineTokenInvalid);
		}
		return false;
	}

	// Token: 0x0600121E RID: 4638 RVA: 0x00161DAC File Offset: 0x0015FFAC
	public bool SubTokenForArmorRequirements(string skill)
	{
		if (this.selectedRace == "Yeti")
		{
			if (skill == "ShortSword" || skill == "Short Sword")
			{
				return true;
			}
			if (skill == "Ax")
			{
				return true;
			}
			if (skill == "Bow")
			{
				return true;
			}
			if (skill == "Sling" || skill == "Slings")
			{
				return true;
			}
			if (skill == "SmallShield" || skill == "Small Shield")
			{
				return true;
			}
			if (skill == "Whip")
			{
				return true;
			}
			if (skill == "Elixir" || skill == "Elixirs")
			{
				return true;
			}
		}
		return false;
	}

	// Token: 0x0600121F RID: 4639 RVA: 0x00161E6C File Offset: 0x0016006C
	public int GetTransformIndex(string s, bool isStat)
	{
		if (isStat)
		{
			if (s == "Strength")
			{
				return 30;
			}
			if (s == "Agility")
			{
				return 34;
			}
			if (s == "Aura")
			{
				return 31;
			}
			if (s == "Pagan")
			{
				return 32;
			}
			if (s == "Dexterity")
			{
				return 33;
			}
			if (s == "Sensory")
			{
				return 35;
			}
		}
		else
		{
			if (s == "Robes")
			{
				return 11;
			}
			if (s == "Pearl")
			{
				return 13;
			}
			if (s == "Crimscale")
			{
				return 12;
			}
			if (s == "Stonewood")
			{
				return 14;
			}
			if (s == "ShortSword" || s == "Short Sword")
			{
				return 0;
			}
			if (s == "LongSword" || s == "Long Sword")
			{
				return 1;
			}
			if (s == "Scepter")
			{
				return 2;
			}
			if (s == "Ax")
			{
				return 4;
			}
			if (s == "Pole")
			{
				return 5;
			}
			if (s == "Multi-Hand")
			{
				return 9;
			}
			if (s == "Bow")
			{
				return 7;
			}
			if (s == "Sling" || s == "Slings")
			{
				return 6;
			}
			if (s == "Elixir" || s == "Elixirs")
			{
				return 10;
			}
			if (s == "Hand-to-Hand" || s == "Hand-To-Hand")
			{
				return 8;
			}
			if (s == "LargeShield" || s == "Large Shield")
			{
				return 20;
			}
			if (s == "SmallShield" || s == "Small Shield")
			{
				return 19;
			}
			if (s == "Bindings")
			{
				return 15;
			}
			if (s == "Fauna")
			{
				return 16;
			}
			if (s == "Vines")
			{
				return 17;
			}
			if (s == "Spores")
			{
				return 18;
			}
			if (s == "Lockpick" || s == "Lockpicking")
			{
				return 27;
			}
			if (s == "Sneaking")
			{
				return 28;
			}
			if (s == "Bartering")
			{
				return 29;
			}
			if (s == "Fish" || s == "Charm Fish")
			{
				return 21;
			}
			if (s == "Forest" || s == "Charm Forest")
			{
				return 22;
			}
			if (s == "Shroom" || s == "Charm Shrooms")
			{
				return 23;
			}
			if (s == "Flute")
			{
				return 24;
			}
			if (s == "Horn")
			{
				return 25;
			}
			if (s == "Drum")
			{
				return 29;
			}
			if (s == "Pipe" || s == "Shepard Pipes")
			{
				return 26;
			}
			if (s == "Melee")
			{
				return 19;
			}
			if (s == "Range")
			{
				return 20;
			}
			if (s == "Defense")
			{
				return 21;
			}
			if (s == "Whip")
			{
				return 3;
			}
		}
		return -1;
	}

	// Token: 0x06001220 RID: 4640 RVA: 0x00162198 File Offset: 0x00160398
	public int GetSkillIndex(string n)
	{
		if (n == "Short Sword")
		{
			return 4;
		}
		if (n == "Long Sword")
		{
			return 5;
		}
		if (n == "Scepter")
		{
			return 6;
		}
		if (n == "Whip")
		{
			return 35;
		}
		if (n == "Ax")
		{
			return 7;
		}
		if (n == "Pole")
		{
			return 8;
		}
		if (n == "Slings" || n == "Sling")
		{
			return 11;
		}
		if (n == "Bow")
		{
			return 10;
		}
		if (n == "Hand-To-Hand")
		{
			return 13;
		}
		if (n == "Multi-Hand")
		{
			return 9;
		}
		if (n == "Elixirs")
		{
			return 12;
		}
		if (n == "Robes")
		{
			return 0;
		}
		if (n == "Crimscale")
		{
			return 2;
		}
		if (n == "Pearl")
		{
			return 1;
		}
		if (n == "Stonewood")
		{
			return 3;
		}
		if (n == "Melee")
		{
			return 30;
		}
		if (n == "Range")
		{
			return 31;
		}
		if (n == "Defense")
		{
			return 32;
		}
		if (n == "Bindings")
		{
			return 16;
		}
		if (n == "Fauna")
		{
			return 17;
		}
		if (n == "Vines")
		{
			return 18;
		}
		if (n == "Spores")
		{
			return 19;
		}
		if (n == "Small Shield")
		{
			return 15;
		}
		if (n == "Large Shield")
		{
			return 14;
		}
		if (n == "Charm Forest")
		{
			return 24;
		}
		if (n == "Charm Fish")
		{
			return 23;
		}
		if (n == "Charm Shrooms")
		{
			return 25;
		}
		if (n == "Flute" || n == "flute")
		{
			return 26;
		}
		if (n == "Horn" || n == "horn")
		{
			return 27;
		}
		if (n == "Drum" || n == "drum")
		{
			return 28;
		}
		if (n.Contains("ipe"))
		{
			return 29;
		}
		if (n.Contains("ockpicking"))
		{
			return 20;
		}
		if (n.Contains("neaking"))
		{
			return 21;
		}
		if (n.Contains("artering"))
		{
			return 22;
		}
		return -1;
	}

	// Token: 0x04001DBA RID: 7610
	[Header("OBJECTS")]
	public GameObject skillObjects;

	// Token: 0x04001DBB RID: 7611
	public GameObject statsObjects;

	// Token: 0x04001DBC RID: 7612
	public Animator animator;

	// Token: 0x04001DBD RID: 7613
	public Image statTokenCounter1;

	// Token: 0x04001DBE RID: 7614
	public Image statTokenUse1;

	// Token: 0x04001DBF RID: 7615
	public Image skillTokenCounter1;

	// Token: 0x04001DC0 RID: 7616
	public Image skillTokenUse1;

	// Token: 0x04001DC1 RID: 7617
	public Image skillTokenCounter2;

	// Token: 0x04001DC2 RID: 7618
	public Image skillTokenUse2;

	// Token: 0x04001DC3 RID: 7619
	public Image skillTokenCounter3;

	// Token: 0x04001DC4 RID: 7620
	public Image skillTokenUse3;

	// Token: 0x04001DC5 RID: 7621
	public RectTransform skillTokenUse1RT;

	// Token: 0x04001DC6 RID: 7622
	public RectTransform skillTokenUse2RT;

	// Token: 0x04001DC7 RID: 7623
	public RectTransform skillTokenUse3RT;

	// Token: 0x04001DC8 RID: 7624
	public RectTransform statTokenUse1RT;

	// Token: 0x04001DC9 RID: 7625
	public RectTransform skillTokenBack1RT;

	// Token: 0x04001DCA RID: 7626
	public RectTransform skillTokenBack2RT;

	// Token: 0x04001DCB RID: 7627
	public RectTransform skillTokenBack3RT;

	// Token: 0x04001DCC RID: 7628
	public RectTransform statTokenBack1RT;

	// Token: 0x04001DCD RID: 7629
	public List<RectTransform> skillTrs = new List<RectTransform>();

	// Token: 0x04001DCE RID: 7630
	public List<Image> skillTokenImages = new List<Image>();

	// Token: 0x04001DCF RID: 7631
	private StringFast str = new StringFast(64);

	// Token: 0x04001DD0 RID: 7632
	public TextMeshProUGUI skillMessage;

	// Token: 0x04001DD1 RID: 7633
	public TextMeshProUGUI skillTitle;

	// Token: 0x04001DD2 RID: 7634
	public TextMeshProUGUI skillPointsRemaining;

	// Token: 0x04001DD3 RID: 7635
	public GameObject skillsNotReadyButton;

	// Token: 0x04001DD4 RID: 7636
	public GameObject statsNotReadyButton;

	// Token: 0x04001DD5 RID: 7637
	public GameObject confirmStats;

	// Token: 0x04001DD6 RID: 7638
	public GameObject confirmSkills;

	// Token: 0x04001DD7 RID: 7639
	public GameObject alertTokensInvalid;

	// Token: 0x04001DD8 RID: 7640
	public TextMeshProUGUI alertMessageFocusInvalid;

	// Token: 0x04001DD9 RID: 7641
	public List<Button> backgroundButtons = new List<Button>();

	// Token: 0x04001DDA RID: 7642
	[Header("INFO")]
	public bool levelUpSkills;

	// Token: 0x04001DDB RID: 7643
	public Character character;

	// Token: 0x04001DDC RID: 7644
	public int multiplier1;

	// Token: 0x04001DDD RID: 7645
	public int multiplier2;

	// Token: 0x04001DDE RID: 7646
	public int multiplier3;

	// Token: 0x04001DDF RID: 7647
	public int level;

	// Token: 0x04001DE0 RID: 7648
	public string skillChosen1;

	// Token: 0x04001DE1 RID: 7649
	public string skillChosen2;

	// Token: 0x04001DE2 RID: 7650
	public string skillChosen3;

	// Token: 0x04001DE3 RID: 7651
	public string statChosen1;

	// Token: 0x04001DE4 RID: 7652
	public string selectedRace;

	// Token: 0x04001DE5 RID: 7653
	public List<float> originalSkills = new List<float>();

	// Token: 0x04001DE6 RID: 7654
	private List<float> currentSkills;

	// Token: 0x04001DE7 RID: 7655
	public float savedStr;

	// Token: 0x04001DE8 RID: 7656
	public float savedAgl;

	// Token: 0x04001DE9 RID: 7657
	public float savedAur;

	// Token: 0x04001DEA RID: 7658
	public float savedDex;

	// Token: 0x04001DEB RID: 7659
	public float savedSen;

	// Token: 0x04001DEC RID: 7660
	public float savedPag;

	// Token: 0x04001DED RID: 7661
	public List<int> levelUps = new List<int>();

	// Token: 0x04001DEE RID: 7662
	public bool fromTesting;

	// Token: 0x04001DEF RID: 7663
	public bool open;

	// Token: 0x04001DF0 RID: 7664
	private IEnumerator alertCoroutineTokenInvalid;

	// Token: 0x04001DF1 RID: 7665
	[Header("TOKEN DRAGGING")]
	public bool draggingToken;

	// Token: 0x04001DF2 RID: 7666
	[Header("TOKEN DRAGGING")]
	public bool startedDrag;

	// Token: 0x04001DF3 RID: 7667
	public RectTransform dragToken;

	// Token: 0x04001DF4 RID: 7668
	public GameObject dragIndicator;
}
