/// <summary> /// </summary> /// <param name="page"> /// </param> /// <param name="item"> /// </param> /// <returns> /// </returns> /// <exception cref="NotSupportedException"> /// </exception> public static Actions GetAction(IInventoryPage page, IItem item) { Actions action = null; // TODO: Add special check for social page if ((page is ArmorInventoryPage) || (page is ImplantInventoryPage)) { action = item.ItemActions.SingleOrDefault(x => x.ActionType == (int)ActionType.ToWear); if (action == null) { return(new Actions()); } } if (page is WeaponInventoryPage) { action = item.ItemActions.SingleOrDefault(x => x.ActionType == (int)ActionType.ToWield); if (action == null) { return(new Actions()); } } if (page is PlayerInventoryPage) { // No checks needed for unequipping return(new Actions()); } if (page is SocialArmorInventoryPage) { // TODO: Check for side, sex, breed conditionals return(new Actions()); } if (action == null) { throw new NotSupportedException( "No suitable action found for equipping to this page: " + page.GetType()); } return(action); }
/// <summary> /// </summary> /// <param name="page"> /// </param> /// <param name="item"> /// </param> /// <returns> /// </returns> /// <exception cref="NotSupportedException"> /// </exception> public static Actions GetAction(IInventoryPage page, IItem item) { Actions action = null; // TODO: Add special check for social page if ((page is ArmorInventoryPage) || (page is ImplantInventoryPage)) { action = item.ItemActions.SingleOrDefault(x => x.ActionType == (int)ActionType.ToWear); if (action == null) { return new Actions(); } } if (page is WeaponInventoryPage) { action = item.ItemActions.SingleOrDefault(x => x.ActionType == (int)ActionType.ToWield); if (action == null) { return new Actions(); } } if (page is PlayerInventoryPage) { // No checks needed for unequipping return new Actions(); } if (page is SocialArmorInventoryPage) { // TODO: Check for side, sex, breed conditionals return new Actions(); } if (action == null) { throw new NotSupportedException( "No suitable action found for equipping to this page: " + page.GetType()); } return action; }