public static string ConvertToString(ItemSkillTree skilltree) { string save = ""; for (int i = 0; i < skilltree.GetSize; i++) { if (i > 0) { save += ";"; } save += ItemNodeAtlas.GetID(skilltree.GetNode(i).GetType().Name) + "|"; for (int j = 0; j < skilltree.GetNode(i).GetNeighboor.Count; j++) { save += skilltree.GetNode(i).GetNeighboor[j]; if (j < skilltree.GetNode(i).GetNeighboor.Count - 1) { save += ':'; } } save += "|" + skilltree.GetNode(i).GetState + "|" + skilltree.GetNode(i).GetLevel + "|" + skilltree.GetNode(i).GetMaxLevel + "|" + skilltree.GetNode(i).GetRequiredPoints + "|" + skilltree.GetNode(i).GetPos.X + ":" + skilltree.GetNode(i).GetPos.Y + "|"; save += skilltree.GetNode(i).GetSaveValue(); } return(save); }
//;ID,Neighboor1:2,state,level,maxlevel,required,posx:posy,specificvalue1:2:3:5:7; virtual public void Init(ItemSkillTree IST, int ID, int maxlevel, int required, Vector2 pos) { m_ID_Neightboor = new List <int>(); m_SkillTreeParent = IST; m_ID = ID; m_Level = 0; m_LockState = MININT; m_MaxLevel = maxlevel; m_RequiredPoints = required; m_position = pos; }
public static ItemSkillTree ConvertToTree(string save, ItemUpdate source) { string[] nodeListSave; string[] nodeDetails; ItemSkillTree tree = new ItemSkillTree(); nodeListSave = save.Split(';'); tree.m_ItemSource = source; string[] a; ItemNode bufferNode; foreach (string nodeSave in nodeListSave) { bufferNode = null; nodeDetails = nodeSave.Split(','); if (nodeDetails.Length != 8) { AnotherRpgMod.Instance.Logger.Warn("Item tree corrupted, reseting tree"); tree = new ItemSkillTree(); tree.Init(source); return(tree); } bufferNode = (ItemNode)ItemNodeAtlas.GetCorrectNode(int.Parse(nodeDetails[0])); a = nodeDetails[6].Split(':'); bufferNode.Init(tree, tree.GetSize, int.Parse(nodeDetails[4]), int.Parse(nodeDetails[5]), new Vector2(int.Parse(a[0]), int.Parse(a[1]))); //Ignore it if there is no neighboor if (nodeDetails[1] != "") { a = nodeDetails[1].Split(':'); foreach (string neightboor in a) { bufferNode.AddNeightboor(int.Parse(neightboor)); } } bufferNode.ForceLockNode(int.Parse(nodeDetails[2])); bufferNode.SetLevel = int.Parse(nodeDetails[3]); if (nodeDetails[7] != "") { bufferNode.LoadValue(nodeDetails[7]); } tree.AddNode(bufferNode); } return(tree); }
public ItemNode() { m_ID_Neightboor = new List <int>(); m_SkillTreeParent = new ItemSkillTree(); }
public static ItemSkillTree ConvertToTree(string save, ItemUpdate source, int evoPoint, int AscPoint) { string[] nodeListSave; string[] nodeDetails; ItemSkillTree tree = new ItemSkillTree(); nodeListSave = save.Split(';'); tree.m_ItemSource = source; string[] a; ItemNode bufferNode; foreach (string nodeSave in nodeListSave) { bufferNode = null; nodeDetails = nodeSave.Split('|'); if (nodeDetails.Length != 8) { AnotherRpgMod.Instance.Logger.Error(source.ItemName); AnotherRpgMod.Instance.Logger.Error("Item tree corrupted, reseting tree"); AnotherRpgMod.Instance.Logger.Error(nodeSave); tree = new ItemSkillTree(); tree.MaxEvolutionPoints = evoPoint; tree.MaxAscendPoints = AscPoint; tree.Init(source); tree.Reset(true); tree.EvolutionPoints = tree.MaxEvolutionPoints; tree.AscendPoints = tree.MaxAscendPoints; if (tree.AscendPoints > 0) { tree.ExtendTree(Mathf.Clamp(Mathf.CeilInt(Mathf.Pow(source.baseCap / 3f, 0.95)), 5, 99) * tree.AscendPoints); } return(tree); } bufferNode = (ItemNode)ItemNodeAtlas.GetCorrectNode(int.Parse(nodeDetails[0])); a = nodeDetails[6].Split(':'); bufferNode.Init(tree, tree.GetSize, int.Parse(nodeDetails[4]), int.Parse(nodeDetails[5]), new Vector2(int.Parse(a[0]), int.Parse(a[1]))); //Ignore it if there is no neighboor if (nodeDetails[1] != "") { a = nodeDetails[1].Split(':'); foreach (string neightboor in a) { bufferNode.AddNeightboor(int.Parse(neightboor)); } } bufferNode.ForceLockNode(int.Parse(nodeDetails[2])); bufferNode.SetLevel = int.Parse(nodeDetails[3]); if (nodeDetails[7] != "") { bufferNode.LoadValue(nodeDetails[7]); } tree.AddNode(bufferNode); } return(tree); }