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.

Revisions

  1. KonyukhovSergey created this gist Apr 24, 2014.
    21 changes: 21 additions & 0 deletions gistfile1.cs
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,21 @@
    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;
    }