You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
469 lines
29 KiB
C#
469 lines
29 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using Gaia;
|
|
using SiegeSong;
|
|
|
|
namespace SiegeSong
|
|
{
|
|
public class ActorLoader : MonoBehaviour
|
|
{
|
|
public string Input;
|
|
public GameObject Species;
|
|
public GameObject Instance;
|
|
public InstanceManager InstanceManager;
|
|
public Transform StartLocation;
|
|
public GameObject PlayerTracker;
|
|
public bool IsPlayer;
|
|
public int ActorID;
|
|
|
|
|
|
void Start()
|
|
{
|
|
if (Input.Length > 0)
|
|
LoadActor2();
|
|
}
|
|
|
|
void Update()
|
|
{
|
|
|
|
}
|
|
|
|
public void LoadActor2(bool despawnOldInstance = false)
|
|
{
|
|
var stats = JsonUtility.FromJson<Statistics>(Input);
|
|
|
|
if (Instance != null && despawnOldInstance)
|
|
GameObject.Destroy(Instance);
|
|
|
|
Instance = GameObject.Instantiate(Species);
|
|
Instance.transform.position = StartLocation.position;
|
|
|
|
if (Instance.GetComponent<StatisticsManager>() == null)
|
|
Instance.AddComponent<StatisticsManager>();
|
|
|
|
var actor = Instance.GetComponent<StatisticsManager>();
|
|
|
|
if (actor.Stats == null)
|
|
actor.Stats = new Statistics();
|
|
|
|
actor.Stats.ID = ActorID;
|
|
actor.ActorLoader = this;
|
|
|
|
if (!Instance.active)
|
|
Instance.active = true;
|
|
|
|
if (stats.IsPlayer)
|
|
{
|
|
for (var j = 0; j < Instance.transform.childCount; j++)
|
|
{
|
|
if (Instance.transform.GetChild(j).name == "PlayerAgent")
|
|
{
|
|
Instance.transform.GetChild(j).gameObject.active = true;
|
|
|
|
PlayerTracker.transform.parent = Instance.transform;
|
|
}
|
|
}
|
|
}
|
|
|
|
actor.Stats = stats;
|
|
Instance.transform.eulerAngles = new Vector3(stats.RotationX, stats.RotationY, stats.RotationZ);
|
|
Instance.transform.position = new Vector3(stats.LocationX, stats.LocationY, stats.LocationZ);
|
|
|
|
for (var i = 0; i < stats.InventoryItemIDs.Count; i++)
|
|
{
|
|
actor.Inventory.SelectedItemID = stats.InventoryItemIDs[i];
|
|
actor.Inventory.SelectedAmount = stats.InventoryItemQuantities[i];
|
|
actor.Inventory.AddItem();
|
|
actor.Inventory.SelectedItemID = 0;
|
|
actor.Inventory.SelectedAmount = 0;
|
|
actor.Inventory.SelectedItemIndex = 0;
|
|
}
|
|
foreach (var itemId in stats.ActiveInventoryItemIDs)
|
|
{
|
|
if (actor.Inventory.GetItemByID(itemId).GetComponent<Equipable>() != null)
|
|
actor.Inventory.EquipmentManager.AddEquipmentToSlots(actor.Inventory.GetItemByID(itemId));
|
|
}
|
|
actor.Inventory.ApparrelManager.CurrentlyActiveIDs = stats.ActiveInventoryItemIDs.ToArray();
|
|
actor.Inventory.ApparrelManager.UpdateApparrel();
|
|
|
|
|
|
actor.Stats.InstanceID = InstanceManager.GenerateInstanceID();
|
|
Instance.gameObject.name = $"{actor.Stats.FirstName} {actor.Stats.LastName}";
|
|
InstanceManager.AddInstance(actor.Stats.InstanceID, Instance);
|
|
if (stats.IsPlayer)
|
|
{
|
|
//InstanceManager.CurrentPlayerInstanceID = actor.Stats.InstanceID;
|
|
//InstanceManager.RuntimeManager.PlayerInstance = Instance;
|
|
//InstanceManager.RuntimeManager.PopulateReferences();
|
|
}
|
|
}
|
|
|
|
public void SaveActor2()
|
|
{
|
|
var stats = Instance.GetComponentInChildren<StatisticsManager>().Stats;
|
|
for (var j = 0; j < Instance.transform.childCount; j++)
|
|
{
|
|
if (Instance.transform.GetChild(j).name == "PlayerAgent" && Instance.transform.GetChild(j).gameObject.active)
|
|
stats.IsPlayer = true;
|
|
}
|
|
|
|
var statsString = JsonUtility.ToJson(stats);
|
|
Input = statsString;
|
|
}
|
|
|
|
public void SaveActor()
|
|
{
|
|
var actorDataString = "A-";
|
|
|
|
|
|
var value = "";
|
|
|
|
if (Instance.GetComponentInChildren<StatisticsManager>().Stats.SkillValueCategories == null)
|
|
Instance.GetComponentInChildren<StatisticsManager>().Stats.SkillValueCategories = new Dictionary<int, Dictionary<int, int>>();
|
|
if (Instance.GetComponentInChildren<StatisticsManager>().Stats.RespectForActor == null)
|
|
Instance.GetComponentInChildren<StatisticsManager>().Stats.RespectForActor = new Dictionary<int, int>();
|
|
if (Instance.GetComponentInChildren<StatisticsManager>().Stats.AdmirationForActor == null)
|
|
Instance.GetComponentInChildren<StatisticsManager>().Stats.AdmirationForActor = new Dictionary<int, int>();
|
|
if (Instance.GetComponentInChildren<StatisticsManager>().Stats.SuspicionOfActor == null)
|
|
Instance.GetComponentInChildren<StatisticsManager>().Stats.SuspicionOfActor = new Dictionary<int, int>();
|
|
if (Instance.GetComponentInChildren<StatisticsManager>().Stats.FactionRank == null)
|
|
Instance.GetComponentInChildren<StatisticsManager>().Stats.FactionRank = new Dictionary<int, int>();
|
|
if (Instance.GetComponentInChildren<StatisticsManager>().Stats.RegionalBounty == null)
|
|
Instance.GetComponentInChildren<StatisticsManager>().Stats.RegionalBounty = new Dictionary<int, int>();
|
|
if (Instance.GetComponentInChildren<StatisticsManager>().Stats.RegionalFame == null)
|
|
Instance.GetComponentInChildren<StatisticsManager>().Stats.RegionalFame = new Dictionary<int, int>();
|
|
if (Instance.GetComponentInChildren<BlendshapeLoader>().Blendshapes == null)
|
|
Instance.GetComponentInChildren<BlendshapeLoader>().Blendshapes = new Dictionary<string, float>();
|
|
if (Instance.GetComponentInChildren<InventoryManager>().Inventory.Contents == null)
|
|
Instance.GetComponentInChildren<InventoryManager>().Inventory.Contents = new Dictionary<int, int>();
|
|
|
|
foreach (var skillCategory in Instance.GetComponentInChildren<StatisticsManager>().Stats.SkillValueCategories.Keys)
|
|
{
|
|
if (Instance.GetComponentInChildren<StatisticsManager>().Stats.SkillValueCategories[skillCategory] == null)
|
|
Instance.GetComponentInChildren<StatisticsManager>().Stats.SkillValueCategories[skillCategory] = new Dictionary<int, int>();
|
|
foreach (var skill in Instance.GetComponentInChildren<StatisticsManager>().Stats.SkillValueCategories[skillCategory])
|
|
{
|
|
actorDataString += $"sc{skillCategory.ToString("00")}_{skill.Key.ToString("00")}_{skill.Value.ToString("00")}/";
|
|
}
|
|
}
|
|
foreach (var id in Instance.GetComponentInChildren<StatisticsManager>().Stats.RespectForActor.Keys)
|
|
{
|
|
actorDataString += $"ra{id}_{Instance.GetComponentInChildren<StatisticsManager>().Stats.RespectForActor[id]}/";
|
|
value = Instance.GetComponentInChildren<StatisticsManager>().Stats.RespectForActor[id] != null ? Instance.GetComponentInChildren<StatisticsManager>().Stats.RespectForActor[id].ToString() : "0";
|
|
actorDataString += $"ra{id}_{value}/";
|
|
}
|
|
foreach (var id in Instance.GetComponentInChildren<StatisticsManager>().Stats.AdmirationForActor.Keys)
|
|
{
|
|
value = Instance.GetComponentInChildren<StatisticsManager>().Stats.AdmirationForActor[id] != null ? Instance.GetComponentInChildren<StatisticsManager>().Stats.AdmirationForActor[id].ToString() : "0";
|
|
actorDataString += $"aa{id}_{value}/";
|
|
}
|
|
foreach (var id in Instance.GetComponentInChildren<StatisticsManager>().Stats.SuspicionOfActor.Keys)
|
|
{
|
|
actorDataString += $"sa{id}_{Instance.GetComponentInChildren<StatisticsManager>().Stats.SuspicionOfActor[id]}/";
|
|
value = Instance.GetComponentInChildren<StatisticsManager>().Stats.SuspicionOfActor[id] != null ? Instance.GetComponentInChildren<StatisticsManager>().Stats.SuspicionOfActor[id].ToString() : "0";
|
|
actorDataString += $"sa{id}_{value}/";
|
|
}
|
|
foreach (var id in Instance.GetComponentInChildren<StatisticsManager>().Stats.FactionRank.Keys)
|
|
{
|
|
actorDataString += $"fr{id}_{Instance.GetComponentInChildren<StatisticsManager>().Stats.FactionRank[id]}/";
|
|
value = Instance.GetComponentInChildren<StatisticsManager>().Stats.FactionRank[id] != null ? Instance.GetComponentInChildren<StatisticsManager>().Stats.FactionRank[id].ToString() : "0";
|
|
actorDataString += $"fr{id}_{value}/";
|
|
}
|
|
foreach (var id in Instance.GetComponentInChildren<StatisticsManager>().Stats.RegionalBounty.Keys)
|
|
{
|
|
actorDataString += $"rb{id}_{Instance.GetComponentInChildren<StatisticsManager>().Stats.RegionalBounty[id]}/";
|
|
value = Instance.GetComponentInChildren<StatisticsManager>().Stats.RegionalBounty[id] != null ? Instance.GetComponentInChildren<StatisticsManager>().Stats.RegionalBounty[id].ToString() : "0";
|
|
actorDataString += $"rb{id}_{value}/";
|
|
}
|
|
foreach (var id in Instance.GetComponentInChildren<StatisticsManager>().Stats.RegionalFame.Keys)
|
|
{
|
|
actorDataString += $"rf{id}_{Instance.GetComponentInChildren<StatisticsManager>().Stats.RegionalFame[id]}/";
|
|
value = Instance.GetComponentInChildren<StatisticsManager>().Stats.RegionalFame[id] != null ? Instance.GetComponentInChildren<StatisticsManager>().Stats.RegionalFame[id].ToString() : "0";
|
|
actorDataString += $"rf{id}_{value}/";
|
|
}
|
|
foreach (var blendshape in Instance.GetComponentInChildren<BlendshapeLoader>().Blendshapes.Keys)
|
|
{
|
|
actorDataString += $"bs{blendshape}_{Instance.GetComponentInChildren<BlendshapeLoader>().Blendshapes[blendshape]}/";
|
|
value = Instance.GetComponentInChildren<BlendshapeLoader>().Blendshapes[blendshape] != null ? Instance.GetComponentInChildren<BlendshapeLoader>().Blendshapes[blendshape].ToString() : "0";
|
|
actorDataString += $"bs{blendshape}_{value}/";
|
|
}
|
|
actorDataString += $"pl{IsPlayer}/";
|
|
actorDataString += $"lx{Instance.transform.position.x.ToString("00000")}/";
|
|
actorDataString += $"ly{Instance.transform.position.y.ToString("00000")}/";
|
|
actorDataString += $"lz{Instance.transform.position.z.ToString("00000")}/";
|
|
actorDataString += $"hs{Instance.GetComponentInChildren<BlendshapeLoader>().HairstyleID.ToString("00")}/";
|
|
actorDataString += $"fh{Instance.GetComponentInChildren<BlendshapeLoader>().FacialHairID.ToString("00")}/";
|
|
actorDataString += $"fd{Instance.GetComponentInChildren<BlendshapeLoader>().FacialDetailID.ToString("00")}/";
|
|
actorDataString += $"hr{Instance.GetComponentInChildren<BlendshapeLoader>().HairColorR.ToString("000")}/";
|
|
actorDataString += $"hg{Instance.GetComponentInChildren<BlendshapeLoader>().HairColorG.ToString("000")}/";
|
|
actorDataString += $"hb{Instance.GetComponentInChildren<BlendshapeLoader>().HairColorB.ToString("000")}/";
|
|
actorDataString += $"ha{Instance.GetComponentInChildren<BlendshapeLoader>().HairColorA.ToString("000")}/";
|
|
actorDataString += $"mm{Instance.GetComponentInChildren<StatisticsManager>().Stats.MaxMagic}/";
|
|
actorDataString += $"ms{Instance.GetComponentInChildren<StatisticsManager>().Stats.MaxStamina}/";
|
|
actorDataString += $"mh{Instance.GetComponentInChildren<StatisticsManager>().Stats.MaxHealth}/";
|
|
|
|
foreach (var item in Instance.GetComponentInChildren<StatisticsManager>().Inventory.Inventory.Contents)
|
|
{
|
|
if (item.Key != 0)
|
|
{
|
|
actorDataString += $"iid{item.Key.ToString("00")}";
|
|
//actorDataString += $"-ius{Instance.GetComponentInChildren<StatisticsManager>().Inventory.GetItemByID(item.Key).GetComponent<InventoryItem>().Using}";
|
|
actorDataString += $"-icn{Instance.GetComponentInChildren<StatisticsManager>().Inventory.GetItemByID(item.Key).GetComponent<InventoryItem>().PhysicalCondition.ToString("00")}";
|
|
actorDataString += $"-/";
|
|
}
|
|
}
|
|
Input = actorDataString;
|
|
}
|
|
|
|
public void LoadActor(bool despawnOldInstance = false)
|
|
{
|
|
if (IsPlayer)
|
|
{
|
|
PlayerTracker.transform.parent = null;
|
|
}
|
|
|
|
if (Instance != null && despawnOldInstance)
|
|
GameObject.Destroy(Instance);
|
|
|
|
Instance = GameObject.Instantiate(Species);
|
|
Instance.transform.position = StartLocation.position;
|
|
|
|
if (Instance.GetComponent<StatisticsManager>().Stats == null)
|
|
Instance.GetComponent<StatisticsManager>().Stats = new Statistics();
|
|
|
|
Instance.GetComponent<StatisticsManager>().Stats.ID = ActorID;
|
|
Instance.GetComponent<StatisticsManager>().ActorLoader = this;
|
|
|
|
if (!Instance.active)
|
|
Instance.active = true;
|
|
|
|
if (IsPlayer)
|
|
{
|
|
PlayerTracker.transform.parent = Instance.transform;
|
|
}
|
|
|
|
var parsedText = "";
|
|
var parseStartIndex = 2;
|
|
var id = -1;
|
|
var key = "";
|
|
var subId = 0;
|
|
var valueStartIndex = -1;
|
|
var integerValue = 0;
|
|
var floatValue = 0.0f;
|
|
var itemId = -1;
|
|
|
|
for (var i = parseStartIndex; i < Input.Length; i++)
|
|
{
|
|
if (Input[i] == '/')
|
|
{
|
|
parsedText = Input.Substring(parseStartIndex, i - parseStartIndex);
|
|
parseStartIndex = i + 1;
|
|
if (parsedText.Length > 2)
|
|
{
|
|
var parsedTextPrefix = parsedText.Substring(0, 2);
|
|
|
|
switch (parsedTextPrefix)
|
|
{
|
|
case "sc":
|
|
id = int.Parse(parsedText.Substring(2, 2));
|
|
subId = int.Parse(parsedText.Substring(5, 2));
|
|
integerValue = int.Parse(parsedText.Substring(8, 2));
|
|
|
|
if (Instance.GetComponent<StatisticsManager>().Stats.SkillValueCategories == null)
|
|
Instance.GetComponent<StatisticsManager>().Stats.SkillValueCategories = new Dictionary<int, Dictionary<int, int>>();
|
|
if (!Instance.GetComponent<StatisticsManager>().Stats.SkillValueCategories.ContainsKey(id))
|
|
Instance.GetComponent<StatisticsManager>().Stats.SkillValueCategories[id] = new Dictionary<int, int>();
|
|
if (!Instance.GetComponent<StatisticsManager>().Stats.SkillValueCategories[id].ContainsKey(subId))
|
|
Instance.GetComponent<StatisticsManager>().Stats.SkillValueCategories[id].Add(subId, integerValue);
|
|
else
|
|
Instance.GetComponent<StatisticsManager>().Stats.SkillValueCategories[id][subId] = integerValue;
|
|
break;
|
|
case "ra":
|
|
valueStartIndex = parsedText.Substring(3, 2).IndexOf('_');
|
|
id = int.Parse(parsedText.Substring(2, valueStartIndex));
|
|
integerValue = int.Parse(parsedText.Substring(valueStartIndex));
|
|
Instance.GetComponent<StatisticsManager>().Stats.RespectForActor[id] = integerValue;
|
|
break;
|
|
case "aa":
|
|
valueStartIndex = parsedText.Substring(2, 2).IndexOf('_');
|
|
id = int.Parse(parsedText.Substring(2, valueStartIndex));
|
|
integerValue = int.Parse(parsedText.Substring(valueStartIndex));
|
|
Instance.GetComponent<StatisticsManager>().Stats.AdmirationForActor[id] = integerValue;
|
|
break;
|
|
case "sa":
|
|
valueStartIndex = parsedText.Substring(2, 2).IndexOf('_');
|
|
id = int.Parse(parsedText.Substring(2, valueStartIndex));
|
|
integerValue = int.Parse(parsedText.Substring(valueStartIndex));
|
|
Instance.GetComponent<StatisticsManager>().Stats.SuspicionOfActor[id] = integerValue;
|
|
break;
|
|
case "fr":
|
|
valueStartIndex = parsedText.Substring(2, 2).IndexOf('_');
|
|
id = int.Parse(parsedText.Substring(2, valueStartIndex));
|
|
integerValue = int.Parse(parsedText.Substring(valueStartIndex));
|
|
Instance.GetComponent<StatisticsManager>().Stats.FactionRank[id] = integerValue;
|
|
break;
|
|
case "rb":
|
|
valueStartIndex = parsedText.Substring(2, 2).IndexOf('_');
|
|
id = int.Parse(parsedText.Substring(2, valueStartIndex));
|
|
integerValue = int.Parse(parsedText.Substring(valueStartIndex));
|
|
Instance.GetComponent<StatisticsManager>().Stats.RegionalBounty[id] = integerValue;
|
|
break;
|
|
case "rf":
|
|
valueStartIndex = parsedText.Substring(2, 2).IndexOf('_');
|
|
id = int.Parse(parsedText.Substring(2, valueStartIndex));
|
|
integerValue = int.Parse(parsedText.Substring(valueStartIndex));
|
|
Instance.GetComponent<StatisticsManager>().Stats.RegionalFame[id] = integerValue;
|
|
break;
|
|
case "bs":
|
|
valueStartIndex = parsedText.Substring(2, 2).IndexOf('_');
|
|
key = parsedText.Substring(2, valueStartIndex);
|
|
integerValue = int.Parse(parsedText.Substring(valueStartIndex));
|
|
Instance.GetComponent<BlendshapeLoader>().Blendshapes[key] = floatValue;
|
|
break;
|
|
case "pl":
|
|
IsPlayer = parsedText.Substring(2, 4) == "True";
|
|
for (var j = 0; j < Instance.transform.childCount; j++)
|
|
{
|
|
if (Instance.transform.GetChild(j).name == "PlayerAgent")
|
|
Instance.transform.GetChild(j).gameObject.active = IsPlayer;
|
|
}
|
|
break;
|
|
case "hs":
|
|
id = int.Parse(parsedText.Substring(2, 2));
|
|
Instance.GetComponent<BlendshapeLoader>().HairstyleID = id;
|
|
break;
|
|
case "fh":
|
|
id = int.Parse(parsedText.Substring(2, 2));
|
|
Instance.GetComponent<BlendshapeLoader>().FacialHairID = id;
|
|
break;
|
|
case "fd":
|
|
id = int.Parse(parsedText.Substring(2, 2));
|
|
Instance.GetComponent<BlendshapeLoader>().FacialDetailID = id;
|
|
break;
|
|
case "hr":
|
|
id = int.Parse(parsedText.Substring(2, 3));
|
|
Instance.GetComponent<BlendshapeLoader>().HairColorR = id;
|
|
break;
|
|
case "hg":
|
|
id = int.Parse(parsedText.Substring(2, 3));
|
|
Instance.GetComponent<BlendshapeLoader>().HairColorG = id;
|
|
break;
|
|
case "hb":
|
|
id = int.Parse(parsedText.Substring(2, 3));
|
|
Instance.GetComponent<BlendshapeLoader>().HairColorB = id;
|
|
break;
|
|
case "ha":
|
|
id = int.Parse(parsedText.Substring(2, 3));
|
|
Instance.GetComponent<BlendshapeLoader>().HairColorA = id;
|
|
break;
|
|
case "mm":
|
|
id = int.Parse(parsedText.Substring(2, 3));
|
|
Instance.GetComponent<StatisticsManager>().Stats.MaxMagic = id;
|
|
break;
|
|
case "nm":
|
|
Instance.GetComponent<StatisticsManager>().Stats.FirstName = parsedText.Substring(2).Contains("_") ? parsedText.Substring(2, parsedText.IndexOf("_") - 2) : parsedText.Substring(2);
|
|
if (parsedText.Substring(2).Contains("_"))
|
|
Instance.GetComponent<StatisticsManager>().Stats.LastName = parsedText.Substring(parsedText.IndexOf("_") + 1);
|
|
Instance.name = parsedText.Substring(2).Replace("_", " ");
|
|
break;
|
|
case "ms":
|
|
id = int.Parse(parsedText.Substring(2, 3));
|
|
Instance.GetComponent<StatisticsManager>().Stats.MaxStamina = id;
|
|
break;
|
|
case "mh":
|
|
id = int.Parse(parsedText.Substring(2, 3));
|
|
Instance.GetComponent<StatisticsManager>().Stats.MaxHealth = id;
|
|
break;
|
|
//case "lx":
|
|
// if (parsedText[2] == '-')
|
|
// integerValue = int.Parse(parsedText.Substring(2, 6));
|
|
// else
|
|
// integerValue = int.Parse(parsedText.Substring(2, 5));
|
|
// Instance.transform.position = new Vector3((float)integerValue, Instance.transform.position.y, Instance.transform.position.z);
|
|
// break;
|
|
//case "ly":
|
|
// if (parsedText[2] == '-')
|
|
// integerValue = int.Parse(parsedText.Substring(2, 6));
|
|
// else
|
|
// integerValue = int.Parse(parsedText.Substring(2, 5));
|
|
// Instance.transform.position = new Vector3(Instance.transform.position.x, (float)integerValue, Instance.transform.position.z);
|
|
// break;
|
|
//case "lz":
|
|
// if (parsedText[2] == '-')
|
|
// integerValue = int.Parse(parsedText.Substring(2, 6));
|
|
// else
|
|
// integerValue = int.Parse(parsedText.Substring(2, 5));
|
|
// Instance.transform.position = new Vector3(Instance.transform.position.x, Instance.transform.position.y, (float)integerValue);
|
|
break;
|
|
case "ii":
|
|
var parsedSubText = "";
|
|
var parseSubStartIndex = 0;
|
|
itemId = int.Parse(parsedText.Substring(3, 2));
|
|
|
|
for (var j = parseSubStartIndex; j < parsedText.Length - 2; j++)
|
|
{
|
|
if (parsedText[j] == '-')
|
|
{
|
|
parsedSubText = parsedText.Substring(parseSubStartIndex, j - parseSubStartIndex);
|
|
parseSubStartIndex = j + 1;
|
|
if (parsedSubText.Length > 2)
|
|
{
|
|
var parsedSubTextPrefix = parsedSubText.Substring(0, 3);
|
|
var subKey = "";
|
|
var subSubId = 0;
|
|
var subValueStartIndex = -1;
|
|
var subIntegerValue = 0;
|
|
var subFloatValue = 0.0f;
|
|
|
|
switch (parsedSubTextPrefix)
|
|
{
|
|
case "iid":
|
|
itemId = int.Parse(parsedText.Substring(3, 2));
|
|
Instance.GetComponent<StatisticsManager>().Inventory.SelectedItemID = itemId;
|
|
Instance.GetComponent<StatisticsManager>().Inventory.SelectedAmount = 1;
|
|
Instance.GetComponent<StatisticsManager>().Inventory.AddItem();
|
|
Instance.GetComponent<StatisticsManager>().Inventory.SelectedItemID = 0;
|
|
Instance.GetComponent<StatisticsManager>().Inventory.SelectedAmount = 0;
|
|
Instance.GetComponent<StatisticsManager>().Inventory.SelectedItemIndex = 0;
|
|
break;
|
|
case "icn":
|
|
Instance.GetComponent<StatisticsManager>().Inventory.GetItemByID(itemId).GetComponentInChildren<InventoryItem>().PhysicalCondition = integerValue;
|
|
integerValue = int.Parse(parsedSubText.Substring(3, 2));
|
|
break;
|
|
case "ius":
|
|
var boolValue = parsedSubText.Substring(3, 4) == "True";
|
|
//Instance.GetComponent<StatisticsManager>().Inventory.GetItemByID(itemId).GetComponentInChildren<InventoryItem>().Using = boolValue;
|
|
if (boolValue)
|
|
{
|
|
var newArray = new int[Instance.GetComponent<StatisticsManager>().Inventory.ApparrelManager.CurrentlyActiveIDs.Length + 1];
|
|
Instance.GetComponent<StatisticsManager>().Inventory.ApparrelManager.CurrentlyActiveIDs.CopyTo(newArray, 1);
|
|
newArray[0] = itemId;
|
|
Instance.GetComponent<StatisticsManager>().Inventory.ApparrelManager.CurrentlyActiveIDs = newArray;
|
|
Instance.GetComponent<StatisticsManager>().Inventory.ApparrelManager.UpdateApparrel();
|
|
if (Instance.GetComponent<StatisticsManager>().Inventory.GetItemByID(itemId).GetComponent<Equipable>() != null)
|
|
Instance.GetComponent<StatisticsManager>().Inventory.EquipmentManager.AddEquipmentToSlots(Instance.GetComponent<StatisticsManager>().Inventory.GetItemByID(itemId));
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
Instance.GetComponent<StatisticsManager>().Stats.InstanceID = InstanceManager.GenerateInstanceID();
|
|
InstanceManager.AddInstance(Instance.GetComponent<StatisticsManager>().Stats.InstanceID, Instance);
|
|
if (IsPlayer)
|
|
{
|
|
InstanceManager.CurrentPlayerInstanceID = Instance.GetComponent<StatisticsManager>().Stats.InstanceID;
|
|
//InstanceManager.RuntimeManager.PlayerInstance = Instance;
|
|
//InstanceManager.RuntimeManager.PopulateReferences();
|
|
}
|
|
}
|
|
}
|
|
}
|