Ejemplo n.º 1
0
/* routine called after dying (or quitting) with nonempty bill */
void
paybill(void)
{
	if (shlevel == dlevel && shopkeeper && ESHK(shopkeeper)->billct) {
		addupbill();
		if (total > u.ugold) {
			shopkeeper->mgold += u.ugold;
			u.ugold = 0;
			pline("%s comes and takes all your possessions.",
			      Monnam(shopkeeper));
		} else {
			u.ugold -= total;
			shopkeeper->mgold += total;
			pline("%s comes and takes the %ld zorkmids you owed him.",
			    Monnam(shopkeeper), total);
		}
		setpaid();	/* in case we create bones */
	}
}
Ejemplo n.º 2
0
/* routine called after dying (or quitting) with nonempty bill */
void paybill()
{
  if (shlevel == dlevel && shopkeeper && ESHK(shopkeeper)->billct) {
    addupbill();
    if (total > you.ugold){
      shopkeeper->mgold += you.ugold;
      you.ugold = 0;
      StrPrintF(ScratchBuffer, "%s comes and takes all your possessions.",
		Monnam(shopkeeper));
      message(ScratchBuffer);
    } else {
      you.ugold -= total;
      shopkeeper->mgold += total;
      StrPrintF(ScratchBuffer,
		"%s comes and takes the %ld zorkmids you owed him.",
		Monnam(shopkeeper), total);
      message(ScratchBuffer);
    }
    setpaid();	/* in case we create bones */
  }
}
Ejemplo n.º 3
0
int
inshop(void)
{
	int roomno = inroom(u.ux, u.uy);

	/* Did we just leave a shop? */
	if (u.uinshop &&
	    (u.uinshop != roomno + 1 || shlevel != dlevel || !shopkeeper)) {
		if (shopkeeper) {
			if (ESHK(shopkeeper)->billct) {
				if (inroom(shopkeeper->mx, shopkeeper->my)
				    == u.uinshop - 1)	/* ab@unido */
					pline("Somehow you escaped the shop without paying!");
				addupbill();
				pline("You stole for a total worth of %ld zorkmids.",
				    total);
				ESHK(shopkeeper)->robbed += total;
				setpaid();
				if ((rooms[ESHK(shopkeeper)->shoproom].rtype == GENERAL)
				    == (rn2(3) == 0))
					ESHK(shopkeeper)->following = 1;
			}
			shopkeeper = NULL;
			shlevel = 0;
		}
		u.uinshop = 0;
	}

	/* Did we just enter a zoo of some kind? */
	if (roomno >= 0) {
		int rt = rooms[roomno].rtype;
		struct monst *mtmp;
		if (rt == ZOO)
			pline("Welcome to David's treasure zoo!");
		else if (rt == SWAMP)
			pline("It looks rather muddy down here.");
		else if (rt == MORGUE) {
			if (midnight())
				pline("Go away! Go away!");
			else
				pline("You get an uncanny feeling ...");
		} else
			rt = 0;
		if (rt != 0) {
			rooms[roomno].rtype = 0;
			for (mtmp = fmon; mtmp; mtmp = mtmp->nmon)
				if (rt != ZOO || !rn2(3))
					mtmp->msleep = 0;
		}
	}

	/* Did we just enter a shop? */
	if (roomno >= 0 && rooms[roomno].rtype >= 8) {
		if (shlevel != dlevel || !shopkeeper
		    || ESHK(shopkeeper)->shoproom != roomno)
			findshk(roomno);
		if (!shopkeeper) {
			rooms[roomno].rtype = 0;
			u.uinshop = 0;
		} else if (!u.uinshop) {
			if (!ESHK(shopkeeper)->visitct ||
			    strncmp(ESHK(shopkeeper)->customer, plname, PL_NSIZ)) {
				/* He seems to be new here */
				ESHK(shopkeeper)->visitct = 0;
				ESHK(shopkeeper)->following = 0;
				strncpy(ESHK(shopkeeper)->customer, plname, PL_NSIZ);
				NOTANGRY(shopkeeper) = 1;
			}
			if (!ESHK(shopkeeper)->following) {
				boolean box, pick;

				pline("Hello %s! Welcome%s to %s's %s shop!",
				      plname,
				      ESHK(shopkeeper)->visitct++ ? " again" : "",
				      shkname(shopkeeper),
				      shopnam[rooms[ESHK(shopkeeper)->shoproom].rtype - 8]);
				box = carrying(ICE_BOX);
				pick = carrying(PICK_AXE);
				if (box || pick) {
					if (dochug(shopkeeper)) {
						u.uinshop = 0;	/* he died moving */
						return (0);
					}
					pline("Will you please leave your %s outside?",
					    (box && pick) ? "box and pick-axe" :
					    box ? "box" : "pick-axe");
				}
			}
			u.uinshop = roomno + 1;
		}
	}
	return (u.uinshop);
}
Ejemplo n.º 4
0
UInt inshop()
{
  Short roomno = inroom(you.ux,you.uy);

  /* Did we just leave a shop? */
  if (you.uinshop &&
      (you.uinshop != roomno + 1 || shlevel != dlevel || !shopkeeper)) {
    if (shopkeeper) {
      if (ESHK(shopkeeper)->billct) {
	if (inroom(shopkeeper->mx, shopkeeper->my) 
	    == you.uinshop - 1)	/* ab@unido */
	  message("Somehow you escaped the shop without paying!");
	addupbill();
	StrPrintF(ScratchBuffer,"You stole for a total worth of %ld zorkmids.",
		  total);
	message(ScratchBuffer);
	ESHK(shopkeeper)->robbed += total;
	setpaid();
	if ((rooms[ESHK(shopkeeper)->shoproom].rtype == GENERAL)
	    == (rund(3) == 0))
	  ESHK(shopkeeper)->following = true;
      }
      shopkeeper = NULL;
      shlevel = 0;
    }
    you.uinshop = 0;
  }

  /* Did we just enter a zoo of some kind? */
  if (roomno >= 0) {
    Short rt = rooms[roomno].rtype;
    monst_t *mtmp;
    if (rt == ZOO) {
      message("Welcome to David's treasure zoo!");
    } else
      if (rt == SWAMP) {
	message("It looks rather muddy down here.");
      } else
	if (rt == MORGUE) {
	  if (midnight())
	    message("Go away! Go away!");
	  else
	    message("You get an uncanny feeling ...");
	} else
	  rt = 0;
    if (rt != 0) {
      rooms[roomno].rtype = 0;
      for (mtmp = fmon ; mtmp ; mtmp = mtmp->nmon)
	if (rt != ZOO || !rund(3))
	  mtmp->bitflags &= ~M_IS_ASLEEP;
    }
  }

  /* Did we just enter a shop? */
  if (roomno >= 0 && rooms[roomno].rtype >= 8) {
    if (shlevel != dlevel || !shopkeeper
	|| ESHK(shopkeeper)->shoproom != roomno)
      findshk(roomno);
    if (!shopkeeper) {
      rooms[roomno].rtype = 0;
      you.uinshop = 0;
    } else if (!you.uinshop) {
      if (!ESHK(shopkeeper)->visitct ||
	  StrNCompare(ESHK(shopkeeper)->customer, plname, PL_NSIZ)) {

	/* He seems to be new here */
	ESHK(shopkeeper)->visitct = 0;
	ESHK(shopkeeper)->following = false;
	StrNCopy(ESHK(shopkeeper)->customer, plname, PL_NSIZ);
	shopkeeper->bitflags |= M_IS_PEACEFUL; // NOTANGRY(shopkeeper) = 1;
      }
      if (!ESHK(shopkeeper)->following) {
	Boolean box, pick;

	StrPrintF(ScratchBuffer, "Hello %s! Welcome%sto %s's %s shop!",
		  plname,
		  ESHK(shopkeeper)->visitct++ ? " again " : " ",
		  shkname(shopkeeper),
		  shopnam[rooms[ESHK(shopkeeper)->shoproom].rtype - 8] );
	message(ScratchBuffer);
	box = carrying(ICE_BOX);
	pick = carrying(PICK_AXE);
	if (box || pick) {
	  if (do_chug(shopkeeper)) {
	    you.uinshop = 0;	/* he died moving */
	    return 0;
	  }
	  StrPrintF(ScratchBuffer, "Will you please leave your %s outside?",
		    (box && pick) ? "box and pick-axe" :
		    box ? "box" : "pick-axe");
	  message(ScratchBuffer);
	}
      }
      you.uinshop = roomno + 1; // (0 is "not in shop")
    }
  }
  return you.uinshop;
}