Save items from pvp theft

lostcalpolydude

Developer
Staff member
I wanted a quick way to make sure nothing valuable would get stolen after breaking my hippy stone, so I made this little script. I would have attached it, but this seems like the type of thing other people will modify and make much more useful.

Code:
int expensiveValue = 10000;

int get_price( item itm )
{
	if ( historical_age( itm ) < 14 ) return historical_price( itm );
	return mall_price( itm );
}

boolean is_pvpable( item thing )
{
	return thing.tradeable && thing.discardable && !thing.gift && !thing.quest;
}

void main()

{
	int[item] inventory = get_inventory();
	batch_open();
	foreach it in inventory
	{
		if( is_pvpable( it ) && get_price( it ) > expensiveValue )
		{
			print_html( it + ": " + get_price( it ) );
			#put_closet( item_amount( it ), it);
		}
	}
	batch_close();
}

Change expensiveValue to set the threshold for item value that you care about. This form just prints information, but you can move the comment to have everything closeted. Or change that one line to do whatever you want with the items (mall, display case, whatever).
 
Last edited:

Veracity

Developer
Staff member
I always thought that items in the closet, as well as inventory, were available to be stolen. The Wiki says that, too, so we know that MUST be right.
 

lostcalpolydude

Developer
Staff member
I thought closet items were only eligible if you didn't have an item in that category in your inventory. I don't know why I thought that.
 

Veracity

Developer
Staff member
I just saw somebody say that on G-D.
It might be true.

Things in the DC and Storage are completely immune. I'll be trying PVP after I ascend again and free the king - without emptying my storage, which I started doing, after CDM changed it such that things could go into your closet when you did that.
 

philmasterplus

Active member
CDMoyer already explained in the forums:

What kinds of items can and cannot be stolen.

Items in your closet were safe, and always will be.

So will the ones in Hagnks and DC.


Edit: Also, here's my rudimentary PvP item safeguard script. It closets all steal-able items above a specific mall price, excluding a few items.
The pvp_unimportant thing was added because mall_price() was returning 1000 meat for the oven/cocktail kit/hammer. Weird.

PHP:
int minimum_value = 1000;
boolean [item] pvp_unimportant = $items[tenderizing hammer, dramatic range, Queue Du Coq cocktailcrafting kit];

//Rudimentary function
boolean is_stealable(item it) { return is_tradeable(it) && autosell_price(it) > 0; }

//Note: Ever since the Closet revamp, multi-putting and multi-taking is impossible.
// Thus batch_open() and batch_close() are not needed.
foreach it, qty in get_inventory() {
	if (is_stealable(it) && mall_price(it) >= minimum_value && !(pvp_unimportant contains it)) {
		print('Gonna closet ' + qty + ' ' + (qty == 1 ? to_string(it) : to_plural(it)) + '.', 'teal');
		put_closet(qty, it);
	}
}

print_html('<b>Done!</b>');
 

Attachments

  • ItemGuard.ash
    666 bytes · Views: 574
Last edited:
Safe, only if you had a legal target.

100 fortune cookies give food legal targets, 100 boxed wine gives booze legal targets, 100 hair spray gives 'other' legal target.

Then again, I could be misunderstanding, I do that quite a bit.
 

lostcalpolydude

Developer
Staff member
Safe, only if you had a legal target.

100 fortune cookies give food legal targets, 100 boxed wine gives booze legal targets, 100 hair spray gives 'other' legal target.

Then again, I could be misunderstanding, I do that quite a bit.

That works, as long as you closet or uncloset stuff about a hundred times per day as you gain items or decide you want to use them. At some point the meat saved isn't worth the effort.

Code:
//Note: Ever since the Closet revamp, multi-putting and multi-taking is impossible.
// Thus batch_open() and batch_close() are not needed.
While true, I included it in case KoL changes. Or in case someone decides to use their display case instead.
 

philmasterplus

Active member
Just had a thought...how does KoL decide which item to yoink from the victim's inventory?

Hypothesis: Choose any item from a pool of tradeable, autosell-able, non-gift item in the inventory. Does not take item quantities into account.

This would mean that having 2-3 each of thousands of items would significantly reduce chances of any important item getting stolen. Whereas "buy 100 hair sprays" approach wouldn't be as effective.

Now this solution would make your inventory a huge cluttered mess.
 

Terion

Member
Whereas "buy 100 hair sprays" approach wouldn't be as effective.

I believe the idea of that plan is: Closet everything and then buy 100 hairsprays (and 100 fortune cookies and 100 day-old beers) so that someone PVPing you for items, food, or booze gets a hairspray/cookie/beer and does not touch your "real" inventory at all.

It's a bit different from the plan of "Closet the expensive stuff, and the rest is up for grabs."
 

lostcalpolydude

Developer
Staff member
is_giftable($item[hair spray]) returns true, so I guess that part of the check was just useless. Not sure what I was trying to gain with it.
 

philmasterplus

Active member
More specifically. According to CDMoyer, gift items cannot be stolen except for the Amulet of Yendor.

You know, I think the Amulet of Yendor thing is actually CDMoyer joking about how you take it from the wizard guy or something in NetHack.

CDMoyer in the KoL Forums said:
Things that can't be stolen:
(...)
gift items (Except an amulet famous for being stolen in the reference material)

So he might have been talking about the reference material (NetHack), instead of actually saying that it can be stolen. I mean, why should it be stealable, anyway?
 

chef noodleman

New member
Safe, only if you had a legal target.

100 fortune cookies give food legal targets, 100 boxed wine gives booze legal targets, 100 hair spray gives 'other' legal target.

Then again, I could be misunderstanding, I do that quite a bit.

As I understand it, 100 fortune cookies would be sufficient. In the new PVP system there's no longer an option to try to steal different types of items, just "phat loot". I'm assuming the new mechanics reflect this interface change.
 

Bale

Minion
So he might have been talking about the reference material (NetHack), instead of actually saying that it can be stolen. I mean, why should it be stealable, anyway?

I'm 98.26% certain that he is saying they specifically made it steal-able because in Nethack it is likely to get stolen from you before you escape with it. In other words, being steal-able in PvP is part of the joke.
 
after having to closet and uncloset an acordian more times then I would like... I'm going to bow to the idea of a min value to closet.

Are there any items that really are valuable, that don't look valuable to the game that would warent a special check?
 

mstieler

Member
CDMoyer already explained in the forums:

What kinds of items can and cannot be stolen.

Items in your closet were safe, and always will be.

So will the ones in Hagnks and DC.


Edit: Also, here's my rudimentary PvP item safeguard script. It closets all steal-able items above a specific mall price, excluding a few items.
The pvp_unimportant thing was added because mall_price() was returning 1000 meat for the oven/cocktail kit/hammer. Weird.

PHP:
int minimum_value = 1000;
boolean [item] pvp_unimportant = $items[tenderizing hammer, dramatic range, Queue Du Coq cocktailcrafting kit];

//Rudimentary function
boolean is_stealable(item it) { return is_tradeable(it) && autosell_price(it) > 0; }

//Note: Ever since the Closet revamp, multi-putting and multi-taking is impossible.
// Thus batch_open() and batch_close() are not needed.
foreach it, qty in get_inventory() {
	if (is_stealable(it) && mall_price(it) >= minimum_value && !(pvp_unimportant contains it)) {
		print('Gonna closet ' + qty + ' ' + (qty == 1 ? to_string(it) : to_plural(it)) + '.', 'teal');
		put_closet(qty, it);
	}
}

print_html('<b>Done!</b>');

Adding a list of stuff that Philmasterplus's script skips can be done like so:

Code:
int minimum_value = 1000;
boolean [item] pvp_unimportant = $items[tenderizing hammer, dramatic range, Queue Du Coq cocktailcrafting kit];

//Rudimentary function
boolean is_stealable(item it) { return is_tradeable(it) && autosell_price(it) > 0; }

//Note: Ever since the Closet revamp, multi-putting and multi-taking is impossible.
// Thus batch_open() and batch_close() are not needed.
foreach it, qty in get_inventory() {
    if (is_stealable(it) && mall_price(it) >= minimum_value && !(pvp_unimportant contains it)) {
        print('Gonna closet ' + qty + ' ' + (qty == 1 ? to_string(it) : to_plural(it)) + '.', 'teal');
        put_closet(qty, it);
    }
    if (is_stealable(it) && mall_price(it) < minimum_value &&!(pvp_unimportant contains it)) {
        print('Not worth closeting ' + qty + ' ' + (qty == 1 ? to_string(it) : to_plural(it)) + '.', 'red');
    }
}

print_html('<b>Done!</b>');

I haven't run this as the first trial (since I was testing out how to get it to function), so I don't know for certain if it will make a list of stuff it skips at the end, or if you have to run the script twice for it to do so.
 
Last edited:

lostcalpolydude

Developer
Staff member
I can't imagine mall_price( it ) being needed in any script for this purpose, unless you're really paranoid about sudden price changes and run it all the time. That change seems like it would make the script take about 1% of the time.
 
Top