public ItemToolInfo(ItemType type, ItemWieldType wieldType, SkillType applyableSkill, float marketValue, string name = null, string description = null) :
     base(ItemClassCode.Weapon, type, name, description)
 {
     this.WieldType      = wieldType;
     this.ApplyableSkill = applyableSkill;
     this.MarketValue    = marketValue;
 }
 public ItemWeaponInfo(ItemType type, ItemWieldType wieldType, SkillType applyableSkill, float marketValue, float baselineDamage, string name = null, string description = null) :
     base(ItemClassCode.Weapon, type, name, description)
 {
     this.BaseDamage     = baselineDamage;
     this.WieldType      = wieldType;
     this.ApplyableSkill = applyableSkill;
 }
示例#3
0
        public bool Set(IItem item, InventorySlot etype, IEntityStats stats)
        {
            bool success = false;
            int  index   = this.GetEmptyIndex(item, etype);

            // if we have a valid index and valid item
            if (item == null && index >= this.innerList.Length)
            {
                return(false);
            }
            // if we are setting it to a unequiped location
            if (index >= (int)InventorySlot.Inventory1)
            {
                IItem existingItem = innerList[index];
                if (existingItem == null)
                {
                    innerList[index] = item;
                    success          = true;
                    Remaining--;
                }
                else
                {
                    existingItem.Count += item.Count;
                    item.Count          = 0;
                }
            }
            else if (etype == InventorySlot.WieldPrimary || etype == InventorySlot.WieldSecondary || etype == InventorySlot.WieldTwoHanded)
            {
                if (item.Info is IWieldableItemInfo)
                {
                    ItemWieldType itemWieldType = ((IWieldableItemInfo)item.Info).WieldType;
                    // unequip any dual wield item
                    var existingTwoHandedItem = this.Get(InventorySlot.WieldTwoHanded, stats);
                    if (existingTwoHandedItem != null)
                    {
                        this.Set(existingTwoHandedItem, InventorySlot.AnyNonEquiped, stats);
                    }

                    if (itemWieldType == ItemWieldType.OneHand && etype != InventorySlot.WieldTwoHanded)
                    {
                        // if the left hand is empty or we are able to unwield whats in it
                        var existing = this.Get(etype, stats);
                        if (existing != null)
                        {
                            this.Set(existing, InventorySlot.AnyNonEquiped, stats);
                        }
                        innerList[index] = item;
                        success          = true;
                    }
                    else if (itemWieldType == ItemWieldType.BothHands && etype != InventorySlot.WieldTwoHanded)
                    {
                        var existingPrimary = this.Get(InventorySlot.WieldPrimary, stats);
                        if (existingPrimary != null)
                        {
                            this.Set(existingPrimary, InventorySlot.AnyNonEquiped, stats);
                        }
                        var existingSecondary = this.Get(InventorySlot.WieldSecondary, stats);
                        if (existingSecondary != null)
                        {
                            this.Set(existingSecondary, InventorySlot.AnyNonEquiped, stats);
                        }
                        innerList[index] = item;
                        success          = true;
                    }
                }
            }
            else
            {
                //equip code
                if (item.Info is IEquipableItemInfo)
                {
                    innerList[index] = item;
                    success          = true;
                }
            }

            // if success apply the new modifiers
            if (success)
            {
                // apply new modifiers
                if (item.Modifier != null)
                {
                    item.Modifier.Apply(stats);
                }
            }

            return(success);
        }