Skip to content

Instantly share code, notes, and snippets.

@KonyukhovSergey
Created April 24, 2014 08:39
Show Gist options
  • Save KonyukhovSergey/11246752 to your computer and use it in GitHub Desktop.
Save KonyukhovSergey/11246752 to your computer and use it in GitHub Desktop.
public bool purchaseItem(string name, List<KeyValuePair<ItemGrade, int>> prices) {
AuctionRequestParams auctionRequestParams = new AuctionRequestParams(name);
List<AuctionItem> items = getAuctionBuyList(auctionRequestParams);
foreach(var price in prices) {
AuctionItem item = findMinimalPrice(items, price.Key, price.Value);
if(item != null) {
if(item.MakeAuctionBid(price.Value)) {
Log("error: " + GetLastError().ToString());
}
else {
Log("item '" + item.item.name + "' purchased");
return true;
}
}
}
return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment