Lines Matching defs:shopkeeper
87 struct monst *shopkeeper = 0;
162 * Descriptor of current shopkeeper. Note that the bill need not be
163 * per-shopkeeper, since it is valid only when in a shop.
165 static struct monst *shopkeeper = 0;
167 static int shlevel = 0; /* level of this shopkeeper */
203 if (mtmp == shopkeeper) {
205 shopkeeper = 0;
214 if (mtmp == shopkeeper) {
215 shopkeeper = mtmp2;
216 bill = &(ESHK(shopkeeper)->bill[0]);
222 { /* caller has checked that shopkeeper exists */
242 ESHK(shopkeeper)->billct = 0;
248 /* caller has checked that shopkeeper exists */
249 int ct = ESHK(shopkeeper)->billct;
265 (u.uinshop != roomno + 1 || shlevel != dlevel || !shopkeeper)) {
266 if (shopkeeper) {
267 if (ESHK(shopkeeper)->billct) {
268 if (inroom(shopkeeper->mx, shopkeeper->my)
274 ESHK(shopkeeper)->robbed += total;
276 if ((rooms[ESHK(shopkeeper)->shoproom].rtype == GENERAL)
278 ESHK(shopkeeper)->following = 1;
280 shopkeeper = 0;
309 if (shlevel != dlevel || !shopkeeper
310 || ESHK(shopkeeper)->shoproom != roomno)
312 if (!shopkeeper) {
316 if (!ESHK(shopkeeper)->visitct ||
317 strncmp(ESHK(shopkeeper)->customer, plname, PL_NSIZ)) {
320 ESHK(shopkeeper)->visitct = 0;
321 ESHK(shopkeeper)->following = 0;
322 (void) strncpy(ESHK(shopkeeper)->customer, plname, PL_NSIZ);
323 NOTANGRY(shopkeeper) = 1;
325 if (!ESHK(shopkeeper)->following) {
330 ESHK(shopkeeper)->visitct++ ? " again" : "",
331 shkname(shopkeeper),
332 shopnam[rooms[ESHK(shopkeeper)->shoproom].rtype - 8]);
336 if (dochug(shopkeeper)) {
358 shopkeeper = mtmp;
359 bill = &(ESHK(shopkeeper)->bill[0]);
361 if (ANGRY(shopkeeper) &&
362 strncmp(ESHK(shopkeeper)->customer, plname, PL_NSIZ))
363 NOTANGRY(shopkeeper) = 1;
374 shopkeeper = 0;
383 if (!shopkeeper)
385 for (bp = bill; bp < &bill[ESHK(shopkeeper)->billct]; bp++)
418 ESHK(shopkeeper)->billct--;
419 *bp = bill[ESHK(shopkeeper)->billct];
455 inroom(shopkeeper->mx, shopkeeper->my) == ESHK(shopkeeper)->shoproom)
456 shkp = shopkeeper;
463 if (shkp != shopkeeper && NOTANGRY(shkp)) {
534 if (shkp != shopkeeper) {
535 impossible("dopay: not to shopkeeper?");
536 if (shopkeeper)
542 while (tmp < ESHK(shopkeeper)->billct) {
550 bill[tmp] = bill[--ESHK(shopkeeper)->billct];
554 shkname(shopkeeper),
555 shopnam[rooms[ESHK(shopkeeper)->shoproom].rtype - 8]);
556 NOTANGRY(shopkeeper) = 1;
573 impossible("Shopkeeper administration out of order.");
583 if (ANGRY(shopkeeper))
591 pay(ltmp, shopkeeper);
604 pline("Error in shopkeeper administration.");
615 if (shlevel == dlevel && shopkeeper && ESHK(shopkeeper)->billct) {
618 shopkeeper->mgold += u.ugold;
621 Monnam(shopkeeper));
624 shopkeeper->mgold += total;
626 Monnam(shopkeeper), total);
661 (u.ux == ESHK(shopkeeper)->shk.x && u.uy == ESHK(shopkeeper)->shk.y) ||
662 (u.ux == ESHK(shopkeeper)->shd.x && u.uy == ESHK(shopkeeper)->shd.y) ||
666 if (ESHK(shopkeeper)->billct == BILLSZ) {
670 bp = &bill[ESHK(shopkeeper)->billct];
675 ESHK(shopkeeper)->billct++;
699 if (ESHK(shopkeeper)->billct == BILLSZ)
703 bp = &bill[ESHK(shopkeeper)->billct];
708 ESHK(shopkeeper)->billct++;
719 if (!inshop() || (u.ux == ESHK(shopkeeper)->shk.x && u.uy == ESHK(shopkeeper)->shk.y) ||
720 (u.ux == ESHK(shopkeeper)->shd.x && u.uy == ESHK(shopkeeper)->shd.y))
736 ESHK(shopkeeper)->billct--;
737 *bp = bill[ESHK(shopkeeper)->billct];
741 pline("%s didn't notice.", Monnam(shopkeeper));
746 if (shopkeeper->msleep || shopkeeper->mfroz ||
747 inroom(shopkeeper->mx, shopkeeper->my) != ESHK(shopkeeper)->shoproom)
749 if (ESHK(shopkeeper)->billct == BILLSZ ||
750 ((tmp = shtypes[rooms[ESHK(shopkeeper)->shoproom].rtype - 8]) && tmp != obj->olet)
752 pline("%s seems not interested.", Monnam(shopkeeper));
756 if (ANGRY(shopkeeper)) {
758 NOTANGRY(shopkeeper) = 1;
761 if (ESHK(shopkeeper)->robbed) {
762 if ((ESHK(shopkeeper)->robbed -= ltmp) < 0)
763 ESHK(shopkeeper)->robbed = 0;
767 if (ltmp > shopkeeper->mgold)
768 ltmp = shopkeeper->mgold;
769 pay(-ltmp, shopkeeper);
772 Monnam(shopkeeper), doname(obj));
790 if (shopkeeper)
791 for (bp = bill; bp - bill < ESHK(shopkeeper)->billct; bp++)
797 if (!shopkeeper) {
798 impossible("doinvbill: no shopkeeper?");
806 for (bp = bill; bp - bill < ESHK(shopkeeper)->billct; bp++) {
809 impossible("Bad shopkeeper administration.");
919 struct monst *shkp = shopkeeper;
1113 } else if (dist(shopkeeper->mx, shopkeeper->my) < 3) {
1116 pline("%s grabs your backpack!", shkname(shopkeeper));
1122 obj->nobj = shopkeeper->minvent;
1123 shopkeeper->minvent = obj;