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

Function dochat

src/sounds.c:1256–1409  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1254}
1255
1256staticfn int
1257dochat(void)
1258{
1259 struct monst *mtmp;
1260 int tx, ty;
1261 struct obj *otmp;
1262
1263 if (is_silent(gy.youmonst.data)) {
1264 pline("As %s, you cannot speak.",
1265 an(pmname(gy.youmonst.data, flags.female ? FEMALE : MALE)));
1266 return ECMD_OK;
1267 }
1268 if (Strangled) {
1269 You_cant("speak. You're choking!");
1270 return ECMD_OK;
1271 }
1272 if (u.uswallow) {
1273 pline("They won't hear you out there.");
1274 return ECMD_OK;
1275 }
1276 if (Underwater) {
1277 Your("speech is unintelligible underwater.");
1278 return ECMD_OK;
1279 }
1280 if (!Deaf && !Blind && (otmp = shop_object(u.ux, u.uy)) != 0) {
1281 /* standing on something in a shop and chatting causes the shopkeeper
1282 to describe the price(s). This can inhibit other chatting inside
1283 a shop, but that shouldn't matter much. shop_object() returns an
1284 object iff inside a shop and the shopkeeper is present and willing
1285 (not angry) and able (not asleep) to speak and the position
1286 contains any objects other than just gold.
1287 */
1288 price_quote(otmp);
1289 return ECMD_TIME;
1290 }
1291
1292 if (!getdir("Talk to whom? (in what direction)")) {
1293 /* decided not to chat */
1294 return ECMD_CANCEL;
1295 }
1296
1297 if (u.usteed && u.dz > 0) {
1298 if (helpless(u.usteed)) {
1299 pline("%s seems not to notice you.", Monnam(u.usteed));
1300 return ECMD_TIME;
1301 } else
1302 return domonnoise(u.usteed);
1303 }
1304
1305 if (u.dz) {
1306 pline("They won't hear you %s there.", u.dz < 0 ? "up" : "down");
1307 return ECMD_OK;
1308 }
1309
1310 if (u.dx == 0 && u.dy == 0) {
1311 /*
1312 * Let's not include this.
1313 * It raises all sorts of questions: can you wear

Callers 1

dotalkFunction · 0.85

Calls 15

anFunction · 0.85
pmnameFunction · 0.85
You_cantFunction · 0.85
YourFunction · 0.85
shop_objectFunction · 0.85
price_quoteFunction · 0.85
getdirFunction · 0.85
MonnamFunction · 0.85
domonnoiseFunction · 0.85
isokFunction · 0.85
pline_TheFunction · 0.85
rndmonnamFunction · 0.85

Tested by

no test coverage detected