public static bool GiftInvertoryPatch_propsFilterAndSort(ref CtrlGiftInvertoryWindow __instance, ref InventoryWindowInfo inventoryWindowInfo) { if (giftFilter.Value) { List <PropsInfo> sort = inventoryWindowInfo.Sort; CharacterMapping mapping = inventoryWindowInfo.Mapping; List <PropsInfo> canAddExpGiftlist = new List <PropsInfo>(); for (int index = 0; index < sort.Count; index++) { Props item = sort[index].Item; if (item.PropsEffect != null) { for (int i = 0; i < item.PropsEffect.Count; i++) { PropsEffect propsEffect = item.PropsEffect[i]; if (propsEffect is PropsFavorable) { PropsFavorable propsFavorable = propsEffect as PropsFavorable; if (mapping != null && mapping.InfoId != null && !mapping.InfoId.Equals(string.Empty)) { if (propsFavorable.Npcid == mapping.InfoId) { canAddExpGiftlist.Add(sort[index]); break; } } } } } } sort.Clear(); sort.AddRange(canAddExpGiftlist.ToArray()); canAddExpGiftlist.Clear(); GiftSortByCategory(sort, mapping.Id); GiftSortByNumber(sort, mapping.Id); } return(true); }
public static int getFavExp(List <PropsInfo> sort, string mappingId, int index) { Props iItem = sort[index].Item; int favExp = 0; for (int i = 0; i < iItem.PropsEffect.Count; i++) { PropsEffect propsEffect = iItem.PropsEffect[i]; if (propsEffect is PropsFavorable) { PropsFavorable propsFavorable = propsEffect as PropsFavorable; if (mappingId != null && !mappingId.Equals(string.Empty)) { if (propsFavorable.Npcid == mappingId) { return(propsFavorable.Value); } } } } return(favExp); }