private void Refresh_View() { List <string> ExpandedNodes = new List <string>(); List <int> ExpandedSubNodes = new List <int>(); var AllNodes = TV_PowerView.Nodes.OfType <TreeNode>().ToList(); var AllSubNodes = TV_PowerView.Nodes.OfType <TreeNode>().FirstOrDefault(x => x.Text == "ActivePowers").Nodes.OfType <TreeNode>().ToList(); foreach (var node in AllSubNodes) { int PowerSNO = int.Parse(node.Text.Split(' ')[1]); if (node.IsExpanded) { ExpandedSubNodes.Add(PowerSNO); } } foreach (var node in AllNodes) { if (node.IsExpanded) { ExpandedNodes.Add(node.Text); } } Update_PowerView(); foreach (var index in ExpandedSubNodes) { var node = TV_PowerView.Nodes.OfType <TreeNode>().FirstOrDefault(x => x.Text == "ActivePowers").Nodes.OfType <TreeNode>().FirstOrDefault(x => x.Text.Contains(index.ToString())); if (node != null) { TV_PowerView.Invoke((MethodInvoker)(() => node.Expand())); } } foreach (var index in ExpandedNodes) { var node = TV_PowerView.Nodes.OfType <TreeNode>().FirstOrDefault(x => x.Text == index); if (node != null) { TV_PowerView.Invoke((MethodInvoker)(() => node.Expand())); } } }
private void BTN_PowerView_ExpandAll_Click(object sender, EventArgs e) { if (!AllExpanded) { TV_PowerView.Invoke((MethodInvoker)(() => TV_PowerView.ExpandAll())); AllExpanded = true; } else { TV_PowerView.Invoke((MethodInvoker)(() => TV_PowerView.CollapseAll())); AllExpanded = false; } }
private void Update_PowerView() { Dictionary <ActorCommonData, List <Monster_ActivePower> > MonstersPlayersInRangePowers = new Dictionary <ActorCommonData, List <Monster_ActivePower> >(); List <ACD> InRange; lock (A_Collection.Environment.Actors.AllActors) InRange = A_Collection.Environment.Actors.AllActors.Where(x => x.Distance <= 100).ToList(); foreach (var acd in InRange) { if ((acd.IsMonster || acd._ACD.x184_ActorType == ActorType.Player) && acd._ACD.x000_Id != A_Collection.Me.HeroGlobals.LocalACD.x000_Id) { List <Monster_ActivePower> ActivePowers = A_Tools.T_ACD.get_MonsterActivePowers(acd._ACD); MonstersPlayersInRangePowers.Add(acd._ACD, ActivePowers); } } List <ActivePower> AllPowers; lock (A_Collection.Me.HeroDetails.ActivePowers) AllPowers = A_Collection.Me.HeroDetails.ActivePowers.Where(x => A_Tools.T_LocalPlayer.PowerCollection.isBuffCount(x.AttribId) || A_Tools.T_LocalPlayer.PowerCollection.isBuffStartTick(x.AttribId) || A_Tools.T_LocalPlayer.PowerCollection.isBuffEndTick(x.AttribId) || A_Tools.T_LocalPlayer.PowerCollection.isSkillOverride(x.AttribId)).ToList(); Dictionary <int, int> AllSkills; lock (A_Collection.Me.HeroDetails.ActiveSkills) AllSkills = A_Collection.Me.HeroDetails.ActiveSkills.ToDictionary(x => x.Key, y => y.Value); //-- adds Potion to EquippedSkills AllSkills.Add(30211, 0); // TV_PowerView.Invoke((MethodInvoker)(() => TV_PowerView.BeginUpdate())); TV_PowerView.Invoke((MethodInvoker)(() => TV_PowerView.Nodes.Clear())); TV_PowerView.Invoke((MethodInvoker)(() => TV_PowerView.Nodes.Add("ActivePowers"))); TV_PowerView.Invoke((MethodInvoker)(() => TV_PowerView.Nodes.Add("EquippedSkills"))); TV_PowerView.Invoke((MethodInvoker)(() => TV_PowerView.Nodes.Add("MonstersAndPlayersInRange"))); //-- add Active Powers foreach (var power in AllPowers) { if (TV_PowerView.Nodes.OfType <TreeNode>().FirstOrDefault(x => x.Text == "ActivePowers").Nodes.OfType <TreeNode>().FirstOrDefault(x => x.Text.Contains(power.PowerSnoId.ToString())) == null) { string powertext = getPowerName(power.PowerSnoId); TreeNode newNode = new TreeNode(); newNode.Text = "PowerSNO: " + power.PowerSnoId.ToString() + " " + powertext; if (Buffer.FirstOrDefault(x => x.PowerSnoId == power.PowerSnoId) == null || Buffer.FirstOrDefault(x => x.PowerSnoId == power.PowerSnoId && x.AttribId == power.AttribId) == null || Buffer.FirstOrDefault(x => x.PowerSnoId == power.PowerSnoId && x.AttribId == power.AttribId && x.Value == power.Value) == null) { newNode.ForeColor = Color.Green; } TV_PowerView.Invoke((MethodInvoker)(() => TV_PowerView.Nodes.OfType <TreeNode>().FirstOrDefault(x => x.Text == "ActivePowers").Nodes.Add(newNode))); } TreeNode newSubNode = new TreeNode(); string powervalue = "Value"; if (A_Tools.T_LocalPlayer.PowerCollection.isSkillOverride(power.AttribId)) { powervalue = "SkillOverride"; } else if (A_Tools.T_LocalPlayer.PowerCollection.isBuffCount(power.AttribId)) { powervalue = "BuffCount"; } else if (A_Tools.T_LocalPlayer.PowerCollection.isBuffStartTick(power.AttribId)) { powervalue = "BuffStartTick"; } else if (A_Tools.T_LocalPlayer.PowerCollection.isBuffEndTick(power.AttribId)) { powervalue = "BuffEndTick"; } newSubNode.Text = "AttribID: " + power.AttribId.ToString() + " || " + powervalue + ": " + power.Value.ToString(); if (Buffer.FirstOrDefault(x => x.PowerSnoId == power.PowerSnoId && x.AttribId == power.AttribId) == null || Buffer.FirstOrDefault( x => x.PowerSnoId == power.PowerSnoId && x.AttribId == power.AttribId && x.Value == power.Value) == null) { newSubNode.ForeColor = Color.Green; TV_PowerView.Invoke((MethodInvoker)(() => TV_PowerView.Nodes.OfType <TreeNode>().FirstOrDefault(x => x.Text == "ActivePowers").Nodes.OfType <TreeNode>().FirstOrDefault(x => x.Text.Contains(power.PowerSnoId.ToString())).ForeColor = Color.Green)); } TV_PowerView.Invoke((MethodInvoker)(() => TV_PowerView.Nodes.OfType <TreeNode>().FirstOrDefault(x => x.Text == "ActivePowers").Nodes.OfType <TreeNode>().FirstOrDefault(x => x.Text.Contains(power.PowerSnoId.ToString())).Nodes.Add(newSubNode))); } // //-- add Equipped Skill foreach (var power in AllSkills) { if (TV_PowerView.Nodes.OfType <TreeNode>().FirstOrDefault(x => x.Text == "EquippedSkills").Nodes.OfType <TreeNode>().FirstOrDefault(x => x.Text.Contains(power.Key.ToString())) == null) { string powertext = A_Collection.Presets.SNOPowers.AllPowers.FirstOrDefault(x => x.Key == power.Key).Value; TreeNode newNode = new TreeNode(); newNode.Text = "PowerSNO: " + power.Key.ToString() + " " + powertext; TV_PowerView.Invoke((MethodInvoker)(() => TV_PowerView.Nodes.OfType <TreeNode>().FirstOrDefault(x => x.Text == "EquippedSkills").Nodes.Add(newNode))); } } // //-- add SelectedMonster Active Powers foreach (var monster in MonstersPlayersInRangePowers) { TreeNode MonsterNode = new TreeNode(); MonsterNode.Text = monster.Key.x004_Name; TV_PowerView.Invoke((MethodInvoker)(() => TV_PowerView.Nodes.OfType <TreeNode>().FirstOrDefault(x => x.Text == "MonstersAndPlayersInRange").Nodes.Add(MonsterNode))); foreach (var power in monster.Value) { if ( MonsterNode.Nodes.OfType <TreeNode>() .FirstOrDefault(x => x.Text.Contains(power.Modifier.ToString())) == null) { string powertext = getPowerName(power.Modifier); TreeNode PowerNode = new TreeNode(); PowerNode.Text = "PowerSNO: " + power.Modifier.ToString() + " " + powertext; MonsterNode.Nodes.Add(PowerNode); } TreeNode AttribNode = new TreeNode(); string powervalue = "Value"; if (A_Tools.T_LocalPlayer.PowerCollection.isSkillOverride(power.AttribID)) { powervalue = "SkillOverride"; } else if (A_Tools.T_LocalPlayer.PowerCollection.isBuffCount(power.AttribID)) { powervalue = "BuffCount"; } else if (A_Tools.T_LocalPlayer.PowerCollection.isBuffStartTick(power.AttribID)) { powervalue = "BuffStartTick"; } else if (A_Tools.T_LocalPlayer.PowerCollection.isBuffEndTick(power.AttribID)) { powervalue = "BuffEndTick"; } AttribNode.Text = "AttribID: " + power.AttribID.ToString() + " || " + powervalue + ": " + power.Value.ToString(); MonsterNode.Nodes.OfType <TreeNode>() .FirstOrDefault(x => x.Text.Contains(power.Modifier.ToString())) .Nodes.Add(AttribNode); } } // TV_PowerView.Invoke((MethodInvoker)(() => TV_PowerView.EndUpdate())); Buffer = AllPowers; }