MCPcopy Create free account
hub / github.com/NetHack/NetHack / shk_names_obj

Function shk_names_obj

src/shk.c:3412–3445  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3410
3411/* shopkeeper tells you what you bought or sold, sometimes partly IDing it */
3412staticfn void
3413shk_names_obj(
3414 struct monst *shkp,
3415 struct obj *obj,
3416 const char *fmt, /* "%s %ld %s %s", doname(obj), amt, plur(amt), arg */
3417 long amt,
3418 const char *arg)
3419{
3420 char *obj_name, fmtbuf[BUFSZ];
3421 boolean was_unknown = !obj->dknown;
3422
3423 observe_object(obj);
3424 /* Use real name for ordinary weapons/armor, and spell-less
3425 * scrolls/books (that is, blank and mail), but only if the
3426 * object is within the shk's area of interest/expertise.
3427 */
3428 if (!objects[obj->otyp].oc_magic && saleable(shkp, obj)
3429 && (obj->oclass == WEAPON_CLASS || obj->oclass == ARMOR_CLASS
3430 || obj->oclass == SCROLL_CLASS || obj->oclass == SPBOOK_CLASS
3431 || obj->otyp == MIRROR)) {
3432 was_unknown |= !objects[obj->otyp].oc_name_known;
3433 makeknown(obj->otyp);
3434 }
3435 obj_name = paydoname(obj);
3436 /* Use an alternate message when extra information is being provided */
3437 if (was_unknown) {
3438 Sprintf(fmtbuf, "%%s; you %s", fmt);
3439 obj_name[0] = highc(obj_name[0]);
3440 pline(fmtbuf, obj_name, (obj->quan > 1L) ? "them" : "it", amt,
3441 plur(amt), arg);
3442 } else {
3443 You(fmt, obj_name, amt, plur(amt), arg);
3444 }
3445}
3446
3447RESTORE_WARNING_FORMAT_NONLITERAL
3448

Callers 3

dopayobjFunction · 0.85
buy_containerFunction · 0.85
sellobjFunction · 0.85

Calls 6

observe_objectFunction · 0.85
saleableFunction · 0.85
paydonameFunction · 0.85
highcFunction · 0.85
YouFunction · 0.85
plineFunction · 0.70

Tested by

no test coverage detected