Example #1
0
 private void ApplyActivateBonus(InventoryChangedEventArgs e)
 {
     for (var i = 0; i < _activateBoost.Length; i++)
     {
         // set boost
         var b = _activateBoost[i].GetBoost();
         _boost[i] += b;
     }
 }
        public void ReCalculateValues(InventoryChangedEventArgs e = null)
        {
            Base.ReCalculateValues(e);
            Boost.ReCalculateValues(e);

            for (var i = 0; i < _stats.Length; i++)
            {
                _stats[i].SetValue(this[i]);
            }
        }
Example #3
0
 public Item this[int index]
 {
     get { return(items[index]); }
     set
     {
         if (items[index] != value)
         {
             var e = new InventoryChangedEventArgs(index, items[index], value);
             items[index] = value;
             InventoryChanged?.Invoke(this, e);
         }
     }
 }
Example #4
0
        private void ApplyEquipBonus(InventoryChangedEventArgs e)
        {
            for (var i = 0; i < 4; i++)
            {
                if (_player.Inventory[i] == null)
                {
                    continue;
                }

                foreach (var b in _player.Inventory[i].StatsBoost)
                {
                    IncrementBoost((StatsType)b.Key, b.Value);
                }
            }
        }
Example #5
0
        private void SetWeaponDamage(InventoryChangedEventArgs e)
        {
            var min  = 0;
            var max  = 0;
            var weap = _parent.Owner.Inventory[0];

            if (weap != null && weap.Projectiles.Length > 0)
            {
                min = weap.Projectiles[0].MinDamage;
                max = weap.Projectiles[0].MaxDamage;
            }

            _base[12] = min;
            _base[13] = max;
        }
Example #6
0
        protected internal void ReCalculateValues(InventoryChangedEventArgs e = null)
        {
            for (var i = 0; i < _boost.Length; i++)
            {
                _boost[i] = 0;
            }

            ApplyEquipBonus(e);
            ApplyActivateBonus(e);

            for (var i = 0; i < _boost.Length; i++)
            {
                _boostSV[i].SetValue(_boost[i]);
            }
        }
Example #7
0
        private void ApplyActivateBonus(InventoryChangedEventArgs e)
        {
            for (var i = 0; i < _activateBoost.Length; i++)
            {
                // set boost
                var b = _activateBoost[i].GetBoost();
                _boost[i] += b;

                if (i > 7)
                {
                    continue;
                }

                // set condition icon
                var haveCondition = _player.HasConditionEffect((ConditionEffects)((ulong)1 << (i + 39)));
                if (b > 0)
                {
                    if (!haveCondition)
                    {
                        _player.ApplyConditionEffect(new ConditionEffect()
                        {
                            Effect     = (ConditionEffectIndex)(i + 39),
                            DurationMS = -1
                        });
                    }
                }
                else
                {
                    if (haveCondition)
                    {
                        _player.ApplyConditionEffect(new ConditionEffect()
                        {
                            Effect     = (ConditionEffectIndex)(i + 39),
                            DurationMS = 0
                        });
                    }
                }
            }
        }
Example #8
0
        private void ApplyEquipBonus(InventoryChangedEventArgs e)
        {
            for (var i = 0; i < 4; i++)
            {
                if (_player.Inventory[i] == null)
                {
                    continue;
                }

                foreach (var b in _player.Inventory[i].StatsBoost)
                {
                    IncrementBoost((StatsType)b.Key, b.Value);
                }

                foreach (var b in _player.Inventory[i].StatsBoostPerc)
                {
                    if (b.Value != 0)
                    {
                        var index = StatsManager.GetStatIndex((StatsType)b.Key);
                        IncrementBoost((StatsType)b.Key, (_parent.Base[index] + _boost[index]) * (b.Value / 100));
                    }
                }
            }
        }
Example #9
0
        private void ApplySetBonus(InventoryChangedEventArgs e)
        {
            var gameData = _player.Manager.Resources.GameData;

            foreach (var equipSet in gameData.EquipmentSets.Values)
            {
                var setEquipped = equipSet.Setpieces
                                  .Where(piece => piece.Type.Equals("Equipment"))
                                  .All(piece => (_player.Inventory[piece.Slot] == null && piece.ItemType == 0xFFFF) ||
                                       (_player.Inventory[piece.Slot] != null &&
                                        _player.Inventory[piece.Slot].ObjectType == piece.ItemType));

                if (setEquipped)
                {
                    // apply bonus
                    foreach (var ae in equipSet.ActivateOnEquipAll)
                    {
                        switch (ae.Effect)
                        {
                        case ActivateEffects.ChangeSkin:
                            _player.Skin = ae.SkinType;
                            _player.Size = ae.Size;
                            break;

                        case ActivateEffects.IncrementStat:
                            IncrementBoost((StatsType)ae.Stats, ae.Amount);
                            break;

                        case ActivateEffects.FixedStat:
                            FixedStat((StatsType)ae.Stats, ae.Amount);
                            break;

                        case ActivateEffects.ConditionEffectSelf:
                            _player.ApplyConditionEffect(ae.ConditionEffect.Value);
                            break;
                        }
                    }
                    return;
                }

                if (e == null)
                {
                    continue;
                }

                var setRemoved = equipSet.Setpieces
                                 .Where(piece => piece.Type.Equals("Equipment"))
                                 .All(piece => (e.OldItems[piece.Slot] == null && piece.ItemType == 0xFFFF) ||
                                      (e.OldItems[piece.Slot] != null && e.OldItems[piece.Slot].ObjectType == piece.ItemType));

                if (setRemoved)
                {
                    foreach (var ae in equipSet.ActivateOnEquipAll)
                    {
                        // remove changes
                        switch (ae.Effect)
                        {
                        case ActivateEffects.ChangeSkin:
                            _player.RestoreDefaultSkin();
                            _player.RestoreDefaultSize();
                            break;

                        case ActivateEffects.ConditionEffectSelf:
                            _player.ApplyConditionEffect(ae.ConditionEffect.Value, 0);
                            break;
                        }
                    }
                }
            }
        }
Example #10
0
 protected internal void ReCalculateValues(InventoryChangedEventArgs e = null)
 {
     SetWeaponDamage(e);
 }
Example #11
0
 protected internal void ReCalculateValues(InventoryChangedEventArgs e = null)
 {
 }