historical_price
Jump to navigation
Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
Function Syntax
int historical_price( item shop_for )
- Returns the most recently seen mall price of an item without making a server request.
- shop_for: Item to retrieve the price of
This obeys the same restrictions as mall_price()
. Unlike mall_price()
, this function will never hit the server.
Code Samples
Gives you an estimate of your total mall-worth.
ASH | JavaScript |
---|---|
1 cli_execute( "outfit save Backup" );
2 outfit( "birthday suit" );
3 int [ item ] inventory = get_inventory();
4 outfit( "Backup" );
5
6 int total;
7 foreach it in inventory {
8 total += historical_price( it ) * inventory[ it ];
9 }
10 string amount = to_string( total, "%,d" );
11 print( `The estimated total mall-worth of your inventory is {amount} meat.`, "blue" );
|
1 const {
2 cliExecute,
3 getInventory,
4 historicalPrice,
5 outfit,
6 print,
7 toString: formatString,
8 } = require("kolmafia");
9
10 cliExecute("outfit save Backup");
11 outfit("birthday suit");
12 const inventory = getInventory();
13 outfit("Backup");
14
15 let total = 0;
16 for (let itemName in inventory) {
17 total += historicalPrice(Item.get(itemName)) * inventory[itemName];
18 }
19 // Because all JavaScript numbers are floating-point, we must format it as such
20 // and manually remove everything after the dot.
21 const amount = formatString(total, "%,f").split(".")[0];
22 print(
23 "The estimated total mall-worth of your inventory is " + amount + " meat.",
24 "blue"
25 );
|