using System;
using System.Collections.Generic;
using System.IO;
using UnityEngine;

// Token: 0x02000079 RID: 121
public class Archives : MonoBehaviour
{
	// Token: 0x06000BAF RID: 2991 RVA: 0x000E15D5 File Offset: 0x000DF7D5
	public void LoadCharacter(GameObject go)
	{
		this.loadedCharacters.Add(go);
	}

	// Token: 0x06000BB0 RID: 2992 RVA: 0x000E15E4 File Offset: 0x000DF7E4
	public void RemoveCharacter(GameObject go)
	{
		int num = this.loadedCharacters.IndexOf(go);
		if (num > -1)
		{
			this.loadedCharacters.RemoveAt(num);
		}
	}

	// Token: 0x06000BB1 RID: 2993 RVA: 0x000E1610 File Offset: 0x000DF810
	public void CreateArchives()
	{
		this.tr = base.transform;
		this.rot = Quaternion.identity;
		this.vec = new Vector3(10000f, 0f, 0f);
		int num = this.characterPrefabs.Count;
		for (int i = 0; i < num; i++)
		{
			this.characterPrefabNames.Add(this.characterPrefabs[i].name);
		}
		num = this.characterHeads.Count;
		for (int j = 0; j < num; j++)
		{
			this.characterHeadNames.Add(this.characterHeads[j].name);
		}
		num = this.characterAnimations.Count;
		for (int k = 0; k < num; k++)
		{
			this.characterAnimationNames.Add(this.characterAnimations[k].name);
		}
		num = this.characterSkins.Count;
		for (int l = 0; l < num; l++)
		{
			this.characterSkinNames.Add(this.characterSkins[l].name.ToLower());
		}
		num = this.boatPrefabs.Count;
		for (int m = 0; m < num; m++)
		{
			this.boatPrefabNames.Add(this.boatPrefabs[m].name);
		}
		num = this.items.Count;
		for (int n = 0; n < num; n++)
		{
			this.itemNames.Add(this.items[n].name);
		}
		num = this.itemsHud.Count;
		for (int num2 = 0; num2 < num; num2++)
		{
			this.itemHudNames.Add(this.itemsHud[num2].name);
		}
		num = this.itemsFull.Count;
		for (int num3 = 0; num3 < num; num3++)
		{
			this.itemFullNames.Add(this.itemsFull[num3].name);
		}
		num = this.itemPrefabs.Count;
		for (int num4 = 0; num4 < num; num4++)
		{
			this.itemPrefabNames.Add(this.itemPrefabs[num4].name);
		}
		num = this.abilities.Count;
		for (int num5 = 0; num5 < num; num5++)
		{
			this.abilityNames.Add(this.abilities[num5].name);
		}
		num = this.itemBodyPrefabs.Count;
		for (int num6 = 0; num6 < num; num6++)
		{
			this.itemBodyPrefabNames.Add(this.itemBodyPrefabs[num6].name);
		}
		num = this.effectHeadIcons.Count;
		for (int num7 = 0; num7 < num; num7++)
		{
			this.effectHeadIconNames.Add(this.effectHeadIcons[num7].name);
		}
	}

	// Token: 0x06000BB2 RID: 2994 RVA: 0x000E18F0 File Offset: 0x000DFAF0
	public AnimatorOverrideController GetOverrideController(string n)
	{
		int count = this.characterAnimations.Count;
		for (int i = 0; i < count; i++)
		{
			if (this.characterAnimationNames[i] == n)
			{
				return this.characterAnimations[i];
			}
		}
		return null;
	}

	// Token: 0x06000BB3 RID: 2995 RVA: 0x000E1938 File Offset: 0x000DFB38
	public Sprite GetEffectImageMedium(string n)
	{
		int count = this.effectsMedium.Count;
		for (int i = 0; i < count; i++)
		{
			if (this.effectNames[i] == n)
			{
				return this.effectsMedium[i];
			}
		}
		return null;
	}

	// Token: 0x06000BB4 RID: 2996 RVA: 0x000E1980 File Offset: 0x000DFB80
	public Sprite GetEffectImage(string n)
	{
		int count = this.effects.Count;
		for (int i = 0; i < count; i++)
		{
			if (this.effectNames[i] == n)
			{
				return this.effects[i];
			}
		}
		return null;
	}

	// Token: 0x06000BB5 RID: 2997 RVA: 0x000E19C8 File Offset: 0x000DFBC8
	public Sprite GetEffectImageHiRes(string n)
	{
		int count = this.effectsLarge.Count;
		for (int i = 0; i < count; i++)
		{
			if (this.effectNames[i] == n)
			{
				return this.effectsLarge[i];
			}
		}
		return null;
	}

	// Token: 0x06000BB6 RID: 2998 RVA: 0x000E1A10 File Offset: 0x000DFC10
	public Sprite GetItem(string n)
	{
		int num = this.items.Count;
		for (int i = 0; i < num; i++)
		{
			if (this.itemNames[i] == n)
			{
				return this.items[i];
			}
		}
		num = this.itemsFull.Count;
		for (int j = 0; j < num; j++)
		{
			if (this.itemFullNames[j] == n)
			{
				return this.itemsFull[j];
			}
		}
		return null;
	}

	// Token: 0x06000BB7 RID: 2999 RVA: 0x000E1A90 File Offset: 0x000DFC90
	public Sprite GetItemFull(string n)
	{
		int count = this.itemsFull.Count;
		for (int i = 0; i < count; i++)
		{
			if (this.itemFullNames[i] == n)
			{
				return this.itemsFull[i];
			}
		}
		return null;
	}

	// Token: 0x06000BB8 RID: 3000 RVA: 0x000E1AD8 File Offset: 0x000DFCD8
	public Sprite GetItemHud(string n)
	{
		int count = this.itemsHud.Count;
		for (int i = 0; i < count; i++)
		{
			if (this.itemHudNames[i] == n)
			{
				return this.itemsHud[i];
			}
		}
		return null;
	}

	// Token: 0x06000BB9 RID: 3001 RVA: 0x000E1B20 File Offset: 0x000DFD20
	public Sprite GetAbilitySprite(string n)
	{
		int count = this.abilities.Count;
		for (int i = 0; i < count; i++)
		{
			if (this.abilityNames[i] == n)
			{
				return this.abilities[i];
			}
		}
		return null;
	}

	// Token: 0x06000BBA RID: 3002 RVA: 0x000E1B68 File Offset: 0x000DFD68
	public Texture GetSkinTexture(string skin, string armor, string race, bool isHead, bool male, bool isNPC)
	{
		int count = this.characterSkins.Count;
		for (int i = 0; i < count; i++)
		{
			string text = this.characterSkinNames[i];
			if (text.Contains(skin) && (text.Contains(armor) || isHead) && text.Contains(race))
			{
				if (isHead)
				{
					if ((text.Contains("head") || text.Contains("npc")) && ((male && text.Contains("male") && !text.Contains("female") && !isNPC) || (!male && text.Contains("female") && !isNPC) || (isNPC && text.Contains("npc"))))
					{
						return this.characterSkins[i];
					}
				}
				else if (!text.Contains("head") && !text.Contains("npc"))
				{
					return this.characterSkins[i];
				}
			}
		}
		return null;
	}

	// Token: 0x06000BBB RID: 3003 RVA: 0x000E1C64 File Offset: 0x000DFE64
	public void ClearBetweenLevels()
	{
		this.clearing = true;
		for (int i = 0; i < this.itemBodyArchives.Count; i++)
		{
			if (this.itemBodyArchives[i])
			{
				Object.Destroy(this.itemBodyArchives[i]);
			}
		}
		this.itemBodyArchives.Clear();
		this.itemBodyArchiveNames.Clear();
		this.itemBodyArchiveTimes.Clear();
		for (int j = 0; j < this.itemArchives.Count; j++)
		{
			if (this.itemArchives[j])
			{
				Object.Destroy(this.itemArchives[j]);
			}
		}
		this.itemArchives.Clear();
		this.itemArchiveNames.Clear();
		this.itemArchiveTimes.Clear();
		for (int k = 0; k < this.characterArchives.Count; k++)
		{
			if (this.characterArchives[k])
			{
				Object.Destroy(this.characterArchives[k]);
			}
		}
		this.characterArchives.Clear();
		this.characterArchiveNames.Clear();
		this.characterArchiveTimes.Clear();
		for (int l = 0; l < this.headArchives.Count; l++)
		{
			if (this.headArchives[l])
			{
				Object.Destroy(this.headArchives[l]);
			}
		}
		this.headArchives.Clear();
		this.headArchiveNames.Clear();
		this.headArchiveTimes.Clear();
		for (int m = 0; m < this.boatArchives.Count; m++)
		{
			if (this.boatArchives[m])
			{
				Object.Destroy(this.boatArchives[m]);
			}
		}
		this.boatArchives.Clear();
		this.boatArchiveNames.Clear();
		this.boatArchiveTimes.Clear();
		for (int n = 0; n < this.deathArchives.Count; n++)
		{
			if (this.deathArchives[n])
			{
				Object.Destroy(this.deathArchives[n]);
			}
		}
		this.deathArchives.Clear();
		this.deathArchivesID.Clear();
		this.deathArchivesTypes.Clear();
		this.clearing = false;
	}

	// Token: 0x06000BBC RID: 3004 RVA: 0x000E1EB0 File Offset: 0x000E00B0
	public GameObject GetItemPrefabBody(string n)
	{
		int count = this.itemBodyPrefabs.Count;
		GameObject gameObject = this.CheckRecycledItemsBody(n);
		if (gameObject)
		{
			gameObject.SetActive(true);
			return gameObject;
		}
		for (int i = 0; i < count; i++)
		{
			if (string.Equals(n, this.itemBodyPrefabNames[i], StringComparison.OrdinalIgnoreCase))
			{
				this.go = Object.Instantiate<GameObject>(this.itemBodyPrefabs[i], this.vec, this.rot, null);
				this.go.SetActive(true);
				return this.go;
			}
		}
		return null;
	}

	// Token: 0x06000BBD RID: 3005 RVA: 0x000E1F3C File Offset: 0x000E013C
	public void RecycleItemBody(GameObject item, string xmlName)
	{
		if (!this.itemBodyArchives.Contains(item))
		{
			this.itemBodyArchives.Add(item);
			this.itemBodyArchiveNames.Add(xmlName);
			if (Records.x.typing)
			{
				this.itemBodyArchiveTimes.Add(Time.realtimeSinceStartup);
			}
			else
			{
				this.itemBodyArchiveTimes.Add(Time.realtimeSinceStartup + Random.Range(0.1f, 0.2f));
			}
			item.SetActive(false);
			item.transform.SetParent(this.tr, false);
		}
	}

	// Token: 0x06000BBE RID: 3006 RVA: 0x000E1FC8 File Offset: 0x000E01C8
	public GameObject CheckRecycledItemsBody(string itemName)
	{
		int count = this.itemBodyArchives.Count;
		int num = -1;
		for (int i = 0; i < count; i++)
		{
			if (this.itemBodyArchiveNames[i] == itemName && Time.realtimeSinceStartup > this.itemBodyArchiveTimes[i] + 0.5f)
			{
				num = i;
				break;
			}
		}
		if (num > -1)
		{
			this.go = this.itemBodyArchives[num];
			this.itemBodyArchives.RemoveAt(num);
			this.itemBodyArchiveNames.RemoveAt(num);
			this.itemBodyArchiveTimes.RemoveAt(num);
			return this.go;
		}
		return null;
	}

	// Token: 0x06000BBF RID: 3007 RVA: 0x000E2064 File Offset: 0x000E0264
	public GameObject GetItemPrefab(string n, Transform par)
	{
		int count = this.itemPrefabs.Count;
		GameObject gameObject = this.CheckRecycledItems(n);
		if (gameObject)
		{
			gameObject.transform.SetParent(par);
			return gameObject;
		}
		this.go = Object.Instantiate<GameObject>(this.itemPrefabs[0], this.vec, this.itemPrefabs[0].transform.rotation, par);
		return this.go;
	}

	// Token: 0x06000BC0 RID: 3008 RVA: 0x000E20D8 File Offset: 0x000E02D8
	public void RecycleItem(GameObject item, string xmlName)
	{
		if (!this.itemArchives.Contains(item))
		{
			this.itemArchives.Add(item);
			this.itemArchiveNames.Add(xmlName);
			this.itemArchiveTimes.Add(Time.realtimeSinceStartup + 0.5f);
			item.transform.SetParent(this.tr, false);
		}
	}

	// Token: 0x06000BC1 RID: 3009 RVA: 0x000E2134 File Offset: 0x000E0334
	public GameObject CheckRecycledItems(string itemName)
	{
		int count = this.itemArchives.Count;
		int num = -1;
		for (int i = 0; i < count; i++)
		{
			if (Time.realtimeSinceStartup > this.itemArchiveTimes[i] + 0.5f)
			{
				num = i;
				break;
			}
		}
		if (num > -1)
		{
			this.go = this.itemArchives[num];
			this.itemArchives.RemoveAt(num);
			this.itemArchiveNames.RemoveAt(num);
			this.itemArchiveTimes.RemoveAt(num);
			return this.go;
		}
		return null;
	}

	// Token: 0x06000BC2 RID: 3010 RVA: 0x000E21BC File Offset: 0x000E03BC
	public GameObject InstantiateBody(string characterModel, Transform par)
	{
		this.go = this.CheckRecycled(characterModel);
		if (this.go)
		{
			this.go.transform.SetParent(par, false);
			this.go.transform.localPosition = this.vec;
			this.go.transform.localRotation = this.rot;
			this.go.SetActive(true);
			return this.go;
		}
		int count = this.characterPrefabs.Count;
		int num = -1;
		for (int i = 0; i < count; i++)
		{
			if (this.characterPrefabNames[i] == characterModel)
			{
				num = i;
				break;
			}
		}
		if (num > -1)
		{
			this.go = Object.Instantiate<GameObject>(this.characterPrefabs[num], this.vec, this.rot, par);
			if (!this.go.GetComponent<Body>())
			{
				this.go.AddComponent<Body>();
			}
			return this.go;
		}
		return null;
	}

	// Token: 0x06000BC3 RID: 3011 RVA: 0x000E22B4 File Offset: 0x000E04B4
	public void RecycleBody(GameObject body, string modelName, string fromName)
	{
		Body component = body.GetComponent<Body>();
		if (component.anim)
		{
			component.anim.updateMode = AnimatorUpdateMode.Normal;
		}
		component.ReturnItems();
		component.inMenu = false;
		component.isPortrait = false;
		if (!this.characterArchives.Contains(body))
		{
			this.characterArchives.Add(body);
			this.characterArchiveNames.Add(modelName);
			if (Records.x.typing)
			{
				this.characterArchiveTimes.Add(Time.realtimeSinceStartup);
			}
			else
			{
				this.characterArchiveTimes.Add(Time.realtimeSinceStartup + 0.5f);
			}
		}
		body.transform.SetParent(this.tr, false);
		body.transform.localPosition = Vector3.zero;
		body.SetActive(false);
	}

	// Token: 0x06000BC4 RID: 3012 RVA: 0x000E2378 File Offset: 0x000E0578
	public GameObject CheckRecycled(string characterName)
	{
		int count = this.characterArchives.Count;
		int num = -1;
		bool flag = false;
		for (int i = 0; i < count; i++)
		{
			if (!flag && i < this.characterArchiveNames.Count && this.characterArchiveNames[i] == characterName && Time.realtimeSinceStartup >= this.characterArchiveTimes[i] && this.characterArchives[i].transform.parent == this.tr && !this.characterArchives[i].activeSelf)
			{
				num = i;
				this.go = this.characterArchives[num];
				this.characterArchives.RemoveAt(num);
				this.characterArchiveNames.RemoveAt(num);
				this.characterArchiveTimes.RemoveAt(num);
				this.go.SetActive(true);
				break;
			}
		}
		if (num > -1)
		{
			this.go.SetActive(true);
			return this.go;
		}
		return null;
	}

	// Token: 0x06000BC5 RID: 3013 RVA: 0x000E2480 File Offset: 0x000E0680
	public GameObject InstantiateHead(string characterModel, Transform par)
	{
		this.go = this.CheckRecycledHead(characterModel);
		if (this.go)
		{
			this.go.transform.SetParent(par, false);
			this.go.transform.localPosition = this.vec;
			this.go.transform.localRotation = this.rot;
			this.go.SetActive(true);
			return this.go;
		}
		int count = this.characterHeads.Count;
		int num = -1;
		for (int i = 0; i < count; i++)
		{
			if (this.characterHeadNames[i] == characterModel)
			{
				num = i;
				break;
			}
		}
		if (num > -1)
		{
			this.go = Object.Instantiate<GameObject>(this.characterHeads[num], this.vec, this.rot, par);
			this.go.SetActive(true);
			return this.go;
		}
		return null;
	}

	// Token: 0x06000BC6 RID: 3014 RVA: 0x000E2568 File Offset: 0x000E0768
	public void RecycleHead(GameObject head, string modelName, string fromName)
	{
		if (!this.headArchives.Contains(head))
		{
			this.headArchives.Add(head);
			this.headArchiveNames.Add(modelName);
			if (Records.x.typing)
			{
				this.headArchiveTimes.Add(Time.realtimeSinceStartup);
			}
			else
			{
				this.headArchiveTimes.Add(Time.realtimeSinceStartup + 0.5f);
			}
		}
		head.transform.SetParent(this.tr, false);
		head.SetActive(false);
	}

	// Token: 0x06000BC7 RID: 3015 RVA: 0x000E25E8 File Offset: 0x000E07E8
	public GameObject CheckRecycledHead(string characterName)
	{
		int count = this.headArchives.Count;
		int num = -1;
		bool flag = false;
		for (int i = 0; i < count; i++)
		{
			if (!flag && i < this.headArchiveNames.Count && this.headArchiveNames[i] == characterName && Time.realtimeSinceStartup >= this.headArchiveTimes[i] && this.headArchives[i].transform.parent == this.tr && !this.headArchives[i].activeSelf)
			{
				num = i;
				this.go = this.headArchives[num];
				this.headArchives.RemoveAt(num);
				this.headArchiveNames.RemoveAt(num);
				this.headArchiveTimes.RemoveAt(num);
				break;
			}
		}
		if (num > -1)
		{
			this.go.SetActive(true);
			return this.go;
		}
		return null;
	}

	// Token: 0x06000BC8 RID: 3016 RVA: 0x000E26E4 File Offset: 0x000E08E4
	public GameObject InstantiateBoat(string boatModel, Transform par)
	{
		this.go = this.CheckRecycledBoat(boatModel);
		if (this.go)
		{
			this.go.transform.SetParent(par, false);
			this.go.transform.localPosition = this.vec;
			this.go.transform.localRotation = this.rot;
			this.go.SetActive(true);
			return this.go;
		}
		int count = this.boatPrefabs.Count;
		int num = -1;
		for (int i = 0; i < count; i++)
		{
			if (this.boatPrefabNames[i] == boatModel)
			{
				num = i;
				break;
			}
		}
		if (num > -1)
		{
			this.go = Object.Instantiate<GameObject>(this.boatPrefabs[num], this.vec, this.rot, par);
			return this.go;
		}
		return null;
	}

	// Token: 0x06000BC9 RID: 3017 RVA: 0x000E27C0 File Offset: 0x000E09C0
	public void RecycleBoat(GameObject body, string modelName, string fromName)
	{
		if (!this.boatArchives.Contains(body))
		{
			this.boatArchives.Add(body);
			this.boatArchiveNames.Add(modelName);
			this.boatArchiveTimes.Add(Time.realtimeSinceStartup + Random.Range(0.1f, 0.2f));
		}
		body.transform.SetParent(this.tr, false);
		body.SetActive(false);
	}

	// Token: 0x06000BCA RID: 3018 RVA: 0x000E282C File Offset: 0x000E0A2C
	public GameObject CheckRecycledBoat(string boatName)
	{
		int count = this.boatArchives.Count;
		int num = -1;
		bool flag = false;
		for (int i = 0; i < count; i++)
		{
			if (!flag && i < this.boatArchiveNames.Count && this.boatArchiveNames[i] == boatName && Time.realtimeSinceStartup > this.boatArchiveTimes[i] + 0.5f)
			{
				num = i;
				this.go = this.boatArchives[num];
				this.boatArchives.RemoveAt(num);
				this.boatArchiveNames.RemoveAt(num);
				this.boatArchiveTimes.RemoveAt(num);
				break;
			}
		}
		if (num > -1)
		{
			this.go.SetActive(true);
			return this.go;
		}
		return null;
	}

	// Token: 0x06000BCB RID: 3019 RVA: 0x000E28EC File Offset: 0x000E0AEC
	public GameObject InstantiateEffectIcon(string effectModel, Transform par)
	{
		this.go = this.CheckRecycledEffectIcons(effectModel);
		if (this.go)
		{
			this.go.transform.SetParent(par, false);
			this.go.transform.localPosition = this.vec;
			this.go.transform.localRotation = this.rot;
			this.go.SetActive(true);
			return this.go;
		}
		int count = this.effectHeadIconNames.Count;
		int num = -1;
		for (int i = 0; i < count; i++)
		{
			if (this.effectHeadIconNames[i] == effectModel)
			{
				num = i;
				break;
			}
		}
		if (num > -1)
		{
			this.go = Object.Instantiate<GameObject>(this.effectHeadIcons[num], this.vec, this.rot, par);
			return this.go;
		}
		return null;
	}

	// Token: 0x06000BCC RID: 3020 RVA: 0x000E29C8 File Offset: 0x000E0BC8
	public void RecycleEffectIcons(GameObject icon, string modelName)
	{
		if (!this.effectHeadIconArchives.Contains(icon))
		{
			this.effectHeadIconArchives.Add(icon);
			this.effectHeadIconArchiveNames.Add(modelName);
			this.effectHeadIconArchiveTimes.Add(Time.realtimeSinceStartup + Random.Range(0.1f, 0.2f));
		}
		icon.transform.SetParent(this.tr, false);
		icon.SetActive(false);
	}

	// Token: 0x06000BCD RID: 3021 RVA: 0x000E2A34 File Offset: 0x000E0C34
	public GameObject CheckRecycledEffectIcons(string n)
	{
		int count = this.effectHeadIconArchives.Count;
		int num = -1;
		bool flag = false;
		for (int i = 0; i < count; i++)
		{
			if (!flag && i < this.effectHeadIconArchiveNames.Count && this.effectHeadIconArchiveNames[i] == n && Time.realtimeSinceStartup > this.effectHeadIconArchiveTimes[i] + 0.5f)
			{
				num = i;
				this.go = this.boatArchives[num];
				this.effectHeadIconArchives.RemoveAt(num);
				this.effectHeadIconArchiveNames.RemoveAt(num);
				this.effectHeadIconArchiveTimes.RemoveAt(num);
				break;
			}
		}
		if (num > -1)
		{
			this.go.SetActive(true);
			return this.go;
		}
		return null;
	}

	// Token: 0x06000BCE RID: 3022 RVA: 0x000E2AF4 File Offset: 0x000E0CF4
	public void InstantiateGore(int deathID)
	{
		if (deathID != 1)
		{
			int num = 0;
			int count = this.deathArchivesID.Count;
			for (int i = 0; i < count; i++)
			{
				if (this.deathArchivesID[i] == deathID)
				{
					num++;
				}
			}
			if (num < 4)
			{
				GameObject death = Links.x.library.GetDeath(deathID, "Random");
				if (death)
				{
					this.go = Object.Instantiate<GameObject>(death, this.vec, this.rot, this.tr);
					this.go.SetActive(false);
					this.deathArchives.Add(this.go);
					this.deathArchivesID.Add(deathID);
					this.deathArchivesTypes.Add("Random");
					this.go.AddComponent<Gore>().Setup();
				}
			}
			if (num == 0)
			{
				GameObject gameObject = Links.x.library.GetDeath(deathID, "Head");
				if (gameObject)
				{
					this.go = Object.Instantiate<GameObject>(gameObject, this.vec, this.rot, this.tr);
					this.go.SetActive(false);
					this.deathArchives.Add(this.go);
					this.deathArchivesID.Add(deathID);
					this.deathArchivesTypes.Add("Head");
					this.go.AddComponent<Gore>().Setup();
				}
				gameObject = Links.x.library.GetDeath(deathID, "Critical");
				if (gameObject)
				{
					this.go = Object.Instantiate<GameObject>(gameObject, this.vec, this.rot, this.tr);
					this.go.SetActive(false);
					this.deathArchives.Add(this.go);
					this.deathArchivesID.Add(deathID);
					this.deathArchivesTypes.Add("Critical");
					this.go.AddComponent<Gore>().Setup();
				}
			}
		}
	}

	// Token: 0x06000BCF RID: 3023 RVA: 0x000E2CD8 File Offset: 0x000E0ED8
	public void RecycleDeath(GameObject body, string type, int deathID)
	{
		if (body != null)
		{
			this.deathArchives.Add(body);
			this.deathArchivesID.Add(deathID);
			this.deathArchivesTypes.Add(type);
			body.transform.SetParent(this.tr, false);
			body.SetActive(false);
			Gore component = body.GetComponent<Gore>();
			if (component)
			{
				component.DoReset();
				return;
			}
			Debug.Log(((body != null) ? body.ToString() : null) + " no gore script!");
		}
	}

	// Token: 0x06000BD0 RID: 3024 RVA: 0x000E2D60 File Offset: 0x000E0F60
	public GameObject CheckRecycledDeaths(int deathID, string type)
	{
		int count = this.deathArchives.Count;
		int num = -1;
		for (int i = 0; i < count; i++)
		{
			if (this.deathArchivesID[i] == deathID && !this.deathArchives[i].activeSelf)
			{
				num = i;
				break;
			}
		}
		if (num > -1)
		{
			this.go = this.deathArchives[num];
			this.deathArchivesID.RemoveAt(num);
			this.deathArchivesTypes.RemoveAt(num);
			this.deathArchives.RemoveAt(num);
			return this.go;
		}
		return null;
	}

	// Token: 0x06000BD1 RID: 3025 RVA: 0x000E2DF0 File Offset: 0x000E0FF0
	public Sprite AddRune(string n, string path, string partyName, string abilityName)
	{
		Sprite sprite = null;
		if (!this.GetRune(out sprite, n, partyName))
		{
			Sprite sprite2 = this.LoadSprite(path, abilityName);
			this.runes.Add(sprite2);
			this.runeNames.Add(n);
			this.runeParty.Add(partyName);
			return sprite2;
		}
		if (sprite == null)
		{
			return this.emptySprite;
		}
		return sprite;
	}

	// Token: 0x06000BD2 RID: 3026 RVA: 0x000E2E4C File Offset: 0x000E104C
	public bool GetRune(out Sprite runeSprite, string n, string partyName)
	{
		runeSprite = null;
		for (int i = 0; i < this.runes.Count; i++)
		{
			if (this.runeNames[i] == n && partyName == this.runeParty[i])
			{
				runeSprite = this.runes[i];
				return true;
			}
		}
		return false;
	}

	// Token: 0x06000BD3 RID: 3027 RVA: 0x000E2EAC File Offset: 0x000E10AC
	public void OverrideRune(string n, string path, string partyName, string abilityName)
	{
		Sprite sprite = null;
		bool rune = this.GetRune(out sprite, n, partyName);
		Debug.Log(string.Concat(new string[]
		{
			rune.ToString(),
			" ",
			n,
			" ",
			path,
			" ",
			partyName
		}));
		if (rune)
		{
			for (int i = 0; i < this.runes.Count; i++)
			{
				if (this.runeNames[i] == n && partyName == this.runeParty[i])
				{
					Sprite sprite2 = this.LoadSprite(path, abilityName);
					this.runes[i] = sprite2;
				}
			}
			return;
		}
		Sprite sprite3 = this.LoadSprite(path, abilityName);
		this.runes.Add(sprite3);
		this.runeNames.Add(n);
		this.runeParty.Add("");
	}

	// Token: 0x06000BD4 RID: 3028 RVA: 0x000E2F94 File Offset: 0x000E1194
	public Sprite LoadSprite(string path, string abilityName)
	{
		if (File.Exists(path))
		{
			byte[] array = File.ReadAllBytes(path);
			Texture2D texture2D = new Texture2D(1, 1);
			texture2D.LoadImage(array);
			return Sprite.Create(texture2D, new Rect(0f, 0f, (float)texture2D.width, (float)texture2D.height), new Vector2(0.5f, 0.5f));
		}
		if (Records.x.editor)
		{
			string text = Application.persistentDataPath + "/" + abilityName + ".png";
			if (File.Exists(text))
			{
				byte[] array2 = File.ReadAllBytes(text);
				Texture2D texture2D2 = new Texture2D(1, 1);
				texture2D2.LoadImage(array2);
				return Sprite.Create(texture2D2, new Rect(0f, 0f, (float)texture2D2.width, (float)texture2D2.height), new Vector2(0.5f, 0.5f));
			}
		}
		return null;
	}

	// Token: 0x06000BD5 RID: 3029 RVA: 0x000E3070 File Offset: 0x000E1270
	public string GetArmorModel(string armor, string race, float sex, Character character)
	{
		if (race != "Yeti")
		{
			if (armor == "Robes1")
			{
				if (sex < 0.5f)
				{
					return "Player_LazureGuardsman_Female_Robes_Light";
				}
				return "Player_LazureGuardsman_Male_Robes_Light";
			}
			else if (armor == "Robes2")
			{
				if (sex < 0.5f)
				{
					return "Player_LazureGuardsman_Female_Robes_Light";
				}
				return "Player_LazureGuardsman_Male_Robes_Light";
			}
			else if (armor == "Robes3")
			{
				if (sex < 0.5f)
				{
					return "Player_LazureGuardsman_Female_Robes_Light";
				}
				return "Player_LazureGuardsman_Male_Robes_Light";
			}
			else if (armor == "Robes4")
			{
				if (sex < 0.5f)
				{
					return "Player_LazureGuardsman_Female_Robes_Light";
				}
				return "Player_LazureGuardsman_Male_Robes_Light";
			}
			else if (armor == "Crimscale1")
			{
				if (sex < 0.5f)
				{
					return "Player_LazureGuardsman_Female_Crimscale_Light";
				}
				return "Player_LazureGuardsman_Male_Crimscale_Light";
			}
			else if (armor == "Crimscale2")
			{
				if (sex < 0.5f)
				{
					return "Player_LazureGuardsman_Female_Crimscale_Light";
				}
				return "Player_LazureGuardsman_Male_Crimscale_Light";
			}
			else if (armor == "Crimscale3")
			{
				if (sex < 0.5f)
				{
					return "Player_LazureGuardsman_Female_Crimscale_Light";
				}
				return "Player_LazureGuardsman_Male_Crimscale_Light";
			}
			else if (armor == "Crimscale4")
			{
				if (sex < 0.5f)
				{
					return "Player_LazureGuardsman_Female_Crimscale_Light";
				}
				return "Player_LazureGuardsman_Male_Crimscale_Light";
			}
			else if (armor == "Pearl1")
			{
				if (sex < 0.5f)
				{
					return "Player_LazureGuardsman_Female_Pearl_Light";
				}
				return "Player_LazureGuardsman_Male_Pearl_Light";
			}
			else
			{
				if (armor == "Pearl2")
				{
					return "Player_LazureGuardsman_Either_Pearl_Medium";
				}
				if (armor == "Pearl3")
				{
					return "Player_LazureGuardsman_Either_Pearl_Medium";
				}
				if (armor == "Pearl4")
				{
					return "Player_LazureGuardsman_Either_Pearl_Medium";
				}
				if (armor == "Stonewood1")
				{
					if (sex < 0.5f)
					{
						return "Player_LazureGuardsman_Female_Stonewood_Light";
					}
					return "Player_LazureGuardsman_Male_Stonewood_Light";
				}
				else if (armor == "Stonewood2")
				{
					if (sex < 0.5f)
					{
						return "Player_LazureGuardsman_Female_Stonewood_Light";
					}
					return "Player_LazureGuardsman_Male_Stonewood_Light";
				}
				else if (armor == "Stonewood3")
				{
					if (sex < 0.5f)
					{
						return "Player_LazureGuardsman_Female_Stonewood_Light";
					}
					return "Player_LazureGuardsman_Male_Stonewood_Light";
				}
				else if (armor == "Stonewood4")
				{
					if (sex < 0.5f)
					{
						return "Player_LazureGuardsman_Female_Stonewood_Light";
					}
					return "Player_LazureGuardsman_Male_Stonewood_Light";
				}
				else
				{
					if (sex < 0.5f)
					{
						return "Player_LazureGuardsman_Female";
					}
					return "Player_LazureGuardsman_Male";
				}
			}
		}
		else
		{
			if (!(race == "Yeti"))
			{
				return character.stats.model;
			}
			if (armor == "Robes1")
			{
				return "Player_LazureGuardsman_Yeti_Robes_Light";
			}
			if (armor == "Crimscale1")
			{
				return "Player_LazureGuardsman_Yeti_Crimscale_Light";
			}
			if (armor == "Pearl1")
			{
				return "Player_LazureGuardsman_Yeti_Pearl_Light";
			}
			if (armor == "Stonewood1")
			{
				return "Player_LazureGuardsman_Yeti_Stonewood_Light";
			}
			return "Player_LazureGuardsmanYeti";
		}
	}

	// Token: 0x040011F0 RID: 4592
	[Header("Characters")]
	public List<GameObject> characterPrefabs = new List<GameObject>();

	// Token: 0x040011F1 RID: 4593
	private List<string> characterPrefabNames = new List<string>();

	// Token: 0x040011F2 RID: 4594
	public List<GameObject> characterHeads = new List<GameObject>();

	// Token: 0x040011F3 RID: 4595
	private List<string> characterHeadNames = new List<string>();

	// Token: 0x040011F4 RID: 4596
	public List<Texture> characterSkins = new List<Texture>();

	// Token: 0x040011F5 RID: 4597
	private List<string> characterSkinNames = new List<string>();

	// Token: 0x040011F6 RID: 4598
	public List<AnimatorOverrideController> characterAnimations = new List<AnimatorOverrideController>();

	// Token: 0x040011F7 RID: 4599
	private List<string> characterAnimationNames = new List<string>();

	// Token: 0x040011F8 RID: 4600
	public List<GameObject> characterArchives = new List<GameObject>();

	// Token: 0x040011F9 RID: 4601
	public List<string> characterArchiveNames = new List<string>();

	// Token: 0x040011FA RID: 4602
	public List<GameObject> headArchives = new List<GameObject>();

	// Token: 0x040011FB RID: 4603
	private List<string> headArchiveNames = new List<string>();

	// Token: 0x040011FC RID: 4604
	private List<float> characterArchiveTimes = new List<float>();

	// Token: 0x040011FD RID: 4605
	private List<float> headArchiveTimes = new List<float>();

	// Token: 0x040011FE RID: 4606
	public List<GameObject> boatPrefabs = new List<GameObject>();

	// Token: 0x040011FF RID: 4607
	public List<GameObject> boatArchives = new List<GameObject>();

	// Token: 0x04001200 RID: 4608
	private List<string> boatArchiveNames = new List<string>();

	// Token: 0x04001201 RID: 4609
	public List<string> boatPrefabNames = new List<string>();

	// Token: 0x04001202 RID: 4610
	private List<float> boatArchiveTimes = new List<float>();

	// Token: 0x04001203 RID: 4611
	public List<GameObject> loadedCharacters = new List<GameObject>();

	// Token: 0x04001204 RID: 4612
	[Header("Gore")]
	public List<GameObject> deathArchives = new List<GameObject>();

	// Token: 0x04001205 RID: 4613
	private List<int> deathArchivesID = new List<int>();

	// Token: 0x04001206 RID: 4614
	private List<string> deathArchivesTypes = new List<string>();

	// Token: 0x04001207 RID: 4615
	[Header("Effects")]
	public List<Sprite> effects = new List<Sprite>();

	// Token: 0x04001208 RID: 4616
	public List<Sprite> effectsLarge = new List<Sprite>();

	// Token: 0x04001209 RID: 4617
	public List<Sprite> effectsMedium = new List<Sprite>();

	// Token: 0x0400120A RID: 4618
	public List<string> effectNames = new List<string>();

	// Token: 0x0400120B RID: 4619
	public List<GameObject> effectHeadIcons = new List<GameObject>();

	// Token: 0x0400120C RID: 4620
	private List<string> effectHeadIconNames = new List<string>();

	// Token: 0x0400120D RID: 4621
	private List<GameObject> effectHeadIconArchives = new List<GameObject>();

	// Token: 0x0400120E RID: 4622
	private List<string> effectHeadIconArchiveNames = new List<string>();

	// Token: 0x0400120F RID: 4623
	private List<float> effectHeadIconArchiveTimes = new List<float>();

	// Token: 0x04001210 RID: 4624
	public Sprite[] staminaSprites1;

	// Token: 0x04001211 RID: 4625
	public Sprite[] staminaSprites2;

	// Token: 0x04001212 RID: 4626
	public Sprite[] staminaVulnerable;

	// Token: 0x04001213 RID: 4627
	public Sprite[] staminaRecover;

	// Token: 0x04001214 RID: 4628
	public Sprite[] armorSprites;

	// Token: 0x04001215 RID: 4629
	public Sprite[] armorSpritesBreak;

	// Token: 0x04001216 RID: 4630
	public Sprite[] armorVulnerable;

	// Token: 0x04001217 RID: 4631
	public Sprite[] armorBuffed;

	// Token: 0x04001218 RID: 4632
	public Sprite arrowUp1;

	// Token: 0x04001219 RID: 4633
	public Sprite arrowDown1;

	// Token: 0x0400121A RID: 4634
	public Sprite arrowUp2;

	// Token: 0x0400121B RID: 4635
	public Sprite arrowDown2;

	// Token: 0x0400121C RID: 4636
	public Sprite arrowUp3;

	// Token: 0x0400121D RID: 4637
	public Sprite arrowDown3;

	// Token: 0x0400121E RID: 4638
	[Header("Abilities")]
	public List<Sprite> abilities = new List<Sprite>();

	// Token: 0x0400121F RID: 4639
	private List<string> abilityNames = new List<string>();

	// Token: 0x04001220 RID: 4640
	public List<Sprite> runes = new List<Sprite>();

	// Token: 0x04001221 RID: 4641
	public List<string> runeNames = new List<string>();

	// Token: 0x04001222 RID: 4642
	public List<string> runeParty = new List<string>();

	// Token: 0x04001223 RID: 4643
	public Sprite emptySprite;

	// Token: 0x04001224 RID: 4644
	[Header("Items")]
	public List<Sprite> items = new List<Sprite>();

	// Token: 0x04001225 RID: 4645
	private List<string> itemNames = new List<string>();

	// Token: 0x04001226 RID: 4646
	public List<Sprite> itemsHud = new List<Sprite>();

	// Token: 0x04001227 RID: 4647
	private List<string> itemHudNames = new List<string>();

	// Token: 0x04001228 RID: 4648
	public List<Sprite> itemsFull = new List<Sprite>();

	// Token: 0x04001229 RID: 4649
	private List<string> itemFullNames = new List<string>();

	// Token: 0x0400122A RID: 4650
	public List<GameObject> itemPrefabs = new List<GameObject>();

	// Token: 0x0400122B RID: 4651
	private List<string> itemPrefabNames = new List<string>();

	// Token: 0x0400122C RID: 4652
	public List<GameObject> itemBodyPrefabs = new List<GameObject>();

	// Token: 0x0400122D RID: 4653
	private List<string> itemBodyPrefabNames = new List<string>();

	// Token: 0x0400122E RID: 4654
	[Header("Recycling")]
	public List<GameObject> itemArchives = new List<GameObject>();

	// Token: 0x0400122F RID: 4655
	public List<string> itemArchiveNames = new List<string>();

	// Token: 0x04001230 RID: 4656
	public List<float> itemArchiveTimes = new List<float>();

	// Token: 0x04001231 RID: 4657
	public List<GameObject> itemBodyArchives = new List<GameObject>();

	// Token: 0x04001232 RID: 4658
	public List<string> itemBodyArchiveNames = new List<string>();

	// Token: 0x04001233 RID: 4659
	public List<float> itemBodyArchiveTimes = new List<float>();

	// Token: 0x04001234 RID: 4660
	private GameObject go;

	// Token: 0x04001235 RID: 4661
	private Vector3 vec;

	// Token: 0x04001236 RID: 4662
	private Quaternion rot;

	// Token: 0x04001237 RID: 4663
	public Transform tr;

	// Token: 0x04001238 RID: 4664
	public bool clearing;
}
