# User:Ion frigate/Shopkeepers
Right now, this is just a place to collect thoughts/notes on shopkeeper mechanics.  They're actually a lot more intricate than we currently document, and it'd be good to get some of this stuff into the shopkeeper article.  Sources include shk.c and my own wizmode testing in SLASH'EM.
Specifically:

Ordinary debt vs robbery.  Once you've left without paying, all debt and credit is erased, ownership of items is cleared, and you now instead cannot pacify the shopkeeper for less than half this total amount.
Shopkeepers do not actively pursue you unless they are robbed (except for the exceptions). Attacking a shopkeeper will make them angry, but they still will not leave their shop ("So wizard, you dare return to Annootok's general store?"). This is why early flame/ice mages can easily dispatch shopkeepers with a corner.
Seems to be a weird exception where a shopkeeper is automatically pacified if it's the first time they've seen you in their shop. Apply a drum of earthquake, they become angry (visible with warning, and they'll shoot at you), but as soon as you enter the store for the first time, they give the first-time welcome message and become peaceful.  This also works with the sphere spells.  It does not work if you make the shopkeeper start pursuing you, as they no longer give welcome messages
Credit covering debt does not pacify shopkeepers, it just stops them from getting angry.  Attack a shopkeeper, escape but have your credit cover the bill, and they'll still be angry.
However, shopkeepers seem to forget about being attacked if you do rob them.  Attack a shopkeeper, escape with a low-value item, and they'll be fully pacified by the value of the item - no 1000zm bribes necessary.
But paying off ordinary debt/shopping bills does not pacify them - so paying for a 5zm rock will not get Annootok to stop psychotically trying to murder you for taking a picture of him, but stealing that rock and then paying for it does.  Interesting sense of justice and morality these guys have.
Using a magic harp to pacify a shopkeeper who is pursuing you does not clear the pursuit status ("Hello wizard, didn't you forget to pay?").  They have a 1/9 chance of getting angry again every time they get a move on you ("Annootok doesn't like customers who don't pay"), unless you stop the pursuit by clearing the robbery.
Maybe the magic harp thing is a bug (as below, charm monster fully pacifies shopkeeps, always), but why is there a specific message and behavior for this situation which seems more or less impossible to create any other way?  Was it just the devs being thorough?  It's weirdly specific for magic harps to have this one weakness.
Pursuit (following and hot_pursuit) and robbery are not actually synonymous.  A shopkeeper who is merely attacked (from inside their shop, see below) doesn't acquire the following/pursuit status, but damaging their walls and refusing to pay gives it.  Pacifying such a shopkeeper with a magic harp leads to the weird situation where the shopkeeper is following you, saying "didn't you forget to pay", but you can't pay them - they have not been robbed, and there is no robbery to compensate them for (charm monster does pacify them fully - guessing it follows a different code path?). The only way to fully pacify such a shopkeeper is to cast charm monster, or let them get angry again and pay the standard 1000zm bribe for a 2/3 chance at pacifying them, or rob them and pay it off.
Pacifying an angry but non-pursuing shopkeeper with a magic harp works (almost) normally.  It does not however pacify the Minetown watch.
Also, you can "add" pursuit to an already angry but non-pursuing shopkeeper by digging into their walls.  No message is given, but you can tell they're pursuing by the absence of the "you dare return..." message on entering
Peaceful-following-but-unrobbed shopkeepers will conduct business normally (no markup), but that still doesn't clear the following status.
Attacking a shopkeeper from outside their shop does initiate pursuit, but attacking from inside does not (even if you leave afterwards).  Attacking from outside leads to the above-mentioned peaceful-following-but-no-debt situation, where the shopkeeper has to get angry again to be truly calmed.
Flame/freeze sphere is an exception to this - doesn't initiate pursuit no matter what
Pursuit/robbery/anger/debt all seem to be preserved on petrification and stone-to-flesh, though ordinary shopping debt is "suspended" while the shopkeeper is stoned
Oh fun, this can cause "program in disorder" messages
Destroying items from outside a shop (e.g. wand of striking) gives anger, pursuit, and robbery valued at the cost of the items destroyed.
Seems similar with cancelling items from outside.
Shopkeepers retain ownership of cancelled items if zapped from outside, but not inside.
Kops and robbery are not completely synonymous.  Destroying items from outside a shop gives robbery but no Kops - only escaping the store with unpaid items/debt seems to summon them.
Polymorph - what is up with this?
Polymorphing an item without destroying it always makes the shopkeeper get angry ("Pakka Pakka gets angry! Pakka Pakka is furious! Pakka Pakka is furious!")
They always start pursuing you (make_angry_shk)
This may be SLASH'EM unique.  It seems they're angered by their items acquiring the (wizmode visible) "hazy" status (will eventually revert)
They don't mind you polymorphing already-hazy items.  They still own the item, but they don't get angry, and don't charge you for it.
They act as if they've been attacked AND as if you owe them for the item.  Pay off the item before leaving the shop, and it's the same situation as mentioned with destroying their walls (pursuit but no owed money).
Items that shudder are treated like ordinary destroyed items.
Shopkeepers need to be inside their shop to charge you for items.  Pursuing shopkeepers will still do it, provided they're inside.  This is NOT related to line-of-sight or anything - a pursuing shopkeeper just outside their shop won't charge you anything for hoovering up all their stuff.
Many thanks to Annootok for enduring dozens of cycles of pacification, petrification, polymorph, and plain old egging.