/// <summary> /// Finds existing stack of item. /// </summary> /// <param name="item">Item to find existing stack for.</param> /// <returns>Existing item stack, or null if no stack or not stackable.</returns> DaggerfallUnityItem FindExistingStack(DaggerfallUnityItem item) { if (!item.IsStackable()) { return(null); } ItemGroups itemGroup = item.ItemGroup; int groupIndex = item.GroupIndex; foreach (DaggerfallUnityItem checkItem in items.Values) { if (checkItem != item && checkItem.ItemGroup == itemGroup && checkItem.GroupIndex == groupIndex && checkItem.message == item.message && checkItem.PotionRecipeKey == item.PotionRecipeKey && checkItem.TimeForItemToDisappear == item.TimeForItemToDisappear && checkItem.IsStackable()) { return(checkItem); } } return(null); }
/// <summary> /// Finds existing stack of item. /// </summary> /// <param name="item">Item to find existing stack for.</param> /// <returns>Existing item stack, or null if no stack or not stackable.</returns> DaggerfallUnityItem FindExistingStack(DaggerfallUnityItem item) { if (!item.IsStackable()) { return(null); } ItemGroups itemGroup = item.ItemGroup; int groupIndex = item.GroupIndex; foreach (DaggerfallUnityItem checkItem in items.Values) { if (checkItem != item && checkItem.ItemGroup == itemGroup && checkItem.GroupIndex == groupIndex && checkItem.PotionRecipeKey == item.PotionRecipeKey && checkItem.IsSummoned == item.IsSummoned && checkItem.message == item.message && checkItem.currentCondition == item.currentCondition && // So differently damaged condition books don't stack, when I apply condition variance to them at least. checkItem.nativeMaterialValue == item.nativeMaterialValue && checkItem.IsStackable()) { return(checkItem); } } return(null); }
/// <summary> /// Finds existing stack of item. /// </summary> /// <param name="item">Item to find existing stack for.</param> /// <returns>Existing item stack, or null if no stack or not stackable.</returns> DaggerfallUnityItem FindExistingStack(DaggerfallUnityItem item) { if (!item.IsStackable()) { return(null); } ItemGroups itemGroup = item.ItemGroup; int groupIndex = item.GroupIndex; foreach (DaggerfallUnityItem checkItem in items.Values) { if (checkItem.ItemGroup == itemGroup && checkItem.GroupIndex == groupIndex && checkItem.IsStackable()) { return(checkItem); } } return(null); }