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

Function wishcmdassist

src/zap.c:6164–6219  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6162DISABLE_WARNING_FORMAT_NONLITERAL
6163
6164staticfn void
6165wishcmdassist(int triesleft)
6166{
6167 static NEARDATA const char *
6168 wishinfo[] = {
6169 "Wish details:",
6170 "",
6171 "Enter the name of an object, such as \"potion of monster detection\",",
6172 "\"scroll labeled README\", \"elven mithril-coat\", or \"Grimtooth\"",
6173 "(without the quotes).",
6174 "",
6175 "For object types which come in stacks, you may specify a plural name",
6176 "such as \"potions of healing\", or specify a count, such as \"1000 gold",
6177 "pieces\", although that aspect of your wish might not be granted.",
6178 "",
6179 "You may also specify various prefix values which might be used to",
6180 "modify the item, such as \"uncursed\" or \"rustproof\" or \"+1\".",
6181 "Most modifiers shown when viewing your inventory can be specified.",
6182 "",
6183 "You may specify 'nothing' to explicitly decline this wish.",
6184 0,
6185 },
6186 preserve_wishless[] = "Doing so will preserve 'wishless' conduct.",
6187 retry_info[] =
6188 "If you specify an unrecognized object name %s%s time%s,",
6189 retry_too[] = "a randomly chosen item will be granted.",
6190 suppress_cmdassist[] =
6191 "(Suppress this assistance with !cmdassist in your config file.)",
6192 *cardinals[] = { "zero", "one", "two", "three", "four", "five" },
6193 too_many[] = "too many";
6194 int i;
6195 winid win;
6196 char buf[BUFSZ];
6197
6198 win = create_nhwindow(NHW_TEXT);
6199 if (!win)
6200 return;
6201 for (i = 0; i < SIZE(wishinfo) - 1; ++i)
6202 putstr(win, 0, wishinfo[i]);
6203 if (!u.uconduct.wishes)
6204 putstr(win, 0, preserve_wishless);
6205 putstr(win, 0, "");
6206 Sprintf(buf, retry_info,
6207 (triesleft >= 0 && triesleft < SIZE(cardinals))
6208 ? cardinals[triesleft]
6209 : too_many,
6210 (triesleft < MAXWISHTRY) ? " more" : "",
6211 plur(triesleft));
6212 putstr(win, 0, buf);
6213 putstr(win, 0, retry_too);
6214 putstr(win, 0, "");
6215 if (iflags.cmdassist)
6216 putstr(win, 0, suppress_cmdassist);
6217 display_nhwindow(win, TRUE);
6218 destroy_nhwindow(win);
6219}
6220
6221#define MAX_WISH_HISTORY 20

Callers 1

makewishFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected