Sell price

From Kolmafia
Revision as of 05:45, 18 March 2012 by imported>Gnocchi masala (Fix obsolete syntax)
Jump to navigation Jump to search

Function Syntax

boolean sell_price(coinmaster master ,item it )

  • master is the coinmaster to query
  • it is the item to check

Returns the number of tokens that master will charge you if you want him to sell it to you.

Code Sample

This prints the price for which you can buy an item from a coinmaster.

void print_price(item it) {
   if(is_coinmaster_item(it)) {
      coinmaster master = it.buyer;
      string token = master.token;
      int price = buy_price(master, it);
      if(price > 1) token += "s";
      print("You can buy that for "+ price + " "+token +".");
   } else if(is_tradeable(it))
      print("You can buy that from the mall for "+mall_price(it)+ " meat.");
   else print("You cannot buy that!", "red");
}

See Also

sell() | buy_price()