Ejemplo n.º 1
0
        /// <summary>
        /// Converts the item attribute to a name in the localized language
        /// </summary>
        /// <param name="itemAttribute">Item attribure to be looked up.</param>
        /// <param name="addVariable">Flag for whether the variable is added to the text string.</param>
        /// <returns>Returns localized item attribute</returns>
        public string GetItemAttributeFriendlyText(string itemAttribute, bool addVariable = true)
        {
            ItemAttributesData data = ItemAttributeProvider.GetAttributeData(itemAttribute);

            if (data == null)
            {
                return(string.Concat("?", itemAttribute, "?"));
            }

            string attributeTextTag = ItemAttributeProvider.GetAttributeTextTag(data);

            if (string.IsNullOrEmpty(attributeTextTag))
            {
                return(string.Concat("?", itemAttribute, "?"));
            }

            string textFromTag = this.GetFriendlyName(attributeTextTag);

            if (string.IsNullOrEmpty(textFromTag))
            {
                textFromTag = string.Concat("ATTR<", itemAttribute, "> TAG<");
                textFromTag = string.Concat(textFromTag, attributeTextTag, ">");
            }

            if (addVariable && data.Variable.Length > 0)
            {
                textFromTag = string.Concat(textFromTag, " ", data.Variable);
            }

            return(textFromTag);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Calculates the order of the attribute based on type.
        /// </summary>
        /// <param name="variable">variable to be checked</param>
        /// <returns>order number of the variable</returns>
        private static int CalcOrder(Variable variable)
        {
            ItemAttributesData aa = ItemAttributeProvider.GetAttributeData(variable.Name);

            if (aa == null)
            {
                return(3000000);
            }

            return(CalcBaseOrder(aa.EffectType, aa.Suborder));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Calculates the order for an array of attributes
        /// </summary>
        /// <param name="attributes">List holding the attributes</param>
        /// <returns>value of the attribute</returns>
        private int CalcOrder(List <Variable> attributes)
        {
            // Get the first item to use as a reference.
            Variable           v  = attributes[0];
            ItemAttributesData aa = ItemAttributeProvider.GetAttributeData(v.Name);

            // put granted skills at the end
            if (v.Name.Equals("itemSkillName"))
            {
                return(4000000);
            }

            if (aa == null)
            {
                return(3000000);
            }

            // This is a good first estimate.
            int order = this.CalcBaseOrder(aa.EffectType, aa.Suborder);

            // now some special cases
            if (aa.FullAttribute.Equals("characterBaseAttackSpeedTag"))
            {
                // put it right after the base piercing stat
                ItemAttributesData piercing = ItemAttributeProvider.GetAttributeData("offensivePierceRatioMin");
                order = this.CalcBaseOrder(piercing.EffectType, piercing.Suborder) + 1;
            }
            else if (aa.FullAttribute.Equals("retaliationGlobalChance"))
            {
                // Put this guy at the beginning of the retaliation global group
                order = MakeGlobal(this.CalcBaseOrder(ItemAttributesEffectType.Retaliation, 0) - 1);
            }
            else if (aa.FullAttribute.Equals("offensiveGlobalChance"))
            {
                // put this guy at the beginning of the offensive global group
                order = MakeGlobal(this.CalcBaseOrder(ItemAttributesEffectType.Offense, 0) - 1);
            }
            else if (this.isArmor && aa.FullAttribute.Equals("offensivePhysicalMin"))
            {
                // put it right after the block recovery time stat
                ItemAttributesData blockRecovery = ItemAttributeProvider.GetAttributeData("blockRecoveryTime");
                order = this.CalcBaseOrder(blockRecovery.EffectType, blockRecovery.Suborder) + 1;
            }

            // Now see if the variable is global and move it to the global group if it is
            if (ItemAttributeProvider.AttributeGroupHas(new Collection <Variable>(attributes), "Global"))
            {
                order = MakeGlobal(order);
            }

            return(order);
        }