Esempio n. 1
0
        public float GetValue(D3Attribute attribute)
        {
            if (this.finalAttributes.ContainsKey(attribute))
            {
                return this.finalAttributes[attribute];
            }

            return 0.0f;
        }
Esempio n. 2
0
        public void AddValue(D3Attribute attribute, float value, float maxValue)
        {
            if (!this.attributes.ContainsKey(attribute))
            {
                this.attributes.Add(attribute, value);
                return;
            }

            this.attributes[attribute] += value;
            if (this.attributes[attribute] > maxValue)
            {
                this.attributes[attribute] = maxValue;
            }
        }
Esempio n. 3
0
        // -------------------------------------------------------------------
        // Private
        // -------------------------------------------------------------------
        private void MergeAttribute(D3Attribute attribute, float value)
        {
            switch (attribute)
            {
                // These replace instead of add
                case D3Attribute.AttackSpeed:
                    {
                        this.attributes[attribute] = value;
                        break;
                    }

                default:
                    {
                        this.attributes[attribute] += value;
                        break;
                    }
            }
        }
Esempio n. 4
0
        private void MultiplyFinalAttribute(D3Attribute attribute, float value)
        {
            if (!this.finalAttributes.ContainsKey(attribute))
            {
                return;
            }

            float current = this.finalAttributes[attribute];
            this.finalAttributes[attribute] += current * (value / 100);
        }
Esempio n. 5
0
        private bool AddPrimaryAttributeFinalValue(D3Attribute attribute, float value)
        {
            switch (attribute)
            {
                case D3Attribute.Str:
                case D3Attribute.GemStr:
                    {
                        if (this.currentClass.PrimaryAttribute == D3Attribute.Str)
                        {
                            this.AddFinalAttribute(D3Attribute.DmgIncreasePrimary, value);
                        }

                        this.AddFinalAttribute(D3Attribute.Armor, value);
                        return true;
                    }

                case D3Attribute.Dex:
                case D3Attribute.GemDex:
                    {
                        if (this.currentClass.PrimaryAttribute == D3Attribute.Dex)
                        {
                            this.AddFinalAttribute(D3Attribute.DmgIncreasePrimary, value);
                        }

                        this.AddFinalAttribute(D3Attribute.DodgeRate, value / 216.0f);
                        return true;
                    }

                case D3Attribute.Int:
                case D3Attribute.GemInt:
                    {
                        if (this.currentClass.PrimaryAttribute == D3Attribute.Int)
                        {
                            this.AddFinalAttribute(D3Attribute.DmgIncreasePrimary, value);
                        }

                        this.AddFinalResistAll(value / 10.0f);
                        return true;
                    }
            }

            return false;
        }
Esempio n. 6
0
        private void AddFinalAttribute(D3Attribute attribute, float value)
        {
            if (!this.finalAttributes.ContainsKey(attribute))
            {
                this.finalAttributes.Add(attribute, value);
                return;
            }

            this.finalAttributes[attribute] += value;
        }
Esempio n. 7
0
        public void SetValue(D3Attribute attribute, float value)
        {
            if (!this.attributes.ContainsKey(attribute))
            {
                this.attributes.Add(attribute, value);
            }

            this.attributes[attribute] = value;

            this.RecalculateAttributes();
        }
Esempio n. 8
0
 public int GetInt(D3Attribute attribute)
 {
     int result;
     try
     {
         uint objActor = Framework.GetACDByGuid(this.GUID);
         result = Framework.GetInt(objActor, (uint)attribute);
     }
     catch (Exception ex)
     {
         Framework.smethod_0("Error in D3Item.GetFloat: " + ex.Message);
         result = 0;
     }
     return result;
 }
Esempio n. 9
0
 public int GetInt(D3Attribute attribute)
 {
     int result;
     if (this.ObjectGuid == 0u || this.ObjectGuid == 4294967295u)
     {
         result = 0;
     }
     else
     {
         try
         {
             uint objActor = Framework.GetACDByGuid(this.ObjectGuid);
             result = Framework.GetInt(objActor, (uint)attribute);
         }
         catch (Exception)
         {
             result = -666;
         }
     }
     return result;
 }