//--------------------------------------------------------------------------------------------- public static UOItem FindPotion(Potion potion, ItemsCollection serachCol) { Graphic gra = potion.DefaultGraphic; UOColor color = potion.DefaultColor; UOItem potionItem = new UOItem(Serial.Invalid); List <UOItem> matchItems = serachCol.Where(i => i.Graphic == gra && i.Color == color).ToList(); if (matchItems.Count > 0) { potionItem = matchItems[0]; } else { foreach (UOItem item in serachCol) { if (item.Graphic == gra) { if (item.Color == color) { potionItem = item; break; } else { if (String.IsNullOrEmpty(item.Name)) { item.Click(); Game.Wait(100); } string name = String.Empty + item.Name; if (name.ToLower().Contains(potion.name.ToLower())) { potionItem = item; break; } } } } } return(potionItem); }
public override IEnumerable <AssociativeNode> BuildOutputAst(List <AssociativeNode> inputAstNodes) { var inputIdentifier = (inputAstNodes[0] as IdentifierNode)?.Value; if (inputIdentifier == null || ItemsCollection.Count == 0 || ItemsCollection.Count == -1) { return(new[] { AstFactory.BuildAssignment(GetAstIdentifierForOutputIndex(0), AstFactory.BuildNullNode()) }); } return(new[] { AstFactory.BuildAssignment( GetAstIdentifierForOutputIndex(0), AstFactory.BuildExprList(ItemsCollection.Where(x => x.IsSelected) .Select(y => AstFactory.BuildIdentifier(inputIdentifier, AstFactory.BuildIntNode(y.Index))) .ToList <AssociativeNode>())) }); }
//--------------------------------------------------------------------------------------------- public UOItem FindKad(Potion potion, ItemsCollection serachCol) { UOItem kad = new UOItem(Serial.Invalid); foreach (KeyValuePair <PotionQuality, PotionQualityDefinition> kvp in potion.Qualities) { List <UOItem> matchItems = serachCol.Where(i => i.Graphic == kvp.Value.KadGraphic && i.Color == kvp.Value.KadColor).ToList(); if (matchItems.Count > 0) { kad = matchItems[0]; break; } else { foreach (UOItem item in serachCol) { if (item.Distance > 5) { continue; } if (item.Graphic == kvp.Value.KadGraphic) { if (item.Color == kvp.Value.KadColor) { return(item); } else { if (String.IsNullOrEmpty(item.Name)) { item.Click(); Game.Wait(100); } string itemName = item.Name + String.Empty; string searchName = (kvp.Key == PotionQuality.None ? "" : kvp.Key.ToString() + " ") + potion.name; if (kvp.Key == PotionQuality.None) { if (itemName.ToLower() == searchName.ToLower()) { return(item); } } else { if (itemName.ToLower().Contains(searchName.ToLower())) { return(item); } } } } } } } return(kad); }