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

// Token: 0x020000D8 RID: 216
public class SkillBag : MonoBehaviour
{
	// Token: 0x0600140D RID: 5133 RVA: 0x00184500 File Offset: 0x00182700
	private void Start()
	{
		this.ToggleWindows(true, false);
		this.selectedAmmoIndex = 0;
		this.trinketWindow.gameObject.SetActive(false);
		this.tooltip.SetActive(false);
		this.spellTooltip.SetActive(false);
		this.outOfAmmoOutline.enabled = false;
		this.spellWindow = this.spellGridTransform.parent.gameObject.transform.parent.gameObject.GetComponent<Windows>();
		this.spellWindow.gameObject.SetActive(false);
		if (this.emptySpellSong)
		{
			this.emptySpellSong.SetActive(false);
		}
		foreach (RectTransform rectTransform in this.staticButtons)
		{
			this.staticBtns.Add(rectTransform.gameObject.GetComponent<Button>());
		}
	}

	// Token: 0x0600140E RID: 5134 RVA: 0x001845FC File Offset: 0x001827FC
	public void ToggleWindowsFromBtn()
	{
		if (this.modalWindowsOpen)
		{
			this.ToggleWindows(false, false);
			return;
		}
		this.ToggleWindows(true, false);
	}

	// Token: 0x0600140F RID: 5135 RVA: 0x00184618 File Offset: 0x00182818
	public void Dragging()
	{
		if (Links.x.pocketWheel.spellbook.activeSelf)
		{
			for (int i = 0; i < this.spells.Count; i++)
			{
				GameObject gameObject = this.spells[i].gameObject;
				if (!gameObject.activeSelf)
				{
					gameObject.SetActive(true);
				}
			}
		}
	}

	// Token: 0x06001410 RID: 5136 RVA: 0x00184674 File Offset: 0x00182874
	public void UpdateButtonsFromGrid(float columnsWanted, float rowsWanted, float cellWidth)
	{
		float num = Mathf.Round(columnsWanted) * cellWidth;
		float num2 = rowsWanted * cellWidth;
		if (Links.x.pocketWheel.spellbook.activeSelf)
		{
			for (int i = 0; i < this.spells.Count; i++)
			{
				GameObject gameObject = this.spells[i].gameObject;
				bool flag = false;
				Vector3 anchoredPosition3D = this.spells[i].rt.anchoredPosition3D;
				if (anchoredPosition3D.x > num - 10f)
				{
					flag = true;
				}
				if (anchoredPosition3D.y < num2 * -1f + 10f)
				{
					flag = true;
				}
				if (flag && Links.x.joy)
				{
					if (gameObject.activeSelf)
					{
						gameObject.SetActive(false);
					}
				}
				else if (!gameObject.activeSelf)
				{
					gameObject.SetActive(true);
				}
			}
		}
		int num3 = this.staticButtons.Count + this.songs.Count + this.dynamicButtons.Count;
		int count = this.staticButtons.Count;
		int count2 = this.dynamicButtons.Count;
		int count3 = this.songs.Count;
		for (int j = 0; j < num3; j++)
		{
			GameObject gameObject2;
			if (j < count)
			{
				gameObject2 = this.staticButtons[j].gameObject;
			}
			else if (j < count + count3)
			{
				gameObject2 = this.songs[j - count].gameObject;
			}
			else
			{
				gameObject2 = this.dynamicButtons[j - count - count3].gameObject;
			}
			if (gameObject2.activeSelf)
			{
				Button button;
				if (j < count)
				{
					button = this.staticBtns[j];
				}
				else if (j < count + count3)
				{
					button = this.songs[j - count].button;
				}
				else
				{
					button = this.dynamicButtons[j - count - count3];
				}
				Navigation navigation = button.navigation;
				navigation.selectOnDown = null;
				navigation.selectOnUp = null;
				navigation.selectOnLeft = null;
				navigation.selectOnRight = null;
				bool flag2 = false;
				for (int k = j + 1; k < num3; k++)
				{
					Button button2;
					if (k < count)
					{
						button2 = this.staticBtns[k];
					}
					else if (k < count + count3)
					{
						button2 = this.songs[k - count].button;
					}
					else
					{
						button2 = this.dynamicButtons[k - count - count3];
					}
					if (button2.gameObject.activeSelf && !flag2)
					{
						navigation.selectOnRight = button2;
						flag2 = true;
					}
				}
				flag2 = false;
				for (int l = j - 1; l >= 0; l--)
				{
					Button button3;
					if (l < count)
					{
						button3 = this.staticBtns[l];
					}
					else if (l < count + count3)
					{
						button3 = this.songs[l - count].button;
					}
					else
					{
						button3 = this.dynamicButtons[l - count - count3];
					}
					if (button3.gameObject.activeSelf && !flag2)
					{
						navigation.selectOnLeft = button3;
						flag2 = true;
					}
				}
				button.navigation = navigation;
			}
		}
	}

	// Token: 0x06001411 RID: 5137 RVA: 0x00184995 File Offset: 0x00182B95
	public void NewPortrait()
	{
		this.updated = 0;
		this.UpdatePortraits(0);
	}

	// Token: 0x06001412 RID: 5138 RVA: 0x001849A5 File Offset: 0x00182BA5
	public void AddButton(Button btn)
	{
		this.dynamicButtons.Add(btn);
		this.trinketWindow.GridLayout(false, false);
	}

	// Token: 0x06001413 RID: 5139 RVA: 0x001849C0 File Offset: 0x00182BC0
	public void RemoveButton(Button btn)
	{
		int num = this.dynamicButtons.IndexOf(btn);
		if (num > -1)
		{
			this.dynamicButtons.RemoveAt(num);
		}
		this.trinketWindow.GridLayout(false, false);
	}

	// Token: 0x06001414 RID: 5140 RVA: 0x001849F8 File Offset: 0x00182BF8
	public void UpdatePortraits(int index)
	{
		if (this.updated < 3)
		{
			if (this.texturesIdle == null || this.updated == 0)
			{
				this.texturesIdle = this.portrait.character.characterSheetPortrait.texturesIdle;
			}
			if (this.texturesIdle != null && this.trinketPortrait)
			{
				this.texturesIdle = this.portrait.character.characterSheetPortrait.texturesIdle;
				this.trinketPortrait.texture = this.texturesIdle;
				this.updated++;
			}
		}
	}

	// Token: 0x06001415 RID: 5141 RVA: 0x00184A97 File Offset: 0x00182C97
	public void ResetWeapons()
	{
		this.current0 = -1;
		this.current16 = -1;
	}

	// Token: 0x06001416 RID: 5142 RVA: 0x00184AA8 File Offset: 0x00182CA8
	public void UpdateWindowStates()
	{
		if (!this.weaponTransform)
		{
			return;
		}
		bool flag = false;
		this.currentItems[0] = this.character.GetInvNum(0);
		this.currentItems[1] = 0;
		this.currentItems[2] = 0;
		this.currentItems[3] = 0;
		this.currentItems[4] = 0;
		this.currentItems[5] = this.character.GetInvNum(32);
		this.currentItems[6] = 0;
		this.currentItems[7] = 0;
		this.currentItems[8] = this.character.GetInvNum(8);
		this.currentItems[9] = this.character.GetInvNum(10);
		this.currentItems[10] = this.character.GetInvNum(12);
		this.currentItems[11] = this.character.GetInvNum(14);
		this.currentItems[12] = this.character.GetInvNum(26);
		this.currentItems[13] = this.character.GetInvNum(28);
		for (int i = 0; i < 14; i++)
		{
			if (this.currentItems[i] != this.previousItems[i])
			{
				flag = (i != 0 && i != 5) || (this.currentItems[i] != this.current0 && this.currentItems[i] != this.current16) || true;
			}
			this.previousItems[i] = this.currentItems[i];
		}
		if (flag)
		{
			this.SetTrinketGrid(false);
		}
		this.UpdateAbilityTriggers();
		this.str.Clear();
		this.tooltipText.spriteAsset = Links.x.GetSpriteSheetAsset(Links.x.gameplay.currentSpriteSheetAsset);
		this.spellTooltipText.spriteAsset = Links.x.GetSpriteSheetAsset(Links.x.gameplay.currentSpriteSheetAsset);
		this.str.Clear();
		if (Links.x.mk)
		{
			this.str.Append("  <color=#605E5A>");
			this.str.Append("<voffset=.4em><size=20><sprite=");
			int keyIconIndex = Links.x.keyControl.GetKeyIconIndex("LMB");
			this.str.Append(keyIconIndex);
			this.str.Append(" color=#000000></size></voffset></color>");
		}
		else
		{
			this.str.Append("  <color=#605E5A> ");
			this.str.Append("<voffset=.4em><size=20><sprite=");
			int controllerSprite = Links.x.gameplay.GetControllerSprite("Action", Links.x.gameplay.controllerName);
			this.str.Append(controllerSprite);
			this.str.Append(" color=#000000></size></voffset></color>");
		}
		this.controlText2 = this.str.ToString();
		this.str.Clear();
		this.str.Append("  <color=#605E5A>");
		this.str.Append("<voffset=.4em><size=2><sprite=");
		this.str.Append(Links.x.keyControl.GetKeyIconIndex("LMB"));
		this.str.Append(" color=#000000></size></voffset></color>");
		this.fakeText = this.str.ToString();
	}

	// Token: 0x06001417 RID: 5143 RVA: 0x00184DC0 File Offset: 0x00182FC0
	public void ToggleWindows(bool state, bool fromMenus)
	{
		if (!this.scrollTrinket)
		{
			return;
		}
		if (state && fromMenus && !this.modalWindowsOpen)
		{
			state = false;
		}
		this.scrollTrinket.enabled = state;
		this.glgTrinket1.enabled = state;
		if (!this.trinketWindow.minimized)
		{
			for (int i = 0; i < this.spells.Count; i++)
			{
				this.spells[i].ToggleStateSkillMenu(state);
			}
			for (int j = 0; j < this.items.Count; j++)
			{
				this.items[j].ToggleStateSkillMenu(state);
			}
		}
		if (!fromMenus)
		{
			this.modalWindowsOpen = state;
		}
	}

	// Token: 0x06001418 RID: 5144 RVA: 0x00184E6C File Offset: 0x0018306C
	public void MinimizeWindow()
	{
		bool flag = true;
		if (this.trinketWindow.minimized)
		{
			flag = false;
		}
		for (int i = 0; i < this.spells.Count; i++)
		{
			this.spells[i].ToggleStateSkillMenu(flag);
		}
		for (int j = 0; j < this.items.Count; j++)
		{
			this.items[j].ToggleStateSkillMenu(flag);
		}
	}

	// Token: 0x06001419 RID: 5145 RVA: 0x00184EDA File Offset: 0x001830DA
	public void SetFirstSong()
	{
		if (this.songs.Count > 0)
		{
			EventSystem.current.SetSelectedGameObject(this.songs[0].gameObject.gameObject);
		}
	}

	// Token: 0x0600141A RID: 5146 RVA: 0x00184F0C File Offset: 0x0018310C
	public void OpenSpells()
	{
		int count = this.spells.Count;
		for (int i = 0; i < count; i++)
		{
			this.spells[i].gameObject.transform.SetParent(this.spellGridTransform, false);
			this.spells[i].gameObject.SetActive(true);
		}
		if (count == 0)
		{
			this.emptySpellSong.SetActive(true);
			this.emptySpellSong.transform.SetParent(this.spellGridTransform, false);
		}
		else
		{
			this.emptySpellSong.SetActive(false);
			if (this.emptySpellSong.transform.parent != this.weaponTransform)
			{
				this.emptySpellSong.transform.SetParent(this.weaponTransform, false);
			}
		}
		if (Links.x.joy)
		{
			this.SetFirstSpell();
		}
		this.spellWindow.GridLayout(true, false);
	}

	// Token: 0x0600141B RID: 5147 RVA: 0x00184FF1 File Offset: 0x001831F1
	public void SetFirstSpell()
	{
		if (this.spells.Count > 0)
		{
			EventSystem.current.SetSelectedGameObject(this.spells[0].gameObject.gameObject);
		}
	}

	// Token: 0x0600141C RID: 5148 RVA: 0x00185021 File Offset: 0x00183221
	public void CloseSongs()
	{
	}

	// Token: 0x0600141D RID: 5149 RVA: 0x00185024 File Offset: 0x00183224
	public void CloseSpells()
	{
		int count = this.spells.Count;
		for (int i = 0; i < count; i++)
		{
			this.spells[i].gameObject.SetActive(false);
			this.spells[i].gameObject.transform.SetParent(this.weaponTransform, false);
		}
		if (this.emptySpellSong.transform.parent != this.weaponTransform)
		{
			this.emptySpellSong.transform.SetParent(this.weaponTransform, false);
			this.emptySpellSong.SetActive(false);
		}
	}

	// Token: 0x0600141E RID: 5150 RVA: 0x001850C4 File Offset: 0x001832C4
	public void SetSongGrid()
	{
		this.character.stats.UpdateAbilityTriggers();
		int count = this.abilityNames.Count;
		if (this.songs.Count > 0)
		{
			for (int i = 0; i < this.songs.Count; i++)
			{
				Links.x.cellar.ReturnPooledUIObject(71, this.songs[i].gameObject);
			}
			this.songs.Clear();
		}
		if (this.character.stats.HasSongbook() && this.character.HasInstrument())
		{
			for (int j = 0; j < count; j++)
			{
				if (this.abilityRows[j]._IsSong && this.abilityReady[j] && this.abilityEquipped[j] == 1)
				{
					GameObject pooledGameObject = Links.x.cellar.GetPooledGameObject(71);
					pooledGameObject.SetActive(true);
					pooledGameObject.transform.SetParent(this.weaponTransform, false);
					SkillButton component = pooledGameObject.GetComponent<SkillButton>();
					component.abilityName = this.abilityNames[j];
					component.uniqueName = this.uniqueNames[j];
					component.index = j;
					component.character = this.character;
					component.inWindow = true;
					component.inSpellMenu = false;
					component.Setup(true, this.abilityReady[j]);
					this.songs.Add(component);
					pooledGameObject.transform.localPosition = new Vector3(0f, 0f, 0f);
				}
			}
			for (int k = 0; k < this.dynamicButtons.Count; k++)
			{
				this.dynamicButtons[k].gameObject.transform.SetAsLastSibling();
			}
			this.trinketWindow.GridLayout(false, false);
		}
		this.SongProcs();
	}

	// Token: 0x0600141F RID: 5151 RVA: 0x001852AC File Offset: 0x001834AC
	public void SongProcs()
	{
		foreach (SkillButton skillButton in this.songs)
		{
			if (skillButton)
			{
				skillButton.ShowTrigger();
			}
		}
	}

	// Token: 0x06001420 RID: 5152 RVA: 0x00185308 File Offset: 0x00183508
	public void SetSpellbookGrid()
	{
		if (true)
		{
			int count = this.abilityNames.Count;
			if (this.spells.Count > 0)
			{
				for (int i = 0; i < this.spells.Count; i++)
				{
					Links.x.cellar.ReturnPooledUIObject(17, this.spells[i].gameObject);
				}
				this.spells.Clear();
			}
			if (this.character.stats.HasSpellbook())
			{
				for (int j = 0; j < count; j++)
				{
					if (this.abilityRows[j]._IsSpell)
					{
						GameObject pooledGameObject = Links.x.cellar.GetPooledGameObject(17);
						pooledGameObject.SetActive(true);
						pooledGameObject.transform.SetParent(this.weaponTransform, false);
						SkillButton component = pooledGameObject.GetComponent<SkillButton>();
						component.abilityName = this.abilityNames[j];
						component.uniqueName = this.uniqueNames[j];
						component.index = j;
						component.abilityCost = this.abilityCosts[j].x;
						component.character = this.character;
						component.inWindow = true;
						component.inSpellMenu = false;
						component.spellStats = this.spellLevels[j];
						component.Setup(true, this.abilityReady[j]);
						this.spells.Add(component);
						pooledGameObject.transform.localPosition = Vector3.zero;
						pooledGameObject.SetActive(false);
					}
				}
			}
			this.UpdateWindowStates();
			this.ToggleWindows(this.character.stats.modalWindowsOpen, false);
		}
	}

	// Token: 0x06001421 RID: 5153 RVA: 0x001854A6 File Offset: 0x001836A6
	public int GetSpellCount()
	{
		return this.spells.Count;
	}

	// Token: 0x06001422 RID: 5154 RVA: 0x001854B3 File Offset: 0x001836B3
	public int GetSongCount()
	{
		return this.songs.Count;
	}

	// Token: 0x06001423 RID: 5155 RVA: 0x001854C0 File Offset: 0x001836C0
	public void NewCharacter()
	{
		this.current0 = -1;
		this.current16 = -1;
		this.current0Durability = -1;
		this.current16Durability = -1;
	}

	// Token: 0x06001424 RID: 5156 RVA: 0x001854E0 File Offset: 0x001836E0
	public void SetTrinketGrid(bool getAbilityLists)
	{
		if (this.abilityNames == null || getAbilityLists)
		{
			this.abilityNames = this.character.stats.abilityNames;
			this.uniqueNames = this.character.stats.uniqueNames;
			this.spellLevels = this.character.stats.abilityLevels;
			this.abilityCosts = this.character.stats.abilityCost;
			this.abilityRows = this.character.stats.abilityRows;
			this.abilityNumbers = this.character.stats.abilityLevels;
			this.abilityReady = this.character.stats.abilityReady;
			this.abilityEquipped = this.character.stats.abilityEquipped;
		}
		int count = this.abilityNames.Count;
		if (this.items.Count > 0)
		{
			for (int i = 0; i < this.items.Count; i++)
			{
				Links.x.cellar.ReturnPooledUIObject(17, this.items[i].gameObject);
			}
			this.items.Clear();
		}
		this.offButtons.Clear();
		int num = this.character.GetInvNum(8);
		Library.Inventory invRow = Links.x.library.GetInvRow(num);
		int num2 = this.character.GetInvNum(10);
		Library.Inventory invRow2 = Links.x.library.GetInvRow(num2);
		int num3 = this.character.GetInvNum(12);
		Library.Inventory invRow3 = Links.x.library.GetInvRow(num3);
		int invNum = this.character.GetInvNum(0);
		int invNum2 = this.character.GetInvNum(32);
		if ((num > 1 || num2 > 1 || num3 > 1) && this.character.invRow1 != null)
		{
			this.character.GetAmmoIndex(this.character.invRow1);
		}
		if (invNum == this.current0 || this.current0 == -1)
		{
			this.current0Durability = 0;
			this.current16Durability = 16;
			this.selectedWpnIndex = 0;
			this.character.selectedWpnIndex = this.selectedWpnIndex;
		}
		else
		{
			this.current16Durability = 0;
			this.current0Durability = 16;
			this.selectedWpnIndex = 1;
			this.character.selectedWpnIndex = this.selectedWpnIndex;
		}
		if ((invNum == this.current0 || invNum == this.current16) && (invNum2 == this.current0 || invNum2 == this.current16))
		{
			invNum = this.current0;
			invNum2 = this.current16;
		}
		else
		{
			this.current0 = invNum;
			this.current16 = invNum2;
		}
		Library.Inventory invRow4 = Links.x.library.GetInvRow(invNum);
		Library.Inventory invRow5 = Links.x.library.GetInvRow(invNum2);
		Library.Inventory invRow6 = Links.x.library.GetInvRow(this.character.GetInvNum(0));
		if (invRow6._MainSkill == "Bow")
		{
			if (num < Links.x.library.arrowsMin || num > Links.x.library.arrowsMax || num <= 1)
			{
				num = 0;
			}
			if (num2 < Links.x.library.arrowsMin || num2 > Links.x.library.arrowsMax || num2 <= 1)
			{
				num2 = 0;
			}
			if (num3 < Links.x.library.arrowsMin || num3 > Links.x.library.arrowsMax || num3 <= 1)
			{
				num3 = 0;
			}
		}
		else if (invRow6._MainSkill == "Sling")
		{
			if (num != Links.x.library.dartsMin || num <= 1)
			{
				num = 0;
			}
			if (num2 != Links.x.library.dartsMin || num2 <= 1)
			{
				num2 = 0;
			}
			if (num3 != Links.x.library.dartsMin || num3 <= 1)
			{
				num3 = 0;
			}
		}
		else if (invRow6._MainSkill.Contains("Elixir"))
		{
			if (num < Links.x.library.vialsMin || num > Links.x.library.vialsMin + 1 || num <= 1)
			{
				num = 0;
			}
			if (num2 < Links.x.library.vialsMin || num2 > Links.x.library.vialsMin + 1 || num2 <= 1)
			{
				num2 = 0;
			}
			if (num3 < Links.x.library.vialsMin || num3 > Links.x.library.vialsMin + 1 || num3 <= 1)
			{
				num3 = 0;
			}
		}
		if (invNum2 > 1)
		{
			this.weapon2Img.sprite = Links.x.archives.GetItem(invRow5._UIModel);
			this.weapon2Name = invRow5._DisplayName;
		}
		else
		{
			this.weapon2Img.sprite = this.fist;
			this.weapon2Name = "Unarmed";
		}
		if (invNum > 1)
		{
			this.weaponImg.sprite = Links.x.archives.GetItem(invRow4._UIModel);
			this.weapon1Name = invRow4._DisplayName;
		}
		else
		{
			this.weaponImg.sprite = this.fist;
			this.weapon1Name = "Unarmed";
		}
		if (invRow4._ID <= 1 && invRow5._ID <= 1)
		{
			this.weapon.SetActive(true);
			this.weapon2.SetActive(false);
			this.offButtons.Add(this.weapon2);
		}
		else
		{
			this.weapon2.SetActive(true);
			this.weapon.SetActive(true);
			this.offButtons.Add(this.weapon);
		}
		if (this.character.GetInvNum(0) == this.current0)
		{
			this.starWeapon.transform.SetParent(this.weapon.transform, false);
		}
		else
		{
			this.starWeapon.transform.SetParent(this.weapon2.transform, false);
		}
		if (invRow6._MeleeRangeEnd >= 5f)
		{
			if (num > 1)
			{
				if (!this.ammo1.activeSelf)
				{
					this.ammo1.SetActive(true);
				}
				this.ammo1Img.sprite = Links.x.archives.GetItem(invRow._UIModel);
				if (this.selectedAmmoIndex == 0)
				{
					this.starAmmo.transform.SetParent(this.ammo1.transform, false);
					this.character.selectedAmmoIndex = 0;
				}
				this.ammo1Name = invRow._DisplayName;
				this.ammo1Txt.enabled = true;
			}
			else
			{
				if (this.ammo1.activeSelf)
				{
					this.ammo1.SetActive(false);
				}
				this.offButtons.Add(this.ammo1);
				this.ammo1Txt.enabled = false;
			}
			if (num2 > 1)
			{
				if (this.selectedAmmoIndex == 0 && num <= 1)
				{
					this.selectedAmmoIndex = 1;
					this.character.selectedAmmoIndex = 1;
				}
				if (!this.ammo2.activeSelf)
				{
					this.ammo2.SetActive(true);
				}
				this.ammo2Img.sprite = Links.x.archives.GetItem(invRow2._UIModel);
				if (this.selectedAmmoIndex == 1)
				{
					this.starAmmo.transform.SetParent(this.ammo2.transform, false);
				}
				this.ammo2Name = invRow2._DisplayName;
				this.ammo2Txt.enabled = true;
			}
			else
			{
				if (this.ammo2.activeSelf)
				{
					this.ammo2.SetActive(false);
				}
				this.offButtons.Add(this.ammo2);
				this.ammo2Txt.enabled = false;
			}
			if (num3 > 1)
			{
				if (this.selectedAmmoIndex < 2 && num <= 1 && num2 <= 1)
				{
					this.selectedAmmoIndex = 2;
					this.character.selectedAmmoIndex = 2;
				}
				if (!this.ammo3.activeSelf)
				{
					this.ammo3.SetActive(true);
				}
				this.ammo3Img.sprite = Links.x.archives.GetItem(invRow3._UIModel);
				if (this.selectedAmmoIndex == 2)
				{
					this.starAmmo.transform.SetParent(this.ammo3.transform, false);
				}
				this.ammo3Name = invRow3._DisplayName;
				this.ammo3Txt.enabled = true;
			}
			else
			{
				if (this.ammo3.activeSelf)
				{
					this.ammo3.SetActive(false);
				}
				this.offButtons.Add(this.ammo3);
				this.ammo3Txt.enabled = false;
			}
		}
		else
		{
			if (this.ammo1.activeSelf)
			{
				this.ammo1.SetActive(false);
			}
			this.offButtons.Add(this.ammo1);
			if (this.ammo2.activeSelf)
			{
				this.ammo2.SetActive(false);
			}
			this.offButtons.Add(this.ammo2);
			if (this.ammo3.activeSelf)
			{
				this.ammo3.SetActive(false);
			}
			this.offButtons.Add(this.ammo3);
		}
		this.UpdateAmmoNumbers();
		this.CheckAmmo();
		this.beltIndex1 = this.character.GetInvNum(14);
		this.beltItemRow1 = Links.x.library.GetInvRow(this.beltIndex1);
		if (!(this.beltItemRow1._Name == "Empty") && !(this.beltItemRow1._Name == "Fist"))
		{
			this.beltItem1Name = this.beltItemRow1._DisplayName;
		}
		int invNum3 = this.character.GetInvNum(15);
		this.beltIndex2 = this.character.GetInvNum(26);
		this.beltItemRow2 = Links.x.library.GetInvRow(this.beltIndex2);
		if (!(this.beltItemRow2._Name == "Empty") && !(this.beltItemRow2._Name == "Fist"))
		{
			this.beltItem2Name = this.beltItemRow2._DisplayName;
		}
		int invNum4 = this.character.GetInvNum(27);
		this.beltIndex3 = this.character.GetInvNum(28);
		this.beltItemRow3 = Links.x.library.GetInvRow(this.beltIndex3);
		if (!(this.beltItemRow3._Name == "Empty") && !(this.beltItemRow3._Name == "Fist"))
		{
			this.beltItem3Name = this.beltItemRow3._DisplayName;
		}
		int invNum5 = this.character.GetInvNum(29);
		for (int j = 0; j < 3; j++)
		{
			Library.Inventory inventory = this.beltItemRow1;
			if (j == 1)
			{
				inventory = this.beltItemRow2;
			}
			if (j == 2)
			{
				inventory = this.beltItemRow3;
			}
			if (inventory._Name == "Empty" || inventory._Name == "Fist" || (!inventory._RightClickAction.Contains("Consume") && inventory._MainSkill != "Charm" && inventory._Tag != "Scroll"))
			{
				if (j == 0)
				{
					if (this.beltItem1.activeSelf)
					{
						this.beltItem1.SetActive(false);
					}
					this.offButtons.Add(this.beltItem1);
				}
				if (j == 1)
				{
					if (this.beltItem2.activeSelf)
					{
						this.beltItem2.SetActive(false);
					}
					this.offButtons.Add(this.beltItem2);
				}
				if (j == 2)
				{
					if (this.beltItem3.activeSelf)
					{
						this.beltItem3.SetActive(false);
					}
					this.offButtons.Add(this.beltItem3);
				}
			}
			else
			{
				if (j == 0)
				{
					if (!this.beltItem1.activeSelf)
					{
						this.beltItem1.SetActive(true);
					}
					this.beltItem1Img.sprite = Links.x.archives.GetItem(inventory._UIModel);
					if (inventory._Stackable)
					{
						this.beltItem1text.text = invNum3.ToString();
						this.beltItem1text.enabled = true;
					}
					else
					{
						this.beltItem1text.enabled = false;
					}
				}
				if (j == 1)
				{
					if (!this.beltItem2.activeSelf)
					{
						this.beltItem2.SetActive(true);
					}
					this.beltItem2Img.sprite = Links.x.archives.GetItem(inventory._UIModel);
					if (inventory._Stackable)
					{
						this.beltItem2text.text = invNum4.ToString();
						this.beltItem2text.enabled = true;
					}
					else
					{
						this.beltItem2text.enabled = false;
					}
				}
				if (j == 2)
				{
					if (!this.beltItem3.activeSelf)
					{
						this.beltItem3.SetActive(true);
					}
					this.beltItem3Img.sprite = Links.x.archives.GetItem(inventory._UIModel);
					if (inventory._Stackable)
					{
						this.beltItem3text.text = invNum5.ToString();
						this.beltItem3text.enabled = true;
					}
					else
					{
						this.beltItem3text.enabled = false;
					}
				}
				if (!(inventory._RightClickAction != "") && !(inventory._MainSkill == "Charm"))
				{
					inventory._Tag == "Scroll";
				}
			}
		}
		if (Records.x.pocketPause)
		{
			Links.x.pocketWheel.SetupItems();
		}
		this.updated = 0;
		this.starWeapon.transform.SetAsFirstSibling();
		this.starAmmo.transform.SetAsFirstSibling();
		if (Records.x.banquetIsle)
		{
			this.trinketWindow.GridLayout(true, false);
		}
		else
		{
			this.trinketWindow.GridLayout(false, false);
		}
		this.SetAliveState();
		if (this.character.mainSelected)
		{
			Links.x.pocketWheel.Open(this.character);
		}
	}

	// Token: 0x06001425 RID: 5157 RVA: 0x00186290 File Offset: 0x00184490
	public void SetSelectedState()
	{
		if (!this.character)
		{
			return;
		}
		bool flag = this.character.mainSelected;
		flag = !Records.x.InCombat(false);
		this.beltItem1Btn.interactable = flag;
		this.beltItem2Btn.interactable = flag;
		this.beltItem3Btn.interactable = flag;
	}

	// Token: 0x06001426 RID: 5158 RVA: 0x001862F0 File Offset: 0x001844F0
	public void SetAliveState()
	{
		if (!this.character)
		{
			return;
		}
		if (this.character.stats.HealthCurrent() <= 0)
		{
			if (this.weaponTransform.gameObject.activeSelf)
			{
				this.weaponTransform.gameObject.SetActive(false);
				return;
			}
		}
		else if (!this.weaponTransform.gameObject.activeSelf)
		{
			this.weaponTransform.gameObject.SetActive(true);
		}
	}

	// Token: 0x06001427 RID: 5159 RVA: 0x00186368 File Offset: 0x00184568
	public void SetResizeDrag()
	{
		bool flag = true;
		if (Records.x)
		{
			if (Records.x.movingWindows)
			{
				flag = false;
			}
			for (int i = 0; i < this.windowImages.Count; i++)
			{
				this.windowImages[i].raycastTarget = flag;
			}
			for (int j = 0; j < this.spells.Count; j++)
			{
				this.spells[j].SetResizeDrag();
			}
			for (int k = 0; k < this.items.Count; k++)
			{
				this.items[k].SetResizeDrag();
			}
		}
	}

	// Token: 0x06001428 RID: 5160 RVA: 0x0018640C File Offset: 0x0018460C
	public void UpdateAmmoNumbers()
	{
		if (this.ammo1Txt.enabled)
		{
			this.ammo1Txt.text = this.character.GetInvNum(9).ToString();
		}
		if (this.ammo2Txt.enabled)
		{
			this.ammo2Txt.text = this.character.GetInvNum(11).ToString();
		}
		if (this.ammo3Txt.enabled)
		{
			this.ammo3Txt.text = this.character.GetInvNum(13).ToString();
		}
		this.CheckAmmo();
	}

	// Token: 0x06001429 RID: 5161 RVA: 0x001864A6 File Offset: 0x001846A6
	public void CheckAmmo()
	{
		if (!this.character.HasAmmoOrMelee(this.character.invRow1, false))
		{
			this.outOfAmmoOutline.enabled = true;
			return;
		}
		this.outOfAmmoOutline.enabled = false;
	}

	// Token: 0x0600142A RID: 5162 RVA: 0x001864DA File Offset: 0x001846DA
	public void ToggleHover(bool state)
	{
	}

	// Token: 0x0600142B RID: 5163 RVA: 0x001864DC File Offset: 0x001846DC
	public void RemoveSelectedButton()
	{
		if (this.selectedSkillButton)
		{
			this.selectedSkillButton.selected = false;
			this.selectedSkillButton.RemoveOutline();
			this.selectedSkillButton = null;
		}
	}

	// Token: 0x0600142C RID: 5164 RVA: 0x0018650C File Offset: 0x0018470C
	public SkillButton GetSkillButton(int num)
	{
		SkillButton skillButton = Links.x.cellar.GetSkillButton();
		skillButton.transform.SetParent(base.transform);
		RectTransform component = skillButton.gameObject.GetComponent<RectTransform>();
		component.anchoredPosition3D = new Vector3(component.anchoredPosition3D.x, component.anchoredPosition3D.y, 0f);
		component.localScale = new Vector3(1f, 1f, 1f);
		skillButton.character = this.character;
		return skillButton;
	}

	// Token: 0x0600142D RID: 5165 RVA: 0x00186594 File Offset: 0x00184794
	public void SetSkills()
	{
		bool flag = true;
		if (Records.x.removeControls)
		{
			flag = false;
		}
		if (!flag)
		{
			this.RemoveSelectedButton();
		}
	}

	// Token: 0x0600142E RID: 5166 RVA: 0x001865BA File Offset: 0x001847BA
	public void Remove()
	{
		if (this.trinketWindow)
		{
			this.trinketWindow.gameObject.SetActive(false);
		}
	}

	// Token: 0x0600142F RID: 5167 RVA: 0x001865DA File Offset: 0x001847DA
	public string GetHoverSpell(int num)
	{
		return "";
	}

	// Token: 0x06001430 RID: 5168 RVA: 0x001865E4 File Offset: 0x001847E4
	public void UpdateAbilityTriggers()
	{
		for (int i = 0; i < this.spells.Count; i++)
		{
			int index = this.spells[i].index;
			if (index < this.abilityReady.Count)
			{
				this.spells[i].UpdateUseState(this.abilityReady[index]);
			}
		}
	}

	// Token: 0x06001431 RID: 5169 RVA: 0x00186644 File Offset: 0x00184844
	public void Sneak()
	{
		if (Input.GetMouseButton(1) || Input.GetMouseButtonUp(1))
		{
			return;
		}
		if (!this.character.mainSelected)
		{
			Links.x.fellowship.SingleSelected(this.character);
			this.character.AddToSelected(false, true);
			this.character.SetAsLeader();
			Links.x.rtsCamera.Follow(this.character.tr, this.character, true);
		}
		if (this.sneakCoroutine != null)
		{
			base.StopCoroutine(this.sneakCoroutine);
			this.sneakCoroutine = null;
			if (Records.x.paused)
			{
				return;
			}
		}
		bool flag = true;
		if (this.character.body.sneaking)
		{
			flag = false;
		}
		this.sneakCoroutine = this.SneakWait(flag);
		base.StartCoroutine(this.sneakCoroutine);
		if (Links.x.mk)
		{
			EventSystem.current.SetSelectedGameObject(null);
		}
	}

	// Token: 0x06001432 RID: 5170 RVA: 0x0018672C File Offset: 0x0018492C
	private IEnumerator SneakWait(bool doSneak)
	{
		bool changeAnim = false;
		while (Records.x.paused)
		{
			if (!changeAnim)
			{
				changeAnim = true;
			}
			yield return null;
		}
		if (!doSneak)
		{
			this.character.EndSneak(false, false);
		}
		else
		{
			this.character.stats.StartSneak();
		}
		this.sneakCoroutine = null;
		yield break;
	}

	// Token: 0x06001433 RID: 5171 RVA: 0x00186742 File Offset: 0x00184942
	public void Lockpick()
	{
		if (!Input.GetMouseButton(1))
		{
			Input.GetMouseButtonUp(1);
		}
	}

	// Token: 0x06001434 RID: 5172 RVA: 0x00186754 File Offset: 0x00184954
	public void Charm()
	{
		if (Input.GetMouseButton(1) || Input.GetMouseButtonUp(1))
		{
			return;
		}
		Links.x.gameplay.RemoveAbilityInfo();
		Links.x.gameplay.actionCharacter = this.character;
		Links.x.gameplay.charming = true;
	}

	// Token: 0x06001435 RID: 5173 RVA: 0x001867A8 File Offset: 0x001849A8
	public void SwapWeapons1()
	{
		if (Input.GetMouseButton(1) || Input.GetMouseButtonUp(1))
		{
			return;
		}
		if (this.starWeapon.transform.parent == this.weapon.transform)
		{
			if (this.character.actions)
			{
				this.character.actions.selectedWeapon = true;
			}
		}
		else if (this.character.invRow2 != null)
		{
			if (this.character.invRow2._WpnSpeed > this.character.invRow1._WpnSpeed)
			{
				this.character.UpdateAtkTime(this.character.invRow2._WpnSpeed - this.character.invRow1._WpnSpeed);
				if (this.character.mainSelected && Records.x.pocketPause)
				{
					Links.x.gameplay.PocketPause(false);
				}
			}
			if (this.character.inventoryBag)
			{
				this.character.inventoryBag.SwapBagItem(0, 16, this.character, true);
			}
			if (this.character.inventoryBag)
			{
				this.character.inventoryBag.SwapBagItem(2, 18, this.character, true);
			}
			if (this.character.inventoryBag)
			{
				this.character.inventoryBag.SwapBagItem(1, 17, this.character, true);
			}
			if (this.character.inventoryBag)
			{
				this.character.inventoryBag.SwapBagItem(3, 15, this.character, true);
			}
			this.SetTrinketGrid(false);
			if (this.character.actions)
			{
				this.character.actions.selectedWeapon = true;
			}
		}
		if (Links.x.mk)
		{
			EventSystem.current.SetSelectedGameObject(null);
		}
		Links.x.gameplay.SetDomeSize();
		if (Links.x.joy)
		{
			this.trinketWindow.GridLayout(true, false);
		}
		else
		{
			this.trinketWindow.GridLayout(false, false);
		}
		Links.x.pocketWheel.SetRallyButtons();
	}

	// Token: 0x06001436 RID: 5174 RVA: 0x001869D4 File Offset: 0x00184BD4
	public void SwapWeapons2()
	{
		if (Input.GetMouseButton(1) || Input.GetMouseButtonUp(1))
		{
			return;
		}
		if (this.starWeapon.transform.parent == this.weapon2.transform)
		{
			if (this.character.actions)
			{
				this.character.actions.selectedWeapon = true;
			}
		}
		else
		{
			if (this.character.invRow2 != null && this.character.invRow2._WpnSpeed > this.character.invRow1._WpnSpeed)
			{
				this.character.UpdateAtkTime(this.character.invRow2._WpnSpeed - this.character.invRow1._WpnSpeed);
				if (this.character.mainSelected && Records.x.pocketPause)
				{
					Links.x.gameplay.PocketPause(false);
				}
			}
			if (this.character.inventoryBag)
			{
				this.character.inventoryBag.SwapBagItem(16, 0, this.character, true);
			}
			if (this.character.inventoryBag)
			{
				this.character.inventoryBag.SwapBagItem(18, 2, this.character, true);
			}
			if (this.character.inventoryBag)
			{
				this.character.inventoryBag.SwapBagItem(17, 1, this.character, true);
			}
			if (this.character.inventoryBag)
			{
				this.character.inventoryBag.SwapBagItem(15, 3, this.character, true);
			}
			this.SetTrinketGrid(false);
			if (this.character.actions)
			{
				this.character.actions.selectedWeapon = true;
			}
			if (this.character.GetInvNum(0) == this.character.GetInvNum(32))
			{
				this.starWeapon.transform.SetParent(this.weapon2.transform, false);
				this.starWeapon.transform.SetAsFirstSibling();
			}
		}
		if (Links.x.mk)
		{
			EventSystem.current.SetSelectedGameObject(null);
		}
		Links.x.gameplay.SetDomeSize();
		if (Links.x.joy)
		{
			this.trinketWindow.GridLayout(true, false);
		}
		else
		{
			this.trinketWindow.GridLayout(false, false);
		}
		Links.x.pocketWheel.SetRallyButtons();
	}

	// Token: 0x06001437 RID: 5175 RVA: 0x00186C41 File Offset: 0x00184E41
	public void SetSelectedAmmoIndex(int index)
	{
		if (index != this.selectedAmmoIndex)
		{
			this.selectedAmmoIndex = index;
			this.SetTrinketGrid(false);
		}
	}

	// Token: 0x06001438 RID: 5176 RVA: 0x00186C5C File Offset: 0x00184E5C
	public void CheckSelectedWeaponIndex()
	{
		int num = this.selectedWpnIndex;
		int num2 = this.selectedWpnIndex;
		if (this.character.GetInvNum(0) == this.current0 || this.current0 == -1)
		{
			num2 = 0;
		}
		else
		{
			num2 = 1;
		}
		if (num != num2)
		{
			this.SetSelectedWpnIndex(num2);
		}
	}

	// Token: 0x06001439 RID: 5177 RVA: 0x00186CA3 File Offset: 0x00184EA3
	public void SetSelectedWpnIndex(int index)
	{
		if (index != this.selectedWpnIndex)
		{
			this.selectedWpnIndex = index;
			this.character.selectedWpnIndex = this.selectedWpnIndex;
			if (index == 0)
			{
				this.SwapWeapons1();
			}
			if (index == 1)
			{
				this.SwapWeapons2();
			}
			this.SetTrinketGrid(false);
		}
	}

	// Token: 0x0600143A RID: 5178 RVA: 0x00186CE0 File Offset: 0x00184EE0
	public void SwapToArrow1()
	{
		if (Input.GetMouseButton(1) || Input.GetMouseButtonUp(1))
		{
			return;
		}
		if (this.selectedAmmoIndex != 0)
		{
			this.selectedAmmoIndex = 0;
			this.character.selectedAmmoIndex = 0;
			this.SetTrinketGrid(false);
			if (this.character.actions)
			{
				this.character.actions.selectedAmmo = true;
			}
		}
		if (Links.x.mk)
		{
			EventSystem.current.SetSelectedGameObject(null);
		}
	}

	// Token: 0x0600143B RID: 5179 RVA: 0x00186D5C File Offset: 0x00184F5C
	public void SwapToArrow2()
	{
		if (Input.GetMouseButton(1) || Input.GetMouseButtonUp(1))
		{
			return;
		}
		if (this.selectedAmmoIndex != 1)
		{
			this.selectedAmmoIndex = 1;
			this.character.selectedAmmoIndex = 1;
			this.SetTrinketGrid(false);
			if (this.character.actions)
			{
				this.character.actions.selectedAmmo = true;
			}
		}
		if (Links.x.mk)
		{
			EventSystem.current.SetSelectedGameObject(null);
		}
	}

	// Token: 0x0600143C RID: 5180 RVA: 0x00186DD8 File Offset: 0x00184FD8
	public void SwapToArrow3()
	{
		if (Input.GetMouseButton(1) || Input.GetMouseButtonUp(1))
		{
			return;
		}
		if (this.selectedAmmoIndex != 2)
		{
			this.selectedAmmoIndex = 2;
			this.character.selectedAmmoIndex = 2;
			this.SetTrinketGrid(false);
			if (this.character.actions)
			{
				this.character.actions.selectedAmmo = true;
			}
		}
		if (Links.x.mk)
		{
			EventSystem.current.SetSelectedGameObject(null);
		}
	}

	// Token: 0x0600143D RID: 5181 RVA: 0x00186E54 File Offset: 0x00185054
	private bool CanConsume(int i)
	{
		int invNum = this.character.GetInvNum(i * 2);
		Library.Inventory invRow = Links.x.library.GetInvRow(invNum);
		return invRow._RightClickAction != "" || (invRow._Tag == "Scroll" && Records.x.pocketPause) || (invRow._Tag == "Revive" && Records.x.pocketPause);
	}

	// Token: 0x0600143E RID: 5182 RVA: 0x00186ED6 File Offset: 0x001850D6
	public void BeltItem(int num)
	{
		if (num == 1)
		{
			this.UseBeltItem1(false);
		}
		if (num == 2)
		{
			this.UseBeltItem2(false);
		}
		if (num == 3)
		{
			this.UseBeltItem3(false);
		}
	}

	// Token: 0x0600143F RID: 5183 RVA: 0x00186EFC File Offset: 0x001850FC
	public bool UseBeltItem1(bool fromWheel)
	{
		if (!this.CanConsume(7) || (!this.beltItem1Btn.interactable && !fromWheel))
		{
			return false;
		}
		int num = this.beltItem1Btn.gameObject.transform.GetSiblingIndex();
		int invNum = this.character.GetInvNum(14);
		Library.Inventory invRow = Links.x.library.GetInvRow(invNum);
		if (invRow._Name.Contains("Leashed"))
		{
			return false;
		}
		if (!this.character.IsSentient())
		{
			return false;
		}
		if (this.character.actions && this.character.actions.cannotInterrupt)
		{
			this.character.actions.TryingToInterruptInventoryWait();
			return false;
		}
		if (Input.GetMouseButton(1) || Input.GetMouseButtonUp(1))
		{
			return false;
		}
		if (this.beltItem1text.enabled && invRow._Tag != "Revive")
		{
			int num2 = int.Parse(this.beltItem1text.text);
			num2--;
			this.beltItem1text.text = num2.ToString();
			if (num2 <= 0)
			{
				this.beltItem1Btn.interactable = false;
			}
		}
		this.character.UseQuickItem(7);
		this.UpdateWindowStates();
		if (Links.x.joy && !Links.x.pocketWheel.open)
		{
			if (num >= this.weaponTransform.childCount)
			{
				num--;
			}
			if (num >= this.weaponTransform.childCount)
			{
				num--;
			}
			if (!this.weaponTransform.GetChild(num).gameObject.activeSelf)
			{
				num--;
			}
			if (!this.weaponTransform.GetChild(num).gameObject.activeSelf)
			{
				num--;
			}
			if (!this.weaponTransform.GetChild(num).gameObject.activeSelf)
			{
				num--;
			}
			EventSystem.current.SetSelectedGameObject(this.weaponTransform.GetChild(num).gameObject);
		}
		if (Links.x.joy)
		{
			if (invRow._Name.Contains("Scroll") || invRow._Tag == "Revive")
			{
				Links.x.pocketWheel.WaitForTargets();
			}
			this.trinketWindow.GridLayout(true, false);
		}
		if (Links.x.mk)
		{
			EventSystem.current.SetSelectedGameObject(null);
		}
		if (Records.x.pocketPause && Records.x.InCombat(false) && !invRow._Name.Contains("Scroll") && invRow._Tag != "Revive")
		{
			if (Links.x.pocketWheel.open)
			{
				if (invRow._Name.Contains("Fatigue"))
				{
					Links.x.pocketWheel.EndTurn(0.667f);
				}
				else
				{
					Links.x.pocketWheel.EndTurn(0.333f);
				}
			}
		}
		else if (Records.x.InCombat(false) && !invRow._Name.Contains("Scroll") && invRow._Tag != "Revive" && this.character.actions)
		{
			this.character.actions.canEndAttackTime = true;
			this.character.actions.EndAttackTime(0f);
		}
		this.TooltipOff();
		return !invRow._Name.Contains("Scroll") && !(invRow._Tag == "Revive");
	}

	// Token: 0x06001440 RID: 5184 RVA: 0x00187274 File Offset: 0x00185474
	public bool UseBeltItem2(bool fromWheel)
	{
		if (!this.CanConsume(13) || (!this.beltItem2Btn.interactable && !fromWheel))
		{
			return false;
		}
		int num = this.beltItem2Btn.gameObject.transform.GetSiblingIndex();
		int invNum = this.character.GetInvNum(26);
		Library.Inventory invRow = Links.x.library.GetInvRow(invNum);
		if (invRow._Name.Contains("Leashed"))
		{
			return false;
		}
		if (!this.character.IsSentient())
		{
			return false;
		}
		if (this.character.actions && this.character.actions.cannotInterrupt)
		{
			this.character.actions.TryingToInterruptInventoryWait();
			return false;
		}
		if (this.beltItem2text.enabled && invRow._Tag != "Revive")
		{
			int num2 = int.Parse(this.beltItem2text.text);
			num2--;
			this.beltItem2text.text = num2.ToString();
			if (num2 <= 0)
			{
				this.beltItem2Btn.interactable = false;
			}
		}
		if (Input.GetMouseButton(1) || Input.GetMouseButtonUp(1))
		{
			return false;
		}
		this.character.UseQuickItem(13);
		this.UpdateWindowStates();
		if (Links.x.joy && !Links.x.pocketWheel.open)
		{
			if (num >= this.weaponTransform.childCount)
			{
				num--;
			}
			if (num >= this.weaponTransform.childCount)
			{
				num--;
			}
			if (!this.weaponTransform.GetChild(num).gameObject.activeSelf)
			{
				num--;
			}
			if (!this.weaponTransform.GetChild(num).gameObject.activeSelf)
			{
				num--;
			}
			if (!this.weaponTransform.GetChild(num).gameObject.activeSelf)
			{
				num--;
			}
			EventSystem.current.SetSelectedGameObject(this.weaponTransform.GetChild(num).gameObject);
		}
		if (Links.x.joy)
		{
			if (invRow._Name.Contains("Scroll") || invRow._Tag == "Revive")
			{
				Links.x.pocketWheel.WaitForTargets();
			}
			this.trinketWindow.GridLayout(true, false);
		}
		if (Links.x.mk)
		{
			EventSystem.current.SetSelectedGameObject(null);
		}
		if (Records.x.pocketPause && Records.x.InCombat(false) && !invRow._Name.Contains("Scroll"))
		{
			if (Links.x.pocketWheel.open)
			{
				if (invRow._Name.Contains("Fatigue"))
				{
					Links.x.pocketWheel.EndTurn(0.667f);
				}
				else
				{
					Links.x.pocketWheel.EndTurn(0.333f);
				}
			}
		}
		else if (Records.x.InCombat(false) && !invRow._Name.Contains("Scroll") && invRow._Tag != "Revive" && this.character.actions)
		{
			this.character.actions.canEndAttackTime = true;
			this.character.actions.EndAttackTime(0f);
		}
		this.TooltipOff();
		return !invRow._Name.Contains("Scroll") && !(invRow._Tag == "Revive");
	}

	// Token: 0x06001441 RID: 5185 RVA: 0x001875D8 File Offset: 0x001857D8
	public bool UseBeltItem3(bool fromWheel)
	{
		if (!this.CanConsume(14) || (!this.beltItem3Btn.interactable && !fromWheel))
		{
			return false;
		}
		int num = this.beltItem3Btn.gameObject.transform.GetSiblingIndex();
		int invNum = this.character.GetInvNum(28);
		Library.Inventory invRow = Links.x.library.GetInvRow(invNum);
		if (invRow._Name.Contains("Leashed"))
		{
			return false;
		}
		if (!this.character.IsSentient())
		{
			return false;
		}
		if (this.character.actions && this.character.actions.cannotInterrupt)
		{
			this.character.actions.TryingToInterruptInventoryWait();
			return false;
		}
		if (this.beltItem3text.enabled && invRow._Tag != "Revive")
		{
			int num2 = int.Parse(this.beltItem3text.text);
			num2--;
			this.beltItem3text.text = num2.ToString();
			if (num2 <= 0)
			{
				this.beltItem3Btn.interactable = false;
			}
		}
		if (Input.GetMouseButton(1) || Input.GetMouseButtonUp(1))
		{
			return false;
		}
		this.character.UseQuickItem(14);
		this.UpdateWindowStates();
		if (Links.x.joy && !Links.x.pocketWheel.open)
		{
			if (num >= this.weaponTransform.childCount)
			{
				num--;
			}
			if (num >= this.weaponTransform.childCount)
			{
				num--;
			}
			if (!this.weaponTransform.GetChild(num).gameObject.activeSelf)
			{
				num--;
			}
			if (!this.weaponTransform.GetChild(num).gameObject.activeSelf)
			{
				num--;
			}
			if (!this.weaponTransform.GetChild(num).gameObject.activeSelf)
			{
				num--;
			}
			EventSystem.current.SetSelectedGameObject(this.weaponTransform.GetChild(num).gameObject);
		}
		if (Links.x.joy)
		{
			if (invRow._Name.Contains("Scroll") || invRow._Tag == "Revive")
			{
				Links.x.pocketWheel.WaitForTargets();
			}
			this.trinketWindow.GridLayout(true, false);
		}
		if (Links.x.mk)
		{
			EventSystem.current.SetSelectedGameObject(null);
		}
		if (Records.x.pocketPause && Records.x.InCombat(false) && !invRow._Name.Contains("Scroll"))
		{
			if (Links.x.pocketWheel.open)
			{
				if (invRow._Name.Contains("Fatigue"))
				{
					Links.x.pocketWheel.EndTurn(0.667f);
				}
				else
				{
					Links.x.pocketWheel.EndTurn(0.333f);
				}
			}
		}
		else if (Records.x.InCombat(false) && !invRow._Name.Contains("Scroll") && invRow._Tag != "Revive" && this.character.actions)
		{
			this.character.actions.canEndAttackTime = true;
			this.character.actions.EndAttackTime(0f);
		}
		this.TooltipOff();
		return !invRow._Name.Contains("Scroll") && !(invRow._Tag == "Revive");
	}

	// Token: 0x06001442 RID: 5186 RVA: 0x0018793C File Offset: 0x00185B3C
	public void TooltipOn(SkillButton btn, GameObject go, string txt, bool functionHover)
	{
		if (this.trinketWindow.dragging)
		{
			return;
		}
		if (Input.GetMouseButton(0))
		{
			return;
		}
		if (this.tooltipCoroutine != null)
		{
			base.StopCoroutine(this.tooltipCoroutine);
			this.tooltipCoroutine = null;
		}
		this.tooltipCoroutine = this.TooltipOnDelay(btn, go, txt, functionHover);
		base.StartCoroutine(this.tooltipCoroutine);
	}

	// Token: 0x06001443 RID: 5187 RVA: 0x00187999 File Offset: 0x00185B99
	private IEnumerator TooltipOnDelay(SkillButton btn, GameObject go, string txt, bool functionHover)
	{
		if (Time.realtimeSinceStartup > this.timeSinceTooltipOff + 0.1f)
		{
			yield return new WaitForSecondsRealtime(0.2f);
		}
		bool flag = false;
		if (btn && btn.isSpell)
		{
			flag = true;
		}
		if (flag)
		{
			if (btn.isSpell && !this.spellTooltip.activeSelf)
			{
				this.spellTooltip.SetActive(true);
			}
		}
		else if (!this.tooltip.activeSelf)
		{
			this.tooltip.SetActive(true);
		}
		string text = go.name;
		this.str.Clear();
		if (Links.x.mk)
		{
			this.str.Append("  <color=#605E5A> Details");
			this.str.Append("  <voffset=.4em><size=20><sprite=");
			int keyIconIndex = Links.x.keyControl.GetKeyIconIndex("RMB");
			this.str.Append(keyIconIndex);
			this.str.Append("></size></voffset></color>");
		}
		else
		{
			this.str.Append("  <color=#605E5A> Details");
			this.str.Append("    <voffset=.4em><size=30><sprite=");
			int controllerSprite = Links.x.gameplay.GetControllerSprite("Interact", Links.x.gameplay.controllerName);
			this.str.Append(controllerSprite);
			this.str.Append("></size></voffset></color>");
			if (!text.Contains("Belt Item"))
			{
				text.Contains("Swap");
			}
		}
		this.controlText = this.str.ToString();
		if (btn || txt.Contains("Resiz") || go.name == "Spirit Btn" || functionHover)
		{
			if (go.name == "Spirit Btn")
			{
				this.str.Clear();
				this.str.Append("Spirit: ");
				this.str.Append(this.character.stats.SpiritCurrent());
				this.str.Append("/");
				this.str.Append(this.character.stats.SpiritMax());
				this.tooltipText.text = this.str.ToString() + this.controlText2;
				this.tooltipText.margin = new Vector4(19f, 2f, 3f, 10f);
			}
			else if (btn)
			{
				if (btn.isSpell)
				{
					this.spellTooltipText.text = txt;
					this.spellTooltipText.margin = new Vector4(19f, 2f, 10f, 10f);
				}
				else
				{
					this.tooltipText.text = txt;
					this.tooltipText.margin = new Vector4(19f, 2f, 10f, 10f);
				}
			}
			else if (functionHover)
			{
				this.tooltipText.text = txt + "<alpha=#00>" + this.fakeText;
				this.tooltipText.margin = new Vector4(19f, 10f, 3f, 10f);
			}
			else
			{
				this.tooltipText.text = txt + this.controlText2;
				this.tooltipText.margin = new Vector4(19f, 2f, 3f, 10f);
			}
		}
		else
		{
			string text2 = text;
			string text3 = " Btn";
			text = text2.Replace(text3, "");
			if (text == "Sneak")
			{
				if (this.character.body.sneaking)
				{
					this.tooltipText.text = "End Sneak";
				}
				else
				{
					this.tooltipText.text = "Sneak";
				}
			}
			else if (text == "Shout")
			{
				this.tooltipText.text = "Shout";
			}
			else if (text == "Swap Weapons 1")
			{
				this.tooltipText.text = "Use " + this.weapon1Name;
			}
			else if (text == "Swap Weapons 2")
			{
				this.tooltipText.text = "Use " + this.weapon2Name;
			}
			else if (text == "Swap Ammo 1")
			{
				this.tooltipText.text = "Load " + this.ammo1Name;
			}
			else if (text == "Swap Ammo 2")
			{
				this.tooltipText.text = "Load " + this.ammo2Name;
			}
			else if (text == "Swap Ammo 3")
			{
				this.tooltipText.text = "Load " + this.ammo3Name;
			}
			else if (text.Contains("Belt Item"))
			{
				int num = 7;
				string text4 = this.beltItem1Name;
				if (text.Contains("2"))
				{
					num = 13;
					text4 = this.beltItem2Name;
				}
				if (text.Contains("3"))
				{
					num = 14;
					text4 = this.beltItem3Name;
				}
				Library.Inventory invRow = Links.x.library.GetInvRow(this.character.GetInvNum(num * 2));
				if (invRow._Name.Contains("SpellScroll") || invRow._Name.Contains("PaganScroll"))
				{
					this.tooltipText.text = "Cast " + text4;
				}
				else if (invRow._Tag.Contains("Revive"))
				{
					this.tooltipText.text = "Revive fallen companions";
				}
				else if (invRow._Name.Contains("Leashes"))
				{
					this.tooltipText.text = text4;
				}
				else if (invRow._RightClickAction == "Consume")
				{
					if (invRow._Stackable && !invRow._Effect.Contains("Berry"))
					{
						this.tooltipText.text = "Drink " + text4;
					}
					else
					{
						this.tooltipText.text = "Eat " + text4;
					}
				}
				else
				{
					this.tooltipText.text = text4;
				}
			}
			else if (text == "Charm")
			{
				this.tooltipText.text = "Bind";
			}
			this.tooltipText.margin = new Vector4(19f, 2f, 10f, 10f);
		}
		if (flag)
		{
			if (this.spellTooltipText.margin.z > 5f)
			{
				TextMeshProUGUI textMeshProUGUI = this.spellTooltipText;
				textMeshProUGUI.text += this.controlText;
			}
			this.spellTooltipRT.sizeDelta = new Vector2(this.spellTooltipText.preferredWidth, this.spellTooltipText.preferredHeight - 10f);
			this.spellTooltipText.spriteAsset = Links.x.GetSpriteSheetAsset(Links.x.gameplay.currentSpriteSheetAsset);
		}
		else if (btn)
		{
			if (this.tooltipText.margin.z > 5f)
			{
				TextMeshProUGUI textMeshProUGUI2 = this.tooltipText;
				textMeshProUGUI2.text += this.controlText;
			}
			this.tooltipRT.sizeDelta = new Vector2(this.tooltipText.preferredWidth, this.tooltipText.preferredHeight - 10f);
			this.tooltipText.spriteAsset = Links.x.GetSpriteSheetAsset(Links.x.gameplay.currentSpriteSheetAsset);
		}
		else
		{
			if (this.tooltipText.margin.z > 5f)
			{
				TextMeshProUGUI textMeshProUGUI3 = this.tooltipText;
				textMeshProUGUI3.text += this.controlText;
			}
			this.tooltipRT.sizeDelta = new Vector2(this.tooltipText.preferredWidth, this.tooltipText.preferredHeight - 10f);
			this.tooltipText.spriteAsset = Links.x.GetSpriteSheetAsset(Links.x.gameplay.currentSpriteSheetAsset);
		}
		this.character.portrait.skillBag.ToggleHover(true);
		yield break;
	}

	// Token: 0x06001444 RID: 5188 RVA: 0x001879C8 File Offset: 0x00185BC8
	public void TooltipOff()
	{
		if (this.tooltipCoroutine != null)
		{
			base.StopCoroutine(this.tooltipCoroutine);
			this.tooltipCoroutine = null;
			this.timeSinceTooltipOff = Time.realtimeSinceStartup;
		}
		if (this.tooltip.activeSelf)
		{
			this.tooltip.SetActive(false);
		}
		if (this.spellTooltip.activeSelf)
		{
			this.spellTooltip.SetActive(false);
		}
		this.ToggleHover(false);
	}

	// Token: 0x06001445 RID: 5189 RVA: 0x00187A34 File Offset: 0x00185C34
	public void OpenDescription(SkillButton btn, GameObject go, string header, string desc)
	{
		if (go.name == "Spirit Btn")
		{
			return;
		}
		string text = "";
		if (btn)
		{
			this.str.Clear();
			this.str.Append("<font=Bold><size=1.4em>");
			this.str.Append(header);
			this.str.Append("</size></font>\n");
			this.str.Append(desc);
			Links.x.hudControl.descText.text = this.str.ToString();
		}
		else
		{
			this.str.Clear();
			text = go.name;
			Library.Inventory inventory = null;
			Vector4 vector = Vector4.zero;
			int num = 0;
			string text2 = text;
			string text3 = " Btn";
			text = text2.Replace(text3, "");
			this.str.Append("<font=Bold><size=1.4em>");
			if (text == "Sneak")
			{
				this.str.Append("Sneak");
			}
			else if (text == "Shout")
			{
				this.str.Append("Shout");
			}
			else if (text == "Light Attack")
			{
				this.str.Append("Attack");
			}
			else if (text == "Special Attack 1")
			{
				this.str.Append("Rally Attacks");
			}
			else if (text.Contains("Damage Rally"))
			{
				bool flag;
				this.str.Append(Links.x.pocketWheel.GetSpecialAttackText(1, go, out flag));
			}
			else if (text.Contains("Cripple Rally"))
			{
				bool flag2;
				this.str.Append(Links.x.pocketWheel.GetSpecialAttackText(2, go, out flag2));
			}
			else if (text.Contains("Rare Ammo"))
			{
				this.str.Append(Links.x.pocketWheel.GetSpecialAttackTextAmmo(text));
			}
			else if (text == "Medium Attack")
			{
				this.str.Append("Pin");
			}
			else if (text == "Heavy Attack")
			{
				this.str.Append("Knockback");
			}
			else if (text == "Command Attack")
			{
				this.str.Append("Direct Companion Targeting");
			}
			else if (text == "Command Reposition")
			{
				this.str.Append("Send Companions to a Location");
			}
			else if (text == "Command Group")
			{
				if (Records.x.circle)
				{
					this.str.Append("Break");
				}
				else
				{
					this.str.Append("Form Up");
				}
			}
			else if (text == "Spellbag")
			{
				this.str.Append("Spell Book");
			}
			else if (text == "Songbook")
			{
				this.str.Append("Song Book");
			}
			else if (text == "Swap Weapons 1")
			{
				inventory = Links.x.library.GetInvRow(this.current0);
				vector = this.character.GetDurabilityNum(this.current0Durability);
				num = this.character.GetInvNum(this.current0Durability * 2 + 1);
				this.str.Append("Use ");
				this.str.Append(this.weapon1Name);
			}
			else if (text == "Swap Weapons 2")
			{
				inventory = Links.x.library.GetInvRow(this.current16);
				vector = this.character.GetDurabilityNum(this.current16Durability);
				num = this.character.GetInvNum(this.current16Durability * 2 + 1);
				this.str.Append("Use ");
				this.str.Append(this.weapon2Name);
			}
			else if (text == "Swap Ammo 1")
			{
				inventory = Links.x.library.GetInvRow(this.character.GetInvNum(8));
				vector = this.character.GetDurabilityNum(4);
				num = this.character.GetInvNum(9);
				this.str.Append("Use ");
				this.str.Append(this.ammo1Name);
			}
			else if (text == "Swap Ammo 2")
			{
				inventory = Links.x.library.GetInvRow(this.character.GetInvNum(10));
				vector = this.character.GetDurabilityNum(5);
				num = this.character.GetInvNum(11);
				this.str.Append("Use ");
				this.str.Append(this.ammo2Name);
			}
			else if (text == "Swap Ammo 3")
			{
				inventory = Links.x.library.GetInvRow(this.character.GetInvNum(12));
				vector = this.character.GetDurabilityNum(6);
				num = this.character.GetInvNum(13);
				this.str.Append("Use ");
				this.str.Append(this.ammo3Name);
			}
			else if (text.Contains("Belt Item") || text == "Item 1" || text == "Item 2" || text == "Item 3")
			{
				string text4 = this.beltItem1Name;
				if (text.Contains("1"))
				{
					inventory = Links.x.library.GetInvRow(this.character.GetInvNum(14));
					vector = this.character.GetDurabilityNum(7);
					num = this.character.GetInvNum(15);
				}
				if (text.Contains("2"))
				{
					text4 = this.beltItem2Name;
					inventory = Links.x.library.GetInvRow(this.character.GetInvNum(26));
					vector = this.character.GetDurabilityNum(13);
					num = this.character.GetInvNum(27);
				}
				if (text.Contains("3"))
				{
					text4 = this.beltItem3Name;
					inventory = Links.x.library.GetInvRow(this.character.GetInvNum(28));
					vector = this.character.GetDurabilityNum(14);
					num = this.character.GetInvNum(29);
				}
				if (inventory._Name.Contains("SpellScroll") || inventory._Name.Contains("PaganScroll"))
				{
					this.str.Append("Cast ");
					this.str.Append(text4);
					this.str.Append(" (");
					this.str.Append(num);
					this.str.Append(")");
				}
				else if (inventory._Name.Contains("Leashes"))
				{
					this.str.Append(text4);
				}
				else if (inventory._Tag.Contains("Revive"))
				{
					this.str.Append("Revive a fallen companion ");
					this.str.Append(" (");
					this.str.Append(num);
					this.str.Append(")");
				}
				else if (inventory._RightClickAction == "Consume")
				{
					if (inventory._Stackable)
					{
						if (!inventory._Effect.Contains("Berry"))
						{
							this.str.Append("Drink ");
						}
						else
						{
							this.str.Append("Eat ");
						}
						this.str.Append(text4);
						this.str.Append(" (");
						this.str.Append(num);
						this.str.Append(")");
					}
					else
					{
						this.str.Append("Eat ");
						this.str.Append(text4);
					}
				}
				else
				{
					this.str.Append(text4);
				}
			}
			else if (text == "Charm")
			{
				this.str.Append("Bind");
			}
			this.str.Append("</size></font>\n");
			if (text == "Sneak")
			{
				this.str.Append("Move without being seen or heard.");
			}
			else if (text == "Light Attack")
			{
				this.str.Append("Select a target or object to attack.");
			}
			else if (text == "Special Attack 1")
			{
				this.str.Append("Use charged Rally bars for powerful attacks.");
			}
			else if (text.Contains("Damage Rally"))
			{
				this.str.Append(Links.x.pocketWheel.GetSpecialAttackTextDesc(1, go));
			}
			else if (text.Contains("Cripple Rally"))
			{
				this.str.Append(Links.x.pocketWheel.GetSpecialAttackTextDesc(2, go));
			}
			else if (text.Contains("Rare Ammo"))
			{
				this.str.Append(Links.x.pocketWheel.GetSpecialAttackTextDescAmmo(text));
			}
			else if (text == "Medium Attack")
			{
				this.str.Append("Pin a target while your companions take aim. Pinned targets will not be able to evade attacks.");
			}
			else if (text == "Heavy Attack")
			{
				this.str.Append("Kick or charge a nearby target to push them away and deal impact damage. Requires stamina.");
			}
			else if (text == "Shout")
			{
				this.str.Append("Say something to those around you.");
			}
			else if (text == "Swap Weapons 1" || text == "Swap Weapons 2")
			{
				if (inventory._MeleeRangeEnd >= 5f)
				{
					if (!inventory._MainSkill.Contains("Elixir"))
					{
						this.str.Append("Damage: from ");
						this.str.Append(inventory._Ammo1);
						this.str.Append("s");
					}
				}
				else if (inventory._DmgMax > 0)
				{
					this.str.Append("Damage: ");
					this.str.Append(inventory._DmgMax);
				}
				if (inventory._ID > 1)
				{
					this.str.Append("\nDurability: ");
					this.str.Append((int)vector.x);
					this.str.Append("/");
					this.str.Append(inventory._DurabilityMax);
				}
				this.str.Append("\nSpeed: ");
				this.str.Append(inventory._WpnSpeed);
				this.str.Append(" seconds");
				if (inventory._ID == 1)
				{
					this.str.Append("\n\nMust be unarmed to sneak.");
				}
			}
			else if (text.Contains("Swap Ammo"))
			{
				this.str.Append("Damage: ");
				this.str.Append(inventory._DmgMax);
				this.str.Append("\nAmount: ");
				this.str.Append(num);
				if (inventory._Effect != "")
				{
					Library.Effects effectRow = Links.x.library.GetEffectRow(inventory._Effect);
					if (effectRow != null)
					{
						string effectDescription = Links.x.manual.GetEffectDescription(effectRow, 0f, 0);
						if (inventory._Name.Contains("Dart"))
						{
							this.str.Append("\nStone Effects: ");
						}
						else
						{
							this.str.Append("\nElyxir Effects: ");
						}
						this.str.Append(effectDescription);
					}
				}
			}
			else if (text.Contains("Belt Item") || text == "Item 1" || text == "Item 2" || text == "Item 3")
			{
				if (inventory._Name.Contains("SpellScroll") || inventory._Name.Contains("PaganScroll"))
				{
					Vector4 spellScrollData = Records.x.GetSpellScrollData((int)inventory._Level);
					Library.Pagan paganRow = Links.x.library.GetPaganRow(inventory._Effect);
					this.str.Append(paganRow._DynamicDescriptionStart);
					string text5 = Records.x.PaganDescription(paganRow, spellScrollData.x, spellScrollData.y, spellScrollData.z);
					this.str.Append(text5);
				}
				else if (inventory._Name.Contains("Leashes"))
				{
					this.str.Append("Used automatically after succesfully attacking a hostile forest animal, shroomer or fish creature.");
					this.str.Append("\nAmount: ");
					this.str.Append(num);
				}
				else
				{
					if (inventory._Life > 0)
					{
						this.str.Append("Shelf Life: ");
						int num2 = (int)vector.x - (int)Mathf.Floor((float)Links.x.gameplay.GetCurrentGameTimeHours());
						if (num2 >= 48)
						{
							this.str.Append(Mathf.RoundToInt((float)num2 / 24f));
							this.str.Append(" day");
							if (num2 != 1)
							{
								this.str.Append("s");
							}
						}
						else
						{
							this.str.Append(num2);
							this.str.Append(" hour");
							if (num2 != 1)
							{
								this.str.Append("s");
							}
						}
						this.str.Append("\n");
					}
					Library.Effects effectRow2 = Links.x.library.GetEffectRow(inventory._Effect);
					if (effectRow2 != null)
					{
						string effectDescription2 = Links.x.manual.GetEffectDescription(effectRow2, 0f, 0);
						this.str.Append("Effect: ");
						this.str.Append(effectDescription2);
					}
				}
			}
			else if (text == "Charm")
			{
				this.str.Append("Bind forest, fish and shroom creatures in your sight range when their health is low. They will follow and fight with you to any end.");
			}
			else if (text == "Spellbag")
			{
				this.str.Append("Open spell book.");
			}
			else if (text == "Songbook")
			{
				this.str.Append("Open song book\n(Songs require an instrument to be played).");
			}
			Links.x.hudControl.descText.text = this.str.ToString();
		}
		Links.x.hudControl.descriptionWindow.SetActive(true);
		Links.x.hudControl.descriptionWindow.transform.SetAsLastSibling();
		Links.x.hudControl.descriptionWindowOpen = true;
		Links.x.hudControl.descriptionAnimator.Play("DescriptionWindowOpen");
		Links.x.hudControl.bg1.color = go.gameObject.GetComponent<Image>().color;
		if (!btn)
		{
			Links.x.hudControl.descriptionWindowSpirit.SetActive(false);
		}
		else if (btn.isSpell)
		{
			Links.x.hudControl.descriptionWindowSpirit.SetActive(true);
			if (btn.abilityCost == 1f)
			{
				Links.x.hudControl.descriptionWindowSpirit1.SetActive(true);
				Links.x.hudControl.descriptionWindowSpirit2.SetActive(false);
				Links.x.hudControl.descriptionWindowSpirit3.SetActive(false);
			}
			if (btn.abilityCost == 2f)
			{
				Links.x.hudControl.descriptionWindowSpirit1.SetActive(true);
				Links.x.hudControl.descriptionWindowSpirit2.SetActive(true);
				Links.x.hudControl.descriptionWindowSpirit3.SetActive(false);
			}
			if (btn.abilityCost == 3f)
			{
				Links.x.hudControl.descriptionWindowSpirit1.SetActive(true);
				Links.x.hudControl.descriptionWindowSpirit2.SetActive(true);
				Links.x.hudControl.descriptionWindowSpirit3.SetActive(true);
			}
		}
		else
		{
			Links.x.hudControl.descriptionWindowSpirit.SetActive(false);
		}
		if (Links.x.mk)
		{
			Links.x.hudControl.descControllerText.text = "";
		}
		else
		{
			Links.x.hudControl.descControllerText.spriteAsset = Links.x.GetSpriteSheetAsset(Links.x.gameplay.currentSpriteSheetAsset);
			this.str.Clear();
			this.str.Append("<voffset=.4em><size=30><sprite=");
			int controllerSprite = Links.x.gameplay.GetControllerSprite("Cancel", Links.x.gameplay.controllerName);
			this.str.Append(controllerSprite);
			this.str.Append("></size></voffset><cspace=.4em></cspace>Close");
			Links.x.hudControl.descControllerText.text = this.str.ToString();
		}
		if (btn)
		{
			if (btn.isSpell)
			{
				Links.x.hudControl.descSprite.sprite = go.gameObject.GetComponent<Image>().sprite;
			}
			else
			{
				Links.x.hudControl.descSprite.sprite = go.gameObject.GetComponent<Image>().sprite;
			}
		}
		else if (go.gameObject.transform.childCount <= 0 || text == "Item 1" || text == "Item 2" || text == "Item 3" || text == "Charm" || text == "Spellbag" || text == "Songbook" || text == "Special Attack 1" || text == "Special Attack 2")
		{
			Links.x.hudControl.descSprite.sprite = go.gameObject.GetComponent<Image>().sprite;
		}
		else
		{
			Links.x.hudControl.descSprite.sprite = go.gameObject.transform.GetChild(0).GetComponent<Image>().sprite;
		}
		Links.x.gameplay.StoneSoundQuieter();
	}

	// Token: 0x06001446 RID: 5190 RVA: 0x00188C84 File Offset: 0x00186E84
	public void PlayFX(GameObject go, bool isSpell)
	{
		this.fx.gameObject.SetActive(true);
		this.fx.gameObject.transform.SetParent(go.transform, false);
		this.fx.gameObject.transform.localPosition = new Vector3(22.5f, -22.5f);
		this.fx.gameObject.transform.SetParent(Links.x.pocketWheel.spellbook.gameObject.transform, true);
	}

	// Token: 0x06001447 RID: 5191 RVA: 0x00188D14 File Offset: 0x00186F14
	public void EndFX()
	{
		if (this.fx && this.fx.gameObject.activeSelf)
		{
			this.fx.gameObject.SetActive(false);
			this.fx.gameObject.transform.SetParent(Links.x.pocketWheel.spellbook.gameObject.transform, false);
		}
	}

	// Token: 0x0400226C RID: 8812
	[Header("OBJECTS")]
	public List<Image> windowImages = new List<Image>();

	// Token: 0x0400226D RID: 8813
	public Windows trinketWindow;

	// Token: 0x0400226E RID: 8814
	public Windows spellWindow;

	// Token: 0x0400226F RID: 8815
	public ScrollRectNoDragging scrollTrinket;

	// Token: 0x04002270 RID: 8816
	public GridLayoutGroup glgTrinket1;

	// Token: 0x04002271 RID: 8817
	public Transform weaponTransform;

	// Token: 0x04002272 RID: 8818
	public Transform spellGridTransform;

	// Token: 0x04002273 RID: 8819
	public RawImage trinketPortrait;

	// Token: 0x04002274 RID: 8820
	public HannahAnimator fx;

	// Token: 0x04002275 RID: 8821
	public GameObject weapon;

	// Token: 0x04002276 RID: 8822
	public GameObject weapon2;

	// Token: 0x04002277 RID: 8823
	public GameObject ammo1;

	// Token: 0x04002278 RID: 8824
	public GameObject ammo2;

	// Token: 0x04002279 RID: 8825
	public GameObject ammo3;

	// Token: 0x0400227A RID: 8826
	public GameObject beltItem1;

	// Token: 0x0400227B RID: 8827
	public GameObject beltItem2;

	// Token: 0x0400227C RID: 8828
	public GameObject beltItem3;

	// Token: 0x0400227D RID: 8829
	public GameObject tooltip;

	// Token: 0x0400227E RID: 8830
	public GameObject spellTooltip;

	// Token: 0x0400227F RID: 8831
	public GameObject songTooltip;

	// Token: 0x04002280 RID: 8832
	public GameObject starWeapon;

	// Token: 0x04002281 RID: 8833
	public GameObject starAmmo;

	// Token: 0x04002282 RID: 8834
	public GameObject spiritMeter;

	// Token: 0x04002283 RID: 8835
	public Image weaponImg;

	// Token: 0x04002284 RID: 8836
	public Image weapon2Img;

	// Token: 0x04002285 RID: 8837
	public Image ammo1Img;

	// Token: 0x04002286 RID: 8838
	public Image ammo2Img;

	// Token: 0x04002287 RID: 8839
	public Image ammo3Img;

	// Token: 0x04002288 RID: 8840
	public Image beltItem1Img;

	// Token: 0x04002289 RID: 8841
	public Image beltItem2Img;

	// Token: 0x0400228A RID: 8842
	public Image beltItem3Img;

	// Token: 0x0400228B RID: 8843
	public Image outOfAmmoOutline;

	// Token: 0x0400228C RID: 8844
	public TextMeshProUGUI tooltipText;

	// Token: 0x0400228D RID: 8845
	public TextMeshProUGUI spellTooltipText;

	// Token: 0x0400228E RID: 8846
	public TextMeshProUGUI ammo1Txt;

	// Token: 0x0400228F RID: 8847
	public TextMeshProUGUI ammo2Txt;

	// Token: 0x04002290 RID: 8848
	public TextMeshProUGUI ammo3Txt;

	// Token: 0x04002291 RID: 8849
	public TextMeshProUGUI beltItem1text;

	// Token: 0x04002292 RID: 8850
	public TextMeshProUGUI beltItem2text;

	// Token: 0x04002293 RID: 8851
	public TextMeshProUGUI beltItem3text;

	// Token: 0x04002294 RID: 8852
	public RectTransform tooltipRT;

	// Token: 0x04002295 RID: 8853
	public RectTransform spellTooltipRT;

	// Token: 0x04002296 RID: 8854
	public RectTransform songTooltipRT;

	// Token: 0x04002297 RID: 8855
	public RectTransform gridRT;

	// Token: 0x04002298 RID: 8856
	public Button weaponButton;

	// Token: 0x04002299 RID: 8857
	public Button weapon2Button;

	// Token: 0x0400229A RID: 8858
	public Button beltItem1Btn;

	// Token: 0x0400229B RID: 8859
	public Button beltItem2Btn;

	// Token: 0x0400229C RID: 8860
	public Button beltItem3Btn;

	// Token: 0x0400229D RID: 8861
	public List<GameObject> offButtons = new List<GameObject>();

	// Token: 0x0400229E RID: 8862
	public List<RectTransform> staticButtons = new List<RectTransform>();

	// Token: 0x0400229F RID: 8863
	private List<Button> staticBtns = new List<Button>();

	// Token: 0x040022A0 RID: 8864
	public List<Button> dynamicButtons = new List<Button>();

	// Token: 0x040022A1 RID: 8865
	public GameObject emptySpellSong;

	// Token: 0x040022A2 RID: 8866
	[Header("FUNCTIONALITY")]
	public bool modalWindowsOpen;

	// Token: 0x040022A3 RID: 8867
	public SkillButton selectedSkillButton;

	// Token: 0x040022A4 RID: 8868
	public List<SkillButton> spells = new List<SkillButton>();

	// Token: 0x040022A5 RID: 8869
	public List<SkillButton> items = new List<SkillButton>();

	// Token: 0x040022A6 RID: 8870
	public List<SkillButton> songs = new List<SkillButton>();

	// Token: 0x040022A7 RID: 8871
	private int updated;

	// Token: 0x040022A8 RID: 8872
	public Sprite fist;

	// Token: 0x040022A9 RID: 8873
	private int current0;

	// Token: 0x040022AA RID: 8874
	private int current16;

	// Token: 0x040022AB RID: 8875
	private int current0Durability;

	// Token: 0x040022AC RID: 8876
	private int current16Durability;

	// Token: 0x040022AD RID: 8877
	public int selectedAmmoIndex;

	// Token: 0x040022AE RID: 8878
	public int selectedWpnIndex;

	// Token: 0x040022AF RID: 8879
	private Color startTooltipColor;

	// Token: 0x040022B0 RID: 8880
	private StringFast str = new StringFast(64);

	// Token: 0x040022B1 RID: 8881
	private string weapon1Name;

	// Token: 0x040022B2 RID: 8882
	private string weapon2Name;

	// Token: 0x040022B3 RID: 8883
	private string ammo1Name;

	// Token: 0x040022B4 RID: 8884
	private string ammo2Name;

	// Token: 0x040022B5 RID: 8885
	private string ammo3Name;

	// Token: 0x040022B6 RID: 8886
	private string controlText;

	// Token: 0x040022B7 RID: 8887
	private string controlText2;

	// Token: 0x040022B8 RID: 8888
	private string fakeText;

	// Token: 0x040022B9 RID: 8889
	public int beltIndex1;

	// Token: 0x040022BA RID: 8890
	public int beltIndex2;

	// Token: 0x040022BB RID: 8891
	public int beltIndex3;

	// Token: 0x040022BC RID: 8892
	public string beltItem1Name;

	// Token: 0x040022BD RID: 8893
	public string beltItem2Name;

	// Token: 0x040022BE RID: 8894
	public string beltItem3Name;

	// Token: 0x040022BF RID: 8895
	private IEnumerator sneakCoroutine;

	// Token: 0x040022C0 RID: 8896
	private IEnumerator tooltipCoroutine;

	// Token: 0x040022C1 RID: 8897
	private float timeSinceTooltipOff;

	// Token: 0x040022C2 RID: 8898
	public Library.Inventory beltItemRow1;

	// Token: 0x040022C3 RID: 8899
	public Library.Inventory beltItemRow2;

	// Token: 0x040022C4 RID: 8900
	public Library.Inventory beltItemRow3;

	// Token: 0x040022C5 RID: 8901
	[Header("CHARACTER")]
	public Character character;

	// Token: 0x040022C6 RID: 8902
	public Portrait portrait;

	// Token: 0x040022C7 RID: 8903
	private int[] previousItems = new int[14];

	// Token: 0x040022C8 RID: 8904
	private int[] currentItems = new int[14];

	// Token: 0x040022C9 RID: 8905
	private List<string> abilityNames;

	// Token: 0x040022CA RID: 8906
	private List<Vector4> abilityNumbers;

	// Token: 0x040022CB RID: 8907
	private List<string> uniqueNames;

	// Token: 0x040022CC RID: 8908
	private List<Vector2> abilityCosts;

	// Token: 0x040022CD RID: 8909
	private List<Vector4> spellLevels;

	// Token: 0x040022CE RID: 8910
	public List<Library.Abilities> abilityRows;

	// Token: 0x040022CF RID: 8911
	private RenderTexture texturesIdle;

	// Token: 0x040022D0 RID: 8912
	private List<bool> abilityReady;

	// Token: 0x040022D1 RID: 8913
	private List<int> abilityEquipped;
}
