private void DecreaseEquipShieldsDurability(BaseCharacterEntity entity, float decreaseDurability) { bool tempDestroy = false; EquipWeapons equipWeapons = entity.EquipWeapons; CharacterItem rightHand = equipWeapons.rightHand; CharacterItem leftHand = equipWeapons.leftHand; if (rightHand.GetShieldItem() != null && rightHand.GetMaxDurability() > 0) { rightHand = DecreaseDurability(rightHand, decreaseDurability, out tempDestroy); if (tempDestroy) { equipWeapons.rightHand = CharacterItem.Empty; } else { equipWeapons.rightHand = rightHand; } } if (leftHand.GetShieldItem() != null && leftHand.GetMaxDurability() > 0) { leftHand = DecreaseDurability(leftHand, decreaseDurability, out tempDestroy); if (tempDestroy) { equipWeapons.leftHand = CharacterItem.Empty; } else { equipWeapons.leftHand = leftHand; } } entity.EquipWeapons = equipWeapons; }
public bool RequestEquipItem(short nonEquipIndex) { if (!CanDoActions() || nonEquipIndex >= NonEquipItems.Count) { return(false); } CharacterItem characterItem = NonEquipItems[nonEquipIndex]; Item armorItem = characterItem.GetArmorItem(); Item weaponItem = characterItem.GetWeaponItem(); Item shieldItem = characterItem.GetShieldItem(); if (weaponItem != null) { if (weaponItem.EquipType == WeaponItemEquipType.OneHandCanDual) { Item rightWeapon = EquipWeapons.rightHand.GetWeaponItem(); if (rightWeapon != null && rightWeapon.EquipType == WeaponItemEquipType.OneHandCanDual) { return(RequestEquipItem(nonEquipIndex, (byte)InventoryType.EquipWeaponLeft, 0)); } else { return(RequestEquipItem(nonEquipIndex, (byte)InventoryType.EquipWeaponRight, 0)); } } else { return(RequestEquipItem(nonEquipIndex, (byte)InventoryType.EquipWeaponRight, 0)); } } else if (shieldItem != null) { return(RequestEquipItem(nonEquipIndex, (byte)InventoryType.EquipWeaponLeft, 0)); } else if (armorItem != null) { return(RequestEquipItem(nonEquipIndex, (byte)InventoryType.EquipItems, (short)this.IndexOfEquipItem(armorItem.EquipPosition))); } return(false); }