Feature - Implemented NPC store availability and pricing

Theraze

Active member
I had been wondering if an item was available through NPC stores. I was looking through NPCStoreDatabase and saw that the contains and price functions both seemed that they would give information on this. I whipped up this patch to add a new command, npc_price. This runs a validating contains to check whether or not the item is purchasable, and returns the price is possible. If not, it returns 0.
> ash npc_price($item[plum])

Returned: 0

> npc_price flat dough

Returned: 70

> npc_price bleargh

Bad item value: "bleargh"
Returned: null

> mall_price bleargh

Bad item value: "bleargh"
Returned: null

> ash npc_price($item[bleargh])

Bad item value: "bleargh" ()
Returned: void

> ash mall_price($item[bleargh])

Bad item value: "bleargh" ()
Returned: void
Demonstrating that it works exactly the same as existing functions, with both ASH and CLI, and properly returns 0 if the item isn't available yet.
 

Attachments

  • NPCPrice.patch
    1.1 KB · Views: 32

Theraze

Active member
Curious about what items in your inventory you can sell in-run but still get back when you have a bit more meat?
> ashq foreach i in get_inventory() { if (npc_price(i) > 0) print(i+" can be bought for "+npc_price(i)); }

anti-anti-antidote can be bought for 30
bugbear beanie can be bought for 70
bugbear bungguard can be bought for 70
casino pass can be bought for 100
cool whip can be bought for 30
detuned radio can be bought for 300
fermenting powder can be bought for 70
frilly skirt can be bought for 80
hair spray can be bought for 24
magicalness-in-a-can can be bought for 200
moxie weed can be bought for 200
oyster basket can be bought for 300
skewer can be bought for 80
strongness elixir can be bought for 200
taco shell can be bought for 80
The Big Book of Pirate Insults can be bought for 500

Curious about what items could be bought at a different point in your run, or with different sign options?
> ashq foreach i in get_inventory() { if (is_npc_item(i) && npc_price(i) == 0) print(i+" can be bought but not by you."); }

marzipan skull can be bought but not by you.
Meleegra™ pills can be bought but not by you.
tamarind-flavored chewing gum can be bought but not by you.
tomato can be bought but not by you.
 

Bale

Minion
Thank you for adding it to the wiki. (I've been adding the new stuff there the last few days and it is nice to get help.)
 

Theraze

Active member
Np. I try not to screw up pages that I don't know, but this one I'm fairly certain on the usage of. :D
 
Top