| | |
| | | if (list == null) return; |
| | | if (xbGridArr == null) return; |
| | | |
| | | if (xbGridArr.Contains(grid)) |
| | | if (AreAllLibItemsRelatedToHeroes(list)) |
| | | { |
| | | int heroID = manager.GetCurrentDisplayCallHeroId(); |
| | | if (!TryGetHeroItemInfo(heroID, libID, list, out int itemID, out int itemCount)) return; |
| | |
| | | return res; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 检查库中所有物品是否都与ActHeroReturnArtConfig中的武将相关 |
| | | /// </summary> |
| | | private bool AreAllLibItemsRelatedToHeroes(List<int> itemList) |
| | | { |
| | | if (itemList == null || itemList.Count == 0) return false; |
| | | |
| | | List<int> heroIdList = ActHeroReturnArtConfig.GetKeys(); |
| | | if (heroIdList == null || heroIdList.Count == 0) return false; |
| | | |
| | | for (int i = 0; i < itemList.Count; i++) |
| | | { |
| | | int itemID = itemList[i]; |
| | | var config = ItemConfig.Get(itemID); |
| | | if (config == null) return false; |
| | | |
| | | if (config.Type == 150) |
| | | { |
| | | if (!heroIdList.Contains(itemID)) return false; |
| | | } |
| | | else if (config.Type == 151) |
| | | { |
| | | if (!heroIdList.Contains(config.EffectValueA1)) return false; |
| | | } |
| | | else |
| | | { |
| | | return false; |
| | | } |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | public bool TryGetHeroItemInfo(int heroID, int libID, List<int> itemList, out int itemID, out int itemCount) |
| | | { |
| | | itemID = 0; |