/// <summary> /// Calculates the total of unallocated target attributes inside jewel area. /// </summary> /// <param name="TargetNode">The target node.</param> /// <param name="AttributeName">Name of Attribute to search for</param> /// <param name="SkilledNodes">The skilled nodes.</param> /// <param name="JewelRadiusType">Jewel Radius Type(Large/Medium/Small)(Default:Large"")</param> /// <returns></returns> static public float CalculateTotalUnallocAttributeInJewelArea(PassiveNodeViewModel TargetNode, string AttributeName, Dictionary <ushort, PassiveNodeViewModel> SkilledNodes, Engine.GameModel.Items.JewelRadius JewelArea = Engine.GameModel.Items.JewelRadius.Large) { float AttributeTotal = 0.0f; IEnumerable <PassiveNodeViewModel>?affectedNodes; var radius = Engine.GameModel.Items.JewelRadiusExtensions.GetRadius(JewelArea, TargetNode.ZoomLevel); affectedNodes = SkilledNodes.Values .Where(n => !n.IsRootNode && !n.IsAscendancyNode) .Where(n => Distance(n.Position, TargetNode.Position) <= radius * 1.2f); foreach (var n in affectedNodes) { if (n.Attributes.ContainsKey(AttributeName) && !SkilledNodes.ContainsValue(n)) { AttributeTotal += n.Attributes[AttributeName][0]; } } return(AttributeTotal); }
/// <summary> /// Generate JewelDictionary Categories from Data from SkillTree and add extra fake attributes to label threshold type and Node id for identifying node in inventory view /// </summary> public void CategorizeJewelSlots() { bool IsStrThreshold; bool IsIntThreshold; bool IsDexThreshold; string StrThresholdLabel = "+# Str JewelSlot"; string IntThresholdLabel = "+# Int JewelSlot"; string DexThresholdLabel = "+# Dex JewelSlot"; string AttributeName = ""; float AttributeTotal; List <float> SingleVal = new List <float>(1); SingleVal.Add(1); IEnumerable <PassiveNodeViewModel>?affectedNodes; //Copying keys so can change elements during foreach loop List <ushort> ElementList = new List <ushort>(GlobalSettings.JewelInfo.Keys); foreach (ushort NodeId in ElementList) { //IDLabel = "Jewel Socket ID: " + NodeId; IsStrThreshold = false; IsIntThreshold = false; IsDexThreshold = false; var regexAttrib = new Regex("[0-9]*\\.?[0-9]+"); for (int AttrIndex = 0; AttrIndex < 3; ++AttrIndex) { AttributeTotal = 0.0f; switch (AttrIndex) { case 1: AttributeName = "+# to Intelligence"; break; case 2: AttributeName = "+# to Dexterity"; break; default: AttributeName = "+# to Strength"; break; } //New Area scan code based on JewelRadiusDrawer.cs::DrawNodeHighlights Engine.GameModel.Items.JewelRadius mediumJewelArea = Engine.GameModel.Items.JewelRadius.Medium; var radius = Engine.GameModel.Items.JewelRadiusExtensions.GetRadius(mediumJewelArea, SkillTree.Skillnodes[NodeId].ZoomLevel); affectedNodes = SkillTree.Skillnodes.Values .Where(n => !n.IsRootNode && !n.IsAscendancyNode) .Where(n => Distance(n.Position, SkillTree.Skillnodes[NodeId].Position) <= radius * 1.2f); foreach (var n in affectedNodes) { if (n.Attributes != null && n.Attributes.ContainsKey(AttributeName)) { AttributeTotal += n.Attributes[AttributeName][0]; } } if (AttributeTotal >= 40.0f) { switch (AttrIndex) { case 1: IsIntThreshold = true; break; case 2: IsDexThreshold = true; break; default: IsStrThreshold = true; break; } } } if (IsDexThreshold && IsStrThreshold && IsIntThreshold) { if (!SkillTree.Skillnodes[NodeId].Attributes.ContainsKey(StrThresholdLabel)) { SkillTree.Skillnodes[NodeId].Attributes.Add(StrThresholdLabel, SingleVal); } if (!SkillTree.Skillnodes[NodeId].Attributes.ContainsKey(IntThresholdLabel)) { SkillTree.Skillnodes[NodeId].Attributes.Add(IntThresholdLabel, SingleVal); } if (!SkillTree.Skillnodes[NodeId].Attributes.ContainsKey(DexThresholdLabel)) { SkillTree.Skillnodes[NodeId].Attributes.Add(DexThresholdLabel, SingleVal); } SetThresholdType(NodeId, ThresholdTypes.OmniType); } else if (IsStrThreshold) { if (!SkillTree.Skillnodes[NodeId].Attributes.ContainsKey(StrThresholdLabel)) { SkillTree.Skillnodes[NodeId].Attributes.Add(StrThresholdLabel, SingleVal); } if (IsIntThreshold) { if (!SkillTree.Skillnodes[NodeId].Attributes.ContainsKey(IntThresholdLabel)) { SkillTree.Skillnodes[NodeId].Attributes.Add(IntThresholdLabel, SingleVal); } SetThresholdType(NodeId, ThresholdTypes.StrIntHybrid); } else if (IsDexThreshold) { if (!SkillTree.Skillnodes[NodeId].Attributes.ContainsKey(DexThresholdLabel)) { SkillTree.Skillnodes[NodeId].Attributes.Add(DexThresholdLabel, SingleVal); } SetThresholdType(NodeId, ThresholdTypes.StrDexHybrid); } else { SetThresholdType(NodeId, ThresholdTypes.Strength); } } else if (IsIntThreshold) { if (!SkillTree.Skillnodes[NodeId].Attributes.ContainsKey(IntThresholdLabel)) { SkillTree.Skillnodes[NodeId].Attributes.Add(IntThresholdLabel, SingleVal); } if (IsDexThreshold) { if (!SkillTree.Skillnodes[NodeId].Attributes.ContainsKey(DexThresholdLabel)) { SkillTree.Skillnodes[NodeId].Attributes.Add(DexThresholdLabel, SingleVal); } SetThresholdType(NodeId, ThresholdTypes.IntDexHybrid); } else { SetThresholdType(NodeId, ThresholdTypes.Intelligence); } } else if (IsDexThreshold) { if (!SkillTree.Skillnodes[NodeId].Attributes.ContainsKey(DexThresholdLabel)) { SkillTree.Skillnodes[NodeId].Attributes.Add(DexThresholdLabel, SingleVal); } SetThresholdType(NodeId, ThresholdTypes.Dexterity); } else//Neutral(often ineffective corner jewels)//Normally Cluster Jewel Sockets { //NeutralJewelSlots.Add(NodeId); } SkillTree.Skillnodes[NodeId].UpdateStatDescription(); //this[NodeId].GenerateSlotDesc(NodeId);//Not needed at moment } #if DEBUG Console.WriteLine("Number of Large+Normal JewelSlots found:" + NumberOfJewelsFound); #endif }