1043 lines
26 KiB
C#
1043 lines
26 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using DarkTonic.MasterAudio;
|
|
using TMPro;
|
|
using UnityEngine;
|
|
using UnityEngine.EventSystems;
|
|
using UnityEngine.UI;
|
|
|
|
// Token: 0x02000094 RID: 148
|
|
public class ArrowKit : MonoBehaviour
|
|
{
|
|
// Token: 0x06000E4B RID: 3659 RVA: 0x00112749 File Offset: 0x00110949
|
|
private void Update()
|
|
{
|
|
if (Links.x.characterSheet.open && Links.x.characterSheet.character != this.character)
|
|
{
|
|
this.OpenMenu(this.kit);
|
|
}
|
|
}
|
|
|
|
// Token: 0x06000E4C RID: 3660 RVA: 0x00112784 File Offset: 0x00110984
|
|
public void SetSlider()
|
|
{
|
|
float x = Links.x.fellowship.direction.x;
|
|
Object currentEventObject = Links.x.gameplay.currentEventObject;
|
|
Slider slider = null;
|
|
if (currentEventObject == this.slider.gameObject)
|
|
{
|
|
slider = this.slider;
|
|
}
|
|
float num = 1f;
|
|
if (slider)
|
|
{
|
|
Links.x.inventory.inSlider = true;
|
|
if (Time.realtimeSinceStartup > this.lastSliderTime + 0.3f || this.lastSliderTime == 0f)
|
|
{
|
|
if (x > 0f)
|
|
{
|
|
slider.value += num;
|
|
}
|
|
else if (x < 0f)
|
|
{
|
|
slider.value -= num;
|
|
}
|
|
this.lastSliderTime = Time.realtimeSinceStartup;
|
|
return;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
Links.x.inventory.inSlider = false;
|
|
}
|
|
}
|
|
|
|
// Token: 0x06000E4D RID: 3661 RVA: 0x00112858 File Offset: 0x00110A58
|
|
public void OpenMenu(Item kitItem)
|
|
{
|
|
if (Links.x.characterSheet.booksMenu.open)
|
|
{
|
|
Links.x.characterSheet.booksMenu.CloseMenu();
|
|
}
|
|
if (Links.x.characterSheet.note.activeSelf)
|
|
{
|
|
Links.x.characterSheet.CloseNote();
|
|
}
|
|
if (!this.open)
|
|
{
|
|
MasterAudio.PlaySoundAndForget("Crafting 1", 0.6f, new float?(1f), 0f, "", null);
|
|
MasterAudio.PlaySoundAndForget("Crafting 3", 0.6f, new float?(1f), 0f, "", null);
|
|
}
|
|
this.kit = kitItem;
|
|
this.crafting = false;
|
|
this.character = Links.x.characterSheet.character;
|
|
this.selectedType = 0;
|
|
this.selectedArrowhead = -1;
|
|
this.selectedIngredient = 9;
|
|
if (!this.setList)
|
|
{
|
|
this.itemIDs = new int[this.itemNames.Length];
|
|
for (int i = 0; i < this.itemNames.Length; i++)
|
|
{
|
|
int invRowID = Links.x.library.GetInvRowID(this.itemNames[i]);
|
|
this.itemIDs[i] = invRowID;
|
|
}
|
|
}
|
|
this.setList = true;
|
|
this.GetFirstSelected(false);
|
|
this.open = true;
|
|
this.slider.minValue = 0f;
|
|
this.KitText();
|
|
this.IngredientKit();
|
|
this.GetMax();
|
|
Links.x.characterSheet.DraggingButtons(true);
|
|
base.gameObject.SetActive(true);
|
|
this.SliderChange();
|
|
Links.x.inventory.CloseTooltip();
|
|
this.SetColors();
|
|
if (Links.x.joy)
|
|
{
|
|
if (this.selectedType == 0 || this.selectedType == -1)
|
|
{
|
|
Links.x.gameplay.SetInteractableSelected(EventSystem.current, this.btns[0].gameObject);
|
|
}
|
|
else if (this.selectedType == 1)
|
|
{
|
|
Links.x.gameplay.SetInteractableSelected(EventSystem.current, this.btns[1].gameObject);
|
|
}
|
|
else if (this.selectedType == 2)
|
|
{
|
|
Links.x.gameplay.SetInteractableSelected(EventSystem.current, this.btns[2].gameObject);
|
|
}
|
|
}
|
|
Links.x.characterSheet.SetPortraitNav(false);
|
|
}
|
|
|
|
// Token: 0x06000E4E RID: 3662 RVA: 0x00112AB5 File Offset: 0x00110CB5
|
|
public void UpdateFromInventoryChange()
|
|
{
|
|
this.IngredientKit();
|
|
this.GetMax();
|
|
this.SliderChange();
|
|
this.SetColors();
|
|
}
|
|
|
|
// Token: 0x06000E4F RID: 3663 RVA: 0x00112AD0 File Offset: 0x00110CD0
|
|
private void GetFirstSelected(bool useSelected)
|
|
{
|
|
bool flag = false;
|
|
if (this.character.ItemAmount(this.itemIDs[0]) > 0 && (!useSelected || (useSelected && this.selectedType == 0)))
|
|
{
|
|
this.selectedArrowhead = -1;
|
|
for (int i = 0; i < this.btns.Length; i++)
|
|
{
|
|
if (!flag && i >= 20 && this.character.ItemAmount(this.itemIDs[i]) > 0)
|
|
{
|
|
this.selectedArrowhead = i;
|
|
this.selectedType = 0;
|
|
flag = true;
|
|
}
|
|
}
|
|
this.selectedIngredient = 9;
|
|
}
|
|
else if (!flag && this.character.ItemAmount(this.itemIDs[1]) > 0 && (!useSelected || (useSelected && this.selectedType == 1)))
|
|
{
|
|
this.selectedArrowhead = -1;
|
|
if (this.character.ItemAmount(this.itemIDs[4]) > 0)
|
|
{
|
|
this.selectedIngredient = 4;
|
|
flag = true;
|
|
this.selectedType = 1;
|
|
}
|
|
if (!flag && this.character.ItemAmount(this.itemIDs[5]) > 0)
|
|
{
|
|
this.selectedIngredient = 5;
|
|
flag = true;
|
|
this.selectedType = 1;
|
|
}
|
|
if (!flag && this.character.ItemAmount(this.itemIDs[6]) > 0)
|
|
{
|
|
this.selectedIngredient = 6;
|
|
flag = true;
|
|
this.selectedType = 1;
|
|
}
|
|
if (!flag && this.character.ItemAmount(this.itemIDs[7]) > 0)
|
|
{
|
|
this.selectedIngredient = 7;
|
|
flag = true;
|
|
this.selectedType = 1;
|
|
}
|
|
if (!flag && this.character.ItemAmount(this.itemIDs[8]) > 0)
|
|
{
|
|
this.selectedIngredient = 8;
|
|
flag = true;
|
|
this.selectedType = 1;
|
|
}
|
|
if (!flag)
|
|
{
|
|
this.selectedIngredient = 9;
|
|
}
|
|
}
|
|
else if (!flag && this.character.ItemAmount(this.itemIDs[2]) > 0 && (!useSelected || (useSelected && this.selectedType == 2)))
|
|
{
|
|
for (int j = 0; j < this.btns.Length; j++)
|
|
{
|
|
if (!flag && j > 9 && j < 20 && this.character.ItemAmount(this.itemIDs[j]) > 0)
|
|
{
|
|
this.selectedIngredient = j;
|
|
flag = true;
|
|
this.selectedType = 2;
|
|
}
|
|
}
|
|
this.selectedArrowhead = -1;
|
|
if (!flag)
|
|
{
|
|
this.selectedIngredient = 9;
|
|
}
|
|
}
|
|
this.render.SetActive(true);
|
|
if (this.selectedType == 0)
|
|
{
|
|
this.arrowsBag.SetActive(true);
|
|
this.dartsBag.SetActive(false);
|
|
this.elixirsBag.SetActive(false);
|
|
this.arrowsHitBoxes.SetActive(true);
|
|
this.dartsHitBoxes.SetActive(false);
|
|
this.elixirsHitBoxes.SetActive(false);
|
|
}
|
|
else if (this.selectedType == 1)
|
|
{
|
|
this.arrowsBag.SetActive(false);
|
|
this.dartsBag.SetActive(true);
|
|
this.elixirsBag.SetActive(false);
|
|
this.arrowsHitBoxes.SetActive(false);
|
|
this.dartsHitBoxes.SetActive(true);
|
|
this.elixirsHitBoxes.SetActive(false);
|
|
}
|
|
else if (this.selectedType == 2)
|
|
{
|
|
this.arrowsBag.SetActive(false);
|
|
this.dartsBag.SetActive(false);
|
|
this.elixirsBag.SetActive(true);
|
|
this.arrowsHitBoxes.SetActive(false);
|
|
this.dartsHitBoxes.SetActive(false);
|
|
this.elixirsHitBoxes.SetActive(true);
|
|
}
|
|
this.EndHover();
|
|
}
|
|
|
|
// Token: 0x06000E50 RID: 3664 RVA: 0x00112E04 File Offset: 0x00111004
|
|
public void SetHover(string type, string resource)
|
|
{
|
|
if (type.Contains("Type"))
|
|
{
|
|
this.labelType.text = Links.x.library.GetInvRowFromName(resource)._DisplayName;
|
|
return;
|
|
}
|
|
if (type.Contains("Animal"))
|
|
{
|
|
string displayName = Links.x.library.GetInvRowFromName(resource)._DisplayName;
|
|
this.str.Clear();
|
|
this.str.Append(displayName);
|
|
string effectType = this.GetEffectType(resource);
|
|
if (effectType != "")
|
|
{
|
|
this.str.Append("\n(");
|
|
this.str.Append(effectType);
|
|
this.str.Append(")");
|
|
}
|
|
this.labelIngredient.text = this.str.ToString();
|
|
return;
|
|
}
|
|
if (type.Contains("Resource"))
|
|
{
|
|
if (resource.Contains("None"))
|
|
{
|
|
this.labelIngredient.text = "No added effects";
|
|
return;
|
|
}
|
|
string effectType2 = this.GetEffectType(resource);
|
|
string displayName2 = Links.x.library.GetInvRowFromName(resource)._DisplayName;
|
|
this.str.Clear();
|
|
this.str.Append(displayName2);
|
|
if (effectType2 != "")
|
|
{
|
|
this.str.Append("\n(");
|
|
this.str.Append(effectType2);
|
|
this.str.Append(")");
|
|
}
|
|
this.labelIngredient.text = this.str.ToString();
|
|
}
|
|
}
|
|
|
|
// Token: 0x06000E51 RID: 3665 RVA: 0x00112F90 File Offset: 0x00111190
|
|
public void EndHover()
|
|
{
|
|
this.labelType.text = Links.x.library.GetInvRowFromName(this.itemNames[this.selectedType])._DisplayName;
|
|
if (this.selectedType == 0)
|
|
{
|
|
if (this.selectedArrowhead > -1)
|
|
{
|
|
Library.Inventory invRowFromName = Links.x.library.GetInvRowFromName(this.itemNames[this.selectedArrowhead]);
|
|
string displayName = invRowFromName._DisplayName;
|
|
this.str.Clear();
|
|
this.str.Append(displayName);
|
|
if (invRowFromName._DmgMax > 0)
|
|
{
|
|
this.str.Append(" (+");
|
|
this.str.Append(invRowFromName._DmgMax);
|
|
this.str.Append(" damage)");
|
|
}
|
|
this.labelIngredient.text = this.str.ToString();
|
|
return;
|
|
}
|
|
this.labelIngredient.text = "Arrowheads";
|
|
return;
|
|
}
|
|
else
|
|
{
|
|
if (this.selectedIngredient > -1 && this.selectedIngredient != 9)
|
|
{
|
|
string effectType = this.GetEffectType(this.itemNames[this.selectedIngredient]);
|
|
string displayName2 = Links.x.library.GetInvRowFromName(this.itemNames[this.selectedIngredient])._DisplayName;
|
|
this.str.Clear();
|
|
this.str.Append(displayName2);
|
|
if (effectType != "")
|
|
{
|
|
this.str.Append("\n(");
|
|
this.str.Append(effectType);
|
|
this.str.Append(")");
|
|
}
|
|
this.labelIngredient.text = this.str.ToString();
|
|
return;
|
|
}
|
|
this.labelIngredient.text = "";
|
|
if (this.selectedType == 1)
|
|
{
|
|
this.labelIngredient.text = "Fillers";
|
|
return;
|
|
}
|
|
this.labelIngredient.text = "Intoxicants";
|
|
return;
|
|
}
|
|
}
|
|
|
|
// Token: 0x06000E52 RID: 3666 RVA: 0x00113178 File Offset: 0x00111378
|
|
private string GetEffectType(string x)
|
|
{
|
|
string text = "";
|
|
if (this.selectedType == 0)
|
|
{
|
|
if (x == "Nail")
|
|
{
|
|
text = "";
|
|
}
|
|
if (x == "Fang")
|
|
{
|
|
text = "Adds damage";
|
|
}
|
|
if (x == "Scales")
|
|
{
|
|
text = "";
|
|
}
|
|
}
|
|
else if (this.selectedType == 1)
|
|
{
|
|
if (x == "Mushroom")
|
|
{
|
|
text = "Confusion";
|
|
}
|
|
if (x == "Frog")
|
|
{
|
|
text = "Poison Damage";
|
|
}
|
|
if (x == "Acorn")
|
|
{
|
|
text = "Slows movement";
|
|
}
|
|
if (x == "Shell")
|
|
{
|
|
text = "Interrupts action time";
|
|
}
|
|
if (x == "ShinyRock")
|
|
{
|
|
text = "Breaks armor";
|
|
}
|
|
}
|
|
else if (this.selectedType == 2 || this.selectedType == 3)
|
|
{
|
|
if (x == "FoodHealthOk")
|
|
{
|
|
text = "Adds damage";
|
|
}
|
|
if (x == "FoodHealthGood")
|
|
{
|
|
text = "Adds damage x2";
|
|
}
|
|
if (x == "FoodSpiritOk")
|
|
{
|
|
text = "Reduces pagan";
|
|
}
|
|
if (x == "FoodSpiritGood")
|
|
{
|
|
text = "Reduces pagan x2";
|
|
}
|
|
if (x == "FoodFatigueOk")
|
|
{
|
|
text = "Reduces Stamina";
|
|
}
|
|
if (x == "FoodFatigueGood")
|
|
{
|
|
text = "Reduces Stamina x2";
|
|
}
|
|
if (x == "FoodWhiteBuffsOk")
|
|
{
|
|
text = "Reduces Speeds";
|
|
}
|
|
if (x == "FoodWhiteBuffsGood")
|
|
{
|
|
text = "Reduces Speeds";
|
|
}
|
|
if (x == "FoodBlackBuffsOk")
|
|
{
|
|
text = "Breaks Armor";
|
|
}
|
|
if (x == "FoodBlackBuffsGood")
|
|
{
|
|
text = "Breaks Armor x2";
|
|
}
|
|
}
|
|
return text;
|
|
}
|
|
|
|
// Token: 0x06000E53 RID: 3667 RVA: 0x00113318 File Offset: 0x00111518
|
|
private void KitText()
|
|
{
|
|
}
|
|
|
|
// Token: 0x06000E54 RID: 3668 RVA: 0x0011331C File Offset: 0x0011151C
|
|
private void IngredientKit()
|
|
{
|
|
for (int i = 0; i < this.stacks.Length; i++)
|
|
{
|
|
if (this.stacks[i])
|
|
{
|
|
bool flag = false;
|
|
if (this.selectedType == 0 && (i >= 20 || i < 3))
|
|
{
|
|
flag = true;
|
|
}
|
|
if (this.selectedType == 1 && i < 10)
|
|
{
|
|
flag = true;
|
|
}
|
|
if (this.selectedType == 2 && (i < 3 || (i > 9 && i < 20)))
|
|
{
|
|
flag = true;
|
|
}
|
|
int num = -1;
|
|
if (flag)
|
|
{
|
|
num = this.character.ItemAmount(this.itemIDs[i]);
|
|
}
|
|
if (num > 0 || i < 3)
|
|
{
|
|
this.stacks[i].text = num.ToString();
|
|
if (this.renderObjects[i])
|
|
{
|
|
this.renderObjects[i].SetActive(true);
|
|
}
|
|
this.buttons[i].gameObject.SetActive(true);
|
|
}
|
|
else
|
|
{
|
|
if (this.renderObjects[i])
|
|
{
|
|
this.renderObjects[i].SetActive(false);
|
|
}
|
|
this.buttons[i].gameObject.SetActive(false);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// Token: 0x06000E55 RID: 3669 RVA: 0x0011343C File Offset: 0x0011163C
|
|
private void GetMax()
|
|
{
|
|
int num = this.character.ItemAmount(this.itemIDs[this.selectedType]);
|
|
int num2 = 0;
|
|
if (this.selectedType >= 1)
|
|
{
|
|
num2 = num;
|
|
}
|
|
else if (this.selectedArrowhead > -1)
|
|
{
|
|
num2 = this.character.ItemAmount(this.itemIDs[this.selectedArrowhead]);
|
|
}
|
|
int num3 = num;
|
|
if (this.selectedType == 1)
|
|
{
|
|
num3 = (int)Mathf.Floor((float)this.character.ItemAmount(this.itemIDs[this.selectedIngredient]) / this.stoneIngredientCost);
|
|
}
|
|
else if (this.selectedType >= 2)
|
|
{
|
|
num3 = this.character.ItemAmount(this.itemIDs[this.selectedIngredient]);
|
|
}
|
|
this.currentMax = num;
|
|
if (this.selectedType == 0)
|
|
{
|
|
if (num < num2)
|
|
{
|
|
this.currentMax = num;
|
|
}
|
|
else
|
|
{
|
|
this.currentMax = num2;
|
|
}
|
|
}
|
|
else if (this.selectedType == 1)
|
|
{
|
|
if (num < num3)
|
|
{
|
|
this.currentMax = num;
|
|
}
|
|
else
|
|
{
|
|
this.currentMax = num3;
|
|
}
|
|
}
|
|
else if (num < num3)
|
|
{
|
|
this.currentMax = num;
|
|
}
|
|
else
|
|
{
|
|
this.currentMax = num3;
|
|
}
|
|
if (this.currentMax > 100)
|
|
{
|
|
this.currentMax = 100;
|
|
}
|
|
if (this.currentMax >= 1)
|
|
{
|
|
this.max.text = this.currentMax.ToString();
|
|
this.min.text = "1";
|
|
this.slider.maxValue = (float)this.currentMax;
|
|
this.slider.minValue = 1f;
|
|
this.slider.value = 1f;
|
|
}
|
|
else
|
|
{
|
|
this.max.text = this.currentMax.ToString();
|
|
this.min.text = "0";
|
|
this.slider.maxValue = (float)this.currentMax;
|
|
this.slider.minValue = 0f;
|
|
this.slider.value = 0f;
|
|
}
|
|
this.SliderChange();
|
|
}
|
|
|
|
// Token: 0x06000E56 RID: 3670 RVA: 0x00113614 File Offset: 0x00111814
|
|
public void SetColors()
|
|
{
|
|
for (int i = 0; i < this.borders.Length; i++)
|
|
{
|
|
if (this.buttons[i])
|
|
{
|
|
if (i < 3)
|
|
{
|
|
this.buttons[i].sprite = this.normalSprites[i];
|
|
this.selectedBackgrounds[i].color = new Color(this.selectedBackgrounds[i].color.r, this.selectedBackgrounds[i].color.g, this.selectedBackgrounds[i].color.b, 0.11f);
|
|
}
|
|
else
|
|
{
|
|
ColorBlock colors = this.btns[i].colors;
|
|
Color normalColor = colors.normalColor;
|
|
normalColor.a = 0f;
|
|
colors.normalColor = normalColor;
|
|
this.btns[i].colors = colors;
|
|
}
|
|
}
|
|
}
|
|
if (this.buttons[this.selectedType])
|
|
{
|
|
this.buttons[this.selectedType].sprite = this.selectedSprites[this.selectedType];
|
|
this.selectedBackgrounds[this.selectedType].color = new Color(this.selectedBackgrounds[this.selectedType].color.r, this.selectedBackgrounds[this.selectedType].color.g, this.selectedBackgrounds[this.selectedType].color.b, 0.61f);
|
|
}
|
|
if (this.selectedType == 0)
|
|
{
|
|
if (this.selectedArrowhead > -1)
|
|
{
|
|
ColorBlock colors2 = this.btns[this.selectedArrowhead].colors;
|
|
Color normalColor2 = colors2.normalColor;
|
|
normalColor2.a = 1f;
|
|
colors2.normalColor = normalColor2;
|
|
this.btns[this.selectedArrowhead].colors = colors2;
|
|
return;
|
|
}
|
|
}
|
|
else if (this.selectedType >= 1 && this.selectedIngredient > -1 && this.btns[this.selectedIngredient])
|
|
{
|
|
ColorBlock colors3 = this.btns[this.selectedIngredient].colors;
|
|
Color normalColor3 = colors3.normalColor;
|
|
normalColor3.a = 1f;
|
|
colors3.normalColor = normalColor3;
|
|
this.btns[this.selectedIngredient].colors = colors3;
|
|
}
|
|
}
|
|
|
|
// Token: 0x06000E57 RID: 3671 RVA: 0x00113848 File Offset: 0x00111A48
|
|
public void SliderChange()
|
|
{
|
|
if (this.crafting)
|
|
{
|
|
return;
|
|
}
|
|
this.slider.value.ToString();
|
|
if (this.currentMax > 0)
|
|
{
|
|
string text = "";
|
|
string text2 = "Create ";
|
|
if (this.selectedType == 0)
|
|
{
|
|
text = "Arrow";
|
|
text2 = "Fletch ";
|
|
}
|
|
else if (this.selectedType == 1)
|
|
{
|
|
text = "Dart";
|
|
text2 = "Wrap ";
|
|
}
|
|
else if (this.selectedType == 2 || this.selectedType == 3)
|
|
{
|
|
text = "Elixir";
|
|
text2 = "Prepare ";
|
|
}
|
|
Vector3 vector = new Vector3((float)this.selectedArrowhead, (float)this.selectedIngredient, 0f);
|
|
if (this.selectedIngredient == 9)
|
|
{
|
|
vector.y = 0f;
|
|
}
|
|
if (text == "Elixir" || text == "Dart")
|
|
{
|
|
vector.x = 0f;
|
|
}
|
|
int realAmmo = Links.x.inventory.GetRealAmmo(text, vector);
|
|
string text3 = Links.x.library.GetInvRowByIndex(realAmmo)._DisplayName;
|
|
if (this.selectedType == 0)
|
|
{
|
|
Library.Inventory invRowFromName = Links.x.library.GetInvRowFromName(this.itemNames[this.selectedArrowhead]);
|
|
if (invRowFromName._DmgMax > 0)
|
|
{
|
|
text3 += " +";
|
|
text3 += invRowFromName._DmgMax.ToString();
|
|
}
|
|
}
|
|
float num = this.slider.value;
|
|
if (this.selectedType == 2 || this.selectedType == 3)
|
|
{
|
|
num = Mathf.Round(this.slider.value) * 2f;
|
|
}
|
|
else if (this.selectedType == 1)
|
|
{
|
|
int num2 = this.character.ItemAmount(this.itemIDs[this.selectedIngredient]);
|
|
float num3 = (float)((int)Mathf.Floor((float)num2 / this.stoneIngredientCost));
|
|
Debug.Log(string.Concat(new string[]
|
|
{
|
|
this.itemIDs[this.selectedIngredient].ToString(),
|
|
" ",
|
|
num2.ToString(),
|
|
" ",
|
|
num3.ToString()
|
|
}));
|
|
if (Mathf.Round(this.slider.value) <= num3)
|
|
{
|
|
num = Mathf.Round(this.slider.value);
|
|
}
|
|
else
|
|
{
|
|
num = num3;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
num = Mathf.Round(this.slider.value) * 4f;
|
|
}
|
|
this.btnText.text = string.Concat(new string[]
|
|
{
|
|
text2,
|
|
text3,
|
|
" (",
|
|
num.ToString(),
|
|
")"
|
|
});
|
|
this.btn.interactable = true;
|
|
return;
|
|
}
|
|
this.btn.interactable = false;
|
|
if (this.selectedType == 0)
|
|
{
|
|
this.btnText.text = "Needs stick and arrowhead";
|
|
return;
|
|
}
|
|
if (this.selectedType == 1)
|
|
{
|
|
this.btnText.text = "Needs leaf and filler x" + this.stoneIngredientCost.ToString();
|
|
return;
|
|
}
|
|
this.btnText.text = "Needs globe and intoxicant";
|
|
}
|
|
|
|
// Token: 0x06000E58 RID: 3672 RVA: 0x00113B56 File Offset: 0x00111D56
|
|
public void Confirm()
|
|
{
|
|
if (!this.crafting && this.currentMax > 0)
|
|
{
|
|
this.StartCraft();
|
|
}
|
|
}
|
|
|
|
// Token: 0x06000E59 RID: 3673 RVA: 0x00113B70 File Offset: 0x00111D70
|
|
private void StartCraft()
|
|
{
|
|
this.crafting = true;
|
|
string text = "";
|
|
if (this.selectedType == 0)
|
|
{
|
|
text = "Arrow";
|
|
}
|
|
else if (this.selectedType == 1)
|
|
{
|
|
text = "Dart";
|
|
}
|
|
else if (this.selectedType == 2 || this.selectedType == 3)
|
|
{
|
|
text = "Elixir";
|
|
}
|
|
Links.x.itemPickupFX.gameObject.SetActive(true);
|
|
Links.x.itemPickupFX.gameObject.GetComponent<HannahAnimator>().Play("Idle");
|
|
Links.x.itemPickupFX.position = this.btns[this.selectedType].gameObject.transform.GetChild(0).position;
|
|
Links.x.itemPickupFX2.gameObject.SetActive(true);
|
|
Links.x.itemPickupFX2.gameObject.GetComponent<HannahAnimator>().Play("Idle");
|
|
if (this.selectedType == 0)
|
|
{
|
|
Links.x.itemPickupFX2.position = this.btns[this.selectedArrowhead].gameObject.transform.GetChild(0).position;
|
|
}
|
|
else
|
|
{
|
|
Links.x.itemPickupFX2.position = this.btns[this.selectedIngredient].gameObject.transform.GetChild(0).position;
|
|
}
|
|
if ("Bow" == "Bow")
|
|
{
|
|
MasterAudio.PlaySoundAndForget("Crafting 1", 1f, new float?(1f), 0f, "", null);
|
|
}
|
|
if (text == "Dart")
|
|
{
|
|
MasterAudio.PlaySoundAndForget("Crafting 2", 1f, new float?(1f), 0f, "", null);
|
|
}
|
|
if (text == "Elixir")
|
|
{
|
|
MasterAudio.PlaySoundAndForget("Crafting 3", 1f, new float?(1f), 0f, "", null);
|
|
}
|
|
int num = 0;
|
|
if (this.selectedType == 0)
|
|
{
|
|
num = Links.x.library.GetInvRowByIndex(this.itemIDs[this.selectedArrowhead])._DmgMax;
|
|
}
|
|
Vector3 vector = new Vector3((float)num, (float)this.selectedIngredient, 0f);
|
|
if (this.selectedIngredient == 9)
|
|
{
|
|
vector.y = 0f;
|
|
}
|
|
if (this.selectedType == 0)
|
|
{
|
|
vector.y = (float)this.selectedArrowhead;
|
|
}
|
|
int realAmmo = Links.x.inventory.GetRealAmmo(text, vector);
|
|
Library.Inventory invRowByIndex = Links.x.library.GetInvRowByIndex(realAmmo);
|
|
if (text == "Elixir" || text == "Dart")
|
|
{
|
|
vector.x = 0f;
|
|
}
|
|
else
|
|
{
|
|
Library.Inventory invRowFromName = Links.x.library.GetInvRowFromName(this.itemNames[this.selectedArrowhead]);
|
|
vector.x = (float)invRowFromName._DmgMax;
|
|
}
|
|
float num2 = Mathf.Round(this.slider.value);
|
|
if (this.selectedType == 2 || this.selectedType == 3)
|
|
{
|
|
num2 = Mathf.Round(this.slider.value) * 2f;
|
|
}
|
|
else if (this.selectedType == 1)
|
|
{
|
|
num2 = Mathf.Round(this.slider.value) * 1f;
|
|
}
|
|
else
|
|
{
|
|
num2 = Mathf.Round(this.slider.value) * 4f;
|
|
}
|
|
Item item;
|
|
ItemEquipped itemEquipped;
|
|
Links.x.inventory.AddFromGround(null, null, 0, false, 0f, realAmmo, (int)num2, vector, Vector3.zero, new Vector4((float)invRowByIndex._DurabilityMax, 0f, 0f, 0f), Links.x.inventory.openBag.character, true, false, out item, out itemEquipped);
|
|
if (item)
|
|
{
|
|
item.CheckStackSize();
|
|
}
|
|
if (itemEquipped)
|
|
{
|
|
itemEquipped.UpdateStackSize();
|
|
}
|
|
Links.x.inventory.selectedPlayer.UpdateListsFromInv(true);
|
|
if (item)
|
|
{
|
|
Links.x.inventory.fx.gameObject.SetActive(true);
|
|
Links.x.inventory.fx.gameObject.GetComponent<HannahAnimator>().Play("Idle");
|
|
Links.x.inventory.fx.gameObject.transform.position = item.gameObject.transform.position;
|
|
}
|
|
if (itemEquipped)
|
|
{
|
|
Links.x.inventory.fx.gameObject.SetActive(true);
|
|
Links.x.inventory.fx.gameObject.GetComponent<HannahAnimator>().Play("Idle");
|
|
Links.x.inventory.fx.gameObject.transform.position = itemEquipped.gameObject.transform.position;
|
|
}
|
|
this.character.RemoveItem(this.itemIDs[this.selectedType], (int)this.slider.value);
|
|
if (this.selectedType == 0)
|
|
{
|
|
this.character.RemoveItem(this.itemIDs[this.selectedArrowhead], (int)this.slider.value);
|
|
}
|
|
int num3 = (int)this.slider.value;
|
|
if (this.selectedType == 1)
|
|
{
|
|
num3 *= (int)this.stoneIngredientCost;
|
|
}
|
|
if (this.selectedIngredient != 9)
|
|
{
|
|
this.character.RemoveItem(this.itemIDs[this.selectedIngredient], num3);
|
|
}
|
|
if (Records.x.InCombat(false))
|
|
{
|
|
Links.x.inventory.AddCombatTime(Links.x.characterSheet.character, "ExtraLong");
|
|
}
|
|
if (this.character.ItemAmount(this.itemIDs[this.selectedType]) > 0)
|
|
{
|
|
this.GetFirstSelected(true);
|
|
}
|
|
else
|
|
{
|
|
this.selectedType = 0;
|
|
this.selectedIngredient = 9;
|
|
this.selectedArrowhead = -1;
|
|
this.GetFirstSelected(false);
|
|
}
|
|
this.crafting = false;
|
|
this.slider.minValue = 0f;
|
|
this.KitText();
|
|
this.IngredientKit();
|
|
this.GetMax();
|
|
this.SliderChange();
|
|
this.SetColors();
|
|
if (Links.x.joy)
|
|
{
|
|
if (this.selectedType == 0 || this.selectedType == -1)
|
|
{
|
|
EventSystem.current.SetSelectedGameObject(this.btns[0].gameObject);
|
|
return;
|
|
}
|
|
if (this.selectedType == 1)
|
|
{
|
|
EventSystem.current.SetSelectedGameObject(this.btns[1].gameObject);
|
|
return;
|
|
}
|
|
if (this.selectedType == 2)
|
|
{
|
|
EventSystem.current.SetSelectedGameObject(this.btns[2].gameObject);
|
|
}
|
|
}
|
|
}
|
|
|
|
// Token: 0x06000E5A RID: 3674 RVA: 0x00114208 File Offset: 0x00112408
|
|
public void SelectCraftingButton(int index)
|
|
{
|
|
if (index == 0 || index == 1 || index == 2 || index == 3)
|
|
{
|
|
int num = this.selectedType;
|
|
this.selectedType = index;
|
|
this.IngredientKit();
|
|
if (index != num)
|
|
{
|
|
this.GetFirstSelected(true);
|
|
}
|
|
}
|
|
if (index > 3)
|
|
{
|
|
if (index >= 20 && this.selectedType == 0)
|
|
{
|
|
this.selectedArrowhead = index;
|
|
this.selectedIngredient = 9;
|
|
}
|
|
else
|
|
{
|
|
this.selectedArrowhead = -1;
|
|
this.selectedIngredient = index;
|
|
}
|
|
}
|
|
this.GetMax();
|
|
this.SetColors();
|
|
if (Links.x.mk)
|
|
{
|
|
EventSystem.current.SetSelectedGameObject(this.slider.gameObject);
|
|
}
|
|
this.EndHover();
|
|
}
|
|
|
|
// Token: 0x06000E5B RID: 3675 RVA: 0x001142A6 File Offset: 0x001124A6
|
|
public void StartClose()
|
|
{
|
|
this.CloseMenu();
|
|
}
|
|
|
|
// Token: 0x06000E5C RID: 3676 RVA: 0x001142B0 File Offset: 0x001124B0
|
|
public void CloseMenu()
|
|
{
|
|
Links.x.inventory.inSlider = false;
|
|
if (Links.x.characterSheet.open)
|
|
{
|
|
MasterAudio.PlaySoundAndForget("Crafting 2", 0.5f, new float?(1f), 0f, "", null);
|
|
MasterAudio.PlaySoundAndForget("Crafting 3", 0.4f, new float?(1f), 0f, "", null);
|
|
}
|
|
Links.x.characterSheet.DraggingButtons(false);
|
|
this.render.SetActive(false);
|
|
this.open = false;
|
|
this.kit = null;
|
|
base.gameObject.GetComponent<Animator>().Play("CloseSubMenu");
|
|
Links.x.gameplay.SetInteractableSelected(EventSystem.current, Links.x.characterSheet.portraits[0].gameObject);
|
|
}
|
|
|
|
// Token: 0x040016AF RID: 5807
|
|
public Item kit;
|
|
|
|
// Token: 0x040016B0 RID: 5808
|
|
public Slider slider;
|
|
|
|
// Token: 0x040016B1 RID: 5809
|
|
public GameObject render;
|
|
|
|
// Token: 0x040016B2 RID: 5810
|
|
public GameObject dartsBag;
|
|
|
|
// Token: 0x040016B3 RID: 5811
|
|
public GameObject elixirsBag;
|
|
|
|
// Token: 0x040016B4 RID: 5812
|
|
public GameObject arrowsBag;
|
|
|
|
// Token: 0x040016B5 RID: 5813
|
|
public GameObject dartsHitBoxes;
|
|
|
|
// Token: 0x040016B6 RID: 5814
|
|
public GameObject elixirsHitBoxes;
|
|
|
|
// Token: 0x040016B7 RID: 5815
|
|
public GameObject arrowsHitBoxes;
|
|
|
|
// Token: 0x040016B8 RID: 5816
|
|
public TextMeshProUGUI max;
|
|
|
|
// Token: 0x040016B9 RID: 5817
|
|
public TextMeshProUGUI min;
|
|
|
|
// Token: 0x040016BA RID: 5818
|
|
public TextMeshProUGUI btnText;
|
|
|
|
// Token: 0x040016BB RID: 5819
|
|
public TextMeshProUGUI ktiText;
|
|
|
|
// Token: 0x040016BC RID: 5820
|
|
public TextMeshProUGUI labelIngredient;
|
|
|
|
// Token: 0x040016BD RID: 5821
|
|
public TextMeshProUGUI labelType;
|
|
|
|
// Token: 0x040016BE RID: 5822
|
|
public bool open;
|
|
|
|
// Token: 0x040016BF RID: 5823
|
|
public int selectedType;
|
|
|
|
// Token: 0x040016C0 RID: 5824
|
|
public int selectedArrowhead;
|
|
|
|
// Token: 0x040016C1 RID: 5825
|
|
public int selectedIngredient;
|
|
|
|
// Token: 0x040016C2 RID: 5826
|
|
public Sprite[] normalSprites = new Sprite[0];
|
|
|
|
// Token: 0x040016C3 RID: 5827
|
|
public Sprite[] selectedSprites = new Sprite[0];
|
|
|
|
// Token: 0x040016C4 RID: 5828
|
|
public Image[] selectedBackgrounds = new Image[0];
|
|
|
|
// Token: 0x040016C5 RID: 5829
|
|
public Image[] borders = new Image[0];
|
|
|
|
// Token: 0x040016C6 RID: 5830
|
|
public Image[] buttons = new Image[0];
|
|
|
|
// Token: 0x040016C7 RID: 5831
|
|
public Button[] btns = new Button[0];
|
|
|
|
// Token: 0x040016C8 RID: 5832
|
|
public string[] itemNames = new string[0];
|
|
|
|
// Token: 0x040016C9 RID: 5833
|
|
private int[] itemIDs = new int[0];
|
|
|
|
// Token: 0x040016CA RID: 5834
|
|
public TextMeshProUGUI[] stacks = new TextMeshProUGUI[0];
|
|
|
|
// Token: 0x040016CB RID: 5835
|
|
public List<GameObject> renderObjects = new List<GameObject>();
|
|
|
|
// Token: 0x040016CC RID: 5836
|
|
private StringFast str = new StringFast(64);
|
|
|
|
// Token: 0x040016CD RID: 5837
|
|
private int currentMax;
|
|
|
|
// Token: 0x040016CE RID: 5838
|
|
public ButtonMultiTargets btn;
|
|
|
|
// Token: 0x040016CF RID: 5839
|
|
private bool setList;
|
|
|
|
// Token: 0x040016D0 RID: 5840
|
|
public Color highlighted;
|
|
|
|
// Token: 0x040016D1 RID: 5841
|
|
public Color normal;
|
|
|
|
// Token: 0x040016D2 RID: 5842
|
|
public bool crafting;
|
|
|
|
// Token: 0x040016D3 RID: 5843
|
|
public Character character;
|
|
|
|
// Token: 0x040016D4 RID: 5844
|
|
public GameObject prefab;
|
|
|
|
// Token: 0x040016D5 RID: 5845
|
|
public Transform arrowHeadParent;
|
|
|
|
// Token: 0x040016D6 RID: 5846
|
|
private List<Item> bagItems;
|
|
|
|
// Token: 0x040016D7 RID: 5847
|
|
private float lastSliderTime;
|
|
|
|
// Token: 0x040016D8 RID: 5848
|
|
private float stoneIngredientCost = 3f;
|
|
}
|